@finema/core 1.4.53 → 1.4.55
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 +63 -63
- package/dist/module.d.mts +4 -4
- package/dist/module.d.ts +4 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Alert.vue +49 -49
- package/dist/runtime/components/Avatar.vue +27 -27
- package/dist/runtime/components/Badge.vue +54 -54
- package/dist/runtime/components/Breadcrumb.vue +45 -45
- package/dist/runtime/components/Button/Group.vue +37 -37
- package/dist/runtime/components/Button/index.vue +77 -77
- package/dist/runtime/components/Card.vue +38 -38
- package/dist/runtime/components/Core.vue +13 -13
- package/dist/runtime/components/Dialog/index.vue +108 -108
- package/dist/runtime/components/Dropdown/index.vue +71 -71
- package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
- package/dist/runtime/components/Form/Fields.vue +153 -153
- package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
- package/dist/runtime/components/Form/InputDateTime/index.vue +52 -51
- package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
- package/dist/runtime/components/Form/InputSelect/index.vue +36 -36
- package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
- package/dist/runtime/components/Form/InputText/index.vue +54 -54
- package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
- package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
- package/dist/runtime/components/Form/InputUploadDropzone/index.vue +157 -157
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +241 -241
- package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +101 -36
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +165 -165
- package/dist/runtime/components/Form/index.vue +6 -6
- package/dist/runtime/components/Icon.vue +23 -23
- package/dist/runtime/components/Image.vue +36 -36
- package/dist/runtime/components/Loader.vue +14 -14
- package/dist/runtime/components/Modal/index.vue +146 -146
- package/dist/runtime/components/SimplePagination.vue +96 -96
- package/dist/runtime/components/Slideover/index.vue +110 -110
- package/dist/runtime/components/Table/Base.vue +139 -133
- package/dist/runtime/components/Table/ColumnDate.vue +16 -16
- package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
- package/dist/runtime/components/Table/ColumnImage.vue +15 -13
- package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
- package/dist/runtime/components/Table/ColumnText.vue +25 -0
- package/dist/runtime/components/Table/Simple.vue +64 -57
- package/dist/runtime/components/Table/index.vue +60 -59
- package/dist/runtime/components/Table/types.d.ts +8 -22
- package/dist/runtime/components/Table/types.mjs +0 -1
- package/dist/runtime/components/Tabs/index.vue +65 -65
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useTable.d.ts +2 -2
- package/dist/runtime/composables/useTable.mjs +2 -4
- package/dist/runtime/types/utils.d.ts +29 -29
- package/dist/runtime/ui.css +32 -32
- package/package.json +89 -83
|
@@ -1,57 +1,64 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Base
|
|
3
|
-
v-bind="$attrs"
|
|
4
|
-
:columns="options.columns"
|
|
5
|
-
:raw-data="itemsByPage"
|
|
6
|
-
:status="options.status"
|
|
7
|
-
:page-options="pageOptions"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<Base
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
:columns="options.columns"
|
|
5
|
+
:raw-data="itemsByPage"
|
|
6
|
+
:status="options.status"
|
|
7
|
+
:page-options="pageOptions"
|
|
8
|
+
:is-simple-pagination="isShowSimplePagination"
|
|
9
|
+
:is-hide-bottom-pagination="options.isHideBottomPagination"
|
|
10
|
+
@page-change="onPageChange"
|
|
11
|
+
>
|
|
12
|
+
<template v-for="(_, slot) of $slots" #[slot]="slotProps">
|
|
13
|
+
<slot :name="slot" v-bind="slotProps || {}" />
|
|
14
|
+
</template>
|
|
15
|
+
</Base>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { computed, type PropType, ref } from 'vue'
|
|
19
|
+
import { type ISimpleTableOptions } from '#core/components/Table/types'
|
|
20
|
+
import Base from '#core/components/Table/Base.vue'
|
|
21
|
+
import { initPageOptions } from '#core/composables/loaderPage'
|
|
22
|
+
import { useCoreConfig } from '#core/composables/useConfig'
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
options: { type: Object as PropType<ISimpleTableOptions>, required: true },
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const currentPage = ref(1)
|
|
29
|
+
const coreConfig = useCoreConfig()
|
|
30
|
+
const isShowSimplePagination = computed(
|
|
31
|
+
(): boolean => props.options.isSimplePagination ?? coreConfig.is_simple_pagination
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const pageOptions = computed(() => {
|
|
35
|
+
if (!props.options?.limit) {
|
|
36
|
+
return undefined
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...initPageOptions({
|
|
41
|
+
limit: props.options.limit,
|
|
42
|
+
primary: props.options.primary,
|
|
43
|
+
}),
|
|
44
|
+
totalCount: props.options.rawData.length,
|
|
45
|
+
totalPage: Math.ceil(props.options.rawData.length / props.options.limit),
|
|
46
|
+
currentPage: currentPage.value,
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const onPageChange = (page: number) => {
|
|
51
|
+
currentPage.value = page
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const itemsByPage = computed(() => {
|
|
55
|
+
if (!pageOptions.value) {
|
|
56
|
+
return props.options?.rawData
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const start = (pageOptions.value.currentPage - 1) * pageOptions.value.limit
|
|
60
|
+
const end = start + pageOptions.value.limit
|
|
61
|
+
|
|
62
|
+
return props.options?.rawData.slice(start, end)
|
|
63
|
+
})
|
|
64
|
+
</script>
|
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div v-if="options.isEnabledSearch" class="mb-4 flex justify-end">
|
|
4
|
-
<UInput
|
|
5
|
-
v-model="q"
|
|
6
|
-
icon="i-heroicons-magnifying-glass"
|
|
7
|
-
:placeholder="options.searchPlaceholder || 'ค้นหา...'"
|
|
8
|
-
/>
|
|
9
|
-
</div>
|
|
10
|
-
<Base
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
:columns="options.columns"
|
|
13
|
-
:raw-data="options.rawData"
|
|
14
|
-
:status="options.status"
|
|
15
|
-
:page-options="options.pageOptions"
|
|
16
|
-
:is-simple-pagination="isShowSimplePagination"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import { type
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
(event: '
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div v-if="options.isEnabledSearch" class="mb-4 flex justify-end">
|
|
4
|
+
<UInput
|
|
5
|
+
v-model="q"
|
|
6
|
+
icon="i-heroicons-magnifying-glass"
|
|
7
|
+
:placeholder="options.searchPlaceholder || 'ค้นหา...'"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
<Base
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
:columns="options.columns"
|
|
13
|
+
:raw-data="options.rawData"
|
|
14
|
+
:status="options.status"
|
|
15
|
+
:page-options="options.pageOptions"
|
|
16
|
+
:is-simple-pagination="isShowSimplePagination"
|
|
17
|
+
:is-hide-bottom-pagination="options.isHideBottomPagination"
|
|
18
|
+
@page-change="onPageChange"
|
|
19
|
+
>
|
|
20
|
+
<template v-for="(_, slot) of $slots" #[slot]="slotProps">
|
|
21
|
+
<slot :name="slot" v-bind="slotProps || {}" />
|
|
22
|
+
</template>
|
|
23
|
+
</Base>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { type PropType } from 'vue'
|
|
28
|
+
import { type ITableOptions } from '#core/components/Table/types'
|
|
29
|
+
import { _debounce, computed, ref, watch } from '#imports'
|
|
30
|
+
import { useCoreConfig } from '#core/composables/useConfig'
|
|
31
|
+
import Base from '#core/components/Table/Base.vue'
|
|
32
|
+
|
|
33
|
+
const emits = defineEmits<{
|
|
34
|
+
(event: 'pageChange', page: number): void
|
|
35
|
+
(event: 'search', q: string): void
|
|
36
|
+
}>()
|
|
37
|
+
|
|
38
|
+
const props = defineProps({
|
|
39
|
+
options: { type: Object as PropType<ITableOptions>, required: true },
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const coreConfig = useCoreConfig()
|
|
43
|
+
|
|
44
|
+
const q = ref(props.options?.pageOptions.search ?? '')
|
|
45
|
+
|
|
46
|
+
const isShowSimplePagination = computed(
|
|
47
|
+
(): boolean => props.options.isSimplePagination ?? coreConfig.is_simple_pagination
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
q,
|
|
52
|
+
_debounce((value) => {
|
|
53
|
+
emits('search', value)
|
|
54
|
+
}, 500)
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const onPageChange = (page: number) => {
|
|
58
|
+
emits('pageChange', page)
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
@@ -4,10 +4,9 @@ export declare const enum COLUMN_TYPES {
|
|
|
4
4
|
DATE = "DATE",
|
|
5
5
|
DATE_TIME = "DATE_TIME",
|
|
6
6
|
NUMBER = "NUMBER",
|
|
7
|
-
IMAGE = "IMAGE"
|
|
8
|
-
ACTION = "ACTION"
|
|
7
|
+
IMAGE = "IMAGE"
|
|
9
8
|
}
|
|
10
|
-
export interface IColumn {
|
|
9
|
+
export interface IColumn<P extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Record<string, any>> {
|
|
11
10
|
[key: string]: any;
|
|
12
11
|
key: string;
|
|
13
12
|
sortable?: boolean;
|
|
@@ -15,37 +14,24 @@ export interface IColumn {
|
|
|
15
14
|
class?: string;
|
|
16
15
|
component?: any;
|
|
17
16
|
type?: COLUMN_TYPES;
|
|
17
|
+
transform?: (value: any, row: any, column: IColumn) => any;
|
|
18
|
+
props?: P;
|
|
19
|
+
on?: O;
|
|
18
20
|
}
|
|
19
|
-
export interface IRowItem {
|
|
20
|
-
value: string | any;
|
|
21
|
-
type?: COLUMN_TYPES;
|
|
22
|
-
title?: string;
|
|
23
|
-
className?: string;
|
|
24
|
-
isSelect?: boolean;
|
|
25
|
-
props?: Record<string, any>;
|
|
26
|
-
on?: Record<string, any>;
|
|
27
|
-
}
|
|
28
|
-
export type IRow = Record<number, IRowItem>;
|
|
29
21
|
export interface IBaseTableOptions<T = object> {
|
|
30
22
|
rawData: T[];
|
|
31
23
|
primary: string;
|
|
32
24
|
status: IStatus;
|
|
33
25
|
columns: IColumn[];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onCheckBoxClick?: (index: number[]) => void;
|
|
38
|
-
disabledCheckIndexes?: number[];
|
|
26
|
+
isHideBottomPagination?: boolean;
|
|
27
|
+
isHideTopPagination?: boolean;
|
|
28
|
+
isSimplePagination?: boolean;
|
|
39
29
|
}
|
|
40
30
|
export interface ITableOptions<T = object> extends IBaseTableOptions<T> {
|
|
41
31
|
pageOptions: IPageOptions;
|
|
42
32
|
isHideToolbar?: boolean;
|
|
43
33
|
isEnabledSearch?: boolean;
|
|
44
34
|
searchPlaceholder?: string;
|
|
45
|
-
deleteStatus?: IStatus;
|
|
46
|
-
isHideBottomPagination?: boolean;
|
|
47
|
-
isHideTopPagination?: boolean;
|
|
48
|
-
isSimplePagination?: boolean;
|
|
49
35
|
isPreventRouteChange: boolean;
|
|
50
36
|
}
|
|
51
37
|
export interface ISimpleTableOptions<T = object> extends IBaseTableOptions<T> {
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<UTabs
|
|
3
|
-
v-bind="attrs"
|
|
4
|
-
:model-value="modelValue"
|
|
5
|
-
:class="$props.class"
|
|
6
|
-
:items="items"
|
|
7
|
-
:orientation="orientation"
|
|
8
|
-
:default-index="defaultIndex"
|
|
9
|
-
:ui="ui"
|
|
10
|
-
@change="change"
|
|
11
|
-
>
|
|
12
|
-
<template #default="{ item, index, selected }">
|
|
13
|
-
<slot name="default" :item="item" :index="index" :selected="selected" />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<template #item="{ item, index, selected }">
|
|
17
|
-
<slot name="item" :item="item" :index="index" :selected="selected" />
|
|
18
|
-
</template>
|
|
19
|
-
</UTabs>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import { useUiConfig, type PropType, useUI, toRef } from '#imports'
|
|
24
|
-
import { type TabItem } from '#ui/types'
|
|
25
|
-
import type { Strategy } from '#core/types/utils'
|
|
26
|
-
import { tabs } from '#core/ui.config'
|
|
27
|
-
|
|
28
|
-
const config = useUiConfig<typeof tabs>(tabs, 'tabs')
|
|
29
|
-
|
|
30
|
-
const props = defineProps({
|
|
31
|
-
modelValue: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: undefined,
|
|
34
|
-
},
|
|
35
|
-
items: {
|
|
36
|
-
type: Array as PropType<TabItem[]>,
|
|
37
|
-
default: () => [],
|
|
38
|
-
},
|
|
39
|
-
orientation: {
|
|
40
|
-
type: String as PropType<'horizontal' | 'vertical'>,
|
|
41
|
-
default: 'horizontal',
|
|
42
|
-
validator: (value: string) => ['horizontal', 'vertical'].includes(value),
|
|
43
|
-
},
|
|
44
|
-
defaultIndex: {
|
|
45
|
-
type: Number,
|
|
46
|
-
default: 0,
|
|
47
|
-
},
|
|
48
|
-
class: {
|
|
49
|
-
type: [String, Object, Array] as PropType<any>,
|
|
50
|
-
default: () => '',
|
|
51
|
-
},
|
|
52
|
-
ui: {
|
|
53
|
-
type: Object as PropType<Partial<typeof config> & { strategy?: Strategy }>,
|
|
54
|
-
default: () => ({}),
|
|
55
|
-
},
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const emits = defineEmits(['update:modelValue', 'change'])
|
|
59
|
-
|
|
60
|
-
const change = (index: number) => {
|
|
61
|
-
emits('change', index)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const { ui, attrs } = useUI('tabs', toRef(props, 'ui'), config, toRef(props, 'class'))
|
|
65
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<UTabs
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
:model-value="modelValue"
|
|
5
|
+
:class="$props.class"
|
|
6
|
+
:items="items"
|
|
7
|
+
:orientation="orientation"
|
|
8
|
+
:default-index="defaultIndex"
|
|
9
|
+
:ui="ui"
|
|
10
|
+
@change="change"
|
|
11
|
+
>
|
|
12
|
+
<template #default="{ item, index, selected }">
|
|
13
|
+
<slot name="default" :item="item" :index="index" :selected="selected" />
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<template #item="{ item, index, selected }">
|
|
17
|
+
<slot name="item" :item="item" :index="index" :selected="selected" />
|
|
18
|
+
</template>
|
|
19
|
+
</UTabs>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { useUiConfig, type PropType, useUI, toRef } from '#imports'
|
|
24
|
+
import { type TabItem } from '#ui/types'
|
|
25
|
+
import type { Strategy } from '#core/types/utils'
|
|
26
|
+
import { tabs } from '#core/ui.config'
|
|
27
|
+
|
|
28
|
+
const config = useUiConfig<typeof tabs>(tabs, 'tabs')
|
|
29
|
+
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: undefined,
|
|
34
|
+
},
|
|
35
|
+
items: {
|
|
36
|
+
type: Array as PropType<TabItem[]>,
|
|
37
|
+
default: () => [],
|
|
38
|
+
},
|
|
39
|
+
orientation: {
|
|
40
|
+
type: String as PropType<'horizontal' | 'vertical'>,
|
|
41
|
+
default: 'horizontal',
|
|
42
|
+
validator: (value: string) => ['horizontal', 'vertical'].includes(value),
|
|
43
|
+
},
|
|
44
|
+
defaultIndex: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 0,
|
|
47
|
+
},
|
|
48
|
+
class: {
|
|
49
|
+
type: [String, Object, Array] as PropType<any>,
|
|
50
|
+
default: () => '',
|
|
51
|
+
},
|
|
52
|
+
ui: {
|
|
53
|
+
type: Object as PropType<Partial<typeof config> & { strategy?: Strategy }>,
|
|
54
|
+
default: () => ({}),
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
|
59
|
+
|
|
60
|
+
const change = (index: number) => {
|
|
61
|
+
emits('change', index)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const { ui, attrs } = useUI('tabs', toRef(props, 'ui'), config, toRef(props, 'class'))
|
|
65
|
+
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
2
|
import { type FieldContext, type FieldOptions } from 'vee-validate';
|
|
3
|
-
import { type IFieldProps
|
|
3
|
+
import { type IFieldProps } from '../components/Form/types';
|
|
4
4
|
interface IFieldContext<TValue> extends FieldContext<TValue> {
|
|
5
5
|
wrapperProps: ComputedRef<IFieldProps>;
|
|
6
6
|
}
|
|
7
7
|
export declare const useFieldHOC: <TValue = unknown>(newFormProps: IFieldProps, opts?: Partial<FieldOptions<TValue>> | undefined) => IFieldContext<TValue>;
|
|
8
|
-
export declare const createFormFields: (fields: () =>
|
|
8
|
+
export declare const createFormFields: <T extends unknown>(fields: () => T[]) => ComputedRef<T[]>;
|
|
9
9
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
2
|
import { type Store } from 'pinia';
|
|
3
3
|
import { type IStatus } from '#imports';
|
|
4
|
-
import { type IColumn, type
|
|
4
|
+
import { type IColumn, type ISimpleTableOptions, type ITableOptions } from '../components/Table/types';
|
|
5
5
|
import { type IUsePageLoader } from '../helpers/apiPageHelper';
|
|
6
6
|
export interface IUseTable<T = object> {
|
|
7
7
|
repo: IUsePageLoader<T> | Store<any, any>;
|
|
@@ -16,4 +16,4 @@ export interface IUseTableSimple<T = object> {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const useTable: <T = object>(options: IUseTable<T>) => ComputedRef<ITableOptions<T>>;
|
|
18
18
|
export declare const useTableSimple: <T = object>(options: IUseTableSimple<T>) => ComputedRef<ISimpleTableOptions<T>>;
|
|
19
|
-
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[],
|
|
19
|
+
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], options: Partial<ITableOptions<T>>) => ITableOptions<T>;
|
|
@@ -5,7 +5,6 @@ export const useTable = (options) => computed(() => {
|
|
|
5
5
|
return createTableOptions(
|
|
6
6
|
options.repo,
|
|
7
7
|
options.columns(),
|
|
8
|
-
get(options.repo.fetchItems),
|
|
9
8
|
typeof options.options === "function" ? options.options() : options.options ?? {}
|
|
10
9
|
);
|
|
11
10
|
});
|
|
@@ -20,16 +19,15 @@ export const useTableSimple = (options) => computed(() => {
|
|
|
20
19
|
...typeof options.options === "function" ? options.options() : options.options ?? {}
|
|
21
20
|
};
|
|
22
21
|
});
|
|
23
|
-
export const createTableOptions = (repo, columns,
|
|
22
|
+
export const createTableOptions = (repo, columns, options) => {
|
|
24
23
|
const config = useCoreConfig();
|
|
25
24
|
return {
|
|
26
25
|
rawData: get(repo.fetchItems),
|
|
27
26
|
pageOptions: get(repo.fetchOptions),
|
|
28
27
|
columns,
|
|
29
28
|
status: get(repo.fetchStatus),
|
|
30
|
-
deleteStatus: get(repo.deleteStatus),
|
|
31
29
|
primary: get(repo.fetchOptions).primary ?? config.default_primary_key,
|
|
32
|
-
|
|
30
|
+
isPreventRouteChange: false,
|
|
33
31
|
...options
|
|
34
32
|
};
|
|
35
33
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export type Strategy = 'merge' | 'override'
|
|
2
|
-
|
|
3
|
-
export type NestedKeyOf<ObjectType extends object> = {
|
|
4
|
-
[Key in keyof ObjectType]: ObjectType[Key] extends object ? NestedKeyOf<ObjectType[Key]> : Key
|
|
5
|
-
}[keyof ObjectType]
|
|
6
|
-
|
|
7
|
-
export type DeepPartial<T> = Partial<{
|
|
8
|
-
[P in keyof T]: DeepPartial<T[P]> | Record<string, string>
|
|
9
|
-
}>
|
|
10
|
-
|
|
11
|
-
type DeepKey<T, Keys extends string[]> = Keys extends [infer First, ...infer Rest]
|
|
12
|
-
? First extends keyof T
|
|
13
|
-
? Rest extends string[]
|
|
14
|
-
? DeepKey<T[First], Rest>
|
|
15
|
-
: never
|
|
16
|
-
: never
|
|
17
|
-
: T
|
|
18
|
-
|
|
19
|
-
export type ExtractDeepKey<T, Path extends string[]> = DeepKey<T, Path> extends infer Result
|
|
20
|
-
? Result extends Record<string, any>
|
|
21
|
-
? keyof Result
|
|
22
|
-
: never
|
|
23
|
-
: never
|
|
24
|
-
|
|
25
|
-
export type ExtractDeepObject<T, Path extends string[]> = DeepKey<T, Path> extends infer Result
|
|
26
|
-
? Result extends Record<string, any>
|
|
27
|
-
? Result
|
|
28
|
-
: never
|
|
29
|
-
: never
|
|
1
|
+
export type Strategy = 'merge' | 'override'
|
|
2
|
+
|
|
3
|
+
export type NestedKeyOf<ObjectType extends object> = {
|
|
4
|
+
[Key in keyof ObjectType]: ObjectType[Key] extends object ? NestedKeyOf<ObjectType[Key]> : Key
|
|
5
|
+
}[keyof ObjectType]
|
|
6
|
+
|
|
7
|
+
export type DeepPartial<T> = Partial<{
|
|
8
|
+
[P in keyof T]: DeepPartial<T[P]> | Record<string, string>
|
|
9
|
+
}>
|
|
10
|
+
|
|
11
|
+
type DeepKey<T, Keys extends string[]> = Keys extends [infer First, ...infer Rest]
|
|
12
|
+
? First extends keyof T
|
|
13
|
+
? Rest extends string[]
|
|
14
|
+
? DeepKey<T[First], Rest>
|
|
15
|
+
: never
|
|
16
|
+
: never
|
|
17
|
+
: T
|
|
18
|
+
|
|
19
|
+
export type ExtractDeepKey<T, Path extends string[]> = DeepKey<T, Path> extends infer Result
|
|
20
|
+
? Result extends Record<string, any>
|
|
21
|
+
? keyof Result
|
|
22
|
+
: never
|
|
23
|
+
: never
|
|
24
|
+
|
|
25
|
+
export type ExtractDeepObject<T, Path extends string[]> = DeepKey<T, Path> extends infer Result
|
|
26
|
+
? Result extends Record<string, any>
|
|
27
|
+
? Result
|
|
28
|
+
: never
|
|
29
|
+
: never
|
package/dist/runtime/ui.css
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--dp-font-family: inherit !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.dp__theme_light {
|
|
6
|
-
--dp-primary-color: rgb(var(--color-primary-DEFAULT)) !important;
|
|
7
|
-
--dp-primary-disabled-color: rgb(var(--color-primary-200)) !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
::-webkit-scrollbar {
|
|
11
|
-
-webkit-appearance: none;
|
|
12
|
-
width: 10px;
|
|
13
|
-
height: 10px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
::-webkit-scrollbar-thumb {
|
|
17
|
-
border-radius: 4px;
|
|
18
|
-
background-color: rgb(0 0 0 / 30%);
|
|
19
|
-
box-shadow: 0 0 1px rgb(255 255 255 / 50%);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
html,
|
|
24
|
-
body,
|
|
25
|
-
#__nuxt,
|
|
26
|
-
#__layout,
|
|
27
|
-
.root-container {
|
|
28
|
-
height: 100%;
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
}
|
|
32
|
-
|
|
1
|
+
:root {
|
|
2
|
+
--dp-font-family: inherit !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dp__theme_light {
|
|
6
|
+
--dp-primary-color: rgb(var(--color-primary-DEFAULT)) !important;
|
|
7
|
+
--dp-primary-disabled-color: rgb(var(--color-primary-200)) !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
::-webkit-scrollbar {
|
|
11
|
+
-webkit-appearance: none;
|
|
12
|
+
width: 10px;
|
|
13
|
+
height: 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
::-webkit-scrollbar-thumb {
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
background-color: rgb(0 0 0 / 30%);
|
|
19
|
+
box-shadow: 0 0 1px rgb(255 255 255 / 50%);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
html,
|
|
24
|
+
body,
|
|
25
|
+
#__nuxt,
|
|
26
|
+
#__layout,
|
|
27
|
+
.root-container {
|
|
28
|
+
height: 100%;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
}
|
|
32
|
+
|