Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
zsmj 2 years ago
parent
commit
b0ae7a53b5
  1. 4
      dist/fix/fix.compact.js
  2. 126
      dist/fix/fix.js
  3. 131
      dist/fix/fix.proxy.js
  4. 4
      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. 2
      src/less/lib/constant.less
  28. 32
      src/router/0.router.js
  29. 244
      src/widget/multiselect/loader.js
  30. 20
      src/widget/multiselect/multiselect.loader.js
  31. 2
      test/utils.js
  32. 25
      webpack/attachments.js
  33. 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 });
})));
}));

4
package.json

@ -1,8 +1,8 @@
{
"name": "fineui",
"version": "2.0.20220623154535",
"version": "2.0.20220624112553",
"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;
}
}

2
src/less/lib/constant.less

@ -246,4 +246,4 @@
@scroll-thumb-color-theme-dark: @color-black;
//box-shadow效果
@box-shadow-toast: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
@box-shadow-toast: 0 6px 20px -2px rgba(9, 30, 64, 0.16);

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;

244
src/widget/multiselect/loader.js

@ -0,0 +1,244 @@
/**
* 加载控件
*
* Created by GUY on 2015/8/31.
* @class BI.Loader
* @extends BI.Widget
*/
BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInnerLoader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-inner-loader",
direction: "top",
isDefaultInit: true, // 是否默认初始化数据
logic: {
dynamic: true,
scrolly: true
},
// 下面是button_group的属性
el: {
type: "bi.button_group",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
behaviors: {
redmark: function () {
return true;
}
},
layouts: [{
type: "bi.vertical"
}]
},
items: [],
itemsCreator: BI.emptyFn,
onLoaded: BI.emptyFn,
// 下面是分页信息
count: false,
prev: false,
next: {},
hasPrev: BI.emptyFn,
hasNext: BI.emptyFn
});
},
_nextLoad: function () {
var self = this, o = this.options;
this.next.setLoading();
if (this.cachItems && this.cachItems.length > 0) {
this.next.setLoaded();
this.addItems(this.cachItems.slice(0, 100));
this.cachItems = this.cachItems.slice(100);
return;
}
o.itemsCreator.apply(this, [{times: ++this.times}, function () {
self.next.setLoaded();
self.addItems.apply(self, arguments);
}]);
},
render: function () {
var self = this, o = this.options;
if (o.itemsCreator === false) {
o.next = false;
}
this.button_group = BI.createWidget(o.el, {
type: "bi.button_group",
chooseType: 0,
items: o.items,
behaviors: {},
layouts: [{
type: "bi.vertical"
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
var node = self.cachGroup.getNodeByValue(value);
if (node) {
node.setSelected(obj.isSelected());
}
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Loader.EVENT_CHANGE, obj);
}
});
this.cachGroup = BI.createWidget(o.el, {
type: "bi.button_group",
root: true,
chooseType: 0,
items: o.items,
behaviors: {},
layouts: [{
type: "bi.vertical"
}],
value: o.value
});
if (o.next !== false) {
this.next = BI.createWidget(BI.extend({
type: "bi.loading_bar"
}, o.next));
this.next.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self._nextLoad();
}
});
}
BI.createWidget({
type: "bi.vertical",
element: this,
items: [this.button_group, this.next]
});
o.isDefaultInit && BI.isEmpty(o.items) && BI.nextTick(BI.bind(function () {
o.isDefaultInit && BI.isEmpty(o.items) && this._populate();
}, this));
},
hasNext: function () {
var o = this.options;
if (BI.isNumber(o.count)) {
return this.count < o.count;
}
if (this.cachItems && this.cachItems.length > 0) {
return true;
}
return !!o.hasNext.apply(this, [{
times: this.times,
count: this.count
}]);
},
addItems: function (items) {
this.count += items.length;
if (BI.isObject(this.next)) {
if (this.hasNext()) {
this.options.items = this.options.items.concat(items);
this.next.setLoaded();
} else {
this.next.setEnd();
}
}
this.cachGroup.addItems.apply(this.cachGroup, arguments);
this.button_group.addItems.apply(this.button_group, arguments);
},
_populate: function (items) {
var self = this, o = this.options;
if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) {
o.itemsCreator.apply(this, [{times: 1}, function (items, keyword) {
if (arguments.length === 0) {
throw new Error("参数不能为空");
}
self.populate.apply(self, arguments);
o.onLoaded();
}]);
return false;
}
this.options.items = (items || []).slice(0, 100);
this.times = 1;
this.count = 0;
this.count += items.length;
if (BI.isObject(this.next)) {
if (this.hasNext()) {
this.next.setLoaded();
} else {
this.next.invisible();
}
}
return true;
},
populate: function (items, keyword) {
if (this._populate.apply(this, arguments)) {
this.cachItems = [];
if (items.length > 100) {
this.cachItems = items.slice(100);
}
this.cachGroup.populate.call(this.cachGroup, items, keyword);
this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword);
}
},
setNotSelectedValue: function () {
this.button_group.setNotSelectedValue.apply(this.button_group, arguments);
this.cachGroup.setNotSelectedValue.apply(this.cachGroup, arguments);
},
getNotSelectedValue: function () {
return this.cachGroup.getNotSelectedValue();
},
setValue: function () {
this.cachGroup.setValue.apply(this.cachGroup, arguments);
this.button_group.setValue.apply(this.button_group, arguments);
},
getValue: function () {
return this.cachGroup.getValue.apply(this.cachGroup, arguments);
},
getAllButtons: function () {
return this.button_group.getAllButtons();
},
getAllLeaves: function () {
return this.button_group.getAllLeaves();
},
getSelectedButtons: function () {
return this.button_group.getSelectedButtons();
},
getNotSelectedButtons: function () {
return this.button_group.getNotSelectedButtons();
},
getIndexByValue: function (value) {
return this.button_group.getIndexByValue(value);
},
getNodeById: function (id) {
return this.button_group.getNodeById(id);
},
getNodeByValue: function (value) {
return this.button_group.getNodeByValue(value);
},
empty: function () {
this.button_group.empty();
this.cachGroup.empty();
BI.each([this.prev, this.next], function (i, ob) {
ob && ob.setVisible(false);
});
}
});
BI.MultiSelectInnerLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_inner_loader", BI.MultiSelectInnerLoader);

20
src/widget/multiselect/multiselect.loader.js

@ -43,23 +43,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
el: BI.extend({
onLoaded: opts.onLoaded,
el: {
type: "bi.loader",
isDefaultInit: false,
logic: {
dynamic: true,
scrolly: true
},
el: {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
behaviors: {
redmark: function () {
return true;
}
},
layouts: [{
type: "bi.vertical"
}]
}
type: "bi.multi_select_inner_loader",
}
}, opts.el),
itemsCreator: function (op, callback) {
@ -190,4 +174,4 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
});
BI.MultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_loader", BI.MultiSelectLoader);
BI.shortcut("bi.multi_select_loader", BI.MultiSelectLoader);

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