rayyy-vue-table-components 1.3.11 → 1.3.13

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.
@@ -49,7 +49,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
49
49
  readonly validateEvent: boolean;
50
50
  readonly inputStyle: string | false | import('vue').CSSProperties | import('vue').StyleValue[] | null;
51
51
  readonly rows: number;
52
- readonly resize?: ("none" | "both" | "horizontal" | "vertical") | undefined;
52
+ readonly resize?: ("none" | "horizontal" | "vertical" | "both") | undefined;
53
53
  readonly size?: ("" | "default" | "small" | "large") | undefined;
54
54
  readonly id?: string | undefined;
55
55
  readonly ariaLabel?: string | undefined;
@@ -147,7 +147,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
147
147
  readonly default: "text";
148
148
  };
149
149
  readonly resize: {
150
- readonly type: import('vue').PropType<"none" | "both" | "horizontal" | "vertical">;
150
+ readonly type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
151
151
  readonly required: false;
152
152
  readonly validator: ((val: unknown) => boolean) | undefined;
153
153
  __epPropKey: true;
@@ -404,7 +404,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
404
404
  readonly default: "text";
405
405
  };
406
406
  readonly resize: {
407
- readonly type: import('vue').PropType<"none" | "both" | "horizontal" | "vertical">;
407
+ readonly type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
408
408
  readonly required: false;
409
409
  readonly validator: ((val: unknown) => boolean) | undefined;
410
410
  __epPropKey: true;
@@ -6,8 +6,10 @@ declare const _default: <T extends Record<string, unknown> = Record<string, unkn
6
6
  readonly "onSelection-change"?: ((selection: T[]) => any) | undefined;
7
7
  readonly "onCurrent-change"?: ((currentRow: T) => any) | undefined;
8
8
  readonly "onColumn-sort-change"?: ((value: SortChangValue<T>) => any) | undefined;
9
+ readonly "onClick:checkRow"?: ((row: T) => any) | undefined;
10
+ readonly "onClick:editRow"?: ((row: T) => any) | undefined;
9
11
  readonly "onCell-click"?: ((column: TableColumn<T>, row: T) => any) | undefined;
10
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelection-change" | "onCurrent-change" | "onColumn-sort-change" | "onCell-click"> & {
12
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelection-change" | "onCurrent-change" | "onColumn-sort-change" | "onClick:checkRow" | "onClick:editRow" | "onCell-click"> & {
11
13
  loading?: boolean;
12
14
  data: T[];
13
15
  columns: TableColumn<T>[];
@@ -22,6 +24,7 @@ declare const _default: <T extends Record<string, unknown> = Record<string, unkn
22
24
  row: T;
23
25
  rowIndex: number;
24
26
  }) => string) | undefined;
27
+ showOperator?: boolean;
25
28
  } & Partial<{}>> & import('vue').PublicProps;
26
29
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
27
30
  attrs: any;
@@ -31,6 +34,8 @@ declare const _default: <T extends Record<string, unknown> = Record<string, unkn
31
34
  (e: "current-change", currentRow: T): void;
32
35
  (e: "cell-click", column: TableColumn<T>, row: T): void;
33
36
  (e: "column-sort-change", value: SortChangValue<T>): void;
37
+ (e: "click:checkRow", row: T): void;
38
+ (e: "click:editRow", row: T): void;
34
39
  };
35
40
  }>) => import('vue').VNode & {
36
41
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -3,11 +3,13 @@ import { TableColumnCtx } from 'element-plus';
3
3
  import { VNode } from 'vue';
4
4
  declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
5
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
6
- readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
6
+ readonly "onClick:checkRow"?: ((row: T) => any) | undefined;
7
+ readonly "onClick:editRow"?: ((row: T) => any) | undefined;
7
8
  readonly "onUpdate:selectRow"?: ((value: T[]) => any) | undefined;
9
+ readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
8
10
  readonly "onOpen:transfer"?: (() => any) | undefined;
9
11
  readonly "onClick:columnSort"?: ((data: SortChangValue<T>) => any) | undefined;
10
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:cell" | "onUpdate:selectRow" | "onOpen:transfer" | "onClick:columnSort"> & {
12
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:checkRow" | "onClick:editRow" | "onUpdate:selectRow" | "onClick:cell" | "onOpen:transfer" | "onClick:columnSort"> & {
11
13
  data: T[];
12
14
  columns: TableColumn<T>[];
13
15
  tableTitle?: string;
@@ -23,6 +25,7 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
23
25
  row: T;
24
26
  rowIndex: number;
25
27
  }) => string;
28
+ showOperator?: boolean;
26
29
  } & Partial<{}>> & import('vue').PublicProps;
27
30
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
28
31
  attrs: any;
@@ -32,6 +35,8 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
32
35
  (e: "update:selectRow", value: T[]): void;
33
36
  (e: "click:cell", column: TableColumn<T>, row: T): void;
34
37
  (e: "click:columnSort", data: SortChangValue<T>): void;
38
+ (e: "click:checkRow", row: T): void;
39
+ (e: "click:editRow", row: T): void;
35
40
  };
36
41
  }>) => import('vue').VNode & {
37
42
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -3,12 +3,13 @@ import { TableColumnCtx } from 'element-plus';
3
3
  import { TableColumn } from 'src/types';
4
4
  declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
5
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
6
+ readonly "onClick:checkRow"?: ((row: T) => any) | undefined;
7
+ readonly "onClick:editRow"?: ((row: T) => any) | undefined;
6
8
  readonly "onClick:add"?: (() => any) | undefined;
7
- readonly "onClick:edit"?: (() => any) | undefined;
8
9
  readonly "onClick:delete"?: (() => any) | undefined;
9
- readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
10
10
  readonly "onUpdate:selectRow"?: ((value: T[]) => any) | undefined;
11
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:add" | "onClick:edit" | "onClick:delete" | "onClick:cell" | "onUpdate:selectRow"> & {
11
+ readonly "onClick:cell"?: ((column: TableColumn<T>, row: T) => any) | undefined;
12
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick:checkRow" | "onClick:editRow" | "onClick:add" | "onClick:delete" | "onUpdate:selectRow" | "onClick:cell"> & {
12
13
  data: T[];
13
14
  columns: TableColumn<T>[];
14
15
  tableTitle?: string;
@@ -23,6 +24,7 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
23
24
  columns: TableColumnCtx<Record<string, unknown>>[];
24
25
  data: T[];
25
26
  }) => (string | VNode)[];
27
+ showOperator?: boolean;
26
28
  } & Partial<{}>> & import('vue').PublicProps;
27
29
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
28
30
  attrs: any;
@@ -31,10 +33,11 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
31
33
  };
32
34
  emit: {
33
35
  (e: "click:add"): void;
34
- (e: "click:edit"): void;
35
36
  (e: "click:delete"): void;
36
37
  (e: "update:selectRow", value: T[]): void;
37
38
  (e: "click:cell", column: TableColumn<T>, row: T): void;
39
+ (e: "click:checkRow", row: T): void;
40
+ (e: "click:editRow", row: T): void;
38
41
  };
39
42
  }>) => import('vue').VNode & {
40
43
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -26,6 +26,8 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
26
26
  }) => (string | VNode)[]
27
27
  /** 行樣式類名 */
28
28
  baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
29
+ /** 是否顯示操作列 */
30
+ showOperator?: boolean
29
31
  }
30
32
 
31
33
  /** BaseTable 組件 Emits 類型 */
@@ -38,6 +40,10 @@ export interface BaseTableEmits<T extends Record<string, unknown> = Record<strin
38
40
  'cell-click': (column: TableColumn<T>, row: T) => void
39
41
  /** 列排序變更事件 */
40
42
  'column-sort-change': (value: SortChangValue<T>) => void
43
+ /** 查看按鈕點擊事件 */
44
+ 'click:checkRow': (row: T) => void
45
+ /** 編輯按鈕點擊事件 */
46
+ 'click:editRow': (row: T) => void
41
47
  }
42
48
 
43
49
  /** BaseTable 組件實例類型 */
@@ -73,6 +79,8 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
73
79
  }) => (string | import('vue').VNode)[]
74
80
  /** 行樣式類名 */
75
81
  sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
82
+ /** 是否顯示操作列 */
83
+ showOperator?: boolean
76
84
  }
77
85
 
78
86
  /** SortTable 組件 Emits 類型 */
@@ -85,6 +93,10 @@ export interface SortTableEmits<T extends Record<string, unknown> = Record<strin
85
93
  (e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
86
94
  /** 列排序點擊事件 */
87
95
  (e: 'click:columnSort', data: import('./index').SortChangValue<T>): void
96
+ /** 查看按鈕點擊事件 */
97
+ (e: 'click:checkRow', row: T): void
98
+ /** 編輯按鈕點擊事件 */
99
+ (e: 'click:editRow', row: T): void
88
100
  }
89
101
 
90
102
  /** SortTable 組件實例類型 */
@@ -124,20 +136,24 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
124
136
  columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
125
137
  data: T[]
126
138
  }) => (string | import('vue').VNode)[]
139
+ /** 是否顯示操作列 */
140
+ showOperator?: boolean
127
141
  }
128
142
 
129
143
  /** TitleTable 組件 Emits 類型 */
130
144
  export interface TitleTableEmits<T extends Record<string, unknown> = Record<string, unknown>> {
131
145
  /** 新增按鈕點擊事件 */
132
146
  (e: 'click:add'): void
133
- /** 編輯按鈕點擊事件 */
134
- (e: 'click:edit'): void
135
147
  /** 刪除按鈕點擊事件 */
136
148
  (e: 'click:delete'): void
137
149
  /** 更新選擇行事件 */
138
150
  (e: 'update:selectRow', value: T[]): void
139
151
  /** 單元格點擊事件 */
140
152
  (e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
153
+ /** 查看按鈕點擊事件 */
154
+ (e: 'click:checkRow', row: T): void
155
+ /** 編輯按鈕點擊事件 */
156
+ (e: 'click:editRow', row: T): void
141
157
  }
142
158
 
143
159
  /** TitleTable 組件實例類型 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -15,6 +15,7 @@ type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
15
15
  data: T[]
16
16
  }) => (string | VNode)[]
17
17
  baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
18
+ showOperator?: boolean
18
19
  }
19
20
 
20
21
  // 組件屬性默認值
@@ -24,6 +25,7 @@ const props = withDefaults(defineProps<Props<T>>(), {
24
25
  showSelection: false,
25
26
  showSummary: false,
26
27
  showOverFlowTooltip: false,
28
+ showOperator: false,
27
29
  summaryMethod: () => [],
28
30
  baseTableRowClassName: () => '',
29
31
  })
@@ -33,6 +35,8 @@ const emit = defineEmits<{
33
35
  (e: 'current-change', currentRow: T): void
34
36
  (e: 'cell-click', column: TableColumn<T>, row: T): void
35
37
  (e: 'column-sort-change', value: SortChangValue<T>): void
38
+ (e: 'click:checkRow', row: T): void
39
+ (e: 'click:editRow', row: T): void
36
40
  }>()
37
41
 
38
42
  const handleCellClick = (column: TableColumn<T>, row: T) => {
@@ -55,6 +59,9 @@ const tableRowClassName = (data: RowClassNameData<T>) => {
55
59
  const onSortChange = (value: SortChangValue<T>) => {
56
60
  emit('column-sort-change', value)
57
61
  }
62
+ const handleOperateClick = (value: T, clickType: 'check' | 'edit') => {
63
+ clickType == 'check' ? emit('click:checkRow', value) : emit('click:editRow', value)
64
+ }
58
65
  </script>
59
66
 
60
67
  <template>
@@ -95,6 +102,27 @@ const onSortChange = (value: SortChangValue<T>) => {
95
102
  </div>
96
103
  </template>
97
104
  </el-table-column>
105
+ <el-table-column v-if="showOperator" width="120" align="center" fixed="right">
106
+ <template #default="{ row }">
107
+ <div class="flex items-center justify-center">
108
+ <base-btn
109
+ type="primary"
110
+ :text-btn="true"
111
+ size="small"
112
+ text="查看"
113
+ @click="handleOperateClick(row, 'check')"
114
+ />
115
+ <el-divider direction="vertical" class="!mx-1" />
116
+ <base-btn
117
+ type="primary"
118
+ :text-btn="true"
119
+ size="small"
120
+ text="编辑"
121
+ @click="handleOperateClick(row, 'edit')"
122
+ />
123
+ </div>
124
+ </template>
125
+ </el-table-column>
98
126
  </el-table>
99
127
  </template>
100
128
 
@@ -18,6 +18,7 @@ defineProps<{
18
18
  data: T[]
19
19
  }) => (string | VNode)[]
20
20
  sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
21
+ showOperator?: boolean
21
22
  }>()
22
23
 
23
24
  const emit = defineEmits<{
@@ -25,6 +26,8 @@ const emit = defineEmits<{
25
26
  (e: 'update:selectRow', value: T[]): void
26
27
  (e: 'click:cell', column: TableColumn<T>, row: T): void
27
28
  (e: 'click:columnSort', data: SortChangValue<T>): void
29
+ (e: 'click:checkRow', row: T): void
30
+ (e: 'click:editRow', row: T): void
28
31
  }>()
29
32
 
30
33
  const openTransferDialog = () => {
@@ -41,6 +44,14 @@ const handleCellClick = (column: TableColumn<T>, row: T) => {
41
44
  const handleColumnSortChange = (data: SortChangValue<T>) => {
42
45
  emit('click:columnSort', data)
43
46
  }
47
+
48
+ const handleCheckClick = (row: T) => {
49
+ emit('click:checkRow', row)
50
+ }
51
+
52
+ const handleEditClick = (row: T) => {
53
+ emit('click:editRow', row)
54
+ }
44
55
  </script>
45
56
 
46
57
  <template>
@@ -66,9 +77,12 @@ const handleColumnSortChange = (data: SortChangValue<T>) => {
66
77
  :summary-method="summaryMethod"
67
78
  :show-selection="showSelection"
68
79
  :base-table-row-class-name="sortTableRowClassName"
80
+ :show-operator="showOperator"
69
81
  @selection-change="handleSelectionChange"
70
82
  @cell-click="handleCellClick"
71
83
  @column-sort-change="handleColumnSortChange"
84
+ @click:checkRow="handleCheckClick"
85
+ @click:editRow="handleEditClick"
72
86
  />
73
87
  </div>
74
88
  </template>
@@ -20,14 +20,16 @@ defineProps<{
20
20
  columns: TableColumnCtx<Record<string, unknown>>[]
21
21
  data: T[]
22
22
  }) => (string | VNode)[]
23
+ showOperator?: boolean
23
24
  }>()
24
25
 
25
26
  const emit = defineEmits<{
26
27
  (e: 'click:add'): void
27
- (e: 'click:edit'): void
28
28
  (e: 'click:delete'): void
29
29
  (e: 'update:selectRow', value: T[]): void
30
30
  (e: 'click:cell', column: TableColumn<T>, row: T): void
31
+ (e: 'click:checkRow', row: T): void
32
+ (e: 'click:editRow', row: T): void
31
33
  }>()
32
34
 
33
35
  const addInvoiceDetail = () => {
@@ -42,6 +44,14 @@ const handleSelectionChange = (selectList: T[]) => {
42
44
  const handleCellClick = (column: TableColumn<T>, row: T) => {
43
45
  emit('click:cell', column, row)
44
46
  }
47
+
48
+ const handleCheckClick = (row: T) => {
49
+ emit('click:checkRow', row)
50
+ }
51
+
52
+ const handleEditClick = (row: T) => {
53
+ emit('click:editRow', row)
54
+ }
45
55
  </script>
46
56
 
47
57
  <template>
@@ -73,8 +83,11 @@ const handleCellClick = (column: TableColumn<T>, row: T) => {
73
83
  :summary-method="summaryMethod"
74
84
  :show-selection="propIsEditable || showSelection"
75
85
  :show-over-flow-tooltip="showOverFlowTooltip"
86
+ :show-operator="showOperator"
76
87
  @selection-change="handleSelectionChange"
77
88
  @cell-click="handleCellClick"
89
+ @click:checkRow="handleCheckClick"
90
+ @click:editRow="handleEditClick"
78
91
  />
79
92
  </div>
80
93
  </template>
@@ -27,6 +27,8 @@ export interface BaseTableProps<T extends Record<string, unknown> = Record<strin
27
27
  }) => (string | VNode)[]
28
28
  /** 行樣式類名 */
29
29
  baseTableRowClassName?: (data: { row: T; rowIndex: number }) => string
30
+ /** 是否顯示操作列 */
31
+ showOperator?: boolean
30
32
  }
31
33
 
32
34
  /** BaseTable 組件 Emits 類型 */
@@ -39,6 +41,10 @@ export interface BaseTableEmits<T extends Record<string, unknown> = Record<strin
39
41
  'cell-click': (column: TableColumn<T>, row: T) => void
40
42
  /** 列排序變更事件 */
41
43
  'column-sort-change': (value: SortChangValue<T>) => void
44
+ /** 查看按鈕點擊事件 */
45
+ 'click:checkRow': (row: T) => void
46
+ /** 編輯按鈕點擊事件 */
47
+ 'click:editRow': (row: T) => void
42
48
  }
43
49
 
44
50
  /** BaseTable 組件實例類型 */
@@ -74,6 +80,8 @@ export interface SortTableProps<T extends Record<string, unknown> = Record<strin
74
80
  }) => (string | import('vue').VNode)[]
75
81
  /** 行樣式類名 */
76
82
  sortTableRowClassName?: (data: { row: T; rowIndex: number }) => string
83
+ /** 是否顯示操作列 */
84
+ showOperator?: boolean
77
85
  }
78
86
 
79
87
  /** SortTable 組件 Emits 類型 */
@@ -86,6 +94,10 @@ export interface SortTableEmits<T extends Record<string, unknown> = Record<strin
86
94
  (e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
87
95
  /** 列排序點擊事件 */
88
96
  (e: 'click:columnSort', data: import('./index').SortChangValue<T>): void
97
+ /** 查看按鈕點擊事件 */
98
+ (e: 'click:checkRow', row: T): void
99
+ /** 編輯按鈕點擊事件 */
100
+ (e: 'click:editRow', row: T): void
89
101
  }
90
102
 
91
103
  /** SortTable 組件實例類型 */
@@ -125,20 +137,24 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
125
137
  columns: import('element-plus').TableColumnCtx<Record<string, unknown>>[]
126
138
  data: T[]
127
139
  }) => (string | import('vue').VNode)[]
140
+ /** 是否顯示操作列 */
141
+ showOperator?: boolean
128
142
  }
129
143
 
130
144
  /** TitleTable 組件 Emits 類型 */
131
145
  export interface TitleTableEmits<T extends Record<string, unknown> = Record<string, unknown>> {
132
146
  /** 新增按鈕點擊事件 */
133
147
  (e: 'click:add'): void
134
- /** 編輯按鈕點擊事件 */
135
- (e: 'click:edit'): void
136
148
  /** 刪除按鈕點擊事件 */
137
149
  (e: 'click:delete'): void
138
150
  /** 更新選擇行事件 */
139
151
  (e: 'update:selectRow', value: T[]): void
140
152
  /** 單元格點擊事件 */
141
153
  (e: 'click:cell', column: import('./index').TableColumn<T>, row: T): void
154
+ /** 查看按鈕點擊事件 */
155
+ (e: 'click:checkRow', row: T): void
156
+ /** 編輯按鈕點擊事件 */
157
+ (e: 'click:editRow', row: T): void
142
158
  }
143
159
 
144
160
  /** TitleTable 組件實例類型 */