转换器 width/colspan 精确版面:layout colspan→amis grid 按比例列宽
补 parseLayoutRows/buildTabBody/LayoutCell(并修上轮半成品致 main 不编译的断点) 真实数据只有 colspan 无像素 width→md 比例列宽,避 columnCount 等宽坑;无信号退回 group 两栏。76测 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -946,22 +946,22 @@ public class TemplateToAmisConverter {
|
|||||||
byName.put(String.valueOf(it.get("name")), it);
|
byName.put(String.valueOf(it.get("name")), it);
|
||||||
}
|
}
|
||||||
Set<String> placed = new LinkedHashSet<>();
|
Set<String> placed = new LinkedHashSet<>();
|
||||||
|
boolean anyGrid = false;
|
||||||
List<Map<String, Object>> tabSchemas = new ArrayList<>();
|
List<Map<String, Object>> tabSchemas = new ArrayList<>();
|
||||||
for (Element tabEl : tabEls) {
|
for (Element tabEl : tabEls) {
|
||||||
String title = tabEl.attributeValue("name");
|
String title = tabEl.attributeValue("name");
|
||||||
if (title == null || title.isBlank()) {
|
if (title == null || title.isBlank()) {
|
||||||
title = "页面";
|
title = "页面";
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> tabItems = new ArrayList<>();
|
// 按 HTML 表格行结构解析(含 <td colspan> 跨列版面信息),字段按文档序归位
|
||||||
for (String nm : extractLocations(tabEl.getText())) {
|
List<List<LayoutCell>> tabRows = parseLayoutRows(tabEl.getText());
|
||||||
Map<String, Object> it = byName.get(nm);
|
List<Map<String, Object>> tabBody = buildTabBody(tabRows, byName, placed);
|
||||||
if (it != null && placed.add(nm)) {
|
if (tabBody.stream().anyMatch(row -> "grid".equals(row.get("type")))) {
|
||||||
tabItems.add(it);
|
anyGrid = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Map<String, Object> tabSchema = new LinkedHashMap<>();
|
Map<String, Object> tabSchema = new LinkedHashMap<>();
|
||||||
tabSchema.put("title", title);
|
tabSchema.put("title", title);
|
||||||
tabSchema.put("body", buildFormRows(tabItems));
|
tabSchema.put("body", tabBody);
|
||||||
tabSchemas.add(tabSchema);
|
tabSchemas.add(tabSchema);
|
||||||
}
|
}
|
||||||
// 未被任何 <div location> 引用的字段(隐藏主键/未布局)收尾追加到末 tab,不丢失
|
// 未被任何 <div location> 引用的字段(隐藏主键/未布局)收尾追加到末 tab,不丢失
|
||||||
@@ -977,7 +977,8 @@ public class TemplateToAmisConverter {
|
|||||||
}
|
}
|
||||||
result.note("form <layout> → " + tabSchemas.size() + " 个 amis tab(字段按 <div location> 归位"
|
result.note("form <layout> → " + tabSchemas.size() + " 个 amis tab(字段按 <div location> 归位"
|
||||||
+ (leftovers.isEmpty() ? "" : ";" + leftovers.size() + " 个未布局字段收尾追加")
|
+ (leftovers.isEmpty() ? "" : ";" + leftovers.size() + " 个未布局字段收尾追加")
|
||||||
+ ";width/colspan 像素版面暂按两栏近似,后续专项)");
|
+ ";" + (anyGrid ? "<td colspan> 版面信息 → amis grid 按比例列宽(md/12)"
|
||||||
|
: "无 colspan 版面信息 → 退回 group 两栏") + ")");
|
||||||
if (tabSchemas.size() == 1) {
|
if (tabSchemas.size() == 1) {
|
||||||
return (List<Map<String, Object>>) tabSchemas.get(0).get("body"); // 单 tab 不套 tabs 壳
|
return (List<Map<String, Object>>) tabSchemas.get(0).get("body"); // 单 tab 不套 tabs 壳
|
||||||
}
|
}
|
||||||
@@ -989,20 +990,150 @@ public class TemplateToAmisConverter {
|
|||||||
return bodyList;
|
return bodyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** amis grid 总栅格数(12 列),col.md = 字段占的网格槽位按比例折算到 12。 */
|
||||||
|
private static final int AMIS_GRID = 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一个版面单元格:tab 内 {@code <td class="customtablecomponent" [colspan=N]>} 包裹的
|
||||||
|
* {@code <div location="字段名">}。{@code slots} = 该字段在老系统网格中占的列槽位
|
||||||
|
* (1 个 caption td + colspan 个 component td;colspan 默认 1 → slots=2)。
|
||||||
|
*/
|
||||||
|
private record LayoutCell(String fieldName, int slots) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 匹配一个 {@code customtablecomponent} td(可带 colspan/其它属性,顺序不定)连其内 div location。 */
|
||||||
|
private static final java.util.regex.Pattern COMPONENT_CELL = java.util.regex.Pattern.compile(
|
||||||
|
"<td\\b([^>]*\\bcustomtablecomponent\\b[^>]*)>\\s*<div\\b[^>]*\\blocation\\s*=\\s*\"([^\"]+)\"",
|
||||||
|
java.util.regex.Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
|
/** 兜底:无 customtablecomponent class 时退回纯 {@code <div location>}(A2 那套简表)。 */
|
||||||
private static final java.util.regex.Pattern LOCATION_ATTR =
|
private static final java.util.regex.Pattern LOCATION_ATTR =
|
||||||
java.util.regex.Pattern.compile("location\\s*=\\s*\"([^\"]+)\"");
|
java.util.regex.Pattern.compile("location\\s*=\\s*\"([^\"]+)\"");
|
||||||
|
|
||||||
/** 从 tab 的 HTML(CDATA)文本按文档序提取 {@code <div location="X">} 的字段名。 */
|
private static final java.util.regex.Pattern COLSPAN_ATTR =
|
||||||
private static List<String> extractLocations(String html) {
|
java.util.regex.Pattern.compile("\\bcolspan\\s*=\\s*\"?(\\d+)", java.util.regex.Pattern.CASE_INSENSITIVE);
|
||||||
List<String> names = new ArrayList<>();
|
|
||||||
|
private static final java.util.regex.Pattern ROW_SPLIT =
|
||||||
|
java.util.regex.Pattern.compile("<tr\\b[^>]*>(.*?)</tr>",
|
||||||
|
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.DOTALL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把 tab 的 HTML(CDATA)按 {@code <tr>} 行解析为版面行序列,每行携带其字段 +
|
||||||
|
* 各字段占的网格槽位(含 {@code <td colspan>} 跨列信息)。
|
||||||
|
*
|
||||||
|
* <p>优先按 {@code customtablecomponent} td 识别(老系统标准编辑表格结构,见真实 view_page),
|
||||||
|
* 从中读 colspan;该结构缺失(A2 简表)时退回纯 {@code <div location>}(每字段 slots=2,等宽)。
|
||||||
|
* 正则解析规避 CDATA 内 HTML 的 {@code } 等非严格 XML 实体导致 DOM 解析失败。
|
||||||
|
*/
|
||||||
|
private static List<List<LayoutCell>> parseLayoutRows(String html) {
|
||||||
|
List<List<LayoutCell>> rows = new ArrayList<>();
|
||||||
if (html == null || html.isBlank()) {
|
if (html == null || html.isBlank()) {
|
||||||
return names;
|
return rows;
|
||||||
}
|
}
|
||||||
java.util.regex.Matcher m = LOCATION_ATTR.matcher(html);
|
java.util.regex.Matcher rowM = ROW_SPLIT.matcher(html);
|
||||||
while (m.find()) {
|
while (rowM.find()) {
|
||||||
names.add(m.group(1));
|
String rowHtml = rowM.group(1);
|
||||||
|
List<LayoutCell> cells = new ArrayList<>();
|
||||||
|
java.util.regex.Matcher cm = COMPONENT_CELL.matcher(rowHtml);
|
||||||
|
while (cm.find()) {
|
||||||
|
String tdAttrs = cm.group(1);
|
||||||
|
String field = cm.group(2);
|
||||||
|
java.util.regex.Matcher csm = COLSPAN_ATTR.matcher(tdAttrs);
|
||||||
|
int colspan = csm.find() ? Math.max(1, Integer.parseInt(csm.group(1))) : 1;
|
||||||
|
cells.add(new LayoutCell(field, 1 + colspan)); // 1 caption td + colspan component td
|
||||||
|
}
|
||||||
|
if (!cells.isEmpty()) {
|
||||||
|
rows.add(cells);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return names;
|
if (rows.isEmpty()) {
|
||||||
|
// 无 customtablecomponent 结构(A2 简表/无版面信息)→ 退回纯 location 顺序解析,
|
||||||
|
// 每字段单独成行(slots=2、无多列),buildTabBody 检测不到版面信号 → 走 buildFormRows 既有两栏
|
||||||
|
java.util.regex.Matcher lm = LOCATION_ATTR.matcher(html);
|
||||||
|
while (lm.find()) {
|
||||||
|
List<LayoutCell> single = new ArrayList<>();
|
||||||
|
single.add(new LayoutCell(lm.group(1), 2));
|
||||||
|
rows.add(single);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由版面行序列构建 tab body。携带真实跨列版面信息(任意 colspan>1,或一行多于一个字段)
|
||||||
|
* 时 → amis {@code grid} 行,列 {@code md} = 字段槽位/网格总槽位×12(按比例列宽,
|
||||||
|
* <b>非</b> form.columnCount 的纯 CSS 等宽);否则退回 {@link #buildFormRows} 既有 group 两栏(向后兼容)。
|
||||||
|
*
|
||||||
|
* <p>宽控件(富文本/附件/多行/子表)无论 colspan 如何一律 {@code md=12} 独占整行——
|
||||||
|
* 防止富文本被塞半栏(52c7397 TinyMCE 挤竖条根因)。{@code hidden} 字段不进 grid,平铺在行外。
|
||||||
|
*/
|
||||||
|
private static List<Map<String, Object>> buildTabBody(List<List<LayoutCell>> rows,
|
||||||
|
Map<String, Map<String, Object>> byName, Set<String> placed) {
|
||||||
|
// 先归位本 tab 的字段(按行内文档序),并判断是否有真实版面信号
|
||||||
|
boolean hasGridSignal = false;
|
||||||
|
int gridTotalSlots = 0;
|
||||||
|
List<List<LayoutCell>> resolvedRows = new ArrayList<>();
|
||||||
|
for (List<LayoutCell> row : rows) {
|
||||||
|
List<LayoutCell> kept = new ArrayList<>();
|
||||||
|
int rowSlots = 0;
|
||||||
|
for (LayoutCell cell : row) {
|
||||||
|
if (!byName.containsKey(cell.fieldName()) || !placed.add(cell.fieldName())) {
|
||||||
|
continue; // 字段不存在或已被前面 tab 归位 → 跳过
|
||||||
|
}
|
||||||
|
kept.add(cell);
|
||||||
|
rowSlots += cell.slots();
|
||||||
|
if (cell.slots() != 2) {
|
||||||
|
hasGridSignal = true; // colspan>1 → 真实跨列
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (kept.size() > 1) {
|
||||||
|
hasGridSignal = true; // 一行多字段 → 真实多列版面
|
||||||
|
}
|
||||||
|
if (!kept.isEmpty()) {
|
||||||
|
resolvedRows.add(kept);
|
||||||
|
gridTotalSlots = Math.max(gridTotalSlots, rowSlots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 收集本 tab 全部归位字段(按行序),供退回路径用
|
||||||
|
List<Map<String, Object>> items = new ArrayList<>();
|
||||||
|
for (List<LayoutCell> row : resolvedRows) {
|
||||||
|
for (LayoutCell cell : row) {
|
||||||
|
items.add(byName.get(cell.fieldName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasGridSignal || gridTotalSlots <= 0) {
|
||||||
|
return buildFormRows(items); // 无版面信号 → 既有 group 两栏(向后兼容,零回归)
|
||||||
|
}
|
||||||
|
// 有版面信号 → 逐行 amis grid,列 md 按槽位比例折算到 12
|
||||||
|
List<Map<String, Object>> body = new ArrayList<>();
|
||||||
|
for (List<LayoutCell> row : resolvedRows) {
|
||||||
|
List<Map<String, Object>> columns = new ArrayList<>();
|
||||||
|
for (LayoutCell cell : row) {
|
||||||
|
Map<String, Object> item = byName.get(cell.fieldName());
|
||||||
|
if (Boolean.TRUE.equals(item.get("hidden"))) {
|
||||||
|
body.add(item); // hidden 不渲染,平铺行外,不占栅格
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int md = isWideField(item)
|
||||||
|
? AMIS_GRID // 宽控件独占整行
|
||||||
|
: Math.max(1, Math.min(AMIS_GRID,
|
||||||
|
Math.round((float) cell.slots() / gridTotalSlots * AMIS_GRID)));
|
||||||
|
Map<String, Object> col = new LinkedHashMap<>();
|
||||||
|
col.put("md", md);
|
||||||
|
List<Map<String, Object>> colBody = new ArrayList<>();
|
||||||
|
colBody.add(item);
|
||||||
|
col.put("body", colBody);
|
||||||
|
columns.add(col);
|
||||||
|
}
|
||||||
|
if (columns.isEmpty()) {
|
||||||
|
continue; // 整行都是 hidden,已平铺
|
||||||
|
}
|
||||||
|
Map<String, Object> grid = new LinkedHashMap<>();
|
||||||
|
grid.put("type", "grid");
|
||||||
|
grid.put("columns", columns);
|
||||||
|
body.add(grid);
|
||||||
|
}
|
||||||
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -449,6 +449,131 @@ class TemplateToAmisConverterTest {
|
|||||||
assertTrue(all.contains("name=HIDDENKEY"), "未布局字段应收尾追加,不丢失");
|
assertTrue(all.contains("name=HIDDENKEY"), "未布局字段应收尾追加,不丢失");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
void form_layout含colspan转amis栅格按比例列宽() {
|
||||||
|
// width/colspan 像素版面:view_page <layout> 的 HTML <td colspan> 携带跨列版面信息。
|
||||||
|
// 老系统网格列总数=最宽行的 td 槽位数;普通字段=1 caption td + 1 component td(colspan 默认 1);
|
||||||
|
// colspan="N" 的 component td 让字段跨 1+N 槽。转成 amis grid(12 栅格),列 md=槽位/总槽位*12。
|
||||||
|
//
|
||||||
|
// 本片段(取真实 1.0.81 view_page 结构):第一行 3 个普通字段(总 6 槽)→每个 md=4;
|
||||||
|
// 第二行 SERVICES colspan=5 → 1+5=6 槽=满行 → md=12(独占整行,按比例,非等宽两栏)。
|
||||||
|
String pageXml = "<page entityid='e9'><fields>"
|
||||||
|
+ "<field name='TEMPLATEID' label='模板' uitype='TextField'/>"
|
||||||
|
+ "<field name='TEMPLATETYPE' label='功能类型' uitype='TextField'/>"
|
||||||
|
+ "<field name='MANAGER' label='负责人' uitype='TextField'/>"
|
||||||
|
+ "<field name='SERVICES' label='服务' uitype='TextField'/>"
|
||||||
|
+ "</fields><layout>"
|
||||||
|
+ "<tab name='基本'><![CDATA[<table><tbody>"
|
||||||
|
+ "<tr><td class=\"customtablecaption\">模板</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\"><div location=\"TEMPLATEID\">模板</div></td>"
|
||||||
|
+ "<td class=\"customtablecaption\">功能类型</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\"><div location=\"TEMPLATETYPE\">功能类型</div></td>"
|
||||||
|
+ "<td class=\"customtablecaption\">负责人</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\"><div location=\"MANAGER\">负责人</div></td></tr>"
|
||||||
|
+ "<tr><td class=\"customtablecaption\">服务</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\" colspan=\"5\" rowspan=\"1\"><div location=\"SERVICES\">服务</div></td></tr>"
|
||||||
|
+ "</tbody></table>]]></tab>"
|
||||||
|
+ "</layout></page>";
|
||||||
|
Function<String, String> resolver = id -> pageXml;
|
||||||
|
String xml = "<form entityid='e1' pageid='p1'/>";
|
||||||
|
ConversionResult r = converter.convertGraded(xml, new ArrayList<>(), resolver);
|
||||||
|
|
||||||
|
Map<String, Object> form = body(r.getSchema());
|
||||||
|
List<Map<String, Object>> formBody = (List<Map<String, Object>>) form.get("body");
|
||||||
|
// 单 tab 不套 tabs 壳;body 直接是版面行序列,含 colspan 时为 grid 行
|
||||||
|
Map<String, Object> firstRow = formBody.get(0);
|
||||||
|
assertEquals("grid", firstRow.get("type"), "携带 colspan 版面信息的行应转 amis grid(非等宽两栏 group)");
|
||||||
|
List<Map<String, Object>> cols = (List<Map<String, Object>>) firstRow.get("columns");
|
||||||
|
assertEquals(3, cols.size(), "首行 3 个普通字段 → 3 个 grid 列");
|
||||||
|
// 三个等宽字段 → 每列 md=4(4+4+4=12,按比例占满 12 栅格)
|
||||||
|
assertEquals(4, cols.get(0).get("md"));
|
||||||
|
assertEquals(4, cols.get(1).get("md"));
|
||||||
|
assertEquals(4, cols.get(2).get("md"));
|
||||||
|
assertTrue(cols.get(0).get("body").toString().contains("name=TEMPLATEID"));
|
||||||
|
assertTrue(cols.get(2).get("body").toString().contains("name=MANAGER"));
|
||||||
|
|
||||||
|
// 第二行 SERVICES colspan=5 → md=12(按比例独占整行,区别于 columnCount 等宽)
|
||||||
|
Map<String, Object> secondRow = formBody.get(1);
|
||||||
|
assertEquals("grid", secondRow.get("type"));
|
||||||
|
List<Map<String, Object>> cols2 = (List<Map<String, Object>>) secondRow.get("columns");
|
||||||
|
assertEquals(1, cols2.size());
|
||||||
|
assertEquals(12, cols2.get(0).get("md"), "colspan=5 满行字段 → md=12 整行");
|
||||||
|
assertTrue(cols2.get(0).get("body").toString().contains("name=SERVICES"));
|
||||||
|
|
||||||
|
// 过闸一:grid 是 amis 6.13 合法栅格渲染器,不重蹈 columnCount 覆辙
|
||||||
|
SchemaGate gate = new SchemaGate();
|
||||||
|
List<String> errors = gate.validate(r.getSchema());
|
||||||
|
assertTrue(errors.isEmpty(), () -> "colspan→grid 应过闸一,但有错误: " + errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
void form_layout无colspan信号退回原group两栏布局() {
|
||||||
|
// 向后兼容:layout HTML 不带 colspan(纯顺序归位,如 A2 多页签那套 <table><tr><td><div location>)
|
||||||
|
// → 不引入 grid,退回既有 buildFormRows(窄字段两两 group、宽控件独占整行),零回归。
|
||||||
|
String pageXml = "<page entityid='e9'><fields>"
|
||||||
|
+ "<field name='NAME' label='名称' uitype='TextField'/>"
|
||||||
|
+ "<field name='SN' label='序列号' uitype='TextField'/>"
|
||||||
|
+ "</fields><layout>"
|
||||||
|
+ "<tab name='基本'><![CDATA[<table><tr><td><div location=\"NAME\">名称</div></td>"
|
||||||
|
+ "<td><div location=\"SN\">序列号</div></td></tr></table>]]></tab>"
|
||||||
|
+ "</layout></page>";
|
||||||
|
Function<String, String> resolver = id -> pageXml;
|
||||||
|
String xml = "<form entityid='e1' pageid='p1'/>";
|
||||||
|
ConversionResult r = converter.convertGraded(xml, new ArrayList<>(), resolver);
|
||||||
|
|
||||||
|
Map<String, Object> form = body(r.getSchema());
|
||||||
|
List<Map<String, Object>> formBody = (List<Map<String, Object>>) form.get("body");
|
||||||
|
// 无 colspan 信号 → 退回 group 行(既有显式两栏),不出现 grid
|
||||||
|
Map<String, Object> firstRow = formBody.get(0);
|
||||||
|
assertEquals("group", firstRow.get("type"), "无 colspan 版面信号应退回既有 group 两栏布局(向后兼容)");
|
||||||
|
assertFalse(formBody.toString().contains("type=grid"), "无 colspan 时不应引入 grid");
|
||||||
|
// 字段不丢失
|
||||||
|
assertTrue(formBody.toString().contains("name=NAME") && formBody.toString().contains("name=SN"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
void form_layout宽控件colspan行内仍独占整行() {
|
||||||
|
// 宽控件(富文本/附件/多行/子表)即便 colspan 描述了网格,也必须 md=12 独占整行——
|
||||||
|
// 防止富文本被塞半栏(52c7397 富文本 TinyMCE 挤竖条的根因)。
|
||||||
|
String pageXml = "<page entityid='e9'><fields>"
|
||||||
|
+ "<field name='TITLE' label='标题' uitype='TextField'/>"
|
||||||
|
+ "<field name='CODE' label='编码' uitype='TextField'/>"
|
||||||
|
+ "<field name='CONTENT' label='正文' uitype='RichTextArea'/>"
|
||||||
|
+ "</fields><layout>"
|
||||||
|
+ "<tab name='基本'><![CDATA[<table><tbody>"
|
||||||
|
+ "<tr><td class=\"customtablecaption\">标题</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\"><div location=\"TITLE\">标题</div></td>"
|
||||||
|
+ "<td class=\"customtablecaption\">编码</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\"><div location=\"CODE\">编码</div></td></tr>"
|
||||||
|
+ "<tr><td class=\"customtablecaption\">正文</td>"
|
||||||
|
+ "<td class=\"customtablecomponent\" colspan=\"3\"><div location=\"CONTENT\">正文</div></td></tr>"
|
||||||
|
+ "</tbody></table>]]></tab>"
|
||||||
|
+ "</layout></page>";
|
||||||
|
Function<String, String> resolver = id -> pageXml;
|
||||||
|
String xml = "<form entityid='e1' pageid='p1'/>";
|
||||||
|
ConversionResult r = converter.convertGraded(xml, new ArrayList<>(), resolver);
|
||||||
|
|
||||||
|
Map<String, Object> form = body(r.getSchema());
|
||||||
|
List<Map<String, Object>> formBody = (List<Map<String, Object>>) form.get("body");
|
||||||
|
// 富文本所在行 md=12 独占整行
|
||||||
|
String all = formBody.toString();
|
||||||
|
assertTrue(all.contains("name=CONTENT") && all.contains("input-rich-text"));
|
||||||
|
// 找到含富文本的 grid 行,断言其单列 md=12
|
||||||
|
Map<String, Object> richRow = formBody.stream()
|
||||||
|
.filter(row -> "grid".equals(row.get("type"))
|
||||||
|
&& row.toString().contains("input-rich-text"))
|
||||||
|
.findFirst().orElseThrow();
|
||||||
|
List<Map<String, Object>> richCols = (List<Map<String, Object>>) richRow.get("columns");
|
||||||
|
assertEquals(1, richCols.size());
|
||||||
|
assertEquals(12, richCols.get(0).get("md"), "富文本必须独占整行(md=12),不被塞半栏");
|
||||||
|
|
||||||
|
SchemaGate gate = new SchemaGate();
|
||||||
|
assertTrue(gate.validate(r.getSchema()).isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
void form_附件字段MultiFileUploadField转inputFile() {
|
void form_附件字段MultiFileUploadField转inputFile() {
|
||||||
|
|||||||
Reference in New Issue
Block a user