plugin-ui-for-kzt 0.0.27 → 0.0.29

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.
@@ -8,7 +8,14 @@
8
8
  class="base-file-upload__input"
9
9
  :accept="acceptedFormats.join(',')"
10
10
  />
11
- <div class="base-file-upload__wrapper" @click="triggerFileInput">
11
+ <div
12
+ class="base-file-upload__wrapper"
13
+ :class="{ '--is-drag-over': isDragOver }"
14
+ @click="triggerFileInput"
15
+ @dragover="handleDragOver"
16
+ @dragleave="handleDragLeave"
17
+ @drop="handleDrop"
18
+ >
12
19
  <base-icon
13
20
  name="upload"
14
21
  class="base-file-upload__icon-upload"
@@ -52,7 +59,11 @@
52
59
  <div
53
60
  v-if="mediaFiles.length > 0"
54
61
  class="base-file-upload__media-item base-file-upload__media-placeholder"
62
+ :class="{ '--is-drag-over': isDragOver }"
55
63
  @click="triggerFileInput"
64
+ @dragover="handleDragOver"
65
+ @dragleave="handleDragLeave"
66
+ @drop="handleDrop"
56
67
  >
57
68
  <base-icon name="gallery" size="medium" class="base-file-upload__placeholder-icon" />
58
69
  <p class="base-file-upload__placeholder-text"><span>Загрузить</span> <br /> фото</p>
@@ -125,9 +136,10 @@ const fileInput = ref<HTMLInputElement | null>(null);
125
136
  const uploadedFiles = ref<UploadedFile[]>([]);
126
137
  const isUploading = ref(false);
127
138
  const errorMessage = ref<string | null>(null);
139
+ const isDragOver = ref(false);
128
140
  const modal = useModal();
129
141
 
130
- const mediaExtensions = ['.jpg', '.jpeg', '.png'];
142
+ const mediaExtensions = ['.jpg', '.jpeg', '.png', '.svg'];
131
143
  const mediaFiles = computed(() =>
132
144
  uploadedFiles.value.filter((file) =>
133
145
  mediaExtensions.includes(`.${file.name.split('.').pop()?.toLowerCase() || ''}`)
@@ -143,6 +155,62 @@ const triggerFileInput = () => {
143
155
  fileInput.value?.click();
144
156
  };
145
157
 
158
+ // Обработчики drag & drop
159
+ const handleDragOver = (event: DragEvent) => {
160
+ event.preventDefault();
161
+ event.stopPropagation();
162
+ isDragOver.value = true;
163
+ };
164
+
165
+ const handleDragLeave = (event: DragEvent) => {
166
+ event.preventDefault();
167
+ event.stopPropagation();
168
+ isDragOver.value = false;
169
+ };
170
+
171
+ const handleDrop = (event: DragEvent) => {
172
+ event.preventDefault();
173
+ event.stopPropagation();
174
+ isDragOver.value = false;
175
+
176
+ const files = event.dataTransfer?.files;
177
+ if (files && files.length > 0) {
178
+ processFiles(Array.from(files));
179
+ }
180
+ };
181
+
182
+ const processFiles = (files: File[]) => {
183
+ isUploading.value = true;
184
+ errorMessage.value = null;
185
+
186
+ const filesToProcess = props.multiple ? files : files.slice(0, 1);
187
+
188
+ if (!props.multiple && uploadedFiles.value.length > 0) {
189
+ uploadedFiles.value = [];
190
+ }
191
+
192
+ filesToProcess.forEach((file) => {
193
+ const fileExtension = `.${file.name.split('.').pop()?.toLowerCase() || ''}`;
194
+ if (!props.acceptedFormats.includes(fileExtension)) {
195
+ errorMessage.value = `Недопустимый формат файла: ${file.name}. Допустимый: ${props.acceptedFormats.join(', ')}.`;
196
+ return;
197
+ }
198
+
199
+ if (file.size > props.maxFileSize) {
200
+ errorMessage.value = `Файл ${file.name} превышает максимальный размер ${formatFileSize(props.maxFileSize)}.`;
201
+ return;
202
+ }
203
+
204
+ if (props.enableCrop && isImageFile(file)) {
205
+ openCropModal(file);
206
+ } else {
207
+ uploadedFiles.value.push({ name: file.name, size: file.size, file });
208
+ }
209
+ });
210
+
211
+ isUploading.value = false;
212
+ };
213
+
146
214
  const isImageFile = (file: File) => {
147
215
  const fileExtension = `.${file.name.split('.').pop()?.toLowerCase() || ''}`;
148
216
  return mediaExtensions.includes(fileExtension);
@@ -153,29 +221,7 @@ const handleFileUpload = (event: Event) => {
153
221
  const files = target.files;
154
222
 
155
223
  if (files) {
156
- isUploading.value = true;
157
- errorMessage.value = null;
158
-
159
- Array.from(files).forEach((file) => {
160
- const fileExtension = `.${file.name.split('.').pop()?.toLowerCase() || ''}`;
161
- if (!props.acceptedFormats.includes(fileExtension)) {
162
- errorMessage.value = `Недопустимый формат файла: ${file.name}. Допустимый: ${props.acceptedFormats.join(', ')}.`;
163
- return;
164
- }
165
-
166
- if (file.size > props.maxFileSize) {
167
- errorMessage.value = `Файл ${file.name} превышает максимальный размер ${formatFileSize(props.maxFileSize)}.`;
168
- return;
169
- }
170
-
171
- if (props.enableCrop && isImageFile(file)) {
172
- openCropModal(file);
173
- } else {
174
- uploadedFiles.value.push({ name: file.name, size: file.size, file });
175
- }
176
- });
177
-
178
- isUploading.value = false;
224
+ processFiles(Array.from(files));
179
225
  target.value = '';
180
226
  }
181
227
  };
@@ -271,6 +317,19 @@ gap: var(--spacing-l);
271
317
  cursor: pointer;
272
318
  background: var(--primary-black-200);
273
319
  }
320
+
321
+ &.--is-drag-over {
322
+ border: 1px dashed var(--primary-blue-500);
323
+ background: var(--primary-blue-100);
324
+
325
+ .base-file-upload__title {
326
+ color: var(--primary-blue);
327
+ }
328
+
329
+ .base-file-upload__icon-upload {
330
+ color: var(--primary-blue);
331
+ }
332
+ }
274
333
  }
275
334
 
276
335
  &__title {
@@ -410,6 +469,19 @@ gap: var(--spacing-l);
410
469
  background: var(--primary-black-200);
411
470
  border-color: var(--primary-blue-500);
412
471
  }
472
+
473
+ &.--is-drag-over {
474
+ border: 1px dashed var(--primary-blue-500);
475
+ background: var(--primary-blue-100);
476
+
477
+ .base-file-upload__placeholder-text span {
478
+ color: var(--primary-blue-deep);
479
+ }
480
+
481
+ .base-file-upload__placeholder-icon {
482
+ color: var(--primary-blue);
483
+ }
484
+ }
413
485
  }
414
486
 
415
487
  &__placeholder-text {
@@ -0,0 +1,24 @@
1
+ declare module '*.png' {
2
+ const value: string;
3
+ export default value;
4
+ }
5
+
6
+ declare module '*.jpg' {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module '*.jpeg' {
12
+ const value: string;
13
+ export default value;
14
+ }
15
+
16
+ declare module '*.gif' {
17
+ const value: string;
18
+ export default value;
19
+ }
20
+
21
+ declare module '*.webp' {
22
+ const value: string;
23
+ export default value;
24
+ }
@@ -1,6 +1,6 @@
1
1
  import type { ICoreColor, ICoreInteractive, ICoreSize, ICoreState, ICoreStyle } from './utils';
2
2
 
3
- export type ICoreButtonProps = ICoreSize & ICoreColor & ICoreInteractive & ICoreState & ICoreStyle;
3
+ export type ICoreButtonProps = ICoreSize & ICoreColor & ICoreInteractive & ICoreState & ICoreStyle & { onlyIcon?: boolean };
4
4
 
5
5
  interface IOptionButtonSegment {
6
6
  label: string;
@@ -63,6 +63,7 @@ export interface ICoreSelectBaseProps {
63
63
  transitionName?: string
64
64
  label?: string
65
65
  hint?: string
66
+ searchable?: boolean
66
67
  }
67
68
 
68
69
  export interface ISelectSlotProps {
@@ -9,6 +9,9 @@ export interface Column {
9
9
  sortable?: boolean
10
10
  icons?: Component[]
11
11
  dropdownVisible?: boolean
12
+ tooltip?: string
13
+ width?: string | number
14
+ align?: 'left' | 'center' | 'right'
12
15
  }
13
16
 
14
17
  export interface Action {
@@ -30,4 +33,7 @@ export interface BaseTableProps {
30
33
  subTable?: {
31
34
  slotName: string
32
35
  }
36
+ virtualScroll?: boolean
37
+ virtualScrollThreshold?: number
38
+ virtualScrollHeight?: number
33
39
  }
@@ -6,4 +6,8 @@ declare module 'vue-virtual-scroller' {
6
6
 
7
7
  export const DynamicScrollerItem: DefineComponent;
8
8
 
9
+ export const RecycleScroller: DefineComponent;
10
+
11
+ export const RecycleScrollerItem: DefineComponent;
12
+
9
13
  }