@esri/solutions-components 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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,51 @@
|
|
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
|
+
/*!
|
7
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
8
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
9
|
+
* v1.0.0-beta.97
|
10
|
+
*/
|
11
|
+
function noopClick() {
|
12
|
+
/** noop */
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* This helper updates the host element to prevent keyboard interaction on its subtree and sets the appropriate aria attribute for accessibility.
|
16
|
+
*
|
17
|
+
* This should be used in the `componentDidRender` lifecycle hook.
|
18
|
+
*
|
19
|
+
* **Notes**
|
20
|
+
*
|
21
|
+
* this util is not needed for simple components whose root element or elements are an interactive component (custom element or native control). For those cases, set the `disabled` props on the root components instead.
|
22
|
+
* technically, users can override `tabindex` and restore keyboard navigation, but this will be considered user error
|
23
|
+
*
|
24
|
+
* @param component
|
25
|
+
* @param hostIsTabbable
|
26
|
+
*/
|
27
|
+
function updateHostInteraction(component, hostIsTabbable = false) {
|
28
|
+
if (component.disabled) {
|
29
|
+
component.el.setAttribute("tabindex", "-1");
|
30
|
+
component.el.setAttribute("aria-disabled", "true");
|
31
|
+
if (component.el.contains(document.activeElement)) {
|
32
|
+
document.activeElement.blur();
|
33
|
+
}
|
34
|
+
component.el.click = noopClick;
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
component.el.click = HTMLElement.prototype.click;
|
38
|
+
if (typeof hostIsTabbable === "function") {
|
39
|
+
component.el.setAttribute("tabindex", hostIsTabbable.call(component) ? "0" : "-1");
|
40
|
+
}
|
41
|
+
else if (hostIsTabbable === true) {
|
42
|
+
component.el.setAttribute("tabindex", "0");
|
43
|
+
}
|
44
|
+
else if (hostIsTabbable === false) {
|
45
|
+
component.el.removeAttribute("tabindex");
|
46
|
+
}
|
47
|
+
else ;
|
48
|
+
component.el.removeAttribute("aria-disabled");
|
49
|
+
}
|
50
|
+
|
51
|
+
export { updateHostInteraction as u };
|
@@ -0,0 +1,19 @@
|
|
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
|
+
/*!
|
7
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
8
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
9
|
+
* v1.0.0-beta.97
|
10
|
+
*/
|
11
|
+
var StatusIcons;
|
12
|
+
(function (StatusIcons) {
|
13
|
+
StatusIcons["green"] = "checkCircle";
|
14
|
+
StatusIcons["yellow"] = "exclamationMarkTriangle";
|
15
|
+
StatusIcons["red"] = "exclamationMarkTriangle";
|
16
|
+
StatusIcons["blue"] = "lightbulb";
|
17
|
+
})(StatusIcons || (StatusIcons = {}));
|
18
|
+
|
19
|
+
export { StatusIcons as S };
|
@@ -0,0 +1,21 @@
|
|
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
|
+
/*!
|
7
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
8
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
9
|
+
* v1.0.0-beta.97
|
10
|
+
*/
|
11
|
+
var TreeSelectionMode;
|
12
|
+
(function (TreeSelectionMode) {
|
13
|
+
TreeSelectionMode["Single"] = "single";
|
14
|
+
TreeSelectionMode["Multi"] = "multi";
|
15
|
+
TreeSelectionMode["None"] = "none";
|
16
|
+
TreeSelectionMode["Children"] = "children";
|
17
|
+
TreeSelectionMode["MultiChildren"] = "multi-children";
|
18
|
+
TreeSelectionMode["Ancestors"] = "ancestors";
|
19
|
+
})(TreeSelectionMode || (TreeSelectionMode = {}));
|
20
|
+
|
21
|
+
export { TreeSelectionMode as T };
|
@@ -0,0 +1,80 @@
|
|
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
|
+
/** @license
|
7
|
+
* Copyright 2022 Esri
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
/**
|
22
|
+
* Resource update types
|
23
|
+
*/
|
24
|
+
var EUpdateType;
|
25
|
+
(function (EUpdateType) {
|
26
|
+
EUpdateType[EUpdateType["Add"] = 0] = "Add";
|
27
|
+
EUpdateType[EUpdateType["Update"] = 1] = "Update";
|
28
|
+
EUpdateType[EUpdateType["Remove"] = 2] = "Remove";
|
29
|
+
EUpdateType[EUpdateType["None"] = 3] = "None";
|
30
|
+
EUpdateType[EUpdateType["Obsolete"] = 4] = "Obsolete";
|
31
|
+
})(EUpdateType || (EUpdateType = {}));
|
32
|
+
var EExportType;
|
33
|
+
(function (EExportType) {
|
34
|
+
EExportType[EExportType["PDF"] = 0] = "PDF";
|
35
|
+
EExportType[EExportType["CSV"] = 1] = "CSV";
|
36
|
+
})(EExportType || (EExportType = {}));
|
37
|
+
var EPageType;
|
38
|
+
(function (EPageType) {
|
39
|
+
EPageType[EPageType["LIST"] = 0] = "LIST";
|
40
|
+
EPageType[EPageType["SELECT"] = 1] = "SELECT";
|
41
|
+
EPageType[EPageType["REFINE"] = 2] = "REFINE";
|
42
|
+
EPageType[EPageType["PDF"] = 3] = "PDF";
|
43
|
+
EPageType[EPageType["CSV"] = 4] = "CSV";
|
44
|
+
})(EPageType || (EPageType = {}));
|
45
|
+
var ERefineMode;
|
46
|
+
(function (ERefineMode) {
|
47
|
+
ERefineMode["ALL"] = "ALL";
|
48
|
+
ERefineMode["SUBSET"] = "SUBSET";
|
49
|
+
})(ERefineMode || (ERefineMode = {}));
|
50
|
+
var ESelectionMode;
|
51
|
+
(function (ESelectionMode) {
|
52
|
+
ESelectionMode["ADD"] = "ADD";
|
53
|
+
ESelectionMode["REMOVE"] = "REMOVE";
|
54
|
+
})(ESelectionMode || (ESelectionMode = {}));
|
55
|
+
var EWorkflowType;
|
56
|
+
(function (EWorkflowType) {
|
57
|
+
EWorkflowType["SEARCH"] = "SEARCH";
|
58
|
+
EWorkflowType["SELECT"] = "SELECT";
|
59
|
+
EWorkflowType["SKETCH"] = "SKETCH";
|
60
|
+
EWorkflowType["REFINE"] = "REFINE";
|
61
|
+
})(EWorkflowType || (EWorkflowType = {}));
|
62
|
+
var ESelectionType;
|
63
|
+
(function (ESelectionType) {
|
64
|
+
ESelectionType["POINT"] = "POINT";
|
65
|
+
ESelectionType["LINE"] = "LINE";
|
66
|
+
ESelectionType["POLY"] = "POLY";
|
67
|
+
ESelectionType["RECT"] = "RECT";
|
68
|
+
})(ESelectionType || (ESelectionType = {}));
|
69
|
+
var ESketchType;
|
70
|
+
(function (ESketchType) {
|
71
|
+
ESketchType["LAYER"] = "LAYER";
|
72
|
+
ESketchType["INTERACTIVE"] = "INTERACTIVE";
|
73
|
+
})(ESketchType || (ESketchType = {}));
|
74
|
+
var EExpandType;
|
75
|
+
(function (EExpandType) {
|
76
|
+
EExpandType["EXPAND"] = "EXPAND";
|
77
|
+
EExpandType["COLLAPSE"] = "COLLAPSE";
|
78
|
+
})(EExpandType || (EExpandType = {}));
|
79
|
+
|
80
|
+
export { EExpandType as E, EPageType as a, ESketchType as b, EWorkflowType as c, EExportType as d, ESelectionMode as e, ERefineMode as f, ESelectionType as g, EUpdateType as h };
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface JsonEditor extends Components.JsonEditor, HTMLElement {}
|
4
|
+
export const JsonEditor: {
|
5
|
+
prototype: JsonEditor;
|
6
|
+
new (): JsonEditor;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,11 @@
|
|
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 { J as JsonEditor$1, d as defineCustomElement$1 } from './json-editor2.js';
|
7
|
+
|
8
|
+
const JsonEditor = JsonEditor$1;
|
9
|
+
const defineCustomElement = defineCustomElement$1;
|
10
|
+
|
11
|
+
export { JsonEditor, defineCustomElement };
|
@@ -0,0 +1,441 @@
|
|
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 { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
7
|
+
import { g as getLocaleComponentStrings } from './locale.js';
|
8
|
+
import { d as defineCustomElement$3 } from './button.js';
|
9
|
+
import { d as defineCustomElement$2 } from './icon.js';
|
10
|
+
import { d as defineCustomElement$1 } from './loader.js';
|
11
|
+
|
12
|
+
const jsonEditorCss = ":host{display:block;box-sizing:border-box;margin-left:0.75rem;margin-right:0.75rem;min-width:0;flex-grow:0;flex-shrink:1}:host-group-1-up>.block{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}:host-group-2-up>.block{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}:host-group-3-up>.block{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}:host-group-4-up>.block{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}:host-group-5-up>.block{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}:host-group-6-up>.block{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}:host-group-7-up>.block{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}:host-group-8-up>.block{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.tablet-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.tablet-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.tablet-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.tablet-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.tablet-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.tablet-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.tablet-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.tablet-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.phone-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.phone-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.phone-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.phone-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.phone-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.phone-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.phone-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.phone-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.code-face :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:normal}.code-face :host b,.code-face :host strong{font-weight:400}.code-italic :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:italic}.code-italic :host b,.code-italic :host strong{font-weight:400}.editor-container{position:relative;height:100%}.editor-controls{height:2.75rem;padding-right:0.5rem;background-color:#F4F4F4}.editor-buttons{float:right}html[dir=rtl] .editor-buttons{float:left}.edit-error-flag{padding-top:0.5rem;color:red;visibility:hidden}.edit-button{-webkit-padding-start:0.5rem;padding-inline-start:0.5rem}.editor-text{width:100%;overflow-y:auto;background-color:#FFFFFF}.edit-width{width:100%}.edit-parent{box-sizing:border-box;width:100%;height:calc(100% - 46px)}.json-edit-container{height:100%;width:100%;border:1px #808080 solid}.padding-right{-webkit-padding-end:0.125rem;padding-inline-end:0.125rem}.btn{margin-bottom:1rem;display:flex;align-content:center;height:25px;width:120px}.select-ctrl{margin-bottom:1rem}.all-edits{margin-top:4rem}.floating-title{font-size:2rem;z-index:100;position:absolute;left:0.5rem;pointer-events:none}.floating-title-button{pointer-events:auto}.json-editor-position1{position:absolute;left:0px;top:0px;margin:0px;height:100%;width:100%;padding:0px;overflow:hidden;max-height:100% !important}.json-editor-position2a{position:absolute;left:0px;top:0px;margin:0px;height:100%;width:50%;padding:0px;overflow:hidden;max-height:100% !important}.json-editor-position2b{position:absolute;right:0px;top:0px;margin:0px;height:100%;width:50%;padding:0px;overflow:hidden;max-height:100% !important}";
|
13
|
+
|
14
|
+
const JsonEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
15
|
+
constructor() {
|
16
|
+
super();
|
17
|
+
this.__registerHost();
|
18
|
+
this._loaded = false;
|
19
|
+
this._useDiffEditor = false;
|
20
|
+
this.hasChanges = false;
|
21
|
+
this.hasErrors = false;
|
22
|
+
this.instanceid = "";
|
23
|
+
this.value = "";
|
24
|
+
}
|
25
|
+
//--------------------------------------------------------------------------
|
26
|
+
//
|
27
|
+
// Lifecycle
|
28
|
+
//
|
29
|
+
//--------------------------------------------------------------------------
|
30
|
+
/**
|
31
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
32
|
+
*/
|
33
|
+
componentDidLoad() {
|
34
|
+
const editorContainer = document.getElementById(`${this.instanceid}-container`);
|
35
|
+
if (editorContainer) {
|
36
|
+
this._editor = monaco.editor.create(editorContainer, {
|
37
|
+
value: this.value,
|
38
|
+
language: "json",
|
39
|
+
theme: "vs",
|
40
|
+
minimap: {
|
41
|
+
enabled: false
|
42
|
+
},
|
43
|
+
automaticLayout: true,
|
44
|
+
scrollBeyondLastLine: false
|
45
|
+
});
|
46
|
+
this._currentModel = this._editor.getModel();
|
47
|
+
this._contentChanged = this._currentModel.onDidChangeContent(this._onEditorChange.bind(this));
|
48
|
+
// Intercept the monaco function call that shows error markers to see if our content has errors
|
49
|
+
const setModelMarkers = monaco.editor.setModelMarkers;
|
50
|
+
const self = this;
|
51
|
+
monaco.editor.setModelMarkers = function (model, owner, markers) {
|
52
|
+
var _a, _b;
|
53
|
+
// If this call was for our model, it acts like an onEditorChange event
|
54
|
+
// but gives us access to the error state as well
|
55
|
+
if (model.id === self._currentModel.id) {
|
56
|
+
// Set the error state & dispatch event if state has changed
|
57
|
+
self._flagEditorHasErrors(markers.length > 0);
|
58
|
+
// Set the changed state & dispatch event if state has changed, but only if there are no errors
|
59
|
+
if (!self.hasErrors) {
|
60
|
+
self._flagEditorHasChanges((_a = self._currentModel) === null || _a === void 0 ? void 0 : _a.canUndo());
|
61
|
+
if ((_b = self._currentModel) === null || _b === void 0 ? void 0 : _b.canUndo()) {
|
62
|
+
self._flagEditorContentChanged();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
// Show the error flag if there are errors
|
66
|
+
const errorFlag = document.getElementById(`${self.instanceid}-errorFlag`);
|
67
|
+
errorFlag.style.visibility = self.hasErrors ? "visible" : "hidden";
|
68
|
+
}
|
69
|
+
// Pass on the call to the next editor in a chain of intercepts or, finally, to monaco
|
70
|
+
setModelMarkers.call(monaco.editor, model, owner, markers);
|
71
|
+
};
|
72
|
+
this._diffEditor = monaco.editor.createDiffEditor(document.getElementById(`${this.instanceid}-diff-container`), {
|
73
|
+
automaticLayout: true
|
74
|
+
});
|
75
|
+
this._setDiffModel();
|
76
|
+
this._loaded = true;
|
77
|
+
this._toggleUndoRedo();
|
78
|
+
}
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
82
|
+
*
|
83
|
+
* @returns Promise when complete
|
84
|
+
*/
|
85
|
+
async componentWillLoad() {
|
86
|
+
this._initValueObserver();
|
87
|
+
await this._getTranslations();
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Renders the component.
|
92
|
+
*/
|
93
|
+
render() {
|
94
|
+
return (h(Host, null, h("div", { id: `${this.instanceid}-editor-container`, class: "editor-container padding-right" }, h("div", { class: "editor-controls" }, h("div", { class: "editor-buttons" }, h("calcite-icon", { id: `${this.instanceid}-errorFlag`, icon: "exclamation-mark-triangle", title: this._translations.errorFlag, scale: "s", class: "edit-error-flag" }), h("calcite-button", { id: `${this.instanceid}-undo`, color: "blue", appearance: "solid", title: this._translations.undo, onClick: () => this._undo(), scale: "s", class: "edit-button" }, h("calcite-icon", { icon: "undo", scale: "s" })), h("calcite-button", { id: `${this.instanceid}-redo`, color: "blue", appearance: "solid", title: this._translations.redo, onClick: () => this._redo(), scale: "s", class: "edit-button" }, h("calcite-icon", { icon: "redo", scale: "s" })), h("calcite-button", { id: `${this.instanceid}-diff`, color: "blue", appearance: "solid", title: this._translations.diff, onClick: () => this._toggleEditor(), scale: "s", class: "edit-button" }, h("calcite-icon", { icon: "compare", scale: "s" })), h("calcite-button", { id: `${this.instanceid}-search`, appearance: "outline", color: "blue", title: this._translations.search, onClick: () => this._search(), scale: "s", class: "edit-button" }, h("calcite-icon", { icon: "search", scale: "s" })), h("calcite-button", { id: `${this.instanceid}-reset`, color: "blue", appearance: "solid", disabled: true, title: this._translations.cancelEdits, onClick: () => this._reset(), scale: "s", class: "edit-button" }, h("calcite-icon", { icon: "reset", scale: "s" })))), h("div", { class: "edit-parent" }, h("div", { id: `${this.instanceid}-container`, class: "json-edit-container" }), h("div", { id: `${this.instanceid}-diff-container`, class: "json-edit-container display-none" })))));
|
95
|
+
}
|
96
|
+
//--------------------------------------------------------------------------
|
97
|
+
//
|
98
|
+
// Event Listeners
|
99
|
+
//
|
100
|
+
//--------------------------------------------------------------------------
|
101
|
+
//--------------------------------------------------------------------------
|
102
|
+
//
|
103
|
+
// Events
|
104
|
+
//
|
105
|
+
//--------------------------------------------------------------------------
|
106
|
+
//--------------------------------------------------------------------------
|
107
|
+
//
|
108
|
+
// Public Methods (async)
|
109
|
+
//
|
110
|
+
//--------------------------------------------------------------------------
|
111
|
+
/**
|
112
|
+
* Gets the contents of the editor.
|
113
|
+
*
|
114
|
+
* @returns Promise resolving with the current contents of the editor
|
115
|
+
*/
|
116
|
+
async getEditorContents() {
|
117
|
+
return new Promise((resolve, reject) => {
|
118
|
+
try {
|
119
|
+
const currentValue = this._currentModel.getValue();
|
120
|
+
resolve(currentValue);
|
121
|
+
}
|
122
|
+
catch (e) {
|
123
|
+
reject(e);
|
124
|
+
}
|
125
|
+
});
|
126
|
+
}
|
127
|
+
/**
|
128
|
+
* Frees the editor events and memory; to be called when the web component is no longer needed.
|
129
|
+
*
|
130
|
+
* Because the component lifecycle doesn't include an "onDestroy" event
|
131
|
+
* (@see https://stenciljs.com/docs/component-lifecycle#disconnectedcallback)
|
132
|
+
* and TypeScript/JavaScript does automatic garbage collection without a callback
|
133
|
+
* hook until ES2021
|
134
|
+
* (@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry),
|
135
|
+
* this cleanup call needs to be called manually.
|
136
|
+
*/
|
137
|
+
async prepareForDeletion() {
|
138
|
+
var _a, _b, _c, _d, _e;
|
139
|
+
(_a = this._searchBtnHandler) === null || _a === void 0 ? void 0 : _a.removeEventListener("click", this._search);
|
140
|
+
(_b = this._cancelEditsBtnHandler) === null || _b === void 0 ? void 0 : _b.removeEventListener("click", this._reset);
|
141
|
+
(_c = this._valueObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
142
|
+
(_d = this._contentChanged) === null || _d === void 0 ? void 0 : _d.dispose();
|
143
|
+
(_e = this._editor) === null || _e === void 0 ? void 0 : _e.dispose();
|
144
|
+
}
|
145
|
+
/**
|
146
|
+
* Replaces the current selection with the supplied text, inserting if nothing is selected.
|
147
|
+
*
|
148
|
+
* @param replacement Text to use for replacement or insertion
|
149
|
+
* @returns Promise resolving when function is done
|
150
|
+
*/
|
151
|
+
async replaceCurrentSelection(replacement) {
|
152
|
+
const currentSelection = this._editor.getSelection();
|
153
|
+
this._editor.executeEdits("", [
|
154
|
+
{ range: currentSelection, text: replacement }
|
155
|
+
]);
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* Resets the contents of the editor with the current `value`.
|
159
|
+
*
|
160
|
+
* @returns Promise resolving when function is done
|
161
|
+
*/
|
162
|
+
async reset() {
|
163
|
+
return new Promise((resolve, reject) => {
|
164
|
+
try {
|
165
|
+
this._reset();
|
166
|
+
resolve({ success: true });
|
167
|
+
}
|
168
|
+
catch (e) {
|
169
|
+
reject(e);
|
170
|
+
}
|
171
|
+
});
|
172
|
+
}
|
173
|
+
//--------------------------------------------------------------------------
|
174
|
+
//
|
175
|
+
// Private Methods
|
176
|
+
//
|
177
|
+
//--------------------------------------------------------------------------
|
178
|
+
/**
|
179
|
+
* Disables a button.
|
180
|
+
*
|
181
|
+
* @param buttonId Id of button to disable
|
182
|
+
*
|
183
|
+
* @protected
|
184
|
+
*/
|
185
|
+
_disableButton(buttonId) {
|
186
|
+
var _a;
|
187
|
+
(_a = document.getElementById(buttonId)) === null || _a === void 0 ? void 0 : _a.setAttribute("disabled", "");
|
188
|
+
}
|
189
|
+
/**
|
190
|
+
* Enables a button.
|
191
|
+
*
|
192
|
+
* @param buttonId Id of button to enable
|
193
|
+
*
|
194
|
+
* @protected
|
195
|
+
*/
|
196
|
+
_enableButton(buttonId) {
|
197
|
+
var _a;
|
198
|
+
(_a = document.getElementById(buttonId)) === null || _a === void 0 ? void 0 : _a.removeAttribute("disabled");
|
199
|
+
}
|
200
|
+
/**
|
201
|
+
* Dispatches an event that the editor's content has changed.
|
202
|
+
*
|
203
|
+
* @protected
|
204
|
+
*/
|
205
|
+
_flagEditorContentChanged() {
|
206
|
+
// Event for notifying that the editor contents have changed
|
207
|
+
window.dispatchEvent(new CustomEvent("solutionEditorContentChanged", {
|
208
|
+
detail: {
|
209
|
+
id: this.instanceid,
|
210
|
+
contents: this._currentModel.getValue()
|
211
|
+
},
|
212
|
+
bubbles: true,
|
213
|
+
cancelable: false,
|
214
|
+
composed: true
|
215
|
+
}));
|
216
|
+
}
|
217
|
+
/**
|
218
|
+
* Sets the editor's flag indicating if it has changes and dispatches an event when
|
219
|
+
* the flag value changes.
|
220
|
+
*
|
221
|
+
* @param flagHasChanges Current state of change in the editor; if it doesn't match the value saved in this
|
222
|
+
* object, an event is dispatched with the new value and the saved value is updated
|
223
|
+
*
|
224
|
+
* @protected
|
225
|
+
*/
|
226
|
+
_flagEditorHasChanges(flagHasChanges) {
|
227
|
+
// Event for notifying if the editor has updated the value of its hasChanges property
|
228
|
+
if (this.hasChanges !== flagHasChanges) {
|
229
|
+
window.dispatchEvent(new CustomEvent("solutionEditorHasChanges", {
|
230
|
+
detail: flagHasChanges,
|
231
|
+
bubbles: true,
|
232
|
+
cancelable: false,
|
233
|
+
composed: true
|
234
|
+
}));
|
235
|
+
this.hasChanges = flagHasChanges;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
/**
|
239
|
+
* Sets the editor's flag indicating if it has errors and dispatches an event when
|
240
|
+
* the flag value changes.
|
241
|
+
*
|
242
|
+
* @param flagHasErrors Current state of errors in the editor; if it doesn't match the value saved in this
|
243
|
+
* object, an event is dispatched with the new value and the saved value is updated
|
244
|
+
*
|
245
|
+
* @protected
|
246
|
+
*/
|
247
|
+
_flagEditorHasErrors(flagHasErrors) {
|
248
|
+
// Event for notifying if the editor has updated the value of its hasErrors property
|
249
|
+
if (this.hasErrors !== flagHasErrors) {
|
250
|
+
window.dispatchEvent(new CustomEvent("solutionEditorHasErrors", {
|
251
|
+
detail: flagHasErrors,
|
252
|
+
bubbles: true,
|
253
|
+
cancelable: false,
|
254
|
+
composed: true
|
255
|
+
}));
|
256
|
+
this.hasErrors = flagHasErrors;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
/**
|
260
|
+
* Fetches the component's translations
|
261
|
+
*
|
262
|
+
* @protected
|
263
|
+
*/
|
264
|
+
async _getTranslations() {
|
265
|
+
const translations = await getLocaleComponentStrings(this.el);
|
266
|
+
this._translations = translations[0];
|
267
|
+
}
|
268
|
+
/**
|
269
|
+
* Initializes the observer that will monitor and respond to changes of the value.
|
270
|
+
*
|
271
|
+
* @protected
|
272
|
+
*/
|
273
|
+
_initValueObserver() {
|
274
|
+
this._valueObserver = new MutationObserver(ml => {
|
275
|
+
ml.forEach(mutation => {
|
276
|
+
if (mutation.type === 'attributes' && mutation.attributeName === "value") {
|
277
|
+
const newValue = mutation.target[mutation.attributeName];
|
278
|
+
if ((newValue !== mutation.oldValue && this._loaded)) {
|
279
|
+
this._currentModel.setValue(this.value);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
});
|
283
|
+
});
|
284
|
+
this._valueObserver.observe(this.el, { attributes: true, attributeOldValue: true });
|
285
|
+
}
|
286
|
+
/**
|
287
|
+
* Handles activites appropriate to changes in the editor.
|
288
|
+
*
|
289
|
+
* @protected
|
290
|
+
*/
|
291
|
+
_onEditorChange() {
|
292
|
+
// Note: we're not flagging that the editor has changes here because this event
|
293
|
+
// arrives before the model markers event, which indicates errors. We don't want
|
294
|
+
// to notify about changes if there are errors.
|
295
|
+
this._toggleUndoRedo();
|
296
|
+
}
|
297
|
+
/**
|
298
|
+
* Redoes the previous edit operation.
|
299
|
+
*
|
300
|
+
* @protected
|
301
|
+
*/
|
302
|
+
_redo() {
|
303
|
+
var _a;
|
304
|
+
if ((_a = this._currentModel) === null || _a === void 0 ? void 0 : _a.canRedo()) {
|
305
|
+
this._currentModel.redo();
|
306
|
+
this._toggleUndoRedo();
|
307
|
+
}
|
308
|
+
}
|
309
|
+
/**
|
310
|
+
* Resets the stored model to the original value.
|
311
|
+
*
|
312
|
+
* @protected
|
313
|
+
*/
|
314
|
+
_reset() {
|
315
|
+
// Restore the original value
|
316
|
+
this._currentModel.setValue(this.value);
|
317
|
+
// update the ui
|
318
|
+
this._toggleUndoRedo();
|
319
|
+
}
|
320
|
+
/**
|
321
|
+
* Handles click on "Search" button.
|
322
|
+
*
|
323
|
+
* @protected
|
324
|
+
*/
|
325
|
+
_search() {
|
326
|
+
this._editor.trigger('toggleFind', 'actions.find');
|
327
|
+
}
|
328
|
+
/**
|
329
|
+
* Sets the models for the diff editor.
|
330
|
+
*
|
331
|
+
* @protected
|
332
|
+
*/
|
333
|
+
_setDiffModel() {
|
334
|
+
if (this._diffEditor) {
|
335
|
+
this._diffEditor.setModel({
|
336
|
+
original: monaco.editor.createModel(this.value, "json"),
|
337
|
+
modified: this._editor.getModel()
|
338
|
+
});
|
339
|
+
}
|
340
|
+
}
|
341
|
+
/**
|
342
|
+
* Shows/Hides the appropriate editor: regular or diff.
|
343
|
+
*
|
344
|
+
* @protected
|
345
|
+
*/
|
346
|
+
_toggleEditor() {
|
347
|
+
this._useDiffEditor = !this._useDiffEditor;
|
348
|
+
let diffContainer = document.getElementById(`${this.instanceid}-diff-container`);
|
349
|
+
let container = document.getElementById(`${this.instanceid}-container`);
|
350
|
+
if (this._useDiffEditor) {
|
351
|
+
this._setDiffModel();
|
352
|
+
diffContainer.classList.remove("display-none");
|
353
|
+
container.classList.add("display-none");
|
354
|
+
}
|
355
|
+
else {
|
356
|
+
diffContainer.classList.add("display-none");
|
357
|
+
container.classList.remove("display-none");
|
358
|
+
}
|
359
|
+
}
|
360
|
+
/**
|
361
|
+
* Toggles the undo and redo buttons.
|
362
|
+
*
|
363
|
+
* @protected
|
364
|
+
*/
|
365
|
+
_toggleUndoRedo() {
|
366
|
+
var _a, _b, _c, _d;
|
367
|
+
if ((_a = this._currentModel) === null || _a === void 0 ? void 0 : _a.canUndo()) {
|
368
|
+
this._enableButton(`${this.instanceid}-undo`);
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
this._disableButton(`${this.instanceid}-undo`);
|
372
|
+
}
|
373
|
+
if ((_b = this._currentModel) === null || _b === void 0 ? void 0 : _b.canRedo()) {
|
374
|
+
this._enableButton(`${this.instanceid}-redo`);
|
375
|
+
}
|
376
|
+
else {
|
377
|
+
this._disableButton(`${this.instanceid}-redo`);
|
378
|
+
}
|
379
|
+
if (((_c = this._currentModel) === null || _c === void 0 ? void 0 : _c.canUndo()) || ((_d = this._currentModel) === null || _d === void 0 ? void 0 : _d.canRedo())) {
|
380
|
+
this._enableButton(`${this.instanceid}-reset`);
|
381
|
+
}
|
382
|
+
else {
|
383
|
+
this._disableButton(`${this.instanceid}-reset`);
|
384
|
+
}
|
385
|
+
}
|
386
|
+
/**
|
387
|
+
* Undoes the current edit operation.
|
388
|
+
*
|
389
|
+
* @protected
|
390
|
+
*/
|
391
|
+
_undo() {
|
392
|
+
var _a;
|
393
|
+
if ((_a = this._currentModel) === null || _a === void 0 ? void 0 : _a.canUndo()) {
|
394
|
+
this._currentModel.undo();
|
395
|
+
this._toggleUndoRedo();
|
396
|
+
}
|
397
|
+
}
|
398
|
+
static get assetsDirs() { return ["assets"]; }
|
399
|
+
get el() { return this; }
|
400
|
+
static get style() { return jsonEditorCss; }
|
401
|
+
}, [0, "json-editor", {
|
402
|
+
"hasChanges": [1540, "has-changes"],
|
403
|
+
"hasErrors": [1540, "has-errors"],
|
404
|
+
"instanceid": [1544],
|
405
|
+
"value": [1544],
|
406
|
+
"getEditorContents": [64],
|
407
|
+
"prepareForDeletion": [64],
|
408
|
+
"replaceCurrentSelection": [64],
|
409
|
+
"reset": [64]
|
410
|
+
}]);
|
411
|
+
function defineCustomElement() {
|
412
|
+
if (typeof customElements === "undefined") {
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
const components = ["json-editor", "calcite-button", "calcite-icon", "calcite-loader"];
|
416
|
+
components.forEach(tagName => { switch (tagName) {
|
417
|
+
case "json-editor":
|
418
|
+
if (!customElements.get(tagName)) {
|
419
|
+
customElements.define(tagName, JsonEditor);
|
420
|
+
}
|
421
|
+
break;
|
422
|
+
case "calcite-button":
|
423
|
+
if (!customElements.get(tagName)) {
|
424
|
+
defineCustomElement$3();
|
425
|
+
}
|
426
|
+
break;
|
427
|
+
case "calcite-icon":
|
428
|
+
if (!customElements.get(tagName)) {
|
429
|
+
defineCustomElement$2();
|
430
|
+
}
|
431
|
+
break;
|
432
|
+
case "calcite-loader":
|
433
|
+
if (!customElements.get(tagName)) {
|
434
|
+
defineCustomElement$1();
|
435
|
+
}
|
436
|
+
break;
|
437
|
+
} });
|
438
|
+
}
|
439
|
+
defineCustomElement();
|
440
|
+
|
441
|
+
export { JsonEditor as J, defineCustomElement as d };
|
@@ -0,0 +1,16 @@
|
|
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
|
+
/*!
|
7
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
8
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
9
|
+
* v1.0.0-beta.97
|
10
|
+
*/
|
11
|
+
function isActivationKey(key) {
|
12
|
+
return key === "Enter" || key === " ";
|
13
|
+
}
|
14
|
+
const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
15
|
+
|
16
|
+
export { isActivationKey as i, numberKeys as n };
|