cloud-b2b 1.0.2 → 1.0.3

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.
Files changed (50) hide show
  1. package/es/Area/Area.js +166 -0
  2. package/es/Area/package.json +6 -0
  3. package/es/Control/Control.js +27 -1
  4. package/es/Header/Header.js +1 -1
  5. package/es/Header/Header.less +12 -11
  6. package/es/HomeHeader/Header.less +1 -1
  7. package/es/Sidebar/Sidebar.js +2 -2
  8. package/es/Sidebar/Sidebar.less +10 -9
  9. package/es/SuperForm/SuperForm.js +74 -27
  10. package/es/SuperTable/DragSortRow.js +125 -0
  11. package/es/SuperTable/DragSortRow.less +17 -0
  12. package/es/SuperTable/FilterDropDown.js +188 -0
  13. package/es/SuperTable/FilterDropDown.less +30 -0
  14. package/es/SuperTable/SuperTable.js +933 -0
  15. package/es/SuperTable/SuperTable.less +135 -0
  16. package/es/SuperTable/fixed.js +42 -0
  17. package/es/SuperTable/package.json +6 -0
  18. package/es/SuperTable2/SuperTable2.js +700 -0
  19. package/es/SuperTable2/SuperTable2.less +100 -0
  20. package/es/SuperTable2/SuperTableCell.js +215 -0
  21. package/es/SuperTable2/package.json +6 -0
  22. package/es/adjust.less +89 -0
  23. package/es/index.js +4 -1
  24. package/es/style.less +20 -1
  25. package/lib/Area/Area.js +194 -0
  26. package/lib/Area/package.json +6 -0
  27. package/lib/Control/Control.js +29 -1
  28. package/lib/Header/Header.js +1 -1
  29. package/lib/Header/Header.less +12 -11
  30. package/lib/HomeHeader/Header.less +1 -1
  31. package/lib/Sidebar/Sidebar.js +2 -2
  32. package/lib/Sidebar/Sidebar.less +10 -9
  33. package/lib/SuperForm/SuperForm.js +72 -27
  34. package/lib/SuperTable/DragSortRow.js +142 -0
  35. package/lib/SuperTable/DragSortRow.less +17 -0
  36. package/lib/SuperTable/FilterDropDown.js +205 -0
  37. package/lib/SuperTable/FilterDropDown.less +30 -0
  38. package/lib/SuperTable/SuperTable.js +937 -0
  39. package/lib/SuperTable/SuperTable.less +135 -0
  40. package/lib/SuperTable/fixed.js +55 -0
  41. package/lib/SuperTable/package.json +6 -0
  42. package/lib/SuperTable2/SuperTable2.js +725 -0
  43. package/lib/SuperTable2/SuperTable2.less +100 -0
  44. package/lib/SuperTable2/SuperTableCell.js +231 -0
  45. package/lib/SuperTable2/package.json +6 -0
  46. package/lib/adjust.less +89 -0
  47. package/lib/index.js +28 -1
  48. package/lib/index.less +5 -0
  49. package/lib/style.less +20 -1
  50. package/package.json +1 -1
@@ -0,0 +1,100 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-SuperTable2 {
4
+ border-spacing: 0;
5
+ cursor: default;
6
+
7
+ :global(.ant-checkbox-input) {
8
+ z-index: -1;
9
+ }
10
+
11
+ :global(.ant-select-selection--multiple) {
12
+ max-width: 200px;
13
+ max-height: 22px;
14
+ overflow: auto;
15
+ }
16
+
17
+ :global(.ant-select-search__field) {
18
+ z-index: 0;
19
+ }
20
+
21
+ :global(.ant-switch-disabled) {
22
+ background: #e4e4e4;
23
+ }
24
+
25
+ :global(.ant-switch-checked) {
26
+ background: #2CBB45!important;
27
+ }
28
+
29
+ th [role='add'] {
30
+ color: @primary-color;
31
+ margin-left: 4px;
32
+ cursor: pointer;
33
+ }
34
+
35
+ td [role='imgBox']{
36
+ color: @primary-color;
37
+
38
+ span {
39
+ margin-left: 10px;
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ max-width: 100px;
43
+ }
44
+ }
45
+
46
+ :global(.ant-table-placeholder) {
47
+ padding: 0;
48
+
49
+ > div {
50
+ margin: 0;
51
+
52
+ :global(.ant-empty-image) {
53
+ display: none;
54
+ }
55
+ }
56
+ }
57
+
58
+ .emphasizedSelectRow{
59
+ background-color: @table-row-hover-bg;
60
+ color :#000;
61
+ font-weight: 700;
62
+ }
63
+ .emphasizedUnselectRow{
64
+ color :#000;
65
+ font-weight: 700;
66
+ }
67
+
68
+ .select {
69
+ background-color: @table-row-hover-bg;
70
+ }
71
+
72
+ .center {
73
+ text-align: center !important;
74
+ }
75
+
76
+ .left {
77
+ text-align: left !important;
78
+ }
79
+
80
+ .right {
81
+ text-align: right !important;
82
+ }
83
+
84
+ .noTransition{
85
+ tr {
86
+ transition: all 0s!important;
87
+ >td{
88
+ transition: all 0s!important;
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ .weakenedSelectRow{
95
+ background-color: @table-row-hover-bg;
96
+ color :#999;
97
+ }
98
+ .weakenedUnselectRow{
99
+ color :#999;
100
+ }
@@ -0,0 +1,215 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
7
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
8
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
9
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
10
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
11
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
12
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
13
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
14
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
15
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
16
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
17
+
18
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+
22
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
23
+
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); }; }
25
+
26
+ 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; } }
27
+
28
+ import React from 'react';
29
+ import PropTypes from 'prop-types';
30
+ import ReactDOM from 'react-dom';
31
+ import Control from '../Control'; // 单元格的type只能取如下值:
32
+ // 'text', 'number', select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'
33
+
34
+ var isInRegion = function isInRegion(target, _ref) {
35
+ var x = _ref.x,
36
+ y = _ref.y;
37
+
38
+ var _target$getBoundingCl = target.getBoundingClientRect(),
39
+ left = _target$getBoundingCl.left,
40
+ right = _target$getBoundingCl.right,
41
+ top = _target$getBoundingCl.top,
42
+ bottom = _target$getBoundingCl.bottom;
43
+
44
+ return !(x < left || x > right || y < top || y > bottom);
45
+ };
46
+
47
+ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
48
+ _inherits(SuperTableCell, _React$Component);
49
+
50
+ var _super = _createSuper(SuperTableCell);
51
+
52
+ function SuperTableCell() {
53
+ var _context;
54
+
55
+ var _this;
56
+
57
+ _classCallCheck(this, SuperTableCell);
58
+
59
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
+ args[_key] = arguments[_key];
61
+ }
62
+
63
+ _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
64
+
65
+ _defineProperty(_assertThisInitialized(_this), "onDateBlur", function (value, event) {
66
+ if (!isInRegion(event.target, global.mousePos)) {
67
+ _this.props.onBlur();
68
+ }
69
+ });
70
+
71
+ _defineProperty(_assertThisInitialized(_this), "onOpenChange", function (open) {
72
+ if (!open) {
73
+ var targets = document.getElementsByClassName('ant-calendar-picker-container');
74
+
75
+ if (!isInRegion(targets[0], global.mousePos)) {
76
+ _this.props.onBlur();
77
+ }
78
+ }
79
+ });
80
+
81
+ _defineProperty(_assertThisInitialized(_this), "options", function () {
82
+ return _this.props.options || _this.props.typeRelated || [];
83
+ });
84
+
85
+ _defineProperty(_assertThisInitialized(_this), "getPopupContainer", function () {
86
+ return ReactDOM.findDOMNode(_assertThisInitialized(_this));
87
+ });
88
+
89
+ _defineProperty(_assertThisInitialized(_this), "toTextComponent", function (props) {
90
+ return /*#__PURE__*/React.createElement(Control, props);
91
+ });
92
+
93
+ _defineProperty(_assertThisInitialized(_this), "toTextAreaComponent", function (props) {
94
+ return /*#__PURE__*/React.createElement(Control, props);
95
+ });
96
+
97
+ _defineProperty(_assertThisInitialized(_this), "toReadonlyComponent", function (props) {
98
+ return /*#__PURE__*/React.createElement(Control, props);
99
+ });
100
+
101
+ _defineProperty(_assertThisInitialized(_this), "toNumberComponent", function (props) {
102
+ props.defaultValue = props.value;
103
+ delete props.value;
104
+ return /*#__PURE__*/React.createElement(Control, props);
105
+ });
106
+
107
+ _defineProperty(_assertThisInitialized(_this), "toDateComponent", function (props) {
108
+ //props.getCalendarContainer = this.getPopupContainer;
109
+ props.onBlur = _this.onDateBlur;
110
+ props.onOpenChange = _this.onOpenChange;
111
+ return /*#__PURE__*/React.createElement(Control, props);
112
+ });
113
+
114
+ _defineProperty(_assertThisInitialized(_this), "toSelectComponent", function (props) {
115
+ props.options = _this.options();
116
+ props.dropdownMatchSelectWidth = false; //props.getPopupContainer = this.getPopupContainer;
117
+
118
+ return /*#__PURE__*/React.createElement(Control, props);
119
+ });
120
+
121
+ _defineProperty(_assertThisInitialized(_this), "toSearchComponent", function (props) {
122
+ props.options = _this.options(); //props.getPopupContainer = this.getPopupContainer;
123
+
124
+ props.onSearch = _this.props.onSearch;
125
+ props.dropdownMatchSelectWidth = false;
126
+ return /*#__PURE__*/React.createElement(Control, props);
127
+ });
128
+
129
+ _defineProperty(_assertThisInitialized(_this), "controlProps", function (_ref2) {
130
+ var type = _ref2.type,
131
+ value = _ref2.value,
132
+ _ref2$props = _ref2.props,
133
+ props = _ref2$props === void 0 ? {} : _ref2$props;
134
+ var _this$props$width = _this.props.width,
135
+ width = _this$props$width === void 0 ? 100 : _this$props$width;
136
+ type === 'readonly' && (props = {});
137
+ return _objectSpread(_objectSpread({}, props), {}, {
138
+ type: type,
139
+ value: value,
140
+ size: 'small',
141
+ autoFocus: _this.props.error,
142
+ style: {
143
+ width: '100%',
144
+ minWidth: width
145
+ },
146
+ onBlur: _this.props.onBlur,
147
+ onChange: _this.props.onChange
148
+ });
149
+ });
150
+
151
+ return _this;
152
+ }
153
+
154
+ _createClass(SuperTableCell, [{
155
+ key: "render",
156
+ value: function render() {
157
+ var props = this.controlProps(this.props);
158
+ var className = this.props.error ? 'has-error' : '';
159
+
160
+ switch (this.props.type) {
161
+ case "text":
162
+ return /*#__PURE__*/React.createElement("div", {
163
+ className: className
164
+ }, this.toTextComponent(props));
165
+
166
+ case "textArea":
167
+ return /*#__PURE__*/React.createElement("div", {
168
+ className: className
169
+ }, this.toTextAreaComponent(props));
170
+
171
+ case "number":
172
+ return /*#__PURE__*/React.createElement("div", {
173
+ className: className
174
+ }, this.toNumberComponent(props));
175
+
176
+ case "select":
177
+ return /*#__PURE__*/React.createElement("div", {
178
+ className: className
179
+ }, this.toSelectComponent(props));
180
+
181
+ case 'search':
182
+ case 'selectSearch':
183
+ return /*#__PURE__*/React.createElement("div", {
184
+ className: className
185
+ }, this.toSearchComponent(props));
186
+
187
+ case "date":
188
+ return /*#__PURE__*/React.createElement("div", {
189
+ className: className
190
+ }, this.toDateComponent(props));
191
+
192
+ case 'readonly':
193
+ return this.toReadonlyComponent(props);
194
+
195
+ default:
196
+ return /*#__PURE__*/React.createElement("div", null, "\"error type\"");
197
+ }
198
+ }
199
+ }]);
200
+
201
+ return SuperTableCell;
202
+ }(React.Component);
203
+
204
+ _defineProperty(SuperTableCell, "propTypes", {
205
+ type: PropTypes.string.isRequired,
206
+ value: PropTypes.any,
207
+ options: PropTypes.array,
208
+ props: PropTypes.object,
209
+ onChange: PropTypes.func,
210
+ onSearch: PropTypes.func,
211
+ onBlur: PropTypes.func
212
+ });
213
+
214
+ export default SuperTableCell;
215
+ export { isInRegion };
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "SuperTable2",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./SuperTable2.js"
6
+ }
package/es/adjust.less ADDED
@@ -0,0 +1,89 @@
1
+
2
+ .ant-table-small {
3
+ .ant-table-thead {
4
+ background-color: @table-header-bg;
5
+
6
+ > tr > th {
7
+ padding: 12px 8px 11px !important;
8
+ }
9
+ }
10
+
11
+ .ant-table-tbody > tr > td {
12
+ padding: 8px 8px 7px !important;
13
+ }
14
+
15
+ .ant-table-tbody > tr.ant-table-row-selected td {
16
+ background-color: @primary-1 !important;
17
+ }
18
+
19
+ .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td {
20
+ background-color: @table-header-bg !important;
21
+ }
22
+
23
+ .ant-table-selection-column {
24
+ min-width: 62px;
25
+ }
26
+
27
+ table {
28
+ border-collapse: separate;
29
+ border-spacing: 0;
30
+ }
31
+ }
32
+
33
+ .ant-modal {
34
+ top: 50px;
35
+ padding-bottom: 0;
36
+ }
37
+
38
+ .ant-form-item {
39
+ margin-bottom: 6px;
40
+ }
41
+
42
+ .ant-select-sm .ant-select-selection--single {
43
+ height: @input-height-sm !important;
44
+ overflow: hidden;
45
+ }
46
+
47
+ .ant-form-vertical .ant-form-item {
48
+ padding-bottom: 0;
49
+ }
50
+
51
+ .ant-form-item-control {
52
+ line-height: @input-height-sm;
53
+
54
+ > .ant-form-explain-holder[aria-hidden='true'] {
55
+ display: none;
56
+ }
57
+ }
58
+
59
+ .ant-form-vertical .ant-form-item-label {
60
+ padding: 0;
61
+ line-height: 1.2;
62
+ }
63
+
64
+ .ant-input-lg {
65
+ font-size: 12px;
66
+ }
67
+
68
+ .ant-btn-lg {
69
+ height: @input-height-lg;
70
+ }
71
+
72
+ .ant-menu-inline .ant-menu-item {
73
+ margin-top: 0;
74
+ margin-bottom: 0 !important;
75
+ }
76
+
77
+ .ant-modal-header {
78
+ padding: 13px 16px;
79
+ }
80
+
81
+ .ant-modal-body {
82
+ padding: 16px;
83
+ }
84
+
85
+ .ant-btn-primary:focus {
86
+ background-color: white;
87
+ color: @primary-color;
88
+ text-shadow: none;
89
+ }
package/es/index.js CHANGED
@@ -21,4 +21,7 @@ export { default as SuperIcon } from './SuperIcon';
21
21
  export { default as SuperToolbar } from './SuperToolbar';
22
22
  export { default as SuperUpload } from './SuperUpload';
23
23
  export { default as Viewer } from './Viewer';
24
- export { default as WingBlank } from './WingBlank';
24
+ export { default as WingBlank } from './WingBlank';
25
+ export { default as Area } from './Area';
26
+ export { default as SuperTable2 } from './SuperTable2';
27
+ export { default as SuperTable } from './SuperTable';
package/es/style.less CHANGED
@@ -1 +1,20 @@
1
- @import "./Title/Title.less";
1
+ @import "./adjust.less";
2
+ @import "./Title/Title.less";
3
+ @import "./Search/Search.less";
4
+ @import "./SuperForm/SuperForm.less";
5
+ @import "./SuperTable/SuperTable.less";
6
+ @import "./SuperTable2/SuperTable2.less";
7
+ @import "./Header/Header.less";
8
+ @import "./HomeHeader/Header.less";
9
+ @import "./InputEditor/InputEditor.less";
10
+ @import "./Layout/Layout.less";
11
+ @import "./LayoutLink/LayoutLink.less";
12
+ @import "./Loading/Loading.less";
13
+ @import "./Loading2/Loading2.less";
14
+ @import "./ModalWithDrag/ModalWithDrag.less";
15
+ @import "./Search/Search.less";
16
+ @import "./Sidebar/Sidebar.less";
17
+ @import "./Sidebar2/Sidebar.less";
18
+ @import "./SuperToolbar/SuperToolbar.less";
19
+ @import "./SuperUpload/SuperUpload.less";
20
+ @import "./Viewer/Viewer.less";
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
+
5
+ var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
6
+
7
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
8
+
9
+ var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
10
+
11
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
12
+
13
+ var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
14
+
15
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
16
+
17
+ var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
18
+
19
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
20
+
21
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
22
+
23
+ _Object$defineProperty(exports, "__esModule", {
24
+ value: true
25
+ });
26
+
27
+ exports["default"] = void 0;
28
+
29
+ var _row = _interopRequireDefault(require("antd/lib/row"));
30
+
31
+ var _col = _interopRequireDefault(require("antd/lib/col"));
32
+
33
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
34
+
35
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
36
+
37
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
38
+
39
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
40
+
41
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
42
+
43
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
44
+
45
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
46
+
47
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
48
+
49
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
50
+
51
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
52
+
53
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
54
+
55
+ var _react = _interopRequireDefault(require("react"));
56
+
57
+ var _propTypes = _interopRequireDefault(require("prop-types"));
58
+
59
+ var _helper = _interopRequireDefault(require("../helper"));
60
+
61
+ var _Control = _interopRequireDefault(require("../Control"));
62
+
63
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
64
+
65
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
66
+
67
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
68
+
69
+ 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; } }
70
+
71
+ var PROPS = {
72
+ value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].object]),
73
+ onChange: _propTypes["default"].func,
74
+ onBlur: _propTypes["default"].func,
75
+ onParentChange: _propTypes["default"].func,
76
+ child: _propTypes["default"].Array
77
+ };
78
+ var PROPS_KEYS = (0, _keys["default"])(PROPS);
79
+
80
+ var Area = /*#__PURE__*/function (_React$Component) {
81
+ (0, _inherits2["default"])(Area, _React$Component);
82
+
83
+ var _super = _createSuper(Area);
84
+
85
+ function Area(props) {
86
+ var _this;
87
+
88
+ (0, _classCallCheck2["default"])(this, Area);
89
+ _this = _super.call(this, props);
90
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (key, keyValue) {
91
+ var _this$props = _this.props,
92
+ onParentChange = _this$props.onParentChange,
93
+ child = _this$props.child,
94
+ value = _this$props.value;
95
+ var newValue = {};
96
+ newValue[key] = keyValue;
97
+ var CheckValue, checkIndex;
98
+ (0, _map["default"])(child).call(child, function (item, index) {
99
+ if (item.key === key) {
100
+ checkIndex = index;
101
+ }
102
+
103
+ CheckValue = index > checkIndex ? '' : value[item.key];
104
+ newValue[item.key] = item.key === key ? keyValue : CheckValue;
105
+ });
106
+
107
+ _this.setState({
108
+ value: _objectSpread(_objectSpread({}, _this.state.value), newValue)
109
+ }, function () {
110
+ return onParentChange && onParentChange(_this.state.value);
111
+ });
112
+ });
113
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (key, control, parentKey, KeyValue) {
114
+ var _this$props2 = _this.props,
115
+ onAreaSearch = _this$props2.onAreaSearch,
116
+ child = _this$props2.child,
117
+ value = _this$props2.value;
118
+ var flag = true;
119
+ (0, _map["default"])(child).call(child, function (item, index) {
120
+ if (item.key === key && index !== 0) {
121
+ var upKey = child[index - 1].key;
122
+
123
+ if (index !== 0 && (_helper["default"].isEmpty2(value[upKey]) || (0, _keys["default"])(value[upKey]).length === 0)) {
124
+ flag = false;
125
+ }
126
+
127
+ ;
128
+ }
129
+ });
130
+ return flag ? onAreaSearch && onAreaSearch(key, KeyValue, parentKey) : _helper["default"].showError('请输入上级选择器');
131
+ });
132
+ _this.state = {
133
+ value: props.value || {},
134
+ options: props.options || {}
135
+ };
136
+ return _this;
137
+ }
138
+
139
+ (0, _createClass2["default"])(Area, [{
140
+ key: "componentWillReceiveProps",
141
+ value: function componentWillReceiveProps(props) {
142
+ if (props.value !== this.props.value) {
143
+ this.setState({
144
+ value: props.value
145
+ });
146
+ }
147
+ }
148
+ }, {
149
+ key: "render",
150
+ value: function render() {
151
+ var _this2 = this;
152
+
153
+ var _this$props3 = this.props,
154
+ child = _this$props3.child,
155
+ parentKey = _this$props3.parentKey,
156
+ _this$props3$options = _this$props3.options,
157
+ options = _this$props3$options === void 0 ? {} : _this$props3$options,
158
+ _this$props3$readonly = _this$props3.readonly,
159
+ readonly = _this$props3$readonly === void 0 ? false : _this$props3$readonly,
160
+ value = _this$props3.value;
161
+ return /*#__PURE__*/_react["default"].createElement(_row["default"], null, (0, _map["default"])(child).call(child, function (item, index) {
162
+ var _context, _context2, _context3;
163
+
164
+ var childOptions = [];
165
+
166
+ if ((0, _includes["default"])(_context = (0, _keys["default"])(options)).call(_context, item.key)) {
167
+ if (index === 0) {
168
+ childOptions = options[item.key];
169
+ } else {
170
+ var upKey = child[index - 1].key;
171
+ childOptions = _helper["default"].isEmpty2(value[upKey]) || (0, _keys["default"])(value[upKey]).length === 0 ? [] : options[item.key];
172
+ }
173
+ }
174
+
175
+ var props = _objectSpread(_objectSpread({}, item), {}, {
176
+ onSearch: (0, _bind["default"])(_context2 = _this2.onSearch).call(_context2, _this2, item.key, item, parentKey),
177
+ onChange: (0, _bind["default"])(_context3 = _this2.onChange).call(_context3, _this2, item.key),
178
+ options: childOptions,
179
+ value: _this2.props.value[item.key].title ? _this2.props.value[item.key].title : _this2.props.value[item.key],
180
+ type: readonly ? 'readonly' : item.type
181
+ });
182
+
183
+ return /*#__PURE__*/_react["default"].createElement(_col["default"], {
184
+ span: 24 / child.length,
185
+ key: item.key
186
+ }, /*#__PURE__*/_react["default"].createElement(_Control["default"], props));
187
+ }));
188
+ }
189
+ }]);
190
+ return Area;
191
+ }(_react["default"].Component);
192
+
193
+ var _default = Area;
194
+ exports["default"] = _default;
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Area",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Area.js"
6
+ }