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.
Files changed (185) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +53 -0
  3. package/dist/Actions/index.d.ts +20 -0
  4. package/dist/Actions/index.js +142 -0
  5. package/dist/Actions/index.less +9 -0
  6. package/dist/AuthComponents/authDivider.d.ts +15 -0
  7. package/dist/AuthComponents/authDivider.js +104 -0
  8. package/dist/AuthComponents/index.d.ts +4 -0
  9. package/dist/AuthComponents/index.js +14 -0
  10. package/dist/BasicFilesRead/images/back.png +0 -0
  11. package/dist/BasicFilesRead/images/excel.png +0 -0
  12. package/dist/BasicFilesRead/images/folder.png +0 -0
  13. package/dist/BasicFilesRead/images/image.png +0 -0
  14. package/dist/BasicFilesRead/images/jpeg.png +0 -0
  15. package/dist/BasicFilesRead/images/jpg.png +0 -0
  16. package/dist/BasicFilesRead/images/normal.png +0 -0
  17. package/dist/BasicFilesRead/images/png.png +0 -0
  18. package/dist/BasicFilesRead/images/tar.png +0 -0
  19. package/dist/BasicFilesRead/images/text.png +0 -0
  20. package/dist/BasicFilesRead/images/zip.png +0 -0
  21. package/dist/BasicFilesRead/index.d.ts +31 -0
  22. package/dist/BasicFilesRead/index.js +286 -0
  23. package/dist/BasicFilesRead/styles/index.d.ts +3 -0
  24. package/dist/BasicFilesRead/styles/index.js +9 -0
  25. package/dist/CombinTable/components/RenderContent.d.ts +9 -0
  26. package/dist/CombinTable/components/RenderContent.js +201 -0
  27. package/dist/CombinTable/hooks/useTableParams.d.ts +20 -0
  28. package/dist/CombinTable/hooks/useTableParams.js +75 -0
  29. package/dist/CombinTable/hooks/useTableState.d.ts +5 -0
  30. package/dist/CombinTable/hooks/useTableState.js +22 -0
  31. package/dist/CombinTable/index.d.ts +4 -0
  32. package/dist/CombinTable/index.js +225 -0
  33. package/dist/CombinTable/styles/index.d.ts +3 -0
  34. package/dist/CombinTable/styles/index.js +11 -0
  35. package/dist/CombinTable/types/index.d.ts +21 -0
  36. package/dist/CombinTable/types/index.js +1 -0
  37. package/dist/CombineSearch/components/Content.d.ts +13 -0
  38. package/dist/CombineSearch/components/Content.js +249 -0
  39. package/dist/CombineSearch/components/Tags.d.ts +14 -0
  40. package/dist/CombineSearch/components/Tags.js +115 -0
  41. package/dist/CombineSearch/hooks/useCombineState.d.ts +5 -0
  42. package/dist/CombineSearch/hooks/useCombineState.js +17 -0
  43. package/dist/CombineSearch/index.d.ts +4 -0
  44. package/dist/CombineSearch/index.js +168 -0
  45. package/dist/CombineSearch/style/edit.svg +1 -0
  46. package/dist/CombineSearch/style/index.d.ts +14 -0
  47. package/dist/CombineSearch/style/index.js +26 -0
  48. package/dist/CombineSearch/types/index.d.ts +46 -0
  49. package/dist/CombineSearch/types/index.js +0 -0
  50. package/dist/ComponentUninstalled/assets/comp-unintall-background.png +0 -0
  51. package/dist/ComponentUninstalled/assets/comp-unintall-bg.png +0 -0
  52. package/dist/ComponentUninstalled/index.d.ts +32 -0
  53. package/dist/ComponentUninstalled/index.js +164 -0
  54. package/dist/ComponentUninstalled/index.less +108 -0
  55. package/dist/ComponentUninstalled/locale.d.ts +14 -0
  56. package/dist/ComponentUninstalled/locale.js +21 -0
  57. package/dist/DataCountPopover/index.d.ts +23 -0
  58. package/dist/DataCountPopover/index.js +121 -0
  59. package/dist/DataCountPopover/index.less +62 -0
  60. package/dist/DateRangePicker/index.d.ts +38 -0
  61. package/dist/DateRangePicker/index.js +483 -0
  62. package/dist/DateRangePicker/index.less +196 -0
  63. package/dist/DeleteConfirm/index.d.ts +23 -0
  64. package/dist/DeleteConfirm/index.js +109 -0
  65. package/dist/DeleteConfirm/index.less +44 -0
  66. package/dist/DeleteConfirm/locale.d.ts +7 -0
  67. package/dist/DeleteConfirm/locale.js +7 -0
  68. package/dist/DisplayButton/index.d.ts +7 -0
  69. package/dist/DisplayButton/index.js +23 -0
  70. package/dist/FileRead/images/back.png +0 -0
  71. package/dist/FileRead/images/excel.png +0 -0
  72. package/dist/FileRead/images/folder.png +0 -0
  73. package/dist/FileRead/images/image.png +0 -0
  74. package/dist/FileRead/images/jpeg.png +0 -0
  75. package/dist/FileRead/images/jpg.png +0 -0
  76. package/dist/FileRead/images/normal.png +0 -0
  77. package/dist/FileRead/images/png.png +0 -0
  78. package/dist/FileRead/images/tar.png +0 -0
  79. package/dist/FileRead/images/text.png +0 -0
  80. package/dist/FileRead/images/zip.png +0 -0
  81. package/dist/FileRead/index.d.ts +31 -0
  82. package/dist/FileRead/index.js +417 -0
  83. package/dist/FileRead/styles/index.d.ts +3 -0
  84. package/dist/FileRead/styles/index.js +9 -0
  85. package/dist/Icon/iconfont.d.ts +1 -0
  86. package/dist/Icon/iconfont.js +1 -0
  87. package/dist/Icon/index.d.ts +10 -0
  88. package/dist/Icon/index.js +20 -0
  89. package/dist/Icon/index.less +11 -0
  90. package/dist/IconPopTips/index.d.ts +10 -0
  91. package/dist/IconPopTips/index.js +26 -0
  92. package/dist/IconPopTips/index.less +33 -0
  93. package/dist/IconText/index.d.ts +15 -0
  94. package/dist/IconText/index.js +19 -0
  95. package/dist/IconText/index.less +38 -0
  96. package/dist/LogCenter/assets/empty.png +0 -0
  97. package/dist/LogCenter/context.d.ts +24 -0
  98. package/dist/LogCenter/context.js +66 -0
  99. package/dist/LogCenter/history-log.d.ts +35 -0
  100. package/dist/LogCenter/history-log.js +1214 -0
  101. package/dist/LogCenter/index.d.ts +8 -0
  102. package/dist/LogCenter/index.js +130 -0
  103. package/dist/LogCenter/index.less +577 -0
  104. package/dist/LogCenter/locale.d.ts +3 -0
  105. package/dist/LogCenter/locale.js +81 -0
  106. package/dist/LogCenter/realtime-log.d.ts +35 -0
  107. package/dist/LogCenter/realtime-log.js +641 -0
  108. package/dist/LogCenter/select-with-all.d.ts +28 -0
  109. package/dist/LogCenter/select-with-all.js +337 -0
  110. package/dist/LogCenter/select-with-all.less +81 -0
  111. package/dist/LogCenter/services.d.ts +27 -0
  112. package/dist/LogCenter/services.js +93 -0
  113. package/dist/LogCenter/tools.d.ts +9 -0
  114. package/dist/LogCenter/tools.js +137 -0
  115. package/dist/LogCenter/types.d.ts +133 -0
  116. package/dist/LogCenter/types.js +1 -0
  117. package/dist/LogicalResourceFilter/index.d.ts +7 -0
  118. package/dist/LogicalResourceFilter/index.js +426 -0
  119. package/dist/LogicalResourceFilter/index.less +139 -0
  120. package/dist/LogicalResourceFilter/locale.d.ts +2 -0
  121. package/dist/LogicalResourceFilter/locale.js +10 -0
  122. package/dist/LogicalResourceFilter/types.d.ts +58 -0
  123. package/dist/LogicalResourceFilter/types.js +1 -0
  124. package/dist/MetadataCount/index.d.ts +16 -0
  125. package/dist/MetadataCount/index.js +97 -0
  126. package/dist/MetadataCount/index.less +40 -0
  127. package/dist/MetadataForm/index.d.ts +18 -0
  128. package/dist/MetadataForm/index.js +85 -0
  129. package/dist/MetadataForm/index.less +108 -0
  130. package/dist/MetadataForm/label.d.ts +13 -0
  131. package/dist/MetadataForm/label.js +447 -0
  132. package/dist/MetadataPopoverList/fetchArray.d.ts +3 -0
  133. package/dist/MetadataPopoverList/fetchArray.js +74 -0
  134. package/dist/MetadataPopoverList/index.d.ts +13 -0
  135. package/dist/MetadataPopoverList/index.js +98 -0
  136. package/dist/MetadataPopoverList/index.less +74 -0
  137. package/dist/MetadataTags/index.d.ts +17 -0
  138. package/dist/MetadataTags/index.js +109 -0
  139. package/dist/MetadataTags/index.less +26 -0
  140. package/dist/OverFlow/index.d.ts +4 -0
  141. package/dist/OverFlow/index.js +66 -0
  142. package/dist/OverFlow/types/index.d.ts +11 -0
  143. package/dist/OverFlow/types/index.js +1 -0
  144. package/dist/PageHeader/index.d.ts +16 -0
  145. package/dist/PageHeader/index.js +41 -0
  146. package/dist/PageHeader/index.less +89 -0
  147. package/dist/ResourceProgress/index.d.ts +6 -0
  148. package/dist/ResourceProgress/index.js +102 -0
  149. package/dist/ResourceProgress/index.less +86 -0
  150. package/dist/ResourceProgress/types/index.d.ts +15 -0
  151. package/dist/ResourceProgress/types/index.js +1 -0
  152. package/dist/Terminal/index.d.ts +44 -0
  153. package/dist/Terminal/index.js +390 -0
  154. package/dist/Terminal/index.less +39 -0
  155. package/dist/TextCopy/index.d.ts +21 -0
  156. package/dist/TextCopy/index.js +38 -0
  157. package/dist/TextCopy/index.less +51 -0
  158. package/dist/TextEllipsis/index.d.ts +18 -0
  159. package/dist/TextEllipsis/index.js +31 -0
  160. package/dist/TextEllipsis/index.less +3 -0
  161. package/dist/ThemeForm/index.d.ts +6 -0
  162. package/dist/ThemeForm/index.js +15 -0
  163. package/dist/ThemeForm/index.less +15 -0
  164. package/dist/ThemeSubmit/index.d.ts +16 -0
  165. package/dist/ThemeSubmit/index.js +60 -0
  166. package/dist/ThemeSubmit/index.less +30 -0
  167. package/dist/TooltipSpan/index.d.ts +6 -0
  168. package/dist/TooltipSpan/index.js +72 -0
  169. package/dist/UsageCycle/index.d.ts +12 -0
  170. package/dist/UsageCycle/index.js +71 -0
  171. package/dist/UsageCycle/index.less +56 -0
  172. package/dist/Yaml/CodeMirrorWrapper.d.ts +14 -0
  173. package/dist/Yaml/CodeMirrorWrapper.js +106 -0
  174. package/dist/Yaml/index.d.ts +6 -0
  175. package/dist/Yaml/index.js +470 -0
  176. package/dist/Yaml/index.less +190 -0
  177. package/dist/Yaml/types.d.ts +38 -0
  178. package/dist/Yaml/types.js +1 -0
  179. package/dist/index.d.ts +52 -0
  180. package/dist/index.js +32 -0
  181. package/dist/metadata/locale.d.ts +52 -0
  182. package/dist/metadata/locale.js +69 -0
  183. package/dist/showMore/index.d.ts +6 -0
  184. package/dist/showMore/index.js +40 -0
  185. package/package.json +121 -0
@@ -0,0 +1,28 @@
1
+ import type { SelectProps } from 'antd';
2
+ import React from 'react';
3
+ import './select-with-all.less';
4
+ export interface FlatOption {
5
+ value: string | number;
6
+ label: React.ReactNode;
7
+ disabled?: boolean;
8
+ dataSource?: string;
9
+ type?: string;
10
+ }
11
+ export interface OptionGroup {
12
+ label: React.ReactNode;
13
+ options: FlatOption[];
14
+ }
15
+ export type OptionItem = FlatOption | OptionGroup;
16
+ export interface SelectWithAllProps extends Omit<SelectProps, 'options' | 'mode' | 'value' | 'onChange'> {
17
+ options: OptionItem[];
18
+ value?: (string | number)[];
19
+ onChange?: (value: (string | number)[]) => void;
20
+ selectAllValue?: string | number;
21
+ selectAllLabel?: string;
22
+ searchPlaceholder?: string;
23
+ dropdownMaxHeight?: number;
24
+ dropdownWidth?: number;
25
+ isShowSearch?: boolean;
26
+ }
27
+ declare const SelectWithAll: React.FC<SelectWithAllProps>;
28
+ export default SelectWithAll;
@@ -0,0 +1,337 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["options", "value", "onChange", "selectAllValue", "selectAllLabel", "placeholder", "searchPlaceholder", "dropdownWidth", "style", "isShowSearch"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ 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); }
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+ 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."); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
14
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
+ 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."); }
16
+ 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); }
17
+ 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; }
18
+ 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; } }
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22
+ import { SearchOutlined } from '@ant-design/icons';
23
+ import { Checkbox, ConfigProvider, Empty, Input, Select, Tag } from 'antd';
24
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
25
+ import { useLogCenterLocale } from "./context";
26
+ import "./select-with-all.less";
27
+ function isOptionGroup(item) {
28
+ return !!item.options;
29
+ }
30
+ var SelectWithAll = function SelectWithAll(props) {
31
+ var _useContext, _rest$maxTagCount;
32
+ var _props$options = props.options,
33
+ options = _props$options === void 0 ? [] : _props$options,
34
+ value = props.value,
35
+ onChange = props.onChange,
36
+ _props$selectAllValue = props.selectAllValue,
37
+ selectAllValue = _props$selectAllValue === void 0 ? '*' : _props$selectAllValue,
38
+ selectAllLabel = props.selectAllLabel,
39
+ placeholder = props.placeholder,
40
+ searchPlaceholder = props.searchPlaceholder,
41
+ dropdownWidth = props.dropdownWidth,
42
+ style = props.style,
43
+ _props$isShowSearch = props.isShowSearch,
44
+ isShowSearch = _props$isShowSearch === void 0 ? true : _props$isShowSearch,
45
+ rest = _objectWithoutProperties(props, _excluded);
46
+ var _useState = useState(value !== null && value !== void 0 ? value : []),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ internalValue = _useState2[0],
49
+ setInternalValue = _useState2[1];
50
+ var _useState3 = useState(''),
51
+ _useState4 = _slicedToArray(_useState3, 2),
52
+ searchText = _useState4[0],
53
+ setSearchText = _useState4[1];
54
+ var configLocale = (_useContext = useContext(ConfigProvider.ConfigContext)) === null || _useContext === void 0 ? void 0 : _useContext.locale;
55
+ var locale = useLogCenterLocale();
56
+ var _useMemo = useMemo(function () {
57
+ var found = null;
58
+ var sec = [];
59
+ var allFlat = [];
60
+ var _iterator = _createForOfIteratorHelper(options),
61
+ _step;
62
+ try {
63
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
64
+ var item = _step.value;
65
+ if (isOptionGroup(item)) {
66
+ sec.push({
67
+ type: 'group',
68
+ label: item.label,
69
+ options: item.options
70
+ });
71
+ allFlat.push.apply(allFlat, _toConsumableArray(item.options));
72
+ } else if (item && item.value !== undefined) {
73
+ if (item.value === selectAllValue) {
74
+ found = item;
75
+ } else {
76
+ sec.push({
77
+ type: 'flat',
78
+ option: item
79
+ });
80
+ allFlat.push(item);
81
+ }
82
+ }
83
+ }
84
+ } catch (err) {
85
+ _iterator.e(err);
86
+ } finally {
87
+ _iterator.f();
88
+ }
89
+ return {
90
+ allOption: found,
91
+ allSelectableOptions: allFlat,
92
+ sections: sec
93
+ };
94
+ }, [options, selectAllValue]),
95
+ allOption = _useMemo.allOption,
96
+ allSelectableOptions = _useMemo.allSelectableOptions,
97
+ sections = _useMemo.sections;
98
+ var optionsFingerprint = useMemo(function () {
99
+ var parts = [];
100
+ var _iterator2 = _createForOfIteratorHelper(options),
101
+ _step2;
102
+ try {
103
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
104
+ var item = _step2.value;
105
+ if (isOptionGroup(item)) {
106
+ parts.push("g:".concat(String(item.label)));
107
+ var _iterator3 = _createForOfIteratorHelper(item.options),
108
+ _step3;
109
+ try {
110
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
111
+ var o = _step3.value;
112
+ parts.push("o:".concat(String(o.value), ":").concat(String(o.label)));
113
+ }
114
+ } catch (err) {
115
+ _iterator3.e(err);
116
+ } finally {
117
+ _iterator3.f();
118
+ }
119
+ } else if (item && item.value !== undefined) {
120
+ var _o = item;
121
+ parts.push("o:".concat(String(_o.value), ":").concat(String(_o.label)));
122
+ }
123
+ }
124
+ } catch (err) {
125
+ _iterator2.e(err);
126
+ } finally {
127
+ _iterator2.f();
128
+ }
129
+ return parts.join('|');
130
+ }, [options]);
131
+ var allSelectableValues = useMemo(function () {
132
+ return allSelectableOptions.map(function (o) {
133
+ return o.value;
134
+ });
135
+ }, [allSelectableOptions]);
136
+ var isAllSelected = useMemo(function () {
137
+ if (internalValue.includes(selectAllValue)) return true;
138
+ if (allSelectableValues.length === 0) return false;
139
+ return internalValue.length === allSelectableValues.length && allSelectableValues.every(function (v) {
140
+ return internalValue.includes(v);
141
+ });
142
+ }, [internalValue, selectAllValue, allSelectableValues]);
143
+ var isItemSelected = function isItemSelected(v) {
144
+ return isAllSelected || internalValue.includes(v);
145
+ };
146
+ var allCheckIndeterminate = useMemo(function () {
147
+ var n = internalValue.filter(function (v) {
148
+ return v !== selectAllValue;
149
+ }).length;
150
+ return n > 0 && n < allSelectableValues.length;
151
+ }, [internalValue, selectAllValue, allSelectableValues]);
152
+ var allCheckChecked = isAllSelected;
153
+ var filteredSections = useMemo(function () {
154
+ if (!searchText.trim()) return sections;
155
+ var lower = searchText.toLowerCase().trim();
156
+ var filterOpts = function filterOpts(opts) {
157
+ return opts.filter(function (o) {
158
+ return String(o.label).toLowerCase().includes(lower) || String(o.value).toLowerCase().includes(lower);
159
+ });
160
+ };
161
+ return sections.map(function (s) {
162
+ if (s.type === 'group') {
163
+ var filtered = filterOpts(s.options);
164
+ if (filtered.length === 0) return null;
165
+ return _objectSpread(_objectSpread({}, s), {}, {
166
+ options: filtered
167
+ });
168
+ }
169
+ var o = s.option;
170
+ if (String(o.label).toLowerCase().includes(lower) || String(o.value).toLowerCase().includes(lower)) {
171
+ return s;
172
+ }
173
+ return null;
174
+ }).filter(Boolean);
175
+ }, [sections, searchText]);
176
+ useEffect(function () {
177
+ if (value) setInternalValue(value);
178
+ }, [value]);
179
+ useEffect(function () {
180
+ setSearchText('');
181
+ }, [optionsFingerprint]);
182
+ var updateValue = function updateValue(next) {
183
+ setInternalValue(next);
184
+ onChange === null || onChange === void 0 || onChange(next);
185
+ };
186
+ var handleSelectAllChange = function handleSelectAllChange(checked) {
187
+ if (checked && allOption) {
188
+ updateValue([selectAllValue]);
189
+ } else {
190
+ updateValue([]);
191
+ }
192
+ };
193
+ var handleItemChange = function handleItemChange(optValue, checked) {
194
+ var next;
195
+ if (internalValue.includes(selectAllValue)) {
196
+ next = checked ? [selectAllValue] : allSelectableValues.filter(function (v) {
197
+ return v !== optValue;
198
+ });
199
+ } else if (checked) {
200
+ next = [].concat(_toConsumableArray(internalValue), [optValue]);
201
+ if (allOption && next.length === allSelectableValues.length) {
202
+ next = [selectAllValue];
203
+ }
204
+ } else {
205
+ next = internalValue.filter(function (v) {
206
+ return v !== optValue;
207
+ });
208
+ }
209
+ updateValue(next);
210
+ };
211
+ var tagRender = function tagRender(tagProps) {
212
+ var label = tagProps.label,
213
+ v = tagProps.value,
214
+ _onClose = tagProps.onClose;
215
+ if (isAllSelected && allOption) {
216
+ if (v === selectAllValue) {
217
+ var _ref, _ref2, _configLocale$common;
218
+ var text = (_ref = (_ref2 = selectAllLabel !== null && selectAllLabel !== void 0 ? selectAllLabel : allOption.label) !== null && _ref2 !== void 0 ? _ref2 : configLocale === null || configLocale === void 0 || (_configLocale$common = configLocale.common) === null || _configLocale$common === void 0 ? void 0 : _configLocale$common.all) !== null && _ref !== void 0 ? _ref : locale.common.all;
219
+ return /*#__PURE__*/React.createElement(Tag, {
220
+ closable: true,
221
+ onClose: function onClose(e) {
222
+ e.preventDefault();
223
+ _onClose();
224
+ }
225
+ }, text);
226
+ }
227
+ return /*#__PURE__*/React.createElement("span", {
228
+ style: {
229
+ display: 'none'
230
+ }
231
+ });
232
+ }
233
+ return /*#__PURE__*/React.createElement(Tag, {
234
+ closable: true,
235
+ onClose: function onClose(e) {
236
+ e.preventDefault();
237
+ _onClose();
238
+ }
239
+ }, label);
240
+ };
241
+ var popupRender = function popupRender() {
242
+ return /*#__PURE__*/React.createElement("div", {
243
+ style: {
244
+ minWidth: dropdownWidth !== null && dropdownWidth !== void 0 ? dropdownWidth : '100%'
245
+ }
246
+ }, isShowSearch && /*#__PURE__*/React.createElement(Input, {
247
+ placeholder: searchPlaceholder || locale.log['请输入关键字'],
248
+ prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
249
+ value: searchText,
250
+ onChange: function onChange(e) {
251
+ return setSearchText(e.target.value);
252
+ },
253
+ allowClear: true,
254
+ className: "search-input"
255
+ }), /*#__PURE__*/React.createElement("div", {
256
+ className: "items"
257
+ }, !searchText && allOption && /*#__PURE__*/React.createElement(Checkbox, {
258
+ checked: allCheckChecked,
259
+ indeterminate: allCheckIndeterminate,
260
+ onChange: function onChange(e) {
261
+ e.stopPropagation();
262
+ handleSelectAllChange(e.target.checked);
263
+ },
264
+ onClick: function onClick(e) {
265
+ e.stopPropagation();
266
+ handleSelectAllChange(!allCheckChecked);
267
+ },
268
+ className: "checkbox-all"
269
+ }, allOption.label), filteredSections.map(function (s, idx) {
270
+ if (s.type === 'group') {
271
+ return /*#__PURE__*/React.createElement("div", {
272
+ key: "group-".concat(idx)
273
+ }, /*#__PURE__*/React.createElement("h5", null, s.label), s.options.map(function (o) {
274
+ return /*#__PURE__*/React.createElement(Checkbox, {
275
+ key: "group-".concat(idx, "-").concat(o.value),
276
+ checked: isItemSelected(o.value),
277
+ disabled: o.disabled,
278
+ onChange: function onChange(e) {
279
+ e.stopPropagation();
280
+ if (!o.disabled) handleItemChange(o.value, e.target.checked);
281
+ },
282
+ onClick: function onClick(e) {
283
+ e.stopPropagation();
284
+ if (!o.disabled) handleItemChange(o.value, !isItemSelected(o.value));
285
+ }
286
+ }, o.label, o.dataSource === 'es' && /*#__PURE__*/React.createElement(Tag, null, locale.history));
287
+ }));
288
+ }
289
+ var o = s.option;
290
+ return /*#__PURE__*/React.createElement(Checkbox, {
291
+ key: "flat-".concat(idx, "-").concat(o.value),
292
+ checked: isItemSelected(o.value),
293
+ disabled: o.disabled,
294
+ onChange: function onChange(e) {
295
+ e.stopPropagation();
296
+ if (!o.disabled) handleItemChange(o.value, e.target.checked);
297
+ },
298
+ onClick: function onClick(e) {
299
+ e.stopPropagation();
300
+ if (!o.disabled) handleItemChange(o.value, !isItemSelected(o.value));
301
+ }
302
+ }, o.label, o.dataSource === 'es' && /*#__PURE__*/React.createElement(Tag, null, locale.history));
303
+ }), filteredSections.length === 0 && /*#__PURE__*/React.createElement(Empty, {
304
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
305
+ description: searchText ? locale.common.noData : locale.common.empty
306
+ })));
307
+ };
308
+ var selectOptions = useMemo(function () {
309
+ var list = [];
310
+ if (allOption) list.push(allOption);
311
+ list.push.apply(list, _toConsumableArray(allSelectableOptions));
312
+ return list;
313
+ }, [allOption, allSelectableOptions]);
314
+ return /*#__PURE__*/React.createElement(Select, _extends({
315
+ mode: "multiple",
316
+ value: internalValue,
317
+ onChange: updateValue,
318
+ placeholder: placeholder || locale.log['请选择'],
319
+ tagRender: tagRender,
320
+ dropdownRender: popupRender,
321
+ maxTagCount: isAllSelected && allOption ? 1 : (_rest$maxTagCount = rest.maxTagCount) !== null && _rest$maxTagCount !== void 0 ? _rest$maxTagCount : 'responsive',
322
+ allowClear: true
323
+ }, rest, {
324
+ showSearch: false,
325
+ popupMatchSelectWidth: false,
326
+ className: "select-with-all-selection",
327
+ popupClassName: "select-with-all-dropdown",
328
+ options: selectOptions.map(function (o) {
329
+ return {
330
+ label: o.label,
331
+ value: o.value,
332
+ disabled: o.disabled
333
+ };
334
+ })
335
+ }));
336
+ };
337
+ export default SelectWithAll;
@@ -0,0 +1,81 @@
1
+ .ant-select {
2
+ &.select-with-all-selection {
3
+ width: 100%;
4
+ .ant-select-selection-overflow-item {
5
+ max-width: 97%;
6
+ & > span {
7
+ display: flex;
8
+ align-items: center;
9
+ }
10
+ }
11
+ .ant-tag {
12
+ max-width: 100%;
13
+ margin: 0;
14
+ overflow: hidden;
15
+ white-space: nowrap;
16
+ text-overflow: ellipsis;
17
+ background: #f5f5f5;
18
+ border: 1px solid #f0f0f0;
19
+ margin-inline-end: 4px;
20
+ }
21
+ }
22
+ }
23
+
24
+ .ant-select-dropdown {
25
+ &.select-with-all-dropdown {
26
+ max-width: 768px;
27
+ max-height: 360px;
28
+ padding: 4px;
29
+ overflow: auto;
30
+ .ant-input-affix-wrapper {
31
+ &.search-input {
32
+ margin-bottom: 4px;
33
+ background: rgba(0, 0, 0, 0.03);
34
+ border: none;
35
+ border-radius: 4px;
36
+ box-shadow: none;
37
+ .ant-input-prefix {
38
+ font-size: 16px;
39
+ }
40
+ .ant-input {
41
+ background: none;
42
+ }
43
+ }
44
+ }
45
+ .items {
46
+ h5 {
47
+ margin: 0;
48
+ padding: 5px 8px;
49
+ color: rgba(0, 0, 0, 0.85);
50
+ font-size: 13px;
51
+ }
52
+ .ant-checkbox-wrapper {
53
+ display: flex;
54
+ width: 100%;
55
+ margin: 2px 0;
56
+ padding: 5px 8px 5px 16px;
57
+ color: rgba(0, 0, 0, 0.65);
58
+ border-radius: 4px;
59
+ &.checkbox-all {
60
+ padding-left: 8px;
61
+ font-weight: 500;
62
+ }
63
+ &.ant-checkbox-wrapper-checked {
64
+ font-weight: 500;
65
+ background: #f0f7ff;
66
+ }
67
+ &:not(.ant-checkbox-wrapper-checked):hover,
68
+ &:not(.ant-checkbox-wrapper-checked):focus {
69
+ background: #f5f5f5;
70
+ }
71
+ .ant-tag {
72
+ margin-left: 4px;
73
+ color: #595959;
74
+ background: #f4f4f4;
75
+ border: none;
76
+ border-radius: 4px;
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,27 @@
1
+ import type { LogCenterRequest } from './types';
2
+ export declare const LOG_CENTER_API: {
3
+ getLogDataSource: string;
4
+ getLogDir: string;
5
+ getLogFiles: string;
6
+ getHistoryLog: string;
7
+ exportHistoryLog: string;
8
+ getCloudservices: string;
9
+ getServiceComponents: string;
10
+ getSvcCompoWorkloads: string;
11
+ clusterAddons: string;
12
+ };
13
+ export declare function createLogCenterServices(request: LogCenterRequest): {
14
+ getLogDataSource: (params: Record<string, any>) => Promise<any>;
15
+ getLogDir: (params: Record<string, any>) => Promise<any>;
16
+ getLogFiles: (params: Record<string, any>) => Promise<any>;
17
+ getHistoryLog: (params: Record<string, any>) => Promise<any>;
18
+ exportHistoryLog: (params: Record<string, any>) => Promise<{
19
+ data: Blob;
20
+ headers?: Record<string, string> | undefined;
21
+ }>;
22
+ getCloudservices: () => Promise<any>;
23
+ getServiceComponents: (params: Record<string, any>) => Promise<any>;
24
+ getSvcCompoWorkloads: (params: Record<string, any>) => Promise<any>;
25
+ getClusterAddons: (params: Record<string, any>) => Promise<any>;
26
+ };
27
+ export type LogCenterServices = ReturnType<typeof createLogCenterServices>;
@@ -0,0 +1,93 @@
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
+ var olympusPortal = '/olympus-portal';
8
+ var apmServerSl = '/cloudmonitor/apmServer-sl';
9
+ export var LOG_CENTER_API = {
10
+ getLogDataSource: "".concat(apmServerSl, "/apmServer-sl/portal/sysAppLog/dropdownSelect"),
11
+ getLogDir: "".concat(apmServerSl, "/apmServer-sl/portal/sysAppLog/logDirs"),
12
+ getLogFiles: "".concat(apmServerSl, "/apmServer-sl/portal/sysAppLog/logFiles"),
13
+ getHistoryLog: "".concat(apmServerSl, "/apmServer-sl/portal/sysAppLog"),
14
+ exportHistoryLog: "".concat(apmServerSl, "/apmServer-sl/portal/sysAppLog/export"),
15
+ getCloudservices: "".concat(olympusPortal, "/apis/v1/cloudservices"),
16
+ getServiceComponents: "".concat(olympusPortal, "/apis/v1/cloudservices/{cloudServiceName}/components"),
17
+ getSvcCompoWorkloads: "".concat(olympusPortal, "/apis/v1/cloudservices/{cloudServiceName}/components/{componentName}/workloads"),
18
+ clusterAddons: "".concat(olympusPortal, "/apis/v1/addons/clusters/{clusterName}/features")
19
+ };
20
+ function restfulURL(url) {
21
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22
+ if (url.indexOf('{') === -1) return {
23
+ url: url,
24
+ data: _objectSpread({}, params)
25
+ };
26
+ var data = _objectSpread({}, params);
27
+ var segments = url.split('/').map(function (segment) {
28
+ var _params$key;
29
+ if (segment.indexOf('{') === -1) return segment;
30
+ var key = segment.slice(1, -1);
31
+ delete data[key];
32
+ return (_params$key = params[key]) !== null && _params$key !== void 0 ? _params$key : '';
33
+ });
34
+ return {
35
+ url: segments.join('/'),
36
+ data: data
37
+ };
38
+ }
39
+ export function createLogCenterServices(request) {
40
+ return {
41
+ getLogDataSource: function getLogDataSource(params) {
42
+ var _restfulURL = restfulURL(LOG_CENTER_API.getLogDataSource, params),
43
+ url = _restfulURL.url,
44
+ data = _restfulURL.data;
45
+ return request.get(url, data);
46
+ },
47
+ getLogDir: function getLogDir(params) {
48
+ var _restfulURL2 = restfulURL(LOG_CENTER_API.getLogDir, params),
49
+ url = _restfulURL2.url,
50
+ data = _restfulURL2.data;
51
+ return request.get(url, data);
52
+ },
53
+ getLogFiles: function getLogFiles(params) {
54
+ var _restfulURL3 = restfulURL(LOG_CENTER_API.getLogFiles, params),
55
+ url = _restfulURL3.url,
56
+ data = _restfulURL3.data;
57
+ return request.get(url, data);
58
+ },
59
+ getHistoryLog: function getHistoryLog(params) {
60
+ var _restfulURL4 = restfulURL(LOG_CENTER_API.getHistoryLog, params),
61
+ url = _restfulURL4.url,
62
+ data = _restfulURL4.data;
63
+ return request.get(url, data);
64
+ },
65
+ exportHistoryLog: function exportHistoryLog(params) {
66
+ var _restfulURL5 = restfulURL(LOG_CENTER_API.exportHistoryLog, params),
67
+ url = _restfulURL5.url,
68
+ data = _restfulURL5.data;
69
+ return request.download(url, data);
70
+ },
71
+ getCloudservices: function getCloudservices() {
72
+ return request.get(LOG_CENTER_API.getCloudservices);
73
+ },
74
+ getServiceComponents: function getServiceComponents(params) {
75
+ var _restfulURL6 = restfulURL(LOG_CENTER_API.getServiceComponents, params),
76
+ url = _restfulURL6.url,
77
+ data = _restfulURL6.data;
78
+ return request.get(url, data);
79
+ },
80
+ getSvcCompoWorkloads: function getSvcCompoWorkloads(params) {
81
+ var _restfulURL7 = restfulURL(LOG_CENTER_API.getSvcCompoWorkloads, params),
82
+ url = _restfulURL7.url,
83
+ data = _restfulURL7.data;
84
+ return request.get(url, data);
85
+ },
86
+ getClusterAddons: function getClusterAddons(params) {
87
+ var _restfulURL8 = restfulURL(LOG_CENTER_API.clusterAddons, params),
88
+ url = _restfulURL8.url,
89
+ data = _restfulURL8.data;
90
+ return request.get(url, data);
91
+ }
92
+ };
93
+ }
@@ -0,0 +1,9 @@
1
+ export declare const convertWorkloadType: (type?: string) => "" | "Deployment" | "StatefulSet" | "DaemonSet" | "Job" | "CronJob";
2
+ export declare const fetchMultiParamsItem: (list?: any, kinds?: any) => any;
3
+ export declare const fetchMultiWorkloadNames: (params?: any, components?: any) => any;
4
+ export declare const fetchDateStr: () => string;
5
+ export declare const downlaodFiles: (data: any, filename: string) => void;
6
+ export declare const fetchStrList: (list: any, key: string) => string[];
7
+ export declare const fetchValidMetadata: (metadataData: any, isCompo: boolean, workloads?: any) => any;
8
+ export declare const fetchOptionsGroup: (newList: any, oldList: any) => any;
9
+ export declare const updateWorkloadOptions: (list?: any) => any;