bkui-vue 0.0.1-beta.58 → 0.0.1-beta.60

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.
Files changed (46) hide show
  1. package/dist/index.cjs.js +26 -26
  2. package/dist/index.esm.js +319 -205
  3. package/dist/index.umd.js +26 -26
  4. package/dist/style.css +1 -1
  5. package/lib/breadcrumb/breadcrumb.css +2 -2
  6. package/lib/breadcrumb/breadcrumb.variable.css +2 -2
  7. package/lib/button/button.less +2 -1
  8. package/lib/card/card.css +10 -10
  9. package/lib/card/card.less +12 -8
  10. package/lib/card/card.variable.css +10 -10
  11. package/lib/container/container.css +5 -5
  12. package/lib/container/container.less +1 -1
  13. package/lib/container/container.variable.css +5 -5
  14. package/lib/dialog/dialog.css +0 -2
  15. package/lib/dialog/dialog.less +4 -2
  16. package/lib/dialog/dialog.variable.css +0 -2
  17. package/lib/input/input.css +3 -3
  18. package/lib/input/input.less +2 -1
  19. package/lib/input/input.variable.css +3 -3
  20. package/lib/loading/loading.css +2 -2
  21. package/lib/loading/loading.variable.css +2 -2
  22. package/lib/menu/menu.css +2 -2
  23. package/lib/menu/menu.variable.css +2 -2
  24. package/lib/progress/progress.css +2 -2
  25. package/lib/progress/progress.variable.css +2 -2
  26. package/lib/styles/mixins/clearfix.css +2 -2
  27. package/lib/styles/mixins/clearfix.less +2 -2
  28. package/lib/styles/mixins/clearfix.variable.css +2 -2
  29. package/lib/styles/mixins/mixins.css +2 -2
  30. package/lib/styles/mixins/mixins.variable.css +2 -2
  31. package/lib/switcher/switcher.css +2 -2
  32. package/lib/switcher/switcher.variable.css +2 -2
  33. package/lib/table/plugins/settings.css +41 -41
  34. package/lib/table/plugins/settings.less +28 -22
  35. package/lib/table/plugins/settings.variable.css +41 -41
  36. package/lib/table/table.css +47 -47
  37. package/lib/table/table.less +10 -8
  38. package/lib/table/table.variable.css +47 -47
  39. package/lib/tree/index.d.ts +31 -52
  40. package/lib/tree/index.js +1 -1
  41. package/lib/tree/props.d.ts +10 -0
  42. package/lib/tree/tree.d.ts +16 -17
  43. package/lib/tree/use-async.d.ts +5 -0
  44. package/lib/tree/use-node-action.d.ts +6 -0
  45. package/lib/tree/use-node-attribute.d.ts +13 -0
  46. package/package.json +4 -4
@@ -182,113 +182,113 @@
182
182
  .bk-head-cell-sort .sort-action.sort-desc {
183
183
  align-items: flex-start;
184
184
  }
185
- .bk-table-settings[data-bk-table-settings-theme="true"] {
185
+ .bk-table-settings[data-bk-table-settings-theme='true'] {
186
186
  padding: 0;
187
187
  }
188
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content {
188
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content {
189
189
  width: 515px;
190
- opacity: 1;
191
190
  border: 1px solid #dcdee5;
192
191
  border-radius: 2px;
192
+ opacity: 1;
193
193
  }
194
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-head {
194
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-head {
195
+ position: relative;
195
196
  display: flex;
196
197
  padding: 0 24px;
197
198
  margin: 0;
198
- line-height: 32px;
199
199
  font-size: 16px;
200
200
  font-weight: 400;
201
+ line-height: 32px;
201
202
  color: #313238;
202
- position: relative;
203
203
  }
204
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-head .icon-close-action {
204
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-head .icon-close-action {
205
205
  position: absolute;
206
- right: 15px;
207
206
  top: 10px;
207
+ right: 15px;
208
208
  cursor: pointer;
209
209
  }
210
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body {
210
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body {
211
211
  padding: 0 24px;
212
212
  }
213
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-title {
213
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-title {
214
214
  display: flex;
215
- justify-content: space-between;
216
215
  font-size: 14px;
217
- color: #63656e;
218
216
  line-height: 19px;
217
+ color: #63656e;
218
+ justify-content: space-between;
219
219
  }
220
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-title .limit {
220
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-title .limit {
221
221
  color: #c4c6cc;
222
222
  }
223
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-title .check-all {
223
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-title .check-all {
224
224
  color: #3a84ff;
225
225
  cursor: pointer;
226
226
  }
227
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-fields {
228
- max-height: 150px;
227
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-fields {
229
228
  display: flex;
229
+ max-height: 150px;
230
230
  align-items: flex-start;
231
231
  flex-wrap: wrap;
232
232
  }
233
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-fields .field-item {
233
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-fields .field-item {
234
234
  width: 150px;
235
- line-height: 42px;
236
235
  height: 42px;
236
+ line-height: 42px;
237
237
  }
238
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-fields .field-item > label {
238
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-fields .field-item > label {
239
239
  overflow: hidden;
240
240
  text-overflow: ellipsis;
241
241
  white-space: nowrap;
242
242
  }
243
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height {
244
- border-top: solid 1px #f0f1f5;
243
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height {
244
+ display: flex;
245
245
  height: 76px;
246
246
  font-size: 14px;
247
- display: flex;
247
+ border-top: solid 1px #f0f1f5;
248
248
  align-items: center;
249
249
  }
250
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size {
250
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size {
251
251
  display: flex;
252
- justify-content: center;
253
- align-items: center;
254
252
  width: 68px;
255
253
  height: 26px;
256
- cursor: pointer;
257
254
  color: #63656e;
255
+ cursor: pointer;
258
256
  border: 1px solid #c4c6cc;
257
+ justify-content: center;
258
+ align-items: center;
259
259
  }
260
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size.active {
261
- background: #e1ecff;
260
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size.active {
262
261
  color: #3a84ff;
262
+ background: #e1ecff;
263
263
  border: 1px solid #a3c5fd;
264
264
  }
265
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size:not(.active) {
266
- border-left: none;
265
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size:not(.active) {
267
266
  border-right: none;
267
+ border-left: none;
268
268
  }
269
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size:first-child {
270
- border-top-left-radius: 2px;
271
- border-bottom-left-radius: 2px;
272
- border-left: 1px solid #c4c6cc;
269
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size:first-child {
273
270
  border-right: 1px solid #c4c6cc;
271
+ border-left: 1px solid #c4c6cc;
272
+ border-bottom-left-radius: 2px;
273
+ border-top-left-radius: 2px;
274
274
  }
275
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size:first-child.is-default {
275
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size:first-child.is-default {
276
276
  border-right: none;
277
277
  }
278
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size:last-child {
279
- border-top-right-radius: 2px;
280
- border-bottom-right-radius: 2px;
278
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size:last-child {
281
279
  border-right: 1px solid #c4c6cc;
282
280
  border-left: 1px solid #c4c6cc;
281
+ border-top-right-radius: 2px;
282
+ border-bottom-right-radius: 2px;
283
283
  }
284
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-body .setting-body-line-height .line-size:last-child.is-default {
284
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-body .setting-body-line-height .line-size:last-child.is-default {
285
285
  border-left: none;
286
286
  }
287
- .bk-table-settings[data-bk-table-settings-theme="true"] .setting-content .setting-footer {
287
+ .bk-table-settings[data-bk-table-settings-theme='true'] .setting-content .setting-footer {
288
+ display: flex;
288
289
  height: 56px;
289
290
  padding: 0 24px;
290
291
  background-color: #fafbfd;
291
- display: flex;
292
292
  justify-content: flex-end;
293
293
  align-items: center;
294
294
  }
@@ -355,18 +355,18 @@
355
355
  position: relative;
356
356
  }
357
357
  .bk-table .bk-table-head .table-head-settings .bk-popover-reference {
358
- cursor: pointer;
359
- width: calc(var(--row-height));
360
- font-size: 18px;
361
358
  position: absolute;
362
- right: 1px;
363
359
  top: 0;
360
+ right: 1px;
364
361
  bottom: 1px;
362
+ display: flex;
363
+ width: calc(var(--row-height));
364
+ font-size: 18px;
365
+ cursor: pointer;
365
366
  background: #f0f1f5;
366
- border-left: 1px solid #dcdee5;
367
367
  border-right: 1px solid #dcdee5;
368
+ border-left: 1px solid #dcdee5;
368
369
  border-radius: 0px 2px 0px 0px;
369
- display: flex;
370
370
  justify-content: center;
371
371
  align-items: center;
372
372
  }
@@ -7,6 +7,7 @@ declare const BkTree: {
7
7
  lineHeight: number;
8
8
  prefixIcon: any;
9
9
  children: string;
10
+ nodeKey: string;
10
11
  indent: number;
11
12
  levelLine: any;
12
13
  virtualRender: boolean;
@@ -16,6 +17,11 @@ declare const BkTree: {
16
17
  default: () => any[];
17
18
  };
18
19
  label: import("vue-types").VueTypeDef<any>;
20
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
21
+ default: string;
22
+ } & {
23
+ default: string;
24
+ };
19
25
  children: import("vue-types").VueTypeValidableDef<string> & {
20
26
  default: string;
21
27
  } & {
@@ -45,6 +51,7 @@ declare const BkTree: {
45
51
  async: import("vue-types").VueTypeShape<{
46
52
  callback: (item: any, cb: any) => Promise<any>;
47
53
  cache: Boolean;
54
+ deepAutoOpen?: string;
48
55
  }>;
49
56
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
50
57
  default: number;
@@ -53,7 +60,7 @@ declare const BkTree: {
53
60
  };
54
61
  }>> & {
55
62
  onCheck?: (...args: any[]) => any;
56
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "lineHeight" | "prefixIcon" | "children" | "indent" | "levelLine" | "virtualRender" | "offsetLeft">;
63
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "data" | "lineHeight" | "prefixIcon" | "children" | "nodeKey" | "indent" | "levelLine" | "virtualRender" | "offsetLeft">;
57
64
  $attrs: {
58
65
  [x: string]: unknown;
59
66
  };
@@ -72,6 +79,11 @@ declare const BkTree: {
72
79
  default: () => any[];
73
80
  };
74
81
  label: import("vue-types").VueTypeDef<any>;
82
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
83
+ default: string;
84
+ } & {
85
+ default: string;
86
+ };
75
87
  children: import("vue-types").VueTypeValidableDef<string> & {
76
88
  default: string;
77
89
  } & {
@@ -101,6 +113,7 @@ declare const BkTree: {
101
113
  async: import("vue-types").VueTypeShape<{
102
114
  callback: (item: any, cb: any) => Promise<any>;
103
115
  cache: Boolean;
116
+ deepAutoOpen?: string;
104
117
  }>;
105
118
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
106
119
  default: number;
@@ -109,27 +122,12 @@ declare const BkTree: {
109
122
  };
110
123
  }>> & {
111
124
  onCheck?: (...args: any[]) => any;
112
- }, {
113
- renderData: import("vue").ComputedRef<any[]>;
114
- flatData: {
115
- data: any[];
116
- schema: any[] | Map<string, any>;
117
- levelLineSchema: {};
118
- };
119
- root: import("vue").Ref<any>;
120
- hanldeTreeNodeClick: (item: any) => void;
121
- handleNodeContentClick: (item: any) => void;
122
- handleNodeActionClick: (e: MouseEvent, node: any) => void;
123
- getActionIcon: (item: any) => any;
124
- getRootIcon: (item: any) => JSX.Element;
125
- getVirtualLines: (node: any) => JSX.Element[];
126
- getNodePrefixIcon: (item: any) => any;
127
- getLoadingIcon: (item: any) => JSX.Element | "";
128
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], string, {
125
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], string, {
129
126
  data: any[];
130
127
  lineHeight: number;
131
128
  prefixIcon: any;
132
129
  children: string;
130
+ nodeKey: string;
133
131
  indent: number;
134
132
  levelLine: any;
135
133
  virtualRender: boolean;
@@ -159,6 +157,11 @@ declare const BkTree: {
159
157
  default: () => any[];
160
158
  };
161
159
  label: import("vue-types").VueTypeDef<any>;
160
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
161
+ default: string;
162
+ } & {
163
+ default: string;
164
+ };
162
165
  children: import("vue-types").VueTypeValidableDef<string> & {
163
166
  default: string;
164
167
  } & {
@@ -188,6 +191,7 @@ declare const BkTree: {
188
191
  async: import("vue-types").VueTypeShape<{
189
192
  callback: (item: any, cb: any) => Promise<any>;
190
193
  cache: Boolean;
194
+ deepAutoOpen?: string;
191
195
  }>;
192
196
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
193
197
  default: number;
@@ -196,23 +200,7 @@ declare const BkTree: {
196
200
  };
197
201
  }>> & {
198
202
  onCheck?: (...args: any[]) => any;
199
- } & import("vue").ShallowUnwrapRef<{
200
- renderData: import("vue").ComputedRef<any[]>;
201
- flatData: {
202
- data: any[];
203
- schema: any[] | Map<string, any>;
204
- levelLineSchema: {};
205
- };
206
- root: import("vue").Ref<any>;
207
- hanldeTreeNodeClick: (item: any) => void;
208
- handleNodeContentClick: (item: any) => void;
209
- handleNodeActionClick: (e: MouseEvent, node: any) => void;
210
- getActionIcon: (item: any) => any;
211
- getRootIcon: (item: any) => JSX.Element;
212
- getVirtualLines: (node: any) => JSX.Element[];
213
- getNodePrefixIcon: (item: any) => any;
214
- getLoadingIcon: (item: any) => JSX.Element | "";
215
- }> & {} & {} & import("vue").ComponentCustomProperties;
203
+ } & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
216
204
  __isFragment?: never;
217
205
  __isTeleport?: never;
218
206
  __isSuspense?: never;
@@ -221,6 +209,11 @@ declare const BkTree: {
221
209
  default: () => any[];
222
210
  };
223
211
  label: import("vue-types").VueTypeDef<any>;
212
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
213
+ default: string;
214
+ } & {
215
+ default: string;
216
+ };
224
217
  children: import("vue-types").VueTypeValidableDef<string> & {
225
218
  default: string;
226
219
  } & {
@@ -250,6 +243,7 @@ declare const BkTree: {
250
243
  async: import("vue-types").VueTypeShape<{
251
244
  callback: (item: any, cb: any) => Promise<any>;
252
245
  cache: Boolean;
246
+ deepAutoOpen?: string;
253
247
  }>;
254
248
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
255
249
  default: number;
@@ -258,27 +252,12 @@ declare const BkTree: {
258
252
  };
259
253
  }>> & {
260
254
  onCheck?: (...args: any[]) => any;
261
- }, {
262
- renderData: import("vue").ComputedRef<any[]>;
263
- flatData: {
264
- data: any[];
265
- schema: any[] | Map<string, any>;
266
- levelLineSchema: {};
267
- };
268
- root: import("vue").Ref<any>;
269
- hanldeTreeNodeClick: (item: any) => void;
270
- handleNodeContentClick: (item: any) => void;
271
- handleNodeActionClick: (e: MouseEvent, node: any) => void;
272
- getActionIcon: (item: any) => any;
273
- getRootIcon: (item: any) => JSX.Element;
274
- getVirtualLines: (node: any) => JSX.Element[];
275
- getNodePrefixIcon: (item: any) => any;
276
- getLoadingIcon: (item: any) => JSX.Element | "";
277
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", {
255
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", {
278
256
  data: any[];
279
257
  lineHeight: number;
280
258
  prefixIcon: any;
281
259
  children: string;
260
+ nodeKey: string;
282
261
  indent: number;
283
262
  levelLine: any;
284
263
  virtualRender: boolean;
package/lib/tree/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n(require("../shared"),require("vue"),require("../icon/"),require("../virtual-render"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon/","../virtual-render"],n);else{var t="object"==typeof exports?n(require("../shared"),require("vue"),require("../icon/"),require("../virtual-render")):n(e["../shared"],e.vue,e["../icon/"],e["../virtual-render"]);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(self,((e,n,t,r)=>(()=>{var o={8022:(e,n,t)=>{var r=t(4481),o=t(6426),i=o;i.v1=r,i.v4=o,e.exports=i},8725:e=>{for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},9157:e=>{var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}},4481:(e,n,t)=>{var r,o,i=t(9157),a=t(8725),l=0,u=0;e.exports=function(e,n,t){var c=n&&t||0,s=n||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==d){var p=i();null==f&&(f=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var v=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,h=v-l+(y-u)/1e4;if(h<0&&void 0===e.clockseq&&(d=d+1&16383),(h<0||v>l)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=v,u=y,o=d;var _=(1e4*(268435455&(v+=122192928e5))+y)%4294967296;s[c++]=_>>>24&255,s[c++]=_>>>16&255,s[c++]=_>>>8&255,s[c++]=255&_;var m=v/4294967296*1e4&268435455;s[c++]=m>>>8&255,s[c++]=255&m,s[c++]=m>>>24&15|16,s[c++]=m>>>16&255,s[c++]=d>>>8|128,s[c++]=255&d;for(var g=0;g<6;++g)s[c+g]=f[g];return n||a(s)}},6426:(e,n,t)=>{var r=t(9157),o=t(8725);e.exports=function(e,n,t){var i=n&&t||0;"string"==typeof e&&(n="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var l=0;l<16;++l)n[i+l]=a[l];return n||o(a)}},7685:e=>{"use strict";e.exports=t},4212:n=>{"use strict";n.exports=e},3511:e=>{"use strict";e.exports=r},748:e=>{"use strict";e.exports=n}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var t=i[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return a.d(n,{a:n}),n},a.d=(e,n)=>{for(var t in n)a.o(n,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";a.r(l),a.d(l,{default:()=>T});var e=a(4212);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var r=a(748),o=a(7685),i=a(3511),u=a.n(i),c={data:e.PropTypes.arrayOf(e.PropTypes.any).def([]),label:e.PropTypes.oneOfType([e.PropTypes.func.def(void 0),e.PropTypes.string.def("label")]),children:e.PropTypes.string.def("children"),indent:e.PropTypes.number.def(18),lineHeight:e.PropTypes.number.def(32),levelLine:e.PropTypes.oneOfType([e.PropTypes.bool.def(!1),e.PropTypes.func.def(void 0),e.PropTypes.string.def("1px dashed #c3cdd7")]).def(!1),virtualRender:e.PropTypes.bool.def(!1),prefixIcon:e.PropTypes.oneOfType([e.PropTypes.func.def((function(){})),e.PropTypes.bool.def(!1)]).def(!0),async:e.PropTypes.shape({callback:e.PropTypes.func.def(null),cache:e.PropTypes.bool.def(!0)}),offsetLeft:e.PropTypes.number.def(5)};function s(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function f(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return s(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d=a(8022),p=void 0,v="1px dashed #c3cdd7",y=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=e.data,a=e.children,l=[],u=0,c=new Map;function s(e,n,t,r){var i=(o||[]).find((function(n){return n.__uuid===e}));return i?i[r]:n[t]}function f(e,n){return s(e,n,"isOpen","__isOpen")}function p(e,n){return s(e,n,"checked","__checked")}function v(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=e.length,y=0;y<s;y++){var h=e[y];if(Array.isArray(h))v(h,r,o,i);else if("object"===n(h)&&null!==h){var _=h.__uuid||(0,d.v4)(),m=null!==i?"".concat(i,"-").concat(y):"".concat(y),g=!!(h[a]||[]).length,b=t({__depth:r,__index:y,__uuid:_,__parentId:o,__hasChild:g,__path:m,__isRoot:null===o,__order:u,__isOpen:f(_,h)&&g,__checked:p(_,h)},a,null);Object.assign(h,{__uuid:_}),c.set(_,b),u+=1,l.push(Object.assign(Object.assign({},h),t({},a,null))),Object.prototype.hasOwnProperty.call(h,a)&&v(h[a]||[],r+1,_,m)}}}return v(r||i),[l,c]},h=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],a=e[n];return"boolean"==typeof a?a?r:o:_(t,e,n,i)},_=function(e,t,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=t[r];if("string"==typeof i)return"object"===n(e)&&null!==e?(Object.prototype.hasOwnProperty.call(e,i)||console.error("cannot find node label with key ".concat(i)),e[i]):i;if("function"==typeof i){var a=i.apply(p,[e].concat(f(o)));return"string"==typeof a?a:void console.error("props label with function return value is not string, please check and return string")}},m=function(e,n){return _(e,n,"label")},g=function(e,n){return e.get(n)||{}},b=function(e,n,t){var r;return null===(r=g(e,n))||void 0===r?void 0:r[t]},x=function(e,n){return{"--level-line":h(n,"levelLine",e,v,null,["tree"]),"--lineHeight":"".concat(n.lineHeight,"px"),"--indent":"".concat(n.indent,"px"),"--offset-left":"".concat(n.offsetLeft,"px")}},N=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.schema,o=b(r,e.__uuid,"__depth");return Object.assign({"--depth":o},"function"==typeof n.levelLine?{"--level-line":h(n,"levelLine",e,v,null,["node"])}:{})},O=function(e,n,t){var r=g(n,e.__uuid)||{};return{"is-root":r.__isRoot,"bk-tree-node":!0,"is-open":r.__isOpen,"is-virtual-render":t.virtualRender,"level-line":t.levelLine}},j=function(n,r){return t({"is-checked":(g(r,n.__uuid)||{}).__checked},(0,e.resolveClassName)("node-row"),!0)},P=function(e,n,t,r){var o=e.split("-").reduce((function(e,n){var r=Number(n);return Array.isArray(e)?e[r]:e[t][r]}),n);Object.assign(o,r||{})};const C=(0,r.defineComponent)({name:"Tree",props:c,emits:["check"],setup:function(i,a){var l=y(i),u=[],c=(0,r.reactive)({data:l[0],schema:l[1],levelLineSchema:{}});(0,r.watch)((function(){return[i.data]}),(function(e){var n=y(i,e,s.value);c.data=n[0],c.schema=n[1]}),{deep:!0});var s=(0,r.computed)((function(){return Array.from(c.schema.values())})),f=function(e){return c.schema.get(e)},d=function(e,n){var t;return null===(t=f(e.__uuid))||void 0===t?void 0:t[n]},p=function(e,n,r){return c.schema.set(e.__uuid,Object.assign(Object.assign({},f(e.__uuid)),t({},n,r)))},v=function(e){return d(e,"__path")},h=function(e){return d(e,"__isRoot")},_=function(e){return d(e,"__isOpen")},m=function(e){return d(e,"__hasChild")},g=(0,r.computed)((function(){return c.data.filter((function(e){return C(e)}))})),b=function(e){var t;return"object"===n(e)?_(e):"string"==typeof e&&(null===(t=f(e))||void 0===t?void 0:t.__isOpen)},x=function(n){return b(n)?(0,r.createVNode)(o.FolderShapeOpen,{class:(0,e.resolveClassName)("tree-icon")},null):(0,r.createVNode)(o.Folder,{class:(0,e.resolveClassName)("tree-icon")},null)},N=function(e){if("string"==typeof e)return e;if("object"===n(e)&&null!==e){if(e.__v_isVNode)return e;var t=e.node,o=e.className,i=e.text,a=e.style;return(0,r.h)(t,{class:o,style:a},i)}return null},O=function(e,r){if("object"===n(e)&&null!==e){p(r,"__isOpen",!0);var o=Array.isArray(e)?e:[e];!function(e,n,r,o,i){P(e,n,r,t({},o,i))}(v(r),i.data,i.children,i.children,o)}},j=function(e){if(e.async){var n=i.async||{},t=n.callback,r=void 0===t?null:t,o=n.cache,a=void 0===o||o;"function"==typeof r?e.cached||(Object.assign(e,{loading:!0}),r(e,(function(n){return O(n,e)})).then((function(n){return O(n,e)})).catch((function(e){return console.error("load remote data error:",e)})).finally((function(){P(v(e),i.data,i.children,Object.assign({loading:!1},a?{cached:!0}:{}))}))):console.error("async need to set prop: asyncLoad with function wich will return promise object")}m(e)&&function(e){var n=!b(e);p(e,"__isOpen",n),n||g.value.filter((function(n){return String.prototype.startsWith.call(v(n),v(e))})).forEach((function(e){return p(e,"__isOpen",n)}))}(e)},C=function(e){return h(e)||b(e)||b(d(e,"__parentId"))},T=(0,r.ref)(),w=function(){var n;if(null===(n=T.value)||void 0===n?void 0:n.$el){var t=".".concat((0,e.resolveClassName)("tree-node")),r=".".concat((0,e.resolveClassName)("node-content"));Array.prototype.forEach.call(T.value.$el.querySelectorAll(t),(function(e){var n=e.querySelectorAll("".concat(r," span")),t=Array.prototype.slice.call(n,-1)[0];if(t){var o=e.offsetWidth-t.offsetLeft;t.style.setProperty("max-width","".concat(o,"px"))}}))}};return(0,r.onMounted)((function(){w()})),(0,r.onUpdated)((function(){w()})),{renderData:g,flatData:c,root:T,hanldeTreeNodeClick:j,handleNodeContentClick:function(e){u.includes(e.__uuid)||(u.forEach((function(e){return p({__uuid:e},"__checked",!1)})),u.length=0,p(e,"__checked",!0),u.push(e.__uuid),_(e)||j(e),a.emit("check",e,f(e.__uuid)))},handleNodeActionClick:function(e,n){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),j(n)},getActionIcon:function(e){var n=null;return"function"==typeof i.prefixIcon&&"default"!==(n=i.prefixIcon(h(e),m(e)||e.async,b(e),"action",e))?N(n):("default"===n||"boolean"==typeof i.prefixIcon&&i.prefixIcon)&&(m(e)||e.async)?b(e)?(0,r.createVNode)(o.DownShape,null,null):(0,r.createVNode)(o.RightShape,null,null):null},getRootIcon:x,getVirtualLines:function(e){if(!i.levelLine)return null;var n=d(e,"__depth")+1;return new Array(n).fill("").map((function(e,n){return n})).filter((function(n){return function(e,n){if(h(n))return!1;var t=v(n),r="".concat(t).split("-").slice(0,e+1);if(r.join("-")===t)return!0;var o=r.pop(),i=parseInt(o,10);r.push("".concat(i+1));var a=r.join("-");return s.value.some((function(e){return e.__path===a}))}(n,e)})).filter((function(e){return e>0})).map((function(e){return(0,r.createVNode)("span",{class:"node-virtual-line",style:(t=n-e,{"--depth":t})},null);var t}))},getNodePrefixIcon:function(n){var t=null;return"function"==typeof i.prefixIcon&&"default"!==(t=i.prefixIcon(h(n),m(n)||n.async,b(n),"node_type",n))?N(t):"default"===t||"boolean"==typeof i.prefixIcon&&i.prefixIcon?h(n)||m(n)?x(n):(0,r.createVNode)(o.TextFile,{class:(0,e.resolveClassName)("tree-icon")},null):null},getLoadingIcon:function(e){return e.loading?(0,r.createVNode)(o.Spinner,null,null):""}}},render:function(){var n=this,t=this.$props,o=function(o){var i,a,l,u,c;return(0,r.createVNode)("div",{class:j(o,n.flatData.schema)},[(0,r.createVNode)("div",{class:O(o,n.flatData.schema,t),style:N(o,t,n.flatData),onClick:function(){return n.handleNodeContentClick(o)}},[(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-action"),onClick:function(e){return n.handleNodeActionClick(e,o)}},[n.getActionIcon(o)]),(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-content")},[[n.getNodePrefixIcon(o),n.getLoadingIcon(o)],(0,r.createVNode)("span",{class:(0,e.resolveClassName)("node-text")},[null!==(l=null===(a=(i=n.$slots).node)||void 0===a?void 0:a.call(i,o))&&void 0!==l?l:[m(o,t),null===(c=(u=n.$slots).nodeAppend)||void 0===c?void 0:c.call(u,o)]])]),n.getVirtualLines(o)])])};return(0,r.createVNode)(u(),{class:(0,e.resolveClassName)("tree"),style:x(null,t),list:this.renderData,lineHeight:t.lineHeight,enabled:t.virtualRender,contentClassName:(0,e.resolveClassName)("container"),throttleDelay:0,ref:"root"},{default:function(e){return(e.data||[]).map(o)}})}}),T=(0,e.withInstall)(C)})(),l})()));
1
+ !function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n(require("../shared"),require("vue"),require("../virtual-render"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../virtual-render","../icon"],n);else{var t="object"==typeof exports?n(require("../shared"),require("vue"),require("../virtual-render"),require("../icon")):n(e["../shared"],e.vue,e["../virtual-render"],e["../icon"]);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(self,((e,n,t,r)=>(()=>{var o={8022:(e,n,t)=>{var r=t(4481),o=t(6426),i=o;i.v1=r,i.v4=o,e.exports=i},8725:e=>{for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},9157:e=>{var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var t=new Uint8Array(16);e.exports=function(){return n(t),t}}else{var r=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),r[n]=e>>>((3&n)<<3)&255;return r}}},4481:(e,n,t)=>{var r,o,i=t(9157),a=t(8725),l=0,u=0;e.exports=function(e,n,t){var c=n&&t||0,s=n||[],d=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==f){var p=i();null==d&&(d=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==f&&(f=o=16383&(p[6]<<8|p[7]))}var v=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,h=v-l+(y-u)/1e4;if(h<0&&void 0===e.clockseq&&(f=f+1&16383),(h<0||v>l)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=v,u=y,o=f;var _=(1e4*(268435455&(v+=122192928e5))+y)%4294967296;s[c++]=_>>>24&255,s[c++]=_>>>16&255,s[c++]=_>>>8&255,s[c++]=255&_;var m=v/4294967296*1e4&268435455;s[c++]=m>>>8&255,s[c++]=255&m,s[c++]=m>>>24&15|16,s[c++]=m>>>16&255,s[c++]=f>>>8|128,s[c++]=255&f;for(var g=0;g<6;++g)s[c+g]=d[g];return n||a(s)}},6426:(e,n,t)=>{var r=t(9157),o=t(8725);e.exports=function(e,n,t){var i=n&&t||0;"string"==typeof e&&(n="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var l=0;l<16;++l)n[i+l]=a[l];return n||o(a)}},6870:e=>{"use strict";e.exports=r},4212:n=>{"use strict";n.exports=e},3511:e=>{"use strict";e.exports=t},748:e=>{"use strict";e.exports=n}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var t=i[e]={exports:{}};return o[e](t,t.exports,a),t.exports}a.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return a.d(n,{a:n}),n},a.d=(e,n)=>{for(var t in n)a.o(n,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";a.r(l),a.d(l,{default:()=>k});var e=a(4212),n=a(748),t=a(3511),r=a.n(t),o={data:e.PropTypes.arrayOf(e.PropTypes.any).def([]),label:e.PropTypes.oneOfType([e.PropTypes.func.def(void 0),e.PropTypes.string.def("label")]),nodeKey:e.PropTypes.string.def(null),children:e.PropTypes.string.def("children"),indent:e.PropTypes.number.def(18),lineHeight:e.PropTypes.number.def(32),levelLine:e.PropTypes.oneOfType([e.PropTypes.bool.def(!1),e.PropTypes.func.def(void 0),e.PropTypes.string.def("1px dashed #c3cdd7")]).def(!1),virtualRender:e.PropTypes.bool.def(!1),prefixIcon:e.PropTypes.oneOfType([e.PropTypes.func.def((function(){})),e.PropTypes.bool.def(!1)]).def(!0),async:e.PropTypes.shape({callback:e.PropTypes.func.def(null),cache:e.PropTypes.bool.def(!0),deepAutoOpen:e.PropTypes.commonType(["once","every"],"columnType").def("once")}),offsetLeft:e.PropTypes.number.def(5)};function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var u=a(6870);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}const s=function(e){var t=(0,n.computed)((function(){return Array.from(e.schema.values())})),r=function(n){return e.schema.get(n)},o=function(e,n){var t;return null===(t=r(e.__uuid))||void 0===t?void 0:t[n]},a=function(e){return o(e,"__isRoot")},l=function(e){return o(e,"__isOpen")},u=function(e){var n;return"object"===i(e)?l(e):"string"==typeof e&&(null===(n=r(e))||void 0===n?void 0:n.__isOpen)};return{schemaValues:t,getSchemaVal:r,getNodeAttr:o,setNodeAttr:function(n,t,o){return e.schema.set(n.__uuid,Object.assign(Object.assign({},r(n.__uuid)),c({},t,o)))},getNodePath:function(e){return o(e,"__path")},isRootNode:a,isNodeOpened:l,hasChildNode:function(e){return o(e,"__hasChild")},isItemOpen:u,checkNodeIsOpen:function(e){return a(e)||u(e)||u(o(e,"__parentId"))}}};function d(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function f(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return d(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?d(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=a(8022),v=void 0,y="1px dashed #c3cdd7",h=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=e.data,o=e.children,a=[],l=0,u=new Map;function s(n){var t=null;return"string"==typeof e.nodeKey&&(t=n[e.nodeKey]),t||n.__uuid||(0,p.v4)()}function d(e,n,r,o){var i=(t||[]).find((function(n){return n.__uuid===e}));return i?i[o]:n[r]}function f(e,n){return d(e,n,"isOpen","__isOpen")}function v(e,n){return d(e,n,"checked","__checked")}function y(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,d=e.length,p=0;p<d;p++){var h=e[p];if(Array.isArray(h))y(h,n,t,r);else if("object"===i(h)&&null!==h){var _=s(h),m=null!==r?"".concat(r,"-").concat(p):"".concat(p),g=!!(h[o]||[]).length,b=c({__depth:n,__index:p,__uuid:_,__parentId:t,__hasChild:g,__path:m,__isRoot:null===t,__order:l,__isOpen:f(_,h),__checked:v(_,h)},o,null);Object.assign(h,{__uuid:_}),u.set(_,b),l+=1,a.push(Object.assign(Object.assign({},h),c({},o,null))),Object.prototype.hasOwnProperty.call(h,o)&&y(h[o]||[],n+1,_,m)}}}return y(n||r),[a,u]},_=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],a=e[n];return"boolean"==typeof a?a?r:o:m(t,e,n,i)},m=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=n[t];if("string"==typeof o)return"object"===i(e)&&null!==e?(Object.prototype.hasOwnProperty.call(e,o)||console.error("cannot find node label with key ".concat(o)),e[o]):o;if("function"==typeof o){var a=o.apply(v,[e].concat(f(r)));return"string"==typeof a?a:void console.error("props label with function return value is not string, please check and return string")}},g=function(e,n){return m(e,n,"label")},b=function(e,n){return e.get(n)||{}},N=function(e,n,t){var r;return null===(r=b(e,n))||void 0===r?void 0:r[t]},O=function(e,n){return{"--level-line":_(n,"levelLine",e,y,null,["tree"]),"--lineHeight":"".concat(n.lineHeight,"px"),"--indent":"".concat(n.indent,"px"),"--offset-left":"".concat(n.offsetLeft,"px")}},A=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.schema,o=N(r,e.__uuid,"__depth");return Object.assign({"--depth":o},"function"==typeof n.levelLine?{"--level-line":_(n,"levelLine",e,y,null,["node"])}:{})},x=function(e,n,t){var r=b(n,e.__uuid)||{};return{"is-root":r.__isRoot,"bk-tree-node":!0,"is-open":r.__isOpen,"is-virtual-render":t.virtualRender,"level-line":t.levelLine}},P=function(n,t){return c({"is-checked":(b(t,n.__uuid)||{}).__checked},(0,e.resolveClassName)("node-row"),!0)},T=function(e,n,t,r){var o=e.split("-").reduce((function(e,n){var r=Number(n);return Array.isArray(e)?e[r]:e[t][r]}),n);Object.assign(o,r||{})};const j=function(t,r,o,a){var l=[],d=s(o),f=d.setNodeAttr,p=d.getNodePath,v=d.getSchemaVal,y=d.getNodeAttr,h=d.isRootNode,_=d.hasChildNode,m=d.isItemOpen,b=d.isNodeOpened,N=d.schemaValues,O=function(e,n){var t=s(n),r=t.setNodeAttr,o=t.getNodePath,a=t.getNodeAttr,l=function(n,t){if("object"===i(n)&&null!==n){r(t,"__isOpen",!0);var a=Array.isArray(n)?n:[n];!function(e,n,t,r,o){T(e,n,t,c({},r,o))}(o(t),e.data,e.children,e.children,a)}},u=function(n){if(n.async){var t=e.async||{},i=t.callback,a=void 0===i?null:i,u=t.cache,c=void 0===u||u;return r(n,"__isAsyncInit",!0),"function"==typeof a?n.cached?Promise.resolve(!0):(Object.assign(n,{loading:!0}),Promise.resolve(a(n,(function(e){return l(e,n)})).then((function(e){return l(e,n)})).catch((function(e){return console.error("load remote data error:",e)})).finally((function(){T(o(n),e.data,e.children,Object.assign({loading:!1},c?{cached:!0}:{}))})))):Promise.reject("async need to set prop: asyncLoad with function wich will return promise object")}};return{asyncNodeClick:u,deepAutoOpen:function e(){var t=n.data.filter((function(e){return e.async&&e.isOpen&&!a(e,"__isAsyncInit")}));t.length&&Promise.all(t.map((function(e){return u(e)}))).then((function(){e()})).catch((function(e){console.warn(e)}))}}}(t,o),j=O.asyncNodeClick,C=O.deepAutoOpen,k=function(e){if("string"==typeof e)return e;if("object"===i(e)&&null!==e){if(e.__v_isVNode)return e;var t=e.node,r=e.className,o=e.text,a=e.style;return(0,n.h)(t,{class:r,style:a},o)}return null},w=function(e){var r=null;return"function"==typeof t.prefixIcon&&"default"!==(r=t.prefixIcon(h(e),_(e)||e.async,m(e),"action",e))?k(r):("default"===r||"boolean"==typeof t.prefixIcon&&t.prefixIcon)&&(_(e)||e.async)?m(e)?(0,n.createVNode)(u.DownShape,null,null):(0,n.createVNode)(u.RightShape,null,null):null},S=function(r){var o=null;return"function"==typeof t.prefixIcon&&"default"!==(o=t.prefixIcon(h(r),_(r)||r.async,m(r),"node_type",r))?k(o):"default"===o||"boolean"==typeof t.prefixIcon&&t.prefixIcon?h(r)||_(r)?function(t){return m(t)?(0,n.createVNode)(u.FolderShapeOpen,{class:(0,e.resolveClassName)("tree-icon")},null):(0,n.createVNode)(u.Folder,{class:(0,e.resolveClassName)("tree-icon")},null)}(r):(0,n.createVNode)(u.TextFile,{class:(0,e.resolveClassName)("tree-icon")},null):null},I=function(e){return e.loading?(0,n.createVNode)(u.Spinner,null,null):""},V=function(e){j(e),_(e)&&function(e){var n=!m(e);f(e,"__isOpen",n),n||a.value.filter((function(n){return String.prototype.startsWith.call(p(n),p(e))})).forEach((function(e){return f(e,"__isOpen",n)}))}(e)},R=function(e){if(!t.levelLine)return null;var r=y(e,"__depth")+1;return new Array(r).fill("").map((function(e,n){return n})).filter((function(n){return function(e,n){if(h(n))return!1;var t=p(n),r="".concat(t).split("-").slice(0,e+1);if(r.join("-")===t)return!0;var o=r.pop(),i=parseInt(o,10);r.push("".concat(i+1));var a=r.join("-");return N.value.some((function(e){return e.__path===a}))}(n,e)})).filter((function(e){return e>0})).map((function(e){return(0,n.createVNode)("span",{class:"node-virtual-line",style:(t=r-e,{"--depth":t})},null);var t}))};return{renderTreeNode:function(i){var a,u,c,s,d;return(0,n.createVNode)("div",{class:P(i,o.schema)},[(0,n.createVNode)("div",{class:x(i,o.schema,t),style:A(i,t,o),onClick:function(){return function(e){l.includes(e.__uuid)||(l.forEach((function(e){return f({__uuid:e},"__checked",!1)})),l.length=0,f(e,"__checked",!0),l.push(e.__uuid),b(e)||V(e),r.emit("check",e,v(e.__uuid)))}(i)}},[(0,n.createVNode)("span",{class:(0,e.resolveClassName)("node-action"),onClick:function(e){return function(e,n){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),V(n)}(e,i)}},[w(i)]),(0,n.createVNode)("span",{class:(0,e.resolveClassName)("node-content")},[[S(i),I(i)],(0,n.createVNode)("span",{class:(0,e.resolveClassName)("node-text")},[null!==(c=null===(u=(a=r.slots).node)||void 0===u?void 0:u.call(a,i))&&void 0!==c?c:[g(i,t),null===(d=(s=r.slots).nodeAppend)||void 0===d?void 0:d.call(s,i)]])]),R(i)])])},hanldeTreeNodeClick:V,deepAutoOpen:C}},C=(0,n.defineComponent)({name:"Tree",props:o,emits:["check"],setup:function(t,o){var i,a=h(t),l=(0,n.reactive)({data:a[0],schema:a[1],levelLineSchema:{}}),u=s(l),c=u.schemaValues,d=u.setNodeAttr,f=u.checkNodeIsOpen,p=u.getNodeAttr,v=u.isRootNode,y=(0,n.computed)((function(){return l.data.filter((function(e){return f(e)}))})),_=j(t,o,l,y),m=_.renderTreeNode,g=_.hanldeTreeNodeClick,b=_.deepAutoOpen;(null===(i=t.async)||void 0===i?void 0:i.callback)&&b(),(0,n.watch)((function(){return[t.data]}),(function(e){var n,r,o=h(t,e,c.value);l.data=o[0],l.schema=o[1],(null===(n=t.async)||void 0===n?void 0:n.callback)&&"every"===(null===(r=t.async)||void 0===r?void 0:r.deepAutoOpen)&&b()}),{deep:!0});var N=function(e){return"string"==typeof e?{__uuid:e}:(Object.prototype.hasOwnProperty.call(e,"__uuid")||console.error("setNodeAction Error: cannot find uid for the ndoe item"),e)},A=function(e,n,t){Array.isArray(e)?e.forEach((function(e){return d(N(e),n,t)})):d(N(e),n,t)};o.expose({hanldeTreeNodeClick:g,setOpen:function e(n){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=N(n);if(r&&t){if(A(o,"__isOpen",t),!v(o)){var i=p(o,"__parentId");e(i,!0,!0)}}else A(o,"__isOpen",t)},setChecked:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];A(N(e),"__checked",n)},setNodeAction:A});var x=(0,n.ref)(),P=function(){var n;if(null===(n=x.value)||void 0===n?void 0:n.$el){var t=".".concat((0,e.resolveClassName)("tree-node")),r=".".concat((0,e.resolveClassName)("node-content"));Array.prototype.forEach.call(x.value.$el.querySelectorAll(t),(function(e){var n=e.querySelectorAll("".concat(r," span")),t=Array.prototype.slice.call(n,-1)[0];if(t){var o=e.offsetWidth-t.offsetLeft;t.style.setProperty("max-width","".concat(o,"px"))}}))}};return(0,n.onMounted)((function(){P()})),(0,n.onUpdated)((function(){P()})),function(){return(0,n.createVNode)(r(),{class:(0,e.resolveClassName)("tree"),style:O(null,t),list:y.value,lineHeight:t.lineHeight,enabled:t.virtualRender,contentClassName:(0,e.resolveClassName)("container"),throttleDelay:0,ref:x},{default:function(e){return(e.data||[]).map(m)}})}}}),k=(0,e.withInstall)(C)})(),l})()));
@@ -19,6 +19,15 @@ export declare const treeProps: {
19
19
  * 指定节点标签为节点对象的某个属性值
20
20
  */
21
21
  label: import("vue-types").VueTypeDef<any>;
22
+ /**
23
+ * 每个树节点用来作为唯一标识的属性,此标识应该是唯一的
24
+ * 如果设置系统会默认自动生成唯一id
25
+ */
26
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
27
+ default: string;
28
+ } & {
29
+ default: string;
30
+ };
22
31
  /**
23
32
  * 子节点 Key, 用于读取子节点
24
33
  * 默认 children
@@ -84,6 +93,7 @@ export declare const treeProps: {
84
93
  declare type AsyncOption = {
85
94
  callback: (item: any, cb: any) => Promise<any>;
86
95
  cache: Boolean;
96
+ deepAutoOpen?: string;
87
97
  };
88
98
  export declare type TreePropTypes = Readonly<ExtractPropTypes<typeof treeProps>>;
89
99
  export {};
@@ -5,6 +5,11 @@ declare const _default: import("vue").DefineComponent<{
5
5
  default: () => any[];
6
6
  };
7
7
  label: import("vue-types").VueTypeDef<any>;
8
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
9
+ default: string;
10
+ } & {
11
+ default: string;
12
+ };
8
13
  children: import("vue-types").VueTypeValidableDef<string> & {
9
14
  default: string;
10
15
  } & {
@@ -23,6 +28,7 @@ declare const _default: import("vue").DefineComponent<{
23
28
  levelLine: import("vue-types").VueTypeDef<any> & {
24
29
  default: any;
25
30
  };
31
+ /** 如果设置了异步请求 */
26
32
  virtualRender: import("vue-types").VueTypeValidableDef<boolean> & {
27
33
  default: boolean;
28
34
  } & {
@@ -34,33 +40,23 @@ declare const _default: import("vue").DefineComponent<{
34
40
  async: import("vue-types").VueTypeShape<{
35
41
  callback: (item: any, cb: any) => Promise<any>;
36
42
  cache: Boolean;
43
+ deepAutoOpen?: string;
37
44
  }>;
38
45
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
39
46
  default: number;
40
47
  } & {
41
48
  default: number;
42
49
  };
43
- }, {
44
- renderData: import("vue").ComputedRef<any[]>;
45
- flatData: {
46
- data: any[];
47
- schema: any[] | Map<string, any>;
48
- levelLineSchema: {};
49
- };
50
- root: import("vue").Ref<any>;
51
- hanldeTreeNodeClick: (item: any) => void;
52
- handleNodeContentClick: (item: any) => void;
53
- handleNodeActionClick: (e: MouseEvent, node: any) => void;
54
- getActionIcon: (item: any) => any;
55
- getRootIcon: (item: any) => JSX.Element;
56
- getVirtualLines: (node: any) => JSX.Element[];
57
- getNodePrefixIcon: (item: any) => any;
58
- getLoadingIcon: (item: any) => JSX.Element | "";
59
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
50
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
60
51
  data: import("vue-types").VueTypeDef<any[]> & {
61
52
  default: () => any[];
62
53
  };
63
54
  label: import("vue-types").VueTypeDef<any>;
55
+ nodeKey: import("vue-types").VueTypeValidableDef<string> & {
56
+ default: string;
57
+ } & {
58
+ default: string;
59
+ };
64
60
  children: import("vue-types").VueTypeValidableDef<string> & {
65
61
  default: string;
66
62
  } & {
@@ -79,6 +75,7 @@ declare const _default: import("vue").DefineComponent<{
79
75
  levelLine: import("vue-types").VueTypeDef<any> & {
80
76
  default: any;
81
77
  };
78
+ /** 如果设置了异步请求 */
82
79
  virtualRender: import("vue-types").VueTypeValidableDef<boolean> & {
83
80
  default: boolean;
84
81
  } & {
@@ -90,6 +87,7 @@ declare const _default: import("vue").DefineComponent<{
90
87
  async: import("vue-types").VueTypeShape<{
91
88
  callback: (item: any, cb: any) => Promise<any>;
92
89
  cache: Boolean;
90
+ deepAutoOpen?: string;
93
91
  }>;
94
92
  offsetLeft: import("vue-types").VueTypeValidableDef<number> & {
95
93
  default: number;
@@ -103,6 +101,7 @@ declare const _default: import("vue").DefineComponent<{
103
101
  lineHeight: number;
104
102
  prefixIcon: any;
105
103
  children: string;
104
+ nodeKey: string;
106
105
  indent: number;
107
106
  levelLine: any;
108
107
  virtualRender: boolean;
@@ -0,0 +1,5 @@
1
+ declare const _default: (props: any, flatData: any) => {
2
+ asyncNodeClick: (item: any) => Promise<any>;
3
+ deepAutoOpen: () => void;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: (props: any, ctx: any, flatData: any, renderData: any) => {
2
+ renderTreeNode: (item: any) => JSX.Element;
3
+ hanldeTreeNodeClick: (item: any) => void;
4
+ deepAutoOpen: () => void;
5
+ };
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ declare const _default: (flatData: any) => {
2
+ schemaValues: import("vue").ComputedRef<unknown[]>;
3
+ getSchemaVal: (key: string) => any;
4
+ getNodeAttr: (node: any, attr: string) => any;
5
+ setNodeAttr: (node: any, attr: string, val: any) => Map<string, any>;
6
+ getNodePath: (node: any) => any;
7
+ isRootNode: (node: any) => any;
8
+ isNodeOpened: (node: any) => any;
9
+ hasChildNode: (node: any) => any;
10
+ isItemOpen: (item: any) => any;
11
+ checkNodeIsOpen: (node: any) => any;
12
+ };
13
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "0.0.1-beta.58",
3
+ "version": "0.0.1-beta.60",
4
4
  "workspaces": {
5
5
  "packages": [
6
6
  "packages/!(**.bak)*",
@@ -31,8 +31,8 @@
31
31
  "fix:site": "eslint ./site --ext .js,.ts,.tsx,.vue --fix --cache",
32
32
  "fix:scripts": "eslint ./scripts --ext .js,.ts,.tsx --fix --cache",
33
33
  "lint:fix": "run-p lint:site lint:packages lint:scripts",
34
- "stylelint": "eslint --ext .js,.ts,.tsx,.vue ./packages ./site --cache",
35
- "stylelint:fix": "yarn stylelint -- --fix",
34
+ "stylelint": "stylelint ./{packages,site}/**/*.{vue,less} --custom-syntax",
35
+ "stylelint:fix": "stylelint --fix ./{packages,site}/**/*.{vue,less} --custom-syntax",
36
36
  "test:unit": "jest --passWithNoTests --config=./jest.config.js",
37
37
  "test:alert": "lerna run --scope @bkui-vue/alert test",
38
38
  "cz": "git-cz"
@@ -123,7 +123,7 @@
123
123
  "eslint ./packages --ext .js,.tsx,.ts --cache --fix",
124
124
  "git add"
125
125
  ],
126
- "*.(vue|scss|css|sass)": [
126
+ "*.(vue|scss|css|sass|less)": [
127
127
  "stylelint --cache --fix",
128
128
  "git add"
129
129
  ]