@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
@@ -9,11 +9,14 @@ var index$4 = require('../Icon/index.js');
9
9
  var index$2 = require('../../coreX/OverflowTooltip/index.js');
10
10
  var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
11
11
  var antd = require('antd');
12
+ var cs = require('classnames');
12
13
  var React = require('react');
14
+ var SmallDialog_widget = require('../SmallDialog/SmallDialog.widget.js');
13
15
  var styles = require('./styles.js');
14
16
 
15
17
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
18
 
19
+ var cs__default = /*#__PURE__*/_interopDefault(cs);
17
20
  var React__default = /*#__PURE__*/_interopDefault(React);
18
21
 
19
22
  var __defProp = Object.defineProperty;
@@ -67,7 +70,9 @@ function ImmersiveDialog(props) {
67
70
  visible = true,
68
71
  isContentFull,
69
72
  onCancel,
70
- onOk
73
+ onOk,
74
+ initializing,
75
+ initializingError
71
76
  } = _a, restProps = __objRest(_a, [
72
77
  "className",
73
78
  "title",
@@ -90,15 +95,27 @@ function ImmersiveDialog(props) {
90
95
  "visible",
91
96
  "isContentFull",
92
97
  "onCancel",
93
- "onOk"
98
+ "onOk",
99
+ "initializing",
100
+ "initializingError"
94
101
  ]);
95
102
  const { t } = useParrotTranslation();
96
103
  const popModal = index.usePopModal();
104
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
105
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
106
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
107
+ const _cancelText = React.useMemo(() => {
108
+ let text = cancelText || defaultCancelText;
109
+ return text;
110
+ }, [cancelText, defaultCancelText]);
97
111
  const _confirmText = React.useMemo(() => {
98
- let text = okText || t("common.confirm");
112
+ let text = okText || defaultOkText;
99
113
  return text;
100
- }, [okText, t]);
114
+ }, [okText, defaultOkText]);
101
115
  const finalFooter = React.useMemo(() => {
116
+ if (initializing) {
117
+ return null;
118
+ }
102
119
  return footer || /* @__PURE__ */ React__default.default.createElement("div", { className: styles.FooterStyle }, /* @__PURE__ */ React__default.default.createElement("div", { className: styles.FooterButtonStyle }, footerLeftAction, error && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("span", { className: core.cx(styles.ErrorStyle, index$1.Typo.Label.l2_regular) }, /* @__PURE__ */ React__default.default.createElement(
103
120
  iconsReact.ExclamationErrorCircleFill16RedIcon,
104
121
  {
@@ -115,6 +132,7 @@ function ImmersiveDialog(props) {
115
132
  )))), /* @__PURE__ */ React__default.default.createElement("div", { className: styles.FooterButtonRightStyle }, showCancel ? /* @__PURE__ */ React__default.default.createElement(
116
133
  index$3,
117
134
  __spreadValues({
135
+ size: "large",
118
136
  type: "quiet",
119
137
  className: styles.CancelButtonStyle,
120
138
  onMouseDown: (e) => {
@@ -125,10 +143,11 @@ function ImmersiveDialog(props) {
125
143
  onCancel == null ? void 0 : onCancel(e);
126
144
  }
127
145
  }, cancelButtonProps),
128
- cancelText || t("common.cancel")
146
+ /* @__PURE__ */ React__default.default.createElement("span", { className: index$1.Typo.Label.l1_bold_title }, _cancelText)
129
147
  ) : null, showOk ? /* @__PURE__ */ React__default.default.createElement(
130
148
  index$3,
131
149
  __spreadValues({
150
+ size: "large",
132
151
  onClick: (e) => {
133
152
  onOk == null ? void 0 : onOk(e);
134
153
  },
@@ -141,7 +160,7 @@ function ImmersiveDialog(props) {
141
160
  footerLeftAction,
142
161
  _confirmText,
143
162
  cancelButtonProps,
144
- cancelText,
163
+ _cancelText,
145
164
  error,
146
165
  footer,
147
166
  okButtonProps,
@@ -151,17 +170,20 @@ function ImmersiveDialog(props) {
151
170
  popModal,
152
171
  showCancel,
153
172
  showOk,
154
- t
173
+ initializing
155
174
  ]);
156
175
  return /* @__PURE__ */ React__default.default.createElement(
157
176
  antd.Modal,
158
177
  __spreadValues({
159
178
  width: "calc(100% - 20px)",
160
- title: /* @__PURE__ */ React__default.default.createElement("span", { className: core.cx(index$1.Typo.Display.d1_bold_title, styles.TitleStyle) }, title),
161
- className: core.cx(
179
+ title: initializing ? /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.default.createElement("span", { className: core.cx(index$1.Typo.Display.d1_bold_title, styles.TitleStyle) }, title || defaultTitle),
180
+ className: cs__default.default(
162
181
  styles.ImmersiveDialogStyle,
163
182
  isContentFull ? styles.FullContentStyle : styles.MultiAreaStyle,
164
- className
183
+ className,
184
+ {
185
+ "initializing-error": initializingError
186
+ }
165
187
  ),
166
188
  closeIcon: closeIcon != null ? closeIcon : /* @__PURE__ */ React__default.default.createElement(
167
189
  index$4,
@@ -181,7 +203,7 @@ function ImmersiveDialog(props) {
181
203
  visible,
182
204
  destroyOnClose: true
183
205
  }, restProps),
184
- /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(styles.BodyStyle, isContentFull ? "" : styles.MultiAreaBodyStyle) }, isContentFull ? null : /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx("right", rightClassName) }, right))
206
+ /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(styles.BodyStyle, isContentFull ? "" : styles.MultiAreaBodyStyle) }, initializing || initializingError ? /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("div", { className: "middle" }, initializing ? /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelContentSkeleton, { num: 4 }) : /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelInitializingError, { error: initializingError }))) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, isContentFull ? null : /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx("left", leftClassName) }, left), /* @__PURE__ */ React__default.default.createElement("div", { className: "middle" }, children), isContentFull ? null : /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx("right", rightClassName) }, right)))
185
207
  );
186
208
  }
187
209
 
@@ -38,16 +38,19 @@ const MediumDialogStyle = "E_m5foqp8";
38
38
  const MediumDialog = _a => {
39
39
  var _b = _a,
40
40
  {
41
- className
41
+ className,
42
+ isContentFull = false
42
43
  } = _b,
43
- restProps = __objRest(_b, ["className"]);
44
+ restProps = __objRest(_b, ["className", "isContentFull"]);
44
45
  return /* @__PURE__ */React__default.default.createElement(SmallDialog.SmallDialog, __spreadValues({
45
46
  TitleRender: ({
46
47
  title
47
48
  }) => /* @__PURE__ */React__default.default.createElement("span", {
48
49
  className: index.Typo.Display.d1s_bold_title
49
50
  }, title),
50
- className: core.cx(MediumDialogStyle, className)
51
+ className: core.cx(MediumDialogStyle, isContentFull && "content-full", className),
52
+ initializingSkeletonRows: 3,
53
+ width: isContentFull ? "calc(100vw - 160px)" : 720
51
54
  }, restProps));
52
55
  };
53
56
 
@@ -9,6 +9,8 @@ var cs = require('classnames');
9
9
  var index$4 = require('../../coreX/OverflowTooltip/index.js');
10
10
  var index$1 = require('../../coreX/Show/index.js');
11
11
  var SmallDialog_style = require('./SmallDialog.style.js');
12
+ var SmallDialog_widget = require('./SmallDialog.widget.js');
13
+ var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
12
14
  var index$3 = require('../Icon/index.js');
13
15
  var index$5 = require('../Button/index.js');
14
16
  var antd5 = require('antd5');
@@ -41,10 +43,11 @@ const DefaultTitleRender = ({
41
43
  return /* @__PURE__ */ React__default.default.createElement("span", { className: cs__default.default(index$2.Typo.Display.d2_bold_title) }, title);
42
44
  };
43
45
  const SmallDialog = ({
46
+ width = 492,
44
47
  title,
45
48
  TitleRender,
46
- cancelText = "\u5173\u95ED",
47
- okText = "\u786E\u5B9A",
49
+ cancelText,
50
+ okText,
48
51
  showOk = true,
49
52
  onOk,
50
53
  onCancel,
@@ -57,8 +60,12 @@ const SmallDialog = ({
57
60
  children,
58
61
  showFooterErrorIcon = true,
59
62
  error,
60
- confirmLoading
63
+ confirmLoading,
64
+ initializing,
65
+ initializingError,
66
+ initializingSkeletonRows
61
67
  }) => {
68
+ const { t } = useParrotTranslation();
62
69
  const popModal = index.usePopModal();
63
70
  const handleClose = () => {
64
71
  if (onCancel) {
@@ -75,12 +82,16 @@ const SmallDialog = ({
75
82
  }
76
83
  };
77
84
  const CustomTitleRender = TitleRender || DefaultTitleRender;
85
+ const defaultTitle = initializingError ? t("common.load_failed") : "";
86
+ const defaultCancelText = showOk ? t("common.cancel") : t("common.close");
87
+ const defaultOkText = initializingError ? t("common.retry") : t("common.confirm");
78
88
  return /* @__PURE__ */ React__default.default.createElement(
79
89
  antd.Modal,
80
90
  {
81
91
  visible: true,
82
- title: /* @__PURE__ */ React__default.default.createElement(CustomTitleRender, { title }),
83
- footer: /* @__PURE__ */ React__default.default.createElement(
92
+ width,
93
+ title: initializing ? /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelTitleSkeleton, null) : /* @__PURE__ */ React__default.default.createElement(CustomTitleRender, { title: title || defaultTitle }),
94
+ footer: initializing ? null : /* @__PURE__ */ React__default.default.createElement(
84
95
  "div",
85
96
  {
86
97
  className: cs__default.default(SmallDialog_style.FooterStyle, footerClassName, {
@@ -102,7 +113,14 @@ const SmallDialog = ({
102
113
  iconWidth: 16
103
114
  }
104
115
  )),
105
- /* @__PURE__ */ React__default.default.createElement(index$4, { multiLines: 3, content: error, tooltip: error })
116
+ /* @__PURE__ */ React__default.default.createElement(
117
+ index$4,
118
+ {
119
+ multiLines: 3,
120
+ content: error,
121
+ tooltip: error
122
+ }
123
+ )
106
124
  )),
107
125
  /* @__PURE__ */ React__default.default.createElement(antd5.Flex, null, /* @__PURE__ */ React__default.default.createElement(
108
126
  index$5,
@@ -111,7 +129,7 @@ const SmallDialog = ({
111
129
  onClick: handleClose,
112
130
  className: index$2.Typo.Label.l2_bold_title
113
131
  }, cancelButtonProps),
114
- cancelText
132
+ cancelText || defaultCancelText
115
133
  ), showOk && /* @__PURE__ */ React__default.default.createElement(
116
134
  index$5,
117
135
  __spreadValues({
@@ -119,13 +137,15 @@ const SmallDialog = ({
119
137
  onClick: handleOk,
120
138
  loading: confirmLoading
121
139
  }, okButtonProps),
122
- okText
140
+ okText || defaultOkText
123
141
  ))
124
142
  ),
125
143
  onCancel: handleClose,
126
144
  closable,
127
145
  maskClosable,
128
- className: core.cx(SmallDialog_style.DialogStyle, className),
146
+ className: cs__default.default(SmallDialog_style.DialogStyle, className, {
147
+ "initializing-error": initializingError
148
+ }),
129
149
  closeIcon: /* @__PURE__ */ React__default.default.createElement(
130
150
  index$3,
131
151
  {
@@ -137,7 +157,7 @@ const SmallDialog = ({
137
157
  }
138
158
  )
139
159
  },
140
- children
160
+ initializing ? /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelContentSkeleton, { num: initializingSkeletonRows }) : initializingError ? /* @__PURE__ */ React__default.default.createElement(SmallDialog_widget.ModelInitializingError, { error: initializingError }) : children
141
161
  );
142
162
  };
143
163
 
@@ -4,8 +4,14 @@ const DialogStyle = "E_dxyv8bv";
4
4
  const FooterStyle = "E_fbgo4wr";
5
5
  const ErrorTextStyle = "E_ekxnz54";
6
6
  const CloseIconStyle = "E_ct1041x";
7
+ const ModelTitleSkeletonStyle = "E_m1k84ymw";
8
+ const ModelContentSkeletonStyle = "E_m15ds5xe";
9
+ const ModelInitializingErrorStyle = "E_ma56n19";
7
10
 
8
11
  exports.CloseIconStyle = CloseIconStyle;
9
12
  exports.DialogStyle = DialogStyle;
10
13
  exports.ErrorTextStyle = ErrorTextStyle;
11
14
  exports.FooterStyle = FooterStyle;
15
+ exports.ModelContentSkeletonStyle = ModelContentSkeletonStyle;
16
+ exports.ModelInitializingErrorStyle = ModelInitializingErrorStyle;
17
+ exports.ModelTitleSkeletonStyle = ModelTitleSkeletonStyle;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var core = require('@linaria/core');
4
+ var React = require('react');
5
+ var SmallDialog_style = require('./SmallDialog.style.js');
6
+ var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
7
+ var index = require('../Skeleton/index.js');
8
+ var antd = require('antd');
9
+ var index$1 = require('../Typo/index.js');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+
15
+ const ModelTitleSkeleton = () => {
16
+ return /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(SmallDialog_style.ModelTitleSkeletonStyle, "initializing-title") }, /* @__PURE__ */ React__default.default.createElement(index.default.Content, null));
17
+ };
18
+ const ModelContentSkeleton = ({ num = 2 }) => {
19
+ return /* @__PURE__ */ React__default.default.createElement(antd.Space, { direction: "vertical", size: 16, className: SmallDialog_style.ModelContentSkeletonStyle }, Array.from({ length: num }).map((_, index$1) => /* @__PURE__ */ React__default.default.createElement("div", { key: index$1, className: "skeleton-wrapper" }, /* @__PURE__ */ React__default.default.createElement(index.default.Content, null))));
20
+ };
21
+ const ModelInitializingError = ({ error }) => {
22
+ const { t } = useParrotTranslation();
23
+ return /* @__PURE__ */ React__default.default.createElement("div", { className: SmallDialog_style.ModelInitializingErrorStyle }, /* @__PURE__ */ React__default.default.createElement("p", { className: index$1.Typo.Display.d3_bold_title }, t("components.initializing_failed")), /* @__PURE__ */ React__default.default.createElement("div", { className: index$1.Typo.Label.l3_regular }, error));
24
+ };
25
+
26
+ exports.ModelContentSkeleton = ModelContentSkeleton;
27
+ exports.ModelInitializingError = ModelInitializingError;
28
+ exports.ModelTitleSkeleton = ModelTitleSkeleton;
@@ -46,7 +46,14 @@ var __objRest = (source, exclude) => {
46
46
  };
47
47
  const AddRowButton = (props) => {
48
48
  const {
49
- config: { maximum, className, CustomizedButton, buttonProps, text },
49
+ config: {
50
+ maximum,
51
+ className,
52
+ CustomizedButton,
53
+ buttonProps,
54
+ text,
55
+ extraAction
56
+ },
50
57
  columns,
51
58
  addData,
52
59
  data
@@ -93,7 +100,7 @@ const AddRowButton = (props) => {
93
100
  disabled
94
101
  }),
95
102
  CustomizedButtonText || t("components.add")
96
- ), typeof maximum === "number" ? /* @__PURE__ */ React__default.default.createElement(
103
+ ), extraAction, typeof maximum === "number" ? /* @__PURE__ */ React__default.default.createElement(
97
104
  "span",
98
105
  {
99
106
  className: core.cx(
package/dist/cjs/index.js CHANGED
@@ -516,6 +516,9 @@ exports.CloseIconStyle = SmallDialog_style.CloseIconStyle;
516
516
  exports.DialogStyle = SmallDialog_style.DialogStyle;
517
517
  exports.ErrorTextStyle = SmallDialog_style.ErrorTextStyle;
518
518
  exports.FooterStyle = SmallDialog_style.FooterStyle;
519
+ exports.ModelContentSkeletonStyle = SmallDialog_style.ModelContentSkeletonStyle;
520
+ exports.ModelInitializingErrorStyle = SmallDialog_style.ModelInitializingErrorStyle;
521
+ exports.ModelTitleSkeletonStyle = SmallDialog_style.ModelTitleSkeletonStyle;
519
522
  exports.CircleProgress = index$1i.CircleProgress;
520
523
  exports.CannotOperationInfo = index$1j.CannotOperationInfo;
521
524
  exports.CommonContent = index$1j.CommonContent;