@esri/solutions-components 0.7.21 → 0.7.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/assets/t9n/public-notification/resources.json +2 -3
  2. package/dist/assets/t9n/public-notification/resources_en.json +2 -3
  3. package/dist/cjs/basemap-gallery_7.cjs.entry.js +11 -12
  4. package/dist/cjs/calcite-alert_3.cjs.entry.js +23 -13
  5. package/dist/cjs/card-manager_3.cjs.entry.js +124 -91
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  8. package/dist/cjs/solutions-components.cjs.js +1 -1
  9. package/dist/collection/components/edit-card/edit-card.js +23 -13
  10. package/dist/collection/components/floor-filter/floor-filter.js +28 -12
  11. package/dist/collection/components/layer-table/layer-table.js +130 -91
  12. package/dist/collection/components/public-notification/public-notification.js +1 -1
  13. package/dist/collection/demos/crowdsource-manager.html +13 -0
  14. package/dist/components/edit-card2.js +23 -13
  15. package/dist/components/floor-filter2.js +12 -13
  16. package/dist/components/layer-table2.js +125 -92
  17. package/dist/components/public-notification.js +1 -1
  18. package/dist/esm/basemap-gallery_7.entry.js +11 -12
  19. package/dist/esm/calcite-alert_3.entry.js +23 -13
  20. package/dist/esm/card-manager_3.entry.js +124 -91
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/public-notification.entry.js +1 -1
  23. package/dist/esm/solutions-components.js +1 -1
  24. package/dist/solutions-components/demos/crowdsource-manager.html +13 -0
  25. package/dist/solutions-components/p-04f05bc5.entry.js +6 -0
  26. package/dist/solutions-components/{p-d3085b7a.entry.js → p-bacc9b0d.entry.js} +1 -1
  27. package/dist/solutions-components/{p-a40a1eab.entry.js → p-c634d047.entry.js} +1 -1
  28. package/dist/solutions-components/p-eff7f407.entry.js +6 -0
  29. package/dist/solutions-components/solutions-components.esm.js +1 -1
  30. package/dist/types/components/edit-card/edit-card.d.ts +2 -1
  31. package/dist/types/components/floor-filter/floor-filter.d.ts +13 -0
  32. package/dist/types/components/layer-table/layer-table.d.ts +19 -3
  33. package/dist/types/components.d.ts +19 -0
  34. package/dist/types/preact.d.ts +3 -1
  35. package/package.json +2 -2
  36. package/dist/solutions-components/p-5302f406.entry.js +0 -6
  37. package/dist/solutions-components/p-704da348.entry.js +0 -6
@@ -29,10 +29,9 @@
29
29
  "export": "Export",
30
30
  "exportTip": "Select lists to include in the exported file. Export lists as CSV and PDF.",
31
31
  "title": "Title",
32
- "addTitle": "Include title",
33
- "addResults": "Include results",
32
+ "addResults": "Results",
34
33
  "titlePlaceholder": "Enter title here",
35
- "includeMap": "Include map",
34
+ "includeMap": "Map",
36
35
  "pdfOptions": "PDF Options",
37
36
  "csvOptions": "CSV Options",
38
37
  "refineSelection": "Refine selection",
@@ -29,10 +29,9 @@
29
29
  "export": "Export",
30
30
  "exportTip": "Select lists to include in the exported file. Export lists as CSV and PDF.",
31
31
  "title": "Title",
32
- "addTitle": "Include title",
33
- "addResults": "Include results",
32
+ "addResults": "Results",
34
33
  "titlePlaceholder": "Enter title here",
35
- "includeMap": "Include map",
34
+ "includeMap": "Map",
36
35
  "pdfOptions": "PDF Options",
37
36
  "csvOptions": "CSV Options",
38
37
  "refineSelection": "Refine selection",
@@ -124,6 +124,7 @@ const floorFilterCss = ":host{display:block}";
124
124
  const FloorFilter = class {
125
125
  constructor(hostRef) {
126
126
  index.registerInstance(this, hostRef);
127
+ this.levelChanged = index.createEvent(this, "levelChanged", 7);
127
128
  this.enabled = undefined;
128
129
  this.floorFilterWidget = undefined;
129
130
  this.mapView = undefined;
@@ -140,16 +141,6 @@ const FloorFilter = class {
140
141
  }
141
142
  //--------------------------------------------------------------------------
142
143
  //
143
- // Methods (public)
144
- //
145
- //--------------------------------------------------------------------------
146
- //--------------------------------------------------------------------------
147
- //
148
- // Events (public)
149
- //
150
- //--------------------------------------------------------------------------
151
- //--------------------------------------------------------------------------
152
- //
153
144
  // Functions (lifecycle)
154
145
  //
155
146
  //--------------------------------------------------------------------------
@@ -175,10 +166,12 @@ const FloorFilter = class {
175
166
  * @protected
176
167
  */
177
168
  async _initModules() {
178
- const [FloorFilter] = await loadModules.loadModules([
179
- "esri/widgets/FloorFilter"
169
+ const [FloorFilter, reactiveUtils] = await loadModules.loadModules([
170
+ "esri/widgets/FloorFilter",
171
+ "esri/core/reactiveUtils"
180
172
  ]);
181
173
  this.FloorFilter = FloorFilter;
174
+ this.reactiveUtils = reactiveUtils;
182
175
  }
183
176
  /**
184
177
  * Initialize the floor filter or reset the current view if it already exists
@@ -191,6 +184,12 @@ const FloorFilter = class {
191
184
  container: this._floorFilterElement,
192
185
  view
193
186
  });
187
+ if (this._levelHandle) {
188
+ this._levelHandle.remove();
189
+ }
190
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
191
+ this.levelChanged.emit(level);
192
+ });
194
193
  }
195
194
  else {
196
195
  this.floorFilterWidget.view = view;
@@ -321,6 +321,7 @@ const EditCard = class {
321
321
  this.refreshGraphics = index.createEvent(this, "refreshGraphics", 7);
322
322
  /**
323
323
  * boolean: When true the Editor widget should be closed
324
+ * Without this logic we are taken to the Editors "Select" workflow step
324
325
  */
325
326
  this._shouldClose = false;
326
327
  this.graphics = undefined;
@@ -339,8 +340,8 @@ const EditCard = class {
339
340
  * Watch for changes to the graphics and update the feature widget
340
341
  */
341
342
  async graphicsWatchHandler() {
342
- if (this.graphics.length === 0) {
343
- await this._closeEdit();
343
+ if (this.graphics.length === 0 && this.open) {
344
+ await this._closeEdit(true);
344
345
  }
345
346
  }
346
347
  async openWatchHandler(v) {
@@ -354,11 +355,13 @@ const EditCard = class {
354
355
  this._editorLoading = false;
355
356
  }
356
357
  if (!v) {
357
- await this._closeEdit();
358
+ await this._closeEdit(true);
358
359
  }
359
360
  }
360
361
  async featureSelectionChange() {
361
- await this._closeEdit();
362
+ if (this.open) {
363
+ await this._closeEdit(false);
364
+ }
362
365
  }
363
366
  //--------------------------------------------------------------------------
364
367
  //
@@ -389,7 +392,6 @@ const EditCard = class {
389
392
  }
390
393
  this._layerEditHandle = this._layer.on("edits", () => {
391
394
  this.editsComplete.emit();
392
- this.open = false;
393
395
  });
394
396
  }
395
397
  }
@@ -404,7 +406,7 @@ const EditCard = class {
404
406
  !this.graphics[0].layer.editingEnabled : true;
405
407
  const tableNodeClass = this._editorLoading ? "display-none" : "position-absolute";
406
408
  const loadingClass = this._editorLoading ? "" : "display-none";
407
- return (index.h(index.Host, null, index.h("div", { class: "position-absolute" }, editDisabled ? (index.h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, index.h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, index.h("div", { class: "position-absolute", slot: "content" }, index.h("div", { class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), index.h("calcite-loader", { class: loadingClass, label: "", scale: "s" })))));
409
+ return (index.h(index.Host, null, index.h("div", { class: "position-absolute" }, editDisabled ? (index.h("calcite-notice", { kind: "warning", open: true, slot: "content-top", width: "full" }, index.h("div", { slot: "message" }, this._translations.enableEditing))) : undefined, index.h("div", { class: "position-absolute" }, index.h("div", { class: tableNodeClass, id: "feature-form", ref: (el) => this._editContainer = el }), index.h("calcite-loader", { class: loadingClass, label: "", scale: "s" })))));
408
410
  }
409
411
  //--------------------------------------------------------------------------
410
412
  //
@@ -459,10 +461,13 @@ const EditCard = class {
459
461
  this._shouldClose = false;
460
462
  });
461
463
  this._activeWorkflowHandle = this.reactiveUtils.watch(() => { var _a; return (_a = this._editor.viewModel.activeWorkflow) === null || _a === void 0 ? void 0 : _a.activeWorkflow; }, (activeWorkflow) => {
464
+ var _a, _b;
462
465
  if ((activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.type) === "update-table-record" || (activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.type) === "create-features") {
463
466
  this._shouldClose = false;
464
467
  }
465
- if (!(activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.type) && !(activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.hasPendingEdits)) {
468
+ // Handle back click and when feature is de-selected from the table
469
+ // this ensures that we are not shown the Editors "Select" workflow step
470
+ if ((!(activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.type) && !(activeWorkflow === null || activeWorkflow === void 0 ? void 0 : activeWorkflow.hasPendingEdits) && !this._editor.activeWorkflow) || !((_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a.activeWorkflow) === null || _b === void 0 ? void 0 : _b.started)) {
466
471
  this.open = false;
467
472
  }
468
473
  });
@@ -473,16 +478,21 @@ const EditCard = class {
473
478
  /**
474
479
  * Close the edit widget
475
480
  */
476
- async _closeEdit() {
481
+ async _closeEdit(destroyOnClose) {
477
482
  var _a, _b, _c, _d;
478
483
  this._shouldClose = true;
479
- if ((_a = this._editor) === null || _a === void 0 ? void 0 : _a.activeWorkflow) {
480
- await ((_b = this._editor) === null || _b === void 0 ? void 0 : _b.cancelWorkflow());
484
+ if (destroyOnClose && ((_a = this._editor) === null || _a === void 0 ? void 0 : _a.activeWorkflow)) {
485
+ if ((_c = (_b = this._editor.activeWorkflow) === null || _b === void 0 ? void 0 : _b.activeWorkflow) === null || _c === void 0 ? void 0 : _c.hasPendingEdits) {
486
+ await this._editor.activeWorkflow.reset();
487
+ await this._editor.cancelWorkflow();
488
+ }
489
+ this._editor.destroy();
481
490
  }
482
- if (this.graphicIndex > -1 && ((_c = this.graphics) === null || _c === void 0 ? void 0 : _c.length) > 0) {
483
- this.refreshGraphics.emit(this.graphics);
491
+ else {
492
+ if (this.graphicIndex > -1 && ((_d = this.graphics) === null || _d === void 0 ? void 0 : _d.length) > 0) {
493
+ this.refreshGraphics.emit(this.graphics);
494
+ }
484
495
  }
485
- (_d = this._editor) === null || _d === void 0 ? void 0 : _d.destroy();
486
496
  this._shouldClose = false;
487
497
  this.closeEdit.emit();
488
498
  }
@@ -263,8 +263,11 @@ const LayerTable = class {
263
263
  * watch for changes in layer view and verify if it has editing enabled
264
264
  */
265
265
  async _layerWatchHandler() {
266
+ var _a, _b;
266
267
  this._fetchingData = true;
267
268
  this._definitionExpression = this._layer.definitionExpression;
269
+ this._floorField = (_b = (_a = this._layer) === null || _a === void 0 ? void 0 : _a.floorInfo) === null || _b === void 0 ? void 0 : _b.floorField;
270
+ this._updateFloorDefinitionExpression();
268
271
  await this._resetTable();
269
272
  this._updateShareUrl();
270
273
  this._initLayerExpressions();
@@ -328,14 +331,19 @@ const LayerTable = class {
328
331
  }
329
332
  /**
330
333
  * Refresh the table when edits are completed
331
- *
332
334
  */
333
335
  async editsComplete() {
334
336
  await this._refresh();
335
337
  }
336
338
  /**
337
- * Refresh the table when edits are completed
338
- *
339
+ * Refresh the table when floor filter level is changed
340
+ */
341
+ async levelChanged(evt) {
342
+ this._floorLevel = evt.detail;
343
+ this._updateFloorDefinitionExpression();
344
+ }
345
+ /**
346
+ * Refresh the table when
339
347
  */
340
348
  noLayersFound() {
341
349
  this._layer = undefined;
@@ -530,93 +538,105 @@ const LayerTable = class {
530
538
  const featuresSelected = this._featuresSelected();
531
539
  const featuresEmpty = this._featuresEmpty();
532
540
  const hasFilterExpressions = this._hasFilterExpressions();
533
- this._toolInfos = [{
534
- active: false,
535
- icon: "zoom-to-object",
536
- indicator: false,
537
- label: this._translations.zoom,
538
- func: () => this._zoom(),
539
- disabled: !featuresSelected,
540
- isOverflow: false
541
- },
542
- hasFilterExpressions ? {
543
- active: false,
544
- icon: "filter",
545
- indicator: false,
546
- label: this._translations.filters,
547
- func: () => this._toggleFilter(),
548
- disabled: false,
549
- isOverflow: false
550
- } : undefined,
551
- this._deleteEnabled ? {
552
- active: false,
553
- icon: "trash",
554
- indicator: false,
555
- label: this._translations.delete,
556
- func: () => this._delete(),
557
- disabled: !featuresSelected,
558
- isDanger: true,
559
- isOverflow: false
560
- } : undefined, {
561
- active: false,
562
- icon: "erase",
563
- indicator: false,
564
- label: this._translations.clearSelection,
565
- func: () => this._clearSelection(),
566
- disabled: !featuresSelected,
567
- isOverflow: false
568
- }, {
569
- active: false,
570
- icon: "selected-items-filter",
571
- indicator: false,
572
- label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
573
- func: () => this._toggleShowSelected(),
574
- disabled: !featuresSelected,
575
- isOverflow: false
576
- }, {
577
- active: false,
578
- icon: "list-check-all",
579
- indicator: false,
580
- func: () => this._selectAll(),
581
- label: this._translations.selectAll,
582
- disabled: featuresEmpty,
583
- isOverflow: false
584
- }, {
585
- active: false,
586
- icon: "compare",
587
- indicator: false,
588
- func: () => this._switchSelected(),
589
- label: this._translations.switchSelected,
590
- disabled: featuresEmpty,
591
- isOverflow: false
592
- }, {
593
- active: false,
594
- icon: "refresh",
595
- indicator: false,
596
- func: () => this._refresh(),
597
- label: this._translations.refresh,
598
- disabled: false,
599
- isOverflow: false
600
- },
601
- this.enableCSV ? {
602
- active: false,
603
- icon: "export",
604
- indicator: false,
605
- func: () => void this._exportToCSV(),
606
- label: this._translations.exportCSV,
607
- disabled: featuresEmpty,
608
- isOverflow: false
609
- } : undefined, {
610
- active: false,
611
- icon: this._showHideOpen ? "chevron-down" : "chevron-right",
612
- indicator: false,
613
- func: () => this._toggleShowHide(),
614
- label: this._translations.showHideColumns,
615
- disabled: false,
616
- isOverflow: false,
617
- isSublist: true
618
- }];
619
- this._defaultVisibleToolSizeInfos = undefined;
541
+ if (this._translations) {
542
+ this._toolInfos = [{
543
+ active: false,
544
+ icon: "zoom-to-object",
545
+ indicator: false,
546
+ label: this._translations.zoom,
547
+ func: () => this._zoom(),
548
+ disabled: !featuresSelected,
549
+ isOverflow: false
550
+ },
551
+ hasFilterExpressions ? {
552
+ active: false,
553
+ icon: "filter",
554
+ indicator: false,
555
+ label: this._translations.filters,
556
+ func: () => this._toggleFilter(),
557
+ disabled: false,
558
+ isOverflow: false
559
+ } : undefined,
560
+ this._deleteEnabled ? {
561
+ active: false,
562
+ icon: "trash",
563
+ indicator: false,
564
+ label: this._translations.delete,
565
+ func: () => this._delete(),
566
+ disabled: !featuresSelected,
567
+ isDanger: true,
568
+ isOverflow: false
569
+ } : undefined, {
570
+ active: false,
571
+ icon: "erase",
572
+ indicator: false,
573
+ label: this._translations.clearSelection,
574
+ func: () => this._clearSelection(),
575
+ disabled: !featuresSelected,
576
+ isOverflow: false
577
+ }, {
578
+ active: false,
579
+ icon: "selected-items-filter",
580
+ indicator: false,
581
+ label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
582
+ func: () => this._toggleShowSelected(),
583
+ disabled: !featuresSelected,
584
+ isOverflow: false
585
+ }, {
586
+ active: false,
587
+ icon: "list-check-all",
588
+ indicator: false,
589
+ func: () => this._selectAll(),
590
+ label: this._translations.selectAll,
591
+ disabled: featuresEmpty,
592
+ isOverflow: false
593
+ }, {
594
+ active: false,
595
+ icon: "compare",
596
+ indicator: false,
597
+ func: () => this._switchSelected(),
598
+ label: this._translations.switchSelected,
599
+ disabled: featuresEmpty,
600
+ isOverflow: false
601
+ }, {
602
+ active: false,
603
+ icon: "refresh",
604
+ indicator: false,
605
+ func: () => this._refresh(),
606
+ label: this._translations.refresh,
607
+ disabled: false,
608
+ isOverflow: false
609
+ },
610
+ this.enableCSV ? {
611
+ active: false,
612
+ icon: "export",
613
+ indicator: false,
614
+ func: () => void this._exportToCSV(),
615
+ label: this._translations.exportCSV,
616
+ disabled: featuresEmpty,
617
+ isOverflow: false
618
+ } : undefined, {
619
+ active: false,
620
+ icon: this._showHideOpen ? "chevron-down" : "chevron-right",
621
+ indicator: false,
622
+ func: () => this._toggleShowHide(),
623
+ label: this._translations.showHideColumns,
624
+ disabled: false,
625
+ isOverflow: false,
626
+ isSublist: true
627
+ }];
628
+ this._defaultVisibleToolSizeInfos = undefined;
629
+ }
630
+ }
631
+ /**
632
+ * Applies a definition expression when floor field and level are available
633
+ *
634
+ * @returns boolean
635
+ */
636
+ _updateFloorDefinitionExpression() {
637
+ if (this._floorField && this._floorLevel) {
638
+ this._layer.definitionExpression = `${this._floorField} = '${this._floorLevel}'`;
639
+ }
620
640
  }
621
641
  /**
622
642
  * Returns true when one ore more features are selected
@@ -827,12 +847,21 @@ const LayerTable = class {
827
847
  if ((_b = this.mapInfo) === null || _b === void 0 ? void 0 : _b.id) {
828
848
  urlObj.searchParams.set("webmap", this.mapInfo.id);
829
849
  }
850
+ else {
851
+ urlObj.searchParams.delete("webmap");
852
+ }
830
853
  if ((_c = this._layer) === null || _c === void 0 ? void 0 : _c.id) {
831
854
  urlObj.searchParams.set("layer", this._layer.id);
832
855
  }
856
+ else {
857
+ urlObj.searchParams.delete("layer");
858
+ }
833
859
  if (((_d = this._selectedIndexes) === null || _d === void 0 ? void 0 : _d.length) > 0) {
834
860
  urlObj.searchParams.set("oid", this._selectedIndexes.join(","));
835
861
  }
862
+ else {
863
+ urlObj.searchParams.delete("oid");
864
+ }
836
865
  if (this._filterActive) {
837
866
  const filter = JSON.parse(this._filterList.urlParams.get("filter"));
838
867
  const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
@@ -846,7 +875,11 @@ const LayerTable = class {
846
875
  });
847
876
  urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
848
877
  }
878
+ else {
879
+ urlObj.searchParams.delete("filter");
880
+ }
849
881
  this._shareNode.shareUrl = urlObj.href;
882
+ history.pushState(history.state, document.title, urlObj.href);
850
883
  }
851
884
  /**
852
885
  * Get a tooltip
@@ -1166,7 +1199,7 @@ const LayerTable = class {
1166
1199
  */
1167
1200
  _filterModal() {
1168
1201
  var _a, _b, _c;
1169
- return (index.h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, index.h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), index.h("div", { slot: "content" }, index.h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1202
+ return (index.h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, index.h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), index.h("div", { slot: "content" }, index.h("instant-apps-filter-list", { autoUpdateUrl: true, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1170
1203
  }
1171
1204
  /**
1172
1205
  * Reset the filter active prop