@fle-ui/next 2.0.0-alpha.6 → 2.0.0-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/es/affix/index.d.ts +54 -0
  2. package/es/affix/index.js +330 -0
  3. package/es/affix/style/css.js +2 -0
  4. package/es/affix/style/index-pure.less +6 -0
  5. package/es/affix/style/index.css +8 -0
  6. package/es/affix/style/index.d.ts +2 -0
  7. package/es/affix/style/index.js +2 -0
  8. package/es/affix/style/index.less +3 -0
  9. package/es/affix/utils.d.ts +15 -0
  10. package/es/affix/utils.js +86 -0
  11. package/es/config-provider/DisabledContext.d.ts +9 -0
  12. package/es/config-provider/DisabledContext.js +11 -0
  13. package/es/config-provider/SizeContext.d.ts +9 -0
  14. package/es/config-provider/SizeContext.js +12 -0
  15. package/es/config-provider/context.d.ts +58 -0
  16. package/es/config-provider/context.js +41 -0
  17. package/es/config-provider/cssVariables.d.ts +3 -0
  18. package/es/config-provider/cssVariables.js +97 -0
  19. package/es/config-provider/defaultRenderEmpty.d.ts +4 -0
  20. package/es/config-provider/defaultRenderEmpty.js +36 -0
  21. package/es/config-provider/index.d.ts +61 -5
  22. package/es/config-provider/index.js +209 -10
  23. package/es/config-provider/style/css.js +1 -0
  24. package/es/config-provider/style/index-pure.less +2 -0
  25. package/es/config-provider/style/index.css +4 -0
  26. package/es/config-provider/style/index.d.ts +1 -0
  27. package/es/config-provider/style/index.js +1 -0
  28. package/es/config-provider/style/index.less +3 -0
  29. package/lib/config-provider/DisabledContext.d.ts +9 -0
  30. package/lib/config-provider/DisabledContext.js +25 -0
  31. package/lib/config-provider/SizeContext.d.ts +9 -0
  32. package/lib/config-provider/SizeContext.js +26 -0
  33. package/lib/config-provider/context.d.ts +58 -0
  34. package/lib/config-provider/context.js +57 -0
  35. package/lib/config-provider/cssVariables.d.ts +3 -0
  36. package/lib/config-provider/cssVariables.js +115 -0
  37. package/lib/config-provider/defaultRenderEmpty.d.ts +4 -0
  38. package/lib/config-provider/defaultRenderEmpty.js +50 -0
  39. package/lib/config-provider/index.d.ts +61 -5
  40. package/lib/config-provider/index.js +250 -10
  41. package/lib/config-provider/style/css.js +3 -0
  42. package/lib/config-provider/style/index-pure.less +2 -0
  43. package/lib/config-provider/style/index.css +4 -0
  44. package/lib/config-provider/style/index.d.ts +1 -0
  45. package/lib/config-provider/style/index.js +3 -0
  46. package/lib/config-provider/style/index.less +3 -0
  47. package/package.json +1 -2
  48. package/es/affix/ActionButton.d.ts +0 -15
  49. package/es/affix/ActionButton.js +0 -118
  50. package/es/affix/colors.d.ts +0 -5
  51. package/es/affix/colors.js +0 -4
  52. package/es/affix/easings.d.ts +0 -1
  53. package/es/affix/easings.js +0 -12
  54. package/es/affix/getDataOrAriaProps.d.ts +0 -1
  55. package/es/affix/getDataOrAriaProps.js +0 -9
  56. package/es/affix/getRenderPropValue.d.ts +0 -3
  57. package/es/affix/getRenderPropValue.js +0 -11
  58. package/es/affix/getScroll.d.ts +0 -2
  59. package/es/affix/getScroll.js +0 -34
  60. package/es/affix/hooks/useFlexGapSupport.d.ts +0 -2
  61. package/es/affix/hooks/useFlexGapSupport.js +0 -14
  62. package/es/affix/hooks/useForceUpdate.d.ts +0 -2
  63. package/es/affix/hooks/useForceUpdate.js +0 -11
  64. package/es/affix/hooks/usePatchElement.d.ts +0 -5
  65. package/es/affix/hooks/usePatchElement.js +0 -26
  66. package/es/affix/hooks/useSyncState.d.ts +0 -3
  67. package/es/affix/hooks/useSyncState.js +0 -13
  68. package/es/affix/isNumeric.d.ts +0 -2
  69. package/es/affix/isNumeric.js +0 -5
  70. package/es/affix/motion.d.ts +0 -8
  71. package/es/affix/motion.js +0 -60
  72. package/es/affix/placements.d.ts +0 -17
  73. package/es/affix/placements.js +0 -88
  74. package/es/affix/raf.d.ts +0 -9
  75. package/es/affix/raf.js +0 -31
  76. package/es/affix/reactNode.d.ts +0 -8
  77. package/es/affix/reactNode.js +0 -16
  78. package/es/affix/responsiveObserve.d.ts +0 -21
  79. package/es/affix/responsiveObserve.js +0 -67
  80. package/es/affix/scrollTo.d.ts +0 -10
  81. package/es/affix/scrollTo.js +0 -38
  82. package/es/affix/statusUtils.d.ts +0 -6
  83. package/es/affix/statusUtils.js +0 -12
  84. package/es/affix/styleChecker.d.ts +0 -4
  85. package/es/affix/styleChecker.js +0 -31
  86. package/es/affix/throttleByAnimationFrame.d.ts +0 -8
  87. package/es/affix/throttleByAnimationFrame.js +0 -58
  88. package/es/affix/transButton.d.ts +0 -9
  89. package/es/affix/transButton.js +0 -75
  90. package/es/affix/type.d.ts +0 -9
  91. package/es/affix/type.js +0 -15
  92. package/es/affix/warning.d.ts +0 -6
  93. package/es/affix/warning.js +0 -17
  94. package/es/affix/wave.d.ts +0 -32
  95. package/es/affix/wave.js +0 -247
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getStyle = getStyle;
9
+ exports.registerTheme = registerTheme;
10
+
11
+ var _colors = require("@ant-design/colors");
12
+
13
+ var _tinycolor = require("@ctrl/tinycolor");
14
+
15
+ var _canUseDom = _interopRequireDefault(require("rc-util/lib/Dom/canUseDom"));
16
+
17
+ var _dynamicCSS = require("rc-util/lib/Dom/dynamicCSS");
18
+
19
+ var _warning = _interopRequireDefault(require("../_util/warning"));
20
+ /* eslint-disable import/prefer-default-export, prefer-destructuring */
21
+
22
+
23
+ var dynamicStyleMark = "-ant-".concat(Date.now(), "-").concat(Math.random());
24
+
25
+ function getStyle(globalPrefixCls, theme) {
26
+ var variables = {};
27
+
28
+ var formatColor = function formatColor(color, updater) {
29
+ var clone = color.clone();
30
+ clone = (updater === null || updater === void 0 ? void 0 : updater(clone)) || clone;
31
+ return clone.toRgbString();
32
+ };
33
+
34
+ var fillColor = function fillColor(colorVal, type) {
35
+ var baseColor = new _tinycolor.TinyColor(colorVal);
36
+ var colorPalettes = (0, _colors.generate)(baseColor.toRgbString());
37
+ variables["".concat(type, "-color")] = formatColor(baseColor);
38
+ variables["".concat(type, "-color-disabled")] = colorPalettes[1];
39
+ variables["".concat(type, "-color-hover")] = colorPalettes[4];
40
+ variables["".concat(type, "-color-active")] = colorPalettes[6];
41
+ variables["".concat(type, "-color-outline")] = baseColor.clone().setAlpha(0.2).toRgbString();
42
+ variables["".concat(type, "-color-deprecated-bg")] = colorPalettes[0];
43
+ variables["".concat(type, "-color-deprecated-border")] = colorPalettes[2];
44
+ }; // ================ Primary Color ================
45
+
46
+
47
+ if (theme.primaryColor) {
48
+ fillColor(theme.primaryColor, 'primary');
49
+ var primaryColor = new _tinycolor.TinyColor(theme.primaryColor);
50
+ var primaryColors = (0, _colors.generate)(primaryColor.toRgbString()); // Legacy - We should use semantic naming standard
51
+
52
+ primaryColors.forEach(function (color, index) {
53
+ variables["primary-".concat(index + 1)] = color;
54
+ }); // Deprecated
55
+
56
+ variables['primary-color-deprecated-l-35'] = formatColor(primaryColor, function (c) {
57
+ return c.lighten(35);
58
+ });
59
+ variables['primary-color-deprecated-l-20'] = formatColor(primaryColor, function (c) {
60
+ return c.lighten(20);
61
+ });
62
+ variables['primary-color-deprecated-t-20'] = formatColor(primaryColor, function (c) {
63
+ return c.tint(20);
64
+ });
65
+ variables['primary-color-deprecated-t-50'] = formatColor(primaryColor, function (c) {
66
+ return c.tint(50);
67
+ });
68
+ variables['primary-color-deprecated-f-12'] = formatColor(primaryColor, function (c) {
69
+ return c.setAlpha(c.getAlpha() * 0.12);
70
+ });
71
+ var primaryActiveColor = new _tinycolor.TinyColor(primaryColors[0]);
72
+ variables['primary-color-active-deprecated-f-30'] = formatColor(primaryActiveColor, function (c) {
73
+ return c.setAlpha(c.getAlpha() * 0.3);
74
+ });
75
+ variables['primary-color-active-deprecated-d-02'] = formatColor(primaryActiveColor, function (c) {
76
+ return c.darken(2);
77
+ });
78
+ } // ================ Success Color ================
79
+
80
+
81
+ if (theme.successColor) {
82
+ fillColor(theme.successColor, 'success');
83
+ } // ================ Warning Color ================
84
+
85
+
86
+ if (theme.warningColor) {
87
+ fillColor(theme.warningColor, 'warning');
88
+ } // ================= Error Color =================
89
+
90
+
91
+ if (theme.errorColor) {
92
+ fillColor(theme.errorColor, 'error');
93
+ } // ================= Info Color ==================
94
+
95
+
96
+ if (theme.infoColor) {
97
+ fillColor(theme.infoColor, 'info');
98
+ } // Convert to css variables
99
+
100
+
101
+ var cssList = Object.keys(variables).map(function (key) {
102
+ return "--".concat(globalPrefixCls, "-").concat(key, ": ").concat(variables[key], ";");
103
+ });
104
+ return "\n :root {\n ".concat(cssList.join('\n'), "\n }\n ").trim();
105
+ }
106
+
107
+ function registerTheme(globalPrefixCls, theme) {
108
+ var style = getStyle(globalPrefixCls, theme);
109
+
110
+ if ((0, _canUseDom["default"])()) {
111
+ (0, _dynamicCSS.updateCSS)(style, "".concat(dynamicStyleMark, "-dynamic-theme"));
112
+ } else {
113
+ process.env.NODE_ENV !== "production" ? (0, _warning["default"])(false, 'ConfigProvider', 'SSR do not support dynamic theme with css variables.') : void 0;
114
+ }
115
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ declare const defaultRenderEmpty: (componentName?: string) => React.ReactNode;
3
+ export type RenderEmptyHandler = typeof defaultRenderEmpty;
4
+ export default defaultRenderEmpty;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var React = _interopRequireWildcard(require("react"));
13
+
14
+ var _ = require(".");
15
+
16
+ var _empty = _interopRequireDefault(require("../empty"));
17
+
18
+ var defaultRenderEmpty = function defaultRenderEmpty(componentName) {
19
+ return /*#__PURE__*/React.createElement(_.ConfigConsumer, null, function (_ref) {
20
+ var getPrefixCls = _ref.getPrefixCls;
21
+ var prefix = getPrefixCls('empty');
22
+
23
+ switch (componentName) {
24
+ case 'Table':
25
+ case 'List':
26
+ return /*#__PURE__*/React.createElement(_empty["default"], {
27
+ image: _empty["default"].PRESENTED_IMAGE_SIMPLE
28
+ });
29
+
30
+ case 'Select':
31
+ case 'TreeSelect':
32
+ case 'Cascader':
33
+ case 'Transfer':
34
+ case 'Mentions':
35
+ return /*#__PURE__*/React.createElement(_empty["default"], {
36
+ image: _empty["default"].PRESENTED_IMAGE_SIMPLE,
37
+ className: "".concat(prefix, "-small")
38
+ });
39
+
40
+ /* istanbul ignore next */
41
+
42
+ default:
43
+ // Should never hit if we take all the component into consider.
44
+ return /*#__PURE__*/React.createElement(_empty["default"], null);
45
+ }
46
+ });
47
+ };
48
+
49
+ var _default = defaultRenderEmpty;
50
+ exports["default"] = _default;
@@ -1,5 +1,61 @@
1
- import { FC } from 'react';
2
- import 'moment/locale/zh-cn';
3
- import type { ConfigProviderProps } from 'antd/es/config-provider/index';
4
- declare const Config: FC<ConfigProviderProps>;
5
- export default Config;
1
+ import type { ValidateMessages } from 'rc-field-form/lib/interface';
2
+ import * as React from 'react';
3
+ import type { RequiredMark } from '../form/Form';
4
+ import type { Locale } from '../locale-provider';
5
+ import type { Theme } from './context';
6
+ import { ConfigConsumer, ConfigConsumerProps, ConfigContext, CSPConfig, DirectionType } from './context';
7
+ import { RenderEmptyHandler } from './defaultRenderEmpty';
8
+ import type { SizeType } from './SizeContext';
9
+ import SizeContext from './SizeContext';
10
+ export { RenderEmptyHandler, ConfigContext, ConfigConsumer, CSPConfig, DirectionType, ConfigConsumerProps, };
11
+ export declare const configConsumerProps: string[];
12
+ export interface ConfigProviderProps {
13
+ getTargetContainer?: () => HTMLElement | Window;
14
+ getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
15
+ prefixCls?: string;
16
+ iconPrefixCls?: string;
17
+ children?: React.ReactNode;
18
+ renderEmpty?: RenderEmptyHandler;
19
+ csp?: CSPConfig;
20
+ autoInsertSpaceInButton?: boolean;
21
+ form?: {
22
+ validateMessages?: ValidateMessages;
23
+ requiredMark?: RequiredMark;
24
+ colon?: boolean;
25
+ };
26
+ input?: {
27
+ autoComplete?: string;
28
+ };
29
+ pagination?: {
30
+ showSizeChanger?: boolean;
31
+ };
32
+ locale?: Locale;
33
+ pageHeader?: {
34
+ ghost: boolean;
35
+ };
36
+ componentSize?: SizeType;
37
+ componentDisabled?: boolean;
38
+ direction?: DirectionType;
39
+ space?: {
40
+ size?: SizeType | number;
41
+ };
42
+ virtual?: boolean;
43
+ dropdownMatchSelectWidth?: boolean;
44
+ }
45
+ export declare const defaultPrefixCls = "ant";
46
+ export declare const defaultIconPrefixCls = "anticon";
47
+ declare function getGlobalIconPrefixCls(): string;
48
+ declare const setGlobalConfig: ({ prefixCls, iconPrefixCls, theme, }: Pick<ConfigProviderProps, "prefixCls" | "iconPrefixCls"> & {
49
+ theme?: Theme | undefined;
50
+ }) => void;
51
+ export declare const globalConfig: () => {
52
+ getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
53
+ getIconPrefixCls: typeof getGlobalIconPrefixCls;
54
+ getRootPrefixCls: (rootPrefixCls?: string, customizePrefixCls?: string) => string;
55
+ };
56
+ declare const ConfigProvider: React.FC<ConfigProviderProps> & {
57
+ ConfigContext: typeof ConfigContext;
58
+ SizeContext: typeof SizeContext;
59
+ config: typeof setGlobalConfig;
60
+ };
61
+ export default ConfigProvider;
@@ -1,14 +1,254 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ "use strict";
2
2
 
3
- import React from 'react';
4
- import { ConfigProvider } from 'antd';
5
- import zhCN from 'antd/es/locale/zh_CN';
6
- import 'moment/locale/zh-cn';
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
7
4
 
8
- var Config = function Config(props) {
9
- return /*#__PURE__*/React.createElement(ConfigProvider, _extends({
10
- locale: zhCN
11
- }, props), props.children);
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ Object.defineProperty(exports, "ConfigConsumer", {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _context.ConfigConsumer;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "ConfigContext", {
17
+ enumerable: true,
18
+ get: function get() {
19
+ return _context.ConfigContext;
20
+ }
21
+ });
22
+ exports.globalConfig = exports.defaultPrefixCls = exports.defaultIconPrefixCls = exports["default"] = exports.configConsumerProps = void 0;
23
+
24
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
+
26
+ var _Context = _interopRequireDefault(require("@ant-design/icons/lib/components/Context"));
27
+
28
+ var _rcFieldForm = require("rc-field-form");
29
+
30
+ var _useMemo = _interopRequireDefault(require("rc-util/lib/hooks/useMemo"));
31
+
32
+ var React = _interopRequireWildcard(require("react"));
33
+
34
+ var _localeProvider = _interopRequireWildcard(require("../locale-provider"));
35
+
36
+ var _LocaleReceiver = _interopRequireDefault(require("../locale-provider/LocaleReceiver"));
37
+
38
+ var _default2 = _interopRequireDefault(require("../locale/default"));
39
+
40
+ var _message = _interopRequireDefault(require("../message"));
41
+
42
+ var _notification = _interopRequireDefault(require("../notification"));
43
+
44
+ var _context = require("./context");
45
+
46
+ var _cssVariables = require("./cssVariables");
47
+
48
+ var _DisabledContext = require("./DisabledContext");
49
+
50
+ var _SizeContext = _interopRequireWildcard(require("./SizeContext"));
51
+
52
+ var configConsumerProps = ['getTargetContainer', 'getPopupContainer', 'rootPrefixCls', 'getPrefixCls', 'renderEmpty', 'csp', 'autoInsertSpaceInButton', 'locale', 'pageHeader']; // These props is used by `useContext` directly in sub component
53
+
54
+ exports.configConsumerProps = configConsumerProps;
55
+ var PASSED_PROPS = ['getTargetContainer', 'getPopupContainer', 'renderEmpty', 'pageHeader', 'input', 'pagination', 'form'];
56
+ var defaultPrefixCls = 'ant';
57
+ exports.defaultPrefixCls = defaultPrefixCls;
58
+ var defaultIconPrefixCls = 'anticon';
59
+ exports.defaultIconPrefixCls = defaultIconPrefixCls;
60
+ var globalPrefixCls;
61
+ var globalIconPrefixCls;
62
+
63
+ function getGlobalPrefixCls() {
64
+ return globalPrefixCls || defaultPrefixCls;
65
+ }
66
+
67
+ function getGlobalIconPrefixCls() {
68
+ return globalIconPrefixCls || defaultIconPrefixCls;
69
+ }
70
+
71
+ var setGlobalConfig = function setGlobalConfig(_ref) {
72
+ var prefixCls = _ref.prefixCls,
73
+ iconPrefixCls = _ref.iconPrefixCls,
74
+ theme = _ref.theme;
75
+
76
+ if (prefixCls !== undefined) {
77
+ globalPrefixCls = prefixCls;
78
+ }
79
+
80
+ if (iconPrefixCls !== undefined) {
81
+ globalIconPrefixCls = iconPrefixCls;
82
+ }
83
+
84
+ if (theme) {
85
+ (0, _cssVariables.registerTheme)(getGlobalPrefixCls(), theme);
86
+ }
12
87
  };
13
88
 
14
- export default Config;
89
+ var globalConfig = function globalConfig() {
90
+ return {
91
+ getPrefixCls: function getPrefixCls(suffixCls, customizePrefixCls) {
92
+ if (customizePrefixCls) return customizePrefixCls;
93
+ return suffixCls ? "".concat(getGlobalPrefixCls(), "-").concat(suffixCls) : getGlobalPrefixCls();
94
+ },
95
+ getIconPrefixCls: getGlobalIconPrefixCls,
96
+ getRootPrefixCls: function getRootPrefixCls(rootPrefixCls, customizePrefixCls) {
97
+ // Customize rootPrefixCls is first priority
98
+ if (rootPrefixCls) {
99
+ return rootPrefixCls;
100
+ } // If Global prefixCls provided, use this
101
+
102
+
103
+ if (globalPrefixCls) {
104
+ return globalPrefixCls;
105
+ } // [Legacy] If customize prefixCls provided, we cut it to get the prefixCls
106
+
107
+
108
+ if (customizePrefixCls && customizePrefixCls.includes('-')) {
109
+ return customizePrefixCls.replace(/^(.*)-[^-]*$/, '$1');
110
+ } // Fallback to default prefixCls
111
+
112
+
113
+ return getGlobalPrefixCls();
114
+ }
115
+ };
116
+ };
117
+
118
+ exports.globalConfig = globalConfig;
119
+
120
+ var ProviderChildren = function ProviderChildren(props) {
121
+ var _a, _b;
122
+
123
+ var children = props.children,
124
+ csp = props.csp,
125
+ autoInsertSpaceInButton = props.autoInsertSpaceInButton,
126
+ form = props.form,
127
+ locale = props.locale,
128
+ componentSize = props.componentSize,
129
+ direction = props.direction,
130
+ space = props.space,
131
+ virtual = props.virtual,
132
+ dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,
133
+ legacyLocale = props.legacyLocale,
134
+ parentContext = props.parentContext,
135
+ iconPrefixCls = props.iconPrefixCls,
136
+ componentDisabled = props.componentDisabled;
137
+ var getPrefixCls = React.useCallback(function (suffixCls, customizePrefixCls) {
138
+ var prefixCls = props.prefixCls;
139
+ if (customizePrefixCls) return customizePrefixCls;
140
+ var mergedPrefixCls = prefixCls || parentContext.getPrefixCls('');
141
+ return suffixCls ? "".concat(mergedPrefixCls, "-").concat(suffixCls) : mergedPrefixCls;
142
+ }, [parentContext.getPrefixCls, props.prefixCls]);
143
+ var config = (0, _extends2["default"])((0, _extends2["default"])({}, parentContext), {
144
+ csp: csp,
145
+ autoInsertSpaceInButton: autoInsertSpaceInButton,
146
+ locale: locale || legacyLocale,
147
+ direction: direction,
148
+ space: space,
149
+ virtual: virtual,
150
+ dropdownMatchSelectWidth: dropdownMatchSelectWidth,
151
+ getPrefixCls: getPrefixCls
152
+ }); // Pass the props used by `useContext` directly with child component.
153
+ // These props should merged into `config`.
154
+
155
+ PASSED_PROPS.forEach(function (propName) {
156
+ var propValue = props[propName];
157
+
158
+ if (propValue) {
159
+ config[propName] = propValue;
160
+ }
161
+ }); // https://github.com/ant-design/ant-design/issues/27617
162
+
163
+ var memoedConfig = (0, _useMemo["default"])(function () {
164
+ return config;
165
+ }, config, function (prevConfig, currentConfig) {
166
+ var prevKeys = Object.keys(prevConfig);
167
+ var currentKeys = Object.keys(currentConfig);
168
+ return prevKeys.length !== currentKeys.length || prevKeys.some(function (key) {
169
+ return prevConfig[key] !== currentConfig[key];
170
+ });
171
+ });
172
+ var memoIconContextValue = React.useMemo(function () {
173
+ return {
174
+ prefixCls: iconPrefixCls,
175
+ csp: csp
176
+ };
177
+ }, [iconPrefixCls, csp]);
178
+ var childNode = children; // Additional Form provider
179
+
180
+ var validateMessages = {};
181
+
182
+ if (locale) {
183
+ validateMessages = ((_a = locale.Form) === null || _a === void 0 ? void 0 : _a.defaultValidateMessages) || ((_b = _default2["default"].Form) === null || _b === void 0 ? void 0 : _b.defaultValidateMessages) || {};
184
+ }
185
+
186
+ if (form && form.validateMessages) {
187
+ validateMessages = (0, _extends2["default"])((0, _extends2["default"])({}, validateMessages), form.validateMessages);
188
+ }
189
+
190
+ if (Object.keys(validateMessages).length > 0) {
191
+ childNode = /*#__PURE__*/React.createElement(_rcFieldForm.FormProvider, {
192
+ validateMessages: validateMessages
193
+ }, children);
194
+ }
195
+
196
+ if (locale) {
197
+ childNode = /*#__PURE__*/React.createElement(_localeProvider["default"], {
198
+ locale: locale,
199
+ _ANT_MARK__: _localeProvider.ANT_MARK
200
+ }, childNode);
201
+ }
202
+
203
+ if (iconPrefixCls || csp) {
204
+ childNode = /*#__PURE__*/React.createElement(_Context["default"].Provider, {
205
+ value: memoIconContextValue
206
+ }, childNode);
207
+ }
208
+
209
+ if (componentSize) {
210
+ childNode = /*#__PURE__*/React.createElement(_SizeContext.SizeContextProvider, {
211
+ size: componentSize
212
+ }, childNode);
213
+ }
214
+
215
+ if (componentDisabled !== undefined) {
216
+ childNode = /*#__PURE__*/React.createElement(_DisabledContext.DisabledContextProvider, {
217
+ disabled: componentDisabled
218
+ }, childNode);
219
+ }
220
+
221
+ return /*#__PURE__*/React.createElement(_context.ConfigContext.Provider, {
222
+ value: memoedConfig
223
+ }, childNode);
224
+ };
225
+
226
+ var ConfigProvider = function ConfigProvider(props) {
227
+ React.useEffect(function () {
228
+ if (props.direction) {
229
+ _message["default"].config({
230
+ rtl: props.direction === 'rtl'
231
+ });
232
+
233
+ _notification["default"].config({
234
+ rtl: props.direction === 'rtl'
235
+ });
236
+ }
237
+ }, [props.direction]);
238
+ return /*#__PURE__*/React.createElement(_LocaleReceiver["default"], null, function (_, __, legacyLocale) {
239
+ return /*#__PURE__*/React.createElement(_context.ConfigConsumer, null, function (context) {
240
+ return /*#__PURE__*/React.createElement(ProviderChildren, (0, _extends2["default"])({
241
+ parentContext: context,
242
+ legacyLocale: legacyLocale
243
+ }, props));
244
+ });
245
+ });
246
+ };
247
+ /** @private internal Usage. do not use in your production */
248
+
249
+
250
+ ConfigProvider.ConfigContext = _context.ConfigContext;
251
+ ConfigProvider.SizeContext = _SizeContext["default"];
252
+ ConfigProvider.config = setGlobalConfig;
253
+ var _default = ConfigProvider;
254
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ require("./index.css");
@@ -0,0 +1,2 @@
1
+ // placeholder
2
+ @import '../../style/themes/index';
@@ -0,0 +1,4 @@
1
+ /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
2
+ /* stylelint-disable no-duplicate-selectors */
3
+ /* stylelint-disable */
4
+ /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ require("./index.less");
@@ -0,0 +1,3 @@
1
+ @root-entry-name: default;
2
+
3
+ @import './index-pure.less';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fle-ui/next",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.8",
4
4
  "description": "fle-ui组件库",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -87,7 +87,6 @@
87
87
  "stylelint": "^14.9.1"
88
88
  },
89
89
  "dependencies": {
90
- "@alifd/theme-22858": "2.0.0",
91
90
  "antd": "4.24.4"
92
91
  }
93
92
  }
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import type { ButtonProps, LegacyButtonType } from '../button/button';
3
- export interface ActionButtonProps {
4
- type?: LegacyButtonType;
5
- actionFn?: (...args: any[]) => any | PromiseLike<any>;
6
- close?: Function;
7
- autoFocus?: boolean;
8
- prefixCls: string;
9
- buttonProps?: ButtonProps;
10
- emitEvent?: boolean;
11
- quitOnNullishReturnValue?: boolean;
12
- children?: React.ReactNode;
13
- }
14
- declare const ActionButton: React.FC<ActionButtonProps>;
15
- export default ActionButton;
@@ -1,118 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import useState from "rc-util/es/hooks/useState";
4
- import * as React from 'react';
5
- import Button from "../button";
6
- import { convertLegacyProps } from "../button/button";
7
-
8
- function isThenable(thing) {
9
- return !!(thing && !!thing.then);
10
- }
11
-
12
- var ActionButton = function ActionButton(props) {
13
- var clickedRef = React.useRef(false);
14
- var ref = React.useRef(null);
15
-
16
- var _useState = useState(false),
17
- _useState2 = _slicedToArray(_useState, 2),
18
- loading = _useState2[0],
19
- setLoading = _useState2[1];
20
-
21
- var close = props.close;
22
-
23
- var onInternalClose = function onInternalClose() {
24
- close === null || close === void 0 ? void 0 : close.apply(void 0, arguments);
25
- };
26
-
27
- React.useEffect(function () {
28
- var timeoutId = null;
29
-
30
- if (props.autoFocus) {
31
- timeoutId = setTimeout(function () {
32
- var _a;
33
-
34
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
35
- });
36
- }
37
-
38
- return function () {
39
- if (timeoutId) {
40
- clearTimeout(timeoutId);
41
- }
42
- };
43
- }, []);
44
-
45
- var handlePromiseOnOk = function handlePromiseOnOk(returnValueOfOnOk) {
46
- if (!isThenable(returnValueOfOnOk)) {
47
- return;
48
- }
49
-
50
- setLoading(true);
51
- returnValueOfOnOk.then(function () {
52
- setLoading(false, true);
53
- onInternalClose.apply(void 0, arguments);
54
- clickedRef.current = false;
55
- }, function (e) {
56
- // Emit error when catch promise reject
57
- // eslint-disable-next-line no-console
58
- console.error(e); // See: https://github.com/ant-design/ant-design/issues/6183
59
-
60
- setLoading(false, true);
61
- clickedRef.current = false;
62
- });
63
- };
64
-
65
- var onClick = function onClick(e) {
66
- var actionFn = props.actionFn;
67
-
68
- if (clickedRef.current) {
69
- return;
70
- }
71
-
72
- clickedRef.current = true;
73
-
74
- if (!actionFn) {
75
- onInternalClose();
76
- return;
77
- }
78
-
79
- var returnValueOfOnOk;
80
-
81
- if (props.emitEvent) {
82
- returnValueOfOnOk = actionFn(e);
83
-
84
- if (props.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
85
- clickedRef.current = false;
86
- onInternalClose(e);
87
- return;
88
- }
89
- } else if (actionFn.length) {
90
- returnValueOfOnOk = actionFn(close); // https://github.com/ant-design/ant-design/issues/23358
91
-
92
- clickedRef.current = false;
93
- } else {
94
- returnValueOfOnOk = actionFn();
95
-
96
- if (!returnValueOfOnOk) {
97
- onInternalClose();
98
- return;
99
- }
100
- }
101
-
102
- handlePromiseOnOk(returnValueOfOnOk);
103
- };
104
-
105
- var type = props.type,
106
- children = props.children,
107
- prefixCls = props.prefixCls,
108
- buttonProps = props.buttonProps;
109
- return /*#__PURE__*/React.createElement(Button, _extends({}, convertLegacyProps(type), {
110
- onClick: onClick,
111
- loading: loading,
112
- prefixCls: prefixCls
113
- }, buttonProps, {
114
- ref: ref
115
- }), children);
116
- };
117
-
118
- export default ActionButton;