Open Gykonik opened 1 year ago
Furthermore, I think that it needs undefined-checks for isOptionGroup
:
isOptionGroup(option: string | object, level: number) {
return Object.prototype.hasOwnProperty.call(option, (this.optionGroupChildren as string)[level]);
}
as string[]
or even as any
as it was done in OptionGroupSub
referenceoptionGroupChildren
or passing a string. Any news about this?
I am also blocked because of this bug, since I upgraded vrom v15 to latest version.
Source of Cascade Select is always hierarchical objects, string[] | string | undefined | null
really doesn't make sense.
any updates?
Reporting the same issue after upgrading project from PrimeNG v15.4.1 to v16.9.1.
Type issue for the options input still remains on PrimeNG version 17.18.8 Should have an Interface with hierarchical objects!
Describe the bug
The CascadeComponent defines the options input as:
@Input() options: string[] | string | undefined | null;
SourceHowever, the official documentation provides an example where options is expected to be an array of objects:
<p-cascadeSelect [(ngModel)]="selectedCity" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" [style]="{ minWidth: '14rem' }" placeholder="Select a City"></p-cascadeSelect>
With the corresponding data:
Environment
Angular 16 PrimeNG 16
Reproducer
No response
Angular version
16.1.2
PrimeNG version
16.0.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
The type definition for the options input should match the official documentation (or the other way around) and support arrays of objects. Or am I missing anything obvious here?