@ramathibodi/nuxt-commons 0.0.2 → 0.0.4

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,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.0.2"
7
+ "version": "0.0.4"
8
8
  }
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref, watch } from 'vue'
3
+ import { isEmpty } from 'lodash-es'
3
4
  import { useAlert } from '../composables/alert'
4
5
  import type { AlertItem } from '../types/alert'
5
6
 
@@ -28,25 +29,25 @@ watch(() => alert?.hasAlert(), (hasAlert) => {
28
29
 
29
30
  <template>
30
31
  <VSnackbar
31
- v-if="currentItem"
32
- v-model="isAlertOpen"
33
- :timeout="timeout"
34
- location="center"
35
- multi-line
36
- variant="text"
37
- @update:model-value="renewAlert()"
32
+ v-if="currentItem"
33
+ v-model="isAlertOpen"
34
+ :timeout="timeout"
35
+ location="center"
36
+ multi-line
37
+ variant="text"
38
+ @update:model-value="renewAlert()"
38
39
  >
39
40
  <!-- @vue-expected-error Type conversion problem -->
40
41
  <VAlert
41
- v-model="isAlertOpen"
42
- closable
43
- :type="currentItem.alertType"
44
- elevation="2"
45
- theme="dark"
46
- variant="flat"
47
- @click:close="renewAlert()"
42
+ v-model="isAlertOpen"
43
+ closable
44
+ :type="currentItem.alertType"
45
+ elevation="2"
46
+ theme="dark"
47
+ variant="flat"
48
+ @click:close="renewAlert()"
48
49
  >
49
- {{ currentItem.statusCode ? currentItem.statusCode + ' ' : '' }}{{ currentItem.message }}{{ currentItem.data ? ' ' + currentItem.data : '' }}
50
+ {{ currentItem.statusCode ? currentItem.statusCode + ' ' : '' }} {{ currentItem.message }} {{ !isEmpty(currentItem.data) ? currentItem.data : '' }}
50
51
  </VAlert>
51
52
  </VSnackbar>
52
53
  </template>
@@ -5,13 +5,18 @@ interface DialogProps {
5
5
  modelValue: boolean
6
6
  color?: string
7
7
  }
8
+ const emit = defineEmits(['update:modelValue'])
8
9
 
9
10
  const props = defineProps<DialogProps>()
10
- const dialogVisible = ref<boolean>(false)
11
+ const dialogVisible = ref<boolean>(props.modelValue)
11
12
 
12
13
  watch(() => props.modelValue, (newValue) => {
13
14
  dialogVisible.value = newValue
14
15
  })
16
+
17
+ watch(() => dialogVisible.value, (newValue) => {
18
+ emit('update:modelValue', newValue)
19
+ })
15
20
  </script>
16
21
 
17
22
  <template>
@@ -24,7 +29,7 @@ watch(() => props.modelValue, (newValue) => {
24
29
  <v-card-text>
25
30
  <v-row>
26
31
  <v-col class="text-center">
27
- กรุณารอสักครู่
32
+ <slot>กรุณารอสักครู่</slot>
28
33
  </v-col>
29
34
  </v-row>
30
35
  </v-card-text>
@@ -11,6 +11,7 @@ interface Props {
11
11
  const props = withDefaults(defineProps<Props>(), {
12
12
  modelValue: 0,
13
13
  decimal: 2,
14
+ currency: '',
14
15
  })
15
16
 
16
17
  const formattedCurrency = computed(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramathibodi/nuxt-commons",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Ramathibodi Nuxt modules for common components",
5
5
  "repository": {
6
6
  "type": "git",