tantee-nuxt-commons 0.0.170 → 0.0.172

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.0.170",
7
+ "version": "0.0.172",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -39,6 +39,12 @@ const module = defineNuxtModule({
39
39
  ...runtimeConfig,
40
40
  ..._options
41
41
  };
42
+ _nuxt.options.vite.optimizeDeps ||= {};
43
+ _nuxt.options.vite.optimizeDeps.include ||= [];
44
+ _nuxt.options.vite.optimizeDeps.include.push("painterro");
45
+ _nuxt.options.vite.optimizeDeps.include.push("print-js");
46
+ _nuxt.options.vite.optimizeDeps.include.push("gql-query-builder");
47
+ _nuxt.options.vite.optimizeDeps.include.push("exif-rotate-js");
42
48
  }
43
49
  });
44
50
 
@@ -1,9 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import { ref, watch } from 'vue'
2
+ import { ref, watch,computed } from 'vue'
3
3
  import { isEqual } from 'lodash-es'
4
4
  import { useAlert } from '../../../composables/alert'
5
- import {useAssetFile, type Base64Image, type Base64Asset, type Base64File} from '../../../composables/assetFile'
6
- import {useRuntimeConfig} from "#imports";
5
+ import { useAssetFile, type Base64Image, type Base64Asset, type Base64File} from '../../../composables/assetFile'
6
+ import { useRuntimeConfig } from "#imports";
7
+ import { VInput } from 'vuetify/components/VInput'
7
8
 
8
9
  const emit = defineEmits<{
9
10
  (e: 'update:modelValue', value: Base64Image[]): void
@@ -210,83 +211,103 @@ watch(
210
211
  },
211
212
  { immediate: false }
212
213
  )
214
+
215
+ // validation passthrough
216
+ const inputRef = ref<InstanceType<typeof VInput> | null>(null)
217
+
218
+ const isValid = computed(() => inputRef.value?.isValid)
219
+ const errorMessages = computed(() => inputRef.value?.errorMessages)
220
+
221
+ defineExpose({
222
+ errorMessages,
223
+ isValid,
224
+ reset: () => inputRef.value?.reset(),
225
+ resetValidation: () => inputRef.value?.resetValidation(),
226
+ validate: () => inputRef.value?.validate(),
227
+ })
213
228
  </script>
214
229
 
215
230
  <template>
216
- <VCard>
217
- <VToolbar density="compact">
218
- <VToolbarTitle>{{ label }}</VToolbarTitle>
219
- <v-spacer />
220
- <VToolbarItems v-if="!readonly">
221
- <FileBtn
222
- v-model="uploadImages"
223
- :accept="accept"
224
- color="primary"
225
- icon="mdi:mdi-image-plus"
226
- icon-only
227
- multiple
228
- variant="text"
229
- @update:model-value="uploadImageFile"
230
- />
231
- <v-btn color="primary" icon @click="dialog = true">
232
- <v-icon>mdi mdi-camera-plus</v-icon>
233
- </v-btn>
234
- </VToolbarItems>
235
- </VToolbar>
236
-
237
- <VCardText>
238
- <VRow dense justify="center">
239
- <VCol v-for="(image, index) in images" :key="`${imageKey(image)}-${index}`" cols="4">
240
- <VCard>
241
- <VToolbar density="compact">
242
- <VToolbarTitle>
243
- {{ image.imageTitle }}
244
- </VToolbarTitle>
245
- <VSpacer />
246
- <VToolbarItems v-if="!readonly">
247
- <v-btn icon @click="remove(index)">
248
- <v-icon>mdi mdi-delete-outline</v-icon>
249
- </v-btn>
250
- <v-btn color="primary" icon @click="setDataUpdate(image)" v-if="!image.imageData?.id">
251
- <v-icon>mdi mdi-image-edit-outline</v-icon>
252
- </v-btn>
253
- </VToolbarItems>
254
- </VToolbar>
255
-
256
- <v-img
257
- :src="imageSrcFromImageData(image)"
258
- height="250"
259
- @click="() => { (props.readonly || image.imageData?.id) ? openImageFullScreen(image) : setDataUpdate(image) }"
231
+ <v-input v-model="images" v-bind="$attrs" ref="inputRef">
232
+ <template #default="{ isReadonly, isDisabled }">
233
+ <VCard>
234
+ <VToolbar density="compact">
235
+ <VToolbarTitle>{{ label }}</VToolbarTitle>
236
+ <v-spacer />
237
+ <VToolbarItems v-if="!readonly">
238
+ <FileBtn
239
+ v-model="uploadImages"
240
+ :accept="accept"
241
+ color="primary"
242
+ icon="mdi:mdi-image-plus"
243
+ icon-only
244
+ multiple
245
+ variant="text"
246
+ @update:model-value="uploadImageFile"
247
+ :disabled="isDisabled?.value" :readonly="isReadonly?.value"
260
248
  />
261
- </VCard>
262
- </VCol>
263
- </VRow>
264
- </VCardText>
265
- </VCard>
266
-
267
- <!-- Edit dialog -->
268
- <VDialog v-model="dialogUpdate" fullscreen transition="dialog-bottom-transition">
269
- <FormImagesPad
270
- v-model="dataUpdate.imageData.base64String"
271
- @closedDialog="dialogUpdate = false"
272
- />
273
- </VDialog>
274
-
275
- <!-- Capture dialog -->
276
- <FormDialog v-model="dialog" :form-data="modelData" @create="captureImage">
277
- <template #default="{ data }">
278
- <FormImagesCapture v-model="data.imageCapture" />
249
+ <v-btn color="primary" icon @click="dialog = true" :disabled="isDisabled?.value" :readonly="isReadonly?.value">
250
+ <v-icon>mdi mdi-camera-plus</v-icon>
251
+ </v-btn>
252
+ </VToolbarItems>
253
+ </VToolbar>
254
+
255
+ <VCardText>
256
+ <VRow dense justify="center">
257
+ <VCol v-for="(image, index) in images" :key="`${imageKey(image)}-${index}`" cols="4">
258
+ <VCard>
259
+ <VToolbar density="compact">
260
+ <VToolbarTitle>
261
+ {{ image.imageTitle }}
262
+ </VToolbarTitle>
263
+ <VSpacer />
264
+ <VToolbarItems v-if="!readonly">
265
+ <v-btn icon @click="remove(index)" :disabled="isDisabled?.value" :readonly="isReadonly?.value">
266
+ <v-icon>mdi mdi-delete-outline</v-icon>
267
+ </v-btn>
268
+ <v-btn color="primary" icon @click="setDataUpdate(image)" v-if="!image.imageData?.id" :disabled="isDisabled?.value" :readonly="isReadonly?.value">
269
+ <v-icon>mdi mdi-image-edit-outline</v-icon>
270
+ </v-btn>
271
+ </VToolbarItems>
272
+ </VToolbar>
273
+
274
+ <v-img
275
+ :src="imageSrcFromImageData(image)"
276
+ height="250"
277
+ @click="() => { (props.readonly || image.imageData?.id || isReadonly?.value) ? openImageFullScreen(image) : setDataUpdate(image) }"
278
+ :disabled="isDisabled?.value"
279
+ />
280
+ </VCard>
281
+ </VCol>
282
+ </VRow>
283
+ </VCardText>
284
+ </VCard>
285
+
286
+ <!-- Edit dialog -->
287
+ <VDialog v-model="dialogUpdate" fullscreen transition="dialog-bottom-transition">
288
+ <FormImagesPad
289
+ v-model="dataUpdate.imageData.base64String"
290
+ @closedDialog="dialogUpdate = false"
291
+ />
292
+ </VDialog>
293
+
294
+ <!-- Capture dialog -->
295
+ <FormDialog v-model="dialog" :form-data="modelData" @create="captureImage">
296
+ <template #default="{ data }">
297
+ <FormImagesCapture v-model="data.imageCapture" />
298
+ </template>
299
+ </FormDialog>
300
+
301
+ <!-- Fullscreen preview -->
302
+ <v-dialog v-model="dialogImageFullScreen">
303
+ <v-toolbar :title="imageFullScreen.title">
304
+ <v-spacer />
305
+ <v-btn icon="mdi mdi-close" @click="dialogImageFullScreen = false" />
306
+ </v-toolbar>
307
+ <v-card height="80vh">
308
+ <v-img :src="imageFullScreen.image" />
309
+ </v-card>
310
+ </v-dialog>
279
311
  </template>
280
- </FormDialog>
281
-
282
- <!-- Fullscreen preview -->
283
- <v-dialog v-model="dialogImageFullScreen">
284
- <v-toolbar :title="imageFullScreen.title">
285
- <v-spacer />
286
- <v-btn icon="mdi mdi-close" @click="dialogImageFullScreen = false" />
287
- </v-toolbar>
288
- <v-card height="80vh">
289
- <v-img :src="imageFullScreen.image" />
290
- </v-card>
291
- </v-dialog>
312
+ </v-input>
292
313
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tantee-nuxt-commons",
3
- "version": "0.0.170",
3
+ "version": "0.0.172",
4
4
  "description": "Ramathibodi Nuxt modules for common components",
5
5
  "repository": {
6
6
  "type": "git",