@jiaozhiye/qm-design-react 1.7.23 → 1.7.25
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/lib/hooks/useEvent.d.ts +2 -0
- package/lib/hooks/useLocale.d.ts +4 -0
- package/lib/hooks/useSize.d.ts +9 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/lang/en.d.ts +5 -0
- package/lib/locale/lang/en.js +10 -5
- package/lib/locale/lang/zh-cn.d.ts +5 -0
- package/lib/locale/lang/zh-cn.js +10 -5
- package/lib/style/index.css +144 -1
- package/lib/style/index.less +38 -37
- package/lib/style/index.min.css +1 -1
- package/lib/tour/index.d.ts +4 -0
- package/lib/tour/src/Mask.d.ts +17 -0
- package/lib/tour/src/Tour.d.ts +32 -0
- package/lib/tour/src/TourStep/DefaultPanel.d.ts +4 -0
- package/lib/tour/src/TourStep/index.d.ts +32 -0
- package/lib/tour/src/hooks/useTarget.d.ts +13 -0
- package/lib/tour/src/placements.d.ts +29 -0
- package/lib/tour/src/util.d.ts +3 -0
- package/lib/tour/style/index.less +138 -0
- package/lib/version/index.d.ts +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PosInfo } from './hooks/useTarget';
|
|
3
|
+
export type MaskProps = {
|
|
4
|
+
prefixCls?: string;
|
|
5
|
+
pos: PosInfo;
|
|
6
|
+
rootClassName?: string;
|
|
7
|
+
showMask?: boolean;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
fill?: string;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
animated?: boolean | {
|
|
12
|
+
placeholder: boolean;
|
|
13
|
+
};
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
};
|
|
16
|
+
declare const Mask: React.FC<MaskProps>;
|
|
17
|
+
export default Mask;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Gap } from './hooks/useTarget';
|
|
3
|
+
import type { PlacementType } from './placements';
|
|
4
|
+
import type { TourStepInfo, TourStepProps } from './TourStep';
|
|
5
|
+
import type { TriggerProps } from '@rc-component/trigger';
|
|
6
|
+
export interface TourProps extends Pick<TriggerProps, 'onPopupAlign' | 'builtinPlacements'> {
|
|
7
|
+
steps?: TourStepInfo[];
|
|
8
|
+
open?: boolean;
|
|
9
|
+
defaultCurrent?: number;
|
|
10
|
+
current?: number;
|
|
11
|
+
onChange?: (current: number) => void;
|
|
12
|
+
onClose?: (current: number) => void;
|
|
13
|
+
onFinish?: () => void;
|
|
14
|
+
mask?: boolean | {
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
color?: string;
|
|
17
|
+
};
|
|
18
|
+
arrow?: boolean | {
|
|
19
|
+
pointAtCenter: boolean;
|
|
20
|
+
};
|
|
21
|
+
rootClassName?: string;
|
|
22
|
+
placement?: PlacementType;
|
|
23
|
+
renderPanel?: (props: TourStepProps, current: number) => React.ReactNode;
|
|
24
|
+
gap?: Gap;
|
|
25
|
+
animated?: boolean | {
|
|
26
|
+
placeholder: boolean;
|
|
27
|
+
};
|
|
28
|
+
scrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
}
|
|
31
|
+
declare const Tour: React.FC<TourProps>;
|
|
32
|
+
export default Tour;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PlacementType } from '../placements';
|
|
3
|
+
export interface TourStepInfo {
|
|
4
|
+
arrow?: boolean | {
|
|
5
|
+
pointAtCenter: boolean;
|
|
6
|
+
};
|
|
7
|
+
target?: HTMLElement | (() => HTMLElement) | null | (() => null);
|
|
8
|
+
cover?: React.ReactNode;
|
|
9
|
+
title: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
placement?: PlacementType;
|
|
12
|
+
mask?: boolean | {
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
color?: string;
|
|
15
|
+
};
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
scrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
|
|
19
|
+
indicatorsRender?: (current: number, total: number) => React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface TourStepProps extends TourStepInfo {
|
|
22
|
+
prefixCls?: string;
|
|
23
|
+
total?: number;
|
|
24
|
+
current?: number;
|
|
25
|
+
onClose?: () => void;
|
|
26
|
+
onFinish?: () => void;
|
|
27
|
+
renderPanel?: (step: TourStepProps, current: number) => React.ReactNode;
|
|
28
|
+
onPrev?: () => void;
|
|
29
|
+
onNext?: () => void;
|
|
30
|
+
}
|
|
31
|
+
declare const TourStep: (props: TourStepProps) => React.JSX.Element;
|
|
32
|
+
export default TourStep;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TourStepInfo } from '../TourStep';
|
|
2
|
+
export interface Gap {
|
|
3
|
+
offset?: number;
|
|
4
|
+
radius?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface PosInfo {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
radius: number;
|
|
12
|
+
}
|
|
13
|
+
export default function useTarget(target: TourStepInfo['target'], open: boolean, gap?: Gap, scrollIntoViewOptions?: boolean | ScrollIntoViewOptions): [PosInfo, HTMLElement];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BuildInPlacements } from '@rc-component/trigger';
|
|
2
|
+
export interface AdjustOverflow {
|
|
3
|
+
adjustX?: 0 | 1;
|
|
4
|
+
adjustY?: 0 | 1;
|
|
5
|
+
}
|
|
6
|
+
export interface PlacementsConfig {
|
|
7
|
+
arrowWidth: number;
|
|
8
|
+
arrowPointAtCenter?: boolean;
|
|
9
|
+
autoAdjustOverflow?: boolean | AdjustOverflow;
|
|
10
|
+
offset: number;
|
|
11
|
+
borderRadius: number;
|
|
12
|
+
visibleFirst?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const MAX_VERTICAL_CONTENT_RADIUS = 8;
|
|
15
|
+
export declare function getArrowOffset(options: {
|
|
16
|
+
contentRadius: number;
|
|
17
|
+
limitVerticalRadius?: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
dropdownArrowOffset: number;
|
|
20
|
+
dropdownArrowOffsetVertical: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function getOverflowOptions(placement: string, arrowOffset: ReturnType<typeof getArrowOffset>, arrowWidth: number, autoAdjustOverflow?: boolean | AdjustOverflow): {
|
|
23
|
+
adjustX?: number | boolean | undefined;
|
|
24
|
+
adjustY?: number | boolean | undefined;
|
|
25
|
+
shiftX?: number | boolean | undefined;
|
|
26
|
+
shiftY?: number | boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
export type PlacementType = keyof BuildInPlacements;
|
|
29
|
+
export default function getPlacements(config: PlacementsConfig): BuildInPlacements;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 焦质晔
|
|
3
|
+
* @Date: 2022-01-11 18:01:20
|
|
4
|
+
* @Last Modified by: 焦质晔
|
|
5
|
+
* @Last Modified time: 2023-07-25 21:19:51
|
|
6
|
+
*/
|
|
7
|
+
@import '../../style/common';
|
|
8
|
+
|
|
9
|
+
@prefix-tour: ~'@{qm-prefix}-tour';
|
|
10
|
+
|
|
11
|
+
.@{prefix-tour} {
|
|
12
|
+
.reset-container();
|
|
13
|
+
position: absolute;
|
|
14
|
+
display: block;
|
|
15
|
+
visibility: visible;
|
|
16
|
+
min-width: 500px;
|
|
17
|
+
&-hidden {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
& &-arrow {
|
|
21
|
+
display: block;
|
|
22
|
+
width: 15px;
|
|
23
|
+
height: 15px;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
&::before {
|
|
28
|
+
content: '';
|
|
29
|
+
position: absolute;
|
|
30
|
+
bottom: 0px;
|
|
31
|
+
inset-inline-start: 0px;
|
|
32
|
+
width: 15px;
|
|
33
|
+
height: 8px;
|
|
34
|
+
clip-path: path('M 0 8 A 4 4 0 0 0 2.82843 6.82843 L 6.58579 3.07107 A 2 2 0 0 1 9.41421 3.07107 L 13.1716 6.82843 A 4 4 0 0 0 16 8 Z');
|
|
35
|
+
background-color: #fff;
|
|
36
|
+
}
|
|
37
|
+
&::after {
|
|
38
|
+
content: '';
|
|
39
|
+
position: absolute;
|
|
40
|
+
width: 8.97056px;
|
|
41
|
+
height: 8.97056px;
|
|
42
|
+
bottom: 0px;
|
|
43
|
+
transform: translateY(50%) rotate(-135deg);
|
|
44
|
+
box-shadow: rgba(0, 0, 0, 0.05) 2px 2px 5px;
|
|
45
|
+
z-index: 0;
|
|
46
|
+
inset-inline: 0px;
|
|
47
|
+
margin: auto;
|
|
48
|
+
border-radius: 0px 0px 2px;
|
|
49
|
+
background: 0px 0px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
& &-content {
|
|
53
|
+
position: relative;
|
|
54
|
+
}
|
|
55
|
+
& &-inner {
|
|
56
|
+
box-shadow: rgba(0, 0, 0, 0.03) 0px 1px 2px 0px, rgba(0, 0, 0, 0.02) 0px 1px 6px -1px, rgba(0, 0, 0, 0.02) 0px 2px 4px 0px;
|
|
57
|
+
background-color: rgb(255, 255, 255);
|
|
58
|
+
background-clip: padding-box;
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
border-radius: 8px;
|
|
61
|
+
}
|
|
62
|
+
& &-close {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 10px;
|
|
65
|
+
inset-inline-end: 10px;
|
|
66
|
+
color: @--text-color-secondary;
|
|
67
|
+
width: 22px;
|
|
68
|
+
height: 22px;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
outline: none;
|
|
73
|
+
border-radius: 4px;
|
|
74
|
+
transition: background-color 0.2s ease 0s, color 0.2s ease 0s;
|
|
75
|
+
&:hover {
|
|
76
|
+
color: rgba(0, 0, 0, 0.88);
|
|
77
|
+
background-color: rgba(0, 0, 0, 0.06);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
& &-cover {
|
|
81
|
+
text-align: center;
|
|
82
|
+
padding: 45px 15px 0px;
|
|
83
|
+
}
|
|
84
|
+
& &-header {
|
|
85
|
+
padding: 15px 15px 8px;
|
|
86
|
+
}
|
|
87
|
+
& &-title {
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
}
|
|
90
|
+
& &-description {
|
|
91
|
+
overflow-wrap: break-word;
|
|
92
|
+
padding: 0px 15px;
|
|
93
|
+
}
|
|
94
|
+
& &-footer {
|
|
95
|
+
text-align: end;
|
|
96
|
+
display: flex;
|
|
97
|
+
padding: 8px 15px 15px;
|
|
98
|
+
}
|
|
99
|
+
& &-indicators {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
}
|
|
102
|
+
& &-indicators &-indicator {
|
|
103
|
+
width: 6px;
|
|
104
|
+
height: 6px;
|
|
105
|
+
display: inline-block;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: rgba(0, 0, 0, 0.15);
|
|
108
|
+
&-active {
|
|
109
|
+
background: @--primary-color;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
& &-indicators &-indicator:not(:last-child) {
|
|
113
|
+
margin-inline-end: 6px;
|
|
114
|
+
}
|
|
115
|
+
& &-buttons {
|
|
116
|
+
margin-inline-start: auto;
|
|
117
|
+
}
|
|
118
|
+
// =======================================
|
|
119
|
+
&-mask &-placeholder-animated {
|
|
120
|
+
transition: all 0.2s ease;
|
|
121
|
+
}
|
|
122
|
+
&-placement-bottom &-arrow {
|
|
123
|
+
left: 50%;
|
|
124
|
+
transform: translateX(-50%) translateY(-100%);
|
|
125
|
+
}
|
|
126
|
+
&-placement-top &-arrow {
|
|
127
|
+
left: 50%;
|
|
128
|
+
transform: translateX(-50%) translateY(100%) rotate(180deg);
|
|
129
|
+
}
|
|
130
|
+
&-placement-right &-arrow {
|
|
131
|
+
top: 50%;
|
|
132
|
+
transform: translateY(-50%) translateX(-100%) rotate(-90deg);
|
|
133
|
+
}
|
|
134
|
+
&-placement-left &-arrow {
|
|
135
|
+
top: 50%;
|
|
136
|
+
transform: translateY(-50%) translateX(100%) rotate(90deg);
|
|
137
|
+
}
|
|
138
|
+
}
|
package/lib/version/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const version: string;
|
|
2
|
+
export default version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jiaozhiye/qm-design-react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.25",
|
|
4
4
|
"description": "A Component Library for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"react": ">=16.14.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@rc-component/trigger": "^1.14.0",
|
|
52
53
|
"add-dom-event-listener": "^1.1.0",
|
|
53
54
|
"antd": "4.24.12",
|
|
54
55
|
"axios": "^0.27.2",
|