@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.
Files changed (311) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -0
  3. package/package.json +124 -0
  4. package/src/classes/CaptionInclude.ts +71 -0
  5. package/src/classes/DescriptionInclude.ts +70 -0
  6. package/src/classes/EnabledInclude.ts +56 -0
  7. package/src/classes/EventClickInclude.ts +138 -0
  8. package/src/classes/LabelHighlightInclude.ts +90 -0
  9. package/src/classes/LabelInclude.ts +171 -0
  10. package/src/classes/LabelNumberInclude.ts +70 -0
  11. package/src/classes/ModelInclude.ts +49 -0
  12. package/src/classes/PrefixInclude.ts +71 -0
  13. package/src/classes/SuffixInclude.ts +71 -0
  14. package/src/classes/field/FieldAttributesInclude.ts +100 -0
  15. package/src/classes/field/FieldChangeInclude.ts +52 -0
  16. package/src/classes/field/FieldCodeInclude.ts +69 -0
  17. package/src/classes/field/FieldElementInclude.ts +97 -0
  18. package/src/classes/field/FieldInputCheckInclude.ts +128 -0
  19. package/src/classes/field/FieldMatchInclude.ts +101 -0
  20. package/src/classes/field/FieldPatternInclude.ts +42 -0
  21. package/src/classes/field/FieldTypeInclude.ts +42 -0
  22. package/src/classes/field/FieldValidationInclude.ts +196 -0
  23. package/src/classes/field/FieldValueInclude.ts +318 -0
  24. package/src/classes/field/FieldVisibilityInclude.ts +21 -0
  25. package/src/constructors/Badge/Badge.ts +73 -0
  26. package/src/constructors/Badge/BadgeDesign.tsx +127 -0
  27. package/src/constructors/Badge/BadgeInclude.ts +78 -0
  28. package/src/constructors/Badge/basicTypes.ts +15 -0
  29. package/src/constructors/Badge/index.ts +5 -0
  30. package/src/constructors/Badge/properties.json +36 -0
  31. package/src/constructors/Badge/props.ts +43 -0
  32. package/src/constructors/Badge/style.scss +83 -0
  33. package/src/constructors/Badge/types.ts +47 -0
  34. package/src/constructors/Bars/Bars.ts +188 -0
  35. package/src/constructors/Bars/BarsAction.ts +57 -0
  36. package/src/constructors/Bars/BarsDesign.tsx +229 -0
  37. package/src/constructors/Bars/BarsInclude.ts +116 -0
  38. package/src/constructors/Bars/basicTypes.ts +40 -0
  39. package/src/constructors/Bars/index.ts +6 -0
  40. package/src/constructors/Bars/properties.json +6 -0
  41. package/src/constructors/Bars/props.ts +63 -0
  42. package/src/constructors/Bars/style.scss +18 -0
  43. package/src/constructors/Bars/types.ts +58 -0
  44. package/src/constructors/Button/Button.ts +88 -0
  45. package/src/constructors/Button/ButtonDesign.tsx +136 -0
  46. package/src/constructors/Button/ButtonInclude.ts +80 -0
  47. package/src/constructors/Button/basicTypes.ts +12 -0
  48. package/src/constructors/Button/index.ts +5 -0
  49. package/src/constructors/Button/properties.json +84 -0
  50. package/src/constructors/Button/props.ts +55 -0
  51. package/src/constructors/Button/style.scss +96 -0
  52. package/src/constructors/Button/types.ts +56 -0
  53. package/src/constructors/Cell/Cell.ts +127 -0
  54. package/src/constructors/Cell/CellDesign.tsx +203 -0
  55. package/src/constructors/Cell/basicTypes.ts +6 -0
  56. package/src/constructors/Cell/index.ts +5 -0
  57. package/src/constructors/Cell/properties.json +52 -0
  58. package/src/constructors/Cell/props.ts +61 -0
  59. package/src/constructors/Cell/style.scss +80 -0
  60. package/src/constructors/Cell/types.ts +68 -0
  61. package/src/constructors/Chip/Chip.ts +33 -0
  62. package/src/constructors/Chip/ChipDesign.tsx +26 -0
  63. package/src/constructors/Chip/basicTypes.ts +0 -0
  64. package/src/constructors/Chip/index.ts +4 -0
  65. package/src/constructors/Chip/properties.json +3 -0
  66. package/src/constructors/Chip/props.ts +44 -0
  67. package/src/constructors/Chip/style.scss +6 -0
  68. package/src/constructors/Chip/types.ts +53 -0
  69. package/src/constructors/Field/Field.ts +147 -0
  70. package/src/constructors/Field/FieldDesign.tsx +372 -0
  71. package/src/constructors/Field/FieldIcons.ts +99 -0
  72. package/src/constructors/Field/FieldInclude.ts +72 -0
  73. package/src/constructors/Field/FieldSize.ts +93 -0
  74. package/src/constructors/Field/basicTypes.ts +90 -0
  75. package/src/constructors/Field/index.ts +5 -0
  76. package/src/constructors/Field/properties.json +86 -0
  77. package/src/constructors/Field/props.ts +88 -0
  78. package/src/constructors/Field/style.scss +556 -0
  79. package/src/constructors/Field/types.ts +78 -0
  80. package/src/constructors/FieldCounter/FieldCounter.ts +75 -0
  81. package/src/constructors/FieldCounter/FieldCounterDesign.tsx +122 -0
  82. package/src/constructors/FieldCounter/FieldCounterInclude.ts +98 -0
  83. package/src/constructors/FieldCounter/basicTypes.ts +25 -0
  84. package/src/constructors/FieldCounter/index.ts +6 -0
  85. package/src/constructors/FieldCounter/properties.json +3 -0
  86. package/src/constructors/FieldCounter/props.ts +32 -0
  87. package/src/constructors/FieldCounter/style.scss +4 -0
  88. package/src/constructors/FieldCounter/types.ts +42 -0
  89. package/src/constructors/FieldLabel/FieldLabel.ts +93 -0
  90. package/src/constructors/FieldLabel/FieldLabelDesign.tsx +156 -0
  91. package/src/constructors/FieldLabel/FieldLabelInclude.ts +91 -0
  92. package/src/constructors/FieldLabel/basicTypes.ts +34 -0
  93. package/src/constructors/FieldLabel/index.ts +6 -0
  94. package/src/constructors/FieldLabel/properties.json +4 -0
  95. package/src/constructors/FieldLabel/props.ts +40 -0
  96. package/src/constructors/FieldLabel/style.scss +10 -0
  97. package/src/constructors/FieldLabel/types.ts +49 -0
  98. package/src/constructors/FieldMessage/FieldMessage.ts +79 -0
  99. package/src/constructors/FieldMessage/FieldMessageDesign.tsx +159 -0
  100. package/src/constructors/FieldMessage/FieldMessageInclude.ts +105 -0
  101. package/src/constructors/FieldMessage/FieldMessageMessage.ts +54 -0
  102. package/src/constructors/FieldMessage/basicTypes.ts +27 -0
  103. package/src/constructors/FieldMessage/index.ts +6 -0
  104. package/src/constructors/FieldMessage/properties.json +9 -0
  105. package/src/constructors/FieldMessage/props.ts +40 -0
  106. package/src/constructors/FieldMessage/style.scss +13 -0
  107. package/src/constructors/FieldMessage/types.ts +49 -0
  108. package/src/constructors/Icon/Icon.ts +105 -0
  109. package/src/constructors/Icon/IconDesign.tsx +157 -0
  110. package/src/constructors/Icon/IconInclude.ts +64 -0
  111. package/src/constructors/Icon/IconLiteInclude.ts +121 -0
  112. package/src/constructors/Icon/IconTrailingInclude.ts +106 -0
  113. package/src/constructors/Icon/basicTypes.ts +50 -0
  114. package/src/constructors/Icon/index.ts +8 -0
  115. package/src/constructors/Icon/properties.json +25 -0
  116. package/src/constructors/Icon/props.ts +54 -0
  117. package/src/constructors/Icon/style.scss +106 -0
  118. package/src/constructors/Icon/types.ts +46 -0
  119. package/src/constructors/Image/Image.ts +184 -0
  120. package/src/constructors/Image/ImageAdaptiveGroup.ts +230 -0
  121. package/src/constructors/Image/ImageAdaptiveItem.ts +295 -0
  122. package/src/constructors/Image/ImageBackground.ts +127 -0
  123. package/src/constructors/Image/ImageCalculation.ts +184 -0
  124. package/src/constructors/Image/ImageCalculationList.ts +61 -0
  125. package/src/constructors/Image/ImageCoordinator.ts +104 -0
  126. package/src/constructors/Image/ImageData.ts +99 -0
  127. package/src/constructors/Image/ImageDesign.tsx +137 -0
  128. package/src/constructors/Image/ImageFile.ts +137 -0
  129. package/src/constructors/Image/ImageInclude.ts +53 -0
  130. package/src/constructors/Image/ImagePdf.ts +44 -0
  131. package/src/constructors/Image/ImagePosition.ts +49 -0
  132. package/src/constructors/Image/ImageType.ts +83 -0
  133. package/src/constructors/Image/basicTypes.ts +70 -0
  134. package/src/constructors/Image/index.ts +5 -0
  135. package/src/constructors/Image/properties.json +17 -0
  136. package/src/constructors/Image/props.ts +66 -0
  137. package/src/constructors/Image/style.scss +77 -0
  138. package/src/constructors/Image/types.ts +49 -0
  139. package/src/constructors/List/List.ts +267 -0
  140. package/src/constructors/List/ListControl.ts +194 -0
  141. package/src/constructors/List/ListDesign.tsx +382 -0
  142. package/src/constructors/List/ListFocus.ts +196 -0
  143. package/src/constructors/List/ListGo.ts +283 -0
  144. package/src/constructors/List/ListSearch.ts +113 -0
  145. package/src/constructors/List/basicTypes.ts +3 -0
  146. package/src/constructors/List/index.ts +5 -0
  147. package/src/constructors/List/properties.json +16 -0
  148. package/src/constructors/List/props.ts +76 -0
  149. package/src/constructors/List/style.scss +36 -0
  150. package/src/constructors/List/types.ts +66 -0
  151. package/src/constructors/ListGroup/ListGroup.ts +53 -0
  152. package/src/constructors/ListGroup/ListGroupDesign.tsx +180 -0
  153. package/src/constructors/ListGroup/ListGroupOpen.ts +56 -0
  154. package/src/constructors/ListGroup/basicTypes.ts +3 -0
  155. package/src/constructors/ListGroup/index.ts +5 -0
  156. package/src/constructors/ListGroup/properties.json +15 -0
  157. package/src/constructors/ListGroup/props.ts +30 -0
  158. package/src/constructors/ListGroup/style.scss +18 -0
  159. package/src/constructors/ListGroup/types.ts +51 -0
  160. package/src/constructors/ListItem/ListItem.ts +115 -0
  161. package/src/constructors/ListItem/ListItemDesign.tsx +196 -0
  162. package/src/constructors/ListItem/basicTypes.ts +3 -0
  163. package/src/constructors/ListItem/index.ts +5 -0
  164. package/src/constructors/ListItem/properties.json +52 -0
  165. package/src/constructors/ListItem/props.ts +78 -0
  166. package/src/constructors/ListItem/style.scss +152 -0
  167. package/src/constructors/ListItem/types.ts +78 -0
  168. package/src/constructors/ListMenu/ListMenu.ts +52 -0
  169. package/src/constructors/ListMenu/ListMenuDesign.tsx +127 -0
  170. package/src/constructors/ListMenu/basicTypes.ts +3 -0
  171. package/src/constructors/ListMenu/index.ts +5 -0
  172. package/src/constructors/ListMenu/properties.json +19 -0
  173. package/src/constructors/ListMenu/props.ts +34 -0
  174. package/src/constructors/ListMenu/style.scss +5 -0
  175. package/src/constructors/ListMenu/types.ts +54 -0
  176. package/src/constructors/Mask/Mask.ts +321 -0
  177. package/src/constructors/Mask/MaskBuffer.ts +89 -0
  178. package/src/constructors/Mask/MaskCharacter.ts +192 -0
  179. package/src/constructors/Mask/MaskCharacterLength.ts +40 -0
  180. package/src/constructors/Mask/MaskData.ts +287 -0
  181. package/src/constructors/Mask/MaskDate.ts +157 -0
  182. package/src/constructors/Mask/MaskDesign.tsx +217 -0
  183. package/src/constructors/Mask/MaskEmit.ts +140 -0
  184. package/src/constructors/Mask/MaskEvent.ts +347 -0
  185. package/src/constructors/Mask/MaskFocus.ts +49 -0
  186. package/src/constructors/Mask/MaskFormat.ts +216 -0
  187. package/src/constructors/Mask/MaskItem.ts +218 -0
  188. package/src/constructors/Mask/MaskMatch.ts +73 -0
  189. package/src/constructors/Mask/MaskPattern.ts +123 -0
  190. package/src/constructors/Mask/MaskRight.ts +43 -0
  191. package/src/constructors/Mask/MaskRubber.ts +156 -0
  192. package/src/constructors/Mask/MaskRubberItem.ts +96 -0
  193. package/src/constructors/Mask/MaskRubberTransition.ts +50 -0
  194. package/src/constructors/Mask/MaskSelection.ts +208 -0
  195. package/src/constructors/Mask/MaskSpecial.ts +179 -0
  196. package/src/constructors/Mask/MaskType.ts +103 -0
  197. package/src/constructors/Mask/MaskValidation.ts +102 -0
  198. package/src/constructors/Mask/MaskValue.ts +225 -0
  199. package/src/constructors/Mask/MaskValueBasic.ts +87 -0
  200. package/src/constructors/Mask/MaskView.ts +169 -0
  201. package/src/constructors/Mask/basicTypes.ts +49 -0
  202. package/src/constructors/Mask/index.ts +5 -0
  203. package/src/constructors/Mask/properties.json +29 -0
  204. package/src/constructors/Mask/props.ts +70 -0
  205. package/src/constructors/Mask/style.scss +104 -0
  206. package/src/constructors/Mask/types.ts +71 -0
  207. package/src/constructors/Menu/Menu.ts +179 -0
  208. package/src/constructors/Menu/MenuDesign.tsx +244 -0
  209. package/src/constructors/Menu/MenuInclude.ts +110 -0
  210. package/src/constructors/Menu/MenuRequest.ts +101 -0
  211. package/src/constructors/Menu/MenuSearch.ts +49 -0
  212. package/src/constructors/Menu/MenuValue.ts +73 -0
  213. package/src/constructors/Menu/MenuWindow.ts +89 -0
  214. package/src/constructors/Menu/basicTypes.ts +41 -0
  215. package/src/constructors/Menu/index.ts +6 -0
  216. package/src/constructors/Menu/properties.json +17 -0
  217. package/src/constructors/Menu/props.ts +79 -0
  218. package/src/constructors/Menu/style.scss +17 -0
  219. package/src/constructors/Menu/types.ts +79 -0
  220. package/src/constructors/MotionTransform/MotionTransform.ts +87 -0
  221. package/src/constructors/MotionTransform/MotionTransformClassesInclude.ts +38 -0
  222. package/src/constructors/MotionTransform/MotionTransformDesign.tsx +242 -0
  223. package/src/constructors/MotionTransform/MotionTransformElement.ts +220 -0
  224. package/src/constructors/MotionTransform/MotionTransformEvent.ts +118 -0
  225. package/src/constructors/MotionTransform/MotionTransformGo.ts +47 -0
  226. package/src/constructors/MotionTransform/MotionTransformInclude.ts +123 -0
  227. package/src/constructors/MotionTransform/MotionTransformSize.ts +97 -0
  228. package/src/constructors/MotionTransform/MotionTransformState.ts +250 -0
  229. package/src/constructors/MotionTransform/basicTypes.ts +121 -0
  230. package/src/constructors/MotionTransform/index.ts +7 -0
  231. package/src/constructors/MotionTransform/properties.json +35 -0
  232. package/src/constructors/MotionTransform/props.ts +50 -0
  233. package/src/constructors/MotionTransform/style.scss +180 -0
  234. package/src/constructors/MotionTransform/types.ts +86 -0
  235. package/src/constructors/Progress/Progress.ts +184 -0
  236. package/src/constructors/Progress/ProgressDesign.tsx +175 -0
  237. package/src/constructors/Progress/ProgressInclude.ts +67 -0
  238. package/src/constructors/Progress/basicTypes.ts +12 -0
  239. package/src/constructors/Progress/index.ts +6 -0
  240. package/src/constructors/Progress/properties.json +47 -0
  241. package/src/constructors/Progress/props.ts +54 -0
  242. package/src/constructors/Progress/style.scss +374 -0
  243. package/src/constructors/Progress/types.ts +43 -0
  244. package/src/constructors/Ripple/Ripple.ts +46 -0
  245. package/src/constructors/Ripple/RippleDesign.tsx +112 -0
  246. package/src/constructors/Ripple/RippleInclude.ts +39 -0
  247. package/src/constructors/Ripple/RippleItem.ts +62 -0
  248. package/src/constructors/Ripple/basicTypes.ts +3 -0
  249. package/src/constructors/Ripple/index.ts +6 -0
  250. package/src/constructors/Ripple/properties.json +9 -0
  251. package/src/constructors/Ripple/props.ts +28 -0
  252. package/src/constructors/Ripple/style.scss +62 -0
  253. package/src/constructors/Ripple/types.ts +41 -0
  254. package/src/constructors/Scrollbar/Scrollbar.ts +66 -0
  255. package/src/constructors/Scrollbar/ScrollbarBorder.ts +243 -0
  256. package/src/constructors/Scrollbar/ScrollbarDesign.tsx +126 -0
  257. package/src/constructors/Scrollbar/ScrollbarInclude.ts +80 -0
  258. package/src/constructors/Scrollbar/basicTypes.ts +42 -0
  259. package/src/constructors/Scrollbar/index.ts +5 -0
  260. package/src/constructors/Scrollbar/properties.json +33 -0
  261. package/src/constructors/Scrollbar/props.ts +37 -0
  262. package/src/constructors/Scrollbar/style.scss +117 -0
  263. package/src/constructors/Scrollbar/types.ts +52 -0
  264. package/src/constructors/Skeleton/Skeleton.ts +86 -0
  265. package/src/constructors/Skeleton/SkeletonDesign.tsx +117 -0
  266. package/src/constructors/Skeleton/SkeletonInclude.ts +61 -0
  267. package/src/constructors/Skeleton/basicTypes.ts +16 -0
  268. package/src/constructors/Skeleton/const.ts +1 -0
  269. package/src/constructors/Skeleton/index.ts +6 -0
  270. package/src/constructors/Skeleton/properties.json +24 -0
  271. package/src/constructors/Skeleton/props.ts +28 -0
  272. package/src/constructors/Skeleton/style.scss +112 -0
  273. package/src/constructors/Skeleton/types.ts +46 -0
  274. package/src/constructors/Window/Window.ts +212 -0
  275. package/src/constructors/Window/WindowClasses.ts +180 -0
  276. package/src/constructors/Window/WindowClassesInclude.ts +39 -0
  277. package/src/constructors/Window/WindowClient.ts +93 -0
  278. package/src/constructors/Window/WindowCoordinates.ts +257 -0
  279. package/src/constructors/Window/WindowDesign.tsx +278 -0
  280. package/src/constructors/Window/WindowElement.ts +84 -0
  281. package/src/constructors/Window/WindowEmit.ts +52 -0
  282. package/src/constructors/Window/WindowEvent.ts +157 -0
  283. package/src/constructors/Window/WindowFlash.ts +70 -0
  284. package/src/constructors/Window/WindowHook.ts +110 -0
  285. package/src/constructors/Window/WindowInclude.ts +134 -0
  286. package/src/constructors/Window/WindowOpen.ts +292 -0
  287. package/src/constructors/Window/WindowOrigin.ts +85 -0
  288. package/src/constructors/Window/WindowPersistent.ts +89 -0
  289. package/src/constructors/Window/WindowPosition.ts +358 -0
  290. package/src/constructors/Window/WindowStatic.ts +102 -0
  291. package/src/constructors/Window/WindowStatus.ts +138 -0
  292. package/src/constructors/Window/WindowStyles.ts +78 -0
  293. package/src/constructors/Window/WindowVerification.ts +287 -0
  294. package/src/constructors/Window/basicTypes.ts +186 -0
  295. package/src/constructors/Window/index.ts +7 -0
  296. package/src/constructors/Window/properties.json +236 -0
  297. package/src/constructors/Window/props.ts +88 -0
  298. package/src/constructors/Window/style.scss +262 -0
  299. package/src/constructors/Window/types.ts +124 -0
  300. package/src/functions/getClassTegAStatic.ts +8 -0
  301. package/src/library.ts +36 -0
  302. package/src/types/captionTypes.ts +15 -0
  303. package/src/types/descriptionTypes.ts +15 -0
  304. package/src/types/enabledTypes.ts +9 -0
  305. package/src/types/eventClickTypes.ts +51 -0
  306. package/src/types/fieldTypes.ts +282 -0
  307. package/src/types/labelTypes.ts +30 -0
  308. package/src/types/modelTypes.ts +23 -0
  309. package/src/types/prefixTypes.ts +15 -0
  310. package/src/types/suffixTypes.ts +15 -0
  311. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,169 @@
1
+ import { computed } from 'vue'
2
+
3
+ import { MaskType } from './MaskType'
4
+ import { MaskDate } from './MaskDate'
5
+ import { MaskFormat } from './MaskFormat'
6
+ import { MaskSpecial } from './MaskSpecial'
7
+ import { MaskRubber } from './MaskRubber'
8
+ import { MaskItem } from './MaskItem'
9
+ import { MaskValueBasic } from './MaskValueBasic'
10
+ import { MaskValidation } from './MaskValidation'
11
+
12
+ import { MASK_CHAR_DELETE, type MaskViewList, MASK_VIEW_DEFAULT } from './basicTypes'
13
+ import type { MaskProps } from './props'
14
+
15
+ /**
16
+ * Class for working with data to output to the screen.
17
+ *
18
+ * Класс для работы с данными для вывода на экран.
19
+ */
20
+ export class MaskView {
21
+ /** Class name prefix for item/ Класс для элемента */
22
+ protected classNameItem: string
23
+
24
+ /**
25
+ * Constructor
26
+ * @param props input data/ входные данные
27
+ * @param type object for working with the mask type/ объект для работы с типом маски
28
+ * @param date object for working with date types/ объект для работы с типом даты
29
+ * @param format object for managing numeric mask types/ объект для управления числовыми типами масок
30
+ * @param special object for working with special characters/ объект для работы со специальными символами
31
+ * @param rubber object for working with rubber types/ объект для работы с резиновыми типами
32
+ * @param mask object for managing masks/ объект управления маской
33
+ * @param valueBasic object for working with base values/ объект для работы с базовыми значениями
34
+ * @param validation object for working with validation/ объект для работы с валидацией
35
+ * @param className define class names for each symbol/ определить название класса для каждого символа
36
+ */
37
+ constructor(
38
+ protected readonly props: MaskProps,
39
+ protected readonly type: MaskType,
40
+ protected readonly date: MaskDate,
41
+ protected readonly format: MaskFormat,
42
+ protected readonly special: MaskSpecial,
43
+ protected readonly rubber: MaskRubber,
44
+ protected readonly mask: MaskItem,
45
+ protected readonly valueBasic: MaskValueBasic,
46
+ protected readonly validation: MaskValidation,
47
+ className: string
48
+ ) {
49
+ this.classNameItem = `${className}__character__item`
50
+ }
51
+
52
+ /** View items list/ Список данных для отображения */
53
+ readonly item = computed<MaskViewList>(() => {
54
+ const data: MaskViewList = []
55
+ const valueBasic = this.valueBasic.item.value
56
+
57
+ this.mask.item.value.forEach((char, index) => {
58
+ const value = valueBasic?.[index]
59
+
60
+ data.push({
61
+ className: `${this.classNameItem} ${this.classNameItem}--${this.getStatus(char, value)}`,
62
+ value: this.getValue(char, value)
63
+ })
64
+ })
65
+
66
+ return data
67
+ })
68
+
69
+ /** Input value with special view characters/ Значение ввода со спецсимволами отображения */
70
+ readonly input = computed<string>(() => {
71
+ const value: string[] = []
72
+ const list = this.mask.item.value
73
+
74
+ this.valueBasic.item.value.split('').forEach((char, index) => {
75
+ if (char === MASK_CHAR_DELETE) {
76
+ value.push(
77
+ this.getSpecialToView(list?.[index] ?? '') ?? char
78
+ )
79
+ } else {
80
+ value.push(char)
81
+ }
82
+ })
83
+
84
+ return value.join('')
85
+ })
86
+
87
+ /**
88
+ * Checks if the value is filled in.
89
+ *
90
+ * Проверяет, заполнено ли значение.
91
+ * @param value checked value/ проверяемое значение
92
+ */
93
+ protected isValue(value?: string): value is string {
94
+ return Boolean(value && value !== MASK_CHAR_DELETE)
95
+ }
96
+
97
+ /**
98
+ * Returns the status by mask symbol and its position.
99
+ *
100
+ * Возвращает статус по символу маски и месту его расположения.
101
+ * @param char mask symbol/ символ маски
102
+ * @param value entered value for this position/ введённое значение для позиции
103
+ */
104
+ protected getStatus(char: string, value?: string): string {
105
+ if (this.isValue(value)) {
106
+ if (!this.special.isSpecial(char)) {
107
+ return 'standard'
108
+ }
109
+
110
+ if (this.validation.isError(char)) {
111
+ return 'error'
112
+ }
113
+
114
+ return 'special'
115
+ }
116
+
117
+ if (this.rubber.isTransition(char)) {
118
+ return 'transition'
119
+ }
120
+
121
+ return 'placeholder'
122
+ }
123
+
124
+ /**
125
+ * Returns symbol for rendering: real value or placeholder.
126
+ *
127
+ * Возвращает символ для отображения: реальное значение или плейсхолдер.
128
+ * @param char mask symbol/ символ маски
129
+ * @param value entered value for position/ введённое значение позиции
130
+ */
131
+ protected getValue(char: string, value?: string): string {
132
+ return this.isValue(value) ? value : this.getSpecialToView(char)
133
+ }
134
+
135
+ /**
136
+ * Returns display version of special mask symbol (placeholder).
137
+ *
138
+ * Возвращает отображаемую версию специального символа маски (плейсхолдер).
139
+ * @param char mask symbol/ символ маски
140
+ */
141
+ protected getSpecialToView(char: string): string {
142
+ if (this.special.isSpecial(char)) {
143
+ return this.getViewChar(char)
144
+ ?? this.special.getView(char)
145
+ ?? this.props.view
146
+ ?? MASK_VIEW_DEFAULT
147
+ }
148
+
149
+ return char
150
+ }
151
+
152
+ /**
153
+ * Returns special character for view by its group name.
154
+ *
155
+ * Возвращает специальный символ для отображения по имени группы.
156
+ * @param groupName group name/ имя группы
157
+ */
158
+ protected getViewChar(groupName: string): string | undefined {
159
+ if (this.type.isDate()) {
160
+ return this.date.getView(groupName)
161
+ }
162
+
163
+ if (this.type.isCurrencyOrNumber()) {
164
+ return this.format.view.value
165
+ }
166
+
167
+ return undefined
168
+ }
169
+ }
@@ -0,0 +1,49 @@
1
+ import type { GeoDate } from '@dxtmisha/functional'
2
+ import type { FieldPatternItemOrFunction, FieldValidationItem } from '../../types/fieldTypes'
3
+
4
+ export type MaskTypeItem = GeoDate
5
+ | 'text'
6
+ | 'number'
7
+ | 'number-format'
8
+ | 'currency'
9
+
10
+ export type MaskElementInput = HTMLInputElement | undefined
11
+ export type MaskMatchItem = RegExp | string
12
+ export type MaskFractionItem = string | boolean | number
13
+
14
+ export type MaskSpecialItem = {
15
+ defaultValue?: string
16
+ rubber?: boolean
17
+ transitionChar?: string | string[]
18
+ minLength?: number
19
+ maxLength?: number
20
+ match?: MaskMatchItem
21
+ pattern?: FieldPatternItemOrFunction
22
+ view?: string
23
+ }
24
+ export type MaskSpecialInfo = {
25
+ index: number
26
+ key: number
27
+ char: string
28
+ }
29
+ export type MaskSpecialList = Record<string, MaskSpecialItem>
30
+ export type MaskSpecialProp = string | string[] | MaskSpecialList
31
+
32
+ export type MaskViewItem = {
33
+ className: string
34
+ value: string
35
+ }
36
+ export type MaskViewList = MaskViewItem[]
37
+
38
+ export type MaskList = string | string[]
39
+
40
+ export type MaskEventData = FieldValidationItem
41
+ export type MaskEventSelection = {
42
+ target: HTMLInputElement
43
+ start: number
44
+ end: number
45
+ length: number
46
+ }
47
+
48
+ export const MASK_CHAR_DELETE = '~'
49
+ export const MASK_VIEW_DEFAULT = '_'
@@ -0,0 +1,5 @@
1
+ export * from './Mask'
2
+ export * from './MaskDesign'
3
+ export * from './props'
4
+ export * from './types'
5
+ export * from './basicTypes'
@@ -0,0 +1,29 @@
1
+ {
2
+ "color": {
3
+ "_type": "var"
4
+ },
5
+ "color-opacity": {
6
+ "_type": "var"
7
+ },
8
+ "caret-opacity": {
9
+ "_type": "var"
10
+ },
11
+ "#input": {},
12
+ "#character": {
13
+ "#item": {
14
+ "~placeholder": {}
15
+ }
16
+ },
17
+ "~visible": {
18
+ "_default": true
19
+ },
20
+ "~visiblePartly": {},
21
+ "~align": {
22
+ "~left": {},
23
+ "~right": {}
24
+ },
25
+ "~dir": {
26
+ "~ltr": {},
27
+ "~rtl": {}
28
+ }
29
+ }
@@ -0,0 +1,70 @@
1
+ import type { FieldPatternItemOrFunction } from '../../types/fieldTypes'
2
+ import type {
3
+ MaskFractionItem,
4
+ MaskList,
5
+ MaskMatchItem,
6
+ MaskSpecialProp,
7
+ MaskTypeItem
8
+ } from './basicTypes'
9
+
10
+ interface MaskPropsToken {
11
+ // :type [!] System label / Системная метка
12
+ visible?: boolean
13
+ visiblePartly?: boolean
14
+ align?: 'left' | 'right'
15
+ dir?: 'ltr' | 'rtl'
16
+ // :type [!] System label / Системная метка
17
+ }
18
+
19
+ export interface MaskPropsBasic {
20
+ // Value
21
+ name?: string
22
+ value?: string | number
23
+ valueDefault?: string | number
24
+ currency?: string
25
+ currencyHide?: boolean
26
+ fullOnly?: boolean
27
+
28
+ mask?: MaskList
29
+ special?: MaskSpecialProp
30
+ match?: MaskMatchItem
31
+ groupSave?: boolean
32
+
33
+ pattern?: FieldPatternItemOrFunction
34
+ check?: FieldPatternItemOrFunction
35
+ fraction?: MaskFractionItem
36
+
37
+ // Style
38
+ type?: MaskTypeItem
39
+ view?: string
40
+
41
+ inputAttrs?: Partial<HTMLInputElement>
42
+
43
+ language?: string
44
+ }
45
+
46
+ /**
47
+ * Type describing incoming properties.
48
+ *
49
+ * Тип, описывающий входящие свойства.
50
+ */
51
+ export interface MaskProps extends MaskPropsBasic, MaskPropsToken {
52
+ }
53
+
54
+ /**
55
+ * Default value for property.
56
+ *
57
+ * Значение по умолчанию для свойства.
58
+ */
59
+ export const defaultsMask = {
60
+ special: '*',
61
+ match: /[0-9]/,
62
+ type: 'text',
63
+ groupSave: true,
64
+ view: '_',
65
+ ...{
66
+ // :default [!] System label / Системная метка
67
+ visible: true
68
+ // :default [!] System label / Системная метка
69
+ }
70
+ }
@@ -0,0 +1,104 @@
1
+ @use "@dxtmisha/styles/properties" as ui;
2
+
3
+ @mixin mixinMask {
4
+ @include ui.initByCustom('sys.align', left);
5
+ @include ui.initByCustom('sys.align.flex', flex-start);
6
+ @include ui.initByCustom('sys.color', ui.v('??color', var(--sys-color, inherit)));
7
+ @include ui.initByCustom('sys.opacity', 0);
8
+ @include ui.initByCustom('sys.opacity.all', 0);
9
+
10
+ display: inline-block;
11
+
12
+ box-sizing: border-box;
13
+ position: relative;
14
+
15
+ text-align: ui.v('??sys.align');
16
+
17
+ &__input {
18
+ box-sizing: border-box;
19
+ position: absolute;
20
+ @include ui.inset(0);
21
+ z-index: 4;
22
+
23
+ padding: inherit;
24
+
25
+ width: 100%;
26
+
27
+ font: inherit;
28
+ line-height: inherit;
29
+ letter-spacing: inherit;
30
+ color: transparent;
31
+ @include ui.color(ui.v('??sys.color'), ui.v('??caretOpacity', 1), null, 'caret-color');
32
+ text-align: ui.v('??sys.align');
33
+
34
+ background: transparent;
35
+ border: none;
36
+
37
+ -webkit-tap-highlight-color: transparent;
38
+
39
+ &:focus {
40
+ outline: none !important;
41
+ }
42
+ }
43
+
44
+ &__character {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: ui.v('??sys.align.flex');
48
+ opacity: ui.v('??sys.opacity.all');
49
+ position: relative;
50
+ z-index: 8;
51
+ pointer-events: none;
52
+
53
+ &__item {
54
+ @include ui.color(ui.v('??sys.color'), ui.v('??colorOpacity', 1));
55
+ pointer-events: none;
56
+
57
+ &--placeholder {
58
+ opacity: ui.v('??sys.opacity');
59
+ }
60
+ }
61
+ }
62
+
63
+ &--visible {
64
+ @include ui.initByCustom('sys.opacity', 1);
65
+ @include ui.initByCustom('sys.opacity.all', 1);
66
+ }
67
+
68
+ &--visiblePartly {
69
+ @include ui.initByCustom('sys.opacity.all', 1);
70
+ }
71
+
72
+ &--value,
73
+ &:focus-within {
74
+ @include ui.initByCustom('sys.opacity.all', 1);
75
+
76
+ @include ui.subclass('input') {
77
+ &:-webkit-autofill {
78
+ -webkit-text-fill-color: transparent;
79
+ }
80
+ }
81
+ }
82
+
83
+ &--align {
84
+ &--right,
85
+ &--end {
86
+ @include ui.initByCustom('sys.align', ui.dirRight());
87
+ @include ui.initByCustom('sys.align.flex', flex-end);
88
+ }
89
+
90
+ &--left {
91
+ @include ui.initByCustom('sys.align', ui.dirLeft());
92
+ }
93
+
94
+ &--center {
95
+ @include ui.subclass('input') {
96
+ text-align: center;
97
+ }
98
+
99
+ @include ui.subclass('character') {
100
+ justify-content: center;
101
+ }
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,71 @@
1
+ import type { ComputedRef } from 'vue'
2
+ import type { ConstrClass } from '@dxtmisha/functional'
3
+ import type { FieldValidationItem } from '../../types/fieldTypes'
4
+
5
+ /**
6
+ * Interface for describing which components need to be connected for work.
7
+ *
8
+ * Интерфейс для описания, какие компоненты надо подключить для работы.
9
+ */
10
+ export type MaskComponents = {}
11
+
12
+ /**
13
+ * Type describing available events.
14
+ *
15
+ * Тип, описывающий доступные события.
16
+ */
17
+ export type MaskEmits = {
18
+ focus: [event: FocusEvent]
19
+ blur: [event: FocusEvent]
20
+ keydown: [event: KeyboardEvent]
21
+ keyup: [event: KeyboardEvent]
22
+ beforeinput: [event: InputEvent]
23
+ input: [
24
+ event: InputEvent,
25
+ value: FieldValidationItem
26
+ ]
27
+ inputLite: [value: FieldValidationItem]
28
+ change: [
29
+ event: InputEvent,
30
+ value: FieldValidationItem
31
+ ]
32
+ changeLite: [value: FieldValidationItem]
33
+ paste: [event: ClipboardEvent]
34
+ reset: [event: Event]
35
+ }
36
+
37
+ /**
38
+ * Type describing available properties.
39
+ *
40
+ * Тип, описывающий доступные свойства.
41
+ */
42
+ export interface MaskExpose {
43
+ valueBasic: ComputedRef<string>
44
+ value: ComputedRef<string>
45
+
46
+ setValue(value: string): boolean
47
+
48
+ clear(): boolean
49
+ }
50
+
51
+ /**
52
+ * Type describing available slots.
53
+ *
54
+ * Тип, описывающий доступные слоты.
55
+ */
56
+ export interface MaskSlots {
57
+ }
58
+
59
+ /**
60
+ * Type describing subclasses.
61
+ *
62
+ * Тип, описывающий подклассы.
63
+ */
64
+ export type MaskClasses = {
65
+ main: ConstrClass
66
+ // :classes [!] System label / Системная метка
67
+ input: string
68
+ character: string
69
+ characterItem: string
70
+ // :classes [!] System label / Системная метка
71
+ }
@@ -0,0 +1,179 @@
1
+ import { computed, type Ref, type ToRefs } from 'vue'
2
+ import { type ConstrEmit, DesignComp, ListData } from '@dxtmisha/functional'
3
+
4
+ import { EventClickInclude } from '../../classes/EventClickInclude'
5
+
6
+ import { BarsInclude } from '../Bars'
7
+ import { WindowInclude } from '../Window'
8
+
9
+ import { MenuRequest } from './MenuRequest'
10
+ import { MenuSearch } from './MenuSearch'
11
+
12
+ import { MenuWindow } from './MenuWindow'
13
+ import { MenuValue } from './MenuValue'
14
+
15
+ import type { MenuComponents, MenuEmits, MenuSlots } from './types'
16
+ import type { MenuProps } from './props'
17
+ import type { MenuControlBasic } from './basicTypes'
18
+ import type { ListPropsBasic } from '../List'
19
+ import type { EventClickValue } from '../../types/eventClickTypes'
20
+
21
+ /**
22
+ * Menu
23
+ */
24
+ export class Menu {
25
+ /** Request handler for list data/ Обработчик запросов данных списка */
26
+ readonly request: MenuRequest
27
+ /** Search helper for menu filtering/ Вспомогательный класс поиска для фильтрации меню */
28
+ readonly search: MenuSearch
29
+ /** Value manager for selected handling/ Менеджер выбранного значения */
30
+ readonly value: MenuValue
31
+
32
+ /** Data manager for list selection and mapping/ Менеджер данных списка для выбора и сопоставления */
33
+ readonly data: ListData
34
+
35
+ /** Include for working with the Bars component/ Подключение для работы с компонентом Bars */
36
+ readonly bars: BarsInclude
37
+ /** Include for working with the Window component/ Подключение для работы с компонентом Window */
38
+ readonly window: WindowInclude
39
+
40
+ /** Window manager for Menu/ Класс управления окном Menu */
41
+ readonly menuWindow: MenuWindow
42
+
43
+ /** Click event helper to unify click emissions/ Вспомогательный класс кликов для унифицированной отправки событий */
44
+ readonly event: EventClickInclude
45
+
46
+ /** Data for binding to controls/ Данные для привязки к контролам */
47
+ readonly slotData: MenuControlBasic
48
+
49
+ /**
50
+ * Constructor
51
+ * @param props input data/ входные данные
52
+ * @param refs input data in the form of reactive elements/ входные данные в виде реактивных элементов
53
+ * @param element input element/ элемент ввода
54
+ * @param classDesign design name/ название дизайна
55
+ * @param className class name/ название класса
56
+ * @param components object for working with components/ объект для работы с компонентами
57
+ * @param slots object for working with slots/ объект для работы со слотами
58
+ * @param emits the function is called when an event is triggered/ функция вызывается, когда срабатывает событие
59
+ */
60
+ constructor(
61
+ protected readonly props: MenuProps,
62
+ protected readonly refs: ToRefs<MenuProps>,
63
+ protected readonly element: Ref<HTMLElement | undefined>,
64
+ protected readonly classDesign: string,
65
+ protected readonly className: string,
66
+ protected readonly components?: DesignComp<MenuComponents, MenuProps>,
67
+ protected readonly slots?: MenuSlots,
68
+ protected readonly emits?: ConstrEmit<MenuEmits>
69
+ ) {
70
+ this.request = new MenuRequest(this.props)
71
+ this.search = new MenuSearch()
72
+ this.value = new MenuValue(this.props, this.refs, this.emits)
73
+
74
+ this.data = new ListData(
75
+ this.request.item,
76
+ undefined,
77
+ undefined,
78
+ undefined,
79
+ this.value.selected,
80
+ this.refs.keyValue,
81
+ this.refs.keyLabel
82
+ )
83
+
84
+ this.bars = new BarsInclude(
85
+ this.props,
86
+ this.className,
87
+ this.components,
88
+ this.emits
89
+ )
90
+
91
+ this.menuWindow = new MenuWindow(this.props, this.request)
92
+ this.window = new WindowInclude(
93
+ this.props,
94
+ this.className,
95
+ this.components,
96
+ this.emits,
97
+ this.menuWindow.getExtra()
98
+ )
99
+
100
+ this.event = new EventClickInclude(undefined, undefined, this.emits)
101
+
102
+ this.slotData = {
103
+ loading: this.request.progress,
104
+
105
+ isSelected: this.data.isSelected,
106
+ selectedList: this.data.selectedList,
107
+ selectedNames: this.data.selectedNames,
108
+ selectedValues: this.data.selectedValues
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Getting data for binding to the List component.
114
+ *
115
+ * Получение данных для привязки к компоненту List.
116
+ */
117
+ readonly binds = computed<ListPropsBasic>(() => {
118
+ return {
119
+ liteThreshold: this.props.liteThreshold,
120
+ keyLabel: this.props.keyLabel,
121
+ keyValue: this.props.keyValue,
122
+
123
+ tag: this.props.tag,
124
+ onClick: this.onClick,
125
+ onClose: this.window.expose.toClose,
126
+
127
+ control: true
128
+ }
129
+ })
130
+
131
+ /**
132
+ * Getting data for binding to controls.
133
+ *
134
+ * Получение данных для привязки к контролам.
135
+ * @returns data for binding to controls/ данные для привязки к контролам
136
+ */
137
+ getControlBinds(): MenuControlBasic {
138
+ return this.slotData
139
+ }
140
+
141
+ /**
142
+ * Click handler.
143
+ *
144
+ * Обработчик клика.
145
+ * @param event event object/ объект события
146
+ * @param options data object/ объект с данными
147
+ */
148
+ readonly onClick = (
149
+ event: MouseEvent,
150
+ options?: EventClickValue
151
+ ): void => {
152
+ if (
153
+ options
154
+ && 'value' in options
155
+ ) {
156
+ this.value.setValue(options.value)
157
+ }
158
+
159
+ this.event.onClick(event, options)
160
+ }
161
+
162
+ /**
163
+ * Click on the slot handler.
164
+ *
165
+ * Обработчик клика по слоту.
166
+ * @param event event object/ объект события
167
+ */
168
+ readonly onClickSlot = (event: Event) => {
169
+ const element = event.target as HTMLElement
170
+ const item = element.closest<HTMLElement>('*[data-value]')
171
+
172
+ if (
173
+ item
174
+ && !element.closest(`.${this.className}__list`)
175
+ ) {
176
+ this.emits?.('clickSlot', item.dataset.value)
177
+ }
178
+ }
179
+ }