@finema/core 1.4.186 → 1.4.188

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.d.mts CHANGED
@@ -44,6 +44,6 @@ declare module '@nuxt/schema' {
44
44
  core?: CORE;
45
45
  }
46
46
  }
47
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
47
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
48
48
 
49
49
  export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -44,6 +44,6 @@ declare module '@nuxt/schema' {
44
44
  core?: CORE;
45
45
  }
46
46
  }
47
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
47
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
48
48
 
49
49
  export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.186",
3
+ "version": "1.4.188",
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.186";
5
+ const version = "1.4.188";
6
6
 
7
7
  const colorModeOptions = {
8
8
  preference: "light"
@@ -1,57 +1,215 @@
1
1
  <template>
2
2
  <FieldWrapper v-bind="wrapperProps">
3
3
  <ClientOnly>
4
- <QuillEditor
5
- v-model:content="value"
6
- :placeholder="placeholder ?? label"
7
- :autofocus="autoFocus"
8
- :disabled="isDisabled || isReadonly"
9
- :name="name"
10
- class="ql-snow focus:ring-primary-500 min-h-[300px] rounded-b-md bg-white ring-1 ring-inset ring-gray-300 focus:ring-2"
11
- content-type="html"
12
- :options="options"
13
- />
4
+ <div
5
+ class="form-textarea focus:ring-primary-500 dark:focus:ring-primary-400 relative block w-full resize-none rounded-md border-0 bg-white p-0 pb-3 text-sm text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-75 dark:bg-gray-900 dark:text-white dark:ring-gray-700 dark:placeholder:text-gray-500"
6
+ >
7
+ <div class="tiptap-menu-bar">
8
+ <div
9
+ v-for="(items, index) in menuItems"
10
+ :key="index"
11
+ class="flex items-center border-r border-gray-200 pr-2"
12
+ >
13
+ <button
14
+ v-for="item in items"
15
+ :key="item.name"
16
+ :class="{ 'is-active': item.isActive?.() }"
17
+ class="menu-item"
18
+ :title="item.title"
19
+ @click="item.action"
20
+ >
21
+ <Icon :name="item.icon" class="size-5" />
22
+ </button>
23
+ </div>
24
+ </div>
25
+ <EditorContent
26
+ :editor="editor"
27
+ :placeholder="placeholder ?? label"
28
+ :autofocus="autoFocus"
29
+ :disabled="isDisabled || isReadonly"
30
+ :name="name"
31
+ />
32
+ </div>
14
33
  </ClientOnly>
15
34
  </FieldWrapper>
16
35
  </template>
17
36
  <script lang="ts" setup>
18
37
  import { useFieldHOC } from '#core/composables/useForm'
19
38
  import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
20
- import '@vueup/vue-quill/dist/vue-quill.snow.css'
39
+ import { EditorContent, useEditor } from '@tiptap/vue-3'
21
40
  import type { IWYSIWYGFieldProps } from '#core/components/Form/InputWYSIWYG/types'
41
+ import StarterKit from '@tiptap/starter-kit'
42
+ import Underline from '@tiptap/extension-underline'
43
+ import TextAlign from '@tiptap/extension-text-align'
44
+ import Link from '@tiptap/extension-link'
45
+ import Image from '@tiptap/extension-image'
46
+ import Youtube from '@tiptap/extension-youtube'
47
+ import { computed, watch } from 'vue'
22
48
 
23
49
  const props = withDefaults(defineProps<IWYSIWYGFieldProps>(), {})
24
50
  const { value, wrapperProps } = useFieldHOC<string>(props)
51
+ const editor = useEditor({
52
+ content: value.value,
53
+ extensions: [
54
+ StarterKit,
55
+ Underline,
56
+ TextAlign.configure({
57
+ types: ['heading', 'paragraph'],
58
+ }),
59
+ Link.configure({
60
+ openOnClick: false,
61
+ }),
62
+ Image,
63
+ Youtube,
64
+ ],
65
+ editorProps: {
66
+ attributes: {
67
+ class: 'prose m-4 focus:outline-none',
68
+ },
69
+ },
70
+ onUpdate: ({ editor }) => {
71
+ value.value = editor.getHTML()
72
+ },
73
+ })
25
74
 
26
- const options = {
27
- modules: {
28
- toolbar: [
29
- // [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
30
- ['bold', 'italic', 'underline'], // toggled buttons
31
- // ['blockquote', 'code-block'],
32
-
33
- ['link'],
34
-
35
- // [{ header: 1 }, { header: 2 }], // custom button values
36
- [{ list: 'ordered' }, { list: 'bullet' }],
37
- // [{ script: 'sub' }, { script: 'super' }], // superscript/subscript
38
- [{ indent: '-1' }, { indent: '+1' }], // outdent/indent
39
- // [{ direction: 'rtl' }], // text direction
40
- [{ align: [] }],
75
+ watch(value, (newValue) => {
76
+ if (editor.value && newValue !== editor.value.getHTML()) {
77
+ editor.value.commands.setContent(newValue)
78
+ }
79
+ })
41
80
 
42
- // [{ header: [1, 2, 3, 4, 5, 6, false] }],
81
+ const menuItems = computed(() => [
82
+ [
83
+ {
84
+ name: 'bold',
85
+ icon: 'ph:text-b-bold',
86
+ action: () => editor.value!.chain().focus().toggleBold().run(),
87
+ isActive: () => editor.value!.isActive('bold'),
88
+ title: 'Bold',
89
+ },
90
+ {
91
+ name: 'italic',
92
+ icon: 'ph:text-italic',
93
+ action: () => editor.value!.chain().focus().toggleItalic().run(),
94
+ isActive: () => editor.value!.isActive('italic'),
95
+ title: 'Italic',
96
+ },
97
+ {
98
+ name: 'underline',
99
+ icon: 'ph:text-underline',
100
+ action: () => editor.value!.chain().focus().toggleUnderline().run(),
101
+ isActive: () => editor.value!.isActive('underline'),
102
+ title: 'Underline',
103
+ },
104
+ ],
105
+ [
106
+ {
107
+ name: 'bullet-list',
108
+ icon: 'ph:list-bullets',
109
+ action: () => editor.value!.chain().focus().toggleBulletList().run(),
110
+ isActive: () => editor.value!.isActive('bulletList'),
111
+ title: 'Bullet List',
112
+ },
113
+ {
114
+ name: 'ordered-list',
115
+ icon: 'ph:list-numbers',
116
+ action: () => editor.value!.chain().focus().toggleOrderedList().run(),
117
+ isActive: () => editor.value!.isActive('orderedList'),
118
+ title: 'Ordered List',
119
+ },
120
+ ],
121
+ [
122
+ {
123
+ name: 'align-left',
124
+ icon: 'ph:text-align-left',
125
+ action: () => editor.value!.chain().focus().setTextAlign('left').run(),
126
+ isActive: () => editor.value!.isActive({ textAlign: 'left' }),
127
+ title: 'Align Left',
128
+ },
129
+ {
130
+ name: 'align-center',
131
+ icon: 'ph:text-align-center',
132
+ action: () => editor.value!.chain().focus().setTextAlign('center').run(),
133
+ isActive: () => editor.value!.isActive({ textAlign: 'center' }),
134
+ title: 'Align Center',
135
+ },
136
+ {
137
+ name: 'align-right',
138
+ icon: 'ph:text-align-right',
139
+ action: () => editor.value!.chain().focus().setTextAlign('right').run(),
140
+ isActive: () => editor.value!.isActive({ textAlign: 'right' }),
141
+ title: 'Align Right',
142
+ },
143
+ ],
144
+ [
145
+ {
146
+ name: 'link',
147
+ icon: 'ph:link-simple',
148
+ action: () => {
149
+ const url = window.prompt('URL')
43
150
 
44
- [{ color: [] }], // dropdown with defaults from theme
45
- ['link', 'image', 'video'], // link and image, video
151
+ if (url) {
152
+ editor.value!.chain().focus().setLink({ href: url }).run()
153
+ }
154
+ },
155
+ isActive: () => editor.value!.isActive('link'),
156
+ title: 'Insert Link',
157
+ },
158
+ {
159
+ name: 'image',
160
+ icon: 'ph:image',
161
+ action: () => {
162
+ const url = window.prompt('Image URL')
46
163
 
47
- // [{ font: [] }],
164
+ if (url) {
165
+ editor.value!.chain().focus().setImage({ src: url }).run()
166
+ }
167
+ },
168
+ title: 'Insert Image',
169
+ },
170
+ {
171
+ name: 'video',
172
+ icon: 'ph:video-camera',
173
+ action: () => {
174
+ const url = window.prompt('Video URL')
48
175
 
49
- ['clean'], // remove formatting button
50
- ],
51
- },
52
- theme: 'snow',
53
- }
176
+ if (url) {
177
+ editor.value!.chain().focus().setYoutubeVideo({ src: url }).run()
178
+ }
179
+ },
180
+ title: 'Insert Video',
181
+ },
182
+ ],
183
+ [
184
+ {
185
+ name: 'hardBreak',
186
+ icon: 'ri:text-wrap',
187
+ action: () => editor.value!.chain().focus().setHardBreak().run(),
188
+ title: 'Hard Break',
189
+ },
190
+ {
191
+ name: 'clear',
192
+ icon: 'ri:format-clear',
193
+ action: () => editor.value!.chain().focus().clearNodes().unsetAllMarks().run(),
194
+ title: 'Clear',
195
+ },
196
+ ],
197
+ [
198
+ {
199
+ name: 'undo',
200
+ icon: 'ph:arrow-counter-clockwise',
201
+ action: () => editor.value!.chain().focus().undo().run(),
202
+ title: 'Undo',
203
+ },
204
+ {
205
+ name: 'redo',
206
+ icon: 'ph:arrow-clockwise',
207
+ action: () => editor.value!.chain().focus().redo().run(),
208
+ title: 'Redo',
209
+ },
210
+ ],
211
+ ])
54
212
  </script>
55
213
  <style>
56
- .ql-toolbar.ql-snow{@apply rounded-t-md border-b-0 bg-white}.ql-container.ql-snow,.ql-snow{@apply border-0}
214
+ .tiptap-menu-bar{@apply flex flex-wrap border-b py-2 px-2 gap-1}.menu-item{@apply px-1 py-1 rounded hover:bg-gray-100 transition-colors flex justify-center items-center}.menu-item.is-active{@apply bg-primary-100 text-primary-600}
57
215
  </style>
@@ -1,4 +1,10 @@
1
1
  <template>
2
+ <div v-if="!isHideCaption" class="mb-4 text-gray-500">
3
+ <span class="font-bold">ผลลัพธิ์ทั้งหมด:</span>
4
+ จำนวน
5
+ <span class="font-bold">{{ pageOptions?.totalCount || 0 }}</span>
6
+ รายการ
7
+ </div>
2
8
  <UTable
3
9
  :loading="status.isLoading"
4
10
  :columns="columns"
@@ -117,6 +123,10 @@ const props = defineProps({
117
123
  type: Boolean as PropType<ITableOptions['isHideBottomPagination']>,
118
124
  default: false,
119
125
  },
126
+ isHideCaption: {
127
+ type: Boolean as PropType<ITableOptions['isHideCaption']>,
128
+ default: false,
129
+ },
120
130
  })
121
131
 
122
132
  const page = ref(props.pageOptions?.currentPage || 1)
@@ -24,6 +24,7 @@ export interface IBaseTableOptions<T = object> {
24
24
  status: IStatus;
25
25
  columns: IColumn[];
26
26
  isHideBottomPagination?: boolean;
27
+ isHideCaption?: boolean;
27
28
  isHideTopPagination?: boolean;
28
29
  isSimplePagination?: boolean;
29
30
  }
@@ -8,7 +8,7 @@ export const checkMaxSize = (file, acceptFileSize = 0) => {
8
8
  export const checkFileType = (file, acceptFileType) => {
9
9
  if (!acceptFileType || Array.isArray(acceptFileType) && acceptFileType.length === 0) return true;
10
10
  const result = [];
11
- const acceptedTypes = Array.isArray(acceptFileType) ? acceptFileType : acceptFileType.split(",");
11
+ const acceptedTypes = Array.isArray(acceptFileType) ? acceptFileType : acceptFileType.split(",").map((type) => type.trim());
12
12
  for (const acceptedType of acceptedTypes) {
13
13
  if (acceptedType.startsWith(".")) {
14
14
  const fileExtension = `.${file.name.split(".").pop()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.186",
3
+ "version": "1.4.188",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -35,9 +35,17 @@
35
35
  "prepare": "husky install"
36
36
  },
37
37
  "dependencies": {
38
- "@nuxt/kit": "^3.12.4",
38
+ "@nuxt/kit": "^3.13.1",
39
39
  "@nuxt/ui": "2.18.4",
40
- "@pinia/nuxt": "^0.5.2",
40
+ "@pinia/nuxt": "^0.5.4",
41
+ "@tiptap/extension-image": "^2.6.6",
42
+ "@tiptap/extension-link": "^2.6.6",
43
+ "@tiptap/extension-text-align": "^2.6.6",
44
+ "@tiptap/extension-underline": "^2.6.6",
45
+ "@tiptap/extension-youtube": "^2.6.6",
46
+ "@tiptap/pm": "^2.6.6",
47
+ "@tiptap/starter-kit": "^2.6.6",
48
+ "@tiptap/vue-3": "^2.6.6",
41
49
  "@vee-validate/nuxt": "^4.13.2",
42
50
  "@vee-validate/zod": "^4.13.2",
43
51
  "@vuepic/vue-datepicker": "^8.2.0",
@@ -62,7 +70,7 @@
62
70
  "@nuxt/devtools": "^1.3.9",
63
71
  "@nuxt/eslint-config": "^0.5.0",
64
72
  "@nuxt/module-builder": "^0.5.5",
65
- "@nuxt/schema": "^3.12.4",
73
+ "@nuxt/schema": "^3.13.1",
66
74
  "@nuxt/test-utils": "^3.13.1",
67
75
  "@release-it/conventional-changelog": "^8.0.1",
68
76
  "@types/node": "^20.10.17",
@@ -73,7 +81,7 @@
73
81
  "happy-dom": "^13.0.0",
74
82
  "husky": "^9.0.11",
75
83
  "lint-staged": "^15.2.0",
76
- "nuxt": "^3.12.4",
84
+ "nuxt": "^3.13.1",
77
85
  "playwright-core": "^1.42.1",
78
86
  "prettier": "^3.1.1",
79
87
  "release-it": "^17.0.1",
@@ -81,8 +89,7 @@
81
89
  "stylelint": "^16.1.0",
82
90
  "stylelint-config-prettier-scss": "^1.0.0",
83
91
  "stylelint-config-standard-scss": "^13.0.0",
84
- "vitest": "^2.0.4",
85
- "vue": "^3.4.36"
92
+ "vitest": "^2.0.4"
86
93
  },
87
94
  "lint-staged": {
88
95
  "*.{ts,vue,tsx,js}": "eslint --fix --cache"