@beisen-platform/tree
Advanced tools
Comparing version 0.2.4 to 1.0.0
@@ -1,38 +0,15 @@ | ||
"use strict"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/createClass"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; | ||
import _inherits from "@babel/runtime/helpers/inherits"; | ||
import "core-js/modules/es7.array.includes"; | ||
import "core-js/modules/es6.string.includes"; | ||
import React, { Component } from 'react'; | ||
import TreeItem from './TreeItem'; | ||
import './index.css'; | ||
import Loading from '@beisen-platform/loading'; | ||
import { deepClone } from '@beisen-platform/common-func'; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
require("core-js/modules/es7.array.includes"); | ||
require("core-js/modules/es6.string.includes"); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _TreeItem = _interopRequireDefault(require("./TreeItem")); | ||
require("./index.css"); | ||
var _loading = _interopRequireDefault(require("@beisen-platform/loading")); | ||
var _commonFunc = require("@beisen-platform/common-func"); | ||
if (!String.prototype.includes) { | ||
@@ -51,3 +28,3 @@ String.prototype.includes = function () { | ||
function (_Component) { | ||
(0, _inherits2.default)(Tree, _Component); | ||
_inherits(Tree, _Component); | ||
@@ -57,5 +34,6 @@ function Tree(props) { | ||
(0, _classCallCheck2.default)(this, Tree); | ||
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Tree).call(this, props)); | ||
_classCallCheck(this, Tree); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Tree).call(this, props)); | ||
_this.handleCheckBoxClick = function (e, dataPath) { | ||
@@ -156,3 +134,3 @@ //修改dataId数据的checked | ||
_this.transData = function (data1) { | ||
var data = (0, _commonFunc.deepClone)(data1); | ||
var data = deepClone(data1); | ||
var filter = [], | ||
@@ -196,3 +174,3 @@ getData = {}; | ||
(0, _createClass2.default)(Tree, [{ | ||
_createClass(Tree, [{ | ||
key: "componentWillUnmount", | ||
@@ -285,3 +263,3 @@ value: function componentWillUnmount() { | ||
var Li = filterData.map(function (data, index) { | ||
return _react.default.createElement(_TreeItem.default, (0, _extends2.default)({}, _this2.props, { | ||
return React.createElement(TreeItem, _extends({}, _this2.props, { | ||
treeData: treeData, | ||
@@ -303,3 +281,3 @@ hideLi: _this2.hideLi, | ||
}); | ||
var component = treeData.length == 0 ? _react.default.createElement("div", { | ||
var component = treeData.length == 0 ? React.createElement("div", { | ||
className: "us-no-data empty-con" | ||
@@ -309,5 +287,5 @@ }) : Li; | ||
if (hidden) { | ||
return _react.default.createElement("div", null); | ||
return React.createElement("div", null); | ||
} else { | ||
return _react.default.createElement("div", { | ||
return React.createElement("div", { | ||
ref: "BaseTree", | ||
@@ -317,5 +295,5 @@ className: "base-tree-component", | ||
onMouseOut: this.hoverMouseOut | ||
}, _react.default.createElement("div", { | ||
}, React.createElement("div", { | ||
className: "base-tree-view base-tree-style" | ||
}, _react.default.createElement("ul", null, isFetch ? _react.default.createElement("div", { | ||
}, React.createElement("ul", null, isFetch ? React.createElement("div", { | ||
style: { | ||
@@ -325,5 +303,5 @@ backgroundColor: "#FFF", | ||
} | ||
}, _react.default.createElement(_loading.default, { | ||
}, React.createElement(Loading, { | ||
type: "small" | ||
})) : component), _react.default.createElement("li", { | ||
})) : component), React.createElement("li", { | ||
className: "hover-style", | ||
@@ -333,3 +311,3 @@ style: { | ||
} | ||
}), _react.default.createElement("li", { | ||
}), React.createElement("li", { | ||
className: "click-style", | ||
@@ -345,9 +323,10 @@ style: { | ||
}]); | ||
return Tree; | ||
}(_react.Component); | ||
}(Component); | ||
exports.default = Tree; | ||
Tree.defaultProps = { | ||
initGetData: true, | ||
style: {} | ||
}; | ||
}; | ||
export { Tree as default }; |
@@ -1,42 +0,19 @@ | ||
"use strict"; | ||
import "core-js/modules/es6.function.name"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import "core-js/modules/es6.array.find-index"; | ||
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/createClass"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; | ||
import _inherits from "@babel/runtime/helpers/inherits"; | ||
import React, { Component } from 'react'; | ||
import ToolTip from "@beisen-platform/tool-tip"; | ||
import { clearToolTipDom, decode } from '@beisen-platform/common-func'; | ||
import FlodUpIcon from '@beisen-platform/react-icons/lib/icons/Foldup.js'; | ||
import SpreadIcon from '@beisen-platform/react-icons/lib/icons/Spread.js'; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
require("core-js/modules/es6.function.name"); | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
require("core-js/modules/es6.array.find-index"); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _toolTip = _interopRequireDefault(require("@beisen-platform/tool-tip")); | ||
var _commonFunc = require("@beisen-platform/common-func"); | ||
var _Foldup = _interopRequireDefault(require("@beisen-platform/react-icons/lib/icons/Foldup.js")); | ||
var _Spread = _interopRequireDefault(require("@beisen-platform/react-icons/lib/icons/Spread.js")); | ||
var TreeItem = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
(0, _inherits2.default)(TreeItem, _Component); | ||
_inherits(TreeItem, _Component); | ||
@@ -46,4 +23,5 @@ function TreeItem(props) { | ||
(0, _classCallCheck2.default)(this, TreeItem); | ||
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TreeItem).call(this, props)); | ||
_classCallCheck(this, TreeItem); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(TreeItem).call(this, props)); | ||
_this.defaultProps = { | ||
@@ -55,3 +33,3 @@ hiddenTip: false, | ||
_this.handleClick = function (e) { | ||
(0, _commonFunc.clearToolTipDom)(); | ||
clearToolTipDom(); | ||
e.stopPropagation(); | ||
@@ -119,3 +97,3 @@ var _this$props = _this.props, | ||
(0, _createClass2.default)(TreeItem, [{ | ||
_createClass(TreeItem, [{ | ||
key: "componentWillMount", | ||
@@ -174,3 +152,3 @@ value: function componentWillMount() { | ||
var filterData = data.li && data.li.map(function (data, index) { | ||
return _react.default.createElement(TreeItem, (0, _extends2.default)({}, _this2.props, { | ||
return React.createElement(TreeItem, _extends({}, _this2.props, { | ||
data: data, | ||
@@ -183,11 +161,13 @@ key: index | ||
if (data.has_child) { | ||
iconTv = _react.default.createElement("span", { | ||
className: 'icon-tv ' + (parseInt(data.level) >= 2 && data.has_child ? ' has-child-icon ' : ' '), | ||
var cls = toggle ? 'icon-foldup' : 'icon-spread'; | ||
var defaultCls = 'icon-tv ' + (parseInt(data.level) >= 2 && data.has_child ? ' has-child-icon ' : ' '); | ||
iconTv = React.createElement("span", { | ||
className: defaultCls + ' ' + cls, | ||
onClick: this.handletoggle | ||
}, toggle ? _react.default.createElement(_Foldup.default, null) : _react.default.createElement(_Spread.default, null)); | ||
}, toggle ? React.createElement(FlodUpIcon, null) : React.createElement(SpreadIcon, null)); | ||
} | ||
var isFirstLevel = parseInt(data.level) != 1 ? "empty-child-text" : "empty-child-text-first"; | ||
var showTitle = (0, _commonFunc.decode)(data.name); | ||
return _react.default.createElement("li", { | ||
var showTitle = decode(data.name); | ||
return React.createElement("li", { | ||
id: data.id, | ||
@@ -197,3 +177,3 @@ className: toggle ? '' : 'unfold', | ||
onClick: this.handleClick | ||
}, _react.default.createElement("div", { | ||
}, React.createElement("div", { | ||
style: { | ||
@@ -204,9 +184,9 @@ "paddingLeft": paddingLeft | ||
onMouseOver: handleMouseOver | ||
}, iconTv, _react.default.createElement("div", { | ||
}, iconTv, React.createElement("div", { | ||
className: "text_tv_parent" | ||
}, _react.default.createElement(_toolTip.default, { | ||
}, React.createElement(ToolTip, { | ||
title: showTitle, | ||
hidden: hiddenTip, | ||
side: sideTip | ||
}, _react.default.createElement("div", { | ||
}, React.createElement("div", { | ||
className: "text_tv text_width " + (data.has_child ? '' : isFirstLevel), | ||
@@ -216,8 +196,9 @@ style: { | ||
} | ||
}, showTitle)))), _react.default.createElement("ul", null, filterData)); | ||
}, showTitle)))), React.createElement("ul", null, filterData)); | ||
} | ||
}]); | ||
return TreeItem; | ||
}(_react.Component); | ||
}(Component); | ||
exports.default = TreeItem; | ||
export { TreeItem as default }; |
{ | ||
"name": "@beisen-platform/tree", | ||
"version": "0.2.4", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
61506
1186