fan-standard-comp 3.2.11 → 3.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fan-standard-comp.umd.js +150 -150
- package/es/FormComp/FieldComponent/RefactorTreeSelect.d.ts +4 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +96 -221
- package/es/FormComp/FieldComponent/index.js +1 -1
- package/es/RefactorTree/util.d.ts +4 -3
- package/es/RefactorTree/util.js +52 -8
- package/es/hooks/use-language.d.ts +2 -0
- package/es/hooks/use-language.js +44 -0
- package/es/hooks/use-throttle.d.ts +1 -0
- package/es/hooks/use-throttle.js +33 -0
- package/es/locales/bn-BD/settings.d.ts +34 -0
- package/es/locales/bn-BD/settings.js +36 -0
- package/es/locales/bn-BD.d.ts +35 -0
- package/es/locales/bn-BD.js +4 -0
- package/es/locales/en-US/settings.d.ts +34 -0
- package/es/locales/en-US/settings.js +36 -0
- package/es/locales/en-US.d.ts +35 -0
- package/es/locales/en-US.js +4 -0
- package/es/locales/fa-IR/settings.d.ts +34 -0
- package/es/locales/fa-IR/settings.js +36 -0
- package/es/locales/fa-IR.d.ts +35 -0
- package/es/locales/fa-IR.js +4 -0
- package/es/locales/id-ID/settings.d.ts +34 -0
- package/es/locales/id-ID/settings.js +36 -0
- package/es/locales/id-ID.d.ts +35 -0
- package/es/locales/id-ID.js +4 -0
- package/es/locales/ja-JP/settings.d.ts +33 -0
- package/es/locales/ja-JP/settings.js +35 -0
- package/es/locales/ja-JP.d.ts +34 -0
- package/es/locales/ja-JP.js +4 -0
- package/es/locales/pt-BR/settings.d.ts +34 -0
- package/es/locales/pt-BR/settings.js +36 -0
- package/es/locales/pt-BR.d.ts +35 -0
- package/es/locales/pt-BR.js +4 -0
- package/es/locales/zh-CN/settings.d.ts +34 -0
- package/es/locales/zh-CN/settings.js +36 -0
- package/es/locales/zh-CN.d.ts +35 -0
- package/es/locales/zh-CN.js +4 -0
- package/es/locales/zh-TW/settings.d.ts +34 -0
- package/es/locales/zh-TW/settings.js +36 -0
- package/es/locales/zh-TW.d.ts +34 -0
- package/es/locales/zh-TW.js +2 -0
- package/es/utils/getParentNodes.d.ts +109 -0
- package/es/utils/getParentNodes.js +119 -20
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.d.ts +4 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +94 -218
- package/lib/FormComp/FieldComponent/index.js +1 -1
- package/lib/RefactorTree/util.d.ts +4 -3
- package/lib/RefactorTree/util.js +51 -9
- package/lib/hooks/use-language.d.ts +2 -0
- package/lib/hooks/use-language.js +51 -0
- package/lib/hooks/use-throttle.d.ts +1 -0
- package/lib/hooks/use-throttle.js +38 -0
- package/lib/locales/bn-BD/settings.d.ts +34 -0
- package/lib/locales/bn-BD/settings.js +42 -0
- package/lib/locales/bn-BD.d.ts +35 -0
- package/lib/locales/bn-BD.js +11 -0
- package/lib/locales/en-US/settings.d.ts +34 -0
- package/lib/locales/en-US/settings.js +42 -0
- package/lib/locales/en-US.d.ts +35 -0
- package/lib/locales/en-US.js +11 -0
- package/lib/locales/fa-IR/settings.d.ts +34 -0
- package/lib/locales/fa-IR/settings.js +42 -0
- package/lib/locales/fa-IR.d.ts +35 -0
- package/lib/locales/fa-IR.js +11 -0
- package/lib/locales/id-ID/settings.d.ts +34 -0
- package/lib/locales/id-ID/settings.js +42 -0
- package/lib/locales/id-ID.d.ts +35 -0
- package/lib/locales/id-ID.js +11 -0
- package/lib/locales/ja-JP/settings.d.ts +33 -0
- package/lib/locales/ja-JP/settings.js +41 -0
- package/lib/locales/ja-JP.d.ts +34 -0
- package/lib/locales/ja-JP.js +11 -0
- package/lib/locales/pt-BR/settings.d.ts +34 -0
- package/lib/locales/pt-BR/settings.js +42 -0
- package/lib/locales/pt-BR.d.ts +35 -0
- package/lib/locales/pt-BR.js +11 -0
- package/lib/locales/zh-CN/settings.d.ts +34 -0
- package/lib/locales/zh-CN/settings.js +42 -0
- package/lib/locales/zh-CN.d.ts +35 -0
- package/lib/locales/zh-CN.js +11 -0
- package/lib/locales/zh-TW/settings.d.ts +34 -0
- package/lib/locales/zh-TW/settings.js +42 -0
- package/lib/locales/zh-TW.d.ts +34 -0
- package/lib/locales/zh-TW.js +9 -0
- package/lib/utils/getParentNodes.d.ts +109 -0
- package/lib/utils/getParentNodes.js +118 -22
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
'navBar.lang': string;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// 筛选
|
|
3
|
+
'field.input.placeholder': '请输入',
|
|
4
|
+
'field.inputNumber.placeholder': '请输入数字',
|
|
5
|
+
'field.select.placeholder': '请选择',
|
|
6
|
+
'field.select.search.placeholder': '请输入选择',
|
|
7
|
+
'field.calendar.placeholder': '请选择',
|
|
8
|
+
'field.mentions.input.placeholder': '请输入',
|
|
9
|
+
'field.mentions.select.placeholder': '选择',
|
|
10
|
+
'field.upload.select': '点击选择',
|
|
11
|
+
'field.upload.import': '点击上传',
|
|
12
|
+
'filed.upload.limit.tips': '文件大小不能超过 ',
|
|
13
|
+
'filed.upload.limit.tips.prefix': '文件大小',
|
|
14
|
+
'filed.upload.limit.tips.postfix': '超过限制',
|
|
15
|
+
'filed.upload.fileType.tips': '文件类型不支持',
|
|
16
|
+
'filed.varTemplate.enter': '您已录入',
|
|
17
|
+
'filed.varTemplate.words': '个字',
|
|
18
|
+
'field.expand': '展开',
|
|
19
|
+
'field.collapse': '收起',
|
|
20
|
+
'filter.submit': '查询',
|
|
21
|
+
'filter.reset': '重置',
|
|
22
|
+
// 表格
|
|
23
|
+
'table.order': '序号',
|
|
24
|
+
'table.column.action': '操作',
|
|
25
|
+
'table.pagination.unit': '条',
|
|
26
|
+
'table.pagination.total': '共',
|
|
27
|
+
// 通用
|
|
28
|
+
'global.confirm.text': '确定',
|
|
29
|
+
'global.reset.text': '重置',
|
|
30
|
+
'global.cancel.text': '取消',
|
|
31
|
+
'global.empty.text': '暂无数据',
|
|
32
|
+
'global.prev.text': '上一步',
|
|
33
|
+
'global.next.text': '下一步',
|
|
34
|
+
'global.more.text': '更多',
|
|
35
|
+
'global.delete.confirm': '确定要删除'
|
|
36
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
'navBar.lang': string;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// 筛选
|
|
3
|
+
'field.input.placeholder': '请输入',
|
|
4
|
+
'field.inputNumber.placeholder': '请输入数字',
|
|
5
|
+
'field.select.placeholder': '请选择',
|
|
6
|
+
'field.select.search.placeholder': '请输入选择',
|
|
7
|
+
'field.calendar.placeholder': '请选择',
|
|
8
|
+
'field.mentions.input.placeholder': '请输入',
|
|
9
|
+
'field.mentions.select.placeholder': '选择',
|
|
10
|
+
'field.upload.select': '点击选择',
|
|
11
|
+
'field.upload.import': '点击上传',
|
|
12
|
+
'filed.upload.limit.tips': '文件大小不能超过 ',
|
|
13
|
+
'filed.upload.limit.tips.prefix': '文件大小',
|
|
14
|
+
'filed.upload.limit.tips.postfix': '超过限制',
|
|
15
|
+
'filed.upload.fileType.tips': '文件类型不支持',
|
|
16
|
+
'filed.varTemplate.enter': '您已录入',
|
|
17
|
+
'filed.varTemplate.words': '个字',
|
|
18
|
+
'field.expand': '展开',
|
|
19
|
+
'field.collapse': '收起',
|
|
20
|
+
'filter.submit': '查询',
|
|
21
|
+
'filter.reset': '重置',
|
|
22
|
+
// 表格
|
|
23
|
+
'table.order': '序号',
|
|
24
|
+
'table.column.action': '操作',
|
|
25
|
+
'table.pagination.unit': '条',
|
|
26
|
+
'table.pagination.total': '共',
|
|
27
|
+
// 通用
|
|
28
|
+
'global.confirm.text': '确定',
|
|
29
|
+
'global.reset.text': '重置',
|
|
30
|
+
'global.cancel.text': '取消',
|
|
31
|
+
'global.empty.text': '暂无数据',
|
|
32
|
+
'global.prev.text': '上一步',
|
|
33
|
+
'global.next.text': '下一步',
|
|
34
|
+
'global.more.text': '更多',
|
|
35
|
+
'global.delete.confirm': '确定要删除'
|
|
36
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'filed.upload.limit.tips': string;
|
|
12
|
+
'filed.upload.limit.tips.prefix': string;
|
|
13
|
+
'filed.upload.limit.tips.postfix': string;
|
|
14
|
+
'filed.upload.fileType.tips': string;
|
|
15
|
+
'filed.varTemplate.enter': string;
|
|
16
|
+
'filed.varTemplate.words': string;
|
|
17
|
+
'field.expand': string;
|
|
18
|
+
'field.collapse': string;
|
|
19
|
+
'filter.submit': string;
|
|
20
|
+
'filter.reset': string;
|
|
21
|
+
'table.order': string;
|
|
22
|
+
'table.column.action': string;
|
|
23
|
+
'table.pagination.unit': string;
|
|
24
|
+
'table.pagination.total': string;
|
|
25
|
+
'global.confirm.text': string;
|
|
26
|
+
'global.reset.text': string;
|
|
27
|
+
'global.cancel.text': string;
|
|
28
|
+
'global.empty.text': string;
|
|
29
|
+
'global.prev.text': string;
|
|
30
|
+
'global.next.text': string;
|
|
31
|
+
'global.more.text': string;
|
|
32
|
+
'global.delete.confirm': string;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 递归查看父级节点数据集合及当前节点数据
|
|
3
|
+
* @params {Array} list 当前需要过滤查看的数据集合、
|
|
4
|
+
* @params {String/Array} nodeKey 当前用于查找匹配数据的标识值
|
|
5
|
+
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
6
|
+
* (childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名),keyParam: 指当前匹配标识值字段名)
|
|
7
|
+
* @params {Object} extra
|
|
8
|
+
*
|
|
9
|
+
* @result {Array} nodeParent 当前传入nodeKey值所有上级别父级数据对象数组集合(倒序排列,根节点在最后一条)
|
|
10
|
+
* @result {Array} parentKeys 当前传入nodeKey值所有上级别父级数据关键字数据集合(keyParam)(倒序排列,根节点在最后一条)
|
|
11
|
+
* @result {Array} matchNode 当前传入nodeKey值所在的数据对象集合
|
|
12
|
+
* */
|
|
13
|
+
export declare const getParentNodes: (list: any[], nodeKey: string | number, params?: {
|
|
14
|
+
childrenParam: string;
|
|
15
|
+
keyParam: string;
|
|
16
|
+
}, extraProps?: any) => {
|
|
17
|
+
nodeParent: any[];
|
|
18
|
+
parentKeys: any[];
|
|
19
|
+
matchNode: any[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @description 递归查找指定节点的所有子菜单与子功能集合
|
|
23
|
+
* @params {Array} childNode 当前需要过滤查看的子数据集合、
|
|
24
|
+
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
25
|
+
* (childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名),keyParam: 指当前匹配标识值字段名)
|
|
26
|
+
* @params {Object} extra
|
|
27
|
+
*
|
|
28
|
+
* @result {Array} childKeys 所有子项的id
|
|
29
|
+
* @result {Array} nodeChildren 当前传入nodeKey值所在的数据对象集合
|
|
30
|
+
* */
|
|
31
|
+
export declare const getChildrenNodes: (childNode: any, params?: {
|
|
32
|
+
childrenParam: string;
|
|
33
|
+
keyParam: string;
|
|
34
|
+
}) => {
|
|
35
|
+
childKeys: any[];
|
|
36
|
+
nodeChildren: any[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @description 查找指定节点或节点集合的完整路径数据
|
|
40
|
+
* @params {Array} list 查询的数据源
|
|
41
|
+
* @params {Array | String | Number} nodeKey 需要查询的key集合
|
|
42
|
+
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
43
|
+
* (childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名),keyParam: 指当前匹配标识值字段名)
|
|
44
|
+
*
|
|
45
|
+
* @result {Array} 所有匹配到的层级数据(如果nodeKey是数组,则返回的节点集合会分别按顺序存到数组内
|
|
46
|
+
*
|
|
47
|
+
* */
|
|
48
|
+
export declare const getNodePaths: (list: any, nodeKey: any, params?: {
|
|
49
|
+
childrenParam: string;
|
|
50
|
+
keyParam: string;
|
|
51
|
+
}, extraProps?: any) => any[];
|
|
52
|
+
/**
|
|
53
|
+
* @description 查找节点数据:点击获取对应ID的完整数据(即从树数据中深层查找与ID值相匹配的相关数据对象)
|
|
54
|
+
*
|
|
55
|
+
* @param [array] list 需要过滤的数据
|
|
56
|
+
* @param [string] key 指定过滤的key值
|
|
57
|
+
* @param [Object] optionName 指定value与children相关字段名
|
|
58
|
+
*
|
|
59
|
+
* @data list:<array:[{ value: '', label: '', children: []}]> 列表数据格式
|
|
60
|
+
*/
|
|
61
|
+
export declare const getNode: (list: any[], key?: string | number, optionName?: {
|
|
62
|
+
value: string;
|
|
63
|
+
children: string;
|
|
64
|
+
}) => {};
|
|
65
|
+
/**
|
|
66
|
+
* 数组转树形结构
|
|
67
|
+
* @param {array} list 被转换的数组
|
|
68
|
+
* @param {number|string} root 根节点(最外层节点)的 id
|
|
69
|
+
* @param {object} params 字段值(默认 { keyParam: 'id', parentParam: 'parentId' })
|
|
70
|
+
* @return array
|
|
71
|
+
*/
|
|
72
|
+
export declare const arrayToTree: (list: any, rootId: any, { keyParam, parentParam, childrenParam }?: {
|
|
73
|
+
keyParam?: string;
|
|
74
|
+
parentParam?: string;
|
|
75
|
+
childrenParam?: string;
|
|
76
|
+
}) => any[];
|
|
77
|
+
/**
|
|
78
|
+
* 多根树转换成数组
|
|
79
|
+
* @param {array} tree 被转换的树(仅限于只有一个根的树
|
|
80
|
+
* @return array
|
|
81
|
+
*/
|
|
82
|
+
export declare const convertToArray: (tree: any, { keyParam, parentParam, childrenParam }?: {
|
|
83
|
+
keyParam?: string;
|
|
84
|
+
parentParam?: string;
|
|
85
|
+
childrenParam?: string;
|
|
86
|
+
}) => any[];
|
|
87
|
+
/**
|
|
88
|
+
* 树过滤(默认按名称过滤,也可按指定的字段名过滤)
|
|
89
|
+
* @param {array} list 需要过滤的树
|
|
90
|
+
* @param {string | number} nodeKey 需要筛选的名称(默认搜索名称,如果需要指定其他字段值,则参数传object
|
|
91
|
+
* @param {object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
92
|
+
* @value { childrenParam: 'children', keyParam: 'name' } childrenParam:指当前子集合数据字段名,keyParam: 指当前匹配标识值字段名)
|
|
93
|
+
*
|
|
94
|
+
* @return array 返回新的数组
|
|
95
|
+
* */
|
|
96
|
+
export declare const filterTreeNodes: (list: any[], nodeKey: string | number, params?: {
|
|
97
|
+
childrenParam: string;
|
|
98
|
+
keyParam: string;
|
|
99
|
+
}) => any;
|
|
100
|
+
/**
|
|
101
|
+
* @param {Array} data 树数组数据
|
|
102
|
+
* @param {Number} level 起始层级序号
|
|
103
|
+
* @param {Number} level 起始层级序号
|
|
104
|
+
* @param {Array} parentIndexPath 父级序号集合
|
|
105
|
+
* @param {Array} parentNamePath 父级名称集合
|
|
106
|
+
* @param {Object} optionName 指定字段名 {children: '', label: '', title: '', name: ''}
|
|
107
|
+
* @param {Object} extra 扩展配置 {separator: '/'}
|
|
108
|
+
* */
|
|
109
|
+
export declare const addTreeLevels: (data: any, level: number, parentIndexPath: any[], parentNamePath: any[], optionName: any, extra: any) => any[];
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
2
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
4
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
9
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
// @ts-nocheck
|
|
7
12
|
/**
|
|
8
13
|
* @description 递归查看父级节点数据集合及当前节点数据
|
|
9
14
|
* @params {Array} list 当前需要过滤查看的数据集合、
|
|
@@ -84,7 +89,6 @@ export var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
84
89
|
}
|
|
85
90
|
return matchNode; // 返回查找到的节点数据(格式为数组)
|
|
86
91
|
};
|
|
87
|
-
|
|
88
92
|
// 查找单个节点
|
|
89
93
|
var _findMatchItem = function findMatchItem(arrList, key) {
|
|
90
94
|
var matchItem;
|
|
@@ -120,10 +124,9 @@ export var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
120
124
|
matchNode: matchNode
|
|
121
125
|
}; // 最终查找到的父节点数组 // nodeParent.concat(result || []);
|
|
122
126
|
};
|
|
123
|
-
|
|
124
127
|
/**
|
|
125
|
-
* @description
|
|
126
|
-
* @params {Array} childNode
|
|
128
|
+
* @description 递归查找指定节点的所有子菜单与子功能集合
|
|
129
|
+
* @params {Array} childNode 当前需要过滤查看的子数据集合、
|
|
127
130
|
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
128
131
|
* (childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名),keyParam: 指当前匹配标识值字段名)
|
|
129
132
|
* @params {Object} extra
|
|
@@ -131,7 +134,6 @@ export var getParentNodes = function getParentNodes(list, nodeKey) {
|
|
|
131
134
|
* @result {Array} childKeys 所有子项的id
|
|
132
135
|
* @result {Array} nodeChildren 当前传入nodeKey值所在的数据对象集合
|
|
133
136
|
* */
|
|
134
|
-
|
|
135
137
|
export var getChildrenNodes = function getChildrenNodes(childNode) {
|
|
136
138
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
137
139
|
childrenParam: 'children',
|
|
@@ -152,15 +154,15 @@ export var getChildrenNodes = function getChildrenNodes(childNode) {
|
|
|
152
154
|
nodeChildren: nodeChildren
|
|
153
155
|
};
|
|
154
156
|
};
|
|
155
|
-
|
|
156
157
|
/**
|
|
157
|
-
* @description
|
|
158
|
+
* @description 查找指定节点或节点集合的完整路径数据
|
|
158
159
|
* @params {Array} list 查询的数据源
|
|
159
|
-
* @params {Array} nodeKey 需要查询的key集合
|
|
160
|
+
* @params {Array | String | Number} nodeKey 需要查询的key集合
|
|
160
161
|
* @params {Object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
161
162
|
* (childrenParam:指当前子集合数据字段名(字符串表示单个,数组表示当前多个子集合字段名),keyParam: 指当前匹配标识值字段名)
|
|
162
163
|
*
|
|
163
|
-
* @result {Array} 所有匹配到的层级数据
|
|
164
|
+
* @result {Array} 所有匹配到的层级数据(如果nodeKey是数组,则返回的节点集合会分别按顺序存到数组内
|
|
165
|
+
*
|
|
164
166
|
* */
|
|
165
167
|
export var getNodePaths = function getNodePaths(list, nodeKey) {
|
|
166
168
|
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
@@ -189,7 +191,6 @@ export var getNodePaths = function getNodePaths(list, nodeKey) {
|
|
|
189
191
|
nodePathArray.pop();
|
|
190
192
|
}
|
|
191
193
|
};
|
|
192
|
-
|
|
193
194
|
// 用于存储节点唯一标识值路径数组
|
|
194
195
|
var nodePathArray = [];
|
|
195
196
|
try {
|
|
@@ -206,17 +207,42 @@ export var getNodePaths = function getNodePaths(list, nodeKey) {
|
|
|
206
207
|
var pathItems = getPathByKey(key, list);
|
|
207
208
|
if (pathItems) pathNode.push(pathItems);
|
|
208
209
|
});
|
|
210
|
+
} else if (typeof nodeKey === 'string') {
|
|
211
|
+
var pathItems = getPathByKey(nodeKey, list);
|
|
212
|
+
pathNode = pathItems || [];
|
|
209
213
|
}
|
|
210
214
|
return pathNode;
|
|
211
215
|
};
|
|
212
|
-
|
|
213
216
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @param
|
|
217
|
-
* @param
|
|
218
|
-
* @
|
|
217
|
+
* @description 查找节点数据:点击获取对应ID的完整数据(即从树数据中深层查找与ID值相匹配的相关数据对象)
|
|
218
|
+
*
|
|
219
|
+
* @param [array] list 需要过滤的数据
|
|
220
|
+
* @param [string] key 指定过滤的key值
|
|
221
|
+
* @param [Object] optionName 指定value与children相关字段名
|
|
222
|
+
*
|
|
223
|
+
* @data list:<array:[{ value: '', label: '', children: []}]> 列表数据格式
|
|
219
224
|
*/
|
|
225
|
+
export var getNode = function getNode(list, key) {
|
|
226
|
+
var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
227
|
+
value: 'value',
|
|
228
|
+
children: 'children'
|
|
229
|
+
};
|
|
230
|
+
var matchCurrentItem = {};
|
|
231
|
+
// 深层过滤当前选中的节点
|
|
232
|
+
var _deepFilterMatchItem = function deepFilterMatchItem(treeData, targetId) {
|
|
233
|
+
(treeData || []).some(function (item) {
|
|
234
|
+
if (item[optionName.value] == targetId) {
|
|
235
|
+
matchCurrentItem = item;
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
if (item[optionName.children]) {
|
|
239
|
+
_deepFilterMatchItem(item[optionName.children], targetId); // 没有查找到继续过滤
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
_deepFilterMatchItem(list, key);
|
|
244
|
+
return matchCurrentItem;
|
|
245
|
+
};
|
|
220
246
|
/**
|
|
221
247
|
* 数组转树形结构
|
|
222
248
|
* @param {array} list 被转换的数组
|
|
@@ -261,7 +287,7 @@ export var convertToArray = function convertToArray(tree) {
|
|
|
261
287
|
tree.forEach(function (item) {
|
|
262
288
|
var _loop = function loop(data) {
|
|
263
289
|
sortCount++;
|
|
264
|
-
result.push(
|
|
290
|
+
result.push(Object.assign(Object.assign({}, data), {
|
|
265
291
|
sort: sortCount
|
|
266
292
|
}));
|
|
267
293
|
var child = data[childrenParam];
|
|
@@ -274,4 +300,77 @@ export var convertToArray = function convertToArray(tree) {
|
|
|
274
300
|
_loop(item);
|
|
275
301
|
});
|
|
276
302
|
return result;
|
|
277
|
-
};
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* 树过滤(默认按名称过滤,也可按指定的字段名过滤)
|
|
306
|
+
* @param {array} list 需要过滤的树
|
|
307
|
+
* @param {string | number} nodeKey 需要筛选的名称(默认搜索名称,如果需要指定其他字段值,则参数传object
|
|
308
|
+
* @param {object} params 指定当前数据中,筛选对应子集合字段名及匹配标识值字段名
|
|
309
|
+
* @value { childrenParam: 'children', keyParam: 'name' } childrenParam:指当前子集合数据字段名,keyParam: 指当前匹配标识值字段名)
|
|
310
|
+
*
|
|
311
|
+
* @return array 返回新的数组
|
|
312
|
+
* */
|
|
313
|
+
var _filterTreeNodes = function filterTreeNodes(list, nodeKey) {
|
|
314
|
+
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
315
|
+
childrenParam: 'children',
|
|
316
|
+
keyParam: 'name'
|
|
317
|
+
};
|
|
318
|
+
var result = [];
|
|
319
|
+
var filterList = _toConsumableArray(list);
|
|
320
|
+
filterList.forEach(function (item) {
|
|
321
|
+
var nItem = null;
|
|
322
|
+
if (item[params.keyParam || 'name'].toLowerCase().includes(nodeKey.toLowerCase())) {
|
|
323
|
+
nItem = Object.assign(Object.assign({}, item), _defineProperty({}, params.childrenParam || 'children', []));
|
|
324
|
+
}
|
|
325
|
+
if (item[params.childrenParam || 'children'] && item[params.childrenParam || 'children'].length) {
|
|
326
|
+
var subList = _filterTreeNodes(item[params.childrenParam || 'children'], nodeKey, params);
|
|
327
|
+
if (subList.length) {
|
|
328
|
+
nItem = Object.assign(Object.assign({}, item), _defineProperty({}, params.childrenParam || 'children', subList));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (nItem) {
|
|
332
|
+
result.push(nItem);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
return result;
|
|
336
|
+
};
|
|
337
|
+
// 给节点每个层级加上level,并且将当前节点完整的路径序号值拼接起来
|
|
338
|
+
/**
|
|
339
|
+
* @param {Array} data 树数组数据
|
|
340
|
+
* @param {Number} level 起始层级序号
|
|
341
|
+
* @param {Number} level 起始层级序号
|
|
342
|
+
* @param {Array} parentIndexPath 父级序号集合
|
|
343
|
+
* @param {Array} parentNamePath 父级名称集合
|
|
344
|
+
* @param {Object} optionName 指定字段名 {children: '', label: '', title: '', name: ''}
|
|
345
|
+
* @param {Object} extra 扩展配置 {separator: '/'}
|
|
346
|
+
* */
|
|
347
|
+
export { _filterTreeNodes as filterTreeNodes };
|
|
348
|
+
var _addTreeLevels = function addTreeLevels(data) {
|
|
349
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
350
|
+
var parentIndexPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
351
|
+
var parentNamePath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
352
|
+
var optionName = arguments.length > 4 ? arguments[4] : undefined;
|
|
353
|
+
var extra = arguments.length > 5 ? arguments[5] : undefined;
|
|
354
|
+
if (!Array.isArray(data)) return [];
|
|
355
|
+
return data.map(function (item, index) {
|
|
356
|
+
// 创建当前节点副本
|
|
357
|
+
// 完整的名称路径
|
|
358
|
+
var fullNamePath = _toConsumableArray(parentNamePath).concat(item[(optionName === null || optionName === void 0 ? void 0 : optionName.title) || (optionName === null || optionName === void 0 ? void 0 : optionName.label) || 'label' || 'title'] ? [item[(optionName === null || optionName === void 0 ? void 0 : optionName.title) || (optionName === null || optionName === void 0 ? void 0 : optionName.label) || 'label' || 'title']] : []);
|
|
359
|
+
var node = Object.assign(Object.assign({}, item), {
|
|
360
|
+
treeNodeLevel: level,
|
|
361
|
+
treeParentIndexPath: _toConsumableArray(parentIndexPath),
|
|
362
|
+
treeParentNamePath: _toConsumableArray(parentNamePath),
|
|
363
|
+
treeFullLevelNamePath: fullNamePath,
|
|
364
|
+
treeFullLevelName: fullNamePath.join((extra === null || extra === void 0 ? void 0 : extra.separator) || '/')
|
|
365
|
+
});
|
|
366
|
+
// 当前节点的完整路径(用于构建子节点的父级路径)
|
|
367
|
+
var currentIndexPath = [].concat(_toConsumableArray(parentIndexPath), [index]);
|
|
368
|
+
var currentNamePath = [].concat(_toConsumableArray(parentNamePath), [item[(optionName === null || optionName === void 0 ? void 0 : optionName.title) || (optionName === null || optionName === void 0 ? void 0 : optionName.label) || 'label' || 'title']]);
|
|
369
|
+
// 递归处理子节点
|
|
370
|
+
if (Array.isArray(node[(optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children']) && node[(optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children'].length > 0) {
|
|
371
|
+
node[(optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children'] = _addTreeLevels(node[(optionName === null || optionName === void 0 ? void 0 : optionName.children) || 'children'], level + 1, currentIndexPath, currentNamePath, optionName, extra);
|
|
372
|
+
}
|
|
373
|
+
return node;
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
export { _addTreeLevels as addTreeLevels };
|