jenesius-vue-modal
Advanced tools
Comparing version 1.1.7 to 1.2.0
{ | ||
"name": "jenesius-vue-modal", | ||
"version": "1.1.7", | ||
"version": "1.2.0", | ||
"private": false, | ||
"description": "Simple modal plugin for Vue3", | ||
"author": "Jenesius", | ||
"main": "plugin-dist/jenesius-vue-modal.cjs.js", | ||
"main": "dist/jenesius-vue-modal.cjs.js", | ||
"scripts": { | ||
@@ -19,3 +15,3 @@ "serve": "vue-cli-service serve", | ||
"files": [ | ||
"plugin-dist/jenesius-vue-modal.cjs.js", | ||
"dist/jenesius-vue-modal.cjs.js", | ||
"README.MD" | ||
@@ -28,6 +24,8 @@ ], | ||
"@babel/core": "^7.15.0", | ||
"@babel/plugin-proposal-throw-expressions": "^7.14.5", | ||
"@babel/plugin-transform-modules-commonjs": "^7.15.0", | ||
"@babel/preset-env": "^7.15.0", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^20.0.0", | ||
"@vue/cli-plugin-babel": "~4.5.0", | ||
"@vue/cli-plugin-babel": "^4.5.13", | ||
"@vue/cli-plugin-eslint": "~4.5.0", | ||
@@ -34,0 +32,0 @@ "@vue/cli-plugin-unit-jest": "^4.5.13", |
@@ -70,7 +70,12 @@ # Jenesius Vue Modal | ||
--- | ||
Versions is higher than 1.2.0 **NOT support** 'next'. Now **All** hooks use only returned value(Boolean) for navigation hooks. | ||
If function return **false** or throwing an Error modal window will not be closed. | ||
--- | ||
- onclose | ||
```js | ||
const modal = await openModal(Modal); | ||
modal.onclose = (next) => { | ||
modal.onclose = () => { | ||
console.log("Close"); | ||
return false; //Modal will not be closed | ||
} | ||
@@ -84,4 +89,8 @@ ``` | ||
props: {}, | ||
beforeModalClose(next){ | ||
console.log("Close") | ||
data: () => ({isValidate: false}), | ||
beforeModalClose(){ | ||
console.log("Close"); | ||
if (!isValidate) return false; //modal will not be closed while isValidate === false | ||
} | ||
@@ -94,4 +103,4 @@ } | ||
setup() { | ||
onBeforeModalClose(next => { | ||
console.log("Close") | ||
onBeforeModalClose(() => { | ||
console.log("Close"); | ||
}); | ||
@@ -102,11 +111,3 @@ } | ||
First parameter of each hook is `next` - callback can be run with `false` value for stop closing a modal window. | ||
```js | ||
export default { | ||
props: {}, | ||
beforeModalClose(next){ | ||
next(false); // This modal can not be closed! | ||
} | ||
} | ||
``` | ||
### Async/Await | ||
@@ -116,8 +117,18 @@ | ||
```js | ||
async beforeModalClose(next){ | ||
async beforeModalClose(){ | ||
await doSome(); | ||
next(true); // This modal can not be closed! | ||
return false; // This modal can not be closed! | ||
} | ||
``` | ||
or | ||
```js | ||
beforeModalClose(){ | ||
return Promise(resolve => { | ||
setTimeout(() => resolve(true), 2000); //Modal will closed after 2 second | ||
}) | ||
} | ||
``` | ||
# Example VueModalComponent | ||
@@ -124,0 +135,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22124
438
157
23
1