@pinnacle0/web-ui 0.4.18 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
interface Props {
|
|
4
|
-
height: number;
|
|
5
|
-
width: number;
|
|
6
4
|
id?: string;
|
|
7
5
|
className?: string;
|
|
6
|
+
height: number;
|
|
7
|
+
width: number;
|
|
8
8
|
minHeight?: number;
|
|
9
9
|
minWidth?: number;
|
|
10
|
+
maxHeight?: number;
|
|
11
|
+
maxWidth?: number;
|
|
10
12
|
gap?: number;
|
|
11
13
|
children?: React.ReactNode;
|
|
12
14
|
}
|
package/core/Resizable/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Resizer } from "./Resizer";
|
|
|
3
3
|
import { classNames } from "../../util/ClassNames";
|
|
4
4
|
import "./index.less";
|
|
5
5
|
export var Resizable = React.forwardRef(function (_a, ref) {
|
|
6
|
-
var height = _a.height, width = _a.width, className = _a.className, id = _a.id, gap = _a.gap, children = _a.children, _b = _a.
|
|
6
|
+
var height = _a.height, width = _a.width, className = _a.className, id = _a.id, gap = _a.gap, children = _a.children, _b = _a.maxHeight, maxHeight = _b === void 0 ? window.innerHeight : _b, _c = _a.maxWidth, maxWidth = _c === void 0 ? window.innerWidth : _c, _d = _a.minHeight, minHeight = _d === void 0 ? 0 : _d, _e = _a.minWidth, minWidth = _e === void 0 ? 0 : _e;
|
|
7
7
|
var resizableDivRef = React.useRef(null);
|
|
8
8
|
var startRect = React.useRef({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
|
|
9
9
|
var combineRef = function (node) {
|
|
@@ -25,7 +25,7 @@ export var Resizable = React.forwardRef(function (_a, ref) {
|
|
|
25
25
|
var _a = startRect.current, top_2 = _a.top, height_2 = _a.height;
|
|
26
26
|
var deltaY = state.delta[1];
|
|
27
27
|
var transformedHeight = height_2 - deltaY;
|
|
28
|
-
if (transformedHeight < minHeight) {
|
|
28
|
+
if (transformedHeight < minHeight || transformedHeight > maxHeight) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
resizableDivRef.current.style.top = "".concat(top_2 + deltaY, "px");
|
|
@@ -36,7 +36,7 @@ export var Resizable = React.forwardRef(function (_a, ref) {
|
|
|
36
36
|
if (resizableDivRef.current) {
|
|
37
37
|
var width_2 = startRect.current.width;
|
|
38
38
|
var transformedWidth = width_2 + state.delta[0];
|
|
39
|
-
if (transformedWidth < minWidth) {
|
|
39
|
+
if (transformedWidth < minWidth || transformedWidth > maxWidth) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
resizableDivRef.current.style.width = "".concat(transformedWidth, "px");
|
|
@@ -46,7 +46,7 @@ export var Resizable = React.forwardRef(function (_a, ref) {
|
|
|
46
46
|
if (resizableDivRef.current) {
|
|
47
47
|
var height_3 = startRect.current.height;
|
|
48
48
|
var transformedHeight = height_3 + state.delta[1];
|
|
49
|
-
if (transformedHeight < minHeight) {
|
|
49
|
+
if (transformedHeight < minHeight || transformedHeight > maxHeight) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
resizableDivRef.current.style.height = "".concat(transformedHeight, "px");
|
|
@@ -57,7 +57,7 @@ export var Resizable = React.forwardRef(function (_a, ref) {
|
|
|
57
57
|
var _a = startRect.current, left = _a.left, width_3 = _a.width;
|
|
58
58
|
var deltaX = state.delta[0];
|
|
59
59
|
var transformedWidth = width_3 - deltaX;
|
|
60
|
-
if (transformedWidth < minWidth) {
|
|
60
|
+
if (transformedWidth < minWidth || transformedWidth > maxWidth) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
resizableDivRef.current.style.left = "".concat(left + deltaX, "px");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Resizable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,M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AE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,GAAI;QAC5F,oBAAC,OAAO,IACJ,SAAS,EAAC,UAAU,EACpB,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAA,KAAK;gBACX,WAAW,CAAC,KAAK,CAAC,CAAC;gBACnB,YAAY,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC,GACH;QACD,QAAQ,CACP,CACT,CAAC;AACN,CAAC,CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinnacle0/web-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.19",
|
|
4
4
|
"author": "Pinnacle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"react-dom": "18.2.0",
|
|
53
53
|
"react-router-dom": "5.3.0",
|
|
54
54
|
"typescript": "4.9.4",
|
|
55
|
-
"@pinnacle0/devtool-util": "1.1
|
|
55
|
+
"@pinnacle0/devtool-util": "1.2.1",
|
|
56
56
|
"@pinnacle0/webpack-util": "0.4.45"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|