mmhglobal-dynamicform 1.1.43 → 1.1.44

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 CHANGED
@@ -3,6 +3,11 @@
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.1.44`<br/>
7
+ [zudf] - enhance zudf<br/>
8
+ [zcard] - enhance to handle disablecollapse<br/>
9
+ [zbutton] - enhance to have kendo color, fill<br/>
10
+
6
11
  `1.1.43`<br/>
7
12
  [ztree] - enhance to have expand & select 1 node and collapse 1 node<br/>
8
13
 
@@ -4069,6 +4069,8 @@
4069
4069
  if (button.Disabled != "" && button.Disabled) {
4070
4070
  buttonDisabled = button.Disabled === 'true' ? true : i3.ZComponentHelper.getGroupEvalValue.call(_this, button.Disabled);
4071
4071
  }
4072
+ var fill = button['Fill'] ? button['Fill'] : 'outline';
4073
+ var color = button.Color ? button.Color : 'dark';
4072
4074
  _this.items.push({
4073
4075
  name: button.Name,
4074
4076
  text: label,
@@ -4079,6 +4081,8 @@
4079
4081
  iconName: button.Icon,
4080
4082
  dismissType: button.DismissType,
4081
4083
  disableTriggerTimer: button.DisableTriggerTimer,
4084
+ fill: fill,
4085
+ color: color,
4082
4086
  SubType: _this.data.SubType,
4083
4087
  click: function (y) {
4084
4088
  _this.buttonClick(button);
@@ -4129,14 +4133,19 @@
4129
4133
  });
4130
4134
  };
4131
4135
  ZbuttonsComponent.prototype.getButtonLabel = function (button) {
4132
- var labelExpr = button.Label.match(/^{{.*}}$/gi);
4133
- if (labelExpr) {
4134
- labelExpr = labelExpr[0].slice(2, -2);
4135
- var label = i3.ZComponentHelper.getGroupValue(labelExpr, this.group);
4136
- return label;
4136
+ if (button.Label) {
4137
+ var labelExpr = button.Label.match(/^{{.*}}$/gi);
4138
+ if (labelExpr) {
4139
+ labelExpr = labelExpr[0].slice(2, -2);
4140
+ var label = i3.ZComponentHelper.getGroupValue(labelExpr, this.group);
4141
+ return label;
4142
+ }
4143
+ else {
4144
+ return button.Label;
4145
+ }
4137
4146
  }
4138
4147
  else {
4139
- return button.Label;
4148
+ return null;
4140
4149
  }
4141
4150
  };
4142
4151
  ZbuttonsComponent.prototype.getButtonRole = function (button, label) {
@@ -4167,7 +4176,7 @@
4167
4176
  ZbuttonsComponent.decorators = [
4168
4177
  { type: i0.Component, args: [{
4169
4178
  selector: "app-zbuttons",
4170
- template: "<!-- <p>\r\n zbuttons {{data.Value}}\r\n</p> -->\r\n<div *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible) && items.length > 0\">\r\n\r\n <div class=\"ion-margin-vertical\" *ngIf=\"isMobileScreen() && items.length > 1 && FirstZbtn === false\">\r\n <kendo-dropdownbutton [data]=\"items\" size=\"large\" [look]=\"'outline'\" class=\"ion-activatable ripple-parent\">\r\n Actions\r\n <ng-template kendoDropDownButtonItemTemplate let-dataItem>\r\n <!-- <span class=\"k-icon k-i-{{ dataItem.icon }}\"></span> -->\r\n <span>{{ dataItem.text }}</span>\r\n </ng-template>\r\n <ion-ripple-effect></ion-ripple-effect>\r\n </kendo-dropdownbutton>\r\n </div>\r\n\r\n <div *ngIf=\"!isMobileScreen() || items.length === 1 \" style=\"padding: 10px 0px;\" [class]=\"data.DivClass\">\r\n <!-- <button *ngFor=\"let item of items; let i = index\" (click)=\"BtnClick(item.clickEvent)\"\r\n kendoButton [togglable]=\"true\" [icon]=\"item.icon\" [hidden]=\"!isBtnVisible(item.visible)\"\r\n style=\"margin-right: 5px;\">{{item.text}}</button> -->\r\n <ion-button fill=\"outline\"\r\n color=\"dark\"\r\n size=\"small\"\r\n strong=\"false\"\r\n [expand]=\"expand\"\r\n *ngFor=\"let item of items; let i = index\"\r\n class=\"button-container\"\r\n (click)=\"BtnClick(item)\"\r\n [hidden]=\"!isBtnVisible(item.visible)\"\r\n [disabled]=\"group.isTriggered || item.disabled\">\r\n <fa-icon [icon]=\"getFontAwesome(item.icon)\" style=\"padding-right: 5px;\"></fa-icon>\r\n <span class=\"ion-text-capitalize\">{{item.text}}</span>\r\n </ion-button>\r\n </div>\r\n</div>\r\n",
4179
+ template: "<!-- <p>\r\n zbuttons {{data.Value}}\r\n</p> -->\r\n<div *ngIf=\"data.AlignButton\" style=\"padding-top: 13px\"></div>\r\n<div *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible) && items.length > 0\">\r\n\r\n <div class=\"ion-margin-vertical\" *ngIf=\"isMobileScreen() && items.length > 1 && FirstZbtn === false\">\r\n <kendo-dropdownbutton [data]=\"items\" size=\"large\" [look]=\"'outline'\" class=\"ion-activatable ripple-parent\">\r\n Actions\r\n <ng-template kendoDropDownButtonItemTemplate let-dataItem>\r\n <!-- <span class=\"k-icon k-i-{{ dataItem.icon }}\"></span> -->\r\n <span>{{ dataItem.text }}</span>\r\n </ng-template>\r\n <ion-ripple-effect></ion-ripple-effect>\r\n </kendo-dropdownbutton>\r\n </div>\r\n\r\n <div *ngIf=\"!isMobileScreen() || items.length === 1 \" style=\"padding: 10px 0px;\" [class]=\"data.DivClass\">\r\n <!-- <button *ngFor=\"let item of items; let i = index\" (click)=\"BtnClick(item.clickEvent)\"\r\n kendoButton [togglable]=\"true\" [icon]=\"item.icon\" [hidden]=\"!isBtnVisible(item.visible)\"\r\n style=\"margin-right: 5px;\">{{item.text}}</button> -->\r\n <ion-button *ngFor=\"let item of items; let i = index\"\r\n [fill]=\"item.fill\"\r\n [color]=\"item.color\"\r\n size=\"small\"\r\n strong=\"false\"\r\n class=\"button-container\"\r\n (click)=\"BtnClick(item)\"\r\n [expand]=\"expand\"\r\n [hidden]=\"!isBtnVisible(item.visible)\"\r\n [disabled]=\"group.isTriggered || item.disabled\">\r\n <fa-icon [icon]=\"getFontAwesome(item.icon)\"></fa-icon>\r\n <div *ngIf=\"item.text\" style=\"padding-right: 5px;\"></div>\r\n <span class=\"ion-text-capitalize\">{{item.text}}</span>\r\n </ion-button>\r\n </div>\r\n</div>\r\n",
4171
4180
  styles: [".ripple-parent{position:relative;overflow:hidden}:host ::ng-deep span.ion-text-capitalize{font-weight:600}.button-container,.button:hover{font-size:12px;height:30px}.button:hover{border-radius:5px}"]
4172
4181
  },] }
4173
4182
  ];
@@ -4232,8 +4241,8 @@
4232
4241
  ZcardComponent.decorators = [
4233
4242
  { type: i0.Component, args: [{
4234
4243
  selector: "app-zcard",
4235
- template: "<div *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" style=\"margin: 10px 0 6px 0;\">\r\n <kendo-panelbar keepItemContent=\"true\">\r\n <kendo-panelbar-item [expanded]=\"!data.DefaultCollapse\" [disabled]=\"(!!componentProperties.isReadOnlyField ? group[componentProperties.isReadOnlyField] : componentProperties.isReadOnly)\">\r\n <ng-template kendoPanelBarItemTitle>\r\n <span *ngIf=\"data.Icon\">\r\n <fa-icon [icon]=\"data.Icon\" class=\"zcard-header-icon\"></fa-icon>\r\n </span>\r\n <span *ngIf=\"!data.Icon\">\r\n <i class=\"fas fa-folder\" style=\"color: #000000\"></i>\r\n </span>\r\n <ion-label class=\"zcard-header-title\">{{options.Title}}</ion-label>\r\n </ng-template>\r\n <ng-template kendoPanelBarContent>\r\n <div class=\"ion-row\" style=\"padding: 6px 12px;\">\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of data.Value\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n </div>\r\n </ng-template>\r\n </kendo-panelbar-item>\r\n </kendo-panelbar>\r\n</div>\r\n",
4236
- styles: [".zcard-header-icon{color:#fff!important;padding-right:3px;font-size:11pt}.zcard-header-title{color:#fff!important;font-weight:500;font-size:11pt}"]
4244
+ template: "<div *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" style=\"margin: 10px 0 6px 0;\">\r\n <kendo-panelbar keepItemContent=\"true\" *ngIf=\"!data.DisableCollapse\">\r\n <kendo-panelbar-item [expanded]=\"!data.DefaultCollapse\" [disabled]=\"(!!componentProperties.isReadOnlyField ? group[componentProperties.isReadOnlyField] : componentProperties.isReadOnly)\">\r\n <ng-template kendoPanelBarItemTitle>\r\n <span *ngIf=\"data.Icon\">\r\n <fa-icon [icon]=\"data.Icon\" class=\"zcard-header-icon\"></fa-icon>\r\n </span>\r\n <span *ngIf=\"!data.Icon\">\r\n <i class=\"fas fa-folder\" style=\"color: #000000\"></i>\r\n </span>\r\n <ion-label class=\"zcard-header-title\">{{options.Title}}</ion-label>\r\n </ng-template>\r\n <ng-template kendoPanelBarContent>\r\n <div class=\"ion-row\" style=\"padding: 6px 12px;\">\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of data.Value\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n </div>\r\n </ng-template>\r\n </kendo-panelbar-item>\r\n </kendo-panelbar>\r\n\r\n <kendo-card *ngIf=\"data.DisableCollapse\" width=\"100%\">\r\n <kendo-card-header>\r\n <div>\r\n <span *ngIf=\"data.Icon\">\r\n <fa-icon [icon]=\"data.Icon\" class=\"zcard-header-icon\"></fa-icon>\r\n </span>\r\n <span *ngIf=\"!data.Icon\">\r\n <i class=\"fas fa-folder\" style=\"color: #000000\"></i>\r\n </span>\r\n <ion-label class=\"card-header-title\">{{options.Title}}</ion-label>\r\n </div>\r\n </kendo-card-header>\r\n <kendo-card-body>\r\n <div class=\"ion-row\">\r\n <app-zformcontrol [ngClass]=\"group[field.isVisibleField] ? field.DivClass : ((field.Visible === true) ? field.DivClass : 'flex-hide')\"\r\n *ngFor=\"let field of data.Value\"\r\n [field]=\"field\"\r\n [group]=\"group\"\r\n [form]=\"form\"\r\n id=\"{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n </div>\r\n </kendo-card-body>\r\n </kendo-card>\r\n</div>\r\n",
4245
+ styles: [".zcard-header-icon{color:#fff!important;padding-right:3px;font-size:11pt}:host ::ng-deep kendo-card-header{background-color:#5596e6;color:#fff}.card-header-title{font-weight:500;font-size:10.5pt}"]
4237
4246
  },] }
4238
4247
  ];
4239
4248
  ZcardComponent.ctorParameters = function () { return [
@@ -9878,8 +9887,9 @@
9878
9887
  };
9879
9888
  this.expandAll = function () {
9880
9889
  var node = _this.getItems();
9881
- _this.expandAllNode(node, '');
9882
- console.log(_this.state.expandedkeys);
9890
+ if (node) {
9891
+ _this.expandAllNode(node, '');
9892
+ }
9883
9893
  };
9884
9894
  this.collapseAll = function () {
9885
9895
  _this.state.expandedkeys = [];
@@ -9899,14 +9909,14 @@
9899
9909
  ZtreeComponent.prototype.ngOnInit = function () {
9900
9910
  i3.ZComponentHelper.setComponentProperties(this);
9901
9911
  i3.ZComponentHelper.registerComponent(this);
9912
+ if (this.data.TreeviewExpandAll) {
9913
+ this.expandAll();
9914
+ }
9902
9915
  };
9903
9916
  ZtreeComponent.prototype.ngAfterViewInit = function () {
9904
9917
  // const componentId = ZComponentHelper.getComponentId(this.data);
9905
9918
  // this.group.zComponents[componentId] = this;
9906
9919
  i3.ZComponentHelper.registerComponent(this);
9907
- if (this.data.TreeviewExpandAll) {
9908
- this.expandAll();
9909
- }
9910
9920
  };
9911
9921
  ZtreeComponent.prototype.getItems = function () {
9912
9922
  // if (this.modelName) {
@@ -10831,45 +10841,86 @@
10831
10841
  };
10832
10842
  }
10833
10843
  ZudfComponent.prototype.ngOnInit = function () {
10834
- var _this = this;
10835
10844
  i3.ZComponentHelper.setComponentProperties(this);
10836
10845
  i3.ZComponentHelper.registerComponent(this);
10846
+ // keep data Value
10847
+ this.initialDataValue = this.data.Value;
10848
+ if (i3.ZComponentHelper.isNullUndefinedEmpty(this.data.Value)) {
10849
+ this.loadEmptyForm();
10850
+ }
10851
+ else {
10852
+ this.loadZudfForm();
10853
+ }
10854
+ };
10855
+ ZudfComponent.prototype.loadEmptyForm = function () {
10856
+ var _this = this;
10857
+ rxjs.of(true).pipe(operators.tap(function () {
10858
+ _this.data.SubType = 'zudf';
10859
+ // change the value to the result field form
10860
+ _this.data.Value = [];
10861
+ // change zudf to zdiv
10862
+ //this.data.Type = 'zdiv';
10863
+ }), operators.tap(function () {
10864
+ if (!_this.group['_zudf_' + _this.data.Name]) {
10865
+ _this.group['_zudf_' + _this.data.Name] = new i3.ZGroup;
10866
+ }
10867
+ var grp = _this.group['_zudf_' + _this.data.Name];
10868
+ grp.zModel = {};
10869
+ // create as new Form Group
10870
+ _this.form = _this.toFormGroup(_this.data.Value);
10871
+ // set to zGroup scope
10872
+ grp.form = _this.form;
10873
+ }), operators.tap(function () {
10874
+ // set to formField for display
10875
+ _this.formField = _this.data.Value;
10876
+ })).subscribe(function () {
10877
+ // set Field div class
10878
+ i3.ZComponentHelper.setFieldsDivClass(_this.group._projectName, _this.group.fieldName, _this.data, _this.authService);
10879
+ });
10880
+ };
10881
+ ZudfComponent.prototype.loadZudfForm = function () {
10882
+ var _this = this;
10837
10883
  rxjs.of(true).pipe(operators.concatMap(function (fieldElements) {
10838
10884
  var asyncSubject = new rxjs.AsyncSubject();
10839
10885
  _this.fieldService.getFormFieldCode(_this.data.Value, 'FormField', _this, 'fields').pipe(operators.map(function (formFieldResult) {
10840
10886
  // rename add prefix to all udf field to prevent duplicate from main form
10841
- _this.appendPrefix(formFieldResult, 'zudf');
10887
+ _this.appendPrefix(formFieldResult, 'zudf_' + _this.data.Name);
10842
10888
  // change the value to the result field form
10843
10889
  _this.data.Value = formFieldResult;
10844
10890
  // change zudf to zdiv
10845
- _this.data.Type = 'zdiv';
10891
+ //this.data.Type = 'zdiv';
10846
10892
  // end subject
10847
10893
  asyncSubject.next(true);
10848
10894
  asyncSubject.complete();
10849
10895
  })).subscribe();
10850
10896
  return asyncSubject.asObservable();
10851
10897
  }), operators.tap(function () {
10852
- if (!_this.group._zudf) {
10853
- _this.group._zudf = new i3.ZGroup;
10898
+ if (!_this.group['_zudf_' + _this.data.Name]) {
10899
+ _this.group['_zudf_' + _this.data.Name] = new i3.ZGroup;
10854
10900
  }
10855
- _this.group._zudf.zModel = {};
10901
+ var grp = _this.group['_zudf_' + _this.data.Name];
10902
+ grp.zModel = {};
10856
10903
  // create as new Form Group
10857
10904
  _this.form = _this.toFormGroup(_this.data.Value);
10858
10905
  // set to zGroup scope
10859
- _this.group._zudf.form = _this.form;
10906
+ grp.form = _this.form;
10860
10907
  }), operators.tap(function () {
10861
10908
  // set to formField for display
10862
10909
  _this.formField = _this.data.Value;
10863
10910
  })).subscribe(function () {
10864
10911
  // set Field div class
10865
10912
  i3.ZComponentHelper.setFieldsDivClass(_this.group._projectName, _this.group.fieldName, _this.data, _this.authService);
10866
- // get saved record
10867
- _this.getFormFieldzModel();
10913
+ // TODO: get saved record
10914
+ //this.getFormFieldzModel();
10915
+ // change back the data.Value
10916
+ if (_this.data['DisableReplaceValue']) {
10917
+ _this.data.Value = _this.initialDataValue;
10918
+ }
10868
10919
  });
10869
10920
  };
10870
10921
  ZudfComponent.prototype.getFormFieldzModel = function () {
10871
- var form = this.group._zudf.form;
10872
- var zModel = this.group._zudf.zModel;
10922
+ var form = this.group['_zudf_' + this.data.Name].form;
10923
+ var zModel = this.group['_zudf_' + this.data.Name].zModel;
10873
10924
  var url = this.resourceApiService.getURL('field');
10874
10925
  var respData = { 'parentFormId': 5722, 'zudf_Name': 'test' };
10875
10926
  Object.assign(zModel, respData);
@@ -10908,10 +10959,10 @@
10908
10959
  var isRequired = i3.ZComponentHelper.isRequiredFormControl(_this, field);
10909
10960
  if (isFormControl === true) {
10910
10961
  var validators = i3.ZComponentHelper.getValidators(field, isVisible, isRequired);
10911
- formControls[field.Value] = new forms.FormControl(_this.group._zudf.zModel[field.Value], validators);
10962
+ formControls[field.Value] = new forms.FormControl(_this.group['_zudf_' + _this.data.Name].zModel[field.Value], validators);
10912
10963
  if (i3.ZComponentHelper.hasCCField(field.Type)) {
10913
10964
  var ccValidators = i3.ZComponentHelper.getCCValidators(field, isVisible, isRequired);
10914
- formControls[field.CCValue] = new forms.FormControl(_this.group._zudf.zModel[field.CCValue], ccValidators);
10965
+ formControls[field.CCValue] = new forms.FormControl(_this.group['_zudf_' + _this.data.Name].zModel[field.CCValue], ccValidators);
10915
10966
  }
10916
10967
  }
10917
10968
  }
@@ -10936,13 +10987,25 @@
10936
10987
  ZudfComponent.prototype.ComponentIsVisible = function (field) {
10937
10988
  return i3.ZComponentHelper.ComponentIsVisible(field, this.group);
10938
10989
  };
10990
+ ZudfComponent.prototype.appendFormControl = function (zudfControlName, zudfControl, fieldData) {
10991
+ this.form.addControl(zudfControlName, zudfControl);
10992
+ this.formField.push(fieldData);
10993
+ };
10994
+ ZudfComponent.prototype.clearFormControl = function () {
10995
+ var _this = this;
10996
+ this.formField.forEach(function (data) {
10997
+ _this.form.removeControl(data.Value);
10998
+ });
10999
+ this.data.Value = this.initialDataValue;
11000
+ this.formField = [];
11001
+ };
10939
11002
  return ZudfComponent;
10940
11003
  }());
10941
11004
  ZudfComponent.decorators = [
10942
11005
  { type: i0.Component, args: [{
10943
11006
  selector: 'app-zudf',
10944
- 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</div>\r\n",
10945
- styles: ["#div1,#div2{float:left;width:100px;height:35px;margin:10px;padding:10px;border:1px solid #000}"]
11007
+ template: "<div style=\"padding: 15px\" *ngIf=\"data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" class=\"ion-row\">\r\n <kendo-card *ngIf=\"data.Title\" width=\"100%\" >\r\n <kendo-card-header >\r\n <div>\r\n <ion-label class=\"card-header-title\">{{data.Title}}</ion-label>\r\n </div>\r\n </kendo-card-header>\r\n <kendo-card-body>\r\n <div class=\"ion-row\">\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{{data.Name}}-{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n </div>\r\n </kendo-card-body> \r\n </kendo-card>\r\n</div>\r\n\r\n<div *ngIf=\"!data.Title && (!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" class=\"ion-row\">\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{{data.Name}}-{{field.Type}}-{{field.Name}}\">\r\n </app-zformcontrol>\r\n</div>\r\n",
11008
+ styles: [".card-header-title{color:#fff!important;font-weight:500;font-size:11pt}"]
10946
11009
  },] }
10947
11010
  ];
10948
11011
  ZudfComponent.ctorParameters = function () { return [