Browse Source

Pull request #3443: Master -> es6

Merge in VISUAL/fineui from ~ZHENFEI.LI/fineui:es6 to es6

* commit '79de417f3b2a702c4684f37257c58877bf28742f': (27 commits)
  BI-121538 fix(bi.file): 严格文件类型校验
  update
  无JIRA 用core-js/stable替代已经废弃的@babel/polyfill
  auto upgrade version to 2.0.20230208163847
  无JIRA fix: 组件创建完之后再执行setMinMax修复
  auto upgrade version to 2.0.20230207102533
  BI-120672 feat:时间选择控件opt里支持传height
  BI-120672 feat:时间选择控件opt里支持传height
  auto upgrade version to 2.0.20230206100506
  auto upgrade version to 2.0.20230203202509
  JSY-26262 fix: 更改布局方式
  JSY-26289 fix: 统一setValue和getValue方法
  JSY-26289 fix: 修复无全选按钮时搜索面板勾选不生效
  JSY-26262 fix: multi_select_insert_no_bar_list 结果为空时,提示居中
  auto upgrade version to 2.0.20230202142959
  JSY-26079 update: 去除 multi_select_insert_no_bar_list 的全选配置
  Revert "JSY-26063 fix: 前端搜索支持配置大小写敏感"
  JSY-26079 feat: multi_select_insert_no_bar_list 搜索面板全选按钮支持可选
  JSY-26063 fix: 前端搜索支持配置大小写敏感
  auto upgrade version to 2.0.20230130114621
  ...
es6
Zhenfei.Li-李振飞 2 years ago
parent
commit
6761b08df7
  1. 6
      package.json
  2. 4
      src/base/single/input/file.js
  3. 25
      src/case/combo/textvaluecombo/combo.textvalue.js
  4. 3
      src/core/utils/dom.js
  5. 19
      src/widget/dynamicdatetime/dynamicdatetime.timeselect.js
  6. 14
      src/widget/multiselect/multiselect.loader.nobar.js
  7. 2
      src/widget/multiselect/search/multiselect.search.insert.pane.js
  8. 74
      src/widget/multiselect/search/multiselect.search.loader.js
  9. 4
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  10. 6
      src/widget/singleslider/singleslider.js
  11. 1
      typescript/case/combo/combo.textvalue.ts
  12. 2
      webpack/attachments.js

6
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20230109200447", "version": "2.0.20230208163847",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",
@ -9,8 +9,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.4", "@babel/core": "^7.17.4",
"@babel/polyfill": "7.6.0", "@fui/babel-preset-fineui": "^3.0.0",
"@fui/babel-preset-fineui": "^2.0.0",
"@fui/eslint-plugin": "^1.0.19", "@fui/eslint-plugin": "^1.0.19",
"@juggle/resize-observer": "^3.4.0", "@juggle/resize-observer": "^3.4.0",
"@types/node": "15.6.1", "@types/node": "15.6.1",
@ -19,7 +18,6 @@
"autoprefixer": "9.6.1", "autoprefixer": "9.6.1",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
"chai": "4.2.0", "chai": "4.2.0",
"cnpm": "6.1.1",
"concat": "1.0.3", "concat": "1.0.3",
"core-js": "3.3.2", "core-js": "3.3.2",
"cross-env": "6.0.0", "cross-env": "6.0.0",

4
src/base/single/input/file.js

@ -459,11 +459,11 @@ const fileTypeValidate = (fileName, fileType) => {
let matches; let matches;
matches = mime.match(r1); matches = mime.match(r1);
if (matches) { if (matches) {
return fileName.toLowerCase().indexOf(matches[1]) > -1; return fileName.toLowerCase().endsWith(matches[0]);
} }
matches = mime.match(r2); matches = mime.match(r2);
if (matches) { if (matches) {
return matches[1] === "*" ? true : fileName.toLowerCase().indexOf(matches[1]) > -1; return matches[1] === "*" ? true : fileName.toLowerCase().endsWith(`.${matches[1]}`);
} }
}); });
}; };

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

@ -22,6 +22,7 @@ export class TextValueCombo extends Widget {
static xtype = "bi.text_value_combo"; static xtype = "bi.text_value_combo";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
_defaultConfig(config) { _defaultConfig(config) {
return extend(super._defaultConfig(...arguments), { return extend(super._defaultConfig(...arguments), {
@ -43,13 +44,13 @@ export class TextValueCombo extends Widget {
const o = this.options; const o = this.options;
o.value = isFunction(o.value) o.value = isFunction(o.value)
? this.__watch(o.value, (context, newValue) => { ? this.__watch(o.value, (context, newValue) => {
this.setValue(newValue); this.setValue(newValue);
}) })
: o.value; : o.value;
o.items = isFunction(o.items) o.items = isFunction(o.items)
? this.__watch(o.items, (context, newValue) => { ? this.__watch(o.items, (context, newValue) => {
this.populate(newValue); this.populate(newValue);
}) })
: o.items; : o.items;
super._init(...arguments); super._init(...arguments);
} }
@ -75,7 +76,7 @@ export class TextValueCombo extends Widget {
const trigger = { const trigger = {
type: SelectTextTrigger.xtype, type: SelectTextTrigger.xtype,
ref: (ref) => (this.trigger = ref), ref: ref => (this.trigger = ref),
cls: "text-value-trigger", cls: "text-value-trigger",
items: o.items, items: o.items,
height: toPix(o.height, o.simple ? 1 : 2), height: toPix(o.height, o.simple ? 1 : 2),
@ -91,14 +92,14 @@ export class TextValueCombo extends Widget {
this._clear(); this._clear();
this.fireEvent(TextValueCombo.EVENT_CHANGE); this.fireEvent(TextValueCombo.EVENT_CHANGE);
}, },
}, }
], ],
...o.el, ...o.el,
}; };
let changeTag = false; let changeTag = false;
const popup = { const popup = {
type: TextValueComboPopup.xtype, type: TextValueComboPopup.xtype,
ref: (ref) => (this.popup = ref), ref: ref => (this.popup = ref),
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items, items: o.items,
allowSelectAll: o.allowSelectAll, allowSelectAll: o.allowSelectAll,
@ -137,7 +138,7 @@ export class TextValueCombo extends Widget {
action: (...args) => { action: (...args) => {
this.combo.hideView(); this.combo.hideView();
}, },
}, }
], ],
}; };
@ -145,7 +146,7 @@ export class TextValueCombo extends Widget {
type: Combo.xtype, type: Combo.xtype,
height: toPix(o.height, 2), height: toPix(o.height, 2),
width: toPix(o.width, 2), width: toPix(o.width, 2),
ref: (ref) => (this.combo = ref), ref: ref => (this.combo = ref),
container: o.container, container: o.container,
direction: o.direction, direction: o.direction,
adjustLength: 2, adjustLength: 2,
@ -155,16 +156,16 @@ export class TextValueCombo extends Widget {
eventName: Combo.EVENT_BEFORE_POPUPVIEW, eventName: Combo.EVENT_BEFORE_POPUPVIEW,
action: () => { action: () => {
changeTag = false; changeTag = false;
this.fireEvent(BI.TextValueCombo.EVENT_BEFORE_POPUPVIEW);
}, },
}, }, {
{
eventName: Combo.EVENT_AFTER_HIDEVIEW, eventName: Combo.EVENT_AFTER_HIDEVIEW,
action: (...args) => { action: (...args) => {
if (o.chooseType !== ButtonGroup.CHOOSE_TYPE_SINGLE && changeTag) { if (o.chooseType !== ButtonGroup.CHOOSE_TYPE_SINGLE && changeTag) {
this.fireEvent(TextValueCombo.EVENT_CHANGE, ...args); this.fireEvent(TextValueCombo.EVENT_CHANGE, ...args);
} }
}, },
}, }
], ],
popup: { popup: {
el: popup, el: popup,

3
src/core/utils/dom.js

@ -776,9 +776,10 @@ export function getPositionRelativeContainingBlock(element) {
export function getPositionRelativeContainingBlockRect(element) { export function getPositionRelativeContainingBlockRect(element) {
const positionRelativeElement = getPositionRelativeContainingBlock(element); const positionRelativeElement = getPositionRelativeContainingBlock(element);
const rect = positionRelativeElement.getBoundingClientRect(); const rect = positionRelativeElement.getBoundingClientRect();
const { top, right, bottom, left, width, height, x, y } = positionRelativeElement.getBoundingClientRect();
return { return {
...rect.toJSON(), top, right, bottom, left, width, height, x, y,
scaleX: rect.width / positionRelativeElement.offsetWidth, scaleX: rect.width / positionRelativeElement.offsetWidth,
scaleY: rect.height / positionRelativeElement.offsetHeight, scaleY: rect.height / positionRelativeElement.offsetHeight,
}; };

19
src/widget/dynamicdatetime/dynamicdatetime.timeselect.js

@ -25,11 +25,16 @@ export class DynamicDateTimeSelect extends Widget {
static EVENT_CONFIRM = "EVENT_CONFIRM"; static EVENT_CONFIRM = "EVENT_CONFIRM";
props = { props () {
baseCls: "bi-date-time-select", return {
}; baseCls: "bi-date-time-select",
height: SIZE_CONSANTS.LIST_ITEM_HEIGHT,
};
}
render() { render() {
const { height } = this.options;
return { return {
type: CenterAdaptLayout.xtype, type: CenterAdaptLayout.xtype,
items: [ items: [
@ -49,7 +54,7 @@ export class DynamicDateTimeSelect extends Widget {
if (isNumeric(v)) { if (isNumeric(v)) {
return i18nText("BI-Basic_Input_From_To_Number", "\"00-23\""); return i18nText("BI-Basic_Input_From_To_Number", "\"00-23\"");
} }
return i18nText("BI-Numerical_Interval_Input_Data"); return i18nText("BI-Numerical_Interval_Input_Data");
}, },
listeners: [ listeners: [
@ -74,7 +79,7 @@ export class DynamicDateTimeSelect extends Widget {
} }
], ],
width: 60, width: 60,
height: SIZE_CONSANTS.LIST_ITEM_HEIGHT, height,
}, },
}, },
{ {
@ -119,7 +124,7 @@ export class DynamicDateTimeSelect extends Widget {
} }
], ],
width: 60, width: 60,
height: SIZE_CONSANTS.LIST_ITEM_HEIGHT, height,
}, },
{ {
type: Label.xtype, type: Label.xtype,
@ -153,7 +158,7 @@ export class DynamicDateTimeSelect extends Widget {
} }
], ],
width: 60, width: 60,
height: SIZE_CONSANTS.LIST_ITEM_HEIGHT, height,
} }
], ],
} }

14
src/widget/multiselect/multiselect.loader.nobar.js

@ -15,7 +15,9 @@ import {
toPix, toPix,
Selection, Selection,
pushDistinct, pushDistinct,
SIZE_CONSANTS SIZE_CONSANTS,
LogicFactory,
Direction
} from "@/core"; } from "@/core";
import { ButtonGroup, Loader } from "@/base"; import { ButtonGroup, Loader } from "@/base";
import { SelectList, ListPane, MultiSelectItem } from "@/case"; import { SelectList, ListPane, MultiSelectItem } from "@/case";
@ -133,12 +135,14 @@ export class MultiSelectNoBarLoader extends Widget {
) )
); );
createWidget({ createWidget(extend({
type: VerticalLayout.xtype,
element: this, element: this,
items: [this.button_group], }, LogicFactory.createLogic(LogicFactory.createLogicTypeByDirection(Direction.Top), extend({
scrolly: true,
vgap: 5, vgap: 5,
}); }, opts.logic, {
items: LogicFactory.createLogicItemsByDirection(Direction.Top, this.button_group),
}))));
this.button_group.on(Controller.EVENT_CHANGE, function () { this.button_group.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(Controller.EVENT_CHANGE, arguments); self.fireEvent(Controller.EVENT_CHANGE, arguments);

2
src/widget/multiselect/search/multiselect.search.insert.pane.js

@ -16,6 +16,7 @@ export class MultiSelectSearchInsertPane extends Widget {
itemsCreator: emptyFn, itemsCreator: emptyFn,
valueFormatter: emptyFn, valueFormatter: emptyFn,
keywordGetter: emptyFn, keywordGetter: emptyFn,
allowSelectAll: true,
itemHeight: 24, itemHeight: 24,
}); });
} }
@ -49,6 +50,7 @@ export class MultiSelectSearchInsertPane extends Widget {
}, },
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: o.value, value: o.value,
allowSelectAll: o.allowSelectAll,
}); });
this.loader.on(Controller.EVENT_CHANGE, function () { this.loader.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(Controller.EVENT_CHANGE, arguments); self.fireEvent(Controller.EVENT_CHANGE, arguments);

74
src/widget/multiselect/search/multiselect.search.loader.js

@ -14,7 +14,7 @@ import {
SIZE_CONSANTS SIZE_CONSANTS
} from "@/core"; } from "@/core";
import { ButtonGroup, Loader } from "@/base"; import { ButtonGroup, Loader } from "@/base";
import { SelectList, MultiSelectBar, MultiSelectItem } from "@/case"; import { SelectList, MultiSelectBar, MultiSelectItem, ListPane } from "@/case";
@shortcut() @shortcut()
export class MultiSelectSearchLoader extends Widget { export class MultiSelectSearchLoader extends Widget {
@ -29,18 +29,18 @@ export class MultiSelectSearchLoader extends Widget {
keywordGetter: emptyFn, keywordGetter: emptyFn,
valueFormatter: emptyFn, valueFormatter: emptyFn,
itemFormatter: emptyFn, itemFormatter: emptyFn,
allowSelectAll: true,
itemHeight: 24, itemHeight: 24,
}); });
} }
_init() { _init() {
super._init(...arguments); super._init(...arguments);
const self = this, const self = this,
opts = this.options; opts = this.options;
let hasNext = false; let hasNext = false;
this.storeValue = deepClone(opts.value); this.storeValue = deepClone(opts.value);
this.button_group = createWidget({ this.button_group = createWidget(opts.allowSelectAll ? {
type: SelectList.xtype, type: SelectList.xtype,
toolbar: { toolbar: {
type: MultiSelectBar.xtype, type: MultiSelectBar.xtype,
@ -101,11 +101,58 @@ export class MultiSelectSearchLoader extends Widget {
hasNext() { hasNext() {
return hasNext; return hasNext;
}, },
} : {
type: "bi.list_pane",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch,
},
element: this,
el: {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
behaviors: {
redmark () {
return true;
},
},
layouts: [
{
type: "bi.vertical",
}
],
},
itemsCreator (op, callback) {
self.storeValue && (op = BI.extend(op || {}, {
selectedValues: self.storeValue.value,
}));
opts.itemsCreator(op, ob => {
const keyword = ob.keyword = opts.keywordGetter();
hasNext = ob.hasNext;
let firstItems = [];
if (op.times === 1 && self.storeValue) {
const json = self._filterValues(self.storeValue);
firstItems = self._createItems(json);
}
const context = {
tipText: ob.tipText,
};
callback(firstItems.concat(self._createItems(ob.items)), keyword, context);
if (op.times === 1 && self.storeValue) {
self.setValue(self.storeValue);
}
});
},
value: opts.value,
height: "fill",
}); });
this.button_group.on(Controller.EVENT_CHANGE, function () { this.button_group.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(Controller.EVENT_CHANGE, arguments); self.fireEvent(Controller.EVENT_CHANGE, arguments);
}); });
this.button_group.on(SelectList.EVENT_CHANGE, function () {
const searchLoaderEventChangeName = opts.allowSelectAll ? SelectList.EVENT_CHANGE : ListPane.EVENT_CHANGE;
this.button_group.on(searchLoaderEventChangeName, function () {
self.fireEvent(MultiSelectSearchLoader.EVENT_CHANGE, arguments); self.fireEvent(MultiSelectSearchLoader.EVENT_CHANGE, arguments);
}); });
} }
@ -131,7 +178,9 @@ export class MultiSelectSearchLoader extends Widget {
} }
isAllSelected() { isAllSelected() {
return this.button_group.isAllSelected(); const o = this.options;
return o.allowSelectAll ? this.button_group.isAllSelected() : false;
} }
_filterValues(src) { _filterValues(src) {
@ -161,13 +210,24 @@ export class MultiSelectSearchLoader extends Widget {
} }
setValue(v) { setValue(v) {
v || (v = {});
const o = this.options;
// 暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了 // 暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了
this.storeValue = deepClone(v); this.storeValue = deepClone(v);
this.button_group.setValue(v); o.allowSelectAll ? (this.button_group.setValue(v)) : (this.button_group.setValue(v.value));
} }
getValue() { getValue() {
return this.button_group.getValue(); const o = this.options;
if (o.allowSelectAll) {
return this.button_group.getValue();
}
return {
type: ButtonGroup.CHOOSE_TYPE_MULTI,
value: this.button_group.getValue(),
assist: this.button_group.getNotSelectedValue(),
};
} }
getAllButtons() { getAllButtons() {

4
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -27,7 +27,8 @@ import {
contains, contains,
isNull, isNull,
VTapeLayout, VTapeLayout,
BlankSplitChar BlankSplitChar,
SIZE_CONSANTS
} from "@/core"; } from "@/core";
import { Single, Searcher, Msg } from "@/base"; import { Single, Searcher, Msg } from "@/base";
import { MultiSelectBar } from "@/case"; import { MultiSelectBar } from "@/case";
@ -108,6 +109,7 @@ export class MultiSelectInsertNoBarList extends Single {
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
} }
}, },
allowSelectAll: false,
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);

6
src/widget/singleslider/singleslider.js

@ -374,9 +374,9 @@ export class SingleSlider extends Single {
} }
setMinAndMax(v) { setMinAndMax(v) {
const minNumber = parseFloat(v.min); const minNumber = this.options.min = parseFloat(v.min);
const maxNumber = parseFloat(v.max); const maxNumber = this.options.max = parseFloat(v.max);
if (!isNaN(minNumber) && !isNaN(maxNumber) && maxNumber > minNumber) { if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber)) {
this.min = minNumber; this.min = minNumber;
this.max = maxNumber; this.max = maxNumber;
} }

1
typescript/case/combo/combo.textvalue.ts

@ -4,6 +4,7 @@ export declare class TextValueCombo extends Widget {
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
clear(): void; clear(): void;
setText(text: string): void; setText(text: string): void;

2
webpack/attachments.js

@ -8,7 +8,7 @@ const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js"; const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const popperJs = "src/core/controller/popper.js"; const popperJs = "src/core/controller/popper.js";
const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"]; const runtimePolyfill = ["core-js/stable"];
const basicAttachmentMap = { const basicAttachmentMap = {
polyfill: sync([ polyfill: sync([

Loading…
Cancel
Save