plugin-ui-for-kzt 0.0.14 → 0.0.16

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 (32) hide show
  1. package/dist/components/BaseButton/BaseButton.vue.d.ts +3 -3
  2. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +4 -4
  3. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +3 -3
  4. package/dist/components/BaseInput/BaseInput.vue.d.ts +4 -4
  5. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +4 -4
  6. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +4 -4
  7. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +4 -4
  8. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +4 -4
  9. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +3 -3
  10. package/dist/components/BasePagination/BasePagination.vue.d.ts +51 -0
  11. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +4 -4
  12. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -2
  13. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +3 -3
  14. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +4 -4
  15. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +4 -4
  16. package/dist/index.d.ts +3 -2
  17. package/dist/index.js +1 -1
  18. package/dist/sprite.svg +1 -1
  19. package/package.json +1 -1
  20. package/src/assets/icons/arrow-left.svg +4 -0
  21. package/src/assets/icons/arrow-right.svg +4 -0
  22. package/src/components/BasePagination/BasePagination.vue +382 -0
  23. package/src/components/BasePagination/README.md +156 -0
  24. package/src/components/BaseSelect/BaseSelect.vue +3 -3
  25. package/src/components/Modal/Modal.vue +0 -1
  26. package/src/index.ts +34 -14
  27. package/src/sprite.ts +11 -0
  28. package/src/styles/root.scss +1 -0
  29. package/src/types/pagination.d.ts +13 -0
  30. package/webpack.config.js +1 -1
  31. package/src/icons/index.ts +0 -9
  32. /package/dist/{icons/index.d.ts → sprite.d.ts} +0 -0
@@ -0,0 +1,156 @@
1
+ # Компонент BasePagination
2
+
3
+ Компонент `BasePagination` — это повторно используемый компонент Vue 3, предназначенный для навигации по страницам с различными стилями отображения. Он поддерживает числовую пагинацию с эллипсами для больших количеств страниц, а также альтернативные стили, такие как точки и тире, с или без цветного фона. Компонент легко настраивается через пропсы, слоты и переменные SCSS.
4
+
5
+ ## Содержание
6
+ - [Обзор](#обзор)
7
+ - [Использование](#использование)
8
+ - [Базовое использование](#базовое-использование)
9
+ - [Кастомизация текста через слоты](#кастомизация-текста-через-слоты)
10
+ - [Использование разных типов](#использование-разных-типов)
11
+ - [Пропсы](#пропсы)
12
+ - [Слоты](#слоты)
13
+ - [События](#события)
14
+ - [Стилизация](#стилизация)
15
+ - [Зависимости](#зависимости)
16
+
17
+
18
+ ## Обзор
19
+
20
+ Компонент `BasePagination` предоставляет гибкий способ навигации по нескольким страницам. Поддерживаются пять типов пагинации:
21
+ - `numbers`: Отображает номера страниц с эллипсами для больших количеств страниц.
22
+ - `dots`: Отображает до 3 точек для представления страниц.
23
+ - `dotsWithBackground`: Отображает до 3 точек с цветным фоном.
24
+ - `dashes`: Отображает до 3 тире для представления страниц.
25
+ - `dashesWithBackground`: Отображает до 3 тире с цветным фоном.
26
+
27
+ Компонент включает кнопки навигации ("Назад" и "Вперёд") с возможностью кастомизации текста через слоты, а также поддерживает разные размеры и цветовые схемы.
28
+
29
+ ## Использование
30
+
31
+ ### Базовое использование
32
+
33
+ Для использования компонента `BasePagination` с настройками по умолчанию включите его в ваш шаблон и привяжите необходимые пропсы:
34
+
35
+ ```vue
36
+ <template>
37
+ <div>
38
+ <base-pagination
39
+ :current-page="currentPage"
40
+ :total-pages="10"
41
+ @update:current-page="currentPage = $event"
42
+ />
43
+ </div>
44
+ </template>
45
+
46
+ <script setup lang="ts">
47
+ import { ref } from 'vue';
48
+ import BasePagination from './components/BasePagination.vue';
49
+
50
+ const currentPage = ref(1);
51
+ </script>
52
+ ```
53
+
54
+ **Результат**: Компонент отобразит числовую пагинацию с кнопками "Назад" и "Вперёд" по умолчанию.
55
+
56
+ ### Кастомизация текста через слоты
57
+
58
+ Вы можете кастомизировать текст кнопок "Назад" и "Вперёд" с помощью слотов `previousTextButton` и `nextTextButton`:
59
+
60
+ ```vue
61
+ <template>
62
+ <div>
63
+ <base-pagination
64
+ :current-page="currentPage"
65
+ :total-pages="10"
66
+ @update:current-page="currentPage = $event"
67
+ >
68
+ <template #previousTextButton>Назад</template>
69
+ <template #nextTextButton>Вперёд</template>
70
+ </base-pagination>
71
+ </div>
72
+ </template>
73
+ ```
74
+
75
+ **Результат**: Кнопки будут отображать кастомный текст "Назад" и "Вперёд".
76
+
77
+ ### Использование разных типов
78
+
79
+ Компонент поддерживает разные типы пагинации. Пример с типом `dotsWithBackground`:
80
+
81
+ ```vue
82
+ <template>
83
+ <div>
84
+ <base-pagination
85
+ type="dotsWithBackground"
86
+ :current-page="currentPage"
87
+ :total-pages="3"
88
+ color="primary"
89
+ @update:current-page="currentPage = $event"
90
+ >
91
+ <template #previousTextButton>Пред.</template>
92
+ <template #nextTextButton>След.</template>
93
+ </base-pagination>
94
+ </div>
95
+ </template>
96
+ ```
97
+
98
+ **Результат**: Отобразится пагинация с 3 точками на цветном фоне с кастомным текстом "Пред." и "След.".
99
+
100
+ ## Пропсы
101
+
102
+ | Проп | Тип | По умолчанию | Описание |
103
+ |-------------------|----------------------|----------------|-----------------------------------------------|
104
+ | `type` | `PaginationType` | `'numbers'` | Тип пагинации (`numbers`, `dots`, `dotsWithBackground`, `dashes`, `dashesWithBackground`). |
105
+ | `currentPage` | `number` | `1` | Текущая страница. |
106
+ | `totalPages` | `number` | `1` | Общее количество страниц. |
107
+ | `maxDisplayedPages` | `number` | `5` | Максимальное количество отображаемых страниц (только для `numbers`). |
108
+ | `size` | `ICoreSize` | `'medium'` | Размер пагинации (`small`, `medium`, `large`). |
109
+ | `color` | `PaginationColor` | `'primary'` | Цветовая схема (`primary`, `secondary`, `white`, `black`). |
110
+
111
+ ## Слоты
112
+
113
+ | Слот | По умолчанию | Описание |
114
+ |-------------------|----------------|-----------------------------------------------|
115
+ | `previousTextButton` | `'Назад'` | Слот для текста кнопки "Назад". |
116
+ | `nextTextButton` | `'Вперёд'` | Слот для текста кнопки "Вперёд". |
117
+
118
+ Пример использования слотов:
119
+ ```vue
120
+ <base-pagination :current-page="currentPage" :total-pages="10" @update:current-page="currentPage = $event">
121
+ <template #previousTextButton>Пред.</template>
122
+ <template #nextTextButton>След.</template>
123
+ </base-pagination>
124
+ ```
125
+
126
+ ## События
127
+
128
+ | Событие | Описание | Параметры |
129
+ |--------------------|-----------------------------------------------|--------------------------|
130
+ | `update:currentPage` | Вызывается при изменении текущей страницы. | `page` (число) |
131
+
132
+ Пример обработки события:
133
+ ```vue
134
+ <base-pagination
135
+ :current-page="currentPage"
136
+ :total-pages="10"
137
+ @update:current-page="currentPage = $event"
138
+ />
139
+ ```
140
+
141
+ ## Стилизация
142
+
143
+ Компонент использует SCSS для стилизации и поддерживает следующие особенности:
144
+ - **Размеры**: `small`, `medium`, `large` с соответствующими размерами для кнопок и элементов.
145
+ - **Цветовые схемы**: Четыре цветовых варианта (`primary`, `secondary`, `white`, `black`) для типов `dotsWithBackground` и `dashesWithBackground`.
146
+ - **Анимации**: Плавные переходы для активных элементов (масштабирование точек и тире).
147
+ - **Кастомные классы**:
148
+ - `base-pagination--${type}` для разных типов пагинации.
149
+ - `--color-${color}` для цветовых схем.
150
+
151
+ ## Зависимости
152
+
153
+ - `vue` (Vue 3)
154
+ - `BaseButton` (компонент для кнопок)
155
+ - `BaseIcon` (компонент для иконок)
156
+ - `useKitSize` (композиция для управления размером)
@@ -293,7 +293,7 @@ defineSlots<{
293
293
  }
294
294
 
295
295
  &__header {
296
- height: 22px;
296
+ height: 40px;
297
297
  padding: var(--spacing-s) var(--spacing-2l);
298
298
  border-radius: var(--corner-radius-s);
299
299
  }
@@ -320,7 +320,7 @@ defineSlots<{
320
320
  }
321
321
 
322
322
  &__header {
323
- height: 22px;
323
+ height: 48px;
324
324
  padding: var(--spacing-m) var(--spacing-2l);
325
325
  }
326
326
 
@@ -346,7 +346,7 @@ defineSlots<{
346
346
  }
347
347
 
348
348
  &__header {
349
- height: 30px;
349
+ height: 56px;
350
350
  padding: var(--spacing-m) var(--spacing-l);
351
351
  }
352
352
 
@@ -10,7 +10,6 @@
10
10
  <div class="modal-container-header-title">
11
11
  <component :is="getTypeModal.img"/>
12
12
  <div>{{ options.title }}</div>
13
- <div>{{ getTypeModal.nameClass }}</div>
14
13
  </div>
15
14
  <div
16
15
  class="modal-container-header-show-more"
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import Tooltip from "./components/Tooltip/Tooltip.vue";
5
5
  import Spinner from "./components/Spinner/Spinner.vue";
6
6
  import ModalPlugin, { useModal } from "./plugins/modalPlugin";
7
7
  import ToasterPlugin, { useToast } from "./plugins/toasterPlugin";
8
- import "./icons"; // Импортируем иконки для генерации спрайта
8
+ import "./sprite"; // Импортируем иконки для генерации спрайта
9
9
  import "./styles/root.scss";
10
10
  import BaseIcon from "./components/BaseIcon/BaseIcon.vue";
11
11
  import BaseBreadCrumbs from "./components/BaseBreadCrumbs/BaseBreadCrumbs.vue";
@@ -23,6 +23,7 @@ import BaseInputCalendar from "./components/BaseInputCalendar/BaseInputCalendar.
23
23
  import BaseOpenedListItem from "./components/BaseOpenedListItem/BaseOpenedListItem.vue";
24
24
  import BaseDropdown from "./components/BaseDropdown/BaseDropdown.vue";
25
25
  import BaseSelect from "./components/BaseSelect/BaseSelect.vue";
26
+ import BasePagination from "./components/BasePagination/BasePagination.vue";
26
27
  import BaseSiteInput from "./components/BaseSiteInput/BaseSiteInput.vue";
27
28
  import BaseInputPhone from "./components/BaseInputPhone/BaseInputPhone.vue";
28
29
  import BaseInputCurrency from "./components/BaseInputCurrency/BaseInputCurrency.vue";
@@ -52,22 +53,40 @@ const components = {
52
53
  BaseSiteInput,
53
54
  BaseInputPhone,
54
55
  BaseInputCurrency,
56
+ BasePagination,
55
57
  BaseSegmentedButtons
56
58
  };
57
59
 
58
60
  // Функция для загрузки sprite.svg
59
61
  const loadSprite = () => {
60
- fetch("/sprite.svg")
61
- .then((response) => response.text())
62
- .then((svg) => {
63
- const div = document.createElement("div");
64
- div.style.display = "none";
65
- div.innerHTML = svg;
66
- document.body.appendChild(div);
67
- })
68
- .catch((error) => {
69
- console.error("Ошибка загрузки SVG-спрайта:", error);
70
- });
62
+ const possiblePaths = [
63
+ "/sprite.svg",
64
+ "./sprite.svg",
65
+ "sprite.svg",
66
+ "/dist/sprite.svg"
67
+ ];
68
+
69
+ const tryLoadSprite = async (paths: string[]) => {
70
+ for (const path of paths) {
71
+ try {
72
+ const response = await fetch(path);
73
+ if (response.ok) {
74
+ const svg = await response.text();
75
+ const div = document.createElement("div");
76
+ div.style.display = "none";
77
+ div.innerHTML = svg;
78
+ document.body.appendChild(div);
79
+ console.log(`Спрайт загружен с пути: ${path}`);
80
+ return;
81
+ }
82
+ } catch (error) {
83
+ console.warn(`Не удалось загрузить спрайт с пути: ${path}`);
84
+ }
85
+ }
86
+ console.error("Не удалось загрузить SVG-спрайт ни с одного из путей");
87
+ };
88
+
89
+ tryLoadSprite(possiblePaths);
71
90
  };
72
91
 
73
92
  export default {
@@ -81,10 +100,10 @@ export default {
81
100
  app.component(name, component);
82
101
  });
83
102
 
103
+ loadSprite();
104
+
84
105
  app.use(ModalPlugin);
85
106
  app.use(ToasterPlugin);
86
-
87
- loadSprite();
88
107
  },
89
108
  };
90
109
 
@@ -114,5 +133,6 @@ export {
114
133
  BaseSiteInput,
115
134
  BaseInputPhone,
116
135
  BaseInputCurrency,
136
+ BasePagination,
117
137
  BaseSegmentedButtons
118
138
  };
package/src/sprite.ts ADDED
@@ -0,0 +1,11 @@
1
+ // Импортируем все иконки, чтобы они попали в спрайт
2
+ const requireIcons = require.context(
3
+ "@/assets/icons",
4
+ false,
5
+ /\.svg$/
6
+ );
7
+
8
+ // Автоматически добавляем спрайт в DOM при импорте
9
+ requireIcons.keys().forEach((fileName) => {
10
+ requireIcons(fileName);
11
+ });
@@ -142,6 +142,7 @@
142
142
  --font-weight-medium: 500;
143
143
  --font-weight-regular: 400;
144
144
  --font-weight-semibold: 600;
145
+ --corner-radius-3xs: 3px;
145
146
  --corner-radius-xxs: 4px;
146
147
  --corner-radius-xs: 8px;
147
148
  --corner-radius-s: 10px;
@@ -0,0 +1,13 @@
1
+ import type { ICoreSize } from './utils';
2
+
3
+ type PaginationColor = 'primary' | 'secondary' | 'white' | 'black';
4
+ type PaginationType = 'dots' | 'dotsWithBackground' | 'dashes' | 'dashesWithBackground' | 'numbers';
5
+ export interface IPaginationProps {
6
+ type?: PaginationType;
7
+ currentPage?: number;
8
+ totalPages?: number;
9
+ maxDisplayedPages?: number;
10
+ color?: PaginationColor;
11
+ }
12
+
13
+ export type TPaginationProps = IPaginationProps & ICoreSize;
package/webpack.config.js CHANGED
@@ -60,7 +60,7 @@ module.exports = (env, argv) => {
60
60
  options: {
61
61
  extract: true,
62
62
  spriteFilename: "sprite.svg",
63
- publicPath: "/",
63
+ publicPath: isProduction ? "./" : "/",
64
64
  },
65
65
  },
66
66
  {
@@ -1,9 +0,0 @@
1
- const requireIcons = require.context(
2
- "@/assets/icons",
3
- false,
4
- /\.svg$/
5
- );
6
-
7
- requireIcons.keys().forEach((fileName) => {
8
- requireIcons(fileName);
9
- });
File without changes