free-fe-core-modules 0.0.37 → 0.0.39
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/Dialog/BasicDialog.vue +0 -1
- package/free-field/Fields/Column.vue +12 -4
- package/free-field/Fields/DynamicList.js +1 -1
- package/free-field/Fields/File.vue +0 -2
- package/free-field/Fields/FileList.vue +0 -2
- package/free-field/Fields/Image.vue +1 -0
- package/free-field/Fields/ImageList.vue +0 -2
- package/free-field/Fields/Number.js +0 -1
- package/free-field/Fields/Row.vue +12 -5
- package/free-field/Fields/Search.vue +11 -2
- package/free-field/Fields/Select.vue +2 -0
- package/free-field/Fields/Tabs.vue +10 -0
- package/free-field/composible/fieldWrapper.js +7 -2
- package/package.json +1 -1
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
<free-field
|
|
4
4
|
v-for="(field, idx) in Field.Options?.Fields"
|
|
5
5
|
:Field="field"
|
|
6
|
-
:values="fieldData"
|
|
6
|
+
:values="fieldData.value"
|
|
7
7
|
:key="idx"
|
|
8
8
|
ref="fieldsToValidate"
|
|
9
|
-
@input="
|
|
9
|
+
@input="changed"></free-field>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
14
|
import { defineComponent } from 'vue';
|
|
15
|
-
import { freeFieldProps } from '../composible/useFreeField';
|
|
15
|
+
import { freeFieldProps, useFreeField } from '../composible/useFreeField';
|
|
16
16
|
import { useFormValidator} from '../../composible/useFormValidator';
|
|
17
17
|
|
|
18
18
|
export default defineComponent({
|
|
@@ -119,13 +119,21 @@ export default defineComponent({
|
|
|
119
119
|
],
|
|
120
120
|
Description: '',
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
emits: ['input'],
|
|
123
|
+
setup(props, { emit }) {
|
|
123
124
|
if(!props.Field) return () => null;
|
|
124
125
|
|
|
126
|
+
const { fieldData } = useFreeField(props);
|
|
125
127
|
const { validate } = useFormValidator('fieldsToValidate');
|
|
126
128
|
|
|
127
129
|
return {
|
|
130
|
+
fieldData,
|
|
128
131
|
validate,
|
|
132
|
+
|
|
133
|
+
changed: (fld) => {
|
|
134
|
+
const newValue = props.Field.Name === '.' ? Object.nestValue(fieldData, fld.Name) : fieldData;
|
|
135
|
+
emit('input', newValue, props.Field.Name === '.' ? fld : props.Field);
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
},
|
|
131
139
|
computed: {
|
|
@@ -149,7 +149,6 @@ export default defineComponent({
|
|
|
149
149
|
|
|
150
150
|
if (props.Field.Options.IntegerOnly) {
|
|
151
151
|
const ll = props.Field.Options.MaxLength || 15;
|
|
152
|
-
console.log('mask', Array.from({length: ll}).map(() => '#').join(''))
|
|
153
152
|
return Array.from({length: ll}).map(() => '#').join('');
|
|
154
153
|
}
|
|
155
154
|
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
<free-field
|
|
4
4
|
v-for="(field, idx) in Field.Options?.Fields"
|
|
5
5
|
:Field="field"
|
|
6
|
-
:values="fieldData"
|
|
6
|
+
:values="fieldData.value"
|
|
7
7
|
:key="idx"
|
|
8
8
|
ref="fieldsToValidate"
|
|
9
|
-
@input="
|
|
9
|
+
@input="changed"></free-field>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
// TODO: correct the validations
|
|
15
14
|
import { defineComponent } from 'vue';
|
|
16
|
-
import { freeFieldProps } from '../composible/useFreeField';
|
|
15
|
+
import { freeFieldProps, useFreeField } from '../composible/useFreeField';
|
|
17
16
|
import { useFormValidator} from '../../composible/useFormValidator';
|
|
18
17
|
|
|
19
18
|
export default defineComponent({
|
|
@@ -120,13 +119,21 @@ export default defineComponent({
|
|
|
120
119
|
],
|
|
121
120
|
Description: '',
|
|
122
121
|
},
|
|
123
|
-
|
|
122
|
+
emits: ['input'],
|
|
123
|
+
setup(props, { emit }) {
|
|
124
124
|
if(!props.Field) return () => null;
|
|
125
125
|
|
|
126
|
+
const { fieldData } = useFreeField(props);
|
|
126
127
|
const { validate } = useFormValidator('fieldsToValidate');
|
|
127
128
|
|
|
128
129
|
return {
|
|
130
|
+
fieldData,
|
|
129
131
|
validate,
|
|
132
|
+
|
|
133
|
+
changed: (fld) => {
|
|
134
|
+
const newValue = props.Field.Name === '.' ? Object.nestValue(fieldData, fld.Name) : fieldData;
|
|
135
|
+
emit('input', newValue, props.Field.Name === '.' ? fld : props.Field);
|
|
136
|
+
}
|
|
130
137
|
}
|
|
131
138
|
},
|
|
132
139
|
computed: {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<q-table
|
|
29
29
|
:flat="Field.Options?.Flat"
|
|
30
30
|
:bordered="Field.Options?.Bordered"
|
|
31
|
-
:rows="searchData
|
|
31
|
+
:rows="searchData.docs || []"
|
|
32
32
|
:columns="searchColumns"
|
|
33
33
|
row-key="id"
|
|
34
34
|
:pagination="searchPagination"
|
|
@@ -200,6 +200,12 @@ export default defineComponent({
|
|
|
200
200
|
Name: 'Options.SearchField',
|
|
201
201
|
Default: 'id',
|
|
202
202
|
},
|
|
203
|
+
{
|
|
204
|
+
Type: 'String',
|
|
205
|
+
Label: '搜索传输字段名',
|
|
206
|
+
Name: 'Options.SearchKeyName',
|
|
207
|
+
Default: 'search',
|
|
208
|
+
},
|
|
203
209
|
{
|
|
204
210
|
Type: 'String',
|
|
205
211
|
Label: '显示字段',
|
|
@@ -423,9 +429,12 @@ export default defineComponent({
|
|
|
423
429
|
return;
|
|
424
430
|
}
|
|
425
431
|
|
|
432
|
+
const reqBody = {...(p ? {page: p} : {})};
|
|
433
|
+
reqBody[this.Field.Options?.SearchKeyName || 'search'] = this.searchKey;
|
|
434
|
+
|
|
426
435
|
this.getRequest(
|
|
427
436
|
this.Field.Options.SearchUrl,
|
|
428
|
-
|
|
437
|
+
reqBody,
|
|
429
438
|
)
|
|
430
439
|
.then((d) => {
|
|
431
440
|
if (d && d.msg === 'OK') {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
v-for="(t, idx) in fieldData.value" :key="idx"
|
|
38
38
|
:name="idx">
|
|
39
39
|
<free-field
|
|
40
|
+
:class="`${Field.Options.HideFieldWhenEmpty ? `free-field-tabs-panel-field-${Object.nestValue(t, field.Name) === void 0 ? 'empty' : 'with-value'}` : ''}`"
|
|
40
41
|
v-for="(field, idx) in Field.Options?.Fields"
|
|
41
42
|
:Field="field"
|
|
42
43
|
:values="t"
|
|
@@ -72,6 +73,11 @@ export default defineComponent({
|
|
|
72
73
|
Label: '数值字段名',
|
|
73
74
|
Name: 'Options.ValueField',
|
|
74
75
|
},
|
|
76
|
+
{
|
|
77
|
+
Type: 'Boolean',
|
|
78
|
+
Label: '子字段值不存在时隐藏',
|
|
79
|
+
Name: 'Options.HideFieldWhenEmpty',
|
|
80
|
+
},
|
|
75
81
|
{
|
|
76
82
|
Label: '字段',
|
|
77
83
|
Name: 'Options.Fields',
|
|
@@ -157,5 +163,9 @@ export default defineComponent({
|
|
|
157
163
|
border-bottom: 1px solid;
|
|
158
164
|
}
|
|
159
165
|
}
|
|
166
|
+
|
|
167
|
+
.input-field-tabs-panel-field-empty {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
160
170
|
}
|
|
161
171
|
</style>
|
|
@@ -196,8 +196,13 @@ export default defineComponent({
|
|
|
196
196
|
props.Field.ReadOnly ? "free-field--readonly" : "",
|
|
197
197
|
!shouldHide.value && hasError.value ? "hasError" : "",
|
|
198
198
|
],
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @param {any} _ value of the changed field
|
|
202
|
+
* @param {Field} fld the changed field (optional)
|
|
203
|
+
*/
|
|
204
|
+
onInput: (_, fld) => {
|
|
205
|
+
emit("input", fld || props.Field);
|
|
201
206
|
},
|
|
202
207
|
...compEmits.value,
|
|
203
208
|
},
|