🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@uiw/react-split

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-split - npm Package Compare versions

Comparing version

to
5.9.0

@@ -55,3 +55,3 @@ import React from 'react';

onDragEnd(): void;
render(): JSX.Element;
render(): import("react/jsx-runtime").JSX.Element;
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {

@@ -9,33 +8,18 @@ value: true

exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["prefixCls", "className", "children", "mode", "visiable", "renderBar", "lineBar", "disable", "onDragEnd", "onDragging"];
var Split = /*#__PURE__*/function (_React$Component) {
(0, _inherits2.default)(Split, _React$Component);
var _super = (0, _createSuper2.default)(Split);
function Split(props) {
var _this;
(0, _classCallCheck2.default)(this, Split);

@@ -64,3 +48,2 @@ _this = _super.call(this, props);

}
(0, _createClass2.default)(Split, [{

@@ -83,3 +66,2 @@ key: "componentWillUnmount",

}
this.paneNumber = paneNumber;

@@ -94,3 +76,2 @@ this.startX = env.clientX;

this.boxHeight = this.warpper.clientHeight;
if (prevTarget) {

@@ -100,3 +81,2 @@ this.preWidth = prevTarget.clientWidth;

}
if (nextTarget) {

@@ -106,3 +86,2 @@ this.nextWidth = nextTarget.clientWidth;

}
window.addEventListener('mousemove', this.onDragging);

@@ -120,3 +99,2 @@ window.addEventListener('mouseup', this.onDragEnd, false);

}
if (!this.state.dragging) {

@@ -127,6 +105,5 @@ this.setState({

}
var _this$props = this.props,
mode = _this$props.mode,
onDragging = _this$props.onDragging;
mode = _this$props.mode,
onDragging = _this$props.onDragging;
var nextTarget = this.target.nextElementSibling;

@@ -138,14 +115,10 @@ var prevTarget = this.target.previousElementSibling;

this.nextSize = 0;
if (mode === 'horizontal') {
this.preSize = this.preWidth + x > -1 ? this.preWidth + x : 0;
this.nextSize = this.nextWidth - x > -1 ? this.nextWidth - x : 0;
if (this.preSize === 0 || this.nextSize === 0) {
return;
}
this.preSize = (this.preSize / this.boxWidth >= 1 ? 1 : this.preSize / this.boxWidth) * 100;
this.nextSize = (this.nextSize / this.boxWidth >= 1 ? 1 : this.nextSize / this.boxWidth) * 100;
if (prevTarget && nextTarget) {

@@ -156,3 +129,2 @@ prevTarget.style.width = "".concat(this.preSize, "%");

}
if (mode === 'vertical' && this.preHeight + y > -1 && this.nextHeight - y > -1) {

@@ -163,7 +135,5 @@ this.preSize = this.preHeight + y > -1 ? this.preHeight + y : 0;

this.nextSize = (this.nextSize / this.boxHeight >= 1 ? 1 : this.nextSize / this.boxHeight) * 100;
if (this.preSize === 0 || this.nextSize === 0) {
return;
}
if (prevTarget && nextTarget) {

@@ -174,3 +144,2 @@ prevTarget.style.height = "".concat(this.preSize, "%");

}
onDragging && onDragging(this.preSize, this.nextSize, this.paneNumber);

@@ -193,20 +162,17 @@ }

var _this2 = this;
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
className = _this$props2.className,
children = _this$props2.children,
mode = _this$props2.mode,
visiable = _this$props2.visiable,
renderBar = _this$props2.renderBar,
lineBar = _this$props2.lineBar,
disable = _this$props2.disable,
onDragEnd = _this$props2.onDragEnd,
onDragging = _this$props2.onDragging,
other = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
prefixCls = _this$props2.prefixCls,
className = _this$props2.className,
children = _this$props2.children,
mode = _this$props2.mode,
visiable = _this$props2.visiable,
renderBar = _this$props2.renderBar,
lineBar = _this$props2.lineBar,
disable = _this$props2.disable,
onDragEnd = _this$props2.onDragEnd,
onDragging = _this$props2.onDragging,
other = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
var dragging = this.state.dragging;
var cls = [prefixCls, className, "".concat(prefixCls, "-").concat(mode), dragging ? 'dragging' : null].filter(Boolean).join(' ').trim();
var child = _react.default.Children.toArray(children);
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({

@@ -227,9 +193,6 @@ className: cls

};
if (disable === true || disable && disable.includes(idx + 1)) {
barProps.className = [barProps.className, disable ? 'disable' : null].filter(Boolean).join(' ').trim();
}
var BarCom = null;
if (idx !== 0 && visiableBar && renderBar) {

@@ -244,3 +207,2 @@ BarCom = renderBar((0, _objectSpread2.default)((0, _objectSpread2.default)({}, barProps), {}, {

}
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {

@@ -255,3 +217,2 @@ children: [BarCom, /*#__PURE__*/_react.default.cloneElement(element, (0, _objectSpread2.default)({}, props))]

}(_react.default.Component);
exports.default = Split;

@@ -263,3 +224,2 @@ (0, _defineProperty2.default)(Split, "defaultProps", {

});
module.exports = exports.default;
//# sourceMappingURL=index.js.map
module.exports = exports.default;

@@ -15,3 +15,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

/***/ 638:
/***/ 11:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

@@ -35,3 +35,3 @@

/***/ 724:
/***/ 894:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

@@ -42,3 +42,3 @@

if (true) {
module.exports = __webpack_require__(638);
module.exports = __webpack_require__(11);
} else {}

@@ -135,4 +135,35 @@

;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {

@@ -148,3 +179,2 @@ Object.defineProperty(obj, key, {

}
return obj;

@@ -154,6 +184,4 @@ }

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -165,6 +193,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -179,3 +205,2 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;

@@ -189,3 +214,2 @@ }

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -196,3 +220,2 @@ key = sourceKeys[i];

}
return target;

@@ -206,6 +229,4 @@ }

var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {

@@ -218,3 +239,2 @@ key = sourceSymbolKeys[i];

}
return target;

@@ -229,2 +249,3 @@ }

;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
function _defineProperties(target, props) {

@@ -236,6 +257,5 @@ for (var i = 0; i < props.length; i++) {

if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {

@@ -254,3 +274,2 @@ if (protoProps) _defineProperties(Constructor.prototype, protoProps);

}
return self;

@@ -272,3 +291,2 @@ }

}
subClass.prototype = Object.create(superClass && superClass.prototype, {

@@ -298,3 +316,2 @@ constructor: {

if (typeof Proxy === "function") return true;
try {

@@ -307,12 +324,2 @@ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));

}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js

@@ -327,3 +334,2 @@

}
return _assertThisInitialized(self);

@@ -339,4 +345,3 @@ }

var Super = _getPrototypeOf(Derived),
result;
result;
if (hasNativeReflectConstruct) {

@@ -348,3 +353,2 @@ var NewTarget = _getPrototypeOf(this).constructor;

}
return _possibleConstructorReturn(this, result);

@@ -360,3 +364,3 @@ };

// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(724);
var jsx_runtime = __webpack_require__(894);
;// CONCATENATED MODULE: ./src/index.tsx

@@ -363,0 +367,0 @@ var _excluded=["prefixCls","className","children","mode","visiable","renderBar","lineBar","disable","onDragEnd","onDragging"];var Split=/*#__PURE__*/function(_React$Component){_inherits(Split,_React$Component);var _super=_createSuper(Split);function Split(props){var _this;_classCallCheck(this,Split);_this=_super.call(this,props);_this.state={dragging:false};_this.warpper=void 0;_this.paneNumber=void 0;_this.startX=void 0;_this.startY=void 0;_this.move=void 0;_this.target=void 0;_this.boxWidth=void 0;_this.boxHeight=void 0;_this.preWidth=void 0;_this.nextWidth=void 0;_this.preHeight=void 0;_this.nextHeight=void 0;_this.preSize=void 0;_this.nextSize=void 0;_this.onDragEnd=_this.onDragEnd.bind(_assertThisInitialized(_this));_this.onDragging=_this.onDragging.bind(_assertThisInitialized(_this));return _this;}_createClass(Split,[{key:"componentWillUnmount",value:function componentWillUnmount(){this.removeEvent();}},{key:"removeEvent",value:function removeEvent(){window.removeEventListener('mousemove',this.onDragging,false);window.removeEventListener('mouseup',this.onDragEnd,false);}},{key:"onMouseDown",value:function onMouseDown(paneNumber,env){if(!env.target||!this.warpper){return;}this.paneNumber=paneNumber;this.startX=env.clientX;this.startY=env.clientY;this.move=true;this.target=env.target.parentNode;var prevTarget=this.target.previousElementSibling;var nextTarget=this.target.nextElementSibling;this.boxWidth=this.warpper.clientWidth;this.boxHeight=this.warpper.clientHeight;if(prevTarget){this.preWidth=prevTarget.clientWidth;this.preHeight=prevTarget.clientHeight;}if(nextTarget){this.nextWidth=nextTarget.clientWidth;this.nextHeight=nextTarget.clientHeight;}window.addEventListener('mousemove',this.onDragging);window.addEventListener('mouseup',this.onDragEnd,false);this.setState({dragging:true});}},{key:"onDragging",value:function onDragging(env){if(!this.move){return;}if(!this.state.dragging){this.setState({dragging:true});}var _this$props=this.props,mode=_this$props.mode,onDragging=_this$props.onDragging;var nextTarget=this.target.nextElementSibling;var prevTarget=this.target.previousElementSibling;var x=env.clientX-this.startX;var y=env.clientY-this.startY;this.preSize=0;this.nextSize=0;if(mode==='horizontal'){this.preSize=this.preWidth+x>-1?this.preWidth+x:0;this.nextSize=this.nextWidth-x>-1?this.nextWidth-x:0;if(this.preSize===0||this.nextSize===0){return;}this.preSize=(this.preSize/this.boxWidth>=1?1:this.preSize/this.boxWidth)*100;this.nextSize=(this.nextSize/this.boxWidth>=1?1:this.nextSize/this.boxWidth)*100;if(prevTarget&&nextTarget){prevTarget.style.width="".concat(this.preSize,"%");nextTarget.style.width="".concat(this.nextSize,"%");}}if(mode==='vertical'&&this.preHeight+y>-1&&this.nextHeight-y>-1){this.preSize=this.preHeight+y>-1?this.preHeight+y:0;this.nextSize=this.nextHeight-y>-1?this.nextHeight-y:0;this.preSize=(this.preSize/this.boxHeight>=1?1:this.preSize/this.boxHeight)*100;this.nextSize=(this.nextSize/this.boxHeight>=1?1:this.nextSize/this.boxHeight)*100;if(this.preSize===0||this.nextSize===0){return;}if(prevTarget&&nextTarget){prevTarget.style.height="".concat(this.preSize,"%");nextTarget.style.height="".concat(this.nextSize,"%");}}onDragging&&onDragging(this.preSize,this.nextSize,this.paneNumber);}},{key:"onDragEnd",value:function onDragEnd(){var onDragEnd=this.props.onDragEnd;this.move=false;onDragEnd&&onDragEnd(this.preSize,this.nextSize,this.paneNumber);this.removeEvent();this.setState({dragging:false});}},{key:"render",value:function render(){var _this2=this;var _this$props2=this.props,prefixCls=_this$props2.prefixCls,className=_this$props2.className,children=_this$props2.children,mode=_this$props2.mode,visiable=_this$props2.visiable,renderBar=_this$props2.renderBar,lineBar=_this$props2.lineBar,disable=_this$props2.disable,onDragEnd=_this$props2.onDragEnd,onDragging=_this$props2.onDragging,other=_objectWithoutProperties(_this$props2,_excluded);var dragging=this.state.dragging;var cls=[prefixCls,className,"".concat(prefixCls,"-").concat(mode),dragging?'dragging':null].filter(Boolean).join(' ').trim();var child=external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.toArray(children);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2({className:cls},other),{},{ref:function ref(node){return _this2.warpper=node;},children:external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(child,function(element,idx){var props=Object.assign({},element.props,{className:["".concat(prefixCls,"-pane"),element.props.className].filter(Boolean).join(' ').trim(),style:_objectSpread2({},element.props.style)});var visiableBar=visiable===true||visiable&&visiable.includes(idx+1)||false;var barProps={className:["".concat(prefixCls,"-bar"),lineBar?"".concat(prefixCls,"-line-bar"):null,!lineBar?"".concat(prefixCls,"-large-bar"):null].filter(Boolean).join(' ').trim()};if(disable===true||disable&&disable.includes(idx+1)){barProps.className=[barProps.className,disable?'disable':null].filter(Boolean).join(' ').trim();}var BarCom=null;if(idx!==0&&visiableBar&&renderBar){BarCom=renderBar(_objectSpread2(_objectSpread2({},barProps),{},{onMouseDown:_this2.onMouseDown.bind(_this2,idx+1)}));}else if(idx!==0&&visiableBar){BarCom=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('div',_objectSpread2({},barProps),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{onMouseDown:_this2.onMouseDown.bind(_this2,idx+1)}));}return/*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment,{children:[BarCom,/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(element,_objectSpread2({},props))]},idx);})}));}}]);return Split;}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component);Split.defaultProps={prefixCls:'w-split',visiable:true,mode:'horizontal'};

/*! For license information please see split.min.js.LICENSE.txt */
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("react")):"function"===typeof define&&define.amd?define(["react"],t):"object"===typeof exports?exports["@uiw/react-split"]=t(require("react")):e["@uiw/react-split"]=t(e.React)}(self,(e=>(()=>{"use strict";var t={638:(e,t,r)=>{var i=r(787),n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var i,o={},l=null,u=null;for(i in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,i)&&!c.hasOwnProperty(i)&&(o[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===o[i]&&(o[i]=t[i]);return{$$typeof:n,type:e,key:l,ref:u,props:o,_owner:a.current}}t.jsx=l,t.jsxs=l},724:(e,t,r)=>{e.exports=r(638)},787:t=>{t.exports=e}},r={};function i(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function r(r){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}function o(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},o=Object.keys(e);for(i=0;i<o.length;i++)r=o[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function h(e,t){if(t&&("object"===u(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function p(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=l(e);if(t){var n=l(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return h(this,r)}}i.r(n),i.d(n,{default:()=>y});var f=i(787),d=i.n(f),g=i(724),b=["prefixCls","className","children","mode","visiable","renderBar","lineBar","disable","onDragEnd","onDragging"],y=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(u,e);var t,i,n,l=p(u);function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=l.call(this,e)).state={dragging:!1},t.warpper=void 0,t.paneNumber=void 0,t.startX=void 0,t.startY=void 0,t.move=void 0,t.target=void 0,t.boxWidth=void 0,t.boxHeight=void 0,t.preWidth=void 0,t.nextWidth=void 0,t.preHeight=void 0,t.nextHeight=void 0,t.preSize=void 0,t.nextSize=void 0,t.onDragEnd=t.onDragEnd.bind(a(t)),t.onDragging=t.onDragging.bind(a(t)),t}return t=u,(i=[{key:"componentWillUnmount",value:function(){this.removeEvent()}},{key:"removeEvent",value:function(){window.removeEventListener("mousemove",this.onDragging,!1),window.removeEventListener("mouseup",this.onDragEnd,!1)}},{key:"onMouseDown",value:function(e,t){if(t.target&&this.warpper){this.paneNumber=e,this.startX=t.clientX,this.startY=t.clientY,this.move=!0,this.target=t.target.parentNode;var r=this.target.previousElementSibling,i=this.target.nextElementSibling;this.boxWidth=this.warpper.clientWidth,this.boxHeight=this.warpper.clientHeight,r&&(this.preWidth=r.clientWidth,this.preHeight=r.clientHeight),i&&(this.nextWidth=i.clientWidth,this.nextHeight=i.clientHeight),window.addEventListener("mousemove",this.onDragging),window.addEventListener("mouseup",this.onDragEnd,!1),this.setState({dragging:!0})}}},{key:"onDragging",value:function(e){if(this.move){this.state.dragging||this.setState({dragging:!0});var t=this.props,r=t.mode,i=t.onDragging,n=this.target.nextElementSibling,o=this.target.previousElementSibling,s=e.clientX-this.startX,a=e.clientY-this.startY;if(this.preSize=0,this.nextSize=0,"horizontal"===r){if(this.preSize=this.preWidth+s>-1?this.preWidth+s:0,this.nextSize=this.nextWidth-s>-1?this.nextWidth-s:0,0===this.preSize||0===this.nextSize)return;this.preSize=100*(this.preSize/this.boxWidth>=1?1:this.preSize/this.boxWidth),this.nextSize=100*(this.nextSize/this.boxWidth>=1?1:this.nextSize/this.boxWidth),o&&n&&(o.style.width="".concat(this.preSize,"%"),n.style.width="".concat(this.nextSize,"%"))}if("vertical"===r&&this.preHeight+a>-1&&this.nextHeight-a>-1){if(this.preSize=this.preHeight+a>-1?this.preHeight+a:0,this.nextSize=this.nextHeight-a>-1?this.nextHeight-a:0,this.preSize=100*(this.preSize/this.boxHeight>=1?1:this.preSize/this.boxHeight),this.nextSize=100*(this.nextSize/this.boxHeight>=1?1:this.nextSize/this.boxHeight),0===this.preSize||0===this.nextSize)return;o&&n&&(o.style.height="".concat(this.preSize,"%"),n.style.height="".concat(this.nextSize,"%"))}i&&i(this.preSize,this.nextSize,this.paneNumber)}}},{key:"onDragEnd",value:function(){var e=this.props.onDragEnd;this.move=!1,e&&e(this.preSize,this.nextSize,this.paneNumber),this.removeEvent(),this.setState({dragging:!1})}},{key:"render",value:function(){var e=this,t=this.props,i=t.prefixCls,n=t.className,s=t.children,a=t.mode,c=t.visiable,l=t.renderBar,u=t.lineBar,h=t.disable,p=(t.onDragEnd,t.onDragging,o(t,b)),f=this.state.dragging,y=[i,n,"".concat(i,"-").concat(a),f?"dragging":null].filter(Boolean).join(" ").trim(),v=d().Children.toArray(s);return(0,g.jsx)("div",r(r({className:y},p),{},{ref:function(t){return e.warpper=t},children:d().Children.map(v,(function(t,n){var o=Object.assign({},t.props,{className:["".concat(i,"-pane"),t.props.className].filter(Boolean).join(" ").trim(),style:r({},t.props.style)}),s=!0===c||c&&c.includes(n+1)||!1,a={className:["".concat(i,"-bar"),u?"".concat(i,"-line-bar"):null,u?null:"".concat(i,"-large-bar")].filter(Boolean).join(" ").trim()};(!0===h||h&&h.includes(n+1))&&(a.className=[a.className,h?"disable":null].filter(Boolean).join(" ").trim());var p=null;return 0!==n&&s&&l?p=l(r(r({},a),{},{onMouseDown:e.onMouseDown.bind(e,n+1)})):0!==n&&s&&(p=d().createElement("div",r({},a),(0,g.jsx)("div",{onMouseDown:e.onMouseDown.bind(e,n+1)}))),(0,g.jsxs)(d().Fragment,{children:[p,d().cloneElement(t,r({},o))]},n)}))}))}}])&&s(t.prototype,i),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),u}(d().Component);y.defaultProps={prefixCls:"w-split",visiable:!0,mode:"horizontal"}})(),n})()));
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("react")):"function"===typeof define&&define.amd?define(["react"],t):"object"===typeof exports?exports["@uiw/react-split"]=t(require("react")):e["@uiw/react-split"]=t(e.React)}(self,(e=>(()=>{"use strict";var t={11:(e,t,r)=>{var i=r(787),n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var i,o={},c=null,u=null;for(i in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,i)&&!l.hasOwnProperty(i)&&(o[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===o[i]&&(o[i]=t[i]);return{$$typeof:n,type:e,key:c,ref:u,props:o,_owner:a.current}}t.jsx=c,t.jsxs=c},894:(e,t,r)=>{e.exports=r(11)},787:t=>{t.exports=e}},r={};function i(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var r=function(t,r){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===e(r)?r:String(r)}function r(e,r,i){return(r=t(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function a(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},o=Object.keys(e);for(i=0;i<o.length;i++)r=o[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function l(e,r){for(var i=0;i<r.length;i++){var n=r[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,t(n.key),n)}}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function p(t){var r=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=h(t);if(r){var o=h(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,r){if(r&&("object"===e(r)||"function"===typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}(this,i)}}i.r(n),i.d(n,{default:()=>y});var f=i(787),d=i.n(f),g=i(894),b=["prefixCls","className","children","mode","visiable","renderBar","lineBar","disable","onDragEnd","onDragging"],y=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(o,e);var t,r,i,n=p(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=n.call(this,e)).state={dragging:!1},t.warpper=void 0,t.paneNumber=void 0,t.startX=void 0,t.startY=void 0,t.move=void 0,t.target=void 0,t.boxWidth=void 0,t.boxHeight=void 0,t.preWidth=void 0,t.nextWidth=void 0,t.preHeight=void 0,t.nextHeight=void 0,t.preSize=void 0,t.nextSize=void 0,t.onDragEnd=t.onDragEnd.bind(c(t)),t.onDragging=t.onDragging.bind(c(t)),t}return t=o,(r=[{key:"componentWillUnmount",value:function(){this.removeEvent()}},{key:"removeEvent",value:function(){window.removeEventListener("mousemove",this.onDragging,!1),window.removeEventListener("mouseup",this.onDragEnd,!1)}},{key:"onMouseDown",value:function(e,t){if(t.target&&this.warpper){this.paneNumber=e,this.startX=t.clientX,this.startY=t.clientY,this.move=!0,this.target=t.target.parentNode;var r=this.target.previousElementSibling,i=this.target.nextElementSibling;this.boxWidth=this.warpper.clientWidth,this.boxHeight=this.warpper.clientHeight,r&&(this.preWidth=r.clientWidth,this.preHeight=r.clientHeight),i&&(this.nextWidth=i.clientWidth,this.nextHeight=i.clientHeight),window.addEventListener("mousemove",this.onDragging),window.addEventListener("mouseup",this.onDragEnd,!1),this.setState({dragging:!0})}}},{key:"onDragging",value:function(e){if(this.move){this.state.dragging||this.setState({dragging:!0});var t=this.props,r=t.mode,i=t.onDragging,n=this.target.nextElementSibling,o=this.target.previousElementSibling,s=e.clientX-this.startX,a=e.clientY-this.startY;if(this.preSize=0,this.nextSize=0,"horizontal"===r){if(this.preSize=this.preWidth+s>-1?this.preWidth+s:0,this.nextSize=this.nextWidth-s>-1?this.nextWidth-s:0,0===this.preSize||0===this.nextSize)return;this.preSize=100*(this.preSize/this.boxWidth>=1?1:this.preSize/this.boxWidth),this.nextSize=100*(this.nextSize/this.boxWidth>=1?1:this.nextSize/this.boxWidth),o&&n&&(o.style.width="".concat(this.preSize,"%"),n.style.width="".concat(this.nextSize,"%"))}if("vertical"===r&&this.preHeight+a>-1&&this.nextHeight-a>-1){if(this.preSize=this.preHeight+a>-1?this.preHeight+a:0,this.nextSize=this.nextHeight-a>-1?this.nextHeight-a:0,this.preSize=100*(this.preSize/this.boxHeight>=1?1:this.preSize/this.boxHeight),this.nextSize=100*(this.nextSize/this.boxHeight>=1?1:this.nextSize/this.boxHeight),0===this.preSize||0===this.nextSize)return;o&&n&&(o.style.height="".concat(this.preSize,"%"),n.style.height="".concat(this.nextSize,"%"))}i&&i(this.preSize,this.nextSize,this.paneNumber)}}},{key:"onDragEnd",value:function(){var e=this.props.onDragEnd;this.move=!1,e&&e(this.preSize,this.nextSize,this.paneNumber),this.removeEvent(),this.setState({dragging:!1})}},{key:"render",value:function(){var e=this,t=this.props,r=t.prefixCls,i=t.className,n=t.children,o=t.mode,l=t.visiable,c=t.renderBar,u=t.lineBar,h=t.disable,p=(t.onDragEnd,t.onDragging,a(t,b)),f=this.state.dragging,y=[r,i,"".concat(r,"-").concat(o),f?"dragging":null].filter(Boolean).join(" ").trim(),v=d().Children.toArray(n);return(0,g.jsx)("div",s(s({className:y},p),{},{ref:function(t){return e.warpper=t},children:d().Children.map(v,(function(t,i){var n=Object.assign({},t.props,{className:["".concat(r,"-pane"),t.props.className].filter(Boolean).join(" ").trim(),style:s({},t.props.style)}),o=!0===l||l&&l.includes(i+1)||!1,a={className:["".concat(r,"-bar"),u?"".concat(r,"-line-bar"):null,u?null:"".concat(r,"-large-bar")].filter(Boolean).join(" ").trim()};(!0===h||h&&h.includes(i+1))&&(a.className=[a.className,h?"disable":null].filter(Boolean).join(" ").trim());var p=null;return 0!==i&&o&&c?p=c(s(s({},a),{},{onMouseDown:e.onMouseDown.bind(e,i+1)})):0!==i&&o&&(p=d().createElement("div",s({},a),(0,g.jsx)("div",{onMouseDown:e.onMouseDown.bind(e,i+1)}))),(0,g.jsxs)(d().Fragment,{children:[p,d().cloneElement(t,s({},n))]},i)}))}))}}])&&l(t.prototype,r),i&&l(t,i),Object.defineProperty(t,"prototype",{writable:!1}),o}(d().Component);y.defaultProps={prefixCls:"w-split",visiable:!0,mode:"horizontal"}})(),n})()));

@@ -55,3 +55,3 @@ import React from 'react';

onDragEnd(): void;
render(): JSX.Element;
render(): import("react/jsx-runtime").JSX.Element;
}

@@ -31,7 +31,5 @@ import _extends from "@babel/runtime/helpers/extends";

}
componentWillUnmount() {
this.removeEvent();
}
removeEvent() {

@@ -41,3 +39,2 @@ window.removeEventListener('mousemove', this.onDragging, false);

}
onMouseDown(paneNumber, env) {

@@ -47,3 +44,2 @@ if (!env.target || !this.warpper) {

}
this.paneNumber = paneNumber;

@@ -58,3 +54,2 @@ this.startX = env.clientX;

this.boxHeight = this.warpper.clientHeight;
if (prevTarget) {

@@ -64,3 +59,2 @@ this.preWidth = prevTarget.clientWidth;

}
if (nextTarget) {

@@ -70,3 +64,2 @@ this.nextWidth = nextTarget.clientWidth;

}
window.addEventListener('mousemove', this.onDragging);

@@ -78,3 +71,2 @@ window.addEventListener('mouseup', this.onDragEnd, false);

}
onDragging(env) {

@@ -84,3 +76,2 @@ if (!this.move) {

}
if (!this.state.dragging) {

@@ -91,3 +82,2 @@ this.setState({

}
var {

@@ -103,14 +93,10 @@ mode,

this.nextSize = 0;
if (mode === 'horizontal') {
this.preSize = this.preWidth + x > -1 ? this.preWidth + x : 0;
this.nextSize = this.nextWidth - x > -1 ? this.nextWidth - x : 0;
if (this.preSize === 0 || this.nextSize === 0) {
return;
}
this.preSize = (this.preSize / this.boxWidth >= 1 ? 1 : this.preSize / this.boxWidth) * 100;
this.nextSize = (this.nextSize / this.boxWidth >= 1 ? 1 : this.nextSize / this.boxWidth) * 100;
if (prevTarget && nextTarget) {

@@ -121,3 +107,2 @@ prevTarget.style.width = this.preSize + "%";

}
if (mode === 'vertical' && this.preHeight + y > -1 && this.nextHeight - y > -1) {

@@ -128,7 +113,5 @@ this.preSize = this.preHeight + y > -1 ? this.preHeight + y : 0;

this.nextSize = (this.nextSize / this.boxHeight >= 1 ? 1 : this.nextSize / this.boxHeight) * 100;
if (this.preSize === 0 || this.nextSize === 0) {
return;
}
if (prevTarget && nextTarget) {

@@ -139,6 +122,4 @@ prevTarget.style.height = this.preSize + "%";

}
onDragging && onDragging(this.preSize, this.nextSize, this.paneNumber);
}
onDragEnd() {

@@ -155,17 +136,15 @@ var {

}
render() {
var _this$props = this.props,
{
prefixCls,
className,
children,
mode,
visiable,
renderBar,
lineBar,
disable
} = _this$props,
other = _objectWithoutPropertiesLoose(_this$props, _excluded);
{
prefixCls,
className,
children,
mode,
visiable,
renderBar,
lineBar,
disable
} = _this$props,
other = _objectWithoutPropertiesLoose(_this$props, _excluded);
var {

@@ -189,9 +168,6 @@ dragging

};
if (disable === true || disable && disable.includes(idx + 1)) {
barProps.className = [barProps.className, disable ? 'disable' : null].filter(Boolean).join(' ').trim();
}
var BarCom = null;
if (idx !== 0 && visiableBar && renderBar) {

@@ -206,3 +182,2 @@ BarCom = renderBar(_extends({}, barProps, {

}
return /*#__PURE__*/_jsxs(React.Fragment, {

@@ -214,3 +189,2 @@ children: [BarCom, /*#__PURE__*/React.cloneElement(element, _extends({}, props))]

}
}

@@ -221,3 +195,2 @@ Split.defaultProps = {

mode: 'horizontal'
};
//# sourceMappingURL=index.js.map
};
{
"name": "@uiw/react-split",
"version": "5.8.10",
"version": "5.9.0",
"description": "A piece of content can be divided into areas that can be dragged to adjust the width or height.",

@@ -18,4 +18,4 @@ "main": "cjs/index.js",

"bundle:min": "ncc build src/index.tsx --target web --filename split --minify",
"watch": "tsbb watch & npm run css:watch",
"build": "tsbb build && npm run css:build && npm run css:build:dist",
"watch": "tsbb watch src/*.tsx --use-babel & npm run css:watch",
"build": "tsbb build src/*.tsx --use-babel && npm run css:build && npm run css:build:dist",
"test": "tsbb test",

@@ -44,21 +44,26 @@ "coverage": "tsbb test --coverage --bail",

"devDependencies": {
"@wcj/dark-mode": "^1.0.14",
"@kkt/less-modules": "^7.4.9",
"@kkt/ncc": "~1.0.8",
"@kkt/raw-modules": "^7.4.9",
"@kkt/scope-plugin-options": "^7.4.9",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@uiw/react-codepen": "^1.0.2",
"@uiw/react-codesandbox": "^1.1.5",
"@uiw/react-codepen": "^1.0.2",
"markdown-react-code-preview-loader": "^2.1.2",
"react-code-preview-layout": "^2.0.6",
"@kkt/less-modules": "~7.2.0",
"@kkt/ncc": "~1.0.8",
"@kkt/raw-modules": "~7.2.0",
"@kkt/scope-plugin-options": "~7.2.0",
"@types/react": "~18.0.15",
"@types/react-dom": "~18.0.6",
"@uiw/react-github-corners": "~1.5.3",
"@uiw/react-markdown-preview": "~4.0.22",
"@uiw/react-markdown-preview": "~4.1.0",
"@uiw/reset.css": "~1.0.6",
"@wcj/dark-mode": "^1.0.14",
"compile-less-cli": "~1.8.11",
"kkt": "~7.2.0",
"goober": "^2.1.13",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.6.0",
"jest-environment-node": "^29.5.0",
"jest-watch-typeahead": "^2.2.2",
"kkt": "^7.4.9",
"markdown-react-code-preview-loader": "^2.1.2",
"react": "^18.2.0",
"react-code-preview-layout": "^3.0.0",
"react-dom": "^18.2.0",
"tsbb": "^3.7.6",
"tsbb": "^4.1.5",
"uiw": "^4.21.14"

@@ -65,0 +70,0 @@ },

@@ -342,3 +342,3 @@ Split 面板分割

render() {
const styl = {};
const styl = { lineHeight: 0 };
if (this.state.width === 0) {

@@ -345,0 +345,0 @@ styl.width = `0%`;

@@ -342,3 +342,3 @@ Split

render() {
const styl = {};
const styl = { lineHeight: 0 };
if (this.state.width === 0) {

@@ -469,3 +469,3 @@ styl.width = `0%`;

Made with [action-contributors](https://github.com/jaywcjlove/github-action-contributors).
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).

@@ -472,0 +472,0 @@ ### License

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet