@esri/solutions-components 0.4.0 → 0.4.1
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.
- package/dist/assets/t9n/public-notification/resources.json +0 -2
- package/dist/assets/t9n/public-notification/resources_en.json +0 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +1342 -18
- package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-da276a1c.js → downloadUtils-27dbd8b9.js} +205 -1383
- package/dist/cjs/{index.es-176629d8.js → index.es-40d341ed.js} +3 -13
- package/dist/cjs/layer-table.cjs.entry.js +5 -15
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/layer-table/layer-table.js +4 -16
- package/dist/collection/components/map-search/map-search.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +42 -38
- package/dist/collection/components/pdf-download/pdf-download.js +9 -76
- package/dist/collection/components/public-notification/public-notification.js +3 -3
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/utils/csvUtils.js +4 -0
- package/dist/collection/utils/csvUtils.ts +7 -0
- package/dist/collection/utils/downloadUtils.js +181 -0
- package/dist/collection/utils/downloadUtils.ts +235 -0
- package/dist/collection/utils/interfaces.ts +3 -2
- package/dist/collection/utils/pdfUtils.js +7 -0
- package/dist/collection/utils/pdfUtils.ts +13 -2
- package/dist/components/downloadUtils.js +2279 -0
- package/dist/components/index.es.js +1 -1
- package/dist/components/layer-table.js +5 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-search.js +1 -1
- package/dist/components/map-select-tools2.js +44 -40
- package/dist/components/pdf-download2.js +10 -2124
- package/dist/components/public-notification.js +3 -3
- package/dist/components/queryUtils.js +1 -1
- package/dist/components/refine-selection-tools2.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +1 -1
- package/dist/esm/calcite-input-message_5.entry.js +1341 -13
- package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-c6f63458.js → downloadUtils-76e38a94.js} +206 -1381
- package/dist/esm/{index.es-54a6f3a3.js → index.es-489f4f08.js} +2 -12
- package/dist/esm/layer-table.entry.js +6 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mapViewUtils-63e118f8.js → mapViewUtils-02696ab6.js} +1 -1
- package/dist/esm/public-notification.entry.js +3 -3
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/{p-cc2e20c8.js → p-1bfd07e3.js} +1 -1
- package/dist/solutions-components/{p-117174e8.entry.js → p-335fce8c.entry.js} +1 -1
- package/dist/solutions-components/p-4ef94c6b.entry.js +6 -0
- package/dist/solutions-components/p-5d27b47d.entry.js +17 -0
- package/dist/solutions-components/p-92cb569a.entry.js +6 -0
- package/dist/solutions-components/{p-8a0c0935.entry.js → p-a3b60bc9.entry.js} +1 -1
- package/dist/solutions-components/{p-1e459361.js → p-bff8aa4e.js} +3 -3
- package/dist/solutions-components/p-caa7e7a7.js +437 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/csvUtils.ts +7 -0
- package/dist/solutions-components/utils/downloadUtils.ts +235 -0
- package/dist/solutions-components/utils/interfaces.ts +3 -2
- package/dist/solutions-components/utils/pdfUtils.ts +13 -2
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +11 -5
- package/dist/types/components/pdf-download/pdf-download.d.ts +0 -18
- package/dist/types/utils/downloadUtils.d.ts +40 -0
- package/dist/types/utils/interfaces.d.ts +2 -3
- package/dist/types/utils/pdfUtils.d.ts +3 -1
- package/package.json +1 -1
- package/dist/cjs/csvUtils-3a56c6d8.js +0 -54
- package/dist/components/csvUtils.js +0 -52
- package/dist/esm/csvUtils-23b5418f.js +0 -52
- package/dist/solutions-components/p-3069e3b7.js +0 -21
- package/dist/solutions-components/p-6d28f991.entry.js +0 -6
- package/dist/solutions-components/p-80f5e33c.js +0 -416
- package/dist/solutions-components/p-8927862a.entry.js +0 -6
- package/dist/solutions-components/p-e69c58e5.entry.js +0 -6
|
@@ -73,15 +73,6 @@ export declare class PdfDownload {
|
|
|
73
73
|
* @protected
|
|
74
74
|
*/
|
|
75
75
|
protected _initModules(): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Converts the text of a custom popup into a multiline label specification; conversion splits text into
|
|
78
|
-
* lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
|
|
79
|
-
*
|
|
80
|
-
* @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
|
|
81
|
-
* "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
|
|
82
|
-
* @return Label spec
|
|
83
|
-
*/
|
|
84
|
-
_convertPopupToLabelSpec(popupInfo: string): string[];
|
|
85
76
|
/**
|
|
86
77
|
* Gets the formatted pdf export size text
|
|
87
78
|
*
|
|
@@ -97,15 +88,6 @@ export declare class PdfDownload {
|
|
|
97
88
|
* @protected
|
|
98
89
|
*/
|
|
99
90
|
protected _getTranslations(): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Creates labels from items.
|
|
102
|
-
*
|
|
103
|
-
* @param ids List of ids to download
|
|
104
|
-
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
105
|
-
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
|
106
|
-
* @returns Promise resolving when function is done
|
|
107
|
-
*/
|
|
108
|
-
protected _prepareLabels(ids: number[], removeDuplicates: boolean, includeHeaderNames?: boolean): Promise<string[][]>;
|
|
109
91
|
/**
|
|
110
92
|
* Renders the pdf export size options
|
|
111
93
|
*
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2022 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/// <reference types="arcgis-js-api" />
|
|
17
|
+
import { ILabel } from "./pdfUtils";
|
|
18
|
+
export { ILabel } from "./pdfUtils";
|
|
19
|
+
/**
|
|
20
|
+
* Downloads csv of mailing labels for the provided list of ids
|
|
21
|
+
*
|
|
22
|
+
* @param layer Layer providing features and attributes for download
|
|
23
|
+
* @param ids List of ids to download
|
|
24
|
+
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
|
25
|
+
* all attributes are exported
|
|
26
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
27
|
+
* @param addColumnTitle Indicates if column headings should be included in output
|
|
28
|
+
* @returns Promise resolving when function is done
|
|
29
|
+
*/
|
|
30
|
+
export declare function downloadCSV(layer: __esri.FeatureLayer, ids: number[], formatUsingLayerPopup: boolean, removeDuplicates?: boolean, addColumnTitle?: boolean): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Downloads csv of mailing labels for the provided list of ids
|
|
33
|
+
*
|
|
34
|
+
* @param layer Layer providing features and attributes for download
|
|
35
|
+
* @param ids List of ids to download
|
|
36
|
+
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
|
37
|
+
* @param labelPageDescription Provides PDF page layout info
|
|
38
|
+
* @returns Promise resolving when function is done
|
|
39
|
+
*/
|
|
40
|
+
export declare function downloadPDF(layer: __esri.FeatureLayer, ids: number[], removeDuplicates: boolean, labelPageDescription: ILabel): Promise<void>;
|
|
@@ -86,7 +86,7 @@ export interface ISearchConfiguration {
|
|
|
86
86
|
searchAllEnabled?: boolean;
|
|
87
87
|
sources: Array<ILocatorSourceConfigItem | ILayerSourceConfigItem>;
|
|
88
88
|
}
|
|
89
|
-
interface ISearchSourceConfigItem {
|
|
89
|
+
export interface ISearchSourceConfigItem {
|
|
90
90
|
maxResults: number;
|
|
91
91
|
maxSuggestions: number;
|
|
92
92
|
minSuggestCharacters: number;
|
|
@@ -335,7 +335,7 @@ export interface ISelectionSet {
|
|
|
335
335
|
refineIds: IRefineIds;
|
|
336
336
|
redoStack?: IRefineOperation[];
|
|
337
337
|
undoStack?: IRefineOperation[];
|
|
338
|
-
|
|
338
|
+
skipGeomOIDs?: number[];
|
|
339
339
|
}
|
|
340
340
|
export interface IRefineSelectionEvent {
|
|
341
341
|
graphics: __esri.Graphic[];
|
|
@@ -365,4 +365,3 @@ export interface IMapInfo {
|
|
|
365
365
|
id: string;
|
|
366
366
|
name: string;
|
|
367
367
|
}
|
|
368
|
-
export {};
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import * as PDFLabels from "../assets/arcgis-pdf-creator/PDFLabels";
|
|
17
|
+
export { ILabel } from "../assets/arcgis-pdf-creator/PDFLabels";
|
|
16
18
|
/**
|
|
17
19
|
* Exports a PDF of labels.
|
|
18
20
|
*
|
|
19
21
|
* @param labels Labels to write
|
|
20
22
|
* @param labelPageDescription Page format to use for labels
|
|
21
23
|
*/
|
|
22
|
-
export declare function exportPDF(labels: string[][], labelPageDescription:
|
|
24
|
+
export declare function exportPDF(labels: string[][], labelPageDescription: PDFLabels.ILabel): void;
|
package/package.json
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
/** @license
|
|
9
|
-
* Copyright 2022 Esri
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Export a csv of the attributes from the features that match the provided ids
|
|
25
|
-
*
|
|
26
|
-
* @param labels Labels to write
|
|
27
|
-
*/
|
|
28
|
-
function exportCSV(labels) {
|
|
29
|
-
// Format values to string so it doesn't get tripped up when a value has a comma
|
|
30
|
-
// another option could be to export with a different delimiter
|
|
31
|
-
const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
|
|
32
|
-
_downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Download the CSV file
|
|
36
|
-
*
|
|
37
|
-
* @param outputLines Lines of output to write to file
|
|
38
|
-
* @param fileTitle Title (without file extension) to use for file; defaults to "export"
|
|
39
|
-
*
|
|
40
|
-
* @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
|
|
41
|
-
*/
|
|
42
|
-
function _downloadCSVFile(outputLines, fileTitle) {
|
|
43
|
-
const link = document.createElement("a");
|
|
44
|
-
if (link.download !== undefined) {
|
|
45
|
-
link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
|
|
46
|
-
link.download = `${fileTitle}.csv` || "export.csv";
|
|
47
|
-
link.style.visibility = "hidden";
|
|
48
|
-
document.body.appendChild(link);
|
|
49
|
-
link.click();
|
|
50
|
-
document.body.removeChild(link);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
exports.exportCSV = exportCSV;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
/** @license
|
|
7
|
-
* Copyright 2022 Esri
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Export a csv of the attributes from the features that match the provided ids
|
|
23
|
-
*
|
|
24
|
-
* @param labels Labels to write
|
|
25
|
-
*/
|
|
26
|
-
function exportCSV(labels) {
|
|
27
|
-
// Format values to string so it doesn't get tripped up when a value has a comma
|
|
28
|
-
// another option could be to export with a different delimiter
|
|
29
|
-
const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
|
|
30
|
-
_downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Download the CSV file
|
|
34
|
-
*
|
|
35
|
-
* @param outputLines Lines of output to write to file
|
|
36
|
-
* @param fileTitle Title (without file extension) to use for file; defaults to "export"
|
|
37
|
-
*
|
|
38
|
-
* @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
|
|
39
|
-
*/
|
|
40
|
-
function _downloadCSVFile(outputLines, fileTitle) {
|
|
41
|
-
const link = document.createElement("a");
|
|
42
|
-
if (link.download !== undefined) {
|
|
43
|
-
link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
|
|
44
|
-
link.download = `${fileTitle}.csv` || "export.csv";
|
|
45
|
-
link.style.visibility = "hidden";
|
|
46
|
-
document.body.appendChild(link);
|
|
47
|
-
link.click();
|
|
48
|
-
document.body.removeChild(link);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { exportCSV as e };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
/** @license
|
|
7
|
-
* Copyright 2022 Esri
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Export a csv of the attributes from the features that match the provided ids
|
|
23
|
-
*
|
|
24
|
-
* @param labels Labels to write
|
|
25
|
-
*/
|
|
26
|
-
function exportCSV(labels) {
|
|
27
|
-
// Format values to string so it doesn't get tripped up when a value has a comma
|
|
28
|
-
// another option could be to export with a different delimiter
|
|
29
|
-
const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
|
|
30
|
-
_downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Download the CSV file
|
|
34
|
-
*
|
|
35
|
-
* @param outputLines Lines of output to write to file
|
|
36
|
-
* @param fileTitle Title (without file extension) to use for file; defaults to "export"
|
|
37
|
-
*
|
|
38
|
-
* @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
|
|
39
|
-
*/
|
|
40
|
-
function _downloadCSVFile(outputLines, fileTitle) {
|
|
41
|
-
const link = document.createElement("a");
|
|
42
|
-
if (link.download !== undefined) {
|
|
43
|
-
link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
|
|
44
|
-
link.download = `${fileTitle}.csv` || "export.csv";
|
|
45
|
-
link.style.visibility = "hidden";
|
|
46
|
-
document.body.appendChild(link);
|
|
47
|
-
link.click();
|
|
48
|
-
document.body.removeChild(link);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { exportCSV as e };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
/** @license
|
|
7
|
-
* Copyright 2022 Esri
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
function t(t){!function(t,e){const n=document.createElement("a");void 0!==n.download&&(n.href=URL.createObjectURL(new Blob(t,{type:"text/csv;charset=utf-8;"})),n.download=`${e}.csv`||"export.csv",n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n))}(t.map((t=>Object.values(t).map((t=>`"${t}"`)).join(",")+"\r\n")),`notify-${Date.now().toString()}`)}export{t as e}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
import{r as t,h as e,H as i,g as a}from"./p-c2f00d41.js";import{g as l}from"./p-9260d75a.js";import{q as s,g as r,a as c,b as o}from"./p-cc2e20c8.js";import{e as n}from"./p-3069e3b7.js";import"./p-e1a4994d.js";import"./p-dbc9a5a8.js";const d=class{constructor(e){t(this,e),this._graphics=[],this._fieldNames=[],this.mapView=void 0,this._translations=void 0,this._selectedIndexes=[]}async componentWillLoad(){await this._getTranslations()}render(){return e(i,null,this._getTableControlRow(),e("div",{class:"data-container"},e("div",{class:"table-container"},e("div",{class:"table"},this._getTableHeader(),this._getTableRows()))),e("edit-record-modal",{ref:t=>this._editMultipleMpdal=t}))}_getTableControlRow(){const t=this._selectedIndexes.length>0,i=this._selectedIndexes.length>1;return e("div",{class:"display-flex table-border"},e("map-layer-picker",{mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t)}),e("div",null,e("calcite-button",{appearance:"transparent",color:"neutral",disabled:!t,iconStart:"magnifying-glass",onClick:()=>this._zoom()},this._translations.zoom),e("calcite-button",{appearance:"transparent",color:"neutral",disabled:!i,iconStart:"pencil",onClick:()=>this._editMultiple()},this._translations.editMultiple),e("calcite-button",{appearance:"transparent",color:"neutral",disabled:!t,iconStart:"trash",onClick:()=>this._delete()},this._translations.delete),e("calcite-split-button",{appearance:"transparent",color:"neutral","primary-text":this._translations.more},e("calcite-dropdown-group",{"selection-mode":"none"},e("calcite-dropdown-item",{iconStart:"list-check-all",onClick:()=>this._selectAll(!0)},this._translations.selectAll),e("calcite-dropdown-item",{iconStart:"selected-items-filter",onClick:()=>this._showSelected()},this._translations.showSelected),e("calcite-dropdown-item",{iconStart:"erase",onClick:()=>this._clearSelection()},this._translations.clearSelection),e("calcite-dropdown-item",{iconStart:"refresh",onClick:()=>this._switchSelected()},this._translations.switchSelected),e("calcite-dropdown-item",{iconStart:"export",onClick:()=>this._exportToCSV()},this._translations.exportCSV)))))}_getTableHeader(){return e("div",{class:"header"},e("div",{class:"table-header-cell padding-3-4"},e("calcite-checkbox",{class:"display-flex justify-center",onClick:()=>this._selectAll(this._selectAllElement.checked),ref:t=>this._selectAllElement=t})),this._fieldNames.map((t=>this._getTableHeaderCell(t))))}_getTableHeaderCell(t){return e("div",{class:"table-header-cell field-width"},t)}_getTableRows(){return e("div",{class:"table-body"},this._graphics.map(((t,e)=>this._getTableRow(t,e))))}_getTableRow(t,i){const a=this._selectedIndexes.indexOf(i)>-1;return e("div",{class:"row"},e("div",{class:"table-cell table-border padding-3-4"},e("calcite-checkbox",{checked:a,class:"display-flex justify-center",onClick:()=>this._rowSelected(i),value:i})),this._fieldNames.map((e=>{const i=this._layerView.layer.fieldsIndex.get(e);return this._getTableRowCell(t.attributes[e],i,a)})))}_getTableRowCell(t,i,a){const l=i.editable&&a,s=this._getInputType(i.type);let r;const c=i.domain;return c&&(r="coded-value"===c.type?e("calcite-select",{label:""},c.codedValues.map((i=>e("calcite-option",{label:i.name,selected:t===i.code.toString(),value:i.code})))):e("calcite-input",{max:c.maxValue,min:c.minValue,type:"number",value:t})),e("div",{class:"table-cell table-border field-width"},l&&r?r:l?e("calcite-input",{type:s,value:t}):t)}_getInputType(t){const e={string:"text","small-integer":"number",integer:"number",single:"number",double:"number",long:"number",date:"datetime-local",oid:"number",guid:"text","global-id":"text"};return Object.keys(e).indexOf(t)>-1?e[t]:"text"}_selectAll(t){this._selectedIndexes=t?this._graphics.map(((t,e)=>e)):[]}_showSelected(){console.log("_showSelected")}_clearSelection(){this._selectedIndexes=[]}_switchSelected(){const t=[...this._selectedIndexes];this._selectedIndexes=this._graphics.reduce(((e,i,a)=>(t.indexOf(a)<0&&e.push(a),e)),[])}async _exportToCSV(){const t=this._getSelectedIds(),e=(await s(t,this._layerView.layer)).features.map((t=>t.attributes)),i=[],a=e[0];return Object.keys(a).forEach((t=>{a.hasOwnProperty(t)&&i.push(t)})),e.unshift(i),n(e)}_zoom(){const t=this._getSelectedIds();r(t,this._layerView,this.mapView,!0)}_editMultiple(){this._editMultipleMpdal.open=!0}_delete(){console.log("delete")}_getGraphics(t){return this._graphics.filter(((e,i)=>t.indexOf(i)>-1))}_getSelectedIds(){return this._getGraphics(this._selectedIndexes).map((t=>t.getObjectId()))}_rowSelected(t){const e=this._selectedIndexes.indexOf(t);e>-1?(this._selectedIndexes.splice(e,1),this._selectedIndexes=[...this._selectedIndexes]):this._selectedIndexes=[...this._selectedIndexes,t]}async _layerSelectionChanged(t){const e=t.detail[0];this._layerView=await c(this.mapView,e),this._fieldNames=this._layerView.layer.fields.map((t=>t.alias||t.name)),this._graphics=await o(0,this._layerView.layer,[]),this._selectedIndexes=[]}async _getTranslations(){const t=await l(this.el);this._translations=t[0]}get el(){return a(this)}};d.style=":host{display:block}.table{display:table;width:100%}.header{display:table-header-group;background-color:#757575;font-weight:500;font-size:var(--calcite-font-size-0);color:var(--calcite-ui-text-inverse);position:sticky;top:0;z-index:1}.table-header-cell{display:table-cell;text-align:justify;border-right:1px solid var(--calcite-ui-border-2);padding:0.5rem}.table-body{display:table-row-group}.row{display:table-row}.table-cell{display:table-cell;padding:0.5rem}.display-table-header{display:table-header-group}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-ui-border-2)}.justify-center{justify-content:center}.table-container{width:100%}.overflow-auto{overflow:auto}.data-container{overflow:auto;height:calc(100% - 35px)}.row:nth-child(odd){background:var(--calcite-ui-foreground-3)}.padding-3-4{padding:0.75rem}.field-width{white-space:nowrap;min-width:300px;max-width:300px;overflow:hidden}";export{d as layer_table}
|