free-fe-core-modules 0.0.16 → 0.0.18
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/components/Basic/EIcon.vue +3 -0
- package/composible/useFormValidator.js +4 -0
- package/free-field/Fields/AgreementCheck.js +8 -8
- package/free-field/Fields/ApiCall.js +1 -1
- package/free-field/Fields/Boolean.js +19 -52
- package/free-field/Fields/Category.js +1 -1
- package/free-field/Fields/Check.js +8 -3
- package/free-field/Fields/Column.vue +12 -9
- package/free-field/Fields/Customize.js +1 -1
- package/free-field/Fields/Date.js +11 -2
- package/free-field/Fields/DateRange.js +7 -3
- package/free-field/Fields/DynamicList.js +2 -1
- package/free-field/Fields/File.vue +393 -0
- package/free-field/Fields/FileList.vue +460 -0
- package/free-field/Fields/FileListCombined.vue +172 -0
- package/free-field/Fields/FixedList.vue +4 -3
- package/free-field/Fields/{InputFieldList.vue → FreeFieldList.vue} +34 -11
- package/free-field/Fields/Image.vue +361 -0
- package/free-field/Fields/ImageList.vue +353 -0
- package/free-field/Fields/ImageListCombined.vue +108 -0
- package/free-field/Fields/Labels.vue +3 -5
- package/free-field/Fields/MixedTable.vue +2 -2
- package/free-field/Fields/Number.js +5 -2
- package/free-field/Fields/NumberRange.vue +24 -15
- package/free-field/Fields/Password.js +4 -2
- package/free-field/Fields/Permission.vue +2 -2
- package/free-field/Fields/PermissionEditor.vue +2 -2
- package/free-field/Fields/QueryFilters.vue +1 -1
- package/free-field/Fields/RadioList.vue +4 -3
- package/free-field/Fields/Rich.vue +28 -4
- package/free-field/Fields/Row.vue +13 -10
- package/free-field/Fields/Search.vue +28 -26
- package/free-field/Fields/Select.vue +30 -22
- package/free-field/Fields/SelectionChain.vue +4 -2
- package/free-field/Fields/Separator.js +1 -1
- package/free-field/Fields/SingleList.vue +1 -1
- package/free-field/Fields/Static.js +1 -1
- package/free-field/Fields/String.js +20 -5
- package/free-field/Fields/Tabs.vue +9 -9
- package/free-field/Fields/Text.js +7 -4
- package/free-field/Fields/Time.vue +5 -3
- package/free-field/Fields/TimeRange.vue +7 -4
- package/free-field/Fields/Year.js +4 -2
- package/free-field/Fields/YearRange.vue +6 -3
- package/free-field/Fields/index.js +20 -13
- package/free-field/composible/fieldWrapper.js +137 -11
- package/free-field/composible/readonlyContent.js +1 -1
- package/free-field/composible/useFreeField.js +25 -9
- package/free-field/composible/useUploader.js +320 -0
- package/free-field/style.scss +173 -0
- package/i18n/en-us/index.js +3 -0
- package/i18n/fields/en-us/index.js +1 -0
- package/i18n/fields/zh-cn/index.js +1 -0
- package/i18n/zh-cn/index.js +3 -0
- package/index.js +7 -0
- package/package.json +1 -1
- package/view/menu/index.vue +6 -6
- package/view/system/index.vue +1 -1
- package/free-field/style.sass +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="simple-field
|
|
2
|
+
<span class="simple-field free-field-time row items-center no-wrap">
|
|
3
3
|
<span v-if="Field.ReadOnly">
|
|
4
4
|
<span
|
|
5
5
|
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<q-input v-else v-model="fieldData.value" hide-bottom-space
|
|
15
15
|
:readonly="Field.ReadOnly"
|
|
16
16
|
@input="$emit('input')"
|
|
17
|
+
v-bind="inputControlSettings"
|
|
17
18
|
ref="fieldToValid">
|
|
18
19
|
<template v-slot:before v-if="Field.Label !== void 0">
|
|
19
20
|
<span
|
|
@@ -97,7 +98,7 @@ export default defineComponent({
|
|
|
97
98
|
|
|
98
99
|
const { proxy:vm } = getCurrentInstance();
|
|
99
100
|
|
|
100
|
-
const { fieldData, setFieldData } = useFreeField(props);
|
|
101
|
+
const { fieldData, setFieldData, inputControlSettings } = useFreeField(props);
|
|
101
102
|
|
|
102
103
|
const locale = vm.ctx.config.locales.find(
|
|
103
104
|
(l) => l.locale === (vm.ctx.config.locale || vm.ctx.config.defaultLocale),
|
|
@@ -175,7 +176,8 @@ export default defineComponent({
|
|
|
175
176
|
|
|
176
177
|
changed: (v) => {
|
|
177
178
|
setFieldData(v, emit);
|
|
178
|
-
}
|
|
179
|
+
},
|
|
180
|
+
inputControlSettings,
|
|
179
181
|
};
|
|
180
182
|
},
|
|
181
183
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="simple-field
|
|
2
|
+
<span class="simple-field free-field-time-range row items-center no-wrap">
|
|
3
3
|
<span v-if="Field.ReadOnly">
|
|
4
4
|
<span
|
|
5
5
|
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
v-model="min"
|
|
28
28
|
hide-bottom-space
|
|
29
29
|
:readonly="Field.ReadOnly"
|
|
30
|
+
v-bind="inputControlSettings"
|
|
30
31
|
ref="input_field_validator_first"
|
|
31
32
|
>
|
|
32
33
|
<q-popup-proxy
|
|
@@ -56,12 +57,13 @@
|
|
|
56
57
|
</template>
|
|
57
58
|
</q-input>
|
|
58
59
|
|
|
59
|
-
<span class="
|
|
60
|
+
<span class="free-field-range-separator">{{`${Field.Separator || '~'}`}}</span>
|
|
60
61
|
|
|
61
62
|
<q-input
|
|
62
63
|
v-model="max"
|
|
63
64
|
hide-bottom-space
|
|
64
65
|
:readonly="Field.ReadOnly"
|
|
66
|
+
v-bind="inputControlSettings"
|
|
65
67
|
ref="input_field_validator_second"
|
|
66
68
|
>
|
|
67
69
|
<q-popup-proxy
|
|
@@ -161,7 +163,7 @@ export default defineComponent({
|
|
|
161
163
|
|
|
162
164
|
const { proxy:vm } = getCurrentInstance();
|
|
163
165
|
|
|
164
|
-
const { fieldData, setFieldData } = useFreeField(props);
|
|
166
|
+
const { fieldData, setFieldData, inputControlSettings } = useFreeField(props);
|
|
165
167
|
|
|
166
168
|
const updateFieldDate = () => {
|
|
167
169
|
setFieldData([min.value, max.value].join(props.Field.Separator || '~'), emit);
|
|
@@ -364,7 +366,8 @@ export default defineComponent({
|
|
|
364
366
|
|
|
365
367
|
changed: (v) => {
|
|
366
368
|
setFieldData(v, emit);
|
|
367
|
-
}
|
|
369
|
+
},
|
|
370
|
+
inputControlSettings,
|
|
368
371
|
};
|
|
369
372
|
},
|
|
370
373
|
});
|
|
@@ -75,7 +75,7 @@ export default defineComponent({
|
|
|
75
75
|
setup(props, { emit, slots, expose }){
|
|
76
76
|
if (!props.Field) return {};
|
|
77
77
|
|
|
78
|
-
const { fieldData, setFieldData } = useFreeField(props);
|
|
78
|
+
const { fieldData, setFieldData, inputControlSettings } = useFreeField(props);
|
|
79
79
|
|
|
80
80
|
const before = (props.Field.Label !== void 0) ? () => h(freeFieldLabel, {
|
|
81
81
|
Field: props.Field,
|
|
@@ -111,6 +111,8 @@ export default defineComponent({
|
|
|
111
111
|
'map-options': true,
|
|
112
112
|
label: props.Field.Placeholder,
|
|
113
113
|
|
|
114
|
+
...inputControlSettings.value,
|
|
115
|
+
|
|
114
116
|
class: 'full-width',
|
|
115
117
|
style: props.Field.Info?.Style,
|
|
116
118
|
|
|
@@ -131,7 +133,7 @@ export default defineComponent({
|
|
|
131
133
|
})
|
|
132
134
|
|
|
133
135
|
return () => h('div', {
|
|
134
|
-
class: 'simple-field
|
|
136
|
+
class: 'simple-field free-field-year row items-center no-wrap',
|
|
135
137
|
}, [
|
|
136
138
|
selectNode.value,
|
|
137
139
|
slots.warning && slots.warning(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="
|
|
2
|
+
<span class="free-field-year-range simple-field">
|
|
3
3
|
<span v-if="Field.ReadOnly">
|
|
4
4
|
<span
|
|
5
5
|
:class="`field-label field-label-readonly ${(Field.Label && Field.Label.trim().length)
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
:options="minYearOptions"
|
|
20
20
|
:readonly="Field.ReadOnly"
|
|
21
21
|
@input="rangeChanged"
|
|
22
|
+
v-bind="inputControlSettings"
|
|
22
23
|
ref="input_field_validator_first"
|
|
23
24
|
>
|
|
24
25
|
<template v-slot:before v-if="Field.Label !== void 0">
|
|
@@ -32,13 +33,14 @@
|
|
|
32
33
|
</span>
|
|
33
34
|
</template>
|
|
34
35
|
</q-select>
|
|
35
|
-
<span class="
|
|
36
|
+
<span class="free-field-range-separator">{{`${Field.Separator || '~'}`}}</span>
|
|
36
37
|
<q-select
|
|
37
38
|
v-model="range.max"
|
|
38
39
|
hide-bottom-space
|
|
39
40
|
:options="maxYearOptions"
|
|
40
41
|
:readonly="Field.ReadOnly"
|
|
41
42
|
@input="rangeChanged"
|
|
43
|
+
v-bind="inputControlSettings"
|
|
42
44
|
ref="input_field_validator_second"
|
|
43
45
|
/>
|
|
44
46
|
</span>
|
|
@@ -89,7 +91,7 @@ export default defineComponent({
|
|
|
89
91
|
setup(props, { emit, expose }) {
|
|
90
92
|
if (!props.Field) return () => null;
|
|
91
93
|
|
|
92
|
-
const { fieldData, setFieldData } = useFreeField(props);
|
|
94
|
+
const { fieldData, setFieldData, inputControlSettings } = useFreeField(props);
|
|
93
95
|
|
|
94
96
|
const min = ref('');
|
|
95
97
|
const max = ref('');
|
|
@@ -175,6 +177,7 @@ export default defineComponent({
|
|
|
175
177
|
maxYearOptions,
|
|
176
178
|
|
|
177
179
|
rangeChanged,
|
|
180
|
+
inputControlSettings,
|
|
178
181
|
};
|
|
179
182
|
},
|
|
180
183
|
});
|
|
@@ -6,6 +6,7 @@ import fCategory from './Category.js';
|
|
|
6
6
|
import fCheck from './Check.js';
|
|
7
7
|
import fLabels from './Labels.vue';
|
|
8
8
|
import fNumber from './Number.js';
|
|
9
|
+
import fNumberRange from './NumberRange.vue';
|
|
9
10
|
import fPermission from './Permission.vue';
|
|
10
11
|
import fSearch from './Search.vue';
|
|
11
12
|
import fText from './Text.js';
|
|
@@ -17,25 +18,27 @@ import fYear from './Year.js';
|
|
|
17
18
|
import fYearRange from './YearRange.vue';
|
|
18
19
|
import fRadioList from './RadioList.vue';
|
|
19
20
|
import fBoolean from './Boolean.js';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
import fFile from './File.vue';
|
|
22
|
+
import fFileList from './FileList.vue';
|
|
23
|
+
import fFileListCombined from './FileListCombined.vue';
|
|
24
|
+
import fImage from './Image.vue';
|
|
25
|
+
import fImageList from './ImageList.vue';
|
|
26
|
+
import fImageListCombined from './ImageListCombined.vue';
|
|
24
27
|
import fFixedList from './FixedList.vue';
|
|
25
28
|
import fDynamicList from './DynamicList.js';
|
|
26
29
|
import fSingleList from './SingleList.vue';
|
|
27
30
|
import fSelectChain from './SelectionChain.vue';
|
|
28
31
|
import fRich from './Rich.vue';
|
|
29
|
-
import fFieldList from './
|
|
32
|
+
import fFieldList from './FreeFieldList.vue';
|
|
30
33
|
import fMixedTable from './MixedTable.vue';
|
|
31
34
|
import fCustomize from './Customize.js';
|
|
32
35
|
import fAgreementCheck from './AgreementCheck.js';
|
|
33
36
|
import fSeparator from './Separator.js';
|
|
34
37
|
import fQueryFilters from './QueryFilters.vue';
|
|
35
|
-
// import fFileListCombined from './FileListCombined.vue';
|
|
36
|
-
// import fImageListCombined from './ImageListCombined.vue';
|
|
37
38
|
import fApiCall from './ApiCall.js';
|
|
38
39
|
import fTabs from './Tabs.vue';
|
|
40
|
+
import fRow from './Row.vue';
|
|
41
|
+
import fColumn from './Column.vue';
|
|
39
42
|
|
|
40
43
|
export default {
|
|
41
44
|
Static: fStatic,
|
|
@@ -46,6 +49,7 @@ export default {
|
|
|
46
49
|
Check: fCheck,
|
|
47
50
|
Labels: fLabels,
|
|
48
51
|
Number: fNumber,
|
|
52
|
+
NumberRange: fNumberRange,
|
|
49
53
|
Permission: fPermission,
|
|
50
54
|
Search: fSearch,
|
|
51
55
|
Text: fText,
|
|
@@ -57,10 +61,12 @@ export default {
|
|
|
57
61
|
YearRange: fYearRange,
|
|
58
62
|
RadioList: fRadioList,
|
|
59
63
|
Boolean: fBoolean,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
File: fFile,
|
|
65
|
+
FileList: fFileList,
|
|
66
|
+
FileListCombined: fFileListCombined,
|
|
67
|
+
Image: fImage,
|
|
68
|
+
ImageList: fImageList,
|
|
69
|
+
ImageListCombined: fImageListCombined,
|
|
64
70
|
FixedList: fFixedList,
|
|
65
71
|
DynamicList: fDynamicList,
|
|
66
72
|
SingleList: fSingleList,
|
|
@@ -72,8 +78,9 @@ export default {
|
|
|
72
78
|
AgreementCheck: fAgreementCheck,
|
|
73
79
|
Separator: fSeparator,
|
|
74
80
|
QueryFilters: fQueryFilters,
|
|
75
|
-
// FileListCombined: fFileListCombined,
|
|
76
|
-
// ImageListCombined: fImageListCombined,
|
|
77
81
|
ApiCall: fApiCall,
|
|
82
|
+
|
|
78
83
|
Tabs: fTabs,
|
|
84
|
+
Row: fRow,
|
|
85
|
+
Column: fColumn,
|
|
79
86
|
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { freeFieldProps } from "./useFreeField";
|
|
14
14
|
import { useFormValidator } from '../../composible/useFormValidator';
|
|
15
15
|
|
|
16
|
+
import '../style.scss';
|
|
16
17
|
|
|
17
18
|
export default defineComponent({
|
|
18
19
|
name: "FreeFieldWrapper",
|
|
@@ -48,7 +49,7 @@ export default defineComponent({
|
|
|
48
49
|
lField.Rules.push(
|
|
49
50
|
(val) => {
|
|
50
51
|
const pVal = isRef(val) ? val.value : val;
|
|
51
|
-
return
|
|
52
|
+
return !!pVal;
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
}
|
|
@@ -71,6 +72,7 @@ export default defineComponent({
|
|
|
71
72
|
// eslint-disable-next-line no-eval
|
|
72
73
|
return eval(funcStr);
|
|
73
74
|
} catch (ex) {
|
|
75
|
+
console.error(ex)
|
|
74
76
|
return undefined;
|
|
75
77
|
}
|
|
76
78
|
};
|
|
@@ -154,13 +156,13 @@ export default defineComponent({
|
|
|
154
156
|
|
|
155
157
|
const warningSlot = (!props.noWarning && localField.value.Warning)
|
|
156
158
|
&& h('span', {
|
|
157
|
-
class: '
|
|
159
|
+
class: 'free-field-warning no-wrap',
|
|
158
160
|
},
|
|
159
161
|
[
|
|
160
|
-
h('span', { class: '
|
|
161
|
-
h('span', { class: '
|
|
162
|
-
h('span', { class: '
|
|
163
|
-
h('span', { class: '
|
|
162
|
+
h('span', { class: 'free-field-warning-icon' }),
|
|
163
|
+
h('span', { class: 'free-field-warning-icon-sign-top' }),
|
|
164
|
+
h('span', { class: 'free-field-warning-icon-sign-dot' }),
|
|
165
|
+
h('span', { class: 'free-field-warning-text ellipsis' }, localField.value.Warning),
|
|
164
166
|
]
|
|
165
167
|
);
|
|
166
168
|
|
|
@@ -169,7 +171,7 @@ export default defineComponent({
|
|
|
169
171
|
watchEffect(() => {
|
|
170
172
|
(realComponent?.value?.emits || []).forEach((em) => {
|
|
171
173
|
if (!em || em === 'input') return;
|
|
172
|
-
|
|
174
|
+
|
|
173
175
|
const captEm = `${em[0].toUpperCase()}${em.substring(1)}`;
|
|
174
176
|
compEmits.value[`on${captEm}`] = (...args) => {
|
|
175
177
|
// should not emit event directly as we were not inlucde these events in the emits list
|
|
@@ -184,7 +186,7 @@ export default defineComponent({
|
|
|
184
186
|
});
|
|
185
187
|
})
|
|
186
188
|
|
|
187
|
-
const
|
|
189
|
+
const realComp = computed(() => realComponent.value && h(
|
|
188
190
|
realComponent.value,
|
|
189
191
|
{
|
|
190
192
|
Field: localField.value,
|
|
@@ -204,25 +206,149 @@ export default defineComponent({
|
|
|
204
206
|
warning: slots.warning ? slots.warning : () => warningSlot,
|
|
205
207
|
}
|
|
206
208
|
));
|
|
207
|
-
|
|
209
|
+
|
|
208
210
|
// const emitsRef = computed(() => realComponent?.value?.emits);
|
|
209
211
|
|
|
210
212
|
const {
|
|
211
213
|
validate,
|
|
212
|
-
} = useFormValidator(
|
|
214
|
+
} = useFormValidator(realComp);
|
|
213
215
|
|
|
214
216
|
expose ({
|
|
215
217
|
// emits: emitsRef.value,
|
|
216
218
|
validate: () => validate.value(props.Field.Name),
|
|
217
219
|
})
|
|
218
220
|
|
|
221
|
+
const fieldTip = (tip) => {
|
|
222
|
+
if (!tip || !tip.Text) return '';
|
|
223
|
+
if (!tip.Links || !Array.isArray(tip.Links) || tip.Links.length <= 0) {
|
|
224
|
+
return [{ Text: tip.Text }];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// process tip with links
|
|
228
|
+
let linkPos = [];
|
|
229
|
+
tip.Links.forEach((tl) => {
|
|
230
|
+
if (!tl || !tl.Text) return;
|
|
231
|
+
|
|
232
|
+
const start = tip.Text.indexOf(tl.Text);
|
|
233
|
+
if (start >= 0) {
|
|
234
|
+
linkPos.push({
|
|
235
|
+
...tl,
|
|
236
|
+
start,
|
|
237
|
+
end: start + tl.Text.length,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const textSplit = [];
|
|
243
|
+
let start = 0;
|
|
244
|
+
linkPos = linkPos.sort((a, b) => a.start - b.start);
|
|
245
|
+
for (let i = 0; i < linkPos.length; i += 1) {
|
|
246
|
+
const lp = linkPos[i];
|
|
247
|
+
|
|
248
|
+
const beforeText = tip.Text.substr(start, lp.start - start);
|
|
249
|
+
if (beforeText) {
|
|
250
|
+
textSplit.push({ Text: beforeText });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
textSplit.push({
|
|
254
|
+
...lp,
|
|
255
|
+
Text: tip.Text.substr(lp.start, lp.end - lp.start),
|
|
256
|
+
Link:
|
|
257
|
+
!!lp.File && lp.isFile
|
|
258
|
+
? vm.$filter('serverDocument', lp.File)
|
|
259
|
+
: lp.Link,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
start = lp.end;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const afterText = tip.Text.substr(start);
|
|
266
|
+
if (afterText) {
|
|
267
|
+
textSplit.push({
|
|
268
|
+
Text: afterText,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (textSplit.length > 0) return textSplit;
|
|
273
|
+
|
|
274
|
+
return [{ Text: tip.Text }];
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const tipsElem = !shouldHide.value && !props.noTips && (localField.value.Tips?.length > 0) && h(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
class: "free-field-tips",
|
|
281
|
+
},
|
|
282
|
+
[
|
|
283
|
+
h("span", {
|
|
284
|
+
class: "free-field-tips-prefix",
|
|
285
|
+
}),
|
|
286
|
+
h("span", {
|
|
287
|
+
class: "tips-list",
|
|
288
|
+
},
|
|
289
|
+
[
|
|
290
|
+
localField.value.Tips.map((tip) => h("span", {
|
|
291
|
+
class: "free-field-tips-tip",
|
|
292
|
+
},
|
|
293
|
+
[
|
|
294
|
+
h("span", {
|
|
295
|
+
class: "free-field-tips-tip-prefix",
|
|
296
|
+
}),
|
|
297
|
+
fieldTip(tip).map(
|
|
298
|
+
(t) => h("span", null, [
|
|
299
|
+
t.Link ? h("span", {
|
|
300
|
+
class: "tip-link",
|
|
301
|
+
}, [
|
|
302
|
+
h("span", {
|
|
303
|
+
class: "tip-link-prefix",
|
|
304
|
+
}),
|
|
305
|
+
t.File ? h("a", {
|
|
306
|
+
href: t.Link,
|
|
307
|
+
target: t.target || '_blank',
|
|
308
|
+
download: `${t.Text}${t.File && t.File.substr(t.File.lastIndexOf('.'))}`,
|
|
309
|
+
}, t.Text) : h("a", {
|
|
310
|
+
href: t.Link,
|
|
311
|
+
target: t.target || '_blank',
|
|
312
|
+
}, t.Text),
|
|
313
|
+
h("span", {
|
|
314
|
+
class: "tip-link-postfix",
|
|
315
|
+
}),
|
|
316
|
+
]) : (t.File ? h("span", {
|
|
317
|
+
class: "tip-text",
|
|
318
|
+
}, [
|
|
319
|
+
h("span", {
|
|
320
|
+
class: "tip-link-prefix",
|
|
321
|
+
}),
|
|
322
|
+
t.File,
|
|
323
|
+
h("span", {
|
|
324
|
+
class: "tip-link-postfix",
|
|
325
|
+
}),
|
|
326
|
+
]) : h("span", {
|
|
327
|
+
class: "tip-text",
|
|
328
|
+
}, t.Text))
|
|
329
|
+
])
|
|
330
|
+
),
|
|
331
|
+
h("span", {
|
|
332
|
+
class: "free-field-tips-tip-postfix",
|
|
333
|
+
}),
|
|
334
|
+
]
|
|
335
|
+
)),
|
|
336
|
+
]),
|
|
337
|
+
h('span', {
|
|
338
|
+
class: 'free-field-tips-postfix',
|
|
339
|
+
})
|
|
340
|
+
]
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
|
|
219
344
|
return realComponent.value ? () => h(
|
|
220
345
|
"div",
|
|
221
346
|
{
|
|
222
347
|
class: wrapperClass,
|
|
223
348
|
},
|
|
224
349
|
[
|
|
225
|
-
|
|
350
|
+
realComp.value,
|
|
351
|
+
tipsElem,
|
|
226
352
|
]
|
|
227
353
|
) : () => null;
|
|
228
354
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive, getCurrentInstance, watchEffect } from "vue";
|
|
1
|
+
import { reactive, getCurrentInstance, watchEffect, computed } from "vue";
|
|
2
2
|
|
|
3
3
|
export const freeFieldProps = {
|
|
4
4
|
values: { type: Object },
|
|
@@ -11,24 +11,28 @@ export function useFreeField(props, ctx) {
|
|
|
11
11
|
|
|
12
12
|
watchEffect(() => {
|
|
13
13
|
let realData = void 0;
|
|
14
|
-
|
|
14
|
+
let usingDft = false;
|
|
15
|
+
|
|
15
16
|
if (!props.Field) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
if (!props.Field.Name) {
|
|
20
|
-
realData = props.Field.Value || props.Field.Default ||
|
|
21
|
+
realData = props.Field.Value || props.Field.Default || void 0;
|
|
22
|
+
usingDft = true;
|
|
21
23
|
} else {
|
|
22
|
-
if (props.Field.Info?.Dynamic && props.Field.Value) {
|
|
24
|
+
if (props.Field.Info?.Dynamic && props.Field.Value !== void 0) {
|
|
23
25
|
realData = props.Field.Value;
|
|
26
|
+
usingDft = true;
|
|
24
27
|
} else {
|
|
25
28
|
realData = Object.nestValue(props.values, props.Field?.Name);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
// set to default if still undefined
|
|
30
|
-
if ((realData === void 0 || realData === null) && (props.Field.Value || props.Field.Default)) {
|
|
33
|
+
if ((realData === void 0 || realData === null) && ((props.Field.Value !== void 0) || (props.Field.Default !== void 0))) {
|
|
31
34
|
realData = props.Field.Value || props.Field.Default;
|
|
35
|
+
usingDft = true;
|
|
32
36
|
|
|
33
37
|
// for non-dynamic field, which have refer data, we should save this data into the field
|
|
34
38
|
if (props.Field.ReferTo && !props.Field.Info?.Dynamic) {
|
|
@@ -52,14 +56,25 @@ export function useFreeField(props, ctx) {
|
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
// show NaN placeholder
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
// // show NaN placeholder
|
|
60
|
+
// TODO: return the placeholder here will not work as expected
|
|
61
|
+
// if ((realData === void 0 || realData === null || realData === '') && props.Field?.Info?.ShowNaN) {
|
|
62
|
+
// return vm.ctx.config.nanPlaceholder || '';
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// if we are using a default value for this field, we should set the default value to the values object
|
|
66
|
+
// so that we can get such value from anywhere else immediately
|
|
67
|
+
if (usingDft) {
|
|
68
|
+
Object.setValue(props.values, props.Field?.Name, props.Field.Value || props.Field.Default || void 0);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
fieldData.value = realData;
|
|
61
72
|
});
|
|
62
73
|
|
|
74
|
+
const inputControlSettings = computed(() => {
|
|
75
|
+
return vm.ctx.config['core-modules']?.inputControlSettings || {};
|
|
76
|
+
});
|
|
77
|
+
|
|
63
78
|
return {
|
|
64
79
|
fieldData,
|
|
65
80
|
getFieldData: (n) => Object.nestValue(props.values, n),
|
|
@@ -72,5 +87,6 @@ export function useFreeField(props, ctx) {
|
|
|
72
87
|
setData: (n, v) => {
|
|
73
88
|
Object.setValue(props.values, n, v);
|
|
74
89
|
},
|
|
90
|
+
inputControlSettings,
|
|
75
91
|
}
|
|
76
92
|
};
|