@opentiny/vue-docs 3.28.0 → 3.30.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/action-menu.js +22 -0
- package/demos/apis/alert.js +19 -22
- package/demos/apis/button-group.js +15 -0
- package/demos/apis/calendar-view.js +5 -5
- package/demos/apis/cascader-view.js +5 -5
- package/demos/apis/dialog-box.js +39 -38
- package/demos/apis/drawer.js +31 -0
- package/demos/apis/dropdown.js +39 -1
- package/demos/apis/filter-panel.js +21 -1
- package/demos/apis/fluent-editor.js +30 -0
- package/demos/apis/form.js +11 -0
- package/demos/apis/fullscreen.js +10 -11
- package/demos/apis/grid.js +131 -16
- package/demos/apis/guide.js +14 -0
- package/demos/apis/link.js +11 -0
- package/demos/apis/message.js +48 -22
- package/demos/apis/modal.js +34 -31
- package/demos/apis/notify.js +13 -13
- package/demos/apis/rate.js +15 -0
- package/demos/apis/search-box.js +343 -0
- package/demos/apis/select.js +14 -2
- package/demos/apis/tag-input.js +182 -0
- package/demos/apis/tree.js +23 -23
- package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
- package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
- package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
- package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
- package/demos/pc/app/alert/center.spec.ts +8 -0
- package/demos/pc/app/alert/custom-close.spec.ts +39 -9
- package/demos/pc/app/alert/icon.spec.ts +18 -7
- package/demos/pc/app/alert/show-icon.spec.ts +1 -1
- package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
- package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
- package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
- package/demos/pc/app/button-group/display-mode.vue +31 -0
- package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
- package/demos/pc/app/button-group/sup.vue +1 -0
- package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
- package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
- package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
- package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
- package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -2
- package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
- package/demos/pc/app/checkbox/checked.vue +3 -3
- package/demos/pc/app/date-picker/align.spec.ts +10 -13
- package/demos/pc/app/date-picker/clear.spec.ts +3 -3
- package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
- package/demos/pc/app/date-picker/events.spec.ts +2 -2
- package/demos/pc/app/date-picker/format.spec.ts +3 -3
- package/demos/pc/app/date-picker/now.spec.ts +4 -4
- package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
- package/demos/pc/app/date-picker/slot.spec.ts +5 -5
- package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
- package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
- package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
- package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
- package/demos/pc/app/drawer/placement.spec.ts +4 -4
- package/demos/pc/app/drawer/show-header.spec.ts +3 -2
- package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
- package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
- package/demos/pc/app/dropdown/show-icon.vue +1 -1
- package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
- package/demos/pc/app/dropdown/tip.vue +5 -2
- package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
- package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
- package/demos/pc/app/filter-panel/size.spec.ts +23 -0
- package/demos/pc/app/filter-panel/size.vue +68 -0
- package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
- package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
- package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
- package/demos/pc/app/flowchart/basic-usage.vue +4 -249
- package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
- package/demos/pc/app/flowchart/slots.spec.ts +24 -0
- package/demos/pc/app/flowchart/slots.vue +193 -0
- package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
- package/demos/pc/app/form/basic-usage.spec.ts +6 -4
- package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
- package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
- package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
- package/demos/pc/app/form/group-form-composition-api.vue +2 -2
- package/demos/pc/app/form/group-form.vue +2 -2
- package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
- package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
- package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
- package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
- package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
- package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
- package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
- package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
- package/demos/pc/app/grid/filter/default-filter.vue +4 -1
- package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
- package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
- package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
- package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
- package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
- package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
- package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
- package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
- package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
- package/demos/pc/app/guide/show-close.spec.ts +37 -0
- package/demos/pc/app/guide/show-close.vue +84 -0
- package/demos/pc/app/guide/webdoc/guide.js +12 -0
- package/demos/pc/app/icon/advance-icons.js +108 -2
- package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
- package/demos/pc/app/icon/advance-usage.vue +27 -1
- package/demos/pc/app/icon/webdoc/icon.js +5 -3
- package/demos/pc/app/input/resize.spec.ts +2 -2
- package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
- package/demos/pc/app/link/custom-icon.vue +1 -1
- package/demos/pc/app/link/target-composition-api.vue +24 -0
- package/demos/pc/app/link/target.spec.ts +41 -0
- package/demos/pc/app/link/target.vue +30 -0
- package/demos/pc/app/link/webdoc/link.js +14 -0
- package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
- package/demos/pc/app/message/basic-usage.spec.ts +27 -0
- package/demos/pc/app/message/basic-usage.vue +50 -0
- package/demos/pc/app/message/message-close-composition-api.vue +25 -0
- package/demos/pc/app/message/message-close.spec.ts +9 -0
- package/demos/pc/app/message/message-close.vue +32 -0
- package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
- package/demos/pc/app/message/message-duration.spec.ts +9 -0
- package/demos/pc/app/message/message-duration.vue +32 -0
- package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
- package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
- package/demos/pc/app/message/prevent-duplicate.vue +32 -0
- package/demos/pc/app/message/webdoc/message.cn.md +7 -0
- package/demos/pc/app/message/webdoc/message.en.md +7 -0
- package/demos/pc/app/message/webdoc/message.js +56 -0
- package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
- package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
- package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
- package/demos/pc/app/modal/modal-footer.vue +3 -3
- package/demos/pc/app/modal/modal-header.spec.ts +2 -2
- package/demos/pc/app/modal/modal-size.spec.ts +2 -2
- package/demos/pc/app/modal/status.spec.ts +22 -15
- package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
- package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
- package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
- package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
- package/demos/pc/app/popover/basic-usage.spec.js +3 -8
- package/demos/pc/app/popover/custom-popper.spec.js +2 -2
- package/demos/pc/app/popover/delay.spec.js +2 -2
- package/demos/pc/app/popover/disabled.spec.js +2 -2
- package/demos/pc/app/popover/events.spec.js +1 -1
- package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
- package/demos/pc/app/popover/offset.spec.js +17 -31
- package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
- package/demos/pc/app/radio/dynamic-disable.vue +2 -2
- package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
- package/demos/pc/app/rate/clearable.spec.js +74 -0
- package/demos/pc/app/rate/clearable.vue +28 -0
- package/demos/pc/app/rate/webdoc/rate.js +12 -0
- package/demos/pc/app/search/events.spec.ts +1 -1
- package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
- package/demos/pc/app/search-box/append-to-body.vue +308 -0
- package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
- package/demos/pc/app/search-box/auto-match.vue +170 -0
- package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
- package/demos/pc/app/search-box/basic-usage.vue +277 -0
- package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
- package/demos/pc/app/search-box/custom-panel.vue +72 -0
- package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
- package/demos/pc/app/search-box/default-field.vue +171 -0
- package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
- package/demos/pc/app/search-box/editable.vue +320 -0
- package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
- package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
- package/demos/pc/app/search-box/events-composition-api.vue +169 -0
- package/demos/pc/app/search-box/events.vue +173 -0
- package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
- package/demos/pc/app/search-box/group-key.vue +266 -0
- package/demos/pc/app/search-box/help-composition-api.vue +166 -0
- package/demos/pc/app/search-box/help.vue +175 -0
- package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
- package/demos/pc/app/search-box/id-map-key.vue +140 -0
- package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
- package/demos/pc/app/search-box/item-placeholder.vue +127 -0
- package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
- package/demos/pc/app/search-box/max-length.vue +38 -0
- package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
- package/demos/pc/app/search-box/max-time-length.vue +62 -0
- package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
- package/demos/pc/app/search-box/merge-tag.vue +68 -0
- package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
- package/demos/pc/app/search-box/panel-max-height.vue +170 -0
- package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
- package/demos/pc/app/search-box/potential-match.vue +201 -0
- package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
- package/demos/pc/app/search-box/settings.vue +171 -0
- package/demos/pc/app/search-box/size-composition-api.vue +162 -0
- package/demos/pc/app/search-box/size.vue +170 -0
- package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
- package/demos/pc/app/search-box/split-input-value.vue +170 -0
- package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
- package/demos/pc/app/search-box/suffix-icon.vue +219 -0
- package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
- package/demos/pc/app/search-box/v-model.vue +182 -0
- package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
- package/demos/pc/app/select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
- package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
- package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
- package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
- package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
- package/demos/pc/app/tabs/tooltip-composition-api.vue +1 -1
- package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
- package/demos/pc/app/tag/color-border.spec.ts +2 -2
- package/demos/pc/app/tag/max-width.spec.ts +1 -1
- package/demos/pc/app/tag/size.spec.ts +3 -3
- package/demos/pc/app/tag/slot-default.spec.ts +3 -3
- package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
- package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
- package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
- package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
- package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
- package/demos/pc/app/tag-input/basic-usage.vue +38 -0
- package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
- package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
- package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
- package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
- package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
- package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
- package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/max.vue +28 -0
- package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
- package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
- package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/separator-tag.vue +28 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
- package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
- package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
- package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
- package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
- package/demos/pc/app/time-picker/format.spec.ts +8 -11
- package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
- package/demos/pc/app/time-picker/name.spec.ts +1 -1
- package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
- package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
- package/demos/pc/app/time-picker/size.spec.ts +2 -1
- package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
- package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
- package/demos/pc/app/time-select/focus.spec.ts +1 -1
- package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
- package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
- package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
- package/demos/pc/app/tooltip/delay.spec.js +7 -9
- package/demos/pc/app/tooltip/offset.spec.js +0 -2
- package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
- package/demos/pc/app/user-head/color-composition-api.vue +2 -1
- package/demos/pc/menus.js +6 -4
- package/demos/pc/webdoc/changelog-en.md +370 -176
- package/demos/pc/webdoc/changelog.md +177 -219
- package/demos/pc/webdoc/develop-demo-en.md +13 -13
- package/demos/pc/webdoc/import-components.md +1 -1
- package/demos/pc/webdoc/introduce.md +2 -0
- package/demos/pc/webdoc/skills-en.md +107 -0
- package/demos/pc/webdoc/skills.md +107 -0
- package/demos/pc/webdoc/theme-en.md +82 -79
- package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
- package/demos/saas/menus.js +1 -0
- package/package.json +21 -20
- package/playground/App.vue +12 -6
- package/playground/shims/vue-search-box.mjs +154 -0
- package/public/static/css/mobile-dark-theme.css +1 -0
- package/src/i18n/index.js +1 -2
- package/src/main.js +8 -5
- package/src/style.css +5 -0
- package/src/views/components-doc/common.vue +0 -25
- package/src/views/components-doc/mobile.vue +49 -2
- package/vite.config.ts +3 -2
- package/vite.extend.ts +65 -0
- package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
- package/demos/pc/webdoc/mcp-en.md +0 -101
- package/demos/pc/webdoc/mcp.md +0 -101
- package/src/components/mcp-docs.vue +0 -33
- package/src/composable/useTinyRemoter.ts +0 -176
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tiny-demo">
|
|
3
|
+
<tiny-flowchart
|
|
4
|
+
ref="chart"
|
|
5
|
+
:data="chartDataRaw"
|
|
6
|
+
:config="chartConfigRaw"
|
|
7
|
+
@click-node="onClickNode"
|
|
8
|
+
@click-link="onClickLink"
|
|
9
|
+
@click-blank="onClickBlank"
|
|
10
|
+
>
|
|
11
|
+
<!-- content 插槽:下拉形式展示,收起时显示紧凑视图,点击展开显示表单列表 -->
|
|
12
|
+
<template #content="params">
|
|
13
|
+
<tiny-popover
|
|
14
|
+
placement="bottom-start"
|
|
15
|
+
trigger="manual"
|
|
16
|
+
width="220"
|
|
17
|
+
popper-class="flowchart-content-popover"
|
|
18
|
+
:visible-arrow="false"
|
|
19
|
+
:model-value="params.dropdowns[params.node.name]"
|
|
20
|
+
@update:model-value="params.dropdowns[params.node.name] = $event"
|
|
21
|
+
>
|
|
22
|
+
<template #default>
|
|
23
|
+
<div class="flowchart-content-slot">
|
|
24
|
+
<div v-for="(item, i) in params.node.info.items" :key="item.key || i" class="content-item">
|
|
25
|
+
<span class="item-name">{{ item.name }}</span>
|
|
26
|
+
<span class="item-role">{{ item.role }}</span>
|
|
27
|
+
<span class="item-status">{{ item.status }}</span>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<template #reference>
|
|
32
|
+
<div
|
|
33
|
+
class="flowchart-content-trigger"
|
|
34
|
+
:style="{ borderColor: params.config.listBorderColor }"
|
|
35
|
+
@click.stop="params.dropdowns[params.node.name] = !params.dropdowns[params.node.name]"
|
|
36
|
+
>
|
|
37
|
+
<span class="trigger-text">处理人({{ params.node.info.items.length }})</span>
|
|
38
|
+
<component :is="params.dropdowns[params.node.name] ? IconUp : IconDown" class="trigger-icon" />
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
</tiny-popover>
|
|
42
|
+
</template>
|
|
43
|
+
</tiny-flowchart>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import { TinyModal, TinyPopover, TinyFlowchart } from '@opentiny/vue'
|
|
49
|
+
import { iconChevronDown, iconChevronUp } from '@opentiny/vue-icon'
|
|
50
|
+
import { hooks } from '@opentiny/vue-common'
|
|
51
|
+
|
|
52
|
+
const { createNode, createLink, createItem, createConfig } = TinyFlowchart
|
|
53
|
+
|
|
54
|
+
const IconDown = iconChevronDown()
|
|
55
|
+
const IconUp = iconChevronUp()
|
|
56
|
+
|
|
57
|
+
const handlers = [
|
|
58
|
+
createItem('WX100001', '张三', '转审人', '已转审', '很好', '2018-08-20 12:00', ''),
|
|
59
|
+
createItem('WX100002', '李四', '主管', '已转审', '非常好', '2018-08-20 12:00', ''),
|
|
60
|
+
createItem('WX100003', '王五', '主管', '处理中', '', '', '')
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
const chartData = {
|
|
64
|
+
nodes: [
|
|
65
|
+
createNode('1', 1, '基础信息', '2018.08.02', [], 1, 0),
|
|
66
|
+
createNode('2', 1, '调职补偿', '2018.08.02', handlers, 0, 2),
|
|
67
|
+
createNode('3', 1, '汇总调职补偿', '', [], 1, 4),
|
|
68
|
+
createNode('4', 3, '启动精算', '', [], 4, 5),
|
|
69
|
+
createNode('5', 3, '复核精算', '', [], 4, 6),
|
|
70
|
+
createNode('6', 3, '审核精算', '', [], 4, 7),
|
|
71
|
+
createNode('7', 1, '调职补偿', '2018.08.02', [], 2, 1),
|
|
72
|
+
createNode('8', 1, '复核', '2018.08.02', [], 2, 2),
|
|
73
|
+
createNode('9', 2, '审批', '2018.08.02', [], 2, 3),
|
|
74
|
+
createNode('10', 1, '复核', '2018.08.02', [], 4, 2),
|
|
75
|
+
createNode('11', 2, '审批', '2018.08.02', [], 4, 3),
|
|
76
|
+
createNode('12', 3, '运算调职兑现率', '', [], 4, 4),
|
|
77
|
+
createNode('13', 1, '复核', '2018.08.02', [], 6, 2),
|
|
78
|
+
createNode('14', 4, '审批审批审批审批审批 0123456789asdfghjkl', '2018.08.02', [], 6, 3)
|
|
79
|
+
],
|
|
80
|
+
links: [
|
|
81
|
+
createLink('1', '2', '0 r0.5 t1 c r1.5', 1),
|
|
82
|
+
createLink('2', '3', '0 r1.5 c b1 r0.5', 3),
|
|
83
|
+
createLink('3', '4', '0 r0.5 c b3 r0.5', 3),
|
|
84
|
+
createLink('4', '5', '', 3),
|
|
85
|
+
createLink('5', '6', '', 3),
|
|
86
|
+
createLink('1', '7', 'r0.5 b1 c r0.5', 1),
|
|
87
|
+
createLink('7', '8', '', 1),
|
|
88
|
+
createLink('8', '9', '', 1),
|
|
89
|
+
createLink('9', '3', '0 r0.5 c t1', 3),
|
|
90
|
+
createLink('10', '11', '', 1),
|
|
91
|
+
createLink('11', '12', '', 3),
|
|
92
|
+
createLink('12', '4', '0 r0.5', 3),
|
|
93
|
+
createLink('13', '14', '', 1),
|
|
94
|
+
createLink('14', '4', '0 r1.5 c t2', 3, 'dash')
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const chartConfig = createConfig()
|
|
99
|
+
|
|
100
|
+
chartConfig.headUrl = `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/mountain.png`
|
|
101
|
+
|
|
102
|
+
chartConfig.checkItemStatus = (item) => ~['已转审', '已同意'].indexOf(item.status)
|
|
103
|
+
chartConfig.adjustPos = (afterNode) => afterNode.raw.name === '2' && (afterNode.y += 1)
|
|
104
|
+
// content 插槽需更大展示空间,默认 listWidth 62px 过小会导致文字挤压重叠
|
|
105
|
+
chartConfig.listWidth = 150
|
|
106
|
+
|
|
107
|
+
const chartDataRaw = hooks.markRaw(chartData)
|
|
108
|
+
const chartConfigRaw = hooks.markRaw(chartConfig)
|
|
109
|
+
|
|
110
|
+
function onClickNode(_afterNode, _e) {
|
|
111
|
+
TinyModal.message('click-node')
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function onClickLink(_afterLink, _e) {
|
|
115
|
+
TinyModal.message('click-link')
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function onClickBlank(_param, _e) {
|
|
119
|
+
TinyModal.message('click-blank')
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style scoped>
|
|
124
|
+
/* 覆盖 content 插槽容器的固定高度(默认 24px),否则下拉触发区会被挤压 */
|
|
125
|
+
:deep(.tiny-flow-chart__node-item) {
|
|
126
|
+
min-height: 24px !important;
|
|
127
|
+
height: auto !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* 下拉触发区:收起时显示的紧凑视图 */
|
|
131
|
+
.flowchart-content-trigger {
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
gap: 4px;
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
min-height: 22px;
|
|
139
|
+
padding: 0 4px;
|
|
140
|
+
border: 1px solid #d9d9d9;
|
|
141
|
+
border-radius: 3px;
|
|
142
|
+
font-size: 12px;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
}
|
|
145
|
+
.flowchart-content-trigger .trigger-text {
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
}
|
|
148
|
+
.flowchart-content-trigger .trigger-icon {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* content 插槽:下拉展开后的表单列表 */
|
|
153
|
+
.flowchart-content-slot {
|
|
154
|
+
padding: 4px 8px;
|
|
155
|
+
font-size: 12px;
|
|
156
|
+
}
|
|
157
|
+
.flowchart-content-slot .content-item {
|
|
158
|
+
display: flex;
|
|
159
|
+
gap: 8px;
|
|
160
|
+
padding: 4px 0;
|
|
161
|
+
border-bottom: 1px dashed #e8e8e8;
|
|
162
|
+
}
|
|
163
|
+
.flowchart-content-slot .content-item:last-child {
|
|
164
|
+
border-bottom: none;
|
|
165
|
+
}
|
|
166
|
+
.flowchart-content-slot .item-name {
|
|
167
|
+
min-width: 40px;
|
|
168
|
+
}
|
|
169
|
+
.flowchart-content-slot .item-role {
|
|
170
|
+
min-width: 50px;
|
|
171
|
+
color: #666;
|
|
172
|
+
}
|
|
173
|
+
.flowchart-content-slot .item-status {
|
|
174
|
+
color: #1890ff;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* 下拉弹层样式 */
|
|
178
|
+
:deep(.flowchart-content-popover.tiny-popper) {
|
|
179
|
+
margin-top: 2px;
|
|
180
|
+
padding: 0;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('插槽定制', async ({ page }) => {
|
|
4
|
+
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
5
|
+
await page.goto('flowchart#slots')
|
|
6
|
+
|
|
7
|
+
const preview = page.locator('#slots')
|
|
8
|
+
const flowchart = preview.locator('.tiny-flow-chart')
|
|
9
|
+
const nodes = flowchart.locator('.tiny-flow-chart__node-icon-wrapper')
|
|
10
|
+
await expect(flowchart).toBeVisible()
|
|
11
|
+
await expect(flowchart.locator('.tiny-flow-chart__canvas')).toBeVisible()
|
|
12
|
+
await expect(nodes).toHaveCount(14)
|
|
13
|
+
|
|
14
|
+
// content 插槽:下拉形式,点击「处理人(3)」展开后显示表单列表(弹层可能 teleport 到 body)
|
|
15
|
+
const trigger = flowchart.locator('.flowchart-content-trigger')
|
|
16
|
+
await expect(trigger).toBeVisible()
|
|
17
|
+
await expect(trigger).toContainText('处理人(3)')
|
|
18
|
+
await trigger.click()
|
|
19
|
+
const contentSlot = page.locator('.flowchart-content-slot')
|
|
20
|
+
await expect(contentSlot).toBeVisible()
|
|
21
|
+
await expect(contentSlot).toContainText('张三')
|
|
22
|
+
await expect(contentSlot).toContainText('李四')
|
|
23
|
+
await expect(contentSlot).toContainText('王五')
|
|
24
|
+
})
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tiny-demo">
|
|
3
|
+
<tiny-flowchart
|
|
4
|
+
ref="chart"
|
|
5
|
+
:data="chartData"
|
|
6
|
+
:config="chartConfig"
|
|
7
|
+
@click-node="onClickNode"
|
|
8
|
+
@click-link="onClickLink"
|
|
9
|
+
@click-blank="onClickBlank"
|
|
10
|
+
>
|
|
11
|
+
<!-- content 插槽:下拉形式展示,收起时显示紧凑视图,点击展开显示表单列表 -->
|
|
12
|
+
<template #content="params">
|
|
13
|
+
<tiny-popover
|
|
14
|
+
placement="bottom-start"
|
|
15
|
+
trigger="manual"
|
|
16
|
+
width="220"
|
|
17
|
+
popper-class="flowchart-content-popover"
|
|
18
|
+
:visible-arrow="false"
|
|
19
|
+
:model-value="params.dropdowns[params.node.name]"
|
|
20
|
+
@update:model-value="params.dropdowns[params.node.name] = $event"
|
|
21
|
+
>
|
|
22
|
+
<template #default>
|
|
23
|
+
<div class="flowchart-content-slot">
|
|
24
|
+
<div v-for="(item, i) in params.node.info.items" :key="item.key || i" class="content-item">
|
|
25
|
+
<span class="item-name">{{ item.name }}</span>
|
|
26
|
+
<span class="item-role">{{ item.role }}</span>
|
|
27
|
+
<span class="item-status">{{ item.status }}</span>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<template #reference>
|
|
32
|
+
<div
|
|
33
|
+
class="flowchart-content-trigger"
|
|
34
|
+
:style="{ borderColor: params.config.listBorderColor }"
|
|
35
|
+
@click.stop="params.dropdowns[params.node.name] = !params.dropdowns[params.node.name]"
|
|
36
|
+
>
|
|
37
|
+
<span class="trigger-text">处理人({{ params.node.info.items.length }})</span>
|
|
38
|
+
<component :is="params.dropdowns[params.node.name] ? IconUp : IconDown" class="trigger-icon" />
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
</tiny-popover>
|
|
42
|
+
</template>
|
|
43
|
+
</tiny-flowchart>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { TinyModal, TinyPopover, TinyFlowchart } from '@opentiny/vue'
|
|
49
|
+
import { iconChevronDown, iconChevronUp } from '@opentiny/vue-icon'
|
|
50
|
+
import { hooks } from '@opentiny/vue-common'
|
|
51
|
+
|
|
52
|
+
const { createNode, createLink, createItem, createConfig } = TinyFlowchart
|
|
53
|
+
|
|
54
|
+
const IconDown = iconChevronDown()
|
|
55
|
+
const IconUp = iconChevronUp()
|
|
56
|
+
|
|
57
|
+
const handlers = [
|
|
58
|
+
createItem('WX100001', '张三', '转审人', '已转审', '很好', '2018-08-20 12:00', ''),
|
|
59
|
+
createItem('WX100002', '李四', '主管', '已转审', '非常好', '2018-08-20 12:00', ''),
|
|
60
|
+
createItem('WX100003', '王五', '主管', '处理中', '', '', '')
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
const chartData = {
|
|
64
|
+
nodes: [
|
|
65
|
+
createNode('1', 1, '基础信息', '2018.08.02', [], 1, 0),
|
|
66
|
+
createNode('2', 1, '调职补偿', '2018.08.02', handlers, 0, 2),
|
|
67
|
+
createNode('3', 1, '汇总调职补偿', '', [], 1, 4),
|
|
68
|
+
createNode('4', 3, '启动精算', '', [], 4, 5),
|
|
69
|
+
createNode('5', 3, '复核精算', '', [], 4, 6),
|
|
70
|
+
createNode('6', 3, '审核精算', '', [], 4, 7),
|
|
71
|
+
createNode('7', 1, '调职补偿', '2018.08.02', [], 2, 1),
|
|
72
|
+
createNode('8', 1, '复核', '2018.08.02', [], 2, 2),
|
|
73
|
+
createNode('9', 2, '审批', '2018.08.02', [], 2, 3),
|
|
74
|
+
createNode('10', 1, '复核', '2018.08.02', [], 4, 2),
|
|
75
|
+
createNode('11', 2, '审批', '2018.08.02', [], 4, 3),
|
|
76
|
+
createNode('12', 3, '运算调职兑现率', '', [], 4, 4),
|
|
77
|
+
createNode('13', 1, '复核', '2018.08.02', [], 6, 2),
|
|
78
|
+
createNode('14', 4, '审批审批审批审批审批 0123456789asdfghjkl', '2018.08.02', [], 6, 3)
|
|
79
|
+
],
|
|
80
|
+
links: [
|
|
81
|
+
createLink('1', '2', '0 r0.5 t1 c r1.5', 1),
|
|
82
|
+
createLink('2', '3', '0 r1.5 c b1 r0.5', 3),
|
|
83
|
+
createLink('3', '4', '0 r0.5 c b3 r0.5', 3),
|
|
84
|
+
createLink('4', '5', '', 3),
|
|
85
|
+
createLink('5', '6', '', 3),
|
|
86
|
+
createLink('1', '7', 'r0.5 b1 c r0.5', 1),
|
|
87
|
+
createLink('7', '8', '', 1),
|
|
88
|
+
createLink('8', '9', '', 1),
|
|
89
|
+
createLink('9', '3', '0 r0.5 c t1', 3),
|
|
90
|
+
createLink('10', '11', '', 1),
|
|
91
|
+
createLink('11', '12', '', 3),
|
|
92
|
+
createLink('12', '4', '0 r0.5', 3),
|
|
93
|
+
createLink('13', '14', '', 1),
|
|
94
|
+
createLink('14', '4', '0 r1.5 c t2', 3, 'dash')
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const chartConfig = createConfig()
|
|
99
|
+
|
|
100
|
+
chartConfig.headUrl = `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/mountain.png`
|
|
101
|
+
|
|
102
|
+
chartConfig.checkItemStatus = (item) => ~['已转审', '已同意'].indexOf(item.status)
|
|
103
|
+
chartConfig.adjustPos = (afterNode) => afterNode.raw.name === '2' && (afterNode.y += 1)
|
|
104
|
+
// content 插槽需更大展示空间,默认 listWidth 62px 过小会导致文字挤压重叠
|
|
105
|
+
chartConfig.listWidth = 150
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
components: {
|
|
109
|
+
TinyFlowchart,
|
|
110
|
+
TinyPopover,
|
|
111
|
+
IconDown,
|
|
112
|
+
IconUp
|
|
113
|
+
},
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
chartData: hooks.markRaw(chartData),
|
|
117
|
+
chartConfig: hooks.markRaw(chartConfig)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
methods: {
|
|
121
|
+
onClickNode(_afterNode, _e) {
|
|
122
|
+
TinyModal.message('click-node')
|
|
123
|
+
},
|
|
124
|
+
onClickLink(_afterLink, _e) {
|
|
125
|
+
TinyModal.message('click-link')
|
|
126
|
+
},
|
|
127
|
+
onClickBlank(_param, _e) {
|
|
128
|
+
TinyModal.message('click-blank')
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style scoped>
|
|
135
|
+
/* 覆盖 content 插槽容器的固定高度(默认 24px),否则下拉触发区会被挤压 */
|
|
136
|
+
:deep(.tiny-flow-chart__node-item) {
|
|
137
|
+
min-height: 24px !important;
|
|
138
|
+
height: auto !important;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* 下拉触发区:收起时显示的紧凑视图 */
|
|
142
|
+
.flowchart-content-trigger {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
gap: 4px;
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 100%;
|
|
149
|
+
min-height: 22px;
|
|
150
|
+
padding: 0 4px;
|
|
151
|
+
border: 1px solid #d9d9d9;
|
|
152
|
+
border-radius: 3px;
|
|
153
|
+
font-size: 12px;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
}
|
|
156
|
+
.flowchart-content-trigger .trigger-text {
|
|
157
|
+
white-space: nowrap;
|
|
158
|
+
}
|
|
159
|
+
.flowchart-content-trigger .trigger-icon {
|
|
160
|
+
flex-shrink: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* content 插槽:下拉展开后的表单列表 */
|
|
164
|
+
.flowchart-content-slot {
|
|
165
|
+
padding: 4px 8px;
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
}
|
|
168
|
+
.flowchart-content-slot .content-item {
|
|
169
|
+
display: flex;
|
|
170
|
+
gap: 8px;
|
|
171
|
+
padding: 4px 0;
|
|
172
|
+
border-bottom: 1px dashed #e8e8e8;
|
|
173
|
+
}
|
|
174
|
+
.flowchart-content-slot .content-item:last-child {
|
|
175
|
+
border-bottom: none;
|
|
176
|
+
}
|
|
177
|
+
.flowchart-content-slot .item-name {
|
|
178
|
+
min-width: 40px;
|
|
179
|
+
}
|
|
180
|
+
.flowchart-content-slot .item-role {
|
|
181
|
+
min-width: 50px;
|
|
182
|
+
color: #666;
|
|
183
|
+
}
|
|
184
|
+
.flowchart-content-slot .item-status {
|
|
185
|
+
color: #1890ff;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* 下拉弹层样式 */
|
|
189
|
+
:deep(.flowchart-content-popover.tiny-popper) {
|
|
190
|
+
margin-top: 2px;
|
|
191
|
+
padding: 0;
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -12,11 +12,23 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
desc: {
|
|
14
14
|
'zh-CN':
|
|
15
|
-
"\n
|
|
15
|
+
"\n<p>节点支持 <code>icon</code> | <code>label</code> | <code>content</code> 插槽定制内容,示例提供了 <code>content</code> 插槽的默认实现。节点使用 <code>row</code> | <code>col</code> 属性进行行列配置。连线使用 <code>p</code> 属性进行相对路径配置。流程图的其它设置通过 <code>config</code> 进行配置。组件预置了 <code>createItem</code> | <code>createNode</code> | <code>createLink</code> | <code>createConfig</code> 静态方法,以便于快速构建选项。流程图的行高列宽由 <code>config</code> 的属性 <code>width</code> | <code>height</code> | <code>cols</code> | <code>rows</code> 确定,节点的位置由流程图的行高列宽,以及节点的 <code>row</code> | <code>col</code> 位置确定。</p>\n <p>连线相对路径配置详细介绍:</p>\n <ul>\n <li>'0' 表示从起始节点 1 的位置开始</li>\n <li>'r2' 表示向右画两列宽度的连线</li>\n <li>'c' 表示画一个圆角</li>\n <li>'b2' 表示向下画两行高度的连线</li>\n <li>'c' 再画一个圆角</li>\n <li>'l1' 表示向左画一列宽度的连线</li>\n <li>'c' 再画一个圆角</li>\n <li>'t1' 向上画一行高度的连线</li>\n </ul>\n <p>连线配置参数举例:</p>\n <span>const link = { from: '1', to: '2', p: '0 r2 c b2 c l1 c t1', status: 1 }</span>\n ",
|
|
16
16
|
'en-US':
|
|
17
|
-
"\n
|
|
17
|
+
"\n<p>The node supports custom content through the <code>icon</code> | <code>label</code> | <code>content</code> slots, with a default implementation provided for the <code>content</code> slot. Nodes can be configured for row and column placement using the <code>row</code> | <code>col</code> attributes, while connections between nodes can be configured using the <code>p</code> attribute for relative path configuration. Other settings for the flowchart can be configured through the <code>config</code> attribute. The component also provides static methods <code>createItem</code> | <code>createNode</code> | <code>createLink</code> | <code>createConfig</code> for quick option building. The row height and column width of the flowchart are determined by the <code>width</code> | <code>height</code> | <code>cols</code> | <code>rows</code> attributes of the <code>config</code>, while the position of each node is determined by the row height, column width, and the <code>row</code> | <code>col</code> position of the node.</p>\n <p>Detailed introduction to configuring relative paths for connections:</p>\n <ul>\n <li>'0' represents starting from node 1 position.</li>\n <li>'r2' represents drawing a line two columns wide to the right.</li>\n <li>'c' represents drawing a circle.</li>\n <li>'b2' represents a downward line of two height units.</li>\n <li>'c' represents drawing a circle again.</li>\n <li>'l1' represents drawing a line one columns wide to the left.</li>\n <li>'t1' represents a upward line of two height units.</li>\n </ul>\n <p>Example of connection configuration parameters:</p>\n <span>const link = { from: '1', to: '2', p: '0 r2 c b2 c l1 c t1', status: 1 }</span>\n "
|
|
18
18
|
},
|
|
19
19
|
codeFiles: ['basic-usage.vue']
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
demoId: 'slots',
|
|
23
|
+
name: {
|
|
24
|
+
'zh-CN': '插槽定制',
|
|
25
|
+
'en-US': 'Slots Usage'
|
|
26
|
+
},
|
|
27
|
+
desc: {
|
|
28
|
+
'zh-CN': '节点支持 content 插槽自定义内容。',
|
|
29
|
+
'en-US': 'The node supports content slots for custom content.'
|
|
30
|
+
},
|
|
31
|
+
codeFiles: ['slots.vue']
|
|
20
32
|
}
|
|
21
33
|
],
|
|
22
34
|
features: [
|
|
@@ -18,15 +18,17 @@ test('测试基本表单', async ({ page }) => {
|
|
|
18
18
|
await decreaseIcon.click()
|
|
19
19
|
await expect(numericInput).toHaveValue('0')
|
|
20
20
|
|
|
21
|
-
//
|
|
22
|
-
const datePicker = demo.getByRole('
|
|
21
|
+
// 日期选择器(PR #4028 后,role 从 textbox 改为 combobox)
|
|
22
|
+
const datePicker = demo.getByRole('combobox').first()
|
|
23
23
|
await datePicker.click()
|
|
24
|
+
await page.waitForTimeout(200) // 等待弹出层显示
|
|
24
25
|
await page.getByRole('cell', { name: '15' }).getByText('15').click()
|
|
25
26
|
await expect(datePicker).toHaveValue(/15/)
|
|
26
27
|
|
|
27
|
-
//
|
|
28
|
-
const timePicker = demo.getByRole('combobox').nth(
|
|
28
|
+
// 时间选择器
|
|
29
|
+
const timePicker = demo.getByRole('combobox').nth(1) // 第二个 combobox(第一个是日期选择器)
|
|
29
30
|
await timePicker.click()
|
|
31
|
+
await page.waitForTimeout(200) // 等待下拉列表显示
|
|
30
32
|
await page.getByRole('option').filter({ hasText: '00:30' }).click()
|
|
31
33
|
await expect(timePicker).toHaveValue('00:30')
|
|
32
34
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-form">
|
|
3
|
+
<tiny-form :model="state" :rules="rules">
|
|
4
|
+
<tiny-form-item label="HTML" prop="value0">
|
|
5
|
+
<tiny-input :maxLength="3" v-model="state.value0"></tiny-input>
|
|
6
|
+
</tiny-form-item>
|
|
7
|
+
<tiny-form-item label="默认" prop="value1">
|
|
8
|
+
<tiny-input v-model="state.value1"></tiny-input>
|
|
9
|
+
</tiny-form-item>
|
|
10
|
+
<tiny-form-item label="自定义" prop="value2">
|
|
11
|
+
<tiny-input v-model="state.value2"></tiny-input>
|
|
12
|
+
</tiny-form-item>
|
|
13
|
+
</tiny-form>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
import { reactive, ref } from 'vue'
|
|
19
|
+
|
|
20
|
+
import { Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput } from '@opentiny/vue'
|
|
21
|
+
|
|
22
|
+
const state = reactive({
|
|
23
|
+
value0: '',
|
|
24
|
+
value1: '',
|
|
25
|
+
value2: ''
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const rules = ref({
|
|
29
|
+
value1: [{ max: 3 }],
|
|
30
|
+
value2: [{ max: 4, regular: (val) => val.length }]
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
.demo-form {
|
|
36
|
+
width: 380px;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
test('自定义字符串长度', async ({ page }) => {
|
|
4
|
+
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
5
|
+
await page.goto('form#custom-validation-string-length')
|
|
6
|
+
|
|
7
|
+
const demo = page.locator('#custom-validation-string-length')
|
|
8
|
+
const input1 = demo.locator('input').nth(0)
|
|
9
|
+
const input2 = demo.locator('input').nth(1)
|
|
10
|
+
const input3 = demo.locator('input').nth(2)
|
|
11
|
+
|
|
12
|
+
await input1.fill('1111111')
|
|
13
|
+
await expect(input1).toHaveValue('111')
|
|
14
|
+
await input2.fill('1111111')
|
|
15
|
+
await expect(page.locator('.tiny-tooltip').getByText('不能大于 3 个字符')).toBeVisible()
|
|
16
|
+
await input3.fill('1111111')
|
|
17
|
+
await expect(page.locator('.tiny-tooltip').getByText('不能大于 4 个字符')).toBeVisible()
|
|
18
|
+
})
|
|
@@ -14,21 +14,36 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
|
-
<script
|
|
18
|
-
import { reactive, ref } from 'vue'
|
|
19
|
-
|
|
17
|
+
<script>
|
|
20
18
|
import { Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput } from '@opentiny/vue'
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
export default {
|
|
21
|
+
components: {
|
|
22
|
+
TinyForm,
|
|
23
|
+
TinyFormItem,
|
|
24
|
+
TinyInput
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
state: {
|
|
29
|
+
value0: '',
|
|
30
|
+
value1: '',
|
|
31
|
+
value2: ''
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
value1: [{ max: 3 }],
|
|
35
|
+
value2: [
|
|
36
|
+
{
|
|
37
|
+
max: 4,
|
|
38
|
+
regular(val) {
|
|
39
|
+
return val.length
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
</script>
|
|
33
48
|
|
|
34
49
|
<style scoped>
|
|
@@ -85,7 +85,7 @@ function resetForm() {
|
|
|
85
85
|
width: 380px;
|
|
86
86
|
}
|
|
87
87
|
.group-form-title {
|
|
88
|
-
margin-
|
|
88
|
+
margin-top: 24px;
|
|
89
89
|
font-size: 16px;
|
|
90
90
|
color: #191919;
|
|
91
91
|
font-weight: bold;
|
|
@@ -94,7 +94,7 @@ function resetForm() {
|
|
|
94
94
|
padding-top: 8px;
|
|
95
95
|
}
|
|
96
96
|
.second-title {
|
|
97
|
-
margin-
|
|
97
|
+
margin-bottom: 8px;
|
|
98
98
|
}
|
|
99
99
|
.address {
|
|
100
100
|
position: relative;
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
width: 380px;
|
|
93
93
|
}
|
|
94
94
|
.group-form-title {
|
|
95
|
-
margin-
|
|
95
|
+
margin-top: 24px;
|
|
96
96
|
font-size: 16px;
|
|
97
97
|
color: #191919;
|
|
98
98
|
font-weight: bold;
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
padding-top: 8px;
|
|
102
102
|
}
|
|
103
103
|
.second-title {
|
|
104
|
-
margin-
|
|
104
|
+
margin-bottom: 8px;
|
|
105
105
|
}
|
|
106
106
|
.address {
|
|
107
107
|
position: relative;
|
|
@@ -3,6 +3,7 @@ import { test, expect } from '@playwright/test'
|
|
|
3
3
|
test('过滤高级设置', async ({ page }) => {
|
|
4
4
|
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
5
5
|
await page.goto('grid-filter#filter-default-filter')
|
|
6
|
+
await page.setViewportSize({ width: 1920, height: 1980 })
|
|
6
7
|
await page
|
|
7
8
|
.getByRole('cell', { name: '公司名称鼠标移入可以动态提示 tooltip,公司名称鼠标移入可以动态提示 tooltip' })
|
|
8
9
|
.getByRole('img')
|