@finema/core 3.16.3 → 3.16.4

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.3",
3
+ "version": "3.16.4",
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.3";
7
+ const version = "3.16.4";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -1,15 +1,13 @@
1
1
  import { type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
2
2
  import { tableTheme } from '#core/theme/table';
3
3
  type __VLS_Props = {
4
- options: ITableOptions<any> & ISimpleTableOptions<any>;
4
+ options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
5
5
  ui?: (typeof tableTheme)['slots'];
6
6
  to?: string | ((row: any) => any);
7
7
  target?: string | ((row: any) => string | undefined);
8
8
  preserveQuery?: boolean;
9
9
  };
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
+ declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: any, __VLS_57: any, __VLS_58: any;
13
11
  type __VLS_Slots = {} & {
14
12
  [K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
15
13
  } & {
@@ -55,15 +55,15 @@
55
55
  </template>
56
56
  <template
57
57
  v-for="column in options.columns"
58
- #[`${column.accessorKey}-cell`]="{ row }"
58
+ #[`${column.accessorKey}-cell`]="slotProps"
59
59
  :key="column.accessorKey"
60
60
  >
61
61
  <NuxtLink
62
62
  v-if="to && column.accessorKey !== 'actions'"
63
- :to="resolveTo(row.original)"
64
- :target="resolveTarget(row.original)"
63
+ :to="resolveTo(slotProps.row.original)"
64
+ :target="resolveTarget(slotProps.row.original)"
65
65
  :rel="
66
- resolveTarget(row.original) === '_blank' ? 'noopener noreferrer' : void 0
66
+ resolveTarget(slotProps.row.original) === '_blank' ? 'noopener noreferrer' : void 0
67
67
  "
68
68
  class="absolute inset-0"
69
69
  tabindex="-1"
@@ -76,7 +76,7 @@
76
76
  >
77
77
  <slot
78
78
  :name="`${column.accessorKey}-cell`"
79
- :row="row"
79
+ v-bind="slotProps"
80
80
  >
81
81
  <component
82
82
  :is="
@@ -85,12 +85,12 @@
85
85
  v-if="
86
86
  column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]
87
87
  "
88
- :value="transformValue(column, row)"
88
+ :value="transformValue(column, slotProps.row)"
89
89
  :column="column"
90
- :row="row"
90
+ :row="slotProps.row"
91
91
  />
92
92
  <template v-else>
93
- {{ transformValue(column, row) }}
93
+ {{ transformValue(column, slotProps.row) }}
94
94
  </template>
95
95
  </slot>
96
96
  </div>
@@ -222,6 +222,9 @@ const onSelect = (rows) => {
222
222
  };
223
223
  const changePageLimit = (limit) => {
224
224
  pageLimit.value = limit;
225
+ if (!props.options.repo) {
226
+ return;
227
+ }
225
228
  props.options.repo.fetchPageChange(1, {
226
229
  params: {
227
230
  ...props.options.pageOptions?.request?.params,
@@ -1,15 +1,13 @@
1
1
  import { type ISimpleTableOptions, type ITableOptions } from '#core/components/Table/types';
2
2
  import { tableTheme } from '#core/theme/table';
3
3
  type __VLS_Props = {
4
- options: ITableOptions<any> & ISimpleTableOptions<any>;
4
+ options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
5
5
  ui?: (typeof tableTheme)['slots'];
6
6
  to?: string | ((row: any) => any);
7
7
  target?: string | ((row: any) => string | undefined);
8
8
  preserveQuery?: boolean;
9
9
  };
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
+ declare var __VLS_25: {}, __VLS_32: {}, __VLS_34: {}, __VLS_47: any, __VLS_48: any, __VLS_57: any, __VLS_58: any;
13
11
  type __VLS_Slots = {} & {
14
12
  [K in NonNullable<typeof __VLS_47>]?: (props: typeof __VLS_48) => any;
15
13
  } & {
@@ -3,7 +3,7 @@ import { tableTheme } from '../../theme/table.js';
3
3
  type __VLS_Props = {
4
4
  page: number;
5
5
  pageLimit: number;
6
- options: ITableOptions<any> & ISimpleTableOptions<any>;
6
+ options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
7
7
  ui?: (typeof tableTheme)['slots'];
8
8
  };
9
9
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -34,7 +34,8 @@
34
34
  })
35
35
  "
36
36
  >
37
- {{ modelValue }} {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}
37
+ {{ modelValue }}
38
+ {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}
38
39
  </p>
39
40
  </template>
40
41
  </USelect>
@@ -45,8 +46,12 @@
45
46
  })
46
47
  "
47
48
  >
48
- <span v-if="options.pageOptions">{{ pageBetween }} {{ appConfig.core?.locale === "th" ? "\u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "of total" }} {{ totalCountWithComma }}</span>
49
- <span v-else>{{ appConfig.core?.locale === "th" ? "\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "Total" }} {{ options.rawData.length }} {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}</span>
49
+ <span v-if="options.pageOptions">{{ pageBetween }}
50
+ {{ appConfig.core?.locale === "th" ? "\u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "of total" }}
51
+ {{ totalCountWithComma }}</span>
52
+ <span v-else>{{ appConfig.core?.locale === "th" ? "\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "Total" }}
53
+ {{ options.rawData.length }}
54
+ {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}</span>
50
55
  </p>
51
56
  </div>
52
57
  <UPagination
@@ -71,9 +76,11 @@
71
76
  :ui="{ label: themePagination.label }"
72
77
  square
73
78
  :to="to?.(item.value)"
74
- :class="theme.buttonPagination({
75
- class: [ui?.buttonPagination]
76
- })"
79
+ :class="
80
+ theme.buttonPagination({
81
+ class: [ui?.buttonPagination]
82
+ })
83
+ "
77
84
  />
78
85
  </template>
79
86
  </UPagination>
@@ -98,7 +105,9 @@ const props = defineProps({
98
105
  options: { type: Object, required: true },
99
106
  ui: { type: null, required: false }
100
107
  });
101
- const themePagination = computed(() => useUiConfig(paginationTheme, "pagination")());
108
+ const themePagination = computed(
109
+ () => useUiConfig(paginationTheme, "pagination")()
110
+ );
102
111
  const appConfig = useAppConfig();
103
112
  const pageLimitItems = [
104
113
  {
@@ -3,7 +3,7 @@ import { tableTheme } from '../../theme/table.js';
3
3
  type __VLS_Props = {
4
4
  page: number;
5
5
  pageLimit: number;
6
- options: ITableOptions<any> & ISimpleTableOptions<any>;
6
+ options: ISimpleTableOptions<any> & Partial<ITableOptions<any>>;
7
7
  ui?: (typeof tableTheme)['slots'];
8
8
  };
9
9
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -7,6 +7,9 @@ type Slot = TableSlots<any> & {
7
7
  type __VLS_Props = {
8
8
  options: ISimpleTableOptions<any>;
9
9
  ui?: (typeof tableTheme)['slots'];
10
+ to?: string | ((row: any) => any);
11
+ target?: string | ((row: any) => string | undefined);
12
+ preserveQuery?: boolean;
10
13
  };
11
14
  type __VLS_Slots = Slot;
12
15
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -7,7 +7,10 @@
7
7
  isHideLimitSelect: true,
8
8
  rawData: itemsByPage
9
9
  }"
10
- :ui="ui"
10
+ :ui="computedUi"
11
+ :to="to"
12
+ :target="target"
13
+ :preserve-query="preserveQuery"
11
14
  @page-change="onPageChange"
12
15
  >
13
16
  <template
@@ -29,9 +32,21 @@ import { initPageOptions } from "#core/composables/loaderPage";
29
32
  import { useCoreConfig } from "#core/composables/useConfig";
30
33
  const props = defineProps({
31
34
  options: { type: Object, required: true },
32
- ui: { type: null, required: false }
35
+ ui: { type: null, required: false },
36
+ to: { type: [String, Function], required: false },
37
+ target: { type: [String, Function], required: false },
38
+ preserveQuery: { type: Boolean, required: false }
33
39
  });
34
40
  defineSlots();
41
+ const computedUi = computed(() => {
42
+ if (!props.to) {
43
+ return props.ui;
44
+ }
45
+ return {
46
+ ...props.ui,
47
+ td: [props.ui?.td, "cursor-pointer", "relative"].filter(Boolean).join(" ")
48
+ };
49
+ });
35
50
  const currentPage = ref(1);
36
51
  const coreConfig = useCoreConfig();
37
52
  const pageOptions = computed(() => {
@@ -7,6 +7,9 @@ type Slot = TableSlots<any> & {
7
7
  type __VLS_Props = {
8
8
  options: ISimpleTableOptions<any>;
9
9
  ui?: (typeof tableTheme)['slots'];
10
+ to?: string | ((row: any) => any);
11
+ target?: string | ((row: any) => string | undefined);
12
+ preserveQuery?: boolean;
10
13
  };
11
14
  type __VLS_Slots = Slot;
12
15
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.16.3",
3
+ "version": "3.16.4",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",