@esri/solutions-components 0.8.2 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-action-pad_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite-input-date-picker_3.cjs.entry.js +16 -10
- package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
- package/dist/cjs/{downloadUtils-c2bd7c80.js → downloadUtils-8b05d7cc.js} +39 -8
- package/dist/cjs/{helpers-81779c18.js → helpers-b014d9a9.js} +1 -1
- package/dist/cjs/{index.es-22b3d1a2.js → index.es-e7587227.js} +1 -1
- package/dist/cjs/instant-apps-ckeditor-wrapper_3.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-control-panel.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-export.cjs.entry.js +16 -10
- package/dist/cjs/instant-apps-header.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-keyboard-shortcuts.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-landing-page.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +5 -5
- package/dist/cjs/instant-apps-language-translator.cjs.entry.js +5 -5
- package/dist/cjs/instant-apps-measurement.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-popover.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-splash.cjs.entry.js +14 -5
- package/dist/cjs/{languageSwitcher-4822684b.js → languageSwitcher-3870c772.js} +1 -1
- package/dist/cjs/{languageUtil-9bd00bad.js → languageUtil-0df39c0c.js} +1 -1
- package/dist/cjs/{loadModules-69fc5b98.js → loadModules-01306709.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{locale-3e33f44c.js → locale-4cef466e.js} +2 -2
- package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/cjs/{utils-ea7a5a63.js → utils-ac836e7a.js} +1 -1
- package/dist/collection/utils/downloadUtils.js +38 -7
- package/dist/collection/utils/downloadUtils.ts +46 -7
- package/dist/collection/utils/test/downloadUtils.spec.js +33 -1
- package/dist/collection/utils/test/downloadUtils.spec.tsx +40 -1
- package/dist/components/downloadUtils.js +38 -7
- package/dist/components/instant-apps-export.js +13 -7
- package/dist/components/instant-apps-landing-page.js +1 -1
- package/dist/components/instant-apps-measurement.js +1 -1
- package/dist/components/instant-apps-social-share2.js +13 -7
- package/dist/components/instant-apps-splash.js +16 -2
- package/dist/components/languageUtil.js +1 -1
- package/dist/components/loadModules2.js +1 -1
- package/dist/esm/calcite-action-pad_2.entry.js +1 -1
- package/dist/esm/calcite-input-date-picker_3.entry.js +16 -10
- package/dist/esm/card-manager_3.entry.js +1 -1
- package/dist/esm/{downloadUtils-a6c0e25f.js → downloadUtils-0c13073b.js} +39 -8
- package/dist/esm/{helpers-aeddac74.js → helpers-f9256189.js} +1 -1
- package/dist/esm/{index.es-b0a676ae.js → index.es-ad250bc6.js} +1 -1
- package/dist/esm/instant-apps-ckeditor-wrapper_3.entry.js +4 -4
- package/dist/esm/instant-apps-control-panel.entry.js +1 -1
- package/dist/esm/instant-apps-export.entry.js +16 -10
- package/dist/esm/instant-apps-header.entry.js +1 -1
- package/dist/esm/instant-apps-interactive-legend-classic.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend.entry.js +4 -4
- package/dist/esm/instant-apps-keyboard-shortcuts.entry.js +3 -3
- package/dist/esm/instant-apps-landing-page.entry.js +1 -1
- package/dist/esm/instant-apps-language-switcher.entry.js +5 -5
- package/dist/esm/instant-apps-language-translator.entry.js +5 -5
- package/dist/esm/instant-apps-measurement.entry.js +4 -4
- package/dist/esm/instant-apps-popover.entry.js +3 -3
- package/dist/esm/instant-apps-scoreboard.entry.js +3 -3
- package/dist/esm/instant-apps-splash.entry.js +14 -5
- package/dist/esm/{languageSwitcher-4faa659f.js → languageSwitcher-068998b1.js} +1 -1
- package/dist/esm/{languageUtil-dc3111c1.js → languageUtil-035e7728.js} +1 -1
- package/dist/esm/{loadModules-877bbb89.js → loadModules-7a5f1022.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{locale-bd9034e1.js → locale-4cab280d.js} +2 -2
- package/dist/esm/map-select-tools_3.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/esm/{utils-28d0a086.js → utils-78fe6e5b.js} +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-header/instant-apps-header.css +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-scoreboard/instant-apps-scoreboard.css +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-social-share/instant-apps-social-share.css +8 -1
- package/dist/solutions-components/{p-a455c3f0.entry.js → p-00524417.entry.js} +1 -1
- package/dist/solutions-components/{p-8e9f96db.js → p-12a7d0d1.js} +1 -1
- package/dist/solutions-components/{p-a7b7f8d1.js → p-15a0e7fb.js} +1 -1
- package/dist/solutions-components/{p-b41e2c4c.js → p-1d3a1794.js} +11 -11
- package/dist/solutions-components/p-2d72eac3.entry.js +6 -0
- package/dist/solutions-components/{p-a2544cba.entry.js → p-30edeb79.entry.js} +1 -1
- package/dist/solutions-components/{p-220c46c2.entry.js → p-3a6a1ce9.entry.js} +1 -1
- package/dist/solutions-components/{p-a59078ee.entry.js → p-3b9e4882.entry.js} +1 -1
- package/dist/solutions-components/{p-8ad937b4.entry.js → p-465aa7d9.entry.js} +1 -1
- package/dist/solutions-components/p-4dcc150d.entry.js +6 -0
- package/dist/solutions-components/{p-1bca71bf.entry.js → p-4efd2af6.entry.js} +1 -1
- package/dist/solutions-components/{p-5a28d60c.entry.js → p-5320dc25.entry.js} +1 -1
- package/dist/solutions-components/{p-734d1dc5.js → p-590a2a26.js} +1 -1
- package/dist/solutions-components/{p-0d72a9ca.entry.js → p-5f6e7429.entry.js} +1 -1
- package/dist/solutions-components/{p-015a45e2.entry.js → p-65ad1625.entry.js} +1 -1
- package/dist/solutions-components/{p-2e7a9b9b.entry.js → p-88932d2f.entry.js} +2 -2
- package/dist/solutions-components/{p-104f07e3.entry.js → p-954dc86f.entry.js} +1 -1
- package/dist/solutions-components/{p-52b37bad.entry.js → p-989bf0bf.entry.js} +1 -1
- package/dist/solutions-components/{p-0f427774.entry.js → p-a0611720.entry.js} +1 -1
- package/dist/solutions-components/{p-c302bbea.entry.js → p-a3132356.entry.js} +1 -1
- package/dist/solutions-components/{p-c10b44ee.entry.js → p-a886ab7f.entry.js} +1 -1
- package/dist/solutions-components/{p-03037cf9.js → p-ad98c346.js} +1 -1
- package/dist/solutions-components/{p-03a65871.entry.js → p-bf6b4eb7.entry.js} +1 -1
- package/dist/solutions-components/{p-09801ba6.entry.js → p-c4ff3b52.entry.js} +3 -3
- package/dist/solutions-components/p-d599cfa8.entry.js +6 -0
- package/dist/solutions-components/{p-cfe890f6.entry.js → p-f313b45b.entry.js} +1 -1
- package/dist/solutions-components/{p-aec4441b.entry.js → p-fc1367d9.entry.js} +1 -1
- package/dist/solutions-components/{p-07626c45.js → p-fc2fb61b.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +46 -7
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +40 -1
- package/dist/types/utils/downloadUtils.d.ts +18 -4
- package/package.json +6 -6
- package/dist/solutions-components/p-7d6ee026.entry.js +0 -6
- package/dist/solutions-components/p-b80bc5b9.entry.js +0 -6
- package/dist/solutions-components/p-dd45738e.entry.js +0 -6
- /package/dist/solutions-components/{p-70359c2b.js → p-89218b6e.js} +0 -0
- /package/dist/solutions-components/{p-090e0241.js → p-e85ba21c.js} +0 -0
@@ -37,7 +37,11 @@ import { queryRelated } from "@esri/arcgis-rest-feature-layer";
|
|
37
37
|
* @param exportInfos Key details about what to export (ids, layer, and selectionSetNames)
|
38
38
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
39
39
|
* all attributes are exported
|
40
|
-
* @param includeHeaderNames Add
|
40
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
41
|
+
* @param isCSVExport Indicates if the export is for a CSV file
|
42
|
+
* @param fields Fields to include in the export
|
43
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
44
|
+
* @param filterFields Indicates if fields should be filtered
|
41
45
|
* @returns selectionSetNames that will be used for export filenames
|
42
46
|
*/
|
43
47
|
export async function consolidateLabels(webmap, exportInfos, formatUsingLayerPopup = true, includeHeaderNames = false, isCSVExport = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -63,6 +67,9 @@ export async function consolidateLabels(webmap, exportInfos, formatUsingLayerPop
|
|
63
67
|
* all attributes are exported
|
64
68
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
65
69
|
* @param addColumnTitle Indicates if column headings should be included in output
|
70
|
+
* @param fields Fields to include in the export
|
71
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
72
|
+
* @param filterFields Indicates if fields should be filtered
|
66
73
|
* @returns Promise resolving when function is done
|
67
74
|
*/
|
68
75
|
export async function downloadCSV(webmap, exportInfos, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -304,6 +311,30 @@ export function _createFilename(selectionSetNames) {
|
|
304
311
|
const title = selectionSetNames.length > 0 ? selectionSetNames.join(", ") : "download";
|
305
312
|
return title;
|
306
313
|
}
|
314
|
+
/**
|
315
|
+
* Creates headings from a label format.
|
316
|
+
*
|
317
|
+
* @param labelFormat Format for label
|
318
|
+
* @returns A list of headings, with one heading for each line in the label format
|
319
|
+
*/
|
320
|
+
export function _extractHeaderNames(labelFormat) {
|
321
|
+
// Split the format into lines
|
322
|
+
const lines = labelFormat.split(lineSeparatorChar);
|
323
|
+
// Generate a header for each line
|
324
|
+
const headerNames = lines.map((line, i) => {
|
325
|
+
// Find the field names in the line
|
326
|
+
const fieldNameSyms = line.match(/\{[^\}]*\}/g);
|
327
|
+
// Extract the field names from the symbols; if there are no symbols, use a default name; if a field name
|
328
|
+
// is an Arcade expression, extract the expression name
|
329
|
+
return fieldNameSyms
|
330
|
+
? fieldNameSyms
|
331
|
+
.map(fieldName => fieldName.substring(1, fieldName.length - 1))
|
332
|
+
.map(fieldName => fieldName.startsWith("expression/") ? fieldName.substring(fieldName.indexOf("/") + 1) : fieldName)
|
333
|
+
.join("__")
|
334
|
+
: `column_${i + 1}`;
|
335
|
+
});
|
336
|
+
return headerNames;
|
337
|
+
}
|
307
338
|
/**
|
308
339
|
* Extracts Arcade expression references from the lines of a label format.
|
309
340
|
*
|
@@ -437,7 +468,7 @@ export async function _getLabelFormat(webmap, layer, formatUsingLayerPopup) {
|
|
437
468
|
webmapLayers = webmapLayers.filter((webmapLayer) => webmapLayer.type === "feature" && webmapLayer.layerId === layerRelationship.relatedTableId);
|
438
469
|
if (webmapLayers.length > 0) {
|
439
470
|
labelFormatProps = await _getLabelFormat(webmap, webmapLayers[0], formatUsingLayerPopup);
|
440
|
-
labelFormatProps.relationshipId = relationshipId;
|
471
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
441
472
|
}
|
442
473
|
else {
|
443
474
|
// Related layer info is not in webmap; get the label info from the related layer
|
@@ -475,7 +506,7 @@ export async function _getLabelFormat(webmap, layer, formatUsingLayerPopup) {
|
|
475
506
|
}
|
476
507
|
else {
|
477
508
|
labelFormatProps = await labelFormatPropsPromise;
|
478
|
-
labelFormatProps.relationshipId = relationshipId;
|
509
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
479
510
|
}
|
480
511
|
}
|
481
512
|
}
|
@@ -602,7 +633,7 @@ export function _prepareAttributeValue(attributeValue, attributeType, attributeD
|
|
602
633
|
* @param ids List of ids to download
|
603
634
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
604
635
|
* all attributes are exported
|
605
|
-
* @param includeHeaderNames Add
|
636
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
606
637
|
* @returns Promise resolving when function is done
|
607
638
|
*/
|
608
639
|
export async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup = true, includeHeaderNames = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -707,7 +738,7 @@ export async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup =
|
|
707
738
|
* @param featureSet Features to convert to labels
|
708
739
|
* @param attributeTypes Type for each attribute in a feature
|
709
740
|
* @param attributeDomains Domains for each attribute in a feature
|
710
|
-
* @param includeHeaderNames Add
|
741
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
711
742
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
712
743
|
*/
|
713
744
|
export async function _prepareLabelsFromAll(featureSet, attributeTypes, attributeDomains, includeHeaderNames = false, useFieldAliasNames = false) {
|
@@ -744,7 +775,7 @@ export async function _prepareLabelsFromAll(featureSet, attributeTypes, attribut
|
|
744
775
|
* @param attributeDomains Domains for each attribute in a feature
|
745
776
|
* @param attributeFormats Formats for each attribute in a feature
|
746
777
|
* @param labelFormat Format for label
|
747
|
-
* @param includeHeaderNames Add
|
778
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
748
779
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
749
780
|
*/
|
750
781
|
export async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
@@ -784,7 +815,7 @@ export async function _prepareLabelsFromPattern(layer, featureSet, attributeOrig
|
|
784
815
|
}));
|
785
816
|
// Add header names
|
786
817
|
if (includeHeaderNames) {
|
787
|
-
labels.unshift(
|
818
|
+
labels.unshift(_extractHeaderNames(labelFormat));
|
788
819
|
}
|
789
820
|
return Promise.resolve(labels);
|
790
821
|
}
|
@@ -117,7 +117,11 @@ import {
|
|
117
117
|
* @param exportInfos Key details about what to export (ids, layer, and selectionSetNames)
|
118
118
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
119
119
|
* all attributes are exported
|
120
|
-
* @param includeHeaderNames Add
|
120
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
121
|
+
* @param isCSVExport Indicates if the export is for a CSV file
|
122
|
+
* @param fields Fields to include in the export
|
123
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
124
|
+
* @param filterFields Indicates if fields should be filtered
|
121
125
|
* @returns selectionSetNames that will be used for export filenames
|
122
126
|
*/
|
123
127
|
export async function consolidateLabels(
|
@@ -156,6 +160,9 @@ export async function consolidateLabels(
|
|
156
160
|
* all attributes are exported
|
157
161
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
158
162
|
* @param addColumnTitle Indicates if column headings should be included in output
|
163
|
+
* @param fields Fields to include in the export
|
164
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
165
|
+
* @param filterFields Indicates if fields should be filtered
|
159
166
|
* @returns Promise resolving when function is done
|
160
167
|
*/
|
161
168
|
export async function downloadCSV(
|
@@ -472,6 +479,38 @@ export function _createFilename(
|
|
472
479
|
return title;
|
473
480
|
}
|
474
481
|
|
482
|
+
/**
|
483
|
+
* Creates headings from a label format.
|
484
|
+
*
|
485
|
+
* @param labelFormat Format for label
|
486
|
+
* @returns A list of headings, with one heading for each line in the label format
|
487
|
+
*/
|
488
|
+
export function _extractHeaderNames(
|
489
|
+
labelFormat: string
|
490
|
+
): string[] {
|
491
|
+
// Split the format into lines
|
492
|
+
const lines = labelFormat.split(lineSeparatorChar);
|
493
|
+
|
494
|
+
// Generate a header for each line
|
495
|
+
const headerNames = lines.map(
|
496
|
+
(line, i) => {
|
497
|
+
// Find the field names in the line
|
498
|
+
const fieldNameSyms = line.match(/\{[^\}]*\}/g);
|
499
|
+
|
500
|
+
// Extract the field names from the symbols; if there are no symbols, use a default name; if a field name
|
501
|
+
// is an Arcade expression, extract the expression name
|
502
|
+
return fieldNameSyms
|
503
|
+
? fieldNameSyms
|
504
|
+
.map(fieldName => fieldName.substring(1, fieldName.length - 1))
|
505
|
+
.map(fieldName => fieldName.startsWith("expression/") ? fieldName.substring(fieldName.indexOf("/") + 1) : fieldName)
|
506
|
+
.join("__")
|
507
|
+
: `column_${i + 1}`;
|
508
|
+
}
|
509
|
+
);
|
510
|
+
|
511
|
+
return headerNames;
|
512
|
+
}
|
513
|
+
|
475
514
|
/**
|
476
515
|
* Extracts Arcade expression references from the lines of a label format.
|
477
516
|
*
|
@@ -647,7 +686,7 @@ export async function _getLabelFormat(
|
|
647
686
|
|
648
687
|
if (webmapLayers.length > 0) {
|
649
688
|
labelFormatProps = await _getLabelFormat(webmap, webmapLayers[0], formatUsingLayerPopup);
|
650
|
-
labelFormatProps.relationshipId = relationshipId;
|
689
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
651
690
|
|
652
691
|
} else {
|
653
692
|
// Related layer info is not in webmap; get the label info from the related layer
|
@@ -694,7 +733,7 @@ export async function _getLabelFormat(
|
|
694
733
|
labelFormatProps.labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos);
|
695
734
|
} else {
|
696
735
|
labelFormatProps = await labelFormatPropsPromise;
|
697
|
-
labelFormatProps.relationshipId = relationshipId;
|
736
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
698
737
|
}
|
699
738
|
}
|
700
739
|
|
@@ -836,7 +875,7 @@ export function _prepareAttributeValue(
|
|
836
875
|
* @param ids List of ids to download
|
837
876
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
838
877
|
* all attributes are exported
|
839
|
-
* @param includeHeaderNames Add
|
878
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
840
879
|
* @returns Promise resolving when function is done
|
841
880
|
*/
|
842
881
|
export async function _prepareLabels(
|
@@ -973,7 +1012,7 @@ export async function _prepareLabels(
|
|
973
1012
|
* @param featureSet Features to convert to labels
|
974
1013
|
* @param attributeTypes Type for each attribute in a feature
|
975
1014
|
* @param attributeDomains Domains for each attribute in a feature
|
976
|
-
* @param includeHeaderNames Add
|
1015
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
977
1016
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
978
1017
|
*/
|
979
1018
|
export async function _prepareLabelsFromAll(
|
@@ -1025,7 +1064,7 @@ export async function _prepareLabelsFromAll(
|
|
1025
1064
|
* @param attributeDomains Domains for each attribute in a feature
|
1026
1065
|
* @param attributeFormats Formats for each attribute in a feature
|
1027
1066
|
* @param labelFormat Format for label
|
1028
|
-
* @param includeHeaderNames Add
|
1067
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
1029
1068
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
1030
1069
|
*/
|
1031
1070
|
export async function _prepareLabelsFromPattern(
|
@@ -1089,7 +1128,7 @@ export async function _prepareLabelsFromPattern(
|
|
1089
1128
|
|
1090
1129
|
// Add header names
|
1091
1130
|
if (includeHeaderNames) {
|
1092
|
-
labels.unshift(
|
1131
|
+
labels.unshift(_extractHeaderNames(labelFormat));
|
1093
1132
|
}
|
1094
1133
|
|
1095
1134
|
return Promise.resolve(labels);
|
@@ -189,9 +189,41 @@ describe("downloadUtils", () => {
|
|
189
189
|
expect(title).toEqual(expectedTitle);
|
190
190
|
});
|
191
191
|
});
|
192
|
+
describe("_extractHeaderNames", () => {
|
193
|
+
it("handles a single-line label", () => {
|
194
|
+
const labelSpec = "{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
195
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
196
|
+
const expectedHeaderNames = ["PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
197
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
198
|
+
});
|
199
|
+
it("handles a multi-line label", () => {
|
200
|
+
const labelSpec = "{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
201
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
202
|
+
const expectedHeaderNames = ["OWNERNM1", "PSTLADDRESS", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
203
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
204
|
+
});
|
205
|
+
it("handles a multi-line label with a line without attributes", () => {
|
206
|
+
const labelSpec = "{OWNERNM1}|Line without attributes|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
207
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
208
|
+
const expectedHeaderNames = ["OWNERNM1", "column_2", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
209
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
210
|
+
});
|
211
|
+
it("handles a label with an Arcade expression", () => {
|
212
|
+
const labelSpec = "{expression/expr0}|{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
213
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
214
|
+
const expectedHeaderNames = ["expr0", "OWNERNM1", "PSTLADDRESS", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
215
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
216
|
+
});
|
217
|
+
it("handles a label with multiple Arcade expressions", () => {
|
218
|
+
const labelSpec = "{expression/expr3}: {expression/expr1}|{OWNERNM1}|{expression/expr0}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
219
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
220
|
+
const expectedHeaderNames = ["expr3__expr1", "OWNERNM1", "expr0", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
221
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
222
|
+
});
|
223
|
+
});
|
192
224
|
describe("_getExpressionsFromLabel", () => {
|
193
225
|
it("handles a label with ASCII expression names", () => {
|
194
|
-
const labelSpec = "{expression/expr0}
|
226
|
+
const labelSpec = "{expression/expr0}|{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
195
227
|
const expectedExpressions = ["{expression/expr0}"];
|
196
228
|
const expressions = downloadUtils._getExpressionsFromLabel(labelSpec);
|
197
229
|
expect(expressions).toEqual(expectedExpressions);
|
@@ -251,10 +251,49 @@ describe("downloadUtils", () => {
|
|
251
251
|
|
252
252
|
});
|
253
253
|
|
254
|
+
describe("_extractHeaderNames", () => {
|
255
|
+
|
256
|
+
it("handles a single-line label", () => {
|
257
|
+
const labelSpec = "{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
258
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
259
|
+
const expectedHeaderNames = ["PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
260
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
261
|
+
});
|
262
|
+
|
263
|
+
it("handles a multi-line label", () => {
|
264
|
+
const labelSpec = "{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
265
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
266
|
+
const expectedHeaderNames = ["OWNERNM1", "PSTLADDRESS", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
267
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
268
|
+
});
|
269
|
+
|
270
|
+
it("handles a multi-line label with a line without attributes", () => {
|
271
|
+
const labelSpec = "{OWNERNM1}|Line without attributes|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
272
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
273
|
+
const expectedHeaderNames = ["OWNERNM1", "column_2", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
274
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
275
|
+
});
|
276
|
+
|
277
|
+
it("handles a label with an Arcade expression", () => {
|
278
|
+
const labelSpec = "{expression/expr0}|{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
279
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
280
|
+
const expectedHeaderNames = ["expr0", "OWNERNM1", "PSTLADDRESS", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
281
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
282
|
+
});
|
283
|
+
|
284
|
+
it("handles a label with multiple Arcade expressions", () => {
|
285
|
+
const labelSpec = "{expression/expr3}: {expression/expr1}|{OWNERNM1}|{expression/expr0}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
286
|
+
const headerNames = downloadUtils._extractHeaderNames(labelSpec);
|
287
|
+
const expectedHeaderNames = ["expr3__expr1", "OWNERNM1", "expr0", "PSTLCITY__PSTLSTATE__PSTLZIP5"];
|
288
|
+
expect(headerNames).toEqual(expectedHeaderNames);
|
289
|
+
});
|
290
|
+
|
291
|
+
});
|
292
|
+
|
254
293
|
describe("_getExpressionsFromLabel", () => {
|
255
294
|
|
256
295
|
it("handles a label with ASCII expression names", () => {
|
257
|
-
const labelSpec = "{expression/expr0}
|
296
|
+
const labelSpec = "{expression/expr0}|{OWNERNM1}|{PSTLADDRESS}|{PSTLCITY}, {PSTLSTATE} {PSTLZIP5}";
|
258
297
|
const expectedExpressions = ["{expression/expr0}"];
|
259
298
|
const expressions = downloadUtils._getExpressionsFromLabel(labelSpec);
|
260
299
|
expect(expressions).toEqual(expectedExpressions);
|
@@ -2359,7 +2359,11 @@ const lineSeparatorChar = "|";
|
|
2359
2359
|
* @param exportInfos Key details about what to export (ids, layer, and selectionSetNames)
|
2360
2360
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
2361
2361
|
* all attributes are exported
|
2362
|
-
* @param includeHeaderNames Add
|
2362
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
2363
|
+
* @param isCSVExport Indicates if the export is for a CSV file
|
2364
|
+
* @param fields Fields to include in the export
|
2365
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
2366
|
+
* @param filterFields Indicates if fields should be filtered
|
2363
2367
|
* @returns selectionSetNames that will be used for export filenames
|
2364
2368
|
*/
|
2365
2369
|
async function consolidateLabels(webmap, exportInfos, formatUsingLayerPopup = true, includeHeaderNames = false, isCSVExport = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -2385,6 +2389,9 @@ async function consolidateLabels(webmap, exportInfos, formatUsingLayerPopup = tr
|
|
2385
2389
|
* all attributes are exported
|
2386
2390
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
2387
2391
|
* @param addColumnTitle Indicates if column headings should be included in output
|
2392
|
+
* @param fields Fields to include in the export
|
2393
|
+
* @param useFieldAliasNames Indicates if field alias names should be used in the export
|
2394
|
+
* @param filterFields Indicates if fields should be filtered
|
2388
2395
|
* @returns Promise resolving when function is done
|
2389
2396
|
*/
|
2390
2397
|
async function downloadCSV(webmap, exportInfos, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -2623,6 +2630,30 @@ function _createFilename(selectionSetNames) {
|
|
2623
2630
|
const title = selectionSetNames.length > 0 ? selectionSetNames.join(", ") : "download";
|
2624
2631
|
return title;
|
2625
2632
|
}
|
2633
|
+
/**
|
2634
|
+
* Creates headings from a label format.
|
2635
|
+
*
|
2636
|
+
* @param labelFormat Format for label
|
2637
|
+
* @returns A list of headings, with one heading for each line in the label format
|
2638
|
+
*/
|
2639
|
+
function _extractHeaderNames(labelFormat) {
|
2640
|
+
// Split the format into lines
|
2641
|
+
const lines = labelFormat.split(lineSeparatorChar);
|
2642
|
+
// Generate a header for each line
|
2643
|
+
const headerNames = lines.map((line, i) => {
|
2644
|
+
// Find the field names in the line
|
2645
|
+
const fieldNameSyms = line.match(/\{[^\}]*\}/g);
|
2646
|
+
// Extract the field names from the symbols; if there are no symbols, use a default name; if a field name
|
2647
|
+
// is an Arcade expression, extract the expression name
|
2648
|
+
return fieldNameSyms
|
2649
|
+
? fieldNameSyms
|
2650
|
+
.map(fieldName => fieldName.substring(1, fieldName.length - 1))
|
2651
|
+
.map(fieldName => fieldName.startsWith("expression/") ? fieldName.substring(fieldName.indexOf("/") + 1) : fieldName)
|
2652
|
+
.join("__")
|
2653
|
+
: `column_${i + 1}`;
|
2654
|
+
});
|
2655
|
+
return headerNames;
|
2656
|
+
}
|
2626
2657
|
/**
|
2627
2658
|
* Extracts Arcade expression references from the lines of a label format.
|
2628
2659
|
*
|
@@ -2756,7 +2787,7 @@ async function _getLabelFormat(webmap, layer, formatUsingLayerPopup) {
|
|
2756
2787
|
webmapLayers = webmapLayers.filter((webmapLayer) => webmapLayer.type === "feature" && webmapLayer.layerId === layerRelationship.relatedTableId);
|
2757
2788
|
if (webmapLayers.length > 0) {
|
2758
2789
|
labelFormatProps = await _getLabelFormat(webmap, webmapLayers[0], formatUsingLayerPopup);
|
2759
|
-
labelFormatProps.relationshipId = relationshipId;
|
2790
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
2760
2791
|
}
|
2761
2792
|
else {
|
2762
2793
|
// Related layer info is not in webmap; get the label info from the related layer
|
@@ -2794,7 +2825,7 @@ async function _getLabelFormat(webmap, layer, formatUsingLayerPopup) {
|
|
2794
2825
|
}
|
2795
2826
|
else {
|
2796
2827
|
labelFormatProps = await labelFormatPropsPromise;
|
2797
|
-
labelFormatProps.relationshipId = relationshipId;
|
2828
|
+
labelFormatProps.relationshipId = relationshipId.toString();
|
2798
2829
|
}
|
2799
2830
|
}
|
2800
2831
|
}
|
@@ -2921,7 +2952,7 @@ function _prepareAttributeValue(attributeValue, attributeType, attributeDomain,
|
|
2921
2952
|
* @param ids List of ids to download
|
2922
2953
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
2923
2954
|
* all attributes are exported
|
2924
|
-
* @param includeHeaderNames Add
|
2955
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
2925
2956
|
* @returns Promise resolving when function is done
|
2926
2957
|
*/
|
2927
2958
|
async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup = true, includeHeaderNames = false, fields = undefined, useFieldAliasNames = false, filterFields = false) {
|
@@ -3026,7 +3057,7 @@ async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup = true,
|
|
3026
3057
|
* @param featureSet Features to convert to labels
|
3027
3058
|
* @param attributeTypes Type for each attribute in a feature
|
3028
3059
|
* @param attributeDomains Domains for each attribute in a feature
|
3029
|
-
* @param includeHeaderNames Add
|
3060
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
3030
3061
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
3031
3062
|
*/
|
3032
3063
|
async function _prepareLabelsFromAll(featureSet, attributeTypes, attributeDomains, includeHeaderNames = false, useFieldAliasNames = false) {
|
@@ -3063,7 +3094,7 @@ async function _prepareLabelsFromAll(featureSet, attributeTypes, attributeDomain
|
|
3063
3094
|
* @param attributeDomains Domains for each attribute in a feature
|
3064
3095
|
* @param attributeFormats Formats for each attribute in a feature
|
3065
3096
|
* @param labelFormat Format for label
|
3066
|
-
* @param includeHeaderNames Add
|
3097
|
+
* @param includeHeaderNames Add a heading entries at the beginning of the list of generated labels
|
3067
3098
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
3068
3099
|
*/
|
3069
3100
|
async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
@@ -3103,7 +3134,7 @@ async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames,
|
|
3103
3134
|
}));
|
3104
3135
|
// Add header names
|
3105
3136
|
if (includeHeaderNames) {
|
3106
|
-
labels.unshift(
|
3137
|
+
labels.unshift(_extractHeaderNames(labelFormat));
|
3107
3138
|
}
|
3108
3139
|
return Promise.resolve(labels);
|
3109
3140
|
}
|
@@ -167,7 +167,7 @@ const printStyling = `
|
|
167
167
|
}
|
168
168
|
|
169
169
|
.instant-apps-export-print .esri-legend--card__service-caption-text {
|
170
|
-
padding-bottom:
|
170
|
+
padding-bottom: 4px;
|
171
171
|
}
|
172
172
|
|
173
173
|
.instant-apps-export-print__compass-container {
|
@@ -602,8 +602,10 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
602
602
|
}
|
603
603
|
}
|
604
604
|
handleLegendSetup() {
|
605
|
+
var _a;
|
605
606
|
if (this.showIncludeLegend && this.view != null && this.includeMap && this.legendContainerEl != null) {
|
606
|
-
this.
|
607
|
+
const hasActiveLayers = this.legend != null && ((_a = this.legend.activeLayerInfos) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
608
|
+
this.legendContainerEl.style.display = this.includeLegend && hasActiveLayers ? 'block' : 'none';
|
607
609
|
}
|
608
610
|
}
|
609
611
|
handleWidgetCreation() {
|
@@ -611,11 +613,11 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
611
613
|
this.handleCompassCreation();
|
612
614
|
}
|
613
615
|
handleLegendCreation() {
|
614
|
-
var _a, _b, _c, _d;
|
616
|
+
var _a, _b, _c, _d, _e;
|
615
617
|
if (this.includeMap && this.view != null && this.showIncludeLegend && this.legendContainerEl != null) {
|
616
618
|
const map = this.view.map;
|
617
619
|
const legendMap = (_b = (_a = this.legend) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.map;
|
618
|
-
const checkId = ((_c = map === null || map === void 0 ? void 0 : map.portalItem) === null || _c === void 0 ? void 0 : _c.id)
|
620
|
+
const checkId = ((_c = map === null || map === void 0 ? void 0 : map.portalItem) === null || _c === void 0 ? void 0 : _c.id) != null && ((_d = map === null || map === void 0 ? void 0 : map.portalItem) === null || _d === void 0 ? void 0 : _d.id) === ((_e = legendMap === null || legendMap === void 0 ? void 0 : legendMap.portalItem) === null || _e === void 0 ? void 0 : _e.id);
|
619
621
|
if (!checkId) {
|
620
622
|
this.updateLegend();
|
621
623
|
}
|
@@ -624,13 +626,17 @@ const InstantAppsExport$1 = /*@__PURE__*/ proxyCustomElement(class InstantAppsEx
|
|
624
626
|
updateLegend() {
|
625
627
|
var _a;
|
626
628
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.when(async (view) => {
|
627
|
-
|
628
|
-
|
629
|
+
if (this.legend != null) {
|
630
|
+
this.legend.destroy();
|
631
|
+
this.legend = null;
|
632
|
+
}
|
629
633
|
if (this.legendContainerEl != null) {
|
630
634
|
this.legendContainerEl.innerHTML = '';
|
635
|
+
const legendCont = document.createElement('div');
|
636
|
+
this.legendContainerEl.append(legendCont);
|
631
637
|
const [Legend] = await loadModules(['esri/widgets/Legend']);
|
632
638
|
this.legend = new Legend({
|
633
|
-
container:
|
639
|
+
container: legendCont,
|
634
640
|
view,
|
635
641
|
style: {
|
636
642
|
type: 'card',
|
@@ -84,7 +84,7 @@ const InstantAppsLandingPage$1 = /*@__PURE__*/ proxyCustomElement(class InstantA
|
|
84
84
|
fontFamily,
|
85
85
|
};
|
86
86
|
return (h("div", { style: this.backgroundImageSrc
|
87
|
-
? Object.assign(Object.assign({}, style), { backgroundSize: 'cover', backgroundImage: `url("${this.backgroundImageSrc}")`, backgroundRepeat: 'no-repeat' }) : style, class: `${CSS.BASE}${alignmentClass}${closed}${removeTransition}` }, h("div", { class: CSS.contentContainer }, this.renderIconImage(), this.renderTitleText(), this.renderSubtitleText(), this.renderDescriptionText()), h("div", { class: CSS.buttonContainer }, this.renderEntryButton(), h("slot", { name: "secondary-action" }))));
|
87
|
+
? Object.assign(Object.assign({}, style), { backgroundSize: 'cover', backgroundImage: `url("${this.backgroundImageSrc}")`, backgroundRepeat: 'no-repeat', backgroundPosition: 'center' }) : style, class: `${CSS.BASE}${alignmentClass}${closed}${removeTransition}` }, h("div", { class: CSS.contentContainer }, this.renderIconImage(), this.renderTitleText(), this.renderSubtitleText(), this.renderDescriptionText()), h("div", { class: CSS.buttonContainer }, this.renderEntryButton(), h("slot", { name: "secondary-action" }))));
|
88
88
|
}
|
89
89
|
renderIconImage() {
|
90
90
|
return this.iconImage ? h("img", { class: `${CSS.iconImage}${this.getIconImageScale()}`, src: this.iconImage, alt: this.iconImageAltText }) : null;
|
@@ -51,7 +51,7 @@ const InstantAppsMeasurement$1 = /*@__PURE__*/ proxyCustomElement(class InstantA
|
|
51
51
|
}
|
52
52
|
renderActionPad() {
|
53
53
|
const { messages, activeToolType } = this;
|
54
|
-
return (h("calcite-action-pad", { "expand-disabled": true, layout: "horizontal", position: "end" }, h("calcite-action", { class: activeToolType === 'distance' ? 'active-tool' :
|
54
|
+
return (h("calcite-action-pad", { "expand-disabled": true, layout: "horizontal", position: "end" }, h("calcite-action", { class: activeToolType === 'distance' ? 'active-tool' : '', text: messages === null || messages === void 0 ? void 0 : messages.line, icon: "measure", scale: "m", "data-value": "distance", onClick: this._handleToolClick.bind(this) }, h("calcite-tooltip", { "close-on-click": true, placement: "bottom", slot: "tooltip" }, messages === null || messages === void 0 ? void 0 : messages.line)), h("calcite-action", { class: activeToolType === 'area' ? 'active-tool' : '', text: messages === null || messages === void 0 ? void 0 : messages.area, scale: "m", icon: "measure-area", "data-value": "area", onClick: this._handleToolClick.bind(this) }, h("calcite-tooltip", { "close-on-click": true, placement: "bottom", slot: "tooltip" }, messages === null || messages === void 0 ? void 0 : messages.area)), h("calcite-action", { class: activeToolType === 'point' ? 'active-tool' : '', text: messages === null || messages === void 0 ? void 0 : messages.point, scale: "m", icon: "pin-plus", "data-value": "point", onClick: this._handleToolClick.bind(this) }, h("calcite-tooltip", { "close-on-click": true, placement: "bottom", slot: "tooltip" }, messages === null || messages === void 0 ? void 0 : messages.point)), h("calcite-action", { text: messages === null || messages === void 0 ? void 0 : messages.clear, scale: "m", icon: "trash", "data-value": "clear", onClick: this._handleToolClick.bind(this) }, h("calcite-tooltip", { "close-on-click": true, placement: "bottom", slot: "tooltip" }, messages === null || messages === void 0 ? void 0 : messages.clear))));
|
55
55
|
}
|
56
56
|
_handleToolClick(e) {
|
57
57
|
var _a, _b, _c, _d;
|
@@ -12,9 +12,10 @@ import { d as defineCustomElement$3 } from './icon.js';
|
|
12
12
|
import { d as defineCustomElement$2 } from './loader.js';
|
13
13
|
import { d as defineCustomElement$1 } from './popover.js';
|
14
14
|
|
15
|
-
const instantAppsSocialShareCss = ":host{display:block;--instant-apps-social-share-action-width:initial;--instant-apps-social-share-width--s:200px;--instant-apps-social-share-width--m:280px;--instant-apps-social-share-width--l:320px;--instant-apps-social-share-width-horizontal--s:300px;--instant-apps-social-share-width-horizontal--m:380px;--instant-apps-social-share-width-horizontal--l:420px;--instant-apps-social-share-background-color:var(--calcite-color-foreground-1);--instant-apps-social-share-popover-button-background-color:transparent;--instant-apps-social-share-popover-button-icon-color:var(--calcite-ui-icon-color);--instant-apps-social-share-embed-border:1px solid $border;--instant-apps-social-share-embed-text-area-text:#468540}:host .instant-apps-social-share__popover-button{background-color:var(--instant-apps-social-share-popover-button-background-color)}:host .instant-apps-social-share__popover-button calcite-icon{color:var(--instant-apps-social-share-popover-button-icon-color)}:host .instant-apps-social-share__dialog,:host .instant-apps-social-share__dialog-embed{background-color:var(--instant-apps-social-share-background-color);border:var(--instant-apps-social-share-embed-border)}:host .instant-apps-social-share__dialog{box-sizing:border-box;height:auto;padding:10px 0;border-radius:5px}:host .instant-apps-social-share__options{margin:0;padding:1% 0 0 0;list-style-type:none}:host .instant-apps-social-share__options li{box-sizing:border-box;display:flex;align-items:center;width:100%;padding:5%;transition:background-color 0.15s ease-out 0s}:host .instant-apps-social-share__options li .instant-apps-social-share__icon,:host .instant-apps-social-share__options li .instant-apps-social-share__option-text{display:inline-block}:host .instant-apps-social-share__options li .instant-apps-social-share__icon{display:flex;align-items:center}:host .instant-apps-social-share__options li .instant-apps-social-share__option-text{width:85%;margin-left:10px;word-break:break-word}:host .instant-apps-social-share__options li .instant-apps-social-share__option-text--rtl{margin-left:0;margin-right:10px}:host .instant-apps-social-share__options li:hover{cursor:pointer;background-color:var(--calcite-color-foreground-2)}:host .instant-apps-social-share__tip{box-sizing:border-box;padding:0 5% 1% 5%}:host .instant-apps-social-share__tip-header{display:flex;align-items:center;color:#007ac2;margin:8px 0 5px 0}:host .instant-apps-social-share__tip-header calcite-icon{margin-right:5px}:host .instant-apps-social-share__tip-content{line-height:17px;margin:0;padding-top:2%}:host .instant-apps-social-share__success{display:flex;flex-direction:column;padding:15px}:host .instant-apps-social-share__success-header{display:flex;align-items:center;font-weight:bold;margin-bottom:10px}:host .instant-apps-social-share__success-icon{display:flex;align-items:center;margin-right:5px}:host .instant-apps-social-share__success-icon calcite-icon{color:var(--calcite-color-status-success)}:host .instant-apps-social-share__success-message{line-height:16px}:host .instant-apps-social-share__embed{box-sizing:border-box;width:100%;padding:5%;margin-bottom:10px;border-top:1px solid #d3d3d3}:host .instant-apps-social-share__embed-header{display:flex;align-items:center;margin-bottom:5px}:host .instant-apps-social-share__embed-header calcite-icon{margin-right:5px}:host .instant-apps-social-share__embed-code-text-area{border:1px solid #d3d3d3}:host .instant-apps-social-share__embed-code-text-area textarea{box-sizing:border-box;padding:4%;border:none;resize:none;background:transparent;width:100%;font-family:var(--calcite-sans-family);color:var(--calcite-color-text-1)}:host .instant-apps-social-share__embed-code-text-area button{display:flex;align-items:center;text-align:start;width:100%;border:none;border-top:1px solid #d3d3d3;background-color:transparent;line-height:16px;font-weight:400;padding:3%;color:var(--calcite-color-text-1)}:host .instant-apps-social-share__embed-code-text-area button calcite-icon{color:#007ac2;margin-right:3px}:host .instant-apps-social-share__embed-code-text-area button:hover{cursor:pointer;background-color:var(--calcite-color-foreground-2);transition:background-color 0.15s ease-out 0s}:host .instant-apps-social-share__embed-text-area-text{font-weight:600;color:var(--instant-apps-social-share-embed-text-area-text)}:host .instant-apps-social-share__embed .instant-apps-social-share__text-area--rtl{text-align:left}:host .instant-apps-social-share__embed-dimensions{display:flex;justify-content:space-between;margin-top:10px}:host .instant-apps-social-share__embed-dimensions-input{width:47%;box-sizing:border-box}:host .instant-apps-social-share__embed-dimensions-input input{border:1px solid #d3d3d3;width:100%;height:25px;font-family:var(--calcite-sans-family)}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options{display:flex;justify-content:space-around;margin-bottom:8%}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li{flex-direction:column;padding:0}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li .instant-apps-social-share__option-text{word-break:break-word;margin-left:0;margin-top:10px;text-align:center}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li:hover{background-color:unset}:host .instant-apps-social-share__icon-container{display:flex;align-items:center}:host calcite-action{width:var(--instant-apps-social-share-action-width)}:host([scale=s]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--s)}:host([scale=s]) .instant-apps-social-share__icon{width:16px;height:16px}:host([scale=s]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size--1)}:host([scale=s]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--s)}:host([scale=s]) .instant-apps-social-share__tip-header,:host([scale=s]) .instant-apps-social-share__tip-content,:host([scale=s]) .instant-apps-social-share__embed-header,:host([scale=s]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size--2)}:host([scale=m]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--m)}:host([scale=m]) .instant-apps-social-share__icon{width:24px;height:24px}:host([scale=m]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size-0)}:host([scale=m]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--m)}:host([scale=m]) .instant-apps-social-share__tip-header,:host([scale=m]) .instant-apps-social-share__tip-content,:host([scale=m]) .instant-apps-social-share__embed-header,:host([scale=m]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size--1)}:host([scale=l]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--l)}:host([scale=l]) .instant-apps-social-share__icon{width:32px;height:32px}:host([scale=l]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size-1)}:host([scale=l]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--l)}:host([scale=l]) .instant-apps-social-share__tip-header,:host([scale=l]) .instant-apps-social-share__tip-content,:host([scale=l]) .instant-apps-social-share__embed-header,:host([scale=l]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size-0)}";
|
15
|
+
const instantAppsSocialShareCss = ":host{display:block;--instant-apps-social-share-action-width:initial;--instant-apps-social-share-width--s:200px;--instant-apps-social-share-width--m:280px;--instant-apps-social-share-width--l:320px;--instant-apps-social-share-width-horizontal--s:300px;--instant-apps-social-share-width-horizontal--m:380px;--instant-apps-social-share-width-horizontal--l:420px;--instant-apps-social-share-background-color:var(--calcite-color-foreground-1);--instant-apps-social-share-popover-button-background-color:transparent;--instant-apps-social-share-popover-button-icon-color:var(--calcite-ui-icon-color);--instant-apps-social-share-embed-border:1px solid $border;--instant-apps-social-share-embed-text-area-text:#468540}:host .instant-apps-social-share__popover-button{background-color:var(--instant-apps-social-share-popover-button-background-color)}:host .instant-apps-social-share__popover-button calcite-icon{color:var(--instant-apps-social-share-popover-button-icon-color)}:host .instant-apps-social-share__dialog,:host .instant-apps-social-share__dialog-embed{background-color:var(--instant-apps-social-share-background-color);border:var(--instant-apps-social-share-embed-border)}:host .instant-apps-social-share__dialog{box-sizing:border-box;height:auto;padding:10px 0;border-radius:5px}:host .instant-apps-social-share__options{margin:0;padding:1% 0 0 0;list-style-type:none}:host .instant-apps-social-share__options li{box-sizing:border-box;display:flex;align-items:center;width:100%;padding:5%;transition:background-color 0.15s ease-out 0s}:host .instant-apps-social-share__options li .instant-apps-social-share__icon,:host .instant-apps-social-share__options li .instant-apps-social-share__option-text{display:inline-block}:host .instant-apps-social-share__options li .instant-apps-social-share__icon{display:flex;align-items:center}:host .instant-apps-social-share__options li .instant-apps-social-share__option-text{width:85%;margin-left:10px;word-break:break-word}:host .instant-apps-social-share__options li .instant-apps-social-share__option-text--rtl{margin-left:0;margin-right:10px}:host .instant-apps-social-share__options li:hover{cursor:pointer;background-color:var(--calcite-color-foreground-2)}:host .instant-apps-social-share__options__x-logo--light path{fill:#000000}:host .instant-apps-social-share__options__x-logo--dark path{fill:#ffffff}:host .instant-apps-social-share__tip{box-sizing:border-box;padding:0 5% 1% 5%}:host .instant-apps-social-share__tip-header{display:flex;align-items:center;color:#007ac2;margin:8px 0 5px 0}:host .instant-apps-social-share__tip-header calcite-icon{margin-right:5px}:host .instant-apps-social-share__tip-content{line-height:17px;margin:0;padding-top:2%}:host .instant-apps-social-share__success{display:flex;flex-direction:column;padding:15px}:host .instant-apps-social-share__success-header{display:flex;align-items:center;font-weight:bold;margin-bottom:10px}:host .instant-apps-social-share__success-icon{display:flex;align-items:center;margin-right:5px}:host .instant-apps-social-share__success-icon calcite-icon{color:var(--calcite-color-status-success)}:host .instant-apps-social-share__success-message{line-height:16px}:host .instant-apps-social-share__embed{box-sizing:border-box;width:100%;padding:5%;margin-bottom:10px;border-top:1px solid #d3d3d3}:host .instant-apps-social-share__embed-header{display:flex;align-items:center;margin-bottom:5px}:host .instant-apps-social-share__embed-header calcite-icon{margin-right:5px}:host .instant-apps-social-share__embed-code-text-area{border:1px solid #d3d3d3}:host .instant-apps-social-share__embed-code-text-area textarea{box-sizing:border-box;padding:4%;border:none;resize:none;background:transparent;width:100%;font-family:var(--calcite-sans-family);color:var(--calcite-color-text-1)}:host .instant-apps-social-share__embed-code-text-area button{display:flex;align-items:center;text-align:start;width:100%;border:none;border-top:1px solid #d3d3d3;background-color:transparent;line-height:16px;font-weight:400;padding:3%;color:var(--calcite-color-text-1)}:host .instant-apps-social-share__embed-code-text-area button calcite-icon{color:#007ac2;margin-right:3px}:host .instant-apps-social-share__embed-code-text-area button:hover{cursor:pointer;background-color:var(--calcite-color-foreground-2);transition:background-color 0.15s ease-out 0s}:host .instant-apps-social-share__embed-text-area-text{font-weight:600;color:var(--instant-apps-social-share-embed-text-area-text)}:host .instant-apps-social-share__embed .instant-apps-social-share__text-area--rtl{text-align:left;direction:ltr}:host .instant-apps-social-share__embed-dimensions{display:flex;justify-content:space-between;margin-top:10px}:host .instant-apps-social-share__embed-dimensions-input{width:47%;box-sizing:border-box}:host .instant-apps-social-share__embed-dimensions-input input{border:1px solid #d3d3d3;width:100%;height:25px;font-family:var(--calcite-sans-family)}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options{display:flex;justify-content:space-around;margin-bottom:8%}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li{flex-direction:column;padding:0}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li .instant-apps-social-share__option-text{word-break:break-word;margin-left:0;margin-top:10px;text-align:center}:host .instant-apps-social-share__layout--horizontal .instant-apps-social-share__options li:hover{background-color:unset}:host .instant-apps-social-share__icon-container{display:flex;align-items:center}:host calcite-action{width:var(--instant-apps-social-share-action-width)}:host([scale=s]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--s)}:host([scale=s]) .instant-apps-social-share__icon{width:16px;height:16px}:host([scale=s]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size--1)}:host([scale=s]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--s)}:host([scale=s]) .instant-apps-social-share__tip-header,:host([scale=s]) .instant-apps-social-share__tip-content,:host([scale=s]) .instant-apps-social-share__embed-header,:host([scale=s]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size--2)}:host([scale=m]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--m)}:host([scale=m]) .instant-apps-social-share__icon{width:24px;height:24px}:host([scale=m]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size-0)}:host([scale=m]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--m)}:host([scale=m]) .instant-apps-social-share__tip-header,:host([scale=m]) .instant-apps-social-share__tip-content,:host([scale=m]) .instant-apps-social-share__embed-header,:host([scale=m]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size--1)}:host([scale=l]) .instant-apps-social-share__dialog{width:var(--instant-apps-social-share-width--l)}:host([scale=l]) .instant-apps-social-share__icon{width:32px;height:32px}:host([scale=l]) .instant-apps-social-share__option-text{font-size:var(--calcite-font-size-1)}:host([scale=l]) .instant-apps-social-share__dialog.instant-apps-social-share__layout--horizontal{width:var(--instant-apps-social-share-width-horizontal--l)}:host([scale=l]) .instant-apps-social-share__tip-header,:host([scale=l]) .instant-apps-social-share__tip-content,:host([scale=l]) .instant-apps-social-share__embed-header,:host([scale=l]) .instant-apps-social-share__embed-dimensions-input{font-size:var(--calcite-font-size-0)}";
|
16
16
|
|
17
17
|
const base = 'instant-apps-social-share';
|
18
|
+
const CALCITE_MODE_DARK = '.calcite-mode-dark';
|
18
19
|
const CSS = {
|
19
20
|
base,
|
20
21
|
dialog: `${base}__dialog`,
|
@@ -32,6 +33,10 @@ const CSS = {
|
|
32
33
|
vertical: `${base}__layout--vertical`,
|
33
34
|
horizontal: `${base}__layout--horizontal`,
|
34
35
|
},
|
36
|
+
xLogo: {
|
37
|
+
light: `${base}__x-logo--light`,
|
38
|
+
dark: `${base}__x-logo--dark`,
|
39
|
+
},
|
35
40
|
success: {
|
36
41
|
container: `${base}__success`,
|
37
42
|
header: `${base}__success-header`,
|
@@ -59,7 +64,7 @@ const CSS = {
|
|
59
64
|
};
|
60
65
|
const SOCIAL_URL_TEMPLATES = {
|
61
66
|
facebook: 'https://www.facebook.com/sharer/sharer.php?u={url}',
|
62
|
-
|
67
|
+
x: 'https://x.com/intent/post?url={url}',
|
63
68
|
linkedIn: 'https://www.linkedin.com/sharing/share-offsite/?url={url}',
|
64
69
|
};
|
65
70
|
const SHORTEN_API = 'https://arcg.is/prod/shorten';
|
@@ -240,7 +245,7 @@ const InstantAppsSocialShare = /*@__PURE__*/ proxyCustomElement(class InstantApp
|
|
240
245
|
return (h("ul", { ref: el => (this.shareListRef = el), class: CSS.options, role: "menu" }, h("li", { id: "copyToClipboard", onClick: this.handleShareItem.bind(this, 'link'), onKeyDown: this.handleOptionKeyDown('link'), role: "menuitem", tabindex: "0" }, h("span", { class: CSS.icon }, h("calcite-icon", { icon: "link", scale: this.scale })), h("span", { class: `${CSS.optionText}${optionText_RTL}` }, (_b = options === null || options === void 0 ? void 0 : options.link) === null || _b === void 0 ? void 0 : _b.label)), this.socialMedia
|
241
246
|
? [
|
242
247
|
h("li", { onClick: this.handleShareItem.bind(this, 'facebook'), onKeyDown: this.handleOptionKeyDown('facebook'), role: "menuitem", tabindex: "0" }, h("span", { class: CSS.icon }, this.renderFacebookIcon()), h("span", { class: `${CSS.optionText}${optionText_RTL}` }, (_c = options === null || options === void 0 ? void 0 : options.facebook) === null || _c === void 0 ? void 0 : _c.label)),
|
243
|
-
h("li", { onClick: this.handleShareItem.bind(this, '
|
248
|
+
h("li", { onClick: this.handleShareItem.bind(this, 'x'), onKeyDown: this.handleOptionKeyDown('x'), role: "menuitem", tabindex: "0" }, h("span", { class: CSS.icon }, this.renderXIcon()), h("span", { class: `${CSS.optionText}${optionText_RTL}` }, "X")),
|
244
249
|
h("li", { onClick: this.handleShareItem.bind(this, 'linkedIn'), onKeyDown: this.handleOptionKeyDown('linkedIn'), role: "menuitem", tabindex: "0" }, h("span", { class: CSS.icon }, this.renderLinkedInIcon()), h("span", { class: `${CSS.optionText}${optionText_RTL}` }, (_d = options === null || options === void 0 ? void 0 : options.linkedIn) === null || _d === void 0 ? void 0 : _d.label)),
|
245
250
|
]
|
246
251
|
: null));
|
@@ -257,8 +262,9 @@ const InstantAppsSocialShare = /*@__PURE__*/ proxyCustomElement(class InstantApp
|
|
257
262
|
renderFacebookIcon() {
|
258
263
|
return (h("svg", { height: "100%", style: { fillRule: 'evenodd', clipRule: 'evenodd', strokeLinejoin: 'round', strokeMiterlimit: '2' }, version: "1.1", viewBox: "0 0 512 512", width: "100%", xmlns: "http://www.w3.org/2000/svg" }, h("g", null, h("path", { d: "M512,256c0,-141.385 -114.615,-256 -256,-256c-141.385,0 -256,114.615 -256,256c0,127.777 93.616,233.685 216,252.89l0,-178.89l-65,0l0,-74l65,0l0,-56.4c0,-64.16 38.219,-99.6 96.695,-99.6c28.009,0 57.305,5 57.305,5l0,63l-32.281,0c-31.801,0 -41.719,19.733 -41.719,39.978l0,48.022l71,0l-11.35,74l-59.65,0l0,178.89c122.385,-19.205 216,-125.113 216,-252.89Z", style: { fill: '#1877f2', fillRule: 'nonzero' } }), h("path", { d: "M355.65,330l11.35,-74l-71,0l0,-48.022c0,-20.245 9.917,-39.978 41.719,-39.978l32.281,0l0,-63c0,0 -29.297,-5 -57.305,-5c-58.476,0 -96.695,35.44 -96.695,99.6l0,56.4l-65,0l0,74l65,0l0,178.89c13.033,2.045 26.392,3.11 40,3.11c13.608,0 26.966,-1.065 40,-3.11l0,-178.89l59.65,0Z", style: { fill: '#fff', fillRule: 'nonzero' } }))));
|
259
264
|
}
|
260
|
-
|
261
|
-
|
265
|
+
renderXIcon() {
|
266
|
+
const isCalciteModeDark = !!this.el.closest(CALCITE_MODE_DARK);
|
267
|
+
return (h("svg", { class: isCalciteModeDark ? CSS.xLogo.dark : CSS.xLogo.light, width: "1200", height: "1227", viewBox: "0 0 1200 1227", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("rect", { height: "400", style: { fill: 'none' }, width: "400", x: "56", y: "56" }), h("path", { d: "M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z", fill: isCalciteModeDark ? 'white' : 'black' })));
|
262
268
|
}
|
263
269
|
renderLinkedInIcon() {
|
264
270
|
return (h("svg", { height: "100%", style: { fillRule: 'evenodd', clipRule: 'evenodd', strokeLinejoin: 'round', strokeMiterlimit: '2' }, version: "1.1", viewBox: "0 0 512 512", width: "100%", xmlns: "http://www.w3.org/2000/svg" }, h("g", { id: "g5891" }, h("path", { d: "M512,64c0,-35.323 -28.677,-64 -64,-64l-384,0c-35.323,0 -64,28.677 -64,64l0,384c0,35.323 28.677,64 64,64l384,0c35.323,0 64,-28.677 64,-64l0,-384Z", id: "background", style: { fill: '#2867b2' } }), h("g", { id: "shapes" }, h("rect", { height: "257.962", id: "rect11", style: { fill: '#fff' }, width: "85.76", x: "61.053", y: "178.667" }), h("path", { d: "M104.512,54.28c-29.341,0 -48.512,19.29 -48.512,44.573c0,24.752 18.588,44.574 47.377,44.574l0.554,0c29.903,0 48.516,-19.822 48.516,-44.574c-0.555,-25.283 -18.611,-44.573 -47.935,-44.573Z", id: "path13-0", style: { fill: '#fff', fillRule: 'nonzero' } }), h("path", { d: "M357.278,172.601c-45.49,0 -65.866,25.017 -77.276,42.589l0,-36.523l-85.738,0c1.137,24.197 0,257.961 0,257.961l85.737,0l0,-144.064c0,-7.711 0.554,-15.42 2.827,-20.931c6.188,-15.4 20.305,-31.352 43.993,-31.352c31.012,0 43.436,23.664 43.436,58.327l0,138.02l85.741,0l0,-147.93c0,-79.237 -42.305,-116.097 -98.72,-116.097Z", id: "path15", style: { fill: '#fff', fillRule: 'nonzero' } })))));
|
@@ -324,7 +330,7 @@ const InstantAppsSocialShare = /*@__PURE__*/ proxyCustomElement(class InstantApp
|
|
324
330
|
setTimeout(() => this.closePopover(), 2000);
|
325
331
|
return;
|
326
332
|
case 'facebook':
|
327
|
-
case '
|
333
|
+
case 'x':
|
328
334
|
case 'linkedIn':
|
329
335
|
let socialWin;
|
330
336
|
if (isSafari) {
|
@@ -336,7 +342,7 @@ const InstantAppsSocialShare = /*@__PURE__*/ proxyCustomElement(class InstantApp
|
|
336
342
|
const urlData = {
|
337
343
|
url: encodeURI(urlToUse),
|
338
344
|
};
|
339
|
-
const data = type === '
|
345
|
+
const data = type === 'x' ? Object.assign(Object.assign({}, urlData), { text: this.shareText }) : urlData;
|
340
346
|
const [intl] = await loadModules(['esri/intl']);
|
341
347
|
const url = intl.substitute(SOCIAL_URL_TEMPLATES[type], data);
|
342
348
|
if (this.mode === 'popover') {
|