ns-base-module 2.0.5 → 2.0.7

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.
@@ -1,21 +1,41 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import { CopyOutlined } from "@ant-design/icons";
2
8
  import { message } from "antd";
3
9
  import { get } from "lodash";
4
- import React from "react";
10
+ import React, { useEffect, useState } from "react";
5
11
  import { initLang } from "../utils/language";
6
12
  var CopyCol = function CopyCol(_ref) {
7
13
  var dataSource = _ref.dataSource,
8
14
  dataIndex = _ref.dataIndex,
9
15
  list = _ref.list;
16
+ var _useState = useState(),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ dataSource_ = _useState2[0],
19
+ setDataSource_ = _useState2[1];
10
20
  // 复制
21
+
22
+ useEffect(function () {
23
+ if (dataSource) {
24
+ setDataSource_(dataSource);
25
+ }
26
+ }, [JSON.stringify(dataSource)]);
11
27
  var handleCopy = function handleCopy() {
12
28
  try {
13
29
  var str = "";
14
- if (dataSource) {
15
- dataSource === null || dataSource === void 0 || dataSource.forEach(function (item) {
16
- var val = get(item, dataIndex, "");
17
- if (val && (typeof val === "string" || typeof val === "number")) {
18
- str = str ? "".concat(str, "\r\n").concat(val) : "".concat(val);
30
+ if (dataSource_) {
31
+ dataSource_ === null || dataSource_ === void 0 || dataSource_.forEach(function (item) {
32
+ if (typeof item === "string" || typeof item === "number") {
33
+ str = str ? "".concat(str, "\r\n").concat(item) : "".concat(item);
34
+ } else {
35
+ var val = get(item, dataIndex, "");
36
+ if (val && (typeof val === "string" || typeof val === "number")) {
37
+ str = str ? "".concat(str, "\r\n").concat(val) : "".concat(val);
38
+ }
19
39
  }
20
40
  });
21
41
  }
@@ -31,17 +51,44 @@ var CopyCol = function CopyCol(_ref) {
31
51
  message.warn("该类型不支持复制");
32
52
  return;
33
53
  }
34
- navigator.clipboard.writeText(str).then(function () {
35
- message.info("复制成功");
36
- }).catch(function (err) {
37
- message.error("复制失败");
38
- });
54
+ if (navigator.clipboard) {
55
+ navigator.clipboard.writeText(str).then(function () {
56
+ message.info("复制成功");
57
+ }).catch(function (err) {
58
+ message.error("复制失败");
59
+ });
60
+ } else {
61
+ fallbackCopyText(str);
62
+ }
39
63
  } catch (error) {
40
64
  message.error("复制失败");
41
65
  }
42
66
  };
67
+ var fallbackCopyText = function fallbackCopyText(text) {
68
+ var textArea = document.createElement("textarea");
69
+ textArea.value = text;
70
+ // 隐藏文本域(避免影响页面)
71
+ textArea.style.position = "fixed";
72
+ textArea.style.top = "-999px";
73
+ textArea.style.left = "-999px";
74
+ document.body.appendChild(textArea);
75
+ textArea.select(); // 选中内容
76
+ try {
77
+ var success = document.execCommand("copy");
78
+ if (success) {
79
+ message.info("复制成功");
80
+ }
81
+ } catch (err) {
82
+ message.error("复制失败");
83
+ } finally {
84
+ document.body.removeChild(textArea); // 清理 DOM
85
+ }
86
+ };
43
87
  return /*#__PURE__*/React.createElement("span", {
44
88
  className: "copy-icon-wrap",
89
+ style: {
90
+ display: "block"
91
+ },
45
92
  onClick: function onClick() {
46
93
  return handleCopy();
47
94
  }
@@ -21,10 +21,12 @@ import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";
21
21
  import { Button, Divider } from "antd";
22
22
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
23
23
  import InfiniteScroll from "react-infinite-scroll-component";
24
+ // import InfiniteScroll from "../sollr/index";
25
+
24
26
  import Checkbox from "../Entry/components/Checkbox";
25
27
  import Input from "../Entry/components/Input";
26
28
  import CopyCol from "../CopyCol";
27
- import { cloneDeep, find, flattenDeep, get } from "lodash";
29
+ import { cloneDeep, find, flattenDeep, get, isFunction } from "lodash";
28
30
  import "../../style/components/FilterPopover.scss";
29
31
  import { initLang } from "../utils/language";
30
32
  // import request from "../utils/request";
@@ -52,6 +54,7 @@ var Filter = function Filter(props) {
52
54
  menuCode = props.menuCode,
53
55
  argument = props.argument,
54
56
  request = props.request,
57
+ newRequest = props.newRequest,
55
58
  open = props.open,
56
59
  variablePara = props.variablePara,
57
60
  exportAllParam = props.exportAllParam;
@@ -71,7 +74,7 @@ var Filter = function Filter(props) {
71
74
  setSearchval = _useState6[1];
72
75
  var searchValue = useRef("");
73
76
  var searchEmnuValue = useRef([]); // 枚举搜索
74
-
77
+ var srolRef = useRef(null);
75
78
  var page = useRef({
76
79
  pageNum: 1,
77
80
  pageSize: 40,
@@ -92,8 +95,8 @@ var Filter = function Filter(props) {
92
95
  // 获取列表
93
96
  var getDates = /*#__PURE__*/function () {
94
97
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
95
- var _searchEmnuValue$curr, _res$data, _res$data2;
96
- var _list, checkValues, _label, _searchArgument, params, res, datas, arr, _datas;
98
+ var _searchEmnuValue$curr;
99
+ var _list, checkValues, _label, _searchArgument, params, res, datas, _res, _res2, dataRow, arr, _datas;
97
100
  return _regeneratorRuntime().wrap(function _callee$(_context) {
98
101
  while (1) switch (_context.prev = _context.next) {
99
102
  case 0:
@@ -136,16 +139,45 @@ var Filter = function Filter(props) {
136
139
  pageNum: page.current.pageNum,
137
140
  pageSize: page.current.pageSize,
138
141
  distinctField: [dataIndex],
139
- variablePara: variablePara
142
+ variablePara: variablePara,
143
+ orderKey: orderKey,
144
+ orderType: orderType
140
145
  };
141
- _context.next = 11;
146
+ res = {};
147
+ datas = [];
148
+ if (!isFunction(request)) {
149
+ _context.next = 18;
150
+ break;
151
+ }
152
+ _context.next = 14;
142
153
  return request === null || request === void 0 ? void 0 : request("/querier/menu", {
143
154
  method: "POST",
144
155
  data: params
145
156
  });
146
- case 11:
157
+ case 14:
147
158
  res = _context.sent;
148
159
  datas = get(res, "data.rows", []) || [];
160
+ setTotal((_res = res) === null || _res === void 0 || (_res = _res.data) === null || _res === void 0 ? void 0 : _res.total);
161
+ page.current.total = (_res2 = res) === null || _res2 === void 0 || (_res2 = _res2.data) === null || _res2 === void 0 ? void 0 : _res2.total;
162
+ case 18:
163
+ if (!isFunction(newRequest)) {
164
+ _context.next = 25;
165
+ break;
166
+ }
167
+ _context.next = 21;
168
+ return newRequest === null || newRequest === void 0 ? void 0 : newRequest({
169
+ url: "/api/querier/menu",
170
+ method: "POST",
171
+ data: _objectSpread(_objectSpread(_objectSpread({}, props === null || props === void 0 ? void 0 : props.requestOrderParam), params), {}, {
172
+ withFieldConfigs: false
173
+ })
174
+ });
175
+ case 21:
176
+ dataRow = _context.sent;
177
+ datas = get(dataRow, "rows", []) || [];
178
+ setTotal(dataRow === null || dataRow === void 0 ? void 0 : dataRow.total);
179
+ page.current.total = dataRow === null || dataRow === void 0 ? void 0 : dataRow.total;
180
+ case 25:
149
181
  arr = [];
150
182
  if (dataIndex) {
151
183
  datas.map(function (d) {
@@ -170,9 +202,7 @@ var Filter = function Filter(props) {
170
202
  setChecked([].concat(_toConsumableArray(checked), arr));
171
203
  }
172
204
  }
173
- setTotal(res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.total);
174
- page.current.total = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.total;
175
- case 21:
205
+ case 31:
176
206
  case "end":
177
207
  return _context.stop();
178
208
  }
@@ -184,23 +214,26 @@ var Filter = function Filter(props) {
184
214
  }();
185
215
  var updateOpen = useRef(false);
186
216
  useEffect(function () {
187
- if (updateOpen.current === open) return;
188
- updateOpen.current = open; // 防止当前筛选被更新
217
+ console.log("updateOpen.currentupdateOpen.current:", open, argument, updateOpen.current);
218
+
219
+ // if (updateOpen.current === open) return;
220
+ // updateOpen.current = open; // 防止当前筛选被更新
189
221
 
190
222
  if (open) {
191
223
  // 半选状态 - 不刷新列表
192
- if (!(checked.length > 0 && checked.length < list.length)) {
193
- page.current.pageNum = 1;
194
- page.current.total = 20;
195
- searchValue.current = "";
196
- setSearchval("");
197
- setList([]);
198
- setChecked([]);
199
- getDates();
200
- }
224
+ // if (!(checked.length > 0 && checked.length < list.length)) {
225
+ page.current.pageNum = 1;
226
+ page.current.total = 20;
227
+ searchValue.current = "";
228
+ setSearchval("");
229
+ setList([]);
230
+ setChecked([]);
231
+ getDates();
232
+ // }
201
233
  }
202
234
  }, [dictItems, JSON.stringify(argument), open]);
203
235
  var loadMoreData = function loadMoreData() {
236
+ console.log("jiahzihl");
204
237
  if (page.current.pageNum * page.current.pageSize >= page.current.total) return;
205
238
  page.current.pageNum = page.current.pageNum + 1;
206
239
  getDates();
@@ -327,7 +360,11 @@ var Filter = function Filter(props) {
327
360
  var searchListCheckBox = function searchListCheckBox() {
328
361
  return searchList.map(function (item, index) {
329
362
  return /*#__PURE__*/React.createElement("div", {
330
- key: "".concat(item)
363
+ key: "".concat(item),
364
+ style: {
365
+ display: "block",
366
+ width: "100%"
367
+ }
331
368
  }, /*#__PURE__*/React.createElement(Checkbox, {
332
369
  value: item
333
370
  }, item));
@@ -375,17 +412,13 @@ var Filter = function Filter(props) {
375
412
  var handleSelectSearch = function handleSelectSearch() {
376
413
  onSearch(selectValue);
377
414
  };
378
-
379
- // const hasEntryItem = useMemo(() => {
380
- // return entryType && _TYPES.includes(entryType);
381
- // }, [entryType]);
382
-
415
+ console.log("list.lengthlist.length:", list.length, dataIndex + "-" + "scrollableDiv");
383
416
  return /*#__PURE__*/React.createElement("div", {
384
417
  className: "filter-wrapper-body"
385
418
  }, sort && /*#__PURE__*/React.createElement("div", {
386
419
  className: "sort"
387
420
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CopyCol, {
388
- dataSource: dataSource,
421
+ dataSource: searchList,
389
422
  dataIndex: dataIndex
390
423
  })), /*#__PURE__*/React.createElement("span", {
391
424
  onClick: function onClick() {
@@ -420,26 +453,28 @@ var Filter = function Filter(props) {
420
453
  }
421
454
  }), /*#__PURE__*/React.createElement("div", {
422
455
  className: "filter-group",
456
+ ref: srolRef,
423
457
  id: "".concat(dataIndex, "-scrollableDiv")
424
- }, /*#__PURE__*/React.createElement(InfiniteScroll, {
458
+ }, srolRef.current && /*#__PURE__*/React.createElement(InfiniteScroll, {
425
459
  dataLength: list.length,
426
460
  next: loadMoreData,
427
461
  hasMore: page.current.pageNum * page.current.pageSize < total,
428
462
  loader: /*#__PURE__*/React.createElement(Divider, {
429
463
  plain: true,
430
464
  style: {
431
- margin: 10
465
+ margin: "10px 0"
432
466
  }
433
467
  }),
434
468
  endMessage: /*#__PURE__*/React.createElement(Divider, {
435
469
  plain: true,
436
470
  style: {
437
- margin: 10
471
+ margin: "10px 0"
438
472
  }
439
473
  })
440
474
  // endMessage={<Divider plain>无更多数据</Divider>}
475
+ // scrollableTarget={`${dataIndex}-scrollableDiv`}
441
476
  ,
442
- scrollableTarget: "".concat(dataIndex, "-scrollableDiv")
477
+ scrollableTarget: srolRef.current
443
478
  }, /*#__PURE__*/React.createElement(CheckboxGroup, {
444
479
  value: checked,
445
480
  onChange: onChange
@@ -87,6 +87,7 @@ var Index = function Index(_ref2) {
87
87
 
88
88
  // 活动的icon显示
89
89
  var visibilityStyle = useMemo(function () {
90
+ console.log("filterValuefilterValue:", filterValue);
90
91
  var _value = get(props === null || props === void 0 ? void 0 : props.filterSearch, "".concat(dataIndex, ".value"), "");
91
92
  if (!dataIndex) return null;
92
93
  if (!_value) {
@@ -96,14 +97,17 @@ var Index = function Index(_ref2) {
96
97
  }
97
98
  if (orderKey !== null && orderKey !== void 0 && orderKey.includes(dataIndex)) return {
98
99
  visibility: "visible",
100
+ display: "block",
99
101
  color: "#06B50F"
100
102
  };
101
103
  if (searchFlag) return {
102
104
  visibility: "visible",
105
+ display: "block",
103
106
  color: "#06B50F"
104
107
  };
105
108
  return {
106
109
  visibility: "visible",
110
+ display: "block",
107
111
  color: "#06B50F"
108
112
  };
109
113
  }, [filterValue, list, dataIndex, orderKey, searchFlag, props.filterSearch]);
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["onChange", "showArrows"];
2
+ var _excluded = ["onChange", "showArrows", "isRoot"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -14,7 +14,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
14
14
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import { HolderOutlined, VerticalAlignBottomOutlined, VerticalAlignMiddleOutlined, VerticalAlignTopOutlined } from "@ant-design/icons";
17
- import { Slider, Tooltip } from "antd";
17
+ import { Slider, Switch, Tooltip } from "antd";
18
18
  import React from "react";
19
19
  import { useDrag, useDrop } from "react-dnd";
20
20
  import "../../style/components/TableHeaderConfigPopover.scss";
@@ -40,6 +40,7 @@ var Box = function Box(_ref) {
40
40
  var Dustbin = function Dustbin(_ref2) {
41
41
  var _onChange = _ref2.onChange,
42
42
  showArrows = _ref2.showArrows,
43
+ isRoot = _ref2.isRoot,
43
44
  props = _objectWithoutProperties(_ref2, _excluded);
44
45
  var item = props.item;
45
46
  var _useDrop = useDrop({
@@ -83,7 +84,7 @@ var Dustbin = function Dustbin(_ref2) {
83
84
  flex: 1
84
85
  },
85
86
  onChange: function onChange(e) {
86
- return _onChange(e, item);
87
+ return _onChange(e, item, "width");
87
88
  },
88
89
  value: typeof item.width === "number" ? item.width : 0
89
90
  }), /*#__PURE__*/React.createElement("span", {
@@ -103,6 +104,14 @@ var Dustbin = function Dustbin(_ref2) {
103
104
  onClick: function onClick(e) {
104
105
  return props.onFixed(item.dataIndex, "right", e);
105
106
  }
106
- })));
107
+ })), !!isRoot && /*#__PURE__*/React.createElement(Switch, {
108
+ checkedChildren: "\u6298\u53E0",
109
+ unCheckedChildren: "\u5C55\u5F00",
110
+ size: "small",
111
+ checked: item.frontEndFold === true || item.frontEndFold === undefined && ["FIRST", "LAST", "NONEDATA"].includes(item.hierarchyState),
112
+ onChange: function onChange(e) {
113
+ return _onChange === null || _onChange === void 0 ? void 0 : _onChange(e, item, "frontEndFold");
114
+ }
115
+ }));
107
116
  };
108
117
  export default Dustbin;