@jiaozhiye/qm-design-react 1.7.26 → 1.7.28

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.
@@ -117,7 +117,7 @@ declare class QmForm extends Component<IProps, IState> {
117
117
  setExpandHandle(collapse: boolean): void;
118
118
  createInputFocus(): void;
119
119
  getFormItemLabel(label: string | IFormItem): string;
120
- getBlockDerivedItems(): Pick<IFormItem, "fieldName" | "label">[][];
120
+ getBlockDerivedItems(): Pick<IFormItem, "label" | "fieldName">[][];
121
121
  getFormItemDisplay({ type, fieldName }: {
122
122
  type: any;
123
123
  fieldName: any;
@@ -0,0 +1,3 @@
1
+ import GuideTracker from './src/guideTracker';
2
+ export type { GuideTrackerProps } from './src/guideTracker';
3
+ export default GuideTracker;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ type IProps = {
3
+ action: string;
4
+ onConfirm?: () => void;
5
+ onCancel?: () => void;
6
+ onFinish?: () => void;
7
+ };
8
+ declare const Panel: React.FC<IProps>;
9
+ export default Panel;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ type StepProps = {
3
+ id: string;
4
+ nodePath: string;
5
+ title: string;
6
+ };
7
+ type IOptions = Omit<StepProps, 'title'> & {
8
+ actionStatus: 'add' | 'edit';
9
+ DO_CLOSE: () => void;
10
+ };
11
+ type IProps = {
12
+ open?: boolean;
13
+ current?: number;
14
+ defaultCurrent?: number;
15
+ steps?: StepProps[];
16
+ overlayClassName?: string;
17
+ overlayStyle?: React.CSSProperties;
18
+ control?: boolean;
19
+ destroyOnHide?: boolean;
20
+ onChange?: (items: StepProps[], current: number) => void;
21
+ onClose?: (current: number) => void;
22
+ onFinish?: () => void;
23
+ contentRender?: (options: IOptions, current: number) => React.ReactNode;
24
+ };
25
+ type GuideTrackerRef = {
26
+ OPEN: () => void;
27
+ CLOSE: () => void;
28
+ GET_CURRENT_STEP: () => {
29
+ current: number;
30
+ nodePath?: string;
31
+ };
32
+ };
33
+ export type GuideTrackerProps = IProps;
34
+ declare const QmGuideTracker: React.ForwardRefExoticComponent<IProps & React.RefAttributes<GuideTrackerRef>>;
35
+ export default QmGuideTracker;
@@ -0,0 +1,2 @@
1
+ export declare function hideOverlay(): void;
2
+ export declare function showOverlay(elements: Array<HTMLElement> | null, componentName: string | null, hideAfterTimeout: boolean): void;
@@ -0,0 +1,36 @@
1
+ import type { Rect } from './utils';
2
+ type Box = {
3
+ top: number;
4
+ left: number;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ declare class OverlayRect {
9
+ node: HTMLElement;
10
+ border: HTMLElement;
11
+ padding: HTMLElement;
12
+ content: HTMLElement;
13
+ constructor(doc: Document, container: HTMLElement);
14
+ remove(): void;
15
+ update(box: Rect, dims: any): void;
16
+ }
17
+ declare class OverlayTip {
18
+ tip: HTMLElement;
19
+ nameSpan: HTMLElement;
20
+ dimSpan: HTMLElement;
21
+ constructor(doc: Document, container: HTMLElement);
22
+ remove(): void;
23
+ updateText(name: string, width: number, height: number): void;
24
+ updatePosition(dims: Box, bounds: Box): void;
25
+ }
26
+ export default class Overlay {
27
+ window: any;
28
+ tipBoundsWindow: any;
29
+ container: HTMLElement;
30
+ tip: OverlayTip;
31
+ rects: Array<OverlayRect>;
32
+ constructor();
33
+ remove(): void;
34
+ inspect(nodes: Array<HTMLElement>, name?: string | null): void;
35
+ }
36
+ export {};
@@ -0,0 +1,29 @@
1
+ /// <reference types="lodash" />
2
+ type HighlighterProps = {
3
+ excludeSelectors?: string[];
4
+ onSelect?: (node: HTMLElement, XPath: string) => void;
5
+ };
6
+ export default class Highlighter {
7
+ _isRunning: boolean;
8
+ _selectIgnore: boolean;
9
+ _lastHoveredNode: HTMLElement | null;
10
+ excludeSelectors: string[];
11
+ onSelect: HighlighterProps['onSelect'];
12
+ constructor(options: HighlighterProps);
13
+ startHandle(): void;
14
+ stopHandle(): void;
15
+ iframesListeningTo: Set<HTMLIFrameElement>;
16
+ startInspectingNative(): void;
17
+ stopInspectingNative(): void;
18
+ registerListenersOnWindow(window: any): void;
19
+ removeListenersOnWindow(window: any): void;
20
+ onClick: (event: MouseEvent) => void;
21
+ onMouseEvent: (event: MouseEvent) => void;
22
+ onPointerDown: (event: MouseEvent) => void;
23
+ onPointerMove: (event: MouseEvent) => void;
24
+ onPointerUp: (event: MouseEvent) => void;
25
+ selectFiberForNode: import("lodash").DebouncedFunc<(node: HTMLElement) => void>;
26
+ getEventTarget(event: MouseEvent): HTMLElement;
27
+ }
28
+ export declare function getNodeByXPath(xpathString: string): HTMLElement | null;
29
+ export {};
@@ -0,0 +1,27 @@
1
+ export interface Rect {
2
+ bottom: number;
3
+ height: number;
4
+ left: number;
5
+ right: number;
6
+ top: number;
7
+ width: number;
8
+ }
9
+ export declare function getOwnerWindow(node: HTMLElement): (Window & typeof globalThis) | null;
10
+ export declare function getOwnerIframe(node: HTMLElement): HTMLElement | null;
11
+ export declare function getBoundingClientRectWithBorderOffset(node: HTMLElement): Rect;
12
+ export declare function mergeRectOffsets(rects: Array<Rect>): Rect;
13
+ export declare function getNestedBoundingClientRect(node: HTMLElement, boundaryWindow: typeof window): Rect;
14
+ export declare function getElementDimensions(domElement: Element): {
15
+ borderBottom: number;
16
+ borderLeft: number;
17
+ borderRight: number;
18
+ borderTop: number;
19
+ marginBottom: number;
20
+ marginLeft: number;
21
+ marginRight: number;
22
+ marginTop: number;
23
+ paddingBottom: number;
24
+ paddingLeft: number;
25
+ paddingRight: number;
26
+ paddingTop: number;
27
+ };
@@ -0,0 +1,189 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2022-01-11 18:01:20
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2023-07-29 23:42:13
6
+ */
7
+ @import '../../style/common';
8
+
9
+ @prefix-guide-tracker: ~'@{qm-prefix}-guide-tracker';
10
+
11
+ .@{prefix-guide-tracker} {
12
+ .reset-container();
13
+ position: absolute;
14
+ display: block;
15
+ visibility: visible;
16
+ min-width: 450px;
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
+ & &-close {
53
+ position: absolute;
54
+ top: 10px;
55
+ inset-inline-end: 10px;
56
+ color: @--text-color-secondary;
57
+ width: 22px;
58
+ height: 22px;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ outline: none;
63
+ border-radius: 4px;
64
+ transition: background-color 0.2s ease 0s, color 0.2s ease 0s;
65
+ &:hover {
66
+ color: rgba(0, 0, 0, 0.88);
67
+ background-color: rgba(0, 0, 0, 0.06);
68
+ }
69
+ }
70
+ & &-content {
71
+ position: relative;
72
+ }
73
+ & &-inner {
74
+ 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;
75
+ background-color: #fff;
76
+ background-clip: padding-box;
77
+ text-decoration: none;
78
+ border-radius: 8px;
79
+ padding: 10px 15px 15px;
80
+ }
81
+ &-primary &-inner {
82
+ color: #fff;
83
+ background-color: rgba(@--primary-color, 0.85);
84
+ .panel-label {
85
+ margin-bottom: 5px;
86
+ .title {
87
+ font-weight: 600;
88
+ }
89
+ .step {
90
+ margin-left: 20px;
91
+ }
92
+ }
93
+ .menu-icon {
94
+ right: 35px;
95
+ }
96
+ }
97
+ &-primary &-arrow {
98
+ &::before {
99
+ background-color: rgba(@--primary-color, 0.85);
100
+ }
101
+ }
102
+ &-primary &-close {
103
+ color: #fff;
104
+ &:hover {
105
+ color: #fff;
106
+ }
107
+ }
108
+ &-control {
109
+ position: fixed;
110
+ right: 20px;
111
+ bottom: 20px;
112
+ width: 40px;
113
+ height: 40px;
114
+ border-radius: 50%;
115
+ border: 2px solid #fff;
116
+ background: linear-gradient(to right bottom, @--primary-4, @--primary-7);
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: center;
120
+ pointer-events: auto;
121
+ cursor: pointer;
122
+ .anticon {
123
+ color: #fff;
124
+ font-size: 20px;
125
+ }
126
+ }
127
+ // =======================================
128
+ &-placement-bottom &-arrow {
129
+ left: 50%;
130
+ transform: translateX(-50%) translateY(-100%);
131
+ }
132
+ &-placement-top &-arrow {
133
+ left: 50%;
134
+ transform: translateX(-50%) translateY(100%) rotate(180deg);
135
+ }
136
+ &-placement-right &-arrow {
137
+ top: 50%;
138
+ transform: translateY(-50%) translateX(-100%) rotate(-90deg);
139
+ }
140
+ &-placement-left &-arrow {
141
+ top: 50%;
142
+ transform: translateY(-50%) translateX(100%) rotate(90deg);
143
+ }
144
+ }
145
+
146
+ .@{prefix-guide-tracker}__popper {
147
+ .step-list {
148
+ ul {
149
+ margin: 0;
150
+ li.item {
151
+ line-height: 2;
152
+ display: flex;
153
+ align-items: center;
154
+ padding: 0 @--padding-md;
155
+ &.actived {
156
+ background-color: @--primary-2;
157
+ }
158
+ .handle {
159
+ padding: 2px;
160
+ color: @--text-color-secondary;
161
+ cursor: s-resize;
162
+ transform: scale(0.9);
163
+ }
164
+ .box {
165
+ flex: 1 0;
166
+ display: inline-flex;
167
+ align-items: center;
168
+ .title {
169
+ flex: 1 0;
170
+ width: 0;
171
+ .text-overflow-cut();
172
+ }
173
+ .close-icon {
174
+ padding: 2px;
175
+ font-size: 12px;
176
+ color: @--text-color-secondary;
177
+ border-radius: 4px;
178
+ cursor: pointer;
179
+ display: none;
180
+ }
181
+ &:hover .close-icon {
182
+ display: block;
183
+ background-color: rgba(0, 0, 0, 0.06);
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export default function useLayoutUpdateEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;
@@ -0,0 +1,8 @@
1
+ type Updater<T> = (updater: T | ((origin: T) => T)) => void;
2
+ export default function useMergedState<T, R = T>(defaultStateValue: T | (() => T), option?: {
3
+ defaultValue?: T | (() => T);
4
+ value?: T;
5
+ onChange?: (value: T, prevValue: T) => void;
6
+ postState?: (value: T) => T;
7
+ }): [R, Updater<T>];
8
+ export {};
@@ -0,0 +1,4 @@
1
+ type Updater<T> = T | ((prevValue: T) => T);
2
+ export type SetState<T> = (nextValue: Updater<T>, ignoreDestroy?: boolean) => void;
3
+ export default function useSafeState<T>(defaultValue?: T | (() => T)): [T, SetState<T>];
4
+ export {};
package/lib/index.d.ts CHANGED
@@ -54,10 +54,12 @@ export type { RangeTableHelperProps as QmRangeTableHelperProps } from './range-t
54
54
  export { default as QmRangeTableHelper } from './range-table-helper';
55
55
  export type { TourProps as QmTourProps, TourStepProps as QmTourStepProps } from './tour';
56
56
  export { default as QmTour } from './tour';
57
- export type { PrintProps as QmPrintProps } from './print';
58
- export { default as QmPrint } from './print';
59
57
  export type { TransitionProps as QmTransitionProps } from './transition';
60
58
  export { default as QmTransition } from './transition';
59
+ export type { PrintProps as QmPrintProps } from './print';
60
+ export { default as QmPrint } from './print';
61
+ export type { GuideTrackerProps as QmGuideTrackerProps } from './guide-tracker';
62
+ export { default as QmGuideTracker } from './guide-tracker';
61
63
  export { default as pinyin } from './pinyin';
62
64
  export { default as version } from './version';
63
65
  export * from './antd';