Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 921a53e

Browse files
author
Steffan
committed
v1.0.3
1 parent ab82a76 commit 921a53e

7 files changed

+295
-307
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ $ npm install vue-fields
1616
```
1717

1818
### CDN
19-
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected].2) or [unpkg](https://unpkg.com/[email protected].2).
19+
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected].3) or [unpkg](https://unpkg.com/[email protected].3).
2020
```html
21-
<script src="https://cdn.jsdelivr.net/npm/[email protected].2"></script>
21+
<script src="https://cdn.jsdelivr.net/npm/[email protected].3"></script>
2222
```
2323

2424
## Changelog

dist/vue-fields.common.js

+16-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-fields v1.0.2
2+
* vue-fields v1.0.3
33
* https://github.com/pagekit/vue-fields
44
* Released under the MIT License.
55
*/
@@ -10,8 +10,7 @@
1010
* Utility functions.
1111
*/
1212

13-
var debug = false;
14-
var _set;
13+
var debug = false, _set;
1514

1615
var isArray = Array.isArray;
1716

@@ -40,9 +39,9 @@ function isUndefined(val) {
4039

4140
function get(obj, key, def) {
4241

43-
var parts = key.split('.'), i;
42+
var parts = key.split('.');
4443

45-
for (i = 0; i < parts.length; i++) {
44+
for (var i = 0; i < parts.length; i++) {
4645
if (!isUndefined(obj[parts[i]])) {
4746
obj = obj[parts[i]];
4847
} else {
@@ -55,11 +54,11 @@ function get(obj, key, def) {
5554

5655
function set(obj, key, val) {
5756

58-
var parts = key.split('.'), part;
57+
var parts = key.split('.');
5958

6059
while (parts.length > 1) {
6160

62-
part = parts.shift();
61+
var part = parts.shift();
6362

6463
if (!isObject(obj[part]) || isArray(obj[part])) {
6564
_set(obj, part, {});
@@ -118,7 +117,7 @@ var assign = Object.assign || function (target) {
118117

119118
var Field = {
120119

121-
inject: ['fields'],
120+
inject: ['Fields'],
122121

123122
props: {
124123

@@ -162,7 +161,7 @@ var Field = {
162161

163162
get: function get$$1() {
164163

165-
if (this.enable && !this.fields.evaluate(this.enable)) {
164+
if (this.enable && !this.Fields.evaluate(this.enable)) {
166165
return assign({disabled: 'true'}, this.attrs);
167166
}
168167

@@ -221,7 +220,7 @@ var FieldTextarea = {render: function(){var _vm=this;var _h=_vm.$createElement;v
221220

222221
};
223222

224-
var FieldRadio = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.filterOptions(_vm.options)),function(option){return [_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.value),expression:"value"}],attrs:{"type":"radio","name":_vm.name},domProps:{"value":option.value,"checked":_vm._q(_vm.value,option.value)},on:{"change":function($event){_vm.value=option.value;}}},'input',_vm.attributes,false)),_vm._v(" "),_c('label',[_vm._v(_vm._s(option.text))])]})],2)},staticRenderFns: [],
223+
var FieldRadio = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.filterOptions(_vm.options)),function(option){return [_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.value),expression:"value"}],attrs:{"name":_vm.name,"type":"radio"},domProps:{"value":option.value,"checked":_vm._q(_vm.value,option.value)},on:{"change":function($event){_vm.value=option.value;}}},'input',_vm.attributes,false)),_vm._v(" "),_c('label',[_vm._v(_vm._s(option.text))])]})],2)},staticRenderFns: [],
225224

226225
extends: Field
227226

@@ -264,16 +263,14 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
264263
},
265264

266265
provide: function provide() {
267-
return {
268-
fields: this
269-
};
266+
return {Fields: this};
270267
},
271268

272269
props: {
273270

274271
config: {
275272
type: [Object, Array],
276-
required: true
273+
default: function () {}
277274
},
278275

279276
values: {
@@ -307,25 +304,24 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
307304
}
308305
},
309306

310-
evaluate: function evaluate$1(expr, data) {
307+
evaluate: function evaluate$1(expr, values) {
308+
if ( values === void 0 ) values = this.values;
311309

312-
data = data || this.values;
313310

314311
if (isString(expr)) {
315-
return evaluate(expr, assign({$match: $match}, data));
312+
return evaluate(expr, assign({$match: $match}, values));
316313
}
317314

318-
return expr.call(this, data, this);
315+
return expr.call(this, values, this);
319316
},
320317

321318
prepare: function prepare(config, prefix) {
322319
var this$1 = this;
320+
if ( prefix === void 0 ) prefix = this.prefix;
323321

324322

325323
var arr = isArray(config), fields = [];
326324

327-
prefix = prefix || this.prefix;
328-
329325
each(config, function (field, name) {
330326

331327
field = assign({}, field);

dist/vue-fields.esm.js

+16-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-fields v1.0.2
2+
* vue-fields v1.0.3
33
* https://github.com/pagekit/vue-fields
44
* Released under the MIT License.
55
*/
@@ -8,8 +8,7 @@
88
* Utility functions.
99
*/
1010

11-
var debug = false;
12-
var _set;
11+
var debug = false, _set;
1312

1413
var isArray = Array.isArray;
1514

@@ -38,9 +37,9 @@ function isUndefined(val) {
3837

3938
function get(obj, key, def) {
4039

41-
var parts = key.split('.'), i;
40+
var parts = key.split('.');
4241

43-
for (i = 0; i < parts.length; i++) {
42+
for (var i = 0; i < parts.length; i++) {
4443
if (!isUndefined(obj[parts[i]])) {
4544
obj = obj[parts[i]];
4645
} else {
@@ -53,11 +52,11 @@ function get(obj, key, def) {
5352

5453
function set(obj, key, val) {
5554

56-
var parts = key.split('.'), part;
55+
var parts = key.split('.');
5756

5857
while (parts.length > 1) {
5958

60-
part = parts.shift();
59+
var part = parts.shift();
6160

6261
if (!isObject(obj[part]) || isArray(obj[part])) {
6362
_set(obj, part, {});
@@ -116,7 +115,7 @@ var assign = Object.assign || function (target) {
116115

117116
var Field = {
118117

119-
inject: ['fields'],
118+
inject: ['Fields'],
120119

121120
props: {
122121

@@ -160,7 +159,7 @@ var Field = {
160159

161160
get: function get$$1() {
162161

163-
if (this.enable && !this.fields.evaluate(this.enable)) {
162+
if (this.enable && !this.Fields.evaluate(this.enable)) {
164163
return assign({disabled: 'true'}, this.attrs);
165164
}
166165

@@ -219,7 +218,7 @@ var FieldTextarea = {render: function(){var _vm=this;var _h=_vm.$createElement;v
219218

220219
};
221220

222-
var FieldRadio = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.filterOptions(_vm.options)),function(option){return [_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.value),expression:"value"}],attrs:{"type":"radio","name":_vm.name},domProps:{"value":option.value,"checked":_vm._q(_vm.value,option.value)},on:{"change":function($event){_vm.value=option.value;}}},'input',_vm.attributes,false)),_vm._v(" "),_c('label',[_vm._v(_vm._s(option.text))])]})],2)},staticRenderFns: [],
221+
var FieldRadio = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.filterOptions(_vm.options)),function(option){return [_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.value),expression:"value"}],attrs:{"name":_vm.name,"type":"radio"},domProps:{"value":option.value,"checked":_vm._q(_vm.value,option.value)},on:{"change":function($event){_vm.value=option.value;}}},'input',_vm.attributes,false)),_vm._v(" "),_c('label',[_vm._v(_vm._s(option.text))])]})],2)},staticRenderFns: [],
223222

224223
extends: Field
225224

@@ -262,16 +261,14 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
262261
},
263262

264263
provide: function provide() {
265-
return {
266-
fields: this
267-
};
264+
return {Fields: this};
268265
},
269266

270267
props: {
271268

272269
config: {
273270
type: [Object, Array],
274-
required: true
271+
default: function () {}
275272
},
276273

277274
values: {
@@ -305,25 +302,24 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
305302
}
306303
},
307304

308-
evaluate: function evaluate$1(expr, data) {
305+
evaluate: function evaluate$1(expr, values) {
306+
if ( values === void 0 ) values = this.values;
309307

310-
data = data || this.values;
311308

312309
if (isString(expr)) {
313-
return evaluate(expr, assign({$match: $match}, data));
310+
return evaluate(expr, assign({$match: $match}, values));
314311
}
315312

316-
return expr.call(this, data, this);
313+
return expr.call(this, values, this);
317314
},
318315

319316
prepare: function prepare(config, prefix) {
320317
var this$1 = this;
318+
if ( prefix === void 0 ) prefix = this.prefix;
321319

322320

323321
var arr = isArray(config), fields = [];
324322

325-
prefix = prefix || this.prefix;
326-
327323
each(config, function (field, name) {
328324

329325
field = assign({}, field);

0 commit comments

Comments
 (0)