@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,412 @@
|
|
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 { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers.js';
|
7
|
+
import { getAssetPath } from '@stencil/core/internal/client';
|
8
|
+
|
9
|
+
var esriLoader = createCommonjsModule(function (module, exports) {
|
10
|
+
(function (global, factory) {
|
11
|
+
factory(exports) ;
|
12
|
+
}(commonjsGlobal, (function (exports) {
|
13
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
14
|
+
* Apache-2.0 */
|
15
|
+
var isBrowser = typeof window !== 'undefined';
|
16
|
+
// allow consuming libraries to provide their own Promise implementations
|
17
|
+
var utils = {
|
18
|
+
Promise: isBrowser ? window['Promise'] : undefined
|
19
|
+
};
|
20
|
+
|
21
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
22
|
+
* Apache-2.0 */
|
23
|
+
var DEFAULT_VERSION = '4.22';
|
24
|
+
var NEXT = 'next';
|
25
|
+
function parseVersion(version) {
|
26
|
+
if (version.toLowerCase() === NEXT) {
|
27
|
+
return NEXT;
|
28
|
+
}
|
29
|
+
var match = version && version.match(/^(\d)\.(\d+)/);
|
30
|
+
return match && {
|
31
|
+
major: parseInt(match[1], 10),
|
32
|
+
minor: parseInt(match[2], 10)
|
33
|
+
};
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* Get the CDN url for a given version
|
37
|
+
*
|
38
|
+
* @param version Ex: '4.22' or '3.39'. Defaults to the latest 4.x version.
|
39
|
+
*/
|
40
|
+
function getCdnUrl(version) {
|
41
|
+
if (version === void 0) { version = DEFAULT_VERSION; }
|
42
|
+
return "https://js.arcgis.com/" + version + "/";
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Get the CDN url for a the CSS for a given version and/or theme
|
46
|
+
*
|
47
|
+
* @param version Ex: '4.22', '3.39', or 'next'. Defaults to the latest 4.x version.
|
48
|
+
*/
|
49
|
+
function getCdnCssUrl(version) {
|
50
|
+
if (version === void 0) { version = DEFAULT_VERSION; }
|
51
|
+
var baseUrl = getCdnUrl(version);
|
52
|
+
var parsedVersion = parseVersion(version);
|
53
|
+
if (parsedVersion !== NEXT && parsedVersion.major === 3) {
|
54
|
+
// NOTE: at 3.11 the CSS moved from the /js folder to the root
|
55
|
+
var path = parsedVersion.minor <= 10 ? 'js/' : '';
|
56
|
+
return "" + baseUrl + path + "esri/css/esri.css";
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
// assume 4.x
|
60
|
+
return baseUrl + "esri/themes/light/main.css";
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
65
|
+
* Apache-2.0 */
|
66
|
+
function createStylesheetLink(href) {
|
67
|
+
var link = document.createElement('link');
|
68
|
+
link.rel = 'stylesheet';
|
69
|
+
link.href = href;
|
70
|
+
return link;
|
71
|
+
}
|
72
|
+
function insertLink(link, before) {
|
73
|
+
if (before) {
|
74
|
+
// the link should be inserted before a specific node
|
75
|
+
var beforeNode = document.querySelector(before);
|
76
|
+
beforeNode.parentNode.insertBefore(link, beforeNode);
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
// append the link to then end of the head tag
|
80
|
+
document.head.appendChild(link);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
// check if the css url has been injected or added manually
|
84
|
+
function getCss(url) {
|
85
|
+
return document.querySelector("link[href*=\"" + url + "\"]");
|
86
|
+
}
|
87
|
+
function getCssUrl(urlOrVersion) {
|
88
|
+
return !urlOrVersion || parseVersion(urlOrVersion)
|
89
|
+
// if it's a valid version string return the CDN URL
|
90
|
+
? getCdnCssUrl(urlOrVersion)
|
91
|
+
// otherwise assume it's a URL and return that
|
92
|
+
: urlOrVersion;
|
93
|
+
}
|
94
|
+
// lazy load the CSS needed for the ArcGIS API
|
95
|
+
function loadCss(urlOrVersion, before) {
|
96
|
+
var url = getCssUrl(urlOrVersion);
|
97
|
+
var link = getCss(url);
|
98
|
+
if (!link) {
|
99
|
+
// create & load the css link
|
100
|
+
link = createStylesheetLink(url);
|
101
|
+
insertLink(link, before);
|
102
|
+
}
|
103
|
+
return link;
|
104
|
+
}
|
105
|
+
|
106
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
107
|
+
* Apache-2.0 */
|
108
|
+
var defaultOptions = {};
|
109
|
+
function createScript(url) {
|
110
|
+
var script = document.createElement('script');
|
111
|
+
script.type = 'text/javascript';
|
112
|
+
script.src = url;
|
113
|
+
script.setAttribute('data-esri-loader', 'loading');
|
114
|
+
return script;
|
115
|
+
}
|
116
|
+
// add a one-time load handler to script
|
117
|
+
// and optionally add a one time error handler as well
|
118
|
+
function handleScriptLoad(script, callback, errback) {
|
119
|
+
var onScriptError;
|
120
|
+
if (errback) {
|
121
|
+
// set up an error handler as well
|
122
|
+
onScriptError = handleScriptError(script, errback);
|
123
|
+
}
|
124
|
+
var onScriptLoad = function () {
|
125
|
+
// pass the script to the callback
|
126
|
+
callback(script);
|
127
|
+
// remove this event listener
|
128
|
+
script.removeEventListener('load', onScriptLoad, false);
|
129
|
+
if (onScriptError) {
|
130
|
+
// remove the error listener as well
|
131
|
+
script.removeEventListener('error', onScriptError, false);
|
132
|
+
}
|
133
|
+
};
|
134
|
+
script.addEventListener('load', onScriptLoad, false);
|
135
|
+
}
|
136
|
+
// add a one-time error handler to the script
|
137
|
+
function handleScriptError(script, callback) {
|
138
|
+
var onScriptError = function (e) {
|
139
|
+
// reject the promise and remove this event listener
|
140
|
+
callback(e.error || new Error("There was an error attempting to load " + script.src));
|
141
|
+
// remove this event listener
|
142
|
+
script.removeEventListener('error', onScriptError, false);
|
143
|
+
};
|
144
|
+
script.addEventListener('error', onScriptError, false);
|
145
|
+
return onScriptError;
|
146
|
+
}
|
147
|
+
// allow the user to configure default script options rather than passing options to `loadModules` each time
|
148
|
+
function setDefaultOptions(options) {
|
149
|
+
if (options === void 0) { options = {}; }
|
150
|
+
defaultOptions = options;
|
151
|
+
}
|
152
|
+
// get the script injected by this library
|
153
|
+
function getScript() {
|
154
|
+
return document.querySelector('script[data-esri-loader]');
|
155
|
+
}
|
156
|
+
// has ArcGIS API been loaded on the page yet?
|
157
|
+
function isLoaded() {
|
158
|
+
var globalRequire = window['require'];
|
159
|
+
// .on() ensures that it's Dojo's AMD loader
|
160
|
+
return globalRequire && globalRequire.on;
|
161
|
+
}
|
162
|
+
// load the ArcGIS API on the page
|
163
|
+
function loadScript(options) {
|
164
|
+
if (options === void 0) { options = {}; }
|
165
|
+
// we would have liked to use spread like { ...defaultOptions, ...options }
|
166
|
+
// but TS would inject a polyfill that would require use to configure rollup w content: 'window'
|
167
|
+
// if we have another occasion to use spread, let's do that and replace this for...in
|
168
|
+
var opts = {};
|
169
|
+
[defaultOptions, options].forEach(function (obj) {
|
170
|
+
for (var prop in obj) {
|
171
|
+
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
172
|
+
opts[prop] = obj[prop];
|
173
|
+
}
|
174
|
+
}
|
175
|
+
});
|
176
|
+
// URL to load
|
177
|
+
var version = opts.version;
|
178
|
+
var url = opts.url || getCdnUrl(version);
|
179
|
+
return new utils.Promise(function (resolve, reject) {
|
180
|
+
var script = getScript();
|
181
|
+
if (script) {
|
182
|
+
// the API is already loaded or in the process of loading...
|
183
|
+
// NOTE: have to test against scr attribute value, not script.src
|
184
|
+
// b/c the latter will return the full url for relative paths
|
185
|
+
var src = script.getAttribute('src');
|
186
|
+
if (src !== url) {
|
187
|
+
// potentially trying to load a different version of the API
|
188
|
+
reject(new Error("The ArcGIS API for JavaScript is already loaded (" + src + ")."));
|
189
|
+
}
|
190
|
+
else {
|
191
|
+
if (isLoaded()) {
|
192
|
+
// the script has already successfully loaded
|
193
|
+
resolve(script);
|
194
|
+
}
|
195
|
+
else {
|
196
|
+
// wait for the script to load and then resolve
|
197
|
+
handleScriptLoad(script, resolve, reject);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
else {
|
202
|
+
if (isLoaded()) {
|
203
|
+
// the API has been loaded by some other means
|
204
|
+
// potentially trying to load a different version of the API
|
205
|
+
reject(new Error("The ArcGIS API for JavaScript is already loaded."));
|
206
|
+
}
|
207
|
+
else {
|
208
|
+
// this is the first time attempting to load the API
|
209
|
+
var css = opts.css;
|
210
|
+
if (css) {
|
211
|
+
var useVersion = css === true;
|
212
|
+
// load the css before loading the script
|
213
|
+
loadCss(useVersion ? version : css, opts.insertCssBefore);
|
214
|
+
}
|
215
|
+
// create a script object whose source points to the API
|
216
|
+
script = createScript(url);
|
217
|
+
// _currentUrl = url;
|
218
|
+
// once the script is loaded...
|
219
|
+
handleScriptLoad(script, function () {
|
220
|
+
// update the status of the script
|
221
|
+
script.setAttribute('data-esri-loader', 'loaded');
|
222
|
+
// return the script
|
223
|
+
resolve(script);
|
224
|
+
}, reject);
|
225
|
+
// load the script
|
226
|
+
document.body.appendChild(script);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
});
|
230
|
+
}
|
231
|
+
|
232
|
+
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
233
|
+
* Apache-2.0 */
|
234
|
+
// wrap Dojo's require() in a promise
|
235
|
+
function requireModules(modules) {
|
236
|
+
return new utils.Promise(function (resolve, reject) {
|
237
|
+
// If something goes wrong loading the esri/dojo scripts, reject with the error.
|
238
|
+
var errorHandler = window['require'].on('error', reject);
|
239
|
+
window['require'](modules, function () {
|
240
|
+
var args = [];
|
241
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
242
|
+
args[_i] = arguments[_i];
|
243
|
+
}
|
244
|
+
// remove error handler
|
245
|
+
errorHandler.remove();
|
246
|
+
// Resolve with the parameters from dojo require as an array.
|
247
|
+
resolve(args);
|
248
|
+
});
|
249
|
+
});
|
250
|
+
}
|
251
|
+
// returns a promise that resolves with an array of the required modules
|
252
|
+
// also will attempt to lazy load the ArcGIS API if it has not already been loaded
|
253
|
+
function loadModules(modules, loadScriptOptions) {
|
254
|
+
if (loadScriptOptions === void 0) { loadScriptOptions = {}; }
|
255
|
+
if (!isLoaded()) {
|
256
|
+
// script is not yet loaded, is it in the process of loading?
|
257
|
+
var script = getScript();
|
258
|
+
var src = script && script.getAttribute('src');
|
259
|
+
if (!loadScriptOptions.url && src) {
|
260
|
+
// script is still loading and user did not specify a URL
|
261
|
+
// in this case we want to default to the URL that's being loaded
|
262
|
+
// instead of defaulting to the latest 4.x URL
|
263
|
+
loadScriptOptions.url = src;
|
264
|
+
}
|
265
|
+
// attempt to load the script then load the modules
|
266
|
+
return loadScript(loadScriptOptions).then(function () { return requireModules(modules); });
|
267
|
+
}
|
268
|
+
else {
|
269
|
+
// script is already loaded, just load the modules
|
270
|
+
return requireModules(modules);
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
/*
|
275
|
+
Copyright (c) 2017 Esri
|
276
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
277
|
+
you may not use this file except in compliance with the License.
|
278
|
+
You may obtain a copy of the License at
|
279
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
280
|
+
Unless required by applicable law or agreed to in writing, software
|
281
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
282
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
283
|
+
See the License for the specific language governing permissions and
|
284
|
+
limitations under the License.
|
285
|
+
*/
|
286
|
+
// re-export the functions that are part of the public API
|
287
|
+
|
288
|
+
exports.utils = utils;
|
289
|
+
exports.loadModules = loadModules;
|
290
|
+
exports.getScript = getScript;
|
291
|
+
exports.isLoaded = isLoaded;
|
292
|
+
exports.loadScript = loadScript;
|
293
|
+
exports.setDefaultOptions = setDefaultOptions;
|
294
|
+
exports.loadCss = loadCss;
|
295
|
+
|
296
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
297
|
+
|
298
|
+
})));
|
299
|
+
//# sourceMappingURL=esri-loader.js.map
|
300
|
+
});
|
301
|
+
|
302
|
+
/*
|
303
|
+
* Copyright (c) 2022 Esri
|
304
|
+
* All rights reserved.
|
305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
306
|
+
* you may not use this file except in compliance with the License.
|
307
|
+
* You may obtain a copy of the License at
|
308
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
309
|
+
* Unless required by applicable law or agreed to in writing, software
|
310
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
311
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
312
|
+
* See the License for the specific language governing permissions and
|
313
|
+
* limitations under the License.
|
314
|
+
*/
|
315
|
+
const languageMap = new Map([
|
316
|
+
["ar", "ar"],
|
317
|
+
["bg", "bg"],
|
318
|
+
["bs", "bs"],
|
319
|
+
["ca", "ca"],
|
320
|
+
["cs", "cs"],
|
321
|
+
["da", "da"],
|
322
|
+
["de", "de"],
|
323
|
+
["el", "el"],
|
324
|
+
["en", "en"],
|
325
|
+
["es", "es"],
|
326
|
+
["et", "et"],
|
327
|
+
["fi", "fi"],
|
328
|
+
["fr", "fr"],
|
329
|
+
["he", "he"],
|
330
|
+
["hr", "hr"],
|
331
|
+
["hu", "hu"],
|
332
|
+
["id", "id"],
|
333
|
+
["it", "it"],
|
334
|
+
["ja", "ja"],
|
335
|
+
["ko", "ko"],
|
336
|
+
["lt", "lt"],
|
337
|
+
["lv", "lv"],
|
338
|
+
["nb", "nb"],
|
339
|
+
["nl", "nl"],
|
340
|
+
["pl", "pl"],
|
341
|
+
["pt-br", "pt-BR"],
|
342
|
+
["pt-pt", "pt-PT"],
|
343
|
+
["ro", "ro"],
|
344
|
+
["ru", "ru"],
|
345
|
+
["sk", "sk"],
|
346
|
+
["sl", "sl"],
|
347
|
+
["sr", "sr"],
|
348
|
+
["sv", "sv"],
|
349
|
+
["th", "th"],
|
350
|
+
["tr", "tr"],
|
351
|
+
["uk", "uk"],
|
352
|
+
["vi", "vi"],
|
353
|
+
["zh-cn", "zh-CN"],
|
354
|
+
["zh-hk", "zh-HK"],
|
355
|
+
["zh-tw", "zh-TW"],
|
356
|
+
]);
|
357
|
+
|
358
|
+
/** @license
|
359
|
+
* Copyright 2022 Esri
|
360
|
+
*
|
361
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
362
|
+
* you may not use this file except in compliance with the License.
|
363
|
+
* You may obtain a copy of the License at
|
364
|
+
*
|
365
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
366
|
+
*
|
367
|
+
* Unless required by applicable law or agreed to in writing, software
|
368
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
369
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
370
|
+
* See the License for the specific language governing permissions and
|
371
|
+
* limitations under the License.
|
372
|
+
*/
|
373
|
+
function getComponentClosestLanguage(element) {
|
374
|
+
var _a, _b, _c;
|
375
|
+
const closestElement = (_a = (element.closest("[lang]"))) !== null && _a !== void 0 ? _a : (_c = (_b = element.shadowRoot) === null || _b === void 0 ? void 0 : _b.ownerDocument) === null || _c === void 0 ? void 0 : _c.documentElement;
|
376
|
+
// language set by the calling application or browser. defaults to english.
|
377
|
+
const lang = ((closestElement === null || closestElement === void 0 ? void 0 : closestElement.lang) || (navigator === null || navigator === void 0 ? void 0 : navigator.language) || "en").toLowerCase();
|
378
|
+
if (languageMap.has(lang)) {
|
379
|
+
return languageMap.get(lang);
|
380
|
+
}
|
381
|
+
else {
|
382
|
+
// "ru-RU" maps to "ru" use case
|
383
|
+
return languageMap.has(lang.slice(0, 2)) ? languageMap.get(lang.slice(0, 2)) : "en";
|
384
|
+
}
|
385
|
+
}
|
386
|
+
function fetchLocaleStringsForComponent(componentName, locale) {
|
387
|
+
return new Promise((resolve, reject) => {
|
388
|
+
fetch(getAssetPath(`../assets/t9n/${componentName}/resources_${locale}.json`)).then(result => {
|
389
|
+
if (result.ok) {
|
390
|
+
resolve(result.json());
|
391
|
+
}
|
392
|
+
else {
|
393
|
+
reject();
|
394
|
+
}
|
395
|
+
}, () => reject());
|
396
|
+
});
|
397
|
+
}
|
398
|
+
async function getLocaleComponentStrings(element) {
|
399
|
+
const componentName = element.tagName.toLowerCase();
|
400
|
+
const componentLanguage = getComponentClosestLanguage(element);
|
401
|
+
let strings;
|
402
|
+
try {
|
403
|
+
strings = await fetchLocaleStringsForComponent(componentName, componentLanguage);
|
404
|
+
}
|
405
|
+
catch (e) {
|
406
|
+
console.warn(`no locale for ${componentName} (${componentLanguage}) loading default locale en.`);
|
407
|
+
strings = await fetchLocaleStringsForComponent(componentName, "en");
|
408
|
+
}
|
409
|
+
return [strings, componentLanguage];
|
410
|
+
}
|
411
|
+
|
412
|
+
export { esriLoader as e, getLocaleComponentStrings as g };
|