mmhglobal-dynamicform 1.1.38 → 1.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/bundles/mmhglobal-dynamicform.umd.js +260 -49
- package/bundles/mmhglobal-dynamicform.umd.js.map +1 -1
- package/bundles/mmhglobal-dynamicform.umd.min.js +2 -2
- package/bundles/mmhglobal-dynamicform.umd.min.js.map +1 -1
- package/esm2015/lib/mmhglobal-dynamicform.module.js +5 -1
- package/esm2015/lib/services/main.service.js +76 -47
- package/esm2015/lib/services/zcomponent.debug.service.js +3 -3
- package/esm2015/lib/services/zcomponent.service.js +3 -1
- package/esm2015/lib/zbuttons/zbuttons.component.js +5 -1
- package/esm2015/lib/zform/zform.component.js +6 -2
- package/esm2015/lib/ztext/ztext.component.js +3 -3
- package/esm2015/lib/zudf/zudf.component.js +166 -0
- package/esm2015/lib/zupload/zupload.component.js +8 -2
- package/esm2015/public-api.js +2 -1
- package/fesm2015/mmhglobal-dynamicform.js +259 -54
- package/fesm2015/mmhglobal-dynamicform.js.map +1 -1
- package/lib/zform/zform.component.d.ts +1 -0
- package/lib/zudf/zudf.component.d.ts +31 -0
- package/mmhglobal-dynamicform.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
package/README.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.13.
|
|
4
4
|
|
|
5
5
|
## Changelog
|
|
6
|
+
`1.39`<br/>
|
|
7
|
+
[zudf] added load userdefinedform.<br/>
|
|
8
|
+
[zupload] enhance to allow to set MinFileSize & MaxFileSize in field attribute
|
|
9
|
+
|
|
6
10
|
`1.38`<br/>
|
|
7
11
|
[zupload] default file size restriction.<br/>
|
|
8
12
|
[zupload] added clearFiles function.<br/>
|
|
@@ -395,11 +395,11 @@
|
|
|
395
395
|
onChangeWatchName: this.onChangeWatchName.bind(this),
|
|
396
396
|
getWatchName: this.getWatchName.bind(this),
|
|
397
397
|
fieldElementonEditorCodeChange: this.fieldElementonEditorCodeChange.bind(this),
|
|
398
|
-
gridActivityLogColumnFields: this.fieldService.getFormFieldCode('debugActivityLog', "FormField",
|
|
398
|
+
gridActivityLogColumnFields: this.fieldService.getFormFieldCode('debugActivityLog', "FormField", this.group, "debugActivityLogField"),
|
|
399
399
|
gridActivityLogOnItemClick: this.gridActivityLogOnItemClick.bind(this),
|
|
400
400
|
updateModel: this.updateModel.bind(this),
|
|
401
401
|
refreshWorkflowButtonData: this.loadWorkflowData.bind(this),
|
|
402
|
-
gridWorkflowButtonColumnFields: this.fieldService.getFormFieldCode('debugWorkflowButton', 'FormField',
|
|
402
|
+
gridWorkflowButtonColumnFields: this.fieldService.getFormFieldCode('debugWorkflowButton', 'FormField', this.group, "debugWorkflowButtonField"),
|
|
403
403
|
gridWorkflowButtonOnItemClick: this.gridWorkflowButtonOnItemClick.bind(this)
|
|
404
404
|
});
|
|
405
405
|
if (!d.zData) {
|
|
@@ -1488,10 +1488,22 @@
|
|
|
1488
1488
|
group.beforeBackNavigationPage(group).subscribe(function () {
|
|
1489
1489
|
group['isTriggered'] = false;
|
|
1490
1490
|
_this.router.navigate([group.backNavigationPage]);
|
|
1491
|
+
//if (group['reload']) {
|
|
1492
|
+
// group['isTriggered'] = false;
|
|
1493
|
+
// this.router.routeReuseStrategy.shouldReuseRoute = function () {
|
|
1494
|
+
// return false;
|
|
1495
|
+
// }
|
|
1496
|
+
// this.router.onSameUrlNavigation = 'reload';
|
|
1497
|
+
//}
|
|
1498
|
+
//this.router.navigate([group.backNavigationPage],);
|
|
1491
1499
|
});
|
|
1492
1500
|
}
|
|
1493
1501
|
else {
|
|
1494
1502
|
group['isTriggered'] = false;
|
|
1503
|
+
//this.router.routeReuseStrategy.shouldReuseRoute = function () {
|
|
1504
|
+
// return false;
|
|
1505
|
+
//}
|
|
1506
|
+
//this.router.onSameUrlNavigation = 'reload';
|
|
1495
1507
|
this.router.navigate([group.backNavigationPage]);
|
|
1496
1508
|
}
|
|
1497
1509
|
};
|
|
@@ -1538,10 +1550,14 @@
|
|
|
1538
1550
|
};
|
|
1539
1551
|
MainService.prototype.newModel = function (event, group) {
|
|
1540
1552
|
var _this = this;
|
|
1553
|
+
var _group = group;
|
|
1554
|
+
if (event.data && event.data.SubType) {
|
|
1555
|
+
_group = group['_' + event.data.SubType];
|
|
1556
|
+
}
|
|
1541
1557
|
rxjs.of([])
|
|
1542
1558
|
.pipe(operators.switchMap(function (zmodel) {
|
|
1543
1559
|
console.log("Before new, zModel:", zmodel);
|
|
1544
|
-
return _this.beforeNewModel(
|
|
1560
|
+
return _this.beforeNewModel(_group);
|
|
1545
1561
|
}), operators.tap(function () {
|
|
1546
1562
|
var referenceId = group.parentReferenceId || "0";
|
|
1547
1563
|
console.log("current url: ", _this.router.url);
|
|
@@ -1587,7 +1603,13 @@
|
|
|
1587
1603
|
};
|
|
1588
1604
|
MainService.prototype.createModel = function (event, group) {
|
|
1589
1605
|
var _this = this;
|
|
1606
|
+
var createModelres = null;
|
|
1590
1607
|
var fg = group.form;
|
|
1608
|
+
var _group = group;
|
|
1609
|
+
if (event.data && event.data.SubType) {
|
|
1610
|
+
fg = group['_' + event.data.SubType].form;
|
|
1611
|
+
_group = group['_' + event.data.SubType];
|
|
1612
|
+
}
|
|
1591
1613
|
if (!fg.dirty) {
|
|
1592
1614
|
console.warn("Form is not dirty hence record is not save.");
|
|
1593
1615
|
return;
|
|
@@ -1597,15 +1619,14 @@
|
|
|
1597
1619
|
console.warn("Form Validation got error(s):", errors);
|
|
1598
1620
|
return;
|
|
1599
1621
|
}
|
|
1600
|
-
|
|
1601
|
-
rxjs.of(group.zModel)
|
|
1622
|
+
rxjs.of(_group.zModel)
|
|
1602
1623
|
.pipe(operators.switchMap(function (zmodel) {
|
|
1603
1624
|
console.log("Before create, zModel:", zmodel);
|
|
1604
|
-
return _this.beforeCreateModel(
|
|
1625
|
+
return _this.beforeCreateModel(_group);
|
|
1605
1626
|
}), operators.tap(function () {
|
|
1606
|
-
Object.assign(
|
|
1627
|
+
Object.assign(_group.zModel, fg.value);
|
|
1607
1628
|
}), operators.switchMap(function () {
|
|
1608
|
-
var newModel = Object.assign({},
|
|
1629
|
+
var newModel = Object.assign({}, _group.zModel);
|
|
1609
1630
|
i3.ZComponentHelper.removeNullFields(newModel);
|
|
1610
1631
|
// Object.keys(newModel).forEach((key) => {
|
|
1611
1632
|
// if (newModel[key] === null) {
|
|
@@ -1616,7 +1637,7 @@
|
|
|
1616
1637
|
// newModel.Id = 0;
|
|
1617
1638
|
// }
|
|
1618
1639
|
return _this.webApiService
|
|
1619
|
-
.httpPost$(
|
|
1640
|
+
.httpPost$(_group.resourceURL, // + "/" + group.zModel.Id,
|
|
1620
1641
|
newModel)
|
|
1621
1642
|
.pipe(operators.tap(function (resp) {
|
|
1622
1643
|
createModelres = resp;
|
|
@@ -1627,25 +1648,25 @@
|
|
|
1627
1648
|
if (zmodel) {
|
|
1628
1649
|
//support old and new webapi method
|
|
1629
1650
|
if (zmodel.Data) {
|
|
1630
|
-
Object.assign(
|
|
1651
|
+
Object.assign(_group.zModel, zmodel.Data);
|
|
1631
1652
|
fg.patchValue(zmodel.Data);
|
|
1632
1653
|
}
|
|
1633
1654
|
else if (zmodel["Id"]) {
|
|
1634
|
-
Object.assign(
|
|
1655
|
+
Object.assign(_group.zModel, zmodel);
|
|
1635
1656
|
fg.patchValue(zmodel);
|
|
1636
1657
|
}
|
|
1637
|
-
|
|
1658
|
+
_group.referenceId = _group.zModel.Id;
|
|
1638
1659
|
fg.markAsPristine();
|
|
1639
1660
|
}
|
|
1640
|
-
return _this.afterCreateModel(
|
|
1661
|
+
return _this.afterCreateModel(_group);
|
|
1641
1662
|
}), operators.tap(function (resp) {
|
|
1642
1663
|
if (createModelres.ProcessingStatus == null || createModelres.ProcessingStatus == true) {
|
|
1643
|
-
if (resp &&
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
Object.assign(
|
|
1664
|
+
if (resp && _group.zModel.Id !== 0) {
|
|
1665
|
+
_group.isNew = false;
|
|
1666
|
+
_group.isEdit = true;
|
|
1667
|
+
_group.isTriggered = false;
|
|
1668
|
+
_group.cancelButtonName = "Close";
|
|
1669
|
+
Object.assign(_group.zModel, resp);
|
|
1649
1670
|
fg.patchValue(resp);
|
|
1650
1671
|
}
|
|
1651
1672
|
fg.markAsPristine();
|
|
@@ -1661,6 +1682,11 @@
|
|
|
1661
1682
|
MainService.prototype.updateModel = function (event, group) {
|
|
1662
1683
|
var _this = this;
|
|
1663
1684
|
var fg = group.form;
|
|
1685
|
+
var _group = group;
|
|
1686
|
+
if (event.data && event.data.SubType) {
|
|
1687
|
+
fg = group['_' + event.data.SubType].form;
|
|
1688
|
+
_group = group['_' + event.data.SubType];
|
|
1689
|
+
}
|
|
1664
1690
|
if (!fg.dirty) {
|
|
1665
1691
|
console.warn("Form is not dirty hence record is not save.");
|
|
1666
1692
|
return;
|
|
@@ -1670,31 +1696,32 @@
|
|
|
1670
1696
|
console.warn("Form Validation got error(s):", errors);
|
|
1671
1697
|
return;
|
|
1672
1698
|
}
|
|
1673
|
-
rxjs.of(
|
|
1699
|
+
rxjs.of(_group.zModel)
|
|
1674
1700
|
.pipe(operators.switchMap(function (zmodel) {
|
|
1675
1701
|
console.log("Before update, zModel:", zmodel);
|
|
1676
|
-
return _this.beforeUpdateModel(
|
|
1702
|
+
return _this.beforeUpdateModel(_group);
|
|
1677
1703
|
}), operators.tap(function () {
|
|
1678
|
-
Object.assign(
|
|
1704
|
+
Object.assign(_group.zModel, fg.value);
|
|
1679
1705
|
}), operators.switchMap(function () {
|
|
1680
1706
|
return _this.webApiService
|
|
1681
|
-
.httpPut$(
|
|
1707
|
+
.httpPut$(_group.resourceURL + "/" + _group.zModel.Id, _group.zModel)
|
|
1682
1708
|
.pipe(operators.map(function (res) { return _this.handleSuccess(res, "Record is updated successfully."); }));
|
|
1683
1709
|
}), operators.switchMap(function (zmodel) {
|
|
1684
1710
|
console.log("After updated, zModel:", zmodel);
|
|
1685
1711
|
if (zmodel && zmodel.Data) {
|
|
1686
|
-
Object.assign(
|
|
1712
|
+
Object.assign(_group.zModel, zmodel.Data);
|
|
1687
1713
|
fg.patchValue(zmodel.Data);
|
|
1688
1714
|
// console.log("Done updateModel updated zModel:", fg.value);
|
|
1689
1715
|
}
|
|
1690
1716
|
else if (zmodel && zmodel["Id"]) {
|
|
1691
|
-
Object.assign(
|
|
1717
|
+
Object.assign(_group.zModel, zmodel);
|
|
1692
1718
|
fg.patchValue(zmodel);
|
|
1693
1719
|
// console.log("Done updateModel updated zModel:", fg.value);
|
|
1694
1720
|
}
|
|
1695
1721
|
group.isTriggered = false;
|
|
1722
|
+
_group.isTriggered = false;
|
|
1696
1723
|
fg.markAsPristine();
|
|
1697
|
-
return _this.afterUpdateModel(
|
|
1724
|
+
return _this.afterUpdateModel(_group);
|
|
1698
1725
|
}))
|
|
1699
1726
|
.subscribe();
|
|
1700
1727
|
// Object.assign(group.zModel, fg.value);
|
|
@@ -1708,49 +1735,51 @@
|
|
|
1708
1735
|
// });
|
|
1709
1736
|
};
|
|
1710
1737
|
MainService.prototype.cloneNewModel = function (event, group) {
|
|
1711
|
-
|
|
1712
|
-
|
|
1738
|
+
var _group = group;
|
|
1739
|
+
if (event.data && event.data.SubType) {
|
|
1740
|
+
_group = group['_' + event.data.SubType];
|
|
1741
|
+
}
|
|
1742
|
+
Object.assign(_group.zModel, _group.form.value);
|
|
1743
|
+
_group.zModel.Id = 0;
|
|
1713
1744
|
var clearFields = ["WFS_DocumentId", "WFS_StatusCode", "WFS_StatusName"];
|
|
1714
1745
|
clearFields.forEach(function (field) {
|
|
1715
|
-
if (
|
|
1716
|
-
|
|
1746
|
+
if (_group.zModel.hasOwnProperty(field)) {
|
|
1747
|
+
_group.zModel[field] = null;
|
|
1717
1748
|
}
|
|
1718
1749
|
});
|
|
1719
1750
|
this.cacheService.setCache("cloneNewModel", group.zModel);
|
|
1720
1751
|
this.newModel(null, group);
|
|
1721
1752
|
group.isTriggered = false;
|
|
1753
|
+
_group.isTriggered = false;
|
|
1722
1754
|
};
|
|
1723
1755
|
MainService.prototype.deleteModel = function (event, group) {
|
|
1724
1756
|
var _this = this;
|
|
1725
1757
|
var fg = group.form;
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
// console.warn("Form Validation got error(s):", errors);
|
|
1733
|
-
// return;
|
|
1734
|
-
// }
|
|
1735
|
-
rxjs.of(group.zModel)
|
|
1758
|
+
var _group = group;
|
|
1759
|
+
if (event.data && event.data.SubType) {
|
|
1760
|
+
fg = group['_' + event.data.SubType].form;
|
|
1761
|
+
_group = group['_' + event.data.SubType];
|
|
1762
|
+
}
|
|
1763
|
+
rxjs.of(_group.zModel)
|
|
1736
1764
|
.pipe(operators.switchMap(function (zmodel) {
|
|
1737
1765
|
console.log("Before delete, zModel:", zmodel);
|
|
1738
|
-
return _this.beforeDeleteModel(
|
|
1766
|
+
return _this.beforeDeleteModel(_group);
|
|
1739
1767
|
}), operators.switchMap(function () {
|
|
1740
1768
|
group.isTriggered = false;
|
|
1769
|
+
_group.isTriggered = false;
|
|
1741
1770
|
return _this.alertService.show("Delete Record", "Are you sure?", [
|
|
1742
1771
|
{ text: "No", cssClass: "secondary" },
|
|
1743
1772
|
{ text: "Yes", cssClass: "primary" }
|
|
1744
1773
|
]);
|
|
1745
1774
|
}), operators.switchMap(function (reply) {
|
|
1746
1775
|
if (reply === "Yes") {
|
|
1747
|
-
Object.assign(
|
|
1748
|
-
|
|
1776
|
+
Object.assign(_group.zModel, fg.value);
|
|
1777
|
+
_group.zModel.Disabled = true;
|
|
1749
1778
|
return _this.webApiService
|
|
1750
|
-
.httpPut$(
|
|
1779
|
+
.httpPut$(_group.resourceURL + "/" + _group.zModel.Id, _group.zModel)
|
|
1751
1780
|
.pipe(operators.map(function (res) { return _this.handleSuccess(res, "Record is deleted successfully."); }), operators.switchMap(function (zmodel) {
|
|
1752
1781
|
console.log("After deleted, zModel:", zmodel);
|
|
1753
|
-
return _this.afterDeleteModel(
|
|
1782
|
+
return _this.afterDeleteModel(_group);
|
|
1754
1783
|
}), operators.tap(function (resp) {
|
|
1755
1784
|
_this.historyBack();
|
|
1756
1785
|
}));
|
|
@@ -4022,6 +4051,9 @@
|
|
|
4022
4051
|
field$.subscribe(function (data) {
|
|
4023
4052
|
// this.items = data;
|
|
4024
4053
|
data.forEach(function (button) {
|
|
4054
|
+
if (_this.data.SubType) {
|
|
4055
|
+
button.Name = _this.data.SubType + '_' + button.Name;
|
|
4056
|
+
}
|
|
4025
4057
|
var label = _this.getButtonLabel(button);
|
|
4026
4058
|
var buttonDisabled = null;
|
|
4027
4059
|
if (button.Disabled != "" && button.Disabled) {
|
|
@@ -4037,6 +4069,7 @@
|
|
|
4037
4069
|
iconName: button.Icon,
|
|
4038
4070
|
dismissType: button.DismissType,
|
|
4039
4071
|
disableTriggerTimer: button.DisableTriggerTimer,
|
|
4072
|
+
SubType: _this.data.SubType,
|
|
4040
4073
|
click: function (y) {
|
|
4041
4074
|
_this.buttonClick(button);
|
|
4042
4075
|
}
|
|
@@ -5334,12 +5367,16 @@
|
|
|
5334
5367
|
}
|
|
5335
5368
|
return readOnlyValue;
|
|
5336
5369
|
};
|
|
5370
|
+
ZformComponent.prototype.trackByFn = function (index, item) {
|
|
5371
|
+
//return item['Type'] + '-' + item['Name'];
|
|
5372
|
+
return index;
|
|
5373
|
+
};
|
|
5337
5374
|
return ZformComponent;
|
|
5338
5375
|
}());
|
|
5339
5376
|
ZformComponent.decorators = [
|
|
5340
5377
|
{ type: i0.Component, args: [{
|
|
5341
5378
|
selector: "app-zform",
|
|
5342
|
-
template: "<div class=\"e1-form\">\r\n <!--<div class=\"k-overlay\" *ngIf=\"isLoading\"></div>-->\r\n <form [formGroup]=\"form\" autocomplete=\"off\" *ngIf=\"!isLoading\">\r\n <ion-grid>\r\n <ion-row id=\"dynamic-form-host\" class=\"ion-align-items-start\">\r\n <app-zformcontrol *ngFor=\"let field of fields\"\r\n [ngClass]=\"group[field['isVisibleField']] ? field.DivClass :\r\n ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n [field]=\"field\"\r\n [group]=\"getGroup()\"\r\n [form]=\"form\"\r\n id=\"{{field.Type}}-{{field.Name}}\"></app-zformcontrol>\r\n </ion-row>\r\n </ion-grid>\r\n </form>\r\n</div
|
|
5379
|
+
template: "<div class=\"e1-form\">\r\n <!--<div class=\"k-overlay\" *ngIf=\"isLoading\"></div>-->\r\n <form [formGroup]=\"form\" autocomplete=\"off\" *ngIf=\"!isLoading\">\r\n <ion-grid>\r\n <ion-row id=\"dynamic-form-host\" class=\"ion-align-items-start\">\r\n <app-zformcontrol *ngFor=\"let field of fields; trackBy: trackByFn\"\r\n [ngClass]=\"group[field['isVisibleField']] ? field.DivClass :\r\n ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n [field]=\"field\"\r\n [group]=\"getGroup()\"\r\n [form]=\"form\"\r\n id=\"{{field.Type}}-{{field.Name}}\"></app-zformcontrol>\r\n </ion-row>\r\n </ion-grid>\r\n </form>\r\n</div>\r\n",
|
|
5343
5380
|
styles: ["#dynamic-form-host app-zformcontrol{overflow-x:auto;overflow-y:hidden}"]
|
|
5344
5381
|
},] }
|
|
5345
5382
|
];
|
|
@@ -9486,8 +9523,8 @@
|
|
|
9486
9523
|
});
|
|
9487
9524
|
};
|
|
9488
9525
|
ZtextComponent.prototype.onChange = function (event) {
|
|
9489
|
-
// console.log('ztext.component - onChange: ', event.target.value);
|
|
9490
|
-
i3.ZComponentHelper.
|
|
9526
|
+
// console.log('ztext.component - onChange: ', event.target.value);
|
|
9527
|
+
i3.ZComponentHelper.setComponentModelValue(this.data, event.target.value, this.group);
|
|
9491
9528
|
this.group.subject.next({
|
|
9492
9529
|
type: "onChange",
|
|
9493
9530
|
target: this.data.OnChange,
|
|
@@ -10681,6 +10718,169 @@
|
|
|
10681
10718
|
form: [{ type: i0.Input }]
|
|
10682
10719
|
};
|
|
10683
10720
|
|
|
10721
|
+
/********** Angular **********/
|
|
10722
|
+
var ZudfComponent = /** @class */ (function () {
|
|
10723
|
+
function ZudfComponent(alertService, authService, fieldService, resourceApiService, toastService, webApiService) {
|
|
10724
|
+
var _this = this;
|
|
10725
|
+
this.alertService = alertService;
|
|
10726
|
+
this.authService = authService;
|
|
10727
|
+
this.fieldService = fieldService;
|
|
10728
|
+
this.resourceApiService = resourceApiService;
|
|
10729
|
+
this.toastService = toastService;
|
|
10730
|
+
this.webApiService = webApiService;
|
|
10731
|
+
this.componentProperties = new i3.ZComponentProperties();
|
|
10732
|
+
this.setEnable = function (status) {
|
|
10733
|
+
_this.componentProperties.isReadOnly = !status;
|
|
10734
|
+
};
|
|
10735
|
+
this.setVisible = function (status) {
|
|
10736
|
+
_this.componentProperties.isVisible = status;
|
|
10737
|
+
_this.data.Visible = status;
|
|
10738
|
+
};
|
|
10739
|
+
this.setRequire = function (status) {
|
|
10740
|
+
_this.componentProperties.isRequired = status;
|
|
10741
|
+
i3.ZComponentHelper.changeValidator(status, _this.group, _this.data.Value, _this.componentProperties, forms.Validators.required);
|
|
10742
|
+
};
|
|
10743
|
+
}
|
|
10744
|
+
ZudfComponent.prototype.ngOnInit = function () {
|
|
10745
|
+
var _this = this;
|
|
10746
|
+
i3.ZComponentHelper.setComponentProperties(this);
|
|
10747
|
+
i3.ZComponentHelper.registerComponent(this);
|
|
10748
|
+
rxjs.of(true).pipe(operators.concatMap(function (fieldElements) {
|
|
10749
|
+
var asyncSubject = new rxjs.AsyncSubject();
|
|
10750
|
+
_this.fieldService.getFormFieldCode(_this.data.Value, 'FormField', _this, 'fields').pipe(operators.map(function (formFieldResult) {
|
|
10751
|
+
// rename add prefix to all udf field to prevent duplicate from main form
|
|
10752
|
+
_this.appendPrefix(formFieldResult, 'zudf');
|
|
10753
|
+
// change the value to the result field form
|
|
10754
|
+
_this.data.Value = formFieldResult;
|
|
10755
|
+
// change zudf to zdiv
|
|
10756
|
+
_this.data.Type = 'zdiv';
|
|
10757
|
+
// end subject
|
|
10758
|
+
asyncSubject.next(true);
|
|
10759
|
+
asyncSubject.complete();
|
|
10760
|
+
})).subscribe();
|
|
10761
|
+
return asyncSubject.asObservable();
|
|
10762
|
+
}), operators.tap(function () {
|
|
10763
|
+
if (!_this.group._zudf) {
|
|
10764
|
+
_this.group._zudf = new i3.ZGroup;
|
|
10765
|
+
}
|
|
10766
|
+
_this.group._zudf.zModel = {};
|
|
10767
|
+
// create as new Form Group
|
|
10768
|
+
_this.form = _this.toFormGroup(_this.data.Value);
|
|
10769
|
+
// set to zGroup scope
|
|
10770
|
+
_this.group._zudf.form = _this.form;
|
|
10771
|
+
}), operators.tap(function () {
|
|
10772
|
+
// set to formField for display
|
|
10773
|
+
_this.formField = _this.data.Value;
|
|
10774
|
+
})).subscribe(function () {
|
|
10775
|
+
// set Field div class
|
|
10776
|
+
i3.ZComponentHelper.setFieldsDivClass(_this.group._projectName, _this.group.fieldName, _this.data, _this.authService);
|
|
10777
|
+
// get saved record
|
|
10778
|
+
_this.getFormFieldzModel();
|
|
10779
|
+
});
|
|
10780
|
+
};
|
|
10781
|
+
ZudfComponent.prototype.getFormFieldzModel = function () {
|
|
10782
|
+
var form = this.group._zudf.form;
|
|
10783
|
+
var zModel = this.group._zudf.zModel;
|
|
10784
|
+
var url = this.resourceApiService.getURL('field');
|
|
10785
|
+
var respData = { 'parentFormId': 5722, 'zudf_Name': 'test' };
|
|
10786
|
+
Object.assign(zModel, respData);
|
|
10787
|
+
form.patchValue(zModel);
|
|
10788
|
+
form.markAsPristine();
|
|
10789
|
+
//return this.webApiService.httpGet$(url, { name: this.group.fieldName, type: 'FormField' }).pipe(
|
|
10790
|
+
// tap((respData: any) => {
|
|
10791
|
+
// debugger;
|
|
10792
|
+
// Object.assign(zModel, respData);
|
|
10793
|
+
// form.patchValue(zModel);
|
|
10794
|
+
// form.markAsPristine();
|
|
10795
|
+
// })
|
|
10796
|
+
//);
|
|
10797
|
+
};
|
|
10798
|
+
ZudfComponent.prototype.toFormGroup = function (fieldElements) {
|
|
10799
|
+
var formControls = {};
|
|
10800
|
+
this.getFormControls(fieldElements, formControls);
|
|
10801
|
+
var newFormGroup = new forms.FormGroup(formControls);
|
|
10802
|
+
return newFormGroup;
|
|
10803
|
+
};
|
|
10804
|
+
ZudfComponent.prototype.getFormControls = function (fieldArray, formControls) {
|
|
10805
|
+
var _this = this;
|
|
10806
|
+
fieldArray.forEach(function (field) {
|
|
10807
|
+
if (typeof field.Value === "string" && field.Value.indexOf(".") !== -1) {
|
|
10808
|
+
if (['zgrid', 'ztree', 'zimg', 'textareajson'].indexOf(field.Type) === -1) {
|
|
10809
|
+
console.warn("FormControl - invalid field value", field.Value);
|
|
10810
|
+
}
|
|
10811
|
+
}
|
|
10812
|
+
else {
|
|
10813
|
+
if (Array.isArray(field.Value)) {
|
|
10814
|
+
_this.getFormControls(field.Value, formControls);
|
|
10815
|
+
}
|
|
10816
|
+
else {
|
|
10817
|
+
var isFormControl = i3.ZComponentHelper.isFormControl(field);
|
|
10818
|
+
var isVisible = i3.ZComponentHelper.isVisibleFormControl(_this, field);
|
|
10819
|
+
var isRequired = i3.ZComponentHelper.isRequiredFormControl(_this, field);
|
|
10820
|
+
if (isFormControl === true) {
|
|
10821
|
+
var validators = i3.ZComponentHelper.getValidators(field, isVisible, isRequired);
|
|
10822
|
+
formControls[field.Value] = new forms.FormControl(_this.group._zudf.zModel[field.Value], validators);
|
|
10823
|
+
if (i3.ZComponentHelper.hasCCField(field.Type)) {
|
|
10824
|
+
var ccValidators = i3.ZComponentHelper.getCCValidators(field, isVisible, isRequired);
|
|
10825
|
+
formControls[field.CCValue] = new forms.FormControl(_this.group._zudf.zModel[field.CCValue], ccValidators);
|
|
10826
|
+
}
|
|
10827
|
+
}
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10830
|
+
});
|
|
10831
|
+
};
|
|
10832
|
+
ZudfComponent.prototype.appendPrefix = function (fields, prefix) {
|
|
10833
|
+
var _this = this;
|
|
10834
|
+
fields.forEach(function (field) {
|
|
10835
|
+
if (Array.isArray(field.Value)) {
|
|
10836
|
+
_this.appendPrefix(field.Value, prefix);
|
|
10837
|
+
}
|
|
10838
|
+
else {
|
|
10839
|
+
field.Name = prefix + '_' + field.Name;
|
|
10840
|
+
if (field.Type != 'zbuttons') {
|
|
10841
|
+
field.Value = prefix + '_' + field.Value;
|
|
10842
|
+
}
|
|
10843
|
+
field.SubType = prefix;
|
|
10844
|
+
}
|
|
10845
|
+
});
|
|
10846
|
+
};
|
|
10847
|
+
ZudfComponent.prototype.ComponentIsVisible = function (field) {
|
|
10848
|
+
return i3.ZComponentHelper.ComponentIsVisible(field, this.group);
|
|
10849
|
+
};
|
|
10850
|
+
ZudfComponent.prototype.allowDrop = function (ev) {
|
|
10851
|
+
ev.preventDefault();
|
|
10852
|
+
};
|
|
10853
|
+
ZudfComponent.prototype.drag = function (ev) {
|
|
10854
|
+
ev.dataTransfer.setData("text", ev.target.id);
|
|
10855
|
+
};
|
|
10856
|
+
ZudfComponent.prototype.drop = function (ev) {
|
|
10857
|
+
ev.preventDefault();
|
|
10858
|
+
var data = ev.dataTransfer.getData("text");
|
|
10859
|
+
ev.target.appendChild(document.getElementById(data));
|
|
10860
|
+
};
|
|
10861
|
+
return ZudfComponent;
|
|
10862
|
+
}());
|
|
10863
|
+
ZudfComponent.decorators = [
|
|
10864
|
+
{ type: i0.Component, args: [{
|
|
10865
|
+
selector: 'app-zudf',
|
|
10866
|
+
template: "<div *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" class=\"ion-row\">\r\n\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of formField | divzlayout: data.zlayout\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"zudf-{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n\r\n <h2>Drag and Drop</h2>\r\n <div id=\"div1\"\r\n (drop)=\"drop($event)\"\r\n (dragover)=\"allowDrop($event)\">\r\n\r\n <img src=\"https://images.pexels.com/photos/658687/pexels-photo-658687.jpeg?auto=compress&cs=tinysrgb&h=350\"\r\n draggable=\"true\"\r\n (dragstart)=\"drag($event)\"\r\n id=\"drag1\"\r\n width=\"88\"\r\n height=\"31\">\r\n </div>\r\n\r\n <div id=\"div2\"\r\n (drop)=\"drop($event)\"\r\n (dragover)=\"allowDrop($event)\">\r\n </div>\r\n\r\n</div>\r\n",
|
|
10867
|
+
styles: ["#div1,#div2{float:left;width:100px;height:35px;margin:10px;padding:10px;border:1px solid #000}"]
|
|
10868
|
+
},] }
|
|
10869
|
+
];
|
|
10870
|
+
ZudfComponent.ctorParameters = function () { return [
|
|
10871
|
+
{ type: i3.AlertService },
|
|
10872
|
+
{ type: i3.AuthService },
|
|
10873
|
+
{ type: i3.FieldService },
|
|
10874
|
+
{ type: i3.ResourceApiService },
|
|
10875
|
+
{ type: i3.ToastService },
|
|
10876
|
+
{ type: i3.WebApiService }
|
|
10877
|
+
]; };
|
|
10878
|
+
ZudfComponent.propDecorators = {
|
|
10879
|
+
data: [{ type: i0.Input }],
|
|
10880
|
+
group: [{ type: i0.Input }],
|
|
10881
|
+
form: [{ type: i0.Input }]
|
|
10882
|
+
};
|
|
10883
|
+
|
|
10684
10884
|
/********** Angular **********/
|
|
10685
10885
|
var ZunknownComponent = /** @class */ (function () {
|
|
10686
10886
|
function ZunknownComponent() {
|
|
@@ -10794,6 +10994,12 @@
|
|
|
10794
10994
|
this.restrictions.allowedExtensions = this.data
|
|
10795
10995
|
.SelectOptions;
|
|
10796
10996
|
}
|
|
10997
|
+
if (this.data.MinFileSize) {
|
|
10998
|
+
this.restrictions.minFileSize = this.data.MinFileSize;
|
|
10999
|
+
}
|
|
11000
|
+
if (this.data.MaxFileSize) {
|
|
11001
|
+
this.restrictions.maxFileSize = this.data.MaxFileSize;
|
|
11002
|
+
}
|
|
10797
11003
|
this.isAutoUpload = this.data.AutoUpload || false;
|
|
10798
11004
|
if (!this.data.AllowRemove) {
|
|
10799
11005
|
this.uploadRemoveUrl = "";
|
|
@@ -11028,7 +11234,7 @@
|
|
|
11028
11234
|
} // file type check
|
|
11029
11235
|
}); // loop each file
|
|
11030
11236
|
} // imagecompression check
|
|
11031
|
-
// add to group scope
|
|
11237
|
+
// add to group scope
|
|
11032
11238
|
me.group['zupload_' + me.data.Value] = e.files;
|
|
11033
11239
|
}
|
|
11034
11240
|
}
|
|
@@ -11327,6 +11533,7 @@
|
|
|
11327
11533
|
ktree_list: ZtreelistComponent,
|
|
11328
11534
|
ztrendcard: ZtrendcardComponent,
|
|
11329
11535
|
unknown: ZunknownComponent,
|
|
11536
|
+
zudf: ZudfComponent,
|
|
11330
11537
|
zupload: ZuploadComponent,
|
|
11331
11538
|
zworkflowbuttons: ZworkflowbuttonsComponent
|
|
11332
11539
|
// kdate_rangepicker: ZdaterangeComponent
|
|
@@ -11510,6 +11717,7 @@
|
|
|
11510
11717
|
ZtreelistComponent,
|
|
11511
11718
|
ZtrendcardComponent,
|
|
11512
11719
|
ZunknownComponent,
|
|
11720
|
+
ZudfComponent,
|
|
11513
11721
|
ZuploadComponent,
|
|
11514
11722
|
ZworkflowbuttonsComponent
|
|
11515
11723
|
],
|
|
@@ -11609,6 +11817,7 @@
|
|
|
11609
11817
|
ZtreelistComponent,
|
|
11610
11818
|
ZtrendcardComponent,
|
|
11611
11819
|
ZunknownComponent,
|
|
11820
|
+
ZudfComponent,
|
|
11612
11821
|
ZuploadComponent,
|
|
11613
11822
|
ZworkflowbuttonsComponent
|
|
11614
11823
|
],
|
|
@@ -11658,6 +11867,7 @@
|
|
|
11658
11867
|
ZtreelistComponent,
|
|
11659
11868
|
ZtrendcardComponent,
|
|
11660
11869
|
ZunknownComponent,
|
|
11870
|
+
ZudfComponent,
|
|
11661
11871
|
ZuploadComponent,
|
|
11662
11872
|
ZworkflowbuttonsComponent
|
|
11663
11873
|
],
|
|
@@ -11733,6 +11943,7 @@
|
|
|
11733
11943
|
exports.ZtreeComponent = ZtreeComponent;
|
|
11734
11944
|
exports.ZtreelistComponent = ZtreelistComponent;
|
|
11735
11945
|
exports.ZtrendcardComponent = ZtrendcardComponent;
|
|
11946
|
+
exports.ZudfComponent = ZudfComponent;
|
|
11736
11947
|
exports.ZunknownComponent = ZunknownComponent;
|
|
11737
11948
|
exports.ZuploadComponent = ZuploadComponent;
|
|
11738
11949
|
exports.ZworkflowbuttonsComponent = ZworkflowbuttonsComponent;
|