@tiny-codes/react-easy 1.6.1 → 1.6.3
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/CHANGELOG.md +14 -0
- package/es/components/ConfigProvider/index.d.ts +4 -1
- package/es/components/ConfigProvider/index.js +29 -5
- package/es/components/ConfigProvider/index.js.map +1 -1
- package/es/components/ConfigProvider/style/index.d.ts +3 -0
- package/es/components/ConfigProvider/style/index.js +124 -0
- package/es/components/ConfigProvider/style/index.js.map +1 -0
- package/es/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/es/components/EllipsisTypography/withEllipsisTypography.js +2 -2
- package/es/components/EllipsisTypography/withEllipsisTypography.js.map +1 -1
- package/lib/components/ConfigProvider/index.d.ts +4 -1
- package/lib/components/ConfigProvider/index.js +10 -2
- package/lib/components/ConfigProvider/index.js.map +3 -3
- package/lib/components/ConfigProvider/style/index.d.ts +3 -0
- package/lib/components/ConfigProvider/style/index.js +87 -0
- package/lib/components/ConfigProvider/style/index.js.map +7 -0
- package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/lib/components/EllipsisTypography/withEllipsisTypography.js +1 -1
- package/lib/components/EllipsisTypography/withEllipsisTypography.js.map +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## 1.6.3
|
|
6
|
+
|
|
7
|
+
2026-1-2
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- ✨ Add `easy-full-height-table` class to make table full height inside a container.
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **withEllipsisTypography**
|
|
16
|
+
|
|
17
|
+
- 🐞 Fix Tooltip not accepting custom `ellipsis.tooltip` props issue.
|
|
18
|
+
|
|
5
19
|
## 1.6.1
|
|
6
20
|
|
|
7
21
|
2026-1-1
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CSSProperties, FC, ReactNode } from 'react';
|
|
2
2
|
import type localesEn from '../../locales/langs/en';
|
|
3
3
|
import { type ReactEasyContextProps } from './context';
|
|
4
4
|
export interface ConfigProviderProps extends ReactEasyContextProps {
|
|
5
|
+
prefixCls?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
5
8
|
/**
|
|
6
9
|
* - **EN:** Custom localization resources, if `lang` exists, it will override the localization
|
|
7
10
|
* resources of that language, otherwise, it will add a new language
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["children", "locales"];
|
|
2
|
+
var _excluded = ["children", "locales", "prefixCls", "className", "style"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
import { useEffect } from 'react';
|
|
16
|
+
import { useContext, useEffect } from 'react';
|
|
17
|
+
import { ConfigProvider as ReactConfigProvider } from 'antd';
|
|
18
|
+
import classNames from 'classnames';
|
|
11
19
|
import locales, { langs, resources } from "../../locales";
|
|
12
20
|
import ReactEasyContext from "./context";
|
|
21
|
+
import useStyle from "./style";
|
|
13
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
23
|
/**
|
|
15
24
|
* - **EN:** Provide global configuration for AntdHelper
|
|
@@ -18,8 +27,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
27
|
var ConfigProvider = function ConfigProvider(props) {
|
|
19
28
|
var children = props.children,
|
|
20
29
|
userLocales = props.locales,
|
|
30
|
+
prefixClsInProps = props.prefixCls,
|
|
31
|
+
className = props.className,
|
|
32
|
+
style = props.style,
|
|
21
33
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
22
34
|
var langInProps = restProps.lang;
|
|
35
|
+
var _useContext = useContext(ReactConfigProvider.ConfigContext),
|
|
36
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
37
|
+
var prefixCls = getPrefixCls('react-easy', prefixClsInProps);
|
|
38
|
+
var _useStyle = useStyle(prefixCls),
|
|
39
|
+
_useStyle2 = _slicedToArray(_useStyle, 3),
|
|
40
|
+
wrapCSSVar = _useStyle2[0],
|
|
41
|
+
hashId = _useStyle2[1],
|
|
42
|
+
cssVarCls = _useStyle2[2];
|
|
23
43
|
useEffect(function () {
|
|
24
44
|
// Dynamically add language pack
|
|
25
45
|
if (userLocales) {
|
|
@@ -36,10 +56,14 @@ var ConfigProvider = function ConfigProvider(props) {
|
|
|
36
56
|
// Set the language of the component
|
|
37
57
|
locales.changeLanguage(langInProps || 'en');
|
|
38
58
|
}, [langInProps]);
|
|
39
|
-
return /*#__PURE__*/_jsx(ReactEasyContext.Provider, {
|
|
59
|
+
return wrapCSSVar( /*#__PURE__*/_jsx(ReactEasyContext.Provider, {
|
|
40
60
|
value: restProps,
|
|
41
|
-
children:
|
|
42
|
-
|
|
61
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
62
|
+
className: classNames(hashId, cssVarCls, prefixCls, className),
|
|
63
|
+
style: style,
|
|
64
|
+
children: children
|
|
65
|
+
})
|
|
66
|
+
}));
|
|
43
67
|
};
|
|
44
68
|
ConfigProvider.displayName = 'ReactEasyConfigProvider';
|
|
45
69
|
export default ConfigProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","locales","langs","resources","ReactEasyContext","
|
|
1
|
+
{"version":3,"names":["useContext","useEffect","ConfigProvider","ReactConfigProvider","classNames","locales","langs","resources","ReactEasyContext","useStyle","jsx","_jsx","props","children","userLocales","prefixClsInProps","prefixCls","className","style","restProps","_objectWithoutProperties","_excluded","langInProps","lang","_useContext","ConfigContext","getPrefixCls","_useStyle","_useStyle2","_slicedToArray","wrapCSSVar","hashId","cssVarCls","includes","removeResourceBundle","addResourceBundle","_objectSpread","translation","en","changeLanguage","Provider","value","displayName"],"sources":["../../../src/components/ConfigProvider/index.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect } from 'react';\nimport { ConfigProvider as ReactConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\nimport useStyle from './style';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n prefixCls?: string;\n className?: string;\n style?: CSSProperties;\n /**\n * - **EN:** Custom localization resources, if `lang` exists, it will override the localization\n * resources of that language, otherwise, it will add a new language\n * - **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言\n */\n locales?: Partial<typeof localesEn>;\n children: ReactNode;\n}\n\n/**\n * - **EN:** Provide global configuration for AntdHelper\n * - **CN:** 提供AntdHelper的全局配置\n */\nconst ConfigProvider: FC<ConfigProviderProps> = (props) => {\n const { children, locales: userLocales, prefixCls: prefixClsInProps, className, style, ...restProps } = props;\n const { lang: langInProps } = restProps;\n const { getPrefixCls } = useContext(ReactConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('react-easy', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n useEffect(() => {\n // Dynamically add language pack\n if (userLocales) {\n const lang = langInProps || 'en';\n if (lang && langs.includes(lang)) {\n locales.removeResourceBundle(lang, 'translation');\n locales.addResourceBundle(lang, 'translation', { ...resources[lang].translation, ...userLocales });\n } else {\n locales.addResourceBundle(lang, 'translation', { ...resources.en.translation, ...userLocales });\n }\n }\n }, [langInProps, userLocales]);\n\n useEffect(() => {\n // Set the language of the component\n locales.changeLanguage(langInProps || 'en');\n }, [langInProps]);\n\n return wrapCSSVar(\n <ReactEasyContext.Provider value={restProps}>\n <div className={classNames(hashId, cssVarCls, prefixCls, className)} style={style}>\n {children}\n </div>\n </ReactEasyContext.Provider>\n );\n};\nConfigProvider.displayName = 'ReactEasyConfigProvider';\n\nexport default ConfigProvider;\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,SAASC,cAAc,IAAIC,mBAAmB,QAAQ,MAAM;AAC5D,OAAOC,UAAU,MAAM,YAA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AACc,WAAW,GAAKvB,WAAW,CAAE,CAAC;MACpG,CAAC,MAAM;QACLT,OAAO,CAAC8B,iBAAiB,CAACZ,IAAI,EAAE,aAAa,EAAAa,aAAA,CAAAA,aAAA,KAAO7B,SAAS,CAAC+B,EAAE,CAACD,WAAW,GAAKvB,WAAW,CAAE,CAAC;MACjG;IACF;EACF,CAAC,EAAE,CAACQ,WAAW,EAAER,WAAW,CAAC,CAAC;EAE9Bb,SAAS,CAAC,YAAM;IACd;IACAI,OAAO,CAACkC,cAAc,CAACjB,WAAW,IAAI,IAAI,CAAC;EAC7C,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,OAAOQ,UAAU,eACfnB,IAAA,CAACH,gBAAgB,CAACgC,QAAQ;IAACC,KAAK,EAAEtB,SAAU;IAAAN,QAAA,eAC1CF,IAAA;MAAKM,SAAS,EAAEb,UAAU,CAAC2B,MAAM,EAAEC,SAAS,EAAEhB,SAAS,EAAEC,SAAS,CAAE;MAACC,KAAK,EAAEA,KAAM;MAAAL,QAAA,EAC/EA;IAAQ,CACN;EAAC,CACmB,CAC7B,CAAC;AACH,CAAC;AACDX,cAAc,CAACwC,WAAW,GAAG,yBAAyB;AAEtD,eAAexC,cAAc"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
import { genStyleHooks } from 'antd/es/theme/internal';
|
|
6
|
+
// .full-height-table(@fullHeight:true, @depth: 1) when(@depth <= 2) {
|
|
7
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
8
|
+
// height: if((@fullHeight = true), 100%, auto);
|
|
9
|
+
|
|
10
|
+
// .@{ant-prefix}-spin-nested-loading {
|
|
11
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
12
|
+
// height: if((@fullHeight = true), 100%, auto);
|
|
13
|
+
|
|
14
|
+
// .@{ant-prefix}-spin-container {
|
|
15
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
16
|
+
// display: if((@fullHeight = true), flex, block);
|
|
17
|
+
// flex-direction: column;
|
|
18
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
19
|
+
// height: if((@fullHeight = true), 100%, auto);
|
|
20
|
+
|
|
21
|
+
// .@{ant-prefix}-table:not(.@{ant-prefix}-table-empty) {
|
|
22
|
+
// display: flex;
|
|
23
|
+
// flex: auto;
|
|
24
|
+
// flex-direction: column;
|
|
25
|
+
// width: 100%;
|
|
26
|
+
// min-height: 0;
|
|
27
|
+
|
|
28
|
+
// .@{ant-prefix}-table-container {
|
|
29
|
+
// flex: auto;
|
|
30
|
+
// min-height: 0;
|
|
31
|
+
|
|
32
|
+
// .@{ant-prefix}-table-content {
|
|
33
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
34
|
+
// max-height: if((@fullHeight = true), 100%, auto);
|
|
35
|
+
// // 把容器再多撑高1px,否则会始终显示纵向滚动条
|
|
36
|
+
// padding-bottom: 1px;
|
|
37
|
+
// // 自动显示纵向滚动条
|
|
38
|
+
// // stylelint-disable-next-line declaration-no-important
|
|
39
|
+
// overflow: auto !important;
|
|
40
|
+
|
|
41
|
+
// & > table {
|
|
42
|
+
// /* stylelint-disable-next-line function-no-unknown */
|
|
43
|
+
// height: if((@fullHeight = true), 100%, auto);
|
|
44
|
+
|
|
45
|
+
// .@{ant-prefix}-table-thead {
|
|
46
|
+
// position: sticky;
|
|
47
|
+
// top: 0;
|
|
48
|
+
// z-index: 10;
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// td {
|
|
52
|
+
// // 当嵌套表格时,还原所有full-height样式,防止子表格受影响
|
|
53
|
+
// .full-height-table(false, @depth + 1);
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
// & > .@{ant-prefix}-table-pagination {
|
|
61
|
+
// flex: none;
|
|
62
|
+
// margin-bottom: 0;
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
// .full-height-table-container {
|
|
69
|
+
// .@{ant-prefix}-table-wrapper {
|
|
70
|
+
// .full-height-table();
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
var genStyle = function genStyle(token) {
|
|
74
|
+
var componentCls = token.componentCls;
|
|
75
|
+
return _defineProperty({}, componentCls, {
|
|
76
|
+
width: '100%',
|
|
77
|
+
height: '100%',
|
|
78
|
+
flex: 'auto',
|
|
79
|
+
minWidth: 0,
|
|
80
|
+
minHeight: 0,
|
|
81
|
+
'.easy-full-height-table': _defineProperty({
|
|
82
|
+
height: '100%'
|
|
83
|
+
}, "".concat(token.antCls, "-spin-nested-loading"), _defineProperty({
|
|
84
|
+
height: '100%'
|
|
85
|
+
}, "".concat(token.antCls, "-spin-container"), _defineProperty(_defineProperty({
|
|
86
|
+
display: 'flex',
|
|
87
|
+
flexDirection: 'column',
|
|
88
|
+
height: '100%'
|
|
89
|
+
}, "".concat(token.antCls, "-table:not(").concat(token.antCls, "-table-empty)"), _defineProperty({
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flex: 'auto',
|
|
92
|
+
flexDirection: 'column',
|
|
93
|
+
width: '100%',
|
|
94
|
+
minHeight: 0
|
|
95
|
+
}, "".concat(token.antCls, "-table-container"), _defineProperty({
|
|
96
|
+
flex: 'auto',
|
|
97
|
+
minHeight: 0
|
|
98
|
+
}, "".concat(token.antCls, "-table-content"), {
|
|
99
|
+
maxHeight: '100%',
|
|
100
|
+
// 把容器再多撑高1px,否则会始终显示纵向滚动条
|
|
101
|
+
paddingBottom: 1,
|
|
102
|
+
// 自动显示纵向滚动条
|
|
103
|
+
// stylelint-disable-next-line declaration-no-important
|
|
104
|
+
overflow: 'auto !important',
|
|
105
|
+
'& > table': _defineProperty(_defineProperty({
|
|
106
|
+
height: '100%'
|
|
107
|
+
}, "".concat(token.antCls, "-table-thead"), {
|
|
108
|
+
position: 'sticky',
|
|
109
|
+
top: 0,
|
|
110
|
+
zIndex: 10
|
|
111
|
+
}), "td", {
|
|
112
|
+
// 当嵌套表格时,还原所有full-height样式,防止子表格受影响
|
|
113
|
+
'.easy-full-height-table': {
|
|
114
|
+
height: 'auto'
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
}))), "& > ".concat(token.antCls, "-table-pagination"), {
|
|
118
|
+
flex: 'none',
|
|
119
|
+
marginBottom: 0
|
|
120
|
+
})))
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
export default genStyleHooks('EasyConfigProvider', genStyle);
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["genStyleHooks","genStyle","token","componentCls","_defineProperty","width","height","flex","minWidth","minHeight","concat","antCls","display","flexDirection","maxHeight","paddingBottom","overflow","position","top","zIndex","marginBottom"],"sources":["../../../../src/components/ConfigProvider/style/index.ts"],"sourcesContent":["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype OverflowTagsToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\n// .full-height-table(@fullHeight:true, @depth: 1) when(@depth <= 2) {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-nested-loading {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-container {\n// /* stylelint-disable-next-line function-no-unknown */\n// display: if((@fullHeight = true), flex, block);\n// flex-direction: column;\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table:not(.@{ant-prefix}-table-empty) {\n// display: flex;\n// flex: auto;\n// flex-direction: column;\n// width: 100%;\n// min-height: 0;\n\n// .@{ant-prefix}-table-container {\n// flex: auto;\n// min-height: 0;\n\n// .@{ant-prefix}-table-content {\n// /* stylelint-disable-next-line function-no-unknown */\n// max-height: if((@fullHeight = true), 100%, auto);\n// // 把容器再多撑高1px,否则会始终显示纵向滚动条\n// padding-bottom: 1px;\n// // 自动显示纵向滚动条\n// // stylelint-disable-next-line declaration-no-important\n// overflow: auto !important;\n\n// & > table {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table-thead {\n// position: sticky;\n// top: 0;\n// z-index: 10;\n// }\n\n// td {\n// // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n// .full-height-table(false, @depth + 1);\n// }\n// }\n// }\n// }\n// }\n\n// & > .@{ant-prefix}-table-pagination {\n// flex: none;\n// margin-bottom: 0;\n// }\n// }\n// }\n// }\n\n// .full-height-table-container {\n// .@{ant-prefix}-table-wrapper {\n// .full-height-table();\n// }\n// }\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n width: '100%',\n height: '100%',\n flex: 'auto',\n minWidth: 0,\n minHeight: 0,\n\n '.easy-full-height-table': {\n height: '100%',\n\n [`${token.antCls}-spin-nested-loading`]: {\n height: '100%',\n\n [`${token.antCls}-spin-container`]: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n\n [`${token.antCls}-table:not(${token.antCls}-table-empty)`]: {\n display: 'flex',\n flex: 'auto',\n flexDirection: 'column',\n width: '100%',\n minHeight: 0,\n\n [`${token.antCls}-table-container`]: {\n flex: 'auto',\n minHeight: 0,\n\n [`${token.antCls}-table-content`]: {\n maxHeight: '100%',\n // 把容器再多撑高1px,否则会始终显示纵向滚动条\n paddingBottom: 1,\n // 自动显示纵向滚动条\n // stylelint-disable-next-line declaration-no-important\n overflow: 'auto !important',\n\n '& > table': {\n height: '100%',\n\n [`${token.antCls}-table-thead`]: {\n position: 'sticky',\n top: 0,\n zIndex: 10,\n },\n\n td: {\n // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n '.easy-full-height-table': {\n height: 'auto',\n },\n },\n },\n },\n },\n },\n [`& > ${token.antCls}-table-pagination`]: {\n flex: 'none',\n marginBottom: 0,\n },\n },\n },\n },\n },\n };\n};\n\nexport default genStyleHooks('EasyConfigProvider' as never, genStyle);\n"],"mappings":";;;;AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAOtD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;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AE,CAAC;QACNC,MAAM,EAAE;MACV,CAAC,SAEG;QACF;QACA,yBAAyB,EAAE;UACzBb,MAAM,EAAE;QACV;MACF,CAAC;IAEL,CAAC,YAAAI,MAAA,CAGGR,KAAK,CAACS,MAAM,wBAAsB;MACxCJ,IAAI,EAAE,MAAM;MACZa,YAAY,EAAE;IAChB,CAAC;EAIT,CAAC;AAEL,CAAC;AAED,eAAepB,aAAa,CAAC,oBAAoB,EAAWC,QAAQ,CAAC"}
|
|
@@ -11,9 +11,9 @@ import { type ActionComponentInterface } from '../ConfirmAction/withConfirmActio
|
|
|
11
11
|
*/
|
|
12
12
|
export default function withDeleteConfirmAction<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): (<TriggerProp extends object, Event extends keyof TriggerProp>(props: import("react").PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & Omit<import("antd").ModalFuncProps, "onOk"> & import("../ConfirmAction").ConfirmActionTrigger<TriggerProp, Event> & {
|
|
13
13
|
danger?: boolean | undefined;
|
|
14
|
-
titleColor?: import("antd/es/typography/Base").BaseType |
|
|
15
|
-
contentColor?: import("antd/es/typography/Base").BaseType |
|
|
16
|
-
iconColor?: import("antd/es/typography/Base").BaseType |
|
|
14
|
+
titleColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
15
|
+
contentColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
16
|
+
iconColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
17
17
|
onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown) | undefined;
|
|
18
18
|
afterOk?: ((data?: any) => void) | undefined;
|
|
19
19
|
} & import("react").RefAttributes<import("../ConfirmAction").ConfirmActionRef<Ref>>) => import("react").ReactNode) & import("../ConfirmAction/withConfirmAction").TypedTriggers<P, Ref>;
|
|
@@ -51,7 +51,7 @@ function withEllipsisTypography(Component) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}, [text, isAuto, dom]);
|
|
54
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
|
54
|
+
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, ellipsis === null || ellipsis === void 0 ? void 0 : ellipsis.tooltip), {}, {
|
|
55
55
|
title: tooltipTitle,
|
|
56
56
|
children: /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({
|
|
57
57
|
ref: setDom
|
|
@@ -68,7 +68,7 @@ function withEllipsisTypography(Component) {
|
|
|
68
68
|
}) : ellipsis,
|
|
69
69
|
children: text
|
|
70
70
|
}))
|
|
71
|
-
});
|
|
71
|
+
}));
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
export default withEllipsisTypography;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useState","Tooltip","jsx","_jsx","withEllipsisTypography","Component","EllipsisText","props","ellipsis","text","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","isEllipsis","setIsEllipsis","_useState3","_useState4","dom","setDom","isAutoEllipsis","isAutoTooltip","_typeof","tooltip","isAutoTooltipTitle","title","isAuto","tooltipTitle","undefined","Promise","resolve","then","scrollWidth","clientWidth","scrollHeight","clientHeight","
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useState","Tooltip","jsx","_jsx","withEllipsisTypography","Component","EllipsisText","props","ellipsis","text","rest","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","isEllipsis","setIsEllipsis","_useState3","_useState4","dom","setDom","isAutoEllipsis","isAutoTooltip","_typeof","tooltip","isAutoTooltipTitle","title","isAuto","tooltipTitle","undefined","Promise","resolve","then","scrollWidth","clientWidth","scrollHeight","clientHeight","_objectSpread","children","ref"],"sources":["../../../src/components/EllipsisTypography/withEllipsisTypography.tsx"],"sourcesContent":["import type { ComponentType } from 'react';\nimport { useEffect, useMemo, useState } from 'react';\nimport type { TooltipProps } from 'antd';\nimport { Tooltip } from 'antd';\nimport type { EllipsisConfig } from 'antd/es/typography/Base';\nimport type { ParagraphProps } from 'antd/es/typography/Paragraph';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport type { TitleProps } from 'antd/es/typography/Title';\n\nfunction withEllipsisTypography<T extends TextProps | ParagraphProps | TitleProps>(\n Component: ComponentType<MakeEllipsisTypographyProps<T>>\n) {\n return function EllipsisText(props: MakeEllipsisTypographyProps<T>) {\n const { ellipsis, text, ...rest } = props;\n const [isEllipsis, setIsEllipsis] = useState(false);\n const [dom, setDom] = useState<HTMLElement | null>(null);\n const isAutoEllipsis = useMemo(() => ellipsis === true, [ellipsis]);\n const isAutoTooltip = useMemo(() => typeof ellipsis === 'object' && ellipsis.tooltip === true, [ellipsis]);\n const isAutoTooltipTitle = useMemo(\n () =>\n typeof ellipsis === 'object' &&\n ellipsis.tooltip &&\n typeof ellipsis.tooltip === 'object' &&\n 'title' in ellipsis.tooltip &&\n ellipsis.tooltip.title === true,\n [ellipsis]\n );\n const isAuto = useMemo(\n () => isAutoEllipsis || isAutoTooltip || isAutoTooltipTitle,\n [isAutoEllipsis, isAutoTooltip, isAutoTooltipTitle]\n );\n const tooltipTitle = useMemo(() => (isEllipsis ? text : undefined), [isEllipsis, text]);\n\n useEffect(() => {\n if (dom && isAuto) {\n Promise.resolve().then(() => {\n setIsEllipsis(dom.scrollWidth > dom.clientWidth || dom.scrollHeight > dom.clientHeight);\n });\n }\n }, [text, isAuto, dom]);\n\n return (\n <Tooltip {...((ellipsis as EllipsisConfig)?.tooltip as TooltipProps)} title={tooltipTitle}>\n <Component\n ref={setDom}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(rest as any)}\n ellipsis={\n isAutoEllipsis\n ? { tooltip: undefined }\n : isAutoTooltip\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: undefined,\n }\n : isAutoTooltipTitle\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: {\n ...((ellipsis as EllipsisConfig)?.tooltip as TooltipProps),\n title: undefined,\n },\n }\n : ellipsis\n }\n >\n {text}\n </Component>\n </Tooltip>\n );\n };\n}\n\nexport type MakeEllipsisTypographyProps<T> = Omit<T, 'children'> & {\n text: string | undefined;\n};\n\nexport default withEllipsisTypography;\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,OAAO,QAAQ,MAAM;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM/B,SAASC,sBAAsBA,CAC7BC,SAAwD,EACxD;EACA,OAAO,SAASC,YAAYA,CAACC,KAAqC,EAAE;IAClE,IAAQC,QAAQ,GAAoBD,KAAK,CAAjCC,QAAQ;MAAEC,IAAI,GAAcF,KAAK,CAAvBE,IAAI;MAAKC,IAAI,GAAAC,wBAAA,CAAKJ,KAAK,EAAAK,SAAA;IACzC,IAAAC,SAAA,GAAoCb,QAAQ,CAAC,KAAK,CAAC;MAAAc,UAAA,GAAAC,cAAA,CAAAF,SAAA;MAA5CG,UAAU,GAAAF,UAAA;MAAEG,aAAa,GAAAH,UAAA;IAChC,IAAAI,UAAA,GAAsBlB,QAAQ,CAAqB,IAAI,CAAC;MAAAmB,UAAA,GAAAJ,cAAA,CAAAG,UAAA;MAAjDE,GAAG,GAAAD,UAAA;MAAEE,MAAM,GAAAF,UAAA;IAClB,IAAMG,cAAc,GAAGvB,OAAO,CAAC;MAAA,OAAMS,QAAQ,KAAK,IAAI;IAAA,GAAE,CAACA,QAAQ,CAAC,CAAC;IACnE,IAAMe,aAAa,GAAGxB,OAAO,CAAC;MAAA,OAAMyB,OAAA,CAA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,CAACE,SAAS,EAAAiC,aAAA,CAAAA,aAAA;QACRE,GAAG,EAAEnB;QACL;MAAA,GACKX,IAAI;QACTF,QAAQ,EACNc,cAAc,GACV;UAAEG,OAAO,EAAEK;QAAU,CAAC,GACtBP,aAAa,GAAAe,aAAA,CAAAA,aAAA,KAEL9B,QAAQ;UACZiB,OAAO,EAAEK;QAAS,KAEpBJ,kBAAkB,GAAAY,aAAA,CAAAA,aAAA,KAEV9B,QAAQ;UACZiB,OAAO,EAAAa,aAAA,CAAAA,aAAA,KACA9B,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAqBiB,OAAO;YACzCE,KAAK,EAAEG;UAAS;QACjB,KAEHtB,QACT;QAAA+B,QAAA,EAEA9B;MAAI,EACI;IAAC,EACL,CAAC;EAEd,CAAC;AACH;AAMA,eAAeL,sBAAsB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CSSProperties, FC, ReactNode } from 'react';
|
|
2
2
|
import type localesEn from '../../locales/langs/en';
|
|
3
3
|
import { type ReactEasyContextProps } from './context';
|
|
4
4
|
export interface ConfigProviderProps extends ReactEasyContextProps {
|
|
5
|
+
prefixCls?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
5
8
|
/**
|
|
6
9
|
* - **EN:** Custom localization resources, if `lang` exists, it will override the localization
|
|
7
10
|
* resources of that language, otherwise, it will add a new language
|
|
@@ -33,11 +33,17 @@ __export(ConfigProvider_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(ConfigProvider_exports);
|
|
35
35
|
var import_react = require("react");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
38
|
var import_locales = __toESM(require("../../locales"));
|
|
37
39
|
var import_context = __toESM(require("./context"));
|
|
40
|
+
var import_style = __toESM(require("./style"));
|
|
38
41
|
var ConfigProvider = (props) => {
|
|
39
|
-
const { children, locales: userLocales, ...restProps } = props;
|
|
42
|
+
const { children, locales: userLocales, prefixCls: prefixClsInProps, className, style, ...restProps } = props;
|
|
40
43
|
const { lang: langInProps } = restProps;
|
|
44
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
45
|
+
const prefixCls = getPrefixCls("react-easy", prefixClsInProps);
|
|
46
|
+
const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls);
|
|
41
47
|
(0, import_react.useEffect)(() => {
|
|
42
48
|
if (userLocales) {
|
|
43
49
|
const lang = langInProps || "en";
|
|
@@ -52,7 +58,9 @@ var ConfigProvider = (props) => {
|
|
|
52
58
|
(0, import_react.useEffect)(() => {
|
|
53
59
|
import_locales.default.changeLanguage(langInProps || "en");
|
|
54
60
|
}, [langInProps]);
|
|
55
|
-
return
|
|
61
|
+
return wrapCSSVar(
|
|
62
|
+
/* @__PURE__ */ React.createElement(import_context.default.Provider, { value: restProps }, /* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(hashId, cssVarCls, prefixCls, className), style }, children))
|
|
63
|
+
);
|
|
56
64
|
};
|
|
57
65
|
ConfigProvider.displayName = "ReactEasyConfigProvider";
|
|
58
66
|
var ConfigProvider_default = ConfigProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ConfigProvider/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["locales", "ReactEasyContext"]
|
|
4
|
+
"sourcesContent": ["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect } from 'react';\nimport { ConfigProvider as ReactConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport locales, { langs, resources } from '../../locales';\nimport type localesEn from '../../locales/langs/en';\nimport ReactEasyContext, { type ReactEasyContextProps } from './context';\nimport useStyle from './style';\n\nexport interface ConfigProviderProps extends ReactEasyContextProps {\n prefixCls?: string;\n className?: string;\n style?: CSSProperties;\n /**\n * - **EN:** Custom localization resources, if `lang` exists, it will override the localization\n * resources of that language, otherwise, it will add a new language\n * - **CN:** 自定义本地化资源,如果`lang`存在,则会覆盖该语言的本地化资源,否则,会添加一种新的语言\n */\n locales?: Partial<typeof localesEn>;\n children: ReactNode;\n}\n\n/**\n * - **EN:** Provide global configuration for AntdHelper\n * - **CN:** 提供AntdHelper的全局配置\n */\nconst ConfigProvider: FC<ConfigProviderProps> = (props) => {\n const { children, locales: userLocales, prefixCls: prefixClsInProps, className, style, ...restProps } = props;\n const { lang: langInProps } = restProps;\n const { getPrefixCls } = useContext(ReactConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('react-easy', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n\n useEffect(() => {\n // Dynamically add language pack\n if (userLocales) {\n const lang = langInProps || 'en';\n if (lang && langs.includes(lang)) {\n locales.removeResourceBundle(lang, 'translation');\n locales.addResourceBundle(lang, 'translation', { ...resources[lang].translation, ...userLocales });\n } else {\n locales.addResourceBundle(lang, 'translation', { ...resources.en.translation, ...userLocales });\n }\n }\n }, [langInProps, userLocales]);\n\n useEffect(() => {\n // Set the language of the component\n locales.changeLanguage(langInProps || 'en');\n }, [langInProps]);\n\n return wrapCSSVar(\n <ReactEasyContext.Provider value={restProps}>\n <div className={classNames(hashId, cssVarCls, prefixCls, className)} style={style}>\n {children}\n </div>\n </ReactEasyContext.Provider>\n );\n};\nConfigProvider.displayName = 'ReactEasyConfigProvider';\n\nexport default ConfigProvider;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsC;AACtC,kBAAsD;AACtD,wBAAuB;AACvB,qBAA0C;AAE1C,qBAA6D;AAC7D,mBAAqB;AAmBrB,IAAM,iBAA0C,CAAC,UAAU;AACzD,QAAM,EAAE,UAAU,SAAS,aAAa,WAAW,kBAAkB,WAAW,OAAO,GAAG,UAAU,IAAI;AACxG,QAAM,EAAE,MAAM,YAAY,IAAI;AAC9B,QAAM,EAAE,aAAa,QAAI,yBAAW,YAAAA,eAAoB,aAAa;AACrE,QAAM,YAAY,aAAa,cAAc,gBAAgB;AAC7D,QAAM,CAAC,YAAY,QAAQ,SAAS,QAAI,aAAAC,SAAS,SAAS;AAE1D,8BAAU,MAAM;AAEd,QAAI,aAAa;AACf,YAAM,OAAO,eAAe;AAC5B,UAAI,QAAQ,qBAAM,SAAS,IAAI,GAAG;AAChC,uBAAAC,QAAQ,qBAAqB,MAAM,aAAa;AAChD,uBAAAA,QAAQ,kBAAkB,MAAM,eAAe,EAAE,GAAG,yBAAU,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;AAAA,MACnG,OAAO;AACL,uBAAAA,QAAQ,kBAAkB,MAAM,eAAe,EAAE,GAAG,yBAAU,GAAG,aAAa,GAAG,YAAY,CAAC;AAAA,MAChG;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,WAAW,CAAC;AAE7B,8BAAU,MAAM;AAEd,mBAAAA,QAAQ,eAAe,eAAe,IAAI;AAAA,EAC5C,GAAG,CAAC,WAAW,CAAC;AAEhB,SAAO;AAAA,IACL,oCAAC,eAAAC,QAAiB,UAAjB,EAA0B,OAAO,aAChC,oCAAC,SAAI,eAAW,kBAAAC,SAAW,QAAQ,WAAW,WAAW,SAAS,GAAG,SAClE,QACH,CACF;AAAA,EACF;AACF;AACA,eAAe,cAAc;AAE7B,IAAO,yBAAQ;",
|
|
6
|
+
"names": ["ReactConfigProvider", "useStyle", "locales", "ReactEasyContext", "classNames"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/ConfigProvider/style/index.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
default: () => style_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_internal = require("antd/es/theme/internal");
|
|
26
|
+
var genStyle = (token) => {
|
|
27
|
+
const { componentCls } = token;
|
|
28
|
+
return {
|
|
29
|
+
[componentCls]: {
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: "100%",
|
|
32
|
+
flex: "auto",
|
|
33
|
+
minWidth: 0,
|
|
34
|
+
minHeight: 0,
|
|
35
|
+
".easy-full-height-table": {
|
|
36
|
+
height: "100%",
|
|
37
|
+
[`${token.antCls}-spin-nested-loading`]: {
|
|
38
|
+
height: "100%",
|
|
39
|
+
[`${token.antCls}-spin-container`]: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
height: "100%",
|
|
43
|
+
[`${token.antCls}-table:not(${token.antCls}-table-empty)`]: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
flex: "auto",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
width: "100%",
|
|
48
|
+
minHeight: 0,
|
|
49
|
+
[`${token.antCls}-table-container`]: {
|
|
50
|
+
flex: "auto",
|
|
51
|
+
minHeight: 0,
|
|
52
|
+
[`${token.antCls}-table-content`]: {
|
|
53
|
+
maxHeight: "100%",
|
|
54
|
+
// 把容器再多撑高1px,否则会始终显示纵向滚动条
|
|
55
|
+
paddingBottom: 1,
|
|
56
|
+
// 自动显示纵向滚动条
|
|
57
|
+
// stylelint-disable-next-line declaration-no-important
|
|
58
|
+
overflow: "auto !important",
|
|
59
|
+
"& > table": {
|
|
60
|
+
height: "100%",
|
|
61
|
+
[`${token.antCls}-table-thead`]: {
|
|
62
|
+
position: "sticky",
|
|
63
|
+
top: 0,
|
|
64
|
+
zIndex: 10
|
|
65
|
+
},
|
|
66
|
+
td: {
|
|
67
|
+
// 当嵌套表格时,还原所有full-height样式,防止子表格受影响
|
|
68
|
+
".easy-full-height-table": {
|
|
69
|
+
height: "auto"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[`& > ${token.antCls}-table-pagination`]: {
|
|
77
|
+
flex: "none",
|
|
78
|
+
marginBottom: 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var style_default = (0, import_internal.genStyleHooks)("EasyConfigProvider", genStyle);
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ConfigProvider/style/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype OverflowTagsToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\n// .full-height-table(@fullHeight:true, @depth: 1) when(@depth <= 2) {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-nested-loading {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-spin-container {\n// /* stylelint-disable-next-line function-no-unknown */\n// display: if((@fullHeight = true), flex, block);\n// flex-direction: column;\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table:not(.@{ant-prefix}-table-empty) {\n// display: flex;\n// flex: auto;\n// flex-direction: column;\n// width: 100%;\n// min-height: 0;\n\n// .@{ant-prefix}-table-container {\n// flex: auto;\n// min-height: 0;\n\n// .@{ant-prefix}-table-content {\n// /* stylelint-disable-next-line function-no-unknown */\n// max-height: if((@fullHeight = true), 100%, auto);\n// // 把容器再多撑高1px,否则会始终显示纵向滚动条\n// padding-bottom: 1px;\n// // 自动显示纵向滚动条\n// // stylelint-disable-next-line declaration-no-important\n// overflow: auto !important;\n\n// & > table {\n// /* stylelint-disable-next-line function-no-unknown */\n// height: if((@fullHeight = true), 100%, auto);\n\n// .@{ant-prefix}-table-thead {\n// position: sticky;\n// top: 0;\n// z-index: 10;\n// }\n\n// td {\n// // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n// .full-height-table(false, @depth + 1);\n// }\n// }\n// }\n// }\n// }\n\n// & > .@{ant-prefix}-table-pagination {\n// flex: none;\n// margin-bottom: 0;\n// }\n// }\n// }\n// }\n\n// .full-height-table-container {\n// .@{ant-prefix}-table-wrapper {\n// .full-height-table();\n// }\n// }\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n width: '100%',\n height: '100%',\n flex: 'auto',\n minWidth: 0,\n minHeight: 0,\n\n '.easy-full-height-table': {\n height: '100%',\n\n [`${token.antCls}-spin-nested-loading`]: {\n height: '100%',\n\n [`${token.antCls}-spin-container`]: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n\n [`${token.antCls}-table:not(${token.antCls}-table-empty)`]: {\n display: 'flex',\n flex: 'auto',\n flexDirection: 'column',\n width: '100%',\n minHeight: 0,\n\n [`${token.antCls}-table-container`]: {\n flex: 'auto',\n minHeight: 0,\n\n [`${token.antCls}-table-content`]: {\n maxHeight: '100%',\n // 把容器再多撑高1px,否则会始终显示纵向滚动条\n paddingBottom: 1,\n // 自动显示纵向滚动条\n // stylelint-disable-next-line declaration-no-important\n overflow: 'auto !important',\n\n '& > table': {\n height: '100%',\n\n [`${token.antCls}-table-thead`]: {\n position: 'sticky',\n top: 0,\n zIndex: 10,\n },\n\n td: {\n // 当嵌套表格时,还原所有full-height样式,防止子表格受影响\n '.easy-full-height-table': {\n height: 'auto',\n },\n },\n },\n },\n },\n },\n [`& > ${token.antCls}-table-pagination`]: {\n flex: 'none',\n marginBottom: 0,\n },\n },\n },\n },\n },\n };\n};\n\nexport default genStyleHooks('EasyConfigProvider' as never, genStyle);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AA0E9B,IAAM,WAA6C,CAAC,UAAqB;AACvE,QAAM,EAAE,aAAa,IAAI;AACzB,SAAO;AAAA,IACL,CAAC,YAAY,GAAG;AAAA,MACd,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,MACV,WAAW;AAAA,MAEX,2BAA2B;AAAA,QACzB,QAAQ;AAAA,QAER,CAAC,GAAG,MAAM,4BAA4B,GAAG;AAAA,UACvC,QAAQ;AAAA,UAER,CAAC,GAAG,MAAM,uBAAuB,GAAG;AAAA,YAClC,SAAS;AAAA,YACT,eAAe;AAAA,YACf,QAAQ;AAAA,YAER,CAAC,GAAG,MAAM,oBAAoB,MAAM,qBAAqB,GAAG;AAAA,cAC1D,SAAS;AAAA,cACT,MAAM;AAAA,cACN,eAAe;AAAA,cACf,OAAO;AAAA,cACP,WAAW;AAAA,cAEX,CAAC,GAAG,MAAM,wBAAwB,GAAG;AAAA,gBACnC,MAAM;AAAA,gBACN,WAAW;AAAA,gBAEX,CAAC,GAAG,MAAM,sBAAsB,GAAG;AAAA,kBACjC,WAAW;AAAA;AAAA,kBAEX,eAAe;AAAA;AAAA;AAAA,kBAGf,UAAU;AAAA,kBAEV,aAAa;AAAA,oBACX,QAAQ;AAAA,oBAER,CAAC,GAAG,MAAM,oBAAoB,GAAG;AAAA,sBAC/B,UAAU;AAAA,sBACV,KAAK;AAAA,sBACL,QAAQ;AAAA,oBACV;AAAA,oBAEA,IAAI;AAAA;AAAA,sBAEF,2BAA2B;AAAA,wBACzB,QAAQ;AAAA,sBACV;AAAA,oBACF;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,YACA,CAAC,OAAO,MAAM,yBAAyB,GAAG;AAAA,cACxC,MAAM;AAAA,cACN,cAAc;AAAA,YAChB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,oBAAQ,+BAAc,sBAA+B,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -11,9 +11,9 @@ import { type ActionComponentInterface } from '../ConfirmAction/withConfirmActio
|
|
|
11
11
|
*/
|
|
12
12
|
export default function withDeleteConfirmAction<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): (<TriggerProp extends object, Event extends keyof TriggerProp>(props: import("react").PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & Omit<import("antd").ModalFuncProps, "onOk"> & import("../ConfirmAction").ConfirmActionTrigger<TriggerProp, Event> & {
|
|
13
13
|
danger?: boolean | undefined;
|
|
14
|
-
titleColor?: import("antd/es/typography/Base").BaseType |
|
|
15
|
-
contentColor?: import("antd/es/typography/Base").BaseType |
|
|
16
|
-
iconColor?: import("antd/es/typography/Base").BaseType |
|
|
14
|
+
titleColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
15
|
+
contentColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
16
|
+
iconColor?: "primary" | import("antd/es/typography/Base").BaseType | undefined;
|
|
17
17
|
onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown) | undefined;
|
|
18
18
|
afterOk?: ((data?: any) => void) | undefined;
|
|
19
19
|
} & import("react").RefAttributes<import("../ConfirmAction").ConfirmActionRef<Ref>>) => import("react").ReactNode) & import("../ConfirmAction/withConfirmAction").TypedTriggers<P, Ref>;
|
|
@@ -47,7 +47,7 @@ function withEllipsisTypography(Component) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}, [text, isAuto, dom]);
|
|
50
|
-
return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { title: tooltipTitle }, /* @__PURE__ */ React.createElement(
|
|
50
|
+
return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { ...ellipsis == null ? void 0 : ellipsis.tooltip, title: tooltipTitle }, /* @__PURE__ */ React.createElement(
|
|
51
51
|
Component,
|
|
52
52
|
{
|
|
53
53
|
ref: setDom,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/EllipsisTypography/withEllipsisTypography.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { ComponentType } from 'react';\nimport { useEffect, useMemo, useState } from 'react';\nimport type { TooltipProps } from 'antd';\nimport { Tooltip } from 'antd';\nimport type { EllipsisConfig } from 'antd/es/typography/Base';\nimport type { ParagraphProps } from 'antd/es/typography/Paragraph';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport type { TitleProps } from 'antd/es/typography/Title';\n\nfunction withEllipsisTypography<T extends TextProps | ParagraphProps | TitleProps>(\n Component: ComponentType<MakeEllipsisTypographyProps<T>>\n) {\n return function EllipsisText(props: MakeEllipsisTypographyProps<T>) {\n const { ellipsis, text, ...rest } = props;\n const [isEllipsis, setIsEllipsis] = useState(false);\n const [dom, setDom] = useState<HTMLElement | null>(null);\n const isAutoEllipsis = useMemo(() => ellipsis === true, [ellipsis]);\n const isAutoTooltip = useMemo(() => typeof ellipsis === 'object' && ellipsis.tooltip === true, [ellipsis]);\n const isAutoTooltipTitle = useMemo(\n () =>\n typeof ellipsis === 'object' &&\n ellipsis.tooltip &&\n typeof ellipsis.tooltip === 'object' &&\n 'title' in ellipsis.tooltip &&\n ellipsis.tooltip.title === true,\n [ellipsis]\n );\n const isAuto = useMemo(\n () => isAutoEllipsis || isAutoTooltip || isAutoTooltipTitle,\n [isAutoEllipsis, isAutoTooltip, isAutoTooltipTitle]\n );\n const tooltipTitle = useMemo(() => (isEllipsis ? text : undefined), [isEllipsis, text]);\n\n useEffect(() => {\n if (dom && isAuto) {\n Promise.resolve().then(() => {\n setIsEllipsis(dom.scrollWidth > dom.clientWidth || dom.scrollHeight > dom.clientHeight);\n });\n }\n }, [text, isAuto, dom]);\n\n return (\n <Tooltip title={tooltipTitle}>\n <Component\n ref={setDom}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(rest as any)}\n ellipsis={\n isAutoEllipsis\n ? { tooltip: undefined }\n : isAutoTooltip\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: undefined,\n }\n : isAutoTooltipTitle\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: {\n ...((ellipsis as EllipsisConfig)?.tooltip as TooltipProps),\n title: undefined,\n },\n }\n : ellipsis\n }\n >\n {text}\n </Component>\n </Tooltip>\n );\n };\n}\n\nexport type MakeEllipsisTypographyProps<T> = Omit<T, 'children'> & {\n text: string | undefined;\n};\n\nexport default withEllipsisTypography;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAE7C,kBAAwB;AAMxB,SAAS,uBACP,WACA;AACA,SAAO,SAAS,aAAa,OAAuC;AAClE,UAAM,EAAE,UAAU,MAAM,GAAG,KAAK,IAAI;AACpC,UAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,UAAM,CAAC,KAAK,MAAM,QAAI,uBAA6B,IAAI;AACvD,UAAM,qBAAiB,sBAAQ,MAAM,aAAa,MAAM,CAAC,QAAQ,CAAC;AAClE,UAAM,oBAAgB,sBAAQ,MAAM,OAAO,aAAa,YAAY,SAAS,YAAY,MAAM,CAAC,QAAQ,CAAC;AACzG,UAAM,yBAAqB;AAAA,MACzB,MACE,OAAO,aAAa,YACpB,SAAS,WACT,OAAO,SAAS,YAAY,YAC5B,WAAW,SAAS,WACpB,SAAS,QAAQ,UAAU;AAAA,MAC7B,CAAC,QAAQ;AAAA,IACX;AACA,UAAM,aAAS;AAAA,MACb,MAAM,kBAAkB,iBAAiB;AAAA,MACzC,CAAC,gBAAgB,eAAe,kBAAkB;AAAA,IACpD;AACA,UAAM,mBAAe,sBAAQ,MAAO,aAAa,OAAO,QAAY,CAAC,YAAY,IAAI,CAAC;AAEtF,gCAAU,MAAM;AACd,UAAI,OAAO,QAAQ;AACjB,gBAAQ,QAAQ,EAAE,KAAK,MAAM;AAC3B,wBAAc,IAAI,cAAc,IAAI,eAAe,IAAI,eAAe,IAAI,YAAY;AAAA,QACxF,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,MAAM,QAAQ,GAAG,CAAC;AAEtB,WACE,oCAAC,
|
|
4
|
+
"sourcesContent": ["import type { ComponentType } from 'react';\nimport { useEffect, useMemo, useState } from 'react';\nimport type { TooltipProps } from 'antd';\nimport { Tooltip } from 'antd';\nimport type { EllipsisConfig } from 'antd/es/typography/Base';\nimport type { ParagraphProps } from 'antd/es/typography/Paragraph';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport type { TitleProps } from 'antd/es/typography/Title';\n\nfunction withEllipsisTypography<T extends TextProps | ParagraphProps | TitleProps>(\n Component: ComponentType<MakeEllipsisTypographyProps<T>>\n) {\n return function EllipsisText(props: MakeEllipsisTypographyProps<T>) {\n const { ellipsis, text, ...rest } = props;\n const [isEllipsis, setIsEllipsis] = useState(false);\n const [dom, setDom] = useState<HTMLElement | null>(null);\n const isAutoEllipsis = useMemo(() => ellipsis === true, [ellipsis]);\n const isAutoTooltip = useMemo(() => typeof ellipsis === 'object' && ellipsis.tooltip === true, [ellipsis]);\n const isAutoTooltipTitle = useMemo(\n () =>\n typeof ellipsis === 'object' &&\n ellipsis.tooltip &&\n typeof ellipsis.tooltip === 'object' &&\n 'title' in ellipsis.tooltip &&\n ellipsis.tooltip.title === true,\n [ellipsis]\n );\n const isAuto = useMemo(\n () => isAutoEllipsis || isAutoTooltip || isAutoTooltipTitle,\n [isAutoEllipsis, isAutoTooltip, isAutoTooltipTitle]\n );\n const tooltipTitle = useMemo(() => (isEllipsis ? text : undefined), [isEllipsis, text]);\n\n useEffect(() => {\n if (dom && isAuto) {\n Promise.resolve().then(() => {\n setIsEllipsis(dom.scrollWidth > dom.clientWidth || dom.scrollHeight > dom.clientHeight);\n });\n }\n }, [text, isAuto, dom]);\n\n return (\n <Tooltip {...((ellipsis as EllipsisConfig)?.tooltip as TooltipProps)} title={tooltipTitle}>\n <Component\n ref={setDom}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(rest as any)}\n ellipsis={\n isAutoEllipsis\n ? { tooltip: undefined }\n : isAutoTooltip\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: undefined,\n }\n : isAutoTooltipTitle\n ? {\n ...(ellipsis as EllipsisConfig),\n tooltip: {\n ...((ellipsis as EllipsisConfig)?.tooltip as TooltipProps),\n title: undefined,\n },\n }\n : ellipsis\n }\n >\n {text}\n </Component>\n </Tooltip>\n );\n };\n}\n\nexport type MakeEllipsisTypographyProps<T> = Omit<T, 'children'> & {\n text: string | undefined;\n};\n\nexport default withEllipsisTypography;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAE7C,kBAAwB;AAMxB,SAAS,uBACP,WACA;AACA,SAAO,SAAS,aAAa,OAAuC;AAClE,UAAM,EAAE,UAAU,MAAM,GAAG,KAAK,IAAI;AACpC,UAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,UAAM,CAAC,KAAK,MAAM,QAAI,uBAA6B,IAAI;AACvD,UAAM,qBAAiB,sBAAQ,MAAM,aAAa,MAAM,CAAC,QAAQ,CAAC;AAClE,UAAM,oBAAgB,sBAAQ,MAAM,OAAO,aAAa,YAAY,SAAS,YAAY,MAAM,CAAC,QAAQ,CAAC;AACzG,UAAM,yBAAqB;AAAA,MACzB,MACE,OAAO,aAAa,YACpB,SAAS,WACT,OAAO,SAAS,YAAY,YAC5B,WAAW,SAAS,WACpB,SAAS,QAAQ,UAAU;AAAA,MAC7B,CAAC,QAAQ;AAAA,IACX;AACA,UAAM,aAAS;AAAA,MACb,MAAM,kBAAkB,iBAAiB;AAAA,MACzC,CAAC,gBAAgB,eAAe,kBAAkB;AAAA,IACpD;AACA,UAAM,mBAAe,sBAAQ,MAAO,aAAa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