From 67cd7e95e66472ba58c55e720fe66b2bcbf86bd8 Mon Sep 17 00:00:00 2001 From: kooriookami <38392315+kooriookami@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:03:34 +0800 Subject: [PATCH] feat(components): [dialog] Dialog can drag overflow the viewport (#15643) * style(components): [dialog] Modify dialog style and docs * chore: update * feat(components): [dialog] add overflow prop * feat(components): update --- docs/en-US/component/dialog.md | 5 +- docs/examples/dialog/align-center.vue | 13 ++--- docs/examples/dialog/basic-usage.vue | 15 ++---- docs/examples/dialog/centered-content.vue | 13 ++--- .../examples/dialog/customization-content.vue | 35 ++++---------- docs/examples/dialog/customization-header.vue | 6 ++- docs/examples/dialog/destroy-on-close.vue | 13 ++--- docs/examples/dialog/draggable-dialog.vue | 33 +++++++++++-- docs/examples/dialog/focus-trapping.vue | 47 ------------------- docs/examples/dialog/nested-dialog.vue | 30 +++++------- .../components/dialog/src/dialog-content.ts | 11 ++--- .../components/dialog/src/dialog-content.vue | 9 ++-- packages/components/dialog/src/dialog.vue | 14 +----- .../drawer/__tests__/drawer.test.ts | 17 ------- packages/components/drawer/src/drawer.vue | 13 +---- packages/hooks/use-draggable/index.ts | 18 +++---- packages/theme-chalk/src/common/var.scss | 2 +- packages/theme-chalk/src/dialog.scss | 24 +++++----- 18 files changed, 110 insertions(+), 208 deletions(-) delete mode 100644 docs/examples/dialog/focus-trapping.vue diff --git a/docs/en-US/component/dialog.md b/docs/en-US/component/dialog.md index 40de4a12cc549..fbc9dbe9e7f7f 100644 --- a/docs/en-US/component/dialog.md +++ b/docs/en-US/component/dialog.md @@ -99,7 +99,7 @@ dialog/destroy-on-close Try to drag the `header` part. -:::demo Set `draggable` to `true` to drag. +:::demo Set `draggable` to `true` to drag. Set `overflow` ^(2.5.4) to `true` can drag overflow the viewport. dialog/draggable-dialog @@ -116,7 +116,7 @@ When using `modal` = false, please make sure that `append-to-body` was set to ** ### Attributes | Name | Description | Type | Default | -| -------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------- | ------- | +|----------------------------|------------------------------------------------------------------------------------------------------| ----------------------------------- | ------- | | model-value / v-model | visibility of Dialog | ^[boolean] | — | | title | title of Dialog. Can also be passed with a named slot (see the following table) | ^[string] | '' | | width | width of Dialog, default is 50% | ^[string] / ^[number] | '' | @@ -135,6 +135,7 @@ When using `modal` = false, please make sure that `append-to-body` was set to ** | show-close | whether to show a close button | ^[boolean] | true | | before-close | callback before Dialog closes, and it will prevent Dialog from closing, use done to close the dialog | ^[Function]`(done: DoneFn) => void` | — | | draggable | enable dragging feature for Dialog | ^[boolean] | false | +| overflow ^(2.5.4) | draggable Dialog can overflow the viewport | ^[boolean] | false | | center | whether to align the header and footer in center | ^[boolean] | false | | align-center ^(2.2.16) | whether to align the dialog both horizontally and vertically | ^[boolean] | false | | destroy-on-close | destroy elements in Dialog when closed | ^[boolean] | false | diff --git a/docs/examples/dialog/align-center.vue b/docs/examples/dialog/align-center.vue index 1474756062fd0..72a7acdff06a8 100644 --- a/docs/examples/dialog/align-center.vue +++ b/docs/examples/dialog/align-center.vue @@ -1,22 +1,22 @@ @@ -25,8 +25,3 @@ import { ref } from 'vue' const centerDialogVisible = ref(false) - diff --git a/docs/examples/dialog/basic-usage.vue b/docs/examples/dialog/basic-usage.vue index 1f337afe9e0f7..346b1f85c3473 100644 --- a/docs/examples/dialog/basic-usage.vue +++ b/docs/examples/dialog/basic-usage.vue @@ -1,22 +1,22 @@ @@ -37,8 +37,3 @@ const handleClose = (done: () => void) => { }) } - diff --git a/docs/examples/dialog/centered-content.vue b/docs/examples/dialog/centered-content.vue index 79df4943f6590..23c7c8fbefd08 100644 --- a/docs/examples/dialog/centered-content.vue +++ b/docs/examples/dialog/centered-content.vue @@ -1,20 +1,20 @@ @@ -23,8 +23,3 @@ import { ref } from 'vue' const centerDialogVisible = ref(false) - diff --git a/docs/examples/dialog/customization-content.vue b/docs/examples/dialog/customization-content.vue index bbccc0d485d97..67e771b0a9d08 100644 --- a/docs/examples/dialog/customization-content.vue +++ b/docs/examples/dialog/customization-content.vue @@ -1,9 +1,13 @@ @@ -80,17 +79,3 @@ const gridData = [ }, ] - diff --git a/docs/examples/dialog/customization-header.vue b/docs/examples/dialog/customization-header.vue index ba4502c44f37e..009c58b6ebdb6 100644 --- a/docs/examples/dialog/customization-header.vue +++ b/docs/examples/dialog/customization-header.vue @@ -1,8 +1,9 @@