@yelon/util 12.0.13 → 12.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/array/array-type.service.d.ts +68 -68
  4. package/array/array.service.d.ts +75 -75
  5. package/array/index.d.ts +2 -2
  6. package/array/yelon-util-array.d.ts +4 -4
  7. package/array/yelon-util-array.metadata.json +1 -1
  8. package/browser/browser.d.ts +4 -4
  9. package/browser/cookie.service.d.ts +64 -64
  10. package/browser/copy.d.ts +6 -6
  11. package/browser/index.d.ts +5 -5
  12. package/browser/is-empty.d.ts +6 -6
  13. package/browser/scroll.service.d.ts +34 -34
  14. package/browser/style.d.ts +21 -21
  15. package/bundles/browser.umd.js +275 -275
  16. package/bundles/yelon-util-array.umd.js +606 -606
  17. package/bundles/yelon-util-array.umd.js.map +1 -1
  18. package/bundles/yelon-util-config.umd.js +366 -366
  19. package/bundles/yelon-util-date-time.umd.js +216 -216
  20. package/bundles/yelon-util-decorator.umd.js +437 -437
  21. package/bundles/yelon-util-form.umd.js +116 -116
  22. package/bundles/yelon-util-format.umd.js +726 -726
  23. package/bundles/yelon-util-math.umd.js +83 -83
  24. package/bundles/yelon-util-other.umd.js +652 -656
  25. package/bundles/yelon-util-other.umd.js.map +1 -1
  26. package/bundles/yelon-util-pipes-currency.umd.js +83 -83
  27. package/bundles/yelon-util-pipes-filter.umd.js +353 -353
  28. package/bundles/yelon-util-pipes-format.umd.js +47 -47
  29. package/bundles/yelon-util-pipes.umd.js +7 -7
  30. package/bundles/yelon-util-token.umd.js +30 -30
  31. package/bundles/yelon-util.umd.js +7 -7
  32. package/config/abc/date-picker.type.d.ts +52 -52
  33. package/config/abc/error-collect.type.d.ts +10 -10
  34. package/config/abc/image.type.d.ts +15 -15
  35. package/config/abc/index.d.ts +16 -16
  36. package/config/abc/loading.type.d.ts +31 -31
  37. package/config/abc/lodop.type.d.ts +33 -33
  38. package/config/abc/media.type.d.ts +11 -11
  39. package/config/abc/onboarding.type.d.ts +4 -4
  40. package/config/abc/page-header.type.d.ts +39 -39
  41. package/config/abc/pdf.type.d.ts +35 -35
  42. package/config/abc/qr.type.d.ts +25 -25
  43. package/config/abc/se.type.d.ts +32 -32
  44. package/config/abc/sg.type.d.ts +10 -10
  45. package/config/abc/st.type.d.ts +427 -431
  46. package/config/abc/sv.type.d.ts +14 -14
  47. package/config/abc/xlsx.type.d.ts +12 -12
  48. package/config/abc/zip.type.d.ts +10 -10
  49. package/config/acl/acl.type.d.ts +32 -32
  50. package/config/auth/auth.type.d.ts +55 -55
  51. package/config/bis/bis.type.d.ts +7 -7
  52. package/config/cache/cache.type.d.ts +40 -40
  53. package/config/chart/chart.type.d.ts +33 -33
  54. package/config/config.service.d.ts +10 -10
  55. package/config/config.types.d.ts +49 -49
  56. package/config/index.d.ts +14 -14
  57. package/config/mock/mock.type.d.ts +18 -18
  58. package/config/sf/sf.type.d.ts +127 -127
  59. package/config/stomp/stomp.type.d.ts +2 -2
  60. package/config/theme/http.type.d.ts +14 -14
  61. package/config/theme/i18n.type.d.ts +8 -8
  62. package/config/theme/index.d.ts +3 -3
  63. package/config/theme/responsive.type.d.ts +12 -12
  64. package/config/util/array.type.d.ts +22 -22
  65. package/config/util/currency.type.d.ts +39 -39
  66. package/config/yelon-util-config.d.ts +4 -4
  67. package/date-time/index.d.ts +2 -2
  68. package/date-time/picker.d.ts +68 -68
  69. package/date-time/time.d.ts +26 -26
  70. package/date-time/yelon-util-date-time.d.ts +4 -4
  71. package/decorator/convert.d.ts +24 -24
  72. package/decorator/index.d.ts +2 -2
  73. package/decorator/yelon-util-decorator.d.ts +4 -4
  74. package/decorator/zone-outside.d.ts +35 -35
  75. package/esm2015/array/array-type.service.js +1 -1
  76. package/esm2015/array/array.service.js +250 -250
  77. package/esm2015/array/index.js +2 -2
  78. package/esm2015/array/yelon-util-array.js +4 -4
  79. package/esm2015/browser/browser.js +4 -4
  80. package/esm2015/browser/cookie.service.js +103 -103
  81. package/esm2015/browser/copy.js +26 -26
  82. package/esm2015/browser/index.js +5 -5
  83. package/esm2015/browser/is-empty.js +18 -18
  84. package/esm2015/browser/scroll.service.js +88 -88
  85. package/esm2015/browser/style.js +37 -37
  86. package/esm2015/config/abc/date-picker.type.js +1 -1
  87. package/esm2015/config/abc/error-collect.type.js +1 -1
  88. package/esm2015/config/abc/image.type.js +1 -1
  89. package/esm2015/config/abc/index.js +16 -16
  90. package/esm2015/config/abc/loading.type.js +1 -1
  91. package/esm2015/config/abc/lodop.type.js +1 -1
  92. package/esm2015/config/abc/media.type.js +1 -1
  93. package/esm2015/config/abc/onboarding.type.js +1 -1
  94. package/esm2015/config/abc/page-header.type.js +1 -1
  95. package/esm2015/config/abc/pdf.type.js +1 -1
  96. package/esm2015/config/abc/qr.type.js +1 -1
  97. package/esm2015/config/abc/se.type.js +1 -1
  98. package/esm2015/config/abc/sg.type.js +1 -1
  99. package/esm2015/config/abc/st.type.js +2 -2
  100. package/esm2015/config/abc/sv.type.js +2 -2
  101. package/esm2015/config/abc/xlsx.type.js +1 -1
  102. package/esm2015/config/abc/zip.type.js +1 -1
  103. package/esm2015/config/acl/acl.type.js +1 -1
  104. package/esm2015/config/auth/auth.type.js +1 -1
  105. package/esm2015/config/bis/bis.type.js +1 -1
  106. package/esm2015/config/cache/cache.type.js +1 -1
  107. package/esm2015/config/chart/chart.type.js +1 -1
  108. package/esm2015/config/config.service.js +33 -33
  109. package/esm2015/config/config.types.js +8 -8
  110. package/esm2015/config/index.js +14 -14
  111. package/esm2015/config/mock/mock.type.js +1 -1
  112. package/esm2015/config/sf/sf.type.js +1 -1
  113. package/esm2015/config/stomp/stomp.type.js +1 -1
  114. package/esm2015/config/theme/http.type.js +1 -1
  115. package/esm2015/config/theme/i18n.type.js +1 -1
  116. package/esm2015/config/theme/index.js +3 -3
  117. package/esm2015/config/theme/responsive.type.js +1 -1
  118. package/esm2015/config/util/array.type.js +1 -1
  119. package/esm2015/config/util/currency.type.js +1 -1
  120. package/esm2015/config/yelon-util-config.js +4 -4
  121. package/esm2015/date-time/index.js +2 -2
  122. package/esm2015/date-time/picker.js +115 -115
  123. package/esm2015/date-time/time.js +83 -83
  124. package/esm2015/date-time/yelon-util-date-time.js +4 -4
  125. package/esm2015/decorator/convert.js +55 -55
  126. package/esm2015/decorator/index.js +2 -2
  127. package/esm2015/decorator/yelon-util-decorator.js +4 -4
  128. package/esm2015/decorator/zone-outside.js +54 -54
  129. package/esm2015/form/index.js +2 -2
  130. package/esm2015/form/match-control.js +29 -29
  131. package/esm2015/form/validators.js +80 -80
  132. package/esm2015/form/yelon-util-form.js +4 -4
  133. package/esm2015/format/currency.service.js +224 -224
  134. package/esm2015/format/currency.types.js +7 -7
  135. package/esm2015/format/index.js +4 -4
  136. package/esm2015/format/string.js +75 -75
  137. package/esm2015/format/validate.js +93 -93
  138. package/esm2015/format/yelon-util-format.js +4 -4
  139. package/esm2015/index.js +11 -11
  140. package/esm2015/math/in-range.js +24 -24
  141. package/esm2015/math/index.js +2 -2
  142. package/esm2015/math/round.js +52 -52
  143. package/esm2015/math/yelon-util-math.js +4 -4
  144. package/esm2015/other/assert.js +66 -66
  145. package/esm2015/other/deep.js +76 -76
  146. package/esm2015/other/index.js +4 -4
  147. package/esm2015/other/lazy.service.js +118 -118
  148. package/esm2015/other/logger.js +33 -36
  149. package/esm2015/other/yelon-util-other.js +4 -4
  150. package/esm2015/pipes/currency/cny.pipe.js +21 -21
  151. package/esm2015/pipes/currency/index.js +3 -3
  152. package/esm2015/pipes/currency/mega.pipe.js +25 -25
  153. package/esm2015/pipes/currency/module.js +13 -13
  154. package/esm2015/pipes/currency/price.pipe.js +25 -25
  155. package/esm2015/pipes/currency/yelon-util-pipes-currency.js +5 -5
  156. package/esm2015/pipes/filter/filter.pipe.js +14 -14
  157. package/esm2015/pipes/filter/index.js +2 -2
  158. package/esm2015/pipes/filter/module.js +11 -11
  159. package/esm2015/pipes/filter/yelon-util-pipes-filter.js +4 -4
  160. package/esm2015/pipes/format/index.js +2 -2
  161. package/esm2015/pipes/format/mask.pipe.js +29 -29
  162. package/esm2015/pipes/format/module.js +11 -11
  163. package/esm2015/pipes/format/yelon-util-pipes-format.js +4 -4
  164. package/esm2015/pipes/index.js +3 -3
  165. package/esm2015/pipes/yelon-util-pipes.js +4 -4
  166. package/esm2015/token/index.js +2 -2
  167. package/esm2015/token/page-visibility.js +15 -15
  168. package/esm2015/token/window.js +16 -16
  169. package/esm2015/token/yelon-util-token.js +4 -4
  170. package/esm2015/yelon-util.js +4 -4
  171. package/fesm2015/browser.js +257 -257
  172. package/fesm2015/yelon-util-array.js +246 -246
  173. package/fesm2015/yelon-util-array.js.map +1 -1
  174. package/fesm2015/yelon-util-config.js +36 -36
  175. package/fesm2015/yelon-util-date-time.js +196 -196
  176. package/fesm2015/yelon-util-decorator.js +107 -107
  177. package/fesm2015/yelon-util-form.js +108 -108
  178. package/fesm2015/yelon-util-format.js +390 -390
  179. package/fesm2015/yelon-util-math.js +75 -75
  180. package/fesm2015/yelon-util-other.js +281 -284
  181. package/fesm2015/yelon-util-other.js.map +1 -1
  182. package/fesm2015/yelon-util-pipes-currency.js +72 -72
  183. package/fesm2015/yelon-util-pipes-filter.js +22 -22
  184. package/fesm2015/yelon-util-pipes-format.js +36 -36
  185. package/fesm2015/yelon-util-pipes.js +2 -2
  186. package/fesm2015/yelon-util-token.js +25 -25
  187. package/fesm2015/yelon-util.js +2 -2
  188. package/form/index.d.ts +2 -2
  189. package/form/match-control.d.ts +15 -15
  190. package/form/validators.d.ts +62 -62
  191. package/form/yelon-util-form.d.ts +4 -4
  192. package/format/currency.service.d.ts +34 -34
  193. package/format/currency.types.d.ts +77 -77
  194. package/format/index.d.ts +4 -4
  195. package/format/string.d.ts +44 -44
  196. package/format/validate.d.ts +72 -72
  197. package/format/yelon-util-format.d.ts +4 -4
  198. package/index.d.ts +11 -11
  199. package/math/in-range.d.ts +14 -14
  200. package/math/index.d.ts +2 -2
  201. package/math/round.d.ts +33 -33
  202. package/math/yelon-util-math.d.ts +4 -4
  203. package/other/assert.d.ts +36 -36
  204. package/other/deep.d.ts +33 -33
  205. package/other/index.d.ts +4 -4
  206. package/other/lazy.service.d.ts +22 -22
  207. package/other/logger.d.ts +5 -6
  208. package/other/yelon-util-other.d.ts +4 -4
  209. package/other/yelon-util-other.metadata.json +1 -1
  210. package/package.json +1 -1
  211. package/pipes/currency/cny.pipe.d.ts +12 -12
  212. package/pipes/currency/index.d.ts +3 -3
  213. package/pipes/currency/mega.pipe.d.ts +13 -13
  214. package/pipes/currency/module.d.ts +2 -2
  215. package/pipes/currency/price.pipe.d.ts +16 -16
  216. package/pipes/currency/yelon-util-pipes-currency.d.ts +5 -5
  217. package/pipes/filter/filter.pipe.d.ts +10 -10
  218. package/pipes/filter/index.d.ts +2 -2
  219. package/pipes/filter/module.d.ts +2 -2
  220. package/pipes/filter/yelon-util-pipes-filter.d.ts +4 -4
  221. package/pipes/format/index.d.ts +2 -2
  222. package/pipes/format/mask.pipe.d.ts +24 -24
  223. package/pipes/format/module.d.ts +2 -2
  224. package/pipes/format/yelon-util-pipes-format.d.ts +4 -4
  225. package/pipes/index.d.ts +3 -3
  226. package/pipes/yelon-util-pipes.d.ts +4 -4
  227. package/token/index.d.ts +2 -2
  228. package/token/page-visibility.d.ts +8 -8
  229. package/token/window.d.ts +7 -7
  230. package/token/yelon-util-token.d.ts +4 -4
  231. package/yelon-util.d.ts +4 -4
@@ -1,256 +1,256 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import { NzTreeNode } from 'ng-zorro-antd/core/tree';
4
3
  import * as i1 from '@yelon/util/config';
5
4
  import { YunzaiConfigService } from '@yelon/util/config';
5
+ import { NzTreeNode } from 'ng-zorro-antd/core/tree';
6
6
 
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- class ArrayService {
9
- constructor(cog) {
10
- this.c = cog.merge('utilArray', {
11
- deepMapName: 'deep',
12
- parentMapName: 'parent',
13
- idMapName: 'id',
14
- parentIdMapName: 'parent_id',
15
- childrenMapName: 'children',
16
- titleMapName: 'title',
17
- checkedMapname: 'checked',
18
- selectedMapname: 'selected',
19
- expandedMapname: 'expanded',
20
- disabledMapname: 'disabled'
21
- });
22
- }
23
- /**
24
- * Convert tree structure to array structure
25
- *
26
- * 将树结构转换成数组结构
27
- */
28
- treeToArr(tree, options) {
29
- const opt = Object.assign({ deepMapName: this.c.deepMapName, parentMapName: this.c.parentMapName, childrenMapName: this.c.childrenMapName, clearChildren: true, cb: null }, options);
30
- const result = [];
31
- const inFn = (list, parent, deep = 0) => {
32
- for (const i of list) {
33
- i[opt.deepMapName] = deep;
34
- i[opt.parentMapName] = parent;
35
- if (opt.cb) {
36
- opt.cb(i, parent, deep);
37
- }
38
- result.push(i);
39
- const children = i[opt.childrenMapName];
40
- if (children != null && Array.isArray(children) && children.length > 0) {
41
- inFn(children, i, deep + 1);
42
- }
43
- if (opt.clearChildren) {
44
- delete i[opt.childrenMapName];
45
- }
46
- }
47
- };
48
- inFn(tree, null);
49
- return result;
50
- }
51
- /**
52
- * Convert array structure to tree structure
53
- *
54
- * 数组转换成树数据
55
- */
56
- arrToTree(arr, options) {
57
- if (!Array.isArray(arr) || arr.length === 0) {
58
- return [];
59
- }
60
- const opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, childrenMapName: this.c.childrenMapName, cb: null }, options);
61
- const tree = [];
62
- const childrenOf = {};
63
- let rootPid = opt.rootParentIdValue;
64
- const arrType = arr;
65
- if (!rootPid) {
66
- const pids = arrType.map(i => i[opt.parentIdMapName]);
67
- const emptyPid = pids.findIndex(w => w == null);
68
- rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];
69
- }
70
- for (const item of arrType) {
71
- const id = item[opt.idMapName];
72
- const pid = item[opt.parentIdMapName];
73
- childrenOf[id] = childrenOf[id] || [];
74
- item[opt.childrenMapName] = childrenOf[id];
75
- if (opt.cb) {
76
- opt.cb(item);
77
- }
78
- if (pid !== rootPid) {
79
- childrenOf[pid] = childrenOf[pid] || [];
80
- childrenOf[pid].push(item);
81
- }
82
- else {
83
- tree.push(item);
84
- }
85
- }
86
- return tree;
87
- }
88
- /**
89
- * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
90
- */
91
- arrToTreeNode(arr, options) {
92
- const opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, titleMapName: this.c.titleMapName, isLeafMapName: 'isLeaf', checkedMapname: this.c.checkedMapname, selectedMapname: this.c.selectedMapname, expandedMapname: this.c.expandedMapname, disabledMapname: this.c.disabledMapname, cb: null }, options);
93
- const tree = this.arrToTree(arr, {
94
- idMapName: opt.idMapName,
95
- parentIdMapName: opt.parentIdMapName,
96
- childrenMapName: 'children'
97
- });
98
- this.visitTree(tree, (item, parent, deep) => {
99
- item.key = item[opt.idMapName];
100
- item.title = item[opt.titleMapName];
101
- item.checked = item[opt.checkedMapname];
102
- item.selected = item[opt.selectedMapname];
103
- item.expanded = item[opt.expandedMapname];
104
- item.disabled = item[opt.disabledMapname];
105
- if (item[opt.isLeafMapName] == null) {
106
- item.isLeaf = item.children.length === 0;
107
- }
108
- else {
109
- item.isLeaf = item[opt.isLeafMapName];
110
- }
111
- if (opt.cb) {
112
- opt.cb(item, parent, deep);
113
- }
114
- });
115
- return tree.map(node => new NzTreeNode(node));
116
- }
117
- /**
118
- * 递归访问整个树
119
- */
120
- visitTree(tree, cb, options) {
121
- options = Object.assign({ childrenMapName: this.c.childrenMapName }, options);
122
- const inFn = (data, parent, deep) => {
123
- for (const item of data) {
124
- cb(item, parent, deep);
125
- const childrenVal = item[options.childrenMapName];
126
- if (Array.isArray(childrenVal) && childrenVal.length > 0) {
127
- inFn(childrenVal, item, deep + 1);
128
- }
129
- }
130
- };
131
- inFn(tree, null, 1);
132
- }
133
- /**
134
- * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
135
- *
136
- * 根据条件返回树的第一个值,否则返回 `undefined`
137
- */
138
- findTree(tree, predicate, options) {
139
- let res;
140
- this.visitTree(tree, item => {
141
- if (res === undefined && predicate(item)) {
142
- res = item;
143
- }
144
- }, options);
145
- return res;
146
- }
147
- /**
148
- * 获取所有已经选中的 `key` 值
149
- */
150
- getKeysByTreeNode(tree, options) {
151
- const opt = Object.assign({ includeHalfChecked: true }, options);
152
- const keys = [];
153
- this.visitTree(tree, (item, parent, deep) => {
154
- if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {
155
- keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);
156
- }
157
- });
158
- return keys;
159
- }
160
- baseFlat(array, depth, result = []) {
161
- let index = -1;
162
- while (++index < array.length) {
163
- const value = array[index];
164
- if (depth > 0 && Array.isArray(value)) {
165
- if (depth > 1) {
166
- this.baseFlat(value, depth - 1, result);
167
- }
168
- else {
169
- let pushIndex = -1;
170
- const offset = result.length;
171
- while (++pushIndex < value.length) {
172
- result[offset + pushIndex] = value[pushIndex];
173
- }
174
- }
175
- }
176
- else {
177
- result[result.length] = value;
178
- }
179
- }
180
- return result;
181
- }
182
- /**
183
- * Recursively flattens array
184
- *
185
- * 递归扁平数组
186
- * ```ts
187
- * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
188
- * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
189
- * ```
190
- */
191
- flat(array, depth = 1 / 0) {
192
- return Array.isArray(array) ? this.baseFlat(array, depth) : array;
193
- }
194
- /**
195
- * Group the array
196
- *
197
- * 对数组进行分组
198
- * ```ts
199
- * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
200
- * srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
201
- * ```
202
- */
203
- groupBy(array, iteratee) {
204
- if (!Array.isArray(array)) {
205
- return {};
206
- }
207
- return array.reduce((result, value) => {
208
- const key = iteratee(value);
209
- if (Object.prototype.hasOwnProperty.call(result, key)) {
210
- result[key].push(value);
211
- }
212
- else {
213
- result[key] = [value];
214
- }
215
- return result;
216
- }, {});
217
- }
218
- /**
219
- * Creates a duplicate-free version of an array
220
- *
221
- * 创建去重后的数组
222
- * ```ts
223
- * uniq([1, 2, 2, 3, 1]) => [1,2,3]
224
- * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
225
- * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
226
- * ```
227
- */
228
- uniq(array, predicate) {
229
- return Array.from(array
230
- .reduce((map, value) => {
231
- const key = predicate
232
- ? typeof predicate === 'string'
233
- ? value[predicate]
234
- : predicate(value)
235
- : value;
236
- if (!map.has(key)) {
237
- map.set(key, value);
238
- }
239
- return map;
240
- }, new Map())
241
- .values());
242
- }
243
- }
244
- ArrayService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ArrayService_Factory() { return new ArrayService(i0.ɵɵinject(i1.YunzaiConfigService)); }, token: ArrayService, providedIn: "root" });
245
- ArrayService.decorators = [
246
- { type: Injectable, args: [{ providedIn: 'root' },] }
247
- ];
248
- ArrayService.ctorParameters = () => [
249
- { type: YunzaiConfigService }
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ class ArrayService {
9
+ constructor(cog) {
10
+ this.c = cog.merge('utilArray', {
11
+ deepMapName: 'deep',
12
+ parentMapName: 'parent',
13
+ idMapName: 'id',
14
+ parentIdMapName: 'parent_id',
15
+ childrenMapName: 'children',
16
+ titleMapName: 'title',
17
+ checkedMapname: 'checked',
18
+ selectedMapname: 'selected',
19
+ expandedMapname: 'expanded',
20
+ disabledMapname: 'disabled'
21
+ });
22
+ }
23
+ /**
24
+ * Convert tree structure to array structure
25
+ *
26
+ * 将树结构转换成数组结构
27
+ */
28
+ treeToArr(tree, options) {
29
+ const opt = Object.assign({ deepMapName: this.c.deepMapName, parentMapName: this.c.parentMapName, childrenMapName: this.c.childrenMapName, clearChildren: true, cb: null }, options);
30
+ const result = [];
31
+ const inFn = (list, parent, deep = 0) => {
32
+ for (const i of list) {
33
+ i[opt.deepMapName] = deep;
34
+ i[opt.parentMapName] = parent;
35
+ if (opt.cb) {
36
+ opt.cb(i, parent, deep);
37
+ }
38
+ result.push(i);
39
+ const children = i[opt.childrenMapName];
40
+ if (children != null && Array.isArray(children) && children.length > 0) {
41
+ inFn(children, i, deep + 1);
42
+ }
43
+ if (opt.clearChildren) {
44
+ delete i[opt.childrenMapName];
45
+ }
46
+ }
47
+ };
48
+ inFn(tree, null);
49
+ return result;
50
+ }
51
+ /**
52
+ * Convert array structure to tree structure
53
+ *
54
+ * 数组转换成树数据
55
+ */
56
+ arrToTree(arr, options) {
57
+ if (!Array.isArray(arr) || arr.length === 0) {
58
+ return [];
59
+ }
60
+ const opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, childrenMapName: this.c.childrenMapName, cb: null }, options);
61
+ const tree = [];
62
+ const childrenOf = {};
63
+ let rootPid = opt.rootParentIdValue;
64
+ const arrType = arr;
65
+ if (!rootPid) {
66
+ const pids = arrType.map(i => i[opt.parentIdMapName]);
67
+ const emptyPid = pids.findIndex(w => w == null);
68
+ rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];
69
+ }
70
+ for (const item of arrType) {
71
+ const id = item[opt.idMapName];
72
+ const pid = item[opt.parentIdMapName];
73
+ childrenOf[id] = childrenOf[id] || [];
74
+ item[opt.childrenMapName] = childrenOf[id];
75
+ if (opt.cb) {
76
+ opt.cb(item);
77
+ }
78
+ if (pid !== rootPid) {
79
+ childrenOf[pid] = childrenOf[pid] || [];
80
+ childrenOf[pid].push(item);
81
+ }
82
+ else {
83
+ tree.push(item);
84
+ }
85
+ }
86
+ return tree;
87
+ }
88
+ /**
89
+ * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
90
+ */
91
+ arrToTreeNode(arr, options) {
92
+ const opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, titleMapName: this.c.titleMapName, isLeafMapName: 'isLeaf', checkedMapname: this.c.checkedMapname, selectedMapname: this.c.selectedMapname, expandedMapname: this.c.expandedMapname, disabledMapname: this.c.disabledMapname, cb: null }, options);
93
+ const tree = this.arrToTree(arr, {
94
+ idMapName: opt.idMapName,
95
+ parentIdMapName: opt.parentIdMapName,
96
+ childrenMapName: 'children'
97
+ });
98
+ this.visitTree(tree, (item, parent, deep) => {
99
+ item.key = item[opt.idMapName];
100
+ item.title = item[opt.titleMapName];
101
+ item.checked = item[opt.checkedMapname];
102
+ item.selected = item[opt.selectedMapname];
103
+ item.expanded = item[opt.expandedMapname];
104
+ item.disabled = item[opt.disabledMapname];
105
+ if (item[opt.isLeafMapName] == null) {
106
+ item.isLeaf = item.children.length === 0;
107
+ }
108
+ else {
109
+ item.isLeaf = item[opt.isLeafMapName];
110
+ }
111
+ if (opt.cb) {
112
+ opt.cb(item, parent, deep);
113
+ }
114
+ });
115
+ return tree.map(node => new NzTreeNode(node));
116
+ }
117
+ /**
118
+ * 递归访问整个树
119
+ */
120
+ visitTree(tree, cb, options) {
121
+ options = Object.assign({ childrenMapName: this.c.childrenMapName }, options);
122
+ const inFn = (data, parent, deep) => {
123
+ for (const item of data) {
124
+ cb(item, parent, deep);
125
+ const childrenVal = item[options.childrenMapName];
126
+ if (Array.isArray(childrenVal) && childrenVal.length > 0) {
127
+ inFn(childrenVal, item, deep + 1);
128
+ }
129
+ }
130
+ };
131
+ inFn(tree, null, 1);
132
+ }
133
+ /**
134
+ * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
135
+ *
136
+ * 根据条件返回树的第一个值,否则返回 `undefined`
137
+ */
138
+ findTree(tree, predicate, options) {
139
+ let res;
140
+ this.visitTree(tree, item => {
141
+ if (res === undefined && predicate(item)) {
142
+ res = item;
143
+ }
144
+ }, options);
145
+ return res;
146
+ }
147
+ /**
148
+ * 获取所有已经选中的 `key` 值
149
+ */
150
+ getKeysByTreeNode(tree, options) {
151
+ const opt = Object.assign({ includeHalfChecked: true }, options);
152
+ const keys = [];
153
+ this.visitTree(tree, (item, parent, deep) => {
154
+ if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {
155
+ keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);
156
+ }
157
+ });
158
+ return keys;
159
+ }
160
+ baseFlat(array, depth, result = []) {
161
+ let index = -1;
162
+ while (++index < array.length) {
163
+ const value = array[index];
164
+ if (depth > 0 && Array.isArray(value)) {
165
+ if (depth > 1) {
166
+ this.baseFlat(value, depth - 1, result);
167
+ }
168
+ else {
169
+ let pushIndex = -1;
170
+ const offset = result.length;
171
+ while (++pushIndex < value.length) {
172
+ result[offset + pushIndex] = value[pushIndex];
173
+ }
174
+ }
175
+ }
176
+ else {
177
+ result[result.length] = value;
178
+ }
179
+ }
180
+ return result;
181
+ }
182
+ /**
183
+ * Recursively flattens array
184
+ *
185
+ * 递归扁平数组
186
+ * ```ts
187
+ * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
188
+ * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
189
+ * ```
190
+ */
191
+ flat(array, depth = 1 / 0) {
192
+ return Array.isArray(array) ? this.baseFlat(array, depth) : array;
193
+ }
194
+ /**
195
+ * Group the array
196
+ *
197
+ * 对数组进行分组
198
+ * ```ts
199
+ * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
200
+ * srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
201
+ * ```
202
+ */
203
+ groupBy(array, iteratee) {
204
+ if (!Array.isArray(array)) {
205
+ return {};
206
+ }
207
+ return array.reduce((result, value) => {
208
+ const key = iteratee(value);
209
+ if (Object.prototype.hasOwnProperty.call(result, key)) {
210
+ result[key].push(value);
211
+ }
212
+ else {
213
+ result[key] = [value];
214
+ }
215
+ return result;
216
+ }, {});
217
+ }
218
+ /**
219
+ * Creates a duplicate-free version of an array
220
+ *
221
+ * 创建去重后的数组
222
+ * ```ts
223
+ * uniq([1, 2, 2, 3, 1]) => [1,2,3]
224
+ * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
225
+ * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
226
+ * ```
227
+ */
228
+ uniq(array, predicate) {
229
+ return Array.from(array
230
+ .reduce((map, value) => {
231
+ const key = predicate
232
+ ? typeof predicate === 'string'
233
+ ? value[predicate]
234
+ : predicate(value)
235
+ : value;
236
+ if (!map.has(key)) {
237
+ map.set(key, value);
238
+ }
239
+ return map;
240
+ }, new Map())
241
+ .values());
242
+ }
243
+ }
244
+ ArrayService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ArrayService_Factory() { return new ArrayService(i0.ɵɵinject(i1.YunzaiConfigService)); }, token: ArrayService, providedIn: "root" });
245
+ ArrayService.decorators = [
246
+ { type: Injectable, args: [{ providedIn: 'root' },] }
247
+ ];
248
+ ArrayService.ctorParameters = () => [
249
+ { type: YunzaiConfigService }
250
250
  ];
251
251
 
252
- /**
253
- * Generated bundle index. Do not edit.
252
+ /**
253
+ * Generated bundle index. Do not edit.
254
254
  */
255
255
 
256
256
  export { ArrayService };
@@ -1 +1 @@
1
- {"version":3,"file":"yelon-util-array.js","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/yelon-util-array.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Injectable } from '@angular/core';\n\nimport { NzTreeNode } from 'ng-zorro-antd/core/tree';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\n\nimport {\n ArrayServiceArrToTreeNodeOptions,\n ArrayServiceArrToTreeOptions,\n ArrayServiceGetKeysByTreeNodeOptions,\n ArrayServiceGroupByResult,\n ArrayServiceTreeToArrOptions\n} from './array-type.service';\n\n@Injectable({ providedIn: 'root' })\nexport class ArrayService {\n private c: YunzaiUtilArrayConfig;\n\n constructor(cog: YunzaiConfigService) {\n this.c = cog.merge('utilArray', {\n deepMapName: 'deep',\n parentMapName: 'parent',\n idMapName: 'id',\n parentIdMapName: 'parent_id',\n childrenMapName: 'children',\n titleMapName: 'title',\n checkedMapname: 'checked',\n selectedMapname: 'selected',\n expandedMapname: 'expanded',\n disabledMapname: 'disabled'\n })!;\n }\n\n /**\n * Convert tree structure to array structure\n *\n * 将树结构转换成数组结构\n */\n treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[] {\n const opt = {\n deepMapName: this.c.deepMapName,\n parentMapName: this.c.parentMapName,\n childrenMapName: this.c.childrenMapName,\n clearChildren: true,\n cb: null,\n ...options\n } as ArrayServiceTreeToArrOptions;\n const result: Array<{ [key: string]: any }> = [];\n const inFn = (list: ReadonlyArray<{ [key: string]: any }>, parent: T | null, deep: number = 0) => {\n for (const i of list) {\n i[opt.deepMapName!] = deep;\n i[opt.parentMapName!] = parent;\n if (opt.cb) {\n opt.cb(i, parent, deep);\n }\n result.push(i);\n const children = i[opt.childrenMapName!];\n if (children != null && Array.isArray(children) && children.length > 0) {\n inFn(children, i as T, deep + 1);\n }\n if (opt.clearChildren) {\n delete i[opt.childrenMapName!];\n }\n }\n };\n inFn(tree, null);\n return result as T[];\n }\n\n /**\n * Convert array structure to tree structure\n *\n * 数组转换成树数据\n */\n arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[] {\n if (!Array.isArray(arr) || arr.length === 0) {\n return [];\n }\n\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n childrenMapName: this.c.childrenMapName,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeOptions<T>;\n const tree: T[] = [];\n const childrenOf: { [key: string]: T[] } = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<{ [key: string]: any }>;\n if (!rootPid) {\n const pids = arrType.map(i => i[opt.parentIdMapName!]);\n const emptyPid = pids.findIndex(w => w == null);\n rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];\n }\n for (const item of arrType) {\n const id = item[opt.idMapName!];\n const pid = item[opt.parentIdMapName!];\n childrenOf[id] = childrenOf[id] || [];\n item[opt.childrenMapName!] = childrenOf[id];\n if (opt.cb) {\n opt.cb(item as T);\n }\n if (pid !== rootPid) {\n childrenOf[pid] = childrenOf[pid] || [];\n childrenOf[pid].push(item as T);\n } else {\n tree.push(item as T);\n }\n }\n return tree;\n }\n\n /**\n * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项\n */\n arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[] {\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n titleMapName: this.c.titleMapName,\n isLeafMapName: 'isLeaf',\n checkedMapname: this.c.checkedMapname,\n selectedMapname: this.c.selectedMapname,\n expandedMapname: this.c.expandedMapname,\n disabledMapname: this.c.disabledMapname,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeNodeOptions<T>;\n const tree = this.arrToTree<T>(arr, {\n idMapName: opt.idMapName,\n parentIdMapName: opt.parentIdMapName,\n childrenMapName: 'children'\n });\n this.visitTree<T>(tree, (item: { [key: string]: any }, parent, deep) => {\n item.key = item[opt.idMapName!];\n item.title = item[opt.titleMapName!];\n item.checked = item[opt.checkedMapname!];\n item.selected = item[opt.selectedMapname!];\n item.expanded = item[opt.expandedMapname!];\n item.disabled = item[opt.disabledMapname!];\n if (item[opt.isLeafMapName!] == null) {\n item.isLeaf = item.children.length === 0;\n } else {\n item.isLeaf = item[opt.isLeafMapName!];\n }\n if (opt.cb) {\n opt.cb(item as any, parent, deep);\n }\n });\n return tree.map(node => new NzTreeNode(node as any));\n }\n\n /**\n * 递归访问整个树\n */\n visitTree<T extends object = any>(\n tree: readonly T[],\n cb: (item: T, parent: T | null, deep: number) => void,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): void {\n options = {\n childrenMapName: this.c.childrenMapName,\n ...options\n };\n const inFn = (data: readonly T[], parent: T | null, deep: number) => {\n for (const item of data) {\n cb(item, parent, deep);\n const childrenVal = (item as { [key: string]: any })[options!.childrenMapName!];\n if (Array.isArray(childrenVal) && childrenVal.length > 0) {\n inFn(childrenVal, item, deep + 1);\n }\n }\n };\n inFn(tree, null, 1);\n }\n\n /**\n * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise\n *\n * 根据条件返回树的第一个值,否则返回 `undefined`\n */\n findTree<T extends object = any>(\n tree: readonly T[],\n predicate: (item: T) => boolean,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): T | undefined {\n let res: T | undefined;\n this.visitTree<T>(\n tree,\n item => {\n if (res === undefined && predicate(item)) {\n res = item;\n }\n },\n options\n );\n return res;\n }\n\n /**\n * 获取所有已经选中的 `key` 值\n */\n getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[] {\n const opt = {\n includeHalfChecked: true,\n ...options\n } as ArrayServiceGetKeysByTreeNodeOptions;\n const keys: any[] = [];\n this.visitTree<NzTreeNode>(tree, (item, parent, deep) => {\n if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {\n keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);\n }\n });\n return keys;\n }\n private baseFlat(array: any[], depth: number, result: any[] = []): any[] {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (depth > 0 && Array.isArray(value)) {\n if (depth > 1) {\n this.baseFlat(value, depth - 1, result);\n } else {\n let pushIndex = -1;\n const offset = result.length;\n\n while (++pushIndex < value.length) {\n result[offset + pushIndex] = value[pushIndex];\n }\n }\n } else {\n result[result.length] = value;\n }\n }\n return result;\n }\n /**\n * Recursively flattens array\n *\n * 递归扁平数组\n * ```ts\n * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]\n * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]\n * ```\n */\n flat<T>(array: readonly T[], depth: number = 1 / 0): T[] {\n return Array.isArray(array) ? this.baseFlat(array as any[], depth) : (array as T[]);\n }\n /**\n * Group the array\n *\n * 对数组进行分组\n * ```ts\n * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {\"4\":[4.2],\"6\":[6.1,6.3]}\n * srv.groupBy(['one', 'two', 'three'], v => v.length) => {\"3\":[\"one\",\"two\"],\"5\":[\"three\"]}\n * ```\n */\n groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult {\n if (!Array.isArray(array)) {\n return {};\n }\n return array.reduce((result, value) => {\n const key = iteratee(value);\n if (Object.prototype.hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n return result;\n }, {} as ArrayServiceGroupByResult);\n }\n /**\n * Creates a duplicate-free version of an array\n *\n * 创建去重后的数组\n * ```ts\n * uniq([1, 2, 2, 3, 1]) => [1,2,3]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{\"a\":1},{\"a\":2}]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{\"a\":1},{\"a\":2}]\n * ```\n */\n uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[] {\n return Array.from(\n array\n .reduce((map, value) => {\n const key = predicate\n ? typeof predicate === 'string'\n ? (value as any)[predicate]\n : predicate!(value)\n : value;\n if (!map.has(key)) {\n map.set(key, value);\n }\n return map;\n }, new Map<string | number | boolean, T>())\n .values()\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;MAgBa,YAAY;IAGvB,YAAY,GAAwB;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,WAAW;YAC5B,eAAe,EAAE,UAAU;YAC3B,YAAY,EAAE,OAAO;YACrB,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;SAC5B,CAAE,CAAC;KACL;;;;;;IAOD,SAAS,CAAyB,IAAkB,EAAE,OAAyC;QAC7F,MAAM,GAAG,GAAG,gBACV,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAC/B,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EACnC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,EACvC,aAAa,EAAE,IAAI,EACnB,EAAE,EAAE,IAAI,IACL,OAAO,CACqB,CAAC;QAClC,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,CAAC,IAA2C,EAAE,MAAgB,EAAE,OAAe,CAAC;YAC3F,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,CAAC,CAAC,GAAG,CAAC,WAAY,CAAC,GAAG,IAAI,CAAC;gBAC3B,CAAC,CAAC,GAAG,CAAC,aAAc,CAAC,GAAG,MAAM,CAAC;gBAC/B,IAAI,GAAG,CAAC,EAAE,EAAE;oBACV,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;iBACzB;gBACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACf,MAAM,QAAQ,GAAG,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ts","../../../../packages/util/array/yelon-util-array.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Injectable } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\nimport { NzTreeNode } from 'ng-zorro-antd/core/tree';\n\nimport {\n ArrayServiceArrToTreeNodeOptions,\n ArrayServiceArrToTreeOptions,\n ArrayServiceGetKeysByTreeNodeOptions,\n ArrayServiceGroupByResult,\n ArrayServiceTreeToArrOptions\n} from './array-type.service';\n\n@Injectable({ providedIn: 'root' })\nexport class ArrayService {\n private c: YunzaiUtilArrayConfig;\n\n constructor(cog: YunzaiConfigService) {\n this.c = cog.merge('utilArray', {\n deepMapName: 'deep',\n parentMapName: 'parent',\n idMapName: 'id',\n parentIdMapName: 'parent_id',\n childrenMapName: 'children',\n titleMapName: 'title',\n checkedMapname: 'checked',\n selectedMapname: 'selected',\n expandedMapname: 'expanded',\n disabledMapname: 'disabled'\n })!;\n }\n\n /**\n * Convert tree structure to array structure\n *\n * 将树结构转换成数组结构\n */\n treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[] {\n const opt = {\n deepMapName: this.c.deepMapName,\n parentMapName: this.c.parentMapName,\n childrenMapName: this.c.childrenMapName,\n clearChildren: true,\n cb: null,\n ...options\n } as ArrayServiceTreeToArrOptions;\n const result: Array<{ [key: string]: any }> = [];\n const inFn = (list: ReadonlyArray<{ [key: string]: any }>, parent: T | null, deep: number = 0): void => {\n for (const i of list) {\n i[opt.deepMapName!] = deep;\n i[opt.parentMapName!] = parent;\n if (opt.cb) {\n opt.cb(i, parent, deep);\n }\n result.push(i);\n const children = i[opt.childrenMapName!];\n if (children != null && Array.isArray(children) && children.length > 0) {\n inFn(children, i as T, deep + 1);\n }\n if (opt.clearChildren) {\n delete i[opt.childrenMapName!];\n }\n }\n };\n inFn(tree, null);\n return result as T[];\n }\n\n /**\n * Convert array structure to tree structure\n *\n * 数组转换成树数据\n */\n arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[] {\n if (!Array.isArray(arr) || arr.length === 0) {\n return [];\n }\n\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n childrenMapName: this.c.childrenMapName,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeOptions<T>;\n const tree: T[] = [];\n const childrenOf: { [key: string]: T[] } = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<{ [key: string]: any }>;\n if (!rootPid) {\n const pids = arrType.map(i => i[opt.parentIdMapName!]);\n const emptyPid = pids.findIndex(w => w == null);\n rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];\n }\n for (const item of arrType) {\n const id = item[opt.idMapName!];\n const pid = item[opt.parentIdMapName!];\n childrenOf[id] = childrenOf[id] || [];\n item[opt.childrenMapName!] = childrenOf[id];\n if (opt.cb) {\n opt.cb(item as T);\n }\n if (pid !== rootPid) {\n childrenOf[pid] = childrenOf[pid] || [];\n childrenOf[pid].push(item as T);\n } else {\n tree.push(item as T);\n }\n }\n return tree;\n }\n\n /**\n * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项\n */\n arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[] {\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n titleMapName: this.c.titleMapName,\n isLeafMapName: 'isLeaf',\n checkedMapname: this.c.checkedMapname,\n selectedMapname: this.c.selectedMapname,\n expandedMapname: this.c.expandedMapname,\n disabledMapname: this.c.disabledMapname,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeNodeOptions<T>;\n const tree = this.arrToTree<T>(arr, {\n idMapName: opt.idMapName,\n parentIdMapName: opt.parentIdMapName,\n childrenMapName: 'children'\n });\n this.visitTree<T>(tree, (item: { [key: string]: any }, parent, deep) => {\n item.key = item[opt.idMapName!];\n item.title = item[opt.titleMapName!];\n item.checked = item[opt.checkedMapname!];\n item.selected = item[opt.selectedMapname!];\n item.expanded = item[opt.expandedMapname!];\n item.disabled = item[opt.disabledMapname!];\n if (item[opt.isLeafMapName!] == null) {\n item.isLeaf = item.children.length === 0;\n } else {\n item.isLeaf = item[opt.isLeafMapName!];\n }\n if (opt.cb) {\n opt.cb(item as any, parent, deep);\n }\n });\n return tree.map(node => new NzTreeNode(node as any));\n }\n\n /**\n * 递归访问整个树\n */\n visitTree<T extends object = any>(\n tree: readonly T[],\n cb: (item: T, parent: T | null, deep: number) => void,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): void {\n options = {\n childrenMapName: this.c.childrenMapName,\n ...options\n };\n const inFn = (data: readonly T[], parent: T | null, deep: number): void => {\n for (const item of data) {\n cb(item, parent, deep);\n const childrenVal = (item as { [key: string]: any })[options!.childrenMapName!];\n if (Array.isArray(childrenVal) && childrenVal.length > 0) {\n inFn(childrenVal, item, deep + 1);\n }\n }\n };\n inFn(tree, null, 1);\n }\n\n /**\n * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise\n *\n * 根据条件返回树的第一个值,否则返回 `undefined`\n */\n findTree<T extends object = any>(\n tree: readonly T[],\n predicate: (item: T) => boolean,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): T | undefined {\n let res: T | undefined;\n this.visitTree<T>(\n tree,\n item => {\n if (res === undefined && predicate(item)) {\n res = item;\n }\n },\n options\n );\n return res;\n }\n\n /**\n * 获取所有已经选中的 `key` 值\n */\n getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[] {\n const opt = {\n includeHalfChecked: true,\n ...options\n } as ArrayServiceGetKeysByTreeNodeOptions;\n const keys: any[] = [];\n this.visitTree<NzTreeNode>(tree, (item, parent, deep) => {\n if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {\n keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);\n }\n });\n return keys;\n }\n private baseFlat(array: any[], depth: number, result: any[] = []): any[] {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (depth > 0 && Array.isArray(value)) {\n if (depth > 1) {\n this.baseFlat(value, depth - 1, result);\n } else {\n let pushIndex = -1;\n const offset = result.length;\n\n while (++pushIndex < value.length) {\n result[offset + pushIndex] = value[pushIndex];\n }\n }\n } else {\n result[result.length] = value;\n }\n }\n return result;\n }\n /**\n * Recursively flattens array\n *\n * 递归扁平数组\n * ```ts\n * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]\n * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]\n * ```\n */\n flat<T>(array: readonly T[], depth: number = 1 / 0): T[] {\n return Array.isArray(array) ? this.baseFlat(array as any[], depth) : (array as T[]);\n }\n /**\n * Group the array\n *\n * 对数组进行分组\n * ```ts\n * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {\"4\":[4.2],\"6\":[6.1,6.3]}\n * srv.groupBy(['one', 'two', 'three'], v => v.length) => {\"3\":[\"one\",\"two\"],\"5\":[\"three\"]}\n * ```\n */\n groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult {\n if (!Array.isArray(array)) {\n return {};\n }\n return array.reduce((result, value) => {\n const key = iteratee(value);\n if (Object.prototype.hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n return result;\n }, {} as ArrayServiceGroupByResult);\n }\n /**\n * Creates a duplicate-free version of an array\n *\n * 创建去重后的数组\n * ```ts\n * uniq([1, 2, 2, 3, 1]) => [1,2,3]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{\"a\":1},{\"a\":2}]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{\"a\":1},{\"a\":2}]\n * ```\n */\n uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[] {\n return Array.from(\n array\n .reduce((map, value) => {\n const key = predicate\n ? typeof predicate === 'string'\n ? (value as any)[predicate]\n : predicate!(value)\n : value;\n if (!map.has(key)) {\n map.set(key, value);\n }\n return map;\n }, new Map<string | number | boolean, T>())\n .values()\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;MAea,YAAY;IAGvB,YAAY,GAAwB;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,WAAW;YAC5B,eAAe,EAAE,UAAU;YAC3B,YAAY,EAAE,OAAO;YACrB,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;SAC5B,CAAE,CAAC;KACL;;;;;;IAOD,SAAS,CAAyB,IAAkB,EAAE,OAAyC;QAC7F,MAAM,GAAG,GAAG,gBACV,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAC/B,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EACnC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,EACvC,aAAa,EAAE,IAAI,EACnB,EAAE,EAAE,IAAI,IACL,OAAO,CACqB,CAAC;QAClC,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,CAAC,IAA2C,EAAE,MAAgB,EAAE,OAAe,CAAC;YAC3F,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,CAAC,CAAC,GAAG,CAAC,WAAY,CAAC,GAAG,IAAI,CAAC;gBAC3B,CAAC,CAAC,GAAG,CAAC,aAAc,CAAC,GAAG,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