@topvisor/ui 0.0.35 → 0.0.36

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 (266) hide show
  1. package/{src/components/forms/inputDate/datepicker.css → .chunks/datepicker-1e725859.amd.js} +3 -2
  2. package/.chunks/datepicker-1e725859.amd.js.map +1 -0
  3. package/.chunks/datepicker-ad465c48.es.js +275 -0
  4. package/.chunks/datepicker-ad465c48.es.js.map +1 -0
  5. package/.chunks/forms-2891e074.amd.js +3 -0
  6. package/.chunks/forms-2891e074.amd.js.map +1 -0
  7. package/.chunks/forms-db4cb24d.es.js +946 -0
  8. package/.chunks/forms-db4cb24d.es.js.map +1 -0
  9. package/.chunks/popup-0f540839.es.js +700 -0
  10. package/.chunks/popup-0f540839.es.js.map +1 -0
  11. package/.chunks/popup-e49a9bab.amd.js +341 -0
  12. package/.chunks/popup-e49a9bab.amd.js.map +1 -0
  13. package/README.md +63 -30
  14. package/common/common.amd.js +2 -0
  15. package/common/common.amd.js.map +1 -0
  16. package/common/common.js +2 -0
  17. package/common/common.js.map +1 -0
  18. package/core/core.amd.js +2 -0
  19. package/core/core.amd.js.map +1 -0
  20. package/core/core.js +6 -0
  21. package/core/core.js.map +1 -0
  22. package/core.css +1 -0
  23. package/dark.css +1 -0
  24. package/forms/forms.amd.js +2 -0
  25. package/forms/forms.amd.js.map +1 -0
  26. package/forms/forms.js +15 -0
  27. package/forms/forms.js.map +1 -0
  28. package/forms/helpers.amd.js +2 -0
  29. package/forms/helpers.amd.js.map +1 -0
  30. package/forms/helpers.js +9 -0
  31. package/forms/helpers.js.map +1 -0
  32. package/forms.css +1 -0
  33. package/formsExt/formsExt.amd.js +3 -0
  34. package/formsExt/formsExt.amd.js.map +1 -0
  35. package/formsExt/formsExt.js +207 -0
  36. package/formsExt/formsExt.js.map +1 -0
  37. package/formsExt.css +1 -0
  38. package/light.css +1 -0
  39. package/package.json +1 -50
  40. package/popup/popup.amd.js +3 -0
  41. package/popup/popup.amd.js.map +1 -0
  42. package/popup/popup.js +144 -0
  43. package/popup/popup.js.map +1 -0
  44. package/popup/worker.amd.js +2 -0
  45. package/popup/worker.amd.js.map +1 -0
  46. package/popup/worker.js +154 -0
  47. package/popup/worker.js.map +1 -0
  48. package/popup.css +1 -0
  49. package/tabs/tabs.amd.js +3 -0
  50. package/tabs/tabs.amd.js.map +1 -0
  51. package/tabs/tabs.js +97 -0
  52. package/tabs/tabs.js.map +1 -0
  53. package/tabs.css +1 -0
  54. package/utils/date.amd.js +2 -0
  55. package/utils/date.amd.js.map +1 -0
  56. package/utils/date.js +6 -0
  57. package/utils/date.js.map +1 -0
  58. package/utils/device.amd.js +2 -0
  59. package/utils/device.amd.js.map +1 -0
  60. package/utils/device.js +6 -0
  61. package/utils/device.js.map +1 -0
  62. package/utils/dom.amd.js +2 -0
  63. package/utils/dom.amd.js.map +1 -0
  64. package/utils/dom.js +64 -0
  65. package/utils/dom.js.map +1 -0
  66. package/.storybook/TopTheme.js +0 -82
  67. package/.storybook/TopThemeManager.js +0 -44
  68. package/.storybook/main.ts +0 -43
  69. package/.storybook/manager.ts +0 -28
  70. package/.storybook/preview-head.html +0 -16
  71. package/.storybook/preview.ts +0 -48
  72. package/.storybook/vue/coreDecorator.ts +0 -19
  73. package/.storybook/vue/vModelDecorator.ts +0 -27
  74. package/.vscode/extensions.json +0 -11
  75. package/.vscode/keybindings.example.json +0 -121
  76. package/.vscode/settings.json +0 -46
  77. package/Dockerfile +0 -3
  78. package/NPM.md +0 -25
  79. package/PUBLISH.md +0 -18
  80. package/STORYBOOK.md +0 -27
  81. package/USE_IN_PROJECT.md +0 -29
  82. package/build/afterBuild.sh +0 -12
  83. package/build/cssModules.ts +0 -39
  84. package/build/plugin/amdFix.ts +0 -46
  85. package/build/rollup.config.ts +0 -18
  86. package/nbproject/project.properties +0 -11
  87. package/nbproject/project.xml +0 -9
  88. package/public/README.md +0 -63
  89. package/src/components/common/common.ts +0 -1
  90. package/src/components/common/icon/icon.ts +0 -4
  91. package/src/components/common/icon/icon.vue +0 -15
  92. package/src/components/component.ts +0 -133
  93. package/src/components/forms/button/button.stories.ts +0 -112
  94. package/src/components/forms/button/button.ts +0 -51
  95. package/src/components/forms/button/button.vue +0 -75
  96. package/src/components/forms/button/stories/README.md +0 -35
  97. package/src/components/forms/button/stories/overview.vue +0 -33
  98. package/src/components/forms/button/style/button.css +0 -124
  99. package/src/components/forms/button/style/style-outline.css +0 -42
  100. package/src/components/forms/button/style/style-soft.css +0 -31
  101. package/src/components/forms/button/style/style-transparent.css +0 -35
  102. package/src/components/forms/checkbox/checkbox.stories.ts +0 -33
  103. package/src/components/forms/checkbox/checkbox.ts +0 -23
  104. package/src/components/forms/checkbox/checkbox.vue +0 -135
  105. package/src/components/forms/checkbox/stories/overview.vue +0 -171
  106. package/src/components/forms/controlLabel/controlLabel.stories.ts +0 -38
  107. package/src/components/forms/controlLabel/controlLabel.ts +0 -4
  108. package/src/components/forms/controlLabel/controlLabel.vue +0 -48
  109. package/src/components/forms/forms.ts +0 -10
  110. package/src/components/forms/helpers.ts +0 -10
  111. package/src/components/forms/hint/hint.stories.ts +0 -46
  112. package/src/components/forms/hint/hint.ts +0 -8
  113. package/src/components/forms/hint/hint.vue +0 -32
  114. package/src/components/forms/input/input.stories.ts +0 -31
  115. package/src/components/forms/input/input.ts +0 -34
  116. package/src/components/forms/input/input.vue +0 -170
  117. package/src/components/forms/input/stories/overview.vue +0 -61
  118. package/src/components/forms/inputDate/datepicker.ts +0 -101
  119. package/src/components/forms/inputDate/inputDate.stories.ts +0 -41
  120. package/src/components/forms/inputDate/inputDate.ts +0 -4
  121. package/src/components/forms/inputDate/inputDate.vue +0 -127
  122. package/src/components/forms/inputDate/stories/overview.vue +0 -35
  123. package/src/components/forms/radio/radio.stories.ts +0 -34
  124. package/src/components/forms/radio/radio.ts +0 -15
  125. package/src/components/forms/radio/radio.vue +0 -107
  126. package/src/components/forms/radio/stories/overview.vue +0 -79
  127. package/src/components/forms/select/select.stories.ts +0 -34
  128. package/src/components/forms/select/select.ts +0 -36
  129. package/src/components/forms/select/select.vue +0 -253
  130. package/src/components/forms/select/stories/exampleOptions.ts +0 -71
  131. package/src/components/forms/select/stories/overview.vue +0 -60
  132. package/src/components/forms/switcher/stories/overview.vue +0 -139
  133. package/src/components/forms/switcher/switcher.stories.ts +0 -33
  134. package/src/components/forms/switcher/switcher.ts +0 -22
  135. package/src/components/forms/switcher/switcher.vue +0 -113
  136. package/src/components/forms/textarea/stories/overview.vue +0 -62
  137. package/src/components/forms/textarea/textarea.stories.ts +0 -33
  138. package/src/components/forms/textarea/textarea.ts +0 -38
  139. package/src/components/forms/textarea/textarea.vue +0 -119
  140. package/src/components/formsExt/editArea/editArea.stories.ts +0 -72
  141. package/src/components/formsExt/editArea/editArea.ts +0 -25
  142. package/src/components/formsExt/editArea/editArea.vue +0 -172
  143. package/src/components/formsExt/editArea/stories/README.md +0 -17
  144. package/src/components/formsExt/editArea/stories/overview.vue +0 -66
  145. package/src/components/formsExt/editInput/editInput.stories.ts +0 -36
  146. package/src/components/formsExt/editInput/editInput.ts +0 -20
  147. package/src/components/formsExt/editInput/editInput.vue +0 -57
  148. package/src/components/formsExt/editInput/stories/overview.vue +0 -54
  149. package/src/components/formsExt/formsExt.ts +0 -3
  150. package/src/components/formsExt/radioGroup/radioGroup.stories.ts +0 -51
  151. package/src/components/formsExt/radioGroup/radioGroup.ts +0 -28
  152. package/src/components/formsExt/radioGroup/radioGroup.vue +0 -143
  153. package/src/components/formsExt/radioGroup/stories/overview.vue +0 -78
  154. package/src/components/formsExt/radioGroup/styles/top-scrollBar.css +0 -52
  155. package/src/components/helper.js +0 -10
  156. package/src/components/helpersStories.ts +0 -151
  157. package/src/components/popup/lib/popup.globalEvents.js +0 -205
  158. package/src/components/popup/lib/popup.js +0 -702
  159. package/src/components/popup/lib/worker.globalEvents.js +0 -78
  160. package/src/components/popup/lib/worker.js +0 -232
  161. package/src/components/popup/popup/listItem.vue +0 -42
  162. package/src/components/popup/popup/opener.vue +0 -74
  163. package/src/components/popup/popup/popup.stories.ts +0 -68
  164. package/src/components/popup/popup/popup.ts +0 -93
  165. package/src/components/popup/popup/popup.vue +0 -95
  166. package/src/components/popup/popup/stories/README.md +0 -34
  167. package/src/components/popup/popup/stories/listItems.vue +0 -44
  168. package/src/components/popup/popup/stories/listSubItems.vue +0 -52
  169. package/src/components/popup/popup/stories/overview.vue +0 -208
  170. package/src/components/popup/popup/style/popup.css +0 -243
  171. package/src/components/popup/popup/style/popup.m.css +0 -71
  172. package/src/components/popup/popup/style/popup.pc.css +0 -28
  173. package/src/components/popup/popup.ts +0 -3
  174. package/src/components/popup/worker.ts +0 -1
  175. package/src/components/tabs/tabs/content.vue +0 -24
  176. package/src/components/tabs/tabs/stories/README.md +0 -10
  177. package/src/components/tabs/tabs/tab.vue +0 -52
  178. package/src/components/tabs/tabs/tabs.stories.ts +0 -171
  179. package/src/components/tabs/tabs/tabs.ts +0 -22
  180. package/src/components/tabs/tabs/tabs.vue +0 -64
  181. package/src/components/tabs/tabs.ts +0 -3
  182. package/src/core/base/Colors.stories.ts +0 -15
  183. package/src/core/base/Layout.stories.ts +0 -15
  184. package/src/core/base/Properties.stories.ts +0 -15
  185. package/src/core/base/base.mdx +0 -21
  186. package/src/core/core/core.ts +0 -144
  187. package/src/core/core/events.ts +0 -54
  188. package/src/core/core/options.ts +0 -15
  189. package/src/core/core/state.ts +0 -44
  190. package/src/core/directives/tooltip.ts +0 -55
  191. package/src/core/theme/Colors.stories.ts +0 -15
  192. package/src/core/theme/Properties.stories.ts +0 -15
  193. package/src/core/theme/theme.mdx +0 -15
  194. package/src/core/utils/date.ts +0 -164
  195. package/src/core/utils/device.ts +0 -48
  196. package/src/core/utils/dom.ts +0 -185
  197. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272/gallery.vue" +0 -72
  198. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.mdx" +0 -31
  199. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.stories.ts" +0 -14
  200. package/src/docs/CSS/FAQ.mdx +0 -43
  201. package/src/docs/CSS//320/236/320/261/321/211/320/270/320/265 /320/274/320/276/320/264/320/270/321/204/320/270/320/272/320/260/321/202/320/276/321/200/321/213.mdx" +0 -156
  202. package/src/docs/CSS//320/237/320/265/321/200/320/265/320/274/320/265/320/275/320/275/321/213/320/265.mdx +0 -47
  203. package/src/docs/CSS//320/237/321/200/320/265/320/264/320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/321/200/321/213.mdx +0 -15
  204. package/src/docs/CSS//320/240/320/265/320/272/320/276/320/274/320/265/320/275/320/264/320/260/321/206/320/270/320/270 /320/221/320/255/320/234.mdx" +0 -49
  205. package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.md +0 -53
  206. package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.mdx +0 -4
  207. package/src/docs/CSS//320/247/321/202/320/276 /321/202/320/260/320/272/320/276/320/265 css /320/274/320/276/320/264/321/203/320/273/321/214.mdx" +0 -53
  208. package/src/docs/ROADMAP.md +0 -17
  209. package/src/docs/Roadmap.mdx +0 -4
  210. package/src/docs//320/222/320/262/320/265/320/264/320/265/320/275/320/270/320/265 /320/262 Storybook.mdx" +0 -323
  211. package/src/docs//320/232/320/276/320/274/320/277/320/276/320/275/320/265/320/275/321/202/321/213.mdx +0 -20
  212. package/src/docs//320/237/320/276/320/273/320/265/320/267/320/275/320/260/321/217 /320/270/320/275/321/204/320/276/321/200/320/274/320/260/321/206/320/270/321/217.mdx" +0 -8
  213. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260/IDE.mdx" +0 -42
  214. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/233/320/270/320/275/321/202/320/265/321/200.mdx" +0 -72
  215. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260.mdx" +0 -29
  216. package/src/globals.d.ts +0 -1
  217. package/src/resources/styles/core/colors.css +0 -204
  218. package/src/resources/styles/core/components.css +0 -70
  219. package/src/resources/styles/core/core.ts +0 -10
  220. package/src/resources/styles/core/forms/clear.css +0 -19
  221. package/src/resources/styles/core/forms/controls.css +0 -20
  222. package/src/resources/styles/core/forms/focusable.css +0 -26
  223. package/src/resources/styles/core/forms/forms.css +0 -100
  224. package/src/resources/styles/core/icon.css +0 -58
  225. package/src/resources/styles/core/layout.css +0 -40
  226. package/src/resources/styles/core/modifiers/as.css +0 -9
  227. package/src/resources/styles/core/modifiers/ellipsis.css +0 -18
  228. package/src/resources/styles/core/modifiers/modifiers.css +0 -81
  229. package/src/resources/styles/core/modifiers/only.css +0 -19
  230. package/src/resources/styles/core/select.css +0 -16
  231. package/src/resources/styles/jquery-ui.min.css +0 -6
  232. package/src/resources/styles/storybook.css +0 -11
  233. package/src/resources/styles/themes/dark/theme.css +0 -139
  234. package/src/resources/styles/themes/dark.ts +0 -1
  235. package/src/resources/styles/themes/light/theme.css +0 -139
  236. package/src/resources/styles/themes/light.ts +0 -1
  237. package/src/storybook/components/color.vue +0 -45
  238. package/src/storybook/components/colors.vue +0 -34
  239. package/src/storybook/components/icomoon.ts +0 -38
  240. package/src/storybook/components/properties.vue +0 -82
  241. package/src/storybook/resources/accessibility.png +0 -0
  242. package/src/storybook/resources/accessibility.svg +0 -5
  243. package/src/storybook/resources/addon-library.png +0 -0
  244. package/src/storybook/resources/assets.png +0 -0
  245. package/src/storybook/resources/context.png +0 -0
  246. package/src/storybook/resources/discord.svg +0 -15
  247. package/src/storybook/resources/docs.png +0 -0
  248. package/src/storybook/resources/figma-plugin.png +0 -0
  249. package/src/storybook/resources/github.svg +0 -3
  250. package/src/storybook/resources/share.png +0 -0
  251. package/src/storybook/resources/styling.png +0 -0
  252. package/src/storybook/resources/testing.png +0 -0
  253. package/src/storybook/resources/theming.png +0 -0
  254. package/src/storybook/resources/tutorials.svg +0 -12
  255. package/src/storybook/resources/youtube.svg +0 -4
  256. package/src//320/224/320/276/320/261/321/200/320/276 /320/277/320/276/320/266/320/260/320/273/320/276/320/262/320/260/321/202/321/214.mdx" +0 -3
  257. package/tsconfig.json +0 -62
  258. package/vite.config.ts +0 -91
  259. /package/{src/resources/icomoon → icomoon}/demo-files/demo.css +0 -0
  260. /package/{src/resources/icomoon → icomoon}/demo-files/demo.js +0 -0
  261. /package/{src/resources/icomoon → icomoon}/demo.html +0 -0
  262. /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.svg +0 -0
  263. /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.ttf +0 -0
  264. /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.woff +0 -0
  265. /package/{src/resources/icomoon → icomoon}/selection.json +0 -0
  266. /package/{src/resources/icomoon → icomoon}/style.css +0 -0
@@ -1,702 +0,0 @@
1
- // добавляет jQuery события на this.el, если jQuery загружен:
2
- // aftershow.top-menu-popup
3
- // afterclose.top-menu-popup
4
-
5
- import Core from '@/core/core/core';
6
- import Component from '@/components/component';
7
- import DOM from '@/core/utils/dom';
8
- import Worker from '@/components/popup/lib/worker';
9
- import GlobalEvents from '@/components/popup/lib/popup.globalEvents';
10
-
11
- import css from '@/components/popup/popup/style/popup.css?raw';
12
- import cssM from '@/components/popup/popup/style/popup.m.css?raw';
13
- import cssPC from '@/components/popup/popup/style/popup.pc.css?raw';
14
-
15
- Core.appendStyle(css);
16
- Core.appendStyle(cssM, 'm');
17
- Core.appendStyle(cssPC, 'pc');
18
-
19
- /**
20
- * @property {Element} el - элемент, вызвавший открытие Popup
21
- * @property {Element} elPopup - Popup .top-popup-wrapper
22
- * @property {Element} elPopupInner - контентная часть Popup .top-popup
23
- * @property {Element} elPopupHeader
24
- * @property {Element} elPopupBody
25
- * @property {Element} elPopupFooter
26
- */
27
- class Popup extends Component {
28
-
29
- static componentName = 'Popup';
30
-
31
- el; // элемент, вызвавший открытие Popup
32
- elActiveByDefault; // элемент уже имеет класс top-active перед открытием окна
33
- elPopup;
34
- elPopupInner;
35
- elPopupHeader;
36
- elPopupBody;
37
- elPopupFooter;
38
- elFront;
39
-
40
- popupParent;
41
-
42
- $; // только, если есть jQuery
43
-
44
- elStartPosition; // используется для useOriginal
45
- shift = {
46
- top: 0,
47
- left: 0,
48
- };
49
- isClosed = false; // флаг того, что меню закрыто
50
- isFirstClick = true;
51
- type; // selector или html
52
-
53
- options = {
54
- popup: '', // selector, text
55
- p: 0, // положение меню (0 - над элементом, 1 - сверху, 2 - справа, 3 - снизу, 4 слева)
56
- notch: false, // отображать ли клювик
57
-
58
- class: '', // класс, добавляемый меню
59
-
60
- posBy: 'left', // способ привязки позиционирования меню (left/right - левый/правый край родителя, fixed - по окну)
61
- frontSelector: '',
62
- invertX: false, // базовая ордината - правая граница элемента, а не левая
63
- openByHover: false, // открывать при наведении
64
-
65
- useOriginal: false, // использовать оригинальный шаблон, без клонирвоания (для сохранения состояния меню)
66
-
67
- isFullScreen: false,
68
- i18n: {},
69
- };
70
-
71
- events = {};
72
-
73
- // el - элемент, открывающий меню
74
- constructor(el, options) {
75
- super();
76
-
77
- return this.init(Popup.componentName, el, options);
78
- }
79
-
80
- async mount() {
81
- const vueConnector = this.vueGetComponent();
82
-
83
- this.popupParent = Worker.getPopup(this.el.closest('.top-popup-wrapper'));
84
-
85
- await this.mountJQuery();
86
-
87
- if (DOM.css(this.el, 'position') !== 'absolute') {
88
- this.el.style.position = 'relative';
89
- }
90
-
91
- this.el.dataset.topPopupOpened = 'opened';
92
- this.elActiveByDefault = this.el.classList.contains('top-active');
93
- this.el.classList.add('top-active');
94
-
95
- if (vueConnector) {
96
- // компонент vue Popup
97
- this.type = 'vue';
98
-
99
- this.options.popup = '';
100
- this.elPopup = DOM.genEl('div', {}, this.options.popup);
101
- } else if (this.options.popup.match(/^[#.]/)) {
102
- // selector
103
- this.type = 'selector';
104
-
105
- this.elPopup = document.querySelector(`${this.options.popup}.template`);
106
- } else {
107
- // html
108
- this.type = 'html';
109
-
110
- if (this.options.useOriginal) {
111
- throw ('Option useOriginal not allowed for text templates');
112
- }
113
-
114
- this.elPopup = DOM.genEl('div', {}, this.options.popup);
115
- }
116
-
117
- if (!this.elPopup || vueConnector?.opened) {
118
- // возможно шаблон не найден, так как он используется в уже открытом меню
119
- if (this.options.useOriginal || vueConnector?.opened) {
120
- // закрыть открытое меню
121
- if (vueConnector?.opened) {
122
- this.elPopup = vueConnector.popup.elPopup;
123
- } else {
124
- this.elPopup = document.querySelector(`${this.options.popup}.top-popup-wrapper-shown`);
125
- }
126
-
127
- if (this.elPopup) {
128
- this.el.dataset.topPopupOpened = '';
129
-
130
- if (!this.elActiveByDefault) {
131
- this.el.classList.remove('top-active');
132
- }
133
-
134
- Worker.close(this.elPopup);
135
-
136
- // повторит попытку открыть меню
137
- setTimeout(() => this.mount(), 300);
138
-
139
- return;
140
- }
141
-
142
- throw ('Option useOriginal state allowed only elements .template');
143
- }
144
-
145
- // возможно вместо шаблона используется другой элемент
146
- this.elPopup = document.querySelector(`${this.options.popup}:not(.top-popup-wrapper)`);
147
- }
148
-
149
- if (!this.elPopup) {
150
- return;
151
- }
152
-
153
- if (this.options.useOriginal) {
154
- this.elStartPosition = this.elPopup.closest('.top-popup-el-start-position');
155
- if (!this.elStartPosition) {
156
- this.elStartPosition = DOM.wrap(this.elPopup, 'i');
157
- this.elStartPosition.classList.add('top-popup-el-start-position', 'hidden');
158
- }
159
- } else {
160
- this.elPopup = this.elPopup.cloneNode(true);
161
-
162
- // вывод в меню копии произвольного элемента
163
- if (this.type === 'selector' && !this.elPopup.matches('.template')) {
164
- this.elPopup.classList.remove('hidden');
165
-
166
- if (!this.elPopup.querySelector(':scope > .top-popup_content')) {
167
- this.elPopup.classList.add('top-popup_content');
168
- }
169
-
170
- this.elPopup = DOM.wrap(this.elPopup, 'div');
171
- }
172
-
173
- if (this.type === 'html') {
174
- if (!this.elPopup.querySelector(':scope > .top-popup_content')) {
175
- this.elPopup.classList.add('top-popup_content');
176
-
177
- this.elPopup = DOM.wrap(this.elPopup, 'div');
178
- }
179
- }
180
-
181
- // вложенный Popup
182
- if (this.type === 'selector' && !this.elPopup.matches('.template') || this.type === 'html' || this.type === 'vue') {
183
- DOM.querySelectorAllArray(this.elPopup, '[data-top-popup]').forEach(el => el.dataset.topPopupPosBy = 'fixed');
184
- DOM.querySelectorAllArray(this.elPopup, '.top-popup-wrapper').forEach(el => el.remove());
185
- }
186
- }
187
-
188
- Worker.decoratorBeforeOpen(this);
189
-
190
- if (vueConnector) {
191
- this.options.class = vueConnector.classRef.value;
192
- }
193
-
194
- this.elPopupInner = document.createElement('div');
195
- this.elPopupInner.classList.add('top-popupPanel', 'top-popup');
196
-
197
- while (this.elPopup.firstChild) {
198
- this.elPopupInner.appendChild(this.elPopup.firstChild);
199
- }
200
-
201
- this.elPopup.append(this.elPopupInner);
202
-
203
- this.elPopup.classList.add('top-popup-wrapper');
204
-
205
- if (this.options.class) {
206
- const classes = this.options.class.split(' ');
207
- this.elPopup.classList.add(...classes);
208
- }
209
-
210
- if (this.options.notch) {
211
- this.elPopup.classList.add('with_notch');
212
- this.elPopup.insertAdjacentHTML('beforeend', '<i class="notch notch-border"></i><i class="notch"></i>');
213
- }
214
-
215
- await this.vueOpen();
216
-
217
- this.elPopupHeader = this.elPopupInner.querySelector('.top-popup_header');
218
- this.elPopupBody = this.elPopupInner.querySelector('.top-popup_content');
219
- this.elPopupFooter = this.elPopupInner.querySelector('.top-popup_footer');
220
-
221
- const existsWidgetSearch = !!this.elPopup.querySelector('[data-widget="search"]');
222
-
223
- if (this.options.isFullScreen && !existsWidgetSearch) {
224
- if (!this.elPopupHeader) {
225
- this.elPopupHeader = DOM.genEl('i', { class: 'top-popup_header' });
226
- this.elPopupInner.prepend(this.elPopupHeader);
227
-
228
- this.elPopupHeader.prepend(DOM.genEl('i', { class: 'a closer' }, this.options.i18n.Close));
229
- this.elPopupHeader.append(DOM.genEl('i', { class: 'top-popup_headerButton' }));
230
- }
231
- }
232
-
233
- DOM.storage(this.elPopup, 'Popup', this);
234
-
235
- if (this.options.frontSelector) {
236
- this.elFront = document.querySelector(this.options.frontSelector);
237
- }
238
- if (!this.elFront) {
239
- this.elFront = this.el.closest('.top-popup-front');
240
- }
241
- if (!this.elFront) {
242
- this.elFront = document.body;
243
- }
244
-
245
- this.elPopup.style.width = this.el.offsetWidth + 'px';
246
- this.elPopup.style.height = this.el.offsetHeight + 'px';
247
- this.elPopup.style.top = this.el.offsetTop + 'px';
248
- this.elPopup.style.right = parseInt(this.el.style.right || 0) + 'px';
249
- this.elPopup.style.bottom = parseInt(this.el.style.bottom || 0) + 'px';
250
-
251
- this.el.parentElement.insertBefore(this.elPopup, this.el);
252
- this.elPopup.classList.remove('template');
253
-
254
- if (this.options.invertX) {
255
- this.elPopup.classList.add('invert-x');
256
- }
257
-
258
- let fromTop = !!this.el.closest('.modal-header');
259
- if (!fromTop) {
260
- fromTop = !!this.el.closest('#top_panel');
261
- }
262
- if (!fromTop) {
263
- fromTop = !!this.el.closest('#secondmenu');
264
- }
265
- if (fromTop) {
266
- this.elPopup.classList.add('p-from-top');
267
- }
268
-
269
- // появление с анимацией
270
- setTimeout(() => this.elPopup.classList.add('top-popup-wrapper-shown'));
271
-
272
- if (this.elFront && !this.elFront.matches('body')) {
273
- this.elFront.append(this.elPopup);
274
-
275
- this.shift.top = DOM.offset(this.el).top - this.el.offsetTop - DOM.offset(this.elFront).top;
276
- this.shift.left = DOM.offset(this.el).left - this.el.offsetLeft - DOM.offset(this.elFront).left;
277
-
278
- // position() не учитывает margin, замечено для flex
279
- this.shift.top -= parseInt(this.el.style['margin-top'] || 0);
280
- this.shift.left -= parseInt(this.el.style['margin-left'] || 0);
281
-
282
- this.elPopup.style.top = parseInt(this.elPopup.style.top || '0') + this.shift.top + 'px';
283
- this.elPopup.style.left = parseInt(this.elPopup.style.left || '0') + this.shift.left + 'px';
284
- }
285
-
286
- if (this.$) {
287
- this.$.trigger('aftershow.top-menu-popup', [jQuery(this.elPopup)]);
288
- }
289
-
290
- this.recalcPosition();
291
-
292
- this.elPopup.setAttribute('tabindex', 0);
293
- this.focus();
294
-
295
- Worker.decoratorAfterOpen(this);
296
-
297
- this.mountEvents();
298
- }
299
-
300
- async mountJQuery() {
301
- if (typeof (jQuery) !== 'function') {
302
- return;
303
- }
304
-
305
- this.$ = jQuery(this.el);
306
- }
307
-
308
- /**
309
- * Выполнить фокусировку на нужный элемент после открытия окна
310
- */
311
- focus() {
312
- let el = DOM.querySelectorVisible(this.elPopup, '.top-popup-autofocus');
313
-
314
- // поле ввода
315
- if (!el) {
316
- el = DOM.querySelectorVisible(this.elPopup, ':read-write, select:not(:disabled)');
317
- }
318
-
319
- // кнопка
320
- if (!el) {
321
- el = DOM.querySelectorVisible(this.elPopup, '.top-popup_footer .top-button');
322
- }
323
-
324
- if (!el) {
325
- el = this.elPopup;
326
- }
327
-
328
- el.focus();
329
- }
330
-
331
- mountEvents() {
332
- // закрытие при клике вне контекстного меню
333
- this.addEventListenerWithUnmount(document, 'mousedown', (e) => this.onMousedown(e));
334
-
335
- // закрыть другие меню
336
- this.addEventListenerWithUnmount(this.elPopup, 'focus', (e) => this.onFocus(e));
337
-
338
- // автоматическое закрытие при отведении мыши
339
- if (this.options.openByHover) {
340
- this.addEventListenerWithUnmount(this.elPopup, 'mouseleave', (e) => this.onMouseleave(e));
341
- this.addEventListenerWithUnmount(this.elPopupInner, 'mouseleave', (e) => this.onMouseleave(e));
342
- }
343
-
344
- // не скроллить страницу
345
- if (this.options.isFullScreen) {
346
- this.addEventListenerWithUnmount(this.elPopupBody, 'touchmove', (e) => this.onTouchmove(e));
347
- }
348
- }
349
-
350
- /**
351
- * Обработка клика вне окна
352
- * @param {Event} e
353
- */
354
- onMousedown(e) {
355
- // // не оригинальное событие
356
- // if (!e || !e.originalEvent || !e.originalEvent.isTrusted) {
357
- // return;
358
- // }
359
-
360
- // Popup уже закрыт
361
- if (!this.elPopup) {
362
- return;
363
- }
364
-
365
- // клик на внешнем элементе
366
- if (!this.isFirstClick) {
367
- return;
368
- }
369
-
370
- this.isFirstClick = false;
371
- setTimeout(() => this.isFirstClick = true);
372
-
373
- // клик не основной кнопкой мыши
374
- if (e.button !== 0) {
375
- return;
376
- }
377
-
378
- // открыто другое меню с posBy = fixed, сначала должно быть закрыто оно
379
- let elPopupOpened = DOM.querySelectorVisibleLast(document.body, ':scope > .top-popup-wrapper');
380
- if (elPopupOpened && elPopupOpened !== this.elPopup) {
381
- return;
382
- }
383
-
384
- // открыто другое меню в top-popup-front, сначала должно быть закрыто оно
385
- elPopupOpened = DOM.querySelectorVisibleLast(e.target.closest('.top-popup-front'), ':scope > .top-popup-wrapper');
386
- if (elPopupOpened && elPopupOpened !== this.elPopup) {
387
- return;
388
- }
389
-
390
- // клик внутри этого меню
391
- if (this.elPopup.contains(e.target)) {
392
- return;
393
- }
394
-
395
- // клик вне родительского диалогового окна
396
- if (this.elPopup.closest('.ui-dialog') && !e.target.closest('.ui-dialog')) {
397
- return;
398
- }
399
-
400
- if (Worker.decoratorIsIgnoreOuterClick(e)) {
401
- return;
402
- }
403
-
404
- Worker.close(this.elPopup);
405
- }
406
-
407
- /**
408
- * Закрыть другие Popup при фокусе на элемент формы в текущем
409
- * @param {Event} e
410
- */
411
- onFocus(e) {
412
- if (e.target.matches('input')) {
413
- return;
414
- }
415
-
416
- // // не оригинальное событие
417
- // if (!e || !e.originalEvent || !e.originalEvent.isTrusted) {
418
- // return;
419
- // }
420
-
421
- // это окно уже закрывается
422
- if (this.isClosed) {
423
- return;
424
- }
425
-
426
- const elsPopups = Worker.getAllVisible();
427
- elsPopups.forEach(elPopup => {
428
- // фокус внутри этого окна
429
- if (this.elPopup.contains(elPopup)) {
430
- return;
431
- }
432
-
433
- // это Popup из которого был открыт Popup с фокусом
434
- // глубина вложенности: до 3 подменю
435
- if (
436
- this.popupParent?.elPopup === elPopup ||
437
- this.popupParent?.popupParent?.elPopup === elPopup
438
- ) {
439
- return;
440
- }
441
-
442
- Worker.close(elPopup);
443
- });
444
- }
445
-
446
- /**
447
- * Закрыть Popup при отведении мыши
448
- * @param {Event} _e
449
- */
450
- onMouseleave(_e) {
451
- setTimeout(() => {
452
- if (this.elPopupInner.matches(':hover')) {
453
- return;
454
- }
455
-
456
- Worker.close(this.elPopup);
457
- }, 100);
458
- }
459
-
460
- /**
461
- * Контроль положения Popup при fixed позиционировании
462
- */
463
- onResize() {
464
- // на android при вызове метода append сбрасывается фокус с input внутри this.elPopup
465
- if (this.elPopup.parentElement !== document.body) {
466
- document.body.append(this.elPopup);
467
- }
468
-
469
- this.elPopup.style.top = DOM.offset(this.el).top + 'px';
470
- this.elPopup.style.left = DOM.offset(this.el).left + 'px';
471
- }
472
-
473
- unmount() {
474
- super.unmount();
475
-
476
- this.el.dataset.topPopupOpened = '';
477
- if (!this.elActiveByDefault) {
478
- this.el.classList.remove('top-active');
479
- }
480
-
481
- let style = this.el.getAttribute('style');
482
- if (style) {
483
- style = style.replace(/position:[^;]*;?/g, '');
484
- this.el.setAttribute('style', style);
485
- }
486
- }
487
-
488
- // контроль за положением Popup, чтобы оно не вылезало за пределы документа
489
- recalcPosition() {
490
- let p = this.options.p;
491
- let leftPos;
492
-
493
- this.elPopup.style.height = this.el.offsetHeight + 'px';
494
-
495
- this.elPopup.classList.remove('p0', 'p1', 'p2', 'p3', 'p4');
496
- this.elPopup.classList.add('p' + p);
497
-
498
- switch (this.options.posBy) {
499
- case 'left':
500
- leftPos = this.el.offsetLeft + parseInt(this.el.style['margin-left'] || 0);
501
- leftPos += this.shift.left;
502
- this.elPopup.style.left = leftPos + 'px';
503
-
504
- break;
505
- case 'right':
506
- leftPos = this.el.offsetLeft + parseInt(this.el.style['margin-left'] || 0);
507
- this.elPopup.style.right = this.el.offsetParent.offsetWidth - this.el.offsetWidth - leftPos + 'px';
508
-
509
- break;
510
- case 'fixed':
511
- this.addEventListenerWithUnmount(window, 'resize', () => this.onResize());
512
-
513
- this.onResize();
514
-
515
- break;
516
- default:
517
- this.options.posBy.append(this.elPopup);
518
- }
519
-
520
- // контроль за пложением Popup, чтобы оно не вылезало за пределы документа
521
- const boundingClientRect = this.elPopup.getBoundingClientRect();
522
- this.elPopup.style.setProperty('--top-popup-height', this.elPopup.offsetHeight + 'px');
523
- this.elPopup.style.setProperty('--top-popup-right-bounding', boundingClientRect.right + 'px');
524
- this.elPopup.style.setProperty('--top-popup-bottom-bounding', boundingClientRect.bottom + 'px');
525
- this.elPopup.style.setProperty('--top-popup-top', boundingClientRect.top + 'px');
526
- this.elPopup.style.setProperty('--top-popup-left', boundingClientRect.left + 'px');
527
-
528
- this.elPopupInner.style.maxWidth = 'unset';
529
- this.elPopupInner.style.maxHeight = 'unset';
530
-
531
- let outTop = false;
532
- let outRight = false;
533
- let outBottom = false;
534
- let outLeft = false;
535
-
536
- // имеет ли смысл прикреплять окно к другой стороне кнопки
537
- let usefulInvertX = boundingClientRect.left > window.innerWidth / 2;
538
- let usefulInvertY = boundingClientRect.top > window.innerHeight / 2;
539
-
540
- if (p === 4) {
541
- usefulInvertX = !usefulInvertX;
542
- }
543
-
544
- if (p === 1) {
545
- usefulInvertY = !usefulInvertY;
546
- }
547
-
548
- const contentBoundingClientRect = this.elPopupInner.getBoundingClientRect();
549
- const contentRight = window.innerWidth - contentBoundingClientRect.right;
550
- const contentBottom = window.innerHeight - contentBoundingClientRect.bottom;
551
-
552
- const margin = 8;
553
-
554
- if (contentBoundingClientRect.top < margin) {
555
- outTop = true;
556
- }
557
-
558
- if (contentRight < margin) {
559
- outRight = true;
560
- }
561
-
562
- if (contentBottom < margin) {
563
- outBottom = true;
564
- }
565
-
566
- if (contentBoundingClientRect.left < margin) {
567
- outLeft = true;
568
- }
569
-
570
- if (outTop && (p === 0 || p === 1) && usefulInvertY) {
571
- p = 3;
572
- }
573
-
574
- if (outBottom && p === 3 && usefulInvertY) {
575
- p = 1;
576
- }
577
-
578
- if (outRight && p === 2 && usefulInvertX) {
579
- p = 4;
580
- }
581
-
582
- if (outLeft && p === 4 && usefulInvertX) {
583
- p = 2;
584
- }
585
-
586
- if (outRight && (p === 0 || p === 1 || p === 3)) {
587
- this.elPopup.classList.add('invert-x');
588
- }
589
-
590
- if (outBottom && (p === 2 || p === 4) && usefulInvertY) {
591
- // меню справа может перемещаться вверх, толкьо если есть место слева
592
- if (p === 2 && !usefulInvertX) {
593
- this.elPopup.classList.add('invert-y');
594
- }
595
-
596
- // меню слева перемещаясь вверх, должно открываться влево
597
- if (p === 4 && !usefulInvertX) {
598
- this.elPopup.classList.add('invert-x');
599
- }
600
-
601
- if (!this.elPopup.matches('.invert-y')) {
602
- p = 1;
603
- }
604
- }
605
-
606
- this.elPopup.classList.remove('p0', 'p1', 'p2', 'p3', 'p4');
607
- this.elPopup.classList.add('p' + p);
608
-
609
- this.elPopupInner.style.maxWidth = '';
610
- this.elPopupInner.style.maxHeight = '';
611
-
612
- Worker.scrollToActive(this.elPopup);
613
- };
614
-
615
- onTouchmove(e) {
616
- // разрешить горизональный скролл
617
- let hasScrollX = e.currentTarget.scrollWidth > e.currentTarget.offsetWidth;
618
- if (hasScrollX) {
619
- return;
620
- }
621
-
622
- // разрешить горизональный скролл
623
- let hasScrollX2 = e.target.parentElement.scrollWidth > e.target.parentElement.offsetWidth;
624
- if (hasScrollX2) {
625
- return;
626
- }
627
-
628
- if (!e.currentTarget.matches('.has_scroll')) {
629
- e.preventDefault();
630
- }
631
- }
632
-
633
- close() {
634
- if (this.isClosed) {
635
- return;
636
- }
637
-
638
- this.isClosed = true;
639
-
640
- if (this.$) {
641
- this.$.trigger('afterclose.top-menu-popup', [jQuery(this.elPopup)]);
642
- }
643
-
644
- if (Worker.noClose) {
645
- return;
646
- }
647
-
648
- this.unmount();
649
-
650
- this.elPopup.classList.add('top-popup-wrapper-closed');
651
-
652
- setTimeout(() => {
653
- this.vueClose();
654
-
655
- if (this.options.useOriginal) {
656
- this.elPopup.removeAttribute('style');
657
- this.elPopup.classList.remove('top-popup-wrapper-shown', 'top-popup-wrapper-closed');
658
- this.elPopup.classList.add('template');
659
- this.elStartPosition.append(this.elPopup);
660
-
661
- this.elPopup.querySelector('div.top-popup_content.top-column')?.classList.remove('top-column');
662
- this.elPopup.querySelector('.notch-border')?.remove();
663
- this.elPopup.querySelector('.notch')?.remove();
664
-
665
- this.elPopupInner.replaceWith(...this.elPopupInner.childNodes);
666
-
667
- DOM.storageClear(this.elPopup);
668
- } else {
669
- DOM.storageClear(this.elPopup);
670
-
671
- this.elPopup.remove();
672
- delete this.elPopup;
673
- }
674
-
675
- const elsPopups = Worker.getAllVisible();
676
- const elPopupLast = elsPopups.length && elsPopups[elsPopups.length - 1];
677
-
678
- if (elPopupLast) {
679
- Worker.getPopup(elPopupLast).focus();
680
- } else {
681
- document.documentElement.classList.remove('with_popup');
682
- }
683
- }, 300);
684
- }
685
-
686
- async vueOpen() {
687
- await this.vueGetComponent()?.onOpen(this);
688
- }
689
-
690
- vueClose() {
691
- this.vueGetComponent()?.onClose(this);
692
- }
693
-
694
- // получить vueConnectors компонента Popup
695
- vueGetComponent() {
696
- return Worker.vueConnectors.get(this.el.dataset.topPopupId);
697
- }
698
- }
699
-
700
- GlobalEvents.init();
701
-
702
- export default Popup;