rayyy-vue-table-components 1.2.13 → 1.2.14
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 +10862 -9213
- package/dist/index.umd.js +39 -20
- package/dist/rayyy-vue-table-components.css +1 -1
- package/dist/src/components/BaseForm.vue.d.ts +33 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/stores/layoutStore.d.ts +5 -0
- package/package.json +2 -1
- package/src/assets/styles/_components.scss +10 -1
- package/src/components/BaseForm.vue +61 -0
- package/src/components/index.ts +1 -0
- package/src/components/items/FilterBtn.vue +19 -8
- package/dist/src/stores/counter.d.ts +0 -13
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FormRules } from 'element-plus';
|
|
2
|
+
declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly onSubmit?: (() => any) | undefined;
|
|
5
|
+
readonly "onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
6
|
+
readonly onValidate?: ((valid: boolean) => any) | undefined;
|
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSubmit" | "onUpdate:modelValue" | "onValidate"> & {
|
|
8
|
+
modelValue?: object | undefined;
|
|
9
|
+
rules?: FormRules;
|
|
10
|
+
labelWidth?: string;
|
|
11
|
+
dataCy?: string;
|
|
12
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
13
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
14
|
+
validate: () => Promise<boolean>;
|
|
15
|
+
resetFields: () => void;
|
|
16
|
+
clearValidate: (props?: string | string[]) => void;
|
|
17
|
+
}>): void;
|
|
18
|
+
attrs: any;
|
|
19
|
+
slots: {
|
|
20
|
+
default?(_: {}): any;
|
|
21
|
+
};
|
|
22
|
+
emit: {
|
|
23
|
+
(e: "update:modelValue", value: Record<string, unknown>): void;
|
|
24
|
+
(e: "submit"): void;
|
|
25
|
+
(e: "validate", valid: boolean): void;
|
|
26
|
+
};
|
|
27
|
+
}>) => import('vue').VNode & {
|
|
28
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_PrettifyLocal<T> = {
|
|
32
|
+
[K in keyof T]: T[K];
|
|
33
|
+
} & {};
|
|
@@ -3,6 +3,7 @@ export { default as BaseBtn } from './items/BaseBtn.vue';
|
|
|
3
3
|
export { default as BaseInput } from './items/BaseInput.vue';
|
|
4
4
|
export { default as FilterBtn } from './items/FilterBtn.vue';
|
|
5
5
|
export { default as BaseDialog } from './BaseDialog.vue';
|
|
6
|
+
export { default as BaseForm } from './BaseForm.vue';
|
|
6
7
|
export { default as SortTable } from './tables/SortTable.vue';
|
|
7
8
|
export { default as SearchBar } from './SearchBar.vue';
|
|
8
9
|
export { default as TransferDialog } from './transfer/TransferDialog.vue';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rayyy-vue-table-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "Vue 3 + Element Plus 表格組件庫",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"vite": "^6.2.1",
|
|
126
126
|
"vite-plugin-dts": "^4.5.4",
|
|
127
127
|
"vite-plugin-vue-devtools": "^7.7.2",
|
|
128
|
+
"vite-svg-loader": "^5.1.0",
|
|
128
129
|
"vitest": "^3.0.8",
|
|
129
130
|
"vue": "^3.5.13",
|
|
130
131
|
"vue-router": "^4.5.0",
|
|
@@ -22,12 +22,15 @@
|
|
|
22
22
|
@apply text-sky-500;
|
|
23
23
|
|
|
24
24
|
p {
|
|
25
|
-
@apply text-
|
|
25
|
+
@apply text-primary-80 ml-2 text-base font-bold;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
i {
|
|
29
29
|
@apply text-xl;
|
|
30
30
|
}
|
|
31
|
+
.filter-icon {
|
|
32
|
+
@apply w-5 h-5 stroke-primary;
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
&:hover {
|
|
33
36
|
@apply text-white bg-sky-500;
|
|
@@ -35,6 +38,12 @@
|
|
|
35
38
|
p {
|
|
36
39
|
@apply text-white;
|
|
37
40
|
}
|
|
41
|
+
.filter-icon {
|
|
42
|
+
@apply stroke-white;
|
|
43
|
+
}
|
|
44
|
+
.fill-icon path {
|
|
45
|
+
@apply stroke-white;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
&:disabled {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends Record<string, unknown>">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import type { FormInstance, FormRules } from 'element-plus'
|
|
4
|
+
|
|
5
|
+
type Props<T extends object = object> = {
|
|
6
|
+
modelValue?: T
|
|
7
|
+
rules?: FormRules
|
|
8
|
+
labelWidth?: string
|
|
9
|
+
dataCy?: string
|
|
10
|
+
}
|
|
11
|
+
const props = withDefaults(defineProps<Props>(), {})
|
|
12
|
+
|
|
13
|
+
const computedLabelWidth = computed(() => {
|
|
14
|
+
if (props.labelWidth) return props.labelWidth
|
|
15
|
+
else return '100px'
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const formData = computed(() => props.modelValue)
|
|
19
|
+
|
|
20
|
+
defineEmits<{
|
|
21
|
+
(e: 'update:modelValue', value: Record<string, unknown>): void
|
|
22
|
+
(e: 'submit'): void
|
|
23
|
+
(e: 'validate', valid: boolean): void
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const formRef = ref<FormInstance>()
|
|
27
|
+
|
|
28
|
+
const validate = async () => {
|
|
29
|
+
if (!formRef.value) return false
|
|
30
|
+
return await formRef.value.validate()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const resetFields = () => {
|
|
34
|
+
formRef.value?.resetFields()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const clearValidate = (props?: string | string[]) => {
|
|
38
|
+
formRef.value?.clearValidate(props)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
defineExpose({
|
|
42
|
+
validate,
|
|
43
|
+
resetFields,
|
|
44
|
+
clearValidate,
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<el-form
|
|
50
|
+
ref="formRef"
|
|
51
|
+
:model="formData"
|
|
52
|
+
:label-width="computedLabelWidth"
|
|
53
|
+
:rules="rules"
|
|
54
|
+
@submit.prevent
|
|
55
|
+
class="filter-form"
|
|
56
|
+
>
|
|
57
|
+
<slot></slot>
|
|
58
|
+
</el-form>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<style scoped lang="scss"></style>
|
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 './items/BaseInput.vue'
|
|
5
5
|
export { default as FilterBtn } from './items/FilterBtn.vue'
|
|
6
6
|
export { default as BaseDialog } from './BaseDialog.vue'
|
|
7
|
+
export { default as BaseForm } from './BaseForm.vue'
|
|
7
8
|
export { default as SortTable } from './tables/SortTable.vue'
|
|
8
9
|
export { default as SearchBar } from './SearchBar.vue'
|
|
9
10
|
export { default as TransferDialog } from './transfer/TransferDialog.vue'
|
|
@@ -3,6 +3,9 @@ import { computed, ref } from 'vue'
|
|
|
3
3
|
import { useWindowSize } from '@vueuse/core'
|
|
4
4
|
import { BaseBtn } from '@/components'
|
|
5
5
|
import { Search, Filter } from '@element-plus/icons-vue'
|
|
6
|
+
import { layoutStore } from '@/stores/layoutStore.ts'
|
|
7
|
+
import IconFilter from '@/assets/icons/icon-filter.svg?component'
|
|
8
|
+
import IconFilterBlue from '@/assets/icons/icon-filter-blue.svg?component'
|
|
6
9
|
|
|
7
10
|
const { width } = useWindowSize()
|
|
8
11
|
|
|
@@ -16,7 +19,9 @@ function onClickBtn() {
|
|
|
16
19
|
showDrawer.value = !showDrawer.value
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
const resetValue = () => {
|
|
22
|
+
const resetValue = () => {
|
|
23
|
+
layoutStore.filterDrawerResetClick()
|
|
24
|
+
}
|
|
20
25
|
const computedDrawerSize = computed(() => {
|
|
21
26
|
if (width.value > 1200) {
|
|
22
27
|
return '30%'
|
|
@@ -34,10 +39,15 @@ const submitFilter = () => {
|
|
|
34
39
|
|
|
35
40
|
<template>
|
|
36
41
|
<base-btn type="primary" class="filter-btn" @click="onClickBtn">
|
|
37
|
-
<el-badge
|
|
38
|
-
|
|
42
|
+
<el-badge
|
|
43
|
+
:value="badgeValue"
|
|
44
|
+
class="!flex justify-center items-center"
|
|
45
|
+
type="primary"
|
|
46
|
+
v-if="badgeValue && badgeValue > 0"
|
|
47
|
+
>
|
|
48
|
+
<IconFilterBlue class="filter-icon fill-icon" />
|
|
39
49
|
</el-badge>
|
|
40
|
-
<
|
|
50
|
+
<IconFilter v-else class="filter-icon" />
|
|
41
51
|
</base-btn>
|
|
42
52
|
<el-drawer v-model="showDrawer" append-to-body :size="computedDrawerSize">
|
|
43
53
|
<template #header>
|
|
@@ -55,12 +65,13 @@ const submitFilter = () => {
|
|
|
55
65
|
|
|
56
66
|
<template #footer>
|
|
57
67
|
<base-btn type="primary" class="filter-btn" @click="submitFilter">
|
|
58
|
-
<el-icon
|
|
59
|
-
|
|
68
|
+
<el-icon>
|
|
69
|
+
<Search />
|
|
70
|
+
</el-icon>
|
|
71
|
+
<p>查詢</p>
|
|
60
72
|
</base-btn>
|
|
61
73
|
</template>
|
|
62
74
|
</el-drawer>
|
|
63
75
|
</template>
|
|
64
76
|
|
|
65
|
-
<style scoped lang="scss">
|
|
66
|
-
</style>
|
|
77
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const useCounterStore: import('pinia').StoreDefinition<"counter", Pick<{
|
|
2
|
-
count: import('vue').Ref<number, number>;
|
|
3
|
-
doubleCount: import('vue').ComputedRef<number>;
|
|
4
|
-
increment: () => void;
|
|
5
|
-
}, "count">, Pick<{
|
|
6
|
-
count: import('vue').Ref<number, number>;
|
|
7
|
-
doubleCount: import('vue').ComputedRef<number>;
|
|
8
|
-
increment: () => void;
|
|
9
|
-
}, "doubleCount">, Pick<{
|
|
10
|
-
count: import('vue').Ref<number, number>;
|
|
11
|
-
doubleCount: import('vue').ComputedRef<number>;
|
|
12
|
-
increment: () => void;
|
|
13
|
-
}, "increment">>;
|