@esri/solutions-components 0.7.47 → 0.7.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -123,7 +123,9 @@ const floorFilterCss = ":host{display:block}";
123
123
  const FloorFilter = class {
124
124
  constructor(hostRef) {
125
125
  index.registerInstance(this, hostRef);
126
+ this.facilityChanged = index.createEvent(this, "facilityChanged", 7);
126
127
  this.levelChanged = index.createEvent(this, "levelChanged", 7);
128
+ this.siteChanged = index.createEvent(this, "siteChanged", 7);
127
129
  this.enabled = undefined;
128
130
  this.floorFilterWidget = undefined;
129
131
  this.mapView = undefined;
@@ -176,22 +178,28 @@ const FloorFilter = class {
176
178
  * Initialize the floor filter or reset the current view if it already exists
177
179
  */
178
180
  _initFloorFilter(view) {
179
- var _a;
181
+ var _a, _b, _c, _d;
180
182
  if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
181
183
  if (!this.floorFilterWidget) {
182
184
  this.floorFilterWidget = new this.FloorFilter({
183
185
  container: this._floorFilterElement,
184
186
  view
185
187
  });
186
- if (this._levelHandle) {
187
- this._levelHandle.remove();
188
- }
188
+ (_b = this._facilityHandle) === null || _b === void 0 ? void 0 : _b.remove();
189
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
190
+ this.facilityChanged.emit(facility);
191
+ });
192
+ (_c = this._levelHandle) === null || _c === void 0 ? void 0 : _c.remove();
189
193
  this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
190
194
  this.levelChanged.emit(level);
191
195
  });
196
+ (_d = this._siteHandle) === null || _d === void 0 ? void 0 : _d.remove();
197
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
198
+ this.siteChanged.emit(site);
199
+ });
192
200
  }
193
201
  else {
194
- this.floorFilterWidget.view = view;
202
+ this.floorFilterWidget.viewModel.view = view;
195
203
  }
196
204
  }
197
205
  }
@@ -252,6 +252,7 @@ const LayerTable = class {
252
252
  this._mapClickHandle.remove();
253
253
  }
254
254
  if (this.mapView) {
255
+ this._floorExpression = undefined;
255
256
  this._updateShareUrl();
256
257
  this._mapClickHandle = this.reactiveUtils.on(() => this.mapView, "click", (event) => {
257
258
  void this._mapClicked(event);
@@ -320,6 +321,13 @@ const LayerTable = class {
320
321
  }
321
322
  await this._refresh();
322
323
  }
324
+ /**
325
+ * Refresh the table when floor filter facility is changed
326
+ */
327
+ async facilityChanged(evt) {
328
+ this._floorFacility = evt.detail;
329
+ this._updateFloorDefinitionExpression();
330
+ }
323
331
  /**
324
332
  * Refresh the table when floor filter level is changed
325
333
  */
@@ -327,6 +335,13 @@ const LayerTable = class {
327
335
  this._floorLevel = evt.detail;
328
336
  this._updateFloorDefinitionExpression();
329
337
  }
338
+ /**
339
+ * Refresh the table when floor filter site is changed
340
+ */
341
+ async siteChanged(evt) {
342
+ this._floorSite = evt.detail;
343
+ this._updateFloorDefinitionExpression();
344
+ }
330
345
  /**
331
346
  * Refresh the table when
332
347
  */
@@ -623,7 +638,12 @@ const LayerTable = class {
623
638
  */
624
639
  _updateFloorDefinitionExpression() {
625
640
  if (this._floorField && this._floorLevel) {
626
- this._layer.definitionExpression = `${this._floorField} = '${this._floorLevel}'`;
641
+ const floorExp = `${this._floorField} = '${this._floorLevel}'`;
642
+ const defExp = this._layer.definitionExpression;
643
+ this._layer.definitionExpression = (defExp === null || defExp === void 0 ? void 0 : defExp.indexOf(this._floorExpression)) > -1 ?
644
+ defExp.replace(this._floorExpression, floorExp) :
645
+ defExp ? `${defExp} AND (${floorExp})` : floorExp;
646
+ this._floorExpression = floorExp;
627
647
  }
628
648
  }
629
649
  /**
@@ -1226,7 +1246,15 @@ const LayerTable = class {
1226
1246
  * Check if the layers definitionExpression has been modified
1227
1247
  */
1228
1248
  _handleFilterUpdate() {
1229
- this._filterActive = this._definitionExpression !== this._layer.definitionExpression;
1249
+ const defExp = this._layer.definitionExpression;
1250
+ if (this._floorExpression) {
1251
+ const regEx = new RegExp(`${this._floorField} = ['].+[']`, "gm");
1252
+ this._layer.definitionExpression = defExp && this._floorField && defExp.indexOf(`${this._floorField} = '`) > -1 ?
1253
+ defExp.replace(regEx, this._floorExpression) : defExp ?
1254
+ `${defExp} AND (${this._floorExpression})` : this._floorExpression;
1255
+ }
1256
+ this._filterActive = this._definitionExpression !== this._layer.definitionExpression &&
1257
+ (this._floorExpression ? this._layer.definitionExpression !== this._floorExpression : true);
1230
1258
  this._updateShareUrl();
1231
1259
  }
1232
1260
  /**
@@ -1314,7 +1342,10 @@ const LayerTable = class {
1314
1342
  const layerExpressions = (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.layerExpressions;
1315
1343
  this._layerExpressions = layerExpressions ? layerExpressions.filter((exp) => { var _a; return exp.id === ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id); }) : [];
1316
1344
  this._filterList.layerExpressions = this._layerExpressions;
1317
- this._filterActive = false;
1345
+ this._filterActive = this._layerExpressions.filter(lyrExp => {
1346
+ console.log(lyrExp);
1347
+ return lyrExp.expressions.filter(exp => exp.active).length > 0;
1348
+ }).length > 0;
1318
1349
  }
1319
1350
  /**
1320
1351
  * Select all rows that are not currently selectd