@vtx/components 2.5.7 → 2.5.9
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.
- package/lib/_util/filterSpecialCharacters.js +54 -43
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +1 -4
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getUrlParam.js +0 -6
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/isFunction.js +0 -1
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js +0 -1
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/useInterval.js +0 -3
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +16 -34
- package/lib/_util/useSet.js.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/index.js +40 -62
- package/lib/index.js.map +1 -1
- package/lib/vtx-color-picker/index.js +7 -23
- package/lib/vtx-color-picker/index.js.map +1 -1
- package/lib/vtx-color-picker/style/css.js +0 -2
- package/lib/vtx-color-picker/style/css.js.map +1 -1
- package/lib/vtx-color-picker/style/index.js +0 -2
- package/lib/vtx-color-picker/style/index.js.map +1 -1
- package/lib/vtx-combogrid/Combogrid.js +37 -77
- package/lib/vtx-combogrid/Combogrid.js.map +1 -1
- package/lib/vtx-combogrid/index.js +22 -47
- package/lib/vtx-combogrid/index.js.map +1 -1
- package/lib/vtx-combogrid/style/css.js +0 -7
- package/lib/vtx-combogrid/style/css.js.map +1 -1
- package/lib/vtx-combogrid/style/index.js +0 -7
- package/lib/vtx-combogrid/style/index.js.map +1 -1
- package/lib/vtx-datagrid/Alert.js +3 -11
- package/lib/vtx-datagrid/Alert.js.map +1 -1
- package/lib/vtx-datagrid/ColumnSetting.js +15 -37
- package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
- package/lib/vtx-datagrid/ResizeableTitle.js +2 -13
- package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
- package/lib/vtx-datagrid/index.js +79 -139
- package/lib/vtx-datagrid/index.js.map +1 -1
- package/lib/vtx-datagrid/renderColumnButtons.js +6 -36
- package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
- package/lib/vtx-datagrid/style/css.js +0 -10
- package/lib/vtx-datagrid/style/css.js.map +1 -1
- package/lib/vtx-datagrid/style/index.js +0 -10
- package/lib/vtx-datagrid/style/index.js.map +1 -1
- package/lib/vtx-date-picker/QdatePicker.js +18 -48
- package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
- package/lib/vtx-date-picker/YearPicker.js +9 -32
- package/lib/vtx-date-picker/YearPicker.js.map +1 -1
- package/lib/vtx-date-picker/generatePicker.js +16 -57
- package/lib/vtx-date-picker/generatePicker.js.map +1 -1
- package/lib/vtx-date-picker/index.js +2 -8
- package/lib/vtx-date-picker/index.js.map +1 -1
- package/lib/vtx-date-picker/style/css.js +0 -1
- package/lib/vtx-date-picker/style/css.js.map +1 -1
- package/lib/vtx-date-picker/style/index.js +0 -1
- package/lib/vtx-date-picker/style/index.js.map +1 -1
- package/lib/vtx-editor/index.js +7 -25
- package/lib/vtx-editor/index.js.map +1 -1
- package/lib/vtx-editor/style/css.js +0 -2
- package/lib/vtx-editor/style/css.js.map +1 -1
- package/lib/vtx-editor/style/index.js +0 -2
- package/lib/vtx-editor/style/index.js.map +1 -1
- package/lib/vtx-export/index.js +22 -54
- package/lib/vtx-export/index.js.map +1 -1
- package/lib/vtx-export/style/css.js +0 -6
- package/lib/vtx-export/style/css.js.map +1 -1
- package/lib/vtx-export/style/index.js +0 -6
- package/lib/vtx-export/style/index.js.map +1 -1
- package/lib/vtx-form-layout/Card.js +6 -27
- package/lib/vtx-form-layout/Card.js.map +1 -1
- package/lib/vtx-form-layout/Divider.js +0 -5
- package/lib/vtx-form-layout/Divider.js.map +1 -1
- package/lib/vtx-form-layout/FormItem.js +10 -35
- package/lib/vtx-form-layout/FormItem.js.map +1 -1
- package/lib/vtx-form-layout/Pane.js +2 -7
- package/lib/vtx-form-layout/Pane.js.map +1 -1
- package/lib/vtx-form-layout/Row.js +0 -6
- package/lib/vtx-form-layout/Row.js.map +1 -1
- package/lib/vtx-form-layout/context.js +0 -2
- package/lib/vtx-form-layout/context.js.map +1 -1
- package/lib/vtx-form-layout/index.js +8 -22
- package/lib/vtx-form-layout/index.js.map +1 -1
- package/lib/vtx-form-layout/style/css.js +0 -8
- package/lib/vtx-form-layout/style/css.js.map +1 -1
- package/lib/vtx-form-layout/style/index.js +0 -8
- package/lib/vtx-form-layout/style/index.js.map +1 -1
- package/lib/vtx-image/Image.js +57 -93
- package/lib/vtx-image/Image.js.map +1 -1
- package/lib/vtx-image/Preview.js +23 -54
- package/lib/vtx-image/Preview.js.map +1 -1
- package/lib/vtx-image/PreviewGroup.js +13 -42
- package/lib/vtx-image/PreviewGroup.js.map +1 -1
- package/lib/vtx-image/index.js +1 -7
- package/lib/vtx-image/index.js.map +1 -1
- package/lib/vtx-image/style/css.js +0 -1
- package/lib/vtx-image/style/css.js.map +1 -1
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-image/style/index.js.map +1 -1
- package/lib/vtx-import/index.js +39 -74
- package/lib/vtx-import/index.js.map +1 -1
- package/lib/vtx-import/result.js +8 -25
- package/lib/vtx-import/result.js.map +1 -1
- package/lib/vtx-import/style/css.js +0 -2
- package/lib/vtx-import/style/css.js.map +1 -1
- package/lib/vtx-import/style/index.js +0 -2
- package/lib/vtx-import/style/index.js.map +1 -1
- package/lib/vtx-input/TextArea.js +8 -24
- package/lib/vtx-input/TextArea.js.map +1 -1
- package/lib/vtx-input/index.js +15 -41
- package/lib/vtx-input/index.js.map +1 -1
- package/lib/vtx-input/style/css.js +0 -1
- package/lib/vtx-input/style/css.js.map +1 -1
- package/lib/vtx-input/style/index.js +0 -1
- package/lib/vtx-input/style/index.js.map +1 -1
- package/lib/vtx-input/useLength.js +4 -16
- package/lib/vtx-input/useLength.js.map +1 -1
- package/lib/vtx-modal/Title.js +1 -6
- package/lib/vtx-modal/Title.js.map +1 -1
- package/lib/vtx-modal/index.js +33 -71
- package/lib/vtx-modal/index.js.map +1 -1
- package/lib/vtx-modal/style/css.js +0 -2
- package/lib/vtx-modal/style/css.js.map +1 -1
- package/lib/vtx-modal/style/index.js +0 -2
- package/lib/vtx-modal/style/index.js.map +1 -1
- package/lib/vtx-page-layout/Basic.js +2 -6
- package/lib/vtx-page-layout/Basic.js.map +1 -1
- package/lib/vtx-page-layout/Content.js +9 -21
- package/lib/vtx-page-layout/Content.js.map +1 -1
- package/lib/vtx-page-layout/Pane.js +2 -10
- package/lib/vtx-page-layout/Pane.js.map +1 -1
- package/lib/vtx-page-layout/TableLayout.js +15 -45
- package/lib/vtx-page-layout/TableLayout.js.map +1 -1
- package/lib/vtx-page-layout/TableWrap.js +5 -17
- package/lib/vtx-page-layout/TableWrap.js.map +1 -1
- package/lib/vtx-page-layout/container.js +16 -46
- package/lib/vtx-page-layout/container.js.map +1 -1
- package/lib/vtx-page-layout/index.js +0 -8
- package/lib/vtx-page-layout/index.js.map +1 -1
- package/lib/vtx-page-layout/style/css.js.map +1 -1
- package/lib/vtx-page-layout/style/index.js.map +1 -1
- package/lib/vtx-rps-frame/index.js +52 -63
- package/lib/vtx-rps-frame/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/css.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.js.map +1 -1
- package/lib/vtx-scrollable-row/index.js +23 -59
- package/lib/vtx-scrollable-row/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/css.js +0 -1
- package/lib/vtx-scrollable-row/style/css.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.js +0 -1
- package/lib/vtx-scrollable-row/style/index.js.map +1 -1
- package/lib/vtx-search/VtxCol.js +2 -23
- package/lib/vtx-search/VtxCol.js.map +1 -1
- package/lib/vtx-search/VtxRow.js +6 -12
- package/lib/vtx-search/VtxRow.js.map +1 -1
- package/lib/vtx-search/index.js +39 -90
- package/lib/vtx-search/index.js.map +1 -1
- package/lib/vtx-search/style/css.js +0 -5
- package/lib/vtx-search/style/css.js.map +1 -1
- package/lib/vtx-search/style/index.js +0 -5
- package/lib/vtx-search/style/index.js.map +1 -1
- package/lib/vtx-search-map-input/index.js +41 -70
- package/lib/vtx-search-map-input/index.js.map +1 -1
- package/lib/vtx-search-map-input/style/css.js +0 -2
- package/lib/vtx-search-map-input/style/css.js.map +1 -1
- package/lib/vtx-search-map-input/style/index.js +0 -2
- package/lib/vtx-search-map-input/style/index.js.map +1 -1
- package/lib/vtx-select/index.js +24 -68
- package/lib/vtx-select/index.js.map +1 -1
- package/lib/vtx-select/style/css.js +0 -8
- package/lib/vtx-select/style/css.js.map +1 -1
- package/lib/vtx-select/style/index.js +0 -8
- package/lib/vtx-select/style/index.js.map +1 -1
- package/lib/vtx-signature/index.js +15 -29
- package/lib/vtx-signature/index.js.map +1 -1
- package/lib/vtx-signature/style/css.js +0 -2
- package/lib/vtx-signature/style/css.js.map +1 -1
- package/lib/vtx-signature/style/index.js +0 -2
- package/lib/vtx-signature/style/index.js.map +1 -1
- package/lib/vtx-split-pane/Pane.js +5 -17
- package/lib/vtx-split-pane/Pane.js.map +1 -1
- package/lib/vtx-split-pane/Resizer.js +14 -34
- package/lib/vtx-split-pane/Resizer.js.map +1 -1
- package/lib/vtx-split-pane/SplitPane.js +49 -101
- package/lib/vtx-split-pane/SplitPane.js.map +1 -1
- package/lib/vtx-split-pane/index.js +0 -4
- package/lib/vtx-split-pane/index.js.map +1 -1
- package/lib/vtx-split-pane/style/css.js +0 -3
- package/lib/vtx-split-pane/style/css.js.map +1 -1
- package/lib/vtx-split-pane/style/index.js +0 -3
- package/lib/vtx-split-pane/style/index.js.map +1 -1
- package/lib/vtx-statistics-column/Back.js +2 -8
- package/lib/vtx-statistics-column/Back.js.map +1 -1
- package/lib/vtx-statistics-column/Item.js +8 -25
- package/lib/vtx-statistics-column/Item.js.map +1 -1
- package/lib/vtx-statistics-column/Total.js +8 -25
- package/lib/vtx-statistics-column/Total.js.map +1 -1
- package/lib/vtx-statistics-column/context.js +0 -2
- package/lib/vtx-statistics-column/context.js.map +1 -1
- package/lib/vtx-statistics-column/index.js +0 -16
- package/lib/vtx-statistics-column/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/css.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.js.map +1 -1
- package/lib/vtx-time-picker/index.js +4 -17
- package/lib/vtx-time-picker/index.js.map +1 -1
- package/lib/vtx-time-picker/style/css.js.map +1 -1
- package/lib/vtx-time-picker/style/index.js.map +1 -1
- package/lib/vtx-upload/FilePreview.js +11 -30
- package/lib/vtx-upload/FilePreview.js.map +1 -1
- package/lib/vtx-upload/index.js +70 -136
- package/lib/vtx-upload/index.js.map +1 -1
- package/lib/vtx-upload/style/css.js +0 -6
- package/lib/vtx-upload/style/css.js.map +1 -1
- package/lib/vtx-upload/style/index.js +0 -6
- package/lib/vtx-upload/style/index.js.map +1 -1
- package/lib/vtx-ztree/index.js +57 -109
- package/lib/vtx-ztree/index.js.map +1 -1
- package/lib/vtx-ztree/style/css.js +0 -1
- package/lib/vtx-ztree/style/css.js.map +1 -1
- package/lib/vtx-ztree/style/index.js +0 -1
- package/lib/vtx-ztree/style/index.js.map +1 -1
- package/lib/vtx-ztree-select/index.js +46 -105
- package/lib/vtx-ztree-select/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/css.js +0 -4
- package/lib/vtx-ztree-select/style/css.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.js +0 -4
- package/lib/vtx-ztree-select/style/index.js.map +1 -1
- package/package.json +1 -1
package/lib/vtx-ztree/index.js
CHANGED
|
@@ -4,63 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _input = _interopRequireDefault(require("antd/lib/input"));
|
|
11
|
-
|
|
12
9
|
var _lodash = _interopRequireDefault(require("lodash.isequal"));
|
|
13
|
-
|
|
14
10
|
var _lodash2 = _interopRequireDefault(require("lodash.merge"));
|
|
15
|
-
|
|
16
11
|
var _lodash3 = _interopRequireDefault(require("lodash.debounce"));
|
|
17
|
-
|
|
18
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
13
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
21
|
-
|
|
22
14
|
var _config = _interopRequireDefault(require("../config"));
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
-
|
|
30
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
31
|
-
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
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); }
|
|
32
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
|
|
34
20
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
-
|
|
40
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
-
|
|
21
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
23
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
42
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
43
|
-
|
|
44
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
45
|
-
|
|
25
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
46
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
-
|
|
48
27
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
|
-
|
|
50
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
-
|
|
28
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
52
29
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
-
|
|
54
30
|
var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
55
31
|
_inherits(VtxZtree, _React$Component);
|
|
56
|
-
|
|
57
32
|
var _super = _createSuper(VtxZtree);
|
|
58
|
-
|
|
59
33
|
function VtxZtree(props) {
|
|
60
34
|
var _this;
|
|
61
|
-
|
|
62
35
|
_classCallCheck(this, VtxZtree);
|
|
63
|
-
|
|
64
36
|
_this = _super.call(this, props);
|
|
65
37
|
_this.treeId = "tree-".concat(new Date().getTime(), "-").concat(parseInt(Math.random() * 10000));
|
|
66
38
|
_this.zTreeObj = null;
|
|
@@ -76,7 +48,6 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
76
48
|
};
|
|
77
49
|
return _this;
|
|
78
50
|
}
|
|
79
|
-
|
|
80
51
|
_createClass(VtxZtree, [{
|
|
81
52
|
key: "loadTreeResource",
|
|
82
53
|
value: function loadTreeResource() {
|
|
@@ -104,10 +75,8 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
104
75
|
key: "componentDidMount",
|
|
105
76
|
value: function componentDidMount() {
|
|
106
77
|
var _this2 = this;
|
|
107
|
-
|
|
108
78
|
this.loadPromise.then(function () {
|
|
109
79
|
_this2.loadComplete = true;
|
|
110
|
-
|
|
111
80
|
_this2.refreshTree(_this2.props);
|
|
112
81
|
});
|
|
113
82
|
}
|
|
@@ -115,7 +84,6 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
115
84
|
key: "componentDidUpdate",
|
|
116
85
|
value: function componentDidUpdate(prevProps) {
|
|
117
86
|
if (!this.loadComplete) return;
|
|
118
|
-
|
|
119
87
|
if (!(0, _lodash["default"])(prevProps.refreshFlag, this.props.refreshFlag) || !(0, _lodash["default"])(prevProps.data, this.props.data)) {
|
|
120
88
|
this.refreshTree(this.props);
|
|
121
89
|
}
|
|
@@ -124,13 +92,14 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
124
92
|
key: "componentWillUnmount",
|
|
125
93
|
value: function componentWillUnmount() {
|
|
126
94
|
this.zTreeObj && this.zTreeObj.destroy();
|
|
127
|
-
}
|
|
95
|
+
}
|
|
128
96
|
|
|
97
|
+
// 初始化树的配置
|
|
129
98
|
}, {
|
|
130
99
|
key: "initTreeSetting",
|
|
131
100
|
value: function initTreeSetting(props) {
|
|
132
|
-
var t = this;
|
|
133
|
-
|
|
101
|
+
var t = this;
|
|
102
|
+
// 初始化树的配置
|
|
134
103
|
this.treeSetting = {
|
|
135
104
|
check: {
|
|
136
105
|
enable: !!props.checkable,
|
|
@@ -242,32 +211,30 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
242
211
|
}
|
|
243
212
|
}
|
|
244
213
|
}
|
|
245
|
-
};
|
|
246
|
-
|
|
214
|
+
};
|
|
215
|
+
// 继承外部配置
|
|
247
216
|
if (_typeof(this.props.customCfg) == 'object') {
|
|
248
217
|
(0, _lodash2["default"])(this.treeSetting, this.props.customCfg);
|
|
249
218
|
}
|
|
250
|
-
}
|
|
219
|
+
}
|
|
251
220
|
|
|
221
|
+
// 初始化树的数据,对expandedKeys,checkedKeys做处理
|
|
252
222
|
}, {
|
|
253
223
|
key: "initTreeNodes",
|
|
254
224
|
value: function initTreeNodes(props) {
|
|
255
225
|
var t = this;
|
|
256
226
|
this.keyNameMapping = {};
|
|
257
|
-
|
|
258
227
|
if (!Array.isArray(props.data)) {
|
|
259
228
|
this.treeNodes = [];
|
|
260
229
|
} else {
|
|
261
230
|
var checkedKeys = props.checkedKeys || [];
|
|
262
231
|
var expandedKeys = props.expandedKeys || [];
|
|
263
232
|
var chkDisabled = !!props.disableCheckboxAll;
|
|
264
|
-
|
|
265
233
|
this.treeNodes = function genNodes(nodes) {
|
|
266
234
|
return nodes.map(function (item) {
|
|
267
235
|
var checked = checkedKeys.indexOf(item.key) != -1;
|
|
268
236
|
var open = expandedKeys.indexOf(item.key) != -1;
|
|
269
237
|
t.keyNameMapping[item.key] = item.name;
|
|
270
|
-
|
|
271
238
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
272
239
|
return _objectSpread(_objectSpread({
|
|
273
240
|
chkDisabled: chkDisabled,
|
|
@@ -288,22 +255,19 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
288
255
|
}
|
|
289
256
|
}).map(function (item) {
|
|
290
257
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
291
|
-
var newNode = _objectSpread({}, item);
|
|
292
|
-
|
|
293
|
-
|
|
258
|
+
var newNode = _objectSpread({}, item);
|
|
259
|
+
// 如果子节点全部被勾选,父节点自动勾选
|
|
294
260
|
if (item.children.every(function (item) {
|
|
295
261
|
return item.checked;
|
|
296
262
|
})) {
|
|
297
263
|
newNode.checked = true;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
264
|
+
}
|
|
265
|
+
// 如果配置了自动展开父节点,父节点自动展开
|
|
301
266
|
if (props.autoExpandParent && item.children.some(function (item) {
|
|
302
267
|
return item.open;
|
|
303
268
|
})) {
|
|
304
269
|
newNode.open = true;
|
|
305
270
|
}
|
|
306
|
-
|
|
307
271
|
return newNode;
|
|
308
272
|
} else {
|
|
309
273
|
return item;
|
|
@@ -311,8 +275,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
311
275
|
});
|
|
312
276
|
}(props.data);
|
|
313
277
|
}
|
|
314
|
-
}
|
|
278
|
+
}
|
|
315
279
|
|
|
280
|
+
// 重新生成树
|
|
316
281
|
}, {
|
|
317
282
|
key: "refreshTree",
|
|
318
283
|
value: function refreshTree(newProps) {
|
|
@@ -320,65 +285,62 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
320
285
|
this.initTreeSetting(newProps);
|
|
321
286
|
this.initTreeNodes(newProps);
|
|
322
287
|
this.zTreeObj = $.fn.zTree.init($("#".concat(this.treeId)), this.treeSetting, this.treeNodes);
|
|
323
|
-
|
|
324
288
|
if (Array.isArray(newProps.selectedKeys)) {
|
|
325
289
|
this.selectNodes(newProps.selectedKeys, newProps.multiple);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
290
|
+
}
|
|
291
|
+
// 初始化全展开判断
|
|
329
292
|
if (newProps.defaultExpandAll && !newProps.expandedKeys) {
|
|
330
293
|
this.zTreeObj.expandAll(true);
|
|
331
294
|
}
|
|
332
|
-
}
|
|
295
|
+
}
|
|
333
296
|
|
|
297
|
+
// 展开或折叠相关节点,expandFlag为true表示展开,false表示折叠
|
|
334
298
|
}, {
|
|
335
299
|
key: "expandNodes",
|
|
336
300
|
value: function expandNodes(expandedKeys) {
|
|
337
301
|
var expandFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
338
|
-
|
|
339
302
|
for (var i = 0, len = expandedKeys.length; i < len; i++) {
|
|
340
303
|
var node = this.zTreeObj.getNodesByParam('key', expandedKeys[i]).pop();
|
|
341
|
-
|
|
342
304
|
if (node) {
|
|
343
305
|
this.zTreeObj.expandNode(node, expandFlag, false, false);
|
|
344
306
|
}
|
|
345
307
|
}
|
|
346
|
-
}
|
|
308
|
+
}
|
|
347
309
|
|
|
310
|
+
// 勾选节点, checkedFlag为true表示勾选,false表示取消勾选
|
|
348
311
|
}, {
|
|
349
312
|
key: "checkNodes",
|
|
350
313
|
value: function checkNodes(checkedKeys) {
|
|
351
314
|
var checkedFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
352
|
-
|
|
353
315
|
for (var i = 0, len = checkedKeys.length; i < len; i++) {
|
|
354
316
|
var node = this.zTreeObj.getNodesByParam('key', checkedKeys[i]).pop();
|
|
355
|
-
|
|
356
317
|
if (node) {
|
|
357
318
|
// 隐藏节点的勾选状态也要改变
|
|
358
319
|
node.checked = checkedFlag;
|
|
359
|
-
this.zTreeObj.updateNode(node, true);
|
|
320
|
+
this.zTreeObj.updateNode(node, true);
|
|
321
|
+
// this.zTreeObj.checkNode(node,checkedFlag,false);
|
|
360
322
|
}
|
|
361
323
|
}
|
|
362
|
-
}
|
|
324
|
+
}
|
|
363
325
|
|
|
326
|
+
// 点击选择节点
|
|
364
327
|
}, {
|
|
365
328
|
key: "selectNodes",
|
|
366
329
|
value: function selectNodes(selectedKeys, multiple) {
|
|
367
330
|
for (var i = 0, len = selectedKeys.length; i < len; i++) {
|
|
368
331
|
var node = this.zTreeObj.getNodesByParam('key', selectedKeys[i]).pop();
|
|
369
|
-
|
|
370
332
|
if (node) {
|
|
371
333
|
this.zTreeObj.selectNode(node, multiple, true);
|
|
372
334
|
}
|
|
373
335
|
}
|
|
374
|
-
}
|
|
336
|
+
}
|
|
375
337
|
|
|
338
|
+
// 取消选择节点
|
|
376
339
|
}, {
|
|
377
340
|
key: "cancelSelectedNodes",
|
|
378
341
|
value: function cancelSelectedNodes(selectedKeys) {
|
|
379
342
|
for (var i = 0, len = selectedKeys.length; i < len; i++) {
|
|
380
343
|
var node = this.zTreeObj.getNodesByParam('key', selectedKeys[i]).pop();
|
|
381
|
-
|
|
382
344
|
if (node) {
|
|
383
345
|
this.zTreeObj.cancelSelectedNode(node);
|
|
384
346
|
}
|
|
@@ -392,38 +354,35 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
392
354
|
var nameKey = this.zTreeObj.setting.data.key.name; // get the key of the node name
|
|
393
355
|
// isHighLight = isHighLight===false?false:true;//default true, only use false to disable highlight
|
|
394
356
|
// isExpand = isExpand?true:false; // not to expand in default
|
|
395
|
-
|
|
396
357
|
this.zTreeObj.setting.view.nameIsHTML = isHighLight; // allow use html in node name for highlight use
|
|
397
358
|
|
|
398
359
|
var metaChar = '[\\[\\]\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; // js meta characters
|
|
399
|
-
|
|
400
360
|
var rexMeta = new RegExp(metaChar, 'gi'); // regular expression to match meta characters
|
|
361
|
+
|
|
401
362
|
// searchNodeLazy(keyworld);
|
|
363
|
+
ztreeFilter(t.zTreeObj, keyworld);
|
|
402
364
|
|
|
403
|
-
|
|
365
|
+
// -----------------------------内部函数----------------------------------
|
|
404
366
|
// keywords filter function
|
|
405
|
-
|
|
406
367
|
function ztreeFilter(zTreeObj, _keywords) {
|
|
407
368
|
if (!_keywords) {
|
|
408
369
|
_keywords = ''; // default blank for _keywords
|
|
409
|
-
}
|
|
410
|
-
|
|
370
|
+
}
|
|
411
371
|
|
|
372
|
+
// function to find the matching node
|
|
412
373
|
function filterFunc(node) {
|
|
413
374
|
if (node && node.oldname && node.oldname.length > 0) {
|
|
414
375
|
node[nameKey] = node.oldname; // recover oldname of the node if exist
|
|
415
376
|
}
|
|
416
377
|
|
|
417
378
|
zTreeObj.updateNode(node); // update node to for modifications take effect
|
|
418
|
-
|
|
419
379
|
if (_keywords.length == 0) {
|
|
420
380
|
// return true to show all nodes if the keyword is blank
|
|
421
|
-
zTreeObj.showNode(node);
|
|
422
|
-
|
|
381
|
+
zTreeObj.showNode(node);
|
|
382
|
+
// zTreeObj.expandNode(node,isExpand);
|
|
423
383
|
return true;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
384
|
+
}
|
|
385
|
+
// transform node name and keywords to lowercase
|
|
427
386
|
if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase()) != -1) {
|
|
428
387
|
if (isHighLight) {
|
|
429
388
|
// highlight process
|
|
@@ -434,12 +393,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
434
393
|
// add escape character before meta characters
|
|
435
394
|
return '\\' + matchStr;
|
|
436
395
|
});
|
|
437
|
-
|
|
438
396
|
node.oldname = node[nameKey]; // store the old name
|
|
439
|
-
|
|
440
397
|
var rexGlobal = new RegExp(newKeywords, 'gi'); // 'g' for global,'i' for ignore case
|
|
441
398
|
// use replace(RegExp,replacement) since replace(/substr/g,replacement) cannot be used here
|
|
442
|
-
|
|
443
399
|
node[nameKey] = node.oldname.replace(rexGlobal, function (originalText) {
|
|
444
400
|
// highlight the matching words in node name
|
|
445
401
|
var highLightText = '<span style="color: whitesmoke;background-color:#f50;">' + originalText + '</span>';
|
|
@@ -449,36 +405,30 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
449
405
|
}
|
|
450
406
|
|
|
451
407
|
zTreeObj.showNode(node); // show node with matching keywords
|
|
452
|
-
|
|
453
408
|
return true; // return true and show this node
|
|
454
409
|
}
|
|
455
410
|
|
|
456
411
|
zTreeObj.hideNode(node); // hide node that not matched
|
|
457
|
-
|
|
458
412
|
return false; // return false for node not matched
|
|
459
413
|
}
|
|
460
414
|
|
|
461
415
|
var nodesShow = zTreeObj.getNodesByFilter(filterFunc); // get all nodes that would be shown
|
|
462
|
-
|
|
463
416
|
processShowNodes(zTreeObj, nodesShow, _keywords); // nodes should be reprocessed to show correctly
|
|
464
417
|
}
|
|
418
|
+
|
|
465
419
|
/**
|
|
466
420
|
* reprocess of nodes before showing
|
|
467
421
|
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
422
|
function processShowNodes(zTreeObj, nodesShow, _keywords) {
|
|
471
423
|
if (nodesShow && nodesShow.length > 0) {
|
|
472
424
|
// process the ancient nodes if _keywords is not blank
|
|
473
425
|
if (_keywords.length > 0) {
|
|
474
426
|
$.each(nodesShow, function (n, obj) {
|
|
475
427
|
var pathOfOne = obj.getPath(); // get all the ancient nodes including current node
|
|
476
|
-
|
|
477
428
|
if (pathOfOne && pathOfOne.length > 0) {
|
|
478
429
|
// i < pathOfOne.length-1 process every node in path except self
|
|
479
430
|
for (var i = 0; i < pathOfOne.length - 1; i++) {
|
|
480
431
|
zTreeObj.showNode(pathOfOne[i]); // show node
|
|
481
|
-
|
|
482
432
|
zTreeObj.expandNode(pathOfOne[i], true); // expand node
|
|
483
433
|
}
|
|
484
434
|
}
|
|
@@ -486,15 +436,15 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
486
436
|
} else {
|
|
487
437
|
// show all nodes when _keywords is blank and expand the root nodes
|
|
488
438
|
var rootNodes = zTreeObj.getNodesByParam('level', '0'); // get all root nodes
|
|
489
|
-
|
|
490
439
|
$.each(rootNodes, function (n, obj) {
|
|
491
440
|
zTreeObj.expandNode(obj, true); // expand all root nodes
|
|
492
441
|
});
|
|
493
442
|
}
|
|
494
443
|
}
|
|
495
444
|
}
|
|
496
|
-
}
|
|
445
|
+
}
|
|
497
446
|
|
|
447
|
+
// 清空搜索框数据(供外部调用)
|
|
498
448
|
}, {
|
|
499
449
|
key: "clearSearch",
|
|
500
450
|
value: function clearSearch() {
|
|
@@ -503,13 +453,13 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
503
453
|
searchVal: ''
|
|
504
454
|
});
|
|
505
455
|
this.refreshTree(this.props);
|
|
506
|
-
}
|
|
456
|
+
}
|
|
507
457
|
|
|
458
|
+
// 获取所有已被勾选的节点
|
|
508
459
|
}, {
|
|
509
460
|
key: "getCheckedNodes",
|
|
510
461
|
value: function getCheckedNodes() {
|
|
511
462
|
var _this3 = this;
|
|
512
|
-
|
|
513
463
|
return this.zTreeObj.getNodesByFilter(function (node) {
|
|
514
464
|
// 节点被勾选(非半勾状态)
|
|
515
465
|
if (_this3.props.checkStrictly) return node.checked;
|
|
@@ -517,11 +467,11 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
517
467
|
}).map(function (item) {
|
|
518
468
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
519
469
|
name: item.oldname || item.name // 搜索树会改变节点的name
|
|
520
|
-
|
|
521
470
|
});
|
|
522
471
|
});
|
|
523
|
-
}
|
|
472
|
+
}
|
|
524
473
|
|
|
474
|
+
// 获取所有已被点击选中的节点
|
|
525
475
|
}, {
|
|
526
476
|
key: "getSelectedNodes",
|
|
527
477
|
value: function getSelectedNodes() {
|
|
@@ -530,14 +480,16 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
530
480
|
name: item.oldname || item.name
|
|
531
481
|
});
|
|
532
482
|
});
|
|
533
|
-
}
|
|
483
|
+
}
|
|
534
484
|
|
|
485
|
+
// 展开所有节点(供外部调用)
|
|
535
486
|
}, {
|
|
536
487
|
key: "expandAll",
|
|
537
488
|
value: function expandAll() {
|
|
538
489
|
this.zTreeObj.expandAll(true);
|
|
539
|
-
}
|
|
490
|
+
}
|
|
540
491
|
|
|
492
|
+
// 收起所有节点(供外部调用)
|
|
541
493
|
}, {
|
|
542
494
|
key: "collapseAll",
|
|
543
495
|
value: function collapseAll() {
|
|
@@ -548,9 +500,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
548
500
|
value: function render() {
|
|
549
501
|
var t = this;
|
|
550
502
|
var _t$props = t.props,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
503
|
+
prefixCls = _t$props.prefixCls,
|
|
504
|
+
showSearch = _t$props.showSearch,
|
|
505
|
+
searchPlaceholder = _t$props.searchPlaceholder;
|
|
554
506
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
555
507
|
className: (0, _classnames2["default"])("".concat(prefixCls, "-wraaper"), _defineProperty({}, "".concat(prefixCls, "-has-search"), showSearch))
|
|
556
508
|
}, showSearch && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -570,17 +522,13 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
|
|
|
570
522
|
}));
|
|
571
523
|
}
|
|
572
524
|
}]);
|
|
573
|
-
|
|
574
525
|
return VtxZtree;
|
|
575
526
|
}(_react["default"].Component);
|
|
576
|
-
|
|
577
527
|
exports["default"] = VtxZtree;
|
|
578
|
-
|
|
579
528
|
_defineProperty(VtxZtree, "defaultProps", {
|
|
580
529
|
showSearch: true,
|
|
581
530
|
prefixCls: 'vtx-ztree'
|
|
582
531
|
});
|
|
583
|
-
|
|
584
532
|
VtxZtree.propTypes = {
|
|
585
533
|
showSearch: _propTypes["default"].bool,
|
|
586
534
|
searchPlaceholder: _propTypes["default"].string,
|