@cloudtower/eagle 0.23.3 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ButtonProps } from "src/spec";
2
+ import { ButtonProps } from "../../spec";
3
3
  import { ColumnBodyImpls } from "./Columns";
4
4
  export type ErrorInfo = Record<string, {
5
5
  errorMessage: string;
package/dist/esm/index.js CHANGED
@@ -3,7 +3,9 @@ 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 { useTranslation, withTranslation, I18nextProvider } from 'react-i18next';
6
+ import { parrotI18n } from '@cloudtower/parrot';
7
+ export * from '@cloudtower/parrot';
8
+ import { useTranslation, withTranslation } from 'react-i18next';
7
9
  import { cx } from '@linaria/core';
8
10
  import { styled } from '@linaria/react';
9
11
  import moment from 'moment';
@@ -15,8 +17,6 @@ import { createDispatchHook, createSelectorHook, Provider } from 'react-redux';
15
17
  import { XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon, HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, CheckmarkDoneSuccessCorrect16BlueIcon } from '@cloudtower/icons-react';
16
18
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
17
19
  import TimeZones from 'timezones.json';
18
- import { parrotI18n } from '@cloudtower/parrot';
19
- export * from '@cloudtower/parrot';
20
20
  import dayjs from 'dayjs';
21
21
  import 'recharts';
22
22
 
@@ -152,16 +152,16 @@ function formatPercent(input, decimals = 2) {
152
152
  if (input > 100) {
153
153
  input = 100;
154
154
  }
155
- const value = parseFloat(input.toFixed(decimals));
156
- if (value === 0 && input > 0) {
157
- if (decimals - 1 >= 0) {
155
+ const value = input.toFixed(decimals);
156
+ if (parseFloat(value) === 0 && input > 0) {
157
+ if (decimals >= 1) {
158
158
  return {
159
- value: parseFloat(`0.${"0".repeat(decimals - 1)}1`),
159
+ value: `0.${"0".repeat(decimals - 1)}1`,
160
160
  unit: "%"
161
161
  };
162
162
  }
163
163
  return {
164
- value: 1,
164
+ value: "1",
165
165
  unit: "%"
166
166
  };
167
167
  }
@@ -476,8 +476,14 @@ const Alert = (_a) => {
476
476
  );
477
477
  };
478
478
 
479
+ const useParrotTranslation = () => {
480
+ return useTranslation(void 0, {
481
+ i18n: parrotI18n
482
+ });
483
+ };
484
+
479
485
  const Arch = (props) => {
480
- const { t } = useTranslation();
486
+ const { t } = useParrotTranslation();
481
487
  const { architecture } = props;
482
488
  let text = "";
483
489
  if (architecture) {
@@ -976,7 +982,7 @@ const Byte = ({
976
982
  valueClassName,
977
983
  unitClassName
978
984
  }) => {
979
- const { t } = useTranslation();
985
+ const { t } = useParrotTranslation();
980
986
  if (isEmpty(rawValue)) {
981
987
  return Empty;
982
988
  }
@@ -2599,7 +2605,7 @@ var __objRest$5 = (source, exclude) => {
2599
2605
  };
2600
2606
  const Modal = (props) => {
2601
2607
  var _b;
2602
- const { t } = useTranslation();
2608
+ const { t } = useParrotTranslation();
2603
2609
  const _a = props, {
2604
2610
  error,
2605
2611
  okText = t("common.confirm"),
@@ -2786,7 +2792,7 @@ const Pagination = props => {
2786
2792
  const sizeRef = useRef(size);
2787
2793
  const {
2788
2794
  t
2789
- } = useTranslation();
2795
+ } = useParrotTranslation();
2790
2796
  useEffect(() => {
2791
2797
  if (sizeRef.current === size) return;
2792
2798
  sizeRef.current = size;
@@ -3081,7 +3087,7 @@ const Second = ({
3081
3087
  unitClassName,
3082
3088
  abbreviate
3083
3089
  }) => {
3084
- const { t } = useTranslation();
3090
+ const { t } = useParrotTranslation();
3085
3091
  if (isEmpty(rawValue)) {
3086
3092
  return Empty;
3087
3093
  }
@@ -3100,7 +3106,7 @@ const SimplePagination = props => {
3100
3106
  } = props;
3101
3107
  const {
3102
3108
  t
3103
- } = useTranslation();
3109
+ } = useParrotTranslation();
3104
3110
  const pageLength = Math.ceil(count / size);
3105
3111
  const showPrev = current > 1;
3106
3112
  const showNext = current * size < count;
@@ -3550,7 +3556,7 @@ const AddRowButton = (props) => {
3550
3556
  updateData,
3551
3557
  data
3552
3558
  } = props;
3553
- const { t } = useTranslation();
3559
+ const { t } = useParrotTranslation();
3554
3560
  const _a = buttonProps || {}, {
3555
3561
  disabled: disabledFromProp,
3556
3562
  onClick
@@ -3610,7 +3616,7 @@ const AddRowButton = (props) => {
3610
3616
  const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3611
3617
  const [suffix, setSuffix] = useState("");
3612
3618
  const [prefix, setPrefix] = useState("");
3613
- const { t } = useTranslation();
3619
+ const { t } = useParrotTranslation();
3614
3620
  const onPrefixChange = useCallback(
3615
3621
  (e) => {
3616
3622
  const newPrefix = e.target.value;
@@ -4031,7 +4037,7 @@ const TableFormRow = (props) => {
4031
4037
  rowValidator,
4032
4038
  validateAll
4033
4039
  } = props;
4034
- const { t } = useTranslation();
4040
+ const { t } = useParrotTranslation();
4035
4041
  const rowData = data[rowIndex];
4036
4042
  const [rowError, setRowError] = useState();
4037
4043
  const deleteRow = useCallback(
@@ -4064,7 +4070,7 @@ const TableFormRow = (props) => {
4064
4070
  );
4065
4071
  const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: t("components.remove") }, DeleteIcon);
4066
4072
  return (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [FinalRenderIcon] : void 0;
4067
- }, [rowIndex, deleteConfig, data, deleteRow]);
4073
+ }, [deleteConfig, rowIndex, data, t, deleteRow]);
4068
4074
  const getRowValidateResult = useCallback(
4069
4075
  (rowData2) => {
4070
4076
  const result = rowValidator == null ? void 0 : rowValidator(rowIndex, rowData2);
@@ -4459,7 +4465,7 @@ const TimeZoneSelect = props => {
4459
4465
  const [innerValue, setInnerValue] = useState(value);
4460
4466
  const {
4461
4467
  t
4462
- } = useTranslation();
4468
+ } = useParrotTranslation();
4463
4469
  const _onChange = useCallback(val => {
4464
4470
  setInnerValue(val);
4465
4471
  if (val === BrowserTimeValue) {
@@ -4674,7 +4680,7 @@ const FailedLoad = props => {
4674
4680
  } = props;
4675
4681
  const {
4676
4682
  t
4677
- } = useTranslation();
4683
+ } = useParrotTranslation();
4678
4684
  return /* @__PURE__ */React.createElement("div", {
4679
4685
  className: cs(FailedLoadStyle, className),
4680
4686
  title
@@ -4795,7 +4801,7 @@ const UIKitProvider = (props) => {
4795
4801
  }
4796
4802
  return kit;
4797
4803
  }, [kit, message == null ? void 0 : message.batch]);
4798
- return /* @__PURE__ */ React.createElement(I18nextProvider, { i18n: parrotI18n }, /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues({ autoInsertSpaceInButton: false }, antdConfig), children)));
4804
+ return /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues({ autoInsertSpaceInButton: false }, antdConfig), children));
4799
4805
  };
4800
4806
  const useUIKit = () => {
4801
4807
  return useContext(kitContext);