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,97 @@
|
|
|
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 { Button, Form, Modal } from 'antd';
|
|
8
|
+
import React, { useMemo, useState } from 'react';
|
|
9
|
+
import Icon from "../Icon";
|
|
10
|
+
import { mergeMetadataTexts } from "../metadata/locale";
|
|
11
|
+
import MetadataForm from "../MetadataForm";
|
|
12
|
+
import MetadataPopoverList from "../MetadataPopoverList";
|
|
13
|
+
import "./index.less";
|
|
14
|
+
var iconMap = {
|
|
15
|
+
labels: 'v35_Label',
|
|
16
|
+
taints: 'v35_Tatint',
|
|
17
|
+
annotations: 'v35_Annotation'
|
|
18
|
+
};
|
|
19
|
+
var MetadataCount = function MetadataCount(_ref) {
|
|
20
|
+
var type = _ref.type,
|
|
21
|
+
datasource = _ref.datasource,
|
|
22
|
+
_ref$needEdit = _ref.needEdit,
|
|
23
|
+
needEdit = _ref$needEdit === void 0 ? false : _ref$needEdit,
|
|
24
|
+
_ref$valueRequired = _ref.valueRequired,
|
|
25
|
+
valueRequired = _ref$valueRequired === void 0 ? false : _ref$valueRequired,
|
|
26
|
+
onCallback = _ref.onCallback,
|
|
27
|
+
_ref$isHasAuth = _ref.isHasAuth,
|
|
28
|
+
isHasAuth = _ref$isHasAuth === void 0 ? true : _ref$isHasAuth,
|
|
29
|
+
placement = _ref.placement,
|
|
30
|
+
textsProp = _ref.texts;
|
|
31
|
+
var t = useMemo(function () {
|
|
32
|
+
return mergeMetadataTexts(textsProp);
|
|
33
|
+
}, [textsProp]);
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
isModalVisible = _useState2[0],
|
|
37
|
+
setIsModalVisible = _useState2[1];
|
|
38
|
+
var _Form$useForm = Form.useForm(),
|
|
39
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
40
|
+
inputForm = _Form$useForm2[0];
|
|
41
|
+
var titleNameMap = {
|
|
42
|
+
labels: t.labelEdit,
|
|
43
|
+
taints: t.taintEdit,
|
|
44
|
+
annotations: t.annotationEdit
|
|
45
|
+
};
|
|
46
|
+
var handleSave = function handleSave() {
|
|
47
|
+
inputForm.validateFields().then(function () {
|
|
48
|
+
var values = inputForm.getFieldsValue();
|
|
49
|
+
setIsModalVisible(false);
|
|
50
|
+
onCallback === null || onCallback === void 0 || onCallback(values[type]);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "metadata-count-wrap ".concat(isHasAuth && needEdit ? 'mc-min-width' : '')
|
|
55
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
56
|
+
className: "count-icon"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
58
|
+
name: iconMap[type] || 'v35_Label'
|
|
59
|
+
})), /*#__PURE__*/React.createElement(MetadataPopoverList, {
|
|
60
|
+
datasource: datasource,
|
|
61
|
+
type: type,
|
|
62
|
+
kind: "count",
|
|
63
|
+
placement: placement,
|
|
64
|
+
texts: textsProp
|
|
65
|
+
}), isHasAuth && needEdit && /*#__PURE__*/React.createElement(Button, {
|
|
66
|
+
type: "text",
|
|
67
|
+
size: "small",
|
|
68
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
69
|
+
name: "v35_Edit"
|
|
70
|
+
}),
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
return setIsModalVisible(true);
|
|
73
|
+
}
|
|
74
|
+
})), /*#__PURE__*/React.createElement(Modal, {
|
|
75
|
+
title: titleNameMap[type],
|
|
76
|
+
open: isModalVisible,
|
|
77
|
+
width: 600,
|
|
78
|
+
onOk: handleSave,
|
|
79
|
+
onCancel: function onCancel() {
|
|
80
|
+
return setIsModalVisible(false);
|
|
81
|
+
},
|
|
82
|
+
destroyOnClose: true
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
84
|
+
labelCol: {
|
|
85
|
+
span: 4
|
|
86
|
+
},
|
|
87
|
+
form: inputForm
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(MetadataForm, {
|
|
89
|
+
type: type,
|
|
90
|
+
form: inputForm,
|
|
91
|
+
datasource: datasource,
|
|
92
|
+
needTilte: true,
|
|
93
|
+
valueRequired: valueRequired,
|
|
94
|
+
texts: textsProp
|
|
95
|
+
})))));
|
|
96
|
+
};
|
|
97
|
+
export default MetadataCount;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.metadata-count-wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
min-height: 24px;
|
|
5
|
+
&.mc-min-width {
|
|
6
|
+
min-width: 124px;
|
|
7
|
+
}
|
|
8
|
+
.count-icon {
|
|
9
|
+
font-size: 16px;
|
|
10
|
+
}
|
|
11
|
+
button.ant-btn {
|
|
12
|
+
margin-left: 4px;
|
|
13
|
+
padding: 1.6px 3px;
|
|
14
|
+
&.ant-popover-open,
|
|
15
|
+
&:active {
|
|
16
|
+
color: #2869f6;
|
|
17
|
+
background: rgba(40, 105, 246, 0.1);
|
|
18
|
+
& > span {
|
|
19
|
+
color: #2869f6;
|
|
20
|
+
&::after {
|
|
21
|
+
color: #2869f6;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&.ant-btn-icon-only {
|
|
26
|
+
display: none;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
line-height: 16px;
|
|
29
|
+
&.ant-btn-sm > * {
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
&:hover,
|
|
35
|
+
&:focus {
|
|
36
|
+
button.ant-btn.ant-btn-icon-only {
|
|
37
|
+
display: block;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormInstance } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type MetadataTexts } from '../metadata/locale';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface MetadataFormProps {
|
|
6
|
+
type: 'labels' | 'taints' | 'annotations' | string;
|
|
7
|
+
form: FormInstance;
|
|
8
|
+
needTilte?: boolean;
|
|
9
|
+
datasource?: unknown;
|
|
10
|
+
valueRequired?: boolean;
|
|
11
|
+
texts?: MetadataTexts;
|
|
12
|
+
}
|
|
13
|
+
export interface MetadataFormRef {
|
|
14
|
+
getData: () => ReturnType<FormInstance['getFieldsValue']>;
|
|
15
|
+
validate: FormInstance['validateFields'];
|
|
16
|
+
}
|
|
17
|
+
declare const MetadataForm: React.ForwardRefExoticComponent<MetadataFormProps & React.RefAttributes<MetadataFormRef>>;
|
|
18
|
+
export default MetadataForm;
|
|
@@ -0,0 +1,85 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
12
|
+
import { Popover } from 'antd';
|
|
13
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
14
|
+
import { mergeMetadataTexts } from "../metadata/locale";
|
|
15
|
+
import { fetchMetadataObjFormat } from "../MetadataPopoverList/fetchArray";
|
|
16
|
+
import LabelForm from "./label";
|
|
17
|
+
import "./index.less";
|
|
18
|
+
var MetadataForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
|
+
var _titleMap, _titleMap2;
|
|
20
|
+
var type = props.type,
|
|
21
|
+
form = props.form,
|
|
22
|
+
_props$needTilte = props.needTilte,
|
|
23
|
+
needTilte = _props$needTilte === void 0 ? false : _props$needTilte,
|
|
24
|
+
datasource = props.datasource,
|
|
25
|
+
_props$valueRequired = props.valueRequired,
|
|
26
|
+
valueRequired = _props$valueRequired === void 0 ? false : _props$valueRequired,
|
|
27
|
+
textsProp = props.texts;
|
|
28
|
+
var t = useMemo(function () {
|
|
29
|
+
return mergeMetadataTexts(textsProp);
|
|
30
|
+
}, [textsProp]);
|
|
31
|
+
var _useState = useState(0),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
count = _useState2[0],
|
|
34
|
+
setCount = _useState2[1];
|
|
35
|
+
var titleMap = {
|
|
36
|
+
labels: {
|
|
37
|
+
key: t.labelKey,
|
|
38
|
+
val: t.labelValue
|
|
39
|
+
},
|
|
40
|
+
taints: {
|
|
41
|
+
key: t.taintKey,
|
|
42
|
+
val: t.taintValue
|
|
43
|
+
},
|
|
44
|
+
annotations: {
|
|
45
|
+
key: t.annotationKey,
|
|
46
|
+
val: t.annotationValue
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
var list = datasource ? fetchMetadataObjFormat(datasource, type) : [];
|
|
51
|
+
form.setFieldsValue(_defineProperty({}, type, list));
|
|
52
|
+
setCount(list.length);
|
|
53
|
+
}, [datasource, form, type]);
|
|
54
|
+
useImperativeHandle(ref, function () {
|
|
55
|
+
return {
|
|
56
|
+
getData: function getData() {
|
|
57
|
+
return form.getFieldsValue();
|
|
58
|
+
},
|
|
59
|
+
validate: form.validateFields
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
var effectTipsRender = /*#__PURE__*/React.createElement("ul", {
|
|
63
|
+
className: "metadata-tips-popover-content"
|
|
64
|
+
}, /*#__PURE__*/React.createElement("li", null, t.taintNoScheduleTips), /*#__PURE__*/React.createElement("li", null, t.taintPreferNoScheduleTips), /*#__PURE__*/React.createElement("li", null, t.taintNoExecuteTips));
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "metadata-from-item-wrap ".concat(type, "-wrap")
|
|
67
|
+
}, needTilte && count > 0 && /*#__PURE__*/React.createElement("ul", {
|
|
68
|
+
className: "metadata-title"
|
|
69
|
+
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("span", null, "*"), (_titleMap = titleMap[type]) === null || _titleMap === void 0 ? void 0 : _titleMap.key), /*#__PURE__*/React.createElement("li", null, (_titleMap2 = titleMap[type]) === null || _titleMap2 === void 0 ? void 0 : _titleMap2.val), type === 'taints' && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("span", null, "*"), t.taintEffect, /*#__PURE__*/React.createElement(Popover, {
|
|
70
|
+
content: effectTipsRender,
|
|
71
|
+
placement: "topRight",
|
|
72
|
+
arrow: {
|
|
73
|
+
pointAtCenter: true
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)))), /*#__PURE__*/React.createElement(LabelForm, {
|
|
76
|
+
form: form,
|
|
77
|
+
type: type,
|
|
78
|
+
count: count,
|
|
79
|
+
setCount: setCount,
|
|
80
|
+
valueRequired: valueRequired,
|
|
81
|
+
texts: textsProp
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
MetadataForm.displayName = 'MetadataForm';
|
|
85
|
+
export default MetadataForm;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.metadata-from-item-wrap {
|
|
2
|
+
.metadata-title {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
li {
|
|
7
|
+
width: calc(50% - 20px);
|
|
8
|
+
font-size: 13px;
|
|
9
|
+
list-style: none;
|
|
10
|
+
.anticon {
|
|
11
|
+
margin-left: 4px;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
}
|
|
14
|
+
& > span {
|
|
15
|
+
color: rgba(0, 0, 0, 0.65);
|
|
16
|
+
&:first-child {
|
|
17
|
+
padding-right: 2px;
|
|
18
|
+
color: #ff1a2e;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.metadata-list {
|
|
24
|
+
max-height: 442px;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
}
|
|
28
|
+
.metadata-item {
|
|
29
|
+
display: flex;
|
|
30
|
+
gap: 4px;
|
|
31
|
+
margin-bottom: 12px;
|
|
32
|
+
.ant-form-item {
|
|
33
|
+
width: calc(50% - 20px);
|
|
34
|
+
margin-bottom: 0;
|
|
35
|
+
}
|
|
36
|
+
.ant-btn-text {
|
|
37
|
+
color: #ff1a2e;
|
|
38
|
+
&:hover,
|
|
39
|
+
&:focus {
|
|
40
|
+
background: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.ant-btn-icon-only > * {
|
|
44
|
+
font-size: 20px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.metadata-add-btn {
|
|
48
|
+
width: calc(100% - 36px);
|
|
49
|
+
}
|
|
50
|
+
&.taints-wrap {
|
|
51
|
+
.metadata-title {
|
|
52
|
+
li {
|
|
53
|
+
width: calc(33.33% - 12px);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.metadata-item {
|
|
57
|
+
.ant-form-item {
|
|
58
|
+
width: calc(33.33% - 12px);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.metadata-check-tips-popover {
|
|
65
|
+
&.ant-popover {
|
|
66
|
+
max-width: 500px;
|
|
67
|
+
.ant-popover-inner-content {
|
|
68
|
+
h5 {
|
|
69
|
+
color: rgba(0, 0, 0, 0.85);
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
font-size: 13px;
|
|
72
|
+
}
|
|
73
|
+
p {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
margin: 4px 0;
|
|
77
|
+
color: rgba(0, 0, 0, 0.3);
|
|
78
|
+
line-height: 160%;
|
|
79
|
+
& > span:first-child {
|
|
80
|
+
padding-right: 4px;
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
}
|
|
83
|
+
&.pass {
|
|
84
|
+
color: rgba(0, 0, 0, 0.65);
|
|
85
|
+
}
|
|
86
|
+
&.error {
|
|
87
|
+
color: #ff1a2e;
|
|
88
|
+
}
|
|
89
|
+
&.title {
|
|
90
|
+
margin: 12px 0 8px 0;
|
|
91
|
+
color: rgba(0, 0, 0, 0.65);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ul.metadata-tips-popover-content {
|
|
99
|
+
max-width: 400px;
|
|
100
|
+
margin: 0;
|
|
101
|
+
padding: 0 0 0 16px;
|
|
102
|
+
li {
|
|
103
|
+
margin: 0;
|
|
104
|
+
padding: 0;
|
|
105
|
+
color: rgba(0, 0, 0, 0.65);
|
|
106
|
+
line-height: 150%;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormInstance } from 'antd';
|
|
3
|
+
import { type MetadataTexts } from '../metadata/locale';
|
|
4
|
+
interface IProps {
|
|
5
|
+
form: FormInstance;
|
|
6
|
+
type: string;
|
|
7
|
+
count: number;
|
|
8
|
+
setCount: (n: number) => void;
|
|
9
|
+
valueRequired: boolean;
|
|
10
|
+
texts?: MetadataTexts;
|
|
11
|
+
}
|
|
12
|
+
declare function LabelFormItem(props: IProps): React.JSX.Element;
|
|
13
|
+
export default LabelFormItem;
|