@acorex/platform 21.0.0-next.57 → 21.0.0-next.59

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.
@@ -28678,6 +28678,231 @@ var alertBoxWidgetDesigner_component = /*#__PURE__*/Object.freeze({
28678
28678
  AXPAlertBoxWidgetDesignerComponent: AXPAlertBoxWidgetDesignerComponent
28679
28679
  });
28680
28680
 
28681
+ const AXPBadgeLayoutWidget = {
28682
+ name: 'badge-layout',
28683
+ title: '@platform-layout-widgets:widgets.badge-layout.title',
28684
+ description: '@platform-layout-widgets:widgets.badge-layout.description',
28685
+ icon: 'fa-light fa-badge',
28686
+ categories: [AXP_WIDGETS_LAYOUT_CATEGORY],
28687
+ subCategory: AXP_WIDGETS_LAYOUT_SUB_UTILITY,
28688
+ groups: [AXPWidgetGroupEnum.FormElement],
28689
+ type: 'view',
28690
+ properties: [
28691
+ AXP_NAME_PROPERTY,
28692
+ AXP_DATA_PATH_PROPERTY,
28693
+ {
28694
+ name: 'text',
28695
+ title: 'Text',
28696
+ group: AXP_STYLING_PROPERTY_GROUP,
28697
+ schema: {
28698
+ dataType: 'string',
28699
+ defaultValue: '',
28700
+ interface: {
28701
+ name: 'text',
28702
+ path: 'options.text',
28703
+ type: AXPWidgetsCatalog.text,
28704
+ },
28705
+ },
28706
+ visible: true,
28707
+ },
28708
+ {
28709
+ name: 'color',
28710
+ title: 'Color',
28711
+ group: AXP_STYLING_PROPERTY_GROUP,
28712
+ schema: {
28713
+ dataType: 'string',
28714
+ defaultValue: 'primary',
28715
+ interface: {
28716
+ name: 'color',
28717
+ path: 'options.color',
28718
+ type: AXPWidgetsCatalog.select,
28719
+ valueTransforms: objectKeyValueTransforms('id'),
28720
+ options: {
28721
+ dataSource: [
28722
+ { id: 'primary', title: 'Primary' },
28723
+ { id: 'secondary', title: 'Secondary' },
28724
+ { id: 'success', title: 'Success' },
28725
+ { id: 'warning', title: 'Warning' },
28726
+ { id: 'danger', title: 'Danger' },
28727
+ { id: 'neutral', title: 'Neutral' },
28728
+ { id: 'ghost', title: 'Ghost' },
28729
+ { id: 'accent1', title: 'Accent 1' },
28730
+ { id: 'accent2', title: 'Accent 2' },
28731
+ { id: 'accent3', title: 'Accent 3' },
28732
+ ],
28733
+ },
28734
+ },
28735
+ },
28736
+ visible: true,
28737
+ },
28738
+ {
28739
+ name: 'icon',
28740
+ title: 'Icon',
28741
+ group: AXP_STYLING_PROPERTY_GROUP,
28742
+ schema: {
28743
+ dataType: 'string',
28744
+ defaultValue: '',
28745
+ interface: {
28746
+ name: 'icon',
28747
+ path: 'options.icon',
28748
+ type: AXPWidgetsCatalog.text,
28749
+ },
28750
+ },
28751
+ visible: true,
28752
+ },
28753
+ {
28754
+ name: 'look',
28755
+ title: 'Look',
28756
+ group: AXP_STYLING_PROPERTY_GROUP,
28757
+ schema: {
28758
+ dataType: 'string',
28759
+ defaultValue: 'twotone',
28760
+ interface: {
28761
+ name: 'look',
28762
+ path: 'options.look',
28763
+ type: AXPWidgetsCatalog.select,
28764
+ valueTransforms: objectKeyValueTransforms('id'),
28765
+ options: {
28766
+ dataSource: [
28767
+ { id: 'twotone', title: 'Twotone' },
28768
+ { id: 'solid', title: 'Solid' },
28769
+ { id: 'outline', title: 'Outline' },
28770
+ { id: 'blank', title: 'Blank' },
28771
+ ],
28772
+ },
28773
+ },
28774
+ },
28775
+ visible: true,
28776
+ },
28777
+ ],
28778
+ components: {
28779
+ view: {
28780
+ component: () => Promise.resolve().then(function () { return badgeWidgetView_component; }).then((c) => c.AXPBadgeLayoutWidgetViewComponent),
28781
+ },
28782
+ edit: {
28783
+ component: () => Promise.resolve().then(function () { return badgeWidgetView_component; }).then((c) => c.AXPBadgeLayoutWidgetViewComponent),
28784
+ },
28785
+ designer: {
28786
+ component: () => Promise.resolve().then(function () { return badgeWidgetView_component; }).then((c) => c.AXPBadgeLayoutWidgetViewComponent),
28787
+ },
28788
+ },
28789
+ };
28790
+
28791
+ class AXPBadgeLayoutWidgetViewComponent extends AXPValueWidgetComponent {
28792
+ constructor() {
28793
+ super(...arguments);
28794
+ //#region ---- Computed Properties ----
28795
+ this.resolvedValue = computed(() => this.normalizeValue(this.getValue()), ...(ngDevMode ? [{ debugName: "resolvedValue" }] : /* istanbul ignore next */ []));
28796
+ this.displayText = computed(() => {
28797
+ const value = this.resolvedValue();
28798
+ if (value?.text?.trim()) {
28799
+ return value.text.trim();
28800
+ }
28801
+ const optionText = this.options()['text'];
28802
+ return typeof optionText === 'string' ? optionText.trim() : '';
28803
+ }, ...(ngDevMode ? [{ debugName: "displayText" }] : /* istanbul ignore next */ []));
28804
+ this.displayColor = computed(() => this.resolveColor(this.resolvedValue()?.color ?? this.options()['color'], 'primary'), ...(ngDevMode ? [{ debugName: "displayColor" }] : /* istanbul ignore next */ []));
28805
+ this.displayIcon = computed(() => {
28806
+ const icon = this.resolvedValue()?.icon ?? this.options()['icon'];
28807
+ return typeof icon === 'string' && icon.trim().length > 0 ? icon.trim() : '';
28808
+ }, ...(ngDevMode ? [{ debugName: "displayIcon" }] : /* istanbul ignore next */ []));
28809
+ this.displayLook = computed(() => this.resolveLook(this.resolvedValue()?.look ?? this.options()['look'], 'twotone'), ...(ngDevMode ? [{ debugName: "displayLook" }] : /* istanbul ignore next */ []));
28810
+ this.hasValue = computed(() => this.displayText().length > 0, ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
28811
+ }
28812
+ //#endregion
28813
+ //#region ---- Utility Methods ----
28814
+ normalizeValue(value) {
28815
+ if (value == null) {
28816
+ return null;
28817
+ }
28818
+ if (typeof value === 'string') {
28819
+ return { text: value.trim() };
28820
+ }
28821
+ if (typeof value === 'object') {
28822
+ return value;
28823
+ }
28824
+ return null;
28825
+ }
28826
+ resolveColor(raw, fallback) {
28827
+ const id = typeof raw === 'string' ? raw : raw?.id;
28828
+ const allowed = [
28829
+ 'primary',
28830
+ 'secondary',
28831
+ 'success',
28832
+ 'warning',
28833
+ 'danger',
28834
+ 'neutral',
28835
+ 'ghost',
28836
+ 'accent1',
28837
+ 'accent2',
28838
+ 'accent3',
28839
+ ];
28840
+ if (id && allowed.includes(id)) {
28841
+ return id;
28842
+ }
28843
+ return fallback;
28844
+ }
28845
+ resolveLook(raw, fallback) {
28846
+ const id = typeof raw === 'string' ? raw : raw?.id;
28847
+ const allowed = ['solid', 'twotone', 'blank', 'outline'];
28848
+ if (id && allowed.includes(id)) {
28849
+ return id;
28850
+ }
28851
+ return fallback;
28852
+ }
28853
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBadgeLayoutWidgetViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
28854
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPBadgeLayoutWidgetViewComponent, isStandalone: true, selector: "axp-badge-layout-widget-view", host: { classAttribute: "axp-badge-layout-widget-view" }, usesInheritance: true, ngImport: i0, template: `
28855
+ @if (hasValue()) {
28856
+ <ax-badge
28857
+ class="__badge"
28858
+ [color]="displayColor()"
28859
+ [look]="displayLook()"
28860
+ [text]="(displayText() | translate | async)!"
28861
+ >
28862
+ @if (displayIcon()) {
28863
+ <ax-prefix class="__prefix">
28864
+ <ax-icon class="__icon">
28865
+ <i [class]="displayIcon()"></i>
28866
+ </ax-icon>
28867
+ </ax-prefix>
28868
+ }
28869
+ </ax-badge>
28870
+ } @else {
28871
+ <span class="ax-text-muted">---</span>
28872
+ }
28873
+ `, isInline: true, styles: [".axp-badge-layout-widget-view{display:inline-flex;min-width:0px}.axp-badge-layout-widget-view ax-badge.__badge{display:inline-flex;align-items:center;gap:.125rem;padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500;line-height:1}.axp-badge-layout-widget-view .__prefix{display:inline-flex;flex-shrink:0;align-items:center}.axp-badge-layout-widget-view .__icon{font-size:.85em;opacity:.9}\n"], dependencies: [{ kind: "ngmodule", type: AXBadgeModule }, { kind: "component", type: i1$2.AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2$1.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: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i6.AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
28874
+ }
28875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBadgeLayoutWidgetViewComponent, decorators: [{
28876
+ type: Component,
28877
+ args: [{ selector: 'axp-badge-layout-widget-view', host: {
28878
+ class: 'axp-badge-layout-widget-view',
28879
+ }, template: `
28880
+ @if (hasValue()) {
28881
+ <ax-badge
28882
+ class="__badge"
28883
+ [color]="displayColor()"
28884
+ [look]="displayLook()"
28885
+ [text]="(displayText() | translate | async)!"
28886
+ >
28887
+ @if (displayIcon()) {
28888
+ <ax-prefix class="__prefix">
28889
+ <ax-icon class="__icon">
28890
+ <i [class]="displayIcon()"></i>
28891
+ </ax-icon>
28892
+ </ax-prefix>
28893
+ }
28894
+ </ax-badge>
28895
+ } @else {
28896
+ <span class="ax-text-muted">---</span>
28897
+ }
28898
+ `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXBadgeModule, AXDecoratorModule, AXTranslationModule, AsyncPipe], styles: [".axp-badge-layout-widget-view{display:inline-flex;min-width:0px}.axp-badge-layout-widget-view ax-badge.__badge{display:inline-flex;align-items:center;gap:.125rem;padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500;line-height:1}.axp-badge-layout-widget-view .__prefix{display:inline-flex;flex-shrink:0;align-items:center}.axp-badge-layout-widget-view .__icon{font-size:.85em;opacity:.9}\n"] }]
28899
+ }] });
28900
+
28901
+ var badgeWidgetView_component = /*#__PURE__*/Object.freeze({
28902
+ __proto__: null,
28903
+ AXPBadgeLayoutWidgetViewComponent: AXPBadgeLayoutWidgetViewComponent
28904
+ });
28905
+
28681
28906
  class AXPIconWidgetViewComponent extends AXPColumnWidgetComponent {
28682
28907
  //#region ---- Methods ----
28683
28908
  /**
@@ -29815,6 +30040,7 @@ const REGISTERED_WIDGETS = [
29815
30040
  AXPRepeaterWidget,
29816
30041
  AXPTextBlockWidget,
29817
30042
  AXPAlertBoxWidget,
30043
+ AXPBadgeLayoutWidget,
29818
30044
  AXPFormFieldWidget,
29819
30045
  AXPGridWidget,
29820
30046
  AXPAdvancedGridWidget,