@stemy/ngx-dynamic-form 13.2.0 → 13.2.2
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/esm2020/ngx-dynamic-form/services/dynamic-form.service.mjs +4 -1
- package/esm2020/ngx-dynamic-form/utils/creators.mjs +41 -41
- package/fesm2015/stemy-ngx-dynamic-form.mjs +43 -40
- package/fesm2015/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/fesm2020/stemy-ngx-dynamic-form.mjs +43 -40
- package/fesm2020/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/utils/creators.d.ts +12 -10
- package/package.json +1 -1
|
@@ -203,64 +203,64 @@ class DynamicSelectModel extends DynamicSelectModel$1 {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
function createFormConfig(id, config) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return
|
|
206
|
+
const res = (config || { id });
|
|
207
|
+
res.id = id;
|
|
208
|
+
res.label = ObjectUtils.isNullOrUndefined(config.label) ? id : config.label;
|
|
209
|
+
res.disabled = config.disabled || false;
|
|
210
|
+
res.hidden = config.hidden || false;
|
|
211
|
+
return res;
|
|
212
212
|
}
|
|
213
213
|
function createFormCheckbox(id, config, layout) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return new DynamicCheckboxModel(
|
|
214
|
+
const res = createFormConfig(id, config);
|
|
215
|
+
res.indeterminate = config.indeterminate || false;
|
|
216
|
+
return new DynamicCheckboxModel(res, layout);
|
|
217
217
|
}
|
|
218
218
|
function createFormDate(id, config, layout) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return new DynamicDatePickerModel(
|
|
219
|
+
const res = createFormConfig(id, config);
|
|
220
|
+
res.autoFocus = config.autoFocus || false;
|
|
221
|
+
res.focusedDate = config.focusedDate || new Date();
|
|
222
|
+
res.inline = config.inline || false;
|
|
223
|
+
return new DynamicDatePickerModel(res, layout);
|
|
224
224
|
}
|
|
225
225
|
function createFormEditor(id, config, layout) {
|
|
226
|
-
|
|
227
|
-
return new DynamicEditorModel(
|
|
226
|
+
const res = createFormConfig(id, config);
|
|
227
|
+
return new DynamicEditorModel(res, layout);
|
|
228
228
|
}
|
|
229
229
|
function createFormArray(id, config, layout) {
|
|
230
|
-
|
|
231
|
-
return new DynamicFormArrayModel(
|
|
230
|
+
const res = createFormConfig(id, config);
|
|
231
|
+
return new DynamicFormArrayModel(res, layout);
|
|
232
232
|
}
|
|
233
233
|
function createFormGroup(id, config, layout) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return new DynamicFormGroupModel(
|
|
234
|
+
const res = createFormConfig(id, config);
|
|
235
|
+
res.name = config.name || "";
|
|
236
|
+
return new DynamicFormGroupModel(res, layout);
|
|
237
237
|
}
|
|
238
238
|
function createFormInput(id, config, type = "text", layout) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
return new DynamicInputModel(
|
|
239
|
+
const res = createFormConfig(id, config);
|
|
240
|
+
res.inputType = config.inputType || type;
|
|
241
|
+
res.placeholder = config.placeholder || (config.inputType == "mask" ? "_" : "");
|
|
242
|
+
res.step = config.step || 1;
|
|
243
|
+
res.mask = config.mask || null;
|
|
244
|
+
return new DynamicInputModel(res, layout);
|
|
245
245
|
}
|
|
246
246
|
function createFormSelect(id, config, layout) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return new DynamicSelectModel(
|
|
247
|
+
const res = createFormConfig(id, config);
|
|
248
|
+
res.options = config.options || [];
|
|
249
|
+
return new DynamicSelectModel(res, layout);
|
|
250
250
|
}
|
|
251
251
|
function createFormTextarea(id, config, layout) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return new DynamicTextAreaModel(
|
|
252
|
+
const res = createFormConfig(id, config);
|
|
253
|
+
res.cols = config.cols || 10;
|
|
254
|
+
res.rows = config.rows || 3;
|
|
255
|
+
res.wrap = config.wrap || "soft";
|
|
256
|
+
return new DynamicTextAreaModel(res, layout);
|
|
257
257
|
}
|
|
258
258
|
function createFormFile(id, config, layout) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return new DynamicFileUploadModel(
|
|
259
|
+
const res = createFormConfig(id, config);
|
|
260
|
+
res.accept = config.accept || ["jpg", "jpeg", "png"];
|
|
261
|
+
res.multiple = config.multiple || false;
|
|
262
|
+
res.url = ObjectUtils.isString(config.url) ? config.url : "assets";
|
|
263
|
+
return new DynamicFileUploadModel(res, layout);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
function isStringWithVal(val) {
|
|
@@ -722,6 +722,9 @@ class DynamicFormService extends DynamicFormService$1 {
|
|
|
722
722
|
getFormInputConfig(property, schema) {
|
|
723
723
|
let inputType = StringUtils.has(property.id, "password", "Password") ? "password" : (property.format || property.items?.type || property.type);
|
|
724
724
|
switch (inputType) {
|
|
725
|
+
case "string":
|
|
726
|
+
inputType = "text";
|
|
727
|
+
break;
|
|
725
728
|
case "boolean":
|
|
726
729
|
inputType = "checkbox";
|
|
727
730
|
break;
|