@esri/solutions-components 0.10.7 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +24 -8
  2. package/dist/cjs/buffer-tools_3.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-combobox_3.cjs.entry.js +354 -967
  4. package/dist/cjs/calcite-graph_2.cjs.entry.js +1082 -0
  5. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +6 -6
  6. package/dist/cjs/calcite-tree_3.cjs.entry.js +1 -1
  7. package/dist/cjs/card-manager_3.cjs.entry.js +246 -18
  8. package/dist/cjs/crowdsource-manager.cjs.entry.js +169 -49
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  11. package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
  12. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  13. package/dist/cjs/refine-results-flow-item.cjs.entry.js +1 -1
  14. package/dist/cjs/share-item.cjs.entry.js +1 -1
  15. package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
  16. package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
  17. package/dist/cjs/solutions-components.cjs.js +1 -1
  18. package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
  19. package/dist/collection/assets/t9n/crowdsource-manager/resources.json +5 -1
  20. package/dist/collection/assets/t9n/crowdsource-manager/resources_en.json +5 -1
  21. package/dist/collection/assets/t9n/layer-table/resources.json +1 -0
  22. package/dist/collection/assets/t9n/layer-table/resources_en.json +1 -0
  23. package/dist/collection/assets/t9n/map-card/resources.json +6 -1
  24. package/dist/collection/assets/t9n/map-card/resources_en.json +6 -1
  25. package/dist/collection/components/card-manager/card-manager.js +34 -8
  26. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +173 -65
  27. package/dist/collection/components/layer-table/layer-table.js +175 -8
  28. package/dist/collection/components/map-card/map-card.css +4 -0
  29. package/dist/collection/components/map-card/map-card.js +368 -3
  30. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  31. package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
  32. package/dist/collection/components/map-layer-picker/map-layer-picker.js +9 -3
  33. package/dist/collection/components/map-legend/map-legend.js +1 -1
  34. package/dist/collection/components/map-picker/map-picker.css +8 -0
  35. package/dist/collection/components/map-picker/map-picker.js +74 -3
  36. package/dist/collection/components/map-search/map-search.js +1 -1
  37. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  38. package/dist/collection/components/map-tools/map-tools.js +1 -1
  39. package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
  40. package/dist/collection/components/pdf-download/pdf-download.js +1 -1
  41. package/dist/collection/components/public-notification/public-notification.js +1 -1
  42. package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +1 -1
  43. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  44. package/dist/collection/components/share-item/share-item.js +1 -1
  45. package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
  46. package/dist/collection/components/solution-contents/solution-contents.js +1 -1
  47. package/dist/collection/components/solution-item/solution-item.js +1 -1
  48. package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
  49. package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
  50. package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
  51. package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
  52. package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
  53. package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
  54. package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
  55. package/dist/collection/components/solution-variables/solution-variables.js +1 -1
  56. package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
  57. package/dist/collection/demos/crowdsource-manager.html +1 -0
  58. package/dist/components/card-manager2.js +20 -8
  59. package/dist/components/crowdsource-manager.js +172 -53
  60. package/dist/components/layer-table2.js +72 -10
  61. package/dist/components/map-card2.js +288 -47
  62. package/dist/components/map-draw-tools2.js +1 -1
  63. package/dist/components/map-fullscreen2.js +1 -1
  64. package/dist/components/map-layer-picker2.js +9 -3
  65. package/dist/components/map-legend2.js +1 -1
  66. package/dist/components/map-picker2.js +24 -5
  67. package/dist/components/map-search2.js +1 -1
  68. package/dist/components/map-select-tools2.js +1 -1
  69. package/dist/components/map-tools2.js +1 -1
  70. package/dist/components/pci-calculator.js +1 -1
  71. package/dist/components/pdf-download2.js +1 -1
  72. package/dist/components/public-notification.js +1 -1
  73. package/dist/components/refine-results-flow-item.js +1 -1
  74. package/dist/components/refine-selection2.js +1 -1
  75. package/dist/components/share-item.js +1 -1
  76. package/dist/components/solution-configuration.js +3 -3
  77. package/dist/components/solution-contents2.js +1 -1
  78. package/dist/components/solution-item-details2.js +1 -1
  79. package/dist/components/solution-item-icon2.js +1 -1
  80. package/dist/components/solution-item-sharing2.js +1 -1
  81. package/dist/components/solution-item2.js +1 -1
  82. package/dist/components/solution-organization-variables2.js +1 -1
  83. package/dist/components/solution-resource-item2.js +1 -1
  84. package/dist/components/solution-spatial-ref2.js +1 -1
  85. package/dist/components/solution-template-data2.js +1 -1
  86. package/dist/components/solution-variables2.js +1 -1
  87. package/dist/components/spatial-ref.js +1 -1
  88. package/dist/esm/basemap-gallery_7.entry.js +24 -8
  89. package/dist/esm/buffer-tools_3.entry.js +1 -1
  90. package/dist/esm/calcite-combobox_3.entry.js +369 -982
  91. package/dist/esm/calcite-graph_2.entry.js +1077 -0
  92. package/dist/esm/calcite-shell-panel_14.entry.js +6 -6
  93. package/dist/esm/calcite-tree_3.entry.js +1 -1
  94. package/dist/esm/card-manager_3.entry.js +248 -20
  95. package/dist/esm/crowdsource-manager.entry.js +170 -50
  96. package/dist/esm/loader.js +1 -1
  97. package/dist/esm/map-select-tools_3.entry.js +3 -3
  98. package/dist/esm/pci-calculator.entry.js +1 -1
  99. package/dist/esm/public-notification.entry.js +1 -1
  100. package/dist/esm/refine-results-flow-item.entry.js +1 -1
  101. package/dist/esm/share-item.entry.js +1 -1
  102. package/dist/esm/solution-configuration.entry.js +3 -3
  103. package/dist/esm/solution-contents_3.entry.js +3 -3
  104. package/dist/esm/solutions-components.js +1 -1
  105. package/dist/esm/spatial-ref.entry.js +1 -1
  106. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources.json +5 -1
  107. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources_en.json +5 -1
  108. package/dist/solutions-components/assets/t9n/layer-table/resources.json +1 -0
  109. package/dist/solutions-components/assets/t9n/layer-table/resources_en.json +1 -0
  110. package/dist/solutions-components/assets/t9n/map-card/resources.json +6 -1
  111. package/dist/solutions-components/assets/t9n/map-card/resources_en.json +6 -1
  112. package/dist/solutions-components/demos/crowdsource-manager.html +1 -0
  113. package/dist/solutions-components/p-0abc1354.entry.js +6 -0
  114. package/dist/solutions-components/p-0f7b5d36.entry.js +6 -0
  115. package/dist/solutions-components/{p-a9818be2.entry.js → p-20c465e9.entry.js} +1 -1
  116. package/dist/solutions-components/{p-db18bce8.entry.js → p-36b50b5b.entry.js} +1 -1
  117. package/dist/solutions-components/{p-85512ae3.entry.js → p-445213cf.entry.js} +1 -1
  118. package/dist/solutions-components/{p-d49f895d.entry.js → p-4a5f0a97.entry.js} +1 -1
  119. package/dist/solutions-components/{p-002c97df.entry.js → p-5d201016.entry.js} +1 -1
  120. package/dist/solutions-components/{p-b7cec3bd.entry.js → p-618bafec.entry.js} +1 -1
  121. package/dist/solutions-components/p-6a66d5a9.entry.js +6 -0
  122. package/dist/solutions-components/p-71a2d5b8.entry.js +6 -0
  123. package/dist/solutions-components/p-7a64b026.entry.js +17 -0
  124. package/dist/solutions-components/p-85c25564.entry.js +6 -0
  125. package/dist/solutions-components/{p-235bf02e.entry.js → p-913413c3.entry.js} +1 -1
  126. package/dist/solutions-components/p-9af1cb14.entry.js +6 -0
  127. package/dist/solutions-components/{p-49aa2929.entry.js → p-bebd4646.entry.js} +1 -1
  128. package/dist/solutions-components/p-ce454f5a.entry.js +11 -0
  129. package/dist/solutions-components/solutions-components.esm.js +1 -1
  130. package/dist/types/components/card-manager/card-manager.d.ts +11 -0
  131. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +86 -20
  132. package/dist/types/components/layer-table/layer-table.d.ts +30 -0
  133. package/dist/types/components/map-card/map-card.d.ts +124 -0
  134. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +4 -0
  135. package/dist/types/components/map-picker/map-picker.d.ts +12 -0
  136. package/dist/types/components.d.ts +130 -0
  137. package/dist/types/preact.d.ts +4 -2
  138. package/package.json +1 -1
  139. package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +0 -453
  140. package/dist/esm/calcite-dropdown-group_2.entry.js +0 -448
  141. package/dist/solutions-components/p-129fd80e.entry.js +0 -6
  142. package/dist/solutions-components/p-3b426576.entry.js +0 -6
  143. package/dist/solutions-components/p-72b217f2.entry.js +0 -6
  144. package/dist/solutions-components/p-8b999a2b.entry.js +0 -6
  145. package/dist/solutions-components/p-973ff7b2.entry.js +0 -23
  146. package/dist/solutions-components/p-a001f9c9.entry.js +0 -6
  147. package/dist/solutions-components/p-c683b3fe.entry.js +0 -6
  148. package/dist/solutions-components/p-e9d049bd.entry.js +0 -6
@@ -26,20 +26,27 @@ const component = require('./component-9d0efa36.js');
26
26
  const Validation = require('./Validation-a9d22fb7.js');
27
27
  const utils = require('./utils-3f254442.js');
28
28
  const debounce = require('./debounce-7f1e04d6.js');
29
- const key = require('./key-e4dd32ff.js');
30
- const math = require('./math-8677dfd7.js');
29
+ const resources$1 = require('./resources-ea500edf.js');
30
+ const locale$1 = require('./locale-4e7fe921.js');
31
+ const mapViewUtils = require('./mapViewUtils-8d4da732.js');
32
+ const publicNotificationStore = require('./publicNotificationStore-8d2558c6.js');
31
33
  require('./browser-02cbd1d9.js');
34
+ require('./key-e4dd32ff.js');
35
+ require('./esri-loader-08dc41bd.js');
36
+ require('./_commonjsHelpers-baf43783.js');
37
+ require('./interfaces-09c4c40e.js');
38
+ require('./index-a0cca96e.js');
32
39
 
33
40
  /*!
34
41
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
35
42
  * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
36
43
  * v2.11.1
37
44
  */
38
- const CSS$1 = {
45
+ const CSS = {
39
46
  button: "x-button",
40
47
  };
41
48
  function XButton({ disabled, key, label, onClick, ref, scale, }) {
42
- return (index.h("button", { "aria-label": label, class: CSS$1.button, disabled: disabled, key: key, onClick: onClick, ref: ref, tabIndex: -1, type: "button" }, index.h("calcite-icon", { icon: "x", scale: component.getIconScale(scale) })));
49
+ return (index.h("button", { "aria-label": label, class: CSS.button, disabled: disabled, key: key, onClick: onClick, ref: ref, tabIndex: -1, type: "button" }, index.h("calcite-icon", { icon: "x", scale: component.getIconScale(scale) })));
43
50
  }
44
51
 
45
52
  const comboboxCss = ":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:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([scale=s]) .x-button{inline-size:1rem;block-size:1rem}:host([scale=m]) .x-button{inline-size:1.5rem;block-size:1.5rem}:host([scale=l]) .x-button{inline-size:2rem;block-size:2rem}.x-button{margin:0px;display:flex;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-content:center;align-items:center;justify-content:center;align-self:center;border-width:2px;background-color:transparent;color:var(--calcite-color-text-3);outline-color:transparent;transition:background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start inset-size, opacity, outline-color, transform var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-radius:50%;border-color:transparent;background-color:var(--calcite-color-foreground-2)}.x-button:active,.x-button:hover{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-3)}.x-button:active{border-style:solid;border-color:var(--calcite-color-brand)}.x-button calcite-icon{color:inherit}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1rem;--calcite-internal-combobox-input-margin-block:calc(0.25rem - 1px)}:host([scale=s]) .x-button{margin-inline:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:1rem;--calcite-internal-combobox-input-margin-block:calc(0.5rem - 1px)}:host([scale=m]) .x-button{margin-inline-end:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:1.5rem;--calcite-internal-combobox-input-margin-block:calc(0.625rem - 1px)}:host([scale=l]) .x-button{margin-inline-end:1rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-input);background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.wrapper:hover .icon{color:var(--calcite-color-text-1)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-focus-color, 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 )}:host([read-only]) .wrapper{background-color:var(--calcite-color-background)}:host([read-only]) .label{font-weight:var(--calcite-font-weight-medium)}:host([status=invalid]) .wrapper{border-color:var(--calcite-color-status-danger)}:host([status=invalid]:focus-within) .wrapper{outline:2px solid var(--calcite-color-status-danger);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 )}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{position:relative;display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;gap:var(--calcite-combobox-item-spacing-unit-s);margin-inline-end:var(--calcite-combobox-item-spacing-unit-s)}.grid-input.selection-display-fit,.grid-input.selection-display-single{flex-wrap:nowrap;overflow:hidden}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden;text-overflow:ellipsis;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-color-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);inline-size:100%;margin-block-end:var(--calcite-combobox-item-spacing-unit-s);min-inline-size:4.8125rem}.input:focus{outline:2px solid transparent;outline-offset:2px}.input:-moz-placeholder-shown{text-overflow:ellipsis}.input:placeholder-shown{text-overflow:ellipsis}.input--single{padding:0px;margin-block:var(--calcite-internal-combobox-input-margin-block)}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1;align-items:center}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;cursor:pointer;align-items:center}.icon-end{flex:none}.icon-end .icon{color:var(--calcite-color-text-3)}.floating-ui-container{--calcite-floating-ui-z-index:var(--calcite-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.floating-ui-container .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}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}.floating-ui-container--active{visibility:visible}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-color-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}calcite-chip{--calcite-animation-timing:0}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);max-inline-size:100%}.chip--active{background-color:var(--calcite-color-foreground-3)}.chip--invisible{visibility:hidden;position:absolute}.item{display:block}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:0.5rem}:host([scale=s]) .validation-container{padding-block-start:0.25rem}::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}::slotted(calcite-combobox-item-group:not(:first-child)){padding-block-start:var(--calcite-combobox-item-spacing-unit-l)}";
@@ -260,7 +267,7 @@ const Combobox = class {
260
267
  event.preventDefault();
261
268
  return;
262
269
  }
263
- if (composedPath.some((node) => node.classList?.contains(CSS$1.button))) {
270
+ if (composedPath.some((node) => node.classList?.contains(CSS.button))) {
264
271
  this.clearValue();
265
272
  event.preventDefault();
266
273
  return;
@@ -1129,152 +1136,23 @@ const Combobox = class {
1129
1136
  };
1130
1137
  Combobox.style = CalciteComboboxStyle0;
1131
1138
 
1132
- /*!
1133
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
1134
- * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
1135
- * v2.11.1
1136
- */
1137
- /**
1138
- * Calculate slope of the tangents
1139
- * uses Steffen interpolation as it's monotonic
1140
- * http://jrwalsh1.github.io/posts/interpolations/
1141
- *
1142
- * @param p0
1143
- * @param p1
1144
- * @param p2
1145
- */
1146
- function slope(p0, p1, p2) {
1147
- const dx = p1[0] - p0[0];
1148
- const dx1 = p2[0] - p1[0];
1149
- const dy = p1[1] - p0[1];
1150
- const dy1 = p2[1] - p1[1];
1151
- const m = dy / (dx || (dx1 < 0 && 0));
1152
- const m1 = dy1 / (dx1 || (dx < 0 && 0));
1153
- const p = (m * dx1 + m1 * dx) / (dx + dx1);
1154
- return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
1155
- }
1156
- /**
1157
- * Calculate slope for just one tangent (single-sided)
1158
- *
1159
- * @param p0
1160
- * @param p1
1161
- * @param m
1162
- */
1163
- function slopeSingle(p0, p1, m) {
1164
- const dx = p1[0] - p0[0];
1165
- const dy = p1[1] - p0[1];
1166
- return dx ? ((3 * dy) / dx - m) / 2 : m;
1167
- }
1168
- /**
1169
- * Given two points and their tangent slopes,
1170
- * calculate the bezier handle coordinates and return draw command.
1171
- *
1172
- * Translates Hermite Spline to Bézier curve:
1173
- * https://stackoverflow.com/questions/42574940/
1174
- *
1175
- * @param p0
1176
- * @param p1
1177
- * @param m0
1178
- * @param m1
1179
- * @param t
1180
- */
1181
- function bezier(p0, p1, m0, m1, t) {
1182
- const [x0, y0] = p0;
1183
- const [x1, y1] = p1;
1184
- const dx = (x1 - x0) / 3;
1185
- const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
1186
- const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
1187
- const p = t([x1, y1]).join(",");
1188
- return `C ${h1} ${h2} ${p}`;
1189
- }
1190
- /**
1191
- * Generate a function which will translate a point
1192
- * from the data coordinate space to svg viewbox oriented pixels
1193
- *
1194
- * @param root0
1195
- * @param root0.width
1196
- * @param root0.height
1197
- * @param root0.min
1198
- * @param root0.max
1199
- */
1200
- function translate({ width, height, min, max }) {
1201
- const rangeX = max[0] - min[0];
1202
- const rangeY = max[1] - min[1];
1203
- return (point) => {
1204
- const x = ((point[0] - min[0]) / rangeX) * width;
1205
- const y = height - (point[1] / rangeY) * height;
1206
- return [x, y];
1207
- };
1208
- }
1209
- /**
1210
- * Get the min and max values from the dataset
1211
- *
1212
- * @param data
1213
- */
1214
- function range(data) {
1215
- const [startX, startY] = data[0];
1216
- const min = [startX, startY];
1217
- const max = [startX, startY];
1218
- return data.reduce(({ min, max }, [x, y]) => ({
1219
- min: [Math.min(min[0], x), Math.min(min[1], y)],
1220
- max: [Math.max(max[0], x), Math.max(max[1], y)],
1221
- }), { min, max });
1222
- }
1223
- /**
1224
- * Generate drawing commands for an area graph
1225
- * returns a string can can be passed directly to a path element's `d` attribute
1226
- *
1227
- * @param root0
1228
- * @param root0.data
1229
- * @param root0.min
1230
- * @param root0.max
1231
- * @param root0.t
1232
- */
1233
- function area({ data, min, max, t }) {
1234
- if (data.length === 0) {
1235
- return "";
1236
- }
1237
- // important points for beginning and ending the path
1238
- const [startX, startY] = t(data[0]);
1239
- const [minX, minY] = t(min);
1240
- const [maxX] = t(max);
1241
- // keep track of previous slope/points
1242
- let m;
1243
- let p0;
1244
- let p1;
1245
- // iterate over data points, calculating command for each
1246
- const commands = data.reduce((acc, point, i) => {
1247
- p0 = data[i - 2];
1248
- p1 = data[i - 1];
1249
- if (i > 1) {
1250
- const m1 = slope(p0, p1, point);
1251
- const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
1252
- const command = bezier(p0, p1, m0, m1, t);
1253
- m = m1;
1254
- return `${acc} ${command}`;
1255
- }
1256
- return acc;
1257
- }, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
1258
- // close the path
1259
- const last = data[data.length - 1];
1260
- const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
1261
- return `${commands} ${end} L ${maxX},${minY} Z`;
1262
- }
1139
+ const dropdownGroupCss = ":host{position:relative;display:block}.container{text-align:start}.dropdown-title{margin-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-color-text-2)}.dropdown-separator{display:block;block-size:1px;background-color:var(--calcite-color-border-3)}:host([scale=s]){font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) .dropdown-title{padding:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) .dropdown-title{padding:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) .dropdown-title{padding:1rem}:host([hidden]){display:none}[hidden]{display:none}";
1140
+ const CalciteDropdownGroupStyle0 = dropdownGroupCss;
1263
1141
 
1264
- const graphCss = ":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}";
1265
- const CalciteGraphStyle0 = graphCss;
1266
-
1267
- const Graph = class {
1142
+ const DropdownGroup = class {
1268
1143
  constructor(hostRef) {
1269
1144
  index.registerInstance(this, hostRef);
1270
- this.graphId = `calcite-graph-${guid.guid()}`;
1271
- this.resizeObserver = observers.createObserver("resize", () => index.forceUpdate(this));
1272
- this.data = [];
1273
- this.colorStops = undefined;
1274
- this.highlightMin = undefined;
1275
- this.highlightMax = undefined;
1276
- this.min = undefined;
1277
- this.max = undefined;
1145
+ this.calciteInternalDropdownItemChange = index.createEvent(this, "calciteInternalDropdownItemChange", 6);
1146
+ this.updateItems = () => {
1147
+ Array.from(this.el.querySelectorAll("calcite-dropdown-item")).forEach((item) => (item.selectionMode = this.selectionMode));
1148
+ };
1149
+ this.mutationObserver = observers.createObserver("mutation", () => this.updateItems());
1150
+ this.groupTitle = undefined;
1151
+ this.scale = "m";
1152
+ this.selectionMode = "single";
1153
+ }
1154
+ handlePropsChange() {
1155
+ this.updateItems();
1278
1156
  }
1279
1157
  //--------------------------------------------------------------------------
1280
1158
  //
@@ -1282,909 +1160,418 @@ const Graph = class {
1282
1160
  //
1283
1161
  //--------------------------------------------------------------------------
1284
1162
  connectedCallback() {
1285
- this.resizeObserver?.observe(this.el);
1163
+ this.updateItems();
1164
+ this.mutationObserver?.observe(this.el, { childList: true });
1165
+ }
1166
+ componentWillLoad() {
1167
+ this.groupPosition = this.getGroupPosition();
1286
1168
  }
1287
1169
  disconnectedCallback() {
1288
- this.resizeObserver?.disconnect();
1170
+ this.mutationObserver?.disconnect();
1289
1171
  }
1290
1172
  render() {
1291
- const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
1292
- const id = this.graphId;
1293
- const { clientHeight: height, clientWidth: width } = el;
1294
- // if we have no data, return empty svg
1295
- if (!data || data.length === 0) {
1296
- return (index.h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
1297
- }
1298
- const { min: rangeMin, max: rangeMax } = range(data);
1299
- let currentMin = rangeMin;
1300
- let currentMax = rangeMax;
1301
- if (min < rangeMin[0] || min > rangeMin[0]) {
1302
- currentMin = [min, 0];
1303
- }
1304
- if (max > rangeMax[0] || max < rangeMax[0]) {
1305
- currentMax = [max, rangeMax[1]];
1306
- }
1307
- const t = translate({ min: currentMin, max: currentMax, width, height });
1308
- const [hMinX] = t([highlightMin, currentMax[1]]);
1309
- const [hMaxX] = t([highlightMax, currentMax[1]]);
1310
- const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
1311
- const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
1312
- return (index.h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }, colorStops ? (index.h("defs", null, index.h("linearGradient", { id: `linear-gradient-${id}`, x1: "0", x2: "1", y1: "0", y2: "0" }, colorStops.map(({ offset, color, opacity }) => (index.h("stop", { offset: `${offset * 100}%`, "stop-color": color, "stop-opacity": opacity })))))) : null, highlightMin !== undefined ? ([
1313
- index.h("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, index.h("path", { d: `
1314
- M 0,0
1315
- L ${hMinX - 1},0
1316
- L ${hMinX - 1},${height}
1317
- L 0,${height}
1318
- Z
1319
- `, fill: "white" })),
1320
- index.h("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, index.h("path", { d: `
1321
- M ${hMinX + 1},0
1322
- L ${hMaxX - 1},0
1323
- L ${hMaxX - 1},${height}
1324
- L ${hMinX + 1}, ${height}
1325
- Z
1326
- `, fill: "white" })),
1327
- index.h("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, index.h("path", { d: `
1328
- M ${hMaxX + 1},0
1329
- L ${width},0
1330
- L ${width},${height}
1331
- L ${hMaxX + 1}, ${height}
1332
- Z
1333
- `, fill: "white" })),
1334
- index.h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
1335
- index.h("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
1336
- index.h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` }),
1337
- ]) : (index.h("path", { class: "graph-path", d: areaPath, fill: fill }))));
1173
+ const groupTitle = this.groupTitle ? (index.h("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
1174
+ const dropdownSeparator = this.groupPosition > 0 ? index.h("div", { class: "dropdown-separator", role: "separator" }) : null;
1175
+ return (index.h(index.Host, { key: '1c189e8ff87a118d296781b729c889307c2b4a5b', "aria-label": this.groupTitle, role: "group" }, index.h("div", { key: '2afc3aee9c68b26af882168ce24cb2937a17c9e8', class: {
1176
+ [resources$1.CSS.container]: true,
1177
+ } }, dropdownSeparator, groupTitle, index.h("slot", { key: '3fdcfab750b0541a4a24764f1a1875c867db06e8' }))));
1338
1178
  }
1179
+ //--------------------------------------------------------------------------
1180
+ //
1181
+ // Event Listeners
1182
+ //
1183
+ //--------------------------------------------------------------------------
1184
+ updateActiveItemOnChange(event) {
1185
+ this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
1186
+ this.requestedDropdownItem = event.detail.requestedDropdownItem;
1187
+ this.calciteInternalDropdownItemChange.emit({
1188
+ requestedDropdownGroup: this.requestedDropdownGroup,
1189
+ requestedDropdownItem: this.requestedDropdownItem,
1190
+ });
1191
+ }
1192
+ //--------------------------------------------------------------------------
1193
+ //
1194
+ // Private Methods
1195
+ //
1196
+ //--------------------------------------------------------------------------
1197
+ getGroupPosition() {
1198
+ return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
1199
+ }
1200
+ static get delegatesFocus() { return true; }
1339
1201
  get el() { return index.getElement(this); }
1202
+ static get watchers() { return {
1203
+ "selectionMode": ["handlePropsChange"]
1204
+ }; }
1340
1205
  };
1341
- Graph.style = CalciteGraphStyle0;
1342
-
1343
- /*!
1344
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
1345
- * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
1346
- * v2.11.1
1347
- */
1348
- const CSS = {
1349
- container: "container",
1350
- containerRange: "container--range",
1351
- graph: "graph",
1352
- handle: "handle",
1353
- handleExtension: "handle-extension",
1354
- handleLabel: "handle__label",
1355
- handleLabelMinValue: "handle__label--minValue",
1356
- handleLabelValue: "handle__label--value",
1357
- hyphen: "hyphen",
1358
- hyphenWrap: "hyphen--wrap",
1359
- static: "static",
1360
- thumb: "thumb",
1361
- thumbActive: "thumb--active",
1362
- thumbContainer: "thumb-container",
1363
- thumbMinValue: "thumb--minValue",
1364
- thumbPrecise: "thumb--precise",
1365
- thumbValue: "thumb--value",
1366
- tick: "tick",
1367
- tickActive: "tick--active",
1368
- tickLabel: "tick__label",
1369
- tickMax: "tick__label--max",
1370
- tickMin: "tick__label--min",
1371
- ticks: "ticks",
1372
- track: "track",
1373
- trackRange: "track__range",
1374
- transformed: "transformed",
1375
- };
1376
- const maxTickElementThreshold = 250;
1206
+ DropdownGroup.style = CalciteDropdownGroupStyle0;
1377
1207
 
1378
- const sliderCss = "@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-ui-focus-color, 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}";
1379
- const CalciteSliderStyle0 = sliderCss;
1208
+ const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";
1209
+ const MapLayerPickerStyle0 = mapLayerPickerCss;
1380
1210
 
1381
- function isRange(value) {
1382
- return Array.isArray(value);
1383
- }
1384
- const Slider = class {
1211
+ const MapLayerPicker = class {
1385
1212
  constructor(hostRef) {
1386
1213
  index.registerInstance(this, hostRef);
1387
- this.calciteSliderInput = index.createEvent(this, "calciteSliderInput", 6);
1388
- this.calciteSliderChange = index.createEvent(this, "calciteSliderChange", 6);
1389
- //--------------------------------------------------------------------------
1390
- //
1391
- // Event Listeners
1392
- //
1393
- //--------------------------------------------------------------------------
1394
- this.handleKeyDown = (event) => {
1395
- const mirror = this.shouldMirror();
1396
- const { activeProp, max, min, pageStep, step } = this;
1397
- const value = this[activeProp];
1398
- const { key: key$1 } = event;
1399
- if (key.isActivationKey(key$1)) {
1400
- event.preventDefault();
1401
- return;
1402
- }
1403
- let adjustment;
1404
- if (key$1 === "ArrowUp" || key$1 === "ArrowRight") {
1405
- const directionFactor = mirror && key$1 === "ArrowRight" ? -1 : 1;
1406
- adjustment = value + step * directionFactor;
1407
- }
1408
- else if (key$1 === "ArrowDown" || key$1 === "ArrowLeft") {
1409
- const directionFactor = mirror && key$1 === "ArrowLeft" ? -1 : 1;
1410
- adjustment = value - step * directionFactor;
1411
- }
1412
- else if (key$1 === "PageUp") {
1413
- if (pageStep) {
1414
- adjustment = value + pageStep;
1415
- }
1416
- }
1417
- else if (key$1 === "PageDown") {
1418
- if (pageStep) {
1419
- adjustment = value - pageStep;
1420
- }
1421
- }
1422
- else if (key$1 === "Home") {
1423
- adjustment = min;
1424
- }
1425
- else if (key$1 === "End") {
1426
- adjustment = max;
1427
- }
1428
- if (isNaN(adjustment)) {
1429
- return;
1430
- }
1431
- event.preventDefault();
1432
- const fixedDecimalAdjustment = Number(adjustment.toFixed(math.decimalPlaces(step)));
1433
- this.setValue({
1434
- [activeProp]: this.clamp(fixedDecimalAdjustment, activeProp),
1435
- });
1436
- };
1437
- this.activeProp = "value";
1438
- this.guid = `calcite-slider-${guid.guid()}`;
1439
- this.onThumbBlur = () => {
1440
- this.activeProp = null;
1441
- };
1442
- this.onThumbFocus = (event) => {
1443
- const thumb = event.currentTarget;
1444
- this.activeProp = thumb.getAttribute("data-value-prop");
1445
- };
1446
- this.onThumbPointerDown = (event) => {
1447
- const thumb = event.currentTarget;
1448
- this.pointerDownDragStart(event, thumb.getAttribute("data-value-prop"));
1449
- };
1450
- this.onTrackPointerDown = (event) => {
1451
- this.pointerDownDragStart(event, "minMaxValue");
1452
- };
1453
- this.dragUpdate = (event) => {
1454
- if (this.disabled) {
1455
- return;
1456
- }
1457
- event.preventDefault();
1458
- if (this.dragProp) {
1459
- const value = this.translate(event.clientX || event.pageX);
1460
- if (isRange(this.value) && this.dragProp === "minMaxValue") {
1461
- if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
1462
- const newMinValue = value - this.minValueDragRange;
1463
- const newMaxValue = value + this.maxValueDragRange;
1464
- if (newMaxValue <= this.max &&
1465
- newMinValue >= this.min &&
1466
- newMaxValue - newMinValue === this.minMaxValueRange) {
1467
- this.setValue({
1468
- minValue: this.clamp(newMinValue, "minValue"),
1469
- maxValue: this.clamp(newMaxValue, "maxValue"),
1470
- });
1471
- }
1472
- }
1473
- else {
1474
- this.minValueDragRange = value - this.minValue;
1475
- this.maxValueDragRange = this.maxValue - value;
1476
- this.minMaxValueRange = this.maxValue - this.minValue;
1477
- }
1478
- }
1479
- else {
1480
- this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
1481
- }
1482
- }
1483
- };
1484
- this.pointerUpDragEnd = (event) => {
1485
- if (this.disabled || !dom.isPrimaryPointerButton(event)) {
1486
- return;
1487
- }
1488
- this.dragEnd(event);
1489
- };
1490
- this.dragEnd = (event) => {
1491
- if (this.disabled) {
1492
- return;
1493
- }
1494
- this.removeDragListeners();
1495
- this.focusActiveHandle(event.clientX);
1496
- if (this.lastDragPropValue != this[this.dragProp]) {
1497
- this.emitChange();
1498
- }
1499
- this.dragProp = null;
1500
- this.lastDragPropValue = null;
1501
- this.minValueDragRange = null;
1502
- this.maxValueDragRange = null;
1503
- this.minMaxValueRange = null;
1504
- };
1505
- this.storeTrackRef = (node) => {
1506
- this.trackEl = node;
1507
- };
1508
- this.storeThumbRef = (el) => {
1509
- if (!el) {
1510
- return;
1511
- }
1512
- const valueProp = el.getAttribute("data-value-prop");
1513
- valueProp === "minValue" ? (this.minHandle = el) : (this.maxHandle = el);
1514
- };
1515
- /**
1516
- * Returns a string representing the localized label value based if the groupSeparator prop is parsed.
1517
- *
1518
- * @param value
1519
- */
1520
- this.formatValue = (value) => {
1521
- locale.numberStringFormatter.numberFormatOptions = {
1522
- locale: this.effectiveLocale,
1523
- numberingSystem: this.numberingSystem,
1524
- useGrouping: this.groupSeparator,
1525
- };
1526
- return locale.numberStringFormatter.localize(value.toString());
1527
- };
1528
- this.disabled = false;
1529
- this.fillPlacement = "start";
1530
- this.form = undefined;
1531
- this.groupSeparator = false;
1532
- this.hasHistogram = false;
1533
- this.histogram = undefined;
1534
- this.histogramStops = undefined;
1535
- this.labelHandles = false;
1536
- this.labelFormatter = undefined;
1537
- this.labelTicks = false;
1538
- this.max = 100;
1539
- this.maxLabel = undefined;
1540
- this.maxValue = undefined;
1541
- this.min = 0;
1542
- this.minLabel = undefined;
1543
- this.minValue = undefined;
1544
- this.mirrored = false;
1545
- this.name = undefined;
1546
- this.numberingSystem = undefined;
1547
- this.pageStep = undefined;
1548
- this.precise = false;
1549
- this.required = false;
1550
- this.snap = false;
1551
- this.step = 1;
1552
- this.ticks = undefined;
1553
- this.value = 0;
1214
+ this.idsFound = index.createEvent(this, "idsFound", 7);
1215
+ this.noLayersFound = index.createEvent(this, "noLayersFound", 7);
1216
+ this.layerSelectionChange = index.createEvent(this, "layerSelectionChange", 7);
1217
+ this.appearance = "transparent";
1218
+ this.defaultLayerId = "";
1219
+ this.display = "inline-block";
1220
+ this.enabledLayerIds = [];
1221
+ this.enabledTableIds = [];
1222
+ this.height = undefined;
1223
+ this.isMobile = undefined;
1224
+ this.mapView = undefined;
1225
+ this.onlyShowUpdatableLayers = undefined;
1226
+ this.placeholderIcon = "";
1227
+ this.selectedIds = [];
1554
1228
  this.scale = "m";
1555
- this.effectiveLocale = "";
1556
- this.minMaxValueRange = null;
1557
- this.minValueDragRange = null;
1558
- this.maxValueDragRange = null;
1559
- this.tickValues = [];
1560
- }
1561
- histogramWatcher(newHistogram) {
1562
- this.hasHistogram = !!newHistogram;
1563
- }
1564
- ticksWatcher() {
1565
- this.tickValues = this.generateTickValues();
1566
- }
1567
- valueHandler() {
1568
- this.setMinMaxFromValue();
1569
- }
1570
- minMaxValueHandler() {
1571
- this.setValueFromMinMax();
1229
+ this.showTables = undefined;
1230
+ this.showSingleLayerAsLabel = false;
1231
+ this.type = "select";
1232
+ this._hasMultipleLayers = true;
1233
+ this._hasValidLayers = true;
1234
+ this._isDropdownOpen = undefined;
1235
+ this.ids = [];
1236
+ this.selectedName = "";
1237
+ this._translations = undefined;
1572
1238
  }
1239
+ get el() { return index.getElement(this); }
1573
1240
  //--------------------------------------------------------------------------
1574
1241
  //
1575
- // Lifecycle
1242
+ // Properties (protected)
1576
1243
  //
1577
1244
  //--------------------------------------------------------------------------
1578
- connectedCallback() {
1579
- interactive.connectInteractive(this);
1580
- locale.connectLocalized(this);
1581
- this.setMinMaxFromValue();
1582
- this.setValueFromMinMax();
1583
- label.connectLabel(this);
1584
- form.connectForm(this);
1585
- }
1586
- disconnectedCallback() {
1587
- interactive.disconnectInteractive(this);
1588
- label.disconnectLabel(this);
1589
- form.disconnectForm(this);
1590
- locale.disconnectLocalized(this);
1591
- this.removeDragListeners();
1592
- }
1593
- componentWillLoad() {
1594
- loadable.setUpLoadableComponent(this);
1595
- if (!isRange(this.value)) {
1596
- this.value = this.snap ? this.getClosestStep(this.value) : this.clamp(this.value);
1597
- }
1598
- this.ticksWatcher();
1599
- this.histogramWatcher(this.histogram);
1600
- form.afterConnectDefaultValueSet(this, this.value);
1601
- }
1602
- componentDidLoad() {
1603
- loadable.setComponentLoaded(this);
1604
- }
1605
- componentDidRender() {
1606
- if (this.labelHandles) {
1607
- this.adjustHostObscuredHandleLabel("value");
1608
- if (isRange(this.value)) {
1609
- this.adjustHostObscuredHandleLabel("minValue");
1610
- if (!(this.precise && !this.hasHistogram)) {
1611
- this.hyphenateCollidingRangeHandleLabels();
1612
- }
1613
- }
1614
- }
1615
- this.hideObscuredBoundingTickLabels();
1616
- interactive.updateHostInteraction(this);
1617
- }
1618
- render() {
1619
- const id = this.el.id || this.guid;
1620
- const value = isRange(this.value) ? this.maxValue : this.value;
1621
- const min = this.minValue || this.min;
1622
- const useMinValue = this.shouldUseMinValue();
1623
- const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
1624
- const maxInterval = this.getUnitInterval(value) * 100;
1625
- const mirror = this.shouldMirror();
1626
- const valueIsRange = isRange(this.value);
1627
- const thumbTypes = this.buildThumbType("max");
1628
- const thumb = this.renderThumb({
1629
- type: thumbTypes,
1630
- thumbPlacement: thumbTypes.includes("histogram") ? "below" : "above",
1631
- maxInterval,
1632
- minInterval,
1633
- mirror,
1634
- });
1635
- const minThumbTypes = this.buildThumbType("min");
1636
- const minThumb = valueIsRange &&
1637
- this.renderThumb({
1638
- type: minThumbTypes,
1639
- thumbPlacement: minThumbTypes.includes("histogram") || minThumbTypes.includes("precise")
1640
- ? "below"
1641
- : "above",
1642
- maxInterval,
1643
- minInterval,
1644
- mirror,
1645
- });
1646
- const fillPlacement = valueIsRange ? "start" : this.fillPlacement;
1647
- const trackRangePlacementStyles = fillPlacement === "none"
1648
- ? {
1649
- left: `unset`,
1650
- right: `unset`,
1651
- }
1652
- : fillPlacement === "end"
1653
- ? {
1654
- left: `${mirror ? minInterval : maxInterval}%`,
1655
- right: `${mirror ? maxInterval : minInterval}%`,
1656
- }
1657
- : /* default */
1658
- {
1659
- left: `${mirror ? 100 - maxInterval : minInterval}%`,
1660
- right: `${mirror ? minInterval : 100 - maxInterval}%`,
1661
- };
1662
- return (index.h(index.Host, { key: '345553b84f2336fe5a98bb2b3050d137130c41ef', id: id, onKeyDown: this.handleKeyDown, onTouchStart: this.handleTouchStart }, index.h(interactive.InteractiveContainer, { key: '0d9db31db94152095071d9ff40dbf3cf8ba685d6', disabled: this.disabled }, index.h("div", { key: '767ab1401000b02717013231c935fe1747def1b3', "aria-label": label.getLabelText(this), class: {
1663
- [CSS.container]: true,
1664
- [CSS.containerRange]: valueIsRange,
1665
- [`scale--${this.scale}`]: true,
1666
- } }, this.renderGraph(), index.h("div", { key: '1a104ad97079f71d37efea9d933f364520d49397', class: CSS.track, ref: this.storeTrackRef }, index.h("div", { key: '84f8033505dc0f373a0d19a641886e49ca4fe732', class: CSS.trackRange, onPointerDown: this.onTrackPointerDown, style: trackRangePlacementStyles }), index.h("div", { key: '79f89b93a6acbb05ffce09bd2aa34ef134b3e219', class: CSS.ticks }, this.tickValues.map((tick) => {
1667
- const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
1668
- let activeTicks = false;
1669
- if (fillPlacement === "start" || fillPlacement === "end") {
1670
- if (useMinValue) {
1671
- activeTicks = tick >= this.minValue && tick <= this.maxValue;
1672
- }
1673
- else {
1674
- const rangeStart = fillPlacement === "start" ? min : value;
1675
- const rangeEnd = fillPlacement === "start" ? value : this.max;
1676
- activeTicks = tick >= rangeStart && tick <= rangeEnd;
1677
- }
1678
- }
1679
- return (index.h("span", { class: {
1680
- [CSS.tick]: true,
1681
- [CSS.tickActive]: activeTicks,
1682
- }, style: {
1683
- left: mirror ? "" : tickOffset,
1684
- right: mirror ? tickOffset : "",
1685
- } }, this.renderTickLabel(tick)));
1686
- }))), index.h("div", { key: '9bc6ea406e2036adb87da4a6053533283434864d', class: CSS.thumbContainer }, minThumb, thumb, index.h(form.HiddenFormInputSlot, { key: 'c13236898b527a1ffc058914fe87e6004b93aaf5', component: this }))))));
1687
- }
1688
- renderThumb({ type, mirror, thumbPlacement, minInterval, maxInterval, }) {
1689
- const isLabeled = type.includes("labeled");
1690
- const isPrecise = type.includes("precise");
1691
- const isMinThumb = type.includes("min");
1692
- const valueIsRange = isRange(this.value);
1693
- const value = isMinThumb
1694
- ? this.minValue
1695
- : valueIsRange
1696
- ? this.maxValue
1697
- : this.value;
1698
- const valueProp = isMinThumb ? "minValue" : valueIsRange ? "maxValue" : "value";
1699
- const ariaLabel = isMinThumb ? this.minLabel : valueIsRange ? this.maxLabel : this.minLabel;
1700
- const ariaValuenow = isMinThumb ? this.minValue : value;
1701
- const displayedValue = valueProp === "minValue"
1702
- ? this.internalLabelFormatter(this.minValue, "min")
1703
- : valueProp === "maxValue"
1704
- ? this.internalLabelFormatter(this.maxValue, "max")
1705
- : this.internalLabelFormatter(value, "value");
1706
- const thumbStyle = isMinThumb
1707
- ? { left: `${mirror ? 100 - minInterval : minInterval}%` }
1708
- : { right: `${mirror ? maxInterval : 100 - maxInterval}%` };
1709
- const thumbLabelClasses = `${CSS.handleLabel} ${isMinThumb ? CSS.handleLabelMinValue : CSS.handleLabelValue}`;
1710
- const labels = isLabeled
1711
- ? [
1712
- index.h("span", { "aria-hidden": "true", class: thumbLabelClasses }, displayedValue),
1713
- index.h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.static}` }, displayedValue),
1714
- index.h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.transformed}` }, displayedValue),
1715
- ]
1716
- : [];
1717
- const thumbContent = [
1718
- ...labels,
1719
- index.h("div", { class: CSS.handle }),
1720
- isPrecise && index.h("div", { class: CSS.handleExtension }),
1721
- ];
1722
- if (thumbPlacement === "below") {
1723
- thumbContent.reverse();
1724
- }
1725
- return (index.h("div", { "aria-disabled": this.disabled, "aria-label": ariaLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": ariaValuenow, class: {
1726
- [CSS.thumb]: true,
1727
- [CSS.thumbValue]: !isMinThumb,
1728
- [CSS.thumbActive]: this.lastDragProp !== "minMaxValue" && this.dragProp === valueProp,
1729
- [CSS.thumbPrecise]: isPrecise,
1730
- [CSS.thumbMinValue]: isMinThumb,
1731
- }, "data-value-prop": valueProp, key: type, onBlur: this.onThumbBlur, onFocus: this.onThumbFocus, onPointerDown: this.onThumbPointerDown, ref: this.storeThumbRef, role: "slider", style: thumbStyle, tabIndex: 0 }, thumbContent));
1732
- }
1733
- renderGraph() {
1734
- return this.histogram ? (index.h("calcite-graph", { class: CSS.graph, colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
1735
- }
1736
- renderTickLabel(tick) {
1737
- const { hasHistogram, labelHandles, labelTicks, max, min, precise, value } = this;
1738
- const valueIsRange = isRange(value);
1739
- const isMinTickLabel = tick === min;
1740
- const isMaxTickLabel = tick === max;
1741
- const isAtEdge = isMinTickLabel || isMaxTickLabel;
1742
- const shouldDisplayLabel = labelTicks &&
1743
- ((!hasHistogram && (isAtEdge || !precise || !valueIsRange)) ||
1744
- (hasHistogram && (isAtEdge || (!precise && !labelHandles))));
1745
- return shouldDisplayLabel ? (index.h("span", { class: {
1746
- [CSS.tickLabel]: true,
1747
- [CSS.tickMin]: isMinTickLabel,
1748
- [CSS.tickMax]: isMaxTickLabel,
1749
- } }, this.internalLabelFormatter(tick, "tick"))) : null;
1750
- }
1751
- pointerDownHandler(event) {
1752
- if (this.disabled || !dom.isPrimaryPointerButton(event)) {
1753
- return;
1754
- }
1755
- const x = event.clientX || event.pageX;
1756
- const position = this.translate(x);
1757
- let prop = "value";
1758
- if (isRange(this.value)) {
1759
- const inRange = position >= this.minValue && position <= this.maxValue;
1760
- if (inRange && this.lastDragProp === "minMaxValue") {
1761
- prop = "minMaxValue";
1762
- }
1763
- else {
1764
- const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
1765
- prop = closerToMax || position >= this.maxValue ? "maxValue" : "minValue";
1766
- }
1245
+ /**
1246
+ * boolean: When true the default layer has been loaded once and should no longer be used
1247
+ */
1248
+ defaultLayerHonored = false;
1249
+ /**
1250
+ * HTMLCalciteSelectElement: The html element for selecting layers
1251
+ */
1252
+ _layerElement;
1253
+ /**
1254
+ * IMapItemHash: id/name lookup
1255
+ */
1256
+ _layerNameHash;
1257
+ /**
1258
+ * IMapItemHash: id/name lookup
1259
+ */
1260
+ _tableNameHash;
1261
+ //--------------------------------------------------------------------------
1262
+ //
1263
+ // Watch handlers
1264
+ //
1265
+ //--------------------------------------------------------------------------
1266
+ /**
1267
+ * Called each time the mapView prop is changed.
1268
+ */
1269
+ async mapViewWatchHandler() {
1270
+ await this._setLayers();
1271
+ if (this.ids.length > 0) {
1272
+ this._hasValidLayers = true;
1273
+ this._hasMultipleLayers = this.ids.length > 1;
1274
+ this._setSelectedLayer(this.ids[0]);
1767
1275
  }
1768
- this.lastDragPropValue = this[prop];
1769
- this.dragStart(prop);
1770
- const isThumbActive = this.el.shadowRoot.querySelector(`.${CSS.thumb}:active`);
1771
- if (!isThumbActive) {
1772
- this.setValue({ [prop]: this.clamp(position, prop) });
1276
+ else {
1277
+ this._hasValidLayers = false;
1278
+ this.noLayersFound.emit();
1773
1279
  }
1774
- this.focusActiveHandle(x);
1775
- }
1776
- handleTouchStart(event) {
1777
- // needed to prevent extra click at the end of a handle drag
1778
- event.preventDefault();
1779
1280
  }
1780
1281
  //--------------------------------------------------------------------------
1781
1282
  //
1782
- // Public Methods
1283
+ // Methods (public)
1783
1284
  //
1784
1285
  //--------------------------------------------------------------------------
1785
- /** Sets focus on the component. */
1786
- async setFocus() {
1787
- await loadable.componentFocusable(this);
1788
- const handle = this.minHandle ? this.minHandle : this.maxHandle;
1789
- handle?.focus();
1790
- }
1791
1286
  //--------------------------------------------------------------------------
1792
1287
  //
1793
- // Private Methods
1288
+ // Events (public)
1794
1289
  //
1795
1290
  //--------------------------------------------------------------------------
1796
- buildThumbType(type) {
1797
- const thumbTypeParts = [type];
1798
- if (this.labelHandles) {
1799
- thumbTypeParts.push("labeled");
1800
- }
1801
- if (this.precise) {
1802
- thumbTypeParts.push("precise");
1803
- }
1804
- if (this.hasHistogram) {
1805
- thumbTypeParts.push("histogram");
1806
- }
1807
- return thumbTypeParts.join("-");
1808
- }
1809
- setValueFromMinMax() {
1810
- const { minValue, maxValue } = this;
1811
- if (typeof minValue === "number" && typeof maxValue === "number") {
1812
- this.value = [minValue, maxValue];
1813
- }
1814
- }
1815
- setMinMaxFromValue() {
1816
- const { value } = this;
1817
- if (isRange(value)) {
1818
- this.minValue = value[0];
1819
- this.maxValue = value[1];
1820
- }
1821
- }
1822
- onLabelClick() {
1823
- this.setFocus();
1824
- }
1825
- shouldMirror() {
1826
- return this.mirrored && !this.hasHistogram;
1291
+ /**
1292
+ * Emitted on demand when no valid layers are found
1293
+ *
1294
+ */
1295
+ idsFound;
1296
+ /**
1297
+ * Emitted on demand when no valid layers are found
1298
+ *
1299
+ */
1300
+ noLayersFound;
1301
+ /**
1302
+ * Emitted on demand when a layer is selected
1303
+ *
1304
+ */
1305
+ layerSelectionChange;
1306
+ //--------------------------------------------------------------------------
1307
+ //
1308
+ // Functions (lifecycle)
1309
+ //
1310
+ //--------------------------------------------------------------------------
1311
+ /**
1312
+ * StencilJS: Called once just after the component is first connected to the DOM.
1313
+ */
1314
+ async componentWillLoad() {
1315
+ await this._getTranslations();
1316
+ await this._setLayers();
1827
1317
  }
1828
- shouldUseMinValue() {
1829
- if (!isRange(this.value)) {
1830
- return false;
1318
+ /**
1319
+ * StencilJS: Called once just after the component is first connected to the DOM.
1320
+ */
1321
+ async componentWillRender() {
1322
+ if (this.ids.length > 0 || this.selectedIds.length === 1) {
1323
+ const layer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedIds[0]);
1324
+ this.selectedName = layer?.title;
1831
1325
  }
1832
- return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
1833
1326
  }
1834
- getTickDensity() {
1835
- const density = (this.max - this.min) / this.ticks / maxTickElementThreshold;
1836
- return density < 1 ? 1 : density;
1327
+ /**
1328
+ * Renders the component.
1329
+ */
1330
+ render() {
1331
+ const id = "map-layer-picker";
1332
+ let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
1333
+ style = { ...style, "display": this.display };
1334
+ return (index.h(index.Host, { key: '47a42a4855654930ebaf59b1567ab4bd5ccf3133' }, index.h("div", { key: 'acc05150c663d68ae633a7d293984ae282cfbdfa', class: "map-layer-picker-container", style: style }, index.h("div", { key: '811bde9a5118862f58b6a9ed99abec0f46fb4a1f', class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
1335
+ !this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
1336
+ this.type === "combobox" ? this._getCombobox(id) :
1337
+ this.type === "select" ? this._getSelect(id) : this._getDropdown(id)))));
1837
1338
  }
1838
- generateTickValues() {
1839
- const tickInterval = this.ticks ?? 0;
1840
- if (tickInterval <= 0) {
1841
- return [];
1842
- }
1843
- const ticks = [this.min];
1844
- const density = this.getTickDensity();
1845
- const tickOffset = tickInterval * density;
1846
- let current = this.min;
1847
- while (current < this.max) {
1848
- current += tickOffset;
1849
- ticks.push(Math.min(current, this.max));
1850
- }
1851
- if (!ticks.includes(this.max)) {
1852
- ticks.push(this.max);
1339
+ /**
1340
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
1341
+ */
1342
+ async componentDidLoad() {
1343
+ if (this.ids.length > 0 || this.selectedIds.length === 1) {
1344
+ const id = this.selectedIds.length === 1 ? this.selectedIds[0] : this.ids[0];
1345
+ if (this.type === "select") {
1346
+ this._layerElement.value = id;
1347
+ }
1348
+ else if (this.type === "dropdown") {
1349
+ this.selectedName = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1350
+ this._layerNameHash[id].name : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1351
+ this._tableNameHash[id].name : "";
1352
+ }
1853
1353
  }
1854
- return ticks;
1855
1354
  }
1856
- pointerDownDragStart(event, prop) {
1857
- if (!dom.isPrimaryPointerButton(event)) {
1858
- return;
1859
- }
1860
- this.dragStart(prop);
1861
- }
1862
- dragStart(prop) {
1863
- this.dragProp = prop;
1864
- this.lastDragProp = this.dragProp;
1865
- this.activeProp = prop;
1866
- window.addEventListener("pointermove", this.dragUpdate);
1867
- window.addEventListener("pointerup", this.pointerUpDragEnd);
1868
- window.addEventListener("pointercancel", this.dragEnd);
1869
- }
1870
- focusActiveHandle(valueX) {
1871
- if (this.dragProp === "minValue") {
1872
- this.minHandle.focus();
1873
- }
1874
- else if (this.dragProp === "maxValue" || this.dragProp === "value") {
1875
- this.maxHandle.focus();
1876
- }
1877
- else if (this.dragProp === "minMaxValue") {
1878
- this.getClosestHandle(valueX).focus();
1879
- }
1355
+ //--------------------------------------------------------------------------
1356
+ //
1357
+ // Functions (protected)
1358
+ //
1359
+ //--------------------------------------------------------------------------
1360
+ /**
1361
+ * Create a notice to inform the user that no layers were found
1362
+ *
1363
+ * @returns Calcite Notice component with the message
1364
+ */
1365
+ _getInvalidPlaceholder() {
1366
+ return (index.h("div", null, index.h("calcite-notice", { class: "height-100", icon: "exclamation-mark-triangle", id: "no-valid-layers", kind: "danger", open: true }, index.h("div", { slot: "message" }, this._translations.noLayersFound)), index.h("calcite-tooltip", { label: this._translations.enableEditUpdate, placement: "bottom", "reference-element": "no-valid-layers" }, index.h("span", null, this._translations.enableEditUpdate))));
1880
1367
  }
1881
- emitInput() {
1882
- this.calciteSliderInput.emit();
1368
+ /**
1369
+ * Show layer name as a label with icon
1370
+ *
1371
+ * @returns Calcite label with the layer name and icon
1372
+ */
1373
+ _getSingleLayerPlaceholder() {
1374
+ return (index.h("div", { class: "layer-picker-label-container cursor-default" }, index.h("calcite-icon", { icon: "layers", scale: "s" }), index.h("calcite-label", { class: "no-bottom-margin padding-start-1" }, this.selectedName)));
1883
1375
  }
1884
- emitChange() {
1885
- this.calciteSliderChange.emit();
1376
+ /**
1377
+ * Create a list of layers from the map
1378
+ * Used for selecting a single layer.
1379
+ *
1380
+ * @param id the id for the select component used to support the tooltip
1381
+ *
1382
+ * @returns Calcite Select component with the ids of the layers from the map
1383
+ */
1384
+ _getSelect(id) {
1385
+ return (index.h("calcite-select", { id: id, label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this._getMapLayerOptions()));
1886
1386
  }
1887
- removeDragListeners() {
1888
- window.removeEventListener("pointermove", this.dragUpdate);
1889
- window.removeEventListener("pointerup", this.pointerUpDragEnd);
1890
- window.removeEventListener("pointercancel", this.dragEnd);
1387
+ /**
1388
+ * Create a list of layer ids from the map
1389
+ * Used for selecting multiple layers
1390
+ *
1391
+ * @param id the id for the combobox component used to support the tooltip
1392
+ *
1393
+ * @returns Calcite ComboBox component with the ids of the layers from the map
1394
+ */
1395
+ _getCombobox(id) {
1396
+ return (index.h("calcite-combobox", { clearDisabled: true, id: id, label: "", onCalciteComboboxChange: () => this._layerSelectionChange(), "placeholder-icon": this.placeholderIcon, ref: (el) => { this._layerElement = el; }, scale: this.scale, "selection-mode": "single" }, this._getMapLayerOptions()));
1891
1397
  }
1892
1398
  /**
1893
- * Set prop value(s) if changed at the component level
1399
+ * Hydrate a dropdown component with items to display the layer names
1400
+ *
1401
+ * @param id the id for the dropdown component used to support the tooltip
1894
1402
  *
1895
- * @param {object} values - a set of key/value pairs delineating what properties in the component to update
1403
+ * @returns Array of Dropdown items with layer names
1896
1404
  */
1897
- setValue(values) {
1898
- let valueChanged;
1899
- Object.keys(values).forEach((propName) => {
1900
- const newValue = values[propName];
1901
- if (!valueChanged) {
1902
- const oldValue = this[propName];
1903
- valueChanged = oldValue !== newValue;
1904
- }
1905
- this[propName] = newValue;
1906
- });
1907
- if (!valueChanged) {
1908
- return;
1909
- }
1910
- const dragging = this.dragProp;
1911
- if (!dragging) {
1912
- this.emitChange();
1913
- }
1914
- this.emitInput();
1405
+ _getDropdown(id) {
1406
+ return (index.h("calcite-dropdown", { class: "layer-picker-dropdown", onCalciteDropdownBeforeClose: () => this._isDropdownOpen = false, onCalciteDropdownBeforeOpen: () => this._isDropdownOpen = true }, this.isMobile ? this._getDropdownButton() : this._getActionDropdownButton(id), index.h("calcite-dropdown-group", { "selection-mode": "single" }, this._getMapLayerOptions())));
1915
1407
  }
1916
1408
  /**
1917
- * If number is outside range, constrain to min or max
1409
+ * Get the button that will open the dropdown list wrapped in an action
1918
1410
  *
1919
- * @param value
1920
- * @param prop
1921
- * @internal
1411
+ * @returns the node for the action and button
1922
1412
  */
1923
- clamp(value, prop) {
1924
- value = math.clamp(value, this.min, this.max);
1925
- // ensure that maxValue and minValue don't swap positions
1926
- if (prop === "maxValue") {
1927
- value = Math.max(value, this.minValue);
1928
- }
1929
- if (prop === "minValue") {
1930
- value = Math.min(value, this.maxValue);
1931
- }
1932
- return value;
1413
+ _getActionDropdownButton(id) {
1414
+ return (index.h("calcite-action", { id: id, slot: "trigger", text: "" }, this._getDropdownButton()));
1933
1415
  }
1934
1416
  /**
1935
- * Translate a pixel position to value along the range
1417
+ * Get the button that will open the dropdown list
1936
1418
  *
1937
- * @param x
1938
- * @internal
1419
+ * @returns the node for the button
1939
1420
  */
1940
- translate(x) {
1941
- const range = this.max - this.min;
1942
- const { left, width } = this.trackEl.getBoundingClientRect();
1943
- const percent = (x - left) / width;
1944
- const mirror = this.shouldMirror();
1945
- const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
1946
- const value = Number(clampedValue.toFixed(math.decimalPlaces(this.step)));
1947
- return !(this.snap && this.step) ? value : this.getClosestStep(value);
1421
+ _getDropdownButton() {
1422
+ const buttonClass = this.isMobile ? "" : "max-width-350";
1423
+ const buttonSlot = this.isMobile ? "trigger" : "";
1424
+ const buttonIcon = this._isDropdownOpen ? "chevron-up" : "chevron-down";
1425
+ return (index.h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: buttonClass, iconEnd: buttonIcon, iconStart: "layers", kind: "neutral", slot: buttonSlot, width: "full" }, index.h("div", null, this.selectedName)));
1948
1426
  }
1949
1427
  /**
1950
- * Get closest allowed value along stepped values
1428
+ * Get the appropriate type of dom nodes for each valid layer or table
1951
1429
  *
1952
- * @param value
1953
- * @internal
1430
+ * @returns Array of dom nodes with the names of the layers and optionally of the tables
1954
1431
  */
1955
- getClosestStep(value) {
1956
- const { max, min, step } = this;
1957
- let snappedValue = Math.floor((value - min) / step) * step + min;
1958
- snappedValue = Math.min(Math.max(snappedValue, min), max);
1959
- if (snappedValue > max) {
1960
- snappedValue -= step;
1961
- }
1962
- return snappedValue;
1432
+ _getMapLayerOptions() {
1433
+ return this.ids.reduce((prev, cur) => {
1434
+ if (this._validLayer(cur)) {
1435
+ prev.push(this._getItem(cur, "layer"));
1436
+ }
1437
+ else if (this._validTable(cur)) {
1438
+ prev.push(this._getItem(cur, "table"));
1439
+ }
1440
+ return prev;
1441
+ }, []);
1963
1442
  }
1964
- getClosestHandle(valueX) {
1965
- return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
1966
- ? this.minHandle
1967
- : this.maxHandle;
1443
+ /**
1444
+ * Get the appropriate type of dom node for the current layer or table id
1445
+ *
1446
+ * @returns A dom node with the name of the layer or table
1447
+ */
1448
+ _getItem(id, itemType) {
1449
+ const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
1450
+ const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
1451
+ const name = item.name;
1452
+ const selected = this.selectedIds.indexOf(id) > -1;
1453
+ return this.type === "combobox" ? (index.h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
1454
+ this.type === "select" ? (index.h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (index.h("calcite-dropdown-group", { class: disabled ? "disabled" : "", selectionMode: disabled ? "none" : "single" }, index.h("calcite-dropdown-item", { onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name)));
1968
1455
  }
1969
- getDistanceX(el, valueX) {
1970
- return Math.abs(el.getBoundingClientRect().left - valueX);
1456
+ /**
1457
+ * Store the layer name based on the user selection
1458
+ */
1459
+ _setSelectedLayer(id) {
1460
+ let item;
1461
+ const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
1462
+ if (hasDefaultLayer) {
1463
+ item = this._getLayerFromHash(this.defaultLayerId);
1464
+ this.defaultLayerHonored = item !== undefined;
1465
+ id = this.defaultLayerHonored ? this.defaultLayerId : id;
1466
+ }
1467
+ item = item ? item : this._getLayerFromHash(id);
1468
+ this.selectedName = item?.name;
1469
+ this.selectedIds = [id];
1470
+ this.layerSelectionChange.emit(this.selectedIds);
1971
1471
  }
1972
- getFontSizeForElement(element) {
1973
- return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
1472
+ /**
1473
+ * Fetch layer hash info for the given id
1474
+ *
1475
+ * @returns ILayerHashInfo for the id
1476
+ */
1477
+ _getLayerFromHash(id) {
1478
+ return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
1479
+ this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
1480
+ this._tableNameHash[id] : undefined;
1974
1481
  }
1975
1482
  /**
1976
- * Get position of value along range as fractional value
1483
+ * Fetch the ids of the layers from the map
1977
1484
  *
1978
- * @param num
1979
- * @return {number} number in the unit interval [0,1]
1980
- * @internal
1485
+ * @returns Promise when the operation has completed
1981
1486
  */
1982
- getUnitInterval(num) {
1983
- num = this.clamp(num);
1984
- const range = this.max - this.min;
1985
- return (num - this.min) / range;
1986
- }
1987
- adjustHostObscuredHandleLabel(name) {
1988
- const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
1989
- const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
1990
- const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
1991
- const labelStaticBounds = labelStatic.getBoundingClientRect();
1992
- const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
1993
- label.style.transform = `translateX(${labelStaticOffset}px)`;
1994
- labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
1995
- }
1996
- hyphenateCollidingRangeHandleLabels() {
1997
- const { shadowRoot } = this.el;
1998
- const mirror = this.shouldMirror();
1999
- const leftModifier = mirror ? "value" : "minValue";
2000
- const rightModifier = mirror ? "minValue" : "value";
2001
- const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
2002
- const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
2003
- const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
2004
- const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
2005
- const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
2006
- const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
2007
- const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
2008
- const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
2009
- const labelFontSize = this.getFontSizeForElement(leftValueLabel);
2010
- const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
2011
- const hyphenLabel = leftValueLabel;
2012
- const labelOffset = labelFontSize / 2;
2013
- if (labelTransformedOverlap > 0) {
2014
- hyphenLabel.classList.add(CSS.hyphen, CSS.hyphenWrap);
2015
- if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
2016
- // Neither handle overlaps the host boundary
2017
- let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
2018
- leftValueLabelTranslate =
2019
- Math.sign(leftValueLabelTranslate) === -1
2020
- ? Math.abs(leftValueLabelTranslate)
2021
- : -leftValueLabelTranslate;
2022
- const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
2023
- leftValueLabelTranslate -
2024
- labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
2025
- leftValueLabelTranslate -
2026
- labelOffset);
2027
- let rightValueLabelTranslate = labelTransformedOverlap / 2;
2028
- const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
2029
- if (leftValueLabelTransformedHostOffset !== 0) {
2030
- leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
2031
- rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
2032
- }
2033
- if (rightValueLabelTransformedHostOffset !== 0) {
2034
- leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
2035
- rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
2036
- }
2037
- leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
2038
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
2039
- rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
2040
- rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
2041
- }
2042
- else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
2043
- // labels overlap host boundary on the left side
2044
- leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
2045
- rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
2046
- rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
2047
- }
2048
- else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
2049
- // labels overlap host boundary on the right side
2050
- let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
2051
- leftValueLabelTranslate =
2052
- Math.sign(leftValueLabelTranslate) === -1
2053
- ? Math.abs(leftValueLabelTranslate)
2054
- : -leftValueLabelTranslate;
2055
- leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
2056
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
2057
- }
2058
- }
2059
- else {
2060
- hyphenLabel.classList.remove(CSS.hyphen, CSS.hyphenWrap);
2061
- leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
2062
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
2063
- rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
2064
- rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
1487
+ async _setLayers() {
1488
+ if (this.mapView) {
1489
+ await this._initLayerTableHash();
1490
+ const layerIds = this.onlyShowUpdatableLayers ?
1491
+ this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
1492
+ const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
1493
+ this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
1494
+ this.ids = [
1495
+ ...layerIds.reverse().filter(n => this.enabledLayerIds?.length > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true),
1496
+ ...tableIds.reverse().filter(n => this.enabledTableIds?.length > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true),
1497
+ ];
1498
+ this.idsFound.emit({
1499
+ layerIds,
1500
+ tableIds
1501
+ });
2065
1502
  }
2066
1503
  }
2067
1504
  /**
2068
- * Hides bounding tick labels that are obscured by either handle.
1505
+ * Fetch the ids of all layers that support edits with the update capability
1506
+ *
1507
+ * @returns array of layer ids
2069
1508
  */
2070
- hideObscuredBoundingTickLabels() {
2071
- const valueIsRange = isRange(this.value);
2072
- if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
2073
- return;
2074
- }
2075
- if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
2076
- return;
2077
- }
2078
- if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
2079
- return;
2080
- }
2081
- if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
2082
- return;
2083
- }
2084
- if (!this.hasHistogram && valueIsRange && !this.precise) {
2085
- return;
2086
- }
2087
- if (this.hasHistogram && !this.precise && !this.labelHandles) {
2088
- return;
2089
- }
2090
- const minHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbMinValue}`);
2091
- const maxHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbValue}`);
2092
- const minTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMin}`);
2093
- const maxTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMax}`);
2094
- if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
2095
- minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
2096
- maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
2097
- }
2098
- if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
2099
- minTickLabel.style.opacity =
2100
- this.isMinTickLabelObscured(minTickLabel, minHandle) ||
2101
- this.isMinTickLabelObscured(minTickLabel, maxHandle)
2102
- ? "0"
2103
- : "1";
2104
- maxTickLabel.style.opacity =
2105
- this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
2106
- (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
2107
- ? "0"
2108
- : "1";
2109
- }
1509
+ _getEditableIds(hash) {
1510
+ return Object.keys(hash).reduce((prev, cur) => {
1511
+ if (hash[cur].supportsUpdate) {
1512
+ prev.push(cur);
1513
+ }
1514
+ return prev;
1515
+ }, []);
2110
1516
  }
2111
1517
  /**
2112
- * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
1518
+ * Create a layer id:title hash for layer name display
2113
1519
  *
2114
- * @param leftBounds
2115
- * @param rightBounds
2116
- * @internal
1520
+ * @returns Promise when the operation has completed
2117
1521
  */
2118
- getHostOffset(leftBounds, rightBounds) {
2119
- const hostBounds = this.el.getBoundingClientRect();
2120
- const buffer = 7;
2121
- if (leftBounds + buffer < hostBounds.left) {
2122
- return hostBounds.left - leftBounds - buffer;
2123
- }
2124
- if (rightBounds - buffer > hostBounds.right) {
2125
- return -(rightBounds - hostBounds.right) + buffer;
2126
- }
2127
- return 0;
1522
+ async _initLayerTableHash() {
1523
+ this._layerNameHash = await mapViewUtils.getMapLayerHash(this.mapView, this.onlyShowUpdatableLayers);
1524
+ this._tableNameHash = this.showTables ? await mapViewUtils.getMapTableHash(this.mapView, this.onlyShowUpdatableLayers) : {};
2128
1525
  }
2129
1526
  /**
2130
- * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
2131
- * a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
1527
+ * Evaluate if the id exists in the current hash and verify if it should be excluded
2132
1528
  *
2133
- * @param leftLabel
2134
- * @param rightLabel
1529
+ * @returns boolean when true the layer will be used in the current layer picker type
2135
1530
  */
2136
- getRangeLabelOverlap(leftLabel, rightLabel) {
2137
- const leftLabelBounds = leftLabel.getBoundingClientRect();
2138
- const rightLabelBounds = rightLabel.getBoundingClientRect();
2139
- const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
2140
- const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
2141
- return Math.max(rangeLabelOverlap, 0);
1531
+ _validLayer(id) {
1532
+ const name = this._layerNameHash[id]?.name;
1533
+ return name && Object.keys(publicNotificationStore.state.managedLayers).indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
1534
+ this.enabledLayerIds.indexOf(id) > -1 : true);
2142
1535
  }
2143
1536
  /**
2144
- * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
1537
+ * Evaluate if the id exists in the current hash and verify if it should be excluded
2145
1538
  *
2146
- * @param minLabel
2147
- * @param handle
1539
+ * @returns boolean when true the table will be used in the current layer picker type
2148
1540
  */
2149
- isMinTickLabelObscured(minLabel, handle) {
2150
- const minLabelBounds = minLabel.getBoundingClientRect();
2151
- const handleBounds = handle.getBoundingClientRect();
2152
- return dom.intersects(minLabelBounds, handleBounds);
1541
+ _validTable(id) {
1542
+ const name = this._tableNameHash[id]?.name;
1543
+ const validName = name && this.showTables;
1544
+ return validName ? publicNotificationStore.state.managedTables.indexOf(name) < 0 &&
1545
+ (this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
2153
1546
  }
2154
1547
  /**
2155
- * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
1548
+ * Fetch the ids of the layers from the map
2156
1549
  *
2157
- * @param maxLabel
2158
- * @param handle
1550
+ * @returns Promise when the operation has completed
2159
1551
  */
2160
- isMaxTickLabelObscured(maxLabel, handle) {
2161
- const maxLabelBounds = maxLabel.getBoundingClientRect();
2162
- const handleBounds = handle.getBoundingClientRect();
2163
- return dom.intersects(maxLabelBounds, handleBounds);
2164
- }
2165
- internalLabelFormatter(value, type) {
2166
- const customFormatter = this.labelFormatter;
2167
- if (!customFormatter) {
2168
- return this.formatValue(value);
2169
- }
2170
- const formattedValue = customFormatter(value, type, this.formatValue);
2171
- if (formattedValue == null) {
2172
- return this.formatValue(value);
1552
+ _layerSelectionChange() {
1553
+ const ids = Array.isArray(this._layerElement.value) ? this._layerElement.value : [this._layerElement.value];
1554
+ if (JSON.stringify(ids) !== JSON.stringify([""])) {
1555
+ this.selectedIds = ids;
1556
+ this.layerSelectionChange.emit(this.selectedIds);
2173
1557
  }
2174
- return formattedValue;
2175
1558
  }
2176
- static get delegatesFocus() { return true; }
2177
- get el() { return index.getElement(this); }
1559
+ /**
1560
+ * Fetches the component's translations
1561
+ *
1562
+ * @returns Promise when complete
1563
+ * @protected
1564
+ */
1565
+ async _getTranslations() {
1566
+ const messages = await locale$1.getLocaleComponentStrings(this.el);
1567
+ this._translations = messages[0];
1568
+ }
2178
1569
  static get watchers() { return {
2179
- "histogram": ["histogramWatcher"],
2180
- "ticks": ["ticksWatcher"],
2181
- "value": ["valueHandler"],
2182
- "minValue": ["minMaxValueHandler"],
2183
- "maxValue": ["minMaxValueHandler"]
1570
+ "mapView": ["mapViewWatchHandler"]
2184
1571
  }; }
2185
1572
  };
2186
- Slider.style = CalciteSliderStyle0;
1573
+ MapLayerPicker.style = MapLayerPickerStyle0;
2187
1574
 
2188
1575
  exports.calcite_combobox = Combobox;
2189
- exports.calcite_graph = Graph;
2190
- exports.calcite_slider = Slider;
1576
+ exports.calcite_dropdown_group = DropdownGroup;
1577
+ exports.map_layer_picker = MapLayerPicker;