cloud-b2b 1.0.0 → 1.0.1
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/es/Card/Card.js +20 -0
- package/es/Card/package.json +6 -0
- package/es/Control/Control.js +402 -0
- package/es/Control/event.js +57 -0
- package/es/Control/package.json +6 -0
- package/es/Enhance/Dialogs.js +67 -0
- package/es/Enhance/Loading.js +151 -0
- package/es/Enhance/index.js +8 -0
- package/es/Enhance/package.json +6 -0
- package/es/Header/Header.js +194 -0
- package/es/Header/Header.less +94 -0
- package/es/Header/Vertical.js +129 -0
- package/es/Header/Vertical.less +60 -0
- package/es/Header/package.json +6 -0
- package/es/HomeHeader/Header.js +75 -0
- package/es/HomeHeader/Header.less +73 -0
- package/es/HomeHeader/package.json +6 -0
- package/es/ImageView/ImageView.js +117 -0
- package/es/ImageView/ImageView.less +14 -0
- package/es/ImageView/package.json +6 -0
- package/es/InpurCascader/InputCascader.js +135 -0
- package/es/InpurCascader/package.json +6 -0
- package/es/InputEditor/InputEditor.js +118 -0
- package/es/InputEditor/inputEditor.less +8 -0
- package/es/InputEditor/package.json +6 -0
- package/es/InputSearch/InputSearch.js +306 -0
- package/es/InputSearch/package.json +6 -0
- package/es/InputSelect/InputSelect.js +185 -0
- package/es/InputSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +107 -0
- package/es/InputWriting/package.json +6 -0
- package/es/Layout/Layout.js +232 -0
- package/es/Layout/Layout.less +28 -0
- package/es/Layout/package.json +6 -0
- package/es/LayoutLink/LayoutLink.js +82 -0
- package/es/LayoutLink/LayoutLink.less +53 -0
- package/es/LayoutLink/package.json +6 -0
- package/es/Link/Link.js +108 -0
- package/es/Link/package.json +6 -0
- package/es/Loading/Loading.js +15 -0
- package/es/Loading/Loading.less +13 -0
- package/es/Loading/package.json +6 -0
- package/es/Loading2/Loading2.js +11 -0
- package/es/Loading2/Loading2.less +19 -0
- package/es/Loading2/package.json +6 -0
- package/es/ModalWithDrag/ModalWithDrag.js +34 -0
- package/es/ModalWithDrag/ModalWithDrag.less +6 -0
- package/es/ModalWithDrag/drag.js +133 -0
- package/es/ModalWithDrag/package.json +6 -0
- package/es/NumberInput/NumberInput.js +237 -0
- package/es/NumberInput/package.json +6 -0
- package/es/Search/Search.js +581 -0
- package/es/Search/Search.less +63 -0
- package/es/Search/package.json +6 -0
- package/es/Sidebar/Sidebar.js +165 -0
- package/es/Sidebar/Sidebar.less +77 -0
- package/es/Sidebar/package.json +6 -0
- package/es/Sidebar2/Sidebar.js +192 -0
- package/es/Sidebar2/Sidebar.less +153 -0
- package/es/Sidebar2/package.json +6 -0
- package/es/SuperForm/SuperForm.js +641 -0
- package/es/SuperForm/SuperForm.less +52 -0
- package/es/SuperForm/package.json +6 -0
- package/es/SuperIcon/SuperIcon.js +30 -0
- package/es/SuperIcon/package.json +6 -0
- package/es/SuperPagination/SuperPagination.js +126 -0
- package/es/SuperPagination/package.json +6 -0
- package/es/SuperToolbar/SuperToolbar.js +223 -0
- package/es/SuperToolbar/SuperToolbar.less +17 -0
- package/es/SuperToolbar/package.json +6 -0
- package/es/SuperUpload/SuperUpload.js +282 -0
- package/es/SuperUpload/SuperUpload.less +27 -0
- package/es/SuperUpload/package.json +6 -0
- package/es/Viewer/ImageViews.js +311 -0
- package/es/Viewer/Viewer.js +149 -0
- package/es/Viewer/Viewer.less +67 -0
- package/es/Viewer/imgView.less +59 -0
- package/es/Viewer/package.json +7 -0
- package/es/WingBlank/WingBlank.js +20 -0
- package/es/WingBlank/WingBlank.less +12 -0
- package/es/WingBlank/package.json +6 -0
- package/es/helper.js +118 -0
- package/es/history.js +5 -0
- package/es/index.js +24 -1
- package/es/variables.less +73 -73
- package/lib/Card/Card.js +38 -0
- package/lib/Card/package.json +6 -0
- package/lib/Control/Control.js +449 -0
- package/lib/Control/event.js +68 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +87 -0
- package/lib/Enhance/Loading.js +175 -0
- package/lib/Enhance/index.js +35 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +215 -0
- package/lib/Header/Header.less +94 -0
- package/lib/Header/Vertical.js +150 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/HomeHeader/Header.js +95 -0
- package/lib/HomeHeader/Header.less +73 -0
- package/lib/HomeHeader/package.json +6 -0
- package/lib/ImageView/ImageView.js +134 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +156 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +136 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +322 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +208 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +123 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +258 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +114 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +130 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +30 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +26 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +147 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +259 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +603 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +186 -0
- package/lib/Sidebar/Sidebar.less +77 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +213 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +657 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +47 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +145 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +248 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +324 -0
- package/lib/SuperUpload/SuperUpload.less +27 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Viewer/ImageViews.js +323 -0
- package/lib/Viewer/Viewer.js +167 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +37 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/helper.js +147 -0
- package/lib/history.js +18 -0
- package/lib/index.js +208 -1
- package/lib/index.less +20 -1
- package/lib/variables.less +73 -73
- package/package.json +3 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _Icon from "antd/es/icon";
|
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["type", "style"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
var SuperIcon = function SuperIcon(_ref) {
|
|
8
|
+
var type = _ref.type,
|
|
9
|
+
_ref$style = _ref.style,
|
|
10
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
if (!type) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(_Icon, _extends({
|
|
15
|
+
style: style
|
|
16
|
+
}, props));
|
|
17
|
+
} else if (type.substring(0, 4) !== 'pld-') {
|
|
18
|
+
return /*#__PURE__*/React.createElement(_Icon, _extends({
|
|
19
|
+
type: type,
|
|
20
|
+
style: style
|
|
21
|
+
}, props));
|
|
22
|
+
} else {
|
|
23
|
+
return /*#__PURE__*/React.createElement("i", {
|
|
24
|
+
className: "pldicon anticon anticon-".concat(type),
|
|
25
|
+
style: style
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default SuperIcon;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _Pagination from "antd/es/pagination";
|
|
3
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
6
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
7
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
8
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
10
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
12
|
+
|
|
13
|
+
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); }; }
|
|
14
|
+
|
|
15
|
+
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; } }
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* maxRecords: 最大记录数
|
|
22
|
+
* selRecords: [可选]已选记录条数
|
|
23
|
+
* currentPage:当前页码
|
|
24
|
+
* pageSize:页面大小
|
|
25
|
+
* align: 分页组件的对齐方式,默认居右
|
|
26
|
+
* pageSizeType: 字符串数组,页面大小规格
|
|
27
|
+
* description:字符串描述,类似'共有{maxRecords}条记录'
|
|
28
|
+
* onPageChange:跳转到新的一页时触发,原型func(pageNumber)
|
|
29
|
+
* onPageSizeChange: 页大小改变时触发,原型func(pageSize, pageNumber)
|
|
30
|
+
*/
|
|
31
|
+
var SuperPagination = /*#__PURE__*/function (_React$Component) {
|
|
32
|
+
_inherits(SuperPagination, _React$Component);
|
|
33
|
+
|
|
34
|
+
var _super = _createSuper(SuperPagination);
|
|
35
|
+
|
|
36
|
+
function SuperPagination() {
|
|
37
|
+
var _context;
|
|
38
|
+
|
|
39
|
+
var _this;
|
|
40
|
+
|
|
41
|
+
_classCallCheck(this, SuperPagination);
|
|
42
|
+
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
48
|
+
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (page) {
|
|
50
|
+
var _this$props$callback = _this.props.callback,
|
|
51
|
+
callback = _this$props$callback === void 0 ? {} : _this$props$callback;
|
|
52
|
+
var onPageNumberChange = _this.props.onPageNumberChange || callback.onPageNumberChange;
|
|
53
|
+
onPageNumberChange && onPageNumberChange(page);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "onShowSizeChange", function (current, size) {
|
|
57
|
+
var _this$props$callback2 = _this.props.callback,
|
|
58
|
+
callback = _this$props$callback2 === void 0 ? {} : _this$props$callback2;
|
|
59
|
+
var onPageSizeChange = _this.props.onPageSizeChange || callback.onPageSizeChange;
|
|
60
|
+
onPageSizeChange && onPageSizeChange(size, current || 1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_createClass(SuperPagination, [{
|
|
67
|
+
key: "render",
|
|
68
|
+
value: function render() {
|
|
69
|
+
var _this$props = this.props,
|
|
70
|
+
currentPage = _this$props.currentPage,
|
|
71
|
+
maxRecords = _this$props.maxRecords,
|
|
72
|
+
pageSize = _this$props.pageSize,
|
|
73
|
+
pageSizeType = _this$props.pageSizeType,
|
|
74
|
+
align = _this$props.align,
|
|
75
|
+
description = _this$props.description,
|
|
76
|
+
selRecords = _this$props.selRecords,
|
|
77
|
+
_this$props$page = _this$props.page,
|
|
78
|
+
page = _this$props$page === void 0 ? {} : _this$props$page,
|
|
79
|
+
_this$props$option = _this$props.option,
|
|
80
|
+
option = _this$props$option === void 0 ? {} : _this$props$option,
|
|
81
|
+
_this$props$style = _this$props.style,
|
|
82
|
+
style = _this$props$style === void 0 ? {} : _this$props$style;
|
|
83
|
+
var desp = description || (this.props.config || {}).pageDesp || '';
|
|
84
|
+
var props = {
|
|
85
|
+
current: currentPage || page.currentPage,
|
|
86
|
+
total: maxRecords || page.maxRecords,
|
|
87
|
+
pageSize: pageSize || page.pageSize,
|
|
88
|
+
showSizeChanger: true,
|
|
89
|
+
showQuickJumper: true,
|
|
90
|
+
pageSizeOptions: pageSizeType || option.pageSizeType || [],
|
|
91
|
+
onChange: this.onChange,
|
|
92
|
+
onShowSizeChange: this.onShowSizeChange,
|
|
93
|
+
showTotal: function showTotal(total) {
|
|
94
|
+
return desp.replace('{maxRecords}', total).replace('{selRecords}', selRecords || 0);
|
|
95
|
+
},
|
|
96
|
+
style: _Object$assign({}, style, {
|
|
97
|
+
display: 'inline-block',
|
|
98
|
+
textAlign: 'left',
|
|
99
|
+
verticalAlign: 'top'
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
style: {
|
|
104
|
+
textAlign: align || 'right'
|
|
105
|
+
}
|
|
106
|
+
}, /*#__PURE__*/React.createElement(_Pagination, props));
|
|
107
|
+
}
|
|
108
|
+
}]);
|
|
109
|
+
|
|
110
|
+
return SuperPagination;
|
|
111
|
+
}(React.Component);
|
|
112
|
+
|
|
113
|
+
_defineProperty(SuperPagination, "propTypes", {
|
|
114
|
+
maxRecords: PropTypes.number,
|
|
115
|
+
selRecords: PropTypes.number,
|
|
116
|
+
currentPage: PropTypes.number,
|
|
117
|
+
pageSize: PropTypes.number,
|
|
118
|
+
align: PropTypes.oneOf(['left', 'right', 'center']),
|
|
119
|
+
pageSizeType: PropTypes.array,
|
|
120
|
+
description: PropTypes.string,
|
|
121
|
+
style: PropTypes.object,
|
|
122
|
+
onPageNumberChange: PropTypes.func,
|
|
123
|
+
onPageSizeChange: PropTypes.func
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export default SuperPagination;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _Popconfirm from "antd/es/popconfirm";
|
|
3
|
+
import _Dropdown from "antd/es/dropdown";
|
|
4
|
+
import _Icon from "antd/es/icon";
|
|
5
|
+
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
6
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
7
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
8
|
+
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
9
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
10
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
11
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
12
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
13
|
+
import _Button from "antd/es/button";
|
|
14
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
15
|
+
import _Menu from "antd/es/menu";
|
|
16
|
+
var _excluded = ["type", "children"];
|
|
17
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
18
|
+
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
19
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
20
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
21
|
+
|
|
22
|
+
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); }; }
|
|
23
|
+
|
|
24
|
+
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; } }
|
|
25
|
+
|
|
26
|
+
import React from 'react';
|
|
27
|
+
import PropTypes from 'prop-types';
|
|
28
|
+
import variables from '../variables';
|
|
29
|
+
var MenuItem = _Menu.Item;
|
|
30
|
+
var SubMenu = _Menu.SubMenu;
|
|
31
|
+
var clicktag = 0; //被点击标识
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* key: 用于标识菜单项
|
|
35
|
+
* title: 菜单项上的文字
|
|
36
|
+
* subMenu: [可选],菜单项子列表,包含key和title的对象数组,此时点击菜单项不触发事件,只有点击子列表项才会触发onSubClick事件
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
var MenuType = {
|
|
40
|
+
key: PropTypes.string.isRequired,
|
|
41
|
+
title: PropTypes.string.isRequired,
|
|
42
|
+
subMenu: PropTypes.array
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* key: 用于标识按钮
|
|
46
|
+
* title: 按钮上的文字
|
|
47
|
+
* bsStyle: 按钮样式,与antd中Button的type取值一样
|
|
48
|
+
* confirm: 触发按钮事件前,是否需要用户确认,以及确认的提示文字;为空串则不会触发确认提示
|
|
49
|
+
* menu: [可选],下拉菜单项,有此属性时点击按钮不触发事件,菜单项如果仅是包含key和title的对象,点击菜单项会触发onClick事件
|
|
50
|
+
* 菜单项如果是包含key、title、subMenu的对象,则点击此菜单项不触发事件,必须点击子列表项时才会触发onSubClick事件
|
|
51
|
+
* loading: 是否正在加载,与antd中Button的loading取值一样
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
var ButtonType = {
|
|
55
|
+
key: PropTypes.string.isRequired,
|
|
56
|
+
title: PropTypes.string.isRequired,
|
|
57
|
+
bsStyle: PropTypes.string,
|
|
58
|
+
confirm: PropTypes.string,
|
|
59
|
+
menu: PropTypes.arrayOf(PropTypes.shape(MenuType)),
|
|
60
|
+
loading: PropTypes.bool
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var ButtonEx = function ButtonEx(_ref) {
|
|
64
|
+
var type = _ref.type,
|
|
65
|
+
children = _ref.children,
|
|
66
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
67
|
+
|
|
68
|
+
props[type === 'primary-o' ? 'data-btn-type' : 'type'] = type;
|
|
69
|
+
return /*#__PURE__*/React.createElement(_Button, props, children);
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* onClick: 纯按钮点击时或按钮下拉项中无子菜单列表项点击触发,原型为function(key)
|
|
73
|
+
* onSubClick: 按钮为下拉时下拉项子列表项点击时触发,原型为function(key, subKey)
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var SuperToolbar = /*#__PURE__*/function (_React$Component) {
|
|
78
|
+
_inherits(SuperToolbar, _React$Component);
|
|
79
|
+
|
|
80
|
+
var _super = _createSuper(SuperToolbar);
|
|
81
|
+
|
|
82
|
+
function SuperToolbar() {
|
|
83
|
+
var _context;
|
|
84
|
+
|
|
85
|
+
var _this;
|
|
86
|
+
|
|
87
|
+
_classCallCheck(this, SuperToolbar);
|
|
88
|
+
|
|
89
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
90
|
+
args[_key] = arguments[_key];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
94
|
+
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
96
|
+
var _this$props = _this.props,
|
|
97
|
+
onClick = _this$props.onClick,
|
|
98
|
+
onSubClick = _this$props.onSubClick;
|
|
99
|
+
var key = _typeof(e) === 'object' ? e.key : e;
|
|
100
|
+
|
|
101
|
+
if (_typeof(e) === 'object' && e.keyPath.length === 2 && onSubClick) {
|
|
102
|
+
onSubClick(e.keyPath[1], e.keyPath[0]);
|
|
103
|
+
} else if (onClick) {
|
|
104
|
+
if (clicktag === 0) {
|
|
105
|
+
clicktag = 1;
|
|
106
|
+
onClick(key); //1秒过后可以再次点击
|
|
107
|
+
|
|
108
|
+
_setTimeout(function () {
|
|
109
|
+
clicktag = 0;
|
|
110
|
+
}, 1000);
|
|
111
|
+
} else {
|
|
112
|
+
console.log('请勿频繁操作!');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "toSubMenu", function (_ref2) {
|
|
118
|
+
var key = _ref2.key,
|
|
119
|
+
title = _ref2.title,
|
|
120
|
+
_ref2$subMenu = _ref2.subMenu,
|
|
121
|
+
subMenu = _ref2$subMenu === void 0 ? [] : _ref2$subMenu;
|
|
122
|
+
return /*#__PURE__*/React.createElement(SubMenu, {
|
|
123
|
+
key: key,
|
|
124
|
+
title: title
|
|
125
|
+
}, _mapInstanceProperty(subMenu).call(subMenu, function (_ref3) {
|
|
126
|
+
var key = _ref3.key,
|
|
127
|
+
title = _ref3.title;
|
|
128
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
129
|
+
key: key
|
|
130
|
+
}, title);
|
|
131
|
+
}));
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
_defineProperty(_assertThisInitialized(_this), "toMenu", function (menu) {
|
|
135
|
+
return /*#__PURE__*/React.createElement(_Menu, {
|
|
136
|
+
onClick: _this.onClick
|
|
137
|
+
}, _mapInstanceProperty(menu).call(menu, function (item) {
|
|
138
|
+
var key = item.key,
|
|
139
|
+
title = item.title,
|
|
140
|
+
subMenu = item.subMenu;
|
|
141
|
+
|
|
142
|
+
if (subMenu) {
|
|
143
|
+
return _this.toSubMenu(item);
|
|
144
|
+
} else {
|
|
145
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
146
|
+
key: key
|
|
147
|
+
}, title);
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
_defineProperty(_assertThisInitialized(_this), "toButton", function (_ref4) {
|
|
153
|
+
var _context2;
|
|
154
|
+
|
|
155
|
+
var key = _ref4.key,
|
|
156
|
+
title = _ref4.title,
|
|
157
|
+
type = _ref4.bsStyle,
|
|
158
|
+
confirm = _ref4.confirm,
|
|
159
|
+
menu = _ref4.menu,
|
|
160
|
+
loading = _ref4.loading;
|
|
161
|
+
|
|
162
|
+
var onClick = _bindInstanceProperty(_context2 = _this.onClick).call(_context2, _assertThisInitialized(_this), key);
|
|
163
|
+
|
|
164
|
+
var _this$props$size = _this.props.size,
|
|
165
|
+
size = _this$props$size === void 0 ? 'small' : _this$props$size;
|
|
166
|
+
|
|
167
|
+
if (menu && menu.length) {
|
|
168
|
+
return /*#__PURE__*/React.createElement(_Dropdown, {
|
|
169
|
+
key: key,
|
|
170
|
+
trigger: ['hover'],
|
|
171
|
+
overlay: _this.toMenu(menu)
|
|
172
|
+
}, /*#__PURE__*/React.createElement(ButtonEx, {
|
|
173
|
+
size: size,
|
|
174
|
+
type: type
|
|
175
|
+
}, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
176
|
+
type: "down"
|
|
177
|
+
})));
|
|
178
|
+
} else if (!confirm) {
|
|
179
|
+
return /*#__PURE__*/React.createElement(ButtonEx, {
|
|
180
|
+
key: key,
|
|
181
|
+
size: size,
|
|
182
|
+
type: type,
|
|
183
|
+
onClick: onClick,
|
|
184
|
+
loading: loading
|
|
185
|
+
}, title);
|
|
186
|
+
} else {
|
|
187
|
+
return /*#__PURE__*/React.createElement(_Popconfirm, {
|
|
188
|
+
key: key,
|
|
189
|
+
title: confirm,
|
|
190
|
+
onConfirm: onClick
|
|
191
|
+
}, /*#__PURE__*/React.createElement(ButtonEx, {
|
|
192
|
+
size: size,
|
|
193
|
+
type: type,
|
|
194
|
+
loading: loading
|
|
195
|
+
}, title));
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
return _this;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
_createClass(SuperToolbar, [{
|
|
203
|
+
key: "render",
|
|
204
|
+
value: function render() {
|
|
205
|
+
var buttons = this.props.buttons;
|
|
206
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: variables('SuperToolbar'),
|
|
208
|
+
role: "toolbar"
|
|
209
|
+
}, _mapInstanceProperty(buttons).call(buttons, this.toButton));
|
|
210
|
+
}
|
|
211
|
+
}]);
|
|
212
|
+
|
|
213
|
+
return SuperToolbar;
|
|
214
|
+
}(React.Component);
|
|
215
|
+
|
|
216
|
+
_defineProperty(SuperToolbar, "propTypes", {
|
|
217
|
+
buttons: PropTypes.arrayOf(PropTypes.shape(ButtonType)).isRequired,
|
|
218
|
+
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
219
|
+
onClick: PropTypes.func,
|
|
220
|
+
onSubClick: PropTypes.func
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
export default SuperToolbar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../variables.less';
|
|
2
|
+
|
|
3
|
+
.@{cloudlink-prefix}-SuperToolbar {
|
|
4
|
+
> * {
|
|
5
|
+
margin-right: 5px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-btn-type='primary-o'] {
|
|
9
|
+
color: @brand-primary;
|
|
10
|
+
border-color: @brand-primary;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
color: @primary-5;
|
|
14
|
+
border-color: @primary-5;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|