@yibozhang/pro-table 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/yibozhang-pro-table.umd.js +410 -80
- package/bundles/yibozhang-pro-table.umd.js.map +1 -1
- package/bundles/yibozhang-pro-table.umd.min.js +1 -1
- package/bundles/yibozhang-pro-table.umd.min.js.map +1 -1
- package/esm2015/lib/page-container/page-container.component.js +4 -2
- package/esm2015/lib/page-public/antd-form.js +168 -36
- package/esm2015/lib/page-public/array-form.js +29 -1
- package/esm2015/lib/pro-table.component.js +156 -25
- package/fesm2015/yibozhang-pro-table.js +358 -63
- package/fesm2015/yibozhang-pro-table.js.map +1 -1
- package/lib/page-container/page-container.component.d.ts +1 -0
- package/lib/page-container/page-container.component.d.ts.map +1 -1
- package/lib/page-public/antd-form.d.ts +15 -1
- package/lib/page-public/antd-form.d.ts.map +1 -1
- package/lib/page-public/array-form.d.ts +2 -0
- package/lib/page-public/array-form.d.ts.map +1 -1
- package/lib/pro-table.component.d.ts +5 -0
- package/lib/pro-table.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/yibozhang-pro-table.metadata.json +1 -1
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('lodash-es'), require('rxjs'), require('@angular/cdk/drag-drop'), require('@angular/common'), require('@angular/common/http'), require('@angular/forms'), require('@angular/router'), require('ng-zorro-antd/button'), require('ng-zorro-antd/checkbox'), require('ng-zorro-antd/date-picker'), require('ng-zorro-antd/form'), require('ng-zorro-antd/grid'), require('ng-zorro-antd/icon'), require('ng-zorro-antd/input'), require('ng-zorro-antd/modal'), require('ng-zorro-antd/popover'), require('ng-zorro-antd/select'), require('ng-zorro-antd/space'), require('ng-zorro-antd/table'), require('ng-zorro-antd/typography'), require('ng-zorro-antd/card'), require('sortablejs'), require('ng-zorro-antd/auto-complete'), require('ng-zorro-antd/input-number'), require('ng-zorro-antd/tooltip'), require('rxjs/operators'), require('uuid')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@yibozhang/pro-table', ['exports', '@angular/core', 'lodash-es', 'rxjs', '@angular/cdk/drag-drop', '@angular/common', '@angular/common/http', '@angular/forms', '@angular/router', 'ng-zorro-antd/button', 'ng-zorro-antd/checkbox', 'ng-zorro-antd/date-picker', 'ng-zorro-antd/form', 'ng-zorro-antd/grid', 'ng-zorro-antd/icon', 'ng-zorro-antd/input', 'ng-zorro-antd/modal', 'ng-zorro-antd/popover', 'ng-zorro-antd/select', 'ng-zorro-antd/space', 'ng-zorro-antd/table', 'ng-zorro-antd/typography', 'ng-zorro-antd/card', 'sortablejs', 'ng-zorro-antd/auto-complete', 'ng-zorro-antd/input-number', 'ng-zorro-antd/tooltip', 'rxjs/operators', 'uuid'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yibozhang = global.yibozhang || {}, global.yibozhang[
|
|
5
|
-
}(this, (function (exports, i0, lodashEs, rxjs, dragDrop, common, http, i1, router, button, checkbox, datePicker, form, grid, icon, input, modal, popover, select, space, table, typography, card, Sortable, autoComplete, inputNumber, tooltip, operators, uuid) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yibozhang = global.yibozhang || {}, global.yibozhang["pro-table"] = {}), global.ng.core, global.lodashEs, global.rxjs, global.ng.cdk.dragDrop, global.ng.common, global.ng.common.http, global.ng.forms, global.ng.router, global.button, global.checkbox, global.datePicker, global.form, global.grid, global.icon, global.input, global.modal, global.popover, global.select, global.space, global.table, global.typography, global.card, global.Sortable, global.autoComplete, global.inputNumber, global.tooltip, global.rxjs.operators, global.uuid));
|
|
5
|
+
})(this, (function (exports, i0, lodashEs, rxjs, dragDrop, common, http, i1, router, button, checkbox, datePicker, form, grid, icon, input, modal, popover, select, space, table, typography, card, Sortable, autoComplete, inputNumber, tooltip, operators, uuid) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
9
29
|
var Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
|
|
10
30
|
|
|
11
31
|
/******************************************************************************
|
|
@@ -669,8 +689,10 @@
|
|
|
669
689
|
};
|
|
670
690
|
this._loading = false;
|
|
671
691
|
this._selectedTableRow = null;
|
|
672
|
-
//
|
|
692
|
+
// 选中的行数据(用于复选框选择)- 保留用于兼容性
|
|
673
693
|
this._selectedRows = [];
|
|
694
|
+
// 使用 Set 存储选中项的 ID,支持跨页选中
|
|
695
|
+
this._selectedRowIds = new Set();
|
|
674
696
|
// 全选状态
|
|
675
697
|
this._checkedAll = false;
|
|
676
698
|
// 半选状态(部分选中)
|
|
@@ -1267,7 +1289,12 @@
|
|
|
1267
1289
|
return this._selectedTableRow;
|
|
1268
1290
|
};
|
|
1269
1291
|
ProTableComponent.prototype.getCheckedRows = function () {
|
|
1270
|
-
|
|
1292
|
+
if (!this.showCheckbox) {
|
|
1293
|
+
return [];
|
|
1294
|
+
}
|
|
1295
|
+
// 返回当前数据源中所有 checked 为 true 的项
|
|
1296
|
+
// 注意:如果需要获取所有页的选中项,需要遍历所有数据源或使用 _selectedRowIds
|
|
1297
|
+
return this.dataSource.filter(function (row) { return row.checked === true; });
|
|
1271
1298
|
};
|
|
1272
1299
|
// 获取指定名称的模板
|
|
1273
1300
|
ProTableComponent.prototype.getTemplate = function (name) {
|
|
@@ -1314,14 +1341,16 @@
|
|
|
1314
1341
|
return false;
|
|
1315
1342
|
return this.rowDisabled ? this.rowDisabled(data) : false;
|
|
1316
1343
|
};
|
|
1317
|
-
//
|
|
1344
|
+
// 检查行是否被复选框选中(数据驱动模式)
|
|
1318
1345
|
ProTableComponent.prototype.isRowChecked = function (data) {
|
|
1319
1346
|
if (!this.showCheckbox)
|
|
1320
1347
|
return false;
|
|
1321
|
-
|
|
1348
|
+
// 直接读取数据对象的 checked 属性
|
|
1349
|
+
return data.checked === true;
|
|
1322
1350
|
};
|
|
1323
|
-
//
|
|
1351
|
+
// 切换行的选中状态(数据驱动模式,保留用于兼容)
|
|
1324
1352
|
ProTableComponent.prototype.toggleRowChecked = function (data, checked, event) {
|
|
1353
|
+
var _this = this;
|
|
1325
1354
|
if (event) {
|
|
1326
1355
|
event.stopPropagation(); // 阻止事件冒泡,避免触发行点击
|
|
1327
1356
|
}
|
|
@@ -1329,9 +1358,21 @@
|
|
|
1329
1358
|
if (this.isRowDisabled(data)) {
|
|
1330
1359
|
return;
|
|
1331
1360
|
}
|
|
1332
|
-
|
|
1361
|
+
// 直接设置数据对象的 checked 属性
|
|
1362
|
+
data.checked = checked;
|
|
1363
|
+
// 同步更新 _selectedRowIds(用于跨页选中)
|
|
1364
|
+
var id = this.getRowId(data);
|
|
1365
|
+
if (id !== undefined) {
|
|
1366
|
+
if (checked) {
|
|
1367
|
+
this._selectedRowIds.add(id);
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
this._selectedRowIds.delete(id);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
// 同步更新 _selectedRows(用于兼容性)
|
|
1374
|
+
var index = this._selectedRows.findIndex(function (row) { return _this.isSameRow(row, data); });
|
|
1333
1375
|
if (checked) {
|
|
1334
|
-
// 选中
|
|
1335
1376
|
if (index === -1) {
|
|
1336
1377
|
this._selectedRows.push(data);
|
|
1337
1378
|
}
|
|
@@ -1339,19 +1380,18 @@
|
|
|
1339
1380
|
this._selectedTableRow = data;
|
|
1340
1381
|
}
|
|
1341
1382
|
else {
|
|
1342
|
-
// 取消选中
|
|
1343
1383
|
if (index > -1) {
|
|
1344
1384
|
this._selectedRows.splice(index, 1);
|
|
1345
1385
|
}
|
|
1346
1386
|
// 若当前高亮行为该行,则取消高亮
|
|
1347
1387
|
if (this._selectedTableRow &&
|
|
1348
|
-
|
|
1388
|
+
this.isSameRow(this._selectedTableRow, data)) {
|
|
1349
1389
|
this._selectedTableRow = null;
|
|
1350
1390
|
}
|
|
1351
1391
|
}
|
|
1352
1392
|
this.updateCheckAllStatus();
|
|
1353
1393
|
};
|
|
1354
|
-
//
|
|
1394
|
+
// 更新全选状态(数据驱动模式)
|
|
1355
1395
|
ProTableComponent.prototype.updateCheckAllStatus = function () {
|
|
1356
1396
|
var _this = this;
|
|
1357
1397
|
if (!this.showCheckbox || !Array.isArray(this.dataSource)) {
|
|
@@ -1361,40 +1401,122 @@
|
|
|
1361
1401
|
}
|
|
1362
1402
|
// 只计算可用的行(未禁用的行)
|
|
1363
1403
|
var availableRows = this.dataSource.filter(function (row) { return !_this.isRowDisabled(row); });
|
|
1364
|
-
|
|
1404
|
+
// 基于数据对象的 checked 属性计算
|
|
1405
|
+
var checkedCount = availableRows.filter(function (row) { return row.checked === true; }).length;
|
|
1365
1406
|
var totalCount = availableRows.length;
|
|
1366
1407
|
this._checkedAll =
|
|
1367
1408
|
totalCount > 0 && checkedCount > 0 && checkedCount === totalCount;
|
|
1368
1409
|
this._indeterminate = checkedCount > 0 && checkedCount < totalCount;
|
|
1369
1410
|
};
|
|
1370
|
-
//
|
|
1411
|
+
// 全选/取消全选(数据驱动模式)
|
|
1371
1412
|
ProTableComponent.prototype.toggleCheckAll = function (checked, event) {
|
|
1372
1413
|
var _this = this;
|
|
1373
1414
|
if (event) {
|
|
1374
1415
|
event.stopPropagation();
|
|
1375
1416
|
}
|
|
1417
|
+
// 只处理可用的行(未禁用的行)
|
|
1418
|
+
var availableRows = this.dataSource.filter(function (row) { return !_this.isRowDisabled(row); });
|
|
1419
|
+
// 批量设置 checked 属性
|
|
1420
|
+
availableRows.forEach(function (row) {
|
|
1421
|
+
row.checked = checked;
|
|
1422
|
+
// 同步更新 _selectedRowIds(用于跨页选中)
|
|
1423
|
+
var id = _this.getRowId(row);
|
|
1424
|
+
if (id !== undefined) {
|
|
1425
|
+
if (checked) {
|
|
1426
|
+
_this._selectedRowIds.add(id);
|
|
1427
|
+
}
|
|
1428
|
+
else {
|
|
1429
|
+
_this._selectedRowIds.delete(id);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
// 同步更新 _selectedRows(用于兼容性)
|
|
1376
1434
|
if (checked) {
|
|
1377
|
-
|
|
1378
|
-
this._selectedRows = this.dataSource.filter(function (row) { return !_this.isRowDisabled(row); });
|
|
1435
|
+
this._selectedRows = __spread(availableRows);
|
|
1379
1436
|
// 同步设置高亮选中行为第一条可选数据
|
|
1380
|
-
var availableRows = this._selectedRows;
|
|
1381
1437
|
this._selectedTableRow =
|
|
1382
1438
|
availableRows.length > 0 ? availableRows[0] : null;
|
|
1383
1439
|
}
|
|
1384
1440
|
else {
|
|
1385
|
-
// 取消全选
|
|
1386
1441
|
this._selectedRows = [];
|
|
1387
1442
|
// 取消高亮
|
|
1388
1443
|
this._selectedTableRow = null;
|
|
1389
1444
|
}
|
|
1390
1445
|
this.updateCheckAllStatus();
|
|
1391
1446
|
};
|
|
1392
|
-
//
|
|
1447
|
+
// 获取选中的行数据(保留用于兼容性)
|
|
1393
1448
|
ProTableComponent.prototype.getSelectedRows = function () {
|
|
1394
|
-
return this.
|
|
1449
|
+
return this.getCheckedRows();
|
|
1395
1450
|
};
|
|
1396
|
-
//
|
|
1451
|
+
// 处理行 checkbox 变化事件(数据驱动模式)
|
|
1452
|
+
ProTableComponent.prototype.handleRowCheckedChange = function (data, checked) {
|
|
1453
|
+
var _this = this;
|
|
1454
|
+
if (this.isRowDisabled(data)) {
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
// 数据对象的 checked 属性已经通过双向绑定自动更新
|
|
1458
|
+
// 这里只需要同步更新 _selectedRowIds 和 _selectedRows
|
|
1459
|
+
// 同步更新 _selectedRowIds(用于跨页选中)
|
|
1460
|
+
var id = this.getRowId(data);
|
|
1461
|
+
if (id !== undefined) {
|
|
1462
|
+
if (checked) {
|
|
1463
|
+
this._selectedRowIds.add(id);
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
this._selectedRowIds.delete(id);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
// 同步更新 _selectedRows(用于兼容性)
|
|
1470
|
+
var index = this._selectedRows.findIndex(function (row) { return _this.isSameRow(row, data); });
|
|
1471
|
+
if (checked) {
|
|
1472
|
+
if (index === -1) {
|
|
1473
|
+
this._selectedRows.push(data);
|
|
1474
|
+
}
|
|
1475
|
+
// 勾选复选框时同步设置高亮选中行
|
|
1476
|
+
this._selectedTableRow = data;
|
|
1477
|
+
}
|
|
1478
|
+
else {
|
|
1479
|
+
if (index > -1) {
|
|
1480
|
+
this._selectedRows.splice(index, 1);
|
|
1481
|
+
}
|
|
1482
|
+
// 若当前高亮行为该行,则取消高亮
|
|
1483
|
+
if (this._selectedTableRow &&
|
|
1484
|
+
this.isSameRow(this._selectedTableRow, data)) {
|
|
1485
|
+
this._selectedTableRow = null;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
// 更新全选状态
|
|
1489
|
+
this.updateCheckAllStatus();
|
|
1490
|
+
};
|
|
1491
|
+
// 刷新全选状态(用于其他场景)
|
|
1492
|
+
ProTableComponent.prototype.refreshCheckAllStatus = function () {
|
|
1493
|
+
this.updateCheckAllStatus();
|
|
1494
|
+
};
|
|
1495
|
+
// 获取行的唯一标识(用于跨页选中)
|
|
1496
|
+
ProTableComponent.prototype.getRowId = function (data) {
|
|
1497
|
+
var _a, _b;
|
|
1498
|
+
return (_b = (_a = data.id) !== null && _a !== void 0 ? _a : data.key) !== null && _b !== void 0 ? _b : undefined;
|
|
1499
|
+
};
|
|
1500
|
+
// 判断两行是否为同一行
|
|
1501
|
+
ProTableComponent.prototype.isSameRow = function (row1, row2) {
|
|
1502
|
+
var id1 = this.getRowId(row1);
|
|
1503
|
+
var id2 = this.getRowId(row2);
|
|
1504
|
+
if (id1 !== undefined && id2 !== undefined) {
|
|
1505
|
+
return id1 === id2;
|
|
1506
|
+
}
|
|
1507
|
+
// fallback 到 JSON 比较
|
|
1508
|
+
return JSON.stringify(row1) === JSON.stringify(row2);
|
|
1509
|
+
};
|
|
1510
|
+
// 清空选中的行(数据驱动模式)
|
|
1397
1511
|
ProTableComponent.prototype.clearSelectedRows = function () {
|
|
1512
|
+
// 清空当前数据源中所有项的 checked 状态
|
|
1513
|
+
if (Array.isArray(this.dataSource)) {
|
|
1514
|
+
this.dataSource.forEach(function (row) {
|
|
1515
|
+
row.checked = false;
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
// 清空选中集合
|
|
1519
|
+
this._selectedRowIds.clear();
|
|
1398
1520
|
this._selectedRows = [];
|
|
1399
1521
|
this._checkedAll = false;
|
|
1400
1522
|
this._indeterminate = false;
|
|
@@ -1466,7 +1588,8 @@
|
|
|
1466
1588
|
};
|
|
1467
1589
|
ProTableComponent.prototype.handleQuery = function (afterDelete) {
|
|
1468
1590
|
return __awaiter(this, void 0, void 0, function () {
|
|
1469
|
-
var result, error_4;
|
|
1591
|
+
var previousDataSource, result, newDataIds_1, error_4;
|
|
1592
|
+
var _this = this;
|
|
1470
1593
|
return __generator(this, function (_d) {
|
|
1471
1594
|
switch (_d.label) {
|
|
1472
1595
|
case 0:
|
|
@@ -1477,6 +1600,7 @@
|
|
|
1477
1600
|
this._pageInfo.pageIndex > 1) {
|
|
1478
1601
|
this._pageInfo.pageIndex = this._pageInfo.pageIndex - 1;
|
|
1479
1602
|
}
|
|
1603
|
+
previousDataSource = afterDelete && this.showCheckbox ? __spread(this.dataSource) : [];
|
|
1480
1604
|
this._loading = true;
|
|
1481
1605
|
if (!this.request) return [3 /*break*/, 6];
|
|
1482
1606
|
_d.label = 1;
|
|
@@ -1490,7 +1614,38 @@
|
|
|
1490
1614
|
: {})))];
|
|
1491
1615
|
case 2:
|
|
1492
1616
|
result = _d.sent();
|
|
1493
|
-
|
|
1617
|
+
// 自动注入 checked 字段,支持跨页选中
|
|
1618
|
+
if (this.showCheckbox) {
|
|
1619
|
+
this.dataSource = (result.data || []).map(function (item) {
|
|
1620
|
+
var id = _this.getRowId(item);
|
|
1621
|
+
// 如果数据已有 checked 属性,保留;否则根据 _selectedRowIds 判断
|
|
1622
|
+
var checked = item.checked !== undefined
|
|
1623
|
+
? item.checked
|
|
1624
|
+
: id !== undefined
|
|
1625
|
+
? _this._selectedRowIds.has(id)
|
|
1626
|
+
: false;
|
|
1627
|
+
return Object.assign(Object.assign({}, item), { checked: checked });
|
|
1628
|
+
});
|
|
1629
|
+
// 删除后查询:移除被删除项的选中状态
|
|
1630
|
+
if (afterDelete && previousDataSource.length > 0) {
|
|
1631
|
+
newDataIds_1 = new Set(this.dataSource.map(function (item) { return _this.getRowId(item); }));
|
|
1632
|
+
// 遍历之前的数据源,如果不在新数据源中,说明被删除了,需要清除其选中状态
|
|
1633
|
+
previousDataSource.forEach(function (oldItem) {
|
|
1634
|
+
var oldId = _this.getRowId(oldItem);
|
|
1635
|
+
if (oldId !== undefined && !newDataIds_1.has(oldId)) {
|
|
1636
|
+
// 被删除的项,从选中集合中移除
|
|
1637
|
+
_this._selectedRowIds.delete(oldId);
|
|
1638
|
+
// 如果数据对象还在其他地方引用,清除其选中状态
|
|
1639
|
+
if (oldItem.checked !== undefined) {
|
|
1640
|
+
oldItem.checked = false;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
this.dataSource = result.data || [];
|
|
1648
|
+
}
|
|
1494
1649
|
this.summaryData = result.summaryData || null;
|
|
1495
1650
|
// 本地排序模式:拿到数据后在前端排序
|
|
1496
1651
|
if (this.sortMode === "local") {
|
|
@@ -1518,9 +1673,7 @@
|
|
|
1518
1673
|
console.warn("未提供 _request 回调函数");
|
|
1519
1674
|
this._loading = false;
|
|
1520
1675
|
_d.label = 7;
|
|
1521
|
-
case 7:
|
|
1522
|
-
this.clearSelectedRows();
|
|
1523
|
-
return [2 /*return*/];
|
|
1676
|
+
case 7: return [2 /*return*/];
|
|
1524
1677
|
}
|
|
1525
1678
|
});
|
|
1526
1679
|
});
|
|
@@ -1632,7 +1785,7 @@
|
|
|
1632
1785
|
ProTableComponent.decorators = [
|
|
1633
1786
|
{ type: i0.Component, args: [{
|
|
1634
1787
|
selector: "app-pro-table",
|
|
1635
|
-
template: "<app-page-container [title]=\"title\">\r\n <ng-template #header>\r\n <app-table-search-bar\r\n *ngIf=\"showSearchBar\"\r\n [labelWidth]=\"labelWidth\"\r\n [labelAlign]=\"labelAlign\"\r\n >\r\n <ng-template #leftContent>\r\n <nz-form-item\r\n *ngFor=\"let column of _searchFiledColumns\"\r\n [ngClass]=\"getFormItemClassName(column)\"\r\n >\r\n <nz-form-label *ngIf=\"!getFieldProps(column).hideLabel\" nzNoColon>\r\n <!-- \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49label\u6A21\u677F -->\r\n <ng-container\r\n *ngIf=\"\r\n column.customLabelRender &&\r\n getLabelTemplate(column.customLabelRender);\r\n else defaultLabel\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"getLabelTemplate(column.customLabelRender)\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: column,\r\n column: column,\r\n fieldProps: getFieldProps(column)\r\n }\"\r\n >\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #defaultLabel>\r\n {{ getFieldProps(column).label || column.title }}\r\n </ng-template>\r\n </nz-form-label>\r\n <nz-form-control *ngIf=\"column.valueType === 'input'\">\r\n <input\r\n nz-input\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [placeholder]=\"getFieldProps(column).placeHolder\"\r\n [disabled]=\"getFieldProps(column).disabled\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n />\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'inputPlate'\">\r\n <app-plate-input\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n ></app-plate-input>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'select'\">\r\n <nz-select\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [nzOptions]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n >\r\n </nz-select>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'selectMultiple'\">\r\n <nz-select\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [nzOptions]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n nzMode=\"multiple\"\r\n >\r\n </nz-select>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'date'\">\r\n <nz-date-picker\r\n [nzShowTime]=\"getFieldProps(column).showTime\"\r\n [nzFormat]=\"getFieldProps(column).format\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzMode]=\"getFieldProps(column).mode\"\r\n ></nz-date-picker>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'checkbox'\">\r\n <nz-checkbox-group\r\n [class]=\"\r\n getFieldProps(column).noStyle\r\n ? 'pro-table-checkboxgroup-nostyle'\r\n : ''\r\n \"\r\n [(ngModel)]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n (ngModelChange)=\"\r\n handleFieldCheckBoxChange(\r\n $event,\r\n getFieldProps(column).name || column.prop\r\n )\r\n \"\r\n ></nz-checkbox-group>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'autoComplete'\">\r\n <input\r\n nz-input\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column)?.name || column.prop]\r\n \"\r\n (input)=\"handleAutoCompleteInput($event, column)\"\r\n [nzAutocomplete]=\"auto\"\r\n [disabled]=\"getFieldProps(column)?.disabled\"\r\n [placeholder]=\"getFieldProps(column)?.placeHolder\"\r\n />\r\n <nz-autocomplete\r\n [nzBackfill]=\"getFieldProps(column).backFill\"\r\n [nzDefaultActiveFirstOption]=\"\r\n getFieldProps(column).defaultActiveFirstOption\r\n \"\r\n [nzWidth]=\"getFieldProps(column).width\"\r\n #auto\r\n >\r\n <nz-auto-option\r\n *ngFor=\"let option of getAutoCompleteDataSource(column)\"\r\n [nzValue]=\"\r\n getFieldProps(column).returnFullData ? option : option.value\r\n \"\r\n [nzLabel]=\"option.label\"\r\n [nzDisabled]=\"option.disabled\"\r\n >\r\n {{ option.label }}\r\n </nz-auto-option>\r\n </nz-autocomplete>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'custom'\">\r\n <app-dynamic-search-field\r\n [component]=\"getFieldProps(column).component\"\r\n [value]=\"_searchParams[getFieldProps(column).name || column.prop]\"\r\n [props]=\"getFieldProps(column)\"\r\n (valueChange)=\"\r\n setFieldValue(getFieldProps(column).name || column.prop, $event)\r\n \"\r\n ></app-dynamic-search-field>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'inputNumber'\">\r\n <nz-input-number\r\n [style.width]=\"'100%'\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n [nzFormatter]=\"getFieldProps(column).formatterPercent\"\r\n [nzParser]=\"getFieldProps(column).parserPercent\"\r\n ></nz-input-number>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </ng-template>\r\n <ng-template #actionTextBtn>\r\n <nz-space [nzSize]=\"4\">\r\n <nz-space-item *ngIf=\"showSearchBtn\">\r\n <button nz-button nzType=\"primary\" (click)=\"handleSearch()\">\r\n {{ confirmBtnText }}\r\n </button>\r\n </nz-space-item>\r\n <nz-space-item *ngIf=\"showClearBtn\">\r\n <button nz-button (click)=\"handleResetForm()\">\r\n {{ clearBtnText }}\r\n </button>\r\n </nz-space-item>\r\n </nz-space>\r\n </ng-template>\r\n <ng-template #actionImgBtn>\r\n <nz-space>\r\n <ng-container *ngTemplateOutlet=\"imgActionBarTpl\"></ng-container>\r\n <nz-space-item class=\"setting-space-item\" *ngIf=\"showColumnSetting\">\r\n <app-colmuns-setting\r\n [columns]=\"columns\"\r\n [selectedColumns]=\"_serverColumns\"\r\n [tableName]=\"tableName\"\r\n (afterConfirm)=\"handleColumnsSettingConfirm()\"\r\n ></app-colmuns-setting>\r\n </nz-space-item>\r\n </nz-space>\r\n </ng-template>\r\n </app-table-search-bar>\r\n </ng-template>\r\n <ng-template #body>\r\n <div class=\"mb-12\">\r\n <ng-container *ngIf=\"showActionBar\">\r\n <ng-container *ngTemplateOutlet=\"actionBarTpl\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-container *ngIf=\"customTableRender\">\r\n <ng-container *ngTemplateOutlet=\"customTableRender\"></ng-container>\r\n </ng-container>\r\n <nz-table\r\n *ngIf=\"!customTableRender\"\r\n #basicTable\r\n nzSize=\"small\"\r\n nzShowSizeChanger\r\n [nzBordered]=\"bordered\"\r\n [nzOuterBordered]=\"outerBordered\"\r\n [nzData]=\"dataSource\"\r\n [nzPageIndex]=\"_pageInfo.pageIndex\"\r\n [nzPageSize]=\"_pageInfo.pageSize\"\r\n [nzTotal]=\"_pageInfo.total\"\r\n [nzPageSizeOptions]=\"_pageInfo.pageSizeOptions\"\r\n [nzShowPagination]=\"showPagination\"\r\n [nzShowTotal]=\"totalTemplate\"\r\n [nzLoading]=\"_loading\"\r\n [nzFrontPagination]=\"frontPagination\"\r\n [nzScroll]=\"scroll\"\r\n (nzPageIndexChange)=\"handlePageIndexChange($event)\"\r\n (nzPageSizeChange)=\"handlePageSizeChange($event)\"\r\n >\r\n <thead>\r\n <tr>\r\n <!-- \u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF09 -->\r\n <th\r\n *ngIf=\"showCheckbox\"\r\n [nzWidth]=\"'50px'\"\r\n [nzAlign]=\"'center'\"\r\n style=\"text-align: center\"\r\n >\r\n <label\r\n nz-checkbox\r\n [(ngModel)]=\"_checkedAll\"\r\n [nzIndeterminate]=\"_indeterminate\"\r\n (ngModelChange)=\"toggleCheckAll($event)\"\r\n (click)=\"$event.stopPropagation()\"\r\n ></label>\r\n </th>\r\n <th\r\n *ngFor=\"let column of _columns\"\r\n [nzWidth]=\"column.width\"\r\n [nzAlign]=\"column.align\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n [nzShowSort]=\"!!column.sorter\"\r\n [nzSortOrder]=\"getSortOrder(column.prop)\"\r\n (nzSortOrderChange)=\"onSortChange(column.prop, $event)\"\r\n >\r\n {{ column.title }}\r\n </th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <tr\r\n style=\"cursor: pointer\"\r\n *ngFor=\"let data; let i = index; of: basicTable.data\"\r\n [ngClass]=\"{\r\n 'ant-table-custom-row-selected': !!getTableRowChecked(data),\r\n 'ant-table-custom-row-even': i % 2 === 0,\r\n 'ant-table-custom-row-odd': i % 2 !== 0\r\n }\"\r\n (click)=\"handleTableRowClick(data)\"\r\n (dblclick)=\"handleTableRowDbClick(data)\"\r\n >\r\n <!-- \u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF09 -->\r\n <td\r\n *ngIf=\"showCheckbox\"\r\n [nzAlign]=\"'center'\"\r\n style=\"text-align: center\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n <label\r\n nz-checkbox\r\n [ngModel]=\"isRowChecked(data)\"\r\n [nzDisabled]=\"isRowDisabled(data)\"\r\n (ngModelChange)=\"toggleRowChecked(data, $event)\"\r\n ></label>\r\n </td>\r\n <td\r\n *ngFor=\"let column of _columns\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n [nzAlign]=\"column.align\"\r\n class=\"pro-ellipsis\"\r\n [title]=\"data[column.prop]\"\r\n >\r\n <!-- \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49\u6A21\u677F -->\r\n <ng-container\r\n *ngIf=\"\r\n column.customRender && getTemplate(column.customRender);\r\n let template\r\n \"\r\n >\r\n <ng-template\r\n [ngTemplateOutlet]=\"template\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: data,\r\n data: data,\r\n column: column,\r\n index: i,\r\n pageInfo: _pageInfo\r\n }\"\r\n >\r\n </ng-template>\r\n </ng-container>\r\n\r\n <!-- \u9ED8\u8BA4\u6E32\u67D3\u903B\u8F91 -->\r\n <ng-container\r\n *ngIf=\"!column.customRender || !getTemplate(column.customRender)\"\r\n >\r\n {{ data[column.prop] }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <tr *ngIf=\"summaryData && _pageInfo.total > 0\">\r\n <!-- \u6C47\u603B\u884C\u7684\u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF0C\u4F46\u4E3A\u7A7A\uFF09 -->\r\n <td\r\n *ngIf=\"showCheckbox\"\r\n style=\"font-weight: bold; border-right: 1px solid #e8e8e8\"\r\n ></td>\r\n <td\r\n *ngFor=\"let column; let i = index; of: _columns\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n style=\"font-weight: bold; border-right: 1px solid #e8e8e8\"\r\n [nzAlign]=\"column.align\"\r\n >\r\n <span *ngIf=\"i === 0\">\u603B\u8BA1</span>\r\n <ng-container *ngIf=\"i !== 0 && column.summary\">\r\n {{\r\n column.summary?.format\r\n ? column.summary?.format(\r\n summaryData[column.summary?.name || column.prop]\r\n )\r\n : summaryData[column.summary?.name || column.prop]\r\n }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <ng-template #totalTemplate let-total\r\n >\u5171 {{ _pageInfo.total }} \u6761\u8BB0\u5F55</ng-template\r\n >\r\n </nz-table>\r\n </ng-template>\r\n</app-page-container>\r\n",
|
|
1788
|
+
template: "<app-page-container\r\n [title]=\"title\"\r\n [showHeader]=\"showSearchBar\"\r\n ngClass=\"pro-table-container\"\r\n>\r\n <ng-template #header>\r\n <app-table-search-bar\r\n *ngIf=\"showSearchBar\"\r\n [labelWidth]=\"labelWidth\"\r\n [labelAlign]=\"labelAlign\"\r\n >\r\n <ng-template #leftContent>\r\n <nz-form-item\r\n *ngFor=\"let column of _searchFiledColumns\"\r\n [ngClass]=\"getFormItemClassName(column)\"\r\n >\r\n <nz-form-label *ngIf=\"!getFieldProps(column).hideLabel\" nzNoColon>\r\n <!-- \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49label\u6A21\u677F -->\r\n <ng-container\r\n *ngIf=\"\r\n column.customLabelRender &&\r\n getLabelTemplate(column.customLabelRender);\r\n else defaultLabel\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"getLabelTemplate(column.customLabelRender)\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: column,\r\n column: column,\r\n fieldProps: getFieldProps(column)\r\n }\"\r\n >\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #defaultLabel>\r\n {{ getFieldProps(column).label || column.title }}\r\n </ng-template>\r\n </nz-form-label>\r\n <nz-form-control *ngIf=\"column.valueType === 'input'\">\r\n <input\r\n nz-input\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [placeholder]=\"getFieldProps(column).placeHolder\"\r\n [disabled]=\"getFieldProps(column).disabled\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n />\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'inputPlate'\">\r\n <app-plate-input\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n ></app-plate-input>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'select'\">\r\n <nz-select\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [nzOptions]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n >\r\n </nz-select>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'selectMultiple'\">\r\n <nz-select\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [name]=\"getFieldProps(column).name || column.prop\"\r\n [nzOptions]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n nzMode=\"multiple\"\r\n >\r\n </nz-select>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'date'\">\r\n <nz-date-picker\r\n [nzShowTime]=\"getFieldProps(column).showTime\"\r\n [nzFormat]=\"getFieldProps(column).format\"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [nzAllowClear]=\"getFieldProps(column).allowClear\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzMode]=\"getFieldProps(column).mode\"\r\n ></nz-date-picker>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'checkbox'\">\r\n <nz-checkbox-group\r\n [class]=\"\r\n getFieldProps(column).noStyle\r\n ? 'pro-table-checkboxgroup-nostyle'\r\n : ''\r\n \"\r\n [(ngModel)]=\"getFieldProps(column).options\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n (ngModelChange)=\"\r\n handleFieldCheckBoxChange(\r\n $event,\r\n getFieldProps(column).name || column.prop\r\n )\r\n \"\r\n ></nz-checkbox-group>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'autoComplete'\">\r\n <input\r\n nz-input\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column)?.name || column.prop]\r\n \"\r\n (input)=\"handleAutoCompleteInput($event, column)\"\r\n [nzAutocomplete]=\"auto\"\r\n [disabled]=\"getFieldProps(column)?.disabled\"\r\n [placeholder]=\"getFieldProps(column)?.placeHolder\"\r\n />\r\n <nz-autocomplete\r\n [nzBackfill]=\"getFieldProps(column).backFill\"\r\n [nzDefaultActiveFirstOption]=\"\r\n getFieldProps(column).defaultActiveFirstOption\r\n \"\r\n [nzWidth]=\"getFieldProps(column).width\"\r\n #auto\r\n >\r\n <nz-auto-option\r\n *ngFor=\"let option of getAutoCompleteDataSource(column)\"\r\n [nzValue]=\"\r\n getFieldProps(column).returnFullData ? option : option.value\r\n \"\r\n [nzLabel]=\"option.label\"\r\n [nzDisabled]=\"option.disabled\"\r\n >\r\n {{ option.label }}\r\n </nz-auto-option>\r\n </nz-autocomplete>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'custom'\">\r\n <app-dynamic-search-field\r\n [component]=\"getFieldProps(column).component\"\r\n [value]=\"_searchParams[getFieldProps(column).name || column.prop]\"\r\n [props]=\"getFieldProps(column)\"\r\n (valueChange)=\"\r\n setFieldValue(getFieldProps(column).name || column.prop, $event)\r\n \"\r\n ></app-dynamic-search-field>\r\n </nz-form-control>\r\n <nz-form-control *ngIf=\"column.valueType === 'inputNumber'\">\r\n <nz-input-number\r\n [style.width]=\"'100%'\"\r\n [(ngModel)]=\"\r\n _searchParams[getFieldProps(column).name || column.prop]\r\n \"\r\n [nzPlaceHolder]=\"getFieldProps(column).placeHolder\"\r\n [nzDisabled]=\"getFieldProps(column).disabled\"\r\n [nzFormatter]=\"getFieldProps(column).formatterPercent\"\r\n [nzParser]=\"getFieldProps(column).parserPercent\"\r\n ></nz-input-number>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </ng-template>\r\n <ng-template #actionTextBtn>\r\n <nz-space [nzSize]=\"4\">\r\n <nz-space-item *ngIf=\"showSearchBtn\">\r\n <button nz-button nzType=\"primary\" (click)=\"handleSearch()\">\r\n {{ confirmBtnText }}\r\n </button>\r\n </nz-space-item>\r\n <nz-space-item *ngIf=\"showClearBtn\">\r\n <button nz-button (click)=\"handleResetForm()\">\r\n {{ clearBtnText }}\r\n </button>\r\n </nz-space-item>\r\n </nz-space>\r\n </ng-template>\r\n <ng-template #actionImgBtn>\r\n <nz-space>\r\n <ng-container *ngTemplateOutlet=\"imgActionBarTpl\"></ng-container>\r\n <nz-space-item class=\"setting-space-item\" *ngIf=\"showColumnSetting\">\r\n <app-colmuns-setting\r\n [columns]=\"columns\"\r\n [selectedColumns]=\"_serverColumns\"\r\n [tableName]=\"tableName\"\r\n (afterConfirm)=\"handleColumnsSettingConfirm()\"\r\n ></app-colmuns-setting>\r\n </nz-space-item>\r\n </nz-space>\r\n </ng-template>\r\n </app-table-search-bar>\r\n </ng-template>\r\n\r\n <ng-template #body>\r\n <div class=\"mb-12\">\r\n <ng-container *ngIf=\"showActionBar\">\r\n <ng-container *ngTemplateOutlet=\"actionBarTpl\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-container *ngIf=\"customTableRender\">\r\n <ng-container *ngTemplateOutlet=\"customTableRender\"></ng-container>\r\n </ng-container>\r\n <nz-table\r\n *ngIf=\"!customTableRender\"\r\n #dynamicTable\r\n nzSize=\"small\"\r\n nzShowSizeChanger\r\n [nzBordered]=\"bordered\"\r\n [nzOuterBordered]=\"outerBordered\"\r\n [nzData]=\"dataSource\"\r\n [nzPageIndex]=\"_pageInfo.pageIndex\"\r\n [nzPageSize]=\"_pageInfo.pageSize\"\r\n [nzTotal]=\"_pageInfo.total\"\r\n [nzPageSizeOptions]=\"_pageInfo.pageSizeOptions\"\r\n [nzShowPagination]=\"showPagination\"\r\n [nzShowTotal]=\"totalTemplate\"\r\n [nzLoading]=\"_loading\"\r\n [nzFrontPagination]=\"frontPagination\"\r\n [nzScroll]=\"scroll\"\r\n (nzPageIndexChange)=\"handlePageIndexChange($event)\"\r\n (nzPageSizeChange)=\"handlePageSizeChange($event)\"\r\n >\r\n <thead>\r\n <tr>\r\n <!-- \u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF09 -->\r\n <th\r\n *ngIf=\"showCheckbox\"\r\n [nzWidth]=\"'50px'\"\r\n [nzAlign]=\"'center'\"\r\n style=\"text-align: center\"\r\n [(nzChecked)]=\"_checkedAll\"\r\n [nzIndeterminate]=\"_indeterminate\"\r\n (nzCheckedChange)=\"toggleCheckAll($event)\"\r\n (click)=\"$event.stopPropagation()\"\r\n ></th>\r\n <th\r\n *ngFor=\"let column of _columns\"\r\n [nzWidth]=\"column.width\"\r\n [nzAlign]=\"column.align\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n [nzShowSort]=\"!!column.sorter\"\r\n [nzSortOrder]=\"getSortOrder(column.prop)\"\r\n (nzSortOrderChange)=\"onSortChange(column.prop, $event)\"\r\n >\r\n {{ column.title }}\r\n </th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <tr\r\n style=\"cursor: pointer\"\r\n *ngFor=\"let data; let i = index; of: dynamicTable.data\"\r\n [ngClass]=\"{\r\n 'ant-table-custom-row-selected': !!getTableRowChecked(data),\r\n 'ant-table-custom-row-even': i % 2 === 0,\r\n 'ant-table-custom-row-odd': i % 2 !== 0\r\n }\"\r\n (click)=\"handleTableRowClick(data)\"\r\n (dblclick)=\"handleTableRowDbClick(data)\"\r\n >\r\n <!-- \u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF09 -->\r\n <td\r\n *ngIf=\"showCheckbox\"\r\n [nzAlign]=\"'center'\"\r\n style=\"text-align: center;width: 50px;\"\r\n [(nzChecked)]=\"data.checked\"\r\n [nzDisabled]=\"isRowDisabled(data)\"\r\n (nzCheckedChange)=\"handleRowCheckedChange(data, $event)\"\r\n (click)=\"$event.stopPropagation()\"\r\n ></td>\r\n <td\r\n *ngFor=\"let column of _columns\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n [nzAlign]=\"column.align\"\r\n class=\"pro-ellipsis\"\r\n [title]=\"data[column.prop]\"\r\n >\r\n <!-- \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49\u6A21\u677F -->\r\n <ng-container\r\n *ngIf=\"\r\n column.customRender && getTemplate(column.customRender);\r\n let template\r\n \"\r\n >\r\n <ng-template\r\n [ngTemplateOutlet]=\"template\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: data,\r\n data: data,\r\n column: column,\r\n index: i,\r\n pageInfo: _pageInfo\r\n }\"\r\n >\r\n </ng-template>\r\n </ng-container>\r\n\r\n <!-- \u9ED8\u8BA4\u6E32\u67D3\u903B\u8F91 -->\r\n <ng-container\r\n *ngIf=\"!column.customRender || !getTemplate(column.customRender)\"\r\n >\r\n {{ data[column.prop] }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n <tr *ngIf=\"summaryData && _pageInfo.total > 0\">\r\n <!-- \u6C47\u603B\u884C\u7684\u590D\u9009\u6846\u5217\uFF08\u5F53 showCheckbox=true \u65F6\u663E\u793A\uFF0C\u4F46\u4E3A\u7A7A\uFF09 -->\r\n <td\r\n *ngIf=\"showCheckbox\"\r\n style=\"font-weight: bold; border-right: 1px solid #e8e8e8\"\r\n ></td>\r\n <td\r\n *ngFor=\"let column; let i = index; of: _columns\"\r\n [nzLeft]=\"column.fixedLeft\"\r\n [nzRight]=\"column.fixedRight\"\r\n style=\"font-weight: bold; border-right: 1px solid #e8e8e8\"\r\n [nzAlign]=\"column.align\"\r\n >\r\n <span *ngIf=\"i === 0\">\u603B\u8BA1</span>\r\n <ng-container *ngIf=\"i !== 0 && column.summary\">\r\n {{\r\n column.summary?.format\r\n ? column.summary?.format(\r\n summaryData[column.summary?.name || column.prop]\r\n )\r\n : summaryData[column.summary?.name || column.prop]\r\n }}\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <ng-template #totalTemplate let-total\r\n >\u5171 {{ _pageInfo.total }} \u6761\u8BB0\u5F55</ng-template\r\n >\r\n </nz-table>\r\n </ng-template>\r\n</app-page-container>\r\n",
|
|
1636
1789
|
styles: [".pro-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}::ng-deep .setting-space-item{margin-right:0!important}::ng-deep .pro-table-checkboxgroup-nostyle{white-space:nowrap}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body table{border-collapse:separate;border-spacing:0}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-tbody>tr>td{border-right:1px solid #e8e8e8!important}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-thead>tr>th{border-bottom:1px solid #e8e8e8!important;border-right:1px solid #e8e8e8!important;white-space:nowrap}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-tbody>tr>td:first-child,::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-thead>tr>th:first-child{border-left:none!important}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-cell-fix-left,::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-cell-fix-right,::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-header .ant-table-thead>tr>th.ant-table-cell-fix-left,::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-header .ant-table-thead>tr>th.ant-table-cell-fix-right{border-bottom:1px solid #e8e8e8!important;border-right:1px solid #e8e8e8!important}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-header .ant-table-thead>tr>th{border-top:1px solid #e8e8e8!important}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-tbody>tr>td:last-child,::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-thead>tr>th:last-child{border-right:1px solid #e8e8e8!important}::ng-deep .ant-table-bordered .ant-table-container .ant-table-content .ant-table-body .ant-table-tbody>tr:last-child>td{border-bottom:1px solid #e8e8e8!important}::ng-deep .table-search-bar-left .ant-form-item{margin-bottom:8px}"]
|
|
1637
1790
|
},] }
|
|
1638
1791
|
];
|
|
@@ -1679,6 +1832,7 @@
|
|
|
1679
1832
|
var PageContainerComponent = /** @class */ (function () {
|
|
1680
1833
|
function PageContainerComponent() {
|
|
1681
1834
|
this.title = "";
|
|
1835
|
+
this.showHeader = true;
|
|
1682
1836
|
}
|
|
1683
1837
|
PageContainerComponent.prototype.ngOnInit = function () { };
|
|
1684
1838
|
return PageContainerComponent;
|
|
@@ -1686,13 +1840,14 @@
|
|
|
1686
1840
|
PageContainerComponent.decorators = [
|
|
1687
1841
|
{ type: i0.Component, args: [{
|
|
1688
1842
|
selector: "app-page-container",
|
|
1689
|
-
template: "<nz-card\r\n [nzBorderless]=\"true\"\r\n [nzBodyStyle]=\"{ padding: '10px', width: '100%' }\"\r\n>\r\n <div class=\"page-container-title\" *ngIf=\"title\">{{ title }}</div>\r\n <div class=\"page-container-header\">\r\n <ng-container *ngTemplateOutlet=\"headerTpl\"></ng-container>\r\n </div>\r\n <div class=\"page-container-body\">\r\n <ng-container *ngTemplateOutlet=\"bodyTpl\"></ng-container>\r\n </div>\r\n</nz-card>\r\n",
|
|
1843
|
+
template: "<nz-card\r\n [nzBorderless]=\"true\"\r\n [nzBodyStyle]=\"{ padding: '10px', width: '100%' }\"\r\n>\r\n <div class=\"page-container-title\" *ngIf=\"title\">{{ title }}</div>\r\n <div class=\"page-container-header\" *ngIf=\"showHeader\">\r\n <ng-container *ngTemplateOutlet=\"headerTpl\"></ng-container>\r\n </div>\r\n <div class=\"page-container-body\">\r\n <ng-container *ngTemplateOutlet=\"bodyTpl\"></ng-container>\r\n </div>\r\n</nz-card>\r\n",
|
|
1690
1844
|
styles: [".page-container-title{border-left:3px solid #096dd9;color:#1d1d1d;font-size:16px;margin-bottom:16px;padding-left:10px}.page-container-body,.page-container-header{box-sizing:border-box;padding:7px}"]
|
|
1691
1845
|
},] }
|
|
1692
1846
|
];
|
|
1693
1847
|
PageContainerComponent.ctorParameters = function () { return []; };
|
|
1694
1848
|
PageContainerComponent.propDecorators = {
|
|
1695
1849
|
title: [{ type: i0.Input }],
|
|
1850
|
+
showHeader: [{ type: i0.Input }],
|
|
1696
1851
|
headerTpl: [{ type: i0.ContentChild, args: ["header",] }],
|
|
1697
1852
|
bodyTpl: [{ type: i0.ContentChild, args: ["body",] }]
|
|
1698
1853
|
};
|
|
@@ -1995,7 +2150,7 @@
|
|
|
1995
2150
|
this.sortableInstance = null;
|
|
1996
2151
|
}
|
|
1997
2152
|
if (this.sortableContainer && this.sortableContainer.nativeElement) {
|
|
1998
|
-
this.sortableInstance = new Sortable__default[
|
|
2153
|
+
this.sortableInstance = new Sortable__default["default"](this.sortableContainer.nativeElement, {
|
|
1999
2154
|
animation: 150,
|
|
2000
2155
|
ghostClass: "sortable-ghost",
|
|
2001
2156
|
chosenClass: "sortable-chosen",
|
|
@@ -2324,6 +2479,7 @@
|
|
|
2324
2479
|
this.formStore = {};
|
|
2325
2480
|
this.formModifyType = "create";
|
|
2326
2481
|
// ==================== 私有属性 ====================
|
|
2482
|
+
this.formRegisterStore = {};
|
|
2327
2483
|
this.labelWidth = "120px";
|
|
2328
2484
|
this.labelAlign = "right";
|
|
2329
2485
|
this.labelObservers = {};
|
|
@@ -2338,6 +2494,37 @@
|
|
|
2338
2494
|
};
|
|
2339
2495
|
}
|
|
2340
2496
|
// ==================== 表单创建和初始化 ====================
|
|
2497
|
+
// 判断是否为嵌套 FormGroup 配置
|
|
2498
|
+
AntdFormService.prototype.isFormGroupConfig = function (config) {
|
|
2499
|
+
return (typeof config === "object" &&
|
|
2500
|
+
config !== null &&
|
|
2501
|
+
"type" in config &&
|
|
2502
|
+
config.type === "group");
|
|
2503
|
+
};
|
|
2504
|
+
// 递归创建嵌套 FormGroup
|
|
2505
|
+
AntdFormService.prototype.createNestedFormGroup = function (fields, disabled) {
|
|
2506
|
+
var _this = this;
|
|
2507
|
+
var groupConfig = {};
|
|
2508
|
+
Object.entries(fields).forEach(function (_f) {
|
|
2509
|
+
var _g = __read(_f, 2), key = _g[0], fieldConfig = _g[1];
|
|
2510
|
+
var _a, _b, _c, _d, _e;
|
|
2511
|
+
if (_this.isFormGroupConfig(fieldConfig)) {
|
|
2512
|
+
// 递归创建嵌套的 FormGroup
|
|
2513
|
+
groupConfig[key] = _this.createNestedFormGroup(fieldConfig.fields, (_a = fieldConfig.disabled) !== null && _a !== void 0 ? _a : disabled);
|
|
2514
|
+
}
|
|
2515
|
+
else {
|
|
2516
|
+
// 创建普通 FormControl
|
|
2517
|
+
groupConfig[key] = [
|
|
2518
|
+
{
|
|
2519
|
+
value: fieldConfig.value,
|
|
2520
|
+
disabled: (_c = (_b = fieldConfig.disabled) !== null && _b !== void 0 ? _b : disabled) !== null && _c !== void 0 ? _c : false,
|
|
2521
|
+
},
|
|
2522
|
+
(_e = (_d = fieldConfig.validators) === null || _d === void 0 ? void 0 : _d.call(fieldConfig)) !== null && _e !== void 0 ? _e : [],
|
|
2523
|
+
];
|
|
2524
|
+
}
|
|
2525
|
+
});
|
|
2526
|
+
return this.fb.group(groupConfig);
|
|
2527
|
+
};
|
|
2341
2528
|
// 初始化表单
|
|
2342
2529
|
AntdFormService.prototype.createFormGroup = function (name, config, options) {
|
|
2343
2530
|
var _this = this;
|
|
@@ -2346,12 +2533,27 @@
|
|
|
2346
2533
|
Object.entries(config).forEach(function (_f) {
|
|
2347
2534
|
var _g = __read(_f, 2), key = _g[0], fieldConfig = _g[1];
|
|
2348
2535
|
var _a, _b, _c;
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2536
|
+
if (_this.isFormGroupConfig(fieldConfig)) {
|
|
2537
|
+
// 处理嵌套 FormGroup
|
|
2538
|
+
var nestedGroup = _this.createNestedFormGroup(fieldConfig.fields, fieldConfig.disabled);
|
|
2539
|
+
groupConfig[key] = nestedGroup;
|
|
2540
|
+
// 存储嵌套 FormGroup 的错误消息(如果需要)
|
|
2541
|
+
if (fieldConfig.errorMessages) {
|
|
2542
|
+
_this.errorMessageStore[name][key] = fieldConfig.errorMessages;
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
else {
|
|
2546
|
+
// 处理普通字段
|
|
2547
|
+
groupConfig[key] = [
|
|
2548
|
+
{
|
|
2549
|
+
value: fieldConfig.value,
|
|
2550
|
+
disabled: (_a = fieldConfig.disabled) !== null && _a !== void 0 ? _a : false,
|
|
2551
|
+
},
|
|
2552
|
+
(_c = (_b = fieldConfig.validators) === null || _b === void 0 ? void 0 : _b.call(fieldConfig)) !== null && _c !== void 0 ? _c : [],
|
|
2553
|
+
];
|
|
2554
|
+
if (fieldConfig.errorMessages) {
|
|
2555
|
+
_this.errorMessageStore[name][key] = fieldConfig.errorMessages;
|
|
2556
|
+
}
|
|
2355
2557
|
}
|
|
2356
2558
|
});
|
|
2357
2559
|
if (options === null || options === void 0 ? void 0 : options.labelWidth) {
|
|
@@ -2361,6 +2563,7 @@
|
|
|
2361
2563
|
this.labelAlign = options.labelAlign;
|
|
2362
2564
|
}
|
|
2363
2565
|
this.formStore[name] = this.fb.group(groupConfig);
|
|
2566
|
+
this.formRegisterStore[name] = true;
|
|
2364
2567
|
this.setCSSVariablesToTarget(name);
|
|
2365
2568
|
return this.formStore[name];
|
|
2366
2569
|
};
|
|
@@ -2370,6 +2573,58 @@
|
|
|
2370
2573
|
var _a;
|
|
2371
2574
|
(_a = this.formStore[name]) === null || _a === void 0 ? void 0 : _a.reset(value);
|
|
2372
2575
|
};
|
|
2576
|
+
// 检测表单是否完成注册
|
|
2577
|
+
AntdFormService.prototype.isFormRegistered = function (name) {
|
|
2578
|
+
var _a;
|
|
2579
|
+
return (_a = this.formRegisterStore[name]) !== null && _a !== void 0 ? _a : false;
|
|
2580
|
+
};
|
|
2581
|
+
// 销毁对应的表单
|
|
2582
|
+
AntdFormService.prototype.destory = function (names) {
|
|
2583
|
+
var _this = this;
|
|
2584
|
+
names.forEach(function (name) {
|
|
2585
|
+
// 2. 清理错误消息存储
|
|
2586
|
+
if (_this.errorMessageStore[name]) {
|
|
2587
|
+
delete _this.errorMessageStore[name];
|
|
2588
|
+
}
|
|
2589
|
+
// 3. 清理表单注册标记
|
|
2590
|
+
if (_this.formRegisterStore[name]) {
|
|
2591
|
+
delete _this.formRegisterStore[name];
|
|
2592
|
+
}
|
|
2593
|
+
// 4. 清理表单组(Angular 会自动处理 FormGroup 的清理)
|
|
2594
|
+
if (_this.formStore[name]) {
|
|
2595
|
+
delete _this.formStore[name];
|
|
2596
|
+
}
|
|
2597
|
+
});
|
|
2598
|
+
};
|
|
2599
|
+
// 根据路径获取嵌套的 FormGroup
|
|
2600
|
+
AntdFormService.prototype.getNestedFormGroup = function (formGroup, path) {
|
|
2601
|
+
var e_1, _f;
|
|
2602
|
+
if (!path || path.trim() === "") {
|
|
2603
|
+
return formGroup;
|
|
2604
|
+
}
|
|
2605
|
+
var pathParts = path.split(".").filter(function (p) { return p.trim() !== ""; });
|
|
2606
|
+
var currentGroup = formGroup;
|
|
2607
|
+
try {
|
|
2608
|
+
for (var pathParts_1 = __values(pathParts), pathParts_1_1 = pathParts_1.next(); !pathParts_1_1.done; pathParts_1_1 = pathParts_1.next()) {
|
|
2609
|
+
var part = pathParts_1_1.value;
|
|
2610
|
+
if (!currentGroup || !(currentGroup instanceof i1.FormGroup)) {
|
|
2611
|
+
return null;
|
|
2612
|
+
}
|
|
2613
|
+
currentGroup = currentGroup.get(part);
|
|
2614
|
+
if (!currentGroup || !(currentGroup instanceof i1.FormGroup)) {
|
|
2615
|
+
return null;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2620
|
+
finally {
|
|
2621
|
+
try {
|
|
2622
|
+
if (pathParts_1_1 && !pathParts_1_1.done && (_f = pathParts_1.return)) _f.call(pathParts_1);
|
|
2623
|
+
}
|
|
2624
|
+
finally { if (e_1) throw e_1.error; }
|
|
2625
|
+
}
|
|
2626
|
+
return currentGroup instanceof i1.FormGroup ? currentGroup : null;
|
|
2627
|
+
};
|
|
2373
2628
|
// 批量添加字段配置
|
|
2374
2629
|
AntdFormService.prototype.addFieldsConfig = function (formName, fieldsConfig, options) {
|
|
2375
2630
|
var _this = this;
|
|
@@ -2380,8 +2635,8 @@
|
|
|
2380
2635
|
failed: [],
|
|
2381
2636
|
};
|
|
2382
2637
|
// 1. 验证表单是否存在
|
|
2383
|
-
var
|
|
2384
|
-
if (!
|
|
2638
|
+
var rootFormGroup = this.formStore[formName];
|
|
2639
|
+
if (!rootFormGroup) {
|
|
2385
2640
|
// 如果表单不存在,所有字段都失败
|
|
2386
2641
|
Object.keys(fieldsConfig).forEach(function (fieldName) {
|
|
2387
2642
|
var _a;
|
|
@@ -2395,21 +2650,42 @@
|
|
|
2395
2650
|
result.success = false;
|
|
2396
2651
|
return result;
|
|
2397
2652
|
}
|
|
2398
|
-
// 2.
|
|
2653
|
+
// 2. 获取目标 FormGroup(支持嵌套路径)
|
|
2654
|
+
var targetPath = options === null || options === void 0 ? void 0 : options.targetPath;
|
|
2655
|
+
var targetFormGroup = targetPath
|
|
2656
|
+
? this.getNestedFormGroup(rootFormGroup, targetPath)
|
|
2657
|
+
: rootFormGroup;
|
|
2658
|
+
if (!targetFormGroup) {
|
|
2659
|
+
// 如果目标 FormGroup 不存在,所有字段都失败
|
|
2660
|
+
Object.keys(fieldsConfig).forEach(function (fieldName) {
|
|
2661
|
+
var _a;
|
|
2662
|
+
var error = targetPath
|
|
2663
|
+
? "Target FormGroup at path \"" + targetPath + "\" not found"
|
|
2664
|
+
: "FormGroup not found";
|
|
2665
|
+
result.failed.push({
|
|
2666
|
+
fieldName: fieldName,
|
|
2667
|
+
error: error,
|
|
2668
|
+
});
|
|
2669
|
+
(_a = options === null || options === void 0 ? void 0 : options.onFieldAdded) === null || _a === void 0 ? void 0 : _a.call(options, fieldName, false, error);
|
|
2670
|
+
});
|
|
2671
|
+
result.success = false;
|
|
2672
|
+
return result;
|
|
2673
|
+
}
|
|
2674
|
+
// 3. 初始化 errorMessageStore(如果不存在)
|
|
2399
2675
|
if (!this.errorMessageStore[formName]) {
|
|
2400
2676
|
this.errorMessageStore[formName] = {};
|
|
2401
2677
|
}
|
|
2402
|
-
//
|
|
2678
|
+
// 4. 批量构建控件配置
|
|
2403
2679
|
var controlsToAdd = {};
|
|
2404
2680
|
var errorMessagesToAdd = {};
|
|
2405
|
-
//
|
|
2681
|
+
// 5. 遍历所有字段配置,进行验证和构建
|
|
2406
2682
|
Object.entries(fieldsConfig).forEach(function (_f) {
|
|
2407
2683
|
var _g = __read(_f, 2), fieldName = _g[0], fieldConfig = _g[1];
|
|
2408
2684
|
var _a, _b, _c, _d, _e;
|
|
2409
2685
|
try {
|
|
2410
|
-
//
|
|
2411
|
-
if (
|
|
2412
|
-
var error = "Field \"" + fieldName + "\" already exists";
|
|
2686
|
+
// 5.1 检查字段是否已存在
|
|
2687
|
+
if (targetFormGroup.get(fieldName)) {
|
|
2688
|
+
var error = "Field \"" + fieldName + "\" already exists" + (targetPath ? " in \"" + targetPath + "\"" : "");
|
|
2413
2689
|
result.failed.push({
|
|
2414
2690
|
fieldName: fieldName,
|
|
2415
2691
|
error: error,
|
|
@@ -2417,20 +2693,38 @@
|
|
|
2417
2693
|
(_a = options === null || options === void 0 ? void 0 : options.onFieldAdded) === null || _a === void 0 ? void 0 : _a.call(options, fieldName, false, error);
|
|
2418
2694
|
return;
|
|
2419
2695
|
}
|
|
2420
|
-
//
|
|
2421
|
-
var
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2696
|
+
// 5.2 创建控件
|
|
2697
|
+
var control = void 0;
|
|
2698
|
+
if (_this.isFormGroupConfig(fieldConfig)) {
|
|
2699
|
+
// 创建嵌套 FormGroup
|
|
2700
|
+
control = _this.createNestedFormGroup(fieldConfig.fields, fieldConfig.disabled);
|
|
2701
|
+
// 存储嵌套 FormGroup 的错误消息(如果需要)
|
|
2702
|
+
if (fieldConfig.errorMessages) {
|
|
2703
|
+
var errorMessageKey = targetPath
|
|
2704
|
+
? targetPath + "." + fieldName
|
|
2705
|
+
: fieldName;
|
|
2706
|
+
errorMessagesToAdd[errorMessageKey] = fieldConfig.errorMessages;
|
|
2707
|
+
}
|
|
2428
2708
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2709
|
+
else {
|
|
2710
|
+
// 创建普通 FormControl
|
|
2711
|
+
var controlOptions = {
|
|
2712
|
+
validators: (_c = (_b = fieldConfig.validators) === null || _b === void 0 ? void 0 : _b.call(fieldConfig)) !== null && _c !== void 0 ? _c : [],
|
|
2713
|
+
};
|
|
2714
|
+
control = _this.fb.control(fieldConfig.value, controlOptions);
|
|
2715
|
+
// 设置 disabled 状态
|
|
2716
|
+
if (fieldConfig.disabled) {
|
|
2717
|
+
control.disable();
|
|
2718
|
+
}
|
|
2719
|
+
// 存储错误消息
|
|
2720
|
+
if (fieldConfig.errorMessages) {
|
|
2721
|
+
var errorMessageKey = targetPath
|
|
2722
|
+
? targetPath + "." + fieldName
|
|
2723
|
+
: fieldName;
|
|
2724
|
+
errorMessagesToAdd[errorMessageKey] = fieldConfig.errorMessages;
|
|
2725
|
+
}
|
|
2433
2726
|
}
|
|
2727
|
+
controlsToAdd[fieldName] = control;
|
|
2434
2728
|
result.added.push(fieldName);
|
|
2435
2729
|
(_d = options === null || options === void 0 ? void 0 : options.onFieldAdded) === null || _d === void 0 ? void 0 : _d.call(options, fieldName, true);
|
|
2436
2730
|
}
|
|
@@ -2443,20 +2737,20 @@
|
|
|
2443
2737
|
(_e = options === null || options === void 0 ? void 0 : options.onFieldAdded) === null || _e === void 0 ? void 0 : _e.call(options, fieldName, false, errorMessage);
|
|
2444
2738
|
}
|
|
2445
2739
|
});
|
|
2446
|
-
//
|
|
2740
|
+
// 6. 批量添加到目标 FormGroup
|
|
2447
2741
|
if (Object.keys(controlsToAdd).length > 0) {
|
|
2448
2742
|
Object.entries(controlsToAdd).forEach(function (_f) {
|
|
2449
2743
|
var _g = __read(_f, 2), fieldName = _g[0], control = _g[1];
|
|
2450
|
-
|
|
2744
|
+
targetFormGroup.addControl(fieldName, control);
|
|
2451
2745
|
});
|
|
2452
|
-
//
|
|
2746
|
+
// 7. 批量存储错误消息
|
|
2453
2747
|
Object.entries(errorMessagesToAdd).forEach(function (_f) {
|
|
2454
2748
|
var _g = __read(_f, 2), key = _g[0], messages = _g[1];
|
|
2455
2749
|
_this.errorMessageStore[formName][key] = messages;
|
|
2456
2750
|
});
|
|
2457
|
-
//
|
|
2751
|
+
// 8. 更新表单验证状态
|
|
2458
2752
|
if (options === null || options === void 0 ? void 0 : options.updateValueAndValidity) {
|
|
2459
|
-
|
|
2753
|
+
targetFormGroup.updateValueAndValidity({
|
|
2460
2754
|
emitEvent: (_a = options === null || options === void 0 ? void 0 : options.emitEvent) !== null && _a !== void 0 ? _a : true,
|
|
2461
2755
|
});
|
|
2462
2756
|
}
|
|
@@ -2587,7 +2881,7 @@
|
|
|
2587
2881
|
// ==================== 错误消息相关 ====================
|
|
2588
2882
|
// 获取字段首条错误提示
|
|
2589
2883
|
AntdFormService.prototype.getFieldErrorMessage = function (name, controlName) {
|
|
2590
|
-
var
|
|
2884
|
+
var e_2, _f;
|
|
2591
2885
|
var _a;
|
|
2592
2886
|
var formGroup = this.formStore[name];
|
|
2593
2887
|
if (!formGroup) {
|
|
@@ -2615,12 +2909,12 @@
|
|
|
2615
2909
|
}
|
|
2616
2910
|
}
|
|
2617
2911
|
}
|
|
2618
|
-
catch (
|
|
2912
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2619
2913
|
finally {
|
|
2620
2914
|
try {
|
|
2621
2915
|
if (_h && !_h.done && (_f = _g.return)) _f.call(_g);
|
|
2622
2916
|
}
|
|
2623
|
-
finally { if (
|
|
2917
|
+
finally { if (e_2) throw e_2.error; }
|
|
2624
2918
|
}
|
|
2625
2919
|
return "";
|
|
2626
2920
|
};
|
|
@@ -2666,10 +2960,17 @@
|
|
|
2666
2960
|
var appliedCount = 0;
|
|
2667
2961
|
dom.forEach(function (item) {
|
|
2668
2962
|
var target = item;
|
|
2669
|
-
if (target.
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2963
|
+
if (target.closest(".pro-table-container")) {
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
var customWidth = target.getAttribute("custom-width");
|
|
2967
|
+
var customAlign = target.getAttribute("custom-align");
|
|
2968
|
+
var finalWidth = customWidth || _this.labelWidth;
|
|
2969
|
+
var finalTextAlign = customAlign || _this.labelAlign;
|
|
2970
|
+
if (target.style.width !== finalWidth ||
|
|
2971
|
+
target.style.textAlign !== finalTextAlign) {
|
|
2972
|
+
target.style.width = finalWidth;
|
|
2973
|
+
target.style.textAlign = finalTextAlign;
|
|
2673
2974
|
appliedCount++;
|
|
2674
2975
|
}
|
|
2675
2976
|
});
|
|
@@ -2734,7 +3035,7 @@
|
|
|
2734
3035
|
};
|
|
2735
3036
|
return AntdFormService;
|
|
2736
3037
|
}());
|
|
2737
|
-
AntdFormService.ɵprov =
|
|
3038
|
+
AntdFormService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AntdFormService_Factory() { return new AntdFormService(i0__namespace.ɵɵinject(i1__namespace.FormBuilder)); }, token: AntdFormService, providedIn: "root" });
|
|
2738
3039
|
AntdFormService.decorators = [
|
|
2739
3040
|
{ type: i0.Injectable, args: [{ providedIn: "root" },] }
|
|
2740
3041
|
];
|
|
@@ -3111,9 +3412,38 @@
|
|
|
3111
3412
|
}
|
|
3112
3413
|
return form.data.some(function (item) { return item.isEdit; });
|
|
3113
3414
|
};
|
|
3415
|
+
// 销毁对应的表单
|
|
3416
|
+
ArrayFormService.prototype.destory = function (names) {
|
|
3417
|
+
var _this = this;
|
|
3418
|
+
names.forEach(function (name) {
|
|
3419
|
+
if (_this.formStore[name]) {
|
|
3420
|
+
// 清理表单数据
|
|
3421
|
+
delete _this.formStore[name];
|
|
3422
|
+
}
|
|
3423
|
+
});
|
|
3424
|
+
};
|
|
3425
|
+
// 重置表单数组
|
|
3426
|
+
ArrayFormService.prototype.resetFormArray = function (name) {
|
|
3427
|
+
var form = this.formStore[name];
|
|
3428
|
+
if (!form) {
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
// 1. 清空数据数组
|
|
3432
|
+
form.data = [];
|
|
3433
|
+
// 2. 清理所有快照
|
|
3434
|
+
form.initialSnapshot = {};
|
|
3435
|
+
form.editingSnapshot = {};
|
|
3436
|
+
// 3. 清理校验结果
|
|
3437
|
+
form.validationResults = {};
|
|
3438
|
+
// 4. 重置 touched 状态
|
|
3439
|
+
form.allTouched = false;
|
|
3440
|
+
form.rowTouched = {};
|
|
3441
|
+
// 5. 如果配置了自动更新,更新外部数组引用
|
|
3442
|
+
this.autoUpdateArrayReference(name);
|
|
3443
|
+
};
|
|
3114
3444
|
return ArrayFormService;
|
|
3115
3445
|
}());
|
|
3116
|
-
ArrayFormService.ɵprov =
|
|
3446
|
+
ArrayFormService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ArrayFormService_Factory() { return new ArrayFormService(); }, token: ArrayFormService, providedIn: "root" });
|
|
3117
3447
|
ArrayFormService.decorators = [
|
|
3118
3448
|
{ type: i0.Injectable, args: [{
|
|
3119
3449
|
providedIn: "root",
|
|
@@ -3139,18 +3469,18 @@
|
|
|
3139
3469
|
exports.PlateInputModule = PlateInputModule;
|
|
3140
3470
|
exports.ProTableComponent = ProTableComponent;
|
|
3141
3471
|
exports.ProTableModule = ProTableModule;
|
|
3142
|
-
exports
|
|
3143
|
-
exports
|
|
3144
|
-
exports
|
|
3145
|
-
exports
|
|
3146
|
-
exports
|
|
3147
|
-
exports
|
|
3148
|
-
exports
|
|
3149
|
-
exports
|
|
3150
|
-
exports
|
|
3151
|
-
exports
|
|
3472
|
+
exports["ɵ0"] = ɵ0;
|
|
3473
|
+
exports["ɵ1"] = ɵ1;
|
|
3474
|
+
exports["ɵ2"] = ɵ2;
|
|
3475
|
+
exports["ɵa"] = PageContainerModule;
|
|
3476
|
+
exports["ɵb"] = PageContainerComponent;
|
|
3477
|
+
exports["ɵc"] = TableSearchBarModule;
|
|
3478
|
+
exports["ɵd"] = TableSearchBarComponent;
|
|
3479
|
+
exports["ɵe"] = PlateInputComponent;
|
|
3480
|
+
exports["ɵf"] = ColmunsSettingComponent;
|
|
3481
|
+
exports["ɵg"] = DynamicSearchFieldComponent;
|
|
3152
3482
|
|
|
3153
3483
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3154
3484
|
|
|
3155
|
-
}))
|
|
3485
|
+
}));
|
|
3156
3486
|
//# sourceMappingURL=yibozhang-pro-table.umd.js.map
|