Browse Source

Merge branch 'master' of http://cloud.finedevelop.com:2015/scm/fui/fineui

# Conflicts:
#	dist/_fineui.min.js
#	dist/bundle.min.js
#	dist/fineui.min.js
es6
windy 7 years ago
parent
commit
4456968c20
  1. 34
      demo/js/case/pager/demo.direction_pager.js
  2. 1
      demo/js/widget/table/demo.page_table.js
  3. 1
      dist/base.js
  4. 286
      dist/bundle.js
  5. 2
      dist/case.js
  6. 274
      dist/core.js
  7. 35
      dist/demo.js
  8. 2
      dist/fix/fix.compact.js
  9. 7
      dist/widget.js
  10. 1
      lodash.md
  11. 1
      src/base/single/button/button.basic.js
  12. 2
      src/case/button/item.singleselect.radio.js
  13. 5
      src/core/func/function.js
  14. 15
      src/core/inject.js
  15. 254
      src/core/lodash.js
  16. 6
      src/widget/singleselect/singleselect.combo.js
  17. 269
      utils/utils.js

34
demo/js/case/pager/demo.direction_pager.js

@ -3,14 +3,46 @@ Demo.Func = BI.inherit(BI.Widget, {
baseCls: "demo-func" baseCls: "demo-func"
}, },
mounted: function () {
this.pager.populate();
},
render: function () { render: function () {
var self = this;
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
hgap: 200, hgap: 200,
vgap: 50, vgap: 50,
element: this, element: this,
items: [{ items: [{
type: "bi.direction_pager" type: "bi.direction_pager",
ref: function (_ref) {
self.pager = _ref;
},
horizontal: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (v) {
return v > 1;
},
hasNext: function () {
return true;
},
firstPage: 1
},
vertical: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (v) {
return v > 1;
},
hasNext: function () {
return true;
},
firstPage: 1
}
}] }]
}); });
} }

1
demo/js/widget/table/demo.page_table.js

@ -190,6 +190,7 @@ Demo.Func = BI.inherit(BI.Widget, {
crossHeader: crossHeader, crossHeader: crossHeader,
crossItems: crossItems crossItems: crossItems
}); });
table1.populate();
// table1.populate(items, header, crossItems, crossHeader); // table1.populate(items, header, crossItems, crossHeader);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",

1
dist/base.js vendored

@ -904,6 +904,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (o.action) { if (o.action) {
BI.Actions.runAction(o.action, o); BI.Actions.runAction(o.action, o);
} }
BI.Actions.runGlobalAction(o);
} }
}, },

286
dist/bundle.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10444,6 +10444,20 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
/** /**
* Converts `set` to an array of its values. * Converts `set` to an array of its values.
* *
@ -11459,6 +11473,22 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -12487,6 +12517,116 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}; };
} }
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/** /**
* The base implementation of `_.orderBy` without param guards. * The base implementation of `_.orderBy` without param guards.
* *
@ -13706,6 +13846,30 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
stack['delete'](srcValue);
}
return objValue;
}
/** /**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects. * objects.
@ -17781,6 +17945,34 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
: (reIsBadHex.test(value) ? NAN : +value); : (reIsBadHex.test(value) ? NAN : +value);
} }
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/** /**
* Converts `value` to a string. An empty string is returned for `null` * Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved. * and `undefined` values. The sign of `-0` is preserved.
@ -17934,6 +18126,30 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return object; return object;
}); });
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});
/** /**
* This method is like `_.find` except that it returns the key of the first * This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself. * element `predicate` returns truthy for instead of the element itself.
@ -18228,6 +18444,41 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/** /**
* The opposite of `_.pick`; this method creates an object composed of the * The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted. * own and inherited enumerable property paths of `object` that are not omitted.
@ -18997,6 +19248,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.create = create; lodash.create = create;
lodash.debounce = debounce; lodash.debounce = debounce;
lodash.defaults = defaults; lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer; lodash.defer = defer;
lodash.delay = delay; lodash.delay = delay;
lodash.difference = difference; lodash.difference = difference;
@ -28472,7 +28724,6 @@ BI.extend(BI.DOM, {
}, },
getImage: function (param, fillStyle, backgroundColor) { getImage: function (param, fillStyle, backgroundColor) {
var image = new Image();
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
$("body").append(canvas); $("body").append(canvas);
var w = BI.DOM.getTextSizeWidth(param, 14) + 6; var w = BI.DOM.getTextSizeWidth(param, 14) + 6;
@ -28490,8 +28741,8 @@ BI.extend(BI.DOM, {
width: w, width: w,
height: 24, height: 24,
src: canvas.toDataURL("image/png"), src: canvas.toDataURL("image/png"),
style: "background-color: " + backColor + ";vertical-align: sub; margin: 0 3px;", style: "background-color: " + backColor + ";vertical-align: middle; margin: 0 3px;",
alt: param param: param
}; };
} }
});(function () { });(function () {
@ -28549,7 +28800,14 @@ BI.extend(BI.DOM, {
}; };
var actions = {}; var actions = {};
var globalAction = [];
BI.action = function (type, actionFn) { BI.action = function (type, actionFn) {
if (BI.isFunction(type)) {
globalAction.push(type);
return function () {
BI.remove(globalAction, actionFn);
};
}
if (!actions[type]) { if (!actions[type]) {
actions[type] = []; actions[type] = [];
} }
@ -28610,7 +28868,7 @@ BI.extend(BI.DOM, {
console.error(e); console.error(e);
} }
} }
} };
}(afns)); }(afns));
} }
} }
@ -28670,6 +28928,12 @@ BI.extend(BI.DOM, {
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
act(config); act(config);
}); });
},
runGlobalAction: function () {
var args = [].slice.call(arguments);
BI.each(globalAction, function (i, act) {
act.apply(null, args);
});
} }
}; };
})(); })();
@ -36161,6 +36425,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (o.action) { if (o.action) {
BI.Actions.runAction(o.action, o); BI.Actions.runAction(o.action, o);
} }
BI.Actions.runGlobalAction(o);
} }
}, },
@ -72305,7 +72570,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", { items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.radio], items: [this.radio],
width: 36 width: 16
}, this.text) }, this.text)
})))); }))));
}, },
@ -103332,7 +103597,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
BI.isKey(self._startValue) && (self.storeValue = self._startValue); BI.isKey(self._startValue) && (self.storeValue = self._startValue);
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
}; };
this.storeValue = o.value || ""; this.storeValue = o.value;
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;
@ -103638,7 +103903,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
}, },
@ -103660,7 +103925,8 @@ BI.extend(BI.SingleSelectCombo, {
BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo);/** BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo);
/**
* 选择列表 * 选择列表
* *
* Created by GUY on 2015/11/1. * Created by GUY on 2015/11/1.
@ -111097,6 +111363,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
needPop = true; needPop = true;
} }
this.store = this._store(); this.store = this._store();
this.store._widget = this;
needPop && popTarget(); needPop && popTarget();
needPop = false; needPop = false;
pushTarget(this.store); pushTarget(this.store);
@ -111136,6 +111403,7 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
if (this.store) { if (this.store) {
this.store._parent && (this.store._parent = null); this.store._parent && (this.store._parent = null);
this.store._widget && (this.store._widget = null);
this.store = null; this.store = null;
} }
delete this.__cacheStore; delete this.__cacheStore;

2
dist/case.js vendored

@ -365,7 +365,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", { items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.radio], items: [this.radio],
width: 36 width: 16
}, this.text) }, this.text)
})))); }))));
}, },

274
dist/core.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -10444,6 +10444,20 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
/** /**
* Converts `set` to an array of its values. * Converts `set` to an array of its values.
* *
@ -11459,6 +11473,22 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -12487,6 +12517,116 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}; };
} }
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/** /**
* The base implementation of `_.orderBy` without param guards. * The base implementation of `_.orderBy` without param guards.
* *
@ -13706,6 +13846,30 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
stack['delete'](srcValue);
}
return objValue;
}
/** /**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects. * objects.
@ -17781,6 +17945,34 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
: (reIsBadHex.test(value) ? NAN : +value); : (reIsBadHex.test(value) ? NAN : +value);
} }
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/** /**
* Converts `value` to a string. An empty string is returned for `null` * Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved. * and `undefined` values. The sign of `-0` is preserved.
@ -17934,6 +18126,30 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return object; return object;
}); });
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});
/** /**
* This method is like `_.find` except that it returns the key of the first * This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself. * element `predicate` returns truthy for instead of the element itself.
@ -18228,6 +18444,41 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/** /**
* The opposite of `_.pick`; this method creates an object composed of the * The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted. * own and inherited enumerable property paths of `object` that are not omitted.
@ -18997,6 +19248,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.create = create; lodash.create = create;
lodash.debounce = debounce; lodash.debounce = debounce;
lodash.defaults = defaults; lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer; lodash.defer = defer;
lodash.delay = delay; lodash.delay = delay;
lodash.difference = difference; lodash.difference = difference;
@ -28472,7 +28724,6 @@ BI.extend(BI.DOM, {
}, },
getImage: function (param, fillStyle, backgroundColor) { getImage: function (param, fillStyle, backgroundColor) {
var image = new Image();
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
$("body").append(canvas); $("body").append(canvas);
var w = BI.DOM.getTextSizeWidth(param, 14) + 6; var w = BI.DOM.getTextSizeWidth(param, 14) + 6;
@ -28490,8 +28741,8 @@ BI.extend(BI.DOM, {
width: w, width: w,
height: 24, height: 24,
src: canvas.toDataURL("image/png"), src: canvas.toDataURL("image/png"),
style: "background-color: " + backColor + ";vertical-align: sub; margin: 0 3px;", style: "background-color: " + backColor + ";vertical-align: middle; margin: 0 3px;",
alt: param param: param
}; };
} }
});(function () { });(function () {
@ -28549,7 +28800,14 @@ BI.extend(BI.DOM, {
}; };
var actions = {}; var actions = {};
var globalAction = [];
BI.action = function (type, actionFn) { BI.action = function (type, actionFn) {
if (BI.isFunction(type)) {
globalAction.push(type);
return function () {
BI.remove(globalAction, actionFn);
};
}
if (!actions[type]) { if (!actions[type]) {
actions[type] = []; actions[type] = [];
} }
@ -28610,7 +28868,7 @@ BI.extend(BI.DOM, {
console.error(e); console.error(e);
} }
} }
} };
}(afns)); }(afns));
} }
} }
@ -28670,6 +28928,12 @@ BI.extend(BI.DOM, {
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
act(config); act(config);
}); });
},
runGlobalAction: function () {
var args = [].slice.call(arguments);
BI.each(globalAction, function (i, act) {
act.apply(null, args);
});
} }
}; };
})(); })();

35
dist/demo.js vendored

@ -2797,14 +2797,46 @@ BI.shortcut("demo.all_count_pager", Demo.Func);Demo.Func = BI.inherit(BI.Widget,
baseCls: "demo-func" baseCls: "demo-func"
}, },
mounted: function () {
this.pager.populate();
},
render: function () { render: function () {
var self = this;
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
hgap: 200, hgap: 200,
vgap: 50, vgap: 50,
element: this, element: this,
items: [{ items: [{
type: "bi.direction_pager" type: "bi.direction_pager",
ref: function (_ref) {
self.pager = _ref;
},
horizontal: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (v) {
return v > 1;
},
hasNext: function () {
return true;
},
firstPage: 1
},
vertical: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (v) {
return v > 1;
},
hasNext: function () {
return true;
},
firstPage: 1
}
}] }]
}); });
} }
@ -13646,6 +13678,7 @@ BI.shortcut("demo.slider", Demo.Slider);Demo.Func = BI.inherit(BI.Widget, {
crossHeader: crossHeader, crossHeader: crossHeader,
crossItems: crossItems crossItems: crossItems
}); });
table1.populate();
// table1.populate(items, header, crossItems, crossHeader); // table1.populate(items, header, crossItems, crossHeader);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",

2
dist/fix/fix.compact.js vendored

@ -115,6 +115,7 @@
needPop = true; needPop = true;
} }
this.store = this._store(); this.store = this._store();
this.store._widget = this;
needPop && popTarget(); needPop && popTarget();
needPop = false; needPop = false;
pushTarget(this.store); pushTarget(this.store);
@ -154,6 +155,7 @@
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
if (this.store) { if (this.store) {
this.store._parent && (this.store._parent = null); this.store._parent && (this.store._parent = null);
this.store._widget && (this.store._widget = null);
this.store = null; this.store = null;
} }
delete this.__cacheStore; delete this.__cacheStore;

7
dist/widget.js vendored

@ -16696,7 +16696,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
BI.isKey(self._startValue) && (self.storeValue = self._startValue); BI.isKey(self._startValue) && (self.storeValue = self._startValue);
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
}; };
this.storeValue = o.value || ""; this.storeValue = o.value;
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;
@ -17002,7 +17002,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
}, },
@ -17024,7 +17024,8 @@ BI.extend(BI.SingleSelectCombo, {
BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo);/** BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo);
/**
* 选择列表 * 选择列表
* *
* Created by GUY on 2015/11/1. * Created by GUY on 2015/11/1.

1
lodash.md

@ -1 +0,0 @@
lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference

1
src/base/single/button/button.basic.js

@ -303,6 +303,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (o.action) { if (o.action) {
BI.Actions.runAction(o.action, o); BI.Actions.runAction(o.action, o);
} }
BI.Actions.runGlobalAction(o);
} }
}, },

2
src/case/button/item.singleselect.radio.js

@ -43,7 +43,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", { items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.radio], items: [this.radio],
width: 36 width: 16
}, this.text) }, this.text)
})))); }))));
}, },

5
src/core/func/function.js

@ -301,7 +301,6 @@ BI.extend(BI.DOM, {
}, },
getImage: function (param, fillStyle, backgroundColor) { getImage: function (param, fillStyle, backgroundColor) {
var image = new Image();
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
$("body").append(canvas); $("body").append(canvas);
var w = BI.DOM.getTextSizeWidth(param, 14) + 6; var w = BI.DOM.getTextSizeWidth(param, 14) + 6;
@ -319,8 +318,8 @@ BI.extend(BI.DOM, {
width: w, width: w,
height: 24, height: 24,
src: canvas.toDataURL("image/png"), src: canvas.toDataURL("image/png"),
style: "background-color: " + backColor + ";vertical-align: sub; margin: 0 3px;", style: "background-color: " + backColor + ";vertical-align: middle; margin: 0 3px;",
alt: param param: param
}; };
} }
}); });

15
src/core/inject.js

@ -53,7 +53,14 @@
}; };
var actions = {}; var actions = {};
var globalAction = [];
BI.action = function (type, actionFn) { BI.action = function (type, actionFn) {
if (BI.isFunction(type)) {
globalAction.push(type);
return function () {
BI.remove(globalAction, actionFn);
};
}
if (!actions[type]) { if (!actions[type]) {
actions[type] = []; actions[type] = [];
} }
@ -114,7 +121,7 @@
console.error(e); console.error(e);
} }
} }
} };
}(afns)); }(afns));
} }
} }
@ -174,6 +181,12 @@
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
act(config); act(config);
}); });
},
runGlobalAction: function () {
var args = [].slice.call(arguments);
BI.each(globalAction, function (i, act) {
act.apply(null, args);
});
} }
}; };
})(); })();

254
src/core/lodash.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -846,6 +846,20 @@
return result; return result;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
/** /**
* Converts `set` to an array of its values. * Converts `set` to an array of its values.
* *
@ -1861,6 +1875,22 @@
return result; return result;
} }
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -2889,6 +2919,116 @@
}; };
} }
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/** /**
* The base implementation of `_.orderBy` without param guards. * The base implementation of `_.orderBy` without param guards.
* *
@ -4108,6 +4248,30 @@
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
stack['delete'](srcValue);
}
return objValue;
}
/** /**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects. * objects.
@ -8183,6 +8347,34 @@
: (reIsBadHex.test(value) ? NAN : +value); : (reIsBadHex.test(value) ? NAN : +value);
} }
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/** /**
* Converts `value` to a string. An empty string is returned for `null` * Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved. * and `undefined` values. The sign of `-0` is preserved.
@ -8336,6 +8528,30 @@
return object; return object;
}); });
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});
/** /**
* This method is like `_.find` except that it returns the key of the first * This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself. * element `predicate` returns truthy for instead of the element itself.
@ -8630,6 +8846,41 @@
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/** /**
* The opposite of `_.pick`; this method creates an object composed of the * The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted. * own and inherited enumerable property paths of `object` that are not omitted.
@ -9399,6 +9650,7 @@
lodash.create = create; lodash.create = create;
lodash.debounce = debounce; lodash.debounce = debounce;
lodash.defaults = defaults; lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer; lodash.defer = defer;
lodash.delay = delay; lodash.delay = delay;
lodash.difference = difference; lodash.difference = difference;

6
src/widget/singleselect/singleselect.combo.js

@ -22,7 +22,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
BI.isKey(self._startValue) && (self.storeValue = self._startValue); BI.isKey(self._startValue) && (self.storeValue = self._startValue);
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
}; };
this.storeValue = o.value || ""; this.storeValue = o.value;
// 标记正在请求数据 // 标记正在请求数据
this.requesting = false; this.requesting = false;
@ -328,7 +328,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || ""; this.storeValue = v;
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
}, },
@ -350,4 +350,4 @@ BI.extend(BI.SingleSelectCombo, {
BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.SingleSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo); BI.shortcut("bi.single_select_combo", BI.SingleSelectCombo);

269
utils/utils.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -846,6 +846,20 @@
return result; return result;
} }
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
/** /**
* Converts `set` to an array of its values. * Converts `set` to an array of its values.
* *
@ -1861,6 +1875,22 @@
return result; return result;
} }
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -2889,6 +2919,116 @@
}; };
} }
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
assignMergeValue(object, key, newValue);
}
/** /**
* The base implementation of `_.orderBy` without param guards. * The base implementation of `_.orderBy` without param guards.
* *
@ -4108,6 +4248,30 @@
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
* @returns {*} Returns the value to assign.
*/
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
stack['delete'](srcValue);
}
return objValue;
}
/** /**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects. * objects.
@ -8183,6 +8347,34 @@
: (reIsBadHex.test(value) ? NAN : +value); : (reIsBadHex.test(value) ? NAN : +value);
} }
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
/** /**
* Converts `value` to a string. An empty string is returned for `null` * Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved. * and `undefined` values. The sign of `-0` is preserved.
@ -8336,6 +8528,30 @@
return object; return object;
}); });
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(function(args) {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});
/** /**
* This method is like `_.find` except that it returns the key of the first * This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself. * element `predicate` returns truthy for instead of the element itself.
@ -8630,6 +8846,41 @@
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/** /**
* The opposite of `_.pick`; this method creates an object composed of the * The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted. * own and inherited enumerable property paths of `object` that are not omitted.
@ -9399,6 +9650,7 @@
lodash.create = create; lodash.create = create;
lodash.debounce = debounce; lodash.debounce = debounce;
lodash.defaults = defaults; lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer; lodash.defer = defer;
lodash.delay = delay; lodash.delay = delay;
lodash.difference = difference; lodash.difference = difference;
@ -12987,7 +13239,14 @@ _.extend(BI.OB.prototype, {
}; };
var actions = {}; var actions = {};
var globalAction = [];
BI.action = function (type, actionFn) { BI.action = function (type, actionFn) {
if (BI.isFunction(type)) {
globalAction.push(type);
return function () {
BI.remove(globalAction, actionFn);
};
}
if (!actions[type]) { if (!actions[type]) {
actions[type] = []; actions[type] = [];
} }
@ -13048,7 +13307,7 @@ _.extend(BI.OB.prototype, {
console.error(e); console.error(e);
} }
} }
} };
}(afns)); }(afns));
} }
} }
@ -13108,6 +13367,12 @@ _.extend(BI.OB.prototype, {
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
act(config); act(config);
}); });
},
runGlobalAction: function () {
var args = [].slice.call(arguments);
BI.each(globalAction, function (i, act) {
act.apply(null, args);
});
} }
}; };
})(); })();

Loading…
Cancel
Save