@soxa-ui/plugins 0.0.0-stage → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +125 -2
- package/dist/base/base.class.d.ts +54 -0
- package/dist/base/base.class.js +69 -0
- package/dist/base/bundle.class.d.ts +25 -0
- package/dist/base/bundle.class.js +68 -0
- package/dist/base/index.d.ts +3 -0
- package/dist/base/types.d.ts +147 -0
- package/dist/custom/accordion/header.d.ts +19 -0
- package/dist/custom/accordion/header.js +38 -0
- package/dist/custom/accordion/index.d.ts +2 -0
- package/dist/custom/accordion/item-ids/index.d.ts +1 -0
- package/dist/custom/accordion/item-ids/item-ids.plugin.d.ts +24 -0
- package/dist/custom/accordion/item-ids/item-ids.plugin.js +44 -0
- package/dist/custom/action/action.plugin.d.ts +178 -0
- package/dist/custom/action/action.plugin.js +339 -0
- package/dist/custom/action/index.d.ts +2 -0
- package/dist/custom/action/types.d.ts +65 -0
- package/dist/custom/calendar/ids/ids.plugin.d.ts +25 -0
- package/dist/custom/calendar/ids/ids.plugin.js +44 -0
- package/dist/custom/calendar/ids/index.d.ts +1 -0
- package/dist/custom/calendar/index.d.ts +5 -0
- package/dist/custom/calendar/keyboard/index.d.ts +2 -0
- package/dist/custom/calendar/keyboard/keyboard.plugin.d.ts +114 -0
- package/dist/custom/calendar/keyboard/keyboard.plugin.js +249 -0
- package/dist/custom/calendar/keyboard/types.d.ts +16 -0
- package/dist/custom/calendar/names/index.d.ts +1 -0
- package/dist/custom/calendar/names/names.plugin.d.ts +24 -0
- package/dist/custom/calendar/names/names.plugin.js +45 -0
- package/dist/custom/calendar/parts.d.ts +58 -0
- package/dist/custom/calendar/parts.js +119 -0
- package/dist/custom/calendar/pointer/index.d.ts +2 -0
- package/dist/custom/calendar/pointer/pointer.plugin.d.ts +58 -0
- package/dist/custom/calendar/pointer/pointer.plugin.js +144 -0
- package/dist/custom/calendar/pointer/types.d.ts +6 -0
- package/dist/custom/calendar/stop.d.ts +20 -0
- package/dist/custom/calendar/stop.js +32 -0
- package/dist/custom/calendar/types.d.ts +16 -0
- package/dist/custom/clearable/index.d.ts +1 -0
- package/dist/custom/clearable/names/index.d.ts +1 -0
- package/dist/custom/clearable/names/names.plugin.d.ts +24 -0
- package/dist/custom/clearable/names/names.plugin.js +29 -0
- package/dist/custom/collection/bundles.plugin.d.ts +55 -0
- package/dist/custom/collection/bundles.plugin.js +100 -0
- package/dist/custom/collection/collection-bundles-access.plugin.d.ts +29 -0
- package/dist/custom/collection/collection-bundles-access.plugin.js +44 -0
- package/dist/custom/collection/collection-elements.plugin.d.ts +55 -0
- package/dist/custom/collection/collection-elements.plugin.js +100 -0
- package/dist/custom/collection/index.d.ts +4 -0
- package/dist/custom/collection/leaving-focus.d.ts +119 -0
- package/dist/custom/collection/leaving-focus.js +164 -0
- package/dist/custom/collection/reachable.d.ts +14 -0
- package/dist/custom/collection/reachable.js +18 -0
- package/dist/custom/collection/types.d.ts +14 -0
- package/dist/custom/component-view/aria.plugin.d.ts +102 -0
- package/dist/custom/component-view/aria.plugin.js +190 -0
- package/dist/custom/component-view/index.d.ts +2 -0
- package/dist/custom/component-view/types.d.ts +62 -0
- package/dist/custom/date-input/clipboard/clipboard.plugin.d.ts +41 -0
- package/dist/custom/date-input/clipboard/clipboard.plugin.js +98 -0
- package/dist/custom/date-input/clipboard/index.d.ts +2 -0
- package/dist/custom/date-input/clipboard/types.d.ts +6 -0
- package/dist/custom/date-input/ids/ids.plugin.d.ts +21 -0
- package/dist/custom/date-input/ids/ids.plugin.js +28 -0
- package/dist/custom/date-input/ids/index.d.ts +1 -0
- package/dist/custom/date-input/index.d.ts +6 -0
- package/dist/custom/date-input/keyboard/index.d.ts +2 -0
- package/dist/custom/date-input/keyboard/keyboard.plugin.d.ts +54 -0
- package/dist/custom/date-input/keyboard/keyboard.plugin.js +154 -0
- package/dist/custom/date-input/keyboard/types.d.ts +9 -0
- package/dist/custom/date-input/parts.d.ts +49 -0
- package/dist/custom/date-input/parts.js +127 -0
- package/dist/custom/date-input/pointer/index.d.ts +2 -0
- package/dist/custom/date-input/pointer/pointer.plugin.d.ts +51 -0
- package/dist/custom/date-input/pointer/pointer.plugin.js +141 -0
- package/dist/custom/date-input/pointer/types.d.ts +6 -0
- package/dist/custom/date-input/touch/index.d.ts +2 -0
- package/dist/custom/date-input/touch/touch.plugin.d.ts +100 -0
- package/dist/custom/date-input/touch/touch.plugin.js +276 -0
- package/dist/custom/date-input/touch/types.d.ts +6 -0
- package/dist/custom/date-input/types.d.ts +6 -0
- package/dist/custom/date-picker/field.d.ts +20 -0
- package/dist/custom/date-picker/field.js +27 -0
- package/dist/custom/date-picker/focus/focus.plugin.d.ts +56 -0
- package/dist/custom/date-picker/focus/focus.plugin.js +81 -0
- package/dist/custom/date-picker/focus/index.d.ts +2 -0
- package/dist/custom/date-picker/focus/types.d.ts +3 -0
- package/dist/custom/date-picker/ids/ids.plugin.d.ts +19 -0
- package/dist/custom/date-picker/ids/ids.plugin.js +28 -0
- package/dist/custom/date-picker/ids/index.d.ts +1 -0
- package/dist/custom/date-picker/index.d.ts +5 -0
- package/dist/custom/date-picker/names/index.d.ts +2 -0
- package/dist/custom/date-picker/names/names.plugin.d.ts +33 -0
- package/dist/custom/date-picker/names/names.plugin.js +80 -0
- package/dist/custom/date-picker/names/types.d.ts +12 -0
- package/dist/custom/date-picker/trigger/index.d.ts +2 -0
- package/dist/custom/date-picker/trigger/trigger.plugin.d.ts +37 -0
- package/dist/custom/date-picker/trigger/trigger.plugin.js +69 -0
- package/dist/custom/date-picker/trigger/types.d.ts +3 -0
- package/dist/custom/dialog/ids/ids.plugin.d.ts +15 -0
- package/dist/custom/dialog/ids/ids.plugin.js +28 -0
- package/dist/custom/dialog/ids/index.d.ts +1 -0
- package/dist/custom/dialog/index.d.ts +3 -0
- package/dist/custom/dialog/layout/index.d.ts +3 -0
- package/dist/custom/dialog/layout/layout.plugin.d.ts +42 -0
- package/dist/custom/dialog/layout/layout.plugin.js +78 -0
- package/dist/custom/dialog/layout/offset-event.d.ts +35 -0
- package/dist/custom/dialog/layout/offset-event.js +44 -0
- package/dist/custom/dialog/layout/types.d.ts +12 -0
- package/dist/custom/dialog/names/index.d.ts +1 -0
- package/dist/custom/dialog/names/names.plugin.d.ts +13 -0
- package/dist/custom/dialog/names/names.plugin.js +17 -0
- package/dist/custom/dismiss/dismiss.plugin.d.ts +174 -0
- package/dist/custom/dismiss/dismiss.plugin.js +287 -0
- package/dist/custom/dismiss/index.d.ts +2 -0
- package/dist/custom/dismiss/types.d.ts +59 -0
- package/dist/custom/drag-and-drop/drag.plugin.d.ts +87 -0
- package/dist/custom/drag-and-drop/drag.plugin.js +310 -0
- package/dist/custom/drag-and-drop/index.d.ts +2 -0
- package/dist/custom/drag-and-drop/types.d.ts +13 -0
- package/dist/custom/drawer/index.d.ts +1 -0
- package/dist/custom/drawer/layout/index.d.ts +2 -0
- package/dist/custom/drawer/layout/layout.plugin.d.ts +17 -0
- package/dist/custom/drawer/layout/layout.plugin.js +22 -0
- package/dist/custom/drawer/layout/types.d.ts +3 -0
- package/dist/custom/element/element.plugin.d.ts +35 -0
- package/dist/custom/element/element.plugin.js +58 -0
- package/dist/custom/element/index.d.ts +2 -0
- package/dist/custom/element/types.d.ts +18 -0
- package/dist/custom/field/ids/ids.plugin.d.ts +64 -0
- package/dist/custom/field/ids/ids.plugin.js +126 -0
- package/dist/custom/field/ids/index.d.ts +2 -0
- package/dist/custom/field/ids/types.d.ts +28 -0
- package/dist/custom/field/index.d.ts +1 -0
- package/dist/custom/frame/anchor/anchor.plugin.d.ts +483 -0
- package/dist/custom/frame/anchor/anchor.plugin.js +820 -0
- package/dist/custom/frame/anchor/index.d.ts +2 -0
- package/dist/custom/frame/anchor/types.d.ts +83 -0
- package/dist/custom/frame/index.d.ts +2 -0
- package/dist/custom/frame/layout/index.d.ts +2 -0
- package/dist/custom/frame/layout/layout.plugin.d.ts +24 -0
- package/dist/custom/frame/layout/layout.plugin.js +65 -0
- package/dist/custom/frame/layout/types.d.ts +5 -0
- package/dist/custom/icon/index.d.ts +2 -0
- package/dist/custom/icon/layout.plugin.d.ts +21 -0
- package/dist/custom/icon/layout.plugin.js +51 -0
- package/dist/custom/icon/types.d.ts +5 -0
- package/dist/custom/id/id.plugin.d.ts +32 -0
- package/dist/custom/id/id.plugin.js +42 -0
- package/dist/custom/id/index.d.ts +2 -0
- package/dist/custom/id/types.d.ts +6 -0
- package/dist/custom/index.d.ts +42 -0
- package/dist/custom/input/field.d.ts +16 -0
- package/dist/custom/input/field.js +27 -0
- package/dist/custom/input/index.d.ts +3 -0
- package/dist/custom/input/input.plugin.d.ts +12 -0
- package/dist/custom/input/input.plugin.js +46 -0
- package/dist/custom/input/types.d.ts +2 -0
- package/dist/custom/input-bool/index.d.ts +2 -0
- package/dist/custom/input-bool/input-bool.plugin.d.ts +30 -0
- package/dist/custom/input-bool/input-bool.plugin.js +77 -0
- package/dist/custom/input-bool/types.d.ts +5 -0
- package/dist/custom/input-control/index.d.ts +2 -0
- package/dist/custom/input-control/input-control.plugin.d.ts +12 -0
- package/dist/custom/input-control/input-control.plugin.js +40 -0
- package/dist/custom/input-control/types.d.ts +2 -0
- package/dist/custom/item-group/ids/ids.plugin.d.ts +19 -0
- package/dist/custom/item-group/ids/ids.plugin.js +32 -0
- package/dist/custom/item-group/ids/index.d.ts +1 -0
- package/dist/custom/item-group/index.d.ts +1 -0
- package/dist/custom/label/index.d.ts +1 -0
- package/dist/custom/label/nested-warn/index.d.ts +1 -0
- package/dist/custom/label/nested-warn/nested-warn.plugin.d.ts +21 -0
- package/dist/custom/label/nested-warn/nested-warn.plugin.js +41 -0
- package/dist/custom/list/height/height.plugin.d.ts +129 -0
- package/dist/custom/list/height/height.plugin.js +272 -0
- package/dist/custom/list/height/index.d.ts +2 -0
- package/dist/custom/list/height/types.d.ts +10 -0
- package/dist/custom/list/index.d.ts +7 -0
- package/dist/custom/list/item/index.d.ts +2 -0
- package/dist/custom/list/item/item.plugin.d.ts +25 -0
- package/dist/custom/list/item/item.plugin.js +46 -0
- package/dist/custom/list/item/types.d.ts +5 -0
- package/dist/custom/list/keyboard/index.d.ts +2 -0
- package/dist/custom/list/keyboard/keyboard.plugin.d.ts +133 -0
- package/dist/custom/list/keyboard/keyboard.plugin.js +199 -0
- package/dist/custom/list/keyboard/types.d.ts +3 -0
- package/dist/custom/list/navigation/index.d.ts +2 -0
- package/dist/custom/list/navigation/navigation.plugin.d.ts +262 -0
- package/dist/custom/list/navigation/navigation.plugin.js +402 -0
- package/dist/custom/list/navigation/types.d.ts +25 -0
- package/dist/custom/list/newly-selected.d.ts +17 -0
- package/dist/custom/list/newly-selected.js +22 -0
- package/dist/custom/list/option-ids/index.d.ts +1 -0
- package/dist/custom/list/option-ids/option-ids.plugin.d.ts +29 -0
- package/dist/custom/list/option-ids/option-ids.plugin.js +43 -0
- package/dist/custom/list/row.d.ts +50 -0
- package/dist/custom/list/row.js +99 -0
- package/dist/custom/list/scroll/index.d.ts +2 -0
- package/dist/custom/list/scroll/scroll.plugin.d.ts +132 -0
- package/dist/custom/list/scroll/scroll.plugin.js +286 -0
- package/dist/custom/list/scroll/types.d.ts +21 -0
- package/dist/custom/list/typeahead.d.ts +53 -0
- package/dist/custom/list/typeahead.js +58 -0
- package/dist/custom/menu/focus/focus.plugin.d.ts +61 -0
- package/dist/custom/menu/focus/focus.plugin.js +105 -0
- package/dist/custom/menu/focus/index.d.ts +2 -0
- package/dist/custom/menu/focus/types.d.ts +2 -0
- package/dist/custom/menu/hover/hover.plugin.d.ts +99 -0
- package/dist/custom/menu/hover/hover.plugin.js +235 -0
- package/dist/custom/menu/hover/index.d.ts +2 -0
- package/dist/custom/menu/hover/types.d.ts +2 -0
- package/dist/custom/menu/ids/ids.plugin.d.ts +29 -0
- package/dist/custom/menu/ids/ids.plugin.js +46 -0
- package/dist/custom/menu/ids/index.d.ts +1 -0
- package/dist/custom/menu/index.d.ts +11 -0
- package/dist/custom/menu/keyboard/index.d.ts +2 -0
- package/dist/custom/menu/keyboard/keyboard.plugin.d.ts +41 -0
- package/dist/custom/menu/keyboard/keyboard.plugin.js +68 -0
- package/dist/custom/menu/keyboard/types.d.ts +2 -0
- package/dist/custom/menu/navigation/index.d.ts +2 -0
- package/dist/custom/menu/navigation/navigation.plugin.d.ts +116 -0
- package/dist/custom/menu/navigation/navigation.plugin.js +222 -0
- package/dist/custom/menu/navigation/types.d.ts +2 -0
- package/dist/custom/menu/nested-layer.d.ts +13 -0
- package/dist/custom/menu/nested-layer.js +20 -0
- package/dist/custom/menu/pointer/index.d.ts +2 -0
- package/dist/custom/menu/pointer/pointer.plugin.d.ts +45 -0
- package/dist/custom/menu/pointer/pointer.plugin.js +95 -0
- package/dist/custom/menu/pointer/strategies/context.strategy.d.ts +70 -0
- package/dist/custom/menu/pointer/strategies/context.strategy.js +170 -0
- package/dist/custom/menu/pointer/strategies/index.d.ts +3 -0
- package/dist/custom/menu/pointer/strategies/press.strategy.d.ts +23 -0
- package/dist/custom/menu/pointer/strategies/press.strategy.js +33 -0
- package/dist/custom/menu/pointer/strategies/types.d.ts +49 -0
- package/dist/custom/menu/pointer/types.d.ts +2 -0
- package/dist/custom/menu/popover-item-focus/focus.plugin.d.ts +54 -0
- package/dist/custom/menu/popover-item-focus/focus.plugin.js +70 -0
- package/dist/custom/menu/popover-item-focus/index.d.ts +2 -0
- package/dist/custom/menu/popover-item-focus/types.d.ts +10 -0
- package/dist/custom/menu/popover-item-keyboard/index.d.ts +2 -0
- package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.d.ts +43 -0
- package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.js +79 -0
- package/dist/custom/menu/popover-item-keyboard/types.d.ts +2 -0
- package/dist/custom/menu/popup-ids/ids.plugin.d.ts +27 -0
- package/dist/custom/menu/popup-ids/ids.plugin.js +47 -0
- package/dist/custom/menu/popup-ids/index.d.ts +1 -0
- package/dist/custom/menu/submenu-focus/focus.plugin.d.ts +53 -0
- package/dist/custom/menu/submenu-focus/focus.plugin.js +84 -0
- package/dist/custom/menu/submenu-focus/index.d.ts +2 -0
- package/dist/custom/menu/submenu-focus/types.d.ts +10 -0
- package/dist/custom/menu/submenu-keyboard/index.d.ts +2 -0
- package/dist/custom/menu/submenu-keyboard/keyboard.plugin.d.ts +43 -0
- package/dist/custom/menu/submenu-keyboard/keyboard.plugin.js +74 -0
- package/dist/custom/menu/submenu-keyboard/types.d.ts +2 -0
- package/dist/custom/number-input/index.d.ts +5 -0
- package/dist/custom/number-input/keyboard/index.d.ts +2 -0
- package/dist/custom/number-input/keyboard/keyboard.plugin.d.ts +36 -0
- package/dist/custom/number-input/keyboard/keyboard.plugin.js +80 -0
- package/dist/custom/number-input/keyboard/types.d.ts +3 -0
- package/dist/custom/number-input/names/index.d.ts +1 -0
- package/dist/custom/number-input/names/names.plugin.d.ts +17 -0
- package/dist/custom/number-input/names/names.plugin.js +24 -0
- package/dist/custom/number-input/parts.d.ts +21 -0
- package/dist/custom/number-input/parts.js +39 -0
- package/dist/custom/number-input/stepper/index.d.ts +2 -0
- package/dist/custom/number-input/stepper/stepper.plugin.d.ts +59 -0
- package/dist/custom/number-input/stepper/stepper.plugin.js +166 -0
- package/dist/custom/number-input/stepper/types.d.ts +19 -0
- package/dist/custom/number-input/touch/index.d.ts +2 -0
- package/dist/custom/number-input/touch/touch.plugin.d.ts +25 -0
- package/dist/custom/number-input/touch/touch.plugin.js +53 -0
- package/dist/custom/number-input/touch/types.d.ts +3 -0
- package/dist/custom/number-input/types.d.ts +8 -0
- package/dist/custom/number-input/typing/index.d.ts +2 -0
- package/dist/custom/number-input/typing/types.d.ts +6 -0
- package/dist/custom/number-input/typing/typing.plugin.d.ts +47 -0
- package/dist/custom/number-input/typing/typing.plugin.js +149 -0
- package/dist/custom/overlay/focus/focus.plugin.d.ts +150 -0
- package/dist/custom/overlay/focus/focus.plugin.js +242 -0
- package/dist/custom/overlay/focus/index.d.ts +1 -0
- package/dist/custom/overlay/hide-outside/hide-outside.plugin.d.ts +84 -0
- package/dist/custom/overlay/hide-outside/hide-outside.plugin.js +187 -0
- package/dist/custom/overlay/hide-outside/index.d.ts +2 -0
- package/dist/custom/overlay/hide-outside/marks.d.ts +19 -0
- package/dist/custom/overlay/hide-outside/marks.js +43 -0
- package/dist/custom/overlay/hide-outside/types.d.ts +17 -0
- package/dist/custom/overlay/index.d.ts +9 -0
- package/dist/custom/overlay/modal-focus/index.d.ts +1 -0
- package/dist/custom/overlay/modal-focus/modal-focus.plugin.d.ts +72 -0
- package/dist/custom/overlay/modal-focus/modal-focus.plugin.js +109 -0
- package/dist/custom/overlay/modal-ids/index.d.ts +1 -0
- package/dist/custom/overlay/modal-ids/modal-ids.plugin.d.ts +21 -0
- package/dist/custom/overlay/modal-ids/modal-ids.plugin.js +30 -0
- package/dist/custom/overlay/modal-layout/index.d.ts +2 -0
- package/dist/custom/overlay/modal-layout/modal-layout.plugin.d.ts +66 -0
- package/dist/custom/overlay/modal-layout/modal-layout.plugin.js +119 -0
- package/dist/custom/overlay/modal-layout/types.d.ts +13 -0
- package/dist/custom/overlay/modal-names/index.d.ts +1 -0
- package/dist/custom/overlay/modal-names/modal-names.plugin.d.ts +14 -0
- package/dist/custom/overlay/modal-names/modal-names.plugin.js +17 -0
- package/dist/custom/overlay/open-state.d.ts +12 -0
- package/dist/custom/overlay/open-state.js +42 -0
- package/dist/custom/overlay/scroll-lock/index.d.ts +2 -0
- package/dist/custom/overlay/scroll-lock/lock.d.ts +17 -0
- package/dist/custom/overlay/scroll-lock/lock.js +83 -0
- package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.d.ts +78 -0
- package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.js +134 -0
- package/dist/custom/overlay/scroll-lock/types.d.ts +17 -0
- package/dist/custom/overlay/swipe/index.d.ts +2 -0
- package/dist/custom/overlay/swipe/swipe.plugin.d.ts +150 -0
- package/dist/custom/overlay/swipe/swipe.plugin.js +432 -0
- package/dist/custom/overlay/swipe/types.d.ts +62 -0
- package/dist/custom/overlay/types.d.ts +40 -0
- package/dist/custom/pagination/current.d.ts +24 -0
- package/dist/custom/pagination/current.js +34 -0
- package/dist/custom/pagination/focus/focus.plugin.d.ts +57 -0
- package/dist/custom/pagination/focus/focus.plugin.js +106 -0
- package/dist/custom/pagination/focus/index.d.ts +2 -0
- package/dist/custom/pagination/focus/types.d.ts +8 -0
- package/dist/custom/pagination/index.d.ts +3 -0
- package/dist/custom/pagination/names/index.d.ts +1 -0
- package/dist/custom/pagination/names/names.plugin.d.ts +15 -0
- package/dist/custom/pagination/names/names.plugin.js +19 -0
- package/dist/custom/popover/focus/focus.plugin.d.ts +69 -0
- package/dist/custom/popover/focus/focus.plugin.js +107 -0
- package/dist/custom/popover/focus/index.d.ts +2 -0
- package/dist/custom/popover/focus/types.d.ts +2 -0
- package/dist/custom/popover/ids/ids.plugin.d.ts +18 -0
- package/dist/custom/popover/ids/ids.plugin.js +27 -0
- package/dist/custom/popover/ids/index.d.ts +1 -0
- package/dist/custom/popover/index.d.ts +4 -0
- package/dist/custom/popover/names/index.d.ts +1 -0
- package/dist/custom/popover/names/names.plugin.d.ts +7 -0
- package/dist/custom/popover/names/names.plugin.js +10 -0
- package/dist/custom/popover/pointer/index.d.ts +2 -0
- package/dist/custom/popover/pointer/pointer.plugin.d.ts +35 -0
- package/dist/custom/popover/pointer/pointer.plugin.js +65 -0
- package/dist/custom/popover/pointer/types.d.ts +2 -0
- package/dist/custom/radio-group/checked/checked.plugin.d.ts +45 -0
- package/dist/custom/radio-group/checked/checked.plugin.js +81 -0
- package/dist/custom/radio-group/checked/index.d.ts +1 -0
- package/dist/custom/radio-group/index.d.ts +3 -0
- package/dist/custom/radio-group/name/index.d.ts +1 -0
- package/dist/custom/radio-group/name/name.plugin.d.ts +21 -0
- package/dist/custom/radio-group/name/name.plugin.js +39 -0
- package/dist/custom/radio-group/stop.d.ts +17 -0
- package/dist/custom/radio-group/stop.js +30 -0
- package/dist/custom/rating/hover/hover.plugin.d.ts +36 -0
- package/dist/custom/rating/hover/hover.plugin.js +71 -0
- package/dist/custom/rating/hover/index.d.ts +2 -0
- package/dist/custom/rating/hover/types.d.ts +7 -0
- package/dist/custom/rating/index.d.ts +3 -0
- package/dist/custom/rating/names/index.d.ts +1 -0
- package/dist/custom/rating/names/names.plugin.d.ts +25 -0
- package/dist/custom/rating/names/names.plugin.js +45 -0
- package/dist/custom/rating/validity/index.d.ts +2 -0
- package/dist/custom/rating/validity/types.d.ts +7 -0
- package/dist/custom/rating/validity/validity.plugin.d.ts +48 -0
- package/dist/custom/rating/validity/validity.plugin.js +91 -0
- package/dist/custom/ready/index.d.ts +1 -0
- package/dist/custom/ready/ready.plugin.d.ts +14 -0
- package/dist/custom/ready/ready.plugin.js +28 -0
- package/dist/custom/scroller/index.d.ts +2 -0
- package/dist/custom/scroller/names/index.d.ts +1 -0
- package/dist/custom/scroller/names/names.plugin.d.ts +11 -0
- package/dist/custom/scroller/names/names.plugin.js +15 -0
- package/dist/custom/scroller/viewport/edges.d.ts +34 -0
- package/dist/custom/scroller/viewport/edges.js +29 -0
- package/dist/custom/scroller/viewport/focus.d.ts +39 -0
- package/dist/custom/scroller/viewport/focus.js +61 -0
- package/dist/custom/scroller/viewport/index.d.ts +6 -0
- package/dist/custom/scroller/viewport/stop.d.ts +24 -0
- package/dist/custom/scroller/viewport/stop.js +34 -0
- package/dist/custom/scroller/viewport/types.d.ts +31 -0
- package/dist/custom/scroller/viewport/viewport.plugin.d.ts +163 -0
- package/dist/custom/scroller/viewport/viewport.plugin.js +352 -0
- package/dist/custom/select/backspace/backspace.plugin.d.ts +50 -0
- package/dist/custom/select/backspace/backspace.plugin.js +125 -0
- package/dist/custom/select/backspace/index.d.ts +2 -0
- package/dist/custom/select/backspace/types.d.ts +2 -0
- package/dist/custom/select/editable/editable.plugin.d.ts +193 -0
- package/dist/custom/select/editable/editable.plugin.js +347 -0
- package/dist/custom/select/editable/index.d.ts +2 -0
- package/dist/custom/select/editable/types.d.ts +6 -0
- package/dist/custom/select/ids/ids.plugin.d.ts +22 -0
- package/dist/custom/select/ids/ids.plugin.js +31 -0
- package/dist/custom/select/ids/index.d.ts +1 -0
- package/dist/custom/select/index.d.ts +5 -0
- package/dist/custom/select/keyboard/index.d.ts +2 -0
- package/dist/custom/select/keyboard/keyboard.plugin.d.ts +125 -0
- package/dist/custom/select/keyboard/keyboard.plugin.js +205 -0
- package/dist/custom/select/keyboard/strategies/base.strategy.d.ts +37 -0
- package/dist/custom/select/keyboard/strategies/base.strategy.js +81 -0
- package/dist/custom/select/keyboard/strategies/editable.strategy.d.ts +16 -0
- package/dist/custom/select/keyboard/strategies/editable.strategy.js +20 -0
- package/dist/custom/select/keyboard/strategies/index.d.ts +4 -0
- package/dist/custom/select/keyboard/strategies/select-only.strategy.d.ts +13 -0
- package/dist/custom/select/keyboard/strategies/select-only.strategy.js +59 -0
- package/dist/custom/select/keyboard/strategies/types.d.ts +29 -0
- package/dist/custom/select/keyboard/types.d.ts +18 -0
- package/dist/custom/select/pointer/index.d.ts +2 -0
- package/dist/custom/select/pointer/pointer.plugin.d.ts +59 -0
- package/dist/custom/select/pointer/pointer.plugin.js +104 -0
- package/dist/custom/select/pointer/types.d.ts +2 -0
- package/dist/custom/skeleton/index.d.ts +2 -0
- package/dist/custom/skeleton/layout.plugin.d.ts +18 -0
- package/dist/custom/skeleton/layout.plugin.js +47 -0
- package/dist/custom/skeleton/types.d.ts +5 -0
- package/dist/custom/slide/direction.d.ts +30 -0
- package/dist/custom/slide/direction.js +75 -0
- package/dist/custom/slide/index.d.ts +4 -0
- package/dist/custom/slide/keyboard/index.d.ts +2 -0
- package/dist/custom/slide/keyboard/keyboard.plugin.d.ts +46 -0
- package/dist/custom/slide/keyboard/keyboard.plugin.js +106 -0
- package/dist/custom/slide/keyboard/types.d.ts +6 -0
- package/dist/custom/slide/parts.d.ts +7 -0
- package/dist/custom/slide/parts.js +26 -0
- package/dist/custom/slide/pointer/index.d.ts +2 -0
- package/dist/custom/slide/pointer/pointer.plugin.d.ts +100 -0
- package/dist/custom/slide/pointer/pointer.plugin.js +268 -0
- package/dist/custom/slide/pointer/strategies/base.strategy.d.ts +16 -0
- package/dist/custom/slide/pointer/strategies/base.strategy.js +23 -0
- package/dist/custom/slide/pointer/strategies/hold.strategy.d.ts +28 -0
- package/dist/custom/slide/pointer/strategies/hold.strategy.js +48 -0
- package/dist/custom/slide/pointer/strategies/index.d.ts +7 -0
- package/dist/custom/slide/pointer/strategies/magnet.strategy.d.ts +11 -0
- package/dist/custom/slide/pointer/strategies/magnet.strategy.js +17 -0
- package/dist/custom/slide/pointer/strategies/none.strategy.d.ts +7 -0
- package/dist/custom/slide/pointer/strategies/none.strategy.js +9 -0
- package/dist/custom/slide/pointer/strategies/plateau.strategy.d.ts +24 -0
- package/dist/custom/slide/pointer/strategies/plateau.strategy.js +81 -0
- package/dist/custom/slide/pointer/strategies/points.d.ts +16 -0
- package/dist/custom/slide/pointer/strategies/points.js +32 -0
- package/dist/custom/slide/pointer/strategies/settle.strategy.d.ts +11 -0
- package/dist/custom/slide/pointer/strategies/settle.strategy.js +17 -0
- package/dist/custom/slide/pointer/strategies/types.d.ts +57 -0
- package/dist/custom/slide/pointer/types.d.ts +46 -0
- package/dist/custom/slide/types.d.ts +14 -0
- package/dist/custom/table/column-ids/column-ids.plugin.d.ts +26 -0
- package/dist/custom/table/column-ids/column-ids.plugin.js +36 -0
- package/dist/custom/table/column-ids/index.d.ts +1 -0
- package/dist/custom/table/column-names/column-names.plugin.d.ts +18 -0
- package/dist/custom/table/column-names/column-names.plugin.js +24 -0
- package/dist/custom/table/column-names/index.d.ts +1 -0
- package/dist/custom/table/column-reorder/column-reorder.plugin.d.ts +169 -0
- package/dist/custom/table/column-reorder/column-reorder.plugin.js +465 -0
- package/dist/custom/table/column-reorder/index.d.ts +2 -0
- package/dist/custom/table/column-reorder/types.d.ts +81 -0
- package/dist/custom/table/column-resize/column-resize.plugin.d.ts +96 -0
- package/dist/custom/table/column-resize/column-resize.plugin.js +271 -0
- package/dist/custom/table/column-resize/index.d.ts +2 -0
- package/dist/custom/table/column-resize/types.d.ts +38 -0
- package/dist/custom/table/grid/grid.plugin.d.ts +119 -0
- package/dist/custom/table/grid/grid.plugin.js +356 -0
- package/dist/custom/table/grid/index.d.ts +2 -0
- package/dist/custom/table/grid/types.d.ts +22 -0
- package/dist/custom/table/index.d.ts +8 -0
- package/dist/custom/table/layout/index.d.ts +2 -0
- package/dist/custom/table/layout/layout.plugin.d.ts +52 -0
- package/dist/custom/table/layout/layout.plugin.js +122 -0
- package/dist/custom/table/layout/types.d.ts +7 -0
- package/dist/custom/table/names/index.d.ts +2 -0
- package/dist/custom/table/names/names.plugin.d.ts +18 -0
- package/dist/custom/table/names/names.plugin.js +31 -0
- package/dist/custom/table/names/types.d.ts +6 -0
- package/dist/custom/table/row-ids/index.d.ts +1 -0
- package/dist/custom/table/row-ids/row-ids.plugin.d.ts +21 -0
- package/dist/custom/table/row-ids/row-ids.plugin.js +28 -0
- package/dist/custom/tabs/active-tab/active-tab.plugin.d.ts +42 -0
- package/dist/custom/tabs/active-tab/active-tab.plugin.js +103 -0
- package/dist/custom/tabs/active-tab/index.d.ts +2 -0
- package/dist/custom/tabs/active-tab/types.d.ts +17 -0
- package/dist/custom/tabs/content-warn/content-warn.plugin.d.ts +21 -0
- package/dist/custom/tabs/content-warn/content-warn.plugin.js +41 -0
- package/dist/custom/tabs/content-warn/index.d.ts +1 -0
- package/dist/custom/tabs/index.d.ts +7 -0
- package/dist/custom/tabs/item-ids/index.d.ts +1 -0
- package/dist/custom/tabs/item-ids/item-ids.plugin.d.ts +60 -0
- package/dist/custom/tabs/item-ids/item-ids.plugin.js +94 -0
- package/dist/custom/tabs/item-names/index.d.ts +1 -0
- package/dist/custom/tabs/item-names/item-names.plugin.d.ts +17 -0
- package/dist/custom/tabs/item-names/item-names.plugin.js +23 -0
- package/dist/custom/tabs/keyboard/index.d.ts +2 -0
- package/dist/custom/tabs/keyboard/keyboard.plugin.d.ts +105 -0
- package/dist/custom/tabs/keyboard/keyboard.plugin.js +206 -0
- package/dist/custom/tabs/keyboard/types.d.ts +6 -0
- package/dist/custom/tabs/layout/index.d.ts +2 -0
- package/dist/custom/tabs/layout/layout.plugin.d.ts +37 -0
- package/dist/custom/tabs/layout/layout.plugin.js +81 -0
- package/dist/custom/tabs/layout/types.d.ts +4 -0
- package/dist/custom/tabs/parts.d.ts +15 -0
- package/dist/custom/tabs/parts.js +21 -0
- package/dist/custom/tabs/tab.d.ts +29 -0
- package/dist/custom/tabs/tab.js +44 -0
- package/dist/custom/tags/index.d.ts +4 -0
- package/dist/custom/tags/item-names/index.d.ts +1 -0
- package/dist/custom/tags/item-names/item-names.plugin.d.ts +12 -0
- package/dist/custom/tags/item-names/item-names.plugin.js +18 -0
- package/dist/custom/tags/keyboard/index.d.ts +2 -0
- package/dist/custom/tags/keyboard/keyboard.plugin.d.ts +133 -0
- package/dist/custom/tags/keyboard/keyboard.plugin.js +253 -0
- package/dist/custom/tags/keyboard/types.d.ts +6 -0
- package/dist/custom/tags/scroll/index.d.ts +2 -0
- package/dist/custom/tags/scroll/scroll.plugin.d.ts +68 -0
- package/dist/custom/tags/scroll/scroll.plugin.js +120 -0
- package/dist/custom/tags/scroll/types.d.ts +6 -0
- package/dist/custom/tags/tag.d.ts +41 -0
- package/dist/custom/tags/tag.js +66 -0
- package/dist/custom/textarea/autoresize/autoresize.plugin.d.ts +70 -0
- package/dist/custom/textarea/autoresize/autoresize.plugin.js +176 -0
- package/dist/custom/textarea/autoresize/index.d.ts +2 -0
- package/dist/custom/textarea/autoresize/types.d.ts +6 -0
- package/dist/custom/textarea/ids/ids.plugin.d.ts +26 -0
- package/dist/custom/textarea/ids/ids.plugin.js +44 -0
- package/dist/custom/textarea/ids/index.d.ts +1 -0
- package/dist/custom/textarea/index.d.ts +3 -0
- package/dist/custom/textarea/names/index.d.ts +2 -0
- package/dist/custom/textarea/names/names.plugin.d.ts +33 -0
- package/dist/custom/textarea/names/names.plugin.js +65 -0
- package/dist/custom/textarea/names/types.d.ts +8 -0
- package/dist/custom/toasts/cascade/cascade.plugin.d.ts +81 -0
- package/dist/custom/toasts/cascade/cascade.plugin.js +214 -0
- package/dist/custom/toasts/cascade/index.d.ts +2 -0
- package/dist/custom/toasts/cascade/types.d.ts +15 -0
- package/dist/custom/toasts/index.d.ts +7 -0
- package/dist/custom/toasts/item-names/index.d.ts +1 -0
- package/dist/custom/toasts/item-names/item-names.plugin.d.ts +12 -0
- package/dist/custom/toasts/item-names/item-names.plugin.js +18 -0
- package/dist/custom/toasts/keyboard/index.d.ts +2 -0
- package/dist/custom/toasts/keyboard/keyboard.plugin.d.ts +57 -0
- package/dist/custom/toasts/keyboard/keyboard.plugin.js +136 -0
- package/dist/custom/toasts/keyboard/types.d.ts +6 -0
- package/dist/custom/toasts/layout/index.d.ts +2 -0
- package/dist/custom/toasts/layout/layout.plugin.d.ts +23 -0
- package/dist/custom/toasts/layout/layout.plugin.js +39 -0
- package/dist/custom/toasts/layout/types.d.ts +5 -0
- package/dist/custom/toasts/names/index.d.ts +1 -0
- package/dist/custom/toasts/names/names.plugin.d.ts +10 -0
- package/dist/custom/toasts/names/names.plugin.js +13 -0
- package/dist/custom/toasts/removal/index.d.ts +2 -0
- package/dist/custom/toasts/removal/removal.plugin.d.ts +35 -0
- package/dist/custom/toasts/removal/removal.plugin.js +69 -0
- package/dist/custom/toasts/removal/types.d.ts +6 -0
- package/dist/custom/toasts/timer/index.d.ts +2 -0
- package/dist/custom/toasts/timer/timer.plugin.d.ts +71 -0
- package/dist/custom/toasts/timer/timer.plugin.js +213 -0
- package/dist/custom/toasts/timer/types.d.ts +15 -0
- package/dist/custom/tooltip/ids/ids.plugin.d.ts +22 -0
- package/dist/custom/tooltip/ids/ids.plugin.js +42 -0
- package/dist/custom/tooltip/ids/index.d.ts +1 -0
- package/dist/custom/tooltip/index.d.ts +2 -0
- package/dist/custom/tooltip/trigger/document-state.d.ts +42 -0
- package/dist/custom/tooltip/trigger/document-state.js +50 -0
- package/dist/custom/tooltip/trigger/index.d.ts +2 -0
- package/dist/custom/tooltip/trigger/trigger.plugin.d.ts +133 -0
- package/dist/custom/tooltip/trigger/trigger.plugin.js +271 -0
- package/dist/custom/tooltip/trigger/types.d.ts +20 -0
- package/dist/custom/virtual/index.d.ts +2 -0
- package/dist/custom/virtual/types.d.ts +6 -0
- package/dist/custom/virtual/virtual.plugin.d.ts +126 -0
- package/dist/custom/virtual/virtual.plugin.js +311 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +149 -0
- package/dist/locale/index.d.ts +6 -0
- package/dist/locale/locale.d.ts +38 -0
- package/dist/locale/locale.js +93 -0
- package/dist/locale/locale.plugin.d.ts +26 -0
- package/dist/locale/locale.plugin.js +35 -0
- package/dist/locale/locales/ar.d.ts +5 -0
- package/dist/locale/locales/ar.js +59 -0
- package/dist/locale/locales/en.d.ts +7 -0
- package/dist/locale/locales/en.js +61 -0
- package/dist/locale/locales/es.d.ts +2 -0
- package/dist/locale/locales/es.js +56 -0
- package/dist/locale/locales/fr.d.ts +2 -0
- package/dist/locale/locales/fr.js +56 -0
- package/dist/locale/locales/index.d.ts +6 -0
- package/dist/locale/locales/ru.d.ts +2 -0
- package/dist/locale/locales/ru.js +56 -0
- package/dist/locale/locales/zh.d.ts +2 -0
- package/dist/locale/locales/zh.js +56 -0
- package/dist/locale/names.plugin.d.ts +32 -0
- package/dist/locale/names.plugin.js +39 -0
- package/dist/locale/source.class.d.ts +22 -0
- package/dist/locale/source.class.js +32 -0
- package/dist/locale/types.d.ts +197 -0
- package/dist/motion/index.d.ts +2 -0
- package/dist/motion/motion.d.ts +28 -0
- package/dist/motion/motion.js +67 -0
- package/dist/motion/types.d.ts +14 -0
- package/dist/utils/afterTransitions.d.ts +49 -0
- package/dist/utils/afterTransitions.js +79 -0
- package/dist/utils/focusFirst.d.ts +13 -0
- package/dist/utils/focusFirst.js +24 -0
- package/dist/utils/graceArea.d.ts +21 -0
- package/dist/utils/graceArea.js +66 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/isAboveLayer.d.ts +14 -0
- package/dist/utils/isAboveLayer.js +24 -0
- package/dist/utils/isAppleTouch.d.ts +10 -0
- package/dist/utils/isAppleTouch.js +17 -0
- package/dist/utils/isFocusableElement.d.ts +8 -0
- package/dist/utils/isFocusableElement.js +13 -0
- package/dist/utils/isMeasurableElement.d.ts +11 -0
- package/dist/utils/isMeasurableElement.js +16 -0
- package/dist/utils/isPrintableKey.d.ts +7 -0
- package/dist/utils/isPrintableKey.js +12 -0
- package/dist/utils/layerOf.d.ts +12 -0
- package/dist/utils/layerOf.js +21 -0
- package/dist/utils/nearestShift.d.ts +19 -0
- package/dist/utils/nearestShift.js +58 -0
- package/dist/utils/positionOrigin.d.ts +34 -0
- package/dist/utils/positionOrigin.js +71 -0
- package/dist/utils/scrollParent.d.ts +12 -0
- package/dist/utils/scrollParent.js +23 -0
- package/dist/utils/scrollWindow.d.ts +27 -0
- package/dist/utils/scrollWindow.js +50 -0
- package/dist/utils/tabStops.d.ts +44 -0
- package/dist/utils/tabStops.js +102 -0
- package/dist/utils/tabStopsAfter.d.ts +10 -0
- package/dist/utils/tabStopsAfter.js +16 -0
- package/dist/utils/tabStopsBefore.d.ts +11 -0
- package/dist/utils/tabStopsBefore.js +17 -0
- package/dist/utils/toCssValue.d.ts +8 -0
- package/dist/utils/toCssValue.js +17 -0
- package/dist/utils/trapTab.d.ts +16 -0
- package/dist/utils/trapTab.js +36 -0
- package/dist/utils/types.d.ts +64 -0
- package/package.json +43 -4
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { isFocusableElement } from "../../../utils/isFocusableElement.js";
|
|
4
|
+
import { collapseRowSelection, rowOf, rowSelection, segmentElementOf, segmentOf, segmentsOf, selectRow, touchedSegments } from "../parts.js";
|
|
5
|
+
//#region src/custom/date-input/keyboard/keyboard.plugin.ts
|
|
6
|
+
/**
|
|
7
|
+
* Клавиши части под фокусом — команды ядра. ←/→ идут к соседней части по
|
|
8
|
+
* направлению ряда, а не страницы: у `ar-EG` дата пишется справа налево, и →
|
|
9
|
+
* ведёт к части, что стоит правее, — к предыдущей по формату.
|
|
10
|
+
*/
|
|
11
|
+
var COMMANDS = {
|
|
12
|
+
ArrowUp: (owner) => owner.shiftSegment(1),
|
|
13
|
+
ArrowDown: (owner) => owner.shiftSegment(-1),
|
|
14
|
+
Home: (owner) => owner.moveSegmentToEdge("start"),
|
|
15
|
+
End: (owner) => owner.moveSegmentToEdge("end"),
|
|
16
|
+
ArrowLeft: (owner) => owner.shiftFocus(owner.segmentsDirection === "rtl" ? 1 : -1),
|
|
17
|
+
ArrowRight: (owner) => owner.shiftFocus(owner.segmentsDirection === "rtl" ? -1 : 1),
|
|
18
|
+
Backspace: (owner) => owner.eraseDigit(),
|
|
19
|
+
Delete: (owner) => owner.clearSegment(),
|
|
20
|
+
" ": () => {}
|
|
21
|
+
};
|
|
22
|
+
/** Клавиши, которые стирают выделенные части целиком. */
|
|
23
|
+
var ERASE_KEYS = /* @__PURE__ */ new Set(["Backspace", "Delete"]);
|
|
24
|
+
/**
|
|
25
|
+
* TDateInputKeyboardPlugin — клавиатура поля даты и DOM-фокус, который идёт
|
|
26
|
+
* за частью под фокусом ядра.
|
|
27
|
+
*
|
|
28
|
+
* Части нередактируемые: браузер текст сам не правит и `beforeinput` не шлёт,
|
|
29
|
+
* а всё, что делает клавиша, — команда ядра. Клавиши берутся только с самой
|
|
30
|
+
* части: у содержимого слотов (кнопки календаря) свои клавиши. Обработанная
|
|
31
|
+
* клавиша гасится `preventDefault`.
|
|
32
|
+
*
|
|
33
|
+
* - **Цифра** — набор в часть (`typeKey`); цифры ASCII, локали и
|
|
34
|
+
* полноширинные различает ядро. Во время композиции IME клавиша не наша.
|
|
35
|
+
* - **Буква** у периода суток — тот же `typeKey`: какой период она выбирает,
|
|
36
|
+
* решает ядро по именам периодов локали.
|
|
37
|
+
* - **↑/↓, Home/End** — число части (у периода суток — другой период),
|
|
38
|
+
* **Backspace** — стереть цифру (с пустой части — фокус на предыдущую),
|
|
39
|
+
* **Delete** — очистить часть, **←/→** — соседняя часть по направлению ряда.
|
|
40
|
+
* - **Ctrl/Cmd+A** — выделение браузера на весь ряд, по `code`, а не `key`:
|
|
41
|
+
* на русской раскладке `key` — «ф». Фокус остаётся на части, копирует и
|
|
42
|
+
* вырезает выделенное плагин буфера обмена.
|
|
43
|
+
* - **Выделение задело части** — Delete и Backspace их очищают, цифра
|
|
44
|
+
* очищает и набирается в первую (`replaceSegments`). Выделение браузер у
|
|
45
|
+
* нередактируемого текста сам не снимает, поэтому клавишу, которую поле
|
|
46
|
+
* обработало, плагин снимает с ним вместе.
|
|
47
|
+
*
|
|
48
|
+
* **Фокус.** `focusin` на части сообщает ядру часть, `focusout` из ряда —
|
|
49
|
+
* что фокуса в поле нет. Обратно — `change:focusedSegment`: ядро перевело
|
|
50
|
+
* фокус (набрали число до конца, Backspace на пустой части), и DOM-фокус идёт
|
|
51
|
+
* за ним, если стоит в ряду. Своих `tabindex` у плагина нет: остановка Tab у
|
|
52
|
+
* каждой части — набор, который отдаёт ядро.
|
|
53
|
+
*/
|
|
54
|
+
var TDateInputKeyboardPlugin = class extends TBasePlugin {
|
|
55
|
+
_owner = null;
|
|
56
|
+
_root = null;
|
|
57
|
+
install(ctx) {
|
|
58
|
+
super.install(ctx);
|
|
59
|
+
this._owner = ctx.getInstance() ?? null;
|
|
60
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
61
|
+
elementPlugin?.events.on("ready", (element) => this._bind(element));
|
|
62
|
+
elementPlugin?.events.on("removed", () => this._bind(null));
|
|
63
|
+
this._listenTo(this._owner?.events, "change:focusedSegment", ({ newValue }) => this._onFocusedSegment(newValue));
|
|
64
|
+
}
|
|
65
|
+
destroy() {
|
|
66
|
+
this._bind(null);
|
|
67
|
+
this._owner = null;
|
|
68
|
+
super.destroy();
|
|
69
|
+
}
|
|
70
|
+
/** Корень сменился — слушатели переезжают. */
|
|
71
|
+
_bind(root) {
|
|
72
|
+
const previous = this._root;
|
|
73
|
+
previous?.removeEventListener("keydown", this._onKeyDown);
|
|
74
|
+
previous?.removeEventListener("focusin", this._onFocusIn);
|
|
75
|
+
previous?.removeEventListener("focusout", this._onFocusOut);
|
|
76
|
+
this._root = root;
|
|
77
|
+
const target = root;
|
|
78
|
+
target?.addEventListener("keydown", this._onKeyDown);
|
|
79
|
+
target?.addEventListener("focusin", this._onFocusIn);
|
|
80
|
+
target?.addEventListener("focusout", this._onFocusOut);
|
|
81
|
+
}
|
|
82
|
+
_onKeyDown = (event) => {
|
|
83
|
+
const owner = this._owner;
|
|
84
|
+
const root = this._root;
|
|
85
|
+
if (!owner || !root || event.defaultPrevented || event.isComposing) return;
|
|
86
|
+
const row = rowOf(owner, root);
|
|
87
|
+
if (!row || !segmentOf(owner, root, event.target)) return;
|
|
88
|
+
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.code === "KeyA") {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
selectRow(row);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
94
|
+
if (this._handle(owner, root, row, event.key)) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
collapseRowSelection(row);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
/** Исполнить клавишу; клавиша не поля — `false`. */
|
|
100
|
+
_handle(owner, root, row, key) {
|
|
101
|
+
const range = rowSelection(row);
|
|
102
|
+
const touched = range ? touchedSegments(segmentsOf(owner, root), range) : [];
|
|
103
|
+
if (touched.length > 0) {
|
|
104
|
+
if (ERASE_KEYS.has(key)) {
|
|
105
|
+
owner.clearSegments(touched);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (isCharacter(key)) return owner.replaceSegments(touched, key);
|
|
109
|
+
}
|
|
110
|
+
const command = COMMANDS[key];
|
|
111
|
+
if (command) {
|
|
112
|
+
command(owner);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return isCharacter(key) && owner.typeKey(key);
|
|
116
|
+
}
|
|
117
|
+
/** Фокус пришёл на часть — ядро ведёт набор в неё; не на часть — фокуса в поле нет. */
|
|
118
|
+
_onFocusIn = (event) => {
|
|
119
|
+
const owner = this._owner;
|
|
120
|
+
const root = this._root;
|
|
121
|
+
if (!owner || !root) return;
|
|
122
|
+
owner.focusSegment(segmentOf(owner, root, event.target)?.part);
|
|
123
|
+
};
|
|
124
|
+
/** Фокус ушёл не на часть — из поля. На соседнюю часть его приведёт `focusin`. */
|
|
125
|
+
_onFocusOut = (event) => {
|
|
126
|
+
const owner = this._owner;
|
|
127
|
+
const root = this._root;
|
|
128
|
+
if (!owner || !root || segmentOf(owner, root, event.relatedTarget)) return;
|
|
129
|
+
owner.focusSegment(void 0);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Ядро перевело фокус на другую часть — DOM-фокус за ним, если он в ряду:
|
|
133
|
+
* фокус, который пользователь увёл со страницы, поле не забирает.
|
|
134
|
+
*/
|
|
135
|
+
_onFocusedSegment = (part) => {
|
|
136
|
+
const owner = this._owner;
|
|
137
|
+
const root = this._root;
|
|
138
|
+
if (!owner || !root || part === void 0) return;
|
|
139
|
+
const current = segmentOf(owner, root, root.ownerDocument.activeElement);
|
|
140
|
+
if (!current || current.part === part) return;
|
|
141
|
+
const element = segmentElementOf(owner, root, part);
|
|
142
|
+
if (isFocusableElement(element)) element.focus();
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Знак, а не имя клавиши (`Enter`, `Tab`): набор берёт один знак. Цифры
|
|
147
|
+
* некоторых систем счисления — за пределами BMP, и знак у них из двух единиц
|
|
148
|
+
* UTF-16.
|
|
149
|
+
*/
|
|
150
|
+
function isCharacter(key) {
|
|
151
|
+
return [...key].length === 1;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { TDateInputKeyboardPlugin };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDateInput } from '@soxa-ui/core';
|
|
2
|
+
import type { TPluginEvents } from '../../../base';
|
|
3
|
+
/**
|
|
4
|
+
* Своих событий у плагина нет: результат клавиши виден в ядре — в частях,
|
|
5
|
+
* значении и части под фокусом.
|
|
6
|
+
*/
|
|
7
|
+
export type TDateInputKeyboardPluginEvents = TPluginEvents;
|
|
8
|
+
/** Клавиша части — команда ядра для части под фокусом. */
|
|
9
|
+
export type TDateInputKeyCommand = (owner: IDateInput) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IDateInput, TDateFieldPart, TDateInputPart } from '@soxa-ui/core';
|
|
2
|
+
import type { IPluginContext } from '../../base';
|
|
3
|
+
import type { TDateInputSegmentNode } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Все типы частей поля — в формате и нет: смена вида, точности времени и
|
|
6
|
+
* локали меняет их состав.
|
|
7
|
+
*/
|
|
8
|
+
export declare function allPartTypes(): TDateFieldPart[];
|
|
9
|
+
/**
|
|
10
|
+
* Части формата поля по порядку — выход ядра без разделителей. Не узлы, а
|
|
11
|
+
* значения: по ним плагин пишет в наборы частей и тогда, когда разметки ещё
|
|
12
|
+
* нет.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatPartsOf(owner: IDateInput): TDateInputPart[];
|
|
15
|
+
/** Ряд частей поля — `__segments` в корне. */
|
|
16
|
+
export declare function rowOf(owner: IDateInput, root: Element): Element | null;
|
|
17
|
+
/** Часть поля, в узле которой лежит `target`; не часть этого поля — `undefined`. */
|
|
18
|
+
export declare function segmentOf(owner: IDateInput, root: Element, target: EventTarget | null): TDateInputSegmentNode | undefined;
|
|
19
|
+
/** Части ряда по порядку документа. */
|
|
20
|
+
export declare function segmentsOf(owner: IDateInput, root: Element): TDateInputSegmentNode[];
|
|
21
|
+
/**
|
|
22
|
+
* Первая часть поля — узел фокуса DateInput (`focusTarget` плагина действия):
|
|
23
|
+
* запись `focused = true` ставит фокус на неё, а не на коробку корня и не на
|
|
24
|
+
* кнопку в слоте `leading`. Первая — по порядку документа: туда же ведёт Tab.
|
|
25
|
+
* `null` — инстанса или частей в корне нет.
|
|
26
|
+
*/
|
|
27
|
+
export declare function firstSegmentOf(root: Element, ctx: IPluginContext): Element | null;
|
|
28
|
+
/** Узел части по её типу. */
|
|
29
|
+
export declare function segmentElementOf(owner: IDateInput, root: Element, part: TDateFieldPart): Element | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Выделение документа в ряду: непустой диапазон, оба конца которого в ряду.
|
|
32
|
+
* Выделение шире ряда или вне его — не поля: `null`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function rowSelection(row: Element): Range | null;
|
|
35
|
+
/**
|
|
36
|
+
* Части, у которых выделение задело хотя бы один знак. Край выделения ровно на
|
|
37
|
+
* границе части её не задевает: протяжка до начала года год не выделила.
|
|
38
|
+
*/
|
|
39
|
+
export declare function touchedSegments(nodes: readonly TDateInputSegmentNode[], range: Range): TDateFieldPart[];
|
|
40
|
+
/**
|
|
41
|
+
* Текст диапазона — текст его узлов подряд. Не `Selection#toString()`: тот
|
|
42
|
+
* собирает текст по раскладке, и Chrome ставит перевод строки между
|
|
43
|
+
* флекс-коробками частей (`12\n.\n05`), а Firefox — нет.
|
|
44
|
+
*/
|
|
45
|
+
export declare function rangeText(range: Range): string;
|
|
46
|
+
/** Выделить весь ряд: диапазон по его содержимому. */
|
|
47
|
+
export declare function selectRow(row: Element): void;
|
|
48
|
+
/** Снять выделение документа, если оно в ряду: правка его уже исполнила. */
|
|
49
|
+
export declare function collapseRowSelection(row: Element): void;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//#region src/custom/date-input/parts.ts
|
|
2
|
+
/**
|
|
3
|
+
* Узлы поля даты — один поиск на все плагины поля: клавиши, указатель, буфер
|
|
4
|
+
* обмена и сенсорный ввод находят части, ряд и выделение одинаково.
|
|
5
|
+
*
|
|
6
|
+
* Части находят по классам владельца (`classes.resolve`), а не строкой в
|
|
7
|
+
* плагине, и только внутри его корня; тип части — из её `data-type`, который
|
|
8
|
+
* разметке отдало ядро.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Типы частей — словарём по типу, а не списком: появится у ядра новая часть,
|
|
12
|
+
* и словарь без неё не скомпилируется.
|
|
13
|
+
*/
|
|
14
|
+
var PARTS = {
|
|
15
|
+
day: true,
|
|
16
|
+
month: true,
|
|
17
|
+
year: true,
|
|
18
|
+
hour: true,
|
|
19
|
+
minute: true,
|
|
20
|
+
second: true,
|
|
21
|
+
dayPeriod: true
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Все типы частей поля — в формате и нет: смена вида, точности времени и
|
|
25
|
+
* локали меняет их состав.
|
|
26
|
+
*/
|
|
27
|
+
function allPartTypes() {
|
|
28
|
+
return Object.keys(PARTS).filter(isFieldPart);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Части формата поля по порядку — выход ядра без разделителей. Не узлы, а
|
|
32
|
+
* значения: по ним плагин пишет в наборы частей и тогда, когда разметки ещё
|
|
33
|
+
* нет.
|
|
34
|
+
*/
|
|
35
|
+
function formatPartsOf(owner) {
|
|
36
|
+
return owner.segments.filter((segment) => segment.type !== "literal");
|
|
37
|
+
}
|
|
38
|
+
/** Ряд частей поля — `__segments` в корне. */
|
|
39
|
+
function rowOf(owner, root) {
|
|
40
|
+
return root.querySelector(owner.classes.resolve("__segments", { point: true }));
|
|
41
|
+
}
|
|
42
|
+
/** Часть поля, в узле которой лежит `target`; не часть этого поля — `undefined`. */
|
|
43
|
+
function segmentOf(owner, root, target) {
|
|
44
|
+
if (!(target instanceof Element)) return void 0;
|
|
45
|
+
const element = target.closest(owner.classes.resolve("__segment", { point: true }));
|
|
46
|
+
const part = element?.getAttribute("data-type");
|
|
47
|
+
if (!element || !root.contains(element) || !isFieldPart(part)) return void 0;
|
|
48
|
+
return {
|
|
49
|
+
part,
|
|
50
|
+
element
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Части ряда по порядку документа. */
|
|
54
|
+
function segmentsOf(owner, root) {
|
|
55
|
+
return [...root.querySelectorAll(owner.classes.resolve("__segment", { point: true }))].flatMap((element) => {
|
|
56
|
+
const part = element.getAttribute("data-type");
|
|
57
|
+
return isFieldPart(part) ? [{
|
|
58
|
+
part,
|
|
59
|
+
element
|
|
60
|
+
}] : [];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Первая часть поля — узел фокуса DateInput (`focusTarget` плагина действия):
|
|
65
|
+
* запись `focused = true` ставит фокус на неё, а не на коробку корня и не на
|
|
66
|
+
* кнопку в слоте `leading`. Первая — по порядку документа: туда же ведёт Tab.
|
|
67
|
+
* `null` — инстанса или частей в корне нет.
|
|
68
|
+
*/
|
|
69
|
+
function firstSegmentOf(root, ctx) {
|
|
70
|
+
const owner = ctx.getInstance();
|
|
71
|
+
return owner ? segmentsOf(owner, root)[0]?.element ?? null : null;
|
|
72
|
+
}
|
|
73
|
+
/** Узел части по её типу. */
|
|
74
|
+
function segmentElementOf(owner, root, part) {
|
|
75
|
+
return segmentsOf(owner, root).find((node) => node.part === part)?.element;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Выделение документа в ряду: непустой диапазон, оба конца которого в ряду.
|
|
79
|
+
* Выделение шире ряда или вне его — не поля: `null`.
|
|
80
|
+
*/
|
|
81
|
+
function rowSelection(row) {
|
|
82
|
+
const selection = row.ownerDocument.getSelection();
|
|
83
|
+
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) return null;
|
|
84
|
+
const range = selection.getRangeAt(0);
|
|
85
|
+
return row.contains(range.startContainer) && row.contains(range.endContainer) ? range : null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Части, у которых выделение задело хотя бы один знак. Край выделения ровно на
|
|
89
|
+
* границе части её не задевает: протяжка до начала года год не выделила.
|
|
90
|
+
*/
|
|
91
|
+
function touchedSegments(nodes, range) {
|
|
92
|
+
return nodes.filter(({ element }) => touches(range, element)).map(({ part }) => part);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Текст диапазона — текст его узлов подряд. Не `Selection#toString()`: тот
|
|
96
|
+
* собирает текст по раскладке, и Chrome ставит перевод строки между
|
|
97
|
+
* флекс-коробками частей (`12\n.\n05`), а Firefox — нет.
|
|
98
|
+
*/
|
|
99
|
+
function rangeText(range) {
|
|
100
|
+
return range.cloneContents().textContent ?? "";
|
|
101
|
+
}
|
|
102
|
+
/** Выделить весь ряд: диапазон по его содержимому. */
|
|
103
|
+
function selectRow(row) {
|
|
104
|
+
const selection = row.ownerDocument.getSelection();
|
|
105
|
+
const range = row.ownerDocument.createRange();
|
|
106
|
+
range.selectNodeContents(row);
|
|
107
|
+
selection?.removeAllRanges();
|
|
108
|
+
selection?.addRange(range);
|
|
109
|
+
}
|
|
110
|
+
/** Снять выделение документа, если оно в ряду: правка его уже исполнила. */
|
|
111
|
+
function collapseRowSelection(row) {
|
|
112
|
+
if (rowSelection(row)) row.ownerDocument.getSelection()?.removeAllRanges();
|
|
113
|
+
}
|
|
114
|
+
/** Тип части из `data-type` узла. */
|
|
115
|
+
function isFieldPart(value) {
|
|
116
|
+
return typeof value === "string" && Object.hasOwn(PARTS, value);
|
|
117
|
+
}
|
|
118
|
+
/** Задело ли выделение знаки узла: пересечение диапазонов не пусто. */
|
|
119
|
+
function touches(range, element) {
|
|
120
|
+
const overlap = element.ownerDocument.createRange();
|
|
121
|
+
overlap.selectNodeContents(element);
|
|
122
|
+
if (range.compareBoundaryPoints(Range.START_TO_START, overlap) > 0) overlap.setStart(range.startContainer, range.startOffset);
|
|
123
|
+
if (range.compareBoundaryPoints(Range.END_TO_END, overlap) < 0) overlap.setEnd(range.endContainer, range.endOffset);
|
|
124
|
+
return overlap.toString() !== "";
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { allPartTypes, collapseRowSelection, firstSegmentOf, formatPartsOf, rangeText, rowOf, rowSelection, segmentElementOf, segmentOf, segmentsOf, selectRow, touchedSegments };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IDateInput } from '@soxa-ui/core';
|
|
2
|
+
import { TBasePlugin } from '../../../base';
|
|
3
|
+
import type { IPluginContext } from '../../../base';
|
|
4
|
+
import type { TDateInputPointerPluginEvents } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* TDateInputPointerPlugin — указатель поля даты: нажатие мимо частей и
|
|
7
|
+
* контекстное меню.
|
|
8
|
+
*
|
|
9
|
+
* **Нажатие мимо частей** — по разделителю или пустому месту поля — отдаёт
|
|
10
|
+
* фокус ближайшей по горизонтали части: курсор текста обещает это по всему
|
|
11
|
+
* полю. Только при свёрнутом выделении: протяжку мышью, которая закончилась
|
|
12
|
+
* мимо частей, нажатие не снимает. `mousedown` плагин не гасит: протяжка
|
|
13
|
+
* начинается и с пустого места поля.
|
|
14
|
+
*
|
|
15
|
+
* **Контекстное меню.** «Вставить» и «Вырезать» браузер показывает только над
|
|
16
|
+
* редактируемым узлом, а части нередактируемые — так дату выделяет протяжка.
|
|
17
|
+
* Поэтому на `contextmenu` в ряду ряд на время становится `contenteditable`;
|
|
18
|
+
* всё, что браузер в нём правил бы сам (`beforeinput`), гасится, а удаление
|
|
19
|
+
* из меню очищает части, которые задело выделение. Обратно ряд возвращается
|
|
20
|
+
* после `paste` и `cut` — их исполняет плагин буфера обмена, — на нажатие,
|
|
21
|
+
* клавишу и уход фокуса. Выделение при переключении остаётся на месте. У поля
|
|
22
|
+
* только для чтения и выключенного править нечего, и меню остаётся меню
|
|
23
|
+
* выделения: «Копировать».
|
|
24
|
+
*/
|
|
25
|
+
export declare class TDateInputPointerPlugin extends TBasePlugin<IDateInput, TDateInputPointerPluginEvents> {
|
|
26
|
+
private _owner;
|
|
27
|
+
private _root;
|
|
28
|
+
/** Ряд, который стал редактируемым ради контекстного меню. */
|
|
29
|
+
private _editableRow;
|
|
30
|
+
install(ctx: IPluginContext): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
/** Корень сменился — слушатели переезжают, ряд перестаёт быть редактируемым. */
|
|
33
|
+
private _bind;
|
|
34
|
+
/** Нажатие мимо частей и слотов — фокус ближайшей части. */
|
|
35
|
+
private readonly _onClick;
|
|
36
|
+
/**
|
|
37
|
+
* Меню над рядом — ряд на время редактируемый: в меню появятся «Вставить» и
|
|
38
|
+
* «Вырезать». Над частью, которую касание уже сделало редактируемой, меню и
|
|
39
|
+
* так меню правки — ряд не трогается: иначе его правку гасил бы этот плагин,
|
|
40
|
+
* и ввод экранной клавиатуры после двойного касания или долгого нажатия
|
|
41
|
+
* пропадал бы до следующего нажатия.
|
|
42
|
+
*/
|
|
43
|
+
private readonly _onContextMenu;
|
|
44
|
+
/**
|
|
45
|
+
* Правка браузера в редактируемом ряду гасится: текст частей пишет ядро.
|
|
46
|
+
* Удаление из меню очищает задетые части.
|
|
47
|
+
*/
|
|
48
|
+
private readonly _onBeforeInput;
|
|
49
|
+
/** Ряд снова нередактируемый: протяжка выделяет дату целиком. */
|
|
50
|
+
private readonly _restore;
|
|
51
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { isFocusableElement } from "../../../utils/isFocusableElement.js";
|
|
4
|
+
import { collapseRowSelection, rowOf, rowSelection, segmentOf, segmentsOf, touchedSegments } from "../parts.js";
|
|
5
|
+
//#region src/custom/date-input/pointer/pointer.plugin.ts
|
|
6
|
+
/** Обёртки слотов — содержимое потребителя: его нажатия поле не трогает. */
|
|
7
|
+
var SLOTS = ["__leading", "__trailing"];
|
|
8
|
+
/**
|
|
9
|
+
* TDateInputPointerPlugin — указатель поля даты: нажатие мимо частей и
|
|
10
|
+
* контекстное меню.
|
|
11
|
+
*
|
|
12
|
+
* **Нажатие мимо частей** — по разделителю или пустому месту поля — отдаёт
|
|
13
|
+
* фокус ближайшей по горизонтали части: курсор текста обещает это по всему
|
|
14
|
+
* полю. Только при свёрнутом выделении: протяжку мышью, которая закончилась
|
|
15
|
+
* мимо частей, нажатие не снимает. `mousedown` плагин не гасит: протяжка
|
|
16
|
+
* начинается и с пустого места поля.
|
|
17
|
+
*
|
|
18
|
+
* **Контекстное меню.** «Вставить» и «Вырезать» браузер показывает только над
|
|
19
|
+
* редактируемым узлом, а части нередактируемые — так дату выделяет протяжка.
|
|
20
|
+
* Поэтому на `contextmenu` в ряду ряд на время становится `contenteditable`;
|
|
21
|
+
* всё, что браузер в нём правил бы сам (`beforeinput`), гасится, а удаление
|
|
22
|
+
* из меню очищает части, которые задело выделение. Обратно ряд возвращается
|
|
23
|
+
* после `paste` и `cut` — их исполняет плагин буфера обмена, — на нажатие,
|
|
24
|
+
* клавишу и уход фокуса. Выделение при переключении остаётся на месте. У поля
|
|
25
|
+
* только для чтения и выключенного править нечего, и меню остаётся меню
|
|
26
|
+
* выделения: «Копировать».
|
|
27
|
+
*/
|
|
28
|
+
var TDateInputPointerPlugin = class extends TBasePlugin {
|
|
29
|
+
_owner = null;
|
|
30
|
+
_root = null;
|
|
31
|
+
/** Ряд, который стал редактируемым ради контекстного меню. */
|
|
32
|
+
_editableRow = null;
|
|
33
|
+
install(ctx) {
|
|
34
|
+
super.install(ctx);
|
|
35
|
+
this._owner = ctx.getInstance() ?? null;
|
|
36
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
37
|
+
elementPlugin?.events.on("ready", (element) => this._bind(element));
|
|
38
|
+
elementPlugin?.events.on("removed", () => this._bind(null));
|
|
39
|
+
}
|
|
40
|
+
destroy() {
|
|
41
|
+
this._bind(null);
|
|
42
|
+
this._owner = null;
|
|
43
|
+
super.destroy();
|
|
44
|
+
}
|
|
45
|
+
/** Корень сменился — слушатели переезжают, ряд перестаёт быть редактируемым. */
|
|
46
|
+
_bind(root) {
|
|
47
|
+
const previous = this._root;
|
|
48
|
+
previous?.removeEventListener("click", this._onClick);
|
|
49
|
+
previous?.removeEventListener("contextmenu", this._onContextMenu);
|
|
50
|
+
previous?.removeEventListener("beforeinput", this._onBeforeInput);
|
|
51
|
+
previous?.removeEventListener("pointerdown", this._restore);
|
|
52
|
+
previous?.removeEventListener("keydown", this._restore);
|
|
53
|
+
previous?.removeEventListener("focusout", this._restore);
|
|
54
|
+
previous?.removeEventListener("paste", this._restore);
|
|
55
|
+
previous?.removeEventListener("cut", this._restore);
|
|
56
|
+
this._restore();
|
|
57
|
+
this._root = root;
|
|
58
|
+
const target = root;
|
|
59
|
+
target?.addEventListener("click", this._onClick);
|
|
60
|
+
target?.addEventListener("contextmenu", this._onContextMenu);
|
|
61
|
+
target?.addEventListener("beforeinput", this._onBeforeInput);
|
|
62
|
+
target?.addEventListener("pointerdown", this._restore);
|
|
63
|
+
target?.addEventListener("keydown", this._restore);
|
|
64
|
+
target?.addEventListener("focusout", this._restore);
|
|
65
|
+
target?.addEventListener("paste", this._restore);
|
|
66
|
+
target?.addEventListener("cut", this._restore);
|
|
67
|
+
}
|
|
68
|
+
/** Нажатие мимо частей и слотов — фокус ближайшей части. */
|
|
69
|
+
_onClick = (event) => {
|
|
70
|
+
const owner = this._owner;
|
|
71
|
+
const root = this._root;
|
|
72
|
+
if (!owner || !root || owner.disabled || event.defaultPrevented) return;
|
|
73
|
+
if (segmentOf(owner, root, event.target) || inSlot(owner, root, event.target)) return;
|
|
74
|
+
const selection = root.ownerDocument.getSelection();
|
|
75
|
+
if (selection && !selection.isCollapsed) return;
|
|
76
|
+
const nearest = nearestSegment(segmentsOf(owner, root), event.clientX);
|
|
77
|
+
if (isFocusableElement(nearest)) nearest.focus();
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Меню над рядом — ряд на время редактируемый: в меню появятся «Вставить» и
|
|
81
|
+
* «Вырезать». Над частью, которую касание уже сделало редактируемой, меню и
|
|
82
|
+
* так меню правки — ряд не трогается: иначе его правку гасил бы этот плагин,
|
|
83
|
+
* и ввод экранной клавиатуры после двойного касания или долгого нажатия
|
|
84
|
+
* пропадал бы до следующего нажатия.
|
|
85
|
+
*/
|
|
86
|
+
_onContextMenu = (event) => {
|
|
87
|
+
const owner = this._owner;
|
|
88
|
+
const root = this._root;
|
|
89
|
+
const row = owner && root ? rowOf(owner, root) : null;
|
|
90
|
+
if (!owner || !row || !(event.target instanceof Node) || !row.contains(event.target)) return;
|
|
91
|
+
if (owner.disabled || owner.readonly) return;
|
|
92
|
+
if (event.target instanceof HTMLElement && event.target.isContentEditable) return;
|
|
93
|
+
row.setAttribute("contenteditable", "true");
|
|
94
|
+
this._editableRow = row;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Правка браузера в редактируемом ряду гасится: текст частей пишет ядро.
|
|
98
|
+
* Удаление из меню очищает задетые части.
|
|
99
|
+
*/
|
|
100
|
+
_onBeforeInput = (event) => {
|
|
101
|
+
const owner = this._owner;
|
|
102
|
+
const root = this._root;
|
|
103
|
+
const row = this._editableRow;
|
|
104
|
+
if (!owner || !root || !row) return;
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
if (!event.inputType.startsWith("delete")) return;
|
|
107
|
+
const range = rowSelection(row);
|
|
108
|
+
if (range) owner.clearSegments(touchedSegments(segmentsOf(owner, root), range));
|
|
109
|
+
collapseRowSelection(row);
|
|
110
|
+
this._restore();
|
|
111
|
+
};
|
|
112
|
+
/** Ряд снова нередактируемый: протяжка выделяет дату целиком. */
|
|
113
|
+
_restore = () => {
|
|
114
|
+
this._editableRow?.removeAttribute("contenteditable");
|
|
115
|
+
this._editableRow = null;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
/** Лежит ли `target` в обёртке слота поля. */
|
|
119
|
+
function inSlot(owner, root, target) {
|
|
120
|
+
if (!(target instanceof Element)) return false;
|
|
121
|
+
return SLOTS.some((slot) => {
|
|
122
|
+
const wrapper = target.closest(owner.classes.resolve(slot, { point: true }));
|
|
123
|
+
return wrapper !== null && root.contains(wrapper);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Часть, ближайшая к точке по горизонтали; над частью расстояние — ноль. */
|
|
127
|
+
function nearestSegment(nodes, x) {
|
|
128
|
+
let nearest;
|
|
129
|
+
let distance = Number.POSITIVE_INFINITY;
|
|
130
|
+
for (const { element } of nodes) {
|
|
131
|
+
const { left, right } = element.getBoundingClientRect();
|
|
132
|
+
const away = x < left ? left - x : Math.max(x - right, 0);
|
|
133
|
+
if (away < distance) {
|
|
134
|
+
nearest = element;
|
|
135
|
+
distance = away;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return nearest;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { TDateInputPointerPlugin };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { IDateInput } from '@soxa-ui/core';
|
|
2
|
+
import { TBasePlugin } from '../../../base';
|
|
3
|
+
import type { IPluginContext } from '../../../base';
|
|
4
|
+
import type { TDateInputTouchPluginEvents } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* TDateInputTouchPlugin — сенсорный режим поля даты: на касание части
|
|
7
|
+
* редактируемые, и дату вводят с экранной клавиатуры.
|
|
8
|
+
*
|
|
9
|
+
* На компьютере части нередактируемые — так дату целиком выделяет протяжка
|
|
10
|
+
* мышью. Но экранная клавиатура открывается только над редактируемым узлом.
|
|
11
|
+
* Поэтому **режим выбирает нажатие**, а не устройство: палец и перо
|
|
12
|
+
* (`pointerType`) делают части редактируемыми (`contenteditable`; клавиатура
|
|
13
|
+
* цифр, у периода суток — букв: его набирают буквой), мышь — снова нет. Смена
|
|
14
|
+
* вида поля, точности времени и локали меняет состав частей, и наборы
|
|
15
|
+
* пересчитываются: новым частям — те же атрибуты. На ноутбуке с сенсорным экраном
|
|
16
|
+
* мышь сохраняет протяжку, а палец получает клавиатуру. Режим меняется на
|
|
17
|
+
* `pointerdown`, раньше фокуса: фокус браузер переводит после конца касания, а
|
|
18
|
+
* нажатие мышью начинает протяжку уже по нередактируемым частям. Атрибуты
|
|
19
|
+
* идут значениями в наборы частей (`segmentSets`), разметку рисует фреймворк;
|
|
20
|
+
* сервер рисует части нередактируемыми.
|
|
21
|
+
*
|
|
22
|
+
* **Текст части пишет ядро.** Правка браузера (`beforeinput`) гасится и
|
|
23
|
+
* становится командой: вставка — знаки по одному, как клавиши (`typeKey`;
|
|
24
|
+
* по выделению — вместо задетых частей), стирание назад — цифра
|
|
25
|
+
* (`eraseDigit`), другое удаление — часть или задетые выделением части. Чего
|
|
26
|
+
* отменить нельзя — композиции (IME, клавиатуры Android) — браузер пишет в
|
|
27
|
+
* часть сам; по `compositionend` набранное уходит ядру, а часть получает текст
|
|
28
|
+
* ядра обратно. Так же — после правки, которую браузер всё же сделал мимо
|
|
29
|
+
* отмены (SwiftKey стирает и после погашенного Backspace).
|
|
30
|
+
*
|
|
31
|
+
* **Сенсорные устройства Apple.** VoiceOver на iOS счётчик (`spinbutton`) не
|
|
32
|
+
* фокусирует — роль частей там `textbox`; а групп не объявляет — имя поля
|
|
33
|
+
* входит в имя каждой части: ссылкой на себя и на подпись поля
|
|
34
|
+
* (`aria-labelledby`), у поля, названного строкой, — строкой («день, Дата
|
|
35
|
+
* рождения»). Устройство плагин узнаёт после `ready`, у документа корня, и
|
|
36
|
+
* сервер рисует счётчики.
|
|
37
|
+
*
|
|
38
|
+
* Клавиши, которые экранная клавиатура шлёт как клавиши (`keydown` с цифрой),
|
|
39
|
+
* исполняет плагин клавиатуры, и правки за ними браузер не делает: клавиша
|
|
40
|
+
* погашена.
|
|
41
|
+
*/
|
|
42
|
+
export declare class TDateInputTouchPlugin extends TBasePlugin<IDateInput, TDateInputTouchPluginEvents> {
|
|
43
|
+
private _owner;
|
|
44
|
+
private _root;
|
|
45
|
+
/** Последнее нажатие на поле — пальцем или пером: части редактируемые */
|
|
46
|
+
private _touch;
|
|
47
|
+
/** Сенсорное устройство Apple: роль частей — `textbox`, имя поля — в имени части */
|
|
48
|
+
private _appleTouch;
|
|
49
|
+
/** Идёт композиция: её текст в части вернёт `compositionend` */
|
|
50
|
+
private _composing;
|
|
51
|
+
install(ctx: IPluginContext): void;
|
|
52
|
+
/**
|
|
53
|
+
* Записанное в наборы частей уходит вместе с плагином: наборы — у поля, а
|
|
54
|
+
* поле переживает монтирование.
|
|
55
|
+
*/
|
|
56
|
+
destroy(): void;
|
|
57
|
+
/** Части редактируемые: нажатие пальцем или пером, и поле можно править. */
|
|
58
|
+
private get _editable();
|
|
59
|
+
/** Корень сменился — слушатели переезжают; устройство — у документа корня. */
|
|
60
|
+
private _bind;
|
|
61
|
+
/** Нажатие на поле выбирает режим: палец и перо — части редактируемые, мышь — нет. */
|
|
62
|
+
private readonly _onPointerDown;
|
|
63
|
+
/**
|
|
64
|
+
* Правка браузера в части гасится и становится командой ядра. Правка
|
|
65
|
+
* приходит только туда, где можно править, — в части, которые плагин сделал
|
|
66
|
+
* редактируемыми.
|
|
67
|
+
*/
|
|
68
|
+
private readonly _onBeforeInput;
|
|
69
|
+
/**
|
|
70
|
+
* Правка части — команда ядра. Вставка — знаки по одному, как клавиши, а
|
|
71
|
+
* если выделение задело части — вместо них. Удаление назад — цифра (с пустой
|
|
72
|
+
* части ядро уводит фокус на предыдущую), другое удаление — часть; задетые
|
|
73
|
+
* выделением части — целиком.
|
|
74
|
+
*/
|
|
75
|
+
private _edit;
|
|
76
|
+
/**
|
|
77
|
+
* Браузер поправил текст части мимо отмены — клавиатура не уважает
|
|
78
|
+
* погашенный `beforeinput`, — и часть получает текст ядра обратно. Пока
|
|
79
|
+
* идёт композиция, её текст часть показывает: его вернёт `compositionend`.
|
|
80
|
+
*/
|
|
81
|
+
private readonly _onInput;
|
|
82
|
+
private readonly _onCompositionStart;
|
|
83
|
+
/**
|
|
84
|
+
* Композиция кончилась: набранное — в ядро знаками, как клавиши, а часть
|
|
85
|
+
* получает текст ядра обратно. Текст композиции браузер писал в часть мимо
|
|
86
|
+
* фреймворка, и тот его не перерисует, если текст ядра не сменился: набрали
|
|
87
|
+
* не цифры.
|
|
88
|
+
*/
|
|
89
|
+
private readonly _onCompositionEnd;
|
|
90
|
+
/** Атрибуты редактируемости — в наборы частей: части редактируемы на касание. */
|
|
91
|
+
private readonly _syncEditable;
|
|
92
|
+
/**
|
|
93
|
+
* Роль и имя частей на сенсорных устройствах Apple: `textbox` и имя поля в
|
|
94
|
+
* имени части. Подпись поля по `id` — ссылкой: часть называет себя (её
|
|
95
|
+
* `aria-label` — имя части) и подпись. Имя поля строкой — строкой, после
|
|
96
|
+
* имени части. Без своего `id` части сослаться на себя нельзя, и имя
|
|
97
|
+
* остаётся её собственным. На остальных устройствах набор пуст.
|
|
98
|
+
*/
|
|
99
|
+
private readonly _syncAppleTouch;
|
|
100
|
+
}
|