jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
202 lines (201 loc) • 17.5 kB
TypeScript
import type { ApiObject, BaseSchemaWithoutType, RendererProps, SchemaClassName, SchemaExpression } from 'jamis-core';
import type { ActionSchema, AlertSchema, AnchorNavSchema, AppRouterSchema, AppSchema, ArrayControlSchema, AudioSchema, AvatarSchema, BarCodeSchema, BreadcrumbSchema, ButtonGroupControlSchema, ButtonGroupSchema, ButtonToolbarSchema, CRUD2Schema, CRUDBultinToolbarType, CRUDSchema, CalendarSchema, CardSchema, CardsSchema, CarouselSchema, ChainedSelectControlSchema, ChartSchema, CheckboxControlSchema, CheckboxesControlSchema, CodeSchema, CollapseGroupSchema, CollapseSchema, ColorSchema, ComboControlSchema, ConditionBuilderControlSchema, ContainerSchema, CopyrightSchema, CustomSchema, DateControlSchema, DateRangeControlSchema, DateSchema, DateTimeControlSchema, DialogSchema, DialogSchemaBase, DiffControlSchema, DividerSchema, DrawerSchema, DropdownButtonSchema, EachSchema, EditorControlSchema, FieldSetControlSchema, FileControlSchema, FlexSchema, FormControlSchema, FormSchema, FormulaControlSchema, Grid2DSchema, GridNavSchema, GridSchema, GroupControlSchema, HBoxSchema, HiddenControlSchema, IFrameSchema, IconPickerControlSchema, IconSchema, ImageControlSchema, ImageSchema, ImagesSchema, InputCityControlSchema, InputColorControlSchema, InputFormulaControlSchema, InputGroupControlSchema, InputTableControlSchema, JSONSchemaEditorControlSchema, JsonSchema, LinkSchema, ListControlSchema, ListSchema, LocationControlSchema, MappingSchema, MarkdownSchema, MatrixControlSchema, MonthControlSchema, MonthRangeControlSchema, NavSchema, NestedSelectControlSchema, NumberControlSchema, OperationSchema, PageSchema, PaginationSchema, PaginationWrapperSchema, PanelSchema, PickerControlSchema, PlainSchema, PortletSchema, ProgressSchema, PropertySchema, QRCodeSchema, QuarterControlSchema, QuarterRangeControlSchema, RadiosControlSchema, RangeControlSchema, RatingControlSchema, RemarkSchema, RepeatControlSchema, RichTextControlSchema, SearchBoxSchema, SelectControlSchema, ServiceSchema, SparkLineSchema, SpinnerSchema, StaticActionSchema, StaticCodeSchema, StaticColorSchema, StaticContainerSchema, StaticControlSchema, StaticCustomSchema, StaticDateSchema, StaticImageSchema, StaticImagesSchema, StaticJsonSchema, StaticListSchema, StaticMappingSchema, StaticPlainSchema, StaticProgressSchema, StaticServiceSchema, StaticTableSchema, StaticTplSchema, StatusSchema, StepsSchema, SubFormControlSchema, SwitchControlSchema, TableSchema, TableViewSchema, TabsSchema, TabsTransferControlSchema, TabsTransferPickerControlSchema, TagControlSchema, TagSchema, TasksSchema, TextControlSchema, TextareaControlSchema, TimeControlSchema, TimelineSchema, TooltipWrapperSchema, TplSchema, TransferControlSchema, TransferPickerControlSchema, TreeControlSchema, UUIDControlSchema, UserSelectControlSchema, VBoxSchema, VideoSchema, WizardSchema, WrapperSchema, WujieSchema, YearControlSchema, YearRangeControlSchema } from './types';
import type { StaticWrapperSchema } from './r-container/types';
import type { StaticFlexSchema } from './r-layout/types';
import type { TableCellSchema } from './r-table/types';
import type { AIChatBoxSchema } from './r-ai-chatbox/types';
declare global {
type JSObject = Record<string, any>;
}
export type SchemaType = 'form' | 'button' | 'submit' | 'reset' | 'action' | 'static-submit' | 'static-reset' | 'static-button' | 'static-action' | 'alert' | 'app' | 'app-router' | 'audio' | 'avatar' | 'button-group' | 'button-toolbar' | 'breadcrumb' | 'card' | 'cards' | 'carousel' | 'chart' | 'calendar' | 'collapse' | 'collapse-group' | 'color' | 'static-color' | 'container' | 'static-container' | 'crud' | 'crud2' | 'custom' | 'static-custom' | 'date' | 'datetime' | 'time' | 'month' | 'static-date' | 'static-datetime' | 'static-time' | 'static-month' | 'dialog' | 'spinner' | 'divider' | 'dropdown-button' | 'drawer' | 'each' | 'flex' | 'grid' | 'grid-2d' | 'hbox' | 'icon' | 'iframe' | 'image' | 'images' | 'static-image' | 'static-images' | 'json-schema' | 'json-schema-editor' | 'json' | 'static-json' | 'link' | 'log' | 'list' | 'static-list' | 'map' | 'mapping' | 'static-map' | 'static-mapping' | 'markdown' | 'nav' | 'page' | 'pagination' | 'pagination-wrapper' | 'property' | 'operation' | 'panel' | 'plain' | 'text' | 'static-text' | 'static-plain' | 'progress' | 'static-progress' | 'qrcode' | 'qr-code' | 'barcode' | 'remark' | 'search-box' | 'service' | 'static-service' | 'sparkline' | 'status' | 'switch' | 'table' | 'static-table' | 'table2' | 'tabs' | 'html' | 'tpl' | 'static-html' | 'static-tpl' | 'tasks' | 'vbox' | 'video' | 'wizard' | 'wrapper' | 'web-component' | 'anchor-nav' | 'steps' | 'timeline' | 'control' | 'input-array' | 'button' | 'submit' | 'reset' | 'button-group-select' | 'button-toolbar' | 'chained-select' | 'chart-radios' | 'checkbox' | 'checkboxes' | 'input-city' | 'input-color' | 'combo' | 'condition-builder' | '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' | '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' | 'input-image' | 'input-group' | 'list-select' | 'location-picker' | 'matrix-checkboxes' | 'input-month-range' | 'input-quarter-range' | 'nested-select' | 'input-number' | 'panel' | 'picker' | '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' | 'wujie' | 'copyright' | 'native-date' | 'native-time' | 'native-number' | 'code' | 'static-code' | 'tooltip-wrapper' | 'nav' | 'input-kv' | 'cell' | 'table-cell' | CRUDBultinToolbarType | `custom-${string}` | `static-custom-${string}` | 'ai-chatbox';
export interface SchemaObjectAny extends BaseSchema {
type: SchemaType;
[prop: string]: any;
}
/**
* 带有数据域的容器组件
*/
export type SchemaObjectScoped = AppSchema | PageSchema | CRUDSchema | FormSchema | DialogSchema | DrawerSchema | WizardSchema | ServiceSchema;
/**
* 通过component函数自定义渲染组件
*/
export interface CustomComponentSchema extends BaseSchema {
type?: never;
component: (props: RendererProps) => JSX.Element;
}
export type SchemaObject = PageSchema | StaticTplSchema | TplSchema | RemarkSchema | ActionSchema | AlertSchema | AudioSchema | AvatarSchema | ButtonGroupSchema | ButtonToolbarSchema | CalendarSchema | CardSchema | CardsSchema | CarouselSchema | ChartSchema | CollapseSchema | CollapseGroupSchema | ColorSchema | ContainerSchema | StaticContainerSchema | CRUDSchema | CRUD2Schema | DateSchema | DialogSchema | DividerSchema | DrawerSchema | DropdownButtonSchema | EachSchema | GridSchema | Grid2DSchema | HBoxSchema | IconSchema | IFrameSchema | ImageSchema | ImagesSchema | JsonSchema | LinkSchema | ListSchema | MappingSchema | NavSchema | OperationSchema | PaginationSchema | PaginationWrapperSchema | PanelSchema | PlainSchema | StaticPlainSchema | ProgressSchema | StaticProgressSchema | QRCodeSchema | SearchBoxSchema | ServiceSchema | StaticServiceSchema | SparkLineSchema | StatusSchema | SpinnerSchema | TableSchema | TabsSchema | TasksSchema | VBoxSchema | VideoSchema | WizardSchema | WrapperSchema | StaticWrapperSchema | TooltipWrapperSchema | FormSchema | AnchorNavSchema | StepsSchema | PortletSchema | TimelineSchema | FormControlSchema | ArrayControlSchema | ButtonGroupControlSchema | ChainedSelectControlSchema | CheckboxControlSchema | CheckboxesControlSchema | InputCityControlSchema | InputColorControlSchema | InputFormulaControlSchema | ComboControlSchema | ConditionBuilderControlSchema | DateControlSchema | DateTimeControlSchema | TimeControlSchema | MonthControlSchema | MonthControlSchema | QuarterControlSchema | YearControlSchema | DateRangeControlSchema | DiffControlSchema | EditorControlSchema | FieldSetControlSchema | FileControlSchema | FormulaControlSchema | GroupControlSchema | HiddenControlSchema | IconPickerControlSchema | ImageControlSchema | InputGroupControlSchema | ListControlSchema | JSONSchemaEditorControlSchema | LocationControlSchema | UUIDControlSchema | MatrixControlSchema | MonthRangeControlSchema | QuarterRangeControlSchema | NestedSelectControlSchema | NumberControlSchema | PickerControlSchema | RadiosControlSchema | RangeControlSchema | RatingControlSchema | RichTextControlSchema | RepeatControlSchema | SelectControlSchema | SubFormControlSchema | SwitchControlSchema | StaticControlSchema | InputTableControlSchema | TabsTransferControlSchema | TagControlSchema | TagSchema | TextControlSchema | TextareaControlSchema | TransferControlSchema | TransferPickerControlSchema | TabsTransferPickerControlSchema | TreeControlSchema | UserSelectControlSchema | FlexSchema | StaticFlexSchema | AppSchema | PropertySchema | CustomSchema | StaticCustomSchema | CodeSchema | BreadcrumbSchema | GridNavSchema | MarkdownSchema | BarCodeSchema | TableViewSchema | StaticCodeSchema | StaticListSchema | StaticDateSchema | StaticActionSchema | StaticMappingSchema | StaticJsonSchema | StaticImageSchema | StaticImagesSchema | StaticColorSchema | StaticTableSchema | CustomComponentSchema | YearRangeControlSchema | WujieSchema | TableCellSchema | CopyrightSchema | AppRouterSchema | AIChatBoxSchema;
export type SchemaCollection = SchemaObject | SchemaTpl | Array<SchemaObject | SchemaTpl>;
export type FormItemSchemaObject = TextControlSchema | FormControlSchema | ArrayControlSchema | ButtonGroupControlSchema | ChainedSelectControlSchema | CheckboxControlSchema | CheckboxesControlSchema | InputCityControlSchema | InputColorControlSchema | InputFormulaControlSchema | ComboControlSchema | ConditionBuilderControlSchema | DateControlSchema | DateTimeControlSchema | TimeControlSchema | MonthControlSchema | MonthControlSchema | QuarterControlSchema | YearControlSchema | DateRangeControlSchema | DiffControlSchema | EditorControlSchema | FieldSetControlSchema | FileControlSchema | FormulaControlSchema | GroupControlSchema | HiddenControlSchema | IconPickerControlSchema | ImageControlSchema | InputGroupControlSchema | ListControlSchema | JSONSchemaEditorControlSchema | LocationControlSchema | UUIDControlSchema | MatrixControlSchema | MonthRangeControlSchema | QuarterRangeControlSchema | NestedSelectControlSchema | NumberControlSchema | PickerControlSchema | RadiosControlSchema | RangeControlSchema | RatingControlSchema | RichTextControlSchema | RepeatControlSchema | SelectControlSchema | SubFormControlSchema | SwitchControlSchema | StaticControlSchema | InputTableControlSchema | TabsTransferControlSchema | TagControlSchema | TextControlSchema | TextareaControlSchema | TransferControlSchema | TransferPickerControlSchema | TabsTransferPickerControlSchema | TreeControlSchema | UserSelectControlSchema | YearRangeControlSchema | StaticCodeSchema | StaticListSchema | StaticDateSchema | StaticActionSchema | StaticMappingSchema | StaticJsonSchema | StaticImageSchema | StaticImagesSchema | StaticColorSchema | StaticTableSchema | StaticCustomSchema | StaticServiceSchema | StaticProgressSchema | StaticPlainSchema | StaticContainerSchema | StaticTplSchema;
export type FormItemSchemaCollection = FormItemSchemaObject | FormItemSchemaObject[];
export type SchemaApiObject = ApiObject;
export type SchemaApi = string | SchemaApiObject;
/**
* 配置刷新动作,这个动作通常在完成渲染器本省的固定动作后出发。
*
* 一般用来配置目标组件的 name 属性。多个目标可以用逗号隔开。
*
* 当目标是 windows 时表示刷新整个页面。
*
* 刷新目标的同时还支持传递参数如: `foo?a=${a}&b=${b},boo?c=${c}`
*/
export type SchemaReload = string;
/**
* 页面跳转地址,支持相对地址。
*/
export type SchemaRedirect = string;
/**
* 支持两种语法,但是不能混着用。分别是:
*
* 1. `${xxx}` 或者 `${xxx|upperCase}`
* 2. `<%= data.xxx %>`
*
*
* 更多
*/
export type SchemaTpl = string;
/**
* 初始数据,设置得值可用于组件内部模板使用。
*/
export type SchemaDefaultData = {
[propName: string]: any;
};
/**
* 用来关联 json schema 的,不用管。
*/
export type SchemaSchema = string;
/**
* iconfont 里面的类名。
*/
export type SchemaIcon = string;
export type SchemaTokenizeableString = string;
export type SchemaUrlPath = SchemaTokenizeableString;
export type SchemaTooltip = string | {
/**
* 标题
*/
title?: string;
/**
* 内容
*/
content: string;
};
export type SchemaFunction = string | Function;
export type BaseSchema = BaseSchemaWithoutType;
export interface FeedbackDialog extends DialogSchemaBase {
/**
* 可以用来配置 feedback 的出现条件
*/
visibleOn?: string;
/**
* feedback 弹框取消是否中断后续操作
*/
skipRestOnCancel?: boolean;
/**
* feedback 弹框确认是否中断后续操作
*/
skipRestOnConfirm?: boolean;
}
export type RootSchema = PageSchema;
export interface ToastSchemaBase extends BaseSchema {
/**
* 轻提示内容
*/
items: Array<{
title?: SchemaCollection;
body: SchemaCollection;
level: 'info' | 'success' | 'error' | 'warning';
id: string;
position?: 'top-right' | 'top-center' | 'top-left' | 'bottom-center' | 'bottom-left' | 'bottom-right' | 'center';
closeButton?: boolean;
showIcon?: boolean;
timeout?: number;
}>;
/**
* 弹出位置
*/
position: 'top-right' | 'top-center' | 'top-left' | 'bottom-center' | 'bottom-left' | 'bottom-right' | 'center';
/**
* 是否展示关闭按钮
*/
closeButton: boolean;
/**
* 是否展示图标
*/
showIcon?: boolean;
/**
* 持续时间
*/
timeout: number;
}
export type { SchemaClassName, SchemaExpression };
export * from './components/types';
export * from './core/types';
export * from './hoc/types';
export * from './form-checkbox/types';
export * from './form-color/types';
export * from './form-combo/types';
export * from './form-condition-builder/types';
export * from './form-editor/types';
export * from './form-excel/types';
export * from './form-fieldset/types';
export * from './form-file/types';
export * from './form-formula/types';
export * from './form-group/types';
export * from './r-image/types';
export * from './form-input-city/types';
export * from './form-json-schema-editor/types';
export * from './form-json-schema/types';
export * from './form-picker/types';
export * from './form-range/types';
export * from './form-rating/types';
export * from './form-repeat/types';
export * from './form-select/types';
export * from './form-static/types';
export * from './form-static/types';
export * from './form-subform/types';
export * from './form-subform/types';
export * from './form-text/types';
export * from './form-text/types';
export * from './form-transfer/types';
export * from './form-uuid/types';
export * from './form/types';
export * from './r-tag/types';
export * from './r-app/types';
export * from './r-button/types';
export * from './r-calendar/types';
export * from './r-card/types';
export * from './r-collapse/types';
export * from './r-crud/types';
export * from './r-dialog/types';
export * from './r-grid/types';
export * from './r-layout/types';
export * from './r-list/types';
export * from './r-nav/types';
export * from './r-page/types';
export * from './r-pagination/types';
export * from './r-service/types';
export * from './r-spinner/types';
export * from './r-table/types';
export * from './r-tabs/types';
export * from './r-timeline/types';
export * from './r-tree/types';
export * from './r-wujie/types';
export * from './r-spark-line/types';
export * from './r-container/types';
export * from './r-code/types';
export * from './r-steps/types';
export * from './r-progress/types';
export * from './r-property/types';
export * from './r-wizard/types';
export * from './r-tasks/types';
export * from './r-chart/types';
export * from './r-breadcrumb/types';
export * from './r-media/types';
export * from './r-mapping/types';
export * from './r-log/types';
export * from './r-searchbox/types';
export * from './renderers/types';
export * from './r-copyright/types';
export * from './r-tour/types';
export * from './r-ai-chatbox/types';
export * from './sdk/types';