@cloudtower/eagle 0.31.28 → 0.32.1
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/dist/cjs/UIKitProvider/index.js +16 -2
- package/dist/cjs/core/ConfigProvider/index.js +1 -37
- package/dist/cjs/core/Fields/FieldsEnum/index.js +1 -1
- package/dist/cjs/core/Select/index.js +117 -106
- package/dist/cjs/core/TableForm/TableFormBodyCell.js +3 -6
- package/dist/cjs/core/TableForm/TableFormBodyRows.js +2 -7
- package/dist/cjs/core/TableForm/index.js +1 -12
- package/dist/cjs/core/TimeZoneSelect/index.js +1 -1
- package/dist/cjs/core/Tooltip/index.js +1 -4
- package/dist/cjs/core/index.js +12 -15
- package/dist/cjs/coreX/ChartWithTooltip/index.js +12 -14
- package/dist/cjs/coreX/DateRangePicker/Calendar.js +3 -4
- package/dist/cjs/coreX/DateRangePicker/index.js +2 -2
- package/dist/cjs/coreX/SummaryTable/index.js +3 -6
- package/dist/cjs/coreX/UnitWithChart/index.js +12 -14
- package/dist/cjs/index.js +239 -245
- package/dist/cjs/legacy-antd.js +133 -137
- package/dist/cjs/stats1.html +1 -1
- package/dist/cjs/utils/tower.js +0 -17
- package/dist/components.css +3150 -3348
- package/dist/esm/UIKitProvider/index.js +12 -2
- package/dist/esm/core/ConfigProvider/index.js +2 -32
- package/dist/esm/core/Fields/FieldsEnum/index.js +4 -4
- package/dist/esm/core/Select/index.js +116 -104
- package/dist/esm/core/TableForm/TableFormBodyCell.js +3 -6
- package/dist/esm/core/TableForm/TableFormBodyRows.js +2 -7
- package/dist/esm/core/TableForm/index.js +2 -13
- package/dist/esm/core/TimeZoneSelect/index.js +2 -2
- package/dist/esm/core/Tooltip/index.js +1 -4
- package/dist/esm/core/index.js +1 -3
- package/dist/esm/coreX/ChartWithTooltip/index.js +0 -2
- package/dist/esm/coreX/DateRangePicker/Calendar.js +3 -4
- package/dist/esm/coreX/DateRangePicker/index.js +3 -3
- package/dist/esm/coreX/SummaryTable/index.js +3 -6
- package/dist/esm/coreX/UnitWithChart/index.js +0 -2
- package/dist/esm/index.js +3 -6
- package/dist/esm/legacy-antd.js +0 -4
- package/dist/esm/stats1.html +1 -1
- package/dist/esm/utils/tower.js +1 -17
- package/dist/src/UIKitProvider/UIKitProvider.stories.d.ts +2 -1
- package/dist/src/antd.d.ts +0 -1
- package/dist/src/core/ConfigProvider/index.d.ts +0 -2
- package/dist/src/core/Select/index.d.ts +0 -1
- package/dist/src/core/Select/select.type.d.ts +31 -6
- package/dist/src/core/TableForm/types.d.ts +0 -3
- package/dist/src/core/Tooltip/EllipsisTooltipContent.d.ts +1 -1
- package/dist/src/core/Tooltip/index.d.ts +1 -7
- package/dist/src/core/Tooltip/tooltip.widget.d.ts +5 -0
- package/dist/src/core/index.d.ts +2 -7
- package/dist/src/coreX/SummaryTable/index.d.ts +0 -1
- package/dist/src/coreX/UnitWithChart/index.d.ts +0 -1
- package/dist/src/spec/base.d.ts +1 -3
- package/dist/src/utils/tower.d.ts +0 -1
- package/dist/stories/docs/core/EllipsisTooltipContent.stories.d.ts +1 -1
- package/dist/stories/docs/core/{LegacySelect.Simple.stories.d.ts → Select.Simple.stories.d.ts} +3 -3
- package/dist/stories/docs/core/Tooltip.stories.d.ts +1 -3
- package/dist/style.css +3146 -3312
- package/package.json +4 -6
- package/dist/cjs/core/BytePerSecond/index.js +0 -45
- package/dist/cjs/core/LegacySelect/index.js +0 -185
- package/dist/cjs/core/LegacySelect/select.style.js +0 -5
- package/dist/cjs/core/Select/select.style.js +0 -11
- package/dist/cjs/core/Select/select.widgets.js +0 -63
- package/dist/cjs/core/Tooltip/EllipsisTooltipContent.js +0 -55
- package/dist/esm/core/BytePerSecond/index.js +0 -39
- package/dist/esm/core/LegacySelect/index.js +0 -177
- package/dist/esm/core/LegacySelect/select.style.js +0 -3
- package/dist/esm/core/Select/select.style.js +0 -6
- package/dist/esm/core/Select/select.widgets.js +0 -57
- package/dist/esm/core/Tooltip/EllipsisTooltipContent.js +0 -49
- package/dist/src/core/BytePerSecond/index.d.ts +0 -3
- package/dist/src/core/LegacySelect/index.d.ts +0 -4
- package/dist/src/core/LegacySelect/select.style.d.ts +0 -1
- package/dist/src/core/LegacySelect/select.type.d.ts +0 -31
- package/dist/src/core/Select/select.style.d.ts +0 -4
- package/dist/src/core/Select/select.widgets.d.ts +0 -7
- package/dist/stories/docs/core/BytePerSecond.stories.d.ts +0 -17
- package/dist/stories/docs/core/LegacySelect.stories.d.ts +0 -16
- package/dist/stories/docs/coreX/Calendar.stories.d.ts +0 -11
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { parrotI18n } from '@cloudtower/parrot';
|
|
2
2
|
import _message from '../core/message/index.js';
|
|
3
3
|
import { antdKit } from '../legacy-antd.js';
|
|
4
|
+
import enUS from 'antd/lib/locale/en_US';
|
|
5
|
+
import zhCN from 'antd/lib/locale/zh_CN';
|
|
6
|
+
import antd5enUS from 'antd5/lib/locale/en_US';
|
|
7
|
+
import antd5zhCN from 'antd5/lib/locale/zh_CN';
|
|
4
8
|
import React__default, { createContext, useMemo, useEffect, useContext } from 'react';
|
|
5
9
|
import { ConfigProvider } from '../core/ConfigProvider/index.js';
|
|
6
10
|
import { createBatchMessageMethods } from '../core/message-group/index.js';
|
|
@@ -51,8 +55,14 @@ const UIKitProvider = (props) => {
|
|
|
51
55
|
return /* @__PURE__ */ React__default.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React__default.createElement(MessageContext.Provider, { value: batchMessage != null ? batchMessage : _message }, /* @__PURE__ */ React__default.createElement(
|
|
52
56
|
ConfigProvider,
|
|
53
57
|
{
|
|
54
|
-
antd4Configs: __spreadValues({
|
|
55
|
-
|
|
58
|
+
antd4Configs: __spreadValues({
|
|
59
|
+
autoInsertSpaceInButton: false,
|
|
60
|
+
locale: lng === "zh-CN" ? zhCN : enUS
|
|
61
|
+
}, config == null ? void 0 : config.antd4Configs),
|
|
62
|
+
antd5Configs: __spreadValues({
|
|
63
|
+
autoInsertSpaceInButton: false,
|
|
64
|
+
locale: lng === "zh-CN" ? antd5zhCN : antd5enUS
|
|
65
|
+
}, config == null ? void 0 : config.antd5Configs)
|
|
56
66
|
},
|
|
57
67
|
children
|
|
58
68
|
)));
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
2
1
|
import { ConfigProvider as ConfigProvider$2 } from 'antd';
|
|
3
2
|
import { ConfigProvider as ConfigProvider$1 } from 'antd5';
|
|
4
|
-
import React__default
|
|
5
|
-
import enUS from 'antd/lib/locale/en_US';
|
|
6
|
-
import zhCN from 'antd/lib/locale/zh_CN';
|
|
7
|
-
import antd5enUS from 'antd5/lib/locale/en_US';
|
|
8
|
-
import antd5zhCN from 'antd5/lib/locale/zh_CN';
|
|
9
|
-
import moment from 'moment';
|
|
10
|
-
import dayjs from 'dayjs';
|
|
3
|
+
import React__default from 'react';
|
|
11
4
|
|
|
12
5
|
var __defProp = Object.defineProperty;
|
|
13
6
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -30,30 +23,7 @@ const ConfigProvider = ({
|
|
|
30
23
|
antd4Configs,
|
|
31
24
|
children
|
|
32
25
|
}) => {
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const adjustDateLocale = (lng) => {
|
|
36
|
-
moment.locale(lng === "zh-CN" ? "zh-cn" : "en");
|
|
37
|
-
dayjs.locale(lng === "zh-CN" ? "zh-cn" : "en");
|
|
38
|
-
};
|
|
39
|
-
i18n.on("languageChanged", adjustDateLocale);
|
|
40
|
-
adjustDateLocale(i18n.language);
|
|
41
|
-
}, []);
|
|
42
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
43
|
-
ConfigProvider$1,
|
|
44
|
-
__spreadValues({
|
|
45
|
-
autoInsertSpaceInButton: false,
|
|
46
|
-
locale: i18n.language === "zh-CN" ? antd5zhCN : antd5enUS
|
|
47
|
-
}, antd5Configs),
|
|
48
|
-
/* @__PURE__ */ React__default.createElement(
|
|
49
|
-
ConfigProvider$2,
|
|
50
|
-
__spreadValues({
|
|
51
|
-
autoInsertSpaceInButton: false,
|
|
52
|
-
locale: i18n.language === "zh-CN" ? zhCN : enUS
|
|
53
|
-
}, antd4Configs),
|
|
54
|
-
children
|
|
55
|
-
)
|
|
56
|
-
);
|
|
26
|
+
return /* @__PURE__ */ React__default.createElement(ConfigProvider$1, __spreadValues({}, antd5Configs), /* @__PURE__ */ React__default.createElement(ConfigProvider$2, __spreadValues({}, antd4Configs), children));
|
|
57
27
|
};
|
|
58
28
|
|
|
59
29
|
export { ConfigProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Select } from 'antd';
|
|
1
|
+
import { Select as Select$1 } from 'antd';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import
|
|
3
|
+
import Select from '../../Select/index.js';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -40,10 +40,10 @@ const FieldsEnum = (_a) => {
|
|
|
40
40
|
"enumValues",
|
|
41
41
|
"emptyLabel"
|
|
42
42
|
]);
|
|
43
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
43
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Select, __spreadValues({}, restProps), emptyLabel && /* @__PURE__ */ React__default.createElement(Select$1.Option, { value: "" }, emptyLabel), enumValues.map((v) => {
|
|
44
44
|
const item = typeof v === "string" ? { value: v, text: v } : v;
|
|
45
45
|
return /* @__PURE__ */ React__default.createElement(
|
|
46
|
-
Select.Option,
|
|
46
|
+
Select$1.Option,
|
|
47
47
|
{
|
|
48
48
|
key: item.value,
|
|
49
49
|
value: item.value,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Icon from '../Icon/index.js';
|
|
3
|
-
import LegacySelect from '../LegacySelect/index.js';
|
|
1
|
+
import Loading from '../Loading/index.js';
|
|
4
2
|
import { Typo } from '../Typo/index.js';
|
|
5
|
-
import
|
|
3
|
+
import { Select as Select$2 } from 'antd';
|
|
6
4
|
import cs from 'classnames';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import React__default, { useMemo, useRef, useEffect } from 'react';
|
|
7
|
+
import { findDOMNode } from 'react-dom';
|
|
8
|
+
import { isElement } from 'react-is';
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __defProps = Object.defineProperties;
|
|
@@ -13,113 +13,125 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
13
13
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
14
14
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
15
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
16
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
16
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value
|
|
21
|
+
}) : obj[key] = value;
|
|
17
22
|
var __spreadValues = (a, b) => {
|
|
18
|
-
for (var prop in b || (b = {}))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
23
|
-
if (__propIsEnum.call(b, prop))
|
|
24
|
-
__defNormalProp(a, prop, b[prop]);
|
|
25
|
-
}
|
|
23
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
25
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
26
|
+
}
|
|
26
27
|
return a;
|
|
27
28
|
};
|
|
28
29
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var __objRest = (source, exclude) => {
|
|
31
|
+
var target = {};
|
|
32
|
+
for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
|
|
33
|
+
if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) {
|
|
34
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
const SelectStyle = "E_s177mls5";
|
|
39
|
+
const Select = _a => {
|
|
40
|
+
var _b = _a,
|
|
41
|
+
{
|
|
42
|
+
input,
|
|
43
|
+
multiple,
|
|
44
|
+
className,
|
|
45
|
+
scrollBottomBuffer = 0,
|
|
46
|
+
onScrollBottom,
|
|
47
|
+
onPopupScroll,
|
|
48
|
+
onSearch,
|
|
49
|
+
showSearch,
|
|
50
|
+
filterOption,
|
|
51
|
+
loading,
|
|
52
|
+
notFoundContent,
|
|
53
|
+
children,
|
|
54
|
+
error,
|
|
55
|
+
selectLimit,
|
|
56
|
+
dropdownClassName,
|
|
57
|
+
danger,
|
|
58
|
+
size = "middle",
|
|
59
|
+
meta,
|
|
60
|
+
placeholder
|
|
61
|
+
} = _b,
|
|
62
|
+
restProps = __objRest(_b, ["input", "multiple", "className", "scrollBottomBuffer", "onScrollBottom", "onPopupScroll", "onSearch", "showSearch", "filterOption", "loading", "notFoundContent", "children", "error", "selectLimit", "dropdownClassName", "danger", "size", "meta", "placeholder"]);
|
|
63
|
+
var _a2;
|
|
64
|
+
const limitExceeded = multiple && selectLimit && selectLimit <= (((_a2 = input.value) == null ? void 0 : _a2.length) || 0);
|
|
32
65
|
const typo = {
|
|
33
66
|
large: Typo.Label.l2_regular,
|
|
34
67
|
middle: Typo.Label.l3_regular,
|
|
35
68
|
small: Typo.Label.l4_regular
|
|
36
69
|
}[size];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
103
|
-
Icon,
|
|
104
|
-
{
|
|
105
|
-
className: "select-error-expanded-suffix",
|
|
106
|
-
src: ArrowChevronUp16BoldSecondaryIcon
|
|
107
|
-
}
|
|
108
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
109
|
-
Icon,
|
|
110
|
-
{
|
|
111
|
-
className: "select-error-expanded-search-suffix",
|
|
112
|
-
src: Search16SecondaryIcon
|
|
113
|
-
}
|
|
114
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
115
|
-
Icon,
|
|
116
|
-
{
|
|
117
|
-
className: "select-error-focus-suffix",
|
|
118
|
-
src: ArrowChevronDown16BoldTertiaryIcon
|
|
119
|
-
}
|
|
120
|
-
)))
|
|
121
|
-
})
|
|
122
|
-
);
|
|
70
|
+
const _danger = useMemo(() => {
|
|
71
|
+
if (danger !== void 0) {
|
|
72
|
+
return danger;
|
|
73
|
+
}
|
|
74
|
+
return (meta == null ? void 0 : meta.touched) && meta.invalid;
|
|
75
|
+
}, [danger, meta]);
|
|
76
|
+
const selectRef = useRef(null);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!selectRef.current) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const realDom = findDOMNode(selectRef.current);
|
|
82
|
+
if (realDom) {
|
|
83
|
+
const inputDom = realDom.getElementsByClassName("ant-select-selection-search-input")[0];
|
|
84
|
+
const item = realDom.getElementsByClassName("ant-select-selection-item")[0];
|
|
85
|
+
inputDom && (placeholder || item) && inputDom.setAttribute("data-test", String(placeholder || item.textContent));
|
|
86
|
+
}
|
|
87
|
+
}, [selectRef, placeholder]);
|
|
88
|
+
return /* @__PURE__ */React__default.createElement(Select$2, __spreadValues(__spreadProps(__spreadValues({}, input), {
|
|
89
|
+
ref: selectRef,
|
|
90
|
+
size,
|
|
91
|
+
value: multiple ? input.value || [] : input.value || void 0,
|
|
92
|
+
onChange: (e, option) => {
|
|
93
|
+
var _a3, _b2;
|
|
94
|
+
if (Array.isArray(e) && e.some(v => v === "")) {
|
|
95
|
+
(_a3 = input.onChange) == null ? void 0 : _a3.call(input, [], option);
|
|
96
|
+
} else {
|
|
97
|
+
(_b2 = input.onChange) == null ? void 0 : _b2.call(input, e, option);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onBlur: () => {
|
|
101
|
+
var _a3;
|
|
102
|
+
return (_a3 = input.onBlur) == null ? void 0 : _a3.call(input);
|
|
103
|
+
},
|
|
104
|
+
mode: multiple ? "multiple" : void 0,
|
|
105
|
+
className: cs(SelectStyle, "select", className, limitExceeded && "select-event-none", _danger ? "select-error" : "", typo),
|
|
106
|
+
"data-size": size,
|
|
107
|
+
dropdownClassName: cs(dropdownClassName, limitExceeded && "display-none"),
|
|
108
|
+
showSearch: multiple ? void 0 : typeof showSearch === "undefined" ? Boolean(onSearch) : showSearch,
|
|
109
|
+
filterOption: onSearch === void 0 ? filterOption === void 0 ? (input2, option) => {
|
|
110
|
+
const label = option == null ? void 0 : option.label;
|
|
111
|
+
if (!label || typeof label !== "string") {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return label.toLowerCase().includes(input2.toLowerCase());
|
|
115
|
+
} : filterOption : false,
|
|
116
|
+
onSearch: onSearch && _.debounce(onSearch, 100),
|
|
117
|
+
onPopupScroll: e => {
|
|
118
|
+
onPopupScroll == null ? void 0 : onPopupScroll(e);
|
|
119
|
+
const el = e.currentTarget;
|
|
120
|
+
if (el.scrollHeight - el.offsetHeight - el.scrollTop <= scrollBottomBuffer) {
|
|
121
|
+
onScrollBottom == null ? void 0 : onScrollBottom();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
notFoundContent: loading ? /* @__PURE__ */React__default.createElement(Loading, null) : notFoundContent,
|
|
125
|
+
dropdownRender: menu => /* @__PURE__ */React__default.createElement(React__default.Fragment, null, error || menu),
|
|
126
|
+
loading,
|
|
127
|
+
placeholder
|
|
128
|
+
}), restProps), React__default.Children.map(children, child => {
|
|
129
|
+
return isElement(child) ? __spreadProps(__spreadValues({}, child), {
|
|
130
|
+
props: __spreadProps(__spreadValues({}, child.props), {
|
|
131
|
+
"data-test": child.props.value
|
|
132
|
+
})
|
|
133
|
+
}) : child;
|
|
134
|
+
}));
|
|
123
135
|
};
|
|
124
136
|
var Select$1 = Select;
|
|
125
137
|
|
|
@@ -37,22 +37,20 @@ const TableFormBodyCell = (props) => {
|
|
|
37
37
|
onChange,
|
|
38
38
|
onBlur,
|
|
39
39
|
validateAll,
|
|
40
|
-
error
|
|
41
|
-
onValidate
|
|
40
|
+
error
|
|
42
41
|
} = props;
|
|
43
42
|
const [validateResult, setValidateResult] = useState();
|
|
44
43
|
const [isTouched, setIsTouched] = useState(false);
|
|
45
44
|
const width = typeof column.width === "number" ? column.width + "px" : column.width;
|
|
46
45
|
const isCellErrorStyle = Boolean((validateResult == null ? void 0 : validateResult.isError) || isRowError);
|
|
47
46
|
useEffect(() => {
|
|
48
|
-
if (isTouched)
|
|
47
|
+
if (isTouched)
|
|
49
48
|
setValidateResult(
|
|
50
49
|
error ? {
|
|
51
50
|
msg: error,
|
|
52
51
|
isError: true
|
|
53
52
|
} : void 0
|
|
54
53
|
);
|
|
55
|
-
}
|
|
56
54
|
}, [error, isTouched]);
|
|
57
55
|
const triggerValidate = useCallback(
|
|
58
56
|
(currentValue) => {
|
|
@@ -71,11 +69,10 @@ const TableFormBodyCell = (props) => {
|
|
|
71
69
|
});
|
|
72
70
|
const isError = result ? typeof result === "string" : false;
|
|
73
71
|
setValidateResult({ msg: result || "", isError });
|
|
74
|
-
onValidate == null ? void 0 : onValidate(`${column.key}${rowIndex}`, !isError);
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
74
|
},
|
|
78
|
-
[data, rowIndex, column, getRowValidateResult
|
|
75
|
+
[data, rowIndex, column, getRowValidateResult]
|
|
79
76
|
);
|
|
80
77
|
useEffect(() => {
|
|
81
78
|
if (validateAll) {
|
|
@@ -78,8 +78,7 @@ const TableFormRow = (props) => {
|
|
|
78
78
|
updateData,
|
|
79
79
|
onBodyBlur,
|
|
80
80
|
renderRowDescription,
|
|
81
|
-
validateAll
|
|
82
|
-
onValidate
|
|
81
|
+
validateAll
|
|
83
82
|
} = props;
|
|
84
83
|
const rowData = data[rowIndex];
|
|
85
84
|
const errorFromProps = errors[rowIndex];
|
|
@@ -90,9 +89,6 @@ const TableFormRow = (props) => {
|
|
|
90
89
|
useEffect(() => {
|
|
91
90
|
setRowError(rowLevelError);
|
|
92
91
|
}, [rowLevelError]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
onValidate == null ? void 0 : onValidate(`table_row_${rowIndex}`, !rowError);
|
|
95
|
-
}, [onValidate, rowError, rowIndex]);
|
|
96
92
|
const rowDeletable = typeof (row == null ? void 0 : row.deletable) === "boolean" ? row.deletable : (_a = typeof (row == null ? void 0 : row.deletable) === "function" || (deleteConfig == null ? void 0 : deleteConfig.deletable)) != null ? _a : false;
|
|
97
93
|
const getRowValidateResult = useCallback(
|
|
98
94
|
(rowData2) => {
|
|
@@ -122,8 +118,7 @@ const TableFormRow = (props) => {
|
|
|
122
118
|
isRowError: !!rowError,
|
|
123
119
|
getRowValidateResult,
|
|
124
120
|
validateAll,
|
|
125
|
-
error: cellError
|
|
126
|
-
onValidate
|
|
121
|
+
error: cellError
|
|
127
122
|
}
|
|
128
123
|
);
|
|
129
124
|
});
|
|
@@ -3,7 +3,7 @@ import { TableFormWrapper, DraggableHandleWrapper } from './style.js';
|
|
|
3
3
|
import TableFormBodyRows from './TableFormBodyRows.js';
|
|
4
4
|
import { BatchInputListHeaderCell } from './TableFormHeaderCell.js';
|
|
5
5
|
import { List } from 'antd';
|
|
6
|
-
import React__default, { useState,
|
|
6
|
+
import React__default, { useState, useCallback, useImperativeHandle, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __defProps = Object.defineProperties;
|
|
@@ -55,7 +55,6 @@ const TableForm = React__default.forwardRef(
|
|
|
55
55
|
const [validateAll, setValidateAll] = useState(false);
|
|
56
56
|
const rowSplitType = (row == null ? void 0 : row.splitType) || props.rowSplitType || "border";
|
|
57
57
|
const draggable = (_b = (_a = row == null ? void 0 : row.draggable) != null ? _a : props.draggable) != null ? _b : false;
|
|
58
|
-
const formValidMapRef = useRef({});
|
|
59
58
|
const updateData = useCallback(
|
|
60
59
|
(value, rowIndex, columnKey) => {
|
|
61
60
|
setLatestData(value);
|
|
@@ -100,20 +99,11 @@ const TableForm = React__default.forwardRef(
|
|
|
100
99
|
updateData(data2);
|
|
101
100
|
},
|
|
102
101
|
validateWholeFields() {
|
|
103
|
-
formValidMapRef.current = {};
|
|
104
102
|
setValidateAll(true);
|
|
105
|
-
},
|
|
106
|
-
isValid() {
|
|
107
|
-
return Object.values(formValidMapRef.current).every(
|
|
108
|
-
(v) => v === true
|
|
109
|
-
);
|
|
110
103
|
}
|
|
111
104
|
}),
|
|
112
105
|
[updateData]
|
|
113
106
|
);
|
|
114
|
-
const onValidate = (id, isValid) => {
|
|
115
|
-
formValidMapRef.current[id] = isValid;
|
|
116
|
-
};
|
|
117
107
|
const headerCells = columns.map((col) => {
|
|
118
108
|
return /* @__PURE__ */ React__default.createElement(
|
|
119
109
|
BatchInputListHeaderCell,
|
|
@@ -169,8 +159,7 @@ const TableForm = React__default.forwardRef(
|
|
|
169
159
|
renderRowDescription,
|
|
170
160
|
rowValidator,
|
|
171
161
|
validateAll,
|
|
172
|
-
errors
|
|
173
|
-
onValidate
|
|
162
|
+
errors
|
|
174
163
|
}
|
|
175
164
|
))
|
|
176
165
|
), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React__default.createElement(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CheckmarkDoneSuccessCorrect16BlueIcon } from '@cloudtower/icons-react';
|
|
2
2
|
import { cx } from '@linaria/core';
|
|
3
3
|
import Icon from '../Icon/index.js';
|
|
4
|
-
import
|
|
4
|
+
import Select$1 from '../Select/index.js';
|
|
5
5
|
import { Typo } from '../Typo/index.js';
|
|
6
6
|
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
7
7
|
import { Select, Tag } from 'antd';
|
|
@@ -86,7 +86,7 @@ const TimeZoneSelect = props => {
|
|
|
86
86
|
}));
|
|
87
87
|
}));
|
|
88
88
|
});
|
|
89
|
-
return /* @__PURE__ */React__default.createElement(
|
|
89
|
+
return /* @__PURE__ */React__default.createElement(Select$1, {
|
|
90
90
|
className: cx(SelectStyle, className),
|
|
91
91
|
dropdownClassName: DropdownStyle,
|
|
92
92
|
placeholder: /* @__PURE__ */React__default.createElement("span", null, placeholder || t("components.time_zone_select_placeholder")),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Tooltip as Tooltip$2 } from 'antd';
|
|
2
2
|
import cs from 'classnames';
|
|
3
3
|
import React__default, { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
-
import EllipsisTooltipContent from './EllipsisTooltipContent.js';
|
|
5
4
|
|
|
6
5
|
var __defProp = Object.defineProperty;
|
|
7
6
|
var __defProps = Object.defineProperties;
|
|
@@ -33,7 +32,7 @@ var __objRest = (source, exclude) => {
|
|
|
33
32
|
};
|
|
34
33
|
let componentId = 0;
|
|
35
34
|
const TooltipDefaultClass = "E_t1m2x205";
|
|
36
|
-
const
|
|
35
|
+
const Tooltip = props => {
|
|
37
36
|
const _a = props,
|
|
38
37
|
{
|
|
39
38
|
followMouse,
|
|
@@ -81,8 +80,6 @@ const InternalTooltip = props => {
|
|
|
81
80
|
}, overlayStyle) : overlayStyle
|
|
82
81
|
}));
|
|
83
82
|
};
|
|
84
|
-
const Tooltip = InternalTooltip;
|
|
85
|
-
Tooltip.EllipsisContent = EllipsisTooltipContent;
|
|
86
83
|
var Tooltip$1 = Tooltip;
|
|
87
84
|
|
|
88
85
|
export { Tooltip$1 as default };
|
package/dist/esm/core/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import Bit from './Bit/index.js';
|
|
|
2
2
|
import BitPerSecond from './BitPerSecond/index.js';
|
|
3
3
|
import Bps from './Bps/index.js';
|
|
4
4
|
import Byte from './Byte/index.js';
|
|
5
|
-
import BytePerSecond from './BytePerSecond/index.js';
|
|
6
5
|
import Frequency from './Frequency/index.js';
|
|
7
6
|
import Percent from './Percent/index.js';
|
|
8
7
|
import Second from './Second/index.js';
|
|
@@ -11,7 +10,6 @@ import Speed from './Speed/index.js';
|
|
|
11
10
|
const units = {
|
|
12
11
|
Percent,
|
|
13
12
|
Byte,
|
|
14
|
-
BytePerSecond,
|
|
15
13
|
Frequency,
|
|
16
14
|
Speed,
|
|
17
15
|
Bps,
|
|
@@ -20,4 +18,4 @@ const units = {
|
|
|
20
18
|
Second
|
|
21
19
|
};
|
|
22
20
|
|
|
23
|
-
export { Bit, BitPerSecond, Bps, Byte,
|
|
21
|
+
export { Bit, BitPerSecond, Bps, Byte, Frequency, Percent, Second, Speed, units as Units, units };
|
|
@@ -3,7 +3,6 @@ import Bit from '../../core/Bit/index.js';
|
|
|
3
3
|
import BitPerSecond from '../../core/BitPerSecond/index.js';
|
|
4
4
|
import Bps from '../../core/Bps/index.js';
|
|
5
5
|
import Byte from '../../core/Byte/index.js';
|
|
6
|
-
import BytePerSecond from '../../core/BytePerSecond/index.js';
|
|
7
6
|
import Frequency from '../../core/Frequency/index.js';
|
|
8
7
|
import Percent from '../../core/Percent/index.js';
|
|
9
8
|
import Second from '../../core/Second/index.js';
|
|
@@ -18,7 +17,6 @@ import React__default from 'react';
|
|
|
18
17
|
const units = {
|
|
19
18
|
Percent,
|
|
20
19
|
Byte,
|
|
21
|
-
BytePerSecond,
|
|
22
20
|
Frequency,
|
|
23
21
|
Speed,
|
|
24
22
|
Bps,
|
|
@@ -10,8 +10,6 @@ import dayjs from 'dayjs';
|
|
|
10
10
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
11
11
|
import { getDiffMonthAndDate, getTime, checkDateNotInRange, getClassNameForDateBlock } from './common.js';
|
|
12
12
|
import { CalendarStyle } from './DateRangePicker.style.js';
|
|
13
|
-
import { parrotI18n } from '@cloudtower/parrot';
|
|
14
|
-
import { getCalendarTitle } from '../common/getCalendarTitle.js';
|
|
15
13
|
|
|
16
14
|
const Year = (props) => {
|
|
17
15
|
const { year, onChange } = props;
|
|
@@ -80,7 +78,7 @@ const MonthItem = (props) => {
|
|
|
80
78
|
onRangeChange,
|
|
81
79
|
onMouseEnter
|
|
82
80
|
} = props;
|
|
83
|
-
useParrotTranslation();
|
|
81
|
+
const { t } = useParrotTranslation();
|
|
84
82
|
const containerRef = useRef(null);
|
|
85
83
|
const datesContainerRef = useRef(null);
|
|
86
84
|
const headerRef = useRef(null);
|
|
@@ -131,7 +129,8 @@ const MonthItem = (props) => {
|
|
|
131
129
|
className: cx(Typo.Label.l1_bold, isPinned && "pinned"),
|
|
132
130
|
ref: headerRef
|
|
133
131
|
},
|
|
134
|
-
|
|
132
|
+
initMonth.month,
|
|
133
|
+
t("common.month")
|
|
135
134
|
), /* @__PURE__ */ React__default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.createElement("span", { key: `blank-date-${index}`, className: "blank" })), initMonth.dates.map((date) => {
|
|
136
135
|
const _date = getTime(initYear, initMonth.month, date);
|
|
137
136
|
const dateNotIncludeInRange = checkDateNotInRange(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalendarClockDateTime24GradientGrayIcon, CalendarClockDateTime24GradientBlueIcon, CalendarTimeRecord16Icon } from '@cloudtower/icons-react';
|
|
2
2
|
import { cx } from '@linaria/core';
|
|
3
3
|
import Icon from '../../core/Icon/index.js';
|
|
4
4
|
import Input from '../../core/Input/index.js';
|
|
@@ -247,7 +247,7 @@ const DateRangePicker = (props) => {
|
|
|
247
247
|
className: "default-calendar-icon",
|
|
248
248
|
iconWidth: 16,
|
|
249
249
|
iconHeight: 16,
|
|
250
|
-
src:
|
|
250
|
+
src: CalendarClockDateTime24GradientGrayIcon
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
253
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -256,7 +256,7 @@ const DateRangePicker = (props) => {
|
|
|
256
256
|
className: "hover-calendar-icon",
|
|
257
257
|
iconWidth: 16,
|
|
258
258
|
iconHeight: 16,
|
|
259
|
-
src:
|
|
259
|
+
src: CalendarClockDateTime24GradientBlueIcon
|
|
260
260
|
}
|
|
261
261
|
),
|
|
262
262
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -40,14 +40,12 @@ const SummaryTableRow = props => {
|
|
|
40
40
|
title,
|
|
41
41
|
children,
|
|
42
42
|
hiddenTitle = false,
|
|
43
|
-
hiddenBorder = false
|
|
44
|
-
dataKey
|
|
43
|
+
hiddenBorder = false
|
|
45
44
|
} = props;
|
|
46
45
|
return /* @__PURE__ */React__default.createElement(TableRow, {
|
|
47
46
|
className: cs("table-row", {
|
|
48
47
|
hiddenBorder
|
|
49
|
-
})
|
|
50
|
-
"data-key": dataKey
|
|
48
|
+
})
|
|
51
49
|
}, /* @__PURE__ */React__default.createElement(RowLabel, {
|
|
52
50
|
width: labelWidth,
|
|
53
51
|
className: cs({
|
|
@@ -73,8 +71,7 @@ const SummaryTableContent = props => {
|
|
|
73
71
|
labelWidth,
|
|
74
72
|
hiddenTitle: item == null ? void 0 : item.hiddenTitle,
|
|
75
73
|
hiddenBorder: item == null ? void 0 : item.hiddenBorder,
|
|
76
|
-
title: item.title
|
|
77
|
-
dataKey: item.key
|
|
74
|
+
title: item.title
|
|
78
75
|
}, item.render ? item.render(value, dataSource) : _.isNull(value) || _.isUndefined(value) || value === "" ? Empty : value);
|
|
79
76
|
}));
|
|
80
77
|
};
|
|
@@ -3,7 +3,6 @@ import Bit from '../../core/Bit/index.js';
|
|
|
3
3
|
import BitPerSecond from '../../core/BitPerSecond/index.js';
|
|
4
4
|
import Bps from '../../core/Bps/index.js';
|
|
5
5
|
import Byte from '../../core/Byte/index.js';
|
|
6
|
-
import BytePerSecond from '../../core/BytePerSecond/index.js';
|
|
7
6
|
import Empty from '../../core/Empty/index.js';
|
|
8
7
|
import Frequency from '../../core/Frequency/index.js';
|
|
9
8
|
import Percent from '../../core/Percent/index.js';
|
|
@@ -33,7 +32,6 @@ var __spreadValues = (a, b) => {
|
|
|
33
32
|
const units = {
|
|
34
33
|
Percent,
|
|
35
34
|
Byte,
|
|
36
|
-
BytePerSecond,
|
|
37
35
|
Frequency,
|
|
38
36
|
Speed,
|
|
39
37
|
Bps,
|