hc-busin-components 1.0.0
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/Actions/index.d.ts +20 -0
- package/dist/Actions/index.js +142 -0
- package/dist/Actions/index.less +9 -0
- package/dist/AuthComponents/authDivider.d.ts +15 -0
- package/dist/AuthComponents/authDivider.js +104 -0
- package/dist/AuthComponents/index.d.ts +4 -0
- package/dist/AuthComponents/index.js +14 -0
- package/dist/BasicFilesRead/images/back.png +0 -0
- package/dist/BasicFilesRead/images/excel.png +0 -0
- package/dist/BasicFilesRead/images/folder.png +0 -0
- package/dist/BasicFilesRead/images/image.png +0 -0
- package/dist/BasicFilesRead/images/jpeg.png +0 -0
- package/dist/BasicFilesRead/images/jpg.png +0 -0
- package/dist/BasicFilesRead/images/normal.png +0 -0
- package/dist/BasicFilesRead/images/png.png +0 -0
- package/dist/BasicFilesRead/images/tar.png +0 -0
- package/dist/BasicFilesRead/images/text.png +0 -0
- package/dist/BasicFilesRead/images/zip.png +0 -0
- package/dist/BasicFilesRead/index.d.ts +31 -0
- package/dist/BasicFilesRead/index.js +286 -0
- package/dist/BasicFilesRead/styles/index.d.ts +3 -0
- package/dist/BasicFilesRead/styles/index.js +9 -0
- package/dist/CombinTable/components/RenderContent.d.ts +9 -0
- package/dist/CombinTable/components/RenderContent.js +201 -0
- package/dist/CombinTable/hooks/useTableParams.d.ts +20 -0
- package/dist/CombinTable/hooks/useTableParams.js +75 -0
- package/dist/CombinTable/hooks/useTableState.d.ts +5 -0
- package/dist/CombinTable/hooks/useTableState.js +22 -0
- package/dist/CombinTable/index.d.ts +4 -0
- package/dist/CombinTable/index.js +225 -0
- package/dist/CombinTable/styles/index.d.ts +3 -0
- package/dist/CombinTable/styles/index.js +11 -0
- package/dist/CombinTable/types/index.d.ts +21 -0
- package/dist/CombinTable/types/index.js +1 -0
- package/dist/CombineSearch/components/Content.d.ts +13 -0
- package/dist/CombineSearch/components/Content.js +249 -0
- package/dist/CombineSearch/components/Tags.d.ts +14 -0
- package/dist/CombineSearch/components/Tags.js +115 -0
- package/dist/CombineSearch/hooks/useCombineState.d.ts +5 -0
- package/dist/CombineSearch/hooks/useCombineState.js +17 -0
- package/dist/CombineSearch/index.d.ts +4 -0
- package/dist/CombineSearch/index.js +168 -0
- package/dist/CombineSearch/style/edit.svg +1 -0
- package/dist/CombineSearch/style/index.d.ts +14 -0
- package/dist/CombineSearch/style/index.js +26 -0
- package/dist/CombineSearch/types/index.d.ts +46 -0
- package/dist/CombineSearch/types/index.js +0 -0
- package/dist/ComponentUninstalled/assets/comp-unintall-background.png +0 -0
- package/dist/ComponentUninstalled/assets/comp-unintall-bg.png +0 -0
- package/dist/ComponentUninstalled/index.d.ts +32 -0
- package/dist/ComponentUninstalled/index.js +164 -0
- package/dist/ComponentUninstalled/index.less +108 -0
- package/dist/ComponentUninstalled/locale.d.ts +14 -0
- package/dist/ComponentUninstalled/locale.js +21 -0
- package/dist/DataCountPopover/index.d.ts +23 -0
- package/dist/DataCountPopover/index.js +121 -0
- package/dist/DataCountPopover/index.less +62 -0
- package/dist/DateRangePicker/index.d.ts +38 -0
- package/dist/DateRangePicker/index.js +483 -0
- package/dist/DateRangePicker/index.less +196 -0
- package/dist/DeleteConfirm/index.d.ts +23 -0
- package/dist/DeleteConfirm/index.js +109 -0
- package/dist/DeleteConfirm/index.less +44 -0
- package/dist/DeleteConfirm/locale.d.ts +7 -0
- package/dist/DeleteConfirm/locale.js +7 -0
- package/dist/DisplayButton/index.d.ts +7 -0
- package/dist/DisplayButton/index.js +23 -0
- package/dist/FileRead/images/back.png +0 -0
- package/dist/FileRead/images/excel.png +0 -0
- package/dist/FileRead/images/folder.png +0 -0
- package/dist/FileRead/images/image.png +0 -0
- package/dist/FileRead/images/jpeg.png +0 -0
- package/dist/FileRead/images/jpg.png +0 -0
- package/dist/FileRead/images/normal.png +0 -0
- package/dist/FileRead/images/png.png +0 -0
- package/dist/FileRead/images/tar.png +0 -0
- package/dist/FileRead/images/text.png +0 -0
- package/dist/FileRead/images/zip.png +0 -0
- package/dist/FileRead/index.d.ts +31 -0
- package/dist/FileRead/index.js +417 -0
- package/dist/FileRead/styles/index.d.ts +3 -0
- package/dist/FileRead/styles/index.js +9 -0
- package/dist/Icon/iconfont.d.ts +1 -0
- package/dist/Icon/iconfont.js +1 -0
- package/dist/Icon/index.d.ts +10 -0
- package/dist/Icon/index.js +20 -0
- package/dist/Icon/index.less +11 -0
- package/dist/IconPopTips/index.d.ts +10 -0
- package/dist/IconPopTips/index.js +26 -0
- package/dist/IconPopTips/index.less +33 -0
- package/dist/IconText/index.d.ts +15 -0
- package/dist/IconText/index.js +19 -0
- package/dist/IconText/index.less +38 -0
- package/dist/LogCenter/assets/empty.png +0 -0
- package/dist/LogCenter/context.d.ts +24 -0
- package/dist/LogCenter/context.js +66 -0
- package/dist/LogCenter/history-log.d.ts +35 -0
- package/dist/LogCenter/history-log.js +1214 -0
- package/dist/LogCenter/index.d.ts +8 -0
- package/dist/LogCenter/index.js +130 -0
- package/dist/LogCenter/index.less +577 -0
- package/dist/LogCenter/locale.d.ts +3 -0
- package/dist/LogCenter/locale.js +81 -0
- package/dist/LogCenter/realtime-log.d.ts +35 -0
- package/dist/LogCenter/realtime-log.js +641 -0
- package/dist/LogCenter/select-with-all.d.ts +28 -0
- package/dist/LogCenter/select-with-all.js +337 -0
- package/dist/LogCenter/select-with-all.less +81 -0
- package/dist/LogCenter/services.d.ts +27 -0
- package/dist/LogCenter/services.js +93 -0
- package/dist/LogCenter/tools.d.ts +9 -0
- package/dist/LogCenter/tools.js +137 -0
- package/dist/LogCenter/types.d.ts +133 -0
- package/dist/LogCenter/types.js +1 -0
- package/dist/LogicalResourceFilter/index.d.ts +7 -0
- package/dist/LogicalResourceFilter/index.js +426 -0
- package/dist/LogicalResourceFilter/index.less +139 -0
- package/dist/LogicalResourceFilter/locale.d.ts +2 -0
- package/dist/LogicalResourceFilter/locale.js +10 -0
- package/dist/LogicalResourceFilter/types.d.ts +58 -0
- package/dist/LogicalResourceFilter/types.js +1 -0
- package/dist/MetadataCount/index.d.ts +16 -0
- package/dist/MetadataCount/index.js +97 -0
- package/dist/MetadataCount/index.less +40 -0
- package/dist/MetadataForm/index.d.ts +18 -0
- package/dist/MetadataForm/index.js +85 -0
- package/dist/MetadataForm/index.less +108 -0
- package/dist/MetadataForm/label.d.ts +13 -0
- package/dist/MetadataForm/label.js +447 -0
- package/dist/MetadataPopoverList/fetchArray.d.ts +3 -0
- package/dist/MetadataPopoverList/fetchArray.js +74 -0
- package/dist/MetadataPopoverList/index.d.ts +13 -0
- package/dist/MetadataPopoverList/index.js +98 -0
- package/dist/MetadataPopoverList/index.less +74 -0
- package/dist/MetadataTags/index.d.ts +17 -0
- package/dist/MetadataTags/index.js +109 -0
- package/dist/MetadataTags/index.less +26 -0
- package/dist/OverFlow/index.d.ts +4 -0
- package/dist/OverFlow/index.js +66 -0
- package/dist/OverFlow/types/index.d.ts +11 -0
- package/dist/OverFlow/types/index.js +1 -0
- package/dist/PageHeader/index.d.ts +16 -0
- package/dist/PageHeader/index.js +41 -0
- package/dist/PageHeader/index.less +89 -0
- package/dist/ResourceProgress/index.d.ts +6 -0
- package/dist/ResourceProgress/index.js +102 -0
- package/dist/ResourceProgress/index.less +86 -0
- package/dist/ResourceProgress/types/index.d.ts +15 -0
- package/dist/ResourceProgress/types/index.js +1 -0
- package/dist/Terminal/index.d.ts +44 -0
- package/dist/Terminal/index.js +390 -0
- package/dist/Terminal/index.less +39 -0
- package/dist/TextCopy/index.d.ts +21 -0
- package/dist/TextCopy/index.js +38 -0
- package/dist/TextCopy/index.less +51 -0
- package/dist/TextEllipsis/index.d.ts +18 -0
- package/dist/TextEllipsis/index.js +31 -0
- package/dist/TextEllipsis/index.less +3 -0
- package/dist/ThemeForm/index.d.ts +6 -0
- package/dist/ThemeForm/index.js +15 -0
- package/dist/ThemeForm/index.less +15 -0
- package/dist/ThemeSubmit/index.d.ts +16 -0
- package/dist/ThemeSubmit/index.js +60 -0
- package/dist/ThemeSubmit/index.less +30 -0
- package/dist/TooltipSpan/index.d.ts +6 -0
- package/dist/TooltipSpan/index.js +72 -0
- package/dist/UsageCycle/index.d.ts +12 -0
- package/dist/UsageCycle/index.js +71 -0
- package/dist/UsageCycle/index.less +56 -0
- package/dist/Yaml/CodeMirrorWrapper.d.ts +14 -0
- package/dist/Yaml/CodeMirrorWrapper.js +106 -0
- package/dist/Yaml/index.d.ts +6 -0
- package/dist/Yaml/index.js +470 -0
- package/dist/Yaml/index.less +190 -0
- package/dist/Yaml/types.d.ts +38 -0
- package/dist/Yaml/types.js +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +32 -0
- package/dist/metadata/locale.d.ts +52 -0
- package/dist/metadata/locale.js +69 -0
- package/dist/showMore/index.d.ts +6 -0
- package/dist/showMore/index.js +40 -0
- package/package.json +121 -0
|
@@ -0,0 +1,286 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { CaretRightOutlined, HomeOutlined } from '@ant-design/icons';
|
|
18
|
+
import { Button, Checkbox, Image, Space, Spin, Table } from 'antd';
|
|
19
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useState } from 'react';
|
|
20
|
+
import back from "./images/back.png";
|
|
21
|
+
import excel from "./images/excel.png";
|
|
22
|
+
import folder from "./images/folder.png";
|
|
23
|
+
import jpeg from "./images/jpeg.png";
|
|
24
|
+
import jpg from "./images/jpg.png";
|
|
25
|
+
import normal from "./images/normal.png";
|
|
26
|
+
import png from "./images/png.png";
|
|
27
|
+
import tar from "./images/tar.png";
|
|
28
|
+
import text from "./images/text.png";
|
|
29
|
+
import zip from "./images/zip.png";
|
|
30
|
+
import { useReadFileStyles } from "./styles";
|
|
31
|
+
var FileRead = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32
|
+
var _props$tools;
|
|
33
|
+
var _useReadFileStyles = useReadFileStyles(),
|
|
34
|
+
styles = _useReadFileStyles.styles;
|
|
35
|
+
var data = props.data,
|
|
36
|
+
onClickPath = props.onClickPath,
|
|
37
|
+
operations = props.operations,
|
|
38
|
+
fieldNames = props.fieldNames,
|
|
39
|
+
loading = props.loading;
|
|
40
|
+
var backValue = new Date().getTime().toString() + 'back';
|
|
41
|
+
var _useState = useState([]),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
multiples = _useState2[0],
|
|
44
|
+
setMultiples = _useState2[1];
|
|
45
|
+
var _useState3 = useState([]),
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
paths = _useState4[0],
|
|
48
|
+
setPaths = _useState4[1];
|
|
49
|
+
useImperativeHandle(ref, function () {
|
|
50
|
+
return {
|
|
51
|
+
paths: paths,
|
|
52
|
+
multiples: multiples
|
|
53
|
+
};
|
|
54
|
+
}, [paths, multiples]);
|
|
55
|
+
var goBack = useCallback(function () {
|
|
56
|
+
var newPaths = paths.slice(0, -1);
|
|
57
|
+
var lastPath = newPaths[newPaths.length - 1];
|
|
58
|
+
onClickPath(lastPath ? '/' + lastPath.path : '', newPaths);
|
|
59
|
+
setPaths(newPaths);
|
|
60
|
+
}, [paths, onClickPath]);
|
|
61
|
+
var goDownUp = useCallback(function (item) {
|
|
62
|
+
if (item.folder) {
|
|
63
|
+
var newPaths = [].concat(_toConsumableArray(paths), [{
|
|
64
|
+
title: item.fileName,
|
|
65
|
+
path: item.fileName
|
|
66
|
+
}]);
|
|
67
|
+
setPaths(newPaths);
|
|
68
|
+
var nowPath = paths.length ? item.fileName + '/' : '/' + item.fileName + '/';
|
|
69
|
+
onClickPath(nowPath, newPaths);
|
|
70
|
+
}
|
|
71
|
+
}, [paths, onClickPath]);
|
|
72
|
+
var getIconType = useCallback(function (item) {
|
|
73
|
+
var mapSuffixs = [{
|
|
74
|
+
suffix: "(png)",
|
|
75
|
+
type: png
|
|
76
|
+
}, {
|
|
77
|
+
suffix: "(jpg)",
|
|
78
|
+
type: jpg
|
|
79
|
+
}, {
|
|
80
|
+
suffix: "(jpeg)",
|
|
81
|
+
type: jpeg
|
|
82
|
+
}, {
|
|
83
|
+
suffix: "(excel|csv)",
|
|
84
|
+
type: excel
|
|
85
|
+
}, {
|
|
86
|
+
suffix: "(txt|text)",
|
|
87
|
+
type: text
|
|
88
|
+
}, {
|
|
89
|
+
suffix: "(tar)",
|
|
90
|
+
type: tar
|
|
91
|
+
}, {
|
|
92
|
+
suffix: "(zip)",
|
|
93
|
+
type: zip
|
|
94
|
+
}];
|
|
95
|
+
var findType = mapSuffixs.find(function (i) {
|
|
96
|
+
var Reg = new RegExp(".*.".concat(i.suffix));
|
|
97
|
+
return Reg.test(item.toLocaleLowerCase());
|
|
98
|
+
});
|
|
99
|
+
if (findType) {
|
|
100
|
+
return findType.type;
|
|
101
|
+
}
|
|
102
|
+
return normal;
|
|
103
|
+
}, []);
|
|
104
|
+
var fileTableMemo = useMemo(function () {
|
|
105
|
+
var sharedOnCell = function sharedOnCell(_, index, key) {
|
|
106
|
+
if (index === 0 && fieldNames && _[fieldNames[0]] === backValue) {
|
|
107
|
+
return {
|
|
108
|
+
colSpan: 0
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {};
|
|
112
|
+
};
|
|
113
|
+
var cloumns = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.map(function (item, index) {
|
|
114
|
+
return {
|
|
115
|
+
title: item,
|
|
116
|
+
dataIndex: item,
|
|
117
|
+
onCell: index === 0 ? function (_, index) {
|
|
118
|
+
return {
|
|
119
|
+
colSpan: _[item] === backValue && index === 0 ? fieldNames.length + 1 + (props.customColumnsRender ? props.customColumnsRender.length : 0) : 1
|
|
120
|
+
};
|
|
121
|
+
} : function (_, idx) {
|
|
122
|
+
return sharedOnCell(_, idx, item);
|
|
123
|
+
},
|
|
124
|
+
// width: index !== 0 ? 180 : undefined,
|
|
125
|
+
render: function render(r, record) {
|
|
126
|
+
var _props$fieldVisible;
|
|
127
|
+
var findItem = (_props$fieldVisible = props.fieldVisible) === null || _props$fieldVisible === void 0 ? void 0 : _props$fieldVisible.find(function (f) {
|
|
128
|
+
return f.dataIndex === item;
|
|
129
|
+
});
|
|
130
|
+
if (findItem && record[findItem.visibleKey] === findItem.visibleValue) {
|
|
131
|
+
return '-';
|
|
132
|
+
}
|
|
133
|
+
if (index === 0) {
|
|
134
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
135
|
+
align: "baseline"
|
|
136
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
137
|
+
width: 16,
|
|
138
|
+
className: 'img',
|
|
139
|
+
src: r === backValue ? back : record.folder ? folder : getIconType(r),
|
|
140
|
+
preview: false
|
|
141
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
142
|
+
onClick: function onClick() {
|
|
143
|
+
if (r === backValue) {
|
|
144
|
+
setMultiples([]);
|
|
145
|
+
goBack();
|
|
146
|
+
} else {
|
|
147
|
+
goDownUp(record);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
className: record.folder || record[fieldNames[0]] === backValue ? 'linkPath' : ''
|
|
151
|
+
}, r === backValue ? '上一级' : r ? r : '-'));
|
|
152
|
+
}
|
|
153
|
+
return r ? r : '-';
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
if (props.customColumnsRender) {
|
|
158
|
+
props.customColumnsRender.forEach(function (i) {
|
|
159
|
+
cloumns.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
160
|
+
onCell: function onCell(_, idx) {
|
|
161
|
+
return sharedOnCell(_, idx, '');
|
|
162
|
+
}
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
var operationCloumn = [{
|
|
167
|
+
title: '操作',
|
|
168
|
+
width: operations.length * 50,
|
|
169
|
+
onCell: function onCell(_, idx) {
|
|
170
|
+
return sharedOnCell(_, idx);
|
|
171
|
+
},
|
|
172
|
+
render: function render(record, r, idx) {
|
|
173
|
+
return operations === null || operations === void 0 ? void 0 : operations.map(function (item) {
|
|
174
|
+
if (item.displayKey && item.displayValue) {
|
|
175
|
+
if (record[item.displayKey] === item.displayValue) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (item.render) {
|
|
180
|
+
return item.render(record, paths);
|
|
181
|
+
}
|
|
182
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
183
|
+
size: "small",
|
|
184
|
+
onClick: function onClick() {
|
|
185
|
+
item.onClick(record, paths);
|
|
186
|
+
},
|
|
187
|
+
style: {
|
|
188
|
+
margin: 0,
|
|
189
|
+
padding: '0 5px'
|
|
190
|
+
},
|
|
191
|
+
key: item.key,
|
|
192
|
+
type: "link",
|
|
193
|
+
danger: item.type === 'danger'
|
|
194
|
+
}, item.title);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}];
|
|
198
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
199
|
+
size: "small",
|
|
200
|
+
rowSelection: props.multiple ? {
|
|
201
|
+
preserveSelectedRowKeys: false,
|
|
202
|
+
selectedRowKeys: multiples.map(function (i) {
|
|
203
|
+
return i[fieldNames[0]];
|
|
204
|
+
}),
|
|
205
|
+
onChange: function onChange(keys, selectedRows) {
|
|
206
|
+
setMultiples(selectedRows);
|
|
207
|
+
},
|
|
208
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
209
|
+
return {
|
|
210
|
+
disabled: record[fieldNames[0]] === backValue
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
} : undefined,
|
|
214
|
+
rowKey: function rowKey(r) {
|
|
215
|
+
return r ? r[fieldNames[0]] : 'file';
|
|
216
|
+
},
|
|
217
|
+
loading: loading,
|
|
218
|
+
showHeader: false,
|
|
219
|
+
pagination: false,
|
|
220
|
+
dataSource: paths.length >= 1 ? [fieldNames && _defineProperty({}, fieldNames[0], backValue)].concat(_toConsumableArray(data)) : data,
|
|
221
|
+
columns: [].concat(_toConsumableArray(cloumns), operationCloumn)
|
|
222
|
+
});
|
|
223
|
+
}, [data, fieldNames, operations, paths, props.fieldVisible, multiples]);
|
|
224
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
className: styles.default
|
|
226
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
227
|
+
className: 'fileContainer'
|
|
228
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: 'toolContainer'
|
|
230
|
+
}, props.multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
231
|
+
indeterminate: multiples.length > 0 && multiples.length < data.length,
|
|
232
|
+
checked: multiples.length === data.length,
|
|
233
|
+
style: {
|
|
234
|
+
marginLeft: '8px'
|
|
235
|
+
},
|
|
236
|
+
onChange: function onChange(e) {
|
|
237
|
+
if (e.target.checked) {
|
|
238
|
+
setMultiples(data);
|
|
239
|
+
} else {
|
|
240
|
+
setMultiples([]);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: 'pathsContainer'
|
|
245
|
+
}, /*#__PURE__*/React.createElement(HomeOutlined, {
|
|
246
|
+
onClick: function onClick() {
|
|
247
|
+
if (onClickPath) {
|
|
248
|
+
onClickPath('', []);
|
|
249
|
+
setMultiples([]);
|
|
250
|
+
setPaths([]);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}), paths.map(function (item, index) {
|
|
254
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
255
|
+
className: 'pathItem',
|
|
256
|
+
key: index
|
|
257
|
+
}, /*#__PURE__*/React.createElement(CaretRightOutlined, {
|
|
258
|
+
className: 'icon'
|
|
259
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
260
|
+
onClick: function onClick() {
|
|
261
|
+
var list = paths.slice(0, index + 1);
|
|
262
|
+
onClickPath('', list);
|
|
263
|
+
setPaths(list);
|
|
264
|
+
},
|
|
265
|
+
className: 'des'
|
|
266
|
+
}, item.title));
|
|
267
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
className: 'tools'
|
|
269
|
+
}, (_props$tools = props.tools) === null || _props$tools === void 0 ? void 0 : _props$tools.map(function (item) {
|
|
270
|
+
if (!!item.multiple) {
|
|
271
|
+
return multiples.length ? /*#__PURE__*/React.createElement("div", {
|
|
272
|
+
className: 'renderItem'
|
|
273
|
+
}, item.DOM) : null;
|
|
274
|
+
}
|
|
275
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
276
|
+
className: 'renderItem'
|
|
277
|
+
}, item.DOM);
|
|
278
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
279
|
+
style: {
|
|
280
|
+
overflow: 'hidden'
|
|
281
|
+
}
|
|
282
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
283
|
+
spinning: loading !== null && loading !== void 0 ? loading : false
|
|
284
|
+
}, fileTableMemo))));
|
|
285
|
+
});
|
|
286
|
+
export default FileRead;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useReadFileStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
return {
|
|
7
|
+
default: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .fileContainer {\n width: 100%;\n min-height: 300px;\n border: 1px solid #ccc;\n // border-radius: 10px;\n .toolContainer {\n // border-radius: 10px 10px 0 0;\n width: 100%;\n height: 40px;\n border-bottom: 1px solid #ccc;\n // background-color: #bdd6fd;\n // background-color: hsl(0, 12%, 92%);\n // background-color: #ccc;\n\n display: flex;\n align-items: center;\n .btnContainer {\n padding: 0 20px;\n display: flex;\n gap: 20px;\n justify-content: space-evenly;\n .canEventIocn {\n cursor: pointer;\n &:hover {\n color: #3359cd;\n }\n }\n .noEventIocn {\n pointer-events: none;\n cursor: no-drop;\n color: #93a6c5;\n }\n }\n .pathsContainer {\n background-color: #fff;\n width: 100%;\n height: 30px;\n margin: 0 20px 0 5px;\n padding: 0 12px;\n border-radius: 5px;\n // border-radius: 30px;\n display: flex;\n align-items: center;\n .pathItem {\n display: flex;\n .icon {\n margin-right: 5px;\n margin-left: 5px;\n }\n .des {\n cursor: pointer;\n color: #93a6c5;\n font-weight: 500;\n &:hover {\n color: black;\n }\n }\n }\n }\n .tools {\n display: flex;\n gap: 16px\n align-items: center;\n flex-direction: row;\n justify-content: center;\n .icon {\n padding: 10px;\n margin-right: 5px;\n border-radius: 5px;\n cursor: pointer;\n &:hover {\n // background-color: rgba(247, 249, 250, 0.5);\n background-color: #e5e5e5;\n }\n }\n .renderItem {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 5px;\n border-radius: 5px;\n cursor: pointer;\n min-height: 32px;\n min-width: 32px;\n &:hover {\n // background-color: rgba(247, 249, 250, 0.5);\n background-color: #e5e5e5;\n }\n }\n .activeicon {\n background-color: #e5e5e5;\n // background-color: rgba(247, 249, 250, 0.5);\n }\n }\n }\n .filesMaps {\n padding: 20px;\n display: flex;\n flex-wrap: wrap;\n user-select: none;\n position: relative;\n gap: 20px;\n .odd {\n background: #fafafa;\n }\n .filestools {\n z-index: 999;\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n width: 150px;\n min-height: 200px;\n background-color: #fafafa;\n border-radius: 5px;\n padding: 10px;\n border: 1px solid #fafafa;\n box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1),\n 0px 0px 0px rgba(0, 0, 0, 0.1), 4px 0px 10px rgba(0, 0, 0, 0.1);\n p {\n margin-bottom: 0px;\n cursor: pointer;\n padding: 4px;\n border-radius: 5px;\n &:hover {\n background-color: #3359cd;\n color: #fff;\n }\n }\n }\n .fileItem {\n width: 120px;\n display: flex;\n flex-direction: column;\n align-items: center;\n user-select: none;\n .img {\n width: 100px;\n height: 100px;\n padding: auto;\n border-radius: 5px;\n }\n .des {\n margin-top: 5px;\n font-size: 10px;\n width: 100px;\n font-weight: 500;\n text-align: center;\n word-wrap: break-word;\n padding: 2px 5px;\n border-radius: 5px;\n }\n &:hover {\n .img {\n background-color: #e5e5e5;\n }\n .des {\n background-color: #3863dd;\n color: #fff;\n }\n }\n }\n .activeFileItem {\n .img {\n background-color: #e5e5e5 !important;\n }\n .des {\n background-color: #3863dd !important;\n color: #fff !important;\n }\n }\n }\n .linkPath {\n display: inline-block;\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n }\n }\n "])))
|
|
8
|
+
};
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CombineOptionsType } from '../../CombineSearch/types';
|
|
3
|
+
declare const RenderContent: (props: {
|
|
4
|
+
values: Record<string, any>;
|
|
5
|
+
setValues: React.Dispatch<React.SetStateAction<Record<string, any>>>;
|
|
6
|
+
current: CombineOptionsType;
|
|
7
|
+
fieldKey: string;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
export default RenderContent;
|
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
/* eslint-disable no-case-declarations */
|
|
14
|
+
import { Badge, Button, Checkbox, Col, Divider, Dropdown, Popover } from 'antd';
|
|
15
|
+
import React, { useEffect, useId, useMemo, useState } from 'react';
|
|
16
|
+
import Icon from "../../Icon";
|
|
17
|
+
import { useFilterStyles } from "../styles";
|
|
18
|
+
var RenderContent = function RenderContent(props) {
|
|
19
|
+
var values = props.values,
|
|
20
|
+
setValues = props.setValues,
|
|
21
|
+
current = props.current,
|
|
22
|
+
fieldKey = props.fieldKey;
|
|
23
|
+
var _useFilterStyles = useFilterStyles(),
|
|
24
|
+
styles = _useFilterStyles.styles;
|
|
25
|
+
var id = useId();
|
|
26
|
+
var _useState = useState([]),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
checkboxValues = _useState2[0],
|
|
29
|
+
setCheckBoxValues = _useState2[1];
|
|
30
|
+
var _useState3 = useState(false),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
open = _useState4[0],
|
|
33
|
+
setOpen = _useState4[1];
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if (current.componentType === 'Checkbox' && values[fieldKey]) {
|
|
36
|
+
setCheckBoxValues(values[fieldKey]);
|
|
37
|
+
}
|
|
38
|
+
return function () {
|
|
39
|
+
setCheckBoxValues([]);
|
|
40
|
+
};
|
|
41
|
+
}, [values]);
|
|
42
|
+
var handleChangeValue = function handleChangeValue(e) {
|
|
43
|
+
switch (current.componentType) {
|
|
44
|
+
case 'Checkbox':
|
|
45
|
+
case 'StatusSelect':
|
|
46
|
+
case 'Select':
|
|
47
|
+
setValues(function (values) {
|
|
48
|
+
return JSON.parse(JSON.stringify(_objectSpread(_objectSpread({}, values), {}, _defineProperty({}, fieldKey, e.length ? e : undefined))));
|
|
49
|
+
});
|
|
50
|
+
setOpen(false);
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var getRenderDom = useMemo(function () {
|
|
57
|
+
var _componentProps$field, _componentProps$field2, _componentProps$optio, _componentProps$field3, _componentProps$field4, _componentProps$optio2, _componentProps$field5, _componentProps$field6, _componentProps$optio3;
|
|
58
|
+
var componentType = current.componentType,
|
|
59
|
+
componentProps = current.componentProps;
|
|
60
|
+
switch (componentType) {
|
|
61
|
+
case 'StatusSelect':
|
|
62
|
+
var labelKey = (componentProps === null || componentProps === void 0 || (_componentProps$field = componentProps.fieldNames) === null || _componentProps$field === void 0 ? void 0 : _componentProps$field.label) || 'label';
|
|
63
|
+
var valueKey = (componentProps === null || componentProps === void 0 || (_componentProps$field2 = componentProps.fieldNames) === null || _componentProps$field2 === void 0 ? void 0 : _componentProps$field2.value) || 'value';
|
|
64
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
65
|
+
open: open,
|
|
66
|
+
onOpenChange: function onOpenChange(openValue) {
|
|
67
|
+
setOpen(openValue);
|
|
68
|
+
},
|
|
69
|
+
overlayStyle: componentProps === null || componentProps === void 0 ? void 0 : componentProps.dropdownStyle,
|
|
70
|
+
trigger: ['click'],
|
|
71
|
+
menu: {
|
|
72
|
+
activeKey: values[fieldKey],
|
|
73
|
+
style: _objectSpread({
|
|
74
|
+
minWidth: '120px',
|
|
75
|
+
maxWidth: '300px'
|
|
76
|
+
}, componentProps === null || componentProps === void 0 ? void 0 : componentProps.dropdownStyle),
|
|
77
|
+
onClick: function onClick(value) {
|
|
78
|
+
handleChangeValue(value.key);
|
|
79
|
+
},
|
|
80
|
+
items: componentProps === null || componentProps === void 0 || (_componentProps$optio = componentProps.options) === null || _componentProps$optio === void 0 ? void 0 : _componentProps$optio.map(function (i) {
|
|
81
|
+
return {
|
|
82
|
+
label: /*#__PURE__*/React.createElement(Badge, {
|
|
83
|
+
color: i.color,
|
|
84
|
+
text: i[labelKey]
|
|
85
|
+
}),
|
|
86
|
+
key: i[valueKey]
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
91
|
+
icon: values[fieldKey] ? /*#__PURE__*/React.createElement(Icon, {
|
|
92
|
+
name: "v35_Filter",
|
|
93
|
+
className: "hc-icon-active"
|
|
94
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
95
|
+
name: "v35_Filter"
|
|
96
|
+
}),
|
|
97
|
+
type: "text"
|
|
98
|
+
}));
|
|
99
|
+
case 'Select':
|
|
100
|
+
var SelectlabelKey = (componentProps === null || componentProps === void 0 || (_componentProps$field3 = componentProps.fieldNames) === null || _componentProps$field3 === void 0 ? void 0 : _componentProps$field3.label) || 'label';
|
|
101
|
+
var SelectvalueKey = (componentProps === null || componentProps === void 0 || (_componentProps$field4 = componentProps.fieldNames) === null || _componentProps$field4 === void 0 ? void 0 : _componentProps$field4.value) || 'value';
|
|
102
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
103
|
+
open: open,
|
|
104
|
+
onOpenChange: function onOpenChange(openValue) {
|
|
105
|
+
setOpen(openValue);
|
|
106
|
+
},
|
|
107
|
+
trigger: ['click'],
|
|
108
|
+
menu: {
|
|
109
|
+
activeKey: values[fieldKey],
|
|
110
|
+
style: _objectSpread({
|
|
111
|
+
minWidth: '120px',
|
|
112
|
+
maxWidth: '20px'
|
|
113
|
+
}, componentProps === null || componentProps === void 0 ? void 0 : componentProps.dropdownStyle),
|
|
114
|
+
onClick: function onClick(value) {
|
|
115
|
+
handleChangeValue(value.key);
|
|
116
|
+
},
|
|
117
|
+
items: componentProps === null || componentProps === void 0 || (_componentProps$optio2 = componentProps.options) === null || _componentProps$optio2 === void 0 ? void 0 : _componentProps$optio2.map(function (i) {
|
|
118
|
+
return {
|
|
119
|
+
label: i[SelectlabelKey],
|
|
120
|
+
key: i[SelectvalueKey]
|
|
121
|
+
};
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
125
|
+
icon: values[fieldKey] ? /*#__PURE__*/React.createElement(Icon, {
|
|
126
|
+
name: "v35_Filter",
|
|
127
|
+
className: "hc-icon-active"
|
|
128
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
129
|
+
name: "v35_Filter"
|
|
130
|
+
}),
|
|
131
|
+
type: "text"
|
|
132
|
+
}));
|
|
133
|
+
case 'Checkbox':
|
|
134
|
+
var CheckboxlabelKey = (componentProps === null || componentProps === void 0 || (_componentProps$field5 = componentProps.fieldNames) === null || _componentProps$field5 === void 0 ? void 0 : _componentProps$field5.label) || 'label';
|
|
135
|
+
var CheckboxvalueKey = (componentProps === null || componentProps === void 0 || (_componentProps$field6 = componentProps.fieldNames) === null || _componentProps$field6 === void 0 ? void 0 : _componentProps$field6.value) || 'value';
|
|
136
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
137
|
+
destroyTooltipOnHide: true,
|
|
138
|
+
open: open,
|
|
139
|
+
onOpenChange: function onOpenChange(openValue) {
|
|
140
|
+
setOpen(openValue);
|
|
141
|
+
},
|
|
142
|
+
overlayInnerStyle: componentProps === null || componentProps === void 0 ? void 0 : componentProps.dropdownStyle,
|
|
143
|
+
trigger: "click",
|
|
144
|
+
placement: "bottomLeft",
|
|
145
|
+
arrow: false,
|
|
146
|
+
key: id,
|
|
147
|
+
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
148
|
+
value: checkboxValues,
|
|
149
|
+
onChange: function onChange(value) {
|
|
150
|
+
setCheckBoxValues(value);
|
|
151
|
+
},
|
|
152
|
+
style: {
|
|
153
|
+
display: 'block'
|
|
154
|
+
}
|
|
155
|
+
}, componentProps === null || componentProps === void 0 || (_componentProps$optio3 = componentProps.options) === null || _componentProps$optio3 === void 0 ? void 0 : _componentProps$optio3.map(function (item) {
|
|
156
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
157
|
+
key: item[CheckboxvalueKey]
|
|
158
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
159
|
+
value: item[CheckboxvalueKey]
|
|
160
|
+
}, item[CheckboxlabelKey]));
|
|
161
|
+
})), /*#__PURE__*/React.createElement(Divider, {
|
|
162
|
+
style: {
|
|
163
|
+
margin: '8px 0'
|
|
164
|
+
}
|
|
165
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
style: {
|
|
167
|
+
display: 'flex',
|
|
168
|
+
justifyContent: 'end',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
gap: '12px'
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
173
|
+
type: "primary",
|
|
174
|
+
onClick: function onClick() {
|
|
175
|
+
handleChangeValue(checkboxValues);
|
|
176
|
+
},
|
|
177
|
+
size: "small"
|
|
178
|
+
}, "\u786E\u8BA4"), /*#__PURE__*/React.createElement(Button, {
|
|
179
|
+
onClick: function onClick() {
|
|
180
|
+
setCheckBoxValues([]);
|
|
181
|
+
handleChangeValue([]);
|
|
182
|
+
},
|
|
183
|
+
size: "small"
|
|
184
|
+
}, "\u53D6\u6D88"))),
|
|
185
|
+
className: styles.container
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
187
|
+
icon: values[fieldKey] ? /*#__PURE__*/React.createElement(Icon, {
|
|
188
|
+
name: "v35_Filter",
|
|
189
|
+
className: "hc-icon-active"
|
|
190
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
191
|
+
name: "v35_Filter"
|
|
192
|
+
}),
|
|
193
|
+
type: "text"
|
|
194
|
+
}));
|
|
195
|
+
default:
|
|
196
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
197
|
+
}
|
|
198
|
+
}, [current, checkboxValues, open]);
|
|
199
|
+
return getRenderDom;
|
|
200
|
+
};
|
|
201
|
+
export default RenderContent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ValuesType = Record<string, any>;
|
|
3
|
+
type PageValueType = {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
total: number;
|
|
7
|
+
};
|
|
8
|
+
export interface TableParamsProps {
|
|
9
|
+
tableParams: ValuesType;
|
|
10
|
+
setTableParams: React.Dispatch<React.SetStateAction<ValuesType>>;
|
|
11
|
+
saveCurrentPageValues: () => void;
|
|
12
|
+
getCurrentSaveValues: () => {
|
|
13
|
+
values: ValuesType;
|
|
14
|
+
pageInfo: PageValueType;
|
|
15
|
+
};
|
|
16
|
+
pageInfo: PageValueType;
|
|
17
|
+
setPageInfo: React.Dispatch<React.SetStateAction<PageValueType>>;
|
|
18
|
+
}
|
|
19
|
+
declare const useTableParams: (initSize?: number, uniqueKey?: string) => TableParamsProps;
|
|
20
|
+
export default useTableParams;
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
14
|
+
var useTableParams = function useTableParams() {
|
|
15
|
+
var initSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
16
|
+
var uniqueKey = arguments.length > 1 ? arguments[1] : undefined;
|
|
17
|
+
var baseInfo = JSON.parse(sessionStorage.getItem('tableSearchInfo') || '{}');
|
|
18
|
+
var pathKey = uniqueKey || window.location.pathname;
|
|
19
|
+
var _useState = useState({}),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
tableParams = _useState2[0],
|
|
22
|
+
setTableParams = _useState2[1];
|
|
23
|
+
var _useState3 = useState({
|
|
24
|
+
currentPage: 1,
|
|
25
|
+
pageSize: initSize,
|
|
26
|
+
total: 0
|
|
27
|
+
}),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
pageInfo = _useState4[0],
|
|
30
|
+
setPageInfo = _useState4[1];
|
|
31
|
+
function saveCurrentPageValues() {
|
|
32
|
+
var baseInfo = JSON.parse(sessionStorage.getItem('tableSearchInfo') || '{}');
|
|
33
|
+
sessionStorage.setItem('tableSearchInfo', JSON.stringify(_objectSpread(_objectSpread({}, baseInfo), {}, _defineProperty({}, pathKey, {
|
|
34
|
+
values: tableParams,
|
|
35
|
+
pageInfo: pageInfo
|
|
36
|
+
}))));
|
|
37
|
+
}
|
|
38
|
+
var removeCurrentValues = useCallback(function (path) {
|
|
39
|
+
var baseInfo = JSON.parse(sessionStorage.getItem('tableSearchInfo') || '{}');
|
|
40
|
+
var resetInfo = {};
|
|
41
|
+
Object.keys(baseInfo).forEach(function (havaPath) {
|
|
42
|
+
if (path.includes(havaPath)) {
|
|
43
|
+
resetInfo[havaPath] = baseInfo[havaPath];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
sessionStorage.setItem('tableSearchInfo', JSON.stringify(resetInfo));
|
|
47
|
+
}, [pathKey]);
|
|
48
|
+
var getCurrentSaveValues = useCallback(function () {
|
|
49
|
+
if (baseInfo[pathKey]) {
|
|
50
|
+
return baseInfo[pathKey];
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
values: {},
|
|
54
|
+
pageInfo: {
|
|
55
|
+
currentPage: 1,
|
|
56
|
+
pageSize: initSize,
|
|
57
|
+
total: 0
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, [pathKey, baseInfo, initSize]);
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
return function () {
|
|
63
|
+
removeCurrentValues(pathKey);
|
|
64
|
+
};
|
|
65
|
+
}, [pathKey]);
|
|
66
|
+
return {
|
|
67
|
+
tableParams: tableParams,
|
|
68
|
+
setTableParams: setTableParams,
|
|
69
|
+
saveCurrentPageValues: saveCurrentPageValues,
|
|
70
|
+
getCurrentSaveValues: getCurrentSaveValues,
|
|
71
|
+
pageInfo: pageInfo,
|
|
72
|
+
setPageInfo: setPageInfo
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export default useTableParams;
|
|
@@ -0,0 +1,22 @@
|
|
|
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; }
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
export default function useCombinTableState(init) {
|
|
9
|
+
var _useState = useState({}),
|
|
10
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
+
values = _useState2[0],
|
|
12
|
+
setValues = _useState2[1];
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
if (init && Object.keys(init).length) {
|
|
15
|
+
setValues(init);
|
|
16
|
+
}
|
|
17
|
+
}, [init]);
|
|
18
|
+
return {
|
|
19
|
+
values: values,
|
|
20
|
+
setValues: setValues
|
|
21
|
+
};
|
|
22
|
+
}
|