@acorex/platform 19.2.9 → 19.2.10

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 (42) hide show
  1. package/common/lib/app/application.types.d.ts +3 -2
  2. package/common/lib/utils/expression-evaluator.service.d.ts +3 -1
  3. package/fesm2022/acorex-platform-common.mjs +26 -12
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-layout-builder.mjs +20 -4
  6. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-designer.mjs +31 -12
  8. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-entity.mjs +45 -64
  10. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  11. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-BK8BItxL.mjs → acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs} +8 -4
  12. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Bvwr0PVk.mjs.map +1 -0
  13. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-De61n012.mjs → acorex-platform-themes-default-entity-master-list-view.component-BzLgFr7D.mjs} +8 -3
  14. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BzLgFr7D.mjs.map +1 -0
  15. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-U8aBv1Ql.mjs → acorex-platform-themes-default-entity-master-modify-view.component-BAU_s90_.mjs} +8 -4
  16. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BAU_s90_.mjs.map +1 -0
  17. package/fesm2022/{acorex-platform-themes-default-setting-page.component-CN2NCgUv.mjs → acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs} +3 -3
  18. package/fesm2022/{acorex-platform-themes-default-setting-page.component-CN2NCgUv.mjs.map → acorex-platform-themes-default-setting-page.component-DYumYm5k.mjs.map} +1 -1
  19. package/fesm2022/acorex-platform-themes-default.mjs +14 -15
  20. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-widgets.mjs +215 -124
  22. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  23. package/layout/builder/lib/builder/widget-map.d.ts +1 -0
  24. package/layout/builder/lib/builder/widget.types.d.ts +13 -0
  25. package/layout/designer/lib/designer/components/drawers/data-sources/data-sources.component.d.ts +3 -0
  26. package/layout/entity/lib/entity-master-create.viewmodel.d.ts +2 -1
  27. package/layout/entity/lib/entity-master-update.viewmodel.d.ts +4 -3
  28. package/layout/entity/lib/entity.viewmodel.d.ts +2 -0
  29. package/package.json +5 -5
  30. package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -0
  31. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +2 -1
  32. package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -0
  33. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +0 -1
  34. package/widgets/lib/widgets/advance/file/file-box-widget-edit.component.d.ts +6 -4
  35. package/widgets/lib/widgets/charts/bar-chart/bar-chart-widget-edit.component.d.ts +3 -3
  36. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget-edit.component.d.ts +14 -0
  37. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart-widget.config.d.ts +7 -0
  38. package/widgets/lib/widgets/charts/gauge-chart/gauge-chart.type.d.ts +17 -0
  39. package/widgets/lib/widgets/charts/gauge-chart/index.d.ts +2 -0
  40. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-BK8BItxL.mjs.map +0 -1
  41. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-De61n012.mjs.map +0 -1
  42. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-U8aBv1Ql.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as i1$6 from '@acorex/platform/layout/builder';
2
- import { AXPWidgetsCatalog, createStringProperty, createBooleanProperty, createSelectProperty, cloneProperty, AXPWidgetComponent, AXP_WIDGETS_ACTION_GROUP, AXP_WIDGETS_EDITOR_GROUP, AXPColumnWidgetComponent, AXPDataListWidgetComponent, AXPWidgetStatus, AXPPageStatus, AXP_WIDGETS_ADVANCE_GROUP, AXPLayoutBuilderModule, AXP_WIDGETS_LAYOUT_GROUP, AXP_WIDGETS_VALIDATION_GROUP, AXP_WIDGETS_CHART_GROUP, AXP_WIDGETS_FILTER_GROUP } from '@acorex/platform/layout/builder';
2
+ import { AXPWidgetsCatalog, createStringProperty, createBooleanProperty, createSelectProperty, cloneProperty, AXPWidgetComponent, AXP_WIDGETS_ACTION_GROUP, AXP_WIDGETS_EDITOR_GROUP, AXPColumnWidgetComponent, createNumberProperty, AXPDataListWidgetComponent, AXPWidgetStatus, AXPPageStatus, AXP_WIDGETS_ADVANCE_GROUP, AXPLayoutBuilderModule, AXP_WIDGETS_LAYOUT_GROUP, AXP_WIDGETS_VALIDATION_GROUP, AXP_WIDGETS_CHART_GROUP, AXP_WIDGETS_FILTER_GROUP } from '@acorex/platform/layout/builder';
3
3
  import { AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, AXDataSource } from '@acorex/components/common';
4
4
  import * as i1$2 from '@acorex/components/badge';
5
5
  import { AXBadgeModule } from '@acorex/components/badge';
@@ -107,7 +107,7 @@ const AXP_WIDGET_PROPERTY_GROUP = {
107
107
  const AXP_VALIDATION_PROPERTY_GROUP = {
108
108
  name: 'validation',
109
109
  order: 4,
110
- title: 'validation',
110
+ title: 'Validation',
111
111
  };
112
112
 
113
113
  const AXP_DATA_SOURCE_PROPERTY = {
@@ -3788,6 +3788,7 @@ const AXPNumberBoxWidget = {
3788
3788
  numberDefaultProperty(),
3789
3789
  numberMinValueProperty(),
3790
3790
  numberMaxValueProperty(),
3791
+ createNumberProperty({ defaultValue: 0, name: 'decimals', title: "Decimals", path: "options.decimals", group: AXP_BEHAVIOR_PROPERTY_GROUP }),
3791
3792
  cloneProperty(AXP_TABLE_COLUMN_WIDTH_PROPERTY, { schema: { defaultValue: '200px' } }),
3792
3793
  //
3793
3794
  AXP_REQUIRED_VALIDATION_PROPERTY,
@@ -4813,7 +4814,6 @@ const AXPRichTextWidget = {
4813
4814
  properties: [
4814
4815
  AXP_NAME_PROPERTY,
4815
4816
  AXP_DATA_PATH_PROPERTY,
4816
- AXP_ALLOW_MULTIPLE_PROPERTY,
4817
4817
  AXP_DISABLED_PROPERTY,
4818
4818
  AXP_PLACEHOLDER_PROPERTY,
4819
4819
  //cloneProperty(AXP_TABLE_COLUMN_WIDTH_PROPERTY, { schema: { defaultValue: '300px' } }),
@@ -6346,29 +6346,36 @@ class AXPFileBoxWidgetEditComponent extends AXPWidgetComponent {
6346
6346
  return [];
6347
6347
  return this.getValue() ? (Array.isArray(this.getValue()) ? this.getValue() : [this.getValue()]) : [{}];
6348
6348
  });
6349
+ this.files = signal([]);
6349
6350
  this.markedListAsCommitted = null;
6350
6351
  this.markedListAsDeleted = null;
6351
- this.#effect2 = effect(async () => {
6352
- const status = this.layoutService.status();
6353
- if (status == AXPPageStatus.Submitted) {
6354
- if (this.markedListAsCommitted) {
6355
- for (const fileId of this.markedListAsCommitted) {
6356
- await this.fileStorage.commit(fileId);
6357
- }
6358
- this.markedListAsCommitted = null;
6352
+ }
6353
+ async ngOnDestroy() {
6354
+ const status = this.layoutService.status();
6355
+ if (status == AXPPageStatus.Submitted) {
6356
+ if (this.markedListAsCommitted) {
6357
+ for (const fileId of this.markedListAsCommitted) {
6358
+ await this.fileStorage.commit(fileId);
6359
6359
  }
6360
- if (this.markedListAsDeleted) {
6361
- for (const fileId of this.markedListAsDeleted) {
6362
- await this.fileStorage.markForDeletion(fileId);
6363
- }
6364
- this.markedListAsDeleted = null;
6360
+ this.markedListAsCommitted = null;
6361
+ }
6362
+ if (this.markedListAsDeleted) {
6363
+ for (const fileId of this.markedListAsDeleted) {
6364
+ await this.fileStorage.markForDeletion(fileId);
6365
6365
  }
6366
+ this.markedListAsDeleted = null;
6366
6367
  }
6367
- });
6368
+ }
6369
+ }
6370
+ handleOnFileRemove(file) {
6371
+ debugger;
6372
+ this.files.update((files) => files.filter((f) => f !== file));
6368
6373
  }
6369
- #effect2;
6370
6374
  handleOnFileUploadComplete(e) { }
6371
- handleOnFilesUploadComplete(e) { }
6375
+ handleOnFilesUploadComplete(e) {
6376
+ this.files.set(e.uploadedFiles);
6377
+ console.log(e.uploadedFiles[0].onComplete);
6378
+ }
6372
6379
  async handleChanged(e) {
6373
6380
  const results = [];
6374
6381
  for (var i = 0; i < e.requests.length; i++) {
@@ -6379,7 +6386,9 @@ class AXPFileBoxWidgetEditComponent extends AXPWidgetComponent {
6379
6386
  refType: this.refType(),
6380
6387
  isPrimary: true,
6381
6388
  }));
6382
- e.requests[i].finish();
6389
+ e.requests[i].finish({
6390
+ id: results[i].fileId,
6391
+ });
6383
6392
  }
6384
6393
  if (!this.multiple()) {
6385
6394
  this.setValue(results[0].fileId);
@@ -6394,45 +6403,45 @@ class AXPFileBoxWidgetEditComponent extends AXPWidgetComponent {
6394
6403
  const extension = fileName?.split('.')?.pop()?.toLowerCase();
6395
6404
  switch (extension) {
6396
6405
  case 'txt':
6397
- return { icon: 'fa-file-alt', color: 'ax-bg-blue-100 ax-text-blue-500' };
6406
+ return { icon: ' far fa-file-alt', color: 'ax-bg-blue-100 ax-text-blue-500' };
6398
6407
  case 'pdf':
6399
- return { icon: 'fa-file-pdf', color: 'ax-bg-red-100 ax-text-red-500' };
6408
+ return { icon: ' far fa-file-pdf', color: 'ax-bg-red-100 ax-text-red-500' };
6400
6409
  case 'doc':
6401
6410
  case 'docx':
6402
- return { icon: 'fa-file-word', color: 'ax-bg-blue-200 ax-text-blue-600' };
6411
+ return { icon: ' far fa-file-word', color: 'ax-bg-blue-200 ax-text-blue-600' };
6403
6412
  case 'xls':
6404
6413
  case 'xlsx':
6405
- return { icon: 'fa-file-excel', color: 'ax-bg-green-100 ax-text-green-500' };
6414
+ return { icon: ' far fa-file-excel', color: 'ax-bg-green-100 ax-text-green-500' };
6406
6415
  case 'ppt':
6407
6416
  case 'pptx':
6408
- return { icon: 'fa-file-powerpoint', color: 'ax-bg-orange-100 ax-text-orange-500' };
6417
+ return { icon: ' far fa-file-powerpoint', color: 'ax-bg-orange-100 ax-text-orange-500' };
6409
6418
  case 'jpg':
6410
6419
  case 'jpeg':
6411
6420
  case 'png':
6412
6421
  case 'gif':
6413
6422
  case 'bmp':
6414
- return { icon: 'fa-file-image', color: 'ax-bg-purple-100 ax-text-purple-500' };
6423
+ return { icon: ' far fa-file-image', color: 'ax-bg-purple-100 ax-text-purple-500' };
6415
6424
  case 'zip':
6416
6425
  case 'rar':
6417
6426
  case '7z':
6418
- return { icon: 'fa-file-archive', color: 'ax-bg-yellow-100 ax-text-yellow-500' };
6427
+ return { icon: ' far fa-file-archive', color: 'ax-bg-yellow-100 ax-text-yellow-500' };
6419
6428
  case 'mp3':
6420
6429
  case 'wav':
6421
6430
  case 'ogg':
6422
- return { icon: 'fa-file-audio', color: 'ax-bg-pink-100 ax-text-pink-500' };
6431
+ return { icon: ' far fa-file-audio', color: 'ax-bg-pink-100 ax-text-pink-500' };
6423
6432
  case 'mp4':
6424
6433
  case 'avi':
6425
6434
  case 'mkv':
6426
6435
  case 'mov':
6427
- return { icon: 'fa-file-video', color: 'ax-bg-blue-100 ax-text-blue-500' };
6436
+ return { icon: ' far fa-file-video', color: 'ax-bg-blue-100 ax-text-blue-500' };
6428
6437
  case 'js':
6429
6438
  case 'jsx':
6430
6439
  case 'ts':
6431
6440
  case 'tsx':
6432
- return { icon: 'fa-file-code', color: 'ax-bg-yellow-100 ax-text-yellow-500' };
6441
+ return { icon: ' far fa-file-code', color: 'ax-bg-yellow-100 ax-text-yellow-500' };
6433
6442
  // Add more cases as needed for other file types
6434
6443
  default:
6435
- return { icon: 'fa-file', color: 'ax-bg-gray-100 ax-text-gray-500' };
6444
+ return { icon: ' far fa-file', color: 'ax-bg-gray-100 ax-text-gray-500' };
6436
6445
  }
6437
6446
  }
6438
6447
  get __class() {
@@ -6442,7 +6451,7 @@ class AXPFileBoxWidgetEditComponent extends AXPWidgetComponent {
6442
6451
  return cls;
6443
6452
  }
6444
6453
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFileBoxWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
6445
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPFileBoxWidgetEditComponent, isStandalone: true, selector: "axp-file-widget-edit", host: { properties: { "class": "this.__class" } }, usesInheritance: true, ngImport: i0, template: `
6454
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXPFileBoxWidgetEditComponent, isStandalone: true, selector: "axp-file-widget-edit", host: { properties: { "class": "this.__class" } }, usesInheritance: true, ngImport: i0, template: `
6446
6455
  <div class="ax-grid ax-grid-cols-12">
6447
6456
  <div class="ax-col-span-12">
6448
6457
  <ax-uploader-drop-zone
@@ -6456,7 +6465,17 @@ class AXPFileBoxWidgetEditComponent extends AXPWidgetComponent {
6456
6465
  ></ax-uploader-drop-zone>
6457
6466
  </div>
6458
6467
  </div>
6459
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXUploaderModule }, { kind: "component", type: i5$3.AXUploaderDropZoneComponent, selector: "ax-uploader-drop-zone", inputs: ["description"] }, { kind: "directive", type: i5$3.AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: ["multiple", "accept"], outputs: ["onChanged", "onFileUploadComplete", "onFilesUploadComplete"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6468
+ @for(file of files(); track $index){
6469
+ <div class="ax-grid ax-mt-10 ax-grid-cols-12 ax-gap-1 ax-px-4">
6470
+ <ax-icon class="{{ getFileInfo(file.file.name).icon }} {{ getFileInfo(file.file.name).color }}"></ax-icon>
6471
+ <ax-text class="ax-col-span-10" [textContent]="file.file.name"></ax-text>
6472
+ <div>
6473
+ <ax-icon class="fa-light fa-download ax-px-2"></ax-icon>
6474
+ <ax-icon (click)="handleOnFileRemove(file)" class="fa-light fa-xmark"></ax-icon>
6475
+ </div>
6476
+ </div>
6477
+ }
6478
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.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: AXUploaderModule }, { kind: "component", type: i5$3.AXUploaderDropZoneComponent, selector: "ax-uploader-drop-zone", inputs: ["description"] }, { kind: "directive", type: i5$3.AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: ["multiple", "accept"], outputs: ["onChanged", "onFileUploadComplete", "onFilesUploadComplete"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6460
6479
  }
6461
6480
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFileBoxWidgetEditComponent, decorators: [{
6462
6481
  type: Component,
@@ -6476,6 +6495,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
6476
6495
  ></ax-uploader-drop-zone>
6477
6496
  </div>
6478
6497
  </div>
6498
+ @for(file of files(); track $index){
6499
+ <div class="ax-grid ax-mt-10 ax-grid-cols-12 ax-gap-1 ax-px-4">
6500
+ <ax-icon class="{{ getFileInfo(file.file.name).icon }} {{ getFileInfo(file.file.name).color }}"></ax-icon>
6501
+ <ax-text class="ax-col-span-10" [textContent]="file.file.name"></ax-text>
6502
+ <div>
6503
+ <ax-icon class="fa-light fa-download ax-px-2"></ax-icon>
6504
+ <ax-icon (click)="handleOnFileRemove(file)" class="fa-light fa-xmark"></ax-icon>
6505
+ </div>
6506
+ </div>
6507
+ }
6479
6508
  `,
6480
6509
  changeDetection: ChangeDetectionStrategy.OnPush,
6481
6510
  imports: [CommonModule, FormsModule, AXButtonModule, AXDecoratorModule, AXUploaderModule],
@@ -7407,6 +7436,7 @@ const AXPMapBoxWidget = {
7407
7436
  options: {
7408
7437
  minValue: -90,
7409
7438
  maxValue: 90,
7439
+ decimals: 5
7410
7440
  },
7411
7441
  },
7412
7442
  },
@@ -7426,6 +7456,7 @@ const AXPMapBoxWidget = {
7426
7456
  options: {
7427
7457
  minValue: -180,
7428
7458
  maxValue: 180,
7459
+ decimals: 5
7429
7460
  },
7430
7461
  },
7431
7462
  },
@@ -11624,12 +11655,6 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11624
11655
  if (options.enableTooltip) {
11625
11656
  this.addTooltips(data, x, y, options);
11626
11657
  }
11627
- if (options.enableLegend) {
11628
- this.addLegend(data, width, height, margin, options);
11629
- }
11630
- if (options.enableExport) {
11631
- this.addExportButton();
11632
- }
11633
11658
  }
11634
11659
  updateChart(chartValue) {
11635
11660
  const { data, options } = chartValue;
@@ -11641,26 +11666,8 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11641
11666
  getChartDimensions(options) {
11642
11667
  const baseWidth = options.width || 400;
11643
11668
  const baseHeight = options.height || 200;
11644
- const margin = options.margin || { top: 20, right: 20, bottom: 30, left: 40 };
11645
- // Reserve space for legend
11646
- const legendSpace = 100; // 100px reserved for legend
11647
- let width = baseWidth;
11648
- let height = baseHeight;
11649
- if (options.enableLegend) {
11650
- switch (options.legendPosition) {
11651
- case 'top-right':
11652
- case 'top-left':
11653
- height -= legendSpace; // Reserve space at the top
11654
- margin.top += legendSpace;
11655
- break;
11656
- case 'bottom-right':
11657
- case 'bottom-left':
11658
- height -= legendSpace; // Reserve space at the bottom
11659
- margin.bottom += legendSpace;
11660
- break;
11661
- }
11662
- }
11663
- return { width, height, margin };
11669
+ const margin = options.margin || { top: 100, right: 20, bottom: 30, left: 40 };
11670
+ return { width: baseWidth, height: baseHeight, margin };
11664
11671
  }
11665
11672
  createXScale(data, width, margin) {
11666
11673
  return this.d3
@@ -11698,7 +11705,7 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11698
11705
  // Draw X axis
11699
11706
  this.svg
11700
11707
  .append('g')
11701
- .attr('class', 'x-axis')
11708
+ .attr('class', 'axp-bar-chart-x-axis')
11702
11709
  .attr('transform', `translate(0,${height - margin.bottom})`)
11703
11710
  .call(this.d3.axisBottom(x).tickSizeOuter(0))
11704
11711
  .attr('color', axisColor)
@@ -11706,14 +11713,14 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11706
11713
  // Draw Y axis
11707
11714
  this.svg
11708
11715
  .append('g')
11709
- .attr('class', 'y-axis')
11716
+ .attr('class', 'axp-bar-chart-y-axis')
11710
11717
  .attr('transform', `translate(${margin.left},0)`)
11711
11718
  .call(this.d3.axisLeft(y))
11712
11719
  .attr('color', axisColor)
11713
11720
  .style('font-size', `${axisFontSize}px`);
11714
11721
  }
11715
11722
  addTooltips(data, x, y, options) {
11716
- this.tooltip = this.svg.append('g').attr('class', 'tooltip').style('opacity', 0);
11723
+ this.tooltip = this.svg.append('g').attr('class', 'axp-bar-chart-tooltip').style('opacity', 0);
11717
11724
  this.tooltip
11718
11725
  .append('rect')
11719
11726
  .attr('width', 80)
@@ -11733,80 +11740,48 @@ class AXPBarChartWidgetEditComponent extends AXPWidgetComponent {
11733
11740
  .on('mouseover', (event, d) => {
11734
11741
  const barX = x(d.name) || 0;
11735
11742
  const barY = y(d.value);
11736
- this.tooltip.style('opacity', 1).attr('transform', `translate(${barX + x.bandwidth() / 2 - 40},${barY - 40})`);
11743
+ // Adjust tooltip position to stay within SVG boundaries
11744
+ const tooltipX = Math.min(barX + x.bandwidth() / 2 - 40, Number.parseInt(this.svg.attr('width')) - 80);
11745
+ const tooltipY = Math.max(barY - 40, 0);
11746
+ this.tooltip.style('opacity', 1).attr('transform', `translate(${tooltipX},${tooltipY})`);
11737
11747
  this.tooltip.select('text').text(`${d.name}: ${d.value}`);
11738
11748
  })
11739
11749
  .on('mouseout', () => {
11740
11750
  this.tooltip.style('opacity', 0);
11741
11751
  });
11742
11752
  }
11743
- addLegend(data, width, height, margin, options) {
11744
- const legendPosition = options.legendPosition || 'top-right';
11745
- const legend = this.svg.append('g').attr('class', 'legend');
11753
+ // API to render legend in another component
11754
+ renderLegend(data, options, container) {
11755
+ const legend = this.d3.select(container).append('div').attr('class', 'axp-bar-chart-legend');
11746
11756
  const legendItems = legend
11747
11757
  .selectAll('.legend-item')
11748
11758
  .data(data)
11749
11759
  .enter()
11750
- .append('g')
11751
- .attr('class', 'legend-item')
11752
- .attr('transform', (d, i) => `translate(0, ${i * 20})`);
11760
+ .append('div')
11761
+ .attr('class', 'axp-bar-chart-legend-item')
11762
+ .style('display', 'flex')
11763
+ .style('align-items', 'center')
11764
+ .style('margin-bottom', '5px');
11753
11765
  legendItems
11754
- .append('rect')
11755
- .attr('width', 16)
11756
- .attr('height', 16)
11757
- .attr('fill', (d) => d.color || options.color || 'teal');
11766
+ .append('div')
11767
+ .style('width', '16px')
11768
+ .style('height', '16px')
11769
+ .style('background-color', (d) => d.color || options.color || 'teal')
11770
+ .style('margin-right', '8px');
11758
11771
  legendItems
11759
- .append('text')
11760
- .attr('x', 24)
11761
- .attr('y', 12)
11762
- .attr('fill', '#000')
11763
- .style('font-size', '12px')
11764
- .text((d) => d.name);
11765
- // Position the legend
11766
- switch (legendPosition) {
11767
- case 'top-right':
11768
- legend.attr('transform', `translate(${width - margin.right - 100}, ${margin.top - 80})`);
11769
- break;
11770
- case 'top-left':
11771
- legend.attr('transform', `translate(${margin.left}, ${margin.top - 80})`);
11772
- break;
11773
- case 'bottom-right':
11774
- legend.attr('transform', `translate(${width - margin.right - 100}, ${height - margin.bottom + 20})`);
11775
- break;
11776
- case 'bottom-left':
11777
- legend.attr('transform', `translate(${margin.left}, ${height - margin.bottom + 20})`);
11778
- break;
11779
- }
11772
+ .append('div')
11773
+ .text((d) => d.name)
11774
+ .style('font-size', '12px');
11780
11775
  }
11781
- addExportButton() {
11782
- const exportButton = this.d3
11783
- .select(this.chartEl().nativeElement)
11784
- .append('button')
11785
- .text('Export to PNG')
11786
- .style('position', 'absolute')
11787
- .style('top', '10px')
11788
- .style('right', '10px')
11789
- .style('z-index', '1000')
11790
- .on('click', () => {
11791
- const svgElement = this.svg.node();
11792
- if (svgElement) {
11793
- const serializer = new XMLSerializer();
11794
- const svgString = serializer.serializeToString(svgElement);
11795
- const canvas = document.createElement('canvas');
11796
- const ctx = canvas.getContext('2d');
11797
- const img = new Image();
11798
- img.onload = () => {
11799
- canvas.width = img.width;
11800
- canvas.height = img.height;
11801
- ctx?.drawImage(img, 0, 0);
11802
- const link = document.createElement('a');
11803
- link.download = 'chart.png';
11804
- link.href = canvas.toDataURL('image/png');
11805
- link.click();
11806
- };
11807
- img.src = 'data:image/svg+xml;base64,' + btoa(svgString);
11808
- }
11809
- });
11776
+ // API to export chart as PNG
11777
+ exportChartAsPNG() {
11778
+ const svgElement = this.svg.node();
11779
+ if (svgElement) {
11780
+ const serializer = new XMLSerializer();
11781
+ const svgString = serializer.serializeToString(svgElement);
11782
+ return 'data:image/svg+xml;base64,' + btoa(svgString);
11783
+ }
11784
+ return null;
11810
11785
  }
11811
11786
  ngOnDestroy() {
11812
11787
  if (this.svg) {
@@ -12215,6 +12190,119 @@ const AXPQrcodeWidget = {
12215
12190
  },
12216
12191
  };
12217
12192
 
12193
+ class AXPGaugeChartWidgetEditComponent extends AXPWidgetComponent {
12194
+ constructor() {
12195
+ super(...arguments);
12196
+ this.chartEl = viewChild.required('chart');
12197
+ this.#af = afterNextRender(async () => {
12198
+ await this.loadD3();
12199
+ this.createChart();
12200
+ });
12201
+ }
12202
+ #af;
12203
+ async loadD3() {
12204
+ try {
12205
+ this.d3 = await import('d3');
12206
+ }
12207
+ catch (error) {
12208
+ console.error('Failed to load D3.js:', error);
12209
+ }
12210
+ }
12211
+ createChart() {
12212
+ const chartElement = this.chartEl().nativeElement;
12213
+ this.d3.select(chartElement).selectAll('*').remove();
12214
+ const width = this.getValue().options.width;
12215
+ const height = this.getValue().options.height;
12216
+ const minValue = this.getValue().options.minValue;
12217
+ const maxValue = this.getValue().options.maxValue;
12218
+ const arcThickness = this.getValue().options.arcThickness;
12219
+ const labelOffset = this.getValue().options.labelOffset;
12220
+ const radius = Math.min(width, height) / 2;
12221
+ const arc = this.d3
12222
+ .arc()
12223
+ .innerRadius(radius - arcThickness)
12224
+ .outerRadius(radius)
12225
+ .startAngle(-Math.PI / 2)
12226
+ .endAngle(Math.PI / 2);
12227
+ const scale = this.d3
12228
+ .scaleLinear()
12229
+ .domain([minValue, maxValue])
12230
+ .range([-Math.PI / 2, Math.PI / 2]);
12231
+ const svg = this.d3
12232
+ .select(chartElement)
12233
+ .append('svg')
12234
+ .attr('width', width)
12235
+ .attr('height', height)
12236
+ .attr('role', 'img')
12237
+ .attr('aria-label', 'Gauge chart')
12238
+ .attr('viewBox', `0 0 ${width} ${height}`) // Adjusted viewBox
12239
+ .style('max-width', '100%')
12240
+ .style('height', 'auto')
12241
+ .append('g')
12242
+ .attr('transform', `translate(${width / 2}, ${height / 2})`); // Center the chart
12243
+ const gaugeArc = svg
12244
+ .append('g')
12245
+ .selectAll('path')
12246
+ .data(this.getValue().data)
12247
+ .enter()
12248
+ .append('path')
12249
+ .attr('fill', (d) => d.color || this.getRandomColor())
12250
+ .attr('d', arc);
12251
+ const label = svg
12252
+ .append('text')
12253
+ .attr('text-anchor', 'middle')
12254
+ .attr('font-size', '16px')
12255
+ .attr('y', labelOffset)
12256
+ .text(`${this.getValue().data[0].value}`);
12257
+ const pointer = svg
12258
+ .append('line')
12259
+ .attr('x1', 0)
12260
+ .attr('y1', 0)
12261
+ .attr('x2', 0)
12262
+ .attr('y2', -radius + arcThickness / 2)
12263
+ .attr('stroke', 'black')
12264
+ .attr('stroke-width', 2)
12265
+ .attr('transform', `rotate(${scale(this.getValue().data[0].value) * (180 / Math.PI)})`);
12266
+ }
12267
+ getRandomColor() {
12268
+ // Generate a random hex color
12269
+ return `#${Math.floor(Math.random() * 16777215).toString(16)}`;
12270
+ }
12271
+ ngOnDestroy() {
12272
+ this.d3.select(this.chartEl().nativeElement).selectAll('*').remove();
12273
+ }
12274
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGaugeChartWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
12275
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.3", type: AXPGaugeChartWidgetEditComponent, 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 }); }
12276
+ }
12277
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGaugeChartWidgetEditComponent, decorators: [{
12278
+ type: Component,
12279
+ args: [{
12280
+ template: ` <div class="ax-flex ax-justify-center ax-items-center" #chart></div>`,
12281
+ standalone: true,
12282
+ changeDetection: ChangeDetectionStrategy.OnPush,
12283
+ }]
12284
+ }] });
12285
+
12286
+ var gaugeChartWidgetEdit_component = /*#__PURE__*/Object.freeze({
12287
+ __proto__: null,
12288
+ AXPGaugeChartWidgetEditComponent: AXPGaugeChartWidgetEditComponent
12289
+ });
12290
+
12291
+ const AXPGaugeChartWidget = {
12292
+ name: 'gauge-chart',
12293
+ title: 'Gauge Chart Widget',
12294
+ group: AXP_WIDGETS_CHART_GROUP,
12295
+ type: 'chart',
12296
+ icon: 'fa-solid fa-gauge',
12297
+ visible: false,
12298
+ properties: [AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_DISABLED_PROPERTY],
12299
+ components: {
12300
+ edit: {
12301
+ component: () => Promise.resolve().then(function () { return gaugeChartWidgetEdit_component; }).then((c) => c.AXPGaugeChartWidgetEditComponent),
12302
+ },
12303
+ },
12304
+ };
12305
+
12218
12306
  class AXPColorBoxWidgetViewComponent extends AXPWidgetComponent {
12219
12307
  constructor() {
12220
12308
  super(...arguments);
@@ -12575,7 +12663,7 @@ var tabularDataWidgetView_component = /*#__PURE__*/Object.freeze({
12575
12663
 
12576
12664
  const AXPTableEditorWidget = {
12577
12665
  name: 'table-editor',
12578
- title: 'Table Editor Box',
12666
+ title: 'Table Editor',
12579
12667
  icon: 'fa-solid fa-input-text',
12580
12668
  description: 'Inputs single-line text',
12581
12669
  group: AXP_WIDGETS_EDITOR_GROUP,
@@ -12610,6 +12698,7 @@ const AXPTableEditorWidget = {
12610
12698
  component: () => Promise.resolve().then(function () { return tabularDataWidgetEdit_component; }).then((c) => c.AXPTabularDataEditorWidgetEditComponent),
12611
12699
  },
12612
12700
  },
12701
+ visible: false
12613
12702
  };
12614
12703
 
12615
12704
  class AXPBooleanFilterWidgetEditComponent extends AXPWidgetComponent {
@@ -14293,6 +14382,7 @@ class AXPWidgetsModule {
14293
14382
  //charts
14294
14383
  AXPDonutChartWidget,
14295
14384
  AXPBarChartWidget,
14385
+ AXPGaugeChartWidget,
14296
14386
  ],
14297
14387
  })] }); }
14298
14388
  }
@@ -14362,6 +14452,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
14362
14452
  //charts
14363
14453
  AXPDonutChartWidget,
14364
14454
  AXPBarChartWidget,
14455
+ AXPGaugeChartWidget,
14365
14456
  ],
14366
14457
  }),
14367
14458
  ],