@cyberpunk-vue/components 1.10.1 → 1.11.0

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.
@@ -95,17 +95,33 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
95
95
  readonly type: import('vue').PropType<(row: any) => boolean>;
96
96
  readonly default: undefined;
97
97
  };
98
+ readonly treeCheckMode: {
99
+ readonly type: import('vue').PropType<import('.').TreeCheckMode>;
100
+ readonly default: "strict";
101
+ };
102
+ readonly selectionPayload: {
103
+ readonly type: import('vue').PropType<import('.').SelectionPayloadShape>;
104
+ readonly default: "rows";
105
+ };
106
+ readonly includeHalfChecked: {
107
+ readonly type: BooleanConstructor;
108
+ readonly default: false;
109
+ };
98
110
  }>> & Readonly<{
99
- onSelect?: ((selection: any[], row: any) => any) | undefined;
100
- "onSelect-all"?: ((selection: any[]) => any) | undefined;
111
+ onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
112
+ "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
101
113
  "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
102
114
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
103
- "onSelection-change"?: ((selection: any[]) => any) | undefined;
115
+ "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
104
116
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
105
117
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
106
118
  }>, {
107
119
  clearSelection: () => void;
108
120
  getSelectionRows: () => any[];
121
+ getSelectionKeys: () => (string | number)[];
122
+ getHalfCheckedRows: () => any[];
123
+ getHalfCheckedKeys: () => (string | number)[];
124
+ getSelectionDetail: () => import('.').SelectionDetail;
109
125
  sort: (prop: string, order: import('.').SortOrder) => void;
110
126
  setCurrentRow: (row: any) => void;
111
127
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
@@ -113,11 +129,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
113
129
  collapseAll: () => void;
114
130
  toggleRowExpand: (row: any, expanded?: boolean) => void;
115
131
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
116
- select: (selection: any[], row: any) => void;
117
- "select-all": (selection: any[]) => void;
132
+ select: (selection: import('.').SelectionPayload, row: any) => void;
133
+ "select-all": (selection: import('.').SelectionPayload) => void;
118
134
  "sort-change": (sortState: import('.').SortState) => void;
119
135
  "row-click": (row: any, index: number, event: MouseEvent) => void;
120
- "selection-change": (selection: any[]) => void;
136
+ "selection-change": (selection: import('.').SelectionPayload) => void;
121
137
  "current-change": (currentRow: any, oldRow: any) => void;
122
138
  "expand-change": (row: any, expanded: boolean) => void;
123
139
  }, import('vue').PublicProps, {
@@ -139,6 +155,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
139
155
  readonly treeProps: import('.').TableTreeProps;
140
156
  readonly expandRowKeys: (string | number)[];
141
157
  readonly rowExpandable: (row: any) => boolean;
158
+ readonly treeCheckMode: import('.').TreeCheckMode;
159
+ readonly selectionPayload: import('.').SelectionPayloadShape;
160
+ readonly includeHalfChecked: boolean;
142
161
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
143
162
  P: {};
144
163
  B: {};
@@ -228,17 +247,33 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
228
247
  readonly type: import('vue').PropType<(row: any) => boolean>;
229
248
  readonly default: undefined;
230
249
  };
250
+ readonly treeCheckMode: {
251
+ readonly type: import('vue').PropType<import('.').TreeCheckMode>;
252
+ readonly default: "strict";
253
+ };
254
+ readonly selectionPayload: {
255
+ readonly type: import('vue').PropType<import('.').SelectionPayloadShape>;
256
+ readonly default: "rows";
257
+ };
258
+ readonly includeHalfChecked: {
259
+ readonly type: BooleanConstructor;
260
+ readonly default: false;
261
+ };
231
262
  }>> & Readonly<{
232
- onSelect?: ((selection: any[], row: any) => any) | undefined;
233
- "onSelect-all"?: ((selection: any[]) => any) | undefined;
263
+ onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
264
+ "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
234
265
  "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
235
266
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
236
- "onSelection-change"?: ((selection: any[]) => any) | undefined;
267
+ "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
237
268
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
238
269
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
239
270
  }>, {
240
271
  clearSelection: () => void;
241
272
  getSelectionRows: () => any[];
273
+ getSelectionKeys: () => (string | number)[];
274
+ getHalfCheckedRows: () => any[];
275
+ getHalfCheckedKeys: () => (string | number)[];
276
+ getSelectionDetail: () => import('.').SelectionDetail;
242
277
  sort: (prop: string, order: import('.').SortOrder) => void;
243
278
  setCurrentRow: (row: any) => void;
244
279
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
@@ -264,6 +299,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
264
299
  readonly treeProps: import('.').TableTreeProps;
265
300
  readonly expandRowKeys: (string | number)[];
266
301
  readonly rowExpandable: (row: any) => boolean;
302
+ readonly treeCheckMode: import('.').TreeCheckMode;
303
+ readonly selectionPayload: import('.').SelectionPayloadShape;
304
+ readonly includeHalfChecked: boolean;
267
305
  }>;
268
306
  __isFragment?: never;
269
307
  __isTeleport?: never;
@@ -350,17 +388,33 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
350
388
  readonly type: import('vue').PropType<(row: any) => boolean>;
351
389
  readonly default: undefined;
352
390
  };
391
+ readonly treeCheckMode: {
392
+ readonly type: import('vue').PropType<import('.').TreeCheckMode>;
393
+ readonly default: "strict";
394
+ };
395
+ readonly selectionPayload: {
396
+ readonly type: import('vue').PropType<import('.').SelectionPayloadShape>;
397
+ readonly default: "rows";
398
+ };
399
+ readonly includeHalfChecked: {
400
+ readonly type: BooleanConstructor;
401
+ readonly default: false;
402
+ };
353
403
  }>> & Readonly<{
354
- onSelect?: ((selection: any[], row: any) => any) | undefined;
355
- "onSelect-all"?: ((selection: any[]) => any) | undefined;
404
+ onSelect?: ((selection: import('.').SelectionPayload, row: any) => any) | undefined;
405
+ "onSelect-all"?: ((selection: import('.').SelectionPayload) => any) | undefined;
356
406
  "onSort-change"?: ((sortState: import('.').SortState) => any) | undefined;
357
407
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
358
- "onSelection-change"?: ((selection: any[]) => any) | undefined;
408
+ "onSelection-change"?: ((selection: import('.').SelectionPayload) => any) | undefined;
359
409
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
360
410
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
361
411
  }>, {
362
412
  clearSelection: () => void;
363
413
  getSelectionRows: () => any[];
414
+ getSelectionKeys: () => (string | number)[];
415
+ getHalfCheckedRows: () => any[];
416
+ getHalfCheckedKeys: () => (string | number)[];
417
+ getSelectionDetail: () => import('.').SelectionDetail;
364
418
  sort: (prop: string, order: import('.').SortOrder) => void;
365
419
  setCurrentRow: (row: any) => void;
366
420
  toggleRowExpansion: (row: any, expanded?: boolean) => void;
@@ -368,11 +422,11 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
368
422
  collapseAll: () => void;
369
423
  toggleRowExpand: (row: any, expanded?: boolean) => void;
370
424
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
371
- select: (selection: any[], row: any) => void;
372
- "select-all": (selection: any[]) => void;
425
+ select: (selection: import('.').SelectionPayload, row: any) => void;
426
+ "select-all": (selection: import('.').SelectionPayload) => void;
373
427
  "sort-change": (sortState: import('.').SortState) => void;
374
428
  "row-click": (row: any, index: number, event: MouseEvent) => void;
375
- "selection-change": (selection: any[]) => void;
429
+ "selection-change": (selection: import('.').SelectionPayload) => void;
376
430
  "current-change": (currentRow: any, oldRow: any) => void;
377
431
  "expand-change": (row: any, expanded: boolean) => void;
378
432
  }, string, {
@@ -394,6 +448,9 @@ export declare const CpTable: import('../utils').SFCWithInstall<{
394
448
  readonly treeProps: import('.').TableTreeProps;
395
449
  readonly expandRowKeys: (string | number)[];
396
450
  readonly rowExpandable: (row: any) => boolean;
451
+ readonly treeCheckMode: import('.').TreeCheckMode;
452
+ readonly selectionPayload: import('.').SelectionPayloadShape;
453
+ readonly includeHalfChecked: boolean;
397
454
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
398
455
  $slots: {
399
456
  default?(_: {}): any;
@@ -19,6 +19,35 @@ export interface SortState {
19
19
  prop: string;
20
20
  order: SortOrder;
21
21
  }
22
+ /**
23
+ * 树形 + 多选联动策略
24
+ */
25
+ export type TreeCheckMode = 'strict' | 'cascade' | 'bubble';
26
+ /**
27
+ * selection-change / select / select-all 事件 payload 的输出形态
28
+ * - `'rows'`:数组,每项为完整行对象(默认)
29
+ * - `'keys'`:数组,每项为该行的 rowKey 值
30
+ * - `'detail'`:结构化对象,同时返回 checked 与 half-checked 两套数据
31
+ */
32
+ export type SelectionPayloadShape = 'rows' | 'keys' | 'detail';
33
+ /**
34
+ * `selectionPayload === 'detail'` 时的事件 payload 结构
35
+ */
36
+ export interface SelectionDetail {
37
+ /** 完全选中的行对象数组 */
38
+ rows: any[];
39
+ /** 完全选中行的 rowKey 数组 */
40
+ keys: (string | number)[];
41
+ /** 半选行对象数组(仅 cascade / bubble 模式可能非空) */
42
+ halfRows: any[];
43
+ /** 半选行的 rowKey 数组 */
44
+ halfKeys: (string | number)[];
45
+ }
46
+ /**
47
+ * selection-change 等事件 payload 的联合类型
48
+ * 具体形态由 `selectionPayload` prop 决定
49
+ */
50
+ export type SelectionPayload = any[] | (string | number)[] | SelectionDetail;
22
51
  /**
23
52
  * 树形数据配置
24
53
  */
@@ -65,7 +94,11 @@ export interface TableColumnConfig {
65
94
  * @slots empty - 空数据自定义内容 (默认: CpEmpty 组件)
66
95
  * @slots loading - 自定义加载中内容(替代默认 CpLoading + 文字)
67
96
  * @exposes clearSelection() - 清空选择
68
- * @exposes getSelectionRows() - 获取选中行数组
97
+ * @exposes getSelectionRows() - 获取选中行对象数组
98
+ * @exposes getSelectionKeys() - 获取选中行 rowKey 数组
99
+ * @exposes getHalfCheckedRows() - 获取半选行对象数组(仅联动模式)
100
+ * @exposes getHalfCheckedKeys() - 获取半选行 rowKey 数组(仅联动模式)
101
+ * @exposes getSelectionDetail() - 获取结构化选中详情 { rows, keys, halfRows, halfKeys }
69
102
  * @exposes sort(prop, order) - 编程式排序
70
103
  * @exposes setCurrentRow(row) - 设置当前行
71
104
  * @exposes toggleRowExpand(row, expanded?) - 切换行展开(展开列模式)
@@ -272,10 +305,44 @@ export declare const tableProps: {
272
305
  readonly type: PropType<(row: any) => boolean>;
273
306
  readonly default: undefined;
274
307
  };
308
+ /**
309
+ * 树形 + 多选场景下,父子节点的联动策略
310
+ * - `'strict'`(默认):父子独立,互不影响
311
+ * - `'cascade'`:完全双向联动。勾父 → 全部后代勾选;勾/取子 → 父按直接子状态自动更新(含半选)
312
+ * - `'bubble'`:勾子 → 向上冒泡勾选祖先;取消父 → 后代全部取消;其他动作保持独立
313
+ * 仅在同时启用 `treeProps` 与 `type="selection"` 列时生效
314
+ * @default 'strict'
315
+ */
316
+ readonly treeCheckMode: {
317
+ readonly type: PropType<TreeCheckMode>;
318
+ readonly default: "strict";
319
+ };
320
+ /**
321
+ * selection-change / select / select-all 事件 payload 的输出形态
322
+ * - `'rows'`(默认):数组,每项是完整行对象(等价原行为)
323
+ * - `'keys'`:数组,每项是该行的 rowKey 值
324
+ * - `'detail'`:结构化对象 `{ rows, keys, halfRows, halfKeys }`,同时返回全选与半选
325
+ * @default 'rows'
326
+ */
327
+ readonly selectionPayload: {
328
+ readonly type: PropType<SelectionPayloadShape>;
329
+ readonly default: "rows";
330
+ };
331
+ /**
332
+ * `selectionPayload` 为 `'rows'` 或 `'keys'` 时,是否将半选节点也混入数组
333
+ * 仅在联动模式(cascade / bubble)下可能产生半选节点
334
+ * `selectionPayload === 'detail'` 时此 prop 无效(detail 本身已分离全选与半选)
335
+ * @default false
336
+ */
337
+ readonly includeHalfChecked: {
338
+ readonly type: BooleanConstructor;
339
+ readonly default: false;
340
+ };
275
341
  };
276
342
  export type TableProps = ExtractPropTypes<typeof tableProps>;
277
343
  /**
278
344
  * CpTable 事件定义
345
+ * selection / select / select-all payload 的具体形态由 `selectionPayload` prop 决定
279
346
  */
280
347
  export declare const tableEmits: {
281
348
  /** 排序变化 */
@@ -283,11 +350,11 @@ export declare const tableEmits: {
283
350
  /** 行点击 */
284
351
  'row-click': (row: any, index: number, event: MouseEvent) => boolean;
285
352
  /** 选中行变化 */
286
- 'selection-change': (selection: any[]) => boolean;
353
+ 'selection-change': (selection: SelectionPayload) => boolean;
287
354
  /** 全选 */
288
- 'select-all': (selection: any[]) => boolean;
355
+ 'select-all': (selection: SelectionPayload) => boolean;
289
356
  /** 单行选中 */
290
- select: (selection: any[], row: any) => boolean;
357
+ select: (selection: SelectionPayload, row: any) => boolean;
291
358
  /** 当前行变化 */
292
359
  'current-change': (currentRow: any | null, oldRow: any | null) => boolean;
293
360
  /** 树形行展开/折叠 或 行展开列展开/折叠 */
@@ -1,4 +1,4 @@
1
- import { SortOrder, SortState } from './table';
1
+ import { SortOrder, SortState, SelectionDetail, SelectionPayload } from './table';
2
2
  declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
@@ -92,11 +92,31 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
92
92
  readonly type: import('vue').PropType<(row: any) => boolean>;
93
93
  readonly default: undefined;
94
94
  };
95
+ readonly treeCheckMode: {
96
+ readonly type: import('vue').PropType<import('./table').TreeCheckMode>;
97
+ readonly default: "strict";
98
+ };
99
+ readonly selectionPayload: {
100
+ readonly type: import('vue').PropType<import('./table').SelectionPayloadShape>;
101
+ readonly default: "rows";
102
+ };
103
+ readonly includeHalfChecked: {
104
+ readonly type: BooleanConstructor;
105
+ readonly default: false;
106
+ };
95
107
  }>, {
96
108
  /** 清空选择 */
97
109
  clearSelection: () => void;
98
- /** 获取选中行 */
110
+ /** 获取完全选中行对象数组 */
99
111
  getSelectionRows: () => any[];
112
+ /** 获取完全选中行的 rowKey 数组 */
113
+ getSelectionKeys: () => (string | number)[];
114
+ /** 获取半选行对象数组(仅 cascade / bubble 模式可能非空) */
115
+ getHalfCheckedRows: () => any[];
116
+ /** 获取半选行的 rowKey 数组(仅 cascade / bubble 模式可能非空) */
117
+ getHalfCheckedKeys: () => (string | number)[];
118
+ /** 获取结构化选中详情 { rows, keys, halfRows, halfKeys } */
119
+ getSelectionDetail: () => SelectionDetail;
100
120
  /** 排序 */
101
121
  sort: (prop: string, order: SortOrder) => void;
102
122
  /** 设置当前行 */
@@ -110,11 +130,11 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
110
130
  /** 切换行展开(展开列模式) */
111
131
  toggleRowExpand: (row: any, expanded?: boolean) => void;
112
132
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
113
- select: (selection: any[], row: any) => void;
114
- "select-all": (selection: any[]) => void;
133
+ select: (selection: SelectionPayload, row: any) => void;
134
+ "select-all": (selection: SelectionPayload) => void;
115
135
  "sort-change": (sortState: SortState) => void;
116
136
  "row-click": (row: any, index: number, event: MouseEvent) => void;
117
- "selection-change": (selection: any[]) => void;
137
+ "selection-change": (selection: SelectionPayload) => void;
118
138
  "current-change": (currentRow: any, oldRow: any) => void;
119
139
  "expand-change": (row: any, expanded: boolean) => void;
120
140
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -199,12 +219,24 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
199
219
  readonly type: import('vue').PropType<(row: any) => boolean>;
200
220
  readonly default: undefined;
201
221
  };
222
+ readonly treeCheckMode: {
223
+ readonly type: import('vue').PropType<import('./table').TreeCheckMode>;
224
+ readonly default: "strict";
225
+ };
226
+ readonly selectionPayload: {
227
+ readonly type: import('vue').PropType<import('./table').SelectionPayloadShape>;
228
+ readonly default: "rows";
229
+ };
230
+ readonly includeHalfChecked: {
231
+ readonly type: BooleanConstructor;
232
+ readonly default: false;
233
+ };
202
234
  }>> & Readonly<{
203
- onSelect?: ((selection: any[], row: any) => any) | undefined;
204
- "onSelect-all"?: ((selection: any[]) => any) | undefined;
235
+ onSelect?: ((selection: SelectionPayload, row: any) => any) | undefined;
236
+ "onSelect-all"?: ((selection: SelectionPayload) => any) | undefined;
205
237
  "onSort-change"?: ((sortState: SortState) => any) | undefined;
206
238
  "onRow-click"?: ((row: any, index: number, event: MouseEvent) => any) | undefined;
207
- "onSelection-change"?: ((selection: any[]) => any) | undefined;
239
+ "onSelection-change"?: ((selection: SelectionPayload) => any) | undefined;
208
240
  "onCurrent-change"?: ((currentRow: any, oldRow: any) => any) | undefined;
209
241
  "onExpand-change"?: ((row: any, expanded: boolean) => any) | undefined;
210
242
  }>, {
@@ -226,6 +258,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
226
258
  readonly treeProps: import('./table').TableTreeProps;
227
259
  readonly expandRowKeys: (string | number)[];
228
260
  readonly rowExpandable: (row: any) => boolean;
261
+ readonly treeCheckMode: import('./table').TreeCheckMode;
262
+ readonly selectionPayload: import('./table').SelectionPayloadShape;
263
+ readonly includeHalfChecked: boolean;
229
264
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
230
265
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
231
266
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberpunk-vue/components",
3
- "version": "1.10.1",
3
+ "version": "1.11.0",
4
4
  "description": "Cyberpunk Vue components - A futuristic Vue 3 component library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -23,9 +23,9 @@
23
23
  "vue": "^3.5.0"
24
24
  },
25
25
  "dependencies": {
26
- "@cyberpunk-vue/constants": "1.10.1",
27
- "@cyberpunk-vue/hooks": "1.10.1",
28
- "@cyberpunk-vue/theme-chalk": "1.10.1"
26
+ "@cyberpunk-vue/hooks": "1.11.0",
27
+ "@cyberpunk-vue/constants": "1.11.0",
28
+ "@cyberpunk-vue/theme-chalk": "1.11.0"
29
29
  },
30
30
  "author": "Juxest",
31
31
  "license": "MIT",