@topvisor/ui 0.0.15 → 0.0.17

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 (69) hide show
  1. package/.chunks/core-0b2c7817.es.js +152 -0
  2. package/.chunks/core-0b2c7817.es.js.map +1 -0
  3. package/.chunks/core-51f7b679.amd.js +151 -0
  4. package/.chunks/core-51f7b679.amd.js.map +1 -0
  5. package/.chunks/{forms-5e17154c.es.js → forms-245e3bc0.es.js} +175 -32
  6. package/.chunks/forms-245e3bc0.es.js.map +1 -0
  7. package/.chunks/forms-f7b7b259.amd.js +568 -0
  8. package/.chunks/forms-f7b7b259.amd.js.map +1 -0
  9. package/.chunks/popup-8f650530.amd.js +728 -0
  10. package/.chunks/popup-8f650530.amd.js.map +1 -0
  11. package/.chunks/popup-d240ed19.es.js +731 -0
  12. package/.chunks/popup-d240ed19.es.js.map +1 -0
  13. package/README.md +62 -62
  14. package/common/common.amd.js +1 -1
  15. package/core/core.amd.js +5 -0
  16. package/core/core.amd.js.map +1 -0
  17. package/core/core.js +7 -0
  18. package/core/core.js.map +1 -0
  19. package/core.css +647 -658
  20. package/dark.css +135 -135
  21. package/editArea/editArea.amd.js +126 -0
  22. package/editArea/editArea.amd.js.map +1 -0
  23. package/editArea/editArea.js +123 -0
  24. package/editArea/editArea.js.map +1 -0
  25. package/editArea.css +61 -0
  26. package/forms/forms.amd.js +5 -3
  27. package/forms/forms.amd.js.map +1 -1
  28. package/forms/forms.js +6 -4
  29. package/{helpers → forms}/helpers.amd.js +2 -2
  30. package/{helpers → forms}/helpers.js +1 -1
  31. package/forms.css +344 -254
  32. package/icomoon/demo-files/demo.css +161 -161
  33. package/icomoon/demo-files/demo.js +30 -30
  34. package/icomoon/demo.html +2945 -2931
  35. package/icomoon/fonts/Topvisor-2.svg +232 -231
  36. package/icomoon/fonts/Topvisor-2.ttf +0 -0
  37. package/icomoon/fonts/Topvisor-2.woff +0 -0
  38. package/icomoon/selection.json +1 -1
  39. package/icomoon/style.css +647 -644
  40. package/light.css +135 -135
  41. package/package.json +19 -19
  42. package/popup/popup.amd.js +198 -0
  43. package/popup/popup.amd.js.map +1 -0
  44. package/popup/popup.js +198 -0
  45. package/popup/popup.js.map +1 -0
  46. package/popup/worker.amd.js +234 -0
  47. package/popup/worker.amd.js.map +1 -0
  48. package/popup/worker.js +237 -0
  49. package/popup/worker.js.map +1 -0
  50. package/popup.css +19 -0
  51. package/tabs/tabs.amd.js +123 -0
  52. package/tabs/tabs.amd.js.map +1 -0
  53. package/tabs/tabs.js +120 -0
  54. package/tabs/tabs.js.map +1 -0
  55. package/tabs.css +60 -0
  56. package/utils/device.amd.js +42 -0
  57. package/utils/device.amd.js.map +1 -0
  58. package/utils/device.js +41 -0
  59. package/utils/device.js.map +1 -0
  60. package/utils/dom.amd.js +95 -0
  61. package/utils/dom.amd.js.map +1 -0
  62. package/utils/dom.js +94 -0
  63. package/utils/dom.js.map +1 -0
  64. package/.chunks/forms-2abb7eaa.amd.js +0 -425
  65. package/.chunks/forms-2abb7eaa.amd.js.map +0 -1
  66. package/.chunks/forms-5e17154c.es.js.map +0 -1
  67. package/icomoon/demo-files/Read Me.txt +0 -7
  68. /package/{helpers → forms}/helpers.amd.js.map +0 -0
  69. /package/{helpers → forms}/helpers.js.map +0 -0
@@ -0,0 +1,731 @@
1
+ import { C as Core } from "./core-0b2c7817.es.js";
2
+ import DOM from "../utils/dom.js";
3
+ import Worker from "../popup/worker.js";
4
+ import "vue";
5
+ import "../utils/device.js";
6
+ class Component {
7
+ static componentName = "Top";
8
+ componentName;
9
+ // имя класса компонента
10
+ className;
11
+ // имя css класса компонента
12
+ uid;
13
+ // уникальный id компонента
14
+ el;
15
+ // элемент, связанный с компонентом
16
+ options = {};
17
+ // параметры компонента
18
+ unmountEls = [];
19
+ unmountEvents = [];
20
+ // переопредлять нельзя
21
+ // если компонент инициирован, необходимо сразу его вернуть и выполнить reInit() вместо mount()
22
+ // используется init вместо constructor, так как super constructor выполняется до Object.defineProperty() параметров класса
23
+ init(componentName, el, options) {
24
+ if (!el) {
25
+ throw componentName + ": el is undefined";
26
+ }
27
+ const component = Component.getComponent(el, componentName);
28
+ if (component) {
29
+ component.reInit(options);
30
+ return component;
31
+ }
32
+ this.componentName = componentName;
33
+ this.className = "top" + componentName[0].toUpperCase() + componentName.substring(1);
34
+ this.uid = this.componentName + (Math.random() + "").replace(".", "");
35
+ this.#setComponent(el);
36
+ this.el = el;
37
+ this.el.classList.add(this.className);
38
+ this.options = Object.assign(this.options, options);
39
+ this.mount();
40
+ }
41
+ // получить инициированный компонент
42
+ static getComponent(el, componentName) {
43
+ return DOM.storage(el, "#" + componentName);
44
+ }
45
+ // устанвоить компонент
46
+ #setComponent(el) {
47
+ DOM.storage(el, "#" + this.componentName, this);
48
+ }
49
+ // функция подключения компонента
50
+ mount() {
51
+ throw "Please, add method mount() to component: " + this.componentName;
52
+ }
53
+ // функция отключения компонента
54
+ unmount() {
55
+ DOM.storage(this.el, "#" + this.componentName, null);
56
+ this.unmountEls.forEach((el) => {
57
+ el.remove();
58
+ });
59
+ this.unmountEls = [];
60
+ this.unmountEvents.forEach((eventData) => {
61
+ eventData.el.removeEventListener(eventData.type, eventData.listener, eventData.options);
62
+ });
63
+ this.unmountEvents = [];
64
+ }
65
+ // указание новые элементы, которые должны будут удалиться после unmount
66
+ registerElForUnmount(el) {
67
+ this.unmountEls.push(el);
68
+ }
69
+ // указание новые события, которые должны будут удалиться после unmount
70
+ addEventListenerWithUnmount(el, type, listener, options) {
71
+ el.addEventListener(type, listener, options);
72
+ this.registerEventForUnmount(el, type, listener, options);
73
+ }
74
+ // указание новые события, которые должны будут удалиться после unmount
75
+ registerEventForUnmount(el, type, listener, options) {
76
+ const eventData = {
77
+ el,
78
+ type,
79
+ listener,
80
+ options
81
+ };
82
+ this.unmountEvents.push(eventData);
83
+ }
84
+ // функция перенастройки уже подключенного компонента
85
+ reInit(_options) {
86
+ throw "Please, add method reInit() to component: " + this.componentName;
87
+ }
88
+ // удалить элементы из DOM, но не из памяти
89
+ static detach(nodes) {
90
+ var _a;
91
+ if (nodes.forEach) {
92
+ nodes.forEach((node) => {
93
+ var _a2;
94
+ return (_a2 = node.parentElement) == null ? void 0 : _a2.removeChild(node);
95
+ });
96
+ } else {
97
+ const el = nodes;
98
+ (_a = el.parentElement) == null ? void 0 : _a.removeChild(el);
99
+ }
100
+ }
101
+ }
102
+ class GlobalEvents {
103
+ static init() {
104
+ document.addEventListener("click", this.onclick);
105
+ document.addEventListener("keydown", this.onkeydown);
106
+ }
107
+ /**
108
+ * Глобальный обработчик кликов
109
+ * обрабатывает клики внутри Popup
110
+ * @param {Event} e
111
+ */
112
+ static onclick(e) {
113
+ var _a;
114
+ const elCloser = e.target.closest(".closer, a, .a, .top-button");
115
+ if (elCloser) {
116
+ const elPopup = e.target.closest(".top-popup-wrapper");
117
+ if (!elPopup) {
118
+ return;
119
+ }
120
+ if (elCloser.matches(".top-popup-noCloser")) {
121
+ return;
122
+ }
123
+ if (elCloser.getAttribute("href") === ".") {
124
+ e.preventDefault();
125
+ }
126
+ if (e.target.matches("[data-top-popup]")) {
127
+ const elUl = e.target.closest("ul");
128
+ const elItem = e.target.closest("a, .a");
129
+ if (elUl) {
130
+ (_a = elUl.querySelector("a.top-active, .a.top-active")) == null ? void 0 : _a.classList.remove("top-active");
131
+ }
132
+ if (elItem) {
133
+ elItem.classList.add("top-active");
134
+ }
135
+ return;
136
+ }
137
+ Worker.close(elPopup);
138
+ }
139
+ if (e.target.matches(".top-popup-wrapper")) {
140
+ const elPopup = e.target;
141
+ Worker.close(elPopup);
142
+ }
143
+ }
144
+ /**
145
+ * Глобальный обработчик нажатия кнопки на клавиатуре
146
+ * @param {Event} e
147
+ */
148
+ static onkeydown(e) {
149
+ var _a;
150
+ const elPopup = e.target.closest(".top-popup-wrapper");
151
+ if (!elPopup) {
152
+ return;
153
+ }
154
+ const elUl = elPopup.querySelector("ul.top-popup_content");
155
+ switch (e.key) {
156
+ case "Escape":
157
+ break;
158
+ case "Enter":
159
+ if (!elUl) {
160
+ if (DOM.querySelectorVisible(elPopup, ".preloader")) {
161
+ break;
162
+ }
163
+ const elBtn = elPopup.querySelector(".top-popup_footer .go, .top-popup_footer [data-action]");
164
+ if (elBtn) {
165
+ elBtn.click();
166
+ }
167
+ break;
168
+ }
169
+ const elLink = DOM.querySelectorVisible(elPopup, "li > a.top-active");
170
+ if (elLink) {
171
+ e.preventDefault();
172
+ location.href = elLink.getAttribute("href");
173
+ }
174
+ const elItem = elPopup.querySelector("li > .top-active");
175
+ if (elItem) {
176
+ elItem.click();
177
+ }
178
+ break;
179
+ case "ArrowUp":
180
+ case "ArrowRight":
181
+ case "ArrowDown":
182
+ case "ArrowLeft":
183
+ if (!elUl) {
184
+ break;
185
+ }
186
+ if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
187
+ const elMoreVisible = DOM.querySelectorVisible(elPopup, "ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter) > .top-active > .top-popup_listMore");
188
+ if (elMoreVisible) {
189
+ e.preventDefault();
190
+ }
191
+ } else {
192
+ e.preventDefault();
193
+ }
194
+ const elItemActive = (_a = elPopup.querySelector("ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter) > .top-active")) == null ? void 0 : _a.parentElement;
195
+ if (e.key === "ArrowRight" && elItemActive) {
196
+ const elMore = elItemActive.querySelector(".top-active > .top-popup_listMore");
197
+ if (elMore) {
198
+ return elMore.click();
199
+ }
200
+ }
201
+ const elsLiVisible = DOM.querySelectorAllVisible(elPopup, "ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter)");
202
+ const countLi = elsLiVisible.length;
203
+ let index = elsLiVisible.indexOf(elItemActive);
204
+ if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
205
+ index--;
206
+ } else {
207
+ index++;
208
+ }
209
+ if (e.key === "ArrowLeft" && index === -1) {
210
+ if (e.target.matches("input")) {
211
+ return;
212
+ }
213
+ return Worker.close(elPopup);
214
+ }
215
+ if (e.key === "ArrowRight" && index === countLi) {
216
+ return;
217
+ }
218
+ if (index < 0) {
219
+ index = countLi - 1;
220
+ }
221
+ if (index > countLi - 1) {
222
+ index = 0;
223
+ }
224
+ elPopup.querySelectorAll("ul.top-popup_content > li > .top-active").forEach((el) => el.classList.remove("top-active"));
225
+ elsLiVisible[index].querySelector(":scope > a, :scope > .a").classList.add("top-active");
226
+ Worker.scrollToActive(elPopup);
227
+ break;
228
+ }
229
+ }
230
+ }
231
+ const css = ':root{\n --top-popup-background-color-hover: var(--color-steel-150);\n --top-popup-background-color-active: var(--color-steel-200);\n --top-popup-border-color: var(--color-theme-100);\n --top-popup-title-background-color: var(--color-steel-100);\n}\n\n.top-theme-dark{\n --top-popup-background-color-hover: var(--color-gray-800);\n --top-popup-background-color-active: var(--color-gray-750);\n --top-popup-title-background-color: var(--color-gray-900);\n}\n\n.top-popup-front{ position: relative; }\n\n.top-popup-wrapper{\n --top-popup-background-color: var(--color-bg-3);\n\n --top-popup-padding-h: 8px;\n --top-popup-padding-v: 8px;\n\n /* см. recalcPosition() */\n --top-popup-height: 0px;\n --top-popup-right-bounding: 0px;\n --top-popup-bottom-bounding: 0px;\n --top-popup-top: 0px;\n --top-popup-right: calc(100vw - var(--top-popup-right-bounding));\n --top-popup-bottom: calc(var(--100vh) - var(--top-popup-bottom-bounding));\n --top-popup-left: 0px;\n\n text-align: initial; white-space: normal; word-break: normal;\n position: absolute; z-index: 200000;\n}\n.top-popup-wrapper:not(.top-popup-wrapper-shown){ overflow: hidden; }\n\n/* top-popupPanel */\n.top-popupPanel {\n cursor: default;\n box-shadow: var(--top-shadow-b);\n border-radius: 8px;\n background: var(--top-popup-background-color);\n position: absolute; overflow: hidden;\n display: flex; flex-direction: column;\n}\n\n/* position */\n.top-popup-wrapper > *{ opacity: 0; transition: opacity 100ms linear, transform 100ms linear; }\n.top-popup-wrapper.p0 > *{ transform: translateY(-8px); }\n.top-popup-wrapper.p1 > *{ transform: translateY(8px); }\n.top-popup-wrapper.p2 > *{ transform: translateX(8px); }\n.top-popup-wrapper.p3 > *{ transform: translateY(8px); }\n.top-popup-wrapper.p4 > *{ transform: translateX(-8px); }\n.top-popup-wrapper-shown:not(.top-popup-wrapper-closed) > *{opacity: 1;transform: translate(0, 0) !important;}\n\n.top-popup-wrapper.p0 > .top-popup{ top: calc(-16px); left: calc(0px - var(--top-popup-padding-h)); }\n.top-popup-wrapper.p1 > .top-popup{ bottom: calc(100% + 8px); }\n.top-popup-wrapper.p2 > .top-popup{ left: calc(100% + 8px); }\n.top-popup-wrapper.p3 > .top-popup{ top: calc(100% + 8px); }\n.top-popup-wrapper.p4 > .top-popup{ right: calc(100% + 8px); }\n.top-popup-wrapper.p2 > .top-popup,\n.top-popup-wrapper.p4 > .top-popup{ margin-top: -10px; }\n\n.top-popup-wrapper.p1.with_notch > .top-popup{ margin-bottom: 5px; }\n.top-popup-wrapper.p2.with_notch > .top-popup{ margin-left: 5px; }\n.top-popup-wrapper.p3.with_notch > .top-popup{ margin-top: 5px; }\n.top-popup-wrapper.p4.with_notch > .top-popup{ margin-right: 5px; }\n\n.top-popup-wrapper.invert-x > .top-popup{ right: 0; }\n.top-popup-wrapper.invert-y > .top-popup{ bottom: 0; }\n\n/* notch */\n.top-popup-wrapper > .notch{ border: 7.4px solid transparent; position: absolute; display: block; }\n\n.top-popup-wrapper.p1 > .notch{ border-bottom: 0; border-top: 7.4px solid var(--content-background-color); margin: 0 0 7.4px -7.4px; bottom: 100%; left: 50% }\n.top-popup-wrapper.p2 > .notch{ border-left: 0; border-right: 7.4px solid var(--content-background-color); margin: 0 0 -7.4px 7.4px; bottom: 50%; left: 100%; }\n.top-popup-wrapper.p3 > .notch{ border-top: 0; border-bottom: 7.4px solid var(--content-background-color); margin: 7.4px 0 0 -7.4px; top: 100%; left: 50%; }\n.top-popup-wrapper.p4 > .notch{ border-right: 0; border-left: 7.4px solid var(--content-background-color); margin: 0 7.4px -7.4px 0; bottom: 50%; right: 100%; }\n\n.top-popup-wrapper.p1 > .notch-border{ border-top-color: rgba(0,0,0,0.05); margin-bottom: 6px; }\n.top-popup-wrapper.p2 > .notch-border{ border-right-color: rgba(0,0,0,0.05); margin-left: 6px; }\n.top-popup-wrapper.p3 > .notch-border{ border-bottom-color: rgba(0,0,0,0.05); margin-top: 6px; }\n.top-popup-wrapper.p4 > .notch-border{ border-left-color: rgba(0,0,0,0.05); margin-right: 6px; }\n\n/* common */\n.top-popup_header,\n.top-popup_content,\n.top-popup_footer{ padding: var(--top-popup-padding-h) var(--top-popup-padding-h); font-size: 14px; }\n.top-popup_header,\n.top-popup_footer{ display: flex; align-items: center; justify-content: space-between; }\n\n/* header */\n.top-popup_header{ border-bottom: 1px solid var(--top-popup-border-color); font-weight: 600; }\n.top-popup_header > *{ font-weight: 400; }\n.top-popup_header > .a{ cursor: pointer; color: var(--color-blue-450); }\n.top-popup_header > .a:hover{ color: var(--color-blue-350); }\n\n.top-popup-headerButton{ width: 60px; }\n\n/* content */\n.top-popup .top-popup_content{\n /* has_scroll */\n --scroll-padding-top: var(--top-popup-padding-v);\n --scroll-padding-bottom: var(--top-popup-padding-v);\n\n padding-top: var(--top-popup-padding-v); padding-bottom: var(--top-popup-padding-v); margin: 0; line-height:1.3 !important;\n flex-grow: 1; overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n.top-popup .top-popup_content .top-unwrap{\n --top-unwrap-x: var(--top-popup-padding-h);\n}\n\n.top-popup div.top-popup_content{ display: flex; flex-direction: column; gap: 4px; }\n.top-popup div.top-popup_content > *{ flex-shrink: 0; }\n.top-popup div.top-popup_content > .top-button{ margin: 0; }\n\n.top-popup ul.top-popup_content{\n --scroll-padding-top: 4px;\n --scroll-padding-bottom: var(--scroll-padding-top);\n\n padding: var(--scroll-padding-top) 0;\n}\n\nul.top-popup_content li{ margin: 0; list-style:none; display: flex; position: relative }\nul.top-popup_content li > *{ flex-grow: 1; }\nul.top-popup_content li > a:not(.top-button),\nul.top-popup_content li > i.a{\n cursor: pointer;\n box-sizing: border-box;\n background: var(--top-popup-background-color); padding:var(--top-popup-padding-v) var(--top-popup-padding-h);\n color:var(--color-text) !important; font-size: 14px; font-weight: normal !important; text-decoration:none !important; font-style: normal;\n display:flex; flex: 1 1 100%; align-items: center;\n transition: background-color 0.1s ease-in-out;\n}\n.top-popup-wrapper-no_animate ul.top-popup_content li > a:not(.top-button),\n.top-popup-wrapper-no_animate ul.top-popup_content li > i.a{ transition: none; }\n\nul.top-popup_content li > a:not(.top-button):hover,\nul.top-popup_content li > i.a:hover{ background: var(--top-popup-background-color-hover); }\nul.top-popup_content li > a:not(.top-button).top-active,\nul.top-popup_content li > i.a.top-active{ background: var(--top-popup-background-color-active); }\n\n/* listTitle */\nli.top-popup_listTitle{\n background: var(--top-popup-title-background-color); padding: var(--top-popup-padding-v) var(--top-popup-padding-h);\n color: var(--color-text-3); font-size: 12px; font-weight: 400;\n}\nli.top-popup_listTitle:first-child{\n padding-top: calc(var(--top-popup-padding-v) + var(--scroll-padding-top));\n margin-top: calc(0px - var(--scroll-padding-top));\n}\n\n/* listDelimiter */\nul.top-popup_content li.top-popup_listDelimiter{\n border-radius: 3px;\n background: var(--top-popup-border-color);\n height: 2px;\n margin: calc(var(--top-popup-padding-h) / 2) var(--top-popup-padding-h);\n}\n\n/* listMore */\nul.top-popup_content li > i.a.top-popup_listMore{\n height: auto; padding-right: 4px; padding-left: 4px;\n font-size: 24px; line-height: 17px; text-align: center;\n flex-basis: 10px;\n}\nul.top-popup_content li > i.a.top-popup_listMore:before{ color: var(--color-gray-500); }\nul.top-popup_content li > * > i.top-popup_listMore{\n padding: 0 var(--top-popup-padding-h); margin: 0 0 0 auto;\n color: var(--color-gray-500);\n font-size: 14px;\n}\nul.top-popup_content li > * > i.top-popup_listMore:hover,\nul.top-popup_content li > * > i.top-popup_listMore.top-active{ color: var(--color-blue-500); }\nul.top-popup_content li > * > i.top-popup_listMore:before{ transform: rotate(90deg); }\n\nul.top-popup_content li a.close{ background: none !important; }\n\n/* data-top-icon */\n.top-popup_content > [data-top-icon]:before{ --top-icon-size: 20px; }\n\nul.top-popup_content li > [data-top-icon]:not(.top-button):before{\n --top-icon-color: var(--color-text-3);\n --top-icon-size: 20px;\n --top-icon-width: 20px;\n\n height: 1rem; margin-right: 8px; transition: color 0.1s;\n}\nul.top-popup_content li:hover > [data-top-icon]:not(.top-button):before,\nul.top-popup_content li > [data-top-icon]:not(.top-button).top-active:before{\n --top-icon-color: #378DC6;\n}\n\n/* footer */\n.top-popup_footer{\n padding: var(--top-popup-padding-h) var(--top-popup-padding-h); display: flex; gap:8px; justify-content: flex-end;\n}\n.top-popup_footer > .top-button{ margin: 0; }\n\n/* Виджеты */\n.top-popup > [data-widget]{ padding: 0 var(--top-popup-padding-h); }\n.top-popup > [data-widget] + hr{ margin: 0 var(--top-popup-padding-h); }\n\n.top-popup .placeholder{\n border:1px solid #E0D9D9 !important; border-right: none !important; border-left: none !important; background:#F9F9F9 !important; margin: -1px 0; z-index: 1;\n position: relative;\n}\n\n/* компоненты */\n.top-popup-wrapper.simple_list > .top-popup{ min-width: 0; white-space: nowrap; }\n\n.top-popup_content .top-column{ display: flex; flex-direction: column; gap: 4px; }\n.top-popup_content li > :not(a):not(.a){ margin:0 var(--top-popup-padding-h); }\nhtml .top-popup .top-popup_content li > .top-button{ margin:calc(var(--top-popup-padding-v) / 2) var(--top-popup-padding-h); }\n\n.top-popup li .check_all,\n.top-popup li .clear_all{ cursor: pointer; color: var(--color-cyan); padding: 8px; display: inline-block; }\n.top-popup li .check_all:hover,\n.top-popup li .clear_all:hover{ text-decoration: underline; }\n.top-popup li .clear_all{ display: none; }\n\n/* table */\n.top-popup_content table{ margin: -9px 0; }\n.top-popup_content table td,\n.top-popup_content table th{ padding: 9px var(--top-popup-padding-h) 9px 0; vertical-align: top; }\n.top-popup_content table th{ width: 40%; font-weight: 600; white-space: nowrap; }\n\n/* формы */\nul.top-popup_content .a > [type="checkbox"],\nul.top-popup_content .a > [type="radio"]{ margin: -8px 0 -8px auto; }\n\n/* deprecated */\nul.top-popup_content a > [class*=icon],\nul.top-popup_content i.a > [class*=icon]{\n margin-right: 14px; text-align: center;\n width: auto; height: 16px; font-size: 16px; vertical-align: top;\n transition: 0.1s;\n}\n\n.top-popup .buttons{ border-radius:0 0 4px 4px; border-top:1px solid #BDC3C7; background:#ECF0F1; padding:10px 15px; margin:10px -15px -10px -15px; white-space: nowrap; }\n.top-popup_footer [class*=btn]:not(.btn-transparent){ min-width: 100px; padding: 5px 14px; margin-left: 10px; }\n.top-popup_footer [class*=btn]:first-child{ margin-left: 0; }\n.top-popup_footer .btn.full_width{ margin: 0; flex-grow: 1; }';
232
+ const cssM = "html.with_popup{ background: #808080; }\n\n.top-popup-wrapper{\n --top-popup-padding-h: 19px;\n --top-popup-padding-v: 16px;\n --top-popup-footer-offset: 25px;\n\n width: auto !important; height: auto !important;\n position: fixed; top: 0 !important; right: 0 !important; left: 0 !important; overflow: hidden;\n transition: background 0.3s;\n}\n\n.top-popup-wrapper-shown:not(.top-popup-wrapper-closed){ background: rgba(0,0,0,0.5); backdrop-filter: blur(1px); }\n.top-popup-wrapper-shown:not(.top-popup-wrapper-closed) > .top-popup{ opacity: 1 !important; }\n\n.top-popup{\n border-radius: 8px 8px 0 0; width: auto !important; max-height: calc(100% - var(--header-height) - 12px);\n top: auto !important; right: 0 !important; bottom: 0 !important; left: 0 !important;\n display: flex; flex-direction: column;\n\n /* невозможно опустить элемент вниз за экран на 100%, fix: opacity и translateY(80%) */\n transform: translateY(80%);\n\n transition: opacity 0.3s, transform 0.3s;\n}\n\n/* from top */\n.top-popup-wrapper.p-from-top{\n --top-popup-footer-offset: 0px;\n\n top: var(--header-height) !important;\n}\n.with_dialog .top-popup-wrapper.p-from-top{ top: 50px !important; }\n.top-popup-wrapper.p-from-top > .top-popup{\n border-radius: 0 0 8px 8px; max-height: calc(100% - 24px); top: 0 !important; bottom: auto !important;\n transform: translateY(calc(-100% - 24px));\n}\n\n.top-popup_content:last-child,\n.top-popup_footer{\n --scroll-padding-bottom: calc(var(--top-popup-padding-v) + var(--top-popup-footer-offset));\n\n padding-bottom: var(--scroll-padding-bottom);\n}\n\n/* content */\nul.top-popup_content{\n --scroll-padding-top: 0px;\n --scroll-padding-bottom: var(--scroll-padding-top);\n\n display: flex; flex-direction: column;\n}\nul.top-popup_content li:not(:last-child){ border-bottom: 1px solid var(--top-popup-border-color); }\n\n.top-popup-wrapper.top-style_alt > .top-popup > ul > li{ border-bottom: none; }\n\n/* footer */\n.top-popup_footer{ flex-wrap: wrap; }\n.top-popup_footer > .top-button{\n --top-forms-base-height: var(--top-forms-base-height_xl);\n\n flex-grow: 1;\n}\n\n/* listTitle */\nul.top-popup_content li.top-popup_listTitle{\n --top-popup-padding-v: 12px;\n}\n\n/* listDelimiter */\nul.top-popup_content li.top-popup_listDelimiter{ border-radius: 0; border-bottom: none; height: 2px; margin: 0; }";
233
+ const cssPC = "html:not(.with_dialog){ margin-right: 0 !important; }\n\n.top-popup{ min-width: 250px; max-width: calc(100vw - var(--top-popup-left) - 16px); max-height: calc(var(--top-popup-bottom) + var(--top-popup-height)); }\n.top-popup-wrapper.invert-x > .top-popup{ max-width: calc(100vw - var(--top-popup-right) - 16px); }\n.top-popup-wrapper.invert-y > .top-popup{ max-height: calc(100vh - var(--top-popup-bottom) - 16px); }\n\n/* position */\n.top-popup-wrapper.p1 > .top-popup{ max-height: calc(var(--top-popup-top) - var(--header-height) - 16px); }\n.top-popup-wrapper.p3 > .top-popup{ max-height: calc(var(--top-popup-bottom) - 16px); }\n.top-popup-wrapper.p2 > .top-popup{ max-width: calc(var(--top-popup-right) - 16px); }\n.top-popup-wrapper.p4 > .top-popup{ max-width: calc(var(--top-popup-left) - 16px); }\n\n/* notch */\n.top-popup-wrapper.p1.with_notch > .top-popup,\n.top-popup-wrapper.p3.with_notch > .top-popup{ margin-left: -16px !important; }\n.top-popup-wrapper.p1.with_notch > .notch,\n.top-popup-wrapper.p3.with_notch > .notch{ margin-left: -8px !important; }\n\n.top-popup-wrapper.p1.with_notch.invert-x,\n.top-popup-wrapper.p3.with_notch.invert-x{ margin-left: 3px !important; }\n.top-popup-wrapper.p1.with_notch.invert-x > .notch,\n.top-popup-wrapper.p3.with_notch.invert-x > .notch{ margin-left: -9px !important; }\n\n/* listMore */\nul.top-popup_content li > * > i.top-popup_listMore{ visibility: hidden; transition: none; }\nul.top-popup_content li:hover > * > i.top-popup_listMore,\nul.top-popup_content li > *.top-active > i.top-popup_listMore,\nul.top-popup_content li > * > i.top-popup_listMore.top-active{ visibility: visible; }";
234
+ Core.appendStyle(css);
235
+ Core.appendStyle(cssM, "m");
236
+ Core.appendStyle(cssPC, "pc");
237
+ class Popup extends Component {
238
+ static componentName = "Popup";
239
+ el;
240
+ // элемент, вызвавший открытие Popup
241
+ elActiveByDefault;
242
+ // элемент уже имеет класс top-active перед открытием окна
243
+ elPopup;
244
+ elPopupInner;
245
+ elPopupHeader;
246
+ elPopupBody;
247
+ elPopupFooter;
248
+ elFront;
249
+ popupParent;
250
+ $;
251
+ // только, если есть jQuery
252
+ elStartPosition;
253
+ // используется для useOriginal
254
+ shift = {
255
+ top: 0,
256
+ left: 0
257
+ };
258
+ isClosed = false;
259
+ // флаг того, что меню закрыто
260
+ isFirstClick = true;
261
+ type;
262
+ // selector или html
263
+ options = {
264
+ popup: "",
265
+ // selector, text
266
+ p: 0,
267
+ // положение меню (0 - над элементом, 1 - сверху, 2 - справа, 3 - снизу, 4 слева)
268
+ notch: false,
269
+ // отображать ли клювик
270
+ class: "",
271
+ // класс, добавляемый меню
272
+ posBy: "left",
273
+ // способ привязки позиционирования меню (left/right - левый/правый край родителя, fixed - по окну)
274
+ frontSelector: "",
275
+ invertX: false,
276
+ // базовая ордината - правая граница элемента, а не левая
277
+ openByHover: false,
278
+ // открывать при наведении
279
+ useOriginal: false,
280
+ // использовать оригинальный шаблон, без клонирвоания (для сохранения состояния меню)
281
+ isFullScreen: false,
282
+ i18n: {}
283
+ };
284
+ events = {};
285
+ // el - элемент, открывающий меню
286
+ constructor(el, options) {
287
+ super();
288
+ return this.init(Popup.componentName, el, options);
289
+ }
290
+ async mount() {
291
+ const vueConnector = this.vueGetComponent();
292
+ this.popupParent = Worker.getPopup(this.el.closest(".top-popup-wrapper"));
293
+ await this.mountJQuery();
294
+ if (DOM.css(this.el, "position") !== "absolute") {
295
+ this.el.style.position = "relative";
296
+ }
297
+ this.el.dataset.topPopupOpened = "opened";
298
+ this.elActiveByDefault = this.el.classList.contains("top-active");
299
+ this.el.classList.add("top-active");
300
+ if (vueConnector) {
301
+ this.type = "vue";
302
+ this.options.popup = "";
303
+ this.elPopup = DOM.genEl("div", {}, this.options.popup);
304
+ } else if (this.options.popup.match(/^[#.]/)) {
305
+ this.type = "selector";
306
+ this.elPopup = document.querySelector(`${this.options.popup}.template`);
307
+ } else {
308
+ this.type = "html";
309
+ if (this.options.useOriginal) {
310
+ throw "Option useOriginal not allowed for text templates";
311
+ }
312
+ this.elPopup = DOM.genEl("div", {}, this.options.popup);
313
+ }
314
+ if (!this.elPopup || (vueConnector == null ? void 0 : vueConnector.opened)) {
315
+ if (this.options.useOriginal || (vueConnector == null ? void 0 : vueConnector.opened)) {
316
+ if (vueConnector == null ? void 0 : vueConnector.opened) {
317
+ this.elPopup = vueConnector.popup.elPopup;
318
+ } else {
319
+ this.elPopup = document.querySelector(`${this.options.popup}.top-popup-wrapper-shown`);
320
+ }
321
+ if (this.elPopup) {
322
+ this.el.dataset.topPopupOpened = "";
323
+ if (!this.elActiveByDefault) {
324
+ this.el.classList.remove("top-active");
325
+ }
326
+ Worker.close(this.elPopup);
327
+ setTimeout(() => this.mount(), 300);
328
+ return;
329
+ }
330
+ throw "Option useOriginal state allowed only elements .template";
331
+ }
332
+ this.elPopup = document.querySelector(`${this.options.popup}:not(.top-popup-wrapper)`);
333
+ }
334
+ if (!this.elPopup) {
335
+ return;
336
+ }
337
+ if (this.options.useOriginal) {
338
+ this.elStartPosition = this.elPopup.closest(".top-popup-el-start-position");
339
+ if (!this.elStartPosition) {
340
+ this.elStartPosition = DOM.wrap(this.elPopup, "i");
341
+ this.elStartPosition.classList.add("top-popup-el-start-position", "hidden");
342
+ }
343
+ } else {
344
+ this.elPopup = this.elPopup.cloneNode(true);
345
+ if (this.type === "selector" && !this.elPopup.matches(".template")) {
346
+ this.elPopup.classList.remove("hidden");
347
+ if (!this.elPopup.querySelector(":scope > .top-popup_content")) {
348
+ this.elPopup.classList.add("top-popup_content");
349
+ }
350
+ this.elPopup = DOM.wrap(this.elPopup, "div");
351
+ }
352
+ if (this.type === "html") {
353
+ if (!this.elPopup.querySelector(":scope > .top-popup_content")) {
354
+ this.elPopup.classList.add("top-popup_content");
355
+ this.elPopup = DOM.wrap(this.elPopup, "div");
356
+ }
357
+ }
358
+ if (this.type === "selector" && !this.elPopup.matches(".template") || this.type === "html" || this.type === "vue") {
359
+ DOM.querySelectorAllArray(this.elPopup, "[data-top-popup]").forEach((el) => el.dataset.topPopupPosBy = "fixed");
360
+ DOM.querySelectorAllArray(this.elPopup, ".top-popup-wrapper").forEach((el) => el.remove());
361
+ }
362
+ }
363
+ Worker.decoratorBeforeOpen(this);
364
+ if (vueConnector) {
365
+ this.options.class = vueConnector.classRef.value;
366
+ }
367
+ this.elPopupInner = document.createElement("div");
368
+ this.elPopupInner.classList.add("top-popupPanel", "top-popup");
369
+ while (this.elPopup.firstChild) {
370
+ this.elPopupInner.appendChild(this.elPopup.firstChild);
371
+ }
372
+ this.elPopup.append(this.elPopupInner);
373
+ this.elPopup.classList.add("top-popup-wrapper");
374
+ if (this.options.class) {
375
+ const classes = this.options.class.split(" ");
376
+ this.elPopup.classList.add(...classes);
377
+ }
378
+ if (this.options.notch) {
379
+ this.elPopup.classList.add("with_notch");
380
+ this.elPopup.insertAdjacentHTML("beforeend", '<i class="notch notch-border"></i><i class="notch"></i>');
381
+ }
382
+ await this.vueOpen();
383
+ this.elPopupHeader = this.elPopupInner.querySelector(".top-popup_header");
384
+ this.elPopupBody = this.elPopupInner.querySelector(".top-popup_content");
385
+ this.elPopupFooter = this.elPopupInner.querySelector(".top-popup_footer");
386
+ const existsWidgetSearch = !!this.elPopup.querySelector('[data-widget="search"]');
387
+ if (this.options.isFullScreen && !existsWidgetSearch) {
388
+ if (!this.elPopupHeader) {
389
+ this.elPopupHeader = DOM.genEl("i", { class: "header" });
390
+ this.elPopupInner.prepend(this.elPopupHeader);
391
+ this.elPopupHeader.prepend(DOM.genEl("i", { class: "a closer" }, this.options.i18n.Close));
392
+ this.elPopupHeader.append(DOM.genEl("i", { class: "top-popup-headerButton" }));
393
+ }
394
+ }
395
+ DOM.storage(this.elPopup, "Popup", this);
396
+ if (this.options.frontSelector) {
397
+ this.elFront = document.querySelector(this.options.frontSelector);
398
+ }
399
+ if (!this.elFront) {
400
+ this.elFront = this.el.closest(".top-popup-front");
401
+ }
402
+ if (!this.elFront) {
403
+ this.elFront = document.body;
404
+ }
405
+ this.elPopup.style.width = this.el.offsetWidth + "px";
406
+ this.elPopup.style.height = this.el.offsetHeight + "px";
407
+ this.elPopup.style.top = this.el.offsetTop + "px";
408
+ this.elPopup.style.right = parseInt(this.el.style.right || 0) + "px";
409
+ this.elPopup.style.bottom = parseInt(this.el.style.bottom || 0) + "px";
410
+ this.el.parentElement.insertBefore(this.elPopup, this.el);
411
+ this.elPopup.classList.remove("template");
412
+ if (this.options.invertX) {
413
+ this.elPopup.classList.add("invert-x");
414
+ }
415
+ let fromTop = !!this.el.closest(".modal-header");
416
+ if (!fromTop) {
417
+ fromTop = !!this.el.closest("#top_panel");
418
+ }
419
+ if (!fromTop) {
420
+ fromTop = !!this.el.closest("#secondmenu");
421
+ }
422
+ if (fromTop) {
423
+ this.elPopup.classList.add("p-from-top");
424
+ }
425
+ setTimeout(() => this.elPopup.classList.add("top-popup-wrapper-shown"));
426
+ if (this.elFront && !this.elFront.matches("body")) {
427
+ this.elFront.append(this.elPopup);
428
+ this.shift.top = DOM.offset(this.el).top - this.el.offsetTop - DOM.offset(this.elFront).top;
429
+ this.shift.left = DOM.offset(this.el).left - this.el.offsetLeft - DOM.offset(this.elFront).left;
430
+ this.shift.top -= parseInt(this.el.style["margin-top"] || 0);
431
+ this.shift.left -= parseInt(this.el.style["margin-left"] || 0);
432
+ this.elPopup.style.top = parseInt(this.elPopup.style.top || "0") + this.shift.top + "px";
433
+ this.elPopup.style.left = parseInt(this.elPopup.style.left || "0") + this.shift.left + "px";
434
+ }
435
+ if (this.$) {
436
+ this.$.trigger("aftershow.top-menu-popup", [jQuery(this.elPopup)]);
437
+ }
438
+ this.recalcPosition();
439
+ this.elPopup.setAttribute("tabindex", 0);
440
+ this.focus();
441
+ Worker.decoratorAfterOpen(this);
442
+ this.mountEvents();
443
+ }
444
+ async mountJQuery() {
445
+ if (typeof jQuery !== "function") {
446
+ return;
447
+ }
448
+ this.$ = jQuery(this.el);
449
+ }
450
+ /**
451
+ * Выполнить фокусировку на нужный элемент после открытия окна
452
+ */
453
+ focus() {
454
+ let el = DOM.querySelectorVisible(this.elPopup, ".top-popup-autofocus");
455
+ if (!el) {
456
+ el = DOM.querySelectorVisible(this.elPopup, ":read-write, select:not(:disabled)");
457
+ }
458
+ if (!el) {
459
+ el = DOM.querySelectorVisible(this.elPopup, ".top-popup_footer .top-button");
460
+ }
461
+ if (!el) {
462
+ el = this.elPopup;
463
+ }
464
+ el.focus();
465
+ }
466
+ mountEvents() {
467
+ this.addEventListenerWithUnmount(document, "mousedown", (e) => this.onMousedown(e));
468
+ this.addEventListenerWithUnmount(this.elPopup, "focus", (e) => this.onFocus(e));
469
+ if (this.options.openByHover) {
470
+ this.addEventListenerWithUnmount(this.elPopup, "mouseleave", (e) => this.onMouseleave(e));
471
+ this.addEventListenerWithUnmount(this.elPopupInner, "mouseleave", (e) => this.onMouseleave(e));
472
+ }
473
+ if (this.options.isFullScreen) {
474
+ this.addEventListenerWithUnmount(this.elPopupBody, "touchmove", (e) => this.onTouchmove(e));
475
+ }
476
+ }
477
+ /**
478
+ * Обработка клика вне окна
479
+ * @param {Event} e
480
+ */
481
+ onMousedown(e) {
482
+ if (!this.elPopup) {
483
+ return;
484
+ }
485
+ if (!this.isFirstClick) {
486
+ return;
487
+ }
488
+ this.isFirstClick = false;
489
+ setTimeout(() => this.isFirstClick = true);
490
+ if (e.button !== 0) {
491
+ return;
492
+ }
493
+ let elPopupOpened = DOM.querySelectorVisibleLast(document.body, ":scope > .top-popup-wrapper");
494
+ if (elPopupOpened && elPopupOpened !== this.elPopup) {
495
+ return;
496
+ }
497
+ elPopupOpened = DOM.querySelectorVisibleLast(e.target.closest(".top-popup-front"), ":scope > .top-popup-wrapper");
498
+ if (elPopupOpened && elPopupOpened !== this.elPopup) {
499
+ return;
500
+ }
501
+ if (this.elPopup.contains(e.target)) {
502
+ return;
503
+ }
504
+ if (this.elPopup.closest(".ui-dialog") && !e.target.closest(".ui-dialog")) {
505
+ return;
506
+ }
507
+ if (Worker.decoratorIsIgnoreOuterClick(e)) {
508
+ return;
509
+ }
510
+ Worker.close(this.elPopup);
511
+ }
512
+ /**
513
+ * Закрыть другие Popup при фокусе на элемент формы в текущем
514
+ * @param {Event} e
515
+ */
516
+ onFocus(e) {
517
+ if (e.target.matches("input")) {
518
+ return;
519
+ }
520
+ if (this.isClosed) {
521
+ return;
522
+ }
523
+ const elsPopups = Worker.getAllVisible();
524
+ elsPopups.forEach((elPopup) => {
525
+ var _a, _b, _c;
526
+ if (this.elPopup.contains(elPopup)) {
527
+ return;
528
+ }
529
+ if (((_a = this.popupParent) == null ? void 0 : _a.elPopup) === elPopup || ((_c = (_b = this.popupParent) == null ? void 0 : _b.popupParent) == null ? void 0 : _c.elPopup) === elPopup) {
530
+ return;
531
+ }
532
+ Worker.close(elPopup);
533
+ });
534
+ }
535
+ /**
536
+ * Закрыть Popup при отведении мыши
537
+ * @param {Event} _e
538
+ */
539
+ onMouseleave(_e) {
540
+ setTimeout(() => {
541
+ if (this.elPopupInner.matches(":hover")) {
542
+ return;
543
+ }
544
+ Worker.close(this.elPopup);
545
+ }, 100);
546
+ }
547
+ /**
548
+ * Контроль положения Popup при fixed позиционировании
549
+ */
550
+ onResize() {
551
+ if (this.elPopup.parentElement !== document.body) {
552
+ document.body.append(this.elPopup);
553
+ }
554
+ this.elPopup.style.top = DOM.offset(this.el).top + "px";
555
+ this.elPopup.style.left = DOM.offset(this.el).left + "px";
556
+ }
557
+ unmount() {
558
+ super.unmount();
559
+ this.el.dataset.topPopupOpened = "";
560
+ if (!this.elActiveByDefault) {
561
+ this.el.classList.remove("top-active");
562
+ }
563
+ let style = this.el.getAttribute("style");
564
+ if (style) {
565
+ style = style.replace(/position:[^;]*;?/g, "");
566
+ this.el.setAttribute("style", style);
567
+ }
568
+ }
569
+ // контроль за положением Popup, чтобы оно не вылезало за пределы документа
570
+ recalcPosition() {
571
+ let p = this.options.p;
572
+ let leftPos;
573
+ this.elPopup.style.height = this.el.offsetHeight + "px";
574
+ this.elPopup.classList.remove("p0", "p1", "p2", "p3", "p4");
575
+ this.elPopup.classList.add("p" + p);
576
+ switch (this.options.posBy) {
577
+ case "left":
578
+ leftPos = this.el.offsetLeft + parseInt(this.el.style["margin-left"] || 0);
579
+ leftPos += this.shift.left;
580
+ this.elPopup.style.left = leftPos + "px";
581
+ break;
582
+ case "right":
583
+ leftPos = this.el.offsetLeft + parseInt(this.el.style["margin-left"] || 0);
584
+ this.elPopup.style.right = this.el.offsetParent.offsetWidth - this.el.offsetWidth - leftPos + "px";
585
+ break;
586
+ case "fixed":
587
+ this.addEventListenerWithUnmount(window, "resize", () => this.onResize());
588
+ this.onResize();
589
+ break;
590
+ default:
591
+ this.options.posBy.append(this.elPopup);
592
+ }
593
+ const boundingClientRect = this.elPopup.getBoundingClientRect();
594
+ this.elPopup.style.setProperty("--top-popup-height", this.elPopup.offsetHeight + "px");
595
+ this.elPopup.style.setProperty("--top-popup-right-bounding", boundingClientRect.right + "px");
596
+ this.elPopup.style.setProperty("--top-popup-bottom-bounding", boundingClientRect.bottom + "px");
597
+ this.elPopup.style.setProperty("--top-popup-top", boundingClientRect.top + "px");
598
+ this.elPopup.style.setProperty("--top-popup-left", boundingClientRect.left + "px");
599
+ this.elPopupInner.style.maxWidth = "unset";
600
+ this.elPopupInner.style.maxHeight = "unset";
601
+ let outTop = false;
602
+ let outRight = false;
603
+ let outBottom = false;
604
+ let outLeft = false;
605
+ let usefulInvertX = boundingClientRect.left > window.innerWidth / 2;
606
+ let usefulInvertY = boundingClientRect.top > window.innerHeight / 2;
607
+ if (p === 4) {
608
+ usefulInvertX = !usefulInvertX;
609
+ }
610
+ if (p === 1) {
611
+ usefulInvertY = !usefulInvertY;
612
+ }
613
+ const contentBoundingClientRect = this.elPopupInner.getBoundingClientRect();
614
+ const contentRight = window.innerWidth - contentBoundingClientRect.right;
615
+ const contentBottom = window.innerHeight - contentBoundingClientRect.bottom;
616
+ const margin = 8;
617
+ if (contentBoundingClientRect.top < margin) {
618
+ outTop = true;
619
+ }
620
+ if (contentRight < margin) {
621
+ outRight = true;
622
+ }
623
+ if (contentBottom < margin) {
624
+ outBottom = true;
625
+ }
626
+ if (contentBoundingClientRect.left < margin) {
627
+ outLeft = true;
628
+ }
629
+ if (outTop && (p === 0 || p === 1) && usefulInvertY) {
630
+ p = 3;
631
+ }
632
+ if (outBottom && p === 3 && usefulInvertY) {
633
+ p = 1;
634
+ }
635
+ if (outRight && p === 2 && usefulInvertX) {
636
+ p = 4;
637
+ }
638
+ if (outLeft && p === 4 && usefulInvertX) {
639
+ p = 2;
640
+ }
641
+ if (outRight && (p === 0 || p === 1 || p === 3)) {
642
+ this.elPopup.classList.add("invert-x");
643
+ }
644
+ if (outBottom && (p === 2 || p === 4) && usefulInvertY) {
645
+ if (p === 2 && !usefulInvertX) {
646
+ this.elPopup.classList.add("invert-y");
647
+ }
648
+ if (p === 4 && !usefulInvertX) {
649
+ this.elPopup.classList.add("invert-x");
650
+ }
651
+ if (!this.elPopup.matches(".invert-y")) {
652
+ p = 1;
653
+ }
654
+ }
655
+ this.elPopup.classList.remove("p0", "p1", "p2", "p3", "p4");
656
+ this.elPopup.classList.add("p" + p);
657
+ this.elPopupInner.style.maxWidth = "";
658
+ this.elPopupInner.style.maxHeight = "";
659
+ Worker.scrollToActive(this.elPopup);
660
+ }
661
+ onTouchmove(e) {
662
+ let hasScrollX = e.currentTarget.scrollWidth > e.currentTarget.offsetWidth;
663
+ if (hasScrollX) {
664
+ return;
665
+ }
666
+ let hasScrollX2 = e.target.parentElement.scrollWidth > e.target.parentElement.offsetWidth;
667
+ if (hasScrollX2) {
668
+ return;
669
+ }
670
+ if (!e.currentTarget.matches(".has_scroll")) {
671
+ e.preventDefault();
672
+ }
673
+ }
674
+ close() {
675
+ if (this.isClosed) {
676
+ return;
677
+ }
678
+ this.isClosed = true;
679
+ if (this.$) {
680
+ this.$.trigger("afterclose.top-menu-popup", [jQuery(this.elPopup)]);
681
+ }
682
+ if (Worker.noClose) {
683
+ return;
684
+ }
685
+ this.unmount();
686
+ this.elPopup.classList.add("top-popup-wrapper-closed");
687
+ setTimeout(() => {
688
+ var _a, _b, _c;
689
+ this.vueClose();
690
+ if (this.options.useOriginal) {
691
+ this.elPopup.removeAttribute("style");
692
+ this.elPopup.classList.remove("top-popup-wrapper-shown", "top-popup-wrapper-closed");
693
+ this.elPopup.classList.add("template");
694
+ this.elStartPosition.append(this.elPopup);
695
+ (_a = this.elPopup.querySelector("div.top-popup_content.top-column")) == null ? void 0 : _a.classList.remove("top-column");
696
+ (_b = this.elPopup.querySelector(".notch-border")) == null ? void 0 : _b.remove();
697
+ (_c = this.elPopup.querySelector(".notch")) == null ? void 0 : _c.remove();
698
+ this.elPopupInner.replaceWith(...this.elPopupInner.childNodes);
699
+ DOM.storageClear(this.elPopup);
700
+ } else {
701
+ DOM.storageClear(this.elPopup);
702
+ this.elPopup.remove();
703
+ delete this.elPopup;
704
+ }
705
+ const elsPopups = Worker.getAllVisible();
706
+ const elPopupLast = elsPopups.length && elsPopups[elsPopups.length - 1];
707
+ if (elPopupLast) {
708
+ Worker.getPopup(elPopupLast).focus();
709
+ } else {
710
+ document.documentElement.classList.remove("with_popup");
711
+ }
712
+ }, 300);
713
+ }
714
+ async vueOpen() {
715
+ var _a;
716
+ await ((_a = this.vueGetComponent()) == null ? void 0 : _a.onOpen(this));
717
+ }
718
+ vueClose() {
719
+ var _a;
720
+ (_a = this.vueGetComponent()) == null ? void 0 : _a.onClose(this);
721
+ }
722
+ // получить vueConnectors компонента Popup
723
+ vueGetComponent() {
724
+ return Worker.vueConnectors.get(this.el.dataset.topPopupId);
725
+ }
726
+ }
727
+ GlobalEvents.init();
728
+ export {
729
+ Popup as default
730
+ };
731
+ //# sourceMappingURL=popup-d240ed19.es.js.map