Skip to content

feat(dialog-select): [dialog-select] add attribute lock-scroll #3489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/sites/demos/apis/dialog-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ export default {
mode: ['pc'],
pcDemo: 'nest-grid-multi'
},
{
name: 'lock-scroll',
type: 'boolean',
defaultValue: 'true',
desc: {
'zh-CN': '设置弹出面板的锁定滚动',
'en-US': 'Set the lock scroll of the pop-up panel.'
},
meta: {
stable: '3.24.0'
},
mode: ['pc'],
pcDemo: 'nest-grid-multi'
},
{
name: 'grid-op',
typeAnchorName: 'IGridOption',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
value-field="id"
text-field="name"
:main-height="240"
:lock-scroll="false"
>
<template #search>
<div class="tiny-demo-search">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ test('dialogSelect 表格多选', async ({ page }) => {
const demo = page.locator('#nest-grid-multi')

await demo.getByRole('button', { name: '打开窗口' }).click()
await expect(page.locator('body')).not.toHaveClass(/dialog-box__scroll-lock/)
await page
.locator('div')
.filter({ hasText: /^GFD 科技有限公司福州WSX 科技有限公司黄冈暂无数据$/ })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
value-field="id"
text-field="name"
:main-height="240"
:lock-scroll="false"
>
<template #search>
<div class="tiny-demo-search">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default {
},
desc: {
'zh-CN':
'<p>通过 <code>auto-lookup</code>、<code>lookup-method</code> 属性 和 <code>change</code> 事件设置初始化时数据的反查回显功能。</p> \n<p>表格多选场景需要设置 <code>popselector</code> 为 <code>grid</code>,<code>multi</code> 为 <code>true</code>,<code>checkRowKeys</code> 设置默认选中数据。</p >\n',
'<p>通过 <code>auto-lookup</code>、<code>lookup-method</code> 属性 和 <code>change</code> 事件设置初始化时数据的反查回显功能。</p> \n<p>表格多选场景需要设置 <code>popselector</code> 为 <code>grid</code>,<code>multi</code> 为 <code>true</code>,<code>checkRowKeys</code> 设置默认选中数据。<code>lock-scroll</code> 配置弹出窗口时是否禁用滚动条。</p >\n',
'en-US':
'<p>Use the <code>auto-lookup</code>,<code>lookup-method</code> attributes, and <code>change</code> event settings to perform data backtracking during initialization. <code>autoLookup</code>The default value is <code>true</code>. </p>\n<p> Multiple selection scenarios in the table require setting<code>popcollector</code>as grid,<code>multi</code>as true, and<code>checkRowKeys</code>as default selected data. </p >\n'
'<p>Use the <code>auto-lookup</code>,<code>lookup-method</code> attributes, and <code>change</code> event settings to perform data backtracking during initialization. <code>autoLookup</code>The default value is <code>true</code>. </p>\n<p> Multiple selection scenarios in the table require setting<code>popcollector</code>as grid,<code>multi</code>as true, and<code>checkRowKeys</code>as default selected data. <code>lock-scroll</code>Configure whether to disable the scrollbar when a pop-up window appears.</p >\n'
},
codeFiles: ['nest-grid-multi.vue']
},
Expand Down
4 changes: 4 additions & 0 deletions packages/vue/src/dialog-select/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export default defineComponent({
mainHeight: {
type: Number,
default: 290
},
lockScroll: {
type: Boolean,
default: true
}
},
setup(props, context) {
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/dialog-select/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
modal-append-to-body
:close-on-press-escape="false"
:close-on-click-modal="false"
:lock-scroll="lockScroll"
v-bind="dialogOp"
@open="$emit('open', $event)"
@close="$emit('close', $event)"
Expand Down Expand Up @@ -216,7 +217,8 @@ export default defineComponent({
'beforeClose',
'autoLookup',
'lookupMethod',
'mainHeight'
'mainHeight',
'lockScroll'
Comment on lines +220 to +221
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add prop definition with type and default value.

The prop should be defined with proper type and default value to match the API documentation which specifies boolean type with default true.

Replace the string-based prop definition with an object-based definition:

-    'mainHeight',
-    'lockScroll'
+    'mainHeight',
+    {
+      name: 'lockScroll',
+      type: Boolean,
+      default: true
+    }

Or alternatively, define all props using the object syntax for better type safety and consistency.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'mainHeight',
'lockScroll'
'mainHeight',
{
name: 'lockScroll',
type: Boolean,
default: true
}
🤖 Prompt for AI Agents
In packages/vue/src/dialog-select/src/pc.vue at lines 220 to 221, the props
'mainHeight' and 'lockScroll' are currently defined as strings without type or
default values. Update the prop definitions to use the object syntax, specifying
the type as Boolean and setting the default value to true, to align with the API
documentation and improve type safety and consistency.

],
components: {
TinyDialogBox: DialogBox,
Expand Down
Loading