@esri/solutions-components 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/cjs/buffer-tools_6.cjs.entry.js +21 -2
  2. package/dist/cjs/calcite-input-message_5.cjs.entry.js +33 -13
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/public-notification.cjs.entry.js +11 -19
  5. package/dist/cjs/solutions-components.cjs.js +1 -1
  6. package/dist/collection/components/map-draw-tools/map-draw-tools.js +21 -2
  7. package/dist/collection/components/map-select-tools/map-select-tools.js +75 -13
  8. package/dist/collection/components/public-notification/public-notification.js +81 -19
  9. package/dist/collection/demos/new-public-notification.html +10 -7
  10. package/dist/components/map-draw-tools2.js +21 -2
  11. package/dist/components/map-select-tools2.js +36 -14
  12. package/dist/components/public-notification.js +15 -20
  13. package/dist/esm/buffer-tools_6.entry.js +21 -2
  14. package/dist/esm/calcite-input-message_5.entry.js +33 -13
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/public-notification.entry.js +12 -20
  17. package/dist/esm/solutions-components.js +1 -1
  18. package/dist/solutions-components/demos/new-public-notification.html +10 -7
  19. package/dist/solutions-components/p-778c0a36.entry.js +17 -0
  20. package/dist/solutions-components/{p-fc9609e6.entry.js → p-877dd0dc.entry.js} +1 -1
  21. package/dist/solutions-components/p-bd4d0773.entry.js +6 -0
  22. package/dist/solutions-components/solutions-components.esm.js +1 -1
  23. package/dist/types/components/map-draw-tools/map-draw-tools.d.ts +4 -0
  24. package/dist/types/components/map-select-tools/map-select-tools.d.ts +18 -0
  25. package/dist/types/components/public-notification/public-notification.d.ts +22 -2
  26. package/dist/types/components.d.ts +48 -0
  27. package/dist/types/preact.d.ts +3 -1
  28. package/package.json +1 -1
  29. package/dist/solutions-components/p-07593958.entry.js +0 -6
  30. package/dist/solutions-components/p-bfa95147.entry.js +0 -17
@@ -29,6 +29,9 @@ import * as utils from "../../utils/publicNotificationUtils";
29
29
  export class PublicNotification {
30
30
  constructor() {
31
31
  this.addresseeLayerIds = [];
32
+ this.bufferColor = [227, 139, 79, 0.8];
33
+ this.bufferOutlineColor = [255, 255, 255];
34
+ this.customLabelEnabled = undefined;
32
35
  this.defaultBufferDistance = undefined;
33
36
  this.defaultBufferUnit = undefined;
34
37
  this.exportOptions = undefined;
@@ -89,16 +92,6 @@ export class PublicNotification {
89
92
  return this._highlightFeatures();
90
93
  }
91
94
  }
92
- //--------------------------------------------------------------------------
93
- //
94
- // Methods (public)
95
- //
96
- //--------------------------------------------------------------------------
97
- //--------------------------------------------------------------------------
98
- //
99
- // Events (public)
100
- //
101
- //--------------------------------------------------------------------------
102
95
  /**
103
96
  * Handle changes to the selection sets
104
97
  */
@@ -286,21 +279,19 @@ export class PublicNotification {
286
279
  * @protected
287
280
  */
288
281
  _getSelectPage() {
289
- var _a, _b;
290
- // const searchTip = `${this._translations.selectSearchTip} ${this._translations.optionalSearchDistance}`;
282
+ var _a, _b, _c;
291
283
  const searchTip = this._translations.selectSearchTip;
292
- // const selectTip = `${this._translations.selectLayerTip} ${this._translations.optionalSearchDistance}`;
293
284
  const selectTip = this._translations.selectLayerTip;
294
- // const sketchTip = this._sketchType === ESketchType.INTERACTIVE ?
295
- // `${this._translations.selectSketchTip} ${this._translations.optionalSearchDistance}` :
296
- // `${this._translations.selectLayerTip} ${this._translations.optionalSearchDistance}`;
297
285
  const sketchTip = this._sketchType === ESketchType.INTERACTIVE ?
298
286
  this._translations.selectSketchTip :
299
287
  this._translations.selectLayerTip;
300
288
  const noticeText = this._selectionWorkflowType === EWorkflowType.SELECT ? selectTip :
301
289
  this._selectionWorkflowType === EWorkflowType.SKETCH ? sketchTip : searchTip;
302
- return (h("calcite-panel", null, this._getLabel(this._translations.stepTwoFull.replace("{{layer}}", (_a = this.addresseeLayer) === null || _a === void 0 ? void 0 : _a.layer.title)), this._getNotice(noticeText), h("div", { class: "padding-1" }, h("map-select-tools", { class: "font-bold", enabledLayerIds: this.selectionLayerIds, isUpdate: !!this._activeSelection, mapView: this.mapView, onSelectionSetChange: (evt) => this._updateForSelection(evt), onWorkflowTypeChange: (evt) => this._updateForWorkflowType(evt), ref: (el) => { this._selectTools = el; }, searchConfiguration: this.searchConfiguration, selectLayerView: this.addresseeLayer, selectionSet: this._activeSelection, showBufferTools: this.showSearchSettings })), h("div", { class: "padding-sides-1 padding-bottom-1", style: { "align-items": "end", "display": "flex" } }, h("calcite-icon", { class: "info-blue padding-end-1-2", icon: "feature-layer", scale: "s" }), h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this.noResultText && this._numSelected === 0 ? this.noResultText :
303
- this._translations.selectedAddresses.replace("{{n}}", this._numSelected.toString()).replace("{{layer}}", ((_b = this.addresseeLayer) === null || _b === void 0 ? void 0 : _b.layer.title) || ""))), this._getPageNavButtons(this._translations.done, this._numSelected === 0, () => { void this._saveSelection(); }, this._translations.cancel, false, () => { void this._home(); })));
290
+ const nameLabelClass = this.customLabelEnabled ? "" : "display-none";
291
+ return (h("calcite-panel", null, this._getLabel(this._translations.stepTwoFull.replace("{{layer}}", (_a = this.addresseeLayer) === null || _a === void 0 ? void 0 : _a.layer.title)), this._getNotice(noticeText), h("div", { class: "padding-top-sides-1" }, h("map-select-tools", { bufferColor: this.bufferColor, bufferOutlineColor: this.bufferOutlineColor, class: "font-bold", defaultBufferDistance: this.defaultBufferDistance, defaultBufferUnit: this.defaultBufferUnit, enabledLayerIds: this.selectionLayerIds, isUpdate: !!this._activeSelection, mapView: this.mapView, onSelectionSetChange: (evt) => this._updateForSelection(evt), onWorkflowTypeChange: (evt) => this._updateForWorkflowType(evt), ref: (el) => { this._selectTools = el; }, searchConfiguration: this.searchConfiguration, selectLayerView: this.addresseeLayer, selectionSet: this._activeSelection, showBufferTools: this.showSearchSettings })), h("div", { class: "padding-sides-1 padding-bottom-1", style: { "align-items": "end", "display": "flex" } }, h("calcite-icon", { class: "info-blue padding-end-1-2", icon: "feature-layer", scale: "s" }), h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this.noResultText && this._numSelected === 0 ? this.noResultText :
292
+ this._translations.selectedAddresses.replace("{{n}}", this._numSelected.toString()).replace("{{layer}}", ((_b = this.addresseeLayer) === null || _b === void 0 ? void 0 : _b.layer.title) || ""))), h("div", { class: "padding-sides-1 " + nameLabelClass }, h("calcite-label", { class: "font-bold" }, "Name label", h("calcite-input", { onInput: () => {
293
+ this.labelChange.emit(this._labelName.value);
294
+ }, placeholder: "Insert label here...", ref: (el) => { this._labelName = el; }, value: ((_c = this._activeSelection) === null || _c === void 0 ? void 0 : _c.label) || "" }))), this._getPageNavButtons(this._translations.done, this._numSelected === 0, () => { void this._saveSelection(); }, this._translations.cancel, false, () => { void this._home(); })));
304
295
  }
305
296
  /**
306
297
  * Create the Refine page that users can interactively add/remove features from existing selection sets
@@ -388,7 +379,7 @@ export class PublicNotification {
388
379
  * Get selection set list node with checkbox for Download pages
389
380
  *
390
381
  * @returns the list node
391
- * @protected
382
+ * @protectedlabel
392
383
  */
393
384
  _getSelectionLists() {
394
385
  return this._selectionSets.reduce((prev, cur) => {
@@ -696,6 +687,59 @@ export class PublicNotification {
696
687
  },
697
688
  "defaultValue": "[]"
698
689
  },
690
+ "bufferColor": {
691
+ "type": "any",
692
+ "mutable": false,
693
+ "complexType": {
694
+ "original": "any",
695
+ "resolved": "any",
696
+ "references": {}
697
+ },
698
+ "required": false,
699
+ "optional": false,
700
+ "docs": {
701
+ "tags": [],
702
+ "text": "string | number[] | object with r, g, b, a: https://developers.arcgis.com/javascript/latest/api-reference/esri-Color.html"
703
+ },
704
+ "attribute": "buffer-color",
705
+ "reflect": false,
706
+ "defaultValue": "[227, 139, 79, 0.8]"
707
+ },
708
+ "bufferOutlineColor": {
709
+ "type": "any",
710
+ "mutable": false,
711
+ "complexType": {
712
+ "original": "any",
713
+ "resolved": "any",
714
+ "references": {}
715
+ },
716
+ "required": false,
717
+ "optional": false,
718
+ "docs": {
719
+ "tags": [],
720
+ "text": "string | number[] | object with r, g, b, a: https://developers.arcgis.com/javascript/latest/api-reference/esri-Color.html"
721
+ },
722
+ "attribute": "buffer-outline-color",
723
+ "reflect": false,
724
+ "defaultValue": "[255, 255, 255]"
725
+ },
726
+ "customLabelEnabled": {
727
+ "type": "boolean",
728
+ "mutable": false,
729
+ "complexType": {
730
+ "original": "boolean",
731
+ "resolved": "boolean",
732
+ "references": {}
733
+ },
734
+ "required": false,
735
+ "optional": false,
736
+ "docs": {
737
+ "tags": [],
738
+ "text": "boolean: When true the user can define a name for each notification list"
739
+ },
740
+ "attribute": "custom-label-enabled",
741
+ "reflect": false
742
+ },
699
743
  "defaultBufferDistance": {
700
744
  "type": "number",
701
745
  "mutable": false,
@@ -915,6 +959,24 @@ export class PublicNotification {
915
959
  "_translations": {}
916
960
  };
917
961
  }
962
+ static get events() {
963
+ return [{
964
+ "method": "labelChange",
965
+ "name": "labelChange",
966
+ "bubbles": true,
967
+ "cancelable": true,
968
+ "composed": true,
969
+ "docs": {
970
+ "tags": [],
971
+ "text": "Emitted on demand when a buffer is generated."
972
+ },
973
+ "complexType": {
974
+ "original": "string",
975
+ "resolved": "string",
976
+ "references": {}
977
+ }
978
+ }];
979
+ }
918
980
  static get elementRef() { return "el"; }
919
981
  static get watchers() {
920
982
  return [{
@@ -72,9 +72,9 @@
72
72
  var webMap = new WebMap({
73
73
  portalItem: {
74
74
  // solutions
75
- // id: "3715f4899bea4b2a948347c5c2357e58"
75
+ id: "3715f4899bea4b2a948347c5c2357e58"
76
76
  // InstantApps
77
- id: "863e4f6f2a7840db896cc1b1606d552d"
77
+ //id: "863e4f6f2a7840db896cc1b1606d552d"
78
78
  }
79
79
  });
80
80
 
@@ -90,9 +90,9 @@
90
90
  });
91
91
  demo.mapView.ui.add(legend, "top-left");
92
92
  });
93
- demo.addresseeLayerIds = ["18434515eb8-layer-12"];
94
- demo.defaultBufferDistance = 100;
95
- demo.defaultBufferUnit = "kilometers";
93
+ //demo.addresseeLayerIds = ["18434515eb8-layer-12"];
94
+ //demo.defaultBufferDistance = 100;
95
+ //demo.defaultBufferUnit = "kilometers";
96
96
  demo.exportOptions = {
97
97
  csvOptions: {
98
98
  enabled: true, // I question if this should be exposed
@@ -109,8 +109,11 @@
109
109
  };
110
110
  demo.featureHighlightEnabled = true;
111
111
  demo.noResultText = "No results found";
112
- demo.selectionLayerIds = ["1843422bf6b-layer-7"];
113
- demo.showSearchSettings = false;
112
+ //demo.selectionLayerIds = ["1843422bf6b-layer-7"];
113
+ demo.showSearchSettings = true;
114
+ demo.customLabelEnabled = true;
115
+ demo.bufferColor = [227, 0, 0, 0.8];
116
+ demo.bufferOutlineColor = [0, 255, 0];
114
117
  });
115
118
  </script>
116
119
  </head>
@@ -169,10 +169,29 @@ const MapDrawTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
169
169
  }
170
170
  };
171
171
  this._sketchWidget.on("update", (evt) => {
172
- if (evt.state === "complete" && this.active) {
173
- this.graphics = this._sketchGraphicsLayer.graphics.toArray();
172
+ if (evt.state === "start") {
173
+ this.graphics = evt.graphics;
174
174
  this.sketchGraphicsChange.emit(this.graphics);
175
175
  }
176
+ if (evt.state === "active") {
177
+ clearTimeout(this._selectionTimer);
178
+ this._selectionTimer = setTimeout(() => {
179
+ this.graphics = evt.graphics;
180
+ this.sketchGraphicsChange.emit(this.graphics);
181
+ }, 500);
182
+ }
183
+ });
184
+ this._sketchWidget.on("delete", () => {
185
+ this.graphics = [];
186
+ this.sketchGraphicsChange.emit(this.graphics);
187
+ });
188
+ this._sketchWidget.on("undo", (evt) => {
189
+ this.graphics = evt.graphics;
190
+ this.sketchGraphicsChange.emit(this.graphics);
191
+ });
192
+ this._sketchWidget.on("redo", (evt) => {
193
+ this.graphics = evt.graphics;
194
+ this.sketchGraphicsChange.emit(this.graphics);
176
195
  });
177
196
  }
178
197
  /**
@@ -47,6 +47,8 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
47
47
  * string: A label to help uniquely identify the selection set
48
48
  */
49
49
  this._selectionLabel = "";
50
+ this.bufferColor = [227, 139, 79, 0.8];
51
+ this.bufferOutlineColor = [255, 255, 255];
50
52
  this.enabledLayerIds = [];
51
53
  this.defaultBufferDistance = undefined;
52
54
  this.defaultBufferUnit = undefined;
@@ -112,6 +114,11 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
112
114
  * @returns Promise with the new selection set
113
115
  */
114
116
  async getSelection() {
117
+ // Allow any non whitespace
118
+ if (!/\S+/gm.test(this._selectionLabel)) {
119
+ this._selectionLabel = this._getSelectionBaseLabel();
120
+ }
121
+ const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
115
122
  return {
116
123
  id: this.isUpdate ? this.selectionSet.id : Date.now(),
117
124
  workflowType: this._workflowType,
@@ -120,7 +127,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
120
127
  distance: this._bufferTools.distance,
121
128
  download: true,
122
129
  unit: this._bufferTools.unit,
123
- label: this._workflowType === EWorkflowType.SEARCH ?
130
+ label: (this._selectionLabel && !isBaseLabel) ?
124
131
  this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
125
132
  selectedIds: this._selectedIds,
126
133
  layerView: this.selectLayerView,
@@ -128,12 +135,18 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
128
135
  refineSelectLayers: this._refineTools.layerViews
129
136
  };
130
137
  }
138
+ /**
139
+ * Handle changes to the selection sets
140
+ */
141
+ labelChange(event) {
142
+ this._selectionLabel = event.detail;
143
+ }
131
144
  /**
132
145
  * Listen to changes in the sketch graphics
133
146
  *
134
147
  */
135
148
  sketchGraphicsChange(event) {
136
- this._updateSelection(EWorkflowType.SKETCH, event.detail, this._translations.sketch);
149
+ this._updateSelection(EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch);
137
150
  }
138
151
  /**
139
152
  * Listen to changes in the refine graphics
@@ -141,7 +154,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
141
154
  */
142
155
  refineSelectionGraphicsChange(event) {
143
156
  const graphics = event.detail;
144
- this._updateSelection(EWorkflowType.SELECT, graphics, this._translations.select);
157
+ this._updateSelection(EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select);
145
158
  // Using OIDs to avoid issue with points
146
159
  const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
147
160
  return this._highlightFeatures(oids);
@@ -168,18 +181,15 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
168
181
  * Renders the component.
169
182
  */
170
183
  render() {
171
- var _a, _b;
184
+ var _a, _b, _c;
172
185
  const searchEnabled = this._workflowType === EWorkflowType.SEARCH;
173
186
  const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
174
187
  const drawEnabled = this._workflowType === EWorkflowType.SKETCH || this._workflowType === EWorkflowType.SELECT;
175
- //const showDrawToolsClass = drawEnabled ? " div-visible" : " div-not-visible";
176
- // const selectEnabled = this._workflowType === EWorkflowType.SELECT;
177
- // const showSelectToolsClass = selectEnabled ? " div-visible" : " div-not-visible";
178
188
  const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
179
189
  const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
180
190
  const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
181
191
  const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
182
- return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit) || this.defaultBufferUnit })), h("slot", null)));
192
+ return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { checked: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.workflowType) === EWorkflowType.SELECT, onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.unit) || this.defaultBufferUnit })), h("slot", null)));
183
193
  }
184
194
  //--------------------------------------------------------------------------
185
195
  //
@@ -233,15 +243,25 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
233
243
  ...(_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.geometries
234
244
  ];
235
245
  // reset selection label base
236
- this._selectionLabel = this._workflowType === EWorkflowType.SKETCH ?
237
- this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
238
- this._translations.select : (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.label;
246
+ this._selectionLabel = ((_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.label) || this._getSelectionBaseLabel();
239
247
  void goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
240
248
  }
241
249
  else {
242
250
  this._workflowType = EWorkflowType.SEARCH;
243
251
  }
244
252
  }
253
+ /**
254
+ * Get the default label base when the user has not provided a value
255
+ *
256
+ * @protected
257
+ */
258
+ _getSelectionBaseLabel() {
259
+ var _a, _b;
260
+ return this._workflowType === EWorkflowType.SKETCH ?
261
+ this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
262
+ this._translations.select : this._workflowType === EWorkflowType.SEARCH && this._searchResult ?
263
+ (_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
264
+ }
245
265
  /**
246
266
  * Initialize the search widget
247
267
  *
@@ -394,9 +414,9 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
394
414
  // Create a symbol for rendering the graphic
395
415
  const symbol = {
396
416
  type: "simple-fill",
397
- color: [227, 139, 79, 0.8],
417
+ color: this.bufferColor,
398
418
  outline: {
399
- color: [255, 255, 255],
419
+ color: this.bufferOutlineColor,
400
420
  width: 1
401
421
  }
402
422
  };
@@ -486,6 +506,8 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
486
506
  }; }
487
507
  static get style() { return mapSelectToolsCss; }
488
508
  }, [4, "map-select-tools", {
509
+ "bufferColor": [8, "buffer-color"],
510
+ "bufferOutlineColor": [8, "buffer-outline-color"],
489
511
  "enabledLayerIds": [16],
490
512
  "defaultBufferDistance": [2, "default-buffer-distance"],
491
513
  "defaultBufferUnit": [1, "default-buffer-unit"],
@@ -502,7 +524,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
502
524
  "_workflowType": [32],
503
525
  "clearSelection": [64],
504
526
  "getSelection": [64]
505
- }, [[8, "sketchGraphicsChange", "sketchGraphicsChange"], [8, "refineSelectionGraphicsChange", "refineSelectionGraphicsChange"]]]);
527
+ }, [[8, "labelChange", "labelChange"], [8, "sketchGraphicsChange", "sketchGraphicsChange"], [8, "refineSelectionGraphicsChange", "refineSelectionGraphicsChange"]]]);
506
528
  function defineCustomElement() {
507
529
  if (typeof customElements === "undefined") {
508
530
  return;
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
6
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { a as EPageType, b as ESketchType, c as EWorkflowType, d as EExportType } from './interfaces3.js';
8
8
  import { l as loadModules } from './loadModules.js';
9
9
  import { a as getMapLayerView, g as goToSelection, h as highlightFeatures, d as defineCustomElement$6 } from './map-layer-picker2.js';
@@ -53,7 +53,11 @@ const PublicNotification$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
53
53
  constructor() {
54
54
  super();
55
55
  this.__registerHost();
56
+ this.labelChange = createEvent(this, "labelChange", 7);
56
57
  this.addresseeLayerIds = [];
58
+ this.bufferColor = [227, 139, 79, 0.8];
59
+ this.bufferOutlineColor = [255, 255, 255];
60
+ this.customLabelEnabled = undefined;
57
61
  this.defaultBufferDistance = undefined;
58
62
  this.defaultBufferUnit = undefined;
59
63
  this.exportOptions = undefined;
@@ -114,16 +118,6 @@ const PublicNotification$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
114
118
  return this._highlightFeatures();
115
119
  }
116
120
  }
117
- //--------------------------------------------------------------------------
118
- //
119
- // Methods (public)
120
- //
121
- //--------------------------------------------------------------------------
122
- //--------------------------------------------------------------------------
123
- //
124
- // Events (public)
125
- //
126
- //--------------------------------------------------------------------------
127
121
  /**
128
122
  * Handle changes to the selection sets
129
123
  */
@@ -311,21 +305,19 @@ const PublicNotification$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
311
305
  * @protected
312
306
  */
313
307
  _getSelectPage() {
314
- var _a, _b;
315
- // const searchTip = `${this._translations.selectSearchTip} ${this._translations.optionalSearchDistance}`;
308
+ var _a, _b, _c;
316
309
  const searchTip = this._translations.selectSearchTip;
317
- // const selectTip = `${this._translations.selectLayerTip} ${this._translations.optionalSearchDistance}`;
318
310
  const selectTip = this._translations.selectLayerTip;
319
- // const sketchTip = this._sketchType === ESketchType.INTERACTIVE ?
320
- // `${this._translations.selectSketchTip} ${this._translations.optionalSearchDistance}` :
321
- // `${this._translations.selectLayerTip} ${this._translations.optionalSearchDistance}`;
322
311
  const sketchTip = this._sketchType === ESketchType.INTERACTIVE ?
323
312
  this._translations.selectSketchTip :
324
313
  this._translations.selectLayerTip;
325
314
  const noticeText = this._selectionWorkflowType === EWorkflowType.SELECT ? selectTip :
326
315
  this._selectionWorkflowType === EWorkflowType.SKETCH ? sketchTip : searchTip;
327
- return (h("calcite-panel", null, this._getLabel(this._translations.stepTwoFull.replace("{{layer}}", (_a = this.addresseeLayer) === null || _a === void 0 ? void 0 : _a.layer.title)), this._getNotice(noticeText), h("div", { class: "padding-1" }, h("map-select-tools", { class: "font-bold", enabledLayerIds: this.selectionLayerIds, isUpdate: !!this._activeSelection, mapView: this.mapView, onSelectionSetChange: (evt) => this._updateForSelection(evt), onWorkflowTypeChange: (evt) => this._updateForWorkflowType(evt), ref: (el) => { this._selectTools = el; }, searchConfiguration: this.searchConfiguration, selectLayerView: this.addresseeLayer, selectionSet: this._activeSelection, showBufferTools: this.showSearchSettings })), h("div", { class: "padding-sides-1 padding-bottom-1", style: { "align-items": "end", "display": "flex" } }, h("calcite-icon", { class: "info-blue padding-end-1-2", icon: "feature-layer", scale: "s" }), h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this.noResultText && this._numSelected === 0 ? this.noResultText :
328
- this._translations.selectedAddresses.replace("{{n}}", this._numSelected.toString()).replace("{{layer}}", ((_b = this.addresseeLayer) === null || _b === void 0 ? void 0 : _b.layer.title) || ""))), this._getPageNavButtons(this._translations.done, this._numSelected === 0, () => { void this._saveSelection(); }, this._translations.cancel, false, () => { void this._home(); })));
316
+ const nameLabelClass = this.customLabelEnabled ? "" : "display-none";
317
+ return (h("calcite-panel", null, this._getLabel(this._translations.stepTwoFull.replace("{{layer}}", (_a = this.addresseeLayer) === null || _a === void 0 ? void 0 : _a.layer.title)), this._getNotice(noticeText), h("div", { class: "padding-top-sides-1" }, h("map-select-tools", { bufferColor: this.bufferColor, bufferOutlineColor: this.bufferOutlineColor, class: "font-bold", defaultBufferDistance: this.defaultBufferDistance, defaultBufferUnit: this.defaultBufferUnit, enabledLayerIds: this.selectionLayerIds, isUpdate: !!this._activeSelection, mapView: this.mapView, onSelectionSetChange: (evt) => this._updateForSelection(evt), onWorkflowTypeChange: (evt) => this._updateForWorkflowType(evt), ref: (el) => { this._selectTools = el; }, searchConfiguration: this.searchConfiguration, selectLayerView: this.addresseeLayer, selectionSet: this._activeSelection, showBufferTools: this.showSearchSettings })), h("div", { class: "padding-sides-1 padding-bottom-1", style: { "align-items": "end", "display": "flex" } }, h("calcite-icon", { class: "info-blue padding-end-1-2", icon: "feature-layer", scale: "s" }), h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this.noResultText && this._numSelected === 0 ? this.noResultText :
318
+ this._translations.selectedAddresses.replace("{{n}}", this._numSelected.toString()).replace("{{layer}}", ((_b = this.addresseeLayer) === null || _b === void 0 ? void 0 : _b.layer.title) || ""))), h("div", { class: "padding-sides-1 " + nameLabelClass }, h("calcite-label", { class: "font-bold" }, "Name label", h("calcite-input", { onInput: () => {
319
+ this.labelChange.emit(this._labelName.value);
320
+ }, placeholder: "Insert label here...", ref: (el) => { this._labelName = el; }, value: ((_c = this._activeSelection) === null || _c === void 0 ? void 0 : _c.label) || "" }))), this._getPageNavButtons(this._translations.done, this._numSelected === 0, () => { void this._saveSelection(); }, this._translations.cancel, false, () => { void this._home(); })));
329
321
  }
330
322
  /**
331
323
  * Create the Refine page that users can interactively add/remove features from existing selection sets
@@ -413,7 +405,7 @@ const PublicNotification$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
413
405
  * Get selection set list node with checkbox for Download pages
414
406
  *
415
407
  * @returns the list node
416
- * @protected
408
+ * @protectedlabel
417
409
  */
418
410
  _getSelectionLists() {
419
411
  return this._selectionSets.reduce((prev, cur) => {
@@ -701,6 +693,9 @@ const PublicNotification$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
701
693
  static get style() { return publicNotificationCss; }
702
694
  }, [0, "public-notification", {
703
695
  "addresseeLayerIds": [16],
696
+ "bufferColor": [8, "buffer-color"],
697
+ "bufferOutlineColor": [8, "buffer-outline-color"],
698
+ "customLabelEnabled": [4, "custom-label-enabled"],
704
699
  "defaultBufferDistance": [2, "default-buffer-distance"],
705
700
  "defaultBufferUnit": [1, "default-buffer-unit"],
706
701
  "exportOptions": [16],
@@ -1451,10 +1451,29 @@ const MapDrawTools = class {
1451
1451
  }
1452
1452
  };
1453
1453
  this._sketchWidget.on("update", (evt) => {
1454
- if (evt.state === "complete" && this.active) {
1455
- this.graphics = this._sketchGraphicsLayer.graphics.toArray();
1454
+ if (evt.state === "start") {
1455
+ this.graphics = evt.graphics;
1456
1456
  this.sketchGraphicsChange.emit(this.graphics);
1457
1457
  }
1458
+ if (evt.state === "active") {
1459
+ clearTimeout(this._selectionTimer);
1460
+ this._selectionTimer = setTimeout(() => {
1461
+ this.graphics = evt.graphics;
1462
+ this.sketchGraphicsChange.emit(this.graphics);
1463
+ }, 500);
1464
+ }
1465
+ });
1466
+ this._sketchWidget.on("delete", () => {
1467
+ this.graphics = [];
1468
+ this.sketchGraphicsChange.emit(this.graphics);
1469
+ });
1470
+ this._sketchWidget.on("undo", (evt) => {
1471
+ this.graphics = evt.graphics;
1472
+ this.sketchGraphicsChange.emit(this.graphics);
1473
+ });
1474
+ this._sketchWidget.on("redo", (evt) => {
1475
+ this.graphics = evt.graphics;
1476
+ this.sketchGraphicsChange.emit(this.graphics);
1458
1477
  });
1459
1478
  }
1460
1479
  /**
@@ -248,6 +248,8 @@ const MapSelectTools = class {
248
248
  * string: A label to help uniquely identify the selection set
249
249
  */
250
250
  this._selectionLabel = "";
251
+ this.bufferColor = [227, 139, 79, 0.8];
252
+ this.bufferOutlineColor = [255, 255, 255];
251
253
  this.enabledLayerIds = [];
252
254
  this.defaultBufferDistance = undefined;
253
255
  this.defaultBufferUnit = undefined;
@@ -313,6 +315,11 @@ const MapSelectTools = class {
313
315
  * @returns Promise with the new selection set
314
316
  */
315
317
  async getSelection() {
318
+ // Allow any non whitespace
319
+ if (!/\S+/gm.test(this._selectionLabel)) {
320
+ this._selectionLabel = this._getSelectionBaseLabel();
321
+ }
322
+ const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
316
323
  return {
317
324
  id: this.isUpdate ? this.selectionSet.id : Date.now(),
318
325
  workflowType: this._workflowType,
@@ -321,7 +328,7 @@ const MapSelectTools = class {
321
328
  distance: this._bufferTools.distance,
322
329
  download: true,
323
330
  unit: this._bufferTools.unit,
324
- label: this._workflowType === EWorkflowType.SEARCH ?
331
+ label: (this._selectionLabel && !isBaseLabel) ?
325
332
  this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
326
333
  selectedIds: this._selectedIds,
327
334
  layerView: this.selectLayerView,
@@ -329,12 +336,18 @@ const MapSelectTools = class {
329
336
  refineSelectLayers: this._refineTools.layerViews
330
337
  };
331
338
  }
339
+ /**
340
+ * Handle changes to the selection sets
341
+ */
342
+ labelChange(event) {
343
+ this._selectionLabel = event.detail;
344
+ }
332
345
  /**
333
346
  * Listen to changes in the sketch graphics
334
347
  *
335
348
  */
336
349
  sketchGraphicsChange(event) {
337
- this._updateSelection(EWorkflowType.SKETCH, event.detail, this._translations.sketch);
350
+ this._updateSelection(EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch);
338
351
  }
339
352
  /**
340
353
  * Listen to changes in the refine graphics
@@ -342,7 +355,7 @@ const MapSelectTools = class {
342
355
  */
343
356
  refineSelectionGraphicsChange(event) {
344
357
  const graphics = event.detail;
345
- this._updateSelection(EWorkflowType.SELECT, graphics, this._translations.select);
358
+ this._updateSelection(EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select);
346
359
  // Using OIDs to avoid issue with points
347
360
  const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
348
361
  return this._highlightFeatures(oids);
@@ -369,18 +382,15 @@ const MapSelectTools = class {
369
382
  * Renders the component.
370
383
  */
371
384
  render() {
372
- var _a, _b;
385
+ var _a, _b, _c;
373
386
  const searchEnabled = this._workflowType === EWorkflowType.SEARCH;
374
387
  const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
375
388
  const drawEnabled = this._workflowType === EWorkflowType.SKETCH || this._workflowType === EWorkflowType.SELECT;
376
- //const showDrawToolsClass = drawEnabled ? " div-visible" : " div-not-visible";
377
- // const selectEnabled = this._workflowType === EWorkflowType.SELECT;
378
- // const showSelectToolsClass = selectEnabled ? " div-visible" : " div-not-visible";
379
389
  const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
380
390
  const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
381
391
  const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
382
392
  const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
383
- return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit) || this.defaultBufferUnit })), h("slot", null)));
393
+ return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { checked: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.workflowType) === EWorkflowType.SELECT, onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.unit) || this.defaultBufferUnit })), h("slot", null)));
384
394
  }
385
395
  //--------------------------------------------------------------------------
386
396
  //
@@ -434,15 +444,25 @@ const MapSelectTools = class {
434
444
  ...(_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.geometries
435
445
  ];
436
446
  // reset selection label base
437
- this._selectionLabel = this._workflowType === EWorkflowType.SKETCH ?
438
- this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
439
- this._translations.select : (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.label;
447
+ this._selectionLabel = ((_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.label) || this._getSelectionBaseLabel();
440
448
  void goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
441
449
  }
442
450
  else {
443
451
  this._workflowType = EWorkflowType.SEARCH;
444
452
  }
445
453
  }
454
+ /**
455
+ * Get the default label base when the user has not provided a value
456
+ *
457
+ * @protected
458
+ */
459
+ _getSelectionBaseLabel() {
460
+ var _a, _b;
461
+ return this._workflowType === EWorkflowType.SKETCH ?
462
+ this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
463
+ this._translations.select : this._workflowType === EWorkflowType.SEARCH && this._searchResult ?
464
+ (_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
465
+ }
446
466
  /**
447
467
  * Initialize the search widget
448
468
  *
@@ -595,9 +615,9 @@ const MapSelectTools = class {
595
615
  // Create a symbol for rendering the graphic
596
616
  const symbol = {
597
617
  type: "simple-fill",
598
- color: [227, 139, 79, 0.8],
618
+ color: this.bufferColor,
599
619
  outline: {
600
- color: [255, 255, 255],
620
+ color: this.bufferOutlineColor,
601
621
  width: 1
602
622
  }
603
623
  };