rayyy-vue-table-components 2.0.21 → 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 +4971 -5030
- 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/dist/src/utils/i18n.d.ts +1 -1
- 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 +4 -21
- package/src/types/components.d.ts +0 -45
- package/src/utils/i18n.ts +4 -42
- 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
|
@@ -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';
|
|
@@ -26,7 +25,6 @@ export type { default as SearchBarType } from './items/SearchBar.vue';
|
|
|
26
25
|
export type { default as TransferDialogType } from './transfer/TransferDialog.vue';
|
|
27
26
|
export type { default as TransferItemType } from './transfer/transferItem.vue';
|
|
28
27
|
export type { default as SearchableListPanelType } from './layout/SearchableListPanel.vue';
|
|
29
|
-
export type { default as BaseMultipleInputType } from './form/BaseMultipleInput.vue';
|
|
30
28
|
export type { default as FunctionHeaderType } from './layout/FunctionHeader.vue';
|
|
31
29
|
export type { default as MainPanelType } from './layout/MainPanel.vue';
|
|
32
30
|
export type { default as DetailLayoutType } from './layout/DetailLayout.vue';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,14 +3,22 @@ import { default as BaseTable } from './components/tables/BaseTable.vue';
|
|
|
3
3
|
import { default as BaseBtn } from './components/items/BaseBtn.vue';
|
|
4
4
|
import { default as BaseInput } from './components/form/BaseInput.vue';
|
|
5
5
|
import { default as BaseDialog } from './components/items/BaseDialog.vue';
|
|
6
|
+
import { default as BaseWaringDialog } from './components/items/BaseWaringDialog.vue';
|
|
6
7
|
import { default as SortTable } from './components/tables/SortTable.vue';
|
|
7
8
|
import { default as TitleTable } from './components/tables/TitleTable.vue';
|
|
8
9
|
import { default as SearchBar } from './components/items/SearchBar.vue';
|
|
10
|
+
import { default as TransferDialog } from './components/transfer/TransferDialog.vue';
|
|
11
|
+
import { default as TransferItem } from './components/transfer/transferItem.vue';
|
|
12
|
+
import { default as FunctionHeader } from './components/layout/FunctionHeader.vue';
|
|
13
|
+
import { default as MainPanel } from './components/layout/MainPanel.vue';
|
|
14
|
+
import { default as SearchableListPanel } from './components/layout/SearchableListPanel.vue';
|
|
15
|
+
import { default as DetailLayout } from './components/layout/DetailLayout.vue';
|
|
16
|
+
import { default as FilterLayout } from './components/layout/FilterLayout.vue';
|
|
9
17
|
export * from './types';
|
|
10
18
|
export * from './utils/tableHelper';
|
|
11
19
|
export { useI18n, setLocale, useComponentElementLocale } from './utils/i18n';
|
|
12
20
|
export * from './locales';
|
|
13
|
-
export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, TitleTable, SearchBar };
|
|
21
|
+
export { BaseTable, BaseBtn, BaseInput, BaseDialog, BaseWaringDialog, SortTable, TitleTable, SearchBar, TransferDialog, TransferItem, FunctionHeader, MainPanel, SearchableListPanel, DetailLayout, FilterLayout };
|
|
14
22
|
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
|
|
15
23
|
export * from './components';
|
|
16
24
|
export declare function install(app: App, options?: {
|
|
@@ -5,7 +5,6 @@ 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";
|
|
9
8
|
readonly TRANSFER_DIALOG: "/demo/transfer-dialog";
|
|
10
9
|
readonly BASE_BTN: "/demo/base-btn";
|
|
11
10
|
readonly BASE_INPUT: "/demo/base-input";
|
|
@@ -28,7 +27,6 @@ export declare const ROUTE_NAMES: {
|
|
|
28
27
|
readonly INSTALL_GUIDE: "InstallGuide";
|
|
29
28
|
readonly DOCS_CENTER: "DocsCenter";
|
|
30
29
|
readonly SEARCHABLE_LIST_PANEL: "SearchableListPanel";
|
|
31
|
-
readonly BASE_MULTIPLE_INPUT: "BaseMultipleInput";
|
|
32
30
|
readonly TRANSFER_DIALOG: "TransferDialog";
|
|
33
31
|
readonly BASE_BTN: "BaseBtn";
|
|
34
32
|
readonly BASE_INPUT: "BaseInput";
|
|
@@ -369,33 +369,6 @@ export interface BaseInputInstance {
|
|
|
369
369
|
$emit: BaseInputEmits
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
// ==================== BaseMultipleInput 組件類型 ====================
|
|
373
|
-
|
|
374
|
-
/** BaseMultipleInput 組件 Props 類型 */
|
|
375
|
-
export interface BaseMultipleInputProps {
|
|
376
|
-
/** 模型值(字符串數組) */
|
|
377
|
-
modelValue: string[]
|
|
378
|
-
/** 輸入框類型 */
|
|
379
|
-
type?: string
|
|
380
|
-
/** 驗證規則函數 */
|
|
381
|
-
validateRule?: (inputString: string) => boolean
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/** BaseMultipleInput 組件 Emits 類型 */
|
|
385
|
-
export interface BaseMultipleInputEmits {
|
|
386
|
-
/** 更新模型值事件 */
|
|
387
|
-
(e: 'update:modelValue', val: string[]): void
|
|
388
|
-
/** 輸入錯誤事件 */
|
|
389
|
-
(e: 'inputError'): void
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/** BaseMultipleInput 組件實例類型 */
|
|
393
|
-
export interface BaseMultipleInputInstance {
|
|
394
|
-
/** 組件 Props */
|
|
395
|
-
$props: BaseMultipleInputProps
|
|
396
|
-
/** 組件 Emits */
|
|
397
|
-
$emit: BaseMultipleInputEmits
|
|
398
|
-
}
|
|
399
372
|
|
|
400
373
|
// ==================== 搜尋相關組件類型 ====================
|
|
401
374
|
|
|
@@ -774,21 +747,6 @@ export declare const BaseInput: DefineComponent<
|
|
|
774
747
|
install: (app: App) => void
|
|
775
748
|
}
|
|
776
749
|
|
|
777
|
-
/** BaseMultipleInput 組件定義 */
|
|
778
|
-
export declare const BaseMultipleInput: DefineComponent<
|
|
779
|
-
BaseMultipleInputProps,
|
|
780
|
-
{},
|
|
781
|
-
{},
|
|
782
|
-
{},
|
|
783
|
-
{},
|
|
784
|
-
{},
|
|
785
|
-
{},
|
|
786
|
-
{},
|
|
787
|
-
BaseMultipleInputEmits
|
|
788
|
-
> & {
|
|
789
|
-
/** 安裝方法 */
|
|
790
|
-
install: (app: App) => void
|
|
791
|
-
}
|
|
792
750
|
|
|
793
751
|
/** SearchBar 組件定義 */
|
|
794
752
|
export declare const SearchBar: DefineComponent<
|
|
@@ -934,8 +892,6 @@ export interface VueTableComponentsPlugin {
|
|
|
934
892
|
TransferDialog: typeof TransferDialog
|
|
935
893
|
/** BaseInput 組件 */
|
|
936
894
|
BaseInput: typeof BaseInput
|
|
937
|
-
/** BaseMultipleInput 組件 */
|
|
938
|
-
BaseMultipleInput: typeof BaseMultipleInput
|
|
939
895
|
/** SearchBar 組件 */
|
|
940
896
|
SearchBar: typeof SearchBar
|
|
941
897
|
/** SearchableListPanel 組件 */
|
|
@@ -964,7 +920,6 @@ declare module '@vue/runtime-core' {
|
|
|
964
920
|
BaseWaringDialog: typeof BaseWaringDialog
|
|
965
921
|
TransferDialog: typeof TransferDialog
|
|
966
922
|
BaseInput: typeof BaseInput
|
|
967
|
-
BaseMultipleInput: typeof BaseMultipleInput
|
|
968
923
|
SearchBar: typeof SearchBar
|
|
969
924
|
SearchableListPanel: typeof SearchableListPanel
|
|
970
925
|
FunctionHeader: typeof FunctionHeader
|
package/dist/src/utils/i18n.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function setLocale(locale: string): void;
|
|
|
6
6
|
/**
|
|
7
7
|
* 全域 i18n 實例(用於非組件環境)
|
|
8
8
|
*/
|
|
9
|
-
export declare function useI18n(): Composer
|
|
9
|
+
export declare function useI18n(): Composer;
|
|
10
10
|
/**
|
|
11
11
|
* 組件庫內部使用的 Element Plus locale composable
|
|
12
12
|
* 專門用於組件庫內部的 Element Plus 組件
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -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'
|
|
@@ -97,7 +96,6 @@ export type { default as SearchBarType } from './items/SearchBar.vue'
|
|
|
97
96
|
export type { default as TransferDialogType } from './transfer/TransferDialog.vue'
|
|
98
97
|
export type { default as TransferItemType } from './transfer/transferItem.vue'
|
|
99
98
|
export type { default as SearchableListPanelType } from './layout/SearchableListPanel.vue'
|
|
100
|
-
export type { default as BaseMultipleInputType } from './form/BaseMultipleInput.vue'
|
|
101
99
|
export type { default as FunctionHeaderType } from './layout/FunctionHeader.vue'
|
|
102
100
|
export type { default as MainPanelType } from './layout/MainPanel.vue'
|
|
103
101
|
export type { default as DetailLayoutType } from './layout/DetailLayout.vue'
|
|
@@ -56,14 +56,15 @@ const buttonClass = computed(() => {
|
|
|
56
56
|
|
|
57
57
|
<style scoped lang="scss">
|
|
58
58
|
.el-button {
|
|
59
|
-
|
|
59
|
+
font-size: 0.875rem;
|
|
60
|
+
line-height: 1.25rem;
|
|
60
61
|
|
|
61
62
|
:deep(span) {
|
|
62
|
-
|
|
63
|
+
font-weight: 700 !important;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
&:focus-visible {
|
|
66
|
-
|
|
67
|
+
outline: none !important;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
// 主要按钮样式
|
|
@@ -109,5 +110,136 @@ const buttonClass = computed(() => {
|
|
|
109
110
|
--el-button-disabled-text-color: var(--el-text-color-placeholder);
|
|
110
111
|
--el-button-text-color: var(--el-text-color-regular);
|
|
111
112
|
}
|
|
113
|
+
|
|
114
|
+
// 成功按钮样式
|
|
115
|
+
&--success {
|
|
116
|
+
--el-button-bg-color: var(--el-fill-color-blank);
|
|
117
|
+
--el-button-border-color: var(--el-color-success);
|
|
118
|
+
--el-button-hover-bg-color: var(--el-color-success);
|
|
119
|
+
--el-button-hover-border-color: var(--el-color-success);
|
|
120
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
121
|
+
--el-button-active-bg-color: var(--el-color-success-dark-2);
|
|
122
|
+
--el-button-active-border-color: var(--el-color-success-dark-2);
|
|
123
|
+
--el-button-disabled-bg-color: var(--el-fill-color-blank);
|
|
124
|
+
--el-button-disabled-border-color: var(--el-color-success-light-7);
|
|
125
|
+
--el-button-disabled-text-color: var(--el-color-success-light-7);
|
|
126
|
+
--el-button-text-color: var(--el-color-success);
|
|
127
|
+
|
|
128
|
+
&.is-fill {
|
|
129
|
+
--el-button-bg-color: var(--el-color-success);
|
|
130
|
+
--el-button-border-color: var(--el-color-success);
|
|
131
|
+
--el-button-hover-bg-color: var(--el-color-success-dark-2);
|
|
132
|
+
--el-button-hover-border-color: var(--el-color-success-dark-2);
|
|
133
|
+
--el-button-active-bg-color: var(--el-color-success-dark-2);
|
|
134
|
+
--el-button-active-border-color: var(--el-color-success-dark-2);
|
|
135
|
+
--el-button-disabled-bg-color: var(--el-color-success-light-7);
|
|
136
|
+
--el-button-disabled-border-color: var(--el-color-success-light-7);
|
|
137
|
+
--el-button-text-color: var(--el-fill-color-blank);
|
|
138
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 警告按钮样式
|
|
143
|
+
&--warning {
|
|
144
|
+
--el-button-bg-color: var(--el-fill-color-blank);
|
|
145
|
+
--el-button-border-color: var(--el-color-warning);
|
|
146
|
+
--el-button-hover-bg-color: var(--el-color-warning);
|
|
147
|
+
--el-button-hover-border-color: var(--el-color-warning);
|
|
148
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
149
|
+
--el-button-active-bg-color: var(--el-color-warning-dark-2);
|
|
150
|
+
--el-button-active-border-color: var(--el-color-warning-dark-2);
|
|
151
|
+
--el-button-disabled-bg-color: var(--el-fill-color-blank);
|
|
152
|
+
--el-button-disabled-border-color: var(--el-color-warning-light-7);
|
|
153
|
+
--el-button-disabled-text-color: var(--el-color-warning-light-7);
|
|
154
|
+
--el-button-text-color: var(--el-color-warning);
|
|
155
|
+
|
|
156
|
+
&.is-fill {
|
|
157
|
+
--el-button-bg-color: var(--el-color-warning);
|
|
158
|
+
--el-button-border-color: var(--el-color-warning);
|
|
159
|
+
--el-button-hover-bg-color: var(--el-color-warning-dark-2);
|
|
160
|
+
--el-button-hover-border-color: var(--el-color-warning-dark-2);
|
|
161
|
+
--el-button-active-bg-color: var(--el-color-warning-dark-2);
|
|
162
|
+
--el-button-active-border-color: var(--el-color-warning-dark-2);
|
|
163
|
+
--el-button-disabled-bg-color: var(--el-color-warning-light-7);
|
|
164
|
+
--el-button-disabled-border-color: var(--el-color-warning-light-7);
|
|
165
|
+
--el-button-text-color: var(--el-fill-color-blank);
|
|
166
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 危险按钮样式
|
|
171
|
+
&--danger {
|
|
172
|
+
--el-button-bg-color: var(--el-fill-color-blank);
|
|
173
|
+
--el-button-border-color: var(--el-color-danger);
|
|
174
|
+
--el-button-hover-bg-color: var(--el-color-danger);
|
|
175
|
+
--el-button-hover-border-color: var(--el-color-danger);
|
|
176
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
177
|
+
--el-button-active-bg-color: var(--el-color-danger-dark-2);
|
|
178
|
+
--el-button-active-border-color: var(--el-color-danger-dark-2);
|
|
179
|
+
--el-button-disabled-bg-color: var(--el-fill-color-blank);
|
|
180
|
+
--el-button-disabled-border-color: var(--el-color-danger-light-7);
|
|
181
|
+
--el-button-disabled-text-color: var(--el-color-danger-light-7);
|
|
182
|
+
--el-button-text-color: var(--el-color-danger);
|
|
183
|
+
|
|
184
|
+
&.is-fill {
|
|
185
|
+
--el-button-bg-color: var(--el-color-danger);
|
|
186
|
+
--el-button-border-color: var(--el-color-danger);
|
|
187
|
+
--el-button-hover-bg-color: var(--el-color-danger-dark-2);
|
|
188
|
+
--el-button-hover-border-color: var(--el-color-danger-dark-2);
|
|
189
|
+
--el-button-active-bg-color: var(--el-color-danger-dark-2);
|
|
190
|
+
--el-button-active-border-color: var(--el-color-danger-dark-2);
|
|
191
|
+
--el-button-disabled-bg-color: var(--el-color-danger-light-7);
|
|
192
|
+
--el-button-disabled-border-color: var(--el-color-danger-light-7);
|
|
193
|
+
--el-button-text-color: var(--el-fill-color-blank);
|
|
194
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// 信息按钮样式
|
|
199
|
+
&--info {
|
|
200
|
+
--el-button-bg-color: var(--el-fill-color-blank);
|
|
201
|
+
--el-button-border-color: var(--el-color-info);
|
|
202
|
+
--el-button-hover-bg-color: var(--el-color-info);
|
|
203
|
+
--el-button-hover-border-color: var(--el-color-info);
|
|
204
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
205
|
+
--el-button-active-bg-color: var(--el-color-info-dark-2);
|
|
206
|
+
--el-button-active-border-color: var(--el-color-info-dark-2);
|
|
207
|
+
--el-button-disabled-bg-color: var(--el-fill-color-blank);
|
|
208
|
+
--el-button-disabled-border-color: var(--el-color-info-light-7);
|
|
209
|
+
--el-button-disabled-text-color: var(--el-color-info-light-7);
|
|
210
|
+
--el-button-text-color: var(--el-color-info);
|
|
211
|
+
|
|
212
|
+
&.is-fill {
|
|
213
|
+
--el-button-bg-color: var(--el-color-info);
|
|
214
|
+
--el-button-border-color: var(--el-color-info);
|
|
215
|
+
--el-button-hover-bg-color: var(--el-color-info-dark-2);
|
|
216
|
+
--el-button-hover-border-color: var(--el-color-info-dark-2);
|
|
217
|
+
--el-button-active-bg-color: var(--el-color-info-dark-2);
|
|
218
|
+
--el-button-active-border-color: var(--el-color-info-dark-2);
|
|
219
|
+
--el-button-disabled-bg-color: var(--el-color-info-light-7);
|
|
220
|
+
--el-button-disabled-border-color: var(--el-color-info-light-7);
|
|
221
|
+
--el-button-text-color: var(--el-fill-color-blank);
|
|
222
|
+
--el-button-hover-text-color: var(--el-fill-color-blank);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// 通用禁用样式
|
|
227
|
+
&.is-disabled {
|
|
228
|
+
cursor: not-allowed;
|
|
229
|
+
opacity: 0.6;
|
|
230
|
+
|
|
231
|
+
&:hover {
|
|
232
|
+
transform: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&:active {
|
|
236
|
+
transform: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 填充樣式的禁用狀態 - 使用白色文字
|
|
241
|
+
&.is-fill.is-disabled {
|
|
242
|
+
color: white !important;
|
|
243
|
+
}
|
|
112
244
|
}
|
|
113
245
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { toRefs, computed
|
|
2
|
+
import { toRefs, computed } from 'vue'
|
|
3
3
|
import type { Pager } from '@/types'
|
|
4
4
|
import { MainPanel, SearchBar } from '@/components'
|
|
5
5
|
import { useComponentElementLocale } from '@/utils/i18n'
|
|
@@ -55,30 +55,13 @@ const showPager = computed(() => {
|
|
|
55
55
|
}
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
// 在 computed 外部調用,保持引用穩定
|
|
59
|
-
const fallbackLocale = useComponentElementLocale()
|
|
60
|
-
|
|
61
|
-
// 監聽 fallbackLocale 的變化
|
|
62
|
-
watch(fallbackLocale, (newLocale, oldLocale) => {
|
|
63
|
-
console.log('🔄 [SearchableListPanel] fallbackLocale 變化:', {
|
|
64
|
-
old: oldLocale?.name,
|
|
65
|
-
new: newLocale?.name
|
|
66
|
-
})
|
|
67
|
-
}, { immediate: true })
|
|
68
|
-
|
|
69
58
|
// 優先使用 prop,沒有 prop 則使用 composable
|
|
70
59
|
const elementLocale = computed(() => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// 檢查 props.locale 是否為真正的 Language 對象(不是預設值)
|
|
74
|
-
if (props.locale && typeof props.locale === 'object' && 'name' in props.locale) {
|
|
75
|
-
console.log('🔍 [SearchableListPanel] 使用 props.locale:', props.locale.name)
|
|
60
|
+
if (props.locale) {
|
|
76
61
|
return props.locale
|
|
77
62
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// 現在能正確追蹤響應式
|
|
81
|
-
return fallbackLocale.value
|
|
63
|
+
// 回退:使用簡化的 composable
|
|
64
|
+
return useComponentElementLocale().value
|
|
82
65
|
})
|
|
83
66
|
</script>
|
|
84
67
|
|
|
@@ -370,33 +370,6 @@ export interface BaseInputInstance {
|
|
|
370
370
|
$emit: BaseInputEmits
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
// ==================== BaseMultipleInput 組件類型 ====================
|
|
374
|
-
|
|
375
|
-
/** BaseMultipleInput 組件 Props 類型 */
|
|
376
|
-
export interface BaseMultipleInputProps {
|
|
377
|
-
/** 模型值(字符串數組) */
|
|
378
|
-
modelValue: string[]
|
|
379
|
-
/** 輸入框類型 */
|
|
380
|
-
type?: string
|
|
381
|
-
/** 驗證規則函數 */
|
|
382
|
-
validateRule?: (inputString: string) => boolean
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/** BaseMultipleInput 組件 Emits 類型 */
|
|
386
|
-
export interface BaseMultipleInputEmits {
|
|
387
|
-
/** 更新模型值事件 */
|
|
388
|
-
(e: 'update:modelValue', val: string[]): void
|
|
389
|
-
/** 輸入錯誤事件 */
|
|
390
|
-
(e: 'inputError'): void
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/** BaseMultipleInput 組件實例類型 */
|
|
394
|
-
export interface BaseMultipleInputInstance {
|
|
395
|
-
/** 組件 Props */
|
|
396
|
-
$props: BaseMultipleInputProps
|
|
397
|
-
/** 組件 Emits */
|
|
398
|
-
$emit: BaseMultipleInputEmits
|
|
399
|
-
}
|
|
400
373
|
|
|
401
374
|
// ==================== 搜尋相關組件類型 ====================
|
|
402
375
|
|
|
@@ -775,21 +748,6 @@ export declare const BaseInput: DefineComponent<
|
|
|
775
748
|
install: (app: App) => void
|
|
776
749
|
}
|
|
777
750
|
|
|
778
|
-
/** BaseMultipleInput 組件定義 */
|
|
779
|
-
export declare const BaseMultipleInput: DefineComponent<
|
|
780
|
-
BaseMultipleInputProps,
|
|
781
|
-
{},
|
|
782
|
-
{},
|
|
783
|
-
{},
|
|
784
|
-
{},
|
|
785
|
-
{},
|
|
786
|
-
{},
|
|
787
|
-
{},
|
|
788
|
-
BaseMultipleInputEmits
|
|
789
|
-
> & {
|
|
790
|
-
/** 安裝方法 */
|
|
791
|
-
install: (app: App) => void
|
|
792
|
-
}
|
|
793
751
|
|
|
794
752
|
/** SearchBar 組件定義 */
|
|
795
753
|
export declare const SearchBar: DefineComponent<
|
|
@@ -935,8 +893,6 @@ export interface VueTableComponentsPlugin {
|
|
|
935
893
|
TransferDialog: typeof TransferDialog
|
|
936
894
|
/** BaseInput 組件 */
|
|
937
895
|
BaseInput: typeof BaseInput
|
|
938
|
-
/** BaseMultipleInput 組件 */
|
|
939
|
-
BaseMultipleInput: typeof BaseMultipleInput
|
|
940
896
|
/** SearchBar 組件 */
|
|
941
897
|
SearchBar: typeof SearchBar
|
|
942
898
|
/** SearchableListPanel 組件 */
|
|
@@ -965,7 +921,6 @@ declare module '@vue/runtime-core' {
|
|
|
965
921
|
BaseWaringDialog: typeof BaseWaringDialog
|
|
966
922
|
TransferDialog: typeof TransferDialog
|
|
967
923
|
BaseInput: typeof BaseInput
|
|
968
|
-
BaseMultipleInput: typeof BaseMultipleInput
|
|
969
924
|
SearchBar: typeof SearchBar
|
|
970
925
|
SearchableListPanel: typeof SearchableListPanel
|
|
971
926
|
FunctionHeader: typeof FunctionHeader
|
package/src/utils/i18n.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createI18n, type I18n, type Composer } from 'vue-i18n'
|
|
2
|
-
import {
|
|
2
|
+
import { computed } from 'vue'
|
|
3
3
|
import { messages } from '../locales'
|
|
4
4
|
import zhTw from 'element-plus/es/locale/lang/zh-tw'
|
|
5
|
-
import enUs from 'element-plus/es/locale/lang/en'
|
|
6
5
|
|
|
7
6
|
// 內部 i18n 實例
|
|
8
7
|
let internalI18n: I18n | null = null
|
|
@@ -41,11 +40,8 @@ export function setLocale(locale: string): void {
|
|
|
41
40
|
* 全域 i18n 實例(用於非組件環境)
|
|
42
41
|
*/
|
|
43
42
|
export function useI18n() {
|
|
44
|
-
console.log('🔍 [useI18n] 開始執行')
|
|
45
43
|
const i18n = getInternalI18n()
|
|
46
|
-
|
|
47
|
-
console.log('🔍 [useI18n] 返回內部 i18n,locale:', global.locale.value)
|
|
48
|
-
return global
|
|
44
|
+
return i18n.global as Composer
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
/**
|
|
@@ -53,42 +49,8 @@ export function useI18n() {
|
|
|
53
49
|
* 專門用於組件庫內部的 Element Plus 組件
|
|
54
50
|
*/
|
|
55
51
|
export function useComponentElementLocale() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return computed(() => {
|
|
59
|
-
console.log('🔍 [useComponentElementLocale] computed 開始執行')
|
|
60
|
-
|
|
61
|
-
// 在 computed 內部嘗試獲取外部 i18n(確保響應式)
|
|
62
|
-
const instance = getCurrentInstance()
|
|
63
|
-
let externalLocale: any = undefined
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
console.log('🔍 [useComponentElementLocale] 嘗試獲取外部 i18n')
|
|
67
|
-
const globalProperties = instance?.appContext.config.globalProperties
|
|
68
|
-
const externalI18nInstance = globalProperties?.$i18n as I18n | undefined
|
|
69
|
-
|
|
70
|
-
if (externalI18nInstance && 'global' in externalI18nInstance) {
|
|
71
|
-
externalLocale = externalI18nInstance.global.locale
|
|
72
|
-
console.log('🔍 [useComponentElementLocale] 成功獲取外部 locale:', externalLocale.value)
|
|
73
|
-
} else {
|
|
74
|
-
console.log('🔍 [useComponentElementLocale] 外部 i18n 不存在')
|
|
75
|
-
}
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.log('❌ [useComponentElementLocale] 獲取外部 i18n 失敗:', e)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// 獲取內部 i18n(回退)
|
|
81
|
-
const { locale: internalLocale } = useI18n()
|
|
82
|
-
console.log('🔍 [useComponentElementLocale] 內部 locale:', internalLocale.value)
|
|
83
|
-
|
|
84
|
-
// 決定使用哪個 locale
|
|
85
|
-
const currentLocale = externalLocale || internalLocale
|
|
86
|
-
console.log('🔍 [useComponentElementLocale] 最終使用 locale:', currentLocale.value)
|
|
87
|
-
|
|
88
|
-
const result = currentLocale.value === 'zh-TW' ? zhTw : enUs
|
|
89
|
-
console.log('🔍 [useComponentElementLocale] 返回結果:', result.name)
|
|
90
|
-
return result
|
|
91
|
-
})
|
|
52
|
+
// 直接返回預設中文
|
|
53
|
+
return computed(() => zhTw)
|
|
92
54
|
}
|
|
93
55
|
|
|
94
56
|
// 導出類型
|