@ramathibodi/nuxt-commons 0.1.63 → 0.1.64
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,14 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import '@vuepic/vue-datepicker/dist/main.css'
|
|
3
|
-
import {computed,
|
|
3
|
+
import {computed, onMounted, ref} from 'vue'
|
|
4
4
|
import {VTextField} from "vuetify/components/VTextField";
|
|
5
|
-
import {isArray
|
|
6
|
-
import {useRules} from "../../composables/utils/validation";
|
|
5
|
+
import {isArray} from "lodash-es";
|
|
7
6
|
|
|
8
7
|
interface IDobPrecision {
|
|
9
8
|
yearMonthDay: string
|
|
10
9
|
yearMonth: string
|
|
11
10
|
year: string
|
|
11
|
+
estimated: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
@@ -31,10 +31,11 @@ const dobPrecisionText = computed(() => {
|
|
|
31
31
|
yearMonthDay: 'YMD',
|
|
32
32
|
yearMonth: 'YM',
|
|
33
33
|
year: 'Y',
|
|
34
|
+
estimated: 'EST',
|
|
34
35
|
}
|
|
35
36
|
})
|
|
36
|
-
const dobPrecisionChoice = ref<('yearMonthDay' | 'yearMonth' | 'year')[]>(['yearMonthDay', 'yearMonth', 'year'])
|
|
37
|
-
const dobPrecisionSelected = defineModel<'yearMonthDay' | 'yearMonth' | 'year'>('dobPrecision')
|
|
37
|
+
const dobPrecisionChoice = ref<('yearMonthDay' | 'yearMonth' | 'year' | 'estimated')[]>(['yearMonthDay', 'yearMonth', 'year', 'estimated'])
|
|
38
|
+
const dobPrecisionSelected = defineModel<'yearMonthDay' | 'yearMonth' | 'year' | 'estimated'>('dobPrecision')
|
|
38
39
|
onMounted(()=>{
|
|
39
40
|
if (!dobPrecisionSelected.value) {
|
|
40
41
|
dobPrecisionSelected.value = 'yearMonthDay'
|
|
@@ -70,6 +71,9 @@ const dobFormat = computed(() => {
|
|
|
70
71
|
if (dobPrecisionSelected.value=="year") {
|
|
71
72
|
displayFormat = "yyyy"
|
|
72
73
|
}
|
|
74
|
+
if (dobPrecisionSelected.value=="estimated") {
|
|
75
|
+
displayFormat = "~ MMM yyyy"
|
|
76
|
+
}
|
|
73
77
|
return displayFormat
|
|
74
78
|
})
|
|
75
79
|
</script>
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {watchDebounced} from '@vueuse/core'
|
|
16
16
|
import {useRules} from '../../composables/utils/validation'
|
|
17
17
|
import {useDocumentTemplate} from '../../composables/document/template'
|
|
18
|
-
import { isObject, isArray, isString, isPlainObject, isEqual } from 'lodash-es'
|
|
18
|
+
import { isObject, isArray, isString, isPlainObject, isEqual, debounce } from 'lodash-es'
|
|
19
19
|
import FormPad from './Pad.vue'
|
|
20
20
|
|
|
21
21
|
defineOptions({
|
|
@@ -87,7 +87,9 @@ function isBlankString(v: unknown): v is string {
|
|
|
87
87
|
return isString(v) && v.trim().length === 0
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
const sanitizeBlankStrings = debounce(sanitizeBlankStringsRaw, 500)
|
|
91
|
+
|
|
92
|
+
function sanitizeBlankStringsRaw(val: any, original?: any): void {
|
|
91
93
|
if (!original && props.originalData) {
|
|
92
94
|
sanitizeBlankStrings(val, props.originalData)
|
|
93
95
|
return
|
|
@@ -101,7 +103,7 @@ function sanitizeBlankStrings(val: any, original?: any): void {
|
|
|
101
103
|
} else if (isPlainObject(item) || isArray(item)) {
|
|
102
104
|
sanitizeBlankStrings(item,{})
|
|
103
105
|
} else {
|
|
104
|
-
if (item && typeof item
|
|
106
|
+
if (item && typeof item === 'string') val[i] = item.replace(/[ \t]+$/, '')
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
return
|
|
@@ -117,7 +119,7 @@ function sanitizeBlankStrings(val: any, original?: any): void {
|
|
|
117
119
|
let originalChild = (original && (isPlainObject(original[key]) || isArray(original[key]))) ? original[key] : {}
|
|
118
120
|
sanitizeBlankStrings(v, originalChild)
|
|
119
121
|
} else {
|
|
120
|
-
if (v && typeof v
|
|
122
|
+
if (v && typeof v === 'string') val[key] = v.replace(/[ \t]+$/, '')
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
}
|