stk-table-vue 0.6.17 → 0.7.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.
Files changed (39) hide show
  1. package/README.md +211 -213
  2. package/lib/src/StkTable/StkTable.vue.d.ts +43 -24
  3. package/lib/src/StkTable/components/TriangleIcon.vue.d.ts +2 -0
  4. package/lib/src/StkTable/const.d.ts +0 -1
  5. package/lib/src/StkTable/types/highlightDimOptions.d.ts +1 -5
  6. package/lib/src/StkTable/types/index.d.ts +26 -6
  7. package/lib/src/StkTable/useHighlight.d.ts +1 -1
  8. package/lib/src/StkTable/useRowExpand.d.ts +17 -0
  9. package/lib/src/StkTable/useTree.d.ts +20 -0
  10. package/lib/stk-table-vue.js +313 -163
  11. package/lib/style.css +29 -20
  12. package/package.json +75 -75
  13. package/src/StkTable/StkTable.vue +1557 -1550
  14. package/src/StkTable/components/DragHandle.vue +9 -9
  15. package/src/StkTable/components/SortIcon.vue +6 -6
  16. package/src/StkTable/components/TriangleIcon.vue +3 -0
  17. package/src/StkTable/const.ts +37 -37
  18. package/src/StkTable/index.ts +4 -4
  19. package/src/StkTable/style.less +567 -553
  20. package/src/StkTable/types/highlightDimOptions.ts +26 -26
  21. package/src/StkTable/types/index.ts +260 -239
  22. package/src/StkTable/useAutoResize.ts +91 -91
  23. package/src/StkTable/useColResize.ts +216 -216
  24. package/src/StkTable/useFixedCol.ts +148 -148
  25. package/src/StkTable/useFixedStyle.ts +75 -75
  26. package/src/StkTable/useGetFixedColPosition.ts +65 -65
  27. package/src/StkTable/useHighlight.ts +320 -318
  28. package/src/StkTable/useKeyboardArrowScroll.ts +112 -112
  29. package/src/StkTable/useRowExpand.ts +78 -0
  30. package/src/StkTable/useThDrag.ts +102 -102
  31. package/src/StkTable/useTrDrag.ts +118 -118
  32. package/src/StkTable/useTree.ts +158 -0
  33. package/src/StkTable/useVirtualScroll.ts +462 -462
  34. package/src/StkTable/utils/constRefUtils.ts +29 -29
  35. package/src/StkTable/utils/index.ts +213 -212
  36. package/src/StkTable/utils/useTriggerRef.ts +33 -33
  37. package/src/VirtualTree.vue +622 -622
  38. package/src/VirtualTreeSelect.vue +367 -367
  39. package/src/vite-env.d.ts +10 -10
@@ -46,8 +46,9 @@ export type StkTableColumn<T extends Record<string, any>> = {
46
46
  * - seq 序号列
47
47
  * - expand 展开列
48
48
  * - dragRow 拖拽列(使用sktTableRef.getTableData 获取改变后的顺序)
49
+ * - tree-node 树节点列,这一列前面有展开收起箭头
49
50
  */
50
- type?: 'seq' | 'expand' | 'dragRow';
51
+ type?: 'seq' | 'expand' | 'dragRow' | 'tree-node';
51
52
  /** 取值id */
52
53
  dataIndex: keyof T & string;
53
54
  /** 表头文字 */
@@ -122,18 +123,31 @@ export type PrivateRowDT = {
122
123
  * If user define the `__ROW_KEY__` in table data, this value will be used as the row key
123
124
  * @private
124
125
  */
125
- __ROW_KEY__: string;
126
+ __ROW_KEY__?: string;
126
127
  /**
127
128
  * if row expanded
128
129
  * @private
129
130
  */
130
131
  __EXPANDED__?: StkTableColumn<any> | null;
132
+ /**
133
+ * if tree node row expanded
134
+ * @private
135
+ */
136
+ __T_EXPANDED__?: boolean;
137
+ /**
138
+ * tree parent key
139
+ * @private
140
+ */
141
+ __T_PARENT_K__?: UniqKey;
142
+ /**
143
+ * tree level
144
+ * @private
145
+ */
146
+ __T_LV__?: number;
131
147
  };
132
148
  export type SortOption<T extends Record<string, any>> = Pick<StkTableColumn<T>, 'sorter' | 'dataIndex' | 'sortField' | 'sortType'>;
133
- export type SortState<T> = {
134
- dataIndex: keyof T;
149
+ export type SortState<T extends Record<string, any>> = Pick<StkTableColumn<T>, 'dataIndex' | 'sortField' | 'sortType'> & {
135
150
  order: Order;
136
- sortType?: 'number' | 'string';
137
151
  };
138
152
  export type UniqKey = string | number;
139
153
  export type UniqKeyFun = (param: any) => UniqKey;
@@ -197,8 +211,14 @@ export type ExpandedRow = PrivateRowDT & {
197
211
  export type DragRowConfig = {
198
212
  mode?: 'none' | 'insert' | 'swap';
199
213
  };
214
+ /** 树形配置 */
215
+ export type TreeConfig = {
216
+ defaultExpandAll?: boolean;
217
+ defaultExpandKeys?: UniqKey[];
218
+ defaultExpandLevel?: number;
219
+ };
200
220
  /** header drag config */
201
- export type HeaderDragConfig<DT extends Record<string, any> = any> = boolean | {
221
+ export type HeaderDragConfig<DT extends Record<string, any> = any> = {
202
222
  /**
203
223
  * 列交换模式
204
224
  * - none - 不做任何事
@@ -11,7 +11,7 @@ type Params = {
11
11
  * 高亮单元格,行
12
12
  */
13
13
  export declare function useHighlight({ props, stkTableId, tableContainerRef }: Params): {
14
- highlightSteps: number | null;
14
+ highlightSteps: import('vue').ComputedRef<number | null>;
15
15
  setHighlightDimRow: (rowKeyValues: UniqKey[], option?: HighlightDimRowOption) => void;
16
16
  setHighlightDimCell: (rowKeyValue: UniqKey, colKeyValue: string, option?: HighlightDimCellOption) => void;
17
17
  };
@@ -0,0 +1,17 @@
1
+ import { ShallowRef } from 'vue';
2
+ import { PrivateRowDT, StkTableColumn, UniqKey } from './types';
3
+
4
+ type DT = PrivateRowDT;
5
+ type Option<DT extends Record<string, any>> = {
6
+ rowKeyGen: (row: any) => UniqKey;
7
+ dataSourceCopy: ShallowRef<DT[]>;
8
+ emits: any;
9
+ };
10
+ export declare function useRowExpand({ dataSourceCopy, rowKeyGen, emits }: Option<DT>): {
11
+ toggleExpandRow: (row: DT, col: StkTableColumn<DT>) => void;
12
+ setRowExpand: (rowKeyOrRow: string | undefined | DT, expand?: boolean, data?: {
13
+ col?: StkTableColumn<DT>;
14
+ silent?: boolean;
15
+ }) => void;
16
+ };
17
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ShallowRef } from 'vue';
2
+ import { PrivateRowDT, UniqKey } from './types';
3
+
4
+ type DT = PrivateRowDT & {
5
+ children?: DT[];
6
+ };
7
+ type Option<DT extends Record<string, any>> = {
8
+ props: any;
9
+ rowKeyGen: (row: any) => UniqKey;
10
+ dataSourceCopy: ShallowRef<DT[]>;
11
+ emits: any;
12
+ };
13
+ export declare function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>): {
14
+ toggleTreeNode: (row: DT, col: any) => void;
15
+ setTreeExpand: (row: (UniqKey | DT) | (UniqKey | DT)[], option?: {
16
+ expand?: boolean;
17
+ }) => void;
18
+ flatTreeData: (data: DT[]) => DT[];
19
+ };
20
+ export {};