@kne/form-creator 0.1.7 → 0.1.8

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.
@@ -4895,7 +4895,8 @@ const withBlockLayout = (element, forceBlock) => {
4895
4895
  }));
4896
4896
  };
4897
4897
 
4898
- /** 列表子项内嵌的 FormInfo / List:表头圆角、去掉底边,压过 antd Card CSS-in-JS */
4898
+ /** 列表子项内嵌的 FormInfo/object:表头圆角、去掉底边,压过 antd Card CSS-in-JS
4899
+ * 不要套到嵌套 List 上,否则会干扰 form-info 的 nestDepth / nest-beyond 满宽样式。 */
4899
4900
  const nestedListItemPartProps = {
4900
4901
  styles: {
4901
4902
  header: {
@@ -4908,6 +4909,7 @@ const nestedListItemPartProps = {
4908
4909
  overflow: 'hidden'
4909
4910
  }
4910
4911
  };
4912
+ const isFormInfoLikeBlock = kind => kind === 'formInfo' || kind === 'object';
4911
4913
  const renderBlockElement = (block, preview = false, ctx = {}) => {
4912
4914
  const {
4913
4915
  isMobile = false,
@@ -4923,8 +4925,17 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
4923
4925
  asListItem: false
4924
4926
  });
4925
4927
  const bordered = isMobile ? false : block.bordered || undefined;
4926
- const listItemPartProps = asListItem ? nestedListItemPartProps : null;
4928
+ // FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
4929
+ const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
4927
4930
  const renderChildBlocks = (blocks = [], childCtx = nextCtx) => (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
4931
+
4932
+ /** list.itemBlocks:object/formInfo 走 asListItem;嵌套 list 等保持 nestDepth 链路 */
4933
+ const renderItemBlocks = (blocks = []) => (blocks || []).map(child => {
4934
+ const childCtx = _extends({}, nextCtx, {
4935
+ asListItem: isFormInfoLikeBlock(child.kind)
4936
+ });
4937
+ return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
4938
+ }).filter(Boolean);
4928
4939
  switch (block.kind) {
4929
4940
  case 'formInfo':
4930
4941
  {
@@ -4959,9 +4970,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
4959
4970
  case 'list':
4960
4971
  {
4961
4972
  const fields = renderFieldElements(block.list, preview);
4962
- const nested = renderChildBlocks(block.itemBlocks || [], _extends({}, nextCtx, {
4963
- asListItem: true
4964
- })).map(node => withBlockLayout(node, true));
4973
+ const nested = renderItemBlocks(block.itemBlocks || []);
4965
4974
  return withBlockLayout(/*#__PURE__*/createElement(List, _extends({
4966
4975
  key: block.id,
4967
4976
  name: block.name,
@@ -4976,7 +4985,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
4976
4985
  itemTitle: block.itemTitle
4977
4986
  } : {}, {
4978
4987
  list: [...fields, ...nested]
4979
- }, listItemPartProps || {})), asListItem);
4988
+ })), asListItem);
4980
4989
  }
4981
4990
  case 'tableList':
4982
4991
  {