@esri/solutions-components 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/cjs/{calcite-action-menu_2.cjs.entry.js → calcite-action-menu_3.cjs.entry.js} +114 -7
- package/dist/cjs/calcite-alert_4.cjs.entry.js +46 -5
- package/dist/cjs/{calcite-input-date-picker_3.cjs.entry.js → calcite-block_5.cjs.entry.js} +691 -13
- package/dist/cjs/{calcite-combobox_5.cjs.entry.js → calcite-combobox_3.cjs.entry.js} +876 -844
- package/dist/cjs/calcite-dropdown_4.cjs.entry.js +1023 -0
- package/dist/cjs/{calcite-flow_5.cjs.entry.js → calcite-flow_6.cjs.entry.js} +327 -2
- package/dist/cjs/card-manager_3.cjs.entry.js +5 -5
- package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +122 -21
- package/dist/cjs/{downloadUtils-8b05d7cc.js → downloadUtils-dc349b1a.js} +2 -2
- package/dist/cjs/{index.es-e7587227.js → index.es-1830a1e6.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +8 -8
- package/dist/cjs/{mapViewUtils-3e0fa457.js → mapViewUtils-9dc05308.js} +11 -5
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/create-feature/create-feature.js +18 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +16 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +155 -35
- package/dist/collection/components/feature-details/feature-details.css +18 -0
- package/dist/collection/components/feature-details/feature-details.js +500 -0
- package/dist/collection/components/feature-details/test/feature-details.e2e.js +14 -0
- package/dist/collection/components/feature-details/test/feature-details.spec.js +22 -0
- package/dist/collection/components/feature-list/feature-list.js +14 -1
- package/dist/collection/components/info-card/info-card.css +15 -5
- package/dist/collection/components/info-card/info-card.js +178 -5
- package/dist/collection/components/layer-table/layer-table.js +2 -2
- package/dist/collection/components/map-card/map-card.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/demos/crowdsource-reporter.html +115 -1
- package/dist/collection/utils/mapViewUtils.js +11 -5
- package/dist/collection/utils/mapViewUtils.ts +13 -5
- package/dist/components/create-feature2.js +4 -0
- package/dist/components/crowdsource-reporter.js +270 -81
- package/dist/components/feature-details.d.ts +11 -0
- package/dist/components/feature-details.js +11 -0
- package/dist/components/feature-details2.js +449 -0
- package/dist/components/feature-list2.js +14 -1
- package/dist/components/info-card2.js +53 -5
- package/dist/components/layer-table2.js +2 -2
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-select-tools2.js +5 -5
- package/dist/components/mapViewUtils.js +11 -5
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/{calcite-action-menu_2.entry.js → calcite-action-menu_3.entry.js} +118 -12
- package/dist/esm/calcite-alert_4.entry.js +46 -5
- package/dist/esm/{calcite-input-date-picker_3.entry.js → calcite-block_5.entry.js} +688 -12
- package/dist/esm/{calcite-combobox_5.entry.js → calcite-combobox_3.entry.js} +878 -844
- package/dist/esm/calcite-date-picker-day_3.entry.js +1 -1
- package/dist/esm/calcite-dropdown_4.entry.js +1016 -0
- package/dist/esm/{calcite-flow_5.entry.js → calcite-flow_6.entry.js} +327 -3
- package/dist/esm/card-manager_3.entry.js +5 -5
- package/dist/esm/crowdsource-manager.entry.js +1 -1
- package/dist/esm/crowdsource-reporter.entry.js +122 -21
- package/dist/esm/{date-5630530d.js → date-0c026a8b.js} +1 -1
- package/dist/esm/{downloadUtils-0c1e4d7b.js → downloadUtils-df4f21f6.js} +2 -2
- package/dist/esm/{index.es-286e3cfa.js → index.es-904fb846.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +8 -8
- package/dist/esm/{mapViewUtils-253178f1.js → mapViewUtils-2ec19fb0.js} +11 -5
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +115 -1
- package/dist/solutions-components/{p-813fd8a4.entry.js → p-29f518fd.entry.js} +2 -2
- package/dist/solutions-components/{p-13ca3b00.entry.js → p-452fd697.entry.js} +1 -1
- package/dist/solutions-components/p-511b1c91.entry.js +23 -0
- package/dist/solutions-components/p-577efb16.js +36 -0
- package/dist/solutions-components/{p-94de9279.js → p-5817d78c.js} +1 -1
- package/dist/solutions-components/p-602cd811.entry.js +17 -0
- package/dist/solutions-components/{p-15f9624a.entry.js → p-6557b703.entry.js} +1 -1
- package/dist/solutions-components/p-7269c49b.entry.js +6 -0
- package/dist/solutions-components/p-760bd17e.entry.js +6 -0
- package/dist/solutions-components/p-95fea07a.entry.js +17 -0
- package/dist/solutions-components/{p-212b02e7.js → p-ae4d86e8.js} +1 -1
- package/dist/solutions-components/{p-038fcd93.entry.js → p-c273ab7a.entry.js} +1 -1
- package/dist/solutions-components/p-d742b915.entry.js +29 -0
- package/dist/solutions-components/p-dfad61a8.entry.js +24 -0
- package/dist/solutions-components/{p-331b5d1e.js → p-fca434c8.js} +2 -2
- package/dist/solutions-components/p-fd82a00f.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +13 -5
- package/dist/types/components/create-feature/create-feature.d.ts +4 -4
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +91 -10
- package/dist/types/components/feature-details/feature-details.d.ts +151 -0
- package/dist/types/components/feature-list/feature-list.d.ts +6 -0
- package/dist/types/components/info-card/info-card.d.ts +33 -1
- package/dist/types/components.d.ts +129 -12
- package/dist/types/preact.d.ts +6 -1
- package/dist/types/utils/mapViewUtils.d.ts +5 -3
- package/package.json +1 -1
- package/dist/cjs/calcite-block_2.cjs.entry.js +0 -652
- package/dist/cjs/calcite-graph_2.cjs.entry.js +0 -1055
- package/dist/cjs/calcite-scrim.cjs.entry.js +0 -125
- package/dist/cjs/utils-7bc7f595.js +0 -64
- package/dist/esm/calcite-block_2.entry.js +0 -647
- package/dist/esm/calcite-graph_2.entry.js +0 -1050
- package/dist/esm/calcite-scrim.entry.js +0 -121
- package/dist/esm/utils-9fb4104a.js +0 -61
- package/dist/solutions-components/p-04c37d69.entry.js +0 -17
- package/dist/solutions-components/p-0b92e4b1.entry.js +0 -11
- package/dist/solutions-components/p-238d3b5f.entry.js +0 -6
- package/dist/solutions-components/p-3af79063.js +0 -36
- package/dist/solutions-components/p-80b11ec1.entry.js +0 -17
- package/dist/solutions-components/p-a3a11749.entry.js +0 -6
- package/dist/solutions-components/p-aec06ce4.entry.js +0 -18
- package/dist/solutions-components/p-bfdf89c2.js +0 -11
- package/dist/solutions-components/p-c4ff3b52.entry.js +0 -17
- package/dist/solutions-components/p-ced067bd.entry.js +0 -17
- package/dist/solutions-components/p-d136eab0.entry.js +0 -23
- package/dist/solutions-components/p-e0446d5b.entry.js +0 -6
@@ -1,121 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import { r as registerInstance, h, g as getElement } from './index-164d485a.js';
|
7
|
-
import { c as connectLocalized, d as disconnectLocalized } from './locale-904407bf.js';
|
8
|
-
import { u as updateMessages, c as connectMessages, s as setUpMessages, d as disconnectMessages } from './t9n-436fb2b1.js';
|
9
|
-
import { c as createObserver } from './observers-d04d1da9.js';
|
10
|
-
import { D as slotChangeHasContent } from './dom-38c6f027.js';
|
11
|
-
import './key-c83d835f.js';
|
12
|
-
import './guid-b75a5f7b.js';
|
13
|
-
import './resources-8834f920.js';
|
14
|
-
|
15
|
-
/*!
|
16
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
17
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
18
|
-
* v2.4.0
|
19
|
-
*/
|
20
|
-
const CSS = {
|
21
|
-
scrim: "scrim",
|
22
|
-
content: "content",
|
23
|
-
};
|
24
|
-
const BREAKPOINTS = {
|
25
|
-
s: 72,
|
26
|
-
// medium is assumed default.
|
27
|
-
l: 480, // Greater than or equal to 480px.
|
28
|
-
};
|
29
|
-
|
30
|
-
const scrimCss = ":host{--calcite-scrim-background:var(--calcite-color-transparent-scrim);position:absolute;inset:0px;z-index:var(--calcite-z-index-overlay);display:flex;block-size:100%;inline-size:100%;flex-direction:column;align-items:stretch}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}.scrim{position:absolute;inset:0px;display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background, var(--calcite-color-transparent-scrim))}.content{padding:1rem}:host([hidden]){display:none}[hidden]{display:none}";
|
31
|
-
|
32
|
-
const Scrim = class {
|
33
|
-
constructor(hostRef) {
|
34
|
-
registerInstance(this, hostRef);
|
35
|
-
this.resizeObserver = createObserver("resize", () => this.handleResize());
|
36
|
-
// --------------------------------------------------------------------------
|
37
|
-
//
|
38
|
-
// Private Methods
|
39
|
-
//
|
40
|
-
// --------------------------------------------------------------------------
|
41
|
-
this.handleDefaultSlotChange = (event) => {
|
42
|
-
this.hasContent = slotChangeHasContent(event);
|
43
|
-
};
|
44
|
-
this.storeLoaderEl = (el) => {
|
45
|
-
this.loaderEl = el;
|
46
|
-
this.handleResize();
|
47
|
-
};
|
48
|
-
this.loading = false;
|
49
|
-
this.messages = undefined;
|
50
|
-
this.messageOverrides = undefined;
|
51
|
-
this.loaderScale = undefined;
|
52
|
-
this.defaultMessages = undefined;
|
53
|
-
this.effectiveLocale = "";
|
54
|
-
this.hasContent = false;
|
55
|
-
}
|
56
|
-
onMessagesChange() {
|
57
|
-
/* wired up by t9n util */
|
58
|
-
}
|
59
|
-
effectiveLocaleChange() {
|
60
|
-
updateMessages(this, this.effectiveLocale);
|
61
|
-
}
|
62
|
-
//--------------------------------------------------------------------------
|
63
|
-
//
|
64
|
-
// Lifecycle
|
65
|
-
//
|
66
|
-
//--------------------------------------------------------------------------
|
67
|
-
connectedCallback() {
|
68
|
-
var _a;
|
69
|
-
connectLocalized(this);
|
70
|
-
connectMessages(this);
|
71
|
-
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
|
72
|
-
}
|
73
|
-
async componentWillLoad() {
|
74
|
-
await setUpMessages(this);
|
75
|
-
}
|
76
|
-
disconnectedCallback() {
|
77
|
-
var _a;
|
78
|
-
disconnectLocalized(this);
|
79
|
-
disconnectMessages(this);
|
80
|
-
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
81
|
-
}
|
82
|
-
// --------------------------------------------------------------------------
|
83
|
-
//
|
84
|
-
// Render Method
|
85
|
-
//
|
86
|
-
// --------------------------------------------------------------------------
|
87
|
-
render() {
|
88
|
-
const { hasContent, loading, messages } = this;
|
89
|
-
return (h("div", { class: CSS.scrim }, loading ? (h("calcite-loader", { label: messages.loading, scale: this.loaderScale,
|
90
|
-
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
|
91
|
-
ref: this.storeLoaderEl })) : null, h("div", { class: CSS.content, hidden: !hasContent }, h("slot", { onSlotchange: this.handleDefaultSlotChange }))));
|
92
|
-
}
|
93
|
-
getScale(size) {
|
94
|
-
if (size < BREAKPOINTS.s) {
|
95
|
-
return "s";
|
96
|
-
}
|
97
|
-
else if (size >= BREAKPOINTS.l) {
|
98
|
-
return "l";
|
99
|
-
}
|
100
|
-
else {
|
101
|
-
return "m";
|
102
|
-
}
|
103
|
-
}
|
104
|
-
handleResize() {
|
105
|
-
var _a;
|
106
|
-
const { loaderEl, el } = this;
|
107
|
-
if (!loaderEl) {
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
this.loaderScale = this.getScale((_a = Math.min(el.clientHeight, el.clientWidth)) !== null && _a !== void 0 ? _a : 0);
|
111
|
-
}
|
112
|
-
static get assetsDirs() { return ["assets"]; }
|
113
|
-
get el() { return getElement(this); }
|
114
|
-
static get watchers() { return {
|
115
|
-
"messageOverrides": ["onMessagesChange"],
|
116
|
-
"effectiveLocale": ["effectiveLocaleChange"]
|
117
|
-
}; }
|
118
|
-
};
|
119
|
-
Scrim.style = scrimCss;
|
120
|
-
|
121
|
-
export { Scrim as calcite_scrim };
|
@@ -1,61 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import { a as getAssetPath } from './index-164d485a.js';
|
7
|
-
import { e as dateFromISO } from './date-5630530d.js';
|
8
|
-
import { g as getSupportedLocale } from './locale-904407bf.js';
|
9
|
-
|
10
|
-
/*!
|
11
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
12
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
13
|
-
* v2.4.0
|
14
|
-
*/
|
15
|
-
/**
|
16
|
-
* CLDR cache.
|
17
|
-
* Exported for testing purposes.
|
18
|
-
*
|
19
|
-
* @private
|
20
|
-
*/
|
21
|
-
const translationCache = {};
|
22
|
-
/**
|
23
|
-
* CLDR request cache.
|
24
|
-
* Exported for testing purposes.
|
25
|
-
*
|
26
|
-
* @private
|
27
|
-
*/
|
28
|
-
const requestCache = {};
|
29
|
-
/**
|
30
|
-
* Fetch calendar data for a given locale from list of supported languages
|
31
|
-
*
|
32
|
-
* @param lang
|
33
|
-
* @public
|
34
|
-
*/
|
35
|
-
async function getLocaleData(lang) {
|
36
|
-
const locale = getSupportedLocale(lang);
|
37
|
-
if (translationCache[locale]) {
|
38
|
-
return translationCache[locale];
|
39
|
-
}
|
40
|
-
if (!requestCache[locale]) {
|
41
|
-
requestCache[locale] = fetch(getAssetPath(`./assets/date-picker/nls/${locale}.json`))
|
42
|
-
.then((resp) => resp.json())
|
43
|
-
.catch(() => {
|
44
|
-
console.error(`Translations for "${locale}" not found or invalid, falling back to english`);
|
45
|
-
return getLocaleData("en");
|
46
|
-
});
|
47
|
-
}
|
48
|
-
const data = await requestCache[locale];
|
49
|
-
translationCache[locale] = data;
|
50
|
-
return data;
|
51
|
-
}
|
52
|
-
/**
|
53
|
-
* Maps value to valueAsDate
|
54
|
-
*
|
55
|
-
* @param value
|
56
|
-
*/
|
57
|
-
function getValueAsDateRange(value) {
|
58
|
-
return value.map((v, index) => dateFromISO(v, index === 1));
|
59
|
-
}
|
60
|
-
|
61
|
-
export { getLocaleData as a, getValueAsDateRange as g };
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,h as i,g as e,f as a,c as s,H as l}from"./p-7d280d8a.js";import{g as h}from"./p-5a9a971a.js";import{c as n}from"./p-1f65ab1e.js";import{i as r,r as o}from"./p-3dd92f0d.js";import{c,d,a as m,H as u}from"./p-1f33a29d.js";import{c as b,d as p,u as g,I as f}from"./p-6d520a58.js";import{i as v}from"./p-e7afc0a8.js";import{c as x,d as k,g as _}from"./p-9d53e0f2.js";import{s as $,a as y,c as w}from"./p-a4149333.js";import{n as M,c as z,d as V}from"./p-13f2d901.js";import{d as L,c as H}from"./p-f0c7d964.js";import"./p-7c2be8cc.js";import"./p-ba7d55ea.js";import"./p-495e7b9d.js";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.4.0
|
11
|
-
*/function j(t,i,e){const a=i[0]-t[0];return a?(3*(i[1]-t[1])/a-e)/2:e}function X(t,i,e,a,s){const[l,h]=t,[n,r]=i,o=(n-l)/3;return`C ${s([l+o,h+o*e]).join(",")} ${s([n-o,r-o*a]).join(",")} ${s([n,r]).join(",")}`}const T=class{constructor(i){t(this,i),this.graphId=`calcite-graph-${h()}`,this.resizeObserver=n("resize",(()=>a(this))),this.data=[],this.colorStops=void 0,this.highlightMin=void 0,this.highlightMax=void 0,this.min=void 0,this.max=void 0}connectedCallback(){var t;null===(t=this.resizeObserver)||void 0===t||t.observe(this.el)}disconnectedCallback(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}render(){const{data:t,colorStops:e,el:a,highlightMax:s,highlightMin:l,min:h,max:n}=this,r=this.graphId,{clientHeight:o,clientWidth:c}=a;if(!t||0===t.length)return i("svg",{"aria-hidden":"true",class:"svg",height:o,preserveAspectRatio:"none",viewBox:`0 0 ${c} ${o}`,width:c});const{min:d,max:m}=function(t){const[i,e]=t[0];return t.reduce((({min:t,max:i},[e,a])=>({min:[Math.min(t[0],e),Math.min(t[1],a)],max:[Math.max(i[0],e),Math.max(i[1],a)]})),{min:[i,e],max:[i,e]})}(t);let u=d,b=m;(h<d[0]||h>d[0])&&(u=[h,0]),(n>m[0]||n<m[0])&&(b=[n,m[1]]);const p=function({width:t,height:i,min:e,max:a}){const s=a[0]-e[0],l=a[1]-e[1];return a=>[(a[0]-e[0])/s*t,i-a[1]/l*i]}({min:u,max:b,width:c,height:o}),[g]=p([l,b[1]]),[f]=p([s,b[1]]),v=function({data:t,min:i,max:e,t:a}){if(0===t.length)return"";const[s,l]=a(t[0]),[h,n]=a(i),[r]=a(e);let o,c,d;const m=t.reduce(((i,e,s)=>{if(c=t[s-2],d=t[s-1],s>1){const t=function(t,i,e){const a=i[0]-t[0],s=e[0]-i[0],l=(i[1]-t[1])/(a||s<0&&0),h=(e[1]-i[1])/(s||a<0&&0),n=(l*s+h*a)/(a+s);return(Math.sign(l)+Math.sign(h))*Math.min(Math.abs(l),Math.abs(h),.5*Math.abs(n))||0}(c,d,e),s=void 0===o?j(c,d,t):o,l=X(c,d,s,t,a);return o=t,`${i} ${l}`}return i}),`M ${h},${n} L ${h},${l} L ${s},${l}`),u=t[t.length-1];return`${m} ${X(d,u,o,j(d,u,o),a)} L ${r},${n} Z`}({data:t,min:d,max:m,t:p}),x=e?`url(#linear-gradient-${r})`:void 0;return i("svg",{"aria-hidden":"true",class:"svg",height:o,preserveAspectRatio:"none",viewBox:`0 0 ${c} ${o}`,width:c},e?i("defs",null,i("linearGradient",{id:`linear-gradient-${r}`,x1:"0",x2:"1",y1:"0",y2:"0"},e.map((({offset:t,color:e,opacity:a})=>i("stop",{offset:100*t+"%","stop-color":e,"stop-opacity":a}))))):null,void 0!==l?[i("mask",{height:"100%",id:`${r}1`,width:"100%",x:"0%",y:"0%"},i("path",{d:`\n M 0,0\n L ${g-1},0\n L ${g-1},${o}\n L 0,${o}\n Z\n `,fill:"white"})),i("mask",{height:"100%",id:`${r}2`,width:"100%",x:"0%",y:"0%"},i("path",{d:`\n M ${g+1},0\n L ${f-1},0\n L ${f-1},${o}\n L ${g+1}, ${o}\n Z\n `,fill:"white"})),i("mask",{height:"100%",id:`${r}3`,width:"100%",x:"0%",y:"0%"},i("path",{d:`\n M ${f+1},0\n L ${c},0\n L ${c},${o}\n L ${f+1}, ${o}\n Z\n `,fill:"white"})),i("path",{class:"graph-path",d:v,fill:x,mask:`url(#${r}1)`}),i("path",{class:"graph-path--highlight",d:v,fill:x,mask:`url(#${r}2)`}),i("path",{class:"graph-path",d:v,fill:x,mask:`url(#${r}3)`})]:i("path",{class:"graph-path",d:v,fill:x}))}get el(){return e(this)}};T.style=":host{display:block;block-size:100%}.svg{fill:currentColor;stroke:transparent;margin:0px;display:block;block-size:100%;inline-size:100%;padding:0px}.svg .graph-path--highlight{fill:var(--calcite-color-brand);opacity:0.5}:host([hidden]){display:none}[hidden]{display:none}";
|
12
|
-
/*!
|
13
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
|
-
* v2.4.0
|
16
|
-
*/
|
17
|
-
const D="hyphen",C="hyphen--wrap",S="thumb",I="thumb--minValue",A="thumb--value",F="tick__label--max",P="tick__label--min";function R(t){return Array.isArray(t)}const N=class{constructor(i){t(this,i),this.calciteSliderInput=s(this,"calciteSliderInput",6),this.calciteSliderChange=s(this,"calciteSliderChange",6),this.activeProp="value",this.guid=`calcite-slider-${h()}`,this.onThumbBlur=()=>{this.activeProp=null},this.onThumbFocus=t=>{this.activeProp=t.currentTarget.getAttribute("data-value-prop")},this.onThumbPointerDown=t=>{this.pointerDownDragStart(t,t.currentTarget.getAttribute("data-value-prop"))},this.onTrackPointerDown=t=>{this.pointerDownDragStart(t,"minMaxValue")},this.dragUpdate=t=>{if(!this.disabled&&(t.preventDefault(),this.dragProp)){const i=this.translate(t.clientX||t.pageX);if(R(this.value)&&"minMaxValue"===this.dragProp)if(this.minValueDragRange&&this.maxValueDragRange&&this.minMaxValueRange){const t=i-this.minValueDragRange,e=i+this.maxValueDragRange;e<=this.max&&t>=this.min&&e-t===this.minMaxValueRange&&this.setValue({minValue:this.clamp(t,"minValue"),maxValue:this.clamp(e,"maxValue")})}else this.minValueDragRange=i-this.minValue,this.maxValueDragRange=this.maxValue-i,this.minMaxValueRange=this.maxValue-this.minValue;else this.setValue({[this.dragProp]:this.clamp(i,this.dragProp)})}},this.pointerUpDragEnd=t=>{!this.disabled&&r(t)&&this.dragEnd(t)},this.dragEnd=t=>{this.disabled||(this.removeDragListeners(),this.focusActiveHandle(t.clientX),this.lastDragPropValue!=this[this.dragProp]&&this.emitChange(),this.dragProp=null,this.lastDragPropValue=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.minMaxValueRange=null)},this.storeTrackRef=t=>{this.trackEl=t},this.storeThumbRef=t=>{t&&("minValue"===t.getAttribute("data-value-prop")?this.minHandle=t:this.maxHandle=t)},this.formatValue=t=>(M.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator},M.localize(t.toString())),this.disabled=!1,this.form=void 0,this.groupSeparator=!1,this.hasHistogram=!1,this.histogram=void 0,this.histogramStops=void 0,this.labelHandles=!1,this.labelTicks=!1,this.max=100,this.maxLabel=void 0,this.maxValue=void 0,this.min=0,this.minLabel=void 0,this.minValue=void 0,this.mirrored=!1,this.name=void 0,this.numberingSystem=void 0,this.pageStep=void 0,this.precise=!1,this.required=!1,this.snap=!1,this.step=1,this.ticks=void 0,this.value=0,this.scale="m",this.effectiveLocale="",this.minMaxValueRange=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.tickValues=[]}histogramWatcher(t){this.hasHistogram=!!t}ticksWatcher(){this.tickValues=this.generateTickValues()}valueHandler(){this.setMinMaxFromValue()}minMaxValueHandler(){this.setValueFromMinMax()}connectedCallback(){b(this),z(this),this.setMinMaxFromValue(),this.setValueFromMinMax(),x(this),c(this)}disconnectedCallback(){p(this),k(this),d(this),V(this),this.removeDragListeners()}componentWillLoad(){$(this),R(this.value)||(this.value=this.snap?this.getClosestStep(this.value):this.clamp(this.value)),this.ticksWatcher(),this.histogramWatcher(this.histogram),m(this,this.value)}componentDidLoad(){y(this)}componentDidRender(){this.labelHandles&&(this.adjustHostObscuredHandleLabel("value"),R(this.value)&&(this.adjustHostObscuredHandleLabel("minValue"),this.precise&&!this.hasHistogram||this.hyphenateCollidingRangeHandleLabels())),this.hideObscuredBoundingTickLabels(),g(this)}render(){const t=this.el.id||this.guid,e=R(this.value)?this.maxValue:this.value,a=this.minValue||this.min,s=this.shouldUseMinValue(),h=100*this.getUnitInterval(s?this.minValue:a),n=100*this.getUnitInterval(e),r=this.shouldMirror(),o=R(this.value),c=this.buildThumbType("max"),d=this.renderThumb({type:c,thumbPlacement:c.includes("histogram")?"below":"above",maxInterval:n,minInterval:h,mirror:r}),m=this.buildThumbType("min"),b=o&&this.renderThumb({type:m,thumbPlacement:m.includes("histogram")||m.includes("precise")?"below":"above",maxInterval:n,minInterval:h,mirror:r});return i(l,{id:t,onTouchStart:this.handleTouchStart},i(f,{disabled:this.disabled},i("div",{"aria-label":_(this),class:{container:!0,"container--range":o,[`scale--${this.scale}`]:!0}},this.renderGraph(),i("div",{class:"track",ref:this.storeTrackRef},i("div",{class:"track__range",onPointerDown:this.onTrackPointerDown,style:{left:`${r?100-n:h}%`,right:`${r?h:100-n}%`}}),i("div",{class:"ticks"},this.tickValues.map((t=>{const l=100*this.getUnitInterval(t)+"%";let h=t>=a&&t<=e;return s&&(h=t>=this.minValue&&t<=this.maxValue),i("span",{class:{tick:!0,"tick--active":h},style:{left:r?"":l,right:r?l:""}},this.renderTickLabel(t))})))),i("div",{class:"thumb-container"},b,d,i(u,{component:this})))))}renderThumb({type:t,mirror:e,thumbPlacement:a,minInterval:s,maxInterval:l}){const h=t.includes("labeled"),n=t.includes("precise"),r=t.includes("min"),o=R(this.value),c=r?this.minValue:o?this.maxValue:this.value,d=r?"minValue":o?"maxValue":"value",m=r?this.minLabel:o?this.maxLabel:this.minLabel,u=r?this.minValue:c,b=this.formatValue(r?this.minValue:c),p=r?{left:`${e?100-s:s}%`}:{right:`${e?l:100-l}%`},g="handle__label "+(r?"handle__label--minValue":"handle__label--value"),f=[...h?[i("span",{"aria-hidden":"true",class:g},b),i("span",{"aria-hidden":"true",class:`${g} static`},b),i("span",{"aria-hidden":"true",class:`${g} transformed`},b)]:[],i("div",{class:"handle"}),n&&i("div",{class:"handle-extension"})];return"below"===a&&f.reverse(),i("div",{"aria-disabled":this.disabled,"aria-label":m,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":u,class:{[S]:!0,[A]:!r,"thumb--active":"minMaxValue"!==this.lastDragProp&&this.dragProp===d,"thumb--precise":n,[I]:r},"data-value-prop":d,key:t,onBlur:this.onThumbBlur,onFocus:this.onThumbFocus,onPointerDown:this.onThumbPointerDown,role:"slider",style:p,tabIndex:0,ref:this.storeThumbRef},f)}renderGraph(){return this.histogram?i("calcite-graph",{class:"graph",colorStops:this.histogramStops,data:this.histogram,highlightMax:R(this.value)?this.maxValue:this.value,highlightMin:R(this.value)?this.minValue:this.min,max:this.max,min:this.min}):null}renderTickLabel(t){const{hasHistogram:e,labelHandles:a,labelTicks:s,max:l,min:h,precise:n,value:r}=this,o=R(r),c=t===h,d=t===l,m=c||d;return!s||(e||!m&&n&&o)&&(!e||!m&&(n||a))?null:i("span",{class:{tick__label:!0,[P]:c,[F]:d}},this.formatValue(t))}keyDownHandler(t){const i=this.shouldMirror(),{activeProp:e,max:a,min:s,pageStep:l,step:h}=this,n=this[e],{key:r}=t;if(v(r))return void t.preventDefault();let o;if("ArrowUp"===r||"ArrowRight"===r?o=n+h*(i&&"ArrowRight"===r?-1:1):"ArrowDown"===r||"ArrowLeft"===r?o=n-h*(i&&"ArrowLeft"===r?-1:1):"PageUp"===r?l&&(o=n+l):"PageDown"===r?l&&(o=n-l):"Home"===r?o=s:"End"===r&&(o=a),isNaN(o))return;t.preventDefault();const c=Number(o.toFixed(L(h)));this.setValue({[e]:this.clamp(c,e)})}pointerDownHandler(t){if(this.disabled||!r(t))return;const i=t.clientX||t.pageX,e=this.translate(i);let a="value";R(this.value)&&(a=e>=this.minValue&&e<=this.maxValue&&"minMaxValue"===this.lastDragProp?"minMaxValue":Math.abs(this.maxValue-e)<Math.abs(this.minValue-e)||e>this.maxValue?"maxValue":"minValue"),this.lastDragPropValue=this[a],this.dragStart(a),this.el.shadowRoot.querySelector(`.${S}:active`)||this.setValue({[a]:this.clamp(e,a)}),this.focusActiveHandle(i)}handleTouchStart(t){t.preventDefault()}async setFocus(){await w(this);const t=this.minHandle?this.minHandle:this.maxHandle;null==t||t.focus()}buildThumbType(t){const i=[t];return this.labelHandles&&i.push("labeled"),this.precise&&i.push("precise"),this.hasHistogram&&i.push("histogram"),i.join("-")}setValueFromMinMax(){const{minValue:t,maxValue:i}=this;"number"==typeof t&&"number"==typeof i&&(this.value=[t,i])}setMinMaxFromValue(){const{value:t}=this;R(t)&&(this.minValue=t[0],this.maxValue=t[1])}onLabelClick(){this.setFocus()}shouldMirror(){return this.mirrored&&!this.hasHistogram}shouldUseMinValue(){return!!R(this.value)&&(this.hasHistogram&&0===this.maxValue||!this.hasHistogram&&0===this.minValue)}getTickDensity(){const t=(this.max-this.min)/this.ticks/250;return t<1?1:t}generateTickValues(){var t;const i=null!==(t=this.ticks)&&void 0!==t?t:0;if(i<=0)return[];const e=[this.min],a=i*this.getTickDensity();let s=this.min;for(;s<this.max;)s+=a,e.push(Math.min(s,this.max));return e.includes(this.max)||e.push(this.max),e}pointerDownDragStart(t,i){r(t)&&this.dragStart(i)}dragStart(t){this.dragProp=t,this.lastDragProp=this.dragProp,this.activeProp=t,window.addEventListener("pointermove",this.dragUpdate),window.addEventListener("pointerup",this.pointerUpDragEnd),window.addEventListener("pointercancel",this.dragEnd)}focusActiveHandle(t){switch(this.dragProp){case"minValue":this.minHandle.focus();break;case"maxValue":case"value":this.maxHandle.focus();break;case"minMaxValue":this.getClosestHandle(t).focus()}}emitInput(){this.calciteSliderInput.emit()}emitChange(){this.calciteSliderChange.emit()}removeDragListeners(){window.removeEventListener("pointermove",this.dragUpdate),window.removeEventListener("pointerup",this.pointerUpDragEnd),window.removeEventListener("pointercancel",this.dragEnd)}setValue(t){let i;Object.keys(t).forEach((e=>{const a=t[e];i||(i=this[e]!==a),this[e]=a})),i&&(this.dragProp||this.emitChange(),this.emitInput())}clamp(t,i){return t=H(t,this.min,this.max),"maxValue"===i&&(t=Math.max(t,this.minValue)),"minValue"===i&&(t=Math.min(t,this.maxValue)),t}translate(t){const i=this.max-this.min,{left:e,width:a}=this.trackEl.getBoundingClientRect(),s=(t-e)/a,l=this.shouldMirror(),h=this.clamp(this.min+i*(l?1-s:s));let n=Number(h.toFixed(L(this.step)));return this.snap&&this.step&&(n=this.getClosestStep(n)),n}getClosestStep(t){if(t=Number(this.clamp(t).toFixed(L(this.step))),this.step){const i=Math.round(t/this.step)*this.step;t=Number(this.clamp(i).toFixed(L(this.step)))}return t}getClosestHandle(t){return this.getDistanceX(this.maxHandle,t)>this.getDistanceX(this.minHandle,t)?this.minHandle:this.maxHandle}getDistanceX(t,i){return Math.abs(t.getBoundingClientRect().left-i)}getFontSizeForElement(t){return Number(window.getComputedStyle(t).getPropertyValue("font-size").match(/\d+/)[0])}getUnitInterval(t){return((t=this.clamp(t))-this.min)/(this.max-this.min)}adjustHostObscuredHandleLabel(t){const i=this.el.shadowRoot.querySelector(`.handle__label--${t}`),e=this.el.shadowRoot.querySelector(`.handle__label--${t}.static`),a=this.el.shadowRoot.querySelector(`.handle__label--${t}.transformed`),s=e.getBoundingClientRect(),l=this.getHostOffset(s.left,s.right);i.style.transform=`translateX(${l}px)`,a.style.transform=`translateX(${l}px)`}hyphenateCollidingRangeHandleLabels(){const{shadowRoot:t}=this.el,i=this.shouldMirror(),e=i?"value":"minValue",a=i?"minValue":"value",s=t.querySelector(`.handle__label--${e}`),l=t.querySelector(`.handle__label--${e}.static`),h=t.querySelector(`.handle__label--${e}.transformed`),n=this.getHostOffset(l.getBoundingClientRect().left,l.getBoundingClientRect().right),r=t.querySelector(`.handle__label--${a}`),o=t.querySelector(`.handle__label--${a}.static`),c=t.querySelector(`.handle__label--${a}.transformed`),d=this.getHostOffset(o.getBoundingClientRect().left,o.getBoundingClientRect().right),m=this.getFontSizeForElement(s),u=this.getRangeLabelOverlap(h,c),b=s,p=m/2;if(u>0){if(b.classList.add(D,C),0===d&&0===n){let t=u/2-p;t=-1===Math.sign(t)?Math.abs(t):-t;const i=this.getHostOffset(h.getBoundingClientRect().left+t-p,h.getBoundingClientRect().right+t-p);let e=u/2;const a=this.getHostOffset(c.getBoundingClientRect().left+e,c.getBoundingClientRect().right+e);0!==i&&(t+=i,e+=i),0!==a&&(t+=a,e+=a),s.style.transform=`translateX(${t}px)`,h.style.transform=`translateX(${t-p}px)`,r.style.transform=`translateX(${e}px)`,c.style.transform=`translateX(${e}px)`}else if(n>0||d>0)s.style.transform=`translateX(${n+p}px)`,r.style.transform=`translateX(${u+d}px)`,c.style.transform=`translateX(${u+d}px)`;else if(n<0||d<0){let t=Math.abs(n)+u-p;t=-1===Math.sign(t)?Math.abs(t):-t,s.style.transform=`translateX(${t}px)`,h.style.transform=`translateX(${t-p}px)`}}else b.classList.remove(D,C),s.style.transform=`translateX(${n}px)`,h.style.transform=`translateX(${n}px)`,r.style.transform=`translateX(${d}px)`,c.style.transform=`translateX(${d}px)`}hideObscuredBoundingTickLabels(){const t=R(this.value);if(!(this.hasHistogram||t||this.labelHandles||this.precise))return;if(!this.hasHistogram&&!t&&this.labelHandles&&!this.precise)return;if(!this.hasHistogram&&!t&&!this.labelHandles&&this.precise)return;if(!this.hasHistogram&&!t&&this.labelHandles&&this.precise)return;if(!this.hasHistogram&&t&&!this.precise)return;if(this.hasHistogram&&!this.precise&&!this.labelHandles)return;const i=this.el.shadowRoot.querySelector(`.${I}`),e=this.el.shadowRoot.querySelector(`.${A}`),a=this.el.shadowRoot.querySelector(`.${P}`),s=this.el.shadowRoot.querySelector(`.${F}`);!i&&e&&a&&s&&(a.style.opacity=this.isMinTickLabelObscured(a,e)?"0":"1",s.style.opacity=this.isMaxTickLabelObscured(s,e)?"0":"1"),i&&e&&a&&s&&(a.style.opacity=this.isMinTickLabelObscured(a,i)||this.isMinTickLabelObscured(a,e)?"0":"1",s.style.opacity=this.isMaxTickLabelObscured(s,i)||this.isMaxTickLabelObscured(s,e)&&this.hasHistogram?"0":"1")}getHostOffset(t,i){const e=this.el.getBoundingClientRect();return t+7<e.left?e.left-t-7:i-7>e.right?7-(i-e.right):0}getRangeLabelOverlap(t,i){const e=t.getBoundingClientRect(),a=i.getBoundingClientRect(),s=this.getFontSizeForElement(t);return Math.max(e.right+s-a.left,0)}isMinTickLabelObscured(t,i){const e=t.getBoundingClientRect(),a=i.getBoundingClientRect();return o(e,a)}isMaxTickLabelObscured(t,i){const e=t.getBoundingClientRect(),a=i.getBoundingClientRect();return o(e,a)}static get delegatesFocus(){return!0}get el(){return e(this)}static get watchers(){return{histogram:["histogramWatcher"],ticks:["ticksWatcher"],value:["valueHandler"],minValue:["minMaxValueHandler"],maxValue:["minMaxValueHandler"]}}};N.style='@charset "UTF-8";:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}.scale--s{--calcite-slider-handle-size:0.625rem;--calcite-slider-handle-extension-height:0.4rem;--calcite-slider-container-font-size:var(--calcite-font-size--3)}.scale--s .handle__label,.scale--s .tick__label{line-height:.75rem}.scale--m{--calcite-slider-handle-size:0.875rem;--calcite-slider-handle-extension-height:0.5rem;--calcite-slider-container-font-size:var(--calcite-font-size--2)}.scale--m .handle__label,.scale--m .tick__label{line-height:1rem}.scale--l{--calcite-slider-handle-size:1rem;--calcite-slider-handle-extension-height:0.65rem;--calcite-slider-container-font-size:var(--calcite-font-size--1)}.scale--l .handle__label,.scale--l .tick__label{line-height:1rem}.handle__label,.tick__label{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-2);font-size:var(--calcite-slider-container-font-size)}:host{display:block}.container{position:relative;display:block;overflow-wrap:normal;word-break:normal;padding-inline:calc(var(--calcite-slider-handle-size) * 0.5);padding-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-inline:0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n );touch-action:none}:host([disabled]) .track__range,:host([disabled]) .tick--active{background-color:var(--calcite-color-text-3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.375rem}.scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.5rem}.scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.55rem}:host([precise]:not([has-histogram])) .container .thumb--value{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}.thumb-container{position:relative;max-inline-size:100%}.thumb{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:flex;cursor:pointer;flex-direction:column;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}.thumb .handle__label.static,.thumb .handle__label.transformed{position:absolute;inset-block:0px;opacity:0}.thumb .handle__label.hyphen::after{content:"—";display:inline-block;inline-size:1em}.thumb .handle__label.hyphen--wrap{display:flex}.thumb .handle{box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-color-foreground-1);outline-color:transparent;block-size:var(--calcite-slider-handle-size);inline-size:var(--calcite-slider-handle-size);box-shadow:0 0 0 2px var(--calcite-color-text-3) inset;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease}.thumb .handle-extension{inline-size:0.125rem;block-size:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-color-text-3)}.thumb:hover .handle{box-shadow:0 0 0 3px var(--calcite-color-brand) inset}.thumb:hover .handle-extension{background-color:var(--calcite-color-brand)}.thumb:focus .handle{outline:2px solid var(--calcite-color-brand);outline-offset:calc(\n 2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}.thumb:focus .handle-extension{background-color:var(--calcite-color-brand)}.thumb.thumb--minValue{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-0.125rem}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.4375rem}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.875rem}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-2rem}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{margin-block-start:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{margin-block-end:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-2.075rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-2.75rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-3.0625rem}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-color-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise:after,.thumb:focus.thumb--precise:after,.thumb--active.thumb--precise:after{background-color:var(--calcite-color-brand)}.track{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-color-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-color-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range:after{position:absolute;inline-size:100%;content:"";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){.thumb{outline-width:0;outline-offset:0}.handle{outline:2px solid transparent;outline-offset:2px}.thumb:focus .handle,.thumb .handle-extension,.thumb:hover .handle-extension,.thumb:focus .handle-extension,.thumb:active .handle-extension{background-color:canvasText}.track{background-color:canvasText}.track__range{background-color:highlight}}.tick{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-color-border-input);border-color:var(--calcite-color-foreground-1);inset-block-start:-2px;pointer-events:none;margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-color-brand)}.tick__label{pointer-events:none;margin-block-start:0.875rem;display:flex;justify-content:center}.tick__label--min{transition:opacity var(--calcite-animation-timing)}.tick__label--max{transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-3)}.graph{color:var(--calcite-color-foreground-3);block-size:48px}:host([label-ticks][ticks]) .container{padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{padding-block-start:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}';export{T as calcite_graph,N as calcite_slider}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as i,h as t,g as s}from"./p-7d280d8a.js";import{c as e,d as a}from"./p-13f2d901.js";import{u as c,c as n,s as o,d as r}from"./p-05cb50f9.js";import{c as l}from"./p-1f65ab1e.js";import{D as d}from"./p-3dd92f0d.js";import"./p-e7afc0a8.js";import"./p-5a9a971a.js";import"./p-7c2be8cc.js";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.4.0
|
11
|
-
*/const h=class{constructor(t){i(this,t),this.resizeObserver=l("resize",(()=>this.handleResize())),this.handleDefaultSlotChange=i=>{this.hasContent=d(i)},this.storeLoaderEl=i=>{this.loaderEl=i,this.handleResize()},this.loading=!1,this.messages=void 0,this.messageOverrides=void 0,this.loaderScale=void 0,this.defaultMessages=void 0,this.effectiveLocale="",this.hasContent=!1}onMessagesChange(){}effectiveLocaleChange(){c(this,this.effectiveLocale)}connectedCallback(){var i;e(this),n(this),null===(i=this.resizeObserver)||void 0===i||i.observe(this.el)}async componentWillLoad(){await o(this)}disconnectedCallback(){var i;a(this),r(this),null===(i=this.resizeObserver)||void 0===i||i.disconnect()}render(){const{hasContent:i,loading:s,messages:e}=this;return t("div",{class:"scrim"},s?t("calcite-loader",{label:e.loading,scale:this.loaderScale,ref:this.storeLoaderEl}):null,t("div",{class:"content",hidden:!i},t("slot",{onSlotchange:this.handleDefaultSlotChange})))}getScale(i){return i<72?"s":i>=480?"l":"m"}handleResize(){var i;const{loaderEl:t,el:s}=this;t&&(this.loaderScale=this.getScale(null!==(i=Math.min(s.clientHeight,s.clientWidth))&&void 0!==i?i:0))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};h.style=":host{--calcite-scrim-background:var(--calcite-color-transparent-scrim);position:absolute;inset:0px;z-index:var(--calcite-z-index-overlay);display:flex;block-size:100%;inline-size:100%;flex-direction:column;align-items:stretch}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}.scrim{position:absolute;inset:0px;display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background, var(--calcite-color-transparent-scrim))}.content{padding:1rem}:host([hidden]){display:none}[hidden]{display:none}";export{h as calcite_scrim}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as i,h as t,H as s,g as e,c as h}from"./p-7d280d8a.js";import{g as o,l as a}from"./p-be8ef276.js";import{q as l,g as n,d,e as r,f as c,i as v}from"./p-3af79063.js";import{d as p}from"./p-331b5d1e.js";import"./p-8ddc7786.js";import"./p-e2d0ad1b.js";import"./p-c1cf3ebc.js";import"./p-b503d01d.js";import"./p-a230b270.js";import"./p-94c634ba.js";const u=class{constructor(t){i(this,t),this.isMobile=void 0,this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._cardLoading=!1,this._graphics=void 0,this._translations=void 0}async featureSelectionChange(i){const t=i.detail;this._cardLoading=!0;const s=t.length>0?await l(t,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((i,s)=>t.indexOf(i.getObjectId())-t.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(i){const t=i.detail[0];this.layer=await n(this.mapView,t)}async componentWillLoad(){await this._getTranslations()}render(){var i,e;const h=(null===(i=this._graphics)||void 0===i?void 0:i.length)>0?"":"display-none",o=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return t(s,null,t("div",{class:"overflow-auto height-full"},t("calcite-shell",{class:"position-relative "+h},t("div",null,t("info-card",{graphics:this._graphics,isLoading:this._cardLoading,isMobile:this.isMobile,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),t("calcite-shell",{class:"position-relative "+o},t("div",{class:"padding-1"},t("calcite-notice",{icon:"table",open:!0},t("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}};u.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}card-manager{display:block}";const b=class{constructor(t){i(this,t),this.featureSelectionChange=h(this,"featureSelectionChange",7),this._ctrlIsPressed=!1,this._defaultFilterHonored=!1,this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._observerSet=!1,this._shiftIsPressed=!1,this._skipOnChange=!1,this.onTableNodeCreate=i=>{this._tableNode=i},this.defaultGlobalId=void 0,this.defaultLayerId=void 0,this.defaultOid=void 0,this.enableAutoRefresh=void 0,this.enableColumnReorder=!0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableShare=void 0,this.isMobile=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.selectedIds=[],this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._allIds=[],this._controlsThatFit=void 0,this._csvExporting=!1,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._layer=void 0,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=void 0,this._translations=void 0}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}enableCSVWatchHandler(){var i;(null===(i=this._toolInfos)||void 0===i?void 0:i.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}_controlsThatFitWatchHandler(){var i;const t=this._controlsThatFit?this._controlsThatFit.reduce(((i,t)=>(i.push(t.id),i)),[]):[];this._toolInfos=null===(i=this._toolInfos)||void 0===i?void 0:i.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}isMobileWatchHandler(){this._toolInfos||this.isMobile||this._initToolInfos()}async mapInfoWatchHandler(){this._resetColumnTemplates(),this._initLayerExpressions(),this._initToolInfos(),this._updateToolbar()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression=void 0,this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(i=>{this._mapClicked(i)})))}async _layerWatchHandler(){var i;this._fetchingData=!0,await(null===(i=this._layer)||void 0===i?void 0:i.when((async()=>{var i;this._definitionExpression=this._layer.definitionExpression,this._floorField=null===(i=this._layer.floorInfo)||void 0===i?void 0:i.floorField,this._updateFloorDefinitionExpression(),await this._resetTable(),this._initLayerExpressions(),this._updateShareUrl(),this._fetchingData=!1})))}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1)}async selectionChanged(i){const t=i.detail[0],s=t.getObjectId();if(this.zoomAndScrollToSelected){const i=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(i);const e=t.layer;let h;this.mapView.allLayerViews.toArray().some((i=>{if(i.layer.title===e.title&&"feature"===i.layer.type)return h=i,!0})),h&&await d([s],h,this.mapView,!0)}}async editsComplete(i){const t=i.detail;"delete"!==t&&"add"!==t||(this._allIds=await r(this._layer)),await this._refresh()}async facilityChanged(i){this._floorFacility=i.detail,this._updateFloorDefinitionExpression()}async levelChanged(i){this._floorLevel=i.detail,this._updateFloorDefinitionExpression()}async siteChanged(i){this._floorSite=i.detail,this._updateFloorDefinitionExpression()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._onResize())))}render(){const i=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",h=this._allIds.length.toString(),o=this.selectedIds.length.toString(),a=this.isMobile?"height-full":"height-full-adjusted";return this._validateActiveActions(),t(s,null,t("calcite-shell",null,this._getTableControlRow("header"),t("div",{class:`width-full ${a}`},t("calcite-panel",{class:"height-full width-full"},t("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),t("div",{class:i,ref:this.onTableNodeCreate})),this.isMobile?void 0:t("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",h).replace("{{selected}}",o)))),this._filterModal())}async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0),document.onclick=i=>this._handleDocumentClick(i),document.onkeydown=i=>this._handleKeyDown(i),document.onkeyup=i=>this._handleKeyUp(i)}componentDidRender(){this._updateToolbar()}async _initModules(){const[i,t,s]=await a(["esri/widgets/FeatureTable","esri/core/reactiveUtils","esri/widgets/FeatureTable/support/TableTemplate"]);this.FeatureTable=i,this.reactiveUtils=t,this.TableTemplate=s}_onResize(){this._updateToolbar()}_getTableControlRow(i){return t("div",{class:"display-flex border-bottom height-51",ref:i=>this._toolbar=i,slot:i},this._getActionBar(),this.isMobile?void 0:this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile?this._getShare("share"):void 0)}_getActionBar(){const i=this.isMobile?"width-full":"",s=this.isMobile?"border-top":"";return t("calcite-action-bar",{class:i,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},t("div",{class:`border-end ${i} ${s}`,id:"solutions-map-layer-picker-container"},t("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onLayerSelectionChange:i=>this._layerSelectionChanged(i),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showSingleLayerAsLabel:!0,showTables:!0,type:"dropdown"})),this.isMobile?void 0:this._getActions())}_getActions(){const i=this._getActionItems();return null==i?void 0:i.reduce(((i,s)=>(s&&!s.isOverflow&&i.push(s.isDanger?this._getDangerAction(s.icon,s.label,s.func,s.disabled):s.isSublist?t("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(s.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._showHideDropdown=i},this._getAction(s.active,this._showHideOpen?"chevron-down":s.icon,s.indicator,s.label,s.func,s.disabled,s.loading,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(s.active,s.icon,s.indicator,s.label,s.func,s.disabled,s.loading)),i)),[])}_getFieldlist(){return this._columnsInfo?t("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((i=>t("calcite-dropdown-item",{id:i,onClick:i=>{const t=i.target;this._columnsInfo[t.id]=t.selected,t.selected?this._table.showColumn(t.id):this._table.hideColumn(t.id)},selected:this._columnsInfo[i]},i)))):void 0}_validateEnabledActions(){var i;const t=this._featuresSelected(),s=["zoom-to-object","trash","erase","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&s.indexOf(i.icon)>-1&&(i.disabled=!t)}))}_validateActiveActions(){var i;const t=["filter","list-check-all","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&t.indexOf(i.icon)>-1&&("filter"===i.icon&&(i.indicator=this._filterActive),"list-check-all"===i.icon&&(i.active=this._selectAllActive),"selected-items-filter"===i.icon&&(i.active=this._showOnlySelected))}))}_initToolInfos(){const i=this._featuresSelected(),t=this._featuresEmpty(),s=this._hasFilterExpressions();this._translations&&(this._toolInfos=[{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1},s?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this._toggleFilter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{active:void 0,icon:"trash",indicator:void 0,label:void 0,func:void 0,disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{active:!1,icon:"list-check-all",indicator:!1,func:()=>this._selectAll(),label:this._translations.selectAll,disabled:t,isOverflow:!1},{active:!1,icon:"compare",indicator:!1,func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:t,isOverflow:!1},{active:!1,icon:"refresh",indicator:!1,func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:t,isOverflow:!1}:void 0,{active:!1,icon:this._showHideOpen?"chevron-down":"chevron-right",indicator:!1,func:()=>this._toggleShowHide(),label:this._translations.showHideColumns,disabled:!1,isOverflow:!1,isSublist:!0}],this._defaultVisibleToolSizeInfos=void 0)}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){const i=`${this._floorField} = '${this._floorLevel}'`,t=this._layer.definitionExpression;this._layer.definitionExpression=(null==t?void 0:t.indexOf(this._floorExpression))>-1?t.replace(this._floorExpression,i):t?`${t} AND (${i})`:i,this._floorExpression=i}}_featuresSelected(){return this.selectedIds.length>0}_featuresEmpty(){return 0===this._allIds.length}_hasFilterExpressions(){var i,t,s;let e;return(null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions)&&(null===(s=this._layer)||void 0===s?void 0:s.id)&&(e=this.mapInfo.filterConfig.layerExpressions.filter((i=>i.id===this._layer.id))),(null==e?void 0:e.length)>0}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const i=this._toolbar.offsetWidth;let t=this._toolbarSizeInfos.reduce(((i,t)=>i+t.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(t>i){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(t>i?t-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((i,t)=>(i.push(t.id),i)),[]);let h=!1;const o=[...this._defaultVisibleToolSizeInfos].reduce(((o,a)=>(!h&&s.indexOf(a.id)<0&&(e.indexOf(a.id)>-1||t+a.width<=i)?(e.indexOf(a.id)<0&&(t+=a.width),o.push(a)):s.indexOf(a.id)<0&&t+a.width>i&&(h=!0),o)),[]);this._setControlsThatFit(o,s)}}),250))}_setControlsThatFit(i,t){let s=JSON.stringify(i)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((i=>{t.indexOf(i.id)<0&&!s&&(s=this._controlsThatFit.map((i=>i.id)).indexOf(i.id)<0)})),s&&(this._controlsThatFit=[...i])}_setToolbarSizeInfos(){let i=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((t,s)=>{0===s?t.childNodes.forEach((t=>{this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0)})):t.referenceElement||(this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0))})),i&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&!i.isOverflow))}_getDropdown(i){const s=this._getDropdownItems();return s.length>0?t("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._moreDropdown=i},t("calcite-action",{appearance:"solid",id:i,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},t("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),t("calcite-dropdown-group",{"selection-mode":"none"},s.map((i=>t("calcite-dropdown-group",{class:i.disabled?"disabled":"",selectionMode:i.disabled?"none":"single"},t("calcite-dropdown-item",{disabled:i.loading,iconStart:i.isSublist&&this._showHideOpen?"chevron-down":i.loading?"":i.icon,id:"solutions-subset-list",onClick:i.func},i.loading?t("div",{class:"display-flex"},t("calcite-loader",{inline:!0,label:i.label,scale:"m"}),i.label):i.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&i.isOverflow))}_getAction(i,s,e,h,o,a,l,n){const d=void 0===this._layer||a;return t("div",{class:"display-flex",id:this._getId(s),slot:n},t("calcite-action",{active:i,appearance:"solid",disabled:d,icon:s,id:s,indicator:e,label:h,loading:l,onClick:o,text:h,textEnabled:!0}),this._getToolTip("bottom",s,h))}_getShare(i){return t("div",{class:"share-action",id:this._getId(i)},t("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:i=>this._shareNode=i,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",i,this._translations.share))}_updateShareUrl(){var i,t,s,e;const h=null===(i=this._shareNode)||void 0===i?void 0:i.shareUrl;if(!h)return;const o=new URL(h);(null===(t=this.mapInfo)||void 0===t?void 0:t.id)?o.searchParams.set("webmap",this.mapInfo.id):o.searchParams.delete("webmap"),(null===(s=this._layer)||void 0===s?void 0:s.id)?o.searchParams.set("layer",this._layer.id):o.searchParams.delete("layer"),(null===(e=this.selectedIds)||void 0===e?void 0:e.length)>0?o.searchParams.set("oid",this.selectedIds.join(",")):o.searchParams.delete("oid"),this._shareNode.shareUrl=o.href}_getToolTip(i,s,e){return document.getElementById(s)?t("calcite-tooltip",{placement:i,"reference-element":s},t("span",null,e)):void 0}_getId(i){return`solutions-action-${i}`}_getDangerAction(i,s,e,h){const o=void 0===this._layer||h;return t("div",{class:"display-flex",id:this._getId(i)},"trash"===i?t("delete-button",{buttonType:"action",class:"display-flex",disabled:o,icon:i,ids:this._getIds(),layer:this._layer}):t("calcite-action",{appearance:"solid",disabled:o,id:i,onClick:e,text:""},t("calcite-button",{appearance:"transparent",iconStart:i,kind:"danger"},s)),this._getToolTip("bottom",i,s))}_getIds(){return this._table.highlightIds.toArray()}async _getTable(i,t){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:t},container:i})})),await this._table.when((()=>{this._table.highlightIds.on("change",(i=>{this._handleOnChange(i)}))})))}async _handleOnChange(i){const t=[...this._table.highlightIds.toArray()];if(this._skipOnChange)this._skipOnChange=!1;else{if(this._ctrlIsPressed||this._shiftIsPressed){if(this._ctrlIsPressed)this.selectedIds=t.reverse();else if(this._shiftIsPressed&&(this._skipOnChange=!0,this._previousCurrentId=this._currentId,this._currentId=[...this._table.highlightIds.toArray()].reverse()[0],this._previousCurrentId!==this._currentId)){const i=this._table.activeSortOrders.reduce(((i,t)=>(i.push(`${t.fieldName} ${t.direction}`),i)),[]),s=await c(this._layer,this._layer.definitionExpression,i);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),o=this._table.viewModel.getObjectIdIndex(this._currentId),a=h<o?h:o,l=o>h?o:h;this._skipOnChange=a+1!==l;const n=s.reduce(((i,t)=>{const s=t,h=this._table.viewModel.getObjectIdIndex(s);return s!==this._currentId&&s!==this._previousCurrentId||(e=!e,i.indexOf(s)<0&&i.push(s)),e&&i.indexOf(s)<0&&i.push(s),(this.selectedIds.indexOf(s)>-1||h>=a&&h<=l)&&i.indexOf(s)<0&&h>-1&&i.push(s),i}),[]);this.selectedIds=h<o?n.reverse():n,this._table.highlightIds.addMany(this.selectedIds.filter((i=>t.indexOf(i)<0)))}}else if(this.selectedIds.length>0){this._skipOnChange=!0;const s=this.selectedIds.length>1&&1===i.removed.length?i.removed:t.filter((i=>this.selectedIds.indexOf(i)<0));this._clearSelection(),this.selectedIds=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this.selectedIds=t.reverse();this._finishOnChange()}this._currentId=[...this._table.highlightIds.toArray()].reverse()[0]}_finishOnChange(){this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this.selectedIds)}_resetColumnTemplates(){var i,t;const s=this._getColumnTemplates(null===(i=this._layer)||void 0===i?void 0:i.id,null===(t=this._layer)||void 0===t?void 0:t.fields),e=null==s?void 0:s.some(((i,t)=>{var s;return JSON.stringify(null===(s=this._table)||void 0===s?void 0:s.tableTemplate.columnTemplates[t])!==JSON.stringify(i)}));if(this._table&&s&&(e||!this._columnsInfo)){this._table.tableTemplate=new this.TableTemplate({columnTemplates:s});const i=s.map((i=>i.fieldName));this._initColumnsInfo(i)}}async _resetTable(){var i;if(this._clearSelection(),this._allIds=await r(this._layer),this._table)this._table.view=this.mapView,this._table.layer=this._layer;else{const t=this._getColumnTemplates(this._layer.id,null===(i=this._layer)||void 0===i?void 0:i.fields);await this._getTable(this._tableNode,t)}await this._initLayerRefresh(),this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,await this.reactiveUtils.once((()=>"loaded"===this._table.state)).then((async()=>{this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),this._initToolInfos(),this._updateToolbar()}))}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._refreshHandle=this._layer.on("refresh",(i=>{i.dataChanged&&(this._skipOnChange=!0,this._updateAllIds())}))}async _updateAllIds(){this._allIds=await r(this._layer),this.selectedIds=this.selectedIds.filter((i=>this._allIds.indexOf(i)>-1)),await this._refresh()}async _handleDefaults(){var i,t;if(!this._defaultOidHonored&&(null===(i=this.defaultOid)||void 0===i?void 0:i.length)>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=void 0,this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&(null===(t=this.defaultGlobalId)||void 0===t?void 0:t.length)>0&&this._table){const i=await v(this.defaultGlobalId,this._layer),t=(null==i?void 0:i.length)>0?i.map((i=>i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=void 0,this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(i){var t,s;const e=null===(t=this._table)||void 0===t?void 0:t.columns.reduce(((t,s)=>((!i||(null==i?void 0:i.indexOf(s.name))>-1)&&(t[s.name]=!s.hidden),t)),{}),h=null===(s=this._table)||void 0===s?void 0:s.columns.map((i=>i.name));(i?i.filter((i=>h.indexOf(i)<0)):[]).forEach((i=>{e[i]=!0})),this._columnsInfo=i?i.reduce(((i,t)=>(i[t]=e[t],i)),{}):e}async _selectDefaultFeature(i){i.length>0&&this._table.highlightIds.addMany(i)}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){this._table&&this._layer&&this.showNewestFirst&&(await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc")})))}_forceShowHide(){this._showHideDropdown&&(this._showHideDropdown.open=this._showHideOpen),this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_closeShowHide(){this._showHideOpen=!1}_handleDocumentClick(i){var t;const s=null===(t=i.target)||void 0===t?void 0:t.id;this._showHideOpen&&Object.keys(this._columnsInfo).indexOf(s)<0&&"solutions-subset-list"!==s&&"chevron-right"!==s&&(this._closeShowHide(),this._moreDropdown&&(this._moreDropdown.open=!1),this._showHideDropdown&&(this._showHideDropdown.open=!1))}_handleKeyDown(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_handleKeyUp(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_filterModal(){var i,s,e;return t("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},t("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},null===(s=null===(i=this._translations)||void 0===i?void 0:i.filter)||void 0===s?void 0:s.replace("{{title}}",null===(e=this._layer)||void 0===e?void 0:e.title)),t("div",{slot:"content"},t("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",layerExpressions:this._layerExpressions,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:i=>this._filterList=i,view:this.mapView,zoomBtn:!1})))}_handleFilterListReset(){this._filterActive=!1,this._updateShareUrl()}_handleFilterUpdate(){const i=this._layer.definitionExpression;if(this._floorExpression){const t=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=i&&this._floorField&&i.indexOf(`${this._floorField} = '`)>-1?i.replace(t,this._floorExpression):i?`${i} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=this._definitionExpression!==this._layer.definitionExpression&&(!this._floorExpression||this._layer.definitionExpression!==this._floorExpression),this._updateShareUrl()}async _closeFilter(){this._filterOpen&&(this._allIds=await r(this._layer),this._filterOpen=!1)}async _mapClicked(i){const t={include:this._layer},s=await this.mapView.hitTest(i.screenPoint,t);s.results.length>0?(s.results.forEach((i=>{const t=i.graphic.getObjectId();this._table.highlightIds.indexOf(t)<0&&this._table.highlightIds.add(t)})),this._showOnlySelected&&this._table.filterBySelection()):this._clearSelection()}_selectAll(){const i=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(i),this.selectedIds=i,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var i;this.selectedIds=[],null===(i=this._table)||void 0===i||i.highlightIds.removeAll(),this._finishOnChange()}_toggleFilter(){this._filterOpen=!this._filterOpen}_initLayerExpressions(){var i,t;const s=null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions;this._layerExpressions=s?s.filter((i=>{var t;return i.id===(null===(t=this._layer)||void 0===t?void 0:t.id)})):[],this._filterList.layerExpressions=this._layerExpressions,this._filterActive=this._layerExpressions.filter((i=>i.expressions.filter((i=>i.active)).length>0)).length>0}_switchSelected(){const i=[...this.selectedIds];this._table.highlightIds.removeAll();const t=this._allIds.reduce(((t,s)=>(i.indexOf(s)<0&&t.push(s),t)),[]).sort(((i,t)=>i-t));this._skipOnChange=!0,this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()}async _exportToCSV(){const i={},t=this._table.highlightIds.toArray();i[this._layer.id]={selectionSetNames:[this._layer.title],ids:t,layer:this._layer};const s=this._table.columns.toArray().reduce(((i,t)=>(t.hidden||i.push(t.name.toLocaleLowerCase()),i)),[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,await p(null,i,!1,!1,!0,s,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}_updateToolInfoLoading(i,t){this._toolInfos.some((s=>{if((null==s?void 0:s.icon)===i)return s.loading=t,!0}))}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this.selectedIds)}_zoom(){this._table.zoomToSelection()}async _layerSelectionChanged(i){var t;const s=i.detail[0];if(s!==(null===(t=this._layer)||void 0===t?void 0:t.id)||this._featuresEmpty()){this._fetchingData=!0;const i=await n(this.mapView,s);await i.when((()=>{this._layer=i}))}this._fetchingData=!1}_getColumnTemplates(i,t){var s,e;let h;null===(e=null===(s=this.mapInfo)||void 0===s?void 0:s.layerOptions)||void 0===e||e.layers.some((t=>{if(t.id===i)return h=t,!0}));const o=(null==h?void 0:h.fields)&&(null==h?void 0:h.fieldOrder)?h.fieldOrder.filter((i=>h.fields.indexOf(i)>-1)):void 0;let a;return t&&(a=h&&(null==h?void 0:h.fields)?t.reduce(((i,t)=>{if(h.fields.indexOf(t.name)>-1){const s={type:"field",fieldName:t.name,label:t.alias,menuConfig:this._getMenuConfig(t.name)};i.push(s)}return i}),[]).sort(this._sortFields.bind(this,null==h?void 0:h.fieldOrder)):t.map((i=>({type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)})))),o?null==a?void 0:a.sort(this._sortFields.bind(this,o)):a}_sortFields(i,t,s){return(null==i?void 0:i.indexOf(t.fieldName))-i.indexOf(s.fieldName)}_getMenuConfig(i){return{items:[{label:this._translations.hideField,iconClass:"esri-icon-non-visible",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(i)}}]}}_handleHideClick(i){this._columnsInfo[i]=!1,this._table.hideColumn(i),this._table.tableTemplate.columnTemplates.forEach((t=>{t.fieldName===i&&(t.visible=!1)}))}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}static get watchers(){return{defaultOid:["defaultOidWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],enableShare:["enableShareWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],selectedIds:["selectedIdsWatchHandler"]}}};b.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-background)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{font-size:14px !important;color:var(--calcite-color-text-3) !important}.share-action{position:absolute;right:0}html[dir="rtl"] .share-action{left:0}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.instant-app-share{height:50px !important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-modal-content-padding:0}';const m=class{constructor(t){i(this,t),this.mapChanged=h(this,"mapChanged",7),this.beforeMapChanged=h(this,"beforeMapChanged",7),this._defaultWebmapHonored=!1,this._loadedId="",this.appProxies=void 0,this.defaultWebmapId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSingleExpand=!0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.homeZoomIndex=3,this.homeZoomPosition="top-left",this.homeZoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.mapView=void 0,this.stackTools=!0,this.theme=void 0,this.toolOrder=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(i){await this._loadMap(i.detail)}async componentWillLoad(){await this._initModules()}render(){var i,e;const h=this.hidden?"visibility-hidden-1":"",o="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",a=(null===(i=this.mapInfos)||void 0===i?void 0:i.length)>1?"":"display-none",l=(null===(e=this.mapInfos)||void 0===e?void 0:e.length)>1?"map-height":"height-full";return t(s,null,t("map-picker",{class:a,mapInfos:this.mapInfos,ref:i=>this._mapPicker=i}),t("div",{class:`${l} ${h}`,ref:i=>this._mapDiv=i}),t("map-tools",{basemapConfig:this.basemapConfig,class:`box-shadow ${o}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableSingleExpand:this.enableSingleExpand,homeZoomToolsSize:this.homeZoomToolsSize,mapView:this.mapView,mapWidgetsSize:this.mapWidgetsSize,position:this.mapWidgetsPosition,ref:i=>this._mapTools=i,searchConfiguration:this._searchConfiguration,stackTools:this.stackTools,toolOrder:this.toolOrder}))}async _initModules(){const[i,t,s,e]=await a(["esri/WebMap","esri/views/MapView","esri/widgets/Home","esri/config"]);this.WebMap=i,this.MapView=t,this.Home=s,this.esriConfig=e}async _loadMap(i){var t;const s=!this._defaultWebmapHonored&&this.defaultWebmapId,e=null===(t=this.mapInfos)||void 0===t?void 0:t.filter((i=>i.id===this.defaultWebmapId)),h=JSON.stringify(i)!==JSON.stringify(this._webMapInfo);this._webMapInfo=s&&e?e[0]:!(null==i?void 0:i.id)&&this.mapInfos.length>0?this.mapInfos[0]:i;const o=this._webMapInfo.id,a=s&&(null==i?void 0:i.id)===this.defaultWebmapId;if(this._loadedId!==o&&!s||a){const i=new this.WebMap({portalItem:{id:o}});this.appProxies&&(await i.load(),await(l=i,n=this.esriConfig,d=this.appProxies,d&&d.forEach((i=>{l.allLayers.forEach((t=>{t&&t.url===i.sourceUrl&&(t.url=i.proxyUrl,t.portalItem&&t.portalItem.when((()=>{t.portalItem.url=i.proxyUrl})),n.request?.interceptors?.push({urls:i.sourceUrl,before:t=>{t.url&&t.url===i.sourceUrl&&(t.url=i.proxyUrl)}}))}))})),l)),this.mapView=new this.MapView({container:this._mapDiv,map:i,resizeAlign:"center"}),this._loadedId=o,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=!!a||this._defaultWebmapHonored,this.mapChanged.emit({id:o,mapView:this.mapView})}))}else s?(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(o)):h&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:o,mapView:this.mapView}));var l,n,d}_initHome(){if(this.enableHome){this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:this.homeZoomPosition,index:this.homeZoomIndex});const i="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";this._homeWidget.domNode.style.height=i,this._homeWidget.domNode.style.width=i}else this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};m.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.height-full{height:100%}.box-shadow{box-shadow:none !important}.visibility-hidden-1{visibility:hidden;height:1px;}.display-none{display:none}";export{u as card_manager,b as layer_table,m as map_card}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{a as t}from"./p-c1cf3ebc.js";
|
7
|
-
/** @license
|
8
|
-
* Copyright 2022 Esri
|
9
|
-
*
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
-
* you may not use this file except in compliance with the License.
|
12
|
-
* You may obtain a copy of the License at
|
13
|
-
*
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
-
*
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
-
* See the License for the specific language governing permissions and
|
20
|
-
* limitations under the License.
|
21
|
-
*/async function n(t){const n=t.createQuery();return n.where=t.definitionExpression||"1=1",await t.queryObjectIds(n)}async function a(t,n){let a=[];const s=t?t.map((t=>async function(t,n){const a=n.createQuery();return a.spatialRelationship="intersects",a.geometry=t,n.queryObjectIds(a)}
|
22
|
-
/** @license
|
23
|
-
* Copyright 2022 Esri
|
24
|
-
*
|
25
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
26
|
-
* you may not use this file except in compliance with the License.
|
27
|
-
* You may obtain a copy of the License at
|
28
|
-
*
|
29
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
30
|
-
*
|
31
|
-
* Unless required by applicable law or agreed to in writing, software
|
32
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
33
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
34
|
-
* See the License for the specific language governing permissions and
|
35
|
-
* limitations under the License.
|
36
|
-
*/(t,n))):[Promise.resolve()];return(await Promise.all(s)).forEach((t=>{a=[...a,...t||[]]})),a}async function s(t,n,a,c,o,e){var i;const r=null===(i=n.capabilities)||void 0===i?void 0:i.query.maxRecordCount;0===t.length&&(t=await n.queryObjectIds());const u=n.createQuery();u.returnGeometry=c,u.objectIds=t.slice(0,r),o&&(u.outSpatialReference=o),e&&(u.outFields=e);const f=await n.queryFeatures(u);a=a.concat(f.features);const w=t.slice(r,t.length);return w.length>0?s(w,n,a,c,o,e):Promise.resolve(a)}async function c(t,n){const a=n.globalIdField;if(!a)return[];const s=n.createQuery();return s.returnGeometry=!1,s.outFields=[n.objectIdField],s.where=t.map((t=>`${a} = '${t}'`)).join(" or "),(await n.queryFeatures(s)).features}async function o(t,n,a,s){const c=n.capabilities.query.maxRecordCount,e=n.createQuery();e.start=t,e.num=c,e.geometry=a;const i=await n.queryFeatures(e);return s[n.id]=s[n.id].concat(i.features),i.exceededTransferLimit?o(t+=c,n,a,s):Promise.resolve(s)}async function e(t,n,a){const s=t.createQuery();return s.where=n||"1=1",s.orderByFields=a,await t.queryObjectIds(s)}function i(t,n){return[...r(t,"polygon",n),...r(t,"polyline",n),...r(t,"point",n)]}function r(t,n,a){const s=(null==t?void 0:t.filter((t=>t.type===n)))||[];return s.length<=1?s:[a.union(s)]}async function u(t,n){let a;return await t.when((()=>{a=t.map.allLayers.toArray().reduce(((t,n)=>("feature"===n.type&&(t[n.id]={name:n.title,supportsUpdate:void 0}),t)),{})})),w(n,a,t)}async function f(t,n){let a;return await t.when((()=>{a=t.map.allTables.toArray().reduce(((t,n)=>(t[n.id]={name:n.title,supportsUpdate:void 0},t)),{})})),w(n,a,t)}async function w(t,n,a){if(t){const t={},s=Object.keys(n);for(let c=0;c<s.length;c++){const o=s[c],e=await l(a,o);await e.load(),await e.when(),t[o]={name:n[o].name,supportsUpdate:e.editingEnabled&&e.capabilities.operations.supportsUpdate}}return t}return n}async function y(t,n){const a=await l(t,n);return a?await t.whenLayerView(a):void 0}async function l(t,n){let a=[];return await t.when((()=>{a=[...t.map.allLayers.toArray(),...t.map.allTables.toArray()].filter((t=>t.id===n))})),a.length>0?a[0]:void 0}async function d(t){const n=t.map.allLayers.toArray();let a;return await t.when((()=>{a=n.map((n=>t.whenLayerView(n)))})),await Promise.allSettled(a),n}async function p(t,n,a,s=!1){return s&&(await j(t,n,a,!1),await new Promise((t=>setTimeout(t,1e3)))),n.highlight(t)}async function m(t){const n=b(t);return Object.keys(n).reduce(((t,a)=>{const s=n[a];return t.push(s.layerView.highlight(s.ids)),t}),[])}function b(n){return n.reduce(((n,a)=>{const s=a.layerView,c=null==s?void 0:s.layer.id;return c&&Object.keys(n).indexOf(c)>-1?n[c].ids=[...new Set([...a.selectedIds,...n[c].ids])]:c&&(n[c]={layerView:s,ids:a.selectedIds}),a.workflowType===t.REFINE&&Object.keys(a.refineInfos).forEach((t=>{const s=a.refineInfos[t];Object.keys(n).indexOf(t)>-1&&(n[t].ids=[...new Set([...s.addIds,...n[t].ids])],n[t].ids=n[t].ids.filter((t=>s.removeIds.indexOf(t)<0)))})),n}),{})}async function j(t,n,a,s=!0,c){const o=await async function(t,n){const a=n.createQuery();return a.objectIds=t,n.queryExtent(a)}(t,n.layer);await a.goTo(o.extent),s&&await async function(t,n,a){const s={objectIds:t};n.featureEffect=Object.assign(Object.assign({},a),{filter:s}),setTimeout((()=>{n.featureEffect=void 0}),1300)}(t,n,c)}export{d as a,y as b,u as c,j as d,n as e,e as f,l as g,p as h,c as i,a as j,i as k,o as l,b as m,m as n,f as o,s as q}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,h as i,g as s,c as e,H as a,F as o}from"./p-7d280d8a.js";import{c as n}from"./p-1f65ab1e.js";import{c as l,s as c,a as r}from"./p-a4149333.js";import{a as h}from"./p-3dd92f0d.js";import{c as d,u as p,d as m,I as u}from"./p-6d520a58.js";import{c as v,d as f}from"./p-13f2d901.js";import{c as g,s as y,d as w,u as b}from"./p-05cb50f9.js";import{S as x}from"./p-7d04ff20.js";import{l as k,g as L,f as C}from"./p-be8ef276.js";import{a as _,g as j,b as S,h as I,c as F}from"./p-3af79063.js";import{P as z}from"./p-fb7a5f6e.js";import"./p-5a9a971a.js";import"./p-7c2be8cc.js";import"./p-ba7d55ea.js";import"./p-e7afc0a8.js";import"./p-8ddc7786.js";import"./p-e2d0ad1b.js";import"./p-c1cf3ebc.js";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.4.0
|
11
|
-
*/const W=class{constructor(i){t(this,i),this.itemMutationObserver=n("mutation",(()=>this.updateFlowProps())),this.getFlowDirection=(t,i)=>t&&i>1||t>1?i<t?"retreating":"advancing":null,this.updateFlowProps=()=>{const{customItemSelectors:t,el:i,items:s}=this,e=Array.from(i.querySelectorAll("calcite-flow-item"+(t?`,${t}`:""))).filter((t=>t.closest("calcite-flow")===i)),a=s.length,o=e.length,n=e[o-1],l=e[o-2];if(o&&n&&e.forEach((t=>{t.showBackButton=t===n&&o>1,t.hidden=t!==n})),l&&(l.menuOpen=!1),this.items=e,a!==o){const t=this.getFlowDirection(a,o);this.itemCount=o,this.flowDirection=t}},this.customItemSelectors=void 0,this.flowDirection=null,this.itemCount=0,this.items=[]}async back(){const{items:t}=this,i=t[t.length-1];if(!i)return;const s=i.beforeBack?i.beforeBack:()=>Promise.resolve();try{await s.call(i)}catch(t){return}return i.remove(),i}async setFocus(){await l(this);const{items:t}=this,i=t[t.length-1];return null==i?void 0:i.setFocus()}connectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.observe(this.el,{childList:!0,subtree:!0}),this.updateFlowProps()}async componentWillLoad(){c(this)}componentDidLoad(){r(this)}disconnectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.disconnect()}async handleItemBackClick(t){if(!t.defaultPrevented)return await this.back(),this.setFocus()}render(){const{flowDirection:t}=this;return i("div",{class:{frame:!0,"frame--advancing":"advancing"===t,"frame--retreating":"retreating"===t}},i("slot",null))}get el(){return s(this)}};W.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}:host([hidden]){display:none}[hidden]{display:none}";
|
12
|
-
/*!
|
13
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
|
-
* v2.4.0
|
16
|
-
*/
|
17
|
-
const D=class{constructor(i){t(this,i),this.calciteFlowItemBack=e(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=e(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=e(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=e(this,"calciteFlowItemToggle",6),this.handlePanelScroll=t=>{t.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=t=>{t.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=t=>{t.stopPropagation(),this.collapsed=t.target.collapsed,this.calciteFlowItemToggle.emit()},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=t=>{this.backButtonEl=t},this.setContainerRef=t=>{this.containerEl=t},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.overlayPositioning="absolute",this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){d(this),v(this),g(this)}async componentWillLoad(){await y(this),c(this)}componentDidRender(){p(this)}disconnectedCallback(){m(this),f(this),w(this)}componentDidLoad(){r(this)}effectiveLocaleChange(){b(this,this.effectiveLocale)}async setFocus(){await l(this);const{backButtonEl:t,containerEl:i}=this;return t?t.setFocus():i?i.setFocus():void 0}async scrollContentTo(t){var i;await(null===(i=this.containerEl)||void 0===i?void 0:i.scrollContentTo(t))}renderBackButton(){const{el:t}=this,s="rtl"===h(t),{showBackButton:e,backButtonClick:a,messages:o}=this,n=o.back;return e?i("calcite-action",{"aria-label":n,class:"back-button",icon:s?"chevron-right":"chevron-left",key:"flow-back-button",onClick:a,scale:"s",slot:"header-actions-start",text:n,title:n,ref:this.setBackRef}):null}render(){const{collapsed:t,collapseDirection:s,collapsible:e,closable:o,closed:n,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messages:m,overlayPositioning:v}=this;return i(a,null,i(u,{disabled:c},i("calcite-panel",{closable:o,closed:n,collapseDirection:s,collapsed:t,collapsible:e,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messageOverrides:m,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,overlayPositioning:v,ref:this.setContainerRef},this.renderBackButton(),i("slot",{name:"action-bar",slot:x.actionBar}),i("slot",{name:"header-actions-start",slot:x.headerActionsStart}),i("slot",{name:"header-actions-end",slot:x.headerActionsEnd}),i("slot",{name:"header-content",slot:x.headerContent}),i("slot",{name:"header-menu-actions",slot:x.headerMenuActions}),i("slot",{name:"fab",slot:x.fab}),i("slot",{name:"footer-actions",slot:x.footerActions}),i("slot",{name:"footer",slot:x.footer}),i("slot",null))))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};D.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-color-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}";const E=class{constructor(i){t(this,i),this.success=e(this,"success",7),this.fail=e(this,"fail",7),this.drawComplete=e(this,"drawComplete",7),this.editingAttachment=e(this,"editingAttachment",7),this.mapView=void 0,this.selectedLayerId=void 0,this.customizeSubmit=!1,this.searchConfiguration=void 0,this.showSearchWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&this._editor.viewModel.featureFormViewModel.submit()}async componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){const t=this.showSearchWidget?"":"display-none";return i(o,null,i("div",{id:"feature-form"}),i("div",{class:`search-widget ${t}`,id:"search-widget-ref"}))}async init(){this.mapView&&this.selectedLayerId&&(await this.createEditorWidget(),await this.createSearchWidget())}async initModules(){const[t,i,s]=await k(["esri/widgets/Editor","esri/core/reactiveUtils","esri/widgets/Search"]);this.Editor=t,this.reactiveUtils=i,this.Search=s}async createEditorWidget(){this._editor&&this._editor.destroy();const t=[],i=document.createElement("div");(await _(this.mapView)).forEach((async i=>{t.push({layer:i,enabled:"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.id)===this.selectedLayerId,addEnabled:!0,updateEnabled:!1,deleteEnabled:!1})})),this._editor=new this.Editor({allowedWorkflows:"create-features",view:this.mapView,layerInfos:t,visibleElements:{snappingControls:!1},container:i}),this.el.appendChild(i);const s=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"adding-attachment"===t||"editing-attachment"===t?(this._addingAttachment=!0,this.editingAttachment.emit(!0)):this._addingAttachment&&(this.editingAttachment.emit(!1),this._addingAttachment=!1)}));this._editor.viewModel.addHandles(s);const e=this.reactiveUtils.watch((()=>this._editor.viewModel.featureTemplatesViewModel.state),(t=>{"ready"===t&&this.startCreate()}));this._editor.viewModel.addHandles(e);const a=this.reactiveUtils.watch((()=>this._editor.viewModel.state),(t=>{"creating-features"===t&&(this.showSearchWidget=!0)}));this._editor.viewModel.addHandles(a)}async startCreate(){var t;if(null===(t=this._editor.viewModel.featureTemplatesViewModel.items)||void 0===t?void 0:t.length){const t=this._editor.viewModel.featureTemplatesViewModel.items[0].get("items");this._editor.viewModel.featureTemplatesViewModel.on("select",(()=>{setTimeout((()=>{this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this)),this._editor.viewModel.sketchViewModel.on("create",(t=>{"complete"===t.state&&(this.showSearchWidget=!1,this.drawComplete.emit())})),this.hideEditorsElements()}),700),this.hideEditorsElements()})),1===t.length&&this._editor.viewModel.featureTemplatesViewModel.select(t[0]),this.hideEditorsElements()}}async createSearchWidget(){let t={view:this.mapView};if(this.searchConfiguration){const i=this._getSearchConfig(this.searchConfiguration,this.mapView);t=Object.assign({},i)}this._search=new this.Search(t),this._search.container="search-widget-ref",this._search.popupEnabled=!1,this._search.resultGraphicEnabled=!1;const i=await j(this.mapView,this.selectedLayerId);let s=null;this._search.on("search-complete",(t=>{var e;this.mapView.goTo(t.results[0].results[0].extent),"point"===i.geometryType&&(s=null===(e=t.results[0].results[0])||void 0===e?void 0:e.feature.geometry)}));const e=this.reactiveUtils.watch((()=>this._search.viewModel.state),(t=>{"ready"===t&&setTimeout((()=>{this._editor.viewModel.sketchViewModel.createGraphic&&s&&(this._editor.viewModel.sketchViewModel.createGraphic.set("geometry",s),this._editor.viewModel.sketchViewModel.complete(),this.hideEditorsElements())}),100)}));this._search.viewModel.addHandles(e)}_getSearchConfig(t,i){const s=t.sources;return(null==s?void 0:s.length)>0?(t.includeDefaultSources=!1,s.forEach((t=>{var s,e;if(t.hasOwnProperty("layer")){const a=t,o=null===(s=a.layer)||void 0===s?void 0:s.id,n=o?i.map.findLayerById(o):null,l=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;n?a.layer=n:l&&(a.layer=new this.FeatureLayer(l))}})),null==s||s.forEach((t=>{if(t.hasOwnProperty("locator")){const i=t;"ArcGIS World Geocoding Service"===(null==i?void 0:i.name)&&(i.outFields=i.outFields||["Addr_type","Match_addr","StAddr","City"],i.singleLineFieldName="SingleLine"),i.url=i.url,delete i.url}}))):t=Object.assign(Object.assign({},t),{includeDefaultSources:!0}),t}hideEditorsElements(){this.customizeSubmit&&setTimeout((()=>{var t;null===(t=this.el.querySelector(".esri-editor").querySelectorAll("calcite-flow-item"))||void 0===t||t.forEach((t=>{var i,s,e,a,o;const n=null===(e=null===(s=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("calcite-panel"))||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("article");null===(a=null==n?void 0:n.querySelector("header"))||void 0===a||a.setAttribute("style","display: none"),null===(o=null==n?void 0:n.querySelector("footer"))||void 0===o||o.setAttribute("style","display: none")}))}),700)}async submitted(t){var i;if(!t.invalid.length&&t.valid.length){try{await this._editor.activeWorkflow.commit(),(null===(i=this._editor.viewModel.failures)||void 0===i?void 0:i.length)&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};E.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}.search-widget{width:92% !important;margin:5px 0 20px 14px}.display-none{display:none !important}";const P=class{constructor(i){t(this,i),this.featureSelect=e(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this.highlightOnHover=!1,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}async selectedLayerWatchHandler(){this._selectedLayer=await j(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async refresh(){await this.initializeFeatureItems()}async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=!0,this._popupUtils=new z,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await j(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return i("calcite-panel",{"full-height":!0,"full-width":!0},this._isLoading&&i("calcite-loader",{label:"",scale:"m"}),0===this._featureItems.length&&!this._isLoading&&i("calcite-notice",{class:"error-msg",icon:"feature-details",kind:"info",open:!0},i("div",{slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),i("calcite-list",{"selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&i("div",{class:"width-full",slot:"footer"},i("calcite-pagination",{class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t]=await k(["esri/Color"]);this.Color=t}async initializeFeatureItems(){this._selectedLayer&&(this._isLoading=!0,this._featureItems=await this.queryPage(0),this._featuresCount=await this._selectedLayer.queryFeatureCount(),this._isLoading=!1)}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),s=await S(this.mapView,this.selectedLayerId);this._highlightHandle=await I([i],s,this.mapView,!0)}this.featureSelect.emit(i)}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),s=await S(this.mapView,this.selectedLayerId);s.highlightOptions={color:new this.Color("#FFFF00")},this._highlightHandle=s.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,s=i.objectIdField,e={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:i.definitionExpression,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&(e.orderByFields=[s.toString()+" DESC"]);const a=await i.queryFeatures(e);return await this.createFeatureItem(a)}async createFeatureItem(t){const i=(null==t?void 0:t.features).map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);return this.getFeatureItem(t,i)}));return Promise.all(i)}getFeatureItem(t,s){const e=t.attributes[this._selectedLayer.objectIdField].toString();return i("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:e},i("div",{class:"popup-title",slot:"content-start"},s=null!=s?s:e),i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}async _getTranslations(){const t=await L(this.el);this._translations=t[0]}get el(){return s(this)}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"]}}};P.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.popup-title{font-weight:500;padding:10px 12px}";const T=class{constructor(i){t(this,i),this.layerSelect=e(this,"layerSelect",7),this.layersListLoaded=e(this,"layersListLoaded",7),this._noLayerToDisplayErrorMsg="Web map does not contain any editable layers.",this.mapView=void 0,this.layers=void 0,this.noLayerErrorMsg=void 0,this.showFeatureCount=!0,this.showNextIcon=!1,this._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=void 0}async refresh(){await this.setLayers()}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0}async componentDidLoad(){await this.setLayers(),this._isLoading=!1}render(){return i(o,null,this._isLoading&&i("calcite-loader",{label:"",scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{slot:"title"},this._translations.error),i("div",{slot:"message"},this.noLayerErrorMsg?this.noLayerErrorMsg:this._noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{"selection-appearance":"border","selection-mode":"none"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await F(this.mapView,!0),(await _(this.mapView)).forEach((async i=>{var s,e;if("feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.supportsAdd)&&(this._layerItemsHash[i.id].supportsAdd=!0,this.showFeatureCount)){const s=i.createQuery(),e=i.queryFeatureCount(s);t.push(e),e.then((async t=>{const s=isNaN(t)?"":await C(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[i.id].formattedFeatureCount=s}))}})),await Promise.all(t).then((()=>{const t=this.getLayersToBeShownInList(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getLayersToBeShownInList(t){var i;const s=(null===(i=this.layers)||void 0===i?void 0:i.length)>0?this.layers:[];return Object.keys(t).reduce(((t,i)=>{let e=!0;return(null==s?void 0:s.length)>0&&(e=s.indexOf(i)>-1),e&&t.push(i),t}),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const s=this._layerItemsHash[t].formattedFeatureCount;return i("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},i("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==s&&""!==s&&i("div",{class:this.showNextIcon?"":"feature-count",slot:"content-end"},"("+s+")"),this.showNextIcon&&i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await L(this.el);this._translations=t[0]}get el(){return s(this)}};T.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{W as calcite_flow,D as calcite_flow_item,E as create_feature,P as feature_list,T as layer_list}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,c as i,h as s,H as e,g as h}from"./p-7d280d8a.js";import{l as a,g as o}from"./p-be8ef276.js";import{a as l,b as c,h as n,c as r,g as d,q as u}from"./p-3af79063.js";import"./p-8ddc7786.js";import"./p-e2d0ad1b.js";import"./p-c1cf3ebc.js";const p=class{constructor(s){t(this,s),this.togglePanel=i(this,"togglePanel",7),this._noLayerToDisplayErrorMsg="Web map does not contain any editable layers.",this.description=void 0,this.isMobile=void 0,this.enableAnonymousAccess=void 0,this.enableAnonymousComments=void 0,this.enableComments=void 0,this.enableLogin=void 0,this.enableNewReports=void 0,this.layers=void 0,this.loginTitle=void 0,this.mapView=void 0,this.layerId=void 0,this.objectId=void 0,this.center=void 0,this.level=void 0,this.reportButtonText=void 0,this.reportsHeader=void 0,this.reportingOptions=void 0,this.reportSubmittedMessage=void 0,this.searchConfiguration=void 0,this.showComments=void 0,this.defaultWebmap="",this.enableSearch=!0,this.enableHome=!0,this.mapInfos=[],this.theme="light",this.enableZoom=!0,this.zoomToScale=void 0,this._mapInfo=void 0,this._flowItems=[],this._sidePanelCollapsed=!1,this._translations=void 0,this._hasValidLayers=!1,this._selectedLayerName=void 0,this._reportSubmitted=!1,this._showSubmitCancelButton=!1,this._featureCreationFailedErrorMsg=void 0}async isMobileWatchHandler(){this._sidePanelCollapsed=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async componentWillLoad(){var t;this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(null===(t=this.mapView)||void 0===t?void 0:t.when((async()=>{await this.setMapView()})))}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(e,null,this._reportSubmitted&&s("calcite-alert",{"auto-close":!0,class:t+" report-submitted-msg",icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},s("div",{slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{"auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{slot:"title"},this._translations.error),s("div",{slot:"message"},this._featureCreationFailedErrorMsg)),s("div",null,s("calcite-shell",{"content-behind":!0},this._getReporter())))}async _initModules(){const[t]=await a(["esri/core/reactiveUtils"]);this.reactiveUtils=t}setSelectedLayer(t,i){this._selectedLayerId=t,this._selectedLayerName=i,this._validLayers.forEach((i=>{i.set("visible",!t||i.id===t)}))}_getReporter(){const t=[];return this._flowItems.forEach((i=>{switch(i){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,(null==t?void 0:t.length)>0&&t):s("calcite-loader",{label:"",scale:"m"}))}getLayerListFlowItem(){var t;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader},this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"solid",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("layer-list",{class:"height-full",layers:(null===(t=this._editableLayerIds)||void 0===t?void 0:t.length)>0?this._editableLayerIds:this.layers,mapView:this.mapView,noLayerErrorMsg:this._noLayerToDisplayErrorMsg,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),ref:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-panel",{"full-height":!0,"full-width":!0},s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.chooseCategoryMsg)),s("layer-list",{class:"height-full",layers:this.layers,mapView:this.mapView,noLayerErrorMsg:this._noLayerToDisplayErrorMsg,onLayerSelect:this.navigateToCreateFeature.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.featureEditFormInfoMsg)),s("create-feature",{customizeSubmit:!0,mapView:this.mapView,onDrawComplete:this.onDrawComplete.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.bind(this),onSuccess:this.onReportSubmitted.bind(this),ref:t=>this._createFeature=t,searchConfiguration:this.searchConfiguration,selectedLayerId:this._selectedLayerId})))}onDrawComplete(){this._showSubmitCancelButton=!0}showSubmitCancelButton(t){this._showSubmitCancelButton=!t.detail}onSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this._createFeature.close(),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}onReportSubmitted(){this._reportSubmitted=!0,this.navigateToHomePage()}async navigateToHomePage(){this._createFeature&&this._createFeature.close(),this._layerList&&this._layerList.refresh(),this.setSelectedFeatures([]),1===this._editableLayerIds.length?(await this._featureList.refresh(),this._flowItems=["feature-list"]):this._flowItems=["layer-list"]}async navigateToCreateFeature(t){t.detail.layerId&&t.detail.layerName&&this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._showSubmitCancelButton=!1,this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this._flowItems=[...this._flowItems,"reporting-layer-list"]}async layerListLoaded(t){const i=t.detail,s=await l(this.mapView);this._validLayers=[],s.forEach((t=>{i.includes(t.id)&&this._validLayers.push(t)})),this.handleMapClick(),this._hasValidLayers=i.length>0,this._urlParamsLoaded||(this._urlParamsLoaded=!0,await this.loadFeatureFromURLParams())}displayFeaturesList(t){this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._flowItems=[...this._flowItems,"feature-list"]}backFromSelectedPanel(){const t=[...this._flowItems];t.pop(),this.clearHighlights(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit(this._sidePanelCollapsed)}async onFeatureSelectFromList(t){this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}getFeatureListFlowItem(t,i){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&s("calcite-button",{appearance:"solid",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{class:"height-full",highlightOnHover:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,selectedLayerId:t})))}getFeatureDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("instant-apps-social-share",{autoUpdateShareUrl:!1,embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,mapView:this.mapView,onSelectionChanged:this.featureDetailsChanged.bind(this),zoomAndScrollToSelected:!0})))}setSelectedFeatures(t){this._selectedFeature=t,this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}setCurrentFeature(t){if(t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField]}else this._editableLayerIds.length>1&&this.setSelectedLayer("",""),this._currentFeatureId="";this._updateShareURL()}featureDetailsChanged(t){this.setCurrentFeature(t.detail[0]),this.highlightOnMap(t.detail[0])}async highlightOnMap(t){if(this.clearHighlights(),t&&t.geometry&&t.layer){const i=await c(this.mapView,t.layer.id);i.highlightOptions=null,this._highlightHandle=await n([t.getObjectId()],i,this.mapView,!0)}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){var t;await this.getLayersToShowInList(),1===(null===(t=this._editableLayerIds)||void 0===t?void 0:t.length)?await this.renderFeaturesList():this._flowItems=["layer-list"],this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const i=await this.mapView.hitTest(t);if(i.results.length>0){const t=[];i.results.forEach((function(i){"graphic"===i.type&&t.push(i.graphic)}));const s=t.filter((t=>this._validLayers.includes(t.layer))),e=t.filter((t=>{var i;return!this._validLayers.includes(t.layer)&&(null===(i=null==t?void 0:t.layer)||void 0===i?void 0:i.id)}));if(s.length>0&&(this.setSelectedFeatures(s),this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?this._flowItems=[...this._flowItems,"feature-details"]:(this._flowItems=[...this._flowItems],this.highlightOnMap(t[0]))),e.length>0){this.mapView.popupEnabled=!0;const t={features:e,updateLocationEnabled:!0};await this.mapView.openPopup(t)}}}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}reduceToConfiguredLayers(t){var i;const s=(null===(i=this.layers)||void 0===i?void 0:i.length)>0?this.layers:[];return Object.keys(t).reduce(((i,e)=>{let h=t[e].supportsAdd;return(null==s?void 0:s.length)>0&&(h=s.indexOf(e)>-1&&t[e].supportsAdd),h&&i.push(e),i}),[])}async getLayersToShowInList(){const t=await r(this.mapView,!0);(await l(this.mapView)).forEach((i=>{var s,e;"feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.supportsAdd)&&(t[i.id].supportsAdd=!0)})),this._editableLayerIds=this.reduceToConfiguredLayers(t)}async renderFeaturesList(){const t={detail:this._editableLayerIds};await this.layerListLoaded(t),this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this._flowItems=["feature-list"]}_updateShareURL(){var t,i;const s=null===(t=this._shareNode)||void 0===t?void 0:t.shareUrl;if(!s)return;const e=new URL(s);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),(null===(i=this._selectedFeature)||void 0===i?void 0:i.length)?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.href}async loadFeatureFromURLParams(){if(this.center&&this.level&&await this.mapView.goTo({center:this.center.split(";").map(Number),zoom:this.level}),this.layerId&&this.objectId){const t=await d(this.mapView,this.layerId);if(t){const i=await u([Number(this.objectId)],t,[],!0,this.mapView.spatialReference);i.length&&(this._selectedFeature=i,this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems],await this.highlightOnMap(i[0]))}}}get el(){return h(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};p.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.report-submitted-msg{position:absolute;z-index:1000}";export{p as crowdsource_reporter}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{r as t,c as e,h as i,F as s,g as o,f as n,H as a}from"./p-7d280d8a.js";import{g as r}from"./p-fc9fe5fb.js";import{t as l,i as c,e as h,f as d,q as p}from"./p-3dd92f0d.js";import{g as f}from"./p-5a9a971a.js";import{i as m}from"./p-e7afc0a8.js";import{s as u,a as v,c as b}from"./p-a4149333.js";import{a as g,C as x,I as w,S as y}from"./p-4c5d243f.js";import{f as k,c as E,b as H,a as z,r as P,F as C}from"./p-db53bde3.js";import{d as D,a as j,c as I,u as A}from"./p-d7b02d3a.js";import{o as M}from"./p-2b0454a0.js";import{H as L}from"./p-76bd5032.js";import{c as O,d as B}from"./p-13f2d901.js";import{u as F,c as S,s as $,d as R}from"./p-05cb50f9.js";import{c as T}from"./p-1f65ab1e.js";import{F as _}from"./p-201a6ea3.js";import{g as U}from"./p-495e7b9d.js";import"./p-7c2be8cc.js";import"./p-a82f35c9.js";const W=["ArrowUp","ArrowDown","End","Home"],X=class{constructor(i){t(this,i),this.calciteActionMenuOpen=e(this,"calciteActionMenuOpen",6),this.actionElements=[],this.guid=`calcite-action-menu-${f()}`,this.menuId=`${this.guid}-menu`,this.menuButtonId=`${this.guid}-menu-button`,this.connectMenuButtonEl=()=>{const{menuButtonId:t,menuId:e,open:i,label:s}=this,o=this.slottedMenuButtonEl||this.defaultMenuButtonEl;this.menuButtonEl!==o&&(this.disconnectMenuButtonEl(),this.menuButtonEl=o,this.setTooltipReferenceElement(),o&&(o.active=i,o.setAttribute("aria-controls",e),o.setAttribute("aria-expanded",l(i)),o.setAttribute("aria-haspopup","true"),o.id||(o.id=t),o.label||(o.label=s),o.text||(o.text=s),o.addEventListener("pointerdown",this.menuButtonClick),o.addEventListener("keydown",this.menuButtonKeyDown)))},this.disconnectMenuButtonEl=()=>{const{menuButtonEl:t}=this;t&&(t.removeEventListener("pointerdown",this.menuButtonClick),t.removeEventListener("keydown",this.menuButtonKeyDown))},this.setMenuButtonEl=t=>{const e=t.target.assignedElements({flatten:!0}).filter((t=>null==t?void 0:t.matches("calcite-action")));this.slottedMenuButtonEl=e[0],this.connectMenuButtonEl()},this.setDefaultMenuButtonEl=t=>{this.defaultMenuButtonEl=t,this.connectMenuButtonEl()},this.handleCalciteActionClick=()=>{this.open=!1,this.setFocus()},this.menuButtonClick=t=>{c(t)&&this.toggleOpen()},this.updateTooltip=t=>{const e=t.target.assignedElements({flatten:!0}).filter((t=>null==t?void 0:t.matches("calcite-tooltip")));this.tooltipEl=e[0],this.setTooltipReferenceElement()},this.setTooltipReferenceElement=()=>{const{tooltipEl:t,expanded:e,menuButtonEl:i,open:s}=this;t&&(t.referenceElement=e||s?null:i)},this.updateAction=(t,e)=>{const{guid:i,activeMenuItemIndex:s}=this,o=`${i}-action-${e}`;t.tabIndex=-1,t.setAttribute("role","menuitem"),t.id||(t.id=o),t.toggleAttribute(g,e===s)},this.updateActions=t=>{null==t||t.forEach(this.updateAction)},this.handleDefaultSlotChange=t=>{const e=t.target.assignedElements({flatten:!0}).reduce(((t,e)=>(null==e?void 0:e.matches("calcite-action"))?(t.push(e),t):(null==e?void 0:e.matches("calcite-action-group"))?t.concat(Array.from(e.querySelectorAll("calcite-action"))):t),[]);this.actionElements=e.filter((t=>!t.disabled&&!t.hidden))},this.menuButtonKeyDown=t=>{const{key:e}=t,{actionElements:i,activeMenuItemIndex:s,open:o}=this;if(i.length){if(m(e)){if(t.preventDefault(),!o)return void this.toggleOpen();const e=i[s];e?e.click():this.toggleOpen(!1)}if("Tab"!==e)return"Escape"===e?(this.toggleOpen(!1),void t.preventDefault()):void this.handleActionNavigation(t,e,i);this.open=!1}},this.handleActionNavigation=(t,e,i)=>{if(!this.isValidKey(e,W))return;if(t.preventDefault(),!this.open)return this.toggleOpen(),"Home"!==e&&"ArrowDown"!==e||(this.activeMenuItemIndex=0),void("End"!==e&&"ArrowUp"!==e||(this.activeMenuItemIndex=i.length-1));"Home"===e&&(this.activeMenuItemIndex=0),"End"===e&&(this.activeMenuItemIndex=i.length-1);const s=this.activeMenuItemIndex;"ArrowUp"===e&&(this.activeMenuItemIndex=r(Math.max(s-1,-1),i.length)),"ArrowDown"===e&&(this.activeMenuItemIndex=r(s+1,i.length))},this.toggleOpenEnd=()=>{this.setFocus(),this.el.removeEventListener("calcitePopoverOpen",this.toggleOpenEnd)},this.toggleOpen=(t=!this.open)=>{this.el.addEventListener("calcitePopoverOpen",this.toggleOpenEnd),this.open=t},this.handlePopoverOpen=()=>{this.open=!0},this.handlePopoverClose=()=>{this.open=!1},this.appearance="solid",this.expanded=!1,this.flipPlacements=void 0,this.label=void 0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.scale=void 0,this.menuButtonEl=void 0,this.activeMenuItemIndex=-1}connectedCallback(){this.connectMenuButtonEl()}componentWillLoad(){u(this)}componentDidLoad(){v(this)}disconnectedCallback(){this.disconnectMenuButtonEl()}expandedHandler(){this.open=!1,this.setTooltipReferenceElement()}openHandler(t){this.activeMenuItemIndex=this.open?0:-1,this.menuButtonEl&&(this.menuButtonEl.active=t),this.calciteActionMenuOpen.emit(),this.setTooltipReferenceElement()}activeMenuItemIndexHandler(){this.updateActions(this.actionElements)}async setFocus(){return await b(this),h(this.menuButtonEl)}renderMenuButton(){const{appearance:t,label:e,scale:s,expanded:o}=this;return i("slot",{name:y.trigger,onSlotchange:this.setMenuButtonEl},i("calcite-action",{appearance:t,class:x.defaultTrigger,icon:w.menu,scale:s,text:e,textEnabled:o,ref:this.setDefaultMenuButtonEl}))}renderMenuItems(){const{actionElements:t,activeMenuItemIndex:e,open:s,menuId:o,menuButtonEl:n,label:a,placement:r,overlayPositioning:l,flipPlacements:c}=this,h=t[e];return i("calcite-popover",{autoClose:!0,flipPlacements:c,focusTrapDisabled:!0,label:a,offsetDistance:0,onCalcitePopoverClose:this.handlePopoverClose,onCalcitePopoverOpen:this.handlePopoverOpen,open:s,overlayPositioning:l,placement:r,pointerDisabled:!0,referenceElement:n},i("div",{"aria-activedescendant":(null==h?void 0:h.id)||null,"aria-labelledby":null==n?void 0:n.id,class:x.menu,id:o,onClick:this.handleCalciteActionClick,role:"menu",tabIndex:-1},i("slot",{onSlotchange:this.handleDefaultSlotChange})))}render(){return i(s,null,this.renderMenuButton(),this.renderMenuItems(),i("slot",{name:y.tooltip,onSlotchange:this.updateTooltip}))}isValidKey(t,e){return!!e.find((e=>e===t))}get el(){return o(this)}static get watchers(){return{expanded:["expandedHandler"],open:["openHandler"],activeMenuItemIndex:["activeMenuItemIndexHandler"]}}};X.style=":host{box-sizing:border-box;display:flex;flex-direction:column;font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-2)}::slotted(calcite-action-group){border-block-end:1px solid var(--calcite-color-border-3)}::slotted(calcite-action-group:last-child){border-block-end:0}.default-trigger{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}slot[name=trigger]::slotted(calcite-action),calcite-action::slotted([slot=trigger]){position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}.menu{max-block-size:45vh;flex-direction:column;flex-wrap:nowrap;overflow-y:auto;overflow-x:hidden;outline:2px solid transparent;outline-offset:2px}:host([hidden]){display:none}[hidden]{display:none}";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.4.0
|
11
|
-
*/
|
12
|
-
const Y="close-button-container",q="header",K="aria-controls",V="aria-expanded",G=new
|
13
|
-
/*!
|
14
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
15
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
16
|
-
* v2.4.0
|
17
|
-
*/
|
18
|
-
class{constructor(){this.registeredElements=new Map,this.registeredElementCount=0,this.queryPopover=t=>{const{registeredElements:e}=this,i=t.find((t=>e.has(t)));return e.get(i)},this.togglePopovers=t=>{const e=t.composedPath(),i=this.queryPopover(e);i&&!i.triggerDisabled&&(i.open=!i.open),Array.from(this.registeredElements.values()).filter((t=>t!==i&&t.autoClose&&t.open&&!e.includes(t))).forEach((t=>t.open=!1))},this.keyHandler=t=>{t.defaultPrevented||("Escape"===t.key?this.closeAllPopovers():m(t.key)&&this.togglePopovers(t))},this.clickHandler=t=>{c(t)&&this.togglePopovers(t)}}registerElement(t,e){this.registeredElementCount++,this.registeredElements.set(t,e),1===this.registeredElementCount&&this.addListeners()}unregisterElement(t){this.registeredElements.delete(t)&&this.registeredElementCount--,0===this.registeredElementCount&&this.removeListeners()}closeAllPopovers(){Array.from(this.registeredElements.values()).forEach((t=>t.open=!1))}addListeners(){window.addEventListener("pointerdown",this.clickHandler,{capture:!0}),window.addEventListener("keydown",this.keyHandler,{capture:!0})}removeListeners(){window.removeEventListener("pointerdown",this.clickHandler,{capture:!0}),window.removeEventListener("keydown",this.keyHandler,{capture:!0})}},J=class{constructor(i){t(this,i),this.calcitePopoverBeforeClose=e(this,"calcitePopoverBeforeClose",6),this.calcitePopoverClose=e(this,"calcitePopoverClose",6),this.calcitePopoverBeforeOpen=e(this,"calcitePopoverBeforeOpen",6),this.calcitePopoverOpen=e(this,"calcitePopoverOpen",6),this.mutationObserver=T("mutation",(()=>this.updateFocusTrapElements())),this.guid=`calcite-popover-${f()}`,this.openTransitionProp="opacity",this.hasLoaded=!1,this.setTransitionEl=t=>{this.transitionEl=t},this.setFilteredPlacements=()=>{const{el:t,flipPlacements:e}=this;this.filteredFlipPlacements=e?k(e,t):null},this.setUpReferenceElement=(t=!0)=>{this.removeReferences(),this.effectiveReferenceElement=this.getReferenceElement(),E(this,this.effectiveReferenceElement,this.el);const{el:e,referenceElement:i,effectiveReferenceElement:s}=this;t&&i&&!s&&console.warn(`${e.tagName}: reference-element id "${i}" was not found.`,{el:e}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.setExpandedAttr=()=>{const{effectiveReferenceElement:t,open:e}=this;t&&"setAttribute"in t&&t.setAttribute(V,l(e))},this.addReferences=()=>{const{effectiveReferenceElement:t}=this;if(!t)return;const e=this.getId();"setAttribute"in t&&t.setAttribute(K,e),G.registerElement(t,this.el),this.setExpandedAttr()},this.removeReferences=()=>{const{effectiveReferenceElement:t}=this;t&&("removeAttribute"in t&&(t.removeAttribute(K),t.removeAttribute(V)),G.unregisterElement(t))},this.hide=()=>{this.open=!1},this.storeArrowEl=t=>{this.arrowEl=t,this.reposition(!0)},this.autoClose=!1,this.closable=!1,this.flipDisabled=!1,this.focusTrapDisabled=!1,this.pointerDisabled=!1,this.flipPlacements=void 0,this.heading=void 0,this.headingLevel=void 0,this.label=void 0,this.messageOverrides=void 0,this.messages=void 0,this.offsetDistance=H,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.referenceElement=void 0,this.scale="m",this.triggerDisabled=!1,this.effectiveLocale="",this.floatingLayout="vertical",this.effectiveReferenceElement=void 0,this.defaultMessages=void 0}handleFocusTrapDisabled(t){this.open&&(t?D(this):j(this))}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}onMessagesChange(){}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(){M(this),this.reposition(!0),this.setExpandedAttr()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement(),this.reposition(!0)}effectiveLocaleChange(){F(this,this.effectiveLocale)}connectedCallback(){this.setFilteredPlacements(),O(this),S(this),this.setUpReferenceElement(this.hasLoaded),I(this),this.open&&M(this),E(this,this.effectiveReferenceElement,this.el)}async componentWillLoad(){await $(this),u(this)}componentDidLoad(){v(this),this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),B(this),R(this),z(this,this.effectiveReferenceElement,this.el),D(this)}async reposition(t=!1){const{el:e,effectiveReferenceElement:i,placement:s,overlayPositioning:o,flipDisabled:n,filteredFlipPlacements:a,offsetDistance:r,offsetSkidding:l,arrowEl:c}=this;return P(this,{floatingEl:e,referenceEl:i,overlayPositioning:o,placement:s,flipDisabled:n,flipPlacements:a,offsetDistance:r,offsetSkidding:l,arrowEl:c,type:"popover"},t)}async setFocus(){await b(this),n(this.el),d(this.el)}async updateFocusTrapElements(){A(this)}getReferenceElement(){const{referenceElement:t,el:e}=this;return("string"==typeof t?p(e,{id:t}):t)||null}onBeforeOpen(){this.calcitePopoverBeforeOpen.emit()}onOpen(){this.calcitePopoverOpen.emit(),j(this)}onBeforeClose(){this.calcitePopoverBeforeClose.emit()}onClose(){this.calcitePopoverClose.emit(),D(this)}renderCloseButton(){const{messages:t,closable:e}=this;return e?i("div",{class:Y,key:Y},i("calcite-action",{appearance:"transparent",class:"close-button",onClick:this.hide,scale:this.scale,text:t.close,ref:t=>this.closeButtonEl=t},i("calcite-icon",{icon:"x",scale:U(this.scale)}))):null}renderHeader(){const{heading:t,headingLevel:e}=this,s=t?i(L,{class:"heading",level:e},t):null;return s?i("div",{class:q,key:q},s,this.renderCloseButton()):null}render(){const{effectiveReferenceElement:t,heading:e,label:s,open:o,pointerDisabled:n,floatingLayout:r}=this,c=t&&o,h=!c,d=n?null:i(_,{floatingLayout:r,key:"floating-arrow",ref:this.storeArrowEl});return i(a,{"aria-hidden":l(h),"aria-label":s,"aria-live":"polite","calcite-hydrated-hidden":h,id:this.getId(),role:"dialog"},i("div",{class:{[C.animation]:!0,[C.animationActive]:c},ref:this.setTransitionEl},d,i("div",{class:{"has-header":!!e,container:!0}},this.renderHeader(),i("div",{class:"content"},i("slot",null)),e?null:this.renderCloseButton())))}static get assetsDirs(){return["assets"]}get el(){return o(this)}static get watchers(){return{focusTrapDisabled:["handleFocusTrapDisabled"],flipPlacements:["flipPlacementsHandler"],messageOverrides:["onMessagesChange"],offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"],effectiveLocale:["effectiveLocaleChange"]}}};J.style=":host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, var(--calcite-z-index-popup));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-z-index) * -1);fill:var(--calcite-color-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-color-border-3)}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.arrow::before{outline:1px solid var(--calcite-color-border-3)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-color-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;color:var(--calcite-color-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}:host([hidden]){display:none}[hidden]{display:none}";export{X as calcite_action_menu,J as calcite_popover}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
import{a as n}from"./p-7d280d8a.js";import{e as o}from"./p-94de9279.js";import{g as s}from"./p-13f2d901.js";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.4.0
|
11
|
-
*/const t={},a={};async function r(o){const e=s(o);if(t[e])return t[e];a[e]||(a[e]=fetch(n(`./assets/date-picker/nls/${e}.json`)).then((n=>n.json())).catch((()=>(console.error(`Translations for "${e}" not found or invalid, falling back to english`),r("en")))));const i=await a[e];return t[e]=i,i}function e(n){return n.map(((n,s)=>o(n,1===s)))}export{r as a,e as g}
|