Browse Source

Pull request #1: Release/11.0

Merge in ~JIMMY.CHAI/dec-fineui from release/11.0 to final/11.0

* commit '9d5e6f0c5a3de55e81736bac9f4d01340e21f205': (36 commits)
  BI-143459 fix: 修复请求头boundary与formData中WebKitFormBoundary不一致问题
  BI-143459 fix: 修复请求头boundary与formData中WebKitFormBoundary不一致问题
  REPORT-113703 FineOne 新前端样式统一 弹窗-FR.Msg.Alert()
  REPORT-112276 公共数据取数简道云数据连接部分适配 补充下ts类型
  REPORT-112276 公共数据取数简道云数据连接部分适配 引用lodash.uniqWith
  REPORT-112276 公共数据取数简道云数据连接部分适配 补充下ts类型
  BI-142512 fix: 年份控件切换成动态时间少了横线
  REPORT-112276 公共数据取数简道云数据连接部分适配 引用lodash.uniqWith
  BI-142512 fix: 年份控件切换成动态时间少了横线
  无jira任务 fix:补充MultiLayerDownListCombo的抛出事件
  BI-137665 fix: popover和message高度改28
  无jira任务 优化布局
  BI-141781 feat: 下拉框接收tipText
  BI-129824 fix: 多提交
  BI-129824 fix: 控件优化
  BI-129824 fix: 控件优化
  BI-137665 feat: 修改弹窗样式
  无JIRA任务 form不传label时展示内容
  update font
  BI-137665 fix: 代码优化
  ...
research/test
Jimmy.Chai-柴嘉明 9 months ago
parent
commit
d26086bafa
  1. 477
      packages/fineui/src/base/foundation/message.js
  2. 50
      packages/fineui/src/base/layer/layer.popover.js
  3. 7
      packages/fineui/src/base/single/input/file.js
  4. 2
      packages/fineui/src/case/button/item.multiselect.js
  5. 26
      packages/fineui/src/case/button/switch.js
  6. 3
      packages/fineui/src/case/colorchooser/colorchooser.js
  7. 4
      packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js
  8. 2
      packages/fineui/src/component/form/form.field.js
  9. 25
      packages/fineui/src/core/1.lodash.js
  10. 2
      packages/fineui/src/core/2.base.js
  11. 6
      packages/fineui/src/core/4.widget.js
  12. 4
      packages/fineui/src/core/platform/web/detectElementResize.js
  13. 2
      packages/fineui/src/core/wrapper/layout/layout.table.js
  14. 2
      packages/fineui/src/fix/fix.js
  15. 4
      packages/fineui/src/less/base/tree/ztree.less
  16. 2
      packages/fineui/src/less/lib/colors.less
  17. 2
      packages/fineui/src/less/lib/constant.less
  18. 5
      packages/fineui/src/less/lib/font.less
  19. 5
      packages/fineui/src/less/resource/font.less
  20. 7
      packages/fineui/src/widget/editor/editor.search.js
  21. 5
      packages/fineui/src/widget/multilayerdownlist/combo.downlist.js
  22. 5
      packages/fineui/src/widget/multiselect/multiselect.loader.js
  23. 5
      packages/fineui/src/widget/multiselect/multiselect.loader.nobar.js
  24. 6
      packages/fineui/src/widget/searchmultitextvaluecombo/multitextvalue.loader.search.js
  25. 1
      packages/fineui/src/widget/year/popup.year.js
  26. 18
      packages/fineui/typescript/base/foundation/message.ts
  27. 5
      packages/fineui/typescript/case/button/switch.ts
  28. 7
      packages/fineui/typescript/case/colorchooser/colorchooser.ts
  29. 14
      packages/fineui/typescript/core/base.ts
  30. 1
      packages/fineui/typescript/widget/multilayerdownlist/multilayerdownlist.combo.ts

477
packages/fineui/src/base/foundation/message.js

@ -17,258 +17,273 @@ import {
i18nText, i18nText,
KeyCode, KeyCode,
isPlainObject, isPlainObject,
SIZE_CONSANTS SIZE_CONSANTS,
CenterAdaptLayout,
VerticalLayout,
HTapeLayout,
RightVerticalAdaptLayout
} from "../../core"; } from "../../core";
import { Toast } from "../single"; import { Button, IconLabel, Label, Toast } from "../single";
export const Msg = (() => { let $mask, $pop;
let $mask, $pop;
const messageShows = []; const messageShows = [];
const toastStack = []; const toastStack = [];
const defaultConfig = { const AlertLevel = {
buttonHeight: 24, WARNING: 'warning',
}; INFO: 'info',
ERROR: 'error',
SUCCESS: 'success',
}
return { function getIconCls(level) {
alert(title, message, callback, config = defaultConfig) { switch (level) {
this._show(false, title, message, callback, config); case AlertLevel.ERROR:
}, return 'alert-error-font';
confirm(title, message, callback, config = defaultConfig) { case AlertLevel.SUCCESS:
this._show(true, title, message, callback, config); return 'alert-success-font';
}, case AlertLevel.INFO:
prompt(title, message, value, callback, min_width) { return 'alert-info-font';
// Msg.prompt(title, message, value, callback, min_width); case AlertLevel.WARNING:
}, default:
toast(message, options, context) { return 'alert-warning-font';
isString(options) && (options = { level: options }); }
options = options || {}; }
context = context || Widget._renderEngine.createElement("body");
const level = options.level || "common";
const autoClose = isNull(options.autoClose) ? true : options.autoClose;
const callback = isFunction(options.callback) ? options.callback : emptyFn;
const toast = createWidget({
type: "bi.toast",
cls: "bi-message-animate bi-message-leave",
level,
autoClose,
closable: options.closable,
text: message,
listeners: [
{
eventName: Toast.EVENT_DESTORY,
action() {
remove(toastStack, toast.element);
let _height = SIZE_CONSANTS.TOAST_TOP;
each(toastStack, (i, element) => {
element.css({ top: _height });
_height += element.outerHeight() + 10;
});
callback();
},
}
],
});
let height = SIZE_CONSANTS.TOAST_TOP;
each(toastStack, (i, element) => {
height += element.outerHeight() + 10;
});
createWidget({
type: "bi.absolute",
element: context,
items: [
{
el: toast,
left: "50%",
top: height,
}
],
});
toastStack.push(toast.element);
toast.element.css({ "margin-left": (-1 * toast.element.outerWidth()) / 2 });
toast.element.removeClass("bi-message-leave").addClass("bi-message-enter");
autoClose &&
delay(() => {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy?.();
}, 5000);
return function() { export const Msg = {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave"); alert(title, message, callback, config) {
toast.destroy?.(); _show(false, title, message, callback, config);
}; },
}, confirm(title, message, callback, config) {
_show(hasCancel, title, message, callback, config) { _show(true, title, message, callback, config);
isNull($mask) && },
($mask = Widget._renderEngine toast(message, options, context) {
.createElement("<div class=\"bi-z-index-mask\">") isString(options) && (options = { level: options });
.css({ options = options || {};
position: "absolute", context = context || Widget._renderEngine.createElement("body");
zIndex: zIndex_tip - 2, const level = options.level || "common";
top: 0, const autoClose = isNull(options.autoClose) ? true : options.autoClose;
left: 0, const callback = isFunction(options.callback) ? options.callback : emptyFn;
right: 0, const toast = createWidget({
bottom: 0, type: "bi.toast",
opacity: 0.5, cls: "bi-message-animate bi-message-leave",
}) level,
.appendTo("body")); autoClose,
$pop = Widget._renderEngine closable: options.closable,
.createElement("<div class=\"bi-message-depend\">") text: message,
.css({ listeners: [
position: "absolute", {
zIndex: zIndex_tip - 1, eventName: Toast.EVENT_DESTORY,
top: 0, action() {
left: 0, remove(toastStack, toast.element);
right: 0, let _height = SIZE_CONSANTS.TOAST_TOP;
bottom: 0, each(toastStack, (i, element) => {
}) element.css({ top: _height });
.appendTo("body"); _height += element.outerHeight() + 10;
});
function close() { callback();
messageShows[messageShows.length - 1].destroy(); },
messageShows.pop(); }
if (messageShows.length === 0) { ],
$mask.remove(); });
$mask = null; let height = SIZE_CONSANTS.TOAST_TOP;
each(toastStack, (i, element) => {
height += element.outerHeight() + 10;
});
createWidget({
type: "bi.absolute",
element: context,
items: [
{
el: toast,
left: "50%",
top: height,
} }
} ],
});
toastStack.push(toast.element);
toast.element.css({ "margin-left": (-1 * toast.element.outerWidth()) / 2 });
toast.element.removeClass("bi-message-leave").addClass("bi-message-enter");
autoClose &&
delay(() => {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy?.();
}, 5000);
return function() {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy?.();
};
},
};
function _show(hasCancel, title, message, callback, config = {}) {
config = {
buttonHeight: 28,
cancelText: i18nText("BI-Basic_Cancel"),
sureText: i18nText("BI-Basic_OK"),
level: AlertLevel.WARNING,
...config,
}
isNull($mask) &&
($mask = Widget._renderEngine
.createElement("<div class=\"bi-z-index-mask\">")
.css({
position: "absolute",
zIndex: zIndex_tip - 2,
top: 0,
left: 0,
right: 0,
bottom: 0,
opacity: 0.5,
})
.appendTo("body"));
$pop = Widget._renderEngine
.createElement("<div class=\"bi-message-depend\">")
.css({
position: "absolute",
zIndex: zIndex_tip - 1,
top: 0,
left: 0,
right: 0,
bottom: 0,
})
.appendTo("body");
const controlItems = []; function close() {
if (hasCancel === true) { messageShows[messageShows.length - 1].destroy();
controlItems.push({ messageShows.pop();
el: { if (messageShows.length === 0) {
type: "bi.button", $mask.remove();
height: config.buttonHeight, $mask = null;
text: i18nText("BI-Basic_Cancel"), }
light: true, }
handler() {
const controlItems = [];
if (hasCancel === true) {
controlItems.push({
el: {
type: Button.xtype,
height: config.buttonHeight,
text: config.cancelText,
light: true,
handler() {
close();
if (isFunction(callback)) {
callback.apply(null, [false]);
}
},
},
});
}
controlItems.push({
el: {
type: Button.xtype,
height: config.buttonHeight,
text: config.sureText,
handler() {
close();
if (isFunction(callback)) {
callback.apply(null, [true]);
}
},
},
});
const conf = {
element: $pop,
type: CenterAdaptLayout.xtype,
items: [
{
type: VerticalLayout.xtype,
cls: "bi-card bi-border-radius",
width: 450,
css: {
'max-height': '100%'
},
hgap: 32,
attributes: {
tabIndex: 1,
},
mounted() {
this.element.keyup(e => {
if (e.keyCode === KeyCode.ENTER) {
close(); close();
if (isFunction(callback)) { if (isFunction(callback)) {
callback.apply(null, [false]); callback.apply(null, [true]);
}
} else if (e.keyCode === KeyCode.ESCAPE) {
close();
if (hasCancel === true) {
if (isFunction(callback)) {
callback.apply(null, [false]);
}
} }
},
},
});
}
controlItems.push({
el: {
type: "bi.button",
height: config.buttonHeight,
text: i18nText("BI-Basic_OK"),
handler() {
close();
if (isFunction(callback)) {
callback.apply(null, [true]);
} }
}, });
try {
this.element.focus();
} catch (e) {
}
}, },
});
const conf = {
element: $pop,
type: "bi.center_adapt",
items: [ items: [
{ {
type: "bi.border", el: {
attributes: { type: HTapeLayout.xtype,
tabIndex: 1, height: 24,
}, items: [
mounted() { {
this.element.keyup(e => { type: IconLabel.xtype,
if (e.keyCode === KeyCode.ENTER) { cls: `${getIconCls(config.level)} icon-size-20`,
close(); width: 24,
if (isFunction(callback)) { height: 24,
callback.apply(null, [true]);
}
} else if (e.keyCode === KeyCode.ESCAPE) {
close();
if (hasCancel === true) {
if (isFunction(callback)) {
callback.apply(null, [false]);
}
}
}
});
try {
this.element.focus();
} catch (e) {
}
},
cls: "bi-card",
items: {
north: {
el: {
type: "bi.border",
cls: "bi-message-title bi-background",
items: {
center: {
el: {
type: "bi.label",
cls: "bi-font-bold",
text: title || i18nText("BI-Basic_Prompt"),
textAlign: "left",
hgap: 20,
height: 40,
},
},
east: {
el: {
type: "bi.icon_button",
cls: "bi-message-close close-font",
// height: 50,
handler() {
close();
if (isFunction(callback)) {
callback.apply(null, [false]);
}
},
},
width: 56,
},
},
}, },
height: 40, {
}, el: {
center: { type: Label.xtype,
el: isPlainObject(message) css: {"font-size": 16},
? message cls: 'bi-font-bold', // 16px
: { textAlign: 'left',
type: "bi.label", text: title || i18nText('BI-Basic_Prompt'),
vgap: 10, lgap: 16,
hgap: 20,
whiteSpace: "normal",
text: message,
}, },
}, width: 'fill',
south: {
el: {
type: "bi.absolute",
items: [
{
el: {
type: "bi.right_vertical_adapt",
lgap: 10,
items: controlItems,
},
top: 0,
left: 20,
right: 20,
bottom: 0,
}
],
}, },
height: 44, ],
},
tgap: 32,
},
{
el: isPlainObject(message)
? message
: {
type: Label.xtype,
css: { "font-size": 14 },
cls: 'alert-content',
textAlign: 'left',
text: message,
whiteSpace: 'normal',
}, },
height: 'fill',
tgap: 12,
lgap: 40,
},
{
el: config.footer && isFunction(config.footer) ? config.footer(close) : {
type: RightVerticalAdaptLayout.xtype,
lgap: 12,
items: controlItems,
}, },
width: 450, tgap: 32,
height: 200, bgap: 24,
} },
], ],
}; },
],
messageShows[messageShows.length] = createWidget(conf);
},
}; };
})();
messageShows[messageShows.length] = createWidget(conf);
}

50
packages/fineui/src/base/layer/layer.popover.js

@ -47,7 +47,7 @@ export class Popover extends Widget {
body: null, body: null,
footer: null, footer: null,
footerHeight: 44, footerHeight: 44,
footerButtonHeight: 24, footerButtonHeight: 28,
closable: true, // BI-40839 是否显示右上角的关闭按钮 closable: true, // BI-40839 是否显示右上角的关闭按钮
bodyHgap: SIZE_CONSANTS.H_GAP_SIZE, bodyHgap: SIZE_CONSANTS.H_GAP_SIZE,
bodyTgap: SIZE_CONSANTS.V_GAP_SIZE, bodyTgap: SIZE_CONSANTS.V_GAP_SIZE,
@ -64,30 +64,7 @@ export class Popover extends Widget {
// var self = this; // var self = this;
const { header, headerHeight, closable, logic, footer, footerHeight, body, bodyTgap, bodyHgap } = this.options; const { header, headerHeight, closable, logic, footer, footerHeight, body, bodyTgap, bodyHgap } = this.options;
const c = this._constant; const c = this._constant;
this.startX = 0;
this.startY = 0;
const size = this._calculateSize(); const size = this._calculateSize();
const bodyDom = getOuterBody();
this.tracker = new MouseMoveTracker(
(deltaX, deltaY) => {
const W = Widget._renderEngine.createElement(bodyDom).width();
const H = Widget._renderEngine.createElement(bodyDom).height();
this.startX += deltaX;
this.startY += deltaY;
this.element.css({
left: `${clamp(this.startX, 0, W - this.element.width())}px`,
top: `${clamp(this.startY, 0, H - this.element.height())}px`,
});
// BI-12134 没有什么特别好的方法
Resizers._resize({
target: this.element[0],
});
},
() => {
this.tracker.releaseMouseMoves();
},
_global
);
const items = [ const items = [
{ {
el: { el: {
@ -219,7 +196,30 @@ export class Popover extends Widget {
// mounted之后绑定事件 // mounted之后绑定事件
mounted() { mounted() {
this.dragger.element.mousedown(e => { this.startX = 0;
this.startY = 0;
const bodyDom = getOuterBody();
this.tracker = new MouseMoveTracker(
(deltaX, deltaY) => {
const W = Widget._renderEngine.createElement(bodyDom).width();
const H = Widget._renderEngine.createElement(bodyDom).height();
this.startX += deltaX;
this.startY += deltaY;
this.element.css({
left: `${clamp(this.startX, 0, W - this.element.width())}px`,
top: `${clamp(this.startY, 0, H - this.element.height())}px`,
});
// BI-12134 没有什么特别好的方法
Resizers._resize({
target: this.element[0],
});
},
() => {
this.tracker.releaseMouseMoves();
},
_global
);
this.dragger?.element.mousedown(e => {
if (this.options.draggable !== false) { if (this.options.draggable !== false) {
this.startX = this.element[0].offsetLeft; this.startX = this.element[0].offsetLeft;
this.startY = this.element[0].offsetTop; this.startY = this.element[0].offsetTop;

7
packages/fineui/src/base/single/input/file.js

@ -242,14 +242,11 @@ const sendFile = (toString => {
upload.onloadstart(); upload.onloadstart();
} }
} }
const boundary = `AjaxUploadBoundary${new Date().getTime()}`;
xhr.setRequestHeader("Content-Type", `multipart/form-data; boundary=${boundary}`);
if (handler.file.getAsBinary) { if (handler.file.getAsBinary) {
const boundary = `AjaxUploadBoundary${new Date().getTime()}`;
xhr.setRequestHeader("Content-Type", `multipart/form-data; boundary=${boundary}`);
xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file)); xhr[xhr.sendAsBinary ? "sendAsBinary" : "send"](multipart(boundary, handler.name, handler.file));
} else { } else {
xhr.setRequestHeader("Content-Type", "multipart/form-data");
// xhr.setRequestHeader("X-Name", handler.name);
// xhr.setRequestHeader("X-File-Name", handler.file.fileName);
const form = new FormData(); const form = new FormData();
form.append("FileData", handler.file); form.append("FileData", handler.file);
xhr.send(form); xhr.send(form);

2
packages/fineui/src/case/button/item.multiselect.js

@ -19,6 +19,7 @@ export class MultiSelectItem extends BasicButton {
}, },
height: SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 26, iconWrapperWidth: 26,
el: {},
}); });
} }
@ -55,6 +56,7 @@ export class MultiSelectItem extends BasicButton {
keyword: o.keyword, keyword: o.keyword,
value: o.value, value: o.value,
py: o.py, py: o.py,
...o.el
}, },
} }
], ],

26
packages/fineui/src/case/button/switch.js

@ -1,15 +1,13 @@
import { AbsoluteLayout, shortcut, i18nText } from "@/core"; import { AbsoluteLayout, shortcut, i18nText } from "@/core";
import { TextButton, Label, BasicButton } from "@/base"; import { TextButton, Label, BasicButton } from "@/base";
const CIRCLE_SIZE = 12;
@shortcut() @shortcut()
export class Switch extends BasicButton { export class Switch extends BasicButton {
static xtype = "bi.switch"; static xtype = "bi.switch";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
constants = {
CIRCLE_SIZE: 12,
};
props = { props = {
extraCls: "bi-switch", extraCls: "bi-switch",
attributes: { attributes: {
@ -18,12 +16,12 @@ export class Switch extends BasicButton {
height: 20, height: 20,
width: 44, width: 44,
showTip: false, showTip: false,
textGap: 8,
}; };
render() { render() {
const o = this.options, const { selected, width, height, textGap, showTip } = this.options;
c = this.constants; const tgap = (height - CIRCLE_SIZE) / 2;
const tgap = (o.height - c.CIRCLE_SIZE) / 2;
return { return {
type: AbsoluteLayout.xtype, type: AbsoluteLayout.xtype,
@ -39,15 +37,15 @@ export class Switch extends BasicButton {
width: 12, width: 12,
height: 12, height: 12,
top: tgap, top: tgap,
left: o.selected ? 28 : 4, left: selected ? width - height + tgap : tgap,
}, },
{ {
type: Label.xtype, type: Label.xtype,
text: i18nText("BI-Basic_Simple_Open"), text: i18nText("BI-Basic_Simple_Open"),
cls: "content-tip", cls: "content-tip",
left: 8, left: textGap,
top: tgap - 2, top: tgap - 2,
invisible: !(o.showTip && o.selected), invisible: !(showTip && selected),
ref: _ref => { ref: _ref => {
this.openTip = _ref; this.openTip = _ref;
}, },
@ -56,9 +54,9 @@ export class Switch extends BasicButton {
type: Label.xtype, type: Label.xtype,
text: i18nText("BI-Basic_Simple_Close"), text: i18nText("BI-Basic_Simple_Close"),
cls: "content-tip", cls: "content-tip",
right: 8, right: textGap,
top: tgap - 2, top: tgap - 2,
invisible: !(o.showTip && !o.selected), invisible: !(showTip && !selected),
ref: _ref => { ref: _ref => {
this.closeTip = _ref; this.closeTip = _ref;
}, },
@ -78,7 +76,9 @@ export class Switch extends BasicButton {
setSelected(v) { setSelected(v) {
super.setSelected(...arguments); super.setSelected(...arguments);
this.layout.attr("items")[0].left = v ? 28 : 4; const { width, height } = this.options;
const tgap = (height - CIRCLE_SIZE) / 2;
this.layout.attr("items")[0].left = v ? width - height + tgap : tgap;
this.layout.resize(); this.layout.resize();
this.options.showTip && this.openTip.setVisible(v); this.options.showTip && this.openTip.setVisible(v);
this.options.showTip && this.closeTip.setVisible(!v); this.options.showTip && this.closeTip.setVisible(!v);

3
packages/fineui/src/case/colorchooser/colorchooser.js

@ -24,6 +24,7 @@ export class ColorChooser extends Widget {
height: 24, height: 24,
el: {}, el: {},
simple: false, simple: false,
colorBoardHeight: 80,
}); });
} }
@ -62,6 +63,8 @@ export class ColorChooser extends Widget {
el: extend( el: extend(
{ {
type: HexColorChooserPopup.xtype, type: HexColorChooserPopup.xtype,
colorItems: o.colorItems,
colorBoardHeight: o.colorBoardHeight,
recommendColorsGetter: o.recommendColorsGetter, recommendColorsGetter: o.recommendColorsGetter,
ref: _ref => { ref: _ref => {
this.colorPicker = _ref; this.colorPicker = _ref;

4
packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js

@ -47,6 +47,7 @@ export class HexColorChooserPopup extends Widget {
width: 300, width: 300,
recommendColorsGetter: emptyFn, // 推荐色获取接口 recommendColorsGetter: emptyFn, // 推荐色获取接口
simple: false, // 简单模式, popup中没有自动和透明 simple: false, // 简单模式, popup中没有自动和透明
colorBoardHeight: 80,
}; };
render() { render() {
@ -167,6 +168,7 @@ export class HexColorChooserPopup extends Widget {
type: HexColorPicker.xtype, type: HexColorPicker.xtype,
space: true, space: true,
value: o.value, value: o.value,
items: o.colorItems,
listeners: [ listeners: [
{ {
eventName: ColorPicker.EVENT_CHANGE, eventName: ColorPicker.EVENT_CHANGE,
@ -187,7 +189,7 @@ export class HexColorChooserPopup extends Widget {
bottom: 1, bottom: 1,
} }
], ],
height: 80, height: o.colorBoardHeight,
} }
], ],
}, },

2
packages/fineui/src/component/form/form.field.js

@ -69,7 +69,7 @@ export class FormField extends Widget {
return { return {
type: VerticalAdaptLayout.xtype, type: VerticalAdaptLayout.xtype,
columnSize: ["auto", "fill"], columnSize: isKey(o.label) ? ["auto", "fill"] : ["fill"],
verticalAlign: VerticalAlign.Stretch, verticalAlign: VerticalAlign.Stretch,
items: isKey(o.label) items: isKey(o.label)
? [ ? [

25
packages/fineui/src/core/1.lodash.js

@ -6142,6 +6142,30 @@
return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : []; return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];
} }
/**
* This method is like `uniq` except that it accepts `comparator` which
* is invoked to compare elements of `array`. The order of result values is
* determined by the order they occur in the array. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @see uniq, uniqBy
* @example
*
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]
*
* uniqWith(objects, isEqual)
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
*/
function uniqWith(array, comparator) {
comparator = typeof comparator === 'function' ? comparator : undefined;
return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
}
/** /**
* This method is like `_.zip` except that it accepts an array of grouped * This method is like `_.zip` except that it accepts an array of grouped
* elements and creates an array regrouping the elements to their pre-zip * elements and creates an array regrouping the elements to their pre-zip
@ -10041,6 +10065,7 @@
lodash.union = union; lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.without = without; lodash.without = without;

2
packages/fineui/src/core/2.base.js

@ -482,6 +482,7 @@ _.each(
"take", "take",
"takeRight", "takeRight",
"uniqBy", "uniqBy",
"uniqWith"
], ],
name => { name => {
lodashFns[name] = _apply(name); lodashFns[name] = _apply(name);
@ -510,6 +511,7 @@ export const range = lodashFns.range;
export const take = lodashFns.take; export const take = lodashFns.take;
export const takeRight = lodashFns.takeRight; export const takeRight = lodashFns.takeRight;
export const uniqBy = lodashFns.uniqBy; export const uniqBy = lodashFns.uniqBy;
export const uniqWith = lodashFns.uniqWith;
export const findIndex = lodashFns.findIndex; export const findIndex = lodashFns.findIndex;
export const findLastIndex = lodashFns.findLastIndex; export const findLastIndex = lodashFns.findLastIndex;

6
packages/fineui/src/core/4.widget.js

@ -241,7 +241,8 @@ export class Widget extends OB {
if (beforeRenderResult instanceof Promise) { if (beforeRenderResult instanceof Promise) {
beforeRenderResult.then(render).catch((e) => { beforeRenderResult.then(render).catch((e) => {
_global.console && console.error(e); _global.console && console.error(e);
render(); // 异步render,组件此时可能已经被销毁
!this.isDestroyed() ? render() : _global.console && console.error('Async render error! Widget has been destroyed!');
}); });
} }
} else { } else {
@ -258,7 +259,8 @@ export class Widget extends OB {
if (beforeInitResult instanceof Promise) { if (beforeInitResult instanceof Promise) {
beforeInitResult.then(init).catch((e) => { beforeInitResult.then(init).catch((e) => {
_global.console && console.error(e); _global.console && console.error(e);
init(); // 异步init,组件此时可能已经被销毁
!this.isDestroyed() ? init() : _global.console && console.error('Async init error! Widget has been destroyed!');
}); });
} }
} else { } else {

4
packages/fineui/src/core/platform/web/detectElementResize.js

@ -46,10 +46,14 @@ export const ResizeDetector = {
addResizeListener(widget.element[0], fn); addResizeListener(widget.element[0], fn);
return function () { return function () {
// 如果fn是debounce需要cancel掉
fn?.cancel?.();
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);
}; };
}, },
removeResizeListener(widget, fn) { removeResizeListener(widget, fn) {
// 如果fn是debounce需要cancel掉
fn?.cancel?.();
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);
}, },
}; };

2
packages/fineui/src/core/wrapper/layout/layout.table.js

@ -59,7 +59,7 @@ export class TableLayout extends Layout {
return { return {
type: "bi.default", type: "bi.default",
ref(_ref) { ref: (_ref) => {
this.layout = _ref; this.layout = _ref;
}, },
items: this._formatItems(items), items: this._formatItems(items),

2
packages/fineui/src/fix/fix.js

@ -1386,7 +1386,7 @@ class Model {
this.$$computed = null; this.$$computed = null;
this.$$state = null; this.$$state = null;
this.$$context = null; this.$$context = null;
this.model = null; this.model = {}; // 一些异步请求里访问model里的属性,这里先变成空对象,保证部分场景下不报错,其他报错会try catch
this._destroyHandler && this._destroyHandler(); this._destroyHandler && this._destroyHandler();
} }
} }

4
packages/fineui/src/less/base/tree/ztree.less

@ -272,7 +272,9 @@
} }
.bi-theme-dark { .bi-theme-dark {
.ztree.solid li span.button.center_docu, .ztree.solid li span.button.bottom_docu { .ztree.solid li span.button.center_docu, .ztree.solid li span.button.bottom_docu,.ztree.solid li span.button.roots_docu {
background: none;
&:before { &:before {
border-right: 1px solid @border-color-dark-gray-line-theme-dark; border-right: 1px solid @border-color-dark-gray-line-theme-dark;
} }

2
packages/fineui/src/less/lib/colors.less

@ -132,3 +132,5 @@
@color-bi-border-warning: @border-color-warning; @color-bi-border-warning: @border-color-warning;
//边框提亮 //边框提亮
@color-bi-border-highlight: @border-color-highlight; @color-bi-border-highlight: @border-color-highlight;
@color-bi-alert-warning: @color-bi-orange;

2
packages/fineui/src/less/lib/constant.less

@ -248,3 +248,5 @@
//box-shadow效果 //box-shadow效果
@box-shadow-toast: 0 6px 20px -2px rgba(9, 30, 64, 0.16); @box-shadow-toast: 0 6px 20px -2px rgba(9, 30, 64, 0.16);
@color-bi-orange: #f0ac3c;

5
packages/fineui/src/less/lib/font.less

@ -58,3 +58,8 @@
@font-key: "e1d0"; @font-key: "e1d0";
@font-add: "e1c7"; @font-add: "e1c7";
@font-alert-warning: 'e755';
@font-alert-success: 'e6de';
@font-alert-info: 'e74b';
@font-alert-error: 'e757';

5
packages/fineui/src/less/resource/font.less

@ -118,3 +118,8 @@
.font(text-align-left-font, @font-align-left); .font(text-align-left-font, @font-align-left);
.font(text-align-center-font, @font-align-center); .font(text-align-center-font, @font-align-center);
.font(text-align-right-font, @font-align-right); .font(text-align-right-font, @font-align-right);
.font(alert-success-font, @font-alert-success, @color-sea-green-100);
.font(alert-warning-font, @font-alert-warning, @color-bi-alert-warning);
.font(alert-error-font, @font-alert-error, @color-red-100);
.font(alert-info-font, @font-alert-info, @color-bi-text-highlight);

7
packages/fineui/src/widget/editor/editor.search.js

@ -10,7 +10,7 @@ import {
Controller, Controller,
Events, Events,
HTapeLayout, HTapeLayout,
isEndWithBlank isEndWithBlank, HorizontalFillLayout
} from "@/core"; } from "@/core";
import { IconButton, Editor, IconLabel } from "@/base"; import { IconButton, Editor, IconLabel } from "@/base";
@ -87,14 +87,15 @@ export class SearchEditor extends Widget {
createWidget({ createWidget({
element: this, element: this,
height: toPix(o.height, o.simple ? 1 : 2), height: toPix(o.height, o.simple ? 1 : 2),
type: HTapeLayout.xtype, type: HorizontalFillLayout.xtype,
columnSize: ["", "fill", ""],
items: [ items: [
{ {
el: { el: {
type: IconLabel.xtype, type: IconLabel.xtype,
cls: "search-font", cls: "search-font",
width: 24,
}, },
width: 24,
}, },
{ {
el: this.editor, el: this.editor,

5
packages/fineui/src/widget/multilayerdownlist/combo.downlist.js

@ -10,6 +10,7 @@ export class MultiLayerDownListCombo extends Widget {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; static EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
_defaultConfig() { _defaultConfig() {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -70,6 +71,10 @@ export class MultiLayerDownListCombo extends Widget {
this.downlistcombo.on(Combo.EVENT_BEFORE_POPUPVIEW, () => { this.downlistcombo.on(Combo.EVENT_BEFORE_POPUPVIEW, () => {
this.fireEvent(MultiLayerDownListCombo.EVENT_BEFORE_POPUPVIEW); this.fireEvent(MultiLayerDownListCombo.EVENT_BEFORE_POPUPVIEW);
}); });
this.downlistcombo.on(Combo.EVENT_BEFORE_HIDEVIEW, () => {
this.fireEvent(MultiLayerDownListCombo.EVENT_BEFORE_HIDEVIEW);
});
} }
hideView() { hideView() {

5
packages/fineui/src/widget/multiselect/multiselect.loader.js

@ -107,7 +107,10 @@ export class MultiSelectLoader extends Widget {
} }
firstItems = self._createItems(json); firstItems = self._createItems(json);
} }
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); const context = {
tipText: ob.tipText,
};
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || "", context);
if (op.times === 1 && self.storeValue) { if (op.times === 1 && self.storeValue) {
isKey(startValue) && isKey(startValue) &&
(self.storeValue.type === Selection.All (self.storeValue.type === Selection.All

5
packages/fineui/src/widget/multiselect/multiselect.loader.nobar.js

@ -115,7 +115,10 @@ export class MultiSelectNoBarLoader extends Widget {
} }
firstItems = self._createItems(json); firstItems = self._createItems(json);
} }
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); const context = {
tipText: ob.tipText,
};
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || "", context);
if (op.times === 1 && self.storeValue) { if (op.times === 1 && self.storeValue) {
isKey(startValue) && isKey(startValue) &&
(self.storeValue.type === Selection.All (self.storeValue.type === Selection.All

6
packages/fineui/src/widget/searchmultitextvaluecombo/multitextvalue.loader.search.js

@ -120,8 +120,10 @@ export class SearchMultiSelectLoader extends Widget {
} }
firstItems = this._createItems(json); firstItems = this._createItems(json);
} }
const context = {
callback(firstItems.concat(this._createItems(ob.items)), ob.keyword || ""); tipText: ob.tipText,
};
callback(firstItems.concat(this._createItems(ob.items)), ob.keyword || "", context);
if (op.times === 1 && this.storeValue) { if (op.times === 1 && this.storeValue) {
isKey(startValue) && isKey(startValue) &&
(this.storeValue.type === Selection.All (this.storeValue.type === Selection.All

1
packages/fineui/src/widget/year/popup.year.js

@ -150,6 +150,7 @@ export class DynamicYearPopup extends Widget {
}, },
tab: { tab: {
type: LinearSegment.xtype, type: LinearSegment.xtype,
cls: "bi-split-bottom",
invisible: !o.supportDynamic, invisible: !o.supportDynamic,
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: createItems( items: createItems(

18
packages/fineui/typescript/base/foundation/message.ts

@ -8,13 +8,23 @@ type toastOptions = {
export declare namespace Msg { export declare namespace Msg {
function alert(title: string, message?: string | { function alert(title: string, message?: string | {
[key: string]: any [key: string]: any
}, callback?: (result?: boolean) => void): void }, callback?: (result?: boolean) => void, config?: {
buttonHeight?: number,
sureText?: string,
cancelText?: string,
level?: 'success' | 'warning' | 'error' | 'info',
footer?: (onClose: Function) => Obj;
}): void
function confirm(title: string, message?: string | { function confirm(title: string, message?: string | {
[key: string]: any [key: string]: any
}, callback?: (result: boolean) => void): void }, callback?: (result: boolean) => void, config?: {
buttonHeight?: number,
function prompt(title: string, message?: string, value?: any, callback?: (result: string) => void, minWidth?: number): void sureText?: string,
cancelText?: string,
level?: 'success' | 'warning' | 'error' | 'info',
footer?: (onClose: Function) => Obj;
}): void
function toast(message: string | Obj, options?: toastOptions | string, context?: HTMLElement): Function function toast(message: string | Obj, options?: toastOptions | string, context?: HTMLElement): Function
} }

5
packages/fineui/typescript/case/button/switch.ts

@ -1,6 +1,11 @@
import { BasicButton } from "../../base/single/button/button.basic"; import { BasicButton } from "../../base/single/button/button.basic";
export declare class Switch extends BasicButton { export declare class Switch extends BasicButton {
props: {
textGap: number;
} & BasicButton['props']
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
} }

7
packages/fineui/typescript/case/colorchooser/colorchooser.ts

@ -1,3 +1,4 @@
import { Single } from 'typescript/base/single/single';
import { Widget } from '../../core/widget'; import { Widget } from '../../core/widget';
export declare class ColorChooser extends Widget { export declare class ColorChooser extends Widget {
@ -5,6 +6,12 @@ export declare class ColorChooser extends Widget {
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
static EVENT_AFTER_POPUPVIEW: string; static EVENT_AFTER_POPUPVIEW: string;
props: {
stopEvent?: boolean;
colorBoardHeight?: number;
colorItems?: { value: string }[][];
} & Single["props"];
isViewVisible(): boolean; isViewVisible(): boolean;
hideView(): void; hideView(): void;

14
packages/fineui/typescript/core/base.ts

@ -172,6 +172,8 @@ export declare function uniq<T>(array: T[], isSorted?: boolean, iteratee?: any,
export declare function uniqBy<T>(array: T[], iteratee?: any, context?: any): T[]; export declare function uniqBy<T>(array: T[], iteratee?: any, context?: any): T[];
export declare function uniqWith<T>(array: T[], comparator?: any): T[];
// 对象相关方法 // 对象相关方法
export declare function keys(object: object): string[]; export declare function keys(object: object): string[];
@ -320,7 +322,17 @@ export declare function once(func: Function): Function;
export declare function partial(func: Function, ...partials: any): Function; export declare function partial(func: Function, ...partials: any): Function;
export declare function debounce<T extends Function>(func: T, wait?: number, options?: any): T;
interface DebouncedFunc<T extends (...args: any[]) => any> {
(...args: Parameters<T>): ReturnType<T> | undefined;
cancel(): void;
flush(): ReturnType<T> | undefined;
}
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, options?: any): DebouncedFunc<T>;
export declare function throttle<T extends Function>(func: T, wait?: number, options?: any): T; export declare function throttle<T extends Function>(func: T, wait?: number, options?: any): T;

1
packages/fineui/typescript/widget/multilayerdownlist/multilayerdownlist.combo.ts

@ -7,6 +7,7 @@ export declare class MultiLayerDownListCombo extends Widget {
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
static EVENT_SON_VALUE_CHANGE: string; static EVENT_SON_VALUE_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string; static EVENT_BEFORE_POPUPVIEW: string;
static EVENT_BEFORE_HIDEVIEW: string;
props: { props: {
adjustLength: Combo['props']['adjustLength']; adjustLength: Combo['props']['adjustLength'];

Loading…
Cancel
Save