inviton-powerduck 0.0.196 → 0.0.200

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.
@@ -51,6 +51,7 @@ interface DaterangePickerArgs extends FormItemWrapperArgs {
51
51
  singleDate?: boolean;
52
52
  pickerRootCssClass?: string;
53
53
  maxDate?: Temporal.PlainDateTime;
54
+ forceModalMode?: boolean;
54
55
  prevIcon?: string;
55
56
  nextIcon?: string;
56
57
  hideYearInMonthName?: boolean;
@@ -106,6 +107,7 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
106
107
  @Prop() alwaysOpen!: boolean;
107
108
  @Prop() singleDate!: boolean;
108
109
  @Prop() pickerRootCssClass!: string;
110
+ @Prop() forceModalMode?: boolean;
109
111
  @Prop() wrap!: boolean;
110
112
  @Prop() hint: string;
111
113
  @Prop() appendIcon: string;
@@ -178,8 +180,8 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
178
180
  return;
179
181
  }
180
182
 
181
- const $elem = this.getInputElement();
182
183
  if (!this.useModalMode()) {
184
+ const $elem = this.getInputElement();
183
185
  this.bindDateRangePicker(
184
186
  $elem,
185
187
  this.calendarPlacement,
@@ -190,29 +192,7 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
190
192
  );
191
193
  } else {
192
194
  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
- );
195
+ this.openInModal();
216
196
  });
217
197
  }
218
198
  }
@@ -226,6 +206,10 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
226
206
  }
227
207
 
228
208
  useModalMode(): boolean {
209
+ if (this.forceModalMode) {
210
+ return true;
211
+ }
212
+
229
213
  if (this.alwaysOpen && (this.calendarPlacement != null && this.calendarPlacement != 'body')) {
230
214
  return false;
231
215
  }
@@ -375,6 +359,45 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
375
359
  }, 0);
376
360
  }
377
361
 
362
+ async openInModal(args?: { title: string }) {
363
+ const uuid = `drp-modal-${PortalUtils.randomString(6)}`;
364
+ const handle = await DialogUtils.showDialogEx({
365
+ title: args?.title ?? this.label ?? '',
366
+ cssClass: 'daterangepicker-modal pd-modal-mobile-input',
367
+ message: `<div><div id="${uuid}"></div></div>`,
368
+ buttons: [],
369
+ onHidden: () => {
370
+ this.tryDestroyPickerInstance();
371
+ },
372
+ });
373
+
374
+ setTimeout(() => {
375
+ this.$nextTick(() => {
376
+ setTimeout(() => {
377
+ this.$nextTick(() => {
378
+ const $elem = this.getInputElement();
379
+ const $modalRoot = $(document.getElementById(uuid));
380
+
381
+ (window as any)._elem = $elem;
382
+ (window as any)._modalRoot = $modalRoot;
383
+
384
+ this.bindDateRangePicker(
385
+ $elem,
386
+ 'inline',
387
+ true,
388
+ true,
389
+ () => {
390
+ this.raiseChangedEvent();
391
+ handle.hideModal();
392
+ },
393
+ $modalRoot,
394
+ );
395
+ });
396
+ }, 1);
397
+ });
398
+ }, 1);
399
+ }
400
+
378
401
  close(ms?: number): void {
379
402
  const $elem = this.getInputElement();
380
403
 
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.200",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",