rayyy-vue-table-components 2.0.22 → 2.0.23
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.
- package/README.md +550 -135
- package/dist/index.es.js +4588 -4621
- package/dist/index.umd.js +11 -11
- package/dist/rayyy-vue-table-components.css +1 -1
- package/dist/src/components/index.d.ts +0 -2
- package/dist/src/index.d.ts +9 -1
- package/dist/src/router/constants.d.ts +0 -2
- package/dist/src/types/components.d.ts +0 -45
- package/package.json +1 -1
- package/src/components/index.ts +0 -2
- package/src/components/items/BaseBtn.vue +135 -3
- package/src/components/layout/SearchableListPanel.vue +3 -8
- package/src/types/components.d.ts +0 -45
- package/src/utils/i18n.ts +1 -2
- package/dist/src/components/form/BaseMultipleInput.vue.d.ts +0 -549
- package/dist/src/views/demo/BaseMultipleInputDemo.vue.d.ts +0 -2
- package/src/components/form/BaseMultipleInput.vue +0 -112
- package/src/components/form/BaseSelector.vue +0 -65
package/README.md
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
- 🚀 **現代化技術棧** - 基於 Vue 3 + TypeScript + Element Plus + Tailwind CSS
|
|
15
15
|
- 📦 **開箱即用** - 提供完整的組件解決方案,包含表格、表單、佈局、交互組件
|
|
16
16
|
- 🎯 **類型安全** - 完整的 TypeScript 類型定義,支援智能提示和類型檢查
|
|
17
|
-
- 🌐 **國際化支持** -
|
|
17
|
+
- 🌐 **國際化支持** - 支援多語言切換,與外部專案 i18n 完美整合
|
|
18
18
|
- 📱 **響應式設計** - 使用 Tailwind CSS,適配各種設備尺寸
|
|
19
19
|
- 🔧 **高度可配置** - 靈活的配置選項和豐富的插槽支持
|
|
20
20
|
- 🎨 **樣式系統** - 多種樣式導入方式,支援自定義主題和 Tailwind CSS 集成
|
|
21
21
|
- 🛠️ **現代化工具** - Sass 模組化 + TypeScript 樣式工具 + 自動導入
|
|
22
|
-
- 💡 **豐富組件** -
|
|
22
|
+
- 💡 **豐富組件** - 15 個組件,涵蓋表格、表單、佈局、對話框、穿梭框等
|
|
23
23
|
- 🧪 **完整測試** - 單元測試 + E2E 測試,確保組件穩定性
|
|
24
24
|
- 📚 **詳細文檔** - 完整的 API 文檔和使用示例
|
|
25
25
|
|
|
@@ -97,7 +97,7 @@ app.mount('#app')
|
|
|
97
97
|
|
|
98
98
|
### 國際化 (i18n) 設定
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
組件庫支援國際化,需要與外部專案的 `vue-i18n` 整合。**重要**:組件庫提供翻譯檔案,需要外部專案合併使用:
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
import { createApp } from 'vue'
|
|
@@ -114,20 +114,22 @@ const i18n = createI18n({
|
|
|
114
114
|
fallbackLocale: 'zh-TW',
|
|
115
115
|
messages: {
|
|
116
116
|
// 合併組件庫的翻譯
|
|
117
|
-
...componentMessages,
|
|
118
|
-
// 可以添加您自己的翻譯
|
|
119
117
|
'zh-TW': {
|
|
120
118
|
...componentMessages['zh-TW'],
|
|
119
|
+
// 可以添加您自己的翻譯
|
|
121
120
|
'custom.key': '自定義翻譯'
|
|
121
|
+
},
|
|
122
|
+
'en-US': {
|
|
123
|
+
...componentMessages['en-US'],
|
|
124
|
+
// 可以添加您自己的翻譯
|
|
125
|
+
'custom.key': 'Custom Translation'
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
128
|
})
|
|
125
129
|
|
|
126
130
|
app.use(i18n)
|
|
127
131
|
app.use(ElementPlus)
|
|
128
|
-
app.use(VueTableComponents
|
|
129
|
-
locale: 'zh-TW' // 設定組件庫預設語系
|
|
130
|
-
})
|
|
132
|
+
app.use(VueTableComponents)
|
|
131
133
|
app.mount('#app')
|
|
132
134
|
```
|
|
133
135
|
|
|
@@ -356,6 +358,110 @@ const handleSelectionChange = (selection: Product[]) => {
|
|
|
356
358
|
```
|
|
357
359
|
</details>
|
|
358
360
|
|
|
361
|
+
#### SortTable - 排序表格
|
|
362
|
+
|
|
363
|
+
支援多列排序的高級表格組件。
|
|
364
|
+
|
|
365
|
+
<details>
|
|
366
|
+
<summary>基本用法</summary>
|
|
367
|
+
|
|
368
|
+
```vue
|
|
369
|
+
<template>
|
|
370
|
+
<SortTable
|
|
371
|
+
:data="tableData"
|
|
372
|
+
:columns="columns"
|
|
373
|
+
:loading="loading"
|
|
374
|
+
@sort-change="handleSortChange"
|
|
375
|
+
/>
|
|
376
|
+
</template>
|
|
377
|
+
|
|
378
|
+
<script setup lang="ts">
|
|
379
|
+
import { ref } from 'vue'
|
|
380
|
+
import { SortTable } from 'rayyy-vue-table-components'
|
|
381
|
+
import type { TableColumn, SortInfo } from 'rayyy-vue-table-components'
|
|
382
|
+
|
|
383
|
+
interface User {
|
|
384
|
+
id: number
|
|
385
|
+
name: string
|
|
386
|
+
email: string
|
|
387
|
+
age: number
|
|
388
|
+
score: number
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const loading = ref(false)
|
|
392
|
+
const tableData = ref<User[]>([
|
|
393
|
+
{ id: 1, name: '張三', email: 'zhangsan@example.com', age: 30, score: 85 },
|
|
394
|
+
{ id: 2, name: '李四', email: 'lisi@example.com', age: 25, score: 92 }
|
|
395
|
+
])
|
|
396
|
+
|
|
397
|
+
const columns: TableColumn<User>[] = [
|
|
398
|
+
{ prop: 'id', label: 'ID', width: 80 },
|
|
399
|
+
{ prop: 'name', label: '姓名', sortable: true },
|
|
400
|
+
{ prop: 'email', label: '郵箱' },
|
|
401
|
+
{ prop: 'age', label: '年齡', sortable: true },
|
|
402
|
+
{ prop: 'score', label: '分數', sortable: true }
|
|
403
|
+
]
|
|
404
|
+
|
|
405
|
+
const handleSortChange = (sortInfo: SortInfo<User>) => {
|
|
406
|
+
console.log('排序變更:', sortInfo)
|
|
407
|
+
}
|
|
408
|
+
</script>
|
|
409
|
+
```
|
|
410
|
+
</details>
|
|
411
|
+
|
|
412
|
+
#### TitleTable - 標題表格
|
|
413
|
+
|
|
414
|
+
帶標題和操作按鈕的表格組件。
|
|
415
|
+
|
|
416
|
+
<details>
|
|
417
|
+
<summary>基本用法</summary>
|
|
418
|
+
|
|
419
|
+
```vue
|
|
420
|
+
<template>
|
|
421
|
+
<TitleTable
|
|
422
|
+
title="用戶列表"
|
|
423
|
+
:data="tableData"
|
|
424
|
+
:columns="columns"
|
|
425
|
+
:loading="loading"
|
|
426
|
+
@add="handleAdd"
|
|
427
|
+
@export="handleExport"
|
|
428
|
+
/>
|
|
429
|
+
</template>
|
|
430
|
+
|
|
431
|
+
<script setup lang="ts">
|
|
432
|
+
import { ref } from 'vue'
|
|
433
|
+
import { TitleTable } from 'rayyy-vue-table-components'
|
|
434
|
+
import type { TableColumn } from 'rayyy-vue-table-components'
|
|
435
|
+
|
|
436
|
+
interface User {
|
|
437
|
+
id: number
|
|
438
|
+
name: string
|
|
439
|
+
email: string
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const loading = ref(false)
|
|
443
|
+
const tableData = ref<User[]>([
|
|
444
|
+
{ id: 1, name: '張三', email: 'zhangsan@example.com' },
|
|
445
|
+
{ id: 2, name: '李四', email: 'lisi@example.com' }
|
|
446
|
+
])
|
|
447
|
+
|
|
448
|
+
const columns: TableColumn<User>[] = [
|
|
449
|
+
{ prop: 'id', label: 'ID', width: 80 },
|
|
450
|
+
{ prop: 'name', label: '姓名' },
|
|
451
|
+
{ prop: 'email', label: '郵箱' }
|
|
452
|
+
]
|
|
453
|
+
|
|
454
|
+
const handleAdd = () => {
|
|
455
|
+
console.log('新增用戶')
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const handleExport = () => {
|
|
459
|
+
console.log('導出數據')
|
|
460
|
+
}
|
|
461
|
+
</script>
|
|
462
|
+
```
|
|
463
|
+
</details>
|
|
464
|
+
|
|
359
465
|
### 🎛️ 表單組件
|
|
360
466
|
|
|
361
467
|
#### BaseInput - 基礎輸入框
|
|
@@ -404,43 +510,6 @@ const validateEmail = (value: string) => {
|
|
|
404
510
|
```
|
|
405
511
|
</details>
|
|
406
512
|
|
|
407
|
-
#### BaseMultipleInput - 多標籤輸入
|
|
408
|
-
|
|
409
|
-
支援多標籤輸入的組件,適用於標籤管理和多值輸入場景。
|
|
410
|
-
|
|
411
|
-
<details>
|
|
412
|
-
<summary>基本用法</summary>
|
|
413
|
-
|
|
414
|
-
```vue
|
|
415
|
-
<template>
|
|
416
|
-
<BaseMultipleInput
|
|
417
|
-
v-model="tags"
|
|
418
|
-
placeholder="輸入標籤後按 Enter 確認"
|
|
419
|
-
:max-tags="10"
|
|
420
|
-
:validate="validateTag"
|
|
421
|
-
@change="handleTagsChange"
|
|
422
|
-
/>
|
|
423
|
-
</template>
|
|
424
|
-
|
|
425
|
-
<script setup lang="ts">
|
|
426
|
-
import { ref } from 'vue'
|
|
427
|
-
import { BaseMultipleInput } from 'rayyy-vue-table-components'
|
|
428
|
-
|
|
429
|
-
const tags = ref<string[]>(['Vue', 'TypeScript'])
|
|
430
|
-
|
|
431
|
-
const validateTag = (tag: string) => {
|
|
432
|
-
if (tag.length < 2) return '標籤長度至少 2 個字符'
|
|
433
|
-
if (tag.length > 20) return '標籤長度不能超過 20 個字符'
|
|
434
|
-
return true
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const handleTagsChange = (newTags: string[]) => {
|
|
438
|
-
console.log('標籤變更:', newTags)
|
|
439
|
-
}
|
|
440
|
-
</script>
|
|
441
|
-
```
|
|
442
|
-
</details>
|
|
443
|
-
|
|
444
513
|
### 🎨 交互組件
|
|
445
514
|
|
|
446
515
|
#### BaseBtn - 按鈕組件
|
|
@@ -578,6 +647,49 @@ const handleCancel = () => {
|
|
|
578
647
|
```
|
|
579
648
|
</details>
|
|
580
649
|
|
|
650
|
+
#### BaseWaringDialog - 警告對話框
|
|
651
|
+
|
|
652
|
+
專門用於警告和確認操作的對話框組件。
|
|
653
|
+
|
|
654
|
+
<details>
|
|
655
|
+
<summary>基本用法</summary>
|
|
656
|
+
|
|
657
|
+
```vue
|
|
658
|
+
<template>
|
|
659
|
+
<div>
|
|
660
|
+
<BaseBtn type="danger" @click="showWarningDialog = true">
|
|
661
|
+
刪除項目
|
|
662
|
+
</BaseBtn>
|
|
663
|
+
|
|
664
|
+
<BaseWaringDialog
|
|
665
|
+
v-model="showWarningDialog"
|
|
666
|
+
title="警告"
|
|
667
|
+
sub-title="此操作無法復原,確定要刪除嗎?"
|
|
668
|
+
@confirm="handleConfirm"
|
|
669
|
+
@cancel="handleCancel"
|
|
670
|
+
/>
|
|
671
|
+
</div>
|
|
672
|
+
</template>
|
|
673
|
+
|
|
674
|
+
<script setup lang="ts">
|
|
675
|
+
import { ref } from 'vue'
|
|
676
|
+
import { BaseBtn, BaseWaringDialog } from 'rayyy-vue-table-components'
|
|
677
|
+
|
|
678
|
+
const showWarningDialog = ref(false)
|
|
679
|
+
|
|
680
|
+
const handleConfirm = () => {
|
|
681
|
+
console.log('確認刪除')
|
|
682
|
+
showWarningDialog.value = false
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const handleCancel = () => {
|
|
686
|
+
console.log('取消刪除')
|
|
687
|
+
showWarningDialog.value = false
|
|
688
|
+
}
|
|
689
|
+
</script>
|
|
690
|
+
```
|
|
691
|
+
</details>
|
|
692
|
+
|
|
581
693
|
### 🏗️ 佈局組件
|
|
582
694
|
|
|
583
695
|
#### MainPanel - 主面板組件
|
|
@@ -651,45 +763,6 @@ const handleSearch = (keyword: string) => {
|
|
|
651
763
|
```
|
|
652
764
|
</details>
|
|
653
765
|
|
|
654
|
-
<details>
|
|
655
|
-
<summary>自定義高度</summary>
|
|
656
|
-
|
|
657
|
-
```vue
|
|
658
|
-
<template>
|
|
659
|
-
<!-- 使用預設高度 -->
|
|
660
|
-
<MainPanel title="預設高度">
|
|
661
|
-
<template #main>
|
|
662
|
-
<div>內容區域</div>
|
|
663
|
-
</template>
|
|
664
|
-
</MainPanel>
|
|
665
|
-
|
|
666
|
-
<!-- 自定義高度 -->
|
|
667
|
-
<MainPanel
|
|
668
|
-
title="自定義高度"
|
|
669
|
-
max-height="500px"
|
|
670
|
-
>
|
|
671
|
-
<template #main>
|
|
672
|
-
<div>固定高度 500px 的內容區域</div>
|
|
673
|
-
</template>
|
|
674
|
-
</MainPanel>
|
|
675
|
-
|
|
676
|
-
<!-- 響應式高度 -->
|
|
677
|
-
<MainPanel
|
|
678
|
-
title="響應式高度"
|
|
679
|
-
max-height="calc(100vh-300px)"
|
|
680
|
-
>
|
|
681
|
-
<template #main>
|
|
682
|
-
<div>根據視窗高度動態調整的內容區域</div>
|
|
683
|
-
</template>
|
|
684
|
-
</MainPanel>
|
|
685
|
-
</template>
|
|
686
|
-
|
|
687
|
-
<script setup lang="ts">
|
|
688
|
-
import { MainPanel } from 'rayyy-vue-table-components'
|
|
689
|
-
</script>
|
|
690
|
-
```
|
|
691
|
-
</details>
|
|
692
|
-
|
|
693
766
|
#### DetailLayout - 詳細頁面佈局
|
|
694
767
|
|
|
695
768
|
專門用於詳細頁面的佈局組件,支援編輯模式和只讀模式切換。
|
|
@@ -797,11 +870,6 @@ const handleBack = () => {
|
|
|
797
870
|
label="關鍵字"
|
|
798
871
|
placeholder="搜尋姓名或郵箱"
|
|
799
872
|
/>
|
|
800
|
-
<BaseSelector
|
|
801
|
-
v-model="filterForm.status"
|
|
802
|
-
label="狀態"
|
|
803
|
-
:options="statusOptions"
|
|
804
|
-
/>
|
|
805
873
|
<BaseInput
|
|
806
874
|
v-model="filterForm.dateRange"
|
|
807
875
|
label="創建時間"
|
|
@@ -814,20 +882,13 @@ const handleBack = () => {
|
|
|
814
882
|
|
|
815
883
|
<script setup lang="ts">
|
|
816
884
|
import { ref } from 'vue'
|
|
817
|
-
import { FilterLayout, BaseInput
|
|
885
|
+
import { FilterLayout, BaseInput } from 'rayyy-vue-table-components'
|
|
818
886
|
|
|
819
887
|
const filterForm = ref({
|
|
820
888
|
keyword: '',
|
|
821
|
-
status: '',
|
|
822
889
|
dateRange: []
|
|
823
890
|
})
|
|
824
891
|
|
|
825
|
-
const statusOptions = [
|
|
826
|
-
{ label: '全部', value: '' },
|
|
827
|
-
{ label: '啟用', value: 'active' },
|
|
828
|
-
{ label: '禁用', value: 'inactive' }
|
|
829
|
-
]
|
|
830
|
-
|
|
831
892
|
const handleFilterSubmit = () => {
|
|
832
893
|
console.log('篩選條件:', filterForm.value)
|
|
833
894
|
}
|
|
@@ -835,7 +896,6 @@ const handleFilterSubmit = () => {
|
|
|
835
896
|
const handleFilterReset = () => {
|
|
836
897
|
filterForm.value = {
|
|
837
898
|
keyword: '',
|
|
838
|
-
status: '',
|
|
839
899
|
dateRange: []
|
|
840
900
|
}
|
|
841
901
|
}
|
|
@@ -845,7 +905,7 @@ const handleFilterReset = () => {
|
|
|
845
905
|
|
|
846
906
|
#### SearchableListPanel - 整合式搜尋面板
|
|
847
907
|
|
|
848
|
-
|
|
908
|
+
整合搜尋、篩選、分頁功能的綜合面板組件。**支援 locale prop 來覆寫 i18n 設定**。
|
|
849
909
|
|
|
850
910
|
<details>
|
|
851
911
|
<summary>基本用法</summary>
|
|
@@ -869,39 +929,38 @@ const handleFilterReset = () => {
|
|
|
869
929
|
</template>
|
|
870
930
|
|
|
871
931
|
<template #customButton>
|
|
872
|
-
<BaseBtn type="
|
|
932
|
+
<BaseBtn type="success" @click="handleExport">
|
|
873
933
|
導出數據
|
|
874
934
|
</BaseBtn>
|
|
875
935
|
</template>
|
|
876
936
|
|
|
877
|
-
<template #
|
|
878
|
-
<
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
label="關鍵字"
|
|
882
|
-
placeholder="搜尋姓名或郵箱"
|
|
883
|
-
/>
|
|
884
|
-
<BaseSelector
|
|
885
|
-
v-model="filterForm.status"
|
|
886
|
-
label="狀態"
|
|
887
|
-
:options="statusOptions"
|
|
888
|
-
/>
|
|
889
|
-
</div>
|
|
937
|
+
<template #lastButton>
|
|
938
|
+
<BaseBtn type="warning" @click="handleBatch">
|
|
939
|
+
批量操作
|
|
940
|
+
</BaseBtn>
|
|
890
941
|
</template>
|
|
891
942
|
</SearchableListPanel>
|
|
892
943
|
</template>
|
|
893
944
|
|
|
894
945
|
<script setup lang="ts">
|
|
895
946
|
import { ref } from 'vue'
|
|
896
|
-
import { SearchableListPanel, BaseBtn
|
|
947
|
+
import { SearchableListPanel, BaseBtn } from 'rayyy-vue-table-components'
|
|
948
|
+
import type { TableColumn } from 'rayyy-vue-table-components'
|
|
949
|
+
|
|
950
|
+
interface User {
|
|
951
|
+
id: number
|
|
952
|
+
name: string
|
|
953
|
+
email: string
|
|
954
|
+
status: string
|
|
955
|
+
}
|
|
897
956
|
|
|
898
957
|
const loading = ref(false)
|
|
899
|
-
const tableData = ref([
|
|
958
|
+
const tableData = ref<User[]>([
|
|
900
959
|
{ id: 1, name: '張三', email: 'zhangsan@example.com', status: 'active' },
|
|
901
960
|
{ id: 2, name: '李四', email: 'lisi@example.com', status: 'inactive' }
|
|
902
961
|
])
|
|
903
962
|
|
|
904
|
-
const columns = [
|
|
963
|
+
const columns: TableColumn<User>[] = [
|
|
905
964
|
{ prop: 'id', label: 'ID', width: 80 },
|
|
906
965
|
{ prop: 'name', label: '姓名' },
|
|
907
966
|
{ prop: 'email', label: '郵箱' },
|
|
@@ -914,22 +973,11 @@ const pagination = ref({
|
|
|
914
973
|
total: 100
|
|
915
974
|
})
|
|
916
975
|
|
|
917
|
-
const filterForm = ref({
|
|
918
|
-
keyword: '',
|
|
919
|
-
status: ''
|
|
920
|
-
})
|
|
921
|
-
|
|
922
|
-
const statusOptions = [
|
|
923
|
-
{ label: '全部', value: '' },
|
|
924
|
-
{ label: '啟用', value: 'active' },
|
|
925
|
-
{ label: '禁用', value: 'inactive' }
|
|
926
|
-
]
|
|
927
|
-
|
|
928
976
|
const handleSearch = (keyword: string) => {
|
|
929
977
|
console.log('搜尋:', keyword)
|
|
930
978
|
}
|
|
931
979
|
|
|
932
|
-
const handleFilter = (filters: any) => {
|
|
980
|
+
const handleFilter = (filters: Record<string, any>) => {
|
|
933
981
|
console.log('篩選:', filters)
|
|
934
982
|
}
|
|
935
983
|
|
|
@@ -944,6 +992,82 @@ const handleAdd = () => {
|
|
|
944
992
|
const handleExport = () => {
|
|
945
993
|
console.log('導出數據')
|
|
946
994
|
}
|
|
995
|
+
|
|
996
|
+
const handleBatch = () => {
|
|
997
|
+
console.log('批量操作')
|
|
998
|
+
}
|
|
999
|
+
</script>
|
|
1000
|
+
```
|
|
1001
|
+
</details>
|
|
1002
|
+
|
|
1003
|
+
<details>
|
|
1004
|
+
<summary>使用 locale prop 覆寫 i18n</summary>
|
|
1005
|
+
|
|
1006
|
+
```vue
|
|
1007
|
+
<template>
|
|
1008
|
+
<SearchableListPanel
|
|
1009
|
+
title="User List"
|
|
1010
|
+
:data="tableData"
|
|
1011
|
+
:columns="columns"
|
|
1012
|
+
:loading="loading"
|
|
1013
|
+
:pagination="pagination"
|
|
1014
|
+
:locale="elementLocale"
|
|
1015
|
+
@search="handleSearch"
|
|
1016
|
+
/>
|
|
1017
|
+
</template>
|
|
1018
|
+
|
|
1019
|
+
<script setup lang="ts">
|
|
1020
|
+
import { ref, computed } from 'vue'
|
|
1021
|
+
import { SearchableListPanel } from 'rayyy-vue-table-components'
|
|
1022
|
+
import en from 'element-plus/es/locale/lang/en'
|
|
1023
|
+
import zhTw from 'element-plus/es/locale/lang/zh-tw'
|
|
1024
|
+
|
|
1025
|
+
const currentLocale = ref('zh-TW')
|
|
1026
|
+
|
|
1027
|
+
// 根據當前語系選擇 Element Plus locale
|
|
1028
|
+
const elementLocale = computed(() => {
|
|
1029
|
+
return currentLocale.value === 'zh-TW' ? zhTw : en
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
// 切換語系
|
|
1033
|
+
const switchLocale = () => {
|
|
1034
|
+
currentLocale.value = currentLocale.value === 'zh-TW' ? 'en-US' : 'zh-TW'
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// 其他組件邏輯...
|
|
1038
|
+
</script>
|
|
1039
|
+
```
|
|
1040
|
+
</details>
|
|
1041
|
+
|
|
1042
|
+
#### FunctionHeader - 功能頁面標題
|
|
1043
|
+
|
|
1044
|
+
提供頁面標題、麵包屑和操作按鈕的功能標題組件。
|
|
1045
|
+
|
|
1046
|
+
<details>
|
|
1047
|
+
<summary>基本用法</summary>
|
|
1048
|
+
|
|
1049
|
+
```vue
|
|
1050
|
+
<template>
|
|
1051
|
+
<FunctionHeader
|
|
1052
|
+
title="用戶管理"
|
|
1053
|
+
sub-title="管理系統用戶信息"
|
|
1054
|
+
:breadcrumbs="breadcrumbs"
|
|
1055
|
+
>
|
|
1056
|
+
<template #actions>
|
|
1057
|
+
<BaseBtn type="primary">新增用戶</BaseBtn>
|
|
1058
|
+
<BaseBtn type="default">導出數據</BaseBtn>
|
|
1059
|
+
</template>
|
|
1060
|
+
</FunctionHeader>
|
|
1061
|
+
</template>
|
|
1062
|
+
|
|
1063
|
+
<script setup lang="ts">
|
|
1064
|
+
import { FunctionHeader, BaseBtn } from 'rayyy-vue-table-components'
|
|
1065
|
+
|
|
1066
|
+
const breadcrumbs = [
|
|
1067
|
+
{ label: '首頁', path: '/' },
|
|
1068
|
+
{ label: '系統管理', path: '/system' },
|
|
1069
|
+
{ label: '用戶管理' }
|
|
1070
|
+
]
|
|
947
1071
|
</script>
|
|
948
1072
|
```
|
|
949
1073
|
</details>
|
|
@@ -1111,6 +1235,34 @@ type ComponentSize = 'default' | 'small' | 'large'
|
|
|
1111
1235
|
|
|
1112
1236
|
---
|
|
1113
1237
|
|
|
1238
|
+
### BaseInput
|
|
1239
|
+
|
|
1240
|
+
增強的輸入框組件,支援多種類型和驗證功能。
|
|
1241
|
+
|
|
1242
|
+
#### Props
|
|
1243
|
+
|
|
1244
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1245
|
+
|------|------|--------|------|
|
|
1246
|
+
| `modelValue` | `string \| number \| null` | - | 輸入值 |
|
|
1247
|
+
| `placeholder` | `string` | - | 佔位符 |
|
|
1248
|
+
| `type` | `string` | `'text'` | 輸入框類型 |
|
|
1249
|
+
| `class` | `string \| object` | - | 自定義類名 |
|
|
1250
|
+
| `showPassword` | `boolean` | `false` | 是否顯示密碼切換按鈕 |
|
|
1251
|
+
| `disabled` | `boolean` | `false` | 是否禁用 |
|
|
1252
|
+
| `readonly` | `boolean` | `false` | 是否只讀 |
|
|
1253
|
+
| `maxlength` | `string \| number` | - | 最大長度 |
|
|
1254
|
+
| `autocomplete` | `'on' \| 'off'` | - | 自動完成 |
|
|
1255
|
+
| `showSearch` | `boolean` | `false` | 是否顯示搜尋圖標 |
|
|
1256
|
+
|
|
1257
|
+
#### Events
|
|
1258
|
+
|
|
1259
|
+
| 事件名 | 參數 | 說明 |
|
|
1260
|
+
|--------|------|------|
|
|
1261
|
+
| `update:modelValue` | `value: string \| number \| null` | 輸入值變更時觸發 |
|
|
1262
|
+
| `update:clearValue` | - | 清除值時觸發 |
|
|
1263
|
+
|
|
1264
|
+
---
|
|
1265
|
+
|
|
1114
1266
|
### BaseDialog
|
|
1115
1267
|
|
|
1116
1268
|
靈活的對話框組件,支援多種配置選項。
|
|
@@ -1145,6 +1297,113 @@ type ComponentSize = 'default' | 'small' | 'large'
|
|
|
1145
1297
|
|
|
1146
1298
|
---
|
|
1147
1299
|
|
|
1300
|
+
### BaseWaringDialog
|
|
1301
|
+
|
|
1302
|
+
警告對話框組件,專門用於警告和確認操作。
|
|
1303
|
+
|
|
1304
|
+
#### Props
|
|
1305
|
+
|
|
1306
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1307
|
+
|------|------|--------|------|
|
|
1308
|
+
| `modelValue` | `boolean` | - | 對話框顯示狀態 |
|
|
1309
|
+
| `title` | `string` | - | 對話框標題 |
|
|
1310
|
+
| `subTitle` | `string` | - | 副標題 |
|
|
1311
|
+
| `customWidth` | `string` | - | 自定義寬度 |
|
|
1312
|
+
|
|
1313
|
+
#### Events
|
|
1314
|
+
|
|
1315
|
+
| 事件名 | 參數 | 說明 |
|
|
1316
|
+
|--------|------|------|
|
|
1317
|
+
| `update:modelValue` | `value: boolean` | 對話框顯示狀態變更 |
|
|
1318
|
+
| `confirm` | - | 確認按鈕點擊時觸發 |
|
|
1319
|
+
| `cancel` | - | 取消按鈕點擊時觸發 |
|
|
1320
|
+
|
|
1321
|
+
---
|
|
1322
|
+
|
|
1323
|
+
### SortTable
|
|
1324
|
+
|
|
1325
|
+
支援多列排序的高級表格組件。
|
|
1326
|
+
|
|
1327
|
+
#### Props
|
|
1328
|
+
|
|
1329
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1330
|
+
|------|------|--------|------|
|
|
1331
|
+
| `data` | `T[]` | `[]` | 表格數據 |
|
|
1332
|
+
| `columns` | `TableColumn<T>[]` | `[]` | 表格列配置 |
|
|
1333
|
+
| `tableTitle` | `string` | - | 表格標題 |
|
|
1334
|
+
| `showSelection` | `boolean` | `false` | 是否顯示選擇列 |
|
|
1335
|
+
| `loading` | `boolean` | `false` | 加載狀態 |
|
|
1336
|
+
| `showSummary` | `boolean` | `false` | 是否顯示合計行 |
|
|
1337
|
+
| `showOverFlowTooltip` | `boolean` | `false` | 是否顯示溢出提示 |
|
|
1338
|
+
| `summaryMethod` | `SummaryMethod<T>` | - | 合計行計算方法 |
|
|
1339
|
+
| `sortTableRowClassName` | `RowClassNameGetter<T>` | - | 行樣式類名函數 |
|
|
1340
|
+
| `showCheckBtn` | `boolean` | `false` | 是否顯示查看按鈕 |
|
|
1341
|
+
| `showEditBtn` | `boolean` | `false` | 是否顯示編輯按鈕 |
|
|
1342
|
+
|
|
1343
|
+
#### Events
|
|
1344
|
+
|
|
1345
|
+
| 事件名 | 參數 | 說明 |
|
|
1346
|
+
|--------|------|------|
|
|
1347
|
+
| `open:transfer` | - | 打開轉移對話框時觸發 |
|
|
1348
|
+
| `click:downloadExcelFile` | - | 下載 Excel 檔案時觸發 |
|
|
1349
|
+
| `update:selectRow` | `value: T[]` | 更新選擇行時觸發 |
|
|
1350
|
+
| `click:cell` | `column: TableColumn<T>, row: T` | 單元格點擊時觸發 |
|
|
1351
|
+
| `sort-change` | `sortInfo: SortInfo<T>` | 排序變更時觸發 |
|
|
1352
|
+
|
|
1353
|
+
---
|
|
1354
|
+
|
|
1355
|
+
### TitleTable
|
|
1356
|
+
|
|
1357
|
+
帶標題和操作按鈕的表格組件。
|
|
1358
|
+
|
|
1359
|
+
#### Props
|
|
1360
|
+
|
|
1361
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1362
|
+
|------|------|--------|------|
|
|
1363
|
+
| `title` | `string` | - | 表格標題 |
|
|
1364
|
+
| `data` | `T[]` | `[]` | 表格數據 |
|
|
1365
|
+
| `columns` | `TableColumn<T>[]` | `[]` | 表格列配置 |
|
|
1366
|
+
| `loading` | `boolean` | `false` | 加載狀態 |
|
|
1367
|
+
| `showSelection` | `boolean` | `false` | 是否顯示選擇列 |
|
|
1368
|
+
| `showSummary` | `boolean` | `false` | 是否顯示合計行 |
|
|
1369
|
+
| `showOverFlowTooltip` | `boolean` | `false` | 是否顯示溢出提示 |
|
|
1370
|
+
| `summaryMethod` | `SummaryMethod<T>` | - | 合計行計算方法 |
|
|
1371
|
+
| `titleTableRowClassName` | `RowClassNameGetter<T>` | - | 行樣式類名函數 |
|
|
1372
|
+
| `showCheckBtn` | `boolean` | `false` | 是否顯示查看按鈕 |
|
|
1373
|
+
| `showEditBtn` | `boolean` | `false` | 是否顯示編輯按鈕 |
|
|
1374
|
+
|
|
1375
|
+
#### Events
|
|
1376
|
+
|
|
1377
|
+
| 事件名 | 參數 | 說明 |
|
|
1378
|
+
|--------|------|------|
|
|
1379
|
+
| `add` | - | 新增按鈕點擊時觸發 |
|
|
1380
|
+
| `export` | - | 導出按鈕點擊時觸發 |
|
|
1381
|
+
| `update:selectRow` | `value: T[]` | 更新選擇行時觸發 |
|
|
1382
|
+
| `click:cell` | `column: TableColumn<T>, row: T` | 單元格點擊時觸發 |
|
|
1383
|
+
| `sort-change` | `sortInfo: SortInfo<T>` | 排序變更時觸發 |
|
|
1384
|
+
|
|
1385
|
+
---
|
|
1386
|
+
|
|
1387
|
+
### SearchBar
|
|
1388
|
+
|
|
1389
|
+
功能豐富的搜尋欄組件,支援即時搜尋和搜尋建議。
|
|
1390
|
+
|
|
1391
|
+
#### Props
|
|
1392
|
+
|
|
1393
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1394
|
+
|------|------|--------|------|
|
|
1395
|
+
| `showSearch` | `boolean` | `false` | 是否顯示搜尋功能 |
|
|
1396
|
+
|
|
1397
|
+
#### Events
|
|
1398
|
+
|
|
1399
|
+
| 事件名 | 參數 | 說明 |
|
|
1400
|
+
|--------|------|------|
|
|
1401
|
+
| `keydown:enter` | `data: string` | 按下 Enter 鍵時觸發 |
|
|
1402
|
+
| `update:clear` | - | 清除時觸發 |
|
|
1403
|
+
| `update:resetFilter` | - | 重置篩選時觸發 |
|
|
1404
|
+
|
|
1405
|
+
---
|
|
1406
|
+
|
|
1148
1407
|
### TransferDialog
|
|
1149
1408
|
|
|
1150
1409
|
用於表格列配置的穿梭框組件。
|
|
@@ -1188,6 +1447,30 @@ interface ListContainerSlotProps<T = any> {
|
|
|
1188
1447
|
|
|
1189
1448
|
---
|
|
1190
1449
|
|
|
1450
|
+
### TransferItem
|
|
1451
|
+
|
|
1452
|
+
轉移項目組件,用於 TransferDialog 中。
|
|
1453
|
+
|
|
1454
|
+
#### Props
|
|
1455
|
+
|
|
1456
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1457
|
+
|------|------|--------|------|
|
|
1458
|
+
| `columnsValue` | `TableColumn<T>` | - | 列配置對象 |
|
|
1459
|
+
| `columnsIndex` | `number` | - | 列索引 |
|
|
1460
|
+
| `columnsLen` | `number` | - | 列總數 |
|
|
1461
|
+
|
|
1462
|
+
#### Events
|
|
1463
|
+
|
|
1464
|
+
| 事件名 | 參數 | 說明 |
|
|
1465
|
+
|--------|------|------|
|
|
1466
|
+
| `mousedown` | `prop: string` | 滑鼠按下時觸發 |
|
|
1467
|
+
| `update:toTop` | `index: number` | 移至頂部時觸發 |
|
|
1468
|
+
| `update:toBottom` | `index: number` | 移至底部時觸發 |
|
|
1469
|
+
| `update:toPre` | `index: number` | 移至前一位時觸發 |
|
|
1470
|
+
| `update:toNext` | `index: number` | 移至下一位時觸發 |
|
|
1471
|
+
|
|
1472
|
+
---
|
|
1473
|
+
|
|
1191
1474
|
### MainPanel
|
|
1192
1475
|
|
|
1193
1476
|
主面板組件,提供標題、返回按鈕和可自定義高度的滾動區域。
|
|
@@ -1217,6 +1500,118 @@ interface ListContainerSlotProps<T = any> {
|
|
|
1217
1500
|
|
|
1218
1501
|
---
|
|
1219
1502
|
|
|
1503
|
+
### SearchableListPanel
|
|
1504
|
+
|
|
1505
|
+
整合式搜尋、篩選、分頁組件。**支援 locale prop 來覆寫 i18n 設定**。
|
|
1506
|
+
|
|
1507
|
+
#### Props
|
|
1508
|
+
|
|
1509
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1510
|
+
|------|------|--------|------|
|
|
1511
|
+
| `title` | `string` | - | 面板標題 |
|
|
1512
|
+
| `pagination` | `Pager` | - | 分頁配置 |
|
|
1513
|
+
| `showBack` | `boolean \| string \| object` | `false` | 是否顯示返回按鈕 |
|
|
1514
|
+
| `showSearch` | `boolean` | `false` | 是否顯示搜尋功能 |
|
|
1515
|
+
| `pageSizeList` | `number[]` | `[10, 25, 50, 100, 200]` | 頁面大小選項 |
|
|
1516
|
+
| `showPagination` | `boolean` | - | 是否顯示分頁器 |
|
|
1517
|
+
| `locale` | `Language` | - | **Element Plus 語言設定,用於覆寫 i18n** |
|
|
1518
|
+
|
|
1519
|
+
#### Events
|
|
1520
|
+
|
|
1521
|
+
| 事件名 | 參數 | 說明 |
|
|
1522
|
+
|--------|------|------|
|
|
1523
|
+
| `search` | `data: string \| null` | 搜尋時觸發 |
|
|
1524
|
+
| `updatePage` | `page: number` | 頁碼變更時觸發 |
|
|
1525
|
+
| `updatePageSize` | `limit: number` | 頁面大小變更時觸發 |
|
|
1526
|
+
| `click:back` | - | 返回按鈕點擊時觸發 |
|
|
1527
|
+
|
|
1528
|
+
#### Slots
|
|
1529
|
+
|
|
1530
|
+
| 插槽名 | 參數 | 說明 |
|
|
1531
|
+
|--------|------|------|
|
|
1532
|
+
| `firstButton` | - | 第一個按鈕插槽 |
|
|
1533
|
+
| `customButton` | - | 自定義按鈕插槽 |
|
|
1534
|
+
| `lastButton` | - | 最後一個按鈕插槽 |
|
|
1535
|
+
| `filterButton` | - | 篩選按鈕插槽 |
|
|
1536
|
+
| `main` | - | 主要內容區域 |
|
|
1537
|
+
|
|
1538
|
+
---
|
|
1539
|
+
|
|
1540
|
+
### DetailLayout
|
|
1541
|
+
|
|
1542
|
+
詳細頁面佈局組件,支援編輯模式和只讀模式切換。
|
|
1543
|
+
|
|
1544
|
+
#### Props
|
|
1545
|
+
|
|
1546
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1547
|
+
|------|------|--------|------|
|
|
1548
|
+
| `title` | `string` | - | 頁面標題 |
|
|
1549
|
+
| `editable` | `boolean` | `false` | 是否可編輯 |
|
|
1550
|
+
| `loading` | `boolean` | `false` | 加載狀態 |
|
|
1551
|
+
|
|
1552
|
+
#### Events
|
|
1553
|
+
|
|
1554
|
+
| 事件名 | 參數 | 說明 |
|
|
1555
|
+
|--------|------|------|
|
|
1556
|
+
| `save` | - | 保存時觸發 |
|
|
1557
|
+
| `cancel` | - | 取消時觸發 |
|
|
1558
|
+
| `back` | - | 返回時觸發 |
|
|
1559
|
+
|
|
1560
|
+
#### Slots
|
|
1561
|
+
|
|
1562
|
+
| 插槽名 | 參數 | 說明 |
|
|
1563
|
+
|--------|------|------|
|
|
1564
|
+
| `header` | - | 標題區域 |
|
|
1565
|
+
| `main` | - | 主要內容區域 |
|
|
1566
|
+
|
|
1567
|
+
---
|
|
1568
|
+
|
|
1569
|
+
### FilterLayout
|
|
1570
|
+
|
|
1571
|
+
篩選頁面佈局組件,支援自定義篩選表單。
|
|
1572
|
+
|
|
1573
|
+
#### Props
|
|
1574
|
+
|
|
1575
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1576
|
+
|------|------|--------|------|
|
|
1577
|
+
| `mainTitle` | `string` | - | 主要標題 |
|
|
1578
|
+
| `filterTitle` | `string` | - | 篩選標題 |
|
|
1579
|
+
|
|
1580
|
+
#### Events
|
|
1581
|
+
|
|
1582
|
+
| 事件名 | 參數 | 說明 |
|
|
1583
|
+
|--------|------|------|
|
|
1584
|
+
| `submit` | - | 提交篩選時觸發 |
|
|
1585
|
+
| `reset` | - | 重置篩選時觸發 |
|
|
1586
|
+
|
|
1587
|
+
#### Slots
|
|
1588
|
+
|
|
1589
|
+
| 插槽名 | 參數 | 說明 |
|
|
1590
|
+
|--------|------|------|
|
|
1591
|
+
| `filter-form` | - | 篩選表單內容 |
|
|
1592
|
+
|
|
1593
|
+
---
|
|
1594
|
+
|
|
1595
|
+
### FunctionHeader
|
|
1596
|
+
|
|
1597
|
+
功能頁面標題組件,提供頁面標題、麵包屑和操作按鈕。
|
|
1598
|
+
|
|
1599
|
+
#### Props
|
|
1600
|
+
|
|
1601
|
+
| 屬性 | 類型 | 默認值 | 說明 |
|
|
1602
|
+
|------|------|--------|------|
|
|
1603
|
+
| `title` | `string` | - | 頁面標題 |
|
|
1604
|
+
| `subTitle` | `string` | - | 頁面副標題 |
|
|
1605
|
+
| `breadcrumbs` | `BreadcrumbItem[]` | `[]` | 麵包屑配置 |
|
|
1606
|
+
|
|
1607
|
+
#### Slots
|
|
1608
|
+
|
|
1609
|
+
| 插槽名 | 參數 | 說明 |
|
|
1610
|
+
|--------|------|------|
|
|
1611
|
+
| `actions` | - | 操作按鈕區域 |
|
|
1612
|
+
|
|
1613
|
+
---
|
|
1614
|
+
|
|
1220
1615
|
### 通用類型定義
|
|
1221
1616
|
|
|
1222
1617
|
#### TableColumn
|
|
@@ -1248,6 +1643,26 @@ interface SortChangValue<T = any> {
|
|
|
1248
1643
|
}
|
|
1249
1644
|
```
|
|
1250
1645
|
|
|
1646
|
+
#### SortInfo
|
|
1647
|
+
|
|
1648
|
+
```typescript
|
|
1649
|
+
interface SortInfo<T = any> {
|
|
1650
|
+
column: TableColumn<T>
|
|
1651
|
+
prop: keyof T | string
|
|
1652
|
+
order: 'ascending' | 'descending' | null
|
|
1653
|
+
}
|
|
1654
|
+
```
|
|
1655
|
+
|
|
1656
|
+
#### Pager
|
|
1657
|
+
|
|
1658
|
+
```typescript
|
|
1659
|
+
interface Pager {
|
|
1660
|
+
page: number
|
|
1661
|
+
limit: number
|
|
1662
|
+
totalCount: number
|
|
1663
|
+
}
|
|
1664
|
+
```
|
|
1665
|
+
|
|
1251
1666
|
## 🎨 樣式系統
|
|
1252
1667
|
|
|
1253
1668
|
### 樣式導入方式
|
|
@@ -1448,8 +1863,7 @@ npm run release:major
|
|
|
1448
1863
|
src/
|
|
1449
1864
|
├── components/ # 組件源碼
|
|
1450
1865
|
│ ├── form/ # 表單組件
|
|
1451
|
-
│ │
|
|
1452
|
-
│ │ └── BaseMultipleInput.vue
|
|
1866
|
+
│ │ └── BaseInput.vue
|
|
1453
1867
|
│ ├── items/ # 交互組件
|
|
1454
1868
|
│ │ ├── BaseBtn.vue
|
|
1455
1869
|
│ │ ├── BaseDialog.vue
|
|
@@ -1513,15 +1927,16 @@ src/
|
|
|
1513
1927
|
|
|
1514
1928
|
查看 [CHANGELOG.md](./CHANGELOG.md) 了解詳細的版本更新記錄。
|
|
1515
1929
|
|
|
1516
|
-
#### 最新更新 (v2.0.
|
|
1930
|
+
#### 最新更新 (v2.0.22)
|
|
1517
1931
|
|
|
1518
1932
|
**🌐 國際化 (i18n) 支持**
|
|
1519
1933
|
- ✅ 新增完整的國際化支持,支援繁體中文 (zh-TW) 和英文 (en-US)
|
|
1520
1934
|
- ✅ 所有組件文字已替換為 i18n 翻譯鍵值
|
|
1521
|
-
- ✅
|
|
1935
|
+
- ✅ 支援外部專案語系同步,需要合併 JSON 檔案使用
|
|
1522
1936
|
- ✅ 提供 `vue-i18n` 整合,支援 `>=10.0.0` 版本
|
|
1523
1937
|
- ✅ 新增語系切換功能,支援動態語言切換
|
|
1524
1938
|
- ✅ 提供翻譯檔案自動更新腳本,支援 Google Sheets 整合
|
|
1939
|
+
- ✅ **SearchableListPanel 支援 locale prop 來覆寫 i18n 設定**
|
|
1525
1940
|
|
|
1526
1941
|
**🔧 技術改進**
|
|
1527
1942
|
- ✅ 修復 `vue-i18n` 依賴版本衝突問題
|
|
@@ -1538,13 +1953,13 @@ src/
|
|
|
1538
1953
|
|
|
1539
1954
|
### 組件統計
|
|
1540
1955
|
|
|
1541
|
-
本組件庫目前包含 **
|
|
1956
|
+
本組件庫目前包含 **15 個組件**,涵蓋以下類別:
|
|
1542
1957
|
|
|
1543
1958
|
| 類別 | 組件數量 | 主要組件 |
|
|
1544
1959
|
|------|----------|----------|
|
|
1545
1960
|
| 🗂️ 表格組件 | 3 | BaseTable, SortTable, TitleTable |
|
|
1546
|
-
| 🎛️ 表單組件 |
|
|
1547
|
-
| 🎨 交互組件 |
|
|
1961
|
+
| 🎛️ 表單組件 | 1 | BaseInput |
|
|
1962
|
+
| 🎨 交互組件 | 3 | BaseBtn, BaseDialog, BaseWaringDialog, SearchBar |
|
|
1548
1963
|
| 🏗️ 佈局組件 | 5 | MainPanel, DetailLayout, FilterLayout, FunctionHeader, SearchableListPanel |
|
|
1549
1964
|
| 🔄 轉移組件 | 2 | TransferDialog, TransferItem |
|
|
1550
1965
|
|