From bb7905bf0f347d7944e3255cecd3a64f61e46a0e Mon Sep 17 00:00:00 2001 From: Renzo Date: Wed, 1 Feb 2023 14:08:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?JSY-26063=20fix:=20=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E6=95=8F=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/func/function.js | 10 +++++++--- typescript/core/func/function.ts | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/func/function.js b/src/core/func/function.js index 83d58c5ec..cc77b7798 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -40,11 +40,13 @@ BI._.extend(BI.Func, { * @param items * @param keyword * @param param 搜索哪个属性 + * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: function (items, keyword, param) { + getSearchResult: function (items, keyword, param, opt) { var isArray = BI.isArray(items); items = isArray ? BI.flatten(items) : items; param || (param = "text"); + opt || (opt = {caseSensitive: false}); if (!BI.isKey(keyword)) { return { find: items, @@ -69,8 +71,10 @@ BI._.extend(BI.Func, { py = BI.makeFirstPY(text, { splitChar: "\u200b" }); - text = BI.toUpperCase(text); - py = BI.toUpperCase(py); + if (!opt.caseSensitive) { + text = BI.toUpperCase(text); + py = BI.toUpperCase(py); + } var pidx; if (text.indexOf(keyword) > -1) { if (text === keyword) { diff --git a/typescript/core/func/function.ts b/typescript/core/func/function.ts index 4da9ab104..12634e513 100644 --- a/typescript/core/func/function.ts +++ b/typescript/core/func/function.ts @@ -13,8 +13,9 @@ export type _function = { * @param items 待搜索的数据 * @param keyword 关键字 * @param param 搜索哪个属性 + * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: (items: any, keyword: any, param?: string) => { find: any[], match: any[] }; + getSearchResult: (items: any, keyword: any, param?: string, opt?: {caseSensitive: boolean}) => { find: any[], match: any[] }; /** * 获取编码后的url From 0ae05dc79cc6262d29f99f87ee4b93b47133ef1f Mon Sep 17 00:00:00 2001 From: Renzo Date: Wed, 1 Feb 2023 16:01:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?JSY-26079=20feat:=20multi=5Fselect=5Finsert?= =?UTF-8?q?=5Fno=5Fbar=5Flist=20=E6=90=9C=E7=B4=A2=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=85=A8=E9=80=89=E6=8C=89=E9=92=AE=E6=94=AF=E6=8C=81=E5=8F=AF?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/multiselect.search.insert.pane.js | 6 +- .../search/multiselect.search.loader.js | 66 +++++++++++++++++-- .../multiselectlist.insert.nobar.js | 4 +- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/widget/multiselect/search/multiselect.search.insert.pane.js b/src/widget/multiselect/search/multiselect.search.insert.pane.js index d459dc73a..8def90700 100644 --- a/src/widget/multiselect/search/multiselect.search.insert.pane.js +++ b/src/widget/multiselect/search/multiselect.search.insert.pane.js @@ -19,7 +19,8 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, { itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, keywordGetter: BI.emptyFn, - itemHeight: 24 + allowSelectAll: true, + itemHeight: 24, }); }, @@ -47,7 +48,8 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, { }]); }, itemHeight: o.itemHeight, - value: o.value + value: o.value, + allowSelectAll: o.allowSelectAll, }); this.loader.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 5f6d09f54..9029a94ed 100644 --- a/src/widget/multiselect/search/multiselect.search.loader.js +++ b/src/widget/multiselect/search/multiselect.search.loader.js @@ -13,6 +13,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { keywordGetter: BI.emptyFn, valueFormatter: BI.emptyFn, itemFormatter: BI.emptyFn, + allowSelectAll: true, itemHeight: 24 }); }, @@ -23,7 +24,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; this.storeValue = BI.deepClone(opts.value); - this.button_group = BI.createWidget({ + this.button_group = BI.createWidget(opts.allowSelectAll ? { type: "bi.select_list", toolbar: { type: "bi.multi_select_bar", @@ -83,19 +84,71 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { hasNext: function () { 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: function () { + return true; + } + }, + layouts: [ + { + type: "bi.vertical" + } + ] + }, + itemsCreator: function (op, callback) { + self.storeValue && (op = BI.extend(op || {}, { + selectedValues: self.storeValue.value + })); + opts.itemsCreator(op, function (ob) { + var keyword = ob.keyword = opts.keywordGetter(); + hasNext = ob.hasNext; + var firstItems = []; + if (op.times === 1 && self.storeValue) { + var json = self._filterValues(self.storeValue); + firstItems = self._createItems(json); + } + var 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(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectSearchLoader.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); + }); + } }, _createItems: function (items) { var allSelected = this.isAllSelected(); var itemFormatter = this.options.itemFormatter; - + return BI.map(items, (index, item) => { return { type: "bi.multi_select_item", @@ -113,7 +166,8 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { }, isAllSelected: function () { - return this.button_group.isAllSelected(); + var o = this.options; + return o.allowSelectAll ? this.button_group.isAllSelected() : false; }, _filterValues: function (src) { diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index be87999ad..d88116279 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -8,6 +8,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, searcherHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + allowSelectAll: true, }); }, _init: function () { @@ -61,6 +62,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { o.itemsCreator(op, callback); } }, + allowSelectAll: o.allowSelectAll, }); this.searcherPane.setVisible(false); @@ -244,7 +246,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { // 和复选下拉框同步,allData做缓存是会爆炸的 digest(); - function digest (items) { + function digest(items) { BI.each(keywords, function (i, val) { self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); }); From fc54af70a787b9ab3ced9851226e3e13874c3a86 Mon Sep 17 00:00:00 2001 From: Renzo Date: Wed, 1 Feb 2023 16:38:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Revert=20"JSY-26063=20fix:=20=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E6=95=8F=E6=84=9F"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bb7905bf0f347d7944e3255cecd3a64f61e46a0e. --- src/core/func/function.js | 10 +++------- typescript/core/func/function.ts | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/core/func/function.js b/src/core/func/function.js index cc77b7798..83d58c5ec 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -40,13 +40,11 @@ BI._.extend(BI.Func, { * @param items * @param keyword * @param param 搜索哪个属性 - * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: function (items, keyword, param, opt) { + getSearchResult: function (items, keyword, param) { var isArray = BI.isArray(items); items = isArray ? BI.flatten(items) : items; param || (param = "text"); - opt || (opt = {caseSensitive: false}); if (!BI.isKey(keyword)) { return { find: items, @@ -71,10 +69,8 @@ BI._.extend(BI.Func, { py = BI.makeFirstPY(text, { splitChar: "\u200b" }); - if (!opt.caseSensitive) { - text = BI.toUpperCase(text); - py = BI.toUpperCase(py); - } + text = BI.toUpperCase(text); + py = BI.toUpperCase(py); var pidx; if (text.indexOf(keyword) > -1) { if (text === keyword) { diff --git a/typescript/core/func/function.ts b/typescript/core/func/function.ts index 12634e513..4da9ab104 100644 --- a/typescript/core/func/function.ts +++ b/typescript/core/func/function.ts @@ -13,9 +13,8 @@ export type _function = { * @param items 待搜索的数据 * @param keyword 关键字 * @param param 搜索哪个属性 - * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: (items: any, keyword: any, param?: string, opt?: {caseSensitive: boolean}) => { find: any[], match: any[] }; + getSearchResult: (items: any, keyword: any, param?: string) => { find: any[], match: any[] }; /** * 获取编码后的url From e2e05e9d7af00f3a4785841be0670f21b4a55296 Mon Sep 17 00:00:00 2001 From: Renzo Date: Wed, 1 Feb 2023 16:43:59 +0800 Subject: [PATCH 4/5] =?UTF-8?q?JSY-26079=20update:=20=E5=8E=BB=E9=99=A4=20?= =?UTF-8?q?multi=5Fselect=5Finsert=5Fno=5Fbar=5Flist=20=E7=9A=84=E5=85=A8?= =?UTF-8?q?=E9=80=89=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselectlist/multiselectlist.insert.nobar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index d88116279..aa322378b 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -8,7 +8,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, searcherHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, - allowSelectAll: true, }); }, _init: function () { @@ -62,7 +61,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { o.itemsCreator(op, callback); } }, - allowSelectAll: o.allowSelectAll, + allowSelectAll: false, }); this.searcherPane.setVisible(false); From 96604bdc5302b095e7782703e9d6dbfef44e383c Mon Sep 17 00:00:00 2001 From: data Date: Thu, 2 Feb 2023 14:30:19 +0800 Subject: [PATCH 5/5] auto upgrade version to 2.0.20230202142959 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0a5b94bd..a922cc97b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20230130114621", + "version": "2.0.20230202142959", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",