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

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 (33) hide show
  1. package/esm2022/lib/components/dynamic/dynamic.component.mjs +3 -3
  2. package/esm2022/lib/components/from/ck-editor/ck-editor-config.component.mjs +2 -2
  3. package/esm2022/lib/components/from/file-explorer/file-explorer-config.component.mjs +2 -2
  4. package/esm2022/lib/components/from/file-explorer/file-explorer-config.mjs +3 -2
  5. package/esm2022/lib/components/from/form-control-group.mjs +1 -17
  6. package/esm2022/lib/components/from/index.mjs +1 -3
  7. package/esm2022/lib/dynamic-form.module.mjs +7 -22
  8. package/esm2022/lib/services/create-dynamic-components.service.mjs +51 -0
  9. package/esm2022/lib/services/index.mjs +2 -1
  10. package/fesm2022/dignite-ng-expand.dynamic-form.mjs +61 -709
  11. package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
  12. package/lib/components/dynamic/dynamic.component.d.ts +1 -1
  13. package/lib/components/from/index.d.ts +0 -2
  14. package/lib/dynamic-form.module.d.ts +8 -11
  15. package/lib/services/create-dynamic-components.service.d.ts +13 -0
  16. package/lib/services/index.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/esm2022/lib/components/from/matrix/index.mjs +0 -4
  19. package/esm2022/lib/components/from/matrix/matrix-config.component.mjs +0 -225
  20. package/esm2022/lib/components/from/matrix/matrix-config.mjs +0 -50
  21. package/esm2022/lib/components/from/matrix/matrix-control.component.mjs +0 -110
  22. package/esm2022/lib/components/from/table/index.mjs +0 -4
  23. package/esm2022/lib/components/from/table/table-config.component.mjs +0 -171
  24. package/esm2022/lib/components/from/table/table-config.mjs +0 -38
  25. package/esm2022/lib/components/from/table/table-control.component.mjs +0 -112
  26. package/lib/components/from/matrix/index.d.ts +0 -3
  27. package/lib/components/from/matrix/matrix-config.component.d.ts +0 -72
  28. package/lib/components/from/matrix/matrix-config.d.ts +0 -24
  29. package/lib/components/from/matrix/matrix-control.component.d.ts +0 -39
  30. package/lib/components/from/table/index.d.ts +0 -3
  31. package/lib/components/from/table/table-config.component.d.ts +0 -57
  32. package/lib/components/from/table/table-config.d.ts +0 -18
  33. package/lib/components/from/table/table-control.component.d.ts +0 -36
@@ -1,12 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, inject, ViewContainerRef, NgModule } from '@angular/core';
2
+ import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, ViewContainerRef, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
- import { Validators, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl, FormBuilder } from '@angular/forms';
4
+ import { Validators, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl } 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';
8
7
  import { ThemeSharedModule } from '@abp/ng.theme.shared';
9
- import * as i7 from '@ng-bootstrap/ng-bootstrap';
10
8
  import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
11
9
  import { NzTreeModule } from 'ng-zorro-antd/tree';
12
10
  import * as i4 from '@dignite-ng/expand.file-explorer';
@@ -586,7 +584,7 @@ class CkEditorConfigComponent {
586
584
  // if (this.Entity && (this._selected || this._selected === '')) {
587
585
  if (this.Entity && this._type) {
588
586
  await this.AfterInit();
589
- this.submitclick.nativeElement.click();
587
+ // this.submitclick.nativeElement.click();
590
588
  }
591
589
  }
592
590
  AfterInit() {
@@ -997,7 +995,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
997
995
 
998
996
  class FileExplorerConfig {
999
997
  /**文件容器名称 */
1000
- 'FileExplorer.FileContainerName' = ['', []];
998
+ 'FileExplorer.FileContainerName' = ['', [Validators.required]];
1001
999
  /**多选 */
1002
1000
  'FileExplorer.UploadFileMultiple' = [false, []];
1003
1001
  constructor(data) {
@@ -1041,7 +1039,7 @@ class FileExplorerConfigComponent {
1041
1039
  async dataLoaded() {
1042
1040
  if (this._Entity && this._type) {
1043
1041
  await this.AfterInit();
1044
- this.submitclick.nativeElement.click();
1042
+ this.submitclick?.nativeElement?.click();
1045
1043
  }
1046
1044
  }
1047
1045
  AfterInit() {
@@ -1165,44 +1163,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1165
1163
  args: ['submitclick', { static: true }]
1166
1164
  }] } });
1167
1165
 
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({});
1166
+ class SelectConfig {
1167
+ /**空值文本 */
1168
+ 'Select.NullText' = ['', []];
1169
+ //多选
1170
+ 'Select.Multiple' = [false, []];
1171
+ // 选项
1172
+ 'Select.Options' = new FormArray([]);
1206
1173
  constructor(data) {
1207
1174
  if (data) {
1208
1175
  for (const key in data) {
@@ -1214,108 +1181,6 @@ class matrixFieldInputBase {
1214
1181
  }
1215
1182
  }
1216
1183
 
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
-
1319
1184
  class DfApiService {
1320
1185
  constructor() { }
1321
1186
  /**
@@ -1395,235 +1260,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1395
1260
  }]
1396
1261
  }], ctorParameters: function () { return []; } });
1397
1262
 
1398
- class MatrixConfigComponent {
1399
- fb;
1400
- _DfApiService;
1401
- constructor(fb, _DfApiService) {
1402
- this.fb = fb;
1403
- this._DfApiService = _DfApiService;
1404
- }
1263
+ class CreateDynamicComponentsService {
1264
+ constructor() { }
1405
1265
  /**表单控件组 */
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)
1266
+ _fieldControlGroup = FieldControlGroup;
1267
+ /**加载动态表单配置组件 */
1268
+ loadfieldConfigComponent(input) {
1269
+ let { configRef, type, entity, selected } = input;
1270
+ let fieldControlItem = this._fieldControlGroup.find(el => el.name === type);
1271
+ //清空了容器中的所有组件
1272
+ configRef?.clear();
1273
+ if (!fieldControlItem || !fieldControlItem.fieldConfigComponent)
1578
1274
  return;
1579
- nameInput.patchValue(pinyin);
1275
+ //在容器中创建组件
1276
+ const { instance } = configRef?.createComponent(fieldControlItem.fieldConfigComponent); //创建组件模板
1277
+ console.log('加载动态表单配置组件', input, instance);
1278
+ /**向创建的组件模板中传值 */
1279
+ instance.Entity = entity;
1280
+ instance.selected = selected;
1281
+ instance.type = type;
1580
1282
  }
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)
1283
+ /**加载动态表单组件 */
1284
+ loadfieldComponent(input) {
1285
+ let { controlRef, entity, fields, parentFiledName, selected, culture } = input;
1286
+ let fieldControlItem = this._fieldControlGroup.find(el => el.name === fields.field.formControlName);
1287
+ //清空了容器中的所有组件
1288
+ controlRef?.clear();
1289
+ if (!fieldControlItem || !fieldControlItem.fieldComponent)
1587
1290
  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
- }
1291
+ //在容器中创建组件
1292
+ const { instance } = controlRef?.createComponent(fieldControlItem.fieldComponent); //创建组件模板
1293
+ /**向创建的组件模板中传值 */
1294
+ instance.entity = entity;
1295
+ instance.fields = fields;
1296
+ instance.parentFiledName = parentFiledName;
1297
+ instance.selected = selected;
1298
+ instance.culture = culture;
1299
+ }
1300
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateDynamicComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1301
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateDynamicComponentsService, providedIn: 'root' });
1626
1302
  }
1303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateDynamicComponentsService, decorators: [{
1304
+ type: Injectable,
1305
+ args: [{
1306
+ providedIn: 'root'
1307
+ }]
1308
+ }], ctorParameters: function () { return []; } });
1627
1309
 
1628
1310
  class SelectConfigComponent {
1629
1311
  fb;
@@ -1800,307 +1482,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1800
1482
  args: ['submitclick', { static: true }]
1801
1483
  }] } });
1802
1484
 
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
-
2104
1485
  /**
2105
1486
  * 表单控件分组-包含配置,控件,显示的数组
2106
1487
  */
@@ -2136,20 +1517,6 @@ const FieldControlGroup = [
2136
1517
  fieldComponent: DateEditControlComponent,
2137
1518
  // fieldViewComponent:TextBoxViewComponent,
2138
1519
  },
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
- },
2153
1520
  {
2154
1521
  displayName: '文件管理',
2155
1522
  name: 'FileExplorer',
@@ -2267,11 +1634,11 @@ class DynamicComponent {
2267
1634
  instance.culture = this._culture;
2268
1635
  }
2269
1636
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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: [""] });
1637
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DynamicComponent, 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: [""] });
2271
1638
  }
2272
1639
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, decorators: [{
2273
1640
  type: Component,
2274
- args: [{ selector: 'df-dynamic', standalone: true, template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
1641
+ args: [{ selector: 'df-dynamic', template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
2275
1642
  }], propDecorators: { selected: [{
2276
1643
  type: Input
2277
1644
  }], type: [{
@@ -2314,11 +1681,7 @@ class DynamicFormModule {
2314
1681
  CkEditorConfigComponent,
2315
1682
  SelectConfigComponent,
2316
1683
  SelectControlComponent,
2317
- // DynamicComponent,
2318
- TableConfigComponent,
2319
- TableControlComponent,
2320
- MatrixConfigComponent,
2321
- MatrixControlComponent], imports: [FormsModule,
1684
+ DynamicComponent], imports: [FormsModule,
2322
1685
  CoreModule,
2323
1686
  ThemeSharedModule,
2324
1687
  ReactiveFormsModule,
@@ -2337,11 +1700,7 @@ class DynamicFormModule {
2337
1700
  CkEditorConfigComponent,
2338
1701
  SelectConfigComponent,
2339
1702
  SelectControlComponent,
2340
- // DynamicComponent,
2341
- TableConfigComponent,
2342
- TableControlComponent,
2343
- MatrixConfigComponent,
2344
- MatrixControlComponent] });
1703
+ DynamicComponent] });
2345
1704
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, imports: [FormsModule,
2346
1705
  CoreModule,
2347
1706
  ThemeSharedModule,
@@ -2367,11 +1726,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2367
1726
  CkEditorConfigComponent,
2368
1727
  SelectConfigComponent,
2369
1728
  SelectControlComponent,
2370
- // DynamicComponent,
2371
- TableConfigComponent,
2372
- TableControlComponent,
2373
- MatrixConfigComponent,
2374
- MatrixControlComponent,
1729
+ DynamicComponent,
2375
1730
  ],
2376
1731
  imports: [
2377
1732
  FormsModule,
@@ -2381,6 +1736,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2381
1736
  NgbDropdownModule,
2382
1737
  NzTreeModule,
2383
1738
  FileExplorerModule,
1739
+ // DynamicComponent
2384
1740
  ],
2385
1741
  exports: [
2386
1742
  TextEditConfigComponent,
@@ -2396,11 +1752,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2396
1752
  CkEditorConfigComponent,
2397
1753
  SelectConfigComponent,
2398
1754
  SelectControlComponent,
2399
- // DynamicComponent,
2400
- TableConfigComponent,
2401
- TableControlComponent,
2402
- MatrixConfigComponent,
2403
- MatrixControlComponent,
1755
+ DynamicComponent,
2404
1756
  ],
2405
1757
  }]
2406
1758
  }] });
@@ -2587,5 +1939,5 @@ var index = /*#__PURE__*/Object.freeze({
2587
1939
  * Generated bundle index. Do not edit.
2588
1940
  */
2589
1941
 
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 };
1942
+ export { AddFieldControlGroup, CkEditorConfigComponent, CkEditorControlComponent, CreateDynamicComponentsService, 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 };
2591
1943
  //# sourceMappingURL=dignite-ng-expand.dynamic-form.mjs.map