free-fe-core-modules 0.1.32 → 0.1.34

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.
@@ -75,7 +75,13 @@ export default defineComponent({
75
75
  (l) => l.locale === (vm.ctx.config.locale || vm.ctx.config.defaultLocale),
76
76
  )?.calendar;
77
77
 
78
- const localDate = computed(() => vm.$filter('normalDate', fieldData.value));
78
+ const normalizeDateValue = (value) => {
79
+ if (value === void 0 || value === null || value === '') return '';
80
+
81
+ return vm.$filter('normalDate', value) || '';
82
+ };
83
+
84
+ const localDate = computed(() => normalizeDateValue(fieldData.value));
79
85
 
80
86
  const showPopup = ref(false);
81
87
 
@@ -94,7 +100,7 @@ export default defineComponent({
94
100
  class: 'full-width',
95
101
  modelValue: localDate.value,
96
102
  'onUpdate:modelValue': (v) => {
97
- setFieldData(v, emit);
103
+ setFieldData(normalizeDateValue(v), emit);
98
104
  },
99
105
  }, {
100
106
  default: () => h(QPopupProxy, {
@@ -113,7 +119,7 @@ export default defineComponent({
113
119
  locale,
114
120
 
115
121
  'onUpdate:modelValue': (v) => {
116
- setFieldData(v, emit);
122
+ setFieldData(normalizeDateValue(v), emit);
117
123
 
118
124
  // TODO: not working, should close the popup but not
119
125
  showPopup.value = false;
@@ -129,7 +135,7 @@ export default defineComponent({
129
135
 
130
136
  const readonlyNode = () => h(ReadonlyContent, {
131
137
  Field: props.Field,
132
- Content: fieldData.value,
138
+ Content: localDate.value,
133
139
  });
134
140
 
135
141
  const {
@@ -46,6 +46,12 @@ export default defineComponent({
46
46
 
47
47
  const { fieldData, setFieldData, inputControlSettings } = useFreeField(props);
48
48
 
49
+ const normalizeDateValue = (value) => {
50
+ if (value === void 0 || value === null || value === '') return '';
51
+
52
+ return vm.$filter('normalDate', value) || '';
53
+ };
54
+
49
55
  const updateFieldDate = () => {
50
56
  setFieldData([min.value, max.value].join(props.Field.Separator || '~'), emit);
51
57
  };
@@ -58,13 +64,18 @@ export default defineComponent({
58
64
 
59
65
  watchEffect(() => {
60
66
  const yl = (fieldData.value || '').split(props.Field.Separator || '~');
61
- min.value = yl[0] && yl[0].trim();
62
- max.value = yl[1] && yl[1].trim();
67
+ min.value = normalizeDateValue(yl[0] && yl[0].trim());
68
+ max.value = normalizeDateValue(yl[1] && yl[1].trim());
69
+ });
70
+
71
+ const readonlyContent = computed(() => {
72
+ const separator = props.Field.Separator || '~';
73
+ return [min.value, max.value].join(separator);
63
74
  });
64
75
 
65
76
  const readonlyNode = () => h(ReadonlyContent, {
66
77
  Field: props.Field,
67
- Content: fieldData.value,
78
+ Content: readonlyContent.value,
68
79
  });
69
80
 
70
81
  const before = (props.Field.Label !== void 0) ? () => h(freeFieldLabel, {
@@ -132,7 +143,7 @@ export default defineComponent({
132
143
 
133
144
  modelValue: min.value,
134
145
  'onUpdate:modelValue': (v) => {
135
- min.value = v;
146
+ min.value = normalizeDateValue(v);
136
147
  emit('input', v);
137
148
  },
138
149
  }, {
@@ -152,7 +163,7 @@ export default defineComponent({
152
163
  locale,
153
164
 
154
165
  'onUpdate:modelValue': (v) => {
155
- min.value = v;
166
+ min.value = normalizeDateValue(v);
156
167
 
157
168
  // TODO: not working, should close the popup but not
158
169
  showMinPopup.value = false;
@@ -181,7 +192,7 @@ export default defineComponent({
181
192
 
182
193
  modelValue: max.value,
183
194
  'onUpdate:modelValue': (v) => {
184
- max.value = v;
195
+ max.value = normalizeDateValue(v);
185
196
  emit('input', v);
186
197
  },
187
198
  }, {
@@ -201,7 +212,7 @@ export default defineComponent({
201
212
  locale,
202
213
 
203
214
  'onUpdate:modelValue': (v) => {
204
- max.value = v;
215
+ max.value = normalizeDateValue(v);
205
216
 
206
217
  // TODO: not working, should close the popup but not
207
218
  showMaxPopup.value = false;
@@ -120,7 +120,7 @@ export default defineComponent({
120
120
  && !Array.isArray(service)
121
121
  && ['scope'].indexOf(service) < 0
122
122
  ) {
123
- children.push({ Name: sk, Index: props.Service[sk].Index || 0 });
123
+ children.push({ Name: sk, Index: props.Service[sk] ? (props.Service[sk].Index || 0) : 0 });
124
124
  }
125
125
  }
126
126
  return children.sort(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/freeeis/free-fe-core-modules.git",
6
6
  "author": "zhiquan",