mmhglobal-dynamicform 1.1.29 → 1.1.33

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,25 @@
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.33`<br/>
7
+ [zupload] - minor fix for selectFileOnly attribute. <br/>
8
+ [zgrid] - added support for filter operator "contains" for .net core. Default as contains, to use ==, zgrid attribute add FilterContainsUsingEqual:true.
9
+
10
+ `1.32`<br/>
11
+ [zgrid] - added getFormControlData function to retrieve incell data. <br/>
12
+ [zgrid] - added AfterloadCallback attribute handling. <br/>
13
+ [zgrid] - fix form control error when grid data is null. <br/>
14
+ [zupload] - save file data to group scope. <br/>
15
+ [zquerybuilder] - bug fix for query builder.
16
+
17
+ `1.31`<br/>
18
+ update dynamicform module for zuploadmodule. <br/>
19
+
20
+ `1.30`<br/>
21
+ [zupload] - support Select/Remove/Change Event. <br/>
22
+ [zupload] - added SelectFileOnly attribute handling, to allow select file without upload. <br/>
23
+ [zupload] - added selected file append to group scope (type+value as name). <br/>
24
+
6
25
  `1.1.29`<br/>
7
26
  [zgrid] - Incelledit support ztime format. <br/>
8
27
  [zgrid] - cleaned the code and the way data been loaded. <br/>
@@ -2397,6 +2397,11 @@
2397
2397
  return "isnull";
2398
2398
  case "isnotnull":
2399
2399
  return "isnotnull";
2400
+ case "contains": {
2401
+ if (!this.field['FilterContainsUsingEqual']) {
2402
+ return "contains";
2403
+ }
2404
+ }
2400
2405
  default:
2401
2406
  return "==";
2402
2407
  // eq, neq, isnull, isnotnull, endswith, startswith
@@ -5537,7 +5542,9 @@
5537
5542
  });
5538
5543
  }
5539
5544
  }
5540
- _this.createFormControls();
5545
+ if (_this.gData) {
5546
+ _this.createFormControls();
5547
+ }
5541
5548
  };
5542
5549
  /* Available Functions */
5543
5550
  this.setEnable = function (status) {
@@ -5628,6 +5635,9 @@
5628
5635
  _this.setGridSessionKey(_this.group);
5629
5636
  }
5630
5637
  return rxjs.of(true);
5638
+ }), operators.tap(function () {
5639
+ _this.gridCallback(_this.group);
5640
+ return rxjs.of(true);
5631
5641
  })).subscribe();
5632
5642
  };
5633
5643
  ZgridComponent.prototype.ngOnDestroy = function () {
@@ -5769,6 +5779,16 @@
5769
5779
  });
5770
5780
  }
5771
5781
  };
5782
+ ZgridComponent.prototype.gridCallback = function (group) {
5783
+ if (this.data['AfterloadCallback']) {
5784
+ var me = Object.assign({}, this);
5785
+ this.group.subject.next({
5786
+ type: "zgrid-AfterloadCallback",
5787
+ target: this.data['AfterloadCallback'],
5788
+ data: me
5789
+ });
5790
+ }
5791
+ };
5772
5792
  ZgridComponent.prototype.getData = function () {
5773
5793
  if (this.zgrid) {
5774
5794
  this.zgrid.getDataBinding();
@@ -6074,6 +6094,9 @@
6074
6094
  var formArray = this.inlineEditedFormGroups.get('items');
6075
6095
  return formArray.at(rowIndex);
6076
6096
  };
6097
+ ZgridComponent.prototype.getFormControlData = function (value) {
6098
+ return this.inlineEditedFormGroups.value.items;
6099
+ };
6077
6100
  /* Event */
6078
6101
  ZgridComponent.prototype.beforeGridGetData = function (group, me) {
6079
6102
  console.warn("beforeDataBinding triggered");
@@ -8125,10 +8148,12 @@
8125
8148
  return this.qbItems[rule.field].options ? this.qbItems[rule.field].options : optionsList;
8126
8149
  };
8127
8150
  ZquerybuilderComponent.prototype.setQueryValue = function (queryValueString) {
8128
- var defaultQueryValueJson = JSON.parse(queryValueString);
8129
- this.queryCtrl = defaultQueryValueJson;
8130
- // default lock the query builder if there default query
8131
- this.completeRule(true, defaultQueryValueJson);
8151
+ if (queryValueString) {
8152
+ var defaultQueryValueJson = toQueryRule(JSON.parse(queryValueString));
8153
+ this.queryCtrl = defaultQueryValueJson;
8154
+ // default lock the query builder if there default query
8155
+ this.completeRule(true, defaultQueryValueJson);
8156
+ }
8132
8157
  };
8133
8158
  return ZquerybuilderComponent;
8134
8159
  }());
@@ -8150,7 +8175,23 @@
8150
8175
  data: [{ type: i0.Input }],
8151
8176
  group: [{ type: i0.Input }],
8152
8177
  form: [{ type: i0.Input }]
8153
- };
8178
+ };
8179
+ function toQueryRule(queryBuilderModel) {
8180
+ var rule = {};
8181
+ if (queryBuilderModel.condition) {
8182
+ rule.condition = queryBuilderModel.condition;
8183
+ rule.rules = queryBuilderModel.rules.map(function (q) { return toQueryRule(q); });
8184
+ }
8185
+ else {
8186
+ rule.field = queryBuilderModel.field;
8187
+ rule.type = queryBuilderModel.type;
8188
+ rule.operator = queryBuilderModel.operator;
8189
+ rule.value = queryBuilderModel.value instanceof Array
8190
+ ? queryBuilderModel.type === 'date' ? new Date(queryBuilderModel.value) : queryBuilderModel.value
8191
+ : [queryBuilderModel.type === 'date' ? new Date(queryBuilderModel.value) : queryBuilderModel.value];
8192
+ }
8193
+ return rule;
8194
+ }
8154
8195
 
8155
8196
  /********** Angular **********/
8156
8197
  var ZreportComponent = /** @class */ (function () {
@@ -10620,7 +10661,6 @@
10620
10661
  form: [{ type: i0.Input }]
10621
10662
  };
10622
10663
 
10623
- /********** Angular **********/
10624
10664
  var MyFileInfo = /** @class */ (function () {
10625
10665
  function MyFileInfo() {
10626
10666
  }
@@ -10662,6 +10702,7 @@
10662
10702
  this.imagePreviews = [];
10663
10703
  this.uid = [];
10664
10704
  this.showFileList = true;
10705
+ this.fileList = [];
10665
10706
  this.restrictions = {
10666
10707
  allowedExtensions: [
10667
10708
  "jpg",
@@ -10838,49 +10879,115 @@
10838
10879
  };
10839
10880
  ZuploadComponent.prototype.onRemove = function (e) {
10840
10881
  var _this = this;
10841
- var myFile = e.files[0];
10842
- // console.log('remove done: ', e);
10843
- e.data = {
10844
- id: myFile.myUid,
10845
- };
10846
- e.headers = e.headers.append("Authorization", "Bearer " + this.authService.e1AccessToken);
10847
- if (this.data.EnableImagePreview) {
10848
- e.files.forEach(function (file) {
10849
- _this.imagePreviews = _this.imagePreviews.filter(function (f) { return f.uid !== file.uid; });
10882
+ // remove file from component memory
10883
+ var index = this.fileList.findIndex(function (item) { return item.uid === e.files[0].uid; });
10884
+ if (index >= 0) {
10885
+ this.fileList.splice(index, 1);
10886
+ this.group['zupload_' + this.data.Value] = this.fileList;
10887
+ }
10888
+ if (this.data['FileRemovedEvent']) {
10889
+ this.group.subject.next({
10890
+ type: "zupload-fileRemovedEvent",
10891
+ target: this.data['FileRemovedEvent'],
10892
+ data: e
10893
+ });
10894
+ }
10895
+ else {
10896
+ var myFile = e.files[0];
10897
+ // console.log('remove done: ', e);
10898
+ e.data = {
10899
+ id: myFile.myUid,
10900
+ };
10901
+ e.headers = e.headers.append("Authorization", "Bearer " + this.authService.e1AccessToken);
10902
+ if (this.data.EnableImagePreview) {
10903
+ e.files.forEach(function (file) {
10904
+ _this.imagePreviews = _this.imagePreviews.filter(function (f) { return f.uid !== file.uid; });
10905
+ });
10906
+ }
10907
+ }
10908
+ };
10909
+ ZuploadComponent.prototype.onChange = function (file) {
10910
+ if (this.data['FileChangedEvent']) {
10911
+ this.group.subject.next({
10912
+ type: "zupload-fileChangedEvent",
10913
+ target: this.data['FileChangedEvent'],
10914
+ data: file
10850
10915
  });
10851
10916
  }
10852
10917
  };
10853
10918
  ZuploadComponent.prototype.selectEventHandler = function (e) {
10854
10919
  var _this = this;
10855
10920
  var me = this;
10856
- // Only workable for Auto Upload = false
10857
- if (!this.data.AutoUpload) {
10858
- // Compression for image file
10859
- var imageCompressionEnabled = this.data.Compression ? true : false;
10860
- //Check if Image Compression is enabled.
10861
- if (imageCompressionEnabled === true) {
10862
- e.files.forEach(function (file) {
10863
- // Compress only if it is an image file
10864
- if (file.rawFile && file.rawFile.type.includes("image")) {
10865
- if (!file.validationErrors) {
10866
- var imgConfig = _this.compressionConfigHandler(_this.data.Compression);
10867
- if (file.size > imgConfig.FileSizeMinSizeByte) {
10868
- me.compressImage.compress(file.rawFile, imgConfig) //Pass in parameter to set the Compression Options
10869
- .pipe(operators.take(1))
10870
- .subscribe(function (compressFile) {
10871
- _this.ngZone.run(function () {
10872
- file.rawFile = compressFile;
10873
- file.size = compressFile.size;
10874
- var reader = new FileReader();
10875
- reader.readAsDataURL(file.rawFile);
10921
+ if (this.data['SelectFileOnly']) {
10922
+ // append all file to component memory
10923
+ e.files.forEach(function (file) { return __awaiter(_this, void 0, void 0, function () {
10924
+ var reader;
10925
+ return __generator(this, function (_a) {
10926
+ switch (_a.label) {
10927
+ case 0:
10928
+ if (!file.rawFile) return [3 /*break*/, 2];
10929
+ reader = new FileReader();
10930
+ reader.onload = function (ev) {
10931
+ // clone the data and also add the readed file to the object
10932
+ var fileData = Object.assign({}, file);
10933
+ fileData['file'] = ev.target["result"];
10934
+ // push to component fileList
10935
+ me.fileList.push(fileData);
10936
+ me.group['zupload_' + me.data.Value] = me.fileList;
10937
+ if (me.data['FileSelectedEvent']) {
10938
+ // call the project event
10939
+ me.group.subject.next({
10940
+ type: "zupload-fileSelectedEvent",
10941
+ target: me.data['FileSelectedEvent'],
10942
+ data: me.fileList
10876
10943
  });
10877
- console.log("Compressed file size: " + (file.rawFile.size / 1024).toFixed(2) + "KB");
10878
- });
10879
- } // file size check
10880
- } // validationErrors check
10881
- } // file type check
10882
- }); // loop each file
10883
- } // imagecompression check
10944
+ }
10945
+ };
10946
+ return [4 /*yield*/, reader.readAsDataURL(file.rawFile)];
10947
+ case 1:
10948
+ _a.sent();
10949
+ _a.label = 2;
10950
+ case 2: return [2 /*return*/];
10951
+ }
10952
+ });
10953
+ }); });
10954
+ }
10955
+ else {
10956
+ // Only workable for Auto Upload = false
10957
+ if (!this.data.AutoUpload) {
10958
+ // Compression for image file
10959
+ var imageCompressionEnabled = this.data.Compression ? true : false;
10960
+ //Check if Image Compression is enabled.
10961
+ if (imageCompressionEnabled === true) {
10962
+ e.files.forEach(function (file) {
10963
+ // Compress only if it is an image file
10964
+ if (file.rawFile && file.rawFile.type.includes("image")) {
10965
+ if (!file.validationErrors) {
10966
+ var imgConfig = _this.compressionConfigHandler(_this.data.Compression);
10967
+ if (file.size > imgConfig.FileSizeMinSizeByte) {
10968
+ me.compressImage.compress(file.rawFile, imgConfig) //Pass in parameter to set the Compression Options
10969
+ .pipe(operators.take(1))
10970
+ .subscribe(function (compressFile) {
10971
+ _this.ngZone.run(function () {
10972
+ file.rawFile = compressFile;
10973
+ file.size = compressFile.size;
10974
+ // clone the data and also add the readed file to the object
10975
+ var fileData = Object.assign({}, file);
10976
+ // push to component fileList
10977
+ me.fileList.push(fileData);
10978
+ var reader = new FileReader();
10979
+ reader.readAsDataURL(file.rawFile);
10980
+ });
10981
+ console.log("Compressed file size: " + (file.rawFile.size / 1024).toFixed(2) + "KB");
10982
+ });
10983
+ } // file size check
10984
+ } // validationErrors check
10985
+ } // file type check
10986
+ }); // loop each file
10987
+ } // imagecompression check
10988
+ // add to group scope
10989
+ me.group['zupload_' + me.data.Value] = e.files;
10990
+ }
10884
10991
  }
10885
10992
  };
10886
10993
  return ZuploadComponent;
@@ -10888,7 +10995,7 @@
10888
10995
  ZuploadComponent.decorators = [
10889
10996
  { type: i0.Component, args: [{
10890
10997
  selector: "app-zupload",
10891
- template: "<ion-item [formGroup]=\"form\" *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" [ngClass]=\"getIon_InvalidClass(form, data)\" style=\"margin-left: -15px;\">\r\n <ion-label [attr.for]=\"data.Value\" *ngIf=\"data.ShowLabel === undefined || data.ShowLabel\" position=\"stacked\" style=\"margin-bottom: 10px;\">\r\n {{data.Label}} <ion-text *ngIf=\"(!!componentProperties.isRequiredField ? group[componentProperties.isRequiredField] : componentProperties.isRequired)\" color=\"danger\">*</ion-text>\r\n </ion-label>\r\n <div class=\"ion-row\" style=\"justify-content: space-between; width: 100%\">\r\n <span style=\"flex: 1;\">\r\n <kendo-upload [autoUpload]=\"isAutoUpload\"\r\n [saveUrl]=\"uploadSaveUrl\"\r\n [removeUrl]=\"uploadRemoveUrl\"\r\n [restrictions]=\"restrictions\"\r\n [formControlName]=\"data.Value\"\r\n [multiple]=\"isMultiple\"\r\n [chunkable]=\"chunkSettings\"\r\n [showFileList]=\"showFileList\"\r\n (select)=\"selectEventHandler($event)\"\r\n (remove)=\"onRemove($event)\"\r\n (success)=\"onSuccess($event)\"\r\n (upload)=\"uploadEventHandler($event)\">\r\n </kendo-upload>\r\n </span>\r\n </div>\r\n</ion-item>\r\n<br />\r\n<!--<div class=\"wrap\" *ngIf=\"data.EnableCompression\">\r\n <ion-label>Enable Compression: </ion-label>\r\n <ion-checkbox style=\"margin: -5px 0;\" color=\"primary\" (ionChange)=\"toogleEnableCompression($event)\"></ion-checkbox>\r\n</div>-->\r\n<ion-label *ngIf=\"imagePreviews.length\" position=\"stacked\">\r\n Image Preview:\r\n</ion-label>\r\n<div *ngIf=\"imagePreviews.length\" >\r\n <img *ngFor=\"let image of imagePreviews\"\r\n [src]=\"image.src\"\r\n alt=\"image preview\"\r\n height=\"100\"\r\n style=\"margin: 5px; border: 1px solid gray;\"/>\r\n</div>\r\n ",
10998
+ template: "<ion-item [formGroup]=\"form\" *ngIf=\"(!!componentProperties.isVisibleField ? group[componentProperties.isVisibleField] : componentProperties.isVisible)\" [ngClass]=\"getIon_InvalidClass(form, data)\" style=\"margin-left: -15px;\">\r\n <ion-label [attr.for]=\"data.Value\" *ngIf=\"data.ShowLabel === undefined || data.ShowLabel\" position=\"stacked\" style=\"margin-bottom: 10px;\">\r\n {{data.Label}} <ion-text *ngIf=\"(!!componentProperties.isRequiredField ? group[componentProperties.isRequiredField] : componentProperties.isRequired)\" color=\"danger\">*</ion-text>\r\n </ion-label>\r\n <div class=\"ion-row\" style=\"justify-content: space-between; width: 100%\">\r\n <span style=\"flex: 1;\">\r\n <kendo-upload *ngIf=\"!data.SelectFileOnly\"\r\n [autoUpload]=\"isAutoUpload\"\r\n [saveUrl]=\"uploadSaveUrl\"\r\n [removeUrl]=\"uploadRemoveUrl\"\r\n [restrictions]=\"restrictions\"\r\n [formControlName]=\"data.Value\"\r\n [multiple]=\"isMultiple\"\r\n [chunkable]=\"chunkSettings\"\r\n [showFileList]=\"showFileList\"\r\n (select)=\"selectEventHandler($event)\"\r\n (remove)=\"onRemove($event)\"\r\n (success)=\"onSuccess($event)\"\r\n (upload)=\"uploadEventHandler($event)\">\r\n </kendo-upload>\r\n\r\n <kendo-fileselect *ngIf=\"data.SelectFileOnly\"\r\n (select)=\"selectEventHandler($event)\"\r\n (remove)=\"onRemove($event)\"\r\n (valueChange)=\"onChange($event)\"\r\n [restrictions]=\"restrictions\" >\r\n </kendo-fileselect>\r\n </span>\r\n </div>\r\n</ion-item>\r\n<br />\r\n<!--<div class=\"wrap\" *ngIf=\"data.EnableCompression\">\r\n <ion-label>Enable Compression: </ion-label>\r\n <ion-checkbox style=\"margin: -5px 0;\" color=\"primary\" (ionChange)=\"toogleEnableCompression($event)\"></ion-checkbox>\r\n</div>-->\r\n<ion-label *ngIf=\"imagePreviews.length\" position=\"stacked\">\r\n Image Preview:\r\n</ion-label>\r\n<div *ngIf=\"imagePreviews.length\" >\r\n <img *ngFor=\"let image of imagePreviews\"\r\n [src]=\"image.src\"\r\n alt=\"image preview\"\r\n height=\"100\"\r\n style=\"margin: 5px; border: 1px solid gray;\"/>\r\n</div>\r\n",
10892
10999
  styles: [""]
10893
11000
  },] }
10894
11001
  ];
@@ -11394,6 +11501,7 @@
11394
11501
  kendoAngularTreeview.TreeViewModule,
11395
11502
  kendoAngularTooltip.TooltipModule,
11396
11503
  kendoAngularUpload.UploadModule,
11504
+ kendoAngularUpload.UploadsModule,
11397
11505
  i3.ZCoreModule,
11398
11506
  i4.MmhglobalZmodalModule
11399
11507
  ],
@@ -11581,6 +11689,7 @@
11581
11689
  exports.ZuploadComponent = ZuploadComponent;
11582
11690
  exports.ZworkflowbuttonsComponent = ZworkflowbuttonsComponent;
11583
11691
  exports.refreshGrid = refreshGrid;
11692
+ exports.toQueryRule = toQueryRule;
11584
11693
  exports.ɵa = ZComponentDebugService;
11585
11694
  exports.ɵb = ZGridCalendarBindingDirective;
11586
11695
  exports.ɵc = ZComponentService;