@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.
@@ -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,7 @@
1
+ /**
2
+ * 表格
3
+ */
4
+ import { TableProps } from 'antd';
5
+ export interface IMTableProps extends TableProps {
6
+ }
7
+ export declare function MTable(props: IMTableProps): import("react/jsx-runtime").JSX.Element;
@@ -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
+ }
@@ -1,2 +1,5 @@
1
+ export * from './ItemsRow';
2
+ export * from './MBreadcrumb';
1
3
  export * from './MDescriptions';
2
- export { default as MyButton } from './MyButton';
4
+ export * from './MTable';
5
+ export * from './ThemeContext';
@@ -1,10 +1,9 @@
1
- // export { default as ItemRow } from './ItemsRow';
2
- // export { default as MBreadcrumb } from './MBreadcrumb';
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
- // export { default as MTable } from './MTable';
9
- export { default as MyButton } from './MyButton';
10
- // export * from './ThemeContext';
8
+ export * from './MTable';
9
+ export * from './ThemeContext';