@esri/solutions-components 0.7.46 → 0.7.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,22 +74,28 @@ export class FloorFilter {
74
74
  * Initialize the floor filter or reset the current view if it already exists
75
75
  */
76
76
  _initFloorFilter(view) {
77
- var _a;
77
+ var _a, _b, _c, _d;
78
78
  if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
79
79
  if (!this.floorFilterWidget) {
80
80
  this.floorFilterWidget = new this.FloorFilter({
81
81
  container: this._floorFilterElement,
82
82
  view
83
83
  });
84
- if (this._levelHandle) {
85
- this._levelHandle.remove();
86
- }
84
+ (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
85
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
86
+ this.facilityChanged.emit(facility);
87
+ });
88
+ (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
87
89
  this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
88
90
  this.levelChanged.emit(level);
89
91
  });
92
+ (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
93
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
94
+ this.siteChanged.emit(site);
95
+ });
90
96
  }
91
97
  else {
92
- this.floorFilterWidget.view = view;
98
+ this.floorFilterWidget.viewModel.view = view;
93
99
  }
94
100
  }
95
101
  }
@@ -168,6 +174,21 @@ export class FloorFilter {
168
174
  }
169
175
  static get events() {
170
176
  return [{
177
+ "method": "facilityChanged",
178
+ "name": "facilityChanged",
179
+ "bubbles": true,
180
+ "cancelable": true,
181
+ "composed": true,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Emitted on demand when the Facility is changed"
185
+ },
186
+ "complexType": {
187
+ "original": "string",
188
+ "resolved": "string",
189
+ "references": {}
190
+ }
191
+ }, {
171
192
  "method": "levelChanged",
172
193
  "name": "levelChanged",
173
194
  "bubbles": true,
@@ -182,6 +203,21 @@ export class FloorFilter {
182
203
  "resolved": "string",
183
204
  "references": {}
184
205
  }
206
+ }, {
207
+ "method": "siteChanged",
208
+ "name": "siteChanged",
209
+ "bubbles": true,
210
+ "cancelable": true,
211
+ "composed": true,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": "Emitted on demand when the Site is changed"
215
+ },
216
+ "complexType": {
217
+ "original": "string",
218
+ "resolved": "string",
219
+ "references": {}
220
+ }
185
221
  }];
186
222
  }
187
223
  static get elementRef() { return "el"; }
@@ -167,6 +167,7 @@ export class LayerTable {
167
167
  this._mapClickHandle.remove();
168
168
  }
169
169
  if (this.mapView) {
170
+ this._floorExpression = undefined;
170
171
  this._updateShareUrl();
171
172
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
172
173
  void this._mapClicked(event);
@@ -235,6 +236,13 @@ export class LayerTable {
235
236
  }
236
237
  await this._refresh();
237
238
  }
239
+ /**
240
+ * Refresh the table when floor filter facility is changed
241
+ */
242
+ async facilityChanged(evt) {
243
+ this._floorFacility = evt.detail;
244
+ this._updateFloorDefinitionExpression();
245
+ }
238
246
  /**
239
247
  * Refresh the table when floor filter level is changed
240
248
  */
@@ -242,6 +250,13 @@ export class LayerTable {
242
250
  this._floorLevel = evt.detail;
243
251
  this._updateFloorDefinitionExpression();
244
252
  }
253
+ /**
254
+ * Refresh the table when floor filter site is changed
255
+ */
256
+ async siteChanged(evt) {
257
+ this._floorSite = evt.detail;
258
+ this._updateFloorDefinitionExpression();
259
+ }
245
260
  /**
246
261
  * Refresh the table when
247
262
  */
@@ -538,7 +553,12 @@ export class LayerTable {
538
553
  */
539
554
  _updateFloorDefinitionExpression() {
540
555
  if (this._floorField && this._floorLevel) {
541
- this._layer.definitionExpression = `${this._floorField} = '${this._floorLevel}'`;
556
+ const floorExp = `${this._floorField} = '${this._floorLevel}'`;
557
+ const defExp = this._layer.definitionExpression;
558
+ this._layer.definitionExpression = (defExp === null || defExp === void 0 ? void 0 : defExp.indexOf(this._floorExpression)) > -1 ?
559
+ defExp.replace(this._floorExpression, floorExp) :
560
+ defExp ? `${defExp} AND (${floorExp})` : floorExp;
561
+ this._floorExpression = floorExp;
542
562
  }
543
563
  }
544
564
  /**
@@ -1141,7 +1161,15 @@ export class LayerTable {
1141
1161
  * Check if the layers definitionExpression has been modified
1142
1162
  */
1143
1163
  _handleFilterUpdate() {
1144
- this._filterActive = this._definitionExpression !== this._layer.definitionExpression;
1164
+ const defExp = this._layer.definitionExpression;
1165
+ if (this._floorExpression) {
1166
+ const regEx = new RegExp(`${this._floorField} = ['].+[']`, "gm");
1167
+ this._layer.definitionExpression = defExp && this._floorField && defExp.indexOf(`${this._floorField} = '`) > -1 ?
1168
+ defExp.replace(regEx, this._floorExpression) : defExp ?
1169
+ `${defExp} AND (${this._floorExpression})` : this._floorExpression;
1170
+ }
1171
+ this._filterActive = this._definitionExpression !== this._layer.definitionExpression &&
1172
+ (this._floorExpression ? this._layer.definitionExpression !== this._floorExpression : true);
1145
1173
  this._updateShareUrl();
1146
1174
  }
1147
1175
  /**
@@ -1229,7 +1257,10 @@ export class LayerTable {
1229
1257
  const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1230
1258
  this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => { var _a; return exp.id === ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id); }) : [];
1231
1259
  this._filterList.layerExpressions = this._layerExpressions;
1232
- this._filterActive = false;
1260
+ this._filterActive = this._layerExpressions.filter(lyrExp => {
1261
+ console.log(lyrExp);
1262
+ return lyrExp.expressions.filter(exp => exp.active).length > 0;
1263
+ }).length > 0;
1233
1264
  }
1234
1265
  /**
1235
1266
  * Select all rows that are not currently selectd
@@ -1817,12 +1848,24 @@ export class LayerTable {
1817
1848
  "target": "window",
1818
1849
  "capture": false,
1819
1850
  "passive": false
1851
+ }, {
1852
+ "name": "facilityChanged",
1853
+ "method": "facilityChanged",
1854
+ "target": "window",
1855
+ "capture": false,
1856
+ "passive": false
1820
1857
  }, {
1821
1858
  "name": "levelChanged",
1822
1859
  "method": "levelChanged",
1823
1860
  "target": "window",
1824
1861
  "capture": false,
1825
1862
  "passive": false
1863
+ }, {
1864
+ "name": "siteChanged",
1865
+ "method": "siteChanged",
1866
+ "target": "window",
1867
+ "capture": false,
1868
+ "passive": false
1826
1869
  }, {
1827
1870
  "name": "noLayersFound",
1828
1871
  "method": "noLayersFound",
@@ -38,6 +38,12 @@
38
38
  <script type="module" src="../solutions-components.esm.js"></script>
39
39
 
40
40
  <script>
41
+ // require(["esri/config"], (
42
+ // esriConfig
43
+ // ) => {
44
+ // esriConfig.portalUrl = "https://holistic.mapsdevext.arcgis.com";
45
+ // });
46
+
41
47
  function addValues() {
42
48
  const demo = document.getElementById("demo");
43
49
 
@@ -13,7 +13,9 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
13
13
  super();
14
14
  this.__registerHost();
15
15
  this.__attachShadow();
16
+ this.facilityChanged = createEvent(this, "facilityChanged", 7);
16
17
  this.levelChanged = createEvent(this, "levelChanged", 7);
18
+ this.siteChanged = createEvent(this, "siteChanged", 7);
17
19
  this.enabled = undefined;
18
20
  this.floorFilterWidget = undefined;
19
21
  this.mapView = undefined;
@@ -66,22 +68,28 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
66
68
  * Initialize the floor filter or reset the current view if it already exists
67
69
  */
68
70
  _initFloorFilter(view) {
69
- var _a;
71
+ var _a, _b, _c, _d;
70
72
  if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
71
73
  if (!this.floorFilterWidget) {
72
74
  this.floorFilterWidget = new this.FloorFilter({
73
75
  container: this._floorFilterElement,
74
76
  view
75
77
  });
76
- if (this._levelHandle) {
77
- this._levelHandle.remove();
78
- }
78
+ (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
79
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
80
+ this.facilityChanged.emit(facility);
81
+ });
82
+ (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
79
83
  this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
80
84
  this.levelChanged.emit(level);
81
85
  });
86
+ (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
87
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
88
+ this.siteChanged.emit(site);
89
+ });
82
90
  }
83
91
  else {
84
- this.floorFilterWidget.view = view;
92
+ this.floorFilterWidget.viewModel.view = view;
85
93
  }
86
94
  }
87
95
  }
@@ -196,6 +196,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
196
196
  this._mapClickHandle.remove();
197
197
  }
198
198
  if (this.mapView) {
199
+ this._floorExpression = undefined;
199
200
  this._updateShareUrl();
200
201
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
201
202
  void this._mapClicked(event);
@@ -264,6 +265,13 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
264
265
  }
265
266
  await this._refresh();
266
267
  }
268
+ /**
269
+ * Refresh the table when floor filter facility is changed
270
+ */
271
+ async facilityChanged(evt) {
272
+ this._floorFacility = evt.detail;
273
+ this._updateFloorDefinitionExpression();
274
+ }
267
275
  /**
268
276
  * Refresh the table when floor filter level is changed
269
277
  */
@@ -271,6 +279,13 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
271
279
  this._floorLevel = evt.detail;
272
280
  this._updateFloorDefinitionExpression();
273
281
  }
282
+ /**
283
+ * Refresh the table when floor filter site is changed
284
+ */
285
+ async siteChanged(evt) {
286
+ this._floorSite = evt.detail;
287
+ this._updateFloorDefinitionExpression();
288
+ }
274
289
  /**
275
290
  * Refresh the table when
276
291
  */
@@ -567,7 +582,12 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
567
582
  */
568
583
  _updateFloorDefinitionExpression() {
569
584
  if (this._floorField && this._floorLevel) {
570
- this._layer.definitionExpression = `${this._floorField} = '${this._floorLevel}'`;
585
+ const floorExp = `${this._floorField} = '${this._floorLevel}'`;
586
+ const defExp = this._layer.definitionExpression;
587
+ this._layer.definitionExpression = (defExp === null || defExp === void 0 ? void 0 : defExp.indexOf(this._floorExpression)) > -1 ?
588
+ defExp.replace(this._floorExpression, floorExp) :
589
+ defExp ? `${defExp} AND (${floorExp})` : floorExp;
590
+ this._floorExpression = floorExp;
571
591
  }
572
592
  }
573
593
  /**
@@ -1170,7 +1190,15 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1170
1190
  * Check if the layers definitionExpression has been modified
1171
1191
  */
1172
1192
  _handleFilterUpdate() {
1173
- this._filterActive = this._definitionExpression !== this._layer.definitionExpression;
1193
+ const defExp = this._layer.definitionExpression;
1194
+ if (this._floorExpression) {
1195
+ const regEx = new RegExp(`${this._floorField} = ['].+[']`, "gm");
1196
+ this._layer.definitionExpression = defExp && this._floorField && defExp.indexOf(`${this._floorField} = '`) > -1 ?
1197
+ defExp.replace(regEx, this._floorExpression) : defExp ?
1198
+ `${defExp} AND (${this._floorExpression})` : this._floorExpression;
1199
+ }
1200
+ this._filterActive = this._definitionExpression !== this._layer.definitionExpression &&
1201
+ (this._floorExpression ? this._layer.definitionExpression !== this._floorExpression : true);
1174
1202
  this._updateShareUrl();
1175
1203
  }
1176
1204
  /**
@@ -1258,7 +1286,10 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1258
1286
  const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1259
1287
  this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => { var _a; return exp.id === ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id); }) : [];
1260
1288
  this._filterList.layerExpressions = this._layerExpressions;
1261
- this._filterActive = false;
1289
+ this._filterActive = this._layerExpressions.filter(lyrExp => {
1290
+ console.log(lyrExp);
1291
+ return lyrExp.expressions.filter(exp => exp.active).length > 0;
1292
+ }).length > 0;
1262
1293
  }
1263
1294
  /**
1264
1295
  * Select all rows that are not currently selectd
@@ -1484,7 +1515,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1484
1515
  "_showOnlySelected": [32],
1485
1516
  "_toolInfos": [32],
1486
1517
  "_translations": [32]
1487
- }, [[8, "selectionChanged", "selectionChanged"], [8, "editsComplete", "editsComplete"], [8, "levelChanged", "levelChanged"], [8, "noLayersFound", "noLayersFound"]], {
1518
+ }, [[8, "selectionChanged", "selectionChanged"], [8, "editsComplete", "editsComplete"], [8, "facilityChanged", "facilityChanged"], [8, "levelChanged", "levelChanged"], [8, "siteChanged", "siteChanged"], [8, "noLayersFound", "noLayersFound"]], {
1488
1519
  "enableCSV": ["enableCSVWatchHandler"],
1489
1520
  "enableInlineEdit": ["enableInlineEditWatchHandler"],
1490
1521
  "enableShare": ["enableShareWatchHandler"],
@@ -119,7 +119,9 @@ const floorFilterCss = ":host{display:block}";
119
119
  const FloorFilter = class {
120
120
  constructor(hostRef) {
121
121
  registerInstance(this, hostRef);
122
+ this.facilityChanged = createEvent(this, "facilityChanged", 7);
122
123
  this.levelChanged = createEvent(this, "levelChanged", 7);
124
+ this.siteChanged = createEvent(this, "siteChanged", 7);
123
125
  this.enabled = undefined;
124
126
  this.floorFilterWidget = undefined;
125
127
  this.mapView = undefined;
@@ -172,22 +174,28 @@ const FloorFilter = class {
172
174
  * Initialize the floor filter or reset the current view if it already exists
173
175
  */
174
176
  _initFloorFilter(view) {
175
- var _a;
177
+ var _a, _b, _c, _d;
176
178
  if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
177
179
  if (!this.floorFilterWidget) {
178
180
  this.floorFilterWidget = new this.FloorFilter({
179
181
  container: this._floorFilterElement,
180
182
  view
181
183
  });
182
- if (this._levelHandle) {
183
- this._levelHandle.remove();
184
- }
184
+ (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
185
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
186
+ this.facilityChanged.emit(facility);
187
+ });
188
+ (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
185
189
  this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
186
190
  this.levelChanged.emit(level);
187
191
  });
192
+ (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
193
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
194
+ this.siteChanged.emit(site);
195
+ });
188
196
  }
189
197
  else {
190
- this.floorFilterWidget.view = view;
198
+ this.floorFilterWidget.viewModel.view = view;
191
199
  }
192
200
  }
193
201
  }
@@ -248,6 +248,7 @@ const LayerTable = class {
248
248
  this._mapClickHandle.remove();
249
249
  }
250
250
  if (this.mapView) {
251
+ this._floorExpression = undefined;
251
252
  this._updateShareUrl();
252
253
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
253
254
  void this._mapClicked(event);
@@ -316,6 +317,13 @@ const LayerTable = class {
316
317
  }
317
318
  await this._refresh();
318
319
  }
320
+ /**
321
+ * Refresh the table when floor filter facility is changed
322
+ */
323
+ async facilityChanged(evt) {
324
+ this._floorFacility = evt.detail;
325
+ this._updateFloorDefinitionExpression();
326
+ }
319
327
  /**
320
328
  * Refresh the table when floor filter level is changed
321
329
  */
@@ -323,6 +331,13 @@ const LayerTable = class {
323
331
  this._floorLevel = evt.detail;
324
332
  this._updateFloorDefinitionExpression();
325
333
  }
334
+ /**
335
+ * Refresh the table when floor filter site is changed
336
+ */
337
+ async siteChanged(evt) {
338
+ this._floorSite = evt.detail;
339
+ this._updateFloorDefinitionExpression();
340
+ }
326
341
  /**
327
342
  * Refresh the table when
328
343
  */
@@ -619,7 +634,12 @@ const LayerTable = class {
619
634
  */
620
635
  _updateFloorDefinitionExpression() {
621
636
  if (this._floorField && this._floorLevel) {
622
- this._layer.definitionExpression = `${this._floorField} = '${this._floorLevel}'`;
637
+ const floorExp = `${this._floorField} = '${this._floorLevel}'`;
638
+ const defExp = this._layer.definitionExpression;
639
+ this._layer.definitionExpression = (defExp === null || defExp === void 0 ? void 0 : defExp.indexOf(this._floorExpression)) > -1 ?
640
+ defExp.replace(this._floorExpression, floorExp) :
641
+ defExp ? `${defExp} AND (${floorExp})` : floorExp;
642
+ this._floorExpression = floorExp;
623
643
  }
624
644
  }
625
645
  /**
@@ -1222,7 +1242,15 @@ const LayerTable = class {
1222
1242
  * Check if the layers definitionExpression has been modified
1223
1243
  */
1224
1244
  _handleFilterUpdate() {
1225
- this._filterActive = this._definitionExpression !== this._layer.definitionExpression;
1245
+ const defExp = this._layer.definitionExpression;
1246
+ if (this._floorExpression) {
1247
+ const regEx = new RegExp(`${this._floorField} = ['].+[']`, "gm");
1248
+ this._layer.definitionExpression = defExp && this._floorField && defExp.indexOf(`${this._floorField} = '`) > -1 ?
1249
+ defExp.replace(regEx, this._floorExpression) : defExp ?
1250
+ `${defExp} AND (${this._floorExpression})` : this._floorExpression;
1251
+ }
1252
+ this._filterActive = this._definitionExpression !== this._layer.definitionExpression &&
1253
+ (this._floorExpression ? this._layer.definitionExpression !== this._floorExpression : true);
1226
1254
  this._updateShareUrl();
1227
1255
  }
1228
1256
  /**
@@ -1310,7 +1338,10 @@ const LayerTable = class {
1310
1338
  const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1311
1339
  this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => { var _a; return exp.id === ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id); }) : [];
1312
1340
  this._filterList.layerExpressions = this._layerExpressions;
1313
- this._filterActive = false;
1341
+ this._filterActive = this._layerExpressions.filter(lyrExp => {
1342
+ console.log(lyrExp);
1343
+ return lyrExp.expressions.filter(exp => exp.active).length > 0;
1344
+ }).length > 0;
1314
1345
  }
1315
1346
  /**
1316
1347
  * Select all rows that are not currently selectd