@pisell/materials 1.0.977 → 1.0.979
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +6 -6
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +15 -15
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -23
- package/es/components/PisellProcedure/PisellProcedure.d.ts +27 -0
- package/es/components/PisellProcedure/components/ProcedureAction.d.ts +8 -0
- package/es/components/PisellProcedure/components/ProcedureContent.d.ts +8 -0
- package/es/components/PisellProcedure/components/ProcedureHeader.d.ts +8 -0
- package/es/components/PisellProcedure/components/ProcedureSummary.d.ts +8 -0
- package/es/components/PisellProcedure/hooks/useResponsive.d.ts +6 -0
- package/es/components/PisellProcedure/index.d.ts +4 -0
- package/es/components/PisellProcedure/types.d.ts +303 -0
- package/es/components/PisellSteps/PisellSteps.d.ts +14 -0
- package/es/components/PisellSteps/PisellSteps.js +170 -148
- package/es/components/PisellSteps/PisellSteps.less +248 -383
- package/es/components/PisellSteps/hooks/index.d.ts +4 -0
- package/es/components/PisellSteps/hooks/index.js +4 -0
- package/es/components/PisellSteps/hooks/useAnchor.d.ts +9 -0
- package/es/components/PisellSteps/hooks/useAnchor.js +55 -0
- package/es/components/PisellSteps/hooks/useResponsive.d.ts +8 -0
- package/es/components/PisellSteps/hooks/useResponsive.js +43 -0
- package/es/components/PisellSteps/hooks/useStepClick.d.ts +11 -0
- package/es/components/PisellSteps/hooks/useStepClick.js +35 -0
- package/es/components/PisellSteps/hooks/useStepsState.d.ts +9 -0
- package/es/components/PisellSteps/hooks/useStepsState.js +60 -0
- package/es/components/PisellSteps/index.d.ts +3 -0
- package/es/components/PisellSteps/index.js +2 -5
- package/es/components/PisellSteps/types.d.ts +271 -0
- package/es/components/PisellSteps/utils/index.d.ts +54 -0
- package/es/components/PisellSteps/utils/index.js +118 -0
- package/es/components/Template/PisellSteps.d.ts +0 -0
- package/es/components/Template/PisellSteps.js +1 -0
- package/es/components/Template/PisellSteps.less +1 -0
- package/es/components/Template/components/index.d.ts +0 -0
- package/es/components/Template/components/index.js +1 -0
- package/es/components/Template/hooks/index.d.ts +0 -0
- package/es/components/Template/hooks/index.js +1 -0
- package/es/components/Template/utils/index.d.ts +0 -0
- package/es/components/Template/utils/index.js +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +5 -5
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +0 -10
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.js +13 -64
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +56 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +3 -4
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +101 -0
- package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +17 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +16 -0
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/es/components/dataSourceComponents/fields/Switch/WithMode.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Switch/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/Switch/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Switch/index.js +8 -0
- package/es/components/dataSourceComponents/fields/Switch/type.d.ts +16 -0
- package/es/components/dataSourceComponents/fields/Switch/type.js +1 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +12 -12
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.d.ts +4 -0
- package/es/components/pisellCardList/index.d.ts +107 -0
- package/es/components/pisellGoodPassCard/index.d.ts +50 -0
- package/es/components/pisellWalletPassCard/index.d.ts +146 -0
- package/es/components/productCard/index.d.ts +7 -0
- package/es/index.d.ts +149 -0
- package/es/index.js +1 -1
- package/lib/components/PisellProcedure/PisellProcedure.d.ts +27 -0
- package/lib/components/PisellProcedure/components/ProcedureAction.d.ts +8 -0
- package/lib/components/PisellProcedure/components/ProcedureContent.d.ts +8 -0
- package/lib/components/PisellProcedure/components/ProcedureHeader.d.ts +8 -0
- package/lib/components/PisellProcedure/components/ProcedureSummary.d.ts +8 -0
- package/lib/components/PisellProcedure/hooks/useResponsive.d.ts +6 -0
- package/lib/components/PisellProcedure/index.d.ts +4 -0
- package/lib/components/PisellProcedure/types.d.ts +303 -0
- package/lib/components/PisellSteps/PisellSteps.d.ts +14 -0
- package/lib/components/PisellSteps/PisellSteps.js +155 -102
- package/lib/components/PisellSteps/PisellSteps.less +248 -383
- package/lib/components/PisellSteps/hooks/index.d.ts +4 -0
- package/lib/components/PisellSteps/hooks/index.js +38 -0
- package/lib/components/PisellSteps/hooks/useAnchor.d.ts +9 -0
- package/lib/components/PisellSteps/hooks/useAnchor.js +63 -0
- package/lib/components/PisellSteps/hooks/useResponsive.d.ts +8 -0
- package/lib/components/PisellSteps/hooks/useResponsive.js +48 -0
- package/lib/components/PisellSteps/hooks/useStepClick.d.ts +11 -0
- package/lib/components/PisellSteps/hooks/useStepClick.js +55 -0
- package/lib/components/PisellSteps/hooks/useStepsState.d.ts +9 -0
- package/lib/components/PisellSteps/hooks/useStepsState.js +54 -0
- package/lib/components/PisellSteps/index.d.ts +3 -0
- package/lib/components/PisellSteps/index.js +2 -7
- package/lib/components/PisellSteps/types.d.ts +271 -0
- package/lib/components/PisellSteps/utils/index.d.ts +54 -0
- package/lib/components/PisellSteps/utils/index.js +88 -0
- package/lib/components/Template/PisellSteps.d.ts +0 -0
- package/lib/components/Template/PisellSteps.js +0 -0
- package/lib/components/Template/PisellSteps.less +1 -0
- package/lib/components/Template/components/index.d.ts +0 -0
- package/lib/components/Template/components/index.js +0 -0
- package/lib/components/Template/hooks/index.d.ts +0 -0
- package/lib/components/Template/hooks/index.js +0 -0
- package/lib/components/Template/utils/index.d.ts +0 -0
- package/lib/components/Template/utils/index.js +0 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +4 -4
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +0 -10
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.js +3 -25
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +56 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +101 -0
- package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +17 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +16 -0
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.js +52 -0
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/lib/components/dataSourceComponents/fields/Switch/WithMode.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Switch/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Switch/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Switch/index.js +42 -0
- package/lib/components/dataSourceComponents/fields/Switch/type.d.ts +16 -0
- package/lib/components/dataSourceComponents/fields/Switch/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +12 -12
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.d.ts +4 -0
- package/lib/components/pisellCardList/index.d.ts +107 -0
- package/lib/components/pisellGoodPassCard/index.d.ts +50 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +146 -0
- package/lib/components/productCard/index.d.ts +7 -0
- package/lib/index.d.ts +149 -0
- package/lib/index.js +3 -3
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/utils.ts +36 -7
- package/lowcode/form-item-switch/meta.ts +145 -0
- package/lowcode/form-item-switch/snippets.ts +15 -0
- package/lowcode/pisell-steps/meta.ts +621 -271
- package/lowcode/pisell-steps/snippets.ts +27 -69
- package/package.json +3 -3
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonProps } from 'antd';
|
|
3
|
+
import type { PisellStepsProps, StepItem } from '../PisellSteps/types';
|
|
4
|
+
/**
|
|
5
|
+
* 布局方向类型
|
|
6
|
+
*/
|
|
7
|
+
export declare type LayoutDirection = 'vertical' | 'horizontal';
|
|
8
|
+
/**
|
|
9
|
+
* 操作区定位模式
|
|
10
|
+
*/
|
|
11
|
+
export declare type ActionMode = 'fixed' | 'embedded' | 'float';
|
|
12
|
+
/**
|
|
13
|
+
* 操作区定位位置
|
|
14
|
+
*/
|
|
15
|
+
export declare type ActionPosition = 'bottom' | 'content' | 'summary';
|
|
16
|
+
/**
|
|
17
|
+
* 头部固定模式
|
|
18
|
+
*/
|
|
19
|
+
export declare type HeaderFixed = boolean | 'scroll';
|
|
20
|
+
/**
|
|
21
|
+
* 操作按钮配置项
|
|
22
|
+
*/
|
|
23
|
+
export interface ActionItem {
|
|
24
|
+
/** 唯一标识 */
|
|
25
|
+
key: string;
|
|
26
|
+
/** 按钮文本 */
|
|
27
|
+
label: React.ReactNode;
|
|
28
|
+
/** 按钮类型 */
|
|
29
|
+
type?: 'primary' | 'default' | 'dashed' | 'link' | 'text';
|
|
30
|
+
/** 点击回调 */
|
|
31
|
+
onClick?: () => void | Promise<void>;
|
|
32
|
+
/** 是否禁用 */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** 是否加载中 */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/** 按钮图标 */
|
|
37
|
+
icon?: React.ReactNode;
|
|
38
|
+
/** 排序权重(越小越靠前) */
|
|
39
|
+
order?: number;
|
|
40
|
+
/** 是否隐藏 */
|
|
41
|
+
hidden?: boolean;
|
|
42
|
+
/** 自定义类名 */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** 自定义样式 */
|
|
45
|
+
style?: React.CSSProperties;
|
|
46
|
+
/** 其他按钮属性 */
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* PisellProcedure 组件属性
|
|
51
|
+
*/
|
|
52
|
+
export interface PisellProcedureProps {
|
|
53
|
+
/** 当前步骤索引(从 0 开始) */
|
|
54
|
+
current?: number;
|
|
55
|
+
/** 步骤配置数组(传递给 PisellSteps 组件) */
|
|
56
|
+
steps: StepItem[];
|
|
57
|
+
/** 步骤改变时的回调 */
|
|
58
|
+
onStepChange?: (current: number) => void | Promise<void>;
|
|
59
|
+
/** 点击关闭按钮的回调 */
|
|
60
|
+
onClose?: () => void;
|
|
61
|
+
/** 点击上一步按钮的回调 */
|
|
62
|
+
onPrev?: () => void;
|
|
63
|
+
/** 内容区渲染函数 */
|
|
64
|
+
contentRender: (current: number) => React.ReactNode;
|
|
65
|
+
/** 信息总结区渲染函数 */
|
|
66
|
+
summaryRender?: (current: number) => React.ReactNode;
|
|
67
|
+
/** 操作按钮配置数组 */
|
|
68
|
+
actions?: ActionItem[];
|
|
69
|
+
/** 整体布局方向 */
|
|
70
|
+
layout?: LayoutDirection;
|
|
71
|
+
/** 主体区域布局方向 */
|
|
72
|
+
bodyLayout?: LayoutDirection;
|
|
73
|
+
/** 内容区宽度(百分比或固定值) */
|
|
74
|
+
contentWidth?: string | number;
|
|
75
|
+
/** 信息总结区宽度(固定值) */
|
|
76
|
+
summaryWidth?: string | number;
|
|
77
|
+
/** 是否显示头部区域 */
|
|
78
|
+
showHeader?: boolean;
|
|
79
|
+
/** 是否显示信息总结区 */
|
|
80
|
+
showSummary?: boolean;
|
|
81
|
+
/** 是否显示操作区 */
|
|
82
|
+
showAction?: boolean;
|
|
83
|
+
/** 是否显示上一步按钮 */
|
|
84
|
+
showPrevButton?: boolean;
|
|
85
|
+
/** 是否显示关闭按钮 */
|
|
86
|
+
showCloseButton?: boolean;
|
|
87
|
+
/** 头部区域是否固定定位 */
|
|
88
|
+
headerFixed?: HeaderFixed;
|
|
89
|
+
/** 操作区定位模式 */
|
|
90
|
+
actionMode?: ActionMode;
|
|
91
|
+
/** 操作区定位位置 */
|
|
92
|
+
actionPosition?: ActionPosition;
|
|
93
|
+
/** 信息总结区是否可折叠 */
|
|
94
|
+
summaryCollapsible?: boolean;
|
|
95
|
+
/** 信息总结区默认是否折叠 */
|
|
96
|
+
summaryDefaultCollapsed?: boolean;
|
|
97
|
+
/** 步骤切换前是否自动验证 */
|
|
98
|
+
validateOnStepChange?: boolean;
|
|
99
|
+
/** 步骤验证函数 */
|
|
100
|
+
onValidate?: (current: number) => boolean | Promise<boolean>;
|
|
101
|
+
/** 返回上一步是否清除当前步骤数据 */
|
|
102
|
+
clearOnBack?: boolean;
|
|
103
|
+
/** 数据改变影响当前步骤时是否弹窗确认 */
|
|
104
|
+
confirmOnDataChange?: boolean;
|
|
105
|
+
/** 头部区域自定义类名 */
|
|
106
|
+
headerClassName?: string;
|
|
107
|
+
/** 头部区域自定义样式 */
|
|
108
|
+
headerStyle?: React.CSSProperties;
|
|
109
|
+
/** 内容区自定义类名 */
|
|
110
|
+
contentClassName?: string;
|
|
111
|
+
/** 内容区自定义样式 */
|
|
112
|
+
contentStyle?: React.CSSProperties;
|
|
113
|
+
/** 信息总结区自定义类名 */
|
|
114
|
+
summaryClassName?: string;
|
|
115
|
+
/** 信息总结区自定义样式 */
|
|
116
|
+
summaryStyle?: React.CSSProperties;
|
|
117
|
+
/** 操作区自定义类名 */
|
|
118
|
+
actionClassName?: string;
|
|
119
|
+
/** 操作区自定义样式 */
|
|
120
|
+
actionStyle?: React.CSSProperties;
|
|
121
|
+
/** 组件根节点自定义类名 */
|
|
122
|
+
className?: string;
|
|
123
|
+
/** 组件根节点自定义样式 */
|
|
124
|
+
style?: React.CSSProperties;
|
|
125
|
+
/** 头部区域额外内容插槽 */
|
|
126
|
+
headerExtra?: React.ReactNode;
|
|
127
|
+
/** 信息总结区额外内容插槽 */
|
|
128
|
+
summaryExtra?: React.ReactNode;
|
|
129
|
+
/** 操作区额外内容插槽 */
|
|
130
|
+
actionExtra?: React.ReactNode;
|
|
131
|
+
/** 传递给 PisellSteps 组件的额外属性 */
|
|
132
|
+
stepsProps?: Partial<PisellStepsProps>;
|
|
133
|
+
/** 上一步按钮的属性 */
|
|
134
|
+
prevButtonProps?: ButtonProps;
|
|
135
|
+
/** 关闭按钮的属性 */
|
|
136
|
+
closeButtonProps?: ButtonProps;
|
|
137
|
+
/** 是否显示加载状态 */
|
|
138
|
+
loading?: boolean;
|
|
139
|
+
/** 是否禁用所有操作 */
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* ProcedureHeader 组件属性(内部子组件)
|
|
144
|
+
*/
|
|
145
|
+
export interface ProcedureHeaderProps {
|
|
146
|
+
/** 当前步骤索引 */
|
|
147
|
+
current: number;
|
|
148
|
+
/** 步骤配置数组 */
|
|
149
|
+
steps: StepItem[];
|
|
150
|
+
/** 传递给 PisellSteps 的额外属性 */
|
|
151
|
+
stepsProps?: Partial<PisellStepsProps>;
|
|
152
|
+
/** 是否显示上一步按钮 */
|
|
153
|
+
showPrevButton: boolean;
|
|
154
|
+
/** 是否显示关闭按钮 */
|
|
155
|
+
showCloseButton: boolean;
|
|
156
|
+
/** 点击上一步的回调 */
|
|
157
|
+
onPrev?: () => void;
|
|
158
|
+
/** 点击关闭的回调 */
|
|
159
|
+
onClose?: () => void;
|
|
160
|
+
/** 点击步骤的回调 */
|
|
161
|
+
onStepClick?: (index: number) => void;
|
|
162
|
+
/** 额外内容插槽 */
|
|
163
|
+
headerExtra?: React.ReactNode;
|
|
164
|
+
/** 上一步按钮属性 */
|
|
165
|
+
prevButtonProps?: ButtonProps;
|
|
166
|
+
/** 关闭按钮属性 */
|
|
167
|
+
closeButtonProps?: ButtonProps;
|
|
168
|
+
/** 是否固定定位 */
|
|
169
|
+
fixed?: HeaderFixed;
|
|
170
|
+
/** 自定义类名 */
|
|
171
|
+
className?: string;
|
|
172
|
+
/** 自定义样式 */
|
|
173
|
+
style?: React.CSSProperties;
|
|
174
|
+
/** 是否禁用 */
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* ProcedureContent 组件属性(内部子组件)
|
|
179
|
+
*/
|
|
180
|
+
export interface ProcedureContentProps {
|
|
181
|
+
/** 当前步骤索引 */
|
|
182
|
+
current: number;
|
|
183
|
+
/** 内容渲染函数 */
|
|
184
|
+
contentRender: (current: number) => React.ReactNode;
|
|
185
|
+
/** 宽度 */
|
|
186
|
+
width?: string | number;
|
|
187
|
+
/** 自定义类名 */
|
|
188
|
+
className?: string;
|
|
189
|
+
/** 自定义样式 */
|
|
190
|
+
style?: React.CSSProperties;
|
|
191
|
+
/** 是否加载中 */
|
|
192
|
+
loading?: boolean;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* ProcedureSummary 组件属性(内部子组件)
|
|
196
|
+
*/
|
|
197
|
+
export interface ProcedureSummaryProps {
|
|
198
|
+
/** 当前步骤索引 */
|
|
199
|
+
current: number;
|
|
200
|
+
/** 信息总结区渲染函数 */
|
|
201
|
+
summaryRender?: (current: number) => React.ReactNode;
|
|
202
|
+
/** 宽度 */
|
|
203
|
+
width?: string | number;
|
|
204
|
+
/** 是否可折叠 */
|
|
205
|
+
collapsible?: boolean;
|
|
206
|
+
/** 默认是否折叠 */
|
|
207
|
+
defaultCollapsed?: boolean;
|
|
208
|
+
/** 折叠状态改变的回调 */
|
|
209
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
210
|
+
/** 额外内容插槽 */
|
|
211
|
+
summaryExtra?: React.ReactNode;
|
|
212
|
+
/** 自定义类名 */
|
|
213
|
+
className?: string;
|
|
214
|
+
/** 自定义样式 */
|
|
215
|
+
style?: React.CSSProperties;
|
|
216
|
+
/** 是否显示 */
|
|
217
|
+
visible?: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* ProcedureAction 组件属性(内部子组件)
|
|
221
|
+
*/
|
|
222
|
+
export interface ProcedureActionProps {
|
|
223
|
+
/** 操作按钮配置数组 */
|
|
224
|
+
actions: ActionItem[];
|
|
225
|
+
/** 定位模式 */
|
|
226
|
+
mode?: ActionMode;
|
|
227
|
+
/** 定位位置 */
|
|
228
|
+
position?: ActionPosition;
|
|
229
|
+
/** 额外内容插槽 */
|
|
230
|
+
actionExtra?: React.ReactNode;
|
|
231
|
+
/** 自定义类名 */
|
|
232
|
+
className?: string;
|
|
233
|
+
/** 自定义样式 */
|
|
234
|
+
style?: React.CSSProperties;
|
|
235
|
+
/** 是否禁用所有按钮 */
|
|
236
|
+
disabled?: boolean;
|
|
237
|
+
/** 是否加载中 */
|
|
238
|
+
loading?: boolean;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* MobileSummaryDrawer 组件属性(内部子组件)
|
|
242
|
+
*/
|
|
243
|
+
export interface MobileSummaryDrawerProps {
|
|
244
|
+
/** 当前步骤索引 */
|
|
245
|
+
current: number;
|
|
246
|
+
/** 信息总结区渲染函数 */
|
|
247
|
+
summaryRender?: (current: number) => React.ReactNode;
|
|
248
|
+
/** 是否可见 */
|
|
249
|
+
visible: boolean;
|
|
250
|
+
/** 可见状态改变的回调 */
|
|
251
|
+
onVisibleChange: (visible: boolean) => void;
|
|
252
|
+
/** 额外内容插槽 */
|
|
253
|
+
summaryExtra?: React.ReactNode;
|
|
254
|
+
/** 自定义类名 */
|
|
255
|
+
className?: string;
|
|
256
|
+
/** 自定义样式 */
|
|
257
|
+
style?: React.CSSProperties;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 响应式信息类型
|
|
261
|
+
*/
|
|
262
|
+
export interface ResponsiveInfo {
|
|
263
|
+
/** < 430px */
|
|
264
|
+
xs: boolean;
|
|
265
|
+
/** < 744px */
|
|
266
|
+
sm: boolean;
|
|
267
|
+
/** < 960px */
|
|
268
|
+
md: boolean;
|
|
269
|
+
/** < 1133px */
|
|
270
|
+
lg: boolean;
|
|
271
|
+
/** < 1366px */
|
|
272
|
+
xl: boolean;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 步骤验证结果
|
|
276
|
+
*/
|
|
277
|
+
export interface ValidationResult {
|
|
278
|
+
/** 是否验证通过 */
|
|
279
|
+
valid: boolean;
|
|
280
|
+
/** 错误信息 */
|
|
281
|
+
message?: string;
|
|
282
|
+
/** 错误字段 */
|
|
283
|
+
errors?: Record<string, string>;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* 数据同步配置
|
|
287
|
+
*/
|
|
288
|
+
export interface DataSyncConfig {
|
|
289
|
+
/** 是否需要确认 */
|
|
290
|
+
needConfirm: boolean;
|
|
291
|
+
/** 确认标题 */
|
|
292
|
+
confirmTitle?: string;
|
|
293
|
+
/** 确认内容 */
|
|
294
|
+
confirmContent?: string;
|
|
295
|
+
/** 确认按钮文本 */
|
|
296
|
+
confirmOkText?: string;
|
|
297
|
+
/** 取消按钮文本 */
|
|
298
|
+
confirmCancelText?: string;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 导出所有类型
|
|
302
|
+
*/
|
|
303
|
+
export type { StepItem, PisellStepsProps, } from '../PisellSteps/types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './PisellSteps.less';
|
|
3
|
+
import type { PisellStepsProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* PisellSteps 步骤条组件
|
|
6
|
+
*
|
|
7
|
+
* 基于 Ant Design Steps 组件进行二次封装和增强
|
|
8
|
+
* 支持多种展示样式、布局方式和丰富的交互功能
|
|
9
|
+
*
|
|
10
|
+
* @author Pisell Team
|
|
11
|
+
* @version 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
declare const PisellSteps: React.FC<PisellStepsProps>;
|
|
14
|
+
export default PisellSteps;
|
|
@@ -32,137 +32,190 @@ __export(PisellSteps_exports, {
|
|
|
32
32
|
default: () => PisellSteps_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(PisellSteps_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
35
|
var import_antd = require("antd");
|
|
37
|
-
var
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
38
37
|
var import_PisellSteps = require("./PisellSteps.less");
|
|
38
|
+
var import_hooks = require("./hooks");
|
|
39
|
+
var import_utils = require("./utils");
|
|
39
40
|
var PisellSteps = ({
|
|
40
|
-
|
|
41
|
-
items = [],
|
|
41
|
+
// 基础属性
|
|
42
42
|
type = "default",
|
|
43
|
-
|
|
43
|
+
current: controlledCurrent,
|
|
44
|
+
defaultCurrent = 0,
|
|
44
45
|
direction = "horizontal",
|
|
46
|
+
size = "default",
|
|
45
47
|
status = "process",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
initial = 0,
|
|
49
|
+
items = [],
|
|
48
50
|
percent,
|
|
51
|
+
labelPlacement = "horizontal",
|
|
49
52
|
responsive = true,
|
|
50
53
|
onChange,
|
|
51
54
|
className,
|
|
52
55
|
style,
|
|
56
|
+
progressDot,
|
|
57
|
+
// 扩展功能属性
|
|
58
|
+
clickable = false,
|
|
59
|
+
allowClickFinished = true,
|
|
60
|
+
showProgressPercent = false,
|
|
61
|
+
iconSize,
|
|
62
|
+
iconColor,
|
|
53
63
|
connectorStyle,
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
connectorPosition = "center",
|
|
65
|
+
animated = true,
|
|
66
|
+
gridLayout = false,
|
|
67
|
+
gridColumns,
|
|
68
|
+
itemLayout = "horizontal",
|
|
69
|
+
itemGap,
|
|
70
|
+
enableAnchor = false,
|
|
71
|
+
anchorContainer,
|
|
72
|
+
// 低代码属性
|
|
73
|
+
__designMode,
|
|
74
|
+
__id,
|
|
75
|
+
other,
|
|
56
76
|
...restProps
|
|
57
77
|
}) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
const [currentStep, setCurrentStep] = (0, import_hooks.useStepsState)(
|
|
79
|
+
controlledCurrent,
|
|
80
|
+
defaultCurrent,
|
|
81
|
+
onChange
|
|
82
|
+
);
|
|
83
|
+
const handleStepClick = (0, import_hooks.useStepClick)(
|
|
84
|
+
currentStep,
|
|
85
|
+
clickable,
|
|
86
|
+
allowClickFinished,
|
|
87
|
+
setCurrentStep
|
|
88
|
+
);
|
|
89
|
+
(0, import_hooks.useAnchor)(currentStep, enableAnchor, anchorContainer);
|
|
90
|
+
const isMobile = (0, import_hooks.useResponsive)(768);
|
|
91
|
+
const processedItems = (0, import_react.useMemo)(() => {
|
|
92
|
+
const visibleItems = items.filter((item) => !item.hidden);
|
|
93
|
+
if (__designMode === "design" && visibleItems.length === 0) {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
title: "步骤一",
|
|
97
|
+
description: "This is a description.",
|
|
98
|
+
status: "finish"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: "步骤二",
|
|
102
|
+
description: "This is a description.",
|
|
103
|
+
status: "process"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: "步骤三",
|
|
107
|
+
description: "This is a description.",
|
|
108
|
+
status: "wait"
|
|
68
109
|
}
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
return visibleItems.map((item, index) => {
|
|
113
|
+
const adjustedIndex = index + initial;
|
|
114
|
+
let stepStatus;
|
|
115
|
+
if (item.status) {
|
|
116
|
+
stepStatus = item.status;
|
|
117
|
+
} else if (adjustedIndex === currentStep) {
|
|
118
|
+
stepStatus = status;
|
|
119
|
+
} else {
|
|
120
|
+
stepStatus = (0, import_utils.getStepStatus)(adjustedIndex, currentStep);
|
|
69
121
|
}
|
|
122
|
+
const stepClassName = (0, import_utils.mergeStepClassName)(
|
|
123
|
+
"pisell-steps-item",
|
|
124
|
+
stepStatus,
|
|
125
|
+
item.className
|
|
126
|
+
);
|
|
127
|
+
const handleClick = () => {
|
|
128
|
+
var _a;
|
|
129
|
+
if (!item.disabled) {
|
|
130
|
+
(_a = item.onClick) == null ? void 0 : _a.call(item);
|
|
131
|
+
handleStepClick(adjustedIndex, item);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
70
134
|
return {
|
|
71
135
|
...item,
|
|
72
|
-
status:
|
|
136
|
+
status: stepStatus,
|
|
137
|
+
className: stepClassName,
|
|
138
|
+
onClick: clickable || item.onClick ? handleClick : void 0
|
|
73
139
|
};
|
|
74
140
|
});
|
|
75
|
-
}, [items, current, status]);
|
|
76
|
-
const handleStepClick = (0, import_react.useCallback)(
|
|
77
|
-
(index) => {
|
|
78
|
-
var _a;
|
|
79
|
-
const targetItem = items[index];
|
|
80
|
-
if (targetItem == null ? void 0 : targetItem.disabled) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (index < current) {
|
|
84
|
-
onChange == null ? void 0 : onChange(index);
|
|
85
|
-
}
|
|
86
|
-
(_a = targetItem == null ? void 0 : targetItem.onClick) == null ? void 0 : _a.call(targetItem);
|
|
87
|
-
},
|
|
88
|
-
[items, current, onChange]
|
|
89
|
-
);
|
|
90
|
-
const antdItems = (0, import_react.useMemo)(() => {
|
|
91
|
-
return computedItems.map((item) => ({
|
|
92
|
-
title: item.title,
|
|
93
|
-
subTitle: item.subTitle,
|
|
94
|
-
description: item.description,
|
|
95
|
-
status: item.status,
|
|
96
|
-
icon: item.icon,
|
|
97
|
-
disabled: item.disabled,
|
|
98
|
-
className: (0, import_classnames.default)(item.className, {
|
|
99
|
-
"pisell-steps-item-clickable": !item.disabled && item.status === "finish"
|
|
100
|
-
}),
|
|
101
|
-
style: item.style
|
|
102
|
-
}));
|
|
103
|
-
}, [computedItems]);
|
|
104
|
-
const mergedStyle = (0, import_react.useMemo)(() => {
|
|
105
|
-
const baseStyle = {
|
|
106
|
-
...style
|
|
107
|
-
};
|
|
108
|
-
if (connectorStyle) {
|
|
109
|
-
Object.entries(connectorStyle).forEach(([key, value]) => {
|
|
110
|
-
const cssVarKey = `--pisell-step-connector-${key.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
111
|
-
baseStyle[cssVarKey] = value;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return baseStyle;
|
|
115
|
-
}, [style, connectorStyle]);
|
|
116
|
-
const mergedClassName = (0, import_react.useMemo)(() => {
|
|
117
|
-
return (0, import_classnames.default)(
|
|
118
|
-
"pisell-steps",
|
|
119
|
-
`pisell-steps-${type}`,
|
|
120
|
-
`pisell-steps-${size}`,
|
|
121
|
-
`pisell-steps-${direction}`,
|
|
122
|
-
{
|
|
123
|
-
"pisell-steps-dot": progressDot,
|
|
124
|
-
"pisell-steps-responsive": responsive,
|
|
125
|
-
"pisell-steps-no-connector": !showConnector,
|
|
126
|
-
"pisell-steps-label-vertical": labelPlacement === "vertical",
|
|
127
|
-
"pisell-steps-icon-bottom": iconPosition === "bottom"
|
|
128
|
-
},
|
|
129
|
-
className
|
|
130
|
-
);
|
|
131
141
|
}, [
|
|
142
|
+
items,
|
|
143
|
+
currentStep,
|
|
144
|
+
initial,
|
|
145
|
+
status,
|
|
146
|
+
clickable,
|
|
147
|
+
handleStepClick,
|
|
148
|
+
__designMode
|
|
149
|
+
]);
|
|
150
|
+
const wrapperClassName = (0, import_react.useMemo)(() => {
|
|
151
|
+
const classes = ["pisell-steps"];
|
|
152
|
+
if (className) classes.push(className);
|
|
153
|
+
if (type !== "default") classes.push(`pisell-steps-${type}`);
|
|
154
|
+
if (size !== "default") classes.push(`pisell-steps-${size}`);
|
|
155
|
+
if (direction === "vertical") classes.push("pisell-steps-vertical");
|
|
156
|
+
if (responsive) classes.push("pisell-steps-responsive");
|
|
157
|
+
if (animated) classes.push("pisell-steps-animated");
|
|
158
|
+
if (clickable) classes.push("pisell-steps-clickable");
|
|
159
|
+
if (gridLayout) classes.push("pisell-steps-grid-layout");
|
|
160
|
+
if (connectorPosition !== "center")
|
|
161
|
+
classes.push(`pisell-steps-connector-${connectorPosition}`);
|
|
162
|
+
if (itemLayout === "vertical") classes.push("pisell-steps-item-vertical");
|
|
163
|
+
return classes.join(" ");
|
|
164
|
+
}, [
|
|
165
|
+
className,
|
|
132
166
|
type,
|
|
133
167
|
size,
|
|
134
168
|
direction,
|
|
135
|
-
progressDot,
|
|
136
169
|
responsive,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
170
|
+
animated,
|
|
171
|
+
clickable,
|
|
172
|
+
gridLayout,
|
|
173
|
+
connectorPosition,
|
|
174
|
+
itemLayout
|
|
141
175
|
]);
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
176
|
+
const wrapperStyle = (0, import_react.useMemo)(() => {
|
|
177
|
+
const customStyle = { ...style };
|
|
178
|
+
if (iconSize) {
|
|
179
|
+
customStyle["--pisell-steps-icon-size"] = `${iconSize}px`;
|
|
145
180
|
}
|
|
146
|
-
|
|
147
|
-
|
|
181
|
+
if (iconColor) {
|
|
182
|
+
customStyle["--pisell-steps-icon-color"] = iconColor;
|
|
183
|
+
}
|
|
184
|
+
if (itemGap) {
|
|
185
|
+
customStyle["--pisell-steps-item-gap"] = `${itemGap}px`;
|
|
186
|
+
}
|
|
187
|
+
if (gridColumns && gridLayout) {
|
|
188
|
+
customStyle["--pisell-steps-grid-columns"] = gridColumns;
|
|
189
|
+
}
|
|
190
|
+
return customStyle;
|
|
191
|
+
}, [style, iconSize, iconColor, itemGap, gridColumns, gridLayout]);
|
|
192
|
+
const effectivePercent = showProgressPercent ? percent : void 0;
|
|
193
|
+
const antdType = type === "dot" ? "inline" : type === "navigation" ? "navigation" : "default";
|
|
148
194
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
149
|
-
|
|
195
|
+
"div",
|
|
150
196
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
197
|
+
className: wrapperClassName,
|
|
198
|
+
style: wrapperStyle,
|
|
199
|
+
"data-component": "pisell-steps",
|
|
200
|
+
"data-id": __id
|
|
201
|
+
},
|
|
202
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
203
|
+
import_antd.Steps,
|
|
204
|
+
{
|
|
205
|
+
current: currentStep - initial,
|
|
206
|
+
direction,
|
|
207
|
+
size: size === "large" ? "default" : size,
|
|
208
|
+
status,
|
|
209
|
+
items: processedItems,
|
|
210
|
+
percent: effectivePercent,
|
|
211
|
+
labelPlacement,
|
|
212
|
+
type: antdType,
|
|
213
|
+
progressDot: type === "dot" ? progressDot : false,
|
|
214
|
+
...restProps,
|
|
215
|
+
...other
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
showProgressPercent && percent !== void 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-steps-progress-info" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-steps-progress-percent" }, percent, "%"))
|
|
166
219
|
);
|
|
167
220
|
};
|
|
168
221
|
PisellSteps.displayName = "PisellSteps";
|