@finema/core 1.4.87 → 1.4.89

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.
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.87",
3
+ "version": "1.4.89",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
2
 
3
3
  const name = "@finema/core";
4
- const version = "1.4.87";
4
+ const version = "1.4.89";
5
5
 
6
6
  const colors = {
7
7
  black: "#20243E",
@@ -1,5 +1,17 @@
1
1
  <template>
2
- <!-- TODO -->
2
+ <slot v-if="status.isLoading" name="loading-state">
3
+ <div class="flex h-60 items-center justify-center">
4
+ <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
5
+ </div>
6
+ </slot>
7
+ <slot v-if="!status.isLoading && rawData.length === 0" name="empty-state">
8
+ <div class="min-h-60">
9
+ <p class="text-center text-sm italic">ไม่พบข้อมูล!</p>
10
+ </div>
11
+ </slot>
12
+ <div v-if="status.isSuccess" :class="containerClass">
13
+ <slot v-for="(row, index) in rawData" :key="index" :row="row" />
14
+ </div>
3
15
  <div v-if="pageOptions" class="mt-4 flex justify-between px-3">
4
16
  <p class="text-xs text-gray-500">
5
17
  ผลลัพธ์ {{ pageBetween }} ของ {{ totalCountWithComma }} รายการ
@@ -48,6 +60,7 @@ const props = defineProps({
48
60
  type: Boolean as PropType<IFlexDeckOptions['isHideBottomPagination']>,
49
61
  default: false,
50
62
  },
63
+ containerClass: { type: [String, Array, Object] },
51
64
  })
52
65
 
53
66
  const page = ref(props.pageOptions?.currentPage || 1)
@@ -8,12 +8,12 @@
8
8
  />
9
9
  </div>
10
10
  <Base
11
- v-bind="$attrs"
12
11
  :raw-data="options.rawData"
13
12
  :status="options.status"
14
13
  :page-options="options.pageOptions"
15
14
  :is-simple-pagination="isShowSimplePagination"
16
15
  :is-hide-bottom-pagination="options.isHideBottomPagination"
16
+ :container-class="containerClass"
17
17
  @page-change="onPageChange"
18
18
  >
19
19
  <template v-for="(_, slot) of $slots" #[slot]="slotProps">
@@ -29,6 +29,12 @@ import { useCoreConfig } from '#core/composables/useConfig'
29
29
  import Base from '#core/components/FlexDeck/Base.vue'
30
30
  import type { IFlexDeckOptions } from '#core/components/FlexDeck/types'
31
31
 
32
+ defineSlots<{
33
+ default: (props: { row: any }) => any
34
+ 'empty-state': () => any
35
+ 'loading-state': () => any
36
+ }>()
37
+
32
38
  const emits = defineEmits<{
33
39
  (event: 'pageChange', page: number): void
34
40
  (event: 'search', q: string): void
@@ -36,6 +42,7 @@ const emits = defineEmits<{
36
42
 
37
43
  const props = defineProps({
38
44
  options: { type: Object as PropType<IFlexDeckOptions>, required: true },
45
+ containerClass: { type: [String, Array, Object], default: '' },
39
46
  })
40
47
 
41
48
  const coreConfig = useCoreConfig()
@@ -2,7 +2,7 @@
2
2
  <UTable :loading="status.isLoading" :columns="columns" :rows="rawData" v-bind="$attrs">
3
3
  <template #loading-state>
4
4
  <div class="flex h-60 items-center justify-center">
5
- <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary h-8 w-8" />
5
+ <Icon name="i-svg-spinners:180-ring-with-bg" class="text-primary size-8" />
6
6
  </div>
7
7
  </template>
8
8
  <template #empty-state>
@@ -21,6 +21,11 @@ import Base from '#core/components/Table/Base.vue'
21
21
  import { initPageOptions } from '#core/composables/loaderPage'
22
22
  import { useCoreConfig } from '#core/composables/useConfig'
23
23
 
24
+ defineSlots<{
25
+ 'empty-state': () => any
26
+ 'loading-state': () => any
27
+ }>()
28
+
24
29
  const props = defineProps({
25
30
  options: { type: Object as PropType<ISimpleTableOptions>, required: true },
26
31
  })
@@ -30,6 +30,11 @@ import { _debounce, computed, ref, watch } from '#imports'
30
30
  import { useCoreConfig } from '#core/composables/useConfig'
31
31
  import Base from '#core/components/Table/Base.vue'
32
32
 
33
+ defineSlots<{
34
+ 'empty-state': () => any
35
+ 'loading-state': () => any
36
+ }>()
37
+
33
38
  const emits = defineEmits<{
34
39
  (event: 'pageChange', page: number): void
35
40
  (event: 'search', q: string): void
@@ -1,4 +1,10 @@
1
1
  import type { ComputedRef } from 'vue';
2
+ import type { IUsePageLoader } from '#core/helpers/apiPageHelper';
2
3
  import type { IFlexDeckOptions } from '#core/components/FlexDeck/types';
4
+ import type { Store } from 'pinia';
5
+ export interface IUseFlexDeck<T = object> {
6
+ repo: IUsePageLoader<T> | Store<any, any>;
7
+ options?: (() => Partial<IFlexDeckOptions<T>>) | Partial<IFlexDeckOptions<T>>;
8
+ }
3
9
  export declare const createFlexDeckOptions: <T = object>(repo: IUsePageLoader<T>, options: IFlexDeckOptions<T>) => IFlexDeckOptions<T>;
4
- export declare const useFlexDeck: <T = object>(options: IUseTable<T>) => ComputedRef<IFlexDeckOptions<T>>;
10
+ export declare const useFlexDeck: <T = object>(options: IUseFlexDeck<T>) => ComputedRef<IFlexDeckOptions<T>>;
@@ -1,32 +1 @@
1
- :root {
2
- --dp-font-family: inherit !important;
3
- }
4
-
5
- .dp__theme_light {
6
- --dp-primary-color: rgb(var(--color-primary-DEFAULT)) !important;
7
- --dp-primary-disabled-color: rgb(var(--color-primary-200)) !important;
8
- }
9
-
10
- ::-webkit-scrollbar {
11
- -webkit-appearance: none;
12
- width: 10px;
13
- height: 10px;
14
- }
15
-
16
- ::-webkit-scrollbar-thumb {
17
- border-radius: 4px;
18
- background-color: rgb(0 0 0 / 30%);
19
- box-shadow: 0 0 1px rgb(255 255 255 / 50%);
20
- }
21
-
22
-
23
- html,
24
- body,
25
- #__nuxt,
26
- #__layout,
27
- .root-container {
28
- height: 100%;
29
- display: flex;
30
- flex-direction: column;
31
- }
32
-
1
+ :root{--dp-font-family:inherit!important}.dp__theme_light{--dp-primary-color:rgb(var(--color-primary-DEFAULT))!important;--dp-primary-disabled-color:rgb(var(--color-primary-200))!important}::-webkit-scrollbar{-webkit-appearance:none;height:10px;width:10px}::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3);border-radius:4px;box-shadow:0 0 1px hsla(0,0%,100%,.5)}#__layout,#__nuxt,.root-container,body,html{display:flex;flex-direction:column;height:100%}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.87",
3
+ "version": "1.4.89",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -80,5 +80,9 @@
80
80
  "lint-staged": {
81
81
  "*.{ts,vue,tsx,js}": "eslint --fix --cache",
82
82
  "*.{html,json}": "prettier --write"
83
- }
83
+ },
84
+ "workspaces": [
85
+ "./*"
86
+ ],
87
+ "packageManager": "yarn@4.1.1"
84
88
  }