@pega/angular-sdk-overrides 0.242.7 → 0.242.9

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 (53) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  3. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -0
  4. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  5. package/lib/designSystemExtension/operator/operator.component.scss +10 -2
  6. package/lib/designSystemExtension/operator/operator.component.ts +4 -3
  7. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  8. package/lib/field/auto-complete/auto-complete.component.ts +15 -2
  9. package/lib/field/currency/currency.component.ts +19 -13
  10. package/lib/field/date-time/date-time.component.html +0 -1
  11. package/lib/field/date-time/date-time.component.ts +17 -3
  12. package/lib/field/decimal/decimal.component.html +1 -0
  13. package/lib/field/decimal/decimal.component.ts +38 -15
  14. package/lib/field/dropdown/dropdown.component.ts +18 -4
  15. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  16. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -2
  17. package/lib/field/percentage/percentage.component.html +1 -1
  18. package/lib/field/percentage/percentage.component.ts +27 -17
  19. package/lib/field/phone/config-ext.json +1 -1
  20. package/lib/field/phone/phone.component.ts +6 -13
  21. package/lib/field/rich-text/rich-text.component.ts +12 -3
  22. package/lib/field/text/text.component.ts +2 -2
  23. package/lib/field/text-input/text-input.component.ts +1 -1
  24. package/lib/field/time/time.component.html +1 -1
  25. package/lib/field/time/time.component.ts +21 -6
  26. package/lib/field/user-reference/user-reference.component.html +40 -38
  27. package/lib/field/user-reference/user-reference.component.ts +70 -7
  28. package/lib/infra/Containers/flow-container/flow-container.component.ts +7 -2
  29. package/lib/infra/Containers/flow-container/helpers.ts +1 -1
  30. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  31. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +0 -1
  32. package/lib/infra/action-buttons/action-buttons.component.html +1 -1
  33. package/lib/infra/assignment/assignment.component.ts +2 -4
  34. package/lib/infra/assignment-card/assignment-card.component.ts +4 -32
  35. package/lib/infra/defer-load/defer-load.component.ts +4 -1
  36. package/lib/infra/reference/reference.component.ts +70 -86
  37. package/lib/infra/root-container/root-container.component.ts +24 -17
  38. package/lib/template/default-form/default-form.component.ts +5 -7
  39. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  40. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  41. package/lib/template/field-group-template/field-group-template.component.ts +64 -41
  42. package/lib/template/field-group-template/utils.ts +9 -0
  43. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  44. package/lib/template/field-value-list/field-value-list.component.scss +4 -0
  45. package/lib/template/list-view/list-view.component.html +3 -1
  46. package/lib/template/list-view/list-view.component.ts +1 -1
  47. package/lib/template/simple-table-manual/helpers.ts +18 -2
  48. package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
  49. package/lib/template/simple-table-manual/simple-table-manual.component.scss +11 -3
  50. package/lib/template/simple-table-manual/simple-table-manual.component.ts +62 -22
  51. package/lib/widget/todo/todo.component.html +0 -1
  52. package/lib/widget/todo/todo.component.scss +2 -0
  53. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
- import { Component, OnInit, Input, NgZone, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, Input, NgZone, forwardRef, OnDestroy, inject } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
4
4
  import { interval, Subscription } from 'rxjs';
5
5
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
+ import { ServerConfigService } from '@pega/angular-sdk-components';
6
7
  import { ProgressSpinnerService } from '@pega/angular-sdk-components';
7
8
  import { ReferenceComponent } from '@pega/angular-sdk-components';
8
9
  import { PreviewViewContainerComponent } from '@pega/angular-sdk-components';
@@ -37,6 +38,8 @@ export class RootContainerComponent implements OnInit, OnDestroy {
37
38
  @Input() displayOnlyFA$: boolean;
38
39
  @Input() isMashup$: boolean;
39
40
 
41
+ scService = inject(ServerConfigService);
42
+
40
43
  // For interaction with AngularPConnect
41
44
  angularPConnectData: AngularPConnectData = {};
42
45
 
@@ -62,8 +65,6 @@ export class RootContainerComponent implements OnInit, OnDestroy {
62
65
  ) {}
63
66
 
64
67
  ngOnInit(): void {
65
- const myContext = 'app';
66
-
67
68
  const { containers } = PCore.getStore().getState();
68
69
  const items = Object.keys(containers).filter(item => item.includes('root'));
69
70
 
@@ -84,24 +85,11 @@ export class RootContainerComponent implements OnInit, OnDestroy {
84
85
 
85
86
  this.pvConn$ = configObjPreview.getPConnect();
86
87
 
87
- const configObjModal = PCore.createPConnect({
88
- meta: {
89
- type: 'ModalViewContainer',
90
- config: {
91
- name: 'modal'
92
- }
93
- },
94
- options: {
95
- pageReference: 'pyPortal',
96
- context: myContext
97
- }
98
- });
88
+ this.configureModalContainer();
99
89
 
100
90
  // clear out hasViewContainer
101
91
  sessionStorage.setItem('hasViewContainer', 'false');
102
92
 
103
- this.mConn$ = configObjModal.getPConnect();
104
-
105
93
  // First thing in initialization is registering and subscribing to the AngularPConnect service
106
94
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
107
95
 
@@ -181,6 +169,25 @@ export class RootContainerComponent implements OnInit, OnDestroy {
181
169
  }
182
170
  }
183
171
 
172
+ async configureModalContainer() {
173
+ const sdkConfig = await this.scService.getSdkConfig();
174
+ const showModalsInEmbeddedMode = sdkConfig.serverConfig.showModalsInEmbeddedMode;
175
+
176
+ if (!this.displayOnlyFA$ || showModalsInEmbeddedMode) {
177
+ const configObjModal = PCore.createPConnect({
178
+ meta: {
179
+ type: 'ModalViewContainer',
180
+ config: {
181
+ name: 'modal'
182
+ }
183
+ },
184
+ options
185
+ });
186
+
187
+ this.mConn$ = configObjModal.getPConnect();
188
+ }
189
+ }
190
+
184
191
  generateViewContainerForNoPortal() {
185
192
  // bootstrap loadMashup resolves to here
186
193
  const arChildren = this.pConn$.getChildren() as any[];
@@ -1,8 +1,8 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
5
+ import { ReferenceComponent } from '@pega/angular-sdk-components';
6
6
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
7
  import { TemplateUtils } from '@pega/angular-sdk-components';
8
8
  import { FormTemplateBase } from '@pega/angular-sdk-components';
@@ -31,7 +31,7 @@ interface DefaultFormProps {
31
31
  standalone: true,
32
32
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
33
33
  })
34
- export class DefaultFormComponent extends FormTemplateBase implements OnInit, OnDestroy {
34
+ export class DefaultFormComponent extends FormTemplateBase implements OnInit {
35
35
  @Input() override pConn$: typeof PConnect;
36
36
  @Input() formGroup$: FormGroup;
37
37
 
@@ -86,10 +86,8 @@ export class DefaultFormComponent extends FormTemplateBase implements OnInit, On
86
86
  // normalize them
87
87
  const children = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren());
88
88
 
89
- const visibleChildren = children?.filter(child => child !== undefined) || [];
90
-
91
- if (areViewsChanged(this.arChildren$, visibleChildren)) {
92
- this.arChildren$ = visibleChildren;
89
+ if (areViewsChanged(this.arChildren$, children)) {
90
+ this.arChildren$ = children;
93
91
  }
94
92
  }
95
93
  }
@@ -1,5 +1,5 @@
1
1
  <div id="field-group">
2
- <h3 *ngIf="showLabel$" className="label" style="font-weight: bold">
2
+ <h3 *ngIf="showLabel$" class="field-group-template-header" style="font-weight: bold">
3
3
  {{ label$ }}
4
4
  </h3>
5
5
  <div *ngIf="readonlyMode; else editable">
@@ -11,23 +11,23 @@
11
11
  </div>
12
12
  <ng-template #editable>
13
13
  <div *ngIf="children && children.length > 0">
14
- <div *ngFor="let kid of children; let i = index">
14
+ <div class="field-group-template-item" *ngFor="let child of children; let i = index">
15
15
  <div class="header-div">
16
16
  <div style="width: 80%">
17
- <b>{{ kid.name }}</b>
17
+ <b>{{ child.name }}</b>
18
18
  </div>
19
- <div *ngIf="allowAddEdit !== false" style="width: 20%; text-align: right">
19
+ <div *ngIf="allowDelete && child.allowRowDelete" style="width: 20%; text-align: right">
20
20
  <button id="delete-button" mat-icon-button (click)="deleteFieldGroupItem(i)">
21
21
  <img class="psdk-utility-card-action-svg-icon" src="{{ menuIconOverride$ }}" />
22
22
  </button>
23
23
  </div>
24
24
  </div>
25
25
 
26
- <div *ngIf="kid.children.getPConnect().getRawMetadata().type.toLowerCase() == 'region'">
27
- <component-mapper name="Region" [props]="{ pConn$: kid.children.getPConnect(), formGroup$ }"></component-mapper>
26
+ <div *ngIf="child.children.getPConnect().getRawMetadata().type.toLowerCase() == 'region'">
27
+ <component-mapper name="Region" [props]="{ pConn$: child.children.getPConnect(), formGroup$ }"></component-mapper>
28
28
  </div>
29
29
  </div>
30
- <button *ngIf="allowAddEdit !== false" mat-button color="primary" style="font-size: 16px" (click)="addFieldGroupItem()">+ Add</button>
31
30
  </div>
31
+ <button *ngIf="allowAdd" mat-button color="primary" style="font-size: 16px" (click)="addFieldGroupItem()">{{ getAddBtnLabel() }}</button>
32
32
  </ng-template>
33
33
  </div>
@@ -6,3 +6,11 @@
6
6
  display: flex;
7
7
  align-items: center;
8
8
  }
9
+
10
+ .field-group-template-header {
11
+ margin-left: 0;
12
+ }
13
+
14
+ .field-group-template-item {
15
+ padding-block: 1rem;
16
+ }
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnDestroy, OnChanges, AfterViewInit } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { MatButtonModule } from '@angular/material/button';
@@ -6,11 +6,14 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
6
6
  import { buildView, getReferenceList } from '@pega/angular-sdk-components';
7
7
  import { Utils } from '@pega/angular-sdk-components';
8
8
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
+ import { evaluateAllowRowAction } from './utils';
9
10
 
10
11
  interface FieldGroupTemplateProps {
11
12
  // If any, enter additional props that only exist on this component
12
13
  label?: string;
13
- showLabel?: boolean;
14
+ hideLabel?: boolean;
15
+ allowActions?: any;
16
+ allowRowDelete?: any;
14
17
  referenceList?: any[];
15
18
  contextClass: string;
16
19
  renderMode?: string;
@@ -19,6 +22,7 @@ interface FieldGroupTemplateProps {
19
22
  displayMode?: string;
20
23
  fieldHeader?: string;
21
24
  allowTableEdit: boolean;
25
+ targetClassLabel?: string;
22
26
  }
23
27
 
24
28
  @Component({
@@ -28,26 +32,27 @@ interface FieldGroupTemplateProps {
28
32
  standalone: true,
29
33
  imports: [CommonModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)]
30
34
  })
31
- export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges {
35
+ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
32
36
  @Input() configProps$: FieldGroupTemplateProps;
33
37
  @Input() pConn$: typeof PConnect;
34
38
  @Input() formGroup$: FormGroup;
35
39
 
36
40
  angularPConnectData: AngularPConnectData = {};
37
- inheritedProps$: object;
41
+
38
42
  showLabel$?: boolean = true;
39
43
  label$?: string;
40
44
  readonlyMode: boolean;
41
45
  contextClass: any;
42
- referenceList: any;
43
- pageReference: any;
44
46
  heading: any;
45
47
  children: any;
46
48
  menuIconOverride$: any;
47
- prevRefLength: number;
48
- allowAddEdit: boolean;
49
+ referenceListLength: number;
49
50
  fieldHeader: any;
50
51
 
52
+ allowAdd = true;
53
+ allowEdit = true;
54
+ allowDelete = true;
55
+
51
56
  constructor(
52
57
  private angularPConnect: AngularPConnectService,
53
58
  private utils: Utils
@@ -58,9 +63,21 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
58
63
  this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
59
64
  this.updateSelf();
60
65
 
61
- const menuIconOverride$ = 'trash';
62
- if (menuIconOverride$) {
63
- this.menuIconOverride$ = this.utils.getImageSrc(menuIconOverride$, this.utils.getSDKStaticContentUrl());
66
+ this.menuIconOverride$ = this.utils.getImageSrc('trash', this.utils.getSDKStaticContentUrl());
67
+
68
+ const { allowActions, allowTableEdit, referenceList } = this.configProps$;
69
+
70
+ if (allowActions && Object.keys(allowActions).length > 0) {
71
+ this.allowAdd = allowActions.allowAdd ?? allowTableEdit ?? true;
72
+ this.allowEdit = allowActions.allowEdit ?? true;
73
+ this.allowDelete = allowActions.allowDelete ?? allowTableEdit ?? true;
74
+ } else {
75
+ this.allowAdd = allowTableEdit ?? true;
76
+ this.allowDelete = allowTableEdit ?? true;
77
+ }
78
+
79
+ if (referenceList?.length === 0 && (this.allowAdd || this.allowEdit)) {
80
+ this.pConn$.getListActions().insert({ classID: this.contextClass }, referenceList.length);
64
81
  }
65
82
  }
66
83
 
@@ -85,56 +102,57 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
85
102
  const props = changes.configProps$;
86
103
  if (props.currentValue !== props.previousValue) {
87
104
  this.configProps$ = props.currentValue;
105
+
88
106
  if (changes?.pConn$?.currentValue) {
89
107
  this.pConn$ = changes?.pConn$?.currentValue;
90
108
  }
109
+
91
110
  this.updateSelf();
92
111
  }
93
112
  }
94
113
  }
95
114
 
115
+ ngAfterViewInit() {
116
+ const resolvedList = getReferenceList(this.pConn$);
117
+ // @ts-ignore - Expected 3 arguments, but got 1
118
+ this.pConn$.getListActions().initDefaultPageInstructions(resolvedList);
119
+ }
120
+
96
121
  updateSelf() {
97
- this.inheritedProps$ = this.pConn$.getInheritedProps();
98
- this.label$ = this.configProps$.label;
99
- this.showLabel$ = this.configProps$.showLabel;
100
- // label & showLabel within inheritedProps takes precedence over configProps
101
- this.label$ = (this.inheritedProps$ as any).label || this.label$;
102
- this.showLabel$ = (this.inheritedProps$ as any).showLabel || this.showLabel$;
122
+ const inheritedProps: any = this.pConn$.getInheritedProps();
103
123
 
104
- this.allowAddEdit = this.configProps$.allowTableEdit;
124
+ const { label, hideLabel, allowRowDelete, referenceList, fieldHeader, renderMode, displayMode, heading, contextClass, lookForChildInConfig } =
125
+ this.configProps$;
126
+
127
+ // label within inheritedProps takes precedence over configProps
128
+ this.label$ = inheritedProps.label || label;
129
+
130
+ this.showLabel$ = referenceList?.length === 0 || !hideLabel;
105
131
 
106
- const renderMode = this.configProps$.renderMode;
107
- const displayMode = this.configProps$.displayMode;
108
132
  this.readonlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY';
109
- this.contextClass = this.configProps$.contextClass;
110
- const lookForChildInConfig = this.configProps$.lookForChildInConfig;
111
- this.heading = this.configProps$.heading ?? 'Row';
112
- this.fieldHeader = this.configProps$.fieldHeader;
133
+
134
+ this.contextClass = contextClass;
135
+ this.heading = heading ?? 'Row';
136
+ this.fieldHeader = fieldHeader;
137
+
113
138
  const resolvedList = getReferenceList(this.pConn$);
114
- this.pageReference = `${this.pConn$.getPageReference()}${resolvedList}`;
115
139
  this.pConn$.setReferenceList(resolvedList);
140
+
116
141
  if (this.readonlyMode) {
117
142
  this.pConn$.setInheritedProp('displayMode', 'DISPLAY_ONLY');
118
143
  }
119
- this.referenceList = this.configProps$.referenceList;
120
- if (this.prevRefLength != this.referenceList?.length) {
121
- // eslint-disable-next-line sonarjs/no-collapsible-if
122
- if (!this.readonlyMode) {
123
- if (this.referenceList?.length === 0 && this.allowAddEdit !== false) {
124
- this.addFieldGroupItem();
125
- }
126
- }
127
- const children: any = [];
128
- this.referenceList?.forEach((item, index) => {
129
- children.push({
144
+
145
+ if (this.referenceListLength != referenceList?.length) {
146
+ this.children = referenceList?.map((item, index) => {
147
+ return {
130
148
  id: index,
131
149
  name: this.fieldHeader === 'propertyRef' ? this.getDynamicHeader(item, index) : this.getStaticHeader(this.heading, index),
132
- children: buildView(this.pConn$, index, lookForChildInConfig)
133
- });
150
+ children: buildView(this.pConn$, index, lookForChildInConfig),
151
+ allowRowDelete: evaluateAllowRowAction(allowRowDelete, item)
152
+ };
134
153
  });
135
- this.children = children;
136
154
  }
137
- this.prevRefLength = this.referenceList.length;
155
+ this.referenceListLength = referenceList?.length || 0;
138
156
  }
139
157
 
140
158
  getStaticHeader = (heading, index) => {
@@ -149,10 +167,15 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges
149
167
  };
150
168
 
151
169
  addFieldGroupItem() {
152
- this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length);
170
+ this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceListLength);
153
171
  }
154
172
 
155
173
  deleteFieldGroupItem(index) {
156
174
  this.pConn$.getListActions().deleteEntry(index);
157
175
  }
176
+
177
+ getAddBtnLabel() {
178
+ const { targetClassLabel } = this.configProps$;
179
+ return targetClassLabel ? `+ Add ${targetClassLabel}` : '+ Add';
180
+ }
158
181
  }
@@ -0,0 +1,9 @@
1
+ export const evaluateAllowRowAction = (allowRowDelete, rowData) => {
2
+ if (allowRowDelete === undefined || allowRowDelete === true) return true;
3
+ if (allowRowDelete.startsWith?.('@E ')) {
4
+ const expression = allowRowDelete.replace('@E ', '');
5
+ // @ts-ignore
6
+ return PCore.getExpressionEngine().evaluate(expression, rowData);
7
+ }
8
+ return false;
9
+ };
@@ -1,5 +1,5 @@
1
- <div *ngIf="displayMode$ === 'DISPLAY_ONLY'; else STACKED_LARGE_VAL" class="psdk-container-labels-left">
2
- <div class="psdk-grid-label">{{ label$ }}</div>
1
+ <div *ngIf="displayMode$ === 'DISPLAY_ONLY'; else STACKED_LARGE_VAL" [ngClass]="label$ ? 'psdk-container-labels-left' : 'psdk-container-nolabels'">
2
+ <div *ngIf="label$" class="psdk-grid-label">{{ label$ }}</div>
3
3
  <div class="psdk-val-labels-left">
4
4
  <ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
5
5
  </div>
@@ -6,6 +6,10 @@
6
6
  align-items: start;
7
7
  padding-block: 8px;
8
8
  }
9
+ .psdk-container-nolabels {
10
+ align-items: start;
11
+ padding-block: 8px;
12
+ }
9
13
  .psdk-value {
10
14
  margin: 8px 0px;
11
15
  }
@@ -180,7 +180,9 @@
180
180
  <tr mat-header-row *matHeaderRowDef="displayedColumns$"></tr>
181
181
  </table>
182
182
  </div>
183
- <div class="psdk-no-records" *ngIf="repeatListData?.length === 0">No Records Found.</div>
183
+ <div class="psdk-no-records" *ngIf="repeatListData?.length === 0">
184
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
185
+ </div>
184
186
  </div>
185
187
  </div>
186
188
  </div>
@@ -165,7 +165,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
165
165
 
166
166
  constructor(
167
167
  private psService: ProgressSpinnerService,
168
- private utils: Utils
168
+ public utils: Utils
169
169
  ) {}
170
170
 
171
171
  ngOnInit(): void {
@@ -191,7 +191,7 @@ export const createMetaForTable = (fields, renderMode) => {
191
191
  };
192
192
 
193
193
  export const filterDataByDate = (item, filterObj) => {
194
- let bKeep;
194
+ let bKeep = true;
195
195
  let value = item[filterObj.ref] != null || item[filterObj.ref] != '' ? getSeconds(item[filterObj.ref]) : null;
196
196
  let filterValue = filterObj.containsFilterValue != null && filterObj.containsFilterValue != '' ? getSeconds(filterObj.containsFilterValue) : null;
197
197
 
@@ -239,7 +239,7 @@ export const filterDataByDate = (item, filterObj) => {
239
239
  };
240
240
 
241
241
  export const filterDataByCommonFields = (item, filterObj) => {
242
- let bKeep;
242
+ let bKeep = true;
243
243
  const value = item[filterObj.ref].toLowerCase();
244
244
  const filterValue = filterObj.containsFilterValue.toLowerCase();
245
245
 
@@ -294,3 +294,19 @@ export const createPConnect = (contextName, referenceList, pageReference) => {
294
294
 
295
295
  return getPConnect();
296
296
  };
297
+
298
+ /**
299
+ * This method evaluates whether a row action is allowed based on the provided conditions.
300
+ * @param {string|boolean|undefined} allowRowDelete - The condition for allowing row deletion.
301
+ * @param {object} rowData - The data of the row being evaluated.
302
+ * @returns {boolean} - Returns true if the row action is allowed, false otherwise.
303
+ */
304
+ export const evaluateAllowRowAction = (allowRowDelete, rowData) => {
305
+ if (allowRowDelete === undefined || allowRowDelete === true) return true;
306
+ if (allowRowDelete.startsWith?.('@E ')) {
307
+ const expression = allowRowDelete.replace('@E ', '');
308
+ // @ts-ignore - Expected 3 arguments, but got 2
309
+ return PCore.getExpressionEngine().evaluate(expression, rowData);
310
+ }
311
+ return false;
312
+ };
@@ -3,8 +3,8 @@
3
3
  <h3 *ngIf="label" className="label" style="font-weight: bold">
4
4
  {{ label }} <span class="results-count">{{ getResultsText() }}</span>
5
5
  </h3>
6
- <table *ngIf="readOnlyMode || allowEditingInModal" mat-table [dataSource]="rowData" class="mat-elevation-z8" id="readonly-table" matSort>
7
- <ng-container *ngFor="let dCol of processedFields" [matColumnDef]="dCol.config.name">
6
+ <table *ngIf="readOnlyMode || allowEditingInModal" mat-table [dataSource]="elementsData" class="mat-elevation-z8" id="readonly-table" matSort>
7
+ <ng-container *ngFor="let dCol of processedFields; let i = index" [matColumnDef]="dCol.config.name">
8
8
  <th mat-header-cell *matHeaderCellDef mat-sort-header (click)="_headerSortClick($event, dCol)" arrowPosition="before">
9
9
  <div>{{ dCol.config.label }}</div>
10
10
  <div class="psdk-mat-header-filter">
@@ -27,7 +27,16 @@
27
27
  </mat-menu>
28
28
  </div>
29
29
  </th>
30
- <td mat-cell *matCellDef="let element">{{ element[dCol.config.name] || '---' }}</td>
30
+ <td mat-cell *matCellDef="let element">
31
+ <component-mapper
32
+ [name]="element[i].getPConnect().getComponentName()"
33
+ [props]="{
34
+ pConn$: element[i].getPConnect(),
35
+ formGroup$: formGroup$
36
+ }"
37
+ errorMsg="Table wants component not yet available: {{ element[i].getPConnect().getComponentName() }}"
38
+ ></component-mapper>
39
+ </td>
31
40
  </ng-container>
32
41
  <ng-container matColumnDef="DeleteIcon">
33
42
  <div *ngIf="allowEditingInModal">
@@ -47,6 +56,11 @@
47
56
  </ng-container>
48
57
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
49
58
  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
59
+ <tr class="mat-row psdk-no-records" *matNoDataRow>
60
+ <td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
61
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
62
+ </td>
63
+ </tr>
50
64
  </table>
51
65
  <table *ngIf="editableMode && !allowEditingInModal" mat-table [dataSource]="elementsData" class="mat-elevation-z8" id="editable-table">
52
66
  <ng-container *ngFor="let dCol of fieldDefs; let i = index">
@@ -74,11 +88,16 @@
74
88
  </ng-container>
75
89
  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
76
90
  <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
91
+ <tr class="mat-row psdk-no-records" *matNoDataRow>
92
+ <td id="no-records" class="mat-cell" [attr.colspan]="displayedColumns.length">
93
+ {{ utils.getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.') }}
94
+ </td>
95
+ </tr>
77
96
  </table>
78
- <div class="psdk-no-records" id="no-records" *ngIf="editableMode && referenceList?.length === 0">No Records Found.</div>
79
- <div class="psdk-no-records" id="no-records" *ngIf="readOnlyMode && rowData?.data?.length === 0">No Records Found.</div>
80
97
  </div>
81
- <button *ngIf="showAddRowButton" mat-button color="primary" style="font-size: 16px" (click)="addRecord()">+ Add</button>
98
+ <button *ngIf="showAddRowButton" mat-button color="primary" style="font-size: 16px" (click)="addRecord()">
99
+ + {{ localizedVal('Add', localeCategory) }}
100
+ </button>
82
101
  </ng-container>
83
102
 
84
103
  <!-- pop overs for filters-->
@@ -5,6 +5,10 @@
5
5
  margin-top: 0.5rem;
6
6
  margin-bottom: 0.5rem;
7
7
  overflow-y: auto;
8
+ box-shadow:
9
+ 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
10
+ 0px 1px 1px 0px rgba(0, 0, 0, 0.14),
11
+ 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
8
12
  }
9
13
 
10
14
  table {
@@ -24,6 +28,12 @@ td.mat-mdc-cell,
24
28
  td.mat-mdc-footer-cell {
25
29
  border-right: 1px solid var(--app-neutral-light-color);
26
30
  padding: 8px !important;
31
+ min-width: 10rem;
32
+ }
33
+
34
+ ::ng-deep th.mat-mdc-header-cell:last-child,
35
+ td.mat-mdc-cell:last-child {
36
+ min-width: 2rem;
27
37
  }
28
38
 
29
39
  ::ng-deep .mat-mdc-button {
@@ -160,9 +170,7 @@ tr.mat-mdc-header-row {
160
170
 
161
171
  .psdk-no-records {
162
172
  height: 56px;
163
- justify-content: center;
164
- display: flex;
165
- align-items: center;
173
+ text-align: center;
166
174
  border: 1px solid var(--app-neutral-light-color);
167
175
  border-top: none;
168
176
  background: var(--app-form-color);