@esri/solutions-components 0.6.31 → 0.6.33

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 (74) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +14 -2
  2. package/dist/cjs/calcite-alert_3.cjs.entry.js +14 -5
  3. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  4. package/dist/cjs/card-manager_3.cjs.entry.js +47 -55
  5. package/dist/cjs/crowdsource-manager.cjs.entry.js +7 -7
  6. package/dist/cjs/{downloadUtils-84024878.js → downloadUtils-b37689dd.js} +22 -2
  7. package/dist/cjs/{index.es-eb7cf427.js → index.es-83e253dc.js} +2 -2
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  10. package/dist/cjs/{mapViewUtils-786a219b.js → mapViewUtils-303bf42d.js} +1 -1
  11. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  12. package/dist/cjs/solutions-components.cjs.js +1 -1
  13. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +8 -0
  14. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +6 -6
  15. package/dist/collection/components/edit-card/edit-card.js +23 -5
  16. package/dist/collection/components/floor-filter/floor-filter.js +2 -1
  17. package/dist/collection/components/layer-table/layer-table.css +4 -2
  18. package/dist/collection/components/layer-table/layer-table.js +40 -50
  19. package/dist/collection/components/map-card/map-card.css +5 -1
  20. package/dist/collection/components/map-card/map-card.js +20 -1
  21. package/dist/collection/components/map-tools/map-tools.js +15 -1
  22. package/dist/collection/utils/downloadUtils.js +20 -0
  23. package/dist/collection/utils/downloadUtils.ts +20 -0
  24. package/dist/collection/utils/queryUtils.js +1 -1
  25. package/dist/collection/utils/queryUtils.ts +1 -1
  26. package/dist/collection/utils/test/downloadUtils.spec.js +79 -5
  27. package/dist/collection/utils/test/downloadUtils.spec.tsx +84 -5
  28. package/dist/components/crowdsource-manager.js +7 -7
  29. package/dist/components/downloadUtils.js +20 -0
  30. package/dist/components/edit-card2.js +15 -6
  31. package/dist/components/floor-filter2.js +2 -1
  32. package/dist/components/layer-table2.js +41 -51
  33. package/dist/components/map-card2.js +5 -2
  34. package/dist/components/map-tools2.js +14 -1
  35. package/dist/components/queryUtils.js +1 -1
  36. package/dist/esm/basemap-gallery_7.entry.js +14 -2
  37. package/dist/esm/calcite-alert_3.entry.js +14 -5
  38. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  39. package/dist/esm/card-manager_3.entry.js +47 -55
  40. package/dist/esm/crowdsource-manager.entry.js +7 -7
  41. package/dist/esm/{downloadUtils-fa2b3718.js → downloadUtils-ddd7eeb7.js} +22 -2
  42. package/dist/esm/{index.es-cc671fd2.js → index.es-a53707d1.js} +2 -2
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/map-select-tools_3.entry.js +2 -2
  45. package/dist/esm/{mapViewUtils-8bfabd80.js → mapViewUtils-43c930f1.js} +1 -1
  46. package/dist/esm/public-notification.entry.js +2 -2
  47. package/dist/esm/solutions-components.js +1 -1
  48. package/dist/solutions-components/{p-e94c7cf2.js → p-05ba41f9.js} +1 -1
  49. package/dist/solutions-components/{p-ce3b40ca.entry.js → p-4792005c.entry.js} +1 -1
  50. package/dist/solutions-components/{p-86893d46.entry.js → p-50a3a887.entry.js} +1 -1
  51. package/dist/solutions-components/p-65ade5af.entry.js +6 -0
  52. package/dist/solutions-components/p-7b61f856.entry.js +6 -0
  53. package/dist/solutions-components/{p-190c83b9.entry.js → p-978a26b3.entry.js} +1 -1
  54. package/dist/solutions-components/p-a5342c42.entry.js +6 -0
  55. package/dist/solutions-components/{p-37a58e04.js → p-b745143d.js} +3 -3
  56. package/dist/solutions-components/{p-33fa9891.entry.js → p-e05cf92d.entry.js} +2 -2
  57. package/dist/solutions-components/{p-53bc5fc1.js → p-f2194390.js} +1 -1
  58. package/dist/solutions-components/solutions-components.esm.js +1 -1
  59. package/dist/solutions-components/utils/downloadUtils.ts +20 -0
  60. package/dist/solutions-components/utils/queryUtils.ts +1 -1
  61. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +84 -5
  62. package/dist/types/components/edit-card/edit-card.d.ts +2 -1
  63. package/dist/types/components/map-card/map-card.d.ts +4 -0
  64. package/dist/types/components/map-tools/map-tools.d.ts +8 -0
  65. package/dist/types/components.d.ts +8 -0
  66. package/package.json +1 -1
  67. package/dist/esm/polyfills/core-js.js +0 -11
  68. package/dist/esm/polyfills/dom.js +0 -79
  69. package/dist/esm/polyfills/es5-html-element.js +0 -1
  70. package/dist/esm/polyfills/index.js +0 -34
  71. package/dist/esm/polyfills/system.js +0 -6
  72. package/dist/solutions-components/p-3c702004.entry.js +0 -6
  73. package/dist/solutions-components/p-d44ad6c4.entry.js +0 -6
  74. package/dist/solutions-components/p-f2dcb05a.entry.js +0 -6
@@ -44,7 +44,7 @@ export class EditCard {
44
44
  */
45
45
  async graphicsWatchHandler() {
46
46
  if (this.graphics.length === 0) {
47
- this._closeEdit();
47
+ await this._closeEdit();
48
48
  }
49
49
  }
50
50
  async openWatchHandler(v) {
@@ -58,9 +58,12 @@ export class EditCard {
58
58
  this._editorLoading = false;
59
59
  }
60
60
  if (!v) {
61
- this._closeEdit();
61
+ await this._closeEdit();
62
62
  }
63
63
  }
64
+ async featureSelectionChange() {
65
+ await this._closeEdit();
66
+ }
64
67
  //--------------------------------------------------------------------------
65
68
  //
66
69
  // Functions (lifecycle)
@@ -90,7 +93,7 @@ export class EditCard {
90
93
  }
91
94
  this._layerEditHandle = this._layer.on("edits", () => {
92
95
  this.editsComplete.emit();
93
- this._closeEdit();
96
+ void this._closeEdit();
94
97
  });
95
98
  }
96
99
  }
@@ -161,7 +164,7 @@ export class EditCard {
161
164
  });
162
165
  this._editHandle = this.reactiveUtils.when(() => this._editor.viewModel.state === "ready", () => {
163
166
  if (this._shouldClose) {
164
- this._closeEdit();
167
+ void this._closeEdit();
165
168
  }
166
169
  else if (this.graphicIndex > -1 && this.graphics.length > 0 && this.open && !this._shouldClose) {
167
170
  void this._startUpdate();
@@ -181,7 +184,13 @@ export class EditCard {
181
184
  *
182
185
  * @returns void
183
186
  */
184
- _closeEdit() {
187
+ async _closeEdit() {
188
+ var _a, _b, _c;
189
+ this._shouldClose = true;
190
+ if ((_a = this._editor) === null || _a === void 0 ? void 0 : _a.activeWorkflow) {
191
+ await ((_b = this._editor) === null || _b === void 0 ? void 0 : _b.cancelWorkflow());
192
+ }
193
+ (_c = this._editor) === null || _c === void 0 ? void 0 : _c.destroy();
185
194
  this._shouldClose = false;
186
195
  this.closeEdit.emit();
187
196
  }
@@ -343,4 +352,13 @@ export class EditCard {
343
352
  "methodName": "openWatchHandler"
344
353
  }];
345
354
  }
355
+ static get listeners() {
356
+ return [{
357
+ "name": "featureSelectionChange",
358
+ "method": "featureSelectionChange",
359
+ "target": "window",
360
+ "capture": false,
361
+ "passive": false
362
+ }];
363
+ }
346
364
  }
@@ -86,7 +86,8 @@ export class FloorFilter {
86
86
  * @protected
87
87
  */
88
88
  _initFloorFilter(view) {
89
- if (view && this.enabled && this.FloorFilter) {
89
+ var _a;
90
+ if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
90
91
  if (!this.floorFilterWidget) {
91
92
  this.floorFilterWidget = new this.FloorFilter({
92
93
  container: this._floorFilterElement,
@@ -60,14 +60,16 @@
60
60
 
61
61
  .bottom-left {
62
62
  position: absolute;
63
- left: 5;
63
+ left: 0;
64
64
  bottom: 0;
65
+ padding-left: 5px;
65
66
  }
66
67
 
67
68
  html[dir="rtl"] .bottom-left {
68
69
  position: absolute;
69
- right: 5;
70
+ right: 0;
70
71
  bottom: 0;
72
+ padding-right: 5px;
71
73
  }
72
74
 
73
75
  .height-19 {
@@ -331,26 +331,26 @@ export class LayerTable {
331
331
  func: () => this._selectAll(),
332
332
  label: this._translations.selectAll,
333
333
  disabled: false,
334
- isOverflow: true
334
+ isOverflow: false
335
335
  }, {
336
336
  icon: "compare",
337
337
  func: () => this._switchSelected(),
338
338
  label: this._translations.switchSelected,
339
339
  disabled: false,
340
- isOverflow: true
340
+ isOverflow: false
341
341
  }, {
342
342
  icon: "refresh",
343
343
  func: () => this._refresh(),
344
344
  label: this._translations.refresh,
345
345
  disabled: false,
346
- isOverflow: true
346
+ isOverflow: false
347
347
  },
348
348
  this.enableCSV ? {
349
349
  icon: "export",
350
350
  func: () => void this._exportToCSV(),
351
351
  label: this._translations.exportCSV,
352
352
  disabled: false,
353
- isOverflow: true
353
+ isOverflow: false
354
354
  } : undefined];
355
355
  this._defaultVisibleToolSizeInfos = undefined;
356
356
  }
@@ -394,14 +394,20 @@ export class LayerTable {
394
394
  prev.push(cur.id);
395
395
  return prev;
396
396
  }, []);
397
+ let forceFinish = false;
397
398
  const controlsThatFit = [...this._defaultVisibleToolSizeInfos].reduce((prev, cur) => {
398
- if (skipControls.indexOf(cur.id) < 0 &&
399
+ if (!forceFinish && skipControls.indexOf(cur.id) < 0 &&
399
400
  (currentTools.indexOf(cur.id) > -1 || (controlsWidth + cur.width) <= toolbarWidth)) {
400
401
  if (currentTools.indexOf(cur.id) < 0) {
401
402
  controlsWidth += cur.width;
402
403
  }
403
404
  prev.push(cur);
404
405
  }
406
+ else if (skipControls.indexOf(cur.id) < 0 && (controlsWidth + cur.width) > toolbarWidth) {
407
+ // exit the first time we evalute this as true...otherwise it will add the next control that will fit
408
+ // and not preserve the overall order of controls
409
+ forceFinish = true;
410
+ }
405
411
  return prev;
406
412
  }, []);
407
413
  this._setControlsThatFit(controlsThatFit, skipControls);
@@ -480,9 +486,9 @@ export class LayerTable {
480
486
  */
481
487
  _getDropdown(id) {
482
488
  const dropdownItems = this._getDropdownItems();
483
- return (h("calcite-dropdown", { disabled: this._layer === undefined, id: "solutions-more" }, h("calcite-action", { appearance: "solid", id: id, label: "", slot: "trigger", text: "" }, h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), h("calcite-dropdown-group", { "selection-mode": "none" }, dropdownItems.map(item => {
489
+ return dropdownItems.length > 0 ? (h("calcite-dropdown", { disabled: this._layer === undefined, id: "solutions-more" }, h("calcite-action", { appearance: "solid", id: id, label: "", slot: "trigger", text: "" }, h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), h("calcite-dropdown-group", { "selection-mode": "none" }, dropdownItems.map(item => {
484
490
  return (h("calcite-dropdown-item", { iconStart: item.icon, onClick: item.func }, item.label));
485
- }))));
491
+ })))) : undefined;
486
492
  }
487
493
  /**
488
494
  * Get a list of toolInfos that should display in the dropdown
@@ -599,33 +605,30 @@ export class LayerTable {
599
605
  * @returns void
600
606
  */
601
607
  async _resetTable() {
602
- if (this._table) {
603
- this._clearSelection();
604
- this._allIds = [];
605
- this.featureSelectionChange.emit(this._selectedIndexes);
606
- if (this._layer) {
607
- await this._layer.when(() => {
608
- var _a, _b;
609
- const columnTemplates = this._getColumnTemplates(this._layer.id, (_b = (_a = this._layer) === null || _a === void 0 ? void 0 : _a.popupTemplate) === null || _b === void 0 ? void 0 : _b.fieldInfos);
610
- this._table.layer = this._layer;
611
- this._table.tableTemplate.columnTemplates = columnTemplates;
612
- this._table.view = this.mapView;
613
- this._checkEditEnabled();
614
- this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
615
- this._initToolInfos();
616
- });
617
- await this._table.when(() => {
618
- this._table.clearSelectionFilter();
619
- });
620
- this._showOnlySelected = false;
621
- this._sortActive = false;
622
- await this._sortTable();
623
- }
624
- else {
625
- this._table.view = this.mapView;
626
- this._table.layer = this._layer;
627
- }
608
+ var _a, _b;
609
+ this._clearSelection();
610
+ this._allIds = [];
611
+ this.featureSelectionChange.emit(this._selectedIndexes);
612
+ const columnTemplates = this._getColumnTemplates(this._layer.id, (_b = (_a = this._layer) === null || _a === void 0 ? void 0 : _a.popupTemplate) === null || _b === void 0 ? void 0 : _b.fieldInfos);
613
+ this._allIds = await queryAllIds(this._layer);
614
+ if (!this._table) {
615
+ await this._getTable(this._tableNode, columnTemplates);
616
+ }
617
+ else if (columnTemplates) {
618
+ this._table.tableTemplate.columnTemplates = columnTemplates;
628
619
  }
620
+ this._table.layer = this._layer;
621
+ this._table.view = this.mapView;
622
+ this._checkEditEnabled();
623
+ this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
624
+ this._initToolInfos();
625
+ await this._table.when(() => {
626
+ this._table.highlightIds.removeAll();
627
+ this._table.clearSelectionFilter();
628
+ });
629
+ this._showOnlySelected = false;
630
+ this._sortActive = false;
631
+ await this._sortTable();
629
632
  }
630
633
  /**
631
634
  * Verify edit capabilities of the layer
@@ -827,28 +830,15 @@ export class LayerTable {
827
830
  * @returns a promise that will resolve when the operation is complete
828
831
  */
829
832
  async _layerSelectionChanged(evt) {
830
- var _a, _b, _c;
833
+ var _a;
831
834
  const id = evt.detail[0];
832
835
  if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._allIds.length === 0) {
833
836
  this._fetchingData = true;
834
- this._layer = await getLayerOrTable(this.mapView, id);
835
- const columnTemplates = this._getColumnTemplates(id, (_c = (_b = this._layer) === null || _b === void 0 ? void 0 : _b.popupTemplate) === null || _c === void 0 ? void 0 : _c.fieldInfos);
836
- this._allIds = await queryAllIds(this._layer);
837
- if (!this._table) {
838
- await this._getTable(this._tableNode, columnTemplates);
839
- }
840
- else if (columnTemplates) {
841
- this._table.tableTemplate.columnTemplates = columnTemplates;
842
- }
843
- await this._table.when(() => {
844
- this._table.highlightIds.removeAll();
837
+ const layer = await getLayerOrTable(this.mapView, id);
838
+ await layer.when(() => {
839
+ this._layer = layer;
845
840
  });
846
- this._selectedIndexes = [];
847
- this._table.layer = this._layer;
848
- this._table.render();
849
841
  }
850
- this._sortActive = false;
851
- await this._sortTable();
852
842
  this._fetchingData = false;
853
843
  }
854
844
  /**
@@ -21,9 +21,13 @@
21
21
  }
22
22
 
23
23
  .map-height {
24
- height: calc(100% - 58px);
24
+ height: calc(100% - 51px);
25
25
  }
26
26
 
27
27
  .box-shadow {
28
28
  box-shadow: none !important;
29
29
  }
30
+
31
+ .visibility-hidden {
32
+ visibility: hidden;
33
+ }
@@ -38,6 +38,7 @@ export class MapCard {
38
38
  this.enableSearch = undefined;
39
39
  this.enableBasemap = undefined;
40
40
  this.basemapConfig = undefined;
41
+ this.hidden = undefined;
41
42
  this.mapInfos = [];
42
43
  this.mapView = undefined;
43
44
  this._searchConfiguration = undefined;
@@ -64,7 +65,8 @@ export class MapCard {
64
65
  * Renders the component.
65
66
  */
66
67
  render() {
67
- return (h(Host, null, h("map-picker", { mapInfos: this.mapInfos }), h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) }), h("map-tools", { basemapConfig: this.basemapConfig, class: "box-shadow", enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableLegend: this.enableLegend, enableSearch: this.enableSearch, mapView: this.mapView, ref: (el) => this._mapTools = el, searchConfiguration: this._searchConfiguration })));
68
+ const mapClass = this.hidden ? "visibility-hidden" : "";
69
+ return (h(Host, null, h("map-picker", { mapInfos: this.mapInfos }), h("div", { class: `map-height ${mapClass}`, ref: (el) => (this._mapDiv = el) }), h("map-tools", { basemapConfig: this.basemapConfig, class: "box-shadow", enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableLegend: this.enableLegend, enableSearch: this.enableSearch, mapView: this.mapView, ref: (el) => this._mapTools = el, searchConfiguration: this._searchConfiguration })));
68
70
  }
69
71
  //--------------------------------------------------------------------------
70
72
  //
@@ -247,6 +249,23 @@ export class MapCard {
247
249
  "text": "IBasemapConfig: List of any basemaps to filter out from the basemap widget"
248
250
  }
249
251
  },
252
+ "hidden": {
253
+ "type": "boolean",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "boolean",
257
+ "resolved": "boolean",
258
+ "references": {}
259
+ },
260
+ "required": false,
261
+ "optional": false,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": "boolean: When true the map display will be hidden"
265
+ },
266
+ "attribute": "hidden",
267
+ "reflect": false
268
+ },
250
269
  "mapInfos": {
251
270
  "type": "unknown",
252
271
  "mutable": false,
@@ -31,6 +31,7 @@ export class MapTools {
31
31
  this.layout = "vertical";
32
32
  this.mapView = undefined;
33
33
  this.searchConfiguration = undefined;
34
+ this._hasFloorInfo = false;
34
35
  this._translations = undefined;
35
36
  this._showTools = true;
36
37
  this._showBasemapWidget = false;
@@ -44,6 +45,15 @@ export class MapTools {
44
45
  // Watch handlers
45
46
  //
46
47
  //--------------------------------------------------------------------------
48
+ /**
49
+ * When the mapView loads check if it supports floor awareness
50
+ */
51
+ async mapViewWatchHandler() {
52
+ await this.mapView.when(() => {
53
+ var _a, _b;
54
+ this._hasFloorInfo = (_b = (_a = this.mapView) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.floorInfo;
55
+ });
56
+ }
47
57
  /**
48
58
  * When the _showBasemapWidget property is true display the basemap gallery
49
59
  */
@@ -157,7 +167,7 @@ export class MapTools {
157
167
  this._getActionGroup(fullscreenIcon, false, fullscreenTip, () => this._expand()) :
158
168
  undefined, this.enableBasemap ?
159
169
  this._getActionGroup("basemap", false, this._translations.basemap, () => this._toggleBasemapPicker()) :
160
- undefined, this.enableFloorFilter ?
170
+ undefined, this.enableFloorFilter && this._hasFloorInfo ?
161
171
  this._getActionGroup("urban-model", false, this._translations.floorFilter, () => this._toggleFloorFilter()) :
162
172
  undefined)), h("basemap-gallery", { basemapConfig: this.basemapConfig, class: basemapClass, mapView: this.mapView, ref: (el) => { this._basemapElement = el; } }), h("map-search", { class: searchClass, mapView: this.mapView, ref: (el) => { this._searchElement = el; }, resultGraphicEnabled: true, searchConfiguration: this.searchConfiguration }), h("map-legend", { class: legendClass, mapView: this.mapView, ref: (el) => { this._legendElement = el; } }), h("map-fullscreen", { class: fullscreenClass, mapView: this.mapView, ref: (el) => { this._fullscreenElement = el; } }), h("floor-filter", { class: floorFilterClass, enabled: this.enableFloorFilter, mapView: this.mapView, ref: (el) => { this._floorFilterElement = el; } })));
163
173
  }
@@ -432,6 +442,7 @@ export class MapTools {
432
442
  }
433
443
  static get states() {
434
444
  return {
445
+ "_hasFloorInfo": {},
435
446
  "_translations": {},
436
447
  "_showTools": {},
437
448
  "_showBasemapWidget": {},
@@ -444,6 +455,9 @@ export class MapTools {
444
455
  static get elementRef() { return "el"; }
445
456
  static get watchers() {
446
457
  return [{
458
+ "propName": "mapView",
459
+ "methodName": "mapViewWatchHandler"
460
+ }, {
447
461
  "propName": "_showBasemapWidget",
448
462
  "methodName": "_showBasemapWidgetWatchHandler"
449
463
  }, {
@@ -514,6 +514,26 @@ export function _prepareAttributeValue(attributeValue, attributeType, attributeD
514
514
  // e.g., "12/31/1969, 4:00 PM"
515
515
  value = value.replace(/\xe2\x80\xaf/g, "");
516
516
  break;
517
+ case "date-only":
518
+ // Value is a string, e.g., "2020-12-08"
519
+ if (attributeFormat === null || attributeFormat === void 0 ? void 0 : attributeFormat.dateFormat) {
520
+ const dateFormatIntlOptions = intl.convertDateFormatToIntlOptions(attributeFormat.dateFormat);
521
+ value = intl.formatDateOnly(value, dateFormatIntlOptions);
522
+ }
523
+ else {
524
+ value = intl.formatDateOnly(value);
525
+ }
526
+ break;
527
+ case "time-only":
528
+ // Value is a string, e.g., "14:51:44.2533333"
529
+ if (attributeFormat === null || attributeFormat === void 0 ? void 0 : attributeFormat.dateFormat) {
530
+ const dateFormatIntlOptions = intl.convertDateFormatToIntlOptions(attributeFormat.dateFormat);
531
+ value = intl.formatTimeOnly(value, dateFormatIntlOptions);
532
+ }
533
+ else {
534
+ value = intl.formatTimeOnly(value);
535
+ }
536
+ break;
517
537
  case "double":
518
538
  case "integer":
519
539
  case "long":
@@ -688,6 +688,26 @@ export function _prepareAttributeValue(
688
688
  value = value.replace(/\xe2\x80\xaf/g, "");
689
689
  break;
690
690
 
691
+ case "date-only":
692
+ // Value is a string, e.g., "2020-12-08"
693
+ if (attributeFormat?.dateFormat) {
694
+ const dateFormatIntlOptions = intl.convertDateFormatToIntlOptions(attributeFormat.dateFormat as any);
695
+ value = intl.formatDateOnly(value, dateFormatIntlOptions);
696
+ } else {
697
+ value = intl.formatDateOnly(value);
698
+ }
699
+ break;
700
+
701
+ case "time-only":
702
+ // Value is a string, e.g., "14:51:44.2533333"
703
+ if (attributeFormat?.dateFormat) {
704
+ const dateFormatIntlOptions = intl.convertDateFormatToIntlOptions(attributeFormat.dateFormat as any);
705
+ value = intl.formatTimeOnly(value, dateFormatIntlOptions);
706
+ } else {
707
+ value = intl.formatTimeOnly(value);
708
+ }
709
+ break;
710
+
691
711
  case "double":
692
712
  case "integer":
693
713
  case "long":
@@ -49,7 +49,7 @@ export async function queryAllFeatures(start, layer, graphics) {
49
49
  */
50
50
  export async function queryAllIds(layer) {
51
51
  const query = layer.createQuery();
52
- query.where = "1=1";
52
+ query.where = layer.definitionExpression || "1=1";
53
53
  return await layer.queryObjectIds(query);
54
54
  }
55
55
  /**
@@ -59,7 +59,7 @@ export async function queryAllIds(
59
59
  layer: __esri.FeatureLayer
60
60
  ): Promise<number[]> {
61
61
  const query = layer.createQuery();
62
- query.where = "1=1";
62
+ query.where = layer.definitionExpression || "1=1";
63
63
  return await layer.queryObjectIds(query);
64
64
  }
65
65
 
@@ -803,21 +803,95 @@ describe("downloadUtils", () => {
803
803
  });
804
804
  });
805
805
  describe('_prepareAttributeValue', () => {
806
+ it('should format date attributes', () => {
807
+ const attributeValue = new Date('2022-02-01T00:00:00.000Z');
808
+ const attributeType = 'date';
809
+ const attributeDomain = null;
810
+ const attributeFormat = null;
811
+ const intl = {
812
+ formatDate: jest.fn().mockReturnValue('02/01/2022'),
813
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
814
+ };
815
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
816
+ expect(result).toEqual('02/01/2022');
817
+ expect(intl.formatDate).toHaveBeenCalledWith(attributeValue);
818
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
819
+ });
820
+ it('should format date-only attributes', () => {
821
+ const attributeValue = '2020-02-01';
822
+ const attributeType = 'date-only';
823
+ const attributeDomain = null;
824
+ const attributeFormat = null;
825
+ const intl = {
826
+ formatDateOnly: jest.fn().mockReturnValue('02/01/2022'),
827
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
828
+ };
829
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
830
+ expect(result).toEqual('02/01/2022');
831
+ expect(intl.formatDateOnly).toHaveBeenCalledWith(attributeValue);
832
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
833
+ });
834
+ it('should format time-only attributes', () => {
835
+ const attributeValue = '14:51:44.2533333';
836
+ const attributeType = 'time-only';
837
+ const attributeDomain = null;
838
+ const attributeFormat = null;
839
+ const intl = {
840
+ formatTimeOnly: jest.fn().mockReturnValue('14:41'),
841
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
842
+ };
843
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
844
+ expect(result).toEqual('14:41');
845
+ expect(intl.formatTimeOnly).toHaveBeenCalledWith(attributeValue);
846
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
847
+ });
806
848
  it('should format date attributes using the specified date format', () => {
807
- const attributeValue = new Date('2022-01-01T00:00:00.000Z');
849
+ const attributeValue = new Date('2022-02-01T00:00:00.000Z');
808
850
  const attributeType = 'date';
809
851
  const attributeDomain = null;
810
852
  const attributeFormat = {
811
- dateFormat: 'short-date'
853
+ dateFormat: 'shortdate'
812
854
  };
813
855
  const intl = {
814
- formatDate: jest.fn().mockReturnValue('01/01/2022'),
856
+ formatDate: jest.fn().mockReturnValue('02/01/2022'),
815
857
  convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
816
858
  };
817
859
  const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
818
- expect(result).toEqual('01/01/2022');
860
+ expect(result).toEqual('02/01/2022');
819
861
  expect(intl.formatDate).toHaveBeenCalledWith(attributeValue, {});
820
- expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('short-date');
862
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
863
+ });
864
+ it('should format date-only attributes using the specified date format', () => {
865
+ const attributeValue = '2020-02-01';
866
+ const attributeType = 'date-only';
867
+ const attributeDomain = null;
868
+ const attributeFormat = {
869
+ dateFormat: 'shortdate'
870
+ };
871
+ const intl = {
872
+ formatDateOnly: jest.fn().mockReturnValue('02/01/2022'),
873
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
874
+ };
875
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
876
+ expect(result).toEqual('02/01/2022');
877
+ expect(intl.formatDateOnly).toHaveBeenCalledWith(attributeValue, {});
878
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
879
+ });
880
+ it('should format time-only attributes using the specified date format', () => {
881
+ const attributeValue = '14:51:44.2533333';
882
+ const attributeType = 'time-only';
883
+ const attributeDomain = null;
884
+ const attributeFormat = {
885
+ dateFormat: 'shortdate'
886
+ };
887
+ const intl = {
888
+ formatTimeOnly: jest.fn().mockReturnValue('14:41'),
889
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
890
+ };
891
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat, intl);
892
+ expect(result).toEqual('14:41');
893
+ expect(intl.formatTimeOnly).toHaveBeenCalledWith(attributeValue, {});
894
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
821
895
  });
822
896
  it('should format number attributes using the specified number format', () => {
823
897
  const attributeValue = 1234.5678;
@@ -924,21 +924,100 @@ describe("downloadUtils", () => {
924
924
 
925
925
  describe('_prepareAttributeValue', () => {
926
926
 
927
+ it('should format date attributes', () => {
928
+ const attributeValue = new Date('2022-02-01T00:00:00.000Z');
929
+ const attributeType = 'date';
930
+ const attributeDomain = null;
931
+ const attributeFormat = null;
932
+ const intl = {
933
+ formatDate: jest.fn().mockReturnValue('02/01/2022'),
934
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
935
+ };
936
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
937
+ expect(result).toEqual('02/01/2022');
938
+ expect(intl.formatDate).toHaveBeenCalledWith(attributeValue);
939
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
940
+ });
941
+
942
+ it('should format date-only attributes', () => {
943
+ const attributeValue = '2020-02-01';
944
+ const attributeType = 'date-only';
945
+ const attributeDomain = null;
946
+ const attributeFormat = null;
947
+ const intl = {
948
+ formatDateOnly: jest.fn().mockReturnValue('02/01/2022'),
949
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
950
+ };
951
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
952
+ expect(result).toEqual('02/01/2022');
953
+ expect(intl.formatDateOnly).toHaveBeenCalledWith(attributeValue);
954
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
955
+ });
956
+
957
+ it('should format time-only attributes', () => {
958
+ const attributeValue = '14:51:44.2533333';
959
+ const attributeType = 'time-only';
960
+ const attributeDomain = null;
961
+ const attributeFormat = null;
962
+ const intl = {
963
+ formatTimeOnly: jest.fn().mockReturnValue('14:41'),
964
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
965
+ };
966
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
967
+ expect(result).toEqual('14:41');
968
+ expect(intl.formatTimeOnly).toHaveBeenCalledWith(attributeValue);
969
+ expect(intl.convertDateFormatToIntlOptions).not.toHaveBeenCalled();
970
+ });
971
+
927
972
  it('should format date attributes using the specified date format', () => {
928
- const attributeValue = new Date('2022-01-01T00:00:00.000Z');
973
+ const attributeValue = new Date('2022-02-01T00:00:00.000Z');
929
974
  const attributeType = 'date';
930
975
  const attributeDomain = null;
931
976
  const attributeFormat = {
932
- dateFormat: 'short-date'
977
+ dateFormat: 'shortdate'
933
978
  };
934
979
  const intl = {
935
- formatDate: jest.fn().mockReturnValue('01/01/2022'),
980
+ formatDate: jest.fn().mockReturnValue('02/01/2022'),
936
981
  convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
937
982
  };
938
983
  const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
939
- expect(result).toEqual('01/01/2022');
984
+ expect(result).toEqual('02/01/2022');
940
985
  expect(intl.formatDate).toHaveBeenCalledWith(attributeValue, {});
941
- expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('short-date');
986
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
987
+ });
988
+
989
+ it('should format date-only attributes using the specified date format', () => {
990
+ const attributeValue = '2020-02-01';
991
+ const attributeType = 'date-only';
992
+ const attributeDomain = null;
993
+ const attributeFormat = {
994
+ dateFormat: 'shortdate'
995
+ };
996
+ const intl = {
997
+ formatDateOnly: jest.fn().mockReturnValue('02/01/2022'),
998
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
999
+ };
1000
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
1001
+ expect(result).toEqual('02/01/2022');
1002
+ expect(intl.formatDateOnly).toHaveBeenCalledWith(attributeValue, {});
1003
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
1004
+ });
1005
+
1006
+ it('should format time-only attributes using the specified date format', () => {
1007
+ const attributeValue = '14:51:44.2533333';
1008
+ const attributeType = 'time-only';
1009
+ const attributeDomain = null;
1010
+ const attributeFormat = {
1011
+ dateFormat: 'shortdate'
1012
+ };
1013
+ const intl = {
1014
+ formatTimeOnly: jest.fn().mockReturnValue('14:41'),
1015
+ convertDateFormatToIntlOptions: jest.fn().mockReturnValue({})
1016
+ };
1017
+ const result = downloadUtils._prepareAttributeValue(attributeValue, attributeType, attributeDomain, attributeFormat as any, intl);
1018
+ expect(result).toEqual('14:41');
1019
+ expect(intl.formatTimeOnly).toHaveBeenCalledWith(attributeValue, {});
1020
+ expect(intl.convertDateFormatToIntlOptions).toHaveBeenCalledWith('shortdate');
942
1021
  });
943
1022
 
944
1023
  it('should format number attributes using the specified number format', () => {