@opentiny/vue-docs 3.26.7 → 3.27.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/demos/apis/base-select.js +13 -0
- package/demos/apis/calendar-view.js +12 -0
- package/demos/apis/color-picker.js +16 -0
- package/demos/apis/color-select-panel.js +14 -0
- package/demos/apis/config-provider.js +2 -1
- package/demos/apis/date-picker.js +52 -0
- package/demos/apis/dialog-box.js +16 -4
- package/demos/apis/drawer.js +22 -0
- package/demos/apis/exception.js +43 -27
- package/demos/apis/grid.js +38 -3
- package/demos/apis/guide.js +14 -0
- package/demos/apis/pager.js +3 -3
- package/demos/apis/query-builder.js +346 -1
- package/demos/apis/select.js +41 -0
- package/demos/apis/space.js +99 -0
- package/demos/apis/steps.js +15 -0
- package/demos/apis/time-picker.js +28 -0
- package/demos/apis/time-select.js +30 -0
- package/demos/apis/tree-menu.js +14 -0
- package/demos/mobile-first/app/calendar-view/basic-usage.vue +1 -1
- package/demos/mobile-first/app/exception/webdoc/exception.js +4 -4
- package/demos/mobile-first/app/load-list/webdoc/load-list.en.md +1 -1
- package/demos/mobile-first/app/space/basic-usage-composition-api.vue +41 -0
- package/demos/mobile-first/app/space/basic-usage.spec.ts +37 -0
- package/demos/mobile-first/app/space/basic-usage.vue +37 -0
- package/demos/mobile-first/app/space/space-align-composition-api.vue +37 -0
- package/demos/mobile-first/app/space/space-align.spec.ts +24 -0
- package/demos/mobile-first/app/space/space-align.vue +37 -0
- package/demos/mobile-first/app/space/space-direction-composition-api.vue +32 -0
- package/demos/mobile-first/app/space/space-direction.spec.ts +17 -0
- package/demos/mobile-first/app/space/space-direction.vue +32 -0
- package/demos/mobile-first/app/space/space-justify-composition-api.vue +44 -0
- package/demos/mobile-first/app/space/space-justify.spec.ts +18 -0
- package/demos/mobile-first/app/space/space-justify.vue +39 -0
- package/demos/mobile-first/app/space/space-order-composition-api.vue +14 -0
- package/demos/mobile-first/app/space/space-order.spec.ts +13 -0
- package/demos/mobile-first/app/space/space-order.vue +14 -0
- package/demos/mobile-first/app/space/space-size-composition-api.vue +39 -0
- package/demos/mobile-first/app/space/space-size.spec.ts +37 -0
- package/demos/mobile-first/app/space/space-size.vue +39 -0
- package/demos/mobile-first/app/space/space-wrap-composition-api.vue +31 -0
- package/demos/mobile-first/app/space/space-wrap.spec.ts +25 -0
- package/demos/mobile-first/app/space/space-wrap.vue +31 -0
- package/demos/mobile-first/app/space/webdoc/space.cn.md +9 -0
- package/demos/mobile-first/app/space/webdoc/space.en.md +9 -0
- package/demos/mobile-first/app/space/webdoc/space.js +98 -0
- package/demos/mobile-first/menus.js +3 -1
- package/demos/pc/app/calendar-view/basic-usage-composition-api.vue +1 -1
- package/demos/pc/app/calendar-view/basic-usage.vue +1 -1
- package/demos/pc/app/carousel/webdoc/carousel.js +2 -1
- package/demos/pc/app/color-picker/linear-gradient-composition-api.vue +20 -0
- package/demos/pc/app/color-picker/linear-gradient.spec.ts +10 -0
- package/demos/pc/app/color-picker/linear-gradient.vue +28 -0
- package/demos/pc/app/color-picker/webdoc/color-picker.js +27 -0
- package/demos/pc/app/color-select-panel/linear-gradient-composition-api.vue +38 -0
- package/demos/pc/app/color-select-panel/linear-gradient.spec.ts +71 -0
- package/demos/pc/app/color-select-panel/linear-gradient.vue +45 -0
- package/demos/pc/app/color-select-panel/webdoc/color-select-panel.js +12 -0
- package/demos/pc/app/config-provider/webdoc/config-provider.js +2 -1
- package/demos/pc/app/date-panel/basic-usage.vue +19 -8
- package/demos/pc/app/date-panel/custom-weeks.vue +19 -9
- package/demos/pc/app/date-panel/disabled-date.vue +29 -19
- package/demos/pc/app/date-panel/event.vue +38 -31
- package/demos/pc/app/date-panel/format.vue +15 -5
- package/demos/pc/app/date-panel/readonly.vue +19 -8
- package/demos/pc/app/date-panel/shortcuts.vue +182 -176
- package/demos/pc/app/date-panel/unlink-panels.vue +15 -5
- package/demos/pc/app/date-picker/now-composition-api.vue +4 -1
- package/demos/pc/app/date-picker/now.vue +6 -2
- package/demos/pc/app/date-picker/slot-composition-api.vue +112 -0
- package/demos/pc/app/date-picker/slot.spec.ts +41 -0
- package/demos/pc/app/date-picker/slot.vue +119 -0
- package/demos/pc/app/date-picker/webdoc/date-picker.js +12 -0
- package/demos/pc/app/dialog-box/before-close-composition-api.vue +65 -0
- package/demos/pc/app/dialog-box/before-close.spec.ts +6 -0
- package/demos/pc/app/dialog-box/before-close.vue +71 -0
- package/demos/pc/app/dialog-box/webdoc/dialog-box.js +16 -0
- package/demos/pc/app/dialog-select/nest-tree-single.spec.ts +4 -7
- package/demos/pc/app/drawer/webdoc/drawer.js +2 -1
- package/demos/pc/app/exception/basic-usage-composition-api.vue +15 -0
- package/demos/pc/app/exception/basic-usage.vue +21 -0
- package/demos/pc/app/exception/button-text-composition-api.vue +13 -0
- package/demos/pc/app/exception/button-text.vue +21 -0
- package/demos/pc/app/exception/component-page-composition-api.vue +44 -0
- package/demos/pc/app/exception/component-page.vue +55 -0
- package/demos/pc/app/exception/page-empty-composition-api.vue +7 -0
- package/demos/pc/app/exception/page-empty.vue +13 -0
- package/demos/pc/app/exception/slot-composition-api.vue +29 -0
- package/demos/pc/app/exception/slot.vue +23 -0
- package/demos/pc/app/exception/sub-message-composition-api.vue +7 -0
- package/demos/pc/app/exception/sub-message.vue +13 -0
- package/demos/pc/app/exception/webdoc/exception.cn.md +5 -0
- package/demos/pc/app/exception/webdoc/exception.en.md +5 -0
- package/demos/pc/app/exception/webdoc/exception.js +84 -0
- package/demos/pc/app/grid/custom/default-customs-composition-api.vue +66 -0
- package/demos/pc/app/grid/custom/default-customs.spec.ts +9 -0
- package/demos/pc/app/grid/custom/default-customs.vue +75 -0
- package/demos/pc/app/grid/mouse-keyboard/mouse-config-hover-composition-api.vue +70 -0
- package/demos/pc/app/grid/mouse-keyboard/mouse-config-hover.vue +79 -0
- package/demos/pc/app/grid/validation/highlight-error-composition-api.vue +183 -0
- package/demos/pc/app/grid/validation/highlight-error.vue +192 -0
- package/demos/pc/app/grid/webdoc/grid-custom.js +11 -0
- package/demos/pc/app/grid/webdoc/grid-editor.js +2 -2
- package/demos/pc/app/grid/webdoc/grid-mouse-keyboard.js +9 -0
- package/demos/pc/app/grid/webdoc/grid-validation.js +9 -0
- package/demos/pc/app/guide/mask-composition-api.vue +31 -0
- package/demos/pc/app/guide/mask.spec.ts +13 -0
- package/demos/pc/app/guide/mask.vue +41 -0
- package/demos/pc/app/guide/webdoc/guide.js +12 -0
- package/demos/pc/app/input/resize.spec.ts +1 -1
- package/demos/pc/app/notify/manual-close-composition-api.vue +9 -11
- package/demos/pc/app/notify/manual-close.spec.ts +1 -1
- package/demos/pc/app/notify/manual-close.vue +9 -11
- package/demos/pc/app/notify/verticalOffset.spec.ts +3 -1
- package/demos/pc/app/query-builder/handle.vue +558 -0
- package/demos/pc/app/query-builder/limit.vue +555 -0
- package/demos/pc/app/query-builder/webdoc/query-builder.js +29 -1
- package/demos/pc/app/radio/dynamic-disable.vue +1 -1
- package/demos/pc/app/space/basic-usage-composition-api.vue +41 -0
- package/demos/pc/app/space/basic-usage.spec.ts +37 -0
- package/demos/pc/app/space/basic-usage.vue +37 -0
- package/demos/pc/app/space/space-align-composition-api.vue +37 -0
- package/demos/pc/app/space/space-align.spec.ts +24 -0
- package/demos/pc/app/space/space-align.vue +37 -0
- package/demos/pc/app/space/space-direction-composition-api.vue +32 -0
- package/demos/pc/app/space/space-direction.spec.ts +17 -0
- package/demos/pc/app/space/space-direction.vue +32 -0
- package/demos/pc/app/space/space-justify-composition-api.vue +44 -0
- package/demos/pc/app/space/space-justify.spec.ts +18 -0
- package/demos/pc/app/space/space-justify.vue +39 -0
- package/demos/pc/app/space/space-order-composition-api.vue +14 -0
- package/demos/pc/app/space/space-order.spec.ts +13 -0
- package/demos/pc/app/space/space-order.vue +14 -0
- package/demos/pc/app/space/space-size-composition-api.vue +39 -0
- package/demos/pc/app/space/space-size.spec.ts +37 -0
- package/demos/pc/app/space/space-size.vue +39 -0
- package/demos/pc/app/space/space-wrap-composition-api.vue +31 -0
- package/demos/pc/app/space/space-wrap.spec.ts +25 -0
- package/demos/pc/app/space/space-wrap.vue +31 -0
- package/demos/pc/app/space/webdoc/space.cn.md +9 -0
- package/demos/pc/app/space/webdoc/space.en.md +9 -0
- package/demos/pc/app/space/webdoc/space.js +98 -0
- package/demos/pc/app/steps/slot-icon-composition-api.vue +46 -0
- package/demos/pc/app/steps/slot-icon.vue +54 -0
- package/demos/pc/app/steps/webdoc/steps.js +12 -0
- package/demos/pc/app/tree-menu/events-composition-api.vue +4 -0
- package/demos/pc/app/tree-menu/events.vue +4 -0
- package/demos/pc/app/tree-menu/webdoc/tree-menu.js +2 -2
- package/demos/pc/app/tree-menu/with-icon-composition-api.vue +149 -24
- package/demos/pc/app/tree-menu/with-icon.spec.ts +1 -1
- package/demos/pc/app/tree-menu/with-icon.vue +149 -24
- package/demos/pc/menus.js +16 -0
- package/demos/pc/webdoc/changelog.md +209 -177
- package/env/.env.saas +1 -1
- package/env/.env.saaspages +9 -0
- package/package.json +20 -19
- package/playground/App.vue +2 -2
- package/src/App.vue +2 -1
- package/src/components/anchor.vue +20 -74
- package/src/const.ts +2 -0
- package/src/main.js +2 -5
- package/src/menus.js +2 -1
- package/src/tools/docsearch.js +3 -2
- package/src/tools/useTemplateMode.js +2 -1
- package/src/tools/useTheme.js +2 -2
- package/src/views/components-doc/cmp-config.js +2 -1
- package/src/views/components-doc/common.vue +76 -12
- /package/demos/pc/app/user/{nodata-text-composition-api.vue → no-data-text-composition-api.vue} +0 -0
- /package/demos/pc/app/user/{nodata-text.vue → no-data-text.vue} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 给 space 容器加 id,方便 e2e 定位 -->
|
|
3
|
+
<div id="space-basic-usage">
|
|
4
|
+
<!-- 方向按钮 -->
|
|
5
|
+
<tiny-button type="primary" @click="setDirection('row')">行</tiny-button>
|
|
6
|
+
<tiny-button type="success" @click="setDirection('column')">列</tiny-button>
|
|
7
|
+
|
|
8
|
+
<!-- 间距按钮 -->
|
|
9
|
+
<div style="margin: 10px 0">
|
|
10
|
+
<tiny-button @click="value += 5">增加间距 +5</tiny-button>
|
|
11
|
+
<tiny-button @click="value -= 5">减少间距 -5</tiny-button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<!-- 在 tiny-space 上加一个 class,保证 E2E 稳定 -->
|
|
15
|
+
<tiny-space class="tiny-space" :size="value" :direction="direction">
|
|
16
|
+
<tiny-button style="margin: 0" v-for="n in 3" :key="n">按钮 {{ n }}</tiny-button>
|
|
17
|
+
</tiny-space>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
components: {
|
|
26
|
+
TinySpace,
|
|
27
|
+
TinyButton
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
value: 10, // 初始间距
|
|
32
|
+
direction: 'column' // 初始方向为 column
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
setDirection(direction) {
|
|
37
|
+
this.direction = direction
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space Basic Demo - direction & size (按钮版)', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-basic-usage')
|
|
5
|
+
|
|
6
|
+
const space = page.locator('#space-basic-usage .tiny-space')
|
|
7
|
+
await space.waitFor({ state: 'visible', timeout: 5000 })
|
|
8
|
+
|
|
9
|
+
const getGap = async () =>
|
|
10
|
+
await space.evaluate((el) => {
|
|
11
|
+
const style = getComputedStyle(el)
|
|
12
|
+
return style.gap || '0px'
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const getFlexDirection = async () => await space.evaluate((el) => getComputedStyle(el).flexDirection)
|
|
16
|
+
|
|
17
|
+
// 初始状态检查
|
|
18
|
+
expect(await getFlexDirection()).toBe('column')
|
|
19
|
+
expect(await getGap()).toBe('10px')
|
|
20
|
+
|
|
21
|
+
// 点击“行”按钮 -> flex-direction 应变成 row
|
|
22
|
+
const rowButton = page.locator('#space-basic-usage .tiny-button', { hasText: '行' })
|
|
23
|
+
await rowButton.click()
|
|
24
|
+
expect(await getFlexDirection()).toBe('row')
|
|
25
|
+
|
|
26
|
+
// 点击增加间距按钮 -> gap 应变成 15px
|
|
27
|
+
const increaseGap = page.locator('#space-basic-usage .tiny-button', { hasText: '增加间距 +5' })
|
|
28
|
+
await increaseGap.click()
|
|
29
|
+
await page.waitForTimeout(50) // 等待 DOM 更新
|
|
30
|
+
expect(await getGap()).toBe('15px')
|
|
31
|
+
|
|
32
|
+
// 点击减少间距按钮 -> gap 应变回 10px
|
|
33
|
+
const decreaseGap = page.locator('#space-basic-usage .tiny-button', { hasText: '减少间距 -5' })
|
|
34
|
+
await decreaseGap.click()
|
|
35
|
+
await page.waitForTimeout(50)
|
|
36
|
+
expect(await getGap()).toBe('10px')
|
|
37
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 给 space 容器加 id,方便 e2e 定位 -->
|
|
3
|
+
<div>
|
|
4
|
+
<tiny-button type="primary" @click="setDirection('row')">行</tiny-button>
|
|
5
|
+
<tiny-button type="success" @click="setDirection('column')">列</tiny-button>
|
|
6
|
+
|
|
7
|
+
<tiny-slider v-model="value" :min="0" :max="50" :step="2" style="width: 300px; margin-bottom: 20px" />
|
|
8
|
+
|
|
9
|
+
<!-- 在 tiny-space 上加一个 class,保证 E2E 稳定 -->
|
|
10
|
+
<tiny-space class="tiny-space" :size="value" :direction="direction">
|
|
11
|
+
<tiny-button style="margin: 0" v-for="n in 3" :key="n">按钮 {{ n }}</tiny-button>
|
|
12
|
+
</tiny-space>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { TinyButton, TinySpace, TinySlider } from '@opentiny/vue'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
components: {
|
|
21
|
+
TinySpace,
|
|
22
|
+
TinyButton,
|
|
23
|
+
TinySlider
|
|
24
|
+
},
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
value: 10, // slider 的值
|
|
28
|
+
direction: 'column' // 初始方向为 column
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
setDirection(direction) {
|
|
33
|
+
this.direction = direction
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="space-align" style="display: flex; flex-direction: column; justify-content: space-around">
|
|
3
|
+
<strong>当前 align: {{ alignValue }}</strong>
|
|
4
|
+
<tiny-space direction="row" size="4" style="margin-bottom: 10px">
|
|
5
|
+
<tiny-button style="margin: 0" v-for="val in alignOptions" :key="val" @click="setAlign(val)">
|
|
6
|
+
{{ val }}
|
|
7
|
+
</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
<tiny-space class="tiny-space" :align="alignValue" style="border: 1px dashed #ccc">
|
|
10
|
+
<tiny-button style="margin: 0">button</tiny-button>
|
|
11
|
+
<tiny-button style="height: 60px; margin: 0">高按钮</tiny-button>
|
|
12
|
+
</tiny-space>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
components: {
|
|
21
|
+
TinyButton,
|
|
22
|
+
TinySpace
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
const alignOptions = ['start', 'center', 'end', 'baseline', 'stretch']
|
|
26
|
+
return {
|
|
27
|
+
alignValue: 'start',
|
|
28
|
+
alignOptions
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
setAlign(val: string) {
|
|
33
|
+
this.alignValue = val
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space align 属性', async ({ page }) => {
|
|
4
|
+
// 跳转到 align 示例
|
|
5
|
+
await page.goto('space#space-align')
|
|
6
|
+
|
|
7
|
+
// 定位 tiny-space 容器
|
|
8
|
+
const wrap = page.locator('#space-align .tiny-space')
|
|
9
|
+
|
|
10
|
+
// 初始 align 为 start
|
|
11
|
+
let alignItems = await wrap.evaluate((el) => getComputedStyle(el).alignItems)
|
|
12
|
+
expect(alignItems).toBe('start') // 注意这里用 start 而不是 flex-start
|
|
13
|
+
|
|
14
|
+
// 点击按钮修改 align 为 center
|
|
15
|
+
await page.getByRole('button', { name: 'center', exact: true }).click()
|
|
16
|
+
|
|
17
|
+
// 检查 align 是否更新
|
|
18
|
+
alignItems = await wrap.evaluate((el) => getComputedStyle(el).alignItems)
|
|
19
|
+
expect(alignItems).toBe('center')
|
|
20
|
+
|
|
21
|
+
// 检查子元素数量
|
|
22
|
+
const items = wrap.locator('.tiny-button')
|
|
23
|
+
await expect(items).toHaveCount(2)
|
|
24
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="display: flex; flex-direction: column; justify-content: space-around">
|
|
3
|
+
<strong>当前 align: {{ alignValue }}</strong>
|
|
4
|
+
<tiny-space direction="row" size="4" style="margin-bottom: 10px">
|
|
5
|
+
<tiny-button style="margin: 0" v-for="val in alignOptions" :key="val" @click="setAlign(val)">
|
|
6
|
+
{{ val }}
|
|
7
|
+
</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
<tiny-space class="tiny-space" :align="alignValue" style="border: 1px dashed #ccc">
|
|
10
|
+
<tiny-button style="margin: 0">button</tiny-button>
|
|
11
|
+
<tiny-button style="height: 60px; margin: 0">高按钮</tiny-button>
|
|
12
|
+
</tiny-space>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
components: {
|
|
21
|
+
TinyButton,
|
|
22
|
+
TinySpace
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
const alignOptions = ['start', 'center', 'end', 'baseline', 'stretch']
|
|
26
|
+
return {
|
|
27
|
+
alignValue: 'start',
|
|
28
|
+
alignOptions
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
setAlign(val: string) {
|
|
33
|
+
this.alignValue = val
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="space-direction">
|
|
3
|
+
<!-- 选择行或列的按钮 -->
|
|
4
|
+
<tiny-button type="primary" @click="setDirection('row')">行</tiny-button>
|
|
5
|
+
<tiny-button style="margin: 10px" type="success" @click="setDirection('column')">列</tiny-button>
|
|
6
|
+
|
|
7
|
+
<tiny-space class="tiny-space" :direction="direction">
|
|
8
|
+
<tiny-button style="margin: 0" v-for="n in 3" :key="n">按钮 {{ n }}</tiny-button>
|
|
9
|
+
</tiny-space>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
TinySpace,
|
|
19
|
+
TinyButton
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
direction: 'column' // 初始方向为 column
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
setDirection(direction) {
|
|
28
|
+
this.direction = direction
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space direction 属性', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-direction')
|
|
5
|
+
|
|
6
|
+
const wrap = page.locator('#space-direction .tiny-space')
|
|
7
|
+
|
|
8
|
+
// 获取实际渲染的 flex-direction
|
|
9
|
+
const getFlexDirection = async () => wrap.evaluate((el) => getComputedStyle(el).flexDirection)
|
|
10
|
+
|
|
11
|
+
// 验证 flex-direction 是否为 column
|
|
12
|
+
expect(await getFlexDirection()).toBe('column')
|
|
13
|
+
|
|
14
|
+
// 检查子元素数量
|
|
15
|
+
const items = wrap.locator('.tiny-button')
|
|
16
|
+
await expect(items).toHaveCount(3)
|
|
17
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- 选择行或列的按钮 -->
|
|
4
|
+
<tiny-button type="primary" @click="setDirection('row')">行</tiny-button>
|
|
5
|
+
<tiny-button style="margin: 10px" type="success" @click="setDirection('column')">列</tiny-button>
|
|
6
|
+
|
|
7
|
+
<tiny-space class="tiny-space" :direction="direction">
|
|
8
|
+
<tiny-button style="margin: 0" v-for="n in 3" :key="n">按钮 {{ n }}</tiny-button>
|
|
9
|
+
</tiny-space>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
TinySpace,
|
|
19
|
+
TinyButton
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
direction: 'column' // 初始方向为 column
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
setDirection(direction) {
|
|
28
|
+
this.direction = direction
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="space-justify" style="margin-bottom: 16px">
|
|
3
|
+
<strong>当前 justify: {{ justifyValue }}</strong>
|
|
4
|
+
<tiny-space direction="row" size="4" style="margin-bottom: 10px">
|
|
5
|
+
<tiny-button v-for="val in justifyOptions" :key="val" @click="setJustify(val)">
|
|
6
|
+
{{ val }}
|
|
7
|
+
</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
|
|
10
|
+
<tiny-space
|
|
11
|
+
class="tiny-space"
|
|
12
|
+
direction="row"
|
|
13
|
+
:justify="justifyValue"
|
|
14
|
+
style="border: 1px dashed #ccc; padding: 8px"
|
|
15
|
+
>
|
|
16
|
+
<tiny-button>按钮 1</tiny-button>
|
|
17
|
+
<tiny-button>按钮 2</tiny-button>
|
|
18
|
+
<tiny-button>按钮 3</tiny-button>
|
|
19
|
+
</tiny-space>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
components: {
|
|
28
|
+
TinyButton,
|
|
29
|
+
TinySpace
|
|
30
|
+
},
|
|
31
|
+
data() {
|
|
32
|
+
const justifyOptions = ['start', 'center', 'end', 'space-around', 'space-between', 'space-evenly']
|
|
33
|
+
return {
|
|
34
|
+
justifyValue: 'start',
|
|
35
|
+
justifyOptions
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
setJustify(val: string) {
|
|
40
|
+
this.justifyValue = val
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space justify 属性', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-justify')
|
|
5
|
+
|
|
6
|
+
const space = page.locator('#space-justify .tiny-space')
|
|
7
|
+
|
|
8
|
+
// 初始值为 start
|
|
9
|
+
await expect(space).toHaveAttribute('style', /justify-content:\s*(flex-start|start)/)
|
|
10
|
+
|
|
11
|
+
// 切换到 space-between
|
|
12
|
+
await page.getByRole('button', { name: 'space-between' }).click()
|
|
13
|
+
await expect(space).toHaveAttribute('style', /justify-content:\s*space-between/)
|
|
14
|
+
|
|
15
|
+
// 再切换到 center
|
|
16
|
+
await page.getByRole('button', { name: 'center' }).click()
|
|
17
|
+
await expect(space).toHaveAttribute('style', /justify-content:\s*center/)
|
|
18
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="margin-bottom: 16px">
|
|
3
|
+
<strong>当前 justify: {{ justifyValue }}</strong>
|
|
4
|
+
<tiny-space direction="row" size="4" style="margin-bottom: 10px">
|
|
5
|
+
<tiny-button v-for="val in justifyOptions" :key="val" @click="setJustify(val)">
|
|
6
|
+
{{ val }}
|
|
7
|
+
</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
|
|
10
|
+
<tiny-space direction="row" :justify="justifyValue" style="border: 1px dashed #ccc; padding: 8px">
|
|
11
|
+
<tiny-button>按钮 1</tiny-button>
|
|
12
|
+
<tiny-button>按钮 2</tiny-button>
|
|
13
|
+
<tiny-button>按钮 3</tiny-button>
|
|
14
|
+
</tiny-space>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
components: {
|
|
23
|
+
TinyButton,
|
|
24
|
+
TinySpace
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
const justifyOptions = ['start', 'center', 'end', 'space-around', 'space-between', 'space-evenly']
|
|
28
|
+
return {
|
|
29
|
+
justifyValue: 'start',
|
|
30
|
+
justifyOptions
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
setJustify(val: string) {
|
|
35
|
+
this.justifyValue = val
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tiny-space id="space-order" :order="order" style="border: 1px dashed #ccc">
|
|
3
|
+
<tiny-button key="1">First Button</tiny-button>
|
|
4
|
+
<tiny-button key="2">Second Button</tiny-button>
|
|
5
|
+
<tiny-button key="3">Third Button</tiny-button>
|
|
6
|
+
<tiny-button>Fourth Button</tiny-button>
|
|
7
|
+
</tiny-space>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
12
|
+
|
|
13
|
+
const order = ['2', '3', '1'] // 自定义顺序:第二个、第三个、然后第一个
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space order 属性', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-order')
|
|
5
|
+
|
|
6
|
+
const buttons = page.locator('#space-order .tiny-button')
|
|
7
|
+
|
|
8
|
+
// 检查顺序是否符合 order=['2','3','1']
|
|
9
|
+
await expect(buttons.nth(0)).toHaveText('Second Button')
|
|
10
|
+
await expect(buttons.nth(1)).toHaveText('Third Button')
|
|
11
|
+
await expect(buttons.nth(2)).toHaveText('First Button')
|
|
12
|
+
await expect(buttons.nth(3)).toHaveText('Fourth Button')
|
|
13
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tiny-space :order="order" style="border: 1px dashed #ccc">
|
|
3
|
+
<tiny-button key="1">First Button</tiny-button>
|
|
4
|
+
<tiny-button key="2">Second Button</tiny-button>
|
|
5
|
+
<tiny-button key="3">Third Button</tiny-button>
|
|
6
|
+
<tiny-button>Fourth Button</tiny-button>
|
|
7
|
+
</tiny-space>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
12
|
+
|
|
13
|
+
const order = ['2', '3', '1'] // 自定义顺序:第二个、第三个、然后第一个
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="space-size">
|
|
3
|
+
<!-- 显示当前间距 -->
|
|
4
|
+
<div>
|
|
5
|
+
<strong>当前间距: [{{ rowValue }}, {{ columnValue }}]</strong>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<!-- 行间距操作按钮 -->
|
|
9
|
+
<div>
|
|
10
|
+
<tiny-button id="increase-row" @click="rowValue += 5">增加行间距 +5</tiny-button>
|
|
11
|
+
<tiny-button id="decrease-row" @click="rowValue -= 5">减少行间距 -5</tiny-button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<!-- 列间距操作按钮 -->
|
|
15
|
+
<div>
|
|
16
|
+
<tiny-button id="increase-column" @click="columnValue += 5">增加列间距 +5</tiny-button>
|
|
17
|
+
<tiny-button id="decrease-column" @click="columnValue -= 5">减少列间距 -5</tiny-button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- tiny-space 容器 -->
|
|
21
|
+
<tiny-space class="tiny-space" :size="[rowValue, columnValue]" :wrap="true">
|
|
22
|
+
<tiny-button v-for="n in 15" :key="n">按钮 {{ n }}</tiny-button>
|
|
23
|
+
</tiny-space>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
components: { TinyButton, TinySpace },
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
rowValue: 10,
|
|
35
|
+
columnValue: 10
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space size 动态调整(按钮版)', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-size')
|
|
5
|
+
|
|
6
|
+
const space = page.locator('#space-size .tiny-space')
|
|
7
|
+
await space.waitFor({ state: 'visible', timeout: 5000 })
|
|
8
|
+
|
|
9
|
+
const getGap = async () =>
|
|
10
|
+
await space.evaluate((el) => {
|
|
11
|
+
const style = getComputedStyle(el)
|
|
12
|
+
return `${style.rowGap || style.gap} ${style.columnGap || style.gap}`
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
// 初始值检查
|
|
16
|
+
expect(await getGap()).toBe('10px 10px')
|
|
17
|
+
|
|
18
|
+
// 点击增加行间距按钮
|
|
19
|
+
await page.locator('#increase-row').click()
|
|
20
|
+
await page.waitForTimeout(50)
|
|
21
|
+
expect(await getGap()).toBe('10px 15px') // 行间距对应 rowGap,列间距对应 columnGap
|
|
22
|
+
|
|
23
|
+
// 点击增加列间距按钮
|
|
24
|
+
await page.locator('#increase-column').click()
|
|
25
|
+
await page.waitForTimeout(50)
|
|
26
|
+
expect(await getGap()).toBe('15px 15px')
|
|
27
|
+
|
|
28
|
+
// 点击减少行间距按钮
|
|
29
|
+
await page.locator('#decrease-row').click()
|
|
30
|
+
await page.waitForTimeout(50)
|
|
31
|
+
expect(await getGap()).toBe('15px 10px')
|
|
32
|
+
|
|
33
|
+
// 点击减少列间距按钮
|
|
34
|
+
await page.locator('#decrease-column').click()
|
|
35
|
+
await page.waitForTimeout(50)
|
|
36
|
+
expect(await getGap()).toBe('10px 10px')
|
|
37
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- 选择行或列的按钮 -->
|
|
4
|
+
<div>
|
|
5
|
+
<strong>当前 间距: [{{ rowValue }}, {{ columnValue }}]</strong>
|
|
6
|
+
</div>
|
|
7
|
+
<div>
|
|
8
|
+
<tiny-button type="primary">行</tiny-button>
|
|
9
|
+
<tiny-slider v-model="rowValue" :min="0" :max="50" :step="2" style="width: 300px; margin-bottom: 20px" />
|
|
10
|
+
</div>
|
|
11
|
+
<div>
|
|
12
|
+
<tiny-button type="success">列</tiny-button>
|
|
13
|
+
<tiny-slider v-model="columnValue" :min="0" :max="50" :step="2" style="width: 300px; margin-bottom: 20px" />
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<!-- 使用 dynamic direction 值 -->
|
|
17
|
+
<tiny-space class="tiny-space" :size="[rowValue, columnValue]" :wrap="true">
|
|
18
|
+
<tiny-button style="margin: 0" v-for="n in 15" :key="n">按钮 {{ n }}</tiny-button>
|
|
19
|
+
</tiny-space>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { TinyButton, TinySpace, TinySlider } from '@opentiny/vue'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
components: {
|
|
28
|
+
TinySpace,
|
|
29
|
+
TinyButton,
|
|
30
|
+
TinySlider
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
rowValue: 10,
|
|
35
|
+
columnValue: 10
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="space-wrap">
|
|
3
|
+
<!-- 选择行或列的按钮 -->
|
|
4
|
+
<tiny-button type="primary" @click="setWrap(true)">换行</tiny-button>
|
|
5
|
+
<tiny-button type="success" style="margin: 10px" @click="setWrap(false)">不换行</tiny-button>
|
|
6
|
+
<tiny-space class="tiny-space" :size="12" :wrap="wrapValue">
|
|
7
|
+
<tiny-button style="margin: 0" v-for="n in 10" :key="n">按钮 {{ n }}</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
components: {
|
|
17
|
+
TinySpace,
|
|
18
|
+
TinyButton
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
wrapValue: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
setWrap(val: boolean) {
|
|
27
|
+
this.wrapValue = val
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('Space wrap 切换', async ({ page }) => {
|
|
4
|
+
await page.goto('space#space-wrap')
|
|
5
|
+
|
|
6
|
+
const space = page.locator('#space-wrap .tiny-space')
|
|
7
|
+
|
|
8
|
+
// 工具函数:获取当前 flex-wrap
|
|
9
|
+
const getFlexWrap = async () => {
|
|
10
|
+
return await space.evaluate((el) => getComputedStyle(el).flexWrap)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 默认不换行
|
|
14
|
+
expect(await getFlexWrap()).toBe('nowrap')
|
|
15
|
+
|
|
16
|
+
// 点击“换行”按钮,使用 exact:true 避免严格模式报错
|
|
17
|
+
const wrapButton = page.getByRole('button', { name: '换行', exact: true })
|
|
18
|
+
await wrapButton.click()
|
|
19
|
+
expect(await getFlexWrap()).toBe('wrap')
|
|
20
|
+
|
|
21
|
+
// 点击“不换行”按钮
|
|
22
|
+
const nowrapButton = page.getByRole('button', { name: '不换行', exact: true })
|
|
23
|
+
await nowrapButton.click()
|
|
24
|
+
expect(await getFlexWrap()).toBe('nowrap')
|
|
25
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- 选择行或列的按钮 -->
|
|
4
|
+
<tiny-button type="primary" @click="setWrap(true)">换行</tiny-button>
|
|
5
|
+
<tiny-button type="success" style="margin: 10px" @click="setWrap(false)">不换行</tiny-button>
|
|
6
|
+
<tiny-space :size="12" :wrap="wrapValue">
|
|
7
|
+
<tiny-button style="margin: 0" v-for="n in 10" :key="n">按钮 {{ n }}</tiny-button>
|
|
8
|
+
</tiny-space>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { TinyButton, TinySpace } from '@opentiny/vue'
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
components: {
|
|
17
|
+
TinySpace,
|
|
18
|
+
TinyButton
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
wrapValue: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
setWrap(val: boolean) {
|
|
27
|
+
this.wrapValue = val
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|