grist/dsl/spreadsheet.xsd
2025-07-16 12:13:39 +08:00

470 lines
20 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.torchdb.com/spreadsheet"
xmlns:tns="https://www.torchdb.com/spreadsheet" elementFormDefault="qualified">
<element name="spreadsheet">
<complexType>
<sequence>
<element name="cell" type="tns:cell" minOccurs="1" maxOccurs="unbounded"/>
<element name="row" type="tns:row" minOccurs="1" maxOccurs="unbounded"/>
<element name="column" type="tns:column" minOccurs="1" maxOccurs="unbounded"/>
<element name="header" type="tns:header-footer" minOccurs="0" maxOccurs="1"/>
<element name="footer" type="tns:header-footer" minOccurs="0" maxOccurs="1"/>
<element name="paper" type="tns:paper" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
</element>
<complexType name="header-footer">
<sequence>
<element name="left" type="tns:content" minOccurs="0" maxOccurs="1"/>
<element name="center" type="tns:content" minOccurs="0" maxOccurs="1"/>
<element name="right" type="tns:content" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="font-family" type="string"/>
<attribute name="font-size" type="int"/>
<attribute name="forecolor" type="string"/>
<attribute name="bgcolor" type="string"/>
<!-- justify-content 水平 hAlign -->
<attribute name="h-align" type="string"/>
<!-- align-items 垂直 vAlign -->
<attribute name="v-align" type="string"/>
<!-- 边距 -->
<attribute name="margin" type="int"/>
<attribute name="bold" type="boolean"/>
<attribute name="italic" type="boolean"/>
<attribute name="underline" type="boolean"/>
<attribute name="line-through" type="boolean"/>
</complexType>
<complexType name="content" mixed="true"/>
<complexType name="paper">
<attribute name="type" use="required">
<simpleType>
<restriction base="string">
<enumeration value="A0"/>
<enumeration value="A1"/>
<enumeration value="A2"/>
<enumeration value="A3"/>
<enumeration value="A4"/>
<enumeration value="A5"/>
<enumeration value="A6"/>
<enumeration value="A7"/>
<enumeration value="A8"/>
<enumeration value="A9"/>
<enumeration value="A10"/>
<enumeration value="B0"/>
<enumeration value="B1"/>
<enumeration value="B2"/>
<enumeration value="B3"/>
<enumeration value="B4"/>
<enumeration value="B5"/>
<enumeration value="B6"/>
<enumeration value="B7"/>
<enumeration value="B8"/>
<enumeration value="B9"/>
<enumeration value="B10"/>
<enumeration value="CUSTOM"/>
</restriction>
</simpleType>
</attribute>
<attribute name="orientation" use="required">
<simpleType>
<restriction base="string">
<enumeration value="portrait"/>
<enumeration value="landscape"/>
</restriction>
</simpleType>
</attribute>
<attribute name="width" type="int"/>
<attribute name="height" type="int"/>
<attribute name="width-mm" type="int"/>
<attribute name="height-mm" type="int"/>
<attribute name="left-margin" type="int"/>
<attribute name="left-margin-mm" type="int"/>
<attribute name="right-margin" type="int"/>
<attribute name="right-margin-mm" type="int"/>
<attribute name="top-margin" type="int"/>
<attribute name="top-margin-mm" type="int"/>
<attribute name="bottom-margin" type="int"/>
<attribute name="bottom-margin-mm" type="int"/>
<attribute name="paging-mode">
<simpleType>
<restriction base="string">
<enumeration value="fitpage"/>
<enumeration value="fixrows"/>
<enumeration value="onepage"/>
</restriction>
</simpleType>
</attribute>
<attribute name="fixrows" type="int"/>
<attribute name="column-enabled" type="boolean"/>
<attribute name="column-count" type="int"/>
<attribute name="column-margin" type="int"/>
<!--for tree report collapse level-->
<attribute name="collapse-tree-level" type="int"/>
</complexType>
<complexType name="row">
<attribute name="row-number" type="int" use="required"/>
<attribute name="height" type="int" use="required"/>
<attribute name="band">
<simpleType>
<restriction base="string">
<!--标题行-->
<enumeration value="title"/>
<!--重复表头-->
<enumeration value="headerrepeat"/>
<!--重复表尾-->
<enumeration value="footerrepeat"/>
<!--总结行-->
<enumeration value="summary"/>
</restriction>
</simpleType>
</attribute>
<attribute name="freeze" use="optional">
<simpleType>
<restriction base="string">
<enumeration value="top"/>
<enumeration value="bottom"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="column">
<attribute name="col-number" type="int" use="required"/>
<attribute name="width" type="int" use="required"/>
<attribute name="hide" type="boolean"/>
<attribute name="freeze" use="optional">
<simpleType>
<restriction base="string">
<enumeration value="left"/>
<enumeration value="right"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="cell">
<sequence>
<element name="simple-value" type="tns:simple-value" minOccurs="0" maxOccurs="1"/>
<element name="slash-value" type="tns:slash-value" minOccurs="0" maxOccurs="1"/>
<element name="expression-value" type="tns:expression-value" minOccurs="0" maxOccurs="1"/>
<element name="dataset-value" type="tns:dataset-value" minOccurs="0" maxOccurs="1"/>
<element name="cell-style" type="tns:cell-style" minOccurs="0" maxOccurs="1"/>
<element name="condition-property-item" type="tns:condition-property-item"
maxOccurs="unbounded" minOccurs="0"/>
<element name="link-parameter" type="tns:link-parameter" maxOccurs="unbounded" minOccurs="0"/>
</sequence>
<attribute name="name" type="string" use="required"/>
<attribute name="row" type="int" use="required"/>
<attribute name="col" type="int" use="required"/>
<attribute name="left-cell" type="string"/>
<attribute name="top-cell" type="string"/>
<attribute name="col-span" type="int"/>
<attribute name="row-span" type="int"/>
<attribute name="expand" use="required">
<simpleType>
<restriction base="string">
<enumeration value="None"/>
<enumeration value="Right"/>
<enumeration value="Down"/>
</restriction>
</simpleType>
</attribute>
<attribute name="fill-blank-rows" type="boolean" default="false"/>
<attribute name="multiple" type="int" default="1"/>
<!-- 解决多个没有关联关系的数据集下的根格平行渲染不会错开 -->
<attribute name="multiRoot" type="boolean" default="false"/>
<attribute name="link-url" type="string"/>
<attribute name="link-target-window">
<simpleType>
<restriction base="string">
<enumeration value="_blank"/>
<enumeration value="_self"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="condition-property-item">
<sequence>
<element name="condition" type="tns:condition" maxOccurs="unbounded" minOccurs="0"/>
<element name="link-parameter" type="tns:link-parameter" maxOccurs="unbounded" minOccurs="0"/>
<element name="cell-style" type="tns:cell-style" maxOccurs="1" minOccurs="0"/>
<element name="expr" type="tns:text" minOccurs="0" maxOccurs="1"/>
<element name="paging" type="tns:condition-paging" maxOccurs="1" minOccurs="0"/>
</sequence>
<attribute name="row-height" type="int" use="optional"/>
<attribute name="col-width" type="int" use="optional"/>
<attribute name="new-value" type="string" use="optional"/>
<attribute name="link-url" type="string" use="optional"/>
<attribute name="link-target-window" use="optional">
<simpleType>
<restriction base="string">
<enumeration value="_blank"/>
<enumeration value="_self"/>
</restriction>
</simpleType>
</attribute>
<attribute name="type" use="required">
<simpleType>
<restriction base="string">
<enumeration value="normal"/>
<enumeration value="expr"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="condition-paging">
<attribute name="line" type="int"/>
<attribute name="position">
<simpleType>
<restriction base="string">
<enumeration value="before"/>
<enumeration value="after"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<!--
单元格值自定义渲染器; 因为可以有多个值渲染器套娃输出,所以翻译时可能需要根据功能优先次序进行追加,避免输出结果不达预期
-->
<complexType name="value-render">
<sequence>
<!-- Cell Render`s JSON Conf Data -->
<element name="properties" type="tns:text" maxOccurs="1" minOccurs="0"/>
</sequence>
<!-- Java Class Full Name (implements ICellRender) -->
<attribute name="class-name" type="string" use="required"/>
<!-- Java Class Full Name (JavaBean for JSON Conf Data to convert) -->
<attribute name="properties-class-name" type="string" default=""/>
</complexType>
<complexType name="cell-style">
<sequence>
<element name="left-border" type="tns:border" minOccurs="0" maxOccurs="1"/>
<element name="right-border" type="tns:border" minOccurs="0" maxOccurs="1"/>
<element name="top-border" type="tns:border" minOccurs="0" maxOccurs="1"/>
<element name="bottom-border" type="tns:border" minOccurs="0" maxOccurs="1"/>
<element name="zebra-color" type="tns:zebra-color" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="font-family" type="string"/>
<attribute name="font-size" type="int"/>
<attribute name="forecolor" type="string"/>
<attribute name="bgcolor" type="string"/>
<attribute name="format" type="string"/>
<attribute name="template" type="string"/>
<attribute name="show-tree" type="boolean"/>
<attribute name="bold" type="boolean"/>
<attribute name="italic" type="boolean"/>
<attribute name="underline" type="boolean"/>
<attribute name="line-through" type="boolean"/>
<attribute name="wrap-compute" type="boolean"/>
<attribute name="show-html" type="boolean"/>
<attribute name="for-condition" type="boolean"/>
<attribute name="align" default="left">
<simpleType>
<restriction base="string">
<enumeration value="left"/>
<enumeration value="center"/>
<enumeration value="right"/>
</restriction>
</simpleType>
</attribute>
<attribute name="valign">
<simpleType>
<restriction base="string">
<enumeration value="top"/>
<enumeration value="middle"/>
<enumeration value="bottom"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="border">
<attribute name="width" type="int"/>
<attribute name="color" type="string"/>
<attribute name="style" default="solid">
<simpleType>
<restriction base="string">
<enumeration value="solid"/>
<enumeration value="dashed"/>
<enumeration value="dotted"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<!--间隔色-->
<complexType name="zebra-color">
<!--作用区域-->
<attribute name="range" type="string" use="required"/>
<!---->
<attribute name="single-color" type="string" use="required"/>
<!---->
<attribute name="double-color" type="string" use="required"/>
</complexType>
<complexType name="simple-value">
<sequence>
<element name="text" type="tns:text" maxOccurs="1" minOccurs="1"/>
<element name="render" type="tns:value-render" maxOccurs="unbounded" minOccurs="0"/>
</sequence>
</complexType>
<!-- 斜线表头定义 -->
<complexType name="slash-value">
<sequence>
<!-- put custom svg document -->
<element name="data" type="tns:text" maxOccurs="1" minOccurs="0"/>
</sequence>
<!-- slash start point -->
<attribute name="start-point" default="leftUp">
<simpleType>
<restriction base="string">
<enumeration value="leftUp"/>
<enumeration value="leftDown"/>
<enumeration value="rightUp"/>
<enumeration value="rightDown"/>
</restriction>
</simpleType>
</attribute>
<!-- if titles empty then will read custom data(svg document) -->
<attribute name="titles" type="string" default=""/>
<attribute name="line-width" type="int" default="1"/>
<!-- css style color value for create svg document -->
<attribute name="line-color" type="string" default="#000000"/>
</complexType>
<complexType name="expression-value">
<sequence>
<element name="text" type="tns:text" maxOccurs="1" minOccurs="1"/>
<element name="render" type="tns:value-render" maxOccurs="unbounded" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="text" mixed="true"/>
<complexType name="dataset-value">
<sequence>
<element name="conditions" maxOccurs="1" minOccurs="0">
<complexType>
<sequence>
<element name="condition" minOccurs="1" maxOccurs="unbounded">
<complexType>
<sequence>
<!--QSL: (a>1 and b like '%ood') and c='Mike'-->
<element type="tns:text" name="expr"/>
</sequence>
<!--创建定义时: condition current 与 all都只能存在一个-->
<attribute name="scope" default="current">
<simpleType>
<restriction base="string">
<!--只针对当前单元格过滤,即受父格约束-->
<enumeration value="current"/>
<!--针对全数据集过滤-->
<enumeration value="all"/>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="render" type="tns:value-render" maxOccurs="unbounded" minOccurs="0"/>
<!-- 以其它数据集字段类型单元格作为排序参考,此处值为 单元格名称 -->
<element name="order-by" type="tns:text" maxOccurs="1" minOccurs="0"/>
</sequence>
<!-- 主题模型名,可选,获取不到就是空,向下兼容 -->
<attribute name="topic-dataset-name" type="string" default="" use="optional"/>
<attribute name="dataset-name" type="string" use="required"/>
<attribute name="aggregate" type="string" use="required"/>
<attribute name="property" type="string" use="required"/>
<attribute name="order">
<simpleType>
<restriction base="string">
<enumeration value="desc"/>
<enumeration value="asc"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="link-parameter">
<sequence>
<element name="value" type="tns:link-parameter-value" maxOccurs="1" minOccurs="1"/>
</sequence>
<attribute name="name" type="string" use="required"/>
</complexType>
<complexType name="link-parameter-value" mixed="true"/>
<complexType name="group-item">
<sequence>
<element name="condition" type="tns:condition" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="name" type="string" use="required"/>
</complexType>
<complexType name="condition">
<sequence>
<element name="value" type="tns:condition-value" minOccurs="0" maxOccurs="1"/>
<element name="left" type="tns:condition-value" minOccurs="0" maxOccurs="1"/>
<element name="right" type="tns:condition-value" minOccurs="0" maxOccurs="1"/>
</sequence>
<!--left is expression, require.-->
<attribute name="type" use="optional"/>
<!--for dataset field name.-->
<attribute name="property" use="optional"/>
<!--default is and-->
<attribute name="join" use="required">
<simpleType>
<restriction base="string">
<enumeration value="and"/>
<enumeration value="or"/>
</restriction>
</simpleType>
</attribute>
<attribute name="op" use="required">
<simpleType>
<restriction base="string">
<enumeration value="GreatThen"/>
<enumeration value="EqualsGreatThen"/>
<enumeration value="LessThen"/>
<enumeration value="EqualsLessThen"/>
<enumeration value="Equals"/>
<enumeration value="NotEquals"/>
<enumeration value="In"/>
<enumeration value="NotIn"/>
<enumeration value="Like"/>
<enumeration value="NotLike"/>
<enumeration value="Empty"/>
<enumeration value="NotEmpty"/>
<enumeration value="Contain"/>
<enumeration value="NotContain"/>
<enumeration value="DayAt"/>
<enumeration value="DayRange"/>
<enumeration value="MonthAt"/>
<enumeration value="MonthRange"/>
<enumeration value="QuarterAt"/>
<enumeration value="QuarterRange"/>
<enumeration value="WeekAt"/>
<enumeration value="WeekRange"/>
<enumeration value="YearAt"/>
<enumeration value="YearRange"/>
<enumeration value="Is"/>
<enumeration value="Between"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="condition-value" mixed="true"/>
</schema>