@cloudtower/eagle 0.33.28 → 0.33.30

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,10 +1,11 @@
1
1
  import { parrotI18n } from '@cloudtower/parrot';
2
- import _message from '../core/message/index.js';
2
+ import _message from '../core/message/message.js';
3
3
  import { antdKit } from '../legacy-antd.js';
4
4
  import { omit } from 'lodash';
5
5
  import React__default, { createContext, useMemo, useEffect, useContext } from 'react';
6
6
  import { ConfigProvider } from '../core/ConfigProvider/index.js';
7
7
  import { createBatchMessageMethods } from '../core/message-group/index.js';
8
+ import { MessageContext } from '../core/message/useMessage.js';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __defProps = Object.defineProperties;
@@ -26,7 +27,6 @@ var __spreadValues = (a, b) => {
26
27
  };
27
28
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
29
  const kitContext = createContext(antdKit);
29
- const MessageContext = createContext(_message);
30
30
  const UIKitProvider = (props) => {
31
31
  const { children, kit = antdKit, message, lng = "en-US", config } = props;
32
32
  const batchMessage = useMemo(() => {
@@ -60,8 +60,5 @@ var UIKitProvider$1 = UIKitProvider;
60
60
  const useUIKit = () => {
61
61
  return useContext(kitContext);
62
62
  };
63
- const useMessage = () => {
64
- return useContext(MessageContext);
65
- };
66
63
 
67
- export { MessageContext, UIKitProvider$1 as default, kitContext, useMessage, useUIKit };
64
+ export { UIKitProvider$1 as default, kitContext, useUIKit };
@@ -1,186 +1,6 @@
1
- import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
2
- import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
3
- import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
4
- import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';
5
- import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
6
- import RCNotification from '@cloudtower/rc-notification';
7
- import cs from 'classnames';
8
- import * as React from 'react';
1
+ import _message from './message.js';
2
+ export { DEFAULT_DURATION, attachTypeApi, getKeyThenIncreaseKey } from './message.js';
9
3
 
10
- var __defProp = Object.defineProperty;
11
- var __defProps = Object.defineProperties;
12
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
- var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
- var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
17
- var __spreadValues = (a, b) => {
18
- for (var prop in b || (b = {}))
19
- if (__hasOwnProp.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop))
24
- __defNormalProp(a, prop, b[prop]);
25
- }
26
- return a;
27
- };
28
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29
- const DEFAULT_DURATION = 3;
30
- let messageInstance;
31
- let defaultDuration = DEFAULT_DURATION;
32
- let defaultTop;
33
- let key = 1;
34
- let localPrefixCls = "ant-message";
35
- let transitionName = "move-up";
36
- let getContainer;
37
- let maxCount;
38
- let rtl = false;
39
- function getKeyThenIncreaseKey() {
40
- return key++;
41
- }
42
- function setMessageConfig(options) {
43
- if (options.top !== void 0) {
44
- defaultTop = options.top;
45
- messageInstance = null;
46
- }
47
- if (options.duration !== void 0) {
48
- defaultDuration = options.duration;
49
- }
50
- if (options.prefixCls !== void 0) {
51
- localPrefixCls = options.prefixCls;
52
- }
53
- if (options.getContainer !== void 0) {
54
- getContainer = options.getContainer;
55
- }
56
- if (options.transitionName !== void 0) {
57
- transitionName = options.transitionName;
58
- messageInstance = null;
59
- }
60
- if (options.maxCount !== void 0) {
61
- maxCount = options.maxCount;
62
- messageInstance = null;
63
- }
64
- if (options.rtl !== void 0) {
65
- rtl = options.rtl;
66
- }
67
- }
68
- function getRCNotificationInstance(args, callback) {
69
- const prefixCls = args.prefixCls || localPrefixCls;
70
- if (messageInstance) {
71
- callback({
72
- prefixCls,
73
- instance: messageInstance
74
- });
75
- return;
76
- }
77
- RCNotification.newInstance(
78
- {
79
- prefixCls,
80
- transitionName,
81
- style: { top: defaultTop },
82
- // 覆盖原来的样式
83
- getContainer,
84
- maxCount
85
- },
86
- (instance) => {
87
- if (messageInstance) {
88
- callback({
89
- prefixCls,
90
- instance: messageInstance
91
- });
92
- return;
93
- }
94
- messageInstance = instance;
95
- callback({
96
- prefixCls,
97
- instance
98
- });
99
- }
100
- );
101
- }
102
- const typeToIcon = {
103
- info: InfoCircleFilled,
104
- success: CheckCircleFilled,
105
- error: CloseCircleFilled,
106
- warning: ExclamationCircleFilled,
107
- loading: LoadingOutlined
108
- };
109
- function getRCNoticeProps(args, prefixCls) {
110
- const duration = args.duration !== void 0 ? args.duration : defaultDuration;
111
- const IconComponent = args.type != null ? typeToIcon[args.type] : void 0;
112
- const messageClass = cs(`${prefixCls}-custom-content`, {
113
- [`${prefixCls}-${args.type}`]: args.type,
114
- [`${prefixCls}-rtl`]: rtl === true
115
- });
116
- return {
117
- key: args.key,
118
- duration,
119
- style: args.style || {},
120
- className: args.className,
121
- content: /* @__PURE__ */ React.createElement("div", { className: messageClass }, args.icon || IconComponent && /* @__PURE__ */ React.createElement(IconComponent, null), /* @__PURE__ */ React.createElement("span", null, args.content)),
122
- onClose: args.onClose
123
- };
124
- }
125
- function notice(args) {
126
- const target = args.key || key++;
127
- const closePromise = new Promise((resolve) => {
128
- const callback = () => {
129
- if (typeof args.onClose === "function") {
130
- args.onClose();
131
- }
132
- return resolve(true);
133
- };
134
- if (document.hidden) {
135
- return;
136
- }
137
- getRCNotificationInstance(args, ({ prefixCls, instance }) => {
138
- instance.notice(
139
- getRCNoticeProps(
140
- __spreadProps(__spreadValues({}, args), { key: target, onClose: callback }),
141
- prefixCls
142
- )
143
- );
144
- });
145
- });
146
- const result = () => {
147
- if (messageInstance) {
148
- messageInstance.removeNotice(target);
149
- }
150
- };
151
- result.then = (filled, rejected) => closePromise.then(filled, rejected);
152
- result.promise = closePromise;
153
- return result;
154
- }
155
- function isArgsProps(content) {
156
- return Object.prototype.toString.call(content) === "[object Object]" && !!content.content;
157
- }
158
- const api = {
159
- open: notice,
160
- config: setMessageConfig,
161
- destroy() {
162
- if (messageInstance) {
163
- messageInstance.destroy();
164
- messageInstance = null;
165
- }
166
- }
167
- };
168
- function attachTypeApi(originalApi, type) {
169
- originalApi[type] = (content, duration, onClose) => {
170
- if (isArgsProps(content)) {
171
- return originalApi.open(__spreadProps(__spreadValues({}, content), { type }));
172
- }
173
- if (typeof duration === "function") {
174
- onClose = duration;
175
- duration = void 0;
176
- }
177
- return originalApi.open({ content, duration, type, onClose });
178
- };
179
- }
180
- ["success", "info", "warning", "error", "loading"].forEach(
181
- (type) => attachTypeApi(api, type)
182
- );
183
- api.warn = api.warning;
184
- var _message = api;
185
4
 
186
- export { DEFAULT_DURATION, attachTypeApi, _message as default, getKeyThenIncreaseKey };
5
+
6
+ export { _message as default };
@@ -0,0 +1,186 @@
1
+ import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
2
+ import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
3
+ import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
4
+ import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';
5
+ import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
6
+ import RCNotification from '@cloudtower/rc-notification';
7
+ import cs from 'classnames';
8
+ import * as React from 'react';
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __defProps = Object.defineProperties;
12
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
+ var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
17
+ var __spreadValues = (a, b) => {
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols)
22
+ for (var prop of __getOwnPropSymbols(b)) {
23
+ if (__propIsEnum.call(b, prop))
24
+ __defNormalProp(a, prop, b[prop]);
25
+ }
26
+ return a;
27
+ };
28
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29
+ const DEFAULT_DURATION = 3;
30
+ let messageInstance;
31
+ let defaultDuration = DEFAULT_DURATION;
32
+ let defaultTop;
33
+ let key = 1;
34
+ let localPrefixCls = "ant-message";
35
+ let transitionName = "move-up";
36
+ let getContainer;
37
+ let maxCount;
38
+ let rtl = false;
39
+ function getKeyThenIncreaseKey() {
40
+ return key++;
41
+ }
42
+ function setMessageConfig(options) {
43
+ if (options.top !== void 0) {
44
+ defaultTop = options.top;
45
+ messageInstance = null;
46
+ }
47
+ if (options.duration !== void 0) {
48
+ defaultDuration = options.duration;
49
+ }
50
+ if (options.prefixCls !== void 0) {
51
+ localPrefixCls = options.prefixCls;
52
+ }
53
+ if (options.getContainer !== void 0) {
54
+ getContainer = options.getContainer;
55
+ }
56
+ if (options.transitionName !== void 0) {
57
+ transitionName = options.transitionName;
58
+ messageInstance = null;
59
+ }
60
+ if (options.maxCount !== void 0) {
61
+ maxCount = options.maxCount;
62
+ messageInstance = null;
63
+ }
64
+ if (options.rtl !== void 0) {
65
+ rtl = options.rtl;
66
+ }
67
+ }
68
+ function getRCNotificationInstance(args, callback) {
69
+ const prefixCls = args.prefixCls || localPrefixCls;
70
+ if (messageInstance) {
71
+ callback({
72
+ prefixCls,
73
+ instance: messageInstance
74
+ });
75
+ return;
76
+ }
77
+ RCNotification.newInstance(
78
+ {
79
+ prefixCls,
80
+ transitionName,
81
+ style: { top: defaultTop },
82
+ // 覆盖原来的样式
83
+ getContainer,
84
+ maxCount
85
+ },
86
+ (instance) => {
87
+ if (messageInstance) {
88
+ callback({
89
+ prefixCls,
90
+ instance: messageInstance
91
+ });
92
+ return;
93
+ }
94
+ messageInstance = instance;
95
+ callback({
96
+ prefixCls,
97
+ instance
98
+ });
99
+ }
100
+ );
101
+ }
102
+ const typeToIcon = {
103
+ info: InfoCircleFilled,
104
+ success: CheckCircleFilled,
105
+ error: CloseCircleFilled,
106
+ warning: ExclamationCircleFilled,
107
+ loading: LoadingOutlined
108
+ };
109
+ function getRCNoticeProps(args, prefixCls) {
110
+ const duration = args.duration !== void 0 ? args.duration : defaultDuration;
111
+ const IconComponent = args.type != null ? typeToIcon[args.type] : void 0;
112
+ const messageClass = cs(`${prefixCls}-custom-content`, {
113
+ [`${prefixCls}-${args.type}`]: args.type,
114
+ [`${prefixCls}-rtl`]: rtl === true
115
+ });
116
+ return {
117
+ key: args.key,
118
+ duration,
119
+ style: args.style || {},
120
+ className: args.className,
121
+ content: /* @__PURE__ */ React.createElement("div", { className: messageClass }, args.icon || IconComponent && /* @__PURE__ */ React.createElement(IconComponent, null), /* @__PURE__ */ React.createElement("span", null, args.content)),
122
+ onClose: args.onClose
123
+ };
124
+ }
125
+ function notice(args) {
126
+ const target = args.key || key++;
127
+ const closePromise = new Promise((resolve) => {
128
+ const callback = () => {
129
+ if (typeof args.onClose === "function") {
130
+ args.onClose();
131
+ }
132
+ return resolve(true);
133
+ };
134
+ if (document.hidden) {
135
+ return;
136
+ }
137
+ getRCNotificationInstance(args, ({ prefixCls, instance }) => {
138
+ instance.notice(
139
+ getRCNoticeProps(
140
+ __spreadProps(__spreadValues({}, args), { key: target, onClose: callback }),
141
+ prefixCls
142
+ )
143
+ );
144
+ });
145
+ });
146
+ const result = () => {
147
+ if (messageInstance) {
148
+ messageInstance.removeNotice(target);
149
+ }
150
+ };
151
+ result.then = (filled, rejected) => closePromise.then(filled, rejected);
152
+ result.promise = closePromise;
153
+ return result;
154
+ }
155
+ function isArgsProps(content) {
156
+ return Object.prototype.toString.call(content) === "[object Object]" && !!content.content;
157
+ }
158
+ const api = {
159
+ open: notice,
160
+ config: setMessageConfig,
161
+ destroy() {
162
+ if (messageInstance) {
163
+ messageInstance.destroy();
164
+ messageInstance = null;
165
+ }
166
+ }
167
+ };
168
+ function attachTypeApi(originalApi, type) {
169
+ originalApi[type] = (content, duration, onClose) => {
170
+ if (isArgsProps(content)) {
171
+ return originalApi.open(__spreadProps(__spreadValues({}, content), { type }));
172
+ }
173
+ if (typeof duration === "function") {
174
+ onClose = duration;
175
+ duration = void 0;
176
+ }
177
+ return originalApi.open({ content, duration, type, onClose });
178
+ };
179
+ }
180
+ ["success", "info", "warning", "error", "loading"].forEach(
181
+ (type) => attachTypeApi(api, type)
182
+ );
183
+ api.warn = api.warning;
184
+ var _message = api;
185
+
186
+ export { DEFAULT_DURATION, attachTypeApi, _message as default, getKeyThenIncreaseKey };
@@ -0,0 +1,9 @@
1
+ import { createContext, useContext } from 'react';
2
+ import _message from './message.js';
3
+
4
+ const MessageContext = createContext(_message);
5
+ const useMessage = () => {
6
+ return useContext(MessageContext);
7
+ };
8
+
9
+ export { MessageContext, useMessage };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_DURATION } from '../message/index.js';
1
+ import { DEFAULT_DURATION } from '../message/message.js';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
@@ -6,7 +6,7 @@ import { cx } from '@linaria/core';
6
6
  import { copy, download } from './utils.js';
7
7
  import { KubeConfigModalStyle, KubeConfigFooterStyle, KubeConfigWrapperStyle, KubeConfigTitleStyle, KubeConfigTipStyle, KubeConfigContentStyle, ErrorWrapper, ErrorContentWrapper } from './KubeConfigModal.style.js';
8
8
  import { usePopModal } from '../../core/KitStoreProvider/index.js';
9
- import _message from '../../core/message/index.js';
9
+ import _message from '../../core/message/message.js';
10
10
  import Button from '../../core/Button/index.js';
11
11
  import Icon from '../../core/Icon/index.js';
12
12
  import Loading from '../../core/Loading/index.js';
package/dist/esm/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  export { units as Units, units } from './core/index.js';
2
2
  export { UIKitStore, closeModal, popModal, pushModal } from './store/index.js';
3
- export { MessageContext, default as UIKitProvider, kitContext, useMessage, useUIKit } from './UIKitProvider/index.js';
3
+ export { default as UIKitProvider, kitContext, useUIKit } from './UIKitProvider/index.js';
4
4
  export * from '@cloudtower/parrot';
5
5
  export { AntdModal, AntdOption, AntdSelectOptGroup, AntdTimelineItem, DatePickerRangePicker, ListItem, MenuItemGroup, SkeletonButton, TabsTabPane, TypographyText, UploadDragger } from './antd.js';
6
6
  export { antdKit, getAntdKit } from './legacy-antd.js';
7
7
  export { default as useElementsSize } from './hooks/useElementsSize.js';
8
+ export { DEFAULT_DURATION, attachTypeApi, getKeyThenIncreaseKey, default as message } from './core/message/message.js';
9
+ export { MessageContext, useMessage } from './core/message/useMessage.js';
8
10
  export { ModalActions } from './store/modal.js';
9
11
  export { default as AccordionCard } from './core/AccordionCard/index.js';
10
12
  export { default as Alert } from './core/Alert/index.js';
@@ -49,7 +51,6 @@ export { default as Legend, LegendIcon, LegendPresetColors } from './core/Legend
49
51
  export { default as LineChart } from './core/LineChart/index.js';
50
52
  export { default as Link } from './core/Link/index.js';
51
53
  export { default as Loading } from './core/Loading/index.js';
52
- export { DEFAULT_DURATION, attachTypeApi, getKeyThenIncreaseKey, default as message } from './core/message/index.js';
53
54
  export { default as Metric } from './core/Metric/index.js';
54
55
  export { default as Modal } from './core/Modal/index.js';
55
56
  export { default as ModalStack } from './core/ModalStack/index.js';
@@ -79,7 +80,7 @@ export { default as Token, TokenPresetColors } from './core/Token/index.js';
79
80
  export { default as Tooltip } from './core/Tooltip/index.js';
80
81
  export { default as Truncate } from './core/Truncate/index.js';
81
82
  export { Antd5Dropdown } from './core/Antd5Dropdown/Antd5Dropdown.js';
82
- export { Tree as Antd5Tree } from 'antd5';
83
+ export { Flex as Antd5Flex, Tree as Antd5Tree } from 'antd5';
83
84
  export { Architecture } from './core/Arch/arch.type.js';
84
85
  export { Banner } from './core/Banner/index.js';
85
86
  export { BasicCTError } from './core/BasicCTError/index.js';
@@ -31,7 +31,7 @@ import InputGroup from './core/InputGroup/index.js';
31
31
  import LegacySelect from './core/LegacySelect/index.js';
32
32
  import Link from './core/Link/index.js';
33
33
  import Loading from './core/Loading/index.js';
34
- import _message from './core/message/index.js';
34
+ import _message from './core/message/message.js';
35
35
  import Modal from './core/Modal/index.js';
36
36
  import Pagination from './core/Pagination/index.js';
37
37
  import Percent from './core/Percent/index.js';