rayyy-vue-table-components 1.3.32 → 1.4.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 +10401 -15108
- package/dist/index.umd.js +20 -41
- package/dist/rayyy-vue-table-components.css +1 -1
- package/dist/src/components/form/BaseMultipleInput.vue.d.ts +549 -0
- package/dist/src/components/index.d.ts +3 -2
- package/dist/src/components/items/BaseDialog.vue.d.ts +1 -0
- package/dist/src/components/items/BaseWaringDialog.vue.d.ts +4 -1
- package/dist/src/components/items/SearchBar.vue.d.ts +2 -0
- package/dist/src/components/layout/SearchableListPanel.vue.d.ts +4 -1
- package/dist/src/const/tableConst.d.ts +51 -0
- package/dist/src/index.d.ts +1 -12
- package/dist/src/router/constants.d.ts +2 -2
- package/dist/src/types/components.d.ts +6 -47
- package/dist/src/{components/LanguageSwitcher.vue.d.ts → views/demo/BaseMultipleInputDemo.vue.d.ts} +1 -1
- package/package.json +2 -6
- package/src/components/form/BaseMultipleInput.vue +112 -0
- package/src/components/form/BaseSelector.vue +62 -0
- package/src/components/index.ts +3 -2
- package/src/components/items/BaseDialog.vue +12 -11
- package/src/components/items/BaseWaringDialog.vue +13 -10
- package/src/components/items/SearchBar.vue +6 -4
- package/src/components/layout/DetailLayout.vue +4 -7
- package/src/components/layout/FilterLayout.vue +2 -5
- package/src/components/layout/FunctionHeader.vue +0 -1
- package/src/components/layout/SearchableListPanel.vue +15 -9
- package/src/components/tables/BaseTable.vue +3 -6
- package/src/components/tables/SortTable.vue +3 -2
- package/src/components/tables/TitleTable.vue +2 -1
- package/src/types/components.d.ts +6 -47
- package/dist/src/locales/en-US.json.d.ts +0 -39
- package/dist/src/locales/zh-TW.json.d.ts +0 -39
- package/dist/src/plugins/i18n.d.ts +0 -504
- package/dist/src/utils/languageSwitcher.d.ts +0 -49
- package/dist/src/views/demo/I18nDemo.vue.d.ts +0 -2
- package/src/components/LanguageSwitcher.vue +0 -53
- package/src/utils/languageSwitcher.ts +0 -145
|
@@ -1,3 +1,28 @@
|
|
|
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
|
+
}];
|
|
1
26
|
export declare const DEMO_CONSTANTS: {
|
|
2
27
|
readonly LOADING_DURATION: 2000;
|
|
3
28
|
readonly STATUS_CONFIG: {
|
|
@@ -30,3 +55,29 @@ export interface User extends Record<string, unknown> {
|
|
|
30
55
|
joinDate: string;
|
|
31
56
|
}
|
|
32
57
|
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
|
+
}];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,23 +3,12 @@ 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';
|
|
7
6
|
import { default as SortTable } from './components/tables/SortTable.vue';
|
|
8
7
|
import { default as TitleTable } from './components/tables/TitleTable.vue';
|
|
9
8
|
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';
|
|
17
|
-
import { default as LanguageSwitcher } from './components/LanguageSwitcher.vue';
|
|
18
9
|
export * from './types';
|
|
19
10
|
export * from './utils/tableHelper';
|
|
20
|
-
export {
|
|
21
|
-
export { switchLanguage as switchLanguageUtil, getCurrentLocale as getCurrentLocaleUtil, availableLocales as availableLocalesUtil, getLanguageName as getLanguageNameUtil, getLocaleConfig, getCurrentLocaleConfig as getCurrentLocaleConfigUtil, initLanguageSwitcher, configureLanguageSwitcher, type LocaleCode, type LocaleConfig, type LanguageConfig, type ExternalI18nHandler } from './utils/languageSwitcher';
|
|
22
|
-
export { BaseTable, BaseBtn, BaseInput, BaseDialog, BaseWaringDialog, SortTable, TitleTable, SearchBar, TransferDialog, TransferItem, FunctionHeader, MainPanel, SearchableListPanel, DetailLayout, FilterLayout, LanguageSwitcher };
|
|
11
|
+
export { BaseTable, BaseBtn, BaseInput, BaseDialog, SortTable, TitleTable, SearchBar };
|
|
23
12
|
export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
|
|
24
13
|
export * from './components';
|
|
25
14
|
export declare function install(app: App, options?: {
|
|
@@ -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
|
|
8
|
+
readonly BASE_MULTIPLE_INPUT: "/demo/base-multiple-input";
|
|
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
|
|
31
|
+
readonly BASE_MULTIPLE_INPUT: "BaseMultipleInput";
|
|
32
32
|
readonly TRANSFER_DIALOG: "TransferDialog";
|
|
33
33
|
readonly BASE_TABLE: "BaseTable";
|
|
34
34
|
readonly BASE_BTN: "BaseBtn";
|
|
@@ -238,6 +238,8 @@ export interface BaseDialogProps {
|
|
|
238
238
|
bodyLoading?: boolean
|
|
239
239
|
/** 提交按鈕加載狀態 */
|
|
240
240
|
submitLoading?: boolean
|
|
241
|
+
/** 是否顯示關閉按鈕 */
|
|
242
|
+
showClose?: boolean
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
/** BaseDialog 組件 Emits 類型 */
|
|
@@ -409,6 +411,8 @@ export interface SearchBarEmits {
|
|
|
409
411
|
(e: 'keydown:enter', data: string): void
|
|
410
412
|
/** 清除事件 */
|
|
411
413
|
(e: 'update:clear'): void
|
|
414
|
+
/** 重置篩選事件 */
|
|
415
|
+
(e: 'update:resetFilter'): void
|
|
412
416
|
}
|
|
413
417
|
|
|
414
418
|
/** SearchBar 組件實例類型 */
|
|
@@ -445,6 +449,8 @@ export interface SearchableListPanelProps {
|
|
|
445
449
|
showFilter?: boolean
|
|
446
450
|
/** 是否顯示預設搜尋 */
|
|
447
451
|
showDefaultSearch?: boolean
|
|
452
|
+
/** 分頁大小選項列表 */
|
|
453
|
+
pageSizeList?: number[]
|
|
448
454
|
}
|
|
449
455
|
|
|
450
456
|
/** SearchableListPanel 組件 Emits 類型 */
|
|
@@ -637,34 +643,6 @@ export interface TransferItemInstance {
|
|
|
637
643
|
$emit: TransferItemEmits
|
|
638
644
|
}
|
|
639
645
|
|
|
640
|
-
// ==================== 語言切換相關組件類型 ====================
|
|
641
|
-
|
|
642
|
-
// ==================== LanguageSwitcher 組件類型 ====================
|
|
643
|
-
|
|
644
|
-
/** LanguageSwitcher 組件 Props 類型 */
|
|
645
|
-
export interface LanguageSwitcherProps {
|
|
646
|
-
/** 是否顯示語言名稱 */
|
|
647
|
-
showLabel?: boolean
|
|
648
|
-
/** 自定義 CSS 類名 */
|
|
649
|
-
class?: string
|
|
650
|
-
/** 是否禁用 */
|
|
651
|
-
disabled?: boolean
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/** LanguageSwitcher 組件 Emits 類型 */
|
|
655
|
-
export interface LanguageSwitcherEmits {
|
|
656
|
-
/** 語言變更事件 */
|
|
657
|
-
(e: 'change', locale: string): void
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/** LanguageSwitcher 組件實例類型 */
|
|
661
|
-
export interface LanguageSwitcherInstance {
|
|
662
|
-
/** 組件 Props */
|
|
663
|
-
$props: LanguageSwitcherProps
|
|
664
|
-
/** 組件 Emits */
|
|
665
|
-
$emit: LanguageSwitcherEmits
|
|
666
|
-
}
|
|
667
|
-
|
|
668
646
|
// ==================== 組件定義類型 ====================
|
|
669
647
|
|
|
670
648
|
/** BaseTable 組件定義 */
|
|
@@ -924,22 +902,6 @@ export declare const TransferItem: DefineComponent<
|
|
|
924
902
|
install: (app: App) => void
|
|
925
903
|
}
|
|
926
904
|
|
|
927
|
-
/** LanguageSwitcher 組件定義 */
|
|
928
|
-
export declare const LanguageSwitcher: DefineComponent<
|
|
929
|
-
LanguageSwitcherProps,
|
|
930
|
-
{},
|
|
931
|
-
{},
|
|
932
|
-
{},
|
|
933
|
-
{},
|
|
934
|
-
{},
|
|
935
|
-
{},
|
|
936
|
-
{},
|
|
937
|
-
LanguageSwitcherEmits
|
|
938
|
-
> & {
|
|
939
|
-
/** 安裝方法 */
|
|
940
|
-
install: (app: App) => void
|
|
941
|
-
}
|
|
942
|
-
|
|
943
905
|
// ==================== 插件類型 ====================
|
|
944
906
|
|
|
945
907
|
/** 插件安裝選項 */
|
|
@@ -986,8 +948,6 @@ export interface VueTableComponentsPlugin {
|
|
|
986
948
|
FilterLayout: typeof FilterLayout
|
|
987
949
|
/** TransferItem 組件 */
|
|
988
950
|
TransferItem: typeof TransferItem
|
|
989
|
-
/** LanguageSwitcher 組件 */
|
|
990
|
-
LanguageSwitcher: typeof LanguageSwitcher
|
|
991
951
|
}
|
|
992
952
|
|
|
993
953
|
// ==================== 全局類型擴展 ====================
|
|
@@ -1010,6 +970,5 @@ declare module '@vue/runtime-core' {
|
|
|
1010
970
|
DetailLayout: typeof DetailLayout
|
|
1011
971
|
FilterLayout: typeof FilterLayout
|
|
1012
972
|
TransferItem: typeof TransferItem
|
|
1013
|
-
LanguageSwitcher: typeof LanguageSwitcher
|
|
1014
973
|
}
|
|
1015
974
|
}
|
package/dist/src/{components/LanguageSwitcher.vue.d.ts → views/demo/BaseMultipleInputDemo.vue.d.ts}
RENAMED
|
@@ -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, {},
|
|
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>;
|
|
2
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
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Vue 3 + Element Plus 表格組件庫",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -84,8 +84,7 @@
|
|
|
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"
|
|
88
|
-
"fetchI18n": "node ./scripts/fetch-i18n.js"
|
|
87
|
+
"release:major": "./scripts/release.sh major"
|
|
89
88
|
},
|
|
90
89
|
"peerDependencies": {
|
|
91
90
|
"element-plus": "^2.9.3",
|
|
@@ -130,8 +129,5 @@
|
|
|
130
129
|
"vue-router": "^4.5.0",
|
|
131
130
|
"vue-tsc": "^2.2.8",
|
|
132
131
|
"vuedraggable": "^4.1.0"
|
|
133
|
-
},
|
|
134
|
-
"dependencies": {
|
|
135
|
-
"vue-i18n": "^11.1.12"
|
|
136
132
|
}
|
|
137
133
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, useAttrs } from 'vue'
|
|
3
|
+
import type { ElInput } from 'element-plus'
|
|
4
|
+
|
|
5
|
+
const inputValue = ref<string>('')
|
|
6
|
+
const InputRef = ref<InstanceType<typeof ElInput>>()
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
modelValue: string[]
|
|
11
|
+
type?: string
|
|
12
|
+
validateRule?: (inputString: string) => boolean
|
|
13
|
+
}>(),
|
|
14
|
+
{
|
|
15
|
+
type: 'textarea',
|
|
16
|
+
validateRule: () => true,
|
|
17
|
+
},
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
// 獲取所有非 props 屬性
|
|
21
|
+
const attrs = useAttrs()
|
|
22
|
+
|
|
23
|
+
const emits = defineEmits<{
|
|
24
|
+
(e: 'update:modelValue', val: string[]): void
|
|
25
|
+
(e: 'inputError'): void
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
const remove = (position: number) => {
|
|
29
|
+
emits(
|
|
30
|
+
'update:modelValue',
|
|
31
|
+
props.modelValue.filter((input, index) => index !== position),
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const handleInputConfirm = () => {
|
|
36
|
+
const inputString = inputValue.value
|
|
37
|
+
if (!inputString) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (!props.validateRule(inputString)) {
|
|
41
|
+
emits('inputError')
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
if (!props.modelValue.includes(inputString)) {
|
|
45
|
+
emits('update:modelValue', props.modelValue.concat(inputValue.value))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
inputValue.value = ''
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const focusInput = () => {
|
|
52
|
+
InputRef.value?.focus()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const deleteLastTag = () => {
|
|
56
|
+
if (inputValue.value) {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
emits('update:modelValue', props.modelValue.slice(0, -1))
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<div v-bind="attrs" class="w-full border border-t rounded" @click="focusInput">
|
|
65
|
+
<el-tag
|
|
66
|
+
v-for="(tag, position) in props.modelValue"
|
|
67
|
+
:key="tag"
|
|
68
|
+
class="m-0.5 break-all whitespace-pre-line"
|
|
69
|
+
closable
|
|
70
|
+
@close="() => remove(position)"
|
|
71
|
+
>
|
|
72
|
+
{{ tag }}
|
|
73
|
+
</el-tag>
|
|
74
|
+
<el-input
|
|
75
|
+
ref="InputRef"
|
|
76
|
+
v-model="inputValue"
|
|
77
|
+
:type="props.type"
|
|
78
|
+
class="shadow-none"
|
|
79
|
+
autosize
|
|
80
|
+
resize="none"
|
|
81
|
+
@keydown.enter.prevent="handleInputConfirm"
|
|
82
|
+
@blur="handleInputConfirm"
|
|
83
|
+
@keydown.delete.stop="deleteLastTag"
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<style scoped lang="scss">
|
|
89
|
+
:deep(.el-input) {
|
|
90
|
+
--el-input-border-color: transparent;
|
|
91
|
+
--el-input-focus-border-color: transparent;
|
|
92
|
+
--el-border-color-hover: transparent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:deep(.el-input__inner) {
|
|
96
|
+
box-shadow: none !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:deep(.el-input__inner:hover) {
|
|
100
|
+
box-shadow: none !important;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:deep(.el-input)::-webkit-outer-spin-button,
|
|
104
|
+
:deep(.el-input)::-webkit-inner-spin-button {
|
|
105
|
+
-webkit-appearance: none;
|
|
106
|
+
margin: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:deep(.el-input[type='number']) {
|
|
110
|
+
-moz-appearance: textfield;
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-select
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
:model-value="modelValue"
|
|
5
|
+
:class="props.class"
|
|
6
|
+
:placeholder="props.placeholder"
|
|
7
|
+
:clearable="props.clearable"
|
|
8
|
+
:collapse-tags="props.collapseTags"
|
|
9
|
+
:collapse-tags-tooltip="props.collapseTagsTooltip"
|
|
10
|
+
:multiple="props.multiple"
|
|
11
|
+
:disabled="props.disabled"
|
|
12
|
+
:reserve-keyword="false"
|
|
13
|
+
filterable
|
|
14
|
+
@update:model-value="updateValue"
|
|
15
|
+
>
|
|
16
|
+
<el-option v-for="it in options" :key="it.label" :label="it.label" :value="it.value" />
|
|
17
|
+
</el-select>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { useAttrs } from 'vue'
|
|
22
|
+
import type { ElOptions } from '@/types/OptionDto.ts'
|
|
23
|
+
|
|
24
|
+
export type Selection = string | string[]
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(
|
|
27
|
+
defineProps<{
|
|
28
|
+
modelValue?: Selection
|
|
29
|
+
options?: ElOptions[]
|
|
30
|
+
placeholder?: string
|
|
31
|
+
clearable?: boolean
|
|
32
|
+
collapseTags?: boolean
|
|
33
|
+
collapseTagsTooltip?: boolean
|
|
34
|
+
multiple?: boolean
|
|
35
|
+
disabled?: boolean
|
|
36
|
+
class?: string
|
|
37
|
+
}>(),
|
|
38
|
+
{
|
|
39
|
+
modelValue: () => '',
|
|
40
|
+
options: () => [{ value: '', label: '' }],
|
|
41
|
+
placeholder: '請選擇',
|
|
42
|
+
class: 'w-full',
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// 獲取所有非 props 屬性
|
|
47
|
+
const attrs = useAttrs()
|
|
48
|
+
|
|
49
|
+
const emits = defineEmits<{
|
|
50
|
+
(e: 'update:modelValue', data?: Selection): void
|
|
51
|
+
}>()
|
|
52
|
+
|
|
53
|
+
function updateValue(val: Selection) {
|
|
54
|
+
let value: Selection | undefined = val
|
|
55
|
+
|
|
56
|
+
if (typeof value === 'string' && !value) {
|
|
57
|
+
value = undefined
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
emits('update:modelValue', value)
|
|
61
|
+
}
|
|
62
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ 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'
|
|
7
8
|
export { default as SortTable } from './tables/SortTable.vue'
|
|
8
9
|
export { default as TitleTable } from './tables/TitleTable.vue'
|
|
9
10
|
export { default as SearchBar } from './items/SearchBar.vue'
|
|
@@ -14,7 +15,6 @@ export { default as MainPanel } from './layout/MainPanel.vue'
|
|
|
14
15
|
export { default as SearchableListPanel } from './layout/SearchableListPanel.vue'
|
|
15
16
|
export { default as DetailLayout } from './layout/DetailLayout.vue'
|
|
16
17
|
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,6 +97,7 @@ 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'
|
|
100
101
|
export type { default as FunctionHeaderType } from './layout/FunctionHeader.vue'
|
|
101
102
|
export type { default as MainPanelType } from './layout/MainPanel.vue'
|
|
102
103
|
export type { default as DetailLayoutType } from './layout/DetailLayout.vue'
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { useWindowSize } from '@vueuse/core'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
4
|
import BaseBtn from './BaseBtn.vue'
|
|
6
5
|
|
|
7
|
-
const { t } = useI18n()
|
|
8
|
-
|
|
9
6
|
const props = defineProps<{
|
|
10
7
|
modelValue: boolean
|
|
11
8
|
title?: string
|
|
@@ -16,6 +13,7 @@ const props = defineProps<{
|
|
|
16
13
|
isPrimary?: boolean
|
|
17
14
|
bodyLoading?: boolean
|
|
18
15
|
submitLoading?: boolean
|
|
16
|
+
showClose?: boolean
|
|
19
17
|
}>()
|
|
20
18
|
|
|
21
19
|
const { width } = useWindowSize()
|
|
@@ -83,14 +81,17 @@ const handleSubmit = () => {
|
|
|
83
81
|
<template #footer>
|
|
84
82
|
<footer>
|
|
85
83
|
<slot name="customFooter">
|
|
86
|
-
<base-btn
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
<base-btn text="關閉" type="primary" is-fill @click="handleCancel" v-if="showClose" />
|
|
85
|
+
<template v-if="!showClose">
|
|
86
|
+
<base-btn
|
|
87
|
+
text="確定"
|
|
88
|
+
type="primary"
|
|
89
|
+
is-fill
|
|
90
|
+
@click="handleSubmit"
|
|
91
|
+
:loading="submitLoading"
|
|
92
|
+
/>
|
|
93
|
+
<base-btn text="取消" type="primary" @click="handleCancel" />
|
|
94
|
+
</template>
|
|
94
95
|
</slot>
|
|
95
96
|
</footer>
|
|
96
97
|
</template>
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
|
-
import { useI18n } from 'vue-i18n'
|
|
4
3
|
import BaseDialog from './BaseDialog.vue'
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
modelValue: boolean
|
|
8
|
+
waringText?: string
|
|
9
|
+
subWaringText?: string
|
|
10
|
+
titleText?: string
|
|
11
|
+
modalWidth?: string
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
waringText: '請問是否確認移除該使用者',
|
|
15
|
+
titleText: '警告',
|
|
16
|
+
},
|
|
17
|
+
)
|
|
15
18
|
|
|
16
19
|
const emit = defineEmits<{
|
|
17
20
|
(e: 'update:modelValue', value: boolean): void
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref, useAttrs } from 'vue'
|
|
3
|
-
import { useI18n } from 'vue-i18n'
|
|
4
3
|
import BaseInput from '../form/BaseInput.vue'
|
|
5
4
|
|
|
6
|
-
const { t } = useI18n()
|
|
7
|
-
|
|
8
5
|
defineProps<{
|
|
9
6
|
showSearch?: boolean
|
|
10
7
|
}>()
|
|
@@ -12,6 +9,7 @@ defineProps<{
|
|
|
12
9
|
const emits = defineEmits<{
|
|
13
10
|
(e: 'keydown:enter', data: string): void
|
|
14
11
|
(e: 'update:clear'): void
|
|
12
|
+
(e: 'update:resetFilter'): void
|
|
15
13
|
}>()
|
|
16
14
|
|
|
17
15
|
// 獲取所有非 props 屬性
|
|
@@ -25,6 +23,9 @@ const doSearch = () => {
|
|
|
25
23
|
const clearableClick = () => {
|
|
26
24
|
emits('update:clear')
|
|
27
25
|
}
|
|
26
|
+
const resetFilter = () => {
|
|
27
|
+
emits('update:resetFilter')
|
|
28
|
+
}
|
|
28
29
|
</script>
|
|
29
30
|
|
|
30
31
|
<template>
|
|
@@ -37,8 +38,9 @@ const clearableClick = () => {
|
|
|
37
38
|
<div v-if="showSearch" class="search-input">
|
|
38
39
|
<base-input
|
|
39
40
|
v-model="keyword"
|
|
40
|
-
|
|
41
|
+
placeholder="請輸入關鍵字搜尋列表"
|
|
41
42
|
:show-word-limit="true"
|
|
43
|
+
:show-search="true"
|
|
42
44
|
@keydown.enter="doSearch"
|
|
43
45
|
@update:clearValue="clearableClick"
|
|
44
46
|
class="search-input_inner"
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { MainPanel, BaseBtn } from '@/components'
|
|
4
|
-
|
|
5
|
-
const { t } = useI18n()
|
|
2
|
+
import { MainPanel, BaseBtn, SearchableListPanel } from '@/components'
|
|
6
3
|
|
|
7
4
|
defineProps<{
|
|
8
5
|
title: string
|
|
@@ -41,9 +38,9 @@ const handleBackClick = () => {
|
|
|
41
38
|
</template>
|
|
42
39
|
|
|
43
40
|
<template #footer>
|
|
44
|
-
<div class="border-t
|
|
45
|
-
<BaseBtn
|
|
46
|
-
<BaseBtn
|
|
41
|
+
<div class="border-t py-4 w-full flex items-center justify-end" v-if="isEditable">
|
|
42
|
+
<BaseBtn text="儲存" type="primary" is-fill @click="saveDetailEdit" />
|
|
43
|
+
<BaseBtn text="捨棄" type="primary" @click="cancelDetailEdit" />
|
|
47
44
|
</div>
|
|
48
45
|
</template>
|
|
49
46
|
</MainPanel>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useI18n } from 'vue-i18n'
|
|
3
2
|
import { MainPanel, BaseBtn } from '@/components'
|
|
4
3
|
|
|
5
|
-
const { t } = useI18n()
|
|
6
|
-
|
|
7
4
|
defineProps<{
|
|
8
5
|
mainTitle: string
|
|
9
6
|
showBack?: boolean | string | object
|
|
@@ -39,8 +36,8 @@ const handleBackClick = () => {
|
|
|
39
36
|
</template>
|
|
40
37
|
<template #footer>
|
|
41
38
|
<div class="submit-row">
|
|
42
|
-
<base-btn
|
|
43
|
-
<base-btn
|
|
39
|
+
<base-btn text="執行" is-fill type="primary" @click="doFilter" />
|
|
40
|
+
<base-btn text="重設" type="primary" @click="resetFilter" />
|
|
44
41
|
</div>
|
|
45
42
|
</template>
|
|
46
43
|
</MainPanel>
|
|
@@ -3,15 +3,21 @@ import { toRefs, computed } from 'vue'
|
|
|
3
3
|
import type { Pager } from '@/types'
|
|
4
4
|
import { MainPanel, SearchBar } from '@/components'
|
|
5
5
|
|
|
6
|
-
const props =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
title: string
|
|
9
|
+
pagination: Pager
|
|
10
|
+
showBack?: boolean | string | object
|
|
11
|
+
showSearch?: boolean
|
|
12
|
+
showEdit?: boolean
|
|
13
|
+
showFilter?: boolean
|
|
14
|
+
showDefaultSearch?: boolean
|
|
15
|
+
pageSizeList?: number[]
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
pageSizeList: () => [10, 20, 30, 40, 50],
|
|
19
|
+
},
|
|
20
|
+
)
|
|
15
21
|
|
|
16
22
|
const { pagination } = toRefs(props)
|
|
17
23
|
|