@uxf/smart-address 1.0.0-beta.110 → 1.0.0-beta.112
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/package.json +1 -1
- package/v1/index.d.ts +37 -14
- package/v1/index.js +29 -27
- package/v1/v1.stories.js +14 -24
package/package.json
CHANGED
package/v1/index.d.ts
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export type { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, LocationExtended, ObjectType, ObjectTypeBasic, Point, SewerConnectionType, WaterConnectionType, } from "./types";
|
|
2
|
+
export declare const SmartAddress: {
|
|
3
|
+
createAddressLoader: (params: {
|
|
4
|
+
level: number;
|
|
5
|
+
limit?: number | undefined;
|
|
6
|
+
zip?: number | undefined;
|
|
7
|
+
getLabel?: ((address: import("./types").Location) => string) | undefined;
|
|
8
|
+
}) => (term: string) => Promise<import("./types").Option[]>;
|
|
9
|
+
createZipLoader: (params: {
|
|
10
|
+
getLabel?: ((address: import("./types").Location) => string) | undefined;
|
|
11
|
+
}) => (term: string) => Promise<import("./types").Option[]>;
|
|
12
|
+
getAddress: (id: number) => Promise<import("./types").Location>;
|
|
13
|
+
getAddressExtended: (id: number) => Promise<import("./types").LocationExtended>;
|
|
14
|
+
getCity: (id: number) => Promise<import("./types").Location>;
|
|
15
|
+
getCityPart: (id: number) => Promise<import("./types").Location>;
|
|
16
|
+
getMomc: (id: number) => Promise<import("./types").Location>;
|
|
17
|
+
getMop: (id: number) => Promise<import("./types").Location>;
|
|
18
|
+
getStreet: (id: number) => Promise<import("./types").Location>;
|
|
19
|
+
loadAddressOptions: (params: {
|
|
20
|
+
term: string;
|
|
21
|
+
level: number;
|
|
22
|
+
limit?: number | undefined;
|
|
23
|
+
zip?: number | undefined;
|
|
24
|
+
getLabel?: ((address: import("./types").Location) => string) | undefined;
|
|
25
|
+
}) => Promise<import("./types").Option[]>;
|
|
26
|
+
loadZipOptions: (params: {
|
|
27
|
+
term: string;
|
|
28
|
+
getLabel?: ((address: import("./types").Location) => string) | undefined;
|
|
29
|
+
}) => Promise<import("./types").Option[]>;
|
|
30
|
+
search: (props: {
|
|
31
|
+
term: string;
|
|
32
|
+
level: number;
|
|
33
|
+
limit?: number | undefined;
|
|
34
|
+
zip?: number | undefined;
|
|
35
|
+
}) => Promise<import("./types").Location[]>;
|
|
36
|
+
searchZip: (term: string) => Promise<import("./types").Location[]>;
|
|
37
|
+
};
|
package/v1/index.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
3
|
+
exports.SmartAddress = void 0;
|
|
4
|
+
const create_address_loader_1 = require("./create-address-loader");
|
|
5
|
+
const create_zip_loader_1 = require("./create-zip-loader");
|
|
6
|
+
const get_address_1 = require("./get-address");
|
|
7
|
+
const get_address_extended_1 = require("./get-address-extended");
|
|
8
|
+
const get_city_1 = require("./get-city");
|
|
9
|
+
const get_city_part_1 = require("./get-city-part");
|
|
10
|
+
const get_momc_1 = require("./get-momc");
|
|
11
|
+
const get_mop_1 = require("./get-mop");
|
|
12
|
+
const get_street_1 = require("./get-street");
|
|
13
|
+
const load_address_options_1 = require("./load-address-options");
|
|
14
|
+
const load_zip_options_1 = require("./load-zip-options");
|
|
15
|
+
const search_1 = require("./search");
|
|
16
|
+
const search_zip_1 = require("./search-zip");
|
|
17
|
+
exports.SmartAddress = {
|
|
18
|
+
createAddressLoader: create_address_loader_1.createAddressLoader,
|
|
19
|
+
createZipLoader: create_zip_loader_1.createZipLoader,
|
|
20
|
+
getAddress: get_address_1.getAddress,
|
|
21
|
+
getAddressExtended: get_address_extended_1.getAddressExtended,
|
|
22
|
+
getCity: get_city_1.getCity,
|
|
23
|
+
getCityPart: get_city_part_1.getCityPart,
|
|
24
|
+
getMomc: get_momc_1.getMomc,
|
|
25
|
+
getMop: get_mop_1.getMop,
|
|
26
|
+
getStreet: get_street_1.getStreet,
|
|
27
|
+
loadAddressOptions: load_address_options_1.loadAddressOptions,
|
|
28
|
+
loadZipOptions: load_zip_options_1.loadZipOptions,
|
|
29
|
+
search: search_1.search,
|
|
30
|
+
searchZip: search_zip_1.searchZip,
|
|
31
|
+
};
|
package/v1/v1.stories.js
CHANGED
|
@@ -24,21 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Default = void 0;
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
27
|
const button_1 = require("@uxf/ui/button");
|
|
29
|
-
const text_input_1 = require("@uxf/ui/text-input");
|
|
30
|
-
const load_address_options_1 = require("./load-address-options");
|
|
31
|
-
const load_zip_options_1 = require("./load-zip-options");
|
|
32
28
|
const combobox_1 = require("@uxf/ui/combobox");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const get_address_extended_1 = require("./get-address-extended");
|
|
37
|
-
const get_city_1 = require("./get-city");
|
|
38
|
-
const get_city_part_1 = require("./get-city-part");
|
|
39
|
-
const get_momc_1 = require("./get-momc");
|
|
40
|
-
const get_mop_1 = require("./get-mop");
|
|
41
|
-
const get_street_1 = require("./get-street");
|
|
29
|
+
const text_input_1 = require("@uxf/ui/text-input");
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const index_1 = require("./index");
|
|
42
32
|
exports.default = {
|
|
43
33
|
title: "Smart address/v1",
|
|
44
34
|
};
|
|
@@ -50,37 +40,37 @@ function Default() {
|
|
|
50
40
|
const load = (type) => async () => {
|
|
51
41
|
switch (type) {
|
|
52
42
|
case "load-address":
|
|
53
|
-
setContent(await
|
|
43
|
+
setContent(await index_1.SmartAddress.loadAddressOptions({ term: textValue, level: 1 }));
|
|
54
44
|
break;
|
|
55
45
|
case "load-zip":
|
|
56
|
-
setContent(await
|
|
46
|
+
setContent(await index_1.SmartAddress.loadZipOptions({ term: textValue }));
|
|
57
47
|
break;
|
|
58
48
|
case "get-address":
|
|
59
|
-
setContent(await
|
|
49
|
+
setContent(await index_1.SmartAddress.getAddress(parseInt(textValue, 10)));
|
|
60
50
|
break;
|
|
61
51
|
case "get-address-extended":
|
|
62
|
-
setContent(await
|
|
52
|
+
setContent(await index_1.SmartAddress.getAddressExtended(parseInt(textValue, 10)));
|
|
63
53
|
break;
|
|
64
54
|
case "get-city":
|
|
65
|
-
setContent(await
|
|
55
|
+
setContent(await index_1.SmartAddress.getCity(parseInt(textValue, 10)));
|
|
66
56
|
break;
|
|
67
57
|
case "get-city-part":
|
|
68
|
-
setContent(await
|
|
58
|
+
setContent(await index_1.SmartAddress.getCityPart(parseInt(textValue, 10)));
|
|
69
59
|
break;
|
|
70
60
|
case "get-momc":
|
|
71
|
-
setContent(await
|
|
61
|
+
setContent(await index_1.SmartAddress.getMomc(parseInt(textValue, 10)));
|
|
72
62
|
break;
|
|
73
63
|
case "get-mop":
|
|
74
|
-
setContent(await
|
|
64
|
+
setContent(await index_1.SmartAddress.getMop(parseInt(textValue, 10)));
|
|
75
65
|
break;
|
|
76
66
|
case "get-street":
|
|
77
|
-
setContent(await
|
|
67
|
+
setContent(await index_1.SmartAddress.getStreet(parseInt(textValue, 10)));
|
|
78
68
|
break;
|
|
79
69
|
}
|
|
80
70
|
};
|
|
81
71
|
return (react_1.default.createElement("div", { className: "mx-auto max-w-3xl space-y-4 rounded border bg-white p-4" },
|
|
82
|
-
react_1.default.createElement(combobox_1.Combobox, { label: "Address combobox", value: addressValue, onChange: setAddressValue, loadOptions:
|
|
83
|
-
react_1.default.createElement(combobox_1.Combobox, { label: "Zip combobox", value: zipValue, onChange: setZipValue, loadOptions:
|
|
72
|
+
react_1.default.createElement(combobox_1.Combobox, { label: "Address combobox", value: addressValue, onChange: setAddressValue, loadOptions: index_1.SmartAddress.createAddressLoader({ level: 1 }) }),
|
|
73
|
+
react_1.default.createElement(combobox_1.Combobox, { label: "Zip combobox", value: zipValue, onChange: setZipValue, loadOptions: index_1.SmartAddress.createZipLoader({}) }),
|
|
84
74
|
react_1.default.createElement(text_input_1.TextInput, { type: "text", value: textValue, onChange: setTextValue, label: "Text input" }),
|
|
85
75
|
react_1.default.createElement("div", { className: "grid grid-cols-2 gap-4" },
|
|
86
76
|
react_1.default.createElement(button_1.Button, { onClick: load("load-address") }, "Load Address Options"),
|