@dxtmisha/constructor 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/package.json +124 -0
- package/src/classes/CaptionInclude.ts +71 -0
- package/src/classes/DescriptionInclude.ts +70 -0
- package/src/classes/EnabledInclude.ts +56 -0
- package/src/classes/EventClickInclude.ts +138 -0
- package/src/classes/LabelHighlightInclude.ts +90 -0
- package/src/classes/LabelInclude.ts +171 -0
- package/src/classes/LabelNumberInclude.ts +70 -0
- package/src/classes/ModelInclude.ts +49 -0
- package/src/classes/PrefixInclude.ts +71 -0
- package/src/classes/SuffixInclude.ts +71 -0
- package/src/classes/field/FieldAttributesInclude.ts +100 -0
- package/src/classes/field/FieldChangeInclude.ts +52 -0
- package/src/classes/field/FieldCodeInclude.ts +69 -0
- package/src/classes/field/FieldElementInclude.ts +97 -0
- package/src/classes/field/FieldInputCheckInclude.ts +128 -0
- package/src/classes/field/FieldMatchInclude.ts +101 -0
- package/src/classes/field/FieldPatternInclude.ts +42 -0
- package/src/classes/field/FieldTypeInclude.ts +42 -0
- package/src/classes/field/FieldValidationInclude.ts +196 -0
- package/src/classes/field/FieldValueInclude.ts +318 -0
- package/src/classes/field/FieldVisibilityInclude.ts +21 -0
- package/src/constructors/Badge/Badge.ts +73 -0
- package/src/constructors/Badge/BadgeDesign.tsx +127 -0
- package/src/constructors/Badge/BadgeInclude.ts +78 -0
- package/src/constructors/Badge/basicTypes.ts +15 -0
- package/src/constructors/Badge/index.ts +5 -0
- package/src/constructors/Badge/properties.json +36 -0
- package/src/constructors/Badge/props.ts +43 -0
- package/src/constructors/Badge/style.scss +83 -0
- package/src/constructors/Badge/types.ts +47 -0
- package/src/constructors/Bars/Bars.ts +188 -0
- package/src/constructors/Bars/BarsAction.ts +57 -0
- package/src/constructors/Bars/BarsDesign.tsx +229 -0
- package/src/constructors/Bars/BarsInclude.ts +116 -0
- package/src/constructors/Bars/basicTypes.ts +40 -0
- package/src/constructors/Bars/index.ts +6 -0
- package/src/constructors/Bars/properties.json +6 -0
- package/src/constructors/Bars/props.ts +63 -0
- package/src/constructors/Bars/style.scss +18 -0
- package/src/constructors/Bars/types.ts +58 -0
- package/src/constructors/Button/Button.ts +88 -0
- package/src/constructors/Button/ButtonDesign.tsx +136 -0
- package/src/constructors/Button/ButtonInclude.ts +80 -0
- package/src/constructors/Button/basicTypes.ts +12 -0
- package/src/constructors/Button/index.ts +5 -0
- package/src/constructors/Button/properties.json +84 -0
- package/src/constructors/Button/props.ts +55 -0
- package/src/constructors/Button/style.scss +96 -0
- package/src/constructors/Button/types.ts +56 -0
- package/src/constructors/Cell/Cell.ts +127 -0
- package/src/constructors/Cell/CellDesign.tsx +203 -0
- package/src/constructors/Cell/basicTypes.ts +6 -0
- package/src/constructors/Cell/index.ts +5 -0
- package/src/constructors/Cell/properties.json +52 -0
- package/src/constructors/Cell/props.ts +61 -0
- package/src/constructors/Cell/style.scss +80 -0
- package/src/constructors/Cell/types.ts +68 -0
- package/src/constructors/Chip/Chip.ts +33 -0
- package/src/constructors/Chip/ChipDesign.tsx +26 -0
- package/src/constructors/Chip/basicTypes.ts +0 -0
- package/src/constructors/Chip/index.ts +4 -0
- package/src/constructors/Chip/properties.json +3 -0
- package/src/constructors/Chip/props.ts +44 -0
- package/src/constructors/Chip/style.scss +6 -0
- package/src/constructors/Chip/types.ts +53 -0
- package/src/constructors/Field/Field.ts +147 -0
- package/src/constructors/Field/FieldDesign.tsx +372 -0
- package/src/constructors/Field/FieldIcons.ts +99 -0
- package/src/constructors/Field/FieldInclude.ts +72 -0
- package/src/constructors/Field/FieldSize.ts +93 -0
- package/src/constructors/Field/basicTypes.ts +90 -0
- package/src/constructors/Field/index.ts +5 -0
- package/src/constructors/Field/properties.json +86 -0
- package/src/constructors/Field/props.ts +88 -0
- package/src/constructors/Field/style.scss +556 -0
- package/src/constructors/Field/types.ts +78 -0
- package/src/constructors/FieldCounter/FieldCounter.ts +75 -0
- package/src/constructors/FieldCounter/FieldCounterDesign.tsx +122 -0
- package/src/constructors/FieldCounter/FieldCounterInclude.ts +98 -0
- package/src/constructors/FieldCounter/basicTypes.ts +25 -0
- package/src/constructors/FieldCounter/index.ts +6 -0
- package/src/constructors/FieldCounter/properties.json +3 -0
- package/src/constructors/FieldCounter/props.ts +32 -0
- package/src/constructors/FieldCounter/style.scss +4 -0
- package/src/constructors/FieldCounter/types.ts +42 -0
- package/src/constructors/FieldLabel/FieldLabel.ts +93 -0
- package/src/constructors/FieldLabel/FieldLabelDesign.tsx +156 -0
- package/src/constructors/FieldLabel/FieldLabelInclude.ts +91 -0
- package/src/constructors/FieldLabel/basicTypes.ts +34 -0
- package/src/constructors/FieldLabel/index.ts +6 -0
- package/src/constructors/FieldLabel/properties.json +4 -0
- package/src/constructors/FieldLabel/props.ts +40 -0
- package/src/constructors/FieldLabel/style.scss +10 -0
- package/src/constructors/FieldLabel/types.ts +49 -0
- package/src/constructors/FieldMessage/FieldMessage.ts +79 -0
- package/src/constructors/FieldMessage/FieldMessageDesign.tsx +159 -0
- package/src/constructors/FieldMessage/FieldMessageInclude.ts +105 -0
- package/src/constructors/FieldMessage/FieldMessageMessage.ts +54 -0
- package/src/constructors/FieldMessage/basicTypes.ts +27 -0
- package/src/constructors/FieldMessage/index.ts +6 -0
- package/src/constructors/FieldMessage/properties.json +9 -0
- package/src/constructors/FieldMessage/props.ts +40 -0
- package/src/constructors/FieldMessage/style.scss +13 -0
- package/src/constructors/FieldMessage/types.ts +49 -0
- package/src/constructors/Icon/Icon.ts +105 -0
- package/src/constructors/Icon/IconDesign.tsx +157 -0
- package/src/constructors/Icon/IconInclude.ts +64 -0
- package/src/constructors/Icon/IconLiteInclude.ts +121 -0
- package/src/constructors/Icon/IconTrailingInclude.ts +106 -0
- package/src/constructors/Icon/basicTypes.ts +50 -0
- package/src/constructors/Icon/index.ts +8 -0
- package/src/constructors/Icon/properties.json +25 -0
- package/src/constructors/Icon/props.ts +54 -0
- package/src/constructors/Icon/style.scss +106 -0
- package/src/constructors/Icon/types.ts +46 -0
- package/src/constructors/Image/Image.ts +184 -0
- package/src/constructors/Image/ImageAdaptiveGroup.ts +230 -0
- package/src/constructors/Image/ImageAdaptiveItem.ts +295 -0
- package/src/constructors/Image/ImageBackground.ts +127 -0
- package/src/constructors/Image/ImageCalculation.ts +184 -0
- package/src/constructors/Image/ImageCalculationList.ts +61 -0
- package/src/constructors/Image/ImageCoordinator.ts +104 -0
- package/src/constructors/Image/ImageData.ts +99 -0
- package/src/constructors/Image/ImageDesign.tsx +137 -0
- package/src/constructors/Image/ImageFile.ts +137 -0
- package/src/constructors/Image/ImageInclude.ts +53 -0
- package/src/constructors/Image/ImagePdf.ts +44 -0
- package/src/constructors/Image/ImagePosition.ts +49 -0
- package/src/constructors/Image/ImageType.ts +83 -0
- package/src/constructors/Image/basicTypes.ts +70 -0
- package/src/constructors/Image/index.ts +5 -0
- package/src/constructors/Image/properties.json +17 -0
- package/src/constructors/Image/props.ts +66 -0
- package/src/constructors/Image/style.scss +77 -0
- package/src/constructors/Image/types.ts +49 -0
- package/src/constructors/List/List.ts +267 -0
- package/src/constructors/List/ListControl.ts +194 -0
- package/src/constructors/List/ListDesign.tsx +382 -0
- package/src/constructors/List/ListFocus.ts +196 -0
- package/src/constructors/List/ListGo.ts +283 -0
- package/src/constructors/List/ListSearch.ts +113 -0
- package/src/constructors/List/basicTypes.ts +3 -0
- package/src/constructors/List/index.ts +5 -0
- package/src/constructors/List/properties.json +16 -0
- package/src/constructors/List/props.ts +76 -0
- package/src/constructors/List/style.scss +36 -0
- package/src/constructors/List/types.ts +66 -0
- package/src/constructors/ListGroup/ListGroup.ts +53 -0
- package/src/constructors/ListGroup/ListGroupDesign.tsx +180 -0
- package/src/constructors/ListGroup/ListGroupOpen.ts +56 -0
- package/src/constructors/ListGroup/basicTypes.ts +3 -0
- package/src/constructors/ListGroup/index.ts +5 -0
- package/src/constructors/ListGroup/properties.json +15 -0
- package/src/constructors/ListGroup/props.ts +30 -0
- package/src/constructors/ListGroup/style.scss +18 -0
- package/src/constructors/ListGroup/types.ts +51 -0
- package/src/constructors/ListItem/ListItem.ts +115 -0
- package/src/constructors/ListItem/ListItemDesign.tsx +196 -0
- package/src/constructors/ListItem/basicTypes.ts +3 -0
- package/src/constructors/ListItem/index.ts +5 -0
- package/src/constructors/ListItem/properties.json +52 -0
- package/src/constructors/ListItem/props.ts +78 -0
- package/src/constructors/ListItem/style.scss +152 -0
- package/src/constructors/ListItem/types.ts +78 -0
- package/src/constructors/ListMenu/ListMenu.ts +52 -0
- package/src/constructors/ListMenu/ListMenuDesign.tsx +127 -0
- package/src/constructors/ListMenu/basicTypes.ts +3 -0
- package/src/constructors/ListMenu/index.ts +5 -0
- package/src/constructors/ListMenu/properties.json +19 -0
- package/src/constructors/ListMenu/props.ts +34 -0
- package/src/constructors/ListMenu/style.scss +5 -0
- package/src/constructors/ListMenu/types.ts +54 -0
- package/src/constructors/Mask/Mask.ts +321 -0
- package/src/constructors/Mask/MaskBuffer.ts +89 -0
- package/src/constructors/Mask/MaskCharacter.ts +192 -0
- package/src/constructors/Mask/MaskCharacterLength.ts +40 -0
- package/src/constructors/Mask/MaskData.ts +287 -0
- package/src/constructors/Mask/MaskDate.ts +157 -0
- package/src/constructors/Mask/MaskDesign.tsx +217 -0
- package/src/constructors/Mask/MaskEmit.ts +140 -0
- package/src/constructors/Mask/MaskEvent.ts +347 -0
- package/src/constructors/Mask/MaskFocus.ts +49 -0
- package/src/constructors/Mask/MaskFormat.ts +216 -0
- package/src/constructors/Mask/MaskItem.ts +218 -0
- package/src/constructors/Mask/MaskMatch.ts +73 -0
- package/src/constructors/Mask/MaskPattern.ts +123 -0
- package/src/constructors/Mask/MaskRight.ts +43 -0
- package/src/constructors/Mask/MaskRubber.ts +156 -0
- package/src/constructors/Mask/MaskRubberItem.ts +96 -0
- package/src/constructors/Mask/MaskRubberTransition.ts +50 -0
- package/src/constructors/Mask/MaskSelection.ts +208 -0
- package/src/constructors/Mask/MaskSpecial.ts +179 -0
- package/src/constructors/Mask/MaskType.ts +103 -0
- package/src/constructors/Mask/MaskValidation.ts +102 -0
- package/src/constructors/Mask/MaskValue.ts +225 -0
- package/src/constructors/Mask/MaskValueBasic.ts +87 -0
- package/src/constructors/Mask/MaskView.ts +169 -0
- package/src/constructors/Mask/basicTypes.ts +49 -0
- package/src/constructors/Mask/index.ts +5 -0
- package/src/constructors/Mask/properties.json +29 -0
- package/src/constructors/Mask/props.ts +70 -0
- package/src/constructors/Mask/style.scss +104 -0
- package/src/constructors/Mask/types.ts +71 -0
- package/src/constructors/Menu/Menu.ts +179 -0
- package/src/constructors/Menu/MenuDesign.tsx +244 -0
- package/src/constructors/Menu/MenuInclude.ts +110 -0
- package/src/constructors/Menu/MenuRequest.ts +101 -0
- package/src/constructors/Menu/MenuSearch.ts +49 -0
- package/src/constructors/Menu/MenuValue.ts +73 -0
- package/src/constructors/Menu/MenuWindow.ts +89 -0
- package/src/constructors/Menu/basicTypes.ts +41 -0
- package/src/constructors/Menu/index.ts +6 -0
- package/src/constructors/Menu/properties.json +17 -0
- package/src/constructors/Menu/props.ts +79 -0
- package/src/constructors/Menu/style.scss +17 -0
- package/src/constructors/Menu/types.ts +79 -0
- package/src/constructors/MotionTransform/MotionTransform.ts +87 -0
- package/src/constructors/MotionTransform/MotionTransformClassesInclude.ts +38 -0
- package/src/constructors/MotionTransform/MotionTransformDesign.tsx +242 -0
- package/src/constructors/MotionTransform/MotionTransformElement.ts +220 -0
- package/src/constructors/MotionTransform/MotionTransformEvent.ts +118 -0
- package/src/constructors/MotionTransform/MotionTransformGo.ts +47 -0
- package/src/constructors/MotionTransform/MotionTransformInclude.ts +123 -0
- package/src/constructors/MotionTransform/MotionTransformSize.ts +97 -0
- package/src/constructors/MotionTransform/MotionTransformState.ts +250 -0
- package/src/constructors/MotionTransform/basicTypes.ts +121 -0
- package/src/constructors/MotionTransform/index.ts +7 -0
- package/src/constructors/MotionTransform/properties.json +35 -0
- package/src/constructors/MotionTransform/props.ts +50 -0
- package/src/constructors/MotionTransform/style.scss +180 -0
- package/src/constructors/MotionTransform/types.ts +86 -0
- package/src/constructors/Progress/Progress.ts +184 -0
- package/src/constructors/Progress/ProgressDesign.tsx +175 -0
- package/src/constructors/Progress/ProgressInclude.ts +67 -0
- package/src/constructors/Progress/basicTypes.ts +12 -0
- package/src/constructors/Progress/index.ts +6 -0
- package/src/constructors/Progress/properties.json +47 -0
- package/src/constructors/Progress/props.ts +54 -0
- package/src/constructors/Progress/style.scss +374 -0
- package/src/constructors/Progress/types.ts +43 -0
- package/src/constructors/Ripple/Ripple.ts +46 -0
- package/src/constructors/Ripple/RippleDesign.tsx +112 -0
- package/src/constructors/Ripple/RippleInclude.ts +39 -0
- package/src/constructors/Ripple/RippleItem.ts +62 -0
- package/src/constructors/Ripple/basicTypes.ts +3 -0
- package/src/constructors/Ripple/index.ts +6 -0
- package/src/constructors/Ripple/properties.json +9 -0
- package/src/constructors/Ripple/props.ts +28 -0
- package/src/constructors/Ripple/style.scss +62 -0
- package/src/constructors/Ripple/types.ts +41 -0
- package/src/constructors/Scrollbar/Scrollbar.ts +66 -0
- package/src/constructors/Scrollbar/ScrollbarBorder.ts +243 -0
- package/src/constructors/Scrollbar/ScrollbarDesign.tsx +126 -0
- package/src/constructors/Scrollbar/ScrollbarInclude.ts +80 -0
- package/src/constructors/Scrollbar/basicTypes.ts +42 -0
- package/src/constructors/Scrollbar/index.ts +5 -0
- package/src/constructors/Scrollbar/properties.json +33 -0
- package/src/constructors/Scrollbar/props.ts +37 -0
- package/src/constructors/Scrollbar/style.scss +117 -0
- package/src/constructors/Scrollbar/types.ts +52 -0
- package/src/constructors/Skeleton/Skeleton.ts +86 -0
- package/src/constructors/Skeleton/SkeletonDesign.tsx +117 -0
- package/src/constructors/Skeleton/SkeletonInclude.ts +61 -0
- package/src/constructors/Skeleton/basicTypes.ts +16 -0
- package/src/constructors/Skeleton/const.ts +1 -0
- package/src/constructors/Skeleton/index.ts +6 -0
- package/src/constructors/Skeleton/properties.json +24 -0
- package/src/constructors/Skeleton/props.ts +28 -0
- package/src/constructors/Skeleton/style.scss +112 -0
- package/src/constructors/Skeleton/types.ts +46 -0
- package/src/constructors/Window/Window.ts +212 -0
- package/src/constructors/Window/WindowClasses.ts +180 -0
- package/src/constructors/Window/WindowClassesInclude.ts +39 -0
- package/src/constructors/Window/WindowClient.ts +93 -0
- package/src/constructors/Window/WindowCoordinates.ts +257 -0
- package/src/constructors/Window/WindowDesign.tsx +278 -0
- package/src/constructors/Window/WindowElement.ts +84 -0
- package/src/constructors/Window/WindowEmit.ts +52 -0
- package/src/constructors/Window/WindowEvent.ts +157 -0
- package/src/constructors/Window/WindowFlash.ts +70 -0
- package/src/constructors/Window/WindowHook.ts +110 -0
- package/src/constructors/Window/WindowInclude.ts +134 -0
- package/src/constructors/Window/WindowOpen.ts +292 -0
- package/src/constructors/Window/WindowOrigin.ts +85 -0
- package/src/constructors/Window/WindowPersistent.ts +89 -0
- package/src/constructors/Window/WindowPosition.ts +358 -0
- package/src/constructors/Window/WindowStatic.ts +102 -0
- package/src/constructors/Window/WindowStatus.ts +138 -0
- package/src/constructors/Window/WindowStyles.ts +78 -0
- package/src/constructors/Window/WindowVerification.ts +287 -0
- package/src/constructors/Window/basicTypes.ts +186 -0
- package/src/constructors/Window/index.ts +7 -0
- package/src/constructors/Window/properties.json +236 -0
- package/src/constructors/Window/props.ts +88 -0
- package/src/constructors/Window/style.scss +262 -0
- package/src/constructors/Window/types.ts +124 -0
- package/src/functions/getClassTegAStatic.ts +8 -0
- package/src/library.ts +36 -0
- package/src/types/captionTypes.ts +15 -0
- package/src/types/descriptionTypes.ts +15 -0
- package/src/types/enabledTypes.ts +9 -0
- package/src/types/eventClickTypes.ts +51 -0
- package/src/types/fieldTypes.ts +282 -0
- package/src/types/labelTypes.ts +30 -0
- package/src/types/modelTypes.ts +23 -0
- package/src/types/prefixTypes.ts +15 -0
- package/src/types/suffixTypes.ts +15 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { computed, type Ref } from 'vue'
|
|
2
|
+
import { getElementId } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import type { MotionTransformClassList, MotionTransformStyle } from './basicTypes'
|
|
5
|
+
import type { MotionTransformProps } from './props'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Class for working with elements and classes.
|
|
9
|
+
*
|
|
10
|
+
* Класс для работы с элементами и классами.
|
|
11
|
+
*/
|
|
12
|
+
export class MotionTransformElement {
|
|
13
|
+
readonly classes: MotionTransformClassList
|
|
14
|
+
readonly style: MotionTransformStyle
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param props input data/ входные данные
|
|
19
|
+
* @param element window element/ элемент окна
|
|
20
|
+
* @param elementContext substrate element/ элемент подложка
|
|
21
|
+
* @param className class name/ название класса
|
|
22
|
+
*/
|
|
23
|
+
constructor(
|
|
24
|
+
protected readonly props: MotionTransformProps,
|
|
25
|
+
readonly element: Ref<HTMLDivElement | undefined>,
|
|
26
|
+
protected readonly elementContext: Ref<HTMLDivElement | undefined>,
|
|
27
|
+
protected readonly className: string
|
|
28
|
+
) {
|
|
29
|
+
this.classes = MotionTransformElement.getClassesList(className)
|
|
30
|
+
|
|
31
|
+
this.style = {
|
|
32
|
+
top: `--${this.className}-sys-top`,
|
|
33
|
+
left: `--${this.className}-sys-left`,
|
|
34
|
+
height: `--${this.className}-sys-height`,
|
|
35
|
+
scale: `--${this.className}-sys-scale`,
|
|
36
|
+
|
|
37
|
+
contextWidth: `--${this.className}-sys-context-width`,
|
|
38
|
+
contextHeight: `--${this.className}-sys-context-height`,
|
|
39
|
+
|
|
40
|
+
headWidth: `--${this.className}-sys-head-width`,
|
|
41
|
+
headHeight: `--${this.className}-sys-head-height`,
|
|
42
|
+
headScale: `--${this.className}-sys-head-scale`,
|
|
43
|
+
|
|
44
|
+
bodyHeight: `--${this.className}-sys-body-height`
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Checks if the element exists/ Проверяет, есть ли элемент */
|
|
49
|
+
readonly is = computed<boolean>(() => Boolean(this.element.value))
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks if the click event is prohibited.
|
|
53
|
+
*
|
|
54
|
+
* Проверяет, запрещено ли событие клика.
|
|
55
|
+
* @param target selected element/ выбранный элемент
|
|
56
|
+
*/
|
|
57
|
+
isClick(target: HTMLElement): boolean {
|
|
58
|
+
return Boolean(
|
|
59
|
+
target.closest<HTMLElement>(`.${this.classes.click}`)
|
|
60
|
+
|| !target.closest<HTMLElement>(`.${this.classes.none}`)
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Checks if the click event is prohibited in the global area.
|
|
66
|
+
*
|
|
67
|
+
* Проверяет, запрещено ли событие клика в глобальной области.
|
|
68
|
+
* @param target selected element/ выбранный элемент
|
|
69
|
+
*/
|
|
70
|
+
isClickGlobal(target: HTMLElement): boolean {
|
|
71
|
+
return !target.closest<HTMLElement>(`.${this.classes.noneGlobal}`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Checks if the window needs to be closed on click.
|
|
76
|
+
*
|
|
77
|
+
* Проверяет, нужно ли закрыть окно при клике.
|
|
78
|
+
* @param target selected element/ выбранный элемент
|
|
79
|
+
*/
|
|
80
|
+
isClose(target: HTMLElement): boolean {
|
|
81
|
+
return Boolean(target.closest<HTMLElement>(`${this.getId()} .${this.classes.close}`))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Checks if the element is outside the body.
|
|
86
|
+
*
|
|
87
|
+
* Проверяет, является ли элемент за предел тела.
|
|
88
|
+
* @param target selected element/ выбранный элемент
|
|
89
|
+
*/
|
|
90
|
+
isOutside(target: HTMLElement): boolean {
|
|
91
|
+
return !target.closest(this.getId())
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Checks if the element needs to be ignored.
|
|
96
|
+
*
|
|
97
|
+
* Проверяет, нужно ли игнорировать элемент.
|
|
98
|
+
* @param target selected element/ выбранный элемент
|
|
99
|
+
*/
|
|
100
|
+
isIgnore(target: HTMLElement): boolean {
|
|
101
|
+
return !(this.props.ignore && target.closest(getElementId(this.props.ignore, '')))
|
|
102
|
+
&& !(this.props.ignoreSelector && target.closest(this.props.ignoreSelector))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Is the animation for slide changes enabled.
|
|
107
|
+
*
|
|
108
|
+
* Включено ли анимация на изменения слайда.
|
|
109
|
+
*/
|
|
110
|
+
isAnimation(): boolean {
|
|
111
|
+
return Boolean(
|
|
112
|
+
this.elementContext.value
|
|
113
|
+
&& this.props.animationShow
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Is window mode enabled.
|
|
119
|
+
*
|
|
120
|
+
* Включен ли режим окна.
|
|
121
|
+
*/
|
|
122
|
+
isWindow(): boolean {
|
|
123
|
+
return Boolean(
|
|
124
|
+
this.element.value
|
|
125
|
+
&& getComputedStyle(this.element.value).content === '"--WINDOW--"'
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Checks whether the title needs to be left.
|
|
131
|
+
*
|
|
132
|
+
* Проверяет, надо ли оставить заголовок.
|
|
133
|
+
*/
|
|
134
|
+
isSection(): boolean {
|
|
135
|
+
return Boolean(this.props.section)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Returns the main element.
|
|
140
|
+
*
|
|
141
|
+
* Возвращает главного элемента.
|
|
142
|
+
*/
|
|
143
|
+
getElement(): HTMLDivElement | undefined {
|
|
144
|
+
return this.element.value
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns the context element.
|
|
149
|
+
*
|
|
150
|
+
* Возвращает элемент контекста.
|
|
151
|
+
*/
|
|
152
|
+
getElementContext(): HTMLDivElement | undefined {
|
|
153
|
+
return this.elementContext.value
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns the title element.
|
|
158
|
+
*
|
|
159
|
+
* Возвращает элемент заголовка.
|
|
160
|
+
*/
|
|
161
|
+
getElementHead(): HTMLDivElement | undefined {
|
|
162
|
+
return this.getElement()?.querySelector<HTMLDivElement>(`.${this.className}__head`) || undefined
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Returns the body element.
|
|
167
|
+
*
|
|
168
|
+
* Возвращает элемент тела.
|
|
169
|
+
*/
|
|
170
|
+
getElementBody(): HTMLDivElement | undefined {
|
|
171
|
+
return this.getElement()?.querySelector<HTMLDivElement>(`.${this.className}__body`) || undefined
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Returns the identifier.
|
|
176
|
+
*
|
|
177
|
+
* Возвращает идентификатор.
|
|
178
|
+
*/
|
|
179
|
+
getId(): string {
|
|
180
|
+
return `#${getElementId(this.element.value)}`
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Returns the sizes of elements.
|
|
185
|
+
*
|
|
186
|
+
* Возвращает размеры элементов.
|
|
187
|
+
*/
|
|
188
|
+
getRect(): DOMRect | undefined {
|
|
189
|
+
return this.getElementContext()?.getBoundingClientRect()
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns the list of available classes.
|
|
194
|
+
*
|
|
195
|
+
* Возвращает список доступных классов.
|
|
196
|
+
* @param className class name/ название класса
|
|
197
|
+
*/
|
|
198
|
+
static getClassesList(className: string): MotionTransformClassList {
|
|
199
|
+
return {
|
|
200
|
+
show: `${className}--show`,
|
|
201
|
+
open: `${className}--open`,
|
|
202
|
+
window: `${className}--window`,
|
|
203
|
+
|
|
204
|
+
click: `${className}--click`,
|
|
205
|
+
close: `${className}--close`,
|
|
206
|
+
none: `${className}--none`,
|
|
207
|
+
noneGlobal: `${className}--noneGlobal`
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns a list of available classes by design name.
|
|
213
|
+
*
|
|
214
|
+
* Возвращает список доступных классов по названию дизайна.
|
|
215
|
+
* @param design design name/ названия дизайна
|
|
216
|
+
*/
|
|
217
|
+
static getClassesListByDesign(design: string) {
|
|
218
|
+
return this.getClassesList(`${design}-motionTransform`)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { watch } from 'vue'
|
|
2
|
+
import { type ConstrEmit, EventItem } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import { MotionTransformElement } from './MotionTransformElement'
|
|
5
|
+
import { MotionTransformState } from './MotionTransformState'
|
|
6
|
+
|
|
7
|
+
import type { MotionTransformEmitOptions } from './basicTypes'
|
|
8
|
+
import type { MotionTransformEmits } from './types'
|
|
9
|
+
import type { MotionTransformProps } from './props'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Class for event management.
|
|
13
|
+
*
|
|
14
|
+
* Класс для управления событиями.
|
|
15
|
+
*/
|
|
16
|
+
export class MotionTransformEvent {
|
|
17
|
+
protected readonly item: EventItem<HTMLElement, PointerEvent>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Constructor.
|
|
21
|
+
*
|
|
22
|
+
* Конструктор.
|
|
23
|
+
* @param props input data/ входные данные
|
|
24
|
+
* @param element class object for managing an element/ объект класса для управления элементом
|
|
25
|
+
* @param state class object for status management/ объект класса для управления статусом
|
|
26
|
+
* @param emits the function is called when an event is triggered/ функция вызывается, когда срабатывает событие
|
|
27
|
+
*/
|
|
28
|
+
constructor(
|
|
29
|
+
protected readonly props: MotionTransformProps,
|
|
30
|
+
protected readonly element: MotionTransformElement,
|
|
31
|
+
protected readonly state: MotionTransformState,
|
|
32
|
+
protected readonly emits?: ConstrEmit<MotionTransformEmits>
|
|
33
|
+
) {
|
|
34
|
+
this.item = new EventItem(document.body, 'click', this.listener)
|
|
35
|
+
|
|
36
|
+
watch(this.state.open, () => this.item.toggle(this.state.open.value))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Stopping event listening.
|
|
41
|
+
*
|
|
42
|
+
* Остановка прослушивания события.
|
|
43
|
+
*/
|
|
44
|
+
stop(): this {
|
|
45
|
+
this.item.stop()
|
|
46
|
+
return this
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Click event on the title.
|
|
51
|
+
*
|
|
52
|
+
* Событие клика на заголовок.
|
|
53
|
+
* @param event event object/ объект события
|
|
54
|
+
*/
|
|
55
|
+
readonly onClick = (event: Event) => {
|
|
56
|
+
if (
|
|
57
|
+
this.props.clickOpen
|
|
58
|
+
&& this.element.isClick(event.target as HTMLElement)
|
|
59
|
+
) {
|
|
60
|
+
this.emit(event, 'head')
|
|
61
|
+
this.state.toggle()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* End of animation event.
|
|
67
|
+
*
|
|
68
|
+
* Событие окончания анимации.
|
|
69
|
+
* @param event event object/ объект события
|
|
70
|
+
*/
|
|
71
|
+
readonly onTransitionend = (event: TransitionEvent) => {
|
|
72
|
+
if (
|
|
73
|
+
this.element.getElement() === event.target
|
|
74
|
+
&& event.propertyName === 'height'
|
|
75
|
+
) {
|
|
76
|
+
this.state.reset()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Event call.
|
|
82
|
+
*
|
|
83
|
+
* Вызов события.
|
|
84
|
+
* @param event event object/ объект события
|
|
85
|
+
* @param type event type/ тип события
|
|
86
|
+
*/
|
|
87
|
+
emit(
|
|
88
|
+
event: Event | undefined,
|
|
89
|
+
type: MotionTransformEmitOptions['type']
|
|
90
|
+
): void {
|
|
91
|
+
const options: MotionTransformEmitOptions = {
|
|
92
|
+
type,
|
|
93
|
+
open: !this.state.open.value
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.emits?.('transform', event, options)
|
|
97
|
+
this.emits?.('transformLite', options)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
protected listener = (event: PointerEvent) => {
|
|
101
|
+
const target = event.target as HTMLDivElement
|
|
102
|
+
|
|
103
|
+
if (
|
|
104
|
+
this.state.open.value
|
|
105
|
+
&& this.element.isClickGlobal(target) && (
|
|
106
|
+
this.element.isClose(target)
|
|
107
|
+
|| (
|
|
108
|
+
this.props.autoClose
|
|
109
|
+
&& this.element.isOutside(target)
|
|
110
|
+
&& this.element.isIgnore(target)
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
) {
|
|
114
|
+
this.emit(event, 'body')
|
|
115
|
+
this.state.set(false)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MotionTransformState } from './MotionTransformState'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Class for managing control actions.
|
|
5
|
+
*
|
|
6
|
+
* Класс для управления действиями управления.
|
|
7
|
+
*/
|
|
8
|
+
export class MotionTransformGo {
|
|
9
|
+
/**
|
|
10
|
+
* Constructor.
|
|
11
|
+
*
|
|
12
|
+
* Конструктор.
|
|
13
|
+
* @param state class object for status management/ объект класса для управления статусом
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
protected readonly state: MotionTransformState
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Opens.
|
|
21
|
+
*
|
|
22
|
+
* Открывает.
|
|
23
|
+
*/
|
|
24
|
+
readonly open = () => this.state.set(true)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Closes.
|
|
28
|
+
*
|
|
29
|
+
* Закрывает.
|
|
30
|
+
*/
|
|
31
|
+
readonly close = () => this.state.set(false)
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Switching.
|
|
35
|
+
*
|
|
36
|
+
* Переключение.
|
|
37
|
+
*/
|
|
38
|
+
readonly toggle = () => this.state.toggle()
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* State changes.
|
|
42
|
+
*
|
|
43
|
+
* Изменение состояния.
|
|
44
|
+
* @param open opening status/ статус открытия
|
|
45
|
+
*/
|
|
46
|
+
readonly to = (open: boolean) => this.state.set(open)
|
|
47
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { computed, ref, type VNode } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
type ConstrBind,
|
|
4
|
+
DesignComponents,
|
|
5
|
+
getRef,
|
|
6
|
+
type RefOrNormal,
|
|
7
|
+
toBind,
|
|
8
|
+
type ConstrEmit
|
|
9
|
+
} from '@dxtmisha/functional'
|
|
10
|
+
|
|
11
|
+
import type { MotionTransformProps } from './props'
|
|
12
|
+
import type { MotionTransformEmits, MotionTransformExpose, MotionTransformSlots } from './types'
|
|
13
|
+
import type {
|
|
14
|
+
MotionTransformComponentInclude,
|
|
15
|
+
MotionTransformEmitOptions, MotionTransformExposeInclude,
|
|
16
|
+
MotionTransformPropsInclude
|
|
17
|
+
} from './basicTypes'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The class returns data for working with the MotionTransform component
|
|
21
|
+
*
|
|
22
|
+
* Класс возвращает данные для работы с компонентом MotionTransform
|
|
23
|
+
*/
|
|
24
|
+
export class MotionTransformInclude<
|
|
25
|
+
Props extends MotionTransformPropsInclude = MotionTransformPropsInclude,
|
|
26
|
+
PropsExtra extends ConstrBind<MotionTransformProps> = ConstrBind<MotionTransformProps>
|
|
27
|
+
> {
|
|
28
|
+
/**
|
|
29
|
+
* Constructor
|
|
30
|
+
* @param props input parameter/ входной параметр
|
|
31
|
+
* @param className class name/ название класса
|
|
32
|
+
* @param components object for working with components/ объект для работы с компонентами
|
|
33
|
+
* @param emits the function is called when an event is triggered/ функция вызывается при срабатывании события
|
|
34
|
+
* @param extra additional parameter or property name/ дополнительный параметр или имя свойства
|
|
35
|
+
* @param index index identifier/ идентификатор индекса
|
|
36
|
+
*/
|
|
37
|
+
constructor(
|
|
38
|
+
protected readonly props: Readonly<Props>,
|
|
39
|
+
protected readonly className: string,
|
|
40
|
+
protected readonly components?: DesignComponents<MotionTransformComponentInclude, Props>,
|
|
41
|
+
protected readonly emits?: ConstrEmit<MotionTransformEmits>,
|
|
42
|
+
protected readonly extra?: RefOrNormal<PropsExtra>,
|
|
43
|
+
protected readonly index?: string
|
|
44
|
+
) {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Reference to MotionTransform element expose/ Ссылка на expose элемента MotionTransform */
|
|
48
|
+
readonly element = ref<ConstrBind<MotionTransformExpose> | undefined>()
|
|
49
|
+
|
|
50
|
+
/** Computed bindings for MotionTransform/ Вычисляемые привязки для MotionTransform */
|
|
51
|
+
readonly binds = computed<PropsExtra>(() => {
|
|
52
|
+
const props = toBind<PropsExtra>(
|
|
53
|
+
getRef(this.extra) ?? {},
|
|
54
|
+
this.props.motionTransformAttrs ?? {}
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
...props,
|
|
59
|
+
|
|
60
|
+
open: this.props.open,
|
|
61
|
+
clickOpen: this.props.clickOpen,
|
|
62
|
+
autoClose: this.props.autoClose
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Expose helpers for MotionTransform state and actions/
|
|
68
|
+
* Вспомогательные методы expose для состояния и действий MotionTransform
|
|
69
|
+
*/
|
|
70
|
+
readonly expose: MotionTransformExposeInclude = {
|
|
71
|
+
open: computed(() => Boolean(this.element.value?.open)),
|
|
72
|
+
isShow: computed(() => Boolean(this.element.value?.isShow)),
|
|
73
|
+
setOpen: async (open: boolean) => this.element.value?.setOpen(open),
|
|
74
|
+
toOpen: async () => this.element.value?.toOpen(),
|
|
75
|
+
toClose: async () => this.element.value?.toClose(),
|
|
76
|
+
toggle: async () => this.element.value?.toggle(),
|
|
77
|
+
|
|
78
|
+
motionTransformElement: this.element
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Emits 'transform' event upward/
|
|
83
|
+
* Поднимает событие 'transform' наверх
|
|
84
|
+
* @param event native event/ нативное событие
|
|
85
|
+
* @param options payload/ параметры события
|
|
86
|
+
*/
|
|
87
|
+
readonly onTransform = (
|
|
88
|
+
event: Event | undefined,
|
|
89
|
+
options: MotionTransformEmitOptions
|
|
90
|
+
) => {
|
|
91
|
+
this.emits?.('transform', event, options)
|
|
92
|
+
this.emits?.('transformLite', options)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Render the MotionTransform component with slots/
|
|
97
|
+
* Рендер компонента MotionTransform со слотами
|
|
98
|
+
* @param slotsChildren slots passed to the component/ слоты, передаваемые компоненту
|
|
99
|
+
* @param attrs additional attributes/ дополнительные атрибуты
|
|
100
|
+
*/
|
|
101
|
+
readonly render = (
|
|
102
|
+
slotsChildren: MotionTransformSlots,
|
|
103
|
+
attrs?: ConstrBind<MotionTransformProps>
|
|
104
|
+
): VNode[] => {
|
|
105
|
+
if (this.components) {
|
|
106
|
+
return this.components.render(
|
|
107
|
+
'motionTransform',
|
|
108
|
+
{
|
|
109
|
+
onTransform: this.onTransform,
|
|
110
|
+
...toBind(
|
|
111
|
+
attrs ?? {},
|
|
112
|
+
this.binds.value
|
|
113
|
+
),
|
|
114
|
+
ref: this.element
|
|
115
|
+
},
|
|
116
|
+
slotsChildren as unknown as Record<string, any>,
|
|
117
|
+
this.index
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return []
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { MotionTransformElement } from './MotionTransformElement'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Class for managing size calculation.
|
|
5
|
+
*
|
|
6
|
+
* Класс для управления вычислением размера.
|
|
7
|
+
*/
|
|
8
|
+
export class MotionTransformSize {
|
|
9
|
+
/** Top offset for transform/ Верхнее смещение для трансформации */
|
|
10
|
+
top: string | null = null
|
|
11
|
+
/** Left offset for transform/ Левое смещение для трансформации */
|
|
12
|
+
left: string | null = null
|
|
13
|
+
/** Head width value/ Ширина шапки */
|
|
14
|
+
headWidth: string | null = null
|
|
15
|
+
/** Total height value/ Общая высота */
|
|
16
|
+
height: string | null = null
|
|
17
|
+
/** Scale factor/ Коэффициент масштаба */
|
|
18
|
+
scale: string | null = null
|
|
19
|
+
|
|
20
|
+
/** Context width/ Ширина контекста */
|
|
21
|
+
contextWidth: string | null = null
|
|
22
|
+
/** Context height/ Высота контекста */
|
|
23
|
+
contextHeight: string | null = null
|
|
24
|
+
|
|
25
|
+
/** Head height value/ Высота шапки */
|
|
26
|
+
headHeight: string | null = null
|
|
27
|
+
/** Head scale factor/ Коэффициент масштаба шапки */
|
|
28
|
+
headScale: string | null = null
|
|
29
|
+
|
|
30
|
+
/** Body height value/ Высота тела */
|
|
31
|
+
bodyHeight: string | null = null
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Constructor
|
|
35
|
+
* @param element class object for managing an element/ объект класса для управления элементом
|
|
36
|
+
*/
|
|
37
|
+
constructor(
|
|
38
|
+
protected element: MotionTransformElement
|
|
39
|
+
) {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Update all sizes.
|
|
44
|
+
*
|
|
45
|
+
* Обновить все размеры.
|
|
46
|
+
*/
|
|
47
|
+
update(): void {
|
|
48
|
+
const rect = this.element.getRect()
|
|
49
|
+
|
|
50
|
+
if (rect) {
|
|
51
|
+
const elementHead = this.element.getElementHead()
|
|
52
|
+
const elementBody = this.element.getElementBody()
|
|
53
|
+
|
|
54
|
+
const scale = 1 / window.innerWidth * rect.width
|
|
55
|
+
const headScale = 1 / rect.width * window.innerWidth
|
|
56
|
+
|
|
57
|
+
this.top = `${rect.top - (scale * rect.top / (scale - 1))}px`
|
|
58
|
+
this.left = `${rect.left - (scale * rect.left / (scale - 1))}px`
|
|
59
|
+
this.height = `${100 / window.innerHeight * rect.height * headScale}%`
|
|
60
|
+
this.scale = scale.toString()
|
|
61
|
+
|
|
62
|
+
this.contextWidth = `${rect.width}px`
|
|
63
|
+
this.contextHeight = `${rect.height}px`
|
|
64
|
+
|
|
65
|
+
if (elementHead) {
|
|
66
|
+
this.headWidth = `${rect.width}px`
|
|
67
|
+
this.headHeight = `${elementHead.offsetHeight ?? '0'}px`
|
|
68
|
+
this.headScale = headScale.toString()
|
|
69
|
+
|
|
70
|
+
if (elementBody) {
|
|
71
|
+
this.bodyHeight = `${elementBody.offsetHeight + (this.element.isSection() ? elementHead.offsetHeight : 0)}px`
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Restores all data to original.
|
|
79
|
+
*
|
|
80
|
+
* Восстанавливает все данные на изначальные.
|
|
81
|
+
*/
|
|
82
|
+
reset(): void {
|
|
83
|
+
this.top = null
|
|
84
|
+
this.left = null
|
|
85
|
+
this.height = null
|
|
86
|
+
this.scale = null
|
|
87
|
+
|
|
88
|
+
this.contextWidth = null
|
|
89
|
+
this.contextHeight = null
|
|
90
|
+
|
|
91
|
+
this.headWidth = null
|
|
92
|
+
this.headHeight = null
|
|
93
|
+
this.headScale = null
|
|
94
|
+
|
|
95
|
+
this.bodyHeight = null
|
|
96
|
+
}
|
|
97
|
+
}
|