@formixru/b2b-ui 1.0.4 → 1.1.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
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## v1.1.0
|
|
2
|
+
|
|
3
|
+
- Использование cssVar() в ColorInput для работы с предустановленными цветами
|
|
4
|
+
|
|
5
|
+
## v1.0.5
|
|
6
|
+
|
|
7
|
+
- Доработки по коду и документации
|
|
8
|
+
- Функция `__FORMIX__DIALOG__INIT_JSON` переименована в `__FORMIX__DIALOG__INTERCEPT_DATA`
|
|
9
|
+
- Обновлена требуемая версия @advdominion/tooltip
|
|
10
|
+
- Доработки по работе по .tabs
|
|
11
|
+
|
|
1
12
|
## v1.0.4
|
|
2
13
|
|
|
3
14
|
- Добавлены новые переменные для .slider-nav
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formixru/b2b-ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@advdominion/is": "^1.0.1",
|
|
29
29
|
"@advdominion/lightningcss-loader": "^1.0.0",
|
|
30
30
|
"@advdominion/pluralize": "^1.0.1",
|
|
31
|
-
"@advdominion/tooltip": "^
|
|
31
|
+
"@advdominion/tooltip": "^3.0.0",
|
|
32
32
|
"@eslint/eslintrc": "^3.2.0",
|
|
33
33
|
"@eslint/js": "^9.18.0",
|
|
34
34
|
"@floating-ui/dom": "^1.6.13",
|
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
import Color from 'color';
|
|
79
79
|
import { computed, ref, toRefs, watch } from 'vue';
|
|
80
80
|
|
|
81
|
+
import { cssVar } from '../../helpers/css-var.js';
|
|
82
|
+
|
|
81
83
|
const ICONS_PATH = window.ICONS_PATH;
|
|
82
84
|
|
|
83
85
|
const emit = defineEmits(['input']);
|
|
@@ -129,11 +131,7 @@ const setColor = (color) => {
|
|
|
129
131
|
|
|
130
132
|
const getHexColor = (color) => {
|
|
131
133
|
if (color.charAt(0) === '$') {
|
|
132
|
-
|
|
133
|
-
$div.classList.add(color.replace('$', 'theme-'));
|
|
134
|
-
document.body.append($div);
|
|
135
|
-
color = getComputedStyle($div).backgroundColor;
|
|
136
|
-
$div.remove();
|
|
134
|
+
color = cssVar(color.replace('$', '--'));
|
|
137
135
|
return Color(color).hex().toLowerCase();
|
|
138
136
|
}
|
|
139
137
|
return color;
|
|
@@ -125,7 +125,7 @@ export const get = async (id, url) => {
|
|
|
125
125
|
try {
|
|
126
126
|
data = JSON.parse(data);
|
|
127
127
|
if (is(data.redirect, 'String')) {
|
|
128
|
-
if (data.redirect
|
|
128
|
+
if (data.redirect) {
|
|
129
129
|
location.assign(data.redirect);
|
|
130
130
|
clearLoaderTimeout();
|
|
131
131
|
} else {
|
|
@@ -133,9 +133,9 @@ export const get = async (id, url) => {
|
|
|
133
133
|
}
|
|
134
134
|
} else {
|
|
135
135
|
try {
|
|
136
|
-
await window.
|
|
136
|
+
await window.__FORMIX__DIALOG__INTERCEPT_DATA(data);
|
|
137
137
|
} catch {
|
|
138
|
-
console.warn('Функция
|
|
138
|
+
console.warn('Функция __FORMIX__DIALOG__INTERCEPT_DATA не установлена');
|
|
139
139
|
}
|
|
140
140
|
data = data.content || '';
|
|
141
141
|
}
|
|
@@ -44,49 +44,7 @@ export const send = async ($b, url, method, data) => {
|
|
|
44
44
|
console.warn('Ошибка при попытке преобразования ответа в JSON.');
|
|
45
45
|
return {};
|
|
46
46
|
});
|
|
47
|
-
if (data.
|
|
48
|
-
$b.dispatchEvent(new CustomEvent('form-success', { bubbles: true }));
|
|
49
|
-
}
|
|
50
|
-
if (data.dialog) {
|
|
51
|
-
const $dialog = document.querySelector(data.dialog.id);
|
|
52
|
-
$dialog.querySelector('.dialog__container').innerHTML = data.dialog.content;
|
|
53
|
-
showDialog($dialog);
|
|
54
|
-
}
|
|
55
|
-
if (data.reloadOnHideDialog) {
|
|
56
|
-
$b.closest('.dialog').addEventListener('dialog-hide', () => {
|
|
57
|
-
location.reload();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (data.hideDialog) {
|
|
61
|
-
hideDialog($b.closest('.dialog'));
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
await window.__FORMIX__FORM__INTERCEPT_DATA(data);
|
|
65
|
-
} catch {
|
|
66
|
-
console.warn('Функция __FORMIX__FORM__INTERCEPT_DATA не установлена');
|
|
67
|
-
}
|
|
68
|
-
if (data.content) {
|
|
69
|
-
hideLoader();
|
|
70
|
-
const $dialog = $b.closest('.dialog');
|
|
71
|
-
if ($dialog) {
|
|
72
|
-
$dialog.querySelector('.dialog__container').innerHTML = data.content;
|
|
73
|
-
initDialogContent($dialog);
|
|
74
|
-
setTimeout(() => {
|
|
75
|
-
scrollToError($dialog);
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
const $parent = $b.parentElement;
|
|
79
|
-
$b.outerHTML = data.content;
|
|
80
|
-
const $form = $parent.querySelector('.form');
|
|
81
|
-
if ($form) {
|
|
82
|
-
init($form);
|
|
83
|
-
initFormContent($form);
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
scrollToError($form);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} else if (is(data.redirect, 'String')) {
|
|
47
|
+
if (is(data.redirect, 'String')) {
|
|
90
48
|
if (data.redirect) {
|
|
91
49
|
location.assign(data.redirect);
|
|
92
50
|
if (data.redirect.startsWith('tg:')) {
|
|
@@ -98,7 +56,51 @@ export const send = async ($b, url, method, data) => {
|
|
|
98
56
|
location.reload();
|
|
99
57
|
}
|
|
100
58
|
} else {
|
|
101
|
-
|
|
59
|
+
if (!(data.reloadOnHideDialog && data.hideDialog)) {
|
|
60
|
+
hideLoader();
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await window.__FORMIX__FORM__INTERCEPT_DATA(data);
|
|
64
|
+
} catch {
|
|
65
|
+
console.warn('Функция __FORMIX__FORM__INTERCEPT_DATA не установлена');
|
|
66
|
+
}
|
|
67
|
+
if (data.success) {
|
|
68
|
+
$b.dispatchEvent(new CustomEvent('form-success', { bubbles: true }));
|
|
69
|
+
}
|
|
70
|
+
if (data.dialog) {
|
|
71
|
+
const $dialog = document.querySelector(data.dialog.id);
|
|
72
|
+
$dialog.querySelector('.dialog__container').innerHTML = data.dialog.content;
|
|
73
|
+
showDialog($dialog);
|
|
74
|
+
}
|
|
75
|
+
if (data.reloadOnHideDialog) {
|
|
76
|
+
$b.closest('.dialog').addEventListener('dialog-hide', () => {
|
|
77
|
+
location.reload();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (data.hideDialog) {
|
|
81
|
+
hideDialog($b.closest('.dialog'));
|
|
82
|
+
}
|
|
83
|
+
if (data.content) {
|
|
84
|
+
const $dialog = $b.closest('.dialog');
|
|
85
|
+
if ($dialog) {
|
|
86
|
+
$dialog.querySelector('.dialog__container').innerHTML = data.content;
|
|
87
|
+
initDialogContent($dialog);
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
scrollToError($dialog);
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
const $parent = $b.parentElement;
|
|
93
|
+
$b.outerHTML = data.content;
|
|
94
|
+
const $form = $parent.querySelector('.form');
|
|
95
|
+
if ($form) {
|
|
96
|
+
init($form);
|
|
97
|
+
initFormContent($form);
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
scrollToError($form);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
102
104
|
}
|
|
103
105
|
} catch (error) {
|
|
104
106
|
if (error.status === 401) {
|
|
@@ -88,10 +88,9 @@ export const get = async (id, url, showLoaderDelay) => {
|
|
|
88
88
|
if (data.length > 0) {
|
|
89
89
|
const $b = document.querySelector(id);
|
|
90
90
|
$b.innerHTML = data;
|
|
91
|
-
show($b)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
91
|
+
await show($b);
|
|
92
|
+
hideLoader();
|
|
93
|
+
initSidebarContent($b);
|
|
95
94
|
} else {
|
|
96
95
|
hideLoader();
|
|
97
96
|
}
|
|
@@ -10,7 +10,7 @@ const setLeftWidth = async ($line, $el) => {
|
|
|
10
10
|
const $label = $el.querySelector('.tabs__label');
|
|
11
11
|
const styles = {
|
|
12
12
|
width: $label.getBoundingClientRect().width,
|
|
13
|
-
left: $label.offsetLeft,
|
|
13
|
+
left: $el.offsetLeft + $label.offsetLeft,
|
|
14
14
|
};
|
|
15
15
|
await $line.animate([{ transform: `translateX(${styles.left}px)`, width: `${styles.width}px` }], {
|
|
16
16
|
duration: cssVar('--duration-effect-s'),
|