@finema/core 1.4.217 → 1.4.219

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.217",
3
+ "version": "1.4.219",
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.217";
5
+ const version = "1.4.219";
6
6
 
7
7
  const colorModeOptions = {
8
8
  preference: "light"
@@ -29,6 +29,7 @@
29
29
  v-if="dialog.meta?.isShowCancelBtn"
30
30
  :color="uiConfig.actionGroup?.cancelColor"
31
31
  :variant="uiConfig.actionGroup?.cancelVariant"
32
+ :class="[dialog.meta.cancelButtonClassName]"
32
33
  type="button"
33
34
  @click="dialog.closeDialogCancel"
34
35
  >
@@ -45,6 +46,7 @@
45
46
  'btn-warning': dialog.meta?.type === DialogType.WARNING,
46
47
  'mr-3': dialog.meta.isShowCancelBtn,
47
48
  },
49
+ dialog.meta.confirmButtonClassName,
48
50
  ]"
49
51
  @click="dialog.closeDialogProceed"
50
52
  >
@@ -99,7 +99,7 @@
99
99
  />
100
100
  </a>
101
101
  <Icon
102
- v-if="isImageFromPath(value.path)"
102
+ v-if="isImageFromPath(value.path) || isVideoFromPath(value.path)"
103
103
  :name="ui.action.previewIcon"
104
104
  :class="[ui.action.iconClass]"
105
105
  title="ดูตัวอย่าง"
@@ -119,7 +119,18 @@
119
119
  @click="handleDeleteFile"
120
120
  />
121
121
  <Modal v-model="isPreviewOpen" :title="value.name">
122
- <img :src="value.url" alt="img-preview" />
122
+ <img
123
+ v-if="isImageFromPath(value.path)"
124
+ :src="value.url"
125
+ alt="img-preview"
126
+ class="mx-auto max-w-full rounded-lg"
127
+ />
128
+ <video
129
+ v-else-if="isVideoFromPath(value.path)"
130
+ :src="value.url"
131
+ controls
132
+ class="mx-auto max-w-full"
133
+ />
123
134
  </Modal>
124
135
  </div>
125
136
  </div>
@@ -180,6 +191,7 @@ import {
180
191
  isImageFromPath,
181
192
  useFileSize,
182
193
  isPDFFromPath,
194
+ isVideoFromPath,
183
195
  } from '#core/helpers/componentHelper'
184
196
  import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
185
197
  import { useFieldHOC } from '#core/composables/useForm'
@@ -31,7 +31,7 @@
31
31
  </div>
32
32
  <div :class="[ui.action.wrapper]">
33
33
  <Icon
34
- v-if="isImageFromPath(selectedFile.path)"
34
+ v-if="isImageFromPath(selectedFile.path) || isVideoFromPath(selectedFile.path)"
35
35
  :name="ui.action.previewIcon"
36
36
  :class="[ui.action.iconClass]"
37
37
  title="ดูตัวอย่าง"
@@ -59,10 +59,17 @@
59
59
  />
60
60
  <Modal v-model="isPreviewOpen" :title="selectedFile?.name">
61
61
  <img
62
+ v-if="isImageFromPath(selectedFile.path)"
62
63
  :src="selectedFile.url"
63
64
  alt="image-preview"
64
65
  class="mx-auto max-w-full rounded-lg"
65
66
  />
67
+ <video
68
+ v-else-if="isVideoFromPath(selectedFile.path)"
69
+ :src="selectedFile.url"
70
+ controls
71
+ class="mx-auto max-w-full"
72
+ />
66
73
  </Modal>
67
74
  </div>
68
75
  </div>
@@ -74,6 +81,7 @@ import {
74
81
  downloadFileFromURL,
75
82
  isImageFromPath,
76
83
  isPDFFromPath,
84
+ isVideoFromPath,
77
85
  useFileSize,
78
86
  } from '#core/helpers/componentHelper'
79
87
  import { type uploadFileDropzone } from '#core/ui.config'
@@ -12,6 +12,8 @@ export interface IDialogMetaItem {
12
12
  cancelText?: string;
13
13
  isShowCancelBtn?: boolean;
14
14
  isHideIcon?: boolean;
15
+ confirmButtonClassName?: string;
16
+ cancelButtonClassName?: string;
15
17
  }
16
18
  export interface IDialog {
17
19
  isShow: boolean;
@@ -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 isVideoFromPath: (path?: string) => boolean;
7
8
  export declare const isPDFFromPath: (path?: string) => boolean;
8
9
  export declare const useFileAllocate: (selectedFile: Ref<File | undefined | null>, props: {
9
10
  accept?: string | string[];
@@ -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 isVideoFromPath = (path = "") => {
45
+ const imageExtensions = [".mp4"];
46
+ const extension = path.toLowerCase().substring(path.lastIndexOf("."));
47
+ return imageExtensions.includes(extension);
48
+ };
44
49
  export const isPDFFromPath = (path = "") => {
45
50
  const imageExtensions = [".pdf"];
46
51
  const extension = path.toLowerCase().substring(path.lastIndexOf("."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.217",
3
+ "version": "1.4.219",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@nuxt/kit": "^3.13.1",
39
- "@nuxt/ui": "2.19.2",
39
+ "@nuxt/ui": "2.20.0",
40
40
  "@pinia/nuxt": "^0.7.0",
41
41
  "@tiptap/extension-image": "^2.8.0",
42
42
  "@tiptap/extension-link": "^2.8.0",