@jiaozhiye/qm-design-react 1.7.24 → 1.7.26
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/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 +163 -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/Pause.d.ts +10 -0
- package/lib/tour/src/Tour.d.ts +39 -0
- package/lib/tour/src/TourStep/DefaultPanel.d.ts +4 -0
- package/lib/tour/src/TourStep/index.d.ts +34 -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 +5 -0
- package/lib/tour/style/index.less +157 -0
- 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,39 @@
|
|
|
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
|
+
type?: 'default' | 'primary';
|
|
10
|
+
defaultCurrent?: number;
|
|
11
|
+
current?: number;
|
|
12
|
+
onChange?: (current: number) => void;
|
|
13
|
+
onClose?: (current: number) => void;
|
|
14
|
+
onFinish?: () => void;
|
|
15
|
+
mask?: boolean | {
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
color?: string;
|
|
18
|
+
};
|
|
19
|
+
arrow?: boolean | {
|
|
20
|
+
pointAtCenter: boolean;
|
|
21
|
+
};
|
|
22
|
+
control?: boolean;
|
|
23
|
+
rootClassName?: string;
|
|
24
|
+
placement?: PlacementType;
|
|
25
|
+
renderPanel?: (props: TourStepProps, current: number) => React.ReactNode;
|
|
26
|
+
gap?: Gap;
|
|
27
|
+
animated?: boolean | {
|
|
28
|
+
placeholder: boolean;
|
|
29
|
+
};
|
|
30
|
+
scrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
|
|
31
|
+
zIndex?: number;
|
|
32
|
+
}
|
|
33
|
+
type TourRef = {
|
|
34
|
+
OPEN: () => void;
|
|
35
|
+
CLOSE: () => void;
|
|
36
|
+
SET_ZINDEX: (value: number) => void;
|
|
37
|
+
};
|
|
38
|
+
declare const QmTour: React.ForwardRefExoticComponent<TourProps & React.RefAttributes<TourRef>>;
|
|
39
|
+
export default QmTour;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
zIndex?: number;
|
|
21
|
+
action?: (node: HTMLElement, current: number) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface TourStepProps extends TourStepInfo {
|
|
24
|
+
prefixCls?: string;
|
|
25
|
+
total?: number;
|
|
26
|
+
current?: number;
|
|
27
|
+
onClose?: () => void;
|
|
28
|
+
onFinish?: () => void;
|
|
29
|
+
renderPanel?: (step: TourStepProps, current: number) => React.ReactNode;
|
|
30
|
+
onPrev?: () => void;
|
|
31
|
+
onNext?: () => void;
|
|
32
|
+
}
|
|
33
|
+
declare const TourStep: (props: TourStepProps) => React.JSX.Element;
|
|
34
|
+
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,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PlacementType } from './placements';
|
|
3
|
+
export declare const isInViewPort: (element: HTMLElement) => boolean;
|
|
4
|
+
export declare const getPlacement: (targetElement?: HTMLElement | null, placement?: PlacementType, stepPlacement?: PlacementType) => string;
|
|
5
|
+
export declare const isValidNode: (node: React.ReactNode) => boolean;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 焦质晔
|
|
3
|
+
* @Date: 2022-01-11 18:01:20
|
|
4
|
+
* @Last Modified by: 焦质晔
|
|
5
|
+
* @Last Modified time: 2023-07-26 17:22:16
|
|
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: #fff;
|
|
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
|
+
&-control {
|
|
119
|
+
position: fixed;
|
|
120
|
+
right: 20px;
|
|
121
|
+
bottom: 20px;
|
|
122
|
+
width: 40px;
|
|
123
|
+
height: 40px;
|
|
124
|
+
border-radius: 50%;
|
|
125
|
+
border: 2px solid #fff;
|
|
126
|
+
background: linear-gradient(to right bottom, @--primary-4, @--primary-7);
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
pointer-events: auto;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
.anticon {
|
|
133
|
+
color: #fff;
|
|
134
|
+
font-size: 20px;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// =======================================
|
|
138
|
+
&-mask &-placeholder-animated {
|
|
139
|
+
transition: all 0.2s ease;
|
|
140
|
+
}
|
|
141
|
+
&-placement-bottom &-arrow {
|
|
142
|
+
left: 50%;
|
|
143
|
+
transform: translateX(-50%) translateY(-100%);
|
|
144
|
+
}
|
|
145
|
+
&-placement-top &-arrow {
|
|
146
|
+
left: 50%;
|
|
147
|
+
transform: translateX(-50%) translateY(100%) rotate(180deg);
|
|
148
|
+
}
|
|
149
|
+
&-placement-right &-arrow {
|
|
150
|
+
top: 50%;
|
|
151
|
+
transform: translateY(-50%) translateX(-100%) rotate(-90deg);
|
|
152
|
+
}
|
|
153
|
+
&-placement-left &-arrow {
|
|
154
|
+
top: 50%;
|
|
155
|
+
transform: translateY(-50%) translateX(100%) rotate(90deg);
|
|
156
|
+
}
|
|
157
|
+
}
|
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.26",
|
|
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",
|