diff --git a/package.json b/package.json index a922cc97b..b28390b2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20230202142959", + "version": "2.0.20230227095536", "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", "@types/node": "15.6.1", "@typescript-eslint/eslint-plugin": "2.33.0", @@ -18,7 +17,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", diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 290970141..1769de9c5 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -437,11 +437,11 @@ var 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]}`); } }); } diff --git a/src/base/tree/customtree.js b/src/base/tree/customtree.js index c20af875a..3c32a80c0 100644 --- a/src/base/tree/customtree.js +++ b/src/base/tree/customtree.js @@ -51,6 +51,7 @@ BI.CustomTree = BI.inherit(BI.Widget, { }, BI.deepClone(o.expander), { id: node.id, pId: node.pId, + key: node.key, }); var el = BI.stripEL(node); if (!BI.isWidget(el)) { diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js index 6e7273252..4c1335ce6 100644 --- a/src/case/trigger/trigger.text.js +++ b/src/case/trigger/trigger.text.js @@ -40,6 +40,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { height: o.height, text: text || o.defaultText, tipType: o.tipType, + title: o.title, warningTitle: o.warningTitle, hgap: o.textHgap, vgap: o.textVgap, diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 005ac241b..feb0f138b 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -35,7 +35,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { textTgap: o.textTgap, textBgap: o.textBgap, tipType: o.tipType, - title: null, + title: o.title, allowClear: o.allowClear, listeners: [ { diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index 5642cb799..857fc368f 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -1,11 +1,16 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { - props: { - baseCls: "bi-date-time-select" + props: function () { + return { + baseCls: "bi-date-time-select", + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + }; }, render: function () { var self = this; + var o = this.options; + return { type: "bi.center_adapt", items: [{ @@ -41,7 +46,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }], width: 60, - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + height: o.height, } }, { type: "bi.label", @@ -77,7 +82,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }], width: 60, - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + height: o.height, }, { type: "bi.label", text: ":", @@ -106,7 +111,7 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }], width: 60, - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + height: o.height, }] }] }; diff --git a/src/widget/multiselect/multiselect.loader.nobar.js b/src/widget/multiselect/multiselect.loader.nobar.js index dde974df8..274d51f6c 100644 --- a/src/widget/multiselect/multiselect.loader.nobar.js +++ b/src/widget/multiselect/multiselect.loader.nobar.js @@ -98,13 +98,15 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, { value: this.storeValue }, opts.el)); - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.button_group], + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({ + scrolly: true, vgap: 5 - }); - + }, opts.logic, { + items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group) + })))); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); diff --git a/src/widget/multiselect/search/multiselect.search.loader.js b/src/widget/multiselect/search/multiselect.search.loader.js index 9029a94ed..a4a3d8ed5 100644 --- a/src/widget/multiselect/search/multiselect.search.loader.js +++ b/src/widget/multiselect/search/multiselect.search.loader.js @@ -134,15 +134,10 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - if (opts.allowSelectAll) { - this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); - }); - } else { - this.button_group.on(BI.ListPane.EVENT_CHANGE, function (val) { - self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, val); - }); - } + var searchLoaderEventChangeName = opts.allowSelectAll ? BI.SelectList.EVENT_CHANGE : BI.ListPane.EVENT_CHANGE + this.button_group.on(searchLoaderEventChangeName, function () { + self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); + }); }, _createItems: function (items) { @@ -196,13 +191,23 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { }, setValue: function (v) { + v || (v = {}); + var o = this.options; // 暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了 this.storeValue = BI.deepClone(v); - this.button_group.setValue(v); + o.allowSelectAll ? (this.button_group.setValue(v)) : (this.button_group.setValue(v.value)); }, getValue: function () { - return this.button_group.getValue(); + var o = this.options; + if (o.allowSelectAll) { + return this.button_group.getValue(); + } + return { + type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + value: this.button_group.getValue(), + assist: this.button_group.getNotSelectedValue() + }; }, getAllButtons: function () { diff --git a/src/widget/singleslider/singleslider.js b/src/widget/singleslider/singleslider.js index 8cf77b180..4eaf0cc0c 100644 --- a/src/widget/singleslider/singleslider.js +++ b/src/widget/singleslider/singleslider.js @@ -58,16 +58,18 @@ BI.SingleSlider = BI.inherit(BI.Single, { type: "bi.vertical_adapt", cls: "slider-wrapper", columnSize: ["fill"], - items: [{ - type: "bi.absolute", - items: [ - { - el: this.slider, - top: 8, - } - ], - height: c.SLIDER_HEIGHT - }], + items: [ + { + type: "bi.absolute", + items: [ + { + el: this.slider, + top: 8, + } + ], + height: c.SLIDER_HEIGHT + } + ], hgap: c.SLIDER_WIDTH_HALF, height: c.SLIDER_HEIGHT }); @@ -124,41 +126,49 @@ BI.SingleSlider = BI.inherit(BI.Single, { this._setVisible(false); return { type: "bi.absolute", - items: [{ - el: { - type: "bi.vertical", - items: [{ - type: "bi.absolute", - items: [{ - el: this.track, - width: "100%", - height: c.TRACK_HEIGHT - }] - }], - hgap: c.TRACK_GAP_HALF, - height: c.TRACK_HEIGHT - }, - top: 23, - left: 0, - width: "100%" - }, { - el: sliderVertical, - top: 20, - left: 0, - width: "100%" - }, { - el: { - type: "bi.vertical", - items: [{ - type: "bi.horizontal_auto", - items: [this.label] - }], - // height: c.EDITOR_HEIGHT - }, - top: 0, - left: 0, - width: "100%" - }] + items: [ + { + el: { + type: "bi.vertical", + items: [ + { + type: "bi.absolute", + items: [ + { + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + } + ] + } + ], + hgap: c.TRACK_GAP_HALF, + height: c.TRACK_HEIGHT + }, + top: 23, + left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 20, + left: 0, + width: "100%" + }, { + el: { + type: "bi.vertical", + items: [ + { + type: "bi.horizontal_auto", + items: [this.label] + } + ], + // height: c.EDITOR_HEIGHT + }, + top: 0, + left: 0, + width: "100%" + } + ] }; }, @@ -198,7 +208,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { self.fireEvent(BI.SingleSlider.EVENT_CHANGE); }, window); widget.element.on("mousedown", function (event) { - if(!widget.isEnabled()) { + if (!widget.isEnabled()) { return; } defaultSize = this.offsetLeft; @@ -206,7 +216,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { mouseMoveTracker.captureMouseMoves(event); }); - function optimizeSize (s) { + function optimizeSize(s) { return BI.clamp(s, 0, self._getGrayTrackLength()); } }, @@ -214,30 +224,36 @@ BI.SingleSlider = BI.inherit(BI.Single, { _createTrackWrapper: function () { return BI.createWidget({ type: "bi.absolute", - items: [{ - el: { - type: "bi.vertical", - items: [{ - type: "bi.absolute", - items: [{ - el: this.grayTrack, - top: 0, - left: 0, - width: "100%" - }, { - el: this.blueTrack, - top: 0, - left: 0, - width: "0%" - }] - }], - hgap: 8, - height: 8 - }, - top: 8, - left: 0, - width: "100%" - }] + items: [ + { + el: { + type: "bi.vertical", + items: [ + { + type: "bi.absolute", + items: [ + { + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + } + ] + } + ], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + } + ] }); }, @@ -245,9 +261,9 @@ BI.SingleSlider = BI.inherit(BI.Single, { var o = this.options; var valid = false; if (BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max)) { - if(o.digit === false) { + if (o.digit === false) { valid = true; - }else{ + } else { var dotText = (v + "").split(".")[1] || ""; valid = (dotText.length === o.digit); } @@ -256,7 +272,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { }, _setBlueTrack: function (percent) { - this.blueTrack.element.css({width: percent + "%"}); + this.blueTrack.element.css({ width: percent + "%" }); }, _setLabelPosition: function (percent) { @@ -264,7 +280,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { }, _setSliderPosition: function (percent) { - this.slider.element.css({left: percent + "%"}); + this.slider.element.css({ left: percent + "%" }); }, _setAllPosition: function (percent) { @@ -314,7 +330,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { _setEnable: function (b) { BI.SingleSlider.superclass._setEnable.apply(this, [b]); - if(b) { + if (b) { this.blueTrack.element.removeClass("disabled-blue-track").addClass("blue-track"); } else { this.blueTrack.element.removeClass("blue-track").addClass("disabled-blue-track"); @@ -322,9 +338,9 @@ BI.SingleSlider = BI.inherit(BI.Single, { }, setMinAndMax: function (v) { - var minNumber = BI.parseFloat(v.min); - var maxNumber = BI.parseFloat(v.max); - if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + var minNumber = this.options.min = BI.parseFloat(v.min); + var maxNumber = this.options.max = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber)) { this.min = minNumber; this.max = maxNumber; } diff --git a/typescript/widget/numberinterval/numberinterval.ts b/typescript/widget/numberinterval/numberinterval.ts index ea51b9550..17ec1d15d 100644 --- a/typescript/widget/numberinterval/numberinterval.ts +++ b/typescript/widget/numberinterval/numberinterval.ts @@ -16,6 +16,7 @@ export declare class NumberInterval extends Single { closeMax?: boolean; validation?: 'invalid' | 'valid'; numTip?: string; + simple?: boolean; } & Single['props']; isStateValid(): boolean; diff --git a/webpack/attachments.js b/webpack/attachments.js index acb30ad2a..befe73db1 100644 --- a/webpack/attachments.js +++ b/webpack/attachments.js @@ -7,7 +7,7 @@ const workerCompact = './dist/fix/worker.compact.js'; const lodashJs = "src/core/1.lodash.js"; const jqueryJs = "src/core/platform/web/jquery/_jquery.js"; -const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"]; +const runtimePolyfill = ["core-js/stable"]; const basicAttachmentMap = { polyfill: sync([