rayyy-vue-table-components 2.0.52 → 2.0.53

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.
@@ -14,6 +14,16 @@ declare const _default: <T extends Record<string, unknown> = Record<string, unkn
14
14
  loading?: boolean;
15
15
  data: T[];
16
16
  columns: TableColumn<T>[];
17
+ rowKey?: string | ((row: T) => string) | undefined;
18
+ treeProps?: {
19
+ children?: string;
20
+ hasChildren?: string;
21
+ checkStrictly?: boolean;
22
+ };
23
+ defaultExpandAll?: boolean;
24
+ expandRowKeys?: string[];
25
+ lazy?: boolean;
26
+ load?: ((row: T, treeNode: unknown, resolve: (data: T[]) => void) => void) | undefined;
17
27
  showSelection?: boolean;
18
28
  showIndex?: boolean;
19
29
  showExpand?: boolean;
@@ -13,6 +13,16 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
13
13
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:checkRow" | "onClick:editRow" | "onUpdate:selectRow" | "onClick:cell" | "onOpen:transfer" | "onClick:downloadExcelFile" | "onClick:columnSort"> & {
14
14
  data: T[];
15
15
  columns: TableColumn<T>[];
16
+ rowKey?: string | ((row: T) => string);
17
+ treeProps?: {
18
+ children?: string;
19
+ hasChildren?: string;
20
+ checkStrictly?: boolean;
21
+ };
22
+ defaultExpandAll?: boolean;
23
+ expandRowKeys?: string[];
24
+ lazy?: boolean;
25
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void;
16
26
  tableTitle?: string;
17
27
  showSelection?: boolean;
18
28
  showIndex?: boolean;
@@ -12,6 +12,16 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
12
12
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:checkRow" | "onClick:editRow" | "onClick:add" | "onClick:delete" | "onUpdate:selectRow" | "onClick:cell"> & {
13
13
  data: T[];
14
14
  columns: TableColumn<T>[];
15
+ rowKey?: string | ((row: T) => string);
16
+ treeProps?: {
17
+ children?: string;
18
+ hasChildren?: string;
19
+ checkStrictly?: boolean;
20
+ };
21
+ defaultExpandAll?: boolean;
22
+ expandRowKeys?: string[];
23
+ lazy?: boolean;
24
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void;
15
25
  tableTitle?: string;
16
26
  propIsEditable?: boolean;
17
27
  showSelection?: boolean;
@@ -13,6 +13,22 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
13
13
  data: T[]
14
14
  /** 表格列配置 */
15
15
  columns: TableColumn<T>[]
16
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
17
+ rowKey?: string | ((row: T) => string)
18
+ /** 樹形資料配置 */
19
+ treeProps?: {
20
+ children?: string
21
+ hasChildren?: string
22
+ checkStrictly?: boolean
23
+ }
24
+ /** 是否預設展開所有節點 */
25
+ defaultExpandAll?: boolean
26
+ /** 指定預設展開的行 keys */
27
+ expandRowKeys?: string[]
28
+ /** 是否啟用懶加載子節點 */
29
+ lazy?: boolean
30
+ /** 懶加載函式 */
31
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
16
32
  /** 是否顯示選擇列 */
17
33
  showSelection?: boolean
18
34
  /** 是否顯示索引列 */
@@ -76,6 +92,22 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
76
92
  data: T[]
77
93
  /** 表格列配置 */
78
94
  columns: import('./index').TableColumn<T>[]
95
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
96
+ rowKey?: string | ((row: T) => string)
97
+ /** 樹形資料配置 */
98
+ treeProps?: {
99
+ children?: string
100
+ hasChildren?: string
101
+ checkStrictly?: boolean
102
+ }
103
+ /** 是否預設展開所有節點 */
104
+ defaultExpandAll?: boolean
105
+ /** 指定預設展開的行 keys */
106
+ expandRowKeys?: string[]
107
+ /** 是否啟用懶加載子節點 */
108
+ lazy?: boolean
109
+ /** 懶加載函式 */
110
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
79
111
  /** 表格標題 */
80
112
  tableTitle?: string
81
113
  /** 是否顯示選擇列 */
@@ -147,6 +179,22 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
147
179
  data: T[]
148
180
  /** 表格列配置 */
149
181
  columns: import('./index').TableColumn<T>[]
182
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
183
+ rowKey?: string | ((row: T) => string)
184
+ /** 樹形資料配置 */
185
+ treeProps?: {
186
+ children?: string
187
+ hasChildren?: string
188
+ checkStrictly?: boolean
189
+ }
190
+ /** 是否預設展開所有節點 */
191
+ defaultExpandAll?: boolean
192
+ /** 指定預設展開的行 keys */
193
+ expandRowKeys?: string[]
194
+ /** 是否啟用懶加載子節點 */
195
+ lazy?: boolean
196
+ /** 懶加載函式 */
197
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
150
198
  /** 表格標題 */
151
199
  tableTitle?: string
152
200
  /** 是否可編輯(顯示新增/刪除按鈕) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "2.0.52",
3
+ "version": "2.0.53",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -8,10 +8,13 @@
8
8
  @apply h-10;
9
9
 
10
10
  .el-tooltip {
11
+ @apply flex items-center;
12
+
11
13
  .cell-content {
12
14
  @apply truncate;
13
15
  }
14
16
  }
17
+
15
18
  }
16
19
 
17
20
  .is-dismissed {
@@ -12,6 +12,16 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
12
12
  loading?: boolean
13
13
  data: T[]
14
14
  columns: TableColumn<T>[]
15
+ rowKey?: string | ((row: T) => string)
16
+ treeProps?: {
17
+ children?: string
18
+ hasChildren?: string
19
+ checkStrictly?: boolean
20
+ }
21
+ defaultExpandAll?: boolean
22
+ expandRowKeys?: string[]
23
+ lazy?: boolean
24
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
15
25
  showSelection?: boolean
16
26
  showIndex?: boolean
17
27
  showExpand?: boolean
@@ -32,6 +42,12 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
32
42
  const props = withDefaults(defineProps<Props<T>>(), {
33
43
  loading: false,
34
44
  data: () => [],
45
+ defaultExpandAll: false,
46
+ lazy: false,
47
+ treeProps: () => ({
48
+ children: 'children',
49
+ hasChildren: 'hasChildren',
50
+ }),
35
51
  showSelection: false,
36
52
  showIndex: false,
37
53
  showExpand: false,
@@ -97,6 +113,12 @@ const operatorWidth = computed(() => {
97
113
  v-loading="loading"
98
114
  :element-loading-text="t('common.loading')"
99
115
  :data="data"
116
+ :row-key="rowKey"
117
+ :tree-props="treeProps"
118
+ :default-expand-all="defaultExpandAll"
119
+ :expand-row-keys="expandRowKeys"
120
+ :lazy="lazy"
121
+ :load="load"
100
122
  border
101
123
  :show-summary="showSummary"
102
124
  :show-overflow-tooltip="showOverFlowTooltip"
@@ -8,6 +8,16 @@ import { BaseTable } from '@/components'
8
8
  defineProps<{
9
9
  data: T[]
10
10
  columns: TableColumn<T>[]
11
+ rowKey?: string | ((row: T) => string)
12
+ treeProps?: {
13
+ children?: string
14
+ hasChildren?: string
15
+ checkStrictly?: boolean
16
+ }
17
+ defaultExpandAll?: boolean
18
+ expandRowKeys?: string[]
19
+ lazy?: boolean
20
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
11
21
  tableTitle?: string
12
22
  showSelection?: boolean
13
23
  showIndex?: boolean
@@ -105,6 +115,12 @@ const state = reactive({
105
115
  v-loading="loading"
106
116
  :data="data"
107
117
  :columns="columns"
118
+ :row-key="rowKey"
119
+ :tree-props="treeProps"
120
+ :default-expand-all="defaultExpandAll"
121
+ :expand-row-keys="expandRowKeys"
122
+ :lazy="lazy"
123
+ :load="load"
108
124
  :show-summary="showSummary"
109
125
  :show-over-flow-tooltip="showOverFlowTooltip"
110
126
  :summary-method="summaryMethod"
@@ -11,6 +11,16 @@ const { t } = useI18n()
11
11
  defineProps<{
12
12
  data: T[]
13
13
  columns: TableColumn<T>[]
14
+ rowKey?: string | ((row: T) => string)
15
+ treeProps?: {
16
+ children?: string
17
+ hasChildren?: string
18
+ checkStrictly?: boolean
19
+ }
20
+ defaultExpandAll?: boolean
21
+ expandRowKeys?: string[]
22
+ lazy?: boolean
23
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
14
24
  tableTitle?: string
15
25
  propIsEditable?: boolean
16
26
  showSelection?: boolean
@@ -96,6 +106,12 @@ const handleEditClick = (row: T) => {
96
106
  v-loading="loading"
97
107
  :data="data"
98
108
  :columns="columns"
109
+ :row-key="rowKey"
110
+ :tree-props="treeProps"
111
+ :default-expand-all="defaultExpandAll"
112
+ :expand-row-keys="expandRowKeys"
113
+ :lazy="lazy"
114
+ :load="load"
99
115
  :show-summary="showSummary"
100
116
  :summary-method="summaryMethod"
101
117
  :show-selection="propIsEditable || showSelection"
@@ -14,6 +14,22 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
14
14
  data: T[]
15
15
  /** 表格列配置 */
16
16
  columns: TableColumn<T>[]
17
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
18
+ rowKey?: string | ((row: T) => string)
19
+ /** 樹形資料配置 */
20
+ treeProps?: {
21
+ children?: string
22
+ hasChildren?: string
23
+ checkStrictly?: boolean
24
+ }
25
+ /** 是否預設展開所有節點 */
26
+ defaultExpandAll?: boolean
27
+ /** 指定預設展開的行 keys */
28
+ expandRowKeys?: string[]
29
+ /** 是否啟用懶加載子節點 */
30
+ lazy?: boolean
31
+ /** 懶加載函式 */
32
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
17
33
  /** 是否顯示選擇列 */
18
34
  showSelection?: boolean
19
35
  /** 是否顯示索引列 */
@@ -77,6 +93,22 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
77
93
  data: T[]
78
94
  /** 表格列配置 */
79
95
  columns: import('./index').TableColumn<T>[]
96
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
97
+ rowKey?: string | ((row: T) => string)
98
+ /** 樹形資料配置 */
99
+ treeProps?: {
100
+ children?: string
101
+ hasChildren?: string
102
+ checkStrictly?: boolean
103
+ }
104
+ /** 是否預設展開所有節點 */
105
+ defaultExpandAll?: boolean
106
+ /** 指定預設展開的行 keys */
107
+ expandRowKeys?: string[]
108
+ /** 是否啟用懶加載子節點 */
109
+ lazy?: boolean
110
+ /** 懶加載函式 */
111
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
80
112
  /** 表格標題 */
81
113
  tableTitle?: string
82
114
  /** 是否顯示選擇列 */
@@ -148,6 +180,22 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
148
180
  data: T[]
149
181
  /** 表格列配置 */
150
182
  columns: import('./index').TableColumn<T>[]
183
+ /** 行資料的 Key(樹形資料與懶加載建議必填) */
184
+ rowKey?: string | ((row: T) => string)
185
+ /** 樹形資料配置 */
186
+ treeProps?: {
187
+ children?: string
188
+ hasChildren?: string
189
+ checkStrictly?: boolean
190
+ }
191
+ /** 是否預設展開所有節點 */
192
+ defaultExpandAll?: boolean
193
+ /** 指定預設展開的行 keys */
194
+ expandRowKeys?: string[]
195
+ /** 是否啟用懶加載子節點 */
196
+ lazy?: boolean
197
+ /** 懶加載函式 */
198
+ load?: (row: T, treeNode: unknown, resolve: (data: T[]) => void) => void
151
199
  /** 表格標題 */
152
200
  tableTitle?: string
153
201
  /** 是否可編輯(顯示新增/刪除按鈕) */