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.
- package/dist/components/BaseButton/BaseButton.vue.d.ts +9 -0
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +8 -1
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +12 -2
- package/dist/components/BaseTable/BaseTable.vue.d.ts +14 -1
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sprite.svg +1 -1
- package/example/App.vue +278 -6
- package/package.json +1 -1
- package/src/assets/icons/search.svg +4 -0
- package/src/components/BaseButton/BaseButton.vue +30 -1
- package/src/components/BaseDefaultPages/BaseDefaultPages.vue +9 -1
- package/src/components/BaseSelect/BaseSelect.vue +155 -10
- package/src/components/BaseTable/BaseTable.vue +278 -26
- package/src/components/BaseTable/README.md +96 -1
- package/src/components/BaseTooltip/BaseTooltip.vue +9 -5
- package/src/components/BaseUpload/BaseUpload.vue +97 -25
- package/src/images.d.ts +24 -0
- package/src/types/button.d.ts +1 -1
- package/src/types/input.d.ts +1 -0
- package/src/types/table.d.ts +6 -0
- package/src/vue-virtual-scroller.d.ts +4 -0
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
class="base-file-upload__input"
|
|
9
9
|
:accept="acceptedFormats.join(',')"
|
|
10
10
|
/>
|
|
11
|
-
<div
|
|
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
|
-
|
|
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 {
|
package/src/images.d.ts
ADDED
|
@@ -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
|
+
}
|
package/src/types/button.d.ts
CHANGED
|
@@ -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;
|
package/src/types/input.d.ts
CHANGED
package/src/types/table.d.ts
CHANGED
|
@@ -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
|
}
|