@rs-pk/asset-management 1.0.0 → 1.0.13

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.
Files changed (25) hide show
  1. package/bundles/rs-pk-asset-management.umd.js +31 -14
  2. package/bundles/rs-pk-asset-management.umd.js.map +1 -1
  3. package/bundles/rs-pk-asset-management.umd.min.js +1 -1
  4. package/bundles/rs-pk-asset-management.umd.min.js.map +1 -1
  5. package/esm2015/lib/components/partial/asset-dialog/asset-dialog.component.js +13 -4
  6. package/esm2015/lib/components/partial/breadcrumb/breadcrumb.component.js +13 -7
  7. package/esm2015/lib/components/partial/file-item/file-item.component.js +3 -4
  8. package/esm2015/lib/components/partial/upload-dialog/upload-dialog.component.js +2 -2
  9. package/esm2015/lib/services/asset.service.js +4 -1
  10. package/esm2015/lib/services/upload-assets.service.js +6 -3
  11. package/esm5/lib/components/partial/asset-dialog/asset-dialog.component.js +12 -4
  12. package/esm5/lib/components/partial/breadcrumb/breadcrumb.component.js +12 -7
  13. package/esm5/lib/components/partial/file-item/file-item.component.js +3 -4
  14. package/esm5/lib/components/partial/upload-dialog/upload-dialog.component.js +2 -2
  15. package/esm5/lib/services/asset.service.js +4 -1
  16. package/esm5/lib/services/upload-assets.service.js +6 -3
  17. package/fesm2015/rs-pk-asset-management.js +33 -14
  18. package/fesm2015/rs-pk-asset-management.js.map +1 -1
  19. package/fesm5/rs-pk-asset-management.js +31 -14
  20. package/fesm5/rs-pk-asset-management.js.map +1 -1
  21. package/lib/components/partial/asset-dialog/asset-dialog.component.d.ts +2 -1
  22. package/lib/components/partial/breadcrumb/breadcrumb.component.d.ts +3 -2
  23. package/lib/services/upload-assets.service.d.ts +2 -1
  24. package/package.json +1 -1
  25. package/rs-pk-asset-management.metadata.json +1 -1
@@ -648,6 +648,9 @@ var AssetService = /** @class */ (function () {
648
648
  if (isFilter && this.keyword.length) {
649
649
  params = params.set('keyword', this.keyword || '');
650
650
  }
651
+ if (this.dialogConfig.allowedType) {
652
+ params = params.set('fileType', this.dialogConfig.allowedType);
653
+ }
651
654
  return this._api.get(url, { params: params });
652
655
  };
653
656
  /**
@@ -1340,6 +1343,7 @@ var UploadAssetsService = /** @class */ (function () {
1340
1343
  this.messageErrors = {
1341
1344
  size: "File size should be upto",
1342
1345
  ext: "Only supported file extension:",
1346
+ replace: "The replacement file should be the same extension with old one:",
1343
1347
  };
1344
1348
  this.errorObs$ = new BehaviorSubject(true);
1345
1349
  this.baseUrl = this._env.asset2Url;
@@ -1471,7 +1475,7 @@ var UploadAssetsService = /** @class */ (function () {
1471
1475
  * @param {?} parentAssetId
1472
1476
  * @return {?}
1473
1477
  */
1474
- UploadAssetsService.prototype.uploadMultipleAssests = /**
1478
+ UploadAssetsService.prototype.uploadMultipleAssets = /**
1475
1479
  * @param {?} parentAssetId
1476
1480
  * @return {?}
1477
1481
  */
@@ -1486,7 +1490,9 @@ var UploadAssetsService = /** @class */ (function () {
1486
1490
  for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
1487
1491
  var file = files_1_1.value;
1488
1492
  /** @type {?} */
1489
- var ext = "." + file.type.split('/')[1];
1493
+ var nameSplit = file.name.split('.');
1494
+ /** @type {?} */
1495
+ var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
1490
1496
  /** @type {?} */
1491
1497
  var originName = file.name;
1492
1498
  /** @type {?} */
@@ -2302,10 +2308,9 @@ var FileItemComponent = /** @class */ (function () {
2302
2308
  var _b = this.uploadAssetService, supportedTypes = _b.supportedTypes, supportedSize = _b.supportedSize;
2303
2309
  /** @type {?} */
2304
2310
  var nameSplit = file.name.split('.');
2305
- nameSplit.splice(nameSplit.length - 1, 1);
2311
+ this.dataFile.ext = nameSplit.splice(nameSplit.length - 1, 1)[0];
2306
2312
  this.dataFile.name = nameSplit.join('.');
2307
2313
  this.dataFile.size = file.size;
2308
- this.dataFile.ext = file.type.split('/')[1];
2309
2314
  this.dataFile.errors = {
2310
2315
  ext: supportedTypes.indexOf("." + this.dataFile.ext) < 0,
2311
2316
  size: supportedSize < this.dataFile.size,
@@ -2361,7 +2366,7 @@ var FileItemComponent = /** @class */ (function () {
2361
2366
  FileItemComponent.decorators = [
2362
2367
  { type: Component, args: [{
2363
2368
  selector: 'lib-file-item',
2364
- template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || dataFile.ext === 'pdf';\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"dataFile.ext === 'pdf' || dataFile.data\"\n [src]=\"dataFile.ext === 'pdf' ? base64Pdf : 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 Type of file: <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 {{ uploadAssetService.supportedTypes.join(', ') }}\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2369
+ template: "<div class=\"file-item__img\">\n <ng-container\n *ngIf=\"\n file.type.indexOf('image') > -1 || dataFile.ext === 'pdf';\n else defaultFile\n \"\n >\n <img\n [class.image]=\"file.type.indexOf('image') > -1\"\n *ngIf=\"dataFile.ext === 'pdf' || dataFile.data\"\n [src]=\"dataFile.ext === 'pdf' ? base64Pdf : 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 {{ uploadAssetService.supportedTypes.join(', ') }}\n </div>\n <div *ngIf=\"dataFile.errors.size\" class=\"file-item__error\">\n {{ uploadAssetService.messageErrors['size'] }}\n {{ uploadAssetService.supportedSize | fileSize: 0 }}\n </div>\n</div>\n<div class=\"file-item__action\">\n <mat-icon (click)=\"onRemove()\">delete_outline</mat-icon>\n</div>\n",
2365
2370
  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:#f44336}:host::ng-deep .file-item__action{color:#f44336;cursor:pointer}"]
2366
2371
  }] }
2367
2372
  ];
@@ -3143,7 +3148,7 @@ var UploadDialogComponent = /** @class */ (function () {
3143
3148
  var _this = this;
3144
3149
  this.isLoading = true;
3145
3150
  this.uploadAssetsService
3146
- .uploadMultipleAssests(this.data.currentAssetId)
3151
+ .uploadMultipleAssets(this.data.currentAssetId)
3147
3152
  .pipe(takeUntil(this.destroy$))
3148
3153
  .subscribe((/**
3149
3154
  * @param {?} res
@@ -3742,7 +3747,8 @@ if (false) {
3742
3747
  IData$4.prototype.name;
3743
3748
  }
3744
3749
  var AssetDialogComponent = /** @class */ (function () {
3745
- function AssetDialogComponent(dialog, data, dialogRef, fileSize, assetService, fileService, domSanitizer, svc) {
3750
+ function AssetDialogComponent(_env, dialog, data, dialogRef, fileSize, assetService, fileService, domSanitizer, svc) {
3751
+ this._env = _env;
3746
3752
  this.dialog = dialog;
3747
3753
  this.data = data;
3748
3754
  this.dialogRef = dialogRef;
@@ -3771,7 +3777,7 @@ var AssetDialogComponent = /** @class */ (function () {
3771
3777
  * @return {?}
3772
3778
  */
3773
3779
  function () {
3774
- this.linkDownload = "https://sandboxunitedapi.relationshop.net/V6/Asset2/api/File/Download/" + this.data.assetId;
3780
+ this.linkDownload = this._env.asset2Url + "/File/Download/" + this.data.assetId;
3775
3781
  this.getAssetDetail();
3776
3782
  };
3777
3783
  Object.defineProperty(AssetDialogComponent.prototype, "disabled", {
@@ -3941,7 +3947,7 @@ var AssetDialogComponent = /** @class */ (function () {
3941
3947
  var errors = [];
3942
3948
  if (this.acceptTypes.indexOf(ext) < 0) {
3943
3949
  /** @type {?} */
3944
- var extError = this.assetService.messageErrors.ext + " " + this.acceptTypes.join(', ');
3950
+ var extError = this.assetService.messageErrors.replace + " " + this.acceptTypes.join(', ');
3945
3951
  errors.push(extError);
3946
3952
  }
3947
3953
  if (this.assetService.supportedSize < file.size) {
@@ -4049,6 +4055,7 @@ var AssetDialogComponent = /** @class */ (function () {
4049
4055
  ];
4050
4056
  /** @nocollapse */
4051
4057
  AssetDialogComponent.ctorParameters = function () { return [
4058
+ { type: undefined, decorators: [{ type: Inject, args: [AM_CONFIG,] }] },
4052
4059
  { type: MatDialog },
4053
4060
  { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
4054
4061
  { type: MatDialogRef },
@@ -4097,6 +4104,11 @@ if (false) {
4097
4104
  AssetDialogComponent.prototype.isUpdating;
4098
4105
  /** @type {?} */
4099
4106
  AssetDialogComponent.prototype.fileType;
4107
+ /**
4108
+ * @type {?}
4109
+ * @private
4110
+ */
4111
+ AssetDialogComponent.prototype._env;
4100
4112
  /**
4101
4113
  * @type {?}
4102
4114
  * @private
@@ -4949,9 +4961,10 @@ if (false) {
4949
4961
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4950
4962
  */
4951
4963
  var BreadcrumbComponent = /** @class */ (function () {
4952
- function BreadcrumbComponent(nodeTreeService, svc) {
4964
+ function BreadcrumbComponent(nodeTreeService, svc, changeDetectorRef) {
4953
4965
  this.nodeTreeService = nodeTreeService;
4954
4966
  this.svc = svc;
4967
+ this.changeDetectorRef = changeDetectorRef;
4955
4968
  this.unsubscribe$ = new Subject$1();
4956
4969
  this.currentFolderHierarchy = [];
4957
4970
  this.maximumShownLevel = 3;
@@ -5029,9 +5042,7 @@ var BreadcrumbComponent = /** @class */ (function () {
5029
5042
  case 0: return [4 /*yield*/, this.nodeTreeService.initialData({ dispatchRootId: true })];
5030
5043
  case 1:
5031
5044
  _a.sent();
5032
- this.svc.dispatch({
5033
- type: ActionTypes.RELOAD_CURRENT_NODE,
5034
- });
5045
+ this.changeDetectorRef.detectChanges();
5035
5046
  return [2 /*return*/];
5036
5047
  }
5037
5048
  });
@@ -5047,7 +5058,8 @@ var BreadcrumbComponent = /** @class */ (function () {
5047
5058
  /** @nocollapse */
5048
5059
  BreadcrumbComponent.ctorParameters = function () { return [
5049
5060
  { type: NodeTreeService },
5050
- { type: AssetManagementService }
5061
+ { type: AssetManagementService },
5062
+ { type: ChangeDetectorRef }
5051
5063
  ]; };
5052
5064
  return BreadcrumbComponent;
5053
5065
  }());
@@ -5071,6 +5083,11 @@ if (false) {
5071
5083
  * @private
5072
5084
  */
5073
5085
  BreadcrumbComponent.prototype.svc;
5086
+ /**
5087
+ * @type {?}
5088
+ * @private
5089
+ */
5090
+ BreadcrumbComponent.prototype.changeDetectorRef;
5074
5091
  }
5075
5092
 
5076
5093
  /**