@esri/solutions-components 0.5.1 → 0.5.2
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/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/assets/data/images/grid.png +0 -0
- package/dist/assets/data/images/horizontal.png +0 -0
- package/dist/assets/data/images/vertical.png +0 -0
- package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
- package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
- package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
- package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
- package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
- package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
- package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
- package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
- package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
- package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
- package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
- package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
- package/dist/cjs/loader.cjs.js +30 -30
- package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
- package/dist/cjs/public-notification.cjs.entry.js +69 -49
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +31 -31
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
- package/dist/collection/components/layer-table/layer-table.css +2 -70
- package/dist/collection/components/layer-table/layer-table.js +66 -106
- package/dist/collection/components/map-card/map-card.css +4 -7
- package/dist/collection/components/map-card/map-card.js +44 -10
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +45 -27
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +14 -41
- package/dist/collection/utils/csvDownload.js +41 -0
- package/dist/collection/utils/csvDownload.ts +42 -0
- package/dist/collection/utils/csvUtils.js +6 -23
- package/dist/collection/utils/csvUtils.ts +8 -27
- package/dist/collection/utils/downloadUtils.js +30 -14
- package/dist/collection/utils/downloadUtils.ts +36 -14
- package/dist/collection/utils/interfaces.js +6 -0
- package/dist/collection/utils/interfaces.ts +6 -0
- package/dist/collection/utils/pdfUtils.js +9 -6
- package/dist/collection/utils/pdfUtils.ts +13 -8
- package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/components/crowdsource-manager.js +293 -17
- package/dist/components/downloadUtils.js +133 -42
- package/dist/components/interfaces3.js +7 -1
- package/dist/components/layer-table.js +1 -443
- package/dist/components/layer-table2.js +429 -0
- package/dist/components/map-card.js +1 -339
- package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
- package/dist/components/map-draw-tools2.js +16 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +38 -38
- package/dist/components/public-notification.js +102 -82
- package/dist/components/queryUtils.js +10 -10
- package/dist/components/refine-selection-tools2.js +3 -3
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-store.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +76 -76
- package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
- package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
- package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
- package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
- package/dist/esm/calcite-input-message_5.entry.js +275 -275
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
- package/dist/esm/crowdsource-manager.entry.js +88 -14
- package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
- package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
- package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
- package/dist/esm/layer-table_2.entry.js +507 -0
- package/dist/esm/loader.js +26 -26
- package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
- package/dist/esm/public-notification.entry.js +65 -45
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
- package/dist/esm/solutions-components.js +26 -26
- package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
- package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
- package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
- package/dist/solutions-components/p-30de8da1.entry.js +17 -0
- package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
- package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
- package/dist/solutions-components/p-813a04c3.entry.js +6 -0
- package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
- package/dist/solutions-components/p-8cece97f.js +21 -0
- package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
- package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
- package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
- package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
- package/dist/solutions-components/p-ca386a72.entry.js +6 -0
- package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
- package/dist/solutions-components/p-db846ee2.entry.js +11 -0
- package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
- package/dist/solutions-components/p-e1c93241.entry.js +6 -0
- package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +6 -6
- package/dist/solutions-components/utils/csvDownload.ts +42 -0
- package/dist/solutions-components/utils/csvUtils.ts +8 -27
- package/dist/solutions-components/utils/downloadUtils.ts +36 -14
- package/dist/solutions-components/utils/interfaces.ts +6 -0
- package/dist/solutions-components/utils/pdfUtils.ts +13 -8
- package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
- package/dist/types/components/layer-table/layer-table.d.ts +35 -48
- package/dist/types/components/map-card/map-card.d.ts +10 -6
- package/dist/types/components/public-notification/public-notification.d.ts +18 -6
- package/dist/types/components.d.ts +1621 -1601
- package/dist/types/preact.d.ts +2 -1
- package/dist/types/utils/csvDownload.d.ts +24 -0
- package/dist/types/utils/csvUtils.d.ts +2 -1
- package/dist/types/utils/downloadUtils.d.ts +25 -0
- package/dist/types/utils/interfaces.d.ts +5 -0
- package/dist/types/utils/pdfUtils.d.ts +2 -1
- package/package.json +4 -4
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
- package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
- package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
- package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
- package/dist/cjs/layer-table.cjs.entry.js +0 -317
- package/dist/cjs/map-card.cjs.entry.js +0 -252
- package/dist/esm/calcite-chip.entry.js +0 -138
- package/dist/esm/calcite-dropdown.entry.js +0 -477
- package/dist/esm/calcite-handle.entry.js +0 -95
- package/dist/esm/calcite-loader.entry.js +0 -91
- package/dist/esm/layer-table.entry.js +0 -313
- package/dist/solutions-components/p-045d3988.entry.js +0 -12
- package/dist/solutions-components/p-11132485.entry.js +0 -11
- package/dist/solutions-components/p-15b43c29.entry.js +0 -11
- package/dist/solutions-components/p-5034aabc.entry.js +0 -11
- package/dist/solutions-components/p-6f012424.entry.js +0 -6
- package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-bc39f296.entry.js +0 -6
- package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @preserve
|
|
2
2
|
* arcgis-pdf-creator v0.0.1
|
|
3
|
-
*
|
|
3
|
+
* Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
|
|
4
4
|
*/
|
|
5
5
|
/** @license
|
|
6
6
|
* Copyright 2022 Esri
|
|
@@ -275,13 +275,16 @@ class PDFCreator {
|
|
|
275
275
|
*
|
|
276
276
|
* @param text String to estimate
|
|
277
277
|
* @param fontSize Text size in points
|
|
278
|
-
* @returns Estimated width of text
|
|
278
|
+
* @returns Estimated width of text using (points x 1/72 inches/point) * 0.6;
|
|
279
|
+
* need to override this generalized function with a specific PDF generator;
|
|
280
|
+
* the 0.6 width:height ratio comes from https://www.fhwa.dot.gov/publications/research/safety/98057/ch03.cfm#width
|
|
279
281
|
*
|
|
280
282
|
* @class PDFCreator
|
|
281
283
|
*/
|
|
282
284
|
getTextWidth(text, fontSize) {
|
|
285
|
+
const ratioWidthToHeight = 0.6;
|
|
283
286
|
// Return a value for testing
|
|
284
|
-
return text.length * fontSize;
|
|
287
|
+
return text.length * fontSize * this.fontProps.fontResolutionInchesPerPoint * ratioWidthToHeight;
|
|
285
288
|
}
|
|
286
289
|
/**
|
|
287
290
|
* @class PDFCreator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @preserve
|
|
2
2
|
* arcgis-pdf-creator v0.0.1
|
|
3
|
-
*
|
|
3
|
+
* Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
|
|
4
4
|
*/
|
|
5
5
|
import * as fontkit from '@pdf-lib/fontkit';
|
|
6
6
|
import { PDFCreator, EPageType } from './PDFCreator.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @preserve
|
|
2
2
|
* arcgis-pdf-creator v0.0.1
|
|
3
|
-
*
|
|
3
|
+
* Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
|
|
4
4
|
*/
|
|
5
5
|
import { drawGridOfBoxes } from './grid.js';
|
|
6
6
|
|
|
@@ -28,12 +28,13 @@ class PDFLabels {
|
|
|
28
28
|
* @param labels Array of labels; each label consists of one or more line strings
|
|
29
29
|
* @param labelSpec Properties describing page dimensions of labels sheet
|
|
30
30
|
* @param startingPageNum The 1-based page number to start printing labels into; page is assumed to be blank & to exist
|
|
31
|
+
* @param heading Line to add at top of label page outside of labels
|
|
31
32
|
* @param progressCallback Callback with percent done in range 0..100
|
|
32
33
|
* @returns Promise which, when resolved, returns the 1-based page number of the last page containing labels
|
|
33
34
|
*
|
|
34
35
|
* @class PDFLabels
|
|
35
36
|
*/
|
|
36
|
-
addLabelsToDoc(labels, labelSpec, startingPageNum, progressCallback) {
|
|
37
|
+
addLabelsToDoc(labels, labelSpec, startingPageNum, heading, progressCallback) {
|
|
37
38
|
return new Promise((resolve) => {
|
|
38
39
|
const labelsPerPageDisplay = labelSpec.numLabelsAcross * labelSpec.numLabelsDown;
|
|
39
40
|
let column;
|
|
@@ -44,6 +45,9 @@ class PDFLabels {
|
|
|
44
45
|
// Draw
|
|
45
46
|
let currentPageNum = startingPageNum;
|
|
46
47
|
const topOfFirstLabel = labelSpec.pageProperties.topMargin - this.PDFCreator.pageOptions.topMargin;
|
|
48
|
+
if (heading) {
|
|
49
|
+
this._drawSupplementalText(heading, 0, -0.1);
|
|
50
|
+
}
|
|
47
51
|
for (let iLabel = 0, iNonBlankLabel = 0; iLabel < labels.length; iLabel++) {
|
|
48
52
|
if (progressCallback) {
|
|
49
53
|
progressCallback(Math.round(iLabel / labels.length * 100));
|
|
@@ -59,6 +63,9 @@ class PDFLabels {
|
|
|
59
63
|
// Advance to next page
|
|
60
64
|
this.PDFCreator.addPage();
|
|
61
65
|
++currentPageNum;
|
|
66
|
+
if (heading) {
|
|
67
|
+
this._drawSupplementalText(heading, 0, -0.1);
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
// Prep the new page
|
|
64
71
|
column = 0;
|
|
@@ -71,11 +78,14 @@ class PDFLabels {
|
|
|
71
78
|
row = 0;
|
|
72
79
|
}
|
|
73
80
|
// Draw the label
|
|
81
|
+
const minimumFontSize = 4;
|
|
74
82
|
// Temporarily reduce the font size if we have more lines than the label can hold
|
|
75
83
|
let fontPoints = labelSpec.fontSizePx;
|
|
76
84
|
if (labelSpec.maxNumLabelLines < labelLines.length) {
|
|
77
|
-
fontPoints = Math.floor(labelSpec.maxNumLabelLines / labelLines.length * labelSpec.fontSizePx);
|
|
85
|
+
fontPoints = Math.max(Math.floor(labelSpec.maxNumLabelLines / labelLines.length * labelSpec.fontSizePx), minimumFontSize);
|
|
78
86
|
}
|
|
87
|
+
// Temporarily reduce the font size farther if label lines are too long
|
|
88
|
+
fontPoints = this._getFontSizeForOverlongLines(labelLines, maxLabelTextWidth, fontPoints, minimumFontSize);
|
|
79
89
|
// Clip overlong lines; append ellipses to clipped lines
|
|
80
90
|
labelLines = this._clipOverlongLines(labelLines, maxLabelTextWidth, fontPoints);
|
|
81
91
|
const labelLineHeight = this.PDFCreator.fontAscenderDescenderHeight(fontPoints);
|
|
@@ -237,6 +247,47 @@ class PDFLabels {
|
|
|
237
247
|
});
|
|
238
248
|
return trimmedLines;
|
|
239
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Draws supplemental text such as a heading or footer.
|
|
252
|
+
*
|
|
253
|
+
* @param text Text to draw
|
|
254
|
+
* @param left Offset from left edge of document to left edge of text
|
|
255
|
+
* @param top Offset from top of document to top of text
|
|
256
|
+
*/
|
|
257
|
+
_drawSupplementalText(text, left, top) {
|
|
258
|
+
const fontPoints = 6;
|
|
259
|
+
this.PDFCreator.drawText(text, {
|
|
260
|
+
left,
|
|
261
|
+
top,
|
|
262
|
+
fontPoints,
|
|
263
|
+
fontColor: "000000"
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Trims a set of text lines to fit within specified bounds.
|
|
268
|
+
*
|
|
269
|
+
* @param lines Text lines to be checked
|
|
270
|
+
* @param maxTextWidth The maximum width permitted for the drawing of the text in doc units
|
|
271
|
+
* @param preferredFontSize Initial text size in points
|
|
272
|
+
* @param minimumFontSize The smallest acceptable font size in points
|
|
273
|
+
* @returns The maximum of `minimumFontSize` and the font size in points that should help all lines
|
|
274
|
+
* of the label to fit on the label
|
|
275
|
+
*
|
|
276
|
+
* @class PDFLabels
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
_getFontSizeForOverlongLines(lines, maxTextWidth, preferredFontSize, minimumFontSize) {
|
|
280
|
+
let fontSize = preferredFontSize;
|
|
281
|
+
lines.forEach(line => {
|
|
282
|
+
line = line.trim();
|
|
283
|
+
if (this.PDFCreator.getTextWidth(line, fontSize) > maxTextWidth) {
|
|
284
|
+
do {
|
|
285
|
+
--fontSize;
|
|
286
|
+
} while (this.PDFCreator.getTextWidth(line, fontSize) > maxTextWidth && fontSize > minimumFontSize);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return fontSize;
|
|
290
|
+
}
|
|
240
291
|
/**
|
|
241
292
|
* Loads the label formats.
|
|
242
293
|
*
|
|
@@ -16,4 +16,126 @@
|
|
|
16
16
|
|
|
17
17
|
:host {
|
|
18
18
|
display: block;
|
|
19
|
+
--calcite-label-margin-bottom: 0px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pad-top-51 {
|
|
23
|
+
padding-top: 51px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.header-title {
|
|
27
|
+
display: flex;
|
|
28
|
+
float: left;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.header-controls-label {
|
|
32
|
+
display: flex;
|
|
33
|
+
float: right;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.header-controls {
|
|
37
|
+
height: 50px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.img-background {
|
|
41
|
+
background-repeat: no-repeat;
|
|
42
|
+
background-size: 100% 100%;
|
|
43
|
+
width: 38px;
|
|
44
|
+
height: 26px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.grid-background {
|
|
48
|
+
background-image: url('../../assets/data/images/grid.png');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vertical-background {
|
|
52
|
+
background-image: url('../../assets/data/images/horizontal.png');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.horizontal-background {
|
|
56
|
+
background-image: url('../../assets/data/images/vertical.png');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.action-center {
|
|
60
|
+
-webkit-box-align: center;
|
|
61
|
+
-webkit-align-items: center;
|
|
62
|
+
-ms-grid-row-align: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
align-content: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.background-transparent {
|
|
69
|
+
background-color: transparent;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.display-flex {
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.header-text {
|
|
77
|
+
font-size: var(--calcite-font-size-0);
|
|
78
|
+
font-weight: var(--calcite-font-weight-medium);
|
|
79
|
+
padding-inline: 0.75rem;
|
|
80
|
+
padding-block: 0.875rem;
|
|
81
|
+
line-height: 1.25rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.width-full {
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.width-1-2 {
|
|
89
|
+
position: relative;
|
|
90
|
+
width: 50%;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.width-1-3 {
|
|
94
|
+
position: relative;
|
|
95
|
+
width: 33.33%;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.width-2-3 {
|
|
99
|
+
position: relative;
|
|
100
|
+
width: 66.66%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.width-0 {
|
|
104
|
+
width: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.height-full {
|
|
108
|
+
height: 100%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.height-1-2 {
|
|
112
|
+
position: relative;
|
|
113
|
+
height: 50%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.height-0 {
|
|
117
|
+
height: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.toggle-node {
|
|
121
|
+
width: 48px;
|
|
122
|
+
height: 48px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.overflow-hidden {
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.flex-column {
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.border {
|
|
134
|
+
border-width: 1px;
|
|
135
|
+
border-style: solid;
|
|
136
|
+
border-color: var(--calcite-ui-border-3);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.position-relative {
|
|
140
|
+
position: relative;
|
|
19
141
|
}
|
|
@@ -19,17 +19,16 @@
|
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
21
|
import { Host, h } from '@stencil/core';
|
|
22
|
+
import { getLocaleComponentStrings } from "../../utils/locale";
|
|
23
|
+
import { ELayoutMode } from '../../utils/interfaces';
|
|
22
24
|
export class CrowdsourceManager {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// State (internal)
|
|
31
|
-
//
|
|
32
|
-
//--------------------------------------------------------------------------
|
|
25
|
+
constructor() {
|
|
26
|
+
this.mapInfos = [];
|
|
27
|
+
this._translations = undefined;
|
|
28
|
+
this._layoutMode = ELayoutMode.GRID;
|
|
29
|
+
this._mapView = undefined;
|
|
30
|
+
this._panelOpen = true;
|
|
31
|
+
}
|
|
33
32
|
//--------------------------------------------------------------------------
|
|
34
33
|
//
|
|
35
34
|
// Properties (protected)
|
|
@@ -50,19 +49,95 @@ export class CrowdsourceManager {
|
|
|
50
49
|
// Events (public)
|
|
51
50
|
//
|
|
52
51
|
//--------------------------------------------------------------------------
|
|
52
|
+
/**
|
|
53
|
+
* Handle changes to the buffer distance value
|
|
54
|
+
*/
|
|
55
|
+
mapChanged(event) {
|
|
56
|
+
this._mapView = event.detail;
|
|
57
|
+
}
|
|
53
58
|
//--------------------------------------------------------------------------
|
|
54
59
|
//
|
|
55
60
|
// Functions (lifecycle)
|
|
56
61
|
//
|
|
57
62
|
//--------------------------------------------------------------------------
|
|
63
|
+
async componentWillLoad() {
|
|
64
|
+
await this._getTranslations();
|
|
65
|
+
}
|
|
58
66
|
render() {
|
|
59
|
-
return (h(Host, null, h("slot",
|
|
67
|
+
return (h(Host, null, h("calcite-panel", { class: "width-full height-full", heading: this._translations.header }, h("div", { class: "display-flex", slot: "header-actions-end" }, h("div", { class: "header-text" }, "Layout"), this._getAction("grid-background", ELayoutMode.GRID, this._translations.grid), this._getAction("horizontal-background", ELayoutMode.VERTICAL, this._translations.horizontal), this._getAction("vertical-background", ELayoutMode.HORIZONTAL, this._translations.vertical)), this._getBody(this._layoutMode, this._panelOpen))));
|
|
60
68
|
}
|
|
61
69
|
//--------------------------------------------------------------------------
|
|
62
70
|
//
|
|
63
71
|
// Functions (protected)
|
|
64
72
|
//
|
|
65
73
|
//--------------------------------------------------------------------------
|
|
74
|
+
_getAction(imgClass, layoutMode, tip) {
|
|
75
|
+
return (h("div", null, h("calcite-action", { alignment: "center", appearance: "transparent", compact: false, id: imgClass, indicator: layoutMode === this._layoutMode, onClick: () => { this._setLayoutMode(layoutMode); }, text: "" }, h("div", { class: imgClass + " img-background" })), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": imgClass }, h("span", null, tip))));
|
|
76
|
+
}
|
|
77
|
+
_getDividerIcon(layoutMode, panelOpen) {
|
|
78
|
+
let icon = "";
|
|
79
|
+
switch (layoutMode) {
|
|
80
|
+
case ELayoutMode.HORIZONTAL:
|
|
81
|
+
icon = panelOpen ? "chevrons-up" : "chevrons-down";
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
icon = panelOpen ? "chevrons-left" : "chevrons-right";
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return icon;
|
|
88
|
+
}
|
|
89
|
+
_getMapSizeClass(layoutMode, panelOpen) {
|
|
90
|
+
let sizeClass = "";
|
|
91
|
+
switch (layoutMode) {
|
|
92
|
+
case ELayoutMode.HORIZONTAL:
|
|
93
|
+
sizeClass = `${panelOpen ? "height-1-2" : "height-0"} width-full position-relative`;
|
|
94
|
+
break;
|
|
95
|
+
case ELayoutMode.GRID:
|
|
96
|
+
sizeClass = `height-full position-relative ${panelOpen ? "width-1-3" : "width-0"}`;
|
|
97
|
+
break;
|
|
98
|
+
case ELayoutMode.VERTICAL:
|
|
99
|
+
sizeClass = `height-full position-relative ${panelOpen ? "width-1-2" : "width-0"}`;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return sizeClass;
|
|
103
|
+
}
|
|
104
|
+
_getTableSizeClass(layoutMode, panelOpen) {
|
|
105
|
+
let sizeClass = "";
|
|
106
|
+
switch (layoutMode) {
|
|
107
|
+
case ELayoutMode.HORIZONTAL:
|
|
108
|
+
sizeClass = `${panelOpen ? "height-1-2" : "height-full"} width-full display-flex flex-column`;
|
|
109
|
+
break;
|
|
110
|
+
case ELayoutMode.GRID:
|
|
111
|
+
sizeClass = `${panelOpen ? "width-2-3" : "width-full"} height-full display-flex`;
|
|
112
|
+
break;
|
|
113
|
+
case ELayoutMode.VERTICAL:
|
|
114
|
+
sizeClass = `${panelOpen ? "width-1-2" : "width-full"} height-full display-flex`;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
return sizeClass;
|
|
118
|
+
}
|
|
119
|
+
_getBody(layoutMode, panelOpen) {
|
|
120
|
+
const displayFlex = layoutMode === ELayoutMode.HORIZONTAL ? "" : "display-flex";
|
|
121
|
+
return (h("calcite-shell", { class: "width-full height-full pad-top-51" }, h("div", { class: `width-full height-full ${displayFlex}` }, this._getMap(layoutMode, panelOpen), this._getTable(layoutMode, panelOpen))));
|
|
122
|
+
}
|
|
123
|
+
_getMap(layoutMode, panelOpen) {
|
|
124
|
+
const mapSizeClass = this._getMapSizeClass(layoutMode, panelOpen);
|
|
125
|
+
return (h("div", { class: `${mapSizeClass} overflow-hidden` }, h("div", { style: { "overflow": "hidden" } }, h("map-card", { mapInfos: this.mapInfos }))));
|
|
126
|
+
}
|
|
127
|
+
_getTable(layoutMode, panelOpen) {
|
|
128
|
+
const tableSizeClass = this._getTableSizeClass(layoutMode, panelOpen);
|
|
129
|
+
const icon = this._getDividerIcon(layoutMode, panelOpen);
|
|
130
|
+
const tooltip = panelOpen ? this._translations.close : this._translations.open;
|
|
131
|
+
const id = "toggle-layout";
|
|
132
|
+
const toggleSizeClass = layoutMode === ELayoutMode.HORIZONTAL ? "divider-h" : "divider-w";
|
|
133
|
+
return (h("div", { class: tableSizeClass }, h("div", { class: `border ${toggleSizeClass}` }, h("div", { class: "toggle-node" }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onclick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))), h("div", { class: "width-full height-full" }, h("layer-table", { mapView: this === null || this === void 0 ? void 0 : this._mapView }))));
|
|
134
|
+
}
|
|
135
|
+
_setLayoutMode(layoutMode) {
|
|
136
|
+
this._layoutMode = layoutMode;
|
|
137
|
+
}
|
|
138
|
+
_toggleLayout() {
|
|
139
|
+
this._panelOpen = !this._panelOpen;
|
|
140
|
+
}
|
|
66
141
|
/**
|
|
67
142
|
* Fetches the component's translations
|
|
68
143
|
*
|
|
@@ -70,11 +145,10 @@ export class CrowdsourceManager {
|
|
|
70
145
|
* @protected
|
|
71
146
|
*/
|
|
72
147
|
async _getTranslations() {
|
|
73
|
-
|
|
74
|
-
|
|
148
|
+
const messages = await getLocaleComponentStrings(this.el);
|
|
149
|
+
this._translations = messages[0];
|
|
75
150
|
}
|
|
76
151
|
static get is() { return "crowdsource-manager"; }
|
|
77
|
-
static get encapsulation() { return "shadow"; }
|
|
78
152
|
static get originalStyleUrls() {
|
|
79
153
|
return {
|
|
80
154
|
"$": ["crowdsource-manager.css"]
|
|
@@ -85,5 +159,47 @@ export class CrowdsourceManager {
|
|
|
85
159
|
"$": ["crowdsource-manager.css"]
|
|
86
160
|
};
|
|
87
161
|
}
|
|
162
|
+
static get properties() {
|
|
163
|
+
return {
|
|
164
|
+
"mapInfos": {
|
|
165
|
+
"type": "unknown",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "IMapInfo[]",
|
|
169
|
+
"resolved": "IMapInfo[]",
|
|
170
|
+
"references": {
|
|
171
|
+
"IMapInfo": {
|
|
172
|
+
"location": "import",
|
|
173
|
+
"path": "../../utils/interfaces"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "IMapInfo[]: array of map infos (name and id)"
|
|
182
|
+
},
|
|
183
|
+
"defaultValue": "[]"
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
static get states() {
|
|
188
|
+
return {
|
|
189
|
+
"_translations": {},
|
|
190
|
+
"_layoutMode": {},
|
|
191
|
+
"_mapView": {},
|
|
192
|
+
"_panelOpen": {}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
88
195
|
static get elementRef() { return "el"; }
|
|
196
|
+
static get listeners() {
|
|
197
|
+
return [{
|
|
198
|
+
"name": "mapChanged",
|
|
199
|
+
"method": "mapChanged",
|
|
200
|
+
"target": "window",
|
|
201
|
+
"capture": false,
|
|
202
|
+
"passive": false
|
|
203
|
+
}];
|
|
204
|
+
}
|
|
89
205
|
}
|
|
@@ -18,44 +18,8 @@
|
|
|
18
18
|
display: block;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.table {
|
|
22
|
-
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.header {
|
|
27
|
-
display: table-header-group;
|
|
28
|
-
background-color: #757575;
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
font-size: var(--calcite-font-size-0);
|
|
31
|
-
color: var(--calcite-ui-text-inverse);
|
|
32
|
-
position: sticky;
|
|
33
|
-
top: 0;
|
|
34
|
-
z-index: 1;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.table-header-cell {
|
|
38
|
-
display: table-cell;
|
|
39
|
-
text-align: justify;
|
|
40
|
-
border-right: 1px solid var(--calcite-ui-border-2);
|
|
41
|
-
padding: 0.5rem;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.table-body {
|
|
45
|
-
display: table-row-group;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.row {
|
|
49
|
-
display: table-row;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.table-cell {
|
|
53
|
-
display: table-cell;
|
|
54
|
-
padding: 0.5rem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.display-table-header {
|
|
58
|
-
display: table-header-group;
|
|
21
|
+
.table-div {
|
|
22
|
+
height: calc(100% - 35px);
|
|
59
23
|
}
|
|
60
24
|
|
|
61
25
|
.display-flex {
|
|
@@ -65,35 +29,3 @@
|
|
|
65
29
|
.table-border {
|
|
66
30
|
border: 1px solid var(--calcite-ui-border-2);
|
|
67
31
|
}
|
|
68
|
-
|
|
69
|
-
.justify-center {
|
|
70
|
-
justify-content: center;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.table-container {
|
|
74
|
-
width: 100%;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.overflow-auto {
|
|
78
|
-
overflow: auto;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.data-container {
|
|
82
|
-
overflow: auto;
|
|
83
|
-
height: calc(100% - 35px);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.row:nth-child(odd) {
|
|
87
|
-
background: var(--calcite-ui-foreground-3);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.padding-3-4 {
|
|
91
|
-
padding: 0.75rem;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.field-width {
|
|
95
|
-
white-space: nowrap;
|
|
96
|
-
min-width: 300px;
|
|
97
|
-
max-width: 300px;
|
|
98
|
-
overflow: hidden;
|
|
99
|
-
}
|