@dxtmisha/constructor 0.23.0 → 0.30.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/package.json +36 -6
- package/src/classes/AriaStaticInclude.ts +269 -0
- package/src/classes/DescriptionInclude.ts +19 -2
- package/src/classes/EnabledInclude.ts +11 -0
- package/src/classes/EventClickInclude.ts +2 -2
- package/src/classes/LabelHighlightInclude.ts +35 -0
- package/src/classes/LabelInclude.ts +40 -5
- package/src/classes/ModelInclude.ts +50 -1
- package/src/classes/ModelValueInclude.ts +73 -0
- package/src/classes/TabIndexInclude.ts +260 -0
- package/src/classes/TextInclude.ts +102 -0
- package/src/classes/TouchEventInclude.ts +284 -0
- package/src/classes/field/FieldArrowInclude.ts +189 -0
- package/src/classes/field/FieldAttributesInclude.ts +87 -28
- package/src/classes/field/FieldChangeInclude.ts +1 -1
- package/src/classes/field/FieldElementInclude.ts +1 -1
- package/src/classes/field/FieldEventInclude.ts +253 -0
- package/src/classes/field/FieldInputModeInclude.ts +48 -0
- package/src/classes/field/FieldMatchInclude.ts +9 -3
- package/src/classes/field/FieldTypeInclude.ts +11 -6
- package/src/classes/field/FieldValidationInclude.ts +1 -4
- package/src/classes/field/FieldValueInclude.ts +10 -0
- package/src/constructors/Accordion/Accordion.ts +68 -0
- package/src/constructors/Accordion/AccordionDesign.tsx +192 -0
- package/src/constructors/Accordion/basicTypes.ts +0 -0
- package/src/constructors/Accordion/index.ts +5 -0
- package/src/constructors/Accordion/properties.json +16 -0
- package/src/constructors/Accordion/props.ts +55 -0
- package/src/constructors/Accordion/style.scss +12 -0
- package/src/constructors/Accordion/types.ts +63 -0
- package/src/constructors/ActionSheet/ActionSheet.ts +78 -0
- package/src/constructors/ActionSheet/ActionSheetDesign.tsx +125 -0
- package/src/constructors/ActionSheet/basicTypes.ts +0 -0
- package/src/constructors/ActionSheet/index.ts +5 -0
- package/src/constructors/ActionSheet/properties.json +14 -0
- package/src/constructors/ActionSheet/props.ts +44 -0
- package/src/constructors/ActionSheet/style.scss +25 -0
- package/src/constructors/ActionSheet/types.ts +54 -0
- package/src/constructors/Actions/Actions.ts +60 -0
- package/src/constructors/Actions/ActionsDesign.tsx +212 -0
- package/src/constructors/Actions/ActionsInclude.ts +109 -0
- package/src/constructors/Actions/basicTypes.ts +40 -0
- package/src/constructors/Actions/index.ts +6 -0
- package/src/constructors/Actions/properties.json +63 -0
- package/src/constructors/Actions/props.ts +42 -0
- package/src/constructors/Actions/style.scss +11 -0
- package/src/constructors/Actions/types.ts +52 -0
- package/src/constructors/Anchor/Anchor.ts +113 -0
- package/src/constructors/Anchor/AnchorDesign.tsx +242 -0
- package/src/constructors/Anchor/AnchorEvent.ts +76 -0
- package/src/constructors/Anchor/AnchorHref.ts +54 -0
- package/src/constructors/Anchor/AnchorIcon.ts +54 -0
- package/src/constructors/Anchor/AnchorTo.ts +46 -0
- package/src/constructors/Anchor/basicTypes.ts +9 -0
- package/src/constructors/Anchor/index.ts +5 -0
- package/src/constructors/Anchor/properties.json +3 -0
- package/src/constructors/Anchor/props.ts +54 -0
- package/src/constructors/Anchor/style.scss +10 -0
- package/src/constructors/Anchor/types.ts +47 -0
- package/src/constructors/Arrow/Arrow.ts +134 -0
- package/src/constructors/Arrow/ArrowDesign.tsx +226 -0
- package/src/constructors/Arrow/ArrowElement.ts +139 -0
- package/src/constructors/Arrow/ArrowElementTarget.ts +72 -0
- package/src/constructors/Arrow/ArrowEvent.ts +126 -0
- package/src/constructors/Arrow/ArrowInclude.ts +85 -0
- package/src/constructors/Arrow/ArrowParent.ts +100 -0
- package/src/constructors/Arrow/ArrowPosition.ts +231 -0
- package/src/constructors/Arrow/basicTypes.ts +50 -0
- package/src/constructors/Arrow/index.ts +6 -0
- package/src/constructors/Arrow/properties.json +23 -0
- package/src/constructors/Arrow/props.ts +31 -0
- package/src/constructors/Arrow/style.scss +133 -0
- package/src/constructors/Arrow/types.ts +54 -0
- package/src/constructors/Badge/BadgeDesign.tsx +4 -1
- package/src/constructors/Badge/properties.json +36 -36
- package/src/constructors/Badge/props.ts +3 -1
- package/src/constructors/Badge/types.ts +3 -3
- package/src/constructors/Bars/Bars.ts +10 -4
- package/src/constructors/Bars/BarsDesign.tsx +17 -11
- package/src/constructors/Bars/BarsInclude.ts +5 -2
- package/src/constructors/Bars/properties.json +6 -6
- package/src/constructors/Bars/props.ts +3 -1
- package/src/constructors/Bars/style.scss +4 -0
- package/src/constructors/Bars/types.ts +3 -3
- package/src/constructors/Block/Block.ts +105 -0
- package/src/constructors/Block/BlockDesign.tsx +219 -0
- package/src/constructors/Block/basicTypes.ts +0 -0
- package/src/constructors/Block/index.ts +5 -0
- package/src/constructors/Block/properties.json +10 -0
- package/src/constructors/Block/props.ts +46 -0
- package/src/constructors/Block/style.scss +11 -0
- package/src/constructors/Block/types.ts +64 -0
- package/src/constructors/Button/Button.ts +26 -2
- package/src/constructors/Button/ButtonDesign.tsx +11 -6
- package/src/constructors/Button/ButtonInclude.ts +8 -5
- package/src/constructors/Button/index.ts +1 -0
- package/src/constructors/Button/properties.json +84 -84
- package/src/constructors/Button/props.ts +5 -1
- package/src/constructors/Button/style.scss +1 -1
- package/src/constructors/Button/types.ts +2 -2
- package/src/constructors/Cell/Cell.ts +23 -6
- package/src/constructors/Cell/CellDesign.tsx +53 -22
- package/src/constructors/Cell/basicTypes.ts +33 -0
- package/src/constructors/Cell/properties.json +52 -52
- package/src/constructors/Cell/props.ts +16 -13
- package/src/constructors/Cell/style.scss +1 -1
- package/src/constructors/Cell/types.ts +3 -3
- package/src/constructors/Chip/ChipDesign.tsx +5 -5
- package/src/constructors/Chip/ChipInclude.ts +83 -0
- package/src/constructors/Chip/basicTypes.ts +12 -0
- package/src/constructors/Chip/index.ts +2 -0
- package/src/constructors/Chip/properties.json +3 -3
- package/src/constructors/Chip/types.ts +5 -5
- package/src/constructors/ChipGroup/ChipGroup.ts +74 -0
- package/src/constructors/ChipGroup/ChipGroupDesign.tsx +162 -0
- package/src/constructors/ChipGroup/basicTypes.ts +6 -0
- package/src/constructors/ChipGroup/index.ts +5 -0
- package/src/constructors/ChipGroup/properties.json +3 -0
- package/src/constructors/ChipGroup/props.ts +50 -0
- package/src/constructors/ChipGroup/style.scss +6 -0
- package/src/constructors/ChipGroup/types.ts +47 -0
- package/src/constructors/Dialog/Dialog.ts +145 -0
- package/src/constructors/Dialog/DialogDesign.tsx +135 -0
- package/src/constructors/Dialog/basicTypes.ts +0 -0
- package/src/constructors/Dialog/index.ts +5 -0
- package/src/constructors/Dialog/properties.json +23 -0
- package/src/constructors/Dialog/props.ts +76 -0
- package/src/constructors/Dialog/style.scss +18 -0
- package/src/constructors/Dialog/types.ts +67 -0
- package/src/constructors/Field/Field.ts +58 -19
- package/src/constructors/Field/FieldDesign.tsx +35 -17
- package/src/constructors/Field/FieldInclude.ts +141 -11
- package/src/constructors/Field/basicTypes.ts +35 -19
- package/src/constructors/Field/properties.json +92 -86
- package/src/constructors/Field/props.ts +6 -3
- package/src/constructors/Field/style.scss +36 -20
- package/src/constructors/Field/types.ts +13 -13
- package/src/constructors/FieldCounter/FieldCounterDesign.tsx +1 -0
- package/src/constructors/FieldCounter/FieldCounterInclude.ts +3 -1
- package/src/constructors/FieldCounter/basicTypes.ts +1 -0
- package/src/constructors/FieldCounter/properties.json +3 -3
- package/src/constructors/FieldCounter/props.ts +5 -2
- package/src/constructors/FieldCounter/types.ts +1 -1
- package/src/constructors/FieldLabel/FieldLabelDesign.tsx +6 -2
- package/src/constructors/FieldLabel/FieldLabelInclude.ts +13 -4
- package/src/constructors/FieldLabel/properties.json +4 -4
- package/src/constructors/FieldLabel/props.ts +2 -2
- package/src/constructors/FieldLabel/types.ts +2 -2
- package/src/constructors/FieldMessage/FieldMessage.ts +19 -0
- package/src/constructors/FieldMessage/FieldMessageDesign.tsx +36 -4
- package/src/constructors/FieldMessage/FieldMessageInclude.ts +11 -1
- package/src/constructors/FieldMessage/basicTypes.ts +15 -1
- package/src/constructors/FieldMessage/properties.json +10 -9
- package/src/constructors/FieldMessage/props.ts +4 -0
- package/src/constructors/FieldMessage/style.scss +16 -1
- package/src/constructors/FieldMessage/types.ts +4 -2
- package/src/constructors/Icon/Icon.ts +37 -2
- package/src/constructors/Icon/IconDesign.tsx +46 -39
- package/src/constructors/Icon/properties.json +25 -25
- package/src/constructors/Icon/props.ts +22 -16
- package/src/constructors/Icon/types.ts +1 -1
- package/src/constructors/Image/Image.ts +68 -10
- package/src/constructors/Image/ImageBackground.ts +15 -2
- package/src/constructors/Image/ImageCoordinator.ts +4 -2
- package/src/constructors/Image/ImageData.ts +4 -0
- package/src/constructors/Image/ImageDesign.tsx +81 -15
- package/src/constructors/Image/ImageFile.ts +2 -13
- package/src/constructors/Image/ImageImg.ts +218 -0
- package/src/constructors/Image/ImagePdf.ts +2 -2
- package/src/constructors/Image/basicTypes.ts +5 -0
- package/src/constructors/Image/properties.json +17 -17
- package/src/constructors/Image/props.ts +34 -7
- package/src/constructors/Image/style.scss +42 -0
- package/src/constructors/Image/types.ts +1 -1
- package/src/constructors/Input/Input.ts +146 -0
- package/src/constructors/Input/InputDesign.tsx +174 -0
- package/src/constructors/Input/InputPassword.ts +54 -0
- package/src/constructors/Input/basicTypes.ts +3 -0
- package/src/constructors/Input/index.ts +5 -0
- package/src/constructors/Input/properties.json +2 -0
- package/src/constructors/Input/props.ts +53 -0
- package/src/constructors/Input/style.scss +5 -0
- package/src/constructors/Input/types.ts +48 -0
- package/src/constructors/List/List.ts +36 -11
- package/src/constructors/List/ListControl.ts +2 -2
- package/src/constructors/List/ListDesign.tsx +59 -38
- package/src/constructors/List/ListGo.ts +5 -3
- package/src/constructors/List/properties.json +16 -16
- package/src/constructors/List/props.ts +7 -0
- package/src/constructors/List/style.scss +14 -0
- package/src/constructors/List/types.ts +9 -9
- package/src/constructors/ListGroup/ListGroupDesign.tsx +8 -3
- package/src/constructors/ListGroup/basicTypes.ts +7 -0
- package/src/constructors/ListGroup/properties.json +15 -15
- package/src/constructors/ListGroup/props.ts +4 -4
- package/src/constructors/ListGroup/types.ts +2 -1
- package/src/constructors/ListItem/ListItem.ts +67 -7
- package/src/constructors/ListItem/ListItemDesign.tsx +13 -10
- package/src/constructors/ListItem/properties.json +52 -52
- package/src/constructors/ListItem/props.ts +24 -15
- package/src/constructors/ListItem/types.ts +12 -12
- package/src/constructors/ListMenu/ListMenu.ts +2 -1
- package/src/constructors/ListMenu/ListMenuDesign.tsx +3 -3
- package/src/constructors/ListMenu/properties.json +19 -19
- package/src/constructors/ListMenu/types.ts +3 -3
- package/src/constructors/Mask/MaskDesign.tsx +33 -28
- package/src/constructors/Mask/MaskEvent.ts +41 -2
- package/src/constructors/Mask/MaskInclude.ts +147 -0
- package/src/constructors/Mask/basicTypes.ts +19 -1
- package/src/constructors/Mask/properties.json +30 -29
- package/src/constructors/Mask/props.ts +1 -1
- package/src/constructors/Mask/style.scss +2 -4
- package/src/constructors/Mask/types.ts +4 -4
- package/src/constructors/Menu/Menu.ts +17 -5
- package/src/constructors/Menu/MenuDesign.tsx +11 -11
- package/src/constructors/Menu/MenuGo.ts +72 -0
- package/src/constructors/Menu/MenuInclude.ts +20 -10
- package/src/constructors/Menu/MenuSearch.ts +20 -1
- package/src/constructors/Menu/MenuValue.ts +7 -3
- package/src/constructors/Menu/MenuWindow.ts +2 -1
- package/src/constructors/Menu/basicTypes.ts +21 -4
- package/src/constructors/Menu/properties.json +17 -17
- package/src/constructors/Menu/props.ts +15 -3
- package/src/constructors/Menu/types.ts +6 -16
- package/src/constructors/Modal/Modal.ts +53 -0
- package/src/constructors/Modal/ModalAbstract.ts +74 -0
- package/src/constructors/Modal/ModalDesign.tsx +63 -0
- package/src/constructors/Modal/ModalDesignAbstract.tsx +226 -0
- package/src/constructors/Modal/basicTypes.ts +0 -0
- package/src/constructors/Modal/index.ts +5 -0
- package/src/constructors/Modal/properties.json +17 -0
- package/src/constructors/Modal/props.ts +45 -0
- package/src/constructors/Modal/style.scss +20 -0
- package/src/constructors/Modal/types.ts +62 -0
- package/src/constructors/MotionTransform/MotionTransform.ts +65 -8
- package/src/constructors/MotionTransform/MotionTransformDesign.tsx +55 -21
- package/src/constructors/MotionTransform/MotionTransformElement.ts +7 -2
- package/src/constructors/MotionTransform/MotionTransformInclude.ts +2 -1
- package/src/constructors/MotionTransform/MotionTransformState.ts +5 -0
- package/src/constructors/MotionTransform/basicTypes.ts +18 -2
- package/src/constructors/MotionTransform/properties.json +35 -35
- package/src/constructors/MotionTransform/props.ts +13 -7
- package/src/constructors/MotionTransform/style.scss +24 -2
- package/src/constructors/MotionTransform/types.ts +7 -7
- package/src/constructors/Progress/Progress.ts +12 -2
- package/src/constructors/Progress/ProgressDesign.tsx +75 -53
- package/src/constructors/Progress/ProgressInclude.ts +13 -1
- package/src/constructors/Progress/properties.json +47 -47
- package/src/constructors/Progress/props.ts +5 -1
- package/src/constructors/Progress/style.scss +2 -2
- package/src/constructors/Progress/types.ts +4 -4
- package/src/constructors/Ripple/Ripple.ts +1 -1
- package/src/constructors/Ripple/RippleDesign.tsx +7 -4
- package/src/constructors/Ripple/RippleItem.ts +1 -1
- package/src/constructors/Ripple/style.scss +4 -0
- package/src/constructors/Ripple/types.ts +2 -2
- package/src/constructors/Scrollbar/Scrollbar.ts +3 -3
- package/src/constructors/Scrollbar/ScrollbarDesign.tsx +1 -1
- package/src/constructors/Scrollbar/properties.json +33 -33
- package/src/constructors/Scrollbar/types.ts +1 -1
- package/src/constructors/Section/Section.ts +33 -0
- package/src/constructors/Section/SectionDesign.tsx +127 -0
- package/src/constructors/Section/basicTypes.ts +0 -0
- package/src/constructors/Section/index.ts +5 -0
- package/src/constructors/Section/properties.json +2 -0
- package/src/constructors/Section/props.ts +29 -0
- package/src/constructors/Section/style.scss +5 -0
- package/src/constructors/Section/types.ts +47 -0
- package/src/constructors/Select/Select.ts +172 -0
- package/src/constructors/Select/SelectDesign.tsx +288 -0
- package/src/constructors/Select/SelectFilter.ts +43 -0
- package/src/constructors/Select/SelectInput.ts +68 -0
- package/src/constructors/Select/basicTypes.ts +0 -0
- package/src/constructors/Select/index.ts +5 -0
- package/src/constructors/Select/properties.json +3 -0
- package/src/constructors/Select/props.ts +63 -0
- package/src/constructors/Select/style.scss +5 -0
- package/src/constructors/Select/types.ts +53 -0
- package/src/constructors/SelectValue/SelectValue.ts +95 -0
- package/src/constructors/SelectValue/SelectValueDesign.tsx +198 -0
- package/src/constructors/SelectValue/SelectValueInclude.ts +92 -0
- package/src/constructors/SelectValue/basicTypes.ts +17 -0
- package/src/constructors/SelectValue/index.ts +6 -0
- package/src/constructors/SelectValue/properties.json +7 -0
- package/src/constructors/SelectValue/props.ts +48 -0
- package/src/constructors/SelectValue/style.scss +14 -0
- package/src/constructors/SelectValue/types.ts +47 -0
- package/src/constructors/Skeleton/Skeleton.ts +1 -3
- package/src/constructors/Skeleton/SkeletonDesign.tsx +7 -1
- package/src/constructors/Skeleton/SkeletonInclude.ts +5 -0
- package/src/constructors/Skeleton/properties.json +24 -24
- package/src/constructors/Skeleton/types.ts +1 -1
- package/src/constructors/TextareaAutosize/TextareaAutosize.ts +41 -0
- package/src/constructors/TextareaAutosize/TextareaAutosizeDesign.tsx +147 -0
- package/src/constructors/TextareaAutosize/TextareaAutosizeResize.ts +109 -0
- package/src/constructors/TextareaAutosize/TextareaAutosizeValue.ts +69 -0
- package/src/constructors/TextareaAutosize/basicTypes.ts +0 -0
- package/src/constructors/TextareaAutosize/index.ts +5 -0
- package/src/constructors/TextareaAutosize/properties.json +6 -0
- package/src/constructors/TextareaAutosize/props.ts +34 -0
- package/src/constructors/TextareaAutosize/style.scss +31 -0
- package/src/constructors/TextareaAutosize/types.ts +50 -0
- package/src/constructors/Tooltip/Tooltip.ts +138 -0
- package/src/constructors/Tooltip/TooltipClasses.ts +90 -0
- package/src/constructors/Tooltip/TooltipDesign.tsx +198 -0
- package/src/constructors/Tooltip/TooltipEvent.ts +103 -0
- package/src/constructors/Tooltip/TooltipInclude.ts +114 -0
- package/src/constructors/Tooltip/TooltipOpen.ts +128 -0
- package/src/constructors/Tooltip/TooltipPosition.ts +92 -0
- package/src/constructors/Tooltip/TooltipStatus.ts +97 -0
- package/src/constructors/Tooltip/TooltipStyle.ts +123 -0
- package/src/constructors/Tooltip/basicTypes.ts +39 -0
- package/src/constructors/Tooltip/index.ts +6 -0
- package/src/constructors/Tooltip/properties.json +14 -0
- package/src/constructors/Tooltip/props.ts +49 -0
- package/src/constructors/Tooltip/style.scss +43 -0
- package/src/constructors/Tooltip/types.ts +58 -0
- package/src/constructors/Window/Window.ts +52 -16
- package/src/constructors/Window/WindowClasses.ts +33 -0
- package/src/constructors/Window/WindowClient.ts +39 -0
- package/src/constructors/Window/WindowDesign.tsx +31 -14
- package/src/constructors/Window/WindowEsc.ts +114 -0
- package/src/constructors/Window/WindowHidden.ts +120 -0
- package/src/constructors/Window/WindowInclude.ts +2 -2
- package/src/constructors/Window/WindowOpen.ts +10 -1
- package/src/constructors/Window/WindowOrigin.ts +5 -1
- package/src/constructors/Window/WindowStatic.ts +3 -1
- package/src/constructors/Window/WindowVerification.ts +8 -5
- package/src/constructors/Window/basicTypes.ts +26 -16
- package/src/constructors/Window/properties.json +239 -236
- package/src/constructors/Window/props.ts +10 -1
- package/src/constructors/Window/style.scss +11 -0
- package/src/constructors/Window/types.ts +2 -2
- package/src/functions/{getClassTegAStatic.ts → getClassTagAStatic.ts} +1 -1
- package/src/library.ts +13 -1
- package/src/types/ariaTypes.ts +366 -0
- package/src/types/descriptionTypes.ts +8 -0
- package/src/types/fieldTypes.ts +120 -16
- package/src/types/labelTypes.ts +39 -0
- package/src/types/modelTypes.ts +16 -0
- package/src/types/roleTypes.ts +88 -0
- package/src/types/textTypes.ts +33 -0
- package/src/types/touchEventTypes.ts +43 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ref, watch } from 'vue'
|
|
2
|
+
import type { RefType } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import { EventClickInclude } from './EventClickInclude'
|
|
5
|
+
import { ModelInclude } from './ModelInclude'
|
|
6
|
+
|
|
7
|
+
import type { EventClickValue } from '../types/eventClickTypes'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Class for managing model value with reactive reference and click handling.
|
|
11
|
+
*
|
|
12
|
+
* Класс для управления значением модели с реактивной ссылкой и обработкой клика.
|
|
13
|
+
*/
|
|
14
|
+
export class ModelValueInclude<Value = any> {
|
|
15
|
+
readonly value = ref<Value>()
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Constructor
|
|
19
|
+
* @param index identifier/ идентификатор
|
|
20
|
+
* @param emits emits function/ функция эмитов
|
|
21
|
+
* @param event event click handler/ обработчик клика
|
|
22
|
+
* @param inputValue input value reference/ ссылка на входное значение
|
|
23
|
+
* @param readonly readonly flag/ флаг только для чтения
|
|
24
|
+
*/
|
|
25
|
+
constructor(
|
|
26
|
+
protected readonly index: string,
|
|
27
|
+
protected readonly emits?: any,
|
|
28
|
+
protected readonly event?: EventClickInclude,
|
|
29
|
+
protected readonly inputValue?: RefType<any>,
|
|
30
|
+
protected readonly readonly?: RefType<boolean | undefined>
|
|
31
|
+
) {
|
|
32
|
+
new ModelInclude(this.index, this.emits, this.value)
|
|
33
|
+
|
|
34
|
+
watch(
|
|
35
|
+
[this.inputValue],
|
|
36
|
+
() => {
|
|
37
|
+
this.value.value = this.inputValue?.value
|
|
38
|
+
},
|
|
39
|
+
{ immediate: true }
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current value.
|
|
45
|
+
*
|
|
46
|
+
* Возвращает текущее значение.
|
|
47
|
+
*/
|
|
48
|
+
getValue(): Value | undefined {
|
|
49
|
+
return this.value.value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Click handler.
|
|
54
|
+
*
|
|
55
|
+
* Обработчик клика.
|
|
56
|
+
* @param event event object/ объект события
|
|
57
|
+
* @param options data object/ объект с данными
|
|
58
|
+
*/
|
|
59
|
+
readonly onClick = (
|
|
60
|
+
event: MouseEvent,
|
|
61
|
+
options?: EventClickValue
|
|
62
|
+
): void => {
|
|
63
|
+
if (
|
|
64
|
+
options
|
|
65
|
+
&& 'value' in options
|
|
66
|
+
&& !this.readonly?.value
|
|
67
|
+
) {
|
|
68
|
+
this.value.value = options.value
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.event?.onClick(event, options)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { onUnmounted, type Ref } from 'vue'
|
|
2
|
+
import { EventItem, getRef, isDomRuntime, isFunction } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Class for managing focus and tab index of elements
|
|
6
|
+
*
|
|
7
|
+
* Класс для управления фокусом и табиндексом элементов
|
|
8
|
+
*/
|
|
9
|
+
export class TabIndexInclude<E extends HTMLElement = HTMLElement> {
|
|
10
|
+
/** Previously focused element/ Ранее сфокусированный элемент */
|
|
11
|
+
protected oldElement?: HTMLElement | Element | null
|
|
12
|
+
|
|
13
|
+
/** Event item for focus events/ Элемент события для событий фокуса */
|
|
14
|
+
protected event?: EventItem<HTMLElement, any>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Сonstructor
|
|
18
|
+
* @param element - Reference to the element/ Ссылка на элемент
|
|
19
|
+
*/
|
|
20
|
+
constructor(
|
|
21
|
+
protected readonly element: Ref<E | undefined> | (() => E | undefined)
|
|
22
|
+
) {
|
|
23
|
+
onUnmounted(() => {
|
|
24
|
+
this.stopEvent()
|
|
25
|
+
this.event = undefined
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Set focus to the element.
|
|
31
|
+
*
|
|
32
|
+
* Устанавливает фокус на элемент.
|
|
33
|
+
*/
|
|
34
|
+
goTo(): this {
|
|
35
|
+
if (
|
|
36
|
+
this.isElement()
|
|
37
|
+
&& isDomRuntime()
|
|
38
|
+
) {
|
|
39
|
+
this.updateOldElement()
|
|
40
|
+
this.toFocus()
|
|
41
|
+
this.startEvent()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return this
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Reset focus to the previously focused element.
|
|
49
|
+
*
|
|
50
|
+
* Сбрасывает фокус на ранее сфокусированный элемент.
|
|
51
|
+
*/
|
|
52
|
+
reset(): this {
|
|
53
|
+
if (
|
|
54
|
+
this.oldElement
|
|
55
|
+
&& ('focus' in this.oldElement)
|
|
56
|
+
) {
|
|
57
|
+
this.oldElement.focus()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.stopEvent()
|
|
61
|
+
|
|
62
|
+
return this
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Toggle focus based on status.
|
|
67
|
+
*
|
|
68
|
+
* Переключает фокус в зависимости от статуса.
|
|
69
|
+
* @param status Focus status/ Статус фокуса
|
|
70
|
+
*/
|
|
71
|
+
toggle(status: boolean): this {
|
|
72
|
+
if (status) {
|
|
73
|
+
this.goTo()
|
|
74
|
+
} else {
|
|
75
|
+
this.reset()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return this
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Check if the element is defined.
|
|
83
|
+
*
|
|
84
|
+
* Проверяет, определен ли элемент.
|
|
85
|
+
*/
|
|
86
|
+
protected isElement(): this is { element: Ref<E> } {
|
|
87
|
+
return this.getElement() !== undefined
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if the event is a Tab key event.
|
|
92
|
+
*
|
|
93
|
+
* Проверяет, является ли событие событием клавиши Tab.
|
|
94
|
+
* @param event Keyboard event/ Событие клавиатуры
|
|
95
|
+
*/
|
|
96
|
+
protected isTab(event: KeyboardEvent): boolean {
|
|
97
|
+
return event.key === 'Tab'
|
|
98
|
+
|| event.code === 'Tab'
|
|
99
|
+
|| event.keyCode === 9
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if the Shift key is pressed.
|
|
104
|
+
*
|
|
105
|
+
* Проверяет, нажата ли клавиша Shift.
|
|
106
|
+
* @param event Keyboard event/ Событие клавиатуры
|
|
107
|
+
*/
|
|
108
|
+
protected isShift(event: KeyboardEvent): boolean {
|
|
109
|
+
return event.shiftKey
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get the element.
|
|
114
|
+
*
|
|
115
|
+
* Получает элемент.
|
|
116
|
+
*/
|
|
117
|
+
protected getElement(): E | undefined {
|
|
118
|
+
if (isFunction(this.element)) {
|
|
119
|
+
return this.element()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return getRef(this.element)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Find the first focusable element.
|
|
127
|
+
*
|
|
128
|
+
* Находит первый фокусируемый элемент.
|
|
129
|
+
*/
|
|
130
|
+
findFirstElement(): HTMLElement | undefined {
|
|
131
|
+
const elements = this.getElement()
|
|
132
|
+
?.querySelectorAll<HTMLButtonElement>('*')
|
|
133
|
+
|
|
134
|
+
if (elements) {
|
|
135
|
+
for (const element of elements) {
|
|
136
|
+
if (
|
|
137
|
+
'tabIndex' in element
|
|
138
|
+
&& element.tabIndex >= 0
|
|
139
|
+
) {
|
|
140
|
+
return element
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return undefined
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Find the last focusable element.
|
|
150
|
+
*
|
|
151
|
+
* Находит последний фокусируемый элемент.
|
|
152
|
+
*/
|
|
153
|
+
findLastElement(): HTMLElement | undefined {
|
|
154
|
+
const elements = this.getElement()
|
|
155
|
+
?.querySelectorAll<HTMLButtonElement>('*')
|
|
156
|
+
|
|
157
|
+
if (elements) {
|
|
158
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
159
|
+
const element = elements[i]
|
|
160
|
+
|
|
161
|
+
if (
|
|
162
|
+
element
|
|
163
|
+
&& 'tabIndex' in element
|
|
164
|
+
&& element.tabIndex >= 0
|
|
165
|
+
) {
|
|
166
|
+
return element
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return undefined
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Set focus with temporary tab index modification.
|
|
176
|
+
*
|
|
177
|
+
* Устанавливает фокус с временным изменением табиндекса.
|
|
178
|
+
*/
|
|
179
|
+
protected toFocus(): this {
|
|
180
|
+
const element = this.getElement()
|
|
181
|
+
|
|
182
|
+
if (element) {
|
|
183
|
+
element.setAttribute('tabindex', '-1')
|
|
184
|
+
element.focus()
|
|
185
|
+
|
|
186
|
+
requestAnimationFrame(() => {
|
|
187
|
+
element.removeAttribute('tabindex')
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return this
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Save the currently focused element.
|
|
196
|
+
*
|
|
197
|
+
* Сохраняет текущий сфокусированный элемент.
|
|
198
|
+
*/
|
|
199
|
+
protected updateOldElement(): void {
|
|
200
|
+
if (isDomRuntime()) {
|
|
201
|
+
this.oldElement = document.activeElement
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Event listener for keyboard events.
|
|
207
|
+
*
|
|
208
|
+
* Слушатель событий для событий клавиатуры.
|
|
209
|
+
* @param event Keyboard event/ Событие клавиатуры
|
|
210
|
+
*/
|
|
211
|
+
protected listenEvent = (event: KeyboardEvent): void => {
|
|
212
|
+
if (!this.isTab(event)) {
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const focusActive = document.activeElement as HTMLElement
|
|
217
|
+
|
|
218
|
+
if (focusActive) {
|
|
219
|
+
if (this.isShift(event)) {
|
|
220
|
+
if (focusActive === this.findFirstElement()) {
|
|
221
|
+
this.findLastElement()?.focus()
|
|
222
|
+
event.preventDefault()
|
|
223
|
+
}
|
|
224
|
+
} else if (focusActive === this.findLastElement()) {
|
|
225
|
+
this.findFirstElement()?.focus()
|
|
226
|
+
event.preventDefault()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Start the event listener.
|
|
233
|
+
*
|
|
234
|
+
* Запускает слушатель событий.
|
|
235
|
+
*/
|
|
236
|
+
protected startEvent(): void {
|
|
237
|
+
if (this.event) {
|
|
238
|
+
this.event.start()
|
|
239
|
+
return
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
this.event = new EventItem<HTMLElement, any>(
|
|
243
|
+
document.body,
|
|
244
|
+
'keydown',
|
|
245
|
+
this.listenEvent
|
|
246
|
+
)
|
|
247
|
+
.start()
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Stop the event listener.
|
|
252
|
+
*
|
|
253
|
+
* Останавливает слушатель событий.
|
|
254
|
+
*/
|
|
255
|
+
protected stopEvent(): void {
|
|
256
|
+
if (this.event) {
|
|
257
|
+
this.event.stop()
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { computed, shallowRef } from 'vue'
|
|
2
|
+
import { executeFunction } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
TextAllPropsInclude,
|
|
6
|
+
TextIndex,
|
|
7
|
+
TextList,
|
|
8
|
+
TextValue
|
|
9
|
+
} from '../types/textTypes'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* TextInclude class for managing text-related properties.
|
|
13
|
+
*
|
|
14
|
+
* Класс TextInclude для управления свойствами, связанными с текстом.
|
|
15
|
+
*/
|
|
16
|
+
export class TextInclude {
|
|
17
|
+
/**
|
|
18
|
+
* Global list of texts for all components/ Глобальный список текстов для всех компонентов
|
|
19
|
+
*/
|
|
20
|
+
static readonly list = shallowRef<TextList>({
|
|
21
|
+
close: 'Close',
|
|
22
|
+
copiedClipboard: 'Copied to the clipboard',
|
|
23
|
+
entriesMatch: 'Entries do not match',
|
|
24
|
+
ok: 'OK'
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initialize global texts.
|
|
29
|
+
*
|
|
30
|
+
* Инициализация глобальных текстов.
|
|
31
|
+
* @param texts List of texts/ Список текстов
|
|
32
|
+
*/
|
|
33
|
+
static initText(texts: TextList): void {
|
|
34
|
+
this.list.value = {
|
|
35
|
+
...this.list.value,
|
|
36
|
+
...texts
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Constructor
|
|
42
|
+
* @param props Component properties/ Свойства компонента
|
|
43
|
+
*/
|
|
44
|
+
constructor(
|
|
45
|
+
protected readonly props: TextAllPropsInclude
|
|
46
|
+
) {
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Close text/ Текст закрытия */
|
|
50
|
+
readonly close = computed<string | undefined>(
|
|
51
|
+
() => this.getText('close', this.props.textClose)
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
/** Copied to the clipboard text/ Текст о копировании в буфер обмена */
|
|
55
|
+
readonly copiedClipboard = computed<string | undefined>(
|
|
56
|
+
() => this.getText('copiedClipboard', this.props.textCopiedClipboard)
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
/** Entries match text/ Текст о несовпадении записей */
|
|
60
|
+
readonly entriesMatch = computed<string | undefined>(
|
|
61
|
+
() => this.getText('entriesMatch', this.props.textEntriesMatch)
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
/** OK text/ Текст подтверждения */
|
|
65
|
+
readonly ok = computed<string | undefined>(
|
|
66
|
+
() => this.getText('ok', this.props.textOk)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get text by index, with priority to local value.
|
|
71
|
+
*
|
|
72
|
+
* Получение текста по индексу с приоритетом локального значения.
|
|
73
|
+
* @param index Text index/ Индекс текста
|
|
74
|
+
* @param value Local text value/ Локальное значение текста
|
|
75
|
+
*/
|
|
76
|
+
protected getText(
|
|
77
|
+
index: TextIndex,
|
|
78
|
+
value: TextValue
|
|
79
|
+
): string | undefined {
|
|
80
|
+
if (value) {
|
|
81
|
+
return executeFunction(value)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.getGlobalText(index)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get text from global list.
|
|
89
|
+
*
|
|
90
|
+
* Получение текста из глобального списка.
|
|
91
|
+
* @param index Text index/ Индекс текста
|
|
92
|
+
*/
|
|
93
|
+
protected getGlobalText(
|
|
94
|
+
index: TextIndex
|
|
95
|
+
): string | undefined {
|
|
96
|
+
if (TextInclude.list.value?.[index]) {
|
|
97
|
+
return executeFunction(TextInclude.list.value[index])
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return undefined
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { ref, type Ref } from 'vue'
|
|
2
|
+
import { executePromise } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
TouchEventCallback,
|
|
6
|
+
TouchEventClient,
|
|
7
|
+
TouchEventTypeX,
|
|
8
|
+
TouchEventTypeY
|
|
9
|
+
} from '../types/touchEventTypes'
|
|
10
|
+
|
|
11
|
+
const MAX_MOVE = 80
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Class for handling touch and mouse events with gesture detection.
|
|
15
|
+
*
|
|
16
|
+
* Класс для обработки событий касания и мыши с определением жестов.
|
|
17
|
+
*/
|
|
18
|
+
export class TouchEventInclude {
|
|
19
|
+
/**
|
|
20
|
+
* Current touch point
|
|
21
|
+
*
|
|
22
|
+
* Текущая точка касания
|
|
23
|
+
*/
|
|
24
|
+
readonly touche = ref<Touch>()
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Touchpoint during move
|
|
28
|
+
*
|
|
29
|
+
* Точка касания во время движения
|
|
30
|
+
*/
|
|
31
|
+
readonly toucheMove = ref<Touch>()
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Current mouse position
|
|
35
|
+
*
|
|
36
|
+
* Текущая позиция мыши
|
|
37
|
+
*/
|
|
38
|
+
readonly mouse = ref<TouchEventClient>()
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Mouse position during move
|
|
42
|
+
*
|
|
43
|
+
* Позиция мыши во время движения
|
|
44
|
+
*/
|
|
45
|
+
readonly mouseMove = ref<TouchEventClient>()
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Constructor
|
|
49
|
+
* @param start callback on touch/mouse start/ колбэк при начале касания/клика
|
|
50
|
+
* @param move callback on touch/mouse move/ колбэк при движении
|
|
51
|
+
* @param end callback on touch/mouse end/ колбэк при завершении
|
|
52
|
+
* @param element optional element reference/ необязательная ссылка на элемент
|
|
53
|
+
*/
|
|
54
|
+
constructor(
|
|
55
|
+
private readonly start?: (mouse: TouchEventClient, touche?: Touch) => void,
|
|
56
|
+
private readonly move?: TouchEventCallback,
|
|
57
|
+
private readonly end?: TouchEventCallback,
|
|
58
|
+
private readonly element?: Ref<HTMLElement | undefined>
|
|
59
|
+
) {
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Touch event handlers
|
|
64
|
+
*
|
|
65
|
+
* Обработчики событий касания
|
|
66
|
+
*/
|
|
67
|
+
readonly onTouch = {
|
|
68
|
+
onTouchstart: (event: TouchEvent) => {
|
|
69
|
+
this.touche.value = event.targetTouches?.[0]
|
|
70
|
+
this.mouse.value = {
|
|
71
|
+
x: this.touche.value?.clientX ?? 0,
|
|
72
|
+
y: this.touche.value?.clientY ?? 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.update(event.target as HTMLElement)
|
|
76
|
+
},
|
|
77
|
+
onTouchend: (event: TouchEvent) => this.reset(event.target as HTMLElement),
|
|
78
|
+
onTouchcancel: (event: TouchEvent) => this.reset(event.target as HTMLElement),
|
|
79
|
+
onTouchmove: (event: TouchEvent) => {
|
|
80
|
+
this.toucheMove.value = event.targetTouches?.[0]
|
|
81
|
+
this.mouseMove.value = {
|
|
82
|
+
x: this.toucheMove.value?.clientX ?? 0,
|
|
83
|
+
y: this.toucheMove.value?.clientY ?? 0
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.updateMove(event.target as HTMLElement)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Mouse event handlers
|
|
92
|
+
*
|
|
93
|
+
* Обработчики событий мыши
|
|
94
|
+
*/
|
|
95
|
+
readonly onMouse = {
|
|
96
|
+
onMousedown: (event: MouseEvent) => {
|
|
97
|
+
this.mouse.value = {
|
|
98
|
+
x: event.clientX,
|
|
99
|
+
y: event.clientY
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.update(event.target as HTMLElement)
|
|
103
|
+
},
|
|
104
|
+
onMouseup: (event: MouseEvent) => this.reset(event.target as HTMLElement),
|
|
105
|
+
onMousemove: (event: MouseEvent) => {
|
|
106
|
+
this.mouseMove.value = {
|
|
107
|
+
x: event.clientX,
|
|
108
|
+
y: event.clientY
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.updateMove(event.target as HTMLElement)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Gets the target element for touch events.
|
|
117
|
+
*
|
|
118
|
+
* Получает целевой элемент для событий касания.
|
|
119
|
+
* @param target event target element/ целевой элемент события
|
|
120
|
+
*/
|
|
121
|
+
private getElement(target: HTMLElement) {
|
|
122
|
+
return this.element?.value ?? target.closest<HTMLElement>('[data-touch]')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Determines horizontal direction type from client X coordinate.
|
|
127
|
+
*
|
|
128
|
+
* Определяет тип горизонтального направления из координаты X.
|
|
129
|
+
* @param clientX horizontal coordinate/ горизонтальная координата
|
|
130
|
+
*/
|
|
131
|
+
private getTypeX(clientX: number): TouchEventTypeX {
|
|
132
|
+
if (clientX >= MAX_MOVE) {
|
|
133
|
+
return 'right'
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (clientX < -MAX_MOVE) {
|
|
137
|
+
return 'left'
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return 'none'
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Determines vertical direction type from client Y coordinate.
|
|
145
|
+
*
|
|
146
|
+
* Определяет тип вертикального направления из координаты Y.
|
|
147
|
+
* @param clientY vertical coordinate/ вертикальная координата
|
|
148
|
+
*/
|
|
149
|
+
private getTypeY(clientY: number): TouchEventTypeY {
|
|
150
|
+
if (clientY >= MAX_MOVE) {
|
|
151
|
+
return 'bottom'
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (clientY < -MAX_MOVE) {
|
|
155
|
+
return 'top'
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return 'none'
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Executes callback with calculated movement data.
|
|
163
|
+
*
|
|
164
|
+
* Выполняет колбэк с рассчитанными данными движения.
|
|
165
|
+
* @param callback callback function/ функция обратного вызова
|
|
166
|
+
*/
|
|
167
|
+
private async callback(callback?: TouchEventCallback): Promise<TouchEventClient | undefined> {
|
|
168
|
+
const toucheValue = this.mouse.value
|
|
169
|
+
const toucheMoveValue = this.mouseMove.value
|
|
170
|
+
|
|
171
|
+
if (
|
|
172
|
+
toucheValue
|
|
173
|
+
&& toucheMoveValue
|
|
174
|
+
) {
|
|
175
|
+
const x = toucheMoveValue.x - toucheValue.x
|
|
176
|
+
const y = toucheMoveValue.y - toucheValue.y
|
|
177
|
+
|
|
178
|
+
if (
|
|
179
|
+
!callback
|
|
180
|
+
|| await executePromise(callback(
|
|
181
|
+
this.getTypeX(x),
|
|
182
|
+
this.getTypeY(y),
|
|
183
|
+
x,
|
|
184
|
+
y,
|
|
185
|
+
toucheValue,
|
|
186
|
+
toucheMoveValue,
|
|
187
|
+
this.touche.value,
|
|
188
|
+
this.toucheMove.value
|
|
189
|
+
))
|
|
190
|
+
) {
|
|
191
|
+
return {
|
|
192
|
+
x,
|
|
193
|
+
y
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return undefined
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Resets touch/mouse state and CSS properties after interaction ends.
|
|
203
|
+
*
|
|
204
|
+
* Сбрасывает состояние касания/мыши и CSS свойства после завершения взаимодействия.
|
|
205
|
+
* @param target selected item/ выбранный элемент
|
|
206
|
+
*/
|
|
207
|
+
private reset(target: HTMLElement) {
|
|
208
|
+
const elementValue = this.getElement(target)
|
|
209
|
+
|
|
210
|
+
this
|
|
211
|
+
.callback(this.end)
|
|
212
|
+
.then((client) => {
|
|
213
|
+
if (elementValue) {
|
|
214
|
+
if (client) {
|
|
215
|
+
this.resetData(elementValue)
|
|
216
|
+
} else {
|
|
217
|
+
setTimeout(() => this.resetData(elementValue), 400)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Resets all touch/mouse state and removes CSS custom properties.
|
|
225
|
+
*
|
|
226
|
+
* Сбрасывает все состояния касания/мыши и удаляет CSS кастомные свойства.
|
|
227
|
+
* @param elementValue target element/ целевой элемент
|
|
228
|
+
*/
|
|
229
|
+
private resetData(elementValue: HTMLElement) {
|
|
230
|
+
this.touche.value = undefined
|
|
231
|
+
this.toucheMove.value = undefined
|
|
232
|
+
|
|
233
|
+
this.mouse.value = undefined
|
|
234
|
+
this.mouseMove.value = undefined
|
|
235
|
+
|
|
236
|
+
elementValue.style.removeProperty('--sys-touch-start-x')
|
|
237
|
+
elementValue.style.removeProperty('--sys-touch-start-y')
|
|
238
|
+
elementValue.style.removeProperty('--sys-touch-move-x')
|
|
239
|
+
elementValue.style.removeProperty('--sys-touch-move-y')
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Updates initial touch/mouse position and sets CSS custom properties.
|
|
244
|
+
*
|
|
245
|
+
* Обновляет начальную позицию касания/мыши и устанавливает CSS кастомные свойства.
|
|
246
|
+
* @param target selected item/ выбранный элемент
|
|
247
|
+
*/
|
|
248
|
+
private update(target: HTMLElement) {
|
|
249
|
+
const elementValue = this.getElement(target)
|
|
250
|
+
const toucheValue = this.mouse.value
|
|
251
|
+
|
|
252
|
+
if (
|
|
253
|
+
elementValue
|
|
254
|
+
&& toucheValue
|
|
255
|
+
) {
|
|
256
|
+
elementValue.style.setProperty('--sys-touch-start-x', `${toucheValue.x}px`)
|
|
257
|
+
elementValue.style.setProperty('--sys-touch-start-y', `${toucheValue.y}px`)
|
|
258
|
+
|
|
259
|
+
executePromise(this.start?.(toucheValue, this.touche.value)).then()
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Updates touch/mouse position during movement and sets CSS custom properties.
|
|
265
|
+
*
|
|
266
|
+
* Обновляет позицию касания/мыши во время движения и устанавливает CSS кастомные свойства.
|
|
267
|
+
* @param target selected item/ выбранный элемент
|
|
268
|
+
*/
|
|
269
|
+
private updateMove(target: HTMLElement) {
|
|
270
|
+
const elementValue = this.getElement(target)
|
|
271
|
+
|
|
272
|
+
this
|
|
273
|
+
.callback(this.move)
|
|
274
|
+
.then((client) => {
|
|
275
|
+
if (
|
|
276
|
+
elementValue
|
|
277
|
+
&& client
|
|
278
|
+
) {
|
|
279
|
+
elementValue.style.setProperty('--sys-touch-move-x', `${client.x}px`)
|
|
280
|
+
elementValue.style.setProperty('--sys-touch-move-y', `${client.y}px`)
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
}
|