@arcgis/coding-components 1.0.0-beta.11 → 1.0.0-beta.13
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/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +821 -155
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +853 -187
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +821 -155
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +859 -193
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +859 -193
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +845 -179
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +829 -163
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +858 -192
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +859 -193
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +859 -193
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +859 -193
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +1 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +1 -2
- package/dist/arcgis-coding-components/index.esm.js +1 -1
- package/dist/arcgis-coding-components/{p-ed254359.js → p-00c0b964.js} +1 -1
- package/dist/arcgis-coding-components/{p-616bcc2c.js → p-0f471c2c.js} +1 -1
- package/dist/arcgis-coding-components/{p-4d7cdaf4.js → p-2daa5deb.js} +1 -1
- package/dist/arcgis-coding-components/{p-b866ffa3.js → p-65933e8a.js} +1 -1
- package/dist/arcgis-coding-components/{p-2eee5b07.js → p-92019d78.js} +7 -7
- package/dist/arcgis-coding-components/{p-ee4aaf72.js → p-bcd478e3.js} +1 -1
- package/dist/arcgis-coding-components/{p-41feaa6e.js → p-be85ec3d.js} +1 -1
- package/dist/arcgis-coding-components/{p-63d6d128.js → p-bf83cfac.js} +1 -1
- package/dist/arcgis-coding-components/p-dd2d53e7.entry.js +1 -0
- package/dist/arcgis-coding-components/{p-c14a46af.js → p-f1b6ba59.js} +1 -1
- package/dist/cjs/{arcade-defaults-f77b7bae.js → arcade-defaults-990ceb0a.js} +51 -33
- package/dist/cjs/{arcade-mode-4b1d5adc.js → arcade-mode-6a101da0.js} +1 -1
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +40 -10
- package/dist/cjs/{cssMode-c21a8b34.js → cssMode-ef738198.js} +1 -1
- package/dist/cjs/{html-baddeebf.js → html-e97a8c1e.js} +1 -1
- package/dist/cjs/{htmlMode-3ca73779.js → htmlMode-0afb8251.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{javascript-4226e8d4.js → javascript-09fbcb7d.js} +2 -2
- package/dist/cjs/{jsonMode-4496d6b9.js → jsonMode-9a315af5.js} +1 -1
- package/dist/cjs/{tsMode-6fa6f2f6.js → tsMode-000c3471.js} +1 -1
- package/dist/cjs/{typescript-5b6bab68.js → typescript-a9f8ce6c.js} +1 -1
- package/dist/components/arcade-api.js +2 -1
- package/dist/components/arcade-defaults.js +3 -23
- package/dist/components/arcade-results.js +40 -10
- package/dist/components/arcade-suggestions.js +2 -1
- package/dist/components/arcade-variables.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +1 -1
- package/dist/components/code-editor.js +1 -1
- package/dist/components/fields.js +125 -0
- package/dist/components/index2.js +282 -32
- package/dist/components/utilities.js +2 -334
- package/dist/esm/{arcade-defaults-24670a1d.js → arcade-defaults-a8808d6a.js} +52 -33
- package/dist/esm/{arcade-mode-dc10ed9f.js → arcade-mode-6c8aff99.js} +1 -1
- package/dist/esm/arcgis-arcade-api_6.entry.js +40 -10
- package/dist/esm/{cssMode-0ae84348.js → cssMode-e19675cf.js} +1 -1
- package/dist/esm/{html-c18864a6.js → html-0e2f7c2f.js} +1 -1
- package/dist/esm/{htmlMode-426699f2.js → htmlMode-a4dd6993.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{javascript-982f2d73.js → javascript-9d754452.js} +2 -2
- package/dist/esm/{jsonMode-170e0a0e.js → jsonMode-cfafe91a.js} +1 -1
- package/dist/esm/{tsMode-99d2e8e5.js → tsMode-612386a7.js} +1 -1
- package/dist/esm/{typescript-de4f8a27.js → typescript-a17e2ba3.js} +1 -1
- package/dist/types/utils/arcade-executor.d.ts +35 -3
- package/dist/types/utils/fields.d.ts +10 -0
- package/dist/types/utils/profile/types.d.ts +2 -2
- package/dist/types/utils/utilities.d.ts +0 -6
- package/package.json +8 -8
- package/dist/arcgis-coding-components/p-9a6baa15.entry.js +0 -1
|
@@ -1,43 +1,293 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
// src/deferred.ts
|
|
2
|
+
var Deferred = class {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new deferred promise.
|
|
5
|
+
*/
|
|
6
|
+
constructor() {
|
|
7
|
+
this.resolve = () => void 0;
|
|
8
|
+
this.reject = () => void 0;
|
|
9
|
+
this.promise = new Promise((resolve, reject) => {
|
|
10
|
+
this.resolve = resolve;
|
|
11
|
+
this.reject = reject;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/dom.ts
|
|
17
|
+
function inTargetElement(element, targetElement) {
|
|
18
|
+
let currentElement = element;
|
|
19
|
+
while (currentElement) {
|
|
20
|
+
if (currentElement === targetElement) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (!currentElement.parentNode) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
27
|
+
currentElement = currentElement.parentNode.host;
|
|
28
|
+
} else {
|
|
29
|
+
currentElement = currentElement.parentNode;
|
|
10
30
|
}
|
|
11
|
-
|
|
12
|
-
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
13
33
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
function observeAncestorsMutation(element, attributeFilter, callback = () => void 0) {
|
|
35
|
+
if (!attributeFilter || attributeFilter.length <= 0) {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
39
|
+
for (const mutation of mutations) {
|
|
40
|
+
if (inTargetElement(element, mutation.target)) {
|
|
41
|
+
callback();
|
|
42
|
+
}
|
|
17
43
|
}
|
|
18
|
-
|
|
19
|
-
|
|
44
|
+
});
|
|
45
|
+
mutationObserver.observe(document.documentElement, {
|
|
46
|
+
attributes: true,
|
|
47
|
+
attributeFilter,
|
|
48
|
+
subtree: true
|
|
49
|
+
});
|
|
50
|
+
return mutationObserver;
|
|
20
51
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
52
|
+
function closestElement(base, selector) {
|
|
53
|
+
let currentElement = base;
|
|
54
|
+
while (currentElement) {
|
|
55
|
+
const element = currentElement.closest(selector);
|
|
56
|
+
if (element) {
|
|
57
|
+
return element;
|
|
24
58
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
59
|
+
const rootElement = currentElement.getRootNode();
|
|
60
|
+
if (rootElement === document) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
currentElement = rootElement.host;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function getElementTheme(base) {
|
|
68
|
+
const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
|
|
69
|
+
return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
|
|
70
|
+
}
|
|
71
|
+
function getElementAttribute(el, prop, fallbackValue) {
|
|
72
|
+
const closest = closestElement(el, `[${prop}]`);
|
|
73
|
+
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
27
74
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
75
|
+
function isElement(ref) {
|
|
76
|
+
return ref.nodeType === Node.ELEMENT_NODE;
|
|
77
|
+
}
|
|
78
|
+
function setFocus(ref, selector = "") {
|
|
79
|
+
if (!isElement(ref)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (ref.matches(selector)) {
|
|
83
|
+
setTimeout(() => ref?.setFocus(), 0);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
for (let i = 0; i < ref.children.length; i++) {
|
|
87
|
+
if (setFocus(ref.children[i], selector)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const shadowRoot = ref.shadowRoot;
|
|
92
|
+
if (shadowRoot) {
|
|
93
|
+
for (let i = 0; i < shadowRoot.children.length; i++) {
|
|
94
|
+
if (setFocus(shadowRoot.children[i], selector)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
31
97
|
}
|
|
32
|
-
|
|
33
|
-
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
34
100
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
101
|
+
function setFocusOnElement(ref, selector) {
|
|
102
|
+
if (!ref || !ref.shadowRoot) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
|
|
106
|
+
setFocus(ref, selector);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const mutationObserver = new MutationObserver(() => {
|
|
110
|
+
mutationObserver.disconnect();
|
|
111
|
+
setFocus(ref, selector);
|
|
112
|
+
});
|
|
113
|
+
mutationObserver.observe(ref, {
|
|
114
|
+
attributes: true,
|
|
115
|
+
attributeFilter: ["hydrated", "calcite-hydrated"]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/guid.ts
|
|
120
|
+
function gen(count) {
|
|
121
|
+
let out = "";
|
|
122
|
+
for (let i = 0; i < count; i++) {
|
|
123
|
+
out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
function generateGuid() {
|
|
128
|
+
return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/intl.ts
|
|
132
|
+
var SupportedLocales = /* @__PURE__ */ new Set([
|
|
133
|
+
"ar",
|
|
134
|
+
"bg",
|
|
135
|
+
"bs",
|
|
136
|
+
"ca",
|
|
137
|
+
"cs",
|
|
138
|
+
"da",
|
|
139
|
+
"de",
|
|
140
|
+
"el",
|
|
141
|
+
"en",
|
|
142
|
+
"es",
|
|
143
|
+
"et",
|
|
144
|
+
"fi",
|
|
145
|
+
"fr",
|
|
146
|
+
"he",
|
|
147
|
+
"hr",
|
|
148
|
+
"hu",
|
|
149
|
+
"id",
|
|
150
|
+
"it",
|
|
151
|
+
"ja",
|
|
152
|
+
"ko",
|
|
153
|
+
"lt",
|
|
154
|
+
"lv",
|
|
155
|
+
"nl",
|
|
156
|
+
"nb",
|
|
157
|
+
"pl",
|
|
158
|
+
"pt-BR",
|
|
159
|
+
"pt-PT",
|
|
160
|
+
"ro",
|
|
161
|
+
"ru",
|
|
162
|
+
"sk",
|
|
163
|
+
"sl",
|
|
164
|
+
"sr",
|
|
165
|
+
"sv",
|
|
166
|
+
"th",
|
|
167
|
+
"tr",
|
|
168
|
+
"uk",
|
|
169
|
+
"vi",
|
|
170
|
+
"zh-CN",
|
|
171
|
+
"zh-HK",
|
|
172
|
+
"zh-TW"
|
|
173
|
+
]);
|
|
174
|
+
var t9nStringsCache = /* @__PURE__ */ new Map();
|
|
175
|
+
async function fetchT9NStringsBundle(locale, assetsPath, prefix = "") {
|
|
176
|
+
const filePath = `${assetsPath}/${prefix}${locale}.json`;
|
|
177
|
+
if (t9nStringsCache.has(filePath)) {
|
|
178
|
+
return t9nStringsCache.get(filePath);
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
const response = await fetch(filePath);
|
|
182
|
+
if (response.ok) {
|
|
183
|
+
const stringBundle2 = await response.json();
|
|
184
|
+
t9nStringsCache.set(filePath, stringBundle2);
|
|
185
|
+
return stringBundle2;
|
|
38
186
|
}
|
|
39
|
-
|
|
40
|
-
|
|
187
|
+
if (locale === "en") {
|
|
188
|
+
t9nStringsCache.set(filePath, void 0);
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
const stringBundle = await fetchT9NStringsBundle("en", assetsPath, prefix);
|
|
192
|
+
t9nStringsCache.set(filePath, stringBundle);
|
|
193
|
+
return stringBundle;
|
|
194
|
+
} catch (e) {
|
|
195
|
+
t9nStringsCache.set(filePath, void 0);
|
|
196
|
+
return void 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function getElementLocale(el) {
|
|
200
|
+
const lang = getElementAttribute(el, "lang", navigator?.language || "en");
|
|
201
|
+
if (SupportedLocales.has(lang)) {
|
|
202
|
+
return lang;
|
|
203
|
+
}
|
|
204
|
+
const rootCode = lang.slice(0, 2);
|
|
205
|
+
return SupportedLocales.has(rootCode) ? rootCode : "en";
|
|
206
|
+
}
|
|
207
|
+
var observersMap = /* @__PURE__ */ new WeakMap();
|
|
208
|
+
var assetsPathMap = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
var t9nStringsMap = /* @__PURE__ */ new WeakMap();
|
|
210
|
+
async function startLocaleObserver(component, assetsPath, callback) {
|
|
211
|
+
assetsPathMap.set(component, assetsPath);
|
|
212
|
+
observersMap.set(
|
|
213
|
+
component,
|
|
214
|
+
observeAncestorsMutation(component._hostElt, ["lang"], () => {
|
|
215
|
+
updateComponentLocateState(component, callback);
|
|
216
|
+
})
|
|
217
|
+
);
|
|
218
|
+
await updateComponentLocateState(component, callback);
|
|
219
|
+
}
|
|
220
|
+
function stopLocaleObserver(component) {
|
|
221
|
+
observersMap.get(component)?.disconnect();
|
|
222
|
+
observersMap.delete(component);
|
|
223
|
+
assetsPathMap.delete(component);
|
|
224
|
+
}
|
|
225
|
+
async function updateComponentLocateState(component, callback) {
|
|
226
|
+
const locale = getElementLocale(component._hostElt);
|
|
227
|
+
if (locale === component._locale) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
let t9nStrings = t9nStringsMap.get(component);
|
|
231
|
+
if (!t9nStrings) {
|
|
232
|
+
const assetsPath = assetsPathMap.get(component) ?? "";
|
|
233
|
+
const assetName = component._hostElt.tagName.toLowerCase().replace("arcgis-", "");
|
|
234
|
+
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
235
|
+
const prefix = `${assetName}.t9n.`;
|
|
236
|
+
component._locale = locale;
|
|
237
|
+
t9nStrings = await fetchT9NStringsBundle(component._locale, t9nAssetsPath, prefix);
|
|
238
|
+
}
|
|
239
|
+
component._t9nStrings = t9nStrings;
|
|
240
|
+
await callback?.call(component);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/strings.ts
|
|
244
|
+
var doubleQuote = '"';
|
|
245
|
+
var singleQuote = "'";
|
|
246
|
+
function repeatString(value, n) {
|
|
247
|
+
return new Array(n + 1).join(value);
|
|
248
|
+
}
|
|
249
|
+
function quoteString(value) {
|
|
250
|
+
let quote = doubleQuote;
|
|
251
|
+
let alternateQuote = singleQuote;
|
|
252
|
+
const avoidEscape = value.indexOf(quote) >= 0 && value.indexOf(alternateQuote) < 0;
|
|
253
|
+
if (avoidEscape) {
|
|
254
|
+
alternateQuote = doubleQuote;
|
|
255
|
+
quote = singleQuote;
|
|
256
|
+
}
|
|
257
|
+
const alternateEscape = new RegExp("(^|[^\\\\])((?:\\\\{2})*)((?:\\\\" + alternateQuote + ")+)", "g");
|
|
258
|
+
value = value.replace(
|
|
259
|
+
alternateEscape,
|
|
260
|
+
(_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
|
|
261
|
+
// We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
|
|
262
|
+
boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
|
|
263
|
+
)
|
|
264
|
+
);
|
|
265
|
+
const quoteEscape = new RegExp("(^|[^\\\\])((?:\\\\{2})*)(" + quote + "+)", "g");
|
|
266
|
+
value = value.replace(
|
|
267
|
+
quoteEscape,
|
|
268
|
+
(_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString("\\" + quote, quoteChars.length)
|
|
269
|
+
);
|
|
270
|
+
return quote + value + quote;
|
|
271
|
+
}
|
|
272
|
+
function createFilterExpression(filterWord) {
|
|
273
|
+
const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/g, "\\$&") : "^.*$";
|
|
274
|
+
return new RegExp(sanitizedWord, "i");
|
|
275
|
+
}
|
|
276
|
+
function setValuesInString(message, values = {}) {
|
|
277
|
+
return (message ?? "").replace(/\{(.*?)\}/g, (match, valueName) => {
|
|
278
|
+
return values[valueName] ?? match;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
function addLTRMark(value) {
|
|
282
|
+
return "\u200E" + (value ?? "") + "\u200E";
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/type-guards.ts
|
|
286
|
+
function isNotNull(item) {
|
|
287
|
+
return item !== null;
|
|
288
|
+
}
|
|
289
|
+
function isNotUndefined(item) {
|
|
290
|
+
return item !== void 0;
|
|
41
291
|
}
|
|
42
292
|
|
|
43
|
-
export {
|
|
293
|
+
export { Deferred as D, SupportedLocales as S, getElementTheme as a, stopLocaleObserver as b, isNotUndefined as c, addLTRMark as d, setValuesInString as e, fetchT9NStringsBundle as f, generateGuid as g, setFocusOnElement as h, isNotNull as i, createFilterExpression as j, observeAncestorsMutation as o, quoteString as q, startLocaleObserver as s };
|
|
@@ -1,294 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var Deferred = class {
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new deferred promise.
|
|
5
|
-
*/
|
|
6
|
-
constructor() {
|
|
7
|
-
this.resolve = () => void 0;
|
|
8
|
-
this.reject = () => void 0;
|
|
9
|
-
this.promise = new Promise((resolve, reject) => {
|
|
10
|
-
this.resolve = resolve;
|
|
11
|
-
this.reject = reject;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// src/dom.ts
|
|
17
|
-
function inTargetElement(element, targetElement) {
|
|
18
|
-
let currentElement = element;
|
|
19
|
-
while (currentElement) {
|
|
20
|
-
if (currentElement === targetElement) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
if (!currentElement.parentNode) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
27
|
-
currentElement = currentElement.parentNode.host;
|
|
28
|
-
} else {
|
|
29
|
-
currentElement = currentElement.parentNode;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
function observeAncestorsMutation(element, attributeFilter, callback = () => void 0) {
|
|
35
|
-
if (!attributeFilter || attributeFilter.length <= 0) {
|
|
36
|
-
return void 0;
|
|
37
|
-
}
|
|
38
|
-
const mutationObserver = new MutationObserver((mutations) => {
|
|
39
|
-
for (const mutation of mutations) {
|
|
40
|
-
if (inTargetElement(element, mutation.target)) {
|
|
41
|
-
callback();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
mutationObserver.observe(document.documentElement, {
|
|
46
|
-
attributes: true,
|
|
47
|
-
attributeFilter,
|
|
48
|
-
subtree: true
|
|
49
|
-
});
|
|
50
|
-
return mutationObserver;
|
|
51
|
-
}
|
|
52
|
-
function closestElement(base, selector) {
|
|
53
|
-
let currentElement = base;
|
|
54
|
-
while (currentElement) {
|
|
55
|
-
const element = currentElement.closest(selector);
|
|
56
|
-
if (element) {
|
|
57
|
-
return element;
|
|
58
|
-
}
|
|
59
|
-
const rootElement = currentElement.getRootNode();
|
|
60
|
-
if (rootElement === document) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
currentElement = rootElement.host;
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
function getElementTheme(base) {
|
|
68
|
-
const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
|
|
69
|
-
return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
|
|
70
|
-
}
|
|
71
|
-
function getElementAttribute(el, prop, fallbackValue) {
|
|
72
|
-
const closest = closestElement(el, `[${prop}]`);
|
|
73
|
-
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
74
|
-
}
|
|
75
|
-
function isElement(ref) {
|
|
76
|
-
return ref.nodeType === Node.ELEMENT_NODE;
|
|
77
|
-
}
|
|
78
|
-
function setFocus(ref, selector = "") {
|
|
79
|
-
if (!isElement(ref)) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
if (ref.matches(selector)) {
|
|
83
|
-
setTimeout(() => ref?.setFocus(), 0);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
for (let i = 0; i < ref.children.length; i++) {
|
|
87
|
-
if (setFocus(ref.children[i], selector)) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const shadowRoot = ref.shadowRoot;
|
|
92
|
-
if (shadowRoot) {
|
|
93
|
-
for (let i = 0; i < shadowRoot.children.length; i++) {
|
|
94
|
-
if (setFocus(shadowRoot.children[i], selector)) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
function setFocusOnElement(ref, selector) {
|
|
102
|
-
if (!ref || !ref.shadowRoot) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
|
|
106
|
-
setFocus(ref, selector);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const mutationObserver = new MutationObserver(() => {
|
|
110
|
-
mutationObserver.disconnect();
|
|
111
|
-
setFocus(ref, selector);
|
|
112
|
-
});
|
|
113
|
-
mutationObserver.observe(ref, {
|
|
114
|
-
attributes: true,
|
|
115
|
-
attributeFilter: ["hydrated", "calcite-hydrated"]
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// src/guid.ts
|
|
120
|
-
function gen(count) {
|
|
121
|
-
let out = "";
|
|
122
|
-
for (let i = 0; i < count; i++) {
|
|
123
|
-
out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
124
|
-
}
|
|
125
|
-
return out;
|
|
126
|
-
}
|
|
127
|
-
function generateGuid() {
|
|
128
|
-
return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/intl.ts
|
|
132
|
-
var SupportedLocales = /* @__PURE__ */ new Set([
|
|
133
|
-
"ar",
|
|
134
|
-
"bg",
|
|
135
|
-
"bs",
|
|
136
|
-
"ca",
|
|
137
|
-
"cs",
|
|
138
|
-
"da",
|
|
139
|
-
"de",
|
|
140
|
-
"el",
|
|
141
|
-
"en",
|
|
142
|
-
"es",
|
|
143
|
-
"et",
|
|
144
|
-
"fi",
|
|
145
|
-
"fr",
|
|
146
|
-
"he",
|
|
147
|
-
"hr",
|
|
148
|
-
"hu",
|
|
149
|
-
"id",
|
|
150
|
-
"it",
|
|
151
|
-
"ja",
|
|
152
|
-
"ko",
|
|
153
|
-
"lt",
|
|
154
|
-
"lv",
|
|
155
|
-
"nl",
|
|
156
|
-
"nb",
|
|
157
|
-
"pl",
|
|
158
|
-
"pt-BR",
|
|
159
|
-
"pt-PT",
|
|
160
|
-
"ro",
|
|
161
|
-
"ru",
|
|
162
|
-
"sk",
|
|
163
|
-
"sl",
|
|
164
|
-
"sr",
|
|
165
|
-
"sv",
|
|
166
|
-
"th",
|
|
167
|
-
"tr",
|
|
168
|
-
"uk",
|
|
169
|
-
"vi",
|
|
170
|
-
"zh-CN",
|
|
171
|
-
"zh-HK",
|
|
172
|
-
"zh-TW"
|
|
173
|
-
]);
|
|
174
|
-
var t9nStringsCache = /* @__PURE__ */ new Map();
|
|
175
|
-
async function fetchT9NStringsBundle(locale, assetsPath, prefix = "") {
|
|
176
|
-
const filePath = `${assetsPath}/${prefix}${locale}.json`;
|
|
177
|
-
if (t9nStringsCache.has(filePath)) {
|
|
178
|
-
return t9nStringsCache.get(filePath);
|
|
179
|
-
}
|
|
180
|
-
try {
|
|
181
|
-
const response = await fetch(filePath);
|
|
182
|
-
if (response.ok) {
|
|
183
|
-
const stringBundle2 = await response.json();
|
|
184
|
-
t9nStringsCache.set(filePath, stringBundle2);
|
|
185
|
-
return stringBundle2;
|
|
186
|
-
}
|
|
187
|
-
if (locale === "en") {
|
|
188
|
-
t9nStringsCache.set(filePath, void 0);
|
|
189
|
-
return void 0;
|
|
190
|
-
}
|
|
191
|
-
const stringBundle = await fetchT9NStringsBundle("en", assetsPath, prefix);
|
|
192
|
-
t9nStringsCache.set(filePath, stringBundle);
|
|
193
|
-
return stringBundle;
|
|
194
|
-
} catch (e) {
|
|
195
|
-
t9nStringsCache.set(filePath, void 0);
|
|
196
|
-
return void 0;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function getElementLocale(el) {
|
|
200
|
-
const lang = getElementAttribute(el, "lang", navigator?.language || "en");
|
|
201
|
-
if (SupportedLocales.has(lang)) {
|
|
202
|
-
return lang;
|
|
203
|
-
}
|
|
204
|
-
const rootCode = lang.slice(0, 2);
|
|
205
|
-
return SupportedLocales.has(rootCode) ? rootCode : "en";
|
|
206
|
-
}
|
|
207
|
-
var observersMap = /* @__PURE__ */ new WeakMap();
|
|
208
|
-
var assetsPathMap = /* @__PURE__ */ new WeakMap();
|
|
209
|
-
var t9nStringsMap = /* @__PURE__ */ new WeakMap();
|
|
210
|
-
async function startLocaleObserver(component, assetsPath, callback) {
|
|
211
|
-
assetsPathMap.set(component, assetsPath);
|
|
212
|
-
observersMap.set(
|
|
213
|
-
component,
|
|
214
|
-
observeAncestorsMutation(component._hostElt, ["lang"], () => {
|
|
215
|
-
updateComponentLocateState(component, callback);
|
|
216
|
-
})
|
|
217
|
-
);
|
|
218
|
-
await updateComponentLocateState(component, callback);
|
|
219
|
-
}
|
|
220
|
-
function stopLocaleObserver(component) {
|
|
221
|
-
observersMap.get(component)?.disconnect();
|
|
222
|
-
observersMap.delete(component);
|
|
223
|
-
assetsPathMap.delete(component);
|
|
224
|
-
}
|
|
225
|
-
async function updateComponentLocateState(component, callback) {
|
|
226
|
-
const locale = getElementLocale(component._hostElt);
|
|
227
|
-
if (locale === component._locale) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
let t9nStrings = t9nStringsMap.get(component);
|
|
231
|
-
if (!t9nStrings) {
|
|
232
|
-
const assetsPath = assetsPathMap.get(component) ?? "";
|
|
233
|
-
const assetName = component._hostElt.tagName.toLowerCase().replace("arcgis-", "");
|
|
234
|
-
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
235
|
-
const prefix = `${assetName}.t9n.`;
|
|
236
|
-
component._locale = locale;
|
|
237
|
-
t9nStrings = await fetchT9NStringsBundle(component._locale, t9nAssetsPath, prefix);
|
|
238
|
-
}
|
|
239
|
-
component._t9nStrings = t9nStrings;
|
|
240
|
-
await callback?.call(component);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// src/strings.ts
|
|
244
|
-
var doubleQuote = '"';
|
|
245
|
-
var singleQuote = "'";
|
|
246
|
-
function repeatString(value, n) {
|
|
247
|
-
return new Array(n + 1).join(value);
|
|
248
|
-
}
|
|
249
|
-
function quoteString(value) {
|
|
250
|
-
let quote = doubleQuote;
|
|
251
|
-
let alternateQuote = singleQuote;
|
|
252
|
-
const avoidEscape = value.indexOf(quote) >= 0 && value.indexOf(alternateQuote) < 0;
|
|
253
|
-
if (avoidEscape) {
|
|
254
|
-
alternateQuote = doubleQuote;
|
|
255
|
-
quote = singleQuote;
|
|
256
|
-
}
|
|
257
|
-
const alternateEscape = new RegExp("(^|[^\\\\])((?:\\\\{2})*)((?:\\\\" + alternateQuote + ")+)", "g");
|
|
258
|
-
value = value.replace(
|
|
259
|
-
alternateEscape,
|
|
260
|
-
(_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
|
|
261
|
-
// We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
|
|
262
|
-
boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
|
|
263
|
-
)
|
|
264
|
-
);
|
|
265
|
-
const quoteEscape = new RegExp("(^|[^\\\\])((?:\\\\{2})*)(" + quote + "+)", "g");
|
|
266
|
-
value = value.replace(
|
|
267
|
-
quoteEscape,
|
|
268
|
-
(_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString("\\" + quote, quoteChars.length)
|
|
269
|
-
);
|
|
270
|
-
return quote + value + quote;
|
|
271
|
-
}
|
|
272
|
-
function createFilterExpression(filterWord) {
|
|
273
|
-
const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/g, "\\$&") : "^.*$";
|
|
274
|
-
return new RegExp(sanitizedWord, "i");
|
|
275
|
-
}
|
|
276
|
-
function setValuesInString(message, values = {}) {
|
|
277
|
-
return (message ?? "").replace(/\{(.*?)\}/g, (match, valueName) => {
|
|
278
|
-
return values[valueName] ?? match;
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
function addLTRMark(value) {
|
|
282
|
-
return "\u200E" + (value ?? "") + "\u200E";
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// src/type-guards.ts
|
|
286
|
-
function isNotNull(item) {
|
|
287
|
-
return item !== null;
|
|
288
|
-
}
|
|
289
|
-
function isNotUndefined(item) {
|
|
290
|
-
return item !== void 0;
|
|
291
|
-
}
|
|
1
|
+
import { j as createFilterExpression } from './index2.js';
|
|
292
2
|
|
|
293
3
|
/**
|
|
294
4
|
* Filters a collection of items by the given keys and filter word.
|
|
@@ -322,47 +32,5 @@ function portalItemPageUrl(portalItem) {
|
|
|
322
32
|
return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
|
|
323
33
|
}
|
|
324
34
|
//#endregion
|
|
325
|
-
//#region Fields
|
|
326
|
-
/**
|
|
327
|
-
* Returns the Arcade type for the given field.
|
|
328
|
-
*/
|
|
329
|
-
function fieldTypeToArcadeType(field) {
|
|
330
|
-
switch (field?.type) {
|
|
331
|
-
case "oid":
|
|
332
|
-
case "small-integer":
|
|
333
|
-
case "integer":
|
|
334
|
-
case "single":
|
|
335
|
-
case "double":
|
|
336
|
-
case "long":
|
|
337
|
-
return "number";
|
|
338
|
-
case "global-id":
|
|
339
|
-
case "guid":
|
|
340
|
-
case "string":
|
|
341
|
-
return "text";
|
|
342
|
-
case "date":
|
|
343
|
-
return "date";
|
|
344
|
-
default:
|
|
345
|
-
return "text";
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
function supportedFields(fields) {
|
|
349
|
-
return (fields ?? []).filter((field) => {
|
|
350
|
-
switch (field.type) {
|
|
351
|
-
case "small-integer":
|
|
352
|
-
case "integer":
|
|
353
|
-
case "single":
|
|
354
|
-
case "double":
|
|
355
|
-
case "string":
|
|
356
|
-
case "date":
|
|
357
|
-
case "oid":
|
|
358
|
-
case "guid":
|
|
359
|
-
case "global-id":
|
|
360
|
-
return true;
|
|
361
|
-
default:
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
//#endregion
|
|
367
35
|
|
|
368
|
-
export {
|
|
36
|
+
export { filterCollection as f, portalItemPageUrl as p };
|