+
2020
@@ -262,6 +266,25 @@ export default defineComponent({
:::
+### 设置时间位置
+
+:::demo
+
+```vue
+
+
+ Download
+ Check
+ Build
+ Depoy
+ End
+
+
+
+```
+
+:::
+
### d-time-axis
| 参数 | 类型 | 默认 | 说明 | 跳转 Demo |
@@ -269,6 +292,7 @@ export default defineComponent({
| direction | `'vertical'\|'horizontal'` | `vertical` | 设置时间轴方向 | [基本用法](#基本用法) |
| center | `boolean`| `false` | 当方向为`horizontal`时,是否将内容设置居中 | [基本用法](#基本用法) |
| mode | `'normal'\|'alternative'` | `normal` | 可选,`normal`模式下内容按默认方向排布, `alternative`模式下内容交替排布 | [自定义内容](#自定义内容) |
+| time-position | `'left'\|'bottom'` | `left` | 可选,仅当`direction` 为 `vertical` 时定义时间参数位置(全局设置,当与`mode`属性冲突时以`mode`为准) | [自定义内容](#自定义内容) |
### d-time-axis-item参数
@@ -280,10 +304,12 @@ export default defineComponent({
| lineStyle| `'solid'\|'dashed'\|'dotted'\|'none'` | `solid` | 可选,设置线条样式 | [自定义样式](#自定义样式) |
| lineColor |`string` | -- | 可选,设置线条颜色 | [自定义样式](#自定义样式) |
| position |`'top'\|'bottom'\|'left'\|'right'` | 当`direction`为`vertical`时默认:`right`,当`direction`为`horizontal`时,默认:`bottom` | 可选,设置内容存在的位置,若有time则time处在相反的位置 | [自定义内容位置](#自定义内容位置) |
+| time-position | `'left'\|'bottom'` | `left` | 可选,仅当`direction` 为 `vertical` 时定义时间参数位置(全局设置,当与`position`属性冲突时以`position`为准) | [自定义内容](#自定义内容) |
### d-time-axis-item插槽
| 参数 | 描述 | 跳转 Demo |
| ------------ | ---- | --------- |
| dot | 自定义时间轴点 | [自定义样式](#自定义样式) |
+| time | 自定义时间 | [自定义样式](#自定义样式) |
| extra | 自定义两个时间点间附加元素 | [自定义内容](#自定义内容) |
--
Gitee
From 7a872479702bcbd9a0e67850434c563e4b46fd46 Mon Sep 17 00:00:00 2001
From: jenson <1763417179@qq.com>
Date: Tue, 9 Nov 2021 13:02:08 +0800
Subject: [PATCH 08/13] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E6=97=B6?=
=?UTF-8?q?=E9=97=B4=E8=BD=B4=E7=BB=84=E4=BB=B6=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/devui-vue/devui/time-axis/index.ts | 2 +-
.../src/components/time-axis-item/index.scss | 58 -------------------
.../src/components/time-axis-item/index.tsx | 44 +++++++++-----
.../src/components/time-axis-item/types.ts | 6 ++
.../devui/time-axis/src/time-axis.scss | 54 +++++++++++++++++
.../devui/time-axis/src/time-axis.tsx | 6 +-
.../docs/components/time-axis/index.md | 37 +++++++-----
7 files changed, 116 insertions(+), 91 deletions(-)
delete mode 100644 packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.scss
diff --git a/packages/devui-vue/devui/time-axis/index.ts b/packages/devui-vue/devui/time-axis/index.ts
index c3d67f63..59ac2dbc 100644
--- a/packages/devui-vue/devui/time-axis/index.ts
+++ b/packages/devui-vue/devui/time-axis/index.ts
@@ -12,7 +12,7 @@ export { TimeAxis,TimeAxisItem }
export default {
title: 'TimeAxis 时间轴',
category: '数据展示',
- status: '80%', // TODO: 组件若开发完成则填入"已完成",并删除该注释
+ status: '90%', // TODO: 组件若开发完成则填入"已完成",并删除该注释
install(app: App): void {
app.use(TimeAxis as any)
app.use(TimeAxisItem as any)
diff --git a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.scss b/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.scss
deleted file mode 100644
index 4c46ac03..00000000
--- a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.scss
+++ /dev/null
@@ -1,58 +0,0 @@
-@import '../../../../style/theme/color';
-
-.devui-time-axis-item-type {
- &-primary {
- border: 2px solid $devui-placeholder;
- border-radius: 50%;
- }
-
- &-right {
- i {
- color: $devui-success;
- }
- }
-
- &-danger {
- path {
- fill: $devui-danger;
- }
-
- circle {
- fill: $devui-light-text;
- }
- }
-
- &-warning {
- i {
- color: $devui-warning;
- }
- }
-
- &-running {
- line-height: 16px;
- text-align: center;
- animation: devui-time-axis-running 1.5s linear infinite;
- border: 2px solid $devui-success;
- border-radius: 50%;
- }
-}
-
-@keyframes devui-time-axis-running {
- 0% {
- transform: rotate(0deg);
- color: $devui-success;
- border-color: $devui-success;
- }
-
- 50% {
- transform: rotate(180deg);
- color: $devui-success;
- border-color: $devui-success;
- }
-
- 100% {
- transform: rotate(360deg);
- color: $devui-success;
- border-color: $devui-success;
- }
-}
diff --git a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.tsx b/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.tsx
index 627219cc..6600a304 100644
--- a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.tsx
+++ b/packages/devui-vue/devui/time-axis/src/components/time-axis-item/index.tsx
@@ -1,15 +1,15 @@
import {defineComponent, inject, nextTick, onMounted, ref, watch} from 'vue'
-import type { TimeAxisRootType } from '../../time-axis-types'
-
-import {timeAxisItemProps, TimeAxisItemProps} from './types'
-import './index.scss'
+import type {TimeAxisRootType} from '../../time-axis-types'
+import DIcon from '../../../../icon/src/icon'
+import {timeAxisItemProps, TimeAxisItemProps, Type} from './types'
export default defineComponent({
name: 'DTimeAxisItem',
props: timeAxisItemProps,
+ components: {DIcon},
emits: [],
setup(props: TimeAxisItemProps, ctx) {
- const timeAxis:TimeAxisRootType = inject('timeAxis')
+ const timeAxis: TimeAxisRootType = inject('timeAxis')
const itemClass = 'devui-time-axis-item'
const renderTime = () => {
return (
@@ -39,34 +39,48 @@ export default defineComponent({
return renderTime()
} else {
//如果有设定time-position,则left显示在这
- return props.timePosition === 'left' ? renderTime():''
+ return props.timePosition === 'left' ? renderTime() : ''
}
}
}
+ const setTypeIcon = (type: Type) => {
+ if (type === 'primary') {
+ return ''
+ }
+ return
+ }
+ const renderDot = () => {
+ if (ctx.slots.dot) {
+ return
{ctx.slots.dot?.()}
+ } else {
+ return (
+ {setTypeIcon(props.type)}
+
)
+ }
+
+ }
return () => {
return (
- {renderPosition(['top','left'])}
+ {renderPosition(['top', 'left'])}
{
- ctx.slots.dot
- ?
{ctx.slots.dot?.()}
- :
+ renderDot()
}
- {(timeAxis.props.direction === 'vertical'&&props.timePosition === 'bottom')?renderTime():''}
+ {(timeAxis.props.direction === 'vertical' && props.timePosition === 'bottom') ? renderTime() : ''}
- {ctx.slots.extra ? :''}
+ {ctx.slots.extra ? : ''}
- {renderPosition(['right','bottom'])}
+ {renderPosition(['right', 'bottom'])}
diff --git a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/types.ts b/packages/devui-vue/devui/time-axis/src/components/time-axis-item/types.ts
index 01289a4a..d4172592 100644
--- a/packages/devui-vue/devui/time-axis/src/components/time-axis-item/types.ts
+++ b/packages/devui-vue/devui/time-axis/src/components/time-axis-item/types.ts
@@ -1,6 +1,7 @@
import type { PropType, ExtractPropTypes } from 'vue'
import type { LineStyle,TimePosition } from '../../time-axis-types'
export type Position = 'top' | 'bottom' | 'left' | 'right'
+export type Type = 'primary' | 'success' | 'warning' | 'error'
export const timeAxisItemProps = {
time: {
type: String,
@@ -26,6 +27,11 @@ export const timeAxisItemProps = {
timePosition: {
type: String as PropType
,
default: 'left'
+ },
+ //时间点类型
+ type: {
+ type: String as PropType,
+ default: 'primary'
}
} as const
diff --git a/packages/devui-vue/devui/time-axis/src/time-axis.scss b/packages/devui-vue/devui/time-axis/src/time-axis.scss
index e4804133..6d15b4cc 100644
--- a/packages/devui-vue/devui/time-axis/src/time-axis.scss
+++ b/packages/devui-vue/devui/time-axis/src/time-axis.scss
@@ -174,6 +174,7 @@ $devui-time-axis-item-dot-size: 18px;
& > i {
font-size: $devui-time-axis-item-dot-size;
+ vertical-align: 0;
}
}
@@ -184,4 +185,57 @@ $devui-time-axis-item-dot-size: 18px;
}
}
}
+
+ &-type {
+ &-primary {
+ border: 2px solid $devui-placeholder;
+ border-radius: 50%;
+ }
+
+ &-success {
+ i {
+ color: $devui-success;
+ }
+ }
+
+ &-error {
+ i {
+ color: $devui-danger;
+ }
+ }
+
+ &-warning {
+ i {
+ color: $devui-warning;
+ }
+ }
+
+ &-running {
+ line-height: 16px;
+ text-align: center;
+ animation: devui-time-axis-running 1.5s linear infinite;
+ border: 2px solid $devui-success;
+ border-radius: 50%;
+ }
+ }
+}
+
+@keyframes devui-time-axis-running {
+ 0% {
+ transform: rotate(0deg);
+ color: $devui-success;
+ border-color: $devui-success;
+ }
+
+ 50% {
+ transform: rotate(180deg);
+ color: $devui-success;
+ border-color: $devui-success;
+ }
+
+ 100% {
+ transform: rotate(360deg);
+ color: $devui-success;
+ border-color: $devui-success;
+ }
}
diff --git a/packages/devui-vue/devui/time-axis/src/time-axis.tsx b/packages/devui-vue/devui/time-axis/src/time-axis.tsx
index 060a347d..91e26335 100644
--- a/packages/devui-vue/devui/time-axis/src/time-axis.tsx
+++ b/packages/devui-vue/devui/time-axis/src/time-axis.tsx
@@ -1,5 +1,5 @@
import {defineComponent, Fragment, nextTick, onMounted, provide, reactive, ref, toRef, watch} from 'vue'
-import {timeAxisProps, TimeAxisProps,TimeAxisRootType} from './time-axis-types'
+import {timeAxisProps, TimeAxisProps, TimeAxisRootType} from './time-axis-types'
import TimeAxisItem from './components/time-axis-item'
import './time-axis.scss'
@@ -44,8 +44,8 @@ export default defineComponent({
})
return () => {
const renderPositionNode = (item, position?) => {
- let timePosition:string = props.timePosition ? props.timePosition : 'left'
- if(item.props?.timePosition||item.props?.['time-position']){
+ let timePosition: string = props.timePosition ? props.timePosition : 'left'
+ if (item.props?.timePosition || item.props?.['time-position']) {
timePosition = item.props.timePosition
}
return position
diff --git a/packages/devui-vue/docs/components/time-axis/index.md b/packages/devui-vue/docs/components/time-axis/index.md
index 1ff7bc0b..571df207 100644
--- a/packages/devui-vue/docs/components/time-axis/index.md
+++ b/packages/devui-vue/docs/components/time-axis/index.md
@@ -178,6 +178,9 @@ export default defineComponent({
>
{{ item.title }}
发布日期:{{ item.date }}
+ 版本状态:
+ {{item.status}}
+