@xplortech/apollo-core 1.0.0-beta.8 → 1.0.0-beta.9
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/build/style.css +55 -4
- package/dist/apollo-core/apollo-core.css +5841 -9
- package/dist/apollo-core/apollo-core.esm.js +163 -1
- package/dist/apollo-core/apollo-core.esm.js.map +1 -0
- package/dist/apollo-core/app-globals-0f993ce5.js +5 -0
- package/dist/apollo-core/app-globals-0f993ce5.js.map +1 -0
- package/dist/apollo-core/css-shim-6210ce77.js +6 -0
- package/dist/apollo-core/css-shim-6210ce77.js.map +1 -0
- package/dist/apollo-core/dom-423bdd70.js +75 -0
- package/dist/apollo-core/dom-423bdd70.js.map +1 -0
- package/dist/apollo-core/index-307c7018.js +3397 -0
- package/dist/apollo-core/index-307c7018.js.map +1 -0
- package/dist/apollo-core/index-912d1a21.js +586 -0
- package/dist/apollo-core/index-912d1a21.js.map +1 -0
- package/dist/apollo-core/index.esm.js +3 -0
- package/dist/apollo-core/index.esm.js.map +1 -0
- package/dist/apollo-core/p-08abab41.entry.js +2 -0
- package/dist/apollo-core/p-08abab41.entry.js.map +1 -0
- package/dist/apollo-core/p-16654189.entry.js +2 -0
- package/dist/apollo-core/p-16654189.entry.js.map +1 -0
- package/dist/apollo-core/p-2f90296c.js +3 -3
- package/dist/apollo-core/p-2f90296c.js.map +1 -0
- package/dist/apollo-core/p-315920cd.entry.js +2 -0
- package/dist/apollo-core/p-315920cd.entry.js.map +1 -0
- package/dist/apollo-core/p-3c934536.entry.js +2 -0
- package/dist/apollo-core/p-3c934536.entry.js.map +1 -0
- package/dist/apollo-core/p-47a55fa9.entry.js +2 -0
- package/dist/apollo-core/p-47a55fa9.entry.js.map +1 -0
- package/dist/apollo-core/p-485d0c40.entry.js +2 -0
- package/dist/apollo-core/p-485d0c40.entry.js.map +1 -0
- package/dist/apollo-core/p-5a038a8e.entry.js +2 -0
- package/dist/apollo-core/p-5a038a8e.entry.js.map +1 -0
- package/dist/apollo-core/p-88135928.entry.js +2 -0
- package/dist/apollo-core/p-88135928.entry.js.map +1 -0
- package/dist/apollo-core/p-91d6572c.entry.js +2 -0
- package/dist/apollo-core/p-91d6572c.entry.js.map +1 -0
- package/dist/apollo-core/p-ad90fe4d.js +2 -1
- package/dist/apollo-core/p-ad90fe4d.js.map +1 -0
- package/dist/apollo-core/p-ae99c266.entry.js +2 -0
- package/dist/apollo-core/p-ae99c266.entry.js.map +1 -0
- package/dist/apollo-core/p-aeef61dd.entry.js +2 -0
- package/dist/apollo-core/p-aeef61dd.entry.js.map +1 -0
- package/dist/apollo-core/p-c1b28f32.entry.js +2 -0
- package/dist/apollo-core/p-c1b28f32.entry.js.map +1 -0
- package/dist/apollo-core/p-ce6cb219.entry.js +2 -0
- package/dist/apollo-core/p-ce6cb219.entry.js.map +1 -0
- package/dist/apollo-core/p-cf2e6132.js +3 -0
- package/dist/apollo-core/p-cf2e6132.js.map +1 -0
- package/dist/apollo-core/p-e9cd309e.entry.js +2 -0
- package/dist/apollo-core/p-e9cd309e.entry.js.map +1 -0
- package/dist/apollo-core/p-f5561238.entry.js +2 -0
- package/dist/apollo-core/p-f5561238.entry.js.map +1 -0
- package/dist/apollo-core/p-ff46d20f.entry.js +2 -0
- package/dist/apollo-core/p-ff46d20f.entry.js.map +1 -0
- package/dist/{custom-elements/index.js → apollo-core/regular-133c23b5.js} +13 -4312
- package/dist/apollo-core/regular-133c23b5.js.map +1 -0
- package/dist/apollo-core/shadow-css-f0279020.js +389 -0
- package/dist/apollo-core/shadow-css-f0279020.js.map +1 -0
- package/dist/apollo-core/xpl-application-shell.entry.js +51 -0
- package/dist/apollo-core/xpl-application-shell.entry.js.map +1 -0
- package/dist/apollo-core/xpl-avatar.entry.js +28 -0
- package/dist/apollo-core/xpl-avatar.entry.js.map +1 -0
- package/dist/apollo-core/xpl-backdrop.entry.js +19 -0
- package/dist/apollo-core/xpl-backdrop.entry.js.map +1 -0
- package/dist/apollo-core/xpl-badge.entry.js +21 -0
- package/dist/apollo-core/xpl-badge.entry.js.map +1 -0
- package/dist/apollo-core/xpl-breadcrumb-item.entry.js +19 -0
- package/dist/apollo-core/xpl-breadcrumb-item.entry.js.map +1 -0
- package/dist/apollo-core/xpl-breadcrumbs.entry.js +14 -0
- package/dist/apollo-core/xpl-breadcrumbs.entry.js.map +1 -0
- package/dist/apollo-core/xpl-button-row.entry.js +23 -0
- package/dist/apollo-core/xpl-button-row.entry.js.map +1 -0
- package/dist/apollo-core/xpl-button.entry.js +60 -0
- package/dist/apollo-core/xpl-button.entry.js.map +1 -0
- package/dist/apollo-core/xpl-checkbox.entry.js +35 -0
- package/dist/apollo-core/xpl-checkbox.entry.js.map +1 -0
- package/dist/apollo-core/xpl-choicelist.entry.js +48 -0
- package/dist/apollo-core/xpl-choicelist.entry.js.map +1 -0
- package/dist/apollo-core/xpl-content-area.entry.js +15 -0
- package/dist/apollo-core/xpl-content-area.entry.js.map +1 -0
- package/dist/apollo-core/xpl-divider.entry.js +17 -0
- package/dist/apollo-core/xpl-divider.entry.js.map +1 -0
- package/dist/apollo-core/xpl-dropdown-group.entry.js +35 -0
- package/dist/apollo-core/xpl-dropdown-group.entry.js.map +1 -0
- package/dist/apollo-core/xpl-dropdown-heading.entry.js +15 -0
- package/dist/apollo-core/xpl-dropdown-heading.entry.js.map +1 -0
- package/dist/apollo-core/xpl-dropdown-option.entry.js +70 -0
- package/dist/apollo-core/xpl-dropdown-option.entry.js.map +1 -0
- package/dist/apollo-core/xpl-dropdown.entry.js +106 -0
- package/dist/apollo-core/xpl-dropdown.entry.js.map +1 -0
- package/dist/apollo-core/xpl-grid-item.entry.js +23 -0
- package/dist/apollo-core/xpl-grid-item.entry.js.map +1 -0
- package/dist/apollo-core/xpl-grid.entry.js +33 -0
- package/dist/apollo-core/xpl-grid.entry.js.map +1 -0
- package/dist/apollo-core/xpl-input.entry.js +2553 -0
- package/dist/apollo-core/xpl-input.entry.js.map +1 -0
- package/dist/apollo-core/xpl-list.entry.js +37 -0
- package/dist/apollo-core/xpl-list.entry.js.map +1 -0
- package/dist/apollo-core/xpl-main-nav.entry.js +25 -0
- package/dist/apollo-core/xpl-main-nav.entry.js.map +1 -0
- package/dist/apollo-core/xpl-nav-item.entry.js +25 -0
- package/dist/apollo-core/xpl-nav-item.entry.js.map +1 -0
- package/dist/apollo-core/xpl-pagination.entry.js +77 -0
- package/dist/apollo-core/xpl-pagination.entry.js.map +1 -0
- package/dist/apollo-core/xpl-radio.entry.js +34 -0
- package/dist/apollo-core/xpl-radio.entry.js.map +1 -0
- package/dist/apollo-core/xpl-secondary-nav.entry.js +14 -0
- package/dist/apollo-core/xpl-secondary-nav.entry.js.map +1 -0
- package/dist/apollo-core/xpl-select.entry.js +680 -0
- package/dist/apollo-core/xpl-select.entry.js.map +1 -0
- package/dist/apollo-core/xpl-table.entry.js +109 -0
- package/dist/apollo-core/xpl-table.entry.js.map +1 -0
- package/dist/apollo-core/xpl-tag.entry.js +19 -0
- package/dist/apollo-core/xpl-tag.entry.js.map +1 -0
- package/dist/apollo-core/xpl-toggle.entry.js +35 -0
- package/dist/apollo-core/xpl-toggle.entry.js.map +1 -0
- package/dist/apollo-core/xpl-utility-bar.entry.js +31 -0
- package/dist/apollo-core/xpl-utility-bar.entry.js.map +1 -0
- package/dist/cjs/apollo-core.cjs.js +150 -5
- package/dist/cjs/apollo-core.cjs.js.map +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/css-shim-0a6fd78d.js +8 -0
- package/dist/cjs/css-shim-0a6fd78d.js.map +1 -0
- package/dist/cjs/dom-2c6adc90.js +77 -0
- package/dist/cjs/dom-2c6adc90.js.map +1 -0
- package/dist/cjs/index-0fdb260e.js +3564 -0
- package/dist/cjs/index-0fdb260e.js.map +1 -0
- package/dist/cjs/index-318d5fc7.js +588 -0
- package/dist/cjs/index-318d5fc7.js.map +1 -0
- package/dist/cjs/{index-2ab4832e.js → index-e53b018b.js} +85 -2
- package/dist/cjs/index-e53b018b.js.map +1 -0
- package/dist/cjs/index.cjs.js +3 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +23 -3
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/regular-503465f4.js +16056 -0
- package/dist/cjs/regular-503465f4.js.map +1 -0
- package/dist/cjs/regular-872f5226.js +2 -0
- package/dist/cjs/regular-872f5226.js.map +1 -0
- package/dist/cjs/shadow-css-39dfcfae.js +391 -0
- package/dist/cjs/shadow-css-39dfcfae.js.map +1 -0
- package/dist/cjs/v4-14140ff3.js +2 -0
- package/dist/cjs/v4-14140ff3.js.map +1 -0
- package/dist/cjs/xpl-application-shell.cjs.entry.js +3 -1
- package/dist/cjs/xpl-application-shell.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-avatar.cjs.entry.js +32 -0
- package/dist/cjs/xpl-avatar.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-avatar_12.cjs.entry.js +3 -1
- package/dist/cjs/xpl-avatar_12.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-backdrop.cjs.entry.js +3 -1
- package/dist/cjs/xpl-backdrop.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-badge.cjs.entry.js +25 -0
- package/dist/cjs/xpl-badge.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-breadcrumb-item.cjs.entry.js +23 -0
- package/dist/cjs/xpl-breadcrumb-item.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-breadcrumbs.cjs.entry.js +18 -0
- package/dist/cjs/xpl-breadcrumbs.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-button-row.cjs.entry.js +3 -1
- package/dist/cjs/xpl-button-row.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-button.cjs.entry.js +64 -0
- package/dist/cjs/xpl-button.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-checkbox.cjs.entry.js +39 -0
- package/dist/cjs/xpl-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-choicelist.cjs.entry.js +3 -1
- package/dist/cjs/xpl-choicelist.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-content-area.cjs.entry.js +19 -0
- package/dist/cjs/xpl-content-area.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-divider.cjs.entry.js +3 -1
- package/dist/cjs/xpl-divider.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown-group.cjs.entry.js +39 -0
- package/dist/cjs/xpl-dropdown-group.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown-group_3.cjs.entry.js +6 -3
- package/dist/cjs/xpl-dropdown-group_3.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown-heading.cjs.entry.js +19 -0
- package/dist/cjs/xpl-dropdown-heading.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown-option.cjs.entry.js +74 -0
- package/dist/cjs/xpl-dropdown-option.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown.cjs.entry.js +110 -0
- package/dist/cjs/xpl-dropdown.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-dropdown_2.cjs.entry.js +6 -2
- package/dist/cjs/xpl-dropdown_2.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-grid-item.cjs.entry.js +3 -1
- package/dist/cjs/xpl-grid-item.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-grid.cjs.entry.js +3 -1
- package/dist/cjs/xpl-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-input.cjs.entry.js +509 -600
- package/dist/cjs/xpl-input.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-list.cjs.entry.js +4 -2
- package/dist/cjs/xpl-list.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-main-nav.cjs.entry.js +3 -1
- package/dist/cjs/xpl-main-nav.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-nav-item.cjs.entry.js +29 -0
- package/dist/cjs/xpl-nav-item.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-pagination.cjs.entry.js +3 -1
- package/dist/cjs/xpl-pagination.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-radio.cjs.entry.js +38 -0
- package/dist/cjs/xpl-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-secondary-nav.cjs.entry.js +18 -0
- package/dist/cjs/xpl-secondary-nav.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-select.cjs.entry.js +80 -6
- package/dist/cjs/xpl-select.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-table.cjs.entry.js +113 -0
- package/dist/cjs/xpl-table.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-tag.cjs.entry.js +23 -0
- package/dist/cjs/xpl-tag.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-toggle.cjs.entry.js +5 -3
- package/dist/cjs/xpl-toggle.cjs.entry.js.map +1 -0
- package/dist/cjs/xpl-utility-bar.cjs.entry.js +35 -0
- package/dist/cjs/xpl-utility-bar.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +1 -0
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js.map +1 -0
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +1 -0
- package/dist/collection/components/xpl-avatar/xpl-avatar.js.map +1 -0
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +1 -0
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js.map +1 -0
- package/dist/collection/components/xpl-badge/xpl-badge.js +1 -0
- package/dist/collection/components/xpl-badge/xpl-badge.js.map +1 -0
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +1 -0
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js.map +1 -0
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +1 -0
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js.map +1 -0
- package/dist/collection/components/xpl-button/xpl-button.js +1 -0
- package/dist/collection/components/xpl-button/xpl-button.js.map +1 -0
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +1 -0
- package/dist/collection/components/xpl-button-row/xpl-button-row.js.map +1 -0
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +1 -0
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js.map +1 -0
- package/dist/collection/components/xpl-choicelist/choice.js +1 -0
- package/dist/collection/components/xpl-choicelist/choice.js.map +1 -0
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +1 -0
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js.map +1 -0
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +1 -0
- package/dist/collection/components/xpl-content-area/xpl-content-area.js.map +1 -0
- package/dist/collection/components/xpl-divider/xpl-divider.js +1 -0
- package/dist/collection/components/xpl-divider/xpl-divider.js.map +1 -0
- package/dist/collection/components/xpl-dropdown/dropdownoption.js +1 -0
- package/dist/collection/components/xpl-dropdown/dropdownoption.js.map +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js.map +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js.map +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +23 -4
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js.map +1 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +8 -11
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js.map +1 -0
- package/dist/collection/components/xpl-grid/xpl-grid.js +1 -0
- package/dist/collection/components/xpl-grid/xpl-grid.js.map +1 -0
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +1 -0
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js.map +1 -0
- package/dist/collection/components/xpl-input/xpl-input.js +1 -0
- package/dist/collection/components/xpl-input/xpl-input.js.map +1 -0
- package/dist/collection/components/xpl-list/listitem.js +1 -0
- package/dist/collection/components/xpl-list/listitem.js.map +1 -0
- package/dist/collection/components/xpl-list/xpl-list.js +1 -0
- package/dist/collection/components/xpl-list/xpl-list.js.map +1 -0
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +1 -0
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js.map +1 -0
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +1 -0
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js.map +1 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +1 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js.map +1 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js +1 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js.map +1 -0
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +1 -0
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js.map +1 -0
- package/dist/collection/components/xpl-select/xpl-select.js +95 -9
- package/dist/collection/components/xpl-select/xpl-select.js.map +1 -0
- package/dist/collection/components/xpl-table/xpl-table.js +1 -0
- package/dist/collection/components/xpl-table/xpl-table.js.map +1 -0
- package/dist/collection/components/xpl-tag/xpl-tag.js +1 -0
- package/dist/collection/components/xpl-tag/xpl-tag.js.map +1 -0
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +1 -0
- package/dist/collection/components/xpl-toggle/xpl-toggle.js.map +1 -0
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +1 -0
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js.map +1 -0
- package/dist/components/index.d.ts +39 -0
- package/dist/components/index.js +81 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +586 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/regular.js +16054 -0
- package/dist/components/regular.js.map +1 -0
- package/dist/components/v4.js +77 -0
- package/dist/components/v4.js.map +1 -0
- package/dist/components/xpl-application-shell.d.ts +11 -0
- package/dist/components/xpl-application-shell.js +80 -0
- package/dist/components/xpl-application-shell.js.map +1 -0
- package/dist/components/xpl-avatar.d.ts +11 -0
- package/dist/components/xpl-avatar.js +8 -0
- package/dist/components/xpl-avatar.js.map +1 -0
- package/dist/components/xpl-avatar2.js +51 -0
- package/dist/components/xpl-avatar2.js.map +1 -0
- package/dist/components/xpl-backdrop.d.ts +11 -0
- package/dist/components/xpl-backdrop.js +8 -0
- package/dist/components/xpl-backdrop.js.map +1 -0
- package/dist/components/xpl-backdrop2.js +35 -0
- package/dist/components/xpl-backdrop2.js.map +1 -0
- package/dist/components/xpl-badge.d.ts +11 -0
- package/dist/components/xpl-badge.js +8 -0
- package/dist/components/xpl-badge.js.map +1 -0
- package/dist/components/xpl-badge2.js +38 -0
- package/dist/components/xpl-badge2.js.map +1 -0
- package/dist/components/xpl-breadcrumb-item.d.ts +11 -0
- package/dist/components/xpl-breadcrumb-item.js +36 -0
- package/dist/components/xpl-breadcrumb-item.js.map +1 -0
- package/dist/components/xpl-breadcrumbs.d.ts +11 -0
- package/dist/components/xpl-breadcrumbs.js +31 -0
- package/dist/components/xpl-breadcrumbs.js.map +1 -0
- package/dist/components/xpl-button-row.d.ts +11 -0
- package/dist/components/xpl-button-row.js +50 -0
- package/dist/components/xpl-button-row.js.map +1 -0
- package/dist/components/xpl-button.d.ts +11 -0
- package/dist/components/xpl-button.js +8 -0
- package/dist/components/xpl-button.js.map +1 -0
- package/dist/components/xpl-button2.js +85 -0
- package/dist/components/xpl-button2.js.map +1 -0
- package/dist/components/xpl-checkbox.d.ts +11 -0
- package/dist/components/xpl-checkbox.js +8 -0
- package/dist/components/xpl-checkbox.js.map +1 -0
- package/dist/components/xpl-checkbox2.js +59 -0
- package/dist/components/xpl-checkbox2.js.map +1 -0
- package/dist/components/xpl-choicelist.d.ts +11 -0
- package/dist/components/xpl-choicelist.js +85 -0
- package/dist/components/xpl-choicelist.js.map +1 -0
- package/dist/components/xpl-content-area.d.ts +11 -0
- package/dist/components/xpl-content-area.js +34 -0
- package/dist/components/xpl-content-area.js.map +1 -0
- package/dist/components/xpl-divider.d.ts +11 -0
- package/dist/components/xpl-divider.js +36 -0
- package/dist/components/xpl-divider.js.map +1 -0
- package/dist/components/xpl-dropdown-group.d.ts +11 -0
- package/dist/components/xpl-dropdown-group.js +8 -0
- package/dist/components/xpl-dropdown-group.js.map +1 -0
- package/dist/components/xpl-dropdown-group2.js +69 -0
- package/dist/components/xpl-dropdown-group2.js.map +1 -0
- package/dist/components/xpl-dropdown-heading.d.ts +11 -0
- package/dist/components/xpl-dropdown-heading.js +8 -0
- package/dist/components/xpl-dropdown-heading.js.map +1 -0
- package/dist/components/xpl-dropdown-heading2.js +31 -0
- package/dist/components/xpl-dropdown-heading2.js.map +1 -0
- package/dist/components/xpl-dropdown-option.d.ts +11 -0
- package/dist/components/xpl-dropdown-option.js +8 -0
- package/dist/components/xpl-dropdown-option.js.map +1 -0
- package/dist/components/xpl-dropdown-option2.js +89 -0
- package/dist/components/xpl-dropdown-option2.js.map +1 -0
- package/dist/components/xpl-dropdown.d.ts +11 -0
- package/dist/components/xpl-dropdown.js +8 -0
- package/dist/components/xpl-dropdown.js.map +1 -0
- package/dist/components/xpl-dropdown2.js +147 -0
- package/dist/components/xpl-dropdown2.js.map +1 -0
- package/dist/components/xpl-grid-item.d.ts +11 -0
- package/dist/components/xpl-grid-item.js +45 -0
- package/dist/components/xpl-grid-item.js.map +1 -0
- package/dist/components/xpl-grid.d.ts +11 -0
- package/dist/components/xpl-grid.js +50 -0
- package/dist/components/xpl-grid.js.map +1 -0
- package/dist/components/xpl-input.d.ts +11 -0
- package/dist/components/xpl-input.js +2594 -0
- package/dist/components/xpl-input.js.map +1 -0
- package/dist/components/xpl-list.d.ts +11 -0
- package/dist/components/xpl-list.js +68 -0
- package/dist/components/xpl-list.js.map +1 -0
- package/dist/components/xpl-main-nav.d.ts +11 -0
- package/dist/components/xpl-main-nav.js +44 -0
- package/dist/components/xpl-main-nav.js.map +1 -0
- package/dist/components/xpl-nav-item.d.ts +11 -0
- package/dist/components/xpl-nav-item.js +44 -0
- package/dist/components/xpl-nav-item.js.map +1 -0
- package/dist/components/xpl-pagination.d.ts +11 -0
- package/dist/components/xpl-pagination.js +100 -0
- package/dist/components/xpl-pagination.js.map +1 -0
- package/dist/components/xpl-radio.d.ts +11 -0
- package/dist/components/xpl-radio.js +8 -0
- package/dist/components/xpl-radio.js.map +1 -0
- package/dist/components/xpl-radio2.js +57 -0
- package/dist/components/xpl-radio2.js.map +1 -0
- package/dist/components/xpl-secondary-nav.d.ts +11 -0
- package/dist/components/xpl-secondary-nav.js +31 -0
- package/dist/components/xpl-secondary-nav.js.map +1 -0
- package/dist/components/xpl-select.d.ts +11 -0
- package/dist/components/xpl-select.js +745 -0
- package/dist/components/xpl-select.js.map +1 -0
- package/dist/components/xpl-table.d.ts +11 -0
- package/dist/components/xpl-table.js +136 -0
- package/dist/components/xpl-table.js.map +1 -0
- package/dist/components/xpl-tag.d.ts +11 -0
- package/dist/components/xpl-tag.js +8 -0
- package/dist/components/xpl-tag.js.map +1 -0
- package/dist/components/xpl-tag2.js +33 -0
- package/dist/components/xpl-tag2.js.map +1 -0
- package/dist/components/xpl-toggle.d.ts +11 -0
- package/dist/components/xpl-toggle.js +61 -0
- package/dist/components/xpl-toggle.js.map +1 -0
- package/dist/components/xpl-utility-bar.d.ts +11 -0
- package/dist/components/xpl-utility-bar.js +52 -0
- package/dist/components/xpl-utility-bar.js.map +1 -0
- package/dist/esm/apollo-core.js +151 -6
- package/dist/esm/apollo-core.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/css-shim-6210ce77.js +6 -0
- package/dist/esm/css-shim-6210ce77.js.map +1 -0
- package/dist/esm/dom-423bdd70.js +75 -0
- package/dist/esm/dom-423bdd70.js.map +1 -0
- package/dist/esm/index-307c7018.js +3526 -0
- package/dist/esm/index-307c7018.js.map +1 -0
- package/dist/esm/index-912d1a21.js +586 -0
- package/dist/esm/index-912d1a21.js.map +1 -0
- package/dist/esm/{index-392b5b96.js → index-df9b48b4.js} +85 -2
- package/dist/esm/index-df9b48b4.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +24 -4
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/regular-133c23b5.js +16054 -0
- package/dist/esm/regular-133c23b5.js.map +1 -0
- package/dist/esm/regular-86225e9d.js +2 -0
- package/dist/esm/regular-86225e9d.js.map +1 -0
- package/dist/esm/shadow-css-f0279020.js +389 -0
- package/dist/esm/shadow-css-f0279020.js.map +1 -0
- package/dist/esm/v4-929670b7.js +2 -0
- package/dist/esm/v4-929670b7.js.map +1 -0
- package/dist/esm/xpl-application-shell.entry.js +3 -1
- package/dist/esm/xpl-application-shell.entry.js.map +1 -0
- package/dist/esm/xpl-avatar.entry.js +28 -0
- package/dist/esm/xpl-avatar.entry.js.map +1 -0
- package/dist/esm/xpl-avatar_12.entry.js +3 -1
- package/dist/esm/xpl-avatar_12.entry.js.map +1 -0
- package/dist/esm/xpl-backdrop.entry.js +3 -1
- package/dist/esm/xpl-backdrop.entry.js.map +1 -0
- package/dist/esm/xpl-badge.entry.js +21 -0
- package/dist/esm/xpl-badge.entry.js.map +1 -0
- package/dist/esm/xpl-breadcrumb-item.entry.js +19 -0
- package/dist/esm/xpl-breadcrumb-item.entry.js.map +1 -0
- package/dist/esm/xpl-breadcrumbs.entry.js +14 -0
- package/dist/esm/xpl-breadcrumbs.entry.js.map +1 -0
- package/dist/esm/xpl-button-row.entry.js +3 -1
- package/dist/esm/xpl-button-row.entry.js.map +1 -0
- package/dist/esm/xpl-button.entry.js +60 -0
- package/dist/esm/xpl-button.entry.js.map +1 -0
- package/dist/esm/xpl-checkbox.entry.js +35 -0
- package/dist/esm/xpl-checkbox.entry.js.map +1 -0
- package/dist/esm/xpl-choicelist.entry.js +3 -1
- package/dist/esm/xpl-choicelist.entry.js.map +1 -0
- package/dist/esm/xpl-content-area.entry.js +15 -0
- package/dist/esm/xpl-content-area.entry.js.map +1 -0
- package/dist/esm/xpl-divider.entry.js +3 -1
- package/dist/esm/xpl-divider.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown-group.entry.js +35 -0
- package/dist/esm/xpl-dropdown-group.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown-group_3.entry.js +6 -3
- package/dist/esm/xpl-dropdown-group_3.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown-heading.entry.js +15 -0
- package/dist/esm/xpl-dropdown-heading.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown-option.entry.js +70 -0
- package/dist/esm/xpl-dropdown-option.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown.entry.js +106 -0
- package/dist/esm/xpl-dropdown.entry.js.map +1 -0
- package/dist/esm/xpl-dropdown_2.entry.js +6 -2
- package/dist/esm/xpl-dropdown_2.entry.js.map +1 -0
- package/dist/esm/xpl-grid-item.entry.js +3 -1
- package/dist/esm/xpl-grid-item.entry.js.map +1 -0
- package/dist/esm/xpl-grid.entry.js +3 -1
- package/dist/esm/xpl-grid.entry.js.map +1 -0
- package/dist/esm/xpl-input.entry.js +508 -599
- package/dist/esm/xpl-input.entry.js.map +1 -0
- package/dist/esm/xpl-list.entry.js +4 -2
- package/dist/esm/xpl-list.entry.js.map +1 -0
- package/dist/esm/xpl-main-nav.entry.js +3 -1
- package/dist/esm/xpl-main-nav.entry.js.map +1 -0
- package/dist/esm/xpl-nav-item.entry.js +25 -0
- package/dist/esm/xpl-nav-item.entry.js.map +1 -0
- package/dist/esm/xpl-pagination.entry.js +3 -1
- package/dist/esm/xpl-pagination.entry.js.map +1 -0
- package/dist/esm/xpl-radio.entry.js +34 -0
- package/dist/esm/xpl-radio.entry.js.map +1 -0
- package/dist/esm/xpl-secondary-nav.entry.js +14 -0
- package/dist/esm/xpl-secondary-nav.entry.js.map +1 -0
- package/dist/esm/xpl-select.entry.js +79 -5
- package/dist/esm/xpl-select.entry.js.map +1 -0
- package/dist/esm/xpl-table.entry.js +109 -0
- package/dist/esm/xpl-table.entry.js.map +1 -0
- package/dist/esm/xpl-tag.entry.js +19 -0
- package/dist/esm/xpl-tag.entry.js.map +1 -0
- package/dist/esm/xpl-toggle.entry.js +4 -2
- package/dist/esm/xpl-toggle.entry.js.map +1 -0
- package/dist/esm/xpl-utility-bar.entry.js +31 -0
- package/dist/esm/xpl-utility-bar.entry.js.map +1 -0
- package/dist/stories/application-shell.stories.js +1 -0
- package/dist/stories/application-shell.stories.js.map +1 -0
- package/dist/stories/avatar.stories.js +1 -0
- package/dist/stories/avatar.stories.js.map +1 -0
- package/dist/stories/backdrop.stories.js +1 -0
- package/dist/stories/backdrop.stories.js.map +1 -0
- package/dist/stories/badge.stories.js +1 -0
- package/dist/stories/badge.stories.js.map +1 -0
- package/dist/stories/breadcrumbs.stories.js +1 -0
- package/dist/stories/breadcrumbs.stories.js.map +1 -0
- package/dist/stories/button-row.stories.js +1 -0
- package/dist/stories/button-row.stories.js.map +1 -0
- package/dist/stories/button.stories.js +1 -0
- package/dist/stories/button.stories.js.map +1 -0
- package/dist/stories/checkbox.stories.js +1 -0
- package/dist/stories/checkbox.stories.js.map +1 -0
- package/dist/stories/choicelist.stories.js +1 -0
- package/dist/stories/choicelist.stories.js.map +1 -0
- package/dist/stories/content-area.stories.js +1 -0
- package/dist/stories/content-area.stories.js.map +1 -0
- package/dist/stories/divider.stories.js +1 -0
- package/dist/stories/divider.stories.js.map +1 -0
- package/dist/stories/dropdown.stories.js +74 -65
- package/dist/stories/dropdown.stories.js.map +1 -0
- package/dist/stories/grid.stories.js +1 -0
- package/dist/stories/grid.stories.js.map +1 -0
- package/dist/stories/input.stories.js +1 -0
- package/dist/stories/input.stories.js.map +1 -0
- package/dist/stories/list.stories.js +1 -0
- package/dist/stories/list.stories.js.map +1 -0
- package/dist/stories/main-nav.stories.js +1 -0
- package/dist/stories/main-nav.stories.js.map +1 -0
- package/dist/stories/pagination.stories.js +1 -0
- package/dist/stories/pagination.stories.js.map +1 -0
- package/dist/stories/radio.stories.js +1 -0
- package/dist/stories/radio.stories.js.map +1 -0
- package/dist/stories/secondary-nav.stories.js +1 -0
- package/dist/stories/secondary-nav.stories.js.map +1 -0
- package/dist/stories/select.stories.js +109 -32
- package/dist/stories/select.stories.js.map +1 -0
- package/dist/stories/table.stories.js +1 -0
- package/dist/stories/table.stories.js.map +1 -0
- package/dist/stories/tabs.stories.js +1 -0
- package/dist/stories/tabs.stories.js.map +1 -0
- package/dist/stories/toggle.stories.js +1 -0
- package/dist/stories/toggle.stories.js.map +1 -0
- package/dist/stories/utility-bar.stories.js +1 -0
- package/dist/stories/utility-bar.stories.js.map +1 -0
- package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/dropdown.stories.d.ts +17 -1
- package/dist/types/Users/roc/Sites/apollo/.stencil/stories/select.stories.d.ts +134 -0
- package/dist/types/components/xpl-dropdown/dropdownoption.d.ts +1 -0
- package/dist/types/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.d.ts +7 -1
- package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +2 -2
- package/dist/types/components/xpl-select/xpl-select.d.ts +16 -2
- package/dist/types/components.d.ts +41 -12
- package/dist/types/stencil-public-runtime.d.ts +12 -12
- package/package.json +7 -6
- package/CHANGELOG.md +0 -106
- package/dist/apollo-core/p-10f00380.entry.js +0 -1
- package/dist/apollo-core/p-26ec64fe.entry.js +0 -1
- package/dist/apollo-core/p-31acfdb4.entry.js +0 -1
- package/dist/apollo-core/p-4184ac44.entry.js +0 -1
- package/dist/apollo-core/p-4fa14839.entry.js +0 -1
- package/dist/apollo-core/p-55b87345.js +0 -2
- package/dist/apollo-core/p-63a6c98a.entry.js +0 -1
- package/dist/apollo-core/p-68c33b77.entry.js +0 -1
- package/dist/apollo-core/p-78d07caf.entry.js +0 -1
- package/dist/apollo-core/p-796957d3.entry.js +0 -1
- package/dist/apollo-core/p-88160d68.entry.js +0 -1
- package/dist/apollo-core/p-9ec318bb.entry.js +0 -1
- package/dist/apollo-core/p-a2a34e44.entry.js +0 -1
- package/dist/apollo-core/p-beea2502.entry.js +0 -1
- package/dist/apollo-core/p-d499e43f.entry.js +0 -1
- package/dist/apollo-core/p-d8a3d94c.entry.js +0 -1
- package/dist/apollo-core/p-e047b446.entry.js +0 -1
- package/dist/collection/components/xpl-select/selectchoice.js +0 -1
- package/dist/custom-elements/index.d.ts +0 -219
- package/dist/types/Users/fernandogelin/Xplor/apollo/.stencil/stories/select.stories.d.ts +0 -74
- package/dist/types/components/xpl-select/selectchoice.d.ts +0 -4
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/application-shell.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/avatar.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/backdrop.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/badge.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/breadcrumbs.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/button-row.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/button.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/checkbox.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/choicelist.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/content-area.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/divider.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/grid.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/input.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/list.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/main-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/pagination.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/radio.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/secondary-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/table.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/tabs.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/toggle.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Xplor → roc/Sites}/apollo/.stencil/stories/utility-bar.stories.d.ts +0 -0
|
@@ -1,3190 +1,9 @@
|
|
|
1
|
-
import { HTMLElement as HTMLElement$1, h, Host, createEvent, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
|
-
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
|
-
|
|
4
|
-
const XplApplicationShell$1 = class extends HTMLElement$1 {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
this.__registerHost();
|
|
8
|
-
this.withSubnav = false;
|
|
9
|
-
this.withUtility = true;
|
|
10
|
-
this.navWidth = 'default';
|
|
11
|
-
this.isNavOpenAtStartup = undefined;
|
|
12
|
-
this.navOpen = true;
|
|
13
|
-
}
|
|
14
|
-
closeNavOnMobile() {
|
|
15
|
-
if (window.innerWidth <= 640) {
|
|
16
|
-
this.navOpen = false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
navToggleHandler() {
|
|
20
|
-
this.navOpen = !this.navOpen;
|
|
21
|
-
}
|
|
22
|
-
navWithHandler(event) {
|
|
23
|
-
this.navWidth = event.detail;
|
|
24
|
-
}
|
|
25
|
-
onWindowResize() {
|
|
26
|
-
this.closeNavOnMobile();
|
|
27
|
-
}
|
|
28
|
-
connectedCallback() {
|
|
29
|
-
this.closeNavOnMobile();
|
|
30
|
-
}
|
|
31
|
-
componentWillLoad() {
|
|
32
|
-
this.navOpen =
|
|
33
|
-
this.isNavOpenAtStartup !== undefined
|
|
34
|
-
? this.isNavOpenAtStartup
|
|
35
|
-
: this.navOpen;
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
let applicationShellClasses = 'xpl-application-shell';
|
|
39
|
-
if (this.withUtility)
|
|
40
|
-
applicationShellClasses += ' xpl-application-shell--with_utility';
|
|
41
|
-
let navClasses = 'xpl-application-shell__nav';
|
|
42
|
-
navClasses += this.navOpen
|
|
43
|
-
? ` xpl-application-shell__nav--${this.navWidth}--open`
|
|
44
|
-
: ` xpl-application-shell__nav--${this.navWidth}`;
|
|
45
|
-
return (h(Host, { class: applicationShellClasses }, h("div", { class: navClasses }, h("slot", { name: "nav" })), h("div", { class: "xpl-application-shell__subnav" }, h("slot", { name: "subnav" })), h("div", { class: "xpl-application-shell__utility" }, h("slot", { name: "utility" })), h("div", { class: "xpl-application-shell__content" }, h("slot", { name: "content" })), h("xpl-backdrop", { onClick: () => this.navToggleHandler(), class: {
|
|
46
|
-
'xpl-application-shell__backdrop--open': this.navOpen,
|
|
47
|
-
}, relative: true })));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const XplAvatar$1 = class extends HTMLElement$1 {
|
|
52
|
-
constructor() {
|
|
53
|
-
super();
|
|
54
|
-
this.__registerHost();
|
|
55
|
-
this.color = undefined;
|
|
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;
|
|
63
|
-
}
|
|
64
|
-
render() {
|
|
65
|
-
let className = 'xpl-avatar';
|
|
66
|
-
if (this.size)
|
|
67
|
-
className += ` xpl-avatar--${this.size}`;
|
|
68
|
-
if (this.color)
|
|
69
|
-
className += ` xpl-avatar--${this.color}`;
|
|
70
|
-
const inner = (h("div", null, this.src ? (h("img", { alt: this.name, src: this.src })) : (h("div", { class: "xpl-avatar__placeholder" }, h("slot", null))), this.status && (h("div", { class: `xpl-avatar__dot--${this.status}` }))));
|
|
71
|
-
return (h(Host, null, this.href && !this.disabled ? (h("a", { href: this.href, class: className, target: this.target }, inner)) : this.href && this.disabled ? (h("div", { class: className + ' xpl-avatar--disabled' }, inner)) : (h("div", { class: className }, inner))));
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const XplBackdrop$1 = class extends HTMLElement$1 {
|
|
76
|
-
constructor() {
|
|
77
|
-
super();
|
|
78
|
-
this.__registerHost();
|
|
79
|
-
this.relative = false;
|
|
80
|
-
}
|
|
81
|
-
render() {
|
|
82
|
-
return (h(Host, { class: {
|
|
83
|
-
'xpl-backdrop': true,
|
|
84
|
-
'xpl-backdrop--fixed': !this.relative,
|
|
85
|
-
'xpl-backdrop--relative': this.relative,
|
|
86
|
-
}, "aria-hidden": "true" }));
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const XplBadge$1 = class extends HTMLElement$1 {
|
|
91
|
-
constructor() {
|
|
92
|
-
super();
|
|
93
|
-
this.__registerHost();
|
|
94
|
-
this.dot = undefined;
|
|
95
|
-
this.variant = undefined;
|
|
96
|
-
}
|
|
97
|
-
render() {
|
|
98
|
-
let className = 'xpl-badge';
|
|
99
|
-
if (this.dot)
|
|
100
|
-
className += ' xpl-badge--dot';
|
|
101
|
-
if (this.variant)
|
|
102
|
-
className += ' xpl-badge--' + this.variant;
|
|
103
|
-
return (h(Host, null, h("div", { class: className }, h("slot", null))));
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const XplBreadcrumbItem$1 = class extends HTMLElement$1 {
|
|
108
|
-
constructor() {
|
|
109
|
-
super();
|
|
110
|
-
this.__registerHost();
|
|
111
|
-
// This is temporary as we still don't have a xpl-icon component. When that's created we should update this code.
|
|
112
|
-
this.chevron = `<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-right" class="svg-inline--fa fa-chevron-right fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
|
|
113
|
-
<path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path>
|
|
114
|
-
</svg>
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
render() {
|
|
118
|
-
return (h(Host, { class: "xpl-breadcrumb-item", role: "listitem" }, h("li", { role: "none" }, h("slot", null)), h("span", { innerHTML: `${this.chevron}` })));
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const XplBreadcrumbs$1 = class extends HTMLElement$1 {
|
|
123
|
-
constructor() {
|
|
124
|
-
super();
|
|
125
|
-
this.__registerHost();
|
|
126
|
-
}
|
|
127
|
-
render() {
|
|
128
|
-
return (h(Host, null, h("nav", { class: "xpl-breadcrumbs", "aria-label": "Breadcrumb" }, h("ol", { role: "list" }, h("slot", null)))));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const XplButton$1 = class extends HTMLElement$1 {
|
|
133
|
-
constructor() {
|
|
134
|
-
super();
|
|
135
|
-
this.__registerHost();
|
|
136
|
-
this.disabled = undefined;
|
|
137
|
-
this.link = undefined;
|
|
138
|
-
this.iconOnly = undefined;
|
|
139
|
-
this.fullWidth = undefined;
|
|
140
|
-
this.name = undefined;
|
|
141
|
-
this.size = 'default';
|
|
142
|
-
this.type = undefined;
|
|
143
|
-
this.value = undefined;
|
|
144
|
-
this.variant = 'primary';
|
|
145
|
-
this.state = 'neutral';
|
|
146
|
-
}
|
|
147
|
-
componentDidRender() {
|
|
148
|
-
const attrs = this.el.attributes;
|
|
149
|
-
const dataAttrs = Object.keys(attrs)
|
|
150
|
-
.filter((k) => {
|
|
151
|
-
const propertyName = attrs[k].name;
|
|
152
|
-
if (propertyName) {
|
|
153
|
-
return (propertyName.includes('data-test') ||
|
|
154
|
-
propertyName.includes('aria-'));
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
})
|
|
158
|
-
.reduce((acc, k) => {
|
|
159
|
-
return Object.assign(Object.assign({}, acc), { [attrs[k].name]: attrs[k].value });
|
|
160
|
-
}, {});
|
|
161
|
-
const child = this.el.querySelector('button');
|
|
162
|
-
Object.keys(dataAttrs).forEach((k) => {
|
|
163
|
-
child.setAttribute(k, dataAttrs[k]);
|
|
164
|
-
this.el.removeAttribute(k);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
render() {
|
|
168
|
-
let className = `xpl-button
|
|
169
|
-
xpl-button--${this.size}
|
|
170
|
-
xpl-button--${this.state}
|
|
171
|
-
xpl-button--${this.variant}`;
|
|
172
|
-
if (this.iconOnly)
|
|
173
|
-
className += ' xpl-button--icon-only';
|
|
174
|
-
if (this.fullWidth)
|
|
175
|
-
className += ' xpl-button--full-width';
|
|
176
|
-
if (this.link && this.disabled)
|
|
177
|
-
className += ' xpl-button--link-disabled';
|
|
178
|
-
return (h(Host, { class: className },
|
|
179
|
-
/**
|
|
180
|
-
* Conditionally render either an <slot> or <button> element
|
|
181
|
-
* depending on if there's an `link` or not
|
|
182
|
-
*/
|
|
183
|
-
this.link ? (h("slot", null)) : (h("button", { disabled: this.disabled, name: this.name, type: this.type, value: this.value }, h("slot", null)))));
|
|
184
|
-
}
|
|
185
|
-
get el() { return this; }
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const XplButtonRow$1 = class extends HTMLElement$1 {
|
|
189
|
-
constructor() {
|
|
190
|
-
super();
|
|
191
|
-
this.__registerHost();
|
|
192
|
-
this.clickPrimary = createEvent(this, "clickPrimary", 7);
|
|
193
|
-
this.clickSecondary = createEvent(this, "clickSecondary", 7);
|
|
194
|
-
this.clickTertiary = createEvent(this, "clickTertiary", 7);
|
|
195
|
-
this.onPrimary = () => this.clickPrimary.emit();
|
|
196
|
-
this.onSecondary = () => this.clickSecondary.emit();
|
|
197
|
-
this.onTertiary = () => this.clickTertiary.emit();
|
|
198
|
-
this.primary = undefined;
|
|
199
|
-
this.secondary = undefined;
|
|
200
|
-
this.tertiary = undefined;
|
|
201
|
-
}
|
|
202
|
-
render() {
|
|
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))))));
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
208
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
209
|
-
// generators (like Math.random()).
|
|
210
|
-
var getRandomValues;
|
|
211
|
-
var rnds8 = new Uint8Array(16);
|
|
212
|
-
function rng() {
|
|
213
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
214
|
-
if (!getRandomValues) {
|
|
215
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
|
|
216
|
-
// find the complete implementation of crypto (msCrypto) on IE11.
|
|
217
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
218
|
-
|
|
219
|
-
if (!getRandomValues) {
|
|
220
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return getRandomValues(rnds8);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
228
|
-
|
|
229
|
-
function validate(uuid) {
|
|
230
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
235
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
236
|
-
*/
|
|
237
|
-
|
|
238
|
-
var byteToHex = [];
|
|
239
|
-
|
|
240
|
-
for (var i = 0; i < 256; ++i) {
|
|
241
|
-
byteToHex.push((i + 0x100).toString(16).substr(1));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function stringify(arr) {
|
|
245
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
246
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
247
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
248
|
-
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
249
|
-
// of the following:
|
|
250
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
251
|
-
// "undefined" in the uuid)
|
|
252
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
253
|
-
|
|
254
|
-
if (!validate(uuid)) {
|
|
255
|
-
throw TypeError('Stringified UUID is invalid');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return uuid;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function v4(options, buf, offset) {
|
|
262
|
-
options = options || {};
|
|
263
|
-
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
264
|
-
|
|
265
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
266
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
267
|
-
|
|
268
|
-
if (buf) {
|
|
269
|
-
offset = offset || 0;
|
|
270
|
-
|
|
271
|
-
for (var i = 0; i < 16; ++i) {
|
|
272
|
-
buf[offset + i] = rnds[i];
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return buf;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return stringify(rnds);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const XplCheckbox$1 = class extends HTMLElement$1 {
|
|
282
|
-
constructor() {
|
|
283
|
-
super();
|
|
284
|
-
this.__registerHost();
|
|
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;
|
|
294
|
-
this.id = v4();
|
|
295
|
-
}
|
|
296
|
-
render() {
|
|
297
|
-
return (h(Host, { class: {
|
|
298
|
-
'xpl-checkbox-radio-container': true,
|
|
299
|
-
styled: this.styled,
|
|
300
|
-
disabled: this.disabled,
|
|
301
|
-
} }, h("input", { class: "xpl-checkbox", type: "checkbox", checked: this.checked, disabled: this.disabled, id: this.id, indeterminate: this.indeterminate, onChange: () => this.checkboxChange.emit(this.input.checked), name: this.name, ref: (el) => (this.input = el), required: this.required, value: this.value }), h("label", { class: {
|
|
302
|
-
'xpl-label': true,
|
|
303
|
-
'xpl-label--disabled': this.disabled,
|
|
304
|
-
}, htmlFor: this.id }, h("slot", null), this.description && (h("small", { class: {
|
|
305
|
-
'xpl-description': true,
|
|
306
|
-
'xpl-description--disabled': this.disabled,
|
|
307
|
-
} }, this.description)))));
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const XplChoicelist$1 = class extends HTMLElement$1 {
|
|
312
|
-
constructor() {
|
|
313
|
-
super();
|
|
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;
|
|
322
|
-
}
|
|
323
|
-
componentWillLoad() {
|
|
324
|
-
this.selected =
|
|
325
|
-
this.choices !== undefined &&
|
|
326
|
-
this.choices !== null &&
|
|
327
|
-
this.choices.length > 0
|
|
328
|
-
? this.choices.map(() => false)
|
|
329
|
-
: [];
|
|
330
|
-
}
|
|
331
|
-
render() {
|
|
332
|
-
let className = 'xpl-choicelist';
|
|
333
|
-
if (this.styled)
|
|
334
|
-
className += ' xpl-choicelist--styled';
|
|
335
|
-
return (h(Host, { class: "xpl-choicelist-container" }, this.heading !== undefined ||
|
|
336
|
-
this.description !== undefined ? (h("div", { class: "xpl-choicelist-heading" }, this.heading && h("h3", null, this.heading), this.description && h("p", null, this.description))) : null, this.choices && (h("ul", { class: className }, this.choices.map(({ children, description, label }, i) => {
|
|
337
|
-
const inner = this.multi ? (h("xpl-checkbox", { description: description, name: this.name, onCheckboxChange: (e) => {
|
|
338
|
-
const { detail } = e;
|
|
339
|
-
this.selected = this.selected.map((v, j) => (i === j ? detail : v));
|
|
340
|
-
} }, label)) : (h("xpl-radio", { description: description, name: this.name, onRadioChange: () => {
|
|
341
|
-
this.selected = this.selected.map((_, j) => i === j);
|
|
342
|
-
} }, label));
|
|
343
|
-
let className = this.styled && this.selected[i]
|
|
344
|
-
? 'selected'
|
|
345
|
-
: '';
|
|
346
|
-
return (h("li", { class: className }, inner, children && (h("ul", null, children.map((child) => {
|
|
347
|
-
const childInner = this
|
|
348
|
-
.multi ? (h("xpl-checkbox", { description: child.description }, child.label)) : (h("xpl-radio", { description: child.description }, child.label));
|
|
349
|
-
return (h("li", null, childInner));
|
|
350
|
-
})))));
|
|
351
|
-
})))));
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const XplContentArea$1 = class extends HTMLElement$1 {
|
|
356
|
-
constructor() {
|
|
357
|
-
super();
|
|
358
|
-
this.__registerHost();
|
|
359
|
-
this.size = 'wide';
|
|
360
|
-
}
|
|
361
|
-
render() {
|
|
362
|
-
return (h(Host, null, h("main", { class: `xpl-content-area-wrapper xpl-content-area-wrapper__${this.size}` }, h("div", { class: "xpl-content-area" }, h("slot", null)))));
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const XplDivider$1 = class extends HTMLElement$1 {
|
|
367
|
-
constructor() {
|
|
368
|
-
super();
|
|
369
|
-
this.__registerHost();
|
|
370
|
-
this.tier = undefined;
|
|
371
|
-
}
|
|
372
|
-
render() {
|
|
373
|
-
let className = 'xpl-divider';
|
|
374
|
-
className += ` xpl-divider--${this.tier}`;
|
|
375
|
-
return (h(Host, { class: className }, h("span", null, h("slot", null))));
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
380
|
-
var t = {};
|
|
381
|
-
for (var p in s)
|
|
382
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
383
|
-
t[p] = s[p];
|
|
384
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
385
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
386
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
387
|
-
t[p[i]] = s[p[i]];
|
|
388
|
-
}
|
|
389
|
-
return t;
|
|
390
|
-
};
|
|
391
|
-
const XplDropdown$1 = class extends HTMLElement$1 {
|
|
392
|
-
constructor() {
|
|
393
|
-
super();
|
|
394
|
-
this.__registerHost();
|
|
395
|
-
this.handleClickOutside = ({ target }) => {
|
|
396
|
-
const { triggerId } = this;
|
|
397
|
-
const isTrigger = triggerId && target.id === triggerId;
|
|
398
|
-
const isInside = this.hostElement.contains(target);
|
|
399
|
-
if (!isInside && !isTrigger)
|
|
400
|
-
this.isOpen = false;
|
|
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;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* called on dropdown option click and keydown events to update isSelected states
|
|
412
|
-
*/
|
|
413
|
-
async handleSelect(e, { component }) {
|
|
414
|
-
const { hostElement, mode, options, update } = this;
|
|
415
|
-
const isSingle = mode === 'single';
|
|
416
|
-
const isMulti = mode === 'multi';
|
|
417
|
-
if (Boolean(options)) {
|
|
418
|
-
options
|
|
419
|
-
.reduce((acc, curr) => [
|
|
420
|
-
...acc,
|
|
421
|
-
...(curr.groupName ? curr.options : [curr]),
|
|
422
|
-
], [])
|
|
423
|
-
.forEach((option) => {
|
|
424
|
-
const isMatch = option.label === component.hostElement.label;
|
|
425
|
-
if (isSingle) {
|
|
426
|
-
option.isSelected = isMatch;
|
|
427
|
-
component.hostElement.isSelected = option.isSelected;
|
|
428
|
-
}
|
|
429
|
-
else if (isMulti && isMatch) {
|
|
430
|
-
option.isSelected = !option.isSelected;
|
|
431
|
-
component.hostElement.isSelected = option.isSelected;
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
const mapOptions = (option) => {
|
|
435
|
-
option.options = option.groupName
|
|
436
|
-
? option.options.map(mapOptions)
|
|
437
|
-
: undefined;
|
|
438
|
-
return option;
|
|
439
|
-
};
|
|
440
|
-
this.options = options.map(mapOptions);
|
|
441
|
-
}
|
|
442
|
-
else if (isSingle) {
|
|
443
|
-
const optionNodes = Array.from(hostElement.querySelectorAll('xpl-dropdown-option'));
|
|
444
|
-
optionNodes.forEach((node) => (node.isSelected = node === component.hostElement));
|
|
445
|
-
}
|
|
446
|
-
else if (isMulti) {
|
|
447
|
-
component.isSelected = !component.isSelected;
|
|
448
|
-
}
|
|
449
|
-
if (Boolean(update))
|
|
450
|
-
update(e, { component: this });
|
|
451
|
-
}
|
|
452
|
-
componentWillLoad() {
|
|
453
|
-
this.handleSelect = this.handleSelect.bind(this);
|
|
454
|
-
}
|
|
455
|
-
connectedCallback() {
|
|
456
|
-
document.addEventListener('mousedown', this.handleClickOutside.bind(this));
|
|
457
|
-
}
|
|
458
|
-
disconnectedCallback() {
|
|
459
|
-
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
460
|
-
}
|
|
461
|
-
render() {
|
|
462
|
-
let { isOpen } = this;
|
|
463
|
-
const { mode, options } = this;
|
|
464
|
-
const hasOptions = options && options.length;
|
|
465
|
-
const mappedOptions = hasOptions &&
|
|
466
|
-
options.map((_a) => {
|
|
467
|
-
var { groupName, options } = _a, properties = __rest$1(_a, ["groupName", "options"]);
|
|
468
|
-
return groupName ? (h("xpl-dropdown-group", Object.assign({ groupName: groupName, options: options }, properties))) : (h("xpl-dropdown-option", Object.assign({}, properties)));
|
|
469
|
-
});
|
|
470
|
-
return (h(Host, { "aria-expanded": isOpen, class: {
|
|
471
|
-
'xpl-dropdown': true,
|
|
472
|
-
'xpl-dropdown--multi': mode === 'multi',
|
|
473
|
-
'xpl-dropdown--open': isOpen,
|
|
474
|
-
}, role: "listbox" }, h("ul", { class: "xpl-dropdown-list" }, mappedOptions || h("slot", { name: "options" }))));
|
|
475
|
-
}
|
|
476
|
-
get hostElement() { return this; }
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
480
|
-
var t = {};
|
|
481
|
-
for (var p in s)
|
|
482
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
483
|
-
t[p] = s[p];
|
|
484
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
485
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
486
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
487
|
-
t[p[i]] = s[p[i]];
|
|
488
|
-
}
|
|
489
|
-
return t;
|
|
490
|
-
};
|
|
491
|
-
const XplDropdownGroup$1 = class extends HTMLElement$1 {
|
|
492
|
-
constructor() {
|
|
493
|
-
super();
|
|
494
|
-
this.__registerHost();
|
|
495
|
-
this.groupName = undefined;
|
|
496
|
-
this.options = undefined;
|
|
497
|
-
}
|
|
498
|
-
render() {
|
|
499
|
-
const { groupName, options } = this;
|
|
500
|
-
const hasOptions = options && options.length;
|
|
501
|
-
const mappedOptions = hasOptions &&
|
|
502
|
-
options.map((_a) => {
|
|
503
|
-
var { groupName } = _a, properties = __rest(_a, ["groupName"]);
|
|
504
|
-
return groupName ? (h("xpl-dropdown-group", Object.assign({ label: groupName }, properties))) : (h("xpl-dropdown-option", Object.assign({}, properties)));
|
|
505
|
-
});
|
|
506
|
-
return (h(Host, { role: "group", "aria-label": groupName }, h("li", { class: "xpl-dropdown-list-item" }, h("xpl-dropdown-heading", { label: groupName }), h("ul", { class: "xpl-dropdown-list" }, mappedOptions || h("slot", { name: "options" })))));
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
const XplDropdownHeading$1 = class extends HTMLElement$1 {
|
|
511
|
-
constructor() {
|
|
512
|
-
super();
|
|
513
|
-
this.__registerHost();
|
|
514
|
-
this.label = undefined;
|
|
515
|
-
}
|
|
516
|
-
render() {
|
|
517
|
-
return (h(Host, { class: { 'xpl-dropdown-heading': true }, role: "presentation" }, h("span", null, this.label || h("slot", { name: "heading" }))));
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
const XplDropdownOption$1 = class extends HTMLElement$1 {
|
|
522
|
-
constructor() {
|
|
523
|
-
super();
|
|
524
|
-
this.__registerHost();
|
|
525
|
-
this.isDisabled = undefined;
|
|
526
|
-
this.label = undefined;
|
|
527
|
-
this.isSelected = undefined;
|
|
528
|
-
}
|
|
529
|
-
componentWillLoad() {
|
|
530
|
-
this.dropdown = this.hostElement.closest('xpl-dropdown');
|
|
531
|
-
}
|
|
532
|
-
handleClick(ev) {
|
|
533
|
-
const { closeOnSelect, mode } = this.dropdown;
|
|
534
|
-
if (Boolean(ev.x && ev.y)) {
|
|
535
|
-
this.dropdown.handleSelect(ev, { component: this });
|
|
536
|
-
if (mode === 'single' && closeOnSelect)
|
|
537
|
-
this.dropdown.isOpen = false;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
handleKeyup(ev) {
|
|
541
|
-
const { dropdown } = this;
|
|
542
|
-
const navigationKeys = [
|
|
543
|
-
'ArrowDown',
|
|
544
|
-
'ArrowLeft',
|
|
545
|
-
'ArrowRight',
|
|
546
|
-
'ArrowUp',
|
|
547
|
-
'Tab',
|
|
548
|
-
];
|
|
549
|
-
const { closeOnSelect, mode, selectOnFocus } = this.dropdown;
|
|
550
|
-
if (selectOnFocus && navigationKeys.includes(ev.key)) {
|
|
551
|
-
const hostElement = document.activeElement.closest('xpl-dropdown-option');
|
|
552
|
-
const component = {
|
|
553
|
-
component: { hostElement },
|
|
554
|
-
};
|
|
555
|
-
dropdown.handleSelect(ev, component);
|
|
556
|
-
if (mode === 'single' && closeOnSelect)
|
|
557
|
-
this.dropdown.isOpen = false;
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
560
|
-
const selectionKeys = ['Escape', 'Enter'];
|
|
561
|
-
if (selectionKeys.includes(ev.key)) {
|
|
562
|
-
dropdown.handleSelect(ev, { component: this });
|
|
563
|
-
if (this.dropdown.closeOnSelect)
|
|
564
|
-
this.dropdown.isOpen = false;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
connectedCallback() {
|
|
568
|
-
this.hostElement.addEventListener('click', this.handleClick.bind(this));
|
|
569
|
-
this.hostElement.addEventListener('keyup', this.handleKeyup.bind(this));
|
|
570
|
-
}
|
|
571
|
-
disconnectedCallback() {
|
|
572
|
-
this.hostElement.removeEventListener('click', this.handleClick);
|
|
573
|
-
this.hostElement.removeEventListener('keyup', this.handleKeyup);
|
|
574
|
-
}
|
|
575
|
-
render() {
|
|
576
|
-
const { label, isSelected, isDisabled } = this;
|
|
577
|
-
return (h(Host, { class: {
|
|
578
|
-
'xpl-dropdown-option': true,
|
|
579
|
-
'xpl-dropdown-option--disabled': isDisabled,
|
|
580
|
-
'xpl-dropdown-option--selected': isSelected,
|
|
581
|
-
}, role: "option", "aria-checked": isSelected, "aria-disabled": isDisabled, "aria-selected": isSelected }, h("li", { class: "xpl-dropdown-list-item" }, label || h("slot", { name: "option" }))));
|
|
582
|
-
}
|
|
583
|
-
get hostElement() { return this; }
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
const XplGrid$1 = class extends HTMLElement$1 {
|
|
587
|
-
constructor() {
|
|
588
|
-
super();
|
|
589
|
-
this.__registerHost();
|
|
590
|
-
}
|
|
591
|
-
componentDidLoad() {
|
|
592
|
-
const items = Array.from(this.container.querySelectorAll('.xpl-grid-item'));
|
|
593
|
-
let lgCounter = 0, mdCounter = 0, smCounter = 0, xsCounter = 0;
|
|
594
|
-
items.forEach((item) => {
|
|
595
|
-
lgCounter += +item.getAttribute('lg') || 6;
|
|
596
|
-
mdCounter += +item.getAttribute('md') || 6;
|
|
597
|
-
smCounter += +item.getAttribute('sm') || 6;
|
|
598
|
-
xsCounter += +item.getAttribute('xs') || 6;
|
|
599
|
-
if (lgCounter % 6 === 0)
|
|
600
|
-
item.classList.add('xpl-grid-item-lg-last');
|
|
601
|
-
if (mdCounter % 6 === 0)
|
|
602
|
-
item.classList.add('xpl-grid-item-md-last');
|
|
603
|
-
if (smCounter % 6 === 0)
|
|
604
|
-
item.classList.add('xpl-grid-item-sm-last');
|
|
605
|
-
if (xsCounter % 6 === 0)
|
|
606
|
-
item.classList.add('xpl-grid-item-xs-last');
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
render() {
|
|
610
|
-
return h(Host, { class: "xpl-grid" });
|
|
611
|
-
}
|
|
612
|
-
get container() { return this; }
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
const XplGridItem$1 = class extends HTMLElement$1 {
|
|
616
|
-
constructor() {
|
|
617
|
-
super();
|
|
618
|
-
this.__registerHost();
|
|
619
|
-
this.xs = 6;
|
|
620
|
-
this.sm = 6;
|
|
621
|
-
this.md = 6;
|
|
622
|
-
this.lg = 6;
|
|
623
|
-
}
|
|
624
|
-
render() {
|
|
625
|
-
let className = 'xpl-grid-item';
|
|
626
|
-
className += ` xpl-grid-item-xs-${this.xs}`;
|
|
627
|
-
className += ` xpl-grid-item-sm-${this.sm}`;
|
|
628
|
-
className += ` xpl-grid-item-md-${this.md}`;
|
|
629
|
-
className += ` xpl-grid-item-lg-${this.lg}`;
|
|
630
|
-
return (h(Host, { class: className }, h("slot", null)));
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
var HOOKS = [
|
|
635
|
-
"onChange",
|
|
636
|
-
"onClose",
|
|
637
|
-
"onDayCreate",
|
|
638
|
-
"onDestroy",
|
|
639
|
-
"onKeyDown",
|
|
640
|
-
"onMonthChange",
|
|
641
|
-
"onOpen",
|
|
642
|
-
"onParseConfig",
|
|
643
|
-
"onReady",
|
|
644
|
-
"onValueUpdate",
|
|
645
|
-
"onYearChange",
|
|
646
|
-
"onPreCalendarPosition",
|
|
647
|
-
];
|
|
648
|
-
var defaults = {
|
|
649
|
-
_disable: [],
|
|
650
|
-
allowInput: false,
|
|
651
|
-
allowInvalidPreload: false,
|
|
652
|
-
altFormat: "F j, Y",
|
|
653
|
-
altInput: false,
|
|
654
|
-
altInputClass: "form-control input",
|
|
655
|
-
animate: typeof window === "object" &&
|
|
656
|
-
window.navigator.userAgent.indexOf("MSIE") === -1,
|
|
657
|
-
ariaDateFormat: "F j, Y",
|
|
658
|
-
autoFillDefaultTime: true,
|
|
659
|
-
clickOpens: true,
|
|
660
|
-
closeOnSelect: true,
|
|
661
|
-
conjunction: ", ",
|
|
662
|
-
dateFormat: "Y-m-d",
|
|
663
|
-
defaultHour: 12,
|
|
664
|
-
defaultMinute: 0,
|
|
665
|
-
defaultSeconds: 0,
|
|
666
|
-
disable: [],
|
|
667
|
-
disableMobile: false,
|
|
668
|
-
enableSeconds: false,
|
|
669
|
-
enableTime: false,
|
|
670
|
-
errorHandler: function (err) {
|
|
671
|
-
return typeof console !== "undefined" && console.warn(err);
|
|
672
|
-
},
|
|
673
|
-
getWeek: function (givenDate) {
|
|
674
|
-
var date = new Date(givenDate.getTime());
|
|
675
|
-
date.setHours(0, 0, 0, 0);
|
|
676
|
-
date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
|
|
677
|
-
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
678
|
-
return (1 +
|
|
679
|
-
Math.round(((date.getTime() - week1.getTime()) / 86400000 -
|
|
680
|
-
3 +
|
|
681
|
-
((week1.getDay() + 6) % 7)) /
|
|
682
|
-
7));
|
|
683
|
-
},
|
|
684
|
-
hourIncrement: 1,
|
|
685
|
-
ignoredFocusElements: [],
|
|
686
|
-
inline: false,
|
|
687
|
-
locale: "default",
|
|
688
|
-
minuteIncrement: 5,
|
|
689
|
-
mode: "single",
|
|
690
|
-
monthSelectorType: "dropdown",
|
|
691
|
-
nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
|
|
692
|
-
noCalendar: false,
|
|
693
|
-
now: new Date(),
|
|
694
|
-
onChange: [],
|
|
695
|
-
onClose: [],
|
|
696
|
-
onDayCreate: [],
|
|
697
|
-
onDestroy: [],
|
|
698
|
-
onKeyDown: [],
|
|
699
|
-
onMonthChange: [],
|
|
700
|
-
onOpen: [],
|
|
701
|
-
onParseConfig: [],
|
|
702
|
-
onReady: [],
|
|
703
|
-
onValueUpdate: [],
|
|
704
|
-
onYearChange: [],
|
|
705
|
-
onPreCalendarPosition: [],
|
|
706
|
-
plugins: [],
|
|
707
|
-
position: "auto",
|
|
708
|
-
positionElement: undefined,
|
|
709
|
-
prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
|
|
710
|
-
shorthandCurrentMonth: false,
|
|
711
|
-
showMonths: 1,
|
|
712
|
-
static: false,
|
|
713
|
-
time_24hr: false,
|
|
714
|
-
weekNumbers: false,
|
|
715
|
-
wrap: false,
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
var english = {
|
|
719
|
-
weekdays: {
|
|
720
|
-
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
721
|
-
longhand: [
|
|
722
|
-
"Sunday",
|
|
723
|
-
"Monday",
|
|
724
|
-
"Tuesday",
|
|
725
|
-
"Wednesday",
|
|
726
|
-
"Thursday",
|
|
727
|
-
"Friday",
|
|
728
|
-
"Saturday",
|
|
729
|
-
],
|
|
730
|
-
},
|
|
731
|
-
months: {
|
|
732
|
-
shorthand: [
|
|
733
|
-
"Jan",
|
|
734
|
-
"Feb",
|
|
735
|
-
"Mar",
|
|
736
|
-
"Apr",
|
|
737
|
-
"May",
|
|
738
|
-
"Jun",
|
|
739
|
-
"Jul",
|
|
740
|
-
"Aug",
|
|
741
|
-
"Sep",
|
|
742
|
-
"Oct",
|
|
743
|
-
"Nov",
|
|
744
|
-
"Dec",
|
|
745
|
-
],
|
|
746
|
-
longhand: [
|
|
747
|
-
"January",
|
|
748
|
-
"February",
|
|
749
|
-
"March",
|
|
750
|
-
"April",
|
|
751
|
-
"May",
|
|
752
|
-
"June",
|
|
753
|
-
"July",
|
|
754
|
-
"August",
|
|
755
|
-
"September",
|
|
756
|
-
"October",
|
|
757
|
-
"November",
|
|
758
|
-
"December",
|
|
759
|
-
],
|
|
760
|
-
},
|
|
761
|
-
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
762
|
-
firstDayOfWeek: 0,
|
|
763
|
-
ordinal: function (nth) {
|
|
764
|
-
var s = nth % 100;
|
|
765
|
-
if (s > 3 && s < 21)
|
|
766
|
-
return "th";
|
|
767
|
-
switch (s % 10) {
|
|
768
|
-
case 1:
|
|
769
|
-
return "st";
|
|
770
|
-
case 2:
|
|
771
|
-
return "nd";
|
|
772
|
-
case 3:
|
|
773
|
-
return "rd";
|
|
774
|
-
default:
|
|
775
|
-
return "th";
|
|
776
|
-
}
|
|
777
|
-
},
|
|
778
|
-
rangeSeparator: " to ",
|
|
779
|
-
weekAbbreviation: "Wk",
|
|
780
|
-
scrollTitle: "Scroll to increment",
|
|
781
|
-
toggleTitle: "Click to toggle",
|
|
782
|
-
amPM: ["AM", "PM"],
|
|
783
|
-
yearAriaLabel: "Year",
|
|
784
|
-
monthAriaLabel: "Month",
|
|
785
|
-
hourAriaLabel: "Hour",
|
|
786
|
-
minuteAriaLabel: "Minute",
|
|
787
|
-
time_24hr: false,
|
|
788
|
-
};
|
|
789
|
-
|
|
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); };
|
|
795
|
-
function debounce$1(fn, wait) {
|
|
796
|
-
var t;
|
|
797
|
-
return function () {
|
|
798
|
-
var _this = this;
|
|
799
|
-
var args = arguments;
|
|
800
|
-
clearTimeout(t);
|
|
801
|
-
t = setTimeout(function () { return fn.apply(_this, args); }, wait);
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
var arrayify = function (obj) {
|
|
805
|
-
return obj instanceof Array ? obj : [obj];
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
function toggleClass(elem, className, bool) {
|
|
809
|
-
if (bool === true)
|
|
810
|
-
return elem.classList.add(className);
|
|
811
|
-
elem.classList.remove(className);
|
|
812
|
-
}
|
|
813
|
-
function createElement(tag, className, content) {
|
|
814
|
-
var e = window.document.createElement(tag);
|
|
815
|
-
className = className || "";
|
|
816
|
-
content = content || "";
|
|
817
|
-
e.className = className;
|
|
818
|
-
if (content !== undefined)
|
|
819
|
-
e.textContent = content;
|
|
820
|
-
return e;
|
|
821
|
-
}
|
|
822
|
-
function clearNode(node) {
|
|
823
|
-
while (node.firstChild)
|
|
824
|
-
node.removeChild(node.firstChild);
|
|
825
|
-
}
|
|
826
|
-
function findParent(node, condition) {
|
|
827
|
-
if (condition(node))
|
|
828
|
-
return node;
|
|
829
|
-
else if (node.parentNode)
|
|
830
|
-
return findParent(node.parentNode, condition);
|
|
831
|
-
return undefined;
|
|
832
|
-
}
|
|
833
|
-
function createNumberInput(inputClassName, opts) {
|
|
834
|
-
var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
|
|
835
|
-
if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
|
|
836
|
-
numInput.type = "number";
|
|
837
|
-
}
|
|
838
|
-
else {
|
|
839
|
-
numInput.type = "text";
|
|
840
|
-
numInput.pattern = "\\d*";
|
|
841
|
-
}
|
|
842
|
-
if (opts !== undefined)
|
|
843
|
-
for (var key in opts)
|
|
844
|
-
numInput.setAttribute(key, opts[key]);
|
|
845
|
-
wrapper.appendChild(numInput);
|
|
846
|
-
wrapper.appendChild(arrowUp);
|
|
847
|
-
wrapper.appendChild(arrowDown);
|
|
848
|
-
return wrapper;
|
|
849
|
-
}
|
|
850
|
-
function getEventTarget(event) {
|
|
851
|
-
try {
|
|
852
|
-
if (typeof event.composedPath === "function") {
|
|
853
|
-
var path = event.composedPath();
|
|
854
|
-
return path[0];
|
|
855
|
-
}
|
|
856
|
-
return event.target;
|
|
857
|
-
}
|
|
858
|
-
catch (error) {
|
|
859
|
-
return event.target;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
var doNothing = function () { return undefined; };
|
|
864
|
-
var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
|
|
865
|
-
var revFormat = {
|
|
866
|
-
D: doNothing,
|
|
867
|
-
F: function (dateObj, monthName, locale) {
|
|
868
|
-
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
|
|
869
|
-
},
|
|
870
|
-
G: function (dateObj, hour) {
|
|
871
|
-
dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
|
|
872
|
-
},
|
|
873
|
-
H: function (dateObj, hour) {
|
|
874
|
-
dateObj.setHours(parseFloat(hour));
|
|
875
|
-
},
|
|
876
|
-
J: function (dateObj, day) {
|
|
877
|
-
dateObj.setDate(parseFloat(day));
|
|
878
|
-
},
|
|
879
|
-
K: function (dateObj, amPM, locale) {
|
|
880
|
-
dateObj.setHours((dateObj.getHours() % 12) +
|
|
881
|
-
12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
|
|
882
|
-
},
|
|
883
|
-
M: function (dateObj, shortMonth, locale) {
|
|
884
|
-
dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
|
|
885
|
-
},
|
|
886
|
-
S: function (dateObj, seconds) {
|
|
887
|
-
dateObj.setSeconds(parseFloat(seconds));
|
|
888
|
-
},
|
|
889
|
-
U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
|
|
890
|
-
W: function (dateObj, weekNum, locale) {
|
|
891
|
-
var weekNumber = parseInt(weekNum);
|
|
892
|
-
var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
|
|
893
|
-
date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
|
|
894
|
-
return date;
|
|
895
|
-
},
|
|
896
|
-
Y: function (dateObj, year) {
|
|
897
|
-
dateObj.setFullYear(parseFloat(year));
|
|
898
|
-
},
|
|
899
|
-
Z: function (_, ISODate) { return new Date(ISODate); },
|
|
900
|
-
d: function (dateObj, day) {
|
|
901
|
-
dateObj.setDate(parseFloat(day));
|
|
902
|
-
},
|
|
903
|
-
h: function (dateObj, hour) {
|
|
904
|
-
dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
|
|
905
|
-
},
|
|
906
|
-
i: function (dateObj, minutes) {
|
|
907
|
-
dateObj.setMinutes(parseFloat(minutes));
|
|
908
|
-
},
|
|
909
|
-
j: function (dateObj, day) {
|
|
910
|
-
dateObj.setDate(parseFloat(day));
|
|
911
|
-
},
|
|
912
|
-
l: doNothing,
|
|
913
|
-
m: function (dateObj, month) {
|
|
914
|
-
dateObj.setMonth(parseFloat(month) - 1);
|
|
915
|
-
},
|
|
916
|
-
n: function (dateObj, month) {
|
|
917
|
-
dateObj.setMonth(parseFloat(month) - 1);
|
|
918
|
-
},
|
|
919
|
-
s: function (dateObj, seconds) {
|
|
920
|
-
dateObj.setSeconds(parseFloat(seconds));
|
|
921
|
-
},
|
|
922
|
-
u: function (_, unixMillSeconds) {
|
|
923
|
-
return new Date(parseFloat(unixMillSeconds));
|
|
924
|
-
},
|
|
925
|
-
w: doNothing,
|
|
926
|
-
y: function (dateObj, year) {
|
|
927
|
-
dateObj.setFullYear(2000 + parseFloat(year));
|
|
928
|
-
},
|
|
929
|
-
};
|
|
930
|
-
var tokenRegex = {
|
|
931
|
-
D: "",
|
|
932
|
-
F: "",
|
|
933
|
-
G: "(\\d\\d|\\d)",
|
|
934
|
-
H: "(\\d\\d|\\d)",
|
|
935
|
-
J: "(\\d\\d|\\d)\\w+",
|
|
936
|
-
K: "",
|
|
937
|
-
M: "",
|
|
938
|
-
S: "(\\d\\d|\\d)",
|
|
939
|
-
U: "(.+)",
|
|
940
|
-
W: "(\\d\\d|\\d)",
|
|
941
|
-
Y: "(\\d{4})",
|
|
942
|
-
Z: "(.+)",
|
|
943
|
-
d: "(\\d\\d|\\d)",
|
|
944
|
-
h: "(\\d\\d|\\d)",
|
|
945
|
-
i: "(\\d\\d|\\d)",
|
|
946
|
-
j: "(\\d\\d|\\d)",
|
|
947
|
-
l: "",
|
|
948
|
-
m: "(\\d\\d|\\d)",
|
|
949
|
-
n: "(\\d\\d|\\d)",
|
|
950
|
-
s: "(\\d\\d|\\d)",
|
|
951
|
-
u: "(.+)",
|
|
952
|
-
w: "(\\d\\d|\\d)",
|
|
953
|
-
y: "(\\d{2})",
|
|
954
|
-
};
|
|
955
|
-
var formats = {
|
|
956
|
-
Z: function (date) { return date.toISOString(); },
|
|
957
|
-
D: function (date, locale, options) {
|
|
958
|
-
return locale.weekdays.shorthand[formats.w(date, locale, options)];
|
|
959
|
-
},
|
|
960
|
-
F: function (date, locale, options) {
|
|
961
|
-
return monthToStr(formats.n(date, locale, options) - 1, false, locale);
|
|
962
|
-
},
|
|
963
|
-
G: function (date, locale, options) {
|
|
964
|
-
return pad(formats.h(date, locale, options));
|
|
965
|
-
},
|
|
966
|
-
H: function (date) { return pad(date.getHours()); },
|
|
967
|
-
J: function (date, locale) {
|
|
968
|
-
return locale.ordinal !== undefined
|
|
969
|
-
? date.getDate() + locale.ordinal(date.getDate())
|
|
970
|
-
: date.getDate();
|
|
971
|
-
},
|
|
972
|
-
K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
|
|
973
|
-
M: function (date, locale) {
|
|
974
|
-
return monthToStr(date.getMonth(), true, locale);
|
|
975
|
-
},
|
|
976
|
-
S: function (date) { return pad(date.getSeconds()); },
|
|
977
|
-
U: function (date) { return date.getTime() / 1000; },
|
|
978
|
-
W: function (date, _, options) {
|
|
979
|
-
return options.getWeek(date);
|
|
980
|
-
},
|
|
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(); },
|
|
986
|
-
l: function (date, locale) {
|
|
987
|
-
return locale.weekdays.longhand[date.getDay()];
|
|
988
|
-
},
|
|
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); },
|
|
995
|
-
};
|
|
996
|
-
|
|
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);
|
|
1003
|
-
}
|
|
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)
|
|
1028
|
-
parsedDate = new Date(date);
|
|
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
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
else if (!isBackSlash)
|
|
1060
|
-
regexStr += ".";
|
|
1061
|
-
}
|
|
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;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
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
|
-
};
|
|
1081
|
-
};
|
|
1082
|
-
function compareDates(date1, date2, timeless) {
|
|
1083
|
-
if (timeless === void 0) { timeless = true; }
|
|
1084
|
-
if (timeless !== false) {
|
|
1085
|
-
return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
|
|
1086
|
-
new Date(date2.getTime()).setHours(0, 0, 0, 0));
|
|
1087
|
-
}
|
|
1088
|
-
return date1.getTime() - date2.getTime();
|
|
1089
|
-
}
|
|
1090
|
-
var isBetween = function (ts, ts1, ts2) {
|
|
1091
|
-
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
|
|
1092
|
-
};
|
|
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 = {
|
|
1101
|
-
DAY: 86400000,
|
|
1102
|
-
};
|
|
1103
|
-
function getDefaultHours(config) {
|
|
1104
|
-
var hours = config.defaultHour;
|
|
1105
|
-
var minutes = config.defaultMinute;
|
|
1106
|
-
var seconds = config.defaultSeconds;
|
|
1107
|
-
if (config.minDate !== undefined) {
|
|
1108
|
-
var minHour = config.minDate.getHours();
|
|
1109
|
-
var minMinutes = config.minDate.getMinutes();
|
|
1110
|
-
var minSeconds = config.minDate.getSeconds();
|
|
1111
|
-
if (hours < minHour) {
|
|
1112
|
-
hours = minHour;
|
|
1113
|
-
}
|
|
1114
|
-
if (hours === minHour && minutes < minMinutes) {
|
|
1115
|
-
minutes = minMinutes;
|
|
1116
|
-
}
|
|
1117
|
-
if (hours === minHour && minutes === minMinutes && seconds < minSeconds)
|
|
1118
|
-
seconds = config.minDate.getSeconds();
|
|
1119
|
-
}
|
|
1120
|
-
if (config.maxDate !== undefined) {
|
|
1121
|
-
var maxHr = config.maxDate.getHours();
|
|
1122
|
-
var maxMinutes = config.maxDate.getMinutes();
|
|
1123
|
-
hours = Math.min(hours, maxHr);
|
|
1124
|
-
if (hours === maxHr)
|
|
1125
|
-
minutes = Math.min(maxMinutes, minutes);
|
|
1126
|
-
if (hours === maxHr && minutes === maxMinutes)
|
|
1127
|
-
seconds = config.maxDate.getSeconds();
|
|
1128
|
-
}
|
|
1129
|
-
return { hours: hours, minutes: minutes, seconds: seconds };
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
if (typeof Object.assign !== "function") {
|
|
1133
|
-
Object.assign = function (target) {
|
|
1134
|
-
var args = [];
|
|
1135
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1136
|
-
args[_i - 1] = arguments[_i];
|
|
1137
|
-
}
|
|
1138
|
-
if (!target) {
|
|
1139
|
-
throw TypeError("Cannot convert undefined or null to object");
|
|
1140
|
-
}
|
|
1141
|
-
var _loop_1 = function (source) {
|
|
1142
|
-
if (source) {
|
|
1143
|
-
Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
|
|
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);
|
|
1149
|
-
}
|
|
1150
|
-
return target;
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
|
|
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;
|
|
1173
|
-
function FlatpickrInstance(element, instanceConfig) {
|
|
1174
|
-
var self = {
|
|
1175
|
-
config: __assign(__assign({}, defaults), flatpickr.defaultConfig),
|
|
1176
|
-
l10n: english,
|
|
1177
|
-
};
|
|
1178
|
-
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
|
|
1179
|
-
self._handlers = [];
|
|
1180
|
-
self.pluginElements = [];
|
|
1181
|
-
self.loadedPlugins = [];
|
|
1182
|
-
self._bind = bind;
|
|
1183
|
-
self._setHoursFromDate = setHoursFromDate;
|
|
1184
|
-
self._positionCalendar = positionCalendar;
|
|
1185
|
-
self.changeMonth = changeMonth;
|
|
1186
|
-
self.changeYear = changeYear;
|
|
1187
|
-
self.clear = clear;
|
|
1188
|
-
self.close = close;
|
|
1189
|
-
self.onMouseOver = onMouseOver;
|
|
1190
|
-
self._createElement = createElement;
|
|
1191
|
-
self.createDay = createDay;
|
|
1192
|
-
self.destroy = destroy;
|
|
1193
|
-
self.isEnabled = isEnabled;
|
|
1194
|
-
self.jumpToDate = jumpToDate;
|
|
1195
|
-
self.updateValue = updateValue;
|
|
1196
|
-
self.open = open;
|
|
1197
|
-
self.redraw = redraw;
|
|
1198
|
-
self.set = set;
|
|
1199
|
-
self.setDate = setDate;
|
|
1200
|
-
self.toggle = toggle;
|
|
1201
|
-
function setupHelperFunctions() {
|
|
1202
|
-
self.utils = {
|
|
1203
|
-
getDaysInMonth: function (month, yr) {
|
|
1204
|
-
if (month === void 0) { month = self.currentMonth; }
|
|
1205
|
-
if (yr === void 0) { yr = self.currentYear; }
|
|
1206
|
-
if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
|
|
1207
|
-
return 29;
|
|
1208
|
-
return self.l10n.daysInMonth[month];
|
|
1209
|
-
},
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
function init() {
|
|
1213
|
-
self.element = self.input = element;
|
|
1214
|
-
self.isOpen = false;
|
|
1215
|
-
parseConfig();
|
|
1216
|
-
setupLocale();
|
|
1217
|
-
setupInputs();
|
|
1218
|
-
setupDates();
|
|
1219
|
-
setupHelperFunctions();
|
|
1220
|
-
if (!self.isMobile)
|
|
1221
|
-
build();
|
|
1222
|
-
bindEvents();
|
|
1223
|
-
if (self.selectedDates.length || self.config.noCalendar) {
|
|
1224
|
-
if (self.config.enableTime) {
|
|
1225
|
-
setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);
|
|
1226
|
-
}
|
|
1227
|
-
updateValue(false);
|
|
1228
|
-
}
|
|
1229
|
-
setCalendarWidth();
|
|
1230
|
-
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1231
|
-
if (!self.isMobile && isSafari) {
|
|
1232
|
-
positionCalendar();
|
|
1233
|
-
}
|
|
1234
|
-
triggerEvent("onReady");
|
|
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
|
-
}
|
|
1241
|
-
function bindToInstance(fn) {
|
|
1242
|
-
return fn.bind(self);
|
|
1243
|
-
}
|
|
1244
|
-
function setCalendarWidth() {
|
|
1245
|
-
var config = self.config;
|
|
1246
|
-
if (config.weekNumbers === false && config.showMonths === 1) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
else if (config.noCalendar !== true) {
|
|
1250
|
-
window.requestAnimationFrame(function () {
|
|
1251
|
-
if (self.calendarContainer !== undefined) {
|
|
1252
|
-
self.calendarContainer.style.visibility = "hidden";
|
|
1253
|
-
self.calendarContainer.style.display = "block";
|
|
1254
|
-
}
|
|
1255
|
-
if (self.daysContainer !== undefined) {
|
|
1256
|
-
var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
|
|
1257
|
-
self.daysContainer.style.width = daysWidth + "px";
|
|
1258
|
-
self.calendarContainer.style.width =
|
|
1259
|
-
daysWidth +
|
|
1260
|
-
(self.weekWrapper !== undefined
|
|
1261
|
-
? self.weekWrapper.offsetWidth
|
|
1262
|
-
: 0) +
|
|
1263
|
-
"px";
|
|
1264
|
-
self.calendarContainer.style.removeProperty("visibility");
|
|
1265
|
-
self.calendarContainer.style.removeProperty("display");
|
|
1266
|
-
}
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
function updateTime(e) {
|
|
1271
|
-
if (self.selectedDates.length === 0) {
|
|
1272
|
-
var defaultDate = self.config.minDate === undefined ||
|
|
1273
|
-
compareDates(new Date(), self.config.minDate) >= 0
|
|
1274
|
-
? new Date()
|
|
1275
|
-
: new Date(self.config.minDate.getTime());
|
|
1276
|
-
var defaults = getDefaultHours(self.config);
|
|
1277
|
-
defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());
|
|
1278
|
-
self.selectedDates = [defaultDate];
|
|
1279
|
-
self.latestSelectedDateObj = defaultDate;
|
|
1280
|
-
}
|
|
1281
|
-
if (e !== undefined && e.type !== "blur") {
|
|
1282
|
-
timeWrapper(e);
|
|
1283
|
-
}
|
|
1284
|
-
var prevValue = self._input.value;
|
|
1285
|
-
setHoursFromInputs();
|
|
1286
|
-
updateValue();
|
|
1287
|
-
if (self._input.value !== prevValue) {
|
|
1288
|
-
self._debouncedChange();
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
function ampm2military(hour, amPM) {
|
|
1292
|
-
return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);
|
|
1293
|
-
}
|
|
1294
|
-
function military2ampm(hour) {
|
|
1295
|
-
switch (hour % 24) {
|
|
1296
|
-
case 0:
|
|
1297
|
-
case 12:
|
|
1298
|
-
return 12;
|
|
1299
|
-
default:
|
|
1300
|
-
return hour % 12;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
function setHoursFromInputs() {
|
|
1304
|
-
if (self.hourElement === undefined || self.minuteElement === undefined)
|
|
1305
|
-
return;
|
|
1306
|
-
var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
|
|
1307
|
-
? (parseInt(self.secondElement.value, 10) || 0) % 60
|
|
1308
|
-
: 0;
|
|
1309
|
-
if (self.amPM !== undefined) {
|
|
1310
|
-
hours = ampm2military(hours, self.amPM.textContent);
|
|
1311
|
-
}
|
|
1312
|
-
var limitMinHours = self.config.minTime !== undefined ||
|
|
1313
|
-
(self.config.minDate &&
|
|
1314
|
-
self.minDateHasTime &&
|
|
1315
|
-
self.latestSelectedDateObj &&
|
|
1316
|
-
compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
|
|
1317
|
-
0);
|
|
1318
|
-
var limitMaxHours = self.config.maxTime !== undefined ||
|
|
1319
|
-
(self.config.maxDate &&
|
|
1320
|
-
self.maxDateHasTime &&
|
|
1321
|
-
self.latestSelectedDateObj &&
|
|
1322
|
-
compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
|
|
1323
|
-
0);
|
|
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
|
-
}
|
|
1336
|
-
}
|
|
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
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
setHours(hours, minutes, seconds);
|
|
1360
|
-
}
|
|
1361
|
-
function setHoursFromDate(dateObj) {
|
|
1362
|
-
var date = dateObj || self.latestSelectedDateObj;
|
|
1363
|
-
if (date && date instanceof Date) {
|
|
1364
|
-
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
function setHours(hours, minutes, seconds) {
|
|
1368
|
-
if (self.latestSelectedDateObj !== undefined) {
|
|
1369
|
-
self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
|
|
1370
|
-
}
|
|
1371
|
-
if (!self.hourElement || !self.minuteElement || self.isMobile)
|
|
1372
|
-
return;
|
|
1373
|
-
self.hourElement.value = pad(!self.config.time_24hr
|
|
1374
|
-
? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)
|
|
1375
|
-
: hours);
|
|
1376
|
-
self.minuteElement.value = pad(minutes);
|
|
1377
|
-
if (self.amPM !== undefined)
|
|
1378
|
-
self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
|
|
1379
|
-
if (self.secondElement !== undefined)
|
|
1380
|
-
self.secondElement.value = pad(seconds);
|
|
1381
|
-
}
|
|
1382
|
-
function onYearInput(event) {
|
|
1383
|
-
var eventTarget = getEventTarget(event);
|
|
1384
|
-
var year = parseInt(eventTarget.value) + (event.delta || 0);
|
|
1385
|
-
if (year / 1000 > 1 ||
|
|
1386
|
-
(event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
|
|
1387
|
-
changeYear(year);
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
function bind(element, event, handler, options) {
|
|
1391
|
-
if (event instanceof Array)
|
|
1392
|
-
return event.forEach(function (ev) { return bind(element, ev, handler, options); });
|
|
1393
|
-
if (element instanceof Array)
|
|
1394
|
-
return element.forEach(function (el) { return bind(el, event, handler, options); });
|
|
1395
|
-
element.addEventListener(event, handler, options);
|
|
1396
|
-
self._handlers.push({
|
|
1397
|
-
remove: function () { return element.removeEventListener(event, handler, options); },
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1400
|
-
function triggerChange() {
|
|
1401
|
-
triggerEvent("onChange");
|
|
1402
|
-
}
|
|
1403
|
-
function bindEvents() {
|
|
1404
|
-
if (self.config.wrap) {
|
|
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
|
-
});
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
if (self.isMobile) {
|
|
1412
|
-
setupMobile();
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
var debouncedResize = debounce$1(onResize, 50);
|
|
1416
|
-
self._debouncedChange = debounce$1(triggerChange, DEBOUNCED_CHANGE_MS);
|
|
1417
|
-
if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
|
|
1418
|
-
bind(self.daysContainer, "mouseover", function (e) {
|
|
1419
|
-
if (self.config.mode === "range")
|
|
1420
|
-
onMouseOver(getEventTarget(e));
|
|
1421
|
-
});
|
|
1422
|
-
bind(self._input, "keydown", onKeyDown);
|
|
1423
|
-
if (self.calendarContainer !== undefined) {
|
|
1424
|
-
bind(self.calendarContainer, "keydown", onKeyDown);
|
|
1425
|
-
}
|
|
1426
|
-
if (!self.config.inline && !self.config.static)
|
|
1427
|
-
bind(window, "resize", debouncedResize);
|
|
1428
|
-
if (window.ontouchstart !== undefined)
|
|
1429
|
-
bind(window.document, "touchstart", documentClick);
|
|
1430
|
-
else
|
|
1431
|
-
bind(window.document, "mousedown", documentClick);
|
|
1432
|
-
bind(window.document, "focus", documentClick, { capture: true });
|
|
1433
|
-
if (self.config.clickOpens === true) {
|
|
1434
|
-
bind(self._input, "focus", self.open);
|
|
1435
|
-
bind(self._input, "click", self.open);
|
|
1436
|
-
}
|
|
1437
|
-
if (self.daysContainer !== undefined) {
|
|
1438
|
-
bind(self.monthNav, "click", onMonthNavClick);
|
|
1439
|
-
bind(self.monthNav, ["keyup", "increment"], onYearInput);
|
|
1440
|
-
bind(self.daysContainer, "click", selectDate);
|
|
1441
|
-
}
|
|
1442
|
-
if (self.timeContainer !== undefined &&
|
|
1443
|
-
self.minuteElement !== undefined &&
|
|
1444
|
-
self.hourElement !== undefined) {
|
|
1445
|
-
var selText = function (e) {
|
|
1446
|
-
return getEventTarget(e).select();
|
|
1447
|
-
};
|
|
1448
|
-
bind(self.timeContainer, ["increment"], updateTime);
|
|
1449
|
-
bind(self.timeContainer, "blur", updateTime, { capture: true });
|
|
1450
|
-
bind(self.timeContainer, "click", timeIncrement);
|
|
1451
|
-
bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
|
|
1452
|
-
if (self.secondElement !== undefined)
|
|
1453
|
-
bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
|
|
1454
|
-
if (self.amPM !== undefined) {
|
|
1455
|
-
bind(self.amPM, "click", function (e) {
|
|
1456
|
-
updateTime(e);
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
if (self.config.allowInput) {
|
|
1461
|
-
bind(self._input, "blur", onBlur);
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
function jumpToDate(jumpDate, triggerChange) {
|
|
1465
|
-
var jumpTo = jumpDate !== undefined
|
|
1466
|
-
? self.parseDate(jumpDate)
|
|
1467
|
-
: self.latestSelectedDateObj ||
|
|
1468
|
-
(self.config.minDate && self.config.minDate > self.now
|
|
1469
|
-
? self.config.minDate
|
|
1470
|
-
: self.config.maxDate && self.config.maxDate < self.now
|
|
1471
|
-
? self.config.maxDate
|
|
1472
|
-
: self.now);
|
|
1473
|
-
var oldYear = self.currentYear;
|
|
1474
|
-
var oldMonth = self.currentMonth;
|
|
1475
|
-
try {
|
|
1476
|
-
if (jumpTo !== undefined) {
|
|
1477
|
-
self.currentYear = jumpTo.getFullYear();
|
|
1478
|
-
self.currentMonth = jumpTo.getMonth();
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
catch (e) {
|
|
1482
|
-
e.message = "Invalid date supplied: " + jumpTo;
|
|
1483
|
-
self.config.errorHandler(e);
|
|
1484
|
-
}
|
|
1485
|
-
if (triggerChange && self.currentYear !== oldYear) {
|
|
1486
|
-
triggerEvent("onYearChange");
|
|
1487
|
-
buildMonthSwitch();
|
|
1488
|
-
}
|
|
1489
|
-
if (triggerChange &&
|
|
1490
|
-
(self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
|
|
1491
|
-
triggerEvent("onMonthChange");
|
|
1492
|
-
}
|
|
1493
|
-
self.redraw();
|
|
1494
|
-
}
|
|
1495
|
-
function timeIncrement(e) {
|
|
1496
|
-
var eventTarget = getEventTarget(e);
|
|
1497
|
-
if (~eventTarget.className.indexOf("arrow"))
|
|
1498
|
-
incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1);
|
|
1499
|
-
}
|
|
1500
|
-
function incrementNumInput(e, delta, inputElem) {
|
|
1501
|
-
var target = e && getEventTarget(e);
|
|
1502
|
-
var input = inputElem ||
|
|
1503
|
-
(target && target.parentNode && target.parentNode.firstChild);
|
|
1504
|
-
var event = createEvent("increment");
|
|
1505
|
-
event.delta = delta;
|
|
1506
|
-
input && input.dispatchEvent(event);
|
|
1507
|
-
}
|
|
1508
|
-
function build() {
|
|
1509
|
-
var fragment = window.document.createDocumentFragment();
|
|
1510
|
-
self.calendarContainer = createElement("div", "flatpickr-calendar");
|
|
1511
|
-
self.calendarContainer.tabIndex = -1;
|
|
1512
|
-
if (!self.config.noCalendar) {
|
|
1513
|
-
fragment.appendChild(buildMonthNav());
|
|
1514
|
-
self.innerContainer = createElement("div", "flatpickr-innerContainer");
|
|
1515
|
-
if (self.config.weekNumbers) {
|
|
1516
|
-
var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
|
|
1517
|
-
self.innerContainer.appendChild(weekWrapper);
|
|
1518
|
-
self.weekNumbers = weekNumbers;
|
|
1519
|
-
self.weekWrapper = weekWrapper;
|
|
1520
|
-
}
|
|
1521
|
-
self.rContainer = createElement("div", "flatpickr-rContainer");
|
|
1522
|
-
self.rContainer.appendChild(buildWeekdays());
|
|
1523
|
-
if (!self.daysContainer) {
|
|
1524
|
-
self.daysContainer = createElement("div", "flatpickr-days");
|
|
1525
|
-
self.daysContainer.tabIndex = -1;
|
|
1526
|
-
}
|
|
1527
|
-
buildDays();
|
|
1528
|
-
self.rContainer.appendChild(self.daysContainer);
|
|
1529
|
-
self.innerContainer.appendChild(self.rContainer);
|
|
1530
|
-
fragment.appendChild(self.innerContainer);
|
|
1531
|
-
}
|
|
1532
|
-
if (self.config.enableTime) {
|
|
1533
|
-
fragment.appendChild(buildTime());
|
|
1534
|
-
}
|
|
1535
|
-
toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
|
|
1536
|
-
toggleClass(self.calendarContainer, "animate", self.config.animate === true);
|
|
1537
|
-
toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
|
|
1538
|
-
self.calendarContainer.appendChild(fragment);
|
|
1539
|
-
var customAppend = self.config.appendTo !== undefined &&
|
|
1540
|
-
self.config.appendTo.nodeType !== undefined;
|
|
1541
|
-
if (self.config.inline || self.config.static) {
|
|
1542
|
-
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
|
|
1543
|
-
if (self.config.inline) {
|
|
1544
|
-
if (!customAppend && self.element.parentNode)
|
|
1545
|
-
self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
|
|
1546
|
-
else if (self.config.appendTo !== undefined)
|
|
1547
|
-
self.config.appendTo.appendChild(self.calendarContainer);
|
|
1548
|
-
}
|
|
1549
|
-
if (self.config.static) {
|
|
1550
|
-
var wrapper = createElement("div", "flatpickr-wrapper");
|
|
1551
|
-
if (self.element.parentNode)
|
|
1552
|
-
self.element.parentNode.insertBefore(wrapper, self.element);
|
|
1553
|
-
wrapper.appendChild(self.element);
|
|
1554
|
-
if (self.altInput)
|
|
1555
|
-
wrapper.appendChild(self.altInput);
|
|
1556
|
-
wrapper.appendChild(self.calendarContainer);
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
if (!self.config.static && !self.config.inline)
|
|
1560
|
-
(self.config.appendTo !== undefined
|
|
1561
|
-
? self.config.appendTo
|
|
1562
|
-
: window.document.body).appendChild(self.calendarContainer);
|
|
1563
|
-
}
|
|
1564
|
-
function createDay(className, date, _dayNumber, i) {
|
|
1565
|
-
var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString());
|
|
1566
|
-
dayElement.dateObj = date;
|
|
1567
|
-
dayElement.$i = i;
|
|
1568
|
-
dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
|
|
1569
|
-
if (className.indexOf("hidden") === -1 &&
|
|
1570
|
-
compareDates(date, self.now) === 0) {
|
|
1571
|
-
self.todayDateElem = dayElement;
|
|
1572
|
-
dayElement.classList.add("today");
|
|
1573
|
-
dayElement.setAttribute("aria-current", "date");
|
|
1574
|
-
}
|
|
1575
|
-
if (dateIsEnabled) {
|
|
1576
|
-
dayElement.tabIndex = -1;
|
|
1577
|
-
if (isDateSelected(date)) {
|
|
1578
|
-
dayElement.classList.add("selected");
|
|
1579
|
-
self.selectedDateElem = dayElement;
|
|
1580
|
-
if (self.config.mode === "range") {
|
|
1581
|
-
toggleClass(dayElement, "startRange", self.selectedDates[0] &&
|
|
1582
|
-
compareDates(date, self.selectedDates[0], true) === 0);
|
|
1583
|
-
toggleClass(dayElement, "endRange", self.selectedDates[1] &&
|
|
1584
|
-
compareDates(date, self.selectedDates[1], true) === 0);
|
|
1585
|
-
if (className === "nextMonthDay")
|
|
1586
|
-
dayElement.classList.add("inRange");
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
else {
|
|
1591
|
-
dayElement.classList.add("flatpickr-disabled");
|
|
1592
|
-
}
|
|
1593
|
-
if (self.config.mode === "range") {
|
|
1594
|
-
if (isDateInRange(date) && !isDateSelected(date))
|
|
1595
|
-
dayElement.classList.add("inRange");
|
|
1596
|
-
}
|
|
1597
|
-
if (self.weekNumbers &&
|
|
1598
|
-
self.config.showMonths === 1 &&
|
|
1599
|
-
className !== "prevMonthDay" &&
|
|
1600
|
-
i % 7 === 6) {
|
|
1601
|
-
self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
|
|
1602
|
-
}
|
|
1603
|
-
triggerEvent("onDayCreate", dayElement);
|
|
1604
|
-
return dayElement;
|
|
1605
|
-
}
|
|
1606
|
-
function focusOnDayElem(targetNode) {
|
|
1607
|
-
targetNode.focus();
|
|
1608
|
-
if (self.config.mode === "range")
|
|
1609
|
-
onMouseOver(targetNode);
|
|
1610
|
-
}
|
|
1611
|
-
function getFirstAvailableDay(delta) {
|
|
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];
|
|
1620
|
-
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
|
|
1621
|
-
return c;
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
return undefined;
|
|
1625
|
-
}
|
|
1626
|
-
function getNextAvailableDay(current, delta) {
|
|
1627
|
-
var givenMonth = current.className.indexOf("Month") === -1
|
|
1628
|
-
? current.dateObj.getMonth()
|
|
1629
|
-
: self.currentMonth;
|
|
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
|
|
1635
|
-
? current.$i + delta
|
|
1636
|
-
: delta < 0
|
|
1637
|
-
? month.children.length - 1
|
|
1638
|
-
: 0;
|
|
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];
|
|
1642
|
-
if (c.className.indexOf("hidden") === -1 &&
|
|
1643
|
-
isEnabled(c.dateObj) &&
|
|
1644
|
-
Math.abs(current.$i - i) >= Math.abs(delta))
|
|
1645
|
-
return focusOnDayElem(c);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
self.changeMonth(loopDelta);
|
|
1649
|
-
focusOnDay(getFirstAvailableDay(loopDelta), 0);
|
|
1650
|
-
return undefined;
|
|
1651
|
-
}
|
|
1652
|
-
function focusOnDay(current, offset) {
|
|
1653
|
-
var activeElement = getClosestActiveElement();
|
|
1654
|
-
var dayFocused = isInView(activeElement || document.body);
|
|
1655
|
-
var startElem = current !== undefined
|
|
1656
|
-
? current
|
|
1657
|
-
: dayFocused
|
|
1658
|
-
? activeElement
|
|
1659
|
-
: self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
|
|
1660
|
-
? self.selectedDateElem
|
|
1661
|
-
: self.todayDateElem !== undefined && isInView(self.todayDateElem)
|
|
1662
|
-
? self.todayDateElem
|
|
1663
|
-
: getFirstAvailableDay(offset > 0 ? 1 : -1);
|
|
1664
|
-
if (startElem === undefined) {
|
|
1665
|
-
self._input.focus();
|
|
1666
|
-
}
|
|
1667
|
-
else if (!dayFocused) {
|
|
1668
|
-
focusOnDayElem(startElem);
|
|
1669
|
-
}
|
|
1670
|
-
else {
|
|
1671
|
-
getNextAvailableDay(startElem, offset);
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
function buildMonthDays(year, month) {
|
|
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;
|
|
1679
|
-
for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
|
|
1680
|
-
days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
|
|
1681
|
-
}
|
|
1682
|
-
for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
|
|
1683
|
-
days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex));
|
|
1684
|
-
}
|
|
1685
|
-
for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
|
|
1686
|
-
(self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
|
|
1687
|
-
days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
|
|
1688
|
-
}
|
|
1689
|
-
var dayContainer = createElement("div", "dayContainer");
|
|
1690
|
-
dayContainer.appendChild(days);
|
|
1691
|
-
return dayContainer;
|
|
1692
|
-
}
|
|
1693
|
-
function buildDays() {
|
|
1694
|
-
if (self.daysContainer === undefined) {
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
clearNode(self.daysContainer);
|
|
1698
|
-
if (self.weekNumbers)
|
|
1699
|
-
clearNode(self.weekNumbers);
|
|
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);
|
|
1703
|
-
d.setMonth(self.currentMonth + i);
|
|
1704
|
-
frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
|
|
1705
|
-
}
|
|
1706
|
-
self.daysContainer.appendChild(frag);
|
|
1707
|
-
self.days = self.daysContainer.firstChild;
|
|
1708
|
-
if (self.config.mode === "range" && self.selectedDates.length === 1) {
|
|
1709
|
-
onMouseOver();
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
function buildMonthSwitch() {
|
|
1713
|
-
if (self.config.showMonths > 1 ||
|
|
1714
|
-
self.config.monthSelectorType !== "dropdown")
|
|
1715
|
-
return;
|
|
1716
|
-
var shouldBuildMonth = function (month) {
|
|
1717
|
-
if (self.config.minDate !== undefined &&
|
|
1718
|
-
self.currentYear === self.config.minDate.getFullYear() &&
|
|
1719
|
-
month < self.config.minDate.getMonth()) {
|
|
1720
|
-
return false;
|
|
1721
|
-
}
|
|
1722
|
-
return !(self.config.maxDate !== undefined &&
|
|
1723
|
-
self.currentYear === self.config.maxDate.getFullYear() &&
|
|
1724
|
-
month > self.config.maxDate.getMonth());
|
|
1725
|
-
};
|
|
1726
|
-
self.monthsDropdownContainer.tabIndex = -1;
|
|
1727
|
-
self.monthsDropdownContainer.innerHTML = "";
|
|
1728
|
-
for (var i = 0; i < 12; i++) {
|
|
1729
|
-
if (!shouldBuildMonth(i))
|
|
1730
|
-
continue;
|
|
1731
|
-
var month = createElement("option", "flatpickr-monthDropdown-month");
|
|
1732
|
-
month.value = new Date(self.currentYear, i).getMonth().toString();
|
|
1733
|
-
month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
|
|
1734
|
-
month.tabIndex = -1;
|
|
1735
|
-
if (self.currentMonth === i) {
|
|
1736
|
-
month.selected = true;
|
|
1737
|
-
}
|
|
1738
|
-
self.monthsDropdownContainer.appendChild(month);
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
function buildMonth() {
|
|
1742
|
-
var container = createElement("div", "flatpickr-month");
|
|
1743
|
-
var monthNavFragment = window.document.createDocumentFragment();
|
|
1744
|
-
var monthElement;
|
|
1745
|
-
if (self.config.showMonths > 1 ||
|
|
1746
|
-
self.config.monthSelectorType === "static") {
|
|
1747
|
-
monthElement = createElement("span", "cur-month");
|
|
1748
|
-
}
|
|
1749
|
-
else {
|
|
1750
|
-
self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
|
|
1751
|
-
self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel);
|
|
1752
|
-
bind(self.monthsDropdownContainer, "change", function (e) {
|
|
1753
|
-
var target = getEventTarget(e);
|
|
1754
|
-
var selectedMonth = parseInt(target.value, 10);
|
|
1755
|
-
self.changeMonth(selectedMonth - self.currentMonth);
|
|
1756
|
-
triggerEvent("onMonthChange");
|
|
1757
|
-
});
|
|
1758
|
-
buildMonthSwitch();
|
|
1759
|
-
monthElement = self.monthsDropdownContainer;
|
|
1760
|
-
}
|
|
1761
|
-
var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
|
|
1762
|
-
var yearElement = yearInput.getElementsByTagName("input")[0];
|
|
1763
|
-
yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
|
|
1764
|
-
if (self.config.minDate) {
|
|
1765
|
-
yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
|
|
1766
|
-
}
|
|
1767
|
-
if (self.config.maxDate) {
|
|
1768
|
-
yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
|
|
1769
|
-
yearElement.disabled =
|
|
1770
|
-
!!self.config.minDate &&
|
|
1771
|
-
self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
|
|
1772
|
-
}
|
|
1773
|
-
var currentMonth = createElement("div", "flatpickr-current-month");
|
|
1774
|
-
currentMonth.appendChild(monthElement);
|
|
1775
|
-
currentMonth.appendChild(yearInput);
|
|
1776
|
-
monthNavFragment.appendChild(currentMonth);
|
|
1777
|
-
container.appendChild(monthNavFragment);
|
|
1778
|
-
return {
|
|
1779
|
-
container: container,
|
|
1780
|
-
yearElement: yearElement,
|
|
1781
|
-
monthElement: monthElement,
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
function buildMonths() {
|
|
1785
|
-
clearNode(self.monthNav);
|
|
1786
|
-
self.monthNav.appendChild(self.prevMonthNav);
|
|
1787
|
-
if (self.config.showMonths) {
|
|
1788
|
-
self.yearElements = [];
|
|
1789
|
-
self.monthElements = [];
|
|
1790
|
-
}
|
|
1791
|
-
for (var m = self.config.showMonths; m--;) {
|
|
1792
|
-
var month = buildMonth();
|
|
1793
|
-
self.yearElements.push(month.yearElement);
|
|
1794
|
-
self.monthElements.push(month.monthElement);
|
|
1795
|
-
self.monthNav.appendChild(month.container);
|
|
1796
|
-
}
|
|
1797
|
-
self.monthNav.appendChild(self.nextMonthNav);
|
|
1798
|
-
}
|
|
1799
|
-
function buildMonthNav() {
|
|
1800
|
-
self.monthNav = createElement("div", "flatpickr-months");
|
|
1801
|
-
self.yearElements = [];
|
|
1802
|
-
self.monthElements = [];
|
|
1803
|
-
self.prevMonthNav = createElement("span", "flatpickr-prev-month");
|
|
1804
|
-
self.prevMonthNav.innerHTML = self.config.prevArrow;
|
|
1805
|
-
self.nextMonthNav = createElement("span", "flatpickr-next-month");
|
|
1806
|
-
self.nextMonthNav.innerHTML = self.config.nextArrow;
|
|
1807
|
-
buildMonths();
|
|
1808
|
-
Object.defineProperty(self, "_hidePrevMonthArrow", {
|
|
1809
|
-
get: function () { return self.__hidePrevMonthArrow; },
|
|
1810
|
-
set: function (bool) {
|
|
1811
|
-
if (self.__hidePrevMonthArrow !== bool) {
|
|
1812
|
-
toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
|
|
1813
|
-
self.__hidePrevMonthArrow = bool;
|
|
1814
|
-
}
|
|
1815
|
-
},
|
|
1816
|
-
});
|
|
1817
|
-
Object.defineProperty(self, "_hideNextMonthArrow", {
|
|
1818
|
-
get: function () { return self.__hideNextMonthArrow; },
|
|
1819
|
-
set: function (bool) {
|
|
1820
|
-
if (self.__hideNextMonthArrow !== bool) {
|
|
1821
|
-
toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
|
|
1822
|
-
self.__hideNextMonthArrow = bool;
|
|
1823
|
-
}
|
|
1824
|
-
},
|
|
1825
|
-
});
|
|
1826
|
-
self.currentYearElement = self.yearElements[0];
|
|
1827
|
-
updateNavigationCurrentMonth();
|
|
1828
|
-
return self.monthNav;
|
|
1829
|
-
}
|
|
1830
|
-
function buildTime() {
|
|
1831
|
-
self.calendarContainer.classList.add("hasTime");
|
|
1832
|
-
if (self.config.noCalendar)
|
|
1833
|
-
self.calendarContainer.classList.add("noCalendar");
|
|
1834
|
-
var defaults = getDefaultHours(self.config);
|
|
1835
|
-
self.timeContainer = createElement("div", "flatpickr-time");
|
|
1836
|
-
self.timeContainer.tabIndex = -1;
|
|
1837
|
-
var separator = createElement("span", "flatpickr-time-separator", ":");
|
|
1838
|
-
var hourInput = createNumberInput("flatpickr-hour", {
|
|
1839
|
-
"aria-label": self.l10n.hourAriaLabel,
|
|
1840
|
-
});
|
|
1841
|
-
self.hourElement = hourInput.getElementsByTagName("input")[0];
|
|
1842
|
-
var minuteInput = createNumberInput("flatpickr-minute", {
|
|
1843
|
-
"aria-label": self.l10n.minuteAriaLabel,
|
|
1844
|
-
});
|
|
1845
|
-
self.minuteElement = minuteInput.getElementsByTagName("input")[0];
|
|
1846
|
-
self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
|
|
1847
|
-
self.hourElement.value = pad(self.latestSelectedDateObj
|
|
1848
|
-
? self.latestSelectedDateObj.getHours()
|
|
1849
|
-
: self.config.time_24hr
|
|
1850
|
-
? defaults.hours
|
|
1851
|
-
: military2ampm(defaults.hours));
|
|
1852
|
-
self.minuteElement.value = pad(self.latestSelectedDateObj
|
|
1853
|
-
? self.latestSelectedDateObj.getMinutes()
|
|
1854
|
-
: defaults.minutes);
|
|
1855
|
-
self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
|
|
1856
|
-
self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
|
|
1857
|
-
self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
|
|
1858
|
-
self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
|
|
1859
|
-
self.hourElement.setAttribute("maxlength", "2");
|
|
1860
|
-
self.minuteElement.setAttribute("min", "0");
|
|
1861
|
-
self.minuteElement.setAttribute("max", "59");
|
|
1862
|
-
self.minuteElement.setAttribute("maxlength", "2");
|
|
1863
|
-
self.timeContainer.appendChild(hourInput);
|
|
1864
|
-
self.timeContainer.appendChild(separator);
|
|
1865
|
-
self.timeContainer.appendChild(minuteInput);
|
|
1866
|
-
if (self.config.time_24hr)
|
|
1867
|
-
self.timeContainer.classList.add("time24hr");
|
|
1868
|
-
if (self.config.enableSeconds) {
|
|
1869
|
-
self.timeContainer.classList.add("hasSeconds");
|
|
1870
|
-
var secondInput = createNumberInput("flatpickr-second");
|
|
1871
|
-
self.secondElement = secondInput.getElementsByTagName("input")[0];
|
|
1872
|
-
self.secondElement.value = pad(self.latestSelectedDateObj
|
|
1873
|
-
? self.latestSelectedDateObj.getSeconds()
|
|
1874
|
-
: defaults.seconds);
|
|
1875
|
-
self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
|
|
1876
|
-
self.secondElement.setAttribute("min", "0");
|
|
1877
|
-
self.secondElement.setAttribute("max", "59");
|
|
1878
|
-
self.secondElement.setAttribute("maxlength", "2");
|
|
1879
|
-
self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
|
|
1880
|
-
self.timeContainer.appendChild(secondInput);
|
|
1881
|
-
}
|
|
1882
|
-
if (!self.config.time_24hr) {
|
|
1883
|
-
self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj
|
|
1884
|
-
? self.hourElement.value
|
|
1885
|
-
: self.config.defaultHour) > 11)]);
|
|
1886
|
-
self.amPM.title = self.l10n.toggleTitle;
|
|
1887
|
-
self.amPM.tabIndex = -1;
|
|
1888
|
-
self.timeContainer.appendChild(self.amPM);
|
|
1889
|
-
}
|
|
1890
|
-
return self.timeContainer;
|
|
1891
|
-
}
|
|
1892
|
-
function buildWeekdays() {
|
|
1893
|
-
if (!self.weekdayContainer)
|
|
1894
|
-
self.weekdayContainer = createElement("div", "flatpickr-weekdays");
|
|
1895
|
-
else
|
|
1896
|
-
clearNode(self.weekdayContainer);
|
|
1897
|
-
for (var i = self.config.showMonths; i--;) {
|
|
1898
|
-
var container = createElement("div", "flatpickr-weekdaycontainer");
|
|
1899
|
-
self.weekdayContainer.appendChild(container);
|
|
1900
|
-
}
|
|
1901
|
-
updateWeekdays();
|
|
1902
|
-
return self.weekdayContainer;
|
|
1903
|
-
}
|
|
1904
|
-
function updateWeekdays() {
|
|
1905
|
-
if (!self.weekdayContainer) {
|
|
1906
|
-
return;
|
|
1907
|
-
}
|
|
1908
|
-
var firstDayOfWeek = self.l10n.firstDayOfWeek;
|
|
1909
|
-
var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);
|
|
1910
|
-
if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
|
|
1911
|
-
weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));
|
|
1912
|
-
}
|
|
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 ";
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function buildWeeks() {
|
|
1918
|
-
self.calendarContainer.classList.add("hasWeeks");
|
|
1919
|
-
var weekWrapper = createElement("div", "flatpickr-weekwrapper");
|
|
1920
|
-
weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
|
|
1921
|
-
var weekNumbers = createElement("div", "flatpickr-weeks");
|
|
1922
|
-
weekWrapper.appendChild(weekNumbers);
|
|
1923
|
-
return {
|
|
1924
|
-
weekWrapper: weekWrapper,
|
|
1925
|
-
weekNumbers: weekNumbers,
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
function changeMonth(value, isOffset) {
|
|
1929
|
-
if (isOffset === void 0) { isOffset = true; }
|
|
1930
|
-
var delta = isOffset ? value : value - self.currentMonth;
|
|
1931
|
-
if ((delta < 0 && self._hidePrevMonthArrow === true) ||
|
|
1932
|
-
(delta > 0 && self._hideNextMonthArrow === true))
|
|
1933
|
-
return;
|
|
1934
|
-
self.currentMonth += delta;
|
|
1935
|
-
if (self.currentMonth < 0 || self.currentMonth > 11) {
|
|
1936
|
-
self.currentYear += self.currentMonth > 11 ? 1 : -1;
|
|
1937
|
-
self.currentMonth = (self.currentMonth + 12) % 12;
|
|
1938
|
-
triggerEvent("onYearChange");
|
|
1939
|
-
buildMonthSwitch();
|
|
1940
|
-
}
|
|
1941
|
-
buildDays();
|
|
1942
|
-
triggerEvent("onMonthChange");
|
|
1943
|
-
updateNavigationCurrentMonth();
|
|
1944
|
-
}
|
|
1945
|
-
function clear(triggerChangeEvent, toInitial) {
|
|
1946
|
-
if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
|
|
1947
|
-
if (toInitial === void 0) { toInitial = true; }
|
|
1948
|
-
self.input.value = "";
|
|
1949
|
-
if (self.altInput !== undefined)
|
|
1950
|
-
self.altInput.value = "";
|
|
1951
|
-
if (self.mobileInput !== undefined)
|
|
1952
|
-
self.mobileInput.value = "";
|
|
1953
|
-
self.selectedDates = [];
|
|
1954
|
-
self.latestSelectedDateObj = undefined;
|
|
1955
|
-
if (toInitial === true) {
|
|
1956
|
-
self.currentYear = self._initialDate.getFullYear();
|
|
1957
|
-
self.currentMonth = self._initialDate.getMonth();
|
|
1958
|
-
}
|
|
1959
|
-
if (self.config.enableTime === true) {
|
|
1960
|
-
var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;
|
|
1961
|
-
setHours(hours, minutes, seconds);
|
|
1962
|
-
}
|
|
1963
|
-
self.redraw();
|
|
1964
|
-
if (triggerChangeEvent)
|
|
1965
|
-
triggerEvent("onChange");
|
|
1966
|
-
}
|
|
1967
|
-
function close() {
|
|
1968
|
-
self.isOpen = false;
|
|
1969
|
-
if (!self.isMobile) {
|
|
1970
|
-
if (self.calendarContainer !== undefined) {
|
|
1971
|
-
self.calendarContainer.classList.remove("open");
|
|
1972
|
-
}
|
|
1973
|
-
if (self._input !== undefined) {
|
|
1974
|
-
self._input.classList.remove("active");
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
triggerEvent("onClose");
|
|
1978
|
-
}
|
|
1979
|
-
function destroy() {
|
|
1980
|
-
if (self.config !== undefined)
|
|
1981
|
-
triggerEvent("onDestroy");
|
|
1982
|
-
for (var i = self._handlers.length; i--;) {
|
|
1983
|
-
self._handlers[i].remove();
|
|
1984
|
-
}
|
|
1985
|
-
self._handlers = [];
|
|
1986
|
-
if (self.mobileInput) {
|
|
1987
|
-
if (self.mobileInput.parentNode)
|
|
1988
|
-
self.mobileInput.parentNode.removeChild(self.mobileInput);
|
|
1989
|
-
self.mobileInput = undefined;
|
|
1990
|
-
}
|
|
1991
|
-
else if (self.calendarContainer && self.calendarContainer.parentNode) {
|
|
1992
|
-
if (self.config.static && self.calendarContainer.parentNode) {
|
|
1993
|
-
var wrapper = self.calendarContainer.parentNode;
|
|
1994
|
-
wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
|
|
1995
|
-
if (wrapper.parentNode) {
|
|
1996
|
-
while (wrapper.firstChild)
|
|
1997
|
-
wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
|
|
1998
|
-
wrapper.parentNode.removeChild(wrapper);
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
else
|
|
2002
|
-
self.calendarContainer.parentNode.removeChild(self.calendarContainer);
|
|
2003
|
-
}
|
|
2004
|
-
if (self.altInput) {
|
|
2005
|
-
self.input.type = "text";
|
|
2006
|
-
if (self.altInput.parentNode)
|
|
2007
|
-
self.altInput.parentNode.removeChild(self.altInput);
|
|
2008
|
-
delete self.altInput;
|
|
2009
|
-
}
|
|
2010
|
-
if (self.input) {
|
|
2011
|
-
self.input.type = self.input._type;
|
|
2012
|
-
self.input.classList.remove("flatpickr-input");
|
|
2013
|
-
self.input.removeAttribute("readonly");
|
|
2014
|
-
}
|
|
2015
|
-
[
|
|
2016
|
-
"_showTimeInput",
|
|
2017
|
-
"latestSelectedDateObj",
|
|
2018
|
-
"_hideNextMonthArrow",
|
|
2019
|
-
"_hidePrevMonthArrow",
|
|
2020
|
-
"__hideNextMonthArrow",
|
|
2021
|
-
"__hidePrevMonthArrow",
|
|
2022
|
-
"isMobile",
|
|
2023
|
-
"isOpen",
|
|
2024
|
-
"selectedDateElem",
|
|
2025
|
-
"minDateHasTime",
|
|
2026
|
-
"maxDateHasTime",
|
|
2027
|
-
"days",
|
|
2028
|
-
"daysContainer",
|
|
2029
|
-
"_input",
|
|
2030
|
-
"_positionElement",
|
|
2031
|
-
"innerContainer",
|
|
2032
|
-
"rContainer",
|
|
2033
|
-
"monthNav",
|
|
2034
|
-
"todayDateElem",
|
|
2035
|
-
"calendarContainer",
|
|
2036
|
-
"weekdayContainer",
|
|
2037
|
-
"prevMonthNav",
|
|
2038
|
-
"nextMonthNav",
|
|
2039
|
-
"monthsDropdownContainer",
|
|
2040
|
-
"currentMonthElement",
|
|
2041
|
-
"currentYearElement",
|
|
2042
|
-
"navigationCurrentMonth",
|
|
2043
|
-
"selectedDateElem",
|
|
2044
|
-
"config",
|
|
2045
|
-
].forEach(function (k) {
|
|
2046
|
-
try {
|
|
2047
|
-
delete self[k];
|
|
2048
|
-
}
|
|
2049
|
-
catch (_) { }
|
|
2050
|
-
});
|
|
2051
|
-
}
|
|
2052
|
-
function isCalendarElem(elem) {
|
|
2053
|
-
return self.calendarContainer.contains(elem);
|
|
2054
|
-
}
|
|
2055
|
-
function documentClick(e) {
|
|
2056
|
-
if (self.isOpen && !self.config.inline) {
|
|
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) ||
|
|
2062
|
-
(e.path &&
|
|
2063
|
-
e.path.indexOf &&
|
|
2064
|
-
(~e.path.indexOf(self.input) ||
|
|
2065
|
-
~e.path.indexOf(self.altInput)));
|
|
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
|
-
});
|
|
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
|
-
}
|
|
2078
|
-
if (self.timeContainer !== undefined &&
|
|
2079
|
-
self.minuteElement !== undefined &&
|
|
2080
|
-
self.hourElement !== undefined &&
|
|
2081
|
-
self.input.value !== "" &&
|
|
2082
|
-
self.input.value !== undefined) {
|
|
2083
|
-
updateTime();
|
|
2084
|
-
}
|
|
2085
|
-
self.close();
|
|
2086
|
-
if (self.config &&
|
|
2087
|
-
self.config.mode === "range" &&
|
|
2088
|
-
self.selectedDates.length === 1)
|
|
2089
|
-
self.clear(false);
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
function changeYear(newYear) {
|
|
2094
|
-
if (!newYear ||
|
|
2095
|
-
(self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
|
|
2096
|
-
(self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
|
|
2097
|
-
return;
|
|
2098
|
-
var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
|
|
2099
|
-
self.currentYear = newYearNum || self.currentYear;
|
|
2100
|
-
if (self.config.maxDate &&
|
|
2101
|
-
self.currentYear === self.config.maxDate.getFullYear()) {
|
|
2102
|
-
self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
|
|
2103
|
-
}
|
|
2104
|
-
else if (self.config.minDate &&
|
|
2105
|
-
self.currentYear === self.config.minDate.getFullYear()) {
|
|
2106
|
-
self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
|
|
2107
|
-
}
|
|
2108
|
-
if (isNewYear) {
|
|
2109
|
-
self.redraw();
|
|
2110
|
-
triggerEvent("onYearChange");
|
|
2111
|
-
buildMonthSwitch();
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
function isEnabled(date, timeless) {
|
|
2115
|
-
var _a;
|
|
2116
|
-
if (timeless === void 0) { timeless = true; }
|
|
2117
|
-
var dateToCheck = self.parseDate(date, undefined, timeless);
|
|
2118
|
-
if ((self.config.minDate &&
|
|
2119
|
-
dateToCheck &&
|
|
2120
|
-
compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
|
|
2121
|
-
(self.config.maxDate &&
|
|
2122
|
-
dateToCheck &&
|
|
2123
|
-
compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))
|
|
2124
|
-
return false;
|
|
2125
|
-
if (!self.config.enable && self.config.disable.length === 0)
|
|
2126
|
-
return true;
|
|
2127
|
-
if (dateToCheck === undefined)
|
|
2128
|
-
return false;
|
|
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++) {
|
|
2131
|
-
d = array[i];
|
|
2132
|
-
if (typeof d === "function" &&
|
|
2133
|
-
d(dateToCheck))
|
|
2134
|
-
return bool;
|
|
2135
|
-
else if (d instanceof Date &&
|
|
2136
|
-
dateToCheck !== undefined &&
|
|
2137
|
-
d.getTime() === dateToCheck.getTime())
|
|
2138
|
-
return bool;
|
|
2139
|
-
else if (typeof d === "string") {
|
|
2140
|
-
var parsed = self.parseDate(d, undefined, true);
|
|
2141
|
-
return parsed && parsed.getTime() === dateToCheck.getTime()
|
|
2142
|
-
? bool
|
|
2143
|
-
: !bool;
|
|
2144
|
-
}
|
|
2145
|
-
else if (typeof d === "object" &&
|
|
2146
|
-
dateToCheck !== undefined &&
|
|
2147
|
-
d.from &&
|
|
2148
|
-
d.to &&
|
|
2149
|
-
dateToCheck.getTime() >= d.from.getTime() &&
|
|
2150
|
-
dateToCheck.getTime() <= d.to.getTime())
|
|
2151
|
-
return bool;
|
|
2152
|
-
}
|
|
2153
|
-
return !bool;
|
|
2154
|
-
}
|
|
2155
|
-
function isInView(elem) {
|
|
2156
|
-
if (self.daysContainer !== undefined)
|
|
2157
|
-
return (elem.className.indexOf("hidden") === -1 &&
|
|
2158
|
-
elem.className.indexOf("flatpickr-disabled") === -1 &&
|
|
2159
|
-
self.daysContainer.contains(elem));
|
|
2160
|
-
return false;
|
|
2161
|
-
}
|
|
2162
|
-
function onBlur(e) {
|
|
2163
|
-
var isInput = e.target === self._input;
|
|
2164
|
-
var valueChanged = self._input.value.trimEnd() !== getDateStr();
|
|
2165
|
-
if (isInput &&
|
|
2166
|
-
valueChanged &&
|
|
2167
|
-
!(e.relatedTarget && isCalendarElem(e.relatedTarget))) {
|
|
2168
|
-
self.setDate(self._input.value, true, e.target === self.altInput
|
|
2169
|
-
? self.config.altFormat
|
|
2170
|
-
: self.config.dateFormat);
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
function onKeyDown(e) {
|
|
2174
|
-
var eventTarget = getEventTarget(e);
|
|
2175
|
-
var isInput = self.config.wrap
|
|
2176
|
-
? element.contains(eventTarget)
|
|
2177
|
-
: eventTarget === self._input;
|
|
2178
|
-
var allowInput = self.config.allowInput;
|
|
2179
|
-
var allowKeydown = self.isOpen && (!allowInput || !isInput);
|
|
2180
|
-
var allowInlineKeydown = self.config.inline && isInput && !allowInput;
|
|
2181
|
-
if (e.keyCode === 13 && isInput) {
|
|
2182
|
-
if (allowInput) {
|
|
2183
|
-
self.setDate(self._input.value, true, eventTarget === self.altInput
|
|
2184
|
-
? self.config.altFormat
|
|
2185
|
-
: self.config.dateFormat);
|
|
2186
|
-
self.close();
|
|
2187
|
-
return eventTarget.blur();
|
|
2188
|
-
}
|
|
2189
|
-
else {
|
|
2190
|
-
self.open();
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
else if (isCalendarElem(eventTarget) ||
|
|
2194
|
-
allowKeydown ||
|
|
2195
|
-
allowInlineKeydown) {
|
|
2196
|
-
var isTimeObj = !!self.timeContainer &&
|
|
2197
|
-
self.timeContainer.contains(eventTarget);
|
|
2198
|
-
switch (e.keyCode) {
|
|
2199
|
-
case 13:
|
|
2200
|
-
if (isTimeObj) {
|
|
2201
|
-
e.preventDefault();
|
|
2202
|
-
updateTime();
|
|
2203
|
-
focusAndClose();
|
|
2204
|
-
}
|
|
2205
|
-
else
|
|
2206
|
-
selectDate(e);
|
|
2207
|
-
break;
|
|
2208
|
-
case 27:
|
|
2209
|
-
e.preventDefault();
|
|
2210
|
-
focusAndClose();
|
|
2211
|
-
break;
|
|
2212
|
-
case 8:
|
|
2213
|
-
case 46:
|
|
2214
|
-
if (isInput && !self.config.allowInput) {
|
|
2215
|
-
e.preventDefault();
|
|
2216
|
-
self.clear();
|
|
2217
|
-
}
|
|
2218
|
-
break;
|
|
2219
|
-
case 37:
|
|
2220
|
-
case 39:
|
|
2221
|
-
if (!isTimeObj && !isInput) {
|
|
2222
|
-
e.preventDefault();
|
|
2223
|
-
var activeElement = getClosestActiveElement();
|
|
2224
|
-
if (self.daysContainer !== undefined &&
|
|
2225
|
-
(allowInput === false ||
|
|
2226
|
-
(activeElement && isInView(activeElement)))) {
|
|
2227
|
-
var delta_1 = e.keyCode === 39 ? 1 : -1;
|
|
2228
|
-
if (!e.ctrlKey)
|
|
2229
|
-
focusOnDay(undefined, delta_1);
|
|
2230
|
-
else {
|
|
2231
|
-
e.stopPropagation();
|
|
2232
|
-
changeMonth(delta_1);
|
|
2233
|
-
focusOnDay(getFirstAvailableDay(1), 0);
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
else if (self.hourElement)
|
|
2238
|
-
self.hourElement.focus();
|
|
2239
|
-
break;
|
|
2240
|
-
case 38:
|
|
2241
|
-
case 40:
|
|
2242
|
-
e.preventDefault();
|
|
2243
|
-
var delta = e.keyCode === 40 ? 1 : -1;
|
|
2244
|
-
if ((self.daysContainer &&
|
|
2245
|
-
eventTarget.$i !== undefined) ||
|
|
2246
|
-
eventTarget === self.input ||
|
|
2247
|
-
eventTarget === self.altInput) {
|
|
2248
|
-
if (e.ctrlKey) {
|
|
2249
|
-
e.stopPropagation();
|
|
2250
|
-
changeYear(self.currentYear - delta);
|
|
2251
|
-
focusOnDay(getFirstAvailableDay(1), 0);
|
|
2252
|
-
}
|
|
2253
|
-
else if (!isTimeObj)
|
|
2254
|
-
focusOnDay(undefined, delta * 7);
|
|
2255
|
-
}
|
|
2256
|
-
else if (eventTarget === self.currentYearElement) {
|
|
2257
|
-
changeYear(self.currentYear - delta);
|
|
2258
|
-
}
|
|
2259
|
-
else if (self.config.enableTime) {
|
|
2260
|
-
if (!isTimeObj && self.hourElement)
|
|
2261
|
-
self.hourElement.focus();
|
|
2262
|
-
updateTime(e);
|
|
2263
|
-
self._debouncedChange();
|
|
2264
|
-
}
|
|
2265
|
-
break;
|
|
2266
|
-
case 9:
|
|
2267
|
-
if (isTimeObj) {
|
|
2268
|
-
var elems = [
|
|
2269
|
-
self.hourElement,
|
|
2270
|
-
self.minuteElement,
|
|
2271
|
-
self.secondElement,
|
|
2272
|
-
self.amPM,
|
|
2273
|
-
]
|
|
2274
|
-
.concat(self.pluginElements)
|
|
2275
|
-
.filter(function (x) { return x; });
|
|
2276
|
-
var i = elems.indexOf(eventTarget);
|
|
2277
|
-
if (i !== -1) {
|
|
2278
|
-
var target = elems[i + (e.shiftKey ? -1 : 1)];
|
|
2279
|
-
e.preventDefault();
|
|
2280
|
-
(target || self._input).focus();
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
else if (!self.config.noCalendar &&
|
|
2284
|
-
self.daysContainer &&
|
|
2285
|
-
self.daysContainer.contains(eventTarget) &&
|
|
2286
|
-
e.shiftKey) {
|
|
2287
|
-
e.preventDefault();
|
|
2288
|
-
self._input.focus();
|
|
2289
|
-
}
|
|
2290
|
-
break;
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
if (self.amPM !== undefined && eventTarget === self.amPM) {
|
|
2294
|
-
switch (e.key) {
|
|
2295
|
-
case self.l10n.amPM[0].charAt(0):
|
|
2296
|
-
case self.l10n.amPM[0].charAt(0).toLowerCase():
|
|
2297
|
-
self.amPM.textContent = self.l10n.amPM[0];
|
|
2298
|
-
setHoursFromInputs();
|
|
2299
|
-
updateValue();
|
|
2300
|
-
break;
|
|
2301
|
-
case self.l10n.amPM[1].charAt(0):
|
|
2302
|
-
case self.l10n.amPM[1].charAt(0).toLowerCase():
|
|
2303
|
-
self.amPM.textContent = self.l10n.amPM[1];
|
|
2304
|
-
setHoursFromInputs();
|
|
2305
|
-
updateValue();
|
|
2306
|
-
break;
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
if (isInput || isCalendarElem(eventTarget)) {
|
|
2310
|
-
triggerEvent("onKeyDown", e);
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
function onMouseOver(elem, cellClass) {
|
|
2314
|
-
if (cellClass === void 0) { cellClass = "flatpickr-day"; }
|
|
2315
|
-
if (self.selectedDates.length !== 1 ||
|
|
2316
|
-
(elem &&
|
|
2317
|
-
(!elem.classList.contains(cellClass) ||
|
|
2318
|
-
elem.classList.contains("flatpickr-disabled"))))
|
|
2319
|
-
return;
|
|
2320
|
-
var hoverDate = elem
|
|
2321
|
-
? elem.dateObj.getTime()
|
|
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());
|
|
2323
|
-
var containsDisabled = false;
|
|
2324
|
-
var minRange = 0, maxRange = 0;
|
|
2325
|
-
for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
|
|
2326
|
-
if (!isEnabled(new Date(t), true)) {
|
|
2327
|
-
containsDisabled =
|
|
2328
|
-
containsDisabled || (t > rangeStartDate && t < rangeEndDate);
|
|
2329
|
-
if (t < initialDate && (!minRange || t > minRange))
|
|
2330
|
-
minRange = t;
|
|
2331
|
-
else if (t > initialDate && (!maxRange || t < maxRange))
|
|
2332
|
-
maxRange = t;
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
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) {
|
|
2344
|
-
dayElem.classList.remove(c);
|
|
2345
|
-
});
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
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
|
-
});
|
|
2367
|
-
}
|
|
2368
|
-
function onResize() {
|
|
2369
|
-
if (self.isOpen && !self.config.static && !self.config.inline)
|
|
2370
|
-
positionCalendar();
|
|
2371
|
-
}
|
|
2372
|
-
function open(e, positionElement) {
|
|
2373
|
-
if (positionElement === void 0) { positionElement = self._positionElement; }
|
|
2374
|
-
if (self.isMobile === true) {
|
|
2375
|
-
if (e) {
|
|
2376
|
-
e.preventDefault();
|
|
2377
|
-
var eventTarget = getEventTarget(e);
|
|
2378
|
-
if (eventTarget) {
|
|
2379
|
-
eventTarget.blur();
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
if (self.mobileInput !== undefined) {
|
|
2383
|
-
self.mobileInput.focus();
|
|
2384
|
-
self.mobileInput.click();
|
|
2385
|
-
}
|
|
2386
|
-
triggerEvent("onOpen");
|
|
2387
|
-
return;
|
|
2388
|
-
}
|
|
2389
|
-
else if (self._input.disabled || self.config.inline) {
|
|
2390
|
-
return;
|
|
2391
|
-
}
|
|
2392
|
-
var wasOpen = self.isOpen;
|
|
2393
|
-
self.isOpen = true;
|
|
2394
|
-
if (!wasOpen) {
|
|
2395
|
-
self.calendarContainer.classList.add("open");
|
|
2396
|
-
self._input.classList.add("active");
|
|
2397
|
-
triggerEvent("onOpen");
|
|
2398
|
-
positionCalendar(positionElement);
|
|
2399
|
-
}
|
|
2400
|
-
if (self.config.enableTime === true && self.config.noCalendar === true) {
|
|
2401
|
-
if (self.config.allowInput === false &&
|
|
2402
|
-
(e === undefined ||
|
|
2403
|
-
!self.timeContainer.contains(e.relatedTarget))) {
|
|
2404
|
-
setTimeout(function () { return self.hourElement.select(); }, 50);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
function minMaxDateSetter(type) {
|
|
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"];
|
|
2412
|
-
if (dateObj !== undefined) {
|
|
2413
|
-
self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
|
|
2414
|
-
dateObj.getHours() > 0 ||
|
|
2415
|
-
dateObj.getMinutes() > 0 ||
|
|
2416
|
-
dateObj.getSeconds() > 0;
|
|
2417
|
-
}
|
|
2418
|
-
if (self.selectedDates) {
|
|
2419
|
-
self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
|
|
2420
|
-
if (!self.selectedDates.length && type === "min")
|
|
2421
|
-
setHoursFromDate(dateObj);
|
|
2422
|
-
updateValue();
|
|
2423
|
-
}
|
|
2424
|
-
if (self.daysContainer) {
|
|
2425
|
-
redraw();
|
|
2426
|
-
if (dateObj !== undefined)
|
|
2427
|
-
self.currentYearElement[type] = dateObj.getFullYear().toString();
|
|
2428
|
-
else
|
|
2429
|
-
self.currentYearElement.removeAttribute(type);
|
|
2430
|
-
self.currentYearElement.disabled =
|
|
2431
|
-
!!inverseDateObj &&
|
|
2432
|
-
dateObj !== undefined &&
|
|
2433
|
-
inverseDateObj.getFullYear() === dateObj.getFullYear();
|
|
2434
|
-
}
|
|
2435
|
-
};
|
|
2436
|
-
}
|
|
2437
|
-
function parseConfig() {
|
|
2438
|
-
var boolOpts = [
|
|
2439
|
-
"wrap",
|
|
2440
|
-
"weekNumbers",
|
|
2441
|
-
"allowInput",
|
|
2442
|
-
"allowInvalidPreload",
|
|
2443
|
-
"clickOpens",
|
|
2444
|
-
"time_24hr",
|
|
2445
|
-
"enableTime",
|
|
2446
|
-
"noCalendar",
|
|
2447
|
-
"altInput",
|
|
2448
|
-
"shorthandCurrentMonth",
|
|
2449
|
-
"inline",
|
|
2450
|
-
"static",
|
|
2451
|
-
"enableSeconds",
|
|
2452
|
-
"disableMobile",
|
|
2453
|
-
];
|
|
2454
|
-
var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);
|
|
2455
|
-
var formats = {};
|
|
2456
|
-
self.config.parseDate = userConfig.parseDate;
|
|
2457
|
-
self.config.formatDate = userConfig.formatDate;
|
|
2458
|
-
Object.defineProperty(self.config, "enable", {
|
|
2459
|
-
get: function () { return self.config._enable; },
|
|
2460
|
-
set: function (dates) {
|
|
2461
|
-
self.config._enable = parseDateRules(dates);
|
|
2462
|
-
},
|
|
2463
|
-
});
|
|
2464
|
-
Object.defineProperty(self.config, "disable", {
|
|
2465
|
-
get: function () { return self.config._disable; },
|
|
2466
|
-
set: function (dates) {
|
|
2467
|
-
self.config._disable = parseDateRules(dates);
|
|
2468
|
-
},
|
|
2469
|
-
});
|
|
2470
|
-
var timeMode = userConfig.mode === "time";
|
|
2471
|
-
if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
|
|
2472
|
-
var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
|
|
2473
|
-
formats.dateFormat =
|
|
2474
|
-
userConfig.noCalendar || timeMode
|
|
2475
|
-
? "H:i" + (userConfig.enableSeconds ? ":S" : "")
|
|
2476
|
-
: defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
|
|
2477
|
-
}
|
|
2478
|
-
if (userConfig.altInput &&
|
|
2479
|
-
(userConfig.enableTime || timeMode) &&
|
|
2480
|
-
!userConfig.altFormat) {
|
|
2481
|
-
var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
|
|
2482
|
-
formats.altFormat =
|
|
2483
|
-
userConfig.noCalendar || timeMode
|
|
2484
|
-
? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
|
|
2485
|
-
: defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
|
|
2486
|
-
}
|
|
2487
|
-
Object.defineProperty(self.config, "minDate", {
|
|
2488
|
-
get: function () { return self.config._minDate; },
|
|
2489
|
-
set: minMaxDateSetter("min"),
|
|
2490
|
-
});
|
|
2491
|
-
Object.defineProperty(self.config, "maxDate", {
|
|
2492
|
-
get: function () { return self.config._maxDate; },
|
|
2493
|
-
set: minMaxDateSetter("max"),
|
|
2494
|
-
});
|
|
2495
|
-
var minMaxTimeSetter = function (type) { return function (val) {
|
|
2496
|
-
self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
|
|
2497
|
-
}; };
|
|
2498
|
-
Object.defineProperty(self.config, "minTime", {
|
|
2499
|
-
get: function () { return self.config._minTime; },
|
|
2500
|
-
set: minMaxTimeSetter("min"),
|
|
2501
|
-
});
|
|
2502
|
-
Object.defineProperty(self.config, "maxTime", {
|
|
2503
|
-
get: function () { return self.config._maxTime; },
|
|
2504
|
-
set: minMaxTimeSetter("max"),
|
|
2505
|
-
});
|
|
2506
|
-
if (userConfig.mode === "time") {
|
|
2507
|
-
self.config.noCalendar = true;
|
|
2508
|
-
self.config.enableTime = true;
|
|
2509
|
-
}
|
|
2510
|
-
Object.assign(self.config, formats, userConfig);
|
|
2511
|
-
for (var i = 0; i < boolOpts.length; i++)
|
|
2512
|
-
self.config[boolOpts[i]] =
|
|
2513
|
-
self.config[boolOpts[i]] === true ||
|
|
2514
|
-
self.config[boolOpts[i]] === "true";
|
|
2515
|
-
HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
|
|
2516
|
-
self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
|
|
2517
|
-
});
|
|
2518
|
-
self.isMobile =
|
|
2519
|
-
!self.config.disableMobile &&
|
|
2520
|
-
!self.config.inline &&
|
|
2521
|
-
self.config.mode === "single" &&
|
|
2522
|
-
!self.config.disable.length &&
|
|
2523
|
-
!self.config.enable &&
|
|
2524
|
-
!self.config.weekNumbers &&
|
|
2525
|
-
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
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) {
|
|
2529
|
-
if (HOOKS.indexOf(key) > -1) {
|
|
2530
|
-
self.config[key] = arrayify(pluginConf[key])
|
|
2531
|
-
.map(bindToInstance)
|
|
2532
|
-
.concat(self.config[key]);
|
|
2533
|
-
}
|
|
2534
|
-
else if (typeof userConfig[key] === "undefined")
|
|
2535
|
-
self.config[key] = pluginConf[key];
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
if (!userConfig.altInputClass) {
|
|
2539
|
-
self.config.altInputClass =
|
|
2540
|
-
getInputElem().className + " " + self.config.altInputClass;
|
|
2541
|
-
}
|
|
2542
|
-
triggerEvent("onParseConfig");
|
|
2543
|
-
}
|
|
2544
|
-
function getInputElem() {
|
|
2545
|
-
return self.config.wrap
|
|
2546
|
-
? element.querySelector("[data-input]")
|
|
2547
|
-
: element;
|
|
2548
|
-
}
|
|
2549
|
-
function setupLocale() {
|
|
2550
|
-
if (typeof self.config.locale !== "object" &&
|
|
2551
|
-
typeof flatpickr.l10ns[self.config.locale] === "undefined")
|
|
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"
|
|
2554
|
-
? self.config.locale
|
|
2555
|
-
: self.config.locale !== "default"
|
|
2556
|
-
? flatpickr.l10ns[self.config.locale]
|
|
2557
|
-
: undefined));
|
|
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 || {})));
|
|
2564
|
-
if (userConfig.time_24hr === undefined &&
|
|
2565
|
-
flatpickr.defaultConfig.time_24hr === undefined) {
|
|
2566
|
-
self.config.time_24hr = self.l10n.time_24hr;
|
|
2567
|
-
}
|
|
2568
|
-
self.formatDate = createDateFormatter(self);
|
|
2569
|
-
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
|
|
2570
|
-
}
|
|
2571
|
-
function positionCalendar(customPositionElement) {
|
|
2572
|
-
if (typeof self.config.position === "function") {
|
|
2573
|
-
return void self.config.position(self, customPositionElement);
|
|
2574
|
-
}
|
|
2575
|
-
if (self.calendarContainer === undefined)
|
|
2576
|
-
return;
|
|
2577
|
-
triggerEvent("onPreCalendarPosition");
|
|
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" ||
|
|
2580
|
-
(configPosVertical !== "below" &&
|
|
2581
|
-
distanceFromBottom < calendarHeight &&
|
|
2582
|
-
inputBounds.top > calendarHeight);
|
|
2583
|
-
var top = window.pageYOffset +
|
|
2584
|
-
inputBounds.top +
|
|
2585
|
-
(!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
|
|
2586
|
-
toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
|
|
2587
|
-
toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
|
|
2588
|
-
if (self.config.inline)
|
|
2589
|
-
return;
|
|
2590
|
-
var left = window.pageXOffset + inputBounds.left;
|
|
2591
|
-
var isCenter = false;
|
|
2592
|
-
var isRight = false;
|
|
2593
|
-
if (configPosHorizontal === "center") {
|
|
2594
|
-
left -= (calendarWidth - inputBounds.width) / 2;
|
|
2595
|
-
isCenter = true;
|
|
2596
|
-
}
|
|
2597
|
-
else if (configPosHorizontal === "right") {
|
|
2598
|
-
left -= calendarWidth - inputBounds.width;
|
|
2599
|
-
isRight = true;
|
|
2600
|
-
}
|
|
2601
|
-
toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight);
|
|
2602
|
-
toggleClass(self.calendarContainer, "arrowCenter", isCenter);
|
|
2603
|
-
toggleClass(self.calendarContainer, "arrowRight", isRight);
|
|
2604
|
-
var right = window.document.body.offsetWidth -
|
|
2605
|
-
(window.pageXOffset + inputBounds.right);
|
|
2606
|
-
var rightMost = left + calendarWidth > window.document.body.offsetWidth;
|
|
2607
|
-
var centerMost = right + calendarWidth > window.document.body.offsetWidth;
|
|
2608
|
-
toggleClass(self.calendarContainer, "rightMost", rightMost);
|
|
2609
|
-
if (self.config.static)
|
|
2610
|
-
return;
|
|
2611
|
-
self.calendarContainer.style.top = top + "px";
|
|
2612
|
-
if (!rightMost) {
|
|
2613
|
-
self.calendarContainer.style.left = left + "px";
|
|
2614
|
-
self.calendarContainer.style.right = "auto";
|
|
2615
|
-
}
|
|
2616
|
-
else if (!centerMost) {
|
|
2617
|
-
self.calendarContainer.style.left = "auto";
|
|
2618
|
-
self.calendarContainer.style.right = right + "px";
|
|
2619
|
-
}
|
|
2620
|
-
else {
|
|
2621
|
-
var doc = getDocumentStyleSheet();
|
|
2622
|
-
if (doc === undefined)
|
|
2623
|
-
return;
|
|
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;}";
|
|
2630
|
-
toggleClass(self.calendarContainer, "rightMost", false);
|
|
2631
|
-
toggleClass(self.calendarContainer, "centerMost", true);
|
|
2632
|
-
doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
|
|
2633
|
-
self.calendarContainer.style.left = centerLeft + "px";
|
|
2634
|
-
self.calendarContainer.style.right = "auto";
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
function getDocumentStyleSheet() {
|
|
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;
|
|
2643
|
-
editableSheet = sheet;
|
|
2644
|
-
break;
|
|
2645
|
-
}
|
|
2646
|
-
return editableSheet != null ? editableSheet : createStyleSheet();
|
|
2647
|
-
}
|
|
2648
|
-
function createStyleSheet() {
|
|
2649
|
-
var style = document.createElement("style");
|
|
2650
|
-
document.head.appendChild(style);
|
|
2651
|
-
return style.sheet;
|
|
2652
|
-
}
|
|
2653
|
-
function redraw() {
|
|
2654
|
-
if (self.config.noCalendar || self.isMobile)
|
|
2655
|
-
return;
|
|
2656
|
-
buildMonthSwitch();
|
|
2657
|
-
updateNavigationCurrentMonth();
|
|
2658
|
-
buildDays();
|
|
2659
|
-
}
|
|
2660
|
-
function focusAndClose() {
|
|
2661
|
-
self._input.focus();
|
|
2662
|
-
if (window.navigator.userAgent.indexOf("MSIE") !== -1 ||
|
|
2663
|
-
navigator.msMaxTouchPoints !== undefined) {
|
|
2664
|
-
setTimeout(self.close, 0);
|
|
2665
|
-
}
|
|
2666
|
-
else {
|
|
2667
|
-
self.close();
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
function selectDate(e) {
|
|
2671
|
-
e.preventDefault();
|
|
2672
|
-
e.stopPropagation();
|
|
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);
|
|
2680
|
-
if (t === undefined)
|
|
2681
|
-
return;
|
|
2682
|
-
var target = t;
|
|
2683
|
-
var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
|
|
2684
|
-
var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
|
|
2685
|
-
selectedDate.getMonth() >
|
|
2686
|
-
self.currentMonth + self.config.showMonths - 1) &&
|
|
2687
|
-
self.config.mode !== "range";
|
|
2688
|
-
self.selectedDateElem = target;
|
|
2689
|
-
if (self.config.mode === "single")
|
|
2690
|
-
self.selectedDates = [selectedDate];
|
|
2691
|
-
else if (self.config.mode === "multiple") {
|
|
2692
|
-
var selectedIndex = isDateSelected(selectedDate);
|
|
2693
|
-
if (selectedIndex)
|
|
2694
|
-
self.selectedDates.splice(parseInt(selectedIndex), 1);
|
|
2695
|
-
else
|
|
2696
|
-
self.selectedDates.push(selectedDate);
|
|
2697
|
-
}
|
|
2698
|
-
else if (self.config.mode === "range") {
|
|
2699
|
-
if (self.selectedDates.length === 2) {
|
|
2700
|
-
self.clear(false, false);
|
|
2701
|
-
}
|
|
2702
|
-
self.latestSelectedDateObj = selectedDate;
|
|
2703
|
-
self.selectedDates.push(selectedDate);
|
|
2704
|
-
if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
|
|
2705
|
-
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
|
|
2706
|
-
}
|
|
2707
|
-
setHoursFromInputs();
|
|
2708
|
-
if (shouldChangeMonth) {
|
|
2709
|
-
var isNewYear = self.currentYear !== selectedDate.getFullYear();
|
|
2710
|
-
self.currentYear = selectedDate.getFullYear();
|
|
2711
|
-
self.currentMonth = selectedDate.getMonth();
|
|
2712
|
-
if (isNewYear) {
|
|
2713
|
-
triggerEvent("onYearChange");
|
|
2714
|
-
buildMonthSwitch();
|
|
2715
|
-
}
|
|
2716
|
-
triggerEvent("onMonthChange");
|
|
2717
|
-
}
|
|
2718
|
-
updateNavigationCurrentMonth();
|
|
2719
|
-
buildDays();
|
|
2720
|
-
updateValue();
|
|
2721
|
-
if (!shouldChangeMonth &&
|
|
2722
|
-
self.config.mode !== "range" &&
|
|
2723
|
-
self.config.showMonths === 1)
|
|
2724
|
-
focusOnDayElem(target);
|
|
2725
|
-
else if (self.selectedDateElem !== undefined &&
|
|
2726
|
-
self.hourElement === undefined) {
|
|
2727
|
-
self.selectedDateElem && self.selectedDateElem.focus();
|
|
2728
|
-
}
|
|
2729
|
-
if (self.hourElement !== undefined)
|
|
2730
|
-
self.hourElement !== undefined && self.hourElement.focus();
|
|
2731
|
-
if (self.config.closeOnSelect) {
|
|
2732
|
-
var single = self.config.mode === "single" && !self.config.enableTime;
|
|
2733
|
-
var range = self.config.mode === "range" &&
|
|
2734
|
-
self.selectedDates.length === 2 &&
|
|
2735
|
-
!self.config.enableTime;
|
|
2736
|
-
if (single || range) {
|
|
2737
|
-
focusAndClose();
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
triggerChange();
|
|
2741
|
-
}
|
|
2742
|
-
var CALLBACKS = {
|
|
2743
|
-
locale: [setupLocale, updateWeekdays],
|
|
2744
|
-
showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
|
|
2745
|
-
minDate: [jumpToDate],
|
|
2746
|
-
maxDate: [jumpToDate],
|
|
2747
|
-
positionElement: [updatePositionElement],
|
|
2748
|
-
clickOpens: [
|
|
2749
|
-
function () {
|
|
2750
|
-
if (self.config.clickOpens === true) {
|
|
2751
|
-
bind(self._input, "focus", self.open);
|
|
2752
|
-
bind(self._input, "click", self.open);
|
|
2753
|
-
}
|
|
2754
|
-
else {
|
|
2755
|
-
self._input.removeEventListener("focus", self.open);
|
|
2756
|
-
self._input.removeEventListener("click", self.open);
|
|
2757
|
-
}
|
|
2758
|
-
},
|
|
2759
|
-
],
|
|
2760
|
-
};
|
|
2761
|
-
function set(option, value) {
|
|
2762
|
-
if (option !== null && typeof option === "object") {
|
|
2763
|
-
Object.assign(self.config, option);
|
|
2764
|
-
for (var key in option) {
|
|
2765
|
-
if (CALLBACKS[key] !== undefined)
|
|
2766
|
-
CALLBACKS[key].forEach(function (x) { return x(); });
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
else {
|
|
2770
|
-
self.config[option] = value;
|
|
2771
|
-
if (CALLBACKS[option] !== undefined)
|
|
2772
|
-
CALLBACKS[option].forEach(function (x) { return x(); });
|
|
2773
|
-
else if (HOOKS.indexOf(option) > -1)
|
|
2774
|
-
self.config[option] = arrayify(value);
|
|
2775
|
-
}
|
|
2776
|
-
self.redraw();
|
|
2777
|
-
updateValue(true);
|
|
2778
|
-
}
|
|
2779
|
-
function setSelectedDate(inputDate, format) {
|
|
2780
|
-
var dates = [];
|
|
2781
|
-
if (inputDate instanceof Array)
|
|
2782
|
-
dates = inputDate.map(function (d) { return self.parseDate(d, format); });
|
|
2783
|
-
else if (inputDate instanceof Date || typeof inputDate === "number")
|
|
2784
|
-
dates = [self.parseDate(inputDate, format)];
|
|
2785
|
-
else if (typeof inputDate === "string") {
|
|
2786
|
-
switch (self.config.mode) {
|
|
2787
|
-
case "single":
|
|
2788
|
-
case "time":
|
|
2789
|
-
dates = [self.parseDate(inputDate, format)];
|
|
2790
|
-
break;
|
|
2791
|
-
case "multiple":
|
|
2792
|
-
dates = inputDate
|
|
2793
|
-
.split(self.config.conjunction)
|
|
2794
|
-
.map(function (date) { return self.parseDate(date, format); });
|
|
2795
|
-
break;
|
|
2796
|
-
case "range":
|
|
2797
|
-
dates = inputDate
|
|
2798
|
-
.split(self.l10n.rangeSeparator)
|
|
2799
|
-
.map(function (date) { return self.parseDate(date, format); });
|
|
2800
|
-
break;
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
else
|
|
2804
|
-
self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
|
|
2805
|
-
self.selectedDates = (self.config.allowInvalidPreload
|
|
2806
|
-
? dates
|
|
2807
|
-
: dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));
|
|
2808
|
-
if (self.config.mode === "range")
|
|
2809
|
-
self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
|
|
2810
|
-
}
|
|
2811
|
-
function setDate(date, triggerChange, format) {
|
|
2812
|
-
if (triggerChange === void 0) { triggerChange = false; }
|
|
2813
|
-
if (format === void 0) { format = self.config.dateFormat; }
|
|
2814
|
-
if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
|
|
2815
|
-
return self.clear(triggerChange);
|
|
2816
|
-
setSelectedDate(date, format);
|
|
2817
|
-
self.latestSelectedDateObj =
|
|
2818
|
-
self.selectedDates[self.selectedDates.length - 1];
|
|
2819
|
-
self.redraw();
|
|
2820
|
-
jumpToDate(undefined, triggerChange);
|
|
2821
|
-
setHoursFromDate();
|
|
2822
|
-
if (self.selectedDates.length === 0) {
|
|
2823
|
-
self.clear(false);
|
|
2824
|
-
}
|
|
2825
|
-
updateValue(triggerChange);
|
|
2826
|
-
if (triggerChange)
|
|
2827
|
-
triggerEvent("onChange");
|
|
2828
|
-
}
|
|
2829
|
-
function parseDateRules(arr) {
|
|
2830
|
-
return arr
|
|
2831
|
-
.slice()
|
|
2832
|
-
.map(function (rule) {
|
|
2833
|
-
if (typeof rule === "string" ||
|
|
2834
|
-
typeof rule === "number" ||
|
|
2835
|
-
rule instanceof Date) {
|
|
2836
|
-
return self.parseDate(rule, undefined, true);
|
|
2837
|
-
}
|
|
2838
|
-
else if (rule &&
|
|
2839
|
-
typeof rule === "object" &&
|
|
2840
|
-
rule.from &&
|
|
2841
|
-
rule.to)
|
|
2842
|
-
return {
|
|
2843
|
-
from: self.parseDate(rule.from, undefined),
|
|
2844
|
-
to: self.parseDate(rule.to, undefined),
|
|
2845
|
-
};
|
|
2846
|
-
return rule;
|
|
2847
|
-
})
|
|
2848
|
-
.filter(function (x) { return x; });
|
|
2849
|
-
}
|
|
2850
|
-
function setupDates() {
|
|
2851
|
-
self.selectedDates = [];
|
|
2852
|
-
self.now = self.parseDate(self.config.now) || new Date();
|
|
2853
|
-
var preloadedDate = self.config.defaultDate ||
|
|
2854
|
-
((self.input.nodeName === "INPUT" ||
|
|
2855
|
-
self.input.nodeName === "TEXTAREA") &&
|
|
2856
|
-
self.input.placeholder &&
|
|
2857
|
-
self.input.value === self.input.placeholder
|
|
2858
|
-
? null
|
|
2859
|
-
: self.input.value);
|
|
2860
|
-
if (preloadedDate)
|
|
2861
|
-
setSelectedDate(preloadedDate, self.config.dateFormat);
|
|
2862
|
-
self._initialDate =
|
|
2863
|
-
self.selectedDates.length > 0
|
|
2864
|
-
? self.selectedDates[0]
|
|
2865
|
-
: self.config.minDate &&
|
|
2866
|
-
self.config.minDate.getTime() > self.now.getTime()
|
|
2867
|
-
? self.config.minDate
|
|
2868
|
-
: self.config.maxDate &&
|
|
2869
|
-
self.config.maxDate.getTime() < self.now.getTime()
|
|
2870
|
-
? self.config.maxDate
|
|
2871
|
-
: self.now;
|
|
2872
|
-
self.currentYear = self._initialDate.getFullYear();
|
|
2873
|
-
self.currentMonth = self._initialDate.getMonth();
|
|
2874
|
-
if (self.selectedDates.length > 0)
|
|
2875
|
-
self.latestSelectedDateObj = self.selectedDates[0];
|
|
2876
|
-
if (self.config.minTime !== undefined)
|
|
2877
|
-
self.config.minTime = self.parseDate(self.config.minTime, "H:i");
|
|
2878
|
-
if (self.config.maxTime !== undefined)
|
|
2879
|
-
self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
|
|
2880
|
-
self.minDateHasTime =
|
|
2881
|
-
!!self.config.minDate &&
|
|
2882
|
-
(self.config.minDate.getHours() > 0 ||
|
|
2883
|
-
self.config.minDate.getMinutes() > 0 ||
|
|
2884
|
-
self.config.minDate.getSeconds() > 0);
|
|
2885
|
-
self.maxDateHasTime =
|
|
2886
|
-
!!self.config.maxDate &&
|
|
2887
|
-
(self.config.maxDate.getHours() > 0 ||
|
|
2888
|
-
self.config.maxDate.getMinutes() > 0 ||
|
|
2889
|
-
self.config.maxDate.getSeconds() > 0);
|
|
2890
|
-
}
|
|
2891
|
-
function setupInputs() {
|
|
2892
|
-
self.input = getInputElem();
|
|
2893
|
-
if (!self.input) {
|
|
2894
|
-
self.config.errorHandler(new Error("Invalid input element specified"));
|
|
2895
|
-
return;
|
|
2896
|
-
}
|
|
2897
|
-
self.input._type = self.input.type;
|
|
2898
|
-
self.input.type = "text";
|
|
2899
|
-
self.input.classList.add("flatpickr-input");
|
|
2900
|
-
self._input = self.input;
|
|
2901
|
-
if (self.config.altInput) {
|
|
2902
|
-
self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
|
|
2903
|
-
self._input = self.altInput;
|
|
2904
|
-
self.altInput.placeholder = self.input.placeholder;
|
|
2905
|
-
self.altInput.disabled = self.input.disabled;
|
|
2906
|
-
self.altInput.required = self.input.required;
|
|
2907
|
-
self.altInput.tabIndex = self.input.tabIndex;
|
|
2908
|
-
self.altInput.type = "text";
|
|
2909
|
-
self.input.setAttribute("type", "hidden");
|
|
2910
|
-
if (!self.config.static && self.input.parentNode)
|
|
2911
|
-
self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
|
|
2912
|
-
}
|
|
2913
|
-
if (!self.config.allowInput)
|
|
2914
|
-
self._input.setAttribute("readonly", "readonly");
|
|
2915
|
-
updatePositionElement();
|
|
2916
|
-
}
|
|
2917
|
-
function updatePositionElement() {
|
|
2918
|
-
self._positionElement = self.config.positionElement || self._input;
|
|
2919
|
-
}
|
|
2920
|
-
function setupMobile() {
|
|
2921
|
-
var inputType = self.config.enableTime
|
|
2922
|
-
? self.config.noCalendar
|
|
2923
|
-
? "time"
|
|
2924
|
-
: "datetime-local"
|
|
2925
|
-
: "date";
|
|
2926
|
-
self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
|
|
2927
|
-
self.mobileInput.tabIndex = 1;
|
|
2928
|
-
self.mobileInput.type = inputType;
|
|
2929
|
-
self.mobileInput.disabled = self.input.disabled;
|
|
2930
|
-
self.mobileInput.required = self.input.required;
|
|
2931
|
-
self.mobileInput.placeholder = self.input.placeholder;
|
|
2932
|
-
self.mobileFormatStr =
|
|
2933
|
-
inputType === "datetime-local"
|
|
2934
|
-
? "Y-m-d\\TH:i:S"
|
|
2935
|
-
: inputType === "date"
|
|
2936
|
-
? "Y-m-d"
|
|
2937
|
-
: "H:i:S";
|
|
2938
|
-
if (self.selectedDates.length > 0) {
|
|
2939
|
-
self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
|
|
2940
|
-
}
|
|
2941
|
-
if (self.config.minDate)
|
|
2942
|
-
self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
|
|
2943
|
-
if (self.config.maxDate)
|
|
2944
|
-
self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
|
|
2945
|
-
if (self.input.getAttribute("step"))
|
|
2946
|
-
self.mobileInput.step = String(self.input.getAttribute("step"));
|
|
2947
|
-
self.input.type = "hidden";
|
|
2948
|
-
if (self.altInput !== undefined)
|
|
2949
|
-
self.altInput.type = "hidden";
|
|
2950
|
-
try {
|
|
2951
|
-
if (self.input.parentNode)
|
|
2952
|
-
self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
|
|
2953
|
-
}
|
|
2954
|
-
catch (_a) { }
|
|
2955
|
-
bind(self.mobileInput, "change", function (e) {
|
|
2956
|
-
self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);
|
|
2957
|
-
triggerEvent("onChange");
|
|
2958
|
-
triggerEvent("onClose");
|
|
2959
|
-
});
|
|
2960
|
-
}
|
|
2961
|
-
function toggle(e) {
|
|
2962
|
-
if (self.isOpen === true)
|
|
2963
|
-
return self.close();
|
|
2964
|
-
self.open(e);
|
|
2965
|
-
}
|
|
2966
|
-
function triggerEvent(event, data) {
|
|
2967
|
-
if (self.config === undefined)
|
|
2968
|
-
return;
|
|
2969
|
-
var hooks = self.config[event];
|
|
2970
|
-
if (hooks !== undefined && hooks.length > 0) {
|
|
2971
|
-
for (var i = 0; hooks[i] && i < hooks.length; i++)
|
|
2972
|
-
hooks[i](self.selectedDates, self.input.value, self, data);
|
|
2973
|
-
}
|
|
2974
|
-
if (event === "onChange") {
|
|
2975
|
-
self.input.dispatchEvent(createEvent("change"));
|
|
2976
|
-
self.input.dispatchEvent(createEvent("input"));
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
function createEvent(name) {
|
|
2980
|
-
var e = document.createEvent("Event");
|
|
2981
|
-
e.initEvent(name, true, true);
|
|
2982
|
-
return e;
|
|
2983
|
-
}
|
|
2984
|
-
function isDateSelected(date) {
|
|
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)
|
|
2989
|
-
return "" + i;
|
|
2990
|
-
}
|
|
2991
|
-
return false;
|
|
2992
|
-
}
|
|
2993
|
-
function isDateInRange(date) {
|
|
2994
|
-
if (self.config.mode !== "range" || self.selectedDates.length < 2)
|
|
2995
|
-
return false;
|
|
2996
|
-
return (compareDates(date, self.selectedDates[0]) >= 0 &&
|
|
2997
|
-
compareDates(date, self.selectedDates[1]) <= 0);
|
|
2998
|
-
}
|
|
2999
|
-
function updateNavigationCurrentMonth() {
|
|
3000
|
-
if (self.config.noCalendar || self.isMobile || !self.monthNav)
|
|
3001
|
-
return;
|
|
3002
|
-
self.yearElements.forEach(function (yearElement, i) {
|
|
3003
|
-
var d = new Date(self.currentYear, self.currentMonth, 1);
|
|
3004
|
-
d.setMonth(self.currentMonth + i);
|
|
3005
|
-
if (self.config.showMonths > 1 ||
|
|
3006
|
-
self.config.monthSelectorType === "static") {
|
|
3007
|
-
self.monthElements[i].textContent =
|
|
3008
|
-
monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
|
|
3009
|
-
}
|
|
3010
|
-
else {
|
|
3011
|
-
self.monthsDropdownContainer.value = d.getMonth().toString();
|
|
3012
|
-
}
|
|
3013
|
-
yearElement.value = d.getFullYear().toString();
|
|
3014
|
-
});
|
|
3015
|
-
self._hidePrevMonthArrow =
|
|
3016
|
-
self.config.minDate !== undefined &&
|
|
3017
|
-
(self.currentYear === self.config.minDate.getFullYear()
|
|
3018
|
-
? self.currentMonth <= self.config.minDate.getMonth()
|
|
3019
|
-
: self.currentYear < self.config.minDate.getFullYear());
|
|
3020
|
-
self._hideNextMonthArrow =
|
|
3021
|
-
self.config.maxDate !== undefined &&
|
|
3022
|
-
(self.currentYear === self.config.maxDate.getFullYear()
|
|
3023
|
-
? self.currentMonth + 1 > self.config.maxDate.getMonth()
|
|
3024
|
-
: self.currentYear > self.config.maxDate.getFullYear());
|
|
3025
|
-
}
|
|
3026
|
-
function getDateStr(specificFormat) {
|
|
3027
|
-
var format = specificFormat ||
|
|
3028
|
-
(self.config.altInput ? self.config.altFormat : self.config.dateFormat);
|
|
3029
|
-
return self.selectedDates
|
|
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
|
-
})
|
|
3036
|
-
.join(self.config.mode !== "range"
|
|
3037
|
-
? self.config.conjunction
|
|
3038
|
-
: self.l10n.rangeSeparator);
|
|
3039
|
-
}
|
|
3040
|
-
function updateValue(triggerChange) {
|
|
3041
|
-
if (triggerChange === void 0) { triggerChange = true; }
|
|
3042
|
-
if (self.mobileInput !== undefined && self.mobileFormatStr) {
|
|
3043
|
-
self.mobileInput.value =
|
|
3044
|
-
self.latestSelectedDateObj !== undefined
|
|
3045
|
-
? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)
|
|
3046
|
-
: "";
|
|
3047
|
-
}
|
|
3048
|
-
self.input.value = getDateStr(self.config.dateFormat);
|
|
3049
|
-
if (self.altInput !== undefined) {
|
|
3050
|
-
self.altInput.value = getDateStr(self.config.altFormat);
|
|
3051
|
-
}
|
|
3052
|
-
if (triggerChange !== false)
|
|
3053
|
-
triggerEvent("onValueUpdate");
|
|
3054
|
-
}
|
|
3055
|
-
function onMonthNavClick(e) {
|
|
3056
|
-
var eventTarget = getEventTarget(e);
|
|
3057
|
-
var isPrevMonth = self.prevMonthNav.contains(eventTarget);
|
|
3058
|
-
var isNextMonth = self.nextMonthNav.contains(eventTarget);
|
|
3059
|
-
if (isPrevMonth || isNextMonth) {
|
|
3060
|
-
changeMonth(isPrevMonth ? -1 : 1);
|
|
3061
|
-
}
|
|
3062
|
-
else if (self.yearElements.indexOf(eventTarget) >= 0) {
|
|
3063
|
-
eventTarget.select();
|
|
3064
|
-
}
|
|
3065
|
-
else if (eventTarget.classList.contains("arrowUp")) {
|
|
3066
|
-
self.changeYear(self.currentYear + 1);
|
|
3067
|
-
}
|
|
3068
|
-
else if (eventTarget.classList.contains("arrowDown")) {
|
|
3069
|
-
self.changeYear(self.currentYear - 1);
|
|
3070
|
-
}
|
|
3071
|
-
}
|
|
3072
|
-
function timeWrapper(e) {
|
|
3073
|
-
e.preventDefault();
|
|
3074
|
-
var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget;
|
|
3075
|
-
if (self.amPM !== undefined && eventTarget === self.amPM) {
|
|
3076
|
-
self.amPM.textContent =
|
|
3077
|
-
self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
|
|
3078
|
-
}
|
|
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 ||
|
|
3080
|
-
(isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
|
|
3081
|
-
var newValue = curValue + step * delta;
|
|
3082
|
-
if (typeof input.value !== "undefined" && input.value.length === 2) {
|
|
3083
|
-
var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
|
|
3084
|
-
if (newValue < min) {
|
|
3085
|
-
newValue =
|
|
3086
|
-
max +
|
|
3087
|
-
newValue +
|
|
3088
|
-
int(!isHourElem) +
|
|
3089
|
-
(int(isHourElem) && int(!self.amPM));
|
|
3090
|
-
if (isMinuteElem)
|
|
3091
|
-
incrementNumInput(undefined, -1, self.hourElement);
|
|
3092
|
-
}
|
|
3093
|
-
else if (newValue > max) {
|
|
3094
|
-
newValue =
|
|
3095
|
-
input === self.hourElement ? newValue - max - int(!self.amPM) : min;
|
|
3096
|
-
if (isMinuteElem)
|
|
3097
|
-
incrementNumInput(undefined, 1, self.hourElement);
|
|
3098
|
-
}
|
|
3099
|
-
if (self.amPM &&
|
|
3100
|
-
isHourElem &&
|
|
3101
|
-
(step === 1
|
|
3102
|
-
? newValue + curValue === 23
|
|
3103
|
-
: Math.abs(newValue - curValue) > step)) {
|
|
3104
|
-
self.amPM.textContent =
|
|
3105
|
-
self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
|
|
3106
|
-
}
|
|
3107
|
-
input.value = pad(newValue);
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
init();
|
|
3111
|
-
return self;
|
|
3112
|
-
}
|
|
3113
|
-
function _flatpickr(nodeList, config) {
|
|
3114
|
-
var nodes = Array.prototype.slice
|
|
3115
|
-
.call(nodeList)
|
|
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];
|
|
3120
|
-
try {
|
|
3121
|
-
if (node.getAttribute("data-fp-omit") !== null)
|
|
3122
|
-
continue;
|
|
3123
|
-
if (node._flatpickr !== undefined) {
|
|
3124
|
-
node._flatpickr.destroy();
|
|
3125
|
-
node._flatpickr = undefined;
|
|
3126
|
-
}
|
|
3127
|
-
node._flatpickr = FlatpickrInstance(node, config || {});
|
|
3128
|
-
instances.push(node._flatpickr);
|
|
3129
|
-
}
|
|
3130
|
-
catch (e) {
|
|
3131
|
-
console.error(e);
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
return instances.length === 1 ? instances[0] : instances;
|
|
3135
|
-
}
|
|
3136
|
-
if (typeof HTMLElement !== "undefined" &&
|
|
3137
|
-
typeof HTMLCollection !== "undefined" &&
|
|
3138
|
-
typeof NodeList !== "undefined") {
|
|
3139
|
-
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
|
|
3140
|
-
return _flatpickr(this, config);
|
|
3141
|
-
};
|
|
3142
|
-
HTMLElement.prototype.flatpickr = function (config) {
|
|
3143
|
-
return _flatpickr([this], config);
|
|
3144
|
-
};
|
|
3145
|
-
}
|
|
3146
|
-
var flatpickr = function (selector, config) {
|
|
3147
|
-
if (typeof selector === "string") {
|
|
3148
|
-
return _flatpickr(window.document.querySelectorAll(selector), config);
|
|
3149
|
-
}
|
|
3150
|
-
else if (selector instanceof Node) {
|
|
3151
|
-
return _flatpickr([selector], config);
|
|
3152
|
-
}
|
|
3153
|
-
else {
|
|
3154
|
-
return _flatpickr(selector, config);
|
|
3155
|
-
}
|
|
3156
|
-
};
|
|
3157
|
-
flatpickr.defaultConfig = {};
|
|
3158
|
-
flatpickr.l10ns = {
|
|
3159
|
-
en: __assign({}, english),
|
|
3160
|
-
default: __assign({}, english),
|
|
3161
|
-
};
|
|
3162
|
-
flatpickr.localize = function (l10n) {
|
|
3163
|
-
flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);
|
|
3164
|
-
};
|
|
3165
|
-
flatpickr.setDefaults = function (config) {
|
|
3166
|
-
flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);
|
|
3167
|
-
};
|
|
3168
|
-
flatpickr.parseDate = createDateParser({});
|
|
3169
|
-
flatpickr.formatDate = createDateFormatter({});
|
|
3170
|
-
flatpickr.compareDates = compareDates;
|
|
3171
|
-
if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
|
|
3172
|
-
jQuery.fn.flatpickr = function (config) {
|
|
3173
|
-
return _flatpickr(this, config);
|
|
3174
|
-
};
|
|
3175
|
-
}
|
|
3176
|
-
Date.prototype.fp_incr = function (days) {
|
|
3177
|
-
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
|
|
3178
|
-
};
|
|
3179
|
-
if (typeof window !== "undefined") {
|
|
3180
|
-
window.flatpickr = flatpickr;
|
|
3181
|
-
}
|
|
3182
|
-
|
|
3183
1
|
/*!
|
|
3184
2
|
* Font Awesome Pro 5.15.3 by @fontawesome - https://fontawesome.com
|
|
3185
3
|
* License - https://fontawesome.com/license (Commercial License)
|
|
3186
4
|
*/
|
|
3187
5
|
(function () {
|
|
6
|
+
"use strict";
|
|
3188
7
|
|
|
3189
8
|
function _typeof(obj) {
|
|
3190
9
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -6128,11 +2947,14 @@ if (typeof window !== "undefined") {
|
|
|
6128
2947
|
* License - https://fontawesome.com/license (Commercial License)
|
|
6129
2948
|
*/
|
|
6130
2949
|
(function () {
|
|
2950
|
+
"use strict";
|
|
6131
2951
|
|
|
6132
2952
|
var _WINDOW = {};
|
|
2953
|
+
var _DOCUMENT = {};
|
|
6133
2954
|
|
|
6134
2955
|
try {
|
|
6135
2956
|
if (typeof window !== "undefined") _WINDOW = window;
|
|
2957
|
+
if (typeof document !== "undefined") _DOCUMENT = document;
|
|
6136
2958
|
} catch (e) {}
|
|
6137
2959
|
|
|
6138
2960
|
var _ref = _WINDOW.navigator || {},
|
|
@@ -6140,7 +2962,14 @@ if (typeof window !== "undefined") {
|
|
|
6140
2962
|
userAgent = _ref$userAgent === void 0 ? "" : _ref$userAgent;
|
|
6141
2963
|
|
|
6142
2964
|
var WINDOW = _WINDOW;
|
|
6143
|
-
|
|
2965
|
+
var DOCUMENT = _DOCUMENT;
|
|
2966
|
+
var IS_BROWSER = !!WINDOW.document;
|
|
2967
|
+
var IS_DOM =
|
|
2968
|
+
!!DOCUMENT.documentElement &&
|
|
2969
|
+
!!DOCUMENT.head &&
|
|
2970
|
+
typeof DOCUMENT.addEventListener === "function" &&
|
|
2971
|
+
typeof DOCUMENT.createElement === "function";
|
|
2972
|
+
var IS_IE = ~userAgent.indexOf("MSIE") || ~userAgent.indexOf("Trident/");
|
|
6144
2973
|
|
|
6145
2974
|
var NAMESPACE_IDENTIFIER = "___FONT_AWESOME___";
|
|
6146
2975
|
var PRODUCTION = (function () {
|
|
@@ -19222,1132 +16051,4 @@ if (typeof window !== "undefined") {
|
|
|
19222
16051
|
});
|
|
19223
16052
|
})();
|
|
19224
16053
|
|
|
19225
|
-
|
|
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'
|
|
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>`;
|
|
19228
|
-
const XplInput$1 = class extends HTMLElement$1 {
|
|
19229
|
-
constructor() {
|
|
19230
|
-
super();
|
|
19231
|
-
this.__registerHost();
|
|
19232
|
-
this._id = undefined;
|
|
19233
|
-
this.autocomplete = undefined;
|
|
19234
|
-
this.dateFormat = 'Y-m-d';
|
|
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;
|
|
19242
|
-
this.mode = 'single';
|
|
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;
|
|
19251
|
-
this.type = 'text';
|
|
19252
|
-
this.value = undefined;
|
|
19253
|
-
this.characterCount = 0;
|
|
19254
|
-
this.passwordVisible = false;
|
|
19255
|
-
}
|
|
19256
|
-
updateCharacterCount() {
|
|
19257
|
-
this.characterCount = this.input.value.length;
|
|
19258
|
-
}
|
|
19259
|
-
componentWillLoad() {
|
|
19260
|
-
if (this._id === undefined || this._id === null || this._id === '')
|
|
19261
|
-
this._id = v4();
|
|
19262
|
-
if (this.multiline && this.maxCharacterCount !== undefined) {
|
|
19263
|
-
this.characterCount =
|
|
19264
|
-
this.value !== undefined ? this.value.length : 0;
|
|
19265
|
-
}
|
|
19266
|
-
}
|
|
19267
|
-
componentDidLoad() {
|
|
19268
|
-
if (this.type === 'date') {
|
|
19269
|
-
flatpickr(this.input, {
|
|
19270
|
-
allowInput: true,
|
|
19271
|
-
dateFormat: this.dateFormat,
|
|
19272
|
-
defaultDate: this.value,
|
|
19273
|
-
maxDate: this.max,
|
|
19274
|
-
minDate: this.min,
|
|
19275
|
-
mode: this.mode,
|
|
19276
|
-
nextArrow: arrowSvg(),
|
|
19277
|
-
prevArrow: arrowSvg(true),
|
|
19278
|
-
});
|
|
19279
|
-
}
|
|
19280
|
-
}
|
|
19281
|
-
render() {
|
|
19282
|
-
let className = 'xpl-input';
|
|
19283
|
-
if (this.disabled)
|
|
19284
|
-
className += ' xpl-input--disabled';
|
|
19285
|
-
let hasError = false;
|
|
19286
|
-
if (this.error !== undefined)
|
|
19287
|
-
hasError = true;
|
|
19288
|
-
if (this.multiline &&
|
|
19289
|
-
this.maxCharacterCount !== undefined &&
|
|
19290
|
-
this.characterCount > this.maxCharacterCount)
|
|
19291
|
-
hasError = true;
|
|
19292
|
-
if (hasError)
|
|
19293
|
-
className += ' xpl-input--error';
|
|
19294
|
-
let type = this.type;
|
|
19295
|
-
if (type === 'password' && this.passwordVisible) {
|
|
19296
|
-
type = 'text';
|
|
19297
|
-
}
|
|
19298
|
-
return (h(Host, { class: className }, h("label", { class: "xpl-input-label", htmlFor: this._id }, this.label, this.description && h("small", null, this.description)), h("div", { class: "xpl-input-wrapper" }, this.pre && !this.multiline && (h("label", { class: "xpl-input-pre", htmlFor: this._id }, this.pre)), !this.multiline ? (h("input", { autocomplete: this.type === 'date' ? 'off' : this.autocomplete, disabled: this.disabled, id: this._id, max: this.max, min: this.min, name: this.name, placeholder: this.placeholder, readonly: this.readonly, ref: (el) => {
|
|
19299
|
-
this.input = el;
|
|
19300
|
-
}, required: this.required, step: this.step, type: type, value: this.value })) : (h("textarea", { disabled: this.disabled, id: this._id, name: this.name, onInput: () => this.updateCharacterCount(), placeholder: this.placeholder, readonly: this.readonly, ref: (el) => {
|
|
19301
|
-
this.input = el;
|
|
19302
|
-
}, required: this.required }, this.value)), this.type === 'date' && (h("span", { class: "xpl-input-calendar" }, h("i", { class: "far fa-calendar-alt" }))), this.type === 'password' && (h("button", { class: "xpl-input-password", onClick: () => {
|
|
19303
|
-
this.passwordVisible = !this.passwordVisible;
|
|
19304
|
-
}, role: "presentation" }, h("span", { class: "sr-only" }, "Toggle password visibility"), h("i", { class: "far fa-eye", style: {
|
|
19305
|
-
display: this.passwordVisible
|
|
19306
|
-
? 'none'
|
|
19307
|
-
: 'block',
|
|
19308
|
-
} }), h("i", { class: "far fa-eye-slash", style: {
|
|
19309
|
-
display: this.passwordVisible
|
|
19310
|
-
? 'block'
|
|
19311
|
-
: 'none',
|
|
19312
|
-
} }))), this.post && !this.multiline && (h("label", { class: "xpl-input-post", htmlFor: this._id }, this.post)), this.multiline && this.maxCharacterCount !== undefined && (h("span", { class: "xpl-input-characters" }, this.characterCount, "/", this.maxCharacterCount))), this.error !== undefined && this.error.length > 0 && (h("label", { class: "xpl-input-error", htmlFor: this._id }, h("svg", { width: "10", height: "11", viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" })), this.error))));
|
|
19313
|
-
}
|
|
19314
|
-
};
|
|
19315
|
-
|
|
19316
|
-
const ListItemCpt = ({ avatar, avatars, badges, href, title, subtext, metadata, }) => {
|
|
19317
|
-
const hasRight = avatars || badges || subtext;
|
|
19318
|
-
const inner = (h(Fragment, null, avatar &&
|
|
19319
|
-
(avatar.slice(0, 1) === '/' || avatar.slice(0, 4) === 'http' ? (h("xpl-avatar", { src: avatar, name: title })) : (h("xpl-avatar", { name: title }, avatar))), h("div", { class: "xpl-list-item-content" }, h("div", { class: "xpl-list-left" }, h("div", null, h("h4", null, title), metadata && (h("ul", { class: "xpl-list-item-metadata" }, metadata.map((d) => {
|
|
19320
|
-
if (typeof d === 'string') {
|
|
19321
|
-
return h("li", null, d);
|
|
19322
|
-
}
|
|
19323
|
-
else {
|
|
19324
|
-
return (h("li", null, h("span", { class: `far fa-${d.icon}` }), ' ', d.text));
|
|
19325
|
-
}
|
|
19326
|
-
}))))), hasRight && (h("div", { class: "xpl-list-right" }, subtext && (h("div", { class: "xpl-list-item-subtext" }, subtext)), avatars && (h("div", { class: "xpl-avatar-group xpl-avatar-group--s" }, avatars.map((a) => (h("img", { src: a, alt: "" }))))), badges &&
|
|
19327
|
-
badges.map((b) => {
|
|
19328
|
-
if (typeof b === 'string') {
|
|
19329
|
-
return h("xpl-badge", null, b);
|
|
19330
|
-
}
|
|
19331
|
-
else {
|
|
19332
|
-
return (h("xpl-badge", { dot: b.dot, variant: b.variant }, b.text));
|
|
19333
|
-
}
|
|
19334
|
-
}))))));
|
|
19335
|
-
return href ? (h("a", { class: "xpl-list-item", href: href }, inner)) : (h("div", { class: "xpl-list-item" }, inner));
|
|
19336
|
-
};
|
|
19337
|
-
const XplList$1 = class extends HTMLElement$1 {
|
|
19338
|
-
constructor() {
|
|
19339
|
-
super();
|
|
19340
|
-
this.__registerHost();
|
|
19341
|
-
this.items = [];
|
|
19342
|
-
}
|
|
19343
|
-
render() {
|
|
19344
|
-
return (h(Host, null, this.items.map((item) => (h(ListItemCpt, Object.assign({}, item))))));
|
|
19345
|
-
}
|
|
19346
|
-
};
|
|
19347
|
-
|
|
19348
|
-
const XplMainNav$1 = class extends HTMLElement$1 {
|
|
19349
|
-
constructor() {
|
|
19350
|
-
super();
|
|
19351
|
-
this.__registerHost();
|
|
19352
|
-
this.navWidth = createEvent(this, "navWidth", 7);
|
|
19353
|
-
this.width = 'default';
|
|
19354
|
-
}
|
|
19355
|
-
navWidthHandler() {
|
|
19356
|
-
this.navWidth.emit(this.width);
|
|
19357
|
-
}
|
|
19358
|
-
connectedCallback() {
|
|
19359
|
-
this.navWidthHandler();
|
|
19360
|
-
}
|
|
19361
|
-
componentDidUpdate() {
|
|
19362
|
-
this.navWidthHandler();
|
|
19363
|
-
}
|
|
19364
|
-
render() {
|
|
19365
|
-
return (h(Host, { class: `xpl-main-nav xpl-main-nav--${this.width}`, "aria-label": "Sidebar" }, h("nav", null, h("header", { "aria-label": "Sidebar Header" }, h("slot", { name: "logo" }), h("slot", { name: "brand-name" })), h("div", { class: "xpl-main-nav__main_section" }, h("slot", { name: "navigation" })), h("footer", { class: "xpl-main-nav__footer", "aria-label": "Sidebar Footer" }, h("slot", { name: "footer" })))));
|
|
19366
|
-
}
|
|
19367
|
-
};
|
|
19368
|
-
|
|
19369
|
-
const XplNavItem$1 = class extends HTMLElement$1 {
|
|
19370
|
-
constructor() {
|
|
19371
|
-
super();
|
|
19372
|
-
this.__registerHost();
|
|
19373
|
-
this.navOpen = createEvent(this, "navOpen", 7);
|
|
19374
|
-
this.navControl = false;
|
|
19375
|
-
}
|
|
19376
|
-
onNavToggle() {
|
|
19377
|
-
if (window.innerWidth <= 640) {
|
|
19378
|
-
this.navOpen.emit(false);
|
|
19379
|
-
}
|
|
19380
|
-
}
|
|
19381
|
-
render() {
|
|
19382
|
-
return (h(Host, { class: "xpl-nav-item", role: "listitem", onClick: () => {
|
|
19383
|
-
if (this.navControl) {
|
|
19384
|
-
this.onNavToggle();
|
|
19385
|
-
}
|
|
19386
|
-
} }, h("slot", { name: "link" }, h("slot", { name: "icon" }), h("slot", null))));
|
|
19387
|
-
}
|
|
19388
|
-
};
|
|
19389
|
-
|
|
19390
|
-
const XplPagination$1 = class extends HTMLElement$1 {
|
|
19391
|
-
constructor() {
|
|
19392
|
-
super();
|
|
19393
|
-
this.__registerHost();
|
|
19394
|
-
this.page = createEvent(this, "page", 7);
|
|
19395
|
-
/**
|
|
19396
|
-
* Private `_goto` method respects the `waitForCallback` prop --
|
|
19397
|
-
* it will always emit the `page` event, but won't actually update
|
|
19398
|
-
* the state of what the current page is, leaving that to the caller
|
|
19399
|
-
* to update once (presumably) some other data has loaded.
|
|
19400
|
-
*/
|
|
19401
|
-
this._goto = (n) => {
|
|
19402
|
-
this.page.emit(n);
|
|
19403
|
-
if (!this.waitForCallback) {
|
|
19404
|
-
this.current = n;
|
|
19405
|
-
}
|
|
19406
|
-
};
|
|
19407
|
-
this.goPrev = () => {
|
|
19408
|
-
if (this.current > 1)
|
|
19409
|
-
this._goto(this.current - 1);
|
|
19410
|
-
};
|
|
19411
|
-
this.goNext = () => {
|
|
19412
|
-
const numPages = Math.ceil(this.total / this.perPage);
|
|
19413
|
-
if (this.current < numPages)
|
|
19414
|
-
this._goto(this.current + 1);
|
|
19415
|
-
};
|
|
19416
|
-
this.total = undefined;
|
|
19417
|
-
this.perPage = undefined;
|
|
19418
|
-
this.waitForCallback = undefined;
|
|
19419
|
-
this.current = 1;
|
|
19420
|
-
}
|
|
19421
|
-
/**
|
|
19422
|
-
* Calling `goto` with a page number (which should probably be
|
|
19423
|
-
* taken from the `page` event) updates the pagination's state
|
|
19424
|
-
* and re-renders it, showing the appropriate buttons given the current page.
|
|
19425
|
-
* @param n
|
|
19426
|
-
*/
|
|
19427
|
-
async goto(n) {
|
|
19428
|
-
this.current = n;
|
|
19429
|
-
}
|
|
19430
|
-
render() {
|
|
19431
|
-
const numPages = Math.ceil(this.total / this.perPage);
|
|
19432
|
-
let showing = [1];
|
|
19433
|
-
if (numPages < 7)
|
|
19434
|
-
showing = [1, 2, 3, 4, 5, 6];
|
|
19435
|
-
if (this.current <= 3 || this.current >= numPages - 2) {
|
|
19436
|
-
showing = [1, 2, 3, '...', numPages - 2, numPages - 1, numPages];
|
|
19437
|
-
}
|
|
19438
|
-
else {
|
|
19439
|
-
showing = [
|
|
19440
|
-
1,
|
|
19441
|
-
'...',
|
|
19442
|
-
this.current - 1,
|
|
19443
|
-
this.current,
|
|
19444
|
-
this.current + 1,
|
|
19445
|
-
'...',
|
|
19446
|
-
numPages,
|
|
19447
|
-
];
|
|
19448
|
-
}
|
|
19449
|
-
const showingFirst = (this.current - 1) * this.perPage + 1;
|
|
19450
|
-
const showingLast = Math.min(showingFirst + this.perPage - 1, this.total);
|
|
19451
|
-
return (h(Host, null, h("div", { class: "xpl-pagination" }, h("div", null, h("p", null, "Showing ", h("span", null, showingFirst), " to", ' ', h("span", null, showingLast), " of", ' ', h("span", null, this.total), " results")), h("div", null, h("nav", { "aria-label": "Pagination" }, h("button", { onClick: this.goPrev, class: "xpl-pagination-prev" }, h("span", null, "Previous"), h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", "clip-rule": "evenodd" }))), showing.map((n) => {
|
|
19452
|
-
if (n === '...') {
|
|
19453
|
-
return (h("span", { class: "xpl-pagination-ellipsis" }, "..."));
|
|
19454
|
-
}
|
|
19455
|
-
if (n === this.current) {
|
|
19456
|
-
return (h("button", { "aria-current": "page", class: "xpl-pagination-current" }, n));
|
|
19457
|
-
}
|
|
19458
|
-
return (h("button", { onClick: () => this._goto(n) }, n));
|
|
19459
|
-
}), h("button", { onClick: this.goNext, class: "xpl-pagination-next" }, h("span", null, "Next"), h("svg", { viewBox: "0 0 20 20", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "clip-rule": "evenodd" }))))))));
|
|
19460
|
-
}
|
|
19461
|
-
};
|
|
19462
|
-
|
|
19463
|
-
const XplRadio$1 = class extends HTMLElement$1 {
|
|
19464
|
-
constructor() {
|
|
19465
|
-
super();
|
|
19466
|
-
this.__registerHost();
|
|
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;
|
|
19475
|
-
this.id = v4();
|
|
19476
|
-
}
|
|
19477
|
-
render() {
|
|
19478
|
-
return (h(Host, { class: {
|
|
19479
|
-
'xpl-checkbox-radio-container': true,
|
|
19480
|
-
styled: this.styled,
|
|
19481
|
-
disabled: this.disabled,
|
|
19482
|
-
} }, h("input", { class: "xpl-radio", type: "radio", checked: this.checked, disabled: this.disabled, id: this.id, name: this.name, required: this.required, value: this.value, onChange: () => this.radioChange.emit(true) }), h("label", { class: {
|
|
19483
|
-
'xpl-label': true,
|
|
19484
|
-
'xpl-label--disabled': this.disabled,
|
|
19485
|
-
}, htmlFor: this.id }, h("slot", null), this.description && (h("small", { class: {
|
|
19486
|
-
'xpl-description': true,
|
|
19487
|
-
'xpl-description--disabled': this.disabled,
|
|
19488
|
-
} }, this.description)))));
|
|
19489
|
-
}
|
|
19490
|
-
};
|
|
19491
|
-
|
|
19492
|
-
const XplSecondaryNav$1 = class extends HTMLElement$1 {
|
|
19493
|
-
constructor() {
|
|
19494
|
-
super();
|
|
19495
|
-
this.__registerHost();
|
|
19496
|
-
}
|
|
19497
|
-
render() {
|
|
19498
|
-
return (h(Host, { class: "xpl-secondary-nav" }, h("nav", { "aria-label": "Secondary Nav" }, h("slot", null))));
|
|
19499
|
-
}
|
|
19500
|
-
};
|
|
19501
|
-
|
|
19502
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
19503
|
-
|
|
19504
|
-
/**
|
|
19505
|
-
* lodash (Custom Build) <https://lodash.com/>
|
|
19506
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
19507
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
19508
|
-
* Released under MIT license <https://lodash.com/license>
|
|
19509
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
19510
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
19511
|
-
*/
|
|
19512
|
-
|
|
19513
|
-
/** Used as the `TypeError` message for "Functions" methods. */
|
|
19514
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
19515
|
-
|
|
19516
|
-
/** Used as references for various `Number` constants. */
|
|
19517
|
-
var NAN = 0 / 0;
|
|
19518
|
-
|
|
19519
|
-
/** `Object#toString` result references. */
|
|
19520
|
-
var symbolTag = '[object Symbol]';
|
|
19521
|
-
|
|
19522
|
-
/** Used to match leading and trailing whitespace. */
|
|
19523
|
-
var reTrim = /^\s+|\s+$/g;
|
|
19524
|
-
|
|
19525
|
-
/** Used to detect bad signed hexadecimal string values. */
|
|
19526
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
19527
|
-
|
|
19528
|
-
/** Used to detect binary string values. */
|
|
19529
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
19530
|
-
|
|
19531
|
-
/** Used to detect octal string values. */
|
|
19532
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
19533
|
-
|
|
19534
|
-
/** Built-in method references without a dependency on `root`. */
|
|
19535
|
-
var freeParseInt = parseInt;
|
|
19536
|
-
|
|
19537
|
-
/** Detect free variable `global` from Node.js. */
|
|
19538
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
19539
|
-
|
|
19540
|
-
/** Detect free variable `self`. */
|
|
19541
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
19542
|
-
|
|
19543
|
-
/** Used as a reference to the global object. */
|
|
19544
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
19545
|
-
|
|
19546
|
-
/** Used for built-in method references. */
|
|
19547
|
-
var objectProto = Object.prototype;
|
|
19548
|
-
|
|
19549
|
-
/**
|
|
19550
|
-
* Used to resolve the
|
|
19551
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
19552
|
-
* of values.
|
|
19553
|
-
*/
|
|
19554
|
-
var objectToString = objectProto.toString;
|
|
19555
|
-
|
|
19556
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
19557
|
-
var nativeMax = Math.max,
|
|
19558
|
-
nativeMin = Math.min;
|
|
19559
|
-
|
|
19560
|
-
/**
|
|
19561
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
19562
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
19563
|
-
*
|
|
19564
|
-
* @static
|
|
19565
|
-
* @memberOf _
|
|
19566
|
-
* @since 2.4.0
|
|
19567
|
-
* @category Date
|
|
19568
|
-
* @returns {number} Returns the timestamp.
|
|
19569
|
-
* @example
|
|
19570
|
-
*
|
|
19571
|
-
* _.defer(function(stamp) {
|
|
19572
|
-
* console.log(_.now() - stamp);
|
|
19573
|
-
* }, _.now());
|
|
19574
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
19575
|
-
*/
|
|
19576
|
-
var now = function() {
|
|
19577
|
-
return root.Date.now();
|
|
19578
|
-
};
|
|
19579
|
-
|
|
19580
|
-
/**
|
|
19581
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
19582
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
19583
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
19584
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
19585
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
19586
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
19587
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
19588
|
-
* calls to the debounced function return the result of the last `func`
|
|
19589
|
-
* invocation.
|
|
19590
|
-
*
|
|
19591
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
19592
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
19593
|
-
* is invoked more than once during the `wait` timeout.
|
|
19594
|
-
*
|
|
19595
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
19596
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
19597
|
-
*
|
|
19598
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
19599
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
19600
|
-
*
|
|
19601
|
-
* @static
|
|
19602
|
-
* @memberOf _
|
|
19603
|
-
* @since 0.1.0
|
|
19604
|
-
* @category Function
|
|
19605
|
-
* @param {Function} func The function to debounce.
|
|
19606
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
19607
|
-
* @param {Object} [options={}] The options object.
|
|
19608
|
-
* @param {boolean} [options.leading=false]
|
|
19609
|
-
* Specify invoking on the leading edge of the timeout.
|
|
19610
|
-
* @param {number} [options.maxWait]
|
|
19611
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
19612
|
-
* @param {boolean} [options.trailing=true]
|
|
19613
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
19614
|
-
* @returns {Function} Returns the new debounced function.
|
|
19615
|
-
* @example
|
|
19616
|
-
*
|
|
19617
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
19618
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
19619
|
-
*
|
|
19620
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
19621
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
19622
|
-
* 'leading': true,
|
|
19623
|
-
* 'trailing': false
|
|
19624
|
-
* }));
|
|
19625
|
-
*
|
|
19626
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
19627
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
19628
|
-
* var source = new EventSource('/stream');
|
|
19629
|
-
* jQuery(source).on('message', debounced);
|
|
19630
|
-
*
|
|
19631
|
-
* // Cancel the trailing debounced invocation.
|
|
19632
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
19633
|
-
*/
|
|
19634
|
-
function debounce(func, wait, options) {
|
|
19635
|
-
var lastArgs,
|
|
19636
|
-
lastThis,
|
|
19637
|
-
maxWait,
|
|
19638
|
-
result,
|
|
19639
|
-
timerId,
|
|
19640
|
-
lastCallTime,
|
|
19641
|
-
lastInvokeTime = 0,
|
|
19642
|
-
leading = false,
|
|
19643
|
-
maxing = false,
|
|
19644
|
-
trailing = true;
|
|
19645
|
-
|
|
19646
|
-
if (typeof func != 'function') {
|
|
19647
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
19648
|
-
}
|
|
19649
|
-
wait = toNumber(wait) || 0;
|
|
19650
|
-
if (isObject(options)) {
|
|
19651
|
-
leading = !!options.leading;
|
|
19652
|
-
maxing = 'maxWait' in options;
|
|
19653
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
19654
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
19655
|
-
}
|
|
19656
|
-
|
|
19657
|
-
function invokeFunc(time) {
|
|
19658
|
-
var args = lastArgs,
|
|
19659
|
-
thisArg = lastThis;
|
|
19660
|
-
|
|
19661
|
-
lastArgs = lastThis = undefined;
|
|
19662
|
-
lastInvokeTime = time;
|
|
19663
|
-
result = func.apply(thisArg, args);
|
|
19664
|
-
return result;
|
|
19665
|
-
}
|
|
19666
|
-
|
|
19667
|
-
function leadingEdge(time) {
|
|
19668
|
-
// Reset any `maxWait` timer.
|
|
19669
|
-
lastInvokeTime = time;
|
|
19670
|
-
// Start the timer for the trailing edge.
|
|
19671
|
-
timerId = setTimeout(timerExpired, wait);
|
|
19672
|
-
// Invoke the leading edge.
|
|
19673
|
-
return leading ? invokeFunc(time) : result;
|
|
19674
|
-
}
|
|
19675
|
-
|
|
19676
|
-
function remainingWait(time) {
|
|
19677
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
19678
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
19679
|
-
result = wait - timeSinceLastCall;
|
|
19680
|
-
|
|
19681
|
-
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
19682
|
-
}
|
|
19683
|
-
|
|
19684
|
-
function shouldInvoke(time) {
|
|
19685
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
19686
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
19687
|
-
|
|
19688
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
19689
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
19690
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
19691
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
19692
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
19693
|
-
}
|
|
19694
|
-
|
|
19695
|
-
function timerExpired() {
|
|
19696
|
-
var time = now();
|
|
19697
|
-
if (shouldInvoke(time)) {
|
|
19698
|
-
return trailingEdge(time);
|
|
19699
|
-
}
|
|
19700
|
-
// Restart the timer.
|
|
19701
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
19702
|
-
}
|
|
19703
|
-
|
|
19704
|
-
function trailingEdge(time) {
|
|
19705
|
-
timerId = undefined;
|
|
19706
|
-
|
|
19707
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
19708
|
-
// debounced at least once.
|
|
19709
|
-
if (trailing && lastArgs) {
|
|
19710
|
-
return invokeFunc(time);
|
|
19711
|
-
}
|
|
19712
|
-
lastArgs = lastThis = undefined;
|
|
19713
|
-
return result;
|
|
19714
|
-
}
|
|
19715
|
-
|
|
19716
|
-
function cancel() {
|
|
19717
|
-
if (timerId !== undefined) {
|
|
19718
|
-
clearTimeout(timerId);
|
|
19719
|
-
}
|
|
19720
|
-
lastInvokeTime = 0;
|
|
19721
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
19722
|
-
}
|
|
19723
|
-
|
|
19724
|
-
function flush() {
|
|
19725
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
19726
|
-
}
|
|
19727
|
-
|
|
19728
|
-
function debounced() {
|
|
19729
|
-
var time = now(),
|
|
19730
|
-
isInvoking = shouldInvoke(time);
|
|
19731
|
-
|
|
19732
|
-
lastArgs = arguments;
|
|
19733
|
-
lastThis = this;
|
|
19734
|
-
lastCallTime = time;
|
|
19735
|
-
|
|
19736
|
-
if (isInvoking) {
|
|
19737
|
-
if (timerId === undefined) {
|
|
19738
|
-
return leadingEdge(lastCallTime);
|
|
19739
|
-
}
|
|
19740
|
-
if (maxing) {
|
|
19741
|
-
// Handle invocations in a tight loop.
|
|
19742
|
-
timerId = setTimeout(timerExpired, wait);
|
|
19743
|
-
return invokeFunc(lastCallTime);
|
|
19744
|
-
}
|
|
19745
|
-
}
|
|
19746
|
-
if (timerId === undefined) {
|
|
19747
|
-
timerId = setTimeout(timerExpired, wait);
|
|
19748
|
-
}
|
|
19749
|
-
return result;
|
|
19750
|
-
}
|
|
19751
|
-
debounced.cancel = cancel;
|
|
19752
|
-
debounced.flush = flush;
|
|
19753
|
-
return debounced;
|
|
19754
|
-
}
|
|
19755
|
-
|
|
19756
|
-
/**
|
|
19757
|
-
* Creates a throttled function that only invokes `func` at most once per
|
|
19758
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
19759
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
|
19760
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
19761
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
19762
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
|
19763
|
-
* throttled function. Subsequent calls to the throttled function return the
|
|
19764
|
-
* result of the last `func` invocation.
|
|
19765
|
-
*
|
|
19766
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
19767
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
|
19768
|
-
* is invoked more than once during the `wait` timeout.
|
|
19769
|
-
*
|
|
19770
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
19771
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
19772
|
-
*
|
|
19773
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
19774
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
19775
|
-
*
|
|
19776
|
-
* @static
|
|
19777
|
-
* @memberOf _
|
|
19778
|
-
* @since 0.1.0
|
|
19779
|
-
* @category Function
|
|
19780
|
-
* @param {Function} func The function to throttle.
|
|
19781
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
19782
|
-
* @param {Object} [options={}] The options object.
|
|
19783
|
-
* @param {boolean} [options.leading=true]
|
|
19784
|
-
* Specify invoking on the leading edge of the timeout.
|
|
19785
|
-
* @param {boolean} [options.trailing=true]
|
|
19786
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
19787
|
-
* @returns {Function} Returns the new throttled function.
|
|
19788
|
-
* @example
|
|
19789
|
-
*
|
|
19790
|
-
* // Avoid excessively updating the position while scrolling.
|
|
19791
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
19792
|
-
*
|
|
19793
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
19794
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
19795
|
-
* jQuery(element).on('click', throttled);
|
|
19796
|
-
*
|
|
19797
|
-
* // Cancel the trailing throttled invocation.
|
|
19798
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
|
19799
|
-
*/
|
|
19800
|
-
function throttle(func, wait, options) {
|
|
19801
|
-
var leading = true,
|
|
19802
|
-
trailing = true;
|
|
19803
|
-
|
|
19804
|
-
if (typeof func != 'function') {
|
|
19805
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
19806
|
-
}
|
|
19807
|
-
if (isObject(options)) {
|
|
19808
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
|
19809
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
19810
|
-
}
|
|
19811
|
-
return debounce(func, wait, {
|
|
19812
|
-
'leading': leading,
|
|
19813
|
-
'maxWait': wait,
|
|
19814
|
-
'trailing': trailing
|
|
19815
|
-
});
|
|
19816
|
-
}
|
|
19817
|
-
|
|
19818
|
-
/**
|
|
19819
|
-
* Checks if `value` is the
|
|
19820
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
19821
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
19822
|
-
*
|
|
19823
|
-
* @static
|
|
19824
|
-
* @memberOf _
|
|
19825
|
-
* @since 0.1.0
|
|
19826
|
-
* @category Lang
|
|
19827
|
-
* @param {*} value The value to check.
|
|
19828
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
19829
|
-
* @example
|
|
19830
|
-
*
|
|
19831
|
-
* _.isObject({});
|
|
19832
|
-
* // => true
|
|
19833
|
-
*
|
|
19834
|
-
* _.isObject([1, 2, 3]);
|
|
19835
|
-
* // => true
|
|
19836
|
-
*
|
|
19837
|
-
* _.isObject(_.noop);
|
|
19838
|
-
* // => true
|
|
19839
|
-
*
|
|
19840
|
-
* _.isObject(null);
|
|
19841
|
-
* // => false
|
|
19842
|
-
*/
|
|
19843
|
-
function isObject(value) {
|
|
19844
|
-
var type = typeof value;
|
|
19845
|
-
return !!value && (type == 'object' || type == 'function');
|
|
19846
|
-
}
|
|
19847
|
-
|
|
19848
|
-
/**
|
|
19849
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
19850
|
-
* and has a `typeof` result of "object".
|
|
19851
|
-
*
|
|
19852
|
-
* @static
|
|
19853
|
-
* @memberOf _
|
|
19854
|
-
* @since 4.0.0
|
|
19855
|
-
* @category Lang
|
|
19856
|
-
* @param {*} value The value to check.
|
|
19857
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
19858
|
-
* @example
|
|
19859
|
-
*
|
|
19860
|
-
* _.isObjectLike({});
|
|
19861
|
-
* // => true
|
|
19862
|
-
*
|
|
19863
|
-
* _.isObjectLike([1, 2, 3]);
|
|
19864
|
-
* // => true
|
|
19865
|
-
*
|
|
19866
|
-
* _.isObjectLike(_.noop);
|
|
19867
|
-
* // => false
|
|
19868
|
-
*
|
|
19869
|
-
* _.isObjectLike(null);
|
|
19870
|
-
* // => false
|
|
19871
|
-
*/
|
|
19872
|
-
function isObjectLike(value) {
|
|
19873
|
-
return !!value && typeof value == 'object';
|
|
19874
|
-
}
|
|
19875
|
-
|
|
19876
|
-
/**
|
|
19877
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
19878
|
-
*
|
|
19879
|
-
* @static
|
|
19880
|
-
* @memberOf _
|
|
19881
|
-
* @since 4.0.0
|
|
19882
|
-
* @category Lang
|
|
19883
|
-
* @param {*} value The value to check.
|
|
19884
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
19885
|
-
* @example
|
|
19886
|
-
*
|
|
19887
|
-
* _.isSymbol(Symbol.iterator);
|
|
19888
|
-
* // => true
|
|
19889
|
-
*
|
|
19890
|
-
* _.isSymbol('abc');
|
|
19891
|
-
* // => false
|
|
19892
|
-
*/
|
|
19893
|
-
function isSymbol(value) {
|
|
19894
|
-
return typeof value == 'symbol' ||
|
|
19895
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
19896
|
-
}
|
|
19897
|
-
|
|
19898
|
-
/**
|
|
19899
|
-
* Converts `value` to a number.
|
|
19900
|
-
*
|
|
19901
|
-
* @static
|
|
19902
|
-
* @memberOf _
|
|
19903
|
-
* @since 4.0.0
|
|
19904
|
-
* @category Lang
|
|
19905
|
-
* @param {*} value The value to process.
|
|
19906
|
-
* @returns {number} Returns the number.
|
|
19907
|
-
* @example
|
|
19908
|
-
*
|
|
19909
|
-
* _.toNumber(3.2);
|
|
19910
|
-
* // => 3.2
|
|
19911
|
-
*
|
|
19912
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
19913
|
-
* // => 5e-324
|
|
19914
|
-
*
|
|
19915
|
-
* _.toNumber(Infinity);
|
|
19916
|
-
* // => Infinity
|
|
19917
|
-
*
|
|
19918
|
-
* _.toNumber('3.2');
|
|
19919
|
-
* // => 3.2
|
|
19920
|
-
*/
|
|
19921
|
-
function toNumber(value) {
|
|
19922
|
-
if (typeof value == 'number') {
|
|
19923
|
-
return value;
|
|
19924
|
-
}
|
|
19925
|
-
if (isSymbol(value)) {
|
|
19926
|
-
return NAN;
|
|
19927
|
-
}
|
|
19928
|
-
if (isObject(value)) {
|
|
19929
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
19930
|
-
value = isObject(other) ? (other + '') : other;
|
|
19931
|
-
}
|
|
19932
|
-
if (typeof value != 'string') {
|
|
19933
|
-
return value === 0 ? value : +value;
|
|
19934
|
-
}
|
|
19935
|
-
value = value.replace(reTrim, '');
|
|
19936
|
-
var isBinary = reIsBinary.test(value);
|
|
19937
|
-
return (isBinary || reIsOctal.test(value))
|
|
19938
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
19939
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
19940
|
-
}
|
|
19941
|
-
|
|
19942
|
-
var lodash_throttle = throttle;
|
|
19943
|
-
|
|
19944
|
-
function tagWidth(text) {
|
|
19945
|
-
const context = document.createElement('canvas').getContext('2d');
|
|
19946
|
-
context.font =
|
|
19947
|
-
"14px apple-system, system-ui, 'Segoe UI', Arial, Helvetica, Roboto, sans-serif";
|
|
19948
|
-
return context.measureText(text).width + 44; // = text + l/r padding + margin-right
|
|
19949
|
-
}
|
|
19950
|
-
const XplSelect$1 = class extends HTMLElement$1 {
|
|
19951
|
-
constructor() {
|
|
19952
|
-
super();
|
|
19953
|
-
this.__registerHost();
|
|
19954
|
-
this.choices = [];
|
|
19955
|
-
this.description = undefined;
|
|
19956
|
-
this.disabled = undefined;
|
|
19957
|
-
this.error = undefined;
|
|
19958
|
-
this.label = undefined;
|
|
19959
|
-
this.mode = 'single';
|
|
19960
|
-
this.placeholder = undefined;
|
|
19961
|
-
this.truncate = true;
|
|
19962
|
-
this.active = false;
|
|
19963
|
-
this.id = v4();
|
|
19964
|
-
this.keepFocus = false;
|
|
19965
|
-
this.selected = undefined;
|
|
19966
|
-
this.value = '';
|
|
19967
|
-
this.displayValue = '';
|
|
19968
|
-
this.visibleChoices = Infinity;
|
|
19969
|
-
}
|
|
19970
|
-
componentWillLoad() {
|
|
19971
|
-
this.selected =
|
|
19972
|
-
this.choices && this.choices.length > 0
|
|
19973
|
-
? this.choices.map(() => false)
|
|
19974
|
-
: [];
|
|
19975
|
-
window.addEventListener('click', (e) => {
|
|
19976
|
-
const el = e.target;
|
|
19977
|
-
const select = el.closest('.xpl-select');
|
|
19978
|
-
if (select === null || select !== this.container) {
|
|
19979
|
-
this.active = false;
|
|
19980
|
-
}
|
|
19981
|
-
});
|
|
19982
|
-
window.addEventListener('resize', lodash_throttle(() => {
|
|
19983
|
-
this.maybeTruncateChoices();
|
|
19984
|
-
}, 250));
|
|
19985
|
-
}
|
|
19986
|
-
componentDidLoad() {
|
|
19987
|
-
this.dropdown = this.container.querySelector('xpl-dropdown');
|
|
19988
|
-
}
|
|
19989
|
-
maybeTruncateChoices() {
|
|
19990
|
-
if (this.mode === 'single' || !this.truncate)
|
|
19991
|
-
return;
|
|
19992
|
-
const containerWidth = this.container.getBoundingClientRect().width;
|
|
19993
|
-
let visibleChoices = 0;
|
|
19994
|
-
let visibleChoicesWidth = 0;
|
|
19995
|
-
const actualNumSelected = this.selected.filter((a) => a).length;
|
|
19996
|
-
for (let i = 0; i < actualNumSelected; i++) {
|
|
19997
|
-
visibleChoicesWidth += tagWidth(this.getDisplayValue(i));
|
|
19998
|
-
if (visibleChoicesWidth > containerWidth - 140)
|
|
19999
|
-
break;
|
|
20000
|
-
visibleChoices++;
|
|
20001
|
-
}
|
|
20002
|
-
if (visibleChoices >= actualNumSelected)
|
|
20003
|
-
visibleChoices = Infinity;
|
|
20004
|
-
if (visibleChoices < 1)
|
|
20005
|
-
visibleChoices = 1;
|
|
20006
|
-
this.visibleChoices = visibleChoices;
|
|
20007
|
-
}
|
|
20008
|
-
flattenChoices() {
|
|
20009
|
-
return this.choices.reduce((acc, curr) => [
|
|
20010
|
-
...acc,
|
|
20011
|
-
...(curr.groupName ? curr.options : [curr]),
|
|
20012
|
-
], []);
|
|
20013
|
-
}
|
|
20014
|
-
getDisplayValue(i) {
|
|
20015
|
-
return this.flattenChoices()[i].label || this.flattenChoices()[i].value;
|
|
20016
|
-
}
|
|
20017
|
-
getActualValue(i) {
|
|
20018
|
-
return this.flattenChoices()[i].value || this.flattenChoices()[i].label;
|
|
20019
|
-
}
|
|
20020
|
-
update() {
|
|
20021
|
-
this.selected = this.flattenChoices().map(({ isSelected }) => isSelected);
|
|
20022
|
-
if (this.mode === 'single') {
|
|
20023
|
-
const selected = this.selected.findIndex((v) => v);
|
|
20024
|
-
this.value = selected >= 0 ? this.getActualValue(selected) : '';
|
|
20025
|
-
this.displayValue =
|
|
20026
|
-
selected >= 0 ? this.getDisplayValue(selected) : '';
|
|
20027
|
-
}
|
|
20028
|
-
else if (this.mode === 'multi') {
|
|
20029
|
-
this.value = this.selected
|
|
20030
|
-
.map((v, i) => {
|
|
20031
|
-
return v ? this.getActualValue(i) : '';
|
|
20032
|
-
})
|
|
20033
|
-
.filter((v) => v.length > 0)
|
|
20034
|
-
.join('|');
|
|
20035
|
-
}
|
|
20036
|
-
}
|
|
20037
|
-
render() {
|
|
20038
|
-
let visibleChoices = 0;
|
|
20039
|
-
return (h(Host, { class: {
|
|
20040
|
-
'xpl-select': true,
|
|
20041
|
-
'xpl-select--disabled': this.disabled,
|
|
20042
|
-
'xpl-select--no-truncate': !this.truncate,
|
|
20043
|
-
}, onKeyDown: (e) => {
|
|
20044
|
-
if (e.key === 'Escape')
|
|
20045
|
-
this.active = false;
|
|
20046
|
-
}, ref: (el) => (this.container = el) }, this.label || this.description ? (h("label", { class: {
|
|
20047
|
-
'xpl-label': true,
|
|
20048
|
-
'xpl-label--disabled': this.disabled,
|
|
20049
|
-
}, htmlFor: this.id }, this.label, this.description && (h("small", { class: {
|
|
20050
|
-
'xpl-description': true,
|
|
20051
|
-
'xpl-description--disabled': this.disabled,
|
|
20052
|
-
} }, this.description)))) : null, h("div", { class: {
|
|
20053
|
-
'xpl-input': true,
|
|
20054
|
-
'xpl-input--disabled': this.disabled,
|
|
20055
|
-
'xpl-input--error': this.error !== undefined,
|
|
20056
|
-
} }, h("div", { class: "xpl-input-wrapper" }, h("div", { class: {
|
|
20057
|
-
'xpl-select-value': true,
|
|
20058
|
-
'xpl-select-value--active': this.mode === 'multi' &&
|
|
20059
|
-
this.value.length > 0,
|
|
20060
|
-
'has-value': this.value.length > 0,
|
|
20061
|
-
} }, this.mode === 'single'
|
|
20062
|
-
? this.displayValue || this.placeholder
|
|
20063
|
-
: this.value.length > 0
|
|
20064
|
-
? this.selected.map((v, i) => {
|
|
20065
|
-
if (!v)
|
|
20066
|
-
return null;
|
|
20067
|
-
if (visibleChoices >= this.visibleChoices)
|
|
20068
|
-
return null;
|
|
20069
|
-
visibleChoices++;
|
|
20070
|
-
return (h("xpl-tag", { onClose: () => {
|
|
20071
|
-
this.flattenChoices().forEach((v, j) => {
|
|
20072
|
-
if (i === j)
|
|
20073
|
-
v.isSelected =
|
|
20074
|
-
false;
|
|
20075
|
-
});
|
|
20076
|
-
const mapOptions = (option) => {
|
|
20077
|
-
option.options =
|
|
20078
|
-
option.groupName
|
|
20079
|
-
? option.options.map(mapOptions)
|
|
20080
|
-
: undefined;
|
|
20081
|
-
return option;
|
|
20082
|
-
};
|
|
20083
|
-
this.choices =
|
|
20084
|
-
this.choices.map(mapOptions);
|
|
20085
|
-
this.update();
|
|
20086
|
-
this.maybeTruncateChoices();
|
|
20087
|
-
} }, this.getDisplayValue(i)));
|
|
20088
|
-
})
|
|
20089
|
-
: this.placeholder, this.visibleChoices < Infinity &&
|
|
20090
|
-
`+ ${this.selected.filter((a) => a).length -
|
|
20091
|
-
this.visibleChoices} more`), h("button", { disabled: this.disabled, id: this.id, onKeyDown: (e) => {
|
|
20092
|
-
if (e.key === 'Tab')
|
|
20093
|
-
this.keepFocus = true;
|
|
20094
|
-
}, onClick: () => {
|
|
20095
|
-
const { dropdown } = this;
|
|
20096
|
-
if (!this.disabled)
|
|
20097
|
-
dropdown.isOpen = !dropdown.isOpen;
|
|
20098
|
-
} })), !this.disabled && (h("xpl-dropdown", { options: this.choices, mode: this.mode, triggerId: this.id, update: () => {
|
|
20099
|
-
this.update();
|
|
20100
|
-
this.maybeTruncateChoices();
|
|
20101
|
-
} })), this.error !== undefined && this.error.length > 0 && (h("label", { class: "xpl-input-error", htmlFor: this.id }, h("svg", { width: "10", height: "11", viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" })), this.error))), h("input", { type: "hidden", value: this.value })));
|
|
20102
|
-
}
|
|
20103
|
-
};
|
|
20104
|
-
|
|
20105
|
-
const XplTable$1 = class extends HTMLElement$1 {
|
|
20106
|
-
constructor() {
|
|
20107
|
-
super();
|
|
20108
|
-
this.__registerHost();
|
|
20109
|
-
this.tableSelect = createEvent(this, "tableSelect", 7);
|
|
20110
|
-
this.selectAll = (e) => {
|
|
20111
|
-
const { target } = e;
|
|
20112
|
-
if (!(target instanceof HTMLInputElement))
|
|
20113
|
-
return;
|
|
20114
|
-
const { checked } = target;
|
|
20115
|
-
this.areAllSelected = checked;
|
|
20116
|
-
this.selected = this.selected.map(() => checked);
|
|
20117
|
-
this.onChange();
|
|
20118
|
-
};
|
|
20119
|
-
this.selectOne = (e, i) => {
|
|
20120
|
-
const { target } = e;
|
|
20121
|
-
if (!(target instanceof HTMLInputElement))
|
|
20122
|
-
return;
|
|
20123
|
-
const { checked } = target;
|
|
20124
|
-
this.areAllSelected = false;
|
|
20125
|
-
this.selected = this.selected.map((v, _i) => (_i === i ? checked : v));
|
|
20126
|
-
this.onChange();
|
|
20127
|
-
};
|
|
20128
|
-
this.onChange = () => {
|
|
20129
|
-
this.tableSelect.emit({
|
|
20130
|
-
selected: this.selected,
|
|
20131
|
-
areAllSelected: this.areAllSelected,
|
|
20132
|
-
});
|
|
20133
|
-
};
|
|
20134
|
-
this.onScroll = () => {
|
|
20135
|
-
this.hasScrolled = this.container.scrollLeft > 0;
|
|
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();
|
|
20170
|
-
}
|
|
20171
|
-
componentWillLoad() {
|
|
20172
|
-
this.areAllSelected = false;
|
|
20173
|
-
this.setData();
|
|
20174
|
-
}
|
|
20175
|
-
render() {
|
|
20176
|
-
let className = 'xpl-table';
|
|
20177
|
-
if (this.striped)
|
|
20178
|
-
className += ' xpl-table--striped';
|
|
20179
|
-
if (this.freeze)
|
|
20180
|
-
className += ' xpl-table--freeze';
|
|
20181
|
-
if (this.hasScrolled)
|
|
20182
|
-
className += ' xpl-table--has-scrolled';
|
|
20183
|
-
return (h(Host, null, h("div", { class: "xpl-table-container", onScroll: this.onScroll, ref: (el) => (this.container = el) }, h("table", { class: className }, this.columns && (h("thead", null, this.columns.map((column, i) => {
|
|
20184
|
-
return (h("th", null, this.multiselect && i === 0 ? (h("label", { htmlFor: "__xpl-table-th" }, h("input", { checked: this.areAllSelected, id: "__xpl-table-th",
|
|
20185
|
-
// appear indeterminate when at least one but not all
|
|
20186
|
-
// are selected
|
|
20187
|
-
indeterminate: !this
|
|
20188
|
-
.areAllSelected &&
|
|
20189
|
-
this.selected.some((a) => a), onChange: (e) => {
|
|
20190
|
-
this.selectAll(e);
|
|
20191
|
-
}, type: "checkbox" }), column)) : (column)));
|
|
20192
|
-
}))), h("tbody", null, this.rowData.map((row, rowNum) => {
|
|
20193
|
-
return (h("tr", { class: this.selected &&
|
|
20194
|
-
this.selected[rowNum]
|
|
20195
|
-
? 'xpl-table-row-selected'
|
|
20196
|
-
: '' }, row.map((cell, i) => {
|
|
20197
|
-
return (h("td", null, this.multiselect &&
|
|
20198
|
-
i === 0 ? (h("label", { htmlFor: '__xpl-table-row-' +
|
|
20199
|
-
rowNum }, h("input", { id: '__xpl-table-row-' +
|
|
20200
|
-
rowNum, checked: this
|
|
20201
|
-
.selected[rowNum], type: "checkbox", onChange: (e) => this.selectOne(e, rowNum) }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))));
|
|
20202
|
-
})));
|
|
20203
|
-
}))))));
|
|
20204
|
-
}
|
|
20205
|
-
static get watchers() { return {
|
|
20206
|
-
"data": ["watchData"]
|
|
20207
|
-
}; }
|
|
20208
|
-
};
|
|
20209
|
-
|
|
20210
|
-
const XplTag$1 = class extends HTMLElement$1 {
|
|
20211
|
-
constructor() {
|
|
20212
|
-
super();
|
|
20213
|
-
this.__registerHost();
|
|
20214
|
-
this.close = createEvent(this, "close", 7);
|
|
20215
|
-
}
|
|
20216
|
-
render() {
|
|
20217
|
-
return (h(Host, { class: "xpl-tag-container" }, h("button", { class: "xpl-tag", onClick: () => {
|
|
20218
|
-
this.close.emit();
|
|
20219
|
-
} }, h("slot", null)), h("button", { class: "xpl-tag__close", onClick: () => {
|
|
20220
|
-
this.close.emit();
|
|
20221
|
-
} }, "\u00D7")));
|
|
20222
|
-
}
|
|
20223
|
-
};
|
|
20224
|
-
|
|
20225
|
-
const XplToggle$1 = class extends HTMLElement$1 {
|
|
20226
|
-
constructor() {
|
|
20227
|
-
super();
|
|
20228
|
-
this.__registerHost();
|
|
20229
|
-
this.checked = undefined;
|
|
20230
|
-
this.description = undefined;
|
|
20231
|
-
this.disabled = undefined;
|
|
20232
|
-
this.heading = undefined;
|
|
20233
|
-
this.label = undefined;
|
|
20234
|
-
this.name = undefined;
|
|
20235
|
-
this.variant = 'default';
|
|
20236
|
-
this.id = v4();
|
|
20237
|
-
}
|
|
20238
|
-
render() {
|
|
20239
|
-
let containerClassName = 'xpl-toggle-container';
|
|
20240
|
-
if (this.disabled)
|
|
20241
|
-
containerClassName += ' xpl-toggle-container--disabled';
|
|
20242
|
-
let className = 'xpl-toggle';
|
|
20243
|
-
if (this.variant === 'small')
|
|
20244
|
-
className += ' xpl-toggle--small';
|
|
20245
|
-
return (h(Host, { class: containerClassName }, (this.heading || this.description) && (h("label", { class: {
|
|
20246
|
-
'xpl-label': true,
|
|
20247
|
-
'xpl-label--disabled': this.disabled,
|
|
20248
|
-
}, htmlFor: this.id }, this.heading, this.description && (h("small", { class: {
|
|
20249
|
-
'xpl-description': true,
|
|
20250
|
-
'xpl-description--disabled': this.disabled,
|
|
20251
|
-
} }, this.description)))), h("input", { class: className, type: "checkbox", checked: this.checked, disabled: this.disabled, id: this.id, name: this.name }), this.label && h("label", { htmlFor: this.id }, this.label)));
|
|
20252
|
-
}
|
|
20253
|
-
};
|
|
20254
|
-
|
|
20255
|
-
const XplUtilityBar$1 = class extends HTMLElement$1 {
|
|
20256
|
-
constructor() {
|
|
20257
|
-
super();
|
|
20258
|
-
this.__registerHost();
|
|
20259
|
-
this.navOpen = createEvent(this, "navOpen", 7);
|
|
20260
|
-
this.bars = `
|
|
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>
|
|
20262
|
-
`;
|
|
20263
|
-
this.navControl = undefined;
|
|
20264
|
-
this.isNavOpenAtStartup = undefined;
|
|
20265
|
-
this.open = true;
|
|
20266
|
-
}
|
|
20267
|
-
onNavToggle() {
|
|
20268
|
-
this.open = !this.open;
|
|
20269
|
-
this.navOpen.emit(this.open);
|
|
20270
|
-
}
|
|
20271
|
-
componentWillLoad() {
|
|
20272
|
-
this.open =
|
|
20273
|
-
this.isNavOpenAtStartup !== undefined
|
|
20274
|
-
? this.isNavOpenAtStartup
|
|
20275
|
-
: this.open;
|
|
20276
|
-
}
|
|
20277
|
-
render() {
|
|
20278
|
-
return (h(Host, null, h("nav", { "aria-label": "utility navigation bar", class: "xpl-utility-bar" }, this.navControl ? (h("div", null, h("button", { class: "xpl-utility-bar__nav-control", onClick: () => this.onNavToggle(), innerHTML: `${this.bars}` }), h("slot", { name: "aside" }))) : (h("slot", { name: "aside" })), h("slot", { name: "main" }))));
|
|
20279
|
-
}
|
|
20280
|
-
};
|
|
20281
|
-
|
|
20282
|
-
const XplApplicationShell = /*@__PURE__*/proxyCustomElement(XplApplicationShell$1, [4,"xpl-application-shell",{"withSubnav":[4,"with-subnav"],"withUtility":[4,"with-utility"],"navWidth":[1,"nav-width"],"isNavOpenAtStartup":[4,"is-nav-open-at-startup"],"navOpen":[32]},[[0,"navOpen","navToggleHandler"],[0,"navWidth","navWithHandler"],[9,"resize","onWindowResize"]]]);
|
|
20283
|
-
const XplAvatar = /*@__PURE__*/proxyCustomElement(XplAvatar$1, [4,"xpl-avatar",{"color":[1],"disabled":[4],"href":[1],"name":[1],"size":[1],"src":[1],"status":[1],"target":[1]}]);
|
|
20284
|
-
const XplBackdrop = /*@__PURE__*/proxyCustomElement(XplBackdrop$1, [0,"xpl-backdrop",{"relative":[4]}]);
|
|
20285
|
-
const XplBadge = /*@__PURE__*/proxyCustomElement(XplBadge$1, [4,"xpl-badge",{"dot":[4],"variant":[1]}]);
|
|
20286
|
-
const XplBreadcrumbItem = /*@__PURE__*/proxyCustomElement(XplBreadcrumbItem$1, [4,"xpl-breadcrumb-item"]);
|
|
20287
|
-
const XplBreadcrumbs = /*@__PURE__*/proxyCustomElement(XplBreadcrumbs$1, [4,"xpl-breadcrumbs"]);
|
|
20288
|
-
const XplButton = /*@__PURE__*/proxyCustomElement(XplButton$1, [4,"xpl-button",{"disabled":[4],"link":[4],"iconOnly":[4,"icon-only"],"fullWidth":[4,"full-width"],"name":[1],"size":[1],"type":[1],"value":[1],"variant":[1],"state":[1]}]);
|
|
20289
|
-
const XplButtonRow = /*@__PURE__*/proxyCustomElement(XplButtonRow$1, [0,"xpl-button-row",{"primary":[1],"secondary":[1],"tertiary":[1]}]);
|
|
20290
|
-
const XplCheckbox = /*@__PURE__*/proxyCustomElement(XplCheckbox$1, [4,"xpl-checkbox",{"checked":[4],"description":[1],"disabled":[4],"indeterminate":[4],"name":[1],"required":[4],"styled":[4],"value":[1],"id":[32]}]);
|
|
20291
|
-
const XplChoicelist = /*@__PURE__*/proxyCustomElement(XplChoicelist$1, [0,"xpl-choicelist",{"choices":[16],"description":[1],"heading":[1],"multi":[4],"name":[1],"styled":[4],"selected":[32]}]);
|
|
20292
|
-
const XplContentArea = /*@__PURE__*/proxyCustomElement(XplContentArea$1, [4,"xpl-content-area",{"size":[1]}]);
|
|
20293
|
-
const XplDivider = /*@__PURE__*/proxyCustomElement(XplDivider$1, [4,"xpl-divider",{"tier":[2]}]);
|
|
20294
|
-
const XplDropdown = /*@__PURE__*/proxyCustomElement(XplDropdown$1, [4,"xpl-dropdown",{"isOpen":[1540,"open"],"closeOnSelect":[4,"close-on-select"],"mode":[1],"options":[16],"selectOnFocus":[4,"select-on-focus"],"triggerId":[1,"trigger-id"],"update":[16]}]);
|
|
20295
|
-
const XplDropdownGroup = /*@__PURE__*/proxyCustomElement(XplDropdownGroup$1, [4,"xpl-dropdown-group",{"groupName":[1,"label"],"options":[16]}]);
|
|
20296
|
-
const XplDropdownHeading = /*@__PURE__*/proxyCustomElement(XplDropdownHeading$1, [4,"xpl-dropdown-heading",{"label":[1]}]);
|
|
20297
|
-
const XplDropdownOption = /*@__PURE__*/proxyCustomElement(XplDropdownOption$1, [4,"xpl-dropdown-option",{"isDisabled":[516,"disabled"],"label":[1],"isSelected":[1540,"selected"]}]);
|
|
20298
|
-
const XplGrid = /*@__PURE__*/proxyCustomElement(XplGrid$1, [0,"xpl-grid"]);
|
|
20299
|
-
const XplGridItem = /*@__PURE__*/proxyCustomElement(XplGridItem$1, [4,"xpl-grid-item",{"xs":[2],"sm":[2],"md":[2],"lg":[2]}]);
|
|
20300
|
-
const XplInput = /*@__PURE__*/proxyCustomElement(XplInput$1, [0,"xpl-input",{"_id":[1],"autocomplete":[1],"dateFormat":[1,"date-format"],"description":[1],"disabled":[4],"error":[1],"label":[1],"max":[8],"maxCharacterCount":[2,"max-character-count"],"min":[8],"mode":[1],"multiline":[4],"name":[1],"placeholder":[1],"post":[1],"pre":[1],"readonly":[4],"required":[4],"step":[2],"type":[1],"value":[1],"characterCount":[32],"passwordVisible":[32]}]);
|
|
20301
|
-
const XplList = /*@__PURE__*/proxyCustomElement(XplList$1, [0,"xpl-list",{"items":[16]}]);
|
|
20302
|
-
const XplMainNav = /*@__PURE__*/proxyCustomElement(XplMainNav$1, [4,"xpl-main-nav",{"width":[1]}]);
|
|
20303
|
-
const XplNavItem = /*@__PURE__*/proxyCustomElement(XplNavItem$1, [4,"xpl-nav-item",{"navControl":[4,"nav-control"]}]);
|
|
20304
|
-
const XplPagination = /*@__PURE__*/proxyCustomElement(XplPagination$1, [0,"xpl-pagination",{"total":[2],"perPage":[2,"per-page"],"waitForCallback":[4,"wait-for-callback"],"current":[32]}]);
|
|
20305
|
-
const XplRadio = /*@__PURE__*/proxyCustomElement(XplRadio$1, [4,"xpl-radio",{"checked":[4],"description":[1],"disabled":[4],"name":[1],"required":[4],"styled":[4],"value":[1],"id":[32]}]);
|
|
20306
|
-
const XplSecondaryNav = /*@__PURE__*/proxyCustomElement(XplSecondaryNav$1, [4,"xpl-secondary-nav"]);
|
|
20307
|
-
const XplSelect = /*@__PURE__*/proxyCustomElement(XplSelect$1, [0,"xpl-select",{"choices":[16],"description":[1],"disabled":[4],"error":[1],"label":[1],"mode":[1],"placeholder":[1],"truncate":[4],"active":[32],"id":[32],"keepFocus":[32],"selected":[32],"value":[32],"displayValue":[32],"visibleChoices":[32]}]);
|
|
20308
|
-
const XplTable = /*@__PURE__*/proxyCustomElement(XplTable$1, [0,"xpl-table",{"columns":[16],"data":[16],"freeze":[4],"multiselect":[4],"striped":[4],"areAllSelected":[32],"rowData":[32],"hasScrolled":[32],"selected":[32]}]);
|
|
20309
|
-
const XplTag = /*@__PURE__*/proxyCustomElement(XplTag$1, [4,"xpl-tag"]);
|
|
20310
|
-
const XplToggle = /*@__PURE__*/proxyCustomElement(XplToggle$1, [0,"xpl-toggle",{"checked":[4],"description":[1],"disabled":[4],"heading":[1],"label":[1],"name":[1],"variant":[1],"id":[32]}]);
|
|
20311
|
-
const XplUtilityBar = /*@__PURE__*/proxyCustomElement(XplUtilityBar$1, [4,"xpl-utility-bar",{"navControl":[4,"nav-control"],"isNavOpenAtStartup":[4,"is-nav-open-at-startup"],"open":[32]}]);
|
|
20312
|
-
const defineCustomElements = (opts) => {
|
|
20313
|
-
if (typeof customElements !== 'undefined') {
|
|
20314
|
-
[
|
|
20315
|
-
XplApplicationShell,
|
|
20316
|
-
XplAvatar,
|
|
20317
|
-
XplBackdrop,
|
|
20318
|
-
XplBadge,
|
|
20319
|
-
XplBreadcrumbItem,
|
|
20320
|
-
XplBreadcrumbs,
|
|
20321
|
-
XplButton,
|
|
20322
|
-
XplButtonRow,
|
|
20323
|
-
XplCheckbox,
|
|
20324
|
-
XplChoicelist,
|
|
20325
|
-
XplContentArea,
|
|
20326
|
-
XplDivider,
|
|
20327
|
-
XplDropdown,
|
|
20328
|
-
XplDropdownGroup,
|
|
20329
|
-
XplDropdownHeading,
|
|
20330
|
-
XplDropdownOption,
|
|
20331
|
-
XplGrid,
|
|
20332
|
-
XplGridItem,
|
|
20333
|
-
XplInput,
|
|
20334
|
-
XplList,
|
|
20335
|
-
XplMainNav,
|
|
20336
|
-
XplNavItem,
|
|
20337
|
-
XplPagination,
|
|
20338
|
-
XplRadio,
|
|
20339
|
-
XplSecondaryNav,
|
|
20340
|
-
XplSelect,
|
|
20341
|
-
XplTable,
|
|
20342
|
-
XplTag,
|
|
20343
|
-
XplToggle,
|
|
20344
|
-
XplUtilityBar
|
|
20345
|
-
].forEach(cmp => {
|
|
20346
|
-
if (!customElements.get(cmp.is)) {
|
|
20347
|
-
customElements.define(cmp.is, cmp, opts);
|
|
20348
|
-
}
|
|
20349
|
-
});
|
|
20350
|
-
}
|
|
20351
|
-
};
|
|
20352
|
-
|
|
20353
|
-
export { XplApplicationShell, XplAvatar, XplBackdrop, XplBadge, XplBreadcrumbItem, XplBreadcrumbs, XplButton, XplButtonRow, XplCheckbox, XplChoicelist, XplContentArea, XplDivider, XplDropdown, XplDropdownGroup, XplDropdownHeading, XplDropdownOption, XplGrid, XplGridItem, XplInput, XplList, XplMainNav, XplNavItem, XplPagination, XplRadio, XplSecondaryNav, XplSelect, XplTable, XplTag, XplToggle, XplUtilityBar, defineCustomElements };
|
|
16054
|
+
//# sourceMappingURL=regular-133c23b5.js.map
|