@xplortech/apollo-core 1.0.0-beta.6 → 1.0.0-beta.8
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/LICENSE +21 -0
- package/build/style.css +4 -55
- package/dist/apollo-core/apollo-core.css +5 -5
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/p-10f00380.entry.js +1 -0
- package/dist/apollo-core/p-26ec64fe.entry.js +1 -0
- package/dist/apollo-core/p-2f90296c.js +2 -2
- package/dist/apollo-core/p-31acfdb4.entry.js +1 -0
- package/dist/apollo-core/p-4184ac44.entry.js +1 -0
- package/dist/apollo-core/{p-dad11011.entry.js → p-4fa14839.entry.js} +1 -1
- package/dist/apollo-core/p-55b87345.js +2 -0
- package/dist/apollo-core/p-63a6c98a.entry.js +1 -0
- package/dist/apollo-core/p-68c33b77.entry.js +1 -0
- package/dist/apollo-core/{p-a7cc4114.entry.js → p-78d07caf.entry.js} +1 -1
- package/dist/apollo-core/p-796957d3.entry.js +1 -0
- package/dist/apollo-core/p-88160d68.entry.js +1 -0
- package/dist/apollo-core/p-9ec318bb.entry.js +1 -0
- package/dist/apollo-core/p-a2a34e44.entry.js +1 -0
- package/dist/apollo-core/p-beea2502.entry.js +1 -0
- package/dist/apollo-core/p-d499e43f.entry.js +1 -0
- package/dist/apollo-core/{p-c8af4ed6.entry.js → p-d8a3d94c.entry.js} +1 -1
- package/dist/apollo-core/p-e047b446.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +6 -2
- package/dist/cjs/{index-acf3dd7a.js → index-2ab4832e.js} +592 -215
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/xpl-application-shell.cjs.entry.js +2 -13
- package/dist/cjs/xpl-avatar_12.cjs.entry.js +72 -38
- package/dist/cjs/xpl-backdrop.cjs.entry.js +1 -5
- package/dist/cjs/xpl-button-row.cjs.entry.js +4 -1
- package/dist/cjs/xpl-choicelist.cjs.entry.js +8 -1
- package/dist/cjs/xpl-divider.cjs.entry.js +2 -1
- package/dist/cjs/xpl-dropdown-group_3.cjs.entry.js +7 -1
- package/dist/cjs/xpl-dropdown_2.cjs.entry.js +8 -9
- package/dist/cjs/xpl-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/xpl-grid.cjs.entry.js +1 -1
- package/dist/cjs/xpl-input.cjs.entry.js +615 -501
- package/dist/cjs/xpl-list.cjs.entry.js +1 -23
- package/dist/cjs/xpl-main-nav.cjs.entry.js +1 -4
- package/dist/cjs/xpl-pagination.cjs.entry.js +5 -2
- package/dist/cjs/xpl-select.cjs.entry.js +7 -22
- package/dist/cjs/xpl-toggle.cjs.entry.js +7 -4
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +118 -132
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +150 -144
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +26 -28
- package/dist/collection/components/xpl-badge/xpl-badge.js +43 -39
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +2 -5
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +2 -5
- package/dist/collection/components/xpl-button/xpl-button.js +204 -205
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +105 -104
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +181 -171
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +133 -126
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +27 -31
- package/dist/collection/components/xpl-divider/xpl-divider.js +26 -23
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +46 -42
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +26 -22
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +60 -54
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +170 -167
- package/dist/collection/components/xpl-grid/xpl-grid.js +1 -1
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +75 -74
- package/dist/collection/components/xpl-input/xpl-input.js +404 -417
- package/dist/collection/components/xpl-list/xpl-list.js +42 -75
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +47 -54
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +47 -49
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +116 -128
- package/dist/collection/components/xpl-radio/xpl-radio.js +157 -148
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +2 -4
- package/dist/collection/components/xpl-select/xpl-select.js +212 -238
- package/dist/collection/components/xpl-table/xpl-table.js +168 -151
- package/dist/collection/components/xpl-tag/xpl-tag.js +24 -25
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +137 -135
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +73 -70
- package/dist/custom-elements/index.js +756 -641
- package/dist/esm/apollo-core.js +3 -2
- package/dist/esm/{index-e3c4bb97.js → index-392b5b96.js} +592 -216
- package/dist/esm/loader.js +3 -2
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/xpl-application-shell.entry.js +2 -13
- package/dist/esm/xpl-avatar_12.entry.js +72 -38
- package/dist/esm/xpl-backdrop.entry.js +1 -5
- package/dist/esm/xpl-button-row.entry.js +4 -1
- package/dist/esm/xpl-choicelist.entry.js +8 -1
- package/dist/esm/xpl-divider.entry.js +2 -1
- package/dist/esm/xpl-dropdown-group_3.entry.js +7 -1
- package/dist/esm/xpl-dropdown_2.entry.js +8 -9
- package/dist/esm/xpl-grid-item.entry.js +1 -1
- package/dist/esm/xpl-grid.entry.js +1 -1
- package/dist/esm/xpl-input.entry.js +615 -501
- package/dist/esm/xpl-list.entry.js +1 -23
- package/dist/esm/xpl-main-nav.entry.js +1 -4
- package/dist/esm/xpl-pagination.entry.js +5 -2
- package/dist/esm/xpl-select.entry.js +7 -22
- package/dist/esm/xpl-toggle.entry.js +7 -4
- package/dist/types/components/xpl-dropdown/dropdownoption.d.ts +1 -1
- package/dist/types/components/xpl-table/xpl-table.d.ts +2 -0
- package/dist/types/components.d.ts +47 -11
- package/dist/types/stencil-public-runtime.d.ts +85 -11
- package/loader/index.d.ts +9 -1
- package/loader/package.json +1 -0
- package/package.json +1 -1
- package/dist/apollo-core/p-25f84d39.entry.js +0 -1
- package/dist/apollo-core/p-2ce2fe5c.entry.js +0 -1
- package/dist/apollo-core/p-3ff1ff38.entry.js +0 -1
- package/dist/apollo-core/p-63dd9a65.entry.js +0 -1
- package/dist/apollo-core/p-6c3c1e3d.entry.js +0 -1
- package/dist/apollo-core/p-81a6ce4c.entry.js +0 -1
- package/dist/apollo-core/p-918b0731.entry.js +0 -1
- package/dist/apollo-core/p-a43e2d1f.entry.js +0 -1
- package/dist/apollo-core/p-b6d1b135.entry.js +0 -1
- package/dist/apollo-core/p-bc0ebed2.entry.js +0 -1
- package/dist/apollo-core/p-d4aa2fa9.js +0 -1
- package/dist/apollo-core/p-d4e5d3aa.entry.js +0 -1
- package/dist/apollo-core/p-db74c99c.entry.js +0 -1
- package/dist/apollo-core/p-ee16942f.entry.js +0 -1
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/application-shell.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/avatar.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/backdrop.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/badge.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/breadcrumbs.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/button-row.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/button.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/checkbox.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/choicelist.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/content-area.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/divider.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/dropdown.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/grid.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/input.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/list.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/main-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/pagination.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/radio.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/secondary-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/select.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/table.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/tabs.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/toggle.stories.d.ts +0 -0
- /package/dist/types/Users/{roc/Sites → fernandogelin/Xplor}/apollo/.stencil/stories/utility-bar.stories.d.ts +0 -0
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import { h, Host, createEvent, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
|
|
1
|
+
import { HTMLElement as HTMLElement$1, h, Host, createEvent, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
2
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
3
|
|
|
4
|
-
const XplApplicationShell$1 = class extends HTMLElement {
|
|
4
|
+
const XplApplicationShell$1 = class extends HTMLElement$1 {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
this.__registerHost();
|
|
8
|
-
/**
|
|
9
|
-
* @property {boolean} - Whether or not the Grid should have space for a secondary (sub) navigation bar
|
|
10
|
-
*/
|
|
11
8
|
this.withSubnav = false;
|
|
12
|
-
/**
|
|
13
|
-
* @property {boolean} - Whether or not the Grid should have space for a utility bar
|
|
14
|
-
*/
|
|
15
9
|
this.withUtility = true;
|
|
16
|
-
/**
|
|
17
|
-
* @property {string} - The width of the main navigation bar, can be passed or updated when nav-width event is emitted.
|
|
18
|
-
*/
|
|
19
10
|
this.navWidth = 'default';
|
|
20
|
-
|
|
21
|
-
* @state {boolean} - Whether or not the main nav is open, updates when the nav-open event is emitted.
|
|
22
|
-
*/
|
|
11
|
+
this.isNavOpenAtStartup = undefined;
|
|
23
12
|
this.navOpen = true;
|
|
24
13
|
}
|
|
25
14
|
closeNavOnMobile() {
|
|
@@ -59,11 +48,18 @@ const XplApplicationShell$1 = class extends HTMLElement {
|
|
|
59
48
|
}
|
|
60
49
|
};
|
|
61
50
|
|
|
62
|
-
const XplAvatar$1 = class extends HTMLElement {
|
|
51
|
+
const XplAvatar$1 = class extends HTMLElement$1 {
|
|
63
52
|
constructor() {
|
|
64
53
|
super();
|
|
65
54
|
this.__registerHost();
|
|
55
|
+
this.color = undefined;
|
|
66
56
|
this.disabled = false;
|
|
57
|
+
this.href = undefined;
|
|
58
|
+
this.name = undefined;
|
|
59
|
+
this.size = undefined;
|
|
60
|
+
this.src = undefined;
|
|
61
|
+
this.status = undefined;
|
|
62
|
+
this.target = undefined;
|
|
67
63
|
}
|
|
68
64
|
render() {
|
|
69
65
|
let className = 'xpl-avatar';
|
|
@@ -76,14 +72,10 @@ const XplAvatar$1 = class extends HTMLElement {
|
|
|
76
72
|
}
|
|
77
73
|
};
|
|
78
74
|
|
|
79
|
-
const XplBackdrop$1 = class extends HTMLElement {
|
|
75
|
+
const XplBackdrop$1 = class extends HTMLElement$1 {
|
|
80
76
|
constructor() {
|
|
81
77
|
super();
|
|
82
78
|
this.__registerHost();
|
|
83
|
-
/**
|
|
84
|
-
* @property {boolean} - When true, backdrop will have relative position. This is useful when the backdrop doesn't cover the whole view area.
|
|
85
|
-
* If false, the position will be fixed and cover the whole view area.
|
|
86
|
-
*/
|
|
87
79
|
this.relative = false;
|
|
88
80
|
}
|
|
89
81
|
render() {
|
|
@@ -95,10 +87,12 @@ const XplBackdrop$1 = class extends HTMLElement {
|
|
|
95
87
|
}
|
|
96
88
|
};
|
|
97
89
|
|
|
98
|
-
const XplBadge$1 = class extends HTMLElement {
|
|
90
|
+
const XplBadge$1 = class extends HTMLElement$1 {
|
|
99
91
|
constructor() {
|
|
100
92
|
super();
|
|
101
93
|
this.__registerHost();
|
|
94
|
+
this.dot = undefined;
|
|
95
|
+
this.variant = undefined;
|
|
102
96
|
}
|
|
103
97
|
render() {
|
|
104
98
|
let className = 'xpl-badge';
|
|
@@ -110,7 +104,7 @@ const XplBadge$1 = class extends HTMLElement {
|
|
|
110
104
|
}
|
|
111
105
|
};
|
|
112
106
|
|
|
113
|
-
const XplBreadcrumbItem$1 = class extends HTMLElement {
|
|
107
|
+
const XplBreadcrumbItem$1 = class extends HTMLElement$1 {
|
|
114
108
|
constructor() {
|
|
115
109
|
super();
|
|
116
110
|
this.__registerHost();
|
|
@@ -125,7 +119,7 @@ const XplBreadcrumbItem$1 = class extends HTMLElement {
|
|
|
125
119
|
}
|
|
126
120
|
};
|
|
127
121
|
|
|
128
|
-
const XplBreadcrumbs$1 = class extends HTMLElement {
|
|
122
|
+
const XplBreadcrumbs$1 = class extends HTMLElement$1 {
|
|
129
123
|
constructor() {
|
|
130
124
|
super();
|
|
131
125
|
this.__registerHost();
|
|
@@ -135,21 +129,19 @@ const XplBreadcrumbs$1 = class extends HTMLElement {
|
|
|
135
129
|
}
|
|
136
130
|
};
|
|
137
131
|
|
|
138
|
-
const XplButton$1 = class extends HTMLElement {
|
|
132
|
+
const XplButton$1 = class extends HTMLElement$1 {
|
|
139
133
|
constructor() {
|
|
140
134
|
super();
|
|
141
135
|
this.__registerHost();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
this.disabled = undefined;
|
|
137
|
+
this.link = undefined;
|
|
138
|
+
this.iconOnly = undefined;
|
|
139
|
+
this.fullWidth = undefined;
|
|
140
|
+
this.name = undefined;
|
|
145
141
|
this.size = 'default';
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*/
|
|
142
|
+
this.type = undefined;
|
|
143
|
+
this.value = undefined;
|
|
149
144
|
this.variant = 'primary';
|
|
150
|
-
/**
|
|
151
|
-
* @property {"neutral" | "warning" | "success"} - button state (color) neutral=purple, success=green, warning=red
|
|
152
|
-
*/
|
|
153
145
|
this.state = 'neutral';
|
|
154
146
|
}
|
|
155
147
|
componentDidRender() {
|
|
@@ -193,7 +185,7 @@ const XplButton$1 = class extends HTMLElement {
|
|
|
193
185
|
get el() { return this; }
|
|
194
186
|
};
|
|
195
187
|
|
|
196
|
-
const XplButtonRow$1 = class extends HTMLElement {
|
|
188
|
+
const XplButtonRow$1 = class extends HTMLElement$1 {
|
|
197
189
|
constructor() {
|
|
198
190
|
super();
|
|
199
191
|
this.__registerHost();
|
|
@@ -203,6 +195,9 @@ const XplButtonRow$1 = class extends HTMLElement {
|
|
|
203
195
|
this.onPrimary = () => this.clickPrimary.emit();
|
|
204
196
|
this.onSecondary = () => this.clickSecondary.emit();
|
|
205
197
|
this.onTertiary = () => this.clickTertiary.emit();
|
|
198
|
+
this.primary = undefined;
|
|
199
|
+
this.secondary = undefined;
|
|
200
|
+
this.tertiary = undefined;
|
|
206
201
|
}
|
|
207
202
|
render() {
|
|
208
203
|
return (h(Host, { class: "xpl-button-row" }, h("div", { class: "xpl-button-row-inner" }, h("div", { class: "xpl-button-row__left" }, this.secondary && (h("xpl-button", { variant: "secondary", type: "button", onClick: this.onSecondary }, this.secondary))), h("div", { class: "xpl-button-row__right" }, this.tertiary && (h("xpl-button", { variant: "subtle", type: "button", onClick: this.onTertiary }, this.tertiary)), this.secondary && (h("xpl-button", { variant: "secondary", type: "button", onClick: this.onSecondary }, this.secondary)), this.primary && (h("xpl-button", { class: "xpl-button-row__primary", onClick: this.onPrimary }, this.primary))))));
|
|
@@ -283,11 +278,19 @@ function v4(options, buf, offset) {
|
|
|
283
278
|
return stringify(rnds);
|
|
284
279
|
}
|
|
285
280
|
|
|
286
|
-
const XplCheckbox$1 = class extends HTMLElement {
|
|
281
|
+
const XplCheckbox$1 = class extends HTMLElement$1 {
|
|
287
282
|
constructor() {
|
|
288
283
|
super();
|
|
289
284
|
this.__registerHost();
|
|
290
285
|
this.checkboxChange = createEvent(this, "checkboxChange", 7);
|
|
286
|
+
this.checked = undefined;
|
|
287
|
+
this.description = undefined;
|
|
288
|
+
this.disabled = undefined;
|
|
289
|
+
this.indeterminate = undefined;
|
|
290
|
+
this.name = undefined;
|
|
291
|
+
this.required = undefined;
|
|
292
|
+
this.styled = undefined;
|
|
293
|
+
this.value = undefined;
|
|
291
294
|
this.id = v4();
|
|
292
295
|
}
|
|
293
296
|
render() {
|
|
@@ -305,10 +308,17 @@ const XplCheckbox$1 = class extends HTMLElement {
|
|
|
305
308
|
}
|
|
306
309
|
};
|
|
307
310
|
|
|
308
|
-
const XplChoicelist$1 = class extends HTMLElement {
|
|
311
|
+
const XplChoicelist$1 = class extends HTMLElement$1 {
|
|
309
312
|
constructor() {
|
|
310
313
|
super();
|
|
311
314
|
this.__registerHost();
|
|
315
|
+
this.choices = undefined;
|
|
316
|
+
this.description = undefined;
|
|
317
|
+
this.heading = undefined;
|
|
318
|
+
this.multi = undefined;
|
|
319
|
+
this.name = undefined;
|
|
320
|
+
this.styled = undefined;
|
|
321
|
+
this.selected = undefined;
|
|
312
322
|
}
|
|
313
323
|
componentWillLoad() {
|
|
314
324
|
this.selected =
|
|
@@ -342,13 +352,10 @@ const XplChoicelist$1 = class extends HTMLElement {
|
|
|
342
352
|
}
|
|
343
353
|
};
|
|
344
354
|
|
|
345
|
-
const XplContentArea$1 = class extends HTMLElement {
|
|
355
|
+
const XplContentArea$1 = class extends HTMLElement$1 {
|
|
346
356
|
constructor() {
|
|
347
357
|
super();
|
|
348
358
|
this.__registerHost();
|
|
349
|
-
/**
|
|
350
|
-
* @property {string} size - The content-area size.
|
|
351
|
-
*/
|
|
352
359
|
this.size = 'wide';
|
|
353
360
|
}
|
|
354
361
|
render() {
|
|
@@ -356,10 +363,11 @@ const XplContentArea$1 = class extends HTMLElement {
|
|
|
356
363
|
}
|
|
357
364
|
};
|
|
358
365
|
|
|
359
|
-
const XplDivider$1 = class extends HTMLElement {
|
|
366
|
+
const XplDivider$1 = class extends HTMLElement$1 {
|
|
360
367
|
constructor() {
|
|
361
368
|
super();
|
|
362
369
|
this.__registerHost();
|
|
370
|
+
this.tier = undefined;
|
|
363
371
|
}
|
|
364
372
|
render() {
|
|
365
373
|
let className = 'xpl-divider';
|
|
@@ -380,18 +388,10 @@ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
|
380
388
|
}
|
|
381
389
|
return t;
|
|
382
390
|
};
|
|
383
|
-
const XplDropdown$1 = class extends HTMLElement {
|
|
391
|
+
const XplDropdown$1 = class extends HTMLElement$1 {
|
|
384
392
|
constructor() {
|
|
385
393
|
super();
|
|
386
394
|
this.__registerHost();
|
|
387
|
-
/** text to display as heading */
|
|
388
|
-
this.isOpen = false;
|
|
389
|
-
/** options that are listed */
|
|
390
|
-
this.closeOnSelect = true;
|
|
391
|
-
/** constant representing number of options that can be selected */
|
|
392
|
-
this.mode = 'single';
|
|
393
|
-
/** whether selection should be made when focusing on interactable element */
|
|
394
|
-
this.selectOnFocus = false;
|
|
395
395
|
this.handleClickOutside = ({ target }) => {
|
|
396
396
|
const { triggerId } = this;
|
|
397
397
|
const isTrigger = triggerId && target.id === triggerId;
|
|
@@ -399,6 +399,13 @@ const XplDropdown$1 = class extends HTMLElement {
|
|
|
399
399
|
if (!isInside && !isTrigger)
|
|
400
400
|
this.isOpen = false;
|
|
401
401
|
};
|
|
402
|
+
this.isOpen = false;
|
|
403
|
+
this.closeOnSelect = true;
|
|
404
|
+
this.mode = 'single';
|
|
405
|
+
this.options = undefined;
|
|
406
|
+
this.selectOnFocus = false;
|
|
407
|
+
this.triggerId = undefined;
|
|
408
|
+
this.update = undefined;
|
|
402
409
|
}
|
|
403
410
|
/**
|
|
404
411
|
* called on dropdown option click and keydown events to update isSelected states
|
|
@@ -481,10 +488,12 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
481
488
|
}
|
|
482
489
|
return t;
|
|
483
490
|
};
|
|
484
|
-
const XplDropdownGroup$1 = class extends HTMLElement {
|
|
491
|
+
const XplDropdownGroup$1 = class extends HTMLElement$1 {
|
|
485
492
|
constructor() {
|
|
486
493
|
super();
|
|
487
494
|
this.__registerHost();
|
|
495
|
+
this.groupName = undefined;
|
|
496
|
+
this.options = undefined;
|
|
488
497
|
}
|
|
489
498
|
render() {
|
|
490
499
|
const { groupName, options } = this;
|
|
@@ -498,20 +507,24 @@ const XplDropdownGroup$1 = class extends HTMLElement {
|
|
|
498
507
|
}
|
|
499
508
|
};
|
|
500
509
|
|
|
501
|
-
const XplDropdownHeading$1 = class extends HTMLElement {
|
|
510
|
+
const XplDropdownHeading$1 = class extends HTMLElement$1 {
|
|
502
511
|
constructor() {
|
|
503
512
|
super();
|
|
504
513
|
this.__registerHost();
|
|
514
|
+
this.label = undefined;
|
|
505
515
|
}
|
|
506
516
|
render() {
|
|
507
517
|
return (h(Host, { class: { 'xpl-dropdown-heading': true }, role: "presentation" }, h("span", null, this.label || h("slot", { name: "heading" }))));
|
|
508
518
|
}
|
|
509
519
|
};
|
|
510
520
|
|
|
511
|
-
const XplDropdownOption$1 = class extends HTMLElement {
|
|
521
|
+
const XplDropdownOption$1 = class extends HTMLElement$1 {
|
|
512
522
|
constructor() {
|
|
513
523
|
super();
|
|
514
524
|
this.__registerHost();
|
|
525
|
+
this.isDisabled = undefined;
|
|
526
|
+
this.label = undefined;
|
|
527
|
+
this.isSelected = undefined;
|
|
515
528
|
}
|
|
516
529
|
componentWillLoad() {
|
|
517
530
|
this.dropdown = this.hostElement.closest('xpl-dropdown');
|
|
@@ -570,7 +583,7 @@ const XplDropdownOption$1 = class extends HTMLElement {
|
|
|
570
583
|
get hostElement() { return this; }
|
|
571
584
|
};
|
|
572
585
|
|
|
573
|
-
const XplGrid$1 = class extends HTMLElement {
|
|
586
|
+
const XplGrid$1 = class extends HTMLElement$1 {
|
|
574
587
|
constructor() {
|
|
575
588
|
super();
|
|
576
589
|
this.__registerHost();
|
|
@@ -599,7 +612,7 @@ const XplGrid$1 = class extends HTMLElement {
|
|
|
599
612
|
get container() { return this; }
|
|
600
613
|
};
|
|
601
614
|
|
|
602
|
-
const XplGridItem$1 = class extends HTMLElement {
|
|
615
|
+
const XplGridItem$1 = class extends HTMLElement$1 {
|
|
603
616
|
constructor() {
|
|
604
617
|
super();
|
|
605
618
|
this.__registerHost();
|
|
@@ -618,7 +631,7 @@ const XplGridItem$1 = class extends HTMLElement {
|
|
|
618
631
|
}
|
|
619
632
|
};
|
|
620
633
|
|
|
621
|
-
|
|
634
|
+
var HOOKS = [
|
|
622
635
|
"onChange",
|
|
623
636
|
"onClose",
|
|
624
637
|
"onDayCreate",
|
|
@@ -632,7 +645,7 @@ const HOOKS = [
|
|
|
632
645
|
"onYearChange",
|
|
633
646
|
"onPreCalendarPosition",
|
|
634
647
|
];
|
|
635
|
-
|
|
648
|
+
var defaults = {
|
|
636
649
|
_disable: [],
|
|
637
650
|
allowInput: false,
|
|
638
651
|
allowInvalidPreload: false,
|
|
@@ -654,9 +667,11 @@ const defaults = {
|
|
|
654
667
|
disableMobile: false,
|
|
655
668
|
enableSeconds: false,
|
|
656
669
|
enableTime: false,
|
|
657
|
-
errorHandler: (err)
|
|
658
|
-
|
|
659
|
-
|
|
670
|
+
errorHandler: function (err) {
|
|
671
|
+
return typeof console !== "undefined" && console.warn(err);
|
|
672
|
+
},
|
|
673
|
+
getWeek: function (givenDate) {
|
|
674
|
+
var date = new Date(givenDate.getTime());
|
|
660
675
|
date.setHours(0, 0, 0, 0);
|
|
661
676
|
date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
|
|
662
677
|
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
@@ -700,7 +715,7 @@ const defaults = {
|
|
|
700
715
|
wrap: false,
|
|
701
716
|
};
|
|
702
717
|
|
|
703
|
-
|
|
718
|
+
var english = {
|
|
704
719
|
weekdays: {
|
|
705
720
|
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
706
721
|
longhand: [
|
|
@@ -745,8 +760,8 @@ const english = {
|
|
|
745
760
|
},
|
|
746
761
|
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
747
762
|
firstDayOfWeek: 0,
|
|
748
|
-
ordinal: (nth)
|
|
749
|
-
|
|
763
|
+
ordinal: function (nth) {
|
|
764
|
+
var s = nth % 100;
|
|
750
765
|
if (s > 3 && s < 21)
|
|
751
766
|
return "th";
|
|
752
767
|
switch (s % 10) {
|
|
@@ -772,16 +787,23 @@ const english = {
|
|
|
772
787
|
time_24hr: false,
|
|
773
788
|
};
|
|
774
789
|
|
|
775
|
-
|
|
776
|
-
|
|
790
|
+
var pad = function (number, length) {
|
|
791
|
+
if (length === void 0) { length = 2; }
|
|
792
|
+
return ("000" + number).slice(length * -1);
|
|
793
|
+
};
|
|
794
|
+
var int = function (bool) { return (bool === true ? 1 : 0); };
|
|
777
795
|
function debounce$1(fn, wait) {
|
|
778
|
-
|
|
796
|
+
var t;
|
|
779
797
|
return function () {
|
|
798
|
+
var _this = this;
|
|
799
|
+
var args = arguments;
|
|
780
800
|
clearTimeout(t);
|
|
781
|
-
t = setTimeout(()
|
|
801
|
+
t = setTimeout(function () { return fn.apply(_this, args); }, wait);
|
|
782
802
|
};
|
|
783
803
|
}
|
|
784
|
-
|
|
804
|
+
var arrayify = function (obj) {
|
|
805
|
+
return obj instanceof Array ? obj : [obj];
|
|
806
|
+
};
|
|
785
807
|
|
|
786
808
|
function toggleClass(elem, className, bool) {
|
|
787
809
|
if (bool === true)
|
|
@@ -789,7 +811,7 @@ function toggleClass(elem, className, bool) {
|
|
|
789
811
|
elem.classList.remove(className);
|
|
790
812
|
}
|
|
791
813
|
function createElement(tag, className, content) {
|
|
792
|
-
|
|
814
|
+
var e = window.document.createElement(tag);
|
|
793
815
|
className = className || "";
|
|
794
816
|
content = content || "";
|
|
795
817
|
e.className = className;
|
|
@@ -809,7 +831,7 @@ function findParent(node, condition) {
|
|
|
809
831
|
return undefined;
|
|
810
832
|
}
|
|
811
833
|
function createNumberInput(inputClassName, opts) {
|
|
812
|
-
|
|
834
|
+
var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
|
|
813
835
|
if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
|
|
814
836
|
numInput.type = "number";
|
|
815
837
|
}
|
|
@@ -818,7 +840,7 @@ function createNumberInput(inputClassName, opts) {
|
|
|
818
840
|
numInput.pattern = "\\d*";
|
|
819
841
|
}
|
|
820
842
|
if (opts !== undefined)
|
|
821
|
-
for (
|
|
843
|
+
for (var key in opts)
|
|
822
844
|
numInput.setAttribute(key, opts[key]);
|
|
823
845
|
wrapper.appendChild(numInput);
|
|
824
846
|
wrapper.appendChild(arrowUp);
|
|
@@ -828,7 +850,7 @@ function createNumberInput(inputClassName, opts) {
|
|
|
828
850
|
function getEventTarget(event) {
|
|
829
851
|
try {
|
|
830
852
|
if (typeof event.composedPath === "function") {
|
|
831
|
-
|
|
853
|
+
var path = event.composedPath();
|
|
832
854
|
return path[0];
|
|
833
855
|
}
|
|
834
856
|
return event.target;
|
|
@@ -838,79 +860,81 @@ function getEventTarget(event) {
|
|
|
838
860
|
}
|
|
839
861
|
}
|
|
840
862
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
863
|
+
var doNothing = function () { return undefined; };
|
|
864
|
+
var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
|
|
865
|
+
var revFormat = {
|
|
844
866
|
D: doNothing,
|
|
845
867
|
F: function (dateObj, monthName, locale) {
|
|
846
868
|
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
|
|
847
869
|
},
|
|
848
|
-
G: (dateObj, hour)
|
|
849
|
-
dateObj.setHours(parseFloat(hour));
|
|
870
|
+
G: function (dateObj, hour) {
|
|
871
|
+
dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
|
|
850
872
|
},
|
|
851
|
-
H: (dateObj, hour)
|
|
873
|
+
H: function (dateObj, hour) {
|
|
852
874
|
dateObj.setHours(parseFloat(hour));
|
|
853
875
|
},
|
|
854
|
-
J: (dateObj, day)
|
|
876
|
+
J: function (dateObj, day) {
|
|
855
877
|
dateObj.setDate(parseFloat(day));
|
|
856
878
|
},
|
|
857
|
-
K: (dateObj, amPM, locale)
|
|
879
|
+
K: function (dateObj, amPM, locale) {
|
|
858
880
|
dateObj.setHours((dateObj.getHours() % 12) +
|
|
859
881
|
12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
|
|
860
882
|
},
|
|
861
883
|
M: function (dateObj, shortMonth, locale) {
|
|
862
884
|
dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
|
|
863
885
|
},
|
|
864
|
-
S: (dateObj, seconds)
|
|
886
|
+
S: function (dateObj, seconds) {
|
|
865
887
|
dateObj.setSeconds(parseFloat(seconds));
|
|
866
888
|
},
|
|
867
|
-
U: (_, unixSeconds)
|
|
889
|
+
U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
|
|
868
890
|
W: function (dateObj, weekNum, locale) {
|
|
869
|
-
|
|
870
|
-
|
|
891
|
+
var weekNumber = parseInt(weekNum);
|
|
892
|
+
var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
|
|
871
893
|
date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
|
|
872
894
|
return date;
|
|
873
895
|
},
|
|
874
|
-
Y: (dateObj, year)
|
|
896
|
+
Y: function (dateObj, year) {
|
|
875
897
|
dateObj.setFullYear(parseFloat(year));
|
|
876
898
|
},
|
|
877
|
-
Z: (_, ISODate)
|
|
878
|
-
d: (dateObj, day)
|
|
899
|
+
Z: function (_, ISODate) { return new Date(ISODate); },
|
|
900
|
+
d: function (dateObj, day) {
|
|
879
901
|
dateObj.setDate(parseFloat(day));
|
|
880
902
|
},
|
|
881
|
-
h: (dateObj, hour)
|
|
882
|
-
dateObj.setHours(parseFloat(hour));
|
|
903
|
+
h: function (dateObj, hour) {
|
|
904
|
+
dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
|
|
883
905
|
},
|
|
884
|
-
i: (dateObj, minutes)
|
|
906
|
+
i: function (dateObj, minutes) {
|
|
885
907
|
dateObj.setMinutes(parseFloat(minutes));
|
|
886
908
|
},
|
|
887
|
-
j: (dateObj, day)
|
|
909
|
+
j: function (dateObj, day) {
|
|
888
910
|
dateObj.setDate(parseFloat(day));
|
|
889
911
|
},
|
|
890
912
|
l: doNothing,
|
|
891
|
-
m: (dateObj, month)
|
|
913
|
+
m: function (dateObj, month) {
|
|
892
914
|
dateObj.setMonth(parseFloat(month) - 1);
|
|
893
915
|
},
|
|
894
|
-
n: (dateObj, month)
|
|
916
|
+
n: function (dateObj, month) {
|
|
895
917
|
dateObj.setMonth(parseFloat(month) - 1);
|
|
896
918
|
},
|
|
897
|
-
s: (dateObj, seconds)
|
|
919
|
+
s: function (dateObj, seconds) {
|
|
898
920
|
dateObj.setSeconds(parseFloat(seconds));
|
|
899
921
|
},
|
|
900
|
-
u: (_, unixMillSeconds)
|
|
922
|
+
u: function (_, unixMillSeconds) {
|
|
923
|
+
return new Date(parseFloat(unixMillSeconds));
|
|
924
|
+
},
|
|
901
925
|
w: doNothing,
|
|
902
|
-
y: (dateObj, year)
|
|
926
|
+
y: function (dateObj, year) {
|
|
903
927
|
dateObj.setFullYear(2000 + parseFloat(year));
|
|
904
928
|
},
|
|
905
929
|
};
|
|
906
|
-
|
|
907
|
-
D: "
|
|
908
|
-
F: "
|
|
930
|
+
var tokenRegex = {
|
|
931
|
+
D: "",
|
|
932
|
+
F: "",
|
|
909
933
|
G: "(\\d\\d|\\d)",
|
|
910
934
|
H: "(\\d\\d|\\d)",
|
|
911
935
|
J: "(\\d\\d|\\d)\\w+",
|
|
912
936
|
K: "",
|
|
913
|
-
M: "
|
|
937
|
+
M: "",
|
|
914
938
|
S: "(\\d\\d|\\d)",
|
|
915
939
|
U: "(.+)",
|
|
916
940
|
W: "(\\d\\d|\\d)",
|
|
@@ -920,7 +944,7 @@ const tokenRegex = {
|
|
|
920
944
|
h: "(\\d\\d|\\d)",
|
|
921
945
|
i: "(\\d\\d|\\d)",
|
|
922
946
|
j: "(\\d\\d|\\d)",
|
|
923
|
-
l: "
|
|
947
|
+
l: "",
|
|
924
948
|
m: "(\\d\\d|\\d)",
|
|
925
949
|
n: "(\\d\\d|\\d)",
|
|
926
950
|
s: "(\\d\\d|\\d)",
|
|
@@ -928,8 +952,8 @@ const tokenRegex = {
|
|
|
928
952
|
w: "(\\d\\d|\\d)",
|
|
929
953
|
y: "(\\d{2})",
|
|
930
954
|
};
|
|
931
|
-
|
|
932
|
-
Z: (date)
|
|
955
|
+
var formats = {
|
|
956
|
+
Z: function (date) { return date.toISOString(); },
|
|
933
957
|
D: function (date, locale, options) {
|
|
934
958
|
return locale.weekdays.shorthand[formats.w(date, locale, options)];
|
|
935
959
|
},
|
|
@@ -939,130 +963,151 @@ const formats = {
|
|
|
939
963
|
G: function (date, locale, options) {
|
|
940
964
|
return pad(formats.h(date, locale, options));
|
|
941
965
|
},
|
|
942
|
-
H: (date)
|
|
966
|
+
H: function (date) { return pad(date.getHours()); },
|
|
943
967
|
J: function (date, locale) {
|
|
944
968
|
return locale.ordinal !== undefined
|
|
945
969
|
? date.getDate() + locale.ordinal(date.getDate())
|
|
946
970
|
: date.getDate();
|
|
947
971
|
},
|
|
948
|
-
K: (date, locale)
|
|
972
|
+
K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
|
|
949
973
|
M: function (date, locale) {
|
|
950
974
|
return monthToStr(date.getMonth(), true, locale);
|
|
951
975
|
},
|
|
952
|
-
S: (date)
|
|
953
|
-
U: (date)
|
|
976
|
+
S: function (date) { return pad(date.getSeconds()); },
|
|
977
|
+
U: function (date) { return date.getTime() / 1000; },
|
|
954
978
|
W: function (date, _, options) {
|
|
955
979
|
return options.getWeek(date);
|
|
956
980
|
},
|
|
957
|
-
Y: (date)
|
|
958
|
-
d: (date)
|
|
959
|
-
h: (date)
|
|
960
|
-
i: (date)
|
|
961
|
-
j: (date)
|
|
981
|
+
Y: function (date) { return pad(date.getFullYear(), 4); },
|
|
982
|
+
d: function (date) { return pad(date.getDate()); },
|
|
983
|
+
h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
|
|
984
|
+
i: function (date) { return pad(date.getMinutes()); },
|
|
985
|
+
j: function (date) { return date.getDate(); },
|
|
962
986
|
l: function (date, locale) {
|
|
963
987
|
return locale.weekdays.longhand[date.getDay()];
|
|
964
988
|
},
|
|
965
|
-
m: (date)
|
|
966
|
-
n: (date)
|
|
967
|
-
s: (date)
|
|
968
|
-
u: (date)
|
|
969
|
-
w: (date)
|
|
970
|
-
y: (date)
|
|
989
|
+
m: function (date) { return pad(date.getMonth() + 1); },
|
|
990
|
+
n: function (date) { return date.getMonth() + 1; },
|
|
991
|
+
s: function (date) { return date.getSeconds(); },
|
|
992
|
+
u: function (date) { return date.getTime(); },
|
|
993
|
+
w: function (date) { return date.getDay(); },
|
|
994
|
+
y: function (date) { return String(date.getFullYear()).substring(2); },
|
|
971
995
|
};
|
|
972
996
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
.split("")
|
|
980
|
-
.map((c, i, arr) => formats[c] && arr[i - 1] !== "\\"
|
|
981
|
-
? formats[c](dateObj, locale, config)
|
|
982
|
-
: c !== "\\"
|
|
983
|
-
? c
|
|
984
|
-
: "")
|
|
985
|
-
.join("");
|
|
986
|
-
};
|
|
987
|
-
const createDateParser = ({ config = defaults, l10n = english }) => (date, givenFormat, timeless, customLocale) => {
|
|
988
|
-
if (date !== 0 && !date)
|
|
989
|
-
return undefined;
|
|
990
|
-
const locale = customLocale || l10n;
|
|
991
|
-
let parsedDate;
|
|
992
|
-
const dateOrig = date;
|
|
993
|
-
if (date instanceof Date)
|
|
994
|
-
parsedDate = new Date(date.getTime());
|
|
995
|
-
else if (typeof date !== "string" &&
|
|
996
|
-
date.toFixed !== undefined)
|
|
997
|
-
parsedDate = new Date(date);
|
|
998
|
-
else if (typeof date === "string") {
|
|
999
|
-
const format = givenFormat || (config || defaults).dateFormat;
|
|
1000
|
-
const datestr = String(date).trim();
|
|
1001
|
-
if (datestr === "today") {
|
|
1002
|
-
parsedDate = new Date();
|
|
1003
|
-
timeless = true;
|
|
997
|
+
var createDateFormatter = function (_a) {
|
|
998
|
+
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
|
|
999
|
+
return function (dateObj, frmt, overrideLocale) {
|
|
1000
|
+
var locale = overrideLocale || l10n;
|
|
1001
|
+
if (config.formatDate !== undefined && !isMobile) {
|
|
1002
|
+
return config.formatDate(dateObj, frmt, locale);
|
|
1004
1003
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1004
|
+
return frmt
|
|
1005
|
+
.split("")
|
|
1006
|
+
.map(function (c, i, arr) {
|
|
1007
|
+
return formats[c] && arr[i - 1] !== "\\"
|
|
1008
|
+
? formats[c](dateObj, locale, config)
|
|
1009
|
+
: c !== "\\"
|
|
1010
|
+
? c
|
|
1011
|
+
: "";
|
|
1012
|
+
})
|
|
1013
|
+
.join("");
|
|
1014
|
+
};
|
|
1015
|
+
};
|
|
1016
|
+
var createDateParser = function (_a) {
|
|
1017
|
+
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
|
|
1018
|
+
return function (date, givenFormat, timeless, customLocale) {
|
|
1019
|
+
if (date !== 0 && !date)
|
|
1020
|
+
return undefined;
|
|
1021
|
+
var locale = customLocale || l10n;
|
|
1022
|
+
var parsedDate;
|
|
1023
|
+
var dateOrig = date;
|
|
1024
|
+
if (date instanceof Date)
|
|
1025
|
+
parsedDate = new Date(date.getTime());
|
|
1026
|
+
else if (typeof date !== "string" &&
|
|
1027
|
+
date.toFixed !== undefined)
|
|
1007
1028
|
parsedDate = new Date(date);
|
|
1008
|
-
else if (
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1029
|
+
else if (typeof date === "string") {
|
|
1030
|
+
var format = givenFormat || (config || defaults).dateFormat;
|
|
1031
|
+
var datestr = String(date).trim();
|
|
1032
|
+
if (datestr === "today") {
|
|
1033
|
+
parsedDate = new Date();
|
|
1034
|
+
timeless = true;
|
|
1035
|
+
}
|
|
1036
|
+
else if (config && config.parseDate) {
|
|
1037
|
+
parsedDate = config.parseDate(date, format);
|
|
1038
|
+
}
|
|
1039
|
+
else if (/Z$/.test(datestr) ||
|
|
1040
|
+
/GMT$/.test(datestr)) {
|
|
1041
|
+
parsedDate = new Date(date);
|
|
1042
|
+
}
|
|
1043
|
+
else {
|
|
1044
|
+
var matched = void 0, ops = [];
|
|
1045
|
+
for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
|
|
1046
|
+
var token = format[i];
|
|
1047
|
+
var isBackSlash = token === "\\";
|
|
1048
|
+
var escaped = format[i - 1] === "\\" || isBackSlash;
|
|
1049
|
+
if (tokenRegex[token] && !escaped) {
|
|
1050
|
+
regexStr += tokenRegex[token];
|
|
1051
|
+
var match = new RegExp(regexStr).exec(date);
|
|
1052
|
+
if (match && (matched = true)) {
|
|
1053
|
+
ops[token !== "Y" ? "push" : "unshift"]({
|
|
1054
|
+
fn: revFormat[token],
|
|
1055
|
+
val: match[++matchIndex],
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1028
1058
|
}
|
|
1059
|
+
else if (!isBackSlash)
|
|
1060
|
+
regexStr += ".";
|
|
1029
1061
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1062
|
+
parsedDate =
|
|
1063
|
+
!config || !config.noCalendar
|
|
1064
|
+
? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
|
|
1065
|
+
: new Date(new Date().setHours(0, 0, 0, 0));
|
|
1066
|
+
ops.forEach(function (_a) {
|
|
1067
|
+
var fn = _a.fn, val = _a.val;
|
|
1068
|
+
return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
|
|
1069
|
+
});
|
|
1070
|
+
parsedDate = matched ? parsedDate : undefined;
|
|
1033
1071
|
}
|
|
1034
|
-
parsedDate = matched ? parsedDate : undefined;
|
|
1035
1072
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
parsedDate
|
|
1043
|
-
|
|
1073
|
+
if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
|
|
1074
|
+
config.errorHandler(new Error("Invalid date provided: " + dateOrig));
|
|
1075
|
+
return undefined;
|
|
1076
|
+
}
|
|
1077
|
+
if (timeless === true)
|
|
1078
|
+
parsedDate.setHours(0, 0, 0, 0);
|
|
1079
|
+
return parsedDate;
|
|
1080
|
+
};
|
|
1044
1081
|
};
|
|
1045
|
-
function compareDates(date1, date2, timeless
|
|
1082
|
+
function compareDates(date1, date2, timeless) {
|
|
1083
|
+
if (timeless === void 0) { timeless = true; }
|
|
1046
1084
|
if (timeless !== false) {
|
|
1047
1085
|
return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
|
|
1048
1086
|
new Date(date2.getTime()).setHours(0, 0, 0, 0));
|
|
1049
1087
|
}
|
|
1050
1088
|
return date1.getTime() - date2.getTime();
|
|
1051
1089
|
}
|
|
1052
|
-
|
|
1090
|
+
var isBetween = function (ts, ts1, ts2) {
|
|
1053
1091
|
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
|
|
1054
1092
|
};
|
|
1055
|
-
|
|
1093
|
+
var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
|
|
1094
|
+
return hours * 3600 + minutes * 60 + seconds;
|
|
1095
|
+
};
|
|
1096
|
+
var parseSeconds = function (secondsSinceMidnight) {
|
|
1097
|
+
var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
|
|
1098
|
+
return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
|
|
1099
|
+
};
|
|
1100
|
+
var duration = {
|
|
1056
1101
|
DAY: 86400000,
|
|
1057
1102
|
};
|
|
1058
1103
|
function getDefaultHours(config) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1104
|
+
var hours = config.defaultHour;
|
|
1105
|
+
var minutes = config.defaultMinute;
|
|
1106
|
+
var seconds = config.defaultSeconds;
|
|
1062
1107
|
if (config.minDate !== undefined) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1108
|
+
var minHour = config.minDate.getHours();
|
|
1109
|
+
var minMinutes = config.minDate.getMinutes();
|
|
1110
|
+
var minSeconds = config.minDate.getSeconds();
|
|
1066
1111
|
if (hours < minHour) {
|
|
1067
1112
|
hours = minHour;
|
|
1068
1113
|
}
|
|
@@ -1073,35 +1118,61 @@ function getDefaultHours(config) {
|
|
|
1073
1118
|
seconds = config.minDate.getSeconds();
|
|
1074
1119
|
}
|
|
1075
1120
|
if (config.maxDate !== undefined) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1121
|
+
var maxHr = config.maxDate.getHours();
|
|
1122
|
+
var maxMinutes = config.maxDate.getMinutes();
|
|
1078
1123
|
hours = Math.min(hours, maxHr);
|
|
1079
1124
|
if (hours === maxHr)
|
|
1080
1125
|
minutes = Math.min(maxMinutes, minutes);
|
|
1081
1126
|
if (hours === maxHr && minutes === maxMinutes)
|
|
1082
1127
|
seconds = config.maxDate.getSeconds();
|
|
1083
1128
|
}
|
|
1084
|
-
return { hours, minutes, seconds };
|
|
1129
|
+
return { hours: hours, minutes: minutes, seconds: seconds };
|
|
1085
1130
|
}
|
|
1086
1131
|
|
|
1087
1132
|
if (typeof Object.assign !== "function") {
|
|
1088
|
-
Object.assign = function (target
|
|
1133
|
+
Object.assign = function (target) {
|
|
1134
|
+
var args = [];
|
|
1135
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1136
|
+
args[_i - 1] = arguments[_i];
|
|
1137
|
+
}
|
|
1089
1138
|
if (!target) {
|
|
1090
1139
|
throw TypeError("Cannot convert undefined or null to object");
|
|
1091
1140
|
}
|
|
1092
|
-
|
|
1141
|
+
var _loop_1 = function (source) {
|
|
1093
1142
|
if (source) {
|
|
1094
|
-
Object.keys(source).forEach((key)
|
|
1143
|
+
Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
|
|
1095
1144
|
}
|
|
1145
|
+
};
|
|
1146
|
+
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
|
1147
|
+
var source = args_1[_a];
|
|
1148
|
+
_loop_1(source);
|
|
1096
1149
|
}
|
|
1097
1150
|
return target;
|
|
1098
1151
|
};
|
|
1099
1152
|
}
|
|
1100
1153
|
|
|
1101
|
-
|
|
1154
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
1155
|
+
__assign = Object.assign || function(t) {
|
|
1156
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1157
|
+
s = arguments[i];
|
|
1158
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1159
|
+
t[p] = s[p];
|
|
1160
|
+
}
|
|
1161
|
+
return t;
|
|
1162
|
+
};
|
|
1163
|
+
return __assign.apply(this, arguments);
|
|
1164
|
+
};
|
|
1165
|
+
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
1166
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
1167
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
1168
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
1169
|
+
r[k] = a[j];
|
|
1170
|
+
return r;
|
|
1171
|
+
};
|
|
1172
|
+
var DEBOUNCED_CHANGE_MS = 300;
|
|
1102
1173
|
function FlatpickrInstance(element, instanceConfig) {
|
|
1103
|
-
|
|
1104
|
-
config:
|
|
1174
|
+
var self = {
|
|
1175
|
+
config: __assign(__assign({}, defaults), flatpickr.defaultConfig),
|
|
1105
1176
|
l10n: english,
|
|
1106
1177
|
};
|
|
1107
1178
|
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
|
|
@@ -1115,10 +1186,13 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1115
1186
|
self.changeYear = changeYear;
|
|
1116
1187
|
self.clear = clear;
|
|
1117
1188
|
self.close = close;
|
|
1189
|
+
self.onMouseOver = onMouseOver;
|
|
1118
1190
|
self._createElement = createElement;
|
|
1191
|
+
self.createDay = createDay;
|
|
1119
1192
|
self.destroy = destroy;
|
|
1120
1193
|
self.isEnabled = isEnabled;
|
|
1121
1194
|
self.jumpToDate = jumpToDate;
|
|
1195
|
+
self.updateValue = updateValue;
|
|
1122
1196
|
self.open = open;
|
|
1123
1197
|
self.redraw = redraw;
|
|
1124
1198
|
self.set = set;
|
|
@@ -1126,7 +1200,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1126
1200
|
self.toggle = toggle;
|
|
1127
1201
|
function setupHelperFunctions() {
|
|
1128
1202
|
self.utils = {
|
|
1129
|
-
getDaysInMonth(month
|
|
1203
|
+
getDaysInMonth: function (month, yr) {
|
|
1204
|
+
if (month === void 0) { month = self.currentMonth; }
|
|
1205
|
+
if (yr === void 0) { yr = self.currentYear; }
|
|
1130
1206
|
if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
|
|
1131
1207
|
return 29;
|
|
1132
1208
|
return self.l10n.daysInMonth[month];
|
|
@@ -1151,17 +1227,22 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1151
1227
|
updateValue(false);
|
|
1152
1228
|
}
|
|
1153
1229
|
setCalendarWidth();
|
|
1154
|
-
|
|
1230
|
+
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1155
1231
|
if (!self.isMobile && isSafari) {
|
|
1156
1232
|
positionCalendar();
|
|
1157
1233
|
}
|
|
1158
1234
|
triggerEvent("onReady");
|
|
1159
1235
|
}
|
|
1236
|
+
function getClosestActiveElement() {
|
|
1237
|
+
var _a;
|
|
1238
|
+
return (((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode())
|
|
1239
|
+
.activeElement || document.activeElement);
|
|
1240
|
+
}
|
|
1160
1241
|
function bindToInstance(fn) {
|
|
1161
1242
|
return fn.bind(self);
|
|
1162
1243
|
}
|
|
1163
1244
|
function setCalendarWidth() {
|
|
1164
|
-
|
|
1245
|
+
var config = self.config;
|
|
1165
1246
|
if (config.weekNumbers === false && config.showMonths === 1) {
|
|
1166
1247
|
return;
|
|
1167
1248
|
}
|
|
@@ -1172,7 +1253,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1172
1253
|
self.calendarContainer.style.display = "block";
|
|
1173
1254
|
}
|
|
1174
1255
|
if (self.daysContainer !== undefined) {
|
|
1175
|
-
|
|
1256
|
+
var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
|
|
1176
1257
|
self.daysContainer.style.width = daysWidth + "px";
|
|
1177
1258
|
self.calendarContainer.style.width =
|
|
1178
1259
|
daysWidth +
|
|
@@ -1188,11 +1269,11 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1188
1269
|
}
|
|
1189
1270
|
function updateTime(e) {
|
|
1190
1271
|
if (self.selectedDates.length === 0) {
|
|
1191
|
-
|
|
1272
|
+
var defaultDate = self.config.minDate === undefined ||
|
|
1192
1273
|
compareDates(new Date(), self.config.minDate) >= 0
|
|
1193
1274
|
? new Date()
|
|
1194
1275
|
: new Date(self.config.minDate.getTime());
|
|
1195
|
-
|
|
1276
|
+
var defaults = getDefaultHours(self.config);
|
|
1196
1277
|
defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());
|
|
1197
1278
|
self.selectedDates = [defaultDate];
|
|
1198
1279
|
self.latestSelectedDateObj = defaultDate;
|
|
@@ -1200,7 +1281,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1200
1281
|
if (e !== undefined && e.type !== "blur") {
|
|
1201
1282
|
timeWrapper(e);
|
|
1202
1283
|
}
|
|
1203
|
-
|
|
1284
|
+
var prevValue = self._input.value;
|
|
1204
1285
|
setHoursFromInputs();
|
|
1205
1286
|
updateValue();
|
|
1206
1287
|
if (self._input.value !== prevValue) {
|
|
@@ -1222,49 +1303,64 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1222
1303
|
function setHoursFromInputs() {
|
|
1223
1304
|
if (self.hourElement === undefined || self.minuteElement === undefined)
|
|
1224
1305
|
return;
|
|
1225
|
-
|
|
1306
|
+
var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
|
|
1226
1307
|
? (parseInt(self.secondElement.value, 10) || 0) % 60
|
|
1227
1308
|
: 0;
|
|
1228
1309
|
if (self.amPM !== undefined) {
|
|
1229
1310
|
hours = ampm2military(hours, self.amPM.textContent);
|
|
1230
1311
|
}
|
|
1231
|
-
|
|
1312
|
+
var limitMinHours = self.config.minTime !== undefined ||
|
|
1232
1313
|
(self.config.minDate &&
|
|
1233
1314
|
self.minDateHasTime &&
|
|
1234
1315
|
self.latestSelectedDateObj &&
|
|
1235
1316
|
compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
|
|
1236
1317
|
0);
|
|
1237
|
-
|
|
1318
|
+
var limitMaxHours = self.config.maxTime !== undefined ||
|
|
1238
1319
|
(self.config.maxDate &&
|
|
1239
1320
|
self.maxDateHasTime &&
|
|
1240
1321
|
self.latestSelectedDateObj &&
|
|
1241
1322
|
compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
|
|
1242
1323
|
0);
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1324
|
+
if (self.config.maxTime !== undefined &&
|
|
1325
|
+
self.config.minTime !== undefined &&
|
|
1326
|
+
self.config.minTime > self.config.maxTime) {
|
|
1327
|
+
var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());
|
|
1328
|
+
var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());
|
|
1329
|
+
var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);
|
|
1330
|
+
if (currentTime > maxBound && currentTime < minBound) {
|
|
1331
|
+
var result = parseSeconds(minBound);
|
|
1332
|
+
hours = result[0];
|
|
1333
|
+
minutes = result[1];
|
|
1334
|
+
seconds = result[2];
|
|
1335
|
+
}
|
|
1252
1336
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1337
|
+
else {
|
|
1338
|
+
if (limitMaxHours) {
|
|
1339
|
+
var maxTime = self.config.maxTime !== undefined
|
|
1340
|
+
? self.config.maxTime
|
|
1341
|
+
: self.config.maxDate;
|
|
1342
|
+
hours = Math.min(hours, maxTime.getHours());
|
|
1343
|
+
if (hours === maxTime.getHours())
|
|
1344
|
+
minutes = Math.min(minutes, maxTime.getMinutes());
|
|
1345
|
+
if (minutes === maxTime.getMinutes())
|
|
1346
|
+
seconds = Math.min(seconds, maxTime.getSeconds());
|
|
1347
|
+
}
|
|
1348
|
+
if (limitMinHours) {
|
|
1349
|
+
var minTime = self.config.minTime !== undefined
|
|
1350
|
+
? self.config.minTime
|
|
1351
|
+
: self.config.minDate;
|
|
1352
|
+
hours = Math.max(hours, minTime.getHours());
|
|
1353
|
+
if (hours === minTime.getHours() && minutes < minTime.getMinutes())
|
|
1354
|
+
minutes = minTime.getMinutes();
|
|
1355
|
+
if (minutes === minTime.getMinutes())
|
|
1356
|
+
seconds = Math.max(seconds, minTime.getSeconds());
|
|
1357
|
+
}
|
|
1262
1358
|
}
|
|
1263
1359
|
setHours(hours, minutes, seconds);
|
|
1264
1360
|
}
|
|
1265
1361
|
function setHoursFromDate(dateObj) {
|
|
1266
|
-
|
|
1267
|
-
if (date) {
|
|
1362
|
+
var date = dateObj || self.latestSelectedDateObj;
|
|
1363
|
+
if (date && date instanceof Date) {
|
|
1268
1364
|
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
|
|
1269
1365
|
}
|
|
1270
1366
|
}
|
|
@@ -1284,8 +1380,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1284
1380
|
self.secondElement.value = pad(seconds);
|
|
1285
1381
|
}
|
|
1286
1382
|
function onYearInput(event) {
|
|
1287
|
-
|
|
1288
|
-
|
|
1383
|
+
var eventTarget = getEventTarget(event);
|
|
1384
|
+
var year = parseInt(eventTarget.value) + (event.delta || 0);
|
|
1289
1385
|
if (year / 1000 > 1 ||
|
|
1290
1386
|
(event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
|
|
1291
1387
|
changeYear(year);
|
|
@@ -1293,12 +1389,12 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1293
1389
|
}
|
|
1294
1390
|
function bind(element, event, handler, options) {
|
|
1295
1391
|
if (event instanceof Array)
|
|
1296
|
-
return event.forEach((ev)
|
|
1392
|
+
return event.forEach(function (ev) { return bind(element, ev, handler, options); });
|
|
1297
1393
|
if (element instanceof Array)
|
|
1298
|
-
return element.forEach((el)
|
|
1394
|
+
return element.forEach(function (el) { return bind(el, event, handler, options); });
|
|
1299
1395
|
element.addEventListener(event, handler, options);
|
|
1300
1396
|
self._handlers.push({
|
|
1301
|
-
remove: ()
|
|
1397
|
+
remove: function () { return element.removeEventListener(event, handler, options); },
|
|
1302
1398
|
});
|
|
1303
1399
|
}
|
|
1304
1400
|
function triggerChange() {
|
|
@@ -1306,22 +1402,27 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1306
1402
|
}
|
|
1307
1403
|
function bindEvents() {
|
|
1308
1404
|
if (self.config.wrap) {
|
|
1309
|
-
["open", "close", "toggle", "clear"].forEach((evt)
|
|
1310
|
-
Array.prototype.forEach.call(self.element.querySelectorAll(
|
|
1405
|
+
["open", "close", "toggle", "clear"].forEach(function (evt) {
|
|
1406
|
+
Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) {
|
|
1407
|
+
return bind(el, "click", self[evt]);
|
|
1408
|
+
});
|
|
1311
1409
|
});
|
|
1312
1410
|
}
|
|
1313
1411
|
if (self.isMobile) {
|
|
1314
1412
|
setupMobile();
|
|
1315
1413
|
return;
|
|
1316
1414
|
}
|
|
1317
|
-
|
|
1415
|
+
var debouncedResize = debounce$1(onResize, 50);
|
|
1318
1416
|
self._debouncedChange = debounce$1(triggerChange, DEBOUNCED_CHANGE_MS);
|
|
1319
1417
|
if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
|
|
1320
|
-
bind(self.daysContainer, "mouseover", (e)
|
|
1418
|
+
bind(self.daysContainer, "mouseover", function (e) {
|
|
1321
1419
|
if (self.config.mode === "range")
|
|
1322
1420
|
onMouseOver(getEventTarget(e));
|
|
1323
1421
|
});
|
|
1324
|
-
bind(
|
|
1422
|
+
bind(self._input, "keydown", onKeyDown);
|
|
1423
|
+
if (self.calendarContainer !== undefined) {
|
|
1424
|
+
bind(self.calendarContainer, "keydown", onKeyDown);
|
|
1425
|
+
}
|
|
1325
1426
|
if (!self.config.inline && !self.config.static)
|
|
1326
1427
|
bind(window, "resize", debouncedResize);
|
|
1327
1428
|
if (window.ontouchstart !== undefined)
|
|
@@ -1341,17 +1442,18 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1341
1442
|
if (self.timeContainer !== undefined &&
|
|
1342
1443
|
self.minuteElement !== undefined &&
|
|
1343
1444
|
self.hourElement !== undefined) {
|
|
1344
|
-
|
|
1445
|
+
var selText = function (e) {
|
|
1446
|
+
return getEventTarget(e).select();
|
|
1447
|
+
};
|
|
1345
1448
|
bind(self.timeContainer, ["increment"], updateTime);
|
|
1346
1449
|
bind(self.timeContainer, "blur", updateTime, { capture: true });
|
|
1347
1450
|
bind(self.timeContainer, "click", timeIncrement);
|
|
1348
1451
|
bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
|
|
1349
1452
|
if (self.secondElement !== undefined)
|
|
1350
|
-
bind(self.secondElement, "focus", ()
|
|
1453
|
+
bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
|
|
1351
1454
|
if (self.amPM !== undefined) {
|
|
1352
|
-
bind(self.amPM, "click", (e)
|
|
1455
|
+
bind(self.amPM, "click", function (e) {
|
|
1353
1456
|
updateTime(e);
|
|
1354
|
-
triggerChange();
|
|
1355
1457
|
});
|
|
1356
1458
|
}
|
|
1357
1459
|
}
|
|
@@ -1360,7 +1462,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1360
1462
|
}
|
|
1361
1463
|
}
|
|
1362
1464
|
function jumpToDate(jumpDate, triggerChange) {
|
|
1363
|
-
|
|
1465
|
+
var jumpTo = jumpDate !== undefined
|
|
1364
1466
|
? self.parseDate(jumpDate)
|
|
1365
1467
|
: self.latestSelectedDateObj ||
|
|
1366
1468
|
(self.config.minDate && self.config.minDate > self.now
|
|
@@ -1368,8 +1470,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1368
1470
|
: self.config.maxDate && self.config.maxDate < self.now
|
|
1369
1471
|
? self.config.maxDate
|
|
1370
1472
|
: self.now);
|
|
1371
|
-
|
|
1372
|
-
|
|
1473
|
+
var oldYear = self.currentYear;
|
|
1474
|
+
var oldMonth = self.currentMonth;
|
|
1373
1475
|
try {
|
|
1374
1476
|
if (jumpTo !== undefined) {
|
|
1375
1477
|
self.currentYear = jumpTo.getFullYear();
|
|
@@ -1391,27 +1493,27 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1391
1493
|
self.redraw();
|
|
1392
1494
|
}
|
|
1393
1495
|
function timeIncrement(e) {
|
|
1394
|
-
|
|
1496
|
+
var eventTarget = getEventTarget(e);
|
|
1395
1497
|
if (~eventTarget.className.indexOf("arrow"))
|
|
1396
1498
|
incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1);
|
|
1397
1499
|
}
|
|
1398
1500
|
function incrementNumInput(e, delta, inputElem) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1501
|
+
var target = e && getEventTarget(e);
|
|
1502
|
+
var input = inputElem ||
|
|
1401
1503
|
(target && target.parentNode && target.parentNode.firstChild);
|
|
1402
|
-
|
|
1504
|
+
var event = createEvent("increment");
|
|
1403
1505
|
event.delta = delta;
|
|
1404
1506
|
input && input.dispatchEvent(event);
|
|
1405
1507
|
}
|
|
1406
1508
|
function build() {
|
|
1407
|
-
|
|
1509
|
+
var fragment = window.document.createDocumentFragment();
|
|
1408
1510
|
self.calendarContainer = createElement("div", "flatpickr-calendar");
|
|
1409
1511
|
self.calendarContainer.tabIndex = -1;
|
|
1410
1512
|
if (!self.config.noCalendar) {
|
|
1411
1513
|
fragment.appendChild(buildMonthNav());
|
|
1412
1514
|
self.innerContainer = createElement("div", "flatpickr-innerContainer");
|
|
1413
1515
|
if (self.config.weekNumbers) {
|
|
1414
|
-
|
|
1516
|
+
var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
|
|
1415
1517
|
self.innerContainer.appendChild(weekWrapper);
|
|
1416
1518
|
self.weekNumbers = weekNumbers;
|
|
1417
1519
|
self.weekWrapper = weekWrapper;
|
|
@@ -1434,7 +1536,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1434
1536
|
toggleClass(self.calendarContainer, "animate", self.config.animate === true);
|
|
1435
1537
|
toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
|
|
1436
1538
|
self.calendarContainer.appendChild(fragment);
|
|
1437
|
-
|
|
1539
|
+
var customAppend = self.config.appendTo !== undefined &&
|
|
1438
1540
|
self.config.appendTo.nodeType !== undefined;
|
|
1439
1541
|
if (self.config.inline || self.config.static) {
|
|
1440
1542
|
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
|
|
@@ -1445,7 +1547,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1445
1547
|
self.config.appendTo.appendChild(self.calendarContainer);
|
|
1446
1548
|
}
|
|
1447
1549
|
if (self.config.static) {
|
|
1448
|
-
|
|
1550
|
+
var wrapper = createElement("div", "flatpickr-wrapper");
|
|
1449
1551
|
if (self.element.parentNode)
|
|
1450
1552
|
self.element.parentNode.insertBefore(wrapper, self.element);
|
|
1451
1553
|
wrapper.appendChild(self.element);
|
|
@@ -1459,8 +1561,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1459
1561
|
? self.config.appendTo
|
|
1460
1562
|
: window.document.body).appendChild(self.calendarContainer);
|
|
1461
1563
|
}
|
|
1462
|
-
function createDay(className, date,
|
|
1463
|
-
|
|
1564
|
+
function createDay(className, date, _dayNumber, i) {
|
|
1565
|
+
var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString());
|
|
1464
1566
|
dayElement.dateObj = date;
|
|
1465
1567
|
dayElement.$i = i;
|
|
1466
1568
|
dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
|
|
@@ -1495,7 +1597,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1495
1597
|
if (self.weekNumbers &&
|
|
1496
1598
|
self.config.showMonths === 1 &&
|
|
1497
1599
|
className !== "prevMonthDay" &&
|
|
1498
|
-
|
|
1600
|
+
i % 7 === 6) {
|
|
1499
1601
|
self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
|
|
1500
1602
|
}
|
|
1501
1603
|
triggerEvent("onDayCreate", dayElement);
|
|
@@ -1507,14 +1609,14 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1507
1609
|
onMouseOver(targetNode);
|
|
1508
1610
|
}
|
|
1509
1611
|
function getFirstAvailableDay(delta) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
for (
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
for (
|
|
1517
|
-
|
|
1612
|
+
var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
|
|
1613
|
+
var endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
1614
|
+
for (var m = startMonth; m != endMonth; m += delta) {
|
|
1615
|
+
var month = self.daysContainer.children[m];
|
|
1616
|
+
var startIndex = delta > 0 ? 0 : month.children.length - 1;
|
|
1617
|
+
var endIndex = delta > 0 ? month.children.length : -1;
|
|
1618
|
+
for (var i = startIndex; i != endIndex; i += delta) {
|
|
1619
|
+
var c = month.children[i];
|
|
1518
1620
|
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
|
|
1519
1621
|
return c;
|
|
1520
1622
|
}
|
|
@@ -1522,21 +1624,21 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1522
1624
|
return undefined;
|
|
1523
1625
|
}
|
|
1524
1626
|
function getNextAvailableDay(current, delta) {
|
|
1525
|
-
|
|
1627
|
+
var givenMonth = current.className.indexOf("Month") === -1
|
|
1526
1628
|
? current.dateObj.getMonth()
|
|
1527
1629
|
: self.currentMonth;
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
for (
|
|
1531
|
-
|
|
1532
|
-
|
|
1630
|
+
var endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
1631
|
+
var loopDelta = delta > 0 ? 1 : -1;
|
|
1632
|
+
for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
|
|
1633
|
+
var month = self.daysContainer.children[m];
|
|
1634
|
+
var startIndex = givenMonth - self.currentMonth === m
|
|
1533
1635
|
? current.$i + delta
|
|
1534
1636
|
: delta < 0
|
|
1535
1637
|
? month.children.length - 1
|
|
1536
1638
|
: 0;
|
|
1537
|
-
|
|
1538
|
-
for (
|
|
1539
|
-
|
|
1639
|
+
var numMonthDays = month.children.length;
|
|
1640
|
+
for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
|
|
1641
|
+
var c = month.children[i];
|
|
1540
1642
|
if (c.className.indexOf("hidden") === -1 &&
|
|
1541
1643
|
isEnabled(c.dateObj) &&
|
|
1542
1644
|
Math.abs(current.$i - i) >= Math.abs(delta))
|
|
@@ -1548,11 +1650,12 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1548
1650
|
return undefined;
|
|
1549
1651
|
}
|
|
1550
1652
|
function focusOnDay(current, offset) {
|
|
1551
|
-
|
|
1552
|
-
|
|
1653
|
+
var activeElement = getClosestActiveElement();
|
|
1654
|
+
var dayFocused = isInView(activeElement || document.body);
|
|
1655
|
+
var startElem = current !== undefined
|
|
1553
1656
|
? current
|
|
1554
1657
|
: dayFocused
|
|
1555
|
-
?
|
|
1658
|
+
? activeElement
|
|
1556
1659
|
: self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
|
|
1557
1660
|
? self.selectedDateElem
|
|
1558
1661
|
: self.todayDateElem !== undefined && isInView(self.todayDateElem)
|
|
@@ -1569,21 +1672,21 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1569
1672
|
}
|
|
1570
1673
|
}
|
|
1571
1674
|
function buildMonthDays(year, month) {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1675
|
+
var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
|
|
1676
|
+
var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);
|
|
1677
|
+
var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
|
|
1678
|
+
var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
|
|
1576
1679
|
for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
|
|
1577
|
-
days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
|
|
1680
|
+
days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
|
|
1578
1681
|
}
|
|
1579
1682
|
for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
|
|
1580
|
-
days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
|
|
1683
|
+
days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex));
|
|
1581
1684
|
}
|
|
1582
|
-
for (
|
|
1685
|
+
for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
|
|
1583
1686
|
(self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
|
|
1584
|
-
days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
|
|
1687
|
+
days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
|
|
1585
1688
|
}
|
|
1586
|
-
|
|
1689
|
+
var dayContainer = createElement("div", "dayContainer");
|
|
1587
1690
|
dayContainer.appendChild(days);
|
|
1588
1691
|
return dayContainer;
|
|
1589
1692
|
}
|
|
@@ -1594,9 +1697,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1594
1697
|
clearNode(self.daysContainer);
|
|
1595
1698
|
if (self.weekNumbers)
|
|
1596
1699
|
clearNode(self.weekNumbers);
|
|
1597
|
-
|
|
1598
|
-
for (
|
|
1599
|
-
|
|
1700
|
+
var frag = document.createDocumentFragment();
|
|
1701
|
+
for (var i = 0; i < self.config.showMonths; i++) {
|
|
1702
|
+
var d = new Date(self.currentYear, self.currentMonth, 1);
|
|
1600
1703
|
d.setMonth(self.currentMonth + i);
|
|
1601
1704
|
frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
|
|
1602
1705
|
}
|
|
@@ -1610,7 +1713,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1610
1713
|
if (self.config.showMonths > 1 ||
|
|
1611
1714
|
self.config.monthSelectorType !== "dropdown")
|
|
1612
1715
|
return;
|
|
1613
|
-
|
|
1716
|
+
var shouldBuildMonth = function (month) {
|
|
1614
1717
|
if (self.config.minDate !== undefined &&
|
|
1615
1718
|
self.currentYear === self.config.minDate.getFullYear() &&
|
|
1616
1719
|
month < self.config.minDate.getMonth()) {
|
|
@@ -1622,10 +1725,10 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1622
1725
|
};
|
|
1623
1726
|
self.monthsDropdownContainer.tabIndex = -1;
|
|
1624
1727
|
self.monthsDropdownContainer.innerHTML = "";
|
|
1625
|
-
for (
|
|
1728
|
+
for (var i = 0; i < 12; i++) {
|
|
1626
1729
|
if (!shouldBuildMonth(i))
|
|
1627
1730
|
continue;
|
|
1628
|
-
|
|
1731
|
+
var month = createElement("option", "flatpickr-monthDropdown-month");
|
|
1629
1732
|
month.value = new Date(self.currentYear, i).getMonth().toString();
|
|
1630
1733
|
month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
|
|
1631
1734
|
month.tabIndex = -1;
|
|
@@ -1636,9 +1739,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1636
1739
|
}
|
|
1637
1740
|
}
|
|
1638
1741
|
function buildMonth() {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1742
|
+
var container = createElement("div", "flatpickr-month");
|
|
1743
|
+
var monthNavFragment = window.document.createDocumentFragment();
|
|
1744
|
+
var monthElement;
|
|
1642
1745
|
if (self.config.showMonths > 1 ||
|
|
1643
1746
|
self.config.monthSelectorType === "static") {
|
|
1644
1747
|
monthElement = createElement("span", "cur-month");
|
|
@@ -1646,17 +1749,17 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1646
1749
|
else {
|
|
1647
1750
|
self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
|
|
1648
1751
|
self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel);
|
|
1649
|
-
bind(self.monthsDropdownContainer, "change", (e)
|
|
1650
|
-
|
|
1651
|
-
|
|
1752
|
+
bind(self.monthsDropdownContainer, "change", function (e) {
|
|
1753
|
+
var target = getEventTarget(e);
|
|
1754
|
+
var selectedMonth = parseInt(target.value, 10);
|
|
1652
1755
|
self.changeMonth(selectedMonth - self.currentMonth);
|
|
1653
1756
|
triggerEvent("onMonthChange");
|
|
1654
1757
|
});
|
|
1655
1758
|
buildMonthSwitch();
|
|
1656
1759
|
monthElement = self.monthsDropdownContainer;
|
|
1657
1760
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1761
|
+
var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
|
|
1762
|
+
var yearElement = yearInput.getElementsByTagName("input")[0];
|
|
1660
1763
|
yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
|
|
1661
1764
|
if (self.config.minDate) {
|
|
1662
1765
|
yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
|
|
@@ -1667,15 +1770,15 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1667
1770
|
!!self.config.minDate &&
|
|
1668
1771
|
self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
|
|
1669
1772
|
}
|
|
1670
|
-
|
|
1773
|
+
var currentMonth = createElement("div", "flatpickr-current-month");
|
|
1671
1774
|
currentMonth.appendChild(monthElement);
|
|
1672
1775
|
currentMonth.appendChild(yearInput);
|
|
1673
1776
|
monthNavFragment.appendChild(currentMonth);
|
|
1674
1777
|
container.appendChild(monthNavFragment);
|
|
1675
1778
|
return {
|
|
1676
|
-
container,
|
|
1677
|
-
yearElement,
|
|
1678
|
-
monthElement,
|
|
1779
|
+
container: container,
|
|
1780
|
+
yearElement: yearElement,
|
|
1781
|
+
monthElement: monthElement,
|
|
1679
1782
|
};
|
|
1680
1783
|
}
|
|
1681
1784
|
function buildMonths() {
|
|
@@ -1685,8 +1788,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1685
1788
|
self.yearElements = [];
|
|
1686
1789
|
self.monthElements = [];
|
|
1687
1790
|
}
|
|
1688
|
-
for (
|
|
1689
|
-
|
|
1791
|
+
for (var m = self.config.showMonths; m--;) {
|
|
1792
|
+
var month = buildMonth();
|
|
1690
1793
|
self.yearElements.push(month.yearElement);
|
|
1691
1794
|
self.monthElements.push(month.monthElement);
|
|
1692
1795
|
self.monthNav.appendChild(month.container);
|
|
@@ -1703,8 +1806,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1703
1806
|
self.nextMonthNav.innerHTML = self.config.nextArrow;
|
|
1704
1807
|
buildMonths();
|
|
1705
1808
|
Object.defineProperty(self, "_hidePrevMonthArrow", {
|
|
1706
|
-
get: ()
|
|
1707
|
-
set(bool) {
|
|
1809
|
+
get: function () { return self.__hidePrevMonthArrow; },
|
|
1810
|
+
set: function (bool) {
|
|
1708
1811
|
if (self.__hidePrevMonthArrow !== bool) {
|
|
1709
1812
|
toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
|
|
1710
1813
|
self.__hidePrevMonthArrow = bool;
|
|
@@ -1712,8 +1815,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1712
1815
|
},
|
|
1713
1816
|
});
|
|
1714
1817
|
Object.defineProperty(self, "_hideNextMonthArrow", {
|
|
1715
|
-
get: ()
|
|
1716
|
-
set(bool) {
|
|
1818
|
+
get: function () { return self.__hideNextMonthArrow; },
|
|
1819
|
+
set: function (bool) {
|
|
1717
1820
|
if (self.__hideNextMonthArrow !== bool) {
|
|
1718
1821
|
toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
|
|
1719
1822
|
self.__hideNextMonthArrow = bool;
|
|
@@ -1728,15 +1831,15 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1728
1831
|
self.calendarContainer.classList.add("hasTime");
|
|
1729
1832
|
if (self.config.noCalendar)
|
|
1730
1833
|
self.calendarContainer.classList.add("noCalendar");
|
|
1731
|
-
|
|
1834
|
+
var defaults = getDefaultHours(self.config);
|
|
1732
1835
|
self.timeContainer = createElement("div", "flatpickr-time");
|
|
1733
1836
|
self.timeContainer.tabIndex = -1;
|
|
1734
|
-
|
|
1735
|
-
|
|
1837
|
+
var separator = createElement("span", "flatpickr-time-separator", ":");
|
|
1838
|
+
var hourInput = createNumberInput("flatpickr-hour", {
|
|
1736
1839
|
"aria-label": self.l10n.hourAriaLabel,
|
|
1737
1840
|
});
|
|
1738
1841
|
self.hourElement = hourInput.getElementsByTagName("input")[0];
|
|
1739
|
-
|
|
1842
|
+
var minuteInput = createNumberInput("flatpickr-minute", {
|
|
1740
1843
|
"aria-label": self.l10n.minuteAriaLabel,
|
|
1741
1844
|
});
|
|
1742
1845
|
self.minuteElement = minuteInput.getElementsByTagName("input")[0];
|
|
@@ -1764,7 +1867,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1764
1867
|
self.timeContainer.classList.add("time24hr");
|
|
1765
1868
|
if (self.config.enableSeconds) {
|
|
1766
1869
|
self.timeContainer.classList.add("hasSeconds");
|
|
1767
|
-
|
|
1870
|
+
var secondInput = createNumberInput("flatpickr-second");
|
|
1768
1871
|
self.secondElement = secondInput.getElementsByTagName("input")[0];
|
|
1769
1872
|
self.secondElement.value = pad(self.latestSelectedDateObj
|
|
1770
1873
|
? self.latestSelectedDateObj.getSeconds()
|
|
@@ -1791,8 +1894,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1791
1894
|
self.weekdayContainer = createElement("div", "flatpickr-weekdays");
|
|
1792
1895
|
else
|
|
1793
1896
|
clearNode(self.weekdayContainer);
|
|
1794
|
-
for (
|
|
1795
|
-
|
|
1897
|
+
for (var i = self.config.showMonths; i--;) {
|
|
1898
|
+
var container = createElement("div", "flatpickr-weekdaycontainer");
|
|
1796
1899
|
self.weekdayContainer.appendChild(container);
|
|
1797
1900
|
}
|
|
1798
1901
|
updateWeekdays();
|
|
@@ -1802,35 +1905,29 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1802
1905
|
if (!self.weekdayContainer) {
|
|
1803
1906
|
return;
|
|
1804
1907
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1908
|
+
var firstDayOfWeek = self.l10n.firstDayOfWeek;
|
|
1909
|
+
var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);
|
|
1807
1910
|
if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
|
|
1808
|
-
weekdays =
|
|
1809
|
-
...weekdays.splice(firstDayOfWeek, weekdays.length),
|
|
1810
|
-
...weekdays.splice(0, firstDayOfWeek),
|
|
1811
|
-
];
|
|
1911
|
+
weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));
|
|
1812
1912
|
}
|
|
1813
|
-
for (
|
|
1814
|
-
self.weekdayContainer.children[i].innerHTML =
|
|
1815
|
-
<span class='flatpickr-weekday'>
|
|
1816
|
-
${weekdays.join("</span><span class='flatpickr-weekday'>")}
|
|
1817
|
-
</span>
|
|
1818
|
-
`;
|
|
1913
|
+
for (var i = self.config.showMonths; i--;) {
|
|
1914
|
+
self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n ";
|
|
1819
1915
|
}
|
|
1820
1916
|
}
|
|
1821
1917
|
function buildWeeks() {
|
|
1822
1918
|
self.calendarContainer.classList.add("hasWeeks");
|
|
1823
|
-
|
|
1919
|
+
var weekWrapper = createElement("div", "flatpickr-weekwrapper");
|
|
1824
1920
|
weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
|
|
1825
|
-
|
|
1921
|
+
var weekNumbers = createElement("div", "flatpickr-weeks");
|
|
1826
1922
|
weekWrapper.appendChild(weekNumbers);
|
|
1827
1923
|
return {
|
|
1828
|
-
weekWrapper,
|
|
1829
|
-
weekNumbers,
|
|
1924
|
+
weekWrapper: weekWrapper,
|
|
1925
|
+
weekNumbers: weekNumbers,
|
|
1830
1926
|
};
|
|
1831
1927
|
}
|
|
1832
|
-
function changeMonth(value, isOffset
|
|
1833
|
-
|
|
1928
|
+
function changeMonth(value, isOffset) {
|
|
1929
|
+
if (isOffset === void 0) { isOffset = true; }
|
|
1930
|
+
var delta = isOffset ? value : value - self.currentMonth;
|
|
1834
1931
|
if ((delta < 0 && self._hidePrevMonthArrow === true) ||
|
|
1835
1932
|
(delta > 0 && self._hideNextMonthArrow === true))
|
|
1836
1933
|
return;
|
|
@@ -1845,7 +1942,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1845
1942
|
triggerEvent("onMonthChange");
|
|
1846
1943
|
updateNavigationCurrentMonth();
|
|
1847
1944
|
}
|
|
1848
|
-
function clear(triggerChangeEvent
|
|
1945
|
+
function clear(triggerChangeEvent, toInitial) {
|
|
1946
|
+
if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
|
|
1947
|
+
if (toInitial === void 0) { toInitial = true; }
|
|
1849
1948
|
self.input.value = "";
|
|
1850
1949
|
if (self.altInput !== undefined)
|
|
1851
1950
|
self.altInput.value = "";
|
|
@@ -1858,7 +1957,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1858
1957
|
self.currentMonth = self._initialDate.getMonth();
|
|
1859
1958
|
}
|
|
1860
1959
|
if (self.config.enableTime === true) {
|
|
1861
|
-
|
|
1960
|
+
var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;
|
|
1862
1961
|
setHours(hours, minutes, seconds);
|
|
1863
1962
|
}
|
|
1864
1963
|
self.redraw();
|
|
@@ -1880,7 +1979,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1880
1979
|
function destroy() {
|
|
1881
1980
|
if (self.config !== undefined)
|
|
1882
1981
|
triggerEvent("onDestroy");
|
|
1883
|
-
for (
|
|
1982
|
+
for (var i = self._handlers.length; i--;) {
|
|
1884
1983
|
self._handlers[i].remove();
|
|
1885
1984
|
}
|
|
1886
1985
|
self._handlers = [];
|
|
@@ -1891,7 +1990,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1891
1990
|
}
|
|
1892
1991
|
else if (self.calendarContainer && self.calendarContainer.parentNode) {
|
|
1893
1992
|
if (self.config.static && self.calendarContainer.parentNode) {
|
|
1894
|
-
|
|
1993
|
+
var wrapper = self.calendarContainer.parentNode;
|
|
1895
1994
|
wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
|
|
1896
1995
|
if (wrapper.parentNode) {
|
|
1897
1996
|
while (wrapper.firstChild)
|
|
@@ -1943,7 +2042,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1943
2042
|
"navigationCurrentMonth",
|
|
1944
2043
|
"selectedDateElem",
|
|
1945
2044
|
"config",
|
|
1946
|
-
].forEach((k)
|
|
2045
|
+
].forEach(function (k) {
|
|
1947
2046
|
try {
|
|
1948
2047
|
delete self[k];
|
|
1949
2048
|
}
|
|
@@ -1951,30 +2050,31 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1951
2050
|
});
|
|
1952
2051
|
}
|
|
1953
2052
|
function isCalendarElem(elem) {
|
|
1954
|
-
if (self.config.appendTo && self.config.appendTo.contains(elem))
|
|
1955
|
-
return true;
|
|
1956
2053
|
return self.calendarContainer.contains(elem);
|
|
1957
2054
|
}
|
|
1958
2055
|
function documentClick(e) {
|
|
1959
2056
|
if (self.isOpen && !self.config.inline) {
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
self.element.contains(
|
|
2057
|
+
var eventTarget_1 = getEventTarget(e);
|
|
2058
|
+
var isCalendarElement = isCalendarElem(eventTarget_1);
|
|
2059
|
+
var isInput = eventTarget_1 === self.input ||
|
|
2060
|
+
eventTarget_1 === self.altInput ||
|
|
2061
|
+
self.element.contains(eventTarget_1) ||
|
|
1965
2062
|
(e.path &&
|
|
1966
2063
|
e.path.indexOf &&
|
|
1967
2064
|
(~e.path.indexOf(self.input) ||
|
|
1968
2065
|
~e.path.indexOf(self.altInput)));
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
!isCalendarElem(e.relatedTarget);
|
|
1976
|
-
const isIgnored = !self.config.ignoredFocusElements.some((elem) => elem.contains(eventTarget));
|
|
2066
|
+
var lostFocus = !isInput &&
|
|
2067
|
+
!isCalendarElement &&
|
|
2068
|
+
!isCalendarElem(e.relatedTarget);
|
|
2069
|
+
var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {
|
|
2070
|
+
return elem.contains(eventTarget_1);
|
|
2071
|
+
});
|
|
1977
2072
|
if (lostFocus && isIgnored) {
|
|
2073
|
+
if (self.config.allowInput) {
|
|
2074
|
+
self.setDate(self._input.value, false, self.config.altInput
|
|
2075
|
+
? self.config.altFormat
|
|
2076
|
+
: self.config.dateFormat);
|
|
2077
|
+
}
|
|
1978
2078
|
if (self.timeContainer !== undefined &&
|
|
1979
2079
|
self.minuteElement !== undefined &&
|
|
1980
2080
|
self.hourElement !== undefined &&
|
|
@@ -1985,10 +2085,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1985
2085
|
self.close();
|
|
1986
2086
|
if (self.config &&
|
|
1987
2087
|
self.config.mode === "range" &&
|
|
1988
|
-
self.selectedDates.length === 1)
|
|
2088
|
+
self.selectedDates.length === 1)
|
|
1989
2089
|
self.clear(false);
|
|
1990
|
-
self.redraw();
|
|
1991
|
-
}
|
|
1992
2090
|
}
|
|
1993
2091
|
}
|
|
1994
2092
|
}
|
|
@@ -1997,7 +2095,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
1997
2095
|
(self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
|
|
1998
2096
|
(self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
|
|
1999
2097
|
return;
|
|
2000
|
-
|
|
2098
|
+
var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
|
|
2001
2099
|
self.currentYear = newYearNum || self.currentYear;
|
|
2002
2100
|
if (self.config.maxDate &&
|
|
2003
2101
|
self.currentYear === self.config.maxDate.getFullYear()) {
|
|
@@ -2013,9 +2111,10 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2013
2111
|
buildMonthSwitch();
|
|
2014
2112
|
}
|
|
2015
2113
|
}
|
|
2016
|
-
function isEnabled(date, timeless
|
|
2114
|
+
function isEnabled(date, timeless) {
|
|
2017
2115
|
var _a;
|
|
2018
|
-
|
|
2116
|
+
if (timeless === void 0) { timeless = true; }
|
|
2117
|
+
var dateToCheck = self.parseDate(date, undefined, timeless);
|
|
2019
2118
|
if ((self.config.minDate &&
|
|
2020
2119
|
dateToCheck &&
|
|
2021
2120
|
compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
|
|
@@ -2027,8 +2126,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2027
2126
|
return true;
|
|
2028
2127
|
if (dateToCheck === undefined)
|
|
2029
2128
|
return false;
|
|
2030
|
-
|
|
2031
|
-
for (
|
|
2129
|
+
var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;
|
|
2130
|
+
for (var i = 0, d = void 0; i < array.length; i++) {
|
|
2032
2131
|
d = array[i];
|
|
2033
2132
|
if (typeof d === "function" &&
|
|
2034
2133
|
d(dateToCheck))
|
|
@@ -2038,7 +2137,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2038
2137
|
d.getTime() === dateToCheck.getTime())
|
|
2039
2138
|
return bool;
|
|
2040
2139
|
else if (typeof d === "string") {
|
|
2041
|
-
|
|
2140
|
+
var parsed = self.parseDate(d, undefined, true);
|
|
2042
2141
|
return parsed && parsed.getTime() === dateToCheck.getTime()
|
|
2043
2142
|
? bool
|
|
2044
2143
|
: !bool;
|
|
@@ -2061,9 +2160,10 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2061
2160
|
return false;
|
|
2062
2161
|
}
|
|
2063
2162
|
function onBlur(e) {
|
|
2064
|
-
|
|
2163
|
+
var isInput = e.target === self._input;
|
|
2164
|
+
var valueChanged = self._input.value.trimEnd() !== getDateStr();
|
|
2065
2165
|
if (isInput &&
|
|
2066
|
-
|
|
2166
|
+
valueChanged &&
|
|
2067
2167
|
!(e.relatedTarget && isCalendarElem(e.relatedTarget))) {
|
|
2068
2168
|
self.setDate(self._input.value, true, e.target === self.altInput
|
|
2069
2169
|
? self.config.altFormat
|
|
@@ -2071,18 +2171,19 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2071
2171
|
}
|
|
2072
2172
|
}
|
|
2073
2173
|
function onKeyDown(e) {
|
|
2074
|
-
|
|
2075
|
-
|
|
2174
|
+
var eventTarget = getEventTarget(e);
|
|
2175
|
+
var isInput = self.config.wrap
|
|
2076
2176
|
? element.contains(eventTarget)
|
|
2077
2177
|
: eventTarget === self._input;
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2178
|
+
var allowInput = self.config.allowInput;
|
|
2179
|
+
var allowKeydown = self.isOpen && (!allowInput || !isInput);
|
|
2180
|
+
var allowInlineKeydown = self.config.inline && isInput && !allowInput;
|
|
2081
2181
|
if (e.keyCode === 13 && isInput) {
|
|
2082
2182
|
if (allowInput) {
|
|
2083
2183
|
self.setDate(self._input.value, true, eventTarget === self.altInput
|
|
2084
2184
|
? self.config.altFormat
|
|
2085
2185
|
: self.config.dateFormat);
|
|
2186
|
+
self.close();
|
|
2086
2187
|
return eventTarget.blur();
|
|
2087
2188
|
}
|
|
2088
2189
|
else {
|
|
@@ -2092,7 +2193,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2092
2193
|
else if (isCalendarElem(eventTarget) ||
|
|
2093
2194
|
allowKeydown ||
|
|
2094
2195
|
allowInlineKeydown) {
|
|
2095
|
-
|
|
2196
|
+
var isTimeObj = !!self.timeContainer &&
|
|
2096
2197
|
self.timeContainer.contains(eventTarget);
|
|
2097
2198
|
switch (e.keyCode) {
|
|
2098
2199
|
case 13:
|
|
@@ -2119,15 +2220,16 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2119
2220
|
case 39:
|
|
2120
2221
|
if (!isTimeObj && !isInput) {
|
|
2121
2222
|
e.preventDefault();
|
|
2223
|
+
var activeElement = getClosestActiveElement();
|
|
2122
2224
|
if (self.daysContainer !== undefined &&
|
|
2123
2225
|
(allowInput === false ||
|
|
2124
|
-
(
|
|
2125
|
-
|
|
2226
|
+
(activeElement && isInView(activeElement)))) {
|
|
2227
|
+
var delta_1 = e.keyCode === 39 ? 1 : -1;
|
|
2126
2228
|
if (!e.ctrlKey)
|
|
2127
|
-
focusOnDay(undefined,
|
|
2229
|
+
focusOnDay(undefined, delta_1);
|
|
2128
2230
|
else {
|
|
2129
2231
|
e.stopPropagation();
|
|
2130
|
-
changeMonth(
|
|
2232
|
+
changeMonth(delta_1);
|
|
2131
2233
|
focusOnDay(getFirstAvailableDay(1), 0);
|
|
2132
2234
|
}
|
|
2133
2235
|
}
|
|
@@ -2138,7 +2240,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2138
2240
|
case 38:
|
|
2139
2241
|
case 40:
|
|
2140
2242
|
e.preventDefault();
|
|
2141
|
-
|
|
2243
|
+
var delta = e.keyCode === 40 ? 1 : -1;
|
|
2142
2244
|
if ((self.daysContainer &&
|
|
2143
2245
|
eventTarget.$i !== undefined) ||
|
|
2144
2246
|
eventTarget === self.input ||
|
|
@@ -2163,17 +2265,17 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2163
2265
|
break;
|
|
2164
2266
|
case 9:
|
|
2165
2267
|
if (isTimeObj) {
|
|
2166
|
-
|
|
2268
|
+
var elems = [
|
|
2167
2269
|
self.hourElement,
|
|
2168
2270
|
self.minuteElement,
|
|
2169
2271
|
self.secondElement,
|
|
2170
2272
|
self.amPM,
|
|
2171
2273
|
]
|
|
2172
2274
|
.concat(self.pluginElements)
|
|
2173
|
-
.filter((x)
|
|
2174
|
-
|
|
2275
|
+
.filter(function (x) { return x; });
|
|
2276
|
+
var i = elems.indexOf(eventTarget);
|
|
2175
2277
|
if (i !== -1) {
|
|
2176
|
-
|
|
2278
|
+
var target = elems[i + (e.shiftKey ? -1 : 1)];
|
|
2177
2279
|
e.preventDefault();
|
|
2178
2280
|
(target || self._input).focus();
|
|
2179
2281
|
}
|
|
@@ -2208,18 +2310,19 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2208
2310
|
triggerEvent("onKeyDown", e);
|
|
2209
2311
|
}
|
|
2210
2312
|
}
|
|
2211
|
-
function onMouseOver(elem) {
|
|
2313
|
+
function onMouseOver(elem, cellClass) {
|
|
2314
|
+
if (cellClass === void 0) { cellClass = "flatpickr-day"; }
|
|
2212
2315
|
if (self.selectedDates.length !== 1 ||
|
|
2213
2316
|
(elem &&
|
|
2214
|
-
(!elem.classList.contains(
|
|
2317
|
+
(!elem.classList.contains(cellClass) ||
|
|
2215
2318
|
elem.classList.contains("flatpickr-disabled"))))
|
|
2216
2319
|
return;
|
|
2217
|
-
|
|
2320
|
+
var hoverDate = elem
|
|
2218
2321
|
? elem.dateObj.getTime()
|
|
2219
2322
|
: self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
for (
|
|
2323
|
+
var containsDisabled = false;
|
|
2324
|
+
var minRange = 0, maxRange = 0;
|
|
2325
|
+
for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
|
|
2223
2326
|
if (!isEnabled(new Date(t), true)) {
|
|
2224
2327
|
containsDisabled =
|
|
2225
2328
|
containsDisabled || (t > rangeStartDate && t < rangeEndDate);
|
|
@@ -2229,50 +2332,49 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2229
2332
|
maxRange = t;
|
|
2230
2333
|
}
|
|
2231
2334
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
["inRange", "startRange", "endRange"].forEach((c) => {
|
|
2242
|
-
dayElem.classList.remove(c);
|
|
2243
|
-
});
|
|
2244
|
-
continue;
|
|
2245
|
-
}
|
|
2246
|
-
else if (containsDisabled && !outOfRange)
|
|
2247
|
-
continue;
|
|
2248
|
-
["startRange", "inRange", "endRange", "notAllowed"].forEach((c) => {
|
|
2335
|
+
var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass));
|
|
2336
|
+
hoverableCells.forEach(function (dayElem) {
|
|
2337
|
+
var date = dayElem.dateObj;
|
|
2338
|
+
var timestamp = date.getTime();
|
|
2339
|
+
var outOfRange = (minRange > 0 && timestamp < minRange) ||
|
|
2340
|
+
(maxRange > 0 && timestamp > maxRange);
|
|
2341
|
+
if (outOfRange) {
|
|
2342
|
+
dayElem.classList.add("notAllowed");
|
|
2343
|
+
["inRange", "startRange", "endRange"].forEach(function (c) {
|
|
2249
2344
|
dayElem.classList.remove(c);
|
|
2250
2345
|
});
|
|
2251
|
-
|
|
2252
|
-
elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
|
|
2253
|
-
? "startRange"
|
|
2254
|
-
: "endRange");
|
|
2255
|
-
if (initialDate < hoverDate && timestamp === initialDate)
|
|
2256
|
-
dayElem.classList.add("startRange");
|
|
2257
|
-
else if (initialDate > hoverDate && timestamp === initialDate)
|
|
2258
|
-
dayElem.classList.add("endRange");
|
|
2259
|
-
if (timestamp >= minRange &&
|
|
2260
|
-
(maxRange === 0 || timestamp <= maxRange) &&
|
|
2261
|
-
isBetween(timestamp, initialDate, hoverDate))
|
|
2262
|
-
dayElem.classList.add("inRange");
|
|
2263
|
-
}
|
|
2346
|
+
return;
|
|
2264
2347
|
}
|
|
2265
|
-
|
|
2348
|
+
else if (containsDisabled && !outOfRange)
|
|
2349
|
+
return;
|
|
2350
|
+
["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
|
|
2351
|
+
dayElem.classList.remove(c);
|
|
2352
|
+
});
|
|
2353
|
+
if (elem !== undefined) {
|
|
2354
|
+
elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
|
|
2355
|
+
? "startRange"
|
|
2356
|
+
: "endRange");
|
|
2357
|
+
if (initialDate < hoverDate && timestamp === initialDate)
|
|
2358
|
+
dayElem.classList.add("startRange");
|
|
2359
|
+
else if (initialDate > hoverDate && timestamp === initialDate)
|
|
2360
|
+
dayElem.classList.add("endRange");
|
|
2361
|
+
if (timestamp >= minRange &&
|
|
2362
|
+
(maxRange === 0 || timestamp <= maxRange) &&
|
|
2363
|
+
isBetween(timestamp, initialDate, hoverDate))
|
|
2364
|
+
dayElem.classList.add("inRange");
|
|
2365
|
+
}
|
|
2366
|
+
});
|
|
2266
2367
|
}
|
|
2267
2368
|
function onResize() {
|
|
2268
2369
|
if (self.isOpen && !self.config.static && !self.config.inline)
|
|
2269
2370
|
positionCalendar();
|
|
2270
2371
|
}
|
|
2271
|
-
function open(e, positionElement
|
|
2372
|
+
function open(e, positionElement) {
|
|
2373
|
+
if (positionElement === void 0) { positionElement = self._positionElement; }
|
|
2272
2374
|
if (self.isMobile === true) {
|
|
2273
2375
|
if (e) {
|
|
2274
2376
|
e.preventDefault();
|
|
2275
|
-
|
|
2377
|
+
var eventTarget = getEventTarget(e);
|
|
2276
2378
|
if (eventTarget) {
|
|
2277
2379
|
eventTarget.blur();
|
|
2278
2380
|
}
|
|
@@ -2287,7 +2389,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2287
2389
|
else if (self._input.disabled || self.config.inline) {
|
|
2288
2390
|
return;
|
|
2289
2391
|
}
|
|
2290
|
-
|
|
2392
|
+
var wasOpen = self.isOpen;
|
|
2291
2393
|
self.isOpen = true;
|
|
2292
2394
|
if (!wasOpen) {
|
|
2293
2395
|
self.calendarContainer.classList.add("open");
|
|
@@ -2299,14 +2401,14 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2299
2401
|
if (self.config.allowInput === false &&
|
|
2300
2402
|
(e === undefined ||
|
|
2301
2403
|
!self.timeContainer.contains(e.relatedTarget))) {
|
|
2302
|
-
setTimeout(()
|
|
2404
|
+
setTimeout(function () { return self.hourElement.select(); }, 50);
|
|
2303
2405
|
}
|
|
2304
2406
|
}
|
|
2305
2407
|
}
|
|
2306
2408
|
function minMaxDateSetter(type) {
|
|
2307
|
-
return (date)
|
|
2308
|
-
|
|
2309
|
-
|
|
2409
|
+
return function (date) {
|
|
2410
|
+
var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat));
|
|
2411
|
+
var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
|
|
2310
2412
|
if (dateObj !== undefined) {
|
|
2311
2413
|
self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
|
|
2312
2414
|
dateObj.getHours() > 0 ||
|
|
@@ -2314,7 +2416,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2314
2416
|
dateObj.getSeconds() > 0;
|
|
2315
2417
|
}
|
|
2316
2418
|
if (self.selectedDates) {
|
|
2317
|
-
self.selectedDates = self.selectedDates.filter((d)
|
|
2419
|
+
self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
|
|
2318
2420
|
if (!self.selectedDates.length && type === "min")
|
|
2319
2421
|
setHoursFromDate(dateObj);
|
|
2320
2422
|
updateValue();
|
|
@@ -2333,7 +2435,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2333
2435
|
};
|
|
2334
2436
|
}
|
|
2335
2437
|
function parseConfig() {
|
|
2336
|
-
|
|
2438
|
+
var boolOpts = [
|
|
2337
2439
|
"wrap",
|
|
2338
2440
|
"weekNumbers",
|
|
2339
2441
|
"allowInput",
|
|
@@ -2349,25 +2451,25 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2349
2451
|
"enableSeconds",
|
|
2350
2452
|
"disableMobile",
|
|
2351
2453
|
];
|
|
2352
|
-
|
|
2353
|
-
|
|
2454
|
+
var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);
|
|
2455
|
+
var formats = {};
|
|
2354
2456
|
self.config.parseDate = userConfig.parseDate;
|
|
2355
2457
|
self.config.formatDate = userConfig.formatDate;
|
|
2356
2458
|
Object.defineProperty(self.config, "enable", {
|
|
2357
|
-
get: ()
|
|
2358
|
-
set: (dates)
|
|
2459
|
+
get: function () { return self.config._enable; },
|
|
2460
|
+
set: function (dates) {
|
|
2359
2461
|
self.config._enable = parseDateRules(dates);
|
|
2360
2462
|
},
|
|
2361
2463
|
});
|
|
2362
2464
|
Object.defineProperty(self.config, "disable", {
|
|
2363
|
-
get: ()
|
|
2364
|
-
set: (dates)
|
|
2465
|
+
get: function () { return self.config._disable; },
|
|
2466
|
+
set: function (dates) {
|
|
2365
2467
|
self.config._disable = parseDateRules(dates);
|
|
2366
2468
|
},
|
|
2367
2469
|
});
|
|
2368
|
-
|
|
2470
|
+
var timeMode = userConfig.mode === "time";
|
|
2369
2471
|
if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
|
|
2370
|
-
|
|
2472
|
+
var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
|
|
2371
2473
|
formats.dateFormat =
|
|
2372
2474
|
userConfig.noCalendar || timeMode
|
|
2373
2475
|
? "H:i" + (userConfig.enableSeconds ? ":S" : "")
|
|
@@ -2376,29 +2478,29 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2376
2478
|
if (userConfig.altInput &&
|
|
2377
2479
|
(userConfig.enableTime || timeMode) &&
|
|
2378
2480
|
!userConfig.altFormat) {
|
|
2379
|
-
|
|
2481
|
+
var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
|
|
2380
2482
|
formats.altFormat =
|
|
2381
2483
|
userConfig.noCalendar || timeMode
|
|
2382
2484
|
? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
|
|
2383
|
-
: defaultAltFormat +
|
|
2485
|
+
: defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
|
|
2384
2486
|
}
|
|
2385
2487
|
Object.defineProperty(self.config, "minDate", {
|
|
2386
|
-
get: ()
|
|
2488
|
+
get: function () { return self.config._minDate; },
|
|
2387
2489
|
set: minMaxDateSetter("min"),
|
|
2388
2490
|
});
|
|
2389
2491
|
Object.defineProperty(self.config, "maxDate", {
|
|
2390
|
-
get: ()
|
|
2492
|
+
get: function () { return self.config._maxDate; },
|
|
2391
2493
|
set: minMaxDateSetter("max"),
|
|
2392
2494
|
});
|
|
2393
|
-
|
|
2495
|
+
var minMaxTimeSetter = function (type) { return function (val) {
|
|
2394
2496
|
self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
|
|
2395
|
-
};
|
|
2497
|
+
}; };
|
|
2396
2498
|
Object.defineProperty(self.config, "minTime", {
|
|
2397
|
-
get: ()
|
|
2499
|
+
get: function () { return self.config._minTime; },
|
|
2398
2500
|
set: minMaxTimeSetter("min"),
|
|
2399
2501
|
});
|
|
2400
2502
|
Object.defineProperty(self.config, "maxTime", {
|
|
2401
|
-
get: ()
|
|
2503
|
+
get: function () { return self.config._maxTime; },
|
|
2402
2504
|
set: minMaxTimeSetter("max"),
|
|
2403
2505
|
});
|
|
2404
2506
|
if (userConfig.mode === "time") {
|
|
@@ -2406,11 +2508,11 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2406
2508
|
self.config.enableTime = true;
|
|
2407
2509
|
}
|
|
2408
2510
|
Object.assign(self.config, formats, userConfig);
|
|
2409
|
-
for (
|
|
2511
|
+
for (var i = 0; i < boolOpts.length; i++)
|
|
2410
2512
|
self.config[boolOpts[i]] =
|
|
2411
2513
|
self.config[boolOpts[i]] === true ||
|
|
2412
2514
|
self.config[boolOpts[i]] === "true";
|
|
2413
|
-
HOOKS.filter((hook)
|
|
2515
|
+
HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
|
|
2414
2516
|
self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
|
|
2415
2517
|
});
|
|
2416
2518
|
self.isMobile =
|
|
@@ -2421,9 +2523,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2421
2523
|
!self.config.enable &&
|
|
2422
2524
|
!self.config.weekNumbers &&
|
|
2423
2525
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
2424
|
-
for (
|
|
2425
|
-
|
|
2426
|
-
for (
|
|
2526
|
+
for (var i = 0; i < self.config.plugins.length; i++) {
|
|
2527
|
+
var pluginConf = self.config.plugins[i](self) || {};
|
|
2528
|
+
for (var key in pluginConf) {
|
|
2427
2529
|
if (HOOKS.indexOf(key) > -1) {
|
|
2428
2530
|
self.config[key] = arrayify(pluginConf[key])
|
|
2429
2531
|
.map(bindToInstance)
|
|
@@ -2447,14 +2549,18 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2447
2549
|
function setupLocale() {
|
|
2448
2550
|
if (typeof self.config.locale !== "object" &&
|
|
2449
2551
|
typeof flatpickr.l10ns[self.config.locale] === "undefined")
|
|
2450
|
-
self.config.errorHandler(new Error(
|
|
2451
|
-
self.l10n =
|
|
2552
|
+
self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
|
|
2553
|
+
self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object"
|
|
2452
2554
|
? self.config.locale
|
|
2453
2555
|
: self.config.locale !== "default"
|
|
2454
2556
|
? flatpickr.l10ns[self.config.locale]
|
|
2455
2557
|
: undefined));
|
|
2456
|
-
tokenRegex.
|
|
2457
|
-
|
|
2558
|
+
tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")";
|
|
2559
|
+
tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")";
|
|
2560
|
+
tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")";
|
|
2561
|
+
tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")";
|
|
2562
|
+
tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
|
|
2563
|
+
var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));
|
|
2458
2564
|
if (userConfig.time_24hr === undefined &&
|
|
2459
2565
|
flatpickr.defaultConfig.time_24hr === undefined) {
|
|
2460
2566
|
self.config.time_24hr = self.l10n.time_24hr;
|
|
@@ -2469,21 +2575,21 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2469
2575
|
if (self.calendarContainer === undefined)
|
|
2470
2576
|
return;
|
|
2471
2577
|
triggerEvent("onPreCalendarPosition");
|
|
2472
|
-
|
|
2473
|
-
|
|
2578
|
+
var positionElement = customPositionElement || self._positionElement;
|
|
2579
|
+
var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" ||
|
|
2474
2580
|
(configPosVertical !== "below" &&
|
|
2475
2581
|
distanceFromBottom < calendarHeight &&
|
|
2476
2582
|
inputBounds.top > calendarHeight);
|
|
2477
|
-
|
|
2583
|
+
var top = window.pageYOffset +
|
|
2478
2584
|
inputBounds.top +
|
|
2479
2585
|
(!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
|
|
2480
2586
|
toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
|
|
2481
2587
|
toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
|
|
2482
2588
|
if (self.config.inline)
|
|
2483
2589
|
return;
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2590
|
+
var left = window.pageXOffset + inputBounds.left;
|
|
2591
|
+
var isCenter = false;
|
|
2592
|
+
var isRight = false;
|
|
2487
2593
|
if (configPosHorizontal === "center") {
|
|
2488
2594
|
left -= (calendarWidth - inputBounds.width) / 2;
|
|
2489
2595
|
isCenter = true;
|
|
@@ -2495,50 +2601,52 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2495
2601
|
toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight);
|
|
2496
2602
|
toggleClass(self.calendarContainer, "arrowCenter", isCenter);
|
|
2497
2603
|
toggleClass(self.calendarContainer, "arrowRight", isRight);
|
|
2498
|
-
|
|
2604
|
+
var right = window.document.body.offsetWidth -
|
|
2499
2605
|
(window.pageXOffset + inputBounds.right);
|
|
2500
|
-
|
|
2501
|
-
|
|
2606
|
+
var rightMost = left + calendarWidth > window.document.body.offsetWidth;
|
|
2607
|
+
var centerMost = right + calendarWidth > window.document.body.offsetWidth;
|
|
2502
2608
|
toggleClass(self.calendarContainer, "rightMost", rightMost);
|
|
2503
2609
|
if (self.config.static)
|
|
2504
2610
|
return;
|
|
2505
|
-
self.calendarContainer.style.top =
|
|
2611
|
+
self.calendarContainer.style.top = top + "px";
|
|
2506
2612
|
if (!rightMost) {
|
|
2507
|
-
self.calendarContainer.style.left =
|
|
2613
|
+
self.calendarContainer.style.left = left + "px";
|
|
2508
2614
|
self.calendarContainer.style.right = "auto";
|
|
2509
2615
|
}
|
|
2510
2616
|
else if (!centerMost) {
|
|
2511
2617
|
self.calendarContainer.style.left = "auto";
|
|
2512
|
-
self.calendarContainer.style.right =
|
|
2618
|
+
self.calendarContainer.style.right = right + "px";
|
|
2513
2619
|
}
|
|
2514
2620
|
else {
|
|
2515
|
-
|
|
2621
|
+
var doc = getDocumentStyleSheet();
|
|
2516
2622
|
if (doc === undefined)
|
|
2517
2623
|
return;
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2624
|
+
var bodyWidth = window.document.body.offsetWidth;
|
|
2625
|
+
var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
|
|
2626
|
+
var centerBefore = ".flatpickr-calendar.centerMost:before";
|
|
2627
|
+
var centerAfter = ".flatpickr-calendar.centerMost:after";
|
|
2628
|
+
var centerIndex = doc.cssRules.length;
|
|
2629
|
+
var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
|
|
2524
2630
|
toggleClass(self.calendarContainer, "rightMost", false);
|
|
2525
2631
|
toggleClass(self.calendarContainer, "centerMost", true);
|
|
2526
|
-
doc.insertRule(
|
|
2527
|
-
self.calendarContainer.style.left =
|
|
2632
|
+
doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
|
|
2633
|
+
self.calendarContainer.style.left = centerLeft + "px";
|
|
2528
2634
|
self.calendarContainer.style.right = "auto";
|
|
2529
2635
|
}
|
|
2530
2636
|
}
|
|
2531
2637
|
function getDocumentStyleSheet() {
|
|
2532
|
-
|
|
2533
|
-
for (
|
|
2534
|
-
|
|
2638
|
+
var editableSheet = null;
|
|
2639
|
+
for (var i = 0; i < document.styleSheets.length; i++) {
|
|
2640
|
+
var sheet = document.styleSheets[i];
|
|
2641
|
+
if (!sheet.cssRules)
|
|
2642
|
+
continue;
|
|
2535
2643
|
editableSheet = sheet;
|
|
2536
2644
|
break;
|
|
2537
2645
|
}
|
|
2538
2646
|
return editableSheet != null ? editableSheet : createStyleSheet();
|
|
2539
2647
|
}
|
|
2540
2648
|
function createStyleSheet() {
|
|
2541
|
-
|
|
2649
|
+
var style = document.createElement("style");
|
|
2542
2650
|
document.head.appendChild(style);
|
|
2543
2651
|
return style.sheet;
|
|
2544
2652
|
}
|
|
@@ -2562,16 +2670,18 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2562
2670
|
function selectDate(e) {
|
|
2563
2671
|
e.preventDefault();
|
|
2564
2672
|
e.stopPropagation();
|
|
2565
|
-
|
|
2566
|
-
day.classList
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2673
|
+
var isSelectable = function (day) {
|
|
2674
|
+
return day.classList &&
|
|
2675
|
+
day.classList.contains("flatpickr-day") &&
|
|
2676
|
+
!day.classList.contains("flatpickr-disabled") &&
|
|
2677
|
+
!day.classList.contains("notAllowed");
|
|
2678
|
+
};
|
|
2679
|
+
var t = findParent(getEventTarget(e), isSelectable);
|
|
2570
2680
|
if (t === undefined)
|
|
2571
2681
|
return;
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2682
|
+
var target = t;
|
|
2683
|
+
var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
|
|
2684
|
+
var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
|
|
2575
2685
|
selectedDate.getMonth() >
|
|
2576
2686
|
self.currentMonth + self.config.showMonths - 1) &&
|
|
2577
2687
|
self.config.mode !== "range";
|
|
@@ -2579,7 +2689,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2579
2689
|
if (self.config.mode === "single")
|
|
2580
2690
|
self.selectedDates = [selectedDate];
|
|
2581
2691
|
else if (self.config.mode === "multiple") {
|
|
2582
|
-
|
|
2692
|
+
var selectedIndex = isDateSelected(selectedDate);
|
|
2583
2693
|
if (selectedIndex)
|
|
2584
2694
|
self.selectedDates.splice(parseInt(selectedIndex), 1);
|
|
2585
2695
|
else
|
|
@@ -2592,11 +2702,11 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2592
2702
|
self.latestSelectedDateObj = selectedDate;
|
|
2593
2703
|
self.selectedDates.push(selectedDate);
|
|
2594
2704
|
if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
|
|
2595
|
-
self.selectedDates.sort((a, b)
|
|
2705
|
+
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
|
|
2596
2706
|
}
|
|
2597
2707
|
setHoursFromInputs();
|
|
2598
2708
|
if (shouldChangeMonth) {
|
|
2599
|
-
|
|
2709
|
+
var isNewYear = self.currentYear !== selectedDate.getFullYear();
|
|
2600
2710
|
self.currentYear = selectedDate.getFullYear();
|
|
2601
2711
|
self.currentMonth = selectedDate.getMonth();
|
|
2602
2712
|
if (isNewYear) {
|
|
@@ -2619,8 +2729,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2619
2729
|
if (self.hourElement !== undefined)
|
|
2620
2730
|
self.hourElement !== undefined && self.hourElement.focus();
|
|
2621
2731
|
if (self.config.closeOnSelect) {
|
|
2622
|
-
|
|
2623
|
-
|
|
2732
|
+
var single = self.config.mode === "single" && !self.config.enableTime;
|
|
2733
|
+
var range = self.config.mode === "range" &&
|
|
2624
2734
|
self.selectedDates.length === 2 &&
|
|
2625
2735
|
!self.config.enableTime;
|
|
2626
2736
|
if (single || range) {
|
|
@@ -2629,13 +2739,14 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2629
2739
|
}
|
|
2630
2740
|
triggerChange();
|
|
2631
2741
|
}
|
|
2632
|
-
|
|
2742
|
+
var CALLBACKS = {
|
|
2633
2743
|
locale: [setupLocale, updateWeekdays],
|
|
2634
2744
|
showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
|
|
2635
2745
|
minDate: [jumpToDate],
|
|
2636
2746
|
maxDate: [jumpToDate],
|
|
2747
|
+
positionElement: [updatePositionElement],
|
|
2637
2748
|
clickOpens: [
|
|
2638
|
-
()
|
|
2749
|
+
function () {
|
|
2639
2750
|
if (self.config.clickOpens === true) {
|
|
2640
2751
|
bind(self._input, "focus", self.open);
|
|
2641
2752
|
bind(self._input, "click", self.open);
|
|
@@ -2650,15 +2761,15 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2650
2761
|
function set(option, value) {
|
|
2651
2762
|
if (option !== null && typeof option === "object") {
|
|
2652
2763
|
Object.assign(self.config, option);
|
|
2653
|
-
for (
|
|
2764
|
+
for (var key in option) {
|
|
2654
2765
|
if (CALLBACKS[key] !== undefined)
|
|
2655
|
-
CALLBACKS[key].forEach((x)
|
|
2766
|
+
CALLBACKS[key].forEach(function (x) { return x(); });
|
|
2656
2767
|
}
|
|
2657
2768
|
}
|
|
2658
2769
|
else {
|
|
2659
2770
|
self.config[option] = value;
|
|
2660
2771
|
if (CALLBACKS[option] !== undefined)
|
|
2661
|
-
CALLBACKS[option].forEach((x)
|
|
2772
|
+
CALLBACKS[option].forEach(function (x) { return x(); });
|
|
2662
2773
|
else if (HOOKS.indexOf(option) > -1)
|
|
2663
2774
|
self.config[option] = arrayify(value);
|
|
2664
2775
|
}
|
|
@@ -2666,9 +2777,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2666
2777
|
updateValue(true);
|
|
2667
2778
|
}
|
|
2668
2779
|
function setSelectedDate(inputDate, format) {
|
|
2669
|
-
|
|
2780
|
+
var dates = [];
|
|
2670
2781
|
if (inputDate instanceof Array)
|
|
2671
|
-
dates = inputDate.map((d)
|
|
2782
|
+
dates = inputDate.map(function (d) { return self.parseDate(d, format); });
|
|
2672
2783
|
else if (inputDate instanceof Date || typeof inputDate === "number")
|
|
2673
2784
|
dates = [self.parseDate(inputDate, format)];
|
|
2674
2785
|
else if (typeof inputDate === "string") {
|
|
@@ -2680,24 +2791,26 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2680
2791
|
case "multiple":
|
|
2681
2792
|
dates = inputDate
|
|
2682
2793
|
.split(self.config.conjunction)
|
|
2683
|
-
.map((date)
|
|
2794
|
+
.map(function (date) { return self.parseDate(date, format); });
|
|
2684
2795
|
break;
|
|
2685
2796
|
case "range":
|
|
2686
2797
|
dates = inputDate
|
|
2687
2798
|
.split(self.l10n.rangeSeparator)
|
|
2688
|
-
.map((date)
|
|
2799
|
+
.map(function (date) { return self.parseDate(date, format); });
|
|
2689
2800
|
break;
|
|
2690
2801
|
}
|
|
2691
2802
|
}
|
|
2692
2803
|
else
|
|
2693
|
-
self.config.errorHandler(new Error(
|
|
2804
|
+
self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
|
|
2694
2805
|
self.selectedDates = (self.config.allowInvalidPreload
|
|
2695
2806
|
? dates
|
|
2696
|
-
: dates.filter((d)
|
|
2807
|
+
: dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));
|
|
2697
2808
|
if (self.config.mode === "range")
|
|
2698
|
-
self.selectedDates.sort((a, b)
|
|
2809
|
+
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
|
|
2699
2810
|
}
|
|
2700
|
-
function setDate(date, triggerChange
|
|
2811
|
+
function setDate(date, triggerChange, format) {
|
|
2812
|
+
if (triggerChange === void 0) { triggerChange = false; }
|
|
2813
|
+
if (format === void 0) { format = self.config.dateFormat; }
|
|
2701
2814
|
if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
|
|
2702
2815
|
return self.clear(triggerChange);
|
|
2703
2816
|
setSelectedDate(date, format);
|
|
@@ -2716,7 +2829,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2716
2829
|
function parseDateRules(arr) {
|
|
2717
2830
|
return arr
|
|
2718
2831
|
.slice()
|
|
2719
|
-
.map((rule)
|
|
2832
|
+
.map(function (rule) {
|
|
2720
2833
|
if (typeof rule === "string" ||
|
|
2721
2834
|
typeof rule === "number" ||
|
|
2722
2835
|
rule instanceof Date) {
|
|
@@ -2732,12 +2845,12 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2732
2845
|
};
|
|
2733
2846
|
return rule;
|
|
2734
2847
|
})
|
|
2735
|
-
.filter((x)
|
|
2848
|
+
.filter(function (x) { return x; });
|
|
2736
2849
|
}
|
|
2737
2850
|
function setupDates() {
|
|
2738
2851
|
self.selectedDates = [];
|
|
2739
2852
|
self.now = self.parseDate(self.config.now) || new Date();
|
|
2740
|
-
|
|
2853
|
+
var preloadedDate = self.config.defaultDate ||
|
|
2741
2854
|
((self.input.nodeName === "INPUT" ||
|
|
2742
2855
|
self.input.nodeName === "TEXTAREA") &&
|
|
2743
2856
|
self.input.placeholder &&
|
|
@@ -2799,10 +2912,13 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2799
2912
|
}
|
|
2800
2913
|
if (!self.config.allowInput)
|
|
2801
2914
|
self._input.setAttribute("readonly", "readonly");
|
|
2915
|
+
updatePositionElement();
|
|
2916
|
+
}
|
|
2917
|
+
function updatePositionElement() {
|
|
2802
2918
|
self._positionElement = self.config.positionElement || self._input;
|
|
2803
2919
|
}
|
|
2804
2920
|
function setupMobile() {
|
|
2805
|
-
|
|
2921
|
+
var inputType = self.config.enableTime
|
|
2806
2922
|
? self.config.noCalendar
|
|
2807
2923
|
? "time"
|
|
2808
2924
|
: "datetime-local"
|
|
@@ -2836,7 +2952,7 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2836
2952
|
self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
|
|
2837
2953
|
}
|
|
2838
2954
|
catch (_a) { }
|
|
2839
|
-
bind(self.mobileInput, "change", (e)
|
|
2955
|
+
bind(self.mobileInput, "change", function (e) {
|
|
2840
2956
|
self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);
|
|
2841
2957
|
triggerEvent("onChange");
|
|
2842
2958
|
triggerEvent("onClose");
|
|
@@ -2850,9 +2966,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2850
2966
|
function triggerEvent(event, data) {
|
|
2851
2967
|
if (self.config === undefined)
|
|
2852
2968
|
return;
|
|
2853
|
-
|
|
2969
|
+
var hooks = self.config[event];
|
|
2854
2970
|
if (hooks !== undefined && hooks.length > 0) {
|
|
2855
|
-
for (
|
|
2971
|
+
for (var i = 0; hooks[i] && i < hooks.length; i++)
|
|
2856
2972
|
hooks[i](self.selectedDates, self.input.value, self, data);
|
|
2857
2973
|
}
|
|
2858
2974
|
if (event === "onChange") {
|
|
@@ -2861,13 +2977,15 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2861
2977
|
}
|
|
2862
2978
|
}
|
|
2863
2979
|
function createEvent(name) {
|
|
2864
|
-
|
|
2980
|
+
var e = document.createEvent("Event");
|
|
2865
2981
|
e.initEvent(name, true, true);
|
|
2866
2982
|
return e;
|
|
2867
2983
|
}
|
|
2868
2984
|
function isDateSelected(date) {
|
|
2869
|
-
for (
|
|
2870
|
-
|
|
2985
|
+
for (var i = 0; i < self.selectedDates.length; i++) {
|
|
2986
|
+
var selectedDate = self.selectedDates[i];
|
|
2987
|
+
if (selectedDate instanceof Date &&
|
|
2988
|
+
compareDates(selectedDate, date) === 0)
|
|
2871
2989
|
return "" + i;
|
|
2872
2990
|
}
|
|
2873
2991
|
return false;
|
|
@@ -2881,8 +2999,8 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2881
2999
|
function updateNavigationCurrentMonth() {
|
|
2882
3000
|
if (self.config.noCalendar || self.isMobile || !self.monthNav)
|
|
2883
3001
|
return;
|
|
2884
|
-
self.yearElements.forEach((yearElement, i)
|
|
2885
|
-
|
|
3002
|
+
self.yearElements.forEach(function (yearElement, i) {
|
|
3003
|
+
var d = new Date(self.currentYear, self.currentMonth, 1);
|
|
2886
3004
|
d.setMonth(self.currentMonth + i);
|
|
2887
3005
|
if (self.config.showMonths > 1 ||
|
|
2888
3006
|
self.config.monthSelectorType === "static") {
|
|
@@ -2905,17 +3023,22 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2905
3023
|
? self.currentMonth + 1 > self.config.maxDate.getMonth()
|
|
2906
3024
|
: self.currentYear > self.config.maxDate.getFullYear());
|
|
2907
3025
|
}
|
|
2908
|
-
function getDateStr(
|
|
3026
|
+
function getDateStr(specificFormat) {
|
|
3027
|
+
var format = specificFormat ||
|
|
3028
|
+
(self.config.altInput ? self.config.altFormat : self.config.dateFormat);
|
|
2909
3029
|
return self.selectedDates
|
|
2910
|
-
.map((dObj)
|
|
2911
|
-
.filter((d, i, arr)
|
|
2912
|
-
self.config.
|
|
2913
|
-
|
|
3030
|
+
.map(function (dObj) { return self.formatDate(dObj, format); })
|
|
3031
|
+
.filter(function (d, i, arr) {
|
|
3032
|
+
return self.config.mode !== "range" ||
|
|
3033
|
+
self.config.enableTime ||
|
|
3034
|
+
arr.indexOf(d) === i;
|
|
3035
|
+
})
|
|
2914
3036
|
.join(self.config.mode !== "range"
|
|
2915
3037
|
? self.config.conjunction
|
|
2916
3038
|
: self.l10n.rangeSeparator);
|
|
2917
3039
|
}
|
|
2918
|
-
function updateValue(triggerChange
|
|
3040
|
+
function updateValue(triggerChange) {
|
|
3041
|
+
if (triggerChange === void 0) { triggerChange = true; }
|
|
2919
3042
|
if (self.mobileInput !== undefined && self.mobileFormatStr) {
|
|
2920
3043
|
self.mobileInput.value =
|
|
2921
3044
|
self.latestSelectedDateObj !== undefined
|
|
@@ -2930,9 +3053,9 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2930
3053
|
triggerEvent("onValueUpdate");
|
|
2931
3054
|
}
|
|
2932
3055
|
function onMonthNavClick(e) {
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
3056
|
+
var eventTarget = getEventTarget(e);
|
|
3057
|
+
var isPrevMonth = self.prevMonthNav.contains(eventTarget);
|
|
3058
|
+
var isNextMonth = self.nextMonthNav.contains(eventTarget);
|
|
2936
3059
|
if (isPrevMonth || isNextMonth) {
|
|
2937
3060
|
changeMonth(isPrevMonth ? -1 : 1);
|
|
2938
3061
|
}
|
|
@@ -2948,16 +3071,16 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2948
3071
|
}
|
|
2949
3072
|
function timeWrapper(e) {
|
|
2950
3073
|
e.preventDefault();
|
|
2951
|
-
|
|
3074
|
+
var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget;
|
|
2952
3075
|
if (self.amPM !== undefined && eventTarget === self.amPM) {
|
|
2953
3076
|
self.amPM.textContent =
|
|
2954
3077
|
self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
|
|
2955
3078
|
}
|
|
2956
|
-
|
|
3079
|
+
var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta ||
|
|
2957
3080
|
(isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
|
|
2958
|
-
|
|
3081
|
+
var newValue = curValue + step * delta;
|
|
2959
3082
|
if (typeof input.value !== "undefined" && input.value.length === 2) {
|
|
2960
|
-
|
|
3083
|
+
var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
|
|
2961
3084
|
if (newValue < min) {
|
|
2962
3085
|
newValue =
|
|
2963
3086
|
max +
|
|
@@ -2988,12 +3111,12 @@ function FlatpickrInstance(element, instanceConfig) {
|
|
|
2988
3111
|
return self;
|
|
2989
3112
|
}
|
|
2990
3113
|
function _flatpickr(nodeList, config) {
|
|
2991
|
-
|
|
3114
|
+
var nodes = Array.prototype.slice
|
|
2992
3115
|
.call(nodeList)
|
|
2993
|
-
.filter((x)
|
|
2994
|
-
|
|
2995
|
-
for (
|
|
2996
|
-
|
|
3116
|
+
.filter(function (x) { return x instanceof HTMLElement; });
|
|
3117
|
+
var instances = [];
|
|
3118
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
3119
|
+
var node = nodes[i];
|
|
2997
3120
|
try {
|
|
2998
3121
|
if (node.getAttribute("data-fp-omit") !== null)
|
|
2999
3122
|
continue;
|
|
@@ -3033,14 +3156,14 @@ var flatpickr = function (selector, config) {
|
|
|
3033
3156
|
};
|
|
3034
3157
|
flatpickr.defaultConfig = {};
|
|
3035
3158
|
flatpickr.l10ns = {
|
|
3036
|
-
en:
|
|
3037
|
-
default:
|
|
3159
|
+
en: __assign({}, english),
|
|
3160
|
+
default: __assign({}, english),
|
|
3038
3161
|
};
|
|
3039
|
-
flatpickr.localize = (l10n)
|
|
3040
|
-
flatpickr.l10ns.default =
|
|
3162
|
+
flatpickr.localize = function (l10n) {
|
|
3163
|
+
flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);
|
|
3041
3164
|
};
|
|
3042
|
-
flatpickr.setDefaults = (config)
|
|
3043
|
-
flatpickr.defaultConfig =
|
|
3165
|
+
flatpickr.setDefaults = function (config) {
|
|
3166
|
+
flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);
|
|
3044
3167
|
};
|
|
3045
3168
|
flatpickr.parseDate = createDateParser({});
|
|
3046
3169
|
flatpickr.formatDate = createDateFormatter({});
|
|
@@ -19102,27 +19225,31 @@ if (typeof window !== "undefined") {
|
|
|
19102
19225
|
const arrowSvg = (rotate = false) => `<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="${rotate
|
|
19103
19226
|
? 'M0.557948 5.6813L6.06209 0.132167C6.23831 -0.0440556 6.52327 -0.0440556 6.69949 0.132167L7.44187 0.874551C7.61809 1.05077 7.61809 1.33573 7.44187 1.51195L2.99882 6L7.44187 10.488C7.61809 10.6643 7.61809 10.9492 7.44187 11.1254L6.69949 11.8678C6.52327 12.0441 6.23831 12.0441 6.06209 11.8678L0.557948 6.3187C0.381726 6.14248 0.381726 5.85752 0.557948 5.6813Z'
|
|
19104
19227
|
: 'M7.44187 6.3187L1.93773 11.8678C1.76151 12.0441 1.47655 12.0441 1.30033 11.8678L0.557948 11.1254C0.381726 10.9492 0.381726 10.6643 0.557948 10.488L5.001 6L0.557948 1.51195C0.381726 1.33573 0.381726 1.05077 0.557948 0.874551L1.30033 0.132167C1.47655 -0.0440556 1.76151 -0.0440556 1.93773 0.132167L7.44187 5.6813C7.6181 5.85752 7.6181 6.14248 7.44187 6.3187Z'}" /></svg>`;
|
|
19105
|
-
const XplInput$1 = class extends HTMLElement {
|
|
19228
|
+
const XplInput$1 = class extends HTMLElement$1 {
|
|
19106
19229
|
constructor() {
|
|
19107
19230
|
super();
|
|
19108
19231
|
this.__registerHost();
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
*/
|
|
19232
|
+
this._id = undefined;
|
|
19233
|
+
this.autocomplete = undefined;
|
|
19112
19234
|
this.dateFormat = 'Y-m-d';
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19235
|
+
this.description = undefined;
|
|
19236
|
+
this.disabled = undefined;
|
|
19237
|
+
this.error = undefined;
|
|
19238
|
+
this.label = undefined;
|
|
19239
|
+
this.max = undefined;
|
|
19240
|
+
this.maxCharacterCount = undefined;
|
|
19241
|
+
this.min = undefined;
|
|
19118
19242
|
this.mode = 'single';
|
|
19119
|
-
/**
|
|
19120
|
-
* Whether to render as a singleline text input or
|
|
19121
|
-
* as a multiline textarea. (If `true`, `pre` and `post`
|
|
19122
|
-
* values will be ignored, if present.)
|
|
19123
|
-
*/
|
|
19124
19243
|
this.multiline = false;
|
|
19244
|
+
this.name = undefined;
|
|
19245
|
+
this.placeholder = undefined;
|
|
19246
|
+
this.post = undefined;
|
|
19247
|
+
this.pre = undefined;
|
|
19248
|
+
this.readonly = undefined;
|
|
19249
|
+
this.required = undefined;
|
|
19250
|
+
this.step = undefined;
|
|
19125
19251
|
this.type = 'text';
|
|
19252
|
+
this.value = undefined;
|
|
19126
19253
|
this.characterCount = 0;
|
|
19127
19254
|
this.passwordVisible = false;
|
|
19128
19255
|
}
|
|
@@ -19207,32 +19334,10 @@ const ListItemCpt = ({ avatar, avatars, badges, href, title, subtext, metadata,
|
|
|
19207
19334
|
}))))));
|
|
19208
19335
|
return href ? (h("a", { class: "xpl-list-item", href: href }, inner)) : (h("div", { class: "xpl-list-item" }, inner));
|
|
19209
19336
|
};
|
|
19210
|
-
const XplList$1 = class extends HTMLElement {
|
|
19337
|
+
const XplList$1 = class extends HTMLElement$1 {
|
|
19211
19338
|
constructor() {
|
|
19212
19339
|
super();
|
|
19213
19340
|
this.__registerHost();
|
|
19214
|
-
/**
|
|
19215
|
-
* `items` should be an array of objects with the following signature:
|
|
19216
|
-
* {
|
|
19217
|
-
* avatar?: string; // The URL of the avatar, or the placeholder initials (ex. "SPD").
|
|
19218
|
-
* avatars?: string[]; // The URLs of multiple avatars to be displayed in a group on the right.
|
|
19219
|
-
* badges?: string[] | { // An array of strings or badge-like objects to be displayed as badges
|
|
19220
|
-
* dot?: boolean; // in a group on the right. See <xpl-badge> for more details.
|
|
19221
|
-
* text: string;
|
|
19222
|
-
* variant?: string;
|
|
19223
|
-
* }[];
|
|
19224
|
-
* href?: string; // A URL, if this list item is meant to link somewhere.
|
|
19225
|
-
* title: string; // The text to be displayed for the list item.
|
|
19226
|
-
* metadata?: string[] | { // An array of strings or strings with icons (reference the allowed
|
|
19227
|
-
* icon: string; // Font Awesome icons) to be displayed as metadata below the title.
|
|
19228
|
-
* text: string;
|
|
19229
|
-
* }[];
|
|
19230
|
-
* subtext?: string; // Subtext to be displayed on the right.
|
|
19231
|
-
* }
|
|
19232
|
-
*
|
|
19233
|
-
* - Note that you should *only use one of* `avatars`, `badges`, or `subtext`, to avoid cluttering
|
|
19234
|
-
* the right-hand side of the list item.
|
|
19235
|
-
*/
|
|
19236
19341
|
this.items = [];
|
|
19237
19342
|
}
|
|
19238
19343
|
render() {
|
|
@@ -19240,14 +19345,11 @@ const XplList$1 = class extends HTMLElement {
|
|
|
19240
19345
|
}
|
|
19241
19346
|
};
|
|
19242
19347
|
|
|
19243
|
-
const XplMainNav$1 = class extends HTMLElement {
|
|
19348
|
+
const XplMainNav$1 = class extends HTMLElement$1 {
|
|
19244
19349
|
constructor() {
|
|
19245
19350
|
super();
|
|
19246
19351
|
this.__registerHost();
|
|
19247
19352
|
this.navWidth = createEvent(this, "navWidth", 7);
|
|
19248
|
-
/**
|
|
19249
|
-
* @property {string} width - The width of the Main Nav.
|
|
19250
|
-
*/
|
|
19251
19353
|
this.width = 'default';
|
|
19252
19354
|
}
|
|
19253
19355
|
navWidthHandler() {
|
|
@@ -19264,14 +19366,11 @@ const XplMainNav$1 = class extends HTMLElement {
|
|
|
19264
19366
|
}
|
|
19265
19367
|
};
|
|
19266
19368
|
|
|
19267
|
-
const XplNavItem$1 = class extends HTMLElement {
|
|
19369
|
+
const XplNavItem$1 = class extends HTMLElement$1 {
|
|
19268
19370
|
constructor() {
|
|
19269
19371
|
super();
|
|
19270
19372
|
this.__registerHost();
|
|
19271
19373
|
this.navOpen = createEvent(this, "navOpen", 7);
|
|
19272
|
-
/**
|
|
19273
|
-
* @property {boolean} - Whether or not the item should control the main nav state on click
|
|
19274
|
-
*/
|
|
19275
19374
|
this.navControl = false;
|
|
19276
19375
|
}
|
|
19277
19376
|
onNavToggle() {
|
|
@@ -19288,12 +19387,11 @@ const XplNavItem$1 = class extends HTMLElement {
|
|
|
19288
19387
|
}
|
|
19289
19388
|
};
|
|
19290
19389
|
|
|
19291
|
-
const XplPagination$1 = class extends HTMLElement {
|
|
19390
|
+
const XplPagination$1 = class extends HTMLElement$1 {
|
|
19292
19391
|
constructor() {
|
|
19293
19392
|
super();
|
|
19294
19393
|
this.__registerHost();
|
|
19295
19394
|
this.page = createEvent(this, "page", 7);
|
|
19296
|
-
this.current = 1;
|
|
19297
19395
|
/**
|
|
19298
19396
|
* Private `_goto` method respects the `waitForCallback` prop --
|
|
19299
19397
|
* it will always emit the `page` event, but won't actually update
|
|
@@ -19315,6 +19413,10 @@ const XplPagination$1 = class extends HTMLElement {
|
|
|
19315
19413
|
if (this.current < numPages)
|
|
19316
19414
|
this._goto(this.current + 1);
|
|
19317
19415
|
};
|
|
19416
|
+
this.total = undefined;
|
|
19417
|
+
this.perPage = undefined;
|
|
19418
|
+
this.waitForCallback = undefined;
|
|
19419
|
+
this.current = 1;
|
|
19318
19420
|
}
|
|
19319
19421
|
/**
|
|
19320
19422
|
* Calling `goto` with a page number (which should probably be
|
|
@@ -19358,11 +19460,18 @@ const XplPagination$1 = class extends HTMLElement {
|
|
|
19358
19460
|
}
|
|
19359
19461
|
};
|
|
19360
19462
|
|
|
19361
|
-
const XplRadio$1 = class extends HTMLElement {
|
|
19463
|
+
const XplRadio$1 = class extends HTMLElement$1 {
|
|
19362
19464
|
constructor() {
|
|
19363
19465
|
super();
|
|
19364
19466
|
this.__registerHost();
|
|
19365
19467
|
this.radioChange = createEvent(this, "radioChange", 7);
|
|
19468
|
+
this.checked = undefined;
|
|
19469
|
+
this.description = undefined;
|
|
19470
|
+
this.disabled = undefined;
|
|
19471
|
+
this.name = undefined;
|
|
19472
|
+
this.required = undefined;
|
|
19473
|
+
this.styled = undefined;
|
|
19474
|
+
this.value = undefined;
|
|
19366
19475
|
this.id = v4();
|
|
19367
19476
|
}
|
|
19368
19477
|
render() {
|
|
@@ -19380,7 +19489,7 @@ const XplRadio$1 = class extends HTMLElement {
|
|
|
19380
19489
|
}
|
|
19381
19490
|
};
|
|
19382
19491
|
|
|
19383
|
-
const XplSecondaryNav$1 = class extends HTMLElement {
|
|
19492
|
+
const XplSecondaryNav$1 = class extends HTMLElement$1 {
|
|
19384
19493
|
constructor() {
|
|
19385
19494
|
super();
|
|
19386
19495
|
this.__registerHost();
|
|
@@ -19838,39 +19947,24 @@ function tagWidth(text) {
|
|
|
19838
19947
|
"14px apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif";
|
|
19839
19948
|
return context.measureText(text).width + 44; // = text + l/r padding + margin-right
|
|
19840
19949
|
}
|
|
19841
|
-
const XplSelect$1 = class extends HTMLElement {
|
|
19950
|
+
const XplSelect$1 = class extends HTMLElement$1 {
|
|
19842
19951
|
constructor() {
|
|
19843
19952
|
super();
|
|
19844
19953
|
this.__registerHost();
|
|
19845
|
-
/**
|
|
19846
|
-
* An array of choices for the user to choose from.
|
|
19847
|
-
* Each choice should be of the form:
|
|
19848
|
-
* {
|
|
19849
|
-
* label: string;
|
|
19850
|
-
* href?: string;
|
|
19851
|
-
* value?: string;
|
|
19852
|
-
* isGroupHeading?: boolean;
|
|
19853
|
-
* }
|
|
19854
|
-
*/
|
|
19855
19954
|
this.choices = [];
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19955
|
+
this.description = undefined;
|
|
19956
|
+
this.disabled = undefined;
|
|
19957
|
+
this.error = undefined;
|
|
19958
|
+
this.label = undefined;
|
|
19859
19959
|
this.mode = 'single';
|
|
19860
|
-
|
|
19861
|
-
* Only used in multi-choice selects. If `true`,
|
|
19862
|
-
* badges representing selections that would overflow the
|
|
19863
|
-
* container are replaced with "+x more" (where x is the
|
|
19864
|
-
* number not shown). If `false`, the container's height will
|
|
19865
|
-
* adjust to show all badges representing selections.
|
|
19866
|
-
*/
|
|
19960
|
+
this.placeholder = undefined;
|
|
19867
19961
|
this.truncate = true;
|
|
19868
19962
|
this.active = false;
|
|
19869
19963
|
this.id = v4();
|
|
19870
19964
|
this.keepFocus = false;
|
|
19965
|
+
this.selected = undefined;
|
|
19871
19966
|
this.value = '';
|
|
19872
19967
|
this.displayValue = '';
|
|
19873
|
-
// infinity isn't real, it's just a mathematical construct, it can't hurt you
|
|
19874
19968
|
this.visibleChoices = Infinity;
|
|
19875
19969
|
}
|
|
19876
19970
|
componentWillLoad() {
|
|
@@ -20008,13 +20102,11 @@ const XplSelect$1 = class extends HTMLElement {
|
|
|
20008
20102
|
}
|
|
20009
20103
|
};
|
|
20010
20104
|
|
|
20011
|
-
const XplTable$1 = class extends HTMLElement {
|
|
20105
|
+
const XplTable$1 = class extends HTMLElement$1 {
|
|
20012
20106
|
constructor() {
|
|
20013
20107
|
super();
|
|
20014
20108
|
this.__registerHost();
|
|
20015
20109
|
this.tableSelect = createEvent(this, "tableSelect", 7);
|
|
20016
|
-
this.areAllSelected = false;
|
|
20017
|
-
this.hasScrolled = false;
|
|
20018
20110
|
this.selectAll = (e) => {
|
|
20019
20111
|
const { target } = e;
|
|
20020
20112
|
if (!(target instanceof HTMLInputElement))
|
|
@@ -20042,28 +20134,43 @@ const XplTable$1 = class extends HTMLElement {
|
|
|
20042
20134
|
this.onScroll = () => {
|
|
20043
20135
|
this.hasScrolled = this.container.scrollLeft > 0;
|
|
20044
20136
|
};
|
|
20137
|
+
/**
|
|
20138
|
+
* TODO: Need to figure out how this interplays with data
|
|
20139
|
+
* received from an API/server
|
|
20140
|
+
*/
|
|
20141
|
+
// private sortBy = (col: number, ascending = true) => {
|
|
20142
|
+
// this.rowData.sort((a, b) => {
|
|
20143
|
+
// const A = a[col];
|
|
20144
|
+
// const B = b[col];
|
|
20145
|
+
// if (typeof A === 'number' && typeof B === 'number') {
|
|
20146
|
+
// const f = ascending ? 1 : -1;
|
|
20147
|
+
// return A > B ? f : -f;
|
|
20148
|
+
// }
|
|
20149
|
+
// return -1;
|
|
20150
|
+
// });
|
|
20151
|
+
// this.rowData = Array.from(this.rowData);
|
|
20152
|
+
// this.render();
|
|
20153
|
+
// };
|
|
20154
|
+
this.setData = () => {
|
|
20155
|
+
this.rowData = this.data !== undefined ? Array.from(this.data) : [];
|
|
20156
|
+
this.selected = new Array(this.rowData.length).fill(false);
|
|
20157
|
+
};
|
|
20158
|
+
this.columns = undefined;
|
|
20159
|
+
this.data = undefined;
|
|
20160
|
+
this.freeze = undefined;
|
|
20161
|
+
this.multiselect = undefined;
|
|
20162
|
+
this.striped = undefined;
|
|
20163
|
+
this.areAllSelected = false;
|
|
20164
|
+
this.rowData = undefined;
|
|
20165
|
+
this.hasScrolled = false;
|
|
20166
|
+
this.selected = undefined;
|
|
20167
|
+
}
|
|
20168
|
+
watchData() {
|
|
20169
|
+
this.setData();
|
|
20045
20170
|
}
|
|
20046
|
-
/**
|
|
20047
|
-
* TODO: Need to figure out how this interplays with data
|
|
20048
|
-
* received from an API/server
|
|
20049
|
-
*/
|
|
20050
|
-
// private sortBy = (col: number, ascending = true) => {
|
|
20051
|
-
// this.rowData.sort((a, b) => {
|
|
20052
|
-
// const A = a[col];
|
|
20053
|
-
// const B = b[col];
|
|
20054
|
-
// if (typeof A === 'number' && typeof B === 'number') {
|
|
20055
|
-
// const f = ascending ? 1 : -1;
|
|
20056
|
-
// return A > B ? f : -f;
|
|
20057
|
-
// }
|
|
20058
|
-
// return -1;
|
|
20059
|
-
// });
|
|
20060
|
-
// this.rowData = Array.from(this.rowData);
|
|
20061
|
-
// this.render();
|
|
20062
|
-
// };
|
|
20063
20171
|
componentWillLoad() {
|
|
20064
20172
|
this.areAllSelected = false;
|
|
20065
|
-
this.
|
|
20066
|
-
this.selected = new Array(this.rowData.length).fill(false);
|
|
20173
|
+
this.setData();
|
|
20067
20174
|
}
|
|
20068
20175
|
render() {
|
|
20069
20176
|
let className = 'xpl-table';
|
|
@@ -20095,9 +20202,12 @@ const XplTable$1 = class extends HTMLElement {
|
|
|
20095
20202
|
})));
|
|
20096
20203
|
}))))));
|
|
20097
20204
|
}
|
|
20205
|
+
static get watchers() { return {
|
|
20206
|
+
"data": ["watchData"]
|
|
20207
|
+
}; }
|
|
20098
20208
|
};
|
|
20099
20209
|
|
|
20100
|
-
const XplTag$1 = class extends HTMLElement {
|
|
20210
|
+
const XplTag$1 = class extends HTMLElement$1 {
|
|
20101
20211
|
constructor() {
|
|
20102
20212
|
super();
|
|
20103
20213
|
this.__registerHost();
|
|
@@ -20112,13 +20222,16 @@ const XplTag$1 = class extends HTMLElement {
|
|
|
20112
20222
|
}
|
|
20113
20223
|
};
|
|
20114
20224
|
|
|
20115
|
-
const XplToggle$1 = class extends HTMLElement {
|
|
20225
|
+
const XplToggle$1 = class extends HTMLElement$1 {
|
|
20116
20226
|
constructor() {
|
|
20117
20227
|
super();
|
|
20118
20228
|
this.__registerHost();
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
|
-
|
|
20229
|
+
this.checked = undefined;
|
|
20230
|
+
this.description = undefined;
|
|
20231
|
+
this.disabled = undefined;
|
|
20232
|
+
this.heading = undefined;
|
|
20233
|
+
this.label = undefined;
|
|
20234
|
+
this.name = undefined;
|
|
20122
20235
|
this.variant = 'default';
|
|
20123
20236
|
this.id = v4();
|
|
20124
20237
|
}
|
|
@@ -20139,15 +20252,17 @@ const XplToggle$1 = class extends HTMLElement {
|
|
|
20139
20252
|
}
|
|
20140
20253
|
};
|
|
20141
20254
|
|
|
20142
|
-
const XplUtilityBar$1 = class extends HTMLElement {
|
|
20255
|
+
const XplUtilityBar$1 = class extends HTMLElement$1 {
|
|
20143
20256
|
constructor() {
|
|
20144
20257
|
super();
|
|
20145
20258
|
this.__registerHost();
|
|
20146
20259
|
this.navOpen = createEvent(this, "navOpen", 7);
|
|
20147
|
-
this.open = true;
|
|
20148
20260
|
this.bars = `
|
|
20149
20261
|
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="bars" class="svg-inline--fa fa-bars fa-w-14 xpl-utility-nav__bars" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path></svg>
|
|
20150
20262
|
`;
|
|
20263
|
+
this.navControl = undefined;
|
|
20264
|
+
this.isNavOpenAtStartup = undefined;
|
|
20265
|
+
this.open = true;
|
|
20151
20266
|
}
|
|
20152
20267
|
onNavToggle() {
|
|
20153
20268
|
this.open = !this.open;
|