rayyy-vue-table-components 1.4.5 → 2.0.0
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/dist/index.es.js +13993 -10306
- package/dist/index.umd.js +40 -20
- package/dist/rayyy-vue-table-components.css +1 -1
- package/dist/src/components/items/BaseWaringDialog.vue.d.ts +1 -4
- package/dist/src/index.d.ts +3 -0
- package/dist/src/locales/en-US.json.d.ts +39 -0
- package/dist/src/locales/index.d.ts +80 -0
- package/dist/src/locales/zh-TW.json.d.ts +39 -0
- package/dist/src/router/constants.d.ts +2 -0
- package/dist/src/types/components.d.ts +2 -0
- package/dist/src/utils/i18n.d.ts +21 -0
- package/dist/src/views/demo/I18nTestDemo.vue.d.ts +2 -0
- package/package.json +10 -2
- package/src/components/form/BaseSelector.vue +5 -2
- package/src/components/items/BaseDialog.vue +12 -3
- package/src/components/items/BaseWaringDialog.vue +7 -10
- package/src/components/items/SearchBar.vue +4 -1
- package/src/components/layout/DetailLayout.vue +5 -2
- package/src/components/layout/FilterLayout.vue +5 -2
- package/src/components/layout/SearchableListPanel.vue +1 -1
- package/src/components/tables/BaseTable.vue +6 -3
- package/src/components/tables/SortTable.vue +2 -2
- package/src/components/tables/TitleTable.vue +15 -3
- package/src/components/transfer/TransferDialog.vue +4 -1
- package/src/locales/en-US.json +37 -0
- package/src/locales/index.d.ts +10 -0
- package/src/locales/index.ts +12 -0
- package/src/locales/zh-TW.json +37 -0
- package/src/types/components.d.ts +2 -0
- package/src/utils/i18n.ts +89 -0
|
@@ -20,10 +20,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
20
20
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
21
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
22
22
|
"onUpdate:submit"?: (() => any) | undefined;
|
|
23
|
-
}>, {
|
|
24
|
-
waringText: string;
|
|
25
|
-
titleText: string;
|
|
26
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
24
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
28
25
|
export default _default;
|
|
29
26
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -8,12 +8,15 @@ 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 { useComponentI18n, useI18n, setLocale } from './utils/i18n';
|
|
12
|
+
export * from './locales';
|
|
11
13
|
export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, TitleTable, SearchBar };
|
|
12
14
|
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
|
|
13
15
|
export * from './components';
|
|
14
16
|
export declare function install(app: App, options?: {
|
|
15
17
|
autoImportStyles?: boolean;
|
|
16
18
|
prefix?: string;
|
|
19
|
+
locale?: string;
|
|
17
20
|
}): void;
|
|
18
21
|
declare const _default: {
|
|
19
22
|
length: number;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"common.select": "Please select",
|
|
3
|
+
"common.confirm": "Confirm",
|
|
4
|
+
"common.cancel": "Cancel",
|
|
5
|
+
"dialog.confirmRemoveUser": "Are you sure you want to remove this user?",
|
|
6
|
+
"common.warning": "Warning",
|
|
7
|
+
"search.placeholder": "Please enter keywords to search the list",
|
|
8
|
+
"common.execute": "Execute",
|
|
9
|
+
"common.reset": "Reset",
|
|
10
|
+
"common.loading": "Data loading",
|
|
11
|
+
"common.view": "View",
|
|
12
|
+
"common.edit": "Edit",
|
|
13
|
+
"common.column": "Column",
|
|
14
|
+
"common.back": " Back",
|
|
15
|
+
"demo.componentDemo": "Component Demo",
|
|
16
|
+
"button.title": "Button",
|
|
17
|
+
"button.primary ": "Primary",
|
|
18
|
+
"button.default": "Default",
|
|
19
|
+
"button.danger": "Danger",
|
|
20
|
+
"button.success": "Success",
|
|
21
|
+
"button.warning": "Warning",
|
|
22
|
+
"button.info": "Info",
|
|
23
|
+
"button.style": "Style",
|
|
24
|
+
"button.size": "Size",
|
|
25
|
+
"button.small": "Small",
|
|
26
|
+
"button.medium": "Medium",
|
|
27
|
+
"button.large ": "Large",
|
|
28
|
+
"status.title": "Status",
|
|
29
|
+
"status.normal ": "Normal",
|
|
30
|
+
"status.loading": "Loading",
|
|
31
|
+
"status.disabled": "Disabled",
|
|
32
|
+
"button.withIcon ": "With Icon",
|
|
33
|
+
"button.add": "Add",
|
|
34
|
+
"button.delete": "Delete",
|
|
35
|
+
"common.save": "Save",
|
|
36
|
+
"common.discard": "Discard"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { default as zhTW } from './zh-TW.json';
|
|
2
|
+
import { default as enUS } from './en-US.json';
|
|
3
|
+
export declare const messages: {
|
|
4
|
+
'zh-TW': {
|
|
5
|
+
"common.select": string;
|
|
6
|
+
"common.confirm": string;
|
|
7
|
+
"common.cancel": string;
|
|
8
|
+
"dialog.confirmRemoveUser": string;
|
|
9
|
+
"common.warning": string;
|
|
10
|
+
"search.placeholder": string;
|
|
11
|
+
"common.execute": string;
|
|
12
|
+
"common.reset": string;
|
|
13
|
+
"common.loading": string;
|
|
14
|
+
"common.view": string;
|
|
15
|
+
"common.edit": string;
|
|
16
|
+
"common.column": string;
|
|
17
|
+
"common.back": string;
|
|
18
|
+
"demo.componentDemo": string;
|
|
19
|
+
"button.title": string;
|
|
20
|
+
"button.primary ": string;
|
|
21
|
+
"button.default": string;
|
|
22
|
+
"button.danger": string;
|
|
23
|
+
"button.success": string;
|
|
24
|
+
"button.warning": string;
|
|
25
|
+
"button.info": string;
|
|
26
|
+
"button.style": string;
|
|
27
|
+
"button.size": string;
|
|
28
|
+
"button.small": string;
|
|
29
|
+
"button.medium": string;
|
|
30
|
+
"button.large ": string;
|
|
31
|
+
"status.title": string;
|
|
32
|
+
"status.normal ": string;
|
|
33
|
+
"status.loading": string;
|
|
34
|
+
"status.disabled": string;
|
|
35
|
+
"button.withIcon ": string;
|
|
36
|
+
"button.add": string;
|
|
37
|
+
"button.delete": string;
|
|
38
|
+
"common.save": string;
|
|
39
|
+
"common.discard": string;
|
|
40
|
+
};
|
|
41
|
+
'en-US': {
|
|
42
|
+
"common.select": string;
|
|
43
|
+
"common.confirm": string;
|
|
44
|
+
"common.cancel": string;
|
|
45
|
+
"dialog.confirmRemoveUser": string;
|
|
46
|
+
"common.warning": string;
|
|
47
|
+
"search.placeholder": string;
|
|
48
|
+
"common.execute": string;
|
|
49
|
+
"common.reset": string;
|
|
50
|
+
"common.loading": string;
|
|
51
|
+
"common.view": string;
|
|
52
|
+
"common.edit": string;
|
|
53
|
+
"common.column": string;
|
|
54
|
+
"common.back": string;
|
|
55
|
+
"demo.componentDemo": string;
|
|
56
|
+
"button.title": string;
|
|
57
|
+
"button.primary ": string;
|
|
58
|
+
"button.default": string;
|
|
59
|
+
"button.danger": string;
|
|
60
|
+
"button.success": string;
|
|
61
|
+
"button.warning": string;
|
|
62
|
+
"button.info": string;
|
|
63
|
+
"button.style": string;
|
|
64
|
+
"button.size": string;
|
|
65
|
+
"button.small": string;
|
|
66
|
+
"button.medium": string;
|
|
67
|
+
"button.large ": string;
|
|
68
|
+
"status.title": string;
|
|
69
|
+
"status.normal ": string;
|
|
70
|
+
"status.loading": string;
|
|
71
|
+
"status.disabled": string;
|
|
72
|
+
"button.withIcon ": string;
|
|
73
|
+
"button.add": string;
|
|
74
|
+
"button.delete": string;
|
|
75
|
+
"common.save": string;
|
|
76
|
+
"common.discard": string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export type LocaleType = keyof typeof messages;
|
|
80
|
+
export { zhTW, enUS };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"common.select": "請選擇",
|
|
3
|
+
"common.confirm": "確定",
|
|
4
|
+
"common.cancel": "取消",
|
|
5
|
+
"dialog.confirmRemoveUser": "請問是否確認移除該使用者",
|
|
6
|
+
"common.warning": "警告",
|
|
7
|
+
"search.placeholder": "請輸入關鍵字搜尋列表",
|
|
8
|
+
"common.execute": "執行",
|
|
9
|
+
"common.reset": "重設",
|
|
10
|
+
"common.loading": "數據加載中",
|
|
11
|
+
"common.view": "查看",
|
|
12
|
+
"common.edit": "編輯",
|
|
13
|
+
"common.column": "欄",
|
|
14
|
+
"common.back": "回到前一頁",
|
|
15
|
+
"demo.componentDemo": "組件示範",
|
|
16
|
+
"button.title": "按鈕",
|
|
17
|
+
"button.primary ": "主要",
|
|
18
|
+
"button.default": "默認",
|
|
19
|
+
"button.danger": "危險",
|
|
20
|
+
"button.success": "成功",
|
|
21
|
+
"button.warning": "警告",
|
|
22
|
+
"button.info": "信息",
|
|
23
|
+
"button.style": "樣式",
|
|
24
|
+
"button.size": "尺寸",
|
|
25
|
+
"button.small": "小",
|
|
26
|
+
"button.medium": "中",
|
|
27
|
+
"button.large ": "大",
|
|
28
|
+
"status.title": "狀態",
|
|
29
|
+
"status.normal ": "正常",
|
|
30
|
+
"status.loading": "載入中",
|
|
31
|
+
"status.disabled": "禁用",
|
|
32
|
+
"button.withIcon ": "帶圖標的",
|
|
33
|
+
"button.add": "添加",
|
|
34
|
+
"button.delete": "刪除",
|
|
35
|
+
"common.save": "儲存",
|
|
36
|
+
"common.discard": "捨棄"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default _default;
|
|
@@ -18,6 +18,7 @@ export declare const ROUTES: {
|
|
|
18
18
|
readonly MAIN_PANEL: "/demo/main-panel";
|
|
19
19
|
readonly DETAIL_LAYOUT: "/demo/detail-layout";
|
|
20
20
|
readonly FILTER_LAYOUT: "/demo/filter-layout";
|
|
21
|
+
readonly I18N_TEST: "/demo/i18n-test";
|
|
21
22
|
readonly NOT_FOUND: "/:catchAll(.*)";
|
|
22
23
|
};
|
|
23
24
|
export declare const ROUTE_NAMES: {
|
|
@@ -39,5 +40,6 @@ export declare const ROUTE_NAMES: {
|
|
|
39
40
|
readonly MAIN_PANEL: "MainPanel";
|
|
40
41
|
readonly DETAIL_LAYOUT: "DetailLayout";
|
|
41
42
|
readonly FILTER_LAYOUT: "FilterLayout";
|
|
43
|
+
readonly I18N_TEST: "I18nTest";
|
|
42
44
|
readonly NOT_FOUND: "NotFoundPage";
|
|
43
45
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { I18n, Composer } from 'vue-i18n';
|
|
2
|
+
/**
|
|
3
|
+
* 設定內部 i18n 的語系
|
|
4
|
+
*/
|
|
5
|
+
export declare function setLocale(locale: string): void;
|
|
6
|
+
/**
|
|
7
|
+
* 組件內使用的 i18n composable
|
|
8
|
+
* 會優先使用外部專案的 i18n,如果不存在則使用內部 i18n
|
|
9
|
+
*/
|
|
10
|
+
export declare function useComponentI18n(): {
|
|
11
|
+
t: import('vue-i18n').ComposerTranslation<{}, string, import('@intlify/core-base').RemoveIndexSignature<{
|
|
12
|
+
[x: string]: import('vue-i18n').LocaleMessageValue<import('vue-i18n').VueMessageType>;
|
|
13
|
+
}>, never, never, never>;
|
|
14
|
+
locale: import('vue').WritableComputedRef<string, string>;
|
|
15
|
+
i18n: Composer<{}, {}, {}, string, never, string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 全域 i18n 實例(用於非組件環境)
|
|
19
|
+
*/
|
|
20
|
+
export declare function useI18n(): Composer;
|
|
21
|
+
export type { I18n, Composer };
|
|
@@ -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": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Vue 3 + Element Plus 表格組件庫",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/src/utils/tableStyles.d.ts",
|
|
34
34
|
"import": "./src/utils/tableStyles.ts"
|
|
35
35
|
},
|
|
36
|
+
"./locales": {
|
|
37
|
+
"types": "./src/locales/index.d.ts",
|
|
38
|
+
"import": "./src/locales/index.ts"
|
|
39
|
+
},
|
|
36
40
|
"./styles": "./dist/rayyy-vue-table-components.css",
|
|
37
41
|
"./styles/element": "./src/assets/styles/element/index.scss"
|
|
38
42
|
},
|
|
@@ -43,6 +47,7 @@
|
|
|
43
47
|
"src/types/*",
|
|
44
48
|
"src/types/components.d.ts",
|
|
45
49
|
"src/utils/*",
|
|
50
|
+
"src/locales/*",
|
|
46
51
|
"src/assets/styles/*",
|
|
47
52
|
"tailwind-preset.js",
|
|
48
53
|
"README.md"
|
|
@@ -82,13 +87,15 @@
|
|
|
82
87
|
"lint": "eslint . --fix",
|
|
83
88
|
"format": "prettier --write src/",
|
|
84
89
|
"prepublishOnly": "npm run build",
|
|
90
|
+
"fetchI18n": "node ./scripts/fetch-i18n.js",
|
|
85
91
|
"release:patch": "./scripts/release.sh patch",
|
|
86
92
|
"release:minor": "./scripts/release.sh minor",
|
|
87
93
|
"release:major": "./scripts/release.sh major"
|
|
88
94
|
},
|
|
89
95
|
"peerDependencies": {
|
|
90
96
|
"element-plus": "^2.9.3",
|
|
91
|
-
"vue": "^3.0.0"
|
|
97
|
+
"vue": "^3.0.0",
|
|
98
|
+
"vue-i18n": "^10.0.0"
|
|
92
99
|
},
|
|
93
100
|
"devDependencies": {
|
|
94
101
|
"@tsconfig/node22": "^22.0.0",
|
|
@@ -126,6 +133,7 @@
|
|
|
126
133
|
"vite-plugin-vue-devtools": "^7.7.2",
|
|
127
134
|
"vitest": "^3.0.8",
|
|
128
135
|
"vue": "^3.5.13",
|
|
136
|
+
"vue-i18n": "^10.0.5",
|
|
129
137
|
"vue-router": "^4.5.0",
|
|
130
138
|
"vue-tsc": "^2.2.8",
|
|
131
139
|
"vuedraggable": "^4.1.0"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
v-bind="attrs"
|
|
4
4
|
:model-value="modelValue"
|
|
5
5
|
:class="props.class"
|
|
6
|
-
:placeholder="props.placeholder"
|
|
6
|
+
:placeholder="props.placeholder || t('common.select')"
|
|
7
7
|
:clearable="props.clearable"
|
|
8
8
|
:collapse-tags="props.collapseTags"
|
|
9
9
|
:collapse-tags-tooltip="props.collapseTagsTooltip"
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
<script lang="ts" setup>
|
|
21
21
|
import { useAttrs } from 'vue'
|
|
22
|
+
import { useI18n } from 'vue-i18n'
|
|
22
23
|
import type { ElOptions } from '@/types/OptionDto.ts'
|
|
23
24
|
|
|
25
|
+
const { t } = useI18n()
|
|
26
|
+
|
|
24
27
|
export type Selection = string | string[]
|
|
25
28
|
|
|
26
29
|
const props = withDefaults(
|
|
@@ -38,7 +41,7 @@ const props = withDefaults(
|
|
|
38
41
|
{
|
|
39
42
|
modelValue: () => '',
|
|
40
43
|
options: () => [{ value: '', label: '' }],
|
|
41
|
-
placeholder: '
|
|
44
|
+
placeholder: '',
|
|
42
45
|
class: 'w-full',
|
|
43
46
|
},
|
|
44
47
|
)
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import { useWindowSize } from '@vueuse/core'
|
|
4
5
|
import BaseBtn from './BaseBtn.vue'
|
|
5
6
|
|
|
7
|
+
const { t } = useI18n()
|
|
8
|
+
|
|
6
9
|
const props = defineProps<{
|
|
7
10
|
modelValue: boolean
|
|
8
11
|
title?: string
|
|
@@ -81,16 +84,22 @@ const handleSubmit = () => {
|
|
|
81
84
|
<template #footer>
|
|
82
85
|
<footer>
|
|
83
86
|
<slot name="customFooter">
|
|
84
|
-
<base-btn
|
|
87
|
+
<base-btn
|
|
88
|
+
:text="t('common.back')"
|
|
89
|
+
type="primary"
|
|
90
|
+
is-fill
|
|
91
|
+
@click="handleCancel"
|
|
92
|
+
v-if="showClose"
|
|
93
|
+
/>
|
|
85
94
|
<template v-if="!showClose">
|
|
86
95
|
<base-btn
|
|
87
|
-
text="
|
|
96
|
+
:text="t('common.confirm')"
|
|
88
97
|
type="primary"
|
|
89
98
|
is-fill
|
|
90
99
|
@click="handleSubmit"
|
|
91
100
|
:loading="submitLoading"
|
|
92
101
|
/>
|
|
93
|
-
<base-btn text="
|
|
102
|
+
<base-btn :text="t('common.cancel')" type="primary" @click="handleCancel" />
|
|
94
103
|
</template>
|
|
95
104
|
</slot>
|
|
96
105
|
</footer>
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import BaseDialog from './BaseDialog.vue'
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
const { t } = useI18n()
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
7
9
|
modelValue: boolean
|
|
8
10
|
waringText?: string
|
|
9
11
|
subWaringText?: string
|
|
10
12
|
titleText?: string
|
|
11
13
|
modalWidth?: string
|
|
12
|
-
}>()
|
|
13
|
-
{
|
|
14
|
-
waringText: '請問是否確認移除該使用者',
|
|
15
|
-
titleText: '警告',
|
|
16
|
-
},
|
|
17
|
-
)
|
|
14
|
+
}>()
|
|
18
15
|
|
|
19
16
|
const emit = defineEmits<{
|
|
20
17
|
(e: 'update:modelValue', value: boolean): void
|
|
@@ -33,7 +30,7 @@ const handleSubmit = () => {
|
|
|
33
30
|
<template>
|
|
34
31
|
<base-dialog
|
|
35
32
|
v-model="dialogVisible"
|
|
36
|
-
:title="titleText"
|
|
33
|
+
:title="titleText || t('common.warning')"
|
|
37
34
|
:custom-width="modalWidth"
|
|
38
35
|
:is-waring="true"
|
|
39
36
|
@click:submit="handleSubmit"
|
|
@@ -41,7 +38,7 @@ const handleSubmit = () => {
|
|
|
41
38
|
<div class="w-full h-16 flex items-center justify-center flex-col">
|
|
42
39
|
<slot>
|
|
43
40
|
<p>{{ subWaringText }}</p>
|
|
44
|
-
<p>{{ waringText }} ?</p>
|
|
41
|
+
<p>{{ waringText || t('dialog.confirmRemoveUser') }} ?</p>
|
|
45
42
|
</slot>
|
|
46
43
|
</div>
|
|
47
44
|
</base-dialog>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref, useAttrs } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import BaseInput from '../form/BaseInput.vue'
|
|
4
5
|
|
|
6
|
+
const { t } = useI18n()
|
|
7
|
+
|
|
5
8
|
defineProps<{
|
|
6
9
|
showSearch?: boolean
|
|
7
10
|
}>()
|
|
@@ -38,7 +41,7 @@ const resetFilter = () => {
|
|
|
38
41
|
<div v-if="showSearch" class="search-input">
|
|
39
42
|
<base-input
|
|
40
43
|
v-model="keyword"
|
|
41
|
-
placeholder="
|
|
44
|
+
:placeholder="t('search.placeholder')"
|
|
42
45
|
:show-word-limit="true"
|
|
43
46
|
:show-search="true"
|
|
44
47
|
@keydown.enter="doSearch"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from 'vue-i18n'
|
|
2
3
|
import { MainPanel, BaseBtn, SearchableListPanel } from '@/components'
|
|
3
4
|
|
|
5
|
+
const { t } = useI18n()
|
|
6
|
+
|
|
4
7
|
defineProps<{
|
|
5
8
|
title: string
|
|
6
9
|
showBack?: boolean | string | object
|
|
@@ -39,8 +42,8 @@ const handleBackClick = () => {
|
|
|
39
42
|
|
|
40
43
|
<template #footer>
|
|
41
44
|
<div class="border-t py-4 w-full flex items-center justify-end" v-if="isEditable">
|
|
42
|
-
<BaseBtn text="
|
|
43
|
-
<BaseBtn text="
|
|
45
|
+
<BaseBtn :text="t('common.save')" type="primary" is-fill @click="saveDetailEdit" />
|
|
46
|
+
<BaseBtn :text="t('common.discard')" type="primary" @click="cancelDetailEdit" />
|
|
44
47
|
</div>
|
|
45
48
|
</template>
|
|
46
49
|
</MainPanel>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from 'vue-i18n'
|
|
2
3
|
import { MainPanel, BaseBtn } from '@/components'
|
|
3
4
|
|
|
5
|
+
const { t } = useI18n()
|
|
6
|
+
|
|
4
7
|
defineProps<{
|
|
5
8
|
mainTitle: string
|
|
6
9
|
showBack?: boolean | string | object
|
|
@@ -36,8 +39,8 @@ const handleBackClick = () => {
|
|
|
36
39
|
</template>
|
|
37
40
|
<template #footer>
|
|
38
41
|
<div class="submit-row">
|
|
39
|
-
<base-btn text="
|
|
40
|
-
<base-btn text="
|
|
42
|
+
<base-btn :text="t('common.execute')" is-fill type="primary" @click="doFilter" />
|
|
43
|
+
<base-btn :text="t('common.reset')" type="primary" @click="resetFilter" />
|
|
41
44
|
</div>
|
|
42
45
|
</template>
|
|
43
46
|
</MainPanel>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, unknown> = Record<string, unknown>">
|
|
2
2
|
import type { VNode } from 'vue'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
+
import { useI18n } from 'vue-i18n'
|
|
4
5
|
import type { TableColumnCtx } from 'element-plus'
|
|
5
6
|
import type { SortChangValue, TableColumn } from '@/types'
|
|
6
7
|
|
|
8
|
+
const { t } = useI18n()
|
|
9
|
+
|
|
7
10
|
type Props<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
8
11
|
loading?: boolean
|
|
9
12
|
data: T[]
|
|
@@ -79,7 +82,7 @@ const operatorWidth = computed(() => {
|
|
|
79
82
|
<template>
|
|
80
83
|
<el-table
|
|
81
84
|
v-loading="loading"
|
|
82
|
-
element-loading-text="
|
|
85
|
+
:element-loading-text="t('common.loading')"
|
|
83
86
|
:data="data"
|
|
84
87
|
border
|
|
85
88
|
:show-summary="showSummary"
|
|
@@ -127,7 +130,7 @@ const operatorWidth = computed(() => {
|
|
|
127
130
|
@click="handleOperateClick(row, 'check')"
|
|
128
131
|
v-if="showCheckBtn"
|
|
129
132
|
>
|
|
130
|
-
|
|
133
|
+
{{ t('common.view') }}
|
|
131
134
|
</p>
|
|
132
135
|
<el-divider direction="vertical" class="!mx-2" v-if="showCheckBtn && showEditBtn" />
|
|
133
136
|
<p
|
|
@@ -135,7 +138,7 @@ const operatorWidth = computed(() => {
|
|
|
135
138
|
@click="handleOperateClick(row, 'edit')"
|
|
136
139
|
v-if="showEditBtn"
|
|
137
140
|
>
|
|
138
|
-
|
|
141
|
+
{{ t('common.edit') }}
|
|
139
142
|
</p>
|
|
140
143
|
</div>
|
|
141
144
|
</template>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, unknown>">
|
|
2
2
|
import type { SortChangValue, TableColumn } from '@/types'
|
|
3
3
|
import type { TableColumnCtx } from 'element-plus'
|
|
4
|
-
import {
|
|
4
|
+
import { reactive, type VNode } from 'vue'
|
|
5
5
|
import { Setting } from '@element-plus/icons-vue'
|
|
6
6
|
import { BaseTable } from '@/components'
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
defineProps<{
|
|
9
10
|
data: T[]
|
|
10
11
|
columns: TableColumn<T>[]
|
|
@@ -99,7 +100,6 @@ const state = reactive({
|
|
|
99
100
|
|
|
100
101
|
<base-table
|
|
101
102
|
v-loading="loading"
|
|
102
|
-
element-loading-text="數據加載中..."
|
|
103
103
|
:data="data"
|
|
104
104
|
:columns="columns"
|
|
105
105
|
:show-summary="showSummary"
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, unknown>">
|
|
2
2
|
import type { VNode } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import type { TableColumnCtx } from 'element-plus'
|
|
4
5
|
import type { TableColumn } from 'src/types'
|
|
5
6
|
import { BaseTable, BaseBtn } from '@/components'
|
|
6
7
|
|
|
8
|
+
const { t } = useI18n()
|
|
9
|
+
|
|
7
10
|
// 使用泛型 T 來定義數據類型
|
|
8
11
|
defineProps<{
|
|
9
12
|
data: T[]
|
|
@@ -68,8 +71,18 @@ const handleEditClick = (row: T) => {
|
|
|
68
71
|
<slot name="tableSearch" />
|
|
69
72
|
|
|
70
73
|
<div class="flex items-center" v-if="propIsEditable">
|
|
71
|
-
<BaseBtn
|
|
72
|
-
|
|
74
|
+
<BaseBtn
|
|
75
|
+
:text="t('button.add')"
|
|
76
|
+
type="primary"
|
|
77
|
+
@click="addInvoiceDetail"
|
|
78
|
+
v-if="!onlyDelete"
|
|
79
|
+
/>
|
|
80
|
+
<BaseBtn
|
|
81
|
+
:text="t('button.delete')"
|
|
82
|
+
type="primary"
|
|
83
|
+
@click="deleteSelectRow"
|
|
84
|
+
v-if="showDelete"
|
|
85
|
+
/>
|
|
73
86
|
</div>
|
|
74
87
|
</div>
|
|
75
88
|
</div>
|
|
@@ -77,7 +90,6 @@ const handleEditClick = (row: T) => {
|
|
|
77
90
|
<!-- 表格主體 -->
|
|
78
91
|
<base-table
|
|
79
92
|
v-loading="loading"
|
|
80
|
-
element-loading-text="數據加載中..."
|
|
81
93
|
:data="data"
|
|
82
94
|
:columns="columns"
|
|
83
95
|
:show-summary="showSummary"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T = Record<string, unknown>">
|
|
2
2
|
import { computed, reactive, watch } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
3
4
|
import type { TableColumn } from 'src/types'
|
|
4
5
|
import _ from 'lodash'
|
|
5
6
|
import type { CheckboxValueType } from 'element-plus'
|
|
@@ -7,6 +8,8 @@ import BaseDialog from '../items/BaseDialog.vue'
|
|
|
7
8
|
import TransferItem from '@/components/transfer/transferItem.vue'
|
|
8
9
|
import SearchBar from '../items/SearchBar.vue'
|
|
9
10
|
|
|
11
|
+
const { t } = useI18n()
|
|
12
|
+
|
|
10
13
|
const props = defineProps<{
|
|
11
14
|
modelValue: boolean
|
|
12
15
|
columnsValue: TableColumn<T>[]
|
|
@@ -147,7 +150,7 @@ const doFilterColumn = (keyword: string) => {
|
|
|
147
150
|
</div>
|
|
148
151
|
<div class="transfer-sort-wrapper">
|
|
149
152
|
<el-checkbox v-model="checkAll" class="px-4" @change="handleCheckAllChange">
|
|
150
|
-
|
|
153
|
+
{{ t('common.column') }} ({{ state.checkList.length }}/{{ state.localColumns.length }})
|
|
151
154
|
</el-checkbox>
|
|
152
155
|
<el-checkbox-group v-model="state.checkList" @change="handleCheckChange">
|
|
153
156
|
<!-- 自定義列表容器 slot,讓外部可以選擇是否使用 draggable -->
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"common.select": "Please select",
|
|
3
|
+
"common.confirm": "Confirm",
|
|
4
|
+
"common.cancel": "Cancel",
|
|
5
|
+
"dialog.confirmRemoveUser": "Are you sure you want to remove this user?",
|
|
6
|
+
"common.warning": "Warning",
|
|
7
|
+
"search.placeholder": "Please enter keywords to search the list",
|
|
8
|
+
"common.execute": "Execute",
|
|
9
|
+
"common.reset": "Reset",
|
|
10
|
+
"common.loading": "Data loading",
|
|
11
|
+
"common.view": "View",
|
|
12
|
+
"common.edit": "Edit",
|
|
13
|
+
"common.column": "Column",
|
|
14
|
+
"common.back": " Back",
|
|
15
|
+
"demo.componentDemo": "Component Demo",
|
|
16
|
+
"button.title": "Button",
|
|
17
|
+
"button.primary ": "Primary",
|
|
18
|
+
"button.default": "Default",
|
|
19
|
+
"button.danger": "Danger",
|
|
20
|
+
"button.success": "Success",
|
|
21
|
+
"button.warning": "Warning",
|
|
22
|
+
"button.info": "Info",
|
|
23
|
+
"button.style": "Style",
|
|
24
|
+
"button.size": "Size",
|
|
25
|
+
"button.small": "Small",
|
|
26
|
+
"button.medium": "Medium",
|
|
27
|
+
"button.large ": "Large",
|
|
28
|
+
"status.title": "Status",
|
|
29
|
+
"status.normal ": "Normal",
|
|
30
|
+
"status.loading": "Loading",
|
|
31
|
+
"status.disabled": "Disabled",
|
|
32
|
+
"button.withIcon ": "With Icon",
|
|
33
|
+
"button.add": "Add",
|
|
34
|
+
"button.delete": "Delete",
|
|
35
|
+
"common.save": "Save",
|
|
36
|
+
"common.discard": "Discard"
|
|
37
|
+
}
|