From cca17e808c92c80506c60228eb2eb58acaf88e6d Mon Sep 17 00:00:00 2001 From: Treecat Date: Wed, 26 Apr 2023 15:11:25 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-94961=20fix:=E5=87=BD=E6=95=B0=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E4=B8=8D=E8=83=BD=E5=8F=98=E9=87=8F=E6=8F=90=E5=8D=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README | 31 +++++++++++++++++++ packages/fineui/package.json | 5 +-- .../abstract.treevaluechooser.js | 23 +++++++------- packages/fineui/webpack/webpack.dev.js | 2 +- 4 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 000000000..e31dbb0f0 --- /dev/null +++ b/README @@ -0,0 +1,31 @@ +# FineUI + +[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) + + +> 帆软前端 UI 开发框架。 + +For more details, see the website [http://www.fanruan.com](http://www.fanruan.com). + +## 文档 + +http://fanruan.design/doc.html?post=0169cf558d + +## 开发 + +pnpm run dev + +* demo: [http://localhost:3000/](http://localhost:3000/) +* fineui: [http://localhost:9001/fineui.js](http://localhost:9001/fineui.js) + +## 构建 + +pnpm run build + +## 发布 + +@Treecat + +License +============ +Please refer to [LICENSE](https://code.fanruan.com/fanruan/fineui/src/branch/master/LICENSE) file. \ No newline at end of file diff --git a/packages/fineui/package.json b/packages/fineui/package.json index 79d35a2bc..e61339f24 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -1,6 +1,6 @@ { "name": "@fui/core", - "version": "3.0.20230421163847", + "version": "3.0.20230426142647", "description": "fineui", "main": "dist/fineui.min.js", "module": "dist/es/index.js", @@ -29,7 +29,8 @@ "build:fineui": "webpack --progress --config=webpack/webpack.prod.js" }, "files": [ - "dist" + "dist", + "src/less" ], "repository": { "type": "git", diff --git a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js index c0374b912..317104409 100644 --- a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -413,6 +413,7 @@ export class AbstractTreeValueChooser extends Widget { _reqInitTreeNode(op, callback) { let result = []; + const self = this; const keyword = op.keyword || ""; const selectedValues = op.selectedValues; const lastSearchValue = op.lastSearchValue || ""; // 一次请求100个,但是搜索是拿全部的,lastSearchValue是上一次遍历到的节点索引 @@ -425,8 +426,8 @@ export class AbstractTreeValueChooser extends Widget { }); }); - const search = () => { - const children = this._getChildren([]); + function search(){ + const children = self._getChildren([]); let start = children.length; if (lastSearchValue !== "") { for (let j = 0, len = start; j < len; j++) { @@ -441,22 +442,22 @@ export class AbstractTreeValueChooser extends Widget { const output = []; for (let i = start, len = children.length; i < len; i++) { let find; - if (output.length < this._const.perPage) { + if (output.length < self._const.perPage) { find = nodeSearch(1, [], children[i].value, false, result); - } else if (output.length === this._const.perPage) { + } else if (output.length === self._const.perPage) { find = nodeSearch(1, [], children[i].value, false, []); } if (find[0] === true) { output.push(children[i].value); } - if (output.length > this._const.perPage) { + if (output.length > self._const.perPage) { break; } } // 深层嵌套的比较麻烦,这边先实现的是在根节点添加 if (op.times === 1) { - const nodes = this._getAddedValueNode([], selectedValues); + const nodes = self._getAddedValueNode([], selectedValues); result = concat( filter(nodes, (idx, node) => { const find = Func.getSearchResult([node.text || node.value], keyword); @@ -470,8 +471,8 @@ export class AbstractTreeValueChooser extends Widget { return output; }; - const nodeSearch = (deep, parentValues, current, isAllSelect, result) => { - if (this._isMatch(parentValues, current, keyword)) { + function nodeSearch(deep, parentValues, current, isAllSelect, result) { + if (self._isMatch(parentValues, current, keyword)) { const checked = isAllSelect || isSelected(parentValues, current); createOneJson( parentValues, @@ -487,7 +488,7 @@ export class AbstractTreeValueChooser extends Widget { } const newParents = clone(parentValues); newParents.push(current); - const children = this._getChildren(newParents); + const children = self._getChildren(newParents); let can = false, checked = false; @@ -513,8 +514,8 @@ export class AbstractTreeValueChooser extends Widget { return [can, checked]; }; - const createOneJson = (parentValues, value, isOpen, checked, half, flag, result) => { - const node = this._getTreeNode(parentValues, value); + function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { + const node = self._getTreeNode(parentValues, value); result.push({ id: node.id, pId: node.pId, diff --git a/packages/fineui/webpack/webpack.dev.js b/packages/fineui/webpack/webpack.dev.js index a69e190ee..17fc5de6b 100644 --- a/packages/fineui/webpack/webpack.dev.js +++ b/packages/fineui/webpack/webpack.dev.js @@ -15,6 +15,6 @@ module.exports = merge(common, { devServer: { port: 9001, - liveReload: true, + // liveReload: true, }, });