@arcgis/common-components 6.0.0-next.3 → 6.0.0-next.31
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/cdn/2S4SSY4K.js +2 -0
- package/dist/cdn/{YEFEVEP6.js → 3UAY23XT.js} +1 -1
- package/dist/cdn/{OTWADB4M.js → 3ZTHRAIZ.js} +1 -1
- package/dist/cdn/{TXQKK4DJ.js → 4D35RDOE.js} +1 -1
- package/dist/cdn/4IMLX5B4.js +4 -0
- package/dist/cdn/5GVJKVEV.js +2 -0
- package/dist/cdn/6LZNNXUL.js +2 -0
- package/dist/cdn/74TVQE6W.js +2 -0
- package/dist/cdn/7WN227WZ.js +8207 -0
- package/dist/cdn/ANK7TFWV.js +2 -0
- package/dist/cdn/{X6DNIKWY.js → BAALW3SQ.js} +1 -1
- package/dist/cdn/{LNXO5YIS.js → BDIGRQ2U.js} +1 -1
- package/dist/cdn/BMR5AH6W.js +2 -0
- package/dist/cdn/DAAON2UO.js +3 -0
- package/dist/cdn/{IECXEZNI.js → EOGA62GK.js} +1 -1
- package/dist/cdn/{OMROUY3L.js → FESNPMRM.js} +1 -1
- package/dist/cdn/FGG3L42U.js +2 -0
- package/dist/cdn/{OIGA7XBZ.js → FVFYAK24.js} +1 -1
- package/dist/cdn/GZVXOCN5.js +2 -0
- package/dist/cdn/{D4UHHQ35.js → IOAVVVNO.js} +1 -1
- package/dist/cdn/{B33S3YBM.js → IZD4AM2W.js} +1 -1
- package/dist/cdn/{MFGUTQRR.js → J4AV4EAC.js} +1 -1
- package/dist/cdn/JYWWX277.js +2 -0
- package/dist/cdn/KEQPWVA6.js +2 -0
- package/dist/cdn/{TO3YFXVJ.js → LLLQXE2U.js} +1 -1
- package/dist/cdn/{KDCSDIUQ.js → M7F7EBFY.js} +1 -1
- package/dist/cdn/NZDJ3HVF.js +2 -0
- package/dist/cdn/OUPGMHLD.js +2 -0
- package/dist/cdn/{JTQN5KMG.js → PIXY2HTI.js} +1 -1
- package/dist/cdn/{BZFAYVKR.js → PJGWH4LW.js} +1 -1
- package/dist/cdn/SRO2CZ77.js +2 -0
- package/dist/cdn/T57JKNGO.js +2 -0
- package/dist/cdn/{EB5MDEWF.js → TE77L77R.js} +1 -1
- package/dist/cdn/TWPYXZ2O.js +2 -0
- package/dist/cdn/{735FTIBP.js → U6OGOB7D.js} +1 -1
- package/dist/cdn/V5FMQXMU.js +2 -0
- package/dist/cdn/{HYFFUYAU.js → VNC7X43V.js} +1 -1
- package/dist/cdn/W2W34T5K.js +2 -0
- package/dist/cdn/W7CWMG2O.js +2 -0
- package/dist/cdn/XMMFL5H3.js +2 -0
- package/dist/cdn/XQ65BGER.js +2 -0
- package/dist/cdn/ZJMMAZFG.js +2 -0
- package/dist/cdn/ZLVMV6TP.js +2 -0
- package/dist/cdn/{34AP2EEB.js → ZMYTELNC.js} +1 -1
- package/dist/cdn/assets/layer-replace/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/sharedCacheDirective.js +74 -0
- package/dist/chunks/toolbar.js +3 -3
- package/dist/components/arcgis-ckeditor5/customElement.js +144 -147
- package/dist/components/arcgis-color-input/customElement.js +29 -29
- package/dist/components/arcgis-color-input/index.js +2 -1
- package/dist/components/arcgis-field-pick-list/customElement.js +8 -8
- package/dist/components/arcgis-field-pick-list/index.js +1 -1
- package/dist/components/arcgis-html-content/customElement.d.ts +42 -0
- package/dist/components/arcgis-html-content/customElement.js +71 -0
- package/dist/components/arcgis-html-content/index.d.ts +1 -0
- package/dist/components/arcgis-html-content/index.js +1 -0
- package/dist/components/arcgis-label-input/customElement.js +1 -1
- package/dist/components/arcgis-layer-replace/customElement.d.ts +437 -0
- package/dist/components/arcgis-layer-replace/customElement.js +376 -0
- package/dist/components/arcgis-layer-replace/index.d.ts +1 -0
- package/dist/components/arcgis-layer-replace/index.js +7 -0
- package/dist/components/arcgis-slider/customElement.js +543 -455
- package/dist/components/arcgis-slider-field/customElement.d.ts +43 -41
- package/dist/components/arcgis-slider-field/customElement.js +45 -39
- package/dist/components/arcgis-slider-histogram-range/customElement.d.ts +21 -19
- package/dist/components/arcgis-slider-histogram-range/customElement.js +28 -22
- package/dist/components/arcgis-ticks/customElement.js +8 -8
- package/dist/components/arcgis-toolbar/customElement.d.ts +6 -3
- package/dist/components/arcgis-toolbar/customElement.js +30 -29
- package/dist/components/arcgis-toolbar/types.d.ts +1 -0
- package/dist/components/arcgis-toolbar-group/customElement.js +7 -7
- package/dist/components/arcgis-toolbar-item/customElement.js +1 -1
- package/dist/components/arcgis-toolbar-stack/customElement.js +51 -116
- package/dist/components/arcgis-unique-values-list/customElement.js +11 -11
- package/dist/components/arcgis-unique-values-list/index.js +1 -1
- package/dist/components/arcgis-value-picker/customElement.js +14 -14
- package/dist/components/arcgis-value-picker-combobox/customElement.js +4 -4
- package/dist/components/arcgis-value-picker-label/customElement.js +5 -5
- package/dist/components/arcgis-value-picker-slider/customElement.js +17 -17
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.css-custom-data.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -5
- package/dist/loader.js +6 -4
- package/dist/types/lumina.d.ts +26 -2
- package/dist/types/preact.d.ts +28 -2
- package/dist/types/react.d.ts +30 -2
- package/dist/types/stencil.d.ts +26 -2
- package/dist/utils/sharedCacheDirective.d.ts +68 -0
- package/package.json +6 -6
- package/dist/cdn/3AFEXHZ5.js +0 -2
- package/dist/cdn/5EA7SGHX.js +0 -2
- package/dist/cdn/5XRYXPOX.js +0 -2
- package/dist/cdn/ATLXGXTH.js +0 -2
- package/dist/cdn/BCN6LPOG.js +0 -4
- package/dist/cdn/CKGWDI7B.js +0 -2
- package/dist/cdn/DR2THZQU.js +0 -8208
- package/dist/cdn/EM4OQXFS.js +0 -2
- package/dist/cdn/GDRW3MIZ.js +0 -2
- package/dist/cdn/HJ3EJZFF.js +0 -2
- package/dist/cdn/LLATF73T.js +0 -2
- package/dist/cdn/M2J3GPM4.js +0 -2
- package/dist/cdn/M3SFEFPX.js +0 -2
- package/dist/cdn/QCUF7B3I.js +0 -2
- package/dist/cdn/S4XOD4YS.js +0 -2
- package/dist/cdn/UIBTY5FF.js +0 -2
- package/dist/cdn/XUPA27AW.js +0 -2
- package/dist/cdn/XX2ZCFWI.js +0 -2
- package/dist/cdn/ZCVP2N2O.js +0 -2
- package/dist/cdn/ZGYD3GAS.js +0 -2
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import { c as $ } from "../../chunks/runtime.js";
|
|
3
|
+
import { keyed as v } from "lit/directives/keyed.js";
|
|
4
|
+
import { repeat as b } from "lit/directives/repeat.js";
|
|
5
|
+
import { isAbortError as x } from "@arcgis/core/core/promiseUtils.js";
|
|
6
|
+
import { substitute as u } from "@arcgis/core/intl.js";
|
|
7
|
+
import { LitElement as R, createEvent as C } from "@arcgis/lumina";
|
|
8
|
+
import { log as I } from "@arcgis/toolkit/log";
|
|
9
|
+
import { css as D, html as d } from "lit";
|
|
10
|
+
import { u as L } from "../../chunks/useT9n.js";
|
|
11
|
+
const S = D`:host{display:block;container-type:inline-size;container-name:layer-replace;color:var(--arcgis-layer-replace-color, var(--calcite-color-text-2));--arcgis-layer-replace-content-gap: var(--calcite-space-sm-plus);--arcgis-layer-replace-row-gap: var(--calcite-space-sm-plus);--arcgis-layer-replace-name-gap: var(--calcite-space-sm);--arcgis-layer-replace-min-column-width: 16rem}.layer-replace{display:flex;flex-direction:column;gap:var(--arcgis-layer-replace-content-gap)}.layer-row,.field-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(var(--arcgis-layer-replace-min-column-width),1fr);align-items:center;gap:var(--arcgis-layer-replace-row-gap)}.layer-name,.field-name{display:flex;align-items:center;min-width:0;gap:var(--arcgis-layer-replace-name-gap)}.field-label{display:flex;flex-direction:column;min-width:0}.field-alias{color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--1)}.layer-name span,.field-name span{overflow-wrap:anywhere}.field-list{display:flex;flex-direction:column;gap:var(--arcgis-layer-replace-content-gap)}.layer-cell,.field-source,.field-target{display:flex;flex-direction:column;min-width:0;gap:var(--arcgis-layer-replace-name-gap)}calcite-combobox,calcite-notice{min-width:0}@container layer-replace (max-width: 36rem){.layer-row{grid-template-columns:1fr;gap:var(--arcgis-layer-replace-content-gap);padding:var(--calcite-space-sm);border:1px solid var(--calcite-color-border-1);border-radius:var(--calcite-border-radius-1)}.field-row{grid-template-columns:1fr;gap:var(--arcgis-layer-replace-name-gap);padding-block:var(--arcgis-layer-replace-name-gap);border-bottom:1px solid var(--calcite-color-border-1)}.field-row:last-child{border-bottom:0}.field-target{padding-inline-start:var(--calcite-space-lg)}}`;
|
|
12
|
+
function g(c) {
|
|
13
|
+
return c?.name?.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function k(c, e = {}) {
|
|
16
|
+
const t = c.fieldMappings.flatMap(
|
|
17
|
+
(s, l) => (c.replacementFieldsBySource.get(s.source) ?? []).flatMap((r, o) => {
|
|
18
|
+
const p = N(s.source, r);
|
|
19
|
+
return p === void 0 ? [] : [
|
|
20
|
+
{
|
|
21
|
+
source: s.source,
|
|
22
|
+
replacement: r,
|
|
23
|
+
strength: p,
|
|
24
|
+
sourceIndex: l,
|
|
25
|
+
replacementIndex: o
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
t.sort(
|
|
31
|
+
(s, l) => l.strength - s.strength || s.sourceIndex - l.sourceIndex || s.replacementIndex - l.replacementIndex
|
|
32
|
+
);
|
|
33
|
+
const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const s of t) {
|
|
35
|
+
const l = g(s.replacement);
|
|
36
|
+
!i.has(s.source) && (e.allowDuplicateReplacementFields || !l || !a.has(l)) && (i.set(s.source, s.replacement), l && !e.allowDuplicateReplacementFields && a.add(l));
|
|
37
|
+
}
|
|
38
|
+
return c.fieldMappings.map((s) => ({
|
|
39
|
+
source: s.source,
|
|
40
|
+
replacement: i.get(s.source)
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function F(c, e, t) {
|
|
44
|
+
const i = c.map(({ source: l }) => {
|
|
45
|
+
const r = t.find((o) => o.source === l)?.replacement;
|
|
46
|
+
return {
|
|
47
|
+
source: l,
|
|
48
|
+
replacement: r && e.replacementFieldsBySource.get(l)?.includes(r) ? r : void 0
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
if (e.allowDuplicateReplacementFields)
|
|
52
|
+
return i;
|
|
53
|
+
const a = /* @__PURE__ */ new Map(), s = [...i];
|
|
54
|
+
return s.forEach((l, r) => {
|
|
55
|
+
const o = l.replacement ? g(l.replacement) : void 0;
|
|
56
|
+
if (!o)
|
|
57
|
+
return;
|
|
58
|
+
const p = a.get(o);
|
|
59
|
+
if (p === void 0) {
|
|
60
|
+
a.set(o, r);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (l.source === e.preferredSource) {
|
|
64
|
+
s[p] = { ...s[p], replacement: void 0 }, a.set(o, r);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
s[r] = { ...l, replacement: void 0 };
|
|
68
|
+
}), s;
|
|
69
|
+
}
|
|
70
|
+
function z(c, e, t, i) {
|
|
71
|
+
const a = i.matches.flatMap(({ replacementFieldName: s, sourceFieldName: l }) => {
|
|
72
|
+
const r = w(e, l), o = r ? w(t.replacementFieldsBySource.get(r) ?? [], s) : void 0;
|
|
73
|
+
return r && o ? [{ source: r, replacement: o }] : [];
|
|
74
|
+
});
|
|
75
|
+
return F(c, t, a);
|
|
76
|
+
}
|
|
77
|
+
function w(c, e) {
|
|
78
|
+
const t = c.find((a) => a.name === e);
|
|
79
|
+
if (t)
|
|
80
|
+
return t;
|
|
81
|
+
const i = c.filter((a) => a.name?.toLowerCase() === e.toLowerCase());
|
|
82
|
+
return i.length === 1 ? i[0] : void 0;
|
|
83
|
+
}
|
|
84
|
+
function N(c, e) {
|
|
85
|
+
const t = c.type === "oid" || c.type === "global-id";
|
|
86
|
+
if (t && e.type !== c.type || !t && (!c.name || !e.name))
|
|
87
|
+
return;
|
|
88
|
+
const i = g(c), a = g(e);
|
|
89
|
+
if (i && i === a)
|
|
90
|
+
return 4;
|
|
91
|
+
const s = [c.name, c.alias].filter((n) => !!n), l = [e.name, e.alias].filter((n) => !!n), r = s.map((n) => n.toLowerCase()), o = l.map((n) => n.toLowerCase());
|
|
92
|
+
if (r.some((n) => o.includes(n)))
|
|
93
|
+
return 3;
|
|
94
|
+
if (t)
|
|
95
|
+
return 2;
|
|
96
|
+
let p;
|
|
97
|
+
for (const n of r) {
|
|
98
|
+
const m = n.length * 0.3;
|
|
99
|
+
for (const h of o) {
|
|
100
|
+
const f = A(n, h);
|
|
101
|
+
if (f <= m) {
|
|
102
|
+
const y = 1 + (1 - f / Math.max(n.length, h.length));
|
|
103
|
+
p = Math.max(p ?? 0, y);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return p;
|
|
108
|
+
}
|
|
109
|
+
function A(c, e) {
|
|
110
|
+
if (c === e)
|
|
111
|
+
return 0;
|
|
112
|
+
if (!c)
|
|
113
|
+
return e.length;
|
|
114
|
+
if (!e)
|
|
115
|
+
return c.length;
|
|
116
|
+
const t = new Array(e.length + 1).fill(0);
|
|
117
|
+
let i = Array.from({ length: e.length + 1 }, (a, s) => s);
|
|
118
|
+
for (let a = 1; a <= c.length; a++) {
|
|
119
|
+
t[0] = a;
|
|
120
|
+
for (let s = 1; s <= e.length; s++)
|
|
121
|
+
t[s] = c[a - 1] === e[s - 1] ? i[s - 1] : 1 + Math.min(t[s - 1], i[s], i[s - 1]);
|
|
122
|
+
i = [...t];
|
|
123
|
+
}
|
|
124
|
+
return t[e.length];
|
|
125
|
+
}
|
|
126
|
+
const T = {
|
|
127
|
+
feature: "feature-layer",
|
|
128
|
+
group: "layers",
|
|
129
|
+
"subtype-group": "subtype",
|
|
130
|
+
"knowledge-graph": "knowledge-layer",
|
|
131
|
+
"link-chart": "knowledge-graph",
|
|
132
|
+
graphics: "layer-graphics"
|
|
133
|
+
}, B = {
|
|
134
|
+
point: "point",
|
|
135
|
+
multipoint: "layer-multipoint",
|
|
136
|
+
line: "line",
|
|
137
|
+
polyline: "line",
|
|
138
|
+
polygon: "polygon"
|
|
139
|
+
}, M = {
|
|
140
|
+
oid: "key",
|
|
141
|
+
guid: "key",
|
|
142
|
+
"global-id": "key",
|
|
143
|
+
blob: "binary",
|
|
144
|
+
integer: "integer",
|
|
145
|
+
"small-integer": "integer",
|
|
146
|
+
"big-integer": "integer",
|
|
147
|
+
single: "number",
|
|
148
|
+
double: "number",
|
|
149
|
+
long: "number",
|
|
150
|
+
number: "number",
|
|
151
|
+
date: "date-time",
|
|
152
|
+
"date-only": "calendar",
|
|
153
|
+
"time-only": "clock",
|
|
154
|
+
"timestamp-offset": "time-zone",
|
|
155
|
+
string: "string"
|
|
156
|
+
};
|
|
157
|
+
class E extends R {
|
|
158
|
+
constructor() {
|
|
159
|
+
super(...arguments), this.messages = L({ blocking: !0 }), this.#t = /* @__PURE__ */ new Map(), this.fieldMappings = [], this.isMatchingFields = !1, this.replacementCandidates = [], this.mode = "layer-and-fields", this.showFieldAliases = !1, this.allowDuplicateReplacementFields = !1, this.arcgisChange = C();
|
|
160
|
+
}
|
|
161
|
+
static {
|
|
162
|
+
this.properties = { fieldMappings: 16, isMatchingFields: 16, mapping: 32, source: 0, replacement: 0, replacementCandidates: 0, mode: 1, sourceFieldFilter: 0, additionalSourceFields: 0, replacementFieldFilter: 0, fieldMatcher: 0, showFieldAliases: 5, getFieldDisplayInfo: 0, getLayerDisplayInfo: 0, allowDuplicateReplacementFields: 5, messageOverrides: 0 };
|
|
163
|
+
}
|
|
164
|
+
static {
|
|
165
|
+
this.styles = S;
|
|
166
|
+
}
|
|
167
|
+
#e;
|
|
168
|
+
#n;
|
|
169
|
+
#t;
|
|
170
|
+
get mapping() {
|
|
171
|
+
return this.source ? { source: this.source, replacement: this.replacement, fieldMappings: this.fieldMappings } : void 0;
|
|
172
|
+
}
|
|
173
|
+
async matchFields() {
|
|
174
|
+
this.replacement && await this.#o(!0);
|
|
175
|
+
}
|
|
176
|
+
willUpdate(e) {
|
|
177
|
+
let t = this.replacement;
|
|
178
|
+
const i = e.has("source");
|
|
179
|
+
let a = e.has("replacement") || !this.hasUpdated && !!t;
|
|
180
|
+
const s = e.has("sourceFieldFilter"), l = e.has("additionalSourceFields"), r = e.has("replacementFieldFilter"), o = e.has("fieldMatcher"), p = e.has("allowDuplicateReplacementFields"), n = e.has("fieldMappings"), m = this.mode === "layer-and-fields" && t && !this.replacementCandidates.includes(t) ? void 0 : t;
|
|
181
|
+
m !== t && (t = m, a = !0, this.replacement = m);
|
|
182
|
+
const h = i || a || s || l || r;
|
|
183
|
+
if (h && this.#i(), h || o || p) {
|
|
184
|
+
const f = h || o;
|
|
185
|
+
this.#o(f).catch((y) => {
|
|
186
|
+
x(y) || I("error", this, "Field matching failed.", { detail: { error: y } });
|
|
187
|
+
});
|
|
188
|
+
} else n && this.#a(this.fieldMappings, t);
|
|
189
|
+
}
|
|
190
|
+
disconnectedCallback() {
|
|
191
|
+
this.#i(), super.disconnectedCallback();
|
|
192
|
+
}
|
|
193
|
+
#s(e) {
|
|
194
|
+
return !!e && "fields" in e;
|
|
195
|
+
}
|
|
196
|
+
#c(e) {
|
|
197
|
+
if (!this.#s(e))
|
|
198
|
+
return [];
|
|
199
|
+
const t = e.fields;
|
|
200
|
+
return t ? Array.from(t) : [];
|
|
201
|
+
}
|
|
202
|
+
#v(e, t) {
|
|
203
|
+
const i = this.#c(e);
|
|
204
|
+
return this.additionalSourceFields?.forEach((a) => {
|
|
205
|
+
i.some((l) => g(l) === g(a)) || i.push(a);
|
|
206
|
+
}), e && this.#s(e) ? i.filter((a) => !t || t(a, e)) : [];
|
|
207
|
+
}
|
|
208
|
+
async #o(e) {
|
|
209
|
+
const t = this.replacement;
|
|
210
|
+
this.#i();
|
|
211
|
+
const i = this.#v(this.source, this.sourceFieldFilter);
|
|
212
|
+
this.#t = new Map(i.map((r) => [
|
|
213
|
+
r,
|
|
214
|
+
this.#d(t, r, this.replacementFieldFilter)
|
|
215
|
+
]));
|
|
216
|
+
let a = F(i.map((r) => ({ source: r })), {
|
|
217
|
+
allowDuplicateReplacementFields: this.allowDuplicateReplacementFields,
|
|
218
|
+
replacementFieldsBySource: this.#t
|
|
219
|
+
}, this.fieldMappings);
|
|
220
|
+
if (!e || !this.source || !t) {
|
|
221
|
+
this.#l(a), this.#a(a, t);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
a = a.map(({ source: r }) => ({ source: r })), this.#l(a), this.#a(a, t);
|
|
225
|
+
const s = this.source, l = new AbortController();
|
|
226
|
+
this.#e = l, this.isMatchingFields = !0;
|
|
227
|
+
try {
|
|
228
|
+
const r = await this.#F(a, i, t, l.signal);
|
|
229
|
+
if (l.signal.aborted || this.#e !== l || this.source !== s || this.replacement !== t)
|
|
230
|
+
return;
|
|
231
|
+
this.#l(r), this.#a(r, t);
|
|
232
|
+
} finally {
|
|
233
|
+
this.#e === l && (this.#e = void 0, this.isMatchingFields = !1);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
#d(e, t, i) {
|
|
237
|
+
return !e || !this.#s(e) ? [] : this.#c(e).filter((s) => !i || i(s, e, t));
|
|
238
|
+
}
|
|
239
|
+
#p(e, t = this.replacement) {
|
|
240
|
+
if (t === this.replacement) {
|
|
241
|
+
const i = this.#t.get(e);
|
|
242
|
+
if (i)
|
|
243
|
+
return i;
|
|
244
|
+
}
|
|
245
|
+
return this.#d(t, e, this.replacementFieldFilter);
|
|
246
|
+
}
|
|
247
|
+
#m(e, t) {
|
|
248
|
+
return new Map(e.map((i) => [i, this.#p(i, t)]));
|
|
249
|
+
}
|
|
250
|
+
async #F(e, t, i, a) {
|
|
251
|
+
const s = this.source;
|
|
252
|
+
if (!s)
|
|
253
|
+
return [];
|
|
254
|
+
const l = this.#m(t, i);
|
|
255
|
+
if (!this.fieldMatcher)
|
|
256
|
+
return F(e, {
|
|
257
|
+
allowDuplicateReplacementFields: this.allowDuplicateReplacementFields,
|
|
258
|
+
replacementFieldsBySource: l
|
|
259
|
+
}, k({ fieldMappings: e, replacementFieldsBySource: l }, { allowDuplicateReplacementFields: this.allowDuplicateReplacementFields }));
|
|
260
|
+
const r = t.map((n) => ({
|
|
261
|
+
replacementFields: l.get(n) ?? [],
|
|
262
|
+
sourceField: n
|
|
263
|
+
})), o = {
|
|
264
|
+
allowDuplicateReplacementFields: this.allowDuplicateReplacementFields ?? !1,
|
|
265
|
+
fieldCandidates: r,
|
|
266
|
+
source: s,
|
|
267
|
+
replacement: i
|
|
268
|
+
}, p = await this.fieldMatcher(o, a);
|
|
269
|
+
return a.throwIfAborted(), z(e, t, {
|
|
270
|
+
allowDuplicateReplacementFields: this.allowDuplicateReplacementFields,
|
|
271
|
+
replacementFieldsBySource: l
|
|
272
|
+
}, p);
|
|
273
|
+
}
|
|
274
|
+
#i() {
|
|
275
|
+
this.#e?.abort(), this.#e = void 0, this.isMatchingFields = !1;
|
|
276
|
+
}
|
|
277
|
+
#h(e, t) {
|
|
278
|
+
return e.length === t.length && e.every((i, a) => i.source === t[a].source && i.replacement === t[a].replacement);
|
|
279
|
+
}
|
|
280
|
+
#b(e, t) {
|
|
281
|
+
return e === t ? !0 : !e || !t ? !1 : e.source === t.source && e.replacement === t.replacement && this.#h(e.fieldMappings, t.fieldMappings);
|
|
282
|
+
}
|
|
283
|
+
#l(e) {
|
|
284
|
+
this.#h(this.fieldMappings, e) || (this.fieldMappings = e);
|
|
285
|
+
}
|
|
286
|
+
#a(e, t = this.replacement) {
|
|
287
|
+
const i = this.source ? { source: this.source, replacement: t, fieldMappings: e } : void 0;
|
|
288
|
+
this.#b(this.#n, i) || (this.#n = i, this.arcgisChange.emit(i ?? null));
|
|
289
|
+
}
|
|
290
|
+
#w(e, t) {
|
|
291
|
+
this.#i();
|
|
292
|
+
const i = this.fieldMappings.map((a) => a.source === e ? { ...a, replacement: t } : a);
|
|
293
|
+
this.fieldMappings = F(this.fieldMappings, {
|
|
294
|
+
allowDuplicateReplacementFields: this.allowDuplicateReplacementFields,
|
|
295
|
+
preferredSource: e,
|
|
296
|
+
replacementFieldsBySource: this.#m(this.fieldMappings.map(({ source: a }) => a), this.replacement)
|
|
297
|
+
}, i);
|
|
298
|
+
}
|
|
299
|
+
#u(e) {
|
|
300
|
+
return e.title || e.id;
|
|
301
|
+
}
|
|
302
|
+
#g(e) {
|
|
303
|
+
const t = this.getLayerDisplayInfo?.(e)?.icon;
|
|
304
|
+
if (t === null)
|
|
305
|
+
return;
|
|
306
|
+
if (t)
|
|
307
|
+
return t;
|
|
308
|
+
if ("isTable" in e && e.isTable)
|
|
309
|
+
return "table";
|
|
310
|
+
const i = T[e.type];
|
|
311
|
+
if (i)
|
|
312
|
+
return i;
|
|
313
|
+
const a = "geometryType" in e ? e.geometryType : void 0;
|
|
314
|
+
return typeof a == "string" && B[a] || "layer";
|
|
315
|
+
}
|
|
316
|
+
#f(e) {
|
|
317
|
+
return this.showFieldAliases ? e.alias : void 0;
|
|
318
|
+
}
|
|
319
|
+
#r(e, t) {
|
|
320
|
+
const i = this.getFieldDisplayInfo?.(e, t), a = i?.icon === null ? void 0 : i?.icon ?? M[e.type], s = this.#f(e);
|
|
321
|
+
return d`<div class="field-name">${a && d`<calcite-icon .icon=${a} scale=s></calcite-icon>` || ""}<div class="field-label"><span>${e.name}</span>${s && d`<span class="field-alias">${s}</span>` || ""}</div></div>`;
|
|
322
|
+
}
|
|
323
|
+
#y(e, t, i, a) {
|
|
324
|
+
const s = a?.icon === null ? void 0 : a?.icon ?? M[e.type], l = this.#f(e), r = e.name;
|
|
325
|
+
return v(e.name, d`<calcite-combobox-item .value=${e.name} .icon=${s} .heading=${r} .description=${l ?? void 0} .label=${r} .selected=${i} @calciteComboboxItemChange=${() => this.#w(t, e)}></calcite-combobox-item>`);
|
|
326
|
+
}
|
|
327
|
+
#M(e, t, i, a) {
|
|
328
|
+
const s = e.map((n) => ({
|
|
329
|
+
field: n,
|
|
330
|
+
displayInfo: this.getFieldDisplayInfo?.(n, t)
|
|
331
|
+
}));
|
|
332
|
+
if (!s.some(({ displayInfo: n }) => !!n?.groupName))
|
|
333
|
+
return s.map(({ field: n, displayInfo: m }) => this.#y(n, i, n === a, m));
|
|
334
|
+
const r = this.messages.fields, o = /* @__PURE__ */ new Map();
|
|
335
|
+
for (const n of s) {
|
|
336
|
+
const m = n.displayInfo?.groupName || r, h = o.get(m);
|
|
337
|
+
h ? h.push(n) : o.set(m, [n]);
|
|
338
|
+
}
|
|
339
|
+
const p = [
|
|
340
|
+
...o.has(r) ? [r] : [],
|
|
341
|
+
...Array.from(o.keys()).filter((n) => n !== r)
|
|
342
|
+
];
|
|
343
|
+
return b(p, (n) => n, (n) => d`<calcite-combobox-item-group .label=${n}>${o.get(n).map(({ field: m, displayInfo: h }) => this.#y(m, i, m === a, h))}</calcite-combobox-item-group>`);
|
|
344
|
+
}
|
|
345
|
+
#$() {
|
|
346
|
+
const e = this.replacement ? void 0 : "invalid";
|
|
347
|
+
return this.replacementCandidates.length === 0 ? d`<calcite-notice open kind=info scale=s><div slot=message>${this.messages.noReplacementLayers}</div></calcite-notice>` : d`<calcite-combobox .label=${this.messages.replacementLayer} selection-mode=single-persist .placeholder=${this.messages.selectLayer} .status=${e} overlay-positioning=fixed max-items=8>${b(this.replacementCandidates, (t) => t.id, (t) => {
|
|
348
|
+
const i = this.#u(t);
|
|
349
|
+
return d`<calcite-combobox-item .value=${t.id} .icon=${this.#g(t)} .heading=${i} .label=${i} .selected=${this.replacement === t} @calciteComboboxItemChange=${() => this.replacement = t}></calcite-combobox-item>`;
|
|
350
|
+
})}</calcite-combobox>`;
|
|
351
|
+
}
|
|
352
|
+
#x(e) {
|
|
353
|
+
const t = this.source;
|
|
354
|
+
if (!t)
|
|
355
|
+
return;
|
|
356
|
+
const i = e.source.name;
|
|
357
|
+
if (!this.replacement)
|
|
358
|
+
return v(e.source.name, d`<div class="field-row" role=group .ariaLabel=${u(this.messages.fieldMappingFor, { field: i })}><div class="field-source">${this.#r(e.source, t)}</div><div class="field-target"><calcite-combobox .label=${u(this.messages.replacementFieldFor, { field: i })} disabled .placeholder=${this.messages.selectLayerFirst}></calcite-combobox></div></div>`);
|
|
359
|
+
const a = this.replacement, s = this.#p(e.source), l = e.replacement ? void 0 : "invalid";
|
|
360
|
+
return s.length === 0 ? v(e.source.name, d`<div class="field-row" role=group .ariaLabel=${u(this.messages.fieldMappingFor, { field: i })}><div class="field-source">${this.#r(e.source, t)}</div><div class="field-target"><calcite-notice open kind=info scale=s><div slot=message>${this.messages.noReplacementFields}</div></calcite-notice></div></div>`) : v(e.source.name, d`<div class="field-row" role=group .ariaLabel=${u(this.messages.fieldMappingFor, { field: i })}><div class="field-source">${this.#r(e.source, t)}</div><div class="field-target"><calcite-combobox .label=${u(this.messages.replacementFieldFor, { field: i })} selection-mode=single-persist .placeholder=${this.messages.selectField} .status=${l} overlay-positioning=fixed max-items=8>${this.#M(s, a, e.source, e.replacement)}</calcite-combobox></div></div>`);
|
|
361
|
+
}
|
|
362
|
+
render() {
|
|
363
|
+
const e = this.source;
|
|
364
|
+
if (!e)
|
|
365
|
+
return d`<calcite-notice open kind=info><div slot=message>${this.messages.selectSourceLayer}</div></calcite-notice>`;
|
|
366
|
+
const t = this.#t.size > 0;
|
|
367
|
+
if (this.mode === "fields-only" && !this.replacement)
|
|
368
|
+
return d`<calcite-notice open kind=info><div slot=message>${this.messages.selectReplacementLayer}</div></calcite-notice>`;
|
|
369
|
+
const i = this.#u(e), a = this.mode === "layer-and-fields" ? this.#g(e) : void 0;
|
|
370
|
+
return d`<div class="layer-replace">${this.mode === "layer-and-fields" && d`<div class="layer-row" role=group .ariaLabel=${this.messages.layerReplacement}><div class="layer-cell" role=group .ariaLabel=${u(this.messages.sourceLayer, { layer: i })}><div class="layer-name">${a && d`<calcite-icon .icon=${a} scale=s></calcite-icon>` || ""}<span>${i}</span></div></div><div class="layer-cell">${this.#$()}</div></div>` || ""}<slot></slot>${t && d`<calcite-block expandable expanded .heading=${u(this.messages.fieldsCount, { count: this.fieldMappings.length })} .loading=${this.isMatchingFields}><div class="field-list">${this.fieldMappings.map((s) => this.#x(s))}</div></calcite-block>` || ""}</div>`;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
$("arcgis-layer-replace", E);
|
|
374
|
+
export {
|
|
375
|
+
E as ArcgisLayerReplace
|
|
376
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "@esri/calcite-components/components/calcite-icon";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-combobox-item";
|
|
3
|
+
import "@esri/calcite-components/components/calcite-combobox-item-group";
|
|
4
|
+
import "@esri/calcite-components/components/calcite-notice";
|
|
5
|
+
import "@esri/calcite-components/components/calcite-combobox";
|
|
6
|
+
import "@esri/calcite-components/components/calcite-block";
|
|
7
|
+
export * from "./customElement.js";
|