@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,71 +1,71 @@
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
- <slot
12
- v-if="!status.isLoading && rawData.length === 0"
13
- name="empty-state"
14
- >
15
- <Empty />
16
- </slot>
17
-
18
- <div
19
- v-if="pageOptions && isEnableInfiniteScroll && !isHideTopPagination"
20
- class="mb-4 flex items-center justify-end"
21
- >
22
- <p class="text-xs text-gray-500">
23
- ผลลัพธ์ {{ totalInnerRawData }} ของ {{ totalCountWithComma }} รายการ
24
- </p>
25
- </div>
26
-
27
- <div :class="containerClass">
28
- <slot
29
- v-for="(row, index) in innerRawData"
30
- :key="index"
31
- :row="row"
32
- />
33
- <div ref="bottomEdgeElement" />
34
- </div>
35
-
36
- <slot
37
- v-if="status.isLoading"
38
- name="loading-state"
39
- >
40
- <div class="flex h-60 items-center justify-center">
41
- <Icon
42
- name="i-svg-spinners:180-ring-with-bg"
43
- class="text-primary size-8"
44
- />
45
- </div>
46
- </slot>
47
-
48
- <div
49
- v-if="pageOptions && !isEnableInfiniteScroll"
50
- class="mt-4 flex justify-between px-3"
51
- >
52
- <p class="text-xs text-gray-500">
53
- ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
54
- </p>
55
- <Pagination
56
- v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
57
- :default-page="pageOptions?.currentPage || 1"
58
- :items-per-page="pageOptions.limit"
59
- :total="pageOptions.totalCount"
60
- @update:page="emits('pageChange', $event)"
61
- />
62
- <SimplePagination
63
- v-if="pageOptions.totalPage > 1 && isSimplePagination"
64
- v-model="page"
65
- :page-count="pageOptions.limit"
66
- :total="pageOptions.totalCount"
67
- />
68
- </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
+ <slot
12
+ v-if="!status.isLoading && rawData.length === 0"
13
+ name="empty-state"
14
+ >
15
+ <Empty />
16
+ </slot>
17
+
18
+ <div
19
+ v-if="pageOptions && isEnableInfiniteScroll && !isHideTopPagination"
20
+ class="mb-4 flex items-center justify-end"
21
+ >
22
+ <p class="text-xs text-gray-500">
23
+ ผลลัพธ์ {{ totalInnerRawData }} ของ {{ totalCountWithComma }} รายการ
24
+ </p>
25
+ </div>
26
+
27
+ <div :class="containerClass">
28
+ <slot
29
+ v-for="(row, index) in innerRawData"
30
+ :key="index"
31
+ :row="row"
32
+ />
33
+ <div ref="bottomEdgeElement" />
34
+ </div>
35
+
36
+ <slot
37
+ v-if="status.isLoading"
38
+ name="loading-state"
39
+ >
40
+ <div class="flex h-60 items-center justify-center">
41
+ <Icon
42
+ name="i-svg-spinners:180-ring-with-bg"
43
+ class="text-primary size-8"
44
+ />
45
+ </div>
46
+ </slot>
47
+
48
+ <div
49
+ v-if="pageOptions && !isEnableInfiniteScroll"
50
+ class="mt-4 flex justify-between px-3"
51
+ >
52
+ <p class="text-xs text-gray-500">
53
+ ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
54
+ </p>
55
+ <Pagination
56
+ v-if="pageOptions.totalPage > 1 && !isSimplePagination && !isHideBottomPagination"
57
+ :default-page="pageOptions?.currentPage || 1"
58
+ :items-per-page="pageOptions.limit"
59
+ :total="pageOptions.totalCount"
60
+ @update:page="emits('pageChange', $event)"
61
+ />
62
+ <SimplePagination
63
+ v-if="pageOptions.totalPage > 1 && isSimplePagination"
64
+ v-model="page"
65
+ :page-count="pageOptions.limit"
66
+ :total="pageOptions.totalCount"
67
+ />
68
+ </div>
69
69
  </template>
70
70
 
71
71
  <script setup>
@@ -1,37 +1,37 @@
1
1
  <template>
2
- <div>
3
- <div
4
- v-if="options.isEnabledSearch"
5
- class="mb-4 flex justify-end"
6
- >
7
- <Input
8
- v-model="q"
9
- icon="i-heroicons-magnifying-glass"
10
- :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32...'"
11
- />
12
- </div>
13
- <Base
14
- :raw-data="options.rawData"
15
- :status="options.status"
16
- :page-options="options.pageOptions"
17
- :is-simple-pagination="isShowSimplePagination"
18
- :is-hide-top-pagination="options.isHideTopPagination"
19
- :is-hide-bottom-pagination="options.isHideBottomPagination"
20
- :is-enable-infinite-scroll="options.isEnableInfiniteScroll"
21
- :container-class="containerClass"
22
- @page-change="onPageChange"
23
- >
24
- <template
25
- v-for="(_, slot) of $slots"
26
- #[slot]="slotProps"
27
- >
28
- <slot
29
- :name="slot"
30
- v-bind="slotProps || {}"
31
- />
32
- </template>
33
- </Base>
34
- </div>
2
+ <div>
3
+ <div
4
+ v-if="options.isEnabledSearch"
5
+ class="mb-4 flex justify-end"
6
+ >
7
+ <Input
8
+ v-model="q"
9
+ icon="i-heroicons-magnifying-glass"
10
+ :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32...'"
11
+ />
12
+ </div>
13
+ <Base
14
+ :raw-data="options.rawData"
15
+ :status="options.status"
16
+ :page-options="options.pageOptions"
17
+ :is-simple-pagination="isShowSimplePagination"
18
+ :is-hide-top-pagination="options.isHideTopPagination"
19
+ :is-hide-bottom-pagination="options.isHideBottomPagination"
20
+ :is-enable-infinite-scroll="options.isEnableInfiniteScroll"
21
+ :container-class="containerClass"
22
+ @page-change="onPageChange"
23
+ >
24
+ <template
25
+ v-for="(_, slot) of $slots"
26
+ #[slot]="slotProps"
27
+ >
28
+ <slot
29
+ :name="slot"
30
+ v-bind="slotProps || {}"
31
+ />
32
+ </template>
33
+ </Base>
34
+ </div>
35
35
  </template>
36
36
 
37
37
  <script setup>
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <FormField
3
- :label="label"
4
- :name="name"
5
- :description="description"
6
- :hint="hint"
7
- :data-testid="name"
8
- :help="help"
9
- :error="errorMessage"
10
- :required="!!required"
11
- :ui="containerUi"
12
- >
13
- <slot />
14
- </FormField>
2
+ <FormField
3
+ :label="label"
4
+ :name="name"
5
+ :description="description"
6
+ :hint="hint"
7
+ :data-testid="name"
8
+ :help="help"
9
+ :error="errorMessage"
10
+ :required="!!required"
11
+ :ui="containerUi"
12
+ >
13
+ <slot />
14
+ </FormField>
15
15
  </template>
16
16
 
17
17
  <script setup>
@@ -1,19 +1,19 @@
1
1
  <template>
2
- <div
2
+ <div
3
3
  :class="[theme.base({
4
4
  class: [$props.class, ui?.base]
5
- })]"
6
- >
7
- <component
8
- :is="componentMap[option.type] || option.component"
9
- v-for="option in options.filter((item) => !item.isHide)"
10
- :key="option.props.name"
11
- :class="option.class"
12
- :form="form"
13
- v-bind="getFieldBinding(option)"
14
- v-on="option.on ?? {}"
15
- />
16
- </div>
5
+ })]"
6
+ >
7
+ <component
8
+ :is="componentMap[option.type] || option.component"
9
+ v-for="option in options.filter((item) => !item.isHide)"
10
+ :key="option.props.name"
11
+ :class="option.class"
12
+ :form="form"
13
+ v-bind="getFieldBinding(option)"
14
+ v-on="option.on ?? {}"
15
+ />
16
+ </div>
17
17
  </template>
18
18
 
19
19
  <script setup>
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <FieldWrapper
3
- v-bind="wrapperProps"
4
- label=""
5
- description=""
6
- >
7
- <Checkbox
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :name="name"
11
- :label="label"
12
- :description="description"
13
- :required="required"
14
- :variant="variant"
15
- :indicator="indicator"
16
- :ui="ui"
17
- @update:modelValue="onChange"
18
- />
19
- </FieldWrapper>
2
+ <FieldWrapper
3
+ v-bind="wrapperProps"
4
+ label=""
5
+ description=""
6
+ >
7
+ <Checkbox
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :name="name"
11
+ :label="label"
12
+ :description="description"
13
+ :required="required"
14
+ :variant="variant"
15
+ :indicator="indicator"
16
+ :ui="ui"
17
+ @update:modelValue="onChange"
18
+ />
19
+ </FieldWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,51 +1,51 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Datepicker
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- cancel-text="ยกเลิก"
7
- select-text="เลือก"
8
- locale="th"
9
- :enable-time-picker="!disabledTime"
10
- :placeholder="wrapperProps.placeholder"
11
- :format="format"
12
- :min-date="minDate"
13
- :max-date="maxDate"
14
- :min-time="minTime"
15
- :max-time="maxTime"
16
- :start-time="startTime"
17
- :required="required"
18
- :flow="['calendar', 'time']"
19
- @update:model-value="onInput"
20
- >
21
- <template
22
- v-if="appConfig.core?.is_thai_year"
23
- #year="{ value }"
24
- >
25
- {{ value + 543 }}
26
- </template>
27
- <template
28
- v-if="appConfig.core?.is_thai_year"
29
- #year-overlay-value="{ value }"
30
- >
31
- {{ value + 543 }}
32
- </template>
33
- <template #dp-input="{ value: innerValue }">
34
- <Input
35
- :trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
36
- type="text"
37
- :disabled="wrapperProps.disabled"
38
- :model-value="innerValue"
39
- :placeholder="wrapperProps.placeholder"
40
- :readonly="true"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Datepicker
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ cancel-text="ยกเลิก"
7
+ select-text="เลือก"
8
+ locale="th"
9
+ :enable-time-picker="!disabledTime"
10
+ :placeholder="wrapperProps.placeholder"
11
+ :format="format"
12
+ :min-date="minDate"
13
+ :max-date="maxDate"
14
+ :min-time="minTime"
15
+ :max-time="maxTime"
16
+ :start-time="startTime"
17
+ :required="required"
18
+ :flow="['calendar', 'time']"
19
+ @update:model-value="onInput"
20
+ >
21
+ <template
22
+ v-if="appConfig.core?.is_thai_year"
23
+ #year="{ value }"
24
+ >
25
+ {{ value + 543 }}
26
+ </template>
27
+ <template
28
+ v-if="appConfig.core?.is_thai_year"
29
+ #year-overlay-value="{ value }"
30
+ >
31
+ {{ value + 543 }}
32
+ </template>
33
+ <template #dp-input="{ value: innerValue }">
34
+ <Input
35
+ :trailing-icon="innerValue ? void 0 : 'i-heroicons-calendar-days'"
36
+ type="text"
37
+ :disabled="wrapperProps.disabled"
38
+ :model-value="innerValue"
39
+ :placeholder="wrapperProps.placeholder"
40
+ :readonly="true"
41
41
  :ui="{
42
42
  base: 'cursor-pointer select-none',
43
43
  trailingIcon: 'cursor-pointer'
44
- }"
45
- />
46
- </template>
47
- </Datepicker>
48
- </FieldWrapper>
44
+ }"
45
+ />
46
+ </template>
47
+ </Datepicker>
48
+ </FieldWrapper>
49
49
  </template>
50
50
 
51
51
  <script setup>
@@ -1,24 +1,24 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <InputNumber
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :name="name"
7
- :placeholder="wrapperProps.placeholder"
8
- :autofocus="!!autoFocus"
9
- :readonly="readonly"
10
- :orientation="orientation"
11
- :increment-disabled="incrementDisabled"
12
- :decrement-disabled="decrementDisabled"
13
- :min="min"
14
- :max="max"
15
- :step="step"
16
- :disable-wheel-change="disableWheelChange"
17
- :format-options="formatOptions"
18
- :ui="ui"
19
- @update:model-value="onChange"
20
- />
21
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <InputNumber
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ :name="name"
7
+ :placeholder="wrapperProps.placeholder"
8
+ :autofocus="!!autoFocus"
9
+ :readonly="readonly"
10
+ :orientation="orientation"
11
+ :increment-disabled="incrementDisabled"
12
+ :decrement-disabled="decrementDisabled"
13
+ :min="min"
14
+ :max="max"
15
+ :step="step"
16
+ :disable-wheel-change="disableWheelChange"
17
+ :format-options="formatOptions"
18
+ :ui="ui"
19
+ @update:model-value="onChange"
20
+ />
21
+ </FieldWrapper>
22
22
  </template>
23
23
 
24
24
  <script setup>
@@ -1,48 +1,48 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <SelectMenu
4
- :model-value="value"
5
- :items="options"
6
- :placeholder="wrapperProps.placeholder"
7
- :disabled="wrapperProps.disabled"
8
- :loading="loading"
9
- :search-input="searchInput"
10
- :selected-icon="selectedIcon"
11
- value-key="value"
12
- label-key="label"
13
- :icon="icon"
14
- :ui="ui"
15
- :leading-icon="options.find((item) => item.value === value)?.icon"
16
- :avatar="options.find((item) => item.value === value)?.avatar"
17
- @update:modelValue="onChange"
18
- @update:searchTerm="onSearch"
19
- >
20
- <template #default="{ modelValue }">
21
- <div
22
- v-if="value"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <SelectMenu
4
+ :model-value="value"
5
+ :items="options"
6
+ :placeholder="wrapperProps.placeholder"
7
+ :disabled="wrapperProps.disabled"
8
+ :loading="loading"
9
+ :search-input="searchInput"
10
+ :selected-icon="selectedIcon"
11
+ value-key="value"
12
+ label-key="label"
13
+ :icon="icon"
14
+ :ui="ui"
15
+ :leading-icon="options.find((item) => item.value === value)?.icon"
16
+ :avatar="options.find((item) => item.value === value)?.avatar"
17
+ @update:modelValue="onChange"
18
+ @update:searchTerm="onSearch"
19
+ >
20
+ <template #default="{ modelValue }">
21
+ <div
22
+ v-if="value"
23
23
  :class="theme.selectedWrapper({
24
24
  class: [ui?.selectedWrapper]
25
- })"
26
- >
27
- <span
25
+ })"
26
+ >
27
+ <span
28
28
  :class="theme.selectedLabel({
29
29
  class: [ui?.selectedLabel]
30
- })"
31
- >
32
- {{ options.find((item) => item.value === modelValue)?.label || modelValue }}
33
- </span>
34
- <Icon
35
- v-if="clearable"
36
- :name="clearIcon"
30
+ })"
31
+ >
32
+ {{ options.find((item) => item.value === modelValue)?.label || modelValue }}
33
+ </span>
34
+ <Icon
35
+ v-if="clearable"
36
+ :name="clearIcon"
37
37
  :class="theme.clearIcon({
38
38
  class: [ui?.clearIcon]
39
- })"
40
- @click.stop="onChange(void 0)"
41
- />
42
- </div>
43
- </template>
44
- </SelectMenu>
45
- </FieldWrapper>
39
+ })"
40
+ @click.stop="onChange(void 0)"
41
+ />
42
+ </div>
43
+ </template>
44
+ </SelectMenu>
45
+ </FieldWrapper>
46
46
  </template>
47
47
 
48
48
  <script setup>
@@ -1,57 +1,57 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <SelectMenu
4
- :model-value="value"
5
- :items="options"
6
- multiple
7
- :placeholder="wrapperProps.placeholder"
8
- :disabled="wrapperProps.disabled"
9
- :loading="loading"
10
- :search-input="searchInput"
11
- :selected-icon="selectedIcon"
12
- value-key="value"
13
- label-key="label"
14
- :icon="icon"
15
- :ui="ui"
16
- :ignore-filter="!!$attrs.onSearch"
17
- @update:model-value="onChange"
18
- @update:searchTerm="onSearch"
19
- >
20
- <template #default="{ modelValue }">
21
- <div
22
- v-if="!ArrayHelper.isEmpty(value)"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <SelectMenu
4
+ :model-value="value"
5
+ :items="options"
6
+ multiple
7
+ :placeholder="wrapperProps.placeholder"
8
+ :disabled="wrapperProps.disabled"
9
+ :loading="loading"
10
+ :search-input="searchInput"
11
+ :selected-icon="selectedIcon"
12
+ value-key="value"
13
+ label-key="label"
14
+ :icon="icon"
15
+ :ui="ui"
16
+ :ignore-filter="!!$attrs.onSearch"
17
+ @update:model-value="onChange"
18
+ @update:searchTerm="onSearch"
19
+ >
20
+ <template #default="{ modelValue }">
21
+ <div
22
+ v-if="!ArrayHelper.isEmpty(value)"
23
23
  :class="theme.tagsWrapper({
24
24
  class: [ui?.tagsWrapper]
25
- })"
26
- >
27
- <div
28
- v-for="_value in ArrayHelper.toArray(modelValue)"
29
- :key="_value"
25
+ })"
26
+ >
27
+ <div
28
+ v-for="_value in ArrayHelper.toArray(modelValue)"
29
+ :key="_value"
30
30
  :class="theme.tagsItem({
31
31
  class: [ui?.tagsItem]
32
- })"
33
- >
34
- <div
32
+ })"
33
+ >
34
+ <div
35
35
  :class="theme.tagsItemText({
36
36
  class: [ui?.tagsItemText]
37
- })"
38
- >
39
- {{ options.find((item) => item.value === _value)?.label || _value }}
40
- <Icon
37
+ })"
38
+ >
39
+ {{ options.find((item) => item.value === _value)?.label || _value }}
40
+ <Icon
41
41
  :name="theme.tagsItemDeleteIcon({
42
42
  class: [ui?.tagsItemDeleteIcon]
43
- })"
43
+ })"
44
44
  :class="theme.tagsItemDelete({
45
45
  class: [ui?.tagsItemDelete]
46
- })"
47
- @click.stop="handleDelete(_value)"
48
- />
49
- </div>
50
- </div>
51
- </div>
52
- </template>
53
- </SelectMenu>
54
- </FieldWrapper>
46
+ })"
47
+ @click.stop="handleDelete(_value)"
48
+ />
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+ </SelectMenu>
54
+ </FieldWrapper>
55
55
  </template>
56
56
 
57
57
  <script setup>