@cloudtower/eagle 0.23.0 → 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/umd/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('antd'), require('react'), require('classnames'), require('lodash'), require('@cloudtower/parrot'), require('@linaria/core'), require('@linaria/react'), require('moment'), require('react-dom'), require('react-is'), require('@ant-design/icons'), require('redux'), require('react-redux'), require('@cloudtower/icons-react'), require('react-beautiful-dnd'), require('timezones.json'), require('react-i18next'), require('dayjs'), require('recharts')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'antd', 'react', 'classnames', 'lodash', '@cloudtower/parrot', '@linaria/core', '@linaria/react', 'moment', 'react-dom', 'react-is', '@ant-design/icons', 'redux', 'react-redux', '@cloudtower/icons-react', 'react-beautiful-dnd', 'timezones.json', 'react-i18next', 'dayjs', 'recharts'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.index = {}, global.antd, global.React, global.cs, global._, global.parrot, global.core, global.react, global.moment, global.reactDom, global.reactIs, global.icons, global.redux, global.reactRedux, global.iconsReact, global.reactBeautifulDnd, global.TimeZones, global.reactI18next, global.dayjs));
5
- })(this, (function (exports, antd, React, cs, _, parrot, core, react, moment, reactDom, reactIs, icons, redux, reactRedux, iconsReact, reactBeautifulDnd, TimeZones, reactI18next, dayjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('antd'), require('react'), require('classnames'), require('lodash'), require('react-i18next'), require('@linaria/core'), require('@linaria/react'), require('moment'), require('react-dom'), require('react-is'), require('@ant-design/icons'), require('redux'), require('react-redux'), require('@cloudtower/icons-react'), require('react-beautiful-dnd'), require('timezones.json'), require('@cloudtower/parrot'), require('dayjs'), require('recharts')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'antd', 'react', 'classnames', 'lodash', 'react-i18next', '@linaria/core', '@linaria/react', 'moment', 'react-dom', 'react-is', '@ant-design/icons', 'redux', 'react-redux', '@cloudtower/icons-react', 'react-beautiful-dnd', 'timezones.json', '@cloudtower/parrot', 'dayjs', 'recharts'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.index = {}, global.antd, global.React, global.cs, global._, global.reactI18next, global.core, global.react, global.moment, global.reactDom, global.reactIs, global.icons, global.redux, global.reactRedux, global.iconsReact, global.reactBeautifulDnd, global.TimeZones, global.parrot, global.dayjs));
5
+ })(this, (function (exports, antd, React, cs, _, reactI18next, core, react, moment, reactDom, reactIs, icons, redux, reactRedux, iconsReact, reactBeautifulDnd, TimeZones, parrot, dayjs) { 'use strict';
6
6
 
7
7
  const MAGIC_METRIC_NULL = -2;
8
8
  function formatBits(bits, decimals = 2) {
@@ -461,10 +461,11 @@
461
461
  };
462
462
 
463
463
  const Arch = (props) => {
464
+ const { t } = reactI18next.useTranslation();
464
465
  const { architecture } = props;
465
466
  let text = "";
466
467
  if (architecture) {
467
- text = parrot.parrotI18n.t(`components.Architecture_${architecture}`);
468
+ text = t(`components.Architecture_${architecture}`);
468
469
  }
469
470
  return /* @__PURE__ */ React.createElement("span", null, text);
470
471
  };
@@ -959,11 +960,12 @@
959
960
  valueClassName,
960
961
  unitClassName
961
962
  }) => {
963
+ const { t } = reactI18next.useTranslation();
962
964
  if (isEmpty(rawValue)) {
963
965
  return Empty;
964
966
  }
965
967
  if (rawValue === -1) {
966
- return /* @__PURE__ */ React.createElement("span", null, parrot.parrotI18n.t("common.calculation"));
968
+ return /* @__PURE__ */ React.createElement("span", null, t("common.calculation"));
967
969
  }
968
970
  const { value, unit } = formatBytes(rawValue, decimals);
969
971
  if (noUnitOnZero && value === 0) {
@@ -2581,10 +2583,11 @@
2581
2583
  };
2582
2584
  const Modal = (props) => {
2583
2585
  var _b;
2586
+ const { t } = reactI18next.useTranslation();
2584
2587
  const _a = props, {
2585
2588
  error,
2586
- okText = parrot.parrotI18n.t("common.confirm"),
2587
- cancelText = parrot.parrotI18n.t("common.cancel"),
2589
+ okText = t("common.confirm"),
2590
+ cancelText = t("common.cancel"),
2588
2591
  confirmLoading,
2589
2592
  okButtonProps,
2590
2593
  onOk,
@@ -2633,12 +2636,12 @@
2633
2636
  let text = (okButtonProps == null ? void 0 : okButtonProps.children) || okText;
2634
2637
  if (wizard && typeof wizard === "object" && wizard.steps[wizard.step]) {
2635
2638
  const { step, steps } = wizard;
2636
- text = step < steps.length - 1 ? steps[step].okText || parrot.parrotI18n.t("common.next_step") : steps[step].okText || text;
2639
+ text = step < steps.length - 1 ? steps[step].okText || t("common.next_step") : steps[step].okText || text;
2637
2640
  }
2638
2641
  return text;
2639
- }, [okButtonProps, okText, wizard]);
2642
+ }, [okButtonProps == null ? void 0 : okButtonProps.children, okText, t, wizard]);
2640
2643
  const prevText = React.useMemo(() => {
2641
- let text = /* @__PURE__ */ React.createElement("span", null, "< ", parrot.parrotI18n.t("common.prev_step"));
2644
+ let text = /* @__PURE__ */ React.createElement("span", null, "< ", t("common.prev_step"));
2642
2645
  if (wizard && typeof wizard === "object" && wizard.steps[wizard.step]) {
2643
2646
  const { step, steps } = wizard;
2644
2647
  if (typeof steps[step].prevText === "string") {
@@ -2648,7 +2651,7 @@
2648
2651
  }
2649
2652
  }
2650
2653
  return text;
2651
- }, [wizard]);
2654
+ }, [t, wizard]);
2652
2655
  const stepsRef = React.useRef([]);
2653
2656
  if (wizard && typeof wizard === "object" && !wizard.destroyOtherStep && wizard.steps[wizard.step]) {
2654
2657
  stepsRef.current[wizard.step] = wizard.steps[wizard.step].render;
@@ -2765,6 +2768,9 @@
2765
2768
  selectorVisible = true
2766
2769
  } = props;
2767
2770
  const sizeRef = React.useRef(size);
2771
+ const {
2772
+ t
2773
+ } = reactI18next.useTranslation();
2768
2774
  React.useEffect(() => {
2769
2775
  if (sizeRef.current === size) return;
2770
2776
  sizeRef.current = size;
@@ -2779,18 +2785,18 @@
2779
2785
  const lastRange2 = value + size;
2780
2786
  return {
2781
2787
  value: i + 1,
2782
- text: parrot.parrotI18n.t("components.pagination_range", {
2788
+ text: t("components.pagination_range", {
2783
2789
  range1: value + 1,
2784
2790
  range2: lastRange2 > count ? count : lastRange2
2785
2791
  })
2786
2792
  };
2787
2793
  });
2788
- }, [selectorVisible, count, size]);
2794
+ }, [selectorVisible, count, size, t]);
2789
2795
  let lastRange = current * size;
2790
2796
  lastRange = lastRange > count ? count : lastRange;
2791
2797
  const renderLeft = () => {
2792
2798
  if (!showTotal) return null;
2793
- const content = parrot.parrotI18n.t("components.pagination_total", {
2799
+ const content = t("components.pagination_total", {
2794
2800
  range1: (current - 1) * size + 1,
2795
2801
  range2: lastRange,
2796
2802
  total: count
@@ -2800,7 +2806,7 @@
2800
2806
  placement: "topLeft",
2801
2807
  overlayClassName: DropdownOverlayStyle,
2802
2808
  overlay: /* @__PURE__ */React.createElement(antd.Menu, null, /* @__PURE__ */React.createElement(antd.Menu.ItemGroup, {
2803
- title: parrot.parrotI18n.t("components.push_to")
2809
+ title: t("components.push_to")
2804
2810
  }, selectOptions.map(option => /* @__PURE__ */React.createElement(antd.Menu.Item, {
2805
2811
  key: option.value,
2806
2812
  onClick: () => onChange(option.value)
@@ -2835,7 +2841,7 @@
2835
2841
  onClick: () => {
2836
2842
  onChange == null ? void 0 : onChange(current - 1);
2837
2843
  }
2838
- }, parrot.parrotI18n.t("components.previous_items", {
2844
+ }, t("components.previous_items", {
2839
2845
  size
2840
2846
  })), current * size < count && /* @__PURE__ */React.createElement(Button, {
2841
2847
  className: "next-btn",
@@ -2848,7 +2854,7 @@
2848
2854
  onClick: () => {
2849
2855
  onChange == null ? void 0 : onChange(current + 1);
2850
2856
  }
2851
- }, parrot.parrotI18n.t("components.next_items", {
2857
+ }, t("components.next_items", {
2852
2858
  size
2853
2859
  }))));
2854
2860
  };
@@ -3059,11 +3065,12 @@
3059
3065
  unitClassName,
3060
3066
  abbreviate
3061
3067
  }) => {
3068
+ const { t } = reactI18next.useTranslation();
3062
3069
  if (isEmpty(rawValue)) {
3063
3070
  return Empty;
3064
3071
  }
3065
3072
  const { value, unit } = formatSeconds(rawValue, decimals);
3066
- return /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: core.cx("value", valueClassName) }, value, " "), /* @__PURE__ */ React.createElement("span", { className: core.cx("unit", unitClassName) }, parrot.parrotI18n.t(`common.${abbreviate ? `${unit}_abbreviation` : unit}`)));
3073
+ return /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: core.cx("value", valueClassName) }, value, " "), /* @__PURE__ */ React.createElement("span", { className: core.cx("unit", unitClassName) }, t(`common.${abbreviate ? `${unit}_abbreviation` : unit}`)));
3067
3074
  };
3068
3075
 
3069
3076
  const inputStyle = "igz4le8";
@@ -3075,6 +3082,9 @@
3075
3082
  size,
3076
3083
  onPageChange
3077
3084
  } = props;
3085
+ const {
3086
+ t
3087
+ } = reactI18next.useTranslation();
3078
3088
  const pageLength = Math.ceil(count / size);
3079
3089
  const showPrev = current > 1;
3080
3090
  const showNext = current * size < count;
@@ -3090,7 +3100,7 @@
3090
3100
  className: cs(PaginationStyle, "pagination-wrapper", className)
3091
3101
  }, /* @__PURE__ */React.createElement("span", {
3092
3102
  className: Typo.Label.l3_regular_title
3093
- }, parrot.parrotI18n.t("components.pagination_lots_total", {
3103
+ }, t("components.pagination_lots_total", {
3094
3104
  total: count
3095
3105
  })), /* @__PURE__ */React.createElement("span", {
3096
3106
  className: "pagination-right"
@@ -3524,6 +3534,7 @@
3524
3534
  updateData,
3525
3535
  data
3526
3536
  } = props;
3537
+ const { t } = reactI18next.useTranslation();
3527
3538
  const _a = buttonProps || {}, {
3528
3539
  disabled: disabledFromProp,
3529
3540
  onClick
@@ -3564,7 +3575,7 @@
3564
3575
  },
3565
3576
  disabled
3566
3577
  }),
3567
- CustomizedButtonText || parrot.parrotI18n.t("components.add")
3578
+ CustomizedButtonText || t("components.add")
3568
3579
  ), typeof maximum === "number" ? /* @__PURE__ */ React.createElement(
3569
3580
  "span",
3570
3581
  {
@@ -3574,7 +3585,7 @@
3574
3585
  disabled && "disabled"
3575
3586
  )
3576
3587
  },
3577
- parrot.parrotI18n.t("components.maximum_row_count_desc", {
3588
+ t("components.maximum_row_count_desc", {
3578
3589
  count: maximum
3579
3590
  })
3580
3591
  ) : null);
@@ -3583,6 +3594,7 @@
3583
3594
  const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
3584
3595
  const [suffix, setSuffix] = React.useState("");
3585
3596
  const [prefix, setPrefix] = React.useState("");
3597
+ const { t } = reactI18next.useTranslation();
3586
3598
  const onPrefixChange = React.useCallback(
3587
3599
  (e) => {
3588
3600
  const newPrefix = e.target.value;
@@ -3603,7 +3615,7 @@
3603
3615
  antd.Input,
3604
3616
  {
3605
3617
  value: prefix,
3606
- placeholder: parrot.parrotI18n.t("components.prefix"),
3618
+ placeholder: t("components.prefix"),
3607
3619
  size: "small",
3608
3620
  onChange: onPrefixChange,
3609
3621
  onBlur
@@ -3612,7 +3624,7 @@
3612
3624
  antd.Input,
3613
3625
  {
3614
3626
  value: suffix,
3615
- placeholder: parrot.parrotI18n.t("components.suffix"),
3627
+ placeholder: t("components.suffix"),
3616
3628
  size: "small",
3617
3629
  onChange: onSuffixChange,
3618
3630
  onBlur
@@ -4003,6 +4015,7 @@
4003
4015
  rowValidator,
4004
4016
  validateAll
4005
4017
  } = props;
4018
+ const { t } = reactI18next.useTranslation();
4006
4019
  const rowData = data[rowIndex];
4007
4020
  const [rowError, setRowError] = React.useState();
4008
4021
  const deleteRow = React.useCallback(
@@ -4033,7 +4046,7 @@
4033
4046
  }
4034
4047
  }
4035
4048
  );
4036
- const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: parrot.parrotI18n.t("components.remove") }, DeleteIcon);
4049
+ const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: t("components.remove") }, DeleteIcon);
4037
4050
  return (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [FinalRenderIcon] : void 0;
4038
4051
  }, [rowIndex, deleteConfig, data, deleteRow]);
4039
4052
  const getRowValidateResult = React.useCallback(
@@ -4430,6 +4443,9 @@
4430
4443
  defaultOptionValue
4431
4444
  } = props;
4432
4445
  const [innerValue, setInnerValue] = React.useState(value);
4446
+ const {
4447
+ t
4448
+ } = reactI18next.useTranslation();
4433
4449
  const defaultTz = React.useMemo(() => {
4434
4450
  return allTimeZones.find(tz => tz.value === defaultOptionValue);
4435
4451
  }, [defaultOptionValue]);
@@ -4472,7 +4488,7 @@
4472
4488
  return /* @__PURE__ */React.createElement(Select, {
4473
4489
  className: core.cx(SelectStyle, className),
4474
4490
  dropdownClassName: DropdownStyle,
4475
- placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || parrot.parrotI18n.t("components.time_zone_select_placeholder")),
4491
+ placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || t("components.time_zone_select_placeholder")),
4476
4492
  value: innerValue,
4477
4493
  onChange: _onChange,
4478
4494
  showSearch: true,
@@ -4484,26 +4500,26 @@
4484
4500
  input: {}
4485
4501
  }, defaultTz ? /* @__PURE__ */React.createElement(antd.Select.Option, {
4486
4502
  value: DefaultTimeValue,
4487
- label: `${parrot.parrotI18n.t("components.default_time_zone")} (${getUTCOffsetText(defaultTz.offset)})`,
4503
+ label: `${t("components.default_time_zone")} (${getUTCOffsetText(defaultTz.offset)})`,
4488
4504
  className: OptionWrapperStyle
4489
4505
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4490
4506
  key: DefaultTimeValue,
4491
- customLabel: parrot.parrotI18n.t("components.default_time_zone"),
4507
+ customLabel: t("components.default_time_zone"),
4492
4508
  timeZone: defaultTz
4493
4509
  })) : void 0, /* @__PURE__ */React.createElement(antd.Select.Option, {
4494
4510
  value: BrowserTimeValue,
4495
- label: `${parrot.parrotI18n.t("components.browser_time_zone")} (${getUTCOffsetText(browserTz.offset)})`,
4511
+ label: `${t("components.browser_time_zone")} (${getUTCOffsetText(browserTz.offset)})`,
4496
4512
  className: OptionWrapperStyle
4497
4513
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4498
4514
  key: BrowserTimeValue,
4499
- customLabel: parrot.parrotI18n.t("components.browser_time_zone"),
4515
+ customLabel: t("components.browser_time_zone"),
4500
4516
  timeZone: browserTz
4501
4517
  })), /* @__PURE__ */React.createElement(antd.Select.Option, {
4502
4518
  value: "UTC",
4503
4519
  className: OptionWrapperStyle
4504
4520
  }, /* @__PURE__ */React.createElement(TimeZoneOption, {
4505
4521
  key: "utc",
4506
- customLabel: parrot.parrotI18n.t("components.coorddinated_universal_time"),
4522
+ customLabel: t("components.coorddinated_universal_time"),
4507
4523
  timeZone: {
4508
4524
  value: "UTC",
4509
4525
  text: "UTC",
@@ -4549,6 +4565,7 @@
4549
4565
  pagination: Pagination,
4550
4566
  select: Select,
4551
4567
  option: antd.Select.Option,
4568
+ selectOptGroup: antd.Select.OptGroup,
4552
4569
  table: Table,
4553
4570
  row: antd.Row,
4554
4571
  col: antd.Col,
@@ -4620,7 +4637,8 @@
4620
4637
  antdMessage: antd.message,
4621
4638
  antdButton: antd.Button,
4622
4639
  antdSelect: antd.Select,
4623
- antdTooltip: antd.Tooltip
4640
+ antdTooltip: antd.Tooltip,
4641
+ antdModal: antd.Modal
4624
4642
  };
4625
4643
  kit.option.isSelectOption = true;
4626
4644
  kit.button.__ANT_BUTTON = true;
@@ -4654,6 +4672,9 @@
4654
4672
  title,
4655
4673
  refetchText
4656
4674
  } = props;
4675
+ const {
4676
+ t
4677
+ } = reactI18next.useTranslation();
4657
4678
  return /* @__PURE__ */React.createElement("div", {
4658
4679
  className: cs(FailedLoadStyle, className),
4659
4680
  title
@@ -4662,7 +4683,7 @@
4662
4683
  }, String(error)), /* @__PURE__ */React.createElement(Button, {
4663
4684
  type: "ordinary",
4664
4685
  onClick: () => refetch()
4665
- }, refetchText || parrot.parrotI18n.t("common.retry")));
4686
+ }, refetchText || t("common.retry")));
4666
4687
  };
4667
4688
 
4668
4689
  function getRangeTimestamp(dateRange) {
@@ -4765,7 +4786,7 @@
4765
4786
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4766
4787
  const kitContext = React.createContext(antdKit);
4767
4788
  const UIKitProvider = (props) => {
4768
- const { children, kit = antdKit, message } = props;
4789
+ const { children, kit = antdKit, message, antdConfig } = props;
4769
4790
  const _kit = React.useMemo(() => {
4770
4791
  if ((message == null ? void 0 : message.batch) != null) {
4771
4792
  return __spreadProps(__spreadValues({}, kit), {
@@ -4774,7 +4795,7 @@
4774
4795
  }
4775
4796
  return kit;
4776
4797
  }, [kit, message == null ? void 0 : message.batch]);
4777
- return /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, children);
4798
+ return /* @__PURE__ */ React.createElement(reactI18next.I18nextProvider, { i18n: parrot.parrotI18n }, /* @__PURE__ */ React.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React.createElement(antd.ConfigProvider, __spreadValues({ autoInsertSpaceInButton: false }, antdConfig), children)));
4778
4799
  };
4779
4800
  const useUIKit = () => {
4780
4801
  return React.useContext(kitContext);
@@ -4793,6 +4814,7 @@
4793
4814
  exports.ButtonStyle = ButtonStyle;
4794
4815
  exports.EntityAsyncStatus = EntityAsyncStatus;
4795
4816
  exports.FailedLoad = FailedLoad;
4817
+ exports.FullView = FullView;
4796
4818
  exports.Icon = Icon;
4797
4819
  exports.InputTagItem = InputTagItem;
4798
4820
  exports.KitStoreProvider = KitStoreProvider;
@@ -4804,6 +4826,7 @@
4804
4826
  exports.UIKitStore = UIKitStore;
4805
4827
  exports.UserSource = UserSource;
4806
4828
  exports.ValidateTriggerType = ValidateTriggerType;
4829
+ exports.WizardBody = WizardBody;
4807
4830
  exports.antdKit = antdKit;
4808
4831
  exports.closeModal = closeModal;
4809
4832
  exports.createBatchMessageMethods = createBatchMessageMethods;