export type NodeIDStrict = string | { _kind: "NodeIDStrict"; }; export type NodeID = NodeIDStrict | number; export type LabelChineseSimplified = string | { _kind: "NameLocaled"; _locale: "zh"; _accent: "CN"; } export type LabelEnglish = string | { _kind: "NameLocaled"; _locale: "en"; } export interface NodeSelectionInternalData { id: string; lastName: string; nodeChain: NodeChain; } export type NodeSelection_Empty = { town?: undefined } export type NodeSelection_CountryOnly = { country: NodeID, town?: undefined } export type NodeSelection_CountryProvince = { country: NodeID, province: NodeID, town?: undefined } export type NodeSelection_CountryProvinceCity = { country: NodeID, province: NodeID, city: NodeID, town?: undefined } export type NodeSelection_CountryProvinceCityArea = { country: NodeID, province: NodeID, city: NodeID, area: NodeID, town?: undefined } export type NodeSelection_CountryProvinceCityAreaTown = { country: NodeID, province: NodeID, city: NodeID, area: NodeID, town: NodeID } export type NodeSelection_CountryProvinceCityTown = { country: NodeID, province: NodeID, city: NodeID, town: NodeID } export type NodeSelection = NodeSelection_Empty | NodeSelection_CountryOnly | NodeSelection_CountryProvince | NodeSelection_CountryProvinceCity | NodeSelection_CountryProvinceCityArea | NodeSelection_CountryProvinceCityAreaTown | NodeSelection_CountryProvinceCityTown export type NodeAnyValue = NodeID | NodeSelection export type AddressNodeRoot = { id: NodeIDStrict nameZh?: LabelChineseSimplified; namePy?: string namePyJoined?: string; namePyAbbr?: string; nameEn?: LabelEnglish; level: -1; levelKey: string ofCountry: NodeIDStrict; value: NodeID label: string isLeaf: false parent: null parentNode: null children: AddressNode[] | null } export type AddressNodeInternal = { id: NodeIDStrict nameZh?: LabelChineseSimplified; namePy?: string namePyJoined?: string; namePyAbbr?: string; nameEn?: LabelEnglish; level: number levelKey: string ofCountry: NodeIDStrict; value: NodeID label: string isLeaf: false parent: NodeIDStrict parentNode: AddressNode children: AddressNode[] | null } export type AddressNodeLeaf = { id: NodeIDStrict nameZh?: LabelChineseSimplified; namePy?: string namePyJoined?: string; namePyAbbr?: string; nameEn?: LabelEnglish; level: number levelKey: string ofCountry: NodeIDStrict; value: NodeID label: string isLeaf: true children?: undefined | null parent: NodeIDStrict parentNode: AddressNode } export type AddressNode = | AddressNodeRoot | AddressNodeInternal | AddressNodeLeaf export type SelectionChain = NodeIDStrict[] export type NodeChain = AddressNode[] export type AddressTree = AddressNodeInternal // { [key: string]: AddressNode } export type AddressNodeSet = { [id: string]: AddressNode } export type AddressDataset = { addressTree: AddressTree allNodesSet: AddressNodeSet } export type AddressRequestParams = { addressURL: string townURL: string parentURL: string, ignored: NodeIDStrict[]; dataOverride: { [key: string]: string[] }; preprocessor: (dataRaw: { [key: string]: string[] }) => { [key: string]: string[] }; } export interface CascaderSelectOnChangeExtraData { // we do not provide single select support for now // selectedPath: any[] checked: boolean currentData: AddressNode[] checkedData: AddressNode[] indeterminateData: AddressNode[] }