Browse Source

Pull request #2861: KERNEL-11634 refactor: npm引入的fineui不该有window.$和window._,避免冲突

Merge in VISUAL/fineui from ~ZHENFEI.LI/fineui:master to master

* commit '3ac0b7d2077356a569e08ca51933b15418785805':
  KERNEL-11634 refactor: npm引入的fineui不该有window.$和window._,避免冲突
es6
Zhenfei.Li 3 years ago
parent
commit
dbeb00756e
  1. 4
      dist/fix/fix.compact.js
  2. 90
      dist/fix/fix.js
  3. 97
      dist/fix/fix.proxy.js
  4. 2
      package.json
  5. 4
      src/core/1.lodash.js
  6. 72
      src/core/2.base.js
  7. 16
      src/core/3.ob.js
  8. 7
      src/core/conflict.js
  9. 2
      src/core/constant/events.js
  10. 2
      src/core/constant/var.js
  11. 4
      src/core/func/alias.js
  12. 2
      src/core/func/array.js
  13. 2
      src/core/func/date.js
  14. 4
      src/core/func/function.js
  15. 2
      src/core/func/number.js
  16. 4
      src/core/func/string.js
  17. 2
      src/core/platform/web/function.js
  18. 4
      src/core/platform/web/jquery/_jquery.js
  19. 2
      src/core/platform/web/load.js
  20. 4
      src/core/plugin.js
  21. 2
      src/core/structure/aes.js
  22. 2
      src/core/structure/base64.js
  23. 2
      src/core/utils/chinesePY.js
  24. 2
      src/core/utils/i18n.js
  25. 6
      src/core/wrapper/layout.js
  26. 32
      src/router/0.router.js
  27. 2
      test/utils.js
  28. 25
      webpack/attachments.js
  29. 1
      webpack/webpack.prod.js

4
dist/fix/fix.compact.js vendored

@ -38,7 +38,7 @@
cb = cb.handler; cb = cb.handler;
} }
options = options || {}; options = options || {};
return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, { return Fix.watch(vm.model, keyOrFn, BI._.bind(cb, vm), BI.extend(options, {
store: vm.store store: vm.store
})); }));
} }
@ -177,7 +177,7 @@
delete this.__cacheStore; delete this.__cacheStore;
}; };
_.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) { BI._.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name]; var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () { old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store); this.store && pushTarget(this.store);

90
dist/fix/fix.js vendored

@ -431,7 +431,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Deep watchers and watchers on Object/Arrays should fire even // Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may // when the value is the same, because the value may
// have mutated. // have mutated.
_.isObject(value) && options && options.refresh || this.deep) { BI._.isObject(value) && options && options.refresh || this.deep) {
// set new value // set new value
var oldValue = this.value; var oldValue = this.value;
this.value = value; this.value = value;
@ -491,8 +491,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function _traverse(val, seen) { function _traverse(val, seen) {
var i = void 0, var i = void 0,
keys = void 0; keys = void 0;
var isA = _.isArray(val); var isA = BI._.isArray(val);
if (!isA && !_.isObject(val)) { if (!isA && !BI._.isObject(val)) {
return; return;
} }
if (val.__ob__) { if (val.__ob__) {
@ -508,7 +508,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_traverse(val[i], seen); _traverse(val[i], seen);
} }
} else { } else {
keys = _.keys(val); keys = BI._.keys(val);
i = keys.length; i = keys.length;
while (i--) { while (i--) {
_traverse(val[keys[i]], seen); _traverse(val[keys[i]], seen);
@ -518,7 +518,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var arrayProto = Array.prototype; var arrayProto = Array.prototype;
var arrayMethods = []; var arrayMethods = [];
_.each(['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'], function (method) { BI._.each(['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'], function (method) {
var original = arrayProto[method]; var original = arrayProto[method];
arrayMethods[method] = function mutator() { arrayMethods[method] = function mutator() {
for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) {
@ -554,7 +554,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}; };
}); });
var arrayKeys = _.keys(arrayMethods); var arrayKeys = BI._.keys(arrayMethods);
var observerState = { var observerState = {
shouldConvert: true shouldConvert: true
@ -583,7 +583,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.value = value; this.value = value;
this.dep = new Dep(); this.dep = new Dep();
this.vmCount = 0; this.vmCount = 0;
if (_.isArray(value)) { if (BI._.isArray(value)) {
var augment = hasProto ? protoAugment : copyAugment; var augment = hasProto ? protoAugment : copyAugment;
augment(value, arrayMethods, arrayKeys); augment(value, arrayMethods, arrayKeys);
this.model = this.observeArray(value); this.model = this.observeArray(value);
@ -623,13 +623,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
function observe(value, parentObserver, parentKey) { function observe(value, parentObserver, parentKey) {
if (!_.isObject(value)) { if (!BI._.isObject(value)) {
return; return;
} }
var ob = void 0; var ob = void 0;
if (value.__ob__ instanceof Observer) { if (value.__ob__ instanceof Observer) {
ob = value.__ob__; ob = value.__ob__;
} else if (observerState.shouldConvert && isExtensible(value) && (_.isArray(value) || isPlainObject(value))) { } else if (observerState.shouldConvert && isExtensible(value) && (BI._.isArray(value) || isPlainObject(value))) {
ob = new Observer(value); ob = new Observer(value);
} }
if (ob) { if (ob) {
@ -643,7 +643,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.notify({ observer: observer, key: key, refresh: refresh }); dep.notify({ observer: observer, key: key, refresh: refresh });
if (observer) { if (observer) {
//触发a.*绑定的依赖 //触发a.*绑定的依赖
_.each(observer._deps, function (dep) { BI._.each(observer._deps, function (dep) {
dep.notify({ observer: observer, key: key }); dep.notify({ observer: observer, key: key });
}); });
//触发a.**绑定的依赖 //触发a.**绑定的依赖
@ -651,7 +651,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
root = observer, root = observer,
route = key || ""; route = key || "";
while (parent) { while (parent) {
_.each(parent._scopeDeps, function (dep) { BI._.each(parent._scopeDeps, function (dep) {
dep.notify({ observer: observer, key: key }); dep.notify({ observer: observer, key: key });
}); });
if (parent.parentKey != null) { if (parent.parentKey != null) {
@ -674,7 +674,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function defineReactive(obj, observer, shallow) { function defineReactive(obj, observer, shallow) {
var props = {}; var props = {};
var model = void 0; var model = void 0;
_.each(obj, function (val, key) { BI._.each(obj, function (val, key) {
if (key in $$skipArray) { if (key in $$skipArray) {
return; return;
} }
@ -691,7 +691,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend(); dep.depend();
if (childOb) { if (childOb) {
childOb.dep.depend(); childOb.dep.depend();
if (_.isArray(value)) { if (BI._.isArray(value)) {
dependArray(value); dependArray(value);
} }
} }
@ -740,7 +740,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend(); dep.depend();
if (childOb) { if (childOb) {
childOb.dep.depend(); childOb.dep.depend();
if (_.isArray(value)) { if (BI._.isArray(value)) {
dependArray(value); dependArray(value);
} }
} }
@ -767,12 +767,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* already exist. * already exist.
*/ */
function set(target, key, val) { function set(target, key, val) {
if (_.isArray(target)) { if (BI._.isArray(target)) {
target.length = Math.max(target.length, key); target.length = Math.max(target.length, key);
target.splice(key, 1, val); target.splice(key, 1, val);
return val; return val;
} }
if (_.has(target, key)) { if (BI._.has(target, key)) {
target[key] = val; target[key] = val;
return val; return val;
} }
@ -795,12 +795,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* Delete a property and trigger change if necessary. * Delete a property and trigger change if necessary.
*/ */
function del(target, key) { function del(target, key) {
if (_.isArray(target)) { if (BI._.isArray(target)) {
target.splice(key, 1); target.splice(key, 1);
return; return;
} }
var ob = target.__ob__; var ob = target.__ob__;
if (!_.has(target, key)) { if (!BI._.has(target, key)) {
return; return;
} }
if (!ob) { if (!ob) {
@ -821,7 +821,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
for (var e, i = 0, l = value.length; i < l; i++) { for (var e, i = 0, l = value.length; i < l; i++) {
e = value[i]; e = value[i];
e && e.__ob__ && e.__ob__.dep.depend(); e && e.__ob__ && e.__ob__.dep.depend();
if (_.isArray(e)) { if (BI._.isArray(e)) {
dependArray(e); dependArray(e);
} }
} }
@ -838,7 +838,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function runBinaryFunction(binarys) { function runBinaryFunction(binarys) {
var expr = ''; var expr = '';
for (var i = 0, len = binarys.length; i < len; i++) { for (var i = 0, len = binarys.length; i < len; i++) {
if (_.isBoolean(binarys[i]) || _.has(operators, binarys[i])) { if (BI._.isBoolean(binarys[i]) || BI._.has(operators, binarys[i])) {
expr += binarys[i]; expr += binarys[i];
} else { } else {
expr += 'false'; expr += 'false';
@ -863,7 +863,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
options = options || {}; options = options || {};
options.user = true; options.user = true;
var exps = void 0; var exps = void 0;
if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && expOrFn.indexOf("*") < 0) { if (BI._.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9BI._.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && expOrFn.indexOf("*") < 0) {
var watcher = new Watcher(model, expOrFn, cb, options); var watcher = new Watcher(model, expOrFn, cb, options);
if (options.immediate) { if (options.immediate) {
cb(watcher.value); cb(watcher.value);
@ -900,8 +900,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
} }
}; };
_.each(exps, function (exp, i) { BI._.each(exps, function (exp, i) {
if (_.has(operators, exp)) { if (BI._.has(operators, exp)) {
return; return;
} }
if (exp.indexOf("*") >= 0) { if (exp.indexOf("*") >= 0) {
@ -929,7 +929,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_dep.depend(); _dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue, attrs) { }, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
_w.teardown(); _w.teardown();
@ -955,7 +955,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _regStr = routeToRegExp(exp); var _regStr = routeToRegExp(exp);
var _dep2 = new Dep(); var _dep2 = new Dep();
_root._globalDeps || (_root._globalDeps = {}); _root._globalDeps || (_root._globalDeps = {});
if (_.isArray(_root._globalDeps[_regStr])) { if (BI._.isArray(_root._globalDeps[_regStr])) {
_root._globalDeps[_regStr].push(_dep2); _root._globalDeps[_regStr].push(_dep2);
} else { } else {
_root._globalDeps[_regStr] = [_dep2]; _root._globalDeps[_regStr] = [_dep2];
@ -965,7 +965,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_dep2.depend(); _dep2.depend();
return NaN; return NaN;
}, function (newValue, oldValue, attrs) { }, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
if (_root._globalDeps) { if (_root._globalDeps) {
@ -1005,7 +1005,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var regStr = routeToRegExp(exp); var regStr = routeToRegExp(exp);
var dep = new Dep(); var dep = new Dep();
root._globalDeps || (root._globalDeps = {}); root._globalDeps || (root._globalDeps = {});
if (_.isArray(root._globalDeps[regStr])) { if (BI._.isArray(root._globalDeps[regStr])) {
root._globalDeps[regStr].push(dep); root._globalDeps[regStr].push(dep);
} else { } else {
root._globalDeps[regStr] = [dep]; root._globalDeps[regStr] = [dep];
@ -1015,7 +1015,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend(); dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue, attrs) { }, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
if (root._globalDeps) { if (root._globalDeps) {
@ -1029,7 +1029,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return; return;
} }
var watcher = new Watcher(model, exp, function (newValue, oldValue, attrs) { var watcher = new Watcher(model, exp, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
watcher.teardown(); watcher.teardown();
@ -1045,7 +1045,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
function mixin(xtype, cls) { function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls); mixinInjection[xtype] = BI._.cloneDeep(cls);
} }
var computedWatcherOptions = { lazy: true }; var computedWatcherOptions = { lazy: true };
@ -1119,7 +1119,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
vm._watchers || (vm._watchers = []); vm._watchers || (vm._watchers = []);
for (var key in watch$$1) { for (var key in watch$$1) {
var handler = watch$$1[key]; var handler = watch$$1[key];
if (_.isArray(handler)) { if (BI._.isArray(handler)) {
for (var i = 0; i < handler.length; i++) { for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i])); vm._watchers.push(createWatcher(vm, key, handler[i]));
} }
@ -1137,27 +1137,27 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (typeof cb === 'string') { if (typeof cb === 'string') {
cb = vm[cb]; cb = vm[cb];
} }
return watch(vm.model, keyOrFn, _.bind(cb, vm.$$model ? vm.model : vm), options); return watch(vm.model, keyOrFn, BI._.bind(cb, vm.$$model ? vm.model : vm), options);
} }
function initMethods(vm, methods) { function initMethods(vm, methods) {
for (var key in methods) { for (var key in methods) {
vm[key] = methods[key] == null ? noop : _.bind(methods[key], vm.$$model ? vm.model : vm); vm[key] = methods[key] == null ? noop : BI._.bind(methods[key], vm.$$model ? vm.model : vm);
} }
} }
function initMixins(vm, mixins) { function initMixins(vm, mixins) {
mixins = (mixins || []).slice(0); mixins = (mixins || []).slice(0);
_.each(mixins.reverse(), function (mixinType) { BI._.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType); var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) { for (var key in mixin$$1) {
if (typeof mixin$$1[key] !== "function") continue; if (typeof mixin$$1[key] !== "function") continue;
if (_.has(vm, key)) continue; if (BI._.has(vm, key)) continue;
vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm); vm[key] = BI._.bind(mixin$$1[key], vm.$$model ? vm.model : vm);
} }
}); });
} }
@ -1282,7 +1282,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function getInjectValues(vm) { function getInjectValues(vm) {
var inject = vm.inject || []; var inject = vm.inject || [];
var result = {}; var result = {};
_.each(inject, function (key) { BI._.each(inject, function (key) {
result[key] = getInjectValue(vm, key); result[key] = getInjectValue(vm, key);
}); });
return result; return result;
@ -1303,7 +1303,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.options = model || {}; this.options = model || {};
} }
this._parent = Model.target; this._parent = Model.target;
var state = _.isFunction(this.state) ? this.state() : this.state; var state = BI._.isFunction(this.state) ? this.state() : this.state;
var computed = this.computed; var computed = this.computed;
var context = this.context; var context = this.context;
var inject = this.inject; var inject = this.inject;
@ -1311,7 +1311,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var provide = this.provide; var provide = this.provide;
var watch$$1 = this.watch; var watch$$1 = this.watch;
var actions = this.actions; var actions = this.actions;
var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(inject || []).concat(context || []); var keys = BI._.keys(this.$$model).concat(BI._.keys(state)).concat(BI._.keys(computed)).concat(inject || []).concat(context || []);
var mixins = this.mixins; var mixins = this.mixins;
defineProps(this, keys); defineProps(this, keys);
// deprecated // deprecated
@ -1320,7 +1320,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.$$model && (this.model.__ob__ = this.$$model.__ob__); this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins); initMixins(this, mixins);
this.init(); this.init();
initState(this, _.extend(getInjectValues(this), state)); initState(this, BI._.extend(getInjectValues(this), state));
initComputed(this, computed); initComputed(this, computed);
REACTIVE && initWatch(this, watch$$1); REACTIVE && initWatch(this, watch$$1);
initMethods(this, actions); initMethods(this, actions);
@ -1341,9 +1341,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
for (var _key3 in this._computedWatchers) { for (var _key3 in this._computedWatchers) {
this._computedWatchers[_key3].teardown(); this._computedWatchers[_key3].teardown();
} }
_.each(this._watchers, function (unwatches) { BI._.each(this._watchers, function (unwatches) {
unwatches = _.isArray(unwatches) ? unwatches : [unwatches]; unwatches = BI._.isArray(unwatches) ? unwatches : [unwatches];
_.each(unwatches, function (unwatch) { BI._.each(unwatches, function (unwatch) {
unwatch(); unwatch();
}); });
}); });
@ -1373,7 +1373,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function toJSON(model) { function toJSON(model) {
var result = void 0; var result = void 0;
if (_.isArray(model)) { if (BI._.isArray(model)) {
result = []; result = [];
for (var i = 0, len = model.length; i < len; i++) { for (var i = 0, len = model.length; i < len; i++) {
result[i] = toJSON(model[i]); result[i] = toJSON(model[i]);
@ -1381,7 +1381,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} else if (model && isPlainObject(model)) { } else if (model && isPlainObject(model)) {
result = {}; result = {};
for (var _key4 in model) { for (var _key4 in model) {
if (!_.has($$skipArray, _key4)) { if (!BI._.has($$skipArray, _key4)) {
result[_key4] = toJSON(model[_key4]); result[_key4] = toJSON(model[_key4]);
} }
} }

97
dist/fix/fix.proxy.js vendored

@ -2,22 +2,16 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) : typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Fix = {})); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Fix = {}));
}(this, (function (exports) { 'use strict'; })(this, (function (exports) { 'use strict';
function _typeof(obj) { function _typeof(obj) {
"@babel/helpers - typeof"; "@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
_typeof = function (obj) {
return typeof obj; return typeof obj;
}; } : function (obj) {
} else { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
_typeof = function (obj) { }, _typeof(obj);
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
} }
function _classCallCheck(instance, Constructor) { function _classCallCheck(instance, Constructor) {
@ -39,6 +33,9 @@
function _createClass(Constructor, protoProps, staticProps) { function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps); if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor; return Constructor;
} }
@ -1631,7 +1628,7 @@
return mixinInjection[type]; return mixinInjection[type];
} }
function mixin(xtype, cls) { function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls); mixinInjection[xtype] = BI._.cloneDeep(cls);
} }
var queue = []; var queue = [];
@ -1710,7 +1707,7 @@
} }
function innerWatch(source, cb, options) { function innerWatch(source, cb, options) {
if (!_.isFunction(cb)) { if (!BI._.isFunction(cb)) {
console.warn("`watch(fn, options?)` signature has been moved to a separate API. " + "Use `watchEffect(fn, options?)` instead. `watch` now only " + "supports `watch(source, cb, options?) signature."); console.warn("`watch(fn, options?)` signature has been moved to a separate API. " + "Use `watchEffect(fn, options?)` instead. `watch` now only " + "supports `watch(source, cb, options?) signature.");
} }
@ -1775,21 +1772,21 @@
}; };
deep = true; deep = true;
} else if (_.isArray(source)) { } else if (BI._.isArray(source)) {
getter = function getter() { getter = function getter() {
return source.map(function (s) { return source.map(function (s) {
if (isRef(s)) { if (isRef(s)) {
return s.value; return s.value;
} else if (isReactive(s)) { } else if (isReactive(s)) {
return traverse(s); return traverse(s);
} else if (_.isFunction(s)) { } else if (BI._.isFunction(s)) {
return s.call(instance); return s.call(instance);
} else { } else {
warnInvalidSource(s); warnInvalidSource(s);
} }
}); });
}; };
} else if (_.isFunction(source)) { } else if (BI._.isFunction(source)) {
if (cb) { if (cb) {
// getter with cb // getter with cb
getter = function getter() { getter = function getter() {
@ -1831,7 +1828,7 @@
}; };
}; };
var oldValue = _.isArray(source) ? [] : INITIAL_WATCHER_VALUE; var oldValue = BI._.isArray(source) ? [] : INITIAL_WATCHER_VALUE;
var job = function job() { var job = function job() {
// 这里去掉的原因是,新增属性没有生效也会触发变化监听 // 这里去掉的原因是,新增属性没有生效也会触发变化监听
@ -1903,7 +1900,7 @@
function traverse(value) { function traverse(value) {
var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set(); var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
if (!_.isObject(value) || seen.has(value)) { if (!BI._.isObject(value) || seen.has(value)) {
return value; return value;
} }
@ -1911,7 +1908,7 @@
if (isRef(value)) { if (isRef(value)) {
traverse(value.value, seen); traverse(value.value, seen);
} else if (_.isArray(value)) { } else if (BI._.isArray(value)) {
for (var i = 0; i < value.length; i++) { for (var i = 0; i < value.length; i++) {
traverse(value[i], seen); traverse(value[i], seen);
} }
@ -1940,7 +1937,7 @@
var expr = ""; var expr = "";
for (var i = 0, len = binarys.length; i < len; i++) { for (var i = 0, len = binarys.length; i < len; i++) {
if (_.isBoolean(binarys[i]) || _.has(operators, binarys[i])) { if (BI._.isBoolean(binarys[i]) || BI._.has(operators, binarys[i])) {
expr += binarys[i]; expr += binarys[i];
} else { } else {
expr += "false"; expr += "false";
@ -1953,7 +1950,7 @@
function watchExp(model, getter) { function watchExp(model, getter) {
var result = getter.call(model, model); var result = getter.call(model, model);
if (_.isArray(result)) { if (BI._.isArray(result)) {
return result.concat(); return result.concat();
} }
@ -1974,14 +1971,14 @@
options.user = true; options.user = true;
var exps; var exps;
if (_.isFunction(expOrFn)) { if (BI._.isFunction(expOrFn)) {
var watcher = innerWatch(expOrFn, cb, options); var watcher = innerWatch(expOrFn, cb, options);
return function unwatchFn() { return function unwatchFn() {
watcher(); watcher();
}; };
} }
if (!(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { if (!(exps = expOrFn.match(/[a-zA-Z0-9BI._.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) {
var paths = expOrFn.split("."); var paths = expOrFn.split(".");
var prePaths = paths.slice(0, paths.length - 1); var prePaths = paths.slice(0, paths.length - 1);
var preGetter = parsePath(prePaths.join(".")); var preGetter = parsePath(prePaths.join("."));
@ -2030,8 +2027,8 @@
} }
}; };
_.each(exps, function (exp, i) { BI._.each(exps, function (exp, i) {
if (_.has(operators, exp)) { if (BI._.has(operators, exp)) {
return; return;
} }
@ -2079,14 +2076,14 @@
return watchExp(_v2, _getter); return watchExp(_v2, _getter);
}, function (newValue, oldValue) { }, function (newValue, oldValue) {
// a.** 在a变化的时候不会触发change // a.** 在a变化的时候不会触发change
if (!_.isArray(newValue) && oldValue !== newValue) { if (!BI._.isArray(newValue) && oldValue !== newValue) {
return; return;
} }
callback(i, NaN, NaN, _.extend({ callback(i, NaN, NaN, BI._.extend({
index: i index: i
})); }));
}, _.extend({ }, BI._.extend({
deep: true deep: true
}, options))); }, options)));
return; return;
@ -2145,11 +2142,11 @@
changes = []; changes = [];
if (newValue === true) { if (newValue === true) {
callback(i, NaN, NaN, _.extend({ callback(i, NaN, NaN, BI._.extend({
index: i index: i
})); }));
} }
}, _.extend({}, options, { }, BI._.extend({}, options, {
deep: true, deep: true,
onTrigger: function onTrigger(_ref) { onTrigger: function onTrigger(_ref) {
var target = _ref.target, var target = _ref.target,
@ -2167,7 +2164,7 @@
watchers.push(innerWatch(function () { watchers.push(innerWatch(function () {
return watchExp(model, getter); return watchExp(model, getter);
}, function (newValue, oldValue) { }, function (newValue, oldValue) {
callback(i, newValue, oldValue, _.extend({ callback(i, newValue, oldValue, BI._.extend({
index: i index: i
})); }));
}, options)); }, options));
@ -2188,7 +2185,7 @@
var $$computed = vm.$$computed = {}; var $$computed = vm.$$computed = {};
for (var key in c) { for (var key in c) {
$$computed[key] = computed(_.bind(c[key], vm)); $$computed[key] = computed(BI._.bind(c[key], vm));
} }
} }
@ -2198,7 +2195,7 @@
for (var key in watch) { for (var key in watch) {
var handler = watch[key]; var handler = watch[key];
if (_.isArray(handler)) { if (BI._.isArray(handler)) {
for (var i = 0; i < handler.length; i++) { for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i])); vm._watchers.push(createWatcher(vm, key, handler[i]));
} }
@ -2218,25 +2215,25 @@
cb = vm[cb]; cb = vm[cb];
} }
return watch(vm.model, keyOrFn, _.bind(cb, vm), options); return watch(vm.model, keyOrFn, BI._.bind(cb, vm), options);
} }
function initMethods(vm, methods) { function initMethods(vm, methods) {
for (var key in methods) { for (var key in methods) {
vm[key] = methods[key] == null ? noop : _.bind(methods[key], vm); vm[key] = methods[key] == null ? noop : BI._.bind(methods[key], vm);
} }
} }
function initMixins(vm, mixins) { function initMixins(vm, mixins) {
mixins = (mixins || []).slice(0); mixins = (mixins || []).slice(0);
_.each(mixins.reverse(), function (mixinType) { BI._.each(mixins.reverse(), function (mixinType) {
var mixin = getMixins(mixinType); var mixin = getMixins(mixinType);
for (var key in mixin) { for (var key in mixin) {
if (typeof mixin[key] !== "function") continue; if (typeof mixin[key] !== "function") continue;
if (_.has(vm, key)) continue; if (BI._.has(vm, key)) continue;
vm[key] = _.bind(mixin[key], vm); vm[key] = BI._.bind(mixin[key], vm);
} }
}); });
} }
@ -2329,7 +2326,7 @@
var inject = vm.inject || []; var inject = vm.inject || [];
var result = {}; var result = {};
_.each(inject, function (key) { BI._.each(inject, function (key) {
result[key] = getInjectValue(vm, key); result[key] = getInjectValue(vm, key);
}); });
@ -2346,7 +2343,7 @@
value: function _constructor(options, destroyHandler) { value: function _constructor(options, destroyHandler) {
this.options = options || {}; this.options = options || {};
this._parent = Model.target; this._parent = Model.target;
var state = _.isFunction(this.state) ? this.state() : this.state; var state = BI._.isFunction(this.state) ? this.state() : this.state;
var computed = this.computed; var computed = this.computed;
var context = this.context; var context = this.context;
var inject = this.inject; var inject = this.inject;
@ -2354,14 +2351,14 @@
var watch = this.watch; var watch = this.watch;
var actions = this.actions; var actions = this.actions;
_.keys(state).concat(_.keys(computed)).concat(inject || []).concat(context || []); BI._.keys(state).concat(BI._.keys(computed)).concat(inject || []).concat(context || []);
var mixins = this.mixins; var mixins = this.mixins;
defineProps(this); defineProps(this);
childContext && defineContext(this, childContext); childContext && defineContext(this, childContext);
initMixins(this, mixins); initMixins(this, mixins);
this.init(); this.init();
initState(this, _.extend(getInjectValues(this), state)); initState(this, BI._.extend(getInjectValues(this), state));
initComputed(this, computed); initComputed(this, computed);
REACTIVE && initWatch(this, watch); REACTIVE && initWatch(this, watch);
initMethods(this, actions); initMethods(this, actions);
@ -2379,10 +2376,10 @@
}, { }, {
key: "destroy", key: "destroy",
value: function destroy() { value: function destroy() {
_.each(this._watchers, function (unwatches) { BI._.each(this._watchers, function (unwatches) {
unwatches = _.isArray(unwatches) ? unwatches : [unwatches]; unwatches = BI._.isArray(unwatches) ? unwatches : [unwatches];
_.each(unwatches, function (unwatch) { BI._.each(unwatches, function (unwatch) {
unwatch(); unwatch();
}); });
}); });
@ -2398,7 +2395,7 @@
return Model; return Model;
}(); }();
function set(target, key, val) { function set(target, key, val) {
if (_.isArray(target)) { if (BI._.isArray(target)) {
target.length = Math.max(target.length, key); target.length = Math.max(target.length, key);
target.splice(key, 1, val); target.splice(key, 1, val);
return val; return val;
@ -2416,12 +2413,12 @@
return value; return value;
} }
function del(target, key) { function del(target, key) {
if (_.isArray(target)) { if (BI._.isArray(target)) {
target.splice(key, 1); target.splice(key, 1);
return; return;
} }
if (!_.has(target, key)) { if (!BI._.has(target, key)) {
return; return;
} }
@ -2441,7 +2438,7 @@
function toJSON(model) { function toJSON(model) {
var result; var result;
if (_.isArray(model)) { if (BI._.isArray(model)) {
result = []; result = [];
for (var i = 0, len = model.length; i < len; i++) { for (var i = 0, len = model.length; i < len; i++) {
@ -2475,4 +2472,4 @@
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
}))); }));

2
package.json

@ -2,7 +2,7 @@
"name": "fineui", "name": "fineui",
"version": "2.0.20220623215302", "version": "2.0.20220623215302",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.4", "@babel/core": "^7.17.4",

4
src/core/1.lodash.js

@ -10253,7 +10253,7 @@
// loaded by a script tag in the presence of an AMD loader. // loaded by a script tag in the presence of an AMD loader.
// See http://requirejs.org/docs/errors.html#mismatch for more details. // See http://requirejs.org/docs/errors.html#mismatch for more details.
// Use `_.noConflict` to remove Lodash from the global object. // Use `_.noConflict` to remove Lodash from the global object.
root._ = lodash; BI._ = lodash;
// Define as an anonymous module so, through path mapping, it can be // Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module. // referenced as the "underscore" module.
@ -10270,6 +10270,6 @@
} }
else { else {
// Export to the global object. // Export to the global object.
root._ = lodash; BI._ = lodash;
} }
}.call(this)); }.call(this));

72
src/core/2.base.js

@ -11,19 +11,19 @@
}; };
var _apply = function (name) { var _apply = function (name) {
return function () { return function () {
return _[name].apply(_, arguments); return BI._[name].apply(BI._, arguments);
}; };
}; };
var _applyFunc = function (name) { var _applyFunc = function (name) {
return function () { return function () {
var args = Array.prototype.slice.call(arguments, 0); var args = Array.prototype.slice.call(arguments, 0);
args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1]; args[1] = BI._.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1];
return _[name].apply(_, args); return BI._[name].apply(BI._, args);
}; };
}; };
// Utility // Utility
_.extend(BI, { BI._.extend(BI, {
assert: function (v, is) { assert: function (v, is) {
if (this.isFunction(is)) { if (this.isFunction(is)) {
if (!is(v)) { if (!is(v)) {
@ -146,10 +146,10 @@
}); });
// 集合相关方法 // 集合相关方法
_.each(["where", "findWhere", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) { BI._.each(["where", "findWhere", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) {
BI[name] = _apply(name); BI[name] = _apply(name);
}); });
_.each(["get", "set", "each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", BI._.each(["get", "set", "each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition", "clamp"], function (name) { "sortBy", "groupBy", "indexBy", "countBy", "partition", "clamp"], function (name) {
if (name === "any") { if (name === "any") {
BI[name] = _applyFunc("some"); BI[name] = _applyFunc("some");
@ -157,7 +157,7 @@
BI[name] = _applyFunc(name); BI[name] = _applyFunc(name);
} }
}); });
_.extend(BI, { BI._.extend(BI, {
// 数数 // 数数
count: function (from, to, predicate) { count: function (from, to, predicate) {
var t; var t;
@ -217,10 +217,10 @@
}).join(""); }).join("");
} }
if (BI.isArray(obj1)) { if (BI.isArray(obj1)) {
return _.concat.apply([], arguments); return BI._.concat.apply([], arguments);
} }
if (BI.isObject(obj1)) { if (BI.isObject(obj1)) {
return _.extend.apply({}, arguments); return BI._.extend.apply({}, arguments);
} }
}, },
@ -254,7 +254,7 @@
backFindKey: function (obj, predicate, context) { backFindKey: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context); predicate = BI.iteratee(predicate, context);
var keys = _.keys(obj), key; var keys = BI._.keys(obj), key;
for (var i = keys.length - 1; i >= 0; i--) { for (var i = keys.length - 1; i >= 0; i--) {
key = keys[i]; key = keys[i];
if (predicate(obj[key], key, obj)) { if (predicate(obj[key], key, obj)) {
@ -347,14 +347,14 @@
}); });
// 数组相关的方法 // 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", BI._.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name); BI[name] = _apply(name);
}); });
_.each(["findIndex", "findLastIndex"], function (name) { BI._.each(["findIndex", "findLastIndex"], function (name) {
BI[name] = _applyFunc(name); BI[name] = _applyFunc(name);
}); });
_.extend(BI, { BI._.extend(BI, {
// 构建一个长度为length的数组 // 构建一个长度为length的数组
makeArray: function (length, value) { makeArray: function (length, value) {
var res = []; var res = [];
@ -401,27 +401,27 @@
if (array == null) { if (array == null) {
return []; return [];
} }
if (!_.isBoolean(isSorted)) { if (!BI._.isBoolean(isSorted)) {
context = iteratee; context = iteratee;
iteratee = isSorted; iteratee = isSorted;
isSorted = false; isSorted = false;
} }
iteratee && (iteratee = traverse(iteratee, context)); iteratee && (iteratee = traverse(iteratee, context));
return _.uniq.call(_, array, isSorted, iteratee, context); return BI._.uniq.call(BI._, array, isSorted, iteratee, context);
} }
}); });
// 对象相关方法 // 对象相关方法
_.each(["keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn", BI._.each(["keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn",
"defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty", "defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty",
"isElement", "isNumber", "isString", "isArray", "isObject", "isPlainObject", "isArguments", "isFunction", "isFinite", "isElement", "isNumber", "isString", "isArray", "isObject", "isPlainObject", "isArguments", "isFunction", "isFinite",
"isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined", "zipObject", "cloneDeep"], function (name) { "isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined", "zipObject", "cloneDeep"], function (name) {
BI[name] = _apply(name); BI[name] = _apply(name);
}); });
_.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) { BI._.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) {
BI[name] = _applyFunc(name); BI[name] = _applyFunc(name);
}); });
_.extend(BI, { BI._.extend(BI, {
inherit: function (sp, overrides) { inherit: function (sp, overrides) {
var sb = function () { var sb = function () {
@ -432,7 +432,7 @@
F.prototype = spp; F.prototype = spp;
sb.prototype = new F(); sb.prototype = new F();
sb.superclass = spp; sb.superclass = spp;
_.extend(sb.prototype, overrides, { BI._.extend(sb.prototype, overrides, {
superclass: sp superclass: sp
}); });
return sb; return sb;
@ -455,10 +455,10 @@
return false; return false;
} }
return BI.every(keys, function (i, key) { return BI.every(keys, function (i, key) {
return _.has(obj, key); return BI._.has(obj, key);
}); });
} }
return _.has.apply(_, arguments); return BI._.has.apply(BI._, arguments);
}, },
freeze: function (value) { freeze: function (value) {
@ -528,9 +528,9 @@
}); });
// deep方法 // deep方法
_.extend(BI, { BI._.extend(BI, {
deepClone: _.cloneDeep, deepClone: BI._.cloneDeep,
deepExtend: _.merge, deepExtend: BI._.merge,
isDeepMatch: function (object, attrs) { isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length; var keys = BI.keys(attrs), length = keys.length;
@ -548,8 +548,8 @@
}, },
contains: function (obj, target, fromIndex) { contains: function (obj, target, fromIndex) {
if (!_.isArrayLike(obj)) obj = _.values(obj); if (!BI._.isArrayLike(obj)) obj = BI._.values(obj);
return _.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0; return BI._.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0;
}, },
deepContains: function (obj, copy) { deepContains: function (obj, copy) {
@ -647,20 +647,20 @@
}); });
// 通用方法 // 通用方法
_.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape", "before", "after"], function (name) { BI._.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape", "before", "after"], function (name) {
BI[name] = function () { BI[name] = function () {
return _[name].apply(_, arguments); return BI._[name].apply(BI._, arguments);
}; };
}); });
// 事件相关方法 // 事件相关方法
_.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) { BI._.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) {
BI[name] = function () { BI[name] = function () {
return _[name].apply(_, arguments); return BI._[name].apply(BI._, arguments);
}; };
}); });
_.extend(BI, { BI._.extend(BI, {
nextTick: (function () { nextTick: (function () {
var callbacks = []; var callbacks = [];
var pending = false; var pending = false;
@ -731,10 +731,10 @@
}); });
// 数字相关方法 // 数字相关方法
_.each(["random"], function (name) { BI._.each(["random"], function (name) {
BI[name] = _apply(name); BI[name] = _apply(name);
}); });
_.extend(BI, { BI._.extend(BI, {
parseInt: function (number) { parseInt: function (number) {
var radix = 10; var radix = 10;
@ -837,9 +837,9 @@
}); });
// 字符串相关方法 // 字符串相关方法
_.extend(BI, { BI._.extend(BI, {
trim: function () { trim: function () {
return _.trim.apply(_, arguments); return BI._.trim.apply(BI._, arguments);
}, },
toUpperCase: function (string) { toUpperCase: function (string) {
@ -965,7 +965,7 @@
}); });
// 日期相关方法 // 日期相关方法
_.extend(BI, { BI._.extend(BI, {
/** /**
* 是否是闰年 * 是否是闰年
* @param year * @param year

16
src/core/3.ob.js

@ -31,7 +31,7 @@
var OB = function (config) { var OB = function (config) {
this._constructor(config); this._constructor(config);
}; };
_.extend(OB.prototype, { BI._.extend(OB.prototype, {
props: {}, props: {},
init: null, init: null,
destroyed: null, destroyed: null,
@ -66,12 +66,12 @@
_initListeners: function () { _initListeners: function () {
var self = this; var self = this;
if (this.options.listeners != null) { if (this.options.listeners != null) {
_.each(this.options.listeners, function (lis, eventName) { BI._.each(this.options.listeners, function (lis, eventName) {
if (_.isFunction(lis)) { if (BI._.isFunction(lis)) {
self.on(eventName, lis); self.on(eventName, lis);
return; return;
} }
(lis.target ? lis.target : self)[lis.once ? "once" : "on"](lis.eventName, _.bind(lis.action, self)); (lis.target ? lis.target : self)[lis.once ? "once" : "on"](lis.eventName, BI._.bind(lis.action, self));
}); });
delete this.options.listeners; delete this.options.listeners;
} }
@ -100,7 +100,7 @@
}, },
_getEvents: function () { _getEvents: function () {
if (!_.isObject(this.events)) { if (!BI._.isObject(this.events)) {
this.events = {}; this.events = {};
} }
return this.events; return this.events;
@ -115,7 +115,7 @@
var self = this; var self = this;
eventName = eventName.toLowerCase(); eventName = eventName.toLowerCase();
var fns = this._getEvents()[eventName]; var fns = this._getEvents()[eventName];
if (!_.isArray(fns)) { if (!BI._.isArray(fns)) {
fns = []; fns = [];
this._getEvents()[eventName] = fns; this._getEvents()[eventName] = fns;
} }
@ -151,9 +151,9 @@
delete this._getEvents()[eventName]; delete this._getEvents()[eventName];
} else { } else {
var fns = this._getEvents()[eventName]; var fns = this._getEvents()[eventName];
if (_.isArray(fns)) { if (BI._.isArray(fns)) {
var newFns = []; var newFns = [];
_.each(fns, function (ifn) { BI._.each(fns, function (ifn) {
if (ifn != fn) { if (ifn != fn) {
newFns.push(ifn); newFns.push(ifn);
} }

7
src/core/conflict.js

@ -0,0 +1,7 @@
if (!window.$ && !window.jQuery) {
window.jQuery = window.$ = BI.jQuery;
}
if (!window._) {
window._ = BI._;
}

2
src/core/constant/events.js

@ -2,7 +2,7 @@
* 事件集合 * 事件集合
* @class BI.Events * @class BI.Events
*/ */
_.extend(BI, { BI._.extend(BI, {
Events: { Events: {
/** /**

2
src/core/constant/var.js

@ -2,7 +2,7 @@
* 常量 * 常量
*/ */
_.extend(BI, { BI._.extend(BI, {
MAX: 0xfffffffffffffff, MAX: 0xfffffffffffffff,
MIN: -0xfffffffffffffff, MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200, EVENT_RESPONSE_TIME: 200,

4
src/core/func/alias.js

@ -450,7 +450,7 @@
BI.cjkEncodeDO = function (o) { BI.cjkEncodeDO = function (o) {
if (BI.isPlainObject(o)) { if (BI.isPlainObject(o)) {
var result = {}; var result = {};
_.each(o, function (v, k) { BI._.each(o, function (v, k) {
if (!(typeof v === "string")) { if (!(typeof v === "string")) {
v = BI.jsonEncode(v); v = BI.jsonEncode(v);
} }
@ -603,7 +603,7 @@
return new Date(o.__time__); return new Date(o.__time__);
} }
for (var a in o) { for (var a in o) {
if (o[a] == o || typeof o[a] === "object" || _.isFunction(o[a])) { if (o[a] == o || typeof o[a] === "object" || BI._.isFunction(o[a])) {
break; break;
} }
o[a] = arguments.callee(o[a]); o[a] = arguments.callee(o[a]);

2
src/core/func/array.js

@ -2,7 +2,7 @@
* 对数组对象的扩展 * 对数组对象的扩展
* @class Array * @class Array
*/ */
_.extend(BI, { BI._.extend(BI, {
pushArray: function (sArray, array) { pushArray: function (sArray, array) {
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {

2
src/core/func/date.js

@ -6,7 +6,7 @@ BI.Date.HOUR = 60 * BI.Date.MINUTE;
BI.Date.DAY = 24 * BI.Date.HOUR; BI.Date.DAY = 24 * BI.Date.HOUR;
BI.Date.WEEK = 7 * BI.Date.DAY; BI.Date.WEEK = 7 * BI.Date.DAY;
_.extend(BI, { BI._.extend(BI, {
/** /**
* 获取时区 * 获取时区
* @returns {String} * @returns {String}

4
src/core/func/function.js

@ -3,7 +3,7 @@
* Created by GUY on 2015/6/24. * Created by GUY on 2015/6/24.
*/ */
BI.Func = BI.Func || {}; BI.Func = BI.Func || {};
_.extend(BI.Func, { BI._.extend(BI.Func, {
/** /**
* 创建唯一的名字 * 创建唯一的名字
* @param array * @param array
@ -143,7 +143,7 @@ _.extend(BI.Func, {
} }
}); });
_.extend(BI, { BI._.extend(BI, {
beforeFunc: function (sFunc, func) { beforeFunc: function (sFunc, func) {
var __self = sFunc; var __self = sFunc;
return function () { return function () {

2
src/core/func/number.js

@ -1,4 +1,4 @@
_.extend(BI, { BI._.extend(BI, {
// 给Number类型增加一个add方法,调用起来更加方便。 // 给Number类型增加一个add方法,调用起来更加方便。
add: function (num, arg) { add: function (num, arg) {
return accAdd(arg, num); return accAdd(arg, num);

4
src/core/func/string.js

@ -2,7 +2,7 @@
* 对字符串对象的扩展 * 对字符串对象的扩展
* @class String * @class String
*/ */
_.extend(BI, { BI._.extend(BI, {
/** /**
* 判断字符串是否已指定的字符串开始 * 判断字符串是否已指定的字符串开始
@ -65,7 +65,7 @@ _.extend(BI, {
} else { } else {
src += "&"; src += "&";
} }
_.each(paras, function (value, name) { BI._.each(paras, function (value, name) {
if (typeof(name) === "string") { if (typeof(name) === "string") {
src += name + "=" + value + "&"; src += name + "=" + value + "&";
} }

2
src/core/platform/web/function.js

@ -1,5 +1,5 @@
// 浏览器相关方法 // 浏览器相关方法
_.extend(BI, { BI._.extend(BI, {
isIE: function () { isIE: function () {
if(!_global.navigator) { if(!_global.navigator) {
return false; return false;

4
src/core/platform/web/jquery/_jquery.js vendored

@ -11012,10 +11012,6 @@
// Expose jQuery and $ identifiers, even in // Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566) // and CommonJS for browser emulators (#13566)
if (!window.$ && !window.jQuery) {
window.jQuery = window.$ = jQuery;
}
BI.jQuery = BI.$ = jQuery; BI.jQuery = BI.$ = jQuery;
return jQuery; return jQuery;

2
src/core/platform/web/load.js

@ -1,4 +1,4 @@
_.extend(BI, { BI._.extend(BI, {
$import: function () { $import: function () {
var _LOADED = {}; // alex:保存加载过的 var _LOADED = {}; // alex:保存加载过的
function loadReady (src, must) { function loadReady (src, must) {

4
src/core/plugin.js

@ -36,8 +36,8 @@ BI.Plugin = BI.Plugin || {};
}, },
config: function (widgetConfigFn, objectConfigFn) { config: function (widgetConfigFn, objectConfigFn) {
_GlobalWidgetConfigFns = _GlobalWidgetConfigFns.concat(_.isArray(widgetConfigFn) ? widgetConfigFn : [widgetConfigFn]); _GlobalWidgetConfigFns = _GlobalWidgetConfigFns.concat(BI._.isArray(widgetConfigFn) ? widgetConfigFn : [widgetConfigFn]);
__GlobalObjectConfigFns = __GlobalObjectConfigFns.concat(_.isArray(objectConfigFn) ? objectConfigFn : [objectConfigFn]); __GlobalObjectConfigFns = __GlobalObjectConfigFns.concat(BI._.isArray(objectConfigFn) ? objectConfigFn : [objectConfigFn]);
}, },
configWidget: function (type, fn, opt) { configWidget: function (type, fn, opt) {

2
src/core/structure/aes.js

@ -2308,7 +2308,7 @@
}()); }());
_.extend(BI, { BI._.extend(BI, {
/** /**
* aes加密方法 * aes加密方法
* aes-128-ecb * aes-128-ecb

2
src/core/structure/base64.js

@ -57,7 +57,7 @@
return string; return string;
}; };
_.extend(BI, { BI._.extend(BI, {
encode: function (input) { encode: function (input) {
var output = ""; var output = "";

2
src/core/utils/chinesePY.js

@ -422,7 +422,7 @@
return arrRslt.join(splitChar || "").toLowerCase(); return arrRslt.join(splitChar || "").toLowerCase();
}; };
_.extend(BI, { BI._.extend(BI, {
makeFirstPY: function (str, options) { makeFirstPY: function (str, options) {
options = options || {}; options = options || {};
if (typeof (str) !== "string") {return "" + str;} if (typeof (str) !== "string") {return "" + str;}

2
src/core/utils/i18n.js

@ -1,6 +1,6 @@
!(function () { !(function () {
var i18nStore = {}; var i18nStore = {};
_.extend(BI, { BI._.extend(BI, {
changeI18n: function (i18n) { changeI18n: function (i18n) {
if (i18n) { if (i18n) {
i18nStore = i18n; i18nStore = i18n;

6
src/core/wrapper/layout.js

@ -224,14 +224,14 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
} }
} else { } else {
var keys = _.keys(a), key; var keys = BI._.keys(a), key;
length = keys.length; length = keys.length;
if (_.keys(b).length !== length) { if (BI._.keys(b).length !== length) {
return false; return false;
} }
while (length--) { while (length--) {
key = keys[length]; key = keys[length];
if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) { if (!(BI._.has(b, key) && eq(a[key], b[key], aStack, bStack))) {
return false; return false;
} }
} }

32
src/router/0.router.js

@ -16,7 +16,7 @@
once: function (name, callback, context) { once: function (name, callback, context) {
if (!eventsApi(this, "once", name, [callback, context]) || !callback) return this; if (!eventsApi(this, "once", name, [callback, context]) || !callback) return this;
var self = this; var self = this;
var once = _.once(function () { var once = BI._.once(function () {
self.off(name, once); self.off(name, once);
callback.apply(this, arguments); callback.apply(this, arguments);
}); });
@ -37,7 +37,7 @@
return this; return this;
} }
var names = name ? [name] : _.keys(this._events); var names = name ? [name] : BI._.keys(this._events);
for (var i = 0, length = names.length; i < length; i++) { for (var i = 0, length = names.length; i < length; i++) {
name = names[i]; name = names[i];
@ -103,7 +103,7 @@
// listening to. // listening to.
listenTo: function (obj, name, callback) { listenTo: function (obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {}); var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId("l")); var id = obj._listenId || (obj._listenId = BI._.uniqueId("l"));
listeningTo[id] = obj; listeningTo[id] = obj;
if (!callback && typeof name === "object") callback = this; if (!callback && typeof name === "object") callback = this;
obj.on(name, callback, this); obj.on(name, callback, this);
@ -123,7 +123,7 @@
return this; return this;
} }
if (!callback) return this; if (!callback) return this;
var once = _.once(function () { var once = BI._.once(function () {
this.stopListening(obj, name, once); this.stopListening(obj, name, once);
callback.apply(this, arguments); callback.apply(this, arguments);
}); });
@ -142,7 +142,7 @@
for (var id in listeningTo) { for (var id in listeningTo) {
obj = listeningTo[id]; obj = listeningTo[id];
obj.off(name, callback, this); obj.off(name, callback, this);
if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id]; if (remove || BI._.isEmpty(obj._events)) delete this._listeningTo[id];
} }
return this; return this;
} }
@ -222,7 +222,7 @@
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
// Set up all inheritable **BI.Router** properties and methods. // Set up all inheritable **BI.Router** properties and methods.
_.extend(Router.prototype, Events, { BI._.extend(Router.prototype, Events, {
// _init is an empty function by default. Override it with your own // _init is an empty function by default. Override it with your own
// initialization logic. // initialization logic.
@ -236,8 +236,8 @@
// }); // });
// //
route: function (route, name, callback) { route: function (route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route); if (!BI._.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) { if (BI._.isFunction(name)) {
callback = name; callback = name;
name = ""; name = "";
} }
@ -271,8 +271,8 @@
// routes can be defined at the bottom of the route map. // routes can be defined at the bottom of the route map.
_bindRoutes: function () { _bindRoutes: function () {
if (!this.routes) return; if (!this.routes) return;
this.routes = _.result(this, "routes"); this.routes = BI._.result(this, "routes");
var route, routes = _.keys(this.routes); var route, routes = BI._.keys(this.routes);
while ((route = routes.pop()) != null) { while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]); this.route(route, this.routes[route]);
} }
@ -295,7 +295,7 @@
// treated as `null` to normalize cross-browser behavior. // treated as `null` to normalize cross-browser behavior.
_extractParameters: function (route, fragment) { _extractParameters: function (route, fragment) {
var params = route.exec(fragment).slice(1); var params = route.exec(fragment).slice(1);
return _.map(params, function (param, i) { return BI._.map(params, function (param, i) {
// Don't decode the search params. // Don't decode the search params.
if (i === params.length - 1) return param || null; if (i === params.length - 1) return param || null;
var resultParam = null; var resultParam = null;
@ -322,7 +322,7 @@
// falls back to polling. // falls back to polling.
var History = function () { var History = function () {
this.handlers = []; this.handlers = [];
this.checkUrl = _.bind(this.checkUrl, this); this.checkUrl = BI._.bind(this.checkUrl, this);
// Ensure that `History` can be used outside of the browser. // Ensure that `History` can be used outside of the browser.
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
@ -344,7 +344,7 @@
History.started = false; History.started = false;
// Set up all inheritable **BI.History** properties and methods. // Set up all inheritable **BI.History** properties and methods.
_.extend(History.prototype, Events, { BI._.extend(History.prototype, Events, {
// The default interval to poll for hash changes, if necessary, is // The default interval to poll for hash changes, if necessary, is
// twenty times a second. // twenty times a second.
@ -402,7 +402,7 @@
// Figure out the initial configuration. Do we need an iframe? // Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available? // Is pushState desired ... is it available?
this.options = _.extend({root: "/"}, this.options, options); this.options = BI._.extend({root: "/"}, this.options, options);
this.root = this.options.root; this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false; this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = "onhashchange" in window; this._hasHashChange = "onhashchange" in window;
@ -511,7 +511,7 @@
// remove a route match in routes // remove a route match in routes
unRoute: function (route) { unRoute: function (route) {
var index = _.findIndex(this.handlers, function (handler) { var index = BI._.findIndex(this.handlers, function (handler) {
return handler.route.test(route); return handler.route.test(route);
}); });
if (index > -1) { if (index > -1) {
@ -545,7 +545,7 @@
// returns `false`. // returns `false`.
loadUrl: function (fragment) { loadUrl: function (fragment) {
fragment = this.fragment = this.getFragment(fragment); fragment = this.fragment = this.getFragment(fragment);
return _.some(this.handlers, function (handler) { return BI._.some(this.handlers, function (handler) {
if (handler.route.test(fragment)) { if (handler.route.test(fragment)) {
handler.callback(fragment); handler.callback(fragment);
return true; return true;

2
test/utils.js

@ -1,6 +1,6 @@
!(function () { !(function () {
BI.Test = {}; BI.Test = {};
_.extend(BI.Test, { BI._.extend(BI.Test, {
createWidget: function (widgetJson) { createWidget: function (widgetJson) {
var widget = BI.createWidget(BI.extend(widgetJson, { var widget = BI.createWidget(BI.extend(widgetJson, {
root: true root: true

25
webpack/attachments.js

@ -5,6 +5,7 @@ const fixProxyJs = './dist/fix/fix.proxy.js';
const fixCompact = "./dist/fix/fix.compact.js"; const fixCompact = "./dist/fix/fix.compact.js";
const workerCompact = './dist/fix/worker.compact.js'; const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js"; const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const basicAttachmentMap = { const basicAttachmentMap = {
polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]), polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]),
@ -12,6 +13,7 @@ const basicAttachmentMap = {
"src/less/core/**/*.less", "src/less/core/**/*.less",
"src/less/theme/**/*.less", "src/less/theme/**/*.less",
lodashJs, lodashJs,
jqueryJs,
"src/core/**/*.js", "src/core/**/*.js",
"src/data/**/*.js", "src/data/**/*.js",
]), ]),
@ -46,6 +48,15 @@ const basicAttachmentMap = {
core_without_normalize: sync( core_without_normalize: sync(
["src/less/core/**/*.less", "src/less/theme/**/*.less"], ["src/less/core/normalize.less", "src/less/core/normalize2.less"] ["src/less/core/**/*.less", "src/less/theme/**/*.less"], ["src/less/core/normalize.less", "src/less/core/normalize2.less"]
), ),
core_without_conflict: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
lodashJs,
"src/core/**/*.js",
"src/data/**/*.js",
], [
"src/core/conflict.js",
]),
resource: sync(["src/less/resource/**/*.less"]), resource: sync(["src/less/resource/**/*.less"]),
font: sync(["public/less/font.less"]), font: sync(["public/less/font.less"]),
ts: ['./typescript/bundle.ts'], ts: ['./typescript/bundle.ts'],
@ -156,6 +167,19 @@ const fineui = [].concat(
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
const fineuiWithoutConflict = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core_without_conflict,
basicAttachmentMap.fix,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
[fixCompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
// const fineuiModern = [].concat( // const fineuiModern = [].concat(
// sync(["src/less/modern.less"]), // sync(["src/less/modern.less"]),
// sync([ // sync([
@ -221,6 +245,7 @@ module.exports = {
font: basicAttachmentMap.font, font: basicAttachmentMap.font,
bundle: uniq(bundle), bundle: uniq(bundle),
fineuiWithoutNormalize: uniq(fineuiWithoutNormalize), fineuiWithoutNormalize: uniq(fineuiWithoutNormalize),
fineuiWithoutConflict: uniq(fineuiWithoutConflict),
bundleWithoutNormalize: uniq(bundleWithoutNormalize), bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui), fineui: uniq(fineui),
fineuiProxy: uniq(fineuiProxy), fineuiProxy: uniq(fineuiProxy),

1
webpack/webpack.prod.js

@ -18,6 +18,7 @@ module.exports = merge.smart(common, {
font: attachments.font, font: attachments.font,
"fineui.min": attachments.fineui, "fineui.min": attachments.fineui,
"fineui_without_normalize.min": attachments.fineuiWithoutNormalize, "fineui_without_normalize.min": attachments.fineuiWithoutNormalize,
"fineui_without_conflict.min": attachments.fineuiWithoutConflict,
"fineui.proxy.min": attachments.fineuiProxy, "fineui.proxy.min": attachments.fineuiProxy,
"core_without_platform": attachments.coreWithoutPlatform, "core_without_platform": attachments.coreWithoutPlatform,
utils: attachments.utils, utils: attachments.utils,

Loading…
Cancel
Save