@finema/core 3.22.0 → 3.24.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.
Files changed (130) hide show
  1. package/README.md +22 -2
  2. package/dist/module.d.mts +2 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +18 -15
  5. package/dist/runtime/components/App.vue +1 -1
  6. package/dist/runtime/components/DevToolsWindow/index.vue +24 -26
  7. package/dist/runtime/components/Dialog/index.d.vue.ts +1 -4
  8. package/dist/runtime/components/Dialog/index.vue +17 -17
  9. package/dist/runtime/components/Dialog/index.vue.d.ts +1 -4
  10. package/dist/runtime/components/Empty.d.vue.ts +1 -2
  11. package/dist/runtime/components/Empty.vue +19 -11
  12. package/dist/runtime/components/Empty.vue.d.ts +1 -2
  13. package/dist/runtime/components/FlexDeck/index.vue +21 -23
  14. package/dist/runtime/components/Form/FieldWrapper.vue +1 -1
  15. package/dist/runtime/components/Form/Fields.d.vue.ts +1 -1
  16. package/dist/runtime/components/Form/Fields.vue +26 -20
  17. package/dist/runtime/components/Form/Fields.vue.d.ts +1 -1
  18. package/dist/runtime/components/Form/InputCheckbox/index.vue +3 -6
  19. package/dist/runtime/components/Form/InputCheckboxGroup/index.vue +3 -6
  20. package/dist/runtime/components/Form/InputComponent/index.vue +2 -1
  21. package/dist/runtime/components/Form/InputCurrency/index.vue +11 -11
  22. package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +3 -1
  23. package/dist/runtime/components/Form/InputDateTime/index.vue +12 -17
  24. package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +1 -1
  25. package/dist/runtime/components/Form/InputDateTimeRange/index.vue +28 -20
  26. package/dist/runtime/components/Form/InputMonth/index.vue +14 -12
  27. package/dist/runtime/components/Form/InputMonth/types.d.ts +1 -1
  28. package/dist/runtime/components/Form/InputNumber/index.vue +3 -6
  29. package/dist/runtime/components/Form/InputRadio/index.vue +3 -6
  30. package/dist/runtime/components/Form/InputRating/index.vue +3 -6
  31. package/dist/runtime/components/Form/InputSearch/index.vue +6 -7
  32. package/dist/runtime/components/Form/InputSelect/index.vue +6 -15
  33. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +7 -18
  34. package/dist/runtime/components/Form/InputTags/index.vue +3 -6
  35. package/dist/runtime/components/Form/InputText/index.vue +41 -51
  36. package/dist/runtime/components/Form/InputTextarea/index.vue +3 -6
  37. package/dist/runtime/components/Form/InputTime/index.vue +32 -27
  38. package/dist/runtime/components/Form/InputTime/types.d.ts +1 -1
  39. package/dist/runtime/components/Form/InputToggle/index.vue +3 -5
  40. package/dist/runtime/components/Form/InputUploadDropzone/index.d.vue.ts +1 -4
  41. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +25 -23
  42. package/dist/runtime/components/Form/InputUploadDropzone/index.vue.d.ts +1 -4
  43. package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +2 -2
  44. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.d.vue.ts +0 -5
  45. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +22 -23
  46. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue.d.ts +0 -5
  47. package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +3 -3
  48. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.d.vue.ts +0 -5
  49. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +26 -24
  50. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue.d.ts +0 -5
  51. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +3 -3
  52. package/dist/runtime/components/Form/InputUploadImageAuto/index.d.vue.ts +1 -6
  53. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +22 -23
  54. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue.d.ts +1 -6
  55. package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +3 -3
  56. package/dist/runtime/components/Form/InputWYSIWYG/EditorImagePasteExtension.js +7 -6
  57. package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadExtension.js +13 -12
  58. package/dist/runtime/components/Form/InputWYSIWYG/EditorImageUploadNode.vue +3 -1
  59. package/dist/runtime/components/Form/InputWYSIWYG/EditorLinkPopover.vue +20 -22
  60. package/dist/runtime/components/Form/InputWYSIWYG/index.vue +140 -118
  61. package/dist/runtime/components/Form/fileState/EmptyState.vue +1 -1
  62. package/dist/runtime/components/Form/fileState/FailedState.vue +4 -2
  63. package/dist/runtime/components/Form/fileState/MultipleFilesState.d.vue.ts +4 -4
  64. package/dist/runtime/components/Form/fileState/MultipleFilesState.vue +5 -5
  65. package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +4 -4
  66. package/dist/runtime/components/Form/fileState/SuccessState.d.vue.ts +2 -2
  67. package/dist/runtime/components/Form/fileState/SuccessState.vue +8 -13
  68. package/dist/runtime/components/Form/fileState/SuccessState.vue.d.ts +2 -2
  69. package/dist/runtime/components/Form/fileState/useFilePicker.d.ts +34 -0
  70. package/dist/runtime/components/Form/fileState/useFilePicker.js +48 -0
  71. package/dist/runtime/components/Form/fileState/useFileState.d.ts +7 -9
  72. package/dist/runtime/components/Form/fileState/useFileState.js +32 -120
  73. package/dist/runtime/components/Form/fileState/useUploadImageState.d.ts +7 -8
  74. package/dist/runtime/components/Form/fileState/useUploadImageState.js +27 -301
  75. package/dist/runtime/components/Form/fileState/useUploadState.d.ts +11 -7
  76. package/dist/runtime/components/Form/fileState/useUploadState.js +52 -136
  77. package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +12 -18
  78. package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +88 -226
  79. package/dist/runtime/components/Form/types.d.ts +2 -0
  80. package/dist/runtime/components/Image.vue +4 -10
  81. package/dist/runtime/components/Loader.d.vue.ts +2 -1
  82. package/dist/runtime/components/Loader.vue +10 -7
  83. package/dist/runtime/components/Loader.vue.d.ts +2 -1
  84. package/dist/runtime/components/Log/LogItem.vue +1 -3
  85. package/dist/runtime/components/Log/index.vue +1 -3
  86. package/dist/runtime/components/Table/Base.d.vue.ts +15 -1
  87. package/dist/runtime/components/Table/Base.vue +9 -29
  88. package/dist/runtime/components/Table/Base.vue.d.ts +15 -1
  89. package/dist/runtime/components/Table/ColumnText.d.vue.ts +2 -3
  90. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  91. package/dist/runtime/components/Table/ColumnText.vue.d.ts +2 -3
  92. package/dist/runtime/components/Table/Pagination.vue +19 -22
  93. package/dist/runtime/components/Table/index.d.vue.ts +1 -1
  94. package/dist/runtime/components/Table/index.vue +5 -7
  95. package/dist/runtime/components/Table/index.vue.d.ts +1 -1
  96. package/dist/runtime/composables/loaderList.d.ts +2 -1
  97. package/dist/runtime/composables/loaderList.js +3 -4
  98. package/dist/runtime/composables/loaderObject.d.ts +2 -1
  99. package/dist/runtime/composables/loaderObject.js +2 -1
  100. package/dist/runtime/composables/loaderPage.js +223 -350
  101. package/dist/runtime/composables/useConfig.js +4 -3
  102. package/dist/runtime/composables/useDialog.js +3 -1
  103. package/dist/runtime/composables/useForm.d.ts +2 -2
  104. package/dist/runtime/composables/useForm.js +2 -4
  105. package/dist/runtime/composables/useMessages.d.ts +10 -0
  106. package/dist/runtime/composables/useMessages.js +10 -0
  107. package/dist/runtime/composables/useTable.js +2 -14
  108. package/dist/runtime/helpers/apiBaseHelper.js +6 -24
  109. package/dist/runtime/helpers/apiListHelper.js +2 -5
  110. package/dist/runtime/helpers/apiObjectHelper.js +2 -5
  111. package/dist/runtime/helpers/apiPageHelper.d.ts +0 -1
  112. package/dist/runtime/helpers/apiPageHelper.js +19 -38
  113. package/dist/runtime/helpers/componentHelper.js +2 -6
  114. package/dist/runtime/helpers/uploadCore.d.ts +54 -0
  115. package/dist/runtime/helpers/uploadCore.js +81 -0
  116. package/dist/runtime/i18n/valibot.d.ts +5 -68
  117. package/dist/runtime/i18n/valibot.js +33 -29
  118. package/dist/runtime/locale/en.d.ts +2 -0
  119. package/dist/runtime/locale/en.js +42 -0
  120. package/dist/runtime/locale/index.d.ts +7 -0
  121. package/dist/runtime/locale/index.js +5 -0
  122. package/dist/runtime/locale/th.d.ts +43 -0
  123. package/dist/runtime/locale/th.js +42 -0
  124. package/dist/runtime/server/tsconfig.json +1 -1
  125. package/dist/runtime/styles/main.css +1 -1
  126. package/dist/runtime/utils/ParamHelper.js +1 -1
  127. package/dist/runtime/utils/StringHelper.js +1 -4
  128. package/dist/runtime/utils/TimeHelper.js +2 -2
  129. package/dist/runtime/utils/lodash.js +2 -2
  130. package/package.json +57 -36
package/README.md CHANGED
@@ -7,6 +7,23 @@
7
7
 
8
8
  > Enterprise-grade Vue.js UI component library for Nuxt applications
9
9
 
10
+ ---
11
+
12
+ ## 🚀 Starting a new project? Use the starter template
13
+
14
+ > [!TIP]
15
+ > **Don't set it up by hand: start from the template.** It's a Nuxt 3 project with `@finema/core` already installed and configured.
16
+ >
17
+ > ### 👉 [gitlab.finema.co/finema/shared/nuxt3-template-with-uikit](https://gitlab.finema.co/finema/shared/nuxt3-template-with-uikit)
18
+ >
19
+ > ```bash
20
+ > git clone https://gitlab.finema.co/finema/shared/nuxt3-template-with-uikit.git my-app
21
+ > ```
22
+
23
+ Adding the kit to an **existing** project instead? See [Installation](#-installation) below.
24
+
25
+ ---
26
+
10
27
  A comprehensive, production-ready UI kit that provides 20+ auto-registered components, composables, and utilities for building consistent and beautiful user interfaces. Designed specifically for Nuxt 3 with TypeScript support, automatic validation, and seamless theming.
11
28
 
12
29
  ## ✨ Features
@@ -24,6 +41,7 @@ A comprehensive, production-ready UI kit that provides 20+ auto-registered compo
24
41
  ## 📋 Quick Links
25
42
 
26
43
  - [📖 Getting Started Guide](./docs/getting-started.md) - Complete setup and usage guide
44
+ - [🚀 **Starter Template**](https://gitlab.finema.co/finema/shared/nuxt3-template-with-uikit) - Nuxt 3 project template with the kit pre-configured
27
45
  - [🎮 Playground Examples](./playground/) - Live examples and demos
28
46
  - [📚 Component Documentation](./docs/components/) - Detailed component API
29
47
  - [🔧 Composables Guide](./docs/composables/) - Available utilities and helpers
@@ -362,14 +380,16 @@ bun run dev:build # Build playground
362
380
  bun run dev:prepare # Prepare development environment
363
381
 
364
382
  # Quality
365
- bun run lint # Lint codebase
383
+ bun run check # oxfmt --check + oxlint + nuxt-oxclint check-vue (rules from @finema/nuxt-oxclint)
384
+ bun run lint # oxlint only
366
385
  bun run lint:fix # Fix linting issues
386
+ bun run format # oxfmt, writes in place
367
387
  bun run test # Run tests
368
388
  bun run test:watch # Run tests in watch mode
369
389
  bun run test:types # Type checking
370
390
 
371
391
  # Release
372
- bun run release # Create new release (lint, test, build, publish)
392
+ bun run release # Create new release (check, test, build, publish)
373
393
  ```
374
394
 
375
395
  ## 📚 Documentation
package/dist/module.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { ICoreMessagesOverride } from '../dist/runtime/locale/index.js';
2
3
 
3
4
  declare const core: {
4
5
  limit_per_page: number;
@@ -15,6 +16,7 @@ declare const core: {
15
16
  color: string;
16
17
  time_zone: string;
17
18
  locale: string;
19
+ messages: ICoreMessagesOverride;
18
20
  };
19
21
 
20
22
  interface ModuleOptions {
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.22.0",
3
+ "version": "3.24.0",
4
4
  "configKey": "core",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.2",
6
+ "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
8
8
  }
9
9
  }
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.22.0";
7
+ const version = "3.24.0";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -62,7 +62,9 @@ const core = {
62
62
  site_name: "",
63
63
  color: "#3675FB",
64
64
  time_zone: "Asia/Bangkok",
65
- locale: "th"
65
+ locale: "th",
66
+ // Override any text the kit renders by itself, e.g. { common: { confirm: 'ยืนยัน' } }
67
+ messages: {}
66
68
  };
67
69
 
68
70
  const module$1 = defineNuxtModule({
@@ -79,16 +81,7 @@ const module$1 = defineNuxtModule({
79
81
  defaults: {
80
82
  prefix: "",
81
83
  theme: {
82
- colors: [
83
- "primary",
84
- "secondary",
85
- "tertiary",
86
- "info",
87
- "success",
88
- "warning",
89
- "error",
90
- "white"
91
- ]
84
+ colors: ["primary", "secondary", "tertiary", "info", "success", "warning", "error", "white"]
92
85
  }
93
86
  }
94
87
  },
@@ -101,9 +94,7 @@ const module$1 = defineNuxtModule({
101
94
  },
102
95
  defaults: {},
103
96
  async setup(_options, _nuxt) {
104
- const {
105
- resolve
106
- } = createResolver(import.meta.url);
97
+ const { resolve } = createResolver(import.meta.url);
107
98
  const runtimeDir = resolve("./runtime");
108
99
  _nuxt.options.build.transpile.push(runtimeDir);
109
100
  _nuxt.options.alias["#core"] = runtimeDir;
@@ -132,6 +123,17 @@ const module$1 = defineNuxtModule({
132
123
  },
133
124
  _nuxt.options.build
134
125
  );
126
+ const isInstalledPackage = import.meta.url.includes("node_modules");
127
+ const runtimeOptimizeDeps = [
128
+ "date-fns",
129
+ "date-fns/locale/th",
130
+ "date-fns-tz",
131
+ "lodash-es",
132
+ "url-join",
133
+ "maska/vue",
134
+ "@vuepic/vue-datepicker",
135
+ "@vueuse/components"
136
+ ].map((dep) => isInstalledPackage ? `${name} > ${dep}` : dep);
135
137
  _nuxt.options.vite = defu(
136
138
  {
137
139
  resolve: {
@@ -153,6 +155,7 @@ const module$1 = defineNuxtModule({
153
155
  "axios",
154
156
  "tailwind-variants",
155
157
  "@vueuse/core",
158
+ ...runtimeOptimizeDeps,
156
159
  "@nuxt/ui > prosemirror-state",
157
160
  "@nuxt/ui > prosemirror-transform",
158
161
  "@nuxt/ui > prosemirror-model",
@@ -13,7 +13,7 @@
13
13
 
14
14
  <script setup>
15
15
  import { th } from "@nuxt/ui/locale";
16
- import UApp from "#ui/components/App";
16
+ import UApp from "#ui/components/App.vue";
17
17
  import { useHead } from "#imports";
18
18
  import { useCoreConfig } from "#core/composables/useConfig";
19
19
  import DevToolsWindow from "#core/components/DevToolsWindow/index.vue";
@@ -2,10 +2,7 @@
2
2
  <div
3
3
  v-show="isShowDevTools"
4
4
  ref="devToolsRef"
5
- class="
6
- fixed z-50 overflow-hidden rounded-lg border border-neutral-300 bg-white
7
- opacity-80 shadow-2xl
8
- "
5
+ class="fixed z-50 overflow-hidden rounded-lg border border-neutral-300 bg-white opacity-80 shadow-2xl"
9
6
  :style="devToolsDynamicStyles"
10
7
  >
11
8
  <!-- Draggable Title Bar -->
@@ -85,9 +82,7 @@
85
82
  </div>
86
83
 
87
84
  <!-- Toggle button for this DevToolsWindow -->
88
- <div
89
- class="fixed right-1 bottom-1 z-[99999]"
90
- >
85
+ <div class="fixed right-1 bottom-1 z-[99999]">
91
86
  <Button
92
87
  :icon="isShowDevTools ? 'heroicons:x-mark' : 'heroicons:information-circle'"
93
88
  color="info"
@@ -214,14 +209,7 @@ const handleResizeStart = (handle, event) => {
214
209
  };
215
210
  const handleResizeMove = (event) => {
216
211
  if (!isResizing.value || !devToolsRef.value || !activeResizeHandle.value) return;
217
- const {
218
- width,
219
- height,
220
- top,
221
- left,
222
- mouseX,
223
- mouseY
224
- } = initialResizeState.value;
212
+ const { width, height, top, left, mouseX, mouseY } = initialResizeState.value;
225
213
  const deltaX = event.clientX - mouseX;
226
214
  const deltaY = event.clientY - mouseY;
227
215
  let newWidth = width;
@@ -278,33 +266,43 @@ const resetDevToolsState = () => {
278
266
  ...DEFAULT_POSITION
279
267
  };
280
268
  Object.keys(newStyles).forEach((key) => {
269
+ ;
281
270
  devToolsRef.value.style[key] = newStyles[key];
282
271
  });
283
272
  if (newStyles.top === "auto") {
273
+ ;
284
274
  devToolsRef.value.style.bottom = newStyles.bottom;
285
275
  } else {
276
+ ;
286
277
  devToolsRef.value.style.bottom = "auto";
287
278
  }
288
279
  if (newStyles.left === "auto") {
280
+ ;
289
281
  devToolsRef.value.style.right = newStyles.right;
290
282
  } else {
283
+ ;
291
284
  devToolsRef.value.style.right = "auto";
292
285
  }
293
286
  }
294
287
  };
295
288
  onMounted(() => {
296
- watch(isShowDevTools, (newValue) => {
297
- if (newValue && devToolsRef.value) {
298
- const currentStyle = devToolsDynamicStyles.value;
299
- Object.keys(currentStyle).forEach((key) => {
300
- if (devToolsRef.value) {
301
- devToolsRef.value.style[key] = currentStyle[key];
302
- }
303
- });
289
+ watch(
290
+ isShowDevTools,
291
+ (newValue) => {
292
+ if (newValue && devToolsRef.value) {
293
+ const currentStyle = devToolsDynamicStyles.value;
294
+ Object.keys(currentStyle).forEach((key) => {
295
+ if (devToolsRef.value) {
296
+ ;
297
+ devToolsRef.value.style[key] = currentStyle[key] ?? "";
298
+ }
299
+ });
300
+ }
301
+ },
302
+ {
303
+ immediate: true
304
304
  }
305
- }, {
306
- immediate: true
307
- });
305
+ );
308
306
  });
309
307
  onUnmounted(() => {
310
308
  if (isDragging.value) handleDragEnd();
@@ -3,9 +3,6 @@ declare const __VLS_export: import("vue").DefineComponent<IDialogMetaItem, {}, {
3
3
  close: (args_0: boolean) => any;
4
4
  }, string, import("vue").PublicProps, Readonly<IDialogMetaItem> & Readonly<{
5
5
  onClose?: ((args_0: boolean) => any) | undefined;
6
- }>, {
7
- confirmText: string;
8
- cancelText: string;
9
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
7
  declare const _default: typeof __VLS_export;
11
8
  export default _default;
@@ -2,9 +2,7 @@
2
2
  <AlertDialogRoot :open="true">
3
3
  <AlertDialogPortal>
4
4
  <AlertDialogOverlay :class="theme.overlay()" />
5
- <AlertDialogContent
6
- :class="theme.base()"
7
- >
5
+ <AlertDialogContent :class="theme.base()">
8
6
  <div :class="theme.iconWrapper()">
9
7
  <Icon
10
8
  v-if="!propsSafe.isHideIcon"
@@ -64,21 +62,18 @@ import { computed, useAttrs } from "vue";
64
62
  import { useUiIconConfig, useUiConfig } from "../../composables/useConfig";
65
63
  import { dialogTheme } from "#core/theme/dialog";
66
64
  import { DialogType } from "#core/composables/useDialog";
65
+ import { useCoreMessages } from "#core/composables/useMessages";
67
66
  const emits = defineEmits();
68
- const props = withDefaults(defineProps(), {
69
- confirmText: "\u0E15\u0E01\u0E25\u0E07",
70
- cancelText: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01"
71
- });
67
+ const props = defineProps();
72
68
  const attrs = useAttrs();
69
+ const { messages } = useCoreMessages();
73
70
  const icons = useUiIconConfig("dialog");
74
71
  const propsSafe = computed(() => {
75
- if (props.title) {
76
- return props;
77
- }
72
+ const source = props.title ? props : attrs;
78
73
  return {
79
- ...attrs,
80
- cancelText: attrs.cancelText || "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
81
- confirmText: attrs.confirmText || "\u0E15\u0E01\u0E25\u0E07"
74
+ ...source,
75
+ cancelText: source.cancelText || messages.value.common.cancel,
76
+ confirmText: source.confirmText || messages.value.common.confirm
82
77
  };
83
78
  });
84
79
  const getIcon = computed(() => {
@@ -100,8 +95,13 @@ const getIcon = computed(() => {
100
95
  return icons.iconInfo;
101
96
  }
102
97
  });
103
- const theme = computed(() => useUiConfig(dialogTheme, "dialog")({
104
- color: propsSafe.value.type,
105
- confirm: propsSafe.value.isConfirm
106
- }));
98
+ const theme = computed(
99
+ () => useUiConfig(
100
+ dialogTheme,
101
+ "dialog"
102
+ )({
103
+ color: propsSafe.value.type,
104
+ confirm: propsSafe.value.isConfirm
105
+ })
106
+ );
107
107
  </script>
@@ -3,9 +3,6 @@ declare const __VLS_export: import("vue").DefineComponent<IDialogMetaItem, {}, {
3
3
  close: (args_0: boolean) => any;
4
4
  }, string, import("vue").PublicProps, Readonly<IDialogMetaItem> & Readonly<{
5
5
  onClose?: ((args_0: boolean) => any) | undefined;
6
- }>, {
7
- confirmText: string;
8
- cancelText: string;
9
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
7
  declare const _default: typeof __VLS_export;
11
8
  export default _default;
@@ -2,12 +2,11 @@ import { emptyTheme } from '#core/theme/empty';
2
2
  type __VLS_Props = {
3
3
  message?: any;
4
4
  icon?: string;
5
- ui?: typeof emptyTheme['slots'];
5
+ ui?: (typeof emptyTheme)['slots'];
6
6
  class?: any;
7
7
  };
8
8
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
9
  icon: string;
10
- message: any;
11
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
11
  declare const _default: typeof __VLS_export;
13
12
  export default _default;
@@ -1,20 +1,26 @@
1
1
  <template>
2
2
  <div
3
- :class="theme.base({
4
- class: [ui?.base, props.class]
5
- })"
3
+ :class="
4
+ theme.base({
5
+ class: [ui?.base, props.class]
6
+ })
7
+ "
6
8
  >
7
9
  <Icon
8
10
  :name="icon"
9
- :class="theme.iconSize({
10
- class: [ui?.iconSize]
11
- })"
11
+ :class="
12
+ theme.iconSize({
13
+ class: [ui?.iconSize]
14
+ })
15
+ "
12
16
  />
13
17
  <p
14
- :class="theme.message({
15
- class: [ui?.message]
16
- })"
17
- v-html="message"
18
+ :class="
19
+ theme.message({
20
+ class: [ui?.message]
21
+ })
22
+ "
23
+ v-html="message ?? messages.common.empty"
18
24
  />
19
25
  </div>
20
26
  </template>
@@ -23,11 +29,13 @@
23
29
  import { computed } from "vue";
24
30
  import { useUiConfig } from "#core/composables/useConfig";
25
31
  import { emptyTheme } from "#core/theme/empty";
32
+ import { useCoreMessages } from "#core/composables/useMessages";
26
33
  const props = defineProps({
27
- message: { type: null, required: false, default: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25!" },
34
+ message: { type: null, required: false },
28
35
  icon: { type: String, required: false, default: "ph:table-thin" },
29
36
  ui: { type: null, required: false },
30
37
  class: { type: null, required: false }
31
38
  });
32
39
  const theme = computed(() => useUiConfig(emptyTheme, "empty")());
40
+ const { messages } = useCoreMessages();
33
41
  </script>
@@ -2,12 +2,11 @@ import { emptyTheme } from '#core/theme/empty';
2
2
  type __VLS_Props = {
3
3
  message?: any;
4
4
  icon?: string;
5
- ui?: typeof emptyTheme['slots'];
5
+ ui?: (typeof emptyTheme)['slots'];
6
6
  class?: any;
7
7
  };
8
8
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
9
  icon: string;
10
- message: any;
11
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
11
  declare const _default: typeof __VLS_export;
13
12
  export default _default;
@@ -7,7 +7,7 @@
7
7
  <Input
8
8
  v-model="q"
9
9
  icon="i-heroicons-magnifying-glass"
10
- :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32...'"
10
+ :placeholder="options.searchPlaceholder || messages.common.search"
11
11
  />
12
12
  </div>
13
13
 
@@ -16,7 +16,8 @@
16
16
  class="mb-4 flex items-center justify-end"
17
17
  >
18
18
  <p class="text-xs text-gray-500">
19
- {{ totalInnerRawData }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
19
+ {{ totalInnerRawData }} {{ messages.pagination.itemsOfTotal }} {{ totalCountWithComma }}
20
+ {{ messages.pagination.items }}
20
21
  </p>
21
22
  </div>
22
23
 
@@ -31,19 +32,13 @@
31
32
  v-else-if="options.status.isLoading"
32
33
  name="loading-state"
33
34
  >
34
- <Loader
35
- :loading="true"
36
- />
35
+ <Loader :loading="true" />
37
36
  </slot>
38
37
  <slot
39
38
  v-else-if="options.status.isError"
40
39
  name="error-state"
41
40
  >
42
- <div
43
- class="
44
- text-error-400 flex h-[200px] items-center justify-center text-2xl
45
- "
46
- >
41
+ <div class="flex h-[200px] items-center justify-center text-2xl text-error-400">
47
42
  {{ StringHelper.getError(options.status.errorData) }}
48
43
  </div>
49
44
  </slot>
@@ -65,8 +60,8 @@
65
60
  class="mt-4 flex justify-between px-3"
66
61
  >
67
62
  <p class="text-xs text-gray-500">
68
- {{ pageBetween }} {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23 \u0E08\u0E32\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14" : "items of total" }}
69
- {{ totalCountWithComma }} {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}
63
+ {{ pageBetween }} {{ messages.pagination.itemsOfTotal }} {{ totalCountWithComma }}
64
+ {{ messages.pagination.items }}
70
65
  </p>
71
66
  <Pagination
72
67
  v-if="options.pageOptions.totalPage > 1"
@@ -81,10 +76,12 @@
81
76
  </template>
82
77
 
83
78
  <script setup>
79
+ import { useCoreMessages } from "#core/composables/useMessages";
84
80
  import { computed, ref, watch } from "vue";
85
81
  import { useElementVisibility } from "@vueuse/core";
86
82
  import { NumberHelper } from "#core/utils/NumberHelper";
87
- import { _debounce, useRouter, useWatchChange, useWatchTrue, useAppConfig } from "#imports";
83
+ import { StringHelper } from "#core/utils/StringHelper";
84
+ import { _debounce, useRouter, useWatchChange, useWatchTrue } from "#imports";
88
85
  import { useCoreConfig } from "#core/composables/useConfig";
89
86
  import Empty from "#core/components/Empty.vue";
90
87
  const emits = defineEmits(["pageChange", "search"]);
@@ -100,7 +97,6 @@ const props = defineProps({
100
97
  });
101
98
  defineSlots();
102
99
  const coreConfig = useCoreConfig();
103
- const appConfig = useAppConfig();
104
100
  const router = useRouter();
105
101
  const q = ref(props.options?.pageOptions.search ?? "");
106
102
  const bottomEdgeElement = ref(null);
@@ -113,9 +109,7 @@ const displayData = computed(() => {
113
109
  const to = (page2) => {
114
110
  const params = props.options?.pageOptions?.request?.params || {};
115
111
  const cleanParams = Object.fromEntries(
116
- Object.entries(params).filter(
117
- ([key, value]) => value !== null && value !== void 0 && value !== ""
118
- )
112
+ Object.entries(params).filter(([key, value]) => value !== null && value !== void 0 && value !== "")
119
113
  );
120
114
  return {
121
115
  query: {
@@ -124,12 +118,15 @@ const to = (page2) => {
124
118
  }
125
119
  };
126
120
  };
127
- useWatchChange(() => props.options?.pageOptions?.request?.params, () => {
128
- if (props.options?.isRouteChange) return;
129
- router.replace({
130
- query: props.options?.pageOptions?.request?.params || {}
131
- });
132
- });
121
+ useWatchChange(
122
+ () => props.options?.pageOptions?.request?.params,
123
+ () => {
124
+ if (props.options?.isRouteChange) return;
125
+ router.replace({
126
+ query: props.options?.pageOptions?.request?.params || {}
127
+ });
128
+ }
129
+ );
133
130
  const pageBetween = computed(() => {
134
131
  const length = props.options.rawData?.length;
135
132
  if (length === 0) {
@@ -176,4 +173,5 @@ watch(targetElement, (value) => {
176
173
  const onPageChange = (page2) => {
177
174
  emits("pageChange", page2);
178
175
  };
176
+ const { messages } = useCoreMessages();
179
177
  </script>
@@ -30,6 +30,6 @@ defineProps({
30
30
  required: { type: Boolean, required: false },
31
31
  help: { type: String, required: false },
32
32
  ui: { type: null, required: false },
33
- containerUi: { type: null, required: false }
33
+ containerUi: { type: Object, required: false }
34
34
  });
35
35
  </script>
@@ -6,7 +6,7 @@ type __VLS_Props = {
6
6
  options: IFormField[];
7
7
  orientation?: 'horizontal' | 'vertical';
8
8
  class?: any;
9
- ui?: typeof formTheme['slots'];
9
+ ui?: (typeof formTheme)['slots'];
10
10
  };
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
12
  orientation: "horizontal" | "vertical";
@@ -1,8 +1,10 @@
1
1
  <template>
2
2
  <div
3
- :class="[theme.base({
4
- class: [$props.class, ui?.base]
5
- })]"
3
+ :class="[
4
+ theme.base({
5
+ class: [$props.class, ui?.base]
6
+ })
7
+ ]"
6
8
  >
7
9
  <component
8
10
  :is="componentMap[option.type]?.component"
@@ -20,7 +22,7 @@
20
22
  </template>
21
23
 
22
24
  <script setup>
23
- import { computed } from "vue";
25
+ import { computed, defineAsyncComponent } from "vue";
24
26
  import FormInputTextarea from "./InputTextarea/index.vue";
25
27
  import FormInputText from "./InputText/index.vue";
26
28
  import FormInputSearch from "./InputSearch/index.vue";
@@ -34,16 +36,7 @@ import FormInputSelectMultiple from "./InputSelectMultiple/index.vue";
34
36
  import FormInputComponent from "./InputComponent/index.vue";
35
37
  import FormInputRadio from "./InputRadio/index.vue";
36
38
  import FormInputRating from "./InputRating/index.vue";
37
- import FormInputDateTime from "./InputDateTime/index.vue";
38
- import FormInputTime from "./InputTime/index.vue";
39
- import FormInputMonth from "./InputMonth/index.vue";
40
- import FormInputDateTimeRange from "./InputDateTimeRange/index.vue";
41
- import FormInputUploadDropzoneAuto from "./InputUploadDropzoneAuto/index.vue";
42
- import FormInputUploadDropzoneAutoMultiple from "./InputUploadDropzoneAutoMultiple/index.vue";
43
- import FormInputUploadDropzone from "./InputUploadDropzone/index.vue";
44
- import FormInputUploadImageAuto from "./InputUploadImageAuto/index.vue";
45
39
  import FormInputTag from "./InputTags/index.vue";
46
- import FormInputWYSIWYG from "./InputWYSIWYG/index.vue";
47
40
  import { INPUT_TYPES } from "#core/components/Form/types";
48
41
  import { formTheme } from "#core/theme/form";
49
42
  import { useUiConfig } from "#core/composables/useConfig";
@@ -54,6 +47,17 @@ const props = defineProps({
54
47
  class: { type: null, required: false },
55
48
  ui: { type: null, required: false }
56
49
  });
50
+ const FormInputDateTime = defineAsyncComponent(() => import("./InputDateTime/index.vue"));
51
+ const FormInputTime = defineAsyncComponent(() => import("./InputTime/index.vue"));
52
+ const FormInputMonth = defineAsyncComponent(() => import("./InputMonth/index.vue"));
53
+ const FormInputDateTimeRange = defineAsyncComponent(() => import("./InputDateTimeRange/index.vue"));
54
+ const FormInputUploadDropzoneAuto = defineAsyncComponent(() => import("./InputUploadDropzoneAuto/index.vue"));
55
+ const FormInputUploadDropzoneAutoMultiple = defineAsyncComponent(
56
+ () => import("./InputUploadDropzoneAutoMultiple/index.vue")
57
+ );
58
+ const FormInputUploadDropzone = defineAsyncComponent(() => import("./InputUploadDropzone/index.vue"));
59
+ const FormInputUploadImageAuto = defineAsyncComponent(() => import("./InputUploadImageAuto/index.vue"));
60
+ const FormInputWYSIWYG = defineAsyncComponent(() => import("./InputWYSIWYG/index.vue"));
57
61
  const componentMap = {
58
62
  [INPUT_TYPES.TEXT]: {
59
63
  component: FormInputText,
@@ -179,14 +183,16 @@ const componentMap = {
179
183
  props: {}
180
184
  }
181
185
  };
182
- const theme = computed(() => useUiConfig(formTheme, "form")({
183
- orientation: props.orientation
184
- }));
186
+ const theme = computed(
187
+ () => useUiConfig(
188
+ formTheme,
189
+ "form"
190
+ )({
191
+ orientation: props.orientation
192
+ })
193
+ );
185
194
  const getFieldBinding = (field) => {
186
- const {
187
- props: fieldProps,
188
- ui: fieldUi
189
- } = field;
195
+ const { props: fieldProps, ui: fieldUi } = field;
190
196
  const allProps = {
191
197
  ...fieldProps,
192
198
  containerUi: {
@@ -6,7 +6,7 @@ type __VLS_Props = {
6
6
  options: IFormField[];
7
7
  orientation?: 'horizontal' | 'vertical';
8
8
  class?: any;
9
- ui?: typeof formTheme['slots'];
9
+ ui?: (typeof formTheme)['slots'];
10
10
  };
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
12
  orientation: "horizontal" | "vertical";
@@ -39,13 +39,10 @@ const props = defineProps({
39
39
  readonly: { type: Boolean, required: false },
40
40
  required: { type: Boolean, required: false },
41
41
  help: { type: String, required: false },
42
- ui: { type: null, required: false }
42
+ ui: { type: null, required: false },
43
+ containerUi: { type: null, required: false }
43
44
  });
44
- const {
45
- value,
46
- wrapperProps,
47
- handleChange
48
- } = useFieldHOC(props);
45
+ const { value, wrapperProps, handleChange } = useFieldHOC(props);
49
46
  const onChange = (value2) => {
50
47
  handleChange(value2);
51
48
  emits("change", value2);