kui-vue 3.6.8 → 3.6.10
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/components/alert/alert.jsx +1 -1
- package/components/alert/demo/basic.md +2 -2
- package/components/alert/demo/close.md +2 -2
- package/components/alert/demo/customIcon.md +2 -2
- package/components/alert/styles/index.less +0 -1
- package/components/backtop/backtop.jsx +1 -1
- package/components/button/button.jsx +1 -1
- package/components/carousel/carousel.jsx +1 -1
- package/components/checkbox/checkbox.jsx +1 -1
- package/components/checkbox/styles/index.less +3 -0
- package/components/collapse/collapsePanel.jsx +1 -1
- package/components/colorPicker/presets.jsx +1 -1
- package/components/components.js +1 -2
- package/components/datePicker/datepicker.jsx +1 -1
- package/components/drawer/drawer.jsx +1 -1
- package/components/dropdown/dropdownButton.jsx +1 -1
- package/components/empty/empty.jsx +1 -1
- package/components/form/demo/valid.md +8 -7
- package/components/image/demo/group.md +1 -1
- package/components/image/group.jsx +10 -4
- package/components/image/image.jsx +48 -100
- package/components/image/preview.jsx +132 -117
- package/components/image/styles/index.less +211 -224
- package/components/image/utils.js +31 -0
- package/components/index.js +16 -35
- package/components/input/demo/event.md +0 -1
- package/components/input/input.jsx +1 -1
- package/components/inputNumber/inputNumber.jsx +1 -1
- package/components/inputNumber/styles/index.less +2 -2
- package/components/layout/demo/layout5.md +0 -1
- package/components/loading/loading.jsx +5 -27
- package/components/message/index.js +0 -6
- package/components/message/inner.jsx +1 -1
- package/components/modal/index.js +4 -7
- package/components/modal/modal.jsx +2 -3
- package/components/modal/styles/index.less +1 -0
- package/components/modal/toast.jsx +1 -1
- package/components/notice/index.js +0 -6
- package/components/page/demo/basic.md +3 -3
- package/components/page/demo/size.md +4 -4
- package/components/page/demo/sizer-elevator.md +6 -6
- package/components/page/index.md +1 -1
- package/components/page/page.jsx +9 -9
- package/components/popconfirm/popconfirm.jsx +1 -1
- package/components/progress/progress.jsx +1 -1
- package/components/radio/styles/index.less +3 -0
- package/components/rate/star.jsx +1 -1
- package/components/select/demo/theme.md +2 -1
- package/components/select/option.jsx +1 -1
- package/components/select/select.jsx +2 -2
- package/components/slider/demo/formatter.md +8 -9
- package/components/slider/slider.jsx +3 -4
- package/components/slider/thumb.jsx +4 -3
- package/components/space/demo/compact.md +9 -9
- package/components/statCard/statNumber.jsx +2 -2
- package/components/statCard/{countup.jsx → statup/countup.jsx} +1 -1
- package/components/styles/less-var.less +1 -1
- package/components/switch/switch.jsx +1 -1
- package/components/table/table.jsx +1 -1
- package/components/tabs/styles/index.less +2 -2
- package/components/tabs/tabs.jsx +1 -1
- package/components/tag/tag.jsx +1 -1
- package/components/tree/tree.jsx +1 -1
- package/components/treeselect/treeselect.jsx +1 -1
- package/components/upload/fileList.jsx +1 -1
- package/components/upload/selector.jsx +1 -1
- package/components/utils/theme.js +0 -10
- package/components/utils/vue.js +8 -0
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +332 -331
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +13 -14
- package/types/index.d.ts +34 -34
- package/types/page/Page.d.ts +1 -1
- package/types/slider/Slider.d.ts +1 -0
- package/components/utils/i18n.js +0 -32
- /package/components/statCard/{countup.js → statup/countup.js} +0 -0
- /package/components/statCard/{rollup.jsx → statup/rollup.jsx} +0 -0
|
@@ -12,19 +12,23 @@ import Icon from "../icon";
|
|
|
12
12
|
import { getChildren } from "../utils/vnode";
|
|
13
13
|
import { withInstall } from "../utils/vue";
|
|
14
14
|
import {
|
|
15
|
-
Refresh,
|
|
16
15
|
Close,
|
|
17
16
|
ArrowDown,
|
|
18
17
|
IconImage,
|
|
19
18
|
ArrowBack,
|
|
20
19
|
ArrowForward,
|
|
21
|
-
Add,
|
|
20
|
+
Add,
|
|
21
|
+
Remove,
|
|
22
|
+
ChevronBack,
|
|
22
23
|
ChevronUp,
|
|
24
|
+
ChevronForward,
|
|
23
25
|
Loading,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "kui-icons";
|
|
26
|
+
RotateLeft,
|
|
27
|
+
RotateRight,
|
|
28
|
+
} from "kui-icons/dist/icons";
|
|
27
29
|
import Slider from "../slider";
|
|
30
|
+
import { Button } from "../button";
|
|
31
|
+
import { loadImage } from "./utils";
|
|
28
32
|
|
|
29
33
|
const ImagePreview = defineComponent({
|
|
30
34
|
name: "ImagePreview",
|
|
@@ -38,7 +42,6 @@ const ImagePreview = defineComponent({
|
|
|
38
42
|
showPanel: Boolean,
|
|
39
43
|
},
|
|
40
44
|
setup(props, { emit, slots, expose, listeners }) {
|
|
41
|
-
// console.log(props, listeners, slots);
|
|
42
45
|
const { value, type, src, origin, showPanel, data } = toRefs(props);
|
|
43
46
|
const state = reactive({
|
|
44
47
|
scale: 1,
|
|
@@ -62,7 +65,7 @@ const ImagePreview = defineComponent({
|
|
|
62
65
|
|
|
63
66
|
const imgRef = ref(null);
|
|
64
67
|
const panelRef = ref(null);
|
|
65
|
-
|
|
68
|
+
const maxScale = 10;
|
|
66
69
|
const updatePanelRight = () => {
|
|
67
70
|
state.panelRight =
|
|
68
71
|
panelRef.value && state.isShowPanel ? panelRef.value.offsetWidth : 0;
|
|
@@ -76,7 +79,9 @@ const ImagePreview = defineComponent({
|
|
|
76
79
|
|
|
77
80
|
const setScale = (zoom) => {
|
|
78
81
|
state.scale = zoom ? state.scale + 1 : state.scale - 1;
|
|
79
|
-
state.scale = zoom
|
|
82
|
+
state.scale = zoom
|
|
83
|
+
? Math.min(state.scale, maxScale)
|
|
84
|
+
: Math.max(1, state.scale);
|
|
80
85
|
resetPosition();
|
|
81
86
|
};
|
|
82
87
|
|
|
@@ -203,9 +208,7 @@ const ImagePreview = defineComponent({
|
|
|
203
208
|
newIndex = Math.max(0, newIndex);
|
|
204
209
|
newIndex = Math.min(newIndex, data.length - 1);
|
|
205
210
|
|
|
206
|
-
// if (props.global && !slots.panel) {
|
|
207
211
|
state.src = data[newIndex];
|
|
208
|
-
// }
|
|
209
212
|
|
|
210
213
|
if ((left && index == 0) || (!left && index == data.length - 1)) return;
|
|
211
214
|
emit("switch", newIndex);
|
|
@@ -262,7 +265,7 @@ const ImagePreview = defineComponent({
|
|
|
262
265
|
() => props.src,
|
|
263
266
|
(src) => {
|
|
264
267
|
state.src = src;
|
|
265
|
-
}
|
|
268
|
+
},
|
|
266
269
|
);
|
|
267
270
|
|
|
268
271
|
watch(
|
|
@@ -274,36 +277,26 @@ const ImagePreview = defineComponent({
|
|
|
274
277
|
updatePanelRight();
|
|
275
278
|
});
|
|
276
279
|
}
|
|
277
|
-
}
|
|
280
|
+
},
|
|
278
281
|
);
|
|
279
282
|
|
|
280
283
|
watch(
|
|
281
284
|
() => state.src,
|
|
282
285
|
(src) => {
|
|
283
286
|
if (state.type == "media" || !src) return;
|
|
284
|
-
let image = new Image();
|
|
285
|
-
let isCompleted = false;
|
|
286
|
-
|
|
287
|
-
const cleanup = () => {
|
|
288
|
-
if (isCompleted) return;
|
|
289
|
-
isCompleted = true;
|
|
290
|
-
image.onload = null;
|
|
291
|
-
image.onerror = null;
|
|
292
|
-
image = null;
|
|
293
|
-
};
|
|
294
287
|
state.loading = true;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
288
|
+
loadImage(
|
|
289
|
+
src,
|
|
290
|
+
({ width, height }) => {
|
|
291
|
+
state.loading = false;
|
|
292
|
+
state.error = false;
|
|
293
|
+
},
|
|
294
|
+
() => {
|
|
295
|
+
state.loading = false;
|
|
296
|
+
state.error = true;
|
|
297
|
+
},
|
|
298
|
+
);
|
|
299
|
+
},
|
|
307
300
|
);
|
|
308
301
|
|
|
309
302
|
watch(
|
|
@@ -311,7 +304,7 @@ const ImagePreview = defineComponent({
|
|
|
311
304
|
(value) => {
|
|
312
305
|
state.isShowPanel = value;
|
|
313
306
|
updatePanelRight();
|
|
314
|
-
}
|
|
307
|
+
},
|
|
315
308
|
);
|
|
316
309
|
|
|
317
310
|
onMounted(() => {
|
|
@@ -343,17 +336,13 @@ const ImagePreview = defineComponent({
|
|
|
343
336
|
state.visible = true;
|
|
344
337
|
};
|
|
345
338
|
|
|
346
|
-
const hide = () => {
|
|
347
|
-
state.visible = false;
|
|
348
|
-
};
|
|
349
|
-
|
|
350
339
|
const escToClose = (e) => {
|
|
351
340
|
if (e.keyCode === 27) {
|
|
352
|
-
|
|
341
|
+
close();
|
|
353
342
|
}
|
|
354
343
|
};
|
|
355
344
|
|
|
356
|
-
expose({ show,
|
|
345
|
+
expose({ show, close, togglePanel });
|
|
357
346
|
|
|
358
347
|
return () => {
|
|
359
348
|
const {
|
|
@@ -386,112 +375,138 @@ const ImagePreview = defineComponent({
|
|
|
386
375
|
|
|
387
376
|
return (
|
|
388
377
|
<div class="k-image-preview-root">
|
|
389
|
-
<
|
|
390
|
-
<
|
|
391
|
-
<div class="k-image-preview-mask" onClick={close}></div>
|
|
378
|
+
<div class="k-image-preview" v-show={visible}>
|
|
379
|
+
<transition name="k-image-fade">
|
|
392
380
|
<div
|
|
393
|
-
class="k-image-preview-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
381
|
+
class="k-image-preview-mask"
|
|
382
|
+
onClick={close}
|
|
383
|
+
v-show={visible}
|
|
384
|
+
></div>
|
|
385
|
+
</transition>
|
|
386
|
+
<div
|
|
387
|
+
class="k-image-preview-wrap"
|
|
388
|
+
style={{ right: panelRight + "px" }}
|
|
389
|
+
>
|
|
390
|
+
<transition name="k-image-fade">
|
|
391
|
+
<ul class="k-image-preview-control" v-show={visible}>
|
|
392
|
+
<li class="k-image-preview-action-nav">
|
|
393
|
+
<Button
|
|
394
|
+
icon={ChevronBack}
|
|
395
|
+
type="text"
|
|
396
|
+
disabled={!data.length || data.indexOf(src) == 0}
|
|
397
|
+
onClick={() => switchImage(1)}
|
|
398
|
+
/>
|
|
399
|
+
<span>
|
|
400
|
+
{data?.indexOf(src) + 1 || 1}/{data?.length || 1}
|
|
401
|
+
</span>
|
|
402
|
+
<Button
|
|
403
|
+
icon={ChevronForward}
|
|
404
|
+
type="text"
|
|
405
|
+
disabled={
|
|
406
|
+
!data.length || data.indexOf(src) == data.length - 1
|
|
407
|
+
}
|
|
408
|
+
onClick={() => switchImage()}
|
|
409
|
+
/>
|
|
399
410
|
</li>
|
|
400
|
-
<li
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
<li
|
|
412
|
+
class="k-image-preview-action k-image-preview-action-rotate-left"
|
|
413
|
+
onClick={() => setRotate(1)}
|
|
414
|
+
>
|
|
415
|
+
<Icon type={RotateLeft} />
|
|
416
|
+
</li>
|
|
417
|
+
<li
|
|
418
|
+
class="k-image-preview-action k-image-preview-action-rotate-right"
|
|
419
|
+
onClick={() => setRotate(0)}
|
|
420
|
+
>
|
|
421
|
+
<Icon type={RotateRight} />
|
|
406
422
|
</li>
|
|
407
423
|
<li
|
|
408
424
|
class={[
|
|
409
425
|
"k-image-preview-action",
|
|
410
|
-
{ "k-image-preview-action-disabled": scale
|
|
426
|
+
{ "k-image-preview-action-disabled": scale <= 1 },
|
|
411
427
|
]}
|
|
412
|
-
onClick={() => setScale(
|
|
428
|
+
onClick={() => setScale(0)}
|
|
413
429
|
>
|
|
414
|
-
<Icon type={
|
|
430
|
+
<Icon type={Remove} />
|
|
415
431
|
</li>
|
|
416
432
|
<li class="k-image-preview-action k-image-preview-action-scale">
|
|
417
433
|
<Slider
|
|
418
434
|
value={state.scale}
|
|
419
435
|
min={1}
|
|
420
|
-
max={
|
|
436
|
+
max={maxScale}
|
|
421
437
|
size="small"
|
|
438
|
+
tooltipVisible={false}
|
|
422
439
|
onChange={(val) => (state.scale = val)}
|
|
423
440
|
/>
|
|
424
441
|
</li>
|
|
425
442
|
<li
|
|
426
443
|
class={[
|
|
427
444
|
"k-image-preview-action",
|
|
428
|
-
{ "k-image-preview-action-disabled": scale
|
|
445
|
+
{ "k-image-preview-action-disabled": scale >= 5 },
|
|
429
446
|
]}
|
|
430
|
-
onClick={() => setScale(
|
|
447
|
+
onClick={() => setScale(1)}
|
|
431
448
|
>
|
|
432
|
-
<Icon type={
|
|
449
|
+
<Icon type={Add} />
|
|
433
450
|
</li>
|
|
434
|
-
<li
|
|
435
|
-
|
|
436
|
-
onClick={() => setRotate(0)}
|
|
437
|
-
>
|
|
438
|
-
<Icon type={Refresh} />
|
|
451
|
+
<li class="k-image-preview-action" onClick={download}>
|
|
452
|
+
<Icon type={ArrowDown} />
|
|
439
453
|
</li>
|
|
440
|
-
|
|
441
|
-
class="k-image-preview-action
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
454
|
+
{tools.map((tool) => {
|
|
455
|
+
return <li class="k-image-preview-action">{tool}</li>;
|
|
456
|
+
})}
|
|
457
|
+
<li class="k-image-preview-action-divider" />
|
|
458
|
+
<li class="k-image-preview-action" onClick={close}>
|
|
459
|
+
<Icon type={Close} />
|
|
445
460
|
</li>
|
|
446
461
|
</ul>
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
)}
|
|
457
|
-
</div>
|
|
458
|
-
{props.data.length > 1
|
|
459
|
-
? [
|
|
460
|
-
<div
|
|
461
|
-
class={[
|
|
462
|
-
"k-image-preview-switch-left",
|
|
463
|
-
{
|
|
464
|
-
"k-image-preview-switch-disabled":
|
|
465
|
-
data.indexOf(src) == 0,
|
|
466
|
-
},
|
|
467
|
-
]}
|
|
468
|
-
onClick={() => switchImage(1)}
|
|
469
|
-
>
|
|
470
|
-
<Icon type={ArrowBack} />
|
|
471
|
-
</div>,
|
|
472
|
-
<div
|
|
473
|
-
class={[
|
|
474
|
-
"k-image-preview-switch-right",
|
|
475
|
-
{
|
|
476
|
-
"k-image-preview-switch-disabled":
|
|
477
|
-
data.indexOf(src) == data.length - 1,
|
|
478
|
-
},
|
|
479
|
-
]}
|
|
480
|
-
onClick={() => switchImage()}
|
|
481
|
-
>
|
|
482
|
-
<Icon type={ArrowForward} />
|
|
483
|
-
</div>,
|
|
484
|
-
]
|
|
485
|
-
: null}
|
|
486
|
-
{loading ? (
|
|
487
|
-
<div class="k-image-preview-loading">
|
|
488
|
-
<Icon type={Loading} spin />
|
|
462
|
+
</transition>
|
|
463
|
+
<div class="k-image-preview-img-wrap" style={moveStyle}>
|
|
464
|
+
{type == "media" ? (
|
|
465
|
+
<video controls {...imgProps} v-show={visible} />
|
|
466
|
+
) : !state.error && !state.loading ? (
|
|
467
|
+
<img {...imgProps} v-show={visible} />
|
|
468
|
+
) : !loading ? (
|
|
469
|
+
<div class="k-image-preview-img-error">
|
|
470
|
+
<Icon type={IconImage} />
|
|
489
471
|
</div>
|
|
490
472
|
) : null}
|
|
491
473
|
</div>
|
|
492
|
-
{
|
|
474
|
+
{props.data.length > 1
|
|
475
|
+
? [
|
|
476
|
+
<div
|
|
477
|
+
class={[
|
|
478
|
+
"k-image-preview-switch-left",
|
|
479
|
+
{
|
|
480
|
+
"k-image-preview-switch-disabled":
|
|
481
|
+
data.indexOf(src) == 0,
|
|
482
|
+
},
|
|
483
|
+
]}
|
|
484
|
+
onClick={() => switchImage(1)}
|
|
485
|
+
>
|
|
486
|
+
<Icon type={ArrowBack} />
|
|
487
|
+
</div>,
|
|
488
|
+
<div
|
|
489
|
+
class={[
|
|
490
|
+
"k-image-preview-switch-right",
|
|
491
|
+
{
|
|
492
|
+
"k-image-preview-switch-disabled":
|
|
493
|
+
data.indexOf(src) == data.length - 1,
|
|
494
|
+
},
|
|
495
|
+
]}
|
|
496
|
+
onClick={() => switchImage()}
|
|
497
|
+
>
|
|
498
|
+
<Icon type={ArrowForward} />
|
|
499
|
+
</div>,
|
|
500
|
+
]
|
|
501
|
+
: null}
|
|
502
|
+
{loading ? (
|
|
503
|
+
<div class="k-image-preview-loading">
|
|
504
|
+
<Icon type={Loading} spin />
|
|
505
|
+
</div>
|
|
506
|
+
) : null}
|
|
493
507
|
</div>
|
|
494
|
-
|
|
508
|
+
{getPanel()}
|
|
509
|
+
</div>
|
|
495
510
|
</div>
|
|
496
511
|
);
|
|
497
512
|
};
|