@finema/core 2.17.3 → 2.18.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
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FieldWrapper v-bind="wrapperProps">
|
|
3
3
|
<Datepicker
|
|
4
|
-
:model-value="
|
|
4
|
+
:model-value="innerValue"
|
|
5
5
|
:disabled="wrapperProps.disabled"
|
|
6
6
|
cancel-text="ยกเลิก"
|
|
7
7
|
select-text="เลือก"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<script setup>
|
|
61
61
|
import Datepicker from "@vuepic/vue-datepicker";
|
|
62
62
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
63
|
-
import { computed, TimeHelper, useAppConfig, useFieldHOC, useUiConfig } from "#imports";
|
|
63
|
+
import { computed, TimeHelper, useAppConfig, useFieldHOC, useUiConfig, ref, watch, onMounted } from "#imports";
|
|
64
64
|
import "@vuepic/vue-datepicker/dist/main.css";
|
|
65
65
|
import { dateTimeTheme } from "#core/theme/dateTime";
|
|
66
66
|
const props = defineProps({
|
|
@@ -93,6 +93,27 @@ const {
|
|
|
93
93
|
value,
|
|
94
94
|
wrapperProps
|
|
95
95
|
} = useFieldHOC(props);
|
|
96
|
+
const innerValue = ref();
|
|
97
|
+
const initializeValue = () => {
|
|
98
|
+
const currentValue = value.value;
|
|
99
|
+
if (currentValue) {
|
|
100
|
+
innerValue.value = typeof currentValue === "string" ? new Date(currentValue) : currentValue;
|
|
101
|
+
} else {
|
|
102
|
+
innerValue.value = void 0;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
watch(value, (newValue) => {
|
|
106
|
+
if (newValue) {
|
|
107
|
+
innerValue.value = typeof newValue === "string" ? new Date(newValue) : newValue;
|
|
108
|
+
} else {
|
|
109
|
+
innerValue.value = void 0;
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
immediate: true
|
|
113
|
+
});
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
initializeValue();
|
|
116
|
+
});
|
|
96
117
|
const format = (date) => {
|
|
97
118
|
if (props.disabledTime) {
|
|
98
119
|
return TimeHelper.displayDate(date);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<script setup>
|
|
64
64
|
import Datepicker from "@vuepic/vue-datepicker";
|
|
65
65
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
66
|
-
import { TimeHelper, ref, useFieldHOC, useAppConfig, computed, useUiConfig } from "#imports";
|
|
66
|
+
import { TimeHelper, ref, useFieldHOC, useAppConfig, computed, useUiConfig, watch, onMounted } from "#imports";
|
|
67
67
|
import "@vuepic/vue-datepicker/dist/main.css";
|
|
68
68
|
import { dateTimeTheme } from "#core/theme/dateTime";
|
|
69
69
|
const props = defineProps({
|
|
@@ -98,6 +98,30 @@ const {
|
|
|
98
98
|
wrapperProps
|
|
99
99
|
} = useFieldHOC(props);
|
|
100
100
|
const innerValueRef = ref([]);
|
|
101
|
+
const initializeValue = () => {
|
|
102
|
+
const currentValue = value.value;
|
|
103
|
+
if (currentValue) {
|
|
104
|
+
const start = typeof currentValue.start === "string" ? new Date(currentValue.start) : currentValue.start;
|
|
105
|
+
const end = typeof currentValue.end === "string" ? new Date(currentValue.end) : currentValue.end;
|
|
106
|
+
innerValueRef.value = [start, end];
|
|
107
|
+
} else {
|
|
108
|
+
innerValueRef.value = [];
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
watch(value, (newValue) => {
|
|
112
|
+
if (newValue && (newValue.start || newValue.end)) {
|
|
113
|
+
const start = typeof newValue.start === "string" ? new Date(newValue.start) : newValue.start;
|
|
114
|
+
const end = typeof newValue.end === "string" ? new Date(newValue.end) : newValue.end;
|
|
115
|
+
innerValueRef.value = [start, end];
|
|
116
|
+
} else if (!newValue) {
|
|
117
|
+
innerValueRef.value = [];
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
immediate: true
|
|
121
|
+
});
|
|
122
|
+
onMounted(() => {
|
|
123
|
+
initializeValue();
|
|
124
|
+
});
|
|
101
125
|
const format = (date) => {
|
|
102
126
|
if (props.disabledTime) {
|
|
103
127
|
return date.length > 0 ? TimeHelper.displayDate(date[0]) + " - " + TimeHelper.displayDate(date[1] ?? date[0]) : "";
|
|
@@ -114,6 +114,7 @@ export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onU
|
|
|
114
114
|
});
|
|
115
115
|
const getOptions = (data) => {
|
|
116
116
|
const {
|
|
117
|
+
page: page2,
|
|
117
118
|
total,
|
|
118
119
|
limit: limit2,
|
|
119
120
|
...more
|
|
@@ -122,7 +123,7 @@ export const apiFetchHelper = async (state, onUpdateStatus, onUpdateOptions, onU
|
|
|
122
123
|
...state().options,
|
|
123
124
|
...more,
|
|
124
125
|
currentPageCount: state().items?.length || 0,
|
|
125
|
-
currentPage:
|
|
126
|
+
currentPage: page2,
|
|
126
127
|
totalCount: total,
|
|
127
128
|
limit: limit2,
|
|
128
129
|
search: query,
|