rayyy-vue-table-components 1.3.17 → 1.3.19

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.
@@ -1,2 +1,2 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
2
  export default _default;
@@ -3,7 +3,6 @@ export { default as BaseBtn } from './items/BaseBtn.vue';
3
3
  export { default as BaseInput } from './form/BaseInput.vue';
4
4
  export { default as BaseDialog } from './items/BaseDialog.vue';
5
5
  export { default as BaseWaringDialog } from './items/BaseWaringDialog.vue';
6
- export { default as BaseMultipleInput } from './form/BaseMultipleInput.vue';
7
6
  export { default as SortTable } from './tables/SortTable.vue';
8
7
  export { default as TitleTable } from './tables/TitleTable.vue';
9
8
  export { default as SearchBar } from './items/SearchBar.vue';
@@ -14,7 +13,8 @@ export { default as MainPanel } from './layout/MainPanel.vue';
14
13
  export { default as SearchableListPanel } from './layout/SearchableListPanel.vue';
15
14
  export { default as DetailLayout } from './layout/DetailLayout.vue';
16
15
  export { default as FilterLayout } from './layout/FilterLayout.vue';
17
- export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, BaseWaringDialogProps, BaseWaringDialogEmits, BaseWaringDialogInstance, BaseInputProps, BaseInputEmits, BaseInputInstance, SortTableProps, SortTableEmits, SortTableInstance, TitleTableProps, TitleTableEmits, TitleTableInstance, SearchBarProps, SearchBarEmits, SearchBarInstance, SearchBarSlots, TransferDialogProps, TransferDialogEmits, TransferDialogInstance, TransferItemProps, TransferItemEmits, TransferItemInstance, MainPanelProps, MainPanelEmits, MainPanelInstance, SearchableListPanelProps, SearchableListPanelEmits, SearchableListPanelInstance, SearchableListPanelSlots, FunctionHeaderProps, FunctionHeaderEmits, FunctionHeaderInstance, DetailLayoutProps, DetailLayoutEmits, DetailLayoutInstance, FilterLayoutProps, FilterLayoutEmits, FilterLayoutInstance, PluginOptions, VueTableComponentsPlugin } from '../types/components.d';
16
+ export { default as LanguageSwitcher } from './LanguageSwitcher.vue';
17
+ export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, BaseWaringDialogProps, BaseWaringDialogEmits, BaseWaringDialogInstance, BaseInputProps, BaseInputEmits, BaseInputInstance, SortTableProps, SortTableEmits, SortTableInstance, TitleTableProps, TitleTableEmits, TitleTableInstance, SearchBarProps, SearchBarEmits, SearchBarInstance, SearchBarSlots, TransferDialogProps, TransferDialogEmits, TransferDialogInstance, TransferItemProps, TransferItemEmits, TransferItemInstance, MainPanelProps, MainPanelEmits, MainPanelInstance, SearchableListPanelProps, SearchableListPanelEmits, SearchableListPanelInstance, SearchableListPanelSlots, FunctionHeaderProps, FunctionHeaderEmits, FunctionHeaderInstance, DetailLayoutProps, DetailLayoutEmits, DetailLayoutInstance, FilterLayoutProps, FilterLayoutEmits, FilterLayoutInstance, PluginOptions, VueTableComponentsPlugin, } from '../types/components.d';
18
18
  export type { default as BaseTableType } from './tables/BaseTable.vue';
19
19
  export type { default as BaseBtnType } from './items/BaseBtn.vue';
20
20
  export type { default as BaseInputType } from './form/BaseInput.vue';
@@ -26,7 +26,6 @@ export type { default as SearchBarType } from './items/SearchBar.vue';
26
26
  export type { default as TransferDialogType } from './transfer/TransferDialog.vue';
27
27
  export type { default as TransferItemType } from './transfer/transferItem.vue';
28
28
  export type { default as SearchableListPanelType } from './layout/SearchableListPanel.vue';
29
- export type { default as BaseMultipleInputType } from './form/BaseMultipleInput.vue';
30
29
  export type { default as FunctionHeaderType } from './layout/FunctionHeader.vue';
31
30
  export type { default as MainPanelType } from './layout/MainPanel.vue';
32
31
  export type { default as DetailLayoutType } from './layout/DetailLayout.vue';
@@ -1,28 +1,3 @@
1
- export declare const NAVIGATION_ITEMS: readonly [{
2
- readonly id: "transfer-dialog";
3
- readonly title: "TransferDialog 示範";
4
- readonly description: "表格列配置功能";
5
- readonly icon: "⚙️";
6
- readonly section: "transfer-demo";
7
- }, {
8
- readonly id: "sort-table";
9
- readonly title: "排序表格示範";
10
- readonly description: "排序和選擇功能";
11
- readonly icon: "📊";
12
- readonly section: "sort-table-demo";
13
- }, {
14
- readonly id: "search-bar";
15
- readonly title: "搜尋欄示範";
16
- readonly description: "搜尋和篩選功能";
17
- readonly icon: "🔍";
18
- readonly section: "search-bar-demo";
19
- }, {
20
- readonly id: "buttons-dialogs";
21
- readonly title: "按鈕和對話框示範";
22
- readonly description: "基礎組件展示";
23
- readonly icon: "🎯";
24
- readonly section: "buttons-dialogs-demo";
25
- }];
26
1
  export declare const DEMO_CONSTANTS: {
27
2
  readonly LOADING_DURATION: 2000;
28
3
  readonly STATUS_CONFIG: {
@@ -55,29 +30,3 @@ export interface User extends Record<string, unknown> {
55
30
  joinDate: string;
56
31
  }
57
32
  export declare const DEMO_USER_DATA: User[];
58
- export declare const DEPARTMENT_OPTIONS: readonly [{
59
- readonly label: "全部";
60
- readonly value: "";
61
- }, {
62
- readonly label: "工程部";
63
- readonly value: "engineering";
64
- }, {
65
- readonly label: "設計部";
66
- readonly value: "design";
67
- }, {
68
- readonly label: "行銷部";
69
- readonly value: "marketing";
70
- }];
71
- export declare const STATUS_OPTIONS: readonly [{
72
- readonly label: "全部";
73
- readonly value: "";
74
- }, {
75
- readonly label: "啟用";
76
- readonly value: "active";
77
- }, {
78
- readonly label: "停用";
79
- readonly value: "inactive";
80
- }, {
81
- readonly label: "待處理";
82
- readonly value: "pending";
83
- }];
@@ -8,6 +8,7 @@ import { default as TitleTable } from './components/tables/TitleTable.vue';
8
8
  import { default as SearchBar } from './components/items/SearchBar.vue';
9
9
  export * from './types';
10
10
  export * from './utils/tableHelper';
11
+ export { switchLanguage, getCurrentLocale, availableLocales, getLanguageName, initLanguageSwitcher, type LocaleCode } from './utils/languageSwitcher';
11
12
  export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, TitleTable, SearchBar };
12
13
  export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
13
14
  export * from './components';
@@ -0,0 +1,79 @@
1
+ export declare const i18n: import('vue-i18n').I18n<{
2
+ 'zh-TW': {
3
+ "common.select": string;
4
+ "common.confirm": string;
5
+ "common.cancel": string;
6
+ "dialog.confirmRemoveUser": string;
7
+ "common.warning": string;
8
+ "search.placeholder": string;
9
+ "common.execute": string;
10
+ "common.reset": string;
11
+ "common.loading": string;
12
+ "common.view": string;
13
+ "common.edit": string;
14
+ "common.column": string;
15
+ "common.back": string;
16
+ "demo.componentDemo": string;
17
+ "button.title": string;
18
+ "button.primary ": string;
19
+ "button.default": string;
20
+ "button.danger": string;
21
+ "button.success": string;
22
+ "button.warning": string;
23
+ "button.info": string;
24
+ "button.style": string;
25
+ "button.size": string;
26
+ "button.small": string;
27
+ "button.medium": string;
28
+ "button.large ": string;
29
+ "status.title": string;
30
+ "status.normal ": string;
31
+ "status.loading": string;
32
+ "status.disabled": string;
33
+ "button.withIcon ": string;
34
+ "button.add": string;
35
+ "button.delete": string;
36
+ };
37
+ 'en-US': {
38
+ "common.select": string;
39
+ "common.confirm": string;
40
+ "common.cancel": string;
41
+ "dialog.confirmRemoveUser": string;
42
+ "common.warning": string;
43
+ "search.placeholder": string;
44
+ "common.execute": string;
45
+ "common.reset": string;
46
+ "common.loading": string;
47
+ "common.view": string;
48
+ "common.edit": string;
49
+ "common.column": string;
50
+ "common.back": string;
51
+ "demo.componentDemo": string;
52
+ "button.title": string;
53
+ "button.primary ": string;
54
+ "button.default": string;
55
+ "button.danger": string;
56
+ "button.success": string;
57
+ "button.warning": string;
58
+ "button.info": string;
59
+ "button.style": string;
60
+ "button.size": string;
61
+ "button.small": string;
62
+ "button.medium": string;
63
+ "button.large ": string;
64
+ "status.title": string;
65
+ "status.normal ": string;
66
+ "status.loading": string;
67
+ "status.disabled": string;
68
+ "button.withIcon ": string;
69
+ "button.add": string;
70
+ "button.delete": string;
71
+ };
72
+ }, {}, {}, string, false>;
73
+ export declare const switchLanguage: (locale: "zh-TW" | "en-US") => void;
74
+ export declare const getCurrentLocale: () => "zh-TW" | "en-US";
75
+ export declare const availableLocales: {
76
+ code: string;
77
+ name: string;
78
+ }[];
79
+ export declare const initLocale: () => void;
@@ -5,7 +5,7 @@ export declare const ROUTES: {
5
5
  readonly INSTALL_GUIDE: "/install-guide";
6
6
  readonly DOCS_CENTER: "/docs-center";
7
7
  readonly SEARCHABLE_LIST_PANEL: "/demo/searchable-list-panel";
8
- readonly BASE_MULTIPLE_INPUT: "/demo/base-multiple-input";
8
+ readonly I18N_DEMO: "/demo/i18n-demo";
9
9
  readonly TRANSFER_DIALOG: "/demo/transfer-dialog";
10
10
  readonly BASE_TABLE: "/demo/base-table";
11
11
  readonly BASE_BTN: "/demo/base-btn";
@@ -28,7 +28,7 @@ export declare const ROUTE_NAMES: {
28
28
  readonly INSTALL_GUIDE: "InstallGuide";
29
29
  readonly DOCS_CENTER: "DocsCenter";
30
30
  readonly SEARCHABLE_LIST_PANEL: "SearchableListPanel";
31
- readonly BASE_MULTIPLE_INPUT: "BaseMultipleInput";
31
+ readonly I18N_DEMO: "I18nDemo";
32
32
  readonly TRANSFER_DIALOG: "TransferDialog";
33
33
  readonly BASE_TABLE: "BaseTable";
34
34
  readonly BASE_BTN: "BaseBtn";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 語言切換工具
3
+ * 供外部專案使用的語言切換功能
4
+ */
5
+ export declare const availableLocales: readonly [{
6
+ readonly code: "zh-TW";
7
+ readonly name: "繁體中文";
8
+ }, {
9
+ readonly code: "en-US";
10
+ readonly name: "English";
11
+ }];
12
+ export type LocaleCode = typeof availableLocales[number]['code'];
13
+ export declare const switchLanguage: (locale: LocaleCode) => void;
14
+ export declare const getCurrentLocale: () => LocaleCode;
15
+ export declare const getLanguageName: (locale: LocaleCode) => string;
16
+ export declare const initLanguageSwitcher: () => "zh-TW" | "en-US";
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.3.17",
3
+ "version": "1.3.19",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -84,7 +84,8 @@
84
84
  "prepublishOnly": "npm run build",
85
85
  "release:patch": "./scripts/release.sh patch",
86
86
  "release:minor": "./scripts/release.sh minor",
87
- "release:major": "./scripts/release.sh major"
87
+ "release:major": "./scripts/release.sh major",
88
+ "fetchI18n": "node ./scripts/fetch-i18n.js"
88
89
  },
89
90
  "peerDependencies": {
90
91
  "element-plus": "^2.9.3",
@@ -129,5 +130,8 @@
129
130
  "vue-router": "^4.5.0",
130
131
  "vue-tsc": "^2.2.8",
131
132
  "vuedraggable": "^4.1.0"
133
+ },
134
+ "dependencies": {
135
+ "vue-i18n": "^11.1.12"
132
136
  }
133
137
  }
@@ -0,0 +1,53 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { useI18n } from 'vue-i18n'
4
+ import { switchLanguage, availableLocales } from '@/plugins/i18n'
5
+
6
+ const { locale } = useI18n()
7
+
8
+ // 切換語言
9
+ const handleLanguageChange = (newLocale: "zh-TW" | "en-US") => {
10
+ switchLanguage(newLocale)
11
+ }
12
+
13
+ // 當前語言顯示名稱
14
+ const currentLanguageName = computed(() => {
15
+ const currentLocale = availableLocales.find(l => l.code === locale.value)
16
+ return currentLocale?.name || '繁體中文'
17
+ })
18
+ </script>
19
+
20
+ <template>
21
+ <div class="language-switcher">
22
+ <el-dropdown @command="handleLanguageChange" trigger="click">
23
+ <el-button type="text" class="flex items-center">
24
+ <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
25
+ <path
26
+ stroke-linecap="round"
27
+ stroke-linejoin="round"
28
+ stroke-width="2"
29
+ d="M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"
30
+ />
31
+ </svg>
32
+ {{ currentLanguageName }}
33
+ <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
34
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
35
+ </svg>
36
+ </el-button>
37
+ <template #dropdown>
38
+ <el-dropdown-menu>
39
+ <el-dropdown-item
40
+ v-for="item in availableLocales"
41
+ :key="item.code"
42
+ :command="item.code"
43
+ >
44
+ {{ item.name }}
45
+ </el-dropdown-item>
46
+ </el-dropdown-menu>
47
+ </template>
48
+ </el-dropdown>
49
+ </div>
50
+ </template>
51
+
52
+ <style scoped>
53
+ </style>
@@ -4,7 +4,6 @@ export { default as BaseBtn } from './items/BaseBtn.vue'
4
4
  export { default as BaseInput } from './form/BaseInput.vue'
5
5
  export { default as BaseDialog } from './items/BaseDialog.vue'
6
6
  export { default as BaseWaringDialog } from './items/BaseWaringDialog.vue'
7
- export { default as BaseMultipleInput } from './form/BaseMultipleInput.vue'
8
7
  export { default as SortTable } from './tables/SortTable.vue'
9
8
  export { default as TitleTable } from './tables/TitleTable.vue'
10
9
  export { default as SearchBar } from './items/SearchBar.vue'
@@ -15,6 +14,7 @@ export { default as MainPanel } from './layout/MainPanel.vue'
15
14
  export { default as SearchableListPanel } from './layout/SearchableListPanel.vue'
16
15
  export { default as DetailLayout } from './layout/DetailLayout.vue'
17
16
  export { default as FilterLayout } from './layout/FilterLayout.vue'
17
+ export { default as LanguageSwitcher } from './LanguageSwitcher.vue'
18
18
 
19
19
  // 導出組件類型
20
20
  export type {
@@ -82,7 +82,7 @@ export type {
82
82
  FilterLayoutInstance,
83
83
  // 插件類型
84
84
  PluginOptions,
85
- VueTableComponentsPlugin
85
+ VueTableComponentsPlugin,
86
86
  } from '../types/components.d'
87
87
 
88
88
  // 重新導出組件定義類型
@@ -97,7 +97,6 @@ export type { default as SearchBarType } from './items/SearchBar.vue'
97
97
  export type { default as TransferDialogType } from './transfer/TransferDialog.vue'
98
98
  export type { default as TransferItemType } from './transfer/transferItem.vue'
99
99
  export type { default as SearchableListPanelType } from './layout/SearchableListPanel.vue'
100
- export type { default as BaseMultipleInputType } from './form/BaseMultipleInput.vue'
101
100
  export type { default as FunctionHeaderType } from './layout/FunctionHeader.vue'
102
101
  export type { default as MainPanelType } from './layout/MainPanel.vue'
103
102
  export type { default as DetailLayoutType } from './layout/DetailLayout.vue'
@@ -81,13 +81,13 @@ const handleSubmit = () => {
81
81
  <footer>
82
82
  <slot name="customFooter">
83
83
  <base-btn
84
- text="確定"
84
+ :text="$t('common.confirm')"
85
85
  type="primary"
86
86
  is-fill
87
87
  @click="handleSubmit"
88
88
  :loading="submitLoading"
89
89
  />
90
- <base-btn text="取消" type="primary" @click="handleCancel" />
90
+ <base-btn :text="$t('common.cancel')" type="primary" @click="handleCancel" />
91
91
  </slot>
92
92
  </footer>
93
93
  </template>
@@ -42,6 +42,7 @@ const handleClick = () => {
42
42
  </div>
43
43
  <div class="font-bold text-text text-xl md:text-2xl;">{{ props.title }}</div>
44
44
  </div>
45
+
45
46
  <div class="flex items-center gap-3">
46
47
  <slot />
47
48
  </div>
@@ -69,14 +69,13 @@ const handleEditClick = (row: T) => {
69
69
  </div>
70
70
 
71
71
  <base-table
72
- v-loading="loading"
73
- element-loading-text="數據加載中..."
72
+ :loading="loading"
74
73
  :data="data"
75
74
  :columns="columns"
75
+ :show-selection="showSelection"
76
76
  :show-summary="showSummary"
77
77
  :show-over-flow-tooltip="showOverFlowTooltip"
78
78
  :summary-method="summaryMethod"
79
- :show-selection="showSelection"
80
79
  :base-table-row-class-name="sortTableRowClassName"
81
80
  :show-check-btn="showCheckBtn"
82
81
  :show-edit-btn="showEditBtn"
@@ -76,8 +76,7 @@ const handleEditClick = (row: T) => {
76
76
 
77
77
  <!-- 表格主體 -->
78
78
  <base-table
79
- v-loading="loading"
80
- element-loading-text="數據加載中..."
79
+ :loading="loading"
81
80
  :data="data"
82
81
  :columns="columns"
83
82
  :show-summary="showSummary"
@@ -0,0 +1,49 @@
1
+ /**
2
+ * 語言切換工具
3
+ * 供外部專案使用的語言切換功能
4
+ */
5
+
6
+ // 可用的語言列表
7
+ export const availableLocales = [
8
+ { code: 'zh-TW', name: '繁體中文' },
9
+ { code: 'en-US', name: 'English' },
10
+ ] as const
11
+
12
+ export type LocaleCode = typeof availableLocales[number]['code']
13
+
14
+ // 語言切換功能
15
+ export const switchLanguage = (locale: LocaleCode) => {
16
+ // 保存到 localStorage
17
+ localStorage.setItem('locale', locale)
18
+
19
+ // 觸發自定義事件,讓外部專案監聽
20
+ window.dispatchEvent(new CustomEvent('languageChanged', {
21
+ detail: { locale }
22
+ }))
23
+ }
24
+
25
+ // 獲取當前語言
26
+ export const getCurrentLocale = (): LocaleCode => {
27
+ const savedLocale = localStorage.getItem('locale') as LocaleCode
28
+ return savedLocale && availableLocales.some(l => l.code === savedLocale)
29
+ ? savedLocale
30
+ : 'zh-TW'
31
+ }
32
+
33
+ // 獲取語言顯示名稱
34
+ export const getLanguageName = (locale: LocaleCode): string => {
35
+ const language = availableLocales.find(l => l.code === locale)
36
+ return language?.name || '繁體中文'
37
+ }
38
+
39
+ // 初始化語言設定(供外部專案調用)
40
+ export const initLanguageSwitcher = () => {
41
+ const currentLocale = getCurrentLocale()
42
+
43
+ // 觸發初始化事件
44
+ window.dispatchEvent(new CustomEvent('languageInitialized', {
45
+ detail: { locale: currentLocale }
46
+ }))
47
+
48
+ return currentLocale
49
+ }