@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
@@ -844,6 +844,9 @@
844
844
  if (isFilter && this.keyword.length) {
845
845
  params = params.set('keyword', this.keyword || '');
846
846
  }
847
+ if (this.dialogConfig.allowedType) {
848
+ params = params.set('fileType', this.dialogConfig.allowedType);
849
+ }
847
850
  return this._api.get(url, { params: params });
848
851
  };
849
852
  /**
@@ -1536,6 +1539,7 @@
1536
1539
  this.messageErrors = {
1537
1540
  size: "File size should be upto",
1538
1541
  ext: "Only supported file extension:",
1542
+ replace: "The replacement file should be the same extension with old one:",
1539
1543
  };
1540
1544
  this.errorObs$ = new rxjs.BehaviorSubject(true);
1541
1545
  this.baseUrl = this._env.asset2Url;
@@ -1667,7 +1671,7 @@
1667
1671
  * @param {?} parentAssetId
1668
1672
  * @return {?}
1669
1673
  */
1670
- UploadAssetsService.prototype.uploadMultipleAssests = /**
1674
+ UploadAssetsService.prototype.uploadMultipleAssets = /**
1671
1675
  * @param {?} parentAssetId
1672
1676
  * @return {?}
1673
1677
  */
@@ -1682,7 +1686,9 @@
1682
1686
  for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
1683
1687
  var file = files_1_1.value;
1684
1688
  /** @type {?} */
1685
- var ext = "." + file.type.split('/')[1];
1689
+ var nameSplit = file.name.split('.');
1690
+ /** @type {?} */
1691
+ var ext = "." + nameSplit.splice(nameSplit.length - 1, 1)[0];
1686
1692
  /** @type {?} */
1687
1693
  var originName = file.name;
1688
1694
  /** @type {?} */
@@ -2498,10 +2504,9 @@
2498
2504
  var _b = this.uploadAssetService, supportedTypes = _b.supportedTypes, supportedSize = _b.supportedSize;
2499
2505
  /** @type {?} */
2500
2506
  var nameSplit = file.name.split('.');
2501
- nameSplit.splice(nameSplit.length - 1, 1);
2507
+ this.dataFile.ext = nameSplit.splice(nameSplit.length - 1, 1)[0];
2502
2508
  this.dataFile.name = nameSplit.join('.');
2503
2509
  this.dataFile.size = file.size;
2504
- this.dataFile.ext = file.type.split('/')[1];
2505
2510
  this.dataFile.errors = {
2506
2511
  ext: supportedTypes.indexOf("." + this.dataFile.ext) < 0,
2507
2512
  size: supportedSize < this.dataFile.size,
@@ -2557,7 +2562,7 @@
2557
2562
  FileItemComponent.decorators = [
2558
2563
  { type: core.Component, args: [{
2559
2564
  selector: 'lib-file-item',
2560
- 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",
2565
+ 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",
2561
2566
  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}"]
2562
2567
  }] }
2563
2568
  ];
@@ -3339,7 +3344,7 @@
3339
3344
  var _this = this;
3340
3345
  this.isLoading = true;
3341
3346
  this.uploadAssetsService
3342
- .uploadMultipleAssests(this.data.currentAssetId)
3347
+ .uploadMultipleAssets(this.data.currentAssetId)
3343
3348
  .pipe(operators.takeUntil(this.destroy$))
3344
3349
  .subscribe((/**
3345
3350
  * @param {?} res
@@ -3938,7 +3943,8 @@
3938
3943
  IData$4.prototype.name;
3939
3944
  }
3940
3945
  var AssetDialogComponent = /** @class */ (function () {
3941
- function AssetDialogComponent(dialog, data, dialogRef, fileSize, assetService, fileService, domSanitizer, svc) {
3946
+ function AssetDialogComponent(_env, dialog, data, dialogRef, fileSize, assetService, fileService, domSanitizer, svc) {
3947
+ this._env = _env;
3942
3948
  this.dialog = dialog;
3943
3949
  this.data = data;
3944
3950
  this.dialogRef = dialogRef;
@@ -3967,7 +3973,7 @@
3967
3973
  * @return {?}
3968
3974
  */
3969
3975
  function () {
3970
- this.linkDownload = "https://sandboxunitedapi.relationshop.net/V6/Asset2/api/File/Download/" + this.data.assetId;
3976
+ this.linkDownload = this._env.asset2Url + "/File/Download/" + this.data.assetId;
3971
3977
  this.getAssetDetail();
3972
3978
  };
3973
3979
  Object.defineProperty(AssetDialogComponent.prototype, "disabled", {
@@ -4137,7 +4143,7 @@
4137
4143
  var errors = [];
4138
4144
  if (this.acceptTypes.indexOf(ext) < 0) {
4139
4145
  /** @type {?} */
4140
- var extError = this.assetService.messageErrors.ext + " " + this.acceptTypes.join(', ');
4146
+ var extError = this.assetService.messageErrors.replace + " " + this.acceptTypes.join(', ');
4141
4147
  errors.push(extError);
4142
4148
  }
4143
4149
  if (this.assetService.supportedSize < file.size) {
@@ -4245,6 +4251,7 @@
4245
4251
  ];
4246
4252
  /** @nocollapse */
4247
4253
  AssetDialogComponent.ctorParameters = function () { return [
4254
+ { type: undefined, decorators: [{ type: core.Inject, args: [AM_CONFIG,] }] },
4248
4255
  { type: dialog.MatDialog },
4249
4256
  { type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] },
4250
4257
  { type: dialog.MatDialogRef },
@@ -4293,6 +4300,11 @@
4293
4300
  AssetDialogComponent.prototype.isUpdating;
4294
4301
  /** @type {?} */
4295
4302
  AssetDialogComponent.prototype.fileType;
4303
+ /**
4304
+ * @type {?}
4305
+ * @private
4306
+ */
4307
+ AssetDialogComponent.prototype._env;
4296
4308
  /**
4297
4309
  * @type {?}
4298
4310
  * @private
@@ -5145,9 +5157,10 @@
5145
5157
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5146
5158
  */
5147
5159
  var BreadcrumbComponent = /** @class */ (function () {
5148
- function BreadcrumbComponent(nodeTreeService, svc) {
5160
+ function BreadcrumbComponent(nodeTreeService, svc, changeDetectorRef) {
5149
5161
  this.nodeTreeService = nodeTreeService;
5150
5162
  this.svc = svc;
5163
+ this.changeDetectorRef = changeDetectorRef;
5151
5164
  this.unsubscribe$ = new Subject.Subject();
5152
5165
  this.currentFolderHierarchy = [];
5153
5166
  this.maximumShownLevel = 3;
@@ -5225,9 +5238,7 @@
5225
5238
  case 0: return [4 /*yield*/, this.nodeTreeService.initialData({ dispatchRootId: true })];
5226
5239
  case 1:
5227
5240
  _a.sent();
5228
- this.svc.dispatch({
5229
- type: ActionTypes.RELOAD_CURRENT_NODE,
5230
- });
5241
+ this.changeDetectorRef.detectChanges();
5231
5242
  return [2 /*return*/];
5232
5243
  }
5233
5244
  });
@@ -5243,7 +5254,8 @@
5243
5254
  /** @nocollapse */
5244
5255
  BreadcrumbComponent.ctorParameters = function () { return [
5245
5256
  { type: NodeTreeService },
5246
- { type: AssetManagementService }
5257
+ { type: AssetManagementService },
5258
+ { type: core.ChangeDetectorRef }
5247
5259
  ]; };
5248
5260
  return BreadcrumbComponent;
5249
5261
  }());
@@ -5267,6 +5279,11 @@
5267
5279
  * @private
5268
5280
  */
5269
5281
  BreadcrumbComponent.prototype.svc;
5282
+ /**
5283
+ * @type {?}
5284
+ * @private
5285
+ */
5286
+ BreadcrumbComponent.prototype.changeDetectorRef;
5270
5287
  }
5271
5288
 
5272
5289
  /**