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.
Files changed (172) hide show
  1. package/es/Card/Card.js +20 -0
  2. package/es/Card/package.json +6 -0
  3. package/es/Control/Control.js +402 -0
  4. package/es/Control/event.js +57 -0
  5. package/es/Control/package.json +6 -0
  6. package/es/Enhance/Dialogs.js +67 -0
  7. package/es/Enhance/Loading.js +151 -0
  8. package/es/Enhance/index.js +8 -0
  9. package/es/Enhance/package.json +6 -0
  10. package/es/Header/Header.js +194 -0
  11. package/es/Header/Header.less +94 -0
  12. package/es/Header/Vertical.js +129 -0
  13. package/es/Header/Vertical.less +60 -0
  14. package/es/Header/package.json +6 -0
  15. package/es/HomeHeader/Header.js +75 -0
  16. package/es/HomeHeader/Header.less +73 -0
  17. package/es/HomeHeader/package.json +6 -0
  18. package/es/ImageView/ImageView.js +117 -0
  19. package/es/ImageView/ImageView.less +14 -0
  20. package/es/ImageView/package.json +6 -0
  21. package/es/InpurCascader/InputCascader.js +135 -0
  22. package/es/InpurCascader/package.json +6 -0
  23. package/es/InputEditor/InputEditor.js +118 -0
  24. package/es/InputEditor/inputEditor.less +8 -0
  25. package/es/InputEditor/package.json +6 -0
  26. package/es/InputSearch/InputSearch.js +306 -0
  27. package/es/InputSearch/package.json +6 -0
  28. package/es/InputSelect/InputSelect.js +185 -0
  29. package/es/InputSelect/package.json +6 -0
  30. package/es/InputWriting/InputWriting.js +107 -0
  31. package/es/InputWriting/package.json +6 -0
  32. package/es/Layout/Layout.js +232 -0
  33. package/es/Layout/Layout.less +28 -0
  34. package/es/Layout/package.json +6 -0
  35. package/es/LayoutLink/LayoutLink.js +82 -0
  36. package/es/LayoutLink/LayoutLink.less +53 -0
  37. package/es/LayoutLink/package.json +6 -0
  38. package/es/Link/Link.js +108 -0
  39. package/es/Link/package.json +6 -0
  40. package/es/Loading/Loading.js +15 -0
  41. package/es/Loading/Loading.less +13 -0
  42. package/es/Loading/package.json +6 -0
  43. package/es/Loading2/Loading2.js +11 -0
  44. package/es/Loading2/Loading2.less +19 -0
  45. package/es/Loading2/package.json +6 -0
  46. package/es/ModalWithDrag/ModalWithDrag.js +34 -0
  47. package/es/ModalWithDrag/ModalWithDrag.less +6 -0
  48. package/es/ModalWithDrag/drag.js +133 -0
  49. package/es/ModalWithDrag/package.json +6 -0
  50. package/es/NumberInput/NumberInput.js +237 -0
  51. package/es/NumberInput/package.json +6 -0
  52. package/es/Search/Search.js +581 -0
  53. package/es/Search/Search.less +63 -0
  54. package/es/Search/package.json +6 -0
  55. package/es/Sidebar/Sidebar.js +165 -0
  56. package/es/Sidebar/Sidebar.less +77 -0
  57. package/es/Sidebar/package.json +6 -0
  58. package/es/Sidebar2/Sidebar.js +192 -0
  59. package/es/Sidebar2/Sidebar.less +153 -0
  60. package/es/Sidebar2/package.json +6 -0
  61. package/es/SuperForm/SuperForm.js +641 -0
  62. package/es/SuperForm/SuperForm.less +52 -0
  63. package/es/SuperForm/package.json +6 -0
  64. package/es/SuperIcon/SuperIcon.js +30 -0
  65. package/es/SuperIcon/package.json +6 -0
  66. package/es/SuperPagination/SuperPagination.js +126 -0
  67. package/es/SuperPagination/package.json +6 -0
  68. package/es/SuperToolbar/SuperToolbar.js +223 -0
  69. package/es/SuperToolbar/SuperToolbar.less +17 -0
  70. package/es/SuperToolbar/package.json +6 -0
  71. package/es/SuperUpload/SuperUpload.js +282 -0
  72. package/es/SuperUpload/SuperUpload.less +27 -0
  73. package/es/SuperUpload/package.json +6 -0
  74. package/es/Viewer/ImageViews.js +311 -0
  75. package/es/Viewer/Viewer.js +149 -0
  76. package/es/Viewer/Viewer.less +67 -0
  77. package/es/Viewer/imgView.less +59 -0
  78. package/es/Viewer/package.json +7 -0
  79. package/es/WingBlank/WingBlank.js +20 -0
  80. package/es/WingBlank/WingBlank.less +12 -0
  81. package/es/WingBlank/package.json +6 -0
  82. package/es/helper.js +118 -0
  83. package/es/history.js +5 -0
  84. package/es/index.js +24 -1
  85. package/es/variables.less +73 -73
  86. package/lib/Card/Card.js +38 -0
  87. package/lib/Card/package.json +6 -0
  88. package/lib/Control/Control.js +449 -0
  89. package/lib/Control/event.js +68 -0
  90. package/lib/Control/package.json +6 -0
  91. package/lib/Enhance/Dialogs.js +87 -0
  92. package/lib/Enhance/Loading.js +175 -0
  93. package/lib/Enhance/index.js +35 -0
  94. package/lib/Enhance/package.json +6 -0
  95. package/lib/Header/Header.js +215 -0
  96. package/lib/Header/Header.less +94 -0
  97. package/lib/Header/Vertical.js +150 -0
  98. package/lib/Header/Vertical.less +60 -0
  99. package/lib/Header/package.json +6 -0
  100. package/lib/HomeHeader/Header.js +95 -0
  101. package/lib/HomeHeader/Header.less +73 -0
  102. package/lib/HomeHeader/package.json +6 -0
  103. package/lib/ImageView/ImageView.js +134 -0
  104. package/lib/ImageView/ImageView.less +14 -0
  105. package/lib/ImageView/package.json +6 -0
  106. package/lib/InpurCascader/InputCascader.js +156 -0
  107. package/lib/InpurCascader/package.json +6 -0
  108. package/lib/InputEditor/InputEditor.js +136 -0
  109. package/lib/InputEditor/inputEditor.less +8 -0
  110. package/lib/InputEditor/package.json +6 -0
  111. package/lib/InputSearch/InputSearch.js +322 -0
  112. package/lib/InputSearch/package.json +6 -0
  113. package/lib/InputSelect/InputSelect.js +208 -0
  114. package/lib/InputSelect/package.json +6 -0
  115. package/lib/InputWriting/InputWriting.js +123 -0
  116. package/lib/InputWriting/package.json +6 -0
  117. package/lib/Layout/Layout.js +258 -0
  118. package/lib/Layout/Layout.less +28 -0
  119. package/lib/Layout/package.json +6 -0
  120. package/lib/LayoutLink/LayoutLink.js +114 -0
  121. package/lib/LayoutLink/LayoutLink.less +53 -0
  122. package/lib/LayoutLink/package.json +6 -0
  123. package/lib/Link/Link.js +130 -0
  124. package/lib/Link/package.json +6 -0
  125. package/lib/Loading/Loading.js +30 -0
  126. package/lib/Loading/Loading.less +13 -0
  127. package/lib/Loading/package.json +6 -0
  128. package/lib/Loading2/Loading2.js +26 -0
  129. package/lib/Loading2/Loading2.less +19 -0
  130. package/lib/Loading2/package.json +6 -0
  131. package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
  132. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  133. package/lib/ModalWithDrag/drag.js +147 -0
  134. package/lib/ModalWithDrag/package.json +6 -0
  135. package/lib/NumberInput/NumberInput.js +259 -0
  136. package/lib/NumberInput/package.json +6 -0
  137. package/lib/Search/Search.js +603 -0
  138. package/lib/Search/Search.less +63 -0
  139. package/lib/Search/package.json +6 -0
  140. package/lib/Sidebar/Sidebar.js +186 -0
  141. package/lib/Sidebar/Sidebar.less +77 -0
  142. package/lib/Sidebar/package.json +6 -0
  143. package/lib/Sidebar2/Sidebar.js +213 -0
  144. package/lib/Sidebar2/Sidebar.less +153 -0
  145. package/lib/Sidebar2/package.json +6 -0
  146. package/lib/SuperForm/SuperForm.js +657 -0
  147. package/lib/SuperForm/SuperForm.less +52 -0
  148. package/lib/SuperForm/package.json +6 -0
  149. package/lib/SuperIcon/SuperIcon.js +47 -0
  150. package/lib/SuperIcon/package.json +6 -0
  151. package/lib/SuperPagination/SuperPagination.js +145 -0
  152. package/lib/SuperPagination/package.json +6 -0
  153. package/lib/SuperToolbar/SuperToolbar.js +248 -0
  154. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  155. package/lib/SuperToolbar/package.json +6 -0
  156. package/lib/SuperUpload/SuperUpload.js +324 -0
  157. package/lib/SuperUpload/SuperUpload.less +27 -0
  158. package/lib/SuperUpload/package.json +6 -0
  159. package/lib/Viewer/ImageViews.js +323 -0
  160. package/lib/Viewer/Viewer.js +167 -0
  161. package/lib/Viewer/Viewer.less +67 -0
  162. package/lib/Viewer/imgView.less +59 -0
  163. package/lib/Viewer/package.json +7 -0
  164. package/lib/WingBlank/WingBlank.js +37 -0
  165. package/lib/WingBlank/WingBlank.less +12 -0
  166. package/lib/WingBlank/package.json +6 -0
  167. package/lib/helper.js +147 -0
  168. package/lib/history.js +18 -0
  169. package/lib/index.js +208 -1
  170. package/lib/index.less +20 -1
  171. package/lib/variables.less +73 -73
  172. package/package.json +3 -2
@@ -0,0 +1,603 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+
5
+ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
+
7
+ var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
8
+
9
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
10
+
11
+ var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
12
+
13
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
14
+
15
+ var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
16
+
17
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
18
+
19
+ var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
20
+
21
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
22
+
23
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
24
+
25
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
26
+
27
+ _Object$defineProperty(exports, "__esModule", {
28
+ value: true
29
+ });
30
+
31
+ exports["default"] = void 0;
32
+
33
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
34
+
35
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
36
+
37
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
38
+
39
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
40
+
41
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
42
+
43
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
44
+
45
+ var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
46
+
47
+ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
48
+
49
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
50
+
51
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
52
+
53
+ var _row = _interopRequireDefault(require("antd/lib/row"));
54
+
55
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
56
+
57
+ var _col = _interopRequireDefault(require("antd/lib/col"));
58
+
59
+ var _icon = _interopRequireDefault(require("antd/lib/icon"));
60
+
61
+ var _button = _interopRequireDefault(require("antd/lib/button"));
62
+
63
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
64
+
65
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
66
+
67
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
68
+
69
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
70
+
71
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
72
+
73
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
74
+
75
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
76
+
77
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
78
+
79
+ var _form = _interopRequireDefault(require("antd/lib/form"));
80
+
81
+ var _react = _interopRequireDefault(require("react"));
82
+
83
+ var _propTypes = _interopRequireDefault(require("prop-types"));
84
+
85
+ var _reactDom = _interopRequireDefault(require("react-dom"));
86
+
87
+ var _Control = _interopRequireWildcard(require("../Control"));
88
+
89
+ var _helper = require("../helper");
90
+
91
+ var _variables = _interopRequireDefault(require("../variables"));
92
+
93
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
94
+
95
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
96
+
97
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
98
+
99
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context12, _context13; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context12 = ownKeys(Object(source), !0)).call(_context12, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context13 = ownKeys(Object(source))).call(_context13, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
100
+
101
+ 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); }; }
102
+
103
+ 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; } }
104
+
105
+ var FormItem = _form["default"].Item;
106
+ var defaultSize = 'small';
107
+ var defaultColNum = 4;
108
+ var TYPE = ['text', 'search', 'select', 'number', 'date', 'readonly', 'selectSearch', 'cascader' //级联选择下拉
109
+ ];
110
+ /**
111
+ * search: 搜索按钮的标题
112
+ * more:更多按钮的标题
113
+ * reset:重置按钮的标题
114
+ * sort:排序按钮的标题
115
+ */
116
+
117
+ var ConfigType = {
118
+ search: _propTypes["default"].string.isRequired,
119
+ reset: _propTypes["default"].string,
120
+ sort: _propTypes["default"].string,
121
+ more: _propTypes["default"].string
122
+ };
123
+ /**
124
+ * key: 唯一标识一个表单元素
125
+ * title:表单元素旁边的标题
126
+ * type:表单元素的类型
127
+ * props:传递给表单元素的额外属性
128
+ */
129
+
130
+ var FilterType = {
131
+ key: _propTypes["default"].string.isRequired,
132
+ title: _propTypes["default"].string.isRequired,
133
+ type: _propTypes["default"].oneOf(TYPE).isRequired,
134
+ options: _propTypes["default"].array,
135
+ props: _propTypes["default"].object
136
+ };
137
+ /**
138
+ * data:传递给filters的默认值,为key:value的形式,此处的key为FilterType中的key
139
+ * isSort:是否需要排序按钮,默认false,当设置为true时,onClick函数需要实现key为sort的响应函数
140
+ * options: 作用同FilterType.options类似,但优先级高于它
141
+ * onClick:按钮点击事件,原型为func(key)
142
+ * onChange:表单控件内容改变时触发,原型为func(key, value)
143
+ * onSearch:search控件发出的事件,原型为func(key, value)
144
+ * displayRow:折叠时需要展示的行数,整数,默认为1
145
+ */
146
+
147
+ var Search = /*#__PURE__*/function (_React$Component) {
148
+ (0, _inherits2["default"])(Search, _React$Component);
149
+
150
+ var _super = _createSuper(Search);
151
+
152
+ function Search() {
153
+ var _context;
154
+
155
+ var _this;
156
+
157
+ (0, _classCallCheck2["default"])(this, Search);
158
+
159
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
160
+ args[_key] = arguments[_key];
161
+ }
162
+
163
+ _this = _super.call.apply(_super, (0, _concat["default"])(_context = [this]).call(_context, args));
164
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
165
+ more: false
166
+ });
167
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClick", function (key) {
168
+ var onClick = _this.props.onClick;
169
+ onClick && onClick(key);
170
+ });
171
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMore", function () {
172
+ var onHeightChange = _this.props.onHeightChange;
173
+
174
+ _this.setState({
175
+ more: !_this.state.more
176
+ });
177
+
178
+ onHeightChange && onHeightChange(_this.calHeight(!_this.state.more));
179
+ });
180
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (dictionary, key, value) {
181
+ var _context2, _context3;
182
+
183
+ var onChange = _this.props.onChange;
184
+
185
+ if (value && key === 'queryGroup' && dictionary && global.dictionary && global.dictionary[dictionary] && !(0, _includes["default"])(_context2 = (0, _map["default"])(_context3 = global.dictionary[dictionary]).call(_context3, function (item) {
186
+ return item.value;
187
+ })).call(_context2, value)) {
188
+ var _context4;
189
+
190
+ var realValue = JSON.parse(value);
191
+
192
+ _this.onClick('reset');
193
+
194
+ (0, _map["default"])(_context4 = (0, _keys["default"])(realValue)).call(_context4, function (objectKey) {
195
+ onChange && objectKey !== 'queryId' && onChange(objectKey, realValue[objectKey]);
196
+ });
197
+ }
198
+
199
+ onChange && onChange(key, value);
200
+ });
201
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPressEnter", function () {
202
+ _reactDom["default"].findDOMNode(_this.refs.search).click();
203
+ });
204
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toButton", function (key) {
205
+ var _context5;
206
+
207
+ var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
208
+ var config = _this.props.config;
209
+ var onClick = (0, _bind["default"])(_context5 = _this.onClick).call(_context5, (0, _assertThisInitialized2["default"])(_this), key);
210
+ return /*#__PURE__*/_react["default"].createElement(_button["default"], (0, _extends2["default"])({
211
+ size: defaultSize,
212
+ onClick: onClick
213
+ }, props), config[key]);
214
+ });
215
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toMore", function () {
216
+ return /*#__PURE__*/_react["default"].createElement("a", {
217
+ role: "more",
218
+ onClick: _this.onMore
219
+ }, _this.props.config.more, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
220
+ type: "down",
221
+ "data-status": !_this.state.more ? 'down' : 'up'
222
+ }));
223
+ });
224
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toButtons", function () {
225
+ var config = _this.props.config;
226
+ return /*#__PURE__*/_react["default"].createElement("div", {
227
+ role: "buttons"
228
+ }, _this.toButton('search', {
229
+ ref: 'search',
230
+ type: 'primary'
231
+ }), config.reset ? _this.toButton('reset') : null, _this.isSort() ? _this.toButton('sort') : null, _this.isMore() ? _this.toMore() : null);
232
+ });
233
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isSort", function () {
234
+ var _this$props = _this.props,
235
+ config = _this$props.config,
236
+ _this$props$colNum = _this$props.colNum,
237
+ colNum = _this$props$colNum === void 0 ? defaultColNum : _this$props$colNum,
238
+ filters = _this$props.filters,
239
+ _this$props$isSort = _this$props.isSort,
240
+ isSort = _this$props$isSort === void 0 ? false : _this$props$isSort;
241
+ return isSort && (0, _sort["default"])(config) && filters.length > colNum;
242
+ });
243
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isMore", function () {
244
+ var _this$props2 = _this.props,
245
+ config = _this$props2.config,
246
+ _this$props2$colNum = _this$props2.colNum,
247
+ colNum = _this$props2$colNum === void 0 ? defaultColNum : _this$props2$colNum,
248
+ filters = _this$props2.filters,
249
+ _this$props2$displayR = _this$props2.displayRow,
250
+ displayRow = _this$props2$displayR === void 0 ? 1 : _this$props2$displayR;
251
+ return config.more && (0, _filter["default"])(filters).call(filters, function (item) {
252
+ return !item.hide;
253
+ }).length > colNum * displayRow;
254
+ });
255
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getOptions", function (filter) {
256
+ var options = _this.props.options;
257
+
258
+ if (options && (0, _isArray["default"])(options[filter.key])) {
259
+ return options[filter.key];
260
+ } else {
261
+ return filter.options || filter.typeRelated || [];
262
+ }
263
+ });
264
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getContainer", function () {
265
+ return _this.props.getContainer;
266
+ });
267
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getControlProps", function (control) {
268
+ var _context6;
269
+
270
+ var _this$props$data = _this.props.data,
271
+ data = _this$props$data === void 0 ? {} : _this$props$data;
272
+ return _objectSpread(_objectSpread({}, control.props || {}), {}, {
273
+ size: defaultSize,
274
+ type: control.type,
275
+ value: (0, _Control.makeString)(data[control.key]),
276
+ onChange: (0, _bind["default"])(_context6 = _this.onChange).call(_context6, (0, _assertThisInitialized2["default"])(_this), control.dictionary, control.key)
277
+ });
278
+ });
279
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validDate", function (_ref) {
280
+ var key = _ref.key,
281
+ type = _ref.type;
282
+ return function (date) {
283
+ var _this$props$data2 = _this.props.data,
284
+ data = _this$props$data2 === void 0 ? {} : _this$props$data2;
285
+
286
+ if (!date || !data[key]) {
287
+ return false;
288
+ } else {
289
+ if (type === '>') {
290
+ return date.format('YYYY-MM-DD HH:mm:ss') <= data[key].valueOf();
291
+ } else if (type === '<') {
292
+ return date.format('YYYY-MM-DD HH:mm:ss') >= data[key].valueOf();
293
+ } else {
294
+ return false;
295
+ }
296
+ }
297
+ };
298
+ });
299
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toText", function (props) {
300
+ props.onPressEnter = _this.onPressEnter;
301
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
302
+ });
303
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toNumber", function (props) {
304
+ props.defaultValue = props.value;
305
+ delete props.value;
306
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
307
+ });
308
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getQueryGroupOptions", function (_ref2) {
309
+ var dictionary = _ref2.dictionary,
310
+ _ref2$configCode = _ref2.configCode,
311
+ configCode = _ref2$configCode === void 0 ? 'unknown' : _ref2$configCode;
312
+ var realOptions = [];
313
+
314
+ if (dictionary && global.dictionary) {
315
+ var dicOptions = global.dictionary[dictionary] || [];
316
+ realOptions = (0, _concat["default"])(realOptions).call(realOptions, dicOptions);
317
+ }
318
+
319
+ var state = global.store.getState();
320
+ var path = ['layout', 'tableColsSetting', configCode];
321
+
322
+ var _ref3 = (0, _helper.getPathValue)(state, path) || {},
323
+ _ref3$queryList = _ref3.queryList,
324
+ queryList = _ref3$queryList === void 0 ? [] : _ref3$queryList;
325
+
326
+ return (0, _concat["default"])(realOptions).call(realOptions, (0, _map["default"])(queryList).call(queryList, function (item) {
327
+ return {
328
+ title: item.name,
329
+ value: (0, _stringify["default"])(item.query)
330
+ };
331
+ }));
332
+ });
333
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toSelect", function (props, filter) {
334
+ var container = _this.getContainer();
335
+
336
+ container && (props.getPopupContainer = container);
337
+ props.options = filter.key === 'queryGroup' ? _this.getQueryGroupOptions(filter) : _this.getOptions(filter);
338
+ props.dropdownMatchSelectWidth = false;
339
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
340
+ });
341
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "createSearchEvent", function (filter) {
342
+ if (_this.props.onSearch) {
343
+ return function (value) {
344
+ return _this.props.onSearch(filter.key, value, filter);
345
+ };
346
+ } else {
347
+ return null;
348
+ }
349
+ });
350
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toSearch", function (props, filter) {
351
+ var container = _this.getContainer();
352
+
353
+ container && (props.getPopupContainer = container);
354
+ props.options = _this.getOptions(filter);
355
+ props.onSearch = _this.createSearchEvent(filter);
356
+ props.dropdownMatchSelectWidth = false;
357
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
358
+ });
359
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "selectSearch", function (props, filter) {
360
+ var container = _this.getContainer();
361
+
362
+ container && (props.getPopupContainer = container);
363
+ props.options = _this.getOptions(filter);
364
+ props.onSearch = _this.createSearchEvent(filter);
365
+ props.dropdownMatchSelectWidth = false;
366
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
367
+ });
368
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toDate", function (props, _ref4) {
369
+ var rule = _ref4.rule;
370
+
371
+ var container = _this.getContainer();
372
+
373
+ container && (props.getCalendarContainer = container);
374
+ rule && (props.disabledDate = _this.validDate(rule));
375
+ props.style = {
376
+ width: '100%'
377
+ };
378
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
379
+ });
380
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toReadonly", function (props, filter) {
381
+ props.value = (0, _Control.getTitle)(props.value, _this.getOptions(filter));
382
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
383
+ });
384
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toCascader", function (props, filter) {
385
+ var container = _this.getContainer();
386
+
387
+ container && (props.getPopupContainer = container);
388
+ props.options = _this.getOptions(filter);
389
+ props.onSearch = _this.createSearchEvent(filter);
390
+ props.placeholder = filter.placeholder || '';
391
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
392
+ });
393
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toControl", function (control) {
394
+ var props = _this.getControlProps(control);
395
+
396
+ switch (control.type) {
397
+ case 'text':
398
+ return _this.toText(props, control);
399
+
400
+ case 'number':
401
+ return _this.toNumber(props, control);
402
+
403
+ case 'select':
404
+ return _this.toSelect(props, control);
405
+
406
+ case 'selectSearch':
407
+ return _this.selectSearch(props, control);
408
+
409
+ case 'search':
410
+ return _this.toSearch(props, control);
411
+
412
+ case 'date':
413
+ return _this.toDate(props, control);
414
+
415
+ case 'readonly':
416
+ return _this.toReadonly(props, control);
417
+
418
+ case 'cascader':
419
+ return _this.toCascader(props, control);
420
+
421
+ default:
422
+ return 'type error';
423
+ }
424
+ });
425
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toLabel", function (_ref5) {
426
+ var title = _ref5.title,
427
+ key = _ref5.key,
428
+ dictionary = _ref5.dictionary,
429
+ _ref5$configCode = _ref5.configCode,
430
+ configCode = _ref5$configCode === void 0 ? 'unknown' : _ref5$configCode;
431
+
432
+ if (key === 'queryGroup') {
433
+ var _context7, _context8;
434
+
435
+ //查询组合
436
+ return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
437
+ role: "icon",
438
+ type: "plus-circle-o",
439
+ onClick: (0, _bind["default"])(_context7 = _this.onAddQueryGroup).call(_context7, (0, _assertThisInitialized2["default"])(_this), configCode, _this.props.data, dictionary)
440
+ }), /*#__PURE__*/_react["default"].createElement(_icon["default"], {
441
+ role: "icon",
442
+ type: "minus-circle-o",
443
+ onClick: (0, _bind["default"])(_context8 = _this.onDelQueryGroup).call(_context8, (0, _assertThisInitialized2["default"])(_this), configCode, _this.props.data, dictionary)
444
+ }));
445
+ } else {
446
+ return title;
447
+ }
448
+ });
449
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toCol", function (span, control, more) {
450
+ var factor = control.span || 1;
451
+ return /*#__PURE__*/_react["default"].createElement(_col["default"], {
452
+ span: span * factor,
453
+ key: control.key,
454
+ onFocus: more ? function () {
455
+ _this.setState({
456
+ more: true
457
+ });
458
+ } : undefined
459
+ }, /*#__PURE__*/_react["default"].createElement(FormItem, {
460
+ label: _this.toLabel(control),
461
+ required: control.required
462
+ }, _this.toControl(control)));
463
+ });
464
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toCols", function () {
465
+ var _context9;
466
+
467
+ var _this$props3 = _this.props,
468
+ _this$props3$colNum = _this$props3.colNum,
469
+ colNum = _this$props3$colNum === void 0 ? defaultColNum : _this$props3$colNum,
470
+ filters = _this$props3.filters,
471
+ _this$props3$displayR = _this$props3.displayRow,
472
+ displayRow = _this$props3$displayR === void 0 ? 1 : _this$props3$displayR;
473
+ var span = 24 / Math.min(colNum, (0, _filter["default"])(filters).call(filters, function (item) {
474
+ return !item.hide;
475
+ }).length);
476
+ return (0, _map["default"])(_context9 = (0, _filter["default"])(filters).call(filters, function (item) {
477
+ return !item.hide;
478
+ })).call(_context9, function (control, index) {
479
+ return _this.toCol(span, control, index >= colNum * displayRow);
480
+ });
481
+ });
482
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "calWidth", function () {
483
+ var _this$props4 = _this.props,
484
+ _this$props4$colNum = _this$props4.colNum,
485
+ colNum = _this$props4$colNum === void 0 ? defaultColNum : _this$props4$colNum,
486
+ filters = _this$props4.filters;
487
+ var length = (0, _filter["default"])(filters).call(filters, function (item) {
488
+ return !item.hide;
489
+ }).length;
490
+
491
+ if (length < colNum) {
492
+ return "".concat(length * 18, "%");
493
+ } else {
494
+ return "".concat(defaultColNum * 18, "%");
495
+ }
496
+ });
497
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "calHeight", function (more) {
498
+ var _this$props5 = _this.props,
499
+ _this$props5$colNum = _this$props5.colNum,
500
+ colNum = _this$props5$colNum === void 0 ? defaultColNum : _this$props5$colNum,
501
+ filters = _this$props5.filters,
502
+ _this$props5$displayR = _this$props5.displayRow,
503
+ displayRow = _this$props5$displayR === void 0 ? 1 : _this$props5$displayR;
504
+
505
+ if (more) {
506
+ var row = Math.ceil((0, _filter["default"])(filters).call(filters, function (item) {
507
+ return !item.hide;
508
+ }).length / colNum);
509
+ return row * 36 + (row - 1) * 10;
510
+ } else {
511
+ return displayRow * 36 + (displayRow - 1) * 10;
512
+ }
513
+ });
514
+ return _this;
515
+ }
516
+
517
+ (0, _createClass2["default"])(Search, [{
518
+ key: "onAddQueryGroup",
519
+ value: function () {
520
+ var _onAddQueryGroup = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(configCode, searchData, dictionary) {
521
+ var onAddQueryGroup;
522
+ return _regenerator["default"].wrap(function _callee$(_context10) {
523
+ while (1) {
524
+ switch (_context10.prev = _context10.next) {
525
+ case 0:
526
+ onAddQueryGroup = this.props.onAddQueryGroup;
527
+ onAddQueryGroup && onAddQueryGroup(configCode, searchData, dictionary);
528
+
529
+ case 2:
530
+ case "end":
531
+ return _context10.stop();
532
+ }
533
+ }
534
+ }, _callee, this);
535
+ }));
536
+
537
+ function onAddQueryGroup(_x, _x2, _x3) {
538
+ return _onAddQueryGroup.apply(this, arguments);
539
+ }
540
+
541
+ return onAddQueryGroup;
542
+ }()
543
+ }, {
544
+ key: "onDelQueryGroup",
545
+ value: function () {
546
+ var _onDelQueryGroup = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(configCode, searchData, dictionary) {
547
+ var onDelQueryGroup;
548
+ return _regenerator["default"].wrap(function _callee2$(_context11) {
549
+ while (1) {
550
+ switch (_context11.prev = _context11.next) {
551
+ case 0:
552
+ onDelQueryGroup = this.props.onDelQueryGroup;
553
+ onDelQueryGroup && onDelQueryGroup(configCode, searchData, dictionary);
554
+
555
+ case 2:
556
+ case "end":
557
+ return _context11.stop();
558
+ }
559
+ }
560
+ }, _callee2, this);
561
+ }));
562
+
563
+ function onDelQueryGroup(_x4, _x5, _x6) {
564
+ return _onDelQueryGroup.apply(this, arguments);
565
+ }
566
+
567
+ return onDelQueryGroup;
568
+ }()
569
+ }, {
570
+ key: "render",
571
+ value: function render() {
572
+ return /*#__PURE__*/_react["default"].createElement("div", {
573
+ className: (0, _variables["default"])('Search'),
574
+ style: {
575
+ height: this.calHeight(this.state.more)
576
+ }
577
+ }, /*#__PURE__*/_react["default"].createElement(_form["default"], {
578
+ layout: "vertical",
579
+ style: {
580
+ width: this.calWidth()
581
+ }
582
+ }, /*#__PURE__*/_react["default"].createElement(_row["default"], {
583
+ gutter: 20
584
+ }, this.toCols())), this.toButtons());
585
+ }
586
+ }]);
587
+ return Search;
588
+ }(_react["default"].Component);
589
+
590
+ (0, _defineProperty2["default"])(Search, "propTypes", {
591
+ config: _propTypes["default"].shape(ConfigType).isRequired,
592
+ filters: _propTypes["default"].arrayOf(_propTypes["default"].shape(FilterType)).isRequired,
593
+ data: _propTypes["default"].object,
594
+ options: _propTypes["default"].object,
595
+ getContainer: _propTypes["default"].func,
596
+ onClick: _propTypes["default"].func,
597
+ onChange: _propTypes["default"].func,
598
+ onSearch: _propTypes["default"].func,
599
+ onHeightChange: _propTypes["default"].func,
600
+ displayRow: _propTypes["default"].number
601
+ });
602
+ var _default = Search;
603
+ exports["default"] = _default;
@@ -0,0 +1,63 @@
1
+ @import '../variables.less';
2
+
3
+ .@{cloudlink-prefix}-Search {
4
+ transition: all 0.3s;
5
+
6
+ > *:first-child {
7
+ display: inline-block;
8
+ vertical-align: top;
9
+ margin-bottom: -10px;
10
+
11
+ :global(.ant-form-item) {
12
+ margin-bottom: 10px;
13
+
14
+ :global(.ant-select-selection--multiple) {
15
+ border-top-width: 1px;
16
+ height: 22px;
17
+ overflow: auto;
18
+ }
19
+
20
+ [role='icon'] {
21
+ cursor: pointer;
22
+ margin-left: 10px;
23
+ color: @primary-color;
24
+ }
25
+ }
26
+ }
27
+
28
+ > *:last-child {
29
+ display: inline-block;
30
+ vertical-align: top;
31
+ padding-left: 20px;
32
+ padding-top: 14px;
33
+ width: 25%;
34
+ }
35
+
36
+ :global(.ant-form-item-control) input,
37
+ :global(.ant-calendar-picker),
38
+ :global(.ant-select) {
39
+ display: block;
40
+ }
41
+
42
+ [role='buttons'] > * {
43
+ margin-right: 5px;
44
+ }
45
+
46
+ [role='more'] {
47
+ color: rgba(0, 0, 0, 0.65);
48
+ user-select: none;
49
+
50
+ &:hover {
51
+ color: @brand-primary;
52
+ }
53
+
54
+ > i {
55
+ transform: scale(0.75);
56
+ transition: all 0.2s;
57
+
58
+ &[data-status='up'] {
59
+ transform: scale(0.75) rotate(-180deg);
60
+ }
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "Search",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Search.js"
6
+ }