@finema/core 3.16.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.16.1",
3
+ "version": "3.16.2",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import * as lodash from 'lodash-es';
4
4
  import * as theme from '../dist/runtime/theme/index.js';
5
5
 
6
6
  const name = "@finema/core";
7
- const version = "3.16.1";
7
+ const version = "3.16.2";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -5,10 +5,15 @@ type __VLS_Props = {
5
5
  ui?: (typeof tableTheme)['slots'];
6
6
  to?: string | ((row: any) => any);
7
7
  target?: string | ((row: any) => string | undefined);
8
+ preserveQuery?: boolean;
8
9
  };
9
- declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_53: any, __VLS_54: any;
10
+ declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: {
11
+ row: any;
12
+ }, __VLS_57: any, __VLS_58: any;
10
13
  type __VLS_Slots = {} & {
11
- [K in NonNullable<typeof __VLS_53>]?: (props: typeof __VLS_54) => any;
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;
12
17
  } & {
13
18
  loading?: (props: typeof __VLS_25) => any;
14
19
  } & {
@@ -74,24 +74,29 @@
74
74
  to && column.accessorKey !== 'actions' ? 'pointer-events-none relative z-10' : 'relative z-10'
75
75
  "
76
76
  >
77
- <component
78
- :is="
77
+ <slot
78
+ :name="`${column.accessorKey}-cell`"
79
+ :row="row"
80
+ >
81
+ <component
82
+ :is="
79
83
  column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]
80
84
  "
81
- v-if="
85
+ v-if="
82
86
  column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]
83
87
  "
84
- :value="transformValue(column, row)"
85
- :column="column"
86
- :row="row"
87
- />
88
- <template v-else>
89
- {{ transformValue(column, row) }}
90
- </template>
88
+ :value="transformValue(column, row)"
89
+ :column="column"
90
+ :row="row"
91
+ />
92
+ <template v-else>
93
+ {{ transformValue(column, row) }}
94
+ </template>
95
+ </slot>
91
96
  </div>
92
97
  </template>
93
98
  <template
94
- v-for="(_, slotName) of $slots"
99
+ v-for="slotName in forwardedSlotNames"
95
100
  :key="slotName"
96
101
  #[slotName]="slotProps"
97
102
  >
@@ -116,7 +121,7 @@
116
121
  </template>
117
122
 
118
123
  <script setup>
119
- import { computed, ref } from "vue";
124
+ import { computed, ref, useSlots } from "vue";
120
125
  import {
121
126
  COLUMN_TYPES
122
127
  } from "#core/components/Table/types";
@@ -124,6 +129,7 @@ import ColumnNumber from "#core/components/Table/ColumnNumber.vue";
124
129
  import ColumnImage from "#core/components/Table/ColumnImage.vue";
125
130
  import {
126
131
  useAppConfig,
132
+ useRoute,
127
133
  useUiConfig,
128
134
  useWatchChange,
129
135
  StringHelper
@@ -140,8 +146,14 @@ const props = defineProps({
140
146
  options: { type: Object, required: true },
141
147
  ui: { type: null, required: false },
142
148
  to: { type: [String, Function], required: false },
143
- target: { type: [String, Function], required: false }
149
+ target: { type: [String, Function], required: false },
150
+ preserveQuery: { type: Boolean, required: false }
144
151
  });
152
+ const route = useRoute();
153
+ const slots = useSlots();
154
+ const forwardedSlotNames = computed(
155
+ () => Object.keys(slots).filter((name) => !name.endsWith("-cell"))
156
+ );
145
157
  const columnTypeComponents = {
146
158
  [COLUMN_TYPES.NUMBER]: ColumnNumber,
147
159
  [COLUMN_TYPES.IMAGE]: ColumnImage,
@@ -171,10 +183,23 @@ const transformValue = (column, row) => {
171
183
  return row.getValue(column.accessorKey);
172
184
  };
173
185
  const resolveTo = (rowOriginal) => {
174
- if (typeof props.to === "function") {
175
- return props.to(rowOriginal);
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
+ };
176
195
  }
177
- return props.to;
196
+ return {
197
+ ...resolved,
198
+ query: {
199
+ ...route.query,
200
+ ...resolved.query || {}
201
+ }
202
+ };
178
203
  };
179
204
  const resolveTarget = (rowOriginal) => {
180
205
  if (typeof props.target === "function") {
@@ -5,10 +5,15 @@ type __VLS_Props = {
5
5
  ui?: (typeof tableTheme)['slots'];
6
6
  to?: string | ((row: any) => any);
7
7
  target?: string | ((row: any) => string | undefined);
8
+ preserveQuery?: boolean;
8
9
  };
9
- declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_53: any, __VLS_54: any;
10
+ declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: {
11
+ row: any;
12
+ }, __VLS_57: any, __VLS_58: any;
10
13
  type __VLS_Slots = {} & {
11
- [K in NonNullable<typeof __VLS_53>]?: (props: typeof __VLS_54) => any;
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;
12
17
  } & {
13
18
  loading?: (props: typeof __VLS_25) => any;
14
19
  } & {
@@ -14,6 +14,7 @@ type __VLS_Props = {
14
14
  };
15
15
  to?: string | ((row: any) => any);
16
16
  target?: string | ((row: any) => string | undefined);
17
+ preserveQuery?: boolean;
17
18
  };
18
19
  type __VLS_Slots = Slot;
19
20
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -21,6 +21,7 @@
21
21
  :column-pinning="computedColumnPinning"
22
22
  :to="to"
23
23
  :target="target"
24
+ :preserve-query="preserveQuery"
24
25
  @page-change="onPageChange"
25
26
  @search="emits('search', q)"
26
27
  @select="emits('select', $event)"
@@ -53,7 +54,8 @@ const props = defineProps({
53
54
  right: []
54
55
  }) },
55
56
  to: { type: [String, Function], required: false },
56
- target: { type: [String, Function], required: false }
57
+ target: { type: [String, Function], required: false },
58
+ preserveQuery: { type: Boolean, required: false }
57
59
  });
58
60
  defineSlots();
59
61
  const tableContainer = ref();
@@ -14,6 +14,7 @@ type __VLS_Props = {
14
14
  };
15
15
  to?: string | ((row: any) => any);
16
16
  target?: string | ((row: any) => string | undefined);
17
+ preserveQuery?: boolean;
17
18
  };
18
19
  type __VLS_Slots = Slot;
19
20
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.16.1",
3
+ "version": "3.16.2",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",