free-fe-core-modules 0.1.13 → 0.1.15
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/free-field/Fields/AgreementCheck.js +11 -4
- package/free-field/Fields/Check.js +13 -1
- package/free-field/Fields/File.vue +1 -1
- package/free-field/Fields/FileList.vue +1 -1
- package/free-field/Fields/FreeFieldList.vue +1 -1
- package/free-field/Fields/Image.vue +1 -1
- package/free-field/Fields/ImageList.vue +1 -1
- package/free-field/Fields/Rich.vue +1 -1
- package/free-field/Fields/Row.vue +5 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, ref, getCurrentInstance,
|
|
1
|
+
import { defineComponent, h, ref, getCurrentInstance, watch } from 'vue';
|
|
2
2
|
import { QCheckbox, QIcon } from 'quasar';
|
|
3
3
|
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ export default defineComponent({
|
|
|
21
21
|
...freeFieldProps,
|
|
22
22
|
},
|
|
23
23
|
emits: ['input'],
|
|
24
|
-
setup(props, { emit }){
|
|
24
|
+
setup(props, { emit, expose }){
|
|
25
25
|
if (!props.Field) return {};
|
|
26
26
|
|
|
27
27
|
const { proxy:vm } = getCurrentInstance();
|
|
@@ -86,7 +86,8 @@ export default defineComponent({
|
|
|
86
86
|
const validate = () => {
|
|
87
87
|
if (props.Field.Required) {
|
|
88
88
|
hasError.value = typeof fieldData.value === 'undefined' || !fieldData.value;
|
|
89
|
-
|
|
89
|
+
|
|
90
|
+
if (hasError.value) return false;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
const rules = Array.isArray(typeof props.Field.Rules)
|
|
@@ -100,13 +101,19 @@ export default defineComponent({
|
|
|
100
101
|
if (typeof r === 'function') {
|
|
101
102
|
isValid = isValid && r(fieldData.value);
|
|
102
103
|
}
|
|
104
|
+
|
|
105
|
+
if (!isValid) return false;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
hasError.value = !isValid;
|
|
106
109
|
return isValid;
|
|
107
110
|
};
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
watch(() => fieldData.value, () => {
|
|
113
|
+
validate();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
expose({
|
|
110
117
|
validate,
|
|
111
118
|
})
|
|
112
119
|
|
|
@@ -69,7 +69,7 @@ export default defineComponent({
|
|
|
69
69
|
...freeFieldProps,
|
|
70
70
|
},
|
|
71
71
|
emits: ['input'],
|
|
72
|
-
setup(props, { emit, slots }){
|
|
72
|
+
setup(props, { emit, slots, expose }){
|
|
73
73
|
if (!props.Field) return {};
|
|
74
74
|
|
|
75
75
|
const { fieldData, setFieldData } = useFreeField(props);
|
|
@@ -86,6 +86,14 @@ export default defineComponent({
|
|
|
86
86
|
class: 'field-label-empty'
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
+
const validate = () => {
|
|
90
|
+
if (props.Field?.Required) {
|
|
91
|
+
return fieldData.value === true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
|
|
89
97
|
const checkboxNode = () => h(QCheckbox, {
|
|
90
98
|
disable: props.Field?.ReadOnly,
|
|
91
99
|
label: props.Field?.showLabel ? '' : props.Field?.Label,
|
|
@@ -96,6 +104,10 @@ export default defineComponent({
|
|
|
96
104
|
'onUpdate:modelValue': (v) => {
|
|
97
105
|
setFieldData(v, emit);
|
|
98
106
|
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expose({
|
|
110
|
+
validate,
|
|
99
111
|
})
|
|
100
112
|
|
|
101
113
|
return () => h('div', {
|
|
@@ -114,7 +114,7 @@ function parseStaticResourceParams(paramStr, route) {
|
|
|
114
114
|
|
|
115
115
|
let finalParamStr = paramStr || '';
|
|
116
116
|
|
|
117
|
-
const paramList = paramStr.match(/\{[
|
|
117
|
+
const paramList = paramStr.match(/\{[^\\}]+\}/g);
|
|
118
118
|
const paramValuesMap = {};
|
|
119
119
|
for (let i = 0; i < paramList.length; i += 1) {
|
|
120
120
|
const varItem = paramList[i];
|
|
@@ -136,7 +136,7 @@ function parseStaticResourceParams(paramStr, route) {
|
|
|
136
136
|
|
|
137
137
|
let finalParamStr = paramStr || '';
|
|
138
138
|
|
|
139
|
-
const paramList = paramStr.match(/\{[
|
|
139
|
+
const paramList = paramStr.match(/\{[^\\}]+\}/g);
|
|
140
140
|
const paramValuesMap = {};
|
|
141
141
|
for (let i = 0; i < paramList.length; i += 1) {
|
|
142
142
|
const varItem = paramList[i];
|
|
@@ -123,7 +123,7 @@ function parseStaticResourceParams(paramStr, route) {
|
|
|
123
123
|
|
|
124
124
|
let finalParamStr = paramStr || '';
|
|
125
125
|
|
|
126
|
-
const paramList = paramStr.match(/\{[
|
|
126
|
+
const paramList = paramStr.match(/\{[^\\}]+\}/g);
|
|
127
127
|
const paramValuesMap = {};
|
|
128
128
|
for (let i = 0; i < paramList.length; i += 1) {
|
|
129
129
|
const varItem = paramList[i];
|
|
@@ -115,7 +115,7 @@ function parseStaticResourceParams(paramStr, route) {
|
|
|
115
115
|
|
|
116
116
|
let finalParamStr = paramStr || '';
|
|
117
117
|
|
|
118
|
-
const paramList = paramStr.match(/\{[
|
|
118
|
+
const paramList = paramStr.match(/\{[^\\}]+\}/g);
|
|
119
119
|
const paramValuesMap = {};
|
|
120
120
|
for (let i = 0; i < paramList.length; i += 1) {
|
|
121
121
|
const varItem = paramList[i];
|
|
@@ -371,7 +371,7 @@ export default defineComponent({
|
|
|
371
371
|
},
|
|
372
372
|
}).then((res) => {
|
|
373
373
|
if (res && res.data && res.data.id) {
|
|
374
|
-
resolve(`${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}${
|
|
374
|
+
resolve(`${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}${vm.ctx.config.imageUrlBase}${res.data.id}${props.Field.Options?.UploadedImageUrlArgs || ''}`);
|
|
375
375
|
} else {
|
|
376
376
|
reject({
|
|
377
377
|
message: '上传失败',
|
|
@@ -138,7 +138,11 @@ export default defineComponent({
|
|
|
138
138
|
},
|
|
139
139
|
computed: {
|
|
140
140
|
rowClasses() {
|
|
141
|
-
|
|
141
|
+
const wrap = this.Field.Options?.NoWrap ? 'nowrap' : '';
|
|
142
|
+
const itemsAlign = this.Field.Options?.ItemsAlign || '';
|
|
143
|
+
const justifyAlign = this.Field.Options?.JustifyAlign || '';
|
|
144
|
+
|
|
145
|
+
return [wrap, itemsAlign, justifyAlign].filter((cls) => cls).join(' ');
|
|
142
146
|
},
|
|
143
147
|
},
|
|
144
148
|
});
|