@pisell/materials 6.8.1 → 6.8.2

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.
@@ -50,8 +50,11 @@ var PisellProcedure = function PisellProcedure(props) {
50
50
  __id = props.__id,
51
51
  other = _objectWithoutProperties(props, _excluded);
52
52
 
53
- // 检测是否是移动端(< 744px)- 弹窗模式下不应用移动端检测
54
- var isMobile = mode === 'modal' ? false : useMobile(744);
53
+ // 检测是否是移动端(< 744px
54
+ // 注意:Hook 必须无条件调用,不能放在条件语句中
55
+ var isMobileDetected = useMobile(744);
56
+ // 弹窗模式下不应用移动端检测
57
+ var isMobile = mode === 'modal' ? false : isMobileDetected;
55
58
 
56
59
  // 使用步骤管理 Hook
57
60
  var _useStepManager = useStepManager({
@@ -132,17 +132,13 @@
132
132
 
133
133
  // 纵向排列时的样式
134
134
  .@{procedure-prefix}-body--vertical & {
135
- width: 100%;
135
+ width: 100% !important;
136
136
  flex: 1 1 auto;
137
137
  }
138
138
  }
139
139
 
140
140
  // 信息区 - 高度自适应内容,sticky 定位
141
141
  &-sidebar {
142
- width: @sidebar-width-xl;
143
- max-width: @sidebar-width-xl;
144
- min-width: @sidebar-width-xl;
145
- flex: 0 0 @sidebar-width-xl;
146
142
  background-color: @color-bg-sidebar;
147
143
  border-radius: 4px;
148
144
  position: sticky!important;
@@ -177,6 +173,10 @@
177
173
  flex: 0 0 auto !important;
178
174
  position: relative;
179
175
  top: auto;
176
+
177
+ .@{procedure-prefix}-sider-content-top{
178
+ height: 100%;
179
+ }
180
180
  }
181
181
 
182
182
  // 响应式宽度调整 - 基于容器宽度的类名控制(适用于弹窗场景)
@@ -212,6 +212,14 @@
212
212
  display: initial !important;
213
213
  }
214
214
 
215
+ // 大于1133px: 405px
216
+ @media (min-width: @breakpoint-lg) {
217
+ width: @sidebar-width-xl !important;
218
+ max-width: @sidebar-width-xl !important;
219
+ min-width: @sidebar-width-xl !important;
220
+ flex: 0 0 @sidebar-width-xl !important;
221
+ }
222
+
215
223
  // 保留媒体查询作为降级方案(当没有提供 containerSelector 时,即页面模式)
216
224
  // 弹窗模式下会添加 responsive-xs 类名,所以媒体查询不会生效
217
225
  // 960px < viewportWidth < 1133px: 376px ~ 405px 线性插值
@@ -464,7 +472,7 @@
464
472
  flex-shrink: 0;
465
473
  position: sticky;
466
474
  bottom: 0;
467
- margin:auto 0;
475
+ margin: 0;
468
476
  }
469
477
  }
470
478
  }
@@ -132,7 +132,8 @@ var ProcedureBody = function ProcedureBody(_ref) {
132
132
  extra: sidebarFooter,
133
133
  isRatioMode: layoutMode === 'ratio',
134
134
  containerSelector: bodyProps === null || bodyProps === void 0 ? void 0 : bodyProps.sidebarContainerSelector,
135
- mode: mode
135
+ mode: mode,
136
+ direction: direction
136
137
  }, bodyProps === null || bodyProps === void 0 ? void 0 : bodyProps.sidebarSlot) : null;
137
138
 
138
139
  /** 根据 contentOrder 决定渲染顺序 */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CSSProperties, ReactNode } from 'react';
3
- import type { ProcedureMode } from '../types';
3
+ import type { ProcedureMode, BodyDirection } from '../types';
4
4
  /**
5
5
  * ProcedureSidebar 子组件 Props
6
6
  */
@@ -23,6 +23,8 @@ export interface ProcedureSidebarProps {
23
23
  containerSelector?: string;
24
24
  /** 组件使用模式 */
25
25
  mode?: ProcedureMode;
26
+ /** 排列方向 */
27
+ direction?: BodyDirection;
26
28
  }
27
29
  /**
28
30
  * ProcedureSidebar 信息区组件
@@ -28,28 +28,32 @@ var ProcedureSidebar = function ProcedureSidebar(_ref) {
28
28
  isRatioMode = _ref$isRatioMode === void 0 ? false : _ref$isRatioMode,
29
29
  containerSelector = _ref.containerSelector,
30
30
  _ref$mode = _ref.mode,
31
- mode = _ref$mode === void 0 ? 'page' : _ref$mode;
32
- // 获取 header 高度
31
+ mode = _ref$mode === void 0 ? 'page' : _ref$mode,
32
+ _ref$direction = _ref.direction,
33
+ direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction;
34
+ // 垂直布局下不需要计算高度
35
+ var isVertical = direction === 'vertical';
36
+ // 获取 header 高度(垂直布局下不需要)
33
37
  var headerSize = useElementSize({
34
38
  selector: '.pisell-procedure-header',
35
- enabled: true
39
+ enabled: !isVertical
36
40
  });
37
41
 
38
- // 计算全局 footer 的高度
42
+ // 计算全局 footer 的高度(垂直布局下不需要)
39
43
  var floatAllFooterSize = useElementSize({
40
44
  selector: '.pisell-procedure-footer--float-all',
41
- enabled: true
45
+ enabled: !isVertical
42
46
  });
43
47
  var fixedBottomFooterSize = useElementSize({
44
48
  selector: '.pisell-procedure-footer--fixed-bottom',
45
- enabled: true
49
+ enabled: !isVertical
46
50
  });
47
51
  var footerHeight = Math.max((floatAllFooterSize === null || floatAllFooterSize === void 0 ? void 0 : floatAllFooterSize.height) || 0, (fixedBottomFooterSize === null || fixedBottomFooterSize === void 0 ? void 0 : fixedBottomFooterSize.height) || 0);
48
52
 
49
- // 获取容器宽度和高度
53
+ // 获取容器宽度和高度(垂直布局下不需要)
50
54
  var containerSize = useElementSize({
51
55
  selector: containerSelector || '',
52
- enabled: !!containerSelector,
56
+ enabled: !isVertical && !!containerSelector,
53
57
  threshold: 5,
54
58
  debounceMs: 200
55
59
  });
@@ -67,8 +71,12 @@ var ProcedureSidebar = function ProcedureSidebar(_ref) {
67
71
  };
68
72
  }, [containerWidth]);
69
73
 
70
- // 检查所有尺寸是否已稳定
74
+ // 检查所有尺寸是否已稳定(垂直布局下始终返回 false,不计算高度)
71
75
  var isSizeStable = useMemo(function () {
76
+ // 垂直布局下不需要计算高度
77
+ if (isVertical) {
78
+ return false;
79
+ }
72
80
  if (!(headerSize !== null && headerSize !== void 0 && headerSize.height) || headerSize.height === 0) {
73
81
  return false;
74
82
  }
@@ -76,9 +84,9 @@ var ProcedureSidebar = function ProcedureSidebar(_ref) {
76
84
  return (containerSize === null || containerSize === void 0 ? void 0 : containerSize.width) > 0 && (containerSize === null || containerSize === void 0 ? void 0 : containerSize.height) > 0;
77
85
  }
78
86
  return true;
79
- }, [containerSelector, containerSize === null || containerSize === void 0 ? void 0 : containerSize.width, containerSize === null || containerSize === void 0 ? void 0 : containerSize.height, headerSize === null || headerSize === void 0 ? void 0 : headerSize.height]);
87
+ }, [isVertical, containerSelector, containerSize === null || containerSize === void 0 ? void 0 : containerSize.width, containerSize === null || containerSize === void 0 ? void 0 : containerSize.height, headerSize === null || headerSize === void 0 ? void 0 : headerSize.height]);
80
88
 
81
- // 使用自定义 Hook 计算高度
89
+ // 使用自定义 Hook 计算高度(垂直布局下不需要)
82
90
  var siderHeight = useSidebarHeight(isSizeStable, {
83
91
  containerSelector: containerSelector,
84
92
  containerHeight: containerSize === null || containerSize === void 0 ? void 0 : containerSize.height,
@@ -87,7 +95,10 @@ var ProcedureSidebar = function ProcedureSidebar(_ref) {
87
95
  });
88
96
 
89
97
  // 使用自定义 Hook 计算响应式类名(延迟应用,避免宽度抖动)
90
- var responsiveCls = mode === 'modal' ? useResponsiveClass(containerWidth) : '';
98
+ // 注意:Hook 必须无条件调用,不能放在条件语句中
99
+ var responsiveClsComputed = useResponsiveClass(containerWidth);
100
+ // 仅在 modal 模式下应用响应式类名
101
+ var responsiveCls = mode === 'modal' ? responsiveClsComputed : '';
91
102
 
92
103
  // 信息区类名
93
104
  var sidebarCls = useMemo(function () {
@@ -242,13 +242,13 @@
242
242
  // 水平布局时(labelPlacement='horizontal'),控制图标右侧的间距
243
243
  .ant-steps-item {
244
244
  .ant-steps-item-icon {
245
- margin-right: var(--pisell-steps-item-gap);
245
+ margin-right: var(--pisell-steps-item-gap) !important;
246
246
  }
247
247
  }
248
248
 
249
249
  // 低代码平台中的样式支持 - 水平布局
250
250
  .pisell-lowcode-steps-item-icon {
251
- margin-right: var(--pisell-steps-item-gap);
251
+ margin-right: var(--pisell-steps-item-gap) !important;
252
252
  }
253
253
 
254
254
  // 低代码平台垂直布局 - 设置内容区域的上边距
@@ -76,8 +76,12 @@ var PisellTabbar = function PisellTabbar(props) {
76
76
  * 处理一级 Tab 切换
77
77
  */
78
78
  var handleLevel1Change = useCallback(function (key, item) {
79
- var _item$children, _item$children$;
80
- setActiveKey(0, key, item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length ? item === null || item === void 0 || (_item$children$ = item.children[0]) === null || _item$children$ === void 0 ? void 0 : _item$children$.id : undefined);
79
+ if (item.childrenMaxLevel !== undefined && item.childrenMaxLevel < 2) {
80
+ setActiveKey(0, key, 0);
81
+ } else {
82
+ var _item$children, _item$children$;
83
+ setActiveKey(0, key, item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length ? item === null || item === void 0 || (_item$children$ = item.children[0]) === null || _item$children$ === void 0 ? void 0 : _item$children$.id : undefined);
84
+ }
81
85
  }, [setActiveKey]);
82
86
 
83
87
  /**
@@ -67,7 +67,8 @@ var PisellProcedure = (props) => {
67
67
  __id,
68
68
  ...other
69
69
  } = props;
70
- const isMobile = mode === "modal" ? false : (0, import_useMobile.useMobile)(744);
70
+ const isMobileDetected = (0, import_useMobile.useMobile)(744);
71
+ const isMobile = mode === "modal" ? false : isMobileDetected;
71
72
  const { currentStep, goPrev, goNext, goToStep } = (0, import_hooks.useStepManager)({
72
73
  stepsProps: headerProps == null ? void 0 : headerProps.stepsProps,
73
74
  defaultCurrent,
@@ -132,17 +132,13 @@
132
132
 
133
133
  // 纵向排列时的样式
134
134
  .@{procedure-prefix}-body--vertical & {
135
- width: 100%;
135
+ width: 100% !important;
136
136
  flex: 1 1 auto;
137
137
  }
138
138
  }
139
139
 
140
140
  // 信息区 - 高度自适应内容,sticky 定位
141
141
  &-sidebar {
142
- width: @sidebar-width-xl;
143
- max-width: @sidebar-width-xl;
144
- min-width: @sidebar-width-xl;
145
- flex: 0 0 @sidebar-width-xl;
146
142
  background-color: @color-bg-sidebar;
147
143
  border-radius: 4px;
148
144
  position: sticky!important;
@@ -177,6 +173,10 @@
177
173
  flex: 0 0 auto !important;
178
174
  position: relative;
179
175
  top: auto;
176
+
177
+ .@{procedure-prefix}-sider-content-top{
178
+ height: 100%;
179
+ }
180
180
  }
181
181
 
182
182
  // 响应式宽度调整 - 基于容器宽度的类名控制(适用于弹窗场景)
@@ -212,6 +212,14 @@
212
212
  display: initial !important;
213
213
  }
214
214
 
215
+ // 大于1133px: 405px
216
+ @media (min-width: @breakpoint-lg) {
217
+ width: @sidebar-width-xl !important;
218
+ max-width: @sidebar-width-xl !important;
219
+ min-width: @sidebar-width-xl !important;
220
+ flex: 0 0 @sidebar-width-xl !important;
221
+ }
222
+
215
223
  // 保留媒体查询作为降级方案(当没有提供 containerSelector 时,即页面模式)
216
224
  // 弹窗模式下会添加 responsive-xs 类名,所以媒体查询不会生效
217
225
  // 960px < viewportWidth < 1133px: 376px ~ 405px 线性插值
@@ -464,7 +472,7 @@
464
472
  flex-shrink: 0;
465
473
  position: sticky;
466
474
  bottom: 0;
467
- margin:auto 0;
475
+ margin: 0;
468
476
  }
469
477
  }
470
478
  }
@@ -140,7 +140,8 @@ var ProcedureBody = ({
140
140
  extra: sidebarFooter,
141
141
  isRatioMode: layoutMode === "ratio",
142
142
  containerSelector: bodyProps == null ? void 0 : bodyProps.sidebarContainerSelector,
143
- mode
143
+ mode,
144
+ direction
144
145
  },
145
146
  bodyProps == null ? void 0 : bodyProps.sidebarSlot
146
147
  ) : null;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CSSProperties, ReactNode } from 'react';
3
- import type { ProcedureMode } from '../types';
3
+ import type { ProcedureMode, BodyDirection } from '../types';
4
4
  /**
5
5
  * ProcedureSidebar 子组件 Props
6
6
  */
@@ -23,6 +23,8 @@ export interface ProcedureSidebarProps {
23
23
  containerSelector?: string;
24
24
  /** 组件使用模式 */
25
25
  mode?: ProcedureMode;
26
+ /** 排列方向 */
27
+ direction?: BodyDirection;
26
28
  }
27
29
  /**
28
30
  * ProcedureSidebar 信息区组件
@@ -43,19 +43,21 @@ var ProcedureSidebar = ({
43
43
  extra,
44
44
  isRatioMode = false,
45
45
  containerSelector,
46
- mode = "page"
46
+ mode = "page",
47
+ direction = "horizontal"
47
48
  }) => {
49
+ const isVertical = direction === "vertical";
48
50
  const headerSize = (0, import_hooks.useElementSize)({
49
51
  selector: ".pisell-procedure-header",
50
- enabled: true
52
+ enabled: !isVertical
51
53
  });
52
54
  const floatAllFooterSize = (0, import_hooks.useElementSize)({
53
55
  selector: ".pisell-procedure-footer--float-all",
54
- enabled: true
56
+ enabled: !isVertical
55
57
  });
56
58
  const fixedBottomFooterSize = (0, import_hooks.useElementSize)({
57
59
  selector: ".pisell-procedure-footer--fixed-bottom",
58
- enabled: true
60
+ enabled: !isVertical
59
61
  });
60
62
  const footerHeight = Math.max(
61
63
  (floatAllFooterSize == null ? void 0 : floatAllFooterSize.height) || 0,
@@ -63,7 +65,7 @@ var ProcedureSidebar = ({
63
65
  );
64
66
  const containerSize = (0, import_hooks.useElementSize)({
65
67
  selector: containerSelector || "",
66
- enabled: !!containerSelector,
68
+ enabled: !isVertical && !!containerSelector,
67
69
  threshold: 5,
68
70
  debounceMs: 200
69
71
  });
@@ -82,6 +84,9 @@ var ProcedureSidebar = ({
82
84
  };
83
85
  }, [containerWidth]);
84
86
  const isSizeStable = (0, import_react.useMemo)(() => {
87
+ if (isVertical) {
88
+ return false;
89
+ }
85
90
  if (!(headerSize == null ? void 0 : headerSize.height) || headerSize.height === 0) {
86
91
  return false;
87
92
  }
@@ -89,14 +94,15 @@ var ProcedureSidebar = ({
89
94
  return (containerSize == null ? void 0 : containerSize.width) > 0 && (containerSize == null ? void 0 : containerSize.height) > 0;
90
95
  }
91
96
  return true;
92
- }, [containerSelector, containerSize == null ? void 0 : containerSize.width, containerSize == null ? void 0 : containerSize.height, headerSize == null ? void 0 : headerSize.height]);
97
+ }, [isVertical, containerSelector, containerSize == null ? void 0 : containerSize.width, containerSize == null ? void 0 : containerSize.height, headerSize == null ? void 0 : headerSize.height]);
93
98
  const siderHeight = (0, import_hooks.useSidebarHeight)(isSizeStable, {
94
99
  containerSelector,
95
100
  containerHeight: containerSize == null ? void 0 : containerSize.height,
96
101
  headerHeight: headerSize == null ? void 0 : headerSize.height,
97
102
  footerHeight
98
103
  });
99
- const responsiveCls = mode === "modal" ? (0, import_hooks.useResponsiveClass)(containerWidth) : "";
104
+ const responsiveClsComputed = (0, import_hooks.useResponsiveClass)(containerWidth);
105
+ const responsiveCls = mode === "modal" ? responsiveClsComputed : "";
100
106
  const sidebarCls = (0, import_react.useMemo)(() => {
101
107
  return (0, import_utils.mergeClassNames)(
102
108
  "pisell-procedure-sidebar",
@@ -242,13 +242,13 @@
242
242
  // 水平布局时(labelPlacement='horizontal'),控制图标右侧的间距
243
243
  .ant-steps-item {
244
244
  .ant-steps-item-icon {
245
- margin-right: var(--pisell-steps-item-gap);
245
+ margin-right: var(--pisell-steps-item-gap) !important;
246
246
  }
247
247
  }
248
248
 
249
249
  // 低代码平台中的样式支持 - 水平布局
250
250
  .pisell-lowcode-steps-item-icon {
251
- margin-right: var(--pisell-steps-item-gap);
251
+ margin-right: var(--pisell-steps-item-gap) !important;
252
252
  }
253
253
 
254
254
  // 低代码平台垂直布局 - 设置内容区域的上边距
@@ -74,11 +74,15 @@ var PisellTabbar = (props) => {
74
74
  const handleLevel1Change = (0, import_react.useCallback)(
75
75
  (key, item) => {
76
76
  var _a, _b;
77
- setActiveKey(
78
- 0,
79
- key,
80
- ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) ? (_b = item == null ? void 0 : item.children[0]) == null ? void 0 : _b.id : void 0
81
- );
77
+ if (item.childrenMaxLevel !== void 0 && item.childrenMaxLevel < 2) {
78
+ setActiveKey(0, key, 0);
79
+ } else {
80
+ setActiveKey(
81
+ 0,
82
+ key,
83
+ ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) ? (_b = item == null ? void 0 : item.children[0]) == null ? void 0 : _b.id : void 0
84
+ );
85
+ }
82
86
  },
83
87
  [setActiveKey]
84
88
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.8.1",
3
+ "version": "6.8.2",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -78,9 +78,9 @@
78
78
  "swiper": "^8.4.7",
79
79
  "antd-mobile": "^5.38.1",
80
80
  "vod-js-sdk-v6": "^1.4.11",
81
+ "@pisell/date-picker": "3.0.7",
81
82
  "@pisell/icon": "0.0.11",
82
- "@pisell/utils": "3.0.2",
83
- "@pisell/date-picker": "3.0.7"
83
+ "@pisell/utils": "3.0.2"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "react": "^18.0.0",