@cloudtower/eagle 0.34.2 → 0.34.4

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 (33) hide show
  1. package/dist/cjs/core/ImmersiveDialog/index.js +33 -11
  2. package/dist/cjs/core/MediumDialog/MediumDialog.js +6 -3
  3. package/dist/cjs/core/SmallDialog/SmallDialog.js +30 -10
  4. package/dist/cjs/core/SmallDialog/SmallDialog.style.js +6 -0
  5. package/dist/cjs/core/SmallDialog/SmallDialog.widget.js +28 -0
  6. package/dist/cjs/core/TableForm/AddRowButton.js +9 -2
  7. package/dist/cjs/index.js +3 -0
  8. package/dist/cjs/stats1.html +1 -1
  9. package/dist/components.css +1853 -1794
  10. package/dist/esm/core/ImmersiveDialog/index.js +32 -11
  11. package/dist/esm/core/MediumDialog/MediumDialog.js +6 -3
  12. package/dist/esm/core/SmallDialog/SmallDialog.js +30 -10
  13. package/dist/esm/core/SmallDialog/SmallDialog.style.js +4 -1
  14. package/dist/esm/core/SmallDialog/SmallDialog.widget.js +20 -0
  15. package/dist/esm/core/TableForm/AddRowButton.js +9 -2
  16. package/dist/esm/index.js +1 -1
  17. package/dist/esm/stats1.html +1 -1
  18. package/dist/linaria.merged.scss +2386 -2314
  19. package/dist/src/core/ImmersiveDialog/type.d.ts +4 -0
  20. package/dist/src/core/MediumDialog/MediumDialog.d.ts +2 -2
  21. package/dist/src/core/MediumDialog/MediumDialog.type.d.ts +5 -0
  22. package/dist/src/core/SmallDialog/SmallDialog.style.d.ts +3 -0
  23. package/dist/src/core/SmallDialog/SmallDialog.type.d.ts +8 -0
  24. package/dist/src/core/SmallDialog/SmallDialog.widget.d.ts +8 -0
  25. package/dist/src/core/TableForm/types.d.ts +1 -0
  26. package/dist/stories/docs/core/ImmersiveDialog.stories.d.ts +6 -0
  27. package/dist/stories/docs/core/MediumDialog.stories.d.ts +8 -0
  28. package/dist/stories/docs/core/SmallDialog.stories.d.ts +4 -0
  29. package/dist/stories/docs/core/TableForm.stories.d.ts +3 -0
  30. package/dist/stories/docs/core/WizardDialog.stories.d.ts +3 -0
  31. package/dist/stories/utils.d.ts +12 -0
  32. package/dist/style.css +1853 -1794
  33. package/package.json +4 -4
@@ -7,7 +7,9 @@ import Icon from '../Icon/index.js';
7
7
  import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
8
8
  import useParrotTranslation from '../../hooks/useParrotTranslation.js';
9
9
  import { Modal } from 'antd';
10
+ import cs from 'classnames';
10
11
  import React__default, { useMemo } from 'react';
12
+ import { ModelTitleSkeleton, ModelContentSkeleton, ModelInitializingError } from '../SmallDialog/SmallDialog.widget.js';
11
13
  import { FooterStyle, FooterButtonStyle, ErrorStyle, ErrorIconStyle, ErrorTextStyle, FooterButtonRightStyle, TitleStyle, ImmersiveDialogStyle, FullContentStyle, MultiAreaStyle, CloseIconStyle, BodyStyle, MultiAreaBodyStyle, CancelButtonStyle } from './styles.js';
12
14
 
13
15
  var __defProp = Object.defineProperty;
@@ -61,7 +63,9 @@ function ImmersiveDialog(props) {
61
63
  visible = true,
62
64
  isContentFull,
63
65
  onCancel,
64
- onOk
66
+ onOk,
67
+ initializing,
68
+ initializingError
65
69
  } = _a, restProps = __objRest(_a, [
66
70
  "className",
67
71
  "title",
@@ -84,15 +88,27 @@ function ImmersiveDialog(props) {
84
88
  "visible",
85
89
  "isContentFull",
86
90
  "onCancel",
87
- "onOk"
91
+ "onOk",
92
+ "initializing",
93
+ "initializingError"
88
94
  ]);
89
95
  const { t } = useParrotTranslation();
90
96
  const popModal = usePopModal();
97
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
98
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
99
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
100
+ const _cancelText = useMemo(() => {
101
+ let text = cancelText || defaultCancelText;
102
+ return text;
103
+ }, [cancelText, defaultCancelText]);
91
104
  const _confirmText = useMemo(() => {
92
- let text = okText || t("common.confirm");
105
+ let text = okText || defaultOkText;
93
106
  return text;
94
- }, [okText, t]);
107
+ }, [okText, defaultOkText]);
95
108
  const finalFooter = useMemo(() => {
109
+ if (initializing) {
110
+ return null;
111
+ }
96
112
  return footer || /* @__PURE__ */ React__default.createElement("div", { className: FooterStyle }, /* @__PURE__ */ React__default.createElement("div", { className: FooterButtonStyle }, footerLeftAction, error && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: cx(ErrorStyle, Typo.Label.l2_regular) }, /* @__PURE__ */ React__default.createElement(
97
113
  ExclamationErrorCircleFill16RedIcon,
98
114
  {
@@ -109,6 +125,7 @@ function ImmersiveDialog(props) {
109
125
  )))), /* @__PURE__ */ React__default.createElement("div", { className: FooterButtonRightStyle }, showCancel ? /* @__PURE__ */ React__default.createElement(
110
126
  Button,
111
127
  __spreadValues({
128
+ size: "large",
112
129
  type: "quiet",
113
130
  className: CancelButtonStyle,
114
131
  onMouseDown: (e) => {
@@ -119,10 +136,11 @@ function ImmersiveDialog(props) {
119
136
  onCancel == null ? void 0 : onCancel(e);
120
137
  }
121
138
  }, cancelButtonProps),
122
- cancelText || t("common.cancel")
139
+ /* @__PURE__ */ React__default.createElement("span", { className: Typo.Label.l1_bold_title }, _cancelText)
123
140
  ) : null, showOk ? /* @__PURE__ */ React__default.createElement(
124
141
  Button,
125
142
  __spreadValues({
143
+ size: "large",
126
144
  onClick: (e) => {
127
145
  onOk == null ? void 0 : onOk(e);
128
146
  },
@@ -135,7 +153,7 @@ function ImmersiveDialog(props) {
135
153
  footerLeftAction,
136
154
  _confirmText,
137
155
  cancelButtonProps,
138
- cancelText,
156
+ _cancelText,
139
157
  error,
140
158
  footer,
141
159
  okButtonProps,
@@ -145,17 +163,20 @@ function ImmersiveDialog(props) {
145
163
  popModal,
146
164
  showCancel,
147
165
  showOk,
148
- t
166
+ initializing
149
167
  ]);
150
168
  return /* @__PURE__ */ React__default.createElement(
151
169
  Modal,
152
170
  __spreadValues({
153
171
  width: "calc(100% - 20px)",
154
- title: /* @__PURE__ */ React__default.createElement("span", { className: cx(Typo.Display.d1_bold_title, TitleStyle) }, title),
155
- className: cx(
172
+ title: initializing ? /* @__PURE__ */ React__default.createElement(ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.createElement("span", { className: cx(Typo.Display.d1_bold_title, TitleStyle) }, title || defaultTitle),
173
+ className: cs(
156
174
  ImmersiveDialogStyle,
157
175
  isContentFull ? FullContentStyle : MultiAreaStyle,
158
- className
176
+ className,
177
+ {
178
+ "initializing-error": initializingError
179
+ }
159
180
  ),
160
181
  closeIcon: closeIcon != null ? closeIcon : /* @__PURE__ */ React__default.createElement(
161
182
  Icon,
@@ -175,7 +196,7 @@ function ImmersiveDialog(props) {
175
196
  visible,
176
197
  destroyOnClose: true
177
198
  }, restProps),
178
- /* @__PURE__ */ React__default.createElement("div", { className: cx(BodyStyle, isContentFull ? "" : MultiAreaBodyStyle) }, isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("right", rightClassName) }, right))
199
+ /* @__PURE__ */ React__default.createElement("div", { className: cx(BodyStyle, isContentFull ? "" : MultiAreaBodyStyle) }, initializing || initializingError ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, initializing ? /* @__PURE__ */ React__default.createElement(ModelContentSkeleton, { num: 4 }) : /* @__PURE__ */ React__default.createElement(ModelInitializingError, { error: initializingError }))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.createElement("div", { className: cx("right", rightClassName) }, right)))
179
200
  );
180
201
  }
181
202
 
@@ -32,16 +32,19 @@ const MediumDialogStyle = "E_m5foqp8";
32
32
  const MediumDialog = _a => {
33
33
  var _b = _a,
34
34
  {
35
- className
35
+ className,
36
+ isContentFull = false
36
37
  } = _b,
37
- restProps = __objRest(_b, ["className"]);
38
+ restProps = __objRest(_b, ["className", "isContentFull"]);
38
39
  return /* @__PURE__ */React__default.createElement(SmallDialog, __spreadValues({
39
40
  TitleRender: ({
40
41
  title
41
42
  }) => /* @__PURE__ */React__default.createElement("span", {
42
43
  className: Typo.Display.d1s_bold_title
43
44
  }, title),
44
- className: cx(MediumDialogStyle, className)
45
+ className: cx(MediumDialogStyle, isContentFull && "content-full", className),
46
+ initializingSkeletonRows: 3,
47
+ width: isContentFull ? "calc(100vw - 160px)" : 720
45
48
  }, restProps));
46
49
  };
47
50
 
@@ -7,6 +7,8 @@ import cs from 'classnames';
7
7
  import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
8
8
  import { Show } from '../../coreX/Show/index.js';
9
9
  import { FooterStyle, ErrorTextStyle, DialogStyle, CloseIconStyle } from './SmallDialog.style.js';
10
+ import { ModelTitleSkeleton, ModelContentSkeleton, ModelInitializingError } from './SmallDialog.widget.js';
11
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
10
12
  import Icon from '../Icon/index.js';
11
13
  import Button from '../Button/index.js';
12
14
  import { Flex } from 'antd5';
@@ -34,10 +36,11 @@ const DefaultTitleRender = ({
34
36
  return /* @__PURE__ */ React__default.createElement("span", { className: cs(Typo.Display.d2_bold_title) }, title);
35
37
  };
36
38
  const SmallDialog = ({
39
+ width = 492,
37
40
  title,
38
41
  TitleRender,
39
- cancelText = "\u5173\u95ED",
40
- okText = "\u786E\u5B9A",
42
+ cancelText,
43
+ okText,
41
44
  showOk = true,
42
45
  onOk,
43
46
  onCancel,
@@ -50,8 +53,12 @@ const SmallDialog = ({
50
53
  children,
51
54
  showFooterErrorIcon = true,
52
55
  error,
53
- confirmLoading
56
+ confirmLoading,
57
+ initializing,
58
+ initializingError,
59
+ initializingSkeletonRows
54
60
  }) => {
61
+ const { t } = useParrotTranslation();
55
62
  const popModal = usePopModal();
56
63
  const handleClose = () => {
57
64
  if (onCancel) {
@@ -68,12 +75,16 @@ const SmallDialog = ({
68
75
  }
69
76
  };
70
77
  const CustomTitleRender = TitleRender || DefaultTitleRender;
78
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
79
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
80
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
71
81
  return /* @__PURE__ */ React__default.createElement(
72
82
  Modal,
73
83
  {
74
84
  visible: true,
75
- title: /* @__PURE__ */ React__default.createElement(CustomTitleRender, { title }),
76
- footer: /* @__PURE__ */ React__default.createElement(
85
+ width,
86
+ title: initializing ? /* @__PURE__ */ React__default.createElement(ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.createElement(CustomTitleRender, { title: title || defaultTitle }),
87
+ footer: initializing ? null : /* @__PURE__ */ React__default.createElement(
77
88
  "div",
78
89
  {
79
90
  className: cs(FooterStyle, footerClassName, {
@@ -95,7 +106,14 @@ const SmallDialog = ({
95
106
  iconWidth: 16
96
107
  }
97
108
  )),
98
- /* @__PURE__ */ React__default.createElement(OverflowTooltip, { multiLines: 3, content: error, tooltip: error })
109
+ /* @__PURE__ */ React__default.createElement(
110
+ OverflowTooltip,
111
+ {
112
+ multiLines: 3,
113
+ content: error,
114
+ tooltip: error
115
+ }
116
+ )
99
117
  )),
100
118
  /* @__PURE__ */ React__default.createElement(Flex, null, /* @__PURE__ */ React__default.createElement(
101
119
  Button,
@@ -104,7 +122,7 @@ const SmallDialog = ({
104
122
  onClick: handleClose,
105
123
  className: Typo.Label.l2_bold_title
106
124
  }, cancelButtonProps),
107
- cancelText
125
+ cancelText || defaultCancelText
108
126
  ), showOk && /* @__PURE__ */ React__default.createElement(
109
127
  Button,
110
128
  __spreadValues({
@@ -112,13 +130,15 @@ const SmallDialog = ({
112
130
  onClick: handleOk,
113
131
  loading: confirmLoading
114
132
  }, okButtonProps),
115
- okText
133
+ okText || defaultOkText
116
134
  ))
117
135
  ),
118
136
  onCancel: handleClose,
119
137
  closable,
120
138
  maskClosable,
121
- className: cx(DialogStyle, className),
139
+ className: cs(DialogStyle, className, {
140
+ "initializing-error": initializingError
141
+ }),
122
142
  closeIcon: /* @__PURE__ */ React__default.createElement(
123
143
  Icon,
124
144
  {
@@ -130,7 +150,7 @@ const SmallDialog = ({
130
150
  }
131
151
  )
132
152
  },
133
- children
153
+ initializing ? /* @__PURE__ */ React__default.createElement(ModelContentSkeleton, { num: initializingSkeletonRows }) : initializingError ? /* @__PURE__ */ React__default.createElement(ModelInitializingError, { error: initializingError }) : children
134
154
  );
135
155
  };
136
156
 
@@ -2,5 +2,8 @@ const DialogStyle = "E_dxyv8bv";
2
2
  const FooterStyle = "E_fbgo4wr";
3
3
  const ErrorTextStyle = "E_ekxnz54";
4
4
  const CloseIconStyle = "E_ct1041x";
5
+ const ModelTitleSkeletonStyle = "E_m1k84ymw";
6
+ const ModelContentSkeletonStyle = "E_m15ds5xe";
7
+ const ModelInitializingErrorStyle = "E_ma56n19";
5
8
 
6
- export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle };
9
+ export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle, ModelTitleSkeletonStyle };
@@ -0,0 +1,20 @@
1
+ import { cx } from '@linaria/core';
2
+ import React__default from 'react';
3
+ import { ModelTitleSkeletonStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle } from './SmallDialog.style.js';
4
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
5
+ import Skeleton from '../Skeleton/index.js';
6
+ import { Space } from 'antd';
7
+ import { Typo } from '../Typo/index.js';
8
+
9
+ const ModelTitleSkeleton = () => {
10
+ return /* @__PURE__ */ React__default.createElement("div", { className: cx(ModelTitleSkeletonStyle, "initializing-title") }, /* @__PURE__ */ React__default.createElement(Skeleton.Content, null));
11
+ };
12
+ const ModelContentSkeleton = ({ num = 2 }) => {
13
+ return /* @__PURE__ */ React__default.createElement(Space, { direction: "vertical", size: 16, className: ModelContentSkeletonStyle }, Array.from({ length: num }).map((_, index) => /* @__PURE__ */ React__default.createElement("div", { key: index, className: "skeleton-wrapper" }, /* @__PURE__ */ React__default.createElement(Skeleton.Content, null))));
14
+ };
15
+ const ModelInitializingError = ({ error }) => {
16
+ const { t } = useParrotTranslation();
17
+ return /* @__PURE__ */ React__default.createElement("div", { className: ModelInitializingErrorStyle }, /* @__PURE__ */ React__default.createElement("p", { className: Typo.Display.d3_bold_title }, t("components.initializing_failed")), /* @__PURE__ */ React__default.createElement("div", { className: Typo.Label.l3_regular }, error));
18
+ };
19
+
20
+ export { ModelContentSkeleton, ModelInitializingError, ModelTitleSkeleton };
@@ -40,7 +40,14 @@ var __objRest = (source, exclude) => {
40
40
  };
41
41
  const AddRowButton = (props) => {
42
42
  const {
43
- config: { maximum, className, CustomizedButton, buttonProps, text },
43
+ config: {
44
+ maximum,
45
+ className,
46
+ CustomizedButton,
47
+ buttonProps,
48
+ text,
49
+ extraAction
50
+ },
44
51
  columns,
45
52
  addData,
46
53
  data
@@ -87,7 +94,7 @@ const AddRowButton = (props) => {
87
94
  disabled
88
95
  }),
89
96
  CustomizedButtonText || t("components.add")
90
- ), typeof maximum === "number" ? /* @__PURE__ */ React__default.createElement(
97
+ ), extraAction, typeof maximum === "number" ? /* @__PURE__ */ React__default.createElement(
91
98
  "span",
92
99
  {
93
100
  className: cx(
package/dist/esm/index.js CHANGED
@@ -113,7 +113,7 @@ export { SidebarMenu } from './core/SidebarMenu/SidebarMenu.js';
113
113
  export { default as Skeleton } from './core/Skeleton/index.js';
114
114
  export { default as SkeletonContent } from './core/Skeleton/Content.js';
115
115
  export { SmallDialog } from './core/SmallDialog/SmallDialog.js';
116
- export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle } from './core/SmallDialog/SmallDialog.style.js';
116
+ export { CloseIconStyle, DialogStyle, ErrorTextStyle, FooterStyle, ModelContentSkeletonStyle, ModelInitializingErrorStyle, ModelTitleSkeletonStyle } from './core/SmallDialog/SmallDialog.style.js';
117
117
  export { CircleProgress } from './core/StepProgress/index.js';
118
118
  export { CannotOperationInfo, CommonContent, ContentWrapper, Desc, Description, Divider, Dot, ErrorSpan, ExpandArrow, FieldTitle, FormField, FormItemDiv, FormSectionTitle, FormWrapper, FullView, HorizontalWizardModalCompactStyle, HorizontalWizardModalLooseStyle, InfoAlert, InputStyle, KitInputStyle, LeftEndInputStyle, LeftEndSelectStyle, LightDesc, LoadingWrapper, ModalBody, ModalWrapper, NameTag, NormalAlert, NoticeAlert, OperationWraper, RadioDesc, RightEndInputStyle, RightEndSelectStyle, SelectOptionDisabledText, TagSpan, TertiaryText, UnitStyle, WarningAlert, WizardBody, radioStyle } from './core/Styled/index.js';
119
119
  export { useTableBodyHasScrollBar } from './core/Table/common.js';