@cloudtower/eagle 0.31.16 → 0.31.18

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 (42) hide show
  1. package/dist/cjs/core/Fields/FieldsEnum/index.js +1 -1
  2. package/dist/cjs/core/LegacySelect/index.js +185 -0
  3. package/dist/cjs/core/LegacySelect/select.style.js +5 -0
  4. package/dist/cjs/core/Select/index.js +106 -117
  5. package/dist/cjs/core/Select/select.style.js +11 -0
  6. package/dist/cjs/core/Select/select.widgets.js +63 -0
  7. package/dist/cjs/core/TableForm/TableFormBodyCell.js +6 -3
  8. package/dist/cjs/core/TableForm/TableFormBodyRows.js +7 -2
  9. package/dist/cjs/core/TableForm/index.js +12 -1
  10. package/dist/cjs/core/TimeZoneSelect/index.js +1 -1
  11. package/dist/cjs/core/index.js +9 -9
  12. package/dist/cjs/index.js +185 -181
  13. package/dist/cjs/legacy-antd.js +137 -135
  14. package/dist/cjs/stats1.html +1 -1
  15. package/dist/components.css +3556 -3373
  16. package/dist/esm/core/Fields/FieldsEnum/index.js +4 -4
  17. package/dist/esm/core/LegacySelect/index.js +177 -0
  18. package/dist/esm/core/LegacySelect/select.style.js +3 -0
  19. package/dist/esm/core/Select/index.js +104 -116
  20. package/dist/esm/core/Select/select.style.js +6 -0
  21. package/dist/esm/core/Select/select.widgets.js +57 -0
  22. package/dist/esm/core/TableForm/TableFormBodyCell.js +6 -3
  23. package/dist/esm/core/TableForm/TableFormBodyRows.js +7 -2
  24. package/dist/esm/core/TableForm/index.js +13 -2
  25. package/dist/esm/core/TimeZoneSelect/index.js +2 -2
  26. package/dist/esm/index.js +5 -3
  27. package/dist/esm/legacy-antd.js +2 -0
  28. package/dist/esm/stats1.html +1 -1
  29. package/dist/src/core/LegacySelect/index.d.ts +4 -0
  30. package/dist/src/core/LegacySelect/select.style.d.ts +1 -0
  31. package/dist/src/core/LegacySelect/select.type.d.ts +31 -0
  32. package/dist/src/core/Select/index.d.ts +1 -0
  33. package/dist/src/core/Select/select.style.d.ts +4 -0
  34. package/dist/src/core/Select/select.type.d.ts +6 -31
  35. package/dist/src/core/Select/select.widgets.d.ts +7 -0
  36. package/dist/src/core/TableForm/types.d.ts +3 -0
  37. package/dist/src/core/index.d.ts +4 -2
  38. package/dist/src/spec/base.d.ts +2 -1
  39. package/dist/stories/docs/core/{Select.Simple.stories.d.ts → LegacySelect.Simple.stories.d.ts} +3 -3
  40. package/dist/stories/docs/core/LegacySelect.stories.d.ts +16 -0
  41. package/dist/style.css +3327 -3175
  42. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
- import { Select as Select$1 } from 'antd';
1
+ import { Select } from 'antd';
2
2
  import React__default from 'react';
3
- import Select from '../../Select/index.js';
3
+ import LegacySelect from '../../LegacySelect/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(Select, __spreadValues({}, restProps), emptyLabel && /* @__PURE__ */ React__default.createElement(Select$1.Option, { value: "" }, emptyLabel), enumValues.map((v) => {
43
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(LegacySelect, __spreadValues({}, restProps), emptyLabel && /* @__PURE__ */ React__default.createElement(Select.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$1.Option,
46
+ Select.Option,
47
47
  {
48
48
  key: item.value,
49
49
  value: item.value,
@@ -0,0 +1,177 @@
1
+ import Loading from '../Loading/index.js';
2
+ import { Typo } from '../Typo/index.js';
3
+ import { Select } from 'antd';
4
+ import cs from 'classnames';
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
+ import { SelectStyle } from './select.style.js';
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __defProps = Object.defineProperties;
13
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
14
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
17
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues = (a, b) => {
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(b)) {
24
+ if (__propIsEnum.call(b, prop))
25
+ __defNormalProp(a, prop, b[prop]);
26
+ }
27
+ return a;
28
+ };
29
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
30
+ var __objRest = (source, exclude) => {
31
+ var target = {};
32
+ for (var prop in source)
33
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
34
+ target[prop] = source[prop];
35
+ if (source != null && __getOwnPropSymbols)
36
+ for (var prop of __getOwnPropSymbols(source)) {
37
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
38
+ target[prop] = source[prop];
39
+ }
40
+ return target;
41
+ };
42
+ const LegacySelect = (_a) => {
43
+ var _b = _a, {
44
+ input,
45
+ multiple,
46
+ className,
47
+ scrollBottomBuffer = 0,
48
+ onScrollBottom,
49
+ onPopupScroll,
50
+ onSearch,
51
+ showSearch,
52
+ filterOption,
53
+ loading,
54
+ notFoundContent,
55
+ children,
56
+ error,
57
+ selectLimit,
58
+ dropdownClassName,
59
+ danger,
60
+ size = "middle",
61
+ meta,
62
+ placeholder
63
+ } = _b, restProps = __objRest(_b, [
64
+ "input",
65
+ "multiple",
66
+ "className",
67
+ "scrollBottomBuffer",
68
+ "onScrollBottom",
69
+ "onPopupScroll",
70
+ "onSearch",
71
+ "showSearch",
72
+ "filterOption",
73
+ "loading",
74
+ "notFoundContent",
75
+ "children",
76
+ "error",
77
+ "selectLimit",
78
+ "dropdownClassName",
79
+ "danger",
80
+ "size",
81
+ "meta",
82
+ "placeholder"
83
+ ]);
84
+ var _a2;
85
+ const limitExceeded = multiple && selectLimit && selectLimit <= (((_a2 = input.value) == null ? void 0 : _a2.length) || 0);
86
+ const typo = {
87
+ large: Typo.Label.l2_regular,
88
+ middle: Typo.Label.l3_regular,
89
+ small: Typo.Label.l4_regular
90
+ }[size];
91
+ const _danger = useMemo(() => {
92
+ if (danger !== void 0) {
93
+ return danger;
94
+ }
95
+ return (meta == null ? void 0 : meta.touched) && meta.invalid;
96
+ }, [danger, meta]);
97
+ const selectRef = useRef(null);
98
+ useEffect(() => {
99
+ if (!selectRef.current) {
100
+ return;
101
+ }
102
+ const realDom = findDOMNode(selectRef.current);
103
+ if (realDom) {
104
+ const inputDom = realDom.getElementsByClassName(
105
+ "ant-select-selection-search-input"
106
+ )[0];
107
+ const item = realDom.getElementsByClassName(
108
+ "ant-select-selection-item"
109
+ )[0];
110
+ inputDom && (placeholder || item) && inputDom.setAttribute(
111
+ "data-test",
112
+ String(placeholder || item.textContent)
113
+ );
114
+ }
115
+ }, [selectRef, placeholder]);
116
+ return /* @__PURE__ */ React__default.createElement(
117
+ Select,
118
+ __spreadValues(__spreadProps(__spreadValues({}, input), {
119
+ ref: selectRef,
120
+ size,
121
+ value: multiple ? input.value || [] : input.value || void 0,
122
+ onChange: (e, option) => {
123
+ var _a3, _b2;
124
+ if (Array.isArray(e) && e.some((v) => v === "")) {
125
+ (_a3 = input.onChange) == null ? void 0 : _a3.call(input, [], option);
126
+ } else {
127
+ (_b2 = input.onChange) == null ? void 0 : _b2.call(input, e, option);
128
+ }
129
+ },
130
+ onBlur: () => {
131
+ var _a3;
132
+ return (_a3 = input.onBlur) == null ? void 0 : _a3.call(input);
133
+ },
134
+ mode: multiple ? "multiple" : void 0,
135
+ className: cs(
136
+ SelectStyle,
137
+ "select",
138
+ className,
139
+ limitExceeded && "select-event-none",
140
+ _danger ? "select-error" : "",
141
+ typo
142
+ ),
143
+ "data-size": size,
144
+ dropdownClassName: cs(dropdownClassName, limitExceeded && "display-none"),
145
+ showSearch: multiple ? void 0 : typeof showSearch === "undefined" ? Boolean(onSearch) : showSearch,
146
+ filterOption: onSearch === void 0 ? filterOption === void 0 ? (input2, option) => {
147
+ const label = option == null ? void 0 : option.label;
148
+ if (!label || typeof label !== "string") {
149
+ return false;
150
+ }
151
+ return label.toLowerCase().includes(input2.toLowerCase());
152
+ } : filterOption : false,
153
+ onSearch: onSearch && _.debounce(onSearch, 100),
154
+ onPopupScroll: (e) => {
155
+ onPopupScroll == null ? void 0 : onPopupScroll(e);
156
+ const el = e.currentTarget;
157
+ if (el.scrollHeight - el.offsetHeight - el.scrollTop <= scrollBottomBuffer) {
158
+ onScrollBottom == null ? void 0 : onScrollBottom();
159
+ }
160
+ },
161
+ notFoundContent: loading ? /* @__PURE__ */ React__default.createElement(Loading, null) : notFoundContent,
162
+ dropdownRender: (menu) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, error || menu),
163
+ loading,
164
+ placeholder
165
+ }), restProps),
166
+ React__default.Children.map(children, (child) => {
167
+ return isElement(child) ? __spreadProps(__spreadValues({}, child), {
168
+ props: __spreadProps(__spreadValues({}, child.props), {
169
+ "data-test": child.props.value
170
+ })
171
+ }) : child;
172
+ })
173
+ );
174
+ };
175
+ var LegacySelect$1 = LegacySelect;
176
+
177
+ export { LegacySelect$1 as default };
@@ -0,0 +1,3 @@
1
+ const SelectStyle = "E_s17wv897";
2
+
3
+ export { SelectStyle };
@@ -1,11 +1,11 @@
1
- import Loading from '../Loading/index.js';
1
+ import { ArrowChevronDown16BoldTertiaryIcon, ArrowChevronDown16BoldBlueIcon, ArrowChevronUp16BoldBlueIcon, Search16BlueIcon, ArrowChevronDown16BoldSecondaryIcon, ArrowChevronUp16BoldSecondaryIcon, Search16SecondaryIcon } from '@cloudtower/icons-react';
2
+ import Icon from '../Icon/index.js';
3
+ import LegacySelect from '../LegacySelect/index.js';
2
4
  import { Typo } from '../Typo/index.js';
3
- import { Select as Select$2 } from 'antd';
5
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
4
6
  import cs from 'classnames';
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';
7
+ import React__default from 'react';
8
+ import { SelectStyle, SelectIconStyle, SelectSizeStyle, PlaceholderTextStyle } from './select.style.js';
9
9
 
10
10
  var __defProp = Object.defineProperty;
11
11
  var __defProps = Object.defineProperties;
@@ -13,125 +13,113 @@ 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, {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value
21
- }) : obj[key] = value;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22
17
  var __spreadValues = (a, b) => {
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
- }
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols)
22
+ for (var prop of __getOwnPropSymbols(b)) {
23
+ if (__propIsEnum.call(b, prop))
24
+ __defNormalProp(a, prop, b[prop]);
25
+ }
27
26
  return a;
28
27
  };
29
28
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
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);
29
+ const Select = (props) => {
30
+ const { size = "middle", isLoadingValue } = props;
31
+ const { t } = useParrotTranslation();
65
32
  const typo = {
66
33
  large: Typo.Label.l2_regular,
67
34
  middle: Typo.Label.l3_regular,
68
35
  small: Typo.Label.l4_regular
69
36
  }[size];
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
- }));
37
+ return /* @__PURE__ */ React__default.createElement(
38
+ LegacySelect,
39
+ __spreadProps(__spreadValues({}, props), {
40
+ className: cs(
41
+ SelectStyle,
42
+ SelectIconStyle,
43
+ SelectSizeStyle,
44
+ isLoadingValue ? "select-loading-value" : "",
45
+ props.className
46
+ ),
47
+ placeholder: /* @__PURE__ */ React__default.createElement("span", { className: cs(typo, PlaceholderTextStyle) }, isLoadingValue ? t("components.loading") : props.placeholder),
48
+ suffixIcon: props.suffixIcon || (props.loading ? void 0 : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
49
+ Icon,
50
+ {
51
+ className: "select-suffix",
52
+ src: ArrowChevronDown16BoldTertiaryIcon
53
+ }
54
+ ), /* @__PURE__ */ React__default.createElement(
55
+ Icon,
56
+ {
57
+ className: "select-hover-suffix",
58
+ src: ArrowChevronDown16BoldBlueIcon
59
+ }
60
+ ), /* @__PURE__ */ React__default.createElement(
61
+ Icon,
62
+ {
63
+ className: "select-active-suffix",
64
+ src: ArrowChevronDown16BoldBlueIcon
65
+ }
66
+ ), /* @__PURE__ */ React__default.createElement(
67
+ Icon,
68
+ {
69
+ className: "select-expanded-suffix",
70
+ src: ArrowChevronUp16BoldBlueIcon
71
+ }
72
+ ), /* @__PURE__ */ React__default.createElement(
73
+ Icon,
74
+ {
75
+ className: "select-expanded-search-suffix",
76
+ src: Search16BlueIcon
77
+ }
78
+ ), /* @__PURE__ */ React__default.createElement(
79
+ Icon,
80
+ {
81
+ className: "select-focus-suffix",
82
+ src: ArrowChevronDown16BoldTertiaryIcon
83
+ }
84
+ ), /* @__PURE__ */ React__default.createElement(
85
+ Icon,
86
+ {
87
+ className: "select-error-suffix",
88
+ src: ArrowChevronDown16BoldTertiaryIcon
89
+ }
90
+ ), /* @__PURE__ */ React__default.createElement(
91
+ Icon,
92
+ {
93
+ className: "select-error-hover-suffix",
94
+ src: ArrowChevronDown16BoldSecondaryIcon
95
+ }
96
+ ), /* @__PURE__ */ React__default.createElement(
97
+ Icon,
98
+ {
99
+ className: "select-error-active-suffix",
100
+ src: ArrowChevronDown16BoldSecondaryIcon
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
+ );
135
123
  };
136
124
  var Select$1 = Select;
137
125
 
@@ -0,0 +1,6 @@
1
+ const SelectStyle = "E_s4ivdfu";
2
+ const SelectIconStyle = "E_sks9xr8";
3
+ const SelectSizeStyle = "E_swwhohx";
4
+ const PlaceholderTextStyle = "E_p2sxmsl";
5
+
6
+ export { PlaceholderTextStyle, SelectIconStyle, SelectSizeStyle, SelectStyle };
@@ -0,0 +1,57 @@
1
+ import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
2
+ import { Select } from 'antd';
3
+ import React__default from 'react';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value
14
+ }) : obj[key] = value;
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) {
26
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
27
+ }
28
+ return target;
29
+ };
30
+ const OptionStyle = "E_oa99sl3";
31
+ const LeftStyle = "E_lvp5pj7";
32
+ const SlotStyle = "E_s1io1lws";
33
+ const AntdOption = Select.Option;
34
+ function getOptions(options) {
35
+ return options.map(option => {
36
+ const _a = option,
37
+ {
38
+ prefix,
39
+ suffix,
40
+ children
41
+ } = _a,
42
+ restProps = __objRest(_a, ["prefix", "suffix", "children"]);
43
+ return /* @__PURE__ */React__default.createElement(AntdOption, __spreadValues({}, restProps), /* @__PURE__ */React__default.createElement("div", {
44
+ className: OptionStyle
45
+ }, /* @__PURE__ */React__default.createElement("span", {
46
+ className: LeftStyle
47
+ }, prefix ? /* @__PURE__ */React__default.createElement("span", {
48
+ className: SlotStyle
49
+ }, prefix) : null, /* @__PURE__ */React__default.createElement(OverflowTooltip, {
50
+ content: children
51
+ })), suffix ? /* @__PURE__ */React__default.createElement("span", {
52
+ className: SlotStyle
53
+ }, suffix) : null));
54
+ });
55
+ }
56
+
57
+ export { getOptions };
@@ -37,20 +37,22 @@ const TableFormBodyCell = (props) => {
37
37
  onChange,
38
38
  onBlur,
39
39
  validateAll,
40
- error
40
+ error,
41
+ onValidate
41
42
  } = props;
42
43
  const [validateResult, setValidateResult] = useState();
43
44
  const [isTouched, setIsTouched] = useState(false);
44
45
  const width = typeof column.width === "number" ? column.width + "px" : column.width;
45
46
  const isCellErrorStyle = Boolean((validateResult == null ? void 0 : validateResult.isError) || isRowError);
46
47
  useEffect(() => {
47
- if (isTouched)
48
+ if (isTouched) {
48
49
  setValidateResult(
49
50
  error ? {
50
51
  msg: error,
51
52
  isError: true
52
53
  } : void 0
53
54
  );
55
+ }
54
56
  }, [error, isTouched]);
55
57
  const triggerValidate = useCallback(
56
58
  (currentValue) => {
@@ -69,10 +71,11 @@ const TableFormBodyCell = (props) => {
69
71
  });
70
72
  const isError = result ? typeof result === "string" : false;
71
73
  setValidateResult({ msg: result || "", isError });
74
+ onValidate == null ? void 0 : onValidate(`${column.key}${rowIndex}`, !isError);
72
75
  return;
73
76
  }
74
77
  },
75
- [data, rowIndex, column, getRowValidateResult]
78
+ [data, rowIndex, column, getRowValidateResult, onValidate]
76
79
  );
77
80
  useEffect(() => {
78
81
  if (validateAll) {
@@ -78,7 +78,8 @@ const TableFormRow = (props) => {
78
78
  updateData,
79
79
  onBodyBlur,
80
80
  renderRowDescription,
81
- validateAll
81
+ validateAll,
82
+ onValidate
82
83
  } = props;
83
84
  const rowData = data[rowIndex];
84
85
  const errorFromProps = errors[rowIndex];
@@ -89,6 +90,9 @@ const TableFormRow = (props) => {
89
90
  useEffect(() => {
90
91
  setRowError(rowLevelError);
91
92
  }, [rowLevelError]);
93
+ useEffect(() => {
94
+ onValidate == null ? void 0 : onValidate(`table_row_${rowIndex}`, !rowError);
95
+ }, [onValidate, rowError, rowIndex]);
92
96
  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;
93
97
  const getRowValidateResult = useCallback(
94
98
  (rowData2) => {
@@ -118,7 +122,8 @@ const TableFormRow = (props) => {
118
122
  isRowError: !!rowError,
119
123
  getRowValidateResult,
120
124
  validateAll,
121
- error: cellError
125
+ error: cellError,
126
+ onValidate
122
127
  }
123
128
  );
124
129
  });
@@ -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, useCallback, useImperativeHandle, useMemo } from 'react';
6
+ import React__default, { useState, useRef, useCallback, useImperativeHandle, useMemo } from 'react';
7
7
 
8
8
  var __defProp = Object.defineProperty;
9
9
  var __defProps = Object.defineProperties;
@@ -55,6 +55,7 @@ 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({});
58
59
  const updateData = useCallback(
59
60
  (value, rowIndex, columnKey) => {
60
61
  setLatestData(value);
@@ -99,11 +100,20 @@ const TableForm = React__default.forwardRef(
99
100
  updateData(data2);
100
101
  },
101
102
  validateWholeFields() {
103
+ formValidMapRef.current = {};
102
104
  setValidateAll(true);
105
+ },
106
+ isValid() {
107
+ return Object.values(formValidMapRef.current).every(
108
+ (v) => v === true
109
+ );
103
110
  }
104
111
  }),
105
112
  [updateData]
106
113
  );
114
+ const onValidate = (id, isValid) => {
115
+ formValidMapRef.current[id] = isValid;
116
+ };
107
117
  const headerCells = columns.map((col) => {
108
118
  return /* @__PURE__ */ React__default.createElement(
109
119
  BatchInputListHeaderCell,
@@ -159,7 +169,8 @@ const TableForm = React__default.forwardRef(
159
169
  renderRowDescription,
160
170
  rowValidator,
161
171
  validateAll,
162
- errors
172
+ errors,
173
+ onValidate
163
174
  }
164
175
  ))
165
176
  ), (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 Select$1 from '../Select/index.js';
4
+ import LegacySelect from '../LegacySelect/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(Select$1, {
89
+ return /* @__PURE__ */React__default.createElement(LegacySelect, {
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")),