@esri/solutions-components 0.7.33 → 0.7.34

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.
@@ -1383,35 +1383,47 @@ const LayerTable = class {
1383
1383
  * @returns a list of column templates if they exist
1384
1384
  */
1385
1385
  _getColumnTemplates(id, fieldInfos) {
1386
- var _a;
1387
- let layerInfo;
1388
- (_a = this.mapInfo.layerInfos) === null || _a === void 0 ? void 0 : _a.some(li => {
1389
- if (li.id === id) {
1390
- layerInfo = li;
1386
+ var _a, _b;
1387
+ let layerOption;
1388
+ (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.layerOptions) === null || _b === void 0 ? void 0 : _b.layers.some(l => {
1389
+ if (l.id === id) {
1390
+ layerOption = l;
1391
1391
  return true;
1392
1392
  }
1393
1393
  });
1394
- let columnTemplates = layerInfo === null || layerInfo === void 0 ? void 0 : layerInfo.columnTemplates;
1394
+ const fieldOrder = (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields) && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder) ?
1395
+ layerOption.fieldOrder.filter(f => layerOption.fields.indexOf(f) > -1) :
1396
+ undefined;
1397
+ let columnTemplates;
1395
1398
  if (fieldInfos) {
1396
- columnTemplates = columnTemplates ? columnTemplates.map(columnTemplate => {
1397
- fieldInfos.some(fieldInfo => {
1398
- if (fieldInfo.name === columnTemplate.fieldName) {
1399
- columnTemplate.label = fieldInfo.alias;
1400
- columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1401
- return true;
1399
+ columnTemplates = layerOption && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields)
1400
+ ? fieldInfos.reduce((prev, cur) => {
1401
+ if (layerOption.fields.indexOf(cur.name) > -1) {
1402
+ const template = {
1403
+ type: "field",
1404
+ fieldName: cur.name,
1405
+ label: cur.alias,
1406
+ menuConfig: this._getMenuConfig(cur.name)
1407
+ };
1408
+ prev.push(template);
1402
1409
  }
1410
+ return prev;
1411
+ }, []).sort(this._sortFields.bind(this, layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder))
1412
+ : fieldInfos.map(fieldInfo => {
1413
+ return {
1414
+ type: "field",
1415
+ fieldName: fieldInfo.name,
1416
+ label: fieldInfo.alias,
1417
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1418
+ };
1403
1419
  });
1404
- return columnTemplate;
1405
- }) : fieldInfos.map(fieldInfo => {
1406
- return {
1407
- type: "field",
1408
- fieldName: fieldInfo.name,
1409
- label: fieldInfo.alias,
1410
- menuConfig: this._getMenuConfig(fieldInfo.name)
1411
- };
1412
- });
1413
1420
  }
1414
- return columnTemplates;
1421
+ return fieldOrder ?
1422
+ columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.sort(this._sortFields.bind(this, fieldOrder)) :
1423
+ columnTemplates;
1424
+ }
1425
+ _sortFields(sorter, a, b) {
1426
+ return (sorter === null || sorter === void 0 ? void 0 : sorter.indexOf(a.fieldName)) - sorter.indexOf(b.fieldName);
1415
1427
  }
1416
1428
  /**
1417
1429
  * Get the menu config that adds the ability to hide the current column
@@ -1,19 +1,19 @@
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
-
17
- :host {
18
- display: block;
19
- }
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
+
17
+ :host {
18
+ display: block;
19
+ }
@@ -1298,35 +1298,47 @@ export class LayerTable {
1298
1298
  * @returns a list of column templates if they exist
1299
1299
  */
1300
1300
  _getColumnTemplates(id, fieldInfos) {
1301
- var _a;
1302
- let layerInfo;
1303
- (_a = this.mapInfo.layerInfos) === null || _a === void 0 ? void 0 : _a.some(li => {
1304
- if (li.id === id) {
1305
- layerInfo = li;
1301
+ var _a, _b;
1302
+ let layerOption;
1303
+ (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.layerOptions) === null || _b === void 0 ? void 0 : _b.layers.some(l => {
1304
+ if (l.id === id) {
1305
+ layerOption = l;
1306
1306
  return true;
1307
1307
  }
1308
1308
  });
1309
- let columnTemplates = layerInfo === null || layerInfo === void 0 ? void 0 : layerInfo.columnTemplates;
1309
+ const fieldOrder = (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields) && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder) ?
1310
+ layerOption.fieldOrder.filter(f => layerOption.fields.indexOf(f) > -1) :
1311
+ undefined;
1312
+ let columnTemplates;
1310
1313
  if (fieldInfos) {
1311
- columnTemplates = columnTemplates ? columnTemplates.map(columnTemplate => {
1312
- fieldInfos.some(fieldInfo => {
1313
- if (fieldInfo.name === columnTemplate.fieldName) {
1314
- columnTemplate.label = fieldInfo.alias;
1315
- columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1316
- return true;
1314
+ columnTemplates = layerOption && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields)
1315
+ ? fieldInfos.reduce((prev, cur) => {
1316
+ if (layerOption.fields.indexOf(cur.name) > -1) {
1317
+ const template = {
1318
+ type: "field",
1319
+ fieldName: cur.name,
1320
+ label: cur.alias,
1321
+ menuConfig: this._getMenuConfig(cur.name)
1322
+ };
1323
+ prev.push(template);
1317
1324
  }
1325
+ return prev;
1326
+ }, []).sort(this._sortFields.bind(this, layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder))
1327
+ : fieldInfos.map(fieldInfo => {
1328
+ return {
1329
+ type: "field",
1330
+ fieldName: fieldInfo.name,
1331
+ label: fieldInfo.alias,
1332
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1333
+ };
1318
1334
  });
1319
- return columnTemplate;
1320
- }) : fieldInfos.map(fieldInfo => {
1321
- return {
1322
- type: "field",
1323
- fieldName: fieldInfo.name,
1324
- label: fieldInfo.alias,
1325
- menuConfig: this._getMenuConfig(fieldInfo.name)
1326
- };
1327
- });
1328
1335
  }
1329
- return columnTemplates;
1336
+ return fieldOrder ?
1337
+ columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.sort(this._sortFields.bind(this, fieldOrder)) :
1338
+ columnTemplates;
1339
+ }
1340
+ _sortFields(sorter, a, b) {
1341
+ return (sorter === null || sorter === void 0 ? void 0 : sorter.indexOf(a.fieldName)) - sorter.indexOf(b.fieldName);
1330
1342
  }
1331
1343
  /**
1332
1344
  * Get the menu config that adds the ability to hide the current column
@@ -1,19 +1,19 @@
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
-
17
- :host {
18
- display: block;
19
- }
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
+
17
+ :host {
18
+ display: block;
19
+ }
@@ -1,3 +1,3 @@
1
- :host {
2
- display: block;
3
- }
1
+ :host {
2
+ display: block;
3
+ }
@@ -1,12 +1,10 @@
1
1
  <html>
2
- <head>
3
- <meta charset="utf-8" />
4
- <meta
5
- name="viewport"
6
- content="initial-scale=1,maximum-scale=1,user-scalable=no"
7
- />
8
- <title>Crowdsource Manager</title>
9
- <!--
2
+
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
6
+ <title>Crowdsource Manager</title>
7
+ <!--
10
8
  | Copyright 2022 Esri
11
9
  |
12
10
  | Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,164 +19,188 @@
21
19
  | See the License for the specific language governing permissions and
22
20
  | limitations under the License.
23
21
  -->
24
- <style>
25
- .crowdsource {
26
- height: 100vh;
27
- width: 100vw;
28
- display: flex;
29
- }
30
- </style>
22
+ <style>
23
+ .crowdsource {
24
+ height: 100vh;
25
+ width: 100vw;
26
+ display: flex;
27
+ }
28
+ </style>
31
29
 
32
- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css" />
33
- <!-- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/dark/main.css" /> -->
34
- <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.0.0/calcite.css" />
30
+ <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css" />
31
+ <!-- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/dark/main.css" /> -->
32
+ <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.0.0/calcite.css" />
35
33
 
36
- <link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
37
- <link rel="stylesheet" href="../solutions-components.css" type="text/css">
34
+ <link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
35
+ <link rel="stylesheet" href="../solutions-components.css" type="text/css">
38
36
 
39
- <script src="https://jsdev.arcgis.com/4.29/"></script>
40
- <script type="module" src="../solutions-components.esm.js"></script>
37
+ <script src="https://jsdev.arcgis.com/4.29/"></script>
38
+ <script type="module" src="../solutions-components.esm.js"></script>
41
39
 
42
- <script>
43
- function addValues() {
44
- const demo = document.getElementById("demo");
40
+ <script>
41
+ function addValues() {
42
+ const demo = document.getElementById("demo");
45
43
 
46
- let headerSet = false;
47
- let custom = [];
48
- var vars = window.location.search.substring(1).split('&');
49
- vars.forEach((param) => {
50
- let vals = param.split('=');
51
- const v = vals[1];
52
- switch (vals[0]) {
53
- case "id":
54
- custom = [{
55
- id: v,
56
- name: "Map from URL"
57
- }];
58
- break;
59
- case "zoomAndScrollToSelected":
60
- demo.zoomAndScrollToSelected = v.toLocaleLowerCase() === "true";
61
- break;
62
- case "hideHeader":
63
- demo.hideHeader = v.toLocaleLowerCase() === "true";
64
- headerSet = true;
65
- break;
66
- default:
67
- break;
68
- }
69
- });
70
-
71
- if (!headerSet) {
72
- // Want the header to be disabled by default for IA
73
- // Want the header to be enabled by default for the demo app
74
- demo.hideHeader = false;
44
+ let headerSet = false;
45
+ let custom = [];
46
+ var vars = window.location.search.substring(1).split('&');
47
+ vars.forEach((param) => {
48
+ let vals = param.split('=');
49
+ const v = vals[1];
50
+ switch (vals[0]) {
51
+ case "id":
52
+ custom = [{
53
+ id: v,
54
+ name: "Map from URL"
55
+ }];
56
+ break;
57
+ case "zoomAndScrollToSelected":
58
+ demo.zoomAndScrollToSelected = v.toLocaleLowerCase() === "true";
59
+ break;
60
+ case "hideHeader":
61
+ demo.hideHeader = v.toLocaleLowerCase() === "true";
62
+ headerSet = true;
63
+ break;
64
+ default:
65
+ break;
75
66
  }
67
+ });
76
68
 
77
- demo.mapInfos = [
78
- ...custom,
79
- ...[{
80
- id: "ce3dec81bf714d3bb71da9691ab686d1",
81
- name: "Popup Configured Map",
82
- filterConfig: {
83
- mapId: "ce3dec81bf714d3bb71da9691ab686d1",
84
- layerExpressions: [
85
- {
86
- id: "Requests_681",
87
- title: "Requests",
88
- operator: " AND ",
89
- expressions: [
90
- {
91
- definitionExpression: "OBJECTID > 690",
92
- id: 1701793260225,
93
- index: 0,
94
- name: "greater than 690",
95
- active: false
96
- }
97
- ]
98
- }, {
99
- id: "Requets_6608",
100
- title: "Comments",
101
- operator: " AND ",
102
- expressions: [
103
- {
104
- definitionExpression: "OBJECTID > 1",
105
- id: 1701793260226,
106
- index: 0,
107
- name: "greater than 1",
108
- active: false
109
- }
110
- ]
111
- }
112
- ]
113
- }
114
- // filters: {},
115
- // layerInfos: [{
116
- // id: "Requests_681",
117
- // columnTemplates: [{
118
- // type: "field",
119
- // fieldName: "ObjectId",
120
- // visible: false
121
- // }, {
122
- // type: "field",
123
- // fieldName: "reqcategory",
124
- // label: "Request ID",
125
- // visible: true
126
- // }]
127
- // }, {
128
- // id: "Requets_6608",
129
- // columnTemplates: [{
130
- // type: "field",
131
- // fieldName: "requestglobalid",
132
- // visible: false
133
- // }, {
134
- // type: "field",
135
- // fieldName: "comments",
136
- // label: "Comments",
137
- // visible: true
138
- // }]
139
- // }]
140
- }, {
141
- id: "863e4f6f2a7840db896cc1b1606d552d",
142
- name: "IA map"
143
- }, {
144
- id: "3715f4899bea4b2a948347c5c2357e58",
145
- name: "PN Map"
146
- }, {
147
- id: "4fa949c89bb04ecb8a9f5ad119448333",
148
- name: "CS TIL DATA"
149
- }, {
150
- id: "f5b01c17a09941eaad63e7b4e6c7d880",
151
- name: "Attachments Map"
152
- }, {
153
- id: "b422923b7a4c4958b9788118255f2f0a",
154
- name: "Floor aware map"
155
- }, {
156
- id: "5dc8ae351ff34280a75f7ffe1115b36b",
157
- name: "Standalone table",
158
- filterConfig: {
159
- "mapId": "5dc8ae351ff34280a75f7ffe1115b36b",
160
- "layerExpressions": [{
161
- "id": "18c4a8cda15-layer-2",
162
- "title": "Table_1",
163
- "operator": " AND ",
164
- "expressions": [{
165
- "definitionExpression": "OBJECTID > 14",
166
- "id": 1702486334825,
167
- "index": 0,
168
- "name": "> 14",
169
- "active": false
170
- }]
171
- }]
172
- }
173
- }]
174
- ];
69
+ if (!headerSet) {
70
+ // Want the header to be disabled by default for IA
71
+ // Want the header to be enabled by default for the demo app
72
+ demo.hideHeader = false;
175
73
  }
176
- </script>
177
- </head>
178
74
 
179
- <!-- <body class="calcite-mode-dark" onload="addValues()"> -->
180
- <body onload="addValues()">
181
- <crowdsource-manager id="demo" class="crowdsource"/>
182
- <!-- <crowdsource-manager id="demo" class="crowdsource" theme="dark"/> -->
183
- </body>
75
+ demo.mapInfos = [
76
+ ...custom,
77
+ ...[{
78
+ id: "ce3dec81bf714d3bb71da9691ab686d1",
79
+ name: "Popup Configured Map",
80
+ filterConfig: {
81
+ mapId: "ce3dec81bf714d3bb71da9691ab686d1",
82
+ layerExpressions: [
83
+ {
84
+ id: "Requests_681",
85
+ title: "Requests",
86
+ operator: " AND ",
87
+ expressions: [
88
+ {
89
+ definitionExpression: "OBJECTID > 690",
90
+ id: 1701793260225,
91
+ index: 0,
92
+ name: "greater than 690",
93
+ active: false
94
+ }
95
+ ]
96
+ }, {
97
+ id: "Requets_6608",
98
+ title: "Comments",
99
+ operator: " AND ",
100
+ expressions: [
101
+ {
102
+ definitionExpression: "OBJECTID > 1",
103
+ id: 1701793260226,
104
+ index: 0,
105
+ name: "greater than 1",
106
+ active: false
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ }
112
+ }, {
113
+ id: "863e4f6f2a7840db896cc1b1606d552d",
114
+ name: "IA map"
115
+ }, {
116
+ id: "3715f4899bea4b2a948347c5c2357e58",
117
+ name: "PN Map"
118
+ }, {
119
+ id: "4fa949c89bb04ecb8a9f5ad119448333",
120
+ name: "CS TIL DATA"
121
+ }, {
122
+ id: "f5b01c17a09941eaad63e7b4e6c7d880",
123
+ name: "Attachments Map"
124
+ }, {
125
+ id: "b422923b7a4c4958b9788118255f2f0a",
126
+ name: "Floor aware map"
127
+ }, {
128
+ id: "5dc8ae351ff34280a75f7ffe1115b36b",
129
+ name: "Standalone table",
130
+ filterConfig: {
131
+ mapId: "5dc8ae351ff34280a75f7ffe1115b36b",
132
+ layerExpressions: [{
133
+ id: "18c4a8cda15-layer-2",
134
+ title: "Table_1",
135
+ operator: " AND ",
136
+ expressions: [{
137
+ definitionExpression: "OBJECTID > 14",
138
+ id: 1702486334825,
139
+ index: 0,
140
+ name: "> 14",
141
+ active: false
142
+ }]
143
+ }]
144
+ }
145
+ }, {
146
+ id: "91e220910a994da4abfb0d1763d64ecb",
147
+ name: "EditMultiLayers",
148
+ visible: true,
149
+ layerOptions: {
150
+ layers: [{
151
+ id: "18b1fb85a29-layer-3",
152
+ fields: [
153
+ "OBJECTID", "a", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "c"
154
+ ],
155
+ fieldOrder: [
156
+ "c", "b", "a", "OBJECTID", "Shape__Area", "Shape__Length", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"
157
+ ]
158
+ }, {
159
+ id: "18b1fb862df-layer-4",
160
+ fields: ["OBJECTID", "test"],
161
+ fieldOrder: ["test", "OBJECTID"]
162
+ }, {
163
+ id: "18b1fb82f0e-layer-2",
164
+ fields: [
165
+ "URL", "Avg_Stars", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
166
+ ],
167
+ fieldOrder: [
168
+ "Your_Stars", "Route", "Location", "URL", "Avg_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
169
+ ]
170
+ }],
171
+ mapId: "91e220910a994da4abfb0d1763d64ecb"
172
+ }
173
+ }, {
174
+ id: "7197542839d948258c7862b33f9d96ad",
175
+ name: "EditPolymap",
176
+ visible: true
177
+ }, {
178
+ id: "fbe7bb1907f34d5aa8771ad6475a1dfe",
179
+ name: "Mountain Project",
180
+ visible: true,
181
+ layerOptions: {
182
+ layers: [{
183
+ id: "18a6ffdeae9-layer-2",
184
+ fields: [
185
+ "URL", "Avg_Stars", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
186
+ ],
187
+ fieldOrder: [
188
+ "Avg_Stars", "Route", "Location", "URL", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
189
+ ]
190
+ }],
191
+ mapId: "fbe7bb1907f34d5aa8771ad6475a1dfe"
192
+ }
193
+ }]
194
+ ];
195
+ }
196
+ </script>
197
+ </head>
198
+
199
+ <!-- <body class="calcite-mode-dark" onload="addValues()"> -->
200
+
201
+ <body onload="addValues()">
202
+ <crowdsource-manager id="demo" class="crowdsource" />
203
+ <!-- <crowdsource-manager id="demo" class="crowdsource" theme="dark"/> -->
204
+ </body>
205
+
184
206
  </html>
@@ -450,14 +450,21 @@ export interface IMapInfo {
450
450
  name: string;
451
451
  searchConfiguration?: ISearchConfiguration;
452
452
  filterConfig?: IFilterConfig;
453
- layerInfos?: ILayerInfo[];
454
453
  _hasValidLayers?: boolean;
455
454
  visible?: boolean;
455
+ layerOptions?: ILayerOptions;
456
456
  }
457
457
 
458
- export interface ILayerInfo {
458
+ export interface ILayerOptions {
459
+ layers: ILayerDef[];
460
+ mapId?: string;
461
+ }
462
+
463
+ export interface ILayerDef {
459
464
  id: string;
460
- columnTemplates: __esri.FieldColumnTemplate[];
465
+ sublayerId?: number;
466
+ fields?: string[];
467
+ fieldOrder?: string[];
461
468
  }
462
469
 
463
470
  export interface IMapChange {