@zamlia/mini-ui 0.0.12 → 0.0.13
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/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +762 -33
- package/es/index.js.map +1 -1
- package/es/types/components.d.ts +13 -0
- package/es/types/components.d.ts.map +1 -0
- package/es/types/index.d.ts +8 -0
- package/es/types/index.d.ts.map +1 -0
- package/es/types/utils.d.ts +70 -0
- package/es/types/utils.d.ts.map +1 -0
- package/es/utils/cache.d.ts +6 -0
- package/es/utils/cache.d.ts.map +1 -0
- package/es/utils/index.d.ts +73 -33
- package/es/utils/index.d.ts.map +1 -1
- package/es/utils/lib/format.utils.d.ts +29 -0
- package/es/utils/lib/format.utils.d.ts.map +1 -0
- package/es/utils/lib/is.utils.d.ts +128 -0
- package/es/utils/lib/is.utils.d.ts.map +1 -0
- package/es/utils/lib/mini.utils.d.ts +78 -0
- package/es/utils/lib/mini.utils.d.ts.map +1 -0
- package/es/utils/lib/object.utils.d.ts +40 -0
- package/es/utils/lib/object.utils.d.ts.map +1 -0
- package/es/utils/lib/pay.utils.d.ts +25 -0
- package/es/utils/lib/pay.utils.d.ts.map +1 -0
- package/es/utils/lib/string.utils.d.ts +36 -0
- package/es/utils/lib/string.utils.d.ts.map +1 -0
- package/lib/index.d.ts +155 -34
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +762 -33
- package/lib/index.js.map +1 -1
- package/lib/types/components.d.ts +13 -0
- package/lib/types/components.d.ts.map +1 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/utils.d.ts +70 -0
- package/lib/types/utils.d.ts.map +1 -0
- package/lib/utils/cache.d.ts +6 -0
- package/lib/utils/cache.d.ts.map +1 -0
- package/lib/utils/index.d.ts +73 -33
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/lib/format.utils.d.ts +29 -0
- package/lib/utils/lib/format.utils.d.ts.map +1 -0
- package/lib/utils/lib/is.utils.d.ts +128 -0
- package/lib/utils/lib/is.utils.d.ts.map +1 -0
- package/lib/utils/lib/mini.utils.d.ts +78 -0
- package/lib/utils/lib/mini.utils.d.ts.map +1 -0
- package/lib/utils/lib/object.utils.d.ts +40 -0
- package/lib/utils/lib/object.utils.d.ts.map +1 -0
- package/lib/utils/lib/pay.utils.d.ts +25 -0
- package/lib/utils/lib/pay.utils.d.ts.map +1 -0
- package/lib/utils/lib/string.utils.d.ts +36 -0
- package/lib/utils/lib/string.utils.d.ts.map +1 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,87 @@ import React, { CSSProperties, PropsWithChildren, MutableRefObject } from 'react
|
|
|
2
2
|
import { PopupProps, DialogProps } from '@nutui/nutui-react-taro';
|
|
3
3
|
import { ITouchEvent } from '@tarojs/components';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 组件类型统一入口 - Components
|
|
7
|
+
* 约定:组件 Props 以 XxxProps 命名,Ref 以 XxxRef 命名
|
|
8
|
+
*/
|
|
9
|
+
/** 组件基础 Props:通用可选能力 */
|
|
10
|
+
interface BaseComponentProps {
|
|
11
|
+
/** 自定义类名 */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** 自定义样式 */
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 工具类型统一入口 - Utils
|
|
19
|
+
* 约定:请求参数以 XxxParams 命名,返回/结果以 XxxResult 命名,实体以语义命名(如 GeoLocation)
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* 经纬度信息
|
|
23
|
+
*/
|
|
24
|
+
type GeoLocation = {
|
|
25
|
+
/** 经度 */
|
|
26
|
+
longitude: number;
|
|
27
|
+
/** 纬度 */
|
|
28
|
+
latitude: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 弹窗
|
|
32
|
+
*/
|
|
33
|
+
type ShowToast = {
|
|
34
|
+
/** 提示的内容 */
|
|
35
|
+
title: string;
|
|
36
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
37
|
+
complete?: (res: TaroGeneral.CallbackResult) => void;
|
|
38
|
+
/** 提示的延迟时间 */
|
|
39
|
+
duration?: number;
|
|
40
|
+
/** 接口调用失败的回调函数 */
|
|
41
|
+
fail?: (res: TaroGeneral.CallbackResult) => void;
|
|
42
|
+
/** 图标
|
|
43
|
+
*
|
|
44
|
+
* 可选值:
|
|
45
|
+
* - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
|
|
46
|
+
* - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
|
|
47
|
+
* - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
|
|
48
|
+
* - 'none': 不显示图标,此时 title 文本最多可显示两行 */
|
|
49
|
+
icon?: 'success' | 'error' | 'loading' | 'none';
|
|
50
|
+
/** 自定义图标的本地路径,image 的优先级高于 icon */
|
|
51
|
+
image?: string;
|
|
52
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
|
53
|
+
mask?: boolean;
|
|
54
|
+
/** 接口调用成功的回调函数 */
|
|
55
|
+
success?: (res: TaroGeneral.CallbackResult) => void;
|
|
56
|
+
};
|
|
57
|
+
type SignType =
|
|
58
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
59
|
+
'MD5'
|
|
60
|
+
/** 仅在微信支付 v2 版本接口适用 */
|
|
61
|
+
| 'HMAC-SHA256'
|
|
62
|
+
/** 仅在微信支付 v3 版本接口适用 */
|
|
63
|
+
| 'RSA';
|
|
64
|
+
/**
|
|
65
|
+
* 微信支付结果
|
|
66
|
+
*/
|
|
67
|
+
type WechatPayResult = {
|
|
68
|
+
timeStamp: string;
|
|
69
|
+
nonceStr: string;
|
|
70
|
+
packageValue: string;
|
|
71
|
+
signType?: SignType;
|
|
72
|
+
paySign: string;
|
|
73
|
+
tradeId: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 微信支付参数
|
|
77
|
+
*/
|
|
78
|
+
interface WechatPayParams {
|
|
79
|
+
timeStamp: string;
|
|
80
|
+
nonceStr: string;
|
|
81
|
+
package: string;
|
|
82
|
+
signType?: SignType;
|
|
83
|
+
paySign: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
5
86
|
type BottomPopupProps = {
|
|
6
87
|
/**
|
|
7
88
|
* 标题
|
|
@@ -536,50 +617,90 @@ declare const CitySelectButton: React.FC<CitySelectButtonProps>;
|
|
|
536
617
|
*/
|
|
537
618
|
declare const Utils: {
|
|
538
619
|
/**
|
|
539
|
-
*
|
|
540
|
-
* @
|
|
541
|
-
* @
|
|
542
|
-
|
|
543
|
-
|
|
620
|
+
* 获取随机数
|
|
621
|
+
* @public
|
|
622
|
+
* @param {number} min 最小值
|
|
623
|
+
* @param {number} max 最大值
|
|
624
|
+
* @returns {number}
|
|
625
|
+
*/
|
|
626
|
+
getRandom(min: number, max: number): number;
|
|
627
|
+
/**
|
|
628
|
+
* base64转图片Url
|
|
629
|
+
* @public
|
|
630
|
+
* @param {string} base64Url base64 url
|
|
631
|
+
* @returns {string}
|
|
632
|
+
*/
|
|
633
|
+
base64ToImgUrl(base64Url: string): string;
|
|
544
634
|
/**
|
|
545
635
|
* 深拷贝对象
|
|
546
636
|
* @param obj 要拷贝的对象
|
|
547
637
|
* @returns 深拷贝后的新对象
|
|
548
638
|
*/
|
|
549
639
|
cloneDeep<T>(obj: T): T;
|
|
550
|
-
/**
|
|
551
|
-
* 判断 URL 是否是图片
|
|
552
|
-
* @param url 要检查的 URL
|
|
553
|
-
* @returns 如果是图片返回 true,否则返回 false
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* isImg('https://example.com/image.jpg') // => true
|
|
557
|
-
* isImg('https://example.com/image.png') // => true
|
|
558
|
-
* isImg('https://example.com/video.mp4') // => false
|
|
559
|
-
*/
|
|
560
|
-
isImg(url: string): boolean;
|
|
561
|
-
/**
|
|
562
|
-
* 判断 URL 是否是视频
|
|
563
|
-
* @param url 要检查的 URL
|
|
564
|
-
* @returns 如果是视频返回 true,否则返回 false
|
|
565
|
-
*
|
|
566
|
-
* @example
|
|
567
|
-
* isVideo('https://example.com/video.mp4') // => true
|
|
568
|
-
* isVideo('https://example.com/video.mov') // => true
|
|
569
|
-
* isVideo('https://example.com/image.jpg') // => false
|
|
570
|
-
*/
|
|
571
|
-
isVideo(url: string): boolean;
|
|
572
|
-
/**
|
|
573
|
-
* 将字符串多余长度转化为...
|
|
574
|
-
* @param str 字符串
|
|
575
|
-
* @param len 字符串长度
|
|
576
|
-
*/
|
|
577
|
-
substr(str: string, len: number): string;
|
|
578
640
|
/**
|
|
579
641
|
* 等待
|
|
580
642
|
*/
|
|
581
643
|
delay: (delayTime?: number) => Promise<void>;
|
|
644
|
+
onlinePay: (payParams: WechatPayParams, tradeId?: string) => Promise<boolean>;
|
|
645
|
+
wechatPay: (payParams: WechatPayParams, tradeId?: string) => Promise<boolean>;
|
|
646
|
+
aliPay: (tradeId?: string) => Promise<boolean>;
|
|
647
|
+
dev: () => void;
|
|
648
|
+
env: (isCapitalization?: boolean) => string;
|
|
649
|
+
envText: () => string;
|
|
650
|
+
showToast: (params: ShowToast & {
|
|
651
|
+
delay
|
|
652
|
+
/**
|
|
653
|
+
* 深拷贝对象
|
|
654
|
+
* @param obj 要拷贝的对象
|
|
655
|
+
* @returns 深拷贝后的新对象
|
|
656
|
+
*/
|
|
657
|
+
?: number;
|
|
658
|
+
}) => void;
|
|
659
|
+
setCopyContent(content: string): void;
|
|
660
|
+
scanCode: (isonlyFromCamera?: boolean) => Promise<string>;
|
|
661
|
+
miniLogin: () => Promise<void | string>;
|
|
662
|
+
getLocation(): Promise<GeoLocation>;
|
|
663
|
+
updateVersion(): void;
|
|
664
|
+
openLocation: (location?: number[], options?: {
|
|
665
|
+
scale?: number;
|
|
666
|
+
name?: string;
|
|
667
|
+
address?: string;
|
|
668
|
+
}) => void;
|
|
669
|
+
previewImage(current: string, urlArr: string[]): void;
|
|
670
|
+
setCacheParams: (params: Record<string, any>) => void;
|
|
671
|
+
getCacheParams: () => Record<string, any>;
|
|
672
|
+
removeCacheParams: () => void;
|
|
673
|
+
jsonStrToObj(jsonStr: string): Record<string, any>;
|
|
674
|
+
objectToParams(params: Record<string, any>): string;
|
|
675
|
+
objectCleanEmpty(obj: Record<string, any>): Record<string, any>;
|
|
676
|
+
shuffle(arr: (Record<string, any> | string | number)[]): (Record<string, any> | string | number)[];
|
|
677
|
+
arrayToTree<T>(array?: T[], id?: string, parentId?: string, children?: string): Array<T>;
|
|
678
|
+
formatAmount(amount: string | number): string;
|
|
679
|
+
formatDate(time: string, format?: string): string;
|
|
680
|
+
formatDateCn(dateStr: string): string;
|
|
681
|
+
substr(str: string, len: number): string;
|
|
682
|
+
generateNonceStr: (len: number) => string;
|
|
683
|
+
urlEcode: (url: string) => string;
|
|
684
|
+
urlDecode: (url: string) => string;
|
|
685
|
+
hexToRgbaColor(colorCode: string, opacity?: number): string;
|
|
686
|
+
isAlipay: () => boolean;
|
|
687
|
+
isWeapp: () => boolean;
|
|
688
|
+
isNumberStr(str: string): boolean;
|
|
689
|
+
isText: (value: string) => boolean;
|
|
690
|
+
isHexColor(text: string): boolean;
|
|
691
|
+
isRgbOrRgbaColor(text: string): boolean;
|
|
692
|
+
isMobile(text: string): boolean;
|
|
693
|
+
isPhone(text: string): boolean;
|
|
694
|
+
isEmail(text: string): boolean;
|
|
695
|
+
isURL(text: string): boolean;
|
|
696
|
+
isIdCard(text: string): boolean;
|
|
697
|
+
isMoney(text: string): boolean;
|
|
698
|
+
isName(text: string): boolean;
|
|
699
|
+
isCompanyCode(text: string): boolean;
|
|
700
|
+
isEmpty(value: any): boolean;
|
|
701
|
+
isImg(url: string): boolean;
|
|
702
|
+
isVideo(url: string): boolean;
|
|
582
703
|
};
|
|
583
704
|
|
|
584
705
|
export { _default as BottomPopup, Card, CitySelectButton, DataSelect, Modal, NavBar, Page, PaymentMethodSelect, WrappedPullToPushRefresh as PullToPushRefresh, Radio, Tabs, UploadFile, Utils, VideoView };
|
|
585
|
-
export type { BottomPopupProps, CardProps, CitySelectButtonProps, DataSelectProps, ModalProps, NavBarProps, PageProps, PaymentMethod, PaymentMethodSelectProps, PullToPushRefreshProps, RadioProps, TabsProps, UploadFileProps, VideoViewProps };
|
|
706
|
+
export type { BaseComponentProps, BottomPopupProps, CardProps, CitySelectButtonProps, DataSelectProps, GeoLocation, ModalProps, NavBarProps, PageProps, PaymentMethod, PaymentMethodSelectProps, PullToPushRefreshProps, RadioProps, ShowToast, TabsProps, UploadFileProps, VideoViewProps, WechatPayParams, WechatPayResult };
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAA;AAGnC,cAAc,uBAAuB,CAAA;AAGrC,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AAGvB,cAAc,qBAAqB,CAAA;AAGnC,cAAc,uBAAuB,CAAA;AAGrC,cAAc,SAAS,CAAA"}
|