@acorex/platform 20.0.13 → 20.0.21

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.
@@ -20,7 +20,7 @@ import { AXLabelModule } from '@acorex/components/label';
20
20
  import { AXValidationModule, AXValidationService } from '@acorex/core/validation';
21
21
  import * as i2$3 from '@angular/forms';
22
22
  import { FormsModule } from '@angular/forms';
23
- import { AXPClipBoardService, AXPRegionalService, AXPFilterOperatorMiddlewareService, AXPCleanNestedFilters, AXPFileStorageService, AXPFileTypeProviderService, ALL_DEFAULT_OPERATORS, DATE_OPERATORS, BOOLEAN_OPERATORS, NUMBER_OPERATORS, STRING_OPERATORS } from '@acorex/platform/common';
23
+ import { AXPClipBoardService, AXPSettingService, AXPRegionalService, AXPFilterOperatorMiddlewareService, AXPCleanNestedFilters, AXPFileStorageService, AXPFileTypeProviderService, ALL_DEFAULT_OPERATORS, DATE_OPERATORS, BOOLEAN_OPERATORS, NUMBER_OPERATORS, STRING_OPERATORS } from '@acorex/platform/common';
24
24
  import { AXPopupService } from '@acorex/components/popup';
25
25
  import * as i3 from '@acorex/components/select-box';
26
26
  import { AXSelectBoxModule, AXSelectBoxComponent } from '@acorex/components/select-box';
@@ -31,7 +31,7 @@ import { AXTranslationModule, AXTranslationService } from '@acorex/core/translat
31
31
  import * as i1$1 from '@angular/common';
32
32
  import { CommonModule } from '@angular/common';
33
33
  import { AXBasePageComponent } from '@acorex/components/page';
34
- import { AXDateTimeFormatter, AXTimeDurationFormatter, AXCalendarService } from '@acorex/core/date-time';
34
+ import { AXFormatService } from '@acorex/core/format';
35
35
  import * as i3$1 from '@acorex/components/datetime-box';
36
36
  import { AXDateTimeBoxModule } from '@acorex/components/datetime-box';
37
37
  import * as i5 from '@acorex/components/text-area';
@@ -39,7 +39,6 @@ import { AXTextAreaModule } from '@acorex/components/text-area';
39
39
  import { set, isNumber, castArray, cloneDeep, isEqual, sum, get } from 'lodash-es';
40
40
  import * as i4$1 from '@acorex/components/tabs';
41
41
  import { AXTabsModule } from '@acorex/components/tabs';
42
- import { AXFormatService } from '@acorex/core/format';
43
42
  import * as i1$4 from '@acorex/components/number-box';
44
43
  import { AXNumberBoxModule } from '@acorex/components/number-box';
45
44
  import * as i3$2 from '@acorex/components/password-box';
@@ -90,6 +89,7 @@ import { AXColorUtil } from '@acorex/core/utils';
90
89
  import * as i6$3 from '@acorex/components/dropdown-button';
91
90
  import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
92
91
  import { AXDataTableModule } from '@acorex/components/data-table';
92
+ import { AXTimeDurationFormatter, AXCalendarService } from '@acorex/core/date-time';
93
93
  import * as i2$a from '@acorex/components/time-duration';
94
94
  import { AXTimeDurationModule } from '@acorex/components/time-duration';
95
95
  import * as i1$c from '@acorex/components/collapse';
@@ -1834,9 +1834,10 @@ const AXPContactWidget = {
1834
1834
  class AXPDateTimeBoxWidgetViewComponent extends AXPValueWidgetComponent {
1835
1835
  constructor() {
1836
1836
  super(...arguments);
1837
- this.formatter = inject(AXDateTimeFormatter);
1838
- this.translationService = inject(AXTranslationService);
1837
+ this.formatter = inject(AXFormatService);
1838
+ this.settingService = inject(AXPSettingService);
1839
1839
  this.multiple = computed(() => this.options()['multiple']);
1840
+ this.convertedValue = signal(null);
1840
1841
  this.format = computed(() => {
1841
1842
  const rawValue = this.options()['format'];
1842
1843
  if (typeof rawValue == 'string')
@@ -1846,28 +1847,47 @@ class AXPDateTimeBoxWidgetViewComponent extends AXPValueWidgetComponent {
1846
1847
  else
1847
1848
  return 'date';
1848
1849
  });
1849
- this.internalValue = computed(() => Array.isArray(this.getValue())
1850
- ? this.getValue().map((v) => this.handleFormat(v))
1851
- : [this.handleFormat(this.getValue())]);
1850
+ this.#effect = effect(() => {
1851
+ this.updateValue();
1852
+ });
1853
+ this.updateValue = async () => {
1854
+ const rawValue = this.getValue();
1855
+ if (rawValue == null) {
1856
+ this.convertedValue.set(null);
1857
+ }
1858
+ if (this.isArray(rawValue)) {
1859
+ this.convertedValue.set(rawValue.map((item) => this.handleFormat(item)).join(', '));
1860
+ }
1861
+ else {
1862
+ this.convertedValue.set(await this.handleFormat(rawValue));
1863
+ }
1864
+ };
1852
1865
  }
1853
- handleFormat(value) {
1866
+ #effect;
1867
+ async handleFormat(value) {
1868
+ let mode = '';
1869
+ if (this.format() == 'date') {
1870
+ mode = await this.settingService.get('regional:short-date');
1871
+ }
1872
+ else if (this.format() == 'time') {
1873
+ mode = await this.settingService.get('regional:short-time');
1874
+ }
1875
+ else if (this.format() == 'datetime') {
1876
+ mode = `${await this.settingService.get('regional:short-date')} ${await this.settingService.get('regional:short-time')}`;
1877
+ }
1854
1878
  return value
1855
- ? this.formatter.format(new Date(value), {
1856
- format: this.format(),
1857
- locale: this.translationService.getActiveLang() === 'fa' ? 'fa' : undefined,
1879
+ ? this.formatter.format(new Date(value), this.format(), {
1880
+ format: mode,
1858
1881
  })
1859
1882
  : '---';
1860
1883
  }
1884
+ isArray(val) {
1885
+ return Array.isArray(val);
1886
+ }
1861
1887
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXPDateTimeBoxWidgetViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1862
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.7", type: AXPDateTimeBoxWidgetViewComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1888
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.7", type: AXPDateTimeBoxWidgetViewComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1863
1889
  <div class="ax-text-muted">
1864
- @if(multiple()){
1865
- @for (item of internalValue(); track $index) {
1866
- <span dir="ltr" >{{ item }}</span>
1867
- }
1868
- } @else {
1869
- <span dir="ltr" >{{ internalValue()[0] }}</span>
1870
- }
1890
+ <span [dir]="'ltr'" [title]="convertedValue()">{{ convertedValue() }}</span>
1871
1891
  </div>
1872
1892
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1873
1893
  }
@@ -1876,18 +1896,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
1876
1896
  args: [{
1877
1897
  template: `
1878
1898
  <div class="ax-text-muted">
1879
- @if(multiple()){
1880
- @for (item of internalValue(); track $index) {
1881
- <span dir="ltr" >{{ item }}</span>
1882
- }
1883
- } @else {
1884
- <span dir="ltr" >{{ internalValue()[0] }}</span>
1885
- }
1899
+ <span [dir]="'ltr'" [title]="convertedValue()">{{ convertedValue() }}</span>
1886
1900
  </div>
1887
1901
  `,
1888
1902
  changeDetection: ChangeDetectionStrategy.OnPush,
1889
1903
  imports: [],
1890
- inputs: []
1904
+ inputs: [],
1891
1905
  }]
1892
1906
  }] });
1893
1907
 
@@ -1900,6 +1914,7 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPValueWidgetComponent {
1900
1914
  constructor() {
1901
1915
  super(...arguments);
1902
1916
  this.validationService = inject(AXValidationService);
1917
+ this.settingService = inject(AXPSettingService);
1903
1918
  this.multiple = computed(() => this.options()['multiple']);
1904
1919
  this.clearButton = computed(() => this.options()['clearButton']);
1905
1920
  this.format = computed(() => {
@@ -1914,13 +1929,19 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPValueWidgetComponent {
1914
1929
  this.disabled = computed(() => this.options()['disabled']);
1915
1930
  this.placeholder = computed(() => this.options()['placeholder']);
1916
1931
  this.internalValue = computed(() => Array.isArray(this.getValue()) ? this.getValue() : [this.getValue()]);
1917
- this.calendarFormat = computed(() => {
1918
- if (this.format() === 'date')
1919
- return 'DD/MM/YYYY';
1920
- else if (this.format() === 'time')
1921
- return 'HH:mm';
1922
- else
1923
- return 'DD/MM/YYYY HH:mm';
1932
+ this.calendarFormat = signal('date');
1933
+ this.#effect = effect(async () => {
1934
+ let mode = '';
1935
+ if (this.format() == 'date') {
1936
+ mode = await this.settingService.get('regional:short-date');
1937
+ }
1938
+ else if (this.format() == 'time') {
1939
+ mode = await this.settingService.get('regional:short-time');
1940
+ }
1941
+ else if (this.format() == 'datetime') {
1942
+ mode = `${await this.settingService.get('regional:short-date')} ${await this.settingService.get('regional:short-time')}`;
1943
+ }
1944
+ this.calendarFormat.set(mode);
1924
1945
  });
1925
1946
  }
1926
1947
  handleValueChange(e, i) {
@@ -1932,6 +1953,7 @@ class AXPDateTimeBoxWidgetEditComponent extends AXPValueWidgetComponent {
1932
1953
  this.setValue(newValues[0]);
1933
1954
  }
1934
1955
  }
1956
+ #effect;
1935
1957
  addItem() {
1936
1958
  const newValues = [...this.internalValue(), ''];
1937
1959
  this.setValue(newValues);
@@ -2041,7 +2063,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
2041
2063
  AXDateTimeBoxModule,
2042
2064
  AXButtonModule,
2043
2065
  AXDecoratorModule,
2044
- AXValidationModule
2066
+ AXValidationModule,
2045
2067
  ],
2046
2068
  inputs: [],
2047
2069
  }]
@@ -2077,9 +2099,10 @@ var dateTimeBoxWidgetFilter_component = /*#__PURE__*/Object.freeze({
2077
2099
  class AXPDateTimeBoxWidgetColumnComponent extends AXPColumnWidgetComponent {
2078
2100
  constructor() {
2079
2101
  super(...arguments);
2080
- this.formatter = inject(AXDateTimeFormatter);
2081
- this.translationService = inject(AXTranslationService);
2082
- this.multiple = this.options['multiple'];
2102
+ this.formatter = inject(AXFormatService);
2103
+ this.settingService = inject(AXPSettingService);
2104
+ this.convertedValue = signal(this.rawValue);
2105
+ this.multiple = this.options['multiple'] || false;
2083
2106
  this.format = computed(() => {
2084
2107
  const rawValue = this.options['format'];
2085
2108
  if (typeof rawValue == 'string')
@@ -2089,28 +2112,53 @@ class AXPDateTimeBoxWidgetColumnComponent extends AXPColumnWidgetComponent {
2089
2112
  else
2090
2113
  return 'date';
2091
2114
  });
2092
- this.internalValue = () => Array.isArray(this.rawValue)
2093
- ? this.rawValue.map((v) => this.handleFormat(v))
2094
- : [this.handleFormat(this.rawValue)];
2115
+ this.#effect = effect(() => {
2116
+ this.updateValue();
2117
+ });
2118
+ this.updateValue = async () => {
2119
+ const rawValue = this.rawValue;
2120
+ if (rawValue == null) {
2121
+ this.convertedValue.set(null);
2122
+ }
2123
+ if (this.isArray(rawValue)) {
2124
+ this.convertedValue.set(rawValue.map((item) => this.handleFormat(item)).join(', '));
2125
+ }
2126
+ else {
2127
+ this.convertedValue.set(await this.handleFormat(rawValue));
2128
+ }
2129
+ };
2095
2130
  }
2096
- handleFormat(value) {
2131
+ #effect;
2132
+ async handleFormat(value) {
2133
+ let mode = '';
2134
+ if (this.format() == 'date') {
2135
+ mode = await this.settingService.get('regional:short-date');
2136
+ }
2137
+ else if (this.format() == 'time') {
2138
+ mode = await this.settingService.get('regional:short-time');
2139
+ }
2140
+ else if (this.format() == 'datetime') {
2141
+ mode = `${await this.settingService.get('regional:short-date')} ${await this.settingService.get('regional:short-time')}`;
2142
+ }
2097
2143
  return value
2098
- ? this.formatter.format(new Date(value), {
2099
- format: this.format(),
2100
- locale: this.translationService.getActiveLang() === 'fa' ? 'fa' : undefined,
2144
+ ? this.formatter.format(new Date(value), this.format(), {
2145
+ format: mode,
2101
2146
  })
2102
2147
  : '---';
2103
2148
  }
2149
+ isArray(val) {
2150
+ return Array.isArray(val);
2151
+ }
2104
2152
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXPDateTimeBoxWidgetColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2105
2153
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.7", type: AXPDateTimeBoxWidgetColumnComponent, isStandalone: true, selector: "ng-component", inputs: { rawValue: "rawValue", rowData: "rowData" }, usesInheritance: true, ngImport: i0, template: `<div class="ax-flex">
2106
- <span [dir]="'ltr'" [title]="internalValue()">{{ internalValue() }}</span>
2154
+ <span [dir]="'ltr'" [title]="convertedValue()">{{ convertedValue() }}</span>
2107
2155
  </div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2108
2156
  }
2109
2157
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXPDateTimeBoxWidgetColumnComponent, decorators: [{
2110
2158
  type: Component,
2111
2159
  args: [{
2112
2160
  template: `<div class="ax-flex">
2113
- <span [dir]="'ltr'" [title]="internalValue()">{{ internalValue() }}</span>
2161
+ <span [dir]="'ltr'" [title]="convertedValue()">{{ convertedValue() }}</span>
2114
2162
  </div>`,
2115
2163
  changeDetection: ChangeDetectionStrategy.OnPush,
2116
2164
  imports: [CommonModule],