inviton-powerduck 0.0.195 → 0.0.199

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -178,8 +178,8 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
178
178
  return;
179
179
  }
180
180
 
181
- const $elem = this.getInputElement();
182
181
  if (!this.useModalMode()) {
182
+ const $elem = this.getInputElement();
183
183
  this.bindDateRangePicker(
184
184
  $elem,
185
185
  this.calendarPlacement,
@@ -190,29 +190,7 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
190
190
  );
191
191
  } else {
192
192
  this.getInputElement().parent().on('click', async () => {
193
- const uuid = `drp-modal-${PortalUtils.randomString(6)}`;
194
- const handle = await DialogUtils.showDialogEx({
195
- title: this.label || '',
196
- cssClass: 'daterangepicker-modal pd-modal-mobile-input',
197
- message: `<div><div id="${uuid}"></div></div>`,
198
- buttons: [],
199
- onHidden: () => {
200
- this.tryDestroyPickerInstance();
201
- },
202
- });
203
-
204
- const $modalRoot = $(document.getElementById(uuid));
205
- this.bindDateRangePicker(
206
- $elem,
207
- 'inline',
208
- true,
209
- true,
210
- () => {
211
- this.raiseChangedEvent();
212
- handle.hideModal();
213
- },
214
- $modalRoot,
215
- );
193
+ this.openInModal();
216
194
  });
217
195
  }
218
196
  }
@@ -375,6 +353,37 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
375
353
  }, 0);
376
354
  }
377
355
 
356
+ async openInModal(args?: { title: string }) {
357
+ const uuid = `drp-modal-${PortalUtils.randomString(6)}`;
358
+ const handle = await DialogUtils.showDialogEx({
359
+ title: args?.title ?? this.label ?? '',
360
+ cssClass: 'daterangepicker-modal pd-modal-mobile-input',
361
+ message: `<div><div id="${uuid}"></div></div>`,
362
+ buttons: [],
363
+ onHidden: () => {
364
+ this.tryDestroyPickerInstance();
365
+ },
366
+ });
367
+
368
+ setTimeout(() => {
369
+ this.$nextTick(() => {
370
+ const $elem = this.getInputElement();
371
+ const $modalRoot = $(document.getElementById(uuid));
372
+ this.bindDateRangePicker(
373
+ $elem,
374
+ 'inline',
375
+ true,
376
+ true,
377
+ () => {
378
+ this.raiseChangedEvent();
379
+ handle.hideModal();
380
+ },
381
+ $modalRoot,
382
+ );
383
+ });
384
+ }, 1);
385
+ }
386
+
378
387
  close(ms?: number): void {
379
388
  const $elem = this.getInputElement();
380
389
 
@@ -600,9 +600,7 @@ import { globalState } from '../../../../app/global-state';
600
600
 
601
601
  init_datepicker.call(this);
602
602
 
603
- if (opt.alwaysOpen) {
604
- open(0);
605
- }
603
+
606
604
 
607
605
  // expose some api
608
606
  $(this).data('dateRangePicker', {
@@ -1272,6 +1270,10 @@ import { globalState } from '../../../../app/global-state';
1272
1270
  min,
1273
1271
  );
1274
1272
  });
1273
+
1274
+ if (opt.alwaysOpen) {
1275
+ open(0);
1276
+ }
1275
1277
  }
1276
1278
 
1277
1279
  function calcPosition() {
@@ -1,6 +1,7 @@
1
1
  import { Prop, toNative } from 'vue-facing-decorator';
2
2
  import PowerduckState from '../../app/powerduck-state';
3
3
  import TsxComponent, { Component } from '../../app/vuetsx';
4
+ import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
4
5
  import Button from '../button/button';
5
6
  import { ButtonLayout } from '../button/button-layout';
6
7
  import FlexContainer from '../form/flex-container';
@@ -9,13 +10,13 @@ import Modal, { ModalSize } from '../modal/modal';
9
10
  import ModalBody from '../modal/modal-body';
10
11
  import ModalFooter from '../modal/modal-footer';
11
12
  import './css/mobile-optimized-hero-filter.css';
12
- import { isNullOrEmpty } from '@powerduck/common/utils/is-null-or-empty';
13
13
 
14
14
  interface MobileOptimizedHeroFilterArgs {
15
15
  caption: string;
16
16
  isLoading?: boolean;
17
17
  cssClass?: string;
18
- placeholder?: string
18
+ placeholder?: string;
19
+ useIntersectionObserver?: boolean;
19
20
  clearFilterText?: string;
20
21
  submitText?: string;
21
22
  clickedClear?: () => void;
@@ -34,7 +35,8 @@ class MobileOptimizedHeroFilterComponent extends TsxComponent<MobileOptimizedHer
34
35
  @Prop() caption: string;
35
36
  @Prop() isLoading: boolean;
36
37
  @Prop() cssClass?: string;
37
- @Prop() placeholder?: string
38
+ @Prop() placeholder?: string;
39
+ @Prop() useIntersectionObserver?: boolean;
38
40
  @Prop() clearFilterText?: string;
39
41
  @Prop() clickedClear?: () => void;
40
42
  @Prop() clickedSubmit?: () => void;
@@ -45,6 +47,26 @@ class MobileOptimizedHeroFilterComponent extends TsxComponent<MobileOptimizedHer
45
47
  @Prop() mobileSecondLineText: string;
46
48
  @Prop() mobileModalSize?: ModalSize;
47
49
 
50
+ mounted() {
51
+ if (this.useIntersectionObserver) {
52
+ this.$nextTick(() => {
53
+ const observer = new IntersectionObserver(([e]) => {
54
+ e.target.toggleAttribute('data-stuck', e.intersectionRatio < 1);
55
+ }, { threshold: [1] });
56
+
57
+ observer.observe(this.$el);
58
+ (this as any)._observer = observer;
59
+ });
60
+ }
61
+ }
62
+
63
+ beforeUnmount(): void {
64
+ if ((this as any)._observer != null) {
65
+ ((this as any)._observer as IntersectionObserver).disconnect();
66
+ (this as any)._observer = null;
67
+ }
68
+ }
69
+
48
70
  showFilterModal() {
49
71
  this.getModal().show();
50
72
  }
@@ -83,7 +105,7 @@ class MobileOptimizedHeroFilterComponent extends TsxComponent<MobileOptimizedHer
83
105
  <div class="mohf-input-first-line-text">{firstLine}</div>
84
106
 
85
107
  {this.mobileSecondLineText?.length > 0
86
- && <div class="mohf-input-second-line-text">{this.mobileSecondLineText}</div>}
108
+ && <div class="mohf-input-second-line-text">{this.mobileSecondLineText}</div>}
87
109
 
88
110
  </div>
89
111
  </FlexFormItem>
@@ -108,16 +130,16 @@ class MobileOptimizedHeroFilterComponent extends TsxComponent<MobileOptimizedHer
108
130
  </ModalBody>
109
131
  <ModalFooter>
110
132
  {this.mobileShowClearFilters
111
- && (
112
- <Button
113
- layout={ButtonLayout.Secondary}
114
- text={this.clearFilterText}
115
- fullWidth={true}
116
- clicked={() => {
117
- this.clickedClear();
118
- }}
119
- />
120
- )}
133
+ && (
134
+ <Button
135
+ layout={ButtonLayout.Secondary}
136
+ text={this.clearFilterText}
137
+ fullWidth={true}
138
+ clicked={() => {
139
+ this.clickedClear();
140
+ }}
141
+ />
142
+ )}
121
143
  <Button
122
144
  layout={ButtonLayout.Primary}
123
145
  text={PowerduckState.getResourceValue('search')}
@@ -1,11 +1,10 @@
1
1
  import type { VNode } from 'vue';
2
2
  import type { ModalOnBeforeShownArgs, ModalOnShownArgs } from './modal-utils';
3
- import { isNullOrEmpty } from '@powerduck/common/utils/is-null-or-empty';
4
3
  import { Modal as BootstrapModal } from 'bootstrap';
5
4
  import { Prop, toNative } from 'vue-facing-decorator';
6
- import { globalState } from '../../app/global-state';
7
5
  import PowerduckState from '../../app/powerduck-state';
8
6
  import TsxComponent, { Component } from '../../app/vuetsx';
7
+ import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
9
8
  import { PortalUtils } from '../../common/utils/utils';
10
9
  import LoadingIndicator from '../loading-indicator';
11
10
  import Teleport from '../teleport/teleport';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.195",
4
+ "version": "0.0.199",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",