bromcom-ui 2.11.1-rc.9-3 → 2.11.2-test.0
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/dist/bromcom-ui/bromcom-ui.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-00c28e19.entry.js +5 -0
- package/dist/bromcom-ui/p-0533a1b0.entry.js +5 -0
- package/dist/bromcom-ui/{p-2cd6cdee.js → p-09318a64.js} +1 -1
- package/dist/bromcom-ui/p-0a44db90.entry.js +5 -0
- package/dist/bromcom-ui/p-0cd4e8a1.entry.js +5 -0
- package/dist/bromcom-ui/p-195c1819.entry.js +5 -0
- package/dist/bromcom-ui/p-19783732.entry.js +5 -0
- package/dist/bromcom-ui/p-1e5df686.entry.js +5 -0
- package/dist/bromcom-ui/p-207c20c6.entry.js +5 -0
- package/dist/bromcom-ui/p-2270e612.entry.js +5 -0
- package/dist/bromcom-ui/p-34740cfd.entry.js +5 -0
- package/dist/bromcom-ui/p-350719ca.entry.js +5 -0
- package/dist/bromcom-ui/p-385a50b0.entry.js +5 -0
- package/dist/bromcom-ui/p-3b38d001.js +5 -0
- package/dist/bromcom-ui/p-3c04d0f7.entry.js +5 -0
- package/dist/bromcom-ui/p-3e2fb868.entry.js +5 -0
- package/dist/bromcom-ui/p-44faabe9.entry.js +5 -0
- package/dist/bromcom-ui/{p-5a391fcd.js → p-4757735e.js} +1 -1
- package/dist/bromcom-ui/p-4d5eb722.entry.js +5 -0
- package/dist/bromcom-ui/p-50926f4c.entry.js +5 -0
- package/dist/bromcom-ui/p-5196912d.js +5 -0
- package/dist/bromcom-ui/p-543457d1.entry.js +5 -0
- package/dist/bromcom-ui/p-58ca54dc.js +5 -0
- package/dist/bromcom-ui/p-60dd2172.entry.js +5 -0
- package/dist/bromcom-ui/p-6146d180.entry.js +5 -0
- package/dist/bromcom-ui/p-62804f2c.entry.js +5 -0
- package/dist/bromcom-ui/p-666d9883.entry.js +5 -0
- package/dist/bromcom-ui/{p-0eacfbb2.entry.js → p-695d8d34.entry.js} +1 -1
- package/dist/bromcom-ui/{p-14ed8029.entry.js → p-69c64256.entry.js} +1 -1
- package/dist/bromcom-ui/p-6c6beb41.entry.js +5 -0
- package/dist/bromcom-ui/p-6e5f5f36.js +1 -1
- package/dist/bromcom-ui/p-6e961eb9.entry.js +7 -0
- package/dist/bromcom-ui/p-70c2412a.entry.js +5 -0
- package/dist/bromcom-ui/p-7175c984.entry.js +5 -0
- package/dist/bromcom-ui/p-7222a8db.entry.js +5 -0
- package/dist/bromcom-ui/p-75e4f799.entry.js +5 -0
- package/dist/bromcom-ui/p-76f6db61.entry.js +5 -0
- package/dist/bromcom-ui/p-79153d4a.entry.js +5 -0
- package/dist/bromcom-ui/p-7b9e8f58.entry.js +5 -0
- package/dist/bromcom-ui/p-80a43d63.js +5 -0
- package/dist/bromcom-ui/p-86384d20.entry.js +5 -0
- package/dist/bromcom-ui/p-894c02ef.entry.js +5 -0
- package/dist/bromcom-ui/p-8b00d553.entry.js +5 -0
- package/dist/bromcom-ui/p-8b3eafe7.entry.js +5 -0
- package/dist/bromcom-ui/p-9098db35.entry.js +5 -0
- package/dist/bromcom-ui/p-a0d6d680.js +1 -1
- package/dist/bromcom-ui/p-a313fba6.js +1 -1
- package/dist/bromcom-ui/p-a42fbe84.entry.js +5 -0
- package/dist/bromcom-ui/p-a516049b.entry.js +5 -0
- package/dist/bromcom-ui/p-a62adacd.js +5 -0
- package/dist/bromcom-ui/p-aaf36d5c.entry.js +5 -0
- package/dist/bromcom-ui/p-ab2dcd70.entry.js +5 -0
- package/dist/bromcom-ui/{p-db15dca3.entry.js → p-ad8d9e10.entry.js} +1 -1
- package/dist/bromcom-ui/{p-ede82918.js → p-b12c8235.js} +1 -1
- package/dist/bromcom-ui/p-b2c6659a.entry.js +5 -0
- package/dist/bromcom-ui/p-b381e7f1.js +19 -0
- package/dist/bromcom-ui/{p-90223f9f.entry.js → p-b3f7b64d.entry.js} +1 -1
- package/dist/bromcom-ui/p-b4755ed0.entry.js +5 -0
- package/dist/bromcom-ui/{p-a018f340.entry.js → p-b66e0388.entry.js} +1 -1
- package/dist/bromcom-ui/{p-adcb30bc.entry.js → p-b6e6027b.entry.js} +1 -1
- package/dist/bromcom-ui/{p-35c215f2.entry.js → p-b85fd5f4.entry.js} +1 -1
- package/dist/bromcom-ui/p-c6b86846.entry.js +5 -0
- package/dist/bromcom-ui/p-cc449a87.entry.js +5 -0
- package/dist/bromcom-ui/{p-8b31581f.js → p-ccbb5a6b.js} +1 -1
- package/dist/bromcom-ui/p-d01426b6.entry.js +5 -0
- package/dist/bromcom-ui/p-d43d75d2.entry.js +5 -0
- package/dist/bromcom-ui/p-d51f76b2.js +5 -0
- package/dist/bromcom-ui/p-ef4baf81.entry.js +5 -0
- package/dist/bromcom-ui/p-f2b520a4.entry.js +5 -0
- package/dist/bromcom-ui/{p-5bf1657b.entry.js → p-f2e06aca.entry.js} +1 -1
- package/dist/bromcom-ui/{p-930f3618.js → p-f6169b46.js} +1 -1
- package/dist/bromcom-ui/p-f7e70814.entry.js +5 -0
- package/dist/bromcom-ui/{p-6f37a4d7.entry.js → p-fc27c9ca.entry.js} +1 -1
- package/dist/cjs/Overflow-a821abd0.js +2769 -0
- package/dist/cjs/{bcm-1d1fcf21.js → bcm-489c9b1a.js} +4 -4
- package/dist/cjs/bcm-accordion.cjs.entry.js +74 -0
- package/dist/cjs/bcm-alert.cjs.entry.js +4 -4
- package/dist/cjs/bcm-attendance-actions-comment.cjs.entry.js +8 -9
- package/dist/cjs/bcm-attendance-actions-dropdown.cjs.entry.js +8 -9
- package/dist/cjs/bcm-attendance-actions.cjs.entry.js +329 -0
- package/dist/cjs/bcm-attendance.cjs.entry.js +35 -0
- package/dist/cjs/bcm-avatar_2.cjs.entry.js +209 -0
- package/dist/cjs/bcm-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/bcm-button-group.cjs.entry.js +92 -0
- package/dist/cjs/bcm-button_15.cjs.entry.js +18623 -0
- package/dist/cjs/bcm-caption.cjs.entry.js +9 -10
- package/dist/cjs/bcm-card.cjs.entry.js +5 -5
- package/dist/cjs/bcm-checkbox-group.cjs.entry.js +415 -0
- package/dist/cjs/{bcm-checkbox-lite_8.cjs.entry.js → bcm-checkbox-lite_9.cjs.entry.js} +26 -6
- package/dist/cjs/bcm-checkbox_2.cjs.entry.js +194 -0
- package/dist/cjs/bcm-chip-group.cjs.entry.js +9 -10
- package/dist/cjs/bcm-chip.cjs.entry.js +91 -0
- package/dist/cjs/bcm-collapse.cjs.entry.js +2 -2
- package/dist/cjs/bcm-color-input.cjs.entry.js +76 -0
- package/dist/cjs/bcm-default.cjs.entry.js +2 -2
- package/dist/cjs/bcm-drawer.cjs.entry.js +95 -0
- package/dist/cjs/bcm-dropdown.cjs.entry.js +119 -0
- package/dist/cjs/bcm-error-layout.cjs.entry.js +1 -1
- package/dist/cjs/bcm-expansion-panel.cjs.entry.js +116 -0
- package/dist/cjs/bcm-input-custom.cjs.entry.js +2 -2
- package/dist/cjs/bcm-input-dropdown.cjs.entry.js +10 -11
- package/dist/cjs/bcm-item.cjs.entry.js +72 -0
- package/dist/cjs/bcm-items.cjs.entry.js +49 -0
- package/dist/cjs/bcm-link.cjs.entry.js +3 -3
- package/dist/cjs/bcm-list_3.cjs.entry.js +1970 -0
- package/dist/cjs/bcm-menu.cjs.entry.js +150 -0
- package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +6 -7
- package/dist/cjs/bcm-modal-2-header.cjs.entry.js +6 -7
- package/dist/cjs/bcm-modal-2.cjs.entry.js +7 -8
- package/dist/cjs/bcm-modal.cjs.entry.js +157 -0
- package/dist/cjs/bcm-number-input.cjs.entry.js +9 -10
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +115 -0
- package/dist/cjs/bcm-popconfirm.cjs.entry.js +101 -0
- package/dist/cjs/bcm-popover.cjs.entry.js +9 -10
- package/dist/cjs/bcm-progress.cjs.entry.js +162 -0
- package/dist/cjs/bcm-radio-group.cjs.entry.js +160 -0
- package/dist/cjs/bcm-radio.cjs.entry.js +64 -0
- package/dist/cjs/bcm-range.cjs.entry.js +6 -6
- package/dist/cjs/bcm-select.cjs.entry.js +2 -2
- package/dist/cjs/bcm-shortcut.cjs.entry.js +64 -0
- package/dist/cjs/bcm-skeleton.cjs.entry.js +6 -7
- package/dist/cjs/bcm-step.cjs.entry.js +89 -0
- package/dist/cjs/bcm-stepper.cjs.entry.js +239 -0
- package/dist/cjs/bcm-switch.cjs.entry.js +151 -0
- package/dist/cjs/bcm-tab-group.cjs.entry.js +209 -0
- package/dist/cjs/bcm-tab-item-header.cjs.entry.js +58 -0
- package/dist/cjs/bcm-tab-item.cjs.entry.js +90 -0
- package/dist/cjs/bcm-table.cjs.entry.js +6 -7
- package/dist/cjs/bcm-tag.cjs.entry.js +15 -15
- package/dist/cjs/bcm-text.cjs.entry.js +49 -0
- package/dist/cjs/bcm-textarea.cjs.entry.js +163 -0
- package/dist/cjs/bcm-toast.cjs.entry.js +11 -11
- package/dist/cjs/bromcom-ui.cjs.js +3 -3
- package/dist/cjs/{caption-template-85a18b6d.js → caption-template-086e9cac.js} +2 -2
- package/dist/cjs/{floating-ui-5b396838.js → floating-ui-21890d11.js} +2 -2
- package/dist/cjs/{generate-f73a098d.js → generate-64f84d95.js} +1 -1
- package/dist/cjs/{global-baf04c81.js → global-895f2946.js} +1 -1
- package/dist/cjs/input-template-9c106337.js +92 -0
- package/dist/cjs/json-parse-decarator-9db107be.js +40 -0
- package/dist/cjs/{label-template-e83447b5.js → label-template-94b3d775.js} +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{number-helper-0543a62e.js → number-helper-f9323233.js} +1 -1
- package/dist/cjs/old-bcm-popover-box.cjs.entry.js +7 -7
- package/dist/cjs/old-bcm-popover.cjs.entry.js +5 -5
- package/dist/cjs/{package-e717a31f.js → package-992c024f.js} +1 -1
- package/dist/cjs/{popover-placement-02e6101b.js → popover-placement-e7d6eabd.js} +1 -1
- package/dist/cjs/{slot-template-df7b5b59.js → slot-template-c8e2816c.js} +1 -1
- package/dist/cjs/stepper-states-b3496b3f.js +85 -0
- package/dist/cjs/{string-helper-9cdfb273.js → string-helper-f9184277.js} +2 -2
- package/dist/cjs/tooltip-helper-cb99c02e.js +157 -0
- package/dist/cjs/{validators-77768582.js → validators-abb0434a.js} +6 -1
- package/dist/collection/components/atoms/avatar/avatar.js +1 -1
- package/dist/collection/components/atoms/badge/badge.js +1 -1
- package/dist/collection/components/atoms/badge/badge.style.js +1 -1
- package/dist/collection/components/atoms/button/button.css +13 -13
- package/dist/collection/components/atoms/button/button.js +14 -14
- package/dist/collection/components/atoms/chip/chip.css +4 -4
- package/dist/collection/components/atoms/chip/chip.js +3 -3
- package/dist/collection/components/molecules/checkbox/group.css +2 -2
- package/dist/collection/components/molecules/checkbox/group.js +1 -1
- package/dist/collection/components/molecules/color-input/color-input.js +1 -1
- package/dist/collection/components/molecules/empty/empty.js +1 -1
- package/dist/collection/components/molecules/error-layout/error-layout.js +1 -1
- package/dist/collection/components/molecules/expansion-panel/expansion-panel.js +1 -1
- package/dist/collection/components/molecules/input/input.js +1 -1
- package/dist/collection/components/molecules/input-dropdown/input-dropdown.js +1 -1
- package/dist/collection/components/molecules/menu/menu.css +4 -4
- package/dist/collection/components/molecules/modal/modal.css +1 -1
- package/dist/collection/components/molecules/radio/radio-group.js +1 -1
- package/dist/collection/components/molecules/radio/radio.js +1 -1
- package/dist/collection/components/molecules/range/range.js +1 -1
- package/dist/collection/components/molecules/switch/switch.css +2 -2
- package/dist/collection/components/molecules/tab-group/tab-group.js +2 -2
- package/dist/collection/components/molecules/tab-group/tab-item-header.js +5 -5
- package/dist/collection/components/molecules/tooltip/tooltip.js +1 -1
- package/dist/collection/components/organism/list/list.css +2 -3
- package/dist/collection/components/organism/list/list.js +2 -2
- package/dist/collection/components/other/attendance/attendance.js +1 -1
- package/dist/collection/components/third-parts/rc-picker/date.js +1 -1
- package/dist/collection/components/third-parts/rc-picker/rc-picker.css +40 -5
- package/dist/collection/components/third-parts/rc-picker/rc-picker.js +11 -2
- package/dist/collection/stories/ui-library/components/date/argTypes_common.js +0 -1
- package/dist/collection/templates/button-template.js +1 -1
- package/dist/collection/templates/caption-template.js +2 -2
- package/dist/collection/templates/input-template.js +1 -1
- package/dist/collection/templates/label-template.js +1 -1
- package/dist/collection/templates/list-item-template.js +1 -1
- package/dist/collection/templates/list-template.js +9 -3
- package/dist/components/{raf.js → Overflow.js} +692 -69
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/bcm-attendance.js +1 -1
- package/dist/components/bcm-checkbox-group.js +2 -2
- package/dist/components/bcm-color-input.js +1 -1
- package/dist/components/bcm-date.js +1 -1
- package/dist/components/bcm-error-layout.js +1 -1
- package/dist/components/bcm-expansion-panel.js +1 -1
- package/dist/components/bcm-input-dropdown.js +1 -1
- package/dist/components/bcm-modal.js +1 -1
- package/dist/components/bcm-radio-group.js +1 -1
- package/dist/components/bcm-range.js +1 -1
- package/dist/components/bcm-switch.js +1 -1
- package/dist/components/bcm-tab-group.js +2 -2
- package/dist/components/bcm-tab-item-header.js +5 -5
- package/dist/components/button.js +16 -16
- package/dist/components/caption-template.js +2 -2
- package/dist/components/chip.js +4 -4
- package/dist/components/empty.js +1 -1
- package/dist/components/generate.js +1 -1
- package/dist/components/input-template.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/list.js +13 -7
- package/dist/components/menu.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/rc-overflow.js +1 -593
- package/dist/components/rc-picker.js +8620 -8025
- package/dist/components/tooltip.js +1 -1
- package/dist/esm/Overflow-2cffcda0.js +2750 -0
- package/dist/esm/bcm-a50d55ba.js +1 -1
- package/dist/esm/bcm-accordion.entry.js +70 -0
- package/dist/esm/bcm-alert.entry.js +2 -2
- package/dist/esm/bcm-attendance-actions-comment.entry.js +5 -6
- package/dist/esm/bcm-attendance-actions-dropdown.entry.js +5 -6
- package/dist/esm/bcm-attendance-actions.entry.js +325 -0
- package/dist/esm/bcm-attendance.entry.js +31 -0
- package/dist/esm/bcm-avatar_2.entry.js +204 -0
- package/dist/esm/bcm-breadcrumb.entry.js +2 -2
- package/dist/esm/bcm-button-group.entry.js +88 -0
- package/dist/esm/bcm-button_15.entry.js +18605 -0
- package/dist/esm/bcm-caption.entry.js +6 -7
- package/dist/esm/bcm-card.entry.js +2 -2
- package/dist/esm/bcm-checkbox-group.entry.js +411 -0
- package/dist/esm/{bcm-checkbox-lite_8.entry.js → bcm-checkbox-lite_9.entry.js} +24 -5
- package/dist/esm/bcm-checkbox_2.entry.js +189 -0
- package/dist/esm/bcm-chip-group.entry.js +7 -8
- package/dist/esm/bcm-chip.entry.js +87 -0
- package/dist/esm/bcm-collapse.entry.js +2 -2
- package/dist/esm/bcm-color-input.entry.js +72 -0
- package/dist/esm/bcm-default.entry.js +2 -2
- package/dist/esm/bcm-drawer.entry.js +91 -0
- package/dist/esm/bcm-dropdown.entry.js +115 -0
- package/dist/esm/bcm-error-layout.entry.js +1 -1
- package/dist/esm/bcm-expansion-panel.entry.js +112 -0
- package/dist/esm/bcm-input-custom.entry.js +2 -2
- package/dist/esm/bcm-input-dropdown.entry.js +7 -8
- package/dist/esm/bcm-item.entry.js +68 -0
- package/dist/esm/bcm-items.entry.js +45 -0
- package/dist/esm/bcm-link.entry.js +1 -1
- package/dist/esm/bcm-list_3.entry.js +1964 -0
- package/dist/esm/bcm-menu.entry.js +146 -0
- package/dist/esm/bcm-modal-2-footer.entry.js +4 -5
- package/dist/esm/bcm-modal-2-header.entry.js +4 -5
- package/dist/esm/bcm-modal-2.entry.js +5 -6
- package/dist/esm/bcm-modal.entry.js +153 -0
- package/dist/esm/bcm-number-input.entry.js +6 -7
- package/dist/esm/bcm-popconfirm-box.entry.js +111 -0
- package/dist/esm/bcm-popconfirm.entry.js +97 -0
- package/dist/esm/bcm-popover.entry.js +5 -6
- package/dist/esm/bcm-progress.entry.js +158 -0
- package/dist/esm/bcm-radio-group.entry.js +156 -0
- package/dist/esm/bcm-radio.entry.js +60 -0
- package/dist/esm/bcm-range.entry.js +4 -4
- package/dist/esm/bcm-shortcut.entry.js +60 -0
- package/dist/esm/bcm-skeleton.entry.js +4 -5
- package/dist/esm/bcm-step.entry.js +85 -0
- package/dist/esm/bcm-stepper.entry.js +235 -0
- package/dist/esm/bcm-switch.entry.js +147 -0
- package/dist/esm/bcm-tab-group.entry.js +205 -0
- package/dist/esm/bcm-tab-item-header.entry.js +54 -0
- package/dist/esm/bcm-tab-item.entry.js +86 -0
- package/dist/esm/bcm-table.entry.js +4 -5
- package/dist/esm/bcm-tag.entry.js +4 -4
- package/dist/esm/bcm-text.entry.js +45 -0
- package/dist/esm/bcm-textarea.entry.js +159 -0
- package/dist/esm/bcm-toast.entry.js +3 -3
- package/dist/esm/bromcom-ui.js +3 -3
- package/dist/esm/{caption-template-d7953d13.js → caption-template-fd7738eb.js} +2 -2
- package/dist/esm/floating-ui-3f4394da.js +1 -1
- package/dist/esm/{generate-c2c0b02e.js → generate-56856b63.js} +1 -1
- package/dist/esm/{global-2473677b.js → global-c0272f2f.js} +1 -1
- package/dist/esm/input-template-19a34625.js +90 -0
- package/dist/esm/json-parse-decarator-c9a132f1.js +38 -0
- package/dist/esm/{label-template-a26f76c0.js → label-template-374fbdcd.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{number-helper-75447fa6.js → number-helper-0501b786.js} +1 -1
- package/dist/esm/old-bcm-popover-box.entry.js +3 -3
- package/dist/esm/old-bcm-popover.entry.js +3 -3
- package/dist/esm/{package-28dc6847.js → package-a9b6e2c6.js} +1 -1
- package/dist/esm/stepper-states-a4b1efb3.js +83 -0
- package/dist/esm/string-helper-3592bdc2.js +1 -1
- package/dist/esm/tooltip-helper-de7eb9a3.js +155 -0
- package/dist/esm/{validators-5a383988.js → validators-be951131.js} +6 -2
- package/dist/types/templates/list-template.d.ts +0 -1
- package/package.json +2 -2
- package/dist/bromcom-ui/p-1345d51b.entry.js +0 -5
- package/dist/bromcom-ui/p-178fa936.entry.js +0 -5
- package/dist/bromcom-ui/p-3361f6c9.entry.js +0 -5
- package/dist/bromcom-ui/p-350dbff0.entry.js +0 -5
- package/dist/bromcom-ui/p-3cdfd8eb.entry.js +0 -5
- package/dist/bromcom-ui/p-5a22b74b.entry.js +0 -5
- package/dist/bromcom-ui/p-626a65e9.js +0 -5
- package/dist/bromcom-ui/p-627c7769.entry.js +0 -5
- package/dist/bromcom-ui/p-64f21481.entry.js +0 -20
- package/dist/bromcom-ui/p-70253803.entry.js +0 -5
- package/dist/bromcom-ui/p-7fd22a35.entry.js +0 -5
- package/dist/bromcom-ui/p-a0f44b56.entry.js +0 -5
- package/dist/bromcom-ui/p-a4b675ef.entry.js +0 -5
- package/dist/bromcom-ui/p-abd2f9ff.entry.js +0 -5
- package/dist/bromcom-ui/p-bb46d881.entry.js +0 -5
- package/dist/bromcom-ui/p-bca0ff0a.entry.js +0 -5
- package/dist/bromcom-ui/p-c10b07cc.entry.js +0 -5
- package/dist/bromcom-ui/p-c7030364.entry.js +0 -5
- package/dist/bromcom-ui/p-dc607ae4.entry.js +0 -5
- package/dist/bromcom-ui/p-de0b0192.entry.js +0 -5
- package/dist/bromcom-ui/p-e10780ed.entry.js +0 -5
- package/dist/bromcom-ui/p-e497cf5d.entry.js +0 -5
- package/dist/bromcom-ui/p-e93d6619.js +0 -5
- package/dist/bromcom-ui/p-ebeb9689.entry.js +0 -5
- package/dist/bromcom-ui/p-eca0acda.js +0 -5
- package/dist/bromcom-ui/p-fba1682e.entry.js +0 -5
- package/dist/cjs/bcm-accordion_46.cjs.entry.js +0 -24086
- package/dist/cjs/bcm-date-picker.cjs.entry.js +0 -182
- package/dist/cjs/bcm-datetime-picker.cjs.entry.js +0 -1450
- package/dist/cjs/bcm-form-2.cjs.entry.js +0 -212
- package/dist/cjs/bcm-old-input.cjs.entry.js +0 -397
- package/dist/cjs/bcm-time-picker.cjs.entry.js +0 -150
- package/dist/cjs/datetime-helper-eaf4fadb.js +0 -11
- package/dist/esm/bcm-accordion_46.entry.js +0 -24037
- package/dist/esm/bcm-date-picker.entry.js +0 -178
- package/dist/esm/bcm-datetime-picker.entry.js +0 -1446
- package/dist/esm/bcm-form-2.entry.js +0 -208
- package/dist/esm/bcm-old-input.entry.js +0 -393
- package/dist/esm/bcm-time-picker.entry.js +0 -146
- package/dist/esm/datetime-helper-df25808a.js +0 -9
|
@@ -1,1446 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built with Stencil
|
|
3
|
-
* Copyright (c) Bromcom.
|
|
4
|
-
*/
|
|
5
|
-
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-0615c2b8.js';
|
|
6
|
-
import { D as DragDirections, E as ElementDragger } from './element-dragger-89bb52fd.js';
|
|
7
|
-
import { c as classnames } from './index-f549811f.js';
|
|
8
|
-
import { D as DateTimeHelper } from './datetime-helper-df25808a.js';
|
|
9
|
-
import { d as delay } from './utils-57652744.js';
|
|
10
|
-
import { G as Generate } from './generate-c2c0b02e.js';
|
|
11
|
-
import { a as Bcm } from './bcm-a50d55ba.js';
|
|
12
|
-
import { g as getPlacement, s as setPosition } from './popover-placement-d12fec40.js';
|
|
13
|
-
import { L as LabelTemplate } from './label-template-a26f76c0.js';
|
|
14
|
-
import { I as IsLoad } from './is-load-decorator-8277e3b8.js';
|
|
15
|
-
import './_commonjsHelpers-82aa9212.js';
|
|
16
|
-
import './package-28dc6847.js';
|
|
17
|
-
import './colors-c530a5b8.js';
|
|
18
|
-
import './string-helper-3592bdc2.js';
|
|
19
|
-
|
|
20
|
-
var Months;
|
|
21
|
-
(function (Months) {
|
|
22
|
-
Months["january"] = "january";
|
|
23
|
-
Months["february"] = "february";
|
|
24
|
-
Months["march"] = "march";
|
|
25
|
-
Months["april"] = "april";
|
|
26
|
-
Months["may"] = "may";
|
|
27
|
-
Months["june"] = "june";
|
|
28
|
-
Months["july"] = "july";
|
|
29
|
-
Months["august"] = "august";
|
|
30
|
-
Months["september"] = "september";
|
|
31
|
-
Months["october"] = "october";
|
|
32
|
-
Months["november"] = "november";
|
|
33
|
-
Months["december"] = "december";
|
|
34
|
-
})(Months || (Months = {}));
|
|
35
|
-
var Days;
|
|
36
|
-
(function (Days) {
|
|
37
|
-
Days["sunday"] = "sunday";
|
|
38
|
-
Days["monday"] = "monday";
|
|
39
|
-
Days["tuesday"] = "tuesday";
|
|
40
|
-
Days["wednesday"] = "wednesday";
|
|
41
|
-
Days["thursday"] = "thursday";
|
|
42
|
-
Days["friday"] = "friday";
|
|
43
|
-
Days["saturday"] = "saturday";
|
|
44
|
-
})(Days || (Days = {}));
|
|
45
|
-
/**
|
|
46
|
-
* 'type' prop predefined values
|
|
47
|
-
*/
|
|
48
|
-
var Types;
|
|
49
|
-
(function (Types) {
|
|
50
|
-
Types["datetime"] = "datetime";
|
|
51
|
-
Types["range"] = "range";
|
|
52
|
-
Types["date"] = "date";
|
|
53
|
-
Types["time"] = "time";
|
|
54
|
-
})(Types || (Types = {}));
|
|
55
|
-
|
|
56
|
-
const datetimePickerCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}:host{display:inline-flex;flex-direction:column;position:relative;width:100%;max-width:256px;margin:0;margin-bottom:8px}:host(.full-width){max-width:100%}:host(.no-margin){margin:0}:host(.hidden){display:none}:host(.linked-component){display:none}.toggle{cursor:pointer}.toggle.disabled{cursor:not-allowed}.modules{display:flex}.picker-label{user-select:none;line-height:1}.datetime-picker{position:absolute;top:-1000px;display:inline-flex;flex-direction:column;box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);opacity:0;visibility:hidden;transition:transform 0.2s ease, opacity 0.3s ease;transform:scale(0.8) translateY(-100px);background-color:#ffffff;min-height:356px;max-height:356px;box-sizing:border-box;z-index:-1000}.datetime-picker.alignment-left{left:0}.datetime-picker.alignment-right{right:0}.datetime-picker.open{top:calc(100% - 28px);z-index:10000;opacity:1;visibility:visible;transform:scale(1) translateY(0)}.datetime-picker.open.no-caption{top:100%}.actions{display:flex;align-items:center;justify-content:space-between;padding:8px;margin-top:auto;border-top:1px solid var(--bcm-color-grey-6)}.actions .current-date{font-size:14px;line-height:22px;color:var(--bcm-color-prime-blue-6);text-transform:capitalize}.date-container+.time-container{border-left:1px solid #cecece}.time-container{width:185px}.time-container .bcm-datetime-picker__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;max-height:60px;border-bottom:1px solid var(--bcm-color-grey-4)}.time-container .bcm-datetime-picker__header .now{font-size:14px;line-height:22px;cursor:pointer;color:var(--bcm-color-prime-blue-6);user-select:none}.time-container .bcm-datetime-picker__content{position:relative;display:flex}.time-container .hours,.time-container .minutes,.time-container .time-period{position:relative;flex:1 1 100%;max-width:100%;height:280px;overflow:hidden}.time-container .hours .items>span,.time-container .minutes .items>span,.time-container .time-period .items>span{font-size:14px;color:var(--bcm-color-grey-8)}.time-container .hours .items>span.selected,.time-container .minutes .items>span.selected,.time-container .time-period .items>span.selected{color:var(--bcm-color-prime-blue-6)}.date-container{width:364px;}.date-container .bcm-datetime-picker__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;max-height:60px;border-bottom:1px solid var(--bcm-color-grey-4)}.date-container .bcm-datetime-picker__header .month-year-wrapper{display:flex;align-items:center;justify-content:center;margin:0 4px;min-width:125px}.date-container .bcm-datetime-picker__header .month-year{font-size:16px;line-height:24px}.date-container .bcm-datetime-picker__header .month-year{display:flex;align-items:center}.date-container .bcm-datetime-picker__header .month-year button{display:flex;align-items:center;box-shadow:none;background:transparent;outline:none;appearance:none;border:none;color:var(--bcm-color-prime-blue-6);cursor:pointer}.date-container .bcm-datetime-picker__header .month{text-transform:capitalize}.date-container .bcm-datetime-picker__header .year{padding-left:4px}.date-container .bcm-datetime-picker__header .today{font-size:14px;line-height:22px;cursor:pointer;color:var(--bcm-color-prime-blue-6);user-select:none}.date-container .bcm-datetime-picker__content{display:flex}.date-container .years{position:relative;flex:0 0 70px;max-width:70px;height:280px;overflow:hidden;background-color:var(--bcm-color-grey-2)}.date-container .days{width:100%}.date-container .day-numbers,.date-container .day-labels{display:grid;grid-template-columns:repeat(7, 1fr)}.date-container .day-numbers{padding:24px 24px}.date-container .day-numbers>span,.date-container .day-labels span{text-align:center}.date-container .day-numbers>span{position:relative;padding-bottom:100%;cursor:pointer}.date-container .day-numbers>span.not-this-month{color:var(--bcm-color-grey-4)}.date-container .day-numbers>span.is-weekend{color:var(--bcm-color-prime-blue-3)}.date-container .day-numbers>span.is-disabled-date:not(.today){color:var(--bcm-color-grey-4);cursor:not-allowed}.date-container .day-numbers>span.is-disabled-date:not(.today):before{opacity:0 !important}.date-container .day-numbers>span.today{color:var(--bcm-color-prime-blue-6)}.date-container .day-numbers>span.today:before{opacity:1;background-color:var(--bcm-color-prime-blue-2);border:1px solid var(--bcm-color-prime-blue-6)}.date-container .day-numbers>span.selected-start{background:linear-gradient(90deg, white 50%, #8abde2 50%) !important}.date-container .day-numbers>span.selected-end{background:linear-gradient(90deg, #8abde2 50%, white 50%) !important}.date-container .day-numbers>span.range{background:#8abde2}.date-container .day-numbers>span.range:not(.today){color:#ffffff}.date-container .day-numbers>span.range:not(.today):before{background-color:var(--bcm-color-prime-blue-6)}.date-container .day-numbers>span.range.is-weekend:not(.today){color:var(--bcm-color-prime-blue-2)}.date-container .day-numbers>span.selected,.date-container .day-numbers>span.selected-end{color:#ffffff}.date-container .day-numbers>span.selected:before,.date-container .day-numbers>span.selected-end:before{opacity:1;background-color:var(--bcm-color-prime-blue-6)}.date-container .day-numbers.start-1>span:first-child{grid-column:1}.date-container .day-numbers.start-2>span:first-child{grid-column:2}.date-container .day-numbers.start-3>span:first-child{grid-column:3}.date-container .day-numbers.start-4>span:first-child{grid-column:4}.date-container .day-numbers.start-5>span:first-child{grid-column:5}.date-container .day-numbers.start-6>span:first-child{grid-column:6}.date-container .day-numbers.start-7>span:first-child{grid-column:7}.date-container .day-numbers>span:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;border-radius:50%;background-color:var(--bcm-color-grey-4);opacity:0;box-sizing:border-box}.date-container .day-numbers>span:hover.not-this-month:not(.is-weekend){color:var(--bcm-color-grey-6)}.date-container .day-numbers>span:hover:before{opacity:1}.date-container .day-numbers .number{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.date-container .day-labels{padding:24px 40px 0 40px}.date-container .day-labels span{font-size:12px;color:var(--bcm-color-grey-6)}.date-container .day-labels span:nth-child(7n+6),.date-container .day-labels span:nth-child(7n+7){color:var(--bcm-color-prime-blue-3)}.years .items,.hours .items,.minutes .items,.time-period .items{position:relative;display:flex;flex-direction:column;z-index:0;transform:translateY(0);scroll-behavior:smooth}.years .items>span,.hours .items>span,.minutes .items>span,.time-period .items>span{text-align:center;font-size:12px;min-height:26px;max-height:26px;line-height:26px;color:var(--bcm-color-grey-8);user-select:none}.years:before,.years:after,.hours:before,.hours:after,.minutes:before,.minutes:after,.time-period:before,.time-period:after{content:\"\";position:absolute;left:0;width:100%;height:40px}.years:before,.hours:before,.minutes:before,.time-period:before{top:-40px;box-shadow:0 10px 100px 70px #ffffff;z-index:1}.years:after,.hours:after,.minutes:after,.time-period:after{bottom:-40px;box-shadow:0 -10px 100px 70px #ffffff;z-index:2}.select-strip{position:absolute;width:100%;top:50%;left:0;transform:translateY(-50%);min-height:26px;max-height:26px;border:1px solid var(--bcm-color-grey-5);border-left:0;border-right:0;pointer-events:none;box-sizing:border-box}.bcm-label{font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-bottom:4px;font-weight:500;color:#475569}.bcm-label.tw-text-1{font-size:10px;line-height:18px}.bcm-label.tw-text-2{font-size:12px;line-height:20px}.bcm-label.tw-text-3{font-size:14px;line-height:22px}.bcm-caption-area{color:#dc2626;font-weight:400;justify-content:space-between;align-items:flex-start;flex-direction:row;min-height:20px;display:flex;margin-top:4px;font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bcm-caption-area.tw-text-1{font-size:10px;line-height:18px}.bcm-caption-area.tw-text-2{font-size:12px;line-height:20px}.bcm-caption-area.tw-text-3{font-size:14px;line-height:22px}.picker-input-container{display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch}";
|
|
57
|
-
|
|
58
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
59
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
60
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
61
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
62
|
-
else
|
|
63
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
64
|
-
if (d = decorators[i])
|
|
65
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
66
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
67
|
-
};
|
|
68
|
-
const stringify = JSON.stringify;
|
|
69
|
-
const BcmDatetimePicker = class {
|
|
70
|
-
constructor(hostRef) {
|
|
71
|
-
registerInstance(this, hostRef);
|
|
72
|
-
this.load = createEvent(this, "bcm-load", 7);
|
|
73
|
-
this.change = createEvent(this, "bcm-change", 7);
|
|
74
|
-
this.bcmOpen = createEvent(this, "bcm-open", 7);
|
|
75
|
-
this.inputId = null;
|
|
76
|
-
this.emptyState = false;
|
|
77
|
-
this.initialized = false;
|
|
78
|
-
this.disabledDatesList = { min: null, max: null, dates: [] };
|
|
79
|
-
this.dayNumbers = [];
|
|
80
|
-
this.valueText = null;
|
|
81
|
-
this.dataIsValid = false;
|
|
82
|
-
this._id = Generate.UID();
|
|
83
|
-
this.date = new Date();
|
|
84
|
-
this.endDate = null;
|
|
85
|
-
this.type = Types.datetime;
|
|
86
|
-
this.disabled = false;
|
|
87
|
-
this.disabledDates = '';
|
|
88
|
-
this.value = null;
|
|
89
|
-
this._open = false;
|
|
90
|
-
this.hidden = false;
|
|
91
|
-
this.name = undefined;
|
|
92
|
-
this.fullWidth = false;
|
|
93
|
-
this.required = false;
|
|
94
|
-
this.label = undefined;
|
|
95
|
-
this.placeholder = undefined;
|
|
96
|
-
this.minYear = 1900;
|
|
97
|
-
this.maxYear = 2200;
|
|
98
|
-
this.noCaption = false;
|
|
99
|
-
this.noMargin = false;
|
|
100
|
-
this.captionError = undefined;
|
|
101
|
-
this.caption = '';
|
|
102
|
-
this.captionType = 'default';
|
|
103
|
-
this.alignment = undefined;
|
|
104
|
-
this.placement = Bcm.Placement['bottom-start'];
|
|
105
|
-
this.linkedComponent = undefined;
|
|
106
|
-
this.clearable = false;
|
|
107
|
-
this.years = [];
|
|
108
|
-
this.hours = [];
|
|
109
|
-
this.minutes = [];
|
|
110
|
-
this.hasDateModule = false;
|
|
111
|
-
this.hasTimeModule = false;
|
|
112
|
-
this.renderDate = undefined;
|
|
113
|
-
this.selectedDate = undefined;
|
|
114
|
-
this.selectedEndDate = undefined;
|
|
115
|
-
this.error = false;
|
|
116
|
-
this.errorText = '';
|
|
117
|
-
this.tick = {};
|
|
118
|
-
}
|
|
119
|
-
markForCheck() {
|
|
120
|
-
this.tick = Generate.UID();
|
|
121
|
-
}
|
|
122
|
-
openChanged() {
|
|
123
|
-
this.bcmOpen.emit(this._open);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* @ComponentMethod
|
|
127
|
-
*/
|
|
128
|
-
componentWillLoad() {
|
|
129
|
-
this.inputId = 'picker-input-' + this._id;
|
|
130
|
-
this.hasDateModule = this.type === Types.datetime
|
|
131
|
-
|| this.type === Types.date
|
|
132
|
-
|| this.type === Types.range;
|
|
133
|
-
this.hasTimeModule = this.type === Types.datetime
|
|
134
|
-
|| this.type === Types.time;
|
|
135
|
-
this.prepareDisabledDates();
|
|
136
|
-
this.setData();
|
|
137
|
-
// Generate year, hour, minute sequences
|
|
138
|
-
// #
|
|
139
|
-
if (!this.initialized) {
|
|
140
|
-
for (let i = this.minYear; i <= this.maxYear; i++)
|
|
141
|
-
this.years.push(i);
|
|
142
|
-
for (let i = 0; i <= 23; i++)
|
|
143
|
-
this.hours.push(i);
|
|
144
|
-
for (let i = 0; i <= 59; i++)
|
|
145
|
-
this.minutes.push(i);
|
|
146
|
-
this.load.emit();
|
|
147
|
-
}
|
|
148
|
-
this.initialized = true;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @ComponentMethod
|
|
152
|
-
*/
|
|
153
|
-
componentDidRender() {
|
|
154
|
-
// Create years selection
|
|
155
|
-
// #
|
|
156
|
-
if (this.hasDateModule && !this.yearsDragger) {
|
|
157
|
-
this.createDragSelection('years', this.yearsElement, this.yearsWrapperElement, this.yearsStripElement, DragDirections.y);
|
|
158
|
-
this.createWheelChange('years', this.yearsWrapperElement, this.yearsStripElement);
|
|
159
|
-
this.setDragSelection('years', this.currentDate.year);
|
|
160
|
-
}
|
|
161
|
-
// Create hours selection
|
|
162
|
-
// #
|
|
163
|
-
if (this.hasTimeModule && !this.hoursDragger) {
|
|
164
|
-
this.createDragSelection('hours', this.hoursElement, this.hoursWrapperElement, this.timeStripElement, DragDirections.y);
|
|
165
|
-
this.createWheelChange('hours', this.hoursWrapperElement, this.timeStripElement);
|
|
166
|
-
this.setDragSelection('hours', this.currentDate.hour);
|
|
167
|
-
}
|
|
168
|
-
// Create minutes selection
|
|
169
|
-
// #
|
|
170
|
-
if (this.hasTimeModule && !this.minutesDragger) {
|
|
171
|
-
this.createDragSelection('minutes', this.minutesElement, this.minutesWrapperElement, this.timeStripElement, DragDirections.y);
|
|
172
|
-
this.createWheelChange('minutes', this.minutesWrapperElement, this.timeStripElement);
|
|
173
|
-
this.setDragSelection('minutes', this.currentDate.minute);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @desc
|
|
178
|
-
* @param newValue
|
|
179
|
-
*/
|
|
180
|
-
renderDateChange() {
|
|
181
|
-
if (!this.initialized)
|
|
182
|
-
return;
|
|
183
|
-
this.setData();
|
|
184
|
-
this.hasDateModule && this.setDragSelection('years', this.currentDate.year);
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* @desc
|
|
188
|
-
* @param newValue
|
|
189
|
-
*/
|
|
190
|
-
openChange(newValue) {
|
|
191
|
-
if (newValue) {
|
|
192
|
-
this.calculateLocation();
|
|
193
|
-
// Create years selection
|
|
194
|
-
// #
|
|
195
|
-
if (this.hasDateModule) {
|
|
196
|
-
this.createDragSelection('years', this.yearsElement, this.yearsWrapperElement, this.yearsStripElement, DragDirections.y);
|
|
197
|
-
this.createWheelChange('years', this.yearsWrapperElement, this.yearsStripElement);
|
|
198
|
-
this.setDragSelection('years', this.currentDate.year);
|
|
199
|
-
}
|
|
200
|
-
// Create hours selection
|
|
201
|
-
// #
|
|
202
|
-
if (this.hasTimeModule) {
|
|
203
|
-
this.createDragSelection('hours', this.hoursElement, this.hoursWrapperElement, this.timeStripElement, DragDirections.y);
|
|
204
|
-
this.createWheelChange('hours', this.hoursWrapperElement, this.timeStripElement);
|
|
205
|
-
this.setDragSelection('hours', this.currentDate.hour, true);
|
|
206
|
-
}
|
|
207
|
-
// Create minutes selection
|
|
208
|
-
// #
|
|
209
|
-
if (this.hasTimeModule) {
|
|
210
|
-
this.createDragSelection('minutes', this.minutesElement, this.minutesWrapperElement, this.timeStripElement, DragDirections.y);
|
|
211
|
-
this.createWheelChange('minutes', this.minutesWrapperElement, this.timeStripElement);
|
|
212
|
-
this.setDragSelection('minutes', this.currentDate.minute, true);
|
|
213
|
-
}
|
|
214
|
-
this.markForCheck();
|
|
215
|
-
forceUpdate(this.el);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* @desc
|
|
220
|
-
* @param newValue
|
|
221
|
-
*/
|
|
222
|
-
valueChange(newValue, oldValue) {
|
|
223
|
-
const errorObject1 = { isValid: false, value: this.valueText };
|
|
224
|
-
const errorObject2 = { isValid: false, value: this.inputElement.value };
|
|
225
|
-
if (!newValue) {
|
|
226
|
-
this.change.emit();
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
if (this.type !== Types.range && this.error) {
|
|
230
|
-
this.change.emit(errorObject2);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
try {
|
|
234
|
-
if ((oldValue && stringify(newValue.dateObject) !== stringify(oldValue.dateObject)) || (!oldValue && newValue)) {
|
|
235
|
-
if (this.type === Types.date || this.type === Types.datetime) {
|
|
236
|
-
this.change.emit(newValue);
|
|
237
|
-
}
|
|
238
|
-
if (this.type === Types.time) {
|
|
239
|
-
this.change.emit(newValue);
|
|
240
|
-
// this.change.emit({
|
|
241
|
-
// time: newValue.time,
|
|
242
|
-
// timeObject: newValue.dateObject
|
|
243
|
-
// })
|
|
244
|
-
}
|
|
245
|
-
if (this.type === Types.range) {
|
|
246
|
-
const dateObject = newValue.dateObject;
|
|
247
|
-
if (dateObject.start.date && dateObject.end.date) {
|
|
248
|
-
if (newValue.isValid) {
|
|
249
|
-
this.change.emit({
|
|
250
|
-
isValid: newValue.isValid,
|
|
251
|
-
value: newValue.value,
|
|
252
|
-
start: dateObject.start,
|
|
253
|
-
end: dateObject.end
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
this.change.emit(errorObject1);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
catch (exception) { }
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* @desc
|
|
267
|
-
* @param newValue -
|
|
268
|
-
*/
|
|
269
|
-
disabledDatesChange(newValue) {
|
|
270
|
-
if (newValue) {
|
|
271
|
-
this.prepareDisabledDates();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* @desc
|
|
276
|
-
* @param date
|
|
277
|
-
*/
|
|
278
|
-
stringToDate(date) {
|
|
279
|
-
const isDate = !!date.getMonth;
|
|
280
|
-
if (!isDate) {
|
|
281
|
-
return new Date(Date.parse(this.switchDDMM(date)));
|
|
282
|
-
}
|
|
283
|
-
return date;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* @desc
|
|
287
|
-
* @param date
|
|
288
|
-
*/
|
|
289
|
-
dateToString(date) {
|
|
290
|
-
if (!(date instanceof Date))
|
|
291
|
-
return false;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
*
|
|
295
|
-
* @param str
|
|
296
|
-
*/
|
|
297
|
-
switchDDMM(str) {
|
|
298
|
-
if (!str)
|
|
299
|
-
return;
|
|
300
|
-
const parts = str.split('/');
|
|
301
|
-
if (str.indexOf('/') === -1 || parts.length !== 3)
|
|
302
|
-
return str;
|
|
303
|
-
return `${parts[1]}/${parts[0]}/${parts[2]}`;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* @desc
|
|
307
|
-
*/
|
|
308
|
-
setData() {
|
|
309
|
-
this.date = this.stringToDate(this.date);
|
|
310
|
-
if (!this.initialized && !this.renderDate) {
|
|
311
|
-
this.renderDate = this.date && this.date || new Date();
|
|
312
|
-
}
|
|
313
|
-
if (!this.initialized && this.endDate) {
|
|
314
|
-
this.selectedEndDate = this.stringToDate(this.endDate);
|
|
315
|
-
//this.currentEndDate = this.createDateObject(this.selectedEndDate)
|
|
316
|
-
}
|
|
317
|
-
const date = this.renderDate;
|
|
318
|
-
this.currentDate = this.createDateObject(date);
|
|
319
|
-
// Calculate days in current
|
|
320
|
-
// month
|
|
321
|
-
this.dayNumbers = this.getMonthDayNumbers(date).map(day => {
|
|
322
|
-
return {
|
|
323
|
-
day,
|
|
324
|
-
thisMonth: true,
|
|
325
|
-
isWeekend: this.getDayIsWeekend(date, day),
|
|
326
|
-
today: this.getIsCurrentDate(date, day),
|
|
327
|
-
date: this.getTargetDayDate(date, day)
|
|
328
|
-
};
|
|
329
|
-
});
|
|
330
|
-
// Add prev month days to
|
|
331
|
-
// empty columns
|
|
332
|
-
if (this.currentDate.year > this.minYear) {
|
|
333
|
-
let targetMonth = new Date(new Date(date).setMonth(this.currentDate.month - 1, 1));
|
|
334
|
-
let targetMonthDayNumbers = this.getMonthDayNumbers(targetMonth).reverse();
|
|
335
|
-
let max = this.currentDate.monthFirstDay;
|
|
336
|
-
for (let i = 1; i < (max === 0 ? 7 : max); i++) {
|
|
337
|
-
const day = targetMonthDayNumbers[i - 1];
|
|
338
|
-
this.dayNumbers.unshift({
|
|
339
|
-
day,
|
|
340
|
-
prevMonth: true,
|
|
341
|
-
isWeekend: this.getDayIsWeekend(targetMonth, day),
|
|
342
|
-
date: this.getTargetDayDate(targetMonth, day)
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
// Add next month days to
|
|
347
|
-
// rest of columns
|
|
348
|
-
if (this.currentDate.year < this.maxYear) {
|
|
349
|
-
let targetMonth = new Date(new Date(date).setMonth(this.currentDate.month + 1));
|
|
350
|
-
let targetMonthDayNumbers = this.getMonthDayNumbers(targetMonth);
|
|
351
|
-
let max = 42 - this.dayNumbers.length;
|
|
352
|
-
for (let i = 0; i < max; i++) {
|
|
353
|
-
const day = targetMonthDayNumbers[i];
|
|
354
|
-
this.dayNumbers.push({
|
|
355
|
-
day,
|
|
356
|
-
nextMonth: true,
|
|
357
|
-
isWeekend: this.getDayIsWeekend(targetMonth, day),
|
|
358
|
-
date: this.getTargetDayDate(targetMonth, day)
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (!this.emptyState) {
|
|
363
|
-
this.valueText = this.getValueText();
|
|
364
|
-
}
|
|
365
|
-
forceUpdate(this.el);
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* @desc
|
|
369
|
-
*/
|
|
370
|
-
prepareDisabledDates() {
|
|
371
|
-
if (!this.disabledDates)
|
|
372
|
-
return;
|
|
373
|
-
let disabledDatesData = null;
|
|
374
|
-
if (typeof this.disabledDates === 'string') {
|
|
375
|
-
try {
|
|
376
|
-
disabledDatesData = JSON.parse(this.disabledDates);
|
|
377
|
-
}
|
|
378
|
-
catch (e) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
else
|
|
383
|
-
disabledDatesData = this.disabledDates;
|
|
384
|
-
// Convert dates to list
|
|
385
|
-
// #
|
|
386
|
-
if (disabledDatesData.dates && disabledDatesData.dates.length && !!disabledDatesData.dates.length) {
|
|
387
|
-
const disabledDates = disabledDatesData.dates.map(date => {
|
|
388
|
-
const tempDate = new Date(date);
|
|
389
|
-
if (tempDate.toString().toLowerCase() === 'invalid date')
|
|
390
|
-
return null;
|
|
391
|
-
else
|
|
392
|
-
return tempDate;
|
|
393
|
-
}).filter(date => date);
|
|
394
|
-
this.disabledDatesList.dates = disabledDates;
|
|
395
|
-
}
|
|
396
|
-
// Get min & max range
|
|
397
|
-
// #
|
|
398
|
-
if (disabledDatesData.min &&
|
|
399
|
-
disabledDatesData.max && (disabledDatesData.min.getTime() > disabledDatesData.max.getTime() ||
|
|
400
|
-
disabledDatesData.max.getTime() < disabledDatesData.min.getTime())) {
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
if (disabledDatesData.min && disabledDatesData.min instanceof Date) {
|
|
404
|
-
this.disabledDatesList.min = new Date(disabledDatesData.min.toDateString());
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
delete this.disabledDatesList.min;
|
|
408
|
-
}
|
|
409
|
-
if (disabledDatesData.max && disabledDatesData.max instanceof Date) {
|
|
410
|
-
this.disabledDatesList.max = new Date(disabledDatesData.max.toDateString());
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
delete this.disabledDatesList.max;
|
|
414
|
-
}
|
|
415
|
-
const value = this.inputElement && this.inputElement.value;
|
|
416
|
-
value && this.setDataFromText(value);
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
*
|
|
420
|
-
* @param target
|
|
421
|
-
* @param wheelTriggerElement
|
|
422
|
-
* @param strip
|
|
423
|
-
*/
|
|
424
|
-
createWheelChange(target, wheelTriggerElement, strip) {
|
|
425
|
-
/**
|
|
426
|
-
* [ Mouse Event: wheel ]
|
|
427
|
-
*/
|
|
428
|
-
wheelTriggerElement.addEventListener('wheel', (event) => {
|
|
429
|
-
const moveDown = event.deltaY > 0;
|
|
430
|
-
const dragger = this[target + 'Dragger'];
|
|
431
|
-
const draggerOffsetY = dragger.getOffset().top;
|
|
432
|
-
const childIdx = this.getTargetChildByDragPosition({ y: draggerOffsetY }, strip);
|
|
433
|
-
let nextChild = moveDown ? childIdx + 1 : childIdx - 1;
|
|
434
|
-
// Array bounds check
|
|
435
|
-
// #
|
|
436
|
-
nextChild < 0
|
|
437
|
-
? (nextChild = 0) : typeof this[target][nextChild] === 'undefined'
|
|
438
|
-
? (nextChild = this[target].length - 1) : nextChild;
|
|
439
|
-
if (this.type == "time" && !this.selectedDate) {
|
|
440
|
-
this.setTime();
|
|
441
|
-
}
|
|
442
|
-
this.setDragSelection(target, this[target][nextChild], true, true);
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* @desc
|
|
447
|
-
*/
|
|
448
|
-
createDragSelection(target, element, dragTriggerElement, strip, direction) {
|
|
449
|
-
const dragger = target + 'Dragger';
|
|
450
|
-
this[dragger] = new ElementDragger({
|
|
451
|
-
target: element,
|
|
452
|
-
trigger: dragTriggerElement,
|
|
453
|
-
direction: direction,
|
|
454
|
-
useTransform: true,
|
|
455
|
-
limit: {
|
|
456
|
-
y: {
|
|
457
|
-
max: strip.offsetTop - (strip.offsetHeight / 2),
|
|
458
|
-
min: (element.offsetHeight - (strip.offsetTop + strip.offsetHeight / 2)) * -1
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
/**
|
|
463
|
-
* [ ElementDragger Event: end ]
|
|
464
|
-
*/
|
|
465
|
-
this[dragger].on('end', (pos) => {
|
|
466
|
-
const childIdx = this.getTargetChildByDragPosition(pos, strip);
|
|
467
|
-
// Select target child when dragging
|
|
468
|
-
// end
|
|
469
|
-
this.selectTargetChildByDragIdx(childIdx, strip, this[dragger]);
|
|
470
|
-
// Set target value
|
|
471
|
-
// #
|
|
472
|
-
this.setDragSelection(target, this[target][childIdx], false);
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* @desc Calculates which child in center of strip
|
|
477
|
-
* for drag areas
|
|
478
|
-
*/
|
|
479
|
-
getTargetChildByDragPosition({ y }, strip) {
|
|
480
|
-
const stripHeight = strip.offsetHeight;
|
|
481
|
-
const stripCenter = stripHeight / 2;
|
|
482
|
-
const stripTriggerY = strip.offsetTop - (stripCenter);
|
|
483
|
-
const childY = -(y - stripTriggerY - (stripCenter));
|
|
484
|
-
return Math.floor(childY / stripHeight);
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* @esc
|
|
488
|
-
* @param target
|
|
489
|
-
* @param childIdx
|
|
490
|
-
*/
|
|
491
|
-
selectTargetChildByDragIdx(childIdx, strip, dragger, anim = true) {
|
|
492
|
-
const y = ((strip.offsetHeight / 2) + strip.offsetTop) - ((childIdx + 1) * (strip.offsetHeight));
|
|
493
|
-
dragger.setPosition({ y, anim });
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* @desc
|
|
497
|
-
* @param year
|
|
498
|
-
*/
|
|
499
|
-
setDragSelection(target, value, scroll = true, anim = false) {
|
|
500
|
-
// if (!value) return
|
|
501
|
-
const childIdx = this[target].findIndex((itemValue) => itemValue === value);
|
|
502
|
-
scroll && this.selectTargetChildByDragIdx(childIdx, this[target === 'years' ? target + 'StripElement' : 'timeStripElement'], this[target + 'Dragger'], anim);
|
|
503
|
-
switch (target) {
|
|
504
|
-
case 'years':
|
|
505
|
-
this.date.setFullYear(value);
|
|
506
|
-
break;
|
|
507
|
-
case 'hours':
|
|
508
|
-
this.date.setHours(value);
|
|
509
|
-
break;
|
|
510
|
-
case 'minutes':
|
|
511
|
-
this.date.setMinutes(value);
|
|
512
|
-
break;
|
|
513
|
-
}
|
|
514
|
-
this.renderDate = this.date;
|
|
515
|
-
this.setData();
|
|
516
|
-
if (this.selectedDate) {
|
|
517
|
-
this.setValue();
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* @desc
|
|
522
|
-
* @returns
|
|
523
|
-
*/
|
|
524
|
-
getHours12() {
|
|
525
|
-
const hours = (this.date.getHours() + 24) % 12 || 12;
|
|
526
|
-
return hours > 12 ? hours - 12 : hours;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* @desc
|
|
530
|
-
* @param date
|
|
531
|
-
* @param excludeTime -
|
|
532
|
-
*/
|
|
533
|
-
createDateObject(date, { excludeTime = false, exactMonthNumber = false } = {}) {
|
|
534
|
-
const dateYear = date.getFullYear();
|
|
535
|
-
const year = dateYear >= this.maxYear
|
|
536
|
-
? this.maxYear : dateYear <= this.minYear
|
|
537
|
-
? this.minYear : dateYear;
|
|
538
|
-
return Object.assign(Object.assign({ year, day: date.getDate(), month: date.getMonth() + (exactMonthNumber ? 1 : 0), dayOfWeek: date.getDay(), monthFirstDay: new Date(new Date(date).setDate(1)).getDay() }, !excludeTime && { hour: date.getHours() }), !excludeTime && { minute: date.getMinutes() });
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* @desc
|
|
542
|
-
* @param max
|
|
543
|
-
*/
|
|
544
|
-
generateDaysArrayFromMax(max) {
|
|
545
|
-
return Array.from(Array(max + 1).keys()).slice(1);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* @desc
|
|
549
|
-
* @param date
|
|
550
|
-
*/
|
|
551
|
-
getMonthDayNumbers(date) {
|
|
552
|
-
const totalDays = this.getDaysInMonth(date.getMonth(), date.getFullYear());
|
|
553
|
-
return this.generateDaysArrayFromMax(totalDays);
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* @desc
|
|
557
|
-
* @param date
|
|
558
|
-
* @param day
|
|
559
|
-
*/
|
|
560
|
-
getTargetDayDate(date, day) {
|
|
561
|
-
return new Date(new Date(date).setDate(day));
|
|
562
|
-
}
|
|
563
|
-
/**
|
|
564
|
-
* @desc
|
|
565
|
-
* @param date
|
|
566
|
-
* @param day
|
|
567
|
-
*/
|
|
568
|
-
getDayIsWeekend(date, day) {
|
|
569
|
-
const dayOfWeek = new Date(new Date(date).setDate(day)).getDay();
|
|
570
|
-
return (dayOfWeek === 6) || (dayOfWeek === 0);
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* @desc
|
|
574
|
-
* @param date
|
|
575
|
-
*/
|
|
576
|
-
getClock(date) {
|
|
577
|
-
date = date || new Date();
|
|
578
|
-
const hours = date.getHours();
|
|
579
|
-
const minutes = date.getMinutes();
|
|
580
|
-
const seconds = date.getSeconds();
|
|
581
|
-
const milis = date.getMilliseconds();
|
|
582
|
-
return { hours, minutes, seconds, milis };
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* @desc
|
|
586
|
-
*/
|
|
587
|
-
setValue(reset) {
|
|
588
|
-
var _a, _b, _c;
|
|
589
|
-
const date = new Date(this.date.setHours(Number(this.currentDate.hour), Number(this.currentDate.minute)));
|
|
590
|
-
if (reset) {
|
|
591
|
-
this.value = null;
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
this.dataIsValid = true;
|
|
595
|
-
if (this.type === Types.datetime) {
|
|
596
|
-
const dateObject = Object.assign({}, this.currentDate);
|
|
597
|
-
dateObject.month += 1;
|
|
598
|
-
if (((_a = this.value) === null || _a === void 0 ? void 0 : _a.value) != this.valueText) {
|
|
599
|
-
this.value = {
|
|
600
|
-
isValid: this.dataIsValid,
|
|
601
|
-
date: date,
|
|
602
|
-
timestamp: date.getTime(),
|
|
603
|
-
dateObject,
|
|
604
|
-
value: this.valueText
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
if (this.type === Types.date) {
|
|
609
|
-
const dateObject = Object.assign({}, this.currentDate);
|
|
610
|
-
delete dateObject.hour;
|
|
611
|
-
delete dateObject.minute;
|
|
612
|
-
dateObject.month += 1;
|
|
613
|
-
if (((_b = this.value) === null || _b === void 0 ? void 0 : _b.value) != this.valueText) {
|
|
614
|
-
this.value = {
|
|
615
|
-
isValid: this.dataIsValid,
|
|
616
|
-
date,
|
|
617
|
-
timestamp: date.getTime(),
|
|
618
|
-
dateObject,
|
|
619
|
-
value: this.valueText
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
if (this.type === Types.time) {
|
|
624
|
-
const getTimeText = this.getTimeText();
|
|
625
|
-
const dateObject = Object.assign({}, this.currentDate);
|
|
626
|
-
dateObject.month += 1;
|
|
627
|
-
this.value = {
|
|
628
|
-
isValid: this.dataIsValid,
|
|
629
|
-
date: date,
|
|
630
|
-
timestamp: date.getTime(),
|
|
631
|
-
time: getTimeText,
|
|
632
|
-
dateObject,
|
|
633
|
-
timeObject: {
|
|
634
|
-
hours: this.currentDate.hour,
|
|
635
|
-
minutes: this.currentDate.minute
|
|
636
|
-
},
|
|
637
|
-
value: getTimeText
|
|
638
|
-
};
|
|
639
|
-
this.inputElement.value = getTimeText;
|
|
640
|
-
}
|
|
641
|
-
if (this.type === Types.range) {
|
|
642
|
-
if (((_c = this.value) === null || _c === void 0 ? void 0 : _c.value) != this.valueText) {
|
|
643
|
-
this.value = {
|
|
644
|
-
isValid: this.dataIsValid,
|
|
645
|
-
dateObject: {
|
|
646
|
-
start: Object.assign({}, this.selectedDate && {
|
|
647
|
-
date: this.selectedDate,
|
|
648
|
-
timestamp: this.selectedDate.getTime(),
|
|
649
|
-
detail: this.createDateObject(this.selectedDate, {
|
|
650
|
-
excludeTime: true,
|
|
651
|
-
exactMonthNumber: true
|
|
652
|
-
})
|
|
653
|
-
}),
|
|
654
|
-
end: Object.assign({}, this.selectedEndDate && {
|
|
655
|
-
date: this.selectedEndDate,
|
|
656
|
-
timestamp: this.selectedEndDate.getTime(),
|
|
657
|
-
detail: this.createDateObject(this.selectedEndDate, {
|
|
658
|
-
excludeTime: true,
|
|
659
|
-
exactMonthNumber: true
|
|
660
|
-
})
|
|
661
|
-
})
|
|
662
|
-
},
|
|
663
|
-
value: this.valueText
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* @desc
|
|
670
|
-
* @param month
|
|
671
|
-
*/
|
|
672
|
-
setMonth(month) {
|
|
673
|
-
this.renderDate.setDate(1);
|
|
674
|
-
this.renderDate = new Date(this.renderDate.setMonth(month));
|
|
675
|
-
this.setDragSelection('years', this.currentDate.year);
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* @desc
|
|
679
|
-
* @param popupClosing -
|
|
680
|
-
*/
|
|
681
|
-
checkRangeValidation({ popupClosing = false } = {}) {
|
|
682
|
-
if (this.type !== Types.range)
|
|
683
|
-
return true;
|
|
684
|
-
const errorText = 'date range invalid';
|
|
685
|
-
if (popupClosing && (!this.selectedDate || this.selectedDate && !this.selectedEndDate)) {
|
|
686
|
-
this.setError(true, errorText);
|
|
687
|
-
return false;
|
|
688
|
-
}
|
|
689
|
-
if (!popupClosing) {
|
|
690
|
-
this.setError(false);
|
|
691
|
-
return true;
|
|
692
|
-
}
|
|
693
|
-
return true;
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* @desc
|
|
697
|
-
* @param value
|
|
698
|
-
* @param max
|
|
699
|
-
* @returns
|
|
700
|
-
*/
|
|
701
|
-
pad(value, max) {
|
|
702
|
-
return value < max ? '0' : '';
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* @desc
|
|
706
|
-
* @returns
|
|
707
|
-
*/
|
|
708
|
-
isInputClearable() {
|
|
709
|
-
if (this.inputElement && this.inputElement.value) {
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
return false;
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* @desc
|
|
716
|
-
* @param date
|
|
717
|
-
*/
|
|
718
|
-
isDisabledDate(date) {
|
|
719
|
-
if (!!this.disabledDatesList.dates.map(d => this.isSameDate(d, date)).filter(d => d).length)
|
|
720
|
-
return true;
|
|
721
|
-
if (this.disabledDatesList.min) {
|
|
722
|
-
const minDate = new Date(this.disabledDatesList.min);
|
|
723
|
-
if (minDate && minDate.getTime() > date.getTime())
|
|
724
|
-
return true;
|
|
725
|
-
}
|
|
726
|
-
if (this.disabledDatesList.max) {
|
|
727
|
-
const maxDate = new Date(this.disabledDatesList.max);
|
|
728
|
-
if (maxDate && new Date(maxDate.setDate(maxDate.getDate() + 1)).getTime() < date.getTime())
|
|
729
|
-
return true;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* @desc
|
|
734
|
-
* @param date
|
|
735
|
-
*/
|
|
736
|
-
setDate(date, isUserSelect, notClosePicker = false) {
|
|
737
|
-
const isRange = this.type === Types.range;
|
|
738
|
-
const isEndSelect = !!this.selectedEndDate;
|
|
739
|
-
// Check disabled date
|
|
740
|
-
// #
|
|
741
|
-
if ((this.type === Types.date || this.type === Types.datetime) && this.isDisabledDate(date)) {
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
this.emptyState = false;
|
|
745
|
-
if (!isRange || (isRange && !isEndSelect)) {
|
|
746
|
-
this.date = new Date(date.setHours(this.currentDate.hour, this.currentDate.minute));
|
|
747
|
-
}
|
|
748
|
-
isRange && this.checkRangeValidation();
|
|
749
|
-
if (isRange && this.selectedDate && this.selectedEndDate) {
|
|
750
|
-
this.selectedDate = null;
|
|
751
|
-
this.selectedEndDate = null;
|
|
752
|
-
}
|
|
753
|
-
if (isUserSelect) {
|
|
754
|
-
const newDate = new Date(date);
|
|
755
|
-
!isRange
|
|
756
|
-
? this.selectedDate = newDate
|
|
757
|
-
: !this.selectedDate
|
|
758
|
-
? this.selectedDate = newDate
|
|
759
|
-
: this.selectedDate.getTime() > newDate.getTime()
|
|
760
|
-
? (this.selectedEndDate = this.selectedDate) && (this.selectedDate = newDate)
|
|
761
|
-
: this.selectedEndDate = newDate;
|
|
762
|
-
!isRange && (this._open = notClosePicker);
|
|
763
|
-
this.renderDate = this.date;
|
|
764
|
-
this.valueText = this.getValueText();
|
|
765
|
-
this.setValue();
|
|
766
|
-
const splitText = this.valueText.split('/');
|
|
767
|
-
const newValue = this.valueText ? this.changeFormat(new Date(splitText[1] + "/" + splitText[0] + "/" + splitText[2])) : '';
|
|
768
|
-
this.inputElement.value = newValue;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
setDataFromText(text, updateData = false, openPicker = true) {
|
|
772
|
-
let update = false;
|
|
773
|
-
let errorState = '';
|
|
774
|
-
const parsed = this.parse(text);
|
|
775
|
-
if ((this.type === Types.date || this.type === Types.datetime) && this.isDisabledDate(parsed.date)) {
|
|
776
|
-
parsed.dateIsValid = false;
|
|
777
|
-
errorState = 'disabled-date';
|
|
778
|
-
}
|
|
779
|
-
// Check mode datetime
|
|
780
|
-
// #
|
|
781
|
-
if (this.type === Types.datetime && parsed.dateIsValid && parsed.timeIsValid) {
|
|
782
|
-
updateData && this.setDate(parsed.date, true, openPicker);
|
|
783
|
-
updateData && this.setTime(parsed.timeSections[0], parsed.timeSections[1]);
|
|
784
|
-
update = true;
|
|
785
|
-
}
|
|
786
|
-
// Check mode date
|
|
787
|
-
// #
|
|
788
|
-
if (this.type === Types.date && parsed.dateIsValid) {
|
|
789
|
-
updateData && this.setDate(parsed.date, true, openPicker);
|
|
790
|
-
update = true;
|
|
791
|
-
}
|
|
792
|
-
// Check mode time
|
|
793
|
-
// #
|
|
794
|
-
if (this.type === Types.time && parsed.timeIsValid) {
|
|
795
|
-
updateData && this.setTime(parsed.timeSections[0], parsed.timeSections[1]);
|
|
796
|
-
update = true;
|
|
797
|
-
}
|
|
798
|
-
// Check mode range
|
|
799
|
-
// #
|
|
800
|
-
if (this.type === Types.range) {
|
|
801
|
-
if (parsed.dateIsValid && !this.selectedDate) {
|
|
802
|
-
updateData && this.setDate(parsed.date, true, openPicker);
|
|
803
|
-
update = true;
|
|
804
|
-
}
|
|
805
|
-
if (parsed.date2IsValid && !this.selectedEndDate) {
|
|
806
|
-
updateData && this.setDate(parsed.date2, true, openPicker);
|
|
807
|
-
update = true;
|
|
808
|
-
}
|
|
809
|
-
if (this.selectedDate && this.selectedEndDate && parsed.rangeIsValid) {
|
|
810
|
-
if (this.isSameDate(parsed.date2, this.selectedEndDate) && !this.isSameDate(parsed.date, this.selectedDate)) {
|
|
811
|
-
this.selectedDate = null;
|
|
812
|
-
updateData && this.setDate(parsed.date, true, openPicker);
|
|
813
|
-
update = true;
|
|
814
|
-
}
|
|
815
|
-
if (this.isSameDate(parsed.date, this.selectedDate) && !this.isSameDate(parsed.date2, this.selectedEndDate)) {
|
|
816
|
-
this.selectedEndDate = null;
|
|
817
|
-
updateData && this.setDate(parsed.date2, true, openPicker);
|
|
818
|
-
update = true;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
if (this.selectedDate && this.selectedEndDate && !parsed.rangeIsValid && updateData) {
|
|
822
|
-
this.selectedDate = null;
|
|
823
|
-
this.selectedEndDate = null;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
// Fix: render warning
|
|
827
|
-
if (update) {
|
|
828
|
-
if (updateData) {
|
|
829
|
-
this.renderDate = this.date;
|
|
830
|
-
}
|
|
831
|
-
this.setError(false);
|
|
832
|
-
}
|
|
833
|
-
else {
|
|
834
|
-
if (this.type === Types.range && this.selectedDate && this.selectedEndDate && parsed.rangeIsValid) {
|
|
835
|
-
this.setError(false);
|
|
836
|
-
}
|
|
837
|
-
else {
|
|
838
|
-
if (errorState) {
|
|
839
|
-
this.setError(true, (errorState === 'disabled-date' && 'selected date is not allowed'));
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
if (text) {
|
|
843
|
-
this.setError(true, (this.type === Types.datetime && 'invalid date or time') ||
|
|
844
|
-
(this.type === Types.range && 'invalid date range') ||
|
|
845
|
-
(this.type === Types.date && 'The selected date is not allowed.') ||
|
|
846
|
-
(this.type === Types.time && 'invalid time'));
|
|
847
|
-
}
|
|
848
|
-
this.setValue(true);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
const splitText = text.split('/');
|
|
852
|
-
const newValue = text && !this.error ? this.changeFormat(new Date(splitText[1] + "/" + splitText[0] + "/" + splitText[2])) : '';
|
|
853
|
-
this.inputElement.value = newValue;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
/**
|
|
857
|
-
* @desc
|
|
858
|
-
*/
|
|
859
|
-
setDateToday() {
|
|
860
|
-
const date = new Date();
|
|
861
|
-
if (this.type === Types.range) {
|
|
862
|
-
this.selectedDate = null;
|
|
863
|
-
this.selectedEndDate = null;
|
|
864
|
-
}
|
|
865
|
-
this.setDate(date, true, false);
|
|
866
|
-
}
|
|
867
|
-
HourContentDblClick(e) {
|
|
868
|
-
const getPath = Generate.findEventPathWithNodeName(e, 'SPAN');
|
|
869
|
-
if (getPath && getPath.classList.contains('selected')) {
|
|
870
|
-
this.setValue();
|
|
871
|
-
this._open = false;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* @desc
|
|
876
|
-
*/
|
|
877
|
-
setTime(hours, minutes) {
|
|
878
|
-
this.renderDate = new Date(this.date.setHours(Number(hours || this.getClock().hours), Number(minutes || this.getClock().minutes)));
|
|
879
|
-
if (this.type === Types.time) {
|
|
880
|
-
this.selectedDate = this.date;
|
|
881
|
-
}
|
|
882
|
-
const hour = this.currentDate.hour || new Date().getHours();
|
|
883
|
-
const minute = this.currentDate.minute == 0 ? 0 : this.currentDate.minute || new Date().getMinutes();
|
|
884
|
-
this.setDragSelection('hours', hour, true, true);
|
|
885
|
-
this.setDragSelection('minutes', minute, true, true);
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* @desc
|
|
889
|
-
* @param state
|
|
890
|
-
* @param error
|
|
891
|
-
*/
|
|
892
|
-
setError(state = false, error = '') {
|
|
893
|
-
this.error = state;
|
|
894
|
-
this.errorText = !state ? '' : error;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* @desc
|
|
898
|
-
*/
|
|
899
|
-
getError() {
|
|
900
|
-
const { error, errorText } = this;
|
|
901
|
-
return { valid: !error, error, errorText };
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* @desc
|
|
905
|
-
* @param month
|
|
906
|
-
* @param year
|
|
907
|
-
*/
|
|
908
|
-
getDaysInMonth(month, year) {
|
|
909
|
-
return new Date(year, month + 1, 0).getDate();
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* @desc
|
|
913
|
-
* @param date
|
|
914
|
-
* @param day
|
|
915
|
-
* @returns
|
|
916
|
-
*/
|
|
917
|
-
getIsCurrentDate(date, day) {
|
|
918
|
-
const today = new Date();
|
|
919
|
-
return today.getDate() === day
|
|
920
|
-
&& today.getMonth() === date.getMonth()
|
|
921
|
-
&& today.getFullYear() === date.getFullYear();
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* @desc
|
|
925
|
-
* @param date1
|
|
926
|
-
* @param date2
|
|
927
|
-
*/
|
|
928
|
-
isSameDate(date1, date2) {
|
|
929
|
-
return (date1.getFullYear() === date2.getFullYear() &&
|
|
930
|
-
date1.getMonth() === date2.getMonth() &&
|
|
931
|
-
date1.getDate() === date2.getDate());
|
|
932
|
-
}
|
|
933
|
-
/**
|
|
934
|
-
* @desc
|
|
935
|
-
* @param date
|
|
936
|
-
* @returns
|
|
937
|
-
*/
|
|
938
|
-
getSelected(date, endDate = false) {
|
|
939
|
-
const selectPart = endDate ? 'EndDate' : 'Date';
|
|
940
|
-
const targetDate = new Date(this['selected' + selectPart]);
|
|
941
|
-
const year = targetDate.getFullYear();
|
|
942
|
-
const month = targetDate.getMonth();
|
|
943
|
-
const day = targetDate.getDate();
|
|
944
|
-
const isSelected = date.getDate() === day
|
|
945
|
-
&& date.getMonth() === month
|
|
946
|
-
&& date.getFullYear() === year;
|
|
947
|
-
return isSelected;
|
|
948
|
-
}
|
|
949
|
-
/**
|
|
950
|
-
* @desc
|
|
951
|
-
* @param date
|
|
952
|
-
*/
|
|
953
|
-
getDateIsInRange(date) {
|
|
954
|
-
if (this.type !== Types.range || (!this.selectedDate || !this.selectedEndDate))
|
|
955
|
-
return;
|
|
956
|
-
const current = date.getTime();
|
|
957
|
-
const start = this.selectedDate.getTime();
|
|
958
|
-
const end = this.selectedEndDate.getTime();
|
|
959
|
-
return current > start && current < end;
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* @desc
|
|
963
|
-
*/
|
|
964
|
-
getMonthText() {
|
|
965
|
-
return Object.values(Months)[this.renderDate.getMonth()];
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* @desc
|
|
969
|
-
*/
|
|
970
|
-
getCurrentDateText() {
|
|
971
|
-
const dayText = Object.values(Days)[this.currentDate.dayOfWeek];
|
|
972
|
-
const monthText = Object.values(Months)[this.currentDate.month];
|
|
973
|
-
const text = `${dayText}, ${this.currentDate.day}th ${monthText} ${this.currentDate.year}`;
|
|
974
|
-
return text;
|
|
975
|
-
}
|
|
976
|
-
/**
|
|
977
|
-
* @desc
|
|
978
|
-
* @returns
|
|
979
|
-
*/
|
|
980
|
-
getTimeText() {
|
|
981
|
-
const { hour, minute } = this.currentDate;
|
|
982
|
-
return `${hour < 10 ? '0' + hour : hour}:${minute < 10 ? '0' + minute : minute}`;
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
*
|
|
986
|
-
*/
|
|
987
|
-
getValueText() {
|
|
988
|
-
if (!this.selectedDate)
|
|
989
|
-
return '';
|
|
990
|
-
const selectedDate = this.selectedDate;
|
|
991
|
-
const year = selectedDate.getFullYear();
|
|
992
|
-
const day = selectedDate.getDate();
|
|
993
|
-
const baseMonth = selectedDate.getMonth();
|
|
994
|
-
const month = baseMonth + 1;
|
|
995
|
-
let text = '';
|
|
996
|
-
if (this.type === Types.date || this.type === Types.datetime) {
|
|
997
|
-
text = `${day < 10 ? '0' + day : day}/${month < 10 ? '0' + month : month}/${year}`;
|
|
998
|
-
}
|
|
999
|
-
if (this.type === Types.time) {
|
|
1000
|
-
text = this.getTimeText();
|
|
1001
|
-
}
|
|
1002
|
-
if (this.type === Types.datetime) {
|
|
1003
|
-
text = `${text} ${this.getTimeText()}`;
|
|
1004
|
-
}
|
|
1005
|
-
if (this.type === Types.range) {
|
|
1006
|
-
text = `${day < 10 ? '0' + day : day}/${month < 10 ? '0' + month : month}/${year}`;
|
|
1007
|
-
}
|
|
1008
|
-
if (this.type === Types.range && this.selectedEndDate) {
|
|
1009
|
-
const endDate = this.selectedEndDate;
|
|
1010
|
-
const endYear = endDate.getFullYear();
|
|
1011
|
-
const endDay = endDate.getDate();
|
|
1012
|
-
const endBaseMonth = endDate.getMonth();
|
|
1013
|
-
const endMonth = endBaseMonth + 1;
|
|
1014
|
-
text += `-${endDay < 10 ? '0' + endDay : endDay}/${endMonth < 10 ? '0' + endMonth : endMonth}/${endYear}`;
|
|
1015
|
-
}
|
|
1016
|
-
this.setDataFromText(text);
|
|
1017
|
-
return text;
|
|
1018
|
-
}
|
|
1019
|
-
parseDate(input) {
|
|
1020
|
-
var parts = input.split('/');
|
|
1021
|
-
var day = parseInt(parts[0], 10);
|
|
1022
|
-
var month = parseInt(parts[1], 10) - 1;
|
|
1023
|
-
var year = parseInt(parts[2], 10);
|
|
1024
|
-
if (isNaN(day) || isNaN(month) || isNaN(year)) {
|
|
1025
|
-
return 'invalid date';
|
|
1026
|
-
}
|
|
1027
|
-
var date = new Date(year, month, day);
|
|
1028
|
-
if (date.getDate() !== day || date.getMonth() !== month || date.getFullYear() !== year) {
|
|
1029
|
-
return 'invalid date';
|
|
1030
|
-
}
|
|
1031
|
-
return date;
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* @desc
|
|
1035
|
-
* @param dateStr
|
|
1036
|
-
*/
|
|
1037
|
-
parse(dateStr) {
|
|
1038
|
-
const sections = dateStr.split(this.type === Types.range ? '-' : ' ');
|
|
1039
|
-
// const sections: Array<string> = dateStr.split("-")
|
|
1040
|
-
const sectionDate = this.switchDDMM(sections[0]);
|
|
1041
|
-
const sectionDate2 = this.switchDDMM(sections[1]);
|
|
1042
|
-
const sectionTime = this.type === Types.datetime ? sections[1] : sections[0];
|
|
1043
|
-
const date = new Date(sectionDate);
|
|
1044
|
-
const date2 = new Date(sectionDate2);
|
|
1045
|
-
const dateCheck = date.toString().toLowerCase() !== 'invalid date' && this.parseDate(dateStr) !== 'invalid date';
|
|
1046
|
-
const dateCheck2 = date2.toString().toLowerCase() !== 'invalid date';
|
|
1047
|
-
const regDate = /^((0?[1-9]|1[0-2])(-|\/)(0?[1-9]|[12]\d|3[01])(-|\/)[12]\d{3})$/;
|
|
1048
|
-
const regDateCheck = regDate.test(sectionDate);
|
|
1049
|
-
const regDateCheck2 = regDate.test(sectionDate2);
|
|
1050
|
-
const regTime = /\b([01][0-9]|2[0-3]):([0-5][0-9])\b/;
|
|
1051
|
-
const regTimeCheck = regTime.test(sectionTime);
|
|
1052
|
-
const dateIsValid = dateCheck && regDateCheck;
|
|
1053
|
-
const date2IsValid = dateCheck2 && regDateCheck2;
|
|
1054
|
-
const timeSections = regTimeCheck ? sectionTime.split(':') : '';
|
|
1055
|
-
return {
|
|
1056
|
-
date,
|
|
1057
|
-
date2,
|
|
1058
|
-
timeSections,
|
|
1059
|
-
dateIsValid,
|
|
1060
|
-
date2IsValid,
|
|
1061
|
-
rangeIsValid: dateIsValid && date2IsValid,
|
|
1062
|
-
timeIsValid: regTimeCheck
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* @desc
|
|
1067
|
-
*/
|
|
1068
|
-
getPrevMonth() {
|
|
1069
|
-
this.setMonth(this.renderDate.getMonth() - 1);
|
|
1070
|
-
}
|
|
1071
|
-
/**
|
|
1072
|
-
* @desc
|
|
1073
|
-
*/
|
|
1074
|
-
getNextMonth() {
|
|
1075
|
-
this.setMonth(this.renderDate.getMonth() + 1);
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
|
-
* @desc
|
|
1079
|
-
* @param idx
|
|
1080
|
-
*/
|
|
1081
|
-
yearClick(idx) {
|
|
1082
|
-
if (this.yearsDragger.busy)
|
|
1083
|
-
return;
|
|
1084
|
-
this.setDragSelection('years', this.years[idx], true, true);
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* @desc
|
|
1088
|
-
* @param idx
|
|
1089
|
-
*/
|
|
1090
|
-
hourClick(idx) {
|
|
1091
|
-
if (this.hoursDragger.busy)
|
|
1092
|
-
return;
|
|
1093
|
-
if (!this.selectedDate) {
|
|
1094
|
-
this.setTime();
|
|
1095
|
-
}
|
|
1096
|
-
this.setDragSelection('hours', this.hours[idx], true, true);
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* @desc
|
|
1100
|
-
* @param idx
|
|
1101
|
-
*/
|
|
1102
|
-
minuteClick(idx) {
|
|
1103
|
-
if (this.minutesDragger.busy)
|
|
1104
|
-
return;
|
|
1105
|
-
if (!this.selectedDate) {
|
|
1106
|
-
this.setTime();
|
|
1107
|
-
}
|
|
1108
|
-
this.setDragSelection('minutes', this.minutes[idx], true, true);
|
|
1109
|
-
}
|
|
1110
|
-
/**
|
|
1111
|
-
* @desc
|
|
1112
|
-
*/
|
|
1113
|
-
openPicker() {
|
|
1114
|
-
if (this.disabled)
|
|
1115
|
-
return;
|
|
1116
|
-
!this._open && (this._open = true);
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* @desc
|
|
1120
|
-
* @param date
|
|
1121
|
-
*/
|
|
1122
|
-
handleDayNumber(date) {
|
|
1123
|
-
if (this.type === Types.range
|
|
1124
|
-
&& this.selectedDate
|
|
1125
|
-
&& !this.selectedEndDate
|
|
1126
|
-
&& this.isSameDate(this.selectedDate, date))
|
|
1127
|
-
return;
|
|
1128
|
-
this.setDate(date, true);
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* @desc
|
|
1132
|
-
* @param value
|
|
1133
|
-
*/
|
|
1134
|
-
handleInputInput(value) {
|
|
1135
|
-
this.setDataFromText(value, true);
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* @desc
|
|
1139
|
-
* @param event -
|
|
1140
|
-
*/
|
|
1141
|
-
handleInputChange(event) {
|
|
1142
|
-
this.setDataFromText(this.inputElement.value, true, false);
|
|
1143
|
-
event.stopPropagation();
|
|
1144
|
-
}
|
|
1145
|
-
/**
|
|
1146
|
-
* @desc
|
|
1147
|
-
*/
|
|
1148
|
-
async handleInputClear() {
|
|
1149
|
-
this.selectedDate = null;
|
|
1150
|
-
this.selectedEndDate = null;
|
|
1151
|
-
this.emptyState = true;
|
|
1152
|
-
this.renderDate = new Date();
|
|
1153
|
-
this._open = false;
|
|
1154
|
-
this.setValue(true);
|
|
1155
|
-
this.setError();
|
|
1156
|
-
this.getValueText();
|
|
1157
|
-
await this.inputElement.setClear();
|
|
1158
|
-
await delay(10);
|
|
1159
|
-
return Promise.resolve();
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* @desc
|
|
1163
|
-
* @param event
|
|
1164
|
-
*/
|
|
1165
|
-
handleWheel(event) {
|
|
1166
|
-
event.preventDefault();
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* @desc
|
|
1170
|
-
* @param event
|
|
1171
|
-
*/
|
|
1172
|
-
handleWindowClick(event) {
|
|
1173
|
-
if (this._open) {
|
|
1174
|
-
const list = document.getElementById(`picker-vp-${this._id}`);
|
|
1175
|
-
const isClickInside = Generate.findEventPath(event, this.el);
|
|
1176
|
-
const isClickList = list ? (Generate.findEventPath(event, list)) : false;
|
|
1177
|
-
if (!isClickInside && !isClickList) {
|
|
1178
|
-
this._open = false;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
openToggle() {
|
|
1183
|
-
if (this.disabled)
|
|
1184
|
-
return;
|
|
1185
|
-
this._open = !this._open;
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* @desc
|
|
1189
|
-
*/
|
|
1190
|
-
async open() {
|
|
1191
|
-
await delay(50);
|
|
1192
|
-
this.openToggle();
|
|
1193
|
-
}
|
|
1194
|
-
/**
|
|
1195
|
-
* @desc
|
|
1196
|
-
*/
|
|
1197
|
-
async close() {
|
|
1198
|
-
this._open = false;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* @desc
|
|
1202
|
-
*/
|
|
1203
|
-
async getValue() {
|
|
1204
|
-
return this.value;
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* @param
|
|
1208
|
-
* @param disabled
|
|
1209
|
-
*/
|
|
1210
|
-
async setDisabled(disabled) {
|
|
1211
|
-
this.disabled = disabled;
|
|
1212
|
-
}
|
|
1213
|
-
changeFormat(date, reverseDay = false) {
|
|
1214
|
-
if (!date)
|
|
1215
|
-
return;
|
|
1216
|
-
const pad = (n) => n < 10 ? `0${n}` : n;
|
|
1217
|
-
const day = pad(new Date(date).getDate());
|
|
1218
|
-
const month = pad(new Date(date).getMonth() + 1);
|
|
1219
|
-
const year = new Date(date).getFullYear();
|
|
1220
|
-
const hours = pad(new Date(date).getHours());
|
|
1221
|
-
const minutes = pad(new Date(date).getMinutes());
|
|
1222
|
-
if (this.type == "range" || this.type == "date") {
|
|
1223
|
-
return reverseDay ? `${month}/${day}/${year}` : `${day}/${month}/${year}`;
|
|
1224
|
-
}
|
|
1225
|
-
return reverseDay ? `${month}/${day}/${year} ${hours}:${minutes}` : `${day}/${month}/${year} ${hours}:${minutes}`;
|
|
1226
|
-
}
|
|
1227
|
-
isTime(value) {
|
|
1228
|
-
return /^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$/.test(value);
|
|
1229
|
-
}
|
|
1230
|
-
getHHMM(date) {
|
|
1231
|
-
if (!date)
|
|
1232
|
-
return;
|
|
1233
|
-
const pad = (n) => n < 10 ? `0${n}` : n;
|
|
1234
|
-
const hours = pad(new Date(date).getHours());
|
|
1235
|
-
const minutes = pad(new Date(date).getMinutes());
|
|
1236
|
-
return `${hours}:${minutes}`;
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* @desc
|
|
1240
|
-
* @param dateOrTime
|
|
1241
|
-
*/
|
|
1242
|
-
async set(dateOrTime) {
|
|
1243
|
-
if (dateOrTime) {
|
|
1244
|
-
if (typeof dateOrTime === "number") {
|
|
1245
|
-
dateOrTime = new Date(dateOrTime);
|
|
1246
|
-
}
|
|
1247
|
-
if (this.type == "time") {
|
|
1248
|
-
let time = dateOrTime;
|
|
1249
|
-
if (!this.isTime(dateOrTime)) {
|
|
1250
|
-
time = this.getHHMM(dateOrTime);
|
|
1251
|
-
}
|
|
1252
|
-
this.setDataFromText(time, true, false);
|
|
1253
|
-
}
|
|
1254
|
-
else {
|
|
1255
|
-
const split = dateOrTime.toString().split('-');
|
|
1256
|
-
const parseDate0 = Date.parse(split[0]);
|
|
1257
|
-
if (split[0] && !isNaN(parseDate0)) {
|
|
1258
|
-
var date = this.changeFormat(DateTimeHelper.convertTimeStampToDate(new Date(split[0]).getTime()));
|
|
1259
|
-
if (split[1] && !isNaN(Date.parse(split[1]))) {
|
|
1260
|
-
var date2 = this.changeFormat(DateTimeHelper.convertTimeStampToDate(new Date(split[1]).getTime()));
|
|
1261
|
-
date = date + "-" + date2;
|
|
1262
|
-
}
|
|
1263
|
-
this.setDataFromText(date, true, false);
|
|
1264
|
-
}
|
|
1265
|
-
else {
|
|
1266
|
-
this.setDataFromText('', true, false);
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
else {
|
|
1271
|
-
this.setClear();
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
async get() {
|
|
1275
|
-
var _a;
|
|
1276
|
-
return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.timestamp) || null;
|
|
1277
|
-
}
|
|
1278
|
-
async setClear() {
|
|
1279
|
-
await this.handleInputClear();
|
|
1280
|
-
return Promise.resolve();
|
|
1281
|
-
}
|
|
1282
|
-
/**
|
|
1283
|
-
* @desc
|
|
1284
|
-
*/
|
|
1285
|
-
async getInput() {
|
|
1286
|
-
return this.inputElement;
|
|
1287
|
-
}
|
|
1288
|
-
/**
|
|
1289
|
-
* @desc
|
|
1290
|
-
* @returns
|
|
1291
|
-
*/
|
|
1292
|
-
async isValid() {
|
|
1293
|
-
return this.getError();
|
|
1294
|
-
}
|
|
1295
|
-
async resetCaption() {
|
|
1296
|
-
await delay(10);
|
|
1297
|
-
await this.inputElement.resetCaption();
|
|
1298
|
-
this.captionType = 'default';
|
|
1299
|
-
this.captionError = null;
|
|
1300
|
-
await delay(10);
|
|
1301
|
-
return Promise.resolve();
|
|
1302
|
-
}
|
|
1303
|
-
addZeroBefore(n) {
|
|
1304
|
-
return (n < 10 ? '0' : '') + n;
|
|
1305
|
-
}
|
|
1306
|
-
formatDate(date, format) {
|
|
1307
|
-
const map = {
|
|
1308
|
-
mm: this.addZeroBefore(date.getMonth() + 1),
|
|
1309
|
-
dd: this.addZeroBefore(date.getDate()),
|
|
1310
|
-
yyyy: this.addZeroBefore(date.getFullYear()),
|
|
1311
|
-
hh: this.addZeroBefore(date.getHours()),
|
|
1312
|
-
mi: this.addZeroBefore(date.getMinutes()),
|
|
1313
|
-
};
|
|
1314
|
-
return format.replace(/mm|dd|yyyy|hh|mi/gi, matched => map[matched]);
|
|
1315
|
-
}
|
|
1316
|
-
handleResize() {
|
|
1317
|
-
this.calculateLocation();
|
|
1318
|
-
}
|
|
1319
|
-
handleWheels(event) {
|
|
1320
|
-
if (this._open) {
|
|
1321
|
-
const list = document.querySelector(`#picker-vp-${this._id}`);
|
|
1322
|
-
const isClickInside = list && Generate.findEventPath(event, list);
|
|
1323
|
-
if (isClickInside) {
|
|
1324
|
-
this.calculateLocation();
|
|
1325
|
-
}
|
|
1326
|
-
else {
|
|
1327
|
-
this._open = false;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
componentDidLoad() {
|
|
1332
|
-
const picker = this.el.shadowRoot.querySelector(`#picker-vp-${this._id}`);
|
|
1333
|
-
//move to body
|
|
1334
|
-
if (picker) {
|
|
1335
|
-
document.body.appendChild(picker);
|
|
1336
|
-
this.calculateLocation();
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
disconnectedCallback() {
|
|
1340
|
-
this.el.innerHTML = '';
|
|
1341
|
-
const pickerBox = document.getElementById(`picker-vp-${this._id}`);
|
|
1342
|
-
if (pickerBox) {
|
|
1343
|
-
pickerBox.remove();
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
async calculateLocation() {
|
|
1347
|
-
const pickerBox = document.getElementById(`picker-vp-${this._id}`);
|
|
1348
|
-
const placementArray = this.placement.split('-');
|
|
1349
|
-
if (this.alignment) {
|
|
1350
|
-
this.placement = placementArray[0] + (this.alignment == "right" ? "-end" : "-start");
|
|
1351
|
-
}
|
|
1352
|
-
var placement = this.placement;
|
|
1353
|
-
const targetElementId = this.linkedComponent ? this.linkedComponent : this._id;
|
|
1354
|
-
const target = document.getElementById(targetElementId);
|
|
1355
|
-
if (target) {
|
|
1356
|
-
const targetElement = this.linkedComponent ? target : target.shadowRoot.querySelector(`#picker-input-${this._id}`) || target.shadowRoot.querySelector("bcm-datetime-picker").shadowRoot.querySelector(`#picker-input-${this._id}`);
|
|
1357
|
-
if (pickerBox && targetElement) {
|
|
1358
|
-
getPlacement(pickerBox, targetElement, placement, (place) => (placement = place));
|
|
1359
|
-
await delay(10);
|
|
1360
|
-
let pos = setPosition(placement, targetElement);
|
|
1361
|
-
let captionAreaHeight = this.noCaption ? 0 : 20;
|
|
1362
|
-
let labelAreaHeight = 0;
|
|
1363
|
-
// if (this.fullWidth) {
|
|
1364
|
-
// pickerBox.style.width = targetElement.offsetWidth + 'px';
|
|
1365
|
-
// }
|
|
1366
|
-
getPlacement(pickerBox, targetElement, placement, (place) => (placement = place));
|
|
1367
|
-
await delay(10);
|
|
1368
|
-
pos = setPosition(placement, targetElement);
|
|
1369
|
-
if (this.linkedComponent) {
|
|
1370
|
-
pickerBox.style.top = (placement.split('-')[0] == 'top' ? pos[0] - pickerBox.offsetHeight : pos[0]) + 'px';
|
|
1371
|
-
}
|
|
1372
|
-
else {
|
|
1373
|
-
pickerBox.style.top = (placement.split('-')[0] == 'top' ? pos[0] - pickerBox.offsetHeight + labelAreaHeight : pos[0] - captionAreaHeight) + 'px';
|
|
1374
|
-
}
|
|
1375
|
-
switch (placement.split('-')[1]) {
|
|
1376
|
-
case "start":
|
|
1377
|
-
pickerBox.style.left = pos[1] + 'px';
|
|
1378
|
-
break;
|
|
1379
|
-
case "center":
|
|
1380
|
-
pickerBox.style.left = pos[1] - pickerBox.offsetWidth / 2 + 'px';
|
|
1381
|
-
break;
|
|
1382
|
-
case "end":
|
|
1383
|
-
pickerBox.style.left = pos[1] - pickerBox.offsetWidth + 'px';
|
|
1384
|
-
break;
|
|
1385
|
-
}
|
|
1386
|
-
pickerBox.classList.toggle('bcm-list--top', placement.split('-')[0] == 'top');
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
handleKeyDown(ev) {
|
|
1391
|
-
const keycode = ev.keyCode || ev.which;
|
|
1392
|
-
if (keycode === Bcm.KeyCode.escape) {
|
|
1393
|
-
if (this._open) {
|
|
1394
|
-
this._open = false;
|
|
1395
|
-
ev.preventDefault();
|
|
1396
|
-
ev.stopPropagation();
|
|
1397
|
-
ev.stopImmediatePropagation();
|
|
1398
|
-
this.markForCheck();
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
render() {
|
|
1403
|
-
const dayNumbersClasses = classnames('day-numbers');
|
|
1404
|
-
const datetimePickerClasses = classnames('datetime-picker', 'datetime-picker-wrapper', {
|
|
1405
|
-
'open': this._open,
|
|
1406
|
-
'no-caption': this.noCaption,
|
|
1407
|
-
});
|
|
1408
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, {
|
|
1409
|
-
'full-width': this.fullWidth,
|
|
1410
|
-
'linked-component': this.linkedComponent,
|
|
1411
|
-
'no-margin': this.noMargin,
|
|
1412
|
-
});
|
|
1413
|
-
const toggleClasses = classnames('toggle', {
|
|
1414
|
-
disabled: this.disabled
|
|
1415
|
-
});
|
|
1416
|
-
const clockIcon = `<svg style="fill: #595959; width: 14px; height: 14px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"/></svg>`;
|
|
1417
|
-
const calendarIcon = `<svg style="fill: #595959; width: 14px; height: 14px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M148 288h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm108-12v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 96v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96-260v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h128V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-48 346V160H48v298c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"/></svg>`;
|
|
1418
|
-
const errorIcon = `<svg style="fill: #ef4444; width: 14px; height: 14px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm42-104c0 23.2-18.8 42-42 42s-42-18.8-42-42 18.8-42 42-42 42 18.8 42 42zm-81.4-211.4l6.8 136c.3 6.4 5.6 11.4 12 11.4h41.2c6.4 0 11.7-5.1 12-11.4l6.8-136c.3-6.9-5.1-12.6-12-12.6h-54.8c-6.9 0-12.4 5.7-12 12.6z"/></svg>`;
|
|
1419
|
-
const inputIcon = this.type == "time" ? clockIcon : calendarIcon;
|
|
1420
|
-
return (h(Host, { class: hostClasses, "bcm-internal-id": this.inputId }, this.label && (h("div", { class: "picker-label", onClick: () => this.openToggle() }, h(LabelTemplate, { size: "medium", type: this.captionType, value: this.label, required: this.required, htmlFor: this._id }))), h("bcm-old-input", { ref: el => (this.inputElement = el), placeholder: this.placeholder || 'Select ' + (this.type === Types.datetime ? 'date and time' : '') + (this.type === Types.date ? 'date' : '') + (this.type === Types.time ? 'time' : '') + (this.type === Types.range ? 'date range' : ''), value: this.valueText, required: this.required, fullWidth: this.fullWidth, disabled: this.disabled, name: this.name, id: this.inputId, clearable: this.clearable, onClick: () => this.openPicker(), "no-margin": true, disableWatchValue: true, "on-bcm-clear": () => this.handleInputClear(), "on-bcm-change": (e) => this.handleInputChange(e),
|
|
1421
|
-
// on-bcm-input={(e: CustomEvent) => this.handleInputInput(e.detail)}
|
|
1422
|
-
noCaption: this.noCaption, captionError: this.captionError, caption: this.caption, captionType: this.captionType }, this.error && (h("span", { slot: "suffix" }, h("span", { id: "error-icon", class: toggleClasses, innerHTML: errorIcon, title: this.errorText }))), h("span", { slot: "suffix", onClick: () => this.openPicker() }, h("span", { id: "calender-icon", class: toggleClasses, innerHTML: inputIcon }))), h("div", { id: "picker-vp-" + this._id, class: datetimePickerClasses, onWheel: (e) => this.handleWheel(e) }, h("div", { class: "modules" }, this.hasDateModule && (h("div", { class: "date-container" }, h("div", { class: "bcm-datetime-picker__header" }, h("span", null), h("div", { class: "month-year" }, h("button", { onClick: () => this.getPrevMonth() }, h("bcm-icon", { icon: "far fa-chevron-left" })), h("div", { class: "month-year-wrapper" }, h("span", { class: "month" }, this.getMonthText()), ",", h("span", { class: "year" }, this.date.getFullYear())), h("button", { onClick: () => this.getNextMonth() }, h("bcm-icon", { icon: "far fa-chevron-right" }))), h("span", { class: "today", onClick: () => this.setDateToday() }, "Today")), h("div", { class: "bcm-datetime-picker__content" }, h("div", { class: "years", ref: el => (this.yearsWrapperElement = el) }, h("div", { class: "items", ref: el => (this.yearsElement = el) }, this.years.map((year, idx) => h("span", { onClick: () => this.yearClick(idx) }, year))), h("div", { class: "select-strip", ref: el => (this.yearsStripElement = el) })), h("div", { class: "days" }, h("div", { class: "day-labels" }, h("span", null, "Mo"), h("span", null, "Tu"), h("span", null, "We"), h("span", null, "Th"), h("span", null, "Fr"), h("span", null, "Sa"), h("span", null, "Su")), h("div", { class: dayNumbersClasses }, this.dayNumbers.map(day => (h("span", { class: {
|
|
1423
|
-
'is-disabled-date': (this.type === Types.date || this.type === Types.datetime) && this.isDisabledDate(day.date),
|
|
1424
|
-
'not-this-month': !day.thisMonth,
|
|
1425
|
-
'is-weekend': day.isWeekend,
|
|
1426
|
-
'today': day.today,
|
|
1427
|
-
'selected': this.getSelected(day.date),
|
|
1428
|
-
'selected-start': this.getSelected(day.date) && this.selectedEndDate && this.type === Types.range,
|
|
1429
|
-
'selected-end': this.getSelected(day.date, true) && this.type === Types.range,
|
|
1430
|
-
'range': this.getDateIsInRange(day.date) && this.type === Types.range
|
|
1431
|
-
}, onClick: () => this.handleDayNumber(day.date) }, h("span", { class: "number" }, day.day))))))))), this.hasTimeModule && (h("div", { class: "time-container" }, h("div", { class: "bcm-datetime-picker__header" }, h("div", { class: "month-year" }, h("span", { class: "month" }, this.getTimeText())), h("span", { class: "now", onClick: () => { this.setTime(), this.type == "time" && (this._open = false); } }, "Now")), h("div", { class: "bcm-datetime-picker__content", onDblClick: (e) => { this.HourContentDblClick(e); } }, h("div", { class: "hours", ref: el => (this.hoursWrapperElement = el) }, h("div", { class: "items", ref: el => (this.hoursElement = el) }, this.hours.map((hour, idx) => h("span", { class: this.currentDate.hour === hour ? 'selected' : '', onClick: () => this.hourClick(idx) }, (hour < 10 && '0') + hour)))), h("div", { class: "minutes", ref: el => (this.minutesWrapperElement = el) }, h("div", { class: "items", ref: el => (this.minutesElement = el) }, this.minutes.map((minute, idx) => h("span", { class: this.currentDate.minute === minute ? 'selected' : '', onClick: () => this.minuteClick(idx) }, (minute < 10 && '0') + minute)))), h("div", { class: "select-strip", ref: el => (this.timeStripElement = el) }))))))));
|
|
1432
|
-
}
|
|
1433
|
-
get el() { return getElement(this); }
|
|
1434
|
-
static get watchers() { return {
|
|
1435
|
-
"_open": ["openChanged", "openChange"],
|
|
1436
|
-
"renderDate": ["renderDateChange"],
|
|
1437
|
-
"value": ["valueChange"],
|
|
1438
|
-
"disabledDates": ["disabledDatesChange"]
|
|
1439
|
-
}; }
|
|
1440
|
-
};
|
|
1441
|
-
__decorate([
|
|
1442
|
-
IsLoad()
|
|
1443
|
-
], BcmDatetimePicker.prototype, "el", void 0);
|
|
1444
|
-
BcmDatetimePicker.style = datetimePickerCss;
|
|
1445
|
-
|
|
1446
|
-
export { BcmDatetimePicker as bcm_datetime_picker };
|