@finema/core 2.15.2 → 2.16.0

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.
@@ -1,97 +1,97 @@
1
1
  <template>
2
- <div ref="tableContainer">
3
- <div
4
- v-if="options.isEnabledSearch"
2
+ <div ref="tableContainer">
3
+ <div
4
+ v-if="options.isEnabledSearch"
5
5
  :class="theme.searchContainer({
6
6
  class: [ui?.searchContainer]
7
- })"
8
- >
9
- <Input
10
- v-model="q"
11
- icon="i-heroicons-magnifying-glass"
12
- :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32....'"
13
- />
14
- </div>
15
- <UTable
16
- v-bind="$attrs"
17
- :loading="options.status.isLoading"
18
- :data="options.rawData"
19
- :columns="options.columns"
20
- >
21
- <template #empty>
22
- <slot
23
- v-if="options.status.isLoading"
24
- name="loading"
25
- >
26
- <Loader
27
- :loading="true"
28
- />
29
- </slot>
30
- <slot
31
- v-else-if="options.status.isError"
32
- name="error"
33
- >
34
- <div
35
- class="flex h-[200px] items-center justify-center text-2xl text-error-400"
36
- >
37
- {{ StringHelper.getError(options.status.errorData) }}
38
- </div>
39
- </slot>
40
-
41
- <slot
42
- v-else
43
- name="error"
44
- >
45
- <Empty />
46
- </slot>
47
- </template>
48
- <template
49
- v-for="column in options.columns.filter((item) => !!item.type)"
50
- #[`${column.accessorKey}-cell`]="{ row }"
51
- :key="column.accessorKey"
52
- >
53
- <component
54
- :is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
55
- v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
56
- :value="transformValue(column, row)"
57
- :column="column"
58
- :row="row"
59
- />
60
- </template>
61
- <template
62
- v-for="(_, slotName) of $slots"
63
- #[slotName]="slotProps"
64
- >
65
- <slot
66
- :name="slotName"
67
- v-bind="slotProps || {}"
68
- />
69
- </template>
70
- </UTable>
71
-
72
- <div
73
- v-if="!options.isHidePagination"
7
+ })"
8
+ >
9
+ <Input
10
+ v-model="q"
11
+ icon="i-heroicons-magnifying-glass"
12
+ :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32....'"
13
+ />
14
+ </div>
15
+ <UTable
16
+ v-bind="$attrs"
17
+ :loading="options.status.isLoading"
18
+ :data="options.rawData"
19
+ :columns="options.columns"
20
+ >
21
+ <template #empty>
22
+ <slot
23
+ v-if="options.status.isLoading"
24
+ name="loading"
25
+ >
26
+ <Loader
27
+ :loading="true"
28
+ />
29
+ </slot>
30
+ <slot
31
+ v-else-if="options.status.isError"
32
+ name="error"
33
+ >
34
+ <div
35
+ class="flex h-[200px] items-center justify-center text-2xl text-error-400"
36
+ >
37
+ {{ StringHelper.getError(options.status.errorData) }}
38
+ </div>
39
+ </slot>
40
+
41
+ <slot
42
+ v-else
43
+ name="error"
44
+ >
45
+ <Empty />
46
+ </slot>
47
+ </template>
48
+ <template
49
+ v-for="column in options.columns.filter((item) => !!item.type)"
50
+ #[`${column.accessorKey}-cell`]="{ row }"
51
+ :key="column.accessorKey"
52
+ >
53
+ <component
54
+ :is="column.type === COLUMN_TYPES.COMPONENT ? column.component : columnTypeComponents[column.type]"
55
+ v-if="column.type === COLUMN_TYPES.COMPONENT || columnTypeComponents[column.type]"
56
+ :value="transformValue(column, row)"
57
+ :column="column"
58
+ :row="row"
59
+ />
60
+ </template>
61
+ <template
62
+ v-for="(_, slotName) of $slots"
63
+ #[slotName]="slotProps"
64
+ >
65
+ <slot
66
+ :name="slotName"
67
+ v-bind="slotProps || {}"
68
+ />
69
+ </template>
70
+ </UTable>
71
+
72
+ <div
73
+ v-if="!options.isHidePagination"
74
74
  :class="theme.paginationContainer({
75
75
  class: [ui?.paginationContainer]
76
- })"
77
- >
78
- <p
76
+ })"
77
+ >
78
+ <p
79
79
  :class="theme.paginationInfo({
80
80
  class: [ui?.paginationInfo]
81
- })"
82
- >
83
- {{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
84
- </p>
85
- <Pagination
86
- v-if="options.pageOptions.totalPage > 1"
87
- v-model:page="page"
88
- :default-page="options.pageOptions?.currentPage || 1"
89
- :items-per-page="options.pageOptions.limit"
90
- :total="options.pageOptions.totalCount"
91
- @update:page="onPageChange"
92
- />
93
- </div>
94
- </div>
81
+ })"
82
+ >
83
+ {{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
84
+ </p>
85
+ <Pagination
86
+ v-if="options.pageOptions.totalPage > 1"
87
+ v-model:page="page"
88
+ :default-page="options.pageOptions?.currentPage || 1"
89
+ :items-per-page="options.pageOptions.limit"
90
+ :total="options.pageOptions.totalCount"
91
+ @update:page="onPageChange"
92
+ />
93
+ </div>
94
+ </div>
95
95
  </template>
96
96
 
97
97
  <script setup>
@@ -1,14 +1,23 @@
1
- import type { BreadcrumbItem } from '@nuxt/ui';
2
- export interface IDefinePageItem {
1
+ import type { BreadcrumbItem, NavigationMenuItem } from '@nuxt/ui';
2
+ export interface IAppPageMeta {
3
3
  title?: string;
4
4
  sub_title?: string;
5
5
  isHideBreadcrumbs?: boolean;
6
6
  breadcrumbs?: BreadcrumbItem[];
7
7
  }
8
- export declare const useApp: import("pinia").StoreDefinition<"_app", {
9
- pageMeta: IDefinePageItem;
10
- sidebar: BreadcrumbItem[];
11
- }, {}, {
12
- definePage(payload: IDefinePageItem): void;
8
+ export interface IApp {
9
+ pageMeta: IAppPageMeta;
10
+ sidebar: NavigationMenuItem[];
11
+ }
12
+ export declare const useApp: import("pinia").StoreDefinition<"_app", IApp, {}, {
13
+ definePage(pageMeta: IAppPageMeta): void;
13
14
  defineSidebar(items: BreadcrumbItem[]): void;
15
+ patchTitle(payload: {
16
+ title?: string;
17
+ sub_title?: string;
18
+ }): void;
19
+ patchBreadcrumbs(payload: {
20
+ breadcrumbs?: BreadcrumbItem[];
21
+ isHideBreadcrumbs?: boolean;
22
+ }): void;
14
23
  }>;
@@ -5,14 +5,19 @@ export const useApp = defineStore("_app", {
5
5
  sidebar: []
6
6
  }),
7
7
  actions: {
8
- definePage(payload) {
9
- this.pageMeta.title = payload.title;
10
- this.pageMeta.sub_title = payload.sub_title;
11
- this.pageMeta.isHideBreadcrumbs = payload.isHideBreadcrumbs;
12
- this.pageMeta.breadcrumbs = payload.breadcrumbs;
8
+ definePage(pageMeta) {
9
+ this.pageMeta = pageMeta;
13
10
  },
14
11
  defineSidebar(items) {
15
12
  this.sidebar = items;
13
+ },
14
+ patchTitle(payload) {
15
+ this.pageMeta.title = payload.title;
16
+ this.pageMeta.sub_title = payload.sub_title;
17
+ },
18
+ patchBreadcrumbs(payload) {
19
+ this.pageMeta.breadcrumbs = payload.breadcrumbs || [];
20
+ this.pageMeta.isHideBreadcrumbs = payload.isHideBreadcrumbs || false;
16
21
  }
17
22
  }
18
23
  });
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "../../../.nuxt/tsconfig.server.json",
3
- }
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -0,0 +1,5 @@
1
+ export * from './common.js';
2
+ export * from './lib.js';
3
+ export * from '../components/Form/types.js';
4
+ export * from '../components/Table/types.js';
5
+ export * from '../components/FlexDeck/types.js';
@@ -0,0 +1,5 @@
1
+ export * from "./common.js";
2
+ export * from "./lib.js";
3
+ export * from "../components/Form/types.js";
4
+ export * from "../components/Table/types.js";
5
+ export * from "../components/FlexDeck/types.js";
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
7
10
  "type": "module",
8
11
  "exports": {
9
12
  ".": {
@@ -64,6 +67,7 @@
64
67
  "@iconify-json/heroicons": "^1.2.2",
65
68
  "@iconify-json/ph": "^1.2.2",
66
69
  "@iconify-json/svg-spinners": "^1.2.2",
70
+ "@tailwindcss/typography": "^0.5.0-alpha.3",
67
71
  "url-join": "^5.0.0"
68
72
  },
69
73
  "devDependencies": {
@@ -74,7 +78,6 @@
74
78
  "@nuxt/module-builder": "^1.0.1",
75
79
  "@nuxt/schema": "^3.17.3",
76
80
  "@nuxt/test-utils": "^3.19.0",
77
- "@tailwindcss/typography": "^0.5.0-alpha.3",
78
81
  "@types/node": "latest",
79
82
  "changelogen": "^0.5.7",
80
83
  "eslint": "^9.26.0",
@@ -94,4 +97,4 @@
94
97
  "lint-staged": {
95
98
  "*": "eslint --fix"
96
99
  }
97
- }
100
+ }