commit a9219c5c77e38a5ceb7e2eaf2963bcbf5ef89739 Author: zhengwr Date: Wed Jun 10 23:40:51 2026 +0800 chore: 落地 eip4-platform 多模块骨架基线(PoC→工程化) 从 eip4-poc 迁入双层制模块化单体:保真层 platform-legacy-core (com.dsasp 引擎原样)+ 现代层 platform-metadata/auth/flow-gateway/ converter/ai + platform-app 启动器。ArchUnit 纪律固化(保真层禁依赖现代层)。 此为 C1 对拍工作的编译通过基线。 Co-Authored-By: Claude Fable 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..17b61d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +target/ +*.class +.DS_Store +.idea/ +*.iml +.omc/ diff --git a/platform-ai/pom.xml b/platform-ai/pom.xml new file mode 100644 index 0000000..5134213 --- /dev/null +++ b/platform-ai/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-ai + platform-ai + P5 占位:MCP Server、schema 双闸校验 + + com.eip4platform-legacy-core + + diff --git a/platform-app/pom.xml b/platform-app/pom.xml new file mode 100644 index 0000000..f2da973 --- /dev/null +++ b/platform-app/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-app + platform-app + Spring Boot 启动器,组装全部模块。单客户交付形态四进程之一(eip4-platform.jar) + + + com.eip4platform-legacy-core + com.eip4platform-metadata + com.eip4platform-auth + com.eip4platform-flow-gateway + com.eip4platform-converter + com.eip4platform-ai + org.springframework.bootspring-boot-starter-web + org.postgresqlpostgresqlruntime + org.springframework.bootspring-boot-starter-testtest + + com.tngtech.archunitarchunit-junit5test + + com.eip4platform-paritytest + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/platform-app/src/main/java/com/eip4/platform/app/Eip4PlatformApplication.java b/platform-app/src/main/java/com/eip4/platform/app/Eip4PlatformApplication.java new file mode 100644 index 0000000..8dcd5a1 --- /dev/null +++ b/platform-app/src/main/java/com/eip4/platform/app/Eip4PlatformApplication.java @@ -0,0 +1,17 @@ +package com.eip4.platform.app; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * EIP3 路线 A' PoC(WS1):POJOCRUDService/POJOService 元数据引擎 + * 从 OSGi/Spring 3.1/JDK 6 移植到 Spring Boot 3 / JDK 17 的验证工程。 + * 扫描范围覆盖移植代码包 com.dsasp 与新代码包 com.eip4.platform。 + */ +@SpringBootApplication(scanBasePackages = {"com.eip4.platform", "com.dsasp"}) +public class Eip4PlatformApplication { + + public static void main(String[] args) { + SpringApplication.run(Eip4PlatformApplication.class, args); + } +} diff --git a/platform-app/src/main/java/com/eip4/platform/app/config/LegacyXmlWiring.java b/platform-app/src/main/java/com/eip4/platform/app/config/LegacyXmlWiring.java new file mode 100644 index 0000000..93a3ff5 --- /dev/null +++ b/platform-app/src/main/java/com/eip4/platform/app/config/LegacyXmlWiring.java @@ -0,0 +1,49 @@ +package com.eip4.platform.app.config; + +import org.springframework.beans.factory.SmartInitializingSingleton; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.datatype.joda.JodaModule; + +import com.dsasp.server.common.log.service.DataOperatorLog; +import com.dsasp.server.common.log.service.SystemLogManager; +import com.dsasp.server.dataDic.service.POJOCRUDServiceImpl; +import com.dsasp.server.dataDic.service.POJOServiceImpl; + +/** + * 等价替代原 com.dsasp.server.dataDic/META-INF/spring/service.xml 的 + * setter 装配:systemLogManager / dataOperatorLog 在旧代码中 + * 不是 @Autowired 字段,而是 XML 注入。这里集中补齐,旧类零修改。 + */ +@Configuration +public class LegacyXmlWiring implements SmartInitializingSingleton { + + private final POJOCRUDServiceImpl pojoCRUDService; + private final POJOServiceImpl pojoService; + private final SystemLogManager systemLogManager; + private final DataOperatorLog dataOperatorLog; + + public LegacyXmlWiring(POJOCRUDServiceImpl pojoCRUDService, + POJOServiceImpl pojoService, + SystemLogManager systemLogManager, + DataOperatorLog dataOperatorLog) { + this.pojoCRUDService = pojoCRUDService; + this.pojoService = pojoService; + this.systemLogManager = systemLogManager; + this.dataOperatorLog = dataOperatorLog; + } + + @Override + public void afterSingletonsInstantiated() { + pojoCRUDService.setSystemLogManager(systemLogManager); + pojoService.setSystemLogManager(systemLogManager); + pojoService.setDataOperatorLog(dataOperatorLog); + } + + /** 引擎字段值含 joda DateTime(CREATETIME 等),Boot 3 需显式注册序列化模块。 */ + @Bean + public JodaModule jodaModule() { + return new JodaModule(); + } +} diff --git a/platform-app/src/main/resources/application.yml b/platform-app/src/main/resources/application.yml new file mode 100644 index 0000000..6d23e72 --- /dev/null +++ b/platform-app/src/main/resources/application.yml @@ -0,0 +1,19 @@ +spring: + application: + name: eip4-poc + datasource: + url: jdbc:postgresql://192.168.20.68:5435/postgres?currentSchema=eip3 + username: ceshi + password: ceshi + hikari: + maximum-pool-size: 5 + # PoC 阶段对共享测试库默认只读,对拍写操作需显式改 false + read-only: false + +server: + port: 8084 + +logging: + level: + com.dsasp: DEBUG + org.springframework.jdbc.core: DEBUG diff --git a/platform-app/src/main/resources/static/amis.html b/platform-app/src/main/resources/static/amis.html new file mode 100644 index 0000000..41b6757 --- /dev/null +++ b/platform-app/src/main/resources/static/amis.html @@ -0,0 +1,32 @@ + + + + + eip4-poc · amis 渲染验证 + + + + + + + + + +
+ + + diff --git a/platform-app/src/test/java/com/eip4/platform/app/ArchitectureRulesTest.java b/platform-app/src/test/java/com/eip4/platform/app/ArchitectureRulesTest.java new file mode 100644 index 0000000..2df3059 --- /dev/null +++ b/platform-app/src/test/java/com/eip4/platform/app/ArchitectureRulesTest.java @@ -0,0 +1,21 @@ +package com.eip4.platform.app; + +import com.tngtech.archunit.junit.AnalyzeClasses; +import com.tngtech.archunit.junit.ArchTest; +import com.tngtech.archunit.lang.ArchRule; + +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; + +/** + * 架构纪律(《eip4-platform架构设计》第一节,ArchUnit 固化): + * com.eip4.* 可调 com.dsasp.*,反向禁止——保真层不得感知现代层。 + */ +@AnalyzeClasses(packages = {"com.dsasp", "com.eip4"}) +class ArchitectureRulesTest { + + @ArchTest + static final ArchRule 保真层禁止依赖现代层 = + noClasses().that().resideInAPackage("com.dsasp..") + .should().dependOnClassesThat().resideInAPackage("com.eip4..") + .because("双层制:移植的旧代码不重写、不感知新代码,保证与 framework 源码 diff 最小"); +} diff --git a/platform-auth/pom.xml b/platform-auth/pom.xml new file mode 100644 index 0000000..c761542 --- /dev/null +++ b/platform-auth/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-auth + platform-auth + P2:组织/权限/数据权限真实现(当前为 PoC 桩 + C2 数据权限最小真实现) + + com.eip4platform-legacy-core + org.springframework.bootspring-boot-starter-testtest + + diff --git a/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataOperatorLog.java b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataOperatorLog.java new file mode 100644 index 0000000..655094a --- /dev/null +++ b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataOperatorLog.java @@ -0,0 +1,36 @@ +package com.eip4.platform.auth.stub; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.log.bean.DataLogItem; +import com.dsasp.server.common.log.service.DataOperatorLog; + +/** + * WS1 桩:数据操作审计日志。原版写库记录字段级变更,PoC 降级为 slf4j。 + */ +@Service("dataOperatorLog") +public class StubDataOperatorLog implements DataOperatorLog { + + private static final Logger LOG = LoggerFactory.getLogger("eip3.datalog"); + + @Override + public DataLogItem insertData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId) { + LOG.debug("insert {} id={}", po.get_TableName(), po.get_ID()); + return null; + } + + @Override + public DataLogItem updateData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId) { + LOG.debug("update {} id={}", po.get_TableName(), po.get_ID()); + return null; + } + + @Override + public DataLogItem deleteData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId) { + LOG.debug("delete {} id={}", po.get_TableName(), po.get_ID()); + return null; + } +} diff --git a/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataPrivilegeService.java b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataPrivilegeService.java new file mode 100644 index 0000000..6a38498 --- /dev/null +++ b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubDataPrivilegeService.java @@ -0,0 +1,33 @@ +package com.eip4.platform.auth.stub; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.springframework.stereotype.Service; + +import com.dsasp.server.common.privilege.bean.DataFilterRule; +import com.dsasp.server.common.privilege.service.DataPrivilegeService; + +/** + * WS1 桩:数据行级权限。PoC 阶段不过滤(返回 null 等价于 admin 视角), + * 接口签名原样保留,P2 阶段以 EIP3 真实现替换。 + */ +@Service("dataPrivilegeService") +public class StubDataPrivilegeService implements DataPrivilegeService { + + @Override + public String getWhereClause(Properties ctx, String tableName) { + return null; + } + + @Override + public void saveOrUpdateDataPrivilege(String entityId, List list, Properties ctx) { + // PoC 不持久化权限规则 + } + + @Override + public List getEntityDataFilterRule(String entityId) { + return new ArrayList<>(); + } +} diff --git a/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubFileService.java b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubFileService.java new file mode 100644 index 0000000..033775e --- /dev/null +++ b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubFileService.java @@ -0,0 +1,72 @@ +package com.eip4.platform.auth.stub; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.springframework.stereotype.Service; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.file.service.FileService; + +/** + * WS1 桩:附件服务。PoC 选定功能不含附件操作,全部 no-op; + * 接口签名原样保留,P2 阶段以 EIP3 真实现替换。 + */ +@Service("fileService") +public class StubFileService implements FileService { + + @Override + public String save(String tempFile, String fileName, int size, String tableName, String businessKey, Properties ctx) { + return null; + } + + @Override + public void saveDoc(String relativePath, String fileName, int size, String tableName, String businessKey, Properties ctx) { + } + + @Override + public File getDocFile(String relativePath, String fileName, boolean isZip) { + return null; + } + + @Override + public void delete(List fileIds, String userId) { + } + + @Override + public void delete(String fileId, String userId) { + } + + @Override + public void deleteAttatchmentByBusinessKey(String businessKey, String userId) { + } + + @Override + public void deleteAttatchmentByBusinessKey(List businessKeys, String userId) { + } + + @Override + public void clearDeletedDocument() { + } + + @Override + public void clearDumpFile() { + } + + @Override + public List getDoc(List businessKeys) { + return new ArrayList<>(); + } + + @Override + public String getPicPath(String tablename, String businesskey) { + return null; + } + + @Override + public String saveDecoderBase64File(String base64Code, String userId, String tableName, Properties ctx) throws Exception { + return null; + } +} diff --git a/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubProjectSwitchService.java b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubProjectSwitchService.java new file mode 100644 index 0000000..604ec79 --- /dev/null +++ b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubProjectSwitchService.java @@ -0,0 +1,30 @@ +package com.eip4.platform.auth.stub; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.dsasp.server.common.viewframework.service.ProjectSwitchService; + +/** + * WS1 桩:项目切换服务。PoC 测试用户不挂项目。 + */ +@Service("projectSwitchService") +public class StubProjectSwitchService implements ProjectSwitchService { + + @Override + public boolean isUserInProjects(String userId) { + return false; + } + + @Override + public Map findAllProjectByUserId(String userId) { + return new HashMap<>(); + } + + @Override + public String getProjectOrgId(String projectId) { + return null; + } +} diff --git a/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubSystemLogManager.java b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubSystemLogManager.java new file mode 100644 index 0000000..7269958 --- /dev/null +++ b/platform-auth/src/main/java/com/eip4/platform/auth/stub/StubSystemLogManager.java @@ -0,0 +1,44 @@ +package com.eip4.platform.auth.stub; + +import java.util.List; + +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.dsasp.server.common.log.bean.SysLogItem; +import com.dsasp.server.common.log.service.SystemLogManager; + +/** + * WS1 桩:系统日志。原版写库(操作日志审计),PoC 阶段降级为 slf4j 输出。 + */ +@Service("systemLogManager") +public class StubSystemLogManager implements SystemLogManager { + + private static final Logger LOG = LoggerFactory.getLogger("eip3.syslog"); + + @Override + public void log(LogType logType, String logContent) { + LOG.info("[{}] {}", logType, logContent); + } + + @Override + public void deleteAll() { + } + + @Override + public void deleteByType(String type) { + } + + @Override + public void log(List items) { + if (items != null) { + items.forEach(i -> LOG.info("[batch] {}", i)); + } + } + + @Override + public void deleteByLoginTime(List userIds, DateTime[] loginTimes) { + } +} diff --git a/platform-converter/pom.xml b/platform-converter/pom.xml new file mode 100644 index 0000000..c10f06a --- /dev/null +++ b/platform-converter/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-converter + platform-converter + 模板转换器 + S3 脚本改写器(可独立 CLI 跑批) + + com.eip4platform-legacy-core + com.fasterxml.jackson.corejackson-databind + org.springframework.bootspring-boot-starter-testtest + + diff --git a/platform-converter/src/main/java/com/eip4/platform/converter/TemplateToAmisConverter.java b/platform-converter/src/main/java/com/eip4/platform/converter/TemplateToAmisConverter.java new file mode 100644 index 0000000..9812542 --- /dev/null +++ b/platform-converter/src/main/java/com/eip4/platform/converter/TemplateToAmisConverter.java @@ -0,0 +1,175 @@ +package com.eip4.platform.converter; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; + +/** + * 模板 XML → amis schema 转换器原型(P4 批量转换器的种子,对应 PoC 方案 4.1.5)。 + * 当前覆盖 GRID(type=1) 模板的 display/search/button 三段; + * 每个映射决策都登记进 mappingNotes,作为映射表 v0 的数据来源。 + */ +@Component +public class TemplateToAmisConverter { + + private final JdbcTemplate jdbcTemplate; + + public TemplateToAmisConverter(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + public Map convert(String templateXml, List mappingNotes) throws Exception { + Document doc = DocumentHelper.parseText(templateXml); + Element crud = doc.getRootElement(); + if (!"crud".equals(crud.getName())) { + throw new IllegalArgumentException("非 crud 模板: " + crud.getName()); + } + + String title = crud.attributeValue("title", ""); + String entityId = crud.attributeValue("entityid", ""); + String table = resolveTableName(entityId); + mappingNotes.add("crud@entityid=" + entityId + " → 实体表 " + table + "(经 SYS_ENTITY 解析)"); + + // ── display/field → columns + List> columns = new ArrayList<>(); + Element display = crud.element("display"); + if (display != null) { + for (Element f : display.elements("field")) { + String name = f.attributeValue("name", ""); + Map col = new LinkedHashMap<>(); + if (name.endsWith("_DISPLAY__")) { + // 旧引擎的字典/时间翻译列;PoC 先映射回原始列,翻译值待 REST 层补 + String raw = name.substring(0, name.length() - "_DISPLAY__".length()); + col.put("name", raw); + mappingNotes.add("display@field " + name + " → 原始列 " + raw + "(翻译列,REST 层待补显示值)"); + } else { + col.put("name", name); + } + col.put("label", f.attributeValue("text", name)); + String width = f.attributeValue("width"); + if (width != null) { + col.put("width", Integer.parseInt(width)); + } + if ("true".equals(f.attributeValue("hidden"))) { + col.put("toggled", false); + mappingNotes.add("display@field " + name + " hidden=true → columns-toggler 默认隐藏"); + } + columns.add(col); + } + } + + // ── search/field → filter 表单 + Map filter = null; + Element search = crud.element("search"); + if (search != null && !search.elements("field").isEmpty()) { + List> items = new ArrayList<>(); + for (Element f : search.elements("field")) { + String name = f.attributeValue("name", ""); + String uitype = f.attributeValue("uitype", "TextField"); + Map item = new LinkedHashMap<>(); + item.put("name", name); + item.put("label", f.attributeValue("label", name)); + switch (uitype) { + case "ComboBox" -> { + item.put("type", "select"); + item.put("clearable", true); + String dict = f.attributeValue("comboboxid", ""); + item.put("source", "/api/poc/dict/" + dict); + mappingNotes.add("search@field " + name + " uitype=ComboBox(comboboxid=" + dict + + ") → select + source 字典接口(接口待实现)"); + } + case "DateField" -> { + item.put("type", "input-date"); + mappingNotes.add("search@field " + name + " uitype=DateField → input-date"); + } + default -> { + item.put("type", "input-text"); + if (!"TextField".equals(uitype)) { + mappingNotes.add("search@field " + name + " uitype=" + uitype + + " → 暂映射 input-text(映射表待补该控件)"); + } + } + } + items.add(item); + } + filter = new LinkedHashMap<>(); + filter.put("title", "查询"); + filter.put("body", items); + String script = search.attributeValue("script"); + if (script != null && !script.isBlank()) { + mappingNotes.add("search@script 存在(" + script.length() + " 字符)→ 归入脚本分桶处理,本转换器跳过"); + } + } + + // ── button → headerToolbar + List toolbar = new ArrayList<>(); + toolbar.add("bulkActions"); + for (Element b : crud.elements("button")) { + if ("false".equals(b.attributeValue("isshow"))) { + continue; + } + String btnType = b.attributeValue("type", ""); + Map btn = new LinkedHashMap<>(); + btn.put("type", "button"); + btn.put("label", b.attributeValue("name", b.attributeValue("id", ""))); + switch (btnType) { + case "insert" -> { + btn.put("level", "primary"); + btn.put("actionType", "dialog"); + Map dlg = new LinkedHashMap<>(); + dlg.put("type", "dialog"); + dlg.put("title", b.attributeValue("name", "")); + dlg.put("body", Map.of("type", "tpl", + "tpl", "表单页(pageid=" + b.attributeValue("pageid", "") + ")待 EDITFORM 模板转换")); + btn.put("dialog", dlg); + mappingNotes.add("button[insert] " + b.attributeValue("name") + " → dialog 占位(指向 pageid=" + + b.attributeValue("pageid", "") + ",需 EDITFORM 转换器)"); + } + case "delete" -> { + btn.put("level", "danger"); + btn.put("actionType", "ajax"); + btn.put("confirmText", "确认删除选中记录?"); + btn.put("api", "delete:/api/entity/" + table + "/${ids}"); + mappingNotes.add("button[delete] → ajax DELETE /api/entity/" + table + "/${ids}(REST 端点待实现)"); + } + default -> mappingNotes.add("button[" + btnType + "] " + b.attributeValue("name") + " → 普通按钮占位"); + } + toolbar.add(btn); + } + toolbar.add("pagination"); + + // ── 组装 page > crud + Map crudSchema = new LinkedHashMap<>(); + crudSchema.put("type", "crud"); + crudSchema.put("api", "/api/entity/" + table + "/list?page=${page}&perPage=${perPage}"); + crudSchema.put("syncLocation", false); + if (filter != null) { + crudSchema.put("filter", filter); + } + crudSchema.put("columns", columns); + crudSchema.put("headerToolbar", toolbar); + crudSchema.put("primaryField", table + "_ID"); + + Map page = new LinkedHashMap<>(); + page.put("type", "page"); + page.put("title", title); + page.put("body", crudSchema); + return page; + } + + private String resolveTableName(String entityId) { + try { + return jdbcTemplate.queryForObject( + "SELECT TABLENAME FROM SYS_ENTITY WHERE SYS_ENTITY_ID=?", String.class, entityId); + } catch (Exception e) { + return "UNKNOWN_" + entityId; + } + } +} diff --git a/platform-flow-gateway/pom.xml b/platform-flow-gateway/pom.xml new file mode 100644 index 0000000..a743504 --- /dev/null +++ b/platform-flow-gateway/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-flow-gateway + platform-flow-gateway + P3 占位:Flowable REST 客户端、待办聚合、3 个 handler bean + + com.eip4platform-legacy-core + + diff --git a/platform-legacy-core/pom.xml b/platform-legacy-core/pom.xml new file mode 100644 index 0000000..5f1ee2e --- /dev/null +++ b/platform-legacy-core/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-legacy-core + platform-legacy-core + 保真层:移植引擎原样,包名 com.dsasp.* 不动。对拍=完成定义,与 framework 源码 diff 保持最小 + + org.springframework.bootspring-boot-starter-jdbc + org.springframeworkspring-context + org.dom4jdom4j + jaxenjaxen + org.apache.groovygroovy-jsr223 + joda-timejoda-time + org.jsonjson + jakarta.servletjakarta.servlet-apiprovided + + diff --git a/platform-legacy-core/src/main/java/com/dsasp/client/viewframework/template/util/Console.java b/platform-legacy-core/src/main/java/com/dsasp/client/viewframework/template/util/Console.java new file mode 100644 index 0000000..cd29a38 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/client/viewframework/template/util/Console.java @@ -0,0 +1,44 @@ +package com.dsasp.client.viewframework.template.util; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * eip4-poc 移植替换类:原版把脚本日志推送到 Vaadin MainComponent 的浏览器控制台。 + * 保持静态方法签名不变,实现降级为 slf4j 日志输出。 + */ +public class Console { + + private static final Logger LOG = LoggerFactory.getLogger("eip3.script.console"); + + public static void error(Object errMsg) { + LOG.error(convert(errMsg)); + } + + public static void log(Object logMsg) { + LOG.info(convert(logMsg)); + } + + public static void debug(Object debugMsg) { + LOG.debug(convert(debugMsg)); + } + + public static void info(Object infoMsg) { + LOG.info(convert(infoMsg)); + } + + private static String convert(Object msg) { + if (msg == null) { + return "null"; + } + if (msg instanceof Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + return sw.toString(); + } + return String.valueOf(msg); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/core/Function.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/Function.java new file mode 100644 index 0000000..fd39d74 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/Function.java @@ -0,0 +1,25 @@ +package com.dsasp.server.common.core; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Function { + + /** + * function name + * @return + */ + String name(); + + /** + * use function tip + * @return + */ + String tip(); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/core/OriginServiceBean.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/OriginServiceBean.java new file mode 100644 index 0000000..ef80f7c --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/OriginServiceBean.java @@ -0,0 +1,178 @@ +package com.dsasp.server.common.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; + +public class OriginServiceBean{ + + private String beanName; + + private String method; + + private List arg; + + private String returnResult; + + private String type; + + private String description; + + private String displayName; + + private String id; + + public OriginServiceBean(){ + + } + + public OriginServiceBean(GeneralPOJO po){ + id = po.get_ID(); + beanName = (String)po.get_Value(CLASSNAME); + method = (String)po.get_Value(METHODNAME); + returnResult = (String)po.get_Value(RETURNCLASSNAME); + type = (String)po.get_Value(TYPE); + description = (String)po.get_Value(DESCRIPTION); + displayName = (String)po.get_Value(NAME); + List list = (List)po.get_Value(ARGS); + if(list != null && list.size() > 0){ + arg = new ArrayList(); + for(GeneralPOJO pojo : list){ + arg.add((String)pojo.get_Value(ARGCLASSNAME)); + } + } + } + + public String getBeanName() { + return beanName; + } + + + public String getMethod() { + return method; + } + + + public List getArg() { + return arg; + } + + + public String getReturnResult() { + return returnResult; + } + + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public void setMethod(String method) { + this.method = method; + } + + public void setArg(List arg) { + this.arg = arg; + } + + public void setReturnResult(String returnResult) { + this.returnResult = returnResult; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * + * @param pojo + */ + public void updateToPO(GeneralPOJO pojo){ + pojo.set_ValueOfColumn(TYPE, type); + pojo.set_ValueOfColumn(NAME, displayName); + pojo.set_ValueOfColumn(CLASSNAME, beanName); + pojo.set_ValueOfColumn(METHODNAME, method); + pojo.set_ValueOfColumn(DESCRIPTION, description); + pojo.set_ValueOfColumn(RETURNCLASSNAME, returnResult); + + if(arg != null && arg.size() > 0){ + List list = new ArrayList(); + String originServiceId = pojo.get_ID(); + for(int i = 0; i < arg.size(); i ++){ + String a = arg.get(i); + Map map = new HashMap(); + map.put(ORIGINSERVICEID, originServiceId); + map.put(ARGCLASSNAME, a); + map.put(SEQUENCE, i); + list.add(map); + } + pojo.set_ValueOfColumn(ARGS, list); + } + } + + public Map convertToMap(){ + Map list = new HashMap(); + list.put(TYPE, type); + list.put(NAME, displayName); + list.put(CLASSNAME, beanName); + list.put(METHODNAME, method); + list.put(DESCRIPTION, description); + list.put(RETURNCLASSNAME, returnResult); + if(arg != null && arg.size() > 0){ + List args = new ArrayList(); + for(int i = 0; i < arg.size(); i++){ + String a = arg.get(i); + Map map = new HashMap(); + map.put(ARGCLASSNAME, a); + map.put(SEQUENCE, i); + args.add(map); + } + list.put(ARGS, args); + } + return list; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + + public static final String TYPE = "TYPE"; + public static final String NAME = "NAME"; + public static final String CLASSNAME = "CLASSNAME"; + public static final String METHODNAME = "METHODNAME"; + public static final String DESCRIPTION = "DESCRIPTION"; + public static final String RETURNCLASSNAME = "RETURNCLASSNAME"; + + public static final String ARGCLASSNAME = "ARGCLASSNAME"; + public static final String ARGS = "ARGS"; + public static final String ORIGINSERVICEID = "ORIGINSERVICEID"; + public static final String SEQUENCE = "SEQUENCE"; +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/OriginServiceMethod.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/OriginServiceMethod.java new file mode 100644 index 0000000..cabd9bc --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/OriginServiceMethod.java @@ -0,0 +1,20 @@ +package com.dsasp.server.common.core.service; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +/** + * mark the function is a origin service. it is use in a service bean + * @author wuqz + * + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface OriginServiceMethod { + String name(); + String type(); + String description(); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/ScanServiceBeanXml.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/ScanServiceBeanXml.java new file mode 100644 index 0000000..d19d7e6 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/ScanServiceBeanXml.java @@ -0,0 +1,20 @@ +package com.dsasp.server.common.core.service; + +import java.util.ArrayList; +import java.util.List; + +import com.dsasp.server.common.core.OriginServiceBean; + +/** + * eip4-poc 移植桩:原版在 OSGi bundle 启动时 SAX 扫描 /META-INF/spring 下的 + * service bean XML 注册 OriginServiceBean。PoC 不加载旧式服务流 XML, + * 保留静态 classList 契约(空列表),parserXml 退化为 no-op。 + */ +public class ScanServiceBeanXml { + + public static List classList = new ArrayList(); + + public static void parserXml(Object bundleContext) { + // no-op:旧式 OriginService XML 不在 WS1 验证范围 + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/SpringBeanOsgiServices.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/SpringBeanOsgiServices.java new file mode 100644 index 0000000..ea48efe --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/core/service/SpringBeanOsgiServices.java @@ -0,0 +1,43 @@ +package com.dsasp.server.common.core.service; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * eip4-poc 移植替换类:原版是 OSGi BundleListener,遍历 bundle 注册服务按 + * "org.springframework.osgi.bean.name" 取 bean(72 行服务定位器)。 + * 这里保持类名、包名与 getInstance().getBeanByName() 调用契约不变, + * 实现降级为对单一 Spring ApplicationContext 的查找,旧代码零修改。 + */ +@Component +public class SpringBeanOsgiServices implements ApplicationContextAware { + + private static SpringBeanOsgiServices servicesContext; + + private ApplicationContext applicationContext; + + public SpringBeanOsgiServices() { + servicesContext = this; + } + + public static SpringBeanOsgiServices getInstance() { + return servicesContext; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + public Object getBeanByName(String beanName) { + if (beanName == null || beanName.isEmpty() || applicationContext == null) { + return null; + } + if (!applicationContext.containsBean(beanName)) { + return null; + } + return applicationContext.getBean(beanName); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/AbstractPOJOInfo.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/AbstractPOJOInfo.java new file mode 100644 index 0000000..7b600c0 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/AbstractPOJOInfo.java @@ -0,0 +1,55 @@ +package com.dsasp.server.common.dataDic.bean; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.util.StringUtil; + + + +public abstract class AbstractPOJOInfo implements POJOInfo { + + protected static CCache s_cache = new CCache("POInfo", 200); + protected static CCache id_cache = new CCache("TableName", 200); + + /** + * POInfo Factory + * @param ctx context + * @param AD_Table_ID AD_Table_ID + * @param trxName Transaction name + * @return POInfo + */ + public static POJOInfo getPOInfo (String AD_Table_Name) + { + //FIXME: load tableName info + String key = AD_Table_Name; + POJOInfo retValue = (POJOInfo)s_cache.get(key); + if (retValue == null) + { + retValue = ((DataDicService)SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService")).loadInfo(AD_Table_Name); + s_cache.put(key, retValue); + if(id_cache.get(retValue.getAD_Table_ID()) == null){ + id_cache.put(retValue.getAD_Table_ID(), retValue.getTableName()); + } + } + return retValue; + } // getPOInfo + + public static String getTableName(String entityId){ + String tableName = id_cache.get(entityId); + if(StringUtil.isEmpty(tableName)){ + SYS_Entity entity = ((DataDicService)SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService")).getSYSEntity(entityId); + tableName = (String)entity.getPo().get_Value("TABLENAME"); + id_cache.put(entityId, tableName); + } + return tableName; + } + + public static void setChangePOInfo(String entityId){ + String tableName = id_cache.remove(entityId); + if(!StringUtil.isEmpty(tableName)){ + s_cache.remove(tableName); + } + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java new file mode 100644 index 0000000..4b63720 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java @@ -0,0 +1,35 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.HashMap; + +/** + * eip4-poc 移植替换类:原版为 Adempiere CCache(HashMap + 过期 + CacheMgt 全局注册, + * GPL-2 头)。移植代码只使用其 Map API(get/put/containsKey),故重写为最小实现, + * 去除 CacheInterface/CacheMgt 依赖与 GPL 来源代码。构造器签名保持兼容。 + */ +public class CCache extends HashMap { + + private static final long serialVersionUID = 1L; + + private final String name; + + public CCache(String name, int initialCapacity) { + super(initialCapacity); + this.name = name; + } + + public CCache(String name, int initialCapacity, int expireMinutes) { + this(name, initialCapacity); + // PoC:元数据缓存不做过期;如需失效调用 reset() + } + + public String getName() { + return name; + } + + public int reset() { + int size = size(); + clear(); + return size; + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CustomSearchConditional.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CustomSearchConditional.java new file mode 100644 index 0000000..7fff115 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CustomSearchConditional.java @@ -0,0 +1,20 @@ +package com.dsasp.server.common.dataDic.bean; + +public class CustomSearchConditional { + + private String conditional; + + public CustomSearchConditional(String conditional){ + this.conditional = conditional; + } + + public String getConditional() { + return conditional; + } + + public void setConditional(String conditional) { + this.conditional = conditional; + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/DisplayType.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/DisplayType.java new file mode 100644 index 0000000..3a7a398 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/DisplayType.java @@ -0,0 +1,682 @@ +/****************************************************************************** + * Product: Compiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package com.dsasp.server.common.dataDic.bean; + +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +import org.joda.time.DateTime; + +/** + * System Display Types. + *
+ *	SELECT AD_Reference_ID, Name FROM AD_Reference WHERE ValidationType = 'D'
+ *  
+ * @author Jorg Janke + * @version $Id: DisplayType.java,v 1.6 2006/08/30 20:30:44 comdivision Exp $ + * + * @author Teo Sarca, SC ARHIPAC SERVICE SRL + *
  • BF [ 1810632 ] PricePrecision error in InfoProduct (and similar) + */ +public final class DisplayType +{ +// /** Display Type 10 String */ +// public static final int String = 10; +// /** Display Type 11 Integer */ +// public static final int Integer = 11; +// /** Display Type 12 Amount */ +// public static final int Amount = 12; +// /** Display Type 13 ID */ +// public static final int ID = 13; +// /** Display Type 14 Text */ +// public static final int Text = 14; +// /** Display Type 15 Date */ +// public static final int Date = 15; +// /** Display Type 16 DateTime */ +// public static final int DateTime = 16; +// /** Display Type 17 List */ +// public static final int List = 17; +// /** Display Type 18 Table */ +// public static final int Table = 18; +// /** Display Type 19 TableDir */ +// public static final int TableDir = 19; +// /** Display Type 20 YN */ +// public static final int YesNo = 20; +// /** Display Type 21 Location */ +// public static final int Location = 21; +// /** Display Type 22 Number */ +// public static final int Number = 22; +// /** Display Type 23 BLOB */ +// public static final int Binary = 23; +// /** Display Type 24 Time */ +// public static final int Time = 24; +// /** Display Type 25 Account */ +// public static final int Account = 25; +// /** Display Type 26 RowID */ +// public static final int RowID = 26; +// /** Display Type 27 Color */ +// public static final int Color = 27; +// /** Display Type 28 Button */ +// public static final int Button = 28; +// /** Display Type 29 Quantity */ +// public static final int Quantity = 29; +// /** Display Type 30 Search */ +// public static final int Search = 30; +// /** Display Type 31 Locator */ +// public static final int Locator = 31; +// /** Display Type 32 Image */ +// public static final int Image = 32; +// /** Display Type 33 Assignment */ +// public static final int Assignment = 33; +// /** Display Type 34 Memo */ +// public static final int Memo = 34; +// /** Display Type 35 PAttribute */ +// public static final int PAttribute = 35; +// /** Display Type 36 CLOB */ +// public static final int TextLong = 36; +// /** Display Type 37 CostPrice */ +// public static final int CostPrice = 37; +// /** Display Type 38 File Path */ +// public static final int FilePath = 38; +// /** Display Type 39 File Name */ +// public static final int FileName = 39; +// /** Display Type 40 URL */ +// public static final int URL = 40; +// /** Display Type 42 PrinterName */ +// public static final int PrinterName = 42; + // Candidates: + + + /** Display Type 10 String */ + public static final String String = "NVARCHAR"; +// /** Display Type 11 Integer */ + public static final String Integer = "INTEGER"; +// /** Display Type 12 Amount */ +// public static final int Amount = 12; +// /** Display Type 13 ID */ + public static final String ID = "CHAR"; +// /** Display Type 14 Text */ +// public static final int Text = 14; +// /** Display Type 15 Date */ + public static final String Date = "DATE"; +// /** Display Type 16 DateTime */ + public static final String DateTime = "TIME"; +// /** Display Type 17 List */ + public static final String List = "LIST"; +// /** Display Type 18 Table */ +// public static final int Table = 18; +// /** Display Type 19 TableDir */ +// public static final int TableDir = 19; +// /** Display Type 20 YN */ + public static final String YesNo = "BOOLEAN"; +// /** Display Type 21 Location */ +// public static final int Location = 21; +// /** Display Type 22 Number */ + public static final String Number = "DECIMAL"; + + public static final String Money = "MONEY"; + + public static final String ENUMERATE = "ENUMERATE"; + +// /** Display Type 23 BLOB */ + public static final String Binary = "BLOB"; + + public static final String Code = "CODE"; + + public static final String STATUS = "STATUS"; + + +// /** Display Type 24 Time */ +// public static final int Time = 24; +// /** Display Type 25 Account */ +// public static final int Account = 25; +// /** Display Type 26 RowID */ +// public static final int RowID = 26; +// /** Display Type 27 Color */ +// public static final int Color = 27; +// /** Display Type 28 Button */ +// public static final int Button = 28; +// /** Display Type 29 Quantity */ +// public static final int Quantity = 29; +// /** Display Type 30 Search */ +// public static final int Search = 30; +// /** Display Type 31 Locator */ +// public static final int Locator = 31; +// /** Display Type 32 Image */ +// public static final int Image = 32; +// /** Display Type 33 Assignment */ +// public static final int Assignment = 33; +// /** Display Type 34 Memo */ +// public static final int Memo = 34; +// /** Display Type 35 PAttribute */ +// public static final int PAttribute = 35; +// /** Display Type 36 CLOB */ +// public static final int TextLong = 36; +// /** Display Type 37 CostPrice */ +// public static final int CostPrice = 37; +// /** Display Type 38 File Path */ +// public static final int FilePath = 38; +// /** Display Type 39 File Name */ +// public static final int FileName = 39; +// /** Display Type 40 URL */ +// public static final int URL = 40; +// /** Display Type 42 PrinterName */ +// public static final int PrinterName = 42; + + /** + * - New Display Type + INSERT INTO AD_REFERENCE + (AD_REFERENCE_ID, AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY, + NAME,DESCRIPTION,HELP, VALIDATIONTYPE,VFORMAT,ENTITYTYPE) + VALUES (35, 0,0,'Y',SysDate,0,SysDate,0, + 'PAttribute','Product Attribute',null,'D',null,'D'); + * + * - org.compiere.model.MModel (??) + * - org.compiere.grid.ed.VEditor/Dialog + * - org.compiere.grid.ed.VEditorFactory + * - RColumn, WWindow + * add/check 0_cleanupAD.sql + */ + + // See DBA_DisplayType.sql ---------------------------------------------- + + /** Maximum number of digits */ + private static final int MAX_DIGITS = 28; // Oracle Standard Limitation 38 digits + /** Digits of an Integer */ + private static final int INTEGER_DIGITS = 10; + /** Maximum number of fractions */ + private static final int MAX_FRACTION = 12; + /** Default Amount Precision */ + private static final int AMOUNT_FRACTION = 2; + + /** Logger */ +// private static CLogger s_log = CLogger.getCLogger (DisplayType.class); + + /** + * Returns true if (numeric) ID (Table, Search, Account, ..). + * (stored as Integer) + * @param displayType Display Type + * @return true if ID + */ + public static boolean isID (String displayType) + { +// if (displayType == ID || displayType == Table || displayType == TableDir +// || displayType == Search || displayType == Location || displayType == Locator +// || displayType == Account || displayType == Assignment || displayType == PAttribute +// || displayType == Image || displayType == Color) +// return true; +// return false; + if(ID.equals(displayType)){ + return true; + } + return false; + } // isID + + /** + * Returns true, if DisplayType is numeric (Amount, Number, Quantity, Integer). + * (stored as BigDecimal) + * @param displayType Display Type + * @return true if numeric + */ + public static boolean isNumeric(String displayType) + { + if (Money.equals(displayType) || Number.equals(displayType)) + return true; + return false; + } // isNumeric + + /** + * Get Default Precision. + * Used for databases who cannot handle dynamic number precision. + * @param displayType display type + * @return scale (decimal precision) + */ + public static int getDefaultPrecision(int displayType) + { + if (Number.equals(displayType)) + return 6; + return 0; + } // getDefaultPrecision + + + /** + * Returns true, if DisplayType is text (String, Text, TextLong, Memo). + * @param displayType Display Type + * @return true if text + */ + public static boolean isText(String displayType) + { + if (String.equals(displayType) || Code.equals(displayType)) + return true; + return false; + } // isText + + /** + * Returns true if DisplayType is a Date. + * (stored as Timestamp) + * @param displayType Display Type + * @return true if date + */ + public static boolean isDate (String displayType) + { + if (Date.equals(displayType) || DateTime.equals(displayType)) + return true; + return false; + } // isDate + + /** + * Returns true if DisplayType is a VLookup (List, Table, TableDir, Search). + * (stored as Integer) + * @param displayType Display Type + * @return true if Lookup + */ + public static boolean isLookup(String displayType) + { + if (List.equals(displayType)) + return true; + return false; + } // isLookup + + /** + * Returns true if DisplayType is a Large Object + * @param displayType Display Type + * @return true if LOB + */ + public static boolean isLOB (String displayType) + { + if (Binary.equals(displayType)) + return true; + return false; + } // isLOB + + /************************************************************************** + * Return Format for numeric DisplayType + * @param displayType Display Type (default Number) + * @param language Language + * @param pattern Java Number Format pattern e.g. "#,##0.00" + * @return number format + */ + public static DecimalFormat getNumberFormat(String displayType, Locale locale, String pattern) + { + + DecimalFormat format = null; + if (locale != null) + format = (DecimalFormat)NumberFormat.getNumberInstance(locale); + else + format = (DecimalFormat)NumberFormat.getNumberInstance(Locale.CHINA); + // + if (pattern != null && pattern.length() > 0) + { + try { + format.applyPattern(pattern); + return format; + } + catch (IllegalArgumentException e) { +// s_log.log(Level.WARNING, "Invalid number format: " + pattern); + } + } + else if (displayType == Integer) + { + format.setParseIntegerOnly(true); + format.setMaximumIntegerDigits(INTEGER_DIGITS); + format.setMaximumFractionDigits(0); + } + else // if (displayType == Number) + { + format.setMaximumIntegerDigits(MAX_DIGITS); + format.setMaximumFractionDigits(MAX_FRACTION); + format.setMinimumFractionDigits(1); + } + return format; + } // getDecimalFormat + + /************************************************************************** + * Return Format for numeric DisplayType + * @param displayType Display Type (default Number) + * @param language Language + * @return number format + */ + public static DecimalFormat getNumberFormat(String displayType, Locale locale) + { + return getNumberFormat(displayType, locale, null); + } + + /** + * Return Format for numeric DisplayType + * @param displayType Display Type + * @return number format + */ + public static DecimalFormat getNumberFormat(String displayType) + { + return getNumberFormat (displayType, null); + } // getNumberFormat + + + /************************************************************************* + * Return Date Format + * @return date format + */ + public static SimpleDateFormat getDateFormat() + { + return getDateFormat (DisplayType.Date, null); + } // getDateFormat + + + /** + * Return format for date displayType + * @param displayType Display Type + * @return date format + */ + public static SimpleDateFormat getDateFormat (String displayType) + { + return getDateFormat (displayType, null); + } // getDateFormat + + /** + * Return format for date displayType + * @param displayType Display Type (default Date) + * @param language Language + * @return date format + */ + public static SimpleDateFormat getDateFormat (String displayType, Locale locale) + { + return getDateFormat(displayType, locale, null); + } + /** + * Return format for date displayType + * @param displayType Display Type (default Date) + * @param language Language + * @param pattern Java Simple Date Format pattern e.g. "dd/MM/yy" + * @return date format + */ + public static SimpleDateFormat getDateFormat (String displayType, Locale locale, String pattern) + { +// Language myLanguage = language; +// if (myLanguage == null) +// myLanguage = Language.getLoginLanguage(); +// // + if ( pattern != null && pattern.length() > 0) + { + SimpleDateFormat format = (SimpleDateFormat)DateFormat.getInstance(); + try { + format.applyPattern(pattern); + return format; + } + catch (IllegalArgumentException e) { +// s_log.log(Level.WARNING, "Invalid date pattern: " + pattern); + } + } + + if (displayType == DateTime) + return getDateTimeFormat(locale); + // else if (displayType == Date) + return getDateFormat(locale); // default + } // getDateFormat + + /** + * JDBC Date Format YYYY-MM-DD + * @return date format + */ + static public SimpleDateFormat getDateFormat_JDBC() + { + return new SimpleDateFormat ("yyyy-MM-dd"); + } // getDateFormat_JDBC + + /** + * JDBC Timestamp Format yyyy-mm-dd hh:mm:ss + * @return timestamp format + */ + static public SimpleDateFormat getTimestampFormat_Default() + { + return new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); + } // getTimestampFormat_JDBC + + /** + * Return Storage Class. + * (used for MiniTable) + * @param displayType Display Type + * @param yesNoAsBoolean - yes or no as boolean + * @return class Integer - BigDecimal - Timestamp - String - Boolean + */ + public static Class getClass (String displayType, boolean yesNoAsBoolean) + { + if (List.equals(displayType)) + return List.class; + else if (Integer.equals(displayType)) // note that Integer is stored as BD + return Integer.class; + else if (isNumeric(displayType)) + return java.math.BigDecimal.class; + else if (isDate(displayType)) + return DateTime.class; + else if (YesNo.equals(displayType)) + return Boolean.class; + else if (isID(displayType) || String.equals(displayType) || Code.equals(displayType)) + return String.class; + else if (isLOB(displayType)) // CLOB is String + return byte[].class; + else if(ENUMERATE.equals(displayType)){ + return Integer.class; + }else if(STATUS.equals(displayType)){ + return Integer.class; + } + // + return Object.class; + } // getClass + +// /** +// * Get SQL DataType +// * @param displayType AD_Reference_ID +// * @param columnName name +// * @param fieldLength length +// * @return SQL Data Type in Oracle Notation +// */ +// public static String getSQLDataType (String displayType, String columnName, int fieldLength) +// { +// if (columnName.equals("EntityType") +// || columnName.equals ("AD_Language")) +// return "VARCHAR2(" + fieldLength + ")"; +// // ID +// if (DisplayType.isID(displayType)) +// { +// if (columnName.endsWith("_ID") +// || columnName.endsWith("tedBy") +// || columnName.endsWith("_Acct") ) +// return "NUMBER(10)"; +// else if (fieldLength < 4) +// return "CHAR(" + fieldLength + ")"; +// else // EntityType, AD_Language fallback +// return "VARCHAR2(" + fieldLength + ")"; +// } +// // +// if (displayType == DisplayType.Integer) +// return "NUMBER(10)"; +// if (DisplayType.isDate(displayType)) +// return "DATE"; +// if (DisplayType.isNumeric(displayType)) +// return "NUMBER"; +// if (displayType == DisplayType.Binary) +// return "BLOB"; +// if (displayType == DisplayType.TextLong +// || (displayType == DisplayType.Text && fieldLength >= 4000)) +// return "CLOB"; +// if (displayType == DisplayType.YesNo) +// return "CHAR(1)"; +// if (displayType == DisplayType.List) { +// if (fieldLength == 1) +// return "CHAR(" + fieldLength + ")"; +// else +// return "NVARCHAR2(" + fieldLength + ")"; +// } +// if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID +// { +// if (columnName.endsWith("_ID")) +// return "NUMBER(10)"; +// else +// return "CHAR(" + fieldLength + ")"; +// } +// if (displayType == DisplayType.Button) +// { +// if (columnName.endsWith("_ID")) +// return "NUMBER(10)"; +// else +// return "CHAR(" + fieldLength + ")"; +// } +//// if (!DisplayType.isText(displayType)) +//// s_log.severe("Unhandled Data Type = " + displayType); +// +// return "NVARCHAR2(" + fieldLength + ")"; +// } // getSQLDataType + +// /** +// * Get Description +// * @param displayType display Type +// * @return display type description +// */ +// public static String getDescription (int displayType) +// { +// if (displayType == String) +// return "String"; +// if (displayType == Integer) +// return "Integer"; +// if (displayType == Amount) +// return "Amount"; +// if (displayType == ID) +// return "ID"; +// if (displayType == Text) +// return "Text"; +// if (displayType == Date) +// return "Date"; +// if (displayType == DateTime) +// return "DateTime"; +// if (displayType == List) +// return "List"; +// if (displayType == Table) +// return "Table"; +// if (displayType == TableDir) +// return "TableDir"; +// if (displayType == YesNo) +// return "YesNo"; +// if (displayType == Location) +// return "Location"; +// if (displayType == Number) +// return "Number"; +// if (displayType == Binary) +// return "Binary"; +// if (displayType == Time) +// return "Time"; +// if (displayType == Account) +// return "Account"; +// if (displayType == RowID) +// return "RowID"; +// if (displayType == Color) +// return "Color"; +// if (displayType == Button) +// return "Button"; +// if (displayType == Quantity) +// return "Quantity"; +// if (displayType == Search) +// return "Search"; +// if (displayType == Locator) +// return "Locator"; +// if (displayType == Image) +// return "Image"; +// if (displayType == Assignment) +// return "Assignment"; +// if (displayType == Memo) +// return "Memo"; +// if (displayType == PAttribute) +// return "PAttribute"; +// if (displayType == TextLong) +// return "TextLong"; +// if (displayType == CostPrice) +// return "CostPrice"; +// if (displayType == FilePath) +// return "FilePath"; +// if (displayType == FileName) +// return "FileName"; +// if (displayType == URL) +// return "URL"; +// if (displayType == PrinterName) +// return "PrinterName"; +// // +// return "UNKNOWN DisplayType=" + displayType; +// } // getDescription + + public static SimpleDateFormat getDateFormat(Locale m_locale) + { +// if (m_dateFormat == null) +// { + SimpleDateFormat m_dateFormat = (SimpleDateFormat)DateFormat.getDateInstance + (DateFormat.SHORT, m_locale); + String sFormat = m_dateFormat.toPattern(); + // some short formats have only one M and/or d (e.g. ths US) + if (sFormat.indexOf("MM") == -1 || sFormat.indexOf("dd") == -1) + { + sFormat = sFormat.replaceFirst("d+", "dd"); + sFormat = sFormat.replaceFirst("M+", "MM"); + // log.finer(sFormat + " => " + nFormat); + m_dateFormat.applyPattern(sFormat); + } + // Unknown short format => use JDBC + if (m_dateFormat.toPattern().length() != 8) + m_dateFormat.applyPattern("yyyy-MM-dd"); + + // 4 digit year + if (m_dateFormat.toPattern().indexOf("yyyy") == -1) + { + sFormat = m_dateFormat.toPattern(); + String nFormat = ""; + for (int i = 0; i < sFormat.length(); i++) + { + if (sFormat.charAt(i) == 'y') + nFormat += "yy"; + else + nFormat += sFormat.charAt(i); + } + m_dateFormat.applyPattern(nFormat); + } + m_dateFormat.setLenient(true); +// } + return m_dateFormat; + } // getDateFormat + + /** + * Get Date Time Format. + * Used for Display only + * @return Date Time format MMM d, yyyy h:mm:ss a z -or- dd.MM.yyyy HH:mm:ss z + * -or- j nnn aaaa, H' ?????? 'm' ????' + */ + public static SimpleDateFormat getDateTimeFormat(Locale m_locale) + { + SimpleDateFormat retValue = (SimpleDateFormat)DateFormat.getDateTimeInstance + (DateFormat.MEDIUM, DateFormat.LONG, m_locale); + // log.finer("Pattern=" + retValue.toLocalizedPattern() + ", Loc=" + retValue.toLocalizedPattern()); + return retValue; + } // getDateTimeFormat + + public static SimpleDateFormat getTimeFormat(Locale m_locale) + { + return (SimpleDateFormat)DateFormat.getTimeInstance + (DateFormat.LONG, m_locale); + } + + +} // DisplayType diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Enumerate.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Enumerate.java new file mode 100644 index 0000000..f4f94d4 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Enumerate.java @@ -0,0 +1,64 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.List; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.service.DataDicService; + +public class Enumerate { + protected static CCache> s_cache = new CCache>("Enumerate", 2000); + + /** + * get enumerate items by enumerate type + * @param enumerateType + * @return + */ + public static List getEnumerateItems(String enumerateType){ + List enumerateItems = s_cache.get(enumerateType); + if(enumerateItems == null || enumerateItems.size() == 0){ + enumerateItems = ((DataDicService)SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService")).getEnumerateItems(enumerateType); + s_cache.put(enumerateType, enumerateItems); + } + return enumerateItems; + } + + public static EnumerateItem getEnumerateItem(String enumerateType, Integer value){ + List list = getEnumerateItems(enumerateType); + if(list != null && list.size() > 0){ + for(EnumerateItem item : list){ + if(item.getCodeValue().equals(value)){ + return item; + } + } + } + return null; + } + + public static String getEnumerateItemDes(String enumerateType, Integer value){ + List list = getEnumerateItems(enumerateType); + if(list != null && list.size() > 0){ + for(EnumerateItem item : list){ + if(item.getCodeValue().equals(value)){ + return item.getCodeDes(); + } + } + } + return null; + } + + public static Integer getEnumerateItemValue(String enumerateType, String Des){ + List list = getEnumerateItems(enumerateType); + if(list != null && list.size() > 0){ + for(EnumerateItem item : list){ + if(item.getCodeDes().equals(Des)){ + return item.getCodeValue(); + } + } + } + return Integer.MIN_VALUE; + } + + public static void setChange(String enumerateType){ + s_cache.remove(enumerateType); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/EnumerateItem.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/EnumerateItem.java new file mode 100644 index 0000000..80d6ed4 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/EnumerateItem.java @@ -0,0 +1,52 @@ +package com.dsasp.server.common.dataDic.bean; + +public class EnumerateItem { + private String codeDes; + private Integer codeValue; + private String enumerateType; + + private String extendAttributeOne; + private String extendAttributeTwo; + private String extendAttributeThree; +// private String + + public String getCodeDes() { + return codeDes; + } + public void setCodeDes(String codeDes) { + this.codeDes = codeDes; + } + public Integer getCodeValue() { + return codeValue; + } + public void setCodeValue(Integer codeValue) { + this.codeValue = codeValue; + } + public String getEnumerateType() { + return enumerateType; + } + public void setEnumerateType(String enumerateType) { + this.enumerateType = enumerateType; + } + public String getExtendAttributeOne() { + return extendAttributeOne; + } + public void setExtendAttributeOne(String extendAttributeOne) { + this.extendAttributeOne = extendAttributeOne; + } + public String getExtendAttributeTwo() { + return extendAttributeTwo; + } + public void setExtendAttributeTwo(String extendAttributeTwo) { + this.extendAttributeTwo = extendAttributeTwo; + } + public String getExtendAttributeThree() { + return extendAttributeThree; + } + public void setExtendAttributeThree(String extendAttributeThree) { + this.extendAttributeThree = extendAttributeThree; + } + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/GeneralPOJO.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/GeneralPOJO.java new file mode 100644 index 0000000..80d92b5 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/GeneralPOJO.java @@ -0,0 +1,422 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; + +public interface GeneralPOJO { + + + public static final String KEYEND = "_ID"; + + public static final String DISPLAY = "_DISPLAY__"; + + public static final String NULL = "NULL"; + + public static final String UPDATETIME = "UPDATETIME"; + + public static final String CREATETIME = "CREATETIME"; + + public static final String UPDATEBY = "UPDATEBY"; + + public static final String CREATEBY = "CREATEBY"; + + public static final String ISACTIVE = "ISACTIVE"; + + public static final String DEPARTID = "DEPARTID"; + + public static final String ORGID = "ORGID"; + + public static final String PROCESSED = "PROCESSED"; + + public static final String PROCESSINGE = "PROCESSING"; + + public static final String VERSION = "VERSION"; + + public static final String DOCUMENT = "DOCUMENT"; + + public static final String STATUS = "STATUS"; + + public static final String AND = "AND"; + + public static final String OR = "OR"; + + public static final String SEQUENCE = "SEQUENCE_NUMBER"; + + /** + * 条件字段后缀 + */ + public static final String OP = "_OP__"; + + /**系统维护的字段*/ + public static final String[] SYSFIELD = {"UPDATETIME","CREATETIME","UPDATEBY","CREATEBY","ISACTIVE","DEPARTID","ORGID","PROCESSED","PROCESSING","VERSION","DOCUMENT","STATUS"}; + + + public String toString();// toString + + /** + * Equals based on ID + * @param cmp comparator + * @return true if ID the same + */ + public boolean equals (Object cmp); + + + /** + * Get TableName. + * @return table name + */ + public String get_TableName(); + + /** + * Get Key Columns. + * @return table name + */ + public String[] get_KeyColumns(); + + /** + * Get Table ID. + * @return table id + */ + public String get_Table_ID(); + + /** + * Return Single Key Record ID + * @return ID or 0 + */ + public String get_ID(); + + /** + * Return Deleted Single Key Record ID + * @return ID or 0 + */ + public String get_IDOld(); + + // getCtx + + + /************************************************************************** + * Get Value + * @param index index + * @return value + */ + public Object get_Value (int index); + + /** + * Get Value + * @param columnName column name + * @return value or null + */ + public Object get_Value (String columnName); + + + + /** + * Get Value of Column + * @param AD_Column_ID column + * @return value or null + */ + public Object get_ValueOfColumn (String AD_Column_ID); + + /** + * Get Old Value + * @param index index + * @return value + */ + public Object get_ValueOld (int index); + + + /** + * Get new Value + * @param index index + * @return value + */ + public Object get_ValueNew (int index); + + /** + * Get Old Value + * @param columnName column name + * @return value or null + */ + public Object get_ValueOld (String columnName); + + /** + * Is Value Changed + * @param index index + * @return true if changed + */ + public boolean is_ValueChanged (int index); + + /** + * Is Value Changed + * @param columnName column name + * @return true if changed + */ + public boolean is_ValueChanged (String columnName); + + /** + * Return new - old. + * - New Value if Old Value is null + * - New Value - Old Value if Number + * - otherwise null + * @param index index + * @return new - old or null if not appropriate or not changed + */ + public Object get_ValueDifference (int index); + /** + * Return new - old. + * - New Value if Old Value is null + * - New Value - Old Value if Number + * - otherwise null + * @param columnName column name + * @return new - old or null if not appropriate or not changed + */ + public Object get_ValueDifference (String columnName); + + /** + * Set value of Column + * @param columnName + * @param value + */ + public void set_ValueOfColumn(String columnName, Object value); + /** + * Set value of Column returning boolean + * @param columnName + * @param value + * @returns boolean indicating success or failure + */ + public boolean set_ValueOfColumnReturningBooleanByName(String columnName, Object value); + + /** + * Set Value of Column + * @param AD_Column_ID column + * @param value value + */ + public void set_ValueOfColumnByID (String AD_Column_ID, Object value); + + /** + * Set Value of Column + * @param AD_Column_ID column + * @param value value + * @returns boolean indicating success or failure + */ + public boolean set_ValueOfColumnReturningBooleanByID (String AD_Column_ID, Object value); + + + /** + * Set Custom Column + * @param columnName column + * @param value value + */ + public void set_CustomColumn (String columnName, Object value); + /** + * Set Custom Column returning boolean + * @param columnName column + * @param value value + * @returns boolean indicating success or failure + */ + public boolean set_CustomColumnReturningBoolean (String columnName, Object value); + + + /************************************************************************** + * Get Column Count + * @return column count + */ + public int get_ColumnCount(); + + /** + * Get Column Name + * @param index index + * @return ColumnName + */ + public String get_ColumnName (int index); + + + /** + * Get Column Index + * @param columnName column name + * @return index of column with ColumnName or -1 if not found + */ + public int get_ColumnIndex (String columnName); + + + + + + /** + * Set Active + * @param active active + */ + public void setIsActive (boolean active); + + /** + * Is Active + * @return is active + */ + public boolean isActive(); + + /** + * Get Created + * @return created + */ + public DateTime getCreated(); + + /** + * Get Updated + * @return updated + */ + public DateTime getUpdated(); + + /** + * Get CreatedBy + * @return AD_User_ID + */ + public int getCreatedBy(); + + /** + * Get UpdatedBy + * @return AD_User_ID + */ + public int getUpdatedBy(); + + + + + + /** + * Is new record + * @return true if new + */ + public boolean is_new(); + + + + /** + * Is there a Change to be saved? + * @return true if record changed + */ + public boolean is_Changed(); + + /** + * Create Single/Multi Key Where Clause + * @param withValues if true uses actual values otherwise ? + * @return where clause + */ + public StringBuffer get_WhereClause (boolean withValues); + + + + + + /** + * Get value as Boolean + * @param columnName + * @return boolean value + */ + public boolean get_ValueAsBoolean(String columnName); + + public int get_ValueAsInt (int index); + + public int get_ValueAsInt(String columnName); + + public StringBuffer getSelectBuild(); + + public StringBuffer getSelectBuild(List cols); + + + public Map toMap(); + + /** + * return required type date, if not match, return the NA of the type + * @param index + * @param displayType + * @return + */ + public Object getValueAsType(int index, String displayType); + + /** + * return required type date, if not match, return the NA of the type + * @param columnName + * @param displayType + * @return + */ + public Object getValueAsType(String columnName, String displayType); + + public boolean isVirtualColumn (int index); + + public String get_ColumnDisplayType (int index); + + public Class get_ColumnClass(int index); + + public StringBuffer get_SearchWhereClause (Map map); + + /** + * get column display name, if the column is a Entity Object , return the entity display name + * @param colName + * @param defaultValue + * @param timeZone + * @return + */ + public String get_DisplayValue(String colName, boolean defaultValue, DateTimeZone timeZone); + + /** + * get the entity display name + * @return + */ + public String get_EntityDisplayName(); + + /** + * get index column reference table foreign key columnName + * @param index + * @return + */ + public String get_referenceValueColumnName(int index); + + /** + * get index column reference table foreign key columnName + * @param index + * @return + */ + public POJOInfo get_poInfo(); + + /** + * get the entity display column + * @return + */ + public String get_EntityDisplayColumn(); + + /** + * get display type column name list + * @param displayType + * @return + */ + public List get_ColumnsByDisplayType(String displayType); + + /** + * get pojoInfo by tableName + * @param tableName + * @return + */ + public POJOInfo initPO(String tableName); + + /** + * load hierarchical Value, update it, the value set to the old value + * @param columnName + */ + public boolean updateHierarchicalValue(String columnName, List list); + + /** + * load hierarchical Value, update it, the value set to the old value + * @param columnName + */ + public boolean updateHierarchicalValue(int index, List list); + + public GeneralPOJO getMainPO(); + + public void setMainPO(GeneralPOJO po); + + public Properties getCtx(); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/POJOInfo.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/POJOInfo.java new file mode 100644 index 0000000..cbd573b --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/POJOInfo.java @@ -0,0 +1,404 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package com.dsasp.server.common.dataDic.bean; + +import java.util.List; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.privilege.bean.DataFilterRule; +import com.dsasp.server.common.util.StringUtil; + + +/** + * Persistent Object Info. + * Provides structural information + * + * @author Jorg Janke + * @version $Id: POInfo.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $ + * @author Victor Perez, e-Evolution SC + *
  • [ 2195894 ] Improve performance in PO engine + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195894&group_id=176962&atid=879335 + */ +public interface POJOInfo +{ + /** + * String representation + * @return String Representation + */ + public String toString(); + /** + * String representation for index + * @param index column index + * @return String Representation + */ + public String toString (int index); + + /** + * Get Table Name + * @return Table Name + */ + public String getTableName(); + + /** + * Get AD_Table_ID + * @return AD_Table_ID + */ + public String getAD_Table_ID(); + /** + * Table has a Key Column + * @return true if has a key column + */ + public boolean hasKeyColumn(); + + /** + * Get Table Access Level + * @return Table.ACCESS.. + */ + public int getAccessLevel(); + + /************************************************************************** + * Get ColumnCount + * @return column count + */ + public int getColumnCount(); + + /** + * Get Column Index + * @param ColumnName column name + * @return index of column with ColumnName or -1 if not found + */ + public int getColumnIndexByName (String ColumnName); + /** + * Get Column Index + * @param AD_Column_ID column + * @return index of column with ColumnName or -1 if not found + */ + public int getColumnIndexByID (String AD_Column_ID); + + /** + * @param columnName + * @return AD_Column_ID if found, -1 if not found + */ + public String getAD_Column_ID(String columnName); + + + /** + * Get Column Name + * @param index index + * @return ColumnName column name + */ + public String getColumnName (int index); + + /** + * Get Column SQL or Column Name + * @param index index + * @return ColumnSQL column sql or name + */ + public String getColumnSQL (int index, String prefix, StringBuffer lateral); + + /** + * Is Column Virtual? + * @param index index + * @return true if column is virtual + */ + public boolean isVirtualColumn (int index); + + /** + * Get Column Label + * @param index index + * @return column label + */ + public String getColumnLabel (int index); + + /** + * Get Column Description + * @param index index + * @return column description + */ + public String getColumnDescription (int index); + + /** + * Get Column Class + * @param index index + * @return Class + */ + public Class getColumnClass (int index); + + /** + * Get Column Display Type + * @param index index + * @return DisplayType + */ + public String getColumnDisplayType (int index); + + /** + * Get Column Default Logic + * @param index index + * @return Default Logic + */ + public String getDefaultLogic (int index); + + /** + * Is Column Mandatory + * @param index index + * @return true if column mandatory + */ + public boolean isColumnMandatory (int index); + + /** + * Is Column Updateable + * @param index index + * @return true if column updateable + */ + public boolean isColumnUpdateable (int index); + + /** + * Set Column Updateable + * @param index index + * @param updateable column updateable + */ + public void setColumnUpdateable (int index, boolean updateable); + + /** + * Set all columns updateable + * @param updateable updateable + */ + public void setUpdateable (boolean updateable); + /** + * Is Lookup Column + * @param index index + * @return true if it is a lookup column + */ + public boolean isColumnLookup (int index); + /** + * Get Lookup + * @param index index + * @return Lookup + */ +// public Lookup getColumnLookup (int index) +// { +// if (!isColumnLookup(index)) +// return null; +// // +// int WindowNo = 0; +// // List, Table, TableDir +// Lookup lookup = null; +//// try +//// { +//// lookup = MLookupFactory.get (m_ctx, WindowNo, +//// m_columns[index].AD_Column_ID, m_columns[index].DisplayType, +//// Env.getLanguage(m_ctx), m_columns[index].ColumnName, +//// m_columns[index].AD_Reference_Value_ID, +//// m_columns[index].IsParent, m_columns[index].ValidationCode); +//// } +//// catch (Exception e) +//// { +//// lookup = null; // cannot create Lookup +//// } +// return lookup; +// /** @todo other lookup types */ +// } // getColumnLookup + + /** + * Is Column Key + * @param index index + * @return true if column is the key + */ + public boolean isKey (int index); + + /** + * Is Column Parent + * @param index index + * @return true if column is a Parent + */ +// public boolean isColumnParent (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsParent; +// } // isColumnParent + + /** + * Is Column Translated + * @param index index + * @return true if column is translated + */ +// public boolean isColumnTranslated (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsTranslated; +// } // isColumnTranslated + + /** + * Is Table Translated + * @return true if table is translated + */ +// public boolean isTranslated () +// { +// for (int i = 0; i < m_columns.length; i++) +// { +// if (m_columns[i].IsTranslated) +// return true; +// } +// return false; +// } // isTranslated + +// /** +// * Is Column (data) Encrypted +// * @param index index +// * @return true if column is encrypted +// */ +// public boolean isEncrypted (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsEncrypted; +// } // isEncrypted + + /** + * Is allowed logging on this column + * + * @param index + * index + * @return true if column is allowed to be logged + */ + public boolean isAllowLogging(int index); + + /** + * Get Column FieldLength + * @param index index + * @return field length + */ + public int getFieldLength (int index); + + /** + * Get Column FieldLength + * @param columnName Column Name + * @return field length or 0 + */ + public int getFieldLength (String columnName); + + /** + * Validate Content + * @param index index + * @param value new Value + * @return null if all valid otherwise error message + */ + public String validate (int index, Object value); + + /** + * Validate Content (Mandatory ,Length and Min/Max) + * @param index + * @param value newValue + * @return null if all valid otherwise error message + */ + public String validateValue(int index, Object value); + /** + * Build select clause + * @return stringbuffer + */ + public StringBuffer buildSelect(); + + public StringBuffer buildSelect(List cols); + + public StringBuffer buildSelect(List cols, String prefix); + + public StringBuffer buildCount(); + + /** + * + * @return if table save log + */ + public boolean isChangeLog(); + + /** + * get the reference value of the col , if the col is a entity Object or a enumerate + * @param columnName + * @return + */ + public String getReferenceValue(String columnName); + + public String getReferenceValue(int index); + + public int getDisplayIndex(); + + public String getReferenceValueTable(int index); + + public String getReferenceValueTable(String columnName); + + + public String getReferenceValueColumnName(int index); + + public String getReferenceValueColumnName(String columnName); + + + /** + * Is Column identifier + * @param index index + * @return true if column mandatory + */ + public boolean isIdentifier (int index); + + /** + * is column combidentifier + * @param index + * @return + */ + public boolean isCombidentifier (int index); + + /** + * + * @return + */ + public List getRules(); + + /** + * return table type 0: main table 1: sub table 2: middle table + * @return + */ + public int getTableType(); + + public String getKeyColumnName(); + + public String getTableDisplayName(); + + public List getDataFilterRules(); + + public List get_ColumnsByDisplayType(String displayType); + + /** + * columnName is a foreign key, return it reference table + * @param columnName + * @return + */ + public String getReferenceTable(int index); + + /** + * columnName is a foreign key, return it reference table + * @param columnName + * @return + */ + public String getReferenceTable(String columnName); + + public String getEnumerateType(String columnName); + + public String getEnumerateType(int index); + + +} // POInfo diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/PojoMap.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/PojoMap.java new file mode 100644 index 0000000..121b504 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/PojoMap.java @@ -0,0 +1,21 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.HashMap; + +public class PojoMap extends HashMap{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + public Object get_Value(String columnName){ + return get(columnName); + } + + public PojoMap toMap(){ + return this; + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Rule.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Rule.java new file mode 100644 index 0000000..e614b13 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/Rule.java @@ -0,0 +1,49 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.Map; + +public interface Rule { + + public static final String TABLENAME = "SYS_RULE"; + public static final String name = "NAME"; + public static final String content = "CONTENT"; + public static final String entityId = "ENTITYID"; + public static final String verificationTime = "VERIFICATIONTIME"; + + public static final Integer BEFORESAVE = 0; + public static final Integer AFTERSAVE = 1; + public static final Integer BEFOREDELETE = 2; + public static final Integer AFTERDELETE = 3; + + + + public GeneralPOJO getPo(); + + + public String getName() ; + + + public void setName(String name); + + + public String getContent(); + + + public void setContent(String content); + + + public String getEntityId(); + + + public void setEntityId(String entityId); + + + public Integer getVerificationTime(); + + + public void setVerificationTime(Integer verificationTime); + + public Map convertToMap(); + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SYS_Entity.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SYS_Entity.java new file mode 100644 index 0000000..f518420 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SYS_Entity.java @@ -0,0 +1,54 @@ +package com.dsasp.server.common.dataDic.bean; + +import java.util.List; + +public interface SYS_Entity { + + /** + * get sys_entity po + * @return + */ + public GeneralPOJO getPo(); + +// public void setPo(GeneralPO po) { +// this.po = po; +// } + + /** + * get "SYS_ENTITY" + * @return + */ + public String getTablename(); + + /** + * 0: main table 1: sub table 2: mid table + * @return + */ + public Integer getTabletype(); + + /** + * table or view + * @return + */ + public boolean isView(); + + /** + * get entity attributes + * @return + */ + public List getAttributes(); + + /** + * create the table create postgresql sql + * @return + */ + public String createTableSql(); + + + /** + * delete table sql + * @return + */ + public String delteTableSql(); + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SysConfig.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SysConfig.java new file mode 100644 index 0000000..4ecafbe --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/SysConfig.java @@ -0,0 +1,35 @@ +package com.dsasp.server.common.dataDic.bean; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.util.StringUtil; + +/** + * 系统配置信息 + * + * @author shanxh + * + */ +public class SysConfig { + protected static CCache key_cache = new CCache( + "SysConfig", 200); + + /** + * @param key + * @return 配置的属性值 + */ + public static String getConfigValue(String key) { + String configValue = key_cache.get(key); + if (StringUtil.isEmpty(configValue)) { + configValue = ((DataDicService) SpringBeanOsgiServices + .getInstance().getBeanByName("dataDicService")) + .getConfigValue(key); + key_cache.put(key, configValue); + } + return configValue; + } + + public static void setChangeValue(String key) { + key_cache.remove(key); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/CodeRuleService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/CodeRuleService.java new file mode 100644 index 0000000..fceaf3c --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/CodeRuleService.java @@ -0,0 +1,7 @@ +package com.dsasp.server.common.dataDic.service; + +import java.util.Map; + +public interface CodeRuleService { + public String getCode(String tableName,String columnName,Map map) throws Exception; +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/DataDicService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/DataDicService.java new file mode 100644 index 0000000..7629257 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/DataDicService.java @@ -0,0 +1,142 @@ +package com.dsasp.server.common.dataDic.service; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.dsasp.server.common.dataDic.bean.EnumerateItem; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.Rule; +import com.dsasp.server.common.dataDic.bean.SYS_Entity; + +public interface DataDicService { + + + + /** + * control privilege by user self + * @return + */ + public List listSelect(int firstResult, int pageSize, Map map); + + /** + * + * @param countSql + * @return + */ + + public long findCount(String countSql); + + /** + * get entity attributes whit the entity ID + * @param entityID + * @return + */ + public List getEntityAttributes(String entityID); + + /** + * select the meta + * @return + */ + public List getMeta(int firstResult, int pageSize); + + + /** + * only save Entity + * @param entity + * @return + */ + public Object save(Map entity, Properties ctx); + + /** + * + * @param entity + * @return + */ + public Object update(Map entity, Properties ctx); + + + /** + * set isActivity is false. + * @param entity + * @param userID + * @return + */ + public boolean delete(Map entity, Properties ctx); + + public SYS_Entity getSYSEntity(String entityId); + + /** + * load the entity info with the tableName; + * @param tableName + * @return + */ + public POJOInfo loadInfo(String tableName); + + /** + * find the reference Entity's tableName, use the Entity class + * @param referenceId + * @return + */ + public String getReferenceEntityTableName(String referenceId); + + /** + * find the sub table name with the reference value id , it's reference id is List + * @param referenceValueId + * @return + */ + public String getEntityTableNameByReferenceValue(String referenceValueId); + + /** + * get the foreign key by ferenceValue + * @param referenceValueId + * @return + */ + public String getColumnNameByReferenceValue(String referenceValueId); + + /** + * + * @param sql + * @return + */ + public String executeCreateSql(String sql); + + /** + * get entity by table name + * @param tableName + * @return + */ + public SYS_Entity getSYSEntityByTableName(String tableName); + + public GeneralPOJO getTableDefaultAttribute(); + + /** + * get all entity with the entity of the entity id for foreign key + * @param entityId + * @return + */ + public List getEntitysWithForeignKey(String entityId); + + /** + * update or save reference and reference value + * @param po + * @param ctx + */ + public void saveOrUpdateReference(GeneralPOJO po, Properties ctx); + + /** + * + * @param tableName + * @return + */ + public List getRule(String tableName); + + public List getEnumerateItems(String enumerateType); + + /** + * @param key + * @return 系统配置的属性值 + */ + public String getConfigValue(String key); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOCRUDService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOCRUDService.java new file mode 100644 index 0000000..57d28d3 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOCRUDService.java @@ -0,0 +1,107 @@ +package com.dsasp.server.common.dataDic.service; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; + +public interface POJOCRUDService { + + /** + * count of the result page + */ + public static final String PAGE_COUNT = "pagecount"; + + public static final String LIST_RESULT = "listresult"; + + /** + * the count of records of per page + */ + public static final String PAGE_SIZE = "pagesize"; + + /** + * search record from the start record number + */ + public static final String PAGE_START = "pagestart"; + + public static final String ORDER = "order"; + /** + * if true , list select method only return the count size of result list + */ + public static final String IS_ONLY_GET_COUNT = "is_only_get_count"; + + /** + * key/value Value is List type , contains all the result column . other columns don't return + */ + public static final String RETURN_COLUMNS_LIST = "return_columns_list"; + + /** + * key/value Value is List type , contains all the result column . other columns don't return + */ + public static final String SUM_COLUMNS_LIST = "sum_columns_list"; + + public static final String RETURN_SUM_COLUMNS_MAP = "return_sum_columns_map"; + + /** + * fuzzy query, query the entity all display name except date and number field + */ + public static final String FUZZY_QUERY = "fuzzy_query"; + + /** + * + */ + public static final String PARENT_COLUMN_NAME = "parent_column_name"; + + + public Map listSelect(Map map, final String tableName, Properties ctx); + + public GeneralPOJO save(Map map, final String tableName, Properties ctx); + + public GeneralPOJO update(Map map, final String tableName, Properties ctx); + + public GeneralPOJO delete(String entityId, final String tableName, Properties ctx); + + public GeneralPOJO forceDelete(String entityId, final String tableName, Properties ctx); + + public GeneralPOJO loadPOJO(String entityId, String tableName, Properties ctx, Boolean isHierarchical); + + /** + * + * @param map where conditional + * @param tableName special tableName + * @param ctx + * @param returnColumnMap special the return columns + * @return + */ + public Map listSelectSpecialCol(Map map, final String tableName, Properties ctx, List returnColumnMap); + + + /** + * + * @param map 自定义sql的排序需要单独列在map中 + * @param tableName + * @param sql 自定义sql + * @param ctx + * @param returnColMap + * @return + */ + public Map listSelectBySql(Map map, final String tableName, String sql, Properties ctx, List returnColMap); + /** + * 根据返回类型的要求返回值,returnSetType为空表示不返回,则返回空 + * @param returnSetType + * @param ctx + * @param procedure + * @return + */ + public Object executeProcedureReturnObject(String returnType, String[][] returnSetType, Properties ctx, String procedure); + + /** + * 批量保存实体 + * @param list + * @param tableName + * @param ctx + */ + public void batchSave(List list, String tableName, Properties ctx); + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOService.java new file mode 100644 index 0000000..524b323 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/service/POJOService.java @@ -0,0 +1,106 @@ +package com.dsasp.server.common.dataDic.service; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; + +public interface POJOService { + + /** + * control privilege by user self + * @return + */ + public List listSelect(String sql, String tableName, int firstResult, int pageSize); + + /** + * control privilege by user self + * @return + */ + public List listSelectSpecialCols(String sql, String tableName, int firstResult, int pageSize, List cols); + + /** + * + * @param countSql + * @return + */ + + public long findCount(String countSql); + + /** + * + * @param sumSql + * @return + */ + + public Map findSumColumn(String sumSql); + + + /** + * control privilege by this method + * @param tableName + * @param firstResult + * @param count + * @param userId + * @return + */ + public List listSelect(String tableName, int firstResult, int pageSize, Object[] propertyId, boolean[] ascending, String userId, Map map); + + + public long findCount(String tableName, String userId); + + + + + + + public boolean save(GeneralPOJO po, String userID); + + /** + * deal whith optimistic lock version + * @param po + * @return + */ + public boolean update(GeneralPOJO po, String userID); + + + /** + * deal whith optimistic lock version + * @param po + * @return + */ + public boolean delete(GeneralPOJO po, String userID, Boolean force); + + public boolean deleteCascadeValidate(String tableName, String recordID); + + + public GeneralPOJO loadPOJO(String entityId, String tableName, Properties ctx, Boolean isHierarchical); + + public GeneralPOJO loadPOJO(String entityId, String tableName); + + /** + * get table info + * @param tableName + * @return + */ + public POJOInfo getPOJOInfo(String tableName); + + + /** + * execute the procedure, return void, or type or set + * @param sql + */ + public Object executeProcedureReturnList(final String sql, String returnType, + String[][] returnCols); + + + public StringBuffer save_convertToSql(GeneralPOJO po, String userID, String foreignColName); + + public void batchExecute(String sql); + + public Map executeQueryForMap(String sql); + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/PrivilegeException.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/PrivilegeException.java new file mode 100644 index 0000000..33f443b --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/PrivilegeException.java @@ -0,0 +1,25 @@ +package com.dsasp.server.common.exception; + +/** + * + * 权限异常 + * + */ +public class PrivilegeException extends RuntimeException { + + public PrivilegeException() { + super(); + } + + public PrivilegeException(String message) { + super(message); + } + + public PrivilegeException(String message, Throwable cause) { + super(message, cause); + } + + public PrivilegeException(Throwable cause) { + super(cause); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/SameCodeException.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/SameCodeException.java new file mode 100644 index 0000000..b9aafca --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/SameCodeException.java @@ -0,0 +1,57 @@ +package com.dsasp.server.common.exception; + +/** + * 编号相同异常 + * @author zhengwr + * + */ +public class SameCodeException extends RuntimeException { + + /** + * 编号重复的字段 + */ + private String columnName; + + /** + * 编号重复的表 + */ + private String tableName; + + public SameCodeException() { + super(); + } + + public SameCodeException(String message, Throwable cause) { + super(message, cause); + } + + public SameCodeException(String message) { + super(message); + } + + public SameCodeException(Throwable cause) { + super(cause); + } + + public SameCodeException(String message,String tableName, String columName) { + super(message); + this.tableName = tableName; + this.columnName = columName; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/ValidationException.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/ValidationException.java new file mode 100644 index 0000000..7f16731 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/exception/ValidationException.java @@ -0,0 +1,25 @@ +package com.dsasp.server.common.exception; + +/** + * + * 逻辑验证异常 + * + */ +public class ValidationException extends RuntimeException { + + public ValidationException() { + super(); + } + + public ValidationException(String message) { + super(message); + } + + public ValidationException(String message, Throwable cause) { + super(message, cause); + } + + public ValidationException(Throwable cause) { + super(cause); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/FileService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/FileService.java new file mode 100644 index 0000000..906f606 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/FileService.java @@ -0,0 +1,66 @@ +package com.dsasp.server.common.file.service; + +import java.io.File; +import java.util.List; +import java.util.Properties; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; + +public interface FileService { + + /** + * temporary file list + * @param tempFiles + * @param tableName + * @param businessKey + */ + public String save(String tempFile, String fileName, int size, String tableName, String businessKey, Properties ctx); + + public void saveDoc(String relativePath, String fileName, int size, String tableName, String businessKey, Properties ctx); + + + /** + * get doc file by relative path + * @param relativePath + * @param fileName + * @param isZip + * @return + */ + public File getDocFile(String relativePath, String fileName, boolean isZip); + /** + * delete file by doc ids + * @param fileIds + */ + public void delete(List fileIds, String userId); + + public void delete(String fileId, String userId); + + public void deleteAttatchmentByBusinessKey(String businessKey, String userId); + + public void deleteAttatchmentByBusinessKey(List businessKeys, String userId); + + /** + * 定期清理已标志删除文件 + */ + public void clearDeletedDocument(); + + /** + * 定期清理垃圾文件,如:保存失败,事务回滚产生的垃圾文件 + */ + public void clearDumpFile(); + + public List getDoc(List businessKeys); + + /** + * 获得图片地址(取业务的第一个附件) + * @param tablename + * @param businesskey + * @return + */ + public String getPicPath(String tablename,String businesskey); + + + public String saveDecoderBase64File(String base64Code, String userId, String tableName, Properties ctx)throws Exception; + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/SYSDoc.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/SYSDoc.java new file mode 100644 index 0000000..704549f --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/file/service/SYSDoc.java @@ -0,0 +1,23 @@ +package com.dsasp.server.common.file.service; + +public class SYSDoc { + public static String SYSDocTableName = "SYS_DOC"; + public static String fileName = "FILENAME"; + public static String fileExt = "FILEEXT"; + public static String fileSize = "FILESIZE"; + public static String filePath = "FILEPATH"; + public static String tableName = "TABLENAME"; + public static String businessKey = "BUSINESSKEY"; + public static String md5Hash = "MD5HASH"; + + /** + * sys_doc_id + */ + public static String docId = "SYS_DOC_ID"; + + /** + * System.currentTimeMillis() plus upload file name + */ + public static String tempFile = "TEMPFILE"; + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetDefaultValueFunction.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetDefaultValueFunction.java new file mode 100644 index 0000000..b829927 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetDefaultValueFunction.java @@ -0,0 +1,8 @@ +package com.dsasp.server.common.function; + +/** + * eip4-poc 移植桩:原版为 Groovy 脚本函数库(currentYear/currentMonth 等默认值函数), + * 仅被 FunctionUtil 以 class 引用注册。WS3 脚本验证时回迁完整实现。 + */ +public class GetDefaultValueFunction { +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetServicesFunction.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetServicesFunction.java new file mode 100644 index 0000000..5850e36 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetServicesFunction.java @@ -0,0 +1,18 @@ +package com.dsasp.server.common.function; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.service.DataDicService; + +/** + * eip4-poc 移植桩:原版为 780 行 Groovy 脚本函数库(@Function 注解暴露给模板脚本)。 + * PoC 阶段只实现被 Java 代码直接调用的 findCount(POInfo.java:860); + * 完整 Groovy 函数库在 WS3 脚本验证时以 groovy-jsr223 联合编译方式回迁。 + */ +public class GetServicesFunction { + + public static long findCount(String countSql) { + DataDicService dataDicService = + (DataDicService) SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService"); + return dataDicService.findCount(countSql); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetValueFunction.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetValueFunction.java new file mode 100644 index 0000000..8c1ceab --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/function/GetValueFunction.java @@ -0,0 +1,8 @@ +package com.dsasp.server.common.function; + +/** + * eip4-poc 移植桩:原版为 Groovy 脚本函数库,仅被 FunctionUtil 以 class 引用注册。 + * WS3 脚本验证时回迁完整实现。 + */ +public class GetValueFunction { +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogDetail.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogDetail.java new file mode 100644 index 0000000..b6e83a1 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogDetail.java @@ -0,0 +1,68 @@ +package com.dsasp.server.common.log.bean; + +import java.util.List; + +public class DataLogDetail { + + private String DataLogDetail_Id; + + private String dataLogId; + + private String columnName; + + private String oldValue; + + private String newValue; + + private List list; + + public String getDataLogDetail_Id() { + return DataLogDetail_Id; + } + + public void setDataLogDetail_Id(String dataLogDetail_Id) { + DataLogDetail_Id = dataLogDetail_Id; + } + + public String getDataLogId() { + return dataLogId; + } + + public void setDataLogId(String dataLogId) { + this.dataLogId = dataLogId; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public String getOldValue() { + return oldValue; + } + + public void setOldValue(String oldValue) { + this.oldValue = oldValue; + } + + public String getNewValue() { + return newValue; + } + + public void setNewValue(String newValue) { + this.newValue = newValue; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogItem.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogItem.java new file mode 100644 index 0000000..e4396af --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/DataLogItem.java @@ -0,0 +1,91 @@ +package com.dsasp.server.common.log.bean; + +import java.util.ArrayList; +import java.util.List; + +public class DataLogItem { + + private String DataLogItem_Id; + + private String userId; + + private String recordId; + + private String tableName; + + private String mainDataLogItemId; + + private int type; + + /** + * operate type + */ + public static final Integer OPERATE_NEW = 1; + public static final Integer OPERATE_UPDATE = 2; + public static final Integer OPERATE_DELETE = 3; + + private List detailList = new ArrayList(); + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getRecordId() { + return recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getDetailList() { + return detailList; + } + + public void setDetailList(List list) { + this.detailList = list; + } + + public String getMainDataLogItemId() { + return mainDataLogItemId; + } + + public void setMainDataLogItemId(String mainDataLogItemId) { + this.mainDataLogItemId = mainDataLogItemId; + } + + public String getDataLogItem_Id() { + return DataLogItem_Id; + } + + public void setDataLogItem_Id(String dataLogItem_Id) { + DataLogItem_Id = dataLogItem_Id; + } + + public void addDataLogDetail(DataLogDetail detail){ + detailList.add(detail); + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/LogItem.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/LogItem.java new file mode 100644 index 0000000..18135d6 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/LogItem.java @@ -0,0 +1,10 @@ +package com.dsasp.server.common.log.bean; + +public interface LogItem { + + public String toDetail(); + + public String toDifferent(LogItem oldObject); + + public boolean isLog(); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/SysLogItem.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/SysLogItem.java new file mode 100644 index 0000000..348d1bf --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/bean/SysLogItem.java @@ -0,0 +1,44 @@ +package com.dsasp.server.common.log.bean; + +import com.dsasp.server.common.log.service.SystemLogManager.LogType; + +public class SysLogItem { + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public LogType getLogType() { + return logType; + } + public void setLogType(LogType logType) { + this.logType = logType; + } + public String getLogContent() { + return logContent; + } + public void setLogContent(String logContent) { + this.logContent = logContent; + } + private LogType logType; + private String logContent; + private String userId; + + + + public SysLogItem(LogType logType, String logContent, String userId) { + super(); + this.logType = logType; + this.logContent = logContent; + this.userId = userId; + } + public SysLogItem() { + super(); + // TODO Auto-generated constructor stub + } + + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/DataOperatorLog.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/DataOperatorLog.java new file mode 100644 index 0000000..30298a5 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/DataOperatorLog.java @@ -0,0 +1,14 @@ +package com.dsasp.server.common.log.service; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.log.bean.DataLogItem; + +public interface DataOperatorLog { + + public DataLogItem insertData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId); + + public DataLogItem updateData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId); + + public DataLogItem deleteData(GeneralPOJO po, String dataLogItemId, String mainDataLogItemId); + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/SystemLogManager.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/SystemLogManager.java new file mode 100644 index 0000000..792a93c --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/log/service/SystemLogManager.java @@ -0,0 +1,44 @@ +package com.dsasp.server.common.log.service; + +import java.util.List; + +import org.joda.time.DateTime; + +import com.dsasp.server.common.log.bean.SysLogItem; + + +public interface SystemLogManager { + public enum LogType{ + ERRORS("Errors"), + INFO("Info"), + DEBUG("Debug"), + WARNINGS("Warnings"); + private String value; + private LogType(String value) { + this.value = value; + }; + + public String getValue(){ + return value; + } + + public static LogType getType(String value) { + for (LogType c : LogType.values()) { + if (c.getValue().equals(value)) { + return c; + } + } + return null ; + } + } + + public void log(LogType logType,String logContent); + + public void deleteAll(); + + public void deleteByType(String type); + + public void log( List items); + + public void deleteByLoginTime(List userIds,DateTime[] loginTimes); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/organization/bean/Position.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/organization/bean/Position.java new file mode 100644 index 0000000..7f18047 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/organization/bean/Position.java @@ -0,0 +1,45 @@ +package com.dsasp.server.common.organization.bean; + +public class Position { + + private String id; + + private String name; + + private String departId; + + private String type; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDepartId() { + return departId; + } + + public void setDepartId(String departId) { + this.departId = departId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/Conditional.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/Conditional.java new file mode 100644 index 0000000..c35f62c --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/Conditional.java @@ -0,0 +1,88 @@ +package com.dsasp.server.common.privilege.bean; + +public class Conditional { + + /** + * table field + */ + private String preConditional; + /** + * sign > ,<, = , in ... + */ + private String sign; + /** + * back conditional + */ + private String backConditional; + + /** + * conditional type + */ + private String type; + + /** + * and / or with next rule + */ + private String op; + + + public String getPreConditional() { + return preConditional; + } + public void setPreConditional(String preConditional) { + this.preConditional = preConditional; + } + public String getSign() { + return sign; + } + public void setSign(String sign) { + this.sign = sign; + } + public String getBackConditional() { + return backConditional; + } + public void setBackConditional(String backConditional) { + this.backConditional = backConditional; + } + + + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getOp() { + return op; + } + public void setOp(String op) { + this.op = op; + } + + + + public static final String SIGN_GREATER = ">"; + public static final String SIGN_GREATEREQUAL = ">="; + public static final String SIGN_LESS = "<"; + public static final String SIGN_LESSEQUAL = "<="; + public static final String SIGN_EQUAL = "="; + public static final String SIGN_CONTAIN = "in"; + public static final String SIGN_NOTCONTAIN = "not in"; + + + public static final String CURRENTUSER = "CURRENTUSERID"; + public static final String CURRENTUSERDEPART = "CURRENTUSERDEPARTID"; + public static final String CURRENTUSERORG = "CURRENTUSERORGID"; + public static final String SPECIALDEPART = "SPECIALDEPART"; + public static final String SPECAILORG = "SPECIALORG"; + public static final String NUMBER = "NUMBER"; + public static final String TEXT = "TEXT"; + + //所属项目 + public static final String OWNNERPROJECT = "OWNNERPROJECT"; + + +// public static final String AND = "AND"; +// public static final String OR = "OR"; +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataFilterRule.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataFilterRule.java new file mode 100644 index 0000000..0aec4e0 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataFilterRule.java @@ -0,0 +1,42 @@ +package com.dsasp.server.common.privilege.bean; + +import java.util.HashSet; +import java.util.List; + +public class DataFilterRule { + private List roles; + + private List ConditionalList; + + private String id; + + + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public List getConditionalList() { + return ConditionalList; + } + + public void setConditionalList(List conditionalList) { + ConditionalList = conditionalList; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataPrivilege.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataPrivilege.java new file mode 100644 index 0000000..f7dd452 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/bean/DataPrivilege.java @@ -0,0 +1,100 @@ +package com.dsasp.server.common.privilege.bean; + +import java.util.List; + +public class DataPrivilege { + + public final static int READ = 0; + public final static int WRITE = 1; + + private String id; + + /** + * entity + */ + private String entityId; + + /** + * 0: read, 1: write + */ + private int operation; + + /** + * 0: oneself,1:special users,2:owner depart,3:special depart,4:owner org, 5:special org, 6: all + */ + private int scopeType; + + /** + * if scopeType is a special type, specialUnits's value is not null; + */ + private List specialUnits; + + /** + * default permission is all field + */ + private boolean isAll; + + /** + * if isAll is false, exceptionFields is the except fields + */ + private List exceptionFields; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEntityId() { + return entityId; + } + + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + public int getOperation() { + return operation; + } + + public void setOperation(int operation) { + this.operation = operation; + } + + public int getScopeType() { + return scopeType; + } + + public void setScopeType(int scopeType) { + this.scopeType = scopeType; + } + + public List getSpecialUnits() { + return specialUnits; + } + + public void setSpecialUnits(List specialUnits) { + this.specialUnits = specialUnits; + } + + public boolean isAll() { + return isAll; + } + + public void setAll(boolean isAll) { + this.isAll = isAll; + } + + public List getExceptionFields() { + return exceptionFields; + } + + public void setExceptionFields(List exceptionFields) { + this.exceptionFields = exceptionFields; + } + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/service/DataPrivilegeService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/service/DataPrivilegeService.java new file mode 100644 index 0000000..5f6c528 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/privilege/service/DataPrivilegeService.java @@ -0,0 +1,60 @@ +package com.dsasp.server.common.privilege.service; + +import java.util.List; +import java.util.Properties; + +import com.dsasp.server.common.privilege.bean.DataFilterRule; +import com.dsasp.server.common.privilege.bean.DataPrivilege; + +public interface DataPrivilegeService { + + +// /** +// * get user's the privilege of the action, 0: without permission 1: all permission 2: the permission of some fields , +// * @param userID +// * @return map, key is entityID, value is privilege set +// */ +// public DataPrivilege getPrivilege(String userID, String entity, int operationType); + + public String getWhereClause(Properties ctx, String tableName); + +// /** +// * get the action special permission of some fields, +// * @param userID +// * @param entity +// * @return +// */ +// public List getSpecPrivileges(String userID, String entity); + + +// public List getRoleDataPrivilege(String roleId); + + +// /** +// * +// * @param roleId +// * @param privilege +// * @return +// */ +// public boolean updateDataPrivilege(String roleId, DataPrivilege privilege); + + + /** + * update the entity all rules + * @param entityId + * @param list + * @param ctx + */ + public void saveOrUpdateDataPrivilege(String entityId, List list, Properties ctx); + + + /** + * get entity all the rule + * @param entityId + * @return + */ + public List getEntityDataFilterRule(String entityId); + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/user/service/LoggedInUser.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/user/service/LoggedInUser.java new file mode 100644 index 0000000..0d51c3a --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/user/service/LoggedInUser.java @@ -0,0 +1,59 @@ +/* Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.dsasp.server.common.user.service; + +import java.io.Serializable; + +import com.dsasp.server.common.organization.bean.Position; + + +/** + * Interface describing the logged in user. + * + * @author Frederik Heremans + */ +public interface LoggedInUser extends Serializable { + + public static final String CURRENTUSER = "CURRENTUSER"; + + public static final String CURRENTDEPART = "CURRENTDEPART"; + + public static final String CURRENTORG = "CURRENTORG"; + + public static final String ROLES = "ROLES"; + + public static final String ADMIN = "ADMIN "; + + public static final String CURRENTPROJECT ="CURRENTPROJECT";//工程切换 + + public static final String DEFAULTPROJECT = "DEFAULTPROJECT";//个人设置工程 + + public static final String COMPLETEDPROJECT="COMPLETEDPROJECT";//竣工工程 + + public static final String DEFAULTPAGESIZE="DEFAULTPAGESIZE"; + + String getId(); + + String getFirstName(); + + String getLastName(); + + String getFullName(); + + String getPassword(); + + boolean isAdmin(); + + Position getMainPosition(); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/util/DbUtil.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/DbUtil.java new file mode 100644 index 0000000..f4763fa --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/DbUtil.java @@ -0,0 +1,655 @@ +package com.dsasp.server.common.util; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.Writer; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Time; +import java.sql.Types; +import java.util.Locale; + +import org.joda.time.DateTime; +import org.json.JSONObject; + + +public class DbUtil { + public static void testJndi(String jndi) throws Exception { +// Connection conn = getConnection(jndi); +// conn.close(); + } + public static boolean isBlobField(int type) { + switch (type) { + case -2: + case -3: + case -4: + case 2004: + return true; + } + return false; + } + + public static boolean isTextField(int type) { + switch (type) { + case -1: + case -16: + case 2005: + case 2011: + return true; + } + return false; + } + + public static boolean isLargeField(int type) { + switch (type) { + case -1: + case -2: + case -3: + case -4: + case -16: + case 2004: + case 2005: + case 2011: + return true; + } + return false; + } + + + public static String getTypeCategory(int type) { + switch (type) { + case Types.BIGINT: + case Types.INTEGER: + case Types.SMALLINT: + case Types.TINYINT: + return "int"; + case Types.DECIMAL: + case Types.DOUBLE: + case Types.FLOAT: + case Types.NUMERIC: + case Types.REAL: + return "float"; + case Types.TIMESTAMP: + case Types.DATE: + case Types.TIME: + return "date"; + case Types.BOOLEAN: + case Types.BIT: + return "bool"; + default: + return "string"; + } + } + + public static String getFields(ResultSetMetaData meta, int colCount, + boolean dateAsString, JSONObject keyMap) throws Exception { + int i, type; + String name, category, fmt; + StringBuilder buf = new StringBuilder(); + + buf.append('['); + for (i = 0; i < colCount; i++) { + if (i > 0) + buf.append(','); + buf.append("{name:"); + name = meta.getColumnLabel(i + 1); + if (StringUtil.isEmpty(name)) + name = "FIELD" + Integer.toString(i + 1); + buf.append(StringUtil.quote(name)); + buf.append(",type:\""); + if (keyMap != null && keyMap.has(name)) + type = Types.VARCHAR; + else + type = meta.getColumnType(i + 1); + if (dateAsString + && (type == Types.TIMESTAMP || type == Types.DATE || type == Types.TIME)) + type = Types.VARCHAR; + category = getTypeCategory(type); + buf.append(category); + switch (type) { + case Types.TIMESTAMP: + case Types.DATE: + fmt = "Y-m-d H:i:s.u"; + break; + case Types.TIME: + fmt = "H:i:s"; + break; + default: + fmt = null; + } + if (fmt != null) { + buf.append("\",dateFormat:\""); + buf.append(fmt); + } + buf.append("\"}"); + } + buf.append(']'); + return buf.toString(); + } + + public static String getColumns(ResultSetMetaData meta, int colCount, + String editorType, boolean rowNumber, boolean dateAsString, + JSONObject keyMap) throws Exception { + int i, k, len, type, editor; + boolean isText, isBlob, isMap; + String field, name, validator, renderer; + StringBuilder buf = new StringBuilder(); + + if (editorType.equals("editable")) + editor = 1; + else if (editorType.equals("readOnly")) + editor = 2; + else + editor = 0; + buf.append('['); + if (rowNumber) + buf + .append("{width:45,sortable:false,hideable:false,type:\"rowNumber\",renderer:\"Wb.nr\",align:\"right\"}"); + for (i = 0; i < colCount; i++) { + if (rowNumber || i > 0) + buf.append(','); + field = meta.getColumnLabel(i + 1); + if (StringUtil.isEmpty(field)) + field = "FIELD" + Integer.toString(i + 1); + name = StringUtil.quote(field); + buf.append("{dataIndex:"); + buf.append(name); + buf.append(",header:"); + buf.append(name); + isMap = keyMap != null && keyMap.has(field); + if (isMap) + type = Types.VARCHAR; + else + type = meta.getColumnType(i + 1); + isText = isTextField(type); + isBlob = isBlobField(type); + renderer = "Wb.htmlRender"; + validator = ""; + if (isMap) + len = 20; + else if (isText) + len = 25; + else if (isBlob) + len = 6; + else + len = meta.getColumnDisplaySize(i + 1); + switch (type) { + case Types.TIMESTAMP: + case Types.DATE: + if (editor == 1) + validator = "Wb.tsValidator"; + if (!dateAsString) + renderer = "Wb.dateRender"; + len = 18; + break; + case Types.TIME: + if (editor == 1) + validator = "Wb.tmValidator"; + if (!dateAsString) + renderer = "Wb.timeRender"; + len = 10; + break; + case Types.BIGINT: + case Types.INTEGER: + case Types.SMALLINT: + case Types.TINYINT: + case Types.DECIMAL: + case Types.DOUBLE: + case Types.FLOAT: + case Types.NUMERIC: + case Types.REAL: + buf.append(",align:\"right\""); + if (editor == 1) + validator = "Wb.numValidator"; + break; + } + if (editor == 1 && isBlob) + buf.append(",renderer:\"Wb.downRender('" + field + "')\""); + else { + buf.append(",renderer:"); + buf.append(StringUtil.quote(renderer)); + } + buf.append(",sortable:true,width:"); + k = name.length() - 1; + if (len < k) + len = k; + if (len < 5) + len = 5; + if (len > 25) + len = 25; + buf.append(len * 9); + if (editor > 0 && !isBlob) { + buf.append(",editor:{xtype:\""); + if (isText) + buf.append("textarea\",height:100"); + else + buf.append("textfield\""); + if (meta.isNullable(i + 1) == ResultSetMetaData.columnNoNulls) + buf.append(",allowBlank:false"); + if (isMap || isBlob || editor == 2 || meta.isReadOnly(i + 1)) + buf + .append(",readOnly:true,fieldStyle:\"background-image:none;background-color:#C0C0C0\""); + if (!validator.isEmpty()) { + buf.append(",validator:"); + buf.append(validator); + } + buf.append('}'); + } + buf.append('}'); + } + buf.append(']'); + return buf.toString(); + } + + + + public static void exportData(Writer writer, ResultSet rs) throws Exception { +// ResultSetMetaData meta = rs.getMetaData(); +// int i, j = meta.getColumnCount(), ct = 0, types[] = new int[j]; +// +// writer.write("[["); +// for (i = 0; i < j; i++) { +// types[i] = meta.getColumnType(i + 1); +// if (i > 0) +// writer.write(','); +// writer.write(meta.getColumnName(i + 1)); +// } +// writer.write(']'); +// while (rs.next()) { +// writer.write(",["); +// for (i = 0; i < j; i++) { +// if (i > 0) +// writer.write(','); +// writer.write(StringUtil.encode(DbUtil.getObject(rs, i + 1, +// types[i], false))); +// } +// writer.write(']'); +// ct++; +// } +// writer.write(']'); +// writer.flush(); + } + +// public static String getArray(ResultSet rs) throws Exception { +// StringBuilder buf = new StringBuilder(); +// ResultSetMetaData meta = rs.getMetaData(); +// int i, j = meta.getColumnCount(), ct = 0, types[] = new int[j], limit = Var +// .getInt("webbuilder.control.limitRecords"); +// boolean isFirst = true; +// +// for (i = 0; i < j; i++) +// types[i] = meta.getColumnType(i + 1); +// buf.append('['); +// while (rs.next()) { +// if (ct > limit) +// break; +// if (isFirst) +// isFirst = false; +// else +// buf.append(','); +// if (j > 1) { +// buf.append('['); +// for (i = 0; i < j; i++) { +// if (i > 0) +// buf.append(','); +// buf.append(StringUtil.encode(DbUtil.getObject(rs, i + 1, +// types[i], true))); +// } +// buf.append(']'); +// } else +// buf.append(StringUtil.encode(DbUtil.getObject(rs, 1, types[0], +// true))); +// ct++; +// } +// buf.append(']'); +// return buf.toString(); +// } + + public static String getCharStream(ResultSet rs, int index) + throws Exception { + return (String) getObject(rs, index, -1); + } + + public static void setCharStream(PreparedStatement st, int index, + String value) throws Exception { + setObject(st, index, -1, value); + } + + public static Object getObject(CallableStatement st, int index, int type) + throws Exception { + switch (type) { + case Types.CHAR: + case Types.NCHAR: + case Types.VARCHAR: + case Types.NVARCHAR: + return st.getString(index); + case Types.INTEGER: + return st.getInt(index); + case Types.TINYINT: + return st.getByte(index); + case Types.SMALLINT: + return st.getShort(index); + case Types.BIGINT: + return st.getLong(index); + case Types.REAL: + case Types.FLOAT: + return st.getFloat(index); + case Types.DOUBLE: + return st.getDouble(index); + case Types.DECIMAL: + case Types.NUMERIC: + return st.getBigDecimal(index); + case Types.TIMESTAMP: + case Types.DATE: + return st.getTimestamp(index); + case Types.TIME: + return st.getTime(index); + case Types.BOOLEAN: + case Types.BIT: + return st.getBoolean(index); + case Types.LONGVARCHAR: + case Types.LONGNVARCHAR: + case Types.CLOB: + case Types.NCLOB: + Reader rd = st.getCharacterStream(index); + if (rd == null) + return null; + else + return StringUtil.readString(rd); + default: + return st.getObject(index); + } + } + + public static Object getObject(ResultSet rs, int index, int type) + throws Exception { + return getObject(rs, index, type, true); + } + + public static Object getObject(ResultSet rs, int index, int type, + boolean ignoreBlob) throws Exception { + Object obj; + switch (type) { + case Types.CHAR: + case Types.NCHAR: + case Types.VARCHAR: + case Types.NVARCHAR: + obj = rs.getString(index); + break; + case Types.INTEGER: + obj = rs.getInt(index); + break; + case Types.TINYINT: + obj = rs.getByte(index); + break; + case Types.SMALLINT: + obj = rs.getShort(index); + break; + case Types.BIGINT: + obj = rs.getLong(index); + break; + case Types.REAL: + case Types.FLOAT: + obj = rs.getFloat(index); + break; + case Types.DOUBLE: + obj = rs.getDouble(index); + break; + case Types.DECIMAL: + case Types.NUMERIC: + obj = rs.getBigDecimal(index); + break; + case Types.TIMESTAMP: + case Types.DATE: + obj = rs.getTimestamp(index); + break; + case Types.TIME: + obj = rs.getTime(index); + break; + case Types.BOOLEAN: + case Types.BIT: + obj = rs.getBoolean(index); + break; + case Types.LONGVARCHAR: + case Types.LONGNVARCHAR: + case Types.CLOB: + case Types.NCLOB: + Reader rd = rs.getCharacterStream(index); + if (rd == null) + obj = null; + else + obj = StringUtil.readString(rd); + break; + case Types.BLOB: + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + InputStream is = rs.getBinaryStream(index); + if (ignoreBlob) { + if (is == null) + return "(blob)"; + else { + is.close(); + return "(BLOB)"; + } + } else + return is; + default: + obj = rs.getObject(index); + } + if (rs.wasNull()) + return null; + else + return obj; + } + + public static void setObject(PreparedStatement st, int index, int type, + Object obj) throws Exception { + if (obj != null && !(obj instanceof String)) { + if (obj instanceof InputStream) + st.setBinaryStream(index, (InputStream) obj, + ((InputStream) obj).available()); + else if (obj instanceof DateTime) + st.setLong(index, ((DateTime)obj).getMillis()); + else { + if (type != 12) + st.setObject(index, obj, type); + else + st.setObject(index, obj); + } + return; + } + String value; + + if (obj == null) + value = null; + else + value = (String) obj; + if (StringUtil.isEmpty(value)) + st.setNull(index, type); + else { + switch (type) { + case Types.CHAR: + case Types.NCHAR: + case Types.VARCHAR: + case Types.NVARCHAR: + st.setString(index, value); + break; + case Types.INTEGER: + st.setInt(index, Integer.parseInt(value)); + break; + case Types.TINYINT: + st.setByte(index, Byte.parseByte(value)); + break; + case Types.SMALLINT: + st.setShort(index, Short.parseShort(value)); + break; + case Types.BIGINT: + st.setLong(index, Long.parseLong(value)); + break; + case Types.REAL: + case Types.FLOAT: + st.setFloat(index, Float.parseFloat(value)); + break; + case Types.DOUBLE: + st.setDouble(index, Double.parseDouble(value)); + break; + case Types.DECIMAL: + case Types.NUMERIC: + st.setBigDecimal(index, new BigDecimal(value)); + break; + case Types.TIMESTAMP: + case Types.DATE: + st.setLong(index, Long.parseLong(value)); + break; + case Types.TIME: + st.setTime(index, Time.valueOf(fixTime(value))); + break; + case Types.BOOLEAN: + case Types.BIT: + st.setBoolean(index, StringUtil.getBool(value)); + break; + case Types.LONGVARCHAR: + case Types.LONGNVARCHAR: + case Types.CLOB: + case Types.NCLOB: + st.setCharacterStream(index, new StringReader(value), value + .length()); + break; + case Types.BLOB: + case Types.BINARY: + case Types.VARBINARY: +// case Types.LONGVARBINARY: +// InputStream is = new ByteArrayInputStream(StringUtil +// .decodeBase64(value)); +// st.setBinaryStream(index, is, is.available()); +// break; + default: + st.setObject(index, value, type); + } + } + } + + public static String TO_DATE (DateTime time, boolean dayOnly, Locale local) + { + if (time == null) + { + if (dayOnly) + return "TRUNC(SysDate)"; + return "SysDate"; + } + + StringBuffer dateString = new StringBuffer("'"); + if (dayOnly) + { + dateString.append(time.toString(ExDateUtil.YYYY_MM_DD, local)); + dateString.append("'"); + } + else + { + dateString.append(time.toString(ExDateUtil.YYYY_MM_DD_HH_MM_SS_SS, local)); // cut off miliseconds + dateString.append("'"); + } + return dateString.toString(); + } + + public static String TO_STRING (String txt, int maxLength) + { + if (txt == null || txt.length() == 0) + return "NULL"; + // Length + String text = txt; + if (maxLength != 0 && text.length() > maxLength) + text = txt.substring(0, maxLength); + + // copy characters (we need to look through anyway) + StringBuffer out = new StringBuffer(); + out.append(QUOTE); // ' + for (int i = 0; i < text.length(); i++) + { + char c = text.charAt(i); + if (c == QUOTE) + out.append("''"); + else + out.append(c); + } + out.append(QUOTE); // ' + // + return out.toString(); + } // TO_STRING + + /** Quote */ + private static final char QUOTE = '\''; + + + public static String encodeString(String str) throws Exception { + return StringUtil.replace(URLEncoder.encode(str, "utf-8"), "+", "%20"); + } + + public static int isToOs(InputStream is, OutputStream os) throws Exception { + byte buf[] = new byte[8192]; + int len, size = 0; + + while ((len = is.read(buf)) > 0) { + os.write(buf, 0, len); + size += len; + } + return size; + } + + public static void closeInputStream(InputStream inputStream) { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Throwable e) { + } + } + } + + public static String fixTime(String str) { + if (str.indexOf(':') == -1) + return "00:00:00"; + int b = str.indexOf(' '), e = str.indexOf('.'); + if (b == -1) + b = 0; + if (e == -1) + e = str.length(); + return str.substring(b, e); + } + + public static String fixTimestamp(String str) { + if (str.indexOf(':') == -1) + return qualify(str) + " 00:00:00"; + else { + int i = str.indexOf(' '); + return qualify(str.substring(0, i)) + str.substring(i); + } + } + + private static String qualify(String dateStr) { + if (dateStr.length() == 10) + return dateStr; + String[] sec = StringUtil.split(dateStr, "-"); + if (sec.length == 3) { + StringBuilder buf = new StringBuilder(10); + buf.append(sec[0]); + buf.append("-"); + if (sec[1].length() == 1) + buf.append("0"); + buf.append(sec[1]); + buf.append("-"); + if (sec[2].length() == 1) + buf.append("0"); + buf.append(sec[2]); + return buf.toString(); + } else + return dateStr; + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/util/ExDateUtil.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/ExDateUtil.java new file mode 100644 index 0000000..57e0170 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/ExDateUtil.java @@ -0,0 +1,234 @@ +package com.dsasp.server.common.util; + +import org.joda.time.DateMidnight; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.Days; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; +/** + * Date Utility Class used to convert Strings to Dates and Timestamps to correct + * time pattern. Minutes should be mm not MM (MM is month). + */ +public class ExDateUtil { + public static final String TIME_PATTERN = "HH:mm"; + public static final String YYYY_MM_DD_HH_MM_SS_SS = "yyyy-MM-dd HH:mm:ss.SS"; + public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; + public static final String YYYY_MM_DD = "yyyy-MM-dd"; + public static final String YYYYMMDD = "yyyyMMdd"; + public static final long DAY = 24L * 60L * 60L * 1000L; + /** + * Checkstyle rule: utility classes should not have public constructor + */ + /** + * 返回当前日期+时间 + * YYYY_MM_DD_HH_MM_SS + * @return DateTime 返回该日期 + */ + public final static DateTime getNow(DateTimeZone timezone) { + return new DateTime(timezone); + } + /** + * 返回当前日期+时间(00:00:00) + * YYYY_MM_DD_HH_MM_SS + * @return DateTime 返回该日期 + */ + public final static DateTime getDate(DateTimeZone timezone) { + return new DateMidnight(timezone).toDateTime(); + } + /** + * 返回当前日期+时间 + * YYYY_MM_DD_HH_MM_SS + * @return String 返回该日期的字符串格式 + */ + public final static String getNowTimeByString(DateTimeZone timezone) { + DateTime now = getNow(timezone); + return now.toString(YYYY_MM_DD_HH_MM_SS); + } + /** + * 返回当天的开始日期+时间 + * YYYY_MM_DD_HH_MM_SS + * @return DateTime 返回该日期 + */ + public final static DateTime getStartTimeOfDay(DateTimeZone timezone){ + return new DateMidnight(timezone).toDateTime(); + } + /** + * 返回当天的开始日期+时间(00:00:00) + * YYYY_MM_DD_HH_MM_SS + * @return String 返回该日期的字符串格式 + */ + public final static String getStartTimeOfDayByString(DateTimeZone timezone){ + DateTime start = getStartTimeOfDay(timezone); + return start.toString(YYYY_MM_DD_HH_MM_SS); + } + /** + * 返回当天的最后日期+时间(23:59:59) + * YYYY_MM_DD_HH_MM_SS + * @return String 返回该日期 + */ + public final static DateTime getEndTimeOfDay(DateTimeZone timezone){ + DateTime now = getStartTimeOfDay(timezone); + DateTime end = now.plusDays(1).plus(-1000); + return end; + } + /** + * 返回指定日期的月份第一天 + */ + public final static DateTime getStartDayOfMonth(DateTime date) { + if (date == null) { + return null; + } + return new DateTime(date.getYear(), date.getMonthOfYear(), 1, 0, 0, 0); + } + /** + * 返回指定日期的月份最后一天 + */ + public final static DateTime getEndDayOfMonth(DateTime date) { + if (date == null) + return null; + DateTime dt = getStartDayOfMonth(date);// 所在月第一天 + dt = dt.plusMonths(1);// 所在月的下一个月第一天 + return dt.plusDays(-1); + } + /** + * 返回指定日期的年 + * @return Integer 返回年 + */ + public final static Integer getYear(DateTime date){ + if (date == null) + return null; + return date.getYear(); + } + /** + * 返回指定日期的月份 + * @return Integer 返回月份 + */ + public final static Integer getMonth(DateTime date){ + if (date == null) + return null; + return date.getMonthOfYear(); + } + /** + * 返回指定日期的当月日期 + * @return Integer 返回当月日期 + */ + public final static Integer getDay(DateTime date){ + if (date == null) + return null; + return date.getDayOfMonth(); + } + /** + * 给指定的日期注入一个结束时间23:59:59 + * @param date + * @return Date + */ + public final static DateTime innerEndTimeOfDay(DateTime date){ + if (date == null) + return null; + DateTime newDate = innerStartTimeOfDay(date); + return newDate.plusDays(1).plus(-1000); + } + /** + * 给指定的日期注入一个开始时间00:00:00 + * @param date + * @return Date + */ + public final static DateTime innerStartTimeOfDay(DateTime date) { + if (date == null) { + return null; + } + DateMidnight md = new DateMidnight(date.getMillis(), date.getZone()); + return md.toDateTime(); + } + /** + * 返回当天的最后日期+时间 + * @return String 返回该日期的字符串格式(yyyy-MM-dd HH:mm:ss) + */ + public final static String getEndTimeOfDayByString(DateTimeZone timezone) { + DateTime date = getEndTimeOfDay(timezone); + return date.toString(YYYY_MM_DD_HH_MM_SS); + } + /** + * 转换指定的时间字符串为指定的格式的时间 + * @param date + * @param pattern + * @return 格式化后的时间 + */ + public final static DateTime convertStringTodate(String date, String pattern) { + if (date == null || pattern == null) + return null; + DateTimeFormatter format = DateTimeFormat.forPattern(pattern); + return DateTime.parse(date, format); + } + /** + * 转换指定的时间为指定的格式的时间字符串 + * @param date + * @param pattern + * @return 格式化后的时间字符串 + */ + public final static String convertDateToString(DateTime date, String pattern) + { + if (date == null || pattern == null) + return null; + return date.toString(pattern); + } + + /** + * 比较2个日期,返回相差天数 + * @param from 被减数 + * @param to 减数 + * @return int 天数 + */ + public final static int compareDate(DateTime from,DateTime to){ + return Days.daysBetween(from, to).getDays(); + } + + /** + * 时间转换显示星期 + * @param date + * @return + */ + public final static String convertDateToWeek(DateTime date){ + if (date == null) + return null; + int day = date.getDayOfWeek(); + String showWeek = ""; + switch (day) { + case 1: + showWeek = "星期一"; + break; + case 2: + showWeek = "星期二"; + break; + case 3: + showWeek = "星期三"; + break; + case 4: + showWeek = "星期四"; + break; + case 5: + showWeek = "星期五"; + break; + case 6: + showWeek = "星期六"; + break; + default: + showWeek = "星期日"; + break; + } + return showWeek; + } + + public static void main(String[] args) { +// DateTime dt = new DateTime(2013,9,25,11,12,0); +// DateMidnight md = new DateMidnight(dt.getMillis(),dt.getZone()); +// System.out.println(dt); +// System.out.println(md.toDateTime()); +// System.out.println(getEndTimeOfDay(DateTimeZone.UTC)); +// System.out.println(innerEndTimeOfDay(new DateTime())); +// System.out.println(convertDateToWeek(new DateTime())); +// System.out.println(compareDate(new DateTime(2013,8,30,0,0,0),new DateTime())); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/util/StringUtil.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/StringUtil.java new file mode 100644 index 0000000..b016332 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/StringUtil.java @@ -0,0 +1,809 @@ +package com.dsasp.server.common.util; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.Reader; +import java.text.CollationKey; +import java.text.Collator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; + +import org.joda.time.DateTime; + +public class StringUtil { + private static final String HexCharSet = "0123456789ABCDEF"; + + /** + * ASCII表中可见字符从!开始,偏移位值为33(Decimal) + */ + private static final char DBC_CHAR_START = 33; // 半角! + /** + * ASCII表中可见字符到~结束,偏移位值为126(Decimal) + */ + private static final char DBC_CHAR_END = 126; // 半角~ + /** + * 全角对应于ASCII表的可见字符从!开始,偏移值为65281 + */ + private static final char SBC_CHAR_START = 65281; // 全角! + /** + * 全角对应于ASCII表的可见字符到~结束,偏移值为65374 + */ + private static final char SBC_CHAR_END = 65374; // 全角~ + /** + * ASCII表中除空格外的可见字符与对应的全角字符的相对偏移 + */ + private static final int CONVERT_STEP = 65248; // 全角半角转换间隔 + /** + * 全角空格的值,它没有遵从与ASCII的相对偏移,必须单独处理 + */ + private static final char SBC_SPACE = 12288; // 全角空格 12288 + /** + * 半角空格的值,在ASCII中为32(Decimal) + */ + private static final char DBC_SPACE = ' '; // 半角空格 + + /** + * 半角字符->全角字符转换 + * 只处理空格,!到˜之间的字符,忽略其他 + */ + public static String banjiaoToQuanjiao(String src) { + if (src == null) + return src; + char[] ca = src.toCharArray(); + char[] buf = new char[ca.length]; + for (int i = 0; i < ca.length; i++) { + if (ca[i] == DBC_SPACE) //半角空格 + buf[i] = SBC_SPACE; + else if ((ca[i] >= DBC_CHAR_START) && (ca[i] <= DBC_CHAR_END))//!到~ + buf[i] = (char) (ca[i] + CONVERT_STEP); + else + buf[i] = ca[i]; + } + return new String(buf); + } + + /** + * 全角字符->半角字符转换 + * 只处理全角的空格,全角!到全角~之间的字符,忽略其他 + */ + public static String quanjiaoToBanjiao(String src) { + if (src == null) + return src; + char[] ca = src.toCharArray(); + char[] buf = new char[ca.length]; + for (int i = 0; i < src.length(); i++) { + if (ca[i] >= SBC_CHAR_START && ca[i] <= SBC_CHAR_END)//全角!到~ + buf[i] = (char) (ca[i] - CONVERT_STEP); + else if (ca[i] == SBC_SPACE)//全角空格 + buf[i] = DBC_SPACE; + else + buf[i] = ca[i]; + } + return new String(buf); + } + + public static String[] sort(List list) { + String[] sl = list.toArray(new String[list.size()]); + return StringUtil.sort(sl); + } + + public static String[] sort(String[] list) { + Arrays.sort(list, new Comparator() { + Collator collator = Collator.getInstance(); + + public int compare(String s1, String s2) { + CollationKey key1 = collator.getCollationKey(optString(s1) + .toLowerCase()); + CollationKey key2 = collator.getCollationKey(optString(s2) + .toLowerCase()); + return key1.compareTo(key2); + } + }); + return list; + } + + public static String duplicate(String text, int count) { + StringBuilder buf = new StringBuilder(); + int i; + + for (i = 0; i < count; i++) + buf.append(text); + return buf.toString(); + } + + public static String[] getList(String... args) { + String r[] = new String[args.length]; + int i = 0; + + for (String s : args) + r[i++] = s; + return r; + } + + public static String[] split(String string, String separator) { + String[] result; + if (isEmpty(string)) { + result = new String[1]; + result[0] = ""; + return result; + } + result = new String[stringOccur(string, separator) + 1]; + int oldPos = 0, pos = 0, count = 0, len = separator.length(); + while (pos != -1) { + pos = string.indexOf(separator, oldPos); + if (pos != -1) { + result[count++] = string.substring(oldPos, pos); + pos += len; + oldPos = pos; + } + } + result[count] = string.substring(oldPos); + return result; + } + + public static boolean isSame(String string1, String string2) { + String s1, s2; + + if (string1 == null) + s1 = ""; + else + s1 = string1; + if (string2 == null) + s2 = ""; + else + s2 = string2; + return s1.equalsIgnoreCase(s2); + } + + public static boolean isEqual(String string1, String string2) { + String s1, s2; + + if (string1 == null) + s1 = ""; + else + s1 = string1; + if (string2 == null) + s2 = ""; + else + s2 = string2; + return s1.equals(s2); + } + + public static String toHTML(String string) { + return toHTML(string, false, true); + } + + public static String convertHTML(String string) { + if (isEmpty(string)) + return ""; + int i, j = string.length(); + StringBuilder out = new StringBuilder(); + char c; + + for (i = 0; i < j; i++) { + c = string.charAt(i); + switch (c) { + case '&': + out.append("&"); + break; + case '>': + out.append(">"); + break; + case '<': + out.append("<"); + break; + default: + out.append(c); + } + } + return out.toString(); + } + + public static String toHTML(String string, boolean nbspAsEmpty, + boolean brAsEnter) { + if (isEmpty(string)) { + if (nbspAsEmpty) + return " "; + else + return ""; + } + int i, j = string.length(); + StringBuilder out = new StringBuilder(); + char c; + + for (i = 0; i < j; i++) { + c = string.charAt(i); + switch (c) { + case ' ': + out.append(" "); + break; + case '"': + out.append("""); + break; + case '<': + out.append("<"); + break; + case '>': + out.append(">"); + break; + case '&': + out.append("&"); + break; + case '\n': + if (brAsEnter) + out.append("
    "); + else + out.append(" "); + break; + case '\r': + break; + case '\t': + out.append("    "); + break; + default: + out.append(c); + } + } + return out.toString(); + } + + public static boolean across(String[] list1, String[] list2) { + if (list1 == null || list2 == null) + return false; + for (String s1 : list1) + for (String s2 : list2) + if (s1.equals(s2)) + return true; + return false; + } + + public static int indexOf(String list[], String string) { + int i, j; + + if (list == null) + return -1; + j = list.length; + for (i = 0; i < j; i++) + if (list[i].equals(string)) + return i; + return -1; + } + + public static String concat(String s, String... more) { + StringBuilder buf = new StringBuilder(s); + for (String t : more) + buf.append(t); + return buf.toString(); + } + + public static boolean getBool(String value) { + return isEqual(value, "1") || isSame(value, "true"); + } + + public static int stringOccur(String source, String dest) { + if (isEmpty(source) || isEmpty(dest)) + return 0; + int pos = 0, count = 0; + while (pos != -1) { + pos = source.indexOf(dest, pos); + if (pos != -1) { + pos++; + count++; + } + } + return count; + } + + public static boolean isNumeric(String string, boolean decimal) { + int i, j; + String ts; + char ch; + + ts = string.trim(); + if (decimal && stringOccur(string, ".") > 1) + return false; + if (ts.length() > 1 && isEqual(ts.substring(0, 1), "-")) + ts = ts.substring(1); + j = ts.length(); + if (j == 0) + return false; + for (i = 0; i < j; i++) { + ch = ts.charAt(i); + if (!(ch >= '0' && ch <= '9') && (!decimal || ch != '.')) + return false; + } + return true; + } + + public static String toLine(String string) { + if (string == null) + return ""; + string = string.trim(); + int i, len = string.length(); + if (len == 0) + return ""; + StringBuilder buffer = new StringBuilder(); + char c; + for (i = 0; i < len; i++) { + c = string.charAt(i); + switch (c) { + case '\n': + case '\r': + case '\t': + buffer.append(' '); + break; + default: + buffer.append(c); + } + } + return buffer.toString(); + } + + public static List> sortMapValue(Map map) { + List> list = new ArrayList>( + map.entrySet()); + Collections.sort(list, new Comparator>() { + Collator collator = Collator.getInstance(); + + public int compare(Entry e1, Entry e2) { + CollationKey key1 = collator.getCollationKey(e1.getValue() + .toString().toLowerCase()); + CollationKey key2 = collator.getCollationKey(e2.getValue() + .toString().toLowerCase()); + return key1.compareTo(key2); + } + }); + return list; + } + + public static List> sortMapKey(Map map) { + return sortMapKey(map, false); + } + + public static List> sortMapKey(Map map, + boolean keyAsNumber) { + List> list = new ArrayList>( + map.entrySet()); + final boolean keyAsNum = keyAsNumber; + Collections.sort(list, new Comparator>() { + Collator collator = Collator.getInstance(); + + public int compare(Entry e1, Entry e2) { + if (keyAsNum) + return Integer.parseInt(e1.getKey()) + - Integer.parseInt(e2.getKey()); + else { + CollationKey key1 = collator.getCollationKey(e1.getKey() + .toLowerCase()); + CollationKey key2 = collator.getCollationKey(e2.getKey() + .toLowerCase()); + return key1.compareTo(key2); + } + } + }); + return list; + } + + public static String getNamePart(String string) { + if (string == null) + return ""; + int index = string.indexOf('='); + + if (index == -1) + return string; + else + return string.substring(0, index); + } + + public static String getValuePart(String string) { + if (string == null) + return ""; + int index = string.indexOf('='); + + if (index == -1) + return ""; + else + return string.substring(index + 1); + } + + // public static String replaceParameters(HttpServletRequest request, + // String text) throws Exception { + // int start = 0, startPos = text.indexOf("{#", start), endPos = text + // .indexOf("#}", startPos + 2); + // if (startPos != -1 && endPos != -1) { + // String prefix, paramName, paramValue; + // StringBuilder buf = new StringBuilder(); + // + // while (startPos != -1 && endPos != -1) { + // paramName = text.substring(startPos + 2, endPos); + // prefix = substring(paramName, 0, 4); + // if (prefix.equals("Var.")) { + // paramValue = Var.get(paramName.substring(4)); + // if (paramValue == null) + // paramValue = ""; + // } else if (prefix.equals("Str.")) + // paramValue = Str.format(request, paramName.substring(4)); + // else + // paramValue = WebUtil.fetch(request, paramName); + // buf.append(text.substring(start, startPos)); + // buf.append(paramValue); + // start = endPos + 2; + // startPos = text.indexOf("{#", start); + // endPos = text.indexOf("#}", startPos + 2); + // } + // buf.append(text.substring(start)); + // return buf.toString(); + // } else + // return text; + // } + + public static String replace(String string, String oldString, + String newString) { + return innerReplace(string, oldString, newString, true); + } + + public static String replaceFirst(String string, String oldString, + String newString) { + return innerReplace(string, oldString, newString, false); + } + + public static String substring(String string, int pos, int len) { + if (string == null || string.length() < len - pos) + return ""; + return string.substring(pos, pos + len); + } + + public static String joinArray(String list[], String spliter) { + StringBuilder buf = new StringBuilder(); + boolean isFirst = true; + + for (String s : list) { + if (isFirst) + isFirst = false; + else + buf.append(spliter); + buf.append(s); + } + return buf.toString(); + } + + public static String joinList(Iterable list, String spliter) { + StringBuilder buf = new StringBuilder(); + boolean isFirst = true; + + for (String s : list) { + if (isFirst) + isFirst = false; + else + buf.append(spliter); + buf.append(s); + } + return buf.toString(); + } + + public static String getUtfString(InputStream stream) throws Exception { + return getString(stream, "utf-8"); + } + + // public static String getString(InputStream stream) throws Exception { + // return getString(stream, Var.get("server.charset")); + // } + + public static String getString(InputStream stream, String charset) + throws Exception { + try { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + // SysUtil.isToOs(stream, os); + if (StringUtil.isEmpty(charset)) + return new String(os.toByteArray()); + else + return new String(os.toByteArray(), charset); + } finally { + stream.close(); + } + } + + private static String innerReplace(String string, String oldString, + String newString, boolean isAll) { + if (string == null) + return ""; + int index = string.indexOf(oldString); + if (index == -1) + return string; + int start = 0, len = oldString.length(); + if (len == 0) + return string; + StringBuilder buffer = new StringBuilder(string.length() + len); + do { + buffer.append(string.substring(start, index)); + buffer.append(newString); + start = index + len; + if (!isAll) + break; + index = string.indexOf(oldString, start); + } while (index != -1); + buffer.append(string.substring(start)); + return buffer.toString(); + } + + public static String quote(String string) { + if (string == null) + return "\"\""; + int len = string.length(); + if (len == 0) + return "\"\""; + char b, c = 0; + int i; + String t; + StringBuilder sb = new StringBuilder(len + 4); + + sb.append('"'); + for (i = 0; i < len; i++) { + b = c; + c = string.charAt(i); + switch (c) { + case '\\': + case '"': + sb.append('\\'); + sb.append(c); + break; + case '/': + if (b == '<') + sb.append('\\'); + sb.append(c); + break; + case '\b': + sb.append("\\b"); + break; + case '\t': + sb.append("\\t"); + break; + case '\n': + sb.append("\\n"); + break; + case '\f': + sb.append("\\f"); + break; + case '\r': + sb.append("\\r"); + break; + default: + if (c < ' ' || (c >= '\u0080' && c < '\u00a0') + || (c >= '\u2000' && c < '\u2100')) { + t = "000" + Integer.toHexString(c); + sb.append("\\u"); + sb.append(t.substring(t.length() - 4)); + } else + sb.append(c); + } + } + sb.append('"'); + return sb.toString(); + } + + public static String[] merge(String[] list1, String[] list2) { + int l = list1.length, i, j = l + list2.length; + String[] list = new String[j]; + for (i = 0; i < j; i++) { + if (i < l) + list[i] = list1[i]; + else + list[i] = list2[i - l]; + } + return list; + } + + public static String optString(String s) { + if (s == null) + return ""; + else + return s; + } + + /** + * 判断对象是否为空。“”也认为空 + * 对于String类型将先去除左右空格再判断 + */ + public static boolean empty(Object s) { + if (s == null) + return true; + if (s instanceof String) + return ((String) s).trim().length() == 0; + return false; + } + + /** + * 不去空格的是否为空判断方法 + */ + public static boolean isEmpty(String string) { + return string == null || string.length() == 0; + } + + public static String byteToHex(byte[] bs) { + StringBuilder buf = new StringBuilder(bs.length * 2); + String s; + for (byte b : bs) { + s = Integer.toHexString(b & 0XFF); + if (s.length() == 1) + buf.append('0'); + buf.append(s); + } + return buf.toString().toUpperCase(); + } + + public static byte[] hexToByte(String s) { + int i, j = s.length() / 2, k; + char[] b = s.toCharArray(); + byte[] d = new byte[j]; + + for (i = 0; i < j; i++) { + k = i * 2; + d[i] = (byte) (HexCharSet.indexOf(b[k]) << 4 | HexCharSet + .indexOf(b[k + 1])); + } + return d; + } + + // public static String encodeBase64(InputStream is) throws Exception { + // OutputStream eos = null; + // ByteArrayOutputStream bos1, bos2; + // + // try { + // bos1 = new ByteArrayOutputStream(); + // bos2 = new ByteArrayOutputStream(); + // SysUtil.isToOs(is, bos1); + // eos = MimeUtility.encode(bos2, "base64"); + // eos.write(bos1.toByteArray()); + // } finally { + // is.close(); + // if (eos != null) + // eos.close(); + // } + // return new String(bos2.toByteArray()); + // } + // + // public static byte[] decodeBase64(String data) throws Exception { + // ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes()); + // ByteArrayOutputStream os = new ByteArrayOutputStream(); + // InputStream bis; + // + // bis = MimeUtility.decode(is, "base64"); + // try { + // SysUtil.isToOs(bis, os); + // } finally { + // bis.close(); + // } + // return os.toByteArray(); + // } + // + // public static String encode(Object obj) throws Exception { + // if (obj == null) + // return "null"; + // else { + // if (obj instanceof InputStream) + // return quote(encodeBase64((InputStream) obj)); + // if (obj instanceof Number || obj instanceof Boolean) + // return obj.toString(); + // else + // return quote(obj.toString()); + // } + // } + + public static String readString(Reader reader) throws Exception { + char buf[] = new char[8192]; + StringBuilder sb = new StringBuilder(); + int len; + + while ((len = reader.read(buf)) > 0) { + sb.append(buf, 0, len); + } + return sb.toString(); + } + + public static String TO_DATE(DateTime time, boolean dayOnly, Locale local) { + if (time == null) { + if (dayOnly) + return "TRUNC(SysDate)"; + return "SysDate"; + } + + StringBuffer dateString = new StringBuffer("'"); + if (dayOnly) { + dateString.append(time.toString(ExDateUtil.YYYY_MM_DD, local)); + dateString.append("'"); + } else { + dateString.append(time.toString(ExDateUtil.YYYY_MM_DD_HH_MM_SS_SS, + local)); // cut off miliseconds + dateString.append("'"); + } + return dateString.toString(); + } + + public static String TO_STRING(String txt, int maxLength) { + if (txt == null) + return "NULL"; + // Length + String text = txt; + if (maxLength != 0 && text.length() > maxLength) + text = txt.substring(0, maxLength); + + // copy characters (we need to look through anyway) + StringBuffer out = new StringBuffer(); + out.append(QUOTE); // ' + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (c == QUOTE) + out.append("''"); + else + out.append(c); + } + out.append(QUOTE); // ' + // + return out.toString(); + } // TO_STRING + + public static String convertSplitStrToSql(String txt) { + if (txt == null || !txt.contains(",")) { + return TO_STRING(txt, 0); + } else { + String[] splitStrs = txt.split(","); + StringBuffer re = new StringBuffer(); + for (String str : splitStrs) { + re.append(TO_STRING(str, 0)); + re.append(","); + } + re.deleteCharAt(re.length() - 1); + return re.toString(); + } + } + + public static String convertListStrToSql(List list) { + if (list == null || list.size() == 0) { + return "''"; + } else { + + StringBuffer re = new StringBuffer(); + for (String str : list) { + re.append(TO_STRING(str, 0)); + re.append(","); + } + re.deleteCharAt(re.length() - 1); + return re.toString(); + } + } + + /** + * content xml toString , get attributes value list name="value", "=" before + * and after is not space + * + * @param content + * @param keyName + * @return + */ + public static List getKeyValue(String content, String keyName) { + List list = new ArrayList(); + int index = 0; + while (index != -1 && !StringUtil.isEmpty(content)) { + index = content.indexOf(keyName + "=\""); + if (index != -1) { + content = content.substring(index + keyName.length() + 2); + index = content.indexOf("\""); + if (index > 0) { + list.add(content.substring(0, index)); + } + } else { + break; + } + + } + return list; + } + + private static final char QUOTE = '\''; +} \ No newline at end of file diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/util/UserSession.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/UserSession.java new file mode 100644 index 0000000..571ef30 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/util/UserSession.java @@ -0,0 +1,56 @@ +package com.dsasp.server.common.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import com.dsasp.server.common.dataDic.bean.SysConfig; +import com.dsasp.server.common.user.service.LoggedInUser; + + + +/** + * 用ThreadLocal提供一个存储线程内变量的地方. + *

    + * 客户端代码可以用静态方法存储和获取线程内变量,不需要依赖于HttpSession. + * web层的Controller可通过此处向business层传入user之类的变量 + * + * @author + */ +public class UserSession { + private static final ThreadLocal sessionMap = new ThreadLocal(){ + protected Properties initialValue() { return (null);} + }; + private static Properties admin; + + private static int count = 0; + + public static Properties getAdmin(){ + if(admin == null){ + admin = new Properties(); + admin.setProperty(LoggedInUser.CURRENTUSER, LoggedInUser.ADMIN); + List roles = new ArrayList(); + roles.add(LoggedInUser.ADMIN); + admin.put(LoggedInUser.ROLES, roles); + } + return admin; + } + + public static Properties get() { +// System.out.println(" 当前获取线程 " + Thread.currentThread().getId()); + return(Properties) sessionMap.get(); + } + + public static void set(Properties user) { + sessionMap.set(user); + } + + public static void remove() { + sessionMap.remove(); + } + + public static String getCompanyName() { + + return SysConfig.getConfigValue("com.dsasp.server.organize.COMPANY"); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/viewframework/service/ProjectSwitchService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/viewframework/service/ProjectSwitchService.java new file mode 100644 index 0000000..88f28f3 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/viewframework/service/ProjectSwitchService.java @@ -0,0 +1,12 @@ +package com.dsasp.server.common.viewframework.service; + +import java.util.Map; + +public interface ProjectSwitchService { + + public boolean isUserInProjects(String userId); + + public Map findAllProjectByUserId(String userId); + + public String getProjectOrgId(String projectId); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/bean/WFProcessInstance.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/bean/WFProcessInstance.java new file mode 100644 index 0000000..8b2bca5 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/bean/WFProcessInstance.java @@ -0,0 +1,23 @@ +package com.dsasp.server.common.workflow.bean; + +public interface WFProcessInstance { + + public String getProcessInstanceId(); + + public String getTitle(); + + public String getName(); + + public String getIniator(); + + public String getIniatorTime(); + + public String getStatusDisplay(); + + public Integer getStatus(); + + public String getEndTime(); + + public boolean isEnd(); + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/service/ProcessCoreService.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/service/ProcessCoreService.java new file mode 100644 index 0000000..fe2398a --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/workflow/service/ProcessCoreService.java @@ -0,0 +1,139 @@ +package com.dsasp.server.common.workflow.service; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.joda.time.DateTime; + +import com.dsasp.server.common.workflow.bean.WFProcessInstance; + +public interface ProcessCoreService { + + public static final String INITIATORUSERID = "WFINITIATORUSERID"; + public static final String INITIATORDEPARTID = "WFINITIATORDEPARTID"; + public static final String FORMKEYID = "WFFORMKEYID"; + public static final String TABLENAME = "TABLENAME"; + public static final String PROCESSTITLE = "PROCESSTITLE"; + public static final String PROCESSTASKTYPE= "PROCESSTASKTYPE"; + public static final String PROJECTID = "PROJECTID"; + + public static final String NEED_VALIDATE = "NEED_VALIDATE"; + + public static final int STATUS_NOSUBMIT = 1; + public static final int STATUS_PROCESSING = 2; + public static final int STATUS_PASS = 3; + public static final int STATUS_NOPASS = 4; + public static final int STATUS_RESUBMIT = 5; + public static final int STATUS_INVALID = 6; + + + public boolean startWF(String processDefinitionKey, Map variables, String businessKey, Properties ctx); + + public boolean startWorkflow(String processDefinitionKey, Map variables, String tableName, String businessKey, Properties ctx); + + + public boolean reSubmit(String processDefinitionKey, Map variables, String businessKey, Properties ctx); + + + + public void passProcess(String taskId, Map variables, String description) + throws Exception; + + + public void backProcess(String taskId, String activityId, + Map variables, boolean isStart, String description) throws Exception; + + public List backProcessBath(List> protaskList) throws Exception; + + public void activebackProcess(String taskId, String activityId, + Map variables, Boolean isStart, String description) throws Exception; + + + public void callBackProcess(String taskId, String activityId, String description) + throws Exception ; + + public void endProcess(String taskId, String description) throws Exception; + + + public void transferAssignee(String taskId, List userIds, String description); + + + /** + * 创建子任务 + * @param parentTaskId + * @param userId + * @return + */ + public boolean createSubTask(String parentTaskId, List userIds, String description); + + /** + * 创建与本任务无关的新任务 + * @param variable + * @param userId + * @return + */ + public boolean createNewTask(String taskId, Map variable, List userIds, String description); + + + /** + * 根据当前任务ID,查询可以驳回的任务节点 + * + * @param taskId + * 当前任务ID + */ + public List findBackAvtivity(String taskId) throws Exception; + + /** + * 根据当前任务ID,查询可以驳回的任务节点 + * + * @param taskId + * 当前任务ID + */ + public List> findBackTaskName(String taskId) throws Exception; + + /** + * 当activity为空时,默认为前一处理者,否则为指定节点处理者 + * @param processInstanceId + * @param activityId + * @return + */ + public String getSpecialActivityProcessor(String processInstanceId, + String activityId) ; + + public List queryHistoricProcessInstance( + String title,String processName, String iniator, DateTime start, DateTime end, + int firstResult, int maxResults,String fz); + + /** + * 更换审批人 + * @param taskId + * @param oldAssignee + * @param userCodes + * @param description + */ + public void changeAssignee(String taskId, List userCodes, + String description); + + /** + * 根据业务主键获取流程实例Id + */ + public String getProcessInstanceIdByBusinessKey(String businessKey); + + /** + * 根据流程实例获取流程定义id + */ + public String getProcessDefitionIdByInstanceId(String processInstanceId); + + public long queryHistoricProcessInstanceCount( + String title,String processName, String iniator, DateTime start, DateTime end,String fz); + + public Object getWFVariable(String businessKey, String variableName); + + public void setWFVariable(String businessKey,String variableName,Object obj); + + public boolean invalid(String processDefinitionKey, Map variables, String tableName, + String businessKey,String invalidReason, Properties ctx) ; + + public void dleteCompleteProcessInstance(String processInstanceId); +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/DataDicHelper.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/DataDicHelper.java new file mode 100644 index 0000000..237c1d5 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/DataDicHelper.java @@ -0,0 +1,153 @@ +package com.dsasp.server.dataDic.bean; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.util.UserSession; + +public class DataDicHelper { + + public static void addDefaultTableId(Map map, String tableName){ + Map attributeMap = new HashMap(); + attributeMap.put("COLUMNNAME", tableName.toUpperCase() + "_ID"); + attributeMap.put("METAID", "91D87CCD-3D7C-4C94-A89A-92595B926AD0"); + attributeMap.put("ISKEY", 1); + attributeMap.put("ISMANDATORY", 1); + attributeMap.put("ISIDENTIFIER", 1); + attributeMap.put("REFERENCEID", "CHAR"); + attributeMap.put("DISPLAYNAME", "主键"); + attributeMap.put("ENTITYDISPLAYSEQ", 1); + Object obj = map.get("ATTRIBUTES"); + if (obj != null && obj instanceof List) { + List attributes = (List) obj; + attributes.add(attributeMap); + }else{ + throw new ValidationException("传入参数有误"); + } + } + + public static List getTableDefaultAttributes(){ + List list = new ArrayList(); + list.add(getTableDefaultCreateByAtrribute()); + list.add(getTableDefaultCreateTimeAtrribute()); + list.add(getTableDefaultUpdateByAtrribute()); + list.add(getTableDefaultUpdateTimeAtrribute()); + list.add(getTableDefaultIsActiveAtrribute()); + list.add(getTableDefaultVersionAtrribute()); + list.add(getTableDefaultOrgAtrribute()); + list.add(getTableDefaultDepartAtrribute()); + return list; + } + + public static GeneralPOJO getTableDefaultCreateTimeAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.CREATETIME); + map.put("DISPLAYNAME", "创建时间"); + map.put("METAID", "005667B8-EB06-4250-87B7-24C894457201"); + map.put("ISMANDATORY", 1); + map.put("REFERENCEID", DisplayType.DateTime); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "时间"); + map.put("ENTITYDISPLAYSEQ", 50); + + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultCreateByAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.CREATEBY); + map.put("DISPLAYNAME", "创建者"); + + map.put("METAID", "AF87713D-FEC0-4F98-9474-9E7FBD7356D3"); + map.put("ISMANDATORY", 1); + //FIXME: 创建者应为用户对象 + map.put("REFERENCEID", DisplayType.String); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "文本"); + map.put("ENTITYDISPLAYSEQ", 51); + + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultUpdateTimeAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.UPDATETIME); + map.put("DISPLAYNAME", "更新时间"); + map.put("METAID", "D46666E6-5BA8-41A9-B876-5EF8BCFD3081"); + map.put("ISMANDATORY", 1); + map.put("REFERENCEID", DisplayType.DateTime); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "时间"); + map.put("ENTITYDISPLAYSEQ", 52); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultUpdateByAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.UPDATEBY); + map.put("DISPLAYNAME", "更新者"); + map.put("METAID", "D3FDC944-BBC2-431D-AAE6-1C0852D9F373"); + map.put("ISMANDATORY", 1); + //FIXME: 创建者应为用户对象 + map.put("REFERENCEID", DisplayType.String); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "文本"); + map.put("ENTITYDISPLAYSEQ", 53); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultIsActiveAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.ISACTIVE); + map.put("DISPLAYNAME", "是否有效"); + map.put("METAID", "B2AF976B-A5CF-4E5F-A391-0578E92D9A5C"); + map.put("ISMANDATORY", 1); + map.put("DEFAULTVALUE", "1"); + map.put("REFERENCEID", DisplayType.YesNo); + map.put("ENUMERATETYPE", "YESNO"); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "布尔值"); + map.put("ENTITYDISPLAYSEQ", 56); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultVersionAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.VERSION); + map.put("DISPLAYNAME", "版本"); + map.put("ISMANDATORY", 1); + map.put("METAID", "A9985CC5-E3B5-4C0C-997C-DA39A583D14B"); + map.put("DEFAULTVALUE", "0"); + map.put("REFERENCEID", DisplayType.Integer); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "整型"); + map.put("ENTITYDISPLAYSEQ", 57); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultDepartAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.DEPARTID); + map.put("DISPLAYNAME", "部门"); + map.put("ISMANDATORY", 1); + map.put("METAID", "AF7E8D34-387A-4667-BF07-A977A5C4BD12"); + //FIXME: 部门对象 + map.put("REFERENCEID", DisplayType.String); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "文本"); + map.put("ENTITYDISPLAYSEQ", 55); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + + public static GeneralPOJO getTableDefaultOrgAtrribute(){ + Map map = new HashMap(); + map.put("COLUMNNAME", GeneralPOJO.ORGID); + map.put("DISPLAYNAME", "组织"); + map.put("METAID", "9586433E-695A-42AA-A9A3-10EE0195D2EA"); + map.put("ISMANDATORY", 1); + //FIXME: 组织对象 + map.put("REFERENCEID", DisplayType.String); + map.put("REFERENCEID" + GeneralPOJO.DISPLAY, "文本"); + map.put("ENTITYDISPLAYSEQ", 54); + return new GeneralPO("SYS_ENTITYATTRIBUTE", map, UserSession.get()); + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Entity.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Entity.java new file mode 100644 index 0000000..4bf2bf7 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Entity.java @@ -0,0 +1,213 @@ +package com.dsasp.server.dataDic.bean; + +import java.util.List; +import java.util.UUID; + +import com.dsasp.server.common.dataDic.bean.AbstractPOJOInfo; +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.SYS_Entity; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.user.service.LoggedInUser; +import com.dsasp.server.common.util.StringUtil; +import com.dsasp.server.db.startorupdate.InstallOrUpdate; + +public class Entity implements SYS_Entity{ + public static final String tableName = "SYS_ENTITY"; + + public static final String tableType = "TABLETYPE"; + + public static final String isView = "ISVIEW"; + + public static final String attributes = "ATTRIBUTES"; + + public static final Integer MAINTABLE = 0; + public static final Integer SUBTABLE = 1; + public static final Integer MIDTABLE = 2; + + private GeneralPOJO po; + + public Entity(GeneralPOJO po){ + if (tableName.equals(po.get_TableName())) { + this.po = po; + }else{ + throw new ValidationException("参数类型不是实体类型"); + } + } + + public GeneralPOJO getPo() { + return po; + } + +// public void setPo(GeneralPO po) { +// this.po = po; +// } + + public String getTablename() { + return tableName; + } + + public Integer getTabletype() { + if(po != null){ + return po.get_ValueAsInt(tableType); + } + return -1; + } + + public boolean isView() { + if(po != null){ + return po.get_ValueAsBoolean(isView); + } + return true; + } + + public List getAttributes(){ + return (List)po.get_Value(attributes); + } + + /** + * create the table create postgresql sql + * @return + */ + public String createTableSql() { + StringBuffer sql = new StringBuffer(); + if (!isView()) { + StringBuffer unique = new StringBuffer(); + StringBuffer combUnique = new StringBuffer(); + sql.append("CREATE TABLE ").append(po.get_Value(tableNameCol)).append("\n"); + sql.append("(").append("\n"); + List list = getAttributes(); + if (list != null && list.size() > 0) { + for (GeneralPOJO attribute : list) { + processAttribute(attribute, sql, unique, combUnique); + } + } + sql.append(unique); + if (combUnique.length() > 0) { + sql.append(combUnique).append("), \n"); + } + if (MIDTABLE != getTabletype()) { + sql.append("primary key (").append(po.get_Value(tableNameCol)) + .append("_ID)").append("\n"); + } else { + int index = sql.lastIndexOf(","); + sql.delete(index, index + 1); + } + sql.append("); \n"); + } + if (InstallOrUpdate.isDevDB()) { + sql.append(getOrderEntity()); + } + return sql.toString(); + } + + private StringBuffer getOrderEntity(){ + StringBuffer order = new StringBuffer(); + order.append("INSERT INTO order_entity(order_entity_id, tablename, sys_entitytype, sequ, updatetime, version, updateby)"); + order.append(" VALUES ( "); + order.append(StringUtil.TO_STRING(UUID.randomUUID().toString(), 0)).append(", "); + order.append(StringUtil.TO_STRING(po.get_Value(tableNameCol).toString(), 0)).append(", "); + order.append(StringUtil.TO_STRING(po.get_Value("ENTITYTYPE").toString(), 0)).append(", "); + order.append(StringUtil.TO_STRING("1", 0)).append(", "); + order.append(System.currentTimeMillis()).append(", "); + order.append(0).append(", "); + order.append(StringUtil.TO_STRING(LoggedInUser.ADMIN, 0)).append("); \n"); + return order; + } + + /** + * create column sql + * @param attribute + * @param sqlPre + * @param unique + * @param combUnique + */ + private void processAttribute(GeneralPOJO attribute, StringBuffer sqlPre, StringBuffer unique, StringBuffer combUnique){ + boolean readOnly = attribute.get_ValueAsBoolean(isReadonly); + if(!readOnly){ + String clazz = (String)attribute.get_Value(referenceid); + if (!DisplayType.List.equals(clazz)) { + String colName = (String)attribute.get_Value(columnName); + boolean mandatory = attribute.get_ValueAsBoolean(isMandatory); + boolean identifier = attribute.get_ValueAsBoolean(isIdentifier); + boolean combIdentifier = attribute.get_ValueAsBoolean(isCombidentifier); + String defValue = (String)attribute.get_Value(Entity.defaultValue); + if(GeneralPOJO.CREATEBY.equals(colName) || GeneralPOJO.UPDATEBY.equals(colName) + || GeneralPOJO.ORGID.equals(colName) || GeneralPOJO.DEPARTID.equals(colName)){ + sqlPre.append(colName).append(" character(36) "); + }else if (DisplayType.String.equals(clazz) || DisplayType.Code.equals(clazz)) { + Integer length = (Integer)attribute.get_Value(fieldLength); + if(length == null || length <= 0){ + length = 100; + } + sqlPre.append(colName).append(" character varying(").append(length).append(") "); + } else if (DisplayType.Integer.equals(clazz) || DisplayType.YesNo.equals(clazz) || DisplayType.ENUMERATE.equals(clazz)) { + sqlPre.append(colName).append(" integer "); + } else if (DisplayType.Number.equals(clazz) || DisplayType.Money.equals(clazz)) { + sqlPre.append(colName).append(" numeric(18,6) "); + } else if (DisplayType.Date.equals(clazz) || DisplayType.DateTime.equals(clazz)) { + sqlPre.append(colName).append(" bigint "); + } else if (DisplayType.Binary.equals(clazz) || DisplayType.STATUS.equals(clazz)) { + return; + } else if(DisplayType.ID.equals(clazz)){ + sqlPre.append(colName).append(" character(36) "); + }else{ + String tableName = (String)po.get_Value(tableNameCol); + POJOInfo info = AbstractPOJOInfo.getPOInfo(tableName); + String referenceTableName = info.getReferenceTable(colName); + sqlPre.append(colName).append(" character(36) REFERENCES " + referenceTableName); + } + if(mandatory){ + sqlPre.append(" NOT NULL "); + } + if(!StringUtil.isEmpty(defValue) && !DisplayType.Binary.equals(clazz)){ + if(DisplayType.Integer.equals(clazz) || DisplayType.YesNo.equals(clazz) || DisplayType.Number.equals(clazz) || DisplayType.Money.equals(clazz)){ + sqlPre.append(" DEFAULT "); + sqlPre.append(defValue); + } + } + sqlPre.append(", \n"); + if(identifier){ + unique.append(" unique (").append(colName).append("), \n"); + }else if(combIdentifier){ + // after combUnique string append in the createTableSql function + if(combUnique.length() == 0){ + combUnique.append(" unique ("); + }else{ + combUnique.append(","); + } + combUnique.append(colName); + } + } + } + } + + /** + * delete table sql + * @return + */ + public String delteTableSql() { + StringBuffer sql = new StringBuffer(); + if (!isView()) { + sql.append("drop table if exists ").append(getTablename()) + .append(" cascade;"); + } + return sql.toString(); + } + + /** + * sys_entityattribute table field name + */ + public static final String isKey = "ISKEY"; + public static final String isMandatory = "ISMANDATORY"; + public static final String isIdentifier = "ISIDENTIFIER"; + public static final String referenceid = "REFERENCEID"; + public static final String isReadonly = "ISREADONLY"; + public static final String isCombidentifier = "ISCOMBIDENTIFIER"; + public static final String fieldLength = "FIELDLENGTH"; + public static final String defaultValue = "DEFAULTVALUE"; + public static final String columnName = "COLUMNNAME"; + public static final String tableNameCol = "TABLENAME"; + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/EntityRule.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/EntityRule.java new file mode 100644 index 0000000..4735028 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/EntityRule.java @@ -0,0 +1,89 @@ +package com.dsasp.server.dataDic.bean; + +import java.util.HashMap; +import java.util.Map; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.Rule; +import com.dsasp.server.common.exception.ValidationException; + +public class EntityRule implements Rule{ + + public static final String TABLENAME = "SYS_RULE"; + private GeneralPOJO po; + private static final String name = "NAME"; + private static final String content = "CONTENT"; + private static final String entityId = "ENTITYID"; + private static final String verificationTime = "VERIFICATIONTIME"; + + public static final Integer BEFORESAVE = 0; + public static final Integer AFTERSAVE = 1; + public static final Integer BEFOREDELETE = 2; + public static final Integer AFTERDELETE = 3; + + + public EntityRule(GeneralPOJO po) { + if (TABLENAME.equals(po.get_TableName())) { + this.po = po; + } else { + throw new ValidationException("传入实体参数不匹配"); + } + } + + + public GeneralPOJO getPo() { + return po; + } + + + public String getName() { + return (String)po.get_Value(name); + } + + + public void setName(String name) { + po.set_ValueOfColumn(EntityRule.name, name); + } + + + public String getContent() { + return (String)po.get_Value(content); + } + + + public void setContent(String content) { + po.set_ValueOfColumn(EntityRule.content, content); + } + + + public String getEntityId() { + return (String)po.get_Value(entityId); + } + + + public void setEntityId(String entityId) { + po.set_ValueOfColumn(EntityRule.entityId, entityId); + } + + + public Integer getVerificationTime() { + return po.get_ValueAsInt(verificationTime); + } + + + public void setVerificationTime(Integer verificationTime) { + po.set_ValueOfColumn(EntityRule.verificationTime, verificationTime); + } + + public Map convertToMap(){ + Map map = new HashMap(); + map.put(TABLENAME + "_ID", getPo().get_ID()); + map.put(name, getPo().get_Value(name)); + map.put(content, getPo().get_Value(content)); + map.put(entityId, getPo().get_Value(entityId)); + map.put(verificationTime, getPo().get_Value(verificationTime)); + return map; + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/GeneralPO.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/GeneralPO.java new file mode 100644 index 0000000..e3fcdfa --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/GeneralPO.java @@ -0,0 +1,2550 @@ +package com.dsasp.server.dataDic.bean; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.bean.CustomSearchConditional; +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.Enumerate; +import com.dsasp.server.common.dataDic.bean.EnumerateItem; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.PojoMap; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.log.bean.LogItem; +import com.dsasp.server.common.user.service.LoggedInUser; +import com.dsasp.server.common.util.DbUtil; +import com.dsasp.server.common.util.ExDateUtil; +import com.dsasp.server.common.util.StringUtil; +import com.dsasp.server.common.viewframework.service.ProjectSwitchService; +import com.dsasp.server.common.workflow.service.ProcessCoreService; + +public class GeneralPO implements GeneralPOJO, LogItem, Serializable { + /** + * + */ + private static final long serialVersionUID = 6604764467216189092L; + + private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate"; + + private static final int QUERY_TIME_OUT = 10; + + /** User Maintained Entity Type */ + static protected final String ENTITYTYPE_UserMaintained = "U"; + /** Dictionary Maintained Entity Type */ + static protected final String ENTITYTYPE_Dictionary = "D"; + +// private String userId; +// private String departId; +// private String orgId; + + /** Context */ + protected Properties p_ctx; + /** Model Info */ + protected transient POJOInfo p_info = null; + + /** Original Values */ + private Object[] m_oldValues = null; + /** New Values */ + private Object[] m_newValues = null; + + /** Record_IDs */ + private Object[] m_IDs = new Object[] {}; + /** Key Columns */ + private String[] m_KeyColumns = new String[]{}; + /** Create New for Multi Key */ + private boolean m_createNew = false; + /** Attachment with entries */ + + /** Deleted ID */ + private String m_idOld = NULL; + /** Custom Columns */ + private HashMap m_custom = new HashMap(); + + /** Zero Integer */ + protected static final Integer I_ZERO = new Integer(0); + /** Accounting Columns */ + private ArrayList s_acctColumns = null; + + /** + * Trifon - Indicates that this record is created by replication + * functionality. + */ + private boolean m_isReplication = false; + + private GeneralPOJO mainPO; + + /** Access Level S__ 100 4 System info */ + public static final int ACCESSLEVEL_SYSTEM = 4; + /** Access Level _C_ 010 2 Client info */ + public static final int ACCESSLEVEL_CLIENT = 2; + /** Access Level __O 001 1 Organization info */ + public static final int ACCESSLEVEL_ORG = 1; + /** Access Level SCO 111 7 System shared info */ + public static final int ACCESSLEVEL_ALL = 7; + /** Access Level SC_ 110 6 System/Client info */ + public static final int ACCESSLEVEL_SYSTEMCLIENT = 6; + /** Access Level _CO 011 3 Client shared info */ + public static final int ACCESSLEVEL_CLIENTORG = 3; + + private static Map projectOrgMap = new HashMap(); + + public GeneralPO(String tableName, ResultSet rs, Properties ctx, List cols) { + // if (ctx == null) + // throw new IllegalArgumentException ("No Context"); + p_ctx = ctx; +// this.userId = userID; +// this.departId = departID; +// this.orgId = orgID; + + p_info = initPO(tableName); + if (p_info == null || p_info.getTableName() == null) + throw new IllegalArgumentException("Invalid PO Info - " + p_info); + // + int size = p_info.getColumnCount(); + m_oldValues = new Object[size]; + m_newValues = new Object[size]; + + if (rs != null) + load(rs, cols); // will not have virtual columns + } // PO + +// /** +// * Create New PO by Copying existing (key not copied). +// * +// * @param ctx +// * context +// * @param source +// * source object +// * @param orgId +// * client +// * @param departId +// * org +// */ +// public GeneralPO(GeneralPO source, int orgId, int departId) { +// // this (ctx, NULL, null); // create new +// // +// if (source != null) +// copyValues(source, this); +// setOrgId(orgId); +// setDepartId(departId); +// } // PO + + /** + * Load from the current position of a SqlRowSet + * + * @param rs + * result set + * @return true if loaded + */ + protected boolean load(ResultSet rs, List cols) { + int size = get_ColumnCount(); + boolean success = true; + int index = 0; + for (index = 0; index < size; index++) { + String columnName = p_info.getColumnName(index); + Class clazz = p_info.getColumnClass(index); + String dt = p_info.getColumnDisplayType(index); + if(cols != null && cols.size() > 0 && !cols.contains(columnName)){ + continue; + } + try { + if (clazz == Integer.class) { + BigDecimal val = rs.getBigDecimal(columnName); + m_oldValues[index] = decrypt(index, + val != null ? val.intValue() : null); + } else if (clazz == BigDecimal.class) + m_oldValues[index] = decrypt(index, + rs.getBigDecimal(columnName)); + else if (clazz == Boolean.class) { + Object obj = decrypt(index, rs.getString(columnName)); + if (obj == null) { + m_oldValues[index] = null; + } else if ("true".equalsIgnoreCase(obj.toString()) + || obj.toString().equals("1")) { + m_oldValues[index] = new Boolean("True"); + } else if ("false".equalsIgnoreCase(obj.toString()) + || obj.toString().equals("0")) { + m_oldValues[index] = new Boolean("False"); + } + } else if (clazz == DateTime.class) { + BigDecimal val = rs.getBigDecimal(columnName); + m_oldValues[index] = decrypt(index, + val != null ? new DateTime(val.longValue()) : null); + } + // else if (DisplayType.isLOB(dt)) + // m_oldValues[index] = get_LOB (rs.getObject(columnName)); + else if (clazz == String.class) + m_oldValues[index] = decrypt(index, + rs.getString(columnName)); + else if (clazz == List.class) { + m_oldValues[index] = new ArrayList(); + // load subTable data + } else if(clazz == byte[].class){ + m_oldValues[index] = new ArrayList(); + if(cols != null){ + set_CustomColumn(columnName, + rs.getString(columnName + DISPLAY)); + } + continue; + } + else { + m_oldValues[index] = rs.getString(columnName); + } + + if (( Object.class == clazz)) { + set_CustomColumn(columnName, + rs.getString(columnName + DISPLAY)); + }else if(DisplayType.ENUMERATE.equals(dt) + || DisplayType.YesNo.equals(dt) || DisplayType.STATUS.equals(dt)){ + BigDecimal val = rs.getBigDecimal(columnName); + if (val != null) { + int itemValue = val.intValue(); + set_CustomColumn(columnName, + getEnumerateDis(index, itemValue)); + }else if(DisplayType.STATUS.equals(dt)){ + //为空的是未提交状态 + m_oldValues[index] = 1; + set_CustomColumn(columnName, + getEnumerateDis(index, 1)); + } + } + } catch (Exception e) { + e.printStackTrace(); // @Trifon - MySQL Port + if (p_info.isVirtualColumn(index)) // if rs constructor used + ; + else { + ; + success = false; + } + } + } + m_createNew = false; + setKeyInfo(); + loadComplete(success); + return success; + } // load + + private String getEnumerateDis(int index, int value){ + List items = Enumerate.getEnumerateItems(p_info.getEnumerateType(index)); + for(EnumerateItem item : items){ + if(item.getCodeValue() == value){ + return item.getCodeDes(); + } + } + return null; + } + + public GeneralPO(String tableName, Map map, Properties ctx) { + p_info = initPO(tableName); +// if (p_info == null || p_info.getTableName() == null) +// throw new IllegalArgumentException("Invalid PO Info - " + p_info); + // + int size = p_info.getColumnCount(); + m_oldValues = new Object[size]; + m_newValues = new Object[size]; + +// if (ctx == null) { +// userId = ""; +// orgId = ""; +// departId = ""; +// } + p_ctx = ctx; + + if (map != null) + load(map); // will not have virtual columns + } + + protected boolean load(Map map) { + int size = get_ColumnCount(); + boolean success = true; + int index = 0; + // log.finest("(rs)"); + // load column values + for (index = 0; index < size; index++) { + String columnName = p_info.getColumnName(index); + Class clazz = p_info.getColumnClass(index); + String dt = p_info.getColumnDisplayType(index); + try { + if (clazz == Integer.class) + m_oldValues[index] = decrypt(index, + (Integer) map.get(columnName)); + else if (clazz == BigDecimal.class) + m_oldValues[index] = decrypt(index, map.get(columnName)); + else if (clazz == Boolean.class) { + Object obj = decrypt(index, map.get(columnName)); + if (obj == null) { + m_oldValues[index] = null; + } else if ("true".equalsIgnoreCase(obj.toString()) + || obj.toString().equals("1")) { + m_oldValues[index] = new Boolean("True"); + } else if ("false".equalsIgnoreCase(obj.toString()) + || obj.toString().equals("0")) { + m_oldValues[index] = new Boolean("False"); + } else if (obj instanceof Boolean) { + m_oldValues[index] = obj; + } + } else if (clazz == DateTime.class) + m_oldValues[index] = decrypt(index, map.get(columnName)); + // else if (DisplayType.isLOB(dt)) + // m_oldValues[index] = get_LOB (rs.getObject(columnName)); + else if (clazz == String.class) + m_oldValues[index] = decrypt(index, map.get(columnName)); + else if (clazz == Object.class) { + m_oldValues[index] = decrypt(index, map.get(columnName)); + } else if (clazz == List.class) { + m_oldValues[index] = decrypt(index, map.get(columnName)); + } else if(clazz == byte[].class){ + m_oldValues[index] = map.get(columnName); + }else + m_oldValues[index] = null; + } catch (Exception e) { + throw new ValidationException("加载数据异常,查看数据类型是否匹配" + e.getMessage()); + } + } + m_createNew = true; + setKeyInfo(); + loadDefaults(); + loadComplete(success); + return success; + } // load + + private Object decrypt(int index, Object yy) { + // FIXME: 同上 + if (yy == null) + return null; + // if (index != -1 && p_info.isEncrypted(index)) + // return SecureEngine.decrypt(yy); + if (yy instanceof List) { + List list = (List) yy; + if (list != null && list.size() > 0) { + Object obj = list.get(0); + if (obj instanceof Map) { + String reTableName = p_info.getReferenceValueTable(index); + POInfo info = (POInfo) initPO(reTableName); + if (info.getTableType() != Entity.MIDTABLE) { + String keyCol = info.getKeyColumnName(); + List> mapList = (List>) yy; + List oldList = (List) m_oldValues[index]; + if (!StringUtil.isEmpty(reTableName)) { + List reList = new ArrayList(); + for (HashMap map : mapList) { + GeneralPOJO po = null; + // 主子表 + if (!StringUtil.isEmpty(keyCol)) { + if (!StringUtil.isEmpty((String) map + .get(keyCol)) + && oldList != null + && oldList.size() > 0) { + String id = (String) map.get(keyCol); + for (GeneralPOJO pojo : oldList) { + if (id.equals(pojo.get_ID())) { + po = pojo; + break; + } + } + po.get_KeyColumns(); + int count = po.get_ColumnCount(); + for (int i = 0; i < count; i++) { + if (map.containsKey(po + .get_ColumnName(i))) { + String name = po + .get_ColumnName(i); + po.set_ValueOfColumn(name, + map.get(name)); + } + } + } + } + if (po == null) { + po = new GeneralPO(reTableName, map, p_ctx); + } + reList.add(po); + } + return reList; + } + }else{ + throw new ValidationException(p_info.getColumnLabel(index) + " 传入类型不正确"); + } + } else if (obj instanceof GeneralPOJO) { + return yy; + } else if (obj instanceof String) { + return decryptMidTableList(index, + (List) yy); + } + } + } + if(DisplayType.String.equals(get_ColumnDisplayType(index))){ + yy = yy.toString(); + } + + return yy; + } // decrypt + + + private Object decryptMidTableList(int index, List yy) { + // FIXME: 同上 + if (yy == null) + return null; + if (yy instanceof List) { + String reTableName = p_info.getReferenceValueTable(index); + POInfo info = (POInfo) initPO(reTableName); + + if(Entity.MIDTABLE == info.getTableType()){ +// List oldList = (List) m_oldValues[index]; + if (!StringUtil.isEmpty(reTableName) && info.getColumnCount() == 2) { + return yy; +// List reList = new ArrayList(); +// String foreignKey = p_info.getReferenceValueColumnName(index); +// int otherColumnIndex = foreignKey.equals(info.getColumnName(0)) ? 1 : 0; +// +// String otherTableName = ((DataDicService) SpringBeanOsgiServices +// .getInstance().getBeanByName("dataDicService")) +// .getReferenceEntityTableName(info.getColumnDisplayType(otherColumnIndex)); +// POInfo otherInfo = POInfo.getPOInfo(otherTableName); +// String keyCol = otherInfo.getKeyColumnName(); +// for (String foreign : yy) { +// GeneralPOJO po = null; +// Map map = new HashMap(); +// map.put(keyCol, foreign); +// if (po == null) { +// po = new GeneralPO(otherTableName, map, null); +// } +// reList.add(po); +// } +// return reList; + } + }else{ + throw new ValidationException(p_info.getColumnLabel(index) + " 传入类型不正确"); + } + } + return null; + } // decrypt + + + /** + * Initialize and return PO_Info + * + * @param ctx + * context + * @return POInfo + */ + public POJOInfo initPO(String tableName) { + return POInfo.getPOInfo(tableName); + } + + /** + * Get Table Access Level + * + * @return Access Level + */ + protected int get_AccessLevel() { + return 0; + } + + /** + * String representation + * + * @return String representation + */ + public String toString() { + StringBuffer sb = new StringBuffer("GeneralPO[").append( + get_WhereClause(true)).append("]"); + return sb.toString(); + } // toString + + /** + * Equals based on ID + * + * @param cmp + * comparator + * @return true if ID the same + */ + public boolean equals(Object cmp) { + if (cmp == null) + return false; + if (!(cmp instanceof GeneralPO)) + return false; + if (cmp.getClass().equals(this.getClass())) { + // if both ID's are null they can't be compared by ID + GeneralPO comp = (GeneralPO) cmp; + if (comp.get_ID() == null && get_ID() == null) { + if (p_info.getTableType() == 2 && p_info.getColumnCount() == 2) { + boolean eq = get_Value(0) == null ? comp.get_Value(0) == null + : get_Value(0).equals(comp.get_Value(0)); + eq = eq + && (get_Value(1) == null ? comp.get_Value(1) == null + : get_Value(1).equals(comp.get_Value(1))); + return eq; + } else { + return super.equals(cmp); + } + } else { + return comp.get_ID() == null ? false : comp.get_ID().equals(get_ID()); + } + } + return super.equals(cmp); + } // equals + + /** + * Get TableName. + * + * @return table name + */ + public String get_TableName() { + return p_info.getTableName(); + } // get_TableName + + /** + * Get Key Columns. + * + * @return table name + */ + public String[] get_KeyColumns() { + return m_KeyColumns; + } // get_KeyColumns + + /** + * Get Table ID. + * + * @return table id + */ + public String get_Table_ID() { + return p_info.getAD_Table_ID(); + } // get_TableID + + /** + * Return Single Key Record ID + * + * @return ID or 0 + */ + public String get_ID() { + if (p_info.getTableType() != Entity.MIDTABLE) { + Object oo = m_IDs[0]; + if (oo != null && oo instanceof String) + return oo.toString(); + } + return null; + } // getID + + /** + * Return Deleted Single Key Record ID + * + * @return ID or 0 + */ + public String get_IDOld() { + return m_idOld; + } // getID + + /************************************************************************** + * Get Value + * + * @param index + * index + * @return value + */ + public final Object get_Value(int index) { + if (index < 0 || index >= get_ColumnCount()) { + // log.log(Level.WARNING, "Index invalid - " + index); + return null; + } + if (m_newValues[index] != null) { + if (m_newValues[index].equals(NULL)) + return null; + return m_newValues[index]; + } + return m_oldValues[index]; + } // get_Value + + /** + * Get Value as int + * + * @param index + * index + * @return int value or 0 + */ + public int get_ValueAsInt(int index) { + Object value = get_Value(index); + if (value == null) + return 0; + if (value instanceof Integer) + return ((Integer) value).intValue(); + try { + return Integer.parseInt(value.toString()); + } catch (NumberFormatException ex) { + // log.warning(p_info.getColumnName(index) + " - " + + // ex.getMessage()); + return 0; + } + } // get_ValueAsInt + + /** + * Get Value + * + * @param columnName + * column name + * @return value or null + */ + public final Object get_Value(String columnName) { + int index = get_ColumnIndex(columnName); + if (index < 0) { + // log.log(Level.WARNING, "Column not found - " + columnName); + // Trace.printStack(); + return null; + } + return get_Value(index); + } // get_Value + + /** + * Get Column Value + * + * @param variableName + * name + * @return value or "" + */ + public String get_ValueAsString(String variableName) { + Object value = get_Value(variableName); + if (value == null) + return ""; + return value.toString(); + } // get_ValueAsString + + /** + * Get Value of Column + * + * @param AD_Column_ID + * column + * @return value or null + */ + public final Object get_ValueOfColumn(String AD_Column_ID) { + int index = p_info.getColumnIndexByID(AD_Column_ID); + if (index < 0) { + // log.log(Level.WARNING, "Not found - AD_Column_ID=" + + // AD_Column_ID); + return null; + } + return get_Value(index); + } // get_ValueOfColumn + + /** + * Get Old Value + * + * @param index + * index + * @return value + */ + public final Object get_ValueOld(int index) { + if (index < 0 || index >= get_ColumnCount()) { + // log.log(Level.WARNING, "Index invalid - " + index); + return null; + } + return m_oldValues[index]; + } // get_ValueOld + + /** + * Get Old Value + * + * @param columnName + * column name + * @return value or null + */ + public final Object get_ValueOld(String columnName) { + int index = get_ColumnIndex(columnName); + if (index < 0) { + // log.log(Level.WARNING, "Column not found - " + columnName); + return null; + } + return get_ValueOld(index); + } // get_ValueOld + + /** + * Get Old Value as int + * + * @param columnName + * column name + * @return int value or 0 + */ + public int get_ValueOldAsInt(String columnName) { + Object value = get_ValueOld(columnName); + if (value == null) + return 0; + if (value instanceof Integer) + return ((Integer) value).intValue(); + try { + return Integer.parseInt(value.toString()); + } catch (NumberFormatException ex) { + // log.warning(columnName + " - " + ex.getMessage()); + return 0; + } + } // get_ValueOldAsInt + + /** + * Is Value Changed + * + * @param index + * index + * @return true if changed + */ + public final boolean is_ValueChanged(int index) { + if (index < 0 || index >= get_ColumnCount()) { + // log.log(Level.WARNING, "Index invalid - " + index); + return false; + } + if (m_newValues[index] == null + || (NULL.equals(m_newValues[index]) && m_oldValues[index] == null)) { + return false; + } else if (DisplayType.List.equals(get_ColumnDisplayType(index))) { + return true; + } + return !m_newValues[index].equals(m_oldValues[index]); + } // is_ValueChanged + + /** + * Is Value Changed + * + * @param columnName + * column name + * @return true if changed + */ + public final boolean is_ValueChanged(String columnName) { + int index = get_ColumnIndex(columnName); + if (index < 0) { + // log.log(Level.WARNING, "Column not found - " + columnName); + return false; + } + return is_ValueChanged(index); + } // is_ValueChanged + + /** + * Return new - old. - New Value if Old Value is null - New Value - Old + * Value if Number - otherwise null + * + * @param index + * index + * @return new - old or null if not appropriate or not changed + */ + public final Object get_ValueDifference(int index) { + if (index < 0 || index >= get_ColumnCount()) { + // log.log(Level.WARNING, "Index invalid - " + index); + return null; + } + Object nValue = m_newValues[index]; + // No new Value or NULL + if (nValue == null || nValue == NULL) + return null; + // + Object oValue = m_oldValues[index]; + if (oValue == null || oValue == NULL) + return nValue; + if (nValue instanceof BigDecimal) { + BigDecimal obd = (BigDecimal) oValue; + return ((BigDecimal) nValue).subtract(obd); + } else if (nValue instanceof Integer) { + int result = ((Integer) nValue).intValue(); + result -= ((Integer) oValue).intValue(); + return new Integer(result); + } + return null; + } // get_ValueDifference + + /** + * Return new - old. - New Value if Old Value is null - New Value - Old + * Value if Number - otherwise null + * + * @param columnName + * column name + * @return new - old or null if not appropriate or not changed + */ + public final Object get_ValueDifference(String columnName) { + int index = get_ColumnIndex(columnName); + if (index < 0) { + // log.log(Level.WARNING, "Column not found - " + columnName); + return null; + } + return get_ValueDifference(index); + } // get_ValueDifference + + /************************************************************************** + * Set Value + * + * @param ColumnName + * column name + * @param value + * value + * @return true if value set + */ + protected final boolean set_Value(String ColumnName, Object value) { + // if (value instanceof String && ColumnName.equals("WhereClause") + // && value.toString().toUpperCase().indexOf("=NULL") != -1) + // log.warning("Invalid Null Value - " + ColumnName + "=" + value); + + int index = get_ColumnIndex(ColumnName); + if (index < 0) { + // log.log(Level.SEVERE, "Column not found - " + ColumnName); + return false; + } + return set_Value(index, value); + } // setValue + + /** + * Set Value if updteable and correct class. (and to NULL if not mandatory), + * DateTime type must set DateTime value + * + * @param index + * index + * @param value + * value + * @return true if value set + */ + protected final boolean set_Value(int index, Object value) { + if (index < 0 || index >= get_ColumnCount()) { + // log.log(Level.WARNING, "Index invalid - " + index); + return false; + } + String ColumnName = p_info.getColumnName(index); + String colInfo = " - " + ColumnName; + // FIXME: 考虑只读。解释:只读为虚拟字段无Insert、update,不可更改,即一旦添加后,不能修改 +// if (p_info.isVirtualColumn(index)) { +// return false; +// } +// // FIXME: +// if ((!p_info.isColumnUpdateable(index)) && (!is_new())) { +// // colInfo += " - NewValue=" + value + " - OldValue=" + +// // get_Value(index); +// // log.log(Level.WARNING, "Column not updateable" + colInfo); +// return false; +// } + // + if (value == null || NULL.equals(value)) { + if (p_info.isColumnMandatory(index)) { + throw new IllegalArgumentException(p_info.getColumnLabel(index) + + "是必填项"); + } + m_newValues[index] = NULL; // correct + // log.finer(ColumnName + " = null"); + } else { + // matching class or generic object + if (value instanceof List + && p_info.getColumnClass(index) == List.class) { + m_newValues[index] = decrypt(index, value); + } else if (value.getClass().equals(p_info.getColumnClass(index)) + || p_info.getColumnClass(index) == Object.class) { + if (DisplayType.String.equals(p_info + .getColumnDisplayType(index))) {// 去掉前后空格 + m_newValues[index] = value.toString(); + } else { + m_newValues[index] = value; // correct + } + // Integer can be set as BigDecimal + } + else if (value.getClass() == BigDecimal.class + && p_info.getColumnClass(index) == Integer.class) + m_newValues[index] = new Integer( + ((BigDecimal) value).intValue()); + else if ((value.getClass() == Integer.class || value.getClass() == Double.class) + && p_info.getColumnClass(index) == BigDecimal.class) + m_newValues[index] = value; + // Set Boolean + else if (p_info.getColumnClass(index) == Boolean.class + && (value.getClass() == Integer.class)) + m_newValues[index] = new Boolean((Integer) value > 0); + else if (value.getClass() == Integer.class + && p_info.getColumnClass(index) == String.class) + m_newValues[index] = value; + else if (value.getClass() == String.class + && p_info.getColumnClass(index) == Integer.class) + try { + m_newValues[index] = new Integer((String) value); + } catch (NumberFormatException e) { + // log.log(Level.SEVERE, ColumnName + // + " - Class invalid: " + value.getClass().toString() + // + ", Should be " + + // p_info.getColumnClass(index).toString() + ": " + value); + return false; + } + else if (value.getClass() == String.class + && p_info.getColumnClass(index) == BigDecimal.class) { + try { + m_newValues[index] = new BigDecimal((String) value); + } catch (NumberFormatException e) { + return false; + } + }else if(DisplayType.Binary.equals(p_info.getColumnDisplayType(index))){ + m_newValues[index] = value; + } + else { + return false; + } + // Validate (Min/Max) + String error = p_info.validate(index, value); + if (error != null) { + throw new ValidationException(error); + } + // Length for String + if (p_info.getColumnClass(index) == String.class) { + String stringValue = value.toString(); + int length = p_info.getFieldLength(index); + if (stringValue.length() > length && length > 0) { + // log.warning(ColumnName + + // " - Value too long - truncated to length=" + length); + throw new ValidationException(p_info.getColumnLabel(index) + "的长度不能超过" + + length+ "个字符"); + } + } + // Validate reference list [1762461] + // FIXME: 处理主子表中的字表情�? + // if (p_info.getColumnDisplayType(index) == DisplayType.List && + // value instanceof String) { + // FIXME 列表应用类型处理 + } + set_Keys(ColumnName, m_newValues[index]); + return true; + } // setValue + + /** + * Set Value w/o check (update, r/o, ..). Used when Column is R/O Required + * for key and parent values + * + * @param ColumnName + * column name + * @param value + * value + * @return true if value set + */ + protected final boolean set_ValueNoCheck(String ColumnName, Object value) { + int index = get_ColumnIndex(ColumnName); + if (index < 0) { + // log.log(Level.SEVERE, "Column not found - " + ColumnName); + return false; + } + if (value == null) + m_newValues[index] = NULL; // write direct + else { + // matching class or generic object + if (value.getClass().equals(p_info.getColumnClass(index)) + || p_info.getColumnClass(index) == Object.class) + m_newValues[index] = value; // correct + // Integer can be set as BigDecimal + else if (value.getClass() == BigDecimal.class + && p_info.getColumnClass(index) == Integer.class) + m_newValues[index] = new Integer( + ((BigDecimal) value).intValue()); + // Set Boolean + else if (p_info.getColumnClass(index) == Boolean.class + && ("Y".equals(value) || "N".equals(value))) + m_newValues[index] = new Boolean("Y".equals(value)); + else if (p_info.getColumnClass(index) == Integer.class + && value.getClass() == String.class) { + try { + int intValue = Integer.parseInt((String) value); + m_newValues[index] = Integer.valueOf(intValue); + } catch (Exception e) { + // log.warning (ColumnName + // + " - Class invalid: " + value.getClass().toString() + // + ", Should be " + + // p_info.getColumnClass(index).toString() + ": " + value); + m_newValues[index] = null; + } + } else { + // log.warning (ColumnName + // + " - Class invalid: " + value.getClass().toString() + // + ", Should be " + p_info.getColumnClass(index).toString() + + // ": " + value); + m_newValues[index] = value; // correct + } + // Validate (Min/Max) + String error = p_info.validate(index, value); + if (error != null) + return false; + // log.warning(ColumnName + "=" + value + " - " + error); + // length for String + if (p_info.getColumnClass(index) == String.class) { + String stringValue = value.toString(); + int length = p_info.getFieldLength(index); + if (stringValue.length() > length && length > 0) { + // log.warning(ColumnName + + // " - Value too long - truncated to length=" + length); + m_newValues[index] = stringValue.substring(0, length); + } + } + } + // log.finest(ColumnName + " = " + m_newValues[index] + // + " (" + (m_newValues[index]==null ? "-" : + // m_newValues[index].getClass().getName()) + ")"); + set_Keys(ColumnName, m_newValues[index]); + + return true; + } // set_ValueNoCheck + + /** + * Set Encrypted Value w/o check (update, r/o, ..). Used when Column is R/O + * Required for key and parent values + * + * @param ColumnName + * column name + * @param value + * value + * @return true if value set + */ + protected final boolean set_ValueNoCheckE(String ColumnName, Object value) { + return set_ValueNoCheck(ColumnName, value); + } // set_ValueNoCheckE + + /** + * Set value of Column + * + * @param columnName + * @param value + */ + public final void set_ValueOfColumn(String columnName, Object value) { + set_ValueOfColumnReturningBooleanByName(columnName, value); + } + + /** + * Set value of Column returning boolean + * + * @param columnName + * @param value + * @returns boolean indicating success or failure + */ + public final boolean set_ValueOfColumnReturningBooleanByName( + String columnName, Object value) { + String AD_Column_ID = p_info.getAD_Column_ID(columnName); + if (AD_Column_ID != null) + return set_ValueOfColumnReturningBooleanByID(AD_Column_ID, value); + else + return false; + } + + /** + * Set Value of Column + * + * @param AD_Column_ID + * column + * @param value + * value + */ + public final void set_ValueOfColumnByID(String AD_Column_ID, Object value) { + set_ValueOfColumnReturningBooleanByID(AD_Column_ID, value); + } // setValueOfColumn + + /** + * Set Value of Column + * + * @param AD_Column_ID + * column + * @param value + * value + * @returns boolean indicating success or failure + */ + public final boolean set_ValueOfColumnReturningBooleanByID( + String AD_Column_ID, Object value) { + int index = p_info.getColumnIndexByID(AD_Column_ID); + if (index < 0) + return false; + String ColumnName = p_info.getColumnName(index); + if (ColumnName.equalsIgnoreCase("IsApproved")) + return set_ValueNoCheck(ColumnName, value); + else + return set_Value(index, value); + } // setValueOfColumn + + /** + * Set Custom Column + * + * @param columnName + * column + * @param value + * value + */ + public final void set_CustomColumn(String columnName, Object value) { + set_CustomColumnReturningBoolean(columnName, value); + } // set_CustomColumn + + /** + * Set Custom Column returning boolean + * + * @param columnName + * column + * @param value + * value + * @returns boolean indicating success or failure + */ + public final boolean set_CustomColumnReturningBoolean(String columnName, + Object value) { + if (m_custom == null) + m_custom = new HashMap(); + String valueString = "NULL"; + if (value == null) + valueString = null; + else if (value instanceof Number) + valueString = value.toString(); + else if (value instanceof Boolean) + valueString = ((Boolean) value).booleanValue() ? "'Y'" : "'N'"; + else if (value instanceof DateTime) + valueString = ((DateTime) value).getMillis() + ""; + else if (value instanceof String) { + valueString = value.toString(); + } else + // if (value instanceof String) + valueString = DbUtil.TO_STRING(value.toString(), 0); + // Save it + m_custom.put(columnName, valueString); + return true; + } // set_CustomColumn + + /** + * Set (numeric) Key Value + * + * @param ColumnName + * column name + * @param value + * value + */ + private void set_Keys(String ColumnName, Object value) { + // Update if KeyColumn + for (int i = 0; i < m_IDs.length; i++) { + if (ColumnName.equals(m_KeyColumns[i])) { + m_IDs[i] = value; + } + } // for all key columns + } // setKeys + + /************************************************************************** + * Get Column Count + * + * @return column count + */ + public int get_ColumnCount() { + return p_info.getColumnCount(); + } // getColumnCount + + /** + * Get Column Name + * + * @param index + * index + * @return ColumnName + */ + public String get_ColumnName(int index) { + return p_info.getColumnName(index); + } // getColumnName + + /** + * Get Column Label + * + * @param index + * index + * @return Column Label + */ + protected String get_ColumnLabel(int index) { + return p_info.getColumnLabel(index); + } // getColumnLabel + + /** + * Get Column Description + * + * @param index + * index + * @return column description + */ + protected String get_ColumnDescription(int index) { + return p_info.getColumnDescription(index); + } // getColumnDescription + + /** + * Is Column Mandatory + * + * @param index + * index + * @return true if column mandatory + */ + protected boolean isColumnMandatory(int index) { + return p_info.isColumnMandatory(index); + } // isColumnNandatory + + /** + * Is Column Updateable + * + * @param index + * index + * @return true if column updateable + */ + protected boolean isColumnUpdateable(int index) { + return p_info.isColumnUpdateable(index); + } // isColumnUpdateable + + /** + * Set Column Updateable + * + * @param index + * index + * @param updateable + * column updateable + */ + protected void set_ColumnUpdateable(int index, boolean updateable) { + p_info.setColumnUpdateable(index, updateable); + } // setColumnUpdateable + + /** + * Set all columns updateable + * + * @param updateable + * updateable + */ + protected void setUpdateable(boolean updateable) { + p_info.setUpdateable(updateable); + } // setUpdateable + + /** + * Get Column DisplayType + * + * @param index + * index + * @return display type + */ + public String get_ColumnDisplayType(int index) { + return p_info.getColumnDisplayType(index); + } // getColumnDisplayType + + /** + * Get Lookup + * + * @param index + * index + * @return Lookup or null + */ + // protected Lookup get_ColumnLookup(int index) + // { + // return p_info.getColumnLookup(index); + // } // getColumnLookup + + /** + * Get Column Index + * + * @param columnName + * column name + * @return index of column with ColumnName or -1 if not found + */ + public final int get_ColumnIndex(String columnName) { + return p_info.getColumnIndexByName(columnName); + } // getColumnIndex + + /** + * Get Display Value of value + * + * @param columnName + * columnName + * @param currentValue + * current value + * @return String value with "./." as null + */ + public String get_DisplayValue(String columnName, boolean currentValue, + DateTimeZone timezone) { + Object value = currentValue ? get_Value(columnName) + : get_ValueOld(columnName); + if (value == null) + return "./."; + String retValue = value.toString(); + int index = get_ColumnIndex(columnName); + if (index < 0) + return retValue; + String dt = get_ColumnDisplayType(index); + if (DisplayType.isText(dt) || DisplayType.isID(dt) + || DisplayType.Integer.equals(dt)) { + return retValue; + }else if(DisplayType.Number.equals(dt)){ + String formatStr = get_ColumnDescription(index); + DecimalFormat format = null; + if(StringUtil.isEmpty(formatStr) || !(formatStr.contains("#") || formatStr.contains("0"))){ + format = new DecimalFormat("#.####"); + }else{ + format = new DecimalFormat(formatStr); + } + return format.format(value); + } + else if (DisplayType.YesNo.equals(dt) + || DisplayType.ENUMERATE.equals(dt) || DisplayType.STATUS.equals(dt)) { + if (m_custom != null) { + return m_custom.get(columnName); + } else { + return null; + } + } else if (DisplayType.Money.equals(dt)) { + + String formatStr = get_ColumnDescription(index); + DecimalFormat format = null; + if(StringUtil.isEmpty(formatStr) || !(formatStr.contains("#") || formatStr.contains("0"))){ + format = new DecimalFormat("#,##0.00"); + }else{ + format = new DecimalFormat(formatStr); + } + return format.format(value); + } else if (DisplayType.Date.equals(dt)) { + DateTime date = (DateTime)value; + date.withZone(timezone); + return ExDateUtil.convertDateToString(date, ExDateUtil.YYYY_MM_DD); + } else if (DisplayType.DateTime.equals(dt)) { + DateTime date = (DateTime)value; + date.withZone(timezone); + return ExDateUtil.convertDateToString(date, + ExDateUtil.YYYY_MM_DD_HH_MM_SS); + } else if (DisplayType.List.equals(dt)) { + return null; + } else if (DisplayType.Binary.equals(dt)) { + return m_custom.get(columnName); + } else if (dt.length() == 36) { + // deal with the Entity Object, return entity's displayName + return m_custom.get(columnName); + } + + return retValue; + } // get_DisplayValue + + /** + * Copy old values of From to new values of To. Does not copy Keys + * + * @param from + * old, existing & unchanged PO + * @param to + * new, not saved PO + * @param orgId + * client + * @param departId + * org + */ + protected static void copyValues(GeneralPO from, GeneralPO to, int orgId, + int departId) { + copyValues(from, to); + to.setOrgId(orgId); + to.setDepartId(departId); + } // copyValues + + /** + * Copy old values of From to new values of To. Does not copy Keys and + * orgId/departId + * + * @param from + * old, existing & unchanged PO + * @param to + * new, not saved PO + */ + public static void copyValues(GeneralPO from, GeneralPO to) { + // s_log.fine("From ID=" + from.get_ID() + " - To ID=" + to.get_ID()); + // Different Classes + if (from.getClass() != to.getClass()) { + for (int i1 = 0; i1 < from.m_oldValues.length; i1++) { + if (from.p_info.isVirtualColumn(i1) || from.p_info.isKey(i1)) // KeyColumn + continue; + String colName = from.p_info.getColumnName(i1); + // Ignore Standard Values + if (colName.startsWith("CREATE") + || colName.startsWith("UPDATE") + || colName.equals(ISACTIVE) || colName.equals(ORGID) + || colName.equals(DEPARTID) + || colName.equals(PROCESSINGE)) + ; // ignore + else { + for (int i2 = 0; i2 < to.m_oldValues.length; i2++) { + if (to.p_info.getColumnName(i2).equals(colName)) { + to.m_newValues[i2] = from.m_oldValues[i1]; + break; + } + } + } + } // from loop + } else // same class + { + for (int i = 0; i < from.m_oldValues.length; i++) { + if (from.p_info.isVirtualColumn(i) || from.p_info.isKey(i)) // KeyColumn + continue; + String colName = from.p_info.getColumnName(i); + // Ignore Standard Values + if (colName.startsWith("CREATE") + || colName.startsWith("UPDATE") + || colName.equals(ISACTIVE) || colName.equals(ORGID) + || colName.equals(DEPARTID) + || colName.equals(PROCESSINGE)) + ; // ignore + else + to.m_newValues[i] = from.m_oldValues[i]; + } + } // same class + } // copy + + /** + * (re)Load record with m_ID[*] + * + * @param trxName + * transaction + * @return true if loaded + */ + + /** + * Create Hashmap with data as Strings + * + * @return HashMap + */ + protected HashMap get_HashMap() { + HashMap hmOut = new HashMap(); + int size = get_ColumnCount(); + for (int i = 0; i < size; i++) { + Object value = get_Value(i); + // Don't insert NULL values (allows Database defaults) + if (value == null || p_info.isVirtualColumn(i)) + continue; + // Display Type + String dt = p_info.getColumnDisplayType(i); + // Based on class of definition, not class of value + Class c = p_info.getColumnClass(i); + String stringValue = null; + if (c == Object.class) + ; // saveNewSpecial (value, i)); + else if (value == null || value.equals(NULL)) + ; + else if (value instanceof Integer || value instanceof BigDecimal) + stringValue = value.toString(); + else if (c == Boolean.class) { + boolean bValue = false; + if (value instanceof Boolean) + bValue = ((Boolean) value).booleanValue(); + else + bValue = "Y".equals(value); + stringValue = bValue ? "Y" : "N"; + } else if (value instanceof DateTime) + stringValue = value.toString(); + else if (c == String.class) + stringValue = (String) value; + else if (DisplayType.isLOB(dt)) + ; + else + ; // saveNewSpecial (value, i)); + // + if (stringValue != null) + hmOut.put(p_info.getColumnName(i), stringValue); + } + // Custom Columns + if (m_custom != null) { + Iterator it = m_custom.keySet().iterator(); + while (it.hasNext()) { + String column = (String) it.next(); + // int index = p_info.getColumnIndex(column); + String value = (String) m_custom.get(column); + if (value != null) + hmOut.put(column, value); + } +// m_custom = null; + } + return hmOut; + } // get_HashMap + + /** + * Load is complete + * + * @param success + * success To be extended by sub-classes + */ + protected void loadComplete(boolean success) { + } // loadComplete + + /** + * Load Defaults + */ + protected void loadDefaults() { + setStandardDefaults(); + int size = get_ColumnCount(); + for (int index = 0; index < size; index++) { + // FIXME: 环境变量的处理,当前用户、部门�?组织 + if (p_info.isVirtualColumn(index) || (m_oldValues[index] != null) + || m_newValues[index] != null)// || + // !p_info.isColumnMandatory(index)) + continue; + String colName = p_info.getColumnName(index); + Class clazz = p_info.getColumnClass(index); + String defaultObject = p_info.getDefaultLogic(index); + if (StringUtil.isEmpty(defaultObject)) { + continue; + } + if (clazz == Integer.class) + m_oldValues[index] = decrypt(index, + Integer.parseInt(defaultObject)); + else if (clazz == BigDecimal.class) + m_oldValues[index] = decrypt(index, + Double.parseDouble(defaultObject)); + else if (clazz == Boolean.class) { + Object obj = decrypt(index, defaultObject); + if (obj == null) { + m_oldValues[index] = null; + } else if ("true".equalsIgnoreCase(obj.toString()) + || obj.equals("1")) { + m_oldValues[index] = new Boolean("True"); + } else if ("false".equalsIgnoreCase(obj.toString()) + || obj.equals("0")) { + m_oldValues[index] = new Boolean("False"); + } + } else if (clazz == DateTime.class) + m_oldValues[index] = decrypt(index, + DateTime.parse(defaultObject)); + // else if (DisplayType.isLOB(dt)) + // m_oldValues[index] = get_LOB (rs.getObject(columnName)); + else if (clazz == String.class) + m_oldValues[index] = decrypt(index, defaultObject); + else + m_oldValues[index] = defaultObject; + } + // + /** @todo defaults from Field */ + // MField.getDefault(p_info.getDefaultLogic(i)); + } // loadDefaults + + /** + * Set Default values. Client, Org, Created/Updated, *By, IsActive + */ + protected void setStandardDefaults() { + int size = get_ColumnCount(); + for (int i = 0; i < size; i++) { + // FIXME: 环境变量的处理,当前用户、部门�?组织 + if (p_info.isVirtualColumn(i) || m_oldValues[i] != null) + continue; + String colName = p_info.getColumnName(i); + if (CREATETIME.equals(colName) || UPDATETIME.equals(colName)) + m_newValues[i] = new DateTime(System.currentTimeMillis()); + else if ((CREATEBY.equals(colName) || UPDATEBY.equals(colName)) && p_ctx != null) + m_newValues[i] = p_ctx.get(LoggedInUser.CURRENTUSER); + else if (colName.equals(p_info.getTableName() + GeneralPO.KEYEND)) // KeyColumn + m_newValues[i] = NULL; + else if (ISACTIVE.equals(colName)) + m_newValues[i] = new Boolean(true); + else if (DEPARTID.equals(colName) && p_ctx != null) + m_newValues[i] = p_ctx.get(LoggedInUser.CURRENTDEPART); + else if (ORGID.equals(colName) && p_ctx != null) + m_newValues[i] = getOrgId((String)get_Value(ProcessCoreService.PROJECTID)); + else if (PROCESSED.equals(colName)) + m_newValues[i] = new Boolean(false); + else if (PROCESSINGE.equals(colName)) + m_newValues[i] = new Boolean(false); + else if (VERSION.equals(colName)) + m_newValues[i] = new Integer(0); + } + } // setDefaults + + /** + * Set Key Info (IDs and KeyColumns). + */ + private void setKeyInfo() { + // FIXME id的处理方式,待调整 + // Search for Primary Key + for (int i = 0; i < p_info.getColumnCount(); i++) { + if (p_info.isKey(i)) { + String ColumnName = p_info.getColumnName(i); + m_KeyColumns = new String[] { ColumnName }; + + m_IDs = new Object[] { get_Value(i) }; + + return; + } + } // primary key search + + } // setKeyInfo + + /************************************************************************** + * Are all mandatory Fields filled (i.e. can we save)?. Stops at first null + * mandatory field + * + * @return true if all mandatory fields are ok + */ + protected boolean isMandatoryOK() { + int size = get_ColumnCount(); + for (int i = 0; i < size; i++) { + if (p_info.isColumnMandatory(i)) { + if (p_info.isVirtualColumn(i)) + continue; + if (get_Value(i) == null || get_Value(i).equals(NULL)) { + return false; + } + } + } + return true; + } // isMandatoryOK + + /************************************************************************** + * Set AD_Client + * + * @param orgId + * client + */ + protected void setOrgId(int orgId) { + set_ValueNoCheck(ORGID, new Integer(orgId)); + } // setorgId + + /** + * Get AD_Client + * + * @return orgId + */ + public final int getOrgId() { + Integer ii = (Integer) get_Value(ORGID); + if (ii == null) + return 0; + return ii.intValue(); + } // getorgId + + /** + * Set AD_Org + * + * @param departId + * org + */ + public void setDepartId(int departId) { + set_ValueNoCheck(DEPARTID, new Integer(departId)); + } // setdepartId + + /** + * Get AD_Org + * + * @return departId + */ + public int getDepartId() { + Integer ii = (Integer) get_Value(DEPARTID); + if (ii == null) + return 0; + return ii.intValue(); + } // getdepartId + + /** + * Overwrite Client Org if different + * + * @param orgId + * client + * @param departId + * org + */ + protected void setClientOrg(int orgId, int departId) { + if (orgId != getOrgId()) + setOrgId(orgId); + if (departId != getDepartId()) + setDepartId(departId); + } // setClientOrg + + /** + * Overwrite Client Org if different + * + * @param po + * persistent object + */ + protected void setClientOrg(GeneralPO po) { + setClientOrg(po.getOrgId(), po.getDepartId()); + } // setClientOrg + + /** + * Set Active + * + * @param active + * active + */ + public final void setIsActive(boolean active) { + set_Value(ISACTIVE, new Boolean(active)); + } // setActive + + /** + * Is Active + * + * @return is active + */ + public final boolean isActive() { + Boolean bb = (Boolean) get_Value(ISACTIVE); + if (bb != null) + return bb.booleanValue(); + return false; + } // isActive + + /** + * Get Created + * + * @return created + */ + final public DateTime getCreated() { + return (DateTime) get_Value(CREATETIME); + } // getCreated + + /** + * Get Updated + * + * @return updated + */ + final public DateTime getUpdated() { + return (DateTime) get_Value(UPDATETIME); + } // getUpdated + + /** + * Get CreatedBy + * + * @return AD_User_ID + */ + final public int getCreatedBy() { + Integer ii = (Integer) get_Value(CREATEBY); + if (ii == null) + return 0; + return ii.intValue(); + } // getCreateddBy + + /** + * Get UpdatedBy + * + * @return AD_User_ID + */ + final public int getUpdatedBy() { + Integer ii = (Integer) get_Value(UPDATEBY); + if (ii == null) + return 0; + return ii.intValue(); + } // getUpdatedBy + + /** + * Set UpdatedBy + * + * @param AD_User_ID + * user + */ + final protected void setUpdatedBy(int AD_User_ID) { + set_ValueNoCheck(UPDATEBY, new Integer(AD_User_ID)); + } // setAD_User_ID + + /** + * Is new record + * + * @return true if new + */ + public boolean is_new() { + // FIXME id 的处理方式,uuid + if (m_createNew) + return true; + // + for (int i = 0; i < m_IDs.length; i++) { + if (m_IDs[i] == NULL || m_IDs[i] == null) + continue; + return false; // one value is non-zero + } + return true; + } // is_new + + /** + * Is there a Change to be saved? + * + * @return true if record changed + */ + public boolean is_Changed() { + int size = get_ColumnCount(); + for (int i = 0; i < size; i++) { + // Test if the column has changed - teo_sarca [ 1704828 ] + if (is_ValueChanged(i)) + return true; + } +// if (m_custom != null && m_custom.size() > 0) +// return true; // there are custom columns modified + return false; + } // is_Change + + /** + * Create Single/Multi Key Where Clause + * + * @param withValues + * if true uses actual values otherwise ? + * @return where clause + */ + public StringBuffer get_WhereClause(boolean withValues) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < m_IDs.length; i++) { + if (i != 0) + sb.append(" AND "); + sb.append(m_KeyColumns[i]).append("="); + if (withValues) { + + sb.append("'").append(m_IDs[i]).append("'"); + } else + sb.append("?"); + } + return sb; + } // getWhereClause + + public StringBuffer get_SearchWhereClause(Map map) { + List list = get_searchWhereWithPrefix(map, "P"); + StringBuffer where = new StringBuffer(); + while (list.size() > 1) { + where.append(list.remove(1)); + where.append(" "); + } + where.append(" WHERE 1=1 "); + StringBuffer w = list.remove(0); + if (w.length() > 2) { + where.append(" ").append(w); + } + return where; + } // getWher + + public List get_searchWhereWithPrefix(Map map, String pre) { + List list = new ArrayList(); + StringBuffer sb = new StringBuffer(); + list.add(sb); + int size = get_ColumnCount(); + String fuzzyCondition = (String) map.get(POJOCRUDService.FUZZY_QUERY); + StringBuffer whereFuzzyQuery = new StringBuffer(); + boolean first = true; + for (int index = 0; index < size; index++) { + String columnName = p_info.getColumnName(index); + Class clazz = p_info.getColumnClass(index); + String dt = p_info.getColumnDisplayType(index); + Object obj = map.get(columnName); + addFuzzyQuery(fuzzyCondition, whereFuzzyQuery, list, columnName, + index, pre, dt, clazz, obj, + (List) map.get(POJOCRUDService.RETURN_COLUMNS_LIST)); + try { + if (obj != null && !"".equals(obj.toString())) { + String op = (String) map.get(columnName + OP); + if (StringUtil.isEmpty(op)) { + op = " AND "; + } else { + op = " " + op + " "; + } + sb.append(op); + columnName = pre + "." + columnName; + if (NULL.equals(obj.toString())) { + sb.append(columnName + " IS NULL "); + } else if (obj instanceof CustomSearchConditional) { + CustomSearchConditional cond = (CustomSearchConditional) obj; + if (StringUtil.isEmpty(cond.getConditional())) { + if (sb.length() > 0) { + sb.setLength(sb.length() - op.length()); + } + } else { + sb.append("(").append(cond.getConditional()) + .append(")"); + } + } else if (clazz == Integer.class) { + if (obj instanceof List) { + processListIn(sb, columnName, (List) obj, false); + } else if (obj instanceof int[] + || obj instanceof Integer[]) { + processRang(sb, columnName, (Object[]) obj); + } else if (DisplayType.STATUS.equals(dt)) { + if (obj.equals(1)) { + sb.append(pre) + .append(".") + .append(p_info.getKeyColumnName()) + .append(" NOT IN ( SELECT BUSINESSKEY FROM SYS_DATASTATUS WHERE TABLENAME = '") + .append(get_TableName()).append("') "); + }else{ + sb.setLength(sb.length() - op.length()); + StringBuffer sub = new StringBuffer(); + String subPre = pre + pre + index; + sub.append(" INNER JOIN ").append("SYS_DATASTATUS") + .append(" AS ").append(subPre); + sub.append(" ON ").append(subPre).append(".") + .append("TABLENAME='") + .append(get_TableName()).append("' AND ") + .append(subPre).append(".") + .append("BUSINESSKEY").append("=") + .append(pre).append(".").append(p_info.getKeyColumnName()) + .append(" AND ").append(subPre).append(".") + .append("DATASTATUS=") + .append(obj.toString()).append(" "); + list.add(sub); + } + } else { + sb.append(columnName + " = " + obj.toString()); + } + } else if (clazz == BigDecimal.class) { + if (obj instanceof List) { + processListIn(sb, columnName, (List) obj, false); + } else if (obj instanceof Double[] + || obj instanceof BigDecimal[] + || obj instanceof double[]) { + processRang(sb, columnName, (Object[]) obj); + } else { + sb.append(columnName + " = " + obj.toString()); + } + } else if (clazz == Boolean.class) { + if (obj instanceof Integer) { + sb.append(columnName + " = " + obj); + } else { + sb.append(columnName + + " = " + + ("true".equalsIgnoreCase(obj.toString()) ? 1 + : 0)); + } + } else if (clazz == DateTime.class) + if (obj instanceof DateTime[]) { + sb.append("("); + if (((DateTime[]) obj)[0] != null) { + sb.append(columnName + " >= " + + ((DateTime[]) obj)[0].getMillis()); + } + if (((DateTime[]) obj)[0] != null + && ((DateTime[]) obj)[1] != null) { + sb.append(" AND "); + } + if (((DateTime[]) obj)[1] != null) { + sb.append(columnName + " <= " + + ((DateTime[]) obj)[1].getMillis()); + } + sb.append(")"); + if (((DateTime[]) obj)[0] == null + && ((DateTime[]) obj)[1] == null) { + sb.setLength(sb.length() - op.length() - 2); + } + } else if (obj instanceof Date[]) { + + sb.append("("); + if (((Date[]) obj)[0] != null) { + sb.append(columnName + " >= " + + ((Date[]) obj)[0].getTime()); + } + if (((Date[]) obj)[0] != null + && ((Date[]) obj)[1] != null) { + sb.append(" AND "); + } + if (((Date[]) obj)[1] != null) { + sb.append(columnName + " <= " + + ((Date[]) obj)[1].getTime()); + } + sb.append(")"); + if (((Date[]) obj)[0] == null + && ((Date[]) obj)[1] == null) { + sb.setLength(sb.length() - op.length() - 2); + } + } else { + sb.append(columnName + " = " + + new DateTime(obj).getMillis()); + } + // else if (DisplayType.isLOB(dt)) + // m_oldValues[index] = get_LOB (rs.getObject(columnName)); + else if (clazz == String.class) { + if (obj instanceof List) { + processListIn(sb, columnName, (List) obj, true); + } else { + sb.append(columnName + " like '%" + + obj.toString().trim() + "%'"); + } + } else if (clazz == Object.class) { + if (obj instanceof Map && ((Map) obj).size() > 0) { + sb.setLength(sb.length() - op.length()); + String tableName = p_info.getReferenceTable(index); + POJOInfo info = POInfo.getPOInfo(tableName); + String keyCol = info.getKeyColumnName(); + StringBuffer sub = new StringBuffer(); + String subPre = pre + pre + index; + sub.append(" INNER JOIN ").append(tableName) + .append(" AS ").append(subPre); + sub.append(" ON ").append(subPre).append(".") + .append(keyCol).append("=") + .append(columnName).append(" "); + list.add(sub); + GeneralPO subPo = new GeneralPO(tableName, + new HashMap(), p_ctx); + List subList = subPo + .get_searchWhereWithPrefix((Map) obj, + subPre); + if (subList.size() > 0) { + StringBuffer subWhere = subList.remove(0); + sb.append(subWhere); + list.addAll(subList); + } + + } else if (obj instanceof List + && ((List) obj).size() > 0) { + sb.append(columnName).append(" IN ("); + boolean isfirst = true; + for (String subId : (List) obj) { + if (isfirst) { + isfirst = false; + } else { + sb.append(","); + } + sb.append("'").append(subId).append("'"); + } + sb.append(") "); + } else { + sb.append(columnName + " = '" + obj.toString() + + "'"); + } + } else if (clazz == List.class && obj instanceof Map + && ((Map) obj).size() > 0) { + sb.setLength(sb.length() - op.length()); + String tableName = p_info.getReferenceValueTable(index); + String foreignColumn = p_info + .getReferenceValueColumnName(index); + POJOInfo info = POInfo.getPOInfo(tableName); + StringBuffer sub = new StringBuffer(); + String subPre = pre + pre + index; + sub.append(" INNER JOIN ").append(tableName) + .append(" AS ").append(subPre); + sub.append(" ON ").append(subPre).append(".") + .append(foreignColumn).append("=").append(pre) + .append(".").append(m_KeyColumns[0]) + .append(" "); + if (info.getTableType() == Entity.MIDTABLE) { + int otherColIndex = foreignColumn.equals(info + .getColumnName(0)) ? 1 : 0; + String otherTableName = info + .getReferenceTable(otherColIndex); + String otherPre = pre + subPre; + sub.append(" INNER JOIN ").append(otherTableName) + .append(" AS ").append(otherPre) + .append(" ON ").append(otherPre) + .append(".").append(otherTableName) + .append("_ID").append("=").append(subPre) + .append(".") + .append(info.getColumnName(otherColIndex)) + .append(" "); + // if table type is mid table , the pre and + // tableName should be repeat value + subPre = otherPre; + tableName = otherTableName; + } + list.add(sub); + GeneralPO subPo = new GeneralPO(tableName, + new HashMap(), p_ctx); + List subList = subPo + .get_searchWhereWithPrefix((Map) obj, subPre); + if (subList.size() > 0) { + StringBuffer subWhere = subList.remove(0); + sb.append(subWhere); + list.addAll(subList); + } + } else { + // log + if (sb.length() > 0) { + sb.setLength(sb.length() - op.length()); + } + } + } + } catch (Exception e) { + e.printStackTrace(); // @Trifon - MySQL Port + } + } + if (sb.toString().endsWith(" AND ")) { + sb.setLength(sb.length() - 5); + } else if (sb.toString().endsWith(" OR ")) { + sb.setLength(sb.length() - 4); + } + if (whereFuzzyQuery.length() > 0) { + sb.append(" AND (").append(whereFuzzyQuery).append(") "); + } + return list; + } + + /** + * 处理全表虚拟字段查询 + * @param fuzzyCondition 模糊查询条件 + * @param whereBuffer 模式条件 + * @param list 整理组装list + * @param columnName 列名 + * @param index 索引 + * @param pre 前缀 + * @param dt 字段显示类别 + * @param clazz 字段对象类型 + * @param value 该字段本身的精确查询条件值,存在话,不用加关联表部分。 + */ + private void addFuzzyQuery(String fuzzyCondition, StringBuffer whereBuffer, + List list, String columnName, int index, String pre, + String dt, Class clazz, Object value, + List return_column_list) { + if (!StringUtil.isEmpty(fuzzyCondition) && return_column_list != null + && return_column_list.contains(columnName) + && !DisplayType.ID.equals(dt)) { + if (clazz == String.class && !p_info.isVirtualColumn(index)) { + if (whereBuffer.length() > 0) { + whereBuffer.append(" OR "); + } + whereBuffer.append(pre).append(".").append(columnName) + .append(" ilike '%").append(fuzzyCondition) + .append("%' "); + } else if (clazz == Object.class && !p_info.isVirtualColumn(index)) { + + processMultiEntity(pre, whereBuffer, value, index, columnName, fuzzyCondition, list, p_info); +// String subPre = pre + pre + index; +// String tableName = p_info.getReferenceTable(index); +// POJOInfo info = POInfo.getPOInfo(tableName); +// int displayIndex = info.getDisplayIndex(); +// // 虚拟字段不予处理 +// if (info.isVirtualColumn(displayIndex)) { +// return; +// } +// String displayColumnName = info.getColumnName(info +// .getDisplayIndex()); +// if (value == null +// || !(value instanceof Map && ((Map) value).size() > 0)) { +// String keyCol = info.getKeyColumnName(); +// StringBuffer sub = new StringBuffer(); +// //此处用left join 因为关联的对象可能未必必填。 +// sub.append(" LEFT JOIN ").append(tableName).append(" AS ") +// .append(subPre); +// sub.append(" ON ").append(subPre).append(".") +// .append(keyCol).append("=").append(pre).append(".").append(columnName) +// .append(" "); +// list.add(sub); +// } +// if (whereBuffer.length() > 0) { +// whereBuffer.append(" OR "); +// } +// whereBuffer.append(subPre).append(".") +// .append(displayColumnName).append(" like '%") +// .append(fuzzyCondition).append("%' "); + } + } + } + + private void processMultiEntity(String pre, StringBuffer whereBuffer, Object value, int index, + String columnName, String fuzzyCondition, List list, POJOInfo pinfo){ + String subPre = pre + pre + index; + String tableName = pinfo.getReferenceTable(index); + POJOInfo info = POInfo.getPOInfo(tableName); + int displayIndex = info.getDisplayIndex(); + Class c = info.getColumnClass(displayIndex); + // 虚拟字段不予处理 + if (info.isVirtualColumn(displayIndex)) { + int count = info.getColumnCount(); + String keyCol = info.getKeyColumnName(); + StringBuffer sub = new StringBuffer(); + for(int i = 0; i < count; i++){ + if(info.isCombidentifier(i) && info.getColumnDisplayType(i).equals(DisplayType.String)){ + String combidentifierCol = info.getColumnName(i); + if ((value == null + || !(value instanceof Map && ((Map) value).size() > 0)) && sub.length() == 0) { + // 此处用left join 因为关联的对象可能未必必填。 + sub.append(" LEFT JOIN ").append(tableName).append(" AS ") + .append(subPre); + sub.append(" ON ").append(subPre).append(".").append(keyCol) + .append("=").append(pre).append(".").append(columnName) + .append(" "); + list.add(sub); + } + if (c == Object.class && !info.isVirtualColumn(index)) { + processMultiEntity(subPre, whereBuffer, value, displayIndex, + combidentifierCol, fuzzyCondition, list, info); + } else if (c == String.class) { + if (whereBuffer.length() > 0) { + whereBuffer.append(" OR "); + } + whereBuffer.append(subPre).append(".") + .append(combidentifierCol).append(" like '%") + .append(fuzzyCondition).append("%' "); + } + } + } + } else { + String displayColumnName = info.getColumnName(info + .getDisplayIndex()); + if (value == null + || !(value instanceof Map && ((Map) value).size() > 0)) { + String keyCol = info.getKeyColumnName(); + StringBuffer sub = new StringBuffer(); + // 此处用left join 因为关联的对象可能未必必填。 + sub.append(" LEFT JOIN ").append(tableName).append(" AS ") + .append(subPre); + sub.append(" ON ").append(subPre).append(".").append(keyCol) + .append("=").append(pre).append(".").append(columnName) + .append(" "); + list.add(sub); + } + if (c == Object.class && !info.isVirtualColumn(index)) { + processMultiEntity(subPre, whereBuffer, value, displayIndex, + displayColumnName, fuzzyCondition, list, info); + } else if (c == String.class) { + if (whereBuffer.length() > 0) { + whereBuffer.append(" OR "); + } + whereBuffer.append(subPre).append(".") + .append(displayColumnName).append(" like '%") + .append(fuzzyCondition).append("%' "); + } + } + } + + private void processListIn(StringBuffer sb, String columnName, List obj, + boolean isText) { + if (obj != null && obj.size() > 0) { + sb.append(columnName).append(" IN ("); + List objList = (List) obj; + int oriLength = sb.length(); + for (Object ele : objList) { + if (ele != null) { + if (sb.length() > oriLength) { + sb.append(","); + } + if (isText) { + sb.append(StringUtil.TO_STRING(ele.toString(), 0)); + } else { + sb.append(ele.toString()); + } + } + } + sb.append(")"); + } + } + + private void processRang(StringBuffer sb, String columnName, Object[] obj){ + if(obj != null && obj.length == 2){ + sb.append("(").append(columnName).append(" >= ").append(obj[0]); + sb.append(" AND ").append(columnName).append(" <= ").append(obj[1]).append(")"); + } + } + + /** + * Get the Column Processing index + * + * @return index or -1 + */ + private int get_ProcessingIndex() { + return p_info.getColumnIndexByName(PROCESSINGE); + } // getProcessingIndex + + /** + * Get Find parameter. Convert to upper case and add % at the end + * + * @param query + * in string + * @return out string + */ + protected static String getFindParameter(String query) { + if (query == null) + return null; + if (query.length() == 0 || query.equals("%")) + return null; + if (!query.endsWith("%")) + query += "%"; + return query.toUpperCase(); + } // getFindParameter + + /** Table ID Attribute */ + protected final static String XML_ATTRIBUTE_AD_Table_ID = "AD_Table_ID"; + /** Record ID Attribute */ + protected final static String XML_ATTRIBUTE_Record_ID = "Record_ID"; + + /* + * Doc - To be used on ModelValidator to get the corresponding Doc from the + * PO + */ + // private Doc m_doc; + // + // /** + // * Set the accounting document associated to the PO - for use in POST + // ModelValidator + // * @param doc Document + // */ + // public void setDoc(Doc doc) { + // m_doc = doc; + // } + + public void setReplication(boolean isFromReplication) { + m_isReplication = isFromReplication; + } + + public boolean isReplication() { + return m_isReplication; + } + + /** + * Set the accounting document associated to the PO - for use in POST + * ModelValidator + * + * @return Doc Document + */ + // public Doc getDoc() { + // return m_doc; + // } + + /** + * Get Integer Value + * + * @param columnName + * @return int value + */ + public int get_ValueAsInt(String columnName) { + int idx = get_ColumnIndex(columnName); + if (idx < 0) { + return 0; + } + return get_ValueAsInt(idx); + } + + /** + * Get value as Boolean + * + * @param columnName + * @return boolean value + */ + public boolean get_ValueAsBoolean(String columnName) { + Object oo = get_Value(columnName); + if (oo != null) { + if (oo instanceof Boolean) + return ((Boolean) oo).booleanValue(); + else if (oo instanceof Integer) { + return oo.equals(1); + } + return "Y".equals(oo); + } + return false; + } + + public StringBuffer getSelectBuild(){ + return p_info.buildSelect(); + } + + public StringBuffer getSelectBuild(List cols) { + if(cols == null || cols.size() == 0){ + return p_info.buildSelect(); + } + return p_info.buildSelect(cols); + } + + /** + * 查询叶子节点,遍历其上级节点 + * @param cols cols中必须包含parentColumn + * @param map + * @param parentColumnName + * @return + */ + public StringBuffer getWithRecursive(List cols, Map map, String parentColumnName, String privilege) { + int size = p_info.getColumnCount(); + if (size <= 0) { + return null; + } + boolean first = true; + boolean hasList = false; + StringBuffer select = new StringBuffer("WITH RECURSIVE res AS ( "); + StringBuffer union = new StringBuffer(" UNION "); + StringBuffer returnSelect = new StringBuffer(" SELECT "); + for (int i = 0; i < size; i++) { + String columnName = p_info.getColumnName(i); + if (cols != null && cols.contains(columnName)) { + if (DisplayType.List.equals(p_info.getColumnDisplayType(i))) { + hasList = true; + continue; + } + if(p_info.isVirtualColumn(i)){ + cols.remove(i); + continue; + } + if (!first) { + returnSelect.append(","); + } + returnSelect.append(columnName); + first = false; + } + + } + select.append(" FROM ").append(p_info.buildSelect(cols, "P")).append(" ").append(get_SearchWhereClause(map)).append(privilege); + select.append(union).append(p_info.buildSelect(cols, "CH")).append(" INNER JOIN res AS re ON re."); + select.append(parentColumnName).append("=CH.").append(p_info.getKeyColumnName()).append(")"); + + select.append("\n"); + returnSelect.append(" FROM res; "); + + select.append(returnSelect); + + return select; + } + + public Map toMap() { +// Map map = new HashMap(); +// // FIXME:����ȥ��������ֶΣ���updateTime,updateUser...... +// int j = get_ColumnCount(); +// for (int i = 0; i < j; i++) { +// String key = get_ColumnName(i); +// // if( key != null ) { +// // key = key.toUpperCase(); +// // } +// map.put(key, get_Value(i)); +// } + return poToMap(this); + } + + private Map poToMap(GeneralPOJO po){ + Map map = toMap(po); + if(map == null){ + return new PojoMap(); + } + Set keys = map.keySet(); + for(String key : keys){ + Object oo = map.get(key); + if(oo instanceof List){ + boolean flag = false; + List> list = new ArrayList>(); + for(Object o : (List)oo){ + if(o instanceof GeneralPOJO){ + flag = true; + list.add(poToMap((GeneralPOJO)o)); + }else if(o != null){ + break; + } + } + if(flag){ + map.put(key, list); + } + + } + } + return map; + } + + private Map toMap(GeneralPOJO po) { + Map map = new PojoMap(); + int j = po.get_ColumnCount(); + for (int i = 0; i < j; i++) { + String key = po.get_ColumnName(i); + map.put(key+GeneralPOJO.DISPLAY,po.get_Value(key) == null?"":po.get_DisplayValue(key, true, DateTimeZone.getDefault())); + map.put(key, po.get_Value(i)); + } + return map; + } + + @Override + public String toDetail() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String toDifferent(LogItem oldObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isLog() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Object getValueAsType(int index, String displayType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getValueAsType(String columnName, String displayType) { + // TODO Auto-generated method stub + return null; + } + + public boolean isVirtualColumn(int index) { + return p_info.isVirtualColumn(index); + } + + @Override + public Class get_ColumnClass(int index) { + // TODO Auto-generated method stub + return p_info.getColumnClass(index); + } + + @Override + public String get_EntityDisplayName() { + int index = p_info.getDisplayIndex(); + return get_DisplayValue(get_ColumnName(index), true, null); + } + + public String get_referenceValueColumnName(int index) { + return p_info.getReferenceValueColumnName(index); + } + + @Override + public Object get_ValueNew(int index) { + if (index < 0 || index >= get_ColumnCount()) { + return null; + } + return m_newValues[index]; + } + + @Override + public POJOInfo get_poInfo() { + return p_info; + } + + @Override + public String get_EntityDisplayColumn() { + int index = p_info.getDisplayIndex(); + return get_ColumnName(index); + } + + @Override + public List get_ColumnsByDisplayType(String displayType) { + int count = get_ColumnCount(); + if (count > 0 && !StringUtil.isEmpty(displayType)) { + List list = new ArrayList(); + for (int i = 0; i < count; i++) { + String disType = get_ColumnDisplayType(i); + if (displayType.equals(disType)) { + list.add(get_ColumnName(i)); + } + } + return list; + } + return null; + } + + @Override + public boolean updateHierarchicalValue(String columnName, + List list) { + int index = get_ColumnIndex(columnName); + return updateHierarchicalValue(index, list); + + } + + @Override + public boolean updateHierarchicalValue(int index, List list) { + String type = get_ColumnDisplayType(index); + if (DisplayType.List.equals(type) || DisplayType.Binary.equals(type)) { + m_oldValues[index] = list; + return true; + } + return false; + } + + public GeneralPOJO getMainPO() { + return mainPO; + } + + public void setMainPO(GeneralPOJO mainPO) { + this.mainPO = mainPO; + } + + public String getOrgId(String projectId) { + String orgId = null; + if (!StringUtil.isEmpty(projectId)) { + orgId = projectOrgMap.get(projectId); + if (StringUtil.isEmpty(orgId)) { + ProjectSwitchService projectSwitchService = (ProjectSwitchService) SpringBeanOsgiServices.getInstance().getBeanByName("projectSwitchService"); + if(projectSwitchService != null){ + orgId = projectSwitchService.getProjectOrgId(projectId); + projectOrgMap.put(projectId, orgId); + } + } + } + if (StringUtil.isEmpty(orgId)) { + orgId = (String)p_ctx.get(LoggedInUser.CURRENTORG); + } + return orgId; + + } + + public Properties getCtx() { + return p_ctx; + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfo.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfo.java new file mode 100644 index 0000000..4fe0d9f --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfo.java @@ -0,0 +1,1155 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package com.dsasp.server.dataDic.bean; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.jdbc.support.rowset.SqlRowSet; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.bean.AbstractPOJOInfo; +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.Rule; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.function.GetServicesFunction; +import com.dsasp.server.common.privilege.bean.DataFilterRule; +import com.dsasp.server.common.privilege.service.DataPrivilegeService; +import com.dsasp.server.common.util.StringUtil; + + +/** + * Persistent Object Info. + * Provides structural information + * + * @author Jorg Janke + * @version $Id: POInfo.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $ + * @author Victor Perez, e-Evolution SC + *
  • [ 2195894 ] Improve performance in PO engine + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195894&group_id=176962&atid=879335 + */ +public class POInfo extends AbstractPOJOInfo implements Serializable +{ + /** Used by Remote FinReport */ + private static final long serialVersionUID = -5976719579744948419L; + +// private static CCache s_cache = new CCache("POInfo", 200); +// private static CCache s_cache = new CCache("POInfo", 200); + +// /** +// * POInfo Factory +// * @param ctx context +// * @param AD_Table_ID AD_Table_ID +// * @return POInfo +// */ +// public static POInfo getPOInfo (Properties ctx, String AD_Table_Name) +// { +// return getPOInfo(ctx, AD_Table_Name, null); +// } + + + + /** Cache of POInfo */ + + + + /************************************************************************** + * Create Persistent Info + * @param ctx context + * @param AD_Table_ID AD_ Table_ID + * @param baseLanguageOnly get in base language + * @param trxName transaction name + */ + public POInfo (String AD_Table_Name, SqlRowSet rs) + { +// m_ctx = ctx; + m_TableName = AD_Table_Name; + if(rs == null){ + throw new ValidationException("集合不能为空"); + } + loadInfo (rs); + } // PInfo + + /** Context */ +// private Properties m_ctx = null; + /** Table_ID */ + private String m_AD_Table_ID = null; + /** Table Name */ + private String m_TableName = null; + private String m_TableDisplayName = null; + /** Access Level */ + private int m_AccessLevel; + /** Columns */ + private POInfoColumn[] m_columns = null; + /** Table has Key Column */ + private boolean m_hasKeyColumn = false; + /** Table needs keep log*/ + private boolean m_IsChangeLog = false; + + private int displayIndex; + + private List listRule; + + private List dataFilterRules; + + private int tableType; + + + /** + * Load Table/Column Info + * @param baseLanguage in English + * @param trxName + */ + private void loadInfo (SqlRowSet rs) + { + ArrayList list = new ArrayList(); + +// SqlRowSet rs = null; + try + { +// rs = ((DataDicService)SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService")).loadInfo(m_TableName); + while (rs.next()) + { + if (m_TableName == null) + m_TableName = rs.getString(1); + String ColumnName = rs.getString(2); + String AD_Reference_ID = rs.getString(3); + boolean IsMandatory = rs.getInt(4) > 0; + boolean IsUpdateable = rs.getInt(5) < 1; + String DefaultLogic = rs.getString(6); + String Name = rs.getString(7); + String Description = rs.getString(8); + String AD_Column_ID = rs.getString(9); + boolean IsKey = rs.getInt(10) > 0; + if (IsKey) + m_hasKeyColumn = true; +// boolean IsParent = false; +// int AD_Reference_Value_ID = 0; + String ValidationCode = rs.getString(11); + int FieldLength = rs.getInt(12); + String ValueMin = rs.getString(13); + String ValueMax = rs.getString(14); +// boolean IsTranslated = false; + // + m_AccessLevel = rs.getInt(15); + String ColumnSQL = rs.getString(16); +// boolean IsEncrypted = false; +// boolean IsAllowLogging = false; + m_IsChangeLog = rs.getInt(17) > 0; + String reference_value_ID = rs.getString(18); + Boolean isDisplay = rs.getInt(19) > 0; + String enumeratType = rs.getString(20); + Boolean isIdentifier = rs.getInt(21) > 0; + Boolean iscombidentifier = rs.getInt(22) > 0; + tableType = rs.getInt(23); + m_AD_Table_ID = rs.getString(24); + m_TableDisplayName = rs.getString(25); + if(isDisplay){ + //this col add to the list equal the list size + displayIndex = list.size(); + } + + POInfoColumn col = new POInfoColumn ( + AD_Column_ID, ColumnName, ColumnSQL, AD_Reference_ID, + IsMandatory, IsUpdateable, + DefaultLogic, Name, Description, + IsKey, ValidationCode, + FieldLength, ValueMin, ValueMax, + m_IsChangeLog, reference_value_ID, enumeratType, isIdentifier, iscombidentifier); + list.add(col); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + // convert to array + m_columns = new POInfoColumn[list.size()]; + list.toArray(m_columns); + } // loadInfo + + private void loadReferenceValue(int index){ + if (DisplayType.List.equals(m_columns[index].displayType) && m_columns[index].referenceValue == null) { + DataDicService service = ((DataDicService) SpringBeanOsgiServices.getInstance() + .getBeanByName("dataDicService")); + String referenceValueId = m_columns[index].AD_Reference_Value_ID; + ReferenceValue value = new ReferenceValue(); + value.setEntityTable(service.getEntityTableNameByReferenceValue(referenceValueId)); + value.setColumnName(service.getColumnNameByReferenceValue(referenceValueId)); + m_columns[index].referenceValue = value; + } + } + + + /** + * String representation + * @return String Representation + */ + public String toString() + { + return "POInfo[" + getTableName() + ",AD_Table_ID=" + getAD_Table_ID() + "]"; + } // toString + + /** + * String representation for index + * @param index column index + * @return String Representation + */ + public String toString (int index) + { + if (index < 0 || index >= m_columns.length) + return "POInfo[" + getTableName() + "-(InvalidColumnIndex=" + index + ")]"; + return "POInfo[" + getTableName() + "-" + m_columns[index].toString() + "]"; + } // toString + + /** + * Get Table Name + * @return Table Name + */ + public String getTableName() + { + return m_TableName; + } // getTableName + + /** + * Get AD_Table_ID + * @return AD_Table_ID + */ + public String getAD_Table_ID() + { + return m_AD_Table_ID; + } // getAD_Table_ID + + /** + * Table has a Key Column + * @return true if has a key column + */ + public boolean hasKeyColumn() + { + return m_hasKeyColumn; + } // hasKeyColumn + + /** + * Get Table Access Level + * @return Table.ACCESS.. + */ + public int getAccessLevel() + { + return m_AccessLevel; + } // getAccessLevel + + /************************************************************************** + * Get ColumnCount + * @return column count + */ + public int getColumnCount() + { + return m_columns.length; + } // getColumnCount + + /** + * Get Column Index + * @param ColumnName column name + * @return index of column with ColumnName or -1 if not found + */ + public int getColumnIndexByName (String ColumnName) + { + for (int i = 0; i < m_columns.length; i++) + { + if(ColumnName == null || m_columns[i] == null){ +// System.out.println( ColumnName); + return -1; + } + if (ColumnName.equalsIgnoreCase(m_columns[i].ColumnName)) // teo_sarca : modified to compare ignoring case [ 1619179 ] + return i; + } + return -1; + } // getColumnIndex + + /** + * Get Column Index + * @param AD_Column_ID column + * @return index of column with ColumnName or -1 if not found + */ + public int getColumnIndexByID (String AD_Column_ID) + { + for (int i = 0; i < m_columns.length; i++) + { + if (AD_Column_ID.equals(m_columns[i].AD_Column_ID)) + return i; + } + return -1; + } // getColumnIndex + + /** + * @param columnName + * @return AD_Column_ID if found, -1 if not found + */ + public String getAD_Column_ID(String columnName) + { + for (int i = 0; i < m_columns.length; i++) + { + if (columnName.equalsIgnoreCase(m_columns[i].ColumnName)) // globalqss : modified to compare ignoring case [ 1619179 ] + return m_columns[i].AD_Column_ID; + } + return null; + } + + /** + * Get Column + * @param index index + * @return column + */ + protected POInfoColumn getColumn (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index]; + } // getColumn + + /** + * Get Column Name + * @param index index + * @return ColumnName column name + */ + public String getColumnName (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].ColumnName; + } // getColumnName + + /** + * Get Column SQL or Column Name + * @param index index + * @return ColumnSQL column sql or name + */ +// public String getColumnSQL (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return null; +// if(m_columns[index].displayType.equals(DisplayType.STATUS)){ +// return "(" + m_columns[index].ColumnSQL + "P." + getKeyColumnName() + ") AS " + m_columns[index].ColumnName;// + ", " + getColumnDisplaySQL(index, "P"); +// } +// else if (m_columns[index].ColumnSQL != null && m_columns[index].ColumnSQL.length() > 0){ +// return "(" + m_columns[index].ColumnSQL + ") AS " + m_columns[index].ColumnName; +// } else if(m_columns[index].displayType.length() == 36 || m_columns[index].ColumnClass == Object.class){ +// +// return m_columns[index].ColumnName + ", " + getColumnDisplaySQL(index, "P"); +//// }else if(m_columns[index].displayType.equals(DisplayType.ENUMERATE) || m_columns[index].displayType.equals(DisplayType.YesNo)){ +//// return m_columns[index].ColumnName + ", " + getColumnDisplaySQL(index, "P"); +// }else{ +// return m_columns[index].ColumnName; +// } +// } // getColumnSQL + + public String getColumnSQL (int index, String prefix, StringBuffer lateral) + { + if (index < 0 || index >= m_columns.length) + return null; + String str = null; + if (m_columns[index].displayType.equals(DisplayType.STATUS)) { + str = "(" + prefix + "STA.DATASTATUS" + + ") AS " + m_columns[index].ColumnName;// + ", " + + // getColumnDisplaySQL(index, + // "P"); + } else if (m_columns[index].ColumnSQL != null + && m_columns[index].ColumnSQL.length() > 0) { + lateral.append(" LEFT JOIN lateral (" + m_columns[index].ColumnSQL + ") AS ").append(m_columns[index].ColumnName).append("_LATERAL ON TRUE "); + str = m_columns[index].ColumnName + "_LATERAL." + m_columns[index].ColumnName; + } else { + str = m_columns[index].ColumnName; + } + + if (m_columns[index].displayType.length() == 36 + || m_columns[index].ColumnClass == Object.class) { + str = str + ", " + getColumnDisplaySQL(index, prefix, lateral); + } + return str; + } + + public String getColumnDisplaySQL(int index, String prefix, StringBuffer lateral) { + if (index < 0 || index >= m_columns.length) + return null; + // if(m_columns[index].displayType.equals(DisplayType.STATUS)){ + // return + // " (SELECT E.CODEDES FROM SYS_ENUMERATE AS E WHERE E.CODEVALUE= ( " + // + m_columns[index].ColumnSQL + // + " ) AND E.SYS_ENUMERATETYPE_ID = '" + // + m_columns[index].enumerateType + "') AS " + // + m_columns[index].ColumnName + GeneralPOJO.DISPLAY; + // } + // else + // if (m_columns[index].ColumnSQL != null && + // m_columns[index].ColumnSQL.length() > 0){ + // return "(" + m_columns[index].ColumnSQL + ") AS " + + // m_columns[index].ColumnName; + // } else + if (m_columns[index].displayType.length() == 36 + || m_columns[index].ColumnClass == Object.class) { + + return getEntityReferenceSQL(m_columns[index].displayType, + m_columns[index].ColumnName, m_columns[index].ColumnSQL, prefix, lateral); + } else if (m_columns[index].ColumnSQL != null + && m_columns[index].ColumnSQL.length() > 0) { + return " (" + m_columns[index].ColumnSQL + ") "; + }else if(m_columns[index].displayType.equals(DisplayType.ENUMERATE)){ + String displayPrefix = prefix + prefix; + lateral.append(" LEFT JOIN lateral (SELECT "); + lateral.append(displayPrefix).append("."); + lateral.append("CODEDES AS ").append(m_columns[index].ColumnName) + .append(GeneralPOJO.DISPLAY).append(" FROM SYS_ENUMERATE ") + .append(" AS ").append(displayPrefix); + //三层实体嵌套,迭代 + lateral.append(" WHERE ").append(displayPrefix).append(".").append("SYS_ENUMERATETYPE_ID ='").append(m_columns[index].enumerateType).append("'") + .append(" AND ").append(displayPrefix).append(".").append("CODEVALUE ="); + lateral.append(prefix).append(".").append(m_columns[index].ColumnName); + lateral.append(" ) AS ").append(m_columns[index].ColumnName).append(GeneralPOJO.DISPLAY) + .append("_LATERAL ON TRUE "); + return m_columns[index].ColumnName + GeneralPOJO.DISPLAY + "_LATERAL." + m_columns[index].ColumnName + + GeneralPOJO.DISPLAY; + } + else { + return m_columns[index].ColumnName; + } + } + + private String getEntityReferenceSQL(String referenceId, String columnName, + String columnSQL, String prefix, StringBuffer lateral) { + String tableName = getReferenceTable(columnName); + POInfo info = (POInfo) POInfo.getPOInfo(tableName); + String displayPrefix = prefix + prefix; + StringBuffer innerLateral = new StringBuffer(); + String displayName = info.getColumnDisplaySQL(info.getDisplayIndex(), + displayPrefix, innerLateral); + String keyCol = info.getKeyColumnName(); + + StringBuffer str = lateral; + str.append(" LEFT JOIN lateral (SELECT "); + if (info.getColumnClass(info.getDisplayIndex()) != Object.class + && !info.isVirtualColumn(info.getDisplayIndex()) && !info.getColumnDisplayType(info.getDisplayIndex()).equals(DisplayType.ENUMERATE)) { + str.append(displayPrefix).append("."); + } + str.append(displayName).append(" AS ").append(columnName) + .append(GeneralPOJO.DISPLAY).append(" FROM ").append(tableName) + .append(" AS ").append(displayPrefix); + //三层实体嵌套,迭代 + if (info.getColumnClass(info.getDisplayIndex()) == Object.class + || info.isVirtualColumn(info.getDisplayIndex()) || info.getColumnDisplayType(info.getDisplayIndex()).equals(DisplayType.ENUMERATE)) { + str.append(innerLateral); + } + str.append(" WHERE ").append(displayPrefix).append(".").append(keyCol) + .append("="); + if (StringUtil.isEmpty(columnSQL)) { + str.append(prefix).append(".").append(columnName); + } else { + str.append("(").append(columnName + "_LATERAL." + columnName) + .append(")"); + } + str.append(" ) AS ").append(columnName).append(GeneralPOJO.DISPLAY) + .append("_LATERAL ON TRUE "); + + return columnName + GeneralPOJO.DISPLAY + "_LATERAL." + columnName + + GeneralPOJO.DISPLAY; + } + + + public int getDisplayIndex(){ + return displayIndex; + } + + /** + * Is Column Virtual? + * @param index index + * @return true if column is virtual + */ + public boolean isVirtualColumn (int index) + { + if (index < 0 || index >= m_columns.length) + return true; + return m_columns[index].ColumnSQL != null + && m_columns[index].ColumnSQL.length() > 0; + } // isVirtualColumn + + /** + * Get Column Label + * @param index index + * @return column label + */ + public String getColumnLabel (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].ColumnLabel; + } // getColumnLabel + + /** + * Get Column Description + * @param index index + * @return column description + */ + public String getColumnDescription (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].ColumnDescription; + } // getColumnDescription + + /** + * Get Column Class + * @param index index + * @return Class + */ + public Class getColumnClass (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].ColumnClass; + } // getColumnClass + + /** + * Get Column Display Type + * @param index index + * @return DisplayType + */ + public String getColumnDisplayType (int index) + { + if (index < 0 || index >= m_columns.length) + return DisplayType.String; + return m_columns[index].displayType; + } // getColumnDisplayType + + /** + * Get Column Default Logic + * @param index index + * @return Default Logic + */ + public String getDefaultLogic (int index) + { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].DefaultLogic; + } // getDefaultLogic + + /** + * Is Column Mandatory + * @param index index + * @return true if column mandatory + */ + public boolean isColumnMandatory (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsMandatory; + } // isMandatory + + /** + * Is Column Updateable + * @param index index + * @return true if column updateable + */ + public boolean isColumnUpdateable (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsUpdateable; + } // isUpdateable + + /** + * Set Column Updateable + * @param index index + * @param updateable column updateable + */ + public void setColumnUpdateable (int index, boolean updateable) + { + if (index < 0 || index >= m_columns.length) + return; + m_columns[index].IsUpdateable = updateable; + } // setColumnUpdateable + + /** + * Set all columns updateable + * @param updateable updateable + */ + public void setUpdateable (boolean updateable) + { + for (int i = 0; i < m_columns.length; i++) + m_columns[i].IsUpdateable = updateable; + } // setUpdateable + + /** + * Is Lookup Column + * @param index index + * @return true if it is a lookup column + */ + public boolean isColumnLookup (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return DisplayType.isLookup(m_columns[index].displayType); + } // isColumnLookup + + /** + * Get Lookup + * @param index index + * @return Lookup + */ +// public Lookup getColumnLookup (int index) +// { +// if (!isColumnLookup(index)) +// return null; +// // +// int WindowNo = 0; +// // List, Table, TableDir +// Lookup lookup = null; +//// try +//// { +//// lookup = MLookupFactory.get (m_ctx, WindowNo, +//// m_columns[index].AD_Column_ID, m_columns[index].DisplayType, +//// Env.getLanguage(m_ctx), m_columns[index].ColumnName, +//// m_columns[index].AD_Reference_Value_ID, +//// m_columns[index].IsParent, m_columns[index].ValidationCode); +//// } +//// catch (Exception e) +//// { +//// lookup = null; // cannot create Lookup +//// } +// return lookup; +// /** @todo other lookup types */ +// } // getColumnLookup + + /** + * Is Column Key + * @param index index + * @return true if column is the key + */ + public boolean isKey (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsKey; + } // isKey + + public String getKeyColumnName() + { + if(m_columns != null && m_columns.length > 0){ + for(POInfoColumn col : m_columns){ + if(col.IsKey){ + return col.ColumnName; + } + } + } + return null; + } + + private boolean hasStatusCol() + { + if(m_columns != null && m_columns.length > 0){ + for(POInfoColumn col : m_columns){ + if(col.displayType.equals(DisplayType.STATUS)){ + return true; + } + } + } + return false; + } + + /** + * Is Column Parent + * @param index index + * @return true if column is a Parent + */ +// public boolean isColumnParent (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsParent; +// } // isColumnParent + + /** + * Is Column Translated + * @param index index + * @return true if column is translated + */ +// public boolean isColumnTranslated (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsTranslated; +// } // isColumnTranslated + + /** + * Is Table Translated + * @return true if table is translated + */ +// public boolean isTranslated () +// { +// for (int i = 0; i < m_columns.length; i++) +// { +// if (m_columns[i].IsTranslated) +// return true; +// } +// return false; +// } // isTranslated + +// /** +// * Is Column (data) Encrypted +// * @param index index +// * @return true if column is encrypted +// */ +// public boolean isEncrypted (int index) +// { +// if (index < 0 || index >= m_columns.length) +// return false; +// return m_columns[index].IsEncrypted; +// } // isEncrypted + + /** + * Is allowed logging on this column + * + * @param index + * index + * @return true if column is allowed to be logged + */ + public boolean isAllowLogging(int index) { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsAllowLogging; + } // isAllowLogging + + /** + * Get Column FieldLength + * @param index index + * @return field length + */ + public int getFieldLength (int index) + { + if (index < 0 || index >= m_columns.length) + return 0; + return m_columns[index].FieldLength; + } // getFieldLength + + /** + * Get Column FieldLength + * @param columnName Column Name + * @return field length or 0 + */ + public int getFieldLength (String columnName) + { + int index = getColumnIndexByName( columnName ); + if (index >= 0) { + return getFieldLength( index ); + } + return 0; + } + + /** + * Validate Content + * @param index index + * @param value new Value + * @return null if all valid otherwise error message + */ + public String validate(int index, Object value) { + if (index < 0 || index >= m_columns.length) + return "范围溢出"; + // Mandatory (i.e. not null + if (m_columns[index].IsMandatory && value == null) { + return m_columns[index].ColumnLabel + "是必填项"; + } + if (value == null) + return null; + + // Length ignored + + // + if (DisplayType.Integer.equals(m_columns[index].displayType) + || DisplayType.Number.equals(m_columns[index].displayType) + || DisplayType.Money.equals(m_columns[index].displayType)) { + if (m_columns[index].ValueMin != null) { + BigDecimal value_BD = null; + try { + if (m_columns[index].ValueMin_BD != null) + value_BD = new BigDecimal(value.toString()); + } catch (Exception ex) { + } + // Both are Numeric + if (m_columns[index].ValueMin_BD != null && value_BD != null) { // error: + int comp = m_columns[index].ValueMin_BD.compareTo(value_BD); + if (comp > 0) { + return m_columns[index].ColumnLabel + "的最小值为"+ m_columns[index].ValueMin; + } + } else // String + { + int comp = m_columns[index].ValueMin.compareTo(value + .toString()); + if (comp > 0) { + return m_columns[index].ColumnLabel + "的最小值为"+m_columns[index].ValueMin; + } + } + } + if (m_columns[index].ValueMax != null) { + BigDecimal value_BD = null; + try { + if (m_columns[index].ValueMax_BD != null) + value_BD = new BigDecimal(value.toString()); + } catch (Exception ex) { + } + // Both are Numeric + if (m_columns[index].ValueMax_BD != null && value_BD != null) { // error + int comp = m_columns[index].ValueMax_BD.compareTo(value_BD); + if (comp < 0) { + return m_columns[index].ColumnLabel + "的最大值为"+ m_columns[index].ValueMax; + } + } else // String + { + int comp = m_columns[index].ValueMax.compareTo(value + .toString()); + if (comp < 0) { + return m_columns[index].ColumnLabel + "的最大值为"+ m_columns[index].ValueMax; + } + } + } + } + return null; + } // validate + + /** + * Validate Content (Mandatory ,Length and Min/Max) + * @param index index + * @param value newValue + * @return null if all valid otherwise error message + */ + public String validateValue(int index, Object value) { + String errorMsg = validate(index, value); + if (errorMsg != null) { + return errorMsg; + } + if (value == null) + return null; + // Length validate + if (m_columns[index].ColumnClass == String.class) { + String stringValue = value.toString(); + int length = m_columns[index].FieldLength; + if (stringValue.length() > length && length > 0) { + return m_columns[index].ColumnLabel + "的长度不能超过" + length + + "个字符"; + } + }else if(m_columns[index].ColumnClass == Object.class && value != null){ + String tableName = getReferenceTable(index); + POJOInfo info = getPOInfo(tableName); + String buffer = "SELECT COUNT(*) FROM " + tableName + " WHERE " + info.getKeyColumnName() + "='" + value.toString() + "'"; + long count = GetServicesFunction.findCount(buffer); + if(count != 1){ + return getColumnLabel(index) + "引用的对象被删除"; + } + } + return null; + } + + /** + * Build select clause + * @return stringbuffer + */ + public StringBuffer buildSelect(){ + StringBuffer sql = new StringBuffer("SELECT "); + int size = getColumnCount(); + boolean first = true; + boolean hasList = false; + if (size <= 0) { + return null; + } + StringBuffer lateral = new StringBuffer(); + for (int i = 0; i < size; i++) { + if (!DisplayType.List.equals(m_columns[i].displayType) && !DisplayType.Binary.equals(m_columns[i].displayType)) { + if (!first) { + sql.append(","); + } + if (m_columns[i].ColumnSQL == null + || m_columns[i].ColumnSQL.length() == 0) { + sql.append(" P."); + } + sql.append(getColumnSQL(i, "P", lateral)); // Normal and Virtual Column + first = false; + } else { + hasList = true; + } + } + //FIXME: view_template service should provide , xml type is not support distinct + if (hasList && !"VIEW_TEMPLATE".equals(getTableName()) && !"VIEW_PAGE".equals(getTableName()) && !"SYS_SERVICEFLOW".equals(getTableName()) && !"VIEW_TEMPLATE_CUSTOM".equals(getTableName()) && !"VIEW_PAGE_CUSTOM".equals(getTableName())) { + sql.insert(7, " DISTINCT "); + } + sql.append(" FROM ").append(getTableName()).append(" AS P "); + if(hasStatusCol()){ + sql.append(" LEFT JOIN SYS_DATASTATUS AS PSTA ON PSTA.TABLENAME='").append(getTableName()).append("' AND PSTA.BUSINESSKEY=P.").append(getKeyColumnName()); + } + sql.append(lateral); + return sql; + } + + /** + * Build select clause + * @return stringbuffer + */ + public StringBuffer buildSelect(List cols) + { + return buildSelect(cols, "P"); + } + + public StringBuffer buildSelect(List cols, String prefix) + { + StringBuffer sql = new StringBuffer("SELECT "); + int size = getColumnCount(); + boolean first = true; + boolean hasList = false; + if (size <= 0) { + return null; + } + + StringBuffer lateral = new StringBuffer(); + + for (int i = 0; i < size; i++) { + if (DisplayType.List.equals(m_columns[i].displayType)) { + hasList = true; + continue; + } + if (cols != null && cols.contains(m_columns[i].ColumnName)) { + if (!first) { + sql.append(","); + } + if (DisplayType.Binary.equals(m_columns[i].displayType)) { + sql.append(" DOCUMENT_LATERAL.DOCUMENT_COUNT ").append(" AS ") + .append(GeneralPOJO.DOCUMENT) + .append(GeneralPOJO.DISPLAY); + lateral.append(" LEFT JOIN lateral (select SYS_DOCCOUNT.DOCUMENT_COUNT from (select sd.BUSINESSKEY, count(*) as DOCUMENT_COUNT from SYS_DOC sd where sd.ISACTIVE=1 and sd.tablename='").append(getTableName()).append("' group by sd.BUSINESSKEY) as SYS_DOCCOUNT where SYS_DOCCOUNT.BUSINESSKEY=").append(prefix).append(".").append(getKeyColumnName()).append(")").append(" AS DOCUMENT_LATERAL on true"); + } else { + if (m_columns[i].ColumnSQL == null + || m_columns[i].ColumnSQL.length() == 0) { + sql.append(" " + prefix + "."); + } + sql.append(getColumnSQL(i, prefix, lateral)); // Normal and Virtual + // // Column + } + first = false; + } + } + // FIXME: view_template service should provide , xml type is not support + // distinct +// if (hasList && !"VIEW_TEMPLATE".equals(getTableName()) +// && !"SYS_SERVICEFLOW".equals(getTableName())) { +// sql.insert(7, " DISTINCT "); +// } + if (hasList && (!"VIEW_TEMPLATE".equals(getTableName()) || !cols.contains("XML")) && (!"VIEW_PAGE".equals(getTableName()) || !cols.contains("XML")) && !"SYS_SERVICEFLOW".equals(getTableName()) && (!"VIEW_TEMPLATE_CUSTOM".equals(getTableName()) || !cols.contains("XML")) && (!"VIEW_PAGE_CUSTOM".equals(getTableName()) || !cols.contains("XML"))) { + sql.insert(7, " DISTINCT "); + } + sql.append(" FROM ").append(getTableName()).append(" AS " + prefix + " "); + if(cols.contains(DisplayType.STATUS)){ + sql.append(" LEFT JOIN SYS_DATASTATUS AS ").append(prefix).append("STA ON ").append(prefix).append("STA.TABLENAME='").append(getTableName()).append("' AND ").append(prefix).append("STA.BUSINESSKEY=").append(prefix).append(".").append(getKeyColumnName()); + } + sql.append(lateral); + return sql; + } + + /** + * + * @return if table save log + */ + public boolean isChangeLog() + { + return m_IsChangeLog; + } + + @Override + public StringBuffer buildCount() { + + return new StringBuffer("SELECT COUNT(*) FROM ").append(getTableName()); + } + + @Override + public String getReferenceValue(String columnName) { + int index = getColumnIndexByName(columnName); + if (index > 0) { + return getReferenceValue(index); + } + return null; + } + + @Override + public String getReferenceValue(int index) { + if (index < 0 || index >= m_columns.length) + return null; + return m_columns[index].AD_Reference_Value_ID; + } + + @Override + public String getReferenceValueTable(int index) { + if(DisplayType.List.equals(m_columns[index].displayType)){ + loadReferenceValue(index); + return m_columns[index].referenceValue.getEntityTable(); + } + return null; + } + + @Override + public String getReferenceValueTable(String columnName) { + int index = getColumnIndexByName(columnName); + return getReferenceValueTable(index); + } + + @Override + public String getReferenceValueColumnName(int index) { + if(DisplayType.List.equals(m_columns[index].displayType)){ + loadReferenceValue(index); + return m_columns[index].referenceValue.getColumnName(); + } + return null; + } + + @Override + public String getReferenceValueColumnName(String columnName) { + int index = getColumnIndexByName(columnName); + return getReferenceValueColumnName(index); + } + + /** + * Is Column identifier + * @param index index + * @return true if column mandatory + */ + public boolean isIdentifier (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsIdentifier; + } + + /** + * is column combidentifier + * @param index + * @return + */ + public boolean isCombidentifier (int index) + { + if (index < 0 || index >= m_columns.length) + return false; + return m_columns[index].IsCombidentifier; + } + + public List getRules(){ + if(listRule == null){ + DataDicService dataDicService = (DataDicService)SpringBeanOsgiServices.getInstance().getBeanByName("dataDicService"); + listRule = dataDicService.getRule(getTableName()); + } + return listRule; + } + + public int getTableType(){ + return tableType; + } + + @Override + public String getTableDisplayName() { + + return m_TableDisplayName; + } + + @Override + public List getDataFilterRules() { + if(dataFilterRules == null){ + DataPrivilegeService dataPrivilegeService = (DataPrivilegeService)SpringBeanOsgiServices.getInstance().getBeanByName("dataPrivilegeService"); + dataFilterRules = dataPrivilegeService.getEntityDataFilterRule(getAD_Table_ID()); + } + return dataFilterRules; + } + + @Override + public List get_ColumnsByDisplayType(String displayType) { + int count = getColumnCount(); + if (count > 0 && !StringUtil.isEmpty(displayType)) { + List list = new ArrayList(); + for (int i = 0; i < count; i++) { + String disType = getColumnDisplayType(i); + if (displayType.equals(disType)) { + list.add(getColumnName(i)); + } + } + return list; + } + return null; + } + + /** + * columnName is a foreign key, return it reference table + * @param columnName + * @return + */ + public String getReferenceTable(int index){ + + if(m_columns[index].displayType.length() == 36 || m_columns[index].ColumnClass == Object.class){ + if(StringUtil.isEmpty(m_columns[index].referenceTable)){ + String referenceId = m_columns[index].displayType; + String tableName = ((DataDicService) SpringBeanOsgiServices + .getInstance().getBeanByName("dataDicService")) + .getReferenceEntityTableName(referenceId); + m_columns[index].referenceTable = tableName; + } + return m_columns[index].referenceTable; + } + return null; + } + + /** + * columnName is a foreign key, return it reference table + * @param columnName + * @return + */ + public String getReferenceTable(String columnName){ + int index = getColumnIndexByName(columnName); + if(index != -1){ + return getReferenceTable(index); + } + return null; + } + + @Override + public String getEnumerateType(String columnName) { + int index = getColumnIndexByName(columnName); + if(index >= 0){ + return getEnumerateType(index); + } + return null; + } + + @Override + public String getEnumerateType(int index) { + if (m_columns[index].displayType.equals(DisplayType.ENUMERATE) + || m_columns[index].displayType.equals(DisplayType.YesNo) + || m_columns[index].displayType.equals(DisplayType.STATUS)) { + return m_columns[index].enumerateType; + } + if( m_columns[index].displayType.equals(DisplayType.YesNo) + && GeneralPOJO.ISACTIVE.equals(getColumnName(index))){ + return "YESNO"; + } + return null; + } + +} // POInfo diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfoColumn.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfoColumn.java new file mode 100644 index 0000000..89b89f6 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/POInfoColumn.java @@ -0,0 +1,199 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package com.dsasp.server.dataDic.bean; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.dsasp.server.common.dataDic.bean.DisplayType; + +/** + * PO Info Column Info Value Object + * + * @author Jorg Janke + * @version $Id: POInfoColumn.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $ + */ +public class POInfoColumn implements Serializable +{ + /** Used by Remote FinReport */ + static final long serialVersionUID = -3983585608504631958L; + + /** + * Constructor + * @param ad_Column_ID Column ID + * @param columnName Column name + * @param columnSQL virtual column + * @param displayType Display Type + * @param isMandatory Mandatory + * @param isUpdateable Updateable + * @param defaultLogic Default Logic + * @param columnLabel Column Label + * @param columnDescription Column Description + * @param isKey true if key + * @param isParent true if parent + * @param ad_Reference_Value_ID reference value + * @param validationCode sql validation code + * @param fieldLength Field Length + * @param valueMin minimal value + * @param valueMax maximal value + * @param isTranslated translated + * @param isEncrypted encrypted + * @param isAllowLogging allow logging + */ + public POInfoColumn (String ad_Column_ID, String columnName, String columnSQL, String displayType, + boolean isMandatory, boolean isUpdateable, String defaultLogic, + String columnLabel, String columnDescription, + boolean isKey, String validationCode, + int fieldLength, String valueMin, String valueMax, + boolean isAllowLogging, String ad_Reference_Value_ID, String enumerateType, boolean isIdentifier, boolean iscombidentifier) + { + AD_Column_ID = ad_Column_ID; + ColumnName = columnName; + ColumnSQL = columnSQL; + this.displayType = displayType; + + if (columnName.equals("Posted") + || columnName.equals("Processed") + || columnName.equals("Processing")) + { + ColumnClass = Boolean.class; + } + else if (columnName.endsWith("_ID") && isKey) + { + this.displayType = DisplayType.ID; + ColumnClass = String.class; + } + //FIXME: 非基本类型处�? else + ColumnClass = DisplayType.getClass(displayType, true); + IsMandatory = isMandatory; + IsUpdateable = isUpdateable; + DefaultLogic = defaultLogic; + ColumnLabel = columnLabel; + ColumnDescription = columnDescription; + IsKey = isKey; +// IsParent = isParent; + // + AD_Reference_Value_ID = ad_Reference_Value_ID; + ValidationCode = validationCode; + // + FieldLength = fieldLength; + ValueMin = valueMin; + try + { + if (valueMin != null && valueMin.length() > 0) + ValueMin_BD = new BigDecimal(valueMin); + } + catch (Exception ex) + { +// CLogger.get().log(Level.SEVERE, "ValueMin=" + valueMin, ex); + } + ValueMax = valueMax; + try + { + if (valueMax != null && valueMax.length() > 0) + ValueMax_BD = new BigDecimal(valueMax); + } + catch (Exception ex) + { +// CLogger.get().log(Level.SEVERE, "ValueMax=" + valueMax, ex); + } +// IsTranslated = isTranslated; +// IsEncrypted = isEncrypted; + IsAllowLogging = isAllowLogging; + this.enumerateType = enumerateType; + this.IsIdentifier = isIdentifier; + this.IsCombidentifier = iscombidentifier; + + } // Column + + /** Column ID */ + public String AD_Column_ID; + /** Column Name */ + public String ColumnName; + /** Virtual Column */ + public String ColumnSQL; + /** Display Type */ + public String displayType; + /** Data Type */ + public Class ColumnClass; + /** Mandatory */ + public boolean IsMandatory; + /** Default Value */ + public String DefaultLogic; + /** Updateable */ + public boolean IsUpdateable; + /** Label */ + public String ColumnLabel; + /** Description */ + public String ColumnDescription; + /** PK */ + public boolean IsKey; + /** FK to Parent */ +// public boolean IsParent; + /** Translated */ +// public boolean IsTranslated; +// /** Encrypted */ +// public boolean IsEncrypted; + /** Allow Logging */ + public boolean IsAllowLogging; + + /** Reference Value */ + public String AD_Reference_Value_ID; + /** Validation */ + public String ValidationCode; + + /** Field Length */ + public int FieldLength; + /** Min Value */ + public String ValueMin; + /** Max Value */ + public String ValueMax; + /** Min Value */ + public BigDecimal ValueMin_BD = null; + /** Max Value */ + public BigDecimal ValueMax_BD = null; + + /** + * display type is list , AD_Reference_Value_ID reference table and foreign name + */ + public ReferenceValue referenceValue; + + /** + * display type is object , reference table + */ + public String referenceTable; + + public String enumerateType; + + public boolean IsIdentifier; + public boolean IsCombidentifier; + + /** + * String representation + * @return info + */ + public String toString() + { + StringBuffer sb = new StringBuffer("POInfo.Column["); + sb.append(ColumnName).append(",ID=").append(AD_Column_ID) + .append(",DisplayType=").append(displayType) + .append(",ColumnClass=").append(ColumnClass); + sb.append("]"); + return sb.toString(); + } // toString + +} // POInfoColumn diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/ReferenceValue.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/ReferenceValue.java new file mode 100644 index 0000000..f85bdb1 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/ReferenceValue.java @@ -0,0 +1,41 @@ +package com.dsasp.server.dataDic.bean; + +import java.io.Serializable; + +public class ReferenceValue implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -2483585608504631960L; + + + private String columnName; + + private String entityTable; + + + + public ReferenceValue(){ + + } + + + public String getEntityTable() { + return entityTable; + } + + public void setEntityTable(String entityTable) { + this.entityTable = entityTable; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Rule.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Rule.java new file mode 100644 index 0000000..68572e3 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/bean/Rule.java @@ -0,0 +1,70 @@ +package com.dsasp.server.dataDic.bean; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.exception.ValidationException; + +public class Rule { + + public static final String TABLENAME = "SYS_RULE"; + private GeneralPOJO po; + private static final String name = "NAME"; + private static final String content = "CONTENT"; + private static final String entityId = "ENTITYID"; + private static final String verificationTime = "VERIFICATIONTIME"; + + + public Rule(GeneralPOJO po) { + if (TABLENAME.equals(po.get_TableName())) { + this.po = po; + } else { + throw new ValidationException("传入实体参数不匹配"); + } + } + + + public GeneralPOJO getPo() { + return po; + } + + + public String getName() { + return (String)po.get_Value(name); + } + + + public void setName(String name) { + po.set_ValueOfColumn(Rule.name, name); + } + + + public String getContent() { + return (String)po.get_Value(content); + } + + + public void setContent(String content) { + po.set_ValueOfColumn(Rule.content, content); + } + + + public String getEntityId() { + return (String)po.get_Value(entityId); + } + + + public void setEntityId(String entityId) { + po.set_ValueOfColumn(Rule.entityId, entityId); + } + + + public Integer getVerificationTime() { + return po.get_ValueAsInt(verificationTime); + } + + + public void setVerificationTime(Integer verificationTime) { + po.set_ValueOfColumn(Rule.verificationTime, verificationTime); + } + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/GeneralPOJOBindings.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/GeneralPOJOBindings.java new file mode 100644 index 0000000..a5bf5e0 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/GeneralPOJOBindings.java @@ -0,0 +1,107 @@ +package com.dsasp.server.dataDic.binding; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import javax.script.Bindings; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; + +public class GeneralPOJOBindings implements Bindings { + + protected static final Set UNSTORED_KEYS = + new HashSet(Arrays.asList("out", "out:print", "lang:import", "context", "elcontext", "print", "println", "po", "ctx")); + + protected GeneralPOJO scriptResolvers; + protected Properties ctx; + + public GeneralPOJOBindings(GeneralPOJO po, Properties ctx) { + this.scriptResolvers = po; + if (ctx != null) { + this.ctx = ctx; + } else { + this.ctx = new Properties(); + } + } + + public boolean containsKey(Object key) { + if ("po".equals(key) || "ctx".equals(key) + || scriptResolvers.get_ColumnIndex((String)key) != -1 || ctx.contains(key) || "mainPO".equals(key)) { + return true; + } + return false; + } + + public Object get(Object key) { + if("mainPO".equals(key)){ + return scriptResolvers.getMainPO(); + } + else if ("po".equals(key)) { + return scriptResolvers; + } else if ("ctx".equals(key)) { + return ctx; + } else if (scriptResolvers.get_ColumnIndex((String)key) != -1) { + return scriptResolvers.get_Value((String)key); + } else if (ctx.contains(key)) { + return ctx.get(key); + } + return null; + } + + public Object put(String name, Object value) { + Object oldValue = null; + if (!UNSTORED_KEYS.contains(name)) { + oldValue = scriptResolvers.get_Value(name); + scriptResolvers.set_ValueOfColumn(name, value); + } + return oldValue; + } + + public Set> entrySet() { + throw new UnsupportedOperationException(); +// return variableScope.getVariables().entrySet(); + } + + public Set keySet() { + throw new UnsupportedOperationException(); +// return variableScope.getVariables().keySet(); + } + + public int size() { + throw new UnsupportedOperationException(); +// return variableScope.getVariables().size(); + } + + public Collection values() { + throw new UnsupportedOperationException(); +// return variableScope.getVariables().values(); + } + + public void putAll(Map< ? extends String, ? extends Object> toMerge) { + throw new UnsupportedOperationException(); + } + + public Object remove(Object key) { + if (UNSTORED_KEYS.contains(key)) { + return null; + } + throw new UnsupportedOperationException(); + } + + public void clear() { + throw new UnsupportedOperationException(); + } + + public boolean containsValue(Object value) { + throw new UnsupportedOperationException(); + } + + public boolean isEmpty() { + throw new UnsupportedOperationException(); + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/ScriptingEnginesManager.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/ScriptingEnginesManager.java new file mode 100644 index 0000000..26b98d4 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/binding/ScriptingEnginesManager.java @@ -0,0 +1,114 @@ +package com.dsasp.server.dataDic.binding; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.script.Bindings; +import javax.script.Compilable; +import javax.script.CompiledScript; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineFactory; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; + +import org.codehaus.groovy.jsr223.GroovyScriptEngineFactory; + +import com.dsasp.server.common.exception.PrivilegeException; +import com.dsasp.server.common.exception.SameCodeException; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.util.StringUtil; + +public class ScriptingEnginesManager { + + public static final String GROOVY_SCRIPTING_LANGUAGE = "groovy"; + + private static ScriptingEnginesManager scriptingEnginesManager; + + private Map compilerScripts = new HashMap(); + + private final ScriptEngineManager scriptEngineManager; + + public ScriptingEnginesManager() { + scriptEngineManager = new ScriptEngineManager(); + scriptEngineManager.registerEngineName(GROOVY_SCRIPTING_LANGUAGE, + new GroovyScriptEngineFactory()); + } + + public ScriptingEnginesManager addScriptEngineFactory( + ScriptEngineFactory scriptEngineFactory) { + scriptEngineManager.registerEngineName( + scriptEngineFactory.getEngineName(), scriptEngineFactory); + return this; + } + + public void setScriptEngineFactories( + List scriptEngineFactories) { + if (scriptEngineFactories != null) { + for (ScriptEngineFactory scriptEngineFactory : scriptEngineFactories) { + scriptEngineManager.registerEngineName( + scriptEngineFactory.getEngineName(), + scriptEngineFactory); + } + } + } + + public Object evaluateGroovy(String key, String script, Bindings bindings) { + ScriptEngine scriptEngine = scriptEngineManager + .getEngineByName(GROOVY_SCRIPTING_LANGUAGE); + + if (scriptEngine == null) { + throw new RuntimeException( + "Can't find scripting engine for '" + GROOVY_SCRIPTING_LANGUAGE + "'"); + } + CompiledScript comScript = compilerScripts.get(key); + + try { + + if (comScript == null || StringUtil.isEmpty(key)) { + comScript = ((Compilable) scriptEngine).compile(script); + if (comScript == null) { + return null; + } + compilerScripts.put(key, comScript); + } + return comScript.eval(bindings); + } catch (ScriptException e) { + //To Console Debug + try { + CompiledScript comScript2 = ((Compilable) scriptEngine).compile("import com.dsasp.client.viewframework.template.util.Console; Console.error(errorMsg)"); + bindings.put("errorMsg", e); + comScript2.eval(bindings); + } catch (ScriptException e1) { + e1.printStackTrace(); + } + e.printStackTrace(); + Throwable throwCase = e.getCause(); + while(throwCase != null ){ + if(throwCase instanceof ValidationException){ + throw (ValidationException)throwCase; + }else if(throwCase instanceof PrivilegeException){ + throw (PrivilegeException)throwCase; + }else if(throwCase instanceof SameCodeException){ + throw (SameCodeException)throwCase; + }else{ + throwCase = throwCase.getCause(); + } + } + //FIXME: 脚本异常提醒 + throw new RuntimeException(key + " --- problem evaluating script: " + + e.getMessage().substring(15)); + } + } + + public static ScriptingEnginesManager getScriptingEnginesManager() { + if (scriptingEnginesManager == null) { + scriptingEnginesManager = new ScriptingEnginesManager(); + } + return scriptingEnginesManager; + } + + public void setChangeScript(String key){ + compilerScripts.remove(key); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/CodeRuleServiceImpl.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/CodeRuleServiceImpl.java new file mode 100644 index 0000000..7e8377a --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/CodeRuleServiceImpl.java @@ -0,0 +1,478 @@ +package com.dsasp.server.dataDic.service; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.rowset.SqlRowSet; + +import com.dsasp.server.common.dataDic.bean.AbstractPOJOInfo; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.service.CodeRuleService; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.util.UserSession; + +public class CodeRuleServiceImpl implements CodeRuleService{ + + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + public void setPojoCRUDService(POJOCRUDService pojoCRUDService) { + this.pojoCRUDService = pojoCRUDService; + } + + protected final String REGEX_Y = "\\%Y\\{([2,4])\\}"; + + protected final String REGEX_M= "\\%M\\{([1,2])\\}"; + + protected final String REGEX_D= "\\%D\\{([1,2])\\}"; + + protected final String REGEX_T= "\\%T\\{([0-9a-zA-Z:\\s_,.'=-]+)\\}"; + + protected final String REGEX_N= "\\%N\\{([0-9,]+)\\}"; + + //可能用于递增的项(除了流水号,其它都可能作为递增项) + private final String[] ADDREGEXS = {REGEX_Y,REGEX_M,REGEX_D,REGEX_T}; + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Autowired + private POJOCRUDService pojoCRUDService; + + @Override + public String getCode(String tableName, String columnName, + Map map) throws Exception{ + String columnId = AbstractPOJOInfo.getPOInfo(tableName).getAD_Column_ID(columnName); + Map param = new HashMap(); + param.put("COLUMNID", columnId); + Map result = pojoCRUDService.listSelect(param, "SYS_CODERULE", UserSession.getAdmin()); + List pojos = (List)result.get(POJOCRUDService.LIST_RESULT); + if(pojos != null && pojos.size() == 1 ){ + GeneralPOJO pojo = pojos.get(0); + String codeRule = (String)pojo.get_Value("RULE"); + String addRule = (String)pojo.get_Value("ADDRULE"); + Boolean isopen = (Boolean)pojo.get_Value("ISOPEN"); + String resultCode = codeRule; + if(!isopen){ + return null; + } + + Set types = getMatcher(REGEX_T, codeRule); + Set numbers = getMatcher(REGEX_N, codeRule); + + if(numbers.size() > 1){//暂不处理多个流水号 + return null; + } + + try { + //查询编码(公司编码、工程编码etc.) + Map realMap = getRealMap(tableName, codeRule, map); + + Calendar cal = Calendar.getInstance(); + Map dataY = new HashMap(); + dataY.put("2", new SimpleDateFormat("yy").format(cal.getTime())); + dataY.put("4", new SimpleDateFormat("yyyy").format(cal.getTime())); + + Map dataM = new HashMap(); + dataM.put("1", new SimpleDateFormat("M").format(cal.getTime())); + dataM.put("2", new SimpleDateFormat("MM").format(cal.getTime())); + + Map dataD = new HashMap(); + dataD.put("1", new SimpleDateFormat("d").format(cal.getTime())); + dataD.put("2", new SimpleDateFormat("dd").format(cal.getTime())); + + resultCode = composeRule(REGEX_Y, resultCode, dataY); + resultCode = composeRule(REGEX_M, resultCode, dataM); + resultCode = composeRule(REGEX_D, resultCode, dataD); + resultCode = composeRule(REGEX_T, resultCode, realMap); + + if(numbers.size() == 0){ + return resultCode; + } + + String number = numbers.iterator().next(); + String[] ns = number.split(","); + Long maxLength = Long.parseLong(ns[0]); + Long start = 0L; + if(ns.length > 1){ + start = Long.parseLong(ns[1]); + } + + //递增基础(计算流水号) + //1、查询流水号根据哪些项递增。 + Set replaceRegexs = getRegexByAddRule(addRule); + //2、组合正则表达式(递增基础替换,不作为递增结果的替换为正则通配符,流水号长度使用通配符) + String wheresql = codeRule; + + wheresql = composeRule_IsReplace(REGEX_Y, wheresql, dataY,replaceRegexs); + wheresql = composeRule_IsReplace(REGEX_M, wheresql, dataM,replaceRegexs); + wheresql = composeRule_IsReplace(REGEX_D, wheresql, dataD,replaceRegexs); + wheresql = composeRule_IsReplace(REGEX_T, wheresql, realMap,replaceRegexs); + + Map dataN = new HashMap(); + dataN.put(number, "(\\\\d{"+maxLength+"})"); + wheresql = composeRule(REGEX_N, wheresql, dataN); + Pattern p = Pattern.compile("\\(.*?\\)"); + Matcher m = p.matcher(wheresql); + int position = 0; + while(m.find()){ + if(("\\\\d{"+maxLength+"}").equals(m.group())){ + break; + } + position ++; + } + wheresql = "^"+wheresql+"$"; + //3、用正则表达式作为查询条件,查询业务数据表。 + + //SELECT (regexp_matches(CODE , 'JT(19|20|21)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])(\d{5})'))[4] FROM TEST_INVI WHERE CODE ~'JT(19|20|21)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])(\d{5})' + //ORDER BY (regexp_matches(CODE , 'JT(19|20|21)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])(\d{5})'))[4] DESC LIMIT 1 + String select = "SELECT (regexp_matches("+ columnName +",'"+wheresql+"'))["+position+"] AS "+columnName + + " FROM "+tableName +" WHERE "+columnName+" ~'"+wheresql + +"' ORDER BY "+"(regexp_matches("+columnName+",'"+wheresql+"'))["+position+"]" + +" DESC LIMIT 1"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + String maxCode = null; + if(set != null && set.next()){ + maxCode = set.getString(columnName); + } + + //4、取出最大的数据。 + Long maxNumber = null; + if(maxCode != null){ + maxNumber = Long.parseLong(maxCode); + } + //5、将最大数据中的流水号取出来+1。 + if(maxNumber != null){ + maxNumber = maxNumber+1; + }else{ + maxNumber = start; + } + if(maxNumber == null){ + throw new Exception("未找到最大流水号!"); + } + //6、验证最大流水号长度。 + int maxNumberLength = String.valueOf(maxNumber).length(); + if(maxNumberLength > maxLength){ + throw new Exception("流水号达到最大上限!"); + } + //7、组合新的流水号。 + + dataN = new HashMap(); + dataN.put(number, addZero(maxNumber,maxLength-maxNumberLength)); + resultCode = composeRule(REGEX_N, resultCode, dataN); + return resultCode; + } catch (Exception e) { + throw e; + } + } + return null; + } + + private String addZero(Long number,Long x){ + if(number != null){ + String ns = String.valueOf(number); + String zeros = ""; + for(int i=0; i < x; i++){ + zeros +="0"; + } + return zeros+ns; + } + return null; + } + + private Map getRealMap(String tableName,String codeRule,Map map) throws Exception{ + Map rtnMap = new HashMap(); + Set set = getMatcher(REGEX_T, codeRule); + for(String sT : set){ + String[] arry = sT.split(","); + if(arry.length == 2){//通过外键查询 + String columName = arry[0]!=null?arry[0].trim():null;//当前表中的字段,通过该字段查询外键表 + String refTableColumnName = arry[1]!=null?arry[1].trim():null;//外键表中待查字段 + String refTable = AbstractPOJOInfo.getPOInfo(tableName).getReferenceTable(columName); + String entityId = (String)map.get(columName); + if(refTable == null){ + throw new Exception(columName+"外键关联表未找到!"); + } + if(entityId == null){ + throw new Exception(columName+"传入数据为空!"); + } + GeneralPOJO pojo = pojoCRUDService.loadPOJO(entityId, refTable, UserSession.getAdmin(), false); + rtnMap.put(sT, pojo.get_Value(refTableColumnName)); + }else if (arry.length == 3){//通过SQL语句查询 + String columName = arry[0]!=null?arry[0].trim():null;//当前表中的字段 + String rtnColumName = arry[1]!=null?arry[1].trim():null;//返回的字段 + String selectSQL = arry[2]!=null?arry[2].trim():null;//SQL语句 + Object entityId = map.get(columName); + if(entityId == null){ + throw new Exception(columName+"传入数据为空!"); + } + selectSQL = selectSQL.replaceAll(":"+columName, " '"+entityId+"' "); + String code = jdbcTemplate.queryForObject(selectSQL,String.class); +// String code = null;//编码 +// if(rowSet != null && rowSet.next()){ +// if(StringUtil.isEmpty(rtnColumName) +// ||StringUtil.isEmpty(rtnColumName.trim())){ +// code = rowSet.getString(0); +// }else{ +// code = rowSet.getString(rtnColumName.trim()); +// } +// } + rtnMap.put(sT, code); + } + } + return rtnMap; + } + + /** + * 查询流水号根据哪些条件递增 + * @param addRule + * @return + */ + private Set getRegexByAddRule(String addRule){ + Set set = new HashSet(); + if(addRule != null){ + for(String regex : ADDREGEXS){ + Set _regex = getMatcherALL(regex, addRule); + if(_regex.size() > 0){ + set.addAll(_regex); + } + } + } + return set; + } + +// private Long searchMaxNumber(String codeRuleId,String baseRule){ +// Map param = new HashMap(); +// param.put("CODERULEID", codeRuleId); +// param.put("BASERULE", baseRule); +// Map result = pojoCRUDService.listSelect(param, "SYS_CODEMAX", UserSession.getAdmin()); +// List pojos = (List)result.get(POJOCRUDService.LIST_RESULT); +// if(pojos != null && pojos.size() > 0 ){ +// //FIXME :to Long +// Integer maxNumber = (Integer)pojos.get(0).get_Value("maxnumber"); +// return Long.valueOf(maxNumber); +// } +// return null; +// } + + +// private String composeRuleNoNumber(String resultCode,Map map){ +// Calendar cal = Calendar.getInstance(); +// Map dataY = new HashMap(); +// dataY.put("2", new SimpleDateFormat("yy").format(cal.getTime())); +// dataY.put("4", new SimpleDateFormat("yyyy").format(cal.getTime())); +// +// Map dataM = new HashMap(); +// dataM.put("1", new SimpleDateFormat("M").format(cal.getTime())); +// dataM.put("2", new SimpleDateFormat("MM").format(cal.getTime())); +// +// Map dataD = new HashMap(); +// dataD.put("1", new SimpleDateFormat("d").format(cal.getTime())); +// dataD.put("2", new SimpleDateFormat("dd").format(cal.getTime())); +// +// try { +// resultCode = composeRule(REGEX_T, resultCode, map); +// resultCode = composeRule(REGEX_Y, resultCode, dataY); +// resultCode = composeRule(REGEX_M, resultCode, dataM); +// resultCode = composeRule(REGEX_D, resultCode, dataD); +// return resultCode; +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// } + + + + private Set getMatcher(String regex, String source) { + Set result = new LinkedHashSet(); + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(source); + while (matcher.find()) { + result.add(matcher.group(1)); + } + return result; + } + + private Set getMatcherALL(String regex, String source) { + Set result = new LinkedHashSet(); + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(source); + while (matcher.find()) { + result.add(matcher.group(0)); + } + return result; + } + + /** + * 按正则替换编码规则表达式 + * @param regex 正则表达式 + * @param template 编码规则表达式 + * @param data 各种编号的值 + * @return + * @throws Exception data未传入相应的值即提示错误 + */ + private String composeRule(String regex,String template, Map data) + throws Exception { + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(template); + StringBuffer sb = new StringBuffer(); + while (matcher.find()) { + String name = matcher.group(1); + if (data.get(name) == null) { + throw new Exception(name+"为空!"); + } + String value = data.get(name).toString(); + + matcher.appendReplacement(sb, value); + + } + + matcher.appendTail(sb); + return sb.toString(); + } + + /** + * 产生查询最大编码的正则表达式条件 + * @param regex 替换的正则表达式 + * @param template codeRule编码规则表达式 + * @param data 各种编号的值 + * @param set 流水号的递增项 + * @return + * @throws Exception data未传入相应的值即提示错误 + */ + private String composeRule_IsReplace(String regex,String template, Map data,Set set) + throws Exception { + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(template); + StringBuffer sb = new StringBuffer(); + while (matcher.find()) { + String nameAll = matcher.group(0); + String name = matcher.group(1); + String value = null; + if(set.contains(nameAll)){ + if(data.get(name) != null) + value = (String) data.get(name); + }else{ + if("%Y{2}".equals(nameAll)){ + value = "(\\\\d{2})"; + }else if("%Y{4}".equals(nameAll)){ + value = "(19|20|21)\\\\d{2}"; + }else if("%M{1}".equals(nameAll)){ + value = "([1-9]|1[012])"; + }else if("%M{2}".equals(nameAll)){ + value = "(0[1-9]|1[012])"; + }else if("%D{1}".equals(nameAll)){ + value = "([1-9]|[12]\\\\d|3[01])"; + }else if("%D{2}".equals(nameAll)){ + value = "(0[1-9]|[12]\\\\d|3[01])"; + }else{ + value = "(.*)"; + } + } + if (value == null) { + throw new Exception(name+"为空!"); + } + + matcher.appendReplacement(sb, value); + + } + + matcher.appendTail(sb); + return sb.toString(); + } + + public static void main(String[] args) { + CodeRuleServiceImpl test = new CodeRuleServiceImpl(); + String codeRule ="%T{ORGID}-%Y{4}-%M{2}-%D{2}-%N{5,25}"; + String addRule = "%T{ORGID}"; + Boolean isopen = true; + + Set types = test.getMatcher(test.REGEX_T, codeRule); + Set numbers = test.getMatcher(test.REGEX_N, codeRule); + + String number = numbers.iterator().next(); + String[] ns = number.split(","); + Long maxLength = Long.parseLong(ns[0]); + Long start = 0L; + if(ns.length > 1){ + start = Long.parseLong(ns[1]); + } + + //递增基础(计算流水号) + //1、查询流水号根据哪些项递增。 + Set replaceRegexs = test.getRegexByAddRule(addRule); + //2、组合正则表达式(递增基础替换,不作为递增结果的替换为正则通配符,流水号长度使用通配符) + String wheresql = codeRule; + try { +// for(String regex : ADDREGEXS){ +// wheresql = composeRule_IsReplace(regex, wheresql, map,replaceRegexs); +// } + + Calendar cal = Calendar.getInstance(); + Map dataY = new HashMap(); + dataY.put("2", new SimpleDateFormat("yy").format(cal.getTime())); + dataY.put("4", new SimpleDateFormat("yyyy").format(cal.getTime())); + + Map dataM = new HashMap(); + dataM.put("1", new SimpleDateFormat("M").format(cal.getTime())); + dataM.put("2", new SimpleDateFormat("MM").format(cal.getTime())); + + Map dataD = new HashMap(); + dataD.put("1", new SimpleDateFormat("d").format(cal.getTime())); + dataD.put("2", new SimpleDateFormat("dd").format(cal.getTime())); + + Map map = new HashMap(); + map.put("ORGID", "YI"); + + wheresql = test.composeRule_IsReplace(test.REGEX_Y, wheresql, dataY,replaceRegexs); + wheresql = test.composeRule_IsReplace(test.REGEX_M, wheresql, dataM,replaceRegexs); + wheresql = test.composeRule_IsReplace(test.REGEX_D, wheresql, dataD,replaceRegexs); + wheresql = test.composeRule_IsReplace(test.REGEX_T, wheresql, map,replaceRegexs); + + Map dataN = new HashMap(); + dataN.put(number, "(\\\\d{"+maxLength+"})"); + wheresql = test.composeRule(test.REGEX_N, wheresql, dataN); + System.out.println(wheresql); + Pattern p = Pattern.compile("\\(.*?\\)"); + Matcher m = p.matcher(wheresql); + int position = 0; + while(m.find()){ + position ++; + if(("\\\\d{"+maxLength+"}").equals(m.group())){ + break; + } + } + + Pattern pp = Pattern.compile(wheresql); + Matcher mm = pp.matcher("YI-1988-02-02-00001"); + if(mm.find()){ + System.out.println(mm.group(position)); + } +// Set ss = test.getMatcher(wheresql, "YI-1988-02-02-00001"); +// for(String s : ss){ +// //System.out.println(s); +// } +// +// Pattern p = Pattern.compile("\\(.*?\\)"); +// Matcher m = p.matcher(wheresql); +// while(m.find()){ +// System.out.println(m.group()); +// } + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/DataDicServiceImpl.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/DataDicServiceImpl.java new file mode 100644 index 0000000..27e05ee --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/DataDicServiceImpl.java @@ -0,0 +1,359 @@ +package com.dsasp.server.dataDic.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.rowset.SqlRowSet; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.dsasp.server.common.core.service.OriginServiceMethod; +import com.dsasp.server.common.dataDic.bean.AbstractPOJOInfo; +import com.dsasp.server.common.dataDic.bean.EnumerateItem; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.Rule; +import com.dsasp.server.common.dataDic.bean.SYS_Entity; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.dataDic.service.POJOService; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.user.service.LoggedInUser; +import com.dsasp.server.common.util.StringUtil; +import com.dsasp.server.common.util.UserSession; +import com.dsasp.server.dataDic.bean.DataDicHelper; +import com.dsasp.server.dataDic.bean.Entity; +import com.dsasp.server.dataDic.bean.EntityRule; +import com.dsasp.server.dataDic.bean.GeneralPO; +import com.dsasp.server.dataDic.bean.POInfo; +@Service(value="dataDicService") +@Transactional +public class DataDicServiceImpl implements DataDicService { + + @Autowired + private POJOService pojoService; + + @Autowired + private JdbcTemplate jdbcTemplate; + + + public POJOService getPojoService() { + return pojoService; + } + + public void setPojoService(POJOService pojoService) { + this.pojoService = pojoService; + } + + public JdbcTemplate getJdbcTemplate() { + return jdbcTemplate; + } + + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + @Override + public boolean delete(Map entity, Properties ctx) { +// //FIXME: 权限 +// HashMap map = new HashMap(); +// map.put(tableName + "_ID", entityId); +// GeneralPO po = new GeneralPO(tableName, map, ctx); +// return pojoService.delete(po, ctx != null ? ctx.getProperty("userId") : "admin", false); + + entity.put("ISACTIVE", false); + update(entity, ctx); + return true; + } + + @Override + public long findCount(String countSql) { + + return pojoService.findCount(countSql); + } + + @Override + public List getEntityAttributes(String entityID) { + String sql = "SELECT * FROM SYS_EntityAttribute WHERE entityId = '" + entityID + "'"; + return pojoService.listSelect(sql, "SYS_EntityAttribute", 0, Integer.MAX_VALUE); + } + + @Override + public List getMeta(int firstResult, int pageSize) { + String sql = "SELECT * FROM SYS_Meta"; + return pojoService.listSelect(sql, "SYS_Meta", firstResult, pageSize); + } + + @Override + public List listSelect(int firstResult, int pageSize, Map map) { + String sql = "SELECT * FROM SYS_Entity "; + return pojoService.listSelect(sql, "SYS_Entity", firstResult, pageSize); + } + + @Override + public Object save(Map entity, Properties ctx) { + GeneralPO po = new GeneralPO("SYS_ENTITY", entity, ctx); + pojoService.save(po, ctx != null ? ctx.getProperty(LoggedInUser.CURRENTUSER) : null); + return po; + } + + @Override + public Object update(Map entity, Properties ctx) { + // FIXME: 权限 + String entityId = (String) entity.get("SYS_Entity" + "_ID"); + GeneralPOJO po = pojoService.loadPOJO(entityId, "SYS_Entity", ctx, true); + if (po != null) { + int count = po.get_ColumnCount(); + for (int i = 0; i < count; i++) { + if (entity.containsKey(po.get_ColumnName(i))) { + String name = po.get_ColumnName(i); + po.set_ValueOfColumn(name, entity.get(name)); + } + } + // FIXME: userid is not null, this is test + return pojoService.update(po, + ctx != null ? ctx.getProperty(LoggedInUser.CURRENTUSER) : LoggedInUser.ADMIN); + } + return false; + } + + @Override + public SYS_Entity getSYSEntity(String entityId) { + GeneralPOJO po = pojoService.loadPOJO(entityId, "SYS_ENTITY", UserSession.getAdmin(), true); + return new Entity(po); + } + + @Override + public SYS_Entity getSYSEntityByTableName(String tableName) { + SqlRowSet set = jdbcTemplate.queryForRowSet("SELECT SYS_ENTITY_ID FROM SYS_ENTITY WHERE ISACTIVE=1 AND TABLENAME ='" + tableName + "'"); + if(set != null && set.next()){ + String entityId = set.getString("SYS_ENTITY_ID"); + GeneralPOJO po = pojoService.loadPOJO(entityId, "SYS_ENTITY", UserSession.getAdmin(), false); + return new Entity(po); + } + return null; + } + + public POJOInfo loadInfo(String tableName) { + StringBuffer sql = new StringBuffer(); + sql.append("select t.tableName,c.columnName,c.referenceID," // 1..3 + + " c.isMandatory,c.isReadOnly,c.defaultValue,c.displayName,c.description,c.SYS_EntityAttribute_id,c.isKey,c.ruleId as ruleCode," // 4..6 + + " c.fieldLength,c.valueMin,c.valueMax, t.accessLevel,c.columnSQL, " // 7..9 + + " t.isChangeLog as isChangeLog, c.referencevalue as referencevalue, c.isentitydisplay, c.enumeratetype, c.isidentifier, c.iscombidentifier, t.tabletype ,t.sys_entity_id, t.name "); // 21 + sql.append(" from SYS_Entity as t inner join SYS_EntityAttribute as c on (t.SYS_Entity_id = c.entityId)"); + // + " left join SYS_Meta as e on(c.metaId = e.SYS_Meta_id)"); + sql.append(" where t.tableName = ? and t.isActive = 1 and c.isActive = 1 ORDER BY C.ENTITYDISPLAYSEQ ASC"); + SqlRowSet result = jdbcTemplate.queryForRowSet(sql.toString(), + new Object[] { tableName }); + POJOInfo info = new POInfo(tableName, result); + return info; + + } + + public String getReferenceEntityTableName(String referenceId){ + String select = "SELECT TABLENAME FROM SYS_REFERENCE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID WHERE RE.SYS_REFERENCE_ID='" + referenceId + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + if(set != null && set.next()){ + return set.getString("TABLENAME"); + } + return null; + } + + public String getEntityTableNameByReferenceValue(String referenceValueId){ + String select = "SELECT ENT.TABLENAME " + + " FROM SYS_REFERENCEVALUE AS RE " + + " INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID " + + " WHERE RE.SYS_REFERENCEVALUE_ID='" + referenceValueId + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + if(set != null && set.next()){ + return set.getString("TABLENAME"); + } + return null; + } + + public String getColumnNameByReferenceValue(String referenceValueId){ + String select = "SELECT ATTRI.COLUMNNAME " + + " FROM SYS_REFERENCEVALUE AS RE " + + " INNER JOIN SYS_ENTITYATTRIBUTE AS ATTRI ON RE.ENTITYID = ATTRI.ENTITYID AND RE.ENTITYATTRIBUTEID = ATTRI.SYS_ENTITYATTRIBUTE_ID" + + " WHERE RE.SYS_REFERENCEVALUE_ID='" + referenceValueId + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + if(set != null && set.next()){ + return set.getString("COLUMNNAME"); + } + return null; + } + + + @Override + public String executeCreateSql(String sql) { + if (!StringUtil.isEmpty(sql) + && (sql.toUpperCase().trim().startsWith("CREATE ") || sql.trim().startsWith("INSERT INTO order_entity")) + && sql.trim().split(";").length <= 2) { + String[] sqls = sql.trim().split(";"); + if (sqls.length == 1 + || sqls[1].trim().startsWith("INSERT INTO order_entity")) { + jdbcTemplate.execute(sql); + return null; + } + } + return "非合法的创建表脚本"; + } + + @OriginServiceMethod(name="新增实体的默认属性", type = "dataDic" , description = "新增实体,默认产生createby,updatby,createtime,updatetime,version,isactive,orgid,departid") + @Override + public GeneralPOJO getTableDefaultAttribute() { + HashMap map = new HashMap(); + GeneralPOJO po = new GeneralPO("SYS_ENTITY", map, UserSession.get()); + po.updateHierarchicalValue("ATTRIBUTES", DataDicHelper.getTableDefaultAttributes()); + return po; + } + + public List getEntitysWithForeignKey(String entityId){ + String selectReferenceId = "SELECT SYS_REFERENCE_ID FROM SYS_REFERENCE WHERE ENTITYID='" + entityId + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(selectReferenceId); + if(set != null && set.next()){ + String referenceId = set.getString("SYS_REFERENCE_ID"); + HashMap map = new HashMap(); + GeneralPOJO po = new GeneralPO("SYS_REFERENCEVALUE", map, UserSession.getAdmin()); + StringBuffer select = po.getSelectBuild(); + select.append(" LEFT JOIN SYS_ENTITYATTRIBUTE AS A ON P.ENTITYID=A.ENTITYID AND P.ENTITYATTRIBUTEID=A.SYS_ENTITYATTRIBUTE_ID WHERE P.ISACTIVE=1 AND A.ISACTIVE=1 AND A.REFERENCEID='"); + select.append(referenceId); + select.append("'"); + return pojoService.listSelect(select.toString(), po.get_TableName(), 0, Integer.MAX_VALUE); + } + return null; + } + + /** + * save or update reference and reference value + */ + public void saveOrUpdateReference(GeneralPOJO po, Properties ctx){ + Entity entity = new Entity(po); + String entityId = entity.getPo().get_ID(); + //save or update reference + if(!entity.isView() && entity.getTabletype() == Entity.MAINTABLE){ + String existReference = "SELECT COUNT(*) FROM SYS_REFERENCE WHERE ISACTIVE = 1 AND ENTITYID='" + entityId + "'"; + int count = jdbcTemplate.queryForObject(existReference, Integer.class); + if(count == 0){ + Map map = new HashMap(); + map.put("ENTITYID", entityId); + map.put("NAME", entity.getPo().get_Value("NAME")); + map.put("DESCRIPTION", entity.getPo().get_Value("DESCRIPTION")); + GeneralPO referencePo = new GeneralPO("SYS_REFERENCE", map, ctx); + pojoService.save(referencePo, null); + }else{ + String update = "UPDATE SYS_REFERENCE SET NAME ='" + entity.getPo().get_Value("NAME") + "' WHERE ENTITYID = '" + entityId + "'"; + jdbcTemplate.update(update); + } + } + + //save or update reference value + List attributes = entity.getAttributes(); + String updateReferenceValue = "UPDATE SYS_REFERENCEVALUE SET ISACTIVE=0 WHERE ENTITYID='" + entityId + "'"; + jdbcTemplate.update(updateReferenceValue); + for (GeneralPOJO attri : attributes) { + boolean readOnly = attri.get_ValueAsBoolean(Entity.isReadonly); + if (!readOnly) { + String displayType = (String) attri + .get_Value(Entity.referenceid); + if(displayType.length() > 20){ + String sysEntityAttributeId = attri.get_ID(); + String existReference = "SELECT COUNT(*) FROM SYS_REFERENCEVALUE WHERE ENTITYID='" + entityId + "' AND ENTITYATTRIBUTEID='" + sysEntityAttributeId + "'"; + int count = jdbcTemplate.queryForObject(existReference, Integer.class); + if(count == 0){ + Map map = new HashMap(); + map.put("ENTITYID", entityId); + map.put("NAME", entity.getPo().get_Value("NAME")); + map.put("ENTITYATTRIBUTEID", sysEntityAttributeId); +// map.put("DESCRIPTION", entity.getPo().get_Value("DESCRIPTION")); + GeneralPO referencePo = new GeneralPO("SYS_REFERENCEVALUE", map, ctx); + pojoService.save(referencePo, null); + }else{ + String updateReferenceValueAttri = "UPDATE SYS_REFERENCEVALUE SET ISACTIVE=1 WHERE ENTITYID='" + entityId + "' AND ENTITYATTRIBUTEID='" + sysEntityAttributeId + "'"; + jdbcTemplate.update(updateReferenceValueAttri); + } + } + } + } + + //validate the reference value + String validateSql = "SELECT ATT.DISPLAYNAME FROM SYS_ENTITYATTRIBUTE AS ATT INNER JOIN SYS_REFERENCEVALUE AS REVALUE ON ATT.REFERENCEVALUE=REVALUE.SYS_REFERENCEVALUE_ID WHERE REVALUE.ISACTIVE=0 AND REVALUE.ENTITYID='" + entityId + "'"; + SqlRowSet validateCount = jdbcTemplate.queryForRowSet(validateSql); + if(validateCount.next()){ + throw new ValidationException(validateCount.getString("DISPLAYNAME") + "属性被其他实体应用,不能删除"); + } + AbstractPOJOInfo.setChangePOInfo(entityId); + //String deleteSql = "DELETE FROM SYS_REFERENCEVALUE WHERE ISACTIVE=0 AND ENTITYID='" + entityId + "'"; + } + + public List getRule(String tableName){ + SqlRowSet set = jdbcTemplate.queryForRowSet("SELECT SYS_ENTITY_ID FROM SYS_ENTITY WHERE ISACTIVE=1 AND TABLENAME ='" + tableName + "'"); + List listRule = new ArrayList(); + if(set != null && set.next()){ + String entityId = set.getString("SYS_ENTITY_ID"); + Map map = new HashMap(); + GeneralPO po = new GeneralPO("SYS_RULE", map, UserSession.getAdmin()); + StringBuffer select = po.getSelectBuild(); + map.put("ENTITYID", entityId); + StringBuffer where = po.get_SearchWhereClause(map); + select.append(where); + List list = pojoService.listSelect(select.toString(), po.get_TableName(), 0, Integer.MAX_VALUE); + + for(GeneralPOJO poRule : list){ + listRule.add(new EntityRule(poRule)); + } + } + return listRule; + } + + @Override + public List getEnumerateItems(String enumerateType) { + Map map = new HashMap(); + map.put("SYS_ENUMERATETYPE_ID", enumerateType); + GeneralPOJO po = new GeneralPO("SYS_ENUMERATE", map, UserSession.getAdmin()); + List cols = new ArrayList(); + cols.add("CODEVALUE"); + cols.add("CODEDES"); + cols.add("EXTENDATTRIBUTEONE"); + cols.add("EXTENDATTRIBUTETWO"); + cols.add("EXTENDATTRIBUTETHREE"); + StringBuffer select = po.getSelectBuild(cols); + StringBuffer where = po.get_SearchWhereClause(map); + if(where != null && where.length() > 0){ + select.append(where).append(" ORDER BY ORDERASC ASC"); + } + List list = pojoService.listSelectSpecialCols(select.toString(), po.get_TableName(), 0, Integer.MAX_VALUE, cols); + int size = list.size(); + if(list != null && size > 0){ + List items = new ArrayList(); + for(int i = 0; i < size; i++){ + GeneralPOJO pojo = list.get(i); + EnumerateItem item = new EnumerateItem(); + item.setCodeValue((Integer)pojo.get_Value("CODEVALUE")); + item.setCodeDes((String)pojo.get_Value("CODEDES")); + item.setExtendAttributeOne((String)pojo.get_Value("EXTENDATTRIBUTEONE")); + item.setExtendAttributeTwo((String)pojo.get_Value("EXTENDATTRIBUTETWO")); + item.setExtendAttributeThree((String)pojo.get_Value("EXTENDATTRIBUTETHREE")); + item.setEnumerateType(enumerateType); + items.add(item); + } + return items; + } + return null; + } + + public String getConfigValue(String key) { + SqlRowSet set = jdbcTemplate + .queryForRowSet("SELECT VALUE FROM SYS_APPLICATION_CONFIG WHERE SYS_APPLICATION_CONFIG_ID = '" + + key + "'"); + if (set != null && set.next()) { + return set.getString("VALUE"); + } + return null; + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOCRUDServiceImpl.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOCRUDServiceImpl.java new file mode 100644 index 0000000..4d7ea05 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOCRUDServiceImpl.java @@ -0,0 +1,610 @@ +package com.dsasp.server.dataDic.service; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.dsasp.server.common.core.service.OriginServiceMethod; +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.dataDic.service.POJOService; +import com.dsasp.server.common.file.service.FileService; +import com.dsasp.server.common.file.service.SYSDoc; +import com.dsasp.server.common.log.service.SystemLogManager; +import com.dsasp.server.common.log.service.SystemLogManager.LogType; +import com.dsasp.server.common.privilege.service.DataPrivilegeService; +import com.dsasp.server.common.user.service.LoggedInUser; +import com.dsasp.server.common.util.StringUtil; +import com.dsasp.server.common.util.UserSession; +import com.dsasp.server.dataDic.bean.Entity; +import com.dsasp.server.dataDic.bean.GeneralPO; +import com.dsasp.server.dataDic.bean.POInfo; + +@Service(value="pojoCRUDService") +@Transactional +public class POJOCRUDServiceImpl implements POJOCRUDService{ + + @Autowired + private POJOService pojoService; + + @Autowired + private DataPrivilegeService dataPrivilegeService; + + + public POJOService getPojoService() { + return pojoService; + } + + + public void setPojoService(POJOService pojoService) { + this.pojoService = pojoService; + } + + + public DataPrivilegeService getDataPrivilegeService() { + return dataPrivilegeService; + } + + + public void setDataPrivilegeService(DataPrivilegeService dataPrivilegeService) { + this.dataPrivilegeService = dataPrivilegeService; + } + + private SystemLogManager systemLogManager; + public SystemLogManager getSystemLogManager() { + return systemLogManager; + } + + public void setSystemLogManager(SystemLogManager systemLogManager) { + this.systemLogManager = systemLogManager; + } + + + /** + * return the result key count: number, key result: list + */ + @OriginServiceMethod(name = "通用数据查询",type = "dataDic", description = "数据查询,通用方法,Map 查询条件,tableName 查询实体,ctx 环境") + public Map listSelect(Map map, final String tableName, Properties ctx) { + Object returnList = map.get(RETURN_COLUMNS_LIST); + return listSelectSpecialCol(map, tableName, ctx, returnList == null ? null : (List)returnList); + } + + /** + * return the result key count: number, key result: list + */ + @OriginServiceMethod(name = "通用数据查询(指定返回列)",type = "dataDic", description = "可以指定返回字段的数据查询,通用方法,Map 查询条件,tableName 查询实体,ctx 环境, returnColMap 查询需要返回的列") + public Map listSelectSpecialCol(Map map, final String tableName, Properties ctx, List returnColMap) { + //FIXME:数据权限 + POJOInfo info = POInfo.getPOInfo(tableName); + if (returnColMap != null && returnColMap.size() > 0) { + if (info != null && info.getTableType() != Entity.MIDTABLE) { + if (!returnColMap.contains(tableName + "_ID")) { + returnColMap.add(tableName + "_ID"); + } + String displayName = info.getColumnName(info.getDisplayIndex()); + if(!returnColMap.contains(displayName)){ + returnColMap.add(displayName); + } + } + } + String order = (String)map.get(ORDER); + order = replaceReferOrderCols(order, info); + getOrderCols(order, returnColMap,info); + + + Map result = new HashMap(); + GeneralPO po = new GeneralPO(tableName, new HashMap(), ctx); + StringBuffer select = po.getSelectBuild(returnColMap); + if(!map.containsKey(RETURN_COLUMNS_LIST)){ + map.put(RETURN_COLUMNS_LIST, returnColMap); + } + StringBuffer where = po.get_SearchWhereClause(map); + String privilege = null; + if(ctx != null && !ctx.get(LoggedInUser.CURRENTUSER).equals(LoggedInUser.ADMIN)){ + privilege = dataPrivilegeService.getWhereClause(ctx, tableName); + } + + StringBuffer countSelect = null; + if(info != null && info.getTableType() != Entity.MIDTABLE){ + ArrayList list = new ArrayList(); + list.add(tableName + "_ID"); + countSelect = po.getSelectBuild(list); + } + if(select != null && select.length() > 0){ + boolean hasWhere = false; + if(where != null && where.length() > 0){ + select.append(where); + if(countSelect != null && countSelect.length() > 0){ + countSelect.append(where); + } + hasWhere = true; + } + if(privilege != null && privilege.length() > 0){ + if(!hasWhere){ + select.append(" WHERE "); + if(countSelect != null && countSelect.length() > 0){ + countSelect.append(" WHERE "); + } + hasWhere = true; + } +// else{ +// select.append(" AND "); +// } + select.append(privilege); + + if(countSelect != null && countSelect.length() > 0){ + countSelect.append(privilege); + } + } + } + if(select == null || select.length() == 0 ){ + return result; + } + String countSel = "SELECT COUNT(*) AS COU FROM (" + (countSelect != null && countSelect.length() > 0 ? countSelect : select) + ") AS TEMPTABLE "; + + if (!StringUtil.isEmpty(order)) { + select.append(" "); + select.append(order); + } + //合计列 + if(map.containsKey(SUM_COLUMNS_LIST)){ + List sumCols = (List)map.get(SUM_COLUMNS_LIST); + String sumsql = "SELECT "; + if(sumCols != null && sumCols.size() > 0){ + for(String col : sumCols){ + int cIndex = info.getColumnIndexByName(col); + if(cIndex> 0 + && (DisplayType.Number.equals(info.getColumnDisplayType(cIndex)) + ||DisplayType.Money.equals(info.getColumnDisplayType(cIndex))) + ){ + sumsql +="SUM(" +col+") as "+col+","; + } + } + } + if(sumsql.lastIndexOf(",")>0){ + sumsql= sumsql.substring(0,sumsql.length()-1)+" FROM (" + select + ") AS TEMPTABLE "; + Map sumMap = pojoService.findSumColumn(sumsql); + if(sumMap != null && sumMap.size() > 0){ + Set keys = sumMap.keySet(); + for(String key : keys){ + int cIndex = info.getColumnIndexByName(key); + if(cIndex > 0 && sumMap.get(key) != null){ + String dt = info.getColumnDisplayType(cIndex); + if(DisplayType.Number.equals(dt)){ + String formatStr = info.getColumnDescription(cIndex); + DecimalFormat format = null; + if(StringUtil.isEmpty(formatStr) || !(formatStr.contains("#") || formatStr.contains("0"))){ + format = new DecimalFormat("#.####"); + }else{ + format = new DecimalFormat(formatStr); + } + sumMap.put(key, format.format(sumMap.get(key))); + }else if (DisplayType.Money.equals(dt)) { + String formatStr = info.getColumnDescription(cIndex); + DecimalFormat format = null; + if(StringUtil.isEmpty(formatStr) || !(formatStr.contains("#") || formatStr.contains("0"))){ + format = new DecimalFormat("#,##0.00"); + }else{ + format = new DecimalFormat(formatStr); + } + sumMap.put(key, format.format(sumMap.get(key))); + } + } + } + } + result.put(RETURN_SUM_COLUMNS_MAP, sumMap); + } + } + + + //记录日志 + logSql(countSel, tableName); + long count = pojoService.findCount(countSel); + String selectStr = select.toString(); + if(selectStr.contains(" DISTINCT ")){ + long countWithoutDistinct = pojoService.findCount(countSel.replace("DISTINCT ", " ")); + if(count >= 1 && count == countWithoutDistinct){ + selectStr = selectStr.replace(" DISTINCT ", " "); + } + } + + result.put(PAGE_COUNT, count); + boolean isOnlyGetCount = map.get(IS_ONLY_GET_COUNT) == null ? false : (Boolean)map.get(IS_ONLY_GET_COUNT); + if (count >= 1 && !isOnlyGetCount) { + Object startObj = map.get(PAGE_START); + Object sizeObj = map.get(PAGE_SIZE); + int sta = (startObj == null ? 0 : (Integer) startObj); + int size = (sizeObj == null ? (int)count : (Integer) sizeObj); + sta = (sta > count ? 0 : sta); + size = (size > count ? (int)count : size); + //记录日志 + logSql(select.toString(), tableName); + List list = pojoService.listSelectSpecialCols(selectStr, + tableName, sta, + size, returnColMap); + result.put(LIST_RESULT, list); + } + return result; + } + + /** + * 附件和外键替换排序字段 + * @param orderBy + * @param info + * @return + */ + private String replaceReferOrderCols(String orderBy, POJOInfo info) { + if (!StringUtil.isEmpty(orderBy)) { + orderBy = orderBy.replaceAll(" " + GeneralPOJO.DOCUMENT + " ", " " + GeneralPOJO.DOCUMENT + GeneralPOJO.DISPLAY + " "); + + String[] cols = orderBy.toUpperCase().replace("ORDER", "") + .replaceAll(" BY ", "").replaceAll(" DESC", "") + .replaceAll(" ASC", "").split(","); + for(String col : cols){ + String[] strs = col.trim().split("\\."); + String colName = null; + if(strs.length > 1){ + colName = strs[1]; + }else if(strs.length == 1){ + colName = strs[0]; + } + if(info.getColumnIndexByName(colName)>0 + ){ + String rt = info.getReferenceTable(colName); + if(rt != null){ + orderBy = orderBy.replaceAll(" " + colName + " ", " " + colName + GeneralPOJO.DISPLAY + " "); + } + + } + + } + } + return orderBy; + } + + private List getOrderCols(String orderBy, List list,POJOInfo info) { + if (!StringUtil.isEmpty(orderBy) && list != null) { + String[] cols = orderBy.toUpperCase().replace("ORDER", "") + .replaceAll(" BY ", "").replaceAll(" DESC", "") + .replaceAll(" ASC", "").split(","); + for(String col : cols){ + String[] strs = col.trim().split("\\."); + String colName = null; + if(strs.length > 1){ + colName = strs[1]; + }else if(strs.length == 1){ + colName = strs[0]; + } + if(info.getColumnIndexByName(colName)>0 + ){ + String rt = info.getReferenceTable(colName); + if(rt != null){ + orderBy = orderBy.replaceAll(" " + colName + " ", " " + colName + GeneralPOJO.DISPLAY + " "); + } + + } + if(!list.contains(colName)){ + list.add(colName); + } + } + } + return list; + } + + + @OriginServiceMethod(name = "自定义sql数据查询(指定返回列)",type = "dataDic", description = "可以指定返回字段的数据查询,通用方法,Map 查询条件,tableName 查询实体,sql 自定义sql, ctx 环境, returnColMap 查询需要返回的列") + public Map listSelectBySql(Map map, final String tableName, String sql, Properties ctx, List returnColMap) { + + String order = (String)map.get(ORDER); + + Map result = new HashMap(); + if(!map.containsKey(RETURN_COLUMNS_LIST)){ + map.put(RETURN_COLUMNS_LIST, returnColMap); + } + + String countSel = "SELECT COUNT(*) AS COU FROM (" + sql + ") AS TEMPTABLE "; + if (!StringUtil.isEmpty(order)) { + sql = sql + order; + } + //记录日志 + logSql(countSel, tableName); + long count = pojoService.findCount(countSel); + + result.put(PAGE_COUNT, count); + boolean isOnlyGetCount = map.get(IS_ONLY_GET_COUNT) == null ? false : (Boolean)map.get(IS_ONLY_GET_COUNT); + if (count >= 1 && !isOnlyGetCount) { + Object startObj = map.get(PAGE_START); + Object sizeObj = map.get(PAGE_SIZE); + int sta = (startObj == null ? 0 : (Integer) startObj); + int size = (sizeObj == null ? (int)count : (Integer) sizeObj); + sta = (sta > count ? 0 : sta); + size = (size > count ? (int)count : size); + //记录日志 + logSql(sql, tableName); + List list = pojoService.listSelectSpecialCols(sql, + tableName, sta, + size, returnColMap); + result.put(LIST_RESULT, list); + } + return result; + } + + + /** + * return the result key count: number, key result: list + */ + @OriginServiceMethod(name = "通用数据查询(指定返回列)",type = "dataDic", description = "可以指定返回字段的数据查询,通用方法,Map 查询条件,tableName 查询实体,ctx 环境, returnColMap 查询需要返回的列") + public Map searchTreeStru(Map map, final String tableName, Properties ctx, List returnColMap) { + //FIXME:数据权限 + String parentColumnName = (String)map.get(PARENT_COLUMN_NAME); + if (!StringUtil.isEmpty(parentColumnName)) { + + if (returnColMap != null && returnColMap.size() > 0) { + POJOInfo info = POInfo.getPOInfo(tableName); + if (info != null && info.getTableType() != Entity.MIDTABLE) { + if (!returnColMap.contains(tableName + "_ID")) { + returnColMap.add(tableName + "_ID"); + } + String displayName = info.getColumnLabel(info + .getDisplayIndex()); + if (!returnColMap.contains(displayName)) { + returnColMap.add(displayName); + } + if(!returnColMap.contains(parentColumnName)){ + returnColMap.add(parentColumnName); + } + } + } + + Map result = new HashMap(); + GeneralPO po = new GeneralPO(tableName, + new HashMap(), ctx); + if (!map.containsKey(RETURN_COLUMNS_LIST)) { + map.put(RETURN_COLUMNS_LIST, returnColMap); + } + String privilege = ""; + if(ctx != null && !ctx.get(LoggedInUser.CURRENTUSER).equals(LoggedInUser.ADMIN)){ + privilege = dataPrivilegeService.getWhereClause(ctx, tableName); + } + //FIXME:需考虑权限和排序 + StringBuffer select = po.getWithRecursive(returnColMap, map, parentColumnName, privilege); + String sql = select.toString(); + + String order = (String)map.get(ORDER); + + + String countSel = "SELECT COUNT(*) AS COU FROM (" + sql + ") AS TEMPTABLE "; + if (!StringUtil.isEmpty(order)) { + sql = sql + order; + } + //记录日志 + logSql(countSel, tableName); + long count = pojoService.findCount(countSel); + + result.put(PAGE_COUNT, count); + boolean isOnlyGetCount = map.get(IS_ONLY_GET_COUNT) == null ? false : (Boolean)map.get(IS_ONLY_GET_COUNT); + if (count >= 1 && !isOnlyGetCount) { + Object startObj = map.get(PAGE_START); + Object sizeObj = map.get(PAGE_SIZE); + int sta = (startObj == null ? 0 : (Integer) startObj); + int size = (sizeObj == null ? (int)count : (Integer) sizeObj); + sta = (sta > count ? 0 : sta); + size = (size > count ? (int)count : size); + //记录日志 + logSql(sql, tableName); + List list = pojoService.listSelectSpecialCols(sql, + tableName, sta, + size, returnColMap); + result.put(LIST_RESULT, list); + } + return result; + } + return null; + } + + + @OriginServiceMethod(name = "通用数据保存",type = "dataDic", description = "数据保存,通用方法,Map 保存数据,tableName 保存实体,ctx 环境") + @Override + public GeneralPOJO save(Map map, String tableName, Properties ctx) { + //FIXME: 数据权限 + GeneralPO po = new GeneralPO(tableName, map, ctx); + pojoService.save(po, ctx != null ? ctx.getProperty(LoggedInUser.CURRENTUSER) : LoggedInUser.ADMIN); + return po; + } + + + @OriginServiceMethod(name = "通用数据更新",type = "dataDic", description = "数据更新,通用方法,Map 更新数据,tableName 更新实体,ctx 环境") + @Override + public GeneralPOJO update(Map map, String tableName, Properties ctx) { + //FIXME: 数据权限 + String entityId = (String) map.get(tableName + "_ID"); + GeneralPOJO po = pojoService.loadPOJO(entityId, + tableName, ctx, true); + if (po != null) { + int count = po.get_ColumnCount(); + for (int i = 0; i < count; i++) { + if (map.containsKey(po.get_ColumnName(i))) { + String name = po.get_ColumnName(i); + po.set_ValueOfColumn(name, map.get(name)); + } + } + //FIXME: userid is not null, this is test + pojoService.update(po, + ctx != null ? ctx.getProperty(LoggedInUser.CURRENTUSER) : LoggedInUser.ADMIN); + return po; + } + return null; + } + + + @OriginServiceMethod(name = "通用数据删除",type = "dataDic", description = "数据删除,通用方法,entityId 删除数据id,tableName 删除实体,ctx 环境") + @Override + public GeneralPOJO delete(String entityId, String tableName, Properties ctx) { + //FIXME: 数据权限 + + GeneralPOJO po = loadPOJO(entityId, tableName, ctx, true); + pojoService.delete(po, ctx != null ? ctx.getProperty("userId") : "admin", false); + return po; + } + + @OriginServiceMethod(name = "通用数据强行删除",type = "dataDic", description = "数据删除,通用方法,entityId 删除数据id,tableName 删除实体,ctx 环境") + @Override + public GeneralPOJO forceDelete(String entityId, String tableName, + Properties ctx) { + GeneralPOJO po = loadPOJO(entityId, tableName, ctx, true); + pojoService.delete(po, ctx != null ? ctx.getProperty("userId") : "admin", true); + return po; + } + + @OriginServiceMethod(name = "通用数据加载",type = "dataDic", description = "数据加载,通用方法,entityId 加载数据id,tableName 加载实体,ctx 环境,isHierarchical 是否级联加载") + @Override + public GeneralPOJO loadPOJO(String entityId, String tableName, Properties ctx, Boolean isHierarchical) { + GeneralPOJO result = null; +// GeneralPOJO po = new GeneralPO(tableName, null, UserSession.get()); +// //FIXME: 数据权限 +// StringBuffer select = po.getSelectBuild(); +// String sql = select + " WHERE " + tableName + "_ID='" + entityId + "'"; +// List list = pojoService.listSelect(sql, tableName, 0, 1); +// if(list != null && list.size() == 1){ +// result = list.get(0); +// } + result = pojoService.loadPOJO(entityId, tableName, ctx, isHierarchical); +// if(isHierarchical && result != null){ +// hierarchicalQuery(result, ctx); +// } + return result; + } + + private void hierarchicalQuery(GeneralPOJO po, Properties ctx){ + if(po != null){ + int count = po.get_ColumnCount(); + for(int i = 0; i < count; i++){ + String type = po.get_ColumnDisplayType(i); + if(DisplayType.List.equals(type)){ + String referenceColumn = po.get_referenceValueColumnName(i); + String referenceTable = po.get_poInfo().getReferenceValueTable(i); + Map map = new HashMap(); + map.put(referenceColumn, po.get_ID()); + GeneralPO subPo = new GeneralPO(referenceTable, new HashMap(), ctx); + StringBuffer select = subPo.getSelectBuild(); + StringBuffer where = subPo.get_SearchWhereClause(map); + if(select != null && select.length() > 0){ + if(where != null && where.length() > 0){ + select.append(where); + } + } + //增加子表默认排序,按第二个col升序排序,第一个col为id + String orderCol = subPo.get_ColumnName(1); + select.append(" ORDER ").append(" BY P.").append(orderCol).append(" ASC "); + + List list = pojoService.listSelect(select.toString(), referenceTable, 0, Integer.MAX_VALUE); + POJOInfo referenceInfo = po.initPO(referenceTable); + if(referenceInfo.getTableType() == Entity.MIDTABLE && list.size() > 0){ + String otherForeignCol = referenceColumn.equals(referenceInfo.getColumnName(0)) ? referenceInfo.getColumnName(1) : referenceInfo.getColumnName(0); + List midList = new ArrayList(); + for(GeneralPOJO midPO : list){ + midList.add((String)midPO.get_Value(otherForeignCol)); + } + po.updateHierarchicalValue(i, midList); + } else { + loadSubTableDoc(list, ctx); + po.updateHierarchicalValue(i, list); + } + }else if(DisplayType.Binary.equals(type)){ + loadDoc(po, i); + } + } + } + } + + /** + * 加载子表的附件 + * @param list + */ + private void loadSubTableDoc(List list, Properties ctx){ + if(list != null && list.size() > 0){ + GeneralPOJO po = list.get(0); + if(po != null){ + int count = po.get_ColumnCount(); + for(int i = 0; i < count; i++){ + String type = po.get_ColumnDisplayType(i); + if(DisplayType.Binary.equals(type)){ + for(GeneralPOJO pojo : list){ + loadDoc(pojo, i); + } + }else if(DisplayType.List.equals(type)){ + for(GeneralPOJO pojo : list){ + hierarchicalQuery(pojo, ctx); + } + } + } + } + } + } + + private void loadDoc(GeneralPOJO po, int i){ + FileService fileService = (FileService)SpringBeanOsgiServices.getInstance().getBeanByName("fileService"); + List businessKeys = new ArrayList(); + businessKeys.add(po.get_ID()); + List list = fileService.getDoc(businessKeys); + if (list != null) { + List> objs = new ArrayList>(); + for (GeneralPOJO file : list) { + Map map = new HashMap(); + map.put(SYSDoc.docId, file.get_ID()); + map.put(SYSDoc.fileName, + file.get_Value(SYSDoc.fileName)); + map.put(SYSDoc.fileSize, + file.get_Value(SYSDoc.fileSize)); + map.put(SYSDoc.filePath, + file.get_Value(SYSDoc.filePath)); + map.put(GeneralPOJO.UPDATETIME, file.get_Value(GeneralPOJO.UPDATETIME)); + objs.add(map); + } + po.updateHierarchicalValue(i, objs); + } + } + + + + @Override + public Object executeProcedureReturnObject( + String returnType, String[][] returnSetType, Properties ctx, String procedure) { + return pojoService.executeProcedureReturnList(procedure, returnType, returnSetType); + } + + @OriginServiceMethod(name = "通用数据批量保存",type = "dataDic", description = "数据;批量保存,通用方法,list 保存数据,tableName 保存实体,ctx 环境") + public void batchSave(List list, String tableName, Properties ctx) { + // FIXME: 数据权限 忽略批量插入的日志 + if (list != null) { + StringBuffer buffer = new StringBuffer(); + String userID = ctx != null ? ctx + .getProperty(LoggedInUser.CURRENTUSER) : LoggedInUser.ADMIN; + for (Map map : list) { + GeneralPO po = new GeneralPO(tableName, map, ctx); + buffer.append(pojoService.save_convertToSql(po, userID, null)) + .append(";\n"); + } + if (buffer.length() > 0) { + pojoService.batchExecute(buffer.toString()); + } + } + } + + private void logSql(String sql,String tableName){ + if(tableName != null && !tableName.startsWith("SYS_")){ + this.systemLogManager.log(LogType.INFO, sql); + } + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOServiceImpl.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOServiceImpl.java new file mode 100644 index 0000000..0ae274f --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/service/POJOServiceImpl.java @@ -0,0 +1,1346 @@ +package com.dsasp.server.dataDic.service; + +import java.math.BigDecimal; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; + +import org.joda.time.DateTime; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.CallableStatementCallback; +import org.springframework.jdbc.core.CallableStatementCreator; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.PreparedStatementCreator; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.jdbc.support.rowset.SqlRowSet; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.dsasp.server.common.core.service.SpringBeanOsgiServices; +import com.dsasp.server.common.dataDic.bean.DisplayType; +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.bean.POJOInfo; +import com.dsasp.server.common.dataDic.bean.Rule; +import com.dsasp.server.common.dataDic.service.POJOService; +import com.dsasp.server.common.exception.SameCodeException; +import com.dsasp.server.common.exception.ValidationException; +import com.dsasp.server.common.file.service.FileService; +import com.dsasp.server.common.file.service.SYSDoc; +import com.dsasp.server.common.log.service.DataOperatorLog; +import com.dsasp.server.common.log.service.SystemLogManager; +import com.dsasp.server.common.log.service.SystemLogManager.LogType; +import com.dsasp.server.common.util.StringUtil; +import com.dsasp.server.common.util.UserSession; +import com.dsasp.server.dataDic.bean.Entity; +import com.dsasp.server.dataDic.bean.GeneralPO; +import com.dsasp.server.dataDic.binding.GeneralPOJOBindings; +import com.dsasp.server.dataDic.binding.ScriptingEnginesManager; + +@Service(value = "pojoService") +@Transactional +public class POJOServiceImpl implements POJOService { + + private static String defaultImport = " import com.dsasp.server.common.dataDic.bean.GeneralPOJO; \n" + + " import com.dsasp.server.common.util.StringUtil; \n" + + " import com.dsasp.server.common.function.GetServicesFunction; \n" + + " import com.dsasp.server.common.function.GetDefaultValueFunction; \n" + + " import com.dsasp.server.common.function.GetValueFunction; \n"; + + @Autowired + private JdbcTemplate jdbcTemplate; + + private DataOperatorLog dataOperatorLog; + + private SystemLogManager systemLogManager; + + public JdbcTemplate getJdbcTemplate() { + return jdbcTemplate; + } + + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + + public DataOperatorLog getDataOperatorLog() { + return dataOperatorLog; + } + + public void setDataOperatorLog(DataOperatorLog dataOperatorLog) { + this.dataOperatorLog = dataOperatorLog; + } + + public void batchExecute(String sql){ + this.jdbcTemplate.execute(sql); + } + + public SystemLogManager getSystemLogManager() { + return systemLogManager; + } + + public void setSystemLogManager(SystemLogManager systemLogManager) { + this.systemLogManager = systemLogManager; + } + + public int executeUpdate (String sql) + { + if (sql == null || sql.length() == 0) + throw new IllegalArgumentException("Required parameter missing - " + sql); + // + return jdbcTemplate.update(sql); + } // executeUpdate + + public SqlRowSet executeQuery(String sql, Object... objects){ + return jdbcTemplate.queryForRowSet(sql, objects); + } + + public Map executeQueryForMap(String sql){ + return jdbcTemplate.queryForMap(sql); + } + + public long executeQueryForLong(String sql, Object... objects ){ + return jdbcTemplate.queryForObject(sql, Long.class, objects); + } + + public boolean exists(String tableName, String record_ID){ + if(!StringUtil.isEmpty(tableName) && !StringUtil.isEmpty(record_ID)){ + StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ").append(tableName).append(" WHERE ").append(tableName + "_ID" + " = '").append(record_ID).append("'"); + try{ + int count = jdbcTemplate.queryForObject(sql.toString(), Integer.class); + if(count > 0 ){ + return true; + }else{ + return false; + } + }catch(Exception e){ + return false; + } + } + return false; + } + + + + @Override + public boolean delete(GeneralPOJO po, String userID, Boolean force) { + return deletePo(po, userID, force, UUID.randomUUID().toString(), null); + } + + public boolean deletePo(GeneralPOJO po, String userID, Boolean force, String dataLogItemId, String mainDataLogItemId){ + + // CLogger.resetLast(); + if (po == null || po.is_new()) + return true; + + String AD_Table_Name = po.get_TableName(); + String Record_ID = po.get_ID(); + + if (!force) { + // FIXME: 非强制性的删除,已处理无法删除�? + int iProcessed = po.get_ColumnIndex("Processed"); + if (iProcessed != -1) { + Boolean processed = (Boolean) po.get_Value(iProcessed); + if (processed != null && processed.booleanValue()) { + return false; + } + } // processed + } // force + + // Trx localTrx = null; + boolean success = false; + + try { + beforeDelete(po, userID); + }catch(ValidationException e){ + throw e; + } catch (Exception e) { + throw new ValidationException("删除前的规则验证不通过 " + e.getMessage()); + } + + + // Delete Restrict AD_Table_ID/Record_ID (Requests, ..) + boolean errorMsg = exists(AD_Table_Name, Record_ID); + if (!errorMsg) { + // log.saveError("CannotDelete", errorMsg); + return false; + } + // Call ModelValidators TYPE_DELETE + // FIXME: 删除验证 + + // FIXME: 级联删除 + // DB.deleteCascade(AD_Table_Name, Record_ID, localTrxName); + boolean deleteCascade = deleteCascade(AD_Table_Name, Record_ID, userID, + force, dataLogItemId); + + // The Delete Statement + StringBuffer sql = new StringBuffer("DELETE FROM ") + // jz why no + // FROM?? + .append(po.get_TableName()).append(" WHERE ") + .append(po.get_WhereClause(true)); + int no = 0; + no = executeUpdate(sql.toString()); + success = no == 1; + // + if (!success) { + // log.warning("Not deleted"); + throw new ValidationException("删除的对象不存在"); + } + + try { + success = afterDelete(po, userID); + }catch(ValidationException e){ + throw e; + } + catch (Exception e) { + throw new ValidationException("删除后的规则验证不通过 " + e.getMessage()); + } + // log.info("" + success); + if (success) { + // FIXME: log the operation + dataOperatorLog.deleteData(po, dataLogItemId, mainDataLogItemId); + } + return success; + + } + + + /** + * cascade delete that record + * @param tableName + * @param recordID + * @return + */ + private boolean deleteCascade(String tableName, String recordID, String userID, boolean force, String mainDataLogItemId) { + String select = "SELECT SYS_REFERENCE_ID FROM SYS_REFERENCE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID WHERE ENT.TABLENAME='" + + tableName + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + String reference_id = ""; + List businessKeyList = new ArrayList(); + businessKeyList.add(recordID); + if (set != null && set.next()) { + reference_id = set.getString("SYS_REFERENCE_ID"); + String cascadeSql = "SELECT ENT.TABLENAME, ENT.NAME, RE.COLUMNNAME, ENT.TABLETYPE FROM SYS_ENTITYATTRIBUTE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID WHERE (RE.COLUMNSQL IS NULL OR RE.COLUMNSQL='') AND ENT.ISVIEW = 0 AND RE.REFERENCEID='" + + reference_id + "'"; + SqlRowSet tables = jdbcTemplate.queryForRowSet(cascadeSql); + StringBuffer sql = new StringBuffer(); + List subMidTables = getSubMidTable(tableName); + while (tables.next()) { + String table = tables.getString("TABLENAME"); + String name = tables.getString("NAME"); + String columnName = tables.getString("COLUMNNAME"); + int tableType = tables.getInt("TABLETYPE"); + //if cascade table is subtable or midtable, delete data redirect + if (subMidTables.contains(table)) { + sql.append(" DELETE FROM ") + .append(table).append(" WHERE ").append(columnName) + .append(" = '" + recordID + "';\n"); + if(tableType == Entity.SUBTABLE){ + String tableIDName = table + "_ID"; + String subRecordIdSql = "SELECT " + tableIDName + " FROM " + table + " WHERE " + columnName + " = '" + recordID + "'"; + SqlRowSet recordIds = jdbcTemplate.queryForRowSet(subRecordIdSql); + while(recordIds.next()){ + //级联删除子表的子表 + String subRecordId = recordIds.getString(tableIDName); + deleteCascade(table, subRecordId, userID, force, mainDataLogItemId); + businessKeyList.add(subRecordId); + } + } + }else{ + Map map = new HashMap(); + map.put(columnName, recordID); + GeneralPO subPo = new GeneralPO(table, new HashMap(), UserSession.get()); + StringBuffer deleteRecord = subPo.getSelectBuild(); + StringBuffer where = subPo.get_SearchWhereClause(map); + if(deleteRecord != null && deleteRecord.length() > 0){ + if(where != null && where.length() > 0){ + deleteRecord.append(where); + } + } + List list = listSelect(deleteRecord.toString(), table, 0, Integer.MAX_VALUE); + //增加一个特殊情况,sys_referencevalue表中的值无法手动删除,在此排除它,不做控制。 + if(!force && list != null && list.size() > 0 && !table.equals("SYS_REFERENCEVALUE")){ + throw new ValidationException(name + "表中使用该记录,不能直接删除该记录"); + } + for (GeneralPOJO po : list) { + deletePo(po, userID, force, UUID.randomUUID().toString(), mainDataLogItemId); + } + } + } + jdbcTemplate.execute(sql.toString()); + FileService fileService = (FileService)SpringBeanOsgiServices.getInstance().getBeanByName("fileService"); + fileService.deleteAttatchmentByBusinessKey(businessKeyList, userID); + return true; + } + return false; + } + + private List getSubMidTable(String tableName) { + String sql = " SELECT ENT.TABLENAME FROM SYS_ENTITYATTRIBUTE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID" + + " WHERE RE.SYS_ENTITYATTRIBUTE_ID IN (" + + " SELECT RV.entityattributeid FROM sys_referencevalue AS RV" + + " WHERE RV.sys_referencevalue_id IN (" + + " SELECT ZH.referencevalue FROM SYS_ENTITYATTRIBUTE AS ZH INNER JOIN SYS_ENTITY AS ZHENT ON ZH.ENTITYID = ZHENT.SYS_ENTITY_ID" + + " WHERE ZH.referencevalue IS NOT NULL AND ZHENT.TABLENAME='" + + tableName + "'))"; + List list = new ArrayList(); + SqlRowSet set = jdbcTemplate.queryForRowSet(sql); + while(set.next()){ + String subMidTable = set.getString("TABLENAME"); + list.add(subMidTable); + } + return list; + } + + public boolean deleteCascadeValidate(String tableName, String recordID) { + String select = "SELECT SYS_REFERENCE_ID FROM SYS_REFERENCE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID WHERE ENT.TABLENAME='" + + tableName + "'"; + SqlRowSet set = jdbcTemplate.queryForRowSet(select); + String reference_id = ""; + List businessKeyList = new ArrayList(); + businessKeyList.add(recordID); + if (set != null && set.next()) { + reference_id = set.getString("SYS_REFERENCE_ID"); + + //排除本身的子表和中间表 + //except sub and mid table owner + String cascadeSql = "SELECT ENT.TABLENAME, ENT.NAME, RE.COLUMNNAME, ENT.TABLETYPE FROM SYS_ENTITYATTRIBUTE AS RE INNER JOIN SYS_ENTITY AS ENT ON RE.ENTITYID = ENT.SYS_ENTITY_ID WHERE (RE.COLUMNSQL IS NULL OR RE.COLUMNSQL='') AND ENT.ISVIEW = 0 AND RE.REFERENCEID='" + + reference_id + "'" + + " AND RE.SYS_ENTITYATTRIBUTE_ID NOT IN (SELECT RV.entityattributeid FROM sys_referencevalue AS RV" + + " WHERE RV.sys_referencevalue_id IN (" + + " SELECT ZH.referencevalue FROM SYS_ENTITYATTRIBUTE AS ZH INNER JOIN SYS_ENTITY AS ZHENT ON ZH.ENTITYID = ZHENT.SYS_ENTITY_ID " + +" WHERE ZH.referencevalue IS NOT NULL AND ZHENT.TABLENAME='" + tableName + "' ))"; + SqlRowSet tables = jdbcTemplate.queryForRowSet(cascadeSql); + StringBuffer sql = new StringBuffer(); + while (tables.next()) { + String table = tables.getString("TABLENAME"); + String name = tables.getString("NAME"); + String columnName = tables.getString("COLUMNNAME"); + int tableType = tables.getInt("TABLETYPE"); + //if cascade table is subtable or midtable, delete data redirect + + Map map = new HashMap(); + map.put(columnName, recordID); + map.put(GeneralPOJO.ISACTIVE, 1); + GeneralPO subPo = new GeneralPO(table, new HashMap(), UserSession.get()); + StringBuffer deleteRecord = subPo.getSelectBuild(); + StringBuffer where = subPo.get_SearchWhereClause(map); + if(deleteRecord != null && deleteRecord.length() > 0){ + if(where != null && where.length() > 0){ + deleteRecord.append(where); + } + } + List list = listSelect(deleteRecord.toString(), table, 0, Integer.MAX_VALUE); + //增加一个特殊情况,sys_referencevalue表中的值无法手动删除,在此排除它,不做控制。 + if(list != null && list.size() > 0 && !table.equals("SYS_REFERENCEVALUE")){ + throw new ValidationException(name + "表中使用该记录,不能直接删除该记录"); + } + } + return true; + } + return false; + } + + private boolean beforeDelete(GeneralPOJO po, String userID){ + executeScript(po, Rule.BEFOREDELETE); + return true; + } + + private boolean afterDelete(GeneralPOJO po, String userID){ + executeScript(po, Rule.AFTERDELETE); + return true; + } + + @Override + public POJOInfo getPOJOInfo(String tableName) { + return null; + } + + + @Override + public boolean save(GeneralPOJO po, String userID) { + + if(!saveNew(po, userID, null)){ + throw new RuntimeException(); + } + return true; + } + + private boolean saveNew(GeneralPOJO po, String userID, String mainDataLogItemId) { + StringBuffer sqlInsert = save_convertToSql(po, userID, null); + logSql(sqlInsert.toString(),po.get_TableName()); + getJdbcTemplate().execute(sqlInsert.toString()); + boolean success = finishSave(po, true, true); + dataOperatorLog.insertData(po, UUID.randomUUID().toString(), mainDataLogItemId); + return success; + } + + public StringBuffer save_convertToSql(GeneralPOJO po, String userID, String foreignColName) { + if(!beforeSave(po, userID)){ + throw new RuntimeException(); + } + + String uuid = po.get_ID(); + if (po.get_KeyColumns().length == 1 + && po.get_KeyColumns()[0].endsWith(GeneralPOJO.KEYEND)) // AD_Language, + // EntityType + { + if (StringUtil.isEmpty(uuid)) { + uuid = UUID.randomUUID().toString(); + po.set_ValueOfColumn(po.get_KeyColumns()[0], uuid); + } + + } + + for (int i = 0; i < po.get_ColumnCount(); i++) { + if(!StringUtil.isEmpty(foreignColName) && po.get_ColumnName(i).equals(foreignColName)){ + continue; + } + String errorMsg = po.get_poInfo().validateValue(i, po.get_Value(i));// 验证字段长度、大小 + if (errorMsg != null) { + throw new ValidationException(errorMsg); + } + } + List subSql = new ArrayList(); + // Set new DocumentNo + String columnName = "DocumentNo"; + int index = po.get_ColumnIndex(columnName); + if (index != -1) { + // FIXME:设置单据编号 + } + int AD_ChangeLog_ID = 0; + // SQL + StringBuffer sqlInsert = new StringBuffer("INSERT INTO "); + sqlInsert.append(po.get_TableName()).append(" ("); + StringBuffer sqlValues = new StringBuffer(") VALUES ("); + int size = po.get_ColumnCount(); + boolean doComma = false; + for (int i = 0; i < size; i++) { + Object value = po.get_Value(i); + // Don't insert NULL values (allows Database defaults) + + if ((value == null && !GeneralPOJO.VERSION.equals(po.get_ColumnName(i))) || po.isVirtualColumn(i)){ + + continue; + }else if(value == null && GeneralPOJO.VERSION.equals(po.get_ColumnName(i))){ + po.set_ValueOfColumn(GeneralPOJO.VERSION, 0); + } + + // FIXME: 附件处理 + // Display Type + String dt = po.get_ColumnDisplayType(i); + if (DisplayType.isLOB(dt)) { + if(value instanceof List){ + List> fileList = (List>)value; + for(Map map : fileList){ + saveAttachments(map, po.get_TableName(), uuid, po.getCtx()); + } + } + continue; + } + + // ** add column ** + if (!DisplayType.List.equals(dt)) { + if (doComma) { + sqlInsert.append(","); + sqlValues.append(","); + } else + doComma = true; + sqlInsert.append(po.get_ColumnName(i)); + } + // + // Based on class of definition, not class of value + Class c = po.get_ColumnClass(i); + try { + if (c == Object.class) // may have need to deal with null values + // differently + sqlValues.append(StringUtil.TO_STRING( + saveNewSpecial(value, i), 0)); + else if (c != List.class && value.equals(GeneralPOJO.NULL)) + sqlValues.append("NULL"); + else if (c == Integer.class || c == BigDecimal.class + || value instanceof Integer + || value instanceof BigDecimal) + sqlValues.append(value); + else if (c == Boolean.class) { + boolean bValue = false; + if (value instanceof Boolean) + bValue = ((Boolean) value).booleanValue(); + else + bValue = "Y".equals(value); + sqlValues.append(bValue ? "1" : "0"); + } else if (c == DateTime.class || value instanceof DateTime){ + + sqlValues.append(((DateTime) value).getMillis()); + } + // else if (value instanceof Date) + // sqlValues.append (StringUtil.TO_DATE + // ((DateTime)encrypt(i,value), p_info.getColumnDisplayType (i) + // == DisplayType.Date)); + else if (c == String.class) + sqlValues.append(StringUtil.TO_STRING((String) value, 0)); + // else if (DisplayType.isLOB(dt)) + // sqlValues.append("null"); + else if (c == List.class) { + // FIXME: 处理子表数据 + String foreignKeyColName = po + .get_referenceValueColumnName(i); + String referenceTableName = po.get_poInfo().getReferenceValueTable(i); + POJOInfo referenceInfo = po.initPO(referenceTableName); + if(referenceInfo.getTableType() == Entity.MIDTABLE){ + processMidList(subSql, value, referenceInfo, foreignKeyColName, uuid); + } else { + processSubList(subSql, value, foreignKeyColName, uuid, + userID, po); + } + } else + sqlValues.append(StringUtil.TO_STRING( + saveNewSpecial(value, i), 0)); + + }catch(ValidationException ex){ + throw ex; + } + catch (Exception e) { + // Message; + throw new RuntimeException(e); // fini + } + // Change Log - Only + } + + sqlInsert.append(sqlValues).append(")"); + if (subSql != null && subSql.size() > 0) { + for (StringBuffer sql : subSql) { + sqlInsert.append(";\n"); + sqlInsert.append(sql); + } + } + return sqlInsert; + } + + private void saveAttachments(Map map, String tableName, + String uuid, Properties ctx) { + FileService fileService = (FileService) SpringBeanOsgiServices + .getInstance().getBeanByName("fileService"); +// String filePath = (String) map.get(SYSDoc.filePath); + String tmepFile = (String) map.get(SYSDoc.tempFile); + if (!StringUtil.isEmpty(tmepFile)) { + String remotfilePath = fileService.save((String) map.get(SYSDoc.tempFile), + (String) map.get(SYSDoc.fileName), + (Integer) map.get(SYSDoc.fileSize), tableName, uuid, ctx); + map.put(SYSDoc.filePath, remotfilePath); + } else { + fileService.saveDoc((String) map.get(SYSDoc.filePath), + (String) map.get(SYSDoc.fileName), + (Integer) map.get(SYSDoc.fileSize), tableName, uuid, ctx); + } + } + + /** + * process the sub table data, convert to sql + * @param list + * @param listPo + * @param foreignKeyColName + * @param uuid + * @param userID + */ + private void processSubList(List list, Object listPo, String foreignKeyColName, String uuid, String userID, GeneralPOJO mainPO){ + if (listPo != null && listPo instanceof List) { + List listPojo = (List) listPo; + int size = listPojo.size(); + if (size > 0) { + GeneralPOJO poex = listPojo.get(0); + int count = poex.get_ColumnCount(); + Map identiMap = new HashMap(); + List combList = new ArrayList(); + for (int j = 0; j < count; j++) { + boolean isIdentifier = poex.get_poInfo().isIdentifier(j); + if(isIdentifier){ + identiMap.put(j, null); + continue; + } + boolean isCombIdentifier = poex.get_poInfo() + .isCombidentifier(j); + if(isCombIdentifier){ + combList.add(j); + } + } + List comb = new ArrayList(); + for (int i = 0; i < size; i++) { + GeneralPOJO po = listPojo.get(i); + po.set_ValueOfColumn(foreignKeyColName, uuid); + po.setMainPO(mainPO); + po.set_ValueOfColumn(GeneralPOJO.SEQUENCE, i + 1); + list.add(save_convertToSql(po, userID, foreignKeyColName)); + isCombIdentifierList(combList, po, comb); + isIdentifierList(identiMap, po); + } + } + } + } + + public boolean isIdentifierList(Map map, GeneralPOJO po){ + if(map.size() > 0){ + Iterator set = map.keySet().iterator(); + while(set.hasNext()){ + Integer j = set.next(); + List list = map.get(j); + if(list != null){ + Object obj = po.get_Value(j); + if(list.contains(obj)){ + throw new ValidationException("明细" + po.get_poInfo().getColumnLabel(j) + " 不唯一 "); + }else{ + list.add(obj); + } + }else{ + list = new ArrayList(); + list.add(po.get_Value(j)); + map.put(j, list); + } + } + } + return true; + } + + public boolean isCombIdentifierList(List list, GeneralPOJO po, List comb){ + String s = ""; + String coms = ""; + for(int i = 0; i < list.size(); i++){ + Object obj = po.get_Value(list.get(i)); + s += "-"; + if(obj != null){ + s += obj.toString(); + } + coms += po.get_poInfo().getColumnLabel(list.get(i)) + "、"; + } + if(comb.contains(s)){ + + throw new ValidationException("明细" + coms + "联合不唯一"); + } + return true; + } + + + private void processMidList(List subSql, Object value, POJOInfo info, String foreignKeyColName, String uuid){ + if(value != null && value instanceof List){ + List list = (List)value; + String midTableName = info.getTableName(); + String otherColumnName = foreignKeyColName.equals(info.getColumnName(0)) ? info.getColumnName(1) : info.getColumnName(0); + for(String other : list){ + StringBuffer sqlInsert = new StringBuffer(" INSERT INTO "); + sqlInsert.append(info.getTableName()).append(" ("); + sqlInsert.append(foreignKeyColName).append(", ").append(otherColumnName); + sqlInsert.append(") VALUES ("); + sqlInsert.append(StringUtil.TO_STRING(uuid, 0)).append(","); + sqlInsert.append(StringUtil.TO_STRING(other, 0)).append("); \n"); + subSql.add(sqlInsert); + } + } + } + + protected String saveNewSpecial (Object value, int index) + { + + if(value == null){ + return "NULL"; + } + //FIXME: 如果引用的对象也是未保存对象应该同时保存引用对象�? + else if(value instanceof GeneralPO){ + return ((GeneralPO) value).get_ID(); + } + return value.toString(); + } // saveNewSpecial + + /** + * validate the String length, value max and min, is mandatory, is identifier , is combidentifier and entity rule + * @param po + * @param userID + * @return + */ + private boolean beforeSave(GeneralPOJO po, String userID){ + int size = po.get_ColumnCount(); + String select = "SELECT COUNT(*) FROM " + po.get_TableName(); + StringBuffer combIdentifierSql = new StringBuffer(); + StringBuffer combLael = new StringBuffer(); + for(int index = 0; index < size; index++){ + Class c = po.get_ColumnClass(index); + String columnName = po.get_ColumnName(index); + String label = po.get_poInfo().getColumnLabel(index); + boolean isIdentifier = po.get_poInfo().isIdentifier(index); + boolean isCombIdentifier = po.get_poInfo().isCombidentifier(index); + Object obj = po.get_Value(index); + + if(isIdentifier && !po.get_poInfo().isKey(index)){ + StringBuffer isIdentifierSql = new StringBuffer(); + isIdentifierSql.append(select).append(" WHERE ") + //.append(" ISACTIVE = 1 AND ") + .append(columnName).append(" = "); + if(c == Object.class || c == String.class){ + if (obj != null) { + isIdentifierSql.append(StringUtil.TO_STRING( + obj.toString(), 0)); + }else{ + throw new ValidationException(label + "必填"); + } + }else if(c == DateTime.class && obj instanceof DateTime){ + isIdentifierSql.append(((DateTime)obj).getMillis()); + }else{ + isIdentifierSql.append(obj); + } + if(!po.is_new()){ + isIdentifierSql.append(" AND ").append(po.get_KeyColumns()[0]).append("!='").append(po.get_ID()).append("'"); + } + int i = jdbcTemplate.queryForObject(isIdentifierSql.toString(), Integer.class); + if(i > 0){ + if(DisplayType.Code.equals(po.get_poInfo().getColumnDisplayType(index))){ + throw new SameCodeException(label + "字段不唯一",po.get_TableName(),columnName); + } + throw new ValidationException(label + "字段不唯一"); + } + } + if (isCombIdentifier && !po.get_poInfo().isKey(index)) { + if (combIdentifierSql.length() > 1) { + combIdentifierSql.append(" AND "); + combLael.append(" "); + } + combIdentifierSql.append(columnName); + if (obj != null) { + combIdentifierSql.append("="); + if (c == Object.class || c == String.class) { + combIdentifierSql.append(StringUtil.TO_STRING( + obj.toString(), 0)); + } else if (c == DateTime.class && obj instanceof DateTime) { + combIdentifierSql.append(((DateTime) obj).getMillis()); + } else { + combIdentifierSql.append(obj); + } + } else { + combIdentifierSql.append(" IS NULL "); + } + combLael.append(label); + } + + } + if(combIdentifierSql.length() > 1){ + StringBuffer combSql = new StringBuffer(select); + if(po.get_poInfo().getTableType() == Entity.MIDTABLE){ + + } else { + combSql.append(" WHERE ").append(combIdentifierSql); + //.append(" AND ISACTIVE = 1"); + if (!po.is_new()) { + combSql.append(" AND ").append(po.get_KeyColumns()[0]) + .append("!='").append(po.get_ID()).append("'"); + } + } + int count = jdbcTemplate.queryForObject(combSql.toString(), Integer.class); + if(count >= 1){ + throw new ValidationException(combLael.append(" 应该唯一").toString()); + } + } + executeScript(po, Rule.BEFORESAVE); + return true; + } + + private boolean finishSave(GeneralPOJO po, boolean newRecord, boolean success){ + executeScript(po, Rule.AFTERSAVE); + return true; + } + + /** + * execute the script at the verification time + * @param po + * @param verificationTime + */ + private void executeScript(GeneralPOJO po, Integer verificationTime){ + List list = po.get_poInfo().getRules(); + if (list.size() > 0) { + GeneralPOJOBindings bindings = new GeneralPOJOBindings(po, UserSession.get()); + for (Rule rule : list) { + if (verificationTime == rule.getVerificationTime()) { + ScriptingEnginesManager.getScriptingEnginesManager() + .evaluateGroovy(rule.getPo().get_ID(), + defaultImport + rule.getContent(), bindings); + } + } + } + } + + @Override + public boolean update(GeneralPOJO po, String userID) { + return updatePO(po, userID, UUID.randomUUID().toString(), null); + } + + public boolean updatePO(GeneralPOJO po, String userID, String dataLogItemId, String mainDataLogItemId){ + + + beforeSave(po, userID); + String where = po.get_WhereClause(true).toString(); + // + boolean changes = false; + StringBuffer sql = new StringBuffer ("UPDATE "); + sql.append(po.get_TableName()).append( " SET "); + + boolean updated = false; + boolean updatedBy = false; + int AD_ChangeLog_ID = 0; + int size = po.get_ColumnCount(); + for (int i = 0; i < size; i++) + { + Object value = po.get_Value(i); + String columnName = po.get_ColumnName(i); + if (!GeneralPOJO.VERSION.equals(columnName) && (po.isVirtualColumn(i) || !po.is_ValueChanged(i))) + continue; + + // we have a change + Class c = po.get_ColumnClass(i); + String dt = po.get_ColumnDisplayType(i); + if(columnName.equals(GeneralPOJO.VERSION)){ + boolean versionChange = po.is_ValueChanged(i); + if(versionChange){ + throw new ValidationException("版本冲突,关闭后重新操作"); + }else{ + value = value != null ? ((Integer)value + 1) : 0; + } + } + // updated/by + + if (DisplayType.isLOB(dt)) + { + updateAttachments(po, i, UserSession.getAdmin(), userID); + continue; + } + if (DisplayType.List.equals(dt)) { + String referenceTableName = po.get_poInfo() + .getReferenceValueTable(i); + POJOInfo referenceInfo = po.initPO(referenceTableName); + if (referenceInfo.getTableType() == Entity.MIDTABLE) { + updateMidTable(po, i, referenceInfo); + } else { + updateSubTable(po, userID, i, dataLogItemId); + } + } else { + + if (changes) + sql.append(", "); + changes = true; + sql.append(columnName).append("="); + + // values + if (value == GeneralPOJO.NULL || value == null) + sql.append("NULL"); + else if (value instanceof Integer + || value instanceof BigDecimal) + sql.append(value); + else if (c == Boolean.class) { + boolean bValue = false; + if (value instanceof Boolean) + bValue = ((Boolean) value).booleanValue(); + else + bValue = "Y".equals(value); + sql.append(bValue ? "1" : "0"); + } else if (value instanceof DateTime) + sql.append(((DateTime) value).getMillis()); + else { + sql.append(StringUtil.TO_STRING(value.toString(), 0)); + } + } + + } // for all fields + + // Something changed + if (changes) + { + if (sql.indexOf(GeneralPOJO.UPDATETIME) == -1) { + DateTime now = DateTime.now(); + po.set_ValueOfColumn(GeneralPOJO.UPDATETIME, now.getMillis()); + sql.append(",UPDATETIME=").append(now.getMillis()); + } + if (sql.indexOf(GeneralPOJO.UPDATEBY) == -1) { + po.set_ValueOfColumn(GeneralPOJO.UPDATEBY, userID); + sql.append(",UPDATEBY='").append(userID).append("'"); + } + sql.append(" WHERE ").append(where); + + int no = 0; + no = executeUpdate(sql.toString()); + logSql(sql.toString(), po.get_TableName()); + boolean ok = no == 1; + } + + // nothing changed, so OK + boolean success = finishSave(po, false, true); + dataOperatorLog.updateData(po, dataLogItemId, mainDataLogItemId); + return success; + + + } + + + + private void updateAttachments(GeneralPOJO po, int index, Properties ctx, String userId){ + if(po.get_ColumnDisplayType(index).equals(DisplayType.Binary)){ + List> oldList = (List>) po.get_ValueOld(index); + Object obj = po.get_ValueNew(index); + List> newList = GeneralPOJO.NULL.equals(obj) ? null : (List>) obj; + FileService fileService = (FileService)SpringBeanOsgiServices.getInstance().getBeanByName("fileService"); + if (newList != null) { + for (Map newPojo : newList) { + // 考虑中间表只传另一个对象的id,如角色id + String id = (String)newPojo.get(SYSDoc.docId); + if(StringUtil.isEmpty(id)){ + saveAttachments(newPojo, po.get_TableName(), po.get_ID(), ctx); + } + else{ + if (oldList != null) { + for (Map pojo : oldList) { + if (id.equals(pojo.get(SYSDoc.docId))) { + oldList.remove(pojo); + break; + } + } + } + } + } + } + if (oldList != null && oldList.size() > 0) { + + for(Map map : oldList){ + fileService.delete((String)map.get(SYSDoc.docId), userId); + } + } + } + } + + /** + * process the po list attribute , sub table process + * @param po + * @param userID + * @param index + * @return + */ + private boolean updateSubTable(GeneralPOJO po, String userID, int index, String mainDataLogItemId) { + + List oldList = (List) po.get_ValueOld(index); + Object obj = po.get_ValueNew(index); + List newList = GeneralPOJO.NULL.equals(obj) ? null : (List) obj; + if (newList != null) { + String foreignKeyColName = po.get_referenceValueColumnName(index); + int size = newList.size(); + for (int i = 0; i < size; i++) { + // 考虑中间表只传另一个对象的id,如角色id + GeneralPOJO newPojo = newList.get(i); + newPojo.set_ValueOfColumn(foreignKeyColName, po.get_ID()); + boolean isExist = removeContains(newPojo, oldList); + boolean success; + newPojo.setMainPO(po); + newPojo.set_ValueOfColumn(GeneralPOJO.SEQUENCE, i+1); + if (isExist) { + success = updatePO(newPojo, userID, UUID.randomUUID().toString(), mainDataLogItemId); + } else { + success = saveNew(newPojo, userID, mainDataLogItemId); + } + if (!success) { + throw new ValidationException("更新子表异常"); + } + } + } + if (oldList != null && oldList.size() > 0) { + for (GeneralPOJO removePo : oldList) { + removePo.setMainPO(po); + if (!deletePo(removePo, userID, false, UUID.randomUUID().toString(), mainDataLogItemId)) { + throw new ValidationException("更新子表异常"); + } + } + } + return true; + } + + /** + * update middle table + * @param po + * @param index + * @param referenceInfo + */ + private void updateMidTable(GeneralPOJO po, int index, + POJOInfo referenceInfo) { + List oldList = (List) po.get_ValueOld(index); + Object obj = po.get_ValueNew(index); + List newList = null; + if(obj instanceof List){ + newList = (List) po.get_ValueNew(index); + } + String foreignKeyColName = po.get_referenceValueColumnName(index); + String midTable = referenceInfo.getTableName(); + List list = new ArrayList(); + // + StringBuffer sqlprocess = new StringBuffer(); + if (oldList != null && oldList.size() > 0) { + sqlprocess.append(" DELETE FROM ").append(midTable) + .append(" WHERE ").append(foreignKeyColName) + .append(" = '" + po.get_ID() + "';\n"); + } + if (newList != null) { + processMidList(list, newList, referenceInfo, foreignKeyColName, + po.get_ID()); + } + if (list != null && list.size() > 0) { + for (StringBuffer sql : list) { + sqlprocess.append(sql); + } + } + if (sqlprocess.length() > 0) { + jdbcTemplate.execute(sqlprocess.toString()); + logSql(sqlprocess.toString(), midTable); + } + } + + /** + * if old list exist the po, remove it from old list , and return true + * @param po + * @param list + * @return + */ + private boolean removeContains(GeneralPOJO po, List list){ + if (list != null) { + for (GeneralPOJO pojo : list) { + if (pojo.equals(po)) { + list.remove(pojo); + return true; + } + } + } + return false; + } + + @Override + public long findCount(String countSql) { + // TODO Auto-generated method stub + return getJdbcTemplate().queryForObject(countSql, Long.class); + } + + @Override + public long findCount(String tableName, String userId) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public List listSelect(final String sql, final String tableName, final int firstResult, final int pageSize) { + return listSelectSpecialCols(sql, tableName, firstResult, pageSize, null); + } + + @Override + public List listSelectSpecialCols(final String sql, + final String tableName, final int firstResult, final int pageSize, + List cols) { + final List columnCols = cols; + final String sqlLimit = sql + " limit " + pageSize + " offset " + firstResult; + List customerList = (List) getJdbcTemplate() + .query(new PreparedStatementCreator() { + public PreparedStatement createPreparedStatement( + Connection con) throws SQLException { + return con.prepareStatement(sqlLimit, + ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + } + }, new ResultSetExtractor() { + + public Object extractData(ResultSet rs) + throws SQLException, DataAccessException { + List customers = new ArrayList(); +// if (rs != null && firstResult > 1) { +// rs.absolute(firstResult); +// } +// int count = 0; + Properties ctx = UserSession.get(); + if(ctx == null){ + ctx = UserSession.getAdmin(); + } +// while (rs.next() && count < pageSize) { + while(rs.next()){ + GeneralPOJO po = new GeneralPO(tableName, rs, ctx, columnCols); + customers.add(po); +// count++; + } + return customers; + } + }); + + return customerList; + } + + + /** + * param: returnCols 0:name, 1:Type + */ + public Object executeProcedureReturnList(final String sql, String returnType, + String[][] returnCols) { + final String[][] columnCols = returnCols; + final String returnTypeClass = returnType; + Object customerList = (Object) getJdbcTemplate() + .execute(new CallableStatementCreator() { + public CallableStatement createCallableStatement(Connection con) + throws SQLException { + String storedProc = "{" + sql + "}";// 调用的sql + con.setAutoCommit(false); //这句很重要 , 没有报错 + CallableStatement cs = con.prepareCall(storedProc); + if(columnCols == null && !StringUtil.isEmpty(returnTypeClass)){ + if(BigDecimal.class.getName().equals(returnTypeClass)){ + cs.registerOutParameter(1, Types.DECIMAL); + }else if(Integer.class.getName().equals(returnTypeClass)){ + cs.registerOutParameter(1, Types.INTEGER); + }else if(Boolean.class.getName().equals(returnTypeClass)){ + cs.registerOutParameter(1, Types.BOOLEAN); + }else{ + cs.registerOutParameter(1, Types.NVARCHAR); + } + }else if(columnCols != null && columnCols.length >= 1){ + cs.registerOutParameter(1, Types.OTHER); + } + return cs; + } + }, new CallableStatementCallback() { + public Object doInCallableStatement(CallableStatement cs) + throws SQLException, DataAccessException { + List> resultsMap = new ArrayList>(); + cs.execute(); + if(columnCols == null && !StringUtil.isEmpty(returnTypeClass)){ + Object obj = null; + if(BigDecimal.class.getName().equals(returnTypeClass)){ + obj = cs.getBigDecimal(1); + }else if(Integer.class.getName().equals(returnTypeClass)){ + obj = cs.getInt(1); + }else if(Boolean.class.getName().equals(returnTypeClass)){ + obj = cs.getBoolean(1); + }else{ + obj = cs.getString(1); + } + return obj; + }else if (columnCols != null && columnCols.length >= 1) { + ResultSet rs = (ResultSet) cs.getObject(1);// 获取游标一行的值 + int length = columnCols.length; + while (rs.next()) {// 转换每行的返回值到Map中 + Map rowMap = new HashMap(); + for (int i = 0; i < length; i++) { + Object obj = null; + if (String.class.getName().equals(columnCols[i][1])) { + obj = rs.getString(columnCols[i][0]); + } else if (Integer.class.getName() + .equals(columnCols[i][1])) { + obj = rs.getInt(columnCols[i][0]); + } else if (BigDecimal.class.getName().equals(columnCols[i][1])) { + obj = rs.getBigDecimal(columnCols[i][0]); + } else if(Boolean.class.getName().equals(columnCols[i][1])){ + }else { + obj = rs.getObject(columnCols[i][0]); + } + rowMap.put(columnCols[i][0], obj); + } + resultsMap.add(rowMap); + } + rs.close(); + return resultsMap; + }else{ + return null; + } + } + }); + return customerList; + } + + @Override + public List listSelect(String tableName, int firstResult, + int pageSize, Object[] propertyId, boolean[] ascending, String userId, Map map) { + // TODO Auto-generated method stub + +// if (sortPropertyIds != null && sortPropertyIds.length > 0) { +// for (int i=0; i list = listSelect(sql, tableName, 0, 1); + if(list != null && list.size() == 1){ + result = list.get(0); + } + if(isHierarchical && result != null){ + hierarchicalQuery(result, ctx); + } + return result; + } + + /** + * 只加载实体id及显示名 + * @param entityId + * @param tableName + * @return + */ + public GeneralPOJO loadPOJO(String entityId, String tableName) { + GeneralPOJO result = null; + GeneralPOJO po = new GeneralPO(tableName, null, UserSession.get()); + POJOInfo info = po.get_poInfo(); + List returnColMap = new ArrayList(); + if (returnColMap != null && returnColMap.size() > 0) { + if (info != null && info.getTableType() != Entity.MIDTABLE) { + if (!returnColMap.contains(tableName + "_ID")) { + returnColMap.add(tableName + "_ID"); + } + String displayName = info.getColumnName(info.getDisplayIndex()); + if(!returnColMap.contains(displayName)){ + returnColMap.add(displayName); + } + } + } + + StringBuffer select = po.getSelectBuild(returnColMap); + String sql = select + " WHERE " + tableName + "_ID='" + entityId + "'"; + List list = listSelect(sql, tableName, 0, 1); + if(list != null && list.size() == 1){ + result = list.get(0); + } + return result; + } + + private void hierarchicalQuery(GeneralPOJO po, Properties ctx){ + if(po != null){ + int count = po.get_ColumnCount(); + for(int i = 0; i < count; i++){ + String type = po.get_ColumnDisplayType(i); + if(DisplayType.List.equals(type)){ + String referenceColumn = po.get_referenceValueColumnName(i); + String referenceTable = po.get_poInfo().getReferenceValueTable(i); + Map map = new HashMap(); + map.put(referenceColumn, po.get_ID()); + GeneralPO subPo = new GeneralPO(referenceTable, new HashMap(), ctx); + StringBuffer select = subPo.getSelectBuild(); + StringBuffer where = subPo.get_SearchWhereClause(map); + if(select != null && select.length() > 0){ + if(where != null && where.length() > 0){ + select.append(where); + } + } + //增加子表默认排序,按第二个col升序排序,第一个col为id + String orderCol = subPo.get_ColumnName(1); + select.append(" ORDER ").append(" BY P.").append(orderCol).append(" ASC "); + + List list = listSelect(select.toString(), referenceTable, 0, Integer.MAX_VALUE); + POJOInfo referenceInfo = po.initPO(referenceTable); + if(referenceInfo.getTableType() == Entity.MIDTABLE && list.size() > 0){ + String otherForeignCol = referenceColumn.equals(referenceInfo.getColumnName(0)) ? referenceInfo.getColumnName(1) : referenceInfo.getColumnName(0); + List midList = new ArrayList(); + for(GeneralPOJO midPO : list){ + midList.add((String)midPO.get_Value(otherForeignCol)); + } + po.updateHierarchicalValue(i, midList); + } else { + loadSubTableDoc(list, ctx); + po.updateHierarchicalValue(i, list); + } + }else if(DisplayType.Binary.equals(type)){ + loadDoc(po, i); + } + } + } + } + + /** + * 加载子表的附件 + * @param list + */ + private void loadSubTableDoc(List list, Properties ctx){ + if(list != null && list.size() > 0){ + GeneralPOJO po = list.get(0); + if(po != null){ + int count = po.get_ColumnCount(); + for(int i = 0; i < count; i++){ + String type = po.get_ColumnDisplayType(i); + if(DisplayType.Binary.equals(type)){ + for(GeneralPOJO pojo : list){ + loadDoc(pojo, i); + } + }else if(DisplayType.List.equals(type)){ + for(GeneralPOJO pojo : list){ + hierarchicalQuery(pojo, ctx); + } + } + } + } + } + } + + private void loadDoc(GeneralPOJO po, int i){ + FileService fileService = (FileService)SpringBeanOsgiServices.getInstance().getBeanByName("fileService"); + List businessKeys = new ArrayList(); + businessKeys.add(po.get_ID()); + List list = fileService.getDoc(businessKeys); + if (list != null) { + List> objs = new ArrayList>(); + for (GeneralPOJO file : list) { + Map map = new HashMap(); + map.put(SYSDoc.docId, file.get_ID()); + map.put(SYSDoc.fileName, + file.get_Value(SYSDoc.fileName)); + map.put(SYSDoc.fileSize, + file.get_Value(SYSDoc.fileSize)); + map.put(SYSDoc.filePath, + file.get_Value(SYSDoc.filePath)); + map.put(GeneralPOJO.UPDATETIME, file.get_Value(GeneralPOJO.UPDATETIME)); + objs.add(map); + } + po.updateHierarchicalValue(i, objs); + } + } + + + private void logSql(String sql,String tableName){ + if(tableName != null && !tableName.startsWith("SYS_")){ + this.systemLogManager.log(LogType.INFO, sql); + } + } + + @Override + public Map findSumColumn(String sumSql) { + Map returnMap = new HashMap(); + Map map = jdbcTemplate.queryForMap(sumSql); + if(map != null){ + Set keys = map.keySet(); + for(String key : keys){ + returnMap.put(key.toUpperCase(), map.get(key)); + } + } + return returnMap; + + } + + + + +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionBean.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionBean.java new file mode 100644 index 0000000..bbcda13 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionBean.java @@ -0,0 +1,66 @@ +package com.dsasp.server.dataDic.util; + +public class FunctionBean { + + private String className;// 类名 + private String method;// 方法名称+参数类型 + private String methodName;// 方法名称 + private String tip; + private String name; + private String returnResult; + + public FunctionBean() { + + } + public FunctionBean(String className){ + this.className = className; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getTip() { + return tip; + } + + public void setTip(String tip) { + this.tip = tip; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getReturnResult() { + return returnResult; + } + + public void setReturnResult(String returnResult) { + this.returnResult = returnResult; + } +} \ No newline at end of file diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionUtil.java b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionUtil.java new file mode 100644 index 0000000..3d341e7 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/dataDic/util/FunctionUtil.java @@ -0,0 +1,95 @@ +package com.dsasp.server.dataDic.util; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.dsasp.server.common.core.Function; +import com.dsasp.server.common.function.GetDefaultValueFunction; +import com.dsasp.server.common.function.GetServicesFunction; +import com.dsasp.server.common.function.GetValueFunction; +import com.dsasp.server.common.util.StringUtil; + +public class FunctionUtil { + private static Map> functionMap; + private static Map functionDescription;//函数类型描述 + private static boolean init; + + /** + * @return 函数 + */ + public static Map> getFunctions() { + if (!init) + init0(); + return functionMap; + } + + /** + * @return 函数类型 + */ + public static Map getDescriptions() { + if (!init) + init0(); + return functionDescription; + } + + private static synchronized void init0() { + if (init) + return; + List list = new ArrayList(); + list.add(GetValueFunction.class); + list.add(GetServicesFunction.class); + list.add(GetDefaultValueFunction.class); + functionMap = new HashMap>(); + functionDescription = new HashMap(); + functionDescription.put(GetValueFunction.class.getName(), "字段取值函数"); + functionDescription.put(GetServicesFunction.class.getName(), "服务调用函数"); + functionDescription.put(GetDefaultValueFunction.class.getName(), "默认值函数"); + for (Class functionClass : list) { + List functionList = new ArrayList();//方法属性List + + String beanClassName = functionClass.getName(); + String className = functionClass.getSimpleName(); + Method[] methods = functionClass.getMethods(); + for (Method method : methods) { + if (method.getAnnotation(Function.class) != null) { + FunctionBean fb = new FunctionBean(className); + Function f = (Function) method + .getAnnotation(Function.class); + Class[] paras = method.getParameterTypes(); + String paraTypes = ""; + if (paras != null && paras.length > 0) { + for (Class c : paras) { + String name = c.getName(); + if (name.indexOf(".") != -1) { + name = name + .substring(name.lastIndexOf(".") + 1); + } + paraTypes = paraTypes + "," + name; + } + } + if (!StringUtil.isEmpty(paraTypes)) { + paraTypes = "(" + paraTypes.substring(1) + ")"; + } else { + paraTypes = "()"; + } + fb.setMethod(method.getName() + paraTypes); + fb.setMethodName(method.getName()); + fb.setName(f.name()); + fb.setTip(f.tip()); + fb.setReturnResult(method.getReturnType().getName()); + functionList.add(fb); + } + } + functionMap.put(beanClassName, functionList); + } + init = true; + return; + } + + public static void main(String[] args) { + FunctionUtil.getFunctions(); + } +} diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/db/startorupdate/InstallOrUpdate.java b/platform-legacy-core/src/main/java/com/dsasp/server/db/startorupdate/InstallOrUpdate.java new file mode 100644 index 0000000..1a48733 --- /dev/null +++ b/platform-legacy-core/src/main/java/com/dsasp/server/db/startorupdate/InstallOrUpdate.java @@ -0,0 +1,13 @@ +package com.dsasp.server.db.startorupdate; + +/** + * eip4-poc 移植桩:原版在 OSGi bundle 启动时按版本执行 install SQL,并以 + * 硬编码的开发库 host/dbname 判断 isDevDB()(开发库跳过结构更新)。 + * PoC 中不做启动期 DDL,按生产行为返回 false。 + */ +public class InstallOrUpdate { + + public static boolean isDevDB() { + return false; + } +} diff --git a/platform-metadata/pom.xml b/platform-metadata/pom.xml new file mode 100644 index 0000000..e8f16d5 --- /dev/null +++ b/platform-metadata/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + + platform-metadata + platform-metadata + 现代层:REST API、DTO、OpenAPI(com.eip4.*) + + com.eip4platform-legacy-core + com.eip4platform-converter + org.springframework.bootspring-boot-starter-web + org.springdocspringdoc-openapi-starter-webmvc-ui + com.networkntjson-schema-validator + com.fasterxml.jackson.datatypejackson-datatype-joda + org.springframework.bootspring-boot-starter-testtest + + diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/AmisSchemaController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/AmisSchemaController.java new file mode 100644 index 0000000..1b51848 --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/AmisSchemaController.java @@ -0,0 +1,113 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.eip4.platform.converter.TemplateToAmisConverter; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.networknt.schema.JsonSchema; +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import com.networknt.schema.ValidationMessage; + +/** + * WS2:模板 XML → amis schema 转换 + 官方 schema.json(draft-07)机器校验闭环。 + * /api/poc/amis-schema 返回转换后的页面 schema(amis SDK 直接渲染) + * /api/poc/amis-validate 转换 + 经 amis-schema-6.13.0.json 校验,返回映射台账与校验结果 + */ +@RestController +public class AmisSchemaController { + + private final TemplateToAmisConverter converter; + private final JdbcTemplate jdbcTemplate; + private final ObjectMapper mapper = new ObjectMapper(); + private volatile JsonSchema amisSchema; + + public AmisSchemaController(TemplateToAmisConverter converter, JdbcTemplate jdbcTemplate) { + this.converter = converter; + this.jdbcTemplate = jdbcTemplate; + } + + @GetMapping("/api/poc/amis-schema") + public Map schema(@RequestParam(defaultValue = "角色维护") String template) throws Exception { + return converter.convert(loadXml(template), new ArrayList<>()); + } + + @GetMapping("/api/poc/amis-validate") + public Map validate(@RequestParam(defaultValue = "角色维护") String template) throws Exception { + List notes = new ArrayList<>(); + Map schema = converter.convert(loadXml(template), notes); + + JsonNode node = mapper.valueToTree(schema); + Set errors = officialSchema().validate(node); + + Map resp = new LinkedHashMap<>(); + resp.put("template", template); + resp.put("schemaValid", errors.isEmpty()); + resp.put("validationErrors", errors.stream() + .map(ValidationMessage::getMessage).limit(20).collect(Collectors.toList())); + resp.put("mappingNotes", notes); + resp.put("schema", schema); + return resp; + } + + /** 校验任意 amis 页面 schema(WS5:AI 生成的 schema 走这里过闸)。 */ + @org.springframework.web.bind.annotation.PostMapping("/api/poc/validate-schema") + public Map validateSchema(@org.springframework.web.bind.annotation.RequestBody JsonNode schema) throws Exception { + Set errors = officialSchema().validate(schema); + Map resp = new LinkedHashMap<>(); + resp.put("schemaValid", errors.isEmpty()); + resp.put("validationErrors", errors.stream() + .map(ValidationMessage::getMessage).limit(20).collect(Collectors.toList())); + return resp; + } + + private String loadXml(String template) { + return jdbcTemplate.queryForList( + "SELECT xml::text FROM VIEW_TEMPLATE WHERE NAME=? AND xml IS NOT NULL ORDER BY length(xml::text) ASC", + String.class, template) + .get(0); + } + + private JsonSchema officialSchema() throws Exception { + if (amisSchema == null) { + synchronized (this) { + if (amisSchema == null) { + JsonNode schemaNode = mapper.readTree( + getClass().getResourceAsStream("/amis-schema-6.13.0.json")); + // amis 官方 schema 大量使用 {"$ref":..., "additionalProperties":true} 的 + // 兄弟键覆盖写法——这是 VSCode/Monaco 的宽松合并语义;严格 draft-07 下 + // 兄弟键被忽略,被引用定义里的 additionalProperties:false 会拒绝一切输入。 + // 预处理:全局剥除 additionalProperties:false,保留类型/必填/结构校验。 + // 边界:未知渲染器类型无法被识别(schema 含 Loose 宽松分支,属设计内)。 + stripStrictAdditionalProperties(schemaNode); + amisSchema = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7) + .getSchema(schemaNode); + } + } + } + return amisSchema; + } + + private static void stripStrictAdditionalProperties(JsonNode node) { + if (node instanceof com.fasterxml.jackson.databind.node.ObjectNode obj) { + JsonNode ap = obj.get("additionalProperties"); + if (ap != null && ap.isBoolean() && !ap.asBoolean()) { + obj.remove("additionalProperties"); + } + obj.properties().forEach(e -> stripStrictAdditionalProperties(e.getValue())); + } else if (node instanceof com.fasterxml.jackson.databind.node.ArrayNode arr) { + arr.forEach(AmisSchemaController::stripStrictAdditionalProperties); + } + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/DictController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/DictController.java new file mode 100644 index 0000000..10bcc3d --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/DictController.java @@ -0,0 +1,46 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.common.dataDic.bean.EnumerateItem; +import com.dsasp.server.common.dataDic.service.DataDicService; + +/** + * 字典接口:模板 search@field 的 comboboxid(枚举类型)→ amis select options。 + * 数据来自引擎 getEnumerateItems(SYS_ENUMERATE 表)。 + */ +@RestController +public class DictController { + + private final DataDicService dataDicService; + + public DictController(DataDicService dataDicService) { + this.dataDicService = dataDicService; + } + + @GetMapping("/api/poc/dict/{type}") + public Map dict(@PathVariable String type) { + List> options = new ArrayList<>(); + List items = dataDicService.getEnumerateItems(type); + if (items != null) { + for (EnumerateItem i : items) { + Map o = new LinkedHashMap<>(); + o.put("label", i.getCodeDes()); + o.put("value", i.getCodeValue()); + options.add(o); + } + } + Map resp = new LinkedHashMap<>(); + resp.put("status", 0); + resp.put("msg", ""); + resp.put("data", Map.of("options", options)); + return resp; + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/EntityController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/EntityController.java new file mode 100644 index 0000000..b03aea6 --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/EntityController.java @@ -0,0 +1,98 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.util.UserSession; + +/** + * WS1 冒烟接口:直接驱动移植后的 POJOCRUDService 引擎。 + * 响应封装为 amis CRUD 约定格式 {status, msg, data:{items,total}},WS2 直接对接。 + */ +@RestController +@RequestMapping("/api/entity") +public class EntityController { + + private final POJOCRUDService pojoCRUDService; + + public EntityController(POJOCRUDService pojoCRUDService) { + this.pojoCRUDService = pojoCRUDService; + } + + /** 分页查询:GET /api/entity/{table}/list?page=1&perPage=10&列名=值(amis filter 透传) */ + @GetMapping("/{table}/list") + public Map list(@PathVariable String table, + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int perPage, + @RequestParam Map allParams) { + Properties ctx = UserSession.getAdmin(); + Map cond = new HashMap<>(); + cond.put(POJOCRUDService.PAGE_START, (page - 1) * perPage); + cond.put(POJOCRUDService.PAGE_SIZE, perPage); + // amis filter 表单值透传为引擎查询条件(保留大写列名约定,跳过分页参数与空值) + allParams.forEach((k, v) -> { + if (!"page".equals(k) && !"perPage".equals(k) && v != null && !v.isBlank()) { + cond.put(k.toUpperCase(), v); + } + }); + + Map result = pojoCRUDService.listSelect(cond, table.toUpperCase(), ctx); + + Map data = new HashMap<>(); + data.put("items", toRows(result.get(POJOCRUDService.LIST_RESULT))); + data.put("total", result.get(POJOCRUDService.PAGE_COUNT)); + + Map resp = new HashMap<>(); + resp.put("status", 0); + resp.put("msg", ""); + resp.put("data", data); + return resp; + } + + /** 单条加载:GET /api/entity/{table}/{id} */ + @GetMapping("/{table}/{id}") + public Map load(@PathVariable String table, @PathVariable String id) { + Properties ctx = UserSession.getAdmin(); + Object pojo = pojoCRUDService.loadPOJO(id, table.toUpperCase(), ctx, false); + Map resp = new HashMap<>(); + resp.put("status", 0); + resp.put("msg", ""); + resp.put("data", pojo instanceof GeneralPOJO p ? toRow(p) : pojo); + return resp; + } + + /** GeneralPOJO 值存于内部数组(非 bean getter),手工展开为平面 map 供 JSON 序列化。 */ + @SuppressWarnings("unchecked") + private List> toRows(Object listResult) { + List> rows = new ArrayList<>(); + if (listResult instanceof List list) { + for (Object o : list) { + if (o instanceof GeneralPOJO p) { + rows.add(toRow(p)); + } + } + } + return rows; + } + + private Map toRow(GeneralPOJO p) { + Map row = new LinkedHashMap<>(); + row.put("_id", p.get_ID()); + for (int i = 0; i < p.get_ColumnCount(); i++) { + row.put(p.get_ColumnName(i), p.get_Value(i)); + } + return row; + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/MetaController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/MetaController.java new file mode 100644 index 0000000..d036488 --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/MetaController.java @@ -0,0 +1,204 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.util.UserSession; +import com.dsasp.server.dataDic.bean.Entity; + +import io.swagger.v3.oas.annotations.Operation; + +/** + * 元数据 API(未来 MCP 工具面的雏形,WS5 AI 闭环用): + * POST /api/meta/entity 创建实体(元数据 + 动态物理表), + * DELETE /api/meta/entity/{table} 删除实体(表 + 元数据)。 + * + * 请求体示例: + * {"tablename":"EIP4AI_DEMO","name":"演示实体","attributes":[ + * {"column":"TITLE","display":"标题","type":"string","length":200,"mandatory":true}, + * {"column":"AMOUNT","display":"金额","type":"number"}, + * {"column":"QTY","display":"数量","type":"integer"}, + * {"column":"HAPPENED","display":"发生日期","type":"date"}, + * {"column":"DONE","display":"已完成","type":"boolean"}]} + * 标准列(主键/审计/版本)自动补齐,调用方不要自带。 + */ +@RestController +public class MetaController { + + private final DataDicService dataDicService; + private final POJOCRUDService pojoCRUDService; + private final JdbcTemplate jdbcTemplate; + + public MetaController(DataDicService dataDicService, + POJOCRUDService pojoCRUDService, + JdbcTemplate jdbcTemplate) { + this.dataDicService = dataDicService; + this.pojoCRUDService = pojoCRUDService; + this.jdbcTemplate = jdbcTemplate; + } + + @Operation(summary = "创建实体:写入 SYS_ENTITY/SYS_ENTITYATTRIBUTE 元数据并动态创建物理表") + @PostMapping("/api/meta/entity") + public Map createEntity(@RequestBody Map req) { + Properties ctx = UserSession.getAdmin(); + String table = String.valueOf(req.get("tablename")).toUpperCase(); + if (!table.matches("[A-Z][A-Z0-9_]{2,40}")) { + return err("tablename 不合法(大写字母数字下划线): " + table); + } + if (dataDicService.getSYSEntityByTableName(table) != null) { + return err("实体已存在: " + table); + } + + // 实体行:克隆 SYS_USERGROUP 的实体元数据做载体(与 write-test 同法) + Entity tplEnt = (Entity) dataDicService.getSYSEntityByTableName("SYS_USERGROUP"); + GeneralPOJO tplPo = pojoCRUDService.loadPOJO(idOf(tplEnt), "SYS_ENTITY", ctx, false); + Map entityMap = copyValues(tplPo); + entityMap.remove("SYS_ENTITY_ID"); + entityMap.put("TABLENAME", table); + entityMap.put("NAME", String.valueOf(req.getOrDefault("name", table))); + entityMap.put("DESCRIPTION", "AI 闭环创建 (eip4-poc WS5)"); + GeneralPOJO newEntity = (GeneralPOJO) dataDicService.save(entityMap, ctx); + String entityId = newEntity.get_ID(); + + // 属性模板:取 SYS_USERGROUP.NAME 属性行做默认值载体 + Map attrTpl = loadAttrTemplate(idOf(tplEnt)); + + List> created = new ArrayList<>(); + // 标准列 + created.add(saveAttr(attrTpl, entityId, table + "_ID", "主键", "CHAR", 36, true, true, ctx)); + created.add(saveAttr(attrTpl, entityId, "VERSION", "版本", "INTEGER", null, true, false, ctx)); + created.add(saveAttr(attrTpl, entityId, "CREATETIME", "创建时间", "TIME", null, true, false, ctx)); + created.add(saveAttr(attrTpl, entityId, "UPDATETIME", "更新时间", "TIME", null, true, false, ctx)); + created.add(saveAttr(attrTpl, entityId, "CREATEBY", "创建人", "NVARCHAR", 36, true, false, ctx)); + created.add(saveAttr(attrTpl, entityId, "UPDATEBY", "更新人", "NVARCHAR", 36, true, false, ctx)); + created.add(saveAttr(attrTpl, entityId, "ISACTIVE", "是否有效", "BOOLEAN", null, true, false, ctx)); + + // 业务列 + @SuppressWarnings("unchecked") + List> attrs = (List>) req.get("attributes"); + if (attrs != null) { + for (Map a : attrs) { + String col = String.valueOf(a.get("column")).toUpperCase(); + String type = String.valueOf(a.getOrDefault("type", "string")); + String ref = switch (type) { + case "integer" -> "INTEGER"; + case "number" -> "DECIMAL"; + case "date" -> "DATE"; + case "datetime" -> "TIME"; + case "boolean" -> "BOOLEAN"; + default -> "NVARCHAR"; + }; + Integer len = "NVARCHAR".equals(ref) + ? (a.get("length") instanceof Number n ? n.intValue() : 100) : null; + boolean mandatory = Boolean.TRUE.equals(a.get("mandatory")); + created.add(saveAttr(attrTpl, entityId, + col, String.valueOf(a.getOrDefault("display", col)), ref, len, mandatory, false, ctx)); + } + } + + // 动态建表 + Entity newEnt = (Entity) dataDicService.getSYSEntity(entityId); + String ddl = newEnt.createTableSql(); + dataDicService.executeCreateSql(ddl); + + Map resp = new LinkedHashMap<>(); + resp.put("status", 0); + resp.put("msg", "created"); + resp.put("data", Map.of( + "entityId", entityId, + "tablename", table, + "attributeCount", created.size(), + "listApi", "/api/entity/" + table + "/list")); + return resp; + } + + @Operation(summary = "删除实体:drop 物理表并清除元数据(仅限 EIP4AI_ 前缀,防误删)") + @DeleteMapping("/api/meta/entity/{table}") + public Map dropEntity(@PathVariable String table) { + String t = table.toUpperCase(); + if (!t.startsWith("EIP4")) { + return err("仅允许删除 EIP4 前缀的测试实体"); + } + jdbcTemplate.execute("DROP TABLE IF EXISTS " + t); + int a = jdbcTemplate.update( + "DELETE FROM SYS_ENTITYATTRIBUTE WHERE ENTITYID IN (SELECT SYS_ENTITY_ID FROM SYS_ENTITY WHERE TABLENAME=?)", t); + int e = jdbcTemplate.update("DELETE FROM SYS_ENTITY WHERE TABLENAME=?", t); + Map resp = new LinkedHashMap<>(); + resp.put("status", 0); + resp.put("msg", "dropped attrs=" + a + " entity=" + e); + return resp; + } + + private Map saveAttr(Map tpl, String entityId, String col, + String display, String ref, Integer len, + boolean mandatory, boolean isKey, Properties ctx) { + Map m = new HashMap<>(tpl); + m.remove("SYS_ENTITYATTRIBUTE_ID"); + m.put("ENTITYID", entityId); + m.put("COLUMNNAME", col); + m.put("DISPLAYNAME", display); + m.put("REFERENCEID", ref); + m.put("ISMANDATORY", mandatory ? 1 : 0); + m.put("ISKEY", isKey ? 1 : 0); + m.put("ISIDENTIFIER", 0); + m.put("ISCOMBIDENTIFIER", 0); + m.put("ISREADONLY", 0); + if (len != null) { + m.put("FIELDLENGTH", len); + } else { + m.remove("FIELDLENGTH"); + } + pojoCRUDService.save(m, "SYS_ENTITYATTRIBUTE", ctx); + return Map.of("column", col, "type", ref); + } + + private Map loadAttrTemplate(String tplEntityId) { + Map cond = new HashMap<>(); + cond.put("ENTITYID", tplEntityId); + cond.put("COLUMNNAME", "NAME"); + cond.put(POJOCRUDService.PAGE_START, 0); + cond.put(POJOCRUDService.PAGE_SIZE, 1); + @SuppressWarnings("unchecked") + List rows = (List) pojoCRUDService + .listSelect(cond, "SYS_ENTITYATTRIBUTE", UserSession.getAdmin()) + .get(POJOCRUDService.LIST_RESULT); + return copyValues(rows.get(0)); + } + + private static String idOf(Entity e) { + return e.getPo().get_ID() != null ? e.getPo().get_ID() + : (String) e.getPo().get_Value("SYS_ENTITY_ID"); + } + + private static Map copyValues(GeneralPOJO po) { + Map m = new HashMap<>(); + for (int i = 0; i < po.get_ColumnCount(); i++) { + Object v = po.get_Value(i); + if (v != null) { + m.put(po.get_ColumnName(i), v); + } + } + return m; + } + + private static Map err(String msg) { + Map r = new LinkedHashMap<>(); + r.put("status", 1); + r.put("msg", msg); + return r; + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocMasterSubController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocMasterSubController.java new file mode 100644 index 0000000..43c7fde --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocMasterSubController.java @@ -0,0 +1,174 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.util.UserSession; + +/** + * WS1 主子表级联验证:SYS_DATA_LOG(主) → DETAILLIST → SYS_DATA_LOGITEM(子)。 + * 验证 GeneralPO 对 LIST 列 List<Map> 载荷的子表转换、外键自动回填、 + * 层级回读、updateSubTable 的 diff 语义(保留改/移除删)与级联删除。 + * 测试行以 COLUMNNAME=EIP4POC_* 标记,结束后行数断言复原,残留兜底清理。 + */ +@RestController +public class PocMasterSubController { + + // 首选 SYS_DATA_LOG 对在 diff 更新时暴露了选表不当:其子表为 insert-only 设计 + // (无 UPDATETIME/UPDATEBY 物理列,而引擎 updatePO 无条件追加审计列——老系统行为一致)。 + // 改用带标准审计列的考勤日志主子对。 + private static final String MASTER = "HR_ATTENDLOG"; + private static final String CHILD = "HR_ATTENDLOGDETAIL"; + private static final String LIST_COL = "ATTENDDETAILS"; + private static final String CHILD_FK = "HR_ATTENDLOGID"; + + private final POJOCRUDService pojoCRUDService; + private final JdbcTemplate jdbcTemplate; + + public PocMasterSubController(POJOCRUDService pojoCRUDService, JdbcTemplate jdbcTemplate) { + this.pojoCRUDService = pojoCRUDService; + this.jdbcTemplate = jdbcTemplate; + } + + @PostMapping("/api/poc/mastersub-test") + public Map masterSubTest(@RequestParam(defaultValue = "false") boolean keep) { + List> report = new ArrayList<>(); + Properties ctx = UserSession.getAdmin(); + String masterId = null; + long mBefore = count(MASTER, null, null); + long cBefore = count(CHILD, null, null); + + try { + // 1. 取真实主行做载荷模板 + Map cond = new HashMap<>(); + cond.put(POJOCRUDService.PAGE_START, 0); + cond.put(POJOCRUDService.PAGE_SIZE, 1); + @SuppressWarnings("unchecked") + List tpl = (List) pojoCRUDService + .listSelect(cond, MASTER, ctx).get(POJOCRUDService.LIST_RESULT); + Map master = copyValues(tpl.get(0)); + master.remove(MASTER + "_ID"); + // 组合唯一约束 USERID+ATTENDDATE:考勤日期改为远未来值避免与源行冲突 + // (DATE 显示类型在引擎内为 joda DateTime) + master.put("ATTENDDATE", new org.joda.time.DateTime(2100, 1, 1, 0, 0)); + + // 2. 挂 2 个子行(FK 不传,验证引擎自动回填)。 + // 标记/断言列用 TIMES:UNITNAME 在元数据存在但物理表缺失(库内漂移),不可用 + master.put(LIST_COL, List.of(childMap(8), childMap(9))); + + GeneralPOJO saved = pojoCRUDService.save(master, MASTER, ctx); + masterId = saved.get_ID(); + long fkOk = count(CHILD, CHILD_FK, masterId); + step(report, "1-级联INSERT", masterId != null && fkOk == 2, + "masterId=" + masterId + ", 子行(FK自动回填)=" + fkOk); + + // 3. 层级回读 + GeneralPOJO loaded = pojoCRUDService.loadPOJO(masterId, MASTER, ctx, true); + Object listVal = loaded.get_Value(LIST_COL); + int loadedChildren = (listVal instanceof List l) ? l.size() : -1; + step(report, "2-层级回读", loadedChildren == 2, "DETAILLIST 子行数=" + loadedChildren); + + // 4. diff 更新:保留第 1 个(改值),移除第 2 个 + String keepId = null; + if (listVal instanceof List l) { + for (Object o : l) { + GeneralPOJO c = (GeneralPOJO) o; + if (String.valueOf(c.get_Value("TIMES")).startsWith("8")) { + keepId = c.get_ID(); + } + } + } + Map keepChild = childMap(7); + keepChild.put(CHILD + "_ID", keepId); + Map upd = new HashMap<>(); + upd.put(MASTER + "_ID", masterId); + upd.put(LIST_COL, List.of(keepChild)); + pojoCRUDService.update(upd, MASTER, ctx); + + long after = count(CHILD, CHILD_FK, masterId); + String keptId = jdbcTemplate.queryForObject( + "SELECT " + CHILD + "_ID FROM " + CHILD + " WHERE " + CHILD_FK + "=? LIMIT 1", + String.class, masterId); + String newTimes = jdbcTemplate.queryForObject( + "SELECT TIMES FROM " + CHILD + " WHERE " + CHILD_FK + "=? LIMIT 1", + String.class, masterId); + boolean sameRowUpdated = keepId != null && keptId != null && keptId.trim().equals(keepId.trim()); + step(report, "3-子表diff更新", after == 1 && newTimes != null && newTimes.startsWith("7"), + "更新后子行=" + after + ", TIMES=" + newTimes + + ", 保留行为同一物理行=" + sameRowUpdated + "(保留改/移除删)"); + + // 5. 级联删除 + if (!keep) { + pojoCRUDService.delete(masterId, MASTER, ctx); + long mLeft = count(MASTER, MASTER + "_ID", masterId); + long cLeft = count(CHILD, CHILD_FK, masterId); + step(report, "4-级联DELETE", mLeft == 0 && cLeft == 0, + "主行残留=" + mLeft + ", 子行残留=" + cLeft); + } + } catch (Exception e) { + step(report, "EXCEPTION", false, e.getClass().getSimpleName() + ": " + e.getMessage()); + } finally { + if (!keep && masterId != null) { + // 兜底物理清理(引擎若为逻辑删,这里保证测试库复原) + int c = jdbcTemplate.update("DELETE FROM " + CHILD + " WHERE " + CHILD_FK + "=?", masterId); + int m = jdbcTemplate.update("DELETE FROM " + MASTER + " WHERE " + MASTER + "_ID=?", masterId); + long mAfter = count(MASTER, null, null); + long cAfter = count(CHILD, null, null); + step(report, "5-复原断言", mAfter == mBefore && cAfter == cBefore, + "兜底清理 m=" + m + " c=" + c + ";行数 主 " + mBefore + "→" + mAfter + + " 子 " + cBefore + "→" + cAfter); + } + } + + boolean allOk = report.stream().allMatch(r -> Boolean.TRUE.equals(r.get("ok"))); + Map resp = new LinkedHashMap<>(); + resp.put("passed", allOk); + resp.put("steps", report); + return resp; + } + + private static Map childMap(int times) { + Map m = new HashMap<>(); + m.put("CHECKATTENDANCESTATE", 4); + m.put("TIMES", new java.math.BigDecimal(times)); + m.put("VERSION", 0); + return m; + } + + private long count(String table, String col, String val) { + Long n = (col == null) + ? jdbcTemplate.queryForObject("SELECT COUNT(*) FROM " + table, Long.class) + : jdbcTemplate.queryForObject("SELECT COUNT(*) FROM " + table + " WHERE " + col + "=?", Long.class, val); + return n == null ? -1 : n; + } + + private static Map copyValues(GeneralPOJO po) { + Map m = new HashMap<>(); + for (int i = 0; i < po.get_ColumnCount(); i++) { + Object v = po.get_Value(i); + if (v != null) { + m.put(po.get_ColumnName(i), v); + } + } + return m; + } + + private static void step(List> report, String s, boolean ok, String d) { + Map r = new LinkedHashMap<>(); + r.put("step", s); + r.put("ok", ok); + r.put("detail", d); + report.add(r); + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocScriptTestController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocScriptTestController.java new file mode 100644 index 0000000..3c119de --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocScriptTestController.java @@ -0,0 +1,96 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.script.SimpleBindings; + +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.dataDic.binding.ScriptingEnginesManager; + +import groovy.lang.Closure; + +/** + * WS3 脚本验证:从客户库 VIEW_TEMPLATE 取**真实存量 Groovy 脚本**, + * 经移植后的 ScriptingEnginesManager(JSR-223 + Groovy 4 + 编译缓存)执行。 + * UI 函数(enableButton 等)以 facade 闭包注入,脚本对 UI 的操作被捕获为 + * 指令列表——即「脚本文本零修改,换 facade 实现」方案的最小实证。 + */ +@RestController +public class PocScriptTestController { + + private final JdbcTemplate jdbcTemplate; + + public PocScriptTestController(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + @PostMapping("/api/poc/script-test") + public Map scriptTest(@RequestParam(defaultValue = "通知管理归档") String template) throws Exception { + Map resp = new LinkedHashMap<>(); + + // 1. 取真实模板 XML 并抽出脚本 + List xmls = jdbcTemplate.queryForList( + "SELECT xml::text FROM VIEW_TEMPLATE WHERE NAME=? AND xml IS NOT NULL", String.class, template); + String script = null; + for (String xml : xmls) { + Document doc = DocumentHelper.parseText(xml); + for (org.dom4j.Node n : doc.selectNodes("//script")) { + if (n instanceof Element e) { + // getTextTrim 会压扁换行破坏 Groovy 源码,必须用 getText 保留原文 + String t = e.getText().strip(); + if (t.length() > 10) { + script = t; + break; + } + } + } + if (script != null) break; + } + if (script == null) { + resp.put("passed", false); + resp.put("error", "模板无脚本: " + template); + return resp; + } + resp.put("template", template); + resp.put("scriptSource", script); + + // 2. 用两组行数据分别执行,验证分支行为 + Map runs = new LinkedHashMap<>(); + for (String state : new String[]{"待归档", "已归档"}) { + List captured = new ArrayList<>(); + + Map item = new HashMap<>(); + item.put("ISPLACE", state); + + SimpleBindings bindings = new SimpleBindings(); + bindings.put("item", item); + // facade:原 Vaadin 端 enableButton(name, enabled) → 捕获为 amis 指令 + bindings.put("enableButton", new Closure(null) { + @SuppressWarnings("unused") + public Object doCall(String name, boolean enabled) { + captured.add("{\"actionType\":\"setButtonState\",\"button\":\"" + name + "\",\"enabled\":" + enabled + "}"); + return null; + } + }); + + ScriptingEnginesManager.getScriptingEnginesManager() + .evaluateGroovy("poc:" + template + ":" + state, script, bindings); + runs.put("ISPLACE=" + state, captured); + } + resp.put("runs", runs); + resp.put("passed", true); + resp.put("note", "脚本文本零修改,Groovy 4/JDK17 编译缓存执行,UI 调用被 facade 捕获为前端指令"); + return resp; + } +} diff --git a/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocWriteTestController.java b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocWriteTestController.java new file mode 100644 index 0000000..56051f4 --- /dev/null +++ b/platform-metadata/src/main/java/com/eip4/platform/metadata/web/PocWriteTestController.java @@ -0,0 +1,233 @@ +package com.eip4.platform.metadata.web; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.dsasp.server.common.dataDic.bean.GeneralPOJO; +import com.dsasp.server.common.dataDic.service.DataDicService; +import com.dsasp.server.common.dataDic.service.POJOCRUDService; +import com.dsasp.server.common.util.UserSession; +import com.dsasp.server.dataDic.bean.Entity; + +/** + * WS1 写路径一键验证(PoC 方案 3.1 步骤 7): + * 克隆既有小实体的元数据 → 动态生成并执行 CREATE TABLE → CRUD 往返 → 全量清理。 + * 所有产物以 target 表名隔离(默认 EIP4POCTEST),结束后物理表与元数据一并删除。 + */ +@RestController +public class PocWriteTestController { + + private final DataDicService dataDicService; + private final POJOCRUDService pojoCRUDService; + private final JdbcTemplate jdbcTemplate; + + public PocWriteTestController(DataDicService dataDicService, + POJOCRUDService pojoCRUDService, + JdbcTemplate jdbcTemplate) { + this.dataDicService = dataDicService; + this.pojoCRUDService = pojoCRUDService; + this.jdbcTemplate = jdbcTemplate; + } + + @PostMapping("/api/poc/write-test") + public Map writeTest(@RequestParam(defaultValue = "SYS_USERGROUP") String source, + @RequestParam(defaultValue = "EIP4POCTEST") String target) { + List> report = new ArrayList<>(); + Properties ctx = UserSession.getAdmin(); + String newEntityId = null; + boolean tableCreated = false; + + try { + // 0. 防御:目标残留先清掉 + cleanup(target, null, report, "0-预清理"); + + // 1. 克隆 SYS_ENTITY 元数据 + Entity src = (Entity) dataDicService.getSYSEntityByTableName(source); + if (src == null) { + return fail(report, "source 实体不存在: " + source); + } + String srcEntityId = pojoIdOf(src); + GeneralPOJO srcPo = loadEntityPojo(srcEntityId); + Map entityMap = copyValues(srcPo); + entityMap.remove("SYS_ENTITY_ID"); + entityMap.put("TABLENAME", target); + entityMap.put("NAME", "EIP4 PoC 写路径测试"); + entityMap.put("DESCRIPTION", "eip4-poc write-test,自动创建自动删除"); + GeneralPOJO newEntity = (GeneralPOJO) dataDicService.save(entityMap, ctx); + newEntityId = newEntity.get_ID(); + step(report, "1-克隆实体元数据", true, "SYS_ENTITY_ID=" + newEntityId); + + // 2. 克隆 SYS_ENTITYATTRIBUTE(用 listSelect 条件查询,读路径已全量验证) + Map attrCond = new HashMap<>(); + attrCond.put("ENTITYID", srcEntityId); + attrCond.put(POJOCRUDService.PAGE_START, 0); + attrCond.put(POJOCRUDService.PAGE_SIZE, 200); + Map attrRes = pojoCRUDService.listSelect(attrCond, "SYS_ENTITYATTRIBUTE", ctx); + @SuppressWarnings("unchecked") + List attrs = (List) attrRes.get(POJOCRUDService.LIST_RESULT); + int n = 0; + for (GeneralPOJO a : attrs) { + Map am = copyValues(a); + am.remove("SYS_ENTITYATTRIBUTE_ID"); + am.put("ENTITYID", newEntityId); + // 源表主键属性列随表名改名(EIP3 设计器建实体时也按 {表名}_ID 生成) + if ((source + "_ID").equalsIgnoreCase(String.valueOf(am.get("COLUMNNAME")))) { + am.put("COLUMNNAME", target + "_ID"); + } + try { + pojoCRUDService.save(am, "SYS_ENTITYATTRIBUTE", ctx); + } catch (Exception ex) { + step(report, "2-克隆属性元数据", false, + "失败于第" + (n + 1) + "个属性, map键=" + am.keySet() + ", err=" + ex.getMessage()); + throw ex; + } + n++; + } + step(report, "2-克隆属性元数据", true, n + " 个属性"); + + // 3. 动态建表(引擎生成 DDL → 执行) + Entity newEnt = (Entity) dataDicService.getSYSEntity(newEntityId); + String ddl = newEnt.createTableSql(); + dataDicService.executeCreateSql(ddl); + tableCreated = true; + Integer exists = jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM information_schema.tables WHERE LOWER(table_name)=LOWER(?)", + Integer.class, target); + step(report, "3-动态建表", exists != null && exists > 0, + ddl.lines().findFirst().orElse("") + " ... (表存在=" + exists + ")"); + + // 4. INSERT:取源表真实一行的值作为载荷(外键值天然合法),引擎生成新 UUID 主键 + Map oneCond = new HashMap<>(); + oneCond.put(POJOCRUDService.PAGE_START, 0); + oneCond.put(POJOCRUDService.PAGE_SIZE, 1); + Map oneRes = pojoCRUDService.listSelect(oneCond, source, ctx); + @SuppressWarnings("unchecked") + List srcRows = (List) oneRes.get(POJOCRUDService.LIST_RESULT); + if (srcRows == null || srcRows.isEmpty()) { + return fail(report, "source 表无数据可作插入载荷: " + source); + } + Map row = copyValues(srcRows.get(0)); + row.remove(source + "_ID"); + GeneralPOJO saved = pojoCRUDService.save(row, target, ctx); + String rowId = saved.get_ID(); + step(report, "4-INSERT", rowId != null, "_id=" + rowId); + + // 选一个 NVARCHAR 列做回读/更新断言列 + String strCol = attrs.stream() + .filter(a -> "NVARCHAR".equals(a.get_Value("REFERENCEID"))) + .map(a -> (String) a.get_Value("COLUMNNAME")) + .filter(c -> !"CREATEBY".equals(c) && !"UPDATEBY".equals(c)) + .findFirst().orElse(null); + + // 5. SELECT 回读 + GeneralPOJO loaded = pojoCRUDService.loadPOJO(rowId, target, ctx, false); + boolean loadOk = loaded != null && (strCol == null + || String.valueOf(loaded.get_Value(strCol)).equals(String.valueOf(row.get(strCol)))); + step(report, "5-SELECT回读", loadOk, "断言列=" + strCol + " 值=" + (loaded != null ? loaded.get_Value(strCol) : null)); + + // 6. UPDATE + boolean updOk; + if (strCol != null) { + Map upd = new HashMap<>(); + upd.put(target + "_ID", rowId); + upd.put(strCol, "eip4poc-updated"); + pojoCRUDService.update(upd, target, ctx); + GeneralPOJO re = pojoCRUDService.loadPOJO(rowId, target, ctx, false); + updOk = re != null && "eip4poc-updated".equals(re.get_Value(strCol)); + } else { + updOk = true; + } + step(report, "6-UPDATE", updOk, strCol + " → eip4poc-updated " + (updOk ? "回读一致" : "未生效")); + + // 7. DELETE + pojoCRUDService.delete(rowId, target, ctx); + Integer left = jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM " + target, Integer.class); + step(report, "7-DELETE", left != null, + "删除后剩余行数=" + left + "(逻辑删或物理删以引擎行为为准)"); + + } catch (Exception e) { + step(report, "EXCEPTION", false, e.getClass().getSimpleName() + ": " + e.getMessage()); + } finally { + cleanup(target, newEntityId, report, "8-清理"); + } + + boolean allOk = report.stream() + .filter(r -> !String.valueOf(r.get("step")).contains("清理")) + .allMatch(r -> Boolean.TRUE.equals(r.get("ok"))); + Map resp = new LinkedHashMap<>(); + resp.put("passed", allOk); + resp.put("steps", report); + return resp; + } + + private void cleanup(String target, String entityId, List> report, String label) { + StringBuilder detail = new StringBuilder(); + try { + jdbcTemplate.execute("DROP TABLE IF EXISTS " + target); + detail.append("drop table; "); + } catch (Exception e) { + detail.append("drop失败:").append(e.getMessage()).append("; "); + } + try { + if (entityId != null) { + jdbcTemplate.update("DELETE FROM SYS_ENTITYATTRIBUTE WHERE ENTITYID=?", entityId); + jdbcTemplate.update("DELETE FROM SYS_ENTITY WHERE SYS_ENTITY_ID=?", entityId); + detail.append("元数据已删"); + } else { + int a = jdbcTemplate.update( + "DELETE FROM SYS_ENTITYATTRIBUTE WHERE ENTITYID IN (SELECT SYS_ENTITY_ID FROM SYS_ENTITY WHERE TABLENAME=?)", target); + int b = jdbcTemplate.update("DELETE FROM SYS_ENTITY WHERE TABLENAME=?", target); + detail.append("残留元数据清理 attr=").append(a).append(" entity=").append(b); + } + } catch (Exception e) { + detail.append("元数据清理失败:").append(e.getMessage()); + } + step(report, label, true, detail.toString()); + } + + private GeneralPOJO loadEntityPojo(String entityId) { + return pojoCRUDService.loadPOJO(entityId, "SYS_ENTITY", UserSession.getAdmin(), false); + } + + private static String pojoIdOf(Entity e) { + return e.getPo().get_ID() != null ? e.getPo().get_ID() + : (String) e.getPo().get_Value("SYS_ENTITY_ID"); + } + + private static Map copyValues(GeneralPOJO po) { + Map m = new HashMap<>(); + for (int i = 0; i < po.get_ColumnCount(); i++) { + Object v = po.get_Value(i); + if (v != null) { + m.put(po.get_ColumnName(i), v); + } + } + return m; + } + + private static void step(List> report, String step, boolean ok, String detail) { + Map r = new LinkedHashMap<>(); + r.put("step", step); + r.put("ok", ok); + r.put("detail", detail); + report.add(r); + } + + private static Map fail(List> report, String msg) { + step(report, "ABORT", false, msg); + Map resp = new LinkedHashMap<>(); + resp.put("passed", false); + resp.put("steps", report); + return resp; + } +} diff --git a/platform-metadata/src/main/resources/amis-schema-6.13.0.json b/platform-metadata/src/main/resources/amis-schema-6.13.0.json new file mode 100644 index 0000000..d5a50a8 --- /dev/null +++ b/platform-metadata/src/main/resources/amis-schema-6.13.0.json @@ -0,0 +1,34161 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/PageSchema", + "definitions": { + "PageSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "page", + "description": "指定为 page 渲染器。" + }, + "title": { + "type": "string", + "description": "页面标题" + }, + "subTitle": { + "type": "string", + "description": "页面副标题" + }, + "remark": { + "$ref": "#/definitions/SchemaRemark", + "description": "页面描述, 标题旁边会出现个小图标,放上去会显示这个属性配置的内容。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "内容区 css 类名" + }, + "aside": { + "$ref": "#/definitions/SchemaCollection", + "description": "边栏区域" + }, + "asideResizor": { + "type": "boolean", + "description": "边栏是否允许拖动" + }, + "asideSticky": { + "type": "boolean", + "description": "边栏内容是否粘住,即不跟随滚动。", + "default": true + }, + "asidePosition": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "边栏位置", + "default": "left" + }, + "asideMinWidth": { + "type": "number", + "description": "边栏最小宽度" + }, + "asideMaxWidth": { + "type": "number", + "description": "边栏最小宽度" + }, + "asideClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "边栏区 css 类名" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置容器 className" + }, + "css": { + "type": "object", + "additionalProperties": { + "type": "object" + }, + "description": "自定义页面级别样式表" + }, + "mobileCSS": { + "type": "object", + "additionalProperties": { + "type": "object" + }, + "description": "移动端下的样式表" + }, + "data": { + "$ref": "#/definitions/SchemaDefaultData", + "description": "页面级别的初始数据" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 header 容器 className" + }, + "initApi": { + "$ref": "#/definitions/SchemaApi", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "initFetch": { + "type": "boolean", + "description": "是否默认就拉取?" + }, + "initFetchOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否默认就拉取表达式" + }, + "messages": { + "$ref": "#/definitions/SchemaMessage" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "toolbar": { + "$ref": "#/definitions/SchemaCollection", + "description": "页面顶部区域,当存在 title 时在右上角显示。" + }, + "toolbarClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 toolbar 容器 className" + }, + "definitions": {}, + "interval": { + "type": "number", + "description": "配置轮询间隔,配置后 initApi 将轮询加载。" + }, + "silentPolling": { + "type": "boolean", + "description": "是否要静默加载,也就是说不显示进度" + }, + "stopAutoRefreshWhen": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置停止轮询的条件。" + }, + "showErrorMsg": { + "type": "boolean", + "description": "是否显示错误信息,默认是显示的。" + }, + "cssVars": { + "description": "css 变量" + }, + "regions": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "aside", + "body", + "toolbar", + "header" + ] + }, + "description": "默认不设置自动感觉内容来决定要不要展示这些区域 如果配置了,以配置为主。" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "pullRefresh": { + "type": "object", + "properties": { + "disabled": { + "type": "boolean" + }, + "pullingText": { + "type": "string" + }, + "loosingText": { + "type": "string" + } + }, + "additionalProperties": false, + "description": "下拉刷新配置" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "page" + }, + "testid": true, + "title": true, + "subTitle": true, + "remark": true, + "body": true, + "bodyClassName": true, + "aside": true, + "asideResizor": true, + "asideSticky": true, + "asidePosition": true, + "asideMinWidth": true, + "asideMaxWidth": true, + "asideClassName": true, + "css": true, + "mobileCSS": true, + "data": true, + "headerClassName": true, + "initApi": true, + "initFetch": true, + "initFetchOn": true, + "messages": true, + "name": true, + "toolbar": true, + "toolbarClassName": true, + "definitions": true, + "interval": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "showErrorMsg": true, + "cssVars": true, + "regions": true, + "pullRefresh": true + }, + "required": [ + "type" + ], + "description": "amis Page 渲染器。详情请见:https://aisuda.bce.baidu.com/amis/zh-CN/components/page 一个页面只允许有一个 Page 渲染器。" + }, + "SchemaRemark": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseRemarkSchema" + } + ] + }, + "BaseRemarkSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon" + }, + "tooltipClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "trigger": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "click", + "hover", + "focus" + ] + }, + "description": "触发规则" + }, + "title": { + "type": "string", + "description": "提示标题" + }, + "content": { + "$ref": "#/definitions/SchemaTpl", + "description": "提示内容" + }, + "placement": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ], + "description": "显示位置" + }, + "rootClose": { + "type": "boolean", + "description": "点击其他内容时是否关闭弹框信息" + }, + "shape": { + "type": "string", + "enum": [ + "circle", + "square" + ], + "description": "icon的形状" + } + }, + "required": [ + "content" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "label": true, + "icon": true, + "tooltipClassName": true, + "trigger": true, + "title": true, + "content": true, + "placement": true, + "rootClose": true, + "shape": true + }, + "required": [ + "content" + ], + "description": "提示渲染器,默认会显示个小图标,鼠标放上来的时候显示配置的内容。" + }, + "SchemaIcon": { + "type": "string", + "description": "iconfont 里面的类名。" + }, + "SchemaClassName": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "boolean" + }, + { + "not": {} + }, + { + "type": "null" + }, + { + "$ref": "#/definitions/SchemaExpression" + } + ] + } + } + ], + "description": "css类名,配置字符串,或者对象。\n\n className: \"red\"\n\n用对象配置时意味着你能跟表达式一起搭配使用,如:\n\n className: { \"red\": \"data.progress > 80\", \"blue\": \"data.progress > 60\" }" + }, + "SchemaExpression": { + "type": "string", + "description": "表达式,语法 `${xxx > 5}`。" + }, + "SchemaTpl": { + "type": "string", + "description": "支持两种语法,但是不能混着用。分别是:\n\n1. `${xxx}` 或者 `${xxx|upperCase}` 2. `<%= data.xxx %>`\n\n\n更多文档:https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/template" + }, + "BaseSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/SchemaType" + }, + "testid": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true + }, + "required": [ + "type" + ] + }, + "SchemaType": { + "type": "string", + "enum": [ + "form", + "alert", + "app", + "audio", + "avatar", + "button-group", + "breadcrumb", + "card", + "card2", + "cards", + "carousel", + "chart", + "calendar", + "collapse", + "collapse-group", + "color", + "crud", + "crud2", + "custom", + "date", + "static-date", + "datetime", + "static-datetime", + "time", + "static-time", + "month", + "static-month", + "date-range", + "dialog", + "spinner", + "divider", + "dropdown-button", + "drawer", + "each", + "flex", + "flex-item", + "grid-2d", + "icon", + "iframe", + "image", + "static-image", + "images", + "static-images", + "json-schema", + "json-schema-editor", + "json", + "static-json", + "link", + "list", + "log", + "static-list", + "map", + "mapping", + "markdown", + "nav", + "number", + "page", + "pagination", + "pagination-wrapper", + "property", + "operation", + "plain", + "text", + "progress", + "qrcode", + "qr-code", + "barcode", + "remark", + "search-box", + "sparkline", + "status", + "table", + "static-table", + "table2", + "html", + "tpl", + "tasks", + "vbox", + "video", + "wizard", + "wrapper", + "web-component", + "anchor-nav", + "steps", + "timeline", + "control", + "input-array", + "action", + "button", + "submit", + "reset", + "button-group-select", + "button-toolbar", + "chained-select", + "chart-radios", + "checkbox", + "checkboxes", + "input-city", + "input-color", + "combo", + "condition-builder", + "container", + "switch-container", + "input-date", + "input-datetime", + "input-time", + "input-quarter", + "input-year", + "input-year-range", + "input-month", + "input-date-range", + "input-time-range", + "input-datetime-range", + "input-excel", + "input-formula", + "diff-editor", + "office-viewer", + "pdf-viewer", + "input-signature", + "input-verification-code", + "shape", + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor", + "fieldset", + "fieldSet", + "input-file", + "formula", + "grid", + "group", + "hbox", + "hidden", + "icon-picker", + "icon-select", + "input-image", + "input-group", + "list-select", + "location-picker", + "matrix-checkboxes", + "input-month-range", + "input-quarter-range", + "nested-select", + "input-number", + "panel", + "picker", + "radio", + "radios", + "input-range", + "input-rating", + "input-repeat", + "input-rich-text", + "select", + "service", + "static", + "input-sub-form", + "switch", + "input-table", + "tabs", + "tabs-transfer", + "input-tag", + "input-text", + "input-password", + "input-email", + "input-url", + "uuid", + "multi-select", + "textarea", + "transfer", + "transfer-picker", + "tabs-transfer-picker", + "input-tree", + "tree-select", + "table-view", + "portlet", + "grid-nav", + "users-select", + "tag", + "tags", + "words", + "password", + "multiline-text", + "amis", + "native-date", + "native-time", + "native-number", + "code", + "tooltip-wrapper", + "slider" + ] + }, + "BaseSchemaWithoutType": { + "type": "object", + "properties": { + "$$id": { + "type": "string", + "description": "组件唯一 id,主要用于页面设计器中定位 json 节点" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "容器 css 类名" + }, + "$ref": { + "type": "string", + "description": "配合 definitions 一起使用,可以实现无限循环的渲染器。" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + }, + "disabledOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否禁用表达式" + }, + "hidden": { + "type": "boolean", + "description": "是否隐藏", + "deprecated": "推荐用 visible" + }, + "hiddenOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否隐藏表达式", + "deprecated": "推荐用 visibleOn" + }, + "visible": { + "type": "boolean", + "description": "是否显示" + }, + "visibleOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否显示表达式" + }, + "id": { + "type": "string", + "description": "组件唯一 id,主要用于日志采集" + }, + "onEvent": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "weight": { + "type": "number" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ListenerAction" + } + }, + "debounce": { + "$ref": "#/definitions/debounceConfig" + }, + "track": { + "$ref": "#/definitions/trackConfig" + } + }, + "required": [ + "actions" + ], + "additionalProperties": false + }, + "description": "事件动作配置" + }, + "static": { + "type": "boolean", + "description": "是否静态展示" + }, + "staticOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否静态展示表达式" + }, + "staticPlaceholder": { + "type": "string", + "description": "静态展示空值占位" + }, + "staticClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "静态展示表单项类名" + }, + "staticLabelClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "静态展示表单项Label类名" + }, + "staticInputClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "静态展示表单项Value类名" + }, + "staticSchema": {}, + "style": { + "type": "object", + "description": "组件样式" + }, + "editorSetting": { + "type": "object", + "properties": { + "behavior": { + "type": "string", + "description": "组件行为、用途,如 create、update、remove" + }, + "displayName": { + "type": "string", + "description": "组件名称,通常是业务名称方便定位" + }, + "mock": { + "description": "编辑器假数据,方便展示" + } + }, + "description": "编辑器配置,运行时可以忽略" + }, + "useMobileUI": { + "type": "boolean", + "description": "可以组件级别用来关闭移动端样式" + } + }, + "additionalProperties": false + }, + "ListenerAction": { + "type": "object", + "properties": { + "actionType": { + "type": "string" + }, + "description": { + "type": "string" + }, + "componentId": { + "type": "string" + }, + "componentName": { + "type": "string" + }, + "ignoreError": { + "type": "boolean" + }, + "args": { + "type": "object" + }, + "data": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "dataMergeMode": { + "type": "string", + "enum": [ + "merge", + "override" + ] + }, + "outputVar": { + "type": "string" + }, + "preventDefault": { + "type": "boolean" + }, + "stopPropagation": { + "type": "boolean" + }, + "expression": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/ConditionGroupValue" + } + ] + }, + "execOn": { + "type": "string" + } + }, + "required": [ + "actionType" + ] + }, + "ConditionGroupValue": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "conjunction": { + "type": "string", + "enum": [ + "and", + "or" + ] + }, + "not": { + "type": "boolean" + }, + "children": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ConditionRule" + }, + { + "$ref": "#/definitions/ConditionGroupValue" + } + ] + } + }, + "if": { + "type": "string" + } + }, + "required": [ + "id", + "conjunction" + ], + "additionalProperties": false + }, + "ConditionRule": { + "type": "object", + "properties": { + "id": {}, + "left": { + "$ref": "#/definitions/ExpressionComplex" + }, + "op": { + "$ref": "#/definitions/OperatorType" + }, + "right": { + "anyOf": [ + { + "$ref": "#/definitions/ExpressionComplex" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/ExpressionComplex" + } + } + ] + }, + "if": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + }, + "ExpressionComplex": { + "anyOf": [ + { + "$ref": "#/definitions/ExpressionValue" + }, + { + "$ref": "#/definitions/ExpressionFunc" + }, + { + "$ref": "#/definitions/ExpressionField" + }, + { + "$ref": "#/definitions/ExpressionFormula" + } + ] + }, + "ExpressionValue": { + "anyOf": [ + { + "$ref": "#/definitions/ExpressionSimple" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "value" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "object" + } + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + } + ] + }, + "ExpressionSimple": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "object" + }, + { + "not": {} + } + ] + }, + "ExpressionFunc": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "func" + }, + "func": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/ExpressionComplex" + } + } + }, + "required": [ + "type", + "func", + "args" + ], + "additionalProperties": false + }, + "ExpressionField": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "field" + }, + "field": { + "type": "string" + } + }, + "required": [ + "type", + "field" + ], + "additionalProperties": false + }, + "ExpressionFormula": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "formula" + }, + "value": { + "type": "string" + } + }, + "required": [ + "type", + "value" + ], + "additionalProperties": false + }, + "OperatorType": { + "anyOf": [ + { + "type": "string", + "const": "equal" + }, + { + "type": "string", + "const": "not_equal" + }, + { + "type": "string", + "const": "is_empty" + }, + { + "type": "string", + "const": "is_not_empty" + }, + { + "type": "string", + "const": "like" + }, + { + "type": "string", + "const": "not_like" + }, + { + "type": "string", + "const": "starts_with" + }, + { + "type": "string", + "const": "ends_with" + }, + { + "type": "string", + "const": "less" + }, + { + "type": "string", + "const": "less_or_equal" + }, + { + "type": "string", + "const": "greater" + }, + { + "type": "string", + "const": "greater_or_equal" + }, + { + "type": "string", + "const": "between" + }, + { + "type": "string", + "const": "not_between" + }, + { + "type": "string", + "const": "select_equals" + }, + { + "type": "string", + "const": "select_not_equals" + }, + { + "type": "string", + "const": "select_any_in" + }, + { + "type": "string", + "const": "select_not_any_in" + }, + { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "label", + "value" + ], + "additionalProperties": false + } + ] + }, + "debounceConfig": { + "type": "object", + "properties": { + "maxWait": { + "type": "number" + }, + "wait": { + "type": "number" + }, + "leading": { + "type": "boolean" + }, + "trailing": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "trackConfig": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "additionalProperties": false + }, + "SchemaCollection": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaObject" + }, + { + "$ref": "#/definitions/SchemaTpl" + }, + { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaObject" + }, + { + "$ref": "#/definitions/SchemaTpl" + } + ] + } + } + ] + }, + "SchemaObject": { + "allOf": [ + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "page" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PageSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "flex" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FlexSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "tpl", + "html" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TplSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "remark" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RemarkSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "alert" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AlertSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "audio" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AudioSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "avatar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AvatarSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonGroupSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-toolbar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonToolbarSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "calendar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CalendarSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "card" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CardSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "cards" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CardsSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "carousel" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CarouselSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "chart" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ChartSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "collapse" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CollapseSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "collapse-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CollapseGroupSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "color" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ColorSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "container" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ContainerSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "switch-container" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SwitchContainerSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "date", + "datetime", + "time", + "static-date", + "static-datetime", + "static-time" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "dialogType": { + "type": "string", + "const": "confirm" + } + }, + "required": [ + "type", + "dialogType" + ] + }, + "then": { + "$ref": "#/definitions/DialogSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "divider" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DividerSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "drawer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DrawerSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "dropdown-button" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DropdownButtonSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "each" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/EachSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "grid" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/GridSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "grid-2d" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/Grid2DSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "hbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/HBoxSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "icon" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IconSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "iframe" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IFrameSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "image", + "static-image" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImageSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "images", + "static-images" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImagesSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "json", + "static-json" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/JsonSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "link" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/LinkSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "list", + "static-list" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ListSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "map", + "mapping" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MappingSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "nav" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NavSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "operation" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/OperationSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "pagination" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PaginationSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "pagination-wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PaginationWrapperSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "panel" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PanelSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "plain", + "text" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PlainSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "progress" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ProgressSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "qrcode", + "qr-code" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QRCodeSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "search-box" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SearchBoxSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "service" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ServiceSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "sparkline" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SparkLineSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StatusSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "spinner" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SpinnerSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "table", + "static-table" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "table2" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableSchema2" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tasks" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TasksSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "vbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/VBoxSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "video" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/VideoSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "wizard" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WizardSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WrapperSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tooltip-wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TooltipWrapperSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "form" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "anchor-nav" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AnchorNavSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "steps" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StepsSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "portlet" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PortletSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "timeline" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TimelineSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "control" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-array" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ArrayControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-group-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonGroupControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "chained-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ChainedSelectControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "checkbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CheckboxControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "checkboxes" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CheckboxesControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-city" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputCityControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-color" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputColorControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "combo" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ComboControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "condition-builder" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ConditionBuilderControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-date" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-datetime" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateTimeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-time" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TimeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-month" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MonthControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-quarter" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QuarterControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-year" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/YearControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input-date-range", + "input-datetime-range", + "input-time-range" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateRangeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "diff-editor" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DiffControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/EditorControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "fieldset", + "fieldSet" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FieldSetControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-file" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FileControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "formula" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormulaControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/GroupControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "hidden" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/HiddenControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "icon-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IconPickerControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-image" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImageControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputGroupControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "list-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ListControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "json-schema-editor" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/JSONSchemaEditorControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-signature" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputSignatureSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "location-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/LocationControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "uuid" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/UUIDControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "matrix-checkboxes" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MatrixControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-month-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MonthRangeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-quarter-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QuarterRangeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "nested-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NestedSelectControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-number" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NumberControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PickerControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "radios" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RadiosControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "radio" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RadioControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RangeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-rating" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RatingControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-rich-text" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RichTextControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-repeat" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RepeatControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "select", + "multi-select" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SelectControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-sub-form" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SubFormControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "switch" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SwitchControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "static" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StaticExactControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-table" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs-transfer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsTransferControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-tag" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TagControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input-text", + "input-email", + "input-url", + "input-password", + "native-date", + "native-time", + "native-number" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TextControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "textarea" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TextareaControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "transfer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TransferControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "transfer-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TransferPickerControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs-transfer-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsTransferPickerControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-tree" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TreeControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tree-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TreeSelectControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "users-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/UserSelectControlSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "date-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateRangeSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "multiline-text" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MultilineTextSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "password" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PasswordSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "words" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WordsSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "slider" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SliderSchema" + } + }, + { + "if": { + "properties": { + "type": { + "enum": [ + "action", + "button", + "submit", + "reset" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ActionSchema" + } + }, + { + "if": { + "properties": { + "type": { + "const": "crud" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CRUDSchema" + } + } + ] + }, + "FlexSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "flex", + "description": "指定为 flex 展示类型" + }, + "justify": { + "type": "string", + "enum": [ + "start", + "flex-start", + "center", + "end", + "flex-end", + "space-around", + "space-between", + "space-evenly" + ], + "description": "水平分布" + }, + "alignItems": { + "type": "string", + "enum": [ + "stretch", + "start", + "flex-start", + "flex-end", + "end", + "center", + "baseline" + ], + "description": "垂直布局" + }, + "alignContent": { + "type": "string", + "enum": [ + "normal", + "flex-start", + "flex-end", + "center", + "space-between", + "space-around", + "space-evenly", + "stretch" + ], + "description": "多行情况下的垂直分布" + }, + "direction": { + "type": "string", + "enum": [ + "row", + "column", + "row-reverse", + "column-reverse" + ], + "description": "方向" + }, + "items": { + "$ref": "#/definitions/SchemaCollection", + "description": "每个 flex 的设置" + }, + "style": { + "type": "object", + "description": "自定义样式" + } + }, + "required": [ + "type", + "items" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "flex" + }, + "testid": true, + "justify": true, + "alignItems": true, + "alignContent": true, + "direction": true, + "items": true + }, + "required": [ + "type", + "items" + ], + "description": "Flex 布局 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/flex" + }, + "TplSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "tpl", + "html" + ], + "description": "指定为模板渲染器。\n\n文档:https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/template" + }, + "tpl": { + "$ref": "#/definitions/SchemaTpl" + }, + "html": { + "$ref": "#/definitions/SchemaTpl" + }, + "text": { + "$ref": "#/definitions/SchemaTpl" + }, + "raw": { + "type": "string" + }, + "inline": { + "type": "boolean", + "description": "是否内联显示?" + }, + "wrapperComponent": { + "description": "标签类型" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "testidBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "tpl", + "html" + ] + }, + "testid": true, + "tpl": true, + "html": true, + "text": true, + "raw": true, + "inline": true, + "wrapperComponent": true, + "badge": true, + "testidBuilder": true + }, + "required": [ + "type" + ], + "description": "tpl 渲染器" + }, + "BadgeObject": { + "type": "object", + "properties": { + "className": { + "type": "string" + }, + "text": { + "type": [ + "string", + "number" + ], + "description": "文本内容" + }, + "size": { + "type": "number", + "description": "大小" + }, + "mode": { + "type": "string", + "enum": [ + "text", + "dot", + "ribbon" + ], + "description": "角标类型" + }, + "offset": { + "type": "array", + "items": { + "type": [ + "number", + "string" + ] + }, + "minItems": 2, + "maxItems": 2, + "description": "角标位置,相对于position的位置进行偏移" + }, + "position": { + "type": "string", + "enum": [ + "top-right", + "top-left", + "bottom-right", + "bottom-left" + ], + "description": "角标位置" + }, + "overflowCount": { + "type": "number", + "description": "封顶的数字值" + }, + "visibleOn": { + "type": "string", + "description": "动态控制是否显示" + }, + "animation": { + "type": "boolean", + "description": "是否显示动画" + }, + "style": { + "type": "object", + "description": "角标的自定义样式" + }, + "level": { + "type": "string", + "description": "提示类型" + } + }, + "additionalProperties": false, + "description": "Badge 角标。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/badge" + }, + "TestIdBuilder": { + "type": "object", + "properties": { + "testId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "RemarkSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseRemarkSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "remark" + }, + "testid": true, + "label": true, + "icon": true, + "tooltipClassName": true, + "trigger": true, + "title": true, + "content": true, + "placement": true, + "rootClose": true, + "shape": true + }, + "required": [ + "type" + ] + }, + "ActionSchema": { + "if": { + "required": [ + "actionType" + ] + }, + "then": { + "allOf": [ + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "ajax" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/AjaxActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "url" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/UrlActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "link" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/LinkActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "dialog" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/DialogActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "drawer" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/DrawerActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "toast" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/ToastActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "copy" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/CopyActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "reload" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/ReloadActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "email" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/EmailActionSchema" + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "enum": [ + "prev", + "next", + "cancel", + "close", + "submit", + "confirm", + "add", + "reset", + "reset-and-submit" + ] + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/OtherActionSchema" + } + } + ] + }, + "else": { + "$ref": "#/definitions/VanillaAction" + } + }, + "AjaxActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "ajax", + "description": "指定为发送 ajax 的行为。" + }, + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "配置 ajax 发送地址" + }, + "feedback": { + "$ref": "#/definitions/FeedbackDialog" + }, + "reload": { + "$ref": "#/definitions/SchemaReload" + }, + "redirect": { + "type": "string" + }, + "ignoreConfirm": { + "type": "boolean" + }, + "isolateScope": { + "type": "boolean", + "description": "是否开启请求隔离, 主要用于隔离联动CRUD, Service的请求" + } + }, + "required": [ + "actionType", + "api" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "ajax" + }, + "api": true, + "feedback": true, + "reload": true, + "redirect": true, + "ignoreConfirm": true, + "isolateScope": true + }, + "required": [ + "actionType", + "api" + ] + }, + "SchemaApi": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaApiObject" + } + ] + }, + "SchemaApiObject": { + "type": "object", + "properties": { + "method": { + "type": "string", + "enum": [ + "get", + "post", + "put", + "delete", + "patch", + "jsonp", + "js" + ], + "description": "API 发送类型" + }, + "url": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "API 发送目标地址" + }, + "data": { + "type": "object", + "description": "用来控制携带数据. 当key 为 `&` 值为 `$$` 时, 将所有原始数据打平设置到 data 中. 当值为 $$ 将所有原始数据赋值到对应的 key 中. 当值为 $ 打头时, 将变量值设置到 key 中." + }, + "convertKeyToPath": { + "type": "boolean", + "description": "默认数据映射中的key如果带点,或者带大括号,会转成对象比如:\n\n{ 'a.b': '123' }\n\n经过数据映射后变成 { a: { b: '123 } }\n\n如果想要关闭此功能,请设置 convertKeyToPath 为 false" + }, + "responseData": { + "type": "object", + "description": "用来做接口返回的数据映射。" + }, + "attachDataToQuery": { + "type": "boolean", + "description": "如果 method 为 get 的接口,设置了 data 信息。 默认 data 会自动附带在 query 里面发送给后端。\n\n如果想通过 body 发送给后端,那么请把这个配置成 false。\n\n但是,浏览器还不支持啊,设置了只是摆设。除非服务端支持 method-override" + }, + "dataType": { + "type": "string", + "enum": [ + "json", + "form-data", + "form" + ], + "description": "发送体的格式" + }, + "responseType": { + "type": "string", + "const": "blob", + "description": "如果是文件下载接口,请配置这个。" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "number" + ] + }, + "description": "携带 headers,用法和 data 一样,可以用变量。" + }, + "sendOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "设置发送条件" + }, + "replaceData": { + "type": "boolean", + "description": "默认都是追加模式,如果想完全替换把这个配置成 true" + }, + "autoRefresh": { + "type": "boolean", + "description": "是否自动刷新,当 url 中的取值结果变化时,自动刷新数据。", + "default": true + }, + "trackExpression": { + "type": "string", + "description": "当开启自动刷新的时候,默认是 api 的 url 来自动跟踪变量变化的。 如果你希望监控 url 外的变量,请配置 trackExpression。" + }, + "cache": { + "type": "number", + "description": "如果设置了值,同一个接口,相同参数,指定的时间(单位:ms)内请求将直接走缓存。" + }, + "forceAppendDataToQuery": { + "type": "boolean", + "description": "强制将数据附加在 query,默认只有 api 地址中没有用变量的时候 crud 查询接口才会 自动附加数据到 query 部分,如果想强制附加请设置这个属性。 对于那种临时加了个变量但是又不想全部参数写一遍的时候配置很有用。" + }, + "qsOptions": { + "type": "object", + "properties": { + "arrayFormat": { + "type": "string", + "enum": [ + "indices", + "brackets", + "repeat", + "comma" + ] + }, + "indices": { + "type": "boolean" + }, + "allowDots": { + "type": "boolean" + } + }, + "additionalProperties": false, + "description": "qs 配置项" + }, + "silent": { + "type": "boolean", + "description": "autoFill 是否显示自动填充错误提示" + }, + "downloadFileName": { + "type": "string", + "description": "文件下载时,指定文件名" + } + }, + "required": [ + "url" + ], + "additionalProperties": false + }, + "SchemaUrlPath": { + "$ref": "#/definitions/SchemaTokenizeableString" + }, + "SchemaTokenizeableString": { + "type": "string" + }, + "FeedbackDialog": { + "allOf": [ + { + "type": "object", + "properties": { + "visibleOn": { + "type": "string", + "description": "可以用来配置 feedback 的出现条件" + }, + "skipRestOnCancel": { + "type": "boolean", + "description": "feedback 弹框取消是否中断后续操作" + }, + "skipRestOnConfirm": { + "type": "boolean", + "description": "feedback 弹框确认是否中断后续操作" + } + } + }, + { + "$ref": "#/definitions/DialogSchemaBase", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "dialog" + }, + "testid": true, + "inputParams": true, + "actions": true, + "body": true, + "bodyClassName": true, + "closeOnEsc": true, + "closeOnOutside": true, + "name": true, + "size": true, + "height": true, + "width": true, + "title": true, + "header": true, + "headerClassName": true, + "footer": true, + "confirm": true, + "showCloseButton": true, + "showErrorMsg": true, + "showLoading": true, + "overlay": true, + "dialogType": { + "type": "string", + "const": "confirm" + }, + "draggable": true, + "allowFullscreen": true, + "data": true, + "skipRestOnCancel": true, + "skipRestOnConfirm": true + } + }, + "DialogSchemaBase": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "inputParams": { + "description": "弹窗参数说明,值格式为 JSONSchema。" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "默认不用填写,自动会创建确认和取消按钮。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 Body 容器 className" + }, + "closeOnEsc": { + "type": "boolean", + "description": "是否支持按 ESC 关闭 Dialog" + }, + "closeOnOutside": { + "type": "boolean", + "description": "是否支持点其它区域关闭 Dialog" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "xl", + "full" + ], + "description": "Dialog 大小" + }, + "height": { + "type": "string", + "description": "Dialog 高度" + }, + "width": { + "type": "string", + "description": "Dialog 宽度" + }, + "title": { + "$ref": "#/definitions/SchemaCollection", + "description": "请通过配置 title 设置标题" + }, + "header": { + "$ref": "#/definitions/SchemaCollection" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "footer": { + "$ref": "#/definitions/SchemaCollection" + }, + "confirm": { + "type": "boolean", + "description": "影响自动生成的按钮,如果自己配置了按钮这个配置无效。" + }, + "showCloseButton": { + "type": "boolean", + "description": "是否显示关闭按钮" + }, + "showErrorMsg": { + "type": "boolean", + "description": "是否显示错误信息" + }, + "showLoading": { + "type": "boolean", + "description": "是否显示 spinner" + }, + "overlay": { + "type": "boolean", + "description": "是否显示蒙层" + }, + "dialogType": { + "type": "string", + "const": "confirm", + "description": "弹框类型 confirm 确认弹框" + }, + "draggable": { + "type": "boolean", + "description": "可拖拽" + }, + "allowFullscreen": { + "type": "boolean", + "description": "可全屏" + }, + "data": { + "type": "object", + "description": "数据映射" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "dialog" + }, + "testid": true, + "inputParams": true, + "actions": true, + "body": true, + "bodyClassName": true, + "closeOnEsc": true, + "closeOnOutside": true, + "name": true, + "size": true, + "height": true, + "width": true, + "title": true, + "header": true, + "headerClassName": true, + "footer": true, + "confirm": true, + "showCloseButton": true, + "showErrorMsg": true, + "showLoading": true, + "overlay": true, + "dialogType": { + "type": "string", + "const": "confirm" + }, + "draggable": true, + "allowFullscreen": true, + "data": true + }, + "required": [ + "type" + ], + "description": "Dialog 弹框渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/dialog" + }, + "SchemaName": { + "type": "string", + "description": "组件名字,这个名字可以用来定位,用于组件通信" + }, + "SchemaReload": { + "type": "string", + "description": "配置刷新动作,这个动作通常在完成渲染器本省的固定动作后出发。\n\n一般用来配置目标组件的 name 属性。多个目标可以用逗号隔开。\n\n当目标是 windows 时表示刷新整个页面。\n\n刷新目标的同时还支持传递参数如: `foo?a=${a}&b=${b},boo?c=${c}`" + }, + "ButtonSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "主要用于用户行为跟踪里区分是哪个按钮" + }, + "block": { + "type": "boolean", + "description": "是否为块状展示,默认为内联。" + }, + "disabledTip": { + "type": "string", + "description": "禁用时的文案提示。" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "按钮图标, iconfont 的类名" + }, + "iconClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "icon 上的css 类名" + }, + "rightIcon": { + "$ref": "#/definitions/SchemaIcon", + "description": "右侧按钮图标, iconfont 的类名" + }, + "rightIconClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "右侧 icon 上的 css 类名" + }, + "loadingClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "loading 上的css 类名" + }, + "label": { + "type": "string", + "description": "按钮文字" + }, + "level": { + "type": "string", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary", + "dark", + "light", + "secondary" + ], + "description": "按钮样式" + }, + "primary": { + "type": "boolean", + "deprecated": "通过 level 来配置" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "description": "按钮大小" + }, + "tooltip": { + "$ref": "#/definitions/SchemaTooltip" + }, + "tooltipPlacement": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ] + }, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ], + "description": "指定按钮类型,支持 button、submit或者reset三种类型。" + }, + "confirmText": { + "type": "string", + "description": "提示文字,配置了操作前会要求用户确认。" + }, + "required": { + "type": "array", + "items": { + "type": "string" + }, + "description": "如果按钮在form中,配置此属性会要求用户把指定的字段通过验证后才会触发行为。" + }, + "activeLevel": { + "type": "string", + "description": "激活状态时的样式" + }, + "activeClassName": { + "type": "string", + "description": "激活状态时的类名" + }, + "close": { + "type": [ + "boolean", + "string" + ], + "description": "如果按钮在弹框中,可以配置这个动作完成后是否关闭弹窗,或者指定关闭目标弹框。" + }, + "requireSelected": { + "type": "boolean", + "description": "当按钮时批量操作按钮时,默认必须有勾选元素才能可点击,如果此属性配置成 false,则没有点选成员也能点击。" + }, + "mergeData": { + "type": "boolean", + "description": "是否将弹框中数据 merge 到父级作用域。" + }, + "target": { + "type": "string", + "description": "可以指定让谁来触发这个动作。" + }, + "countDown": { + "type": "number", + "description": "点击后的禁止倒计时(秒)" + }, + "countDownTpl": { + "type": "string", + "description": "倒计时文字自定义" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "hotKey": { + "type": "string", + "description": "键盘快捷键" + }, + "loadingOn": { + "type": "string", + "description": "是否显示loading效果" + }, + "disabledOnAction": { + "type": "boolean", + "description": "是否在动作结束前禁用按钮" + }, + "onClick": { + "anyOf": [ + { + "type": "string" + }, + {} + ], + "description": "自定义事件处理函数" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "子内容" + }, + "tabIndex": { + "type": "string" + }, + "href": { + "type": "string", + "description": "点击后打开的链接地址" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true + }, + "required": [ + "type" + ] + }, + "SchemaTooltip": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "标题" + }, + "content": { + "type": "string", + "description": "内容" + } + }, + "required": [ + "content" + ], + "additionalProperties": false + } + ] + }, + "UrlActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "url", + "description": "指定为打开链接" + }, + "blank": { + "type": "boolean", + "description": "是否新窗口打开" + }, + "url": { + "type": "string", + "description": "打开的目标地址" + } + }, + "required": [ + "actionType", + "url" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "url" + }, + "blank": true, + "url": true + }, + "required": [ + "actionType", + "url" + ] + }, + "LinkActionSchema": { + "allOf": [ + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "link" + }, + "link": true + }, + "required": [ + "actionType", + "link" + ] + }, + "DialogActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "dialog", + "description": "指定为打开弹窗" + }, + "dialog": { + "$ref": "#/definitions/DialogSchemaBase", + "description": "弹框详情 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/dialog" + }, + "nextCondition": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否有下一个的表达式,正常可以不用配置,如果想要刷掉某些数据可以配置这个。" + }, + "reload": { + "$ref": "#/definitions/SchemaReload" + }, + "redirect": { + "type": "string" + }, + "data": { + "description": "数据映射" + } + }, + "required": [ + "actionType", + "dialog" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "dialog" + }, + "dialog": true, + "nextCondition": true, + "reload": true, + "redirect": true, + "data": true + }, + "required": [ + "actionType", + "dialog" + ] + }, + "DrawerActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "drawer", + "description": "指定为打开弹窗,抽出式弹窗" + }, + "drawer": { + "$ref": "#/definitions/DrawerSchemaBase", + "description": "抽出式弹框详情 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/drawer" + }, + "nextCondition": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否有下一个的表达式,正常可以不用配置,如果想要刷掉某些数据可以配置这个。" + }, + "reload": { + "$ref": "#/definitions/SchemaReload" + }, + "redirect": { + "type": "string" + }, + "data": { + "description": "数据映射" + } + }, + "required": [ + "actionType", + "drawer" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "drawer" + }, + "drawer": true, + "nextCondition": true, + "reload": true, + "redirect": true, + "data": true + }, + "required": [ + "actionType", + "drawer" + ] + }, + "DrawerSchemaBase": { + "allOf": [ + { + "type": "object", + "properties": { + "inputParams": { + "description": "弹窗参数说明,值格式为 JSONSchema。" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "默认不用填写,自动会创建确认和取消按钮。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 外层 className" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 Body 容器 className" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 头部 容器 className" + }, + "footerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 头部 容器 className" + }, + "closeOnEsc": { + "type": "boolean", + "description": "是否支持按 ESC 关闭 Dialog" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "full" + ], + "description": "Dialog 大小" + }, + "title": { + "$ref": "#/definitions/SchemaCollection", + "description": "请通过配置 title 设置标题" + }, + "position": { + "type": "string", + "enum": [ + "left", + "right", + "top", + "bottom" + ], + "description": "从什么位置弹出" + }, + "showCloseButton": { + "type": "boolean", + "description": "是否展示关闭按钮 当值为false时,默认开启closeOnOutside" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "抽屉的宽度 (当position为left | right时生效)" + }, + "height": { + "type": [ + "number", + "string" + ], + "description": "抽屉的高度 (当position为top | bottom时生效)" + }, + "header": { + "$ref": "#/definitions/SchemaCollection", + "description": "头部" + }, + "footer": { + "$ref": "#/definitions/SchemaCollection", + "description": "底部" + }, + "confirm": { + "type": "boolean", + "description": "影响自动生成的按钮,如果自己配置了按钮这个配置无效。" + }, + "resizable": { + "type": "boolean", + "description": "是否可以拖动弹窗大小" + }, + "overlay": { + "type": "boolean", + "description": "是否显示蒙层" + }, + "closeOnOutside": { + "type": "boolean", + "description": "点击外部的时候是否关闭弹框。" + }, + "showErrorMsg": { + "type": "boolean", + "description": "是否显示错误信息" + }, + "data": { + "type": "object", + "description": "数据映射" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "inputParams": true, + "actions": true, + "body": true, + "bodyClassName": true, + "headerClassName": true, + "footerClassName": true, + "closeOnEsc": true, + "name": true, + "size": true, + "title": true, + "position": true, + "showCloseButton": true, + "width": true, + "height": true, + "header": true, + "footer": true, + "confirm": true, + "resizable": true, + "overlay": true, + "closeOnOutside": true, + "showErrorMsg": true, + "data": true + }, + "description": "Drawer 抽出式弹框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/drawer" + }, + "ToastActionSchema": { + "allOf": [ + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "toast" + }, + "toast": true + }, + "required": [ + "actionType", + "toast" + ] + }, + "CopyActionSchema": { + "allOf": [ + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "copy" + }, + "copy": true + }, + "required": [ + "actionType", + "copy" + ] + }, + "ReloadActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "reload", + "description": "指定为刷新目标组件。" + }, + "target": { + "$ref": "#/definitions/SchemaReload", + "description": "指定目标组件。" + } + }, + "required": [ + "actionType" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "reload" + } + }, + "required": [ + "actionType" + ] + }, + "EmailActionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string", + "const": "email", + "description": "指定为打开邮箱行为" + }, + "to": { + "type": "string", + "description": "收件人邮箱" + }, + "cc": { + "type": "string", + "description": "抄送邮箱" + }, + "bcc": { + "type": "string", + "description": "匿名抄送邮箱" + }, + "subject": { + "type": "string", + "description": "邮件主题" + }, + "body": { + "type": "string", + "description": "邮件正文" + } + }, + "required": [ + "actionType", + "to" + ] + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "const": "email" + }, + "to": true, + "cc": true, + "bcc": true, + "subject": true + }, + "required": [ + "actionType", + "to" + ] + }, + "OtherActionSchema": { + "allOf": [ + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "action", + "button", + "submit", + "reset" + ] + }, + "testid": true, + "block": true, + "disabledTip": true, + "icon": true, + "iconClassName": true, + "rightIcon": true, + "rightIconClassName": true, + "loadingClassName": true, + "label": true, + "level": true, + "primary": true, + "size": true, + "tooltip": true, + "tooltipPlacement": true, + "confirmText": true, + "required": true, + "activeLevel": true, + "activeClassName": true, + "close": true, + "requireSelected": true, + "mergeData": true, + "target": true, + "countDown": true, + "countDownTpl": true, + "badge": true, + "hotKey": true, + "loadingOn": true, + "disabledOnAction": true, + "onClick": true, + "body": true, + "tabIndex": true, + "href": true, + "actionType": { + "type": "string", + "enum": [ + "prev", + "next", + "cancel", + "close", + "submit", + "confirm", + "add", + "reset", + "reset-and-submit" + ] + } + }, + "required": [ + "actionType" + ] + }, + "VanillaAction": { + "allOf": [ + { + "type": "object", + "properties": { + "actionType": { + "type": "string" + }, + "downloadFileName": { + "type": "string" + } + } + }, + { + "$ref": "#/definitions/ButtonSchema", + "additionalProperties": true + } + ] + }, + "AlertSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "alert", + "description": "指定为提示框类型" + }, + "title": { + "type": "string", + "description": "提示框标题" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "level": { + "type": "string", + "enum": [ + "info", + "warning", + "success", + "danger" + ], + "description": "提示类型" + }, + "showCloseButton": { + "type": "boolean", + "description": "是否显示关闭按钮" + }, + "closeButtonClassName": { + "type": "string", + "description": "关闭按钮CSS类名" + }, + "showIcon": { + "type": "boolean", + "description": "是否显示ICON" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "左侧图标" + }, + "iconClassName": { + "type": "string", + "description": "图标CSS类名" + }, + "actions": { + "$ref": "#/definitions/SchemaCollection", + "description": "操作区域" + } + }, + "required": [ + "type", + "body" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "alert" + }, + "testid": true, + "title": true, + "body": true, + "level": true, + "showCloseButton": true, + "closeButtonClassName": true, + "showIcon": true, + "icon": true, + "iconClassName": true, + "actions": true + }, + "required": [ + "type", + "body" + ], + "description": "Alert 提示渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/alert" + }, + "AudioSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "audio", + "description": "指定为音频播放器" + }, + "inline": { + "type": "boolean", + "description": "是否是内联模式" + }, + "src": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "\"视频播放地址, 支持 $ 取变量。" + }, + "loop": { + "type": "boolean", + "description": "是否循环播放" + }, + "autoPlay": { + "type": "boolean", + "description": "是否自动播放" + }, + "rates": { + "type": "array", + "items": { + "type": "number" + }, + "description": "配置可选播放倍速" + }, + "controls": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "rates", + "play", + "time", + "process", + "volume" + ] + }, + "description": "可以配置控制器" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "audio" + }, + "testid": true, + "inline": true, + "src": true, + "loop": true, + "autoPlay": true, + "rates": true, + "controls": true + }, + "required": [ + "type" + ], + "description": "Audio 音频渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/audio" + }, + "AvatarSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "avatar" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "类名" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "src": { + "type": "string", + "description": "图片地址" + }, + "defaultAvatar": { + "type": "string", + "description": "默认头像" + }, + "icon": { + "type": "string", + "description": "图标" + }, + "fit": { + "type": "string", + "enum": [ + "fill", + "contain", + "cover", + "none", + "scale-down" + ], + "description": "图片相对于容器的缩放方式" + }, + "shape": { + "type": "string", + "enum": [ + "circle", + "square", + "rounded" + ], + "description": "形状" + }, + "size": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "small" + }, + { + "type": "string", + "const": "default" + }, + { + "type": "string", + "const": "large" + } + ], + "description": "大小" + }, + "text": { + "type": "string", + "description": "文本" + }, + "gap": { + "type": "number", + "description": "字符类型距离左右两侧边界单位像素" + }, + "alt": { + "type": "string", + "description": "图片无法显示时的替换文字地址" + }, + "draggable": { + "type": "boolean", + "description": "图片是否允许拖动" + }, + "crossOrigin": { + "type": "string", + "enum": [ + "anonymous", + "use-credentials", + "" + ], + "description": "图片CORS属性" + }, + "onError": { + "type": "string", + "description": "图片加载失败的是否默认处理,字符串函数" + } + }, + "required": [ + "type", + "crossOrigin" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "avatar" + }, + "testid": true, + "badge": true, + "src": true, + "defaultAvatar": true, + "icon": true, + "fit": true, + "shape": true, + "size": true, + "text": true, + "gap": true, + "alt": true, + "draggable": true, + "crossOrigin": true, + "onError": true + }, + "required": [ + "type", + "crossOrigin" + ] + }, + "ButtonGroupSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseButtonGroupSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "button-group" + }, + "testid": true, + "btnClassName": true, + "btnActiveClassName": true, + "buttons": true, + "btnLevel": true, + "btnActiveLevel": true, + "vertical": true, + "tiled": true, + "size": true + }, + "required": [ + "type" + ] + }, + "BaseButtonGroupSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "btnClassName": { + "$ref": "#/definitions/SchemaClassName", + "deprecated": "给 Button 配置 className。建议用btnLevel" + }, + "btnActiveClassName": { + "type": "string", + "deprecated": "给选中态 Button 配置 className。建议用btnActiveLevel" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "按钮集合" + }, + "btnLevel": { + "type": "string", + "description": "按钮样式级别" + }, + "btnActiveLevel": { + "type": "string", + "description": "按钮选中的样式级别" + }, + "vertical": { + "type": "boolean", + "description": "垂直展示?" + }, + "tiled": { + "type": "boolean", + "description": "平铺展示?" + }, + "disabled": { + "type": "boolean", + "description": "是否为禁用状态。" + }, + "disabledOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "通过 JS 表达式来配置当前表单项的禁用状态。" + }, + "visible": { + "type": "boolean", + "description": "是否显示" + }, + "visibleOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "description": "按钮大小" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "btnClassName": true, + "btnActiveClassName": true, + "buttons": true, + "btnLevel": true, + "btnActiveLevel": true, + "vertical": true, + "tiled": true, + "size": true + }, + "description": "Button Group 渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/button-group" + }, + "ButtonToolbarSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/FormBaseControlWithoutSize", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "button-toolbar" + }, + "testid": true, + "buttons": true + }, + "required": [ + "type", + "buttons" + ], + "description": "Button Toolar 渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/button-toolbar" + }, + "FormBaseControlWithoutSize": { + "type": "object", + "properties": { + "label": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean", + "enum": [ + false + ] + } + ], + "description": "描述标题, 当值为 false 时不展示" + }, + "labelAlign": { + "$ref": "#/definitions/LabelAlign", + "description": "描述标题" + }, + "labelWidth": { + "type": [ + "number", + "string" + ], + "description": "label自定义宽度,默认单位为px" + }, + "labelOverflow": { + "type": "string", + "enum": [ + "default", + "ellipsis" + ], + "description": "label展示形式" + }, + "labelClassName": { + "type": "string", + "description": "配置 label className" + }, + "name": { + "type": "string", + "description": "字段名,表单提交时的 key,支持多层级,用.连接,如: a.b.c" + }, + "extraName": { + "type": "string", + "description": "额外的字段名,当为范围组件时可以用来将另外一个值打平出来" + }, + "remark": { + "description": "显示一个小图标, 鼠标放上去的时候显示提示内容" + }, + "labelRemark": { + "description": "显示一个小图标, 鼠标放上去的时候显示提示内容, 这个小图标跟 label 在一起" + }, + "hint": { + "type": "string", + "description": "输入提示,聚焦的时候显示" + }, + "submitOnChange": { + "type": "boolean", + "description": "当修改完的时候是否提交表单。" + }, + "readOnly": { + "type": "boolean", + "description": "是否只读" + }, + "readOnlyOn": { + "type": "string", + "description": "只读条件" + }, + "validateOnChange": { + "type": "boolean", + "description": "不设置时,当表单提交过后表单项每次修改都会触发重新验证, 如果设置了,则由此配置项来决定要不要每次修改都触发验证。" + }, + "description": { + "type": "string", + "description": "描述内容,支持 Html 片段。" + }, + "desc": { + "type": "string", + "deprecated": "用 description 代替" + }, + "descriptionClassName": { + "$ref": "#/definitions/ClassName", + "description": "配置描述上的 className" + }, + "mode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置当前表单项展示模式" + }, + "horizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "当配置为水平布局的时候,用来配置具体的左右分配。" + }, + "inline": { + "type": "boolean", + "description": "表单 control 是否为 inline 模式。" + }, + "inputClassName": { + "$ref": "#/definitions/ClassName", + "description": "配置 input className" + }, + "placeholder": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + ], + "description": "占位符" + }, + "required": { + "type": "boolean", + "description": "是否为必填" + }, + "validationErrors": { + "type": "object", + "properties": { + "isAlpha": { + "type": "string" + }, + "isAlphanumeric": { + "type": "string" + }, + "isEmail": { + "type": "string" + }, + "isFloat": { + "type": "string" + }, + "isInt": { + "type": "string" + }, + "isJson": { + "type": "string" + }, + "isLength": { + "type": "string" + }, + "isNumeric": { + "type": "string" + }, + "isRequired": { + "type": "string" + }, + "isUrl": { + "type": "string" + }, + "matchRegexp": { + "type": "string" + }, + "matchRegexp2": { + "type": "string" + }, + "matchRegexp3": { + "type": "string" + }, + "matchRegexp4": { + "type": "string" + }, + "matchRegexp5": { + "type": "string" + }, + "maxLength": { + "type": "string" + }, + "maximum": { + "type": "string" + }, + "minLength": { + "type": "string" + }, + "minimum": { + "type": "string" + }, + "isDateTimeSame": { + "type": "string" + }, + "isDateTimeBefore": { + "type": "string" + }, + "isDateTimeAfter": { + "type": "string" + }, + "isDateTimeSameOrBefore": { + "type": "string" + }, + "isDateTimeSameOrAfter": { + "type": "string" + }, + "isDateTimeBetween": { + "type": "string" + }, + "isTimeSame": { + "type": "string" + }, + "isTimeBefore": { + "type": "string" + }, + "isTimeAfter": { + "type": "string" + }, + "isTimeSameOrBefore": { + "type": "string" + }, + "isTimeSameOrAfter": { + "type": "string" + }, + "isTimeBetween": { + "type": "string" + } + }, + "description": "验证失败的提示信息" + }, + "validations": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "isAlpha": { + "type": "boolean", + "description": "是否是字母" + }, + "isAlphanumeric": { + "type": "boolean", + "description": "是否为字母数字" + }, + "isEmail": { + "type": "boolean", + "description": "是否为邮箱地址" + }, + "isFloat": { + "type": "boolean", + "description": "是否为浮点型" + }, + "isInt": { + "type": "boolean", + "description": "是否为整型" + }, + "isJson": { + "type": "boolean", + "description": "是否为 json" + }, + "isLength": { + "type": "number", + "description": "长度等于指定值" + }, + "isNumeric": { + "type": "boolean", + "description": "是否为数字" + }, + "isRequired": { + "type": "boolean", + "description": "是否为必填" + }, + "isUrl": { + "type": "boolean", + "description": "是否为 URL 地址" + }, + "matchRegexp": { + "type": "string", + "description": "内容命中指定正则" + }, + "matchRegexp1": { + "type": "string", + "description": "内容命中指定正则" + }, + "matchRegexp2": { + "type": "string", + "description": "内容命中指定正则" + }, + "matchRegexp3": { + "type": "string", + "description": "内容命中指定正则" + }, + "matchRegexp4": { + "type": "string", + "description": "内容命中指定正则" + }, + "matchRegexp5": { + "type": "string", + "description": "内容命中指定正则" + }, + "maxLength": { + "type": "number", + "description": "最大长度为指定值" + }, + "maximum": { + "type": "number", + "description": "最大值为指定值" + }, + "minLength": { + "type": "number", + "description": "最小长度为指定值" + }, + "minimum": { + "type": "number", + "description": "最小值为指定值" + }, + "isDateTimeSame": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "和目标日期相同,支持指定粒度,默认到毫秒" + }, + "isDateTimeBefore": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "早于目标日期,支持指定粒度,默认到毫秒" + }, + "isDateTimeAfter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "晚于目标日期,支持指定粒度,默认到毫秒" + }, + "isDateTimeSameOrBefore": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "早于目标日期或和目标日期相同,支持指定粒度,默认到毫秒" + }, + "isDateTimeSameOrAfter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "晚于目标日期或和目标日期相同,支持指定粒度,默认到毫秒" + }, + "isDateTimeBetween": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "日期处于目标日期范围,支持指定粒度和区间的开闭形式,默认到毫秒, 左右开区间" + }, + "isTimeSame": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "和目标时间相同,支持指定粒度,默认到毫秒" + }, + "isTimeBefore": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "早于目标时间,支持指定粒度,默认到毫秒" + }, + "isTimeAfter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "晚于目标时间,支持指定粒度,默认到毫秒" + }, + "isTimeSameOrBefore": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "早于目标时间或和目标时间相同,支持指定粒度,默认到毫秒" + }, + "isTimeSameOrAfter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "晚于目标时间或和目标时间相同,支持指定粒度,默认到毫秒" + }, + "isTimeBetween": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "时间处于目标时间范围,支持指定粒度和区间的开闭形式,默认到毫秒, 左右开区间" + } + } + } + ] + }, + "value": { + "description": "默认值,切记只能是静态值,不支持取变量,跟数据关联是通过设置 name 属性来实现的。" + }, + "clearValueOnHidden": { + "type": "boolean", + "description": "表单项隐藏时,是否在当前 Form 中删除掉该表单项值。注意同名的未隐藏的表单项值也会删掉" + }, + "validateApi": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "远端校验表单项接口" + }, + "autoFill": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "object", + "properties": { + "showSuggestion": { + "type": "boolean", + "description": "是否为参照录入模式,参照录入会展示候选值供用户选择,而不是直接填充。" + }, + "defaultSelection": { + "description": "参照录入时,默认选中的值" + }, + "api": { + "$ref": "#/definitions/BaseApi", + "description": "自动填充 api" + }, + "silent": { + "type": "boolean", + "description": "是否展示数据格式错误提示,默认为不展示", + "default": true + }, + "fillMappinng": { + "type": "object", + "description": "填充时的数据映射" + }, + "trigger": { + "type": "string", + "enum": [ + "change", + "focus", + "blur" + ], + "description": "触发条件,默认为 change" + }, + "mode": { + "type": "string", + "enum": [ + "popOver", + "dialog", + "drawer" + ], + "description": "弹窗方式,当为参照录入时用可以配置" + }, + "position": { + "type": "string", + "description": "当参照录入为抽屉时可以配置弹出位置" + }, + "size": { + "type": "string", + "description": "当为参照录入时可以配置弹出容器的大小" + }, + "columns": { + "type": "array", + "items": {}, + "description": "参照录入展示的项" + }, + "filter": { + "description": "参照录入时的过滤条件" + } + }, + "additionalProperties": false + } + ], + "description": "自动填充,当选项被选择的时候,将选项中的其他值同步设置到表单内。" + }, + "initAutoFill": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "const": "fillIfNotSet" + } + ], + "default": "fillIfNotSet\n初始化时是否把其他字段同步到表单内部。" + }, + "row": { + "type": "number" + } + }, + "additionalProperties": false + }, + "LabelAlign": { + "type": "string", + "enum": [ + "right", + "left", + "top", + "inherit" + ] + }, + "ClassName": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "boolean" + }, + { + "not": {} + }, + { + "type": "null" + }, + { + "type": "string" + } + ] + } + } + ] + }, + "FormHorizontal": { + "type": "object", + "properties": { + "left": { + "type": "number" + }, + "right": { + "type": "number" + }, + "leftFixed": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string", + "const": "xs" + }, + { + "type": "string", + "const": "sm" + }, + { + "type": "string", + "const": "md" + }, + { + "type": "string", + "const": "lg" + } + ] + }, + "justify": { + "type": "boolean" + }, + "labelAlign": { + "type": "string", + "enum": [ + "left", + "right" + ] + }, + "labelWidth": { + "type": [ + "number", + "string" + ], + "description": "label自定义宽度,默认单位为px" + }, + "labelOverflow": { + "type": "string", + "enum": [ + "default", + "ellipsis" + ] + } + }, + "additionalProperties": false + }, + "BaseApiObject": { + "type": "object", + "properties": { + "method": { + "type": "string", + "enum": [ + "get", + "post", + "put", + "delete", + "patch", + "jsonp", + "js" + ], + "description": "API 发送类型" + }, + "url": { + "type": "string", + "description": "API 发送目标地址" + }, + "data": { + "type": "object", + "description": "用来控制携带数据. 当key 为 `&` 值为 `$$` 时, 将所有原始数据打平设置到 data 中. 当值为 $$ 将所有原始数据赋值到对应的 key 中. 当值为 $ 打头时, 将变量值设置到 key 中." + }, + "convertKeyToPath": { + "type": "boolean", + "description": "默认数据映射中的key如果带点,或者带大括号,会转成对象比如:\n\n{ 'a.b': '123' }\n\n经过数据映射后变成 { a: { b: '123 } }\n\n如果想要关闭此功能,请设置 convertKeyToPath 为 false" + }, + "responseData": { + "type": "object", + "description": "用来做接口返回的数据映射。" + }, + "attachDataToQuery": { + "type": "boolean", + "description": "如果 method 为 get 的接口,设置了 data 信息。 默认 data 会自动附带在 query 里面发送给后端。\n\n如果想通过 body 发送给后端,那么请把这个配置成 false。\n\n但是,浏览器还不支持啊,设置了只是摆设。除非服务端支持 method-override" + }, + "dataType": { + "type": "string", + "enum": [ + "json", + "form-data", + "form" + ], + "description": "发送体的格式" + }, + "responseType": { + "type": "string", + "const": "blob", + "description": "如果是文件下载接口,请配置这个。" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "number" + ] + }, + "description": "携带 headers,用法和 data 一样,可以用变量。" + }, + "sendOn": { + "type": "string", + "description": "设置发送条件" + }, + "replaceData": { + "type": "boolean", + "description": "默认都是追加模式,如果想完全替换把这个配置成 true" + }, + "concatDataFields": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "是否将两次返回的数据字段,做一个合并。配置返回对象中的字段名,支持配置多个。\n\n比如:同时返回 log 字段,第一次返回 {log: '1'},第二次返回 {log: '2'},合并后的结果是 {log: ['1', '2']]} 再比如:同时返回 items 字段,第一次返回 {items: [1, 2]},第二次返回 {items: [3, 4]},合并后的结果是 {items: [1, 2, 3, 4]}" + }, + "autoRefresh": { + "type": "boolean", + "description": "是否自动刷新,当 url 中的取值结果变化时,自动刷新数据。", + "default": true + }, + "trackExpression": { + "type": "string", + "description": "当开启自动刷新的时候,默认是 api 的 url 来自动跟踪变量变化的。 如果你希望监控 url 外的变量,请配置 trackExpression。" + }, + "cache": { + "type": "number", + "description": "如果设置了值,同一个接口,相同参数,指定的时间(单位:ms)内请求将直接走缓存。" + }, + "forceAppendDataToQuery": { + "type": "boolean", + "description": "强制将数据附加在 query,默认只有 api 地址中没有用变量的时候 crud 查询接口才会 自动附加数据到 query 部分,如果想强制附加请设置这个属性。 对于那种临时加了个变量但是又不想全部参数写一遍的时候配置很有用。" + }, + "qsOptions": { + "type": "object", + "properties": { + "arrayFormat": { + "type": "string", + "enum": [ + "indices", + "brackets", + "repeat", + "comma" + ] + }, + "indices": { + "type": "boolean" + }, + "allowDots": { + "type": "boolean" + } + }, + "additionalProperties": false, + "description": "qs 配置项" + }, + "silent": { + "type": "boolean", + "description": "autoFill 是否显示自动填充错误提示" + }, + "messages": { + "type": "object", + "properties": { + "success": { + "type": "string" + }, + "failed": { + "type": "string" + } + }, + "additionalProperties": false, + "description": "提示信息" + } + }, + "required": [ + "url" + ], + "additionalProperties": false + }, + "BaseApi": { + "anyOf": [ + { + "$ref": "#/definitions/BaseApiObject" + }, + { + "type": "string" + } + ] + }, + "CalendarSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "calendar", + "description": "指定为日历选择控件" + }, + "schedules": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "object", + "properties": { + "startTime": { + "type": "string" + }, + "endTime": { + "type": "string" + }, + "content": {}, + "className": { + "type": "string" + } + }, + "required": [ + "startTime", + "endTime", + "content" + ], + "additionalProperties": false + } + }, + { + "type": "string" + } + ], + "description": "日程" + }, + "scheduleClassNames": { + "type": "array", + "items": { + "type": "string" + }, + "description": "日程显示颜色自定义" + }, + "scheduleAction": { + "$ref": "#/definitions/SchemaObject", + "description": "日程点击展示" + }, + "largeMode": { + "type": "boolean", + "description": "是否开启放大模式" + }, + "todayActiveStyle": { + "type": "object", + "description": "今日激活时的自定义样式" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "calendar" + }, + "testid": true, + "schedules": true, + "scheduleClassNames": true, + "scheduleAction": true, + "largeMode": true, + "todayActiveStyle": true + }, + "required": [ + "type" + ] + }, + "CardSchema": { + "allOf": [ + { + "$ref": "#/definitions/CardSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "card" + }, + "testid": true, + "header": true, + "body": true, + "media": true, + "actions": true, + "toolbar": true, + "secondary": true, + "useCardLabel": true + }, + "required": [ + "type" + ], + "description": "Card 卡片渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/card" + }, + "CardSchemaWithoutType": { + "type": "object", + "properties": { + "header": { + "type": "object", + "properties": { + "className": { + "$ref": "#/definitions/SchemaClassName" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题" + }, + "titleClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "subTitle": { + "$ref": "#/definitions/SchemaCollection", + "description": "副标题" + }, + "subTitleClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "subTitlePlaceholder": { + "type": "string" + }, + "description": { + "$ref": "#/definitions/SchemaTpl", + "description": "描述" + }, + "descriptionPlaceholder": { + "type": "string", + "description": "描述占位内容" + }, + "descriptionClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "描述占位类名" + }, + "desc": { + "$ref": "#/definitions/SchemaTpl", + "deprecated": "建议用 description" + }, + "descPlaceholder": { + "$ref": "#/definitions/SchemaTpl", + "deprecated": "建议用 descriptionPlaceholder" + }, + "descClassName": { + "$ref": "#/definitions/SchemaClassName", + "deprecated": "建议用 descriptionClassName" + }, + "avatar": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "图片地址" + }, + "avatarText": { + "$ref": "#/definitions/SchemaTpl" + }, + "avatarTextBackground": { + "type": "array", + "items": { + "type": "object", + "properties": { + "length": { + "type": "number" + } + }, + "required": [ + "length" + ], + "additionalProperties": { + "type": "string" + } + } + }, + "avatarTextClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "avatarClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "图片包括层类名" + }, + "imageClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "图片类名。" + }, + "highlight": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否点亮" + }, + "highlightClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "href": { + "$ref": "#/definitions/SchemaTpl", + "description": "链接地址" + }, + "blank": { + "type": "boolean", + "description": "是否新窗口打开" + } + }, + "additionalProperties": false, + "description": "头部配置" + }, + "body": { + "type": "array", + "items": { + "$ref": "#/definitions/CardBodyField" + }, + "description": "内容区域" + }, + "media": { + "type": "object", + "properties": { + "className": { + "$ref": "#/definitions/SchemaClassName" + }, + "type": { + "type": "string", + "enum": [ + "image", + "video" + ], + "description": "多媒体类型" + }, + "url": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "多媒体链接地址" + }, + "position": { + "type": "string", + "enum": [ + "top", + "left", + "right", + "bottom" + ], + "description": "多媒体区域位置" + }, + "autoPlay": { + "type": "boolean", + "description": "类型为video时是否自动播放" + }, + "isLive": { + "type": "boolean", + "description": "类型为video时是否是直播" + }, + "poster": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "类型为video时视频封面" + } + }, + "additionalProperties": false, + "description": "多媒体区域" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "底部按钮集合。" + }, + "toolbar": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "工具栏按钮" + }, + "secondary": { + "$ref": "#/definitions/SchemaTpl", + "description": "次要说明" + }, + "useCardLabel": { + "type": "boolean", + "description": "卡片内容区的表单项label是否使用Card内部的样式,默认为true" + } + }, + "additionalProperties": false + }, + "CardBodyField": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "列标题" + }, + "labelClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "label 类名" + }, + "name": { + "type": "string", + "description": "绑定字段名" + }, + "popOver": { + "$ref": "#/definitions/SchemaPopOver", + "description": "配置查看详情功能" + }, + "quickEdit": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "配置快速编辑功能" + }, + "copyable": { + "$ref": "#/definitions/SchemaCopyable", + "description": "配置点击复制功能" + } + }, + "required": [ + "label" + ], + "additionalProperties": true + } + ] + }, + "SchemaPopOver": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaPopOverObject" + } + ] + }, + "SchemaPopOverObject": { + "type": "object", + "properties": { + "className": { + "type": "string", + "description": "类名" + }, + "popOverClassName": { + "type": "string", + "description": "弹框外层类名" + }, + "popOverEnableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置当前行是否启动,要用表达式" + }, + "mode": { + "type": "string", + "enum": [ + "dialog", + "drawer", + "popOver" + ], + "description": "弹出模式" + }, + "size": { + "type": "string", + "enum": [ + "sm", + "md", + "lg", + "xl" + ], + "description": "是弹窗形式的时候有用。" + }, + "position": { + "type": "string", + "enum": [ + "center", + "left-top", + "left-top-left-top", + "left-top-left-center", + "left-top-left-bottom", + "left-top-center-top", + "left-top-center-center", + "left-top-center-bottom", + "left-top-right-top", + "left-top-right-center", + "left-top-right-bottom", + "right-top", + "right-top-left-top", + "right-top-left-center", + "right-top-left-bottom", + "right-top-center-top", + "right-top-center-center", + "right-top-center-bottom", + "right-top-right-top", + "right-top-right-center", + "right-top-right-bottom", + "left-bottom", + "left-bottom-left-top", + "left-bottom-left-center", + "left-bottom-left-bottom", + "left-bottom-center-top", + "left-bottom-center-center", + "left-bottom-center-bottom", + "left-bottom-right-top", + "left-bottom-right-center", + "left-bottom-right-bottom", + "right-bottom", + "right-bottom-left-top", + "right-bottom-left-center", + "right-bottom-left-bottom", + "right-bottom-center-top", + "right-bottom-center-center", + "right-bottom-center-bottom", + "right-bottom-right-top", + "right-bottom-right-center", + "right-bottom-right-bottom", + "fixed-center", + "fixed-left-top", + "fixed-right-top", + "fixed-left-bottom", + "fixed-right-bottom" + ], + "description": "弹出位置" + }, + "trigger": { + "type": "string", + "enum": [ + "click", + "hover" + ], + "description": "触发条件,默认是 click" + }, + "showIcon": { + "type": "boolean", + "description": "是否显示查看更多的 icon,通常是放大图标。" + }, + "offset": { + "type": "object", + "properties": { + "top": { + "type": "number" + }, + "left": { + "type": "number" + } + }, + "additionalProperties": false, + "description": "偏移量" + }, + "title": { + "type": "string", + "description": "标题" + }, + "body": { + "$ref": "#/definitions/SchemaCollection" + } + }, + "additionalProperties": false + }, + "SchemaQuickEdit": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaQuickEditObject" + } + ] + }, + "SchemaQuickEditObject": { + "anyOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "saveImmediately": { + "type": "boolean", + "description": "是否立即保存" + }, + "resetOnFailed": { + "type": "boolean", + "description": "接口保存失败后,是否重置组件编辑状态" + }, + "reload": { + "type": "string", + "description": "配置刷新目标,默认就会刷新所属 crud 组件, 如果不需要,请配置为 \"none\"" + }, + "mode": { + "type": "string", + "const": "inline", + "description": "是否直接内嵌" + }, + "icon": { + "type": "string", + "description": "配置按钮图标" + } + }, + "additionalProperties": true + }, + { + "$ref": "#/definitions/SchemaObjectLoose" + } + ] + }, + { + "type": "object", + "properties": { + "saveImmediately": { + "type": "boolean", + "description": "是否立即保存" + }, + "resetOnFailed": { + "type": "boolean", + "description": "接口保存失败后,是否重置组件编辑状态" + }, + "reload": { + "type": "string", + "description": "配置刷新目标,默认就会刷新所属 crud 组件, 如果不需要,请配置为 \"none\"" + }, + "mode": { + "type": "string", + "const": "inline", + "description": "是否直接内嵌" + }, + "icon": { + "type": "string", + "description": "配置按钮图标" + }, + "body": { + "$ref": "#/definitions/SchemaCollection" + } + }, + "required": [ + "body" + ], + "additionalProperties": false + } + ] + }, + "SchemaCopyable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaCopyableObject" + } + ] + }, + "SchemaCopyableObject": { + "type": "object", + "properties": { + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "可以配置图标" + }, + "content": { + "$ref": "#/definitions/SchemaTpl", + "description": "配置复制时的内容模板。" + }, + "tooltip": { + "type": "string", + "description": "提示文字内容" + } + }, + "additionalProperties": false + }, + "CardsSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseCardsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "cards" + }, + "testid": true, + "card": true, + "headerClassName": true, + "footerClassName": true, + "itemClassName": true, + "placeholder": true, + "showFooter": true, + "showHeader": true, + "source": true, + "title": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "header": true, + "footer": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "masonryLayout": true, + "valueField": true + }, + "required": [ + "type" + ] + }, + "BaseCardsSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "card": { + "anyOf": [ + { + "$ref": "#/definitions/CardSchemaWithoutType" + }, + { + "$ref": "#/definitions/Card2Schema" + } + ] + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "头部 CSS 类名" + }, + "footerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "底部 CSS 类名" + }, + "itemClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "卡片 CSS 类名", + "default": "Grid-col--xs12 Grid-col--sm6 Grid-col--md4 Grid-col--lg3" + }, + "placeholder": { + "$ref": "#/definitions/SchemaTpl", + "description": "无数据提示", + "default": "暂无数据" + }, + "showFooter": { + "type": "boolean", + "description": "是否显示底部" + }, + "showHeader": { + "type": "boolean", + "description": "是否显示头部" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "数据源: 绑定当前环境变量", + "default": "${items}" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题" + }, + "hideCheckToggler": { + "type": "boolean", + "description": "是否隐藏勾选框" + }, + "affixHeader": { + "type": "boolean", + "description": "是否固顶" + }, + "affixFooter": { + "type": "boolean", + "description": "是否固底" + }, + "header": { + "$ref": "#/definitions/SchemaCollection", + "description": "顶部区域" + }, + "footer": { + "$ref": "#/definitions/SchemaCollection", + "description": "底部区域" + }, + "itemCheckableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置某项是否可以点选" + }, + "itemDraggableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置某项是否可拖拽排序,前提是要开启拖拽功能" + }, + "checkOnItemClick": { + "type": "boolean", + "description": "点击卡片的时候是否勾选卡片。" + }, + "masonryLayout": { + "type": "boolean", + "description": "是否为瀑布流布局?" + }, + "valueField": { + "type": "string", + "description": "可以用来作为值的字段" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "card": true, + "headerClassName": true, + "footerClassName": true, + "itemClassName": true, + "placeholder": true, + "showFooter": true, + "showHeader": true, + "source": true, + "title": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "header": true, + "footer": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "masonryLayout": true, + "valueField": true + }, + "description": "Cards 卡片集合渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/cards" + }, + "Card2Schema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "card2", + "description": "指定为 card2 类型" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "body 类名" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "hideCheckToggler": { + "type": "boolean", + "description": "隐藏选框" + }, + "checkOnItemClick": { + "type": "boolean", + "description": "不配置href且cards容器下生效,点击整个卡片触发选中" + }, + "wrapperComponent": { + "type": "string", + "description": "渲染标签" + } + }, + "required": [ + "type", + "body", + "checkOnItemClick" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "card2" + }, + "testid": true, + "body": true, + "bodyClassName": true, + "hideCheckToggler": true, + "checkOnItemClick": true, + "wrapperComponent": true + }, + "required": [ + "type", + "body", + "checkOnItemClick" + ], + "description": "Card2 新卡片渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/card2" + }, + "SpinnerExtraProps": { + "type": "object", + "properties": { + "loadingConfig": { + "type": "object", + "properties": { + "root": { + "type": "string" + }, + "show": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "CarouselSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "carousel", + "description": "指定为轮播图类型" + }, + "direction": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ], + "description": "轮播图方向,默认为水平方向" + }, + "loop": { + "type": "boolean", + "description": "是否循环播放, 默认为 true。" + }, + "mouseEvent": { + "type": "boolean", + "description": "是否支持鼠标事件 默认为 true。" + }, + "auto": { + "type": "boolean", + "description": "是否自动播放" + }, + "interval": { + "type": [ + "number", + "string" + ], + "description": "轮播间隔时间" + }, + "duration": { + "type": "number", + "description": "动画时长" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "设置宽度" + }, + "height": { + "type": [ + "number", + "string" + ], + "description": "设置高度" + }, + "controlsTheme": { + "type": "string", + "enum": [ + "light", + "dark" + ] + }, + "placeholder": { + "type": "string", + "description": "占位" + }, + "controls": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "dots", + "arrows" + ] + }, + "description": "配置控件内容" + }, + "animation": { + "type": "string", + "enum": [ + "fade", + "slide", + "marquee" + ], + "description": "动画类型" + }, + "itemSchema": { + "$ref": "#/definitions/SchemaCollection", + "description": "配置单条呈现模板" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "thumbMode": { + "type": "string", + "enum": [ + "contain", + "cover" + ], + "description": "预览图模式" + }, + "options": { + "type": "array", + "items": {}, + "description": "配置固定值" + }, + "alwaysShowArrow": { + "type": "boolean", + "description": "是否一直显示箭头" + }, + "multiple": { + "type": "object", + "properties": { + "count": { + "type": "number" + } + }, + "required": [ + "count" + ], + "additionalProperties": false, + "description": "多图模式配置项" + }, + "icons": { + "type": "object", + "properties": { + "prev": { + "$ref": "#/definitions/SchemaCollection" + }, + "next": { + "$ref": "#/definitions/SchemaCollection" + } + }, + "additionalProperties": false, + "description": "自定义箭头图标" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "carousel" + }, + "testid": true, + "direction": true, + "loop": true, + "mouseEvent": true, + "auto": true, + "interval": true, + "duration": true, + "width": true, + "height": true, + "controlsTheme": true, + "placeholder": true, + "controls": true, + "animation": true, + "itemSchema": true, + "name": true, + "thumbMode": true, + "options": true, + "alwaysShowArrow": true, + "multiple": true, + "icons": true + }, + "required": [ + "type" + ], + "description": "Carousel 轮播图渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/carousel" + }, + "ChartSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "chart", + "description": "指定为 chart 类型" + }, + "chartTheme": { + "description": "Chart 主题配置" + }, + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "图表配置接口" + }, + "initFetch": { + "type": "boolean", + "description": "是否初始加载。", + "deprecated": "建议直接配置 api 的 sendOn" + }, + "initFetchOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否初始加载用表达式来配置", + "deprecated": "建议用 api.sendOn 属性。" + }, + "config": { + "description": "配置echart的config,支持数据映射。如果用了数据映射,为了同步更新,请设置 trackExpression" + }, + "trackExpression": { + "type": "string", + "description": "跟踪表达式,如果这个表达式的运行结果发生变化了,则会更新 Echart,当 config 中用了数据映射时有用。" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "宽度设置" + }, + "height": { + "type": [ + "number", + "string" + ], + "description": "高度设置" + }, + "interval": { + "type": "number", + "description": "刷新时间" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "style": { + "type": "object", + "description": "style样式" + }, + "dataFilter": { + "$ref": "#/definitions/SchemaFunction" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString" + }, + "disableDataMapping": { + "type": "boolean", + "description": "默认开启 Config 中的数据映射,如果想关闭,请开启此功能。" + }, + "clickAction": { + "$ref": "#/definitions/ActionSchema", + "description": "点击行为配置,可以用来满足下钻操作等。" + }, + "replaceChartOption": { + "type": "boolean", + "description": "默认配置时追加的,如果更新配置想完全替换配置请配置为 true." + }, + "unMountOnHidden": { + "type": "boolean", + "description": "不可见的时候隐藏" + }, + "mapURL": { + "$ref": "#/definitions/SchemaApi", + "description": "获取 geo json 文件的地址" + }, + "mapName": { + "type": "string", + "description": "地图名称" + }, + "loadBaiduMap": { + "type": "boolean", + "description": "加载百度地图" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "chart" + }, + "testid": true, + "chartTheme": true, + "api": true, + "initFetch": true, + "initFetchOn": true, + "config": true, + "trackExpression": true, + "width": true, + "height": true, + "interval": true, + "name": true, + "dataFilter": true, + "source": true, + "disableDataMapping": true, + "clickAction": true, + "replaceChartOption": true, + "unMountOnHidden": true, + "mapURL": true, + "mapName": true, + "loadBaiduMap": true + }, + "required": [ + "type" + ], + "description": "Chart 图表渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/chart" + }, + "SchemaFunction": { + "type": "string" + }, + "CollapseSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseCollapseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "collapse" + }, + "testid": true, + "key": true, + "headerPosition": true, + "header": true, + "bodyClassName": true, + "collapsable": true, + "collapsed": true, + "showArrow": true, + "expandIcon": true, + "headingClassName": true, + "collapseHeader": true, + "size": true, + "mountOnEnter": true, + "unmountOnExit": true, + "divideLine": true, + "body": true + }, + "required": [ + "type", + "body" + ], + "description": "Collapse 折叠渲染器,格式说明。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/collapse" + }, + "BaseCollapseSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "标识" + }, + "headerPosition": { + "type": "string", + "enum": [ + "top", + "bottom" + ], + "description": "标题展示位置" + }, + "header": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "标题" + }, + "bodyClassName": { + "type": "string", + "description": "配置 Body 容器 className" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + }, + "collapsable": { + "type": "boolean", + "description": "是否可折叠" + }, + "collapsed": { + "type": "boolean", + "description": "默认是否折叠" + }, + "showArrow": { + "type": "boolean", + "description": "图标是否展示" + }, + "expandIcon": { + "$ref": "#/definitions/SchemaObject", + "description": "自定义切换图标" + }, + "headingClassName": { + "type": "string", + "description": "标题 CSS 类名" + }, + "collapseHeader": { + "$ref": "#/definitions/SchemaTpl", + "description": "收起的标题" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "base" + ], + "description": "控件大小" + }, + "mountOnEnter": { + "type": "boolean", + "description": "点开时才加载内容" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏就销毁内容。" + }, + "divideLine": { + "type": "boolean", + "description": "标题内容分割线" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "key": true, + "headerPosition": true, + "header": true, + "bodyClassName": true, + "collapsable": true, + "collapsed": true, + "showArrow": true, + "expandIcon": true, + "headingClassName": true, + "collapseHeader": true, + "size": true, + "mountOnEnter": true, + "unmountOnExit": true, + "divideLine": true + } + }, + "CollapseGroupSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "collapse-group", + "description": "指定为折叠器类型" + }, + "activeKey": { + "anyOf": [ + { + "type": "array", + "items": { + "type": [ + "string", + "number" + ] + } + }, + { + "type": "string" + }, + { + "type": "number" + } + ], + "description": "激活面板" + }, + "accordion": { + "type": "boolean", + "description": "手风琴模式" + }, + "expandIcon": { + "$ref": "#/definitions/SchemaObject", + "description": "自定义切换图标" + }, + "expandIconPosition": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "设置图标位置" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "enableFieldSetStyle": { + "type": "boolean", + "description": "当Collapse作为Form组件的子元素时,开启该属性后组件样式设置为FieldSet组件的样式,默认开启" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "collapse-group" + }, + "testid": true, + "activeKey": true, + "accordion": true, + "expandIcon": true, + "expandIconPosition": true, + "body": true, + "enableFieldSetStyle": true + }, + "required": [ + "type" + ], + "description": "CollapseGroup 折叠渲染器,格式说明。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/collapse" + }, + "ColorSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "color", + "description": "指定为颜色显示控件" + }, + "defaultColor": { + "type": "string", + "description": "默认颜色" + }, + "showValue": { + "type": "boolean", + "description": "是否用文字显示值。" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "color" + }, + "testid": true, + "defaultColor": true, + "showValue": true + }, + "required": [ + "type" + ], + "description": "Color 显示渲染器,格式说明。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/color" + }, + "ContainerSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "container", + "description": "指定为 container 类型" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "body 类名" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "wrapperComponent": { + "type": "string", + "description": "使用的标签" + }, + "wrapperBody": { + "type": "boolean", + "description": "是否需要对body加一层div包裹,默认为 true" + }, + "draggable": { + "type": [ + "boolean", + "string" + ], + "description": "是否开启容器拖拽" + }, + "draggableConfig": { + "anyOf": [ + { + "$ref": "#/definitions/ContainerDraggableConfig" + }, + { + "type": "string" + } + ], + "description": "是否开启容器拖拽配置" + } + }, + "required": [ + "type", + "body", + "draggableConfig" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "container" + }, + "testid": true, + "body": true, + "bodyClassName": true, + "wrapperComponent": true, + "wrapperBody": true, + "draggable": true, + "draggableConfig": true + }, + "required": [ + "type", + "body", + "draggableConfig" + ], + "description": "Container 容器渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/container" + }, + "ContainerDraggableConfig": { + "type": "object", + "properties": { + "axis": { + "type": "string", + "enum": [ + "both", + "x", + "y" + ], + "description": "可拖拽的方向, 默认为所有方向, 支持设置为X或Y轴" + }, + "defaultPosition": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": [ + "x", + "y" + ], + "additionalProperties": false, + "description": "元素的起始位置" + }, + "bounds": { + "anyOf": [ + { + "type": "object", + "properties": { + "left": { + "type": "number" + }, + "right": { + "type": "number" + }, + "top": { + "type": "number" + }, + "bottom": { + "type": "number" + } + }, + "additionalProperties": false + }, + { + "type": "string" + } + ], + "description": "拖拽的边界, 可以设置坐标, 也可以设置父级元素的选择器" + }, + "grid": { + "type": "array", + "items": { + "type": "number" + }, + "minItems": 2, + "maxItems": 2, + "description": "以网格模式拖拽的步长" + }, + "handle": { + "type": "string", + "description": "初始化拖拽的选择器" + }, + "cancel": { + "type": "string", + "description": "禁止拖拽的选择器" + }, + "scale": { + "type": "number", + "description": "拖拽距离的缩放比, 默认为1" + }, + "enableUserSelect": { + "type": "boolean", + "description": "默认设置容器内部为'user-select:none', 可以设置true关闭" + } + }, + "additionalProperties": false, + "description": "容器拖拽配置" + }, + "SwitchContainerSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "switch-container", + "description": "指定为 container 类型" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/StateSchema" + }, + "description": "状态项列表" + }, + "style": { + "type": "object", + "description": "自定义样式" + } + }, + "required": [ + "type", + "items" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "switch-container" + }, + "testid": true, + "items": true + }, + "required": [ + "type", + "items" + ], + "description": "SwitchContainer 状态容器渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/state-container" + }, + "StateSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "状态标题" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "visibleOn": { + "type": "string", + "description": "显示条件" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "body": true + } + }, + "CRUDSchema": { + "if": { + "required": [ + "mode" + ] + }, + "then": { + "allOf": [ + { + "if": { + "properties": { + "mode": { + "type": "string", + "const": "cards" + } + }, + "required": [ + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUDCardsSchema" + } + }, + { + "if": { + "properties": { + "mode": { + "type": "string", + "const": "list" + } + }, + "required": [ + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUDListSchema" + } + }, + { + "if": { + "properties": { + "mode": { + "type": "string", + "const": "table" + } + }, + "required": [ + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUDTableSchema" + } + } + ] + }, + "else": { + "$ref": "#/definitions/CRUDTableSchema" + } + }, + "CRUDCardsSchema": { + "allOf": [ + { + "$ref": "#/definitions/CRUDCommonSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseCardsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud" + }, + "testid": true, + "card": true, + "headerClassName": true, + "footerClassName": true, + "itemClassName": true, + "placeholder": true, + "showFooter": true, + "showHeader": true, + "source": true, + "title": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "header": true, + "footer": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "masonryLayout": true, + "valueField": true, + "mode": { + "type": "string", + "const": "cards" + }, + "api": true, + "deferApi": true, + "bulkActions": true, + "itemActions": true, + "perPage": true, + "orderBy": true, + "orderDir": true, + "defaultParams": true, + "draggable": true, + "draggableOn": true, + "name": true, + "filter": true, + "initFetch": true, + "initFetchOn": true, + "innerClassName": true, + "interval": true, + "orderField": true, + "pageField": true, + "perPageField": true, + "pageDirectionField": true, + "totalField": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "saveOrderApi": true, + "syncLocation": true, + "toolbar": true, + "toolbarInline": true, + "headerToolbar": true, + "footerToolbar": true, + "perPageAvailable": true, + "messages": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "stopAutoRefreshWhenModalIsOpen": true, + "filterTogglable": true, + "filterDefaultVisible": true, + "syncResponse2Query": true, + "keepItemSelectionOnPageChange": true, + "maxKeepItemSelectionLength": true, + "labelTpl": true, + "loadDataOnce": true, + "loadDataOnceFetchOnFilter": true, + "matchFunc": true, + "expandConfig": true, + "alwaysShowPagination": true, + "autoGenerateFilter": true, + "autoFillHeight": true, + "parsePrimitiveQuery": true, + "selectable": true, + "multiple": true, + "loadMoreProps": true + }, + "required": [ + "mode", + "type" + ] + }, + "CRUDCommonSchemaWithoutType": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "table", + "grid", + "cards", + "list" + ], + "description": "指定内容区的展示模式。" + }, + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "初始化数据 API" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi", + "description": "懒加载 API,当行数据中用 defer: true 标记了,则其孩子节点将会用这个 API 来拉取数据。" + }, + "bulkActions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "批量操作" + }, + "itemActions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "单条操作" + }, + "perPage": { + "type": "number", + "description": "每页个数,默认为 10,如果不是请设置。", + "default": 10 + }, + "orderBy": { + "type": "string", + "description": "默认排序字段" + }, + "orderDir": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "description": "默认排序方向" + }, + "defaultParams": { + "$ref": "#/definitions/PlainObject", + "description": "可以默认给定初始参数如: {\\\"perPage\\\": 24}" + }, + "draggable": { + "type": "boolean", + "description": "是否可通过拖拽排序" + }, + "draggableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否可通过拖拽排序,通过表达式来配置" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "filter": { + "description": "过滤器表单" + }, + "initFetch": { + "type": "boolean", + "description": "初始是否拉取", + "deprecated": "建议用 api 的 sendOn 代替。" + }, + "initFetchOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "初始是否拉取,用表达式来配置。", + "deprecated": "建议用 api 的 sendOn 代替。" + }, + "innerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置内部 DOM 的 className" + }, + "interval": { + "type": "number", + "description": "设置自动刷新时间" + }, + "orderField": { + "type": "string", + "description": "设置用来确定位置的字段名,设置后新的顺序将被赋值到该字段中。" + }, + "pageField": { + "type": "string", + "description": "设置分页页码字段名。", + "default": "page" + }, + "perPageField": { + "type": "string", + "description": "设置分页一页显示的多少条数据的字段名。", + "default": "perPage" + }, + "pageDirectionField": { + "type": "string", + "description": "设置分页方向的字段名。单位简单分页时清楚时向前还是向后翻页。", + "default": "pageDir" + }, + "totalField": { + "type": "string", + "description": "设置总条数的字段名。" + }, + "quickSaveApi": { + "$ref": "#/definitions/SchemaApi", + "description": "快速编辑后用来批量保存的 API" + }, + "quickSaveItemApi": { + "$ref": "#/definitions/SchemaApi", + "description": "快速编辑配置成及时保存时使用的 API" + }, + "saveOrderApi": { + "$ref": "#/definitions/SchemaApi", + "description": "保存排序的 api" + }, + "syncLocation": { + "type": "boolean", + "description": "是否将过滤条件的参数同步到地址栏,默认为true", + "default": true + }, + "toolbar": { + "$ref": "#/definitions/SchemaCollection" + }, + "toolbarInline": { + "type": "boolean", + "description": "工具栏是否为 inline 模式" + }, + "headerToolbar": { + "type": "array", + "items": { + "anyOf": [ + { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "$ref": "#/definitions/CRUDToolbarObject", + "additionalProperties": true + } + ] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "align": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "对齐方式" + }, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/CRUDBultinToolbarType" + } + ] + }, + "description": "顶部工具栏" + }, + "footerToolbar": { + "type": "array", + "items": { + "anyOf": [ + { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "$ref": "#/definitions/CRUDToolbarObject", + "additionalProperties": true + } + ] + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "align": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "对齐方式" + }, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/CRUDBultinToolbarType" + } + ] + }, + "description": "底部工具栏" + }, + "perPageAvailable": { + "type": "array", + "items": { + "type": "number" + }, + "description": "每页显示多少个空间成员的配置如: [10, 20, 50, 100]。" + }, + "messages": { + "$ref": "#/definitions/SchemaMessage" + }, + "hideQuickSaveBtn": { + "type": "boolean", + "description": "是否隐藏快速编辑的按钮。" + }, + "autoJumpToTopOnPagerChange": { + "type": "boolean", + "description": "是否自动跳顶部,当切分页的时候。" + }, + "silentPolling": { + "type": "boolean", + "description": "静默拉取" + }, + "stopAutoRefreshWhen": { + "$ref": "#/definitions/SchemaExpression" + }, + "stopAutoRefreshWhenModalIsOpen": { + "type": "boolean" + }, + "filterTogglable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "activeLabel": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "activeIcon": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "filterDefaultVisible": { + "type": "boolean" + }, + "syncResponse2Query": { + "type": "boolean", + "description": "是否将接口返回的内容自动同步到地址栏,前提是开启了同步地址栏。" + }, + "keepItemSelectionOnPageChange": { + "type": "boolean", + "description": "分页的时候是否保留用户选择。" + }, + "maxKeepItemSelectionLength": { + "type": "number", + "description": "当开启 keepItemSelectionOnPageChange 时,最大保留已勾选项的数量。" + }, + "labelTpl": { + "$ref": "#/definitions/SchemaTpl", + "description": "当配置 keepItemSelectionOnPageChange 时有用,用来配置已勾选项的文案。" + }, + "loadDataOnce": { + "type": "boolean", + "description": "是否为前端单次加载模式,可以用来实现前端分页。" + }, + "loadDataOnceFetchOnFilter": { + "type": "boolean", + "description": "在开启loadDataOnce时,当修改过滤条件时是否重新请求api\n\n如果没有配置,当查询条件表单触发的会重新请求 api,当是列过滤或者是 search-box 触发的则不重新请求 api 如果配置为 true,则不管是什么触发都会重新请求 api 如果配置为 false 则不管是什么触发都不会重新请求 api" + }, + "matchFunc": { + "anyOf": [ + { + "type": "string" + }, + {} + ], + "description": "自定义搜索匹配函数,当开启loadDataOnce时,会基于该函数计算的匹配结果进行过滤,主要用于处理列字段类型较为复杂或者字段值格式和后端返回不一致的场景\n\n参数说明\n\n * `items` 当前表格数据 * `itemsRaw` 当前表格数据(未处理) * `options` 配置 * `options.query` 查询条件 * `options.columns` 列配置 * `options.matchSorter` 系统默认的排序方法" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "也可以直接从环境变量中读取,但是不太推荐。" + }, + "expandConfig": { + "type": "object", + "properties": { + "expand": { + "type": "string", + "enum": [ + "first", + "all", + "none" + ], + "description": "默认是展开第一个、所有、还是都不展开。" + }, + "expandAll": { + "type": "boolean", + "description": "是否显示全部切换按钮" + }, + "accordion": { + "type": "boolean", + "description": "是否为手风琴模式" + } + }, + "additionalProperties": false, + "description": "如果时内嵌模式,可以通过这个来配置默认的展开选项。" + }, + "alwaysShowPagination": { + "type": "boolean", + "description": "默认只有当分页数大于 1 是才显示,如果总是想显示请配置。" + }, + "autoGenerateFilter": { + "anyOf": [ + { + "$ref": "#/definitions/AutoGenerateFilterObject" + }, + { + "type": "boolean" + } + ], + "description": "开启查询区域,会根据列元素的searchable属性值,自动生成查询条件表单" + }, + "autoFillHeight": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "height": { + "type": "number" + }, + "maxHeight": { + "type": "number" + } + }, + "required": [ + "height", + "maxHeight" + ], + "additionalProperties": false + } + ], + "description": "内容区域占满屏幕剩余空间" + }, + "parsePrimitiveQuery": { + "anyOf": [ + { + "type": "object", + "properties": { + "enable": { + "type": "boolean" + }, + "types": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "boolean", + "number" + ] + } + } + }, + "required": [ + "enable" + ], + "additionalProperties": false + }, + { + "type": "boolean" + } + ], + "description": "是否开启Query信息转换,开启后将会对url中的Query进行转换,默认开启,默认仅转化布尔值" + }, + "selectable": { + "type": "boolean", + "description": "是否开启行选择功能, 默认为 false 开启后将支持行选择功能,需要结合事件动作使用" + }, + "multiple": { + "type": "boolean", + "description": "控制是否多选,默认为 false" + }, + "loadMoreProps": { + "type": "object", + "properties": { + "showIcon": { + "type": "boolean" + }, + "showText": { + "type": "boolean" + }, + "color": { + "type": "string" + }, + "iconType": { + "type": "string" + }, + "contentText": { + "type": "object", + "properties": { + "contentdown": { + "type": "string" + }, + "contentrefresh": { + "type": "string" + }, + "contentnomore": { + "type": "string" + } + }, + "required": [ + "contentdown", + "contentrefresh", + "contentnomore" + ], + "additionalProperties": false + }, + "minLoadingTime": { + "type": "number" + }, + "dataAppendTo": { + "type": "string", + "enum": [ + "top", + "bottom" + ] + } + }, + "additionalProperties": false, + "description": "加载更多配置" + } + }, + "additionalProperties": false + }, + "PlainObject": { + "type": "object" + }, + "CRUDToolbarObject": { + "type": "object", + "properties": { + "align": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "对齐方式" + } + }, + "additionalProperties": false + }, + "CRUDBultinToolbarType": { + "type": "string", + "enum": [ + "columns-toggler", + "drag-toggler", + "pagination", + "bulkActions", + "bulk-actions", + "statistics", + "switch-per-page", + "load-more", + "filter-toggler", + "export-csv", + "export-excel" + ] + }, + "SchemaMessage": { + "type": "object", + "properties": { + "fetchFailed": { + "type": "string", + "description": "获取失败时的提示" + }, + "fetchSuccess": { + "type": "string", + "description": "获取成功的提示,默认为空。" + }, + "saveFailed": { + "type": "string", + "description": "保存失败时的提示。" + }, + "saveSuccess": { + "type": "string", + "description": "保存成功时的提示。" + } + }, + "additionalProperties": false, + "description": "消息文案配置,记住这个优先级是最低的,如果你的接口返回了 msg,接口返回的优先。" + }, + "AutoGenerateFilterObject": { + "type": "object", + "properties": { + "columnsNum": { + "type": "number", + "description": "过滤条件单行列数" + }, + "showBtnToolbar": { + "type": "boolean", + "description": "是否显示设置查询字段" + }, + "defaultCollapsed": { + "type": "boolean", + "description": "是否默认收起", + "default": true + }, + "enableBulkActions": { + "type": "boolean", + "description": "是否启用多选框" + }, + "enableBulkActionsOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "启用批量操作的表达式" + } + }, + "additionalProperties": false + }, + "CRUDListSchema": { + "allOf": [ + { + "$ref": "#/definitions/CRUDCommonSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseListSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud" + }, + "testid": true, + "title": true, + "footer": true, + "footerClassName": true, + "header": true, + "headerClassName": true, + "listItem": true, + "source": true, + "showFooter": true, + "showHeader": true, + "placeholder": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "valueField": true, + "size": true, + "itemAction": true, + "showIndexBar": true, + "indexField": true, + "indexBarOffset": true, + "mode": { + "type": "string", + "const": "list" + }, + "api": true, + "deferApi": true, + "bulkActions": true, + "itemActions": true, + "perPage": true, + "orderBy": true, + "orderDir": true, + "defaultParams": true, + "draggable": true, + "draggableOn": true, + "name": true, + "filter": true, + "initFetch": true, + "initFetchOn": true, + "innerClassName": true, + "interval": true, + "orderField": true, + "pageField": true, + "perPageField": true, + "pageDirectionField": true, + "totalField": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "saveOrderApi": true, + "syncLocation": true, + "toolbar": true, + "toolbarInline": true, + "headerToolbar": true, + "footerToolbar": true, + "perPageAvailable": true, + "messages": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "stopAutoRefreshWhenModalIsOpen": true, + "filterTogglable": true, + "filterDefaultVisible": true, + "syncResponse2Query": true, + "keepItemSelectionOnPageChange": true, + "maxKeepItemSelectionLength": true, + "labelTpl": true, + "loadDataOnce": true, + "loadDataOnceFetchOnFilter": true, + "matchFunc": true, + "expandConfig": true, + "alwaysShowPagination": true, + "autoGenerateFilter": true, + "autoFillHeight": true, + "parsePrimitiveQuery": true, + "selectable": true, + "multiple": true, + "loadMoreProps": true + }, + "required": [ + "mode", + "type" + ] + }, + "BaseListSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题" + }, + "footer": { + "$ref": "#/definitions/SchemaCollection", + "description": "底部区域" + }, + "footerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "底部区域类名" + }, + "header": { + "$ref": "#/definitions/SchemaCollection", + "description": "顶部区域" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "顶部区域类名" + }, + "listItem": { + "$ref": "#/definitions/ListItemSchema", + "description": "单条数据展示内容配置" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "数据源: 绑定当前环境变量", + "default": "${items}" + }, + "showFooter": { + "type": "boolean", + "description": "是否显示底部" + }, + "showHeader": { + "type": "boolean", + "description": "是否显示头部" + }, + "placeholder": { + "$ref": "#/definitions/SchemaTpl", + "description": "无数据提示", + "default": "暂无数据" + }, + "hideCheckToggler": { + "type": "boolean", + "description": "是否隐藏勾选框" + }, + "affixHeader": { + "type": "boolean", + "description": "是否固顶" + }, + "affixFooter": { + "type": "boolean", + "description": "是否固底" + }, + "itemCheckableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置某项是否可以点选" + }, + "itemDraggableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "配置某项是否可拖拽排序,前提是要开启拖拽功能" + }, + "checkOnItemClick": { + "type": "boolean", + "description": "点击列表单行时,是否选择" + }, + "valueField": { + "type": "string", + "description": "可以用来作为值的字段" + }, + "size": { + "type": "string", + "enum": [ + "sm", + "base" + ], + "description": "大小" + }, + "itemAction": { + "$ref": "#/definitions/ActionSchema", + "description": "点击列表项的行为" + }, + "showIndexBar": { + "type": "boolean", + "description": "是否显示右侧字母索引条" + }, + "indexField": { + "type": "string", + "description": "索引依据字段" + }, + "indexBarOffset": { + "type": "number", + "description": "索引条偏移量" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "title": true, + "footer": true, + "footerClassName": true, + "header": true, + "headerClassName": true, + "listItem": true, + "source": true, + "showFooter": true, + "showHeader": true, + "placeholder": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "valueField": true, + "size": true, + "itemAction": true, + "showIndexBar": true, + "indexField": true, + "indexBarOffset": true + }, + "description": "List 列表展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/card" + }, + "ListItemSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + } + }, + "actionsPosition": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "操作位置,默认在右侧,可以设置成左侧。" + }, + "avatar": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "图片地址" + }, + "body": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ListBodyField" + }, + { + "$ref": "#/definitions/ListBodyFieldObject" + } + ] + }, + "description": "内容区域" + }, + "desc": { + "$ref": "#/definitions/SchemaTpl", + "description": "描述" + }, + "remark": { + "$ref": "#/definitions/SchemaRemark", + "description": "tooltip 说明" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题" + }, + "subTitle": { + "$ref": "#/definitions/SchemaTpl", + "description": "副标题" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "actions": true, + "actionsPosition": true, + "avatar": true, + "body": true, + "desc": true, + "remark": true, + "title": true, + "subTitle": true + } + }, + "ListBodyField": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "$ref": "#/definitions/ListBodyFieldObject", + "additionalProperties": true + } + ] + }, + "ListBodyFieldObject": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "列标题" + }, + "labelClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "label 类名" + }, + "innerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "内层组件的CSS类名" + }, + "name": { + "type": "string", + "description": "绑定字段名" + }, + "popOver": { + "$ref": "#/definitions/SchemaPopOver", + "description": "配置查看详情功能" + }, + "quickEdit": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "配置快速编辑功能" + }, + "copyable": { + "$ref": "#/definitions/SchemaCopyable", + "description": "配置点击复制功能" + } + }, + "additionalProperties": false, + "description": "不指定类型默认就是文本" + }, + "CRUDTableSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "mode": { + "type": "string", + "const": "table", + "description": "指定内容区的展示模式。" + }, + "type": { + "type": "string", + "const": "crud" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/CRUDCommonSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseTableSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud" + }, + "testid": true, + "affixHeader": true, + "affixFooter": true, + "columns": true, + "columnsTogglable": true, + "footable": true, + "footerClassName": true, + "headerClassName": true, + "placeholder": true, + "showIndex": true, + "showFooter": true, + "showHeader": true, + "source": true, + "tableClassName": true, + "title": true, + "toolbarClassName": true, + "combineNum": true, + "combineFromIndex": true, + "prefixRow": true, + "affixRow": true, + "resizable": true, + "rowClassNameExpr": true, + "itemBadge": true, + "autoGenerateFilter": true, + "canAccessSuperData": true, + "autoFillHeight": true, + "tableLayout": true, + "deferApi": true, + "persistKey": true, + "mode": { + "type": "string", + "const": "table" + }, + "api": true, + "bulkActions": true, + "itemActions": true, + "perPage": true, + "orderBy": true, + "orderDir": true, + "defaultParams": true, + "draggable": true, + "draggableOn": true, + "name": true, + "filter": true, + "initFetch": true, + "initFetchOn": true, + "innerClassName": true, + "interval": true, + "orderField": true, + "pageField": true, + "perPageField": true, + "pageDirectionField": true, + "totalField": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "saveOrderApi": true, + "syncLocation": true, + "toolbar": true, + "toolbarInline": true, + "headerToolbar": true, + "footerToolbar": true, + "perPageAvailable": true, + "messages": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "stopAutoRefreshWhenModalIsOpen": true, + "filterTogglable": true, + "filterDefaultVisible": true, + "syncResponse2Query": true, + "keepItemSelectionOnPageChange": true, + "maxKeepItemSelectionLength": true, + "labelTpl": true, + "loadDataOnce": true, + "loadDataOnceFetchOnFilter": true, + "matchFunc": true, + "expandConfig": true, + "alwaysShowPagination": true, + "parsePrimitiveQuery": true, + "selectable": true, + "multiple": true, + "loadMoreProps": true + }, + "required": [ + "type" + ] + }, + "BaseTableSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "affixHeader": { + "type": "boolean", + "description": "是否固定表头" + }, + "affixFooter": { + "type": "boolean", + "description": "是否固底" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/TableColumn" + }, + "description": "表格的列信息" + }, + "columnsTogglable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "展示列显示开关,自动即:列数量大于或等于5个时自动开启" + }, + "footable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "expand": { + "type": "string", + "enum": [ + "first", + "all", + "none" + ] + }, + "accordion": { + "type": "boolean", + "description": "是否为手风琴模式" + } + }, + "additionalProperties": false + } + ], + "description": "是否开启底部展示功能,适合移动端展示" + }, + "footerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "底部外层 CSS 类名" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "顶部外层 CSS 类名" + }, + "placeholder": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + ], + "description": "占位符" + }, + "showIndex": { + "type": "boolean", + "description": "是否显示序号" + }, + "showFooter": { + "type": "boolean", + "description": "是否显示底部" + }, + "showHeader": { + "type": "boolean", + "description": "是否显示头部" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "数据源:绑定当前环境变量" + }, + "tableClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "表格 CSS 类名" + }, + "title": { + "type": "string", + "description": "标题" + }, + "toolbarClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "工具栏 CSS 类名" + }, + "combineNum": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaExpression" + } + ], + "description": "合并单元格配置,配置数字表示从左到右的多少列自动合并单元格。" + }, + "combineFromIndex": { + "type": "number", + "description": "合并单元格配置,配置从第几列开始合并。" + }, + "prefixRow": { + "type": "array", + "items": { + "$ref": "#/definitions/SchemaObject" + }, + "description": "顶部总结行" + }, + "affixRow": { + "type": "array", + "items": { + "$ref": "#/definitions/SchemaObject" + }, + "description": "底部总结行" + }, + "resizable": { + "type": "boolean", + "description": "是否可调整列宽" + }, + "rowClassNameExpr": { + "type": "string", + "description": "行样式表表达式" + }, + "itemBadge": { + "$ref": "#/definitions/BadgeObject", + "description": "行角标" + }, + "autoGenerateFilter": { + "anyOf": [ + { + "$ref": "#/definitions/AutoGenerateFilterObject" + }, + { + "type": "boolean" + } + ], + "description": "开启查询区域,会根据列元素的searchable属性值,自动生成查询条件表单" + }, + "canAccessSuperData": { + "type": "boolean", + "description": "表格是否可以获取父级数据域值,默认为false" + }, + "autoFillHeight": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "height": { + "type": "number" + }, + "maxHeight": { + "type": "number" + } + }, + "required": [ + "height", + "maxHeight" + ], + "additionalProperties": false + } + ], + "description": "表格自动计算高度" + }, + "tableLayout": { + "type": "string", + "enum": [ + "fixed", + "auto" + ], + "description": "table layout" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi", + "description": "懒加载 API,当行数据中用 defer: true 标记了,则其孩子节点将会用这个 API 来拉取数据。" + }, + "persistKey": { + "type": "string", + "description": "持久化 key" + } + } + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "affixHeader": true, + "affixFooter": true, + "columns": true, + "columnsTogglable": true, + "footable": true, + "footerClassName": true, + "headerClassName": true, + "placeholder": true, + "showIndex": true, + "showFooter": true, + "showHeader": true, + "source": true, + "tableClassName": true, + "title": true, + "toolbarClassName": true, + "combineNum": true, + "combineFromIndex": true, + "prefixRow": true, + "affixRow": true, + "resizable": true, + "rowClassNameExpr": true, + "itemBadge": true, + "autoGenerateFilter": true, + "canAccessSuperData": true, + "autoFillHeight": true, + "tableLayout": true, + "deferApi": true, + "persistKey": true + }, + "description": "Table 表格渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/table" + }, + "TableColumn": { + "anyOf": [ + { + "$ref": "#/definitions/TableColumnWithType" + }, + { + "$ref": "#/definitions/TableColumnObject" + } + ] + }, + "TableColumnWithType": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "$ref": "#/definitions/TableColumnObject", + "additionalProperties": true + } + ] + }, + "TableColumnObject": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "列标题" + }, + "fixed": { + "type": "string", + "enum": [ + "left", + "right", + "none" + ], + "description": "配置是否固定当前列" + }, + "name": { + "type": "string", + "description": "绑定字段名" + }, + "popOver": { + "$ref": "#/definitions/SchemaPopOver", + "description": "配置查看详情功能" + }, + "quickEdit": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "配置快速编辑功能" + }, + "quickEditOnUpdate": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "作为表单项时,可以单独配置编辑时的快速编辑面板。" + }, + "copyable": { + "$ref": "#/definitions/SchemaCopyable", + "description": "配置点击复制功能" + }, + "sortable": { + "type": "boolean", + "description": "配置是否可以排序" + }, + "searchable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "是否可快速搜索" + }, + "toggled": { + "type": "boolean", + "description": "配置是否默认展示" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "列宽度" + }, + "align": { + "type": "string", + "enum": [ + "left", + "right", + "center", + "justify" + ], + "description": "列对齐方式" + }, + "vAlign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom" + ], + "description": "列垂直对齐方式" + }, + "headerAlign": { + "type": "string", + "enum": [ + "left", + "right", + "center", + "justify" + ], + "description": "标题左右对齐方式" + }, + "className": { + "type": "string", + "description": "列样式表" + }, + "classNameExpr": { + "type": "string", + "description": "单元格样式表达式" + }, + "labelClassName": { + "type": "string", + "description": "列头样式表" + }, + "filterable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "options": { + "type": "array", + "items": {} + } + }, + "additionalProperties": false + } + ], + "description": "todo" + }, + "breakpoint": { + "type": "string", + "enum": [ + "*", + "xs", + "sm", + "md", + "lg" + ], + "description": "结合表格的 footable 一起使用。 填写 *、xs、sm、md、lg指定 footable 的触发条件,可以填写多个用空格隔开" + }, + "remark": { + "$ref": "#/definitions/SchemaRemark", + "description": "提示信息" + }, + "value": { + "description": "默认值, 只有在 inputTable 里面才有用" + }, + "unique": { + "type": "boolean", + "description": "是否唯一, 只有在 inputTable 里面才有用" + }, + "canAccessSuperData": { + "type": "boolean", + "description": "表格列单元格是否可以获取父级数据域值,默认为true,该配置对当前列内单元格生效" + }, + "lazyRenderAfter": { + "type": "number", + "description": "当一次性渲染太多列上有用,默认为 100,可以用来提升表格渲染性能", + "default": 100 + }, + "innerStyle": { + "type": "object", + "description": "单元格内部组件自定义样式 style作为单元格自定义样式的配置" + } + }, + "required": [ + "label" + ], + "description": "表格列,不指定类型时默认为文本类型。" + }, + "CRUD2Schema": { + "allOf": [ + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "crud2" + }, + "mode": { + "type": "string", + "const": "cards" + } + }, + "required": [ + "type", + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUD2CardsSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "crud2" + }, + "mode": { + "type": "string", + "const": "list" + } + }, + "required": [ + "type", + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUD2ListSchema" + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "crud2" + }, + "mode": { + "type": "string", + "const": "table2" + } + }, + "required": [ + "type", + "mode" + ] + }, + "then": { + "$ref": "#/definitions/CRUD2TableSchema" + } + } + ] + }, + "CRUD2CardsSchema": { + "type": "object", + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud2" + }, + "testid": true, + "card": true, + "headerClassName": true, + "footerClassName": true, + "itemClassName": true, + "placeholder": true, + "showFooter": true, + "showHeader": true, + "source": true, + "title": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "header": true, + "footer": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "masonryLayout": true, + "valueField": true, + "mode": { + "type": "string", + "const": "cards" + }, + "api": true, + "silentPolling": true, + "interval": true, + "stopAutoRefreshWhen": true, + "loadType": true, + "perPage": true, + "loadDataOnce": true, + "selectable": true, + "multiple": true, + "showSelection": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "saveOrderApi": true, + "syncLocation": true, + "pageField": true, + "perPageField": true, + "name": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "headerToolbar": true, + "headerToolbarClassName": true, + "footerToolbar": true, + "footerToolbarClassName": true, + "syncResponse2Query": true, + "keepItemSelectionOnPageChange": true, + "autoFillHeight": true, + "primaryField": true, + "parsePrimitiveQuery": true, + "pullRefresh": true + }, + "required": [ + "mode", + "type" + ] + }, + "CRUD2ListSchema": { + "type": "object", + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud2" + }, + "testid": true, + "title": true, + "footer": true, + "footerClassName": true, + "header": true, + "headerClassName": true, + "listItem": true, + "source": true, + "showFooter": true, + "showHeader": true, + "placeholder": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "valueField": true, + "size": true, + "itemAction": true, + "showIndexBar": true, + "indexField": true, + "indexBarOffset": true, + "mode": { + "type": "string", + "const": "list" + }, + "loadingConfig": true, + "api": true, + "silentPolling": true, + "interval": true, + "stopAutoRefreshWhen": true, + "loadType": true, + "perPage": true, + "loadDataOnce": true, + "selectable": true, + "multiple": true, + "showSelection": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "saveOrderApi": true, + "syncLocation": true, + "pageField": true, + "perPageField": true, + "name": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "headerToolbar": true, + "headerToolbarClassName": true, + "footerToolbar": true, + "footerToolbarClassName": true, + "syncResponse2Query": true, + "keepItemSelectionOnPageChange": true, + "autoFillHeight": true, + "primaryField": true, + "parsePrimitiveQuery": true, + "pullRefresh": true + }, + "required": [ + "mode", + "type" + ] + }, + "CRUD2TableSchema": { + "type": "object", + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "crud2" + }, + "testid": true, + "title": true, + "source": true, + "columnsTogglable": true, + "columns": true, + "rowSelection": true, + "expandable": true, + "sticky": true, + "loading": true, + "itemBadge": true, + "showBadge": true, + "popOverContainer": true, + "keyField": true, + "childrenColumnName": true, + "rowClassNameExpr": true, + "lineHeight": true, + "bordered": true, + "showHeader": true, + "footer": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "messages": true, + "reload": true, + "actions": true, + "maxKeepItemSelectionLength": true, + "keepItemSelectionOnPageChange": true, + "selectable": true, + "multiple": true, + "primaryField": true, + "tableLayout": true, + "autoFillHeight": true, + "canAccessSuperData": true, + "lazyRenderAfter": true, + "mode": { + "type": "string", + "const": "table2" + }, + "loadingConfig": true, + "api": true, + "silentPolling": true, + "interval": true, + "stopAutoRefreshWhen": true, + "loadType": true, + "perPage": true, + "loadDataOnce": true, + "showSelection": true, + "saveOrderApi": true, + "syncLocation": true, + "pageField": true, + "perPageField": true, + "name": true, + "hideQuickSaveBtn": true, + "autoJumpToTopOnPagerChange": true, + "headerToolbar": true, + "headerToolbarClassName": true, + "footerToolbar": true, + "footerToolbarClassName": true, + "syncResponse2Query": true, + "parsePrimitiveQuery": true, + "pullRefresh": true + }, + "required": [ + "columns", + "source", + "type" + ] + }, + "DateSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "date", + "datetime", + "time", + "static-date", + "static-datetime", + "static-time" + ], + "description": "指定为日期展示类型" + }, + "format": { + "type": "string", + "description": "展示的时间格式,参考 moment 中的格式说明。" + }, + "displayFormat": { + "type": "string", + "description": "展示的时间格式,参考 moment 中的格式说明。(新:同format)" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "valueFormat": { + "type": "string", + "description": "值的时间格式,参考 moment 中的格式说明。" + }, + "fromNow": { + "type": "boolean", + "description": "显示成相对时间,比如1分钟前" + }, + "updateFrequency": { + "type": "number", + "description": "更新频率, 默认为1分钟" + }, + "displayTimeZone": { + "type": "string", + "description": "时区" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "date", + "datetime", + "time", + "static-date", + "static-datetime", + "static-time" + ] + }, + "testid": true, + "format": true, + "displayFormat": true, + "placeholder": true, + "valueFormat": true, + "fromNow": true, + "updateFrequency": true, + "displayTimeZone": true + }, + "required": [ + "type" + ], + "description": "Date 展示渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/date" + }, + "DialogSchema": { + "allOf": [ + { + "$ref": "#/definitions/DialogSchemaBase", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "dialog" + }, + "testid": true, + "inputParams": true, + "actions": true, + "body": true, + "bodyClassName": true, + "closeOnEsc": true, + "closeOnOutside": true, + "name": true, + "size": true, + "height": true, + "width": true, + "title": true, + "header": true, + "headerClassName": true, + "footer": true, + "confirm": true, + "showCloseButton": true, + "showErrorMsg": true, + "showLoading": true, + "overlay": true, + "dialogType": { + "type": "string", + "const": "confirm" + }, + "draggable": true, + "allowFullscreen": true, + "data": true + }, + "required": [ + "type" + ] + }, + "DividerSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "divider" + }, + "lineStyle": { + "type": "string", + "enum": [ + "dashed", + "solid" + ] + }, + "direction": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ] + }, + "color": { + "type": "string" + }, + "rotate": { + "type": "number" + }, + "title": { + "$ref": "#/definitions/SchemaCollection" + }, + "titleClassName": { + "type": "string" + }, + "titlePosition": { + "type": "string", + "enum": [ + "left", + "center", + "right" + ] + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema" + } + ], + "description": "Divider 分割线渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/divider" + }, + "DrawerSchema": { + "allOf": [ + { + "$ref": "#/definitions/DrawerSchemaBase", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "drawer" + }, + "testid": true, + "inputParams": true, + "actions": true, + "body": true, + "bodyClassName": true, + "headerClassName": true, + "footerClassName": true, + "closeOnEsc": true, + "name": true, + "size": true, + "title": true, + "position": true, + "showCloseButton": true, + "width": true, + "height": true, + "header": true, + "footer": true, + "confirm": true, + "resizable": true, + "overlay": true, + "closeOnOutside": true, + "showErrorMsg": true, + "data": true + }, + "required": [ + "type" + ] + }, + "DropdownButtonSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dropdown-button", + "description": "指定为 DropDown Button 类型" + }, + "block": { + "type": "boolean", + "description": "是否独占一行 `display: block`" + }, + "btnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "给 Button 配置 className。" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/definitions/DropdownButton" + }, + "description": "按钮集合,支持分组" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "label": { + "type": "string", + "description": "按钮文字" + }, + "level": { + "type": "string", + "enum": [ + "info", + "success", + "danger", + "warning", + "primary", + "link" + ], + "description": "按钮级别,样式" + }, + "closeOnOutside": { + "type": "boolean", + "description": "点击外部是否关闭" + }, + "closeOnClick": { + "type": "boolean", + "description": "点击内容是否关闭" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "description": "按钮大小" + }, + "align": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "对齐方式" + }, + "iconOnly": { + "type": "boolean", + "description": "是否只显示图标。" + }, + "rightIcon": { + "$ref": "#/definitions/SchemaIcon", + "description": "右侧图标" + }, + "trigger": { + "type": "string", + "enum": [ + "click", + "hover" + ], + "description": "触发条件,默认是 click" + }, + "hideCaret": { + "type": "boolean", + "description": "是否显示下拉按钮" + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹出的下拉按钮放在哪个节点下" + }, + "menuClassName": { + "type": "string", + "description": "菜单 CSS 样式" + }, + "overlayPlacement": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "dropdown-button" + }, + "testid": true, + "block": true, + "btnClassName": true, + "buttons": true, + "body": true, + "label": true, + "level": true, + "closeOnOutside": true, + "closeOnClick": true, + "size": true, + "align": true, + "iconOnly": true, + "rightIcon": true, + "trigger": true, + "hideCaret": true, + "popOverContainerSelector": true, + "menuClassName": true, + "overlayPlacement": true + }, + "required": [ + "type" + ], + "description": "下拉按钮渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/dropdown-button" + }, + "DropdownButton": { + "anyOf": [ + { + "allOf": [ + { + "$ref": "#/definitions/ActionSchemaLoose" + }, + { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/DropdownButton" + } + } + }, + "additionalProperties": true + } + ] + }, + { + "$ref": "#/definitions/DividerSchema" + }, + { + "type": "string", + "const": "divider" + } + ] + }, + "EachSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "each", + "description": "指定为each展示类型" + }, + "name": { + "type": "string", + "description": "关联字段名" + }, + "source": { + "type": "string", + "description": "关联字段名 支持数据映射" + }, + "itemKeyName": { + "type": "string", + "description": "用来控制通过什么字段读取成员数据,考虑到可能多层嵌套 如果名字一样会读取不到上层变量,所以这里可以指定一下", + "default": "item" + }, + "indexKeyName": { + "type": "string", + "description": "用来控制通过什么字段读取序号,考虑到可能多层嵌套 如果名字一样会读取不到上层变量,所以这里可以指定一下", + "default": "index" + }, + "items": { + "$ref": "#/definitions/SchemaCollection" + }, + "placeholder": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "each" + }, + "testid": true, + "name": true, + "source": true, + "itemKeyName": true, + "indexKeyName": true, + "items": true, + "placeholder": true + }, + "required": [ + "type" + ], + "description": "Each 循环功能渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/each" + }, + "GridSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "grid", + "description": "指定为 Grid 格子布局渲染器。" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/GridColumn" + }, + "description": "列集合" + }, + "gap": { + "type": "string", + "enum": [ + "xs", + "sm", + "base", + "none", + "md", + "lg" + ], + "description": "水平间距" + }, + "valign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom", + "between" + ], + "description": "垂直对齐方式" + }, + "align": { + "type": "string", + "enum": [ + "left", + "right", + "between", + "center" + ], + "description": "水平对齐方式" + } + }, + "required": [ + "type", + "columns" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "grid" + }, + "testid": true, + "columns": true, + "gap": true, + "valign": true, + "align": true + }, + "required": [ + "type", + "columns" + ], + "description": "Grid 格子布局渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/grid" + }, + "GridColumn": { + "$ref": "#/definitions/GridColumnObject" + }, + "GridColumnObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "组件唯一 id" + }, + "xs": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "极小屏(<768px)时宽度占比" + }, + "sm": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "小屏时(>=768px)宽度占比" + }, + "md": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "中屏时(>=992px)宽度占比" + }, + "lg": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "大屏时(>=1200px)宽度占比" + }, + "valign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom", + "between" + ], + "description": "垂直对齐方式" + }, + "mode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "horizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection" + }, + "columnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "列类名" + }, + "style": { + "description": "样式" + }, + "wrapperCustomStyle": {}, + "themeCss": {} + }, + "additionalProperties": false + }, + "Grid2DSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "grid-2d", + "description": "指定为 grid-2d 展示类型" + }, + "cols": { + "type": "number", + "description": "列数量,默认是 12" + }, + "width": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "grid 2d 容器宽度,默认是 auto" + }, + "gap": { + "type": [ + "number", + "string" + ], + "description": "格子间距,默认 0,包含行和列" + }, + "gapRow": { + "type": [ + "number", + "string" + ], + "description": "格子行级别的间距,如果不设置就和 gap 一样" + }, + "rowHeight": { + "type": [ + "number", + "string" + ], + "description": "单位行高度,默认 50 px" + }, + "grids": { + "type": "array", + "items": { + "$ref": "#/definitions/Grid" + }, + "description": "每个格子的配置" + } + }, + "required": [ + "type", + "grids" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "grid-2d" + }, + "testid": true, + "cols": true, + "width": true, + "gap": true, + "gapRow": true, + "rowHeight": true, + "grids": true + }, + "required": [ + "type", + "grids" + ], + "description": "二维布局渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/grid-2d" + }, + "Grid": { + "allOf": [ + { + "$ref": "#/definitions/GridObject", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SchemaObjectLoose" + } + ] + }, + "GridObject": { + "type": "object", + "properties": { + "x": { + "type": "number", + "description": "起始横坐标位置,以 1 为起点" + }, + "y": { + "type": "number", + "description": "起始纵坐标位置,以 1 为起点" + }, + "w": { + "type": "number", + "description": "宽度,跨几列" + }, + "h": { + "type": "number", + "description": "高度,跨几行" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "宽度,会影响起始位置对应那一列的宽度" + }, + "height": { + "type": [ + "number", + "string" + ], + "description": "高度,会影响起始位置那一行的高度,设置为 auto 就会自适应" + }, + "align": { + "type": "string", + "enum": [ + "left", + "right", + "center", + "auto" + ], + "description": "水平展示方式,用于内容宽度比 grid 小的情况,默认是 auto 自动撑满" + }, + "valign": { + "type": "string", + "enum": [ + "top", + "bottom", + "middle", + "auto" + ], + "description": "垂直展示方式,用于内容高度比 grid 小的情况,默认是 auto 自动撑满" + }, + "gridClassName": { + "type": "string", + "description": "每个格子最外层容器的 className" + } + }, + "required": [ + "x", + "y", + "w", + "h" + ], + "additionalProperties": false + }, + "HBoxSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "hbox", + "description": "指定为each展示类型" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/HBoxColumn" + } + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "gap": { + "type": "string", + "enum": [ + "xs", + "sm", + "base", + "none", + "md", + "lg" + ], + "description": "水平间距" + }, + "valign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom", + "between" + ], + "description": "垂直对齐方式" + }, + "align": { + "type": "string", + "enum": [ + "left", + "right", + "between", + "center" + ], + "description": "水平对齐方式" + } + }, + "required": [ + "type", + "columns" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "hbox" + }, + "testid": true, + "columns": true, + "subFormMode": true, + "subFormHorizontal": true, + "gap": true, + "valign": true, + "align": true + }, + "required": [ + "type", + "columns" + ], + "description": "Hbox 水平布局渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/hbox" + }, + "HBoxColumn": { + "$ref": "#/definitions/HBoxColumnObject" + }, + "HBoxColumnObject": { + "type": "object", + "properties": { + "columnClassName": { + "type": "string", + "description": "列上 CSS 类名" + }, + "valign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom", + "between" + ], + "description": "垂直对齐方式" + }, + "width": { + "type": [ + "number", + "string" + ], + "description": "宽度" + }, + "height": { + "type": [ + "number", + "string" + ], + "description": "高度" + }, + "style": { + "type": "object", + "description": "其他样式" + }, + "mode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "horizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区" + }, + "visible": { + "type": "boolean", + "description": "是否显示" + }, + "visibleOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否显示表达式" + } + }, + "additionalProperties": false + }, + "IconSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "icon" + }, + "icon": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaTpl" + }, + { + "$ref": "#/definitions/IconCheckedSchema" + } + ], + "description": "按钮类型" + }, + "vendor": { + "type": "string", + "enum": [ + "iconfont", + "fa", + "" + ] + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + } + }, + "required": [ + "type", + "icon" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "icon" + }, + "testid": true, + "icon": true, + "vendor": true, + "badge": true + }, + "required": [ + "type", + "icon" + ], + "description": "Icon 图标渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/icon" + }, + "IconCheckedSchema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "svg": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + }, + "IFrameSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "iframe" + }, + "src": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "页面地址" + }, + "width": { + "type": [ + "number", + "string" + ] + }, + "height": { + "type": [ + "number", + "string" + ] + }, + "allow": { + "type": "string" + }, + "name": { + "type": "string" + }, + "referrerpolicy": { + "type": "string", + "enum": [ + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ] + }, + "sandbox": { + "type": "string" + } + }, + "required": [ + "type", + "src" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "iframe" + }, + "testid": true, + "src": true, + "width": true, + "height": true, + "allow": true, + "name": true, + "referrerpolicy": true, + "sandbox": true + }, + "required": [ + "type", + "src" + ], + "description": "IFrame 渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/iframe" + }, + "ImageSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "image", + "static-image" + ], + "description": "指定为图片展示类型" + }, + "defaultImage": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "默认图片地址" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "图片标题" + }, + "name": { + "type": "string", + "description": "关联字段名,也可以直接配置 src" + }, + "imageCaption": { + "$ref": "#/definitions/SchemaTpl", + "description": "图片描述信息" + }, + "src": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "图片地址,如果配置了 name,这个属性不用配置。" + }, + "originalSrc": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "大图地址,不设置用 src" + }, + "enlargeAble": { + "type": "boolean", + "description": "是否启动放大功能。" + }, + "enlargeWithGallary": { + "type": "boolean", + "description": "放大时是否显示图片集" + }, + "alt": { + "type": "string", + "description": "图片无法显示时的替换文本" + }, + "height": { + "type": "number", + "description": "高度" + }, + "width": { + "type": "number", + "description": "宽度" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "外层 css 类名" + }, + "innerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "组件内层 css 类名" + }, + "imageClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "图片 css 类名" + }, + "thumbClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "图片缩略图外层 css 类名" + }, + "imageGallaryClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "放大详情图 CSS 类名" + }, + "caption": { + "$ref": "#/definitions/SchemaTpl", + "description": "图片说明文字" + }, + "imageMode": { + "type": "string", + "enum": [ + "thumb", + "original" + ], + "description": "图片展示模式,默认为缩略图模式、可以配置成原图模式" + }, + "thumbMode": { + "type": "string", + "enum": [ + "w-full", + "h-full", + "contain", + "cover" + ], + "description": "预览图模式" + }, + "thumbRatio": { + "type": "string", + "enum": [ + "1:1", + "4:3", + "16:9" + ], + "description": "预览图比率" + }, + "href": { + "$ref": "#/definitions/SchemaTpl", + "description": "链接地址" + }, + "blank": { + "type": "boolean", + "description": "是否新窗口打开" + }, + "htmlTarget": { + "type": "string", + "description": "链接的 target" + }, + "showToolbar": { + "type": "boolean", + "description": "是否展示图片工具栏" + }, + "toolbarActions": { + "type": "array", + "items": { + "$ref": "#/definitions/ImageToolbarAction" + }, + "description": "工具栏配置" + }, + "hoverMode": { + "type": "string", + "enum": [ + "hover-slide", + "pull-top", + "scale-center", + "scale-top", + "text-style-1", + "text-style-2", + "text-style-3", + "text-style-4", + "text-style-5", + "text-style-6", + "text-style-7" + ], + "description": "鼠标悬浮时的展示状态(对应AIpage的文字6,9,10不存在)" + }, + "sortType": { + "type": "string", + "description": "图集组件传入的排序方式" + }, + "fontStyle": { + "type": "object", + "properties": { + "fontSize": { + "type": "string" + }, + "fontWeight": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "color": { + "type": "string" + } + }, + "additionalProperties": false, + "description": "描述文字样式" + }, + "maskColor": { + "type": "string", + "description": "蒙层颜色" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "image", + "static-image" + ] + }, + "testid": true, + "defaultImage": true, + "title": true, + "name": true, + "imageCaption": true, + "src": true, + "originalSrc": true, + "enlargeAble": true, + "enlargeWithGallary": true, + "alt": true, + "height": true, + "width": true, + "innerClassName": true, + "imageClassName": true, + "thumbClassName": true, + "imageGallaryClassName": true, + "caption": true, + "imageMode": true, + "thumbMode": true, + "thumbRatio": true, + "href": true, + "blank": true, + "htmlTarget": true, + "showToolbar": true, + "toolbarActions": true, + "hoverMode": true, + "sortType": true, + "fontStyle": true, + "maskColor": true + }, + "required": [ + "type" + ], + "description": "图片展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/image" + }, + "ImageToolbarAction": { + "type": "object", + "properties": { + "key": { + "type": "string", + "enum": [ + "ROTATE_RIGHT", + "ROTATE_LEFT", + "ZOOM_IN", + "ZOOM_OUT", + "SCALE_ORIGIN" + ] + }, + "label": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "iconClassName": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "key" + ], + "additionalProperties": false + }, + "ImagesSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "images", + "static-images" + ], + "description": "指定为图片集渲染器" + }, + "defaultImage": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "默认图片地址" + }, + "placeholder": { + "type": "string", + "description": "列表为空时显示" + }, + "delimiter": { + "type": "string", + "description": "配置值的连接符", + "default": "," + }, + "thumbMode": { + "type": "string", + "enum": [ + "w-full", + "h-full", + "contain", + "cover" + ], + "description": "预览图模式" + }, + "thumbRatio": { + "type": "string", + "enum": [ + "1:1", + "4:3", + "16:9" + ], + "description": "预览图比率" + }, + "name": { + "type": "string", + "description": "关联字段名,也可以直接配置 src" + }, + "value": {}, + "source": { + "type": "string" + }, + "options": { + "type": "array", + "items": {} + }, + "src": { + "type": "string", + "description": "图片地址,默认读取数据中的 image 属性,如果不是请配置 ,如 ${imageUrl}" + }, + "originalSrc": { + "type": "string", + "description": "大图地址,不设置用 src 属性,如果不是请配置,如:${imageOriginUrl}" + }, + "enlargeAble": { + "type": "boolean", + "description": "是否启动放大功能。" + }, + "enlargetWithImages": { + "type": "boolean", + "description": "放大时是否显示图片集" + }, + "showDimensions": { + "type": "boolean", + "description": "是否显示尺寸。" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "外层 CSS 类名" + }, + "listClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "列表 CSS 类名" + }, + "imageGallaryClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "放大详情图 CSS 类名" + }, + "showToolbar": { + "type": "boolean", + "description": "是否展示图片工具栏" + }, + "toolbarActions": { + "type": "array", + "items": { + "$ref": "#/definitions/ImageToolbarAction" + }, + "description": "工具栏配置" + }, + "displayMode": { + "type": "string", + "enum": [ + "thumb", + "full" + ], + "description": "展示模式,支持缩略图模式(thumb)和大图模式(full)" + }, + "currentIndex": { + "type": "number", + "description": "当前展示图片索引" + }, + "fullThumbMode": { + "type": "string", + "enum": [ + "cover", + "contain" + ], + "description": "大图模式下的缩放模式" + }, + "sortType": { + "type": "string", + "enum": [ + "sm-ss-sss-m", + "sss-ss-ms-m", + "sms-ss-sms-m", + "sm-ss-sss-ss", + "ms-ss-sss-ss", + "sss-ss-sm-ss", + "mss-ss-ssm-ss", + "sss-ss-mm-ss", + "even-${number}-${number}" + ], + "description": "排列方式 类命名方式按照上右下左四个边命名,l=2m,m=2s,最小单位为s 每条边的顺序都是从上到下,从左到右。" + }, + "width": { + "type": "string", + "description": "宽度(有sortType时生效)" + }, + "height": { + "type": "string", + "description": "高度(有sortType时生效)" + }, + "hoverMode": { + "type": "string", + "enum": [ + "hover-slide", + "pull-top", + "scale-center", + "scale-top", + "text-style-1", + "text-style-2", + "text-style-3", + "text-style-4", + "text-style-5", + "text-style-6", + "text-style-7" + ], + "description": "鼠标悬浮时的展示状态(对应AIpage的文字6,9,10不存在)" + }, + "fontStyle": { + "type": "object", + "properties": { + "fontSize": { + "type": "string" + }, + "fontWeight": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "color": { + "type": "string" + } + }, + "additionalProperties": false, + "description": "描述文字样式" + }, + "maskColor": { + "type": "string", + "description": "蒙层颜色" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "images", + "static-images" + ] + }, + "testid": true, + "defaultImage": true, + "placeholder": true, + "delimiter": true, + "thumbMode": true, + "thumbRatio": true, + "name": true, + "value": true, + "source": true, + "options": true, + "src": true, + "originalSrc": true, + "enlargeAble": true, + "enlargetWithImages": true, + "showDimensions": true, + "listClassName": true, + "imageGallaryClassName": true, + "showToolbar": true, + "toolbarActions": true, + "displayMode": true, + "currentIndex": true, + "fullThumbMode": true, + "sortType": true, + "width": true, + "height": true, + "hoverMode": true, + "fontStyle": true, + "maskColor": true + }, + "required": [ + "type" + ], + "description": "图片集展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/images" + }, + "JsonSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "json", + "static-json" + ], + "description": "指定为Json展示类型" + }, + "value": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "array", + "items": {} + } + ], + "description": "要展示的 JSON 数据" + }, + "levelExpand": { + "type": "number", + "description": "默认展开的级别" + }, + "source": { + "type": "string", + "description": "支持从数据链取值" + }, + "mutable": { + "type": "boolean", + "description": "是否可修改" + }, + "displayDataTypes": { + "type": "boolean", + "description": "是否显示数据类型" + }, + "enableClipboard": { + "type": "boolean", + "description": "是否可复制" + }, + "iconStyle": { + "type": "string", + "enum": [ + "square", + "circle", + "triangle" + ], + "description": "图标风格" + }, + "quotesOnKeys": { + "type": "boolean", + "description": "是否显示键的引号" + }, + "sortKeys": { + "type": "boolean", + "description": "是否为键排序" + }, + "ellipsisThreshold": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "boolean", + "const": false + } + ], + "description": "设置字符串的最大展示长度,超出长度阈值的字符串将被截断,点击value可切换字符串展示方式,默认为false" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "json", + "static-json" + ] + }, + "testid": true, + "value": true, + "levelExpand": true, + "source": true, + "mutable": true, + "displayDataTypes": true, + "enableClipboard": true, + "iconStyle": true, + "quotesOnKeys": true, + "sortKeys": true, + "ellipsisThreshold": true + }, + "required": [ + "type" + ], + "description": "JSON 数据展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/json" + }, + "LinkSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "link", + "description": "指定为 link 链接展示控件" + }, + "blank": { + "type": "boolean", + "description": "是否新窗口打开。" + }, + "href": { + "type": "string", + "description": "链接地址" + }, + "body": { + "$ref": "#/definitions/SchemaTpl", + "description": "链接内容,如果不配置将显示链接地址。" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "htmlTarget": { + "type": "string", + "description": "a标签原生target属性" + }, + "icon": { + "type": "string", + "description": "图标" + }, + "rightIcon": { + "type": "string", + "description": "右侧图标" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "link" + }, + "testid": true, + "blank": true, + "href": true, + "body": true, + "badge": true, + "htmlTarget": true, + "icon": true, + "rightIcon": true + }, + "required": [ + "type" + ], + "description": "Link 链接展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/link" + }, + "ListSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseListSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "list", + "static-list" + ] + }, + "testid": true, + "title": true, + "footer": true, + "footerClassName": true, + "header": true, + "headerClassName": true, + "listItem": true, + "source": true, + "showFooter": true, + "showHeader": true, + "placeholder": true, + "hideCheckToggler": true, + "affixHeader": true, + "affixFooter": true, + "itemCheckableOn": true, + "itemDraggableOn": true, + "checkOnItemClick": true, + "valueField": true, + "size": true, + "itemAction": true, + "showIndexBar": true, + "indexField": true, + "indexBarOffset": true + }, + "required": [ + "type" + ] + }, + "MappingSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "map", + "mapping" + ], + "description": "指定为映射展示控件" + }, + "name": { + "type": "string", + "description": "关联字段名。" + }, + "map": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SchemaTpl" + }, + "description": "配置映射规则,值可以使用模板语法。当 key 为 * 时表示 else,也就是说值没有映射到任何规则时用 * 对应的值展示。" + }, + "valueField": { + "type": "string", + "description": "map或source为对象数组时,作为value值的字段名" + }, + "labelField": { + "type": "string", + "description": "map或source为对象数组时,作为label值的字段名" + }, + "itemSchema": { + "$ref": "#/definitions/SchemaCollection", + "description": "自定义渲染映射值,支持html或schema" + }, + "source": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaApi" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "如果想远程拉取字典,请配置 source 为接口。" + }, + "placeholder": { + "type": "string", + "description": "占位符" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "map", + "mapping" + ] + }, + "testid": true, + "name": true, + "map": true, + "valueField": true, + "labelField": true, + "itemSchema": true, + "source": true, + "placeholder": true + }, + "required": [ + "type" + ], + "description": "Mapping 映射展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/mapping" + }, + "NavSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "nav", + "description": "指定为 Nav 导航渲染器" + }, + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/NavItemSchema" + }, + "description": "链接地址集合" + }, + "indentSize": { + "type": "number", + "default": 16 + }, + "source": { + "$ref": "#/definitions/SchemaApi", + "description": "可以通过 API 拉取。" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi", + "description": "懒加载 api,如果不配置复用 source 接口。" + }, + "stacked": { + "type": "boolean", + "enum": [ + true, + false + ], + "description": "true 为垂直排列,false 为水平排列类似如 tabs。" + }, + "itemActions": { + "$ref": "#/definitions/SchemaCollection", + "description": "更多操作菜单列表" + }, + "draggable": { + "type": "boolean", + "description": "可拖拽" + }, + "saveOrderApi": { + "$ref": "#/definitions/SchemaApi", + "description": "保存排序的 api" + }, + "itemBadge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "dragOnSameLevel": { + "type": "boolean", + "description": "仅允许同层级拖拽" + }, + "overflow": { + "$ref": "#/definitions/NavOverflow", + "description": "横向导航时自动收纳配置" + }, + "level": { + "type": "number", + "description": "最多展示多少层级" + }, + "defaultOpenLevel": { + "type": "number", + "description": "默认展开层级 小于等于该层数的节点默认全部打开" + }, + "showKey": { + "type": "string", + "description": "控制仅展示指定key菜单下的子菜单项" + }, + "collapsed": { + "type": "boolean", + "description": "控制菜单缩起" + }, + "mode": { + "type": "string", + "enum": [ + "panel", + "float", + "inline" + ], + "description": "垂直模式 非折叠状态下 控制菜单打开方式" + }, + "expandIcon": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "自定义展开图标" + }, + "expandPosition": { + "type": "string", + "description": "自定义展开图标位置 默认在前面 before after" + }, + "themeColor": { + "type": "string", + "enum": [ + "light", + "dark" + ], + "description": "主题配色 默认light" + }, + "accordion": { + "type": "boolean", + "description": "手风琴展开 仅垂直inline模式支持" + }, + "popupClassName": { + "type": "string", + "description": "子菜单项展开浮层样式" + }, + "searchable": { + "type": "boolean", + "description": "是否开启搜索" + }, + "searchConfig": { + "type": "object", + "properties": { + "className": { + "type": "string", + "description": "搜索框外层CSS样式类" + }, + "matchFunc": { + "anyOf": [ + { + "type": "string" + }, + {} + ], + "description": "搜索匹配函数" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "mini": { + "type": "boolean", + "description": "是否为 Mini 样式。" + }, + "enhance": { + "type": "boolean", + "description": "是否为加强样式" + }, + "clearable": { + "type": "boolean", + "description": "是否可清除" + }, + "searchImediately": { + "type": "boolean", + "description": "是否立马搜索。" + }, + "valueField": { + "type": "string", + "description": "指定唯一标识字段" + } + }, + "additionalProperties": false, + "description": "搜索框相关配置" + } + }, + "required": [ + "type", + "indentSize" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "nav" + }, + "testid": true, + "links": true, + "indentSize": true, + "source": true, + "deferApi": true, + "stacked": true, + "itemActions": true, + "draggable": true, + "saveOrderApi": true, + "itemBadge": true, + "badge": true, + "dragOnSameLevel": true, + "overflow": true, + "level": true, + "defaultOpenLevel": true, + "showKey": true, + "collapsed": true, + "mode": true, + "expandIcon": true, + "expandPosition": true, + "themeColor": true, + "accordion": true, + "popupClassName": true, + "searchable": true, + "searchConfig": true + }, + "required": [ + "type", + "indentSize" + ], + "description": "Nav 导航渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/nav" + }, + "NavItemSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "label": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "文字说明" + }, + "icon": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaIcon" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/IconItemSchema" + } + } + ], + "description": "图标类名,参考 fontawesome 4。" + }, + "to": { + "$ref": "#/definitions/SchemaUrlPath" + }, + "target": { + "type": "string" + }, + "unfolded": { + "type": "boolean" + }, + "active": { + "type": "boolean" + }, + "defer": { + "type": "boolean" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/NavItemSchema" + } + }, + "key": { + "type": "string" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + }, + "disabledTip": { + "type": "string" + }, + "className": { + "type": "string", + "description": "容器 css 类名" + }, + "mode": { + "type": "string" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "label": true, + "icon": true, + "to": true, + "target": true, + "unfolded": true, + "active": true, + "defer": true, + "deferApi": true, + "children": true, + "key": true, + "disabledTip": true, + "mode": true + } + }, + "IconItemSchema": { + "type": "object", + "properties": { + "icon": { + "$ref": "#/definitions/SchemaIcon" + }, + "position": { + "type": "string" + } + }, + "required": [ + "position" + ], + "additionalProperties": false + }, + "NavOverflow": { + "type": "object", + "properties": { + "enable": { + "type": "boolean", + "description": "是否开启响应式收纳" + }, + "overflowLabel": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "菜单触发按钮的文字" + }, + "overflowIndicator": { + "$ref": "#/definitions/SchemaIcon", + "description": "菜单触发按钮的图标", + "default": "fa fa-ellipsis-h" + }, + "overflowClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "菜单触发按钮CSS类名" + }, + "overflowPopoverClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "Popover浮层CSS类名" + }, + "overflowListClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "菜单外层CSS类名" + }, + "maxVisibleCount": { + "type": "number", + "description": "导航横向布局时,开启开启响应式收纳后最大可显示数量,超出此数量的导航将被收纳到下拉菜单中" + }, + "wrapperComponent": { + "type": "string", + "description": "包裹导航的外层标签名,可以使用其他标签渲染", + "default": "ul" + }, + "itemWidth": { + "type": "number", + "description": "导航项目宽度", + "default": 160 + }, + "overflowSuffix": { + "$ref": "#/definitions/SchemaCollection", + "description": "导航列表后缀节点" + }, + "style": { + "description": "自定义样式" + }, + "mode": { + "type": "string", + "enum": [ + "popup", + "swipe" + ], + "description": "导航超出后响应式收纳方案。", + "default": "\"popup\"\npopup 导航被收纳到下拉菜单中\nswipe 导航展示在一个可左右滑动的菜单中,通过左右箭头滚动查看。只在横向布局有效" + } + }, + "required": [ + "enable" + ], + "additionalProperties": false + }, + "OperationSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "operation", + "description": "指定为操作栏" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + } + } + }, + "required": [ + "type", + "buttons" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "operation" + }, + "testid": true, + "placeholder": true, + "buttons": true + }, + "required": [ + "type", + "buttons" + ], + "description": "操作栏渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/operation" + }, + "PaginationSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pagination" + }, + "layout": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "通过控制layout属性的顺序,调整分页结构 total,perPage,pager,go", + "default": "pager" + }, + "maxButtons": { + "type": "number", + "description": "最多显示多少个分页按钮。", + "default": 5 + }, + "mode": { + "$ref": "#/definitions/MODE_TYPE", + "description": "模式,默认normal,如果只想简单显示可以配置成 `simple`。", + "default": "normal" + }, + "activePage": { + "type": "number", + "description": "当前页数" + }, + "total": { + "type": "number", + "description": "总条数" + }, + "perPage": { + "type": "number", + "description": "每页显示条数", + "default": 10 + }, + "showPerPage": { + "type": "boolean", + "description": "是否展示分页切换,也同时受layout控制", + "default": false + }, + "perPageAvailable": { + "type": "array", + "items": { + "type": "number" + }, + "description": "指定每页可以显示多少条", + "default": [ + 10, + 20, + 50, + 100 + ] + }, + "showPageInput": { + "type": "boolean", + "description": "是否显示快速跳转输入框", + "default": false + }, + "disabled": { + "type": "boolean", + "description": "是否禁用", + "default": false + }, + "hasNext": { + "type": "boolean" + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹层挂载节点", + "default": false + } + }, + "required": [ + "type", + "activePage" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "pagination" + }, + "testid": true, + "layout": true, + "maxButtons": true, + "mode": true, + "activePage": true, + "total": true, + "perPage": true, + "showPerPage": true, + "perPageAvailable": true, + "showPageInput": true, + "hasNext": true, + "popOverContainerSelector": true + }, + "required": [ + "type", + "activePage" + ] + }, + "MODE_TYPE": { + "type": "string", + "enum": [ + "simple", + "normal" + ] + }, + "PaginationWrapperSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "pagination-wrapper", + "description": "指定为分页容器功能性渲染器" + }, + "showPageInput": { + "type": "boolean", + "description": "是否显示快速跳转输入框" + }, + "maxButtons": { + "type": "number", + "description": "最多显示多少个分页按钮。", + "default": 5 + }, + "inputName": { + "type": "string", + "description": "输入字段名", + "default": "items" + }, + "outputName": { + "type": "string", + "description": "输出字段名", + "default": "items" + }, + "perPage": { + "type": "number", + "description": "每页显示多条数据。", + "default": 10 + }, + "position": { + "type": "string", + "enum": [ + "top", + "bottom", + "none" + ], + "description": "分页显示位置,如果配置为 none 则需要自己在内容区域配置 pagination 组件,否则不显示。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "pagination-wrapper" + }, + "testid": true, + "showPageInput": true, + "maxButtons": true, + "inputName": true, + "outputName": true, + "perPage": true, + "position": true, + "body": true + }, + "required": [ + "type" + ], + "description": "分页容器功能性渲染器。详情请见:https://aisuda.bce.baidu.com/amis/zh-CN/components/pagination-wrapper" + }, + "PanelSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "panel", + "description": "指定为Panel渲染器。" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "按钮集合" + }, + "actionsClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "按钮集合外层类名" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 Body 容器 className" + }, + "footer": { + "$ref": "#/definitions/SchemaCollection", + "description": "底部内容区域" + }, + "footerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 footer 容器 className" + }, + "footerWrapClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "footer 和 actions 外层 div 类名。" + }, + "header": { + "$ref": "#/definitions/SchemaCollection", + "description": "头部内容, 和 title 二选一。" + }, + "headerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 header 容器 className" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "Panel 标题" + }, + "affixFooter": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "const": "always" + } + ], + "description": "固定底部, 想要把按钮固定在底部的时候配置。" + }, + "collapsible": { + "type": "boolean", + "description": "\\ 可折叠。先简单实现一下" + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "headerControlClassName": { + "type": "string", + "description": "外观配置的classname" + }, + "bodyControlClassName": { + "type": "string" + }, + "actionsControlClassName": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "panel" + }, + "testid": true, + "actions": true, + "actionsClassName": true, + "body": true, + "bodyClassName": true, + "footer": true, + "footerClassName": true, + "footerWrapClassName": true, + "header": true, + "headerClassName": true, + "title": true, + "affixFooter": true, + "collapsible": true, + "subFormMode": true, + "subFormHorizontal": true, + "headerControlClassName": true, + "bodyControlClassName": true, + "actionsControlClassName": true + }, + "required": [ + "type" + ], + "description": "Panel渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/panel" + }, + "PlainSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "plain", + "text" + ], + "description": "指定为模板渲染器。\n\n文档:https://aisuda.bce.baidu.com/amis/zh-CN/docs/concepts/template" + }, + "tpl": { + "$ref": "#/definitions/SchemaTpl" + }, + "text": { + "$ref": "#/definitions/SchemaTpl" + }, + "inline": { + "type": "boolean", + "description": "是否内联显示?" + }, + "placeholder": { + "type": "string", + "description": "占位符", + "deprecated": "-" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "plain", + "text" + ] + }, + "testid": true, + "tpl": true, + "text": true, + "inline": true, + "placeholder": true + }, + "required": [ + "type" + ], + "description": "Plain 纯文本渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/plain" + }, + "ProgressSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "progress" + }, + "name": { + "type": "string", + "description": "关联字段名" + }, + "value": { + "type": "number", + "description": "进度值" + }, + "mode": { + "type": "string", + "enum": [ + "line", + "circle", + "dashboard" + ], + "description": "进度条类型" + }, + "progressClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "进度条 CSS 类名" + }, + "map": { + "$ref": "#/definitions/ColorMapType", + "description": "配置不同的值段,用不同的样式提示用户" + }, + "showLabel": { + "type": "boolean", + "description": "是否显示值" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "stripe": { + "type": "boolean", + "description": "是否显示背景间隔" + }, + "animate": { + "type": "boolean", + "description": "是否显示动画(只有在开启的时候才能看出来)" + }, + "strokeWidth": { + "type": "number", + "description": "进度条线的宽度" + }, + "gapDegree": { + "type": "number", + "description": "仪表盘进度条缺口角度,可取值 0 ~ 295" + }, + "gapPosition": { + "type": "string", + "enum": [ + "top", + "bottom", + "left", + "right" + ], + "description": "仪表盘进度条缺口位置" + }, + "valueTpl": { + "type": "string", + "description": "内容的模板函数" + }, + "threshold": { + "anyOf": [ + { + "type": "object", + "properties": { + "value": { + "$ref": "#/definitions/SchemaTpl" + }, + "color": { + "type": "string" + } + }, + "required": [ + "value" + ], + "additionalProperties": false + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "$ref": "#/definitions/SchemaTpl" + }, + "color": { + "type": "string" + } + }, + "required": [ + "value" + ], + "additionalProperties": false + } + } + ], + "description": "阈值" + }, + "showThresholdText": { + "type": "boolean", + "description": "是否显示阈值数值" + } + }, + "required": [ + "type", + "value", + "mode" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "progress" + }, + "testid": true, + "name": true, + "value": true, + "mode": true, + "progressClassName": true, + "map": true, + "showLabel": true, + "placeholder": true, + "stripe": true, + "animate": true, + "strokeWidth": true, + "gapDegree": true, + "gapPosition": true, + "valueTpl": true, + "threshold": true, + "showThresholdText": true + }, + "required": [ + "type", + "value", + "mode" + ], + "description": "进度展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/progress" + }, + "ColorMapType": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "type": "number" + }, + "color": { + "type": "string" + } + }, + "required": [ + "value", + "color" + ], + "additionalProperties": false + } + }, + { + "type": "string" + } + ] + }, + "QRCodeSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "qrcode", + "qr-code" + ] + }, + "name": { + "type": "string", + "description": "关联字段名。" + }, + "qrcodeClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "css 类名" + }, + "codeSize": { + "type": "number", + "description": "二维码的宽高大小,默认 128", + "default": 128 + }, + "backgroundColor": { + "type": "string", + "description": "背景色" + }, + "foregroundColor": { + "type": "string", + "description": "前景色" + }, + "level": { + "type": "string", + "enum": [ + "L", + "M", + "Q", + "H" + ], + "description": "二维码复杂级别" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "imageSettings": { + "$ref": "#/definitions/QRCodeImageSettings", + "description": "图片配置" + }, + "mode": { + "type": "string", + "enum": [ + "canvas", + "svg" + ], + "description": "渲染模式" + }, + "eyeType": { + "type": "string", + "enum": [ + "default", + "circle", + "rounded" + ], + "description": "码眼类型" + }, + "eyeBorderColor": { + "type": "string", + "description": "码眼边框颜色", + "default": "#000000" + }, + "eyeBorderSize": { + "type": "string", + "enum": [ + "default", + "sm", + "xs" + ], + "description": "码眼边框大小", + "default": "default" + }, + "eyeInnerColor": { + "type": "string", + "description": "码眼内部颜色", + "default": "#000000" + }, + "pointType": { + "type": "string", + "enum": [ + "default", + "circle" + ], + "description": "码点类型" + }, + "pointSize": { + "type": "string", + "enum": [ + "default", + "sm", + "xs" + ], + "description": "码点大小", + "default": "default" + }, + "pointSizeRandom": { + "type": "boolean", + "description": "码点大小随机", + "default": false + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "qrcode", + "qr-code" + ] + }, + "testid": true, + "name": true, + "qrcodeClassName": true, + "codeSize": true, + "backgroundColor": true, + "foregroundColor": true, + "level": true, + "placeholder": true, + "imageSettings": true, + "mode": true, + "eyeType": true, + "eyeBorderColor": true, + "eyeBorderSize": true, + "eyeInnerColor": true, + "pointType": true, + "pointSize": true, + "pointSizeRandom": true + }, + "required": [ + "type" + ], + "description": "二维码展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/qrcode" + }, + "QRCodeImageSettings": { + "type": "object", + "properties": { + "src": { + "type": "string" + }, + "height": { + "type": "number" + }, + "width": { + "type": "number" + }, + "excavate": { + "type": "boolean" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": [ + "src", + "height", + "width", + "excavate" + ], + "additionalProperties": false + }, + "SearchBoxSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "search-box", + "description": "指定为搜索框。\n\n文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/search-box" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "外层 css 类名" + }, + "name": { + "type": "string", + "description": "关键字名字。", + "default": "keywords" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "mini": { + "type": "boolean", + "description": "是否为 Mini 样式。" + }, + "enhance": { + "type": "boolean", + "description": "是否为加强样式" + }, + "clearable": { + "type": "boolean", + "description": "是否可清除" + }, + "searchImediately": { + "type": "boolean", + "description": "是否立马搜索。" + }, + "clearAndSubmit": { + "type": "boolean", + "description": "是否开启清空内容后立即重新搜索" + }, + "loading": { + "type": "boolean", + "description": "是否处于加载状态" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "search-box" + }, + "testid": true, + "name": true, + "placeholder": true, + "mini": true, + "enhance": true, + "clearable": true, + "searchImediately": true, + "clearAndSubmit": true, + "loading": true + }, + "required": [ + "type" + ], + "description": "搜索框渲染器" + }, + "ServiceSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "service", + "description": "指定为 Service 数据拉取控件。" + }, + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "ws": { + "type": "string", + "description": "WebScocket 地址,用于实时获取数据" + }, + "dataProvider": { + "$ref": "#/definitions/ComposedDataProvider", + "description": "通过调用外部函数来获取数据" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "fetchOn": { + "$ref": "#/definitions/SchemaExpression", + "deprecated": "改成 api 的 sendOn。" + }, + "initFetch": { + "type": "boolean", + "description": "是否默认就拉取?" + }, + "initFetchOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否默认就拉取?通过表达式来决定.", + "deprecated": "改成 api 的 sendOn。" + }, + "schemaApi": { + "$ref": "#/definitions/SchemaApi", + "description": "用来获取远程 Schema 的 api" + }, + "initFetchSchema": { + "type": "boolean", + "description": "是否默认加载 schemaApi" + }, + "initFetchSchemaOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "用表达式来配置。", + "deprecated": "改成 api 的 sendOn。" + }, + "interval": { + "type": "number", + "description": "是否轮询拉取" + }, + "silentPolling": { + "type": "boolean", + "description": "是否静默拉取" + }, + "stopAutoRefreshWhen": { + "$ref": "#/definitions/SchemaExpression", + "description": "关闭轮询的条件。" + }, + "messages": { + "$ref": "#/definitions/SchemaMessage" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "showErrorMsg": { + "type": "boolean", + "description": "是否以Alert的形式显示api接口响应的错误信息,默认展示" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "service" + }, + "testid": true, + "api": true, + "ws": true, + "dataProvider": true, + "body": true, + "fetchOn": true, + "initFetch": true, + "initFetchOn": true, + "schemaApi": true, + "initFetchSchema": true, + "initFetchSchemaOn": true, + "interval": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "messages": true, + "name": true, + "showErrorMsg": true + }, + "required": [ + "type" + ], + "description": "Service 服务类控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/service" + }, + "ComposedDataProvider": { + "anyOf": [ + { + "$ref": "#/definitions/DataProvider" + }, + { + "$ref": "#/definitions/DataProviderCollection" + } + ] + }, + "DataProvider": { + "type": "string" + }, + "DataProviderCollection": { + "type": "object", + "properties": { + "inited": { + "$ref": "#/definitions/DataProvider" + }, + "onApiFetched": { + "$ref": "#/definitions/DataProvider" + }, + "onSchemaApiFetched": { + "$ref": "#/definitions/DataProvider" + }, + "onWsFetched": { + "$ref": "#/definitions/DataProvider" + } + }, + "additionalProperties": false + }, + "SparkLineSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sparkline" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "css 类名" + }, + "name": { + "type": "string", + "description": "关联数据变量。" + }, + "width": { + "type": "number", + "description": "宽度", + "default": 100 + }, + "height": { + "type": "number", + "description": "高度", + "default": 50 + }, + "clickAction": { + "$ref": "#/definitions/ActionSchema", + "description": "点击行为" + }, + "placeholder": { + "type": "string", + "description": "空数据时显示的内容" + }, + "value": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "value": { + "type": "number" + }, + "label": { + "type": "string" + } + }, + "required": [ + "value" + ], + "additionalProperties": false + } + ] + } + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "sparkline" + }, + "testid": true, + "name": true, + "width": true, + "height": true, + "clickAction": true, + "placeholder": true, + "value": true + }, + "required": [ + "type" + ] + }, + "StatusSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "status", + "description": "指定为状态展示控件" + }, + "placeholder": { + "type": "string", + "description": "占位符", + "default": "-" + }, + "map": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "状态图标映射关系", + "deprecated": "已废弃,2.8.0 废弃,兼容中", + "default": "{\n0: 'svg-fail',\n1: 'svg-success',\nsuccess: 'svg-success',\npending: 'rolling',\nfail: 'svg-fail',\nqueue: 'svg-warning',\nschedule: 'svg-schedule'\n}" + }, + "labelMap": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "文字映射关系", + "deprecated": "已废弃,2.8.0 废弃,兼容中", + "default": { + "success": "成功", + "pending": "运行中", + "fail": "失败", + "queue": "排队中", + "schedule": "调度中" + } + }, + "source": { + "$ref": "#/definitions/StatusSource", + "description": "新版配置映射源的字段 可以兼容新版icon并且配置颜色 2.8.0 新增" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "status" + }, + "testid": true, + "placeholder": true, + "map": true, + "labelMap": true, + "source": true + }, + "required": [ + "type" + ], + "description": "状态展示控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/status" + }, + "StatusSource": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "icon": { + "type": "string" + }, + "label": { + "type": "string" + }, + "color": { + "type": "string" + }, + "className": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "SpinnerSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "spinner", + "description": "组件类型" + }, + "show": { + "type": "boolean", + "description": "控制Spinner显示与隐藏" + }, + "className": { + "type": "string", + "description": "自定义spinner的class" + }, + "spinnerClassName": { + "type": "string", + "description": "spin图标位置包裹元素的自定义class" + }, + "spinnerWrapClassName": { + "type": "string", + "description": "作为容器使用时最外层元素的class" + }, + "mode": { + "type": "string", + "deprecated": "已废弃,没有作用" + }, + "size": { + "type": "string", + "enum": [ + "sm", + "lg", + "" + ], + "description": "spinner Icon 大小" + }, + "icon": { + "type": "string", + "description": "自定义icon" + }, + "tip": { + "type": "string", + "description": "spinner文案" + }, + "tipPlacement": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ], + "description": "spinner文案位置" + }, + "delay": { + "type": "number", + "description": "延迟显示" + }, + "overlay": { + "type": "boolean", + "description": "是否显示遮罩层" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "作为容器使用时内容" + } + }, + "required": [ + "type", + "show" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "spinner" + }, + "testid": true, + "show": true, + "spinnerClassName": true, + "spinnerWrapClassName": true, + "mode": true, + "size": true, + "icon": true, + "tip": true, + "tipPlacement": true, + "delay": true, + "overlay": true, + "body": true + }, + "required": [ + "type", + "show" + ] + }, + "TableSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseTableSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "table", + "static-table" + ] + }, + "testid": true, + "affixHeader": true, + "affixFooter": true, + "columns": true, + "columnsTogglable": true, + "footable": true, + "footerClassName": true, + "headerClassName": true, + "placeholder": true, + "showIndex": true, + "showFooter": true, + "showHeader": true, + "source": true, + "tableClassName": true, + "title": true, + "toolbarClassName": true, + "combineNum": true, + "combineFromIndex": true, + "prefixRow": true, + "affixRow": true, + "resizable": true, + "rowClassNameExpr": true, + "itemBadge": true, + "autoGenerateFilter": true, + "canAccessSuperData": true, + "autoFillHeight": true, + "tableLayout": true, + "deferApi": true, + "persistKey": true + }, + "required": [ + "type" + ] + }, + "TableSchema2": { + "allOf": [ + { + "$ref": "#/definitions/BaseTableSchema2", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "table2" + }, + "testid": true, + "title": true, + "source": true, + "columnsTogglable": true, + "columns": true, + "rowSelection": true, + "expandable": true, + "sticky": true, + "loading": true, + "itemBadge": true, + "showBadge": true, + "popOverContainer": true, + "keyField": true, + "childrenColumnName": true, + "rowClassNameExpr": true, + "lineHeight": true, + "bordered": true, + "showHeader": true, + "footer": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "messages": true, + "reload": true, + "actions": true, + "maxKeepItemSelectionLength": true, + "keepItemSelectionOnPageChange": true, + "selectable": true, + "multiple": true, + "primaryField": true, + "tableLayout": true, + "autoFillHeight": true, + "canAccessSuperData": true, + "lazyRenderAfter": true + }, + "required": [ + "type" + ] + }, + "BaseTableSchema2": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/SchemaObject" + } + } + ], + "description": "表格标题" + }, + "source": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "表格数据源" + }, + "columnsTogglable": { + "anyOf": [ + { + "type": "string", + "const": "auto" + }, + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "表格可自定义列" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/ColumnSchema" + }, + "description": "表格列配置" + }, + "rowSelection": { + "anyOf": [ + { + "$ref": "#/definitions/RowSelectionSchema" + }, + { + "type": "boolean" + } + ], + "description": "表格可选择配置" + }, + "expandable": { + "$ref": "#/definitions/ExpandableSchema", + "description": "表格行可展开配置" + }, + "sticky": { + "type": "boolean", + "description": "粘性头部" + }, + "loading": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "加载中" + }, + "itemBadge": { + "$ref": "#/definitions/BadgeObject", + "description": "行角标内容" + }, + "showBadge": { + "type": "boolean", + "description": "是否展示行角标" + }, + "popOverContainer": { + "description": "指定挂载dom" + }, + "keyField": { + "type": "string", + "description": "多选、嵌套展开记录的ID字段名 默认id" + }, + "childrenColumnName": { + "type": "string", + "description": "数据源嵌套自定义字段名" + }, + "rowClassNameExpr": { + "type": "string", + "description": "自定义行样式" + }, + "lineHeight": { + "type": "string", + "description": "是否固定内容行高度" + }, + "bordered": { + "type": "boolean", + "description": "是否展示边框" + }, + "showHeader": { + "type": "boolean", + "description": "是否展示表头" + }, + "footer": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/SchemaObject" + } + } + ], + "description": "指定表尾" + }, + "quickSaveApi": { + "$ref": "#/definitions/SchemaApi", + "description": "快速编辑后用来批量保存的 API" + }, + "quickSaveItemApi": { + "$ref": "#/definitions/SchemaApi", + "description": "快速编辑配置成及时保存时使用的 API" + }, + "messages": { + "$ref": "#/definitions/SchemaMessage", + "description": "接口报错信息配置" + }, + "reload": { + "type": "string", + "description": "重新加载的组件名称" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "操作列配置" + }, + "maxKeepItemSelectionLength": { + "type": "number", + "description": "批量操作最大限制数" + }, + "keepItemSelectionOnPageChange": { + "type": "boolean", + "description": "翻页是否保存数据" + }, + "selectable": { + "type": "boolean", + "description": "是否可选择 作用同rowSelection 兼容原CRUD属性 默认多选" + }, + "multiple": { + "type": "boolean", + "description": "是否可多选 作用同rowSelection.type 兼容原CRUD属性 不设置认为是多选 仅设置selectable才起作用" + }, + "primaryField": { + "type": "string", + "description": "设置ID字段名 作用同keyFiled 兼容原CURD属性" + }, + "tableLayout": { + "type": "string", + "enum": [ + "fixed", + "auto" + ] + }, + "autoFillHeight": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/AutoFillHeightObject" + } + ], + "description": "表格自动计算高度" + }, + "canAccessSuperData": { + "type": "boolean", + "description": "表格是否可以获取父级数据域值,默认为false" + }, + "lazyRenderAfter": { + "type": "number", + "description": "当一次性渲染太多列上有用,默认为 100,可以用来提升表格渲染性能", + "default": 100 + } + }, + "required": [ + "source", + "columns" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": true, + "testid": true, + "title": true, + "source": true, + "columnsTogglable": true, + "columns": true, + "rowSelection": true, + "expandable": true, + "sticky": true, + "loading": true, + "itemBadge": true, + "showBadge": true, + "popOverContainer": true, + "keyField": true, + "childrenColumnName": true, + "rowClassNameExpr": true, + "lineHeight": true, + "bordered": true, + "showHeader": true, + "footer": true, + "quickSaveApi": true, + "quickSaveItemApi": true, + "messages": true, + "reload": true, + "actions": true, + "maxKeepItemSelectionLength": true, + "keepItemSelectionOnPageChange": true, + "selectable": true, + "multiple": true, + "primaryField": true, + "tableLayout": true, + "autoFillHeight": true, + "canAccessSuperData": true, + "lazyRenderAfter": true + }, + "required": [ + "source", + "columns" + ] + }, + "ColumnSchema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "指定列唯一标识" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "指定列标题" + }, + "type": { + "type": "string", + "description": "指定列内容渲染器" + }, + "rowSpanExpr": { + "type": "string", + "description": "指定行合并表达式" + }, + "colSpanExpr": { + "type": "string", + "description": "指定列合并表达式" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/ColumnSchema" + }, + "description": "表头分组" + }, + "copyable": { + "type": "boolean", + "description": "可复制" + }, + "remark": { + "type": "string", + "description": "列表头提示" + }, + "searchable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "快速搜索" + }, + "sorter": { + "type": "boolean", + "description": "快速排序" + }, + "sortable": { + "type": "boolean", + "description": "兼容table快速排序" + }, + "filterable": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "options": { + "type": "array", + "items": {} + } + }, + "additionalProperties": false, + "description": "兼容table列筛选" + }, + "align": { + "type": "string", + "description": "内容居左、居中、居右" + }, + "headerAlign": { + "type": "string", + "enum": [ + "left", + "center", + "right" + ], + "description": "标题内容居左、居中、居右" + }, + "vAlign": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom" + ], + "description": "列垂直对齐方式" + }, + "fixed": { + "type": [ + "boolean", + "string" + ], + "description": "是否固定在左侧/右侧" + }, + "toggled": { + "type": "boolean", + "description": "当前列是否展示" + }, + "className": { + "type": "string", + "description": "列样式" + }, + "titleClassName": { + "type": "string", + "description": "表头单元格样式" + }, + "classNameExpr": { + "type": "string", + "description": "单元格样式" + }, + "quickEdit": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "配置快速编辑功能" + }, + "width": { + "type": [ + "string", + "number" + ] + }, + "canAccessSuperData": { + "type": "boolean", + "description": "表格列单元格是否可以获取父级数据域值,默认为true,该配置对当前列内单元格生效" + } + }, + "required": [ + "name", + "title" + ], + "additionalProperties": false + }, + "RowSelectionSchema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "选择类型 单选/多选" + }, + "keyField": { + "type": "string", + "description": "对应数据源的key值" + }, + "disableOn": { + "type": "string", + "description": "行是否禁用表达式" + }, + "selections": { + "type": "array", + "items": { + "$ref": "#/definitions/RowSelectionOptionsSchema" + }, + "description": "自定义选择菜单" + }, + "selectedRowKeys": { + "type": "array", + "items": { + "type": [ + "string", + "number" + ] + }, + "description": "已选择的key值" + }, + "selectedRowKeysExpr": { + "type": "string", + "description": "已选择的key值表达式" + }, + "columnWidth": { + "type": "number", + "description": "已选择的key值表达式" + }, + "rowClick": { + "type": "boolean", + "description": "是否点击行触发选中或取消选中" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "RowSelectionOptionsSchema": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "选择类型 选择全部" + }, + "text": { + "type": "string", + "description": "选项显示文本" + } + }, + "required": [ + "key", + "text" + ], + "additionalProperties": false + }, + "ExpandableSchema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "对应渲染器类型" + }, + "keyField": { + "type": "string", + "description": "对应数据源的key值" + }, + "expandableOn": { + "type": "string", + "description": "行是否可展开表达式" + }, + "expandedRowClassNameExpr": { + "type": "string", + "description": "展开行自定义样式表达式" + }, + "expandedRowKeys": { + "type": "array", + "items": { + "type": [ + "string", + "number" + ] + }, + "description": "已展开的key值" + }, + "expandedRowKeysExpr": { + "type": "string", + "description": "已展开的key值表达式" + } + }, + "required": [ + "type", + "keyField", + "expandableOn", + "expandedRowClassNameExpr", + "expandedRowKeys", + "expandedRowKeysExpr" + ], + "additionalProperties": false + }, + "AutoFillHeightObject": { + "type": "object", + "properties": { + "height": { + "type": "number" + }, + "maxHeight": { + "type": "number" + } + }, + "required": [ + "height", + "maxHeight" + ], + "additionalProperties": false + }, + "TabsSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tabs" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/definitions/TabSchema" + }, + "description": "选项卡成员。当配置了 source 时,选项卡成员,将会根据目标数据进行重复。" + }, + "source": { + "type": "string", + "description": "关联已有数据,选项卡直接根据目标数据重复。" + }, + "tabsMode": { + "$ref": "#/definitions/TabsMode", + "description": "展示形式" + }, + "contentClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "内容类名" + }, + "linksClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "链接外层类名" + }, + "mountOnEnter": { + "type": "boolean", + "description": "卡片是否只有在点开的时候加载?" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏的时候是否销毁卡片内容" + }, + "toolbar": { + "$ref": "#/definitions/ActionSchema", + "description": "可以在右侧配置点其他功能按钮。" + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "addable": { + "type": "boolean", + "description": "是否支持新增" + }, + "closable": { + "type": "boolean", + "description": "是否支持删除" + }, + "draggable": { + "type": "boolean", + "description": "是否支持拖拽" + }, + "showTip": { + "type": "boolean", + "description": "是否显示提示" + }, + "showTipClassName": { + "type": "string", + "description": "tooltip 提示的类名" + }, + "editable": { + "type": "boolean", + "description": "是否可编辑标签名" + }, + "scrollable": { + "type": "boolean", + "description": "是否导航支持内容溢出滚动。属性废弃,为了兼容暂且保留" + }, + "sidePosition": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "编辑器模式,侧边的位置" + }, + "addBtnText": { + "type": "string", + "description": "自定义增加按钮文案" + }, + "defaultKey": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaExpression" + }, + { + "type": "number" + } + ], + "description": "初始化激活的选项卡,hash值或索引值,支持使用表达式" + }, + "activeKey": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaExpression" + }, + { + "type": "number" + } + ], + "description": "激活的选项卡,hash值或索引值,支持使用表达式" + }, + "collapseOnExceed": { + "type": "number", + "description": "超过多少个时折叠按钮" + }, + "collapseBtnLabel": { + "type": "string", + "description": "折叠按钮文字" + }, + "swipeable": { + "type": "boolean", + "description": "是否滑动切换只在移动端生效" + } + }, + "required": [ + "type", + "tabs" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "tabs" + }, + "testid": true, + "tabs": true, + "source": true, + "tabsMode": true, + "contentClassName": true, + "linksClassName": true, + "mountOnEnter": true, + "unmountOnExit": true, + "toolbar": true, + "subFormMode": true, + "subFormHorizontal": true, + "addable": true, + "closable": true, + "draggable": true, + "showTip": true, + "showTipClassName": true, + "editable": true, + "scrollable": true, + "sidePosition": true, + "addBtnText": true, + "defaultKey": true, + "activeKey": true, + "collapseOnExceed": true, + "collapseBtnLabel": true, + "swipeable": true + }, + "required": [ + "type", + "tabs" + ], + "description": "选项卡控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/tabs" + }, + "TabSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaObject" + } + ], + "description": "Tab 标题" + }, + "tab": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容", + "deprecated": "用 body 属性" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "badge": { + "type": "number", + "description": "徽标" + }, + "hash": { + "type": "string", + "description": "设置以后将跟url的hash对应" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "按钮图标" + }, + "iconPosition": { + "type": "string", + "enum": [ + "left", + "right" + ] + }, + "reload": { + "type": "boolean", + "description": "设置以后内容每次都会重新渲染" + }, + "mountOnEnter": { + "type": "boolean", + "description": "点开时才加载卡片内容" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏就销毁卡片节点。" + }, + "mode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "horizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "closable": { + "type": "boolean", + "description": "是否可关闭,优先级高于 tabs 的 closable" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "tab": true, + "body": true, + "badge": true, + "hash": true, + "icon": true, + "iconPosition": true, + "reload": true, + "mountOnEnter": true, + "unmountOnExit": true, + "mode": true, + "horizontal": true, + "closable": true + } + }, + "TabsMode": { + "type": "string", + "enum": [ + "", + "line", + "card", + "radio", + "vertical", + "chrome", + "simple", + "strong", + "tiled", + "sidebar" + ] + }, + "TasksSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tasks", + "description": "指定为任务类型" + }, + "btnClassName": { + "$ref": "#/definitions/SchemaClassName" + }, + "btnText": { + "type": "string", + "description": "操作按钮文字", + "default": "上线" + }, + "checkApi": { + "$ref": "#/definitions/SchemaApi", + "description": "用来获取任务状态的 API,当没有进行时任务时不会发送。" + }, + "interval": { + "type": "number", + "description": "当有任务进行中,会每隔一段时间再次检测,而时间间隔就是通过此项配置,默认 3s。", + "default": 3000 + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "任务键值,请唯一区分" + }, + "label": { + "type": "string", + "description": "任务名称" + }, + "remark": { + "type": "string", + "description": "当前任务状态,支持 html" + }, + "status": { + "type": "number", + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "description": "任务状态: 0: 初始状态,不可操作。 1: 就绪,可操作状态。 2: 进行中,还没有结束。 3:有错误,不可重试。 4: 已正常结束。 5:有错误,且可以重试。" + } + }, + "additionalProperties": false + } + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "operationLabel": { + "type": "string", + "description": "操作列说明" + }, + "reSubmitApi": { + "$ref": "#/definitions/SchemaApi", + "description": "如果任务失败,且可以重试,提交的时候会使用此 API" + }, + "remarkLabel": { + "type": "string", + "description": "备注列说明", + "default": "备注" + }, + "retryBtnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置容器重试按钮 className", + "default": "btn-sm btn-danger" + }, + "retryBtnText": { + "type": "string", + "description": "重试操作按钮文字", + "default": "重试" + }, + "statusLabel": { + "type": "string", + "description": "状态列说明", + "default": "状态" + }, + "statusLabelMap": { + "type": "array", + "items": { + "type": "string" + }, + "description": "状态显示对应的类名配置。", + "default": [ + "label-warning", + "label-info", + "label-success", + "label-danger", + "label-default", + "label-danger" + ] + }, + "statusTextMap": { + "type": "array", + "items": { + "type": "string" + }, + "description": "状态显示对应的文字显示配置。", + "default": "[\"未开始\", \"就绪\", \"进行中\", \"出错\", \"已完成\", \"出错\"]," + }, + "submitApi": { + "$ref": "#/definitions/SchemaApi", + "description": "提交任务使用的 API" + }, + "tableClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置 table className" + }, + "taskNameLabel": { + "type": "string", + "description": "任务名称列说明", + "default": "任务名称" + }, + "initialStatusCode": { + "type": "number" + }, + "readyStatusCode": { + "type": "number" + }, + "loadingStatusCode": { + "type": "number" + }, + "canRetryStatusCode": { + "type": "number" + }, + "finishStatusCode": { + "type": "number" + }, + "errorStatusCode": { + "type": "number" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "tasks" + }, + "testid": true, + "btnClassName": true, + "btnText": true, + "checkApi": true, + "interval": true, + "items": true, + "name": true, + "operationLabel": true, + "reSubmitApi": true, + "remarkLabel": true, + "retryBtnClassName": true, + "retryBtnText": true, + "statusLabel": true, + "statusLabelMap": true, + "statusTextMap": true, + "submitApi": true, + "tableClassName": true, + "taskNameLabel": true, + "initialStatusCode": true, + "readyStatusCode": true, + "loadingStatusCode": true, + "canRetryStatusCode": true, + "finishStatusCode": true, + "errorStatusCode": true + }, + "required": [ + "type" + ], + "description": "Tasks 渲染器,格式说明 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/tasks" + }, + "VBoxSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "vbox" + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/definitions/HboxRow" + }, + "description": "行集合" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "vbox" + }, + "testid": true, + "rows": true + }, + "required": [ + "type" + ], + "description": "垂直布局控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/vbox" + }, + "HboxRow": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "type": "object", + "properties": { + "rowClassName": { + "type": "string" + }, + "cellClassName": { + "type": "string" + } + }, + "additionalProperties": true + } + ] + }, + "VideoSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "video", + "description": "指定为视频类型" + }, + "autoPlay": { + "type": "boolean", + "description": "是否自动播放" + }, + "columnsCount": { + "type": "number", + "description": "如果显示切帧,通过此配置项可以控制每行显示多少帧" + }, + "frames": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "设置后,可以显示切帧.点击帧的时候会将视频跳到对应时间。\n\nframes: { '01:22': 'http://domain/xxx.jpg' }" + }, + "framesClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置帧列表容器className" + }, + "style": { + "type": "object", + "description": "组件样式" + }, + "isLive": { + "type": "boolean", + "description": "如果是实时的,请标记一下" + }, + "jumpFrame": { + "type": "boolean", + "description": "点击帧画面时是否跳转视频对应的点", + "default": true + }, + "muted": { + "type": "boolean", + "description": "是否初始静音" + }, + "loop": { + "type": "boolean", + "description": "是否循环播放" + }, + "playerClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置播放器 className" + }, + "poster": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "视频封面地址" + }, + "splitPoster": { + "type": "boolean", + "description": "是否将视频和封面分开显示" + }, + "src": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "视频播放地址" + }, + "videoType": { + "type": "string", + "description": "视频类型如: video/x-flv" + }, + "aspectRatio": { + "type": "string", + "enum": [ + "auto", + "4:3", + "16:9" + ], + "description": "视频比率" + }, + "rates": { + "type": "array", + "items": { + "type": "number" + }, + "description": "视频速率" + }, + "jumpBufferDuration": { + "type": "number", + "description": "跳转到帧时,往前多少秒。" + }, + "stopOnNextFrame": { + "type": "boolean", + "description": "默认播放的时候到了下一帧会继续播放,同时高亮下一帧。 如果配置这个则会停止播放,等待用户选择新的区间再播放。" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "video" + }, + "testid": true, + "autoPlay": true, + "columnsCount": true, + "frames": true, + "framesClassName": true, + "isLive": true, + "jumpFrame": true, + "muted": true, + "loop": true, + "playerClassName": true, + "poster": true, + "splitPoster": true, + "src": true, + "videoType": true, + "aspectRatio": true, + "rates": true, + "jumpBufferDuration": true, + "stopOnNextFrame": true + }, + "required": [ + "type" + ], + "description": "视频播放器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/video" + }, + "WizardSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "wizard", + "description": "指定为表单向导" + }, + "actionClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "配置按钮 className" + }, + "actionFinishLabel": { + "type": "string", + "description": "完成按钮的文字描述" + }, + "actionNextLabel": { + "type": "string", + "description": "下一步按钮的文字描述" + }, + "actionNextSaveLabel": { + "type": "string", + "description": "下一步并且保存按钮的文字描述" + }, + "actionPrevLabel": { + "type": "string", + "description": "上一步按钮的文字描述" + }, + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "Wizard 用来保存数据的 api。 [详情](https://baidu.github.io/amis/docs/api#wizard)" + }, + "bulkSubmit": { + "type": "boolean", + "description": "是否合并后再提交" + }, + "initApi": { + "$ref": "#/definitions/SchemaApi", + "description": "Wizard 用来获取初始数据的 api。" + }, + "mode": { + "type": "string", + "enum": [ + "vertical", + "horizontal" + ], + "description": "展示模式", + "default": "vertical" + }, + "name": { + "$ref": "#/definitions/SchemaName" + }, + "readOnly": { + "type": "boolean", + "description": "是否为只读模式。" + }, + "redirect": { + "type": "string", + "description": "保存完后,可以指定跳转地址,支持相对路径和组内绝对路径,同时可以通过 $xxx 使用变量" + }, + "reload": { + "$ref": "#/definitions/SchemaReload" + }, + "target": { + "type": "string", + "description": "默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。" + }, + "affixFooter": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "const": "always" + } + ], + "description": "是否将底部按钮固定在底部。" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/WizardStepSchema" + } + }, + "startStep": { + "type": "string" + }, + "stepsClassName": { + "type": "string", + "description": "步骤条区域css类" + }, + "bodyClassName": { + "type": "string", + "description": "表单区域css类" + }, + "stepClassName": { + "type": "string", + "description": "step + body区域css类" + }, + "footerClassName": { + "type": "string", + "description": "底部操作栏的css类" + }, + "wrapWithPanel": { + "type": "boolean", + "description": "是否用panel包裹" + } + }, + "required": [ + "type", + "steps" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "wizard" + }, + "testid": true, + "actionClassName": true, + "actionFinishLabel": true, + "actionNextLabel": true, + "actionNextSaveLabel": true, + "actionPrevLabel": true, + "api": true, + "bulkSubmit": true, + "initApi": true, + "mode": true, + "name": true, + "readOnly": true, + "redirect": true, + "reload": true, + "target": true, + "affixFooter": true, + "steps": true, + "startStep": true, + "stepsClassName": true, + "bodyClassName": true, + "stepClassName": true, + "footerClassName": true, + "wrapWithPanel": true + }, + "required": [ + "type", + "steps" + ], + "description": "表单向导 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/wizard" + }, + "WizardStepSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "api": { + "$ref": "#/definitions/SchemaApi", + "description": "当前步骤用来保存数据的 api。" + }, + "asyncApi": { + "$ref": "#/definitions/SchemaApi", + "description": "设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。" + }, + "initApi": { + "$ref": "#/definitions/SchemaApi", + "description": "当前步骤用来获取初始数据的 api" + }, + "jumpable": { + "type": "boolean", + "description": "是否可直接跳转到该步骤,一般编辑模式需要可直接跳转查看。" + }, + "jumpableOn": { + "$ref": "#/definitions/SchemaExpression", + "description": "通过 JS 表达式来配置当前步骤可否被直接跳转到。" + }, + "title": { + "type": "string", + "description": "Step 标题" + }, + "label": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "每一步可以单独配置按钮。如果不配置wizard会自动生成。" + }, + "redirect": { + "type": "string", + "description": "保存完后,可以指定跳转地址,支持相对路径和组内绝对路径,同时可以通过 $xxx 使用变量" + }, + "reload": { + "$ref": "#/definitions/SchemaReload" + }, + "target": { + "type": "string", + "description": "默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。" + } + } + }, + { + "$ref": "#/definitions/BaseFormSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/StepSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "subTitle": true, + "icon": true, + "value": true, + "description": true, + "actions": true, + "body": true, + "tabs": true, + "fieldSet": true, + "data": true, + "debug": true, + "debugConfig": true, + "initApi": true, + "initAsyncApi": true, + "initFinishedField": true, + "initCheckInterval": true, + "initFetch": true, + "initFetchOn": true, + "interval": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "persistData": true, + "persistDataKeys": true, + "clearPersistDataAfterSubmit": true, + "api": true, + "feedback": true, + "asyncApi": true, + "checkInterval": true, + "finishedField": true, + "resetAfterSubmit": true, + "clearAfterSubmit": true, + "mode": true, + "columnCount": true, + "horizontal": true, + "autoFocus": true, + "messages": true, + "name": true, + "panelClassName": true, + "primaryField": true, + "redirect": true, + "reload": true, + "submitOnChange": true, + "submitOnInit": true, + "submitText": true, + "target": true, + "wrapWithPanel": true, + "affixFooter": true, + "promptPageLeave": true, + "promptPageLeaveMessage": true, + "rules": true, + "preventEnterSubmit": true, + "labelAlign": true, + "labelWidth": true, + "jumpable": true, + "jumpableOn": true, + "label": true + } + }, + "BaseFormSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "按钮集合,会固定在底部显示。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "表单项集合" + } + } + }, + { + "$ref": "#/definitions/FormSchemaBase", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "actions": true, + "body": true, + "tabs": true, + "fieldSet": true, + "data": true, + "debug": true, + "debugConfig": true, + "initApi": true, + "initAsyncApi": true, + "initFinishedField": true, + "initCheckInterval": true, + "initFetch": true, + "initFetchOn": true, + "interval": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "persistData": true, + "persistDataKeys": true, + "clearPersistDataAfterSubmit": true, + "api": true, + "feedback": true, + "asyncApi": true, + "checkInterval": true, + "finishedField": true, + "resetAfterSubmit": true, + "clearAfterSubmit": true, + "mode": true, + "columnCount": true, + "horizontal": true, + "autoFocus": true, + "messages": true, + "name": true, + "panelClassName": true, + "primaryField": true, + "redirect": true, + "reload": true, + "submitOnChange": true, + "submitOnInit": true, + "submitText": true, + "target": true, + "wrapWithPanel": true, + "affixFooter": true, + "promptPageLeave": true, + "promptPageLeaveMessage": true, + "rules": true, + "preventEnterSubmit": true, + "labelAlign": true, + "labelWidth": true + }, + "description": "Form 表单渲染器。\n\n说明:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/index" + }, + "FormSchemaBase": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "表单标题" + }, + "actions": { + "type": "array", + "items": {}, + "description": "按钮集合,会固定在底部显示。" + }, + "body": { + "description": "表单项集合" + }, + "tabs": { + "deprecated": "请用类型 tabs" + }, + "fieldSet": { + "deprecated": "请用类型 fieldSet" + }, + "data": {}, + "debug": { + "type": "boolean", + "description": "是否开启调试,开启后会在顶部实时显示表单项数据。" + }, + "debugConfig": { + "type": "object", + "properties": { + "levelExpand": { + "type": "number", + "description": "默认展开的级别" + }, + "enableClipboard": { + "type": "boolean", + "description": "是否可复制" + }, + "iconStyle": { + "type": "string", + "enum": [ + "square", + "circle", + "triangle" + ], + "description": "图标风格" + }, + "quotesOnKeys": { + "type": "boolean", + "description": "是否显示键的引号" + }, + "sortKeys": { + "type": "boolean", + "description": "是否为键排序" + }, + "ellipsisThreshold": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "boolean", + "const": false + } + ], + "description": "设置字符串的最大展示长度,超出长度阈值的字符串将被截断,点击value可切换字符串展示方式,默认为120" + }, + "labelOverflow": { + "type": "string", + "enum": [ + "default", + "ellipsis" + ] + } + }, + "additionalProperties": false, + "description": "Debug面板配置" + }, + "initApi": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "用来初始化表单数据" + }, + "initAsyncApi": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "Form 用来获取初始数据的 api,与initApi不同的是,会一直轮询请求该接口,直到返回 finished 属性为 true 才 结束。" + }, + "initFinishedField": { + "type": "string", + "description": "设置了initAsyncApi后,默认会从返回数据的data.finished来判断是否完成,也可以设置成其他的xxx,就会从data.xxx中获取" + }, + "initCheckInterval": { + "type": "number", + "description": "设置了initAsyncApi以后,默认拉取的时间间隔" + }, + "initFetch": { + "type": "boolean", + "description": "是否初始加载" + }, + "initFetchOn": { + "type": "string", + "description": "建议改成 api 的 sendOn 属性。" + }, + "interval": { + "type": "number", + "description": "设置后将轮询调用 initApi" + }, + "silentPolling": { + "type": "boolean", + "description": "是否静默拉取" + }, + "stopAutoRefreshWhen": { + "type": "string", + "description": "配置停止轮询的条件" + }, + "persistData": { + "type": "string", + "description": "是否开启本地缓存" + }, + "persistDataKeys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "开启本地缓存后限制保存哪些 key" + }, + "clearPersistDataAfterSubmit": { + "type": "boolean", + "description": "提交成功后清空本地缓存" + }, + "api": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "Form 用来保存数据的 api。\n\n详情:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/index#%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4" + }, + "feedback": { + "description": "Form 也可以配置 feedback。" + }, + "asyncApi": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。" + }, + "checkInterval": { + "type": "number", + "description": "轮询请求的时间间隔,默认为 3秒。设置 asyncApi 才有效" + }, + "finishedField": { + "type": "string", + "description": "如果决定结束的字段名不是 `finished` 请设置此属性,比如 `is_success`" + }, + "resetAfterSubmit": { + "type": "boolean", + "description": "提交完后重置表单" + }, + "clearAfterSubmit": { + "type": "boolean", + "description": "提交后清空表单" + }, + "mode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal", + "flex" + ], + "description": "配置表单项默认的展示方式。" + }, + "columnCount": { + "type": "number", + "description": "表单项显示为几列" + }, + "horizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "autoFocus": { + "type": "boolean", + "description": "是否自动将第一个表单元素聚焦。" + }, + "messages": { + "type": "object", + "properties": { + "validateFailed": { + "type": "string", + "description": "表单验证失败时的提示" + } + }, + "additionalProperties": false, + "description": "消息文案配置,记住这个优先级是最低的,如果你的接口返回了 msg,接口返回的优先。" + }, + "name": { + "type": "string" + }, + "panelClassName": { + "$ref": "#/definitions/ClassName", + "description": "配置容器 panel className" + }, + "primaryField": { + "type": "string", + "description": "设置主键 id, 当设置后,检测表单是否完成时(asyncApi),只会携带此数据。", + "default": "id" + }, + "redirect": { + "type": "string" + }, + "reload": { + "type": "string" + }, + "submitOnChange": { + "type": "boolean", + "description": "修改的时候是否直接提交表单。" + }, + "submitOnInit": { + "type": "boolean", + "description": "表单初始先提交一次,联动的时候有用" + }, + "submitText": { + "type": "string", + "description": "默认的提交按钮名称,如果设置成空,则可以把默认按钮去掉。" + }, + "target": { + "type": "string", + "description": "默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。" + }, + "wrapWithPanel": { + "type": "boolean", + "description": "是否用 panel 包裹起来" + }, + "affixFooter": { + "type": "boolean", + "description": "是否固定底下的按钮在底部。" + }, + "promptPageLeave": { + "type": "boolean", + "description": "页面离开提示,为了防止页面不小心跳转而导致表单没有保存。" + }, + "promptPageLeaveMessage": { + "type": "string", + "description": "具体的提示信息,选填。" + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "rule": { + "type": "string" + }, + "message": { + "type": "string" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + }, + "required": [ + "rule", + "message" + ], + "additionalProperties": false + }, + "description": "组合校验规则,选填" + }, + "preventEnterSubmit": { + "type": "boolean", + "description": "禁用回车提交" + }, + "labelAlign": { + "$ref": "#/definitions/LabelAlign", + "description": "表单label的对齐方式" + }, + "labelWidth": { + "type": [ + "number", + "string" + ], + "description": "label自定义宽度,默认单位为px" + }, + "static": { + "type": "boolean", + "description": "展示态时的className" + }, + "staticOn": { + "$ref": "#/definitions/SchemaExpression" + }, + "staticClassName": { + "$ref": "#/definitions/SchemaClassName" + } + }, + "additionalProperties": false + }, + "StepSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "标题" + }, + "subTitle": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "子标题" + }, + "icon": { + "type": "string", + "description": "图标" + }, + "value": { + "type": [ + "string", + "number" + ] + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "描述" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "subTitle": true, + "icon": true, + "value": true, + "description": true + } + }, + "WrapperSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "wrapper", + "description": "指定为 container 类型" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "none" + ] + }, + "wrap": { + "type": "boolean" + }, + "style": { + "type": "object", + "description": "自定义样式" + } + }, + "required": [ + "type", + "body" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "wrapper" + }, + "testid": true, + "body": true, + "size": true, + "wrap": true + }, + "required": [ + "type", + "body" + ], + "description": "Wrapper 容器渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/wrapper" + }, + "TooltipWrapperSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tooltip-wrapper", + "description": "文字提示容器" + }, + "title": { + "type": "string", + "description": "文字提示标题" + }, + "content": { + "type": "string", + "description": "文字提示内容,兼容 tooltip,但建议通过 content 来实现提示内容" + }, + "tooltip": { + "type": "string", + "deprecated": "文字提示内容" + }, + "placement": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ], + "description": "文字提示浮层出现位置,默认为top" + }, + "offset": { + "type": "array", + "items": { + "type": "number" + }, + "minItems": 2, + "maxItems": 2, + "description": "浮层位置相对偏移量" + }, + "showArrow": { + "type": "boolean", + "description": "是否展示浮层指向箭头" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用提示" + }, + "trigger": { + "anyOf": [ + { + "$ref": "#/definitions/Trigger" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/Trigger" + } + } + ], + "description": "浮层触发方式,默认为hover" + }, + "mouseEnterDelay": { + "type": "number", + "description": "浮层延迟显示时间, 单位 ms" + }, + "mouseLeaveDelay": { + "type": "number", + "description": "浮层延迟隐藏时间, 单位 ms" + }, + "rootClose": { + "type": "boolean", + "description": "是否点击非内容区域关闭提示,默认为true" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "wrapperComponent": { + "type": "string", + "description": "内容区包裹标签" + }, + "inline": { + "type": "boolean", + "description": "内容区是否内联显示,默认为false" + }, + "tooltipTheme": { + "type": "string", + "enum": [ + "light", + "dark" + ], + "description": "主题样式, 默认为light" + }, + "style": { + "type": "object", + "description": "内容区自定义样式" + }, + "enterable": { + "type": "boolean", + "description": "是否可以移入浮层中, 默认true" + }, + "tooltipStyle": { + "type": "object", + "description": "自定义提示浮层样式" + }, + "className": { + "type": "string", + "description": "内容区CSS类名" + }, + "tooltipArrowClassName": { + "type": "string", + "description": "箭头CSS类名" + }, + "tooltipClassName": { + "type": "string", + "description": "文字提示浮层CSS类名" + } + }, + "required": [ + "type", + "wrapperComponent" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "tooltip-wrapper" + }, + "testid": true, + "title": true, + "content": true, + "tooltip": true, + "placement": true, + "offset": true, + "showArrow": true, + "trigger": true, + "mouseEnterDelay": true, + "mouseLeaveDelay": true, + "rootClose": true, + "body": true, + "wrapperComponent": true, + "inline": true, + "tooltipTheme": true, + "enterable": true, + "tooltipStyle": true, + "tooltipArrowClassName": true, + "tooltipClassName": true + }, + "required": [ + "type", + "wrapperComponent" + ] + }, + "Trigger": { + "type": "string", + "enum": [ + "hover", + "click", + "focus" + ] + }, + "FormSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "按钮集合,会固定在底部显示。" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "表单项集合" + } + } + }, + { + "$ref": "#/definitions/FormSchemaBase", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "actions": true, + "body": true, + "tabs": true, + "fieldSet": true, + "data": true, + "debug": true, + "debugConfig": true, + "initApi": true, + "initAsyncApi": true, + "initFinishedField": true, + "initCheckInterval": true, + "initFetch": true, + "initFetchOn": true, + "interval": true, + "silentPolling": true, + "stopAutoRefreshWhen": true, + "persistData": true, + "persistDataKeys": true, + "clearPersistDataAfterSubmit": true, + "api": true, + "feedback": true, + "asyncApi": true, + "checkInterval": true, + "finishedField": true, + "resetAfterSubmit": true, + "clearAfterSubmit": true, + "mode": true, + "columnCount": true, + "horizontal": true, + "autoFocus": true, + "messages": true, + "name": true, + "panelClassName": true, + "primaryField": true, + "redirect": true, + "reload": true, + "submitOnChange": true, + "submitOnInit": true, + "submitText": true, + "target": true, + "wrapWithPanel": true, + "affixFooter": true, + "promptPageLeave": true, + "promptPageLeaveMessage": true, + "rules": true, + "preventEnterSubmit": true, + "labelAlign": true, + "labelWidth": true, + "type": { + "type": "string", + "const": "form" + } + }, + "required": [ + "type" + ] + }, + "AnchorNavSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "anchor-nav", + "description": "指定为 AnchorNav 锚点导航渲染器" + }, + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/AnchorNavSectionSchema" + }, + "description": "楼层集合" + }, + "active": { + "type": [ + "string", + "number" + ], + "description": "被激活(定位)的楼层" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "样式名" + }, + "linkClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "导航样式名" + }, + "sectionClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "楼层样式名" + }, + "direction": { + "type": "string", + "enum": [ + "vertical", + "horizontal" + ] + } + }, + "required": [ + "type", + "links" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "anchor-nav" + }, + "testid": true, + "links": true, + "active": true, + "linkClassName": true, + "sectionClassName": true, + "direction": true + }, + "required": [ + "type", + "links" + ], + "description": "AnchorNav 锚点导航渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/anchor-nav" + }, + "AnchorNavSectionSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "导航文字说明" + }, + "href": { + "type": "string", + "description": "锚点链接" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/AnchorNavSectionSchema" + }, + "description": "子节点" + } + }, + "required": [ + "title" + ] + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "href": true, + "body": true, + "children": true + }, + "required": [ + "title" + ], + "description": "AnchorNavSection 锚点区域渲染器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/anchor-nav" + }, + "StepsSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "steps", + "description": "指定为 Steps 步骤条渲染器" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/StepSchema" + }, + "description": "步骤" + }, + "source": { + "type": "string", + "description": "API 或 数据映射" + }, + "value": { + "type": [ + "number", + "string" + ], + "description": "指定当前步骤" + }, + "name": { + "type": "string", + "description": "变量映射" + }, + "status": { + "anyOf": [ + { + "$ref": "#/definitions/StepStatus" + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/StepStatus" + } + }, + { + "$ref": "#/definitions/SchemaExpression" + } + ] + }, + "mode": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ], + "description": "展示模式" + }, + "labelPlacement": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ], + "description": "标签放置位置" + }, + "progressDot": { + "type": "boolean", + "description": "点状步骤条" + }, + "iconPosition": { + "type": "boolean", + "const": false, + "description": "切换图标位置" + } + }, + "required": [ + "type", + "iconPosition" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "steps" + }, + "testid": true, + "steps": true, + "source": true, + "value": true, + "name": true, + "status": true, + "mode": true, + "labelPlacement": true, + "progressDot": true, + "iconPosition": true + }, + "required": [ + "type", + "iconPosition" + ] + }, + "StepStatus": { + "type": "string", + "enum": [ + "wait", + "process", + "finish", + "error" + ] + }, + "PortletSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "portlet", + "description": "指定为 portlet 类型" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/definitions/PortletTabSchema" + } + }, + "source": { + "type": "string", + "description": "关联已有数据,选项卡直接根据目标数据重复。" + }, + "tabsClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "类名" + }, + "tabsMode": { + "type": "string", + "enum": [ + "", + "line", + "card", + "radio", + "vertical", + "tiled" + ], + "description": "展示形式" + }, + "contentClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "内容类名" + }, + "linksClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "链接外层类名" + }, + "mountOnEnter": { + "type": "boolean", + "description": "卡片是否只有在点开的时候加载?" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏的时候是否销毁卡片内容" + }, + "toolbar": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "可以在右侧配置点其他功能按钮。不会随着tab切换" + }, + "scrollable": { + "type": "boolean", + "description": "是否支持溢出滚动" + }, + "divider": { + "type": "boolean", + "description": "header和内容是否展示分割线" + }, + "description": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题右侧的描述" + }, + "hideHeader": { + "type": "boolean", + "description": "隐藏头部" + }, + "style": { + "type": "object", + "description": "自定义样式" + } + }, + "required": [ + "type", + "tabs" + ] + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "portlet" + }, + "tabs": true, + "source": true, + "tabsClassName": true, + "tabsMode": true, + "contentClassName": true, + "linksClassName": true, + "mountOnEnter": true, + "unmountOnExit": true, + "toolbar": true, + "scrollable": true, + "divider": true, + "description": true, + "hideHeader": true + }, + "required": [ + "type", + "tabs" + ] + }, + "PortletTabSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "Tab 标题" + }, + "tab": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容", + "deprecated": "用 body 属性" + }, + "toolbar": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionSchema" + }, + "description": "可以在右侧配置点其他功能按钮,随着tab切换而切换" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "按钮图标" + }, + "iconPosition": { + "type": "string", + "enum": [ + "left", + "right" + ] + }, + "reload": { + "type": "boolean", + "description": "设置以后内容每次都会重新渲染" + }, + "mountOnEnter": { + "type": "boolean", + "description": "点开时才加载卡片内容" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏就销毁卡片节点。" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "title": true, + "tab": true, + "toolbar": true, + "body": true, + "icon": true, + "iconPosition": true, + "reload": true, + "mountOnEnter": true, + "unmountOnExit": true + }, + "description": "栏目容器渲染器。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/portlet" + }, + "TimelineSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "timeline", + "description": "指定为 Timeline 时间轴渲染器" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/TimelineItemSchema" + }, + "description": "节点数据" + }, + "source": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaApi" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "API 或 数据映射" + }, + "mode": { + "type": "string", + "enum": [ + "left", + "right", + "top", + "bottom", + "alternate" + ], + "description": "文字相对于时间轴展示方向" + }, + "direction": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ], + "description": "展示方向" + }, + "reverse": { + "type": "boolean", + "description": "节点倒序" + }, + "itemTitleSchema": { + "$ref": "#/definitions/SchemaCollection", + "description": "节点title自定一展示模板" + }, + "iconClassName": { + "type": "string", + "description": "图标的CSS类名" + }, + "timeClassName": { + "type": "string", + "description": "节点时间的CSS类名" + }, + "titleClassName": { + "type": "string", + "description": "节点标题的CSS类名" + }, + "detailClassName": { + "type": "string", + "description": "节点详情的CSS类名" + }, + "cardSchema": { + "$ref": "#/definitions/CardSchema", + "description": "卡片展示配置,如果传入则将items数据传入cardSchema中循环渲染,itemTitleSchema、titleClassName、detailClassName将不生效。配置后 timeline item中的数据都将可以在cardSchema中通过数据方式引用。如果子节点也配置了cardSchema,则子节点的cardSchema优先级高于timeline的cardSchema" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "timeline" + }, + "testid": true, + "items": true, + "source": true, + "mode": true, + "direction": true, + "reverse": true, + "itemTitleSchema": true, + "iconClassName": true, + "timeClassName": true, + "titleClassName": true, + "detailClassName": true, + "cardSchema": true + }, + "required": [ + "type" + ] + }, + "TimelineItemSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "time": { + "type": "string", + "description": "时间点" + }, + "title": { + "$ref": "#/definitions/SchemaCollection", + "description": "时间节点标题" + }, + "detail": { + "type": "string", + "description": "详细内容" + }, + "detailCollapsedText": { + "type": "string", + "description": "detail折叠时文案" + }, + "detailExpandedText": { + "type": "string", + "description": "detail展开时文案" + }, + "color": { + "type": "string", + "description": "时间点圆圈颜色" + }, + "icon": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/IconCheckedSchema" + } + ], + "description": "图标" + }, + "iconClassName": { + "type": "string", + "description": "图标的CSS类名" + }, + "timeClassName": { + "type": "string", + "description": "节点时间的CSS类名(优先级高于统一配置的timeClassName)" + }, + "titleClassName": { + "type": "string", + "description": "节点标题的CSS类名(优先级高于统一配置的titleClassName)" + }, + "detailClassName": { + "type": "string", + "description": "节点详情的CSS类名(优先级高于统一配置的detailClassName)" + }, + "dotSize": { + "type": "string", + "enum": [ + "sm", + "md", + "lg", + "xl" + ] + }, + "lineColor": { + "type": "string" + }, + "hideDot": { + "type": "boolean" + }, + "cardSchema": { + "$ref": "#/definitions/CardSchema", + "description": "卡片展示配置,如果传入则以卡片形式展示,传入对象转为卡片展示,传入的time、title、detail及相关属性将被忽略,只有连线配置和节点圆圈配置生效" + } + }, + "required": [ + "time" + ] + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "time": true, + "title": true, + "detail": true, + "detailCollapsedText": true, + "detailExpandedText": true, + "color": true, + "icon": true, + "iconClassName": true, + "timeClassName": true, + "titleClassName": true, + "detailClassName": true, + "dotSize": true, + "lineColor": true, + "hideDot": true, + "cardSchema": true + }, + "required": [ + "time" + ] + }, + "FormControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "control" + }, + "body": true + }, + "required": [ + "type", + "body" + ], + "description": "Control 表单项包裹 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/control" + }, + "FormBaseControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/SchemaType" + }, + "remark": { + "$ref": "#/definitions/SchemaRemark", + "description": "显示一个小图标, 鼠标放上去的时候显示提示内容" + }, + "labelRemark": { + "$ref": "#/definitions/SchemaRemark", + "description": "显示一个小图标, 鼠标放上去的时候显示提示内容, 这个小图标跟 label 在一起" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControl", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true + }, + "required": [ + "type" + ] + }, + "FormBaseControl": { + "allOf": [ + { + "type": "object", + "properties": { + "size": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "full" + ], + "description": "表单项大小" + } + } + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/FormBaseControlWithoutSize", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true + } + }, + "ArrayControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseComboControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-array" + }, + "scaffold": true, + "noBorder": true, + "deleteConfirmText": true, + "deleteApi": true, + "typeSwitchable": true, + "conditions": true, + "formClassName": true, + "addButtonClassName": true, + "addButtonText": true, + "addable": true, + "addattop": true, + "items": true, + "draggable": true, + "draggableTip": true, + "flat": true, + "delimiter": true, + "joinValues": true, + "maxLength": true, + "minLength": true, + "multiLine": true, + "multiple": true, + "removable": true, + "subFormMode": true, + "subFormHorizontal": true, + "canAccessSuperData": true, + "tabsMode": true, + "tabsStyle": true, + "tabsLabelTpl": true, + "lazyLoad": true, + "perPage": true, + "strictMode": true, + "syncFields": true, + "nullable": true, + "messages": true, + "updatePristineAfterStoreDataReInit": true, + "testIdBuilder": true + }, + "required": [ + "type" + ], + "description": "InputArray 数组输入框。 combo 的别名。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/array" + }, + "BaseComboControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "scaffold": { + "description": "单组表单项初始值。默认为 `{}`", + "default": {} + }, + "noBorder": { + "type": "boolean", + "description": "是否含有边框" + }, + "deleteConfirmText": { + "type": "string", + "description": "确认删除时的提示" + }, + "deleteApi": { + "$ref": "#/definitions/SchemaApi", + "description": "删除时调用的api" + }, + "typeSwitchable": { + "type": "boolean", + "description": "是否可切换条件,配合`conditions`使用" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/ComboCondition" + }, + "description": "符合某类条件后才渲染的schema" + }, + "formClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "内部单组表单项的类名" + }, + "addButtonClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "新增按钮CSS类名" + }, + "addButtonText": { + "type": "string", + "description": "新增按钮文字", + "default": "新增" + }, + "addable": { + "type": "boolean", + "description": "是否可新增" + }, + "addattop": { + "type": "boolean", + "description": "Add at top" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/ComboSubControl" + }, + "description": "数组输入框的子项" + }, + "draggable": { + "type": "boolean", + "description": "是否可拖拽排序" + }, + "draggableTip": { + "type": "string", + "description": "可拖拽排序的提示信息。", + "default": "可拖拽排序" + }, + "flat": { + "type": "boolean", + "description": "是否将结果扁平化(去掉name),只有当controls的length为1且multiple为true的时候才有效" + }, + "delimiter": { + "type": "string", + "description": "当扁平化开启并且joinValues为true时,用什么分隔符", + "deprecated": true + }, + "joinValues": { + "type": "boolean", + "description": "当扁平化开启的时候,是否用分隔符的形式发送给后端,否则采用array的方式", + "deprecated": true + }, + "maxLength": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "限制最大个数" + }, + "minLength": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "限制最小个数" + }, + "multiLine": { + "type": "boolean", + "description": "是否多行模式,默认一行展示完" + }, + "multiple": { + "type": "boolean", + "description": "是否可多选" + }, + "removable": { + "type": "boolean", + "description": "是否可删除" + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "horizontal", + "inline" + ], + "description": "子表单的模式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + }, + "placeholder": { + "type": "string", + "description": "没有成员时显示。", + "default": "empty" + }, + "canAccessSuperData": { + "type": "boolean", + "description": "是否可以访问父级数据,正常 combo 已经关联到数组成员,是不能访问父级数据的。" + }, + "tabsMode": { + "type": "boolean", + "description": "采用 Tabs 展示方式?" + }, + "tabsStyle": { + "type": "string", + "enum": [ + "", + "line", + "card", + "radio" + ], + "description": "Tabs 的展示模式。" + }, + "tabsLabelTpl": { + "$ref": "#/definitions/SchemaTpl", + "description": "选项卡标题的生成模板。" + }, + "lazyLoad": { + "type": "boolean", + "description": "数据比较多,比较卡时,可以试试开启。" + }, + "perPage": { + "type": "number", + "description": "分页个数,默认不分页" + }, + "strictMode": { + "type": "boolean", + "description": "严格模式,为了性能默认不开的。" + }, + "syncFields": { + "type": "array", + "items": { + "type": "string" + }, + "description": "配置同步字段。只有 `strictMode` 为 `false` 时有效。 如果 Combo 层级比较深,底层的获取外层的数据可能不同步。 但是给 combo 配置这个属性就能同步下来。输入格式:`[\"os\"]`" + }, + "nullable": { + "type": "boolean", + "description": "允许为空,如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。" + }, + "messages": { + "type": "object", + "properties": { + "validateFailed": { + "type": "string", + "description": "验证错误提示" + }, + "minLengthValidateFailed": { + "type": "string", + "description": "最小值验证错误提示" + }, + "maxLengthValidateFailed": { + "type": "string", + "description": "最大值验证错误提示" + } + }, + "additionalProperties": false, + "description": "提示信息" + }, + "updatePristineAfterStoreDataReInit": { + "type": "boolean" + }, + "testIdBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + } + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true, + "scaffold": true, + "noBorder": true, + "deleteConfirmText": true, + "deleteApi": true, + "typeSwitchable": true, + "conditions": true, + "formClassName": true, + "addButtonClassName": true, + "addButtonText": true, + "addable": true, + "addattop": true, + "items": true, + "draggable": true, + "draggableTip": true, + "flat": true, + "delimiter": true, + "joinValues": true, + "maxLength": true, + "minLength": true, + "multiLine": true, + "multiple": true, + "removable": true, + "subFormMode": true, + "subFormHorizontal": true, + "canAccessSuperData": true, + "tabsMode": true, + "tabsStyle": true, + "tabsLabelTpl": true, + "lazyLoad": true, + "perPage": true, + "strictMode": true, + "syncFields": true, + "nullable": true, + "messages": true, + "updatePristineAfterStoreDataReInit": true, + "testIdBuilder": true + }, + "description": "Combo 组合输入框类型 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/combo" + }, + "ComboCondition": { + "type": "object", + "properties": { + "test": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/ComboSubControl" + } + }, + "label": { + "type": "string" + }, + "scaffold": {}, + "mode": { + "type": "string" + } + }, + "required": [ + "test", + "items", + "label" + ], + "additionalProperties": false + }, + "ComboSubControl": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "type": "object", + "properties": { + "unique": { + "type": "boolean", + "description": "是否唯一, 只有在 combo 里面才有用" + }, + "columnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "列类名,可以用来修改这类宽度。" + }, + "testid": { + "type": "string" + } + }, + "additionalProperties": true + } + ] + }, + "ButtonGroupControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormOptionsControlSelf", + "additionalProperties": true + }, + { + "$ref": "#/definitions/FormBaseControlWithoutSize", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseButtonGroupSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "button-group-select" + }, + "testid": true, + "btnClassName": true, + "btnActiveClassName": true, + "buttons": true, + "btnLevel": true, + "btnActiveLevel": true, + "vertical": true, + "tiled": true, + "size": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true + }, + "required": [ + "type" + ], + "description": "按钮组控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/button-group" + }, + "FormOptionsControlSelf": { + "type": "object", + "properties": { + "options": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/Option" + } + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/definitions/PlainObject" + } + ], + "description": "选项集合" + }, + "source": { + "$ref": "#/definitions/BaseApi", + "description": "可用来通过 API 拉取 options。" + }, + "selectFirst": { + "type": "boolean", + "description": "默认选择选项第一个值。" + }, + "initFetchOn": { + "type": "string", + "description": "用表达式来配置 source 接口初始要不要拉取", + "deprecated": "建议用 source 接口的 sendOn" + }, + "initFetch": { + "type": "boolean", + "description": "配置 source 接口初始拉不拉取。", + "deprecated": "建议用 source 接口的 sendOn" + }, + "multiple": { + "type": "boolean", + "description": "是否为多选模式" + }, + "checkAll": { + "type": "boolean", + "description": "是否默认全选" + }, + "joinValues": { + "type": "boolean", + "description": "单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。" + }, + "delimiter": { + "type": "string", + "description": "分割符" + }, + "valuesNoWrap": { + "type": "boolean", + "description": "多选模式,值太多时是否避免折行" + }, + "extractValue": { + "type": "boolean", + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。" + }, + "clearable": { + "type": "boolean", + "description": "是否可清除。" + }, + "resetValue": { + "type": "string", + "description": "点清除按钮时,将表单项设置成当前配置的值。", + "default": "" + }, + "deferField": { + "type": "string", + "description": "懒加载字段" + }, + "deferApi": { + "$ref": "#/definitions/BaseApi", + "description": "延时加载的 API,当选项中有 defer: true 的选项时,点开会通过此接口扩充。" + }, + "addApi": { + "$ref": "#/definitions/BaseApi", + "description": "添加时调用的接口" + }, + "addControls": { + "type": "array", + "items": { + "$ref": "#/definitions/PlainObject" + }, + "description": "新增时的表单项。" + }, + "addDialog": { + "$ref": "#/definitions/PlainObject", + "description": "控制新增弹框设置项" + }, + "creatable": { + "type": "boolean", + "description": "是否可以新增" + }, + "createBtnLabel": { + "type": "string", + "description": "新增文字" + }, + "editable": { + "type": "boolean", + "description": "是否可以编辑" + }, + "editApi": { + "$ref": "#/definitions/BaseApi", + "description": "编辑时调用的 API" + }, + "editControls": { + "type": "array", + "items": { + "$ref": "#/definitions/PlainObject" + }, + "description": "选项修改的表单项" + }, + "editDialog": { + "$ref": "#/definitions/PlainObject", + "description": "控制编辑弹框设置项" + }, + "removable": { + "type": "boolean", + "description": "是否可删除" + }, + "deleteApi": { + "$ref": "#/definitions/BaseApi", + "description": "选项删除 API" + }, + "deleteConfirmText": { + "type": "string", + "description": "选项删除提示文字。" + }, + "clearValueOnSourceChange": { + "type": "boolean", + "description": "source从数据域取值时,数据域值变化后是否自动清空" + } + }, + "additionalProperties": false + }, + "Option": { + "type": "object", + "properties": { + "label": { + "type": "string", + "description": "用来显示的文字" + }, + "scopeLabel": { + "type": "string", + "description": "可以用来给 Option 标记个范围,让数据展示更清晰。\n\n这个只有在数值展示的时候显示。" + }, + "value": { + "description": "请保证数值唯一,多个选项值一致会认为是同一个选项。" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + }, + "disabledTip": { + "type": "string", + "description": "禁用提示" + }, + "children": { + "$ref": "#/definitions/Options", + "description": "支持嵌套" + }, + "visible": { + "type": "boolean", + "description": "是否可见" + }, + "hidden": { + "type": "boolean", + "description": "最好不要用!因为有 visible 就够了。", + "deprecated": "用 visible" + }, + "description": { + "type": "string", + "description": "描述,部分控件支持" + }, + "defer": { + "type": "boolean", + "description": "标记后数据延时加载" + }, + "deferApi": { + "$ref": "#/definitions/BaseApi", + "description": "如果设置了,优先级更高,不设置走 source 接口加载。" + }, + "loading": { + "type": "boolean", + "description": "标记正在加载。只有 defer 为 true 时有意义。内部字段不可以外部设置" + }, + "loaded": { + "type": "boolean", + "description": "只有设置了 defer 才有意义,内部字段不可以外部设置" + } + } + }, + "Options": { + "type": "array", + "items": { + "$ref": "#/definitions/Option" + } + }, + "ChainedSelectControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "chained-select" + } + }, + "required": [ + "type" + ], + "description": "链式下拉框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/chain-select" + }, + "FormOptionsSchema": { + "allOf": [ + { + "type": "object" + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/FormOptionsControlSelf", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true + } + }, + "CheckboxControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "checkbox", + "description": "指定为多行文本输入框" + }, + "trueValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "勾选值" + }, + "falseValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "未勾选值" + }, + "option": { + "type": "string", + "description": "选项说明" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "partial": { + "type": "boolean" + }, + "optionType": { + "type": "string", + "enum": [ + "default", + "button" + ] + }, + "checked": { + "type": "boolean" + }, + "testIdBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "checkbox" + }, + "trueValue": true, + "falseValue": true, + "option": true, + "badge": true, + "partial": true, + "optionType": true, + "checked": true, + "testIdBuilder": true + }, + "required": [ + "type" + ], + "description": "Checkbox 勾选框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/checkbox" + }, + "CheckboxesControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "checkboxes", + "description": "指定为 Checkboxes 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/checkboxes" + }, + "checkAll": { + "type": "boolean", + "description": "是否开启全选功能" + }, + "defaultCheckAll": { + "type": "boolean", + "description": "是否默认全选" + }, + "checkAllText": { + "type": "string", + "description": "全选/不选文案" + }, + "columnsCount": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { + "type": "number" + } + } + ], + "description": "每行显示多少个" + }, + "menuTpl": { + "type": "string", + "description": "自定义选项展示" + }, + "testIdBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "checkboxes" + }, + "defaultCheckAll": true, + "checkAllText": true, + "columnsCount": true, + "menuTpl": true, + "testIdBuilder": true + }, + "required": [ + "type" + ], + "description": "复选框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/checkboxes" + }, + "InputCityControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-city", + "description": "指定为城市选择框。" + }, + "extractValue": { + "type": "boolean", + "description": "开启后只会存城市的 code 信息" + }, + "joinValues": { + "type": "boolean", + "description": "是否将各个信息拼接成字符串。" + }, + "delimiter": { + "type": "string", + "description": "拼接的符号是啥?" + }, + "allowCity": { + "type": "boolean", + "description": "允许选择城市?" + }, + "allowDistrict": { + "type": "boolean", + "description": "允许选择地区?" + }, + "allowStreet": { + "type": "boolean", + "description": "允许选择街道?" + }, + "searchable": { + "type": "boolean", + "description": "是否显示搜索框" + }, + "itemClassName": { + "type": "string", + "description": "下拉框className" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-city" + }, + "extractValue": true, + "joinValues": true, + "delimiter": true, + "allowCity": true, + "allowDistrict": true, + "allowStreet": true, + "searchable": true, + "itemClassName": true + }, + "required": [ + "type" + ], + "description": "City 城市选择框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/city" + }, + "InputColorControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-color", + "description": "指定为颜色选择框" + }, + "clearable": { + "type": "boolean", + "description": "是否显示清除按钮" + }, + "format": { + "type": "string", + "enum": [ + "hex", + "hexa", + "rgb", + "rgba", + "hsl" + ], + "description": "颜色格式" + }, + "closeOnSelect": { + "type": "boolean", + "description": "选中颜色后是否关闭弹出层。" + }, + "presetColors": { + "type": "array", + "items": { + "$ref": "#/definitions/PresetColor" + }, + "description": "预设颜色,用户可以直接从预设中选。" + }, + "allowCustomColor": { + "type": "boolean", + "description": "是否允许用户输入颜色。" + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹窗容器选择器" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-color" + }, + "clearable": true, + "format": true, + "closeOnSelect": true, + "presetColors": true, + "allowCustomColor": true, + "popOverContainerSelector": true + }, + "required": [ + "type" + ], + "description": "Color 颜色选择框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/color" + }, + "PresetColor": { + "anyOf": [ + { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "color", + "title" + ], + "additionalProperties": false + }, + { + "type": "string" + } + ] + }, + "ComboControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseComboControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "combo" + }, + "scaffold": true, + "noBorder": true, + "deleteConfirmText": true, + "deleteApi": true, + "typeSwitchable": true, + "conditions": true, + "formClassName": true, + "addButtonClassName": true, + "addButtonText": true, + "addable": true, + "addattop": true, + "items": true, + "draggable": true, + "draggableTip": true, + "flat": true, + "delimiter": true, + "joinValues": true, + "maxLength": true, + "minLength": true, + "multiLine": true, + "multiple": true, + "removable": true, + "subFormMode": true, + "subFormHorizontal": true, + "canAccessSuperData": true, + "tabsMode": true, + "tabsStyle": true, + "tabsLabelTpl": true, + "lazyLoad": true, + "perPage": true, + "strictMode": true, + "syncFields": true, + "nullable": true, + "messages": true, + "updatePristineAfterStoreDataReInit": true, + "testIdBuilder": true + }, + "required": [ + "type" + ] + }, + "ConditionBuilderControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "condition-builder", + "description": "指定为" + }, + "embed": { + "type": "boolean", + "description": "内嵌模式,默认为 true" + }, + "pickerIcon": { + "$ref": "#/definitions/IconSchema", + "description": "非内嵌模式时 弹窗触发icon" + }, + "funcs": { + "$ref": "#/definitions/ConditionBuilderFuncs", + "description": "函数集合" + }, + "fields": { + "$ref": "#/definitions/ConditionBuilderFields", + "description": "字段集合" + }, + "config": { + "$ref": "#/definitions/ConditionBuilderConfig", + "description": "其他配置" + }, + "source": { + "anyOf": [ + { + "$ref": "#/definitions/SchemaApi" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "通过远程拉取配置项" + }, + "builderMode": { + "type": "string", + "enum": [ + "simple", + "full" + ], + "description": "展现模式" + }, + "showANDOR": { + "type": "boolean", + "description": "是否显示并或切换键按钮,只在简单模式下有用" + }, + "draggable": { + "type": "boolean", + "description": "是否可拖拽,默认为 true" + }, + "addBtnVisibleOn": { + "type": "string" + }, + "addGroupBtnVisibleOn": { + "type": "string", + "description": "表达式:控制按钮“添加条件组”的显示" + }, + "formula": { + "$ref": "#/definitions/BaseInputFormulaControlSchema", + "description": "将字段输入控件变成公式编辑器。" + }, + "formulaForIf": { + "description": "if 里面公式编辑器配置" + } + }, + "required": [ + "type", + "fields" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "condition-builder" + }, + "embed": true, + "pickerIcon": true, + "funcs": true, + "fields": true, + "config": true, + "source": true, + "builderMode": true, + "showANDOR": true, + "draggable": true, + "addBtnVisibleOn": true, + "addGroupBtnVisibleOn": true, + "formula": true, + "formulaForIf": true + }, + "required": [ + "type", + "fields" + ], + "description": "条件组合控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/condition-builder" + }, + "ConditionBuilderFuncs": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/ConditionFieldFunc" + }, + { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/ConditionFieldFunc" + } + } + }, + "required": [ + "label", + "children" + ], + "additionalProperties": false + } + ] + } + }, + "ConditionFieldFunc": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "returnType": { + "$ref": "#/definitions/FieldTypes" + }, + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/ConditionBuilderFuncArg" + } + }, + "label": { + "type": "string" + } + }, + "required": [ + "type", + "returnType", + "args", + "label" + ], + "additionalProperties": false + }, + "FieldTypes": { + "type": "string", + "enum": [ + "text", + "number", + "boolean", + "date", + "time", + "datetime", + "select", + "custom" + ] + }, + "ConditionBuilderFuncArg": { + "allOf": [ + { + "type": "object", + "properties": { + "isOptional": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": true, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "isOptional": true + } + }, + "ConditionBuilderFields": { + "type": "array", + "items": { + "$ref": "#/definitions/ConditionBuilderField" + } + }, + "ConditionBuilderField": { + "anyOf": [ + { + "$ref": "#/definitions/FieldSimple" + }, + { + "$ref": "#/definitions/FieldGroup" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "group" + }, + "label": { + "type": "string" + }, + "name": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/FieldSimple" + } + } + }, + "required": [ + "type", + "label", + "name", + "children" + ], + "additionalProperties": false + } + ] + }, + "FieldSimple": { + "anyOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "const": "text" + }, + "minLength": { + "type": "number" + }, + "maxLength": { + "type": "number" + } + }, + "required": [ + "name", + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "minLength": true, + "maxLength": true + }, + "required": [ + "name", + "type" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "const": "number" + }, + "maximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "step": { + "type": "number" + }, + "precision": { + "type": "number" + } + }, + "required": [ + "name", + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "number" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "maximum": true, + "minimum": true, + "step": true, + "precision": true + }, + "required": [ + "name", + "type" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "const": "date" + }, + "format": { + "type": "string" + }, + "inputFormat": { + "type": "string" + }, + "minDate": {}, + "maxDate": {} + }, + "required": [ + "name", + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "date" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "format": true, + "inputFormat": true, + "minDate": true, + "maxDate": true + }, + "required": [ + "name", + "type" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "const": "time" + }, + "minTime": {}, + "maxTime": {}, + "format": { + "type": "string" + }, + "inputFormat": { + "type": "string" + } + }, + "required": [ + "name", + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "time" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "minTime": true, + "maxTime": true, + "format": true, + "inputFormat": true + }, + "required": [ + "name", + "type" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "datetime" + }, + "name": { + "type": "string" + }, + "format": { + "type": "string" + }, + "inputFormat": { + "type": "string" + }, + "timeFormat": { + "type": "string" + } + }, + "required": [ + "type", + "name" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "datetime" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "format": true, + "inputFormat": true, + "timeFormat": true + }, + "required": [ + "type", + "name" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "select" + }, + "name": { + "type": "string" + }, + "multiple": { + "type": "boolean" + }, + "options": { + "type": "array", + "items": {} + }, + "source": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ] + }, + "searchable": { + "type": "boolean" + }, + "maxTagCount": { + "type": "number" + }, + "overflowTagPopover": {}, + "autoComplete": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/BaseApiObject" + } + ], + "description": "自动完成 API,当输入部分文字的时候,会将这些文字通过 ${term} 可以取到,发送给接口。 接口可以返回匹配到的选项,帮助用户输入。" + } + }, + "required": [ + "type", + "name" + ] + }, + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "select" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "multiple": true, + "options": true, + "source": true, + "searchable": true, + "maxTagCount": true, + "overflowTagPopover": true, + "autoComplete": true + }, + "required": [ + "type", + "name" + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "boolean" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true + }, + "required": [ + "type", + "name" + ] + }, + { + "$ref": "#/definitions/CustomField" + } + ] + }, + "CustomField": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FieldTypes" + }, + "label": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "operators": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "lable": { + "type": "string" + }, + "value": { + "type": "string" + }, + "values": { + "type": "array", + "items": {} + } + }, + "required": [ + "lable", + "value" + ], + "additionalProperties": false + } + ] + } + }, + "funcs": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultValue": {}, + "placeholder": { + "type": "string" + }, + "disabled": { + "type": "boolean" + } + }, + "required": [ + "type", + "label" + ] + } + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "const": "custom" + }, + "label": true, + "valueTypes": true, + "operators": true, + "funcs": true, + "defaultValue": true, + "placeholder": true, + "disabled": true, + "name": true, + "value": true + }, + "required": [ + "type", + "name", + "value" + ] + }, + "FieldGroup": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/FieldSimple" + } + } + }, + "required": [ + "label", + "children" + ], + "additionalProperties": false + }, + "ConditionBuilderConfig": { + "type": "object", + "properties": { + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + }, + "fields": { + "$ref": "#/definitions/ConditionBuilderFields" + }, + "funcs": { + "$ref": "#/definitions/ConditionBuilderFuncs" + }, + "maxLevel": { + "type": "number" + }, + "types": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ConditionBuilderType" + } + } + }, + "required": [ + "types" + ], + "additionalProperties": false + }, + "ConditionBuilderType": { + "type": "object", + "properties": { + "defaultOp": { + "$ref": "#/definitions/OperatorType" + }, + "operators": { + "type": "array", + "items": { + "$ref": "#/definitions/OperatorType" + } + }, + "placeholder": { + "type": "string" + }, + "valueTypes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "value", + "field", + "func" + ] + } + } + }, + "required": [ + "operators" + ], + "additionalProperties": false + }, + "BaseInputFormulaControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "evalMode": { + "type": "boolean", + "description": "evalMode 即直接就是表达式,否则 需要 ${这里面才是表达式} 默认为 true" + }, + "mixedMode": { + "type": "boolean", + "description": "混合模式,意味着这个输入框既可以输入不同文本 也可以输入公式。 当输入公式时,值格式为 ${公式内容} 其他内容当字符串。" + }, + "variables": { + "type": "array", + "items": { + "$ref": "#/definitions/VariableItem" + }, + "description": "用于提示的变量集合,默认为空" + }, + "variableMode": { + "type": "string", + "enum": [ + "tabs", + "tree" + ], + "description": "变量展现模式,可选值:'tabs' | 'tree'" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/FuncGroup" + }, + "description": "函数集合,默认不需要传,即 amis-formula 里面那个函数 如果有扩充,则需要传。" + }, + "title": { + "type": "string", + "description": "编辑器标题" + }, + "header": { + "type": "string", + "description": "顶部标题,默认为表达式" + }, + "inputMode": { + "type": "string", + "enum": [ + "button", + "input-button", + "input-group" + ], + "description": "控件模式" + }, + "allowInput": { + "type": "boolean", + "description": "外层input是否允许输入,否需要点击fx在弹窗中输入" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "按钮图标" + }, + "btnLabel": { + "type": "string", + "description": "按钮Label,inputMode为button时生效" + }, + "level": { + "type": "string", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary", + "dark", + "light" + ], + "description": "按钮样式" + }, + "btnSize": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "description": "按钮大小" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "placeholder": { + "type": "string", + "description": "输入框占位符" + }, + "variableClassName": { + "type": "string", + "description": "变量面板CSS样式类名" + }, + "functionClassName": { + "type": "string", + "description": "函数面板CSS样式类名" + }, + "selfVariableName": { + "type": "string", + "description": "当前输入项字段 name: 用于避免循环绑定自身导致无限渲染" + }, + "inputSettings": { + "$ref": "#/definitions/FormulaPickerInputSettings", + "description": "输入框的类型" + } + }, + "required": [ + "variables", + "functions", + "header" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true, + "evalMode": true, + "mixedMode": true, + "variables": true, + "variableMode": true, + "functions": true, + "title": true, + "header": true, + "inputMode": true, + "allowInput": true, + "icon": true, + "btnLabel": true, + "level": true, + "btnSize": true, + "borderMode": true, + "variableClassName": true, + "functionClassName": true, + "selfVariableName": true, + "inputSettings": true + }, + "required": [ + "variables", + "functions", + "header" + ], + "description": "InputFormula 公式编辑器 文档:https://baidu.gitee.io/amis/zh-CN/components/form/input-formula" + }, + "VariableItem": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + }, + "path": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/VariableItem" + } + }, + "type": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "selectMode": { + "type": "string", + "enum": [ + "tree", + "tabs" + ] + }, + "isMember": { + "type": "boolean" + } + }, + "required": [ + "label" + ], + "additionalProperties": false + }, + "FuncGroup": { + "type": "object", + "properties": { + "groupName": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/FuncItem" + } + } + }, + "required": [ + "groupName", + "items" + ], + "additionalProperties": false + }, + "FuncItem": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "example": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "FormulaPickerInputSettings": { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/FormulaPickerInputSettingType" + } + }, + "required": [ + "type" + ] + }, + "FormulaPickerInputSettingType": { + "type": "string", + "enum": [ + "text", + "number", + "boolean", + "date", + "time", + "datetime", + "select", + "custom" + ] + }, + "DateControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-date", + "description": "指定为日期选择控件" + }, + "format": { + "type": "string", + "description": "日期存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "日期展示格式", + "default": "YYYY-MM-DD" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + }, + "closeOnSelect": { + "type": "boolean", + "description": "点选日期后是否关闭弹窗" + }, + "minDate": { + "type": "string", + "description": "限制最小日期" + }, + "maxDate": { + "type": "string", + "description": "限制最大日期" + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹窗容器选择器" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-date" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true, + "closeOnSelect": true, + "minDate": true, + "maxDate": true, + "popOverContainerSelector": true + }, + "required": [ + "type" + ], + "description": "Date日期选择控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/date" + }, + "InputDateBaseControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input-date", + "input-datetime", + "input-time", + "input-month", + "input-quarter", + "input-year" + ], + "description": "指定为日期选择控件" + }, + "clearable": { + "type": "boolean", + "description": "是否显示清除按钮" + }, + "format": { + "type": "string", + "description": "日期存储格式" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "inputFormat": { + "type": "string", + "description": "日期展示格式" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + }, + "utc": { + "type": "boolean", + "description": "设定是否存储 utc 时间。" + }, + "emebed": { + "type": "boolean", + "description": "是否为内联模式?" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "shortcuts": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/ShortCuts" + } + } + ], + "description": "日期快捷键" + }, + "disabledDate": { + "type": "string", + "description": "字符串函数,用来决定是否禁用某个日期。\n\n(currentDate: moment.Moment, props: any) => boolean;" + }, + "inputForbid": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "enum": [ + "input-date", + "input-datetime", + "input-time", + "input-month", + "input-quarter", + "input-year" + ] + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true + }, + "required": [ + "type" + ] + }, + "ShortCuts": { + "anyOf": [ + { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "label", + "value" + ], + "additionalProperties": false + }, + { + "$ref": "#/definitions/ShortCutDate" + }, + { + "$ref": "#/definitions/ShortCutDateRange" + } + ] + }, + "ShortCutDate": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "date": { + "type": "string", + "description": "支持表达式" + } + }, + "required": [ + "label", + "date" + ], + "additionalProperties": false + }, + "ShortCutDateRange": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "startDate": { + "type": "string" + }, + "endDate": { + "type": "string" + } + }, + "required": [ + "label" + ], + "additionalProperties": false + }, + "DateTimeControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-datetime", + "description": "指定为日期时间选择控件" + }, + "format": { + "type": "string", + "description": "日期存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "日期展示格式", + "default": "YYYY-MM-DD HH:mm" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + }, + "timeFormat": { + "type": "string", + "description": "时间的格式。", + "default": "HH:mm" + }, + "minDate": { + "type": "string", + "description": "限制最小日期" + }, + "maxDate": { + "type": "string", + "description": "限制最大日期" + }, + "timeConstraints": { + "description": "时间输入范围限制" + }, + "isEndDate": { + "type": "boolean", + "description": "是否为结束时间,如果是,那么会自动加上 23:59:59" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-datetime" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true, + "timeFormat": true, + "minDate": true, + "maxDate": true, + "timeConstraints": true, + "isEndDate": true + }, + "required": [ + "type" + ], + "description": "Datetime日期时间选择控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/datetime" + }, + "TimeControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-time", + "description": "指定为日期时间选择控件" + }, + "format": { + "type": "string", + "description": "日期存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "日期展示格式", + "default": "YYYY-MM-DD HH:mm" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + }, + "timeFormat": { + "type": "string", + "description": "时间的格式。", + "default": "HH:mm" + }, + "timeConstraints": { + "description": "时间输入范围限制" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-time" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true, + "timeFormat": true, + "timeConstraints": true + }, + "required": [ + "type" + ], + "description": "Time 时间选择控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/time" + }, + "MonthControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-month", + "description": "指定为月份时间选择控件" + }, + "format": { + "type": "string", + "description": "月份存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "月份展示格式", + "default": "YYYY-MM" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-month" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true + }, + "required": [ + "type" + ], + "description": "Month 月份选择控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/Month" + }, + "QuarterControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-quarter", + "description": "指定为月份时间选择控件" + }, + "format": { + "type": "string", + "description": "月份存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "月份展示格式", + "default": "YYYY-MM" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-quarter" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true + }, + "required": [ + "type" + ], + "description": "季度选择控件" + }, + "YearControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-year", + "description": "指定为月份时间选择控件" + }, + "format": { + "type": "string", + "description": "月份存储格式", + "default": "X" + }, + "inputFormat": { + "type": "string", + "description": "月份展示格式", + "default": "YYYY-MM" + }, + "valueFormat": { + "type": "string", + "description": "替代format" + }, + "displayFormat": { + "type": "string", + "description": "日期展示格式(新:替代inputFormat)" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/InputDateBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-year" + }, + "clearable": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "utc": true, + "emebed": true, + "borderMode": true, + "shortcuts": true, + "disabledDate": true, + "inputForbid": true + }, + "required": [ + "type" + ], + "description": "年份选择控件" + }, + "DateRangeControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseDateRangeControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "enum": [ + "input-date-range", + "input-datetime-range", + "input-time-range" + ] + }, + "delimiter": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "joinValues": true, + "maxDate": true, + "minDate": true, + "maxDuration": true, + "minDuration": true, + "borderMode": true, + "embed": true, + "ranges": true, + "shortcuts": true, + "startPlaceholder": true, + "endPlaceholder": true, + "animation": true, + "transform": true, + "popOverContainerSelector": true + }, + "required": [ + "type" + ], + "description": "DateRange 日期范围控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/date-range" + }, + "BaseDateRangeControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "delimiter": { + "type": "string", + "description": "分割符, 因为有两个值,开始时间和结束时间,所以要有连接符。默认为英文逗号。" + }, + "format": { + "type": "string", + "description": "默认 `X` 即时间戳格式,用来提交的时间格式。更多格式类型请参考 moment." + }, + "valueFormat": { + "type": "string", + "description": "用来提交的时间格式。更多格式类型请参考 moment.(新:同format)" + }, + "inputFormat": { + "type": "string", + "description": "默认 `YYYY-MM-DD` 用来配置显示的时间格式。" + }, + "displayFormat": { + "type": "string", + "description": "用来配置显示的时间格式(新:同inputFormat)" + }, + "joinValues": { + "type": "boolean", + "description": "开启后将选中的选项 value 的值用连接符拼接起来,作为当前表单项的值。如: `value1,value2` 否则为 `[value1, value2]`" + }, + "maxDate": { + "type": "string", + "description": "最大日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\\n * `+2days` 2天后\\n* `-10week` 十周前\\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + }, + "minDate": { + "type": "string", + "description": "最小日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\\n * `+2days` 2天后\\n* `-10week` 十周前\\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + }, + "maxDuration": { + "type": "string", + "description": "最大跨度,比如 2days" + }, + "minDuration": { + "type": "string", + "description": "最小跨度,比如 2days" + }, + "value": { + "description": "这里面 value 需要特殊说明一下,因为支持相对值。* `-2mins` 2分钟前\\n * `+2days` 2天后\\n* `-10week` 十周前\\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "embed": { + "type": "boolean", + "description": "开启后变成非弹出模式,即内联模式。" + }, + "ranges": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/ShortCuts" + } + } + ], + "description": "日期范围快捷键", + "deprecated": "3.1.0及以后版本废弃,建议用 shortcuts 属性。" + }, + "shortcuts": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/ShortCuts" + } + } + ], + "description": "日期范围快捷键" + }, + "startPlaceholder": { + "type": "string", + "description": "日期范围开始时间-占位符" + }, + "endPlaceholder": { + "type": "string", + "description": "日期范围结束时间-占位符" + }, + "animation": { + "type": "boolean", + "description": "是否启用游标动画,默认开启" + }, + "transform": { + "type": "string", + "description": "日期数据处理函数,用来处理选择日期之后的的值\n\n(value: moment.Moment, config: {type: 'start' | 'end'; originValue: moment.Moment, timeFormat: string}, props: any, data: any, moment: moment) => moment.Moment;" + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹窗容器选择器" + } + } + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true, + "delimiter": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "joinValues": true, + "maxDate": true, + "minDate": true, + "maxDuration": true, + "minDuration": true, + "borderMode": true, + "embed": true, + "ranges": true, + "shortcuts": true, + "startPlaceholder": true, + "endPlaceholder": true, + "animation": true, + "transform": true, + "popOverContainerSelector": true + } + }, + "DiffControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "diff-editor", + "description": "指定为 Diff 编辑器" + }, + "diffValue": { + "$ref": "#/definitions/SchemaTokenizeableString", + "description": "左侧面板的值, 支持取变量。" + }, + "language": { + "type": "string", + "description": "语言,参考 monaco-editor" + }, + "options": { + "description": "编辑器配置" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "diff-editor" + }, + "diffValue": true, + "language": true, + "options": true + }, + "required": [ + "type" + ], + "description": "Diff 编辑器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/diff" + }, + "EditorControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor" + ] + }, + "language": { + "type": "string", + "enum": [ + "bat", + "c", + "coffeescript", + "cpp", + "csharp", + "css", + "dockerfile", + "fsharp", + "go", + "handlebars", + "html", + "ini", + "java", + "javascript", + "json", + "less", + "lua", + "markdown", + "msdax", + "objective-c", + "php", + "plaintext", + "postiats", + "powershell", + "pug", + "python", + "r", + "razor", + "ruby", + "sb", + "scss", + "shell", + "sol", + "sql", + "swift", + "typescript", + "vb", + "xml", + "yaml" + ], + "description": "语言类型" + }, + "size": { + "type": "string", + "enum": [ + "sm", + "md", + "lg", + "xl", + "xxl" + ], + "description": "编辑器大小" + }, + "allowFullscreen": { + "type": "boolean", + "description": "是否展示全屏模式开关" + }, + "editorDidMount": { + "type": "string", + "description": "获取编辑器底层实例" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/FormBaseControlWithoutSize", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor" + ] + }, + "language": true, + "size": true, + "allowFullscreen": true, + "editorDidMount": true + }, + "required": [ + "type" + ], + "description": "Editor 代码编辑器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/editor" + }, + "FieldSetControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "fieldset", + "fieldSet" + ], + "description": "指定为表单项集合" + }, + "titlePosition": { + "type": "string", + "enum": [ + "top", + "bottom" + ], + "description": "标题展示位置" + }, + "collapsable": { + "type": "boolean", + "description": "是否可折叠" + }, + "collapsed": { + "type": "boolean", + "description": "默认是否折叠" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "内容区域" + }, + "title": { + "$ref": "#/definitions/SchemaTpl", + "description": "标题" + }, + "collapseTitle": { + "$ref": "#/definitions/SchemaTpl", + "description": "收起的标题" + }, + "mountOnEnter": { + "type": "boolean", + "description": "点开时才加载内容" + }, + "unmountOnExit": { + "type": "boolean", + "description": "卡片隐藏就销毁内容。" + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + } + }, + "required": [ + "type", + "titlePosition" + ] + }, + { + "$ref": "#/definitions/FormBaseControlWithoutSize", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseSchemaWithoutType", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseCollapseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "enum": [ + "fieldset", + "fieldSet" + ] + }, + "testid": true, + "key": true, + "headerPosition": true, + "header": true, + "bodyClassName": true, + "collapsable": true, + "collapsed": true, + "showArrow": true, + "expandIcon": true, + "headingClassName": true, + "collapseHeader": true, + "size": true, + "mountOnEnter": true, + "unmountOnExit": true, + "divideLine": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "titlePosition": true, + "body": true, + "title": true, + "collapseTitle": true, + "subFormMode": true, + "subFormHorizontal": true + }, + "required": [ + "type", + "titlePosition" + ], + "description": "FieldSet 表单项集合 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/fieldset" + }, + "FileControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-file", + "description": "指定为文件上传" + }, + "btnLabel": { + "type": "string", + "description": "上传文件按钮说明", + "default": "请选择文件" + }, + "accept": { + "type": "string", + "description": "默认只支持纯文本,要支持其他类型,请配置此属性。建议直接填写文件后缀 如:.txt,.csv\n\n多个类型用逗号隔开。", + "default": "text/plain" + }, + "capture": { + "type": "string", + "description": "控制 input 标签的 capture 属性,用于移动端拍照或录像。" + }, + "asBase64": { + "type": "boolean", + "description": "如果上传的文件比较小可以设置此选项来简单的把文件 base64 的值给 form 一起提交,目前不支持多选。" + }, + "asBlob": { + "type": "boolean", + "description": "如果不希望 File 组件上传,可以配置 `asBlob` 或者 `asBase64`,采用这种方式后,组件不再自己上传了,而是直接把文件数据作为表单项的值,文件内容会在 Form 表单提交的接口里面一起带上。" + }, + "autoUpload": { + "type": "boolean", + "description": "是否自动开始上传" + }, + "chunkApi": { + "$ref": "#/definitions/SchemaApi", + "description": "默认 `/api/upload/chunk` 想自己存储时才需要关注。" + }, + "chunkSize": { + "type": "number", + "description": "分块大小,默认为 5M.", + "default": 5242880 + }, + "concurrency": { + "type": "number", + "description": "分块上传的并发数" + }, + "delimiter": { + "type": "string", + "description": "分割符" + }, + "downloadUrl": { + "$ref": "#/definitions/SchemaApi", + "description": "默认显示文件路径的时候会支持直接下载, 可以支持加前缀如:`http://xx.dom/filename=` , 如果不希望这样,可以把当前配置项设置为 `false`。\n\n1.1.6 版本开始将支持变量 ${xxx} 来自己拼凑个下载地址,并且支持配置成 post." + }, + "templateUrl": { + "$ref": "#/definitions/SchemaApi", + "description": "模板下载地址" + }, + "fileField": { + "type": "string", + "description": "默认 `file`, 如果你不想自己存储,则可以忽略此属性。", + "default": "file" + }, + "finishChunkApi": { + "$ref": "#/definitions/SchemaApi", + "description": "默认 `/api/upload/finishChunkApi` 想自己存储时才需要关注。", + "default": "/api/upload/finishChunkApi" + }, + "hideUploadButton": { + "type": "boolean", + "description": "是否隐藏上传按钮" + }, + "maxLength": { + "type": "number", + "description": "最多的个数" + }, + "maxSize": { + "type": "number", + "description": "默认没有限制,当设置后,文件大小大于此值将不允许上传。" + }, + "receiver": { + "$ref": "#/definitions/SchemaApi", + "description": "默认 `/api/upload/file` 如果想自己存储,请设置此选项。", + "default": "/api/upload/file" + }, + "startChunkApi": { + "type": "string", + "description": "默认 `/api/upload/startChunk` 想自己存储时才需要关注。", + "default": "/api/upload/startChunk" + }, + "useChunk": { + "anyOf": [ + { + "type": "string", + "const": "auto" + }, + { + "type": "boolean" + } + ], + "description": "默认为 'auto' amis 所在服务器,限制了文件上传大小不得超出10M,所以 amis 在用户选择大文件的时候,自动会改成分块上传模式。" + }, + "btnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "按钮 CSS 类名" + }, + "btnUploadClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "上传按钮 CSS 类名" + }, + "multiple": { + "type": "boolean", + "description": "是否为多选" + }, + "joinValues": { + "type": "boolean", + "description": "1. 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交, 否则,整个选项对象都会作为该表单项的值提交。 2. 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来, 否则直接将以数组的形式提交值。" + }, + "extractValue": { + "type": "boolean", + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。" + }, + "resetValue": { + "description": "清除时设置的值" + }, + "autoFill": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SchemaTokenizeableString" + }, + "description": "上传后把其他字段同步到表单内部。" + }, + "initAutoFill": { + "type": "boolean", + "description": "初始化时是否把其他字段同步到表单内部。" + }, + "valueField": { + "type": "string", + "description": "接口返回的数据中,哪个用来当做值" + }, + "nameField": { + "type": "string", + "description": "接口返回的数据中,哪个用来展示文件名" + }, + "urlField": { + "type": "string", + "description": "接口返回的数据中哪个用来作为下载地址。" + }, + "stateTextMap": { + "type": "object", + "properties": { + "init": { + "type": "string" + }, + "pending": { + "type": "string" + }, + "uploading": { + "type": "string" + }, + "error": { + "type": "string" + }, + "uploaded": { + "type": "string" + }, + "ready": { + "type": "string" + } + }, + "required": [ + "init", + "pending", + "uploading", + "error", + "uploaded", + "ready" + ], + "additionalProperties": false, + "description": "按钮状态文案配置。" + }, + "documentation": { + "type": "string", + "description": "说明文档内容配置" + }, + "documentLink": { + "type": "string", + "description": "说明文档链接配置" + }, + "drag": { + "type": "boolean", + "description": "是否为拖拽上传" + }, + "invalidTypeMessage": { + "type": "string", + "description": "校验格式失败时显示的文字信息" + }, + "invalidSizeMessage": { + "type": "string", + "description": "校验文件大小失败时显示的文字信息" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-file" + }, + "btnLabel": true, + "accept": true, + "capture": true, + "asBase64": true, + "asBlob": true, + "autoUpload": true, + "chunkApi": true, + "chunkSize": true, + "concurrency": true, + "delimiter": true, + "downloadUrl": true, + "templateUrl": true, + "fileField": true, + "finishChunkApi": true, + "hideUploadButton": true, + "maxLength": true, + "maxSize": true, + "receiver": true, + "startChunkApi": true, + "useChunk": true, + "btnClassName": true, + "btnUploadClassName": true, + "multiple": true, + "joinValues": true, + "extractValue": true, + "resetValue": true, + "valueField": true, + "nameField": true, + "urlField": true, + "stateTextMap": true, + "documentation": true, + "documentLink": true, + "drag": true, + "invalidTypeMessage": true, + "invalidSizeMessage": true + }, + "required": [ + "type" + ], + "description": "File 文件上传控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/file" + }, + "FormulaControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "formula", + "description": "指定为公式功能控件。" + }, + "id": { + "type": "string", + "description": "当某个按钮的目标指定为此值后,会触发一次公式应用。这个机制可以在 autoSet 为 false 时用来手动触发" + }, + "condition": { + "type": "string", + "description": "触发公式的作用条件,如 data.xxx == \\\"a\\\" 或者 ${xx}" + }, + "autoSet": { + "type": "boolean", + "description": "是否自动应用" + }, + "formula": { + "type": "string", + "description": "公式" + }, + "initSet": { + "type": "boolean", + "description": "是否初始应用" + }, + "name": { + "type": "string", + "description": "字段名,公式结果将作用到此处指定的变量中去" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "formula" + }, + "condition": true, + "autoSet": true, + "formula": true, + "initSet": true + }, + "required": [ + "type" + ], + "description": "公式功能控件。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formula" + }, + "GroupControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "group" + }, + "body": { + "type": "array", + "items": { + "$ref": "#/definitions/GroupSubControl" + }, + "description": "FormItem 集合" + }, + "gap": { + "type": "string", + "enum": [ + "xs", + "sm", + "normal" + ], + "description": "间隔" + }, + "direction": { + "type": "string", + "enum": [ + "horizontal", + "vertical" + ], + "description": "配置时垂直摆放还是左右摆放。" + }, + "subFormMode": { + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ], + "description": "配置子表单项默认的展示方式。" + }, + "subFormHorizontal": { + "$ref": "#/definitions/FormHorizontal", + "description": "如果是水平排版,这个属性可以细化水平排版的左右宽度占比。" + } + }, + "required": [ + "type", + "body" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "group" + }, + "body": true, + "gap": true, + "direction": true, + "subFormMode": true, + "subFormHorizontal": true + }, + "required": [ + "type", + "body" + ], + "description": "Group 表单集合渲染器,能让多个表单在一行显示 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/group" + }, + "GroupSubControl": { + "allOf": [ + { + "$ref": "#/definitions/SchemaObjectLoose" + }, + { + "type": "object", + "properties": { + "columnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "列类名" + }, + "columnRatio": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "const": "auto" + } + ], + "description": "宽度占用比率。在某些容器里面有用比如 group" + }, + "name": { + "type": "string", + "description": "列名称" + } + }, + "additionalProperties": true + } + ] + }, + "HiddenControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "hidden" + } + }, + "required": [ + "type" + ], + "description": "Hidden 隐藏域。功能性组件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/hidden" + }, + "IconPickerControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "icon-picker" + } + }, + "required": [ + "type" + ], + "description": "图标选择器 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/icon-picker" + }, + "ImageControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "showErrorModal": { + "type": "boolean", + "description": "格式校验失败是否显示弹窗" + }, + "invalidTypeMessage": { + "type": "string", + "description": "校验格式失败时显示的文字信息" + }, + "invalidSizeMessage": { + "type": "string", + "description": "校验文件大小失败时显示的文字信息" + }, + "type": { + "type": "string", + "const": "input-image", + "description": "指定为图片上传控件" + }, + "src": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "默认展示图片的链接" + }, + "imageClassName": { + "type": "string", + "description": "默认展示图片的类名" + }, + "accept": { + "type": "string", + "description": "配置接收的图片类型\n\n建议直接填写文件后缀 如:.txt,.csv\n\n多个类型用逗号隔开。" + }, + "allowInput": { + "type": "boolean", + "description": "默认都是通过用户选择图片后上传返回图片地址,如果开启此选项,则可以允许用户图片地址。" + }, + "autoUpload": { + "type": "boolean", + "description": "是否自动开始上传" + }, + "uploadBtnText": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/TplSchema" + } + ], + "description": "上传按钮文案" + }, + "btnClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "选择图片按钮的 CSS 类名" + }, + "btnUploadClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "上传按钮的 CSS 类名" + }, + "compress": { + "type": "boolean", + "deprecated": true + }, + "compressOptions": { + "type": "object", + "properties": { + "maxHeight": { + "type": "number" + }, + "maxWidth": { + "type": "number" + } + }, + "additionalProperties": false, + "deprecated": true + }, + "crop": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "object", + "properties": { + "aspectRatio": { + "type": "number", + "description": "默认 `1` 即 `1:1`\n\n留空将不限制" + }, + "guides": { + "type": "boolean" + }, + "dragMode": { + "type": "string" + }, + "viewMode": { + "type": "number" + }, + "rotatable": { + "type": "boolean" + }, + "scalable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ] + }, + "cropFormat": { + "type": "string", + "description": "裁剪后的图片类型" + }, + "cropQuality": { + "type": "number", + "description": "裁剪后的质量" + }, + "reCropable": { + "type": "boolean", + "description": "是否允许二次裁剪。" + }, + "hideUploadButton": { + "type": "boolean", + "description": "是否隐藏上传按钮" + }, + "limit": { + "type": "object", + "properties": { + "aspectRatioLabel": { + "type": "string", + "description": "比率不对时的提示文字" + }, + "aspectRatio": { + "type": "number", + "description": "限制比率" + }, + "height": { + "type": "number", + "description": "限制图片高度" + }, + "width": { + "type": "number", + "description": "限制图片宽度" + }, + "maxHeight": { + "type": "number", + "description": "限制图片最大高度" + }, + "maxWidth": { + "type": "number", + "description": "限制图片最大宽度" + }, + "minHeight": { + "type": "number", + "description": "限制图片最小高度" + }, + "minWidth": { + "type": "number", + "description": "限制图片最小宽度" + } + }, + "additionalProperties": false, + "description": "限制图片大小,超出不让上传。" + }, + "maxLength": { + "type": "number", + "description": "最多的个数" + }, + "maxSize": { + "type": "number", + "description": "默认没有限制,当设置后,文件大小大于此值将不允许上传。" + }, + "receiver": { + "$ref": "#/definitions/SchemaApi", + "description": "默认 `/api/upload` 如果想自己存储,请设置此选项。" + }, + "showCompressOptions": { + "type": "boolean", + "description": "默认为 false, 开启后,允许用户输入压缩选项。", + "deprecated": true + }, + "multiple": { + "type": "boolean", + "description": "是否为多选" + }, + "capture": { + "type": "string", + "description": "可配置移动端的拍照功能,比如配置 `camera` 移动端只能拍照,等" + }, + "joinValues": { + "type": "boolean", + "description": "单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。" + }, + "delimiter": { + "type": "string", + "description": "分割符" + }, + "extractValue": { + "type": "boolean", + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。" + }, + "resetValue": { + "description": "清除时设置的值" + }, + "thumbMode": { + "type": "string", + "enum": [ + "w-full", + "h-full", + "contain", + "cover" + ], + "description": "缩路图展示模式" + }, + "thumbRatio": { + "type": "string", + "enum": [ + "1:1", + "4:3", + "16:9" + ], + "description": "缩路图展示比率。" + }, + "autoFill": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SchemaTokenizeableString" + }, + "description": "上传后把其他字段同步到表单内部。" + }, + "initAutoFill": { + "type": "boolean", + "description": "初始化时是否把其他字段同步到表单内部。" + }, + "initCrop": { + "type": "boolean", + "description": "初始化时是否打开裁剪模式" + }, + "dropCrop": { + "type": "boolean", + "description": "图片上传完毕是否进入裁剪模式" + }, + "frameImage": { + "$ref": "#/definitions/SchemaUrlPath", + "description": "默认占位图图片地址" + }, + "fixedSize": { + "type": "boolean", + "description": "是否开启固定尺寸" + }, + "fixedSizeClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "固定尺寸的 CSS类名" + }, + "draggable": { + "type": "boolean", + "description": "是否可拖拽排序" + }, + "draggableTip": { + "type": "string", + "description": "可拖拽排序的提示信息。", + "default": "可拖拽排序" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-image" + }, + "showErrorModal": true, + "invalidTypeMessage": true, + "invalidSizeMessage": true, + "src": true, + "imageClassName": true, + "accept": true, + "allowInput": true, + "autoUpload": true, + "uploadBtnText": true, + "btnClassName": true, + "btnUploadClassName": true, + "compress": true, + "compressOptions": true, + "crop": true, + "cropFormat": true, + "cropQuality": true, + "reCropable": true, + "hideUploadButton": true, + "limit": true, + "maxLength": true, + "maxSize": true, + "receiver": true, + "showCompressOptions": true, + "multiple": true, + "capture": true, + "joinValues": true, + "delimiter": true, + "extractValue": true, + "resetValue": true, + "thumbMode": true, + "thumbRatio": true, + "initCrop": true, + "dropCrop": true, + "frameImage": true, + "fixedSize": true, + "fixedSizeClassName": true, + "draggable": true, + "draggableTip": true + }, + "required": [ + "type" + ], + "description": "Image 图片上传控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/image" + }, + "InputGroupControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-group" + }, + "body": { + "$ref": "#/definitions/SchemaCollection", + "description": "FormItem 集合" + }, + "validationConfig": { + "type": "object", + "properties": { + "errorMode": { + "type": "string", + "enum": [ + "full", + "partial" + ], + "description": "错误提示的展示模式, full为整体飘红, highlight为仅错误项飘红, 默认为full" + }, + "delimiter": { + "type": "string", + "description": "单个子元素多条校验信息的分隔符" + } + }, + "additionalProperties": false, + "description": "校验提示信息配置" + } + }, + "required": [ + "type", + "body" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-group" + }, + "body": true, + "validationConfig": true + }, + "required": [ + "type", + "body" + ], + "description": "InputGroup 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-group" + }, + "ListControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "list-select", + "description": "指定为 ListSelect 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/list-select" + }, + "submitOnDBClick": { + "type": "boolean", + "description": "开启双击点选并提交。" + }, + "imageClassName": { + "type": "string", + "description": "图片div类名" + }, + "itemSchema": { + "$ref": "#/definitions/SchemaCollection", + "description": "可以自定义展示模板。" + }, + "activeItemSchema": { + "$ref": "#/definitions/SchemaCollection", + "description": "激活态自定义展示模板。" + }, + "listClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "支持配置 list div 的 css 类名。 比如:flex justify-between" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "list-select" + }, + "submitOnDBClick": true, + "imageClassName": true, + "itemSchema": true, + "activeItemSchema": true, + "listClassName": true + }, + "required": [ + "type" + ], + "description": "List 复选框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/list-select" + }, + "JSONSchemaEditorControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "json-schema-editor", + "description": "指定为 JSON Schema Editor" + }, + "definitions": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "object", + "array", + "boolean", + "null" + ] + } + }, + "required": [ + "title", + "type" + ] + }, + "description": "可以理解为类型模板,方便快速定义复杂类型" + }, + "rootTypeMutable": { + "type": "boolean", + "description": "顶层是否允许修改类型" + }, + "showRootInfo": { + "type": "boolean", + "description": "顶层类型信息是否隐藏" + }, + "disabledTypes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "禁用类型,默认禁用了 null 类型" + }, + "enableAdvancedSetting": { + "type": "boolean", + "description": "开启详情配置" + }, + "advancedSettings": { + "type": "object", + "description": "自定义详情配置面板如:\n\n{ boolean: [ {type: \"input-text\", name: \"aa\", label: \"AA\" } ] }\n\n当配置布尔字段详情时,就会出现以上配置" + }, + "placeholder": { + "$ref": "#/definitions/SchemaEditorItemPlaceholder", + "description": "各属性输入控件的占位提示文本\n\n{ key: \"key placeholder\", title: \"title placeholder\", description: \"description placeholder\", default: \"default placeholder\" }" + }, + "mini": { + "type": "boolean", + "description": "是否为迷你模式,会隐藏一些不必要的元素" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "json-schema-editor" + }, + "definitions": true, + "rootTypeMutable": true, + "showRootInfo": true, + "disabledTypes": true, + "enableAdvancedSetting": true, + "advancedSettings": true, + "mini": true + }, + "required": [ + "type" + ], + "description": "JSON Schema Editor 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/json-schema-editor" + }, + "SchemaEditorItemPlaceholder": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": { + "type": "string" + }, + "empty": { + "type": "string" + } + }, + "additionalProperties": false + }, + "InputSignatureSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-signature" + }, + "width": { + "type": "number", + "description": "组件宽度,默认占满父容器" + }, + "height": { + "type": "number", + "description": "组件高度,默认占满父容器" + }, + "color": { + "type": "string", + "description": "组件字段颜色", + "default": "#000" + }, + "bgColor": { + "type": "string", + "description": "组件背景颜色", + "default": "#efefef" + }, + "clearBtnLabel": { + "type": "string", + "description": "清空按钮名称", + "default": "清空" + }, + "clearBtnIcon": { + "type": "string", + "description": "清空按钮图标", + "default": "清空" + }, + "undoBtnLabel": { + "type": "string", + "description": "撤销按钮名称", + "default": "撤销" + }, + "undoBtnIcon": { + "type": "string", + "description": "清空按钮图标", + "default": "清空" + }, + "confirmBtnLabel": { + "type": "string", + "description": "确认按钮名称", + "default": "确认" + }, + "confirmBtnIcon": { + "type": "string", + "description": "确认按钮图标", + "default": "确认" + }, + "embed": { + "type": "boolean", + "description": "是否内嵌" + }, + "embedConfirmLabel": { + "type": "string", + "description": "弹窗确认按钮名称" + }, + "embedConfirmIcon": { + "type": "string", + "description": "弹窗确认按钮图标" + }, + "ebmedCancelLabel": { + "type": "string", + "description": "弹窗取消按钮名称" + }, + "ebmedCancelIcon": { + "type": "string", + "description": "弹窗取消按钮图标" + }, + "embedBtnIcon": { + "type": "string", + "description": "弹窗按钮图标" + }, + "embedBtnLabel": { + "type": "string", + "description": "弹窗按钮文案" + }, + "uploadApi": { + "$ref": "#/definitions/SchemaApi", + "description": "上传签名图片api, 仅在内嵌模式下生效" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-signature" + }, + "width": true, + "height": true, + "color": true, + "bgColor": true, + "clearBtnLabel": true, + "clearBtnIcon": true, + "undoBtnLabel": true, + "undoBtnIcon": true, + "confirmBtnLabel": true, + "confirmBtnIcon": true, + "embed": true, + "embedConfirmLabel": true, + "embedConfirmIcon": true, + "ebmedCancelLabel": true, + "ebmedCancelIcon": true, + "embedBtnIcon": true, + "embedBtnLabel": true, + "uploadApi": true + }, + "required": [ + "type" + ] + }, + "LocationControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "location-picker" + }, + "vendor": { + "type": "string", + "enum": [ + "baidu", + "gaode", + "tenxun" + ], + "description": "选择地图类型" + }, + "ak": { + "type": "string", + "description": "有的地图需要设置 ak 信息" + }, + "autoSelectCurrentLoc": { + "type": "boolean", + "description": "是否自动选中当前地理位置" + }, + "onlySelectCurrentLoc": { + "type": "boolean", + "description": "是否限制只能选中当前地理位置 备注:可用于充当定位组件,只允许选择当前位置" + }, + "getLocationPlaceholder": { + "type": "string", + "description": "开启只读模式后的占位提示,默认为“点击获取位置信息” 备注:区分下现有的placeholder(“请选择位置”)" + }, + "hideViewControl": { + "type": "boolean", + "description": "是否隐藏地图控制组件,默认为false" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "location-picker" + }, + "vendor": true, + "ak": true, + "autoSelectCurrentLoc": true, + "onlySelectCurrentLoc": true, + "getLocationPlaceholder": true, + "hideViewControl": true + }, + "required": [ + "type" + ], + "description": "Location 选点组件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/location" + }, + "UUIDControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uuid" + }, + "length": { + "type": "number", + "description": "长度,默认 uuid 的长度是 36,如果不需要那么长,可以设置这个来缩短" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "uuid" + }, + "length": true + }, + "required": [ + "type" + ], + "description": "UUID 功能性组件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/uuid" + }, + "MatrixControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "matrix-checkboxes" + }, + "multiple": { + "type": "boolean", + "description": "配置singleSelectMode时设置为false" + }, + "singleSelectMode": { + "type": "boolean", + "description": "设置单选模式,multiple为false时有效" + }, + "source": { + "$ref": "#/definitions/SchemaApi", + "description": "可用来通过 API 拉取 options。" + }, + "columns": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + } + }, + "required": [ + "label" + ] + } + }, + "rows": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + } + }, + "required": [ + "label" + ] + } + }, + "rowLabel": { + "type": "string", + "description": "行标题说明" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "matrix-checkboxes" + }, + "multiple": true, + "singleSelectMode": true, + "source": true, + "columns": true, + "rows": true, + "rowLabel": true + }, + "required": [ + "type" + ], + "description": "Matrix 选择控件。适合做权限勾选。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/matrix" + }, + "MonthRangeControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseDateRangeControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-month-range" + }, + "delimiter": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "joinValues": true, + "maxDate": true, + "minDate": true, + "maxDuration": true, + "minDuration": true, + "borderMode": true, + "embed": true, + "ranges": true, + "shortcuts": true, + "startPlaceholder": true, + "endPlaceholder": true, + "animation": true, + "transform": true, + "popOverContainerSelector": true + }, + "required": [ + "type" + ], + "description": "MonthRange 月范围控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/month-range" + }, + "QuarterRangeControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseDateRangeControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-quarter-range" + }, + "delimiter": true, + "format": true, + "valueFormat": true, + "inputFormat": true, + "displayFormat": true, + "joinValues": true, + "maxDate": true, + "minDate": true, + "maxDuration": true, + "minDuration": true, + "borderMode": true, + "embed": true, + "ranges": true, + "shortcuts": true, + "startPlaceholder": true, + "endPlaceholder": true, + "animation": true, + "transform": true, + "popOverContainerSelector": true + }, + "required": [ + "type" + ], + "description": "QuarterRange 季度范围控件 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-quarter-range" + }, + "NestedSelectControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "nested-select", + "description": "指定为 NestedSelect 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/nested-select" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "menuClassName": { + "type": "string", + "description": "弹框的 css 类" + }, + "cascade": { + "type": "boolean", + "description": "父子之间是否完全独立。" + }, + "withChildren": { + "type": "boolean", + "description": "选父级的时候是否把子节点的值也包含在内。" + }, + "onlyChildren": { + "type": "boolean", + "description": "选父级的时候,是否只把子节点的值包含在内" + }, + "onlyLeaf": { + "type": "boolean", + "description": "只允许选择叶子节点" + }, + "hideNodePathLabel": { + "type": "boolean", + "description": "是否隐藏选择框中已选中节点的祖先节点的文本信息" + }, + "maxTagCount": { + "type": "number", + "description": "标签的最大展示数量,超出数量后以收纳浮层的方式展示,仅在多选模式开启后生效" + }, + "overflowTagPopover": { + "type": "object", + "description": "收纳标签的Popover配置" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "nested-select" + }, + "borderMode": true, + "menuClassName": true, + "cascade": true, + "withChildren": true, + "onlyChildren": true, + "onlyLeaf": true, + "hideNodePathLabel": true, + "maxTagCount": true, + "overflowTagPopover": true + }, + "required": [ + "type" + ], + "description": "Nested Select 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/nested-select" + }, + "NumberControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-number" + }, + "max": { + "type": "number", + "description": "最大值" + }, + "min": { + "type": "number", + "description": "最小值" + }, + "step": { + "type": "number", + "description": "步长" + }, + "precision": { + "type": "number", + "description": "精度" + }, + "showSteps": { + "type": "boolean", + "description": "是否显示上下点击按钮" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "prefix": { + "type": "string", + "description": "前缀" + }, + "suffix": { + "type": "string", + "description": "后缀" + }, + "unitOptions": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/Option" + } + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/definitions/PlainObject" + } + ], + "description": "单位列表" + }, + "big": { + "type": "boolean", + "description": "是否是大数,如果是的话输入输出都将是字符串" + }, + "kilobitSeparator": { + "type": "boolean", + "description": "是否千分分隔" + }, + "readOnly": { + "type": "boolean", + "description": "只读" + }, + "keyboard": { + "type": "boolean", + "description": "是否启用键盘行为" + }, + "displayMode": { + "type": "string", + "enum": [ + "base", + "enhance" + ], + "description": "输入框为基础输入框还是加强输入框" + }, + "showAsPercent": { + "type": "boolean", + "description": "用来开启百分号的展示形式" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-number" + }, + "max": true, + "min": true, + "step": true, + "precision": true, + "showSteps": true, + "borderMode": true, + "prefix": true, + "suffix": true, + "unitOptions": true, + "big": true, + "kilobitSeparator": true, + "keyboard": true, + "displayMode": true, + "showAsPercent": true + }, + "required": [ + "type" + ], + "description": "数字输入框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-number" + }, + "PickerControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "picker", + "description": "指定为 Picker 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/picker" + }, + "labelTpl": { + "$ref": "#/definitions/SchemaTpl", + "description": "可用来生成选中的值的描述文字" + }, + "labelField": { + "type": "string", + "description": "建议用 labelTpl 选中一个字段名用来作为值的描述文字" + }, + "valueField": { + "type": "string", + "description": "选一个可以用来作为值的字段。" + }, + "pickerSchema": { + "description": "弹窗选择框详情。" + }, + "modalMode": { + "type": "string", + "enum": [ + "dialog", + "drawer" + ], + "description": "弹窗模式,dialog 或者 drawer" + }, + "modalSize": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "xl", + "full" + ], + "description": "弹窗的尺寸,可选值为 'sm'、'md'、'lg'、'xl'" + }, + "modalTitle": { + "type": "string", + "description": "弹窗的标题,默认为情选择" + }, + "embed": { + "type": "boolean", + "description": "内嵌模式,也就是说不弹框了。" + }, + "overflowConfig": { + "type": "object", + "properties": { + "maxTagCount": { + "type": "number", + "description": "标签的最大展示数量,超出数量后以收纳浮层的方式展示,仅在多选模式开启后生效" + }, + "displayPosition": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "select", + "crud" + ] + }, + "description": "开启最大标签展示数量后,收纳标签生效的位置,未开启内嵌模式默认为选择器, 开启后默认为选择器 + 模态框,可选值为'select'(选择器)、'crud'(增删改查)" + }, + "overflowTagPopover": { + "$ref": "#/definitions/TooltipWrapperSchema", + "description": "开启最大标签展示数量后,选择器内收纳标签的Popover配置" + }, + "overflowTagPopoverInCRUD": { + "$ref": "#/definitions/TooltipWrapperSchema", + "description": "开启最大标签展示数量后,CRUD顶部内收纳标签的Popover配置" + } + }, + "additionalProperties": false, + "description": "开启最大标签展示数量的相关配置" + }, + "itemClearable": { + "type": "boolean", + "description": "选中项可删除,默认为true" + } + }, + "required": [ + "type", + "overflowConfig" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "picker" + }, + "labelTpl": true, + "labelField": true, + "valueField": true, + "pickerSchema": true, + "modalMode": true, + "modalSize": true, + "modalTitle": true, + "embed": true, + "overflowConfig": true, + "itemClearable": true + }, + "required": [ + "type", + "overflowConfig" + ], + "description": "Picker 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/picker" + }, + "RadiosControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "radios", + "description": "指定为 Radios 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/radios" + }, + "columnsCount": { + "type": "number", + "description": "每行显示多少个" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "radios" + }, + "columnsCount": true + }, + "required": [ + "type" + ], + "description": "Radio 单选框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/radios" + }, + "RadioControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "radio", + "description": "指定为多行文本输入框" + }, + "trueValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "勾选值" + }, + "falseValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "未勾选值" + }, + "option": { + "type": "string", + "description": "选项说明" + }, + "badge": { + "$ref": "#/definitions/BadgeObject", + "description": "角标" + }, + "partial": { + "type": "boolean" + }, + "optionType": { + "type": "string", + "enum": [ + "default", + "button" + ] + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "radio" + }, + "trueValue": true, + "falseValue": true, + "option": true, + "badge": true, + "partial": true, + "optionType": true + }, + "required": [ + "type" + ], + "description": "Radio 单选框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/radios" + }, + "RangeControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-range" + }, + "value": { + "$ref": "#/definitions/Value", + "description": "滑块值" + }, + "max": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "最大值" + }, + "min": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "最小值" + }, + "step": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "步长" + }, + "unit": { + "type": "string", + "description": "单位" + }, + "showSteps": { + "type": "boolean", + "description": "是否展示步长" + }, + "parts": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { + "type": "number" + } + } + ], + "description": "分割块数" + }, + "marks": { + "type": "array", + "items": {}, + "description": "刻度" + }, + "tooltipVisible": { + "type": "boolean", + "description": "是否展示标签" + }, + "tooltipPlacement": { + "$ref": "#/definitions/TooltipPosType", + "description": "标签方向" + }, + "multiple": { + "type": "boolean", + "description": "是否为双滑块" + }, + "joinValues": { + "type": "boolean", + "description": "是否通过分隔符连接" + }, + "delimiter": { + "type": "string", + "description": "分隔符" + }, + "showInput": { + "type": "boolean", + "description": "是否展示输入框" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + }, + "clearable": { + "type": "boolean", + "description": "输入框是否可清除" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-range" + }, + "max": true, + "min": true, + "step": true, + "unit": true, + "showSteps": true, + "parts": true, + "marks": true, + "tooltipVisible": true, + "tooltipPlacement": true, + "multiple": true, + "joinValues": true, + "delimiter": true, + "showInput": true, + "clearable": true + }, + "required": [ + "type" + ] + }, + "Value": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/MultipleValue" + }, + { + "type": "number" + }, + { + "type": "array", + "items": { + "type": "number" + }, + "minItems": 2, + "maxItems": 2 + } + ], + "description": "Range 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/range" + }, + "MultipleValue": { + "type": "object", + "properties": { + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": [ + "min", + "max" + ], + "additionalProperties": false + }, + "TooltipPosType": { + "type": "string", + "enum": [ + "auto", + "top", + "right", + "bottom", + "left" + ] + }, + "RatingControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-rating" + }, + "count": { + "type": "number", + "description": "分数" + }, + "half": { + "type": "boolean", + "description": "允许半颗星" + }, + "allowClear": { + "type": "boolean", + "description": "是否允许再次点击后清除" + }, + "readonly": { + "type": "boolean", + "description": "是否只读" + }, + "colors": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + ], + "description": "星星被选中的颜色" + }, + "inactiveColor": { + "type": "string", + "description": "未被选中的星星的颜色" + }, + "texts": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "星星被选中时的提示文字" + }, + "textPosition": { + "$ref": "#/definitions/textPositionType", + "description": "文字的位置" + }, + "char": { + "type": "string", + "description": "自定义字符" + }, + "charClassName": { + "type": "string", + "description": "自定义字符类名" + }, + "textClassName": { + "type": "string", + "description": "自定义文字类名" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-rating" + }, + "count": true, + "half": true, + "allowClear": true, + "readonly": true, + "colors": true, + "inactiveColor": true, + "texts": true, + "textPosition": true, + "char": true, + "charClassName": true, + "textClassName": true + }, + "required": [ + "type" + ], + "description": "Rating 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/rating" + }, + "textPositionType": { + "type": "string", + "enum": [ + "left", + "right" + ] + }, + "RichTextControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-rich-text" + }, + "vendor": { + "type": "string", + "enum": [ + "froala", + "tinymce" + ], + "description": "编辑器类型" + }, + "receiver": { + "$ref": "#/definitions/SchemaApi", + "description": "图片保存 API", + "default": "/api/upload/image" + }, + "videoReceiver": { + "$ref": "#/definitions/SchemaApi", + "description": "视频保存 API", + "default": "/api/upload/video" + }, + "fileField": { + "type": "string", + "description": "接收器的字段名" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "options": { + "description": "tinymce 或 froala 的配置" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-rich-text" + }, + "vendor": true, + "receiver": true, + "videoReceiver": true, + "fileField": true, + "borderMode": true, + "options": true + }, + "required": [ + "type" + ], + "description": "RichText 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-rich-text" + }, + "RepeatControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-repeat" + }, + "options": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-repeat" + }, + "options": true + }, + "required": [ + "type" + ], + "description": "Repeat 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/repeat" + }, + "SelectControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "select", + "multi-select" + ], + "description": "指定为 Select 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/select" + }, + "autoComplete": { + "$ref": "#/definitions/SchemaApi", + "description": "自动完成 API,当输入部分文字的时候,会将这些文字通过 ${term} 可以取到,发送给接口。 接口可以返回匹配到的选项,帮助用户输入。" + }, + "menuTpl": { + "type": "string", + "description": "可以自定义菜单展示。" + }, + "showInvalidMatch": { + "type": "boolean", + "description": "当在value值未匹配到当前options中的选项时,是否value值对应文本飘红显示" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "selectMode": { + "type": "string", + "enum": [ + "table", + "group", + "tree", + "chained", + "associated" + ], + "description": "勾选展示模式" + }, + "leftOptions": { + "type": "array", + "items": { + "$ref": "#/definitions/Option" + }, + "description": "当 selectMode 为 associated 时用来定义左侧的选项" + }, + "leftMode": { + "type": "string", + "enum": [ + "tree", + "list" + ], + "description": "当 selectMode 为 associated 时用来定义左侧的选择模式" + }, + "rightMode": { + "type": "string", + "enum": [ + "table", + "list", + "tree", + "chained" + ], + "description": "当 selectMode 为 associated 时用来定义右侧的选择模式" + }, + "searchResultMode": { + "type": "string", + "enum": [ + "table", + "list", + "tree", + "chained" + ], + "description": "搜索结果展示模式" + }, + "columns": { + "type": "array", + "items": {}, + "description": "当 selectMode 为 table 时定义表格列信息。" + }, + "searchResultColumns": { + "type": "array", + "items": {}, + "description": "当 searchResultMode 为 table 时定义表格列信息。" + }, + "searchable": { + "type": "boolean", + "description": "可搜索?" + }, + "searchApi": { + "$ref": "#/definitions/SchemaApi", + "description": "搜索 API" + }, + "itemHeight": { + "type": "number", + "description": "单个选项的高度,主要用于虚拟渲染" + }, + "virtualThreshold": { + "type": "number", + "description": "在选项数量达到多少时开启虚拟渲染" + }, + "checkAll": { + "type": "boolean", + "description": "可多选条件下,是否可全选" + }, + "defaultCheckAll": { + "type": "boolean", + "description": "可多选条件下,是否默认全选中所有值" + }, + "checkAllLabel": { + "type": "string", + "description": "可多选条件下,全选项文案,默认 ”全选“" + }, + "maxTagCount": { + "type": "number", + "description": "标签的最大展示数量,超出数量后以收纳浮层的方式展示,仅在多选模式开启后生效" + }, + "overflowTagPopover": { + "type": "object", + "description": "收纳标签的Popover配置" + }, + "optionClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "选项的自定义CSS类名" + }, + "overlay": { + "type": "object", + "properties": { + "width": { + "type": [ + "number", + "string" + ], + "description": "下拉框 Popover 的宽度设置,支持单位 '%'、'px'、'rem'、'em'、'vw', 支持相对写法如 '+20px'" + }, + "align": { + "type": "string", + "enum": [ + "left", + "center", + "right" + ], + "description": "下拉框 Popover 的对齐方式" + }, + "filterOption": { + "type": "string", + "const": "string", + "description": "检索函数" + } + }, + "additionalProperties": false, + "description": "下拉框 Popover 设置" + }, + "testIdBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "enum": [ + "select", + "multi-select" + ] + }, + "autoComplete": true, + "menuTpl": true, + "showInvalidMatch": true, + "borderMode": true, + "selectMode": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "searchApi": true, + "itemHeight": true, + "virtualThreshold": true, + "defaultCheckAll": true, + "checkAllLabel": true, + "maxTagCount": true, + "overflowTagPopover": true, + "optionClassName": true, + "overlay": true, + "testIdBuilder": true + }, + "required": [ + "type" + ], + "description": "Select 下拉选择框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/select" + }, + "SubFormControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-sub-form", + "description": "指定为 SubForm 子表单" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "multiple": { + "type": "boolean", + "description": "是否多选" + }, + "draggable": { + "type": "boolean", + "description": "是否可拖拽排序" + }, + "draggableTip": { + "type": "string", + "description": "拖拽提示信息" + }, + "addable": { + "type": "boolean", + "description": "是否可新增" + }, + "removable": { + "type": "boolean", + "description": "是否可删除" + }, + "minLength": { + "type": "number", + "description": "最少个数" + }, + "maxLength": { + "type": "number", + "description": "最多个数" + }, + "labelField": { + "type": "string", + "description": "当值中存在这个字段,则按钮名称将使用此字段的值来展示。" + }, + "btnLabel": { + "type": "string", + "description": "按钮默认名称", + "default": "设置" + }, + "addButtonText": { + "type": "string", + "description": "新增按钮文字" + }, + "addButtonClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "新增按钮 CSS 类名" + }, + "itemClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "值元素的类名" + }, + "itemsClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "值列表元素的类名" + }, + "showErrorMsg": { + "type": "boolean", + "description": "是否在左下角显示报错信息" + }, + "form": { + "$ref": "#/definitions/BaseFormSchema", + "description": "子表单详情" + }, + "scaffold": {} + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-sub-form" + }, + "multiple": true, + "draggable": true, + "draggableTip": true, + "addable": true, + "removable": true, + "minLength": true, + "maxLength": true, + "labelField": true, + "btnLabel": true, + "addButtonText": true, + "addButtonClassName": true, + "itemClassName": true, + "itemsClassName": true, + "showErrorMsg": true, + "form": true, + "scaffold": true + }, + "required": [ + "type" + ], + "description": "SubForm 子表单 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/subform" + }, + "SwitchControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "switch", + "description": "指定为多行文本输入框" + }, + "trueValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "勾选值" + }, + "falseValue": { + "type": [ + "boolean", + "string", + "number" + ], + "description": "未勾选值" + }, + "option": { + "type": "string", + "description": "选项说明" + }, + "onText": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/IconSchema" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "开启时显示的内容" + }, + "offText": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/IconSchema" + }, + { + "$ref": "#/definitions/SchemaCollection" + } + ], + "description": "关闭时显示的内容" + }, + "size": { + "type": "string", + "enum": [ + "sm", + "md" + ], + "description": "开关尺寸" + }, + "loading": { + "type": "boolean", + "description": "是否处于加载状态" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "switch" + }, + "trueValue": true, + "falseValue": true, + "option": true, + "onText": true, + "offText": true, + "loading": true + }, + "required": [ + "type" + ], + "description": "Switch 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/switch" + }, + "StaticExactControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "static" + }, + "tpl": { + "$ref": "#/definitions/SchemaTpl", + "description": "内容模板, 支持 HTML" + }, + "text": { + "$ref": "#/definitions/SchemaTpl", + "description": "内容模板,不支持 HTML" + }, + "popOver": { + "$ref": "#/definitions/SchemaPopOver", + "description": "配置查看详情功能" + }, + "quickEdit": { + "$ref": "#/definitions/SchemaQuickEdit", + "description": "配置快速编辑功能" + }, + "copyable": { + "$ref": "#/definitions/SchemaCopyable", + "description": "配置点击复制功能" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,默认是无边框的" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "static" + }, + "tpl": true, + "text": true, + "popOver": true, + "quickEdit": true, + "copyable": true, + "borderMode": true + }, + "required": [ + "type" + ], + "description": "Static 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/static" + }, + "TableControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-table" + }, + "addable": { + "type": "boolean", + "description": "可新增" + }, + "childrenAddable": { + "type": "boolean", + "description": "是否可以新增子项" + }, + "copyable": { + "type": "boolean", + "description": "可复制新增" + }, + "copyBtnLabel": { + "type": "string", + "description": "复制按钮文字" + }, + "copyBtnIcon": { + "type": "string", + "description": "复制按钮图标" + }, + "copyAddBtn": { + "type": "boolean", + "description": "是否显示复制按钮" + }, + "copyData": { + "type": "object", + "description": "复制的时候用来配置复制映射的数据。默认值是 {&:$$},相当与复制整个行数据 通常有时候需要用来标记是复制过来的,也可能需要删掉一下主键字段。" + }, + "draggable": { + "type": "boolean", + "description": "是否可以拖拽排序" + }, + "addApi": { + "$ref": "#/definitions/SchemaApi", + "description": "新增 API" + }, + "addBtnLabel": { + "type": "string", + "description": "新增按钮文字" + }, + "addBtnIcon": { + "type": "string", + "description": "新增按钮图标" + }, + "subAddBtnLabel": { + "type": "string", + "description": "孩子新增按钮文字" + }, + "subAddBtnIcon": { + "type": "string", + "description": "孩子新增按钮图标" + }, + "removable": { + "type": "boolean", + "description": "可否删除" + }, + "deleteApi": { + "$ref": "#/definitions/SchemaApi", + "description": "删除的 API" + }, + "editable": { + "type": "boolean", + "description": "可否编辑" + }, + "editBtnLabel": { + "type": "string", + "description": "更新按钮名称" + }, + "editBtnIcon": { + "type": "string", + "description": "更新按钮图标" + }, + "confirmBtnLabel": { + "type": "string", + "description": "确认按钮文字" + }, + "confirmBtnIcon": { + "type": "string", + "description": "确认按钮图标" + }, + "cancelBtnLabel": { + "type": "string", + "description": "取消按钮文字" + }, + "cancelBtnIcon": { + "type": "string", + "description": "取消按钮图标" + }, + "deleteBtnLabel": { + "type": "string", + "description": "删除按钮文字" + }, + "deleteBtnIcon": { + "type": "string", + "description": "删除按钮图标" + }, + "updateApi": { + "$ref": "#/definitions/SchemaApi", + "description": "更新 API" + }, + "scaffold": { + "description": "初始值,新增的时候" + }, + "deleteConfirmText": { + "type": "string", + "description": "删除确认文字" + }, + "valueField": { + "type": "string", + "description": "值字段" + }, + "needConfirm": { + "type": "boolean", + "description": "是否为确认的编辑模式。" + }, + "canAccessSuperData": { + "type": "boolean", + "description": "是否可以访问父级数据,正常 combo 已经关联到数组成员,是不能访问父级数据的。" + }, + "showIndex": { + "type": "boolean", + "description": "是否显示序号" + }, + "perPage": { + "type": "number", + "description": "分页个数,默认不分页" + }, + "maxLength": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "限制最大个数" + }, + "minLength": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/SchemaTokenizeableString" + } + ], + "description": "限制最小个数" + }, + "showFooterAddBtn": { + "type": "boolean", + "description": "是否显示底部新增按钮" + }, + "showTableAddBtn": { + "type": "boolean", + "description": "是否显示表格操作栏新增按钮" + }, + "footerAddBtn": { + "$ref": "#/definitions/SchemaCollection", + "description": "底部新增按钮配置" + }, + "enableStaticTransform": { + "type": "boolean", + "description": "是否开启 static 状态切换" + }, + "toolbarClassName": { + "$ref": "#/definitions/SchemaClassName", + "description": "底部工具栏CSS样式类" + }, + "matchFunc": { + "anyOf": [ + { + "type": "string" + }, + {} + ], + "description": "自定义搜索匹配函数,当存在列的 searchable 为 true 时,会基于该函数计算的匹配结果进行过滤,主要用于处理列字段类型较为复杂或者字段值格式和后端返回不一致的场景\n\n参数说明\n\n * `items` 当前表格数据 * `itemsRaw` 当前表格数据(未处理) * `options` 配置 * `options.query` 查询条件 * `options.columns` 列配置 * `options.matchSorter` 系统默认的排序方法" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControl", + "additionalProperties": true + }, + { + "$ref": "#/definitions/BaseTableSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "input-table" + }, + "testid": true, + "affixHeader": true, + "affixFooter": true, + "columns": true, + "columnsTogglable": true, + "footable": true, + "footerClassName": true, + "headerClassName": true, + "placeholder": true, + "showIndex": true, + "showFooter": true, + "showHeader": true, + "source": true, + "tableClassName": true, + "title": true, + "toolbarClassName": true, + "combineNum": true, + "combineFromIndex": true, + "prefixRow": true, + "affixRow": true, + "resizable": true, + "rowClassNameExpr": true, + "itemBadge": true, + "autoGenerateFilter": true, + "canAccessSuperData": true, + "autoFillHeight": true, + "tableLayout": true, + "deferApi": true, + "persistKey": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "size": true, + "addable": true, + "childrenAddable": true, + "copyable": true, + "copyBtnLabel": true, + "copyBtnIcon": true, + "copyAddBtn": true, + "copyData": true, + "draggable": true, + "addApi": true, + "addBtnLabel": true, + "addBtnIcon": true, + "subAddBtnLabel": true, + "subAddBtnIcon": true, + "removable": true, + "deleteApi": true, + "editable": true, + "editBtnLabel": true, + "editBtnIcon": true, + "confirmBtnLabel": true, + "confirmBtnIcon": true, + "cancelBtnLabel": true, + "cancelBtnIcon": true, + "deleteBtnLabel": true, + "deleteBtnIcon": true, + "updateApi": true, + "scaffold": true, + "deleteConfirmText": true, + "valueField": true, + "needConfirm": true, + "perPage": true, + "maxLength": true, + "minLength": true, + "showFooterAddBtn": true, + "showTableAddBtn": true, + "footerAddBtn": true, + "enableStaticTransform": true, + "matchFunc": true + }, + "required": [ + "type" + ] + }, + "TabsTransferControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseTransferControlSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "tabs-transfer" + }, + "showArrow": true, + "sortable": true, + "selectMode": true, + "resultListModeFollowSelect": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "resultSearchable": true, + "searchApi": true, + "selectTitle": true, + "resultTitle": true, + "menuTpl": true, + "valueTpl": true, + "searchPlaceholder": true, + "resultSearchPlaceholder": true, + "statistics": true, + "itemHeight": true, + "virtualThreshold": true, + "showInvalidMatch": true, + "onlyChildren": true, + "initiallyOpen": true, + "autoCheckChildren": true, + "pagination": true + }, + "required": [ + "type" + ], + "description": "TabsTransfer 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tabs-transfer" + }, + "BaseTransferControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "showArrow": { + "type": "boolean", + "description": "是否显示剪头" + }, + "sortable": { + "type": "boolean", + "description": "可排序?" + }, + "selectMode": { + "type": "string", + "enum": [ + "table", + "list", + "tree", + "chained", + "associated" + ], + "description": "勾选展示模式" + }, + "resultListModeFollowSelect": { + "type": "boolean", + "description": "结果面板是否追踪显示" + }, + "leftOptions": { + "type": "array", + "items": { + "$ref": "#/definitions/Option" + }, + "description": "当 selectMode 为 associated 时用来定义左侧的选项" + }, + "leftMode": { + "type": "string", + "enum": [ + "tree", + "list" + ], + "description": "当 selectMode 为 associated 时用来定义左侧的选择模式" + }, + "rightMode": { + "type": "string", + "enum": [ + "table", + "list", + "tree", + "chained" + ], + "description": "当 selectMode 为 associated 时用来定义右侧的选择模式" + }, + "searchResultMode": { + "type": "string", + "enum": [ + "table", + "list", + "tree", + "chained" + ], + "description": "搜索结果展示模式" + }, + "columns": { + "type": "array", + "items": {}, + "description": "当 selectMode 为 table 时定义表格列信息。" + }, + "searchResultColumns": { + "type": "array", + "items": {}, + "description": "当 searchResultMode 为 table 时定义表格列信息。" + }, + "searchable": { + "type": "boolean", + "description": "可搜索?" + }, + "resultSearchable": { + "type": "boolean", + "description": "结果(右则)列表的检索功能,当设置为true时,可以通过输入检索模糊匹配检索内容" + }, + "searchApi": { + "$ref": "#/definitions/SchemaApi", + "description": "搜索 API" + }, + "selectTitle": { + "type": "string", + "description": "左侧的标题文字" + }, + "resultTitle": { + "type": "string", + "description": "右侧结果的标题文字" + }, + "menuTpl": { + "$ref": "#/definitions/SchemaObject", + "description": "用来丰富选项展示" + }, + "valueTpl": { + "$ref": "#/definitions/SchemaObject", + "description": "用来丰富值的展示" + }, + "searchPlaceholder": { + "type": "string", + "description": "左侧列表搜索框提示" + }, + "resultSearchPlaceholder": { + "type": "string", + "description": "右侧列表搜索框提示" + }, + "statistics": { + "type": "boolean", + "description": "统计数字" + }, + "itemHeight": { + "type": "number", + "description": "单个选项的高度,主要用于虚拟渲染" + }, + "virtualThreshold": { + "type": "number", + "description": "在选项数量达到多少时开启虚拟渲染" + }, + "showInvalidMatch": { + "type": "boolean", + "description": "当在value值未匹配到当前options中的选项时,是否value值对应文本飘红显示" + }, + "onlyChildren": { + "type": "boolean", + "description": "树形模式下,仅选中子节点" + }, + "initiallyOpen": { + "type": "boolean", + "description": "是否默认都展开" + }, + "autoCheckChildren": { + "type": "boolean", + "description": "ui级联关系,true代表级联选中,false代表不级联,默认为true" + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "properties": { + "layout": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "通过控制layout属性的顺序,调整分页结构 total,perPage,pager,go", + "default": "pager" + }, + "maxButtons": { + "type": "number", + "description": "最多显示多少个分页按钮。", + "default": 5 + }, + "perPageAvailable": { + "type": "array", + "items": { + "type": "number" + }, + "description": "指定每页可以显示多少条", + "default": [ + 10, + 20, + 50, + 100 + ] + }, + "popOverContainerSelector": { + "type": "string", + "description": "弹层挂载节点", + "default": false + }, + "enable": { + "$ref": "#/definitions/SchemaExpression", + "description": "是否左侧选项分页,默认不开启" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "分页组件CSS类名" + }, + "loadDataOnce": { + "type": "boolean", + "description": "是否开启前端分页" + } + }, + "required": [ + "enable" + ], + "description": "分页配置,selectMode为默认和table才会生效" + } + } + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": true, + "showArrow": true, + "sortable": true, + "selectMode": true, + "resultListModeFollowSelect": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "resultSearchable": true, + "searchApi": true, + "selectTitle": true, + "resultTitle": true, + "menuTpl": true, + "valueTpl": true, + "searchPlaceholder": true, + "resultSearchPlaceholder": true, + "statistics": true, + "itemHeight": true, + "virtualThreshold": true, + "showInvalidMatch": true, + "onlyChildren": true, + "initiallyOpen": true, + "autoCheckChildren": true, + "pagination": true + } + }, + "TagControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-tag", + "description": "指定为 InputTag 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-tag" + }, + "optionsTip": { + "type": "string", + "description": "选项提示信息" + }, + "dropdown": { + "type": "boolean", + "description": "是否为下拉模式" + }, + "max": { + "type": "number", + "description": "允许添加的标签的最大数量" + }, + "maxTagLength": { + "type": "number", + "description": "单个标签的最大文本长度" + }, + "maxTagCount": { + "type": "number", + "description": "标签的最大展示数量,超出数量后以收纳浮层的方式展示,仅在多选模式开启后生效" + }, + "overflowTagPopover": { + "$ref": "#/definitions/TooltipWrapperSchema", + "description": "收纳标签的Popover配置" + }, + "enableBatchAdd": { + "type": "boolean", + "description": "是否开启批量添加模式" + }, + "separator": { + "type": "string", + "description": "开启批量添加后,输入多个标签的分隔符,支持传入多个符号,默认为\"-\"", + "default": "-" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-tag" + }, + "optionsTip": true, + "dropdown": true, + "max": true, + "maxTagLength": true, + "maxTagCount": true, + "overflowTagPopover": true, + "enableBatchAdd": true, + "separator": true + }, + "required": [ + "type" + ], + "description": "Tag 输入框 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tag" + }, + "TextControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "input-text", + "input-email", + "input-url", + "input-password", + "native-date", + "native-time", + "native-number" + ], + "description": "指定为 InputText 渲染器。\n\nhttps://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-text" + }, + "addOn": { + "$ref": "#/definitions/InputTextAddOn", + "description": "附带的操作按钮" + }, + "trimContents": { + "type": "boolean", + "description": "是否去除首尾空白文本。" + }, + "autoComplete": { + "$ref": "#/definitions/SchemaApi", + "description": "自动完成 API,当输入部分文字的时候,会将这些文字通过 ${term} 可以取到,发送给接口。 接口可以返回匹配到的选项,帮助用户输入。" + }, + "nativeAutoComplete": { + "type": "string", + "description": "配置原生 input 的 autoComplete 属性", + "default": "off" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "minLength": { + "type": "number", + "description": "限制文字最小输入个数" + }, + "maxLength": { + "type": "number", + "description": "限制文字最大输入个数" + }, + "showCounter": { + "type": "boolean", + "description": "是否显示计数" + }, + "prefix": { + "type": "string", + "description": "前缀" + }, + "suffix": { + "type": "string", + "description": "后缀" + }, + "transform": { + "type": "object", + "properties": { + "lowerCase": { + "type": "boolean", + "description": "用户输入的字符自动转小写" + }, + "upperCase": { + "type": "boolean", + "description": "用户输入的字符自动转大写" + } + }, + "additionalProperties": false, + "description": "自动转换值" + }, + "inputControlClassName": { + "type": "string", + "description": "control节点的CSS类名" + }, + "nativeInputClassName": { + "type": "string", + "description": "原生input标签的CSS类名" + }, + "clearValueOnEmpty": { + "type": "boolean", + "description": "在内容为空的时候清除值" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "enum": [ + "input-text", + "input-email", + "input-url", + "input-password", + "native-date", + "native-time", + "native-number" + ] + }, + "addOn": true, + "trimContents": true, + "autoComplete": true, + "nativeAutoComplete": true, + "borderMode": true, + "minLength": true, + "maxLength": true, + "showCounter": true, + "prefix": true, + "suffix": true, + "transform": true, + "inputControlClassName": true, + "nativeInputClassName": true, + "clearValueOnEmpty": true + }, + "required": [ + "type" + ], + "description": "Text 文本输入框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-text" + }, + "InputTextAddOn": { + "allOf": [ + { + "$ref": "#/definitions/ActionSchemaLoose" + }, + { + "$ref": "#/definitions/InputTextAddOnObject", + "additionalProperties": true + } + ] + }, + "InputTextAddOnObject": { + "type": "object", + "properties": { + "position": { + "type": "string", + "enum": [ + "left", + "right" + ], + "description": "操作按钮位置" + } + } + }, + "TextareaControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "textarea", + "description": "指定为多行文本输入框" + }, + "maxRows": { + "type": "number", + "description": "最大行数" + }, + "minRows": { + "type": "number", + "description": "最小行数" + }, + "readOnly": { + "type": "boolean", + "description": "是否只读" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "maxLength": { + "type": "number", + "description": "限制文字个数" + }, + "showCounter": { + "type": "boolean", + "description": "是否显示计数" + }, + "clearable": { + "type": "boolean", + "description": "输入内容是否可清除" + }, + "resetValue": { + "type": "string", + "description": "重置值" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormBaseControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "textarea" + }, + "maxRows": true, + "minRows": true, + "borderMode": true, + "maxLength": true, + "showCounter": true, + "clearable": true, + "resetValue": true + }, + "required": [ + "type" + ], + "description": "TextArea 多行文本输入框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/textarea" + }, + "TransferControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseTransferControlSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "transfer" + }, + "showArrow": true, + "sortable": true, + "selectMode": true, + "resultListModeFollowSelect": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "resultSearchable": true, + "searchApi": true, + "selectTitle": true, + "resultTitle": true, + "menuTpl": true, + "valueTpl": true, + "searchPlaceholder": true, + "resultSearchPlaceholder": true, + "statistics": true, + "itemHeight": true, + "virtualThreshold": true, + "showInvalidMatch": true, + "onlyChildren": true, + "initiallyOpen": true, + "autoCheckChildren": true, + "pagination": true + }, + "required": [ + "type" + ], + "description": "Transfer 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/transfer" + }, + "TransferPickerControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "transfer-picker" + }, + "borderMode": { + "type": "string", + "enum": [ + "full", + "half", + "none" + ], + "description": "边框模式,全边框,还是半边框,或者没边框。" + }, + "pickerSize": { + "type": "string", + "enum": [ + "xs", + "sm", + "md", + "lg", + "xl", + "full" + ], + "description": "弹窗大小" + }, + "onlyChildren": { + "type": "boolean", + "description": "树形模式下,仅选中子节点" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseTransferControlSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "transfer-picker" + }, + "showArrow": true, + "sortable": true, + "selectMode": true, + "resultListModeFollowSelect": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "resultSearchable": true, + "searchApi": true, + "selectTitle": true, + "resultTitle": true, + "menuTpl": true, + "valueTpl": true, + "searchPlaceholder": true, + "resultSearchPlaceholder": true, + "statistics": true, + "itemHeight": true, + "virtualThreshold": true, + "showInvalidMatch": true, + "onlyChildren": true, + "initiallyOpen": true, + "autoCheckChildren": true, + "pagination": true, + "borderMode": true, + "pickerSize": true + }, + "required": [ + "type" + ], + "description": "TransferPicker 穿梭器的弹框形态 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/transfer-picker" + }, + "TabsTransferPickerControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/BaseTransferControlSchema", + "additionalProperties": true + }, + { + "$ref": "#/definitions/SpinnerExtraProps", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "loadingConfig": true, + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "tabs-transfer-picker" + }, + "showArrow": true, + "sortable": true, + "selectMode": true, + "resultListModeFollowSelect": true, + "leftOptions": true, + "leftMode": true, + "rightMode": true, + "searchResultMode": true, + "columns": true, + "searchResultColumns": true, + "searchable": true, + "resultSearchable": true, + "searchApi": true, + "selectTitle": true, + "resultTitle": true, + "menuTpl": true, + "valueTpl": true, + "searchPlaceholder": true, + "resultSearchPlaceholder": true, + "statistics": true, + "itemHeight": true, + "virtualThreshold": true, + "showInvalidMatch": true, + "onlyChildren": true, + "initiallyOpen": true, + "autoCheckChildren": true, + "pagination": true + }, + "required": [ + "type" + ], + "description": "TabsTransferPicker 穿梭器的弹框形态 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tabs-transfer-picker" + }, + "TreeControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input-tree", + "description": "指定为 InputTree 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-tree" + }, + "hideRoot": { + "type": "boolean", + "description": "是否隐藏顶级" + }, + "rootLabel": { + "type": "string", + "description": "顶级选项的名称" + }, + "rootValue": { + "description": "顶级选项的值" + }, + "showIcon": { + "type": "boolean", + "description": "显示图标" + }, + "autoCheckChildren": { + "type": "boolean", + "description": "ui级联关系,true代表级联选中,false代表不级联,默认为true" + }, + "cascade": { + "type": "boolean", + "description": "该属性代表数据级联关系,autoCheckChildren为true时生效,默认为false,具体数据级联关系如下: 1.casacde为false,ui行为为级联选中子节点,子节点禁用;值只包含父节点的值 2.cascade为false,withChildren为true,ui行为为级联选中子节点,子节点禁用;值包含父子节点的值 3.cascade为true,ui行为级联选中子节点,子节点可反选,值包含父子节点的值,此时withChildren属性失效 4.cascade不论为true还是false,onlyChildren为true,ui行为级联选中子节点,子节点可反选,值只包含子节点的值" + }, + "nodeBehavior": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "unfold", + "check" + ] + }, + "description": "节点行为配置,默认为选中" + }, + "autoCancelParent": { + "type": "boolean", + "description": "子节点取消时自动取消父节点的值,默认为false" + }, + "withChildren": { + "type": "boolean", + "description": "选父级的时候是否把子节点的值也包含在内。" + }, + "onlyChildren": { + "type": "boolean", + "description": "选父级的时候,是否只把子节点的值包含在内" + }, + "onlyLeaf": { + "type": "boolean", + "description": "单选时,只运行选择叶子节点" + }, + "rootCreatable": { + "type": "boolean", + "description": "顶级节点是否可以创建子节点" + }, + "enableNodePath": { + "type": "boolean", + "description": "是否开启节点路径模式" + }, + "pathSeparator": { + "type": "string", + "description": "开启节点路径模式后,节点路径的分隔符" + }, + "showOutline": { + "type": "boolean", + "description": "是否显示展开线" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi", + "description": "懒加载接口" + }, + "highlightTxt": { + "type": "string", + "description": "需要高亮的字符串" + }, + "enableDefaultIcon": { + "type": "boolean", + "description": "是否为选项添加默认的Icon,默认值为true" + }, + "searchable": { + "type": "boolean", + "description": "是否开启搜索" + }, + "searchApi": { + "$ref": "#/definitions/SchemaApi", + "description": "搜索 API" + }, + "itemActions": { + "$ref": "#/definitions/SchemaCollection", + "description": "自定义节点操作栏区域" + }, + "searchConfig": { + "type": "object", + "properties": { + "className": { + "type": "string", + "description": "搜索框外层CSS样式类" + }, + "placeholder": { + "type": "string", + "description": "占位符" + }, + "mini": { + "type": "boolean", + "description": "是否为 Mini 样式。" + }, + "enhance": { + "type": "boolean", + "description": "是否为加强样式" + }, + "clearable": { + "type": "boolean", + "description": "是否可清除" + }, + "searchImediately": { + "type": "boolean", + "description": "是否立马搜索。" + }, + "sticky": { + "type": "boolean", + "description": "搜索框是否吸顶" + } + }, + "additionalProperties": false, + "description": "搜索框的配置" + }, + "treeClassName": { + "type": "string", + "description": "tree 组件层类名" + }, + "heightAuto": { + "type": "boolean", + "description": "高度自动增长?" + }, + "iconField": { + "type": "string", + "description": "设置 icon 字段名" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "input-tree" + }, + "hideRoot": true, + "rootLabel": true, + "rootValue": true, + "showIcon": true, + "autoCheckChildren": true, + "cascade": true, + "nodeBehavior": true, + "autoCancelParent": true, + "withChildren": true, + "onlyChildren": true, + "onlyLeaf": true, + "rootCreatable": true, + "enableNodePath": true, + "pathSeparator": true, + "showOutline": true, + "highlightTxt": true, + "enableDefaultIcon": true, + "searchable": true, + "searchApi": true, + "itemActions": true, + "searchConfig": true, + "treeClassName": true, + "heightAuto": true, + "iconField": true + }, + "required": [ + "type" + ], + "description": "Tree 下拉选择框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tree" + }, + "TreeSelectControlSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tree-select", + "description": "指定为 TreeSelect 渲染器。 https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tree-select" + }, + "hideRoot": { + "type": "boolean", + "description": "是否隐藏顶级" + }, + "rootLabel": { + "type": "string", + "description": "顶级选项的名称" + }, + "rootValue": { + "description": "顶级选项的值" + }, + "showIcon": { + "type": "boolean", + "description": "显示图标" + }, + "cascade": { + "type": "boolean", + "description": "父子之间是否完全独立。" + }, + "nodeBehavior": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "unfold", + "check" + ] + }, + "description": "节点行为配置,默认为选中" + }, + "withChildren": { + "type": "boolean", + "description": "选父级的时候是否把子节点的值也包含在内。" + }, + "onlyChildren": { + "type": "boolean", + "description": "选父级的时候,是否只把子节点的值包含在内" + }, + "onlyLeaf": { + "type": "boolean", + "description": "单选时,只运行选择叶子节点" + }, + "rootCreatable": { + "type": "boolean", + "description": "顶级节点是否可以创建子节点" + }, + "hideNodePathLabel": { + "type": "boolean", + "description": "是否隐藏选择框中已选中节点的祖先节点的文本信息" + }, + "enableNodePath": { + "type": "boolean", + "description": "是否开启节点路径模式" + }, + "pathSeparator": { + "type": "string", + "description": "开启节点路径模式后,节点路径的分隔符" + }, + "showOutline": { + "type": "boolean", + "description": "是否显示展开线" + }, + "deferApi": { + "$ref": "#/definitions/SchemaApi", + "description": "懒加载接口" + }, + "maxTagCount": { + "type": "number", + "description": "标签的最大展示数量,超出数量后以收纳浮层的方式展示,仅在多选模式开启后生效" + }, + "overflowTagPopover": { + "$ref": "#/definitions/TooltipWrapperSchema", + "description": "收纳标签的Popover配置" + }, + "menuTpl": { + "type": "string", + "description": "自定义选项" + }, + "autoCancelParent": { + "type": "boolean", + "description": "子节点取消时自动取消父节点的值,默认为false" + }, + "itemActions": { + "$ref": "#/definitions/SchemaCollection", + "description": "自定义节点操作栏区域" + }, + "enableDefaultIcon": { + "type": "boolean", + "description": "是否为选项添加默认的Icon,默认值为true" + }, + "testIdBuilder": { + "$ref": "#/definitions/TestIdBuilder" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "tree-select" + }, + "hideRoot": true, + "rootLabel": true, + "rootValue": true, + "showIcon": true, + "cascade": true, + "nodeBehavior": true, + "withChildren": true, + "onlyChildren": true, + "onlyLeaf": true, + "rootCreatable": true, + "hideNodePathLabel": true, + "enableNodePath": true, + "pathSeparator": true, + "showOutline": true, + "maxTagCount": true, + "overflowTagPopover": true, + "menuTpl": true, + "autoCancelParent": true, + "itemActions": true, + "enableDefaultIcon": true, + "testIdBuilder": true + }, + "required": [ + "type" + ], + "description": "Tree 下拉选择框。 文档:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/tree" + }, + "UserSelectControlSchema": { + "allOf": [ + { + "$ref": "#/definitions/FormOptionsSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "options": true, + "source": true, + "selectFirst": true, + "initFetchOn": true, + "initFetch": true, + "multiple": true, + "checkAll": true, + "joinValues": true, + "delimiter": true, + "valuesNoWrap": true, + "extractValue": true, + "clearable": true, + "resetValue": true, + "deferField": true, + "deferApi": true, + "addApi": true, + "addControls": true, + "addDialog": true, + "creatable": true, + "createBtnLabel": true, + "editable": true, + "editApi": true, + "editControls": true, + "editDialog": true, + "removable": true, + "deleteApi": true, + "deleteConfirmText": true, + "clearValueOnSourceChange": true, + "label": true, + "labelAlign": true, + "labelWidth": true, + "labelOverflow": true, + "labelClassName": true, + "name": true, + "extraName": true, + "remark": true, + "labelRemark": true, + "hint": true, + "submitOnChange": true, + "readOnly": true, + "readOnlyOn": true, + "validateOnChange": true, + "description": true, + "desc": true, + "descriptionClassName": true, + "mode": true, + "horizontal": true, + "inline": true, + "inputClassName": true, + "placeholder": true, + "required": true, + "validationErrors": true, + "validations": true, + "value": true, + "clearValueOnHidden": true, + "validateApi": true, + "autoFill": true, + "initAutoFill": true, + "row": true, + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "size": true, + "type": { + "type": "string", + "const": "users-select" + } + }, + "required": [ + "type" + ], + "description": "UserSelect 移动端人员选择。" + }, + "DateRangeSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "date-range", + "description": "指定为日期展示类型" + }, + "valueFormat": { + "type": "string", + "description": "值的时间格式,参考 moment 中的格式说明。" + }, + "format": { + "type": "string", + "description": "展示的时间格式,参考 moment 中的格式说明。" + }, + "displayFormat": { + "type": "string", + "description": "展示的时间格式,参考 moment 中的格式说明。(新:同format)" + }, + "delimiter": { + "type": "string", + "description": "分割符" + }, + "connector": { + "type": "string", + "description": "连接符" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "date-range" + }, + "testid": true, + "valueFormat": true, + "format": true, + "displayFormat": true, + "delimiter": true, + "connector": true + }, + "required": [ + "type" + ], + "description": "DateRange 展示渲染器。" + }, + "MultilineTextSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "multiline-text" + }, + "text": { + "type": "string", + "description": "文本" + }, + "maxRows": { + "type": "number", + "description": "最大行数" + }, + "expendButtonText": { + "type": "string", + "description": "展开按钮文本" + }, + "collapseButtonText": { + "type": "string", + "description": "收起按钮文本" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "multiline-text" + }, + "testid": true, + "text": true, + "maxRows": true, + "expendButtonText": true, + "collapseButtonText": true + }, + "required": [ + "type" + ], + "description": "MultilineText" + }, + "PasswordSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "password" + }, + "mosaicText": { + "type": "string", + "description": "打码模式的文本" + } + }, + "required": [ + "type" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "password" + }, + "testid": true, + "mosaicText": true + }, + "required": [ + "type" + ], + "description": "Password" + }, + "WordsSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "words" + }, + "limit": { + "type": "number", + "description": "展示限制, 为0时也无限制" + }, + "expendButtonText": { + "type": "string", + "description": "展示文字" + }, + "expendButton": { + "$ref": "#/definitions/SchemaObject", + "description": "展示文字" + }, + "collapseButtonText": { + "type": "string", + "description": "收起文字" + }, + "collapseButton": { + "$ref": "#/definitions/SchemaObject", + "description": "展示文字" + }, + "words": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "tags数据" + }, + "inTag": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/TagSchema" + } + ], + "description": "useTag 当数据是数组时,是否使用tag的方式展示" + }, + "delimiter": { + "type": "string", + "description": "分割符" + }, + "labelTpl": { + "type": "string", + "description": "标签模板" + } + }, + "required": [ + "type", + "words" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "words" + }, + "testid": true, + "limit": true, + "expendButtonText": true, + "expendButton": true, + "collapseButtonText": true, + "collapseButton": true, + "words": true, + "inTag": true, + "delimiter": true, + "labelTpl": true + }, + "required": [ + "type", + "words" + ], + "description": "Words" + }, + "TagSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tag" + }, + "className": { + "$ref": "#/definitions/SchemaClassName", + "description": "类名" + }, + "style": { + "type": "object", + "description": "自定义样式" + }, + "color": { + "type": "string", + "description": "标签颜色" + }, + "label": { + "type": "string", + "description": "标签文本内容" + }, + "displayMode": { + "type": "string", + "enum": [ + "normal", + "rounded", + "status" + ], + "description": "normal: 面性标签,对应color的背景色 rounded: 线性标签, 对应color的边框 status: 带图标的标签, 图标可以自定义" + }, + "icon": { + "$ref": "#/definitions/SchemaIcon", + "description": "status模式时候设置的前置图标" + }, + "closable": { + "type": "boolean", + "description": "是否展示关闭按钮" + }, + "closeIcon": { + "$ref": "#/definitions/SchemaIcon", + "description": "关闭图标" + }, + "checkable": { + "type": "boolean", + "description": "是否是可选的标签" + }, + "checked": { + "type": "boolean", + "description": "是否选中" + }, + "disabled": { + "type": "boolean", + "description": "是否禁用" + } + }, + "required": [ + "type", + "label", + "closeIcon" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "tag" + }, + "testid": true, + "color": true, + "label": true, + "displayMode": true, + "icon": true, + "closable": true, + "closeIcon": true, + "checkable": true, + "checked": true + }, + "required": [ + "type", + "label", + "closeIcon" + ], + "description": "Tag" + }, + "SliderSchema": { + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "slider" + }, + "body": { + "$ref": "#/definitions/BaseSchema" + }, + "left": { + "$ref": "#/definitions/BaseSchema" + }, + "right": { + "$ref": "#/definitions/BaseSchema" + }, + "bodyWidth": { + "type": "string" + } + }, + "required": [ + "type", + "body" + ] + }, + { + "$ref": "#/definitions/BaseSchema", + "additionalProperties": true + } + ], + "additionalProperties": false, + "properties": { + "$$id": true, + "className": true, + "$ref": true, + "disabled": true, + "disabledOn": true, + "hidden": true, + "hiddenOn": true, + "visible": true, + "visibleOn": true, + "id": true, + "onEvent": true, + "static": true, + "staticOn": true, + "staticPlaceholder": true, + "staticClassName": true, + "staticLabelClassName": true, + "staticInputClassName": true, + "staticSchema": true, + "style": true, + "editorSetting": true, + "useMobileUI": true, + "type": { + "type": "string", + "const": "slider" + }, + "testid": true, + "body": true, + "left": true, + "right": true, + "bodyWidth": true + }, + "required": [ + "type", + "body" + ] + }, + "SchemaDefaultData": { + "type": "object", + "description": "初始数据,设置得值可用于组件内部模板使用。" + }, + "SchemaObjectLoose": { + "allOf": [ + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "page" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PageSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "flex" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FlexSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "tpl", + "html" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TplSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "remark" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RemarkSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "alert" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AlertSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "audio" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AudioSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "avatar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AvatarSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonGroupSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-toolbar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonToolbarSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "calendar" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CalendarSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "card" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CardSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "cards" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CardsSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "carousel" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CarouselSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "chart" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ChartSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "collapse" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CollapseSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "collapse-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CollapseGroupSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "color" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ColorSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "container" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ContainerSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "switch-container" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SwitchContainerSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "date", + "datetime", + "time", + "static-date", + "static-datetime", + "static-time" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "dialogType": { + "type": "string", + "const": "confirm" + } + }, + "required": [ + "type", + "dialogType" + ] + }, + "then": { + "$ref": "#/definitions/DialogSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "divider" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DividerSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "drawer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DrawerSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "dropdown-button" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DropdownButtonSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "each" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/EachSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "grid" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/GridSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "grid-2d" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/Grid2DSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "hbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/HBoxSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "icon" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IconSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "iframe" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IFrameSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "image", + "static-image" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImageSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "images", + "static-images" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImagesSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "json", + "static-json" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/JsonSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "link" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/LinkSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "list", + "static-list" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ListSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "map", + "mapping" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MappingSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "nav" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NavSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "operation" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/OperationSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "pagination" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PaginationSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "pagination-wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PaginationWrapperSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "panel" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PanelSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "plain", + "text" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PlainSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "progress" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ProgressSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "qrcode", + "qr-code" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QRCodeSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "search-box" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SearchBoxSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "service" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ServiceSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "sparkline" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SparkLineSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StatusSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "spinner" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SpinnerSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "table", + "static-table" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "table2" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableSchema2", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tasks" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TasksSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "vbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/VBoxSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "video" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/VideoSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "wizard" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WizardSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WrapperSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tooltip-wrapper" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TooltipWrapperSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "form" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "anchor-nav" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/AnchorNavSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "steps" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StepsSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "portlet" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PortletSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "timeline" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TimelineSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "control" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-array" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ArrayControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "button-group-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ButtonGroupControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "chained-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ChainedSelectControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "checkbox" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CheckboxControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "checkboxes" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CheckboxesControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-city" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputCityControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-color" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputColorControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "combo" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ComboControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "condition-builder" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ConditionBuilderControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-date" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-datetime" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateTimeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-time" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TimeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-month" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MonthControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-quarter" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QuarterControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-year" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/YearControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input-date-range", + "input-datetime-range", + "input-time-range" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateRangeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "diff-editor" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DiffControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/EditorControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "fieldset", + "fieldSet" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FieldSetControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-file" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FileControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "formula" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/FormulaControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/GroupControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "hidden" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/HiddenControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "icon-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/IconPickerControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-image" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ImageControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-group" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputGroupControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "list-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ListControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "json-schema-editor" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/JSONSchemaEditorControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-signature" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/InputSignatureSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "location-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/LocationControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "uuid" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/UUIDControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "matrix-checkboxes" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MatrixControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-month-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MonthRangeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-quarter-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/QuarterRangeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "nested-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NestedSelectControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-number" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/NumberControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PickerControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "radios" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RadiosControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "radio" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RadioControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RangeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-rating" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RatingControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-rich-text" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RichTextControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-repeat" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/RepeatControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "select", + "multi-select" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SelectControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-sub-form" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SubFormControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "switch" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SwitchControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "static" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/StaticExactControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-table" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TableControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs-transfer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsTransferControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-tag" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TagControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "enum": [ + "input-text", + "input-email", + "input-url", + "input-password", + "native-date", + "native-time", + "native-number" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TextControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "textarea" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TextareaControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "transfer" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TransferControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "transfer-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TransferPickerControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tabs-transfer-picker" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TabsTransferPickerControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "input-tree" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TreeControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "tree-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/TreeSelectControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "users-select" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/UserSelectControlSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "date-range" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/DateRangeSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "multiline-text" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/MultilineTextSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "password" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/PasswordSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "words" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/WordsSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "type": "string", + "const": "slider" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/SliderSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "type": { + "enum": [ + "action", + "button", + "submit", + "reset" + ] + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/ActionSchemaLoose" + } + }, + { + "if": { + "properties": { + "type": { + "const": "crud" + } + }, + "required": [ + "type" + ] + }, + "then": { + "$ref": "#/definitions/CRUDSchema", + "additionalProperties": true + } + } + ] + }, + "ActionSchemaLoose": { + "if": { + "required": [ + "actionType" + ] + }, + "then": { + "allOf": [ + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "ajax" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/AjaxActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "url" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/UrlActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "link" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/LinkActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "dialog" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/DialogActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "drawer" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/DrawerActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "toast" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/ToastActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "copy" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/CopyActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "reload" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/ReloadActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "const": "email" + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/EmailActionSchema", + "additionalProperties": true + } + }, + { + "if": { + "properties": { + "actionType": { + "type": "string", + "enum": [ + "prev", + "next", + "cancel", + "close", + "submit", + "confirm", + "add", + "reset", + "reset-and-submit" + ] + } + }, + "required": [ + "actionType" + ] + }, + "then": { + "$ref": "#/definitions/OtherActionSchema", + "additionalProperties": true + } + } + ] + }, + "else": { + "$ref": "#/definitions/VanillaAction" + } + } + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d20d564 --- /dev/null +++ b/pom.xml @@ -0,0 +1,126 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.13 + + + + com.eip4 + eip4-platform + 0.1.0-SNAPSHOT + pom + eip4-platform + EIP4 平台(路线 A'):双层制模块化单体——保真层供奉,现代层生长。见《eip4-platform架构设计.md》 + + + platform-legacy-core + platform-metadata + platform-auth + platform-flow-gateway + platform-converter + platform-ai + platform-parity + platform-app + + + + 17 + 17 + 17 + 1.3.0 + + + + + + com.eip4 + platform-legacy-core + ${project.version} + + + com.eip4 + platform-metadata + ${project.version} + + + com.eip4 + platform-auth + ${project.version} + + + com.eip4 + platform-flow-gateway + ${project.version} + + + com.eip4 + platform-converter + ${project.version} + + + com.eip4 + platform-ai + ${project.version} + + + com.eip4 + platform-parity + ${project.version} + + + + org.dom4j + dom4j + 2.1.4 + + + jaxen + jaxen + 2.0.0 + + + + org.apache.groovy + groovy-jsr223 + 4.0.24 + + + + joda-time + joda-time + 2.12.7 + + + + org.json + json + 20240303 + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.6.0 + + + + com.networknt + json-schema-validator + 1.5.2 + + + + com.tngtech.archunit + archunit-junit5 + ${archunit.version} + test + + + +