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,417 @@
|
|
|
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 { AppstoreOutlined, BarsOutlined, CaretRightOutlined, HomeOutlined } from '@ant-design/icons';
|
|
18
|
+
import { Button, Image, Space, Spin, Table } from 'antd';
|
|
19
|
+
import React, { forwardRef, useCallback, useEffect, 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
|
+
var _useState5 = useState({}),
|
|
50
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
+
record = _useState6[0],
|
|
52
|
+
setRecord = _useState6[1];
|
|
53
|
+
var _useState7 = useState('table'),
|
|
54
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
55
|
+
viewType = _useState8[0],
|
|
56
|
+
setViewType = _useState8[1];
|
|
57
|
+
useImperativeHandle(ref, function () {
|
|
58
|
+
return {
|
|
59
|
+
paths: paths,
|
|
60
|
+
multiples: multiples
|
|
61
|
+
};
|
|
62
|
+
}, [paths, multiples]);
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
var noClick = function noClick() {
|
|
65
|
+
var dom = document.getElementById('filestools');
|
|
66
|
+
if (dom && dom.style.display === 'block') {
|
|
67
|
+
dom.style.display = 'none';
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
document.addEventListener('click', noClick);
|
|
71
|
+
return function () {
|
|
72
|
+
document.removeEventListener('click', noClick);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
var goBack = useCallback(function () {
|
|
76
|
+
var newPaths = paths.slice(0, -1);
|
|
77
|
+
var lastPath = newPaths[newPaths.length - 1];
|
|
78
|
+
onClickPath(lastPath ? '/' + lastPath.path : '', newPaths);
|
|
79
|
+
setPaths(newPaths);
|
|
80
|
+
}, [paths, onClickPath]);
|
|
81
|
+
var goDownUp = useCallback(function (item) {
|
|
82
|
+
if (item.folder) {
|
|
83
|
+
var newPaths = [].concat(_toConsumableArray(paths), [{
|
|
84
|
+
title: item.fileName,
|
|
85
|
+
path: item.fileName
|
|
86
|
+
}]);
|
|
87
|
+
setPaths(newPaths);
|
|
88
|
+
var nowPath = paths.length ? item.fileName + '/' : '/' + item.fileName + '/';
|
|
89
|
+
onClickPath(nowPath, newPaths);
|
|
90
|
+
}
|
|
91
|
+
}, [paths, onClickPath]);
|
|
92
|
+
var showContextMenu = useCallback(function (e, item) {
|
|
93
|
+
var _document$getElementB;
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
setRecord(item);
|
|
97
|
+
var rect = (_document$getElementB = document.getElementById('filesMaps')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.getBoundingClientRect();
|
|
98
|
+
if (rect) {
|
|
99
|
+
var mouseX = e.clientX - (rect === null || rect === void 0 ? void 0 : rect.left);
|
|
100
|
+
var mouseY = e.clientY - rect.top;
|
|
101
|
+
var dom = document.getElementById('filestools');
|
|
102
|
+
if (dom) {
|
|
103
|
+
dom.style.display = 'block';
|
|
104
|
+
dom.style.left = mouseX + 20 + 'px';
|
|
105
|
+
dom.style.top = mouseY + 'px';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [record]);
|
|
109
|
+
var getIconType = useCallback(function (item) {
|
|
110
|
+
var mapSuffixs = [{
|
|
111
|
+
suffix: "(png)",
|
|
112
|
+
type: png
|
|
113
|
+
}, {
|
|
114
|
+
suffix: "(jpg)",
|
|
115
|
+
type: jpg
|
|
116
|
+
}, {
|
|
117
|
+
suffix: "(jpeg)",
|
|
118
|
+
type: jpeg
|
|
119
|
+
}, {
|
|
120
|
+
suffix: "(excel|csv)",
|
|
121
|
+
type: excel
|
|
122
|
+
}, {
|
|
123
|
+
suffix: "(txt|text)",
|
|
124
|
+
type: text
|
|
125
|
+
}, {
|
|
126
|
+
suffix: "(tar)",
|
|
127
|
+
type: tar
|
|
128
|
+
}, {
|
|
129
|
+
suffix: "(zip)",
|
|
130
|
+
type: zip
|
|
131
|
+
}];
|
|
132
|
+
var findType = mapSuffixs.find(function (i) {
|
|
133
|
+
var Reg = new RegExp(".*.".concat(i.suffix));
|
|
134
|
+
return Reg.test(item.toLocaleLowerCase());
|
|
135
|
+
});
|
|
136
|
+
if (findType) {
|
|
137
|
+
return findType.type;
|
|
138
|
+
}
|
|
139
|
+
return normal;
|
|
140
|
+
}, []);
|
|
141
|
+
var getFilesTools = useMemo(function () {
|
|
142
|
+
return operations.length ? /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: 'filestools',
|
|
144
|
+
id: "filestools"
|
|
145
|
+
}, operations.map(function (operation) {
|
|
146
|
+
if (operation.displayKey && operation.displayValue) {
|
|
147
|
+
if (record[operation.displayKey] === operation.displayValue) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (operation.render) {
|
|
152
|
+
return operation.render(record, paths, true);
|
|
153
|
+
}
|
|
154
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
155
|
+
key: operation.key,
|
|
156
|
+
style: operation.type === 'danger' ? {
|
|
157
|
+
color: 'red'
|
|
158
|
+
} : {},
|
|
159
|
+
onClick: function onClick(e) {
|
|
160
|
+
operation === null || operation === void 0 || operation.onClick(record, paths);
|
|
161
|
+
}
|
|
162
|
+
}, operation.title);
|
|
163
|
+
})) : null;
|
|
164
|
+
}, [operations, JSON.stringify(record)]);
|
|
165
|
+
var getClassNameCb = useCallback(function (item) {
|
|
166
|
+
var name = multiples.find(function (i) {
|
|
167
|
+
return JSON.stringify(i) === JSON.stringify(_objectSpread({}, item));
|
|
168
|
+
}) ? 'activeFileItem' : '';
|
|
169
|
+
return name;
|
|
170
|
+
}, [multiples, data]);
|
|
171
|
+
var fileViewDom = useMemo(function () {
|
|
172
|
+
if (props.loading) return null;
|
|
173
|
+
return data === null || data === void 0 ? void 0 : data.map(function (item, index) {
|
|
174
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
key: "".concat(index, "-").concat(item.fileName),
|
|
176
|
+
onMouseMove: function onMouseMove(e) {
|
|
177
|
+
if (e.shiftKey && props.multiple) {
|
|
178
|
+
setMultiples(function (datas) {
|
|
179
|
+
var record = _objectSpread({}, item);
|
|
180
|
+
return datas.some(function (i) {
|
|
181
|
+
return JSON.stringify(i) === JSON.stringify(record);
|
|
182
|
+
}) ? datas : [].concat(_toConsumableArray(datas), [record]);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
onDoubleClick: function onDoubleClick(e) {
|
|
187
|
+
return !e.shiftKey && goDownUp(item);
|
|
188
|
+
},
|
|
189
|
+
onClick: function onClick(e) {
|
|
190
|
+
if (e.shiftKey && props.multiple) {
|
|
191
|
+
setMultiples(function (datas) {
|
|
192
|
+
var record = _objectSpread({}, item);
|
|
193
|
+
return datas.some(function (i) {
|
|
194
|
+
return JSON.stringify(i) === JSON.stringify(record);
|
|
195
|
+
}) ? datas : [].concat(_toConsumableArray(datas), [record]);
|
|
196
|
+
});
|
|
197
|
+
} else {
|
|
198
|
+
multiples.length > 0 && setMultiples([]);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
onContextMenu: function onContextMenu(e) {
|
|
202
|
+
return showContextMenu(e, item);
|
|
203
|
+
},
|
|
204
|
+
className: "fileItem ".concat(getClassNameCb(item))
|
|
205
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "img",
|
|
207
|
+
style: {
|
|
208
|
+
backgroundSize: '100px 100px',
|
|
209
|
+
backgroundRepeat: 'no-repeat',
|
|
210
|
+
backgroundImage: "url(".concat(item.folder ? folder : getIconType(item.fileName), ")")
|
|
211
|
+
}
|
|
212
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: "des"
|
|
214
|
+
}, item.fileName));
|
|
215
|
+
});
|
|
216
|
+
}, [props.loading, data, getClassNameCb, multiples, props.multiple, goDownUp, showContextMenu]);
|
|
217
|
+
var filePicMemo = useMemo(function () {
|
|
218
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
219
|
+
id: "filesMaps",
|
|
220
|
+
className: 'filesMaps'
|
|
221
|
+
}, getFilesTools, paths.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
onContextMenu: function onContextMenu(e) {
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
},
|
|
226
|
+
onDoubleClick: function onDoubleClick() {
|
|
227
|
+
goBack();
|
|
228
|
+
},
|
|
229
|
+
className: 'fileItem'
|
|
230
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
231
|
+
className: 'img',
|
|
232
|
+
src: back,
|
|
233
|
+
preview: false
|
|
234
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
className: 'des'
|
|
236
|
+
}, "\u4E0A\u4E00\u7EA7")), fileViewDom);
|
|
237
|
+
}, [data, operations, getFilesTools, multiples]);
|
|
238
|
+
var fileTableMemo = useMemo(function () {
|
|
239
|
+
var sharedOnCell = function sharedOnCell(_, index, key) {
|
|
240
|
+
if (index === 0 && fieldNames && _[fieldNames[0]] === backValue) {
|
|
241
|
+
return {
|
|
242
|
+
colSpan: 0
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {};
|
|
246
|
+
};
|
|
247
|
+
var cloumns = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.map(function (item, index) {
|
|
248
|
+
return {
|
|
249
|
+
title: item,
|
|
250
|
+
dataIndex: item,
|
|
251
|
+
onCell: index === 0 ? function (_, index) {
|
|
252
|
+
return {
|
|
253
|
+
colSpan: _[item] === backValue && index === 0 ? fieldNames.length + 1 + (props.customColumnsRender ? props.customColumnsRender.length : 0) : 1
|
|
254
|
+
};
|
|
255
|
+
} : function (_, idx) {
|
|
256
|
+
return sharedOnCell(_, idx, item);
|
|
257
|
+
},
|
|
258
|
+
// width: index !== 0 ? 180 : undefined,
|
|
259
|
+
render: function render(r, record) {
|
|
260
|
+
var _props$fieldVisible;
|
|
261
|
+
var findItem = (_props$fieldVisible = props.fieldVisible) === null || _props$fieldVisible === void 0 ? void 0 : _props$fieldVisible.find(function (f) {
|
|
262
|
+
return f.dataIndex === item;
|
|
263
|
+
});
|
|
264
|
+
if (findItem && record[findItem.visibleKey] === findItem.visibleValue) {
|
|
265
|
+
return '-';
|
|
266
|
+
}
|
|
267
|
+
if (index === 0) {
|
|
268
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
269
|
+
align: "baseline"
|
|
270
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
271
|
+
width: 16,
|
|
272
|
+
className: 'img',
|
|
273
|
+
src: r === backValue ? back : record.folder ? folder : getIconType(r),
|
|
274
|
+
preview: false
|
|
275
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
276
|
+
onClick: function onClick() {
|
|
277
|
+
if (r === backValue) {
|
|
278
|
+
setMultiples([]);
|
|
279
|
+
goBack();
|
|
280
|
+
} else {
|
|
281
|
+
goDownUp(record);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
className: record.folder || record[fieldNames[0]] === backValue ? 'linkPath' : ''
|
|
285
|
+
}, r === backValue ? '上一级' : r ? r : '-'));
|
|
286
|
+
}
|
|
287
|
+
return r ? r : '-';
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
if (props.customColumnsRender) {
|
|
292
|
+
props.customColumnsRender.forEach(function (i) {
|
|
293
|
+
cloumns.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
294
|
+
onCell: function onCell(_, idx) {
|
|
295
|
+
return sharedOnCell(_, idx, '');
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
var operationCloumn = [{
|
|
301
|
+
title: '操作',
|
|
302
|
+
width: 150,
|
|
303
|
+
onCell: function onCell(_, idx) {
|
|
304
|
+
return sharedOnCell(_, idx);
|
|
305
|
+
},
|
|
306
|
+
render: function render(record, r, idx) {
|
|
307
|
+
return operations === null || operations === void 0 ? void 0 : operations.map(function (item) {
|
|
308
|
+
if (item.displayKey && item.displayValue) {
|
|
309
|
+
if (record[item.displayKey] === item.displayValue) {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (item.render) {
|
|
314
|
+
return item.render(record, paths);
|
|
315
|
+
}
|
|
316
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
317
|
+
size: "small",
|
|
318
|
+
onClick: function onClick() {
|
|
319
|
+
item.onClick(record, paths);
|
|
320
|
+
},
|
|
321
|
+
style: {
|
|
322
|
+
margin: 0,
|
|
323
|
+
padding: '0 5px'
|
|
324
|
+
},
|
|
325
|
+
key: item.key,
|
|
326
|
+
type: "link"
|
|
327
|
+
}, item.title);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}];
|
|
331
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
332
|
+
size: "small",
|
|
333
|
+
rowSelection: props.multiple ? {
|
|
334
|
+
preserveSelectedRowKeys: false,
|
|
335
|
+
selectedRowKeys: multiples.map(function (i) {
|
|
336
|
+
return i[fieldNames[0]];
|
|
337
|
+
}),
|
|
338
|
+
onChange: function onChange(keys, selectedRows) {
|
|
339
|
+
setMultiples(selectedRows);
|
|
340
|
+
},
|
|
341
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
342
|
+
return {
|
|
343
|
+
disabled: record[fieldNames[0]] === backValue
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
} : undefined,
|
|
347
|
+
rowKey: function rowKey(r) {
|
|
348
|
+
return r ? r[fieldNames[0]] : 'file';
|
|
349
|
+
},
|
|
350
|
+
loading: loading,
|
|
351
|
+
pagination: false,
|
|
352
|
+
dataSource: paths.length >= 1 ? [fieldNames && _defineProperty({}, fieldNames[0], backValue)].concat(_toConsumableArray(data)) : data,
|
|
353
|
+
showHeader: false,
|
|
354
|
+
columns: [].concat(_toConsumableArray(cloumns), operationCloumn)
|
|
355
|
+
});
|
|
356
|
+
}, [data, fieldNames, operations, paths, props.fieldVisible, multiples]);
|
|
357
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
358
|
+
className: styles.default
|
|
359
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
360
|
+
className: 'fileContainer'
|
|
361
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
362
|
+
className: 'toolContainer'
|
|
363
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
364
|
+
className: 'pathsContainer'
|
|
365
|
+
}, /*#__PURE__*/React.createElement(HomeOutlined, {
|
|
366
|
+
onClick: function onClick() {
|
|
367
|
+
if (onClickPath) {
|
|
368
|
+
onClickPath('', []);
|
|
369
|
+
setMultiples([]);
|
|
370
|
+
setPaths([]);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}), paths.map(function (item, index) {
|
|
374
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
375
|
+
className: 'pathItem',
|
|
376
|
+
key: index
|
|
377
|
+
}, /*#__PURE__*/React.createElement(CaretRightOutlined, {
|
|
378
|
+
className: 'icon'
|
|
379
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
380
|
+
onClick: function onClick() {
|
|
381
|
+
var list = paths.slice(0, index + 1);
|
|
382
|
+
onClickPath('', list);
|
|
383
|
+
setPaths(list);
|
|
384
|
+
},
|
|
385
|
+
className: 'des'
|
|
386
|
+
}, item.title));
|
|
387
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
388
|
+
className: 'tools'
|
|
389
|
+
}, (_props$tools = props.tools) === null || _props$tools === void 0 ? void 0 : _props$tools.map(function (item) {
|
|
390
|
+
if (!!item.multiple) {
|
|
391
|
+
return multiples.length ? /*#__PURE__*/React.createElement("div", {
|
|
392
|
+
className: 'renderItem'
|
|
393
|
+
}, item.DOM) : null;
|
|
394
|
+
}
|
|
395
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
396
|
+
className: 'renderItem'
|
|
397
|
+
}, item.DOM);
|
|
398
|
+
}), /*#__PURE__*/React.createElement(BarsOutlined, {
|
|
399
|
+
onClick: function onClick() {
|
|
400
|
+
setViewType('table');
|
|
401
|
+
},
|
|
402
|
+
className: 'icon'.concat(" ", viewType === 'table' ? 'activeicon' : '')
|
|
403
|
+
}), /*#__PURE__*/React.createElement(AppstoreOutlined, {
|
|
404
|
+
onClick: function onClick() {
|
|
405
|
+
setViewType('pic');
|
|
406
|
+
},
|
|
407
|
+
className: 'icon'.concat(" ", viewType === 'pic' ? 'activeicon' : '')
|
|
408
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
409
|
+
style: {
|
|
410
|
+
borderRadius: '0 0 10px 10px',
|
|
411
|
+
overflow: viewType === 'pic' ? 'visible' : 'hidden'
|
|
412
|
+
}
|
|
413
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
414
|
+
spinning: loading
|
|
415
|
+
}, viewType === 'pic' ? filePicMemo : fileTableMemo))));
|
|
416
|
+
});
|
|
417
|
+
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 20px;\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 padding: 20px;\n display: flex;\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 height: 32px;\n 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 @@
|
|
|
1
|
+
declare module './iconfont.js';
|