@acorex/platform 20.6.0-next.25 → 20.6.0-next.27

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.
@@ -21297,10 +21297,35 @@ class AXPDateTimeFilterWidgetEditComponent extends AXPValueWidgetComponent {
21297
21297
  constructor() {
21298
21298
  super(...arguments);
21299
21299
  this.calendarService = inject(AXCalendarService);
21300
+ this.settingService = inject(AXPSettingService);
21300
21301
  this.selectBox = viewChild('selectBox', ...(ngDevMode ? [{ debugName: "selectBox" }] : []));
21301
21302
  this.value = computed(() => this.convertISODateToDate(this.getValue()?.value), ...(ngDevMode ? [{ debugName: "value" }] : []));
21302
21303
  this.operation = computed(() => this.getValue()?.operation, ...(ngDevMode ? [{ debugName: "operation" }] : []));
21303
21304
  this.filterTypeSelectedItem = signal('', ...(ngDevMode ? [{ debugName: "filterTypeSelectedItem" }] : []));
21305
+ this.dateMode = computed(() => this.options()['mode'] || 'short', ...(ngDevMode ? [{ debugName: "dateMode" }] : []));
21306
+ this.format = computed(() => {
21307
+ const rawValue = this.options()['format'];
21308
+ if (typeof rawValue == 'string')
21309
+ return rawValue;
21310
+ else if (rawValue && typeof rawValue == 'object')
21311
+ return rawValue['id'];
21312
+ else
21313
+ return 'date';
21314
+ }, ...(ngDevMode ? [{ debugName: "format" }] : []));
21315
+ this.calendarFormat = signal('date', ...(ngDevMode ? [{ debugName: "calendarFormat" }] : []));
21316
+ this.#effect = effect(async () => {
21317
+ let mode = '';
21318
+ if (this.format() == 'date') {
21319
+ mode = await this.settingService.get(`regional:${this.dateMode()}-date`);
21320
+ }
21321
+ else if (this.format() == 'time') {
21322
+ mode = await this.settingService.get(`regional:${this.dateMode()}-time`);
21323
+ }
21324
+ else if (this.format() == 'datetime') {
21325
+ mode = `${await this.settingService.get(`regional:${this.dateMode()}-date`)} ${await this.settingService.get(`regional:${this.dateMode()}-time`)}`;
21326
+ }
21327
+ this.calendarFormat.set(mode);
21328
+ }, ...(ngDevMode ? [{ debugName: "#effect" }] : []));
21304
21329
  this.filterTypeDataSource = [
21305
21330
  'Today',
21306
21331
  'This Week',
@@ -21325,6 +21350,7 @@ class AXPDateTimeFilterWidgetEditComponent extends AXPValueWidgetComponent {
21325
21350
  };
21326
21351
  this.formatCamelCaseToUpper = (input) => input?.replace(/([a-z])([A-Z])/g, '$1 $2')?.replace(/\b\w/g, (char) => char.toUpperCase());
21327
21352
  }
21353
+ #effect;
21328
21354
  ngAfterViewInit() {
21329
21355
  const availableTypes = ['between', 'greaterThan', 'lessThan'];
21330
21356
  if (availableTypes.includes(this.operation())) {
@@ -21495,7 +21521,7 @@ class AXPDateTimeFilterWidgetEditComponent extends AXPValueWidgetComponent {
21495
21521
  @if (filterTypeSelectedItem() === 'Between') {
21496
21522
  <div class="ax-flex ax-gap-2 ax-mt-2">
21497
21523
  <ax-datetime-box
21498
- format="YYYY/MM/DD"
21524
+ [format]="calendarFormat()"
21499
21525
  [placeholder]="'@general:terms.common.from' | translate | async"
21500
21526
  [ngModel]="value()?.from"
21501
21527
  (onValueChanged)="handleValueChange($event, 'from')"
@@ -21503,7 +21529,7 @@ class AXPDateTimeFilterWidgetEditComponent extends AXPValueWidgetComponent {
21503
21529
  <ax-clear-button></ax-clear-button>
21504
21530
  </ax-datetime-box>
21505
21531
  <ax-datetime-box
21506
- format="YYYY/MM/DD"
21532
+ [format]="calendarFormat()"
21507
21533
  [placeholder]="'@general:terms.common.to' | translate | async"
21508
21534
  [ngModel]="value()?.to"
21509
21535
  (onValueChanged)="handleValueChange($event, 'to')"
@@ -21514,7 +21540,11 @@ class AXPDateTimeFilterWidgetEditComponent extends AXPValueWidgetComponent {
21514
21540
  }
21515
21541
  @if (filterTypeSelectedItem() === 'Greater Than' || filterTypeSelectedItem() === 'Less Than') {
21516
21542
  <div class="ax-w-full ax-mt-2">
21517
- <ax-datetime-box format="YYYY/MM/DD" [ngModel]="value()" (onValueChanged)="handleValueChange($event, 'self')">
21543
+ <ax-datetime-box
21544
+ [format]="calendarFormat()"
21545
+ [ngModel]="value()"
21546
+ (onValueChanged)="handleValueChange($event, 'self')"
21547
+ >
21518
21548
  <ax-clear-button></ax-clear-button>
21519
21549
  </ax-datetime-box>
21520
21550
  </div>
@@ -21539,7 +21569,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
21539
21569
  @if (filterTypeSelectedItem() === 'Between') {
21540
21570
  <div class="ax-flex ax-gap-2 ax-mt-2">
21541
21571
  <ax-datetime-box
21542
- format="YYYY/MM/DD"
21572
+ [format]="calendarFormat()"
21543
21573
  [placeholder]="'@general:terms.common.from' | translate | async"
21544
21574
  [ngModel]="value()?.from"
21545
21575
  (onValueChanged)="handleValueChange($event, 'from')"
@@ -21547,7 +21577,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
21547
21577
  <ax-clear-button></ax-clear-button>
21548
21578
  </ax-datetime-box>
21549
21579
  <ax-datetime-box
21550
- format="YYYY/MM/DD"
21580
+ [format]="calendarFormat()"
21551
21581
  [placeholder]="'@general:terms.common.to' | translate | async"
21552
21582
  [ngModel]="value()?.to"
21553
21583
  (onValueChanged)="handleValueChange($event, 'to')"
@@ -21558,7 +21588,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
21558
21588
  }
21559
21589
  @if (filterTypeSelectedItem() === 'Greater Than' || filterTypeSelectedItem() === 'Less Than') {
21560
21590
  <div class="ax-w-full ax-mt-2">
21561
- <ax-datetime-box format="YYYY/MM/DD" [ngModel]="value()" (onValueChanged)="handleValueChange($event, 'self')">
21591
+ <ax-datetime-box
21592
+ [format]="calendarFormat()"
21593
+ [ngModel]="value()"
21594
+ (onValueChanged)="handleValueChange($event, 'self')"
21595
+ >
21562
21596
  <ax-clear-button></ax-clear-button>
21563
21597
  </ax-datetime-box>
21564
21598
  </div>
@@ -22015,22 +22049,26 @@ class AXPTimeDurationFilterComponent extends AXPValueWidgetComponent {
22015
22049
  path: this.editorPath,
22016
22050
  }, ...(ngDevMode ? [{ debugName: "timeDurationNode" }] : []));
22017
22051
  this.#efUpdateTimeDurationNode = effect(() => {
22018
- const node = {
22019
- type: 'time-duration',
22020
- path: this.editorPath,
22021
- options: {
22022
- hasClearButton: this.hasClearButton(),
22023
- from: { title: 'HOUR' },
22024
- to: { title: 'MINUTE' },
22025
- },
22026
- };
22027
- this.timeDurationNode.set(node);
22052
+ untracked(async () => {
22053
+ const node = {
22054
+ type: 'time-duration',
22055
+ path: this.editorPath,
22056
+ defaultValue: this.value(),
22057
+ options: {
22058
+ from: { title: 'HOUR' },
22059
+ to: { title: 'MINUTE' },
22060
+ },
22061
+ };
22062
+ this.timeDurationNode.set(node);
22063
+ });
22028
22064
  }, ...(ngDevMode ? [{ debugName: "#efUpdateTimeDurationNode" }] : []));
22029
22065
  this.displayText = async () => {
22030
22066
  return await this.timeDurationFormatter.millisecondsToMask(this.value(), 'HOUR', 'MINUTE', false, '00:00:00:00:00:00:00:000', true);
22031
22067
  };
22032
22068
  this.#efUpdateValue = effect(async () => {
22033
22069
  const newValue = this.contextService.getValue(this.editorPath);
22070
+ if (!newValue)
22071
+ return;
22034
22072
  untracked(async () => {
22035
22073
  this.setValue({
22036
22074
  value: newValue,