diff --git a/README.md b/README.md index ac34c5e..c23f77e 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ type WinBoxPropType = { width?: string | number, fullscreen?: boolean, // a wrapper prop for fullscreen() method - onclose?: (force?: boolean) => boolean | undefined | void, + onclose?: (force: boolean) => boolean | undefined | void, onmove?: (x: number, y: number) => any, onresize?: (width: number, height: number) => any, onblur?: () => any, diff --git a/dist/index.d.ts b/dist/index.d.ts index 409df33..56741d8 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -40,10 +40,10 @@ export declare type WinBoxPropType = { * * see the following document for more detail about the argument and the return value. * @see https://github.com/nextapps-de/winbox - * @param force whether you should not abort the winbox to close. + * @param force Whether you should not abort the winbox to close. If this is true, you MUST return false, or some problems will happen. * @return noDefaultClose - true if the winbox does not need the default close process, for example, when it needs a confirmation to close instead of being closed suddenly. */ - onclose?: (force?: boolean) => boolean | undefined | void; + onclose?: (force: boolean) => boolean | undefined | void; onmove?: (x: number, y: number) => any; onresize?: (width: number, height: number) => any; onblur?: () => any; diff --git a/dist/index.js b/dist/index.js index 3a3eed2..4a22876 100644 --- a/dist/index.js +++ b/dist/index.js @@ -139,7 +139,7 @@ var WinBox = /** @class */ (function (_super) { throw 'duplicated window id'; this.winBoxObj = new winbox_1.default(__assign(__assign({ width: 300, height: 200, top: 0, bottom: 0, left: 0, right: 0 }, this.props), { class: "".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : ''), onclose: function (force) { var _a, _b; - if ((_b = (_a = _this.props).onclose) === null || _b === void 0 ? void 0 : _b.call(_a, force)) { + if ((_b = (_a = _this.props).onclose) === null || _b === void 0 ? void 0 : _b.call(_a, force !== null && force !== void 0 ? force : false)) { return true; } _this.handleClose(); // only when false, do close process. diff --git a/package-lock.json b/package-lock.json index 993f60e..3e41ab1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-winbox", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-winbox", - "version": "1.4.1", + "version": "1.4.2", "license": "MIT", "dependencies": { "winbox": "^0.2.1" diff --git a/package.json b/package.json index 1d45333..6f618db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-winbox", - "version": "1.4.1", + "version": "1.4.2", "description": "The React component for WinBox.js. Full Reactful props and state. A window manager for React", "private": false, "homepage": "https://github.com/rickonono3/react-winbox", diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..e6c8528 --- /dev/null +++ b/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash +yarn install +npm install +npm run build +git add . +git commit -m "publish from $(date +'%Y-%m-%d %H:%M:%S')" +npm version patch +npm publish +git push