@rainbow-oh/yee-c 0.14.2 → 0.14.3

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.
@@ -16,5 +16,5 @@ type FormInterface = typeof InternalForm & {
16
16
  List: typeof List;
17
17
  };
18
18
  declare const Form: FormInterface;
19
- export type { FieldGroupProps, FieldStatus, FieldStatusData, FormInstance, FormListProps, FormProps, ValidateMessage, } from './interface';
19
+ export type { FieldGroupProps, FieldStatus, FieldStatusData, FormInstance, FormListProps, FormProps, Rule as FormRule, ValidateMessage, } from './interface';
20
20
  export default Form;
@@ -80,10 +80,11 @@ var getPanelSize = (children, {
80
80
  layout
81
81
  }) => {
82
82
  const panelsRect = [];
83
- const count = import_react.default.Children.count(children);
83
+ const items = import_react.default.Children.toArray(children);
84
+ const count = items.length;
84
85
  let remainingSize = totalSize;
85
86
  let remainingItem = count;
86
- import_react.default.Children.forEach(children, (child) => {
87
+ items.forEach((child) => {
87
88
  if (import_react.default.isValidElement(child)) {
88
89
  const { style, size, defaultSize, min, max } = child.props || {};
89
90
  const styleSize = style ? layout === "horizontal" ? style.width : style.height : void 0;
@@ -140,6 +141,7 @@ var getPanelSize = (children, {
140
141
  });
141
142
  panelsRect.forEach((item) => {
142
143
  if (item.type === "default") {
144
+ item.currentSize = item.size;
143
145
  remainingSize -= item.size || 0;
144
146
  remainingItem--;
145
147
  } else if (item.type === "percent") {
@@ -152,7 +154,7 @@ var getPanelSize = (children, {
152
154
  if (remainingItem > 0) {
153
155
  panelsRect.forEach((item) => {
154
156
  if (item.type === "auto") {
155
- item.size = remainingSize / remainingItem;
157
+ item.size = Math.max(0, remainingSize / remainingItem);
156
158
  item.currentSize = item.size;
157
159
  }
158
160
  });
@@ -164,7 +166,7 @@ var Wrapper = (_a) => {
164
166
  const wrappered = [];
165
167
  const refs = (0, import_react.useRef)({});
166
168
  const arr = import_react.default.Children.toArray(children);
167
- import_react.default.Children.forEach(children, (child, index) => {
169
+ arr.forEach((child, index) => {
168
170
  if (import_react.default.isValidElement(child)) {
169
171
  const n = index + 1;
170
172
  const { style } = child.props || {};
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-09-20T02:38:16.830Z
4
+ * Generated on 2026-09-21T06:47:43.665Z
5
5
  */
6
6
 
7
7
  /* ========== color.blue.css ========== */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-09-20T02:38:16.830Z
4
+ * Generated on 2026-09-21T06:47:43.665Z
5
5
  */
6
6
 
7
7
  /* ========== color.css ========== */
@@ -3,4 +3,4 @@ declare global {
3
3
  __yee_c_version__: string;
4
4
  }
5
5
  }
6
- export declare const version = "0.14.2";
6
+ export declare const version = "0.14.3";
@@ -22,7 +22,7 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- var version = "0.14.2";
25
+ var version = "0.14.3";
26
26
  if (typeof window !== "undefined") {
27
27
  window.__yee_c_version__ = version;
28
28
  }
@@ -16,5 +16,5 @@ type FormInterface = typeof InternalForm & {
16
16
  List: typeof List;
17
17
  };
18
18
  declare const Form: FormInterface;
19
- export type { FieldGroupProps, FieldStatus, FieldStatusData, FormInstance, FormListProps, FormProps, ValidateMessage, } from './interface';
19
+ export type { FieldGroupProps, FieldStatus, FieldStatusData, FormInstance, FormListProps, FormProps, Rule as FormRule, ValidateMessage, } from './interface';
20
20
  export default Form;
@@ -35,10 +35,13 @@ var getPanelSize = function getPanelSize(children, _ref) {
35
35
  var totalSize = _ref.totalSize,
36
36
  layout = _ref.layout;
37
37
  var panelsRect = [];
38
- var count = React.Children.count(children);
38
+ // toArray 剔除 null/undefined/boolean(如 `{open ? <Item/> : null}` 条件面板)。
39
+ // Children.count 会把 null 也计为一面板,导致 auto 面板被平分出错误尺寸。
40
+ var items = React.Children.toArray(children);
41
+ var count = items.length;
39
42
  var remainingSize = totalSize;
40
43
  var remainingItem = count;
41
- React.Children.forEach(children, function (child) {
44
+ items.forEach(function (child) {
42
45
  if ( /*#__PURE__*/React.isValidElement(child)) {
43
46
  var _ref2 = child.props || {},
44
47
  style = _ref2.style,
@@ -100,6 +103,8 @@ var getPanelSize = function getPanelSize(children, _ref) {
100
103
  });
101
104
  panelsRect.forEach(function (item) {
102
105
  if (item.type === 'default') {
106
+ // currentSize 缺失会导致 Wrapper 注入的 flexBasis 为空,defaultSize 失效(宽度由内容撑开)
107
+ item.currentSize = item.size;
103
108
  remainingSize -= item.size || 0;
104
109
  remainingItem--;
105
110
  } else if (item.type === 'percent') {
@@ -112,7 +117,8 @@ var getPanelSize = function getPanelSize(children, _ref) {
112
117
  if (remainingItem > 0) {
113
118
  panelsRect.forEach(function (item) {
114
119
  if (item.type === 'auto') {
115
- item.size = remainingSize / remainingItem;
120
+ // 显式尺寸总和超出 totalSize 时 remainingSize 为负,负 flexBasis 会被浏览器丢弃导致面板回退内容尺寸
121
+ item.size = Math.max(0, remainingSize / remainingItem);
116
122
  item.currentSize = item.size;
117
123
  }
118
124
  });
@@ -126,8 +132,9 @@ var Wrapper = function Wrapper(_ref3) {
126
132
  props = _objectWithoutProperties(_ref3, _excluded);
127
133
  var wrappered = [];
128
134
  var refs = useRef({});
135
+ // 与 getPanelSize 同口径:toArray 剔除 null,index/handler 判断不受条件渲染干扰
129
136
  var arr = React.Children.toArray(children);
130
- React.Children.forEach(children, function (child, index) {
137
+ arr.forEach(function (child, index) {
131
138
  if ( /*#__PURE__*/React.isValidElement(child)) {
132
139
  var n = index + 1;
133
140
  var _ref4 = child.props || {},
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-09-20T02:38:16.830Z
4
+ * Generated on 2026-09-21T06:47:43.665Z
5
5
  */
6
6
 
7
7
  /* ========== color.blue.css ========== */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-09-20T02:38:16.830Z
4
+ * Generated on 2026-09-21T06:47:43.665Z
5
5
  */
6
6
 
7
7
  /* ========== color.css ========== */
@@ -3,4 +3,4 @@ declare global {
3
3
  __yee_c_version__: string;
4
4
  }
5
5
  }
6
- export declare const version = "0.14.2";
6
+ export declare const version = "0.14.3";
@@ -1,4 +1,4 @@
1
- export var version = "0.14.2";
1
+ export var version = "0.14.3";
2
2
  if (typeof window !== 'undefined') {
3
3
  window.__yee_c_version__ = version;
4
4
  }