pukaad-ui-lib 1.224.0 → 1.226.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.224.0",
4
+ "version": "1.226.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -7,7 +7,7 @@
7
7
  <div class="font-body-large-prominent">รายละเอียด</div>
8
8
  <div class="flex flex-col gap-[4px]">
9
9
  <InputAutocomplete name="businessName" v-model="modelValue.businessName" label="ชื่อสถานที่ธุรกิจ"
10
- placeholder="กรอกชื่อสถานที่" required show-counter :limit="180" free-text :fetch-fn="fetchApprovedPlaces"
10
+ placeholder="กรอกชื่อสถานที่" required show-counter :limit="180" :free-text="true" :fetch-fn="fetchApprovedPlaces"
11
11
  value-key="business_name" label-key="business_name" />
12
12
  <InputTextField v-if="extraNameCount >= 1" name="nameTh" v-model="modelValue.nameTh" label="ชื่อภาษาไทย"
13
13
  placeholder="ใส่ในกรณีที่ต่างจากชื่อหลัก" show-counter :limit="180" />
@@ -74,34 +74,43 @@
74
74
  </template>
75
75
 
76
76
  <script setup>
77
- import { ref, computed, onMounted, watch } from "vue";
77
+ import { ref, computed, onMounted, watch, reactive } from "vue";
78
78
  import { useApi } from "@/runtime/composables/useApi";
79
79
  import SuggestPlaceMap from "./suggest-place-map.vue";
80
80
  const props = defineProps({
81
81
  state: { type: String, required: false, default: "personal" }
82
82
  });
83
83
  const api = useApi();
84
- const modelValue = defineModel({ type: Object, ...{
85
- default: () => ({})
86
- } });
87
- if (!modelValue.value.address) modelValue.value.address = {};
88
- if (!modelValue.value.extraPhones) modelValue.value.extraPhones = [];
89
- if (!modelValue.value.categories) modelValue.value.categories = [];
90
- if (!modelValue.value.reviewPhotos) modelValue.value.reviewPhotos = [];
84
+ const _model = defineModel({ type: Object, ...{ default: () => ({}) } });
85
+ const modelValue = reactive({
86
+ address: {},
87
+ extraPhones: [],
88
+ categories: [],
89
+ reviewPhotos: [],
90
+ photos: [],
91
+ videos: [],
92
+ ..._model.value
93
+ });
94
+ watch(_model, (val) => {
95
+ if (val) Object.assign(modelValue, val);
96
+ }, { deep: false });
97
+ watch(modelValue, (val) => {
98
+ _model.value = { ...val };
99
+ }, { deep: true });
91
100
  const extraNameCount = ref(
92
- modelValue.value.nameEn ? 2 : modelValue.value.nameTh ? 1 : 0
101
+ modelValue.nameEn ? 2 : modelValue.nameTh ? 1 : 0
93
102
  );
94
103
  const isAddressCompleted = computed(() => {
95
- const v = modelValue.value.address || {};
104
+ const v = modelValue.address || {};
96
105
  return !!(v.province_id && v.amphur_id && v.tambon_id && v.zipcode);
97
106
  });
98
107
  watch(
99
- () => modelValue.value.isReview,
108
+ () => modelValue.isReview,
100
109
  (newVal) => {
101
110
  if (!newVal) {
102
- modelValue.value.rating = void 0;
103
- modelValue.value.reviewDescription = "";
104
- modelValue.value.reviewPhotos = [];
111
+ modelValue.rating = void 0;
112
+ modelValue.reviewDescription = "";
113
+ modelValue.reviewPhotos = [];
105
114
  }
106
115
  }
107
116
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.224.0",
3
+ "version": "1.226.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",