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. 17
      src/case/combo/textvaluecombo/combo.textvalue.js
  4. 3
      src/core/utils/dom.js
  5. 13
      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. 72
      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",
"version": "2.0.20230109200447",
"version": "2.0.20230208163847",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",
@ -9,8 +9,7 @@
},
"devDependencies": {
"@babel/core": "^7.17.4",
"@babel/polyfill": "7.6.0",
"@fui/babel-preset-fineui": "^2.0.0",
"@fui/babel-preset-fineui": "^3.0.0",
"@fui/eslint-plugin": "^1.0.19",
"@juggle/resize-observer": "^3.4.0",
"@types/node": "15.6.1",
@ -19,7 +18,6 @@
"autoprefixer": "9.6.1",
"babel-loader": "8.0.6",
"chai": "4.2.0",
"cnpm": "6.1.1",
"concat": "1.0.3",
"core-js": "3.3.2",
"cross-env": "6.0.0",

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

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

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

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

3
src/core/utils/dom.js

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

13
src/widget/dynamicdatetime/dynamicdatetime.timeselect.js

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

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

@ -15,7 +15,9 @@ import {
toPix,
Selection,
pushDistinct,
SIZE_CONSANTS
SIZE_CONSANTS,
LogicFactory,
Direction
} from "@/core";
import { ButtonGroup, Loader } from "@/base";
import { SelectList, ListPane, MultiSelectItem } from "@/case";
@ -133,12 +135,14 @@ export class MultiSelectNoBarLoader extends Widget {
)
);
createWidget({
type: VerticalLayout.xtype,
createWidget(extend({
element: this,
items: [this.button_group],
}, LogicFactory.createLogic(LogicFactory.createLogicTypeByDirection(Direction.Top), extend({
scrolly: true,
vgap: 5,
});
}, opts.logic, {
items: LogicFactory.createLogicItemsByDirection(Direction.Top, this.button_group),
}))));
this.button_group.on(Controller.EVENT_CHANGE, function () {
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,
valueFormatter: emptyFn,
keywordGetter: emptyFn,
allowSelectAll: true,
itemHeight: 24,
});
}
@ -49,6 +50,7 @@ export class MultiSelectSearchInsertPane extends Widget {
},
itemHeight: o.itemHeight,
value: o.value,
allowSelectAll: o.allowSelectAll,
});
this.loader.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(Controller.EVENT_CHANGE, arguments);

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

@ -14,7 +14,7 @@ import {
SIZE_CONSANTS
} from "@/core";
import { ButtonGroup, Loader } from "@/base";
import { SelectList, MultiSelectBar, MultiSelectItem } from "@/case";
import { SelectList, MultiSelectBar, MultiSelectItem, ListPane } from "@/case";
@shortcut()
export class MultiSelectSearchLoader extends Widget {
@ -29,18 +29,18 @@ export class MultiSelectSearchLoader extends Widget {
keywordGetter: emptyFn,
valueFormatter: emptyFn,
itemFormatter: emptyFn,
allowSelectAll: true,
itemHeight: 24,
});
}
_init() {
super._init(...arguments);
const self = this,
opts = this.options;
let hasNext = false;
this.storeValue = deepClone(opts.value);
this.button_group = createWidget({
this.button_group = createWidget(opts.allowSelectAll ? {
type: SelectList.xtype,
toolbar: {
type: MultiSelectBar.xtype,
@ -101,11 +101,58 @@ export class MultiSelectSearchLoader extends Widget {
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 () {
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);
});
}
@ -131,7 +178,9 @@ export class MultiSelectSearchLoader extends Widget {
}
isAllSelected() {
return this.button_group.isAllSelected();
const o = this.options;
return o.allowSelectAll ? this.button_group.isAllSelected() : false;
}
_filterValues(src) {
@ -161,15 +210,26 @@ export class MultiSelectSearchLoader extends Widget {
}
setValue(v) {
v || (v = {});
const o = this.options;
// 暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了
this.storeValue = deepClone(v);
this.button_group.setValue(v);
o.allowSelectAll ? (this.button_group.setValue(v)) : (this.button_group.setValue(v.value));
}
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() {
return this.button_group.getAllButtons();
}

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

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

6
src/widget/singleslider/singleslider.js

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

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

@ -4,6 +4,7 @@ export declare class TextValueCombo extends Widget {
static xtype: string;
static EVENT_CHANGE: string;
static EVENT_BEFORE_POPUPVIEW: string;
clear(): 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 popperJs = "src/core/controller/popper.js";
const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"];
const runtimePolyfill = ["core-js/stable"];
const basicAttachmentMap = {
polyfill: sync([

Loading…
Cancel
Save