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

Commit

Permalink
v1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Aug 27, 2018
1 parent c0f986d commit fa27d92
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 68 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ $ npm install vue-fields
```

### CDN
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-fields@1.0.6) or [unpkg](https://unpkg.com/vue-fields@1.0.6).
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-fields@1.0.7) or [unpkg](https://unpkg.com/vue-fields@1.0.7).
```html
<script src="https://cdn.jsdelivr.net/npm/vue-fields@1.0.6"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-fields@1.0.7"></script>
```

## Changelog
Expand Down
51 changes: 30 additions & 21 deletions dist/vue-fields.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-fields v1.0.6
* vue-fields v1.0.7
* https://github.com/pagekit/vue-fields
* Released under the MIT License.
*/
Expand Down Expand Up @@ -83,15 +83,25 @@ function set(obj, key, val) {
_set(obj, parts.shift(), val);
}

function evaluate(self, expr, context) {
var parsedFunc = {};
var expressionRe = /((?:\d|true|false|null|undefined|(?:this\.|\$)[\S]+|\W)*)([\w][\w+.]*)?/g;
var quotedStringRe = /([^"']+)((.)(?:[^\3\\]|\\.)*?\3|.)?/g;

try {
return (Function('c', ("with(c){return " + expr + "}"))).call(self, context);
} catch (e) {
warn(e);
}
function parse(expr) {
return parsedFunc[expr] = parsedFunc[expr] ||
Function('$values', '$context', ("with($context){return " + (expr.replace(quotedStringRe,
function (match, unquoted, quoted) {
if ( quoted === void 0 ) quoted = '';

return unquoted.replace(expressionRe,
function (match, prefix, expression) {
if ( prefix === void 0 ) prefix = '';

return false;
return match ? ("" + prefix + (expression ? ("$get('" + expression + "')") : '')) : '';
}
) + quoted;
}
)) + "}"));
}

function each(obj, iterator) {
Expand Down Expand Up @@ -319,26 +329,25 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
}
},

evaluate: function evaluate$1(expr, values, config) {
evaluate: function evaluate(expression, values) {
if ( values === void 0 ) values = this.values;
if ( config === void 0 ) config = this.config;


if (isString(expr)) {

var context = {$match: $match, $values: values};
try {

each(config, function (ref, key) {
var name = ref.name; if ( name === void 0 ) name = key;

return set(context, name, get(values, name));
if (isString(expression)) {
expression = parse(expression);
}
);

return evaluate(this, expr, assign(context, values));
return expression.call(this, values, {
$match: $match, $get: function (key) { return get(values, key); }
});

} catch (e) {
warn(e);
}

return expr.call(this, values, this);
return true;
},

prepare: function prepare(config, prefix) {
Expand Down Expand Up @@ -409,7 +418,7 @@ var Plugin = {
Vue.component('fields', Fields);
},

version: '1.0.6'
version: '1.0.7'
};

if (typeof window !== 'undefined' && window.Vue) {
Expand Down
51 changes: 30 additions & 21 deletions dist/vue-fields.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-fields v1.0.6
* vue-fields v1.0.7
* https://github.com/pagekit/vue-fields
* Released under the MIT License.
*/
Expand Down Expand Up @@ -81,15 +81,25 @@ function set(obj, key, val) {
_set(obj, parts.shift(), val);
}

function evaluate(self, expr, context) {
var parsedFunc = {};
var expressionRe = /((?:\d|true|false|null|undefined|(?:this\.|\$)[\S]+|\W)*)([\w][\w+.]*)?/g;
var quotedStringRe = /([^"']+)((.)(?:[^\3\\]|\\.)*?\3|.)?/g;

try {
return (Function('c', ("with(c){return " + expr + "}"))).call(self, context);
} catch (e) {
warn(e);
}
function parse(expr) {
return parsedFunc[expr] = parsedFunc[expr] ||
Function('$values', '$context', ("with($context){return " + (expr.replace(quotedStringRe,
function (match, unquoted, quoted) {
if ( quoted === void 0 ) quoted = '';

return unquoted.replace(expressionRe,
function (match, prefix, expression) {
if ( prefix === void 0 ) prefix = '';

return false;
return match ? ("" + prefix + (expression ? ("$get('" + expression + "')") : '')) : '';
}
) + quoted;
}
)) + "}"));
}

function each(obj, iterator) {
Expand Down Expand Up @@ -317,26 +327,25 @@ var Fields = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_
}
},

evaluate: function evaluate$1(expr, values, config) {
evaluate: function evaluate(expression, values) {
if ( values === void 0 ) values = this.values;
if ( config === void 0 ) config = this.config;


if (isString(expr)) {

var context = {$match: $match, $values: values};
try {

each(config, function (ref, key) {
var name = ref.name; if ( name === void 0 ) name = key;

return set(context, name, get(values, name));
if (isString(expression)) {
expression = parse(expression);
}
);

return evaluate(this, expr, assign(context, values));
return expression.call(this, values, {
$match: $match, $get: function (key) { return get(values, key); }
});

} catch (e) {
warn(e);
}

return expr.call(this, values, this);
return true;
},

prepare: function prepare(config, prefix) {
Expand Down Expand Up @@ -407,7 +416,7 @@ var Plugin = {
Vue.component('fields', Fields);
},

version: '1.0.6'
version: '1.0.7'
};

if (typeof window !== 'undefined' && window.Vue) {
Expand Down
51 changes: 30 additions & 21 deletions dist/vue-fields.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-fields v1.0.6
* vue-fields v1.0.7
* https://github.com/pagekit/vue-fields
* Released under the MIT License.
*/
Expand Down Expand Up @@ -87,15 +87,25 @@
_set(obj, parts.shift(), val);
}

function evaluate(self, expr, context) {
var parsedFunc = {};
var expressionRe = /((?:\d|true|false|null|undefined|(?:this\.|\$)[\S]+|\W)*)([\w][\w+.]*)?/g;
var quotedStringRe = /([^"']+)((.)(?:[^\3\\]|\\.)*?\3|.)?/g;

try {
return (Function('c', ("with(c){return " + expr + "}"))).call(self, context);
} catch (e) {
warn(e);
}
function parse(expr) {
return parsedFunc[expr] = parsedFunc[expr] ||
Function('$values', '$context', ("with($context){return " + (expr.replace(quotedStringRe,
function (match, unquoted, quoted) {
if ( quoted === void 0 ) quoted = '';

return unquoted.replace(expressionRe,
function (match, prefix, expression) {
if ( prefix === void 0 ) prefix = '';

return false;
return match ? ("" + prefix + (expression ? ("$get('" + expression + "')") : '')) : '';
}
) + quoted;
}
)) + "}"));
}

function each(obj, iterator) {
Expand Down Expand Up @@ -323,26 +333,25 @@
}
},

evaluate: function evaluate$1(expr, values, config) {
evaluate: function evaluate(expression, values) {
if ( values === void 0 ) values = this.values;
if ( config === void 0 ) config = this.config;


if (isString(expr)) {

var context = {$match: $match, $values: values};
try {

each(config, function (ref, key) {
var name = ref.name; if ( name === void 0 ) name = key;

return set(context, name, get(values, name));
if (isString(expression)) {
expression = parse(expression);
}
);

return evaluate(this, expr, assign(context, values));
return expression.call(this, values, {
$match: $match, $get: function (key) { return get(values, key); }
});

} catch (e) {
warn(e);
}

return expr.call(this, values, this);
return true;
},

prepare: function prepare(config, prefix) {
Expand Down Expand Up @@ -413,7 +422,7 @@
Vue.component('fields', Fields);
},

version: '1.0.6'
version: '1.0.7'
};

if (typeof window !== 'undefined' && window.Vue) {
Expand Down
Loading

0 comments on commit fa27d92

Please sign in to comment.