@rs-pk/asset-management 1.0.29 → 1.0.31
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/rs-pk-asset-management.umd.js +328 -57
- package/bundles/rs-pk-asset-management.umd.js.map +1 -1
- package/bundles/rs-pk-asset-management.umd.min.js +2 -2
- package/bundles/rs-pk-asset-management.umd.min.js.map +1 -1
- package/esm2015/lib/components/partial/asset-list/asset-list.component.js +73 -30
- package/esm2015/lib/components/partial/file-item/file-item.component.js +9 -3
- package/esm2015/lib/components/partial/upload-dialog/upload-dialog.component.js +110 -3
- package/esm2015/lib/configs/admin.config.js +71 -13
- package/esm2015/lib/services/upload-assets.service.js +17 -12
- package/esm5/lib/components/partial/asset-list/asset-list.component.js +95 -31
- package/esm5/lib/components/partial/file-item/file-item.component.js +13 -3
- package/esm5/lib/components/partial/upload-dialog/upload-dialog.component.js +133 -3
- package/esm5/lib/configs/admin.config.js +71 -13
- package/esm5/lib/services/upload-assets.service.js +21 -12
- package/fesm2015/rs-pk-asset-management.js +275 -56
- package/fesm2015/rs-pk-asset-management.js.map +1 -1
- package/fesm5/rs-pk-asset-management.js +328 -57
- package/fesm5/rs-pk-asset-management.js.map +1 -1
- package/lib/components/partial/asset-list/asset-list.component.d.ts +7 -1
- package/lib/components/partial/file-item/file-item.component.d.ts +1 -0
- package/lib/components/partial/upload-dialog/upload-dialog.component.d.ts +6 -0
- package/lib/services/upload-assets.service.d.ts +2 -0
- package/package.json +1 -1
- package/rs-pk-asset-management.metadata.json +1 -1
|
@@ -1633,6 +1633,7 @@
|
|
|
1633
1633
|
this._api = _api;
|
|
1634
1634
|
this.files = [];
|
|
1635
1635
|
this.fileNames = [];
|
|
1636
|
+
this.uploadErrors = new Map();
|
|
1636
1637
|
this.supportedSize = 10 * 1024 * 1024; // 10MB
|
|
1637
1638
|
// 10MB
|
|
1638
1639
|
this.documentExtension = ['.pdf', '.csv'];
|
|
@@ -1735,9 +1736,25 @@
|
|
|
1735
1736
|
* @return {?}
|
|
1736
1737
|
*/
|
|
1737
1738
|
function (index) {
|
|
1739
|
+
this.uploadErrors.delete(this.files[index]);
|
|
1738
1740
|
this.files.splice(index, 1);
|
|
1739
1741
|
this.fileNames.splice(index, 1);
|
|
1740
1742
|
};
|
|
1743
|
+
/**
|
|
1744
|
+
* @param {?} index
|
|
1745
|
+
* @return {?}
|
|
1746
|
+
*/
|
|
1747
|
+
UploadAssetsService.prototype.getUploadName = /**
|
|
1748
|
+
* @param {?} index
|
|
1749
|
+
* @return {?}
|
|
1750
|
+
*/
|
|
1751
|
+
function (index) {
|
|
1752
|
+
/** @type {?} */
|
|
1753
|
+
var nameSplit = this.files[index].name.split('.');
|
|
1754
|
+
/** @type {?} */
|
|
1755
|
+
var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
|
|
1756
|
+
return "" + this.fileNames[index].name + ext;
|
|
1757
|
+
};
|
|
1741
1758
|
/**
|
|
1742
1759
|
* @param {?} parentAssetId
|
|
1743
1760
|
* @return {?}
|
|
@@ -1749,21 +1766,11 @@
|
|
|
1749
1766
|
function (parentAssetId) {
|
|
1750
1767
|
var files = this.files;
|
|
1751
1768
|
/** @type {?} */
|
|
1752
|
-
var fileNames = this.fileNames.map((/**
|
|
1753
|
-
* @param {?} file
|
|
1754
|
-
* @return {?}
|
|
1755
|
-
*/
|
|
1756
|
-
function (file) { return file.name; }));
|
|
1757
|
-
/** @type {?} */
|
|
1758
1769
|
var formData = new FormData();
|
|
1759
1770
|
formData.append('parentAssetId', parentAssetId);
|
|
1760
1771
|
formData.append('companyId', '732DA8D2-04EC-4BE0-A168-63EE0DCF50D8');
|
|
1761
1772
|
for (var i = 0; i < files.length; i++) {
|
|
1762
|
-
|
|
1763
|
-
var nameSplit = files[i].name.split('.');
|
|
1764
|
-
/** @type {?} */
|
|
1765
|
-
var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
|
|
1766
|
-
formData.append('files', files[i], "" + fileNames[i] + ext);
|
|
1773
|
+
formData.append('files', files[i], this.getUploadName(i));
|
|
1767
1774
|
}
|
|
1768
1775
|
return this._api.post(this.baseUrl + "/File/Upload", formData);
|
|
1769
1776
|
};
|
|
@@ -1787,6 +1794,8 @@
|
|
|
1787
1794
|
/** @type {?} */
|
|
1788
1795
|
UploadAssetsService.prototype.fileNames;
|
|
1789
1796
|
/** @type {?} */
|
|
1797
|
+
UploadAssetsService.prototype.uploadErrors;
|
|
1798
|
+
/** @type {?} */
|
|
1790
1799
|
UploadAssetsService.prototype.supportedSize;
|
|
1791
1800
|
/** @type {?} */
|
|
1792
1801
|
UploadAssetsService.prototype.documentExtension;
|
|
@@ -2579,6 +2588,16 @@
|
|
|
2579
2588
|
function () {
|
|
2580
2589
|
this.initDataFile();
|
|
2581
2590
|
};
|
|
2591
|
+
Object.defineProperty(FileItemComponent.prototype, "uploadErrors", {
|
|
2592
|
+
get: /**
|
|
2593
|
+
* @return {?}
|
|
2594
|
+
*/
|
|
2595
|
+
function () {
|
|
2596
|
+
return this.uploadAssetService.uploadErrors.get(this.file);
|
|
2597
|
+
},
|
|
2598
|
+
enumerable: true,
|
|
2599
|
+
configurable: true
|
|
2600
|
+
});
|
|
2582
2601
|
/**
|
|
2583
2602
|
* @private
|
|
2584
2603
|
* @return {?}
|
|
@@ -2701,8 +2720,8 @@
|
|
|
2701
2720
|
FileItemComponent.decorators = [
|
|
2702
2721
|
{ type: core.Component, args: [{
|
|
2703
2722
|
selector: 'lib-file-item',
|
|
2704
|
-
template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['ext'] }}\n
|
|
2705
|
-
styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{margin-top:10px;color:#
|
|
2723
|
+
template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || documentExts.indexOf(dataFile.ext) > -1;\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"documentExts.indexOf(dataFile.ext) > -1 || dataFile.data\"\n [src]=\"documentExts.indexOf(dataFile.ext) > -1 ? base64PNG[dataFile.ext] : dataFile.data\"\n />\n </ng-container>\n <ng-template #defaultFile>\n <mat-icon>attach_file</mat-icon>\n </ng-template>\n</div>\n<div class=\"file-item__content\">\n <input\n class=\"file-item__content--name\"\n matInput\n placeholder=\"Enter file name\"\n [value]=\"dataFile.name\"\n required\n (input)=\"onChange($event)\"\n />\n <div class=\"file-item__content--info\">\n <div class=\"file-item__content--info__item\">\n Extension: <span>{{ dataFile.ext }}</span>\n </div>\n <div class=\"file-item__content--info__item\">\n Size: <span>{{ dataFile.size | fileSize }}</span>\n </div>\n </div>\n <div *ngIf=\"dataFile.errors.ext\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['ext'] }}\n {{ uploadAssetService.supportedTypes.join(', ') }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </span>\n </div>\n <div *ngIf=\"dataFile.errors.maxLength\" class=\"file-item__error\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ uploadAssetService.messageErrors['maxLength'] }}</span>\n </div>\n <div *ngFor=\"let message of uploadErrors\" class=\"file-item__error\" role=\"alert\">\n <mat-icon class=\"file-item__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
|
|
2724
|
+
styles: [":host::ng-deep{padding:10px 5%;display:flex;justify-content:space-between;align-items:center;background-color:#f9f9f9;border-radius:10px}:host::ng-deep .file-item__img{display:flex;justify-content:center;align-items:center;width:250px;height:150px;border-radius:10px}:host::ng-deep .file-item__img img{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}:host::ng-deep .file-item__img img.image{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAUABQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/ivFPFOf+EjvxzjbBgdv+PeDp+OfxzSt4q18AkageASB9ntu3OM+Vn8c5rsdG0fT9d06DVdUgN1f3XmefP5ksO/ypXhj/dwvHGu2ONF+VF3bQSM0AeYUV7IPCWgjgWRA/wCvi4P85SaKAPGm5Vh7H+VeyeERjQLEDoPP/WeQ/wAzRRQB0tFFFAH/2Q==)}:host::ng-deep .file-item__img mat-icon{font-size:100px;width:auto;height:auto}:host::ng-deep .file-item__content{flex:1;padding-left:5%;padding-right:5%}:host::ng-deep .file-item__content--name{width:100%;padding:10px;border:1px solid #d8d8d8;border-radius:5px}:host::ng-deep .file-item__content--info{margin-top:10px;display:flex}:host::ng-deep .file-item__content--info__item:not(:last-child){margin-right:50px}:host::ng-deep .file-item__content--info__item span{color:#000;text-transform:uppercase}:host::ng-deep .file-item__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .file-item__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
|
|
2706
2725
|
}] }
|
|
2707
2726
|
];
|
|
2708
2727
|
/** @nocollapse */
|
|
@@ -3417,6 +3436,8 @@
|
|
|
3417
3436
|
this.uploadAssetsService = uploadAssetsService;
|
|
3418
3437
|
this.isLoading = false;
|
|
3419
3438
|
this.disabled = true;
|
|
3439
|
+
this.errorMessages = [];
|
|
3440
|
+
this.defaultErrorMessage = 'Something went wrong while uploading. Please try again.';
|
|
3420
3441
|
this.destroy$ = new rxjs.Subject();
|
|
3421
3442
|
if (this.data.fileType) {
|
|
3422
3443
|
this.uploadAssetsService.supportedTypes =
|
|
@@ -3444,6 +3465,7 @@
|
|
|
3444
3465
|
*/
|
|
3445
3466
|
function (error) {
|
|
3446
3467
|
_this.disabled = error;
|
|
3468
|
+
_this.clearErrors();
|
|
3447
3469
|
_this.changeDetectorRef.detectChanges();
|
|
3448
3470
|
}));
|
|
3449
3471
|
};
|
|
@@ -3457,6 +3479,7 @@
|
|
|
3457
3479
|
*/
|
|
3458
3480
|
function (hasError) {
|
|
3459
3481
|
this.disabled = hasError;
|
|
3482
|
+
this.clearErrors();
|
|
3460
3483
|
};
|
|
3461
3484
|
/**
|
|
3462
3485
|
* @return {?}
|
|
@@ -3467,6 +3490,8 @@
|
|
|
3467
3490
|
function () {
|
|
3468
3491
|
var _this = this;
|
|
3469
3492
|
this.isLoading = true;
|
|
3493
|
+
this.clearErrors();
|
|
3494
|
+
this.dialogRef.disableClose = true;
|
|
3470
3495
|
this.uploadAssetsService
|
|
3471
3496
|
.uploadMultipleAssets(this.data.currentAssetId)
|
|
3472
3497
|
.pipe(operators.takeUntil(this.destroy$))
|
|
@@ -3478,8 +3503,125 @@
|
|
|
3478
3503
|
if (res) {
|
|
3479
3504
|
_this.closeDialog(true);
|
|
3480
3505
|
}
|
|
3506
|
+
}), (/**
|
|
3507
|
+
* @param {?} err
|
|
3508
|
+
* @return {?}
|
|
3509
|
+
*/
|
|
3510
|
+
function (err) {
|
|
3511
|
+
_this.setUploadErrors(_this.getErrorMessages(err));
|
|
3512
|
+
_this.stopLoading();
|
|
3513
|
+
}), (
|
|
3514
|
+
// the request can complete without a truthy response (or be swallowed by an interceptor)
|
|
3515
|
+
// the request can complete without a truthy response (or be swallowed by an interceptor)
|
|
3516
|
+
/**
|
|
3517
|
+
* @return {?}
|
|
3518
|
+
*/
|
|
3519
|
+
function () { return _this.stopLoading(); }));
|
|
3520
|
+
};
|
|
3521
|
+
/**
|
|
3522
|
+
* @private
|
|
3523
|
+
* @return {?}
|
|
3524
|
+
*/
|
|
3525
|
+
UploadDialogComponent.prototype.stopLoading = /**
|
|
3526
|
+
* @private
|
|
3527
|
+
* @return {?}
|
|
3528
|
+
*/
|
|
3529
|
+
function () {
|
|
3530
|
+
this.isLoading = false;
|
|
3531
|
+
this.dialogRef.disableClose = false;
|
|
3532
|
+
this.changeDetectorRef.detectChanges();
|
|
3533
|
+
};
|
|
3534
|
+
/**
|
|
3535
|
+
* @private
|
|
3536
|
+
* @return {?}
|
|
3537
|
+
*/
|
|
3538
|
+
UploadDialogComponent.prototype.clearErrors = /**
|
|
3539
|
+
* @private
|
|
3540
|
+
* @return {?}
|
|
3541
|
+
*/
|
|
3542
|
+
function () {
|
|
3543
|
+
this.errorMessages = [];
|
|
3544
|
+
this.uploadAssetsService.uploadErrors.clear();
|
|
3545
|
+
};
|
|
3546
|
+
// show each message on the file it mentions, the rest stay under the list
|
|
3547
|
+
// show each message on the file it mentions, the rest stay under the list
|
|
3548
|
+
/**
|
|
3549
|
+
* @private
|
|
3550
|
+
* @param {?} messages
|
|
3551
|
+
* @return {?}
|
|
3552
|
+
*/
|
|
3553
|
+
UploadDialogComponent.prototype.setUploadErrors =
|
|
3554
|
+
// show each message on the file it mentions, the rest stay under the list
|
|
3555
|
+
/**
|
|
3556
|
+
* @private
|
|
3557
|
+
* @param {?} messages
|
|
3558
|
+
* @return {?}
|
|
3559
|
+
*/
|
|
3560
|
+
function (messages) {
|
|
3561
|
+
var _this = this;
|
|
3562
|
+
var _a = this.uploadAssetsService, files = _a.getFiles, uploadErrors = _a.uploadErrors;
|
|
3563
|
+
/** @type {?} */
|
|
3564
|
+
var uploadNames = files.map((/**
|
|
3565
|
+
* @param {?} file
|
|
3566
|
+
* @param {?} index
|
|
3567
|
+
* @return {?}
|
|
3568
|
+
*/
|
|
3569
|
+
function (file, index) { return _this.uploadAssetsService.getUploadName(index); }));
|
|
3570
|
+
this.errorMessages = messages.filter((/**
|
|
3571
|
+
* @param {?} message
|
|
3572
|
+
* @return {?}
|
|
3573
|
+
*/
|
|
3574
|
+
function (message) {
|
|
3575
|
+
/** @type {?} */
|
|
3576
|
+
var index = uploadNames.findIndex((/**
|
|
3577
|
+
* @param {?} name
|
|
3578
|
+
* @return {?}
|
|
3579
|
+
*/
|
|
3580
|
+
function (name) { return message.indexOf(name) > -1; }));
|
|
3581
|
+
if (index < 0 && files.length === 1) {
|
|
3582
|
+
index = 0;
|
|
3583
|
+
}
|
|
3584
|
+
if (index < 0) {
|
|
3585
|
+
return true;
|
|
3586
|
+
}
|
|
3587
|
+
uploadErrors.set(files[index], __spread((uploadErrors.get(files[index]) || []), [message]));
|
|
3588
|
+
return false;
|
|
3481
3589
|
}));
|
|
3482
3590
|
};
|
|
3591
|
+
/**
|
|
3592
|
+
* @private
|
|
3593
|
+
* @param {?} err
|
|
3594
|
+
* @return {?}
|
|
3595
|
+
*/
|
|
3596
|
+
UploadDialogComponent.prototype.getErrorMessages = /**
|
|
3597
|
+
* @private
|
|
3598
|
+
* @param {?} err
|
|
3599
|
+
* @return {?}
|
|
3600
|
+
*/
|
|
3601
|
+
function (err) {
|
|
3602
|
+
// HttpErrorResponse keeps the API body in `error`, an interceptor may already unwrap it
|
|
3603
|
+
/** @type {?} */
|
|
3604
|
+
var body = err && err.error && typeof err.error === 'object' ? err.error : err || {};
|
|
3605
|
+
/** @type {?} */
|
|
3606
|
+
var messages = (body.Messages || [])
|
|
3607
|
+
.map((/**
|
|
3608
|
+
* @param {?} message
|
|
3609
|
+
* @return {?}
|
|
3610
|
+
*/
|
|
3611
|
+
function (message) { return (typeof message === 'string' ? message : message && message.Text); }))
|
|
3612
|
+
.filter(Boolean);
|
|
3613
|
+
if (!messages.length && body.ResponseMessage) {
|
|
3614
|
+
messages.push(body.ResponseMessage);
|
|
3615
|
+
}
|
|
3616
|
+
return messages.length
|
|
3617
|
+
? messages.filter((/**
|
|
3618
|
+
* @param {?} message
|
|
3619
|
+
* @param {?} index
|
|
3620
|
+
* @return {?}
|
|
3621
|
+
*/
|
|
3622
|
+
function (message, index) { return messages.indexOf(message) === index; }))
|
|
3623
|
+
: [this.defaultErrorMessage];
|
|
3624
|
+
};
|
|
3483
3625
|
/**
|
|
3484
3626
|
* @param {?=} res
|
|
3485
3627
|
* @return {?}
|
|
@@ -3504,9 +3646,9 @@
|
|
|
3504
3646
|
UploadDialogComponent.decorators = [
|
|
3505
3647
|
{ type: core.Component, args: [{
|
|
3506
3648
|
selector: 'lib-upload-dialog',
|
|
3507
|
-
template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close>Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
|
|
3649
|
+
template: "<lib-modal heading=\"Add new assets\">\n <ng-container content>\n <lib-upload-file\n *ngIf=\"!uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-upload-file>\n <lib-file-list\n *ngIf=\"uploadAssetsService?.getFiles?.length\"\n (revalidate)=\"onValidate($event)\"\n ></lib-file-list>\n <div *ngFor=\"let message of errorMessages\" class=\"upload__error\" role=\"alert\">\n <mat-icon class=\"upload__error--icon\">error_outline</mat-icon>\n <span>{{ message }}</span>\n </div>\n </ng-container>\n <ng-container actions>\n <button mat-raised-button mat-dialog-close [disabled]=\"isLoading\">Cancel</button>\n <button\n class=\"upload__action\"\n [class.loading]=\"isLoading\"\n mat-raised-button\n color=\"primary\"\n (click)=\"uploadFiles()\"\n [disabled]=\"disabled || isLoading\"\n >\n <ng-container *ngIf=\"isLoading\">\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n </ng-container>\n <span>Upload</span>\n </button>\n </ng-container>\n</lib-modal>\n",
|
|
3508
3650
|
providers: [UploadAssetsService],
|
|
3509
|
-
styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
|
|
3651
|
+
styles: [":host::ng-deep{display:block;width:1200px;max-width:100%;font-size:14px;line-height:16px;color:#979797;letter-spacing:.15px}:host::ng-deep .mat-dialog-title{position:relative;margin-bottom:0;padding-bottom:24px;color:#000}:host::ng-deep .mat-dialog-actions{justify-content:flex-end;padding:24px 0 0}:host::ng-deep .upload__error{display:flex;align-items:center;width:-moz-fit-content;width:fit-content;max-width:100%;margin-top:8px;padding:4px 10px;border-radius:6px;background-color:#fdecea;color:#d32f2f;font-size:13px;line-height:18px;word-break:break-word}:host::ng-deep .upload__error--icon{flex-shrink:0;margin-right:6px;font-size:16px;width:16px;height:16px}:host::ng-deep .upload__action{min-width:100px}:host::ng-deep .upload__action.loading{padding:0 5px}:host::ng-deep .upload__action.loading .mat-button-wrapper{display:flex;width:100%;justify-content:center;align-items:center}:host::ng-deep .upload__action.loading .mat-spinner{margin-right:10px}"]
|
|
3510
3652
|
}] }
|
|
3511
3653
|
];
|
|
3512
3654
|
/** @nocollapse */
|
|
@@ -3523,6 +3665,13 @@
|
|
|
3523
3665
|
UploadDialogComponent.prototype.isLoading;
|
|
3524
3666
|
/** @type {?} */
|
|
3525
3667
|
UploadDialogComponent.prototype.disabled;
|
|
3668
|
+
/** @type {?} */
|
|
3669
|
+
UploadDialogComponent.prototype.errorMessages;
|
|
3670
|
+
/**
|
|
3671
|
+
* @type {?}
|
|
3672
|
+
* @private
|
|
3673
|
+
*/
|
|
3674
|
+
UploadDialogComponent.prototype.defaultErrorMessage;
|
|
3526
3675
|
/**
|
|
3527
3676
|
* @type {?}
|
|
3528
3677
|
* @private
|
|
@@ -3806,6 +3955,7 @@
|
|
|
3806
3955
|
this.hasAccessPermission = true;
|
|
3807
3956
|
this.hasArchivePermission = true;
|
|
3808
3957
|
this.backgroundProcessingNum = BackgroudProcessingStatus;
|
|
3958
|
+
this.processingCheckDelay = 5000;
|
|
3809
3959
|
this.unsubscribe$ = new Subject.Subject();
|
|
3810
3960
|
this.selectedAssets = [];
|
|
3811
3961
|
}
|
|
@@ -3827,17 +3977,8 @@
|
|
|
3827
3977
|
* @return {?}
|
|
3828
3978
|
*/
|
|
3829
3979
|
function (changes) {
|
|
3830
|
-
var _this = this;
|
|
3831
3980
|
if (changes.assets) {
|
|
3832
|
-
|
|
3833
|
-
if (this.assets && this.assets.find((/**
|
|
3834
|
-
* @param {?} x
|
|
3835
|
-
* @return {?}
|
|
3836
|
-
*/
|
|
3837
|
-
function (x) { return x.BackgroudProcessingStatus === _this.backgroundProcessingNum.InProcessing; }))) {
|
|
3838
|
-
this._resetUploadingAssets();
|
|
3839
|
-
}
|
|
3840
|
-
;
|
|
3981
|
+
this.checkProcessingAssets();
|
|
3841
3982
|
this.paginator.pageIndex = this.assetService.pageIndex;
|
|
3842
3983
|
this.paginator.pageSize = this.assetService.pageSize;
|
|
3843
3984
|
this.paginator.length = this.assetService.fileTotal;
|
|
@@ -3990,15 +4131,8 @@
|
|
|
3990
4131
|
* @param {?} res
|
|
3991
4132
|
* @return {?}
|
|
3992
4133
|
*/
|
|
3993
|
-
function (res) {
|
|
3994
|
-
/**
|
|
3995
|
-
var pagination = res && res.Meta || {};
|
|
3996
|
-
/** @type {?} */
|
|
3997
|
-
var assets = res && res.Data && res.Data.Children || [];
|
|
3998
|
-
/** @type {?} */
|
|
3999
|
-
var totalFile = res && res.Data && res.Data.TotalFile || 0;
|
|
4000
|
-
_this.assetService.setAssetList(assets, pagination, totalFile);
|
|
4001
|
-
})).add((/**
|
|
4134
|
+
function (res) { return _this.setAssetList(res); }))
|
|
4135
|
+
.add((/**
|
|
4002
4136
|
* @return {?}
|
|
4003
4137
|
*/
|
|
4004
4138
|
function () {
|
|
@@ -4008,31 +4142,94 @@
|
|
|
4008
4142
|
});
|
|
4009
4143
|
}));
|
|
4010
4144
|
};
|
|
4145
|
+
/**
|
|
4146
|
+
* @private
|
|
4147
|
+
* @param {?} res
|
|
4148
|
+
* @return {?}
|
|
4149
|
+
*/
|
|
4150
|
+
AssetListComponent.prototype.setAssetList = /**
|
|
4151
|
+
* @private
|
|
4152
|
+
* @param {?} res
|
|
4153
|
+
* @return {?}
|
|
4154
|
+
*/
|
|
4155
|
+
function (res) {
|
|
4156
|
+
/** @type {?} */
|
|
4157
|
+
var pagination = res && res.Meta || {};
|
|
4158
|
+
/** @type {?} */
|
|
4159
|
+
var assets = res && res.Data && res.Data.Children || [];
|
|
4160
|
+
/** @type {?} */
|
|
4161
|
+
var totalFile = res && res.Data && res.Data.TotalFile || 0;
|
|
4162
|
+
this.assetService.setAssetList(assets, pagination, totalFile);
|
|
4163
|
+
};
|
|
4164
|
+
// Called on every new asset list: while some files are still processed in the background,
|
|
4165
|
+
// reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
|
|
4166
|
+
// Called on every new asset list: while some files are still processed in the background,
|
|
4167
|
+
// reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
|
|
4011
4168
|
/**
|
|
4012
4169
|
* @private
|
|
4013
4170
|
* @return {?}
|
|
4014
4171
|
*/
|
|
4015
|
-
AssetListComponent.prototype.
|
|
4172
|
+
AssetListComponent.prototype.checkProcessingAssets =
|
|
4173
|
+
// Called on every new asset list: while some files are still processed in the background,
|
|
4174
|
+
// reload the list once after a delay. The reloaded list calls this again, until nothing is processing.
|
|
4175
|
+
/**
|
|
4016
4176
|
* @private
|
|
4017
4177
|
* @return {?}
|
|
4018
4178
|
*/
|
|
4019
4179
|
function () {
|
|
4020
4180
|
var _this = this;
|
|
4181
|
+
this.stopProcessingCheck();
|
|
4021
4182
|
/** @type {?} */
|
|
4022
|
-
var
|
|
4183
|
+
var hasProcessingAssets = this.assets && this.assets.some((/**
|
|
4184
|
+
* @param {?} asset
|
|
4023
4185
|
* @return {?}
|
|
4024
4186
|
*/
|
|
4025
|
-
function () {
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
* @param {?} x
|
|
4187
|
+
function (asset) { return asset.BackgroudProcessingStatus === _this.backgroundProcessingNum.InProcessing; }));
|
|
4188
|
+
if (hasProcessingAssets) {
|
|
4189
|
+
this.processingCheckTimer = setTimeout((/**
|
|
4029
4190
|
* @return {?}
|
|
4030
4191
|
*/
|
|
4031
|
-
function (
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4192
|
+
function () { return _this.reloadProcessingAssets(); }), this.processingCheckDelay);
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
// Silent reload, without the global loading bar
|
|
4196
|
+
// Silent reload, without the global loading bar
|
|
4197
|
+
/**
|
|
4198
|
+
* @private
|
|
4199
|
+
* @return {?}
|
|
4200
|
+
*/
|
|
4201
|
+
AssetListComponent.prototype.reloadProcessingAssets =
|
|
4202
|
+
// Silent reload, without the global loading bar
|
|
4203
|
+
/**
|
|
4204
|
+
* @private
|
|
4205
|
+
* @return {?}
|
|
4206
|
+
*/
|
|
4207
|
+
function () {
|
|
4208
|
+
var _this = this;
|
|
4209
|
+
if (!this.currentFolderId) {
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
this.processingCheckRequest = this.assetService
|
|
4213
|
+
.getChildrenAssets({ assetId: this.currentFolderId })
|
|
4214
|
+
.subscribe((/**
|
|
4215
|
+
* @param {?} res
|
|
4216
|
+
* @return {?}
|
|
4217
|
+
*/
|
|
4218
|
+
function (res) { return _this.setAssetList(res); }));
|
|
4219
|
+
};
|
|
4220
|
+
/**
|
|
4221
|
+
* @private
|
|
4222
|
+
* @return {?}
|
|
4223
|
+
*/
|
|
4224
|
+
AssetListComponent.prototype.stopProcessingCheck = /**
|
|
4225
|
+
* @private
|
|
4226
|
+
* @return {?}
|
|
4227
|
+
*/
|
|
4228
|
+
function () {
|
|
4229
|
+
clearTimeout(this.processingCheckTimer);
|
|
4230
|
+
if (this.processingCheckRequest) {
|
|
4231
|
+
this.processingCheckRequest.unsubscribe();
|
|
4232
|
+
}
|
|
4036
4233
|
};
|
|
4037
4234
|
/**
|
|
4038
4235
|
* @return {?}
|
|
@@ -4041,6 +4238,7 @@
|
|
|
4041
4238
|
* @return {?}
|
|
4042
4239
|
*/
|
|
4043
4240
|
function () {
|
|
4241
|
+
this.stopProcessingCheck();
|
|
4044
4242
|
this.unsubscribe$.next();
|
|
4045
4243
|
this.unsubscribe$.complete();
|
|
4046
4244
|
};
|
|
@@ -4081,6 +4279,21 @@
|
|
|
4081
4279
|
AssetListComponent.prototype.assets;
|
|
4082
4280
|
/** @type {?} */
|
|
4083
4281
|
AssetListComponent.prototype.backgroundProcessingNum;
|
|
4282
|
+
/**
|
|
4283
|
+
* @type {?}
|
|
4284
|
+
* @private
|
|
4285
|
+
*/
|
|
4286
|
+
AssetListComponent.prototype.processingCheckDelay;
|
|
4287
|
+
/**
|
|
4288
|
+
* @type {?}
|
|
4289
|
+
* @private
|
|
4290
|
+
*/
|
|
4291
|
+
AssetListComponent.prototype.processingCheckTimer;
|
|
4292
|
+
/**
|
|
4293
|
+
* @type {?}
|
|
4294
|
+
* @private
|
|
4295
|
+
*/
|
|
4296
|
+
AssetListComponent.prototype.processingCheckRequest;
|
|
4084
4297
|
/**
|
|
4085
4298
|
* @type {?}
|
|
4086
4299
|
* @private
|
|
@@ -6926,20 +7139,78 @@
|
|
|
6926
7139
|
*/
|
|
6927
7140
|
/** @type {?} */
|
|
6928
7141
|
var AdminConfig = {
|
|
6929
|
-
locale:
|
|
6930
|
-
|
|
7142
|
+
locale: "en-US",
|
|
7143
|
+
countryName: {
|
|
7144
|
+
US: "United States",
|
|
7145
|
+
CA: "Canada",
|
|
7146
|
+
},
|
|
6931
7147
|
format: {
|
|
6932
|
-
date:
|
|
6933
|
-
dayMonth:
|
|
6934
|
-
dateTime:
|
|
6935
|
-
fullDateTime:
|
|
6936
|
-
dateTimeAM:
|
|
6937
|
-
apiDate:
|
|
6938
|
-
apiDateTime:
|
|
6939
|
-
apiDateTimeNoZ:
|
|
6940
|
-
apiDateMonthYear:
|
|
6941
|
-
urlParam:
|
|
7148
|
+
date: "MM/DD/YYYY",
|
|
7149
|
+
dayMonth: "MMM DD",
|
|
7150
|
+
dateTime: "MM/DD/YYYY HH:mm",
|
|
7151
|
+
fullDateTime: "MM/DD/YYYY HH:mm:ss",
|
|
7152
|
+
dateTimeAM: "MM/DD/YYYY hh:mm A",
|
|
7153
|
+
apiDate: "YYYY/MM/DD",
|
|
7154
|
+
apiDateTime: "YYYY-MM-DD[T]HH:mm:ssZ",
|
|
7155
|
+
apiDateTimeNoZ: "YYYY-MM-DD[T]HH:mm:ss",
|
|
7156
|
+
apiDateMonthYear: "MMM DD YYYY",
|
|
7157
|
+
urlParam: "YYYY-MM-DD",
|
|
7158
|
+
},
|
|
7159
|
+
mask: {
|
|
7160
|
+
phone: "(000) 000-0000",
|
|
7161
|
+
date: "M0/d0/0000",
|
|
7162
|
+
zipCode: {
|
|
7163
|
+
US: "00000",
|
|
7164
|
+
CA: "AAA AAA",
|
|
7165
|
+
},
|
|
7166
|
+
money: "0*.00",
|
|
7167
|
+
number: "0*.00",
|
|
7168
|
+
integer: "0*",
|
|
7169
|
+
tax: "00.0000",
|
|
7170
|
+
sku: "0000000000000",
|
|
7171
|
+
upca: "000000000000",
|
|
7172
|
+
pin: "000000",
|
|
7173
|
+
mi9ProductUpc: "00000000000000",
|
|
7174
|
+
},
|
|
7175
|
+
regex: {
|
|
7176
|
+
password: "^(?=.*[a-zA-Z])(?=.*[0-9]).{6,12}",
|
|
7177
|
+
bigyPassword: "^(?=.*[a-zA-Z])(?=.*[0-9]).{8,}$",
|
|
7178
|
+
url: /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\.%_~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/,
|
|
7179
|
+
shortCode: "^[A-Z0-9_]{1,20}$",
|
|
7180
|
+
longCode: "^[A-Z0-9_]{1,100}$",
|
|
7181
|
+
email: /^[\w-\.]+@([\w]+[\.-])+[\w-]{2,}$/,
|
|
7182
|
+
textWithoutSpecialChars: /^[a-zA-Z0-9\. ]+$/,
|
|
7183
|
+
textWithSpecialChars: /^[a-zA-Z0-9_-]+$/,
|
|
7184
|
+
// Allow char '_ -'
|
|
7185
|
+
textWithSpaceAndSpecialChars: /^[a-zA-Z0-9\. /_-]+$/,
|
|
7186
|
+
// Allow space and char '_ - /'
|
|
7187
|
+
address: /^[a-zA-Z0-9][a-zA-Z0-9\_\/\. ]+$/,
|
|
7188
|
+
leadTimeKeyPress: /^[0-9mhdw ]+$/,
|
|
7189
|
+
leadTime: [
|
|
7190
|
+
/^(?:(?<minutes>\d{0,2})m\s*)?(?:(?<hours>\d{0,3})h\s*)?(?:(?<days>\d{0,2})d\s*)?(?:(?<weeks>\d{0,2})w\s*)?$/,
|
|
7191
|
+
/^(?:(?<weeks>\d{0,2})w\s*)?(?:(?<days>\d{0,2})d\s*)?(?:(?<hours>\d{0,3})h\s*)?(?:(?<minutes>\d{0,2})m\s*)?$/,
|
|
7192
|
+
],
|
|
7193
|
+
userPIN: /^[0-9]{6}$/,
|
|
7194
|
+
storeCode: /^[0-9]{1,10}$/,
|
|
7195
|
+
sku: /^[0-9]{1,14}$/,
|
|
7196
|
+
sku13: /^[0-9]{1,13}$/,
|
|
7197
|
+
keyConfigProvider: /^[a-zA-Z0-9!*()_+\-\[\]{}:\\|,.<>\/]*$/,
|
|
7198
|
+
//not allow character '?#%='
|
|
7199
|
+
textNoSpace: /^[a-zA-Z]+$/,
|
|
7200
|
+
textWithSpace: /^(\s+\S+\s*)*(?!\s).*$/,
|
|
7201
|
+
//not allow a string containing only white spaces
|
|
7202
|
+
slug: /^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$/,
|
|
7203
|
+
tag: /^[a-zA-Z0-9](-?_?[a-zA-Z0-9])*$/,
|
|
7204
|
+
noSpace: /^[a-zA-Z0-9!*()_+\-\[\]{}:\\|,.<>\/\?\=\&\%\#\@]*$/,
|
|
6942
7205
|
},
|
|
7206
|
+
pattern: {},
|
|
7207
|
+
pipe: {},
|
|
7208
|
+
pageSizeOptions: [5, 10, 25, 50, 100],
|
|
7209
|
+
maxOrderNumber: 99999,
|
|
7210
|
+
// TinyMCE
|
|
7211
|
+
tinyHeightDefault: "75vh",
|
|
7212
|
+
tinyMCEPluginConfig: "print preview fullpage importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons",
|
|
7213
|
+
tinyMCEToolbarConfig: "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | fileManagerButton | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor | pagebreak | charmap emoticons | fullscreen preview save print | image media template link anchor codesample | ltr rtl",
|
|
6943
7214
|
};
|
|
6944
7215
|
|
|
6945
7216
|
/**
|