@acorex/platform 19.2.7 → 19.2.8

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 (29) hide show
  1. package/common/lib/app/application.types.d.ts +1 -0
  2. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  3. package/fesm2022/acorex-platform-layout-builder.mjs +9 -0
  4. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-layout-entity.mjs +26 -12
  6. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-themes-default.mjs +4 -4
  8. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-B90if8wb.mjs +272 -0
  11. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-B90if8wb.mjs.map +1 -0
  12. package/fesm2022/{acorex-platform-widgets-tabular-data-view-popup.component-BBRVgZLu.mjs → acorex-platform-widgets-tabular-data-view-popup.component-BaslkAPS.mjs} +16 -1
  13. package/fesm2022/acorex-platform-widgets-tabular-data-view-popup.component-BaslkAPS.mjs.map +1 -0
  14. package/fesm2022/acorex-platform-widgets.mjs +310 -112
  15. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  16. package/layout/builder/lib/builder/widget-renderer.directive.d.ts +3 -0
  17. package/layout/entity/lib/entity.viewmodel.d.ts +1 -0
  18. package/package.json +5 -5
  19. package/widgets/lib/widgets/charts/bar-chart/bar-chart-widget-edit.component.d.ts +23 -3
  20. package/widgets/lib/widgets/charts/bar-chart/bar-chart.type.d.ts +20 -6
  21. package/widgets/lib/widgets/editors/date-time/date-time-box-widget-edit.component.d.ts +1 -3
  22. package/widgets/lib/widgets/editors/rich-text/rich-text-widget-edit.component.d.ts +4 -1
  23. package/widgets/lib/widgets/editors/tabular-data/tabular-data-edit-popup.component.d.ts +11 -2
  24. package/widgets/lib/widgets/editors/tabular-data/tabular-data-view-popup.component.d.ts +3 -1
  25. package/widgets/lib/widgets/editors/tabular-data/tabular-data-widget-edit.component.d.ts +1 -1
  26. package/widgets/lib/widgets/editors/tabular-data/tabular-data-widget-view.component.d.ts +0 -2
  27. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-D2-nHqYy.mjs +0 -144
  28. package/fesm2022/acorex-platform-widgets-tabular-data-edit-popup.component-D2-nHqYy.mjs.map +0 -1
  29. package/fesm2022/acorex-platform-widgets-tabular-data-view-popup.component-BBRVgZLu.mjs.map +0 -1
@@ -12,7 +12,7 @@ import { AXLoadingModule } from '@acorex/components/loading';
12
12
  import * as i1$1 from '@angular/common';
13
13
  import { CommonModule } from '@angular/common';
14
14
  import * as i0 from '@angular/core';
15
- import { computed, EventEmitter, Component, ChangeDetectionStrategy, inject, afterNextRender, HostBinding, signal, effect, ViewEncapsulation, InjectionToken, ViewChild, untracked, ChangeDetectorRef, viewChild, ElementRef, afterRender, NgZone, model, input, linkedSignal, HostListener, NgModule } from '@angular/core';
15
+ import { computed, EventEmitter, Component, ChangeDetectionStrategy, inject, afterNextRender, HostBinding, signal, ViewEncapsulation, InjectionToken, effect, ViewChild, untracked, ChangeDetectorRef, viewChild, ElementRef, afterRender, NgZone, model, input, linkedSignal, HostListener, NgModule } from '@angular/core';
16
16
  import * as i1 from '@acorex/components/check-box';
17
17
  import { AXCheckBoxModule } from '@acorex/components/check-box';
18
18
  import * as i3$1 from '@acorex/components/form';
@@ -1794,7 +1794,7 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPWidgetComponent {
1794
1794
  this.disabled = computed(() => this.options()['disabled']);
1795
1795
  this.placeholder = computed(() => this.options()['placeholder']);
1796
1796
  this.internalValue = computed(() => Array.isArray(this.getValue()) ? this.getValue() : [this.getValue()]);
1797
- this._validationRules = [];
1797
+ this.validationRules = computed(() => this.options()['validationRules'] ?? []);
1798
1798
  this.calendarFormat = computed(() => {
1799
1799
  if (this.format() === 'date')
1800
1800
  return 'dd/MM/yyyy';
@@ -1804,12 +1804,6 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPWidgetComponent {
1804
1804
  return 'dd/MM/yyyy HH:mm';
1805
1805
  });
1806
1806
  }
1807
- get validationRules() {
1808
- return this._validationRules;
1809
- }
1810
- set validationRules(v) {
1811
- this._validationRules = v;
1812
- }
1813
1807
  handleValueChange(e, i) {
1814
1808
  if (e.isUserInteraction) {
1815
1809
  const newValues = this.internalValue().map((item, index) => (i === index ? e.value : item));
@@ -1845,7 +1839,7 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPWidgetComponent {
1845
1839
  [format]="calendarFormat()"
1846
1840
  [placeholder]="placeholder()"
1847
1841
  >
1848
- @for (validation of validationRules; track $index) {
1842
+ @for (validation of validationRules(); track $index) {
1849
1843
  <ax-validation-rule
1850
1844
  [rule]="validation.rule"
1851
1845
  [message]="validation.options?.message"
@@ -1887,7 +1881,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1887
1881
  [format]="calendarFormat()"
1888
1882
  [placeholder]="placeholder()"
1889
1883
  >
1890
- @for (validation of validationRules; track $index) {
1884
+ @for (validation of validationRules(); track $index) {
1891
1885
  <ax-validation-rule
1892
1886
  [rule]="validation.rule"
1893
1887
  [message]="validation.options?.message"
@@ -4446,16 +4440,19 @@ class AXPRichTextWidgetEditComponent extends AXPWidgetComponent {
4446
4440
  super(...arguments);
4447
4441
  this.placeholder = computed(() => this.options()['placeholder']);
4448
4442
  this.disabled = computed(() => this.options()['disabled']);
4443
+ this.minLineCount = computed(() => this.options()['minLineCount'] ?? 3);
4444
+ this.maxLineCount = computed(() => this.options()['maxLineCount'] ?? 3);
4445
+ this.isFitLine = computed(() => this.options()['fitLineCount'] ?? false);
4449
4446
  this.validationRules = computed(() => this.options()['validationRules'] ?? []);
4450
- this.eff = effect(() => {
4451
- console.log(this.getValue());
4452
- });
4453
4447
  }
4454
4448
  setWysiwyg(e) {
4455
4449
  if (e) {
4456
4450
  this.setValue(e.value);
4457
4451
  }
4458
4452
  }
4453
+ getLinePx(count) {
4454
+ return 24 + 18.46 * count + 'px';
4455
+ }
4459
4456
  get __class() {
4460
4457
  const cls = {};
4461
4458
  cls[`ax-block`] = true;
@@ -4469,7 +4466,11 @@ class AXPRichTextWidgetEditComponent extends AXPWidgetComponent {
4469
4466
  [ngModel]="getValue()"
4470
4467
  (onValueChanged)="setWysiwyg($event)"
4471
4468
  >
4472
- <ax-wysiwyg-view class="ax-min-h-28"></ax-wysiwyg-view>
4469
+ <ax-wysiwyg-view
4470
+ [style.min-height]="getLinePx(minLineCount())"
4471
+ [style.max-height]="getLinePx(maxLineCount())"
4472
+ [style.height]="'fit-content !important'"
4473
+ ></ax-wysiwyg-view>
4473
4474
  <!-- <ax-wysiwyg-toolbar>
4474
4475
  <ax-wysiwyg-history></ax-wysiwyg-history>
4475
4476
  <ax-wysiwyg-font-style></ax-wysiwyg-font-style>
@@ -4510,7 +4511,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
4510
4511
  [ngModel]="getValue()"
4511
4512
  (onValueChanged)="setWysiwyg($event)"
4512
4513
  >
4513
- <ax-wysiwyg-view class="ax-min-h-28"></ax-wysiwyg-view>
4514
+ <ax-wysiwyg-view
4515
+ [style.min-height]="getLinePx(minLineCount())"
4516
+ [style.max-height]="getLinePx(maxLineCount())"
4517
+ [style.height]="'fit-content !important'"
4518
+ ></ax-wysiwyg-view>
4514
4519
  <!-- <ax-wysiwyg-toolbar>
4515
4520
  <ax-wysiwyg-history></ax-wysiwyg-history>
4516
4521
  <ax-wysiwyg-font-style></ax-wysiwyg-font-style>
@@ -4654,7 +4659,7 @@ const AXPRichTextWidget = {
4654
4659
  AXP_DATA_PATH_PROPERTY,
4655
4660
  AXP_ALLOW_MULTIPLE_PROPERTY,
4656
4661
  AXP_DISABLED_PROPERTY,
4657
- AXP_VALIDATION_PROPERTY,
4662
+ // AXP_VALIDATION_PROPERTY,
4658
4663
  AXP_PLACEHOLDER_PROPERTY,
4659
4664
  //cloneProperty(AXP_TABLE_COLUMN_WIDTH_PROPERTY, { schema: { defaultValue: '300px' } }),
4660
4665
  ],
@@ -5613,7 +5618,7 @@ const AXP_REQUIRED_VALIDATION_PROPERTY = {
5613
5618
  name: 'requiredValidation',
5614
5619
  path: 'options.requiredValidation',
5615
5620
  type: AXPWidgetsCatalog.requiredValidation,
5616
- // defaultValue: false,
5621
+ defaultValue: false,
5617
5622
  },
5618
5623
  },
5619
5624
  visible: true,
@@ -5628,7 +5633,7 @@ const AXP_MIN_LENGTH_VALIDATION_PROPERTY = {
5628
5633
  name: 'minLengthValidation',
5629
5634
  path: 'options.minLengthValidation',
5630
5635
  type: AXPWidgetsCatalog.minLengthValidation,
5631
- // defaultValue: false,
5636
+ defaultValue: false,
5632
5637
  },
5633
5638
  },
5634
5639
  visible: true,
@@ -5643,7 +5648,7 @@ const AXP_MAX_LENGTH_VALIDATION_PROPERTY = {
5643
5648
  name: 'maxLengthValidation',
5644
5649
  path: 'options.maxLengthValidation',
5645
5650
  type: AXPWidgetsCatalog.maxLengthValidation,
5646
- // defaultValue: false,
5651
+ defaultValue: false,
5647
5652
  },
5648
5653
  },
5649
5654
  visible: true,
@@ -5658,7 +5663,7 @@ const AXP_REGULAR_EXPRESSION_VALIDATION_PROPERTY = {
5658
5663
  name: 'regularExpressionValidation',
5659
5664
  path: 'options.regularExpressionValidation',
5660
5665
  type: AXPWidgetsCatalog.regularExpressionValidation,
5661
- // defaultValue: false,
5666
+ defaultValue: false,
5662
5667
  },
5663
5668
  },
5664
5669
  visible: true,
@@ -5673,7 +5678,7 @@ const AXP_LESS_THAN_VALIDATION_PROPERTY = {
5673
5678
  name: 'lessThanValidation',
5674
5679
  path: 'options.lessThanValidation',
5675
5680
  type: AXPWidgetsCatalog.lessThanValidation,
5676
- // defaultValue: false,
5681
+ defaultValue: false,
5677
5682
  },
5678
5683
  },
5679
5684
  visible: true,
@@ -5688,7 +5693,7 @@ const AXP_GREATER_THAN_VALIDATION_PROPERTY = {
5688
5693
  name: 'greaterThanValidation',
5689
5694
  path: 'options.greaterThanValidation',
5690
5695
  type: AXPWidgetsCatalog.greaterThanValidation,
5691
- // defaultValue: false,
5696
+ defaultValue: false,
5692
5697
  },
5693
5698
  },
5694
5699
  visible: true,
@@ -5703,7 +5708,7 @@ const AXP_BETWEEN_VALIDATION_PROPERTY = {
5703
5708
  name: 'betweenValidation',
5704
5709
  path: 'options.betweenValidation',
5705
5710
  type: AXPWidgetsCatalog.betweenValidation,
5706
- // defaultValue: false,
5711
+ defaultValue: false,
5707
5712
  },
5708
5713
  },
5709
5714
  visible: true,
@@ -5718,7 +5723,7 @@ const AXP_EQUAL_VALIDATION_PROPERTY = {
5718
5723
  name: 'equalValidation',
5719
5724
  path: 'options.equalValidation',
5720
5725
  type: AXPWidgetsCatalog.equalValidation,
5721
- // defaultValue: false,
5726
+ defaultValue: false,
5722
5727
  },
5723
5728
  },
5724
5729
  visible: true,
@@ -5733,7 +5738,7 @@ const AXP_CALLBACK_VALIDATION_PROPERTY = {
5733
5738
  name: 'callbackValidation',
5734
5739
  path: 'options.callbackValidation',
5735
5740
  type: AXPWidgetsCatalog.callbackValidation,
5736
- // defaultValue: false,
5741
+ defaultValue: false,
5737
5742
  },
5738
5743
  },
5739
5744
  visible: true,
@@ -5752,7 +5757,6 @@ const AXPTextBoxWidget = {
5752
5757
  AXP_DATA_PATH_PROPERTY,
5753
5758
  AXP_ALLOW_MULTIPLE_PROPERTY,
5754
5759
  AXP_DISABLED_PROPERTY,
5755
- AXP_VALIDATION_PROPERTY,
5756
5760
  AXP_PLACEHOLDER_PROPERTY,
5757
5761
  AXP_HAS_CLEAR_BUTTON_PROPERTY,
5758
5762
  plainTextDefaultProperty(),
@@ -11538,101 +11542,311 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11538
11542
  constructor() {
11539
11543
  super(...arguments);
11540
11544
  this.chartEl = viewChild.required('chart');
11541
- this.af = afterNextRender(async () => {
11545
+ this.data = linkedSignal(() => this.getValue());
11546
+ this.isRendered = false;
11547
+ this.#af = afterNextRender(async () => {
11542
11548
  await this.loadD3();
11543
- this.createChart();
11549
+ this.initializeChart();
11550
+ this.isRendered = true;
11551
+ });
11552
+ this.#eff = effect(() => {
11553
+ this.data();
11554
+ if (this.isRendered) {
11555
+ this.updateChart(this.data());
11556
+ }
11544
11557
  });
11545
11558
  }
11559
+ #af;
11560
+ #eff;
11546
11561
  async loadD3() {
11547
11562
  try {
11548
11563
  this.d3 = await import('d3');
11549
- window.d3 = this.d3;
11550
11564
  }
11551
11565
  catch (error) {
11552
11566
  console.error('Failed to load D3.js:', error);
11553
11567
  }
11554
11568
  }
11555
- createChart() {
11556
- const chartElement = this.chartEl().nativeElement;
11557
- this.d3.select(chartElement).selectAll('*').remove();
11558
- const width = this.getValue().options.width;
11559
- const height = this.getValue().options.height;
11560
- const margin = { top: 30, right: 0, bottom: 30, left: 40 };
11561
- const x = this.d3
11569
+ initializeChart() {
11570
+ const chartValue = this.data();
11571
+ const { width, height, margin } = this.getChartDimensions(chartValue.options);
11572
+ this.svg = this.d3.select(this.chartEl().nativeElement).append('svg').attr('width', width).attr('height', height);
11573
+ this.drawChart(chartValue);
11574
+ }
11575
+ drawChart(chartValue) {
11576
+ const { data, options } = chartValue;
11577
+ const { width, height, margin } = this.getChartDimensions(options);
11578
+ const x = this.createXScale(data, width, margin);
11579
+ const y = this.createYScale(data, height, margin);
11580
+ this.drawBars(data, x, y, height, margin, options);
11581
+ this.drawAxes(x, y, height, margin, options);
11582
+ if (options.enableTooltip) {
11583
+ this.addTooltips(data, x, y, options);
11584
+ }
11585
+ if (options.enableLegend) {
11586
+ this.addLegend(data, width, margin, options);
11587
+ }
11588
+ if (options.enableZoom) {
11589
+ this.addZoom();
11590
+ }
11591
+ if (options.enableExport) {
11592
+ this.addExportButton();
11593
+ }
11594
+ }
11595
+ updateChart(chartValue) {
11596
+ const { data, options } = chartValue;
11597
+ const { width, height, margin } = this.getChartDimensions(options);
11598
+ const x = this.createXScale(data, width, margin);
11599
+ const y = this.createYScale(data, height, margin);
11600
+ this.updateBars(data, x, y, height, margin, options);
11601
+ this.updateAxes(x, y, height, margin, options);
11602
+ if (options.enableTooltip) {
11603
+ this.updateTooltips(data, x, y, options);
11604
+ }
11605
+ if (options.enableLegend) {
11606
+ this.updateLegend(data, width, margin, options);
11607
+ }
11608
+ }
11609
+ getChartDimensions(options) {
11610
+ const width = options.width || 400;
11611
+ const height = options.height || 200;
11612
+ const margin = options.margin || { top: 20, right: 20, bottom: 30, left: 40 };
11613
+ return { width, height, margin };
11614
+ }
11615
+ createXScale(data, width, margin) {
11616
+ return this.d3
11562
11617
  .scaleBand()
11563
- .domain(this.getValue().data.map((d) => d.name))
11618
+ .domain(data.map((d) => d.name)) // Use name instead of id
11564
11619
  .range([margin.left, width - margin.right])
11565
11620
  .padding(0.1);
11566
- const y = this.d3
11621
+ }
11622
+ createYScale(data, height, margin) {
11623
+ return this.d3
11567
11624
  .scaleLinear()
11568
- .domain([0, this.d3.max(this.getValue().data, (d) => d.value)])
11625
+ .domain([0, this.d3.max(data, (d) => d.value)])
11626
+ .nice()
11569
11627
  .range([height - margin.bottom, margin.top]);
11570
- const svg = this.d3
11571
- .select(chartElement)
11572
- .append('svg')
11573
- .attr('width', width)
11574
- .attr('height', height)
11575
- .attr('viewBox', [0, 0, width, height])
11576
- .style('max-width', '100%')
11577
- .style('height', 'auto');
11578
- // Add the vertical line on the y-axis
11579
- svg
11580
- .append('line')
11581
- .attr('x1', margin.left)
11582
- .attr('y1', margin.top)
11583
- .attr('x2', margin.left)
11584
- .attr('y2', height - margin.bottom)
11585
- .attr('stroke', 'black')
11586
- .attr('stroke-width', 1);
11587
- // Add the bars
11588
- svg
11589
- .append('g')
11628
+ }
11629
+ drawBars(data, x, y, height, margin, options) {
11630
+ this.svg
11590
11631
  .selectAll('rect')
11591
- .data(this.getValue().data)
11592
- .join('rect')
11593
- .attr('fill', (d) => d.color || this.getValue().options.color || 'steelblue')
11594
- .attr('x', (d) => x(d.name))
11632
+ .data(data)
11633
+ .enter()
11634
+ .append('rect')
11635
+ .attr('x', (d) => x(d.name) || 0) // Use name instead of id
11636
+ .attr('y', height - margin.bottom)
11637
+ .attr('width', x.bandwidth())
11638
+ .attr('height', 0)
11639
+ .attr('fill', (d) => d.color || options.color || 'teal')
11640
+ .transition()
11641
+ .duration(500)
11595
11642
  .attr('y', (d) => y(d.value))
11643
+ .attr('height', (d) => y(0) - y(d.value));
11644
+ }
11645
+ updateBars(data, x, y, height, margin, options) {
11646
+ const bars = this.svg.selectAll('rect').data(data, (d) => d.id);
11647
+ // Enter new bars
11648
+ bars
11649
+ .enter()
11650
+ .append('rect')
11651
+ .attr('x', (d) => x(d.name) || 0) // Use name instead of id
11652
+ .attr('y', height - margin.bottom)
11653
+ .attr('width', x.bandwidth())
11654
+ .attr('height', 0)
11655
+ .attr('fill', (d) => d.color || options.color || 'teal')
11656
+ .transition()
11657
+ .duration(500)
11658
+ .attr('y', (d) => y(d.value))
11659
+ .attr('height', (d) => y(0) - y(d.value));
11660
+ // Update existing bars
11661
+ bars
11662
+ .transition()
11663
+ .duration(500)
11664
+ .attr('x', (d) => x(d.name) || 0) // Use name instead of id
11665
+ .attr('y', (d) => y(d.value))
11666
+ .attr('width', x.bandwidth())
11596
11667
  .attr('height', (d) => y(0) - y(d.value))
11597
- .attr('width', x.bandwidth());
11598
- // Add the x-axis
11599
- svg
11668
+ .attr('fill', (d) => d.color || options.color || 'teal');
11669
+ // Exit old bars
11670
+ bars
11671
+ .exit()
11672
+ .transition()
11673
+ .duration(500)
11674
+ .attr('y', height - margin.bottom)
11675
+ .attr('height', 0)
11676
+ .remove();
11677
+ }
11678
+ drawAxes(x, y, height, margin, options) {
11679
+ const axisColor = options.axisColor || '#000';
11680
+ const axisFontSize = options.axisFontSize || 12;
11681
+ // Draw X axis
11682
+ this.svg
11600
11683
  .append('g')
11684
+ .attr('class', 'x-axis')
11601
11685
  .attr('transform', `translate(0,${height - margin.bottom})`)
11602
- .call(this.d3.axisBottom(x));
11603
- // Add the y-axis with tick lines
11604
- const yAxis = this.d3.axisLeft(y).tickFormat((d) => `${d}`);
11605
- svg
11686
+ .call(this.d3.axisBottom(x).tickSizeOuter(0))
11687
+ .attr('color', axisColor)
11688
+ .style('font-size', `${axisFontSize}px`);
11689
+ // Draw Y axis
11690
+ this.svg
11606
11691
  .append('g')
11692
+ .attr('class', 'y-axis')
11607
11693
  .attr('transform', `translate(${margin.left},0)`)
11608
- .call(yAxis)
11609
- .call((g) => g.select('.domain').remove());
11610
- if (this.getValue().options.yAxisTick === undefined || this.getValue().options.yAxisTick === true) {
11611
- // Add tick lines for each y-axis value
11612
- svg
11613
- .selectAll('.y-tick-line')
11614
- .data(y.ticks())
11615
- .enter()
11616
- .append('line')
11617
- .attr('class', 'y-tick-line')
11618
- .attr('x1', margin.left)
11619
- .attr('y1', (d) => y(d))
11620
- .attr('x2', width - margin.right)
11621
- .attr('y2', (d) => y(d))
11622
- .attr('stroke', '#0001')
11623
- .attr('stroke-width', 0.5);
11694
+ .call(this.d3.axisLeft(y))
11695
+ .attr('color', axisColor)
11696
+ .style('font-size', `${axisFontSize}px`);
11697
+ }
11698
+ updateAxes(x, y, height, margin, options) {
11699
+ const axisColor = options.axisColor || '#000';
11700
+ const axisFontSize = options.axisFontSize || 12;
11701
+ // Update X axis
11702
+ this.svg
11703
+ .select('.x-axis')
11704
+ .transition()
11705
+ .duration(500)
11706
+ .call(this.d3.axisBottom(x).tickSizeOuter(0))
11707
+ .attr('color', axisColor)
11708
+ .style('font-size', `${axisFontSize}px`);
11709
+ // Update Y axis
11710
+ this.svg
11711
+ .select('.y-axis')
11712
+ .transition()
11713
+ .duration(500)
11714
+ .call(this.d3.axisLeft(y))
11715
+ .attr('color', axisColor)
11716
+ .style('font-size', `${axisFontSize}px`);
11717
+ }
11718
+ addTooltips(data, x, y, options) {
11719
+ this.tooltip = this.d3
11720
+ .select('body')
11721
+ .append('div')
11722
+ .attr('class', 'tooltip')
11723
+ .style('opacity', 0)
11724
+ .style('position', 'absolute')
11725
+ .style('background', options.tooltipBackground || '#fff')
11726
+ .style('color', options.tooltipTextColor || '#000')
11727
+ .style('padding', '5px')
11728
+ .style('border-radius', '3px');
11729
+ this.svg
11730
+ .selectAll('rect')
11731
+ .on('mouseover', (event, d) => {
11732
+ const [xPos, yPos] = this.d3.pointer(event);
11733
+ this.tooltip.transition().duration(200).style('opacity', 0.9);
11734
+ this.tooltip
11735
+ .html(`Value: ${d.value}`)
11736
+ .style('left', `${xPos + 10}px`)
11737
+ .style('top', `${yPos - 10}px`);
11738
+ })
11739
+ .on('mouseout', () => {
11740
+ this.tooltip.transition().duration(500).style('opacity', 0);
11741
+ });
11742
+ }
11743
+ updateTooltips(data, x, y, options) {
11744
+ if (!this.tooltip) {
11745
+ this.addTooltips(data, x, y, options);
11624
11746
  }
11625
11747
  }
11748
+ addLegend(data, width, margin, options) {
11749
+ const legend = this.svg
11750
+ .append('g')
11751
+ .attr('class', 'legend')
11752
+ .attr('transform', `translate(${width - margin.right - 100}, ${margin.top})`);
11753
+ const legendItems = legend
11754
+ .selectAll('.legend-item')
11755
+ .data(data)
11756
+ .enter()
11757
+ .append('g')
11758
+ .attr('class', 'legend-item')
11759
+ .attr('transform', (d, i) => `translate(0, ${i * 20})`);
11760
+ legendItems
11761
+ .append('rect')
11762
+ .attr('width', 18)
11763
+ .attr('height', 18)
11764
+ .attr('fill', (d) => d.color || options.color || 'teal');
11765
+ legendItems
11766
+ .append('text')
11767
+ .attr('x', 24)
11768
+ .attr('y', 9)
11769
+ .attr('dy', '.35em')
11770
+ .text((d) => d.name); // Use name instead of id
11771
+ }
11772
+ updateLegend(data, width, margin, options) {
11773
+ const legend = this.svg.select('.legend').data([data]);
11774
+ const legendItems = legend.selectAll('.legend-item').data(data, (d) => d.id);
11775
+ // Enter new legend items
11776
+ const newLegendItems = legendItems
11777
+ .enter()
11778
+ .append('g')
11779
+ .attr('class', 'legend-item')
11780
+ .attr('transform', (d, i) => `translate(0, ${i * 20})`);
11781
+ newLegendItems
11782
+ .append('rect')
11783
+ .attr('width', 18)
11784
+ .attr('height', 18)
11785
+ .attr('fill', (d) => d.color || options.color || 'teal');
11786
+ newLegendItems
11787
+ .append('text')
11788
+ .attr('x', 24)
11789
+ .attr('y', 9)
11790
+ .attr('dy', '.35em')
11791
+ .text((d) => d.name); // Use name instead of id
11792
+ // Update existing legend items
11793
+ legendItems.select('text').text((d) => d.name); // Use name instead of id
11794
+ // Exit old legend items
11795
+ legendItems.exit().remove();
11796
+ }
11797
+ addZoom() {
11798
+ const zoom = this.d3
11799
+ .zoom()
11800
+ .scaleExtent([1, 10])
11801
+ .on('zoom', (event) => {
11802
+ this.svg.attr('transform', event.transform.toString());
11803
+ });
11804
+ this.svg.call(zoom);
11805
+ }
11806
+ addExportButton() {
11807
+ const exportButton = this.d3
11808
+ .select(this.chartEl().nativeElement)
11809
+ .append('button')
11810
+ .text('Export to PNG')
11811
+ .style('position', 'absolute')
11812
+ .style('top', '10px')
11813
+ .style('right', '10px')
11814
+ .on('click', () => {
11815
+ const svgElement = this.svg.node();
11816
+ if (svgElement) {
11817
+ const serializer = new XMLSerializer();
11818
+ const svgString = serializer.serializeToString(svgElement);
11819
+ const canvas = document.createElement('canvas');
11820
+ const ctx = canvas.getContext('2d');
11821
+ const img = new Image();
11822
+ img.onload = () => {
11823
+ canvas.width = img.width;
11824
+ canvas.height = img.height;
11825
+ ctx?.drawImage(img, 0, 0);
11826
+ const link = document.createElement('a');
11827
+ link.download = 'chart.png';
11828
+ link.href = canvas.toDataURL('image/png');
11829
+ link.click();
11830
+ };
11831
+ img.src = 'data:image/svg+xml;base64,' + btoa(svgString);
11832
+ }
11833
+ });
11834
+ }
11626
11835
  ngOnDestroy() {
11627
- this.d3.select(this.chartEl().nativeElement).selectAll('*').remove();
11836
+ if (this.svg) {
11837
+ this.svg.selectAll('*').remove();
11838
+ }
11839
+ if (this.tooltip) {
11840
+ this.tooltip.remove();
11841
+ }
11628
11842
  }
11629
11843
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPBarChartWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
11630
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.3", type: AXPBarChartWidgetEditComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "chartEl", first: true, predicate: ["chart"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: ` <div class="ax-flex ax-justify-center ax-items-center" #chart></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11844
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.3", type: AXPBarChartWidgetEditComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "chartEl", first: true, predicate: ["chart"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `<div class="ax-flex ax-justify-center ax-items-center" #chart></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11631
11845
  }
11632
11846
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPBarChartWidgetEditComponent, decorators: [{
11633
11847
  type: Component,
11634
11848
  args: [{
11635
- template: ` <div class="ax-flex ax-justify-center ax-items-center" #chart></div>`,
11849
+ template: `<div class="ax-flex ax-justify-center ax-items-center" #chart></div>`,
11636
11850
  standalone: true,
11637
11851
  changeDetection: ChangeDetectionStrategy.OnPush,
11638
11852
  }]
@@ -12257,12 +12471,12 @@ class AXPTabularDataEditorWidgetEditComponent extends AXPWidgetComponent {
12257
12471
  constructor() {
12258
12472
  super(...arguments);
12259
12473
  this.columns = computed(() => this.options()['columns']);
12260
- this.isPopup = computed(() => this.options()['isPopup']);
12474
+ this.defaultRowCount = computed(() => this.options()['defaultRowCount']);
12261
12475
  this.popupService = inject(AXPopupService);
12262
12476
  this.platform = inject(AXPlatform);
12263
12477
  }
12264
12478
  async openPopup() {
12265
- const { AXPTabularDataPopupComponent } = await import('./acorex-platform-widgets-tabular-data-edit-popup.component-D2-nHqYy.mjs');
12479
+ const { AXPTabularDataPopupComponent } = await import('./acorex-platform-widgets-tabular-data-edit-popup.component-B90if8wb.mjs');
12266
12480
  const popupData = await this.popupService.open(AXPTabularDataPopupComponent, {
12267
12481
  size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
12268
12482
  header: true,
@@ -12273,24 +12487,19 @@ class AXPTabularDataEditorWidgetEditComponent extends AXPWidgetComponent {
12273
12487
  data: {
12274
12488
  columns: this.columns(),
12275
12489
  context: this.getValue(),
12490
+ defaultRowCount: this.defaultRowCount(),
12276
12491
  },
12277
12492
  });
12278
12493
  this.setValue(popupData.data?.context);
12279
12494
  }
12280
12495
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPTabularDataEditorWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
12281
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPTabularDataEditorWidgetEditComponent, isStandalone: true, selector: "axp-tabular-data-editor-widget", usesInheritance: true, ngImport: i0, template: `
12282
- <span class="ax-truncate ax-underline ax-cursor-pointer" (click)="openPopup()">
12283
- Click To Edit</span>
12284
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXPLayoutBuilderModule }, { kind: "ngmodule", type: AXDataTableModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
12496
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPTabularDataEditorWidgetEditComponent, isStandalone: true, selector: "axp-tabular-data-editor-widget", usesInheritance: true, ngImport: i0, template: ` <span class="ax-truncate ax-underline ax-cursor-pointer" (click)="openPopup()"> Click To Edit</span> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXPLayoutBuilderModule }, { kind: "ngmodule", type: AXDataTableModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
12285
12497
  }
12286
12498
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPTabularDataEditorWidgetEditComponent, decorators: [{
12287
12499
  type: Component,
12288
12500
  args: [{
12289
12501
  selector: 'axp-tabular-data-editor-widget',
12290
- template: `
12291
- <span class="ax-truncate ax-underline ax-cursor-pointer" (click)="openPopup()">
12292
- Click To Edit</span>
12293
- `,
12502
+ template: ` <span class="ax-truncate ax-underline ax-cursor-pointer" (click)="openPopup()"> Click To Edit</span> `,
12294
12503
  changeDetection: ChangeDetectionStrategy.OnPush,
12295
12504
  imports: [
12296
12505
  CommonModule,
@@ -12356,20 +12565,9 @@ class AXPTabularDataEditorWidgetViewComponent extends AXPWidgetComponent {
12356
12565
  this.popupService = inject(AXPopupService);
12357
12566
  this.platform = inject(AXPlatform);
12358
12567
  this.columns = this.options()['columns'];
12359
- this.dataSource = new AXDataSource({
12360
- load: async () => {
12361
- const items = this.getValue() ?? [];
12362
- return {
12363
- items: items,
12364
- total: items.length,
12365
- };
12366
- },
12367
- pageSize: 1000,
12368
- key: 'gridItem',
12369
- });
12370
12568
  }
12371
12569
  async openPopup() {
12372
- const { AXPTabularDataPopupComponent } = await import('./acorex-platform-widgets-tabular-data-view-popup.component-BBRVgZLu.mjs');
12570
+ const { AXPTabularDataPopupComponent } = await import('./acorex-platform-widgets-tabular-data-view-popup.component-BaslkAPS.mjs');
12373
12571
  this.popupService.open(AXPTabularDataPopupComponent, {
12374
12572
  size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
12375
12573
  header: true,
@@ -12378,7 +12576,7 @@ class AXPTabularDataEditorWidgetViewComponent extends AXPWidgetComponent {
12378
12576
  draggable: true,
12379
12577
  title: this.path ?? '',
12380
12578
  data: {
12381
- dataSource: this.dataSource,
12579
+ items: this.getValue() ?? [],
12382
12580
  columns: this.columns,
12383
12581
  },
12384
12582
  });