twcpt 0.0.35 → 0.0.37

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.
@@ -1,8 +1,15 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { JTWBtnProps } from '../j-tw-btn/types';
3
+ export type JTWMultiSelectDropdownAlign = 'center' | 'left' | 'right';
4
+ export interface JTWMultiSelectTab {
5
+ disable?: boolean;
6
+ label: string;
7
+ name: string;
8
+ }
3
9
  export interface JTWMultiSelectOption {
4
10
  disabled?: boolean;
5
11
  label: string;
12
+ tab?: string;
6
13
  value: string | number;
7
14
  }
8
15
  /**
@@ -14,6 +21,10 @@ export interface JTWMultiSelectBtnProps extends Omit<JTWBtnProps, 'color'> {
14
21
  * 本地选项列表
15
22
  */
16
23
  data?: JTWMultiSelectOption[];
24
+ /**
25
+ * 下拉相对按钮的水平对齐
26
+ */
27
+ dropdownAlign?: JTWMultiSelectDropdownAlign;
17
28
  /**
18
29
  * 下拉框最大高度
19
30
  */
@@ -25,7 +36,7 @@ export interface JTWMultiSelectBtnProps extends Omit<JTWBtnProps, 'color'> {
25
36
  /**
26
37
  * 远程加载方法(包含远程搜索)
27
38
  */
28
- fetchOptions?: (keyword: string) => Promise<JTWMultiSelectOption[]>;
39
+ fetchOptions?: (keyword: string, tab?: string) => Promise<JTWMultiSelectOption[]>;
29
40
  /**
30
41
  * 本地搜索过滤方法
31
42
  */
@@ -46,12 +57,22 @@ export interface JTWMultiSelectBtnProps extends Omit<JTWBtnProps, 'color'> {
46
57
  * 搜索防抖时长(ms)
47
58
  */
48
59
  searchDebounce?: number;
60
+ /**
61
+ * 当前 Tab(可 v-model:tab)
62
+ */
63
+ tab?: string;
64
+ /**
65
+ * 下拉面板 Tab,不传则不展示
66
+ */
67
+ tabs?: JTWMultiSelectTab[];
49
68
  }
50
69
  export interface JTWMultiSelectBtnEmits {
51
70
  (e: 'click', event: MouseEvent): void;
52
71
  (e: 'search', keyword: string): void;
53
72
  (e: 'select', options: JTWMultiSelectOption[]): void;
73
+ (e: 'tab-change', tab: string): void;
54
74
  (e: 'update:modelValue', value: Array<string | number>): void;
75
+ (e: 'update:tab', tab: string): void;
55
76
  }
56
77
  export interface JTWMultiSelectBtnSlots {
57
78
  default?: () => any;
@@ -68,7 +89,9 @@ export type JTWMultiSelectBtnEmitsOptions = {
68
89
  click: (e: MouseEvent) => true;
69
90
  search: (keyword: string) => true;
70
91
  select: (options: JTWMultiSelectOption[]) => true;
92
+ 'tab-change': (tab: string) => true;
71
93
  'update:modelValue': (value: Array<string | number>) => true;
94
+ 'update:tab': (tab: string) => true;
72
95
  };
73
96
  export type JTWMultiSelectBtnComponent = DefineComponent<JTWMultiSelectBtnProps, JTWMultiSelectBtnExpose, {}, {}, {}, {}, {}, JTWMultiSelectBtnEmitsOptions>;
74
97
  export type JTWMultiSelectBtnInstance = InstanceType<JTWMultiSelectBtnComponent> & JTWMultiSelectBtnExpose;
@@ -76,7 +99,9 @@ export interface JTWMultiSelectBtnTemplateProps extends JTWMultiSelectBtnProps {
76
99
  onClick?: (event: MouseEvent) => void;
77
100
  onSearch?: (keyword: string) => void;
78
101
  onSelect?: (options: JTWMultiSelectOption[]) => void;
102
+ onTabChange?: (tab: string) => void;
79
103
  'onUpdate:modelValue'?: (value: Array<string | number>) => void;
104
+ 'onUpdate:tab'?: (tab: string) => void;
80
105
  class?: string | Record<string, boolean> | Array<string | Record<string, boolean>>;
81
106
  style?: string | Record<string, string>;
82
107
  }
@@ -53,7 +53,11 @@ declare const _default: DefineComponent<ExtractPropTypes<{
53
53
  type: PropType<(key: string | number) => void>;
54
54
  required: true;
55
55
  };
56
- handleNodeClick: {
56
+ handleNodeCheck: {
57
+ type: PropType<(node: JTWTreeNode) => void>;
58
+ required: true;
59
+ };
60
+ handleNodeLabelClick: {
57
61
  type: PropType<(node: JTWTreeNode) => void>;
58
62
  required: true;
59
63
  };
@@ -110,7 +114,11 @@ declare const _default: DefineComponent<ExtractPropTypes<{
110
114
  type: PropType<(key: string | number) => void>;
111
115
  required: true;
112
116
  };
113
- handleNodeClick: {
117
+ handleNodeCheck: {
118
+ type: PropType<(node: JTWTreeNode) => void>;
119
+ required: true;
120
+ };
121
+ handleNodeLabelClick: {
114
122
  type: PropType<(node: JTWTreeNode) => void>;
115
123
  required: true;
116
124
  };
@@ -73,7 +73,8 @@ declare const _default: DefineComponent<ExtractPropTypes<{
73
73
  innerValues: Ref<Set<string | number> & Omit<Set<string | number>, keyof Set<any>>, Set<string | number> | (Set<string | number> & Omit<Set<string | number>, keyof Set<any>>)>;
74
74
  filteredData: ComputedRef<JTWTreeNode[]>;
75
75
  toggleExpand: (key: string | number) => void;
76
- handleNodeClick: (node: JTWTreeNode) => void;
76
+ handleNodeCheck: (node: JTWTreeNode) => void;
77
+ handleNodeLabelClick: (node: JTWTreeNode) => void;
77
78
  isNodeChecked: (nodeValue: string | number) => boolean;
78
79
  isNodeIndeterminate: (node: JTWTreeNode) => boolean;
79
80
  isNodeActive: (nodeValue: string | number) => boolean;
@@ -224,7 +225,11 @@ declare const _default: DefineComponent<ExtractPropTypes<{
224
225
  type: PropType<(key: string | number) => void>;
225
226
  required: true;
226
227
  };
227
- handleNodeClick: {
228
+ handleNodeCheck: {
229
+ type: PropType<(node: JTWTreeNode) => void>;
230
+ required: true;
231
+ };
232
+ handleNodeLabelClick: {
228
233
  type: PropType<(node: JTWTreeNode) => void>;
229
234
  required: true;
230
235
  };
@@ -281,7 +286,11 @@ declare const _default: DefineComponent<ExtractPropTypes<{
281
286
  type: PropType<(key: string | number) => void>;
282
287
  required: true;
283
288
  };
284
- handleNodeClick: {
289
+ handleNodeCheck: {
290
+ type: PropType<(node: JTWTreeNode) => void>;
291
+ required: true;
292
+ };
293
+ handleNodeLabelClick: {
285
294
  type: PropType<(node: JTWTreeNode) => void>;
286
295
  required: true;
287
296
  };
@@ -75,8 +75,9 @@ export interface JTWTreeSelectProps {
75
75
  defaultExpandFirst?: boolean;
76
76
  /**
77
77
  * 是否启用「默认高亮全部」能力:
78
- * - true:数据就绪后聚焦根节点(优先 value=all)淡色底且不勾选;勾选/取消「全部」走聚焦与选中分离逻辑,并抛出 active-change
79
- * - false:与旧版一致,背景色仅跟随勾选态,不启用聚焦高亮
78
+ * - true:数据就绪后聚焦根节点(优先 value=all)淡色底且不勾选;节点聚焦底与勾选态分离展示
79
+ * - false:不自动聚焦根节点,也不展示聚焦淡色底(背景色仅跟随勾选态)
80
+ * 说明:点击文字仅聚焦展示、点击 checkbox 才勾选——该交互全局生效,不依赖本开关
80
81
  * @default false
81
82
  */
82
83
  defaultHighlightAll?: boolean;
@@ -87,12 +88,13 @@ export interface JTWTreeSelectProps {
87
88
  checkIndependently?: boolean;
88
89
  /**
89
90
  * 节点数据映射表,key 为节点 value,value 为该节点对应的数据列表
90
- * 用于计算节点的选中数/总数统计
91
+ * 用于计算节点的选中数/总数统计,并驱动勾选态:
92
+ * 全选 / 部分选(临时态 -)/ 全不选
91
93
  */
92
94
  nodeDataMap?: Record<string | number, any[]>;
93
95
  /**
94
96
  * 已选中的数据值列表
95
- * 用于计算节点的选中数统计
97
+ * 用于计算节点的选中数统计,并与 nodeDataMap 联动勾选/临时态
96
98
  */
97
99
  selectedDataValues?: (string | number)[];
98
100
  }