commons-shared-web-ui 0.0.16 → 0.0.18

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.
@@ -3687,6 +3687,9 @@ class SmartFormTranslationUtils {
3687
3687
  field.placeholder = translate(field.placeholder);
3688
3688
  if (field.hint)
3689
3689
  field.hint = translate(field.hint);
3690
+ if (field.richTextConfig?.placeholder) {
3691
+ field.richTextConfig.placeholder = translate(field.richTextConfig.placeholder);
3692
+ }
3690
3693
  if (field.textConfig?.patternMessage) {
3691
3694
  field.textConfig.patternMessage = translate(field.textConfig.patternMessage);
3692
3695
  }
@@ -4376,9 +4379,13 @@ class FormFieldComponent {
4376
4379
  next: responses => {
4377
4380
  let mergedData = [];
4378
4381
  responses.forEach(response => {
4379
- const data = optionConfig?.dataPath
4382
+ let data = optionConfig?.dataPath
4380
4383
  ? this.getValueByPath(response, optionConfig.dataPath)
4381
- : (Array.isArray(response) ? response : response.data || response.items || []);
4384
+ : (Array.isArray(response) ? response : response.data || response.items || response || []);
4385
+ // Handle Dictionary Objects by converting them to Arrays
4386
+ if (data !== null && typeof data === 'object' && !Array.isArray(data)) {
4387
+ data = Object.values(data);
4388
+ }
4382
4389
  if (Array.isArray(data))
4383
4390
  mergedData = [...mergedData, ...data];
4384
4391
  });
@@ -6977,9 +6984,13 @@ class SmartTableComponent {
6977
6984
  let request$; // Observable
6978
6985
  if (totalCountConfig?.source === 'separate' && totalCountConfig.apiUrl) {
6979
6986
  const headers = this.getHeaders();
6987
+ const method = this.config.apiMethod || 'GET';
6988
+ const body = this.config.apiPayload || {};
6989
+ const dataRequest$ = method === 'POST' ? this.http.post(this.config.apiUrl, body, { params, headers }) : this.http.get(this.config.apiUrl, { params, headers });
6990
+ const countRequest$ = method === 'POST' ? this.http.post(totalCountConfig.apiUrl, body, { params, headers }) : this.http.get(totalCountConfig.apiUrl, { params, headers });
6980
6991
  request$ = forkJoin({
6981
- data: this.http.get(this.config.apiUrl, { params, headers }),
6982
- count: this.http.get(totalCountConfig.apiUrl, { params, headers })
6992
+ data: dataRequest$,
6993
+ count: countRequest$
6983
6994
  }).pipe(map(({ data, count }) => {
6984
6995
  const dataPath = this.config.dataResponsePath !== undefined ? this.config.dataResponsePath : '';
6985
6996
  return {
@@ -6990,7 +7001,10 @@ class SmartTableComponent {
6990
7001
  }
6991
7002
  else {
6992
7003
  const headers = this.getHeaders();
6993
- request$ = this.http.get(this.config.apiUrl, { params, headers }).pipe(map(response => {
7004
+ const method = this.config.apiMethod || 'GET';
7005
+ const body = this.config.apiPayload || {};
7006
+ const baseRequest$ = method === 'POST' ? this.http.post(this.config.apiUrl, body, { params, headers }) : this.http.get(this.config.apiUrl, { params, headers });
7007
+ request$ = baseRequest$.pipe(map(response => {
6994
7008
  const dataPath = this.config.dataResponsePath !== undefined ? this.config.dataResponsePath : '';
6995
7009
  const totalPath = totalCountConfig?.responsePath || '';
6996
7010
  return {
@@ -7227,7 +7241,19 @@ class SmartTableComponent {
7227
7241
  this.config.filters.forEach(filter => {
7228
7242
  if (filter.apiUrl && !filter.options) {
7229
7243
  const headers = this.getHeaders();
7230
- this.http.get(filter.apiUrl, { headers }).subscribe({
7244
+ let params = new HttpParams();
7245
+ if (filter.handling === 'nested_string' && filter.nestedStringConfig) {
7246
+ const { paramName, baseValue } = filter.nestedStringConfig;
7247
+ if (baseValue) {
7248
+ params = params.set(paramName, baseValue);
7249
+ }
7250
+ }
7251
+ const method = filter.apiMethod || 'GET';
7252
+ const body = filter.apiPayload || {};
7253
+ const request$ = method === 'POST'
7254
+ ? this.http.post(filter.apiUrl, body, { headers, params })
7255
+ : this.http.get(filter.apiUrl, { headers, params });
7256
+ request$.subscribe({
7231
7257
  next: (response) => {
7232
7258
  const data = filter.dataPath ? this.getValueByPath(response, filter.dataPath) : response;
7233
7259
  if (!Array.isArray(data)) {
@@ -7399,6 +7425,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
7399
7425
  }]
7400
7426
  }] });
7401
7427
 
7428
+ function appendBaseUrlRecursively(obj, baseURL) {
7429
+ if (obj && typeof obj === 'object') {
7430
+ if (obj.apiUrl && typeof obj.apiUrl === 'string' && !obj.apiUrl.startsWith('http://') && !obj.apiUrl.startsWith('https://')) {
7431
+ let finalApiUrl = obj.apiUrl;
7432
+ if (baseURL.endsWith('/') && finalApiUrl.startsWith('/')) {
7433
+ finalApiUrl = finalApiUrl.substring(1);
7434
+ }
7435
+ else if (!baseURL.endsWith('/') && !finalApiUrl.startsWith('/')) {
7436
+ finalApiUrl = '/' + finalApiUrl;
7437
+ }
7438
+ obj.apiUrl = baseURL + finalApiUrl;
7439
+ }
7440
+ for (const key in obj) {
7441
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
7442
+ appendBaseUrlRecursively(obj[key], baseURL);
7443
+ }
7444
+ }
7445
+ }
7446
+ }
7447
+
7402
7448
  class ValidationUtils {
7403
7449
  static email() {
7404
7450
  return (control) => {
@@ -8839,5 +8885,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
8839
8885
  * Generated bundle index. Do not edit.
8840
8886
  */
8841
8887
 
8842
- export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CheckboxComponent, ConfigurableFormComponent, configurableForm_examples as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_SIDE_NAV_TOOLTIP_POSITION, DatepickerComponent, DropdownComponent, ExpressionService, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FormComponentsModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SideNavComponent, SideNavModule, SmartFormComponent, SmartFormController, smartForm_examples as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, ToggleComponent, ValidationUtils, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
8888
+ export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CheckboxComponent, ConfigurableFormComponent, configurableForm_examples as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_SIDE_NAV_TOOLTIP_POSITION, DatepickerComponent, DropdownComponent, ExpressionService, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FormComponentsModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SideNavComponent, SideNavModule, SmartFormComponent, SmartFormController, smartForm_examples as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, ToggleComponent, ValidationUtils, appendBaseUrlRecursively, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
8843
8889
  //# sourceMappingURL=commons-shared-web-ui.mjs.map