Browse Source

Merge pull request #255577 in DEC/fineui from bugfix/11.0 to release/11.0

* commit 'e5f64c313d48ee52bc34e6ea206480a03418cb71':
  无JIRA任务 custom_tree支持hasNext
  无JIRA任务 rowHeight支持一下传function
  无JIRA任务,优化object对象的un方法
  无JIRA 补一个ts类型
  无JIRA任务 补充类型
  无JIRA任务 补充类型
  无JIRA singletree.combo 支持传入popup属性, maxHeight之类的
  无JIRA singletree.combo 支持传入popup属性, maxHeight之类的
  BI-125208 feat: 组件日期类型的过滤算子优化
  BI-129591 feat: HexColorChooserPopup 支持配置自动和透明
  update
  KERNEL-15856 fix:兼容定时调度
  无JIRA 更新异步加载方法
  无jria fix:group.virtual
research/test
superman 1 year ago
parent
commit
3ef548d6dc
  1. 2
      packages/fineui/src/base/combination/group.virtual.js
  2. 24
      packages/fineui/src/base/list/virtualgrouplist.js
  3. 2
      packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js
  4. 15
      packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  5. 2
      packages/fineui/src/core/3.ob.js
  6. 10
      packages/fineui/src/core/constant/writable.var.js
  7. 19
      packages/fineui/src/core/platform/web/load.js
  8. 6
      packages/fineui/src/core/utils/index.js
  9. 1
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js
  10. 1
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js
  11. 9
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js
  12. 4
      packages/fineui/src/widget/numbereditor/number.editor.js
  13. 5
      packages/fineui/src/widget/singletree/singletree.combo.js
  14. 1
      packages/fineui/src/widget/timeinterval/timeinterval.js
  15. 2
      packages/fineui/src/widget/yearinterval/yearinterval.js
  16. 2
      packages/fineui/src/widget/yearquarterinterval/yearquarterinterval.js
  17. 14
      packages/fineui/src/without_Jquery_Polyfill.js
  18. 4
      packages/fineui/typescript/core/base.ts
  19. 2
      packages/fineui/typescript/core/platform/web/load.ts
  20. 2
      packages/fineui/typescript/index.ts
  21. 1
      packages/fineui/typescript/widget/dynamicdate/dynamicdate.combo.ts
  22. 14
      packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts
  23. 8
      packages/fineui/typescript/widget/timeinterval/timeinterval.ts
  24. 9
      packages/fineui/typescript/widget/year/combo.year.ts
  25. 23
      packages/fineui/typescript/widget/yearinterval/yearinterval.ts
  26. 11
      packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts
  27. 9
      packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts
  28. 10
      packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts
  29. 23
      packages/fineui/typescript/widget/yearquarterinterval/yearquarterinterval.ts
  30. 3
      packages/fineui/webpack/attachments.js

2
packages/fineui/src/base/combination/group.virtual.js

@ -68,7 +68,7 @@ export class VirtualGroup extends Widget {
el: extend(
{
ref: _ref => {
if (isKey(btMap[el.value])) {
if (isKey(el.value)) {
btMap[el.value] = _ref;
}
},

24
packages/fineui/src/base/list/virtualgrouplist.js

@ -1,4 +1,4 @@
import { VerticalLayout, Layout, Widget, shortcut, extend, isFunction, isNumber, PrefixIntervalTree, ResizeDetector } from "@/core";
import { VerticalLayout, Layout, Widget, shortcut, extend, isFunction, isNumber, sum, PrefixIntervalTree, ResizeDetector } from "@/core";
import { VirtualGroup } from "../combination";
/**
@ -17,7 +17,7 @@ export class VirtualGroupList extends Widget {
overscanHeight: 100,
blockSize: 10,
scrollTop: 0,
rowHeight: "auto",
rowHeight: "auto", // 'auto' 或 数值 或function
items: [],
el: {},
itemFormatter: (item, index) => item,
@ -97,7 +97,7 @@ export class VirtualGroupList extends Widget {
}
_isAutoHeight() {
return !isNumber(this.options.rowHeight);
return this.options.rowHeight === 'auto';
}
_renderMoreIf() {
@ -163,7 +163,7 @@ export class VirtualGroupList extends Widget {
itemsArr.push(items[j]);
}
}
this.container.element.height(rowHeight * items.length - topHeight);
this.container.element.height(this.summaryHeight - topHeight);
this.container.populate(
itemsArr.map((item, i) => itemFormatter(item, (start < 0 ? 0 : start) * blockSize + i))
);
@ -180,6 +180,16 @@ export class VirtualGroupList extends Widget {
Math.ceil(this.options.items.length / blockSize),
this._isAutoHeight() ? 0 : rowHeight * blockSize
);
if (isFunction(rowHeight)) {
for (let i = 0; i < this.options.items.length / blockSize; i++) {
const index = i * blockSize;
let summaryHeight = 0;
for (let j = index; j < index + blockSize && j < this.options.items.length; j++) {
summaryHeight += rowHeight(j, this.options.items[j]);
}
this.tree.set(i, summaryHeight);
}
}
this._calculateBlocksToRender();
try {
@ -188,7 +198,13 @@ export class VirtualGroupList extends Widget {
}
_restore() {
const o = this.options;
this.renderedIndex = -1;
if (isFunction(o.rowHeight)) {
this.summaryHeight = sum(o.items, o.rowHeight);
} else {
this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length;
}
// 依赖于cache的占位元素也要初始化
this.topBlank.setHeight(0);
this.bottomBlank.setHeight(0);

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

@ -69,6 +69,8 @@ export class HexColorChooserPopup extends Widget {
: HexColorPickerEditor.xtype,
value: o.value,
height: o.simple ? 36 : 70,
transparent: o.transparent,
auto: o.auto,
listeners: [
{
eventName: ColorPickerEditor.EVENT_CHANGE,

15
packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -41,6 +41,8 @@ export class HexColorPickerEditor extends Widget {
props = {
baseCls: "bi-color-picker-editor bi-hex-color-picker-editor",
height: 30,
transparent: true,
auto: true,
};
render() {
@ -95,11 +97,13 @@ export class HexColorPickerEditor extends Widget {
height: 24,
items: [
{
el: {
type: ColorChooserShowButton.xtype,
cls: "trans-color-icon",
height: 22,
title: i18nText("BI-Transparent_Color"),
text: i18nText("BI-Transparent_Color"),
invisible: !this.options.transparent,
listeners: [
{
eventName: ColorChooserShowButton.EVENT_CHANGE,
@ -113,6 +117,8 @@ export class HexColorPickerEditor extends Widget {
this.transparent = _ref;
},
},
rgap: this.options.auto ? 5 : 0,
},
{
el: {
type: ColorChooserShowButton.xtype,
@ -120,6 +126,7 @@ export class HexColorPickerEditor extends Widget {
height: 22,
title: i18nText("BI-Basic_Auto"),
text: i18nText("BI-Basic_Auto"),
invisible: !this.options.auto,
listeners: [
{
eventName: ColorChooserShowButton.EVENT_CHANGE,
@ -133,7 +140,7 @@ export class HexColorPickerEditor extends Widget {
this.none = _ref;
},
},
lgap: 10,
lgap: this.options.transparent ? 5 : 0,
}
],
},
@ -176,6 +183,9 @@ export class HexColorPickerEditor extends Widget {
{
eventName: "EVENT_CHANGE",
action: () => {
if (isEmptyString(this.hexEditor.getValue())) {
return;
}
this._checkHexEditor();
if (
checker(this.storeValue.r) &&
@ -261,9 +271,6 @@ export class HexColorPickerEditor extends Widget {
}
_checkHexEditor() {
if (isEmptyString(this.hexEditor.getValue())) {
this.hexEditor.setValue("000000");
}
const json = DOM.rgb2json(DOM.hex2rgb(`#${this.hexEditor.getValue()}`));
this.storeValue = {
r: json.r || 0,

2
packages/fineui/src/core/3.ob.js

@ -155,7 +155,7 @@ export class OB {
eventName = eventName.toLowerCase();
/* alex:如果fn是null,就是把eventName上面所有方法都un掉*/
if (fn === null) {
if (!fn) {
delete this._getEvents()[eventName];
} else {
const fns = this._getEvents()[eventName];

10
packages/fineui/src/core/constant/writable.var.js

@ -4,6 +4,7 @@
import { isNumber } from "../2.base";
import { _global } from "../0.foundation";
import { Cache } from "../structure";
import { setDom, DOM } from "../utils";
const PropertyDescriptors = {};
@ -145,6 +146,15 @@ PropertyDescriptors["EVENT_BLUR"] = {
set: setEventBlur,
};
PropertyDescriptors["DOM"] = {
enumerable: true,
configurable: true,
get: function() {
return DOM;
},
set: setDom,
};
export function _defineVarProperties(libName) {
Object.defineProperties(libName, PropertyDescriptors);
}

19
packages/fineui/src/core/platform/web/load.js

@ -81,25 +81,34 @@ export function syncLoadScript(uri) {
return false;
}
const promises = {};
/**
* 默认的异步加载javascript方法
* @param uri
* @returns {Promise<boolean>|Promise<unknown>}
*/
export function loadScript(uri) {
if (_LOADED[uri]) {
return Promise.resolve(true);
if (promises[uri]) {
return Promise.all(promises[uri]);
}
return new Promise(resolve => {
const promise = new Promise(resolve => {
const script = document.createElement("script");
script.type = "application/javascript";
script.src = uri;
script.onload = function() {
_LOADED[uri] = true;
resolve(true);
};
script.src = uri;
document.head.appendChild(script);
_LOADED[uri] = true;
});
promises[uri] = [];
promises[uri].push(promise);
return Promise.all(promises[uri]);
}
/**

6
packages/fineui/src/core/utils/index.js

@ -6,7 +6,11 @@ import * as platformDom from "./dom";
import * as colorDom from "./color";
export const DOM = {
export let DOM = {
...platformDom,
...colorDom,
};
export function setDom(dom) {
DOM = dom;
}

1
packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -207,6 +207,7 @@ export class DynamicDateTimeCombo extends Single {
popup: {
el: {
type: DynamicDateTimePopup.xtype,
timeSelectTypes: opts.timeSelectTypes,
width: opts.isNeedAdjustWidth ? opts.width : undefined,
supportDynamic: opts.supportDynamic,
behaviors: opts.behaviors,

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

@ -204,6 +204,7 @@ export class DynamicDateTimePopup extends Widget {
{
el: {
type: DynamicDateTimeSelect.xtype,
timeSelectTypes: o.timeSelectTypes,
cls: "bi-split-top",
ref: _ref => {
this.timeSelect = _ref;

9
packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js

@ -29,11 +29,12 @@ export class DynamicDateTimeSelect extends Widget {
return {
baseCls: "bi-date-time-select",
editorHeight: SIZE_CONSANTS.LIST_ITEM_HEIGHT,
timeSelectTypes: [DynamicDateTimeSelect.HOUR, DynamicDateTimeSelect.MINUTE, DynamicDateTimeSelect.SECOND],
};
}
render() {
const { editorHeight } = this.options;
const { editorHeight, timeSelectTypes } = this.options;
return {
type: CenterAdaptLayout.xtype,
@ -44,6 +45,8 @@ export class DynamicDateTimeSelect extends Widget {
{
el: {
type: NumberEditor.xtype,
disabled: !timeSelectTypes.includes(DynamicDateTimeSelect.HOUR),
warningTitle: i18nText("BI-Basic_Do_Not_Support_Modification"),
ref: _ref => {
this.hour = _ref;
},
@ -89,6 +92,8 @@ export class DynamicDateTimeSelect extends Widget {
},
{
type: NumberEditor.xtype,
disabled: !timeSelectTypes.includes(DynamicDateTimeSelect.MINUTE),
warningTitle: i18nText("BI-Basic_Do_Not_Support_Modification"),
ref: _ref => {
this.minute = _ref;
},
@ -133,6 +138,8 @@ export class DynamicDateTimeSelect extends Widget {
},
{
type: NumberEditor.xtype,
disabled: !timeSelectTypes.includes(DynamicDateTimeSelect.SECOND),
warningTitle: i18nText("BI-Basic_Do_Not_Support_Modification"),
ref: _ref => {
this.second = _ref;
},

4
packages/fineui/src/widget/numbereditor/number.editor.js

@ -1,6 +1,5 @@
import {
shortcut,
Widget,
extend,
emptyFn,
createWidget,
@ -18,9 +17,10 @@ import {
import { SignEditor } from "@/case";
import { TextEditor } from "../editor";
import { IconButton } from "@/base";
import { Single } from "../../base/single";
@shortcut()
export class NumberEditor extends Widget {
export class NumberEditor extends Single {
static xtype = "bi.number_editor";
static EVENT_CONFIRM = "EVENT_CONFIRM";

5
packages/fineui/src/widget/singletree/singletree.combo.js

@ -33,6 +33,10 @@ export class SingleTreeCombo extends Widget {
items: [],
value: "",
allowClear: false,
popup: {
maxHeight: 400,
minHeight: 240,
}
});
}
@ -77,6 +81,7 @@ export class SingleTreeCombo extends Widget {
el: this.trigger,
popup: {
el: this.popup,
...o.popup
},
});

1
packages/fineui/src/widget/timeinterval/timeinterval.js

@ -76,6 +76,7 @@ export class TimeInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicDateTimeCombo.xtype,
timeSelectTypes: o.timeSelectTypes,
simple: o.simple,
supportDynamic: o.supportDynamic,
minDate: o.minDate,

2
packages/fineui/src/widget/yearinterval/yearinterval.js

@ -28,6 +28,7 @@ export class YearInterval extends Single {
minDate: "1900-01-01",
maxDate: "2099-12-31",
supportDynamic: true,
simple: false,
};
static EVENT_VALID = "EVENT_VALID";
@ -71,6 +72,7 @@ export class YearInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicYearCombo.xtype,
simple: o.simple,
supportDynamic: o.supportDynamic,
minDate: o.minDate,
maxDate: o.maxDate,

2
packages/fineui/src/widget/yearquarterinterval/yearquarterinterval.js

@ -28,6 +28,7 @@ export class YearQuarterInterval extends Single {
minDate: "1900-01-01",
maxDate: "2099-12-31",
supportDynamic: true,
simple: false,
};
static EVENT_VALID = "EVENT_VALID";
@ -71,6 +72,7 @@ export class YearQuarterInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicYearQuarterCombo.xtype,
simple: o.simple,
supportDynamic: o.supportDynamic,
minDate: o.minDate,
maxDate: o.maxDate,

14
packages/fineui/src/without_Jquery_Polyfill.js

@ -1,14 +0,0 @@
export * from './worker.js';
// "!src/base/single/input/file.js",
// "!src/case/ztree/**/*.js",
import * as _case from './case';
import * as _widget from './widget';
import { _global } from "@/core/0.foundation";
const fuiExport = {
..._case,
..._widget
};
Object.assign(_global.BI, fuiExport);

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

@ -266,7 +266,7 @@ export declare function isNull(obj: any): obj is (undefined | null);
export declare function isEmptyArray<T, U>(arr: T[] | U): arr is T[] & { length: 0 };
export declare function isNotEmptyArray<T, U>(arr: T[] | U): arr is [T, ...T[]];
export declare function isNotEmptyArray<T>(arr: T[]): arr is NonNullable<T>[];
export declare function isEmptyObject(obj: any): boolean;
@ -402,6 +402,8 @@ export declare function getTime(...args: any[]): number;
export declare function clamp(number: number, lower: number, upper: number): number;
export declare function chunk<T>(array: T[], size?: number): T[][];
/**
* promise
* @param obj

2
packages/fineui/typescript/core/platform/web/load.ts

@ -1 +1,3 @@
export declare function $import(src: string, ext?: string, must?: boolean): void
export declare function loadResource(opt: { src: string, extension?: string, async?: boolean }): Promise<any>

2
packages/fineui/typescript/index.ts

@ -167,8 +167,10 @@ export { BubblePopupView, BubblePopupBarView, TextBubblePopupBarView } from "./c
export { ArrowTreeGroupNodeCheckbox } from "./case/checkbox/check.arrownode";
export { NumberInterval } from "./widget/numberinterval/numberinterval";
export { DynamicYearQuarterCombo } from "./widget/yearquarter/combo.yearquarter";
export { YearQuarterInterval } from "./widget/yearquarterinterval/yearquarterinterval";
export { DynamicYearCombo } from "./widget/year/combo.year";
export { DynamicYearPopup } from "./widget/year/popup.year";
export { YearInterval } from "./widget/yearinterval/yearinterval";
export { IntervalSlider } from "./widget/intervalslider/intervalslider";
export { MultiSelectInsertList } from "./widget/multiselectlist/multiselectlist.insert";
export { YearMonthInterval } from "./widget/yearmonthinterval/yearmonthinterval";

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

@ -25,6 +25,7 @@ export declare class DynamicDateCombo extends Single {
tabIndex?: number;
};
watermark?: string;
simple?: boolean;
} & Single['props']
setMinDate(minDate: string): void;

14
packages/fineui/typescript/widget/dynamicdatetime/dynamicdatetime.combo.ts

@ -25,6 +25,8 @@ export declare class DynamicDateTimeCombo extends Single {
watermark?: string;
} & Single['props'];
getValue(): DynamicDateTimeComboValue;
setMinDate(minDate: string): void;
setMaxDate(minDate: string): void;
@ -39,3 +41,15 @@ export declare class DynamicDateTimeCombo extends Single {
setWaterMark(v: string): void
}
export interface DynamicDateTimeComboValue {
type: number;
value: {
year: number;
month: number;
day: number;
hour: number;
minute: number;
second: number;
};
}

8
packages/fineui/typescript/widget/timeinterval/timeinterval.ts

@ -1,5 +1,5 @@
import { Single } from "../../base/single/single";
import { DynamicDataComboValue } from "../dynamicdate/dynamicdate.combo";
import { DynamicDateTimeComboValue } from "../dynamicdatetime/dynamicdatetime.combo";
export declare class TimeInterval extends Single {
static xtype: string;
@ -13,11 +13,11 @@ export declare class TimeInterval extends Single {
supportDynamic?: boolean;
watermark?: string;
simple?: boolean;
} & Single['props']
} & Single['props'];
getValue(): {
start: DynamicDataComboValue;
end: DynamicDataComboValue;
start: DynamicDateTimeComboValue;
end: DynamicDateTimeComboValue;
};
setMinDate(minDate: string): void;

9
packages/fineui/typescript/widget/year/combo.year.ts

@ -7,7 +7,16 @@ export declare class DynamicYearCombo extends Widget {
static EVENT_CONFIRM: string;
static EVENT_BEFORE_POPUPVIEW: string;
getValue(): DynamicYearComboValue;
setMinDate(minDate: string): void;
setMaxDate(maxDate: string): void;
}
export interface DynamicYearComboValue {
type: number;
value: {
year: number;
};
}

23
packages/fineui/typescript/widget/yearinterval/yearinterval.ts

@ -0,0 +1,23 @@
import { Single } from "../../base/single/single";
import { DynamicYearComboValue } from "../year/combo.year";
export declare class YearInterval extends Single {
static xtype: string;
static EVENT_VALID: string;
static EVENT_ERROR: string;
static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
props: {
simple?: boolean;
} & Single['props'];
getValue(): {
start: DynamicYearComboValue;
end: DynamicYearComboValue;
};
setMinDate(minDate: string): void;
setMaxDate(maxDate: string): void;
}

11
packages/fineui/typescript/widget/yearmonth/combo.yearmonth.ts

@ -12,7 +12,18 @@ export declare class DynamicYearMonthCombo extends Single {
getKey(): string;
getValue(): DynamicYearMonthComboValue;
setMinDate(minDate: string): void;
setMaxDate(maxDate: string): void;
}
export interface DynamicYearMonthComboValue {
type: number;
value: {
year: number;
month: number;
};
}

9
packages/fineui/typescript/widget/yearmonthinterval/yearmonthinterval.ts

@ -1,4 +1,5 @@
import { Single } from '../../base/single/single';
import { DynamicYearMonthComboValue } from '../yearmonth/combo.yearmonth';
export declare class YearMonthInterval extends Single {
static xtype: string;
@ -7,9 +8,13 @@ export declare class YearMonthInterval extends Single {
static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
props: {
simple?: boolean;
} & Single['props'];
getValue(): {
start: number;
end: number;
start: DynamicYearMonthComboValue;
end: DynamicYearMonthComboValue;
};
setMinDate(minDate: string): void;

10
packages/fineui/typescript/widget/yearquarter/combo.yearquarter.ts

@ -5,7 +5,17 @@ export declare class DynamicYearQuarterCombo extends Widget {
static EVENT_CONFIRM: string;
static EVENT_BEFORE_POPUPVIEW: string;
getValue(): DynamicYearQuarterComboValue;
setMinDate(minDate: string): void;
setMaxDate(maxDate: string): void;
}
export interface DynamicYearQuarterComboValue {
type: number;
value: {
year: number;
quarter: number;
};
}

23
packages/fineui/typescript/widget/yearquarterinterval/yearquarterinterval.ts

@ -0,0 +1,23 @@
import { Single } from "../../base/single/single";
import { DynamicYearQuarterComboValue } from "../yearquarter/combo.yearquarter";
export declare class YearQuarterInterval extends Single {
static xtype: string;
static EVENT_VALID: string;
static EVENT_ERROR: string;
static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
props: {
simple?: boolean;
} & Single['props'];
getValue(): {
start: DynamicYearQuarterComboValue;
end: DynamicYearQuarterComboValue;
};
setMinDate(minDate: string): void;
setMaxDate(maxDate: string): void;
}

3
packages/fineui/webpack/attachments.js

@ -19,8 +19,7 @@ const basicAttachmentMap = {
"src/less/component/**/*.less"
]),
js_bundle: sync(["src/bundle.js"]),
js_worker: sync(["src/worker.js"]),
js_without_Jquery_polyfill: sync(["src/without_Jquery_Polyfill.js"]),
js_worker: sync(["src/worker.js"])
};
const bundleCss = uniq([].concat(basicAttachmentMap.less, basicAttachmentMap.ui, sync(["public/less/app.less", "public/less/**/*.less"])));

Loading…
Cancel
Save