@dignite-ng/expand.dynamic-form 0.0.6 → 0.0.8

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.
Files changed (40) hide show
  1. package/esm2022/lib/components/dynamic/dynamic.component.mjs +18 -7
  2. package/esm2022/lib/components/from/ck-editor/ck-editor-control.component.mjs +1 -2
  3. package/esm2022/lib/components/from/date-edit/date-edit-config.mjs +1 -8
  4. package/esm2022/lib/components/from/file-explorer/file-explorer-config.mjs +1 -3
  5. package/esm2022/lib/components/from/form-control-group.mjs +20 -17
  6. package/esm2022/lib/components/from/index.mjs +3 -3
  7. package/esm2022/lib/components/from/matrix/index.mjs +4 -0
  8. package/esm2022/lib/components/from/matrix/matrix-config.component.mjs +225 -0
  9. package/esm2022/lib/components/from/matrix/matrix-config.mjs +50 -0
  10. package/esm2022/lib/components/from/matrix/matrix-control.component.mjs +110 -0
  11. package/esm2022/lib/components/from/numeric-edit/numberic-edit-config.mjs +1 -2
  12. package/esm2022/lib/components/from/select/select-config.component.mjs +1 -1
  13. package/esm2022/lib/components/from/select/select-config.mjs +1 -2
  14. package/esm2022/lib/components/from/switch/switch-config.mjs +1 -2
  15. package/esm2022/lib/components/from/switch/switch-control.component.mjs +5 -4
  16. package/esm2022/lib/components/from/table/index.mjs +4 -0
  17. package/esm2022/lib/components/from/table/table-config.component.mjs +171 -0
  18. package/esm2022/lib/components/from/table/table-config.mjs +38 -0
  19. package/esm2022/lib/components/from/table/table-control.component.mjs +112 -0
  20. package/esm2022/lib/components/from/text-edit/text-edit-config.mjs +2 -8
  21. package/esm2022/lib/components/from/text-edit/text-edit.component.mjs +2 -2
  22. package/esm2022/lib/dynamic-form.module.mjs +22 -6
  23. package/fesm2022/dignite-ng-expand.dynamic-form.mjs +736 -63
  24. package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
  25. package/lib/components/dynamic/dynamic.component.d.ts +7 -4
  26. package/lib/components/from/date-edit/date-edit-config.d.ts +0 -1
  27. package/lib/components/from/form-control-group.d.ts +1 -1
  28. package/lib/components/from/index.d.ts +2 -0
  29. package/lib/components/from/matrix/index.d.ts +3 -0
  30. package/lib/components/from/matrix/matrix-config.component.d.ts +72 -0
  31. package/lib/components/from/matrix/matrix-config.d.ts +24 -0
  32. package/lib/components/from/matrix/matrix-control.component.d.ts +39 -0
  33. package/lib/components/from/switch/switch-control.component.d.ts +1 -1
  34. package/lib/components/from/table/index.d.ts +3 -0
  35. package/lib/components/from/table/table-config.component.d.ts +57 -0
  36. package/lib/components/from/table/table-config.d.ts +18 -0
  37. package/lib/components/from/table/table-control.component.d.ts +36 -0
  38. package/lib/components/from/text-edit/text-edit-config.d.ts +1 -0
  39. package/lib/dynamic-form.module.d.ts +11 -8
  40. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, ViewContainerRef, NgModule } from '@angular/core';
2
+ import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, inject, ViewContainerRef, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
- import { Validators, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl } from '@angular/forms';
4
+ import { Validators, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl, FormBuilder } from '@angular/forms';
5
5
  import * as i2 from '@abp/ng.core';
6
6
  import { CoreModule } from '@abp/ng.core';
7
+ import * as i6 from '@abp/ng.theme.shared';
7
8
  import { ThemeSharedModule } from '@abp/ng.theme.shared';
9
+ import * as i7 from '@ng-bootstrap/ng-bootstrap';
8
10
  import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
9
11
  import { NzTreeModule } from 'ng-zorro-antd/tree';
10
12
  import * as i4 from '@dignite-ng/expand.file-explorer';
@@ -34,13 +36,7 @@ import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
34
36
  import { pinyin } from 'pinyin-pro';
35
37
 
36
38
  class TextEditConfig {
37
- // /**占位符 */
38
- // // placeholder: any = new FormControl('', Validators.required);
39
- // 'placeholder': any = ['', []];
40
- // //字段类型,单行文本,多行文本
41
- // textboxMode: any = ['simple', []];
42
- // // 字数限制
43
- // limit: any = ['265', []];
39
+ /**占位符 */
44
40
  'TextEdit.Placeholder' = ['', []];
45
41
  //字段类型,单行文本,多行文本
46
42
  'TextEdit.Mode' = [0, []];
@@ -167,7 +163,7 @@ class TextEditComponent {
167
163
  if (this._fields && this._entity && this._parentFiledName) {
168
164
  this.extraProperties = this._entity.get(this._parentFiledName);
169
165
  await this.AfterInit();
170
- this.submitclick.nativeElement.click();
166
+ this.submitclick?.nativeElement?.click();
171
167
  }
172
168
  }
173
169
  AfterInit() {
@@ -210,7 +206,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
210
206
 
211
207
  class SwitchConfig {
212
208
  /**默认值 */
213
- // placeholder: any = new FormControl('', Validators.required);
214
209
  'Switch.Default' = [false, []];
215
210
  constructor(data) {
216
211
  if (data) {
@@ -307,10 +302,11 @@ class SwitchControlComponent {
307
302
  this._parentFiledName = v;
308
303
  this.dataLoaded();
309
304
  }
310
- /**父级字段名称,用于为表单设置控件赋值 */
305
+ /** */
311
306
  _selected;
312
307
  set selected(v) {
313
- this._selected = v ? v : false;
308
+ // ?v:false;
309
+ this._selected = v;
314
310
  this.dataLoaded();
315
311
  }
316
312
  submitclick;
@@ -330,7 +326,7 @@ class SwitchControlComponent {
330
326
  if (this._fields.required) {
331
327
  ValidatorsArray.push(Validators.required);
332
328
  }
333
- let newControl = this.fb.control(this._selected ? this._selected : this._selected === false ? this._selected : this._fields.field.formConfiguration.default, ValidatorsArray);
329
+ let newControl = this.fb.control(this._selected ? this._selected : this._selected === false ? this._selected : this._fields.field.formConfiguration['Switch.Default'], ValidatorsArray);
334
330
  this.extraProperties.setControl(this._fields.field.name, newControl);
335
331
  resolve(true);
336
332
  });
@@ -358,7 +354,6 @@ class NumbericEditConfig {
358
354
  /**占位符 */
359
355
  'NumericEditField.Placeholder' = ['', []];
360
356
  /**最小值 */
361
- // placeholder: any = new FormControl('', Validators.required);
362
357
  'NumericEditField.Min' = ['', []];
363
358
  //最大值
364
359
  'NumericEditField.Max' = ['', []];
@@ -707,7 +702,6 @@ class CkEditorControlComponent {
707
702
  const currentCulture = this.config.getOne("localization")?.currentCulture?.name;
708
703
  this.editorConfig = {
709
704
  language: this.languagesMap[currentCulture],
710
- // language: currentCulture||'en',
711
705
  placeholder: '',
712
706
  toolbar: {
713
707
  removeItems: ['mediaEmbed'],
@@ -837,13 +831,6 @@ var DateEditInterfaces;
837
831
  })(DateEditInterfaces || (DateEditInterfaces = {}));
838
832
 
839
833
  class DateEditConfig {
840
- /**占位符 */
841
- // placeholder: any = new FormControl('', Validators.required);
842
- // placeholder: any = ['', []];
843
- // //字段类型,单行文本,多行文本
844
- // textboxMode: any = ['simple', []];
845
- // // 字数限制
846
- // limit: any = ['265', []];
847
834
  /**日期格式 */
848
835
  'DateEdit.InputMode' = [DateEditInterfaces.Date, []];
849
836
  /**最小值 */
@@ -1010,10 +997,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1010
997
 
1011
998
  class FileExplorerConfig {
1012
999
  /**文件容器名称 */
1013
- // placeholder: any = new FormControl('', Validators.required);
1014
1000
  'FileExplorer.FileContainerName' = ['', []];
1015
1001
  /**多选 */
1016
- // placeholder: any = new FormControl('', Validators.required);
1017
1002
  'FileExplorer.UploadFileMultiple' = [false, []];
1018
1003
  constructor(data) {
1019
1004
  if (data) {
@@ -1180,14 +1165,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1180
1165
  args: ['submitclick', { static: true }]
1181
1166
  }] } });
1182
1167
 
1183
- class SelectConfig {
1184
- /**空值文本 */
1185
- // placeholder: any = new FormControl('', Validators.required);
1186
- 'Select.NullText' = ['', []];
1187
- //多选
1188
- 'Select.Multiple' = [false, []];
1189
- // 选项
1190
- 'Select.Options' = new FormArray([]);
1168
+ class MatrixConfig {
1169
+ // 矩阵类型
1170
+ 'MatrixBlockTypes' = new FormArray([]);
1171
+ constructor(data) {
1172
+ if (data) {
1173
+ for (const key in data) {
1174
+ if (data.hasOwnProperty(key)) {
1175
+ this[key] = data[key];
1176
+ }
1177
+ }
1178
+ }
1179
+ }
1180
+ }
1181
+ class MatrixItemConfig {
1182
+ displayName = ['', [Validators.required]];
1183
+ /**字段名字 */
1184
+ name = ['', [Validators.required]];
1185
+ constructor(data) {
1186
+ if (data) {
1187
+ for (const key in data) {
1188
+ if (data.hasOwnProperty(key)) {
1189
+ this[key] = data[key];
1190
+ }
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+ class matrixFieldInputBase {
1196
+ /**字段名称 Display name of this field */
1197
+ displayName = ['', [Validators.required]];
1198
+ /**字段唯一名称 Unique Name*/
1199
+ name = ['', [Validators.required]];
1200
+ /**描述 说明 */
1201
+ description = ['', []];
1202
+ /**FieldType字段类型 表单控件名称 */
1203
+ formControlName = ['TextEdit', [Validators.required]];
1204
+ /**动态表单配置 */
1205
+ formConfiguration = new FormGroup({});
1191
1206
  constructor(data) {
1192
1207
  if (data) {
1193
1208
  for (const key in data) {
@@ -1199,6 +1214,108 @@ class SelectConfig {
1199
1214
  }
1200
1215
  }
1201
1216
 
1217
+ class MatrixControlComponent {
1218
+ fb;
1219
+ constructor(fb) {
1220
+ this.fb = fb;
1221
+ }
1222
+ /**表单实体 */
1223
+ _entity;
1224
+ set entity(v) {
1225
+ this._entity = v;
1226
+ this.dataLoaded();
1227
+ }
1228
+ /**字段配置列表 */
1229
+ _fields = '';
1230
+ set fields(v) {
1231
+ this._fields = v;
1232
+ this.dataLoaded();
1233
+ }
1234
+ /**父级字段名称,用于为表单设置控件赋值 */
1235
+ _parentFiledName;
1236
+ set parentFiledName(v) {
1237
+ this._parentFiledName = v;
1238
+ this.dataLoaded();
1239
+ }
1240
+ /**父级字段名称,用于为表单设置控件赋值 */
1241
+ _selected;
1242
+ set selected(v) {
1243
+ this._selected = v;
1244
+ if (v) {
1245
+ this.dataLoaded();
1246
+ }
1247
+ }
1248
+ /**语言 */
1249
+ _culture;
1250
+ set culture(v) {
1251
+ this._culture = v;
1252
+ }
1253
+ submitclick;
1254
+ /** 获取父级字段代表的表单组*/
1255
+ extraProperties;
1256
+ /**数据加载完成 */
1257
+ async dataLoaded() {
1258
+ if (this._fields && this._entity && this._parentFiledName) {
1259
+ this.extraProperties = this._entity.get(this._parentFiledName);
1260
+ await this.AfterInit();
1261
+ this.submitclick.nativeElement.click();
1262
+ if (this._selected)
1263
+ this.fieldNameControl.patchValue(this._selected);
1264
+ }
1265
+ }
1266
+ formConfiguration;
1267
+ /**获取表格字段代表的控件 */
1268
+ fieldNameControl;
1269
+ AfterInit() {
1270
+ return new Promise((resolve, rejects) => {
1271
+ let formConfiguration = this._fields.field.formConfiguration;
1272
+ let newArrayGroup = this.fb.array([]);
1273
+ this.extraProperties.setControl(this._fields.field.name, newArrayGroup);
1274
+ this.fieldNameControl = this.extraProperties.get(this._fields.field.name);
1275
+ if (this._selected) {
1276
+ this._selected.forEach(el => {
1277
+ this.addMatrixControl(formConfiguration.MatrixBlockTypes.find(item => item.name == el.matrixBlockTypeName));
1278
+ });
1279
+ }
1280
+ this.MatrixBlockTypesList = formConfiguration.MatrixBlockTypes;
1281
+ resolve(true);
1282
+ });
1283
+ }
1284
+ /**矩阵列表 */
1285
+ MatrixBlockTypesList = [];
1286
+ /**增加指定矩阵控件项 */
1287
+ addMatrixControl(item) {
1288
+ this.fieldNameControl.push(this.fb.group({
1289
+ extraProperties: new FormGroup({}),
1290
+ matrixBlockTypeName: [item.name],
1291
+ displayName: [item.displayName]
1292
+ }));
1293
+ }
1294
+ /**删除矩阵控件 */
1295
+ deleteMatrixControl(index) {
1296
+ this.fieldNameControl.removeAt(index);
1297
+ }
1298
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixControlComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
1299
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MatrixControlComponent, selector: "df-matrix-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected", culture: "culture" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls;let i=index\">\n <div class=\"card mb-3 border \" [formGroupName]=\"i\">\n <div class=\"card-header d-flex align-items-center justify-content-between border-bottom pt-1\">\n <div>{{item.value.displayName}}</div>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteMatrixControl(i)\"><i\n class=\"fas fa-trash p-2\"></i></button>\n </div>\n <div class=\"card-body\">\n <ng-container *ngFor=\"let el of MatrixBlockTypesList;let il =index\">\n <ng-container *ngIf=\"el.name===item.value.matrixBlockTypeName\">\n <ng-container *ngFor=\"let elf of el.fields; let fi=index\">\n <ng-container>\n <df-dynamic [entity]=\"item\"\n [fields]=\"{ field: elf,displayName:elf.displayName }\"\n [selected]=\"_selected ? _selected[i][_parentFiledName][elf.name]: ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"_culture\"></df-dynamic>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n <div>\n <div class=\"btn-group\" role=\"group\" aria-label=\"Basic example\">\n <ng-container *ngFor=\"let item of MatrixBlockTypesList;let i =index\">\n <button type=\"button\" class=\"btn btn-primary btn-sm\" (click.stop)=\"addMatrixControl(item)\"><i\n class=\"fas fa-plus me-1\"></i>{{item.displayName}}</button>\n </ng-container>\n </div>\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }] });
1300
+ }
1301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixControlComponent, decorators: [{
1302
+ type: Component,
1303
+ args: [{ selector: 'df-matrix-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls;let i=index\">\n <div class=\"card mb-3 border \" [formGroupName]=\"i\">\n <div class=\"card-header d-flex align-items-center justify-content-between border-bottom pt-1\">\n <div>{{item.value.displayName}}</div>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteMatrixControl(i)\"><i\n class=\"fas fa-trash p-2\"></i></button>\n </div>\n <div class=\"card-body\">\n <ng-container *ngFor=\"let el of MatrixBlockTypesList;let il =index\">\n <ng-container *ngIf=\"el.name===item.value.matrixBlockTypeName\">\n <ng-container *ngFor=\"let elf of el.fields; let fi=index\">\n <ng-container>\n <df-dynamic [entity]=\"item\"\n [fields]=\"{ field: elf,displayName:elf.displayName }\"\n [selected]=\"_selected ? _selected[i][_parentFiledName][elf.name]: ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"_culture\"></df-dynamic>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n <div>\n <div class=\"btn-group\" role=\"group\" aria-label=\"Basic example\">\n <ng-container *ngFor=\"let item of MatrixBlockTypesList;let i =index\">\n <button type=\"button\" class=\"btn btn-primary btn-sm\" (click.stop)=\"addMatrixControl(item)\"><i\n class=\"fas fa-plus me-1\"></i>{{item.displayName}}</button>\n </ng-container>\n </div>\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>" }]
1304
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
1305
+ type: Input
1306
+ }], fields: [{
1307
+ type: Input
1308
+ }], parentFiledName: [{
1309
+ type: Input
1310
+ }], selected: [{
1311
+ type: Input
1312
+ }], culture: [{
1313
+ type: Input
1314
+ }], submitclick: [{
1315
+ type: ViewChild,
1316
+ args: ['submitclick', { static: true }]
1317
+ }] } });
1318
+
1202
1319
  class DfApiService {
1203
1320
  constructor() { }
1204
1321
  /**
@@ -1278,6 +1395,236 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1278
1395
  }]
1279
1396
  }], ctorParameters: function () { return []; } });
1280
1397
 
1398
+ class MatrixConfigComponent {
1399
+ fb;
1400
+ _DfApiService;
1401
+ constructor(fb, _DfApiService) {
1402
+ this.fb = fb;
1403
+ this._DfApiService = _DfApiService;
1404
+ }
1405
+ /**表单控件组 */
1406
+ _FieldControlGroup;
1407
+ /**表单控件类型 */
1408
+ _type;
1409
+ set type(v) {
1410
+ this._type = v;
1411
+ this.dataLoaded();
1412
+ }
1413
+ /**表单实体 */
1414
+ _Entity;
1415
+ set Entity(v) {
1416
+ this._Entity = v;
1417
+ this.dataLoaded();
1418
+ }
1419
+ /**选择的表单信息 */
1420
+ _selected;
1421
+ set selected(v) {
1422
+ if (v) {
1423
+ this._selected = v;
1424
+ this.dataLoaded();
1425
+ }
1426
+ }
1427
+ submitclick;
1428
+ async dataLoaded() {
1429
+ if (this._Entity && this._type) {
1430
+ await this.AfterInit();
1431
+ this.submitclick.nativeElement.click();
1432
+ }
1433
+ }
1434
+ AfterInit() {
1435
+ return new Promise(async (resolve, rejects) => {
1436
+ this._FieldControlGroup = getExcludeAssignControl(this._type);
1437
+ // this._FieldControlGroup = getExcludeAssignControl(this._type)
1438
+ this._Entity.setControl('formConfiguration', this.fb.group(new MatrixConfig()));
1439
+ await this.setSelectValue();
1440
+ this.formConfiguration.patchValue(this._selected.formConfiguration);
1441
+ resolve(true);
1442
+ });
1443
+ }
1444
+ setSelectValue() {
1445
+ return new Promise((resolve, rejects) => {
1446
+ if (this._selected && this._selected.formControlName == this._type) {
1447
+ this._selected.formConfiguration['MatrixBlockTypes'].forEach(((el, index) => {
1448
+ this.addMatrixBlockTypeItem(el);
1449
+ el.fields.forEach((elf, indexf) => {
1450
+ this.addMatrixFieldItem(elf, index);
1451
+ });
1452
+ }));
1453
+ resolve(true);
1454
+ }
1455
+ });
1456
+ }
1457
+ /**获取表单配置 */
1458
+ get formConfiguration() {
1459
+ return this._Entity.get('formConfiguration');
1460
+ }
1461
+ /**获取表单配置下的矩阵块表单数组 */
1462
+ get MatrixBlockTypes() {
1463
+ return this.formConfiguration.controls['MatrixBlockTypes'];
1464
+ }
1465
+ /**模态框-状态 */
1466
+ matrixModalOpen = false;
1467
+ /**模态框-是否正在编辑 */
1468
+ isMatrixModalEdit = false;
1469
+ /**模态框-用于确定模态的繁忙状态是否为真 */
1470
+ modalBusy = false;
1471
+ /**模态框-表单 */
1472
+ matrixModalForm;
1473
+ /**表单控件模板-用于在form外提交submit */
1474
+ matrixModalModalSubmit;
1475
+ /**矩阵块-选择的下标 */
1476
+ selectMatrixBlockIndex = 0;
1477
+ /**矩阵块-选择的矩阵下字段的下标 */
1478
+ selectMatrixFieldIndex = 0;
1479
+ /**模态框-状态改变 */
1480
+ matrixModalVisibleChange(event) {
1481
+ if (!event) {
1482
+ this.isMatrixModalEdit = false;
1483
+ this.matrixModalForm = undefined;
1484
+ return;
1485
+ }
1486
+ }
1487
+ /**矩阵块--新增-打开模态框 */
1488
+ addMatrixBlockType() {
1489
+ this.matrixModalForm = this.fb.group(new MatrixItemConfig());
1490
+ this.matrixModalOpen = true;
1491
+ }
1492
+ /**模态框--矩阵表单保存提交 */
1493
+ createOrEditSave() {
1494
+ let input = this.matrixModalForm.value;
1495
+ if (!this.matrixModalForm.valid)
1496
+ return;
1497
+ if (this.isMatrixModalEdit) {
1498
+ let MatrixBlockTypesItem = this.MatrixBlockTypes.at(this.selectMatrixBlockIndex);
1499
+ MatrixBlockTypesItem.patchValue({
1500
+ ...input
1501
+ });
1502
+ }
1503
+ else {
1504
+ this.addMatrixBlockTypeItem(input);
1505
+ }
1506
+ this.matrixModalOpen = false;
1507
+ }
1508
+ /**新增矩阵块-向数组表单中增加项 */
1509
+ addMatrixBlockTypeItem(input) {
1510
+ this.MatrixBlockTypes.push(new FormGroup({
1511
+ displayName: new FormControl(input.displayName, Validators.required),
1512
+ name: new FormControl(input.name, Validators.required),
1513
+ fields: new FormArray([])
1514
+ }));
1515
+ }
1516
+ /**编辑矩阵块 */
1517
+ EditMatrixBlock(input) {
1518
+ this.matrixModalForm = this.fb.group(new MatrixItemConfig());
1519
+ this.matrixModalForm.patchValue({
1520
+ ...input
1521
+ });
1522
+ this.matrixModalOpen = true;
1523
+ this.isMatrixModalEdit = true;
1524
+ }
1525
+ /**删除矩阵块 */
1526
+ DeleteMatrixBlock(index) {
1527
+ this.MatrixBlockTypes.removeAt(index);
1528
+ }
1529
+ /**矩阵块-选择 */
1530
+ selectMatrixBlockChange(index) {
1531
+ this.selectMatrixBlockIndex = index;
1532
+ }
1533
+ /**矩阵字段-新增 */
1534
+ addMatrixField() {
1535
+ this.addMatrixFieldItem('', this.selectMatrixBlockIndex);
1536
+ }
1537
+ /**矩阵字段-新增矩阵字段项 */
1538
+ addMatrixFieldItem(input = '', selectMatrixBlockIndex) {
1539
+ /**矩阵下标的矩阵项Form */
1540
+ let MatrixBlockTypesItemForm = this.MatrixBlockTypes.at(selectMatrixBlockIndex);
1541
+ let MatrixFieldItemForm = MatrixBlockTypesItemForm.get('fields');
1542
+ MatrixFieldItemForm.push(this.fb.group({
1543
+ /**字段名称 Display name of this field */
1544
+ displayName: [input.displayName, [Validators.required]],
1545
+ /**字段唯一名称 Unique Name*/
1546
+ name: [input.name, [Validators.required]],
1547
+ /**描述 说明 */
1548
+ description: [input.description, []],
1549
+ /**FieldType字段类型 表单控件名称 */
1550
+ formControlName: [input.formControlName || 'TextEdit', [Validators.required]],
1551
+ //动态表单配置
1552
+ formConfiguration: new FormGroup({}),
1553
+ }));
1554
+ }
1555
+ /**删除矩阵字段项 */
1556
+ deleteMatrixField(MatrixFieldForm, index) {
1557
+ MatrixFieldForm.removeAt(index);
1558
+ this.selectMatrixFieldIndex = 0;
1559
+ }
1560
+ /**矩阵字段-选择 */
1561
+ selectMatrixFieldChange(MatrixBlockIndex, MatrixFieldIndex) {
1562
+ this.selectMatrixFieldIndex = MatrixFieldIndex;
1563
+ }
1564
+ get nameInput() {
1565
+ return this.matrixModalForm?.get('name');
1566
+ }
1567
+ get FieldnameInput() {
1568
+ let MatrixBlockTypesItemForm = this.MatrixBlockTypes.at(this.selectMatrixBlockIndex);
1569
+ let MatrixFieldItemForm = MatrixBlockTypesItemForm.get('fields');
1570
+ return MatrixFieldItemForm.at(this.selectMatrixFieldIndex).get('name');
1571
+ }
1572
+ /**矩阵displayNameInput字段失去焦点 */
1573
+ displayNameInputBlur(event) {
1574
+ let value = event.target.value;
1575
+ let pinyin = this._DfApiService.chineseToPinyin(value);
1576
+ let nameInput = this.nameInput;
1577
+ if (nameInput.value)
1578
+ return;
1579
+ nameInput.patchValue(pinyin);
1580
+ }
1581
+ /**矩阵displayNameInput字段失去焦点 */
1582
+ MatrixFieldDisplayNameInputBlur(event) {
1583
+ let value = event.target.value;
1584
+ let pinyin = this._DfApiService.chineseToPinyin(value);
1585
+ let FieldnameInput = this.FieldnameInput;
1586
+ if (FieldnameInput.value)
1587
+ return;
1588
+ FieldnameInput.patchValue(pinyin);
1589
+ }
1590
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixConfigComponent, deps: [{ token: i1.FormBuilder }, { token: DfApiService }], target: i0.ɵɵFactoryTarget.Component });
1591
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MatrixConfigComponent, selector: "df-matrix-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }, { propertyName: "matrixModalModalSubmit", first: true, predicate: ["matrixModalModalSubmit"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'Cms::::FormControl:Matrix' | abpLocalization}}</label>\n <div class=\"row\">\n <div class=\"col-md-3\">\n <div class=\"list-group\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::MatrixBlockType' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixBlockType()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixBlockChange(i)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"i===selectMatrixBlockIndex\">\n <div>\n <div>{{item.value.displayName}}</div>\n <div>{{item.value.name}}</div>\n </div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-light btn-sm\" id=\"dropdownBasic1\"\n style=\"z-index: 8;\" ngbDropdownToggle></button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"z-index: 9;\">\n <button ngbDropdownItem\n (click.stop)=\"EditMatrixBlock(item.value)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"DeleteMatrixBlock(i)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"list-group\" *ngIf=\"MatrixBlockTypes?.controls.length>0\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::Fields' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixField()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <ng-container *ngIf=\"i === selectMatrixBlockIndex\">\n <ng-container *ngFor=\"let el of item.controls['fields'].controls;let fi =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixFieldChange(i,fi)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"fi===selectMatrixFieldIndex\">\n <div>\n <div>{{el.value.displayName}}</div>\n <div>{{el.value.name}}</div>\n </div>\n <button type=\"button\"\n (click.stop)=\"deleteMatrixField(item.controls['fields'],fi)\"\n class=\"btn btn-sm btn-li\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-6\" formArrayName=\"MatrixBlockTypes\">\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <div [formGroupName]=\"i\" [hidden]=\"i !== selectMatrixBlockIndex\">\n <div formArrayName=\"fields\">\n <ng-container *ngFor=\"let item of item.controls['fields'].controls;let fi =index\">\n <div [formGroupName]=\"fi\" [hidden]=\"fi !== selectMatrixFieldIndex\">\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"MatrixFieldDisplayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n <div class=\"form-text\">\n {{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\">\n <ng-container *ngFor=\"let item of _FieldControlGroup;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"item.value.formControlName&&item\">\n <df-dynamic [type]=\"item.value.formControlName\" [entity]=\"item\"\n [selected]=\"_selected?_selected['formConfiguration']['MatrixBlockTypes'][i]['fields'][fi]:''\"></df-dynamic>\n </ng-container>\n\n\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n\n<abp-modal [(visible)]=\"matrixModalOpen\" [busy]=\"modalBusy\" (visibleChange)=\"matrixModalVisibleChange($event)\" >\n <ng-template #abpHeader>\n <h3>{{isMatrixEdit?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"matrixModalForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"matrixModalForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #matrixModalModalSubmit style=\"display: none\"></button>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"displayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'Cms::Name' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"matrixModalModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i6.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i6.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i6.ModalCloseDirective, selector: "[abpClose]" }, { kind: "directive", type: i7.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i7.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i7.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i7.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] });
1592
+ }
1593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixConfigComponent, decorators: [{
1594
+ type: Component,
1595
+ args: [{ selector: 'df-matrix-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'Cms::::FormControl:Matrix' | abpLocalization}}</label>\n <div class=\"row\">\n <div class=\"col-md-3\">\n <div class=\"list-group\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::MatrixBlockType' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixBlockType()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixBlockChange(i)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"i===selectMatrixBlockIndex\">\n <div>\n <div>{{item.value.displayName}}</div>\n <div>{{item.value.name}}</div>\n </div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-light btn-sm\" id=\"dropdownBasic1\"\n style=\"z-index: 8;\" ngbDropdownToggle></button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"z-index: 9;\">\n <button ngbDropdownItem\n (click.stop)=\"EditMatrixBlock(item.value)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"DeleteMatrixBlock(i)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"list-group\" *ngIf=\"MatrixBlockTypes?.controls.length>0\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::Fields' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixField()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <ng-container *ngIf=\"i === selectMatrixBlockIndex\">\n <ng-container *ngFor=\"let el of item.controls['fields'].controls;let fi =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixFieldChange(i,fi)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"fi===selectMatrixFieldIndex\">\n <div>\n <div>{{el.value.displayName}}</div>\n <div>{{el.value.name}}</div>\n </div>\n <button type=\"button\"\n (click.stop)=\"deleteMatrixField(item.controls['fields'],fi)\"\n class=\"btn btn-sm btn-li\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-6\" formArrayName=\"MatrixBlockTypes\">\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <div [formGroupName]=\"i\" [hidden]=\"i !== selectMatrixBlockIndex\">\n <div formArrayName=\"fields\">\n <ng-container *ngFor=\"let item of item.controls['fields'].controls;let fi =index\">\n <div [formGroupName]=\"fi\" [hidden]=\"fi !== selectMatrixFieldIndex\">\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"MatrixFieldDisplayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n <div class=\"form-text\">\n {{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\">\n <ng-container *ngFor=\"let item of _FieldControlGroup;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"item.value.formControlName&&item\">\n <df-dynamic [type]=\"item.value.formControlName\" [entity]=\"item\"\n [selected]=\"_selected?_selected['formConfiguration']['MatrixBlockTypes'][i]['fields'][fi]:''\"></df-dynamic>\n </ng-container>\n\n\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n\n<abp-modal [(visible)]=\"matrixModalOpen\" [busy]=\"modalBusy\" (visibleChange)=\"matrixModalVisibleChange($event)\" >\n <ng-template #abpHeader>\n <h3>{{isMatrixEdit?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"matrixModalForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"matrixModalForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #matrixModalModalSubmit style=\"display: none\"></button>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"displayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'Cms::Name' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"matrixModalModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>" }]
1596
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: DfApiService }]; }, propDecorators: { type: [{
1597
+ type: Input
1598
+ }], Entity: [{
1599
+ type: Input
1600
+ }], selected: [{
1601
+ type: Input
1602
+ }], submitclick: [{
1603
+ type: ViewChild,
1604
+ args: ['submitclick', { static: true }]
1605
+ }], matrixModalModalSubmit: [{
1606
+ type: ViewChild,
1607
+ args: ['matrixModalModalSubmit', { static: false }]
1608
+ }] } });
1609
+
1610
+ class SelectConfig {
1611
+ /**空值文本 */
1612
+ 'Select.NullText' = ['', []];
1613
+ //多选
1614
+ 'Select.Multiple' = [false, []];
1615
+ // 选项
1616
+ 'Select.Options' = new FormArray([]);
1617
+ constructor(data) {
1618
+ if (data) {
1619
+ for (const key in data) {
1620
+ if (data.hasOwnProperty(key)) {
1621
+ this[key] = data[key];
1622
+ }
1623
+ }
1624
+ }
1625
+ }
1626
+ }
1627
+
1281
1628
  class SelectConfigComponent {
1282
1629
  fb;
1283
1630
  _DfApiService;
@@ -1453,6 +1800,307 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1453
1800
  args: ['submitclick', { static: true }]
1454
1801
  }] } });
1455
1802
 
1803
+ class TableConfig {
1804
+ // 选项
1805
+ TableColumns = new FormArray([]);
1806
+ constructor(data) {
1807
+ if (data) {
1808
+ for (const key in data) {
1809
+ if (data.hasOwnProperty(key)) {
1810
+ this[key] = data[key];
1811
+ }
1812
+ }
1813
+ }
1814
+ }
1815
+ }
1816
+ class TableFormControl {
1817
+ /**列标题 */
1818
+ displayName = ['', [Validators.required]];
1819
+ /**空间配置 */
1820
+ formConfiguration = new FormGroup({});
1821
+ /**列名 */
1822
+ name = ['', [Validators.required]];
1823
+ //控件标识
1824
+ formControlName = ['', [Validators.required]];
1825
+ /**是否必填 */
1826
+ required = [false];
1827
+ /**描述 */
1828
+ description = [''];
1829
+ constructor(data) {
1830
+ if (data) {
1831
+ for (const key in data) {
1832
+ if (data.hasOwnProperty(key)) {
1833
+ this[key] = data[key];
1834
+ }
1835
+ }
1836
+ }
1837
+ }
1838
+ }
1839
+
1840
+ class TableConfigComponent {
1841
+ fb;
1842
+ _DfApiService;
1843
+ constructor(fb, _DfApiService) {
1844
+ this.fb = fb;
1845
+ this._DfApiService = _DfApiService;
1846
+ }
1847
+ /**表单实体 */
1848
+ _Entity;
1849
+ set Entity(v) {
1850
+ this._Entity = v;
1851
+ this.dataLoaded();
1852
+ }
1853
+ /**选择的表单信息 */
1854
+ _selected;
1855
+ set selected(v) {
1856
+ if (v) {
1857
+ this._selected = v;
1858
+ this.dataLoaded();
1859
+ }
1860
+ }
1861
+ /**表单控件组 */
1862
+ _fieldControlGroup;
1863
+ /**表单控件类型 */
1864
+ _type;
1865
+ set type(v) {
1866
+ this._type = v;
1867
+ this.dataLoaded();
1868
+ }
1869
+ get formConfiguration() {
1870
+ return this._Entity.get('formConfiguration');
1871
+ }
1872
+ get TableColumns() {
1873
+ return this.formConfiguration.controls['TableColumns'];
1874
+ }
1875
+ submitclick;
1876
+ async dataLoaded() {
1877
+ if (this._Entity && this._type) {
1878
+ await this.AfterInit();
1879
+ this.submitclick.nativeElement.click();
1880
+ }
1881
+ }
1882
+ /**增加选项 */
1883
+ addTableColumns() {
1884
+ this.TableColumns.push(this.fb.group({
1885
+ ...new TableFormControl(),
1886
+ formConfiguration: [{}]
1887
+ }));
1888
+ }
1889
+ /**删除某个选项 */
1890
+ deleteTableColumns(index) {
1891
+ this.TableColumns.removeAt(index);
1892
+ }
1893
+ AfterInit() {
1894
+ return new Promise((resolve, rejects) => {
1895
+ this._Entity.setControl('formConfiguration', this.fb.group(new TableConfig()));
1896
+ this._fieldControlGroup = getExcludeAssignControl(this._type);
1897
+ if (this._selected && this._selected.formControlName == this._type) {
1898
+ this._selected.formConfiguration['TableColumns'].forEach(el => {
1899
+ this.addTableColumns();
1900
+ });
1901
+ this.formConfiguration.patchValue(this._selected.formConfiguration);
1902
+ }
1903
+ else {
1904
+ this.addTableColumns();
1905
+ }
1906
+ resolve(true);
1907
+ });
1908
+ }
1909
+ itemForm;
1910
+ /**选择表格的表单控件 */
1911
+ selectTableControl(event, i, item) {
1912
+ this.CurrentSelectionTableControlName = event.target.value;
1913
+ this.tableSelectOpen = true;
1914
+ this.tableSelectForm = this.fb.group(new TableFormControl());
1915
+ this.TableColumnsIndex = i;
1916
+ this.itemForm = item;
1917
+ }
1918
+ CurrentSelectionTableControlName;
1919
+ /**正在创建或编辑的表格项下标 */
1920
+ TableColumnsIndex;
1921
+ /**创建站点模态框状态 */
1922
+ tableSelectOpen = false;
1923
+ /**用于确定模态的繁忙状态是否为真 */
1924
+ modalBusy = false;
1925
+ /**创建站点表单 */
1926
+ tableSelectForm;
1927
+ /**表格已选择数据 */
1928
+ _tableSelected;
1929
+ /**表单控件模板-动态赋值表单控件 */
1930
+ tableSelectModalSubmit;
1931
+ /**创建站点模态框状态改变 */
1932
+ tableSelectVisibleChange(event) {
1933
+ if (!event) {
1934
+ this._tableSelected = undefined;
1935
+ this.tableSelectForm = undefined;
1936
+ this.CurrentSelectionTableControlName = undefined;
1937
+ this.TableColumnsIndex = undefined;
1938
+ return;
1939
+ }
1940
+ }
1941
+ /**表单保存提交 */
1942
+ createOrEditSave() {
1943
+ const formGroup = this.TableColumns.at(this.TableColumnsIndex);
1944
+ let formConfigurationgroup = formGroup.get('formConfiguration');
1945
+ formConfigurationgroup.setValue({
1946
+ ...this.tableSelectForm.value['formConfiguration'],
1947
+ });
1948
+ this.tableSelectOpen = false;
1949
+ }
1950
+ /**编辑站点按钮 */
1951
+ EditSitesBtn(rows, i) {
1952
+ this.CurrentSelectionTableControlName = rows.get('formControlName').value;
1953
+ this.tableSelectForm = this.fb.group(new TableFormControl());
1954
+ this.tableSelectForm.patchValue({
1955
+ ...rows.value
1956
+ });
1957
+ this.tableSelectForm.get('formConfiguration').patchValue({
1958
+ ...rows.value['formConfiguration']
1959
+ });
1960
+ this._tableSelected = rows.value;
1961
+ this.TableColumnsIndex = i;
1962
+ this.tableSelectOpen = true;
1963
+ }
1964
+ /**调整表格位置 */
1965
+ TableArrowUpOrDown(type, index) {
1966
+ let controlAt = this.TableColumns.at(index);
1967
+ this.TableColumns.removeAt(index);
1968
+ let lastindex = type == 'up' ? index - 1 : index + 1;
1969
+ this.TableColumns.insert(lastindex, controlAt);
1970
+ }
1971
+ /**字段标签input失去标点生成字段名字 */
1972
+ disPlayNameInputBlur(event, item) {
1973
+ let value = event.target.value;
1974
+ let pinyin = this._DfApiService.chineseToPinyin(value);
1975
+ let nameInput = item.get('name');
1976
+ if (nameInput.value)
1977
+ return;
1978
+ nameInput.patchValue(pinyin);
1979
+ }
1980
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableConfigComponent, deps: [{ token: i1.FormBuilder }, { token: DfApiService }], target: i0.ɵɵFactoryTarget.Component });
1981
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableConfigComponent, selector: "df-table-config", inputs: { Entity: "Entity", selected: "selected", type: "type" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }, { propertyName: "tableSelectModalSubmit", first: true, predicate: ["tableSelectModalSubmit"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'Cms::TableColumnDisplayName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnForm' | abpLocalization}}</th>\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableColumns()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"TableColumns\">\n <ng-container *ngFor=\"let item of TableColumns.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event,item)\" ></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"name\"></td>\n <td>\n <select class=\"form-select\" formControlName=\"formControlName\"\n (change)=\"selectTableControl($event,i,item)\">\n <option value=\"\">SelectFrom</option>\n <ng-container *ngFor=\"let item_f of _fieldControlGroup;let i_f =index\">\n <option [value]=\"item_f.name\">{{item_f.displayName}}</option>\n </ng-container>\n </select>\n </td>\n <td scope=\"row\">\n <div class=\"flex-start\">\n <button class=\"btn btn-light btn-sm \" (click.stop)=\"EditSitesBtn(item,i)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"deleteTableColumns(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==0\"\n (click.stop)=\"TableArrowUpOrDown('up',i)\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==TableColumns.controls.length-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n<abp-modal [(visible)]=\"tableSelectOpen\" [busy]=\"modalBusy\" (visibleChange)=\"tableSelectVisibleChange($event)\" [options]=\"{ size: CurrentSelectionTableControlName=='Matrix'?'xl':'' ,scrollable:false }\">\n <ng-template #abpHeader>\n <h3>{{_tableSelected?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"tableSelectForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"tableSelectForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #tableSelectModalSubmit style=\"display: none\"></button>\n <ng-container *ngIf=\"CurrentSelectionTableControlName&&tableSelectForm\">\n <df-dynamic [type]=\"CurrentSelectionTableControlName\" [entity]=\"tableSelectForm\"\n [selected]=\"_tableSelected\" [formGroup]=\"tableSelectForm\"></df-dynamic>\n </ng-container>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"tableSelectModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i6.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i6.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i6.ModalCloseDirective, selector: "[abpClose]" }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] });
1982
+ }
1983
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableConfigComponent, decorators: [{
1984
+ type: Component,
1985
+ args: [{ selector: 'df-table-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'Cms::TableColumnDisplayName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnForm' | abpLocalization}}</th>\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableColumns()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"TableColumns\">\n <ng-container *ngFor=\"let item of TableColumns.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event,item)\" ></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"name\"></td>\n <td>\n <select class=\"form-select\" formControlName=\"formControlName\"\n (change)=\"selectTableControl($event,i,item)\">\n <option value=\"\">SelectFrom</option>\n <ng-container *ngFor=\"let item_f of _fieldControlGroup;let i_f =index\">\n <option [value]=\"item_f.name\">{{item_f.displayName}}</option>\n </ng-container>\n </select>\n </td>\n <td scope=\"row\">\n <div class=\"flex-start\">\n <button class=\"btn btn-light btn-sm \" (click.stop)=\"EditSitesBtn(item,i)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"deleteTableColumns(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==0\"\n (click.stop)=\"TableArrowUpOrDown('up',i)\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==TableColumns.controls.length-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n<abp-modal [(visible)]=\"tableSelectOpen\" [busy]=\"modalBusy\" (visibleChange)=\"tableSelectVisibleChange($event)\" [options]=\"{ size: CurrentSelectionTableControlName=='Matrix'?'xl':'' ,scrollable:false }\">\n <ng-template #abpHeader>\n <h3>{{_tableSelected?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"tableSelectForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"tableSelectForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #tableSelectModalSubmit style=\"display: none\"></button>\n <ng-container *ngIf=\"CurrentSelectionTableControlName&&tableSelectForm\">\n <df-dynamic [type]=\"CurrentSelectionTableControlName\" [entity]=\"tableSelectForm\"\n [selected]=\"_tableSelected\" [formGroup]=\"tableSelectForm\"></df-dynamic>\n </ng-container>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"tableSelectModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"] }]
1986
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: DfApiService }]; }, propDecorators: { Entity: [{
1987
+ type: Input
1988
+ }], selected: [{
1989
+ type: Input
1990
+ }], type: [{
1991
+ type: Input
1992
+ }], submitclick: [{
1993
+ type: ViewChild,
1994
+ args: ['submitclick', { static: true }]
1995
+ }], tableSelectModalSubmit: [{
1996
+ type: ViewChild,
1997
+ args: ['tableSelectModalSubmit', { static: false }]
1998
+ }] } });
1999
+
2000
+ class TableControlComponent {
2001
+ constructor() {
2002
+ }
2003
+ fb = inject(FormBuilder);
2004
+ /**表单实体 */
2005
+ _entity;
2006
+ set entity(v) {
2007
+ this._entity = v;
2008
+ this.dataLoaded();
2009
+ }
2010
+ /**字段配置列表 */
2011
+ _fields = '';
2012
+ set fields(v) {
2013
+ this._fields = v;
2014
+ this.dataLoaded();
2015
+ }
2016
+ /**父级字段名称,用于为表单设置控件赋值 */
2017
+ _parentFiledName;
2018
+ set parentFiledName(v) {
2019
+ this._parentFiledName = v;
2020
+ this.dataLoaded();
2021
+ }
2022
+ /**父级字段名称,用于为表单设置控件赋值 */
2023
+ _selected;
2024
+ set selected(v) {
2025
+ this._selected = v;
2026
+ if (v) {
2027
+ this.dataLoaded();
2028
+ }
2029
+ }
2030
+ submitclick;
2031
+ /** 获取父级字段代表的表单组*/
2032
+ extraProperties;
2033
+ /**数据加载完成 */
2034
+ async dataLoaded() {
2035
+ if (this._fields && this._entity && this._parentFiledName) {
2036
+ this.extraProperties = this._entity.get(this._parentFiledName);
2037
+ await this.AfterInit();
2038
+ this.submitclick.nativeElement.click();
2039
+ }
2040
+ }
2041
+ formConfiguration;
2042
+ /**获取表格字段代表的控件 */
2043
+ fieldNameControl;
2044
+ AfterInit() {
2045
+ return new Promise((resolve, rejects) => {
2046
+ let ValidatorsArray = [];
2047
+ if (this._fields.required) {
2048
+ ValidatorsArray.push(Validators.required);
2049
+ }
2050
+ let formConfiguration = this._fields.field.formConfiguration;
2051
+ this.formConfiguration = formConfiguration;
2052
+ let newArrayGroup = this.fb.array([]);
2053
+ this.extraProperties.setControl(this._fields.field.name, newArrayGroup);
2054
+ this.fieldNameControl = this.extraProperties.get(this._fields.field.name);
2055
+ if (this._selected) {
2056
+ this._selected.forEach(el => {
2057
+ this.addTableControlItem();
2058
+ });
2059
+ this.fieldNameControl.patchValue(this._selected);
2060
+ }
2061
+ else {
2062
+ this.addTableControlItem();
2063
+ }
2064
+ resolve(true);
2065
+ });
2066
+ }
2067
+ /**增加表格项 */
2068
+ addTableControlItem() {
2069
+ this.fieldNameControl.push(this.fb.group({
2070
+ 'extraProperties': this.fb.group({})
2071
+ }));
2072
+ }
2073
+ /**删除表格项 */
2074
+ minusTableControlItem(index) {
2075
+ this.fieldNameControl.removeAt(index);
2076
+ }
2077
+ /**调整表格位置 */
2078
+ TableArrowUpOrDown(type, index) {
2079
+ let controlAt = this.fieldNameControl.at(index);
2080
+ this.fieldNameControl.removeAt(index);
2081
+ let lastindex = type == 'up' ? index - 1 : index + 1;
2082
+ this.fieldNameControl.insert(lastindex, controlAt);
2083
+ this._selected = this.fieldNameControl.value;
2084
+ }
2085
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2086
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableControlComponent, selector: "df-table-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let item of formConfiguration.TableColumns\">\n <th scope=\"col\">{{ item.displayName }}</th>\n </ng-container>\n\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableControlItem()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls; let i = index\">\n <tr>\n <ng-container *ngFor=\"let el of formConfiguration.TableColumns\">\n <td>\n <ng-container *ngIf=\"item&&el\">\n <df-dynamic [entity]=\"item\" [fields]=\"{ field: el }\"\n [selected]=\"_selected[i]?.extraProperties[''+el.name+'']\"\n [parentFiledName]=\"'extraProperties'\"></df-dynamic>\n </ng-container>\n </td>\n </ng-container>\n <td scope=\"row\" class=\"\">\n <div class=\"flex-end mb-2\">\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"minusTableControlItem(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"TableArrowUpOrDown('up',i)\"\n *ngIf=\"i!==0\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\"\n *ngIf=\"i!==fieldNameControl.controls.length-1\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }] });
2087
+ }
2088
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableControlComponent, decorators: [{
2089
+ type: Component,
2090
+ args: [{ selector: 'df-table-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let item of formConfiguration.TableColumns\">\n <th scope=\"col\">{{ item.displayName }}</th>\n </ng-container>\n\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableControlItem()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls; let i = index\">\n <tr>\n <ng-container *ngFor=\"let el of formConfiguration.TableColumns\">\n <td>\n <ng-container *ngIf=\"item&&el\">\n <df-dynamic [entity]=\"item\" [fields]=\"{ field: el }\"\n [selected]=\"_selected[i]?.extraProperties[''+el.name+'']\"\n [parentFiledName]=\"'extraProperties'\"></df-dynamic>\n </ng-container>\n </td>\n </ng-container>\n <td scope=\"row\" class=\"\">\n <div class=\"flex-end mb-2\">\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"minusTableControlItem(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"TableArrowUpOrDown('up',i)\"\n *ngIf=\"i!==0\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\"\n *ngIf=\"i!==fieldNameControl.controls.length-1\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"] }]
2091
+ }], ctorParameters: function () { return []; }, propDecorators: { entity: [{
2092
+ type: Input
2093
+ }], fields: [{
2094
+ type: Input
2095
+ }], parentFiledName: [{
2096
+ type: Input
2097
+ }], selected: [{
2098
+ type: Input
2099
+ }], submitclick: [{
2100
+ type: ViewChild,
2101
+ args: ['submitclick', { static: true }]
2102
+ }] } });
2103
+
1456
2104
  /**
1457
2105
  * 表单控件分组-包含配置,控件,显示的数组
1458
2106
  */
@@ -1488,20 +2136,20 @@ const FieldControlGroup = [
1488
2136
  fieldComponent: DateEditControlComponent,
1489
2137
  // fieldViewComponent:TextBoxViewComponent,
1490
2138
  },
1491
- // {
1492
- // displayName: '表格',
1493
- // name: 'Table',
1494
- // fieldConfigComponent: TableConfigComponent,
1495
- // fieldComponent: TableControlComponent,
1496
- // // fieldViewComponent:TextBoxViewComponent,
1497
- // },
1498
- // {
1499
- // displayName: '矩阵',
1500
- // name: 'Matrix',
1501
- // fieldConfigComponent: MatrixConfigComponent,
1502
- // fieldComponent: MatrixControlComponent,
1503
- // // fieldViewComponent:TextBoxViewComponent,
1504
- // },
2139
+ {
2140
+ displayName: '表格',
2141
+ name: 'Table',
2142
+ fieldConfigComponent: TableConfigComponent,
2143
+ fieldComponent: TableControlComponent,
2144
+ // fieldViewComponent:TextBoxViewComponent,
2145
+ },
2146
+ {
2147
+ displayName: '矩阵',
2148
+ name: 'Matrix',
2149
+ fieldConfigComponent: MatrixConfigComponent,
2150
+ fieldComponent: MatrixControlComponent,
2151
+ // fieldViewComponent:TextBoxViewComponent,
2152
+ },
1505
2153
  {
1506
2154
  displayName: '文件管理',
1507
2155
  name: 'FileExplorer',
@@ -1517,15 +2165,13 @@ const FieldControlGroup = [
1517
2165
  },
1518
2166
  ];
1519
2167
  function getExcludeAssignControl(typeName) {
1520
- return FieldControlGroup.filter(el => el.name !== typeName);
2168
+ // return FieldControlGroup.filter(el => el.name !== typeName)
2169
+ return FieldControlGroup;
1521
2170
  }
1522
- function AddFieldControlGroup(array) {
2171
+ function AddFieldControlGroup(array = []) {
1523
2172
  FieldControlGroup.push(...array);
1524
2173
  }
1525
2174
 
1526
- // export * from './matrix'
1527
- // export * from './table'
1528
-
1529
2175
  class DynamicComponent {
1530
2176
  /**选择的表单信息 */
1531
2177
  _selected;
@@ -1544,9 +2190,17 @@ class DynamicComponent {
1544
2190
  /**表单实体 */
1545
2191
  _entity;
1546
2192
  set entity(v) {
1547
- this._entity = v;
1548
- if (v)
2193
+ if (v) {
2194
+ this._entity = v;
1549
2195
  this.dataLoaded(3);
2196
+ }
2197
+ }
2198
+ /**语言 */
2199
+ _culture;
2200
+ set culture(v) {
2201
+ this._culture = v;
2202
+ if (v)
2203
+ this.dataLoaded(6);
1550
2204
  }
1551
2205
  /**父级字段名称,用于为表单设置控件赋值 */
1552
2206
  _parentFiledName;
@@ -1562,9 +2216,9 @@ class DynamicComponent {
1562
2216
  if (v)
1563
2217
  this.dataLoaded(5);
1564
2218
  }
1565
- /**表单控件模板-动态赋值表单控件 */
2219
+ /**表单控件模板-动态表单配置组件 */
1566
2220
  FormControlRef;
1567
- /**表单控件模板-动态赋值表单控件 */
2221
+ /**表单控件模板-动态表单组件 */
1568
2222
  FormComponentsRef;
1569
2223
  /**表单控件组 */
1570
2224
  _fieldControlGroup = FieldControlGroup;
@@ -1610,19 +2264,22 @@ class DynamicComponent {
1610
2264
  instance.fields = this._fields;
1611
2265
  instance.parentFiledName = this._parentFiledName;
1612
2266
  instance.selected = this._selected;
2267
+ instance.culture = this._culture;
1613
2268
  }
1614
2269
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1615
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DynamicComponent, selector: "df-dynamic", inputs: { selected: "selected", type: "type", entity: "entity", parentFiledName: "parentFiledName", fields: "fields" }, viewQueries: [{ propertyName: "FormControlRef", first: true, predicate: ["FormControlRef"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "FormComponentsRef", first: true, predicate: ["FormComponentsRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>", styles: [""] });
2270
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DynamicComponent, isStandalone: true, selector: "df-dynamic", inputs: { selected: "selected", type: "type", entity: "entity", culture: "culture", parentFiledName: "parentFiledName", fields: "fields" }, viewQueries: [{ propertyName: "FormControlRef", first: true, predicate: ["FormControlRef"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "FormComponentsRef", first: true, predicate: ["FormComponentsRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>", styles: [""] });
1616
2271
  }
1617
2272
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, decorators: [{
1618
2273
  type: Component,
1619
- args: [{ selector: 'df-dynamic', template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
2274
+ args: [{ selector: 'df-dynamic', standalone: true, template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
1620
2275
  }], propDecorators: { selected: [{
1621
2276
  type: Input
1622
2277
  }], type: [{
1623
2278
  type: Input
1624
2279
  }], entity: [{
1625
2280
  type: Input
2281
+ }], culture: [{
2282
+ type: Input
1626
2283
  }], parentFiledName: [{
1627
2284
  type: Input
1628
2285
  }], fields: [{
@@ -1657,7 +2314,11 @@ class DynamicFormModule {
1657
2314
  CkEditorConfigComponent,
1658
2315
  SelectConfigComponent,
1659
2316
  SelectControlComponent,
1660
- DynamicComponent], imports: [FormsModule,
2317
+ // DynamicComponent,
2318
+ TableConfigComponent,
2319
+ TableControlComponent,
2320
+ MatrixConfigComponent,
2321
+ MatrixControlComponent], imports: [FormsModule,
1661
2322
  CoreModule,
1662
2323
  ThemeSharedModule,
1663
2324
  ReactiveFormsModule,
@@ -1676,7 +2337,11 @@ class DynamicFormModule {
1676
2337
  CkEditorConfigComponent,
1677
2338
  SelectConfigComponent,
1678
2339
  SelectControlComponent,
1679
- DynamicComponent] });
2340
+ // DynamicComponent,
2341
+ TableConfigComponent,
2342
+ TableControlComponent,
2343
+ MatrixConfigComponent,
2344
+ MatrixControlComponent] });
1680
2345
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, imports: [FormsModule,
1681
2346
  CoreModule,
1682
2347
  ThemeSharedModule,
@@ -1702,7 +2367,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1702
2367
  CkEditorConfigComponent,
1703
2368
  SelectConfigComponent,
1704
2369
  SelectControlComponent,
1705
- DynamicComponent,
2370
+ // DynamicComponent,
2371
+ TableConfigComponent,
2372
+ TableControlComponent,
2373
+ MatrixConfigComponent,
2374
+ MatrixControlComponent,
1706
2375
  ],
1707
2376
  imports: [
1708
2377
  FormsModule,
@@ -1727,7 +2396,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1727
2396
  CkEditorConfigComponent,
1728
2397
  SelectConfigComponent,
1729
2398
  SelectControlComponent,
1730
- DynamicComponent
2399
+ // DynamicComponent,
2400
+ TableConfigComponent,
2401
+ TableControlComponent,
2402
+ MatrixConfigComponent,
2403
+ MatrixControlComponent,
1731
2404
  ],
1732
2405
  }]
1733
2406
  }] });
@@ -1914,5 +2587,5 @@ var index = /*#__PURE__*/Object.freeze({
1914
2587
  * Generated bundle index. Do not edit.
1915
2588
  */
1916
2589
 
1917
- export { AddFieldControlGroup, CkEditorConfigComponent, CkEditorControlComponent, DateEditConfigComponent, DateEditControlComponent, DateEditInterfaces, DfApiService, index$b as Dignite, DynamicComponent, DynamicFormModule, FieldControlGroup, FileExplorerConfigComponent, FileExplorerControlComponent, index$3 as Microsoft, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent, TextEditMode, index as Volo, getExcludeAssignControl, maxDecimalPlacesValidator };
2590
+ export { AddFieldControlGroup, CkEditorConfigComponent, CkEditorControlComponent, DateEditConfigComponent, DateEditControlComponent, DateEditInterfaces, DfApiService, index$b as Dignite, DynamicComponent, DynamicFormModule, FieldControlGroup, FileExplorerConfigComponent, FileExplorerControlComponent, MatrixConfig, MatrixConfigComponent, MatrixControlComponent, MatrixItemConfig, index$3 as Microsoft, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TableConfig, TableConfigComponent, TableControlComponent, TableFormControl, TextEditComponent, TextEditConfig, TextEditConfigComponent, TextEditMode, index as Volo, getExcludeAssignControl, matrixFieldInputBase, maxDecimalPlacesValidator };
1918
2591
  //# sourceMappingURL=dignite-ng-expand.dynamic-form.mjs.map