mmhglobal-dynamicform 1.1.29 → 1.1.30
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 +5 -0
- package/bundles/mmhglobal-dynamicform.umd.js +102 -38
- 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/zupload/zupload.component.js +95 -38
- package/fesm2015/mmhglobal-dynamicform.js +93 -38
- package/fesm2015/mmhglobal-dynamicform.js.map +1 -1
- package/lib/zupload/zupload.component.d.ts +2 -0
- package/mmhglobal-dynamicform.metadata.json +1 -1
- package/package.json +1 -1
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.30`<br/>
|
|
7
|
+
[zupload] - support Select/Remove/Change Event. <br/>
|
|
8
|
+
[zupload] - added SelectFileOnly attribute handling, to allow select file without upload. <br/>
|
|
9
|
+
[zupload] - added selected file append to group scope (type+value as name). <br/>
|
|
10
|
+
|
|
6
11
|
`1.1.29`<br/>
|
|
7
12
|
[zgrid] - Incelledit support ztime format. <br/>
|
|
8
13
|
[zgrid] - cleaned the code and the way data been loaded. <br/>
|
|
@@ -10620,7 +10620,6 @@
|
|
|
10620
10620
|
form: [{ type: i0.Input }]
|
|
10621
10621
|
};
|
|
10622
10622
|
|
|
10623
|
-
/********** Angular **********/
|
|
10624
10623
|
var MyFileInfo = /** @class */ (function () {
|
|
10625
10624
|
function MyFileInfo() {
|
|
10626
10625
|
}
|
|
@@ -10662,6 +10661,7 @@
|
|
|
10662
10661
|
this.imagePreviews = [];
|
|
10663
10662
|
this.uid = [];
|
|
10664
10663
|
this.showFileList = true;
|
|
10664
|
+
this.fileList = [];
|
|
10665
10665
|
this.restrictions = {
|
|
10666
10666
|
allowedExtensions: [
|
|
10667
10667
|
"jpg",
|
|
@@ -10838,49 +10838,113 @@
|
|
|
10838
10838
|
};
|
|
10839
10839
|
ZuploadComponent.prototype.onRemove = function (e) {
|
|
10840
10840
|
var _this = this;
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
if (this.data
|
|
10848
|
-
|
|
10849
|
-
|
|
10841
|
+
// remove file from component memory
|
|
10842
|
+
var index = this.fileList.findIndex(function (item) { return item.uid === e.files[0].uid; });
|
|
10843
|
+
if (index >= 0) {
|
|
10844
|
+
this.fileList.splice(index, 1);
|
|
10845
|
+
this.group['zupload_' + this.data.Value] = this.fileList;
|
|
10846
|
+
}
|
|
10847
|
+
if (this.data['FileRemovedEvent']) {
|
|
10848
|
+
this.group.subject.next({
|
|
10849
|
+
type: "zupload-fileRemovedEvent",
|
|
10850
|
+
target: this.data['FileRemovedEvent'],
|
|
10851
|
+
data: e
|
|
10852
|
+
});
|
|
10853
|
+
}
|
|
10854
|
+
else {
|
|
10855
|
+
var myFile = e.files[0];
|
|
10856
|
+
// console.log('remove done: ', e);
|
|
10857
|
+
e.data = {
|
|
10858
|
+
id: myFile.myUid,
|
|
10859
|
+
};
|
|
10860
|
+
e.headers = e.headers.append("Authorization", "Bearer " + this.authService.e1AccessToken);
|
|
10861
|
+
if (this.data.EnableImagePreview) {
|
|
10862
|
+
e.files.forEach(function (file) {
|
|
10863
|
+
_this.imagePreviews = _this.imagePreviews.filter(function (f) { return f.uid !== file.uid; });
|
|
10864
|
+
});
|
|
10865
|
+
}
|
|
10866
|
+
}
|
|
10867
|
+
};
|
|
10868
|
+
ZuploadComponent.prototype.onChange = function (file) {
|
|
10869
|
+
if (this.data['FileChangedEvent']) {
|
|
10870
|
+
this.group.subject.next({
|
|
10871
|
+
type: "zupload-fileChangedEvent",
|
|
10872
|
+
target: this.data['FileChangedEvent'],
|
|
10873
|
+
data: file
|
|
10850
10874
|
});
|
|
10851
10875
|
}
|
|
10852
10876
|
};
|
|
10853
10877
|
ZuploadComponent.prototype.selectEventHandler = function (e) {
|
|
10854
10878
|
var _this = this;
|
|
10855
10879
|
var me = this;
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10880
|
+
if (this.data['FileSelectedEvent']) {
|
|
10881
|
+
// append all file to component memory
|
|
10882
|
+
e.files.forEach(function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
10883
|
+
var reader;
|
|
10884
|
+
return __generator(this, function (_a) {
|
|
10885
|
+
switch (_a.label) {
|
|
10886
|
+
case 0:
|
|
10887
|
+
if (!file.rawFile) return [3 /*break*/, 2];
|
|
10888
|
+
reader = new FileReader();
|
|
10889
|
+
reader.onload = function (ev) {
|
|
10890
|
+
// clone the data and also add the readed file to the object
|
|
10891
|
+
var fileData = Object.assign({}, file);
|
|
10892
|
+
fileData['file'] = ev.target["result"];
|
|
10893
|
+
// push to component fileList
|
|
10894
|
+
me.fileList.push(fileData);
|
|
10895
|
+
me.group['zupload_' + me.data.Value] = me.fileList;
|
|
10896
|
+
if (me.data['FileSelectedEvent']) {
|
|
10897
|
+
// call the project event
|
|
10898
|
+
me.group.subject.next({
|
|
10899
|
+
type: "zupload-fileSelectedEvent",
|
|
10900
|
+
target: me.data['FileSelectedEvent'],
|
|
10901
|
+
data: me.fileList
|
|
10876
10902
|
});
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10903
|
+
}
|
|
10904
|
+
};
|
|
10905
|
+
return [4 /*yield*/, reader.readAsDataURL(file.rawFile)];
|
|
10906
|
+
case 1:
|
|
10907
|
+
_a.sent();
|
|
10908
|
+
_a.label = 2;
|
|
10909
|
+
case 2: return [2 /*return*/];
|
|
10910
|
+
}
|
|
10911
|
+
});
|
|
10912
|
+
}); });
|
|
10913
|
+
}
|
|
10914
|
+
else {
|
|
10915
|
+
// Only workable for Auto Upload = false
|
|
10916
|
+
if (!this.data.AutoUpload) {
|
|
10917
|
+
// Compression for image file
|
|
10918
|
+
var imageCompressionEnabled = this.data.Compression ? true : false;
|
|
10919
|
+
//Check if Image Compression is enabled.
|
|
10920
|
+
if (imageCompressionEnabled === true) {
|
|
10921
|
+
e.files.forEach(function (file) {
|
|
10922
|
+
// Compress only if it is an image file
|
|
10923
|
+
if (file.rawFile && file.rawFile.type.includes("image")) {
|
|
10924
|
+
if (!file.validationErrors) {
|
|
10925
|
+
var imgConfig = _this.compressionConfigHandler(_this.data.Compression);
|
|
10926
|
+
if (file.size > imgConfig.FileSizeMinSizeByte) {
|
|
10927
|
+
me.compressImage.compress(file.rawFile, imgConfig) //Pass in parameter to set the Compression Options
|
|
10928
|
+
.pipe(operators.take(1))
|
|
10929
|
+
.subscribe(function (compressFile) {
|
|
10930
|
+
_this.ngZone.run(function () {
|
|
10931
|
+
file.rawFile = compressFile;
|
|
10932
|
+
file.size = compressFile.size;
|
|
10933
|
+
// clone the data and also add the readed file to the object
|
|
10934
|
+
var fileData = Object.assign({}, file);
|
|
10935
|
+
// push to component fileList
|
|
10936
|
+
me.fileList.push(fileData);
|
|
10937
|
+
var reader = new FileReader();
|
|
10938
|
+
reader.readAsDataURL(file.rawFile);
|
|
10939
|
+
});
|
|
10940
|
+
console.log("Compressed file size: " + (file.rawFile.size / 1024).toFixed(2) + "KB");
|
|
10941
|
+
});
|
|
10942
|
+
} // file size check
|
|
10943
|
+
} // validationErrors check
|
|
10944
|
+
} // file type check
|
|
10945
|
+
}); // loop each file
|
|
10946
|
+
} // imagecompression check
|
|
10947
|
+
}
|
|
10884
10948
|
}
|
|
10885
10949
|
};
|
|
10886
10950
|
return ZuploadComponent;
|
|
@@ -10888,7 +10952,7 @@
|
|
|
10888
10952
|
ZuploadComponent.decorators = [
|
|
10889
10953
|
{ type: i0.Component, args: [{
|
|
10890
10954
|
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
|
|
10955
|
+
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
10956
|
styles: [""]
|
|
10893
10957
|
},] }
|
|
10894
10958
|
];
|