@cloudtower/eagle 0.22.40 → 0.23.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/esm/index.js CHANGED
@@ -1,10 +1,9 @@
1
- import { Alert as Alert$1, Badge as Badge$1, Button as Button$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, DatePicker, Select as Select$1, InputNumber as InputNumber$1, Input as Input$1, TimePicker as TimePicker$1, message, Modal as Modal$1, Steps as Steps$1, Dropdown, Menu, Progress as Progress$1, Radio as Radio$1, Switch as Switch$1, Table as Table$1, Space, Form, List, Tag, Row, Col, Tree, Divider, Skeleton, Layout, AutoComplete, Popover, Timeline, Typography, Cascader, Upload, Calendar, Tabs } from 'antd';
1
+ import { Alert as Alert$1, Badge as Badge$1, Button as Button$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, DatePicker, Select as Select$1, InputNumber as InputNumber$1, Input as Input$1, TimePicker as TimePicker$1, message, Modal as Modal$1, Steps as Steps$1, Dropdown, Menu, Progress as Progress$1, Radio as Radio$1, Switch as Switch$1, Table as Table$1, Space, Form, List, Tag, Row, Col, Tree, Divider, Skeleton, Layout, AutoComplete, Popover, Timeline, Typography, Cascader, Upload, Calendar, Tabs, ConfigProvider } from 'antd';
2
2
  export { Col, Row } from 'antd';
3
3
  import React, { useState, useMemo, useRef, useCallback, useEffect, Fragment, useLayoutEffect, createContext, memo, useImperativeHandle, useContext } from 'react';
4
4
  import cs from 'classnames';
5
5
  import _, { uniqBy, groupBy, sortBy, toPairs } from 'lodash';
6
- import { parrotI18n } from '@cloudtower/parrot';
7
- export * from '@cloudtower/parrot';
6
+ import { useTranslation, withTranslation, I18nextProvider } from 'react-i18next';
8
7
  import { cx } from '@linaria/core';
9
8
  import { styled } from '@linaria/react';
10
9
  import moment from 'moment';
@@ -13,10 +12,11 @@ import { isElement } from 'react-is';
13
12
  import { CloseCircleFilled, CheckOutlined, SearchOutlined, PlusOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons';
14
13
  import { combineReducers, createStore } from 'redux';
15
14
  import { createDispatchHook, createSelectorHook, Provider } from 'react-redux';
16
- import { HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon, CheckmarkDoneSuccessCorrect16BlueIcon } from '@cloudtower/icons-react';
15
+ import { XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon, HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, CheckmarkDoneSuccessCorrect16BlueIcon } from '@cloudtower/icons-react';
17
16
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
18
17
  import TimeZones from 'timezones.json';
19
- import { withTranslation } from 'react-i18next';
18
+ import { parrotI18n } from '@cloudtower/parrot';
19
+ export * from '@cloudtower/parrot';
20
20
  import dayjs from 'dayjs';
21
21
  import 'recharts';
22
22
 
@@ -477,10 +477,11 @@ const Alert = (_a) => {
477
477
  };
478
478
 
479
479
  const Arch = (props) => {
480
+ const { t } = useTranslation();
480
481
  const { architecture } = props;
481
482
  let text = "";
482
483
  if (architecture) {
483
- text = parrotI18n.t(`components.Architecture_${architecture}`);
484
+ text = t(`components.Architecture_${architecture}`);
484
485
  }
485
486
  return /* @__PURE__ */ React.createElement("span", null, text);
486
487
  };
@@ -975,11 +976,12 @@ const Byte = ({
975
976
  valueClassName,
976
977
  unitClassName
977
978
  }) => {
979
+ const { t } = useTranslation();
978
980
  if (isEmpty(rawValue)) {
979
981
  return Empty;
980
982
  }
981
983
  if (rawValue === -1) {
982
- return /* @__PURE__ */ React.createElement("span", null, parrotI18n.t("common.calculation"));
984
+ return /* @__PURE__ */ React.createElement("span", null, t("common.calculation"));
983
985
  }
984
986
  const { value, unit } = formatBytes(rawValue, decimals);
985
987
  if (noUnitOnZero && value === 0) {
@@ -2597,10 +2599,11 @@ var __objRest$5 = (source, exclude) => {
2597
2599
  };
2598
2600
  const Modal = (props) => {
2599
2601
  var _b;
2602
+ const { t } = useTranslation();
2600
2603
  const _a = props, {
2601
2604
  error,
2602
- okText = parrotI18n.t("common.confirm"),
2603
- cancelText = parrotI18n.t("common.cancel"),
2605
+ okText = t("common.confirm"),
2606
+ cancelText = t("common.cancel"),
2604
2607
  confirmLoading,
2605
2608
  okButtonProps,
2606
2609
  onOk,
@@ -2649,12 +2652,12 @@ const Modal = (props) => {
2649
2652
  let text = (okButtonProps == null ? void 0 : okButtonProps.children) || okText;
2650
2653
  if (wizard && typeof wizard === "object" && wizard.steps[wizard.step]) {
2651
2654
  const { step, steps } = wizard;
2652
- text = step < steps.length - 1 ? steps[step].okText || parrotI18n.t("common.next_step") : steps[step].okText || text;
2655
+ text = step < steps.length - 1 ? steps[step].okText || t("common.next_step") : steps[step].okText || text;
2653
2656
  }
2654
2657
  return text;
2655
- }, [okButtonProps, okText, wizard]);
2658
+ }, [okButtonProps == null ? void 0 : okButtonProps.children, okText, t, wizard]);
2656
2659
  const prevText = useMemo(() => {
2657
- let text = /* @__PURE__ */ React.createElement("span", null, "< ", parrotI18n.t("common.prev_step"));
2660
+ let text = /* @__PURE__ */ React.createElement("span", null, "< ", t("common.prev_step"));
2658
2661
  if (wizard && typeof wizard === "object" && wizard.steps[wizard.step]) {
2659
2662
  const { step, steps } = wizard;
2660
2663
  if (typeof steps[step].prevText === "string") {
@@ -2664,7 +2667,7 @@ const Modal = (props) => {
2664
2667
  }
2665
2668
  }
2666
2669
  return text;
2667
- }, [wizard]);
2670
+ }, [t, wizard]);
2668
2671
  const stepsRef = useRef([]);
2669
2672
  if (wizard && typeof wizard === "object" && !wizard.destroyOtherStep && wizard.steps[wizard.step]) {
2670
2673
  stepsRef.current[wizard.step] = wizard.steps[wizard.step].render;
@@ -2781,6 +2784,9 @@ const Pagination = props => {
2781
2784
  selectorVisible = true
2782
2785
  } = props;
2783
2786
  const sizeRef = useRef(size);
2787
+ const {
2788
+ t
2789
+ } = useTranslation();
2784
2790
  useEffect(() => {
2785
2791
  if (sizeRef.current === size) return;
2786
2792
  sizeRef.current = size;
@@ -2795,18 +2801,18 @@ const Pagination = props => {
2795
2801
  const lastRange2 = value + size;
2796
2802
  return {
2797
2803
  value: i + 1,
2798
- text: parrotI18n.t("components.pagination_range", {
2804
+ text: t("components.pagination_range", {
2799
2805
  range1: value + 1,
2800
2806
  range2: lastRange2 > count ? count : lastRange2
2801
2807
  })
2802
2808
  };
2803
2809
  });
2804
- }, [selectorVisible, count, size]);
2810
+ }, [selectorVisible, count, size, t]);
2805
2811
  let lastRange = current * size;
2806
2812
  lastRange = lastRange > count ? count : lastRange;
2807
2813
  const renderLeft = () => {
2808
2814
  if (!showTotal) return null;
2809
- const content = parrotI18n.t("components.pagination_total", {
2815
+ const content = t("components.pagination_total", {
2810
2816
  range1: (current - 1) * size + 1,
2811
2817
  range2: lastRange,
2812
2818
  total: count
@@ -2816,7 +2822,7 @@ const Pagination = props => {
2816
2822
  placement: "topLeft",
2817
2823
  overlayClassName: DropdownOverlayStyle,
2818
2824
  overlay: /* @__PURE__ */React.createElement(Menu, null, /* @__PURE__ */React.createElement(Menu.ItemGroup, {
2819
- title: parrotI18n.t("components.push_to")
2825
+ title: t("components.push_to")
2820
2826
  }, selectOptions.map(option => /* @__PURE__ */React.createElement(Menu.Item, {
2821
2827
  key: option.value,
2822
2828
  onClick: () => onChange(option.value)
@@ -2851,7 +2857,7 @@ const Pagination = props => {
2851
2857
  onClick: () => {
2852
2858
  onChange == null ? void 0 : onChange(current - 1);
2853
2859
  }
2854
- }, parrotI18n.t("components.previous_items", {
2860
+ }, t("components.previous_items", {
2855
2861
  size
2856
2862
  })), current * size < count && /* @__PURE__ */React.createElement(Button, {
2857
2863
  className: "next-btn",
@@ -2864,7 +2870,7 @@ const Pagination = props => {
2864
2870
  onClick: () => {
2865
2871
  onChange == null ? void 0 : onChange(current + 1);
2866
2872
  }
2867
- }, parrotI18n.t("components.next_items", {
2873
+ }, t("components.next_items", {
2868
2874
  size
2869
2875
  }))));
2870
2876
  };
@@ -3075,11 +3081,12 @@ const Second = ({
3075
3081
  unitClassName,
3076
3082
  abbreviate
3077
3083
  }) => {
3084
+ const { t } = useTranslation();
3078
3085
  if (isEmpty(rawValue)) {
3079
3086
  return Empty;
3080
3087
  }
3081
3088
  const { value, unit } = formatSeconds(rawValue, decimals);
3082
- return /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: cx("value", valueClassName) }, value, " "), /* @__PURE__ */ React.createElement("span", { className: cx("unit", unitClassName) }, parrotI18n.t(`common.${abbreviate ? `${unit}_abbreviation` : unit}`)));
3089
+ return /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: cx("value", valueClassName) }, value, " "), /* @__PURE__ */ React.createElement("span", { className: cx("unit", unitClassName) }, t(`common.${abbreviate ? `${unit}_abbreviation` : unit}`)));
3083
3090
  };
3084
3091
 
3085
3092
  const inputStyle = "igz4le8";
@@ -3091,6 +3098,9 @@ const SimplePagination = props => {
3091
3098
  size,
3092
3099
  onPageChange
3093
3100
  } = props;
3101
+ const {
3102
+ t
3103
+ } = useTranslation();
3094
3104
  const pageLength = Math.ceil(count / size);
3095
3105
  const showPrev = current > 1;
3096
3106
  const showNext = current * size < count;
@@ -3106,7 +3116,7 @@ const SimplePagination = props => {
3106
3116
  className: cs(PaginationStyle, "pagination-wrapper", className)
3107
3117
  }, /* @__PURE__ */React.createElement("span", {
3108
3118
  className: Typo.Label.l3_regular_title
3109
- }, parrotI18n.t("components.pagination_lots_total", {
3119
+ }, t("components.pagination_lots_total", {
3110
3120
  total: count
3111
3121
  })), /* @__PURE__ */React.createElement("span", {
3112
3122
  className: "pagination-right"
@@ -3540,6 +3550,7 @@ const AddRowButton = (props) => {
3540
3550
  updateData,
3541
3551
  data
3542
3552
  } = props;
3553
+ const { t } = useTranslation();
3543
3554
  const _a = buttonProps || {}, {
3544
3555
  disabled: disabledFromProp,
3545
3556
  onClick
@@ -3580,7 +3591,7 @@ const AddRowButton = (props) => {
3580
3591
  },
3581
3592
  disabled
3582
3593
  }),
3583
- CustomizedButtonText || parrotI18n.t("components.add")
3594
+ CustomizedButtonText || t("components.add")
3584
3595
  ), typeof maximum === "number" ? /* @__PURE__ */ React.createElement(
3585
3596
  "span",
3586
3597
  {
@@ -3590,7 +3601,7 @@ const AddRowButton = (props) => {
3590
3601
  disabled && "disabled"
3591
3602
  )
3592
3603
  },
3593
- parrotI18n.t("components.maximum_row_count_desc", {
3604
+ t("components.maximum_row_count_desc", {
3594
3605
  count: maximum
3595
3606
  })
3596
3607
  ) : null);
@@ -3599,6 +3610,7 @@ const AddRowButton = (props) => {
3599
3610
  const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3600
3611
  const [suffix, setSuffix] = useState("");
3601
3612
  const [prefix, setPrefix] = useState("");
3613
+ const { t } = useTranslation();
3602
3614
  const onPrefixChange = useCallback(
3603
3615
  (e) => {
3604
3616
  const newPrefix = e.target.value;
@@ -3619,7 +3631,7 @@ const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3619
3631
  Input$1,
3620
3632
  {
3621
3633
  value: prefix,
3622
- placeholder: parrotI18n.t("components.prefix"),
3634
+ placeholder: t("components.prefix"),
3623
3635
  size: "small",
3624
3636
  onChange: onPrefixChange,
3625
3637
  onBlur
@@ -3628,7 +3640,7 @@ const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3628
3640
  Input$1,
3629
3641
  {
3630
3642
  value: suffix,
3631
- placeholder: parrotI18n.t("components.suffix"),
3643
+ placeholder: t("components.suffix"),
3632
3644
  size: "small",
3633
3645
  onChange: onSuffixChange,
3634
3646
  onBlur
@@ -3636,6 +3648,15 @@ const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3636
3648
  ) : void 0);
3637
3649
  };
3638
3650
 
3651
+ const CheckboxColumnHeaderCell = ({ onChange }) => {
3652
+ const _onChange = useCallback(
3653
+ (e) => {
3654
+ onChange(e.target.checked, true);
3655
+ },
3656
+ [onChange]
3657
+ );
3658
+ return /* @__PURE__ */ React.createElement(Checkbox$1, { onChange: _onChange });
3659
+ };
3639
3660
  const CheckboxColumnBodyCell = ({ data, column, index, onChange }) => {
3640
3661
  const value = data[index][column.key] === void 0 ? column.defaultValue : data[index][column.key];
3641
3662
  const _onChange = useCallback(
@@ -3773,11 +3794,7 @@ const TextColumnHeaderCell = ({
3773
3794
  column.subTitle
3774
3795
  );
3775
3796
  };
3776
- const TextColumnBodyCell = ({
3777
- data,
3778
- column,
3779
- index
3780
- }) => {
3797
+ const TextColumnBodyCell = ({ data, column, index }) => {
3781
3798
  const text = column.displayText || data[index][column.key];
3782
3799
  const CellDescription = useMemo(() => {
3783
3800
  var _a, _b;
@@ -3806,7 +3823,7 @@ const ColumnHeaderImpls = {
3806
3823
  input: InputColumnHeaderCell,
3807
3824
  password: InputColumnHeaderCell,
3808
3825
  affix: AffixColumnHeaderCell,
3809
- checkbox: TextColumnHeaderCell
3826
+ checkbox: CheckboxColumnHeaderCell
3810
3827
  };
3811
3828
  const ColumnBodyImpls = {
3812
3829
  text: TextColumnBodyCell,
@@ -3826,10 +3843,17 @@ const FormItem = props => {
3826
3843
  return /* @__PURE__ */React.createElement(Form.Item, {
3827
3844
  className: FormItemStyle,
3828
3845
  validateStatus,
3829
- help: validateStatus ? message : ""
3846
+ help: validateStatus && message ? message : void 0
3830
3847
  }, children);
3831
3848
  };
3832
3849
 
3850
+ var ValidateTriggerType = /* @__PURE__ */ ((ValidateTriggerType2) => {
3851
+ ValidateTriggerType2[ValidateTriggerType2["Normal"] = 0] = "Normal";
3852
+ ValidateTriggerType2[ValidateTriggerType2["Aggressive"] = 1] = "Aggressive";
3853
+ ValidateTriggerType2[ValidateTriggerType2["Lazy"] = 2] = "Lazy";
3854
+ return ValidateTriggerType2;
3855
+ })(ValidateTriggerType || {});
3856
+
3833
3857
  var __defProp$5 = Object.defineProperty;
3834
3858
  var __defProps$5 = Object.defineProperties;
3835
3859
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
@@ -3852,40 +3876,77 @@ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
3852
3876
  const TableFormBodyCell = (props) => {
3853
3877
  const {
3854
3878
  column,
3855
- disabled,
3856
3879
  index: rowIndex,
3857
3880
  data,
3858
- onChange,
3859
3881
  latestData,
3882
+ validateTriggerType,
3860
3883
  isRowError,
3861
- onBlur
3884
+ getRowValidateResult,
3885
+ disabled,
3886
+ onChange,
3887
+ onBlur,
3888
+ validateAll
3862
3889
  } = props;
3890
+ const [validateResult, setValidateResult] = useState();
3891
+ const isTouched = useRef(false);
3863
3892
  const width = typeof column.width === "number" ? column.width + "px" : column.width;
3864
- const _onChange = useCallback(
3865
- (value, data2) => {
3866
- const newData = data2.map(
3867
- (row, i) => i === rowIndex ? __spreadProps$5(__spreadValues$5({}, row), { [column.key]: value }) : row
3868
- );
3869
- onChange == null ? void 0 : onChange(newData, rowIndex, column.key);
3893
+ const triggerValidate = useCallback(
3894
+ (currentValue) => {
3895
+ var _a;
3896
+ const value = currentValue || data[rowIndex][column.key];
3897
+ const rowData = __spreadProps$5(__spreadValues$5({}, data[rowIndex]), { [column.key]: value });
3898
+ const rowValidateRes = getRowValidateResult(rowData);
3899
+ if (rowValidateRes) {
3900
+ return;
3901
+ }
3902
+ const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
3903
+ value,
3904
+ rowIndex,
3905
+ rowData: data[rowIndex]
3906
+ });
3907
+ const isError = result ? typeof result === "string" : false;
3908
+ setValidateResult({ msg: result || "", isError });
3870
3909
  },
3871
- [rowIndex, onChange, column]
3910
+ [data, column, rowIndex, getRowValidateResult]
3872
3911
  );
3912
+ useEffect(() => {
3913
+ if (validateAll) {
3914
+ isTouched.current = true;
3915
+ triggerValidate();
3916
+ }
3917
+ }, [validateAll, triggerValidate]);
3918
+ const _onChange = (value, data2) => {
3919
+ const newData = data2.map(
3920
+ (row, i) => i === rowIndex ? __spreadProps$5(__spreadValues$5({}, row), { [column.key]: value }) : row
3921
+ );
3922
+ onChange == null ? void 0 : onChange(newData, rowIndex, column.key);
3923
+ if (validateTriggerType === ValidateTriggerType.Normal && isTouched.current || validateTriggerType === ValidateTriggerType.Aggressive) {
3924
+ triggerValidate(value);
3925
+ }
3926
+ };
3873
3927
  const _onBlur = useCallback(() => {
3928
+ isTouched.current = true;
3929
+ triggerValidate();
3874
3930
  onBlur == null ? void 0 : onBlur(data, rowIndex, column.key);
3875
- }, [rowIndex, column, onBlur, data]);
3931
+ }, [rowIndex, column, onBlur, data, triggerValidate]);
3876
3932
  const renderDefaultComponent = () => {
3877
3933
  if (!column.type)
3878
3934
  return null;
3879
3935
  const CellComponent = ColumnBodyImpls[column.type];
3880
3936
  return /* @__PURE__ */ React.createElement(
3881
3937
  CellComponent,
3882
- __spreadProps$5(__spreadValues$5({}, props), {
3883
- customData: column.customData,
3938
+ {
3939
+ disabled,
3940
+ data,
3941
+ index: rowIndex,
3942
+ latestData,
3943
+ column,
3944
+ visible: props.visible,
3884
3945
  onChange: (val) => {
3885
3946
  _onChange(val, data);
3886
3947
  },
3887
3948
  onBlur: _onBlur
3888
- })
3949
+ }
3889
3950
  );
3890
3951
  };
3891
3952
  const Cell = column.render ? column.render({
@@ -3910,24 +3971,6 @@ const TableFormBodyCell = (props) => {
3910
3971
  })) || null;
3911
3972
  return typeof Result === "string" ? /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l4_regular, "cell-description") }, Result) : Result;
3912
3973
  }, [rowIndex, data, latestData, column]);
3913
- const validateResult = useMemo(() => {
3914
- var _a;
3915
- if (isRowError) {
3916
- return {
3917
- msg: "",
3918
- isError: true
3919
- };
3920
- }
3921
- const value = data[rowIndex][column.key];
3922
- const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
3923
- value,
3924
- rowIndex,
3925
- rowData: data[rowIndex]
3926
- });
3927
- if (typeof result === "string" && result) {
3928
- return { msg: result, isError: true };
3929
- }
3930
- }, [data, column, rowIndex, isRowError]);
3931
3974
  return /* @__PURE__ */ React.createElement(
3932
3975
  "div",
3933
3976
  {
@@ -3941,8 +3984,8 @@ const TableFormBodyCell = (props) => {
3941
3984
  /* @__PURE__ */ React.createElement(
3942
3985
  FormItem,
3943
3986
  {
3944
- validateStatus: (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
3945
- message: (validateResult == null ? void 0 : validateResult.isError) && validateResult.msg ? validateResult.msg : void 0
3987
+ validateStatus: isRowError || (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
3988
+ message: isRowError ? "" : validateResult == null ? void 0 : validateResult.msg
3946
3989
  },
3947
3990
  Cell
3948
3991
  ),
@@ -3976,24 +4019,36 @@ const TableFormRow = (props) => {
3976
4019
  latestData,
3977
4020
  disabled,
3978
4021
  passwordVisible,
3979
- deletable,
4022
+ deleteConfig,
3980
4023
  draggable,
3981
4024
  rowIndex,
3982
4025
  provided,
3983
4026
  snapshot,
4027
+ validateTriggerType = ValidateTriggerType.Normal,
3984
4028
  updateData,
3985
4029
  onBodyBlur,
3986
4030
  renderRowDescription,
3987
- rowValidator
4031
+ rowValidator,
4032
+ validateAll
3988
4033
  } = props;
4034
+ const { t } = useTranslation();
3989
4035
  const rowData = data[rowIndex];
3990
- const deleteRow = (index, data2) => {
3991
- const newData = [...data2];
3992
- newData.splice(index, 1);
3993
- updateData(newData);
3994
- };
3995
- const getRowActions = (index, rowDeletable) => {
3996
- const isRowDeleteDisabled = rowDeletable === false;
4036
+ const [rowError, setRowError] = useState();
4037
+ const deleteRow = useCallback(
4038
+ (index, data2) => {
4039
+ const newData = [...data2];
4040
+ newData.splice(index, 1);
4041
+ updateData(newData);
4042
+ },
4043
+ [updateData]
4044
+ );
4045
+ const RowActions = useMemo(() => {
4046
+ var _a;
4047
+ const isRowDeleteDisabled = (_a = deleteConfig == null ? void 0 : deleteConfig.specifyRowDeleteDisabled) == null ? void 0 : _a.call(
4048
+ deleteConfig,
4049
+ rowIndex,
4050
+ data
4051
+ );
3997
4052
  const DeleteIcon = /* @__PURE__ */ React.createElement(
3998
4053
  Icon,
3999
4054
  {
@@ -4003,20 +4058,21 @@ const TableFormRow = (props) => {
4003
4058
  onClick: () => {
4004
4059
  if (isRowDeleteDisabled)
4005
4060
  return;
4006
- deleteRow(index, data);
4061
+ deleteRow(rowIndex, data);
4007
4062
  }
4008
4063
  }
4009
4064
  );
4010
- const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: parrotI18n.t("components.remove") }, DeleteIcon);
4011
- return deletable ? [FinalRenderIcon] : void 0;
4012
- };
4013
- const RowValidateResult = useMemo(() => {
4014
- const result = rowValidator == null ? void 0 : rowValidator(rowIndex, data[rowIndex]);
4015
- if (typeof result === "string" && result) {
4016
- return /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l4_regular, "row-error-message") }, result);
4017
- }
4018
- return null;
4019
- }, [rowValidator, rowIndex, data]);
4065
+ const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: t("components.remove") }, DeleteIcon);
4066
+ return (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [FinalRenderIcon] : void 0;
4067
+ }, [rowIndex, deleteConfig, data, deleteRow]);
4068
+ const getRowValidateResult = useCallback(
4069
+ (rowData2) => {
4070
+ const result = rowValidator == null ? void 0 : rowValidator(rowIndex, rowData2);
4071
+ setRowError(result);
4072
+ return result;
4073
+ },
4074
+ [rowValidator, rowIndex]
4075
+ );
4020
4076
  const Cells = columns.map((col) => {
4021
4077
  return /* @__PURE__ */ React.createElement(
4022
4078
  TableFormBodyCell,
@@ -4030,7 +4086,10 @@ const TableFormRow = (props) => {
4030
4086
  onChange: updateData,
4031
4087
  onBlur: onBodyBlur,
4032
4088
  visible: passwordVisible,
4033
- isRowError: !!RowValidateResult
4089
+ validateTriggerType,
4090
+ isRowError: !!rowError,
4091
+ getRowValidateResult,
4092
+ validateAll
4034
4093
  }
4035
4094
  );
4036
4095
  });
@@ -4060,11 +4119,11 @@ const TableFormRow = (props) => {
4060
4119
  "eagle-table-form-row",
4061
4120
  (snapshot == null ? void 0 : snapshot.isDragging) && "isDragging"
4062
4121
  ),
4063
- actions: getRowActions(rowIndex, rowData.deletable)
4122
+ actions: RowActions
4064
4123
  },
4065
4124
  DraggableHandle,
4066
4125
  Cells,
4067
- RowValidateResult,
4126
+ rowError ? /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l4_regular, "row-error-message") }, rowError) : null,
4068
4127
  RowDescription
4069
4128
  );
4070
4129
  };
@@ -4132,7 +4191,7 @@ const BatchInputListHeaderCell = (props) => {
4132
4191
  const [errMsg, setErrMsg] = useState();
4133
4192
  const width = Number.isNaN(Number(column.width)) ? column.width : column.width + "px";
4134
4193
  const headerOnChange = useCallback(
4135
- (value) => {
4194
+ (value, shouldUpdateData = false) => {
4136
4195
  var _a;
4137
4196
  const err = (_a = column.validator) == null ? void 0 : _a.call(column, { value, isHeader: true });
4138
4197
  setErrMsg(err || void 0);
@@ -4142,7 +4201,7 @@ const BatchInputListHeaderCell = (props) => {
4142
4201
  [column.key]: shouldAutoIncrease && typeof value === "string" ? increaseLastNumber(value, rowIndex) : value
4143
4202
  });
4144
4203
  });
4145
- onChange == null ? void 0 : onChange(newData, column.key);
4204
+ onChange == null ? void 0 : onChange(newData, column.key, shouldUpdateData);
4146
4205
  },
4147
4206
  [onChange, data, column]
4148
4207
  );
@@ -4178,14 +4237,14 @@ const BatchInputListHeaderCell = (props) => {
4178
4237
  visibility: column.hidden ? "hidden" : "visible"
4179
4238
  }
4180
4239
  },
4181
- /* @__PURE__ */ React.createElement(
4240
+ /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l3_bold_title, TitleStyle) }, column.title),
4241
+ disableBatchFilling ? null : /* @__PURE__ */ React.createElement(
4182
4242
  FormItem,
4183
4243
  {
4184
4244
  validateStatus: typeof errMsg === "string" && errMsg ? "error" : "",
4185
4245
  message: errMsg || void 0
4186
4246
  },
4187
- /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l3_bold_title, TitleStyle) }, column.title),
4188
- disableBatchFilling ? null : renderCell()
4247
+ renderCell()
4189
4248
  )
4190
4249
  );
4191
4250
  };
@@ -4212,16 +4271,18 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
4212
4271
  const DEFAULT_ROW_COUNT = 3;
4213
4272
  const TableForm = React.forwardRef(
4214
4273
  ({
4215
- defaultData,
4274
+ defaultData = [],
4216
4275
  columns,
4217
4276
  disabled,
4218
4277
  rowAddConfig,
4219
- deletable,
4278
+ deleteConfig,
4220
4279
  size = "default",
4221
4280
  className,
4222
4281
  draggable,
4223
4282
  disableBatchFilling = false,
4224
4283
  rowSplitType = "border",
4284
+ validateTriggerType,
4285
+ maxHeight,
4225
4286
  renderRowDescription,
4226
4287
  rowValidator,
4227
4288
  onHeaderChange,
@@ -4229,12 +4290,10 @@ const TableForm = React.forwardRef(
4229
4290
  onBodyChange,
4230
4291
  onBodyBlur
4231
4292
  }, ref) => {
4232
- const treatedDefaultData = useMemo(() => {
4233
- return defaultData || [...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns));
4234
- }, [defaultData, columns]);
4235
- const [data, setData] = useState(treatedDefaultData);
4293
+ const [data, setData] = useState(defaultData);
4236
4294
  const [passwordVisible, setPasswordVisible] = useState(false);
4237
- const [latestData, setLatestData] = useState(treatedDefaultData);
4295
+ const [latestData, setLatestData] = useState(defaultData);
4296
+ const [validateAll, setValidateAll] = useState(false);
4238
4297
  const updateData = useCallback(
4239
4298
  (value, rowIndex, columnKey) => {
4240
4299
  setLatestData(value);
@@ -4243,12 +4302,23 @@ const TableForm = React.forwardRef(
4243
4302
  },
4244
4303
  [onBodyChange]
4245
4304
  );
4305
+ useLayoutEffect(() => {
4306
+ if (defaultData.length === 0) {
4307
+ updateData(
4308
+ [...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns))
4309
+ );
4310
+ }
4311
+ }, []);
4246
4312
  const handleBatchChange = useCallback(
4247
- (newData, columnKey) => {
4313
+ (newData, columnKey, shouldUpdateData) => {
4248
4314
  setLatestData(newData);
4249
4315
  onHeaderChange == null ? void 0 : onHeaderChange(newData, columnKey);
4316
+ if (shouldUpdateData) {
4317
+ setData(newData);
4318
+ onBodyChange == null ? void 0 : onBodyChange(newData, void 0, columnKey);
4319
+ }
4250
4320
  },
4251
- [onHeaderChange]
4321
+ [onHeaderChange, onBodyChange]
4252
4322
  );
4253
4323
  const handleBatchBlur = useCallback(
4254
4324
  (key, error) => {
@@ -4273,6 +4343,9 @@ const TableForm = React.forwardRef(
4273
4343
  () => ({
4274
4344
  setData: (data2) => {
4275
4345
  updateData(data2);
4346
+ },
4347
+ validateWholeFields() {
4348
+ setValidateAll(true);
4276
4349
  }
4277
4350
  }),
4278
4351
  [updateData]
@@ -4293,31 +4366,46 @@ const TableForm = React.forwardRef(
4293
4366
  }
4294
4367
  );
4295
4368
  });
4296
- return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(TableFormWrapper, { className: `table-form row-split-by-${rowSplitType}` }, /* @__PURE__ */ React.createElement(List, { size, className: `size-${size}` }, /* @__PURE__ */ React.createElement(
4297
- List.Item,
4369
+ const tableFormWrapperStyle = useMemo(
4370
+ () => maxHeight ? {
4371
+ maxHeight: typeof maxHeight === "number" ? maxHeight + "px" : maxHeight
4372
+ } : void 0,
4373
+ []
4374
+ );
4375
+ return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(
4376
+ TableFormWrapper,
4298
4377
  {
4299
- className: "eagle-table-form-header",
4300
- actions: deletable ? [/* @__PURE__ */ React.createElement(React.Fragment, null)] : void 0
4378
+ className: `table-form row-split-by-${rowSplitType}`,
4379
+ style: tableFormWrapperStyle
4301
4380
  },
4302
- draggable ? /* @__PURE__ */ React.createElement(DraggableHandleWrapper, null) : null,
4303
- headerCells
4304
- ), /* @__PURE__ */ React.createElement(
4305
- TableFormBodyRows,
4306
- {
4307
- data,
4308
- latestData,
4309
- columns,
4310
- passwordVisible,
4311
- deletable,
4312
- disabled,
4313
- draggable,
4314
- rowSplitType,
4315
- onBodyBlur,
4316
- updateData,
4317
- renderRowDescription,
4318
- rowValidator
4319
- }
4320
- ))), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React.createElement(
4381
+ /* @__PURE__ */ React.createElement(List, { size, className: `size-${size}` }, /* @__PURE__ */ React.createElement(
4382
+ List.Item,
4383
+ {
4384
+ className: "eagle-table-form-header",
4385
+ actions: (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [/* @__PURE__ */ React.createElement(React.Fragment, null)] : void 0
4386
+ },
4387
+ draggable ? /* @__PURE__ */ React.createElement(DraggableHandleWrapper, null) : null,
4388
+ headerCells
4389
+ ), /* @__PURE__ */ React.createElement(
4390
+ TableFormBodyRows,
4391
+ {
4392
+ data,
4393
+ latestData,
4394
+ columns,
4395
+ passwordVisible,
4396
+ deleteConfig,
4397
+ disabled,
4398
+ draggable,
4399
+ rowSplitType,
4400
+ validateTriggerType,
4401
+ onBodyBlur,
4402
+ updateData,
4403
+ renderRowDescription,
4404
+ rowValidator,
4405
+ validateAll
4406
+ }
4407
+ ))
4408
+ ), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React.createElement(
4321
4409
  AddRowButton,
4322
4410
  {
4323
4411
  config: rowAddConfig,
@@ -4371,6 +4459,9 @@ const TimeZoneSelect = props => {
4371
4459
  defaultOptionValue
4372
4460
  } = props;
4373
4461
  const [innerValue, setInnerValue] = useState(value);
4462
+ const {
4463
+ t
4464
+ } = useTranslation();
4374
4465
  const defaultTz = useMemo(() => {
4375
4466
  return allTimeZones.find(tz => tz.value === defaultOptionValue);
4376
4467
  }, [defaultOptionValue]);
@@ -4413,7 +4504,7 @@ const TimeZoneSelect = props => {
4413
4504
  return /* @__PURE__ */React.createElement(Select, {
4414
4505
  className: cx(SelectStyle, className),
4415
4506
  dropdownClassName: DropdownStyle,
4416
- placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || parrotI18n.t("components.time_zone_select_placeholder")),
4507
+ placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || t("components.time_zone_select_placeholder")),
4417
4508
  value: innerValue,
4418
4509
  onChange: _onChange,
4419
4510
  showSearch: true,
@@ -4425,26 +4516,26 @@ const TimeZoneSelect = props => {
4425
4516
  input: {}
4426
4517
  }, defaultTz ? /* @__PURE__ */React.createElement(Select$1.Option, {
4427
4518
  value: DefaultTimeValue,
4428
- label: parrotI18n.t("components.default_time_zone"),
4519
+ label: `${t("components.default_time_zone")} (${getUTCOffsetText(defaultTz.offset)})`,
4429
4520
  className: OptionWrapperStyle
4430
4521
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4431
4522
  key: DefaultTimeValue,
4432
- customLabel: parrotI18n.t("components.default_time_zone"),
4523
+ customLabel: t("components.default_time_zone"),
4433
4524
  timeZone: defaultTz
4434
4525
  })) : void 0, /* @__PURE__ */React.createElement(Select$1.Option, {
4435
4526
  value: BrowserTimeValue,
4436
- label: parrotI18n.t("components.browser_time_zone"),
4527
+ label: `${t("components.browser_time_zone")} (${getUTCOffsetText(browserTz.offset)})`,
4437
4528
  className: OptionWrapperStyle
4438
4529
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4439
4530
  key: BrowserTimeValue,
4440
- customLabel: parrotI18n.t("components.browser_time_zone"),
4531
+ customLabel: t("components.browser_time_zone"),
4441
4532
  timeZone: browserTz
4442
4533
  })), /* @__PURE__ */React.createElement(Select$1.Option, {
4443
4534
  value: "UTC",
4444
4535
  className: OptionWrapperStyle
4445
4536
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4446
4537
  key: "utc",
4447
- customLabel: parrotI18n.t("components.coorddinated_universal_time"),
4538
+ customLabel: t("components.coorddinated_universal_time"),
4448
4539
  timeZone: {
4449
4540
  value: "UTC",
4450
4541
  text: "UTC",
@@ -4453,18 +4544,20 @@ const TimeZoneSelect = props => {
4453
4544
  }
4454
4545
  })), timeZoneOptionGroups);
4455
4546
  };
4547
+ function getUTCOffsetText(offset) {
4548
+ if (offset === 0) {
4549
+ return "UTC";
4550
+ } else if (offset < 0) {
4551
+ return `UTC${offset}:00`;
4552
+ } else {
4553
+ return `UTC+${offset}:00`;
4554
+ }
4555
+ }
4456
4556
  const TimeZoneOption = ({
4457
4557
  timeZone,
4458
4558
  customLabel
4459
4559
  }) => {
4460
- let tagText = "";
4461
- if (timeZone.offset === 0) {
4462
- tagText = "UTC";
4463
- } else if (timeZone.offset < 0) {
4464
- tagText = `UTC${timeZone.offset}:00`;
4465
- } else {
4466
- tagText = `UTC+${timeZone.offset}:00`;
4467
- }
4560
+ let tagText = getUTCOffsetText(timeZone.offset);
4468
4561
  return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
4469
4562
  className: OptionFirstLineStyle
4470
4563
  }, /* @__PURE__ */React.createElement("span", {
@@ -4488,6 +4581,7 @@ function getAntdKit() {
4488
4581
  pagination: Pagination,
4489
4582
  select: Select,
4490
4583
  option: Select$1.Option,
4584
+ selectOptGroup: Select$1.OptGroup,
4491
4585
  table: Table,
4492
4586
  row: Row,
4493
4587
  col: Col,
@@ -4559,7 +4653,8 @@ function getAntdKit() {
4559
4653
  antdMessage: message,
4560
4654
  antdButton: Button$1,
4561
4655
  antdSelect: Select$1,
4562
- antdTooltip: Tooltip$1
4656
+ antdTooltip: Tooltip$1,
4657
+ antdModal: Modal$1
4563
4658
  };
4564
4659
  kit.option.isSelectOption = true;
4565
4660
  kit.button.__ANT_BUTTON = true;
@@ -4593,6 +4688,9 @@ const FailedLoad = props => {
4593
4688
  title,
4594
4689
  refetchText
4595
4690
  } = props;
4691
+ const {
4692
+ t
4693
+ } = useTranslation();
4596
4694
  return /* @__PURE__ */React.createElement("div", {
4597
4695
  className: cs(FailedLoadStyle, className),
4598
4696
  title
@@ -4601,7 +4699,7 @@ const FailedLoad = props => {
4601
4699
  }, String(error)), /* @__PURE__ */React.createElement(Button, {
4602
4700
  type: "ordinary",
4603
4701
  onClick: () => refetch()
4604
- }, refetchText || parrotI18n.t("common.retry")));
4702
+ }, refetchText || t("common.retry")));
4605
4703
  };
4606
4704
 
4607
4705
  function getRangeTimestamp(dateRange) {
@@ -4704,7 +4802,7 @@ var __spreadValues = (a, b) => {
4704
4802
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4705
4803
  const kitContext = createContext(antdKit);
4706
4804
  const UIKitProvider = (props) => {
4707
- const { children, kit = antdKit, message } = props;
4805
+ const { children, kit = antdKit, message, antdConfig } = props;
4708
4806
  const _kit = useMemo(() => {
4709
4807
  if ((message == null ? void 0 : message.batch) != null) {
4710
4808
  return __spreadProps(__spreadValues({}, kit), {
@@ -4713,10 +4811,10 @@ const UIKitProvider = (props) => {
4713
4811
  }
4714
4812
  return kit;
4715
4813
  }, [kit, message == null ? void 0 : message.batch]);
4716
- return /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, children);
4814
+ return /* @__PURE__ */ React.createElement(I18nextProvider, { i18n: parrotI18n }, /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues({ autoInsertSpaceInButton: false }, antdConfig), children)));
4717
4815
  };
4718
4816
  const useUIKit = () => {
4719
4817
  return useContext(kitContext);
4720
4818
  };
4721
4819
 
4722
- export { Architecture, Button, ButtonStyle, EntityAsyncStatus, FailedLoad, Icon, InputTagItem, KitStoreProvider, ModalActions, ModalStack, TaskStatus, Typo, UIKitProvider, UIKitStore, UserSource, antdKit, closeModal, createBatchMessageMethods, kitContext, popModal, pushModal, tableStyleCover, tickFormatter, useElementsSize, useKitDispatch, useKitSelector, useUIKit };
4820
+ export { Architecture, Button, ButtonStyle, EntityAsyncStatus, FailedLoad, FullView, Icon, InputTagItem, KitStoreProvider, ModalActions, ModalStack, TaskStatus, Typo, UIKitProvider, UIKitStore, UserSource, ValidateTriggerType, WizardBody, antdKit, closeModal, createBatchMessageMethods, kitContext, popModal, pushModal, tableStyleCover, tickFormatter, useElementsSize, useKitDispatch, useKitSelector, useUIKit };