inviton-powerduck 0.0.178 → 0.0.180
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.
- package/common/dialog-utils.ts +9 -1
- package/components/_common/css/modal-mobile-control.css +3 -0
- package/components/input/daterange-picker.tsx +76 -25
- package/components/input/plugins/daterangepicker/daterangepicker.css +80 -19
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +590 -149
- package/components/modal/modal-utils.ts +94 -0
- package/components/modal/modal.tsx +4 -92
- package/package.json +1 -1
package/common/dialog-utils.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Modal as BootstrapModal } from 'bootstrap';
|
|
|
2
2
|
import { globalState } from '../app/global-state';
|
|
3
3
|
import PowerduckState from '../app/powerduck-state';
|
|
4
4
|
import { ButtonLayout } from '../components/button/button-layout';
|
|
5
|
+
import { ModalUtils } from '../components/modal/modal-utils';
|
|
5
6
|
import { DialogIcons } from './enums/dialog-icons';
|
|
6
7
|
import { isNullOrEmpty } from './utils/is-null-or-empty';
|
|
7
8
|
import { PortalUtils } from './utils/utils';
|
|
@@ -54,6 +55,7 @@ export interface AppDialogButton {
|
|
|
54
55
|
export interface AppDialogArgs {
|
|
55
56
|
title: string;
|
|
56
57
|
message: string;
|
|
58
|
+
mobileMode?: 'default' | 'bottom-sheet' | 'fullscreen';
|
|
57
59
|
icon?: DialogIcons;
|
|
58
60
|
autoHide?: boolean;
|
|
59
61
|
boxColor?: string;
|
|
@@ -123,10 +125,11 @@ class DialogBuilder {
|
|
|
123
125
|
this.builder
|
|
124
126
|
+= `<div id="${this.id}" key="${this.id
|
|
125
127
|
}" tabindex="-1" role="dialog" aria-labelledby="${this.labelId
|
|
126
|
-
}" data-bs-backdrop="true" data-bs-keyboard="true" class="modal fade${args.cssClass ? ` ${args.cssClass}` : ''
|
|
128
|
+
}" data-bs-backdrop="true" data-bs-keyboard="true" class="modal fade modal-bottom-sheet${args.cssClass ? ` ${args.cssClass}` : ''
|
|
127
129
|
}">`;
|
|
128
130
|
this.builder += ` <div role="document" class="modal-dialog${args.size != null ? ` ${args.size}` : ''}">`;
|
|
129
131
|
this.builder += ' <div class="modal-content">';
|
|
132
|
+
this.builder += ' <div class="drag-handle text-center"><div class="handle-bar"></div></div>';
|
|
130
133
|
|
|
131
134
|
this.builder += this._getHeader();
|
|
132
135
|
this.builder += this._getBody();
|
|
@@ -240,6 +243,11 @@ export class DialogUtils {
|
|
|
240
243
|
}, 50);
|
|
241
244
|
});
|
|
242
245
|
|
|
246
|
+
if (args.mobileMode == null || args.mobileMode == 'bottom-sheet') {
|
|
247
|
+
const modal = document.getElementById(builder.id);
|
|
248
|
+
ModalUtils.bindModalBottomSheetHandle(() => modal, () => ModalUtils.hideModal(modalContext));
|
|
249
|
+
}
|
|
250
|
+
|
|
243
251
|
const ensureIconAnimation = function (
|
|
244
252
|
selector: string,
|
|
245
253
|
icon: DialogIcons,
|
|
@@ -5,6 +5,7 @@ import { Prop, toNative } from 'vue-facing-decorator';
|
|
|
5
5
|
import { globalState } from '../../app/global-state';
|
|
6
6
|
import PowerduckState from '../../app/powerduck-state';
|
|
7
7
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
8
|
+
import { DialogUtils } from '../../common/dialog-utils';
|
|
8
9
|
import { utcEpochMilliseconds } from '../../common/extensions/temporal-extensions';
|
|
9
10
|
import DateUtils from '../../common/utils/date-utils';
|
|
10
11
|
import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
|
|
@@ -13,6 +14,7 @@ import { PortalUtils } from '../../common/utils/utils';
|
|
|
13
14
|
import FormItemWrapper from '../form/form-item-wrapper';
|
|
14
15
|
import DateInputHelper from './ts/dateInputHelper';
|
|
15
16
|
import './plugins/daterangepicker/jquery.daterangepicker';
|
|
17
|
+
import './../_common/css/modal-mobile-control.css';
|
|
16
18
|
import './css/daterange-picker.css';
|
|
17
19
|
|
|
18
20
|
export interface DaterangePickerArgsCustomCellRenderArgs {
|
|
@@ -31,6 +33,8 @@ export interface DaterangePickerArgsCustomCellRenderDay {
|
|
|
31
33
|
valid: boolean;
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
type CalendarPlacement = 'body' | 'inline' | 'input-container-leftalign' | 'input-container-rightalign';
|
|
37
|
+
|
|
34
38
|
interface DaterangePickerArgs extends FormItemWrapperArgs {
|
|
35
39
|
disabled?: boolean;
|
|
36
40
|
value?: DaterangeChangedArgs;
|
|
@@ -48,7 +52,7 @@ interface DaterangePickerArgs extends FormItemWrapperArgs {
|
|
|
48
52
|
nextIcon?: string;
|
|
49
53
|
hideYearInMonthName?: boolean;
|
|
50
54
|
singleMonth?: boolean;
|
|
51
|
-
calendarPlacement?:
|
|
55
|
+
calendarPlacement?: CalendarPlacement;
|
|
52
56
|
ensureMonthContinuity?: boolean;
|
|
53
57
|
monthSelect?: boolean;
|
|
54
58
|
yearSelect?: boolean;
|
|
@@ -107,7 +111,7 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
107
111
|
@Prop() prependIconClicked: () => void;
|
|
108
112
|
@Prop() appendIconClicked: () => void;
|
|
109
113
|
@Prop() marginType?: MarginType;
|
|
110
|
-
@Prop() calendarPlacement?:
|
|
114
|
+
@Prop() calendarPlacement?: CalendarPlacement;
|
|
111
115
|
@Prop() changed: (newValue: DaterangeChangedArgs) => void;
|
|
112
116
|
@Prop() format?: string;
|
|
113
117
|
@Prop() showClearValueButton!: boolean;
|
|
@@ -155,6 +159,10 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
beforeUnmount() {
|
|
162
|
+
this.tryDestroyPickerInstance();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
tryDestroyPickerInstance() {
|
|
158
166
|
try {
|
|
159
167
|
this.getInputElement().data('dateRangePicker').destroy();
|
|
160
168
|
} catch (error) { }
|
|
@@ -165,13 +173,71 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
165
173
|
return;
|
|
166
174
|
}
|
|
167
175
|
|
|
168
|
-
const self = this;
|
|
169
176
|
const $elem = this.getInputElement();
|
|
177
|
+
if (!this.useModalMode()) {
|
|
178
|
+
this.bindDateRangePicker(
|
|
179
|
+
$elem,
|
|
180
|
+
this.calendarPlacement,
|
|
181
|
+
this.singleMonth,
|
|
182
|
+
this.alwaysOpen,
|
|
183
|
+
() => this.raiseChangedEvent(),
|
|
184
|
+
(this.calendarPlacement == null || this.calendarPlacement == 'body') ? 'body' : $elem.parent(),
|
|
185
|
+
);
|
|
186
|
+
} else {
|
|
187
|
+
this.getInputElement().parent().on('click', async () => {
|
|
188
|
+
const uuid = `drp-modal-${PortalUtils.randomString(6)}`;
|
|
189
|
+
const handle = await DialogUtils.showDialogEx({
|
|
190
|
+
title: this.label,
|
|
191
|
+
cssClass: 'daterangepicker-modal pd-modal-mobile-input',
|
|
192
|
+
message: `<div><div id="${uuid}"></div></div>`,
|
|
193
|
+
buttons: [],
|
|
194
|
+
onHidden: () => {
|
|
195
|
+
this.tryDestroyPickerInstance();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const $modalRoot = $(document.getElementById(uuid));
|
|
200
|
+
this.bindDateRangePicker(
|
|
201
|
+
$elem,
|
|
202
|
+
'inline',
|
|
203
|
+
true,
|
|
204
|
+
true,
|
|
205
|
+
() => {
|
|
206
|
+
this.raiseChangedEvent();
|
|
207
|
+
handle.hideModal();
|
|
208
|
+
},
|
|
209
|
+
$modalRoot,
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
beforeUpdate() {
|
|
216
|
+
if (!globalState.windowExists) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
this.handleModelValueChange();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
useModalMode(): boolean {
|
|
224
|
+
return PortalUtils.treatAsMobileDevice();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
bindDateRangePicker(
|
|
228
|
+
$elem: JQuery<HTMLElement>,
|
|
229
|
+
calendarPlacement: CalendarPlacement,
|
|
230
|
+
singleMonth: boolean,
|
|
231
|
+
alwaysOpen: boolean,
|
|
232
|
+
raiseChangedEvent: () => void,
|
|
233
|
+
container: JQuery<HTMLElement> | string,
|
|
234
|
+
) {
|
|
235
|
+
const self = this;
|
|
170
236
|
const now = Temporal.Now.plainDateTimeISO();
|
|
171
237
|
|
|
172
238
|
($elem as any).dateRangePicker({
|
|
173
|
-
singleMonth:
|
|
174
|
-
alwaysOpen:
|
|
239
|
+
singleMonth: singleMonth == true,
|
|
240
|
+
alwaysOpen: alwaysOpen == true,
|
|
175
241
|
singleDate: this.singleDate == true,
|
|
176
242
|
startOfWeek: DateInputHelper.getStartOfWeek() == 0 ? 'sunday' : 'monday',
|
|
177
243
|
separator: self.getSeparator(),
|
|
@@ -185,13 +251,9 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
185
251
|
yearSelect: this.yearSelect != false,
|
|
186
252
|
getCellHtml: this.getCellHtml,
|
|
187
253
|
maxDaysTooltip: this.maxDaysTooltip,
|
|
188
|
-
calendarPlacement
|
|
189
|
-
container
|
|
254
|
+
calendarPlacement,
|
|
255
|
+
container,
|
|
190
256
|
displayMode: () => {
|
|
191
|
-
if (PortalUtils.treatAsMobileDevice() && this.alwaysOpen != true) {
|
|
192
|
-
return 'modal';
|
|
193
|
-
}
|
|
194
|
-
|
|
195
257
|
return 'below-input';
|
|
196
258
|
},
|
|
197
259
|
leftOffset: () => {
|
|
@@ -244,8 +306,8 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
244
306
|
self._endDate = obj.date2 || obj.date1;
|
|
245
307
|
self._changed = true;
|
|
246
308
|
|
|
247
|
-
if (
|
|
248
|
-
|
|
309
|
+
if (alwaysOpen) {
|
|
310
|
+
raiseChangedEvent();
|
|
249
311
|
}
|
|
250
312
|
}).bind('datepicker-closed', () => {
|
|
251
313
|
const val = $elem.val() as string;
|
|
@@ -262,18 +324,10 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
262
324
|
}
|
|
263
325
|
|
|
264
326
|
self._opened = false;
|
|
265
|
-
|
|
327
|
+
raiseChangedEvent();
|
|
266
328
|
});
|
|
267
329
|
}
|
|
268
330
|
|
|
269
|
-
beforeUpdate() {
|
|
270
|
-
if (!globalState.windowExists) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
this.handleModelValueChange();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
331
|
handleModelValueChange() {
|
|
278
332
|
if (this.value?.endTime && this.value?.startTime) {
|
|
279
333
|
if (this.enableTime) {
|
|
@@ -525,9 +579,6 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
|
|
|
525
579
|
render(h) {
|
|
526
580
|
return (
|
|
527
581
|
<FormItemWrapper label={this.label} cssClass={this.getCssClass()} mandatory={this.mandatory} wrap={this.wrap} appendIcon={this.appendIcon} prependIcon={this.prependIcon} hint={this.hint} marginType={this.marginType} appendClicked={this.appendClicked} prependClicked={this.prependClicked} prependIconClicked={this.prependIconClicked} appendIconClicked={this.appendIconClicked} validationState={this.validationState} labelButtons={this.labelButtons} subtitle={this.subtitle}>
|
|
528
|
-
{this.shouldAddModalClick()
|
|
529
|
-
&& <div class="pd-daterange-picker-modalclick" onClick={(e) => { this.handleModalOpenClick(e); }}></div>}
|
|
530
|
-
|
|
531
582
|
<div style="position: relative; display: flex; align-items: center; flex-grow:1">
|
|
532
583
|
{' '}
|
|
533
584
|
{/* Added a wrapper for input and clear button */}
|
|
@@ -91,6 +91,10 @@
|
|
|
91
91
|
pointer-events: none;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
.date-range-picker-root.inline-wrapper.drpc-inline {
|
|
95
|
+
position: static;
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
.date-range-picker-root.inline-wrapper.drpc-input-container-leftalign,
|
|
95
99
|
.date-range-picker-root.inline-wrapper.drpc-input-container-rightalign {
|
|
96
100
|
top: 100%;
|
|
@@ -107,14 +111,6 @@
|
|
|
107
111
|
position: relative;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
.date-range-picker-wrapper .month-wrapper-inner {
|
|
111
|
-
margin-top: -20px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.date-range-picker-wrapper .month-wrapper-inner table {
|
|
115
|
-
margin-top: 20px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
114
|
.date-range-picker-root.date-range-picker-modalmode .date-range-picker-wrapper {
|
|
119
115
|
margin: auto;
|
|
120
116
|
}
|
|
@@ -173,7 +169,7 @@
|
|
|
173
169
|
height: 20px;
|
|
174
170
|
}
|
|
175
171
|
|
|
176
|
-
.date-range-picker-wrapper .month-wrapper
|
|
172
|
+
.date-range-picker-wrapper .month-wrapper>table {
|
|
177
173
|
padding-top: 15px;
|
|
178
174
|
}
|
|
179
175
|
|
|
@@ -272,15 +268,6 @@
|
|
|
272
268
|
background-color: rgb(112, 204, 213);
|
|
273
269
|
}
|
|
274
270
|
|
|
275
|
-
.date-range-picker-wrapper table .caption {
|
|
276
|
-
height: 40px;
|
|
277
|
-
color: #393562;
|
|
278
|
-
height: 36px;
|
|
279
|
-
font-size: 18px;
|
|
280
|
-
font-weight: 500;
|
|
281
|
-
font-family: sans-serif;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
271
|
.date-range-picker-wrapper table .caption .next,
|
|
285
272
|
.date-range-picker-wrapper table .caption .prev {
|
|
286
273
|
padding: 0 5px;
|
|
@@ -570,7 +557,7 @@
|
|
|
570
557
|
border-right: 0.667px solid #dfe3f1;
|
|
571
558
|
}
|
|
572
559
|
|
|
573
|
-
.date-range-picker-wrapper .month-wrapper table td
|
|
560
|
+
.date-range-picker-wrapper .month-wrapper table td>div {
|
|
574
561
|
background-color: inherit !important;
|
|
575
562
|
line-height: 1.9;
|
|
576
563
|
margin-left: 5px;
|
|
@@ -627,9 +614,83 @@
|
|
|
627
614
|
background-color: #b94c4c;
|
|
628
615
|
}
|
|
629
616
|
|
|
617
|
+
.date-range-picker-root .select-wrapper-selected-month {
|
|
618
|
+
display: none;
|
|
619
|
+
}
|
|
620
|
+
|
|
630
621
|
.drp-date-switch.month-name {
|
|
631
622
|
border: 0;
|
|
632
623
|
appearance: none;
|
|
633
624
|
-webkit-appearance: none;
|
|
634
625
|
-moz-appearance: none;
|
|
635
626
|
}
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
.date-range-picker-wrapper table .caption,
|
|
630
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table th>span.select-wrapper,
|
|
631
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table th>span.select-wrapper select {
|
|
632
|
+
height: 40px;
|
|
633
|
+
color: #393562;
|
|
634
|
+
height: 36px;
|
|
635
|
+
font-size: 18px;
|
|
636
|
+
font-weight: 400;
|
|
637
|
+
font-family: sans-serif;
|
|
638
|
+
background: white;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline {
|
|
642
|
+
border: 0;
|
|
643
|
+
background: transparent;
|
|
644
|
+
box-shadow: none;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper {
|
|
648
|
+
padding-left: 0;
|
|
649
|
+
padding-right: 0;
|
|
650
|
+
border: 0;
|
|
651
|
+
width: 100% !important;
|
|
652
|
+
padding: 0;
|
|
653
|
+
vertical-align: top;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common {}
|
|
657
|
+
|
|
658
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table {
|
|
659
|
+
width: 100%;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table td,
|
|
663
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table th {
|
|
664
|
+
width: 99999px;
|
|
665
|
+
text-align: center;
|
|
666
|
+
font-weight: 400;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table td>div,
|
|
670
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table th>div,
|
|
671
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table td>span,
|
|
672
|
+
.daterangepicker-modal .date-range-picker-root.inline-wrapper.drpc-inline .month-wrapper .month-wrapper-inner-common table th>span {
|
|
673
|
+
margin: 0;
|
|
674
|
+
margin: auto;
|
|
675
|
+
font-size: 14px;
|
|
676
|
+
font-weight: 400;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.daterangepicker-modal .date-range-picker-root .select-wrapper {
|
|
680
|
+
position: relative;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
.daterangepicker-modal .date-range-picker-root .select-wrapper-selected-month {
|
|
685
|
+
display: inline-block;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
.daterangepicker-modal .date-range-picker-root select {
|
|
689
|
+
position: absolute;
|
|
690
|
+
top: 0;
|
|
691
|
+
left: 0;
|
|
692
|
+
right: 0;
|
|
693
|
+
bottom: 0;
|
|
694
|
+
height: auto !important;
|
|
695
|
+
opacity: 0.001;
|
|
696
|
+
}
|