@formixru/b2b-ui 1.0.3 → 1.0.5

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,15 @@
1
+ ## v1.0.5
2
+
3
+ - Доработки по коду и документации
4
+ - Функция __FORMIX__DIALOG__INIT_JSON переименована в __FORMIX__DIALOG__INTERCEPT_DATA
5
+ - Обновлена требуемая версия @advdominion/tooltip
6
+ - Доработки по работе по .tabs
7
+
8
+ ## v1.0.4
9
+
10
+ - Добавлены новые переменные для .slider-nav
11
+ - Исправлены ошибки в работе FileInput
12
+
1
13
  ## v1.0.3
2
14
 
3
15
  - Исправлены ошибки в работе SuggestInput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formixru/b2b-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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": "^1.0.0",
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",
@@ -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.length > 0) {
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.__FORMIX__DIALOG__INIT_JSON();
136
+ await window.__FORMIX__DIALOG__INTERCEPT_DATA(data);
137
137
  } catch {
138
- console.warn('Функция __FORMIX__DIALOG__INIT_JSON не установлена');
138
+ console.warn('Функция __FORMIX__DIALOG__INTERCEPT_DATA не установлена');
139
139
  }
140
140
  data = data.content || '';
141
141
  }
@@ -48,7 +48,7 @@
48
48
 
49
49
  import { pluralize } from '@advdominion/pluralize';
50
50
  import mime from 'mime';
51
- import { computed, onMounted, ref, toRefs } from 'vue';
51
+ import { computed, nextTick, onMounted, ref, toRefs } from 'vue';
52
52
 
53
53
  const ICONS_PATH = window.ICONS_PATH;
54
54
 
@@ -265,6 +265,7 @@ const uploadFile = async (file) => {
265
265
  throw response;
266
266
  }
267
267
  files.value[index].uploaded = true;
268
+ await nextTick();
268
269
  emit('upload');
269
270
  } catch (error) {
270
271
  if (error.status === 401) {
@@ -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.success) {
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
- hideLoader();
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).then(() => {
92
- hideLoader();
93
- initSidebarContent($b);
94
- });
91
+ await show($b)
92
+ hideLoader();
93
+ initSidebarContent($b);
95
94
  } else {
96
95
  hideLoader();
97
96
  }
@@ -56,6 +56,8 @@ $b: '.slider-nav';
56
56
 
57
57
  &:not(#{$b}__button_disabled):hover,
58
58
  &:not(#{$b}__button_disabled):focus-visible {
59
+ background-color: $slider-nav-button-fill-white-active-bg;
60
+ border-color: $slider-nav-button-fill-white-active-border-color;
59
61
  color: $slider-nav-button-fill-white-active-color;
60
62
  }
61
63
  }
@@ -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'),
@@ -1049,7 +1049,10 @@ $slider-nav-button-fill-white-bg: $color-white !default;
1049
1049
  $slider-nav-button-fill-white-border-color: $color-white !default;
1050
1050
  $slider-nav-button-fill-white-shadow: $shadow !default;
1051
1051
  $slider-nav-button-fill-white-color: $color-grey-70 !default;
1052
+
1053
+ $slider-nav-button-fill-white-active-bg: $slider-nav-button-fill-white-bg !default;
1052
1054
  $slider-nav-button-fill-white-active-color: $color-grey-40 !default;
1055
+ $slider-nav-button-fill-white-active-border-color: $slider-nav-button-fill-white-border-color !default;
1053
1056
 
1054
1057
  /********** Пагинация слайдеров (.slider-pagination) **********/
1055
1058