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.
@@ -109,7 +109,6 @@ import EIcon from '../Basic/EIcon.vue';
109
109
 
110
110
  export default defineComponent({
111
111
  name: 'BasicDialog',
112
- // mixins: [mixins.InputFieldValidator],
113
112
  emits: ['hide', 'ok', 'cancel'],
114
113
  props: {
115
114
  persistent: { type: Boolean, default: true },
@@ -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="$emit('input', field)"></free-field>
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
- setup(props) {
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: {
@@ -224,7 +224,7 @@ export default defineComponent({
224
224
  for (let i = 0; i < tableData.value.length; i += 1) {
225
225
  const td = tableData.value[i];
226
226
 
227
- td.auto__index = td.auto__index || i;
227
+ td.auto__index = i;
228
228
  }
229
229
  }
230
230
  });
@@ -334,8 +334,6 @@ export default defineComponent({
334
334
  }
335
335
  }
336
336
 
337
- console.log('uploadedFiles', uploadedFiles);
338
-
339
337
  setFieldData(uploadedFiles, emit);
340
338
  selfValidate();
341
339
  }
@@ -392,8 +392,6 @@ export default defineComponent({
392
392
  // ...(uploader.value?.files || []),
393
393
  // ];
394
394
 
395
- console.log('allFiles', fieldData.value, localFiles.value);
396
-
397
395
  return [].concat(fieldData.value || []).concat(localFiles.value)
398
396
  });
399
397
 
@@ -165,6 +165,7 @@
165
165
  round size="20px"
166
166
  @click="showPreview=false"></q-icon>
167
167
  <q-img
168
+ fit="contain"
168
169
  v-if="previewType === 'image'"
169
170
  contain :src="previewFile"
170
171
  @click="showPreview=false"
@@ -301,8 +301,6 @@ export default defineComponent({
301
301
  // ...(uploader.value?.files || []),
302
302
  // ];
303
303
 
304
- console.log('allFiles', fieldData.value, localFiles.value);
305
-
306
304
  return [].concat(fieldData.value || []).concat(localFiles.value)
307
305
  });
308
306
 
@@ -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="$emit('input', field)"></free-field>
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
- setup(props) {
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 ? searchData.docs : []"
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
- {search: this.searchKey, ...(p ? {page: p} : {})}
437
+ reqBody,
429
438
  )
430
439
  .then((d) => {
431
440
  if (d && d.msg === 'OK') {
@@ -61,6 +61,8 @@
61
61
  :use-chips="Field && (Field.UseChip || (Field.Info && Field.Info.Chip))"
62
62
  v-bind="inputControlSettings"
63
63
  :rules="Field.Rules"
64
+
65
+ :new-value-mode="Field?.NewValueMode ? 'add' : undefined"
64
66
  >
65
67
  <template v-slot:before>
66
68
  <span
@@ -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
- onInput: () => {
200
- emit("input", props.Field);
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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/freeeis/free-fe-core-modules.git",
6
6
  "author": "zhiquan",