@finema/core 3.16.0 → 3.16.2
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Table/Base.d.vue.ts +8 -2
- package/dist/runtime/components/Table/Base.vue +52 -16
- package/dist/runtime/components/Table/Base.vue.d.ts +8 -2
- package/dist/runtime/components/Table/index.d.vue.ts +2 -0
- package/dist/runtime/components/Table/index.vue +5 -1
- package/dist/runtime/components/Table/index.vue.d.ts +2 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,10 +4,16 @@ type __VLS_Props = {
|
|
|
4
4
|
options: ITableOptions<any> & ISimpleTableOptions<any>;
|
|
5
5
|
ui?: (typeof tableTheme)['slots'];
|
|
6
6
|
to?: string | ((row: any) => any);
|
|
7
|
+
target?: string | ((row: any) => string | undefined);
|
|
8
|
+
preserveQuery?: boolean;
|
|
7
9
|
};
|
|
8
|
-
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {},
|
|
10
|
+
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: {
|
|
11
|
+
row: any;
|
|
12
|
+
}, __VLS_57: any, __VLS_58: any;
|
|
9
13
|
type __VLS_Slots = {} & {
|
|
10
|
-
[K in NonNullable<typeof
|
|
14
|
+
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
|
+
} & {
|
|
16
|
+
[K in NonNullable<typeof __VLS_57>]?: (props: typeof __VLS_58) => any;
|
|
11
17
|
} & {
|
|
12
18
|
loading?: (props: typeof __VLS_25) => any;
|
|
13
19
|
} & {
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
<NuxtLink
|
|
62
62
|
v-if="to && column.accessorKey !== 'actions'"
|
|
63
63
|
:to="resolveTo(row.original)"
|
|
64
|
+
:target="resolveTarget(row.original)"
|
|
65
|
+
:rel="
|
|
66
|
+
resolveTarget(row.original) === '_blank' ? 'noopener noreferrer' : void 0
|
|
67
|
+
"
|
|
64
68
|
class="absolute inset-0"
|
|
65
69
|
tabindex="-1"
|
|
66
70
|
aria-hidden="true"
|
|
@@ -70,24 +74,29 @@
|
|
|
70
74
|
to && column.accessorKey !== 'actions' ? 'pointer-events-none relative z-10' : 'relative z-10'
|
|
71
75
|
"
|
|
72
76
|
>
|
|
73
|
-
<
|
|
74
|
-
:
|
|
77
|
+
<slot
|
|
78
|
+
:name="`${column.accessorKey}-cell`"
|
|
79
|
+
:row="row"
|
|
80
|
+
>
|
|
81
|
+
<component
|
|
82
|
+
:is="
|
|
75
83
|
column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]
|
|
76
84
|
"
|
|
77
|
-
|
|
85
|
+
v-if="
|
|
78
86
|
column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]
|
|
79
87
|
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
:value="transformValue(column, row)"
|
|
89
|
+
:column="column"
|
|
90
|
+
:row="row"
|
|
91
|
+
/>
|
|
92
|
+
<template v-else>
|
|
93
|
+
{{ transformValue(column, row) }}
|
|
94
|
+
</template>
|
|
95
|
+
</slot>
|
|
87
96
|
</div>
|
|
88
97
|
</template>
|
|
89
98
|
<template
|
|
90
|
-
v-for="
|
|
99
|
+
v-for="slotName in forwardedSlotNames"
|
|
91
100
|
:key="slotName"
|
|
92
101
|
#[slotName]="slotProps"
|
|
93
102
|
>
|
|
@@ -112,7 +121,7 @@
|
|
|
112
121
|
</template>
|
|
113
122
|
|
|
114
123
|
<script setup>
|
|
115
|
-
import { computed, ref } from "vue";
|
|
124
|
+
import { computed, ref, useSlots } from "vue";
|
|
116
125
|
import {
|
|
117
126
|
COLUMN_TYPES
|
|
118
127
|
} from "#core/components/Table/types";
|
|
@@ -120,6 +129,7 @@ import ColumnNumber from "#core/components/Table/ColumnNumber.vue";
|
|
|
120
129
|
import ColumnImage from "#core/components/Table/ColumnImage.vue";
|
|
121
130
|
import {
|
|
122
131
|
useAppConfig,
|
|
132
|
+
useRoute,
|
|
123
133
|
useUiConfig,
|
|
124
134
|
useWatchChange,
|
|
125
135
|
StringHelper
|
|
@@ -135,8 +145,15 @@ const emits = defineEmits(["pageChange", "search", "select"]);
|
|
|
135
145
|
const props = defineProps({
|
|
136
146
|
options: { type: Object, required: true },
|
|
137
147
|
ui: { type: null, required: false },
|
|
138
|
-
to: { type: [String, Function], required: false }
|
|
148
|
+
to: { type: [String, Function], required: false },
|
|
149
|
+
target: { type: [String, Function], required: false },
|
|
150
|
+
preserveQuery: { type: Boolean, required: false }
|
|
139
151
|
});
|
|
152
|
+
const route = useRoute();
|
|
153
|
+
const slots = useSlots();
|
|
154
|
+
const forwardedSlotNames = computed(
|
|
155
|
+
() => Object.keys(slots).filter((name) => !name.endsWith("-cell"))
|
|
156
|
+
);
|
|
140
157
|
const columnTypeComponents = {
|
|
141
158
|
[COLUMN_TYPES.NUMBER]: ColumnNumber,
|
|
142
159
|
[COLUMN_TYPES.IMAGE]: ColumnImage,
|
|
@@ -166,10 +183,29 @@ const transformValue = (column, row) => {
|
|
|
166
183
|
return row.getValue(column.accessorKey);
|
|
167
184
|
};
|
|
168
185
|
const resolveTo = (rowOriginal) => {
|
|
169
|
-
|
|
170
|
-
|
|
186
|
+
const resolved = typeof props.to === "function" ? props.to(rowOriginal) : props.to;
|
|
187
|
+
if (!props.preserveQuery || !resolved) {
|
|
188
|
+
return resolved;
|
|
189
|
+
}
|
|
190
|
+
if (typeof resolved === "string") {
|
|
191
|
+
return {
|
|
192
|
+
path: resolved,
|
|
193
|
+
query: route.query
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
...resolved,
|
|
198
|
+
query: {
|
|
199
|
+
...route.query,
|
|
200
|
+
...resolved.query || {}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const resolveTarget = (rowOriginal) => {
|
|
205
|
+
if (typeof props.target === "function") {
|
|
206
|
+
return props.target(rowOriginal);
|
|
171
207
|
}
|
|
172
|
-
return props.
|
|
208
|
+
return props.target;
|
|
173
209
|
};
|
|
174
210
|
useWatchChange(
|
|
175
211
|
() => props.options.pageOptions?.currentPage,
|
|
@@ -4,10 +4,16 @@ type __VLS_Props = {
|
|
|
4
4
|
options: ITableOptions<any> & ISimpleTableOptions<any>;
|
|
5
5
|
ui?: (typeof tableTheme)['slots'];
|
|
6
6
|
to?: string | ((row: any) => any);
|
|
7
|
+
target?: string | ((row: any) => string | undefined);
|
|
8
|
+
preserveQuery?: boolean;
|
|
7
9
|
};
|
|
8
|
-
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {},
|
|
10
|
+
declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: {
|
|
11
|
+
row: any;
|
|
12
|
+
}, __VLS_57: any, __VLS_58: any;
|
|
9
13
|
type __VLS_Slots = {} & {
|
|
10
|
-
[K in NonNullable<typeof
|
|
14
|
+
[K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
|
|
15
|
+
} & {
|
|
16
|
+
[K in NonNullable<typeof __VLS_57>]?: (props: typeof __VLS_58) => any;
|
|
11
17
|
} & {
|
|
12
18
|
loading?: (props: typeof __VLS_25) => any;
|
|
13
19
|
} & {
|
|
@@ -13,6 +13,8 @@ type __VLS_Props = {
|
|
|
13
13
|
right: string[];
|
|
14
14
|
};
|
|
15
15
|
to?: string | ((row: any) => any);
|
|
16
|
+
target?: string | ((row: any) => string | undefined);
|
|
17
|
+
preserveQuery?: boolean;
|
|
16
18
|
};
|
|
17
19
|
type __VLS_Slots = Slot;
|
|
18
20
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
:ui="computedUi"
|
|
21
21
|
:column-pinning="computedColumnPinning"
|
|
22
22
|
:to="to"
|
|
23
|
+
:target="target"
|
|
24
|
+
:preserve-query="preserveQuery"
|
|
23
25
|
@page-change="onPageChange"
|
|
24
26
|
@search="emits('search', q)"
|
|
25
27
|
@select="emits('select', $event)"
|
|
@@ -51,7 +53,9 @@ const props = defineProps({
|
|
|
51
53
|
left: [],
|
|
52
54
|
right: []
|
|
53
55
|
}) },
|
|
54
|
-
to: { type: [String, Function], required: false }
|
|
56
|
+
to: { type: [String, Function], required: false },
|
|
57
|
+
target: { type: [String, Function], required: false },
|
|
58
|
+
preserveQuery: { type: Boolean, required: false }
|
|
55
59
|
});
|
|
56
60
|
defineSlots();
|
|
57
61
|
const tableContainer = ref();
|
|
@@ -13,6 +13,8 @@ type __VLS_Props = {
|
|
|
13
13
|
right: string[];
|
|
14
14
|
};
|
|
15
15
|
to?: string | ((row: any) => any);
|
|
16
|
+
target?: string | ((row: any) => string | undefined);
|
|
17
|
+
preserveQuery?: boolean;
|
|
16
18
|
};
|
|
17
19
|
type __VLS_Slots = Slot;
|
|
18
20
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|