inviton-powerduck 0.0.196 → 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() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.196",
4
+ "version": "0.0.199",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",