@seniorsistemas/angular-components 15.0.0 → 15.0.2
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/seniorsistemas-angular-components.umd.js +73 -65
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/file-upload/file-upload.component.d.ts +17 -33
- package/components/file-upload/index.d.ts +3 -2
- package/components/file-upload/models/file-dto.d.ts +11 -0
- package/components/file-upload/models/index.d.ts +2 -0
- package/components/file-upload/models/validate-errors.d.ts +4 -0
- package/components/token-list/index.d.ts +3 -2
- package/components/token-list/models/index.d.ts +1 -0
- package/components/token-list/models/token.d.ts +5 -0
- package/components/token-list/token-list.component.d.ts +1 -4
- package/esm2015/components/file-upload/file-upload.component.js +49 -63
- package/esm2015/components/file-upload/file-upload.module.js +7 -2
- package/esm2015/components/file-upload/index.js +4 -3
- package/esm2015/components/file-upload/models/file-dto.js +1 -0
- package/esm2015/components/file-upload/models/index.js +2 -0
- package/esm2015/components/file-upload/models/validate-errors.js +6 -0
- package/esm2015/components/token-list/index.js +3 -3
- package/esm2015/components/token-list/models/index.js +1 -0
- package/esm2015/components/token-list/models/token.js +1 -0
- package/esm2015/components/token-list/token-list.component.js +2 -2
- package/esm5/components/file-upload/file-upload.component.js +65 -67
- package/esm5/components/file-upload/file-upload.module.js +7 -2
- package/esm5/components/file-upload/index.js +4 -3
- package/esm5/components/file-upload/models/file-dto.js +1 -0
- package/esm5/components/file-upload/models/index.js +2 -0
- package/esm5/components/file-upload/models/validate-errors.js +6 -0
- package/esm5/components/token-list/index.js +3 -3
- package/esm5/components/token-list/models/index.js +1 -0
- package/esm5/components/token-list/models/token.js +1 -0
- package/esm5/components/token-list/token-list.component.js +2 -2
- package/fesm2015/seniorsistemas-angular-components.js +58 -62
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +73 -65
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -2702,6 +2702,12 @@ var EmptyStateModule = /** @class */ (function () {
|
|
|
2702
2702
|
return EmptyStateModule;
|
|
2703
2703
|
}());
|
|
2704
2704
|
|
|
2705
|
+
var ValidateErrors;
|
|
2706
|
+
(function (ValidateErrors) {
|
|
2707
|
+
ValidateErrors["MAX_FILE_SIZE"] = "MAX_FILE_SIZE";
|
|
2708
|
+
ValidateErrors["MAX_FILE_LIMIT"] = "MAX_FILE_LIMIT";
|
|
2709
|
+
})(ValidateErrors || (ValidateErrors = {}));
|
|
2710
|
+
|
|
2705
2711
|
var Breakpoints = {
|
|
2706
2712
|
SM_MIN: 0,
|
|
2707
2713
|
SM_MAX: 767,
|
|
@@ -2808,14 +2814,10 @@ var ExportUtils = /** @class */ (function () {
|
|
|
2808
2814
|
return ExportUtils;
|
|
2809
2815
|
}());
|
|
2810
2816
|
|
|
2811
|
-
var ValidateErrors;
|
|
2812
|
-
(function (ValidateErrors) {
|
|
2813
|
-
ValidateErrors["MAX_FILE_SIZE"] = "MAX_FILE_SIZE";
|
|
2814
|
-
ValidateErrors["MAX_FILE_LIMIT"] = "MAX_FILE_LIMIT";
|
|
2815
|
-
})(ValidateErrors || (ValidateErrors = {}));
|
|
2816
2817
|
var FileUploadComponent = /** @class */ (function () {
|
|
2817
2818
|
function FileUploadComponent(sanitizer) {
|
|
2818
2819
|
this.sanitizer = sanitizer;
|
|
2820
|
+
this.inputValue = "";
|
|
2819
2821
|
this.id = "s-file-upload-" + FileUploadComponent_1.nextId++;
|
|
2820
2822
|
this.chooseLabel = "Anexar arquivos";
|
|
2821
2823
|
this.removeLabel = "Remover";
|
|
@@ -2828,12 +2830,10 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
2828
2830
|
this.cancelUpload = new EventEmitter();
|
|
2829
2831
|
this.downloadFile = new EventEmitter();
|
|
2830
2832
|
this.validateErros = new EventEmitter();
|
|
2831
|
-
this.uploadedFileCount = 0;
|
|
2832
2833
|
this._files = [];
|
|
2833
2834
|
this.ngUsubscribe = new Subject();
|
|
2834
2835
|
}
|
|
2835
2836
|
FileUploadComponent_1 = FileUploadComponent;
|
|
2836
|
-
FileUploadComponent.prototype.ngOnInit = function () { };
|
|
2837
2837
|
FileUploadComponent.prototype.ngOnDestroy = function () {
|
|
2838
2838
|
this.ngUsubscribe.next();
|
|
2839
2839
|
this.ngUsubscribe.complete();
|
|
@@ -2844,91 +2844,94 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
2844
2844
|
FileUploadComponent.prototype.onResize = function () {
|
|
2845
2845
|
this.update();
|
|
2846
2846
|
};
|
|
2847
|
-
FileUploadComponent.prototype.update = function () {
|
|
2848
|
-
var windowWidth = window.innerWidth;
|
|
2849
|
-
this.isSmallDevice = windowWidth <= Breakpoints.SM_MAX;
|
|
2850
|
-
};
|
|
2851
2847
|
FileUploadComponent.prototype.onFileSelect = function (files) {
|
|
2852
|
-
var
|
|
2848
|
+
var e_1, _a;
|
|
2849
|
+
var newFiles = [];
|
|
2853
2850
|
if (!this.multiple) {
|
|
2854
2851
|
this.files = [];
|
|
2855
2852
|
}
|
|
2856
|
-
if (this.
|
|
2857
|
-
this.
|
|
2858
|
-
|
|
2859
|
-
this.uploadedFileCount -= this.files.length;
|
|
2860
|
-
this.validateErros.emit(ValidateErrors.MAX_FILE_LIMIT);
|
|
2861
|
-
return;
|
|
2862
|
-
}
|
|
2853
|
+
if (this.isFileLimitExceeded(files)) {
|
|
2854
|
+
this.validateErros.emit(ValidateErrors.MAX_FILE_LIMIT);
|
|
2855
|
+
return;
|
|
2863
2856
|
}
|
|
2864
|
-
|
|
2865
|
-
var
|
|
2866
|
-
|
|
2867
|
-
this.
|
|
2868
|
-
|
|
2869
|
-
|
|
2857
|
+
try {
|
|
2858
|
+
for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
|
|
2859
|
+
var file = files_1_1.value;
|
|
2860
|
+
if (this.isFileSizeExceeded(file)) {
|
|
2861
|
+
this.validateErros.emit(ValidateErrors.MAX_FILE_SIZE);
|
|
2862
|
+
return;
|
|
2863
|
+
}
|
|
2864
|
+
newFiles.push(file);
|
|
2870
2865
|
}
|
|
2871
|
-
|
|
2872
|
-
|
|
2866
|
+
}
|
|
2867
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2868
|
+
finally {
|
|
2869
|
+
try {
|
|
2870
|
+
if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
|
|
2873
2871
|
}
|
|
2872
|
+
finally { if (e_1) throw e_1.error; }
|
|
2874
2873
|
}
|
|
2875
|
-
if (
|
|
2876
|
-
this.
|
|
2874
|
+
if (newFiles.length) {
|
|
2875
|
+
this.files = this.files.concat(newFiles);
|
|
2876
|
+
this.uploadHandler.emit({
|
|
2877
|
+
files: newFiles,
|
|
2878
|
+
});
|
|
2877
2879
|
this.inputUpload.nativeElement.value = "";
|
|
2878
2880
|
}
|
|
2879
2881
|
};
|
|
2880
|
-
FileUploadComponent.prototype.onRemoveFile = function (
|
|
2881
|
-
this.files.
|
|
2882
|
-
this.
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
FileUploadComponent.prototype.onCancelUpload = function (event, index) {
|
|
2887
|
-
this.uploadedFileCount -= 1;
|
|
2888
|
-
this.files.splice(index, 1);
|
|
2889
|
-
this.cancelUpload.emit(index);
|
|
2890
|
-
event.preventDefault();
|
|
2882
|
+
FileUploadComponent.prototype.onRemoveFile = function (file) {
|
|
2883
|
+
var fileIndex = this.files.indexOf(file);
|
|
2884
|
+
var removedFiles = this.files.splice(fileIndex, 1);
|
|
2885
|
+
if (removedFiles.length) {
|
|
2886
|
+
this.removeFile.emit({ file: file });
|
|
2887
|
+
}
|
|
2891
2888
|
};
|
|
2892
|
-
FileUploadComponent.prototype.
|
|
2893
|
-
this.
|
|
2894
|
-
|
|
2889
|
+
FileUploadComponent.prototype.onCancelUpload = function (index) {
|
|
2890
|
+
var removedFiles = this.files.splice(index, 1);
|
|
2891
|
+
if (removedFiles.length) {
|
|
2892
|
+
this.cancelUpload.emit(index);
|
|
2893
|
+
}
|
|
2895
2894
|
};
|
|
2896
|
-
FileUploadComponent.prototype.
|
|
2897
|
-
|
|
2895
|
+
FileUploadComponent.prototype.onDowloadFile = function (index) {
|
|
2896
|
+
this.downloadFile.emit({
|
|
2897
|
+
index: index,
|
|
2898
|
+
anchor: this.anchor,
|
|
2899
|
+
});
|
|
2898
2900
|
};
|
|
2899
2901
|
Object.defineProperty(FileUploadComponent.prototype, "files", {
|
|
2900
2902
|
get: function () {
|
|
2901
2903
|
return this._files;
|
|
2902
2904
|
},
|
|
2903
2905
|
set: function (files) {
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
file.objectURL = this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(files[i]));
|
|
2906
|
+
var _this = this;
|
|
2907
|
+
this._files = files.map(function (file) {
|
|
2908
|
+
if (_this.isImage(file)) {
|
|
2909
|
+
file.objectURL = _this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(file));
|
|
2909
2910
|
}
|
|
2910
|
-
|
|
2911
|
-
}
|
|
2911
|
+
return file;
|
|
2912
|
+
});
|
|
2912
2913
|
},
|
|
2913
2914
|
enumerable: true,
|
|
2914
2915
|
configurable: true
|
|
2915
2916
|
});
|
|
2916
|
-
FileUploadComponent.prototype.
|
|
2917
|
-
|
|
2917
|
+
FileUploadComponent.prototype.update = function () {
|
|
2918
|
+
var windowWidth = window.innerWidth;
|
|
2919
|
+
this.isSmallDevice = windowWidth <= Breakpoints.SM_MAX;
|
|
2918
2920
|
};
|
|
2919
2921
|
FileUploadComponent.prototype.isImage = function (file) {
|
|
2920
2922
|
return /^image\//.test(file.type);
|
|
2921
2923
|
};
|
|
2922
|
-
FileUploadComponent.prototype.
|
|
2923
|
-
this.
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
FileUploadComponent.prototype.isFileLimitExceeded = function () {
|
|
2928
|
-
return this.fileLimit && this.fileLimit < this.files.length + this.uploadedFileCount;
|
|
2924
|
+
FileUploadComponent.prototype.isFileLimitExceeded = function (files) {
|
|
2925
|
+
if (!this.fileLimit) {
|
|
2926
|
+
return false;
|
|
2927
|
+
}
|
|
2928
|
+
return this.files.length + files.length > this.fileLimit;
|
|
2929
2929
|
};
|
|
2930
2930
|
FileUploadComponent.prototype.isFileSizeExceeded = function (file) {
|
|
2931
|
-
|
|
2931
|
+
if (!this.maxFileSize) {
|
|
2932
|
+
return false;
|
|
2933
|
+
}
|
|
2934
|
+
return file.size > this.maxFileSize;
|
|
2932
2935
|
};
|
|
2933
2936
|
var FileUploadComponent_1;
|
|
2934
2937
|
FileUploadComponent.nextId = 0;
|
|
@@ -3013,7 +3016,7 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
3013
3016
|
FileUploadComponent = FileUploadComponent_1 = __decorate([
|
|
3014
3017
|
Component({
|
|
3015
3018
|
selector: "s-file-upload",
|
|
3016
|
-
template: "<div
|
|
3019
|
+
template: "<div\n [id]=\"id\"\n class=\"s-fileupload\">\n <div class=\"s-fileupload-choose\">\n <input\n #inputUpload\n [id]=\"id+'input-upload'\"\n type=\"file\"\n name=\"file\"\n [accept]=\"accept\"\n [multiple]=\"multiple\"\n (change)=\"onFileSelect($event.dataTransfer\n ? $event.dataTransfer.files\n : $event.target.files)\"> \n <s-button\n [id]=\"id + 'upload-button'\"\n [label]=\"chooseLabel\"\n (onClick)=\"inputUpload.click()\"\n priority=\"primary\"\n [disabled]=\"disabled || !!formGroup?.disabled\"\n [auxiliary]=\"false\">\n </s-button>\n </div>\n\n <section\n *ngIf=\"files.length\" \n [id]=\"id + 'fileupload-list'\"\n class=\"s-fileupload-list\"\n role=\"grid\">\n <ng-container *ngFor=\"let file of files; let i = index\">\n <div\n class=\"s-fileupload-list-file\"\n role=\"row\">\n <div\n [id]=\"id + '-file-' + i + '-name'\"\n class=\"s-fileupload-list-file-name\"\n role=\"gridcell\">\n <ng-container *ngTemplateOutlet=\"file.savedFile || file.progress === 100\n ? descriptionUrl\n : description; context: {\n $implicit: file,\n index: i\n }\">\n </ng-container>\n </div>\n <div\n class=\"s-fileupload-list-file-status\"\n role=\"gridcell\">\n <p-progressBar\n *ngIf=\"file.isUploading && !isSmallDevice\"\n [style]=\"{ 'width': '250px', 'background-color': '#d8d8d8', 'border-radius': '0px', 'height': '14px'}\"\n [value]=\"file.progress\"\n [showValue]=\"false\"\n role=\"alert\"\n [attr.aria-label]=\"ariaLabelProgress\">\n </p-progressBar>\n <span\n *ngIf=\"file.isUploading && isSmallDevice\" \n [id]=\"id + '-file-' + i + '-spin'\"\n class=\"fas fa-circle-notch fa-spin\"\n [attr.aria-label]=\"ariaLabelProgress\">\n </span>\n <span\n *ngIf=\"!file.isUploading && !file.error && file.progress === 100\"\n [id]=\"id + '-file-' + i + '-check'\"\n class=\"fas fa-check\"\n role=\"alert\"\n [attr.aria-label]=\"ariaLabelSuccess || successTooltip\"\n [pTooltip]=\"successTooltip\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n [appendTo]=\"'body'\">\n </span>\n <span\n *ngIf=\"file.error?.message\" \n [id]=\"id + '-file-' + i + '-error'\"\n class=\"fas fa-times\"\n role=\"alert\"\n [pTooltip]=\"file.error?.message\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n [appendTo]=\"'body'\">\n </span>\n </div>\n <div\n class=\"s-fileupload-list-file-actions\"\n role=\"gridcell\">\n <a\n *ngIf=\"file.isUploading\"\n [id]=\"id + '-file-' + i + '-cancel'\"\n class=\"s-fileupload-list-file-actions-action\"\n (click)=\"onCancelUpload(i)\">\n {{cancelLabel}}\n </a>\n <a\n *ngIf=\"!file.isUploading && !(disabled || !!formGroup?.disabled)\"\n role=\"button\"\n tabindex=\"0\"\n [id]=\"id + '-file-' + i + '-remove'\"\n class=\"s-fileupload-list-file-actions-action\"\n (click)=\"onRemoveFile(file)\"\n [attr.aria-label]=\"ariaLabelRemove || removeLabel\">\n {{removeLabel}}\n </a>\n </div>\n </div>\n </ng-container>\n </section>\n</div>\n\n<ng-template\n #descriptionUrl\n let-file\n let-i = index>\n <a\n [id]=\"id + '-file-' + i + '-name-link'\"\n tabindex=\"0\"\n (click)=\"onDowloadFile(i)\"\n [attr.aria-label]=\"ariaLabelFileName || file.name\">{{file.name}}\n </a>\n <a\n style=\"display: none;\"\n [href]=\"file.objectURL\"\n target=\"_blank\"\n download\n #anchor>\n </a>\n</ng-template>\n\n<ng-template\n #description\n let-file>\n <span\n tabindex=\"0\"\n [attr.aria-label]=\"ariaLabelFileName || file.name\">\n {{file.name}}\n </span>\n</ng-template>\n",
|
|
3017
3020
|
styles: [".s-fileupload .s-fileupload-choose{position:relative;margin:15px 0;width:-webkit-max-content;width:max-content}.s-fileupload input[type=file]{display:none}.s-fileupload-list{border:1px solid #ccc}.s-fileupload-list-file:not(:first-child){border-top:1px solid #ccc}.s-fileupload-list .s-fileupload-list-file{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:justify;justify-content:space-between;padding:15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name>a{cursor:pointer;text-decoration:none}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center}.s-fileupload-list .s-fileupload-list-file .fas.fa-circle-notch{color:#d8d8d8;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-check{color:#0c9348;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-times{color:#c13018;font-size:12px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin-top:15px;-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center;width:100%}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action{text-decoration:none;color:#428bca}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :focus,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :visited,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action:hover{text-decoration:none}@media (min-width:768px){.s-fileupload-list .s-fileupload-list-file{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{width:auto;-ms-flex-positive:2;flex-grow:2}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{margin:0 15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin:0;width:auto}}"]
|
|
3018
3021
|
})
|
|
3019
3022
|
], FileUploadComponent);
|
|
@@ -3026,7 +3029,12 @@ var FileUploadModule = /** @class */ (function () {
|
|
|
3026
3029
|
FileUploadModule = __decorate([
|
|
3027
3030
|
NgModule({
|
|
3028
3031
|
declarations: [FileUploadComponent],
|
|
3029
|
-
imports: [
|
|
3032
|
+
imports: [
|
|
3033
|
+
CommonModule,
|
|
3034
|
+
ButtonModule,
|
|
3035
|
+
TooltipModule,
|
|
3036
|
+
ProgressBarModule,
|
|
3037
|
+
],
|
|
3030
3038
|
exports: [FileUploadComponent],
|
|
3031
3039
|
})
|
|
3032
3040
|
], FileUploadModule);
|
|
@@ -4378,7 +4386,7 @@ var TokenListComponent = /** @class */ (function () {
|
|
|
4378
4386
|
TokenListComponent = TokenListComponent_1 = __decorate([
|
|
4379
4387
|
Component({
|
|
4380
4388
|
selector: "s-token-list",
|
|
4381
|
-
template: "<div\n [id]=\"id\"\n class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span\n [id]=\"token.id\"\n class=\"token\"\n [ngClass]=\"{ 'no-pointer-events': hidePointerEvents }\">\n <a\n [id]=\"(token.id || 'token') + '-label'\"\n class=\"token-label\"\n (click)=\"tokenSelected.next(token)\">\n {{ token.label }}\n </a>\n <span\n *ngIf=\"removableTokens\"\n [id]=\"token.id + '-remove'\"\n class=\"token-icon fa fa-fw fa-close\"\n (click)=\"tokenRemoved.next(token)\">\n </span>\n </span>\n </ng-container>\n</div>",
|
|
4389
|
+
template: "<div\n [id]=\"id\"\n class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span\n [id]=\"token.id\"\n class=\"token\"\n [ngClass]=\"{ 'no-pointer-events': hidePointerEvents }\">\n <a\n [id]=\"(token.id || 'token') + '-label'\"\n class=\"token-label\"\n (click)=\"tokenSelected.next(token)\">\n {{ token.label }}\n </a>\n <span\n *ngIf=\"removableTokens && !token.notRemovable\"\n [id]=\"token.id + '-remove'\"\n class=\"token-icon fa fa-fw fa-close\"\n (click)=\"tokenRemoved.next(token)\">\n </span>\n </span>\n </ng-container>\n</div>",
|
|
4382
4390
|
styles: [".no-pointer-events{pointer-events:none}.token-list{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;padding:0 10px;text-transform:none}.token-list .token{-ms-flex-align:center;align-items:center;background-color:#ccc;border-radius:4px;color:#333;display:-ms-flexbox;display:flex;font:400 12px/150% \"Open Sans\",sans-serif;margin:2px 5px 0 0;max-width:100%;padding:2px 8px}.token-list .token-label{max-width:50ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-list .token:focus,.token-list .token:hover{background-color:#e5eaea}.token-list .token a{text-decoration:none;color:#333}"]
|
|
4383
4391
|
})
|
|
4384
4392
|
], TokenListComponent);
|