novo-elements 13.7.0 → 13.7.1
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.
package/elements/form/index.d.ts
CHANGED
|
@@ -1004,6 +1004,7 @@ interface AddressLookupResult {
|
|
|
1004
1004
|
address2?: string;
|
|
1005
1005
|
city?: string;
|
|
1006
1006
|
state?: string;
|
|
1007
|
+
stateName?: string;
|
|
1007
1008
|
zip?: string;
|
|
1008
1009
|
countryName?: string;
|
|
1009
1010
|
countryCode?: string;
|
|
@@ -1093,9 +1094,10 @@ declare class NovoAddressElement implements ControlValueAccessor, OnInit, DoChec
|
|
|
1093
1094
|
address_components?: any[];
|
|
1094
1095
|
formatted_address?: string;
|
|
1095
1096
|
}): void;
|
|
1097
|
+
private resolveStateValue;
|
|
1096
1098
|
private parseGooglePlaceDetail;
|
|
1097
1099
|
setStateLabel(model: any): void;
|
|
1098
|
-
updateStates():
|
|
1100
|
+
updateStates(): Promise<any[]>;
|
|
1099
1101
|
getStateOptions(filter: string, countryID: number): string[];
|
|
1100
1102
|
updateControl(): void;
|
|
1101
1103
|
writeValue(model: any): void;
|
|
@@ -1304,7 +1306,7 @@ declare class ControlPromptModal {
|
|
|
1304
1306
|
static ɵcmp: i0.ɵɵComponentDeclaration<ControlPromptModal, "control-prompt-modal", never, {}, {}, never, never, false, never>;
|
|
1305
1307
|
}
|
|
1306
1308
|
|
|
1307
|
-
declare class NovoFormElement implements AfterContentInit, OnInit {
|
|
1309
|
+
declare class NovoFormElement implements AfterContentInit, OnChanges, OnInit {
|
|
1308
1310
|
private templates;
|
|
1309
1311
|
form: NovoFormGroup;
|
|
1310
1312
|
layout: string;
|
|
@@ -1318,6 +1320,7 @@ declare class NovoFormElement implements AfterContentInit, OnInit {
|
|
|
1318
1320
|
get value(): any;
|
|
1319
1321
|
get isValid(): boolean;
|
|
1320
1322
|
ngOnInit(): void;
|
|
1323
|
+
ngOnChanges(changes?: SimpleChanges): void;
|
|
1321
1324
|
ngAfterContentInit(): void;
|
|
1322
1325
|
showAllFields(): void;
|
|
1323
1326
|
showOnlyRequired(hideRequiredWithValue: any): void;
|
|
@@ -3971,9 +3971,6 @@ class NovoAddressElement {
|
|
|
3971
3971
|
if (result.city !== undefined) {
|
|
3972
3972
|
this.model.city = result.city;
|
|
3973
3973
|
}
|
|
3974
|
-
if (result.state !== undefined) {
|
|
3975
|
-
this.model.state = result.state;
|
|
3976
|
-
}
|
|
3977
3974
|
if (result.zip !== undefined) {
|
|
3978
3975
|
this.model.zip = result.zip;
|
|
3979
3976
|
}
|
|
@@ -3984,11 +3981,32 @@ class NovoAddressElement {
|
|
|
3984
3981
|
this.model.countryName = country.name;
|
|
3985
3982
|
}
|
|
3986
3983
|
}
|
|
3987
|
-
this.updateStates();
|
|
3988
|
-
this.updateControl();
|
|
3989
|
-
this.fieldList.forEach((field) => this.onInput(null, field));
|
|
3990
3984
|
this.debouncedSearch = '';
|
|
3991
3985
|
this.overlay?.closePanel();
|
|
3986
|
+
// State values differ by picker (name, code or id), so resolve against the loaded options before emitting.
|
|
3987
|
+
this.updateStates()
|
|
3988
|
+
.catch(() => [])
|
|
3989
|
+
.then((stateOptions) => {
|
|
3990
|
+
if (result.state !== undefined || result.stateName !== undefined) {
|
|
3991
|
+
this.model.state = this.resolveStateValue(stateOptions, result);
|
|
3992
|
+
}
|
|
3993
|
+
this.updateControl();
|
|
3994
|
+
this.fieldList.forEach((field) => this.onInput(null, field));
|
|
3995
|
+
});
|
|
3996
|
+
}
|
|
3997
|
+
// Store what a manual pick of the same state would store (option[pickerConfig.field]).
|
|
3998
|
+
resolveStateValue(stateOptions, { state, stateName }) {
|
|
3999
|
+
const name = stateName?.trim().toLowerCase();
|
|
4000
|
+
const code = state?.trim().toLowerCase();
|
|
4001
|
+
const match = stateOptions.find((option) => {
|
|
4002
|
+
const label = String(option?.label ?? option).toLowerCase();
|
|
4003
|
+
const value = String(option?.value ?? option).toLowerCase();
|
|
4004
|
+
return label === name || value === code;
|
|
4005
|
+
});
|
|
4006
|
+
if (match === undefined) {
|
|
4007
|
+
return stateName || state;
|
|
4008
|
+
}
|
|
4009
|
+
return typeof match === 'string' ? match : match[this.config.state.pickerConfig.field ?? 'value'];
|
|
3992
4010
|
}
|
|
3993
4011
|
// Map a raw Google detail to flat fields; omitted components resolve to '' so partial selections clear finer fields.
|
|
3994
4012
|
parseGooglePlaceDetail(place) {
|
|
@@ -4005,7 +4023,8 @@ class NovoAddressElement {
|
|
|
4005
4023
|
address1: street,
|
|
4006
4024
|
address2: find('subpremise'),
|
|
4007
4025
|
city: find('locality') || find('postal_town') || find('sublocality') || find('sublocality_level_1'),
|
|
4008
|
-
state: find('administrative_area_level_1'),
|
|
4026
|
+
state: find('administrative_area_level_1', true),
|
|
4027
|
+
stateName: find('administrative_area_level_1'),
|
|
4009
4028
|
zip: find('postal_code'),
|
|
4010
4029
|
countryName: find('country'),
|
|
4011
4030
|
countryCode: find('country', true),
|
|
@@ -4033,7 +4052,7 @@ class NovoAddressElement {
|
|
|
4033
4052
|
this.config.state.pickerConfig.options = (query = '') => {
|
|
4034
4053
|
return this.stateOptions(query, this.model.countryID);
|
|
4035
4054
|
};
|
|
4036
|
-
this.stateOptions('', this.model.countryID).then((results) => {
|
|
4055
|
+
return this.stateOptions('', this.model.countryID).then((results) => {
|
|
4037
4056
|
this.config.state.pickerConfig.defaultOptions = results;
|
|
4038
4057
|
if (results.length) {
|
|
4039
4058
|
this.tooltip.state = undefined;
|
|
@@ -4049,6 +4068,7 @@ class NovoAddressElement {
|
|
|
4049
4068
|
}
|
|
4050
4069
|
this.validityChange.emit();
|
|
4051
4070
|
this.onInput(null, 'state');
|
|
4071
|
+
return results;
|
|
4052
4072
|
});
|
|
4053
4073
|
}
|
|
4054
4074
|
else {
|
|
@@ -4058,6 +4078,7 @@ class NovoAddressElement {
|
|
|
4058
4078
|
if (this.config.state.required) {
|
|
4059
4079
|
this.valid.state = false;
|
|
4060
4080
|
}
|
|
4081
|
+
return Promise.resolve([]);
|
|
4061
4082
|
}
|
|
4062
4083
|
}
|
|
4063
4084
|
getStateOptions(filter = '', countryID) {
|
|
@@ -6789,7 +6810,12 @@ class NovoFormElement {
|
|
|
6789
6810
|
return this.form.valid;
|
|
6790
6811
|
}
|
|
6791
6812
|
ngOnInit() {
|
|
6792
|
-
this.
|
|
6813
|
+
this.ngOnChanges();
|
|
6814
|
+
}
|
|
6815
|
+
ngOnChanges(changes) {
|
|
6816
|
+
if (this.form) {
|
|
6817
|
+
this.form.layout = this.layout;
|
|
6818
|
+
}
|
|
6793
6819
|
}
|
|
6794
6820
|
ngAfterContentInit() {
|
|
6795
6821
|
if (this.customTemplates && this.customTemplates.length) {
|
|
@@ -6834,7 +6860,7 @@ class NovoFormElement {
|
|
|
6834
6860
|
});
|
|
6835
6861
|
}
|
|
6836
6862
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: NovoFormElement, deps: [{ token: i1.NovoTemplateService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6837
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.19", type: NovoFormElement, isStandalone: false, selector: "novo-form", inputs: { form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: false, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: false, isRequired: false, transformFunction: null }, hasCardSections: { classPropertyName: "hasCardSections", publicName: "hasCardSections", isSignal: true, isRequired: false, transformFunction: null } }, providers: [NovoTemplateService], queries: [{ propertyName: "customTemplates", predicate: NovoTemplate }], ngImport: i0, template: `
|
|
6863
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.19", type: NovoFormElement, isStandalone: false, selector: "novo-form", inputs: { form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: false, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: false, isRequired: false, transformFunction: null }, hasCardSections: { classPropertyName: "hasCardSections", publicName: "hasCardSections", isSignal: true, isRequired: false, transformFunction: null } }, providers: [NovoTemplateService], queries: [{ propertyName: "customTemplates", predicate: NovoTemplate }], usesOnChanges: true, ngImport: i0, template: `
|
|
6838
6864
|
<novo-control-templates></novo-control-templates>
|
|
6839
6865
|
<div class="novo-form-container" [class.card-section]="effectiveCardSections()">
|
|
6840
6866
|
<header *ngIf="!hideHeader">
|