@acorex/platform 20.7.4 → 20.7.6

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.
@@ -86,6 +86,8 @@ import { AXUploaderZoneDirective } from '@acorex/cdk/uploader';
86
86
  import { AXUploaderModule } from '@acorex/components/uploader';
87
87
  import * as i1$d from '@acorex/components/media-viewer';
88
88
  import { AXMediaViewerModule } from '@acorex/components/media-viewer';
89
+ import * as i4$2 from '@acorex/components/menu';
90
+ import { AXMenuModule } from '@acorex/components/menu';
89
91
  import * as i1$e from '@acorex/components/image';
90
92
  import { AXImageModule } from '@acorex/components/image';
91
93
  import * as i1$f from '@acorex/components/json-viewer';
@@ -11435,7 +11437,12 @@ class AXPGalleryWidgetEditComponent extends AXPValueWidgetComponent {
11435
11437
  },
11436
11438
  addFiles: (files) => {
11437
11439
  const currentFiles = this.getValue() ?? [];
11438
- this.setValue([...currentFiles, ...files]);
11440
+ const newValue = [...currentFiles, ...files];
11441
+ this.setValue(newValue);
11442
+ // Navigate to the last item after view updates
11443
+ setTimeout(() => {
11444
+ this.gallery()?.goToIndex(newValue.length - 1);
11445
+ }, 1000);
11439
11446
  },
11440
11447
  updateFile: (predicate, updater) => {
11441
11448
  const currentFiles = this.getValue() ?? [];
@@ -11484,6 +11491,25 @@ class AXPGalleryWidgetEditComponent extends AXPValueWidgetComponent {
11484
11491
  const actions = await this.fileActionsService.getActions(payload);
11485
11492
  this.innerActions.set(actions);
11486
11493
  }
11494
+ /**
11495
+ * Format file size with appropriate unit (B, KB, MB, GB, etc.)
11496
+ * Divides by 1000 until the value is less than 1000
11497
+ */
11498
+ formatFileSize(size) {
11499
+ if (!size) {
11500
+ return '';
11501
+ }
11502
+ const units = ['B', 'KB', 'MB', 'GB', 'TB'];
11503
+ let value = size;
11504
+ let unitIndex = 0;
11505
+ while (value >= 1000 && unitIndex < units.length - 1) {
11506
+ value /= 1000;
11507
+ unitIndex++;
11508
+ }
11509
+ // Round to 2 decimal places, but remove trailing zeros
11510
+ const roundedValue = Math.round(value * 100) / 100;
11511
+ return `${roundedValue} ${units[unitIndex]}`;
11512
+ }
11487
11513
  /**
11488
11514
  * Convert AXPFileListItem to AXMediaViewerData for display in media viewer
11489
11515
  */
@@ -11498,7 +11524,7 @@ class AXPGalleryWidgetEditComponent extends AXPValueWidgetComponent {
11498
11524
  name: file.name,
11499
11525
  type: 'image',
11500
11526
  url: url,
11501
- size: file.size?.toString() ?? '',
11527
+ size: this.formatFileSize(file.size),
11502
11528
  };
11503
11529
  }
11504
11530
  /**
@@ -11544,38 +11570,41 @@ class AXPGalleryWidgetEditComponent extends AXPValueWidgetComponent {
11544
11570
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AXPGalleryWidgetEditComponent, isStandalone: true, selector: "axp-gallery-widget-edit", host: { properties: { "style.height": "height()" }, classAttribute: "ax-block" }, viewQueries: [{ propertyName: "gallery", first: true, predicate: ["c"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: ` <ax-media-viewer-container [thumbnail]="thumbnail()" #c [dataArray]="mediaViewerData()">
11545
11571
  @if (header()) {
11546
11572
  <ax-header>
11547
- @if (fileInfo()) {
11548
- <ax-prefix> <ax-file-info></ax-file-info></ax-prefix>
11549
- }
11550
- <ax-suffix>
11551
- @if (allowUpload()) {
11573
+ @if (allowUpload()) {
11574
+ <ax-prefix>
11552
11575
  <div *translate="let t">
11553
- <ax-button class="ax-sm" [text]="t('@general:actions.add-item.title') | async" [color]="'primary'">
11554
- <ax-prefix>
11555
- <ax-icon icon="fa-light fa-plus"></ax-icon>
11556
- </ax-prefix>
11557
- <ax-dropdown-panel>
11558
- <ax-button-item-list>
11559
-
11560
- <ng-container>
11561
- @for (action of fileActions(); track action.plugin) {
11562
- <ax-button-item
11563
- (onClick)="action.run(capabilities)"
11564
- [text]="action.text ?? (action.textKey ? (t(action.textKey) | async)! : '')"
11565
- >
11566
- @if (action.icon) {
11567
- <ax-prefix>
11568
- <ax-icon [icon]="action.icon"></ax-icon>
11569
- </ax-prefix>
11570
- }
11571
- </ax-button-item>
11576
+ <ax-menu
11577
+ [openOn]="'click'"
11578
+ [hasArrow]="true"
11579
+ style="--ax-comp-menu-action-list-horizontal-min-width:auto"
11580
+ >
11581
+ <ax-menu-item>
11582
+ <ax-prefix>
11583
+ <ax-icon icon="fa-light fa-plus"></ax-icon>
11584
+ </ax-prefix>
11585
+ <ax-text>{{ (t('@general:actions.add-item.title') | async)! }}</ax-text>
11586
+
11587
+ @for (action of fileActions(); track action.plugin) {
11588
+ <ax-menu-item (onClick)="action.run(capabilities)">
11589
+ @if (action.icon) {
11590
+ <ax-prefix>
11591
+ <ax-icon [icon]="action.icon"></ax-icon>
11592
+ </ax-prefix>
11572
11593
  }
11573
- </ng-container>
11574
- </ax-button-item-list>
11575
- </ax-dropdown-panel>
11576
- </ax-button>
11594
+ <ax-text>{{ action.text ?? (action.textKey ? (t(action.textKey) | async)! : '') }}</ax-text>
11595
+ </ax-menu-item>
11596
+ }
11597
+ </ax-menu-item>
11598
+ </ax-menu>
11577
11599
  </div>
11578
- }
11600
+ </ax-prefix>
11601
+ }
11602
+
11603
+ @if (fileInfo()) {
11604
+ <ax-file-info></ax-file-info>
11605
+ }
11606
+
11607
+ <ax-suffix>
11579
11608
  @if (fullScreenButton()) {
11580
11609
  <ax-fullscreen-button> </ax-fullscreen-button>
11581
11610
  }
@@ -11584,17 +11613,17 @@ class AXPGalleryWidgetEditComponent extends AXPValueWidgetComponent {
11584
11613
  }
11585
11614
 
11586
11615
  <ax-prefix>
11587
- <ax-button class="ax-sm" (click)="c.next()">
11616
+ <ax-button class="ax-sm" (click)="c.next()" [disabled]="c.getActiveIndex() === this.mediaViewerData().length - 1">
11588
11617
  <ax-icon class="rtl:ax-rotate-180 ax-icon ax-icon-chevron-right"> </ax-icon>
11589
11618
  </ax-button>
11590
11619
  </ax-prefix>
11591
11620
 
11592
11621
  <ax-suffix>
11593
- <ax-button class="ax-sm" (click)="c.prev()">
11622
+ <ax-button class="ax-sm" (click)="c.prev()" [disabled]="c.getActiveIndex() === 0">
11594
11623
  <ax-icon class="rtl:ax-rotate-180 ax-icon ax-icon-chevron-left"> </ax-icon>
11595
11624
  </ax-button>
11596
11625
  </ax-suffix>
11597
- </ax-media-viewer-container>`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXMediaViewerModule }, { kind: "component", type: i1$d.AXMediaViewerContainerComponent, selector: "ax-media-viewer-container", inputs: ["dataArray", "thumbnail", "pagination"] }, { kind: "component", type: i1$d.AXFileInfoComponent, selector: "ax-file-info" }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: i2.AXDecoratorFullScreenButtonComponent, selector: "ax-fullscreen-button", inputs: ["element", "isActive"], outputs: ["elementChange", "isActiveChange"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i1.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i1.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: AXDropdownModule }, { kind: "component", type: i5$1.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "placement", "_target", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11626
+ </ax-media-viewer-container>`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXMediaViewerModule }, { kind: "component", type: i1$d.AXMediaViewerContainerComponent, selector: "ax-media-viewer-container", inputs: ["dataArray", "thumbnail", "pagination"] }, { kind: "component", type: i1$d.AXFileInfoComponent, selector: "ax-file-info" }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: i2.AXDecoratorFullScreenButtonComponent, selector: "ax-fullscreen-button", inputs: ["element", "isActive"], outputs: ["elementChange", "isActiveChange"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXMenuModule }, { kind: "component", type: i4$2.AXMenuItemComponent, selector: "ax-menu-item", inputs: ["name", "data", "disabled", "color"], outputs: ["onClick"] }, { kind: "component", type: i4$2.AXMenuComponent, selector: "ax-menu", inputs: ["orientation", "openOn", "closeOn", "items", "hasArrow"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11598
11627
  }
11599
11628
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPGalleryWidgetEditComponent, decorators: [{
11600
11629
  type: Component,
@@ -11603,38 +11632,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11603
11632
  template: ` <ax-media-viewer-container [thumbnail]="thumbnail()" #c [dataArray]="mediaViewerData()">
11604
11633
  @if (header()) {
11605
11634
  <ax-header>
11606
- @if (fileInfo()) {
11607
- <ax-prefix> <ax-file-info></ax-file-info></ax-prefix>
11608
- }
11609
- <ax-suffix>
11610
- @if (allowUpload()) {
11635
+ @if (allowUpload()) {
11636
+ <ax-prefix>
11611
11637
  <div *translate="let t">
11612
- <ax-button class="ax-sm" [text]="t('@general:actions.add-item.title') | async" [color]="'primary'">
11613
- <ax-prefix>
11614
- <ax-icon icon="fa-light fa-plus"></ax-icon>
11615
- </ax-prefix>
11616
- <ax-dropdown-panel>
11617
- <ax-button-item-list>
11618
-
11619
- <ng-container>
11620
- @for (action of fileActions(); track action.plugin) {
11621
- <ax-button-item
11622
- (onClick)="action.run(capabilities)"
11623
- [text]="action.text ?? (action.textKey ? (t(action.textKey) | async)! : '')"
11624
- >
11625
- @if (action.icon) {
11626
- <ax-prefix>
11627
- <ax-icon [icon]="action.icon"></ax-icon>
11628
- </ax-prefix>
11629
- }
11630
- </ax-button-item>
11638
+ <ax-menu
11639
+ [openOn]="'click'"
11640
+ [hasArrow]="true"
11641
+ style="--ax-comp-menu-action-list-horizontal-min-width:auto"
11642
+ >
11643
+ <ax-menu-item>
11644
+ <ax-prefix>
11645
+ <ax-icon icon="fa-light fa-plus"></ax-icon>
11646
+ </ax-prefix>
11647
+ <ax-text>{{ (t('@general:actions.add-item.title') | async)! }}</ax-text>
11648
+
11649
+ @for (action of fileActions(); track action.plugin) {
11650
+ <ax-menu-item (onClick)="action.run(capabilities)">
11651
+ @if (action.icon) {
11652
+ <ax-prefix>
11653
+ <ax-icon [icon]="action.icon"></ax-icon>
11654
+ </ax-prefix>
11631
11655
  }
11632
- </ng-container>
11633
- </ax-button-item-list>
11634
- </ax-dropdown-panel>
11635
- </ax-button>
11656
+ <ax-text>{{ action.text ?? (action.textKey ? (t(action.textKey) | async)! : '') }}</ax-text>
11657
+ </ax-menu-item>
11658
+ }
11659
+ </ax-menu-item>
11660
+ </ax-menu>
11636
11661
  </div>
11637
- }
11662
+ </ax-prefix>
11663
+ }
11664
+
11665
+ @if (fileInfo()) {
11666
+ <ax-file-info></ax-file-info>
11667
+ }
11668
+
11669
+ <ax-suffix>
11638
11670
  @if (fullScreenButton()) {
11639
11671
  <ax-fullscreen-button> </ax-fullscreen-button>
11640
11672
  }
@@ -11643,13 +11675,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11643
11675
  }
11644
11676
 
11645
11677
  <ax-prefix>
11646
- <ax-button class="ax-sm" (click)="c.next()">
11678
+ <ax-button class="ax-sm" (click)="c.next()" [disabled]="c.getActiveIndex() === this.mediaViewerData().length - 1">
11647
11679
  <ax-icon class="rtl:ax-rotate-180 ax-icon ax-icon-chevron-right"> </ax-icon>
11648
11680
  </ax-button>
11649
11681
  </ax-prefix>
11650
11682
 
11651
11683
  <ax-suffix>
11652
- <ax-button class="ax-sm" (click)="c.prev()">
11684
+ <ax-button class="ax-sm" (click)="c.prev()" [disabled]="c.getActiveIndex() === 0">
11653
11685
  <ax-icon class="rtl:ax-rotate-180 ax-icon ax-icon-chevron-left"> </ax-icon>
11654
11686
  </ax-button>
11655
11687
  </ax-suffix>
@@ -11659,14 +11691,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11659
11691
  '[style.height]': 'height()',
11660
11692
  },
11661
11693
  changeDetection: ChangeDetectionStrategy.OnPush,
11662
- imports: [
11663
- AXMediaViewerModule,
11664
- AXDecoratorModule,
11665
- AXButtonModule,
11666
- AXDropdownModule,
11667
- AXTranslationModule,
11668
- AsyncPipe,
11669
- ],
11694
+ imports: [AXMediaViewerModule, AXDecoratorModule, AXButtonModule, AXMenuModule, AXTranslationModule, AsyncPipe],
11670
11695
  }]
11671
11696
  }], propDecorators: { gallery: [{ type: i0.ViewChild, args: ['c', { isSignal: true }] }] } });
11672
11697