@esri/solutions-components 0.10.6 → 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,9 +68,10 @@ const InstantAppsControlPanel$1 = /*@__PURE__*/ proxyCustomElement(class Instant
68
68
  };
69
69
  }
70
70
  _getExpand(component) {
71
+ var _a;
71
72
  const { view } = this;
72
73
  const { content } = component;
73
- const expanded = false;
74
+ const expanded = (_a = component === null || component === void 0 ? void 0 : component.expanded) !== null && _a !== void 0 ? _a : false;
74
75
  return new this.Expand({ content, view, expanded, mode: MODE, group: GROUP });
75
76
  }
76
77
  _getComponentsNode() {
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { proxyCustomElement, HTMLElement as HTMLElement$1, h as h$2, Host, Fragment } from '@stencil/core/internal/client';
6
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, h as h$2, Host } from '@stencil/core/internal/client';
7
7
  import { c as createStore } from './index2.js';
8
8
  import { l as loadModules } from './loadModules2.js';
9
9
  import { g as getMessages } from './locale3.js';
@@ -21,6 +21,8 @@ const { state, onChange } = createStore({
21
21
  timeInfoItems: [],
22
22
  selectedTimeInfoItem: null,
23
23
  loading: true,
24
+ timeSliderConfig: {},
25
+ autoPlay: false,
24
26
  });
25
27
 
26
28
  /*
@@ -239,8 +241,8 @@ class InstantAppsTimeFilterViewModel {
239
241
  'esri/core/Handles',
240
242
  'esri/core/reactiveUtils',
241
243
  'esri/widgets/TimeSlider',
242
- 'esri/TimeExtent',
243
- 'esri/TimeInterval',
244
+ 'esri/time/TimeExtent',
245
+ 'esri/time/TimeInterval',
244
246
  'esri/layers/support/FeatureFilter',
245
247
  'esri/layers/support/FeatureEffect',
246
248
  ]);
@@ -255,8 +257,11 @@ class InstantAppsTimeFilterViewModel {
255
257
  catch (_a) { }
256
258
  }
257
259
  async init(timeSliderRef) {
260
+ var _a, _b;
258
261
  if (timeSliderRef)
259
262
  timeSliderRef.innerHTML = '';
263
+ if (((_b = (_a = state === null || state === void 0 ? void 0 : state.timeSlider) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.state) === 'playing')
264
+ state.timeSlider.stop();
260
265
  const { view, timeInfoConfigItems } = state;
261
266
  if (!view)
262
267
  return;
@@ -268,7 +273,7 @@ class InstantAppsTimeFilterViewModel {
268
273
  this.setupFilterModeWatcher();
269
274
  return Promise.resolve();
270
275
  }
271
- catch (_a) { }
276
+ catch (_c) { }
272
277
  }
273
278
  destroy() {
274
279
  var _a, _b;
@@ -313,6 +318,8 @@ class InstantAppsTimeFilterViewModel {
313
318
  state.selectedTimeInfoItem = initialTimeInfoItem;
314
319
  const config = this.getTimeSliderConfig(timeSliderRef);
315
320
  state.timeSlider = new TimeSlider(config);
321
+ if (state.autoPlay)
322
+ state.timeSlider.play();
316
323
  if (((_b = state.view) === null || _b === void 0 ? void 0 : _b.type) === '2d')
317
324
  this.initialize2DView();
318
325
  }
@@ -327,23 +334,16 @@ class InstantAppsTimeFilterViewModel {
327
334
  var _a;
328
335
  const [{ timeExtent, rangeStart, rangeEnd, unit }] = state.timeInfoItems;
329
336
  const { TimeExtent, TimeInterval } = this;
330
- return {
331
- container: timeSliderRef,
332
- fullTimeExtent: timeExtent,
333
- timeExtent: new TimeExtent({
337
+ const config = Object.assign({ container: timeSliderRef, fullTimeExtent: timeExtent, timeExtent: new TimeExtent({
334
338
  start: rangeStart,
335
339
  end: rangeEnd,
336
- }),
337
- mode: 'time-window',
338
- loop: true,
339
- stops: {
340
+ }), mode: 'time-window', stops: {
340
341
  interval: new TimeInterval({
341
342
  unit,
342
343
  value: 1,
343
344
  }),
344
- },
345
- view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null,
346
- };
345
+ }, view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null }, state.timeSliderConfig);
346
+ return config;
347
347
  }
348
348
  initialize2DView() {
349
349
  state.timeInfoItems.forEach(timeInfoItem => this.applyTimeExtent(timeInfoItem.layerView, new this.TimeExtent({ start: timeInfoItem.rangeStart, end: timeInfoItem.rangeEnd })));
@@ -451,6 +451,8 @@ const InstantAppsTimeFilter$1 = /*@__PURE__*/ proxyCustomElement(class InstantAp
451
451
  this.timeInfoConfigItems = [];
452
452
  this.filterMode = undefined;
453
453
  this.view = undefined;
454
+ this.timeSliderConfig = undefined;
455
+ this.autoPlay = false;
454
456
  }
455
457
  async updateTimeInfoConfigItems() {
456
458
  state.timeInfoConfigItems = this.timeInfoConfigItems;
@@ -459,10 +461,28 @@ const InstantAppsTimeFilter$1 = /*@__PURE__*/ proxyCustomElement(class InstantAp
459
461
  async updateFilterMode() {
460
462
  state.filterMode = this.filterMode;
461
463
  }
464
+ async updateTimeSliderConfig() {
465
+ state.timeSliderConfig = this.timeSliderConfig;
466
+ await viewModel.init(this.timeSliderRef);
467
+ }
468
+ async updateAutoPlay() {
469
+ state.autoPlay = this.autoPlay;
470
+ if (state.timeSlider) {
471
+ if (state.autoPlay) {
472
+ state.timeSlider.play();
473
+ }
474
+ else {
475
+ state.timeSlider.stop();
476
+ }
477
+ }
478
+ }
462
479
  async componentWillLoad() {
463
480
  try {
464
481
  state.view = this.view;
465
482
  state.timeInfoConfigItems = this.timeInfoConfigItems;
483
+ state.autoPlay = !!this.autoPlay;
484
+ if (this.timeSliderConfig)
485
+ state.timeSliderConfig = this.timeSliderConfig;
466
486
  if (this.filterMode)
467
487
  state.filterMode = this.filterMode;
468
488
  await getMessages(this);
@@ -483,17 +503,14 @@ const InstantAppsTimeFilter$1 = /*@__PURE__*/ proxyCustomElement(class InstantAp
483
503
  viewModel.destroy();
484
504
  }
485
505
  render() {
486
- return h$2(Host, { key: 'bf0887f83b19239ce1b81efad5c356c7edc05ba1' }, this._renderBase());
506
+ return h$2(Host, { key: '38a0569dba42d51846760bf75df36ee1c88d71b1' }, this._renderBase());
487
507
  }
488
508
  _renderBase() {
489
- return (h$2("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this._renderMain()));
490
- }
491
- _renderMain() {
492
- return (h$2(Fragment, null, this.view.type === '2d' && this._renderTopEl(), h$2("div", { ref: (ref) => (this.timeSliderRef = ref) })));
509
+ return (h$2("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this.view.type === '2d' && this._renderTopEl(), h$2("div", { key: "time-slider", ref: (ref) => (this.timeSliderRef = ref) })));
493
510
  }
494
511
  _renderLoader() {
495
512
  var _a, _b;
496
- return (state.loading && (h$2(Fragment, null, h$2("div", { class: CSS.background }), h$2("div", { class: CSS.loadingContainer }, h$2("calcite-loader", { scale: "m", label: (_a = this.messages) === null || _a === void 0 ? void 0 : _a.loading, text: (_b = this.messages) === null || _b === void 0 ? void 0 : _b.loading })))));
513
+ return (state.loading && (h$2("div", null, h$2("div", { class: CSS.background }), h$2("div", { class: CSS.loadingContainer }, h$2("calcite-loader", { scale: "m", label: (_a = this.messages) === null || _a === void 0 ? void 0 : _a.loading, text: (_b = this.messages) === null || _b === void 0 ? void 0 : _b.loading })))));
497
514
  }
498
515
  _renderTopEl() {
499
516
  const moreThanOneTimeLayer = this.timeInfoConfigItems.length > 1;
@@ -523,17 +540,23 @@ const InstantAppsTimeFilter$1 = /*@__PURE__*/ proxyCustomElement(class InstantAp
523
540
  get el() { return this; }
524
541
  static get watchers() { return {
525
542
  "timeInfoConfigItems": ["updateTimeInfoConfigItems"],
526
- "filterMode": ["updateFilterMode"]
543
+ "filterMode": ["updateFilterMode"],
544
+ "timeSliderConfig": ["updateTimeSliderConfig"],
545
+ "autoPlay": ["updateAutoPlay"]
527
546
  }; }
528
547
  static get style() { return InstantAppsTimeFilterStyle0; }
529
548
  }, [0, "instant-apps-time-filter", {
530
549
  "timeInfoConfigItems": [16],
531
550
  "filterMode": [16],
532
551
  "view": [16],
552
+ "timeSliderConfig": [16],
553
+ "autoPlay": [4, "auto-play"],
533
554
  "timeSliderRef": [32]
534
555
  }, undefined, {
535
556
  "timeInfoConfigItems": ["updateTimeInfoConfigItems"],
536
- "filterMode": ["updateFilterMode"]
557
+ "filterMode": ["updateFilterMode"],
558
+ "timeSliderConfig": ["updateTimeSliderConfig"],
559
+ "autoPlay": ["updateAutoPlay"]
537
560
  }]);
538
561
  function defineCustomElement$1() {
539
562
  if (typeof customElements === "undefined") {
@@ -68,9 +68,10 @@ const InstantAppsControlPanel = class {
68
68
  };
69
69
  }
70
70
  _getExpand(component) {
71
+ var _a;
71
72
  const { view } = this;
72
73
  const { content } = component;
73
- const expanded = false;
74
+ const expanded = (_a = component === null || component === void 0 ? void 0 : component.expanded) !== null && _a !== void 0 ? _a : false;
74
75
  return new this.Expand({ content, view, expanded, mode: MODE, group: GROUP });
75
76
  }
76
77
  _getComponentsNode() {
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { r as registerInstance, h as h$2, H as Host, F as Fragment, g as getElement } from './index-e3f04fa1.js';
6
+ import { r as registerInstance, h as h$2, H as Host, g as getElement } from './index-e3f04fa1.js';
7
7
  import { c as createStore } from './index-1dc14abf.js';
8
8
  import { l as loadModules } from './loadModules-03ba7abe.js';
9
9
  import { g as getMessages } from './locale-adb5ff0b.js';
@@ -19,6 +19,8 @@ const { state, onChange } = createStore({
19
19
  timeInfoItems: [],
20
20
  selectedTimeInfoItem: null,
21
21
  loading: true,
22
+ timeSliderConfig: {},
23
+ autoPlay: false,
22
24
  });
23
25
 
24
26
  /*
@@ -237,8 +239,8 @@ class InstantAppsTimeFilterViewModel {
237
239
  'esri/core/Handles',
238
240
  'esri/core/reactiveUtils',
239
241
  'esri/widgets/TimeSlider',
240
- 'esri/TimeExtent',
241
- 'esri/TimeInterval',
242
+ 'esri/time/TimeExtent',
243
+ 'esri/time/TimeInterval',
242
244
  'esri/layers/support/FeatureFilter',
243
245
  'esri/layers/support/FeatureEffect',
244
246
  ]);
@@ -253,8 +255,11 @@ class InstantAppsTimeFilterViewModel {
253
255
  catch (_a) { }
254
256
  }
255
257
  async init(timeSliderRef) {
258
+ var _a, _b;
256
259
  if (timeSliderRef)
257
260
  timeSliderRef.innerHTML = '';
261
+ if (((_b = (_a = state === null || state === void 0 ? void 0 : state.timeSlider) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.state) === 'playing')
262
+ state.timeSlider.stop();
258
263
  const { view, timeInfoConfigItems } = state;
259
264
  if (!view)
260
265
  return;
@@ -266,7 +271,7 @@ class InstantAppsTimeFilterViewModel {
266
271
  this.setupFilterModeWatcher();
267
272
  return Promise.resolve();
268
273
  }
269
- catch (_a) { }
274
+ catch (_c) { }
270
275
  }
271
276
  destroy() {
272
277
  var _a, _b;
@@ -311,6 +316,8 @@ class InstantAppsTimeFilterViewModel {
311
316
  state.selectedTimeInfoItem = initialTimeInfoItem;
312
317
  const config = this.getTimeSliderConfig(timeSliderRef);
313
318
  state.timeSlider = new TimeSlider(config);
319
+ if (state.autoPlay)
320
+ state.timeSlider.play();
314
321
  if (((_b = state.view) === null || _b === void 0 ? void 0 : _b.type) === '2d')
315
322
  this.initialize2DView();
316
323
  }
@@ -325,23 +332,16 @@ class InstantAppsTimeFilterViewModel {
325
332
  var _a;
326
333
  const [{ timeExtent, rangeStart, rangeEnd, unit }] = state.timeInfoItems;
327
334
  const { TimeExtent, TimeInterval } = this;
328
- return {
329
- container: timeSliderRef,
330
- fullTimeExtent: timeExtent,
331
- timeExtent: new TimeExtent({
335
+ const config = Object.assign({ container: timeSliderRef, fullTimeExtent: timeExtent, timeExtent: new TimeExtent({
332
336
  start: rangeStart,
333
337
  end: rangeEnd,
334
- }),
335
- mode: 'time-window',
336
- loop: true,
337
- stops: {
338
+ }), mode: 'time-window', stops: {
338
339
  interval: new TimeInterval({
339
340
  unit,
340
341
  value: 1,
341
342
  }),
342
- },
343
- view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null,
344
- };
343
+ }, view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null }, state.timeSliderConfig);
344
+ return config;
345
345
  }
346
346
  initialize2DView() {
347
347
  state.timeInfoItems.forEach(timeInfoItem => this.applyTimeExtent(timeInfoItem.layerView, new this.TimeExtent({ start: timeInfoItem.rangeStart, end: timeInfoItem.rangeEnd })));
@@ -448,6 +448,8 @@ const InstantAppsTimeFilter = class {
448
448
  this.timeInfoConfigItems = [];
449
449
  this.filterMode = undefined;
450
450
  this.view = undefined;
451
+ this.timeSliderConfig = undefined;
452
+ this.autoPlay = false;
451
453
  }
452
454
  async updateTimeInfoConfigItems() {
453
455
  state.timeInfoConfigItems = this.timeInfoConfigItems;
@@ -456,10 +458,28 @@ const InstantAppsTimeFilter = class {
456
458
  async updateFilterMode() {
457
459
  state.filterMode = this.filterMode;
458
460
  }
461
+ async updateTimeSliderConfig() {
462
+ state.timeSliderConfig = this.timeSliderConfig;
463
+ await viewModel.init(this.timeSliderRef);
464
+ }
465
+ async updateAutoPlay() {
466
+ state.autoPlay = this.autoPlay;
467
+ if (state.timeSlider) {
468
+ if (state.autoPlay) {
469
+ state.timeSlider.play();
470
+ }
471
+ else {
472
+ state.timeSlider.stop();
473
+ }
474
+ }
475
+ }
459
476
  async componentWillLoad() {
460
477
  try {
461
478
  state.view = this.view;
462
479
  state.timeInfoConfigItems = this.timeInfoConfigItems;
480
+ state.autoPlay = !!this.autoPlay;
481
+ if (this.timeSliderConfig)
482
+ state.timeSliderConfig = this.timeSliderConfig;
463
483
  if (this.filterMode)
464
484
  state.filterMode = this.filterMode;
465
485
  await getMessages(this);
@@ -480,17 +500,14 @@ const InstantAppsTimeFilter = class {
480
500
  viewModel.destroy();
481
501
  }
482
502
  render() {
483
- return h$2(Host, { key: 'bf0887f83b19239ce1b81efad5c356c7edc05ba1' }, this._renderBase());
503
+ return h$2(Host, { key: '38a0569dba42d51846760bf75df36ee1c88d71b1' }, this._renderBase());
484
504
  }
485
505
  _renderBase() {
486
- return (h$2("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this._renderMain()));
487
- }
488
- _renderMain() {
489
- return (h$2(Fragment, null, this.view.type === '2d' && this._renderTopEl(), h$2("div", { ref: (ref) => (this.timeSliderRef = ref) })));
506
+ return (h$2("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this.view.type === '2d' && this._renderTopEl(), h$2("div", { key: "time-slider", ref: (ref) => (this.timeSliderRef = ref) })));
490
507
  }
491
508
  _renderLoader() {
492
509
  var _a, _b;
493
- return (state.loading && (h$2(Fragment, null, h$2("div", { class: CSS.background }), h$2("div", { class: CSS.loadingContainer }, h$2("calcite-loader", { scale: "m", label: (_a = this.messages) === null || _a === void 0 ? void 0 : _a.loading, text: (_b = this.messages) === null || _b === void 0 ? void 0 : _b.loading })))));
510
+ return (state.loading && (h$2("div", null, h$2("div", { class: CSS.background }), h$2("div", { class: CSS.loadingContainer }, h$2("calcite-loader", { scale: "m", label: (_a = this.messages) === null || _a === void 0 ? void 0 : _a.loading, text: (_b = this.messages) === null || _b === void 0 ? void 0 : _b.loading })))));
494
511
  }
495
512
  _renderTopEl() {
496
513
  const moreThanOneTimeLayer = this.timeInfoConfigItems.length > 1;
@@ -520,7 +537,9 @@ const InstantAppsTimeFilter = class {
520
537
  get el() { return getElement(this); }
521
538
  static get watchers() { return {
522
539
  "timeInfoConfigItems": ["updateTimeInfoConfigItems"],
523
- "filterMode": ["updateFilterMode"]
540
+ "filterMode": ["updateFilterMode"],
541
+ "timeSliderConfig": ["updateTimeSliderConfig"],
542
+ "autoPlay": ["updateAutoPlay"]
524
543
  }; }
525
544
  };
526
545
  InstantAppsTimeFilter.style = InstantAppsTimeFilterStyle0;