@formixru/b2b-ui 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/components/dialog/index.js +10 -14
- package/src/components/form/index.js +3 -12
- package/src/components/request/index.js +51 -7
- package/src/components/sidebar/index.js +57 -41
- package/src/components/tabs/index.scss +19 -17
- package/src/components/warning-message/index.scss +25 -29
- package/src/components/warning-message/index.vue +5 -2
- package/src/variables.scss +25 -12
- package/src/helpers/request.js +0 -126
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## v2.2.0
|
|
2
|
+
|
|
3
|
+
- Доработки по стилям `.tabs`/`.warning-message`
|
|
4
|
+
|
|
5
|
+
## v2.1.0
|
|
6
|
+
|
|
7
|
+
- В Request добавлены `reloadOnHideSidebar`/`hideSidebar`, а так же параметр `hideLoaderOnSuccess`
|
|
8
|
+
- В Request добавлена функция `__FORMIX__REQUEST__INIT_CONTENT` вместо `__FORMIX__FORM__INIT_CONTENT`/`__FORMIX__DIALOG__INIT_CONTENT`/`__FORMIX__SIDEBAR_INIT_CONTENT`
|
|
9
|
+
- Поддержка id диалогового окна или сайдбара как c `#`, так и без неё
|
|
10
|
+
|
|
1
11
|
## v2.0.1
|
|
2
12
|
|
|
3
13
|
- Исправлена работа `Request`
|
package/package.json
CHANGED
|
@@ -2,8 +2,9 @@ import _throttle from 'lodash-es/throttle.js';
|
|
|
2
2
|
|
|
3
3
|
import { cssVar } from '../../helpers/css-var.js';
|
|
4
4
|
import { mm } from '../../helpers/mm.js';
|
|
5
|
+
import { hide as hideLoader } from '../loader/index.js';
|
|
5
6
|
import { disableScroll, enableScroll } from '../overlay/index.js';
|
|
6
|
-
import { request } from '../request/index.js';
|
|
7
|
+
import { initRequestContent, request } from '../request/index.js';
|
|
7
8
|
|
|
8
9
|
const isDialogOverflow = ($b) => {
|
|
9
10
|
return $b.scrollHeight > $b.clientHeight;
|
|
@@ -88,35 +89,30 @@ export const hide = async ($b) => {
|
|
|
88
89
|
|
|
89
90
|
$b.hidden = true;
|
|
90
91
|
enableScroll();
|
|
92
|
+
|
|
91
93
|
$b.dispatchEvent(new CustomEvent('dialog-hidden'));
|
|
92
94
|
} else {
|
|
93
95
|
enableScroll();
|
|
94
96
|
}
|
|
95
97
|
};
|
|
96
98
|
|
|
97
|
-
export const initDialogContent = ($b) => {
|
|
98
|
-
try {
|
|
99
|
-
window.__FORMIX__DIALOG__INIT_CONTENT($b);
|
|
100
|
-
} catch {
|
|
101
|
-
console.warn('Функция __FORMIX__DIALOG__INIT_CONTENT не установлена');
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
99
|
export const get = async (id, url) => {
|
|
100
|
+
const elementId = id.startsWith('#') ? id : `#${id}`;
|
|
106
101
|
if (url && url !== '#') {
|
|
107
|
-
const { content } = await request({ url });
|
|
102
|
+
const { content } = await request({ url, hideLoaderOnSuccess: false });
|
|
108
103
|
if (content) {
|
|
109
|
-
const $b = document.querySelector(
|
|
104
|
+
const $b = document.querySelector(elementId);
|
|
110
105
|
if ($b) {
|
|
111
106
|
$b.querySelector('.dialog__container').innerHTML = content;
|
|
112
107
|
await show($b);
|
|
113
|
-
|
|
108
|
+
initRequestContent($b);
|
|
109
|
+
hideLoader();
|
|
114
110
|
} else {
|
|
115
|
-
console.error(`Диалоговое окно с id ${
|
|
111
|
+
console.error(`Диалоговое окно с id ${elementId} не найдено`);
|
|
116
112
|
}
|
|
117
113
|
}
|
|
118
114
|
} else {
|
|
119
|
-
const $b = document.querySelector(
|
|
115
|
+
const $b = document.querySelector(elementId);
|
|
120
116
|
show($b);
|
|
121
117
|
}
|
|
122
118
|
};
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { getSmartCaptcha } from '../../helpers/get-smart-captcha.js';
|
|
4
4
|
import { scrollTo } from '../../helpers/scroll-to.js';
|
|
5
|
-
import {
|
|
6
|
-
import { request } from '../request/index.js';
|
|
7
|
-
|
|
8
|
-
const initFormContent = ($b) => {
|
|
9
|
-
try {
|
|
10
|
-
window.__FORMIX__FORM__INIT_CONTENT($b);
|
|
11
|
-
} catch {
|
|
12
|
-
console.warn('Функция __FORMIX__FORM__INIT_CONTENT не установлена');
|
|
13
|
-
}
|
|
14
|
-
};
|
|
5
|
+
import { initRequestContent, request } from '../request/index.js';
|
|
15
6
|
|
|
16
7
|
export const send = async ($b, url, method, data) => {
|
|
17
8
|
const { success, content } = await request({
|
|
@@ -27,7 +18,7 @@ export const send = async ($b, url, method, data) => {
|
|
|
27
18
|
const $dialog = $b.closest('.dialog');
|
|
28
19
|
if ($dialog) {
|
|
29
20
|
$dialog.querySelector('.dialog__container').innerHTML = content;
|
|
30
|
-
|
|
21
|
+
initRequestContent($dialog);
|
|
31
22
|
setTimeout(() => {
|
|
32
23
|
scrollToError($dialog);
|
|
33
24
|
});
|
|
@@ -37,7 +28,7 @@ export const send = async ($b, url, method, data) => {
|
|
|
37
28
|
const $form = $parent.querySelector('.form');
|
|
38
29
|
if ($form) {
|
|
39
30
|
init($form);
|
|
40
|
-
|
|
31
|
+
initRequestContent($form);
|
|
41
32
|
setTimeout(() => {
|
|
42
33
|
scrollToError($form);
|
|
43
34
|
});
|
|
@@ -3,11 +3,27 @@
|
|
|
3
3
|
import { is } from '@advdominion/is';
|
|
4
4
|
|
|
5
5
|
import { errorHandler } from '../../helpers/error-handler.js';
|
|
6
|
-
import { hide as hideDialog,
|
|
6
|
+
import { hide as hideDialog, show as showDialog } from '../dialog/index.js';
|
|
7
7
|
import { clearLoaderTimeout, hide as hideLoader, show as showLoader } from '../loader/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import { hide as hideSidebar, show as showSidebar } from '../sidebar/index.js';
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const initRequestContent = ($b) => {
|
|
11
|
+
try {
|
|
12
|
+
window.__FORMIX__REQUEST__INIT_CONTENT($b);
|
|
13
|
+
} catch {
|
|
14
|
+
console.warn('Функция __FORMIX__REQUEST__INIT_CONTENT не установлена');
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const request = async ({
|
|
19
|
+
$b,
|
|
20
|
+
url = '',
|
|
21
|
+
method = 'GET',
|
|
22
|
+
data = {},
|
|
23
|
+
loader = true,
|
|
24
|
+
showLoaderDelay,
|
|
25
|
+
hideLoaderOnSuccess = true,
|
|
26
|
+
}) => {
|
|
11
27
|
url = new URL(url, location.origin);
|
|
12
28
|
const options = {
|
|
13
29
|
method,
|
|
@@ -78,7 +94,7 @@ export const request = async ({ $b, url = '', method = 'GET', data = {}, loader
|
|
|
78
94
|
if ($dialog) {
|
|
79
95
|
$dialog.querySelector('.dialog__container').innerHTML = data.dialog.content;
|
|
80
96
|
await showDialog($dialog);
|
|
81
|
-
|
|
97
|
+
initRequestContent($dialog);
|
|
82
98
|
} else {
|
|
83
99
|
console.error(`Диалоговое окно с id ${data.trigger} не найдено`);
|
|
84
100
|
}
|
|
@@ -110,11 +126,33 @@ export const request = async ({ $b, url = '', method = 'GET', data = {}, loader
|
|
|
110
126
|
if ($sidebar) {
|
|
111
127
|
$sidebar.innerHTML = data.sidebar.content;
|
|
112
128
|
await showSidebar($sidebar);
|
|
113
|
-
|
|
129
|
+
initRequestContent($sidebar);
|
|
114
130
|
} else {
|
|
115
131
|
console.error(`Сайдбар с id ${data.trigger} не найден`);
|
|
116
132
|
}
|
|
117
133
|
}
|
|
134
|
+
if (data.reloadOnHideSidebar) {
|
|
135
|
+
if (data.sidebar) {
|
|
136
|
+
const $sidebar = document.querySelector(data.sidebar.id);
|
|
137
|
+
$sidebar?.addEventListener('sidebar-hide', () => {
|
|
138
|
+
location.reload();
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
$b?.closest('.sidebar').addEventListener('sidebar-hide', () => {
|
|
142
|
+
location.reload();
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (data.hideSidebar) {
|
|
147
|
+
if (data.sidebar) {
|
|
148
|
+
const $sidebar = document.querySelector(data.sidebar.id);
|
|
149
|
+
if ($sidebar) {
|
|
150
|
+
hideSidebar($sidebar);
|
|
151
|
+
}
|
|
152
|
+
} else if ($b) {
|
|
153
|
+
hideSidebar($b.closest('.sidebar'));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
118
156
|
if (data.trigger) {
|
|
119
157
|
const $trigger = document.querySelector(data.trigger);
|
|
120
158
|
if ($trigger) {
|
|
@@ -126,7 +164,13 @@ export const request = async ({ $b, url = '', method = 'GET', data = {}, loader
|
|
|
126
164
|
}
|
|
127
165
|
}
|
|
128
166
|
}
|
|
129
|
-
if (
|
|
167
|
+
if (
|
|
168
|
+
!(data.reloadOnHideDialog && data.hideDialog) &&
|
|
169
|
+
!(data.reloadOnHideSidebar && data.hideSidebar) &&
|
|
170
|
+
(!data.trigger || data.hideDialog || data.hideSidebar) &&
|
|
171
|
+
loader &&
|
|
172
|
+
hideLoaderOnSuccess
|
|
173
|
+
) {
|
|
130
174
|
hideLoader();
|
|
131
175
|
}
|
|
132
176
|
}
|
|
@@ -155,7 +199,7 @@ document.body.addEventListener('click', (event) => {
|
|
|
155
199
|
}
|
|
156
200
|
if ($el.dataset.requestData) {
|
|
157
201
|
try {
|
|
158
|
-
options.
|
|
202
|
+
options.data = JSON.parse($el.dataset.requestData);
|
|
159
203
|
} catch {
|
|
160
204
|
console.warn('Ошибка при попытке преобразования значения data-request-data в JSON');
|
|
161
205
|
}
|
|
@@ -1,67 +1,83 @@
|
|
|
1
1
|
import { cssVar } from '../../helpers/css-var.js';
|
|
2
2
|
import { mm } from '../../helpers/mm.js';
|
|
3
|
+
import { hide as hideLoader } from '../loader/index.js';
|
|
3
4
|
import { disableScroll, enableScroll, hide as hideOverlay, show as showOverlay } from '../overlay/index.js';
|
|
4
|
-
import { request } from '../request/index.js';
|
|
5
|
+
import { initRequestContent, request } from '../request/index.js';
|
|
5
6
|
|
|
6
7
|
export const show = async ($b) => {
|
|
7
|
-
if ($b
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
width =
|
|
8
|
+
if ($b?.hidden) {
|
|
9
|
+
$b.dispatchEvent(new CustomEvent('sidebar-show'));
|
|
10
|
+
|
|
11
|
+
if ($b.id !== 'settings-generator') {
|
|
12
|
+
disableScroll();
|
|
13
|
+
}
|
|
14
|
+
$b.hidden = false;
|
|
15
|
+
showOverlay();
|
|
16
|
+
|
|
17
|
+
let width = mm('tablet-landscape-up')
|
|
18
|
+
? $b.offsetWidth + $b.querySelector('.sidebar__aside').offsetWidth
|
|
19
|
+
: $b.offsetWidth;
|
|
20
|
+
if ($b.classList.contains('sidebar_left')) {
|
|
21
|
+
width = width * -1;
|
|
22
|
+
}
|
|
23
|
+
await $b.animate([{ transform: `translateX(${width}px)` }, { transform: 'translateX(0px)' }], {
|
|
24
|
+
duration: cssVar('--duration-enter-m'),
|
|
25
|
+
easing: cssVar('--easing-deceleration'),
|
|
26
|
+
}).finished;
|
|
27
|
+
|
|
28
|
+
$b.dispatchEvent(new CustomEvent('sidebar-shown'));
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
30
|
+
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
22
34
|
};
|
|
23
35
|
|
|
24
36
|
export const hide = async ($b) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
? $b.offsetWidth + $b.querySelector('.sidebar__aside').offsetWidth
|
|
28
|
-
: $b.offsetWidth;
|
|
29
|
-
if ($b.classList.contains('sidebar_left')) {
|
|
30
|
-
width = width * -1;
|
|
31
|
-
}
|
|
32
|
-
await $b.animate([{ transform: 'translateX(0px)' }, { transform: `translateX(${width}px)` }], {
|
|
33
|
-
duration: cssVar('--duration-leave-m'),
|
|
34
|
-
easing: cssVar('--easing-acceleration'),
|
|
35
|
-
}).finished;
|
|
36
|
-
$b.hidden = true;
|
|
37
|
-
if ($b.id !== 'settings-generator') {
|
|
38
|
-
enableScroll();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
37
|
+
if ($b && !$b.hidden) {
|
|
38
|
+
$b.dispatchEvent(new CustomEvent('sidebar-hide'));
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
hideOverlay();
|
|
41
|
+
|
|
42
|
+
let width = mm('tablet-landscape-up')
|
|
43
|
+
? $b.offsetWidth + $b.querySelector('.sidebar__aside').offsetWidth
|
|
44
|
+
: $b.offsetWidth;
|
|
45
|
+
if ($b.classList.contains('sidebar_left')) {
|
|
46
|
+
width = width * -1;
|
|
47
|
+
}
|
|
48
|
+
await $b.animate([{ transform: 'translateX(0px)' }, { transform: `translateX(${width}px)` }], {
|
|
49
|
+
duration: cssVar('--duration-leave-m'),
|
|
50
|
+
easing: cssVar('--easing-acceleration'),
|
|
51
|
+
}).finished;
|
|
52
|
+
|
|
53
|
+
$b.hidden = true;
|
|
54
|
+
if ($b.id !== 'settings-generator') {
|
|
55
|
+
enableScroll();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$b.dispatchEvent(new CustomEvent('sidebar-hidden'));
|
|
59
|
+
} else if ($b.id !== 'settings-generator') {
|
|
60
|
+
enableScroll();
|
|
47
61
|
}
|
|
48
62
|
};
|
|
49
63
|
|
|
50
64
|
export const get = async (id, url, showLoaderDelay) => {
|
|
65
|
+
const elementId = id.startsWith('#') ? id : `#${id}`;
|
|
51
66
|
if (url && url !== '#') {
|
|
52
|
-
const { content } = await request({ url, showLoaderDelay });
|
|
67
|
+
const { content } = await request({ url, showLoaderDelay, hideLoaderOnSuccess: false });
|
|
53
68
|
if (content) {
|
|
54
|
-
const $b = document.querySelector(
|
|
69
|
+
const $b = document.querySelector(elementId);
|
|
55
70
|
if ($b) {
|
|
56
71
|
$b.innerHTML = content;
|
|
57
72
|
await show($b);
|
|
58
|
-
|
|
73
|
+
initRequestContent($b);
|
|
74
|
+
hideLoader();
|
|
59
75
|
} else {
|
|
60
|
-
console.error(`Сайдбар с id ${
|
|
76
|
+
console.error(`Сайдбар с id ${elementId} не найден`);
|
|
61
77
|
}
|
|
62
78
|
}
|
|
63
79
|
} else {
|
|
64
|
-
const $b = document.querySelector(
|
|
80
|
+
const $b = document.querySelector(elementId);
|
|
65
81
|
show($b);
|
|
66
82
|
}
|
|
67
83
|
};
|
|
@@ -13,19 +13,19 @@ $b: '.tabs';
|
|
|
13
13
|
width: 100%;
|
|
14
14
|
|
|
15
15
|
@media (--tablet-portrait-down) {
|
|
16
|
-
margin-left: -
|
|
17
|
-
margin-right: -
|
|
18
|
-
padding-left:
|
|
19
|
-
padding-right:
|
|
16
|
+
margin-left: -16px;
|
|
17
|
+
margin-right: -16px;
|
|
18
|
+
padding-left: 16px;
|
|
19
|
+
padding-right: 16px;
|
|
20
20
|
width: calc(100% + 32px);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.account & {
|
|
24
24
|
@media (--tablet-portrait-down) {
|
|
25
|
-
margin-left: -
|
|
26
|
-
margin-right: -
|
|
27
|
-
padding-left:
|
|
28
|
-
padding-right:
|
|
25
|
+
margin-left: -24px;
|
|
26
|
+
margin-right: -24px;
|
|
27
|
+
padding-left: 24px;
|
|
28
|
+
padding-right: 24px;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ $b: '.tabs';
|
|
|
38
38
|
left: 0;
|
|
39
39
|
position: absolute;
|
|
40
40
|
top: 0;
|
|
41
|
-
width:
|
|
41
|
+
width: 16px;
|
|
42
42
|
z-index: 2;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -59,7 +59,7 @@ $b: '.tabs';
|
|
|
59
59
|
position: absolute;
|
|
60
60
|
right: 0;
|
|
61
61
|
top: 0;
|
|
62
|
-
width:
|
|
62
|
+
width: 16px;
|
|
63
63
|
z-index: 2;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -82,9 +82,9 @@ $b: '.tabs';
|
|
|
82
82
|
border-bottom: $tabs-border-width solid $tabs-border-color;
|
|
83
83
|
display: block;
|
|
84
84
|
margin-bottom: $tabs-border-width * -1;
|
|
85
|
-
padding: 0
|
|
86
|
-
padding-bottom:
|
|
87
|
-
padding-top:
|
|
85
|
+
padding: 0 16px;
|
|
86
|
+
padding-bottom: 12px;
|
|
87
|
+
padding-top: 12px;
|
|
88
88
|
|
|
89
89
|
&:first-of-type {
|
|
90
90
|
padding-left: 0;
|
|
@@ -96,7 +96,7 @@ $b: '.tabs';
|
|
|
96
96
|
|
|
97
97
|
div#{$b}__item + &:any-link,
|
|
98
98
|
div#{$b}__item + &:enabled {
|
|
99
|
-
padding-left:
|
|
99
|
+
padding-left: 16px;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
&.swiper-slide {
|
|
@@ -114,11 +114,13 @@ $b: '.tabs';
|
|
|
114
114
|
background-color: $tabs-counter-bg;
|
|
115
115
|
border-radius: $tabs-counter-radius;
|
|
116
116
|
color: $tabs-counter-color;
|
|
117
|
-
height:
|
|
117
|
+
height: 20px;
|
|
118
118
|
padding-bottom: 2px;
|
|
119
|
-
padding-left: 4px
|
|
120
|
-
padding-right: 4px
|
|
119
|
+
padding-left: 4px;
|
|
120
|
+
padding-right: 4px;
|
|
121
121
|
padding-top: 3px;
|
|
122
|
+
position: relative;
|
|
123
|
+
top: -1px;
|
|
122
124
|
|
|
123
125
|
@include font($tabs-counter-font);
|
|
124
126
|
}
|
|
@@ -8,25 +8,21 @@ $b: '.warning-message';
|
|
|
8
8
|
border-radius: $warning-message-radius;
|
|
9
9
|
box-shadow: $warning-message-shadow;
|
|
10
10
|
display: flex;
|
|
11
|
-
padding
|
|
12
|
-
padding-left: 4px * 4;
|
|
13
|
-
padding-right: 4px * 4;
|
|
14
|
-
padding-top: 4px * 4;
|
|
11
|
+
padding: 16px 16px 24px;
|
|
15
12
|
|
|
16
13
|
@include dark-border;
|
|
17
14
|
|
|
18
15
|
@media (--tablet-landscape-up) {
|
|
19
|
-
padding
|
|
20
|
-
padding-left: 4px * 6;
|
|
21
|
-
padding-right: 4px * 6;
|
|
22
|
-
padding-top: 4px * 6;
|
|
16
|
+
padding: 24px 24px 32px;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
&_small {
|
|
26
|
-
|
|
27
|
-
padding
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
box-shadow: $warning-message-small-shadow;
|
|
21
|
+
padding: 16px 16px 24px;
|
|
22
|
+
|
|
23
|
+
&:has(#{$b}__content:last-child #{$b}__descr:first-child) {
|
|
24
|
+
padding-bottom: 16px;
|
|
25
|
+
}
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
&_success {
|
|
@@ -62,51 +58,51 @@ $b: '.warning-message';
|
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
&__icon {
|
|
65
|
-
fill: $warning-message-color;
|
|
61
|
+
fill: $warning-message-icon-color;
|
|
66
62
|
flex-shrink: 0;
|
|
67
|
-
height:
|
|
68
|
-
margin-right:
|
|
69
|
-
width:
|
|
63
|
+
height: 24px;
|
|
64
|
+
margin-right: 8px;
|
|
65
|
+
width: 24px;
|
|
70
66
|
|
|
71
67
|
#{$b}_small & {
|
|
72
|
-
height:
|
|
73
|
-
width:
|
|
68
|
+
height: 20px;
|
|
69
|
+
width: 20px;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
#{$b}_solid & {
|
|
77
|
-
fill: $warning-message-solid-
|
|
73
|
+
fill: $warning-message-solid-icon-color;
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
#{$b}_success & {
|
|
81
|
-
fill: $warning-message-success-color;
|
|
77
|
+
fill: $warning-message-success-icon-color;
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
#{$b}_solid#{$b}_success & {
|
|
85
|
-
fill: $warning-message-solid-success-color;
|
|
81
|
+
fill: $warning-message-solid-success-icon-color;
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
#{$b}_info & {
|
|
89
|
-
fill: $warning-message-info-color;
|
|
85
|
+
fill: $warning-message-info-icon-color;
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
#{$b}_solid#{$b}_info & {
|
|
93
|
-
fill: $warning-message-solid-info-color;
|
|
89
|
+
fill: $warning-message-solid-info-icon-color;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
#{$b}_light-info & {
|
|
97
|
-
fill: $warning-message-light-info-color;
|
|
93
|
+
fill: $warning-message-light-info-icon-color;
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
#{$b}_solid#{$b}_light-info & {
|
|
101
|
-
fill: $warning-message-solid-light-info-color;
|
|
97
|
+
fill: $warning-message-solid-light-info-icon-color;
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
#{$b}_error & {
|
|
105
|
-
fill: $warning-message-error-color;
|
|
101
|
+
fill: $warning-message-error-icon-color;
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
#{$b}_solid#{$b}_error & {
|
|
109
|
-
fill: $warning-message-solid-error-color;
|
|
105
|
+
fill: $warning-message-solid-error-icon-color;
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
|
|
@@ -223,10 +219,10 @@ $b: '.warning-message';
|
|
|
223
219
|
|
|
224
220
|
&__action {
|
|
225
221
|
flex-shrink: 0;
|
|
226
|
-
margin-top:
|
|
222
|
+
margin-top: 16px;
|
|
227
223
|
|
|
228
224
|
@media (--tablet-landscape-up) {
|
|
229
|
-
margin-left:
|
|
225
|
+
margin-left: 24px;
|
|
230
226
|
margin-top: 0;
|
|
231
227
|
}
|
|
232
228
|
}
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
<a
|
|
10
10
|
v-if="actionUrl.length > 0"
|
|
11
11
|
class="warning-message__action button"
|
|
12
|
-
:class="{
|
|
12
|
+
:class="{
|
|
13
|
+
button_inverted: solid && type !== 'light-info',
|
|
14
|
+
button_alt: !solid || type === 'light-info',
|
|
15
|
+
}"
|
|
13
16
|
:href="actionUrl"
|
|
14
17
|
>
|
|
15
18
|
<svg v-if="actionIcon.length > 0" class="button__icon">
|
|
@@ -61,7 +64,7 @@ const props = defineProps({
|
|
|
61
64
|
},
|
|
62
65
|
});
|
|
63
66
|
|
|
64
|
-
const { type, small, solid, title, descr } = toRefs(props);
|
|
67
|
+
const { type, small, solid, title, descr, actionUrl, actionIcon, noIcon } = toRefs(props);
|
|
65
68
|
|
|
66
69
|
const classes = computed(() => {
|
|
67
70
|
return {
|
package/src/variables.scss
CHANGED
|
@@ -977,8 +977,8 @@ $tabs-line-color: $color-primary !default;
|
|
|
977
977
|
$tabs-label-font: ('font-weight': bold, 'font-size': $font-size, 'line-height': 1) !default;
|
|
978
978
|
|
|
979
979
|
$tabs-counter-bg: $color-grey-80 !default;
|
|
980
|
-
$tabs-counter-color: $color-
|
|
981
|
-
$tabs-counter-font: ('font-
|
|
980
|
+
$tabs-counter-color: $font-color-primary !default;
|
|
981
|
+
$tabs-counter-font: ('font-size': $font-size-xs) !default;
|
|
982
982
|
$tabs-counter-radius: $radius-s !default;
|
|
983
983
|
|
|
984
984
|
/********** Всплывающие подсказки / Tooltips **********/
|
|
@@ -1013,30 +1013,43 @@ $warning-message-radius: $radius !default;
|
|
|
1013
1013
|
$warning-message-shadow: $shadow !default;
|
|
1014
1014
|
$warning-message-color: $color-warning !default;
|
|
1015
1015
|
|
|
1016
|
-
$warning-message-
|
|
1017
|
-
$warning-message-descr-font: ('font-size': $font-size, 'line-height': $line-height) !default;
|
|
1018
|
-
$warning-message-descr-color: $font-color-secondary !default;
|
|
1016
|
+
$warning-message-small-shadow: $shadow-s !default;
|
|
1019
1017
|
|
|
1020
|
-
$warning-message-
|
|
1021
|
-
$warning-message-small-descr-font: ('font-size': $font-size-xs, 'line-height': $line-height) !default;
|
|
1018
|
+
$warning-message-solid-color: $font-color-inverted !default;
|
|
1022
1019
|
|
|
1023
1020
|
$warning-message-success-color: $color-success !default;
|
|
1024
|
-
$warning-message-info-color: $color-primary !default;
|
|
1025
|
-
$warning-message-light-info-color: $color-primary-80 !default;
|
|
1026
|
-
$warning-message-error-color: $color-error !default;
|
|
1027
|
-
|
|
1028
|
-
$warning-message-solid-color: $font-color-inverted !default;
|
|
1029
1021
|
$warning-message-solid-success-color: $warning-message-solid-color !default;
|
|
1022
|
+
$warning-message-info-color: $color-primary !default;
|
|
1030
1023
|
$warning-message-solid-info-color: $warning-message-solid-color !default;
|
|
1024
|
+
$warning-message-light-info-color: $color-primary-70 !default;
|
|
1031
1025
|
$warning-message-solid-light-info-color: $font-color-secondary !default;
|
|
1026
|
+
$warning-message-error-color: $color-error !default;
|
|
1032
1027
|
$warning-message-solid-error-color: $warning-message-solid-color !default;
|
|
1033
1028
|
|
|
1029
|
+
$warning-message-title-font: ('font-weight': bold, 'font-size': $font-size-l, 'line-height': $line-height-s) !default;
|
|
1030
|
+
$warning-message-small-title-font: ('font-weight': bold, 'font-size': $font-size-s, 'line-height': $line-height-s) !default;
|
|
1031
|
+
|
|
1032
|
+
$warning-message-descr-font: ('font-size': $font-size, 'line-height': $line-height) !default;
|
|
1033
|
+
$warning-message-small-descr-font: ('font-size': $font-size-xs, 'line-height': $line-height) !default;
|
|
1034
|
+
|
|
1035
|
+
$warning-message-descr-color: $font-color-secondary !default;
|
|
1034
1036
|
$warning-message-solid-descr-color: $warning-message-solid-color !default;
|
|
1035
1037
|
$warning-message-solid-success-descr-color: $warning-message-solid-success-color !default;
|
|
1036
1038
|
$warning-message-solid-info-descr-color: $warning-message-solid-info-color !default;
|
|
1037
1039
|
$warning-message-solid-light-info-descr-color: $warning-message-solid-light-info-color !default;
|
|
1038
1040
|
$warning-message-solid-error-descr-color: $warning-message-solid-error-color !default;
|
|
1039
1041
|
|
|
1042
|
+
$warning-message-icon-color: $warning-message-solid-color !default;
|
|
1043
|
+
$warning-message-solid-icon-color: $warning-message-icon-color !default;
|
|
1044
|
+
$warning-message-success-icon-color: $warning-message-solid-success-color !default;
|
|
1045
|
+
$warning-message-solid-success-icon-color: $warning-message-success-icon-color !default;
|
|
1046
|
+
$warning-message-info-icon-color: $warning-message-solid-info-color !default;
|
|
1047
|
+
$warning-message-solid-info-icon-color: $warning-message-info-icon-color !default;
|
|
1048
|
+
$warning-message-light-info-icon-color: $color-primary-70 !default;
|
|
1049
|
+
$warning-message-solid-light-info-icon-color: $color-primary !default;
|
|
1050
|
+
$warning-message-error-icon-color: $warning-message-solid-error-color !default;
|
|
1051
|
+
$warning-message-solid-error-icon-color: $warning-message-error-icon-color !default;
|
|
1052
|
+
|
|
1040
1053
|
/********** Панель пустого состояния (.empty-list) **********/
|
|
1041
1054
|
|
|
1042
1055
|
$empty-list-bg: $bg-color-tertiary !default;
|
package/src/helpers/request.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/* globals BX */
|
|
2
|
-
|
|
3
|
-
import { is } from '@advdominion/is';
|
|
4
|
-
|
|
5
|
-
import { hide as hideDialog, initDialogContent, show as showDialog } from '../components/dialog/index.js';
|
|
6
|
-
import { clearLoaderTimeout, hide as hideLoader, show as showLoader } from '../components/loader.js';
|
|
7
|
-
import { initSidebarContent, show as showSidebar } from '../components/sidebar/index.js';
|
|
8
|
-
import { errorHandler } from './error-handler.js';
|
|
9
|
-
|
|
10
|
-
export const req = async ({ $b, url = '', method = 'GET', data = {}, loader = true, showLoaderDelay }) => {
|
|
11
|
-
url = new URL(url, location.origin);
|
|
12
|
-
const options = {
|
|
13
|
-
method,
|
|
14
|
-
headers: {
|
|
15
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
16
|
-
'X-Session-Id': BX.message('bitrix_sessid'),
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
if (method === 'GET') {
|
|
20
|
-
for (const [name, value] of data) {
|
|
21
|
-
url.searchParams.append(name, value);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
options.body = data;
|
|
25
|
-
}
|
|
26
|
-
if (loader) {
|
|
27
|
-
showLoader(showLoaderDelay);
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const response = await fetch(url, options);
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
throw response;
|
|
33
|
-
}
|
|
34
|
-
const data = await response.json().catch(async () => {
|
|
35
|
-
console.warn('Ошибка при попытке преобразования ответа в JSON.');
|
|
36
|
-
const content = await response.text();
|
|
37
|
-
return { content };
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (is(data.redirect, 'String')) {
|
|
41
|
-
if (data.redirect) {
|
|
42
|
-
location.assign(data.redirect);
|
|
43
|
-
if (data.redirect.startsWith('tg:')) {
|
|
44
|
-
if (loader) {
|
|
45
|
-
hideLoader();
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
clearLoaderTimeout();
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
location.reload();
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
try {
|
|
55
|
-
await window.__FORMIX__REQ__INTERCEPT_DATA(data);
|
|
56
|
-
} catch {
|
|
57
|
-
console.warn('Функция __FORMIX__REQUEST__INTERCEPT_DATA не установлена');
|
|
58
|
-
}
|
|
59
|
-
if (data.dialog) {
|
|
60
|
-
const $dialog = document.querySelector(data.dialog.id);
|
|
61
|
-
if ($dialog) {
|
|
62
|
-
$dialog.querySelector('.dialog__container').innerHTML = data.dialog.content;
|
|
63
|
-
await showDialog($dialog);
|
|
64
|
-
initDialogContent($dialog);
|
|
65
|
-
} else {
|
|
66
|
-
console.error(`Диалоговое окно с id ${data.trigger} не найдено`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (data.reloadOnHideDialog) {
|
|
70
|
-
if (data.dialog) {
|
|
71
|
-
const $dialog = document.querySelector(data.dialog.id);
|
|
72
|
-
$dialog?.addEventListener('dialog-hide', () => {
|
|
73
|
-
location.reload();
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
$b?.closest('.dialog').addEventListener('dialog-hide', () => {
|
|
77
|
-
location.reload();
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (data.hideDialog) {
|
|
82
|
-
if (data.dialog) {
|
|
83
|
-
const $dialog = document.querySelector(data.dialog.id);
|
|
84
|
-
if ($dialog) {
|
|
85
|
-
hideDialog($dialog);
|
|
86
|
-
}
|
|
87
|
-
} else if ($b) {
|
|
88
|
-
hideDialog($b.closest('.dialog'));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (data.sidebar) {
|
|
92
|
-
const $sidebar = document.querySelector(data.sidebar.id);
|
|
93
|
-
if ($sidebar) {
|
|
94
|
-
$sidebar.innerHTML = data.sidebar.content;
|
|
95
|
-
await showSidebar($sidebar);
|
|
96
|
-
initSidebarContent($sidebar);
|
|
97
|
-
} else {
|
|
98
|
-
console.error(`Сайдбар с id ${data.trigger} не найден`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (data.trigger) {
|
|
102
|
-
const $trigger = document.querySelector(data.trigger);
|
|
103
|
-
if ($trigger) {
|
|
104
|
-
$trigger?.click();
|
|
105
|
-
console.error(`Элемент с селектором ${data.trigger} не найден`);
|
|
106
|
-
} else if (loader) {
|
|
107
|
-
hideLoader();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (!(data.reloadOnHideDialog && data.hideDialog) && (!data.trigger || data.hideDialog) && loader) {
|
|
111
|
-
hideLoader();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return data;
|
|
116
|
-
} catch (error) {
|
|
117
|
-
if (error.status === 401) {
|
|
118
|
-
location.reload();
|
|
119
|
-
} else {
|
|
120
|
-
if (loader) {
|
|
121
|
-
hideLoader();
|
|
122
|
-
}
|
|
123
|
-
errorHandler(error);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|