@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,257 @@
|
|
|
1
|
+
import { WindowClasses } from './WindowClasses'
|
|
2
|
+
import { WindowElement } from './WindowElement'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A class for working with coordinates.
|
|
6
|
+
*
|
|
7
|
+
* Класс для работы с координатами.
|
|
8
|
+
*/
|
|
9
|
+
export class WindowCoordinates {
|
|
10
|
+
protected top: number = 0
|
|
11
|
+
protected right: number = 0
|
|
12
|
+
protected bottom: number = 0
|
|
13
|
+
protected left: number = 0
|
|
14
|
+
protected width: number = 0
|
|
15
|
+
protected height: number = 0
|
|
16
|
+
protected innerWidth: number = 0
|
|
17
|
+
protected innerHeight: number = 0
|
|
18
|
+
protected controlWidth: number = 0
|
|
19
|
+
protected controlHeight: number = 0
|
|
20
|
+
protected padding: number = 0
|
|
21
|
+
protected location: string = ''
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Constructor
|
|
25
|
+
* @param classes an object for working with classes and searching for elements/ объект для работы с классами и поиском элементов
|
|
26
|
+
* @param element an object of the class for working with elements/ объект класса для работы с элементами
|
|
27
|
+
*/
|
|
28
|
+
constructor(
|
|
29
|
+
protected readonly classes: WindowClasses,
|
|
30
|
+
protected readonly element: WindowElement
|
|
31
|
+
) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the distance from the top point.
|
|
36
|
+
*
|
|
37
|
+
* Возвращает расстояние от верхней точки.
|
|
38
|
+
*/
|
|
39
|
+
getTop(): number {
|
|
40
|
+
return this.top
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the distance from the right point.
|
|
45
|
+
*
|
|
46
|
+
* Возвращает расстояние от правой точки.
|
|
47
|
+
*/
|
|
48
|
+
getRight(): number {
|
|
49
|
+
return this.right
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the distance from the lower point.
|
|
54
|
+
*
|
|
55
|
+
* Возвращает расстояние от нижней точки.
|
|
56
|
+
*/
|
|
57
|
+
getBottom(): number {
|
|
58
|
+
return this.bottom
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns the distance from the left point.
|
|
63
|
+
*
|
|
64
|
+
* Возвращает расстояние от левой точки.
|
|
65
|
+
*/
|
|
66
|
+
getLeft(): number {
|
|
67
|
+
return this.left
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns the width of the element.
|
|
72
|
+
*
|
|
73
|
+
* Возвращает ширину элемента.
|
|
74
|
+
*/
|
|
75
|
+
getWidth(): number {
|
|
76
|
+
return this.width
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Returns the height of the element.
|
|
81
|
+
*
|
|
82
|
+
* Возвращает высоту элемента.
|
|
83
|
+
*/
|
|
84
|
+
getHeight(): number {
|
|
85
|
+
return this.height
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns the width of the window.
|
|
90
|
+
*
|
|
91
|
+
* Возвращает ширину окна.
|
|
92
|
+
*/
|
|
93
|
+
getInnerWidth(): number {
|
|
94
|
+
return this.innerWidth
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the height of the window.
|
|
99
|
+
*
|
|
100
|
+
* Возвращает высоту окна.
|
|
101
|
+
*/
|
|
102
|
+
getInnerHeight(): number {
|
|
103
|
+
return this.innerHeight
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns the width of the control element.
|
|
108
|
+
*
|
|
109
|
+
* Возвращает ширину элемента управления.
|
|
110
|
+
*/
|
|
111
|
+
getControlWidth(): number {
|
|
112
|
+
return this.controlWidth
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns the height of the control element.
|
|
117
|
+
*
|
|
118
|
+
* Возвращает высоту элемента управления.
|
|
119
|
+
*/
|
|
120
|
+
getControlHeight(): number {
|
|
121
|
+
return this.controlHeight
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Returns the margins of the element.
|
|
126
|
+
*
|
|
127
|
+
* Возвращает отступы у элемента.
|
|
128
|
+
*/
|
|
129
|
+
getPadding(): number {
|
|
130
|
+
return this.padding
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Returns the values of the element's position.
|
|
135
|
+
*
|
|
136
|
+
* Возвращает значения положения элемента.
|
|
137
|
+
*/
|
|
138
|
+
getLocation(): string {
|
|
139
|
+
return this.location
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns the maximum height of the body.
|
|
144
|
+
*
|
|
145
|
+
* Возвращает максимальную высоту у body.
|
|
146
|
+
*/
|
|
147
|
+
getMaxHeight(): number {
|
|
148
|
+
return window.innerHeight - (this.padding * 2)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Data updates.
|
|
153
|
+
*
|
|
154
|
+
* Обновления данных.
|
|
155
|
+
*/
|
|
156
|
+
update(): boolean {
|
|
157
|
+
const element = this.element.getMain()
|
|
158
|
+
const rect = this.element.getControlRect()
|
|
159
|
+
|
|
160
|
+
if (
|
|
161
|
+
element
|
|
162
|
+
&& rect
|
|
163
|
+
&& (
|
|
164
|
+
this.top !== rect.top
|
|
165
|
+
|| this.right !== rect.right
|
|
166
|
+
|| this.bottom !== rect.bottom
|
|
167
|
+
|| this.left !== rect.left
|
|
168
|
+
|| this.width !== element.offsetWidth
|
|
169
|
+
|| this.height !== element.offsetHeight
|
|
170
|
+
|| this.innerWidth !== window.innerWidth
|
|
171
|
+
|| this.innerHeight !== window.innerHeight
|
|
172
|
+
)
|
|
173
|
+
) {
|
|
174
|
+
this.top = rect.top
|
|
175
|
+
this.right = rect.right
|
|
176
|
+
this.bottom = rect.bottom
|
|
177
|
+
this.left = rect.left
|
|
178
|
+
this.width = element.offsetWidth
|
|
179
|
+
this.height = element.offsetHeight
|
|
180
|
+
this.innerWidth = window.innerWidth
|
|
181
|
+
this.innerHeight = window.innerHeight
|
|
182
|
+
this.controlWidth = rect.width
|
|
183
|
+
this.controlHeight = rect.height
|
|
184
|
+
this.padding = this.initPadding()
|
|
185
|
+
this.location = this.initLocation(rect.top + (rect.height / 2))
|
|
186
|
+
|
|
187
|
+
return true
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return false
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Resets all data to initial values.
|
|
195
|
+
*
|
|
196
|
+
* Сбрасывает все данные к начальным значениям.
|
|
197
|
+
*/
|
|
198
|
+
reset(): this {
|
|
199
|
+
this.top = 0
|
|
200
|
+
this.right = 0
|
|
201
|
+
this.bottom = 0
|
|
202
|
+
this.left = 0
|
|
203
|
+
this.width = 0
|
|
204
|
+
this.height = 0
|
|
205
|
+
this.innerWidth = 0
|
|
206
|
+
this.innerHeight = 0
|
|
207
|
+
|
|
208
|
+
return this
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Initializes padding value from computed styles.
|
|
213
|
+
*
|
|
214
|
+
* Инициализирует значение отступов из вычисленных стилей.
|
|
215
|
+
*/
|
|
216
|
+
protected initPadding(): number {
|
|
217
|
+
const element = this.element.getMain()
|
|
218
|
+
let padding = 0
|
|
219
|
+
|
|
220
|
+
if (element) {
|
|
221
|
+
const style = getComputedStyle(element)
|
|
222
|
+
const paddingTop = style.paddingTop.replace(/[^0-9]+/g, '')
|
|
223
|
+
const paddingBottom = style.paddingBottom.replace(/[^0-9]+/g, '')
|
|
224
|
+
|
|
225
|
+
padding = (parseInt(paddingTop) + parseInt(paddingBottom)) / 2
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return padding > 0 ? padding : 16
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Calculates control position values.
|
|
233
|
+
*
|
|
234
|
+
* Вычисляет значения положения контроля.
|
|
235
|
+
* @param top position of an element/ положение элемента
|
|
236
|
+
*/
|
|
237
|
+
protected initLocation(
|
|
238
|
+
top: number
|
|
239
|
+
): string {
|
|
240
|
+
const height = this.element.getBody()?.offsetHeight ?? 0
|
|
241
|
+
const half = height / 2
|
|
242
|
+
const max = this.innerHeight - (this.padding * 2) - height
|
|
243
|
+
const position = top - half - this.padding
|
|
244
|
+
|
|
245
|
+
if (
|
|
246
|
+
position < this.padding
|
|
247
|
+
) {
|
|
248
|
+
return '0px'
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (top + half >= this.innerHeight - this.padding) {
|
|
252
|
+
return `${max}px`
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return `${position}px`
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { h, Teleport, type VNode } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
type ConstrOptions,
|
|
4
|
+
type ConstrStyles,
|
|
5
|
+
DesignConstructorAbstract
|
|
6
|
+
} from '@dxtmisha/functional'
|
|
7
|
+
|
|
8
|
+
import { Window } from './Window'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
type WindowPropsBasic
|
|
12
|
+
} from './props'
|
|
13
|
+
import {
|
|
14
|
+
type WindowClasses,
|
|
15
|
+
type WindowComponents,
|
|
16
|
+
type WindowEmits,
|
|
17
|
+
type WindowExpose,
|
|
18
|
+
type WindowSlots
|
|
19
|
+
} from './types'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* WindowDesign
|
|
23
|
+
*/
|
|
24
|
+
export class WindowDesign<
|
|
25
|
+
COMP extends WindowComponents,
|
|
26
|
+
EXPOSE extends WindowExpose,
|
|
27
|
+
CLASSES extends WindowClasses,
|
|
28
|
+
P extends WindowPropsBasic
|
|
29
|
+
> extends DesignConstructorAbstract<
|
|
30
|
+
HTMLDivElement,
|
|
31
|
+
COMP,
|
|
32
|
+
WindowEmits,
|
|
33
|
+
EXPOSE,
|
|
34
|
+
WindowSlots,
|
|
35
|
+
CLASSES,
|
|
36
|
+
P
|
|
37
|
+
> {
|
|
38
|
+
protected readonly item: Window
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Constructor
|
|
42
|
+
* @param name class name/ название класса
|
|
43
|
+
* @param props properties/ свойства
|
|
44
|
+
* @param options list of additional parameters/ список дополнительных параметров
|
|
45
|
+
*/
|
|
46
|
+
constructor(
|
|
47
|
+
name: string,
|
|
48
|
+
props: Readonly<P>,
|
|
49
|
+
options?: ConstrOptions<COMP, WindowEmits, P>
|
|
50
|
+
) {
|
|
51
|
+
super(
|
|
52
|
+
name,
|
|
53
|
+
props,
|
|
54
|
+
options
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
this.item = new Window(
|
|
58
|
+
this.props,
|
|
59
|
+
this.refs,
|
|
60
|
+
this.element,
|
|
61
|
+
this.getDesign(),
|
|
62
|
+
this.getName(),
|
|
63
|
+
this.components,
|
|
64
|
+
this.slots,
|
|
65
|
+
this.emits
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
this.init()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Initialization of all the necessary properties for work
|
|
73
|
+
*
|
|
74
|
+
* Инициализация всех необходимых свойств для работы.
|
|
75
|
+
*/
|
|
76
|
+
protected initExpose(): EXPOSE {
|
|
77
|
+
return {
|
|
78
|
+
id: this.item.classes.getId(),
|
|
79
|
+
open: this.item.open.item,
|
|
80
|
+
setOpen: this.item.open.set,
|
|
81
|
+
toOpen: this.item.open.open,
|
|
82
|
+
toClose: this.item.open.close,
|
|
83
|
+
toggle: this.item.open.toggle,
|
|
84
|
+
control: this.item.slotData
|
|
85
|
+
} as EXPOSE
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Improvement of the obtained list of classes.
|
|
90
|
+
*
|
|
91
|
+
* Доработка полученного списка классов.
|
|
92
|
+
*/
|
|
93
|
+
protected initClasses(): Partial<CLASSES> {
|
|
94
|
+
return {
|
|
95
|
+
main: this.item.classesList.value,
|
|
96
|
+
...{
|
|
97
|
+
// :classes [!] System label / Системная метка
|
|
98
|
+
body: this.getSubClass('body'),
|
|
99
|
+
bodyGroup: this.getSubClass('body__group'),
|
|
100
|
+
bodyContext: this.getSubClass('body__context'),
|
|
101
|
+
control: this.getSubClass('control'),
|
|
102
|
+
image: this.getSubClass('image'),
|
|
103
|
+
close: this.getSubClass('close'),
|
|
104
|
+
teleport: this.getSubClass('teleport')
|
|
105
|
+
// :classes [!] System label / Системная метка
|
|
106
|
+
}
|
|
107
|
+
} as Partial<CLASSES>
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Refinement of the received list of styles.
|
|
112
|
+
*
|
|
113
|
+
* Доработка полученного списка стилей.
|
|
114
|
+
*/
|
|
115
|
+
protected initStyles(): ConstrStyles {
|
|
116
|
+
return {}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A method for rendering.
|
|
121
|
+
*
|
|
122
|
+
* Метод для рендеринга.
|
|
123
|
+
*/
|
|
124
|
+
protected initRender(): VNode[] {
|
|
125
|
+
const main: any[] = []
|
|
126
|
+
|
|
127
|
+
this.initSlot('control', main, this.item.slotData)
|
|
128
|
+
|
|
129
|
+
if (this.item.open.inDom.value) {
|
|
130
|
+
if (this.item.staticMode.item.value) {
|
|
131
|
+
main.push(this.renderMain())
|
|
132
|
+
} else {
|
|
133
|
+
main.push(
|
|
134
|
+
h(
|
|
135
|
+
Teleport,
|
|
136
|
+
{
|
|
137
|
+
key: 'teleport',
|
|
138
|
+
to: 'body'
|
|
139
|
+
},
|
|
140
|
+
h(
|
|
141
|
+
'div',
|
|
142
|
+
{
|
|
143
|
+
'class': this.classes?.value.teleport,
|
|
144
|
+
'data-window-teleport': this.item.classes.getId()
|
|
145
|
+
},
|
|
146
|
+
this.renderMain()
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return main
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Render main window element.
|
|
158
|
+
*
|
|
159
|
+
* Рендер главного элемента окна.
|
|
160
|
+
*/
|
|
161
|
+
readonly renderMain = (): VNode => {
|
|
162
|
+
return h(
|
|
163
|
+
'div',
|
|
164
|
+
{
|
|
165
|
+
'key': 'main',
|
|
166
|
+
'ref': this.element,
|
|
167
|
+
'class': this.classes?.value.main,
|
|
168
|
+
'style': this.styles?.value,
|
|
169
|
+
'data-window': this.item.classes.getId(),
|
|
170
|
+
'onTransitionend': this.item.event.onTransition
|
|
171
|
+
},
|
|
172
|
+
this.renderBody()
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Render body element.
|
|
178
|
+
*
|
|
179
|
+
* Рендер элемента тела.
|
|
180
|
+
*/
|
|
181
|
+
readonly renderBody = (): VNode => {
|
|
182
|
+
return h(
|
|
183
|
+
'div',
|
|
184
|
+
{
|
|
185
|
+
key: 'body',
|
|
186
|
+
...this.getAttrs(),
|
|
187
|
+
class: {
|
|
188
|
+
[String(this.classes?.value.body)]: true,
|
|
189
|
+
...this.toClass(this.attrs?.class)
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
[
|
|
193
|
+
...this.renderBodyImage(),
|
|
194
|
+
...this.renderBodyClose(),
|
|
195
|
+
...this.renderBodyGroup()
|
|
196
|
+
]
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Generates an element to group the displayed data.
|
|
202
|
+
*
|
|
203
|
+
* Генерирует элемент для группировки выводимых данных.
|
|
204
|
+
*/
|
|
205
|
+
readonly renderBodyGroup = (): VNode[] => {
|
|
206
|
+
const children: any[] = []
|
|
207
|
+
|
|
208
|
+
this.initSlot('title', children, this.item.slotData)
|
|
209
|
+
children.push(this.renderBodyContext())
|
|
210
|
+
this.initSlot('footer', children, this.item.slotData)
|
|
211
|
+
|
|
212
|
+
return [
|
|
213
|
+
h('div', {
|
|
214
|
+
key: 'group',
|
|
215
|
+
class: this.classes?.value.bodyGroup
|
|
216
|
+
}, children)
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Render context element.
|
|
222
|
+
*
|
|
223
|
+
* Рендер элемента контекста.
|
|
224
|
+
*/
|
|
225
|
+
readonly renderBodyContext = (): VNode[] => {
|
|
226
|
+
return this.item.scrollbar.render(
|
|
227
|
+
'div',
|
|
228
|
+
{
|
|
229
|
+
'key': 'bodyContext',
|
|
230
|
+
'class': this.classes?.value.bodyContext,
|
|
231
|
+
'divider': this.props.divider,
|
|
232
|
+
'data-window-body': '1'
|
|
233
|
+
},
|
|
234
|
+
() => this.initSlot('default', undefined, this.item.slotData)
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Generates an element to display the image.
|
|
240
|
+
*
|
|
241
|
+
* Генерирует элемент для вывода изображения
|
|
242
|
+
*/
|
|
243
|
+
readonly renderBodyImage = (): VNode[] => {
|
|
244
|
+
if (this.props.image) {
|
|
245
|
+
return [h(
|
|
246
|
+
'div',
|
|
247
|
+
{
|
|
248
|
+
class: this.classes?.value.image
|
|
249
|
+
},
|
|
250
|
+
this.item.image.render()
|
|
251
|
+
)]
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return []
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Generates an element to display the close button.
|
|
259
|
+
*
|
|
260
|
+
* Генерирует элемент для вывода кнопки закрытия.
|
|
261
|
+
*/
|
|
262
|
+
readonly renderBodyClose = (): VNode[] => {
|
|
263
|
+
if (this.props.closeButton) {
|
|
264
|
+
return this.components.render(
|
|
265
|
+
'button',
|
|
266
|
+
{
|
|
267
|
+
class: [
|
|
268
|
+
this.classes?.value.close,
|
|
269
|
+
this.item.classes.list.close
|
|
270
|
+
],
|
|
271
|
+
icon: this.props.iconClose
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return []
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
import { WindowClasses } from './WindowClasses'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A class for working with elements.
|
|
7
|
+
*
|
|
8
|
+
* Класс для работы с элементами.
|
|
9
|
+
*/
|
|
10
|
+
export class WindowElement {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param classes an object for working with classes and searching for elements/ объект для работы с классами и поиском элементов
|
|
14
|
+
* @param element the element of the window itself/ элемент самого окна
|
|
15
|
+
*/
|
|
16
|
+
constructor(
|
|
17
|
+
protected readonly classes: WindowClasses,
|
|
18
|
+
public readonly element: Ref<HTMLDivElement | undefined>
|
|
19
|
+
) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the main element exists.
|
|
24
|
+
*
|
|
25
|
+
* Проверяет, есть ли главный элемент.
|
|
26
|
+
*/
|
|
27
|
+
isMain(): boolean {
|
|
28
|
+
return Boolean(this.element.value)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns the main element.
|
|
33
|
+
*
|
|
34
|
+
* Возвращает главного элемента.
|
|
35
|
+
*/
|
|
36
|
+
getMain(): HTMLDivElement | undefined {
|
|
37
|
+
return this.element.value
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the control element of the current component.
|
|
42
|
+
*
|
|
43
|
+
* Возвращает элемент управления текущего компонента.
|
|
44
|
+
*/
|
|
45
|
+
getControl(): HTMLElement | undefined {
|
|
46
|
+
return this.classes.findControl()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Returns the dimensions of the control element.
|
|
51
|
+
*
|
|
52
|
+
* Возвращает размеры элемента управления.
|
|
53
|
+
*/
|
|
54
|
+
getControlRect(): DOMRect | undefined {
|
|
55
|
+
return this.getControl()?.getBoundingClientRect() || undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns the body element of the window.
|
|
60
|
+
*
|
|
61
|
+
* Возвращает элемент тела окна.
|
|
62
|
+
*/
|
|
63
|
+
getBody(): HTMLDivElement | undefined {
|
|
64
|
+
return this.classes.findBody()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the dimensions of the window's body element.
|
|
69
|
+
*
|
|
70
|
+
* Возвращает размеры элемента тела окна.
|
|
71
|
+
*/
|
|
72
|
+
getBodyRect(): DOMRect | undefined {
|
|
73
|
+
return this.getBody()?.getBoundingClientRect() || undefined
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns the window context element.
|
|
78
|
+
*
|
|
79
|
+
* Возвращает элемент контекста окна.
|
|
80
|
+
*/
|
|
81
|
+
getBodyContext(): HTMLDivElement | undefined {
|
|
82
|
+
return this.classes.findBodyContext()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ConstrEmit } from '@dxtmisha/functional'
|
|
2
|
+
|
|
3
|
+
import { WindowClasses } from './WindowClasses'
|
|
4
|
+
import { WindowElement } from './WindowElement'
|
|
5
|
+
|
|
6
|
+
import type { WindowEmits } from './types'
|
|
7
|
+
import type { WindowEmitOptions } from './basicTypes'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Class triggering a click status change event.
|
|
11
|
+
*
|
|
12
|
+
* Класс, вызывающий событие изменения статуса клика.
|
|
13
|
+
*/
|
|
14
|
+
export class WindowEmit {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor
|
|
17
|
+
* @param classes an object for working with classes and searching for elements/ объект для работы с классами и поиском элементов
|
|
18
|
+
* @param element an object of the class for working with elements/ объект класса для работы с элементами
|
|
19
|
+
* @param emits the function is called when an event is triggered/ функция вызывается, когда срабатывает событие
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
protected readonly classes: WindowClasses,
|
|
23
|
+
protected readonly element: WindowElement,
|
|
24
|
+
protected readonly emits?: ConstrEmit<WindowEmits>
|
|
25
|
+
) {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Perform events.
|
|
30
|
+
*
|
|
31
|
+
* Выполнить события.
|
|
32
|
+
* @param open current state of the window/ текущее состояние окна
|
|
33
|
+
*/
|
|
34
|
+
on(open: boolean) {
|
|
35
|
+
this.emits?.('window', this.getEmitOptions(open))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns an object for calling the event handler.
|
|
40
|
+
*
|
|
41
|
+
* Возвращает объект для вызова обработчика события.
|
|
42
|
+
* @param open current state of the window/ текущее состояние окна
|
|
43
|
+
*/
|
|
44
|
+
protected getEmitOptions(open: boolean): WindowEmitOptions {
|
|
45
|
+
return {
|
|
46
|
+
id: this.classes.getId(),
|
|
47
|
+
element: this.element.getMain() as HTMLDivElement,
|
|
48
|
+
control: this.element.getControl() as HTMLElement,
|
|
49
|
+
open
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|