@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.
@@ -72,9 +72,10 @@ const InstantAppsControlPanel = class {
72
72
  };
73
73
  }
74
74
  _getExpand(component) {
75
+ var _a;
75
76
  const { view } = this;
76
77
  const { content } = component;
77
- const expanded = false;
78
+ const expanded = (_a = component === null || component === void 0 ? void 0 : component.expanded) !== null && _a !== void 0 ? _a : false;
78
79
  return new this.Expand({ content, view, expanded, mode: MODE, group: GROUP });
79
80
  }
80
81
  _getComponentsNode() {
@@ -23,6 +23,8 @@ const { state, onChange } = index.createStore({
23
23
  timeInfoItems: [],
24
24
  selectedTimeInfoItem: null,
25
25
  loading: true,
26
+ timeSliderConfig: {},
27
+ autoPlay: false,
26
28
  });
27
29
 
28
30
  /*
@@ -241,8 +243,8 @@ class InstantAppsTimeFilterViewModel {
241
243
  'esri/core/Handles',
242
244
  'esri/core/reactiveUtils',
243
245
  'esri/widgets/TimeSlider',
244
- 'esri/TimeExtent',
245
- 'esri/TimeInterval',
246
+ 'esri/time/TimeExtent',
247
+ 'esri/time/TimeInterval',
246
248
  'esri/layers/support/FeatureFilter',
247
249
  'esri/layers/support/FeatureEffect',
248
250
  ]);
@@ -257,8 +259,11 @@ class InstantAppsTimeFilterViewModel {
257
259
  catch (_a) { }
258
260
  }
259
261
  async init(timeSliderRef) {
262
+ var _a, _b;
260
263
  if (timeSliderRef)
261
264
  timeSliderRef.innerHTML = '';
265
+ 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')
266
+ state.timeSlider.stop();
262
267
  const { view, timeInfoConfigItems } = state;
263
268
  if (!view)
264
269
  return;
@@ -270,7 +275,7 @@ class InstantAppsTimeFilterViewModel {
270
275
  this.setupFilterModeWatcher();
271
276
  return Promise.resolve();
272
277
  }
273
- catch (_a) { }
278
+ catch (_c) { }
274
279
  }
275
280
  destroy() {
276
281
  var _a, _b;
@@ -315,6 +320,8 @@ class InstantAppsTimeFilterViewModel {
315
320
  state.selectedTimeInfoItem = initialTimeInfoItem;
316
321
  const config = this.getTimeSliderConfig(timeSliderRef);
317
322
  state.timeSlider = new TimeSlider(config);
323
+ if (state.autoPlay)
324
+ state.timeSlider.play();
318
325
  if (((_b = state.view) === null || _b === void 0 ? void 0 : _b.type) === '2d')
319
326
  this.initialize2DView();
320
327
  }
@@ -329,23 +336,16 @@ class InstantAppsTimeFilterViewModel {
329
336
  var _a;
330
337
  const [{ timeExtent, rangeStart, rangeEnd, unit }] = state.timeInfoItems;
331
338
  const { TimeExtent, TimeInterval } = this;
332
- return {
333
- container: timeSliderRef,
334
- fullTimeExtent: timeExtent,
335
- timeExtent: new TimeExtent({
339
+ const config = Object.assign({ container: timeSliderRef, fullTimeExtent: timeExtent, timeExtent: new TimeExtent({
336
340
  start: rangeStart,
337
341
  end: rangeEnd,
338
- }),
339
- mode: 'time-window',
340
- loop: true,
341
- stops: {
342
+ }), mode: 'time-window', stops: {
342
343
  interval: new TimeInterval({
343
344
  unit,
344
345
  value: 1,
345
346
  }),
346
- },
347
- view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null,
348
- };
347
+ }, view: ((_a = state.view) === null || _a === void 0 ? void 0 : _a.type) === '3d' ? state.view : null }, state.timeSliderConfig);
348
+ return config;
349
349
  }
350
350
  initialize2DView() {
351
351
  state.timeInfoItems.forEach(timeInfoItem => this.applyTimeExtent(timeInfoItem.layerView, new this.TimeExtent({ start: timeInfoItem.rangeStart, end: timeInfoItem.rangeEnd })));
@@ -452,6 +452,8 @@ const InstantAppsTimeFilter = class {
452
452
  this.timeInfoConfigItems = [];
453
453
  this.filterMode = undefined;
454
454
  this.view = undefined;
455
+ this.timeSliderConfig = undefined;
456
+ this.autoPlay = false;
455
457
  }
456
458
  async updateTimeInfoConfigItems() {
457
459
  state.timeInfoConfigItems = this.timeInfoConfigItems;
@@ -460,10 +462,28 @@ const InstantAppsTimeFilter = class {
460
462
  async updateFilterMode() {
461
463
  state.filterMode = this.filterMode;
462
464
  }
465
+ async updateTimeSliderConfig() {
466
+ state.timeSliderConfig = this.timeSliderConfig;
467
+ await viewModel.init(this.timeSliderRef);
468
+ }
469
+ async updateAutoPlay() {
470
+ state.autoPlay = this.autoPlay;
471
+ if (state.timeSlider) {
472
+ if (state.autoPlay) {
473
+ state.timeSlider.play();
474
+ }
475
+ else {
476
+ state.timeSlider.stop();
477
+ }
478
+ }
479
+ }
463
480
  async componentWillLoad() {
464
481
  try {
465
482
  state.view = this.view;
466
483
  state.timeInfoConfigItems = this.timeInfoConfigItems;
484
+ state.autoPlay = !!this.autoPlay;
485
+ if (this.timeSliderConfig)
486
+ state.timeSliderConfig = this.timeSliderConfig;
467
487
  if (this.filterMode)
468
488
  state.filterMode = this.filterMode;
469
489
  await locale.getMessages(this);
@@ -484,17 +504,14 @@ const InstantAppsTimeFilter = class {
484
504
  viewModel.destroy();
485
505
  }
486
506
  render() {
487
- return index$1.h(index$1.Host, { key: 'bf0887f83b19239ce1b81efad5c356c7edc05ba1' }, this._renderBase());
507
+ return index$1.h(index$1.Host, { key: '38a0569dba42d51846760bf75df36ee1c88d71b1' }, this._renderBase());
488
508
  }
489
509
  _renderBase() {
490
- return (index$1.h("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this._renderMain()));
491
- }
492
- _renderMain() {
493
- return (index$1.h(index$1.Fragment, null, this.view.type === '2d' && this._renderTopEl(), index$1.h("div", { ref: (ref) => (this.timeSliderRef = ref) })));
510
+ return (index$1.h("div", { class: `${CSS.base}${this.view.type !== '2d' ? CSS.threeD : ''}` }, this._renderLoader(), this.view.type === '2d' && this._renderTopEl(), index$1.h("div", { key: "time-slider", ref: (ref) => (this.timeSliderRef = ref) })));
494
511
  }
495
512
  _renderLoader() {
496
513
  var _a, _b;
497
- return (state.loading && (index$1.h(index$1.Fragment, null, index$1.h("div", { class: CSS.background }), index$1.h("div", { class: CSS.loadingContainer }, index$1.h("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 })))));
514
+ return (state.loading && (index$1.h("div", null, index$1.h("div", { class: CSS.background }), index$1.h("div", { class: CSS.loadingContainer }, index$1.h("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 })))));
498
515
  }
499
516
  _renderTopEl() {
500
517
  const moreThanOneTimeLayer = this.timeInfoConfigItems.length > 1;
@@ -524,7 +541,9 @@ const InstantAppsTimeFilter = class {
524
541
  get el() { return index$1.getElement(this); }
525
542
  static get watchers() { return {
526
543
  "timeInfoConfigItems": ["updateTimeInfoConfigItems"],
527
- "filterMode": ["updateFilterMode"]
544
+ "filterMode": ["updateFilterMode"],
545
+ "timeSliderConfig": ["updateTimeSliderConfig"],
546
+ "autoPlay": ["updateAutoPlay"]
528
547
  }; }
529
548
  };
530
549
  InstantAppsTimeFilter.style = InstantAppsTimeFilterStyle0;