@opentinyvue/vue-docs 3.29.2 → 3.29.3

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.
Files changed (28) hide show
  1. package/demos/apis/button-group.js +15 -0
  2. package/demos/apis/grid.js +1 -1
  3. package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
  4. package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
  5. package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
  6. package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
  7. package/demos/pc/app/button-group/display-mode.vue +31 -0
  8. package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
  9. package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
  10. package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
  11. package/demos/pc/app/flowchart/basic-usage.vue +4 -249
  12. package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
  13. package/demos/pc/app/flowchart/slots.spec.ts +24 -0
  14. package/demos/pc/app/flowchart/slots.vue +193 -0
  15. package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
  16. package/demos/pc/app/input/resize.spec.ts +2 -2
  17. package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
  18. package/demos/pc/app/select/copy-multi.spec.ts +1 -1
  19. package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
  20. package/demos/pc/app/tag/color-border.spec.ts +2 -2
  21. package/demos/pc/app/tag/max-width.spec.ts +1 -1
  22. package/demos/pc/app/tag/size.spec.ts +3 -3
  23. package/demos/pc/app/tag/slot-default.spec.ts +3 -3
  24. package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
  25. package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
  26. package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
  27. package/demos/pc/webdoc/introduce.md +2 -0
  28. package/package.json +5 -5
@@ -110,6 +110,21 @@ export default {
110
110
  mode: ['pc', 'mobile-first'],
111
111
  pcDemo: 'text-value-field',
112
112
  mfDemo: ''
113
+ },
114
+ // displayMode
115
+ {
116
+ name: 'display-mode',
117
+ type: "'default' | 'merged'",
118
+ defaultValue: "'default'",
119
+ desc: {
120
+ 'zh-CN': '按钮组显示模式,可选值为"default"和"merged",默认为"default"。当设置为"merged"时,按钮组内的按钮将合并显示,形成一个整体的外观。',
121
+ 'en-US': 'Button group display mode, optional values are "default" and "merged", the default is "default". When set to "merged", the buttons in the button group will be merged to form an overall appearance.'
122
+ },
123
+ mode: ['pc','mobile-first'],
124
+ pcDemo: 'display-mode',
125
+ meta: {
126
+ stable: '3.29.0'
127
+ }
113
128
  }
114
129
  ],
115
130
  events: [
@@ -3239,7 +3239,7 @@ export default {
3239
3239
  type: 'interface',
3240
3240
  code: `
3241
3241
  interface IPopperOption {
3242
- bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认false
3242
+ bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认true
3243
3243
  followReferenceHide: boolean // 当触发源隐藏时,自动隐藏弹出层,默认true
3244
3244
  removeOnDestroy: boolean // 弹出层消失后,是否移除弹出层的DOM元素,布尔false
3245
3245
  updateHiddenPopperOnScroll: boolean // 滚动过程中是否更新隐藏的弹出层位置
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div>
3
+ <!-- 默认模式 -->
4
+ <tiny-button-group :data="groupData" v-model="checkedVal" />
5
+ <br>
6
+ <br>
7
+
8
+ <!-- 圆角合并模式 -->
9
+ <tiny-button-group :data="groupData" v-model="checkedVal" display-mode="merged" />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { TinyButtonGroup } from "@opentiny/vue";
15
+
16
+ export default {
17
+ components: {
18
+ TinyButtonGroup,
19
+ },
20
+ data() {
21
+ return {
22
+ checkedVal: "Button1",
23
+ groupData: [
24
+ { text: "Button1", value: "Button1" },
25
+ { text: "Button2", value: "Button2" },
26
+ { text: "Button3", value: "Button3" },
27
+ ],
28
+ };
29
+ },
30
+ };
31
+ </script>
@@ -52,6 +52,19 @@ export default {
52
52
  'en-US': '<p>bbutton click</p>'
53
53
  },
54
54
  codeFiles: ['enumeration.vue']
55
+ },
56
+ {
57
+ demoId: 'display-mode',
58
+ name: {
59
+ 'zh-CN': '按钮组显示模式',
60
+ 'en-US': 'button mode'
61
+ },
62
+ desc: {
63
+ 'zh-CN':
64
+ '<p>通过 <code>display-mode</code> 属性设置按钮组显示模式,可选值有 <code>default</code>(默认)和 <code>merged</code>(选块合并)。</p>',
65
+ 'en-US': '<p>button mode</p>'
66
+ },
67
+ codeFiles: ['display-mode.vue']
55
68
  }
56
69
  ]
57
70
  }
@@ -10,7 +10,7 @@ test('多选复制单个标签', async ({ page }) => {
10
10
 
11
11
  await expect(tag).toContainText('北京')
12
12
  await page.waitForTimeout(200)
13
- const tagBox = await tag.locator('span').boundingBox()
13
+ const tagBox = await tag.locator('span > span').boundingBox()
14
14
  const x = tagBox.x + tagBox.width
15
15
  const y = tagBox.y + tagBox.height - 5
16
16
 
File without changes
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div>
3
+ <!-- 默认模式 -->
4
+ <tiny-button-group :data="groupData" v-model="checkedVal" />
5
+ <br>
6
+ <br>
7
+
8
+ <!-- 圆角合并模式 -->
9
+ <tiny-button-group :data="groupData" v-model="checkedVal" display-mode="merged" />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { TinyButtonGroup } from "@opentiny/vue";
15
+
16
+ export default {
17
+ components: {
18
+ TinyButtonGroup,
19
+ },
20
+ data() {
21
+ return {
22
+ checkedVal: "Button1",
23
+ groupData: [
24
+ { text: "Button1", value: "Button1" },
25
+ { text: "Button2", value: "Button2" },
26
+ { text: "Button3", value: "Button3" },
27
+ ],
28
+ };
29
+ },
30
+ };
31
+ </script>
@@ -149,6 +149,20 @@ export default {
149
149
  'en-US': '<p>The <code>change</code> event is triggered when the selected button is changed. </p>'
150
150
  },
151
151
  codeFiles: ['change-event.vue']
152
+ },
153
+ {
154
+ demoId: 'display-mode',
155
+ name: {
156
+ 'zh-CN': '按钮组显示模式',
157
+ 'en-US': 'Button Group Display Mode'
158
+ },
159
+ desc: {
160
+ 'zh-CN':
161
+ '<p>通过 <code>display-mode</code> 属性设置按钮组显示模式,可选值有 <code>default</code>(默认)和 <code>merged</code>(选块合并)。</p>',
162
+ 'en-US':
163
+ '<p>Set the display mode of the button group through the <code>display-mode</code> attribute. The optional values are: <code>default</code> (default) and <code>merged</code> (merged).</p>'
164
+ },
165
+ codeFiles: ['display-mode.vue']
152
166
  }
153
167
  ],
154
168
  features: [
@@ -1,176 +1,27 @@
1
1
  <template>
2
2
  <div class="tiny-demo">
3
- <button @click="toggleStatus">切换状态</button>
4
3
  <tiny-flowchart
5
- ref="chartRef"
6
- :data="chartData"
7
- :config="chartConfig"
4
+ ref="chart"
5
+ :data="chartDataRaw"
6
+ :config="chartConfigRaw"
8
7
  @click-node="onClickNode"
9
8
  @click-link="onClickLink"
10
9
  @click-blank="onClickBlank"
11
10
  >
12
- <template #content="params">
13
- <handler-list class="custom-handler-list" :params="params" />
14
- </template>
15
11
  </tiny-flowchart>
16
12
  </div>
17
13
  </template>
18
14
 
19
15
  <script setup>
20
- import { ref } from 'vue'
21
- import { TinyModal, TinyPopover, Flowchart } from '@opentiny/vue'
22
- import { iconYes, iconPanelMini, iconChevronDown, iconChevronUp } from '@opentiny/vue-icon'
16
+ import { TinyModal, TinyFlowchart } from '@opentiny/vue'
17
+ import { hooks } from '@opentiny/vue-common'
23
18
 
24
- const { createNode, createLink, createItem, createConfig } = Flowchart
25
-
26
- const HandlerDropdown = {
27
- template: `<div class="tiny-handler-dropdown">
28
- <div v-for="(handler, i) in params.node.info.items" :key="i" class="tiny-handler-dropdown-item">
29
- <div class="item-icon">
30
- <div :style="iconStyle(handler)">
31
- <tiny-icon-yes v-if="check(handler)"></tiny-icon-yes>
32
- <tiny-icon-pane v-else></tiny-icon-pane>
33
- </div>
34
- </div>
35
- <div class="item-status">{{ handler.status }}</div>
36
- <div class="item-head">
37
- <img :src="params.allItem[handler.key]" :style="imgStyle" />
38
- </div>
39
- <div class="item-name">{{ handler.name }}</div>
40
- <div class="item-key">{{ handler.key }}</div>
41
- <div class="item-role">{{ handler.role }}</div>
42
- <div class="item-date">{{ handler.date }}</div>
43
- </div>
44
- </div>`,
45
- name: 'TinyHandlerDropdown',
46
- components: {
47
- TinyIconYes: iconYes(),
48
- TinyIconPane: iconPanelMini()
49
- },
50
- props: {
51
- params: Object
52
- },
53
- computed: {
54
- imgStyle() {
55
- return 'width:16px;height:16px;border-radius:50%;'
56
- }
57
- },
58
- methods: {
59
- check(handler) {
60
- const { params } = this
61
- return typeof params.config.checkItemStatus === 'function' && params.config.checkItemStatus(handler)
62
- },
63
- iconStyle(handler) {
64
- const color = this.check(handler)
65
- ? 'border-color:#52c41a;background:#52c41a;'
66
- : 'border-color:#40a9ff;background:#40a9ff;'
67
- return (
68
- this.imgStyle +
69
- 'display:flex;align-items:center;justify-content:center;' +
70
- 'border-width:1px;border-style:solid;' +
71
- color
72
- )
73
- }
74
- }
75
- }
76
-
77
- const HandlerList = {
78
- template: `<tiny-popover
79
- placement="bottom-start"
80
- title=""
81
- v-model="params.showPop"
82
- width="220"
83
- trigger="manual"
84
- popper-class="demo-popover-class1"
85
- :visible-arrow="false"
86
- >
87
- <handler-dropdown class="custom-handler-dropdown" :params="params" />
88
- <template #reference>
89
- <div
90
- class="tiny-handler-list"
91
- :class="'name-' + params.node.name"
92
- :style="'border:1px solid ' + params.config.listBorderColor"
93
- >
94
- <div class="tiny-handler-list__heads" :style="'width:' + headWidth + 'px'">
95
- <img
96
- v-for="(item, i) in heads"
97
- class="tiny-handler-list__head-img"
98
- :key="i"
99
- :src="item.head"
100
- :style="item.style"
101
- />
102
- </div>
103
- <div
104
- class="tiny-handler-list__icon"
105
- :style="'width:' + params.config.listIconSize + 'px;fill:' + params.config.listIconColor"
106
- @click="toggleStatus"
107
- >
108
- <tiny-icon-up v-if="params.dropdowns[params.node.name]"></tiny-icon-up>
109
- <tiny-icon-down v-else></tiny-icon-down>
110
- </div>
111
- </div>
112
- </template>
113
- </tiny-popover>`,
114
- name: 'TinyHandlerList',
115
- components: {
116
- TinyIconDown: iconChevronDown(),
117
- TinyIconUp: iconChevronUp(),
118
- HandlerDropdown,
119
- TinyPopover
120
- },
121
- props: {
122
- params: Object
123
- },
124
- computed: {
125
- headWidth() {
126
- const { params } = this
127
-
128
- return params.config.listWidth - 6 - params.config.listIconSize
129
- },
130
- heads() {
131
- const { params, headWidth } = this
132
- const { allItem, node, config } = params
133
- const { headSize } = config
134
- const { info } = node
135
- const { items } = info
136
- const imgStyle = `width:${headSize}px;height:${headSize}px`
137
- const res = []
138
-
139
- items.forEach(({ key }, i) => {
140
- let left
141
-
142
- if (items.length > 1) {
143
- left = Math.floor(((headWidth - headSize) / (items.length - 1)) * i)
144
- } else if (items.length === 1) {
145
- left = Math.floor(headWidth / 2)
146
- }
147
-
148
- const style = `${imgStyle};left:${left}px`
149
-
150
- res.push({ head: allItem[key], style })
151
- })
152
-
153
- return res
154
- }
155
- },
156
- methods: {
157
- toggleStatus() {
158
- const { params } = this
159
- params.dropdowns[params.node.name] = !params.dropdowns[params.node.name]
160
- }
161
- }
162
- }
163
-
164
- const handlers = [
165
- createItem('WX100001', '张三', '转审人', '已转审', '很好', '2018-08-20 12:00', ''),
166
- createItem('WX100002', '李四', '主管', '已转审', '非常好', '2018-08-20 12:00', ''),
167
- createItem('WX100003', '王五', '主管', '处理中', '', '', '')
168
- ]
19
+ const { createNode, createLink, createConfig } = TinyFlowchart
169
20
 
170
21
  const chartData = {
171
22
  nodes: [
172
23
  createNode('1', 1, '基础信息', '2018.08.02', [], 1, 0),
173
- createNode('2', 1, '调职补偿', '2018.08.02', handlers, 0, 2),
24
+ createNode('2', 1, '调职补偿', '2018.08.02', [], 0, 2),
174
25
  createNode('3', 1, '汇总调职补偿', '', [], 1, 4),
175
26
  createNode('4', 3, '启动精算', '', [], 4, 5),
176
27
  createNode('5', 3, '复核精算', '', [], 4, 6),
@@ -209,23 +60,9 @@ chartConfig.headUrl = `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/m
209
60
  chartConfig.checkItemStatus = (item) => ~['已转审', '已同意'].indexOf(item.status)
210
61
  chartConfig.adjustPos = (afterNode) => afterNode.raw.name === '2' && (afterNode.y += 1)
211
62
 
212
- const nodeFail = chartData.nodes[chartData.nodes.length - 1]
213
- const linkDash = chartData.links[chartData.links.length - 1]
214
-
215
- const flag = ref(false)
216
- const chartRef = ref()
217
- const TinyFlowchart = Flowchart
218
-
219
- function toggleStatus() {
220
- flag.value = !flag.value
221
- // 1.更改数据
222
- nodeFail.info.status = flag.value ? 1 : 4
223
- linkDash.info.style = flag.value ? 'solid' : 'dash'
224
- linkDash.info.status = flag.value ? 1 : 3
225
- chartConfig.anchor = flag.value ? 'left' : 'center'
226
- // 2.刷新流程图
227
- chartRef.value.refresh()
228
- }
63
+ // 使用 markRaw 避免大数据对象被 Vue 深度响应式代理,提升性能
64
+ const chartDataRaw = hooks.markRaw(chartData)
65
+ const chartConfigRaw = hooks.markRaw(chartConfig)
229
66
 
230
67
  function onClickNode(_afterNode, _e) {
231
68
  TinyModal.message('click-node')
@@ -239,90 +76,3 @@ function onClickBlank(_param, _e) {
239
76
  TinyModal.message('click-blank')
240
77
  }
241
78
  </script>
242
-
243
- <style scoped>
244
- /* HandlerList */
245
- .tiny-handler-list {
246
- width: calc(100% - 2px);
247
- height: 100%;
248
- border-radius: 3px;
249
- position: relative;
250
- }
251
- .tiny-handler-list__heads {
252
- position: absolute;
253
- top: 1px;
254
- left: 1px;
255
- height: calc(100% - 2px);
256
- }
257
- .tiny-handler-list__icon {
258
- position: absolute;
259
- top: 1px;
260
- right: 1px;
261
- height: calc(100% - 2px);
262
- display: flex;
263
- align-items: center;
264
- justify-content: center;
265
- font-size: 14px;
266
- }
267
- .tiny-handler-list__head-img {
268
- border-radius: 50%;
269
- position: absolute;
270
- }
271
- /* HandlerDropdown */
272
- .tiny-handler-dropdown {
273
- width: auto;
274
- height: auto;
275
- padding: 6px;
276
- text-align: initial;
277
- cursor: pointer;
278
- }
279
- .tiny-handler-dropdown-item + .tiny-handler-dropdown-item {
280
- margin-top: 6px;
281
- padding-top: 6px;
282
- border-top: 1px dashed #999;
283
- }
284
- .tiny-handler-dropdown-item {
285
- font-size: 12px;
286
- display: grid;
287
- gap: 4px;
288
- grid-template-rows: repeat(3, 20px);
289
- grid-template-columns: 20px 20px 40px auto 40px;
290
- grid-template-areas:
291
- 'icon status status status status'
292
- '. head name key role'
293
- '. date date date date';
294
- align-items: center;
295
- justify-content: start;
296
- }
297
- .tiny-handler-dropdown-item .item-icon {
298
- grid-area: icon;
299
- }
300
- .tiny-handler-dropdown-item .item-status {
301
- grid-area: status;
302
- font-weight: bold;
303
- }
304
- .tiny-handler-dropdown-item .item-head {
305
- grid-area: head;
306
- }
307
- .tiny-handler-dropdown-item .item-name {
308
- grid-area: name;
309
- }
310
- .tiny-handler-dropdown-item .item-key {
311
- grid-area: key;
312
- }
313
- .tiny-handler-dropdown-item .item-role {
314
- grid-area: role;
315
- background: #d9d9d9;
316
- }
317
- .tiny-handler-dropdown-item .item-date {
318
- grid-area: date;
319
- color: #999;
320
- }
321
- .tiny-handler-dropdown-item .item-icon .tiny-svg {
322
- fill: #fff;
323
- }
324
- .tiny-popover.demo-popover-class1.tiny-popper[x-placement^='bottom'] {
325
- margin-top: 2px;
326
- padding: 0;
327
- }
328
- </style>
@@ -4,7 +4,8 @@ test('基本用法', async ({ page }) => {
4
4
  page.on('pageerror', (exception) => expect(exception).toBeNull())
5
5
  await page.goto('flowchart#basic-usage')
6
6
 
7
- const flowchart = page.locator('.pc-demo .tiny-flow-chart')
7
+ const preview = page.locator('#basic-usage')
8
+ const flowchart = preview.locator('.tiny-flow-chart')
8
9
  const nodes = flowchart.locator('.tiny-flow-chart__node-icon-wrapper')
9
10
  await expect(flowchart).toBeVisible()
10
11
  await expect(flowchart).toHaveCSS('width', '1024px')