Skip to content

Commit 2327c03

Browse files
authored
fix(picker): add popperOptions props for Picker (#3769)
* fix(picker): add popperOptions props for Picker * fix(docs): add props api for datepicker and select
1 parent fbb2e3b commit 2327c03

File tree

5 files changed

+118
-0
lines changed

5 files changed

+118
-0
lines changed

examples/sites/demos/apis/date-picker.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ export default {
215215
mode: ['pc'],
216216
pcDemo: 'custom-suffix-icon'
217217
},
218+
{
219+
name: 'popper-options',
220+
typeAnchorName: 'IPopperOption',
221+
type: 'IPopperOption',
222+
defaultValue: ' { }',
223+
desc: {
224+
'zh-CN': '弹出层参数',
225+
'en-US': 'Advanced parameters; Refer to the description of IPopperOption'
226+
},
227+
mode: ['pc', 'mobile-first'],
228+
pcDemo: '',
229+
mfDemo: ''
230+
},
218231
{
219232
name: 'range-separator',
220233
type: 'string',
@@ -666,6 +679,21 @@ interface IPickerOptions {
666679
code: `
667680
type IType = 'date' | 'dates' | 'daterange' | 'datetime' | 'datetimerange' | 'week' | 'month' | 'monthrange' | 'quarter' | 'year' | 'years' | 'yearrange'
668681
`
682+
},
683+
{
684+
name: 'IPopperOption',
685+
type: 'interface',
686+
code: `
687+
interface IPopperOption {
688+
bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认false
689+
followReferenceHide: boolean // 当触发源隐藏时,自动隐藏弹出层,默认true
690+
removeOnDestroy: boolean // 弹出层消失后,是否移除弹出层的DOM元素,布尔false
691+
updateHiddenPopperOnScroll: boolean // 滚动过程中是否更新隐藏的弹出层位置
692+
boundariesElement: 'viewport' | 'body' | HTMLElement // 滚动过程中,弹出层的碰撞边界。 默认值为: 'viewport'
693+
ignoreBoundaries: boolean // 忽略边界判断,弹出的位置始终是设置的 placement 值
694+
scrollParent: HTMLElement // 指定滚动的父节点,优化级最高。 默认为null
695+
}
696+
`
669697
}
670698
]
671699
}

examples/sites/demos/apis/select.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,19 @@ export default {
435435
pcDemo: 'popup-style-position',
436436
mfDemo: 'popup-style-position'
437437
},
438+
{
439+
name: 'popper-options',
440+
typeAnchorName: 'IPopperOption',
441+
type: 'IPopperOption',
442+
defaultValue: ' { }',
443+
desc: {
444+
'zh-CN': '弹出层参数',
445+
'en-US': 'Advanced parameters; Refer to the description of IPopperOption'
446+
},
447+
mode: ['pc', 'mobile-first'],
448+
pcDemo: '',
449+
mfDemo: ''
450+
},
438451
{
439452
name: 'remote',
440453
type: 'boolean',
@@ -1034,6 +1047,21 @@ interface ITreeOption {
10341047
code: `
10351048
type IPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'
10361049
`
1050+
},
1051+
{
1052+
name: 'IPopperOption',
1053+
type: 'interface',
1054+
code: `
1055+
interface IPopperOption {
1056+
bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认false
1057+
followReferenceHide: boolean // 当触发源隐藏时,自动隐藏弹出层,默认true
1058+
removeOnDestroy: boolean // 弹出层消失后,是否移除弹出层的DOM元素,布尔false
1059+
updateHiddenPopperOnScroll: boolean // 滚动过程中是否更新隐藏的弹出层位置
1060+
boundariesElement: 'viewport' | 'body' | HTMLElement // 滚动过程中,弹出层的碰撞边界。 默认值为: 'viewport'
1061+
ignoreBoundaries: boolean // 忽略边界判断,弹出的位置始终是设置的 placement 值
1062+
scrollParent: HTMLElement // 指定滚动的父节点,优化级最高。 默认为null
1063+
}
1064+
`
10371065
}
10381066
]
10391067
}

examples/sites/demos/apis/time-picker.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,19 @@ export default {
162162
mode: ['pc'],
163163
pcDemo: 'popper-class'
164164
},
165+
{
166+
name: 'popper-options',
167+
typeAnchorName: 'IPopperOption',
168+
type: 'IPopperOption',
169+
defaultValue: ' { }',
170+
desc: {
171+
'zh-CN': '弹出层参数',
172+
'en-US': 'Advanced parameters; Refer to the description of IPopperOption'
173+
},
174+
mode: ['pc', 'mobile-first'],
175+
pcDemo: '',
176+
mfDemo: ''
177+
},
165178
{
166179
name: 'range-separator',
167180
type: 'string',
@@ -381,6 +394,21 @@ interface IPickerOptions {
381394
selectableRange: string
382395
// 下拉框中显示的格式
383396
format: string
397+
}
398+
`
399+
},
400+
{
401+
name: 'IPopperOption',
402+
type: 'interface',
403+
code: `
404+
interface IPopperOption {
405+
bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认false
406+
followReferenceHide: boolean // 当触发源隐藏时,自动隐藏弹出层,默认true
407+
removeOnDestroy: boolean // 弹出层消失后,是否移除弹出层的DOM元素,布尔false
408+
updateHiddenPopperOnScroll: boolean // 滚动过程中是否更新隐藏的弹出层位置
409+
boundariesElement: 'viewport' | 'body' | HTMLElement // 滚动过程中,弹出层的碰撞边界。 默认值为: 'viewport'
410+
ignoreBoundaries: boolean // 忽略边界判断,弹出的位置始终是设置的 placement 值
411+
scrollParent: HTMLElement // 指定滚动的父节点,优化级最高。 默认为null
384412
}
385413
`
386414
}

examples/sites/demos/apis/time-select.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ export default {
128128
mode: ['pc'],
129129
pcDemo: ''
130130
},
131+
{
132+
name: 'popper-options',
133+
typeAnchorName: 'IPopperOption',
134+
type: 'IPopperOption',
135+
defaultValue: ' { }',
136+
desc: {
137+
'zh-CN': '弹出层参数',
138+
'en-US': 'Advanced parameters; Refer to the description of IPopperOption'
139+
},
140+
mode: ['pc', 'mobile-first'],
141+
pcDemo: '',
142+
mfDemo: ''
143+
},
131144
{
132145
name: 'size',
133146
type: 'string',
@@ -201,5 +214,22 @@ export default {
201214
],
202215
slots: []
203216
}
217+
],
218+
types: [
219+
{
220+
name: 'IPopperOption',
221+
type: 'interface',
222+
code: `
223+
interface IPopperOption {
224+
bubbling: boolean // 是否监听元素所有上级有滚动元素的scroll事件,监听到则更新popper的位置。用于解决某些弹出层位置在页面滚动时,位置不正确的场景,默认false
225+
followReferenceHide: boolean // 当触发源隐藏时,自动隐藏弹出层,默认true
226+
removeOnDestroy: boolean // 弹出层消失后,是否移除弹出层的DOM元素,布尔false
227+
updateHiddenPopperOnScroll: boolean // 滚动过程中是否更新隐藏的弹出层位置
228+
boundariesElement: 'viewport' | 'body' | HTMLElement // 滚动过程中,弹出层的碰撞边界。 默认值为: 'viewport'
229+
ignoreBoundaries: boolean // 忽略边界判断,弹出的位置始终是设置的 placement 值
230+
scrollParent: HTMLElement // 指定滚动的父节点,优化级最高。 默认为null
231+
}
232+
`
233+
}
204234
]
205235
}

packages/vue/src/picker/src/type.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ export const pickerProps = {
7575
type: Boolean,
7676
default: true
7777
},
78+
popperOptions: {
79+
type: Object,
80+
default: () => ({})
81+
},
7882
align: {
7983
type: String,
8084
default: 'left'

0 commit comments

Comments
 (0)