@box/combobox-with-api 0.29.7 → 0.29.8
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/dist/esm/index.js +14 -14
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +203 -6
- package/dist/esm/lib/components/combobox-with-api-tree-view/index.js +447 -6
- package/package.json +2 -2
- package/dist/chunks/mocks.js +0 -204
- package/dist/chunks/shared.js +0 -448
- package/dist/chunks/web.dom-exception.stack.js +0 -426
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ComboboxWithApiContainer as t } from "./lib/components/combobox-with-api/combobox-with-api-container.js";
|
|
2
|
+
import { ComboboxWithApiPagination as r } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
|
|
3
|
+
import { findState as p, mockFetcher as x, states as b } from "./lib/components/combobox-with-api-pagination/index.js";
|
|
4
|
+
import { ComboboxWithApiTreeView as f } from "./lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js";
|
|
5
|
+
import { apiResponse as h, findNode as s, mockTreeFetcher as C } from "./lib/components/combobox-with-api-tree-view/index.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
t as ComboboxWithApi,
|
|
8
|
+
r as ComboboxWithApiPagination,
|
|
9
|
+
f as ComboboxWithApiTreeView,
|
|
10
|
+
h as apiResponse,
|
|
11
|
+
s as findNode,
|
|
12
|
+
p as findState,
|
|
13
|
+
x as mockFetcher,
|
|
14
|
+
C as mockTreeFetcher,
|
|
15
|
+
b as states
|
|
16
16
|
};
|
|
@@ -1,8 +1,205 @@
|
|
|
1
|
-
import { ComboboxWithApiPagination as
|
|
2
|
-
|
|
1
|
+
import { ComboboxWithApiPagination as x } from "./combobox-with-api-pagination.js";
|
|
2
|
+
function V(a) {
|
|
3
|
+
return {
|
|
4
|
+
marker: a.marker,
|
|
5
|
+
options: a.options.map(({
|
|
6
|
+
value: e,
|
|
7
|
+
displayValue: l
|
|
8
|
+
}) => l ? {
|
|
9
|
+
displayValue: l,
|
|
10
|
+
value: e
|
|
11
|
+
} : {
|
|
12
|
+
value: e
|
|
13
|
+
})
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const r = [{
|
|
17
|
+
value: "0",
|
|
18
|
+
displayValue: "Alabama"
|
|
19
|
+
}, {
|
|
20
|
+
value: "1",
|
|
21
|
+
displayValue: "Alaska"
|
|
22
|
+
}, {
|
|
23
|
+
value: "2",
|
|
24
|
+
displayValue: "Arizona"
|
|
25
|
+
}, {
|
|
26
|
+
value: "3",
|
|
27
|
+
displayValue: "Arkansas"
|
|
28
|
+
}, {
|
|
29
|
+
value: "4",
|
|
30
|
+
displayValue: "California"
|
|
31
|
+
}, {
|
|
32
|
+
value: "5",
|
|
33
|
+
displayValue: "Colorado"
|
|
34
|
+
}, {
|
|
35
|
+
value: "6",
|
|
36
|
+
displayValue: "Connecticut"
|
|
37
|
+
}, {
|
|
38
|
+
value: "7",
|
|
39
|
+
displayValue: "Delaware"
|
|
40
|
+
}, {
|
|
41
|
+
value: "8",
|
|
42
|
+
displayValue: "Florida"
|
|
43
|
+
}, {
|
|
44
|
+
value: "9",
|
|
45
|
+
displayValue: "Georgia"
|
|
46
|
+
}, {
|
|
47
|
+
value: "10",
|
|
48
|
+
displayValue: "Hawaii"
|
|
49
|
+
}, {
|
|
50
|
+
value: "11",
|
|
51
|
+
displayValue: "Idaho"
|
|
52
|
+
}, {
|
|
53
|
+
value: "12",
|
|
54
|
+
displayValue: "Illinois"
|
|
55
|
+
}, {
|
|
56
|
+
value: "13",
|
|
57
|
+
displayValue: "Indiana"
|
|
58
|
+
}, {
|
|
59
|
+
value: "14",
|
|
60
|
+
displayValue: "Iowa"
|
|
61
|
+
}, {
|
|
62
|
+
value: "15",
|
|
63
|
+
displayValue: "Kansas"
|
|
64
|
+
}, {
|
|
65
|
+
value: "16",
|
|
66
|
+
displayValue: "Kentucky"
|
|
67
|
+
}, {
|
|
68
|
+
value: "17",
|
|
69
|
+
displayValue: "Louisiana"
|
|
70
|
+
}, {
|
|
71
|
+
value: "18",
|
|
72
|
+
displayValue: "Maine"
|
|
73
|
+
}, {
|
|
74
|
+
value: "19",
|
|
75
|
+
displayValue: "Maryland"
|
|
76
|
+
}, {
|
|
77
|
+
value: "20",
|
|
78
|
+
displayValue: "Massachusetts"
|
|
79
|
+
}, {
|
|
80
|
+
value: "21",
|
|
81
|
+
displayValue: "Michigan"
|
|
82
|
+
}, {
|
|
83
|
+
value: "22",
|
|
84
|
+
displayValue: "Minnesota"
|
|
85
|
+
}, {
|
|
86
|
+
value: "23",
|
|
87
|
+
displayValue: "Mississippi"
|
|
88
|
+
}, {
|
|
89
|
+
value: "24",
|
|
90
|
+
displayValue: "Missouri"
|
|
91
|
+
}, {
|
|
92
|
+
value: "25",
|
|
93
|
+
displayValue: "Montana"
|
|
94
|
+
}, {
|
|
95
|
+
value: "26",
|
|
96
|
+
displayValue: "Nebraska"
|
|
97
|
+
}, {
|
|
98
|
+
value: "27",
|
|
99
|
+
displayValue: "Nevada"
|
|
100
|
+
}, {
|
|
101
|
+
value: "28",
|
|
102
|
+
displayValue: "New Hampshire"
|
|
103
|
+
}, {
|
|
104
|
+
value: "29",
|
|
105
|
+
displayValue: "New Jersey"
|
|
106
|
+
}, {
|
|
107
|
+
value: "30",
|
|
108
|
+
displayValue: "New Mexico"
|
|
109
|
+
}, {
|
|
110
|
+
value: "31",
|
|
111
|
+
displayValue: "New York"
|
|
112
|
+
}, {
|
|
113
|
+
value: "32",
|
|
114
|
+
displayValue: "North Carolina"
|
|
115
|
+
}, {
|
|
116
|
+
value: "33",
|
|
117
|
+
displayValue: "North Dakota"
|
|
118
|
+
}, {
|
|
119
|
+
value: "34",
|
|
120
|
+
displayValue: "Ohio"
|
|
121
|
+
}, {
|
|
122
|
+
value: "35",
|
|
123
|
+
displayValue: "Oklahoma"
|
|
124
|
+
}, {
|
|
125
|
+
value: "36",
|
|
126
|
+
displayValue: "Oregon"
|
|
127
|
+
}, {
|
|
128
|
+
value: "37",
|
|
129
|
+
displayValue: "Pennsylvania"
|
|
130
|
+
}, {
|
|
131
|
+
value: "38",
|
|
132
|
+
displayValue: "Rhode Island"
|
|
133
|
+
}, {
|
|
134
|
+
value: "39",
|
|
135
|
+
displayValue: "South Carolina"
|
|
136
|
+
}, {
|
|
137
|
+
value: "40",
|
|
138
|
+
displayValue: "South Dakota"
|
|
139
|
+
}, {
|
|
140
|
+
value: "41",
|
|
141
|
+
displayValue: "Tennessee"
|
|
142
|
+
}, {
|
|
143
|
+
value: "42",
|
|
144
|
+
displayValue: "Texas"
|
|
145
|
+
}, {
|
|
146
|
+
value: "43",
|
|
147
|
+
displayValue: "Utah"
|
|
148
|
+
}, {
|
|
149
|
+
value: "44",
|
|
150
|
+
displayValue: "Vermont"
|
|
151
|
+
}, {
|
|
152
|
+
value: "45",
|
|
153
|
+
displayValue: "Virginia"
|
|
154
|
+
}, {
|
|
155
|
+
value: "46",
|
|
156
|
+
displayValue: "Washington"
|
|
157
|
+
}, {
|
|
158
|
+
value: "47",
|
|
159
|
+
displayValue: "West Virginia"
|
|
160
|
+
}, {
|
|
161
|
+
value: "48",
|
|
162
|
+
displayValue: "Wisconsin"
|
|
163
|
+
}, {
|
|
164
|
+
value: "49",
|
|
165
|
+
displayValue: "Wyoming"
|
|
166
|
+
}], h = (a) => r.find((e) => e.displayValue === a), n = 10, c = (a, e) => {
|
|
167
|
+
const l = (parseInt(a, 10) || 0) * n, u = l + n;
|
|
168
|
+
return e.slice(l, u).map(({
|
|
169
|
+
displayValue: i,
|
|
170
|
+
value: t
|
|
171
|
+
}) => ({
|
|
172
|
+
displayValue: i,
|
|
173
|
+
value: t
|
|
174
|
+
}));
|
|
175
|
+
}, m = (a, e) => (parseInt(a, 10) || 0) * n + n < e.length ? ((parseInt(a, 10) || 0) + 1).toString() : void 0, w = /* @__PURE__ */ (() => {
|
|
176
|
+
let a = 0;
|
|
177
|
+
return async ({
|
|
178
|
+
delay: e,
|
|
179
|
+
signal: l,
|
|
180
|
+
searchInput: u,
|
|
181
|
+
marker: i,
|
|
182
|
+
failOnLoadMore: t,
|
|
183
|
+
failOnLoadMoreTimes: d = Number.MAX_SAFE_INTEGER,
|
|
184
|
+
options: p = r
|
|
185
|
+
}) => {
|
|
186
|
+
if (e && await new Promise((s) => setTimeout(s, e)), l.aborted)
|
|
187
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
188
|
+
if (t && i != null && a < d)
|
|
189
|
+
return a += 1, Promise.reject();
|
|
190
|
+
const o = p.filter(({
|
|
191
|
+
displayValue: s,
|
|
192
|
+
value: v
|
|
193
|
+
}) => s ? s.toLowerCase().includes(u.toLowerCase()) : v.toLowerCase().includes(u.toLowerCase())), y = Promise.resolve({
|
|
194
|
+
marker: m(i, o),
|
|
195
|
+
options: c(i, o)
|
|
196
|
+
});
|
|
197
|
+
return V(await y);
|
|
198
|
+
};
|
|
199
|
+
})();
|
|
3
200
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
201
|
+
x as ComboboxWithApiPagination,
|
|
202
|
+
h as findState,
|
|
203
|
+
w as mockFetcher,
|
|
204
|
+
r as states
|
|
8
205
|
};
|
|
@@ -1,8 +1,449 @@
|
|
|
1
|
-
import { ComboboxWithApiTreeView as
|
|
2
|
-
|
|
1
|
+
import { ComboboxWithApiTreeView as I } from "./combobox-with-api-tree-view.js";
|
|
2
|
+
const y = [
|
|
3
|
+
// Level 1
|
|
4
|
+
{
|
|
5
|
+
id: "japan-l1-id",
|
|
6
|
+
ancestors: [],
|
|
7
|
+
displayName: "Japan",
|
|
8
|
+
level: 1,
|
|
9
|
+
selectable: !0
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "uk-l1-id",
|
|
13
|
+
ancestors: [],
|
|
14
|
+
displayName: "United Kingdom",
|
|
15
|
+
level: 1,
|
|
16
|
+
selectable: !0
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "usa-l1-id",
|
|
20
|
+
ancestors: [],
|
|
21
|
+
displayName: "United States",
|
|
22
|
+
level: 1,
|
|
23
|
+
selectable: !0
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "poland-l1-id",
|
|
27
|
+
ancestors: [],
|
|
28
|
+
displayName: "Poland",
|
|
29
|
+
level: 1,
|
|
30
|
+
selectable: !0
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "australia-l1-id",
|
|
34
|
+
ancestors: [],
|
|
35
|
+
displayName: "Australia",
|
|
36
|
+
level: 1,
|
|
37
|
+
selectable: !0
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "spain-l1-id",
|
|
41
|
+
ancestors: [],
|
|
42
|
+
displayName: "Spain",
|
|
43
|
+
level: 1,
|
|
44
|
+
selectable: !0
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "austin-l3-id",
|
|
48
|
+
ancestors: [{
|
|
49
|
+
id: "usa-l1-id",
|
|
50
|
+
displayName: "United States",
|
|
51
|
+
level: 1
|
|
52
|
+
}, {
|
|
53
|
+
id: "texas-l2-id",
|
|
54
|
+
displayName: "Texas",
|
|
55
|
+
level: 2
|
|
56
|
+
}],
|
|
57
|
+
displayName: "Austin",
|
|
58
|
+
level: 3,
|
|
59
|
+
selectable: !0
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "california-l2-id",
|
|
63
|
+
ancestors: [{
|
|
64
|
+
id: "usa-l1-id",
|
|
65
|
+
displayName: "United States",
|
|
66
|
+
level: 1
|
|
67
|
+
}],
|
|
68
|
+
displayName: "California",
|
|
69
|
+
level: 2,
|
|
70
|
+
selectable: !0
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "chicago-l3-id",
|
|
74
|
+
ancestors: [{
|
|
75
|
+
id: "usa-l1-id",
|
|
76
|
+
displayName: "United States",
|
|
77
|
+
level: 1
|
|
78
|
+
}, {
|
|
79
|
+
id: "illinois-l2-id",
|
|
80
|
+
displayName: "Illinois",
|
|
81
|
+
level: 2
|
|
82
|
+
}],
|
|
83
|
+
displayName: "Chicago",
|
|
84
|
+
level: 3,
|
|
85
|
+
selectable: !0
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "illinois-l2-id",
|
|
89
|
+
ancestors: [{
|
|
90
|
+
id: "usa-l1-id",
|
|
91
|
+
displayName: "United States",
|
|
92
|
+
level: 1
|
|
93
|
+
}],
|
|
94
|
+
displayName: "Illinois",
|
|
95
|
+
level: 2,
|
|
96
|
+
selectable: !0
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "london-l3-id",
|
|
100
|
+
ancestors: [{
|
|
101
|
+
id: "uk-l1-id",
|
|
102
|
+
displayName: "United Kingdom",
|
|
103
|
+
level: 1
|
|
104
|
+
}, {
|
|
105
|
+
id: "england-l2-id",
|
|
106
|
+
displayName: "England",
|
|
107
|
+
level: 2
|
|
108
|
+
}],
|
|
109
|
+
displayName: "London",
|
|
110
|
+
level: 3,
|
|
111
|
+
selectable: !0
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "ny-l2-id",
|
|
115
|
+
ancestors: [{
|
|
116
|
+
id: "usa-l1-id",
|
|
117
|
+
displayName: "United States",
|
|
118
|
+
level: 1
|
|
119
|
+
}],
|
|
120
|
+
displayName: "New York",
|
|
121
|
+
level: 2,
|
|
122
|
+
selectable: !0
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "ny-l3-id",
|
|
126
|
+
ancestors: [{
|
|
127
|
+
id: "usa-l1-id",
|
|
128
|
+
displayName: "United States",
|
|
129
|
+
level: 1
|
|
130
|
+
}, {
|
|
131
|
+
id: "ny-l2-id",
|
|
132
|
+
displayName: "New York",
|
|
133
|
+
level: 2
|
|
134
|
+
}],
|
|
135
|
+
displayName: "New York",
|
|
136
|
+
level: 3,
|
|
137
|
+
selectable: !0
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "redwood-l3-id",
|
|
141
|
+
ancestors: [{
|
|
142
|
+
id: "usa-l1-id",
|
|
143
|
+
displayName: "United States",
|
|
144
|
+
level: 1
|
|
145
|
+
}, {
|
|
146
|
+
id: "california-l2-id",
|
|
147
|
+
displayName: "California",
|
|
148
|
+
level: 2
|
|
149
|
+
}],
|
|
150
|
+
displayName: "Redwood City",
|
|
151
|
+
level: 3,
|
|
152
|
+
selectable: !0
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "sf-l3-id",
|
|
156
|
+
ancestors: [{
|
|
157
|
+
id: "usa-l1-id",
|
|
158
|
+
displayName: "United States",
|
|
159
|
+
level: 1
|
|
160
|
+
}, {
|
|
161
|
+
id: "california-l2-id",
|
|
162
|
+
displayName: "California",
|
|
163
|
+
level: 2
|
|
164
|
+
}],
|
|
165
|
+
displayName: "San Francisco",
|
|
166
|
+
level: 3,
|
|
167
|
+
selectable: !0
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "texas-l2-id",
|
|
171
|
+
ancestors: [{
|
|
172
|
+
id: "usa-l1-id",
|
|
173
|
+
displayName: "United States",
|
|
174
|
+
level: 1
|
|
175
|
+
}],
|
|
176
|
+
displayName: "Texas",
|
|
177
|
+
level: 2,
|
|
178
|
+
selectable: !0
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "tokyo-l2-id",
|
|
182
|
+
ancestors: [{
|
|
183
|
+
id: "japan-l1-id",
|
|
184
|
+
displayName: "Japan",
|
|
185
|
+
level: 1
|
|
186
|
+
}],
|
|
187
|
+
displayName: "Tokyo",
|
|
188
|
+
level: 2,
|
|
189
|
+
selectable: !0
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "tokyo-l3-id",
|
|
193
|
+
ancestors: [{
|
|
194
|
+
id: "japan-l1-id",
|
|
195
|
+
displayName: "Japan",
|
|
196
|
+
level: 1
|
|
197
|
+
}, {
|
|
198
|
+
id: "tokyo-l2-id",
|
|
199
|
+
displayName: "Tokyo",
|
|
200
|
+
level: 2
|
|
201
|
+
}],
|
|
202
|
+
displayName: "Tokyo",
|
|
203
|
+
level: 3,
|
|
204
|
+
selectable: !0
|
|
205
|
+
},
|
|
206
|
+
// Japan L2
|
|
207
|
+
{
|
|
208
|
+
id: "hokkaido-l2-id",
|
|
209
|
+
ancestors: [{
|
|
210
|
+
id: "japan-l1-id",
|
|
211
|
+
displayName: "Japan",
|
|
212
|
+
level: 1
|
|
213
|
+
}],
|
|
214
|
+
displayName: "Hokkaido",
|
|
215
|
+
level: 2,
|
|
216
|
+
selectable: !0
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: "iwate-l2-id",
|
|
220
|
+
ancestors: [{
|
|
221
|
+
id: "japan-l1-id",
|
|
222
|
+
displayName: "Japan",
|
|
223
|
+
level: 1
|
|
224
|
+
}],
|
|
225
|
+
displayName: "Iwate",
|
|
226
|
+
level: 2,
|
|
227
|
+
selectable: !0
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: "fukushima-l2-id",
|
|
231
|
+
ancestors: [{
|
|
232
|
+
id: "japan-l1-id",
|
|
233
|
+
displayName: "Japan",
|
|
234
|
+
level: 1
|
|
235
|
+
}],
|
|
236
|
+
displayName: "Fukushima",
|
|
237
|
+
level: 2,
|
|
238
|
+
selectable: !0
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "nagano-l2-id",
|
|
242
|
+
ancestors: [{
|
|
243
|
+
id: "japan-l1-id",
|
|
244
|
+
displayName: "Japan",
|
|
245
|
+
level: 1
|
|
246
|
+
}],
|
|
247
|
+
displayName: "Nagano",
|
|
248
|
+
level: 2,
|
|
249
|
+
selectable: !0
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "niigata-l2-id",
|
|
253
|
+
ancestors: [{
|
|
254
|
+
id: "japan-l1-id",
|
|
255
|
+
displayName: "Japan",
|
|
256
|
+
level: 1
|
|
257
|
+
}],
|
|
258
|
+
displayName: "Niigata",
|
|
259
|
+
level: 2,
|
|
260
|
+
selectable: !0
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "akita-l2-id",
|
|
264
|
+
ancestors: [{
|
|
265
|
+
id: "japan-l1-id",
|
|
266
|
+
displayName: "Japan",
|
|
267
|
+
level: 1
|
|
268
|
+
}],
|
|
269
|
+
displayName: "Akita",
|
|
270
|
+
level: 2,
|
|
271
|
+
selectable: !0
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "hiroshima-l2-id",
|
|
275
|
+
ancestors: [{
|
|
276
|
+
id: "japan-l1-id",
|
|
277
|
+
displayName: "Japan",
|
|
278
|
+
level: 1
|
|
279
|
+
}],
|
|
280
|
+
displayName: "Hiroshima",
|
|
281
|
+
level: 2,
|
|
282
|
+
selectable: !0
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "kagoshima-l2-id",
|
|
286
|
+
ancestors: [{
|
|
287
|
+
id: "japan-l1-id",
|
|
288
|
+
displayName: "Japan",
|
|
289
|
+
level: 1
|
|
290
|
+
}],
|
|
291
|
+
displayName: "Kagoshima",
|
|
292
|
+
level: 2,
|
|
293
|
+
selectable: !0
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: "aomori-l2-id",
|
|
297
|
+
ancestors: [{
|
|
298
|
+
id: "japan-l1-id",
|
|
299
|
+
displayName: "Japan",
|
|
300
|
+
level: 1
|
|
301
|
+
}],
|
|
302
|
+
displayName: "Aomori",
|
|
303
|
+
level: 2,
|
|
304
|
+
selectable: !0
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: "hyogo-l2-id",
|
|
308
|
+
ancestors: [{
|
|
309
|
+
id: "japan-l1-id",
|
|
310
|
+
displayName: "Japan",
|
|
311
|
+
level: 1
|
|
312
|
+
}],
|
|
313
|
+
displayName: "Hyogo",
|
|
314
|
+
level: 2,
|
|
315
|
+
selectable: !0
|
|
316
|
+
},
|
|
317
|
+
// UK L2
|
|
318
|
+
{
|
|
319
|
+
id: "england-l2-id",
|
|
320
|
+
ancestors: [{
|
|
321
|
+
id: "uk-l1-id",
|
|
322
|
+
displayName: "United Kingdom",
|
|
323
|
+
level: 1
|
|
324
|
+
}],
|
|
325
|
+
displayName: "England",
|
|
326
|
+
level: 2,
|
|
327
|
+
selectable: !0
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: "scotland-l2-id",
|
|
331
|
+
ancestors: [{
|
|
332
|
+
id: "uk-l1-id",
|
|
333
|
+
displayName: "United Kingdom",
|
|
334
|
+
level: 1
|
|
335
|
+
}],
|
|
336
|
+
displayName: "Scotland",
|
|
337
|
+
level: 2,
|
|
338
|
+
selectable: !0
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
id: "wales-l2-id",
|
|
342
|
+
ancestors: [{
|
|
343
|
+
id: "uk-l1-id",
|
|
344
|
+
displayName: "United Kingdom",
|
|
345
|
+
level: 1
|
|
346
|
+
}],
|
|
347
|
+
displayName: "Wales",
|
|
348
|
+
level: 2,
|
|
349
|
+
selectable: !0
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: "northern-ireland-l2-id",
|
|
353
|
+
ancestors: [{
|
|
354
|
+
id: "uk-l1-id",
|
|
355
|
+
displayName: "United Kingdom",
|
|
356
|
+
level: 1
|
|
357
|
+
}],
|
|
358
|
+
displayName: "Northern Ireland",
|
|
359
|
+
level: 2,
|
|
360
|
+
selectable: !0
|
|
361
|
+
}
|
|
362
|
+
], N = 5, j = (l, e) => {
|
|
363
|
+
const a = parseInt(l, 10) || 0, i = a + N;
|
|
364
|
+
return e.slice(a, i).map(({
|
|
365
|
+
displayName: s,
|
|
366
|
+
id: t,
|
|
367
|
+
...n
|
|
368
|
+
}) => ({
|
|
369
|
+
displayValue: s,
|
|
370
|
+
value: t,
|
|
371
|
+
...n
|
|
372
|
+
}));
|
|
373
|
+
}, U = (l, e) => {
|
|
374
|
+
const i = (parseInt(l, 10) || 0) + N;
|
|
375
|
+
return i < e.length ? i.toString() : void 0;
|
|
376
|
+
}, x = /* @__PURE__ */ (() => {
|
|
377
|
+
let l = 0, e = 0;
|
|
378
|
+
return async ({
|
|
379
|
+
delay: a,
|
|
380
|
+
signal: i,
|
|
381
|
+
level: s,
|
|
382
|
+
searchInput: t,
|
|
383
|
+
ancestorId: n,
|
|
384
|
+
marker: o,
|
|
385
|
+
failOnLoadMore: u,
|
|
386
|
+
options: v = y,
|
|
387
|
+
failOnLoadMoreTimes: b = Number.MAX_SAFE_INTEGER,
|
|
388
|
+
failOnLoadLevel: k,
|
|
389
|
+
failOnLoadLevelTimes: f = Number.MAX_SAFE_INTEGER
|
|
390
|
+
}) => {
|
|
391
|
+
if (i.aborted)
|
|
392
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
393
|
+
if (u && o != null && l < b)
|
|
394
|
+
return l += 1, Promise.reject();
|
|
395
|
+
if (s === k && e < f)
|
|
396
|
+
return e += 1, Promise.reject();
|
|
397
|
+
a && await new Promise((r) => setTimeout(r, a));
|
|
398
|
+
const m = v.filter((r) => {
|
|
399
|
+
const {
|
|
400
|
+
displayName: h,
|
|
401
|
+
level: c,
|
|
402
|
+
ancestors: p
|
|
403
|
+
} = {
|
|
404
|
+
...r
|
|
405
|
+
};
|
|
406
|
+
let d = !0;
|
|
407
|
+
return s && c && c !== s && (d = !1), t && (d = d && h.toLowerCase().includes(t.toLowerCase())), n && (d = d && (p == null ? void 0 : p.some(({
|
|
408
|
+
id: S
|
|
409
|
+
}) => S === n))), d;
|
|
410
|
+
}), g = Promise.resolve({
|
|
411
|
+
marker: U(o, m),
|
|
412
|
+
options: j(o, m)
|
|
413
|
+
});
|
|
414
|
+
return w(await g);
|
|
415
|
+
};
|
|
416
|
+
})();
|
|
417
|
+
function w(l) {
|
|
418
|
+
return {
|
|
419
|
+
marker: l.marker,
|
|
420
|
+
options: l.options.map(({
|
|
421
|
+
value: e,
|
|
422
|
+
displayValue: a,
|
|
423
|
+
...i
|
|
424
|
+
}) => a ? {
|
|
425
|
+
displayValue: a,
|
|
426
|
+
value: e,
|
|
427
|
+
...i
|
|
428
|
+
} : {
|
|
429
|
+
value: e,
|
|
430
|
+
...i
|
|
431
|
+
})
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const J = (l) => {
|
|
435
|
+
const e = y.find((a) => a.displayName === l);
|
|
436
|
+
return e ? {
|
|
437
|
+
value: e.id,
|
|
438
|
+
displayValue: e.displayName,
|
|
439
|
+
level: e.level,
|
|
440
|
+
selectable: e.selectable,
|
|
441
|
+
ancestors: e.ancestors
|
|
442
|
+
} : null;
|
|
443
|
+
};
|
|
3
444
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
445
|
+
I as ComboboxWithApiTreeView,
|
|
446
|
+
y as apiResponse,
|
|
447
|
+
J as findNode,
|
|
448
|
+
x as mockTreeFetcher
|
|
8
449
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.8",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.15",
|
|
6
6
|
"@box/blueprint-web": "^10.3.1",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"react-intl": "^6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@box/tree": "^0.41.
|
|
14
|
+
"@box/tree": "^0.41.8",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|