@mi-avalon/libs 0.0.19 → 0.0.21
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/dist/components/ItemsRow/index.js +1 -1
- package/dist/components/MBreadcrumb/index.d.ts +17 -0
- package/dist/components/MBreadcrumb/index.js +34 -0
- package/dist/components/MTable/index.d.ts +7 -0
- package/dist/components/MTable/index.js +10 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.js +4 -5
- package/dist/index.es.js +510 -379
- package/dist/index.umd.js +11 -11
- package/dist/style.css +1 -1
- package/dist/utils/calc.d.ts +20 -0
- package/dist/utils/calc.js +92 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/nextTick.d.ts +14 -0
- package/dist/utils/nextTick.js +74 -0
- package/dist/utils/util.d.ts +6 -0
- package/dist/utils/util.js +69 -0
- package/dist/utils/version.d.ts +70 -0
- package/dist/utils/version.js +192 -0
- package/package.json +6 -2
- package/dist/components/MyButton/index.d.ts +0 -10
- package/dist/components/MyButton/index.js +0 -7
- package/dist/components/utils.d.ts +0 -1
- package/dist/components/utils.js +0 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from 'antd';
|
|
3
|
+
import { getClassName } from '../../utils';
|
|
3
4
|
import { CompThemeProvider } from '../ThemeContext';
|
|
4
|
-
import { getClassName } from '../utils';
|
|
5
5
|
const classname = (n = '') => {
|
|
6
6
|
const cn = 'items-row';
|
|
7
7
|
return getClassName(cn, n);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IRowItem } from '../ItemsRow';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
export interface RouteItem {
|
|
5
|
+
name: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IMBreadcrumbProps {
|
|
9
|
+
routes?: RouteItem[];
|
|
10
|
+
customItems?: IRowItem[];
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
className?: string;
|
|
13
|
+
offsetTop?: number;
|
|
14
|
+
mainAppBaseUrl?: string;
|
|
15
|
+
microAppName?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const MBreadcrumb: React.FC<IMBreadcrumbProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Affix, Breadcrumb, Card } from 'antd';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { getClassName } from '../../utils';
|
|
5
|
+
import { ItemsRow } from '../ItemsRow';
|
|
6
|
+
import { CompThemeProvider } from '../ThemeContext';
|
|
7
|
+
import './index.scss';
|
|
8
|
+
const classname = (n = '') => {
|
|
9
|
+
const cn = 'm-breadcrumb';
|
|
10
|
+
return getClassName(cn, n);
|
|
11
|
+
};
|
|
12
|
+
export const MBreadcrumb = props => {
|
|
13
|
+
const { routes, customItems, style, className, offsetTop = 64, mainAppBaseUrl, microAppName, } = props;
|
|
14
|
+
const affixRef = React.useRef(null);
|
|
15
|
+
const onScroll = React.useCallback(() => {
|
|
16
|
+
affixRef.current?.updatePosition?.();
|
|
17
|
+
}, []);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
window.addEventListener('scroll', onScroll, true);
|
|
20
|
+
return () => window.removeEventListener('scroll', onScroll);
|
|
21
|
+
}, [onScroll]);
|
|
22
|
+
const getUrl = React.useCallback((url) => {
|
|
23
|
+
if (!url)
|
|
24
|
+
return '';
|
|
25
|
+
const cleanedUrl = url.replace(/^\/+/, '');
|
|
26
|
+
const parts = [
|
|
27
|
+
mainAppBaseUrl?.replace(/\/+$/, ''),
|
|
28
|
+
microAppName?.replace(/\/+$/, ''),
|
|
29
|
+
cleanedUrl,
|
|
30
|
+
].filter(Boolean);
|
|
31
|
+
return `/${parts.join('/')}`;
|
|
32
|
+
}, [mainAppBaseUrl, microAppName]);
|
|
33
|
+
return (_jsx(CompThemeProvider, { children: _jsx("div", { className: `${classname()} ${className || ''}`, style: style, children: _jsx(Affix, { ref: affixRef, offsetTop: offsetTop, children: _jsxs(Card, { className: classname('container'), rootClassName: classname('body'), variant: 'borderless', children: [_jsx(Breadcrumb, { className: classname('inner-breadcrumb'), style: { fontSize: '18px' }, children: routes?.map(v => (_jsx(Breadcrumb.Item, { children: v.url ? _jsx("a", { href: `#${getUrl(v.url)}`, children: v.name }) : v.name }, v.url || v.name))) }), _jsx("div", { className: classname('custom-item-wrapper'), children: _jsx(ItemsRow, { items: customItems }) })] }) }) }) }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 表格
|
|
4
|
+
*/
|
|
5
|
+
import { Table } from 'antd';
|
|
6
|
+
import { CompThemeProvider } from '../ThemeContext';
|
|
7
|
+
export function MTable(props) {
|
|
8
|
+
const columns = props.columns?.map(e => ({ ...e, dataIndex: e.key })) ?? [];
|
|
9
|
+
return (_jsxs(CompThemeProvider, { children: [_jsx(Table, { rowKey: e => e.id, ...props, columns: columns }), ";"] }));
|
|
10
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from './ItemsRow';
|
|
2
|
+
export * from './MBreadcrumb';
|
|
3
3
|
export * from './MDescriptions';
|
|
4
4
|
// export * from './MForm';
|
|
5
5
|
// export { default as MForm } from './MForm';
|
|
6
6
|
// export * from './MiModal';
|
|
7
7
|
// export { default as MSearch } from './MSearch';
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
// export * from './ThemeContext';
|
|
8
|
+
export * from './MTable';
|
|
9
|
+
export * from './ThemeContext';
|