@esri/solutions-components 0.8.29 → 0.8.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,23 +31,22 @@ export class FloorFilter {
31
31
  // Watch handlers
32
32
  //
33
33
  //--------------------------------------------------------------------------
34
+ /**
35
+ * Watch for changes to the mapView and re-init the floor filter
36
+ */
34
37
  async mapViewWatchHandler() {
35
- console.log("mapViewWatchHandler FF");
36
- const webMap = this.mapView.map;
37
- await webMap.when(() => {
38
- console.log("webMap.when FF");
39
- if (this.floorFilterWidget) {
40
- this.floorFilterWidget.destroy();
41
- this.floorFilterWidget = undefined;
42
- console.log("floorFilterWidget destroyed");
43
- }
44
- if (this._floorFilterElement) {
45
- this._floorFilterElement.remove();
46
- this._floorFilterElement = document.createElement("div");
47
- console.log("this._floorFilterElement created");
48
- }
49
- this._initFloorFilter(this.mapView, webMap);
50
- });
38
+ await this._initFloorFilter(this.mapView);
39
+ }
40
+ /**
41
+ * Watch for changes to the enabled property and re-init or destroy the floor filter
42
+ */
43
+ async enabledWatchHandler() {
44
+ if (this.enabled) {
45
+ await this._initFloorFilter(this.mapView);
46
+ }
47
+ else if (!this.enabled) {
48
+ this._destroyWidget();
49
+ }
51
50
  }
52
51
  //--------------------------------------------------------------------------
53
52
  //
@@ -60,8 +59,11 @@ export class FloorFilter {
60
59
  async componentWillLoad() {
61
60
  return this._initModules();
62
61
  }
62
+ /**
63
+ * Renders the component.
64
+ */
63
65
  render() {
64
- return (h(Host, { key: 'df3c419f3eaf30590c44c4919f0eeddfc333b81d' }, h("div", { key: '8496099f3bc35f34db6e47f73870ead9144df0a4', ref: (el) => { this._floorFilterElement = el; } })));
66
+ return (h(Host, { key: 'c80a8d46fb48f3789d9fa09c2400faad49e2e236' }, h("div", { key: '82919a3ba061a17c8aeaa0d2f6f4f13bc428b519', ref: (el) => { this._floorFilterElement = el; } })));
65
67
  }
66
68
  //--------------------------------------------------------------------------
67
69
  //
@@ -83,32 +85,54 @@ export class FloorFilter {
83
85
  this.FloorFilter = FloorFilter;
84
86
  this.reactiveUtils = reactiveUtils;
85
87
  }
88
+ /**
89
+ * Destroy the widget and remove the containing element if it exists
90
+ *
91
+ * @protected
92
+ */
93
+ _destroyWidget() {
94
+ if (this.floorFilterWidget) {
95
+ this.floorFilterWidget.destroy();
96
+ this.floorFilterWidget = undefined;
97
+ }
98
+ if (this._floorFilterElement) {
99
+ this._floorFilterElement.remove();
100
+ }
101
+ }
102
+ /**
103
+ * Destroy the widget and remove the containing element then re-create the container element
104
+ *
105
+ * @protected
106
+ */
107
+ _initContainer() {
108
+ this._destroyWidget();
109
+ this._floorFilterElement = document.createElement("div");
110
+ }
86
111
  /**
87
112
  * Initialize the floor filter or reset the current view if it already exists
88
113
  */
89
- _initFloorFilter(view, webMap) {
90
- var _a, _b, _c;
91
- console.log("_initFloorFilter");
92
- console.log(`view: ${view}`);
93
- console.log(`this.enabled: ${this.enabled}`);
94
- console.log(`this.FloorFilter: ${this.FloorFilter}`);
95
- console.log(`webMap?.floorInfo: ${webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo}`);
114
+ async _initFloorFilter(view) {
115
+ const webMap = view === null || view === void 0 ? void 0 : view.map;
96
116
  if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
97
- this.floorFilterWidget = new this.FloorFilter({
98
- container: this._floorFilterElement,
99
- view
100
- });
101
- (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
102
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
103
- this.facilityChanged.emit(facility);
104
- });
105
- (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
106
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
107
- this.levelChanged.emit(level);
108
- });
109
- (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
110
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
111
- this.siteChanged.emit(site);
117
+ this._initContainer();
118
+ await webMap.when(() => {
119
+ var _a, _b, _c;
120
+ this.floorFilterWidget = new this.FloorFilter({
121
+ container: this._floorFilterElement,
122
+ view
123
+ });
124
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
125
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
126
+ this.facilityChanged.emit(facility);
127
+ });
128
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
129
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
130
+ this.levelChanged.emit(level);
131
+ });
132
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
133
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
134
+ this.siteChanged.emit(site);
135
+ });
112
136
  });
113
137
  }
114
138
  }
@@ -238,6 +262,9 @@ export class FloorFilter {
238
262
  return [{
239
263
  "propName": "mapView",
240
264
  "methodName": "mapViewWatchHandler"
265
+ }, {
266
+ "propName": "enabled",
267
+ "methodName": "enabledWatchHandler"
241
268
  }];
242
269
  }
243
270
  }
@@ -26,23 +26,22 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
26
26
  // Watch handlers
27
27
  //
28
28
  //--------------------------------------------------------------------------
29
+ /**
30
+ * Watch for changes to the mapView and re-init the floor filter
31
+ */
29
32
  async mapViewWatchHandler() {
30
- console.log("mapViewWatchHandler FF");
31
- const webMap = this.mapView.map;
32
- await webMap.when(() => {
33
- console.log("webMap.when FF");
34
- if (this.floorFilterWidget) {
35
- this.floorFilterWidget.destroy();
36
- this.floorFilterWidget = undefined;
37
- console.log("floorFilterWidget destroyed");
38
- }
39
- if (this._floorFilterElement) {
40
- this._floorFilterElement.remove();
41
- this._floorFilterElement = document.createElement("div");
42
- console.log("this._floorFilterElement created");
43
- }
44
- this._initFloorFilter(this.mapView, webMap);
45
- });
33
+ await this._initFloorFilter(this.mapView);
34
+ }
35
+ /**
36
+ * Watch for changes to the enabled property and re-init or destroy the floor filter
37
+ */
38
+ async enabledWatchHandler() {
39
+ if (this.enabled) {
40
+ await this._initFloorFilter(this.mapView);
41
+ }
42
+ else if (!this.enabled) {
43
+ this._destroyWidget();
44
+ }
46
45
  }
47
46
  //--------------------------------------------------------------------------
48
47
  //
@@ -55,8 +54,11 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
55
54
  async componentWillLoad() {
56
55
  return this._initModules();
57
56
  }
57
+ /**
58
+ * Renders the component.
59
+ */
58
60
  render() {
59
- return (h(Host, { key: 'df3c419f3eaf30590c44c4919f0eeddfc333b81d' }, h("div", { key: '8496099f3bc35f34db6e47f73870ead9144df0a4', ref: (el) => { this._floorFilterElement = el; } })));
61
+ return (h(Host, { key: 'c80a8d46fb48f3789d9fa09c2400faad49e2e236' }, h("div", { key: '82919a3ba061a17c8aeaa0d2f6f4f13bc428b519', ref: (el) => { this._floorFilterElement = el; } })));
60
62
  }
61
63
  //--------------------------------------------------------------------------
62
64
  //
@@ -78,38 +80,61 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
78
80
  this.FloorFilter = FloorFilter;
79
81
  this.reactiveUtils = reactiveUtils;
80
82
  }
83
+ /**
84
+ * Destroy the widget and remove the containing element if it exists
85
+ *
86
+ * @protected
87
+ */
88
+ _destroyWidget() {
89
+ if (this.floorFilterWidget) {
90
+ this.floorFilterWidget.destroy();
91
+ this.floorFilterWidget = undefined;
92
+ }
93
+ if (this._floorFilterElement) {
94
+ this._floorFilterElement.remove();
95
+ }
96
+ }
97
+ /**
98
+ * Destroy the widget and remove the containing element then re-create the container element
99
+ *
100
+ * @protected
101
+ */
102
+ _initContainer() {
103
+ this._destroyWidget();
104
+ this._floorFilterElement = document.createElement("div");
105
+ }
81
106
  /**
82
107
  * Initialize the floor filter or reset the current view if it already exists
83
108
  */
84
- _initFloorFilter(view, webMap) {
85
- var _a, _b, _c;
86
- console.log("_initFloorFilter");
87
- console.log(`view: ${view}`);
88
- console.log(`this.enabled: ${this.enabled}`);
89
- console.log(`this.FloorFilter: ${this.FloorFilter}`);
90
- console.log(`webMap?.floorInfo: ${webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo}`);
109
+ async _initFloorFilter(view) {
110
+ const webMap = view === null || view === void 0 ? void 0 : view.map;
91
111
  if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
92
- this.floorFilterWidget = new this.FloorFilter({
93
- container: this._floorFilterElement,
94
- view
95
- });
96
- (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
97
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
98
- this.facilityChanged.emit(facility);
99
- });
100
- (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
101
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
102
- this.levelChanged.emit(level);
103
- });
104
- (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
105
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
106
- this.siteChanged.emit(site);
112
+ this._initContainer();
113
+ await webMap.when(() => {
114
+ var _a, _b, _c;
115
+ this.floorFilterWidget = new this.FloorFilter({
116
+ container: this._floorFilterElement,
117
+ view
118
+ });
119
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
120
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
121
+ this.facilityChanged.emit(facility);
122
+ });
123
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
124
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
125
+ this.levelChanged.emit(level);
126
+ });
127
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
128
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
129
+ this.siteChanged.emit(site);
130
+ });
107
131
  });
108
132
  }
109
133
  }
110
134
  get el() { return this; }
111
135
  static get watchers() { return {
112
- "mapView": ["mapViewWatchHandler"]
136
+ "mapView": ["mapViewWatchHandler"],
137
+ "enabled": ["enabledWatchHandler"]
113
138
  }; }
114
139
  static get style() { return FloorFilterStyle0; }
115
140
  }, [1, "floor-filter", {
@@ -117,7 +142,8 @@ const FloorFilter = /*@__PURE__*/ proxyCustomElement(class FloorFilter extends H
117
142
  "floorFilterWidget": [16],
118
143
  "mapView": [16]
119
144
  }, undefined, {
120
- "mapView": ["mapViewWatchHandler"]
145
+ "mapView": ["mapViewWatchHandler"],
146
+ "enabled": ["enabledWatchHandler"]
121
147
  }]);
122
148
  function defineCustomElement() {
123
149
  if (typeof customElements === "undefined") {
@@ -132,23 +132,22 @@ const FloorFilter = class {
132
132
  // Watch handlers
133
133
  //
134
134
  //--------------------------------------------------------------------------
135
+ /**
136
+ * Watch for changes to the mapView and re-init the floor filter
137
+ */
135
138
  async mapViewWatchHandler() {
136
- console.log("mapViewWatchHandler FF");
137
- const webMap = this.mapView.map;
138
- await webMap.when(() => {
139
- console.log("webMap.when FF");
140
- if (this.floorFilterWidget) {
141
- this.floorFilterWidget.destroy();
142
- this.floorFilterWidget = undefined;
143
- console.log("floorFilterWidget destroyed");
144
- }
145
- if (this._floorFilterElement) {
146
- this._floorFilterElement.remove();
147
- this._floorFilterElement = document.createElement("div");
148
- console.log("this._floorFilterElement created");
149
- }
150
- this._initFloorFilter(this.mapView, webMap);
151
- });
139
+ await this._initFloorFilter(this.mapView);
140
+ }
141
+ /**
142
+ * Watch for changes to the enabled property and re-init or destroy the floor filter
143
+ */
144
+ async enabledWatchHandler() {
145
+ if (this.enabled) {
146
+ await this._initFloorFilter(this.mapView);
147
+ }
148
+ else if (!this.enabled) {
149
+ this._destroyWidget();
150
+ }
152
151
  }
153
152
  //--------------------------------------------------------------------------
154
153
  //
@@ -161,8 +160,11 @@ const FloorFilter = class {
161
160
  async componentWillLoad() {
162
161
  return this._initModules();
163
162
  }
163
+ /**
164
+ * Renders the component.
165
+ */
164
166
  render() {
165
- return (h(Host, { key: 'df3c419f3eaf30590c44c4919f0eeddfc333b81d' }, h("div", { key: '8496099f3bc35f34db6e47f73870ead9144df0a4', ref: (el) => { this._floorFilterElement = el; } })));
167
+ return (h(Host, { key: 'c80a8d46fb48f3789d9fa09c2400faad49e2e236' }, h("div", { key: '82919a3ba061a17c8aeaa0d2f6f4f13bc428b519', ref: (el) => { this._floorFilterElement = el; } })));
166
168
  }
167
169
  //--------------------------------------------------------------------------
168
170
  //
@@ -184,38 +186,61 @@ const FloorFilter = class {
184
186
  this.FloorFilter = FloorFilter;
185
187
  this.reactiveUtils = reactiveUtils;
186
188
  }
189
+ /**
190
+ * Destroy the widget and remove the containing element if it exists
191
+ *
192
+ * @protected
193
+ */
194
+ _destroyWidget() {
195
+ if (this.floorFilterWidget) {
196
+ this.floorFilterWidget.destroy();
197
+ this.floorFilterWidget = undefined;
198
+ }
199
+ if (this._floorFilterElement) {
200
+ this._floorFilterElement.remove();
201
+ }
202
+ }
203
+ /**
204
+ * Destroy the widget and remove the containing element then re-create the container element
205
+ *
206
+ * @protected
207
+ */
208
+ _initContainer() {
209
+ this._destroyWidget();
210
+ this._floorFilterElement = document.createElement("div");
211
+ }
187
212
  /**
188
213
  * Initialize the floor filter or reset the current view if it already exists
189
214
  */
190
- _initFloorFilter(view, webMap) {
191
- var _a, _b, _c;
192
- console.log("_initFloorFilter");
193
- console.log(`view: ${view}`);
194
- console.log(`this.enabled: ${this.enabled}`);
195
- console.log(`this.FloorFilter: ${this.FloorFilter}`);
196
- console.log(`webMap?.floorInfo: ${webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo}`);
215
+ async _initFloorFilter(view) {
216
+ const webMap = view === null || view === void 0 ? void 0 : view.map;
197
217
  if (view && this.enabled && this.FloorFilter && (webMap === null || webMap === void 0 ? void 0 : webMap.floorInfo)) {
198
- this.floorFilterWidget = new this.FloorFilter({
199
- container: this._floorFilterElement,
200
- view
201
- });
202
- (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
203
- this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
204
- this.facilityChanged.emit(facility);
205
- });
206
- (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
207
- this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
208
- this.levelChanged.emit(level);
209
- });
210
- (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
211
- this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
212
- this.siteChanged.emit(site);
218
+ this._initContainer();
219
+ await webMap.when(() => {
220
+ var _a, _b, _c;
221
+ this.floorFilterWidget = new this.FloorFilter({
222
+ container: this._floorFilterElement,
223
+ view
224
+ });
225
+ (_a = this._facilityHandle) === null || _a === void 0 ? void 0 : _a.remove();
226
+ this._facilityHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.facility, (facility) => {
227
+ this.facilityChanged.emit(facility);
228
+ });
229
+ (_b = this._levelHandle) === null || _b === void 0 ? void 0 : _b.remove();
230
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
231
+ this.levelChanged.emit(level);
232
+ });
233
+ (_c = this._siteHandle) === null || _c === void 0 ? void 0 : _c.remove();
234
+ this._siteHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.site, (site) => {
235
+ this.siteChanged.emit(site);
236
+ });
213
237
  });
214
238
  }
215
239
  }
216
240
  get el() { return getElement(this); }
217
241
  static get watchers() { return {
218
- "mapView": ["mapViewWatchHandler"]
242
+ "mapView": ["mapViewWatchHandler"],
243
+ "enabled": ["enabledWatchHandler"]
219
244
  }; }
220
245
  };
221
246
  FloorFilter.style = FloorFilterStyle0;