Skip to content

Commit 159db1f

Browse files
samhere06mohas22
andauthored
Fixed the issues found while testing with sdktest app (#309)
* Fixed the issues found while testing with sdktest app * updated function name in autocomplete * updated userreference based on comment --------- Co-authored-by: mohas22 <[email protected]>
1 parent 1c2320b commit 159db1f

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

packages/angular-sdk-components/src/lib/_components/field/auto-complete/auto-complete.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[placeholder]="placeholder"
1212
[formControl]="fieldControl"
1313
[attr.data-test-id]="testId"
14-
[value]="value$"
1514
[required]="bRequired$"
1615
[matAutocomplete]="auto"
1716
(input)="fieldOnChange($event)"

packages/angular-sdk-components/src/lib/_components/field/auto-complete/auto-complete.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import { DatapageService } from '../../../_services/datapage.service';
1414
import { handleEvent } from '../../../_helpers/event-util';
1515
import { PConnFieldProps } from '../../../_types/PConnProps.interface';
1616

17+
interface IOption {
18+
key: string;
19+
value: string;
20+
}
1721
interface AutoCompleteProps extends PConnFieldProps {
1822
// If any, enter additional props that only exist on AutoComplete here
1923
deferDatasource?: boolean;
@@ -108,6 +112,13 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
108112
);
109113
}
110114

115+
setOptions(options: IOption[]) {
116+
this.options$ = options;
117+
const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
118+
this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
119+
this.fieldControl.setValue(this.value$);
120+
}
121+
111122
ngOnDestroy(): void {
112123
if (this.formGroup$) {
113124
this.formGroup$.removeControl(this.controlName$);
@@ -149,6 +160,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
149160
if (this.configProps$.value != undefined) {
150161
const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
151162
this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
163+
this.fieldControl.setValue(this.value$);
152164
}
153165

154166
this.setPropertyValuesFromProps();
@@ -191,7 +203,8 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
191203

192204
this.componentReference = this.pConn$.getStateProps().value;
193205
if (this.listType === 'associated') {
194-
this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
206+
const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
207+
this.setOptions(optionsList);
195208
}
196209

197210
if (!this.displayMode$ && this.listType !== 'associated') {
@@ -263,7 +276,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
263276
};
264277
optionsData.push(obj);
265278
});
266-
this.options$ = optionsData;
279+
this.setOptions(optionsData);
267280
}
268281

269282
flattenParameters(params = {}) {

packages/angular-sdk-components/src/lib/_components/field/list-view-action-buttons/list-view-action-buttons.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ export class ListViewActionButtonsComponent {
3131
this.pConn$
3232
.getActionsApi()
3333
.submitEmbeddedDataModal(this.context$)
34-
.then(() => {})
34+
.then(() => {
35+
this.closeActionsDialog.emit();
36+
})
3537
.finally(() => {
3638
this.isDisabled = false;
3739
});
38-
this.closeActionsDialog.emit();
3940
}
4041
}

packages/angular-sdk-components/src/lib/_components/field/user-reference/user-reference.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
168168
this.placeholder = placeholder || '';
169169
this.displayMode$ = displayMode;
170170

171-
this.value$ = value && typeof value === 'object' && value.userName ? value.userName : (value ?? '');
171+
if (value && typeof value === 'object') {
172+
this.value$ = value.userName ? value.userName : '';
173+
} else {
174+
this.value$ = value || '';
175+
}
172176

173177
const { readOnly, required } = props;
174178
[this.bReadonly$, this.bRequired$] = [readOnly, required].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));

packages/angular-sdk-components/src/lib/_components/template/simple-table-manual/simple-table-manual.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
margin-top: 0.5rem;
66
margin-bottom: 0.5rem;
77
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);
812
}
913

1014
table {

0 commit comments

Comments
 (0)