Browse Source

国际化处理把参数个数判断放到前面

es6
qcc 6 years ago
parent
commit
36ed47ca35
  1. 78
      dist/bundle.ie.js
  2. 10
      dist/bundle.ie.min.js
  3. 20
      dist/bundle.js
  4. 6
      dist/bundle.min.js
  5. 20
      dist/core.js
  6. 78
      dist/fineui.ie.js
  7. 8
      dist/fineui.ie.min.js
  8. 20
      dist/fineui.js
  9. 4
      dist/fineui.min.js
  10. 20
      dist/fineui_without_jquery_polyfill.js
  11. 20
      dist/utils.js
  12. 6
      dist/utils.min.js
  13. 20
      src/core/base.js

78
dist/bundle.ie.js vendored

@ -10154,22 +10154,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {
@ -34229,7 +34229,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var model = vm; var model = vm;
if (!model.addWatch && model.$vm) { if (!model.$watch && model.$vm) {
model = model.$vm; model = model.$vm;
} }
if (isPlainObject(cb)) { if (isPlainObject(cb)) {
@ -34243,7 +34243,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
options.user = true; options.user = true;
var exps = void 0; var exps = void 0;
if (_$1.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { if (_$1.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) {
model.addWatch(expOrFn, cb, options); model.$watch(expOrFn, cb, options);
return []; return [];
} }
@ -34298,7 +34298,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return result; return result;
}; };
model.addWatch(getter, function (newValue, oldValue, attrs) { model.$watch(getter, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, _$1.extend(options, { }, _$1.extend(options, {
deep: isGlobal deep: isGlobal
@ -34342,13 +34342,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return currentModels; return currentModels;
}; };
model.addWatch(_getter, function (newValue, oldValue, attrs) { model.$watch(_getter, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, options); }, options);
return; return;
} }
model.addWatch(exp, function (newValue, oldValue, attrs) { model.$watch(exp, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, options); }, options);
}); });
@ -34480,26 +34480,37 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var allModelInstances = {}; var allModelInstances = {};
var emptyFn = function emptyFn() {}; var emptyFn = function emptyFn() {};
var Watcher = function Watcher(_ref) { var Watcher = function () {
var get = _ref.get, function Watcher(_ref) {
last = _ref.last, var get = _ref.get,
listener = _ref.listener, last = _ref.last,
sync = _ref.sync, listener = _ref.listener,
deep = _ref.deep; sync = _ref.sync,
deep = _ref.deep;
_classCallCheck(this, Watcher); _classCallCheck(this, Watcher);
this.get = get; this.get = get;
this.last = cloneShadow(last); this.last = cloneShadow(last);
this.listener = listener || emptyFn; this.listener = listener || emptyFn;
this.sync = sync || false; this.sync = sync || false;
return { return {
get: this.get, get: this.get,
last: this.last, last: this.last,
listener: this.listener listener: this.listener
};
}
// 不要去掉,为了兼容IE8,IE8下instance of Constructor如果不绑定函数会出错
Watcher.prototype.getInstance = function getInstance() {
return this;
}; };
};
return Watcher;
}();
function initState(vm, state) { function initState(vm, state) {
var watchers = vm._stateWatchers = {}; var watchers = vm._stateWatchers = {};
@ -34621,7 +34632,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var p = vm._parent; var p = vm._parent;
while (p) { while (p) {
if (p.childContext && p.childContext.indexOf(key) > -1) { if (p.childContext && p.childContext.indexOf(key) > -1) {
p.addWatch(key, function (cur, last, p) { p.$watch(key, function (cur, last, p) {
if (!vm.alive) return; if (!vm.alive) return;
vm.model[key] = cur; vm.model[key] = cur;
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同) vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
@ -34742,6 +34753,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watchers = [].concat(vm._watchers); var watchers = [].concat(vm._watchers);
_$1.each(watchers, function (watcher) { _$1.each(watchers, function (watcher) {
if (!watcher) return;
var cur = watcher.get(); var cur = watcher.get();
var last = watcher.last; var last = watcher.last;
@ -34809,7 +34821,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
Model.prototype._init = function _init() {}; Model.prototype._init = function _init() {};
Model.prototype.addWatch = function addWatch(expOrFn, cb, options) { Model.prototype.$watch = function $watch(expOrFn, cb, options) {
var watcher = createWatcher(this, expOrFn, cb, options); var watcher = createWatcher(this, expOrFn, cb, options);
this._watchers.push(watcher); this._watchers.push(watcher);
}; };

10
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/bundle.js vendored

@ -10154,22 +10154,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

6
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/core.js vendored

@ -10154,22 +10154,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

78
dist/fineui.ie.js vendored

@ -10396,22 +10396,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {
@ -34471,7 +34471,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var model = vm; var model = vm;
if (!model.addWatch && model.$vm) { if (!model.$watch && model.$vm) {
model = model.$vm; model = model.$vm;
} }
if (isPlainObject(cb)) { if (isPlainObject(cb)) {
@ -34485,7 +34485,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
options.user = true; options.user = true;
var exps = void 0; var exps = void 0;
if (_$1.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { if (_$1.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) {
model.addWatch(expOrFn, cb, options); model.$watch(expOrFn, cb, options);
return []; return [];
} }
@ -34540,7 +34540,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return result; return result;
}; };
model.addWatch(getter, function (newValue, oldValue, attrs) { model.$watch(getter, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, _$1.extend(options, { }, _$1.extend(options, {
deep: isGlobal deep: isGlobal
@ -34584,13 +34584,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return currentModels; return currentModels;
}; };
model.addWatch(_getter, function (newValue, oldValue, attrs) { model.$watch(_getter, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, options); }, options);
return; return;
} }
model.addWatch(exp, function (newValue, oldValue, attrs) { model.$watch(exp, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs)); callback(i, newValue, oldValue, _$1.extend({ index: i }, attrs));
}, options); }, options);
}); });
@ -34722,26 +34722,37 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var allModelInstances = {}; var allModelInstances = {};
var emptyFn = function emptyFn() {}; var emptyFn = function emptyFn() {};
var Watcher = function Watcher(_ref) { var Watcher = function () {
var get = _ref.get, function Watcher(_ref) {
last = _ref.last, var get = _ref.get,
listener = _ref.listener, last = _ref.last,
sync = _ref.sync, listener = _ref.listener,
deep = _ref.deep; sync = _ref.sync,
deep = _ref.deep;
_classCallCheck(this, Watcher); _classCallCheck(this, Watcher);
this.get = get; this.get = get;
this.last = cloneShadow(last); this.last = cloneShadow(last);
this.listener = listener || emptyFn; this.listener = listener || emptyFn;
this.sync = sync || false; this.sync = sync || false;
return { return {
get: this.get, get: this.get,
last: this.last, last: this.last,
listener: this.listener listener: this.listener
};
}
// 不要去掉,为了兼容IE8,IE8下instance of Constructor如果不绑定函数会出错
Watcher.prototype.getInstance = function getInstance() {
return this;
}; };
};
return Watcher;
}();
function initState(vm, state) { function initState(vm, state) {
var watchers = vm._stateWatchers = {}; var watchers = vm._stateWatchers = {};
@ -34863,7 +34874,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var p = vm._parent; var p = vm._parent;
while (p) { while (p) {
if (p.childContext && p.childContext.indexOf(key) > -1) { if (p.childContext && p.childContext.indexOf(key) > -1) {
p.addWatch(key, function (cur, last, p) { p.$watch(key, function (cur, last, p) {
if (!vm.alive) return; if (!vm.alive) return;
vm.model[key] = cur; vm.model[key] = cur;
vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同) vm._contextWatchers[key].last = cloneShadow(cur); // 避免重复调用(可以改成给watch添加一个参数保证下次比较一定相同)
@ -34984,6 +34995,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var watchers = [].concat(vm._watchers); var watchers = [].concat(vm._watchers);
_$1.each(watchers, function (watcher) { _$1.each(watchers, function (watcher) {
if (!watcher) return;
var cur = watcher.get(); var cur = watcher.get();
var last = watcher.last; var last = watcher.last;
@ -35051,7 +35063,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
Model.prototype._init = function _init() {}; Model.prototype._init = function _init() {};
Model.prototype.addWatch = function addWatch(expOrFn, cb, options) { Model.prototype.$watch = function $watch(expOrFn, cb, options) {
var watcher = createWatcher(this, expOrFn, cb, options); var watcher = createWatcher(this, expOrFn, cb, options);
this._watchers.push(watcher); this._watchers.push(watcher);
}; };

8
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/fineui.js vendored

@ -10396,22 +10396,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/fineui_without_jquery_polyfill.js vendored

@ -10154,22 +10154,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

20
dist/utils.js vendored

@ -10916,22 +10916,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

6
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

20
src/core/base.js

@ -43,22 +43,22 @@ if (!_global.BI) {
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
if (localeText.indexOf("{R1}") > -1) { var len = arguments.length;
var len = arguments.length; if (len > 1) {
if (len > 1) { if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + ""); localeText = BI.replaceAll(localeText, key, arguments[i] + "");
} }
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
} }
return localeText;
}, },
assert: function (v, is) { assert: function (v, is) {

Loading…
Cancel
Save