@mi-avalon/libs 0.0.16 → 0.0.18

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.
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ export interface IMDescriptionItem {
3
+ label: React.ReactNode;
4
+ value: React.ReactNode;
5
+ span?: number;
6
+ }
7
+ export interface IMDescriptionProps {
8
+ /**
9
+ * 描述列表的数据[{label: '', value: '',}, ...]
10
+ */
11
+ data: IMDescriptionItem[];
12
+ /**
13
+ * 标题
14
+ */
15
+ title?: React.ReactNode;
16
+ /**
17
+ * 需要显示的列数
18
+ * @default 3
19
+ */
20
+ column?: 1 | 2 | 3 | 4;
21
+ /**
22
+ * 行高
23
+ */
24
+ lineHeight?: number;
25
+ /**
26
+ * 标签对齐方式
27
+ * @default 'left'
28
+ */
29
+ align?: 'left' | 'center' | 'right';
30
+ /**
31
+ * 标签和值的布局配置
32
+ */
33
+ itemLayout?: {
34
+ label?: number | undefined;
35
+ value?: number | undefined;
36
+ };
37
+ /**
38
+ * 是否显示冒号
39
+ * @default true
40
+ */
41
+ colon?: boolean;
42
+ /**
43
+ * 是否显示边框
44
+ * @default false
45
+ */
46
+ bordered?: boolean;
47
+ /**
48
+ * 自定义样式
49
+ */
50
+ style?: React.CSSProperties;
51
+ /**
52
+ * 自定义类名
53
+ */
54
+ className?: string;
55
+ /**
56
+ * 标签样式
57
+ */
58
+ labelStyle?: React.CSSProperties;
59
+ /**
60
+ * 内容样式
61
+ */
62
+ contentStyle?: React.CSSProperties;
63
+ }
64
+ declare const MDescriptions: React.FC<IMDescriptionProps>;
65
+ export { MDescriptions };
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * 详情描述列表组件
4
+ * 用于展示对象的详细信息,如用户信息、产品详情等
5
+ */
6
+ import { Descriptions } from 'antd';
7
+ const MDescriptions = props => {
8
+ const { data, title, column = 3, lineHeight, align = 'left', itemLayout, colon = true, bordered = false, style, className, labelStyle, contentStyle, } = props;
9
+ // 合并样式
10
+ const mergedLabelStyle = {
11
+ ...(lineHeight ? { lineHeight: `${lineHeight}px` } : {}),
12
+ textAlign: align,
13
+ ...(itemLayout?.label ? { width: `${itemLayout.label}px` } : {}),
14
+ ...labelStyle,
15
+ };
16
+ const mergedContentStyle = {
17
+ ...(lineHeight ? { lineHeight: `${lineHeight}px` } : {}),
18
+ ...(itemLayout?.value ? { width: `${itemLayout.value}px` } : {}),
19
+ ...contentStyle,
20
+ };
21
+ return (_jsx(Descriptions, { title: title, column: column, colon: colon, bordered: bordered, style: style, className: className, labelStyle: mergedLabelStyle, contentStyle: mergedContentStyle, children: data.map((item, index) => (_jsx(Descriptions.Item, { label: item.label, span: item.span, children: item.value || '-' }, item.label?.toString() || index))) }));
22
+ };
23
+ MDescriptions.displayName = 'MDescriptions';
24
+ export { MDescriptions };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import './index.css';
2
+ import './index.scss';
3
3
  interface MyButtonProps {
4
4
  type?: 'primary' | 'default' | 'dashed' | 'text' | 'link';
5
5
  children: React.ReactNode;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from 'antd';
3
+ import './index.scss';
4
+ const MyButton = ({ type = 'primary', children, onClick, custom }) => {
5
+ return (_jsx(Button, { type: type, onClick: onClick, className: 'my-button', children: custom || children }));
6
+ };
7
+ export default MyButton;
@@ -0,0 +1,2 @@
1
+ export * from './MDescriptions';
2
+ export { default as MyButton } from './MyButton';
@@ -0,0 +1,10 @@
1
+ // export { default as ItemRow } from './ItemsRow';
2
+ // export { default as MBreadcrumb } from './MBreadcrumb';
3
+ export * from './MDescriptions';
4
+ // export * from './MForm';
5
+ // export { default as MForm } from './MForm';
6
+ // export * from './MiModal';
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';
@@ -0,0 +1 @@
1
+ export declare const getClassName: (key1: string, key2: string) => string;
@@ -0,0 +1,16 @@
1
+ // 生成类名
2
+ export const getClassName = (key1, key2) => {
3
+ const cn = key1;
4
+ let str = key1;
5
+ if (key2.includes(' ')) {
6
+ str = '';
7
+ const nArr = key2?.split(' ');
8
+ for (const i of nArr) {
9
+ str += ` ${cn}-${i}`;
10
+ }
11
+ }
12
+ else if (key2) {
13
+ str = `${key1}-${key2}`;
14
+ }
15
+ return str;
16
+ };
@@ -0,0 +1,11 @@
1
+ export const DATE_FORMAT = {
2
+ YMD_Hms: 'YYYY-MM-DD HH:mm:ss',
3
+ YMD: 'YYYY-MM-DD',
4
+ YMD2: 'YYYYMMDD',
5
+ YMD_POINT: 'YYYY.M.DD',
6
+ Hms: 'HH:mm:ss',
7
+ Hm: 'HH:mm',
8
+ YMD_000: 'YYYY-MM-DD 00:00:00',
9
+ YMD_end: 'YYYY-MM-DD 23:59:59',
10
+ YMD_Hm: 'YYYYMMDD HHmm',
11
+ };
@@ -0,0 +1,3 @@
1
+ export * from './date';
2
+ export * from './pageInfo';
3
+ export * from './pattern';
@@ -0,0 +1 @@
1
+ export const PAGE_SIZE = 10;
@@ -0,0 +1,46 @@
1
+ export class PatternType {
2
+ // 整数
3
+ static integerRegex = /^-?\d+$/;
4
+ // 正整数
5
+ static positiveIntegerRegex = /^[1-9]\d*$/;
6
+ // 负整数
7
+ static negativeIntegerRegex = /^-[1-9]\d*$/;
8
+ // 浮点数
9
+ static floatRegex = /^-?\d+(\.\d+)?$/;
10
+ // 字母
11
+ static letter = /^[a-zA-Z]+$/;
12
+ // 汉字
13
+ static chinese = /^[\u4e00-\u9fa5]+$/;
14
+ // 数字
15
+ static number = /^[0-9]*$/;
16
+ // 用户名 字母开头,允许字母数字下划线,长度4-16
17
+ static username = /^[a-zA-Z]\w{3,15}$/;
18
+ // 强用户名 必须包含大小写字母和数字,6-20位
19
+ static strongUsername = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,20}$/;
20
+ // 密码 至少8位,包含字母和数字
21
+ static password = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/;
22
+ // 强密码 至少8位,包含大小写字母、数字和特殊字符
23
+ static strongPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
24
+ // 中国大陆的手机号
25
+ static phone = /^1[3-9]\d{9}$/;
26
+ // 带区号的手机号
27
+ static phoneWithAreaCode = /^\+?\d{2,3}-?\d{8,11}$/;
28
+ // 邮箱
29
+ static email = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
30
+ // 身份证
31
+ static idCard = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
32
+ // 银行卡
33
+ static bankCard = /^[1-9]\d{3,30}$/;
34
+ // 邮政编码
35
+ static zipCode = /^[1-9]\d{5}$/;
36
+ // IP
37
+ static ip = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
38
+ // URL
39
+ static url = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/;
40
+ // 车牌
41
+ static carNumber = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/;
42
+ // 时间 hh:mm:ss
43
+ static time = /^([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/;
44
+ // 日期 YYYY-MM-DD
45
+ static date = /^(\d{4})-(\d{2})-(\d{2})$/;
46
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export { default as MyButton } from './components/MyButton';
2
- export { default as MyInput } from './components/MyInput';
1
+ export * from './components';
3
2
  export * from './constants';