rayyy-vue-table-components 1.3.5 → 1.3.6

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.
@@ -12,7 +12,10 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
12
12
  data: T[];
13
13
  columns: TableColumn<T>[];
14
14
  tableTitle?: string;
15
+ propIsEditable?: boolean;
15
16
  showSelection?: boolean;
17
+ onlyDelete?: boolean;
18
+ showDelete?: boolean;
16
19
  loading?: boolean;
17
20
  showSummary?: boolean;
18
21
  showOverFlowTooltip?: boolean;
@@ -102,8 +102,14 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
102
102
  columns: import('./index').TableColumn<T>[]
103
103
  /** 表格標題 */
104
104
  tableTitle?: string
105
+ /** 是否可編輯(顯示新增/刪除按鈕) */
106
+ propIsEditable?: boolean
105
107
  /** 是否顯示選擇列 */
106
108
  showSelection?: boolean
109
+ /** 是否只顯示刪除按鈕(隱藏新增按鈕) */
110
+ onlyDelete?: boolean
111
+ /** 是否顯示刪除按鈕 */
112
+ showDelete?: boolean
107
113
  /** 是否顯示加載狀態 */
108
114
  loading?: boolean
109
115
  /** 是否顯示匯總行 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -9,7 +9,10 @@ defineProps<{
9
9
  data: T[]
10
10
  columns: TableColumn<T>[]
11
11
  tableTitle?: string
12
+ propIsEditable?: boolean
12
13
  showSelection?: boolean
14
+ onlyDelete?: boolean
15
+ showDelete?: boolean
13
16
  loading?: boolean
14
17
  showSummary?: boolean
15
18
  showOverFlowTooltip?: boolean
@@ -44,15 +47,18 @@ const handleCellClick = (column: TableColumn<T>, row: T) => {
44
47
  <template>
45
48
  <div class="w-full mb-4">
46
49
  <!-- 表格標題區域:包含標題文本和操作按鈕 -->
47
- <div class="flex items-center h-12 bg-gray-200 px-1.5 rounded-t justify-between" v-if="tableTitle">
48
- <p class="font-bold text-20">{{ tableTitle }}</p>
50
+ <div
51
+ class="flex items-center h-12 bg-gray-200 px-1.5 rounded-t justify-between"
52
+ v-if="tableTitle"
53
+ >
54
+ <p class="font-bold text-xl">{{ tableTitle }}</p>
49
55
 
50
56
  <div class="flex items-center">
51
57
  <slot name="tableSearch" />
52
58
 
53
- <div class="flex items-center">
54
- <BaseBtn text="新增" type="primary" @click="addInvoiceDetail" />
55
- <BaseBtn text="刪除" type="primary" @click="deleteSelectRow" />
59
+ <div class="flex items-center" v-if="propIsEditable">
60
+ <BaseBtn text="新增" type="primary" @click="addInvoiceDetail" v-if="!onlyDelete" />
61
+ <BaseBtn text="刪除" type="primary" @click="deleteSelectRow" v-if="showDelete" />
56
62
  </div>
57
63
  </div>
58
64
  </div>
@@ -65,7 +71,7 @@ const handleCellClick = (column: TableColumn<T>, row: T) => {
65
71
  :columns="columns"
66
72
  :show-summary="showSummary"
67
73
  :summary-method="summaryMethod"
68
- :show-selection="showSelection"
74
+ :show-selection="propIsEditable || showSelection"
69
75
  :show-over-flow-tooltip="showOverFlowTooltip"
70
76
  @selection-change="handleSelectionChange"
71
77
  @cell-click="handleCellClick"
@@ -103,8 +103,14 @@ export interface TitleTableProps<T extends Record<string, unknown> = Record<stri
103
103
  columns: import('./index').TableColumn<T>[]
104
104
  /** 表格標題 */
105
105
  tableTitle?: string
106
+ /** 是否可編輯(顯示新增/刪除按鈕) */
107
+ propIsEditable?: boolean
106
108
  /** 是否顯示選擇列 */
107
109
  showSelection?: boolean
110
+ /** 是否只顯示刪除按鈕(隱藏新增按鈕) */
111
+ onlyDelete?: boolean
112
+ /** 是否顯示刪除按鈕 */
113
+ showDelete?: boolean
108
114
  /** 是否顯示加載狀態 */
109
115
  loading?: boolean
110
116
  /** 是否顯示匯總行 */