Browse Source

Pull request #3077: 无JIRA任务 feature:提供textvaluecombo的复选功能

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '25b0dde07c031b884eba54711dc4192fb52fcf32':
  feature:提供textvaluecombo的复选功能
es6
guy-王川 2 years ago
parent
commit
81cf25c727
  1. 2
      lodash.md
  2. 18
      src/case/combo/textvaluecombo/combo.textvalue.js
  3. 109
      src/case/combo/textvaluecombo/popup.textvalue.js
  4. 193
      src/core/1.lodash.js
  5. 43
      src/core/logic/logic.layout.js
  6. 7
      src/core/platform/web/config.js

2
lodash.md

@ -1 +1 @@
lodash core plus="debounce,throttle,get,set,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,trim,merge,groupBy,uniqBy,before,after,unescape,chunk"
lodash core plus="debounce,throttle,get,set,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,trim,merge,groupBy,uniqBy,before,after,unescape,chunk,pick,pickBy,identity"

18
src/case/combo/textvaluecombo/combo.textvalue.js

@ -16,7 +16,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {},
allowClear: false,
status: "success", // success | warning | error,
title: null,
title: null
});
},
@ -44,11 +44,11 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
if (this.options.status === "error") {
return {
level: "warning",
text: o.warningTitle,
text: o.warningTitle
};
}
return {
level: "success",
level: "success"
};
};
@ -96,6 +96,18 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
action: (...args) => {
this.fireEvent(BI.Controller.EVENT_CHANGE, ...args);
}
}, {
eventName: BI.TextValueComboPopup.EVENT_CLEAR,
action: (...args) => {
changeTag = true;
this.setValue([]);
this.combo.hideView();
}
}, {
eventName: BI.TextValueComboPopup.EVENT_CONFIRM,
action: (...args) => {
this.combo.hideView();
}
}
]
};

109
src/case/combo/textvaluecombo/popup.textvalue.js

@ -6,33 +6,93 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
});
},
_init: function () {
BI.TextValueComboPopup.superclass._init.apply(this, arguments);
render () {
var o = this.options, self = this;
this.popup = BI.createWidget({
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return {
type: "bi.vertical",
vgap: 5,
items: [{
type: "bi.button_group",
ref: (_ref) => {
this.popup = _ref;
},
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
value: o.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
this.check();
BI.createWidget({
}
}]
}]
};
}
return {
type: "bi.vertical",
element: this,
vgap: 5,
items: [this.popup]
});
verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""],
items: [{
type: "bi.select_list",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
el: {
chooseType: o.chooseType
}
},
items: this._formatItems(o.items),
value: {
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: o.value
},
listeners: [{
eventName: BI.SelectList.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}]
}, {
type: "bi.center",
cls: "list-view-toolbar bi-high-light bi-split-top",
height: 24,
items: BI.createItems([{
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}
}, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
}
}], {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
}]
};
},
mounted: function () {
this.check();
},
_formatItems: function (items) {
@ -40,6 +100,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return BI.map(items, function (i, item) {
return BI.extend({
type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item",
iconWrapperWidth: 36,
textAlign: o.textAlign,
title: item.title || item.text
}, item);
@ -52,13 +113,29 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
},
getValue: function () {
if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return this.popup.getValue();
}
var val = this.popup.getValue();
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value;
} else {
return val.assist;
}
},
setValue: function (v) {
this.popup.setValue(v);
if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
return this.popup.setValue(v);
}
this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v
});
}
});
BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.TextValueComboPopup.EVENT_CLEAR = "EVENT_CLEAR";
BI.TextValueComboPopup.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);

193
src/core/1.lodash.js

@ -1,7 +1,7 @@
/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,set,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,trim,merge,groupBy,uniqBy,before,after,unescape,chunk"`
* Build: `lodash core plus="debounce,throttle,get,set,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,trim,merge,groupBy,uniqBy,before,after,unescape,chunk,pick,pickBy,identity"`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -272,8 +272,7 @@
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {
}
} catch (e) {}
}());
/* Node.js helper references. */
@ -297,14 +296,10 @@
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
@ -750,8 +745,7 @@
var index = -1,
length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
}
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
@ -767,8 +761,7 @@
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
}
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
@ -1073,8 +1066,7 @@
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {
}
} catch (e) {}
}());
/* Built-in method references for those with the same name as other `lodash` methods. */
@ -1256,9 +1248,7 @@
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {
}
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
@ -2209,9 +2199,7 @@
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return setTimeout(function () {
func.apply(undefined, args);
}, wait);
return setTimeout(function() { func.apply(undefined, args); }, wait);
}
/**
@ -2242,7 +2230,8 @@
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
} else if (values.length >= LARGE_ARRAY_SIZE) {
}
else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
@ -2261,7 +2250,8 @@
}
}
result.push(value);
} else if (!includes(values, computed, comparator)) {
}
else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
@ -3001,7 +2991,8 @@
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} else {
}
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
@ -3053,25 +3044,32 @@
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
} else if (isArrayLikeObject(objValue)) {
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
} else if (isBuff) {
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
} else if (isTyped) {
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
} else {
}
else {
newValue = [];
}
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
} else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
}
} else {
}
else {
isCommon = false;
}
}
@ -3373,7 +3371,8 @@
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
@ -3381,7 +3380,8 @@
isCommon = false;
includes = cacheHas;
seen = new SetCache;
} else {
}
else {
seen = iteratee ? [] : result;
}
outer:
@ -3401,7 +3401,8 @@
seen.push(computed);
}
result.push(value);
} else if (!includes(seen, computed, comparator)) {
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
@ -3941,7 +3942,6 @@
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
@ -3960,22 +3960,14 @@
// for more details.
var args = arguments;
switch (args.length) {
case 0:
return new Ctor;
case 1:
return new Ctor(args[0]);
case 2:
return new Ctor(args[0], args[1]);
case 3:
return new Ctor(args[0], args[1], args[2]);
case 4:
return new Ctor(args[0], args[1], args[2], args[3]);
case 5:
return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
@ -4020,7 +4012,6 @@
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return apply(fn, this, args);
}
return wrapper;
}
@ -4037,9 +4028,7 @@
if (!isArrayLike(collection)) {
var iteratee = baseIteratee(predicate, 3);
collection = keys(collection);
predicate = function (key) {
return iteratee(iterable[key], key, iterable);
};
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
@ -4116,7 +4105,6 @@
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
@ -4166,7 +4154,6 @@
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
@ -4740,8 +4727,7 @@
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {
}
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
@ -4809,16 +4795,11 @@
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
@ -4844,18 +4825,10 @@
size = data.size;
switch (data.type) {
case 'drop':
start += size;
break;
case 'dropRight':
end -= size;
break;
case 'take':
end = nativeMin(end, start + size);
break;
case 'takeRight':
start = nativeMax(start, end - size);
break;
case 'drop': start += size; break;
case 'dropRight': end -= size; break;
case 'take': end = nativeMin(end, start + size); break;
case 'takeRight': start = nativeMax(start, end - size); break;
}
}
return { 'start': start, 'end': end };
@ -4961,15 +4934,9 @@
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag:
case float64Tag:
case int8Tag:
case int16Tag:
case int32Tag:
case uint8Tag:
case uint8ClampedTag:
case uint16Tag:
case uint32Tag:
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
@ -5475,12 +5442,10 @@
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {
}
} catch (e) {}
try {
return (func + '');
} catch (e) {
}
} catch (e) {}
}
return '';
}
@ -5997,7 +5962,8 @@
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
start = 0;
end = length;
} else {
}
else {
start = start == null ? 0 : toInteger(start);
end = end === undefined ? length : toInteger(end);
}
@ -6352,9 +6318,7 @@
var length = paths.length,
start = length ? paths[0] : 0,
value = this.__wrapped__,
interceptor = function (object) {
return baseAt(object, paths);
};
interceptor = function(object) { return baseAt(object, paths); };
if (length > 1 || this.__actions__.length ||
!(value instanceof LazyWrapper) || !isIndex(start)) {
@ -7378,7 +7342,6 @@
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
@ -7523,14 +7486,10 @@
return function() {
var args = arguments;
switch (args.length) {
case 0:
return !predicate.call(this);
case 1:
return !predicate.call(this, args[0]);
case 2:
return !predicate.call(this, args[0], args[1]);
case 3:
return !predicate.call(this, args[0], args[1], args[2]);
case 0: return !predicate.call(this);
case 1: return !predicate.call(this, args[0]);
case 2: return !predicate.call(this, args[0], args[1]);
case 3: return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
@ -7761,9 +7720,7 @@
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function () {
return arguments;
}()) ? baseIsArguments : function (value) {
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
@ -9442,7 +9399,8 @@
if (typeof upper == 'boolean') {
floating = upper;
upper = undefined;
} else if (typeof lower == 'boolean') {
}
else if (typeof lower == 'boolean') {
floating = lower;
lower = undefined;
}
@ -9450,7 +9408,8 @@
if (lower === undefined && upper === undefined) {
lower = 0;
upper = 1;
} else {
}
else {
lower = toFinite(lower);
if (upper === undefined) {
upper = lower;
@ -10024,6 +9983,7 @@
lodash.omitBy = omitBy;
lodash.once = once;
lodash.pick = pick;
lodash.pickBy = pickBy;
lodash.range = range;
lodash.reject = reject;
lodash.rest = rest;
@ -10336,7 +10296,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.
BI._ = lodash;
root._ = lodash;
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
@ -10350,7 +10310,8 @@
(freeModule.exports = lodash)._ = lodash;
// Export for CommonJS support.
freeExports._ = lodash;
} else {
}
else {
// Export to the global object.
BI._ = lodash;
}

43
src/core/logic/logic.layout.js

@ -32,7 +32,7 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.vtape";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -45,8 +45,12 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -85,7 +89,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
@ -98,8 +102,12 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -135,19 +143,21 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.window";
}
return {
return _.pickBy({
type: layout,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
columns: o.columns,
rows: o.rows,
columnSize: o.columnSize,
rowSize: o.rowSize,
hgap: o.hgap,
vgap: o.vgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
rowSize: o.rowSize
}, _.identity);
}
});
@ -188,9 +198,8 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
} else {
layout = "bi.htape";
}
return {
return _.pickBy({
type: layout,
columnSize: columnSize,
scrollable: o.scrollable,
scrolly: o.scrolly,
scrollx: o.scrollx,
@ -202,7 +211,11 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
bgap: o.bgap,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
items: o.items
};
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: columnSize,
rowSize: o.rowSize
}, _.identity);
}
});

7
src/core/platform/web/config.js

@ -62,6 +62,13 @@
})
});
}
if (ob.verticalAlign === BI.VerticalAlign.Stretch) {
if (isSupportFlex()) {
return BI.extend({
horizontalAlign: BI.HorizontalAlign.Stretch,
}, ob, { type: "bi.flex_vertical" });
}
}
return ob;
});
BI.Plugin.configWidget("bi.inline", function (ob) {

Loading…
Cancel
Save