rayyy-vue-table-components 1.0.16 → 1.0.18

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 +111 -0
  2. package/dist/index.d.ts +5 -0
  3. package/dist/index.es.js +4867 -3660
  4. package/dist/index.umd.js +3 -3
  5. package/dist/rayyy-vue-table-components.css +1 -1
  6. package/dist/src/App.vue.d.ts +2 -0
  7. package/dist/src/components/BaseDialog.vue.d.ts +36 -0
  8. package/dist/src/components/SearchBar.vue.d.ts +30 -0
  9. package/dist/src/components/index.d.ts +11 -0
  10. package/dist/src/components/items/BaseBtn.vue.d.ts +35 -0
  11. package/dist/src/components/items/BaseInput.vue.d.ts +30 -0
  12. package/dist/src/components/items/FilterBtn.vue.d.ts +20 -0
  13. package/dist/src/components/tables/BaseTable.vue.d.ts +41 -0
  14. package/dist/src/components/tables/SortTable.vue.d.ts +42 -0
  15. package/dist/src/global.d.ts +18 -0
  16. package/dist/src/index.d.ts +13615 -0
  17. package/dist/src/layout/HomeLayout.vue.d.ts +2 -0
  18. package/dist/src/main.d.ts +0 -0
  19. package/dist/src/router/constants.d.ts +12 -0
  20. package/dist/src/router/index.d.ts +2 -0
  21. package/dist/src/stores/counter.d.ts +13 -0
  22. package/dist/src/types/components.d.ts +210 -0
  23. package/dist/src/types/index.d.ts +96 -0
  24. package/dist/src/views/DemoPage.vue.d.ts +2 -0
  25. package/dist/src/views/HomePage.vue.d.ts +2 -0
  26. package/dist/src/views/NotFoundPage.vue.d.ts +2 -0
  27. package/package.json +9 -1
  28. package/src/components/BaseDialog.vue +4 -4
  29. package/src/components/SearchBar.vue +82 -0
  30. package/src/components/__tests__/BaseTable.test.ts +2 -45
  31. package/src/components/index.ts +23 -4
  32. package/src/components/{BaseBtn.vue → items/BaseBtn.vue} +0 -1
  33. package/src/components/items/BaseInput.vue +52 -0
  34. package/src/components/items/FilterBtn.vue +91 -0
  35. package/src/components/{BaseTable.vue → tables/BaseTable.vue} +13 -12
  36. package/src/components/tables/SortTable.vue +93 -0
  37. package/src/components/transfer/TransferDialog.vue +173 -0
  38. package/src/components/transfer/transferItem.vue +106 -0
  39. package/src/types/components.d.ts +211 -0
package/README.md CHANGED
@@ -94,6 +94,117 @@ const handleSortChange = (sortInfo: SortChangValue<User>) => {
94
94
  </script>
95
95
  ```
96
96
 
97
+ ## TypeScript 類型支持
98
+
99
+ 本庫提供完整的 TypeScript 類型定義,包括:
100
+
101
+ ### 組件類型
102
+
103
+ ```typescript
104
+ import type {
105
+ // BaseTable 組件類型
106
+ BaseTableProps,
107
+ BaseTableEmits,
108
+ BaseTableInstance,
109
+
110
+ // BaseBtn 組件類型
111
+ BaseBtnProps,
112
+ BaseBtnEmits,
113
+ BaseBtnInstance,
114
+
115
+ // BaseDialog 組件類型
116
+ BaseDialogProps,
117
+ BaseDialogEmits,
118
+ BaseDialogInstance,
119
+
120
+ // 插件類型
121
+ PluginOptions,
122
+ VueTableComponentsPlugin
123
+ } from 'rayyy-vue-table-components/types/components'
124
+ ```
125
+
126
+ ### 數據類型
127
+
128
+ ```typescript
129
+ import type {
130
+ TableColumn,
131
+ SortChangValue,
132
+ TableListReq,
133
+ Pager,
134
+ MenuItemType,
135
+ QRCodeResult
136
+ } from 'rayyy-vue-table-components/types'
137
+ ```
138
+
139
+ ### 使用示例
140
+
141
+ ```typescript
142
+ // 定義數據類型
143
+ interface User extends Record<string, unknown> {
144
+ id: number
145
+ name: string
146
+ email: string
147
+ age: number
148
+ status: 'active' | 'inactive'
149
+ }
150
+
151
+ // 定義表格列配置
152
+ const userColumns: TableColumn<User>[] = [
153
+ {
154
+ prop: 'id',
155
+ label: 'ID',
156
+ width: 80,
157
+ align: 'center'
158
+ },
159
+ {
160
+ prop: 'name',
161
+ label: '姓名',
162
+ width: 120
163
+ },
164
+ {
165
+ prop: 'email',
166
+ label: '郵箱',
167
+ width: 200
168
+ },
169
+ {
170
+ prop: 'age',
171
+ label: '年齡',
172
+ width: 80,
173
+ align: 'center',
174
+ sortable: true
175
+ },
176
+ {
177
+ prop: 'status',
178
+ label: '狀態',
179
+ width: 100,
180
+ align: 'center',
181
+ formatter: (row: User) => row.status === 'active' ? '啟用' : '停用'
182
+ }
183
+ ]
184
+
185
+ // 表格數據
186
+ const userData: User[] = [
187
+ { id: 1, name: '張三', email: 'zhangsan@example.com', age: 25, status: 'active' },
188
+ { id: 2, name: '李四', email: 'lisi@example.com', age: 30, status: 'inactive' }
189
+ ]
190
+
191
+ // BaseTable Props 類型示例
192
+ const tableProps: BaseTableProps<User> = {
193
+ loading: false,
194
+ data: userData,
195
+ columns: userColumns,
196
+ showSelection: true,
197
+ showSummary: true,
198
+ showOverFlowTooltip: true,
199
+ summaryMethod: ({ columns, data }) => {
200
+ return ['總計', '', '', data.reduce((sum, user) => sum + user.age, 0).toString(), '']
201
+ },
202
+ baseTableRowClassName: ({ row, rowIndex }) => {
203
+ return row.status === 'active' ? 'active-row' : 'inactive-row'
204
+ }
205
+ }
206
+ ```
207
+
97
208
  ## API
98
209
 
99
210
  ### BaseTable Props
package/dist/index.d.ts CHANGED
@@ -1 +1,6 @@
1
+ export * from './src/index'
2
+ export {}
3
+ import VueTableComponents from './src/index'
4
+ export default VueTableComponents
5
+ export * from './src/index'
1
6
  export {}