@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,292 @@
|
|
|
1
|
+
import { computed, ref } from 'vue'
|
|
2
|
+
import { frame } from '@dxtmisha/functional'
|
|
3
|
+
|
|
4
|
+
import { WindowStatus } from './WindowStatus'
|
|
5
|
+
import { WindowClient } from './WindowClient'
|
|
6
|
+
import { WindowHook } from './WindowHook'
|
|
7
|
+
|
|
8
|
+
import { WindowElement } from './WindowElement'
|
|
9
|
+
|
|
10
|
+
import { WindowFlash } from './WindowFlash'
|
|
11
|
+
import { WindowCoordinates } from './WindowCoordinates'
|
|
12
|
+
import { WindowPosition } from './WindowPosition'
|
|
13
|
+
import { WindowOrigin } from './WindowOrigin'
|
|
14
|
+
import { WindowEmit } from './WindowEmit'
|
|
15
|
+
import { WindowStyles } from './WindowStyles'
|
|
16
|
+
|
|
17
|
+
import type { WindowProps } from './props'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Class for managing the status of an open window.
|
|
21
|
+
*
|
|
22
|
+
* Класс для управления статусом открытого окна.
|
|
23
|
+
*/
|
|
24
|
+
export class WindowOpen {
|
|
25
|
+
readonly item = ref<boolean>(false)
|
|
26
|
+
|
|
27
|
+
protected readonly first = ref<boolean>(false)
|
|
28
|
+
protected clicks: number = 0
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Constructor
|
|
32
|
+
* @param props input data/ входные данные
|
|
33
|
+
* @param client object for working with mouse pointer coordinates/ объект для работы с координатами указателя мыши
|
|
34
|
+
* @param hook object for working with hooks/ объект для работы с хуками
|
|
35
|
+
* @param element an object of the class for working with elements/ объект класса для работы с элементами
|
|
36
|
+
* @param status object for working with statuses/ объект для работы со статусами
|
|
37
|
+
* @param flash class object for working with fast window opening/ объект класса для работы с быстрым открытием окна
|
|
38
|
+
* @param coordinates object for working with coordinates/ объект для работы с координатами
|
|
39
|
+
* @param position object for working with the position of the element/ объект для работы с положением элемента
|
|
40
|
+
* @param origin the object for work is in the initial position upon opening/ объект для работы в начальной позиции при открытии
|
|
41
|
+
* @param emit the function is called when an event is triggered/ функция вызывается, когда срабатывает событие
|
|
42
|
+
* @param styles an object for working with the styles of an element/ объект для работы со стилями элемента
|
|
43
|
+
*/
|
|
44
|
+
constructor(
|
|
45
|
+
protected readonly props: WindowProps,
|
|
46
|
+
protected readonly client: WindowClient,
|
|
47
|
+
protected readonly hook: WindowHook,
|
|
48
|
+
protected readonly element: WindowElement,
|
|
49
|
+
protected readonly status: WindowStatus,
|
|
50
|
+
protected readonly flash: WindowFlash,
|
|
51
|
+
protected readonly coordinates: WindowCoordinates,
|
|
52
|
+
protected readonly position: WindowPosition,
|
|
53
|
+
protected readonly origin: WindowOrigin,
|
|
54
|
+
protected readonly emit: WindowEmit,
|
|
55
|
+
protected readonly styles: WindowStyles
|
|
56
|
+
) {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether the element should be kept in the DOM.
|
|
61
|
+
*
|
|
62
|
+
* Проверяет, надо ли элемент оставить в DOM.
|
|
63
|
+
*/
|
|
64
|
+
readonly inDom = computed<boolean>(() => {
|
|
65
|
+
return this.item.value
|
|
66
|
+
|| this.props.staticMode
|
|
67
|
+
|| (
|
|
68
|
+
Boolean(this.props.inDom)
|
|
69
|
+
&& this.first.value
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the window is open.
|
|
75
|
+
*
|
|
76
|
+
* Проверяет, открыто ли окно.
|
|
77
|
+
*/
|
|
78
|
+
isClicks(): boolean {
|
|
79
|
+
return this.clicks > 0
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Changes the current state.
|
|
84
|
+
*
|
|
85
|
+
* Изменяет текущее состояние.
|
|
86
|
+
* @param open the value of the current state/ значение текущего состояния
|
|
87
|
+
*/
|
|
88
|
+
readonly set = async (open?: boolean): Promise<void> => {
|
|
89
|
+
if (this.item.value !== Boolean(open)) {
|
|
90
|
+
await this.toggle()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Opens the window.
|
|
96
|
+
*
|
|
97
|
+
* Открывает окно.
|
|
98
|
+
*/
|
|
99
|
+
readonly open = async (): Promise<void> => this.set(true)
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Closes the window.
|
|
103
|
+
*
|
|
104
|
+
* Закрывает окно.
|
|
105
|
+
*/
|
|
106
|
+
readonly close = async (): Promise<void> => this.set(false)
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Switches the state, that is, opens or closes the window, depending on the value of item.
|
|
110
|
+
*
|
|
111
|
+
* Переключает состояние, то есть открывает или закрывает окно, в зависимости от значения item.
|
|
112
|
+
*/
|
|
113
|
+
readonly toggle = async (): Promise<void> => {
|
|
114
|
+
if (this.clicks > 1) {
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const toOpen = !this.item.value
|
|
119
|
+
|
|
120
|
+
if (await this.hook.before(toOpen)) {
|
|
121
|
+
if (toOpen) {
|
|
122
|
+
this.reset()
|
|
123
|
+
this.status.toDisplay()
|
|
124
|
+
|
|
125
|
+
await this.setOpen(toOpen)
|
|
126
|
+
|
|
127
|
+
requestAnimationFrame(async () => {
|
|
128
|
+
this.status.update()
|
|
129
|
+
await this.hook.preparation()
|
|
130
|
+
await this.watchPosition()
|
|
131
|
+
this.styles.updateType(true)
|
|
132
|
+
|
|
133
|
+
requestAnimationFrame(async () => {
|
|
134
|
+
this.position.updateScroll()
|
|
135
|
+
this.status.toPreparation()
|
|
136
|
+
|
|
137
|
+
requestAnimationFrame(async () => {
|
|
138
|
+
if (this.flash.isClose()) {
|
|
139
|
+
this.status.toFlash()
|
|
140
|
+
} else {
|
|
141
|
+
this.status.toOpen()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
requestAnimationFrame(() => {
|
|
145
|
+
this.hook.opening()
|
|
146
|
+
this.resetClicks()
|
|
147
|
+
})
|
|
148
|
+
this.emit.on(this.item.value)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
} else {
|
|
153
|
+
this.client.reset()
|
|
154
|
+
|
|
155
|
+
if (this.flash.isOpen()) {
|
|
156
|
+
this.toClose()
|
|
157
|
+
} else {
|
|
158
|
+
requestAnimationFrame(() => {
|
|
159
|
+
this.status.toHide()
|
|
160
|
+
this.resetClicks()
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Close handler on animation end.
|
|
169
|
+
*
|
|
170
|
+
* Обработчик закрытия по окончании анимации.
|
|
171
|
+
*/
|
|
172
|
+
closeForEvent(): void {
|
|
173
|
+
if (this.status.isHide()) {
|
|
174
|
+
this.toClose()
|
|
175
|
+
} else if (!this.status.isOpen()) {
|
|
176
|
+
this.hook.closing().then()
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Resets all data to initial values.
|
|
182
|
+
*
|
|
183
|
+
* Сбрасывает все данные к начальным значениям.
|
|
184
|
+
*/
|
|
185
|
+
reset(): this {
|
|
186
|
+
this.coordinates.reset()
|
|
187
|
+
this.origin.reset()
|
|
188
|
+
|
|
189
|
+
return this
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The method increases the number of clicks.
|
|
194
|
+
*
|
|
195
|
+
* Метод увеличивает количество кликов.
|
|
196
|
+
*/
|
|
197
|
+
pressed(): this {
|
|
198
|
+
this.clicks++
|
|
199
|
+
return this
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The method resets the number of clicks.
|
|
204
|
+
*
|
|
205
|
+
* Метод сбрасывает количество кликов.
|
|
206
|
+
*/
|
|
207
|
+
resetClicks(): this {
|
|
208
|
+
this.clicks = 0
|
|
209
|
+
return this
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The method updates the current position.
|
|
214
|
+
*
|
|
215
|
+
* Метод обновляет текущее положение.
|
|
216
|
+
*/
|
|
217
|
+
async watchPosition(): Promise<void> {
|
|
218
|
+
if (
|
|
219
|
+
this.item.value
|
|
220
|
+
&& this.element.isMain()
|
|
221
|
+
) {
|
|
222
|
+
this.position.update()
|
|
223
|
+
this.position.updateBody()
|
|
224
|
+
this.origin.update()
|
|
225
|
+
this.styles.update()
|
|
226
|
+
|
|
227
|
+
this.watchCoordinates()
|
|
228
|
+
} else {
|
|
229
|
+
this.reset()
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Changes values and triggers events.
|
|
235
|
+
*
|
|
236
|
+
* Изменяет значения и вызывает события.
|
|
237
|
+
* @param open the value of the current state/ значение текущего состояния
|
|
238
|
+
*/
|
|
239
|
+
async setOpen(open: boolean): Promise<this> {
|
|
240
|
+
this.item.value = open
|
|
241
|
+
|
|
242
|
+
if (open && !this.first.value) {
|
|
243
|
+
this.first.value = true
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Changing the location of the menu window.
|
|
251
|
+
*
|
|
252
|
+
* Изменение расположения окна меню.
|
|
253
|
+
*/
|
|
254
|
+
protected watchCoordinates(): this {
|
|
255
|
+
frame(
|
|
256
|
+
() => {
|
|
257
|
+
const element = this.element.getMain()
|
|
258
|
+
|
|
259
|
+
if (element) {
|
|
260
|
+
const isMenu = getComputedStyle(element).content === '"--MENU--"'
|
|
261
|
+
|
|
262
|
+
if (isMenu && this.position.update()) {
|
|
263
|
+
this.styles.update()
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.styles.updateType(isMenu)
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
() => this.item.value && !this.status.isHide()
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
return this
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Transition to the closing state.
|
|
277
|
+
*
|
|
278
|
+
* Переход в состояние закрытия.
|
|
279
|
+
*/
|
|
280
|
+
protected toClose(): void {
|
|
281
|
+
setTimeout(async () => {
|
|
282
|
+
await this.setOpen(false)
|
|
283
|
+
|
|
284
|
+
await this.hook.closing()
|
|
285
|
+
|
|
286
|
+
this.resetClicks()
|
|
287
|
+
this.emit.on(this.item.value)
|
|
288
|
+
}, 48)
|
|
289
|
+
|
|
290
|
+
this.status.toClose()
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { WindowClient } from './WindowClient'
|
|
2
|
+
import { WindowElement } from './WindowElement'
|
|
3
|
+
import { WindowPosition } from './WindowPosition'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Class for defining the initial position for the animation.
|
|
7
|
+
*
|
|
8
|
+
* Класс для определения начального положения для анимации.
|
|
9
|
+
*/
|
|
10
|
+
export class WindowOrigin {
|
|
11
|
+
protected x: number | null = null
|
|
12
|
+
protected y: number | null = null
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param client object for working with mouse pointer coordinates/ объект для работы с координатами указателя мыши
|
|
17
|
+
* @param element an object of the class for working with elements/ объект класса для работы с элементами
|
|
18
|
+
* @param position object for working with the position of the element/ объект для работы с положением элемента
|
|
19
|
+
*/
|
|
20
|
+
constructor(
|
|
21
|
+
protected readonly client: WindowClient,
|
|
22
|
+
protected readonly element: WindowElement,
|
|
23
|
+
protected readonly position: WindowPosition
|
|
24
|
+
) {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Returns the initial X point for the start of the animation.
|
|
29
|
+
*
|
|
30
|
+
* Возвращает начальную точку X для начала анимации.
|
|
31
|
+
*/
|
|
32
|
+
getStyleX(): string | null {
|
|
33
|
+
return this.x !== null ? `${this.x}px` : null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns the initial Y point for the start of the animation.
|
|
38
|
+
*
|
|
39
|
+
* Возвращает начальную точку Y для начала анимации.
|
|
40
|
+
*/
|
|
41
|
+
getStyleY(): string | null {
|
|
42
|
+
return this.y !== null ? `${this.y}px` : null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Updating the initial position of the element for the animation.
|
|
47
|
+
*
|
|
48
|
+
* Обновление начального положения элемента для анимации.
|
|
49
|
+
*/
|
|
50
|
+
update(): this {
|
|
51
|
+
const element = this.element.getMain()
|
|
52
|
+
|
|
53
|
+
if (!this.client.is()) {
|
|
54
|
+
this.x = 0
|
|
55
|
+
this.y = 0
|
|
56
|
+
} else if (
|
|
57
|
+
element
|
|
58
|
+
&& getComputedStyle(element).content !== '"--MENU--"'
|
|
59
|
+
) {
|
|
60
|
+
const rect = this.element.getBodyRect()
|
|
61
|
+
|
|
62
|
+
if (rect) {
|
|
63
|
+
this.x = this.client.getShiftX(rect.left)
|
|
64
|
+
this.y = this.client.getShiftY(rect.top)
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
this.x = this.client.getShiftX(this.position.getX())
|
|
68
|
+
this.y = this.client.getShiftY(this.position.getY())
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Resets all data to initial values.
|
|
76
|
+
*
|
|
77
|
+
* Сбрасывает все данные к начальным значениям.
|
|
78
|
+
*/
|
|
79
|
+
reset(): this {
|
|
80
|
+
this.x = null
|
|
81
|
+
this.y = null
|
|
82
|
+
|
|
83
|
+
return this
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ref, watch } from 'vue'
|
|
2
|
+
|
|
3
|
+
import { WindowClasses } from './WindowClasses'
|
|
4
|
+
import { WindowElement } from './WindowElement'
|
|
5
|
+
|
|
6
|
+
import type { WindowProps } from './props'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Class for managing the animation output before closing the window.
|
|
10
|
+
*
|
|
11
|
+
* Класс управления выводом анимации перед закрытием окна.
|
|
12
|
+
*/
|
|
13
|
+
export class WindowPersistent {
|
|
14
|
+
readonly item = ref<boolean>(false)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param props input data/ входные данные
|
|
19
|
+
* @param classes an object for working with classes and searching for elements/ объект для работы с классами и поиском элементов
|
|
20
|
+
* @param element an object of the class for working with elements/ объект класса для работы с элементами
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
protected readonly props: WindowProps,
|
|
24
|
+
protected readonly classes: WindowClasses,
|
|
25
|
+
protected readonly element: WindowElement
|
|
26
|
+
) {
|
|
27
|
+
watch(this.item, (value) => {
|
|
28
|
+
const element = this.element.getMain()
|
|
29
|
+
|
|
30
|
+
if (element) {
|
|
31
|
+
if (value) {
|
|
32
|
+
this.removeEvent()
|
|
33
|
+
|
|
34
|
+
element.classList.add(this.classes.list.persistent)
|
|
35
|
+
element.addEventListener('animationend', this.onTransitionend)
|
|
36
|
+
} else {
|
|
37
|
+
element.classList.remove(this.classes.list.persistent)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Request to enable animation.
|
|
45
|
+
*
|
|
46
|
+
* Запрос на включение анимации.
|
|
47
|
+
*/
|
|
48
|
+
on(): boolean {
|
|
49
|
+
if (this.props.persistent) {
|
|
50
|
+
this.item.value = true
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Request to disable animation.
|
|
59
|
+
*
|
|
60
|
+
* Запрос на выключение анимации.
|
|
61
|
+
*/
|
|
62
|
+
disabled(): this {
|
|
63
|
+
if (this.item.value) {
|
|
64
|
+
this.item.value = false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return this
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Event of the animation end of the closing prohibition.
|
|
72
|
+
*
|
|
73
|
+
* Событие окончания анимации запрета на закрытие.
|
|
74
|
+
*/
|
|
75
|
+
protected readonly onTransitionend = (): void => {
|
|
76
|
+
this.removeEvent()
|
|
77
|
+
this.disabled()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Removes the event of the end of the animation.
|
|
82
|
+
*
|
|
83
|
+
* Удаляет событие окончания анимации.
|
|
84
|
+
*/
|
|
85
|
+
protected removeEvent() {
|
|
86
|
+
this.element.getMain()
|
|
87
|
+
?.removeEventListener('animationend', this.onTransitionend)
|
|
88
|
+
}
|
|
89
|
+
}
|