From 8381e146d44e37884e14659f3db450eaf507d545 Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 14 Feb 2024 22:12:56 +0800 Subject: [PATCH 1/2] chore: bump 4.5.3 --- docs/package.json | 2 +- examples/nuxt3/package.json | 2 +- examples/vue3/package.json | 2 +- packages/nuxt/package.json | 2 +- packages/vue-final-modal/package.json | 2 +- pnpm-lock.yaml | 27 ++++++++++----------------- viteplay/package.json | 2 +- 7 files changed, 16 insertions(+), 23 deletions(-) diff --git a/docs/package.json b/docs/package.json index 5f8b17ff..fce3b1ce 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,7 +16,7 @@ "dependencies": { "@vorms/core": "^1.1.0", "@vue-final-modal/nuxt": "workspace:1.0.3", - "vue-final-modal": "workspace:4.5.2", + "vue-final-modal": "workspace:4.5.3", "vue3-drag-resize": "^2.0.5" } } diff --git a/examples/nuxt3/package.json b/examples/nuxt3/package.json index 35fc55cb..60c63d20 100644 --- a/examples/nuxt3/package.json +++ b/examples/nuxt3/package.json @@ -15,6 +15,6 @@ }, "dependencies": { "@vue-final-modal/nuxt": "^1.0.3", - "vue-final-modal": "^4.5.2" + "vue-final-modal": "^4.5.3" } } diff --git a/examples/vue3/package.json b/examples/vue3/package.json index 74f03111..c702d9bc 100644 --- a/examples/vue3/package.json +++ b/examples/vue3/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "vue": "^3.3.7", - "vue-final-modal": "^4.5.2" + "vue-final-modal": "^4.5.3" }, "devDependencies": { "@iconify/vue": "^4.1.1", diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index ab9533b5..ff648f2c 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@nuxt/kit": "^3.8.2", - "vue-final-modal": "^4.5.2" + "vue-final-modal": "^4.5.3" }, "devDependencies": { "@nuxt/module-builder": "^0.5.4", diff --git a/packages/vue-final-modal/package.json b/packages/vue-final-modal/package.json index 8e18eca8..7a23ac02 100644 --- a/packages/vue-final-modal/package.json +++ b/packages/vue-final-modal/package.json @@ -38,7 +38,7 @@ "@cypress/vue": "^5.0.5", "@release-it/conventional-changelog": "^5.1.1", "@vue-macros/volar": "^0.8.4", - "cypress": "^13.6.0", + "cypress": "^13.6.4", "release-it": "^16.1.3", "unplugin-vue-define-options": "^1.3.8", "unplugin-vue-macros": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13ca57fd..62a82718 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: specifier: workspace:1.0.3 version: link:../packages/nuxt vue-final-modal: - specifier: workspace:4.5.1 + specifier: workspace:4.5.3 version: link:../packages/vue-final-modal vue3-drag-resize: specifier: ^2.0.5 @@ -71,7 +71,7 @@ importers: specifier: ^3.8.2 version: 3.8.2(rollup@3.29.4) vue-final-modal: - specifier: ^4.5.1 + specifier: ^4.5.3 version: link:../vue-final-modal devDependencies: '@nuxt/module-builder': @@ -106,7 +106,7 @@ importers: devDependencies: '@cypress/vue': specifier: ^5.0.5 - version: 5.0.5(cypress@13.6.0)(vue@3.3.9) + version: 5.0.5(cypress@13.6.4)(vue@3.3.9) '@release-it/conventional-changelog': specifier: ^5.1.1 version: 5.1.1(release-it@16.2.1) @@ -114,8 +114,8 @@ importers: specifier: ^0.8.4 version: 0.8.4(@vue-macros/reactivity-transform@0.2.4)(vue-tsc@1.8.20)(vue@3.3.9) cypress: - specifier: ^13.6.0 - version: 13.6.0 + specifier: ^13.6.4 + version: 13.6.4 release-it: specifier: ^16.1.3 version: 16.2.1(typescript@5.3.3) @@ -138,7 +138,7 @@ importers: specifier: ^3.3.7 version: 3.3.9(typescript@5.3.3) vue-final-modal: - specifier: workspace:4.5.1 + specifier: workspace:4.5.3 version: link:../packages/vue-final-modal vue-router: specifier: ^4.2.5 @@ -1014,7 +1014,7 @@ packages: uuid: 8.3.2 dev: true - /@cypress/vue@5.0.5(cypress@13.6.0)(vue@3.3.9): + /@cypress/vue@5.0.5(cypress@13.6.4)(vue@3.3.9): resolution: {integrity: sha512-gjE0LKixK6XT4lPDFaEc8G6qNzm8YELgmbOiMVDxbVMuTtjYjorWQcIgzQ62uBX90/s7JrldXJ0W23gskoH4Ng==} engines: {node: '>=8'} peerDependencies: @@ -1025,7 +1025,7 @@ packages: '@cypress/webpack-dev-server': optional: true dependencies: - cypress: 13.6.0 + cypress: 13.6.4 vue: 3.3.9(typescript@5.3.3) dev: true @@ -3473,12 +3473,6 @@ packages: resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} dev: true - /@types/node@18.18.13: - resolution: {integrity: sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g==} - dependencies: - undici-types: 5.26.5 - dev: true - /@types/node@20.10.4: resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} dependencies: @@ -6848,15 +6842,14 @@ packages: /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} - /cypress@13.6.0: - resolution: {integrity: sha512-quIsnFmtj4dBUEJYU4OH0H12bABJpSujvWexC24Ju1gTlKMJbeT6tTO0vh7WNfiBPPjoIXLN+OUqVtiKFs6SGw==} + /cypress@13.6.4: + resolution: {integrity: sha512-pYJjCfDYB+hoOoZuhysbbYhEmNW7DEDsqn+ToCLwuVowxUXppIWRr7qk4TVRIU471ksfzyZcH+mkoF0CQUKnpw==} engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0} hasBin: true requiresBuild: true dependencies: '@cypress/request': 3.0.1 '@cypress/xvfb': 1.2.4(supports-color@8.1.1) - '@types/node': 18.18.13 '@types/sinonjs__fake-timers': 8.1.1 '@types/sizzle': 2.3.3 arch: 2.2.0 diff --git a/viteplay/package.json b/viteplay/package.json index 62cab4fc..268145e3 100644 --- a/viteplay/package.json +++ b/viteplay/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "vue": "^3.3.7", - "vue-final-modal": "workspace:4.5.2", + "vue-final-modal": "workspace:4.5.3", "vue-router": "^4.2.5" }, "devDependencies": { From 175b5abf6e19b88bb2d8053d50453b381ea32848 Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 14 Feb 2024 22:14:22 +0800 Subject: [PATCH 2/2] fix: #424 --- .../components/ModalCloseByScopedSlot.vue | 11 ++++++++ .../cypress/components/scopedSlot.spec.ts | 26 +++++++++++++++++++ .../VueFinalModal/VueFinalModal.vue | 9 +++++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue create mode 100644 packages/vue-final-modal/cypress/components/scopedSlot.spec.ts diff --git a/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue b/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue new file mode 100644 index 00000000..5a29d139 --- /dev/null +++ b/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue @@ -0,0 +1,11 @@ + + + diff --git a/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts b/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts new file mode 100644 index 00000000..e425776f --- /dev/null +++ b/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts @@ -0,0 +1,26 @@ +import App from './App.vue' +import ModalCloseByScopedSlot from './ModalCloseByScopedSlot.vue' +import { createVfm, useModal } from '~/index' + +describe('Test scopedSlot', () => { + it('close() scoped slot ', () => { + const vfm = createVfm() + const modalName = 'modal-close-by-scoped-slot' + useModal({ + defaultModelValue: true, + component: ModalCloseByScopedSlot, + attrs: { class: modalName }, + }) + + cy.mount(App, { + global: { + plugins: [vfm], + stubs: { transition: false }, + }, + }).as('app') + + cy.get(`.${modalName}`).should('exist') + cy.get(`.${modalName}`).find('button').click() + cy.get(`.${modalName}`).should('not.exist') + }) +}) diff --git a/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue b/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue index df66c455..061b7354 100644 --- a/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue +++ b/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue @@ -35,7 +35,7 @@ defineOptions({ inheritAttrs: false }) const instance = getCurrentInstance() defineSlots<{ - 'default'?(props: { close: () => boolean }): void + 'default'?(props: { close: () => void }): void 'swipe-banner'?(): void }>() @@ -135,6 +135,11 @@ function close(): boolean { return true } +/** Close function for scoped slot */ +function _close() { + modelValueLocal.value = false +} + onBeforeUnmount(() => { enableBodyScroll() arrayRemoveItem(modals, instance) @@ -223,7 +228,7 @@ defineExpose({ v-bind="bindSwipe" @mousedown="() => onMousedown()" > - +