@veltra/desktop 1.3.4 → 1.3.5

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 (34) hide show
  1. package/dist/components/action/action-group.vue.d.ts +2 -2
  2. package/dist/components/action/action.vue.d.ts +1 -1
  3. package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
  4. package/dist/components/cascade/cascade.vue.d.ts +4 -4
  5. package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
  6. package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
  7. package/dist/components/code-editor/code-editor.vue.d.ts +2 -2
  8. package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
  9. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  10. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  11. package/dist/components/input/input.vue.d.ts +4 -4
  12. package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
  13. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +5 -5
  14. package/dist/components/number-input/number-input.vue.d.ts +4 -4
  15. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  16. package/dist/components/password-input/password-input.vue.d.ts +1 -1
  17. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  18. package/dist/components/progress-nodes/progress-nodes.vue.d.ts +1 -1
  19. package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
  20. package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
  21. package/dist/components/select/select.vue.d.ts +2 -2
  22. package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
  23. package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
  24. package/dist/components/tabs/tabs.vue.d.ts +2 -2
  25. package/dist/components/textarea/textarea.vue.d.ts +4 -4
  26. package/dist/components/tip/tip.vue.d.ts +1 -1
  27. package/dist/components/tree/tree.vue.d.ts +1 -1
  28. package/dist/components/tree/use-tree-nodes.js +14 -17
  29. package/dist/components/tree/use-tree-nodes.js.map +1 -1
  30. package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
  31. package/dist/types/tree.d.ts +4 -1
  32. package/package.json +6 -6
  33. package/src/components/tree/use-tree-nodes.ts +19 -24
  34. package/src/types/tree.ts +4 -1
@@ -6,11 +6,11 @@ type __VLS_Slots = {
6
6
  default?: () => VNode[];
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<ActionGroupProps, _ActionGroupExposed, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionGroupProps> & Readonly<{}>, {
9
- size: "small" | "default" | "large";
10
9
  type: import("@veltra/utils").ColorType;
10
+ size: "small" | "default" | "large";
11
11
  text: boolean;
12
- max: number;
13
12
  circle: boolean;
13
+ max: number;
14
14
  loading: boolean;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -14,8 +14,8 @@ declare const __VLS_base: import("vue").DefineComponent<ActionProps, {}, {}, {},
14
14
  }, string, import("vue").PublicProps, Readonly<ActionProps> & Readonly<{
15
15
  onRun?: (() => any) | undefined;
16
16
  }>, {
17
- size: import("@veltra/utils").ComponentSize;
18
17
  type: ButtonType;
18
+ size: import("@veltra/utils").ComponentSize;
19
19
  text: boolean;
20
20
  circle: boolean;
21
21
  loading: boolean;
@@ -23,10 +23,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Auto
23
23
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
24
24
  onSelect?: ((value: string) => any) | undefined;
25
25
  }>, {
26
- disabled: boolean;
27
- readonly: boolean;
28
26
  placeholder: string;
29
27
  clearable: boolean;
28
+ disabled: boolean;
29
+ readonly: boolean;
30
30
  allowCustom: boolean;
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -3,17 +3,15 @@ import "../../types/index.js";
3
3
  //#region src/components/cascade/cascade.vue.d.ts
4
4
  declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
5
  "update:modelValue": (value?: string | string[] | undefined) => any;
6
- change: (...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any;
7
6
  clear: () => any;
7
+ change: (...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any;
8
8
  "update:label": (label?: string | string[] | undefined) => any;
9
9
  }, string, import("vue").PublicProps, Readonly<CascadeProps> & Readonly<{
10
10
  "onUpdate:modelValue"?: ((value?: string | string[] | undefined) => any) | undefined;
11
- onChange?: ((...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any) | undefined;
12
11
  onClear?: (() => any) | undefined;
12
+ onChange?: ((...args: [item?: Record<string, any> | undefined] | [items: Record<string, any>[]]) => any) | undefined;
13
13
  "onUpdate:label"?: ((label?: string | string[] | undefined) => any) | undefined;
14
14
  }>, {
15
- disabled: boolean;
16
- readonly: boolean;
17
15
  labelKey: string;
18
16
  valueKey: string;
19
17
  childrenKey: string;
@@ -21,6 +19,8 @@ declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {},
21
19
  placeholder: string;
22
20
  clearable: boolean;
23
21
  filterable: boolean;
22
+ disabled: boolean;
23
+ readonly: boolean;
24
24
  visibilityLimit: number;
25
25
  separator: string;
26
26
  showFullPath: boolean;
@@ -18,9 +18,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
18
18
  "onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
19
19
  onChange?: ((checked: boolean) => any) | undefined;
20
20
  }>, {
21
+ type: import("@veltra/utils").ColorType;
21
22
  disabled: boolean;
22
23
  readonly: boolean;
23
- type: import("@veltra/utils").ColorType;
24
24
  round: boolean;
25
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -13,10 +13,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
13
13
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
14
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
15
15
  }>, {
16
- disabled: boolean;
17
- readonly: boolean;
18
16
  labelKey: string;
19
17
  valueKey: string;
18
+ disabled: boolean;
19
+ readonly: boolean;
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const _default: typeof __VLS_export;
22
22
  //#endregion
@@ -12,12 +12,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  "update:lang": (value: CodeEditorLang | undefined) => any;
13
13
  } & {
14
14
  "update:modelValue": (value: string) => any;
15
- "update:lang": (value: CodeEditorLang | undefined) => any;
16
15
  change: (value: string) => any;
16
+ "update:lang": (value: CodeEditorLang | undefined) => any;
17
17
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
18
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
19
- "onUpdate:lang"?: ((value: CodeEditorLang | undefined) => any) | undefined;
20
19
  onChange?: ((value: string) => any) | undefined;
20
+ "onUpdate:lang"?: ((value: CodeEditorLang | undefined) => any) | undefined;
21
21
  }>, {
22
22
  disabled: boolean;
23
23
  readonly: boolean;
@@ -8,8 +8,8 @@ declare const __VLS_export: import("vue").DefineComponent<DatePanelProps, {}, {}
8
8
  "onSelect:range-date"?: ((rangeDate?: [import("@cat-kit/core").Dater, import("@cat-kit/core").Dater] | undefined) => any) | undefined;
9
9
  "onSelect:date"?: ((date: import("@cat-kit/core").Dater) => any) | undefined;
10
10
  }>, {
11
- size: import("@veltra/utils").ComponentSize;
12
11
  type: "date" | "month" | "year";
12
+ size: import("@veltra/utils").ComponentSize;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
15
15
  //#endregion
@@ -6,11 +6,11 @@ declare const __VLS_export: import("vue").DefineComponent<DatePickerProps, {}, {
6
6
  }, string, import("vue").PublicProps, Readonly<DatePickerProps> & Readonly<{
7
7
  "onUpdate:modelValue"?: ((value?: string | number | Date | undefined) => any) | undefined;
8
8
  }>, {
9
- disabled: boolean;
10
- readonly: boolean;
11
9
  type: "date" | "month" | "year";
12
10
  placeholder: string;
13
11
  clearable: boolean;
12
+ disabled: boolean;
13
+ readonly: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
15
  declare const _default: typeof __VLS_export;
16
16
  //#endregion
@@ -6,11 +6,11 @@ declare const __VLS_export: import("vue").DefineComponent<DateRangePickerProps,
6
6
  }, string, import("vue").PublicProps, Readonly<DateRangePickerProps> & Readonly<{
7
7
  "onUpdate:modelValue"?: ((value?: [string, string] | undefined) => any) | undefined;
8
8
  }>, {
9
- disabled: boolean;
10
- readonly: boolean;
11
9
  type: "date" | "month" | "year";
12
10
  placeholder: [string, string];
13
11
  clearable: boolean;
12
+ disabled: boolean;
13
+ readonly: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
15
  declare const _default: typeof __VLS_export;
16
16
  //#endregion
@@ -16,8 +16,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
16
16
  "update:modelValue": (value: string | undefined) => any;
17
17
  } & {
18
18
  "update:modelValue": (value: string) => any;
19
- change: (value: string) => any;
20
19
  clear: () => any;
20
+ change: (value: string) => any;
21
21
  "suffix:click": (value?: string | undefined) => any;
22
22
  "prefix:click": (value?: string | undefined) => any;
23
23
  focus: (value?: string | undefined) => any;
@@ -25,18 +25,18 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, _Inpu
25
25
  "native:input": (ev: Event) => any;
26
26
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
27
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
28
- onChange?: ((value: string) => any) | undefined;
29
28
  onClear?: (() => any) | undefined;
29
+ onChange?: ((value: string) => any) | undefined;
30
30
  "onSuffix:click"?: ((value?: string | undefined) => any) | undefined;
31
31
  "onPrefix:click"?: ((value?: string | undefined) => any) | undefined;
32
32
  onFocus?: ((value?: string | undefined) => any) | undefined;
33
33
  onBlur?: ((value?: string | undefined) => any) | undefined;
34
34
  "onNative:input"?: ((ev: Event) => any) | undefined;
35
35
  }>, {
36
- disabled: boolean;
37
- readonly: boolean;
38
36
  placeholder: string;
39
37
  clearable: boolean;
38
+ disabled: boolean;
39
+ readonly: boolean;
40
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
41
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
42
  declare const _default: typeof __VLS_export;
@@ -27,13 +27,13 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
27
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
28
28
  onChange?: ((options: Record<string, any>[]) => any) | undefined;
29
29
  }>, {
30
- disabled: boolean;
31
- readonly: boolean;
32
30
  labelKey: string;
33
31
  valueKey: string;
34
32
  placeholder: string;
35
33
  clearable: boolean;
36
34
  minWidth: string;
35
+ disabled: boolean;
36
+ readonly: boolean;
37
37
  visibilityLimit: number;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
39
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -14,22 +14,22 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
14
14
  "update:modelValue": (value: (string | number)[]) => any;
15
15
  } & {
16
16
  "update:modelValue": (value: any[]) => any;
17
- change: (checked: Record<string, any>[]) => any;
18
17
  clear: () => any;
18
+ change: (checked: Record<string, any>[]) => any;
19
19
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
20
  "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
21
- onChange?: ((checked: Record<string, any>[]) => any) | undefined;
22
21
  onClear?: (() => any) | undefined;
22
+ onChange?: ((checked: Record<string, any>[]) => any) | undefined;
23
23
  }>, {
24
- disabled: boolean;
25
- readonly: boolean;
26
- expandAll: boolean;
27
24
  labelKey: string;
28
25
  valueKey: string;
26
+ expandAll: boolean;
29
27
  placeholder: string;
30
28
  clearable: boolean;
31
29
  filterable: boolean;
32
30
  minWidth: string;
31
+ disabled: boolean;
32
+ readonly: boolean;
33
33
  visibilityLimit: number;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
35
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -15,17 +15,17 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
15
15
  "update:modelValue": (value: number | undefined) => any;
16
16
  } & {
17
17
  "update:modelValue": (value?: number | undefined) => any;
18
- change: (value?: number | undefined) => any;
19
18
  clear: () => any;
19
+ change: (value?: number | undefined) => any;
20
20
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
21
21
  "onUpdate:modelValue"?: ((value?: number | undefined) => any) | undefined;
22
- onChange?: ((value?: number | undefined) => any) | undefined;
23
22
  onClear?: (() => any) | undefined;
23
+ onChange?: ((value?: number | undefined) => any) | undefined;
24
24
  }>, {
25
- disabled: boolean;
26
- readonly: boolean;
27
25
  placeholder: string;
28
26
  clearable: boolean;
27
+ disabled: boolean;
28
+ readonly: boolean;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
31
  declare const _default: typeof __VLS_export;
@@ -23,9 +23,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
23
23
  "onUpdate:start"?: ((value: number | undefined) => any) | undefined;
24
24
  "onUpdate:end"?: ((value: number | undefined) => any) | undefined;
25
25
  }>, {
26
+ clearable: boolean;
26
27
  disabled: boolean;
27
28
  readonly: boolean;
28
- clearable: boolean;
29
29
  startPlaceholder: string;
30
30
  endPlaceholder: string;
31
31
  separator: string;
@@ -14,9 +14,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
15
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
16
16
  }>, {
17
+ clearable: boolean;
17
18
  disabled: boolean;
18
19
  readonly: boolean;
19
- clearable: boolean;
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
22
  declare const _default: typeof __VLS_export;
@@ -14,8 +14,8 @@ declare const __VLS_base: import("vue").DefineComponent<PopConfirmProps, {}, {},
14
14
  onConfirm?: (() => any) | undefined;
15
15
  onCancel?: (() => any) | undefined;
16
16
  }>, {
17
- direction: TipDirection;
18
17
  trigger: "hover" | "click";
18
+ direction: TipDirection;
19
19
  icon: import("vue").Component;
20
20
  iconColor: string;
21
21
  confirmText: string;
@@ -20,9 +20,9 @@ declare const __VLS_base: import("vue").DefineComponent<ProgressNodesProps, {},
20
20
  "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
21
21
  onClick?: ((node: Record<string, any>, index: number) => any) | undefined;
22
22
  }>, {
23
+ colorType: import("@veltra/utils").ColorType;
23
24
  labelKey: string;
24
25
  valueKey: string;
25
- colorType: import("@veltra/utils").ColorType;
26
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
27
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
28
  declare const _default: typeof __VLS_export;
@@ -15,10 +15,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
15
15
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
16
16
  onChange?: ((item: Record<string, any>) => any) | undefined;
17
17
  }>, {
18
- disabled: boolean;
19
- readonly: boolean;
20
18
  labelKey: string;
21
19
  valueKey: string;
20
+ disabled: boolean;
21
+ readonly: boolean;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
23
  declare const _default: typeof __VLS_export;
24
24
  //#endregion
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<RichTextEditorProps &
12
12
  }> & Readonly<{
13
13
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
14
14
  }>, {
15
+ placeholder: string;
15
16
  disabled: boolean;
16
17
  readonly: boolean;
17
- placeholder: string;
18
18
  format: RichTextFormat;
19
19
  toolbar: ToolbarItem[];
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -27,12 +27,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
27
  "onUpdate:text"?: ((value: any) => any) | undefined;
28
28
  "onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
29
29
  }>, {
30
- disabled: boolean;
31
- readonly: boolean;
32
30
  labelKey: string;
33
31
  valueKey: string;
34
32
  placeholder: string;
35
33
  clearable: boolean;
34
+ disabled: boolean;
35
+ readonly: boolean;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
38
38
  declare const _default: typeof __VLS_export;
@@ -16,12 +16,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
16
16
  "update:modelValue": (value: string | undefined) => any;
17
17
  } & {
18
18
  "update:modelValue": (value: string) => any;
19
- close: (item: TabItem, index: number) => any;
20
19
  click: (item: TabItem, index: number) => any;
20
+ close: (item: TabItem, index: number) => any;
21
21
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
22
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
23
- onClose?: ((item: TabItem, index: number) => any) | undefined;
24
23
  onClick?: ((item: TabItem, index: number) => any) | undefined;
24
+ onClose?: ((item: TabItem, index: number) => any) | undefined;
25
25
  }>, {
26
26
  closable: boolean;
27
27
  block: boolean;
@@ -16,12 +16,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
16
16
  "update:modelValue": (value: string | undefined) => any;
17
17
  } & {
18
18
  "update:modelValue": (value: string) => any;
19
- close: (item: TabItem, index: number) => any;
20
19
  click: (item: TabItem, index: number) => any;
20
+ close: (item: TabItem, index: number) => any;
21
21
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
22
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
23
- onClose?: ((item: TabItem, index: number) => any) | undefined;
24
23
  onClick?: ((item: TabItem, index: number) => any) | undefined;
24
+ onClose?: ((item: TabItem, index: number) => any) | undefined;
25
25
  }>, {
26
26
  closable: boolean;
27
27
  rounded: boolean;
@@ -11,12 +11,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
11
11
  "update:modelValue": (value: string | undefined) => any;
12
12
  } & {
13
13
  "update:modelValue": (value: string) => any;
14
- close: (item: TabItem, index: number) => any;
15
14
  click: (item: TabItem, index: number) => any;
15
+ close: (item: TabItem, index: number) => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
- onClose?: ((item: TabItem, index: number) => any) | undefined;
19
18
  onClick?: ((item: TabItem, index: number) => any) | undefined;
19
+ onClose?: ((item: TabItem, index: number) => any) | undefined;
20
20
  }>, {
21
21
  closable: boolean;
22
22
  block: boolean;
@@ -10,21 +10,21 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
10
10
  "update:modelValue": (value: string | undefined) => any;
11
11
  } & {
12
12
  "update:modelValue": (value: string) => any;
13
- change: (value: string) => any;
14
13
  clear: () => any;
14
+ change: (value: string) => any;
15
15
  focus: () => any;
16
16
  blur: () => any;
17
17
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
18
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
19
- onChange?: ((value: string) => any) | undefined;
20
19
  onClear?: (() => any) | undefined;
20
+ onChange?: ((value: string) => any) | undefined;
21
21
  onFocus?: (() => any) | undefined;
22
22
  onBlur?: (() => any) | undefined;
23
23
  }>, {
24
- disabled: boolean;
25
- readonly: boolean;
26
24
  placeholder: string;
27
25
  clearable: boolean;
26
+ disabled: boolean;
27
+ readonly: boolean;
28
28
  resize: boolean;
29
29
  autosize: boolean;
30
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -11,10 +11,10 @@ declare const __VLS_base: import("vue").DefineComponent<TipProps, {}, {}, {}, {}
11
11
  }, string, import("vue").PublicProps, Readonly<TipProps> & Readonly<{
12
12
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
13
13
  }>, {
14
- direction: TipDirection;
15
14
  trigger: "hover" | "click";
16
15
  contentTag: string;
17
16
  visible: boolean;
17
+ direction: TipDirection;
18
18
  content: string;
19
19
  alignment: TipAlign;
20
20
  showDelay: number;
@@ -21,9 +21,9 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, _TreeExposed,
21
21
  "onNode-contextmenu"?: ((event: MouseEvent, node: TreeNode<Record<string, any>>) => any) | undefined;
22
22
  "onSelected-synced"?: ((selected?: Record<string, any> | undefined) => any) | undefined;
23
23
  }>, {
24
- expandOnClickNode: boolean;
25
24
  labelKey: string;
26
25
  valueKey: string;
26
+ expandOnClickNode: boolean;
27
27
  childrenKey: string;
28
28
  data: Record<string, any>[];
29
29
  checkStrictly: boolean;
@@ -12,36 +12,33 @@ function useTreeNodes(options) {
12
12
  const nodeDictRef = shallowRef(/* @__PURE__ */ new Map());
13
13
  const nodes = shallowRef([]);
14
14
  function buildForest() {
15
- const { disabledNode, expandAll = false } = props;
15
+ const { expandAll = false } = props;
16
16
  const childrenKey = props.childrenKey ?? "children";
17
17
  const valueKey = fieldKey(props.valueKey, "value");
18
18
  const labelKey = fieldKey(props.labelKey, "label");
19
- function createNode(data, index, depth, parent) {
20
- const node = new TreeNode$1({
21
- data,
22
- index,
23
- depth,
24
- parent,
25
- valueKey,
26
- labelKey
27
- });
28
- node.expanded = expandAll;
29
- return node;
30
- }
31
19
  return new Forest({
32
20
  data: props.data ?? [],
33
21
  childrenKey,
34
- createNode: disabledNode ? (data, index, depth, _f, parent) => {
35
- const node = createNode(data, index, depth, parent);
36
- if (data) node.disabled = disabledNode(data, node) ?? false;
22
+ createNode: (data, index, depth, _f, parent) => {
23
+ const node = new TreeNode$1({
24
+ data,
25
+ index,
26
+ depth,
27
+ parent,
28
+ valueKey,
29
+ labelKey
30
+ });
31
+ node.expanded = expandAll;
37
32
  return node;
38
- } : (data, index, depth, _f, parent) => createNode(data, index, depth, parent)
33
+ }
39
34
  });
40
35
  }
41
36
  function rebuildForest() {
42
37
  const nextForest = buildForest();
43
38
  const nextDict = /* @__PURE__ */ new Map();
39
+ const { disabledNode } = props;
44
40
  nextForest.dfs((node) => {
41
+ if (disabledNode && node.data) node.disabled = disabledNode(node.data, node) ?? false;
45
42
  nextDict.set(node.key, node);
46
43
  });
47
44
  forestRef.value = nextForest;
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree-nodes.js","names":["TreeNode"],"sources":["../../../src/components/tree/use-tree-nodes.ts"],"sourcesContent":["import { Forest } from '@cat-kit/core'\nimport { fieldKey } from '@veltra/utils'\nimport { computed, shallowRef, triggerRef, watch, type ShallowRef, type ComputedRef } from 'vue'\n\nimport type { TreeProps } from '../../types'\nimport { TreeNode } from './tree-node'\n\ninterface Options {\n props: TreeProps\n}\n\ninterface UseTreeNodesReturned {\n nodes: ShallowRef<TreeNode[]>\n forest: ComputedRef<Forest<Record<string, unknown>, any>>\n getFlattedNodes: () => void\n nodeDict: ComputedRef<Map<string | number, TreeNode>>\n /** 强制刷新 `nodes` 的订阅者(供字段级别变化但列表引用不变时手动触发)。 */\n triggerNodes: () => void\n}\n\nexport function useTreeNodes(options: Options): UseTreeNodesReturned {\n const { props } = options\n\n // forest / nodeDict 保持为 shallowRef 而非 computed:\n // - computed 会因为任一 prop 变化(尤其是内联 disabledNode 函数)而整棵重建,\n // 丢失 expanded/checked/visible 等运行时状态;\n // - 显式 watch 仅在真正影响结构的输入变化时才重建,行为可控、可测量。\n const forestRef = shallowRef<Forest<Record<string, unknown>, any>>(\n new Forest<Record<string, unknown>, any>({\n data: [],\n childrenKey: props.childrenKey ?? 'children'\n })\n )\n\n const nodeDictRef = shallowRef<Map<string | number, TreeNode>>(new Map())\n\n const nodes = shallowRef<TreeNode[]>([])\n\n function buildForest(): Forest<Record<string, unknown>, any> {\n const { disabledNode, expandAll = false } = props\n const childrenKey = props.childrenKey ?? 'children'\n const valueKey = fieldKey(props.valueKey, 'value')\n const labelKey = fieldKey(props.labelKey, 'label')\n\n function createNode(\n data: Record<string, any>,\n index: number,\n depth: number,\n parent?: TreeNode\n ): TreeNode {\n const node = new TreeNode({ data, index, depth, parent, valueKey, labelKey })\n node.expanded = expandAll\n return node\n }\n\n return new Forest<Record<string, unknown>, any>({\n data: (props.data ?? []) as Record<string, unknown>[],\n childrenKey,\n createNode: disabledNode\n ? (data, index, depth, _f, parent) => {\n const node = createNode(data as Record<string, any>, index, depth, parent as TreeNode)\n if (data) {\n node.disabled = disabledNode(data as Record<string, any>, node) ?? false\n }\n return node\n }\n : (data, index, depth, _f, parent) =>\n createNode(data as Record<string, any>, index, depth, parent as TreeNode)\n })\n }\n\n function rebuildForest(): void {\n const nextForest = buildForest()\n const nextDict = new Map<string | number, TreeNode>()\n\n // 构建森林的同时一次 DFS 同步填充字典,\n // 避免旧版 “forest computed → nodeDict computed” 两次完整遍历。\n nextForest.dfs((node) => {\n nextDict.set(node.key, node)\n })\n\n forestRef.value = nextForest\n nodeDictRef.value = nextDict\n\n getFlattedNodes()\n }\n\n /** 按展开与可见性扁平化:仅一次 DFS。 */\n function getFlattedNodes(): void {\n const result: TreeNode[] = []\n const roots = forestRef.value.roots as TreeNode[]\n\n const stack: TreeNode[] = []\n for (let i = roots.length - 1; i >= 0; i--) {\n stack.push(roots[i]!)\n }\n\n while (stack.length) {\n const node = stack.pop()!\n if (!node.visible) continue\n result.push(node)\n if (node.expanded && node.children && node.children.length) {\n for (let i = node.children.length - 1; i >= 0; i--) {\n stack.push(node.children[i]!)\n }\n }\n }\n\n nodes.value = result\n }\n\n function triggerNodes(): void {\n triggerRef(nodes)\n }\n\n watch(\n [\n () => props.data,\n () => props.disabledNode,\n () => props.childrenKey,\n () => props.valueKey,\n () => props.labelKey,\n () => props.expandAll\n ],\n () => {\n rebuildForest()\n },\n { immediate: true }\n )\n\n const forest = computed(() => forestRef.value)\n const nodeDict = computed(() => nodeDictRef.value)\n\n return { nodes, forest, getFlattedNodes, nodeDict, triggerNodes }\n}\n"],"mappings":";;;;;AAoBA,SAAgB,aAAa,SAAwC;CACnE,MAAM,EAAE,UAAU;CAMlB,MAAM,YAAY,WAChB,IAAI,OAAqC;EACvC,MAAM,CAAC;EACP,aAAa,MAAM,eAAe;CACpC,CAAC,CACH;CAEA,MAAM,cAAc,2BAA2C,IAAI,IAAI,CAAC;CAExE,MAAM,QAAQ,WAAuB,CAAC,CAAC;CAEvC,SAAS,cAAoD;EAC3D,MAAM,EAAE,cAAc,YAAY,UAAU;EAC5C,MAAM,cAAc,MAAM,eAAe;EACzC,MAAM,WAAW,SAAS,MAAM,UAAU,OAAO;EACjD,MAAM,WAAW,SAAS,MAAM,UAAU,OAAO;EAEjD,SAAS,WACP,MACA,OACA,OACA,QACU;GACV,MAAM,OAAO,IAAIA,WAAS;IAAE;IAAM;IAAO;IAAO;IAAQ;IAAU;GAAS,CAAC;GAC5E,KAAK,WAAW;GAChB,OAAO;EACT;EAEA,OAAO,IAAI,OAAqC;GAC9C,MAAO,MAAM,QAAQ,CAAC;GACtB;GACA,YAAY,gBACP,MAAM,OAAO,OAAO,IAAI,WAAW;IAClC,MAAM,OAAO,WAAW,MAA6B,OAAO,OAAO,MAAkB;IACrF,IAAI,MACF,KAAK,WAAW,aAAa,MAA6B,IAAI,KAAK;IAErE,OAAO;GACT,KACC,MAAM,OAAO,OAAO,IAAI,WACvB,WAAW,MAA6B,OAAO,OAAO,MAAkB;EAChF,CAAC;CACH;CAEA,SAAS,gBAAsB;EAC7B,MAAM,aAAa,YAAY;EAC/B,MAAM,2BAAW,IAAI,IAA+B;EAIpD,WAAW,KAAK,SAAS;GACvB,SAAS,IAAI,KAAK,KAAK,IAAI;EAC7B,CAAC;EAED,UAAU,QAAQ;EAClB,YAAY,QAAQ;EAEpB,gBAAgB;CAClB;;CAGA,SAAS,kBAAwB;EAC/B,MAAM,SAAqB,CAAC;EAC5B,MAAM,QAAQ,UAAU,MAAM;EAE9B,MAAM,QAAoB,CAAC;EAC3B,KAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KACrC,MAAM,KAAK,MAAM,EAAG;EAGtB,OAAO,MAAM,QAAQ;GACnB,MAAM,OAAO,MAAM,IAAI;GACvB,IAAI,CAAC,KAAK,SAAS;GACnB,OAAO,KAAK,IAAI;GAChB,IAAI,KAAK,YAAY,KAAK,YAAY,KAAK,SAAS,QAClD,KAAK,IAAI,IAAI,KAAK,SAAS,SAAS,GAAG,KAAK,GAAG,KAC7C,MAAM,KAAK,KAAK,SAAS,EAAG;EAGlC;EAEA,MAAM,QAAQ;CAChB;CAEA,SAAS,eAAqB;EAC5B,WAAW,KAAK;CAClB;CAEA,MACE;QACQ,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;CACd,SACM;EACJ,cAAc;CAChB,GACA,EAAE,WAAW,KAAK,CACpB;CAKA,OAAO;EAAE;EAAO,QAHD,eAAe,UAAU,KAGnB;EAAG;EAAiB,UAFxB,eAAe,YAAY,KAEI;EAAG;CAAa;AAClE"}
1
+ {"version":3,"file":"use-tree-nodes.js","names":["TreeNode"],"sources":["../../../src/components/tree/use-tree-nodes.ts"],"sourcesContent":["import { Forest } from '@cat-kit/core'\nimport { fieldKey } from '@veltra/utils'\nimport { computed, shallowRef, triggerRef, watch, type ShallowRef, type ComputedRef } from 'vue'\n\nimport type { TreeProps } from '../../types'\nimport { TreeNode } from './tree-node'\n\ninterface Options {\n props: TreeProps\n}\n\ninterface UseTreeNodesReturned {\n nodes: ShallowRef<TreeNode[]>\n forest: ComputedRef<Forest<Record<string, unknown>, any>>\n getFlattedNodes: () => void\n nodeDict: ComputedRef<Map<string | number, TreeNode>>\n /** 强制刷新 `nodes` 的订阅者(供字段级别变化但列表引用不变时手动触发)。 */\n triggerNodes: () => void\n}\n\nexport function useTreeNodes(options: Options): UseTreeNodesReturned {\n const { props } = options\n\n // forest / nodeDict 保持为 shallowRef 而非 computed:\n // - computed 会因为任一 prop 变化(尤其是内联 disabledNode 函数)而整棵重建,\n // 丢失 expanded/checked/visible 等运行时状态;\n // - 显式 watch 仅在真正影响结构的输入变化时才重建,行为可控、可测量。\n const forestRef = shallowRef<Forest<Record<string, unknown>, any>>(\n new Forest<Record<string, unknown>, any>({\n data: [],\n childrenKey: props.childrenKey ?? 'children'\n })\n )\n\n const nodeDictRef = shallowRef<Map<string | number, TreeNode>>(new Map())\n\n const nodes = shallowRef<TreeNode[]>([])\n\n function buildForest(): Forest<Record<string, unknown>, any> {\n const { expandAll = false } = props\n const childrenKey = props.childrenKey ?? 'children'\n const valueKey = fieldKey(props.valueKey, 'value')\n const labelKey = fieldKey(props.labelKey, 'label')\n\n return new Forest<Record<string, unknown>, any>({\n data: (props.data ?? []) as Record<string, unknown>[],\n childrenKey,\n createNode: (data, index, depth, _f, parent) => {\n const node = new TreeNode({\n data: data as Record<string, any>,\n index,\n depth,\n parent: parent as TreeNode | undefined,\n valueKey,\n labelKey\n })\n node.expanded = expandAll\n return node\n }\n })\n }\n\n function rebuildForest(): void {\n const nextForest = buildForest()\n const nextDict = new Map<string | number, TreeNode>()\n const { disabledNode } = props\n\n // Forest 的 createNode 返回时 children 尚未挂载,因此 disabledNode 必须在\n // 整棵树构建完成后再调用,才能安全访问 node.children / node.isLeaf。\n nextForest.dfs((node) => {\n if (disabledNode && node.data) {\n node.disabled = disabledNode(node.data as Record<string, any>, node) ?? false\n }\n nextDict.set(node.key, node)\n })\n\n forestRef.value = nextForest\n nodeDictRef.value = nextDict\n\n getFlattedNodes()\n }\n\n /** 按展开与可见性扁平化:仅一次 DFS。 */\n function getFlattedNodes(): void {\n const result: TreeNode[] = []\n const roots = forestRef.value.roots as TreeNode[]\n\n const stack: TreeNode[] = []\n for (let i = roots.length - 1; i >= 0; i--) {\n stack.push(roots[i]!)\n }\n\n while (stack.length) {\n const node = stack.pop()!\n if (!node.visible) continue\n result.push(node)\n if (node.expanded && node.children && node.children.length) {\n for (let i = node.children.length - 1; i >= 0; i--) {\n stack.push(node.children[i]!)\n }\n }\n }\n\n nodes.value = result\n }\n\n function triggerNodes(): void {\n triggerRef(nodes)\n }\n\n watch(\n [\n () => props.data,\n () => props.disabledNode,\n () => props.childrenKey,\n () => props.valueKey,\n () => props.labelKey,\n () => props.expandAll\n ],\n () => {\n rebuildForest()\n },\n { immediate: true }\n )\n\n const forest = computed(() => forestRef.value)\n const nodeDict = computed(() => nodeDictRef.value)\n\n return { nodes, forest, getFlattedNodes, nodeDict, triggerNodes }\n}\n"],"mappings":";;;;;AAoBA,SAAgB,aAAa,SAAwC;CACnE,MAAM,EAAE,UAAU;CAMlB,MAAM,YAAY,WAChB,IAAI,OAAqC;EACvC,MAAM,CAAC;EACP,aAAa,MAAM,eAAe;CACpC,CAAC,CACH;CAEA,MAAM,cAAc,2BAA2C,IAAI,IAAI,CAAC;CAExE,MAAM,QAAQ,WAAuB,CAAC,CAAC;CAEvC,SAAS,cAAoD;EAC3D,MAAM,EAAE,YAAY,UAAU;EAC9B,MAAM,cAAc,MAAM,eAAe;EACzC,MAAM,WAAW,SAAS,MAAM,UAAU,OAAO;EACjD,MAAM,WAAW,SAAS,MAAM,UAAU,OAAO;EAEjD,OAAO,IAAI,OAAqC;GAC9C,MAAO,MAAM,QAAQ,CAAC;GACtB;GACA,aAAa,MAAM,OAAO,OAAO,IAAI,WAAW;IAC9C,MAAM,OAAO,IAAIA,WAAS;KAClB;KACN;KACA;KACQ;KACR;KACA;IACF,CAAC;IACD,KAAK,WAAW;IAChB,OAAO;GACT;EACF,CAAC;CACH;CAEA,SAAS,gBAAsB;EAC7B,MAAM,aAAa,YAAY;EAC/B,MAAM,2BAAW,IAAI,IAA+B;EACpD,MAAM,EAAE,iBAAiB;EAIzB,WAAW,KAAK,SAAS;GACvB,IAAI,gBAAgB,KAAK,MACvB,KAAK,WAAW,aAAa,KAAK,MAA6B,IAAI,KAAK;GAE1E,SAAS,IAAI,KAAK,KAAK,IAAI;EAC7B,CAAC;EAED,UAAU,QAAQ;EAClB,YAAY,QAAQ;EAEpB,gBAAgB;CAClB;;CAGA,SAAS,kBAAwB;EAC/B,MAAM,SAAqB,CAAC;EAC5B,MAAM,QAAQ,UAAU,MAAM;EAE9B,MAAM,QAAoB,CAAC;EAC3B,KAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KACrC,MAAM,KAAK,MAAM,EAAG;EAGtB,OAAO,MAAM,QAAQ;GACnB,MAAM,OAAO,MAAM,IAAI;GACvB,IAAI,CAAC,KAAK,SAAS;GACnB,OAAO,KAAK,IAAI;GAChB,IAAI,KAAK,YAAY,KAAK,YAAY,KAAK,SAAS,QAClD,KAAK,IAAI,IAAI,KAAK,SAAS,SAAS,GAAG,KAAK,GAAG,KAC7C,MAAM,KAAK,KAAK,SAAS,EAAG;EAGlC;EAEA,MAAM,QAAQ;CAChB;CAEA,SAAS,eAAqB;EAC5B,WAAW,KAAK;CAClB;CAEA,MACE;QACQ,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;CACd,SACM;EACJ,cAAc;CAChB,GACA,EAAE,WAAW,KAAK,CACpB;CAKA,OAAO;EAAE;EAAO,QAHD,eAAe,UAAU,KAGnB;EAAG;EAAiB,UAFxB,eAAe,YAAY,KAEI;EAAG;CAAa;AAClE"}
@@ -17,24 +17,24 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
17
17
  "update:modelValue": (value: string | number | undefined) => any;
18
18
  } & {
19
19
  "update:modelValue": (value?: string | number | undefined) => any;
20
- change: (selectedData?: Record<string, any> | undefined) => any;
21
20
  clear: () => any;
21
+ change: (selectedData?: Record<string, any> | undefined) => any;
22
22
  "update:text": (text?: string | undefined) => any;
23
23
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
24
  "onUpdate:modelValue"?: ((value?: string | number | undefined) => any) | undefined;
25
- onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
26
25
  onClear?: (() => any) | undefined;
26
+ onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
27
27
  "onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
28
28
  }>, {
29
- disabled: boolean;
30
- readonly: boolean;
31
- expandAll: boolean;
32
29
  labelKey: string;
33
30
  valueKey: string;
31
+ expandAll: boolean;
34
32
  placeholder: string;
35
33
  clearable: boolean;
36
34
  filterable: boolean;
37
35
  minWidth: string;
36
+ disabled: boolean;
37
+ readonly: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
39
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
40
  declare const _default: typeof __VLS_export;
@@ -33,7 +33,10 @@ interface TreeProps {
33
33
  childrenKey?: string;
34
34
  /** 数据 */
35
35
  data?: Record<string, any>[];
36
- /** 禁止单选或多选的节点 */
36
+ /**
37
+ * 禁止单选或多选的节点。
38
+ * 在整棵树构建完成后调用,可安全访问 `node.children` / `node.isLeaf`。
39
+ */
37
40
  disabledNode?: (item: Record<string, any>, node: TreeNode$1) => boolean;
38
41
  /** 可多选 */
39
42
  checkable?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltra/desktop",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -57,11 +57,11 @@
57
57
  "@cat-kit/core": ">=1.1.8",
58
58
  "@cat-kit/excel": ">=1.0.0",
59
59
  "@cat-kit/fe": "^1.1.8",
60
- "@veltra/compositions": "1.3.4",
61
- "@veltra/directives": "1.3.4",
62
- "@veltra/icons": "1.3.4",
63
- "@veltra/styles": "1.3.4",
64
- "@veltra/utils": "1.3.4",
60
+ "@veltra/compositions": "1.3.5",
61
+ "@veltra/directives": "1.3.5",
62
+ "@veltra/icons": "1.3.5",
63
+ "@veltra/styles": "1.3.5",
64
+ "@veltra/utils": "1.3.5",
65
65
  "vue": ">=3.5.40"
66
66
  },
67
67
  "devDependencies": {
@@ -37,45 +37,40 @@ export function useTreeNodes(options: Options): UseTreeNodesReturned {
37
37
  const nodes = shallowRef<TreeNode[]>([])
38
38
 
39
39
  function buildForest(): Forest<Record<string, unknown>, any> {
40
- const { disabledNode, expandAll = false } = props
40
+ const { expandAll = false } = props
41
41
  const childrenKey = props.childrenKey ?? 'children'
42
42
  const valueKey = fieldKey(props.valueKey, 'value')
43
43
  const labelKey = fieldKey(props.labelKey, 'label')
44
44
 
45
- function createNode(
46
- data: Record<string, any>,
47
- index: number,
48
- depth: number,
49
- parent?: TreeNode
50
- ): TreeNode {
51
- const node = new TreeNode({ data, index, depth, parent, valueKey, labelKey })
52
- node.expanded = expandAll
53
- return node
54
- }
55
-
56
45
  return new Forest<Record<string, unknown>, any>({
57
46
  data: (props.data ?? []) as Record<string, unknown>[],
58
47
  childrenKey,
59
- createNode: disabledNode
60
- ? (data, index, depth, _f, parent) => {
61
- const node = createNode(data as Record<string, any>, index, depth, parent as TreeNode)
62
- if (data) {
63
- node.disabled = disabledNode(data as Record<string, any>, node) ?? false
64
- }
65
- return node
66
- }
67
- : (data, index, depth, _f, parent) =>
68
- createNode(data as Record<string, any>, index, depth, parent as TreeNode)
48
+ createNode: (data, index, depth, _f, parent) => {
49
+ const node = new TreeNode({
50
+ data: data as Record<string, any>,
51
+ index,
52
+ depth,
53
+ parent: parent as TreeNode | undefined,
54
+ valueKey,
55
+ labelKey
56
+ })
57
+ node.expanded = expandAll
58
+ return node
59
+ }
69
60
  })
70
61
  }
71
62
 
72
63
  function rebuildForest(): void {
73
64
  const nextForest = buildForest()
74
65
  const nextDict = new Map<string | number, TreeNode>()
66
+ const { disabledNode } = props
75
67
 
76
- // 构建森林的同时一次 DFS 同步填充字典,
77
- // 避免旧版 “forest computed → nodeDict computed” 两次完整遍历。
68
+ // Forest 的 createNode 返回时 children 尚未挂载,因此 disabledNode 必须在
69
+ // 整棵树构建完成后再调用,才能安全访问 node.children / node.isLeaf。
78
70
  nextForest.dfs((node) => {
71
+ if (disabledNode && node.data) {
72
+ node.disabled = disabledNode(node.data as Record<string, any>, node) ?? false
73
+ }
79
74
  nextDict.set(node.key, node)
80
75
  })
81
76
 
package/src/types/tree.ts CHANGED
@@ -38,7 +38,10 @@ export interface TreeProps {
38
38
  childrenKey?: string
39
39
  /** 数据 */
40
40
  data?: Record<string, any>[]
41
- /** 禁止单选或多选的节点 */
41
+ /**
42
+ * 禁止单选或多选的节点。
43
+ * 在整棵树构建完成后调用,可安全访问 `node.children` / `node.isLeaf`。
44
+ */
42
45
  disabledNode?: (item: Record<string, any>, node: TreeNode) => boolean
43
46
  /** 可多选 */
44
47
  checkable?: boolean