@veltra/desktop 1.8.5 → 1.9.0
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/alert/alert.js +69 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/style.d.ts +1 -0
- package/dist/components/alert/style.js +1 -0
- package/dist/components/alert/style2.css +76 -0
- package/dist/components/anchor/anchor-item.js +35 -0
- package/dist/components/anchor/anchor-item.js.map +1 -0
- package/dist/components/anchor/anchor.js +61 -0
- package/dist/components/anchor/anchor.js.map +1 -0
- package/dist/components/anchor/di.js +6 -0
- package/dist/components/anchor/di.js.map +1 -0
- package/dist/components/anchor/style.d.ts +1 -0
- package/dist/components/anchor/style.js +1 -0
- package/dist/components/anchor/style2.css +45 -0
- package/dist/components/anchor/use-anchor.js +81 -0
- package/dist/components/anchor/use-anchor.js.map +1 -0
- package/dist/components/avatar/avatar-group.js +28 -0
- package/dist/components/avatar/avatar-group.js.map +1 -0
- package/dist/components/avatar/avatar.js +51 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/style.d.ts +1 -0
- package/dist/components/avatar/style.js +1 -0
- package/dist/components/avatar/style2.css +87 -0
- package/dist/components/back-top/back-top.js +82 -0
- package/dist/components/back-top/back-top.js.map +1 -0
- package/dist/components/back-top/style.d.ts +1 -0
- package/dist/components/back-top/style.js +2 -0
- package/dist/components/back-top/style2.css +32 -0
- package/dist/components/carousel/carousel-item.js +27 -0
- package/dist/components/carousel/carousel-item.js.map +1 -0
- package/dist/components/carousel/carousel.js +118 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/carousel/di.js +7 -0
- package/dist/components/carousel/di.js.map +1 -0
- package/dist/components/carousel/style.d.ts +1 -0
- package/dist/components/carousel/style.js +1 -0
- package/dist/components/carousel/style2.css +97 -0
- package/dist/components/carousel/use-carousel.js +68 -0
- package/dist/components/carousel/use-carousel.js.map +1 -0
- package/dist/components/descriptions/descriptions-item.js +16 -0
- package/dist/components/descriptions/descriptions-item.js.map +1 -0
- package/dist/components/descriptions/descriptions.js +67 -0
- package/dist/components/descriptions/descriptions.js.map +1 -0
- package/dist/components/descriptions/style.d.ts +1 -0
- package/dist/components/descriptions/style.js +1 -0
- package/dist/components/descriptions/style2.css +81 -0
- package/dist/components/divider/divider.js +41 -0
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/divider/style.d.ts +1 -0
- package/dist/components/divider/style.js +1 -0
- package/dist/components/divider/style2.css +68 -0
- package/dist/components/expression-editor/components/variable-picker.js +1 -1
- package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +1 -1
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/components/index.d.ts +48 -30
- package/dist/components/index.js +95 -59
- package/dist/components/index.js.map +1 -1
- package/dist/components/rate/rate.js +130 -0
- package/dist/components/rate/rate.js.map +1 -0
- package/dist/components/rate/style.d.ts +1 -0
- package/dist/components/rate/style.js +1 -0
- package/dist/components/rate/style2.css +58 -0
- package/dist/components/skeleton/skeleton.js +74 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/skeleton/style.d.ts +1 -0
- package/dist/components/skeleton/style.js +1 -0
- package/dist/components/skeleton/style2.css +86 -0
- package/dist/components/space/space.js +47 -0
- package/dist/components/space/space.js.map +1 -0
- package/dist/components/space/style.d.ts +1 -0
- package/dist/components/space/style.js +1 -0
- package/dist/components/space/style2.css +43 -0
- package/dist/components/time-picker/style.d.ts +2 -0
- package/dist/components/time-picker/style.js +3 -0
- package/dist/components/time-picker/style2.css +110 -0
- package/dist/components/time-picker/time-picker.js +196 -0
- package/dist/components/time-picker/time-picker.js.map +1 -0
- package/dist/components/timeline/style.d.ts +1 -0
- package/dist/components/timeline/style.js +1 -0
- package/dist/components/timeline/style2.css +95 -0
- package/dist/components/timeline/timeline-item.js +32 -0
- package/dist/components/timeline/timeline-item.js.map +1 -0
- package/dist/components/timeline/timeline.js +17 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/transfer/style.d.ts +2 -0
- package/dist/components/transfer/style.js +4 -0
- package/dist/components/transfer/style2.css +172 -0
- package/dist/components/transfer/transfer-list.js +101 -0
- package/dist/components/transfer/transfer-list.js.map +1 -0
- package/dist/components/transfer/transfer.js +138 -0
- package/dist/components/transfer/transfer.js.map +1 -0
- package/dist/index.d.ts +119 -88
- package/dist/index.js +106 -88
- package/dist/types/alert.d.ts +27 -0
- package/dist/types/anchor.d.ts +48 -0
- package/dist/types/avatar.d.ts +28 -0
- package/dist/types/back-top.d.ts +19 -0
- package/dist/types/carousel.d.ts +25 -0
- package/dist/types/descriptions.d.ts +22 -0
- package/dist/types/divider.d.ts +14 -0
- package/dist/types/index.d.ts +14 -1
- package/dist/types/layout.d.ts +2 -1
- package/dist/types/rate.d.ts +26 -0
- package/dist/types/skeleton.d.ts +24 -0
- package/dist/types/space.d.ts +20 -0
- package/dist/types/time-picker.d.ts +38 -0
- package/dist/types/timeline.d.ts +16 -0
- package/dist/types/transfer.d.ts +37 -0
- package/package.json +2 -1
- package/src/components/alert/alert.vue +62 -0
- package/src/components/alert/index.ts +1 -0
- package/src/components/alert/style.scss +67 -0
- package/src/components/alert/style.ts +1 -0
- package/src/components/anchor/anchor-item.vue +35 -0
- package/src/components/anchor/anchor.vue +63 -0
- package/src/components/anchor/di.ts +15 -0
- package/src/components/anchor/index.ts +2 -0
- package/src/components/anchor/style.scss +44 -0
- package/src/components/anchor/style.ts +1 -0
- package/src/components/anchor/use-anchor.ts +120 -0
- package/src/components/avatar/avatar-group.vue +26 -0
- package/src/components/avatar/avatar.vue +52 -0
- package/src/components/avatar/index.ts +2 -0
- package/src/components/avatar/style.scss +79 -0
- package/src/components/avatar/style.ts +1 -0
- package/src/components/back-top/back-top.vue +89 -0
- package/src/components/back-top/index.ts +1 -0
- package/src/components/back-top/style.scss +31 -0
- package/src/components/back-top/style.ts +2 -0
- package/src/components/carousel/carousel-item.vue +27 -0
- package/src/components/carousel/carousel.vue +93 -0
- package/src/components/carousel/di.ts +15 -0
- package/src/components/carousel/index.ts +2 -0
- package/src/components/carousel/style.scss +109 -0
- package/src/components/carousel/style.ts +1 -0
- package/src/components/carousel/use-carousel.ts +77 -0
- package/src/components/descriptions/descriptions-item.vue +12 -0
- package/src/components/descriptions/descriptions.vue +81 -0
- package/src/components/descriptions/index.ts +2 -0
- package/src/components/descriptions/style.scss +73 -0
- package/src/components/descriptions/style.ts +1 -0
- package/src/components/divider/divider.vue +29 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/divider/style.scss +90 -0
- package/src/components/divider/style.ts +1 -0
- package/src/components/expression-editor/components/variable-picker.vue +1 -1
- package/src/components/image-cropper/image-cropper.vue +1 -1
- package/src/components/index.ts +26 -0
- package/src/components/rate/index.ts +1 -0
- package/src/components/rate/rate.vue +127 -0
- package/src/components/rate/style.scss +51 -0
- package/src/components/rate/style.ts +1 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.vue +37 -0
- package/src/components/skeleton/style.scss +94 -0
- package/src/components/skeleton/style.ts +1 -0
- package/src/components/space/index.ts +1 -0
- package/src/components/space/space.vue +45 -0
- package/src/components/space/style.scss +41 -0
- package/src/components/space/style.ts +1 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/time-picker/style.scss +82 -0
- package/src/components/time-picker/style.ts +3 -0
- package/src/components/time-picker/time-picker.vue +183 -0
- package/src/components/timeline/index.ts +2 -0
- package/src/components/timeline/style.scss +107 -0
- package/src/components/timeline/style.ts +1 -0
- package/src/components/timeline/timeline-item.vue +43 -0
- package/src/components/timeline/timeline.vue +17 -0
- package/src/components/transfer/index.ts +1 -0
- package/src/components/transfer/style.scss +135 -0
- package/src/components/transfer/style.ts +4 -0
- package/src/components/transfer/transfer-list.vue +120 -0
- package/src/components/transfer/transfer.vue +134 -0
- package/src/types/alert.ts +29 -0
- package/src/types/anchor.ts +50 -0
- package/src/types/avatar.ts +31 -0
- package/src/types/back-top.ts +20 -0
- package/src/types/carousel.ts +29 -0
- package/src/types/descriptions.ts +22 -0
- package/src/types/divider.ts +14 -0
- package/src/types/index.ts +16 -0
- package/src/types/layout.ts +2 -1
- package/src/types/rate.ts +27 -0
- package/src/types/skeleton.ts +29 -0
- package/src/types/space.ts +22 -0
- package/src/types/time-picker.ts +40 -0
- package/src/types/timeline.ts +15 -0
- package/src/types/transfer.ts +45 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot } from "vue";
|
|
2
|
+
import { bem } from "@veltra/utils";
|
|
3
|
+
//#region src/components/space/space.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
name: "USpace",
|
|
6
|
+
__name: "space",
|
|
7
|
+
props: {
|
|
8
|
+
size: { default: "default" },
|
|
9
|
+
direction: { default: "horizontal" },
|
|
10
|
+
align: { default: "center" },
|
|
11
|
+
wrap: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const cls = bem("space");
|
|
18
|
+
const className = computed(() => [
|
|
19
|
+
cls.b,
|
|
20
|
+
cls.m(__props.direction),
|
|
21
|
+
typeof __props.size === "string" && cls.m(__props.size),
|
|
22
|
+
cls.m("align-" + __props.align),
|
|
23
|
+
bem.is("wrap", __props.wrap)
|
|
24
|
+
]);
|
|
25
|
+
/** 间距档走 token class;数字与二元组写内联 gap */
|
|
26
|
+
const style = computed(() => {
|
|
27
|
+
if (typeof __props.size === "number") return { gap: `${__props.size}px` };
|
|
28
|
+
if (Array.isArray(__props.size)) {
|
|
29
|
+
const [horizontal, vertical] = __props.size;
|
|
30
|
+
return {
|
|
31
|
+
columnGap: `${horizontal}px`,
|
|
32
|
+
rowGap: `${vertical}px`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
return openBlock(), createElementBlock("div", {
|
|
38
|
+
class: normalizeClass(className.value),
|
|
39
|
+
style: normalizeStyle(style.value)
|
|
40
|
+
}, [renderSlot(_ctx.$slots, "default")], 6);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
export { _sfc_main as default };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","names":["_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_renderSlot"],"sources":["../../../src/components/space/space.vue"],"sourcesContent":["<template>\n <div :class=\"className\" :style=\"style\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed } from 'vue'\n\nimport type { SpaceProps } from '../../types'\n\ndefineOptions({ name: 'USpace' })\n\nconst {\n size = 'default',\n direction = 'horizontal',\n align = 'center',\n wrap = false\n} = defineProps<SpaceProps>()\n\nconst cls = bem('space')\n\nconst className = computed(() => [\n cls.b,\n cls.m(direction),\n typeof size === 'string' && cls.m(size),\n cls.m('align-' + align),\n bem.is('wrap', wrap)\n])\n\n/** 间距档走 token class;数字与二元组写内联 gap */\nconst style = computed(() => {\n if (typeof size === 'number') {\n return { gap: `${size}px` }\n }\n\n if (Array.isArray(size)) {\n const [horizontal, vertical] = size\n return { columnGap: `${horizontal}px`, rowGap: `${vertical}px` }\n }\n\n return undefined\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EAqBA,MAAM,MAAM,IAAI,OAAO;EAEvB,MAAM,YAAY,eAAe;GAC/B,IAAI;GACJ,IAAI,EAAE,QAAA,SAAS;GACf,OAAO,QAAA,SAAS,YAAY,IAAI,EAAE,QAAA,IAAI;GACtC,IAAI,EAAE,WAAW,QAAA,KAAK;GACtB,IAAI,GAAG,QAAQ,QAAA,IAAI;EACrB,CAAC;;EAGD,MAAM,QAAQ,eAAe;GAC3B,IAAI,OAAO,QAAA,SAAS,UAClB,OAAO,EAAE,KAAK,GAAG,QAAA,KAAK,IAAI;GAG5B,IAAI,MAAM,QAAQ,QAAA,IAAI,GAAG;IACvB,MAAM,CAAC,YAAY,YAAY,QAAA;IAC/B,OAAO;KAAE,WAAW,GAAG,WAAW;KAAK,QAAQ,GAAG,SAAS;IAAI;GACjE;EAGF,CAAC;;GA1CC,OAAAA,UAAA,GAAAC,mBAEM,OAAA;IAFA,OAAKC,eAAE,UAAA,KAAS;IAAG,OAAKC,eAAE,MAAA,KAAK;GACnC,GAAA,CAAAC,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./style2.css";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/** flex布局 */
|
|
3
|
+
/**
|
|
4
|
+
* 设置css变量
|
|
5
|
+
* 参数1:变量前缀
|
|
6
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
7
|
+
* css-var(height, (
|
|
8
|
+
* large: 40px
|
|
9
|
+
* default: 32px
|
|
10
|
+
* small: 24px
|
|
11
|
+
* ))
|
|
12
|
+
* 生成的css变量:
|
|
13
|
+
* --u-height-large: 40px;
|
|
14
|
+
* --u-height-default: 32px;
|
|
15
|
+
* --u-height-small: 24px;
|
|
16
|
+
*/
|
|
17
|
+
/** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
|
|
18
|
+
.u-space {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
gap: var(--u-gap-default);
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
.u-space--vertical {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
.u-space.is-wrap {
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
}
|
|
29
|
+
.u-space--small {
|
|
30
|
+
gap: var(--u-gap-small);
|
|
31
|
+
}
|
|
32
|
+
.u-space--large {
|
|
33
|
+
gap: var(--u-gap-large);
|
|
34
|
+
}
|
|
35
|
+
.u-space--align-start {
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
.u-space--align-end {
|
|
39
|
+
align-items: flex-end;
|
|
40
|
+
}
|
|
41
|
+
.u-space--align-baseline {
|
|
42
|
+
align-items: baseline;
|
|
43
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/** flex布局 */
|
|
3
|
+
/**
|
|
4
|
+
* 设置css变量
|
|
5
|
+
* 参数1:变量前缀
|
|
6
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
7
|
+
* css-var(height, (
|
|
8
|
+
* large: 40px
|
|
9
|
+
* default: 32px
|
|
10
|
+
* small: 24px
|
|
11
|
+
* ))
|
|
12
|
+
* 生成的css变量:
|
|
13
|
+
* --u-height-large: 40px;
|
|
14
|
+
* --u-height-default: 32px;
|
|
15
|
+
* --u-height-small: 24px;
|
|
16
|
+
*/
|
|
17
|
+
/** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
|
|
18
|
+
.u-time-picker {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
.u-time-picker--small .u-time-picker__icon {
|
|
22
|
+
font-size: calc(var(--u-form-component-height-small) / 2 + 2px);
|
|
23
|
+
}
|
|
24
|
+
.u-time-picker--default .u-time-picker__icon {
|
|
25
|
+
font-size: calc(var(--u-form-component-height-default) / 2 + 2px);
|
|
26
|
+
}
|
|
27
|
+
.u-time-picker--large .u-time-picker__icon {
|
|
28
|
+
font-size: calc(var(--u-form-component-height-large) / 2 + 2px);
|
|
29
|
+
}
|
|
30
|
+
.u-time-picker__panel {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
flex-wrap: nowrap;
|
|
35
|
+
gap: var(--u-gap-default);
|
|
36
|
+
padding: var(--u-gap-default);
|
|
37
|
+
}
|
|
38
|
+
.u-time-picker__panel--small {
|
|
39
|
+
font-size: var(--u-font-size-main-small);
|
|
40
|
+
}
|
|
41
|
+
.u-time-picker__panel--small .u-time-picker__column {
|
|
42
|
+
height: calc(var(--u-form-component-height-small) * 7);
|
|
43
|
+
}
|
|
44
|
+
.u-time-picker__panel--small .u-time-picker__item {
|
|
45
|
+
height: var(--u-form-component-height-small);
|
|
46
|
+
line-height: var(--u-form-component-height-small);
|
|
47
|
+
}
|
|
48
|
+
.u-time-picker__panel--small .u-time-picker__spacer {
|
|
49
|
+
height: calc(var(--u-form-component-height-small) * 3);
|
|
50
|
+
}
|
|
51
|
+
.u-time-picker__panel--default {
|
|
52
|
+
font-size: var(--u-font-size-main-default);
|
|
53
|
+
}
|
|
54
|
+
.u-time-picker__panel--default .u-time-picker__column {
|
|
55
|
+
height: calc(var(--u-form-component-height-default) * 7);
|
|
56
|
+
}
|
|
57
|
+
.u-time-picker__panel--default .u-time-picker__item {
|
|
58
|
+
height: var(--u-form-component-height-default);
|
|
59
|
+
line-height: var(--u-form-component-height-default);
|
|
60
|
+
}
|
|
61
|
+
.u-time-picker__panel--default .u-time-picker__spacer {
|
|
62
|
+
height: calc(var(--u-form-component-height-default) * 3);
|
|
63
|
+
}
|
|
64
|
+
.u-time-picker__panel--large {
|
|
65
|
+
font-size: var(--u-font-size-main-large);
|
|
66
|
+
}
|
|
67
|
+
.u-time-picker__panel--large .u-time-picker__column {
|
|
68
|
+
height: calc(var(--u-form-component-height-large) * 7);
|
|
69
|
+
}
|
|
70
|
+
.u-time-picker__panel--large .u-time-picker__item {
|
|
71
|
+
height: var(--u-form-component-height-large);
|
|
72
|
+
line-height: var(--u-form-component-height-large);
|
|
73
|
+
}
|
|
74
|
+
.u-time-picker__panel--large .u-time-picker__spacer {
|
|
75
|
+
height: calc(var(--u-form-component-height-large) * 3);
|
|
76
|
+
}
|
|
77
|
+
.u-time-picker__column {
|
|
78
|
+
position: relative;
|
|
79
|
+
width: 56px;
|
|
80
|
+
flex: none;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
scrollbar-width: none;
|
|
83
|
+
}
|
|
84
|
+
.u-time-picker__column::-webkit-scrollbar {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
.u-time-picker__item {
|
|
88
|
+
margin: 0 4px;
|
|
89
|
+
text-align: center;
|
|
90
|
+
border-radius: 99px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
user-select: none;
|
|
93
|
+
color: var(--u-text-color-main);
|
|
94
|
+
transition: background-color var(--u-transition-fast) var(--u-transition-ease);
|
|
95
|
+
}
|
|
96
|
+
.u-time-picker__item:hover {
|
|
97
|
+
background-color: var(--u-bg-color-hover);
|
|
98
|
+
}
|
|
99
|
+
.u-time-picker__item.is-selected {
|
|
100
|
+
background-color: var(--u-color-primary);
|
|
101
|
+
color: var(--u-text-color-white);
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
}
|
|
104
|
+
.u-time-picker__item.is-disabled {
|
|
105
|
+
cursor: not-allowed;
|
|
106
|
+
color: var(--u-text-color-disabled);
|
|
107
|
+
}
|
|
108
|
+
.u-time-picker__item.is-disabled:hover {
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon/icon.js";
|
|
2
|
+
import _sfc_main$2 from "../dropdown/dropdown.js";
|
|
3
|
+
import input_default from "../input/input.js";
|
|
4
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, openBlock, renderList, shallowRef, toDisplayString, unref, watch, withCtx } from "vue";
|
|
5
|
+
import { useFormFallbackProps, useUserAction } from "@veltra/compositions";
|
|
6
|
+
import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
|
|
7
|
+
import { Time } from "@veltra/icons/normal";
|
|
8
|
+
import { Dater, date } from "@cat-kit/core";
|
|
9
|
+
//#region src/components/time-picker/time-picker.vue
|
|
10
|
+
const _hoisted_1 = ["onClick"];
|
|
11
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
|
+
name: "UTimePicker",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
__name: "time-picker",
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: {},
|
|
17
|
+
placeholder: {},
|
|
18
|
+
format: {},
|
|
19
|
+
valueFormat: {},
|
|
20
|
+
dataType: {},
|
|
21
|
+
disabledHours: { type: Function },
|
|
22
|
+
disabledMinutes: { type: Function },
|
|
23
|
+
disabledSeconds: { type: Function },
|
|
24
|
+
clearable: { type: Boolean },
|
|
25
|
+
tips: {},
|
|
26
|
+
span: {},
|
|
27
|
+
label: {},
|
|
28
|
+
field: {},
|
|
29
|
+
disabled: { type: Boolean },
|
|
30
|
+
readonly: { type: Boolean },
|
|
31
|
+
rules: {},
|
|
32
|
+
size: {}
|
|
33
|
+
},
|
|
34
|
+
emits: ["update:modelValue", "change"],
|
|
35
|
+
setup(__props, { emit: __emit }) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const cls = bem("time-picker");
|
|
39
|
+
const { formProps } = injectFormContext();
|
|
40
|
+
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
41
|
+
size: "default",
|
|
42
|
+
disabled: false,
|
|
43
|
+
readonly: false
|
|
44
|
+
});
|
|
45
|
+
const className = computed(() => [cls.b, cls.m(size.value)]);
|
|
46
|
+
const placeholder = computed(() => props.placeholder ?? "选择时间");
|
|
47
|
+
const clearable = computed(() => props.clearable ?? true);
|
|
48
|
+
const formatStr = computed(() => props.format ?? "HH:mm:ss");
|
|
49
|
+
const currentTime = shallowRef();
|
|
50
|
+
const { userAction, isUserActive } = useUserAction();
|
|
51
|
+
function parseModelValue(val) {
|
|
52
|
+
if (val == null || val === "") return void 0;
|
|
53
|
+
if (val instanceof Date || typeof val === "number") {
|
|
54
|
+
const d = date(val);
|
|
55
|
+
return isNaN(d.timestamp) ? void 0 : d;
|
|
56
|
+
}
|
|
57
|
+
const parsed = Dater.parse(val, props.valueFormat ?? formatStr.value);
|
|
58
|
+
if (!isNaN(parsed.timestamp)) return parsed;
|
|
59
|
+
const fallback = date(val);
|
|
60
|
+
return isNaN(fallback.timestamp) ? void 0 : fallback;
|
|
61
|
+
}
|
|
62
|
+
watch(() => props.modelValue, (modelValue) => {
|
|
63
|
+
if (isUserActive()) return;
|
|
64
|
+
currentTime.value = parseModelValue(modelValue);
|
|
65
|
+
}, { immediate: true });
|
|
66
|
+
const displayedValue = computed(() => currentTime.value?.format(formatStr.value) ?? "");
|
|
67
|
+
const columns = computed(() => {
|
|
68
|
+
const t = currentTime.value;
|
|
69
|
+
const disabledHours = new Set(props.disabledHours?.() ?? []);
|
|
70
|
+
const disabledMinutes = new Set(props.disabledMinutes?.(t?.hours ?? 0) ?? []);
|
|
71
|
+
const disabledSeconds = new Set(props.disabledSeconds?.(t?.hours ?? 0, t?.minutes ?? 0) ?? []);
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
name: "hours",
|
|
75
|
+
selected: t?.hours,
|
|
76
|
+
values: buildValues(24, disabledHours)
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "minutes",
|
|
80
|
+
selected: t?.minutes,
|
|
81
|
+
values: buildValues(60, disabledMinutes)
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "seconds",
|
|
85
|
+
selected: t?.seconds,
|
|
86
|
+
values: buildValues(60, disabledSeconds)
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
});
|
|
90
|
+
function buildValues(count, disabled) {
|
|
91
|
+
return Array.from({ length: count }, (_, value) => ({
|
|
92
|
+
value,
|
|
93
|
+
disabled: disabled.has(value)
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
const pad = (value) => `${value}`.padStart(2, "0");
|
|
97
|
+
function formatModelValue(d) {
|
|
98
|
+
if (props.dataType === "date") return d.raw;
|
|
99
|
+
if (props.dataType === "timestamp") return d.timestamp;
|
|
100
|
+
return d.format(props.valueFormat ?? formatStr.value);
|
|
101
|
+
}
|
|
102
|
+
const commitSelectedTime = userAction((time) => {
|
|
103
|
+
currentTime.value = time;
|
|
104
|
+
emit("update:modelValue", formatModelValue(time));
|
|
105
|
+
emit("change", time.raw);
|
|
106
|
+
});
|
|
107
|
+
function handleSelect(unit, item) {
|
|
108
|
+
if (item.disabled) return;
|
|
109
|
+
const next = (currentTime.value ?? date().setHours(0).setMinutes(0).setSeconds(0)).clone();
|
|
110
|
+
if (unit === "hours") next.setHours(item.value);
|
|
111
|
+
else if (unit === "minutes") next.setMinutes(item.value);
|
|
112
|
+
else next.setSeconds(item.value);
|
|
113
|
+
commitSelectedTime(next);
|
|
114
|
+
}
|
|
115
|
+
function handleClear() {
|
|
116
|
+
currentTime.value = void 0;
|
|
117
|
+
emit("update:modelValue", void 0);
|
|
118
|
+
emit("change", void 0);
|
|
119
|
+
}
|
|
120
|
+
/** 函数 ref:面板经 Teleport 挂载时元素先创建、后插入文档(ref 回调时还未连接),推迟到 nextTick 再把各列滚动到选中值居中 */
|
|
121
|
+
function scrollSelectedToCenter(panel) {
|
|
122
|
+
if (!(panel instanceof HTMLElement)) return;
|
|
123
|
+
nextTick(() => {
|
|
124
|
+
if (!panel.isConnected) return;
|
|
125
|
+
for (const column of panel.querySelectorAll(`.${cls.e("column")}`)) {
|
|
126
|
+
const selected = column.querySelector(".is-selected");
|
|
127
|
+
if (selected instanceof HTMLElement) column.scrollTop = selected.offsetTop - (column.clientHeight - selected.offsetHeight) / 2;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return (_ctx, _cache) => {
|
|
132
|
+
return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
133
|
+
class: className.value,
|
|
134
|
+
trigger: "click",
|
|
135
|
+
width: "auto",
|
|
136
|
+
disabled: unref(disabled)
|
|
137
|
+
}), {
|
|
138
|
+
trigger: withCtx(() => [createVNode(unref(input_default), {
|
|
139
|
+
size: unref(size),
|
|
140
|
+
"native-readonly": "",
|
|
141
|
+
clearable: clearable.value,
|
|
142
|
+
placeholder: placeholder.value,
|
|
143
|
+
"model-value": displayedValue.value,
|
|
144
|
+
disabled: unref(disabled),
|
|
145
|
+
onClear: handleClear
|
|
146
|
+
}, {
|
|
147
|
+
suffix: withCtx(() => [createVNode(unref(_sfc_main$1), { class: normalizeClass(unref(cls).e("icon")) }, {
|
|
148
|
+
default: withCtx(() => [createVNode(unref(Time))]),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 8, ["class"])]),
|
|
151
|
+
_: 1
|
|
152
|
+
}, 8, [
|
|
153
|
+
"size",
|
|
154
|
+
"clearable",
|
|
155
|
+
"placeholder",
|
|
156
|
+
"model-value",
|
|
157
|
+
"disabled"
|
|
158
|
+
])]),
|
|
159
|
+
content: withCtx(() => [createElementVNode("div", {
|
|
160
|
+
ref: scrollSelectedToCenter,
|
|
161
|
+
class: normalizeClass([unref(cls).e("panel"), unref(cls).em("panel", unref(size))])
|
|
162
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (col) => {
|
|
163
|
+
return openBlock(), createElementBlock("div", {
|
|
164
|
+
key: col.name,
|
|
165
|
+
class: normalizeClass(unref(cls).e("column"))
|
|
166
|
+
}, [
|
|
167
|
+
createElementVNode("div", {
|
|
168
|
+
class: normalizeClass(unref(cls).e("spacer")),
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
}, null, 2),
|
|
171
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(col.values, (item) => {
|
|
172
|
+
return openBlock(), createElementBlock("div", {
|
|
173
|
+
key: item.value,
|
|
174
|
+
class: normalizeClass([
|
|
175
|
+
unref(cls).e("item"),
|
|
176
|
+
unref(bem).is("selected", col.selected === item.value),
|
|
177
|
+
unref(bem).is("disabled", item.disabled)
|
|
178
|
+
]),
|
|
179
|
+
onClick: ($event) => handleSelect(col.name, item)
|
|
180
|
+
}, toDisplayString(pad(item.value)), 11, _hoisted_1);
|
|
181
|
+
}), 128)),
|
|
182
|
+
createElementVNode("div", {
|
|
183
|
+
class: normalizeClass(unref(cls).e("spacer")),
|
|
184
|
+
"aria-hidden": "true"
|
|
185
|
+
}, null, 2)
|
|
186
|
+
], 2);
|
|
187
|
+
}), 128))], 2)]),
|
|
188
|
+
_: 1
|
|
189
|
+
}, 16, ["class", "disabled"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(displayedValue.value || unref(FORM_EMPTY_CONTENT)), 1)], 64));
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
//#endregion
|
|
194
|
+
export { _sfc_main as default };
|
|
195
|
+
|
|
196
|
+
//# sourceMappingURL=time-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-picker.js","names":["$attrs","_unref","_openBlock","_createBlock","UDropdown","_mergeProps","_withCtx","_createVNode","UInput","UIcon","_normalizeClass","_createElementVNode","_createElementBlock","_Fragment","_renderList","_toDisplayString","_createTextVNode"],"sources":["../../../src/components/time-picker/time-picker.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n :class=\"className\"\n trigger=\"click\"\n width=\"auto\"\n :disabled=\"disabled\"\n >\n <template #trigger>\n <u-input\n :size=\"size\"\n native-readonly\n :clearable=\"clearable\"\n :placeholder=\"placeholder\"\n :model-value=\"displayedValue\"\n :disabled=\"disabled\"\n @clear=\"handleClear\"\n >\n <template #suffix>\n <u-icon :class=\"cls.e('icon')\"><Time /></u-icon>\n </template>\n </u-input>\n </template>\n\n <template #content>\n <div :ref=\"scrollSelectedToCenter\" :class=\"[cls.e('panel'), cls.em('panel', size)]\">\n <div v-for=\"col in columns\" :key=\"col.name\" :class=\"cls.e('column')\">\n <div :class=\"cls.e('spacer')\" aria-hidden=\"true\"></div>\n <div\n v-for=\"item in col.values\"\n :key=\"item.value\"\n :class=\"[\n cls.e('item'),\n bem.is('selected', col.selected === item.value),\n bem.is('disabled', item.disabled)\n ]\"\n @click=\"handleSelect(col.name, item)\"\n >\n {{ pad(item.value) }}\n </div>\n <div :class=\"cls.e('spacer')\" aria-hidden=\"true\"></div>\n </div>\n </div>\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedValue || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { date, Dater } from '@cat-kit/core'\nimport { useFormFallbackProps, useUserAction } from '@veltra/compositions'\nimport { Time } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT, injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type { TimePickerEmits, TimePickerProps } from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\n\ndefineOptions({ name: 'UTimePicker', inheritAttrs: false })\n\nconst props = defineProps<TimePickerProps>()\n\nconst emit = defineEmits<TimePickerEmits>()\n\nconst cls = bem('time-picker')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst className = computed(() => [cls.b, cls.m(size.value)])\n\nconst placeholder = computed(() => props.placeholder ?? '选择时间')\n\nconst clearable = computed(() => props.clearable ?? true)\n\nconst formatStr = computed(() => props.format ?? 'HH:mm:ss')\n\nconst currentTime = shallowRef<Dater>()\n\nconst { userAction, isUserActive } = useUserAction()\n\nfunction parseModelValue(val?: string | number | Date): Dater | undefined {\n if (val == null || val === '') return undefined\n if (val instanceof Date || typeof val === 'number') {\n const d = date(val)\n return isNaN(d.timestamp) ? undefined : d\n }\n const parsed = Dater.parse(val, props.valueFormat ?? formatStr.value)\n if (!isNaN(parsed.timestamp)) return parsed\n const fallback = date(val)\n return isNaN(fallback.timestamp) ? undefined : fallback\n}\n\nwatch(\n () => props.modelValue,\n (modelValue) => {\n if (isUserActive()) return\n currentTime.value = parseModelValue(modelValue)\n },\n { immediate: true }\n)\n\nconst displayedValue = computed(() => currentTime.value?.format(formatStr.value) ?? '')\n\ntype TimeUnit = 'hours' | 'minutes' | 'seconds'\n\ninterface TimeItem {\n value: number\n disabled: boolean\n}\n\nconst columns = computed(() => {\n const t = currentTime.value\n const disabledHours = new Set(props.disabledHours?.() ?? [])\n const disabledMinutes = new Set(props.disabledMinutes?.(t?.hours ?? 0) ?? [])\n const disabledSeconds = new Set(props.disabledSeconds?.(t?.hours ?? 0, t?.minutes ?? 0) ?? [])\n\n return [\n { name: 'hours' as const, selected: t?.hours, values: buildValues(24, disabledHours) },\n { name: 'minutes' as const, selected: t?.minutes, values: buildValues(60, disabledMinutes) },\n { name: 'seconds' as const, selected: t?.seconds, values: buildValues(60, disabledSeconds) }\n ]\n})\n\nfunction buildValues(count: number, disabled: Set<number>): TimeItem[] {\n return Array.from({ length: count }, (_, value) => ({ value, disabled: disabled.has(value) }))\n}\n\nconst pad = (value: number) => `${value}`.padStart(2, '0')\n\nfunction formatModelValue(d: Dater) {\n if (props.dataType === 'date') return d.raw\n if (props.dataType === 'timestamp') return d.timestamp\n return d.format(props.valueFormat ?? formatStr.value)\n}\n\nconst commitSelectedTime = userAction((time: Dater) => {\n currentTime.value = time\n emit('update:modelValue', formatModelValue(time))\n emit('change', time.raw)\n})\n\nfunction handleSelect(unit: TimeUnit, item: TimeItem) {\n if (item.disabled) return\n // 无初值时以当天 00:00:00 为基底,只改点击的维度,未选维度保持 0\n const next = (currentTime.value ?? date().setHours(0).setMinutes(0).setSeconds(0)).clone()\n if (unit === 'hours') next.setHours(item.value)\n else if (unit === 'minutes') next.setMinutes(item.value)\n else next.setSeconds(item.value)\n commitSelectedTime(next)\n}\n\nfunction handleClear() {\n currentTime.value = undefined\n emit('update:modelValue', undefined)\n emit('change', undefined)\n}\n\n/** 函数 ref:面板经 Teleport 挂载时元素先创建、后插入文档(ref 回调时还未连接),推迟到 nextTick 再把各列滚动到选中值居中 */\nfunction scrollSelectedToCenter(panel: Element | null) {\n if (!(panel instanceof HTMLElement)) return\n nextTick(() => {\n if (!panel.isConnected) return\n for (const column of panel.querySelectorAll<HTMLElement>(`.${cls.e('column')}`)) {\n const selected = column.querySelector('.is-selected')\n if (selected instanceof HTMLElement) {\n column.scrollTop = selected.offsetTop - (column.clientHeight - selected.offsetHeight) / 2\n }\n }\n })\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAE7B,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,YAAY,eAAe,CAAC,IAAI,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC;EAE3D,MAAM,cAAc,eAAe,MAAM,eAAe,MAAM;EAE9D,MAAM,YAAY,eAAe,MAAM,aAAa,IAAI;EAExD,MAAM,YAAY,eAAe,MAAM,UAAU,UAAU;EAE3D,MAAM,cAAc,WAAkB;EAEtC,MAAM,EAAE,YAAY,iBAAiB,cAAc;EAEnD,SAAS,gBAAgB,KAAiD;GACxE,IAAI,OAAO,QAAQ,QAAQ,IAAI,OAAO,KAAA;GACtC,IAAI,eAAe,QAAQ,OAAO,QAAQ,UAAU;IAClD,MAAM,IAAI,KAAK,GAAG;IAClB,OAAO,MAAM,EAAE,SAAS,IAAI,KAAA,IAAY;GAC1C;GACA,MAAM,SAAS,MAAM,MAAM,KAAK,MAAM,eA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,OAAA;OAAjD,OAAKD,eAAET,MAAA,GAAA,CAAG,CAAC,EAAC,QAAA,CAAA;OAAY,eAAY;;;;;GAMlD,GAAA,IAAA,CAAA,SAAA,UAAA,CAAA,MAAAC,UAAA,GAAAU,mBAEWC,UAAA,EAAA,KAAA,EAAA,GAAA,CADNG,gBAAAD,gBAAA,eAAA,SAAkBd,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./style2.css";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/** flex布局 */
|
|
3
|
+
/**
|
|
4
|
+
* 设置css变量
|
|
5
|
+
* 参数1:变量前缀
|
|
6
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
7
|
+
* css-var(height, (
|
|
8
|
+
* large: 40px
|
|
9
|
+
* default: 32px
|
|
10
|
+
* small: 24px
|
|
11
|
+
* ))
|
|
12
|
+
* 生成的css变量:
|
|
13
|
+
* --u-height-large: 40px;
|
|
14
|
+
* --u-height-default: 32px;
|
|
15
|
+
* --u-height-small: 24px;
|
|
16
|
+
*/
|
|
17
|
+
/** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
|
|
18
|
+
.u-timeline {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
list-style: none;
|
|
22
|
+
font-size: var(--u-font-size-main-default);
|
|
23
|
+
line-height: 1.6;
|
|
24
|
+
color: var(--u-text-color-main);
|
|
25
|
+
}
|
|
26
|
+
.u-timeline__item {
|
|
27
|
+
position: relative;
|
|
28
|
+
padding-left: calc(12px + var(--u-gap-default));
|
|
29
|
+
padding-bottom: var(--u-gap-large);
|
|
30
|
+
}
|
|
31
|
+
.u-timeline__item::before {
|
|
32
|
+
content: "";
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: calc((12px - 2px) / 2);
|
|
35
|
+
top: calc((calc(var(--u-font-size-main-default) * 1.6) + 12px) / 2 + var(--u-gap-small));
|
|
36
|
+
bottom: 0;
|
|
37
|
+
border-left: 2px solid var(--u-border-color);
|
|
38
|
+
}
|
|
39
|
+
.u-timeline__item:last-child {
|
|
40
|
+
padding-bottom: 0;
|
|
41
|
+
}
|
|
42
|
+
.u-timeline__item:last-child::before {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
.u-timeline__node {
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
width: 12px;
|
|
53
|
+
height: calc(var(--u-font-size-main-default) * 1.6);
|
|
54
|
+
}
|
|
55
|
+
.u-timeline__node::before {
|
|
56
|
+
content: "";
|
|
57
|
+
width: 12px;
|
|
58
|
+
height: 12px;
|
|
59
|
+
border-radius: 50%;
|
|
60
|
+
background-color: var(--u-border-color);
|
|
61
|
+
}
|
|
62
|
+
.u-timeline__node--primary::before {
|
|
63
|
+
background-color: var(--u-color-primary);
|
|
64
|
+
}
|
|
65
|
+
.u-timeline__node--success::before {
|
|
66
|
+
background-color: var(--u-color-success);
|
|
67
|
+
}
|
|
68
|
+
.u-timeline__node--warning::before {
|
|
69
|
+
background-color: var(--u-color-warning);
|
|
70
|
+
}
|
|
71
|
+
.u-timeline__node--danger::before {
|
|
72
|
+
background-color: var(--u-color-danger);
|
|
73
|
+
}
|
|
74
|
+
.u-timeline__node.is-custom {
|
|
75
|
+
width: auto;
|
|
76
|
+
}
|
|
77
|
+
.u-timeline__node.is-custom::before {
|
|
78
|
+
display: none;
|
|
79
|
+
}
|
|
80
|
+
.u-timeline__wrapper {
|
|
81
|
+
min-width: 0;
|
|
82
|
+
}
|
|
83
|
+
.u-timeline__timestamp {
|
|
84
|
+
margin-top: var(--u-gap-small);
|
|
85
|
+
color: var(--u-text-color-second);
|
|
86
|
+
font-size: var(--u-font-size-main-small);
|
|
87
|
+
line-height: calc(var(--u-font-size-main-default) * 1.6);
|
|
88
|
+
}
|
|
89
|
+
.u-timeline__timestamp--top {
|
|
90
|
+
margin-top: 0;
|
|
91
|
+
margin-bottom: var(--u-gap-small);
|
|
92
|
+
}
|
|
93
|
+
.u-timeline__content {
|
|
94
|
+
word-break: break-word;
|
|
95
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useSlots } from "vue";
|
|
2
|
+
import { bem } from "@veltra/utils";
|
|
3
|
+
//#region src/components/timeline/timeline-item.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
name: "UTimelineItem",
|
|
6
|
+
__name: "timeline-item",
|
|
7
|
+
props: {
|
|
8
|
+
color: { default: "default" },
|
|
9
|
+
timestamp: {},
|
|
10
|
+
timestampPlacement: { default: "bottom" }
|
|
11
|
+
},
|
|
12
|
+
setup(__props) {
|
|
13
|
+
const cls = bem("timeline");
|
|
14
|
+
const slots = useSlots();
|
|
15
|
+
const nodeClass = computed(() => [
|
|
16
|
+
cls.e("node"),
|
|
17
|
+
cls.em("node", __props.color),
|
|
18
|
+
bem.is("custom", !!slots.dot)
|
|
19
|
+
]);
|
|
20
|
+
const timestampClass = computed(() => [cls.e("timestamp"), ...__props.timestampPlacement === "top" ? [cls.em("timestamp", "top")] : []]);
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("li", { class: normalizeClass(unref(cls).e("item")) }, [createElementVNode("div", { class: normalizeClass(nodeClass.value) }, [renderSlot(_ctx.$slots, "dot")], 2), createElementVNode("div", { class: normalizeClass(unref(cls).e("wrapper")) }, [__props.timestamp ? (openBlock(), createElementBlock("div", {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: normalizeClass(timestampClass.value)
|
|
25
|
+
}, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(cls).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2)], 2)], 2);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { _sfc_main as default };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=timeline-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-item.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_renderSlot","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/timeline/timeline-item.vue"],"sourcesContent":["<template>\n <li :class=\"cls.e('item')\">\n <div :class=\"nodeClass\">\n <slot name=\"dot\" />\n </div>\n <div :class=\"cls.e('wrapper')\">\n <div v-if=\"timestamp\" :class=\"timestampClass\">{{ timestamp }}</div>\n <div :class=\"cls.e('content')\">\n <slot />\n </div>\n </div>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, useSlots } from 'vue'\n\nimport type { TimelineItemProps } from '../../types'\n\ndefineOptions({ name: 'UTimelineItem' })\n\nconst {\n color = 'default',\n timestamp,\n timestampPlacement = 'bottom'\n} = defineProps<TimelineItemProps>()\n\nconst cls = bem('timeline')\n\nconst slots = useSlots()\n\nconst nodeClass = computed(() => [\n cls.e('node'),\n cls.em('node', color),\n bem.is('custom', !!slots.dot)\n])\n\nconst timestampClass = computed(() => [\n cls.e('timestamp'),\n ...(timestampPlacement === 'top' ? [cls.em('timestamp', 'top')] : [])\n])\n</script>\n"],"mappings":";;;;;;;;;;;;EA4BA,MAAM,MAAM,IAAI,UAAU;EAE1B,MAAM,QAAQ,SAAS;EAEvB,MAAM,YAAY,eAAe;GAC/B,IAAI,EAAE,MAAM;GACZ,IAAI,GAAG,QAAQ,QAAA,KAAK;GACpB,IAAI,GAAG,UAAU,CAAC,CAAC,MAAM,GAAG;EAC9B,CAAC;EAED,MAAM,iBAAiB,eAAe,CACpC,IAAI,EAAE,WAAW,GACjB,GAAI,QAAA,uBAAuB,QAAQ,CAAC,IAAI,GAAG,aAAa,KAAK,CAAC,IAAI,CAAC,CACrE,CAAC;;GAxCC,OAAAA,UAAA,GAAAC,mBAUK,MAAA,EAVA,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,CAAA,EAAA,GACf,CAAAC,mBAEM,OAAA,EAFA,OAAKF,eAAE,UAAA,KAAS,EAAA,GACpB,CAAAG,WAAmB,KAAA,QAAA,KAAA,CAAA,GAAA,CAErB,GAAAD,mBAKM,OAAA,EALA,OAAKF,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA,EAAA,GACL,CAAA,QAAA,aAAXH,UAAA,GAAAC,mBAAmE,OAAA;;IAA5C,OAAKC,eAAE,eAAA,KAAc;GAAK,GAAAI,gBAAA,QAAA,SAAS,GAAA,CAAA,KAAAC,mBAAA,QAAA,IAAA,GAC1DH,mBAEM,OAAA,EAFA,OAAKF,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA,EAAA,GAChB,CAAAE,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, unref } from "vue";
|
|
2
|
+
import { bem } from "@veltra/utils";
|
|
3
|
+
//#region src/components/timeline/timeline.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
name: "UTimeline",
|
|
6
|
+
__name: "timeline",
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const cls = bem("timeline");
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return openBlock(), createElementBlock("ul", { class: normalizeClass(unref(cls).b) }, [renderSlot(_ctx.$slots, "default")], 2);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { _sfc_main as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_renderSlot"],"sources":["../../../src/components/timeline/timeline.vue"],"sourcesContent":["<template>\n <ul :class=\"cls.b\">\n <slot />\n </ul>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\n\nimport type { TimelineProps } from '../../types'\n\ndefineOptions({ name: 'UTimeline' })\n\ndefineProps<TimelineProps>()\n\nconst cls = bem('timeline')\n</script>\n"],"mappings":";;;;;;;EAeA,MAAM,MAAM,IAAI,UAAU;;GAdxB,OAAAA,UAAA,GAAAC,mBAEK,MAAA,EAFA,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,CAAC,EAAA,GACf,CAAAC,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
|