@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
@@ -1,13 +1,12 @@
1
- import { type ComponentProps } from 'vue';
2
1
  import type { TableColumn } from '@nuxt/ui';
3
- import NuxtLink from '#app/components/nuxt-link';
2
+ import type { NuxtLinkProps } from '#app';
4
3
  type __VLS_Props = {
5
4
  value: any;
6
5
  row: any;
7
6
  column: TableColumn<any> & {
8
7
  meta: {
9
8
  max: number;
10
- link?: ComponentProps<typeof NuxtLink>;
9
+ link?: NuxtLinkProps;
11
10
  };
12
11
  };
13
12
  };
@@ -16,7 +16,7 @@
16
16
  <USelect
17
17
  v-if="options.pageOptions && !options.isHideLimitSelect"
18
18
  size="lg"
19
- trailing="รายการ"
19
+ trailing
20
20
  :class="
21
21
  theme.paginationLimitSelect({
22
22
  class: [ui?.paginationLimitSelect, 'cursor-pointer']
@@ -35,7 +35,7 @@
35
35
  "
36
36
  >
37
37
  {{ modelValue }}
38
- {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}
38
+ {{ messages.pagination.items }}
39
39
  </p>
40
40
  </template>
41
41
  </USelect>
@@ -46,12 +46,16 @@
46
46
  })
47
47
  "
48
48
  >
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" }}
49
+ <span v-if="options.pageOptions">
50
+ {{ pageBetween }}
51
+ {{ messages.pagination.ofTotal }}
52
+ {{ totalCountWithComma }}
53
+ </span>
54
+ <span v-else>
55
+ {{ messages.pagination.total }}
53
56
  {{ options.rawData.length }}
54
- {{ appConfig.core?.locale === "th" ? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23" : "items" }}</span>
57
+ {{ messages.pagination.items }}
58
+ </span>
55
59
  </p>
56
60
  </div>
57
61
  <UPagination
@@ -70,6 +74,7 @@
70
74
  >
71
75
  <template #item="{ item, page }">
72
76
  <Button
77
+ v-if="item.type === 'page'"
73
78
  :variant="page === item.value ? 'subtle' : 'outline'"
74
79
  :color="page === item.value ? 'neutral' : 'neutral'"
75
80
  :label="String(NumberHelper.withComma(item.value))"
@@ -88,14 +93,10 @@
88
93
  </template>
89
94
 
90
95
  <script setup>
91
- import {
92
- computed,
93
- NumberHelper,
94
- useUiConfig,
95
- useAppConfig
96
- } from "#imports";
97
- import UPagination from "#ui/components/Pagination";
98
- import USelect from "#ui/components/Select";
96
+ import { useCoreMessages } from "#core/composables/useMessages";
97
+ import { computed, NumberHelper, useUiConfig } from "#imports";
98
+ import UPagination from "#ui/components/Pagination.vue";
99
+ import USelect from "#ui/components/Select.vue";
99
100
  import { tableTheme } from "../../theme/table";
100
101
  import { paginationTheme } from "../../theme/pagination";
101
102
  const emits = defineEmits(["pageChange", "search", "pageLimitChange"]);
@@ -105,10 +106,7 @@ const props = defineProps({
105
106
  options: { type: Object, required: true },
106
107
  ui: { type: null, required: false }
107
108
  });
108
- const themePagination = computed(
109
- () => useUiConfig(paginationTheme, "pagination")()
110
- );
111
- const appConfig = useAppConfig();
109
+ const themePagination = computed(() => useUiConfig(paginationTheme, "pagination")());
112
110
  const pageLimitItems = [
113
111
  {
114
112
  label: "10",
@@ -153,9 +151,7 @@ const totalCountWithComma = computed(() => {
153
151
  const to = (page) => {
154
152
  const params = props.options.pageOptions?.request?.params || {};
155
153
  const cleanParams = Object.fromEntries(
156
- Object.entries(params).filter(
157
- ([key, value]) => value !== null && value !== void 0 && value !== ""
158
- )
154
+ Object.entries(params).filter(([key, value]) => value !== null && value !== void 0 && value !== "")
159
155
  );
160
156
  return {
161
157
  query: {
@@ -164,4 +160,5 @@ const to = (page) => {
164
160
  }
165
161
  };
166
162
  };
163
+ const { messages } = useCoreMessages();
167
164
  </script>
@@ -32,11 +32,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
32
32
  right: string[];
33
33
  }) => any) | undefined;
34
34
  }>, {
35
- isPinAction: boolean;
36
35
  columnPinning: {
37
36
  left: string[];
38
37
  right: string[];
39
38
  };
39
+ isPinAction: boolean;
40
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
41
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
42
  declare const _default: typeof __VLS_export;
@@ -11,7 +11,7 @@
11
11
  <Input
12
12
  v-model="q"
13
13
  icon="i-heroicons-magnifying-glass"
14
- :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32....'"
14
+ :placeholder="options.searchPlaceholder || messages.common.search"
15
15
  />
16
16
  </div>
17
17
  <Base
@@ -39,6 +39,7 @@
39
39
  </template>
40
40
 
41
41
  <script setup>
42
+ import { useCoreMessages } from "#core/composables/useMessages";
42
43
  import { computed } from "vue";
43
44
  import { _debounce, ref, useUiConfig, watch } from "#imports";
44
45
  import { tableTheme } from "#core/theme/table";
@@ -71,13 +72,9 @@ const computedUi = computed(() => {
71
72
  });
72
73
  const computedColumnPinning = computed(() => {
73
74
  if (props.isPinAction) {
74
- const hasActionsColumn = props.options.columns.some(
75
- (col) => col.accessorKey === "actions"
76
- );
75
+ const hasActionsColumn = props.options.columns.some((col) => col.accessorKey === "actions");
77
76
  if (hasActionsColumn) {
78
- const rightPinned = props.columnPinning.right.filter(
79
- (col) => col !== "actions"
80
- );
77
+ const rightPinned = props.columnPinning.right.filter((col) => col !== "actions");
81
78
  return {
82
79
  left: props.columnPinning.left,
83
80
  right: [...rightPinned, "actions"]
@@ -103,4 +100,5 @@ const onPageChange = (newPage) => {
103
100
  }
104
101
  emits("pageChange", newPage);
105
102
  };
103
+ const { messages } = useCoreMessages();
106
104
  </script>
@@ -32,11 +32,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
32
32
  right: string[];
33
33
  }) => any) | undefined;
34
34
  }>, {
35
- isPinAction: boolean;
36
35
  columnPinning: {
37
36
  left: string[];
38
37
  right: string[];
39
38
  };
39
+ isPinAction: boolean;
40
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
41
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
42
  declare const _default: typeof __VLS_export;
@@ -1,3 +1,4 @@
1
1
  import { type IListLoaderOptions } from '../helpers/apiListHelper.js';
2
2
  import type { IUseListLoader } from '../helpers/apiObjectHelper.js';
3
- export declare const useListLoader: <T = any, O = Record<string, any>>(loaderOptions: IListLoaderOptions<T, O>) => IUseListLoader<T, O>;
3
+ declare const useListLoader: <T = any, O = Record<string, any>>(loaderOptions: IListLoaderOptions<T, O>) => IUseListLoader<T, O>;
4
+ export { useListLoader };
@@ -1,10 +1,8 @@
1
1
  import { reactive, computed } from "vue";
2
2
  import { ObjectHelper } from "../utils/ObjectHelper.js";
3
3
  import { createCancelableRequest } from "../helpers/apiCancelHelper.js";
4
- import {
5
- apiListHelper
6
- } from "../helpers/apiListHelper.js";
7
- export const useListLoader = (loaderOptions) => {
4
+ import { apiListHelper } from "../helpers/apiListHelper.js";
5
+ const useListLoader = (loaderOptions) => {
8
6
  const result = reactive({
9
7
  items: [],
10
8
  status: ObjectHelper.createStatus(),
@@ -72,3 +70,4 @@ export const useListLoader = (loaderOptions) => {
72
70
  setLoading
73
71
  };
74
72
  };
73
+ export { useListLoader };
@@ -1,2 +1,3 @@
1
1
  import { type IObjectLoaderOptions, type IUseObjectLoader } from '../helpers/apiObjectHelper.js';
2
- export declare const useObjectLoader: <T = any, B = any, O = Record<string, any>>(loaderOptions: IObjectLoaderOptions<T, B, O>) => IUseObjectLoader<T, B, O>;
2
+ declare const useObjectLoader: <T = any, B = any, O = Record<string, any>>(loaderOptions: IObjectLoaderOptions<T, B, O>) => IUseObjectLoader<T, B, O>;
3
+ export { useObjectLoader };
@@ -4,7 +4,7 @@ import { createCancelableRequest } from "../helpers/apiCancelHelper.js";
4
4
  import {
5
5
  apiObjectHelper
6
6
  } from "../helpers/apiObjectHelper.js";
7
- export const useObjectLoader = (loaderOptions) => {
7
+ const useObjectLoader = (loaderOptions) => {
8
8
  const state = reactive({
9
9
  data: null,
10
10
  status: ObjectHelper.createStatus(),
@@ -81,3 +81,4 @@ export const useObjectLoader = (loaderOptions) => {
81
81
  setData
82
82
  };
83
83
  };
84
+ export { useObjectLoader };