Browse Source

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

es6
Tangjinxia 4 years ago
parent
commit
39bef4e13c
  1. 5
      changelog.md
  2. 29
      demo.worker.js
  3. 6
      demo/js/base/editor/demo.textarea_editor.js
  4. 2
      demo/js/case/tree/demo.level_tree.js
  5. 2
      demo/js/widget/tree/demo.multilayer_select_level_tree.js
  6. 4
      dist/2.0/fineui.css
  7. 4
      dist/2.0/fineui.ie.min.js
  8. 2
      dist/2.0/fineui.ie.min.js.map
  9. 3859
      dist/2.0/fineui.js
  10. 2
      dist/2.0/fineui.js.map
  11. 4
      dist/2.0/fineui.min.css
  12. 4
      dist/2.0/fineui.min.js
  13. 2
      dist/2.0/fineui.min.js.map
  14. 4
      dist/2.0/fineui_without_normalize.css
  15. 4
      dist/2.0/fineui_without_normalize.min.css
  16. 4
      dist/bundle.min.css
  17. 4
      dist/bundle.min.js
  18. 2
      dist/bundle.min.js.map
  19. 4
      dist/demo.css
  20. 4207
      dist/demo.js
  21. 2
      dist/demo.js.map
  22. 4
      dist/fineui.css
  23. 4
      dist/fineui.ie.min.js
  24. 2
      dist/fineui.ie.min.js.map
  25. 3886
      dist/fineui.js
  26. 2
      dist/fineui.js.map
  27. 4
      dist/fineui.min.css
  28. 4
      dist/fineui.min.js
  29. 2
      dist/fineui.min.js.map
  30. 1819
      dist/fineui_without_jquery_polyfill.js
  31. 2
      dist/fineui_without_jquery_polyfill.js.map
  32. 6
      dist/fix/fix.js
  33. 157
      dist/fix/worker.compact.js
  34. 4
      dist/font.css
  35. 34
      dist/lib/base/single/input/input.d.ts
  36. 10
      dist/lib/case/combo/searchtextvaluecombo/combo.searchtextvalue.d.ts
  37. 8
      dist/lib/core/base.d.ts
  38. 8
      dist/lib/core/plugin.d.ts
  39. 4
      dist/lib/index.d.ts
  40. 155
      dist/utils.js
  41. 2
      dist/utils.js.map
  42. 4
      dist/utils.min.js
  43. 2
      dist/utils.min.js.map
  44. 3
      i18n/i18n.cn.js
  45. 3
      i18n/i18n.en.js
  46. 2
      package.json
  47. 82
      src/base/combination/combo.js
  48. 23
      src/base/combination/searcher.js
  49. 22
      src/base/layer/layer.popover.js
  50. 3
      src/base/pager/pager.js
  51. 4
      src/base/single/button/button.basic.js
  52. 40
      src/base/single/editor/editor.textarea.js
  53. 4
      src/case/button/icon/icon.trigger.js
  54. 2
      src/case/button/node/node.first.plus.js
  55. 74
      src/case/button/treeitem/item.root.treeleaf.js
  56. 12
      src/case/colorchooser/colorchooser.custom.js
  57. 4
      src/case/colorchooser/colorchooser.js
  58. 248
      src/case/colorchooser/colorchooser.popup.hex.js
  59. 49
      src/case/colorchooser/colorchooser.popup.hex.simple.js
  60. 2
      src/case/colorchooser/colorchooser.popup.simple.js
  61. 2
      src/case/colorchooser/colorchooser.simple.js
  62. 308
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  63. 178
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js
  64. 14
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  65. 10
      src/case/colorchooser/colorpicker/editor.colorpicker.simple.js
  66. 8
      src/case/tree/tree.level.js
  67. 77
      src/case/tree/treeexpander/tree.expander.js
  68. 53
      src/case/tree/treeexpander/tree.expander.popup.js
  69. 10
      src/component/treevaluechooser/abstract.treevaluechooser.js
  70. 47
      src/core/worker.js
  71. 31
      src/core/wrapper/layout.js
  72. 30
      src/core/wrapper/layout/layout.border.js
  73. 27
      src/core/wrapper/layout/layout.card.js
  74. 12
      src/core/wrapper/layout/layout.division.js
  75. 2
      src/core/wrapper/layout/layout.grid.js
  76. 4
      src/core/wrapper/layout/layout.table.js
  77. 20
      src/core/wrapper/layout/layout.tape.js
  78. 2
      src/core/wrapper/layout/layout.td.js
  79. 13
      src/core/wrapper/layout/layout.window.js
  80. 8
      src/less/base/single/editor/editor.multifile.less
  81. 9
      src/less/base/tree/tree.expander.less
  82. 6
      src/less/core/utils/common.less
  83. 12
      src/less/image.less
  84. 4
      src/widget/date/calendar/picker.year.js
  85. 2
      src/widget/dynamicdate/dynamicdate.combo.js
  86. 42
      src/widget/multilayerselecttree/multilayerselecttree.leveltree.js
  87. 30
      src/widget/multilayerselecttree/node/node.first.plus.js
  88. 23
      src/widget/multilayerselecttree/node/node.last.plus.js
  89. 23
      src/widget/multilayerselecttree/node/node.mid.plus.js
  90. 23
      src/widget/multilayerselecttree/node/node.plus.js
  91. 42
      src/widget/multilayersingletree/multilayersingletree.leveltree.js
  92. 23
      src/widget/multilayersingletree/node/node.first.plus.js
  93. 23
      src/widget/multilayersingletree/node/node.last.plus.js
  94. 23
      src/widget/multilayersingletree/node/node.mid.plus.js
  95. 24
      src/widget/multilayersingletree/treeitem/item.first.treeleaf.js
  96. 23
      src/widget/multilayersingletree/treeitem/item.last.treeleaf.js
  97. 23
      src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js
  98. 45
      typescript/base/single/input/input.ts
  99. 14
      typescript/case/combo/searchtextvaluecombo/combo.searchtextvalue.ts
  100. 8
      typescript/core/base.ts
  101. Some files were not shown because too many files have changed in this diff Show More

5
changelog.md

@ -1,4 +1,9 @@
# 更新日志
2.0(2020-11)
- 修复了Popover小屏幕上看不完整的问题
- 颜色选择器支持输入16进制颜色编号
- bi.textarea_editor支持气泡提示报错
2.0(2020-10)
- 支持Composition API
- pane和loadingPane支持加载时自定义提示文本

29
demo.worker.js

@ -0,0 +1,29 @@
if (this.importScripts) {
importScripts("./dist/fineui_without_jquery_polyfill.js");
BI.initWorker();
}
var Model = BI.inherit(Fix.Model, {
state: function () {
return {
count: 0
};
},
computed: {
name: function () {
return this.getText(this.model.count);
}
},
actions: {
addCount: function () {
this.model.count += 1;
}
},
getText (count) {
return "被点击了" + count + "次";
}
});
BI.model("demo.model", Model);

6
demo/js/base/editor/demo.textarea_editor.js

@ -8,7 +8,11 @@ Demo.CodeEditor = BI.inherit(BI.Widget, {
cls: "bi-border",
width: 600,
height: 400,
watermark: "请输入内容"
watermark: "请输入内容",
errorText: "检测内容有误",
validationChecker: function (v) {
return BI.isNotEmptyString(v);
},
});
editor.on(BI.TextAreaEditor.EVENT_FOCUS, function () {
BI.Msg.toast("Focus");

2
demo/js/case/tree/demo.level_tree.js

@ -84,4 +84,4 @@ Demo.Func = BI.inherit(BI.Widget, {
});
}
});
BI.shortcut("demo.level_tree", Demo.Func);
BI.shortcut("demo.level_tree", Demo.Func);

2
demo/js/widget/tree/demo.multilayer_select_level_tree.js

@ -44,4 +44,4 @@ Demo.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
}
});
BI.shortcut("demo.multilayer_select_level_tree", Demo.MultiLayerSelectLevelTree);
BI.shortcut("demo.multilayer_select_level_tree", Demo.MultiLayerSelectLevelTree);

4
dist/2.0/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

3859
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored

File diff suppressed because one or more lines are too long

4207
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

3886
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

1819
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

6
dist/fix/fix.js vendored

@ -359,7 +359,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
uniq[name] = true;
}
}
//添加访问器属性
//添加访问器属性
for (name in accessors) {
if (uniq[name]) {
continue;
@ -850,7 +850,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
options && options.refresh || this.deep) {
_.isObject(value) && options && options.refresh || this.deep) {
// set new value
var oldValue = this.value;
this.value = value;
@ -1462,4 +1462,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.toJSON = toJSON;
exports.__esModule = true;
});
});

157
dist/fix/worker.compact.js vendored

@ -0,0 +1,157 @@
;(function () {
var contexts = {};
var WORKER;
BI.useWorker = function (wk) {
WORKER = wk;
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {
this.$destroyWorker = createWorker.call(this);
try {
_init.apply(this, arguments);
} catch (e) {
console.error(e);
}
};
var _initRender = BI.Widget.prototype._initRender;
var postMessage = function (data) {
switch (data.eventType) {
case "create":
this.model = data.msg;
_initRender.call(this);
break;
case "watch":
var watchArgs = data.args;
this.watch[data.currentWatchType].apply(this, watchArgs);
break;
}
};
BI.Widget.prototype._initRender = function () {
if (WORKER && this._worker) {
this.__asking = true;
this.__async = true;
} else {
_initRender.apply(this, arguments);
}
};
var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () {
this.$destroyWorker && this.$destroyWorker();
try {
unMount.apply(this, arguments);
} catch (e) {
console.error(e);
}
};
if (WORKER) {
WORKER.addEventListener("message", function (e) {
var data = e.data;
postMessage.apply(contexts[data.name], [data]);
}, false);
}
};
function createWorker () {
var self = this;
if (this._worker) {
var name = this.getName();
var modelType = this._worker();
var options;
if (BI.isArray(modelType)) {
options = modelType[1];
modelType = modelType[0];
}
if (WORKER) {
contexts[name] = this;
WORKER.postMessage({
type: modelType,
name: name,
eventType: "create",
options: options,
watches: BI.map(this.watch, function (key) {
return key;
})
});
var store = {};
this.store = new Proxy(store, {
get (target, key) {
return function () {
WORKER.postMessage({
type: modelType,
name: name,
eventType: "action",
action: key,
args: [].slice.call(arguments)
});
};
},
set (target, key, value) {
return Reflect.set(target, key, value);
}
});
return function () {
delete contexts[name];
WORKER.postMessage({
type: modelType,
name: name,
eventType: "destroy"
});
};
} else {
this.store = BI.Models.getModel(modelType, options);
this.store && (this.store._widget = this);
if (this.store instanceof Fix.Model) {
this.model = this.store.model;
} else {
this.model = this.store;
}
initWatch(this, this.watch);
return function () {
this.store && BI.isFunction(this.store.destroy) && this.store.destroy();
BI.each(this._watchers, function (i, unwatches) {
unwatches = BI.isArray(unwatches) ? unwatches : [unwatches];
BI.each(unwatches, function (j, unwatch) {
unwatch();
});
});
this._watchers && (this._watchers = []);
if (this.store) {
this.store._parent && (this.store._parent = null);
this.store._widget && (this.store._widget = null);
this.store = null;
}
};
}
}
}
function initWatch (vm, watch) {
vm._watchers || (vm._watchers = []);
for (var key in watch) {
var handler = watch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i]));
}
} else {
vm._watchers.push(createWatcher(vm, key, handler));
}
}
}
function createWatcher (vm, keyOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
}
options = options || {};
return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, {
store: vm.store
}));
}
}());

4
dist/font.css vendored

File diff suppressed because one or more lines are too long

34
dist/lib/base/single/input/input.d.ts vendored

@ -0,0 +1,34 @@
import { _Single } from "../single";
export interface _Input extends _Single {
onClick(): void;
onKeyDown(keyCode: number): void;
focus(): void;
blur(): void;
selectAll(): void;
setValue(v: string): void;
getValue(): string;
isEditing(): boolean;
getLastValidValue(): string;
getLastChangedValue(): string;
}
export interface _InputStatic {
EVENT_CHANGE: string;
EVENT_FOCUS: string;
EVENT_CLICK: string;
EVENT_BLUR: string;
EVENT_KEY_DOWN: string;
EVENT_QUICK_DOWN: string;
EVENT_SPACE: string;
EVENT_BACKSPACE: string;
EVENT_START: string;
EVENT_PAUSE: string;
EVENT_STOP: string;
EVENT_CHANGE_CONFIRM: string;
EVENT_CONFIRM: string;
EVENT_REMOVE: string;
EVENT_EMPTY: string;
EVENT_VALID: string;
EVENT_ERROR: string;
EVENT_ENTER: string;
EVENT_RESTRICT: string;
}

10
dist/lib/case/combo/searchtextvaluecombo/combo.searchtextvalue.d.ts vendored

@ -0,0 +1,10 @@
import { _Widget } from "../../../core/widget";
export interface _SearchTextValueCombo extends _Widget {
populate(items: any[]): void;
setValue(v: any): void;
getValue<T>(): T[];
}
export interface _SearchTextValueComboStatic {
EVENT_CHANGE: string;
EVENT_BEFORE_POPUPVIEW: string;
}

8
dist/lib/core/base.d.ts vendored

@ -135,7 +135,7 @@ export interface _base {
isNotEmptyObject: (obj: any) => obj is object;
isWindow: (obj: any) => obj is Window;
isDeepMatch: (object: any, attrs: any) => boolean;
contains: (obj: any[], target: any, fromIndex?: number) => number;
contains: (obj: any[], target: any, fromIndex?: number) => boolean;
deepContains: (obj: any[], copy: any) => number;
deepIndexOf: (obj: any[], target: any) => number;
deepRemove: (obj: any[], target: any) => boolean;
@ -147,11 +147,11 @@ export interface _base {
chain: (value: any) => any;
iteratee: (func?: Function, thisArg?: any) => Function;
unescape: (str?: string) => string;
bind: (func: Function, thisArg: any, ...partials: any) => Function;
bind: <T extends Function>(func: T, thisArg: any, ...partials: any) => T;
once: (func: Function) => Function;
partial: (func: Function, ...partials: any) => Function;
debounce: (func: Function, wait?: number, options?: any) => Function;
throttle: (func: Function, wait?: number, options?: any) => Function;
debounce: <T extends Function>(func: T, wait?: number, options?: any) => T;
throttle: <T extends Function>(func: T, wait?: number, options?: any) => T;
delay: (func: Function, wait: number, ...args: any[]) => number;
defer: (func: Function, ...args: any[]) => number;
wrap: (value: any, wrapper: Function) => Function;

8
dist/lib/core/plugin.d.ts vendored

@ -1,9 +1,9 @@
import { _Widget } from "./widget";
declare type configWidgetFn = (options: object) => object;
declare type configObjectFn = (widget: _Widget) => void;
declare type configWidgetFn = (type: string, options: Obj) => void;
declare type configObjectFn = (type: string, widget: _Widget) => void;
export declare type _config = (widgetFunction: configWidgetFn | configWidgetFn[], objectFunction: configObjectFn | configObjectFn[]) => void;
export declare type _configWidget = (shorcut: string, widgetFunction: configWidgetFn) => void;
export declare type _registerObject = (shorcut: string, objectFunction: configObjectFn) => void;
export declare type _configWidget = (shortcut: string, widgetFunction: configWidgetFn) => void;
export declare type _registerObject = (shortcut: string, objectFunction: configObjectFn) => void;
export declare type _Plugin = {
config: _config;
configWidget: _configWidget;

4
dist/lib/index.d.ts vendored

@ -10,6 +10,7 @@ import { _IconTextItem, _IconTextItemStatic } from "./base/single/button/listite
import { _Editor, _EditorStatic } from "./base/single/editor/editor";
import { _Iframe } from "./base/single/iframe/iframe";
import { _Checkbox, _CheckboxStatic } from "./base/single/input/checkbox";
import { _Input, _InputStatic } from "./base/single/input/input";
import { _AbstractLabel } from "./base/single/label/abstract.label";
import { _Label } from "./base/single/label/label";
import { _Single } from "./base/single/single";
@ -19,6 +20,7 @@ import { _IconChangeButton, _IconChangeButtonStatic } from "./case/button/icon/i
import { _MultiSelectItem, _MultiSelectItemStatic } from "./case/button/item.multiselect";
import { _BubbleCombo, _BubbleComboStatic } from "./case/combo/bubblecombo/combo.bubble";
import { _TextValueCombo, _TextValueComboStatic } from "./case/combo/combo.textvalue";
import { _SearchTextValueCombo, _SearchTextValueComboStatic } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue";
import { _SignEditor, _SignEditorStatic } from "./case/editor/editor.sign";
import { _LoadingPane } from "./case/loading/loading_pane";
import { _AllValueMultiTextValueCombo, _AllValueMultiTextValueComboStatic } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
@ -92,6 +94,8 @@ export interface BI extends _func, _i18n, _base, _inject {
Iframe: ClassConstructor<_Iframe>;
AbsoluteLayout: ClassConstructor<_AbsoluteLayout>;
VerticalLayout: ClassConstructor<_VerticalLayout>;
Input: ClassConstructor<_Input> & _InputStatic;
SearchTextValueCombo: ClassConstructor<_SearchTextValueCombo> & _SearchTextValueComboStatic;
}
declare const _default: {
Decorators: typeof decorator;

155
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2020-10-22 11:20:30 */
/*! time: 2020-11-16 12:50:27 */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -82,7 +82,7 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1080);
/******/ return __webpack_require__(__webpack_require__.s = 1089);
/******/ })
/************************************************************************/
/******/ ({
@ -4240,7 +4240,7 @@ if (!_global.BI) {
/***/ }),
/***/ 1080:
/***/ 1089:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(101);
@ -4270,8 +4270,8 @@ __webpack_require__(118);
__webpack_require__(119);
__webpack_require__(120);
__webpack_require__(121);
__webpack_require__(745);
__webpack_require__(1081);
__webpack_require__(754);
__webpack_require__(1090);
__webpack_require__(131);
__webpack_require__(132);
module.exports = __webpack_require__(133);
@ -4279,7 +4279,76 @@ module.exports = __webpack_require__(133);
/***/ }),
/***/ 1081:
/***/ 109:
/***/ (function(module, exports) {
!(function () {
function aspect (type) {
return function (target, methodName, advice) {
var exist = target[methodName],
dispatcher;
if (!exist || exist.target != target) {
dispatcher = target[methodName] = function () {
// before methods
var beforeArr = dispatcher.before;
var args = arguments, next;
for (var l = beforeArr.length; l--;) {
next = beforeArr[l].advice.apply(this, args);
if (next === false) {
return false;
}
args = next || args;
}
// target method
var rs = dispatcher.method.apply(this, args);
// after methods
var afterArr = dispatcher.after;
for (var i = 0, ii = afterArr.length; i < ii; i++) {
next = afterArr[i].advice.call(this, rs, args);
if (rs === false) {
return false;
}
args = next || args;
}
return rs;
};
dispatcher.before = [];
dispatcher.after = [];
if (exist) {
dispatcher.method = exist;
}
dispatcher.target = target;
}
var aspectArr = (dispatcher || exist)[type];
var obj = {
advice: advice,
_index: aspectArr.length,
remove: function () {
aspectArr.splice(this._index, 1);
}
};
aspectArr.push(obj);
return obj;
};
}
BI.aspect = {
before: aspect("before"),
after: aspect("after")
};
return BI.aspect;
})();
/***/ }),
/***/ 1090:
/***/ (function(module, exports) {
/**
@ -4351,75 +4420,6 @@ BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
/***/ }),
/***/ 109:
/***/ (function(module, exports) {
!(function () {
function aspect (type) {
return function (target, methodName, advice) {
var exist = target[methodName],
dispatcher;
if (!exist || exist.target != target) {
dispatcher = target[methodName] = function () {
// before methods
var beforeArr = dispatcher.before;
var args = arguments, next;
for (var l = beforeArr.length; l--;) {
next = beforeArr[l].advice.apply(this, args);
if (next === false) {
return false;
}
args = next || args;
}
// target method
var rs = dispatcher.method.apply(this, args);
// after methods
var afterArr = dispatcher.after;
for (var i = 0, ii = afterArr.length; i < ii; i++) {
next = afterArr[i].advice.call(this, rs, args);
if (rs === false) {
return false;
}
args = next || args;
}
return rs;
};
dispatcher.before = [];
dispatcher.after = [];
if (exist) {
dispatcher.method = exist;
}
dispatcher.target = target;
}
var aspectArr = (dispatcher || exist)[type];
var obj = {
advice: advice,
_index: aspectArr.length,
remove: function () {
aspectArr.splice(this._index, 1);
}
};
aspectArr.push(obj);
return obj;
};
}
BI.aspect = {
before: aspect("before"),
after: aspect("after")
};
return BI.aspect;
})();
/***/ }),
/***/ 110:
@ -9172,7 +9172,7 @@ process.umask = function () {
/***/ }),
/***/ 745:
/***/ 754:
/***/ (function(module, exports) {
BI.i18n = {
@ -9364,7 +9364,8 @@ BI.i18n = {
"BI-Basic_Billion": "亿",
"BI-Basic_Quarter": "季度",
"BI-Basic_No_Select": "不选",
"BI-Basic_Now": "此刻"
"BI-Basic_Now": "此刻",
"BI-Color_Picker_Error_Text_Hex": "请输入6位16进制颜色编号"
};
/***/ })

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

3
i18n/i18n.cn.js

@ -187,5 +187,6 @@ BI.i18n = {
"BI-Basic_Billion": "亿",
"BI-Basic_Quarter": "季度",
"BI-Basic_No_Select": "不选",
"BI-Basic_Now": "此刻"
"BI-Basic_Now": "此刻",
"BI-Color_Picker_Error_Text_Hex": "请输入6位16进制颜色编号"
};

3
i18n/i18n.en.js

@ -117,5 +117,6 @@ BI.i18n = {
"BI-Basic_Simple_Thursday": "Thu",
"BI-Multi_Date_Year_Prev": "",
"BI-Tiao_Data": "",
"BI-Basic_Italic": "Italic"
"BI-Basic_Italic": "Italic",
"BI-Color_Picker_Error_Text_Hex": "Please Input Correct Hex Value"
};

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20201022112201",
"version": "2.0.20201116125158",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

82
src/base/combination/combo.js

@ -81,7 +81,7 @@
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{el: this.combo}
{ el: this.combo }
]
}))));
o.isDefaultInit && (this._assertPopupView());
@ -117,7 +117,7 @@
var enterPopup = false;
function hide (e) {
function hide(e) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(e);
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
@ -181,45 +181,49 @@
});
break;
case "click-hover":
var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
// if (self.isViewVisible()) {
// return;
// }
self._popupView(e);
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
case "click-blur":
// IE走click-hover逻辑
if (BI.isIE() || ev === "click-hover") {
var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
// if (self.isViewVisible()) {
// return;
// }
self._popupView(e);
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
}
}
}
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e);
st(e);
});
self.element.on("mouseleave." + self.getName(), function (e) {
if (self.popupView) {
self.popupView.element.on("mouseenter." + self.getName(), function (e) {
enterPopup = true;
self.popupView.element.on("mouseleave." + self.getName(), function (e) {
hide(e);
}, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e);
st(e);
});
self.element.on("mouseleave." + self.getName(), function (e) {
if (self.popupView) {
self.popupView.element.on("mouseenter." + self.getName(), function (e) {
enterPopup = true;
self.popupView.element.on("mouseleave." + self.getName(), function (e) {
hide(e);
});
self.popupView.element.off("mouseenter." + self.getName());
});
self.popupView.element.off("mouseenter." + self.getName());
});
BI.defer(function () {
if (!enterPopup) {
hide(e);
}
}, 50);
}
});
break;
case "click-blur":
BI.defer(function () {
if (!enterPopup) {
hide(e);
}
}, 50);
}
});
break;
}
var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
@ -295,7 +299,7 @@
scrolly: false,
element: this.options.container || this,
items: [
{el: this.popupView}
{ el: this.popupView }
]
});
this._rendered = true;

23
src/base/combination/searcher.js

@ -101,18 +101,17 @@ BI.Searcher = BI.inherit(BI.Widget, {
if (type === BI.Events.CLICK) {
if (o.isAutoSync) {
var values = o.adapter && o.adapter.getValue();
if (!obj.isSelected()) {
o.adapter && o.adapter.setValue(BI.deepWithout(values, obj.getValue()));
} else {
switch (o.chooseType) {
case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:
o.adapter && o.adapter.setValue([obj.getValue()]);
break;
case BI.ButtonGroup.CHOOSE_TYPE_MULTI:
values.push(obj.getValue());
o.adapter && o.adapter.setValue(values);
break;
}
switch (o.chooseType) {
case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:
o.adapter && o.adapter.setValue([obj.getValue()]);
break;
case BI.ButtonGroup.CHOOSE_TYPE_MULTI:
if (!obj.isSelected()) {
o.adapter && o.adapter.setValue(BI.deepWithout(values, obj.getValue()));
}
values.push(obj.getValue());
o.adapter && o.adapter.setValue(values);
break;
}
}
self.fireEvent(BI.Searcher.EVENT_CHANGE, value, obj);

22
src/base/layer/layer.popover.js

@ -99,8 +99,8 @@ BI.Popover = BI.inherit(BI.Widget, {
self.body = this;
},
css: {
"max-height": c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP,
"min-height": size.height,
"max-height": this._getSuitableBodyHeight(c.MAX_HEIGHT - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP),
"min-height": this._getSuitableBodyHeight(size.height),
},
items: [{
el: o.body,
@ -140,13 +140,13 @@ BI.Popover = BI.inherit(BI.Widget, {
return BI.extend({
type: o.logic.dynamic ? "bi.vertical" : "bi.vtape",
items: items,
width: size.width,
width: this._getSuitableWidth(size.width),
}, o.logic.dynamic ? {
type: "bi.vertical",
scrolly: false,
} : {
type: "bi.vtape",
height: size.height,
height: this._getSuitableHeight(size.height),
});
},
@ -160,6 +160,20 @@ BI.Popover = BI.inherit(BI.Widget, {
});
},
_getSuitableBodyHeight: function (height) {
var o = this.options;
var c = this._constant;
return BI.clamp(height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight - o.headerHeight - (o.footer ? o.footerHeight : 0) - c.BODY_TGAP);
},
_getSuitableHeight: function (height) {
return BI.clamp(height, 0, BI.Widget._renderEngine.createElement("body")[0].clientHeight);
},
_getSuitableWidth: function (width) {
return BI.clamp(width, 0, BI.Widget._renderEngine.createElement("body").width());
},
_calculateSize: function () {
var o = this.options;
var size = {};

3
src/base/pager/pager.js

@ -178,7 +178,8 @@ BI.Pager = BI.inherit(BI.Widget, {
items: BI.createItems(view, {
cls: "bi-list-item-select bi-border-radius",
height: 23,
hgap: 10
hgap: 10,
stopPropagation: true
}),
behaviors: o.behaviors,
layouts: o.layouts

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

@ -298,8 +298,8 @@ BI.BasicButton = BI.inherit(BI.Single, {
this.setSelected(!this.isSelected()));
}
if (this.isValid()) {
o.handler.call(this, this.getValue(), this, e);
var v = this.getValue();
o.handler.call(this, v, this, e);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, v, this, e);
this.fireEvent(BI.BasicButton.EVENT_CHANGE, v, this);
if (o.action) {
@ -411,4 +411,4 @@ BI.BasicButton = BI.inherit(BI.Single, {
BI.BasicButton.superclass.destroy.apply(this, arguments);
}
});
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";

40
src/base/single/editor/editor.textarea.js

@ -8,7 +8,11 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), {
baseCls: "bi-textarea-editor",
value: ""
value: "",
errorText: "",
validationChecker: function () {
return true;
},
});
},
@ -38,15 +42,15 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
});
this.content.element.on("input propertychange", function (e) {
self._checkError();
self._checkWaterMark();
self.fireEvent(BI.TextAreaEditor.EVENT_CHANGE);
});
this.content.element.focus(function () {
if (self.isValid()) {
self._focus();
self.fireEvent(BI.TextAreaEditor.EVENT_FOCUS);
}
self._checkError();
self._focus();
self.fireEvent(BI.TextAreaEditor.EVENT_FOCUS);
BI.Widget._renderEngine.createElement(document).bind("mousedown." + self.getName(), function (e) {
if (BI.DOM.isExist(self) && !self.element.__isMouseInBounds__(e)) {
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName());
@ -55,10 +59,9 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
});
});
this.content.element.blur(function () {
if (self.isValid()) {
self._blur();
self.fireEvent(BI.TextAreaEditor.EVENT_BLUR);
}
self._setErrorVisible(false);
self._blur();
self.fireEvent(BI.TextAreaEditor.EVENT_BLUR);
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + self.getName());
});
if (BI.isKey(o.value)) {
@ -112,6 +115,10 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}
},
_checkError: function () {
this._setErrorVisible(this.isEnabled() && !this.options.validationChecker(this.getValue()));
},
_focus: function () {
this.content.element.addClass("textarea-editor-focus");
this._checkWaterMark();
@ -122,6 +129,20 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
this._checkWaterMark();
},
_setErrorVisible: function (b) {
var o = this.options;
var errorText = o.errorText;
if (BI.isFunction(errorText)) {
errorText = errorText(BI.trim(this.getValue()));
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, {
adjustYOffset: 2
});
return BI.Bubbles.get(this.getName());
}
},
focus: function () {
this._focus();
this.content.element.focus();
@ -138,6 +159,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
setValue: function (value) {
this.content.element.val(value);
this._checkError();
this._checkWaterMark();
},

4
src/case/button/icon/icon.trigger.js

@ -10,10 +10,10 @@ BI.TriggerIconButton = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
var conf = BI.TriggerIconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-trigger-icon-button",
baseCls: (conf.baseCls || "") + " bi-trigger-icon-button overflow-hidden",
extraCls: "pull-down-font"
});
}
});
BI.TriggerIconButton.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;
BI.shortcut("bi.trigger_icon_button", BI.TriggerIconButton);
BI.shortcut("bi.trigger_icon_button", BI.TriggerIconButton);

2
src/case/button/node/node.first.plus.js

@ -79,4 +79,4 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode);
BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode);

74
src/case/button/treeitem/item.root.treeleaf.js

@ -0,0 +1,74 @@
BI.RootTreeLeafItem = BI.inherit(BI.BasicButton, {
props: {
baseCls: "bi-root-tree-leaf-item bi-list-item-active",
logic: {
dynamic: false
},
id: "",
pId: "",
layer: 0,
height: 24
},
render: function () {
var self = this;
var o = this.options;
var text = {
type: "bi.label",
ref: function (_ref) {
self.text = _ref;
},
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword
};
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 24,
el: {
type: "bi.layout",
width: 24,
height: o.height
}
}, {
el: text
});
return BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items
}));
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
},
getId: function () {
return this.options.id;
},
getPId: function () {
return this.options.pId;
}
});
BI.shortcut("bi.root_tree_leaf_item", BI.RootTreeLeafItem);

12
src/case/colorchooser/colorchooser.custom.js

@ -10,8 +10,8 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CustomColorChooser.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-custom-color-chooser",
width: 227,
height: 245
width: 292,
height: 265
});
},
@ -19,7 +19,7 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
BI.CustomColorChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.editor, {
type: "bi.simple_color_picker_editor"
type: "bi.simple_hex_color_picker_editor"
});
this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () {
self.setValue(this.getValue());
@ -42,13 +42,13 @@ BI.CustomColorChooser = BI.inherit(BI.Widget, {
top: 0,
right: 0
}],
height: 30
height: 50
}, {
type: "bi.absolute",
items: [{
el: this.farbtastic,
left: 15,
right: 15,
left: 46,
right: 46,
top: 7
}],
height: 215

4
src/case/colorchooser/colorchooser.js

@ -38,7 +38,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, o.el),
popup: {
el: BI.extend({
type: "bi.color_chooser_popup",
type: "bi.hex_color_chooser_popup",
ref: function (_ref) {
self.colorPicker = _ref;
},
@ -59,7 +59,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}]
}, o.popup),
value: o.value,
width: 230
width: 292
},
value: o.value
});

248
src/case/colorchooser/colorchooser.popup.hex.js

@ -0,0 +1,248 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/11/10
*/
BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-color-chooser-popup",
width: 292,
height: 195,
simple: false // 简单模式, popup中没有自动和透明
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.vtape",
items: [{
el: BI.extend({
type: o.simple ? "bi.simple_hex_color_picker_editor" : "bi.hex_color_picker_editor",
value: o.value,
height: 30,
listeners: [{
eventName: BI.ColorPickerEditor.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self._dealStoreColors();
self.fireEvent(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
}
}],
ref: function (_ref) {
self.colorEditor = _ref;
}
}, o.editor),
height: 50
}, {
el: {
type: "bi.absolute",
items: [{
el: {
type: "bi.color_picker",
cls: "bi-border-bottom bi-border-right",
items: [this._digestStoreColors(this._getStoreColors())],
height: 34,
value: o.value,
listeners: [{
eventName: BI.ColorPicker.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue()[0]);
self._dealStoreColors();
self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
}
}],
ref: function (_ref) {
self.storeColors = _ref;
}
},
left: 10,
right: 10,
top: 5
}]
},
height: 38
}, {
el: {
type: "bi.absolute",
items: [{
el: {
type: "bi.color_picker",
value: o.value,
listeners: [{
eventName: BI.ColorPicker.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue()[0]);
self._dealStoreColors();
self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
}
}],
ref: function (_ref) {
self.colorPicker = _ref;
}
},
left: 10,
right: 10,
top: 5,
bottom: 10
}]
}
}, {
el: {
type: "bi.combo",
cls: "bi-border-top",
container: null,
direction: "right,top",
isNeedAdjustHeight: false,
el: {
type: "bi.text_item",
cls: "color-chooser-popup-more bi-list-item",
textAlign: "center",
height: 24,
textLgap: 10,
text: BI.i18nText("BI-Basic_More") + "..."
},
popup: {
type: "bi.popup_panel",
buttons: [BI.i18nText("BI-Basic_Cancel"), BI.i18nText("BI-Basic_Save")],
title: BI.i18nText("BI-Custom_Color"),
el: {
type: "bi.custom_color_chooser",
editor: o.editor,
ref: function (_ref) {
self.customColorChooser = _ref;
}
},
stopPropagation: false,
bgap: -1,
rgap: 1,
lgap: 1,
minWidth: 227,
listeners: [{
eventName: BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON,
action: function (index) {
switch (index) {
case 0:
self.more.hideView();
break;
case 1:
self.setValue(self.customColorChooser.getValue());
self._dealStoreColors();
self.more.hideView();
self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments);
break;
}
}
}]
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_POPUPVIEW,
action: function () {
self.customColorChooser.setValue(self.getValue());
}
}],
ref: function (_ref) {
self.more = _ref;
}
},
height: 24
}]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout",
cls: "disable-mask",
invisible: !o.disabled,
ref: function () {
self.mask = this;
}
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
mounted: function () {
var self = this;
var o = this.options;
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
_setEnable: function (enable) {
BI.ColorChooserPopup.superclass._setEnable.apply(this, arguments);
this.mask.setVisible(!enable);
},
_dealStoreColors: function () {
var color = this.getValue();
var colors = this._getStoreColors();
var que = new BI.Queue(8);
que.fromArray(colors);
que.remove(color);
que.unshift(color);
var array = que.toArray();
BI.Cache.setItem("colors", BI.array2String(array));
this.setStoreColors(array);
},
_digestStoreColors: function (colors) {
var items = BI.map(colors, function (i, color) {
return {
value: color
};
});
BI.count(colors.length, 8, function (i) {
items.push({
value: "",
disabled: true
});
});
return items;
},
_getStoreColors: function() {
var self = this, o = this.options;
var colorsArray = BI.string2Array(BI.Cache.getItem("colors") || "");
return BI.filter(colorsArray, function (idx, color) {
return o.simple ? self._isRGBColor(color) : true;
});
},
_isRGBColor: function (color) {
return BI.isNotEmptyString(color) && color !== "transparent";
},
setStoreColors: function (colors) {
if (BI.isArray(colors)) {
this.storeColors.populate([this._digestStoreColors(colors)]);
// BI-66973 选中颜色的同时选中历史
this.storeColors.setValue(this.getValue());
}
},
setValue: function (color) {
this.colorEditor.setValue(color);
this.colorPicker.setValue(color);
this.storeColors.setValue(color);
},
getValue: function () {
return this.colorEditor.getValue();
}
});
BI.HexColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.HexColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup);

49
src/case/colorchooser/colorchooser.popup.hex.simple.js

@ -0,0 +1,49 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/11/10
*/
BI.SimpleHexColorChooserPopup = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-color-chooser-popup",
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.hex_color_chooser_popup",
value: o.value,
simple: true, // 是否有自动
listeners: [{
eventName: BI.ColorChooserPopup.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.ColorChooserPopup.EVENT_VALUE_CHANGE,
action: function () {
self.fireEvent(BI.SimpleColorChooserPopup.EVENT_VALUE_CHANGE, arguments);
}
}],
ref: function (_ref) {
self.popup = _ref;
}
}
},
setStoreColors: function (colors) {
this.popup.setStoreColors(colors);
},
setValue: function (color) {
this.popup.setValue(color);
},
getValue: function () {
return this.popup.getValue();
}
});
BI.SimpleHexColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.SimpleHexColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_hex_color_chooser_popup", BI.SimpleHexColorChooserPopup);

2
src/case/colorchooser/colorchooser.popup.simple.js

@ -17,7 +17,7 @@ BI.SimpleColorChooserPopup = BI.inherit(BI.Widget, {
BI.SimpleColorChooserPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.color_chooser_popup",
type: o.hex ? "bi.hex_color_chooser_popup" : "bi.color_chooser_popup",
value: o.value,
element: this,
simple: true // 是否有自动

2
src/case/colorchooser/colorchooser.simple.js

@ -26,7 +26,7 @@ BI.SimpleColorChooser = BI.inherit(BI.Widget, {
width: o.width,
height: o.height,
popup: {
type: "bi.simple_color_chooser_popup"
type: "bi.simple_hex_color_chooser_popup"
}
});
this.combo.on(BI.ColorChooser.EVENT_CHANGE, function () {

308
src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -0,0 +1,308 @@
/**
* 简单选色控件
*
* Created by GUY on 2015/11/16.
* @class BI.ColorPickerEditor
* @extends BI.Widget
*/
BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
constants: {
RGB_WIDTH: 32,
HEX_WIDTH: 70,
HEX_PREFIX_POSITION: 1
},
props: {
baseCls: "bi-color-picker-editor",
// width: 200,
height: 50
},
render: function () {
var self = this, o = this.options, c = this.constants;
this.storeValue = {};
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
});
var checker = function (v) {
return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255;
};
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 20,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}]
};
});
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.vertical",
tgap: 5,
items: [{
type: "bi.vertical_adapt",
rgap: 5,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 16,
width: 16,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 16
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 20,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.setValue("#" + this.getValue());
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}]
}, {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
width: c.RGB_WIDTH
}, {
el: {
type: "bi.icon_button",
cls: "trans-color-icon",
width: 16,
height: 16,
iconWidth: 16,
iconHeight: 16,
title: BI.i18nText("BI-Transparent_Color"),
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
if (this.isSelected()) {
self.lastColor = self.getValue();
self.setValue("transparent");
} else {
if (self.lastColor === "transparent") {
self.lastColor = "";
}
self.setValue(self.lastColor || "#ffffff");
}
if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) ||
self._isEmptyRGB()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}],
ref: function (_ref) {
self.transparent = _ref;
}
},
width: 16,
lgap: 5
}, {
el: {
type: "bi.icon_button",
cls: "auto-color-icon",
width: 16,
height: 16,
iconWidth: 16,
iconHeight: 16,
title: BI.i18nText("BI-Basic_Auto"),
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
if (this.isSelected()) {
self.lastColor = self.getValue();
self.setValue("");
} else {
self.setValue(self.lastColor || "#ffffff");
}
if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}],
ref: function (_ref) {
self.none = _ref;
}
},
width: 16,
lgap: 5
}]
}, {
type: "bi.vertical_adapt",
items: [{
el: {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20,
text: "HEX"
},
lgap: 60
},{
el: RGB[0].el,
lgap: 44
}, {
el: RGB[1].el,
lgap: 28
}, {
el: RGB[2].el,
lgap: 28
}]
}]
},
left: 10,
right: 10,
top: 0,
bottom: 0
}]
};
},
_hexChecker: function (v) {
return /^[0-9a-fA-F]{6}$/.test(v);
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
r: this.R.getValue() || 0,
g: this.G.getValue() || 0,
b: this.B.getValue() || 0
};
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION));
},
_isEmptyRGB: function () {
return BI.isEmptyString(this.storeValue.r) && BI.isEmptyString(this.storeValue.g) && BI.isEmptyString(this.storeValue.b);
},
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-normal-background");
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background");
}
},
_setEnable: function (enable) {
BI.ColorPickerEditor.superclass._setEnable.apply(this, arguments);
if (enable === true) {
this.element.removeClass("base-disabled disabled");
} else if (enable === false) {
this.element.addClass("base-disabled disabled");
}
},
setValue: function (color) {
if (color === "transparent") {
this.transparent.setSelected(true);
this.none.setSelected(false);
this._showPreColor("transparent");
this.R.setValue("");
this.G.setValue("");
this.B.setValue("");
this.hexEditor.setValue("");
this.storeValue = {
r: "",
g: "",
b: ""
};
return;
}
if (!color) {
color = "";
this.none.setSelected(true);
} else {
this.none.setSelected(false);
}
this.transparent.setSelected(false);
this._showPreColor(color);
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.g) ? "" : json.g,
b: BI.isNull(json.b) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);
this.B.setValue(this.storeValue.b);
this.hexEditor.setValue(color.slice(this.constants.HEX_PREFIX_POSITION));
},
getValue: function () {
if (this._isEmptyRGB() && this.transparent.isSelected()) {
return "transparent";
}
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.storeValue.r,
g: this.storeValue.g,
b: this.storeValue.b
}));
}
});
BI.HexColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.hex_color_picker_editor", BI.HexColorPickerEditor);

178
src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js

@ -0,0 +1,178 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/11/10
*/
BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
constants: {
RGB_WIDTH: 40,
HEX_WIDTH: 70,
HEX_PREFIX_POSITION: 1
},
props: {
baseCls: "bi-color-picker-editor",
// width: 200,
height: 50
},
render: function () {
var self = this, o = this.options, c = this.constants;
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
});
var checker = function (v) {
return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255;
};
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 20,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
}
}]
}
});
return {
type: "bi.vertical",
tgap: 5,
items: [{
type: "bi.vertical_adapt",
rgap: 10,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 16,
width: 16,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 16,
lgap: 10,
rgap: 5
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 20,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.setValue("#" + this.getValue());
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}]
}, {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
width: c.RGB_WIDTH
}]
}, {
type: "bi.vertical_adapt",
items: [{
el: {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20,
text: "HEX"
},
lgap: 86
},{
el: RGB[0].el,
lgap: 50
}, {
el: RGB[1].el,
lgap: 40
}, {
el: RGB[2].el,
lgap: 40
}]
}]
}
},
_hexChecker: function (v) {
return /^[0-9a-fA-F]{6}$/.test(v);
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION));
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
this.B.setValue(BI.isNull(json.b) ? "" : json.b);
this.hexEditor.setValue(color.slice(this.constants.HEX_PREFIX_POSITION));
},
getValue: function () {
return BI.DOM.rgb2hex(BI.DOM.json2rgb({
r: this.R.getValue(),
g: this.G.getValue(),
b: this.B.getValue()
}));
}
});
BI.SimpleHexColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_hex_color_picker_editor", BI.SimpleHexColorPickerEditor);

14
src/case/colorchooser/colorpicker/editor.colorpicker.js

@ -8,7 +8,7 @@
BI.ColorPickerEditor = BI.inherit(BI.Widget, {
constants: {
REB_WIDTH: 32
RGB_WIDTH: 32
},
_defaultConfig: function () {
@ -46,7 +46,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.REB_WIDTH,
width: c.RGB_WIDTH,
height: 20
});
BI.each(Ws, function (i, w) {
@ -124,19 +124,19 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
width: 20
}, {
el: this.R,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}, {
el: this.transparent,
width: 16,
@ -221,8 +221,8 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.storeValue = {
r: BI.isNull(json.r) ? "" : json.r,
g: BI.isNull(json.r) ? "" : json.g,
b: BI.isNull(json.r) ? "" : json.b
g: BI.isNull(json.g) ? "" : json.g,
b: BI.isNull(json.b) ? "" : json.b
};
this.R.setValue(this.storeValue.r);
this.G.setValue(this.storeValue.g);

10
src/case/colorchooser/colorpicker/editor.colorpicker.simple.js

@ -8,7 +8,7 @@
BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
constants: {
REB_WIDTH: 32
RGB_WIDTH: 32
},
_defaultConfig: function () {
@ -45,7 +45,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.REB_WIDTH,
width: c.RGB_WIDTH,
height: 20
});
BI.each(Ws, function (i, w) {
@ -74,19 +74,19 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
width: 20
}, {
el: this.R,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.REB_WIDTH
width: c.RGB_WIDTH
}]
});
},

8
src/case/tree/tree.level.js

@ -26,7 +26,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
var extend = { layer: layer };
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
@ -38,7 +38,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.first_plus_group_node"
extend.type = "bi.first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.plus_group_node";
@ -48,7 +48,7 @@ BI.LevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
extend.type = "bi.first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
@ -133,4 +133,4 @@ BI.LevelTree = BI.inherit(BI.Widget, {
});
BI.LevelTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.level_tree", BI.LevelTree);
BI.shortcut("bi.level_tree", BI.LevelTree);

77
src/case/tree/treeexpander/tree.expander.js

@ -0,0 +1,77 @@
!(function () {
var Widget = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-tree-expander",
layer: 0, // 第几层级
isLastNode: false, // 是不是最后一个
isFirstNode: false, // 是不是第一个
selectable: false,
},
render: function () {
var self = this;
var o = this.options;
this.trigger = BI.createWidget(o.el, {
forceNotSelected: !o.selectable,
});
this.trigger.on(BI.Controller.EVENT_CHANGE, function (type) {
o.selectable && self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
return {
type: "bi.expander",
ref: function (_ref) {
self.expander = _ref;
},
trigger: o.selectable ? "" : "click",
el: this.trigger,
isDefaultInit: o.isDefaultInit,
popup: {
type: "bi.tree_expander.popup",
layer: o.layer || o.el.layer,
isLastNode: o.isLastNode || o.el.isLastNode,
isFirstNode: o.isFirstNode || o.el.isFirstNode,
el: o.popup,
},
value: o.value,
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
},
},
],
};
},
setValue: function (v) {
if (BI.contains(v, this.trigger.getValue())) {
this.trigger.setSelected(true);
this.expander.setValue([]);
} else {
this.trigger.setSelected(false);
this.expander.setValue(v);
}
},
getValue: function () {
if (this.trigger.isSelected()) {
return [this.trigger.getValue()];
}
return this.expander.getValue();
},
populate: function (items) {
this.expander.populate(items);
},
getAllLeaves: function () {
return this.expander && this.expander.getAllLeaves();
}
});
BI.shortcut("bi.tree_expander", Widget);
}());

53
src/case/tree/treeexpander/tree.expander.popup.js

@ -0,0 +1,53 @@
!(function () {
var Widget = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-tree-expander-popup",
layer: 0, // 第几层级
el: {},
isLastNode: false,
},
render: function () {
var self = this;
var o = this.options;
this.popupView = BI.createWidget(BI.extend(o.el, {
value: o.value
}), this);
this.popupView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.popupView.element.css("margin-left", -12 * o.layer);
this.element.css("margin-left", 12 * o.layer);
return {
type: "bi.vertical",
cls: !o.isLastNode ? "line" : "",
scrolly: null,
items: [
this.popupView,
],
};
},
setValue: function (v) {
this.popupView.setValue(v);
},
getValue: function () {
return this.popupview.getValue();
},
populate: function (items) {
this.popupview.populate(items);
},
getAllLeaves: function () {
return this.popupView && this.popupView.getAllLeaves();
}
});
BI.shortcut("bi.tree_expander.popup", Widget);
}());

10
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -565,19 +565,15 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
parentCheckState.half = find.halfCheck;
}
var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
var isParent = node.getChildrenLength() > 0;
result.push({
id: node.id,
pId: node.pId,
value: node.value,
text: node.text,
times: 1,
isParent: isParent,
// 同步树的情况下,父亲节点的状态由子控制,不再设置checked和halfCheck属性
// 叶子节点本身不存在halfCheck属性且checked属性由计算得到
checked: isParent ? undefined : state[0],
// halfCheck: state[1],
isParent: node.getChildrenLength() > 0,
checked: state[0],
halfCheck: state[1],
open: self.options.open
});
});

47
src/core/worker.js

@ -0,0 +1,47 @@
!(function () {
BI.initWorker = function () {
function createWatcher (model, keyOrFn, cb, options) {
options = options || {};
return Fix.watch(model, keyOrFn, cb, BI.extend(options, {
store: model
}));
}
var models = {}, watches = {};
addEventListener("message", function (e) {
var data = e.data;
switch (data.eventType) {
case "action":
models[data.name][data.action].apply(models[data.name], data.args);
break;
case "destroy":
BI.each(watches[data.name], function (i, unwatches) {
unwatches = BI.isArray(unwatches) ? unwatches : [unwatches];
BI.each(unwatches, function (j, unwatch) {
unwatch();
});
});
delete models[data.name];
delete watches[data.name];
break;
case "create":
var store = models[data.name] = BI.Models.getModel(data.type, data.options);
watches[data.name] = [];
BI.each(data.watches, function (i, key) {
watches[data.name].push(createWatcher(store.model, key, function (newValue, oldValue) {
postMessage(BI.extend({}, data, {
eventType: "watch",
currentWatchType: key
}, {args: [newValue, oldValue]}));
}));
});
postMessage(BI.extend({}, data, {
eventType: "create"
}, {msg: store.model}));
break;
default:
break;
}
}, false);
};
}());

31
src/core/wrapper/layout.js

@ -83,7 +83,7 @@ BI.Layout = BI.inherit(BI.Widget, {
},
_getChildName: function (index) {
return index + "";
return this.getName() + "_" + index;
},
_addElement: function (i, item, context) {
@ -94,7 +94,7 @@ BI.Layout = BI.inherit(BI.Widget, {
BI.each(self._children, function (name, child) {
if (child === w) {
BI.remove(self._children, child);
self.removeItemAt(name | 0);
self.removeItemAt(name.replace(self.getName() + "_", "") | 0);
}
});
});
@ -316,14 +316,13 @@ BI.Layout = BI.inherit(BI.Widget, {
},
prependItems: function (items, context) {
var self = this;
items = items || [];
var fragment = BI.Widget._renderEngine.createFragment();
var added = [];
for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]);
var w = this._addElement(0, items[i], context);
self._children[self._getChildName(0)] = w;
this._children[this._getChildName(0)] = w;
this.options.items.unshift(items[i]);
added.push(w);
fragment.appendChild(w.element[0]);
@ -400,23 +399,23 @@ BI.Layout = BI.inherit(BI.Widget, {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode, oldStartIdx, newStartIdx)) {
updated = this.patchItem(oldStartVnode, newStartVnode, oldStartIdx) || updated;
children[oldStartVnode.key == null ? this._getChildName(oldStartIdx) : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
children[oldStartVnode.key == null ? oldStartIdx : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode, oldEndIdx, newEndIdx)) {
updated = this.patchItem(oldEndVnode, newEndVnode, oldEndIdx) || updated;
children[oldEndVnode.key == null ? this._getChildName(oldEndIdx) : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
children[oldEndVnode.key == null ? oldEndIdx : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) {
updated = this.patchItem(oldStartVnode, newEndVnode, oldStartIdx) || updated;
children[oldStartVnode.key == null ? this._getChildName(oldStartIdx) : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
children[oldStartVnode.key == null ? oldStartIdx : oldStartVnode.key] = this._children[this._getChildName(oldStartIdx)];
insertBefore(oldStartVnode, oldEndVnode, true);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) {
updated = this.patchItem(oldEndVnode, newStartVnode, oldEndIdx) || updated;
children[oldEndVnode.key == null ? this._getChildName(oldEndIdx) : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
children[oldEndVnode.key == null ? oldEndIdx : oldEndVnode.key] = this._children[this._getChildName(oldEndIdx)];
insertBefore(oldEndVnode, oldStartVnode);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
@ -430,7 +429,7 @@ BI.Layout = BI.inherit(BI.Widget, {
BI.each(oldCh, function (index, child) {
if (child && sameVnode(child, newStartVnode)) {
updated = self.patchItem(sameOldVnode, newStartVnode, index) || updated;
children[sameOldVnode.key == null ? self._getChildName(index) : sameOldVnode.key] = self._children[self._getChildName(index)];
children[sameOldVnode.key == null ? index : sameOldVnode.key] = self._children[self._getChildName(index)];
oldCh[index] = undefined;
insertBefore(sameOldVnode, oldStartVnode);
}
@ -449,7 +448,7 @@ BI.Layout = BI.inherit(BI.Widget, {
this._children = {};
BI.each(newCh, function (i, child) {
var node = self._getOptions(child);
var key = node.key == null ? self._getChildName(i) : node.key;
var key = node.key == null ? i : node.key;
children[key]._mount();
self._children[self._getChildName(i)] = children[key];
});
@ -467,7 +466,7 @@ BI.Layout = BI.inherit(BI.Widget, {
function addNode (vnode, index) {
var opt = self._getOptions(vnode);
var key = opt.key == null ? self._getChildName(index) : opt.key;
var key = opt.key == null ? index : opt.key;
return children[key] = self._addElement(key, vnode);
}
@ -483,7 +482,7 @@ BI.Layout = BI.inherit(BI.Widget, {
var ch = vnodes[startIdx];
if (BI.isNotNull(ch)) {
var node = self._getOptions(ch);
var key = node.key == null ? self._getChildName(startIdx) : node.key;
var key = node.key == null ? startIdx : node.key;
delete self._children[self._getChildName(key)];
children[key]._destroy();
}
@ -493,9 +492,9 @@ BI.Layout = BI.inherit(BI.Widget, {
function insertBefore (insert, before, isNext, index) {
insert = self._getOptions(insert);
before = before && self._getOptions(before);
var insertKey = BI.isKey(insert.key) ? insert.key : self._getChildName(index);
var insertKey = BI.isKey(insert.key) ? insert.key : index;
if (before && children[before.key]) {
var beforeKey = BI.isKey(before.key) ? before.key : self._getChildName(index);
var beforeKey = BI.isKey(before.key) ? before.key : index;
var next;
if (isNext) {
next = children[beforeKey].element.next();
@ -565,11 +564,11 @@ BI.Layout = BI.inherit(BI.Widget, {
},
removeWidget: function (nameOrWidget) {
var removeIndex;
var removeIndex, self = this;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeIndex = name;
removeIndex = name.replace(self.getName() + "_", "");
}
});
} else {

30
src/core/wrapper/layout/layout.border.js

@ -35,11 +35,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["north"];
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "north")) {
if (!this.hasWidget(this._getChildName("north"))) {
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "north", w);
this.addWidget(this._getChildName("north"), w);
}
this.getWidgetByName(this.getName() + "north").element.height(item.height)
this.getWidgetByName(this._getChildName("north")).element.height(item.height)
.css({
position: "absolute",
top: (item.top || 0),
@ -55,11 +55,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["south"];
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "south")) {
if (!this.hasWidget(this._getChildName("south"))) {
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "south", w);
this.addWidget(this._getChildName("south"), w);
}
this.getWidgetByName(this.getName() + "south").element.height(item.height)
this.getWidgetByName(this._getChildName("south")).element.height(item.height)
.css({
position: "absolute",
bottom: (item.bottom || 0),
@ -75,11 +75,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["west"];
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "west")) {
if (!this.hasWidget(this._getChildName("west"))) {
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "west", w);
this.addWidget(this._getChildName("west"), w);
}
this.getWidgetByName(this.getName() + "west").element.width(item.width)
this.getWidgetByName(this._getChildName("west")).element.width(item.width)
.css({
position: "absolute",
left: (item.left || 0),
@ -95,11 +95,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["east"];
if (item != null) {
if (item.el) {
if (!this.hasWidget(this.getName() + "east")) {
if (!this.hasWidget(this._getChildName("east"))) {
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "east", w);
this.addWidget(this._getChildName("east"), w);
}
this.getWidgetByName(this.getName() + "east").element.width(item.width)
this.getWidgetByName(this._getChildName("east")).element.width(item.width)
.css({
position: "absolute",
right: (item.right || 0),
@ -114,11 +114,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if ("center" in regions) {
item = regions["center"];
if (item != null) {
if (!this.hasWidget(this.getName() + "center")) {
if (!this.hasWidget(this._getChildName("center"))) {
var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "center", w);
this.addWidget(this._getChildName("center"), w);
}
this.getWidgetByName(this.getName() + "center").element
this.getWidgetByName(this._getChildName("center")).element
.css({position: "absolute", top: top, bottom: bottom, left: left, right: right});
}
}

27
src/core/wrapper/layout/layout.card.js

@ -13,6 +13,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
items: []
});
},
render: function () {
BI.CardLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
@ -37,9 +38,9 @@ BI.CardLayout = BI.inherit(BI.Layout, {
o.items.splice(index, 1);
}
});
self.addWidget(item.cardName, w);
self.addWidget(self._getChildName(item.cardName), w);
} else {
var w = self.getWidgetByName(item.cardName);
var w = self.getWidgetByName(self._getChildName(item.cardName));
}
w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"});
w.setVisible(false);
@ -71,11 +72,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist");
}
return this._children[cardName];
return this._children[this._getChildName(cardName)];
},
_deleteCardByName: function (cardName) {
delete this._children[cardName];
delete this._children[this._getChildName(cardName)];
var index = BI.findIndex(this.options.items, function (i, item) {
return item.cardName == cardName;
});
@ -89,7 +90,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
throw new Error("cardName is not exist");
}
var child = this._children[cardName];
var child = this._children[this._getChildName(cardName)];
this._deleteCardByName(cardName);
child && child._destroy();
},
@ -107,7 +108,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
height: "100%"
}).appendTo(this.element);
widget.invisible();
this.addWidget(cardName, widget);
this.addWidget(this._getChildName(cardName), widget);
this.options.items.push({el: cardItem, cardName: cardName});
return widget;
},
@ -122,7 +123,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.showIndex = name;
var flag = false;
BI.each(this.options.items, function (i, item) {
var el = self._children[item.cardName];
var el = self._children[self._getChildName(item.cardName)];
if (el) {
if (name != item.cardName) {
// 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
@ -138,7 +139,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this;
this.showIndex = this.lastShowIndex;
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i);
self._children[self._getChildName(item.cardName)].setVisible(self.showIndex == i);
});
},
@ -161,7 +162,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!BI.isKey(this.showIndex)) {
return void 0;
}
return this.getWidgetByName(this.showIndex);
return this.getWidgetByName(this._getChildName(this.showIndex));
},
deleteAllCard: function () {
@ -174,7 +175,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
hideAllCard: function () {
var self = this;
BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible();
self._children[self._getChildName(item.cardName)].invisible();
});
},
@ -182,7 +183,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this;
var flag = true;
BI.some(this.options.items, function (i, item) {
if (self._children[item.cardName].isVisible()) {
if (self._children[self._getChildName(item.cardName)].isVisible()) {
flag = false;
return false;
}
@ -191,11 +192,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
},
removeWidget: function (nameOrWidget) {
var removeName;
var removeName, self = this;
if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) {
if (child === nameOrWidget) {
removeName = name;
removeName = name.replace(self.getName() + "_", "");
}
});
} else {

12
src/core/wrapper/layout/layout.division.js

@ -114,16 +114,16 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
if (!map[i][j]) {
throw new Error("item be required");
}
if (!this.hasWidget(this.getName() + i + "_" + j)) {
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(map[i][j]);
this.addWidget(this.getName() + i + "_" + j, w);
this.addWidget(this._getChildName(i + "_" + j), w);
} else {
w = this.getWidgetByName(this.getName() + i + "_" + j);
w = this.getWidgetByName(this._getChildName(i + "_" + j));
}
var left = totalW * 100 / widths[i];
w.element.css({position: "absolute", left: left + "%"});
if (j > 0) {
var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1));
var lastW = this.getWidgetByName(this._getChildName(i + "_" + (j - 1)));
lastW.element.css({right: (100 - left) + "%"});
}
if (j == o.columns - 1) {
@ -136,11 +136,11 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
for (var j = 0; j < o.columns; j++) {
var totalH = 0;
for (var i = 0; i < o.rows; i++) {
var w = this.getWidgetByName(this.getName() + i + "_" + j);
var w = this.getWidgetByName(this._getChildName(i + "_" + j));
var top = totalH * 100 / heights[j];
w.element.css({top: top + "%"});
if (i > 0) {
var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j);
var lastW = this.getWidgetByName(this._getChildName((i - 1) + "_" + j));
lastW.element.css({bottom: (100 - top) + "%"});
}
if (i == o.rows - 1) {

2
src/core/wrapper/layout/layout.grid.js

@ -114,7 +114,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
right: (100 - (width * (j + 1))) + "%",
bottom: (100 - (height * (i + 1))) + "%"
});
this.addWidget(els[i][j]);
this.addWidget(this._getChildName(i + "_" + j), els[i][j]);
}
}
},

4
src/core/wrapper/layout/layout.table.js

@ -116,14 +116,14 @@ BI.TableLayout = BI.inherit(BI.Layout, {
items: abs
});
if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
this.getWidgetByName(this._getChildName(this.rows - 1)).element.css({
"margin-bottom": o.vgap
});
}
w.element.css({
position: "relative"
});
this.addWidget(this.getName() + (this.rows++), w);
this.addWidget(this._getChildName(this.rows++), w);
return w;
},

20
src/core/wrapper/layout/layout.tape.js

@ -46,11 +46,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options;
items = BI.compact(items);
BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) {
if (!self.hasWidget(self._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w);
self.addWidget(self._getChildName(i), w);
} else {
w = self.getWidgetByName(self.getName() + i + "");
w = self.getWidgetByName(self._getChildName(i));
}
w.element.css({position: "absolute", top: (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap + "px", bottom: (item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap + "px"});
});
@ -60,7 +60,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
right[items.length - 1] = 0;
BI.any(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + "");
var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(left[i])) {
left[i] = left[i - 1] + items[i - 1].width + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
}
@ -77,7 +77,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
}
});
BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + "");
var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(right[i])) {
right[i] = right[i + 1] + items[i + 1].width + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
}
@ -159,11 +159,11 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options;
items = BI.compact(items);
BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) {
if (!self.hasWidget(self._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w);
self.addWidget(self._getChildName(i), w);
} else {
w = self.getWidgetByName(self.getName() + i + "");
w = self.getWidgetByName(self._getChildName(i));
}
w.element.css({position: "absolute", left: (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap + "px", right: + (item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap + "px"});
});
@ -173,7 +173,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom[items.length - 1] = 0;
BI.any(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + "");
var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(top[i])) {
top[i] = top[i - 1] + items[i - 1].height + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
}
@ -190,7 +190,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
}
});
BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + "");
var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + items[i + 1].height + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
}

2
src/core/wrapper/layout/layout.td.js

@ -115,7 +115,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
});
tr.addItem(td);
}
this.addWidget(this.getName() + idx, tr);
this.addWidget(this._getChildName(idx), tr);
return tr;
},

13
src/core/wrapper/layout/layout.window.js

@ -52,6 +52,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNumber(o.columnSize)) {
o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length);
}
function firstElement (item, row, col) {
if (row === 0) {
item.addClass("first-row");
@ -94,10 +95,10 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (!o.items[i][j]) {
throw new Error("item be required");
}
if (!this.hasWidget(this.getName() + i + "_" + j)) {
if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(o.items[i][j]);
w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w);
this.addWidget(this._getChildName(i + "_" + j), w);
}
}
}
@ -109,7 +110,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从上到下
for (var i = 0; i < o.rows; i++) {
for (var j = 0; j < o.columns; j++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j);
var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(top[i])) {
top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap);
}
@ -127,7 +128,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从下到上
for (var i = o.rows - 1; i >= 0; i--) {
for (var j = 0; j < o.columns; j++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j);
var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap);
}
@ -145,7 +146,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从左到右
for (var j = 0; j < o.columns; j++) {
for (var i = 0; i < o.rows; i++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j);
var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(left[j])) {
left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap);
}
@ -163,7 +164,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从右到左
for (var j = o.columns - 1; j >= 0; j--) {
for (var i = 0; i < o.rows; i++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j);
var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(right[j])) {
right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap);
}

8
src/less/base/single/editor/editor.multifile.less

@ -9,4 +9,12 @@
// BI-52961 IE11出现光标的兼容: 通过布局的overflow: hidden创建BFC, 此时设置负margin隐藏光标不会影响其他元素
margin-left: -5px;
}
// 解决chrome下input type:file cursor设置为pointer无效的问题
// https://stackoverflow.com/questions/1537223/change-cursor-type-on-input-type-file
input[type=file], /* FF, IE7+, chrome (except button) */
input[type=file]::-webkit-file-upload-button {
/* chromes and blink button */
cursor: pointer;
}
}

9
src/less/base/tree/tree.expander.less

@ -0,0 +1,9 @@
@import "../../index";
.bi-tree-expander-popup.line:before {
position: absolute;
content: "";
border-left: 1px dashed #D0D4DA;
height: 100%;
left: 11px;
}

6
src/less/core/utils/common.less

@ -42,7 +42,11 @@ textarea {
}
.bi-focus-shadow {
&:focus-within, &:focus, &:hover {
&:focus, &:hover {
border-color: @color-bi-border-highlight;
}
// ie下不支持focus-within, 和上面写在一起会导致ie下:hover不生效
&:focus-within{
border-color: @color-bi-border-highlight;
}
&.disabled {

12
src/less/image.less

@ -360,9 +360,6 @@
.font(@class,@content, @color: @color-bi-font-native) {
@fc: "\@{content}";
.@{class} {
& .b-font {
*zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')";
}
& .b-font:before {
content: @fc;
color: @color;
@ -378,9 +375,6 @@
.font-hover(@class,@content,@color-native: @color-bi-font-native, @color-hover: @color-bi-font-hover) {
@fc: "\@{content}";
.@{class} {
& .b-font {
*zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')";
}
& .b-font:before {
content: @fc;
color: @color-native;
@ -401,9 +395,6 @@
.font-hover-active(@class,@content,@color-native: @color-bi-font-native, @color-hover: @color-bi-font-hover, @color-active: @color-bi-font-active) {
@fc: "\@{content}";
.@{class} {
& .b-font {
*zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')";
}
& .b-font:before {
content: @fc;
color: @color-native;
@ -429,9 +420,6 @@
.font-effect(@class,@content,@color-native: @color-bi-font-native, @color-hover: @color-bi-font-hover, @color-active: @color-bi-font-active, @color-selected: @color-bi-font-active) {
@fc: "\@{content}";
.@{class} {
& .b-font {
*zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')";
}
& .b-font:before {
content: @fc;
color: @color-native;

4
src/widget/date/calendar/picker.year.js

@ -87,14 +87,14 @@ BI.YearPicker = BI.inherit(BI.Widget, {
_checkLeftValid: function () {
var o = this.options;
var valid = !(this._year === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear());
var valid = this._year > BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear();
this.left.setEnable(valid);
return valid;
},
_checkRightValid: function () {
var o = this.options;
var valid = !(this._year === BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear());
var valid = this._year < BI.parseDateTime(o.max, "%Y-%X-%d").getFullYear();
this.right.setEnable(valid);
return valid;
},

2
src/widget/dynamicdate/dynamicdate.combo.js

@ -190,9 +190,9 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
listeners: [{
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: function () {
self.popup.setValue(self.storeValue);
self.popup.setMinDate(opts.minDate);
self.popup.setMaxDate(opts.maxDate);
self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicDateCombo.EVENT_BEFORE_POPUPVIEW);
}
}]

42
src/widget/multilayerselecttree/multilayerselecttree.leveltree.js

@ -32,7 +32,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, {
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
var extend = {
isFirstNode: i === 0,
isLastNode: i === nodes.length - 1
};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
@ -40,26 +43,29 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, {
node.keyword = node.keyword || keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
if (layer === 0 && extend.isFirstNode && extend.isLastNode) {
extend.type = "bi.multilayer_select_tree_plus_group_node";
} else if (layer === 0 && extend.isFirstNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
} else if (extend.isLastNode) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
} else {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1, node);
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
if (layer === 0 && extend.isFirstNode && extend.isLastNode) {
extend.type = "bi.root_tree_leaf_item";
} else if (layer === 0 && extend.isFirstNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
} else if (extend.isLastNode) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -83,7 +89,9 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, {
type: "bi.custom_tree",
cls: "tree-view display-table",
expander: {
type: "bi.select_tree_expander",
// type: "bi.select_tree_expander",
type: "bi.tree_expander",
selectable: true,
isDefaultInit: o.isDefaultInit,
el: {},
popup: {
@ -151,7 +159,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, {
setValue: function (v) {
// getValue依赖于storeValue, 那么不选的时候就不要更新storeValue了
if(this.options.chooseType === BI.Selection.None) {
if (this.options.chooseType === BI.Selection.None) {
} else {
this.storeValue = v;
this.tree.setValue(v);
@ -178,4 +186,4 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, {
});
BI.MultiLayerSelectLevelTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);
BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);

30
src/widget/multilayerselecttree/node/node.first.plus.js

@ -43,25 +43,19 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
// BI.count(0, o.layer, function (index) {
// items.push({
// type: "bi.layout",
// cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
// width: 12,
// height: o.height
// });
// });
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -102,4 +96,4 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode);
BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode);

23
src/widget/multilayerselecttree/node/node.last.plus.js

@ -43,25 +43,12 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -98,4 +85,4 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode);
BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode);

23
src/widget/multilayerselecttree/node/node.mid.plus.js

@ -43,25 +43,12 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -98,4 +85,4 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);

23
src/widget/multilayerselecttree/node/node.plus.js

@ -43,25 +43,12 @@ BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -102,4 +89,4 @@ BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);

42
src/widget/multilayersingletree/multilayersingletree.leveltree.js

@ -32,7 +32,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, {
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
var extend = {
isFirstNode: i === 0,
isLastNode: i === nodes.length - 1
};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
@ -40,27 +43,31 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, {
node.keyword = node.keyword || keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
if (layer === 0 && extend.isFirstNode && extend.isLastNode) {
extend.type = "bi.multilayer_single_tree_plus_group_node";
} else if (layer === 0 && extend.isFirstNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
} else if (extend.isLastNode) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
} else {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1, node);
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
if (layer === 0 && extend.isFirstNode && extend.isLastNode) {
extend.type = "bi.root_tree_leaf_item";
} else if (layer === 0 && extend.isFirstNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
} else if (extend.isLastNode) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
}
BI.defaults(node, extend);
}
});
@ -83,6 +90,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, {
type: "bi.custom_tree",
cls: "tree-view display-table",
expander: {
type: "bi.tree_expander",
isDefaultInit: o.isDefaultInit,
el: {},
popup: {
@ -150,7 +158,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, {
setValue: function (v) {
// getValue依赖于storeValue, 那么不选的时候就不要更新storeValue了
if(this.options.chooseType === BI.Selection.None) {
if (this.options.chooseType === BI.Selection.None) {
} else {
this.storeValue = v;
this.tree.setValue(v);
@ -159,8 +167,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, {
getValue: function () {
return BI.isArray(this.storeValue) ?
this.storeValue : BI.isNull(this.storeValue) ?
[] : [this.storeValue];
this.storeValue : BI.isNull(this.storeValue) ?
[] : [this.storeValue];
},
getAllLeaves: function () {

23
src/widget/multilayersingletree/node/node.first.plus.js

@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.node = this._createNode();
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -101,4 +88,4 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_first_plus_group_node", BI.MultiLayerSingleTreeFirstPlusGroupNode);
BI.shortcut("bi.multilayer_single_tree_first_plus_group_node", BI.MultiLayerSingleTreeFirstPlusGroupNode);

23
src/widget/multilayersingletree/node/node.last.plus.js

@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.node = this._createNode();
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -100,4 +87,4 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_last_plus_group_node", BI.MultiLayerSingleTreeLastPlusGroupNode);
BI.shortcut("bi.multilayer_single_tree_last_plus_group_node", BI.MultiLayerSingleTreeLastPlusGroupNode);

23
src/widget/multilayersingletree/node/node.mid.plus.js

@ -22,25 +22,12 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.node = this._createNode();
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.node,
lgap: o.layer * 12
});
items.push(this.node);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -100,4 +87,4 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);
BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);

24
src/widget/multilayersingletree/treeitem/item.first.treeleaf.js

@ -42,26 +42,12 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.item,
lgap: o.layer * 12
});
items.push(this.item);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -97,4 +83,4 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item", BI.MultiLayerSingleTreeFirstTreeLeafItem);
BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item", BI.MultiLayerSingleTreeFirstTreeLeafItem);

23
src/widget/multilayersingletree/treeitem/item.last.treeleaf.js

@ -42,25 +42,12 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.item,
lgap: o.layer * 12
});
items.push(this.item);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -96,4 +83,4 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item", BI.MultiLayerSingleTreeLastTreeLeafItem);
BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item", BI.MultiLayerSingleTreeLastTreeLeafItem);

23
src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js

@ -42,25 +42,12 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
items.push({
el: this.item,
lgap: o.layer * 12
});
items.push(this.item);
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
@ -96,4 +83,4 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
}
});
BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item", BI.MultiLayerSingleTreeMidTreeLeafItem);
BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item", BI.MultiLayerSingleTreeMidTreeLeafItem);

45
typescript/base/single/input/input.ts

@ -0,0 +1,45 @@
import { _Single } from "../single";
export interface _Input extends _Single {
onClick(): void;
onKeyDown(keyCode: number): void;
focus(): void;
blur(): void;
selectAll(): void;
setValue(v: string): void;
getValue(): string;
isEditing(): boolean;
getLastValidValue(): string;
getLastChangedValue(): string;
}
export interface _InputStatic {
EVENT_CHANGE: string;
EVENT_FOCUS: string;
EVENT_CLICK: string;
EVENT_BLUR: string;
EVENT_KEY_DOWN: string;
EVENT_QUICK_DOWN: string;
EVENT_SPACE: string;
EVENT_BACKSPACE: string;
EVENT_START: string;
EVENT_PAUSE: string;
EVENT_STOP: string;
EVENT_CHANGE_CONFIRM: string;
EVENT_CONFIRM: string;
EVENT_REMOVE: string;
EVENT_EMPTY: string;
EVENT_VALID: string;
EVENT_ERROR: string;
EVENT_ENTER: string;
EVENT_RESTRICT: string;
}

14
typescript/case/combo/searchtextvaluecombo/combo.searchtextvalue.ts

@ -0,0 +1,14 @@
import { _Widget } from "../../../core/widget";
export interface _SearchTextValueCombo extends _Widget {
populate(items: any[]): void;
setValue(v: any): void;
getValue<T>(): T[];
}
export interface _SearchTextValueComboStatic {
EVENT_CHANGE: string;
EVENT_BEFORE_POPUPVIEW: string;
}

8
typescript/core/base.ts

@ -263,7 +263,7 @@ export interface _base {
isDeepMatch: (object: any, attrs: any) => boolean;
contains: (obj: any[], target: any, fromIndex?: number) => number;
contains: (obj: any[], target: any, fromIndex?: number) => boolean;
deepContains: (obj: any[], copy: any) => number;
@ -287,15 +287,15 @@ export interface _base {
unescape: (str?: string) => string;
bind: (func: Function, thisArg: any, ...partials: any) => Function;
bind: <T extends Function>(func: T, thisArg: any, ...partials: any) => T;
once: (func: Function) => Function;
partial: (func: Function, ...partials: any) => Function;
debounce: (func: Function, wait?: number, options?: any) => Function;
debounce: <T extends Function>(func: T, wait?: number, options?: any) => T;
throttle: (func: Function, wait?: number, options?: any) => Function;
throttle: <T extends Function>(func: T, wait?: number, options?: any) => T;
delay: (func: Function, wait: number, ...args: any[]) => number;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save