@finema/core 2.1.1 → 2.3.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 (40) hide show
  1. package/README.md +79 -79
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/App.vue +7 -7
  5. package/dist/runtime/components/DevToolsWindow/index.vue +95 -95
  6. package/dist/runtime/components/Dialog/index.vue +61 -50
  7. package/dist/runtime/components/Empty.vue +12 -12
  8. package/dist/runtime/components/FlexDeck/Base.vue +67 -67
  9. package/dist/runtime/components/FlexDeck/index.vue +33 -33
  10. package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
  11. package/dist/runtime/components/Form/Fields.vue +13 -13
  12. package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
  13. package/dist/runtime/components/Form/InputDateTime/index.vue +44 -44
  14. package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
  15. package/dist/runtime/components/Form/InputSelect/index.vue +38 -38
  16. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
  17. package/dist/runtime/components/Form/InputText/index.vue +48 -48
  18. package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
  19. package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
  20. package/dist/runtime/components/Form/index.vue +5 -5
  21. package/dist/runtime/components/Image.vue +28 -28
  22. package/dist/runtime/components/Loader.vue +10 -10
  23. package/dist/runtime/components/Log/index.vue +17 -17
  24. package/dist/runtime/components/Table/Base.vue +76 -76
  25. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  26. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  27. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  28. package/dist/runtime/components/Table/ColumnNumber.vue +1 -1
  29. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  30. package/dist/runtime/components/Table/Simple.vue +21 -21
  31. package/dist/runtime/components/Table/index.vue +100 -100
  32. package/dist/runtime/helpers/apiPageHelper.js +2 -1
  33. package/dist/runtime/server/tsconfig.json +3 -3
  34. package/dist/runtime/types/common.d.ts +1 -1
  35. package/dist/runtime/utils/ArrayHelper.js +1 -1
  36. package/dist/runtime/utils/ObjectHelper.js +1 -2
  37. package/dist/runtime/utils/ParamHelper.js +1 -1
  38. package/dist/runtime/utils/lodash.d.ts +15 -0
  39. package/dist/runtime/utils/lodash.js +27 -0
  40. package/package.json +1 -1
@@ -1,52 +1,52 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Input
4
- v-if="type === 'password'"
5
- v-maska="activeMaskOptions"
6
- :model-value="value"
7
- :disabled="wrapperProps.disabled"
8
- :leading-icon="leadingIcon"
9
- :trailing-icon="trailingIcon"
10
- :loading="loading"
11
- :loading-icon="loadingIcon"
12
- :name="name"
13
- :placeholder="wrapperProps.placeholder"
14
- :type="isShowPassword ? 'text' : 'password'"
15
- :autofocus="!!autoFocus"
16
- :icon="icon"
17
- :readonly="readonly"
18
- :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
19
- @update:model-value="onChange"
20
- >
21
- <template #trailing>
22
- <Button
23
- color="neutral"
24
- variant="link"
25
- :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
26
- :padded="false"
27
- @click="isShowPassword = !isShowPassword"
28
- />
29
- </template>
30
- </Input>
31
- <Input
32
- v-else
33
- v-maska="activeMaskOptions"
34
- :model-value="value"
35
- :disabled="wrapperProps.disabled"
36
- :leading-icon="leadingIcon"
37
- :trailing-icon="trailingIcon"
38
- :loading="loading"
39
- :loading-icon="loadingIcon"
40
- :name="name"
41
- :placeholder="wrapperProps.placeholder"
42
- :type="type"
43
- :autofocus="!!autoFocus"
44
- :icon="icon"
45
- :readonly="readonly"
46
- :ui="ui"
47
- @update:model-value="onChange"
48
- />
49
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Input
4
+ v-if="type === 'password'"
5
+ v-maska="activeMaskOptions"
6
+ :model-value="value"
7
+ :disabled="wrapperProps.disabled"
8
+ :leading-icon="leadingIcon"
9
+ :trailing-icon="trailingIcon"
10
+ :loading="loading"
11
+ :loading-icon="loadingIcon"
12
+ :name="name"
13
+ :placeholder="wrapperProps.placeholder"
14
+ :type="isShowPassword ? 'text' : 'password'"
15
+ :autofocus="!!autoFocus"
16
+ :icon="icon"
17
+ :readonly="readonly"
18
+ :ui="defu(ui, { icon: { trailing: { pointer: '' } } })"
19
+ @update:model-value="onChange"
20
+ >
21
+ <template #trailing>
22
+ <Button
23
+ color="neutral"
24
+ variant="link"
25
+ :icon="isShowPassword ? 'i-heroicons-eye-slash' : 'i-heroicons-eye'"
26
+ :padded="false"
27
+ @click="isShowPassword = !isShowPassword"
28
+ />
29
+ </template>
30
+ </Input>
31
+ <Input
32
+ v-else
33
+ v-maska="activeMaskOptions"
34
+ :model-value="value"
35
+ :disabled="wrapperProps.disabled"
36
+ :leading-icon="leadingIcon"
37
+ :trailing-icon="trailingIcon"
38
+ :loading="loading"
39
+ :loading-icon="loadingIcon"
40
+ :name="name"
41
+ :placeholder="wrapperProps.placeholder"
42
+ :type="type"
43
+ :autofocus="!!autoFocus"
44
+ :icon="icon"
45
+ :readonly="readonly"
46
+ :ui="ui"
47
+ @update:model-value="onChange"
48
+ />
49
+ </FieldWrapper>
50
50
  </template>
51
51
 
52
52
  <script setup>
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Textarea
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :name="name"
7
- :resize="resize"
8
- :placeholder="wrapperProps.placeholder"
9
- :autofocus="!!autoFocus"
10
- :autoresize="autoresize"
11
- :rows="rows"
12
- :maxrows="maxrows"
13
- :loading="loading"
14
- :loading-icon="loadingIcon"
15
- :readonly="readonly"
16
- :ui="ui"
17
- @update:model-value="onChange"
18
- />
19
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Textarea
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ :name="name"
7
+ :resize="resize"
8
+ :placeholder="wrapperProps.placeholder"
9
+ :autofocus="!!autoFocus"
10
+ :autoresize="autoresize"
11
+ :rows="rows"
12
+ :maxrows="maxrows"
13
+ :loading="loading"
14
+ :loading-icon="loadingIcon"
15
+ :readonly="readonly"
16
+ :ui="ui"
17
+ @update:model-value="onChange"
18
+ />
19
+ </FieldWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,21 +1,21 @@
1
1
  <template>
2
- <FieldWrapper
3
- v-bind="wrapperProps"
4
- label=""
5
- description=""
6
- >
7
- <Switch
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :name="name"
11
- :ui="ui"
12
- :label="label"
13
- :description="description"
14
- :loading="loading"
15
- :loading-icon="loadingIcon"
16
- @update:modelValue="onChange"
17
- />
18
- </FieldWrapper>
2
+ <FieldWrapper
3
+ v-bind="wrapperProps"
4
+ label=""
5
+ description=""
6
+ >
7
+ <Switch
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :name="name"
11
+ :ui="ui"
12
+ :label="label"
13
+ :description="description"
14
+ :loading="loading"
15
+ :loading-icon="loadingIcon"
16
+ @update:modelValue="onChange"
17
+ />
18
+ </FieldWrapper>
19
19
  </template>
20
20
 
21
21
  <script setup>
@@ -1,5 +1,5 @@
1
- <template>
2
- <form class="form">
3
- <slot />
4
- </form>
5
- </template>
1
+ <template>
2
+ <form class="form">
3
+ <slot />
4
+ </form>
5
+ </template>
@@ -1,32 +1,32 @@
1
1
  <template>
2
- <UseImage v-bind="$props">
3
- <template #loading>
4
- <slot name="loading">
5
- <div
6
- class="w-full h-full flex justify-center items-center"
7
- >
8
- <Loader
9
- :loading="true"
10
- />
11
- </div>
12
- </slot>
13
- </template>
14
-
15
- <template #error>
16
- <slot name="error">
17
- <div
18
- class="w-full h-full flex justify-center items-center"
19
- >
20
- <p class="text-error-400">
21
- <Icon
22
- name="i-heroicons:exclamation-circle-solid"
23
- class="text-error-400 size-8"
24
- />
25
- </p>
26
- </div>
27
- </slot>
28
- </template>
29
- </UseImage>
2
+ <UseImage v-bind="$props">
3
+ <template #loading>
4
+ <slot name="loading">
5
+ <div
6
+ class="w-full h-full flex justify-center items-center"
7
+ >
8
+ <Loader
9
+ :loading="true"
10
+ />
11
+ </div>
12
+ </slot>
13
+ </template>
14
+
15
+ <template #error>
16
+ <slot name="error">
17
+ <div
18
+ class="w-full h-full flex justify-center items-center"
19
+ >
20
+ <p class="text-error-400">
21
+ <Icon
22
+ name="i-heroicons:exclamation-circle-solid"
23
+ class="text-error-400 size-8"
24
+ />
25
+ </p>
26
+ </div>
27
+ </slot>
28
+ </template>
29
+ </UseImage>
30
30
  </template>
31
31
 
32
32
  <script setup>
@@ -1,18 +1,18 @@
1
1
  <template>
2
- <div
3
- v-if="loading"
2
+ <div
3
+ v-if="loading"
4
4
  :class="theme.base({
5
5
  class: [ui?.base, props.class]
6
- })"
7
- >
8
- <Icon
9
- :name="icon"
6
+ })"
7
+ >
8
+ <Icon
9
+ :name="icon"
10
10
  :class="[theme.icon({
11
11
  class: [ui?.icon]
12
- })]"
13
- />
14
- </div>
15
- <slot v-else />
12
+ })]"
13
+ />
14
+ </div>
15
+ <slot v-else />
16
16
  </template>
17
17
 
18
18
  <script setup>
@@ -1,21 +1,21 @@
1
1
  <template>
2
- <DevOnly>
3
- <TeleportSafe
4
- to="#dev-logs"
5
- >
6
- <LogItem
7
- v-if="typeof data !== 'undefined'"
8
- :data="data"
9
- :title="title"
10
- />
11
- <LogItem
12
- v-for="(item, index) in dataItems"
13
- :key="index"
14
- :data="item"
15
- :title="`${title} #${index + 1}`"
16
- />
17
- </TeleportSafe>
18
- </DevOnly>
2
+ <DevOnly>
3
+ <TeleportSafe
4
+ to="#dev-logs"
5
+ >
6
+ <LogItem
7
+ v-if="typeof data !== 'undefined'"
8
+ :data="data"
9
+ :title="title"
10
+ />
11
+ <LogItem
12
+ v-for="(item, index) in dataItems"
13
+ :key="index"
14
+ :data="item"
15
+ :title="`${title} #${index + 1}`"
16
+ />
17
+ </TeleportSafe>
18
+ </DevOnly>
19
19
  </template>
20
20
 
21
21
  <script setup>
@@ -1,80 +1,80 @@
1
1
  <template>
2
- <div
3
- v-if="!isHideCaption || !isHideBottomPagination"
4
- class="mb-4 text-gray-500"
5
- >
6
- <span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
7
- จำนวน
8
- <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
9
- รายการ
10
- </div>
11
- <UTable
12
- :loading="status.isLoading"
13
- :columns="uTableCompatibleColumns"
14
- :rows="rawData"
15
- v-bind="$attrs"
16
- >
17
- <template #loading-state>
18
- <div class="flex h-60 items-center justify-center">
19
- <Icon
20
- name="i-svg-spinners:180-ring-with-bg"
21
- class="text-primary size-8"
22
- />
23
- </div>
24
- </template>
25
- <template #empty-state>
26
- <Empty />
27
- </template>
28
- <template
29
- v-for="column in columns"
30
- #[`${column.accessorKey}-data`]="{ row }"
31
- :key="column.accessorKey"
32
- >
33
- <component
34
- :is="column.type === COLUMN_TYPES.COMPONENT ? column.component : column.type ? columnTypeComponents[column.type] : void 0"
35
- v-if="column.type === COLUMN_TYPES.COMPONENT || column.type && columnTypeComponents[column.type]"
36
- :value="transformValue(column, row)"
37
- :column="column"
38
- :row="row"
39
- />
40
- <ColumnText
41
- v-else
42
- :value="transformValue(column, row)"
43
- :column="column"
44
- :row="row"
45
- />
46
- </template>
47
-
48
- <template
49
- v-for="(_, slotName) in $slots"
50
- #[slotName]="scope"
51
- >
52
- <slot
53
- :name="slotName"
54
- v-bind="scope"
55
- />
56
- </template>
57
- </UTable>
58
- <div
59
- v-if="pageOptions"
60
- class="mt-4 flex justify-between px-3"
61
- >
62
- <p class="text-sm text-gray-500">
63
- ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
64
- </p>
65
- <Pagination
66
- v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
67
- v-model="page"
68
- :page-count="pageOptions.limit"
69
- :total="pageOptions.totalCount"
70
- />
71
- <SimplePagination
72
- v-if="pageOptions.totalPage > 1 && isSimplePagination"
73
- v-model="page"
74
- :page-count="pageOptions.limit"
75
- :total="pageOptions.totalCount"
76
- />
77
- </div>
2
+ <div
3
+ v-if="!isHideCaption || !isHideBottomPagination"
4
+ class="mb-4 text-gray-500"
5
+ >
6
+ <span class="font-bold">ผลลัพธ์ทั้งหมด:</span>
7
+ จำนวน
8
+ <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
9
+ รายการ
10
+ </div>
11
+ <UTable
12
+ :loading="status.isLoading"
13
+ :columns="uTableCompatibleColumns"
14
+ :rows="rawData"
15
+ v-bind="$attrs"
16
+ >
17
+ <template #loading-state>
18
+ <div class="flex h-60 items-center justify-center">
19
+ <Icon
20
+ name="i-svg-spinners:180-ring-with-bg"
21
+ class="text-primary size-8"
22
+ />
23
+ </div>
24
+ </template>
25
+ <template #empty-state>
26
+ <Empty />
27
+ </template>
28
+ <template
29
+ v-for="column in columns"
30
+ #[`${column.accessorKey}-data`]="{ row }"
31
+ :key="column.accessorKey"
32
+ >
33
+ <component
34
+ :is="column.type === COLUMN_TYPES.COMPONENT ? column.component : column.type ? columnTypeComponents[column.type] : void 0"
35
+ v-if="column.type === COLUMN_TYPES.COMPONENT || column.type && columnTypeComponents[column.type]"
36
+ :value="transformValue(column, row)"
37
+ :column="column"
38
+ :row="row"
39
+ />
40
+ <ColumnText
41
+ v-else
42
+ :value="transformValue(column, row)"
43
+ :column="column"
44
+ :row="row"
45
+ />
46
+ </template>
47
+
48
+ <template
49
+ v-for="(_, slotName) in $slots"
50
+ #[slotName]="scope"
51
+ >
52
+ <slot
53
+ :name="slotName"
54
+ v-bind="scope"
55
+ />
56
+ </template>
57
+ </UTable>
58
+ <div
59
+ v-if="pageOptions"
60
+ class="mt-4 flex justify-between px-3"
61
+ >
62
+ <p class="text-sm text-gray-500">
63
+ ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
64
+ </p>
65
+ <Pagination
66
+ v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
67
+ v-model="page"
68
+ :page-count="pageOptions.limit"
69
+ :total="pageOptions.totalCount"
70
+ />
71
+ <SimplePagination
72
+ v-if="pageOptions.totalPage > 1 && isSimplePagination"
73
+ v-model="page"
74
+ :page-count="pageOptions.limit"
75
+ :total="pageOptions.totalCount"
76
+ />
77
+ </div>
78
78
  </template>
79
79
 
80
80
  <script setup>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- {{ getValue || "-" }}
2
+ {{ getValue || "-" }}
3
3
  </template>
4
4
 
5
5
  <script setup>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- {{ getValue || "-" }}
2
+ {{ getValue || "-" }}
3
3
  </template>
4
4
 
5
5
  <script setup>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <Image
3
- class="h-12 rounded"
4
- :src="getValue"
5
- />
2
+ <Image
3
+ class="h-12 rounded"
4
+ :src="getValue"
5
+ />
6
6
  </template>
7
7
 
8
8
  <script setup>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- {{ getValue }}
2
+ {{ getValue }}
3
3
  </template>
4
4
 
5
5
  <script setup>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- {{ getValue }}
2
+ {{ getValue }}
3
3
  </template>
4
4
 
5
5
  <script setup>
@@ -1,25 +1,25 @@
1
1
  <template>
2
- <Base
3
- v-bind="$attrs"
4
- :columns="options.columns"
5
- :raw-data="itemsByPage"
6
- :status="options.status"
7
- :page-options="pageOptions"
8
- :is-simple-pagination="isShowSimplePagination"
9
- :is-hide-bottom-pagination="options.isHideBottomPagination"
10
- :is-hide-caption="options.isHideCaption"
11
- @page-change="onPageChange"
12
- >
13
- <template
14
- v-for="(_, slot) of $slots"
15
- #[slot]="slotProps"
16
- >
17
- <slot
18
- :name="slot"
19
- v-bind="slotProps || {}"
20
- />
21
- </template>
22
- </Base>
2
+ <Base
3
+ v-bind="$attrs"
4
+ :columns="options.columns"
5
+ :raw-data="itemsByPage"
6
+ :status="options.status"
7
+ :page-options="pageOptions"
8
+ :is-simple-pagination="isShowSimplePagination"
9
+ :is-hide-bottom-pagination="options.isHideBottomPagination"
10
+ :is-hide-caption="options.isHideCaption"
11
+ @page-change="onPageChange"
12
+ >
13
+ <template
14
+ v-for="(_, slot) of $slots"
15
+ #[slot]="slotProps"
16
+ >
17
+ <slot
18
+ :name="slot"
19
+ v-bind="slotProps || {}"
20
+ />
21
+ </template>
22
+ </Base>
23
23
  </template>
24
24
 
25
25
  <script setup>