@finema/core 1.4.213 → 1.4.215

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.213",
3
+ "version": "1.4.215",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import { defu } from 'defu';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.4.213";
5
+ const version = "1.4.215";
6
6
 
7
7
  const colorModeOptions = {
8
8
  preference: "light"
@@ -43,7 +43,7 @@ import { type ISelectFieldProps } from '#core/components/Form/InputSelect/types'
43
43
  const emits = defineEmits(['change'])
44
44
  const props = withDefaults(defineProps<ISelectFieldProps>(), {
45
45
  searchablePlaceholder: 'ค้นหา...',
46
- searchable: () => true,
46
+ searchable: true,
47
47
  })
48
48
 
49
49
  const { value, wrapperProps, handleChange } = useFieldHOC<any>(props)
@@ -10,7 +10,7 @@ export interface ISelectFieldProps extends IFieldProps {
10
10
  loading?: boolean;
11
11
  uiMenu?: object | any;
12
12
  options: IOption[];
13
- searchable?: (q: string) => IOption[] | boolean;
13
+ searchable?: ((q: string) => PromiseLike<IOption[]>) | boolean;
14
14
  }
15
15
  export type ISelectField = IFormFieldBase<INPUT_TYPES.SELECT, ISelectFieldProps, {
16
16
  change?: (value: string) => void;
@@ -91,6 +91,13 @@
91
91
  </p>
92
92
  </div>
93
93
  <div :class="[ui.action.wrapper]">
94
+ <a v-if="isPDFFromPath(value.path)" :href="value.url" target="_blank">
95
+ <Icon
96
+ :name="ui.action.previewIcon"
97
+ :class="[ui.action.iconClass]"
98
+ title="ดูตัวอย่าง"
99
+ />
100
+ </a>
94
101
  <Icon
95
102
  v-if="isImageFromPath(value.path)"
96
103
  :name="ui.action.previewIcon"
@@ -172,6 +179,7 @@ import {
172
179
  useFileProgress,
173
180
  isImageFromPath,
174
181
  useFileSize,
182
+ isPDFFromPath,
175
183
  } from '#core/helpers/componentHelper'
176
184
  import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
177
185
  import { useFieldHOC } from '#core/composables/useForm'
@@ -37,6 +37,9 @@
37
37
  title="ดูตัวอย่าง"
38
38
  @click="() => (isPreviewOpen = true)"
39
39
  />
40
+ <a v-if="isPDFFromPath(selectedFile.path)" :href="selectedFile.url" target="_blank">
41
+ <Icon :name="ui.action.previewIcon" :class="[ui.action.iconClass]" title="ดูตัวอย่าง" />
42
+ </a>
40
43
  <Icon
41
44
  :name="ui.action.downloadIcon"
42
45
  :class="[ui.action.iconClass]"
@@ -62,7 +65,12 @@
62
65
  </div>
63
66
  </template>
64
67
  <script lang="ts" setup>
65
- import { downloadFileFromURL, isImageFromPath, useFileSize } from '#core/helpers/componentHelper'
68
+ import {
69
+ downloadFileFromURL,
70
+ isImageFromPath,
71
+ isPDFFromPath,
72
+ useFileSize,
73
+ } from '#core/helpers/componentHelper'
66
74
  import { type uploadFileDropzone } from '#core/ui.config'
67
75
  import type { IUploadDropzoneAutoMultipleProps } from '#core/components/Form/InputUploadDropzoneAutoMultiple/types'
68
76
  import { ref, StringHelper } from '#imports'
@@ -4,6 +4,7 @@ export declare const checkFileType: (file: File, acceptFileType: string | string
4
4
  export declare const generateURL: (file: File) => string;
5
5
  export declare const isImage: (file: File) => boolean;
6
6
  export declare const isImageFromPath: (path?: string) => boolean;
7
+ export declare const isPDFFromPath: (path?: string) => boolean;
7
8
  export declare const useFileAllocate: (selectedFile: Ref<File | undefined | null>, props: {
8
9
  accept?: string | string[];
9
10
  maxSize?: number;
@@ -41,6 +41,11 @@ export const isImageFromPath = (path = "") => {
41
41
  const extension = path.toLowerCase().substring(path.lastIndexOf("."));
42
42
  return imageExtensions.includes(extension);
43
43
  };
44
+ export const isPDFFromPath = (path = "") => {
45
+ const imageExtensions = [".pdf"];
46
+ const extension = path.toLowerCase().substring(path.lastIndexOf("."));
47
+ return imageExtensions.includes(extension);
48
+ };
44
49
  export const useFileAllocate = (selectedFile, props) => {
45
50
  const selectedFileSizeKb = computed(() => ((selectedFile.value?.size || 0) / 1e3).toFixed(2));
46
51
  const selectedFileSizeMb = computed(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.213",
3
+ "version": "1.4.215",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",