Skip to content

Commit

Permalink
feat: enhance the divider dialogbox treemenu function
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr committed Jan 8, 2025
1 parent 6e29e24 commit eaa9e72
Show file tree
Hide file tree
Showing 90 changed files with 2,035 additions and 242 deletions.
30 changes: 30 additions & 0 deletions examples/sites/demos/apis/dialog-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,36 @@ export default {
mode: ['pc'],
pcDemo: 'dialog-width'
},
{
name: 'custom-style',
type: 'string',
defaultValue: ``,
desc: {
'zh-CN': '自定义实现双层抽屉',
'en-US': 'Custom Styles'
},
meta: {
stable: '3.21.0'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'double-dialog-height',
mfDemo: 'double-dialog-height'
},
{
name: 'no-animation',
type: 'string',
defaultValue: ``,
desc: {
'zh-CN': '是否开启动画',
'en-US': 'Indicates whether to enable animation'
},
meta: {
stable: '3.21.0'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'double-dialog-height',
mfDemo: 'double-dialog-height'
},
{
name: 'dialog-transition',
type: 'string',
Expand Down
97 changes: 88 additions & 9 deletions examples/sites/demos/apis/divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ export default {
type: 'string',
defaultValue: "'solid'",
desc: {
'zh-CN': '设置分隔线的样式,该属性的可选值为 solid / dashed',
'en-US': 'Set the style of the separator line, with optional values of solid/dashed for this property'
'zh-CN': '设置分隔线的样式,该属性的可选值为 solid / dashed / dotted',
'en-US':
'Set the style of the separator line, with optional values of solid/dashed/dotted for this property'
},
mode: ['pc'],
pcDemo: 'custom-style'
mode: ['pc', 'mobile-first'],
pcDemo: 'custom-style',
mfDemo: 'type'
},
{
name: 'color',
Expand All @@ -24,8 +26,9 @@ export default {
'zh-CN': '设置分隔线的颜色',
'en-US': 'Set the color of the divider.'
},
mode: ['pc'],
pcDemo: 'custom-style'
mode: ['pc', 'mobile-first'],
pcDemo: 'custom-style',
mfDemo: 'color'
},
{
name: 'content-background-color',
Expand Down Expand Up @@ -58,8 +61,9 @@ export default {
'en-US':
'Set the position of the separator text, with optional values of left/center/right for this attribute'
},
mode: ['pc'],
pcDemo: 'content-position'
mode: ['pc', 'mobile-first'],
pcDemo: 'content-position',
mfDemo: 'content-position'
},
{
name: 'direction',
Expand All @@ -70,8 +74,83 @@ export default {
'en-US':
'Set the direction of the divider; the possible values for this property are "horizontal" or "vertical"'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'direction',
mfDemo: 'vertical'
},
{
name: 'margin',
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '设置分割线上下左右的边距',
'en-US': 'Sets the margins of the split line'
},
meta: {
stable: '3.21.0'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'custom-style',
mfDemo: 'divider-margin'
},
{
name: 'offset',
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '设置文本位置偏移量,需同时配合`text-position`属性使用,以确定偏移的方向',
'en-US':
'Sets the text position offset. This parameter must be used together with the `text-position` attribute to determine the offset direction'
},
meta: {
stable: '3.21.0'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'content-position',
mfDemo: 'offset'
},
{
name: 'height',
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '设置整体的高度',
'en-US': 'Sets the overall height'
},
meta: {
stable: '3.21.0'
},
mode: ['pc'],
pcDemo: 'custom-style'
},
{
name: 'font-size',
type: 'string',
defaultValue: '14px',
desc: {
'zh-CN': '文本字体大小',
'en-US': 'Text font size'
},
meta: {
stable: '3.21.0'
},
mode: ['pc'],
pcDemo: 'direction'
pcDemo: 'custom-style'
},
{
name: 'status',
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '分割线状态',
'en-US': 'Splitting Line Status'
},
meta: {
stable: '3.21.0'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'status',
mfDemo: 'status'
}
],
events: [],
Expand Down
4 changes: 2 additions & 2 deletions examples/sites/demos/apis/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ export default {
},
{
name: 'validate-on-rule-change',
type: 'boolean',
type: 'boolean | "deep"',
defaultValue: 'true',
desc: {
'zh-CN': '是否在 rules 属性改变后立即触发一次验证',
'zh-CN': '是否在 rules 属性改变后立即触发一次验证("deep"选项新增于3.21.0)',
'en-US': 'Whether to trigger a verification immediately after the rules attribute is changed'
},
mode: ['pc', 'mobile', 'mobile-first'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<template>
<div>
<tiny-button @click="changModdeFn" type="primary">当前为 {{ flag }} 模式</tiny-button>
<tiny-button @click="changFn">双层抽屉 </tiny-button>
<tiny-dialog-box
:visible="boxVisibility"
right-slide
@update:visible="boxVisibility = $event"
title="父弹窗"
width="30%"
:custom-style="customStyle1"
>
<span>父弹窗内容</span>
<tiny-dialog-box
append-to-body
right-slide
:modal="false"
:close-on-click-modal="false"
no-animation
:visible="boxVisibility2"
:custom-style="customStyle2"
@close="dialogClose"
@update:visible="boxVisibility2 = $event"
title="子弹窗"
width="300px"
>
<span>子弹窗内容</span>
<template #footer>
<tiny-button type="primary" @click="boxVisibility2 = false"> 确定 </tiny-button>
</template>
</tiny-dialog-box>
<template #footer>
<tiny-button @click="boxVisibility = false">取消</tiny-button>
<tiny-button type="primary" @click="openDialog"> 子弹窗 </tiny-button>
</template>
</tiny-dialog-box>
</div>
</template>

<script>
import { Button, DialogBox } from '@opentiny/vue'
export default {
components: {
TinyButton: Button,
TinyDialogBox: DialogBox
},
data() {
return {
flag: 'auto',
boxVisibility: false,
customStyle1: {},
customStyle2: {},
boxVisibility2: false
}
},
methods: {
changFn() {
this.boxVisibility = true
},
changModdeFn() {
this.flag = this.flag === 'full' ? 'auto' : 'full'
},
openDialog() {
if (this.flag === 'full') {
this.customStyle1 = {
right: '8px',
bottom: '8px',
top: '8px',
height: 'auto',
borderRadius: '8px',
transition: 'right 0.2s ease-in-out'
}
this.customStyle2 = {
bottom: '8px',
top: '8px',
height: 'auto',
borderRadius: '8px',
opacity: 0
}
const rightW = document.body.offsetWidth * 0.3
this.customStyle1.right = -rightW + 80 + 'px'
this.customStyle2.right = rightW + 'px'
this.customStyle2.transition = 'right 200ms ease-in-out opacity 100ms linear'
this.boxVisibility2 = true
setTimeout(() => {
this.customStyle2.right = '85px'
}, 10)
setTimeout(() => {
this.customStyle2.opacity = 1
}, 100)
} else {
this.customStyle1 = {
right: '8px',
bottom: '8px',
top: '8px',
height: 'auto',
borderRadius: '8px',
transition: 'right 0.2s ease-in-out'
}
this.customStyle2 = {
bottom: '8px',
top: 'unset',
height: 'auto',
borderRadius: '8px',
opacity: 0
}
const rightW = document.body.offsetWidth * 0.3
this.customStyle2.right = rightW + 46 + 'px'
this.customStyle2.transition = 'opacity 100ms linear'
this.boxVisibility2 = true
setTimeout(() => {
this.customStyle2.opacity = 1
}, 100)
}
},
dialogClose() {
setTimeout(() => {
this.customStyle1.right = '8px'
this.customStyle2.opacity = 0
}, 50)
}
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ export default {
'en-US': '<p>code>default</code>: content default slot. <code>footer</code>: bottom slot</p>'
},
codeFiles: ['dialog-slot.vue']
},
{
demoId: 'double-dialog-height',
name: {
'zh-CN': '右侧双层弹框',
'en-US': 'Double-layer dialog box on the right'
},
desc: {
'zh-CN': '右侧弹窗分两种情况,父级弹框自动缩进,子级弹框高度撑满。父级弹框不缩进,子级弹框高度自适应。',
'en-US':
'There are two types of pop-up windows on the right. The parent pop-up boxes are automatically indented, and the child pop-up boxes are full. The parent dialog box is not indented, and the height of the child dialog box is adaptive.'
},
codeFiles: ['double-dialog-height.vue']
}
]
}
19 changes: 19 additions & 0 deletions examples/sites/demos/mobile-first/app/divider/basic-usage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div>
<p>基础使用</p>
<tiny-divider> </tiny-divider>
<br />
<p>带文本分割线</p>
<tiny-divider> 分割线 </tiny-divider>
</div>
</template>

<script>
import { Divider } from '@opentiny/vue'
export default {
components: {
TinyDivider: Divider
}
}
</script>
17 changes: 17 additions & 0 deletions examples/sites/demos/mobile-first/app/divider/color.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div>
<tiny-divider color="#55ccd9"></tiny-divider>
<br />
<tiny-divider color="#eb74df"> 分割线 </tiny-divider>
</div>
</template>

<script>
import { Divider } from '@opentiny/vue'
export default {
components: {
TinyDivider: Divider
}
}
</script>
17 changes: 17 additions & 0 deletions examples/sites/demos/mobile-first/app/divider/content-position.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div>
<tiny-divider> 分割线 </tiny-divider>
<tiny-divider content-position="left"> 分割线 </tiny-divider>
<tiny-divider content-position="right"> 分割线 </tiny-divider>
</div>
</template>

<script>
import { Divider } from '@opentiny/vue'
export default {
components: {
TinyDivider: Divider
}
}
</script>
Loading

0 comments on commit eaa9e72

Please sign in to comment.