element-sim 1.0.3 → 1.0.4
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/package.json +1 -1
- package/packages/theme-chalk/src/common/var.scss +2 -2
- package/packages/theme-chalk/src/form.scss +6 -3
- package/packages/theme-chalk/src/index.scss +87 -87
- package/packages/theme-chalk/src/input.scss +1 -1
- package/src/index.js +51 -51
- package/types/index.d.ts +2 -2
- package/lib/alert.js +0 -420
- package/lib/aside.js +0 -277
- package/lib/autocomplete.js +0 -952
- package/lib/avatar.js +0 -363
- package/lib/backtop.js +0 -404
- package/lib/badge.js +0 -334
- package/lib/breadcrumb-item.js +0 -322
- package/lib/breadcrumb.js +0 -293
- package/lib/button-group.js +0 -262
- package/lib/button.js +0 -357
- package/lib/calendar.js +0 -933
- package/lib/card.js +0 -297
- package/lib/carousel-item.js +0 -434
- package/lib/carousel.js +0 -707
- package/lib/cascader-panel.js +0 -1558
- package/lib/cascader.js +0 -1439
- package/lib/checkbox-button.js +0 -583
- package/lib/checkbox-group.js +0 -313
- package/lib/checkbox.js +0 -627
- package/lib/col.js +0 -177
- package/lib/collapse-item.js +0 -497
- package/lib/collapse.js +0 -329
- package/lib/color-picker.js +0 -1943
- package/lib/container.js +0 -288
- package/lib/date-picker.js +0 -6335
- package/lib/descriptions-item.js +0 -140
- package/lib/descriptions.js +0 -457
- package/lib/dialog.js +0 -598
- package/lib/directives/mousewheel.js +0 -26
- package/lib/directives/repeat-click.js +0 -33
- package/lib/divider.js +0 -313
- package/lib/drawer.js +0 -592
- package/lib/dropdown-item.js +0 -316
- package/lib/dropdown-menu.js +0 -351
- package/lib/dropdown.js +0 -643
- package/lib/element-SIM.common.js +0 -43578
- package/lib/empty.js +0 -730
- package/lib/footer.js +0 -277
- package/lib/form-item.js +0 -826
- package/lib/form.js +0 -466
- package/lib/header.js +0 -277
- package/lib/icon.js +0 -265
- package/lib/image.js +0 -1138
- package/lib/index.js +0 -1
- package/lib/infinite-scroll.js +0 -301
- package/lib/input-number.js +0 -752
- package/lib/input.js +0 -998
- package/lib/link.js +0 -332
- package/lib/loading.js +0 -631
- package/lib/locale/format.js +0 -56
- package/lib/locale/index.js +0 -63
- package/lib/locale/lang/af-ZA.js +0 -126
- package/lib/locale/lang/ar.js +0 -125
- package/lib/locale/lang/az.js +0 -126
- package/lib/locale/lang/bg.js +0 -126
- package/lib/locale/lang/bn.js +0 -126
- package/lib/locale/lang/ca.js +0 -125
- package/lib/locale/lang/cs-CZ.js +0 -128
- package/lib/locale/lang/da.js +0 -125
- package/lib/locale/lang/de.js +0 -127
- package/lib/locale/lang/ee.js +0 -126
- package/lib/locale/lang/el.js +0 -126
- package/lib/locale/lang/en.js +0 -126
- package/lib/locale/lang/eo.js +0 -126
- package/lib/locale/lang/es.js +0 -125
- package/lib/locale/lang/eu.js +0 -126
- package/lib/locale/lang/fa.js +0 -126
- package/lib/locale/lang/fi.js +0 -126
- package/lib/locale/lang/fr.js +0 -125
- package/lib/locale/lang/he.js +0 -126
- package/lib/locale/lang/hr.js +0 -126
- package/lib/locale/lang/hu.js +0 -125
- package/lib/locale/lang/hy-AM.js +0 -126
- package/lib/locale/lang/id.js +0 -126
- package/lib/locale/lang/is.js +0 -126
- package/lib/locale/lang/it.js +0 -125
- package/lib/locale/lang/ja.js +0 -126
- package/lib/locale/lang/kg.js +0 -126
- package/lib/locale/lang/km.js +0 -126
- package/lib/locale/lang/ko.js +0 -126
- package/lib/locale/lang/ku.js +0 -126
- package/lib/locale/lang/kz.js +0 -126
- package/lib/locale/lang/lo-LA.js +0 -126
- package/lib/locale/lang/lt.js +0 -126
- package/lib/locale/lang/lv.js +0 -126
- package/lib/locale/lang/mn.js +0 -126
- package/lib/locale/lang/ms.js +0 -125
- package/lib/locale/lang/nb-NO.js +0 -125
- package/lib/locale/lang/nl.js +0 -126
- package/lib/locale/lang/pl.js +0 -126
- package/lib/locale/lang/pt-br.js +0 -126
- package/lib/locale/lang/pt.js +0 -126
- package/lib/locale/lang/ro.js +0 -126
- package/lib/locale/lang/ru-RU.js +0 -126
- package/lib/locale/lang/si.js +0 -126
- package/lib/locale/lang/sk.js +0 -128
- package/lib/locale/lang/sl.js +0 -126
- package/lib/locale/lang/sr-Latn.js +0 -126
- package/lib/locale/lang/sr.js +0 -126
- package/lib/locale/lang/sv-SE.js +0 -126
- package/lib/locale/lang/sw.js +0 -126
- package/lib/locale/lang/ta.js +0 -125
- package/lib/locale/lang/th.js +0 -126
- package/lib/locale/lang/tk.js +0 -126
- package/lib/locale/lang/tr-TR.js +0 -126
- package/lib/locale/lang/ua.js +0 -126
- package/lib/locale/lang/ug-CN.js +0 -126
- package/lib/locale/lang/uz-UZ.js +0 -126
- package/lib/locale/lang/vi.js +0 -126
- package/lib/locale/lang/zh-CN.js +0 -126
- package/lib/locale/lang/zh-TW.js +0 -126
- package/lib/main.js +0 -264
- package/lib/menu-item-group.js +0 -308
- package/lib/menu-item.js +0 -491
- package/lib/menu.js +0 -865
- package/lib/message-box.js +0 -1192
- package/lib/message.js +0 -548
- package/lib/mixins/emitter.js +0 -36
- package/lib/mixins/focus.js +0 -15
- package/lib/mixins/locale.js +0 -17
- package/lib/mixins/migrating.js +0 -69
- package/lib/notification.js +0 -615
- package/lib/option-group.js +0 -344
- package/lib/option.js +0 -474
- package/lib/page-header.js +0 -319
- package/lib/pagination.js +0 -950
- package/lib/popconfirm.js +0 -457
- package/lib/popover.js +0 -617
- package/lib/progress.js +0 -595
- package/lib/radio-button.js +0 -463
- package/lib/radio-group.js +0 -391
- package/lib/radio.js +0 -497
- package/lib/rate.js +0 -670
- package/lib/result.js +0 -578
- package/lib/row.js +0 -149
- package/lib/scrollbar.js +0 -423
- package/lib/select.js +0 -2167
- package/lib/skeleton-item.js +0 -342
- package/lib/skeleton.js +0 -372
- package/lib/slider.js +0 -1199
- package/lib/spinner.js +0 -301
- package/lib/statistic.js +0 -533
- package/lib/step.js +0 -522
- package/lib/steps.js +0 -342
- package/lib/submenu.js +0 -701
- package/lib/switch.js +0 -554
- package/lib/tab-pane.js +0 -332
- package/lib/table-column.js +0 -952
- package/lib/table.js +0 -5010
- package/lib/tabs.js +0 -920
- package/lib/tag.js +0 -304
- package/lib/theme-chalk/alert.css +0 -1
- package/lib/theme-chalk/aside.css +0 -1
- package/lib/theme-chalk/autocomplete.css +0 -1
- package/lib/theme-chalk/avatar.css +0 -1
- package/lib/theme-chalk/backtop.css +0 -1
- package/lib/theme-chalk/badge.css +0 -1
- package/lib/theme-chalk/base.css +0 -1
- package/lib/theme-chalk/breadcrumb-item.css +0 -0
- package/lib/theme-chalk/breadcrumb.css +0 -1
- package/lib/theme-chalk/button-group.css +0 -0
- package/lib/theme-chalk/button.css +0 -1
- package/lib/theme-chalk/calendar.css +0 -1
- package/lib/theme-chalk/card.css +0 -1
- package/lib/theme-chalk/carousel-item.css +0 -1
- package/lib/theme-chalk/carousel.css +0 -1
- package/lib/theme-chalk/cascader-panel.css +0 -1
- package/lib/theme-chalk/cascader.css +0 -1
- package/lib/theme-chalk/checkbox-button.css +0 -0
- package/lib/theme-chalk/checkbox-group.css +0 -0
- package/lib/theme-chalk/checkbox.css +0 -1
- package/lib/theme-chalk/col.css +0 -1
- package/lib/theme-chalk/collapse-item.css +0 -0
- package/lib/theme-chalk/collapse.css +0 -1
- package/lib/theme-chalk/color-picker.css +0 -1
- package/lib/theme-chalk/container.css +0 -1
- package/lib/theme-chalk/date-picker.css +0 -1
- package/lib/theme-chalk/descriptions-item.css +0 -1
- package/lib/theme-chalk/descriptions.css +0 -1
- package/lib/theme-chalk/dialog.css +0 -1
- package/lib/theme-chalk/display.css +0 -1
- package/lib/theme-chalk/divider.css +0 -1
- package/lib/theme-chalk/drawer.css +0 -1
- package/lib/theme-chalk/dropdown-item.css +0 -0
- package/lib/theme-chalk/dropdown-menu.css +0 -0
- package/lib/theme-chalk/dropdown.css +0 -1
- package/lib/theme-chalk/empty.css +0 -1
- package/lib/theme-chalk/fonts/element-icons.ttf +0 -0
- package/lib/theme-chalk/fonts/element-icons.woff +0 -0
- package/lib/theme-chalk/footer.css +0 -1
- package/lib/theme-chalk/form-item.css +0 -0
- package/lib/theme-chalk/form.css +0 -1
- package/lib/theme-chalk/header.css +0 -1
- package/lib/theme-chalk/icon.css +0 -1
- package/lib/theme-chalk/image.css +0 -1
- package/lib/theme-chalk/index.css +0 -1
- package/lib/theme-chalk/infinite-scroll.css +0 -0
- package/lib/theme-chalk/infiniteScroll.css +0 -0
- package/lib/theme-chalk/input-number.css +0 -1
- package/lib/theme-chalk/input.css +0 -1
- package/lib/theme-chalk/link.css +0 -1
- package/lib/theme-chalk/loading.css +0 -1
- package/lib/theme-chalk/main.css +0 -1
- package/lib/theme-chalk/menu-item-group.css +0 -0
- package/lib/theme-chalk/menu-item.css +0 -0
- package/lib/theme-chalk/menu.css +0 -1
- package/lib/theme-chalk/message-box.css +0 -1
- package/lib/theme-chalk/message.css +0 -1
- package/lib/theme-chalk/notification.css +0 -1
- package/lib/theme-chalk/option-group.css +0 -1
- package/lib/theme-chalk/option.css +0 -1
- package/lib/theme-chalk/page-header.css +0 -1
- package/lib/theme-chalk/pagination.css +0 -1
- package/lib/theme-chalk/popconfirm.css +0 -1
- package/lib/theme-chalk/popover.css +0 -1
- package/lib/theme-chalk/popper.css +0 -1
- package/lib/theme-chalk/progress.css +0 -1
- package/lib/theme-chalk/radio-button.css +0 -1
- package/lib/theme-chalk/radio-group.css +0 -1
- package/lib/theme-chalk/radio.css +0 -1
- package/lib/theme-chalk/rate.css +0 -1
- package/lib/theme-chalk/reset.css +0 -1
- package/lib/theme-chalk/result.css +0 -1
- package/lib/theme-chalk/row.css +0 -1
- package/lib/theme-chalk/scrollbar.css +0 -1
- package/lib/theme-chalk/select-dropdown.css +0 -1
- package/lib/theme-chalk/select.css +0 -1
- package/lib/theme-chalk/skeleton-item.css +0 -1
- package/lib/theme-chalk/skeleton.css +0 -1
- package/lib/theme-chalk/slider.css +0 -1
- package/lib/theme-chalk/spinner.css +0 -1
- package/lib/theme-chalk/statistic.css +0 -1
- package/lib/theme-chalk/step.css +0 -1
- package/lib/theme-chalk/steps.css +0 -1
- package/lib/theme-chalk/submenu.css +0 -0
- package/lib/theme-chalk/switch.css +0 -1
- package/lib/theme-chalk/tab-pane.css +0 -0
- package/lib/theme-chalk/table-column.css +0 -1
- package/lib/theme-chalk/table.css +0 -1
- package/lib/theme-chalk/tabs.css +0 -1
- package/lib/theme-chalk/tag.css +0 -1
- package/lib/theme-chalk/time-picker.css +0 -1
- package/lib/theme-chalk/time-select.css +0 -1
- package/lib/theme-chalk/timeline-item.css +0 -1
- package/lib/theme-chalk/timeline.css +0 -1
- package/lib/theme-chalk/tooltip.css +0 -1
- package/lib/theme-chalk/transfer.css +0 -1
- package/lib/theme-chalk/tree.css +0 -1
- package/lib/theme-chalk/upload.css +0 -1
- package/lib/time-picker.js +0 -2967
- package/lib/time-select.js +0 -1765
- package/lib/timeline-item.js +0 -371
- package/lib/timeline.js +0 -275
- package/lib/tooltip.js +0 -425
- package/lib/transfer.js +0 -1102
- package/lib/transitions/collapse-transition.js +0 -91
- package/lib/tree.js +0 -2263
- package/lib/umd/locale/af-ZA.js +0 -142
- package/lib/umd/locale/ar.js +0 -141
- package/lib/umd/locale/az.js +0 -141
- package/lib/umd/locale/bg.js +0 -142
- package/lib/umd/locale/bn.js +0 -141
- package/lib/umd/locale/ca.js +0 -141
- package/lib/umd/locale/cs-CZ.js +0 -144
- package/lib/umd/locale/da.js +0 -141
- package/lib/umd/locale/de.js +0 -143
- package/lib/umd/locale/ee.js +0 -142
- package/lib/umd/locale/el.js +0 -142
- package/lib/umd/locale/en.js +0 -142
- package/lib/umd/locale/eo.js +0 -142
- package/lib/umd/locale/es.js +0 -141
- package/lib/umd/locale/eu.js +0 -142
- package/lib/umd/locale/fa.js +0 -142
- package/lib/umd/locale/fi.js +0 -142
- package/lib/umd/locale/fr.js +0 -141
- package/lib/umd/locale/he.js +0 -142
- package/lib/umd/locale/hr.js +0 -142
- package/lib/umd/locale/hu.js +0 -141
- package/lib/umd/locale/hy-AM.js +0 -142
- package/lib/umd/locale/id.js +0 -142
- package/lib/umd/locale/is.js +0 -142
- package/lib/umd/locale/it.js +0 -141
- package/lib/umd/locale/ja.js +0 -142
- package/lib/umd/locale/kg.js +0 -142
- package/lib/umd/locale/km.js +0 -142
- package/lib/umd/locale/ko.js +0 -142
- package/lib/umd/locale/ku.js +0 -142
- package/lib/umd/locale/kz.js +0 -142
- package/lib/umd/locale/lo-LA.js +0 -141
- package/lib/umd/locale/lt.js +0 -142
- package/lib/umd/locale/lv.js +0 -142
- package/lib/umd/locale/mn.js +0 -142
- package/lib/umd/locale/ms.js +0 -141
- package/lib/umd/locale/nb-NO.js +0 -141
- package/lib/umd/locale/nl.js +0 -142
- package/lib/umd/locale/pl.js +0 -142
- package/lib/umd/locale/pt-br.js +0 -142
- package/lib/umd/locale/pt.js +0 -142
- package/lib/umd/locale/ro.js +0 -142
- package/lib/umd/locale/ru-RU.js +0 -142
- package/lib/umd/locale/si.js +0 -142
- package/lib/umd/locale/sk.js +0 -144
- package/lib/umd/locale/sl.js +0 -142
- package/lib/umd/locale/sr-Latn.js +0 -142
- package/lib/umd/locale/sr.js +0 -142
- package/lib/umd/locale/sv-SE.js +0 -142
- package/lib/umd/locale/sw.js +0 -142
- package/lib/umd/locale/ta.js +0 -141
- package/lib/umd/locale/th.js +0 -142
- package/lib/umd/locale/tk.js +0 -142
- package/lib/umd/locale/tr-TR.js +0 -142
- package/lib/umd/locale/ua.js +0 -142
- package/lib/umd/locale/ug-CN.js +0 -142
- package/lib/umd/locale/uz-UZ.js +0 -142
- package/lib/umd/locale/vi.js +0 -142
- package/lib/umd/locale/zh-CN.js +0 -142
- package/lib/umd/locale/zh-TW.js +0 -142
- package/lib/upload.js +0 -1390
- package/lib/utils/after-leave.js +0 -35
- package/lib/utils/aria-dialog.js +0 -104
- package/lib/utils/aria-utils.js +0 -126
- package/lib/utils/clickoutside.js +0 -79
- package/lib/utils/date-util.js +0 -310
- package/lib/utils/date.js +0 -369
- package/lib/utils/dom.js +0 -234
- package/lib/utils/lodash.js +0 -9421
- package/lib/utils/menu/aria-menubar.js +0 -24
- package/lib/utils/menu/aria-menuitem.js +0 -62
- package/lib/utils/menu/aria-submenu.js +0 -69
- package/lib/utils/merge.js +0 -21
- package/lib/utils/popper.js +0 -1261
- package/lib/utils/popup/index.js +0 -233
- package/lib/utils/popup/popup-manager.js +0 -205
- package/lib/utils/resize-event.js +0 -59
- package/lib/utils/scroll-into-view.js +0 -38
- package/lib/utils/scrollbar-width.js +0 -39
- package/lib/utils/shared.js +0 -12
- package/lib/utils/types.js +0 -52
- package/lib/utils/util.js +0 -272
- package/lib/utils/vdom.js +0 -13
- package/lib/utils/vue-popper.js +0 -202
- package/packages/theme-chalk/lib/alert.css +0 -1
- package/packages/theme-chalk/lib/aside.css +0 -1
- package/packages/theme-chalk/lib/autocomplete.css +0 -1
- package/packages/theme-chalk/lib/avatar.css +0 -1
- package/packages/theme-chalk/lib/backtop.css +0 -1
- package/packages/theme-chalk/lib/badge.css +0 -1
- package/packages/theme-chalk/lib/base.css +0 -1
- package/packages/theme-chalk/lib/breadcrumb-item.css +0 -0
- package/packages/theme-chalk/lib/breadcrumb.css +0 -1
- package/packages/theme-chalk/lib/button-group.css +0 -0
- package/packages/theme-chalk/lib/button.css +0 -1
- package/packages/theme-chalk/lib/calendar.css +0 -1
- package/packages/theme-chalk/lib/card.css +0 -1
- package/packages/theme-chalk/lib/carousel-item.css +0 -1
- package/packages/theme-chalk/lib/carousel.css +0 -1
- package/packages/theme-chalk/lib/cascader-panel.css +0 -1
- package/packages/theme-chalk/lib/cascader.css +0 -1
- package/packages/theme-chalk/lib/checkbox-button.css +0 -0
- package/packages/theme-chalk/lib/checkbox-group.css +0 -0
- package/packages/theme-chalk/lib/checkbox.css +0 -1
- package/packages/theme-chalk/lib/col.css +0 -1
- package/packages/theme-chalk/lib/collapse-item.css +0 -0
- package/packages/theme-chalk/lib/collapse.css +0 -1
- package/packages/theme-chalk/lib/color-picker.css +0 -1
- package/packages/theme-chalk/lib/container.css +0 -1
- package/packages/theme-chalk/lib/date-picker.css +0 -1
- package/packages/theme-chalk/lib/descriptions-item.css +0 -1
- package/packages/theme-chalk/lib/descriptions.css +0 -1
- package/packages/theme-chalk/lib/dialog.css +0 -1
- package/packages/theme-chalk/lib/display.css +0 -1
- package/packages/theme-chalk/lib/divider.css +0 -1
- package/packages/theme-chalk/lib/drawer.css +0 -1
- package/packages/theme-chalk/lib/dropdown-item.css +0 -0
- package/packages/theme-chalk/lib/dropdown-menu.css +0 -0
- package/packages/theme-chalk/lib/dropdown.css +0 -1
- package/packages/theme-chalk/lib/empty.css +0 -1
- package/packages/theme-chalk/lib/fonts/element-icons.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/element-icons.woff +0 -0
- package/packages/theme-chalk/lib/footer.css +0 -1
- package/packages/theme-chalk/lib/form-item.css +0 -0
- package/packages/theme-chalk/lib/form.css +0 -1
- package/packages/theme-chalk/lib/header.css +0 -1
- package/packages/theme-chalk/lib/icon.css +0 -1
- package/packages/theme-chalk/lib/image.css +0 -1
- package/packages/theme-chalk/lib/index.css +0 -1
- package/packages/theme-chalk/lib/infinite-scroll.css +0 -0
- package/packages/theme-chalk/lib/infiniteScroll.css +0 -0
- package/packages/theme-chalk/lib/input-number.css +0 -1
- package/packages/theme-chalk/lib/input.css +0 -1
- package/packages/theme-chalk/lib/link.css +0 -1
- package/packages/theme-chalk/lib/loading.css +0 -1
- package/packages/theme-chalk/lib/main.css +0 -1
- package/packages/theme-chalk/lib/menu-item-group.css +0 -0
- package/packages/theme-chalk/lib/menu-item.css +0 -0
- package/packages/theme-chalk/lib/menu.css +0 -1
- package/packages/theme-chalk/lib/message-box.css +0 -1
- package/packages/theme-chalk/lib/message.css +0 -1
- package/packages/theme-chalk/lib/notification.css +0 -1
- package/packages/theme-chalk/lib/option-group.css +0 -1
- package/packages/theme-chalk/lib/option.css +0 -1
- package/packages/theme-chalk/lib/page-header.css +0 -1
- package/packages/theme-chalk/lib/pagination.css +0 -1
- package/packages/theme-chalk/lib/popconfirm.css +0 -1
- package/packages/theme-chalk/lib/popover.css +0 -1
- package/packages/theme-chalk/lib/popper.css +0 -1
- package/packages/theme-chalk/lib/progress.css +0 -1
- package/packages/theme-chalk/lib/radio-button.css +0 -1
- package/packages/theme-chalk/lib/radio-group.css +0 -1
- package/packages/theme-chalk/lib/radio.css +0 -1
- package/packages/theme-chalk/lib/rate.css +0 -1
- package/packages/theme-chalk/lib/reset.css +0 -1
- package/packages/theme-chalk/lib/result.css +0 -1
- package/packages/theme-chalk/lib/row.css +0 -1
- package/packages/theme-chalk/lib/scrollbar.css +0 -1
- package/packages/theme-chalk/lib/select-dropdown.css +0 -1
- package/packages/theme-chalk/lib/select.css +0 -1
- package/packages/theme-chalk/lib/skeleton-item.css +0 -1
- package/packages/theme-chalk/lib/skeleton.css +0 -1
- package/packages/theme-chalk/lib/slider.css +0 -1
- package/packages/theme-chalk/lib/spinner.css +0 -1
- package/packages/theme-chalk/lib/statistic.css +0 -1
- package/packages/theme-chalk/lib/step.css +0 -1
- package/packages/theme-chalk/lib/steps.css +0 -1
- package/packages/theme-chalk/lib/submenu.css +0 -0
- package/packages/theme-chalk/lib/switch.css +0 -1
- package/packages/theme-chalk/lib/tab-pane.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -1
- package/packages/theme-chalk/lib/table.css +0 -1
- package/packages/theme-chalk/lib/tabs.css +0 -1
- package/packages/theme-chalk/lib/tag.css +0 -1
- package/packages/theme-chalk/lib/time-picker.css +0 -1
- package/packages/theme-chalk/lib/time-select.css +0 -1
- package/packages/theme-chalk/lib/timeline-item.css +0 -1
- package/packages/theme-chalk/lib/timeline.css +0 -1
- package/packages/theme-chalk/lib/tooltip.css +0 -1
- package/packages/theme-chalk/lib/transfer.css +0 -1
- package/packages/theme-chalk/lib/tree.css +0 -1
- package/packages/theme-chalk/lib/upload.css +0 -1
- /package/types/{element-ui.d.ts → element-sim.d.ts} +0 -0
package/lib/utils/after-leave.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
exports.default = function (instance, callback) {
|
|
6
|
-
var speed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300;
|
|
7
|
-
var once = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8
|
-
|
|
9
|
-
if (!instance || !callback) throw new Error('instance & callback is required');
|
|
10
|
-
var called = false;
|
|
11
|
-
var afterLeaveCallback = function afterLeaveCallback() {
|
|
12
|
-
if (called) return;
|
|
13
|
-
called = true;
|
|
14
|
-
if (callback) {
|
|
15
|
-
callback.apply(null, arguments);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
if (once) {
|
|
19
|
-
instance.$once('after-leave', afterLeaveCallback);
|
|
20
|
-
} else {
|
|
21
|
-
instance.$on('after-leave', afterLeaveCallback);
|
|
22
|
-
}
|
|
23
|
-
setTimeout(function () {
|
|
24
|
-
afterLeaveCallback();
|
|
25
|
-
}, speed + 100);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
; /**
|
|
29
|
-
* Bind after-leave event for vue instance. Make sure after-leave is called in any browsers.
|
|
30
|
-
*
|
|
31
|
-
* @param {Vue} instance Vue instance.
|
|
32
|
-
* @param {Function} callback callback of after-leave event
|
|
33
|
-
* @param {Number} speed the speed of transition, default value is 300ms
|
|
34
|
-
* @param {Boolean} once weather bind after-leave once. default value is false.
|
|
35
|
-
*/
|
package/lib/utils/aria-dialog.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
6
|
-
|
|
7
|
-
var _ariaUtils = require('./aria-utils');
|
|
8
|
-
|
|
9
|
-
var _ariaUtils2 = _interopRequireDefault(_ariaUtils);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @constructor
|
|
15
|
-
* @desc Dialog object providing modal focus management.
|
|
16
|
-
*
|
|
17
|
-
* Assumptions: The element serving as the dialog container is present in the
|
|
18
|
-
* DOM and hidden. The dialog container has role='dialog'.
|
|
19
|
-
*
|
|
20
|
-
* @param dialogId
|
|
21
|
-
* The ID of the element serving as the dialog container.
|
|
22
|
-
* @param focusAfterClosed
|
|
23
|
-
* Either the DOM node or the ID of the DOM node to focus when the
|
|
24
|
-
* dialog closes.
|
|
25
|
-
* @param focusFirst
|
|
26
|
-
* Optional parameter containing either the DOM node or the ID of the
|
|
27
|
-
* DOM node to focus when the dialog opens. If not specified, the
|
|
28
|
-
* first focusable element in the dialog will receive focus.
|
|
29
|
-
*/
|
|
30
|
-
var aria = aria || {};
|
|
31
|
-
var tabEvent;
|
|
32
|
-
|
|
33
|
-
aria.Dialog = function (dialog, focusAfterClosed, focusFirst) {
|
|
34
|
-
var _this = this;
|
|
35
|
-
|
|
36
|
-
this.dialogNode = dialog;
|
|
37
|
-
if (this.dialogNode === null || this.dialogNode.getAttribute('role') !== 'dialog') {
|
|
38
|
-
throw new Error('Dialog() requires a DOM element with ARIA role of dialog.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (typeof focusAfterClosed === 'string') {
|
|
42
|
-
this.focusAfterClosed = document.getElementById(focusAfterClosed);
|
|
43
|
-
} else if ((typeof focusAfterClosed === 'undefined' ? 'undefined' : _typeof(focusAfterClosed)) === 'object') {
|
|
44
|
-
this.focusAfterClosed = focusAfterClosed;
|
|
45
|
-
} else {
|
|
46
|
-
this.focusAfterClosed = null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof focusFirst === 'string') {
|
|
50
|
-
this.focusFirst = document.getElementById(focusFirst);
|
|
51
|
-
} else if ((typeof focusFirst === 'undefined' ? 'undefined' : _typeof(focusFirst)) === 'object') {
|
|
52
|
-
this.focusFirst = focusFirst;
|
|
53
|
-
} else {
|
|
54
|
-
this.focusFirst = null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (this.focusFirst) {
|
|
58
|
-
this.focusFirst.focus();
|
|
59
|
-
} else {
|
|
60
|
-
_ariaUtils2.default.focusFirstDescendant(this.dialogNode);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
this.lastFocus = document.activeElement;
|
|
64
|
-
tabEvent = function tabEvent(e) {
|
|
65
|
-
_this.trapFocus(e);
|
|
66
|
-
};
|
|
67
|
-
this.addListeners();
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
aria.Dialog.prototype.addListeners = function () {
|
|
71
|
-
document.addEventListener('focus', tabEvent, true);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
aria.Dialog.prototype.removeListeners = function () {
|
|
75
|
-
document.removeEventListener('focus', tabEvent, true);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
aria.Dialog.prototype.closeDialog = function () {
|
|
79
|
-
var _this2 = this;
|
|
80
|
-
|
|
81
|
-
this.removeListeners();
|
|
82
|
-
if (this.focusAfterClosed) {
|
|
83
|
-
setTimeout(function () {
|
|
84
|
-
_this2.focusAfterClosed.focus();
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
aria.Dialog.prototype.trapFocus = function (event) {
|
|
90
|
-
if (_ariaUtils2.default.IgnoreUtilFocusChanges) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (this.dialogNode.contains(event.target)) {
|
|
94
|
-
this.lastFocus = event.target;
|
|
95
|
-
} else {
|
|
96
|
-
_ariaUtils2.default.focusFirstDescendant(this.dialogNode);
|
|
97
|
-
if (this.lastFocus === document.activeElement) {
|
|
98
|
-
_ariaUtils2.default.focusLastDescendant(this.dialogNode);
|
|
99
|
-
}
|
|
100
|
-
this.lastFocus = document.activeElement;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
exports.default = aria.Dialog;
|
package/lib/utils/aria-utils.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
var aria = aria || {};
|
|
5
|
-
|
|
6
|
-
aria.Utils = aria.Utils || {};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @desc Set focus on descendant nodes until the first focusable element is
|
|
10
|
-
* found.
|
|
11
|
-
* @param element
|
|
12
|
-
* DOM node for which to find the first focusable descendant.
|
|
13
|
-
* @returns
|
|
14
|
-
* true if a focusable element is found and focus is set.
|
|
15
|
-
*/
|
|
16
|
-
aria.Utils.focusFirstDescendant = function (element) {
|
|
17
|
-
for (var i = 0; i < element.childNodes.length; i++) {
|
|
18
|
-
var child = element.childNodes[i];
|
|
19
|
-
if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @desc Find the last descendant node that is focusable.
|
|
28
|
-
* @param element
|
|
29
|
-
* DOM node for which to find the last focusable descendant.
|
|
30
|
-
* @returns
|
|
31
|
-
* true if a focusable element is found and focus is set.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
aria.Utils.focusLastDescendant = function (element) {
|
|
35
|
-
for (var i = element.childNodes.length - 1; i >= 0; i--) {
|
|
36
|
-
var child = element.childNodes[i];
|
|
37
|
-
if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @desc Set Attempt to set focus on the current node.
|
|
46
|
-
* @param element
|
|
47
|
-
* The node to attempt to focus on.
|
|
48
|
-
* @returns
|
|
49
|
-
* true if element is focused.
|
|
50
|
-
*/
|
|
51
|
-
aria.Utils.attemptFocus = function (element) {
|
|
52
|
-
if (!aria.Utils.isFocusable(element)) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
aria.Utils.IgnoreUtilFocusChanges = true;
|
|
56
|
-
try {
|
|
57
|
-
element.focus();
|
|
58
|
-
} catch (e) {}
|
|
59
|
-
aria.Utils.IgnoreUtilFocusChanges = false;
|
|
60
|
-
return document.activeElement === element;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
aria.Utils.isFocusable = function (element) {
|
|
64
|
-
if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (element.disabled) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
switch (element.nodeName) {
|
|
73
|
-
case 'A':
|
|
74
|
-
return !!element.href && element.rel !== 'ignore';
|
|
75
|
-
case 'INPUT':
|
|
76
|
-
return element.type !== 'hidden' && element.type !== 'file';
|
|
77
|
-
case 'BUTTON':
|
|
78
|
-
case 'SELECT':
|
|
79
|
-
case 'TEXTAREA':
|
|
80
|
-
return true;
|
|
81
|
-
default:
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* 触发一个事件
|
|
88
|
-
* mouseenter, mouseleave, mouseover, keyup, change, click 等
|
|
89
|
-
* @param {Element} elm
|
|
90
|
-
* @param {String} name
|
|
91
|
-
* @param {*} opts
|
|
92
|
-
*/
|
|
93
|
-
aria.Utils.triggerEvent = function (elm, name) {
|
|
94
|
-
var eventName = void 0;
|
|
95
|
-
|
|
96
|
-
if (/^mouse|click/.test(name)) {
|
|
97
|
-
eventName = 'MouseEvents';
|
|
98
|
-
} else if (/^key/.test(name)) {
|
|
99
|
-
eventName = 'KeyboardEvent';
|
|
100
|
-
} else {
|
|
101
|
-
eventName = 'HTMLEvents';
|
|
102
|
-
}
|
|
103
|
-
var evt = document.createEvent(eventName);
|
|
104
|
-
|
|
105
|
-
for (var _len = arguments.length, opts = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
106
|
-
opts[_key - 2] = arguments[_key];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
evt.initEvent.apply(evt, [name].concat(opts));
|
|
110
|
-
elm.dispatchEvent ? elm.dispatchEvent(evt) : elm.fireEvent('on' + name, evt);
|
|
111
|
-
|
|
112
|
-
return elm;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
aria.Utils.keys = {
|
|
116
|
-
tab: 9,
|
|
117
|
-
enter: 13,
|
|
118
|
-
space: 32,
|
|
119
|
-
left: 37,
|
|
120
|
-
up: 38,
|
|
121
|
-
right: 39,
|
|
122
|
-
down: 40,
|
|
123
|
-
esc: 27
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
exports.default = aria.Utils;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _vue = require('vue');
|
|
6
|
-
|
|
7
|
-
var _vue2 = _interopRequireDefault(_vue);
|
|
8
|
-
|
|
9
|
-
var _dom = require('element-SIM/lib/utils/dom');
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
var nodeList = [];
|
|
14
|
-
var ctx = '@@clickoutsideContext';
|
|
15
|
-
|
|
16
|
-
var startClick = void 0;
|
|
17
|
-
var seed = 0;
|
|
18
|
-
|
|
19
|
-
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mousedown', function (e) {
|
|
20
|
-
return startClick = e;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mouseup', function (e) {
|
|
24
|
-
nodeList.forEach(function (node) {
|
|
25
|
-
return node[ctx].documentHandler(e, startClick);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
function createDocumentHandler(el, binding, vnode) {
|
|
30
|
-
return function () {
|
|
31
|
-
var mouseup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
-
var mousedown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
33
|
-
|
|
34
|
-
if (!vnode || !vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target))) return;
|
|
35
|
-
|
|
36
|
-
if (binding.expression && el[ctx].methodName && vnode.context[el[ctx].methodName]) {
|
|
37
|
-
vnode.context[el[ctx].methodName]();
|
|
38
|
-
} else {
|
|
39
|
-
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* v-clickoutside
|
|
46
|
-
* @desc 点击元素外面才会触发的事件
|
|
47
|
-
* @example
|
|
48
|
-
* ```vue
|
|
49
|
-
* <div v-element-clickoutside="handleClose">
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
exports.default = {
|
|
53
|
-
bind: function bind(el, binding, vnode) {
|
|
54
|
-
nodeList.push(el);
|
|
55
|
-
var id = seed++;
|
|
56
|
-
el[ctx] = {
|
|
57
|
-
id: id,
|
|
58
|
-
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
59
|
-
methodName: binding.expression,
|
|
60
|
-
bindingFn: binding.value
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
update: function update(el, binding, vnode) {
|
|
64
|
-
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
65
|
-
el[ctx].methodName = binding.expression;
|
|
66
|
-
el[ctx].bindingFn = binding.value;
|
|
67
|
-
},
|
|
68
|
-
unbind: function unbind(el) {
|
|
69
|
-
var len = nodeList.length;
|
|
70
|
-
|
|
71
|
-
for (var i = 0; i < len; i++) {
|
|
72
|
-
if (nodeList[i][ctx].id === el[ctx].id) {
|
|
73
|
-
nodeList.splice(i, 1);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
delete el[ctx];
|
|
78
|
-
}
|
|
79
|
-
};
|
package/lib/utils/date-util.js
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.validateRangeInOneMonth = exports.extractTimeFormat = exports.extractDateFormat = exports.nextYear = exports.prevYear = exports.nextMonth = exports.prevMonth = exports.changeYearMonthAndClampDate = exports.timeWithinRange = exports.limitTimeRange = exports.clearMilliseconds = exports.clearTime = exports.modifyWithTimeString = exports.modifyTime = exports.modifyDate = exports.range = exports.getRangeMinutes = exports.getMonthDays = exports.getPrevMonthLastDays = exports.getRangeHours = exports.getWeekNumber = exports.getStartDateOfMonth = exports.nextDate = exports.prevDate = exports.getFirstDayOfMonth = exports.getDayCountOfYear = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDateObject = exports.isDate = exports.toDate = exports.getI18nSettings = undefined;
|
|
5
|
-
|
|
6
|
-
var _date = require('element-SIM/lib/utils/date');
|
|
7
|
-
|
|
8
|
-
var _date2 = _interopRequireDefault(_date);
|
|
9
|
-
|
|
10
|
-
var _locale = require('element-SIM/lib/locale');
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
15
|
-
var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
16
|
-
|
|
17
|
-
var newArray = function newArray(start, end) {
|
|
18
|
-
var result = [];
|
|
19
|
-
for (var i = start; i <= end; i++) {
|
|
20
|
-
result.push(i);
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var getI18nSettings = exports.getI18nSettings = function getI18nSettings() {
|
|
26
|
-
return {
|
|
27
|
-
dayNamesShort: weeks.map(function (week) {
|
|
28
|
-
return (0, _locale.t)('el.datepicker.weeks.' + week);
|
|
29
|
-
}),
|
|
30
|
-
dayNames: weeks.map(function (week) {
|
|
31
|
-
return (0, _locale.t)('el.datepicker.weeks.' + week);
|
|
32
|
-
}),
|
|
33
|
-
monthNamesShort: months.map(function (month) {
|
|
34
|
-
return (0, _locale.t)('el.datepicker.months.' + month);
|
|
35
|
-
}),
|
|
36
|
-
monthNames: months.map(function (month, index) {
|
|
37
|
-
return (0, _locale.t)('el.datepicker.month' + (index + 1));
|
|
38
|
-
}),
|
|
39
|
-
amPm: ['am', 'pm']
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var toDate = exports.toDate = function toDate(date) {
|
|
44
|
-
return isDate(date) ? new Date(date) : null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
var isDate = exports.isDate = function isDate(date) {
|
|
48
|
-
if (date === null || date === undefined) return false;
|
|
49
|
-
if (isNaN(new Date(date).getTime())) return false;
|
|
50
|
-
if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
|
|
51
|
-
return true;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var isDateObject = exports.isDateObject = function isDateObject(val) {
|
|
55
|
-
return val instanceof Date;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var formatDate = exports.formatDate = function formatDate(date, format) {
|
|
59
|
-
date = toDate(date);
|
|
60
|
-
if (!date) return '';
|
|
61
|
-
return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings());
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
var parseDate = exports.parseDate = function parseDate(string, format) {
|
|
65
|
-
return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
|
|
69
|
-
if (isNaN(+month)) return 31;
|
|
70
|
-
|
|
71
|
-
return new Date(year, +month + 1, 0).getDate();
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) {
|
|
75
|
-
var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
|
|
76
|
-
return isLeapYear ? 366 : 365;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
|
|
80
|
-
var temp = new Date(date.getTime());
|
|
81
|
-
temp.setDate(1);
|
|
82
|
-
return temp.getDay();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
|
|
86
|
-
// {prev, next} Date should work for Daylight Saving Time
|
|
87
|
-
// Adding 24 * 60 * 60 * 1000 does not work in the above scenario
|
|
88
|
-
var prevDate = exports.prevDate = function prevDate(date) {
|
|
89
|
-
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
90
|
-
|
|
91
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
var nextDate = exports.nextDate = function nextDate(date) {
|
|
95
|
-
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
96
|
-
|
|
97
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
|
|
101
|
-
var result = new Date(year, month, 1);
|
|
102
|
-
var day = result.getDay();
|
|
103
|
-
|
|
104
|
-
if (day === 0) {
|
|
105
|
-
return prevDate(result, 7);
|
|
106
|
-
} else {
|
|
107
|
-
return prevDate(result, day);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
|
|
112
|
-
if (!isDate(src)) return null;
|
|
113
|
-
var date = new Date(src.getTime());
|
|
114
|
-
date.setHours(0, 0, 0, 0);
|
|
115
|
-
// Thursday in current week decides the year.
|
|
116
|
-
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
|
|
117
|
-
// January 4 is always in week 1.
|
|
118
|
-
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
119
|
-
// Adjust to Thursday in week 1 and count number of weeks from date to week 1.
|
|
120
|
-
// Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours.
|
|
121
|
-
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
|
|
125
|
-
var hours = [];
|
|
126
|
-
var disabledHours = [];
|
|
127
|
-
|
|
128
|
-
(ranges || []).forEach(function (range) {
|
|
129
|
-
var value = range.map(function (date) {
|
|
130
|
-
return date.getHours();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
disabledHours = disabledHours.concat(newArray(value[0], value[1]));
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
if (disabledHours.length) {
|
|
137
|
-
for (var i = 0; i < 24; i++) {
|
|
138
|
-
hours[i] = disabledHours.indexOf(i) === -1;
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
for (var _i = 0; _i < 24; _i++) {
|
|
142
|
-
hours[_i] = false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return hours;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
var getPrevMonthLastDays = exports.getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
|
|
150
|
-
if (amount <= 0) return [];
|
|
151
|
-
var temp = new Date(date.getTime());
|
|
152
|
-
temp.setDate(0);
|
|
153
|
-
var lastDay = temp.getDate();
|
|
154
|
-
return range(amount).map(function (_, index) {
|
|
155
|
-
return lastDay - (amount - index - 1);
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
var getMonthDays = exports.getMonthDays = function getMonthDays(date) {
|
|
160
|
-
var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
161
|
-
var days = temp.getDate();
|
|
162
|
-
return range(days).map(function (_, index) {
|
|
163
|
-
return index + 1;
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
function setRangeData(arr, start, end, value) {
|
|
168
|
-
for (var i = start; i < end; i++) {
|
|
169
|
-
arr[i] = value;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var getRangeMinutes = exports.getRangeMinutes = function getRangeMinutes(ranges, hour) {
|
|
174
|
-
var minutes = new Array(60);
|
|
175
|
-
|
|
176
|
-
if (ranges.length > 0) {
|
|
177
|
-
ranges.forEach(function (range) {
|
|
178
|
-
var start = range[0];
|
|
179
|
-
var end = range[1];
|
|
180
|
-
var startHour = start.getHours();
|
|
181
|
-
var startMinute = start.getMinutes();
|
|
182
|
-
var endHour = end.getHours();
|
|
183
|
-
var endMinute = end.getMinutes();
|
|
184
|
-
if (startHour === hour && endHour !== hour) {
|
|
185
|
-
setRangeData(minutes, startMinute, 60, true);
|
|
186
|
-
} else if (startHour === hour && endHour === hour) {
|
|
187
|
-
setRangeData(minutes, startMinute, endMinute + 1, true);
|
|
188
|
-
} else if (startHour !== hour && endHour === hour) {
|
|
189
|
-
setRangeData(minutes, 0, endMinute + 1, true);
|
|
190
|
-
} else if (startHour < hour && endHour > hour) {
|
|
191
|
-
setRangeData(minutes, 0, 60, true);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
} else {
|
|
195
|
-
setRangeData(minutes, 0, 60, true);
|
|
196
|
-
}
|
|
197
|
-
return minutes;
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
var range = exports.range = function range(n) {
|
|
201
|
-
// see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
|
|
202
|
-
return Array.apply(null, { length: n }).map(function (_, n) {
|
|
203
|
-
return n;
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) {
|
|
208
|
-
return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) {
|
|
212
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) {
|
|
216
|
-
if (date == null || !time) {
|
|
217
|
-
return date;
|
|
218
|
-
}
|
|
219
|
-
time = parseDate(time, 'HH:mm:ss');
|
|
220
|
-
return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
var clearTime = exports.clearTime = function clearTime(date) {
|
|
224
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) {
|
|
228
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) {
|
|
232
|
-
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
|
|
233
|
-
|
|
234
|
-
// TODO: refactory a more elegant solution
|
|
235
|
-
if (ranges.length === 0) return date;
|
|
236
|
-
var normalizeDate = function normalizeDate(date) {
|
|
237
|
-
return _date2.default.parse(_date2.default.format(date, format), format);
|
|
238
|
-
};
|
|
239
|
-
var ndate = normalizeDate(date);
|
|
240
|
-
var nranges = ranges.map(function (range) {
|
|
241
|
-
return range.map(normalizeDate);
|
|
242
|
-
});
|
|
243
|
-
if (nranges.some(function (nrange) {
|
|
244
|
-
return ndate >= nrange[0] && ndate <= nrange[1];
|
|
245
|
-
})) return date;
|
|
246
|
-
|
|
247
|
-
var minDate = nranges[0][0];
|
|
248
|
-
var maxDate = nranges[0][0];
|
|
249
|
-
|
|
250
|
-
nranges.forEach(function (nrange) {
|
|
251
|
-
minDate = new Date(Math.min(nrange[0], minDate));
|
|
252
|
-
maxDate = new Date(Math.max(nrange[1], minDate));
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
var ret = ndate < minDate ? minDate : maxDate;
|
|
256
|
-
// preserve Year/Month/Date
|
|
257
|
-
return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) {
|
|
261
|
-
var limitedDate = limitTimeRange(date, selectableRange, format);
|
|
262
|
-
return limitedDate.getTime() === date.getTime();
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
|
|
266
|
-
// clamp date to the number of days in `year`, `month`
|
|
267
|
-
// eg: (2010-1-31, 2010, 2) => 2010-2-28
|
|
268
|
-
var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
|
|
269
|
-
return modifyDate(date, year, month, monthDate);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
var prevMonth = exports.prevMonth = function prevMonth(date) {
|
|
273
|
-
var year = date.getFullYear();
|
|
274
|
-
var month = date.getMonth();
|
|
275
|
-
return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
var nextMonth = exports.nextMonth = function nextMonth(date) {
|
|
279
|
-
var year = date.getFullYear();
|
|
280
|
-
var month = date.getMonth();
|
|
281
|
-
return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
var prevYear = exports.prevYear = function prevYear(date) {
|
|
285
|
-
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
286
|
-
|
|
287
|
-
var year = date.getFullYear();
|
|
288
|
-
var month = date.getMonth();
|
|
289
|
-
return changeYearMonthAndClampDate(date, year - amount, month);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var nextYear = exports.nextYear = function nextYear(date) {
|
|
293
|
-
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
294
|
-
|
|
295
|
-
var year = date.getFullYear();
|
|
296
|
-
var month = date.getMonth();
|
|
297
|
-
return changeYearMonthAndClampDate(date, year + amount, month);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) {
|
|
301
|
-
return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) {
|
|
305
|
-
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
var validateRangeInOneMonth = exports.validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
|
|
309
|
-
return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
|
|
310
|
-
};
|