Browse Source

REPORT-94961 fix:函数变量不能变量提升

es6
Treecat 2 years ago
parent
commit
cca17e808c
  1. 31
      README
  2. 5
      packages/fineui/package.json
  3. 23
      packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js
  4. 2
      packages/fineui/webpack/webpack.dev.js

31
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.

5
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",

23
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,

2
packages/fineui/webpack/webpack.dev.js

@ -15,6 +15,6 @@ module.exports = merge(common, {
devServer: {
port: 9001,
liveReload: true,
// liveReload: true,
},
});

Loading…
Cancel
Save