@esri/solutions-components 0.7.30 → 0.7.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +7 -5
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +7 -5
  3. package/dist/assets/t9n/feature-list/resources.json +1 -1
  4. package/dist/assets/t9n/feature-list/resources_en.json +1 -1
  5. package/dist/assets/t9n/layer-list/resources.json +1 -1
  6. package/dist/assets/t9n/layer-list/resources_en.json +1 -1
  7. package/dist/cjs/{calcite-flow_4.cjs.entry.js → calcite-flow_5.cjs.entry.js} +235 -19
  8. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +221 -32
  10. package/dist/cjs/{downloadUtils-83c6d3c3.js → downloadUtils-10e0de31.js} +2 -2
  11. package/dist/cjs/{index.es-bd1a93b2.js → index.es-72dc7ab9.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  14. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/create-feature/create-feature.css +23 -0
  18. package/dist/collection/components/create-feature/create-feature.js +361 -0
  19. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
  20. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +260 -33
  21. package/dist/collection/components/feature-list/feature-list.js +1 -0
  22. package/dist/collection/components/layer-list/layer-list.js +60 -16
  23. package/dist/collection/demos/crowdsource-reporter.html +26 -11
  24. package/dist/collection/utils/downloadUtils.js +1 -1
  25. package/dist/collection/utils/downloadUtils.ts +1 -1
  26. package/dist/components/create-feature.d.ts +11 -0
  27. package/dist/components/create-feature.js +11 -0
  28. package/dist/components/create-feature2.js +226 -0
  29. package/dist/components/crowdsource-reporter.js +297 -90
  30. package/dist/components/downloadUtils.js +1 -1
  31. package/dist/components/feature-list2.js +1 -0
  32. package/dist/components/layer-list2.js +38 -17
  33. package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +235 -20
  34. package/dist/esm/card-manager_3.entry.js +1 -1
  35. package/dist/esm/crowdsource-reporter.entry.js +222 -33
  36. package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
  37. package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/map-select-tools_3.entry.js +1 -1
  40. package/dist/esm/public-notification.entry.js +1 -1
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
  43. package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
  44. package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
  45. package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
  46. package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
  47. package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
  48. package/dist/solutions-components/p-b4e2cac4.entry.js +17 -0
  49. package/dist/solutions-components/p-bb6562ab.entry.js +6 -0
  50. package/dist/solutions-components/solutions-components.esm.js +1 -1
  51. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  52. package/dist/types/components/create-feature/create-feature.d.ts +107 -0
  53. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +132 -12
  54. package/dist/types/components/feature-list/feature-list.d.ts +1 -0
  55. package/dist/types/components/layer-list/layer-list.d.ts +6 -0
  56. package/dist/types/components.d.ts +89 -0
  57. package/dist/types/preact.d.ts +6 -0
  58. package/package.json +1 -1
  59. package/dist/solutions-components/p-2f162664.entry.js +0 -6
  60. package/dist/solutions-components/p-94ee3ef7.entry.js +0 -17
@@ -6,15 +6,17 @@
6
6
  "expand": "Expand",
7
7
  "collapse": "Collapse",
8
8
  "next": "Next",
9
+ "submit": "Submit",
9
10
  "cancel": "Cancel",
10
11
  "back": "Back",
11
12
  "error": "Error",
12
13
  "invalidConfigurationErrorMsg": "Invalid configuration",
13
- "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer",
14
- "chooseCategoryMsg": "Choose a category for the problem you're reporting",
15
- "featureErrorMsg": "Features not found",
16
- "featureEditFormInfoMsg": "Please provide the details for the incident you are reporting.",
14
+ "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer.",
15
+ "chooseCategoryMsg": "Choose a category for your report.",
16
+ "featureErrorMsg": "Features not found.",
17
+ "featureEditFormInfoMsg": "Please provide the details for your report.",
17
18
  "currentLocationMsg": "Use my current location",
19
+ "addLocationMsg": "Add the location for your report.",
18
20
  "reportSubmit": "Report Submitted.",
19
- "submitMsg": "Thank you! Your report was successfully submitted"
21
+ "submitMsg": "Thank you! Your report was successfully submitted."
20
22
  }
@@ -6,15 +6,17 @@
6
6
  "expand": "Expand",
7
7
  "collapse": "Collapse",
8
8
  "next": "Next",
9
+ "submit": "Submit",
9
10
  "cancel": "Cancel",
10
11
  "back": "Back",
11
12
  "error": "Error",
12
13
  "invalidConfigurationErrorMsg": "Invalid configuration",
13
- "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer",
14
- "chooseCategoryMsg": "Choose a category for the problem you're reporting",
15
- "featureErrorMsg": "Features not found",
16
- "featureEditFormInfoMsg": "Please provide the details for the incident you are reporting.",
14
+ "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer.",
15
+ "chooseCategoryMsg": "Choose a category for your report.",
16
+ "featureErrorMsg": "Features not found.",
17
+ "featureEditFormInfoMsg": "Please provide the details for your report.",
17
18
  "currentLocationMsg": "Use my current location",
19
+ "addLocationMsg": "Add the location for your report.",
18
20
  "reportSubmit": "Report Submitted.",
19
- "submitMsg": "Thank you! Your report was successfully submitted"
21
+ "submitMsg": "Thank you! Your report was successfully submitted."
20
22
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "error": "Error",
3
- "featureErrorMsg": "Features not found"
3
+ "featureErrorMsg": "Features not found."
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "error": "Error",
3
- "featureErrorMsg": "Features not found"
3
+ "featureErrorMsg": "Features not found."
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "error": "Error",
3
- "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer"
3
+ "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer."
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "error": "Error",
3
- "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer"
3
+ "noLayerToDisplayErrorMsg": "Configured web map don't have any editable feature layer."
4
4
  }
@@ -15,16 +15,16 @@ const interactive = require('./interactive-8aff886e.js');
15
15
  const locale = require('./locale-6a627639.js');
16
16
  const t9n = require('./t9n-0556abcb.js');
17
17
  const resources = require('./resources-8e3763a4.js');
18
- const popupUtils = require('./popupUtils-7755782a.js');
19
- const mapViewUtils = require('./mapViewUtils-8aa325de.js');
20
18
  const locale$1 = require('./locale-a476e15d.js');
19
+ const mapViewUtils = require('./mapViewUtils-8aa325de.js');
20
+ const popupUtils = require('./popupUtils-7755782a.js');
21
21
  require('./guid-1a466ca6.js');
22
22
  require('./resources-6c60363a.js');
23
23
  require('./browser-9a43b900.js');
24
24
  require('./key-b8c05387.js');
25
- require('./interfaces-7cd0a48a.js');
26
25
  require('./esri-loader-a91c0ec1.js');
27
26
  require('./_commonjsHelpers-384729db.js');
27
+ require('./interfaces-7cd0a48a.js');
28
28
 
29
29
  /*!
30
30
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
@@ -339,6 +339,200 @@ const FlowItem = class {
339
339
  };
340
340
  FlowItem.style = flowItemCss;
341
341
 
342
+ const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}";
343
+
344
+ const CreateFeature = class {
345
+ constructor(hostRef) {
346
+ index.registerInstance(this, hostRef);
347
+ this.success = index.createEvent(this, "success", 7);
348
+ this.fail = index.createEvent(this, "fail", 7);
349
+ this.drawComplete = index.createEvent(this, "drawComplete", 7);
350
+ this.mapView = undefined;
351
+ this.selectedLayerId = undefined;
352
+ }
353
+ //--------------------------------------------------------------------------
354
+ //
355
+ // Watch handlers
356
+ //
357
+ //--------------------------------------------------------------------------
358
+ /**
359
+ * Called each time the mapView prop is changed.
360
+ */
361
+ async mapViewWatchHandler() {
362
+ await this.mapView.when(async () => {
363
+ await this.init();
364
+ });
365
+ }
366
+ //--------------------------------------------------------------------------
367
+ //
368
+ // Methods (public)
369
+ //
370
+ //--------------------------------------------------------------------------
371
+ /**
372
+ * Destroy the Editor widget instance
373
+ * @returns Promise that resolves when the operation is complete
374
+ */
375
+ async close() {
376
+ if (this._editor) {
377
+ this._editor.destroy();
378
+ }
379
+ }
380
+ /**
381
+ * Submit the created feature
382
+ * @returns Promise that resolves when the operation is complete
383
+ */
384
+ async submit() {
385
+ if (this._editor) {
386
+ this._editor.viewModel.featureFormViewModel.submit();
387
+ }
388
+ }
389
+ //--------------------------------------------------------------------------
390
+ //
391
+ // Functions (lifecycle)
392
+ //
393
+ //--------------------------------------------------------------------------
394
+ /**
395
+ * StencilJS: Called once just after the component is first connected to the DOM.
396
+ * @returns Promise when complete
397
+ */
398
+ async componentWillLoad() {
399
+ await this.initModules();
400
+ }
401
+ /**
402
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
403
+ */
404
+ async componentDidLoad() {
405
+ await this.init();
406
+ }
407
+ /**
408
+ * Renders the component.
409
+ */
410
+ render() {
411
+ return (index.h(index.Host, { id: "feature-form" }));
412
+ }
413
+ //--------------------------------------------------------------------------
414
+ //
415
+ // Functions (protected)
416
+ //
417
+ //--------------------------------------------------------------------------
418
+ /**
419
+ * Init Editor widget and starts the create workflow
420
+ */
421
+ async init() {
422
+ if (this.mapView) {
423
+ if (this.mapView && this.selectedLayerId) {
424
+ await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
425
+ await this.createEditorWidget();
426
+ await this.startCreate();
427
+ this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
428
+ setTimeout(() => {
429
+ var _a, _b;
430
+ this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')[1].shadowRoot.querySelector('calcite-panel').shadowRoot.querySelector('article').querySelector('header').setAttribute('style', 'display: none');
431
+ (_b = (_a = this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')[1].shadowRoot.querySelector('calcite-panel').shadowRoot.querySelector('article')) === null || _a === void 0 ? void 0 : _a.querySelector('footer')) === null || _b === void 0 ? void 0 : _b.setAttribute('style', 'display: none');
432
+ }, 700);
433
+ }
434
+ }
435
+ }
436
+ /**
437
+ * Load esri javascript api modules
438
+ * @returns Promise resolving when function is done
439
+ * @protected
440
+ */
441
+ async initModules() {
442
+ const [Editor] = await locale$1.loadModules([
443
+ "esri/widgets/Editor"
444
+ ]);
445
+ this.Editor = Editor;
446
+ }
447
+ /**
448
+ * Display editor widget to create the new feature
449
+ * @protected
450
+ */
451
+ async createEditorWidget() {
452
+ if (this._editor) {
453
+ this._editor.destroy();
454
+ }
455
+ const container = document.createElement("div");
456
+ const layer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
457
+ const selectedLayer = {
458
+ layer: layer
459
+ };
460
+ this._editor = new this.Editor({
461
+ allowedWorkflows: "create-features",
462
+ view: this.mapView,
463
+ layerInfos: [selectedLayer],
464
+ visibleElements: {
465
+ snappingControls: false,
466
+ snappingControlsElements: {
467
+ featureEnabledToggle: false,
468
+ layerList: false,
469
+ enabledToggle: false
470
+ }
471
+ },
472
+ container,
473
+ });
474
+ this.el.appendChild(container);
475
+ }
476
+ /**
477
+ * Start creating the feature
478
+ * @protected
479
+ */
480
+ async startCreate() {
481
+ var _a, _b;
482
+ const layer = await mapViewUtils.getLayerOrTable(this.mapView, this.selectedLayerId);
483
+ if (layer) {
484
+ let template = layer.templates && layer.templates.length ? layer.templates[0] : {};
485
+ if (((_a = layer.sourceJSON) === null || _a === void 0 ? void 0 : _a.types.length) && ((_b = layer.sourceJSON.types[0].templates) === null || _b === void 0 ? void 0 : _b.length)) {
486
+ template = layer.sourceJSON.types[0].templates[0];
487
+ }
488
+ const creationInfo = {
489
+ layer: layer,
490
+ template: template
491
+ };
492
+ await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(creationInfo);
493
+ this._editor.viewModel.sketchViewModel.on("create", (evt) => {
494
+ if (evt.state === "complete") {
495
+ this.drawComplete.emit();
496
+ }
497
+ });
498
+ }
499
+ }
500
+ /**
501
+ * On creation of feature emit the event that the feature is created
502
+ * @param evt feature submit event
503
+ * @protected
504
+ */
505
+ async submitted(evt) {
506
+ var _a;
507
+ if (evt.invalid.length) {
508
+ return;
509
+ }
510
+ if (evt.valid.length) {
511
+ try {
512
+ await this._editor.activeWorkflow.commit();
513
+ //throw errors if any failures
514
+ if ((_a = this._editor.viewModel.failures) === null || _a === void 0 ? void 0 : _a.length) {
515
+ this._editor.viewModel.failures.some((failure) => {
516
+ if (failure.error) {
517
+ throw (failure.error);
518
+ }
519
+ });
520
+ }
521
+ }
522
+ catch (e) {
523
+ this.fail.emit(e);
524
+ return;
525
+ }
526
+ this.success.emit();
527
+ }
528
+ }
529
+ get el() { return index.getElement(this); }
530
+ static get watchers() { return {
531
+ "mapView": ["mapViewWatchHandler"]
532
+ }; }
533
+ };
534
+ CreateFeature.style = createFeatureCss;
535
+
342
536
  const featureListCss = ":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.popup-title{font-weight:500;padding:10px 12px}";
343
537
 
344
538
  const FeatureList = class {
@@ -405,6 +599,7 @@ const FeatureList = class {
405
599
  //--------------------------------------------------------------------------
406
600
  /**
407
601
  * Initialize the features list using the selected layer
602
+ * @protected
408
603
  */
409
604
  async initializeFeatureItems() {
410
605
  if (this._selectedLayer) {
@@ -538,6 +733,23 @@ const LayerList = class {
538
733
  }
539
734
  //--------------------------------------------------------------------------
540
735
  //
736
+ // Watch handlers
737
+ //
738
+ //--------------------------------------------------------------------------
739
+ //--------------------------------------------------------------------------
740
+ //
741
+ // Methods (public)
742
+ //
743
+ //--------------------------------------------------------------------------
744
+ /**
745
+ * Refresh the layer list which will fetch the latest layer count and update the list
746
+ * @returns Promise that resolves when the operation is complete
747
+ */
748
+ async refresh() {
749
+ await this.setLayers();
750
+ }
751
+ //--------------------------------------------------------------------------
752
+ //
541
753
  // Functions (lifecycle)
542
754
  //
543
755
  //--------------------------------------------------------------------------
@@ -562,7 +774,7 @@ const LayerList = class {
562
774
  render() {
563
775
  return (index.h(index.Fragment, null, this._isLoading && index.h("calcite-loader", { scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
564
776
  index.h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, index.h("div", { slot: "title" }, this._translations.error), index.h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
565
- index.h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single" }, this.renderLayerList())));
777
+ index.h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single-persist" }, this.renderLayerList())));
566
778
  }
567
779
  //--------------------------------------------------------------------------
568
780
  //
@@ -589,21 +801,24 @@ const LayerList = class {
589
801
  this._layerItemsHash = await mapViewUtils.getMapLayerHash(this.mapView, true);
590
802
  const allMapLayers = await mapViewUtils.getAllLayers(this.mapView);
591
803
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
592
- this.showFeatureCount && allMapLayers.forEach(async (eachLayer) => {
804
+ allMapLayers.forEach(async (eachLayer) => {
593
805
  var _a, _b;
594
806
  //TODO: checking editable condition could be configurable
595
- if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.supportsUpdate)) {
596
- const q = eachLayer.createQuery();
597
- const result = eachLayer.queryFeatureCount(q);
598
- def.push(result);
599
- void result.then(async (resCount) => {
600
- const formattedCount = !isNaN(resCount) ? await locale$1.formatNumber(resCount, {
601
- places: 0,
602
- api: 4,
603
- type: "decimal"
604
- }) : "";
605
- this._layerItemsHash[eachLayer.id].formattedFeatureCount = formattedCount;
606
- });
807
+ if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.supportsAdd)) {
808
+ this._layerItemsHash[eachLayer.id].supportsAdd = true;
809
+ if (this.showFeatureCount) {
810
+ const q = eachLayer.createQuery();
811
+ const result = eachLayer.queryFeatureCount(q);
812
+ def.push(result);
813
+ void result.then(async (resCount) => {
814
+ const formattedCount = !isNaN(resCount) ? await locale$1.formatNumber(resCount, {
815
+ places: 0,
816
+ api: 4,
817
+ type: "decimal"
818
+ }) : "";
819
+ this._layerItemsHash[eachLayer.id].formattedFeatureCount = formattedCount;
820
+ });
821
+ }
607
822
  }
608
823
  });
609
824
  await Promise.all(def).then(() => {
@@ -631,9 +846,9 @@ const LayerList = class {
631
846
  var _a;
632
847
  const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
633
848
  return Object.keys(hash).reduce((prev, cur) => {
634
- let showLayer = hash[cur].supportsUpdate;
849
+ let showLayer = hash[cur].supportsAdd;
635
850
  if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
636
- showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsUpdate : false;
851
+ showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
637
852
  }
638
853
  if (showLayer) {
639
854
  prev.push(cur);
@@ -687,5 +902,6 @@ LayerList.style = layerListCss;
687
902
 
688
903
  exports.calcite_flow = Flow;
689
904
  exports.calcite_flow_item = FlowItem;
905
+ exports.create_feature = CreateFeature;
690
906
  exports.feature_list = FeatureList;
691
907
  exports.layer_list = LayerList;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
  const index = require('./index-b8a649fc.js');
11
11
  const locale = require('./locale-a476e15d.js');
12
12
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
13
- const downloadUtils = require('./downloadUtils-83c6d3c3.js');
13
+ const downloadUtils = require('./downloadUtils-10e0de31.js');
14
14
  require('./esri-loader-a91c0ec1.js');
15
15
  require('./_commonjsHelpers-384729db.js');
16
16
  require('./interfaces-7cd0a48a.js');