Browse Source

Merge pull request #82721 in DEC/fineui from master to feature/x

* commit '88897b3f36498aee51955cb26c90f43d796867f6':
  refactor: 重复注册后不再覆盖
  KERNEL-11634 refactor: npm引入的fineui不该有window.$和window._,避免冲突
es6
superman 2 years ago
parent
commit
54e21120f0
  1. 4
      dist/fix/fix.compact.js
  2. 126
      dist/fix/fix.js
  3. 131
      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. 58
      src/core/5.inject.js
  9. 7
      src/core/conflict.js
  10. 2
      src/core/constant/events.js
  11. 2
      src/core/constant/var.js
  12. 4
      src/core/func/alias.js
  13. 2
      src/core/func/array.js
  14. 2
      src/core/func/date.js
  15. 4
      src/core/func/function.js
  16. 2
      src/core/func/number.js
  17. 4
      src/core/func/string.js
  18. 2
      src/core/platform/web/function.js
  19. 4
      src/core/platform/web/jquery/_jquery.js
  20. 2
      src/core/platform/web/load.js
  21. 4
      src/core/plugin.js
  22. 2
      src/core/structure/aes.js
  23. 2
      src/core/structure/base64.js
  24. 2
      src/core/utils/chinesePY.js
  25. 2
      src/core/utils/i18n.js
  26. 6
      src/core/wrapper/layout.js
  27. 32
      src/router/0.router.js
  28. 2
      test/utils.js
  29. 25
      webpack/attachments.js
  30. 1
      webpack/webpack.prod.js

4
dist/fix/fix.compact.js vendored

@ -38,7 +38,7 @@
cb = cb.handler;
}
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
}));
}
@ -177,7 +177,7 @@
delete this.__cacheStore;
};
_.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) {
BI._.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store);

126
dist/fix/fix.js vendored

@ -96,8 +96,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
setImmediate(nextTickHandler);
};
} else if (typeof MessageChannel !== 'undefined' && (isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
var channel = new MessageChannel();
var port = channel.port2;
channel.port1.onmessage = nextTickHandler;
@ -106,18 +106,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
};
} else
/* istanbul ignore next */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick(cb, ctx) {
var _resolve = void 0;
@ -428,10 +428,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (this.active) {
var value = this.get();
if (value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
_.isObject(value) && options && options.refresh || this.deep) {
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
BI._.isObject(value) && options && options.refresh || this.deep) {
// set new value
var oldValue = this.value;
this.value = value;
@ -491,8 +491,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function _traverse(val, seen) {
var i = void 0,
keys = void 0;
var isA = _.isArray(val);
if (!isA && !_.isObject(val)) {
var isA = BI._.isArray(val);
if (!isA && !BI._.isObject(val)) {
return;
}
if (val.__ob__) {
@ -508,7 +508,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_traverse(val[i], seen);
}
} else {
keys = _.keys(val);
keys = BI._.keys(val);
i = keys.length;
while (i--) {
_traverse(val[keys[i]], seen);
@ -518,7 +518,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var arrayProto = Array.prototype;
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];
arrayMethods[method] = function mutator() {
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 = {
shouldConvert: true
@ -583,7 +583,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
if (_.isArray(value)) {
if (BI._.isArray(value)) {
var augment = hasProto ? protoAugment : copyAugment;
augment(value, arrayMethods, arrayKeys);
this.model = this.observeArray(value);
@ -623,13 +623,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
function observe(value, parentObserver, parentKey) {
if (!_.isObject(value)) {
if (!BI._.isObject(value)) {
return;
}
var ob = void 0;
if (value.__ob__ instanceof Observer) {
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);
}
if (ob) {
@ -643,7 +643,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.notify({ observer: observer, key: key, refresh: refresh });
if (observer) {
//触发a.*绑定的依赖
_.each(observer._deps, function (dep) {
BI._.each(observer._deps, function (dep) {
dep.notify({ observer: observer, key: key });
});
//触发a.**绑定的依赖
@ -651,7 +651,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
root = observer,
route = key || "";
while (parent) {
_.each(parent._scopeDeps, function (dep) {
BI._.each(parent._scopeDeps, function (dep) {
dep.notify({ observer: observer, key: key });
});
if (parent.parentKey != null) {
@ -674,7 +674,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function defineReactive(obj, observer, shallow) {
var props = {};
var model = void 0;
_.each(obj, function (val, key) {
BI._.each(obj, function (val, key) {
if (key in $$skipArray) {
return;
}
@ -691,7 +691,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend();
if (childOb) {
childOb.dep.depend();
if (_.isArray(value)) {
if (BI._.isArray(value)) {
dependArray(value);
}
}
@ -740,7 +740,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend();
if (childOb) {
childOb.dep.depend();
if (_.isArray(value)) {
if (BI._.isArray(value)) {
dependArray(value);
}
}
@ -767,12 +767,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* already exist.
*/
function set(target, key, val) {
if (_.isArray(target)) {
if (BI._.isArray(target)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val;
}
if (_.has(target, key)) {
if (BI._.has(target, key)) {
target[key] = val;
return val;
}
@ -795,12 +795,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* Delete a property and trigger change if necessary.
*/
function del(target, key) {
if (_.isArray(target)) {
if (BI._.isArray(target)) {
target.splice(key, 1);
return;
}
var ob = target.__ob__;
if (!_.has(target, key)) {
if (!BI._.has(target, key)) {
return;
}
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++) {
e = value[i];
e && e.__ob__ && e.__ob__.dep.depend();
if (_.isArray(e)) {
if (BI._.isArray(e)) {
dependArray(e);
}
}
@ -838,7 +838,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function runBinaryFunction(binarys) {
var expr = '';
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];
} else {
expr += 'false';
@ -863,7 +863,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
options = options || {};
options.user = true;
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);
if (options.immediate) {
cb(watcher.value);
@ -900,8 +900,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
}
};
_.each(exps, function (exp, i) {
if (_.has(operators, exp)) {
BI._.each(exps, function (exp, i) {
if (BI._.has(operators, exp)) {
return;
}
if (exp.indexOf("*") >= 0) {
@ -929,7 +929,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_dep.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
_w.teardown();
@ -955,7 +955,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _regStr = routeToRegExp(exp);
var _dep2 = new Dep();
_root._globalDeps || (_root._globalDeps = {});
if (_.isArray(_root._globalDeps[_regStr])) {
if (BI._.isArray(_root._globalDeps[_regStr])) {
_root._globalDeps[_regStr].push(_dep2);
} else {
_root._globalDeps[_regStr] = [_dep2];
@ -965,7 +965,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
_dep2.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
if (_root._globalDeps) {
@ -1005,7 +1005,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var regStr = routeToRegExp(exp);
var dep = new Dep();
root._globalDeps || (root._globalDeps = {});
if (_.isArray(root._globalDeps[regStr])) {
if (BI._.isArray(root._globalDeps[regStr])) {
root._globalDeps[regStr].push(dep);
} else {
root._globalDeps[regStr] = [dep];
@ -1015,7 +1015,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
dep.depend();
return NaN;
}, function (newValue, oldValue, attrs) {
callback(i, newValue, oldValue, _.extend({ index: i }, attrs));
callback(i, newValue, oldValue, BI._.extend({ index: i }, attrs));
}, options);
watchers.push(function unwatchFn() {
if (root._globalDeps) {
@ -1029,7 +1029,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return;
}
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);
watchers.push(function unwatchFn() {
watcher.teardown();
@ -1045,7 +1045,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
mixinInjection[xtype] = BI._.cloneDeep(cls);
}
var computedWatcherOptions = { lazy: true };
@ -1119,7 +1119,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
vm._watchers || (vm._watchers = []);
for (var key in watch$$1) {
var handler = watch$$1[key];
if (_.isArray(handler)) {
if (BI._.isArray(handler)) {
for (var i = 0; i < handler.length; 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') {
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) {
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) {
mixins = (mixins || []).slice(0);
_.each(mixins.reverse(), function (mixinType) {
BI._.each(mixins.reverse(), function (mixinType) {
var mixin$$1 = getMixins(mixinType);
for (var key in mixin$$1) {
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) {
var inject = vm.inject || [];
var result = {};
_.each(inject, function (key) {
BI._.each(inject, function (key) {
result[key] = getInjectValue(vm, key);
});
return result;
@ -1303,7 +1303,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.options = model || {};
}
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 context = this.context;
var inject = this.inject;
@ -1311,7 +1311,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var provide = this.provide;
var watch$$1 = this.watch;
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;
defineProps(this, keys);
// deprecated
@ -1320,7 +1320,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.$$model && (this.model.__ob__ = this.$$model.__ob__);
initMixins(this, mixins);
this.init();
initState(this, _.extend(getInjectValues(this), state));
initState(this, BI._.extend(getInjectValues(this), state));
initComputed(this, computed);
REACTIVE && initWatch(this, watch$$1);
initMethods(this, actions);
@ -1341,9 +1341,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
for (var _key3 in this._computedWatchers) {
this._computedWatchers[_key3].teardown();
}
_.each(this._watchers, function (unwatches) {
unwatches = _.isArray(unwatches) ? unwatches : [unwatches];
_.each(unwatches, function (unwatch) {
BI._.each(this._watchers, function (unwatches) {
unwatches = BI._.isArray(unwatches) ? unwatches : [unwatches];
BI._.each(unwatches, function (unwatch) {
unwatch();
});
});
@ -1373,7 +1373,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function toJSON(model) {
var result = void 0;
if (_.isArray(model)) {
if (BI._.isArray(model)) {
result = [];
for (var i = 0, len = model.length; i < len; i++) {
result[i] = toJSON(model[i]);
@ -1381,7 +1381,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} else if (model && isPlainObject(model)) {
result = {};
for (var _key4 in model) {
if (!_.has($$skipArray, _key4)) {
if (!BI._.has($$skipArray, _key4)) {
result[_key4] = toJSON(model[_key4]);
}
}
@ -1416,4 +1416,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.toJSON = toJSON;
exports.__esModule = true;
});
});

131
dist/fix/fix.proxy.js vendored

@ -2,22 +2,16 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Fix = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
@ -39,6 +33,9 @@
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
@ -542,10 +539,10 @@
if (type === "clear"
/* CLEAR */
) {
// collection being cleared
// trigger all effects for target
deps = _toConsumableArray(depsMap.values());
} else if (key === 'length' && isArray(target)) {
// collection being cleared
// trigger all effects for target
deps = _toConsumableArray(depsMap.values());
} else if (key === 'length' && isArray(target)) {
depsMap.forEach(function (dep, key) {
if (key === 'length' || key >= newValue) {
deps.push(dep);
@ -728,12 +725,12 @@
if (key === "__v_isReactive"
/* IS_REACTIVE */
) {
return !isReadonly;
} else if (key === "__v_isReadonly"
return !isReadonly;
} else if (key === "__v_isReadonly"
/* IS_READONLY */
) {
return isReadonly;
} else if (key === "__v_raw"
return isReadonly;
} else if (key === "__v_raw"
/* RAW */
&& receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
return target;
@ -1217,16 +1214,16 @@
if (key === "__v_isReactive"
/* IS_REACTIVE */
) {
return !isReadonly;
} else if (key === "__v_isReadonly"
return !isReadonly;
} else if (key === "__v_isReadonly"
/* IS_READONLY */
) {
return isReadonly;
} else if (key === "__v_raw"
return isReadonly;
} else if (key === "__v_raw"
/* RAW */
) {
return target;
}
return target;
}
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
};
@ -1335,8 +1332,8 @@
if (targetType === 0
/* INVALID */
) {
return target;
}
return target;
}
var proxy = new Proxy(target, targetType === 2
/* COLLECTION */
@ -1631,7 +1628,7 @@
return mixinInjection[type];
}
function mixin(xtype, cls) {
mixinInjection[xtype] = _.cloneDeep(cls);
mixinInjection[xtype] = BI._.cloneDeep(cls);
}
var queue = [];
@ -1710,7 +1707,7 @@
}
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.");
}
@ -1775,21 +1772,21 @@
};
deep = true;
} else if (_.isArray(source)) {
} else if (BI._.isArray(source)) {
getter = function getter() {
return source.map(function (s) {
if (isRef(s)) {
return s.value;
} else if (isReactive(s)) {
return traverse(s);
} else if (_.isFunction(s)) {
} else if (BI._.isFunction(s)) {
return s.call(instance);
} else {
warnInvalidSource(s);
}
});
};
} else if (_.isFunction(source)) {
} else if (BI._.isFunction(source)) {
if (cb) {
// getter with cb
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() {
// 这里去掉的原因是,新增属性没有生效也会触发变化监听
@ -1903,7 +1900,7 @@
function traverse(value) {
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;
}
@ -1911,7 +1908,7 @@
if (isRef(value)) {
traverse(value.value, seen);
} else if (_.isArray(value)) {
} else if (BI._.isArray(value)) {
for (var i = 0; i < value.length; i++) {
traverse(value[i], seen);
}
@ -1940,7 +1937,7 @@
var expr = "";
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];
} else {
expr += "false";
@ -1953,7 +1950,7 @@
function watchExp(model, getter) {
var result = getter.call(model, model);
if (_.isArray(result)) {
if (BI._.isArray(result)) {
return result.concat();
}
@ -1974,14 +1971,14 @@
options.user = true;
var exps;
if (_.isFunction(expOrFn)) {
if (BI._.isFunction(expOrFn)) {
var watcher = innerWatch(expOrFn, cb, options);
return function unwatchFn() {
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 prePaths = paths.slice(0, paths.length - 1);
var preGetter = parsePath(prePaths.join("."));
@ -2030,8 +2027,8 @@
}
};
_.each(exps, function (exp, i) {
if (_.has(operators, exp)) {
BI._.each(exps, function (exp, i) {
if (BI._.has(operators, exp)) {
return;
}
@ -2079,14 +2076,14 @@
return watchExp(_v2, _getter);
}, function (newValue, oldValue) {
// a.** 在a变化的时候不会触发change
if (!_.isArray(newValue) && oldValue !== newValue) {
if (!BI._.isArray(newValue) && oldValue !== newValue) {
return;
}
callback(i, NaN, NaN, _.extend({
callback(i, NaN, NaN, BI._.extend({
index: i
}));
}, _.extend({
}, BI._.extend({
deep: true
}, options)));
return;
@ -2145,11 +2142,11 @@
changes = [];
if (newValue === true) {
callback(i, NaN, NaN, _.extend({
callback(i, NaN, NaN, BI._.extend({
index: i
}));
}
}, _.extend({}, options, {
}, BI._.extend({}, options, {
deep: true,
onTrigger: function onTrigger(_ref) {
var target = _ref.target,
@ -2167,7 +2164,7 @@
watchers.push(innerWatch(function () {
return watchExp(model, getter);
}, function (newValue, oldValue) {
callback(i, newValue, oldValue, _.extend({
callback(i, newValue, oldValue, BI._.extend({
index: i
}));
}, options));
@ -2188,7 +2185,7 @@
var $$computed = vm.$$computed = {};
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) {
var handler = watch[key];
if (_.isArray(handler)) {
if (BI._.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i]));
}
@ -2218,25 +2215,25 @@
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) {
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) {
mixins = (mixins || []).slice(0);
_.each(mixins.reverse(), function (mixinType) {
BI._.each(mixins.reverse(), function (mixinType) {
var mixin = getMixins(mixinType);
for (var key in mixin) {
if (typeof mixin[key] !== "function") continue;
if (_.has(vm, key)) continue;
vm[key] = _.bind(mixin[key], vm);
if (BI._.has(vm, key)) continue;
vm[key] = BI._.bind(mixin[key], vm);
}
});
}
@ -2329,7 +2326,7 @@
var inject = vm.inject || [];
var result = {};
_.each(inject, function (key) {
BI._.each(inject, function (key) {
result[key] = getInjectValue(vm, key);
});
@ -2346,7 +2343,7 @@
value: function _constructor(options, destroyHandler) {
this.options = options || {};
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 context = this.context;
var inject = this.inject;
@ -2354,14 +2351,14 @@
var watch = this.watch;
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;
defineProps(this);
childContext && defineContext(this, childContext);
initMixins(this, mixins);
this.init();
initState(this, _.extend(getInjectValues(this), state));
initState(this, BI._.extend(getInjectValues(this), state));
initComputed(this, computed);
REACTIVE && initWatch(this, watch);
initMethods(this, actions);
@ -2379,10 +2376,10 @@
}, {
key: "destroy",
value: function destroy() {
_.each(this._watchers, function (unwatches) {
unwatches = _.isArray(unwatches) ? unwatches : [unwatches];
BI._.each(this._watchers, function (unwatches) {
unwatches = BI._.isArray(unwatches) ? unwatches : [unwatches];
_.each(unwatches, function (unwatch) {
BI._.each(unwatches, function (unwatch) {
unwatch();
});
});
@ -2398,7 +2395,7 @@
return Model;
}();
function set(target, key, val) {
if (_.isArray(target)) {
if (BI._.isArray(target)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val;
@ -2416,12 +2413,12 @@
return value;
}
function del(target, key) {
if (_.isArray(target)) {
if (BI._.isArray(target)) {
target.splice(key, 1);
return;
}
if (!_.has(target, key)) {
if (!BI._.has(target, key)) {
return;
}
@ -2441,7 +2438,7 @@
function toJSON(model) {
var result;
if (_.isArray(model)) {
if (BI._.isArray(model)) {
result = [];
for (var i = 0, len = model.length; i < len; i++) {
@ -2475,4 +2472,4 @@
Object.defineProperty(exports, '__esModule', { value: true });
})));
}));

2
package.json

@ -2,7 +2,7 @@
"name": "fineui",
"version": "2.0.20220623215302",
"description": "fineui",
"main": "dist/fineui.min.js",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",
"devDependencies": {
"@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.
// See http://requirejs.org/docs/errors.html#mismatch for more details.
// 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
// referenced as the "underscore" module.
@ -10270,6 +10270,6 @@
}
else {
// Export to the global object.
root._ = lodash;
BI._ = lodash;
}
}.call(this));

72
src/core/2.base.js

@ -11,19 +11,19 @@
};
var _apply = function (name) {
return function () {
return _[name].apply(_, arguments);
return BI._[name].apply(BI._, arguments);
};
};
var _applyFunc = function (name) {
return function () {
var args = Array.prototype.slice.call(arguments, 0);
args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1];
return _[name].apply(_, args);
args[1] = BI._.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1];
return BI._[name].apply(BI._, args);
};
};
// Utility
_.extend(BI, {
BI._.extend(BI, {
assert: function (v, is) {
if (this.isFunction(is)) {
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);
});
_.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) {
if (name === "any") {
BI[name] = _applyFunc("some");
@ -157,7 +157,7 @@
BI[name] = _applyFunc(name);
}
});
_.extend(BI, {
BI._.extend(BI, {
// 数数
count: function (from, to, predicate) {
var t;
@ -217,10 +217,10 @@
}).join("");
}
if (BI.isArray(obj1)) {
return _.concat.apply([], arguments);
return BI._.concat.apply([], arguments);
}
if (BI.isObject(obj1)) {
return _.extend.apply({}, arguments);
return BI._.extend.apply({}, arguments);
}
},
@ -254,7 +254,7 @@
backFindKey: function (obj, 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--) {
key = keys[i];
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) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
BI._.each(["findIndex", "findLastIndex"], function (name) {
BI[name] = _applyFunc(name);
});
_.extend(BI, {
BI._.extend(BI, {
// 构建一个长度为length的数组
makeArray: function (length, value) {
var res = [];
@ -401,27 +401,27 @@
if (array == null) {
return [];
}
if (!_.isBoolean(isSorted)) {
if (!BI._.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
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",
"isElement", "isNumber", "isString", "isArray", "isObject", "isPlainObject", "isArguments", "isFunction", "isFinite",
"isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined", "zipObject", "cloneDeep"], function (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);
});
_.extend(BI, {
BI._.extend(BI, {
inherit: function (sp, overrides) {
var sb = function () {
@ -432,7 +432,7 @@
F.prototype = spp;
sb.prototype = new F();
sb.superclass = spp;
_.extend(sb.prototype, overrides, {
BI._.extend(sb.prototype, overrides, {
superclass: sp
});
return sb;
@ -455,10 +455,10 @@
return false;
}
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) {
@ -528,9 +528,9 @@
});
// deep方法
_.extend(BI, {
deepClone: _.cloneDeep,
deepExtend: _.merge,
BI._.extend(BI, {
deepClone: BI._.cloneDeep,
deepExtend: BI._.merge,
isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length;
@ -548,8 +548,8 @@
},
contains: function (obj, target, fromIndex) {
if (!_.isArrayLike(obj)) obj = _.values(obj);
return _.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0;
if (!BI._.isArrayLike(obj)) obj = BI._.values(obj);
return BI._.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0;
},
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 () {
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 () {
return _[name].apply(_, arguments);
return BI._[name].apply(BI._, arguments);
};
});
_.extend(BI, {
BI._.extend(BI, {
nextTick: (function () {
var callbacks = [];
var pending = false;
@ -731,10 +731,10 @@
});
// 数字相关方法
_.each(["random"], function (name) {
BI._.each(["random"], function (name) {
BI[name] = _apply(name);
});
_.extend(BI, {
BI._.extend(BI, {
parseInt: function (number) {
var radix = 10;
@ -837,9 +837,9 @@
});
// 字符串相关方法
_.extend(BI, {
BI._.extend(BI, {
trim: function () {
return _.trim.apply(_, arguments);
return BI._.trim.apply(BI._, arguments);
},
toUpperCase: function (string) {
@ -965,7 +965,7 @@
});
// 日期相关方法
_.extend(BI, {
BI._.extend(BI, {
/**
* 是否是闰年
* @param year

16
src/core/3.ob.js

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

58
src/core/5.inject.js

@ -10,27 +10,29 @@
BI.module = BI.module || function (xtype, cls) {
if (moduleInjection[xtype] != null) {
_global.console && console.error("module: [" + xtype + "] 已经注册过了");
}
if (BI.isFunction(cls)) {
cls = cls();
}
for (var k in moduleInjectionMap) {
if (cls[k]) {
for (var key in cls[k]) {
if (!moduleInjectionMap[k]) {
continue;
}
if (!moduleInjectionMap[k][key]) {
moduleInjectionMap[k][key] = [];
} else {
if (BI.isFunction(cls)) {
cls = cls();
}
for (var k in moduleInjectionMap) {
if (cls[k]) {
for (var key in cls[k]) {
if (!moduleInjectionMap[k]) {
continue;
}
if (!moduleInjectionMap[k][key]) {
moduleInjectionMap[k][key] = [];
}
moduleInjectionMap[k][key].push({
version: cls[k][key],
moduleId: xtype
});
}
moduleInjectionMap[k][key].push({
version: cls[k][key],
moduleId: xtype
});
}
}
moduleInjection[xtype] = cls;
}
moduleInjection[xtype] = cls;
return function () {
return BI.Modules.getModule(xtype);
};
@ -40,8 +42,10 @@
BI.constant = BI.constant || function (xtype, cls) {
if (constantInjection[xtype] != null) {
_global.console && console.error("constant: [" + xtype + "]已经注册过了");
} else {
constantInjection[xtype] = cls;
}
constantInjection[xtype] = cls;
return function () {
return BI.Constants.getConstant(xtype);
};
@ -51,8 +55,10 @@
BI.model = BI.model || function (xtype, cls) {
if (modelInjection[xtype] != null) {
_global.console && console.error("model: [" + xtype + "] 已经注册过了");
} else {
modelInjection[xtype] = cls;
}
modelInjection[xtype] = cls;
return function (config) {
return BI.Models.getModel(xtype, config);
};
@ -62,8 +68,10 @@
BI.store = BI.store || function (xtype, cls) {
if (storeInjection[xtype] != null) {
_global.console && console.error("store: [" + xtype + "] 已经注册过了");
} else {
storeInjection[xtype] = cls;
}
storeInjection[xtype] = cls;
return function (config) {
return BI.Stores.getStore(xtype, config);
};
@ -73,8 +81,10 @@
BI.service = BI.service || function (xtype, cls) {
if (serviceInjection[xtype] != null) {
_global.console && console.error("service: [" + xtype + "] 已经注册过了");
} else {
serviceInjection[xtype] = cls;
}
serviceInjection[xtype] = cls;
return function (config) {
return BI.Services.getService(xtype, config);
};
@ -84,8 +94,10 @@
BI.provider = BI.provider || function (xtype, cls) {
if (providerInjection[xtype] != null) {
_global.console && console.error("provider: [" + xtype + "] 已经注册过了");
} else {
providerInjection[xtype] = cls;
}
providerInjection[xtype] = cls;
return function (config) {
return BI.Providers.getProvider(xtype, config);
};
@ -390,6 +402,8 @@
BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) {
if (kv[xtype] != null) {
_global.console && console.error("组件: [" + xtype + "] 已经注册过了");
return;
}
if (cls) {
cls["xtype"] = xtype;

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
*/
_.extend(BI, {
BI._.extend(BI, {
Events: {
/**

2
src/core/constant/var.js

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

4
src/core/func/alias.js

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

2
src/core/func/array.js

@ -2,7 +2,7 @@
* 对数组对象的扩展
* @class Array
*/
_.extend(BI, {
BI._.extend(BI, {
pushArray: function (sArray, array) {
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.WEEK = 7 * BI.Date.DAY;
_.extend(BI, {
BI._.extend(BI, {
/**
* 获取时区
* @returns {String}

4
src/core/func/function.js

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

2
src/core/func/number.js

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

4
src/core/func/string.js

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

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

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

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

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

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

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

4
src/core/plugin.js

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

2
src/core/structure/aes.js

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

2
src/core/structure/base64.js

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

2
src/core/utils/chinesePY.js

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

2
src/core/utils/i18n.js

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

6
src/core/wrapper/layout.js

@ -224,14 +224,14 @@ BI.Layout = BI.inherit(BI.Widget, {
}
}
} else {
var keys = _.keys(a), key;
var keys = BI._.keys(a), key;
length = keys.length;
if (_.keys(b).length !== length) {
if (BI._.keys(b).length !== length) {
return false;
}
while (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;
}
}

32
src/router/0.router.js

@ -16,7 +16,7 @@
once: function (name, callback, context) {
if (!eventsApi(this, "once", name, [callback, context]) || !callback) return this;
var self = this;
var once = _.once(function () {
var once = BI._.once(function () {
self.off(name, once);
callback.apply(this, arguments);
});
@ -37,7 +37,7 @@
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++) {
name = names[i];
@ -103,7 +103,7 @@
// listening to.
listenTo: function (obj, name, callback) {
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;
if (!callback && typeof name === "object") callback = this;
obj.on(name, callback, this);
@ -123,7 +123,7 @@
return this;
}
if (!callback) return this;
var once = _.once(function () {
var once = BI._.once(function () {
this.stopListening(obj, name, once);
callback.apply(this, arguments);
});
@ -142,7 +142,7 @@
for (var id in listeningTo) {
obj = listeningTo[id];
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;
}
@ -222,7 +222,7 @@
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
// 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
// initialization logic.
@ -236,8 +236,8 @@
// });
//
route: function (route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
if (!BI._.isRegExp(route)) route = this._routeToRegExp(route);
if (BI._.isFunction(name)) {
callback = name;
name = "";
}
@ -271,8 +271,8 @@
// routes can be defined at the bottom of the route map.
_bindRoutes: function () {
if (!this.routes) return;
this.routes = _.result(this, "routes");
var route, routes = _.keys(this.routes);
this.routes = BI._.result(this, "routes");
var route, routes = BI._.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
@ -295,7 +295,7 @@
// treated as `null` to normalize cross-browser behavior.
_extractParameters: function (route, fragment) {
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.
if (i === params.length - 1) return param || null;
var resultParam = null;
@ -322,7 +322,7 @@
// falls back to polling.
var History = function () {
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.
if (typeof window !== "undefined") {
@ -344,7 +344,7 @@
History.started = false;
// 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
// twenty times a second.
@ -402,7 +402,7 @@
// Figure out the initial configuration. Do we need an iframe?
// 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._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = "onhashchange" in window;
@ -511,7 +511,7 @@
// remove a route match in routes
unRoute: function (route) {
var index = _.findIndex(this.handlers, function (handler) {
var index = BI._.findIndex(this.handlers, function (handler) {
return handler.route.test(route);
});
if (index > -1) {
@ -545,7 +545,7 @@
// returns `false`.
loadUrl: function (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)) {
handler.callback(fragment);
return true;

2
test/utils.js

@ -1,6 +1,6 @@
!(function () {
BI.Test = {};
_.extend(BI.Test, {
BI._.extend(BI.Test, {
createWidget: function (widgetJson) {
var widget = BI.createWidget(BI.extend(widgetJson, {
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 workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const basicAttachmentMap = {
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/theme/**/*.less",
lodashJs,
jqueryJs,
"src/core/**/*.js",
"src/data/**/*.js",
]),
@ -46,6 +48,15 @@ const basicAttachmentMap = {
core_without_normalize: sync(
["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"]),
font: sync(["public/less/font.less"]),
ts: ['./typescript/bundle.ts'],
@ -156,6 +167,19 @@ const fineui = [].concat(
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(
// sync(["src/less/modern.less"]),
// sync([
@ -221,6 +245,7 @@ module.exports = {
font: basicAttachmentMap.font,
bundle: uniq(bundle),
fineuiWithoutNormalize: uniq(fineuiWithoutNormalize),
fineuiWithoutConflict: uniq(fineuiWithoutConflict),
bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui),
fineuiProxy: uniq(fineuiProxy),

1
webpack/webpack.prod.js

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

Loading…
Cancel
Save