@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.
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +15 -6
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -5053,7 +5053,8 @@ const withBlockLayout = (element, forceBlock) => {
|
|
|
5053
5053
|
});
|
|
5054
5054
|
};
|
|
5055
5055
|
|
|
5056
|
-
/** 列表子项内嵌的 FormInfo
|
|
5056
|
+
/** 列表子项内嵌的 FormInfo/object:表头圆角、去掉底边,压过 antd Card CSS-in-JS。
|
|
5057
|
+
* 不要套到嵌套 List 上,否则会干扰 form-info 的 nestDepth / nest-beyond 满宽样式。 */
|
|
5057
5058
|
const nestedListItemPartProps = {
|
|
5058
5059
|
styles: {
|
|
5059
5060
|
header: {
|
|
@@ -5066,6 +5067,7 @@ const nestedListItemPartProps = {
|
|
|
5066
5067
|
overflow: 'hidden'
|
|
5067
5068
|
}
|
|
5068
5069
|
};
|
|
5070
|
+
const isFormInfoLikeBlock = kind => kind === 'formInfo' || kind === 'object';
|
|
5069
5071
|
const renderBlockElement = function (block, preview, ctx) {
|
|
5070
5072
|
if (preview === void 0) {
|
|
5071
5073
|
preview = false;
|
|
@@ -5088,7 +5090,8 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5088
5090
|
asListItem: false
|
|
5089
5091
|
};
|
|
5090
5092
|
const bordered = isMobile ? false : block.bordered || undefined;
|
|
5091
|
-
|
|
5093
|
+
// 仅 FormInfo/object 吃列表项 Part 样式;List 等交给 form-info nestDepth
|
|
5094
|
+
const listItemPartProps = asListItem && isFormInfoLikeBlock(block.kind) ? nestedListItemPartProps : null;
|
|
5092
5095
|
const renderChildBlocks = function (blocks, childCtx) {
|
|
5093
5096
|
if (blocks === void 0) {
|
|
5094
5097
|
blocks = [];
|
|
@@ -5098,6 +5101,20 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5098
5101
|
}
|
|
5099
5102
|
return (blocks || []).map(child => renderBlockElement(child, preview, childCtx)).filter(Boolean);
|
|
5100
5103
|
};
|
|
5104
|
+
|
|
5105
|
+
/** list.itemBlocks:object/formInfo 走 asListItem;嵌套 list 等保持 nestDepth 链路 */
|
|
5106
|
+
const renderItemBlocks = function (blocks) {
|
|
5107
|
+
if (blocks === void 0) {
|
|
5108
|
+
blocks = [];
|
|
5109
|
+
}
|
|
5110
|
+
return (blocks || []).map(child => {
|
|
5111
|
+
const childCtx = {
|
|
5112
|
+
...nextCtx,
|
|
5113
|
+
asListItem: isFormInfoLikeBlock(child.kind)
|
|
5114
|
+
};
|
|
5115
|
+
return withBlockLayout(renderBlockElement(child, preview, childCtx), true);
|
|
5116
|
+
}).filter(Boolean);
|
|
5117
|
+
};
|
|
5101
5118
|
switch (block.kind) {
|
|
5102
5119
|
case 'formInfo':
|
|
5103
5120
|
{
|
|
@@ -5134,10 +5151,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5134
5151
|
case 'list':
|
|
5135
5152
|
{
|
|
5136
5153
|
const fields = renderFieldElements(block.list);
|
|
5137
|
-
const nested =
|
|
5138
|
-
...nextCtx,
|
|
5139
|
-
asListItem: true
|
|
5140
|
-
}).map(node => withBlockLayout(node, true));
|
|
5154
|
+
const nested = renderItemBlocks(block.itemBlocks || []);
|
|
5141
5155
|
return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo.List, {
|
|
5142
5156
|
key: block.id,
|
|
5143
5157
|
name: block.name,
|
|
@@ -5152,8 +5166,7 @@ const renderBlockElement = function (block, preview, ctx) {
|
|
|
5152
5166
|
...(typeof block.itemTitle === 'function' || block.itemTitle ? {
|
|
5153
5167
|
itemTitle: block.itemTitle
|
|
5154
5168
|
} : {}),
|
|
5155
|
-
list: [...fields, ...nested]
|
|
5156
|
-
...(listItemPartProps || {})
|
|
5169
|
+
list: [...fields, ...nested]
|
|
5157
5170
|
}), asListItem);
|
|
5158
5171
|
}
|
|
5159
5172
|
case 'tableList':
|