Comparing version 1.0.0-qbi39-open.6 to 2.0.0-beta.2
@@ -5,14 +5,14 @@ /** | ||
*/ | ||
import { IDataSchema } from './data-schema'; | ||
import { IStyleSchema } from './style-schema'; | ||
import { DataSchema } from './data-schema'; | ||
import { StyleSchema } from './style-schema'; | ||
/** | ||
* 面板配置 | ||
*/ | ||
export interface IPropsSchema { | ||
export interface ComponentMetaPropsSchema { | ||
/** 数据面板配置 */ | ||
dataSchema?: IDataSchema; | ||
dataSchema?: DataSchema; | ||
/** 样式面板配置 */ | ||
styleSchema?: IStyleSchema; | ||
styleSchema?: StyleSchema; | ||
/** 高级面板配置 */ | ||
advancedSchema?: IStyleSchema; | ||
advancedSchema?: StyleSchema; | ||
} | ||
@@ -22,38 +22,4 @@ /** | ||
*/ | ||
export interface BIComponentMeta { | ||
propsSchema?: IPropsSchema; | ||
export interface ComponentMeta { | ||
propsSchema?: ComponentMetaPropsSchema; | ||
} | ||
/** | ||
* 开放组件生命周期属性 | ||
*/ | ||
export interface BIComponentLifecycleProps<T = object> { | ||
container?: HTMLElement; | ||
customProps?: T; | ||
} | ||
/** | ||
* 开机阶段钩子 | ||
*/ | ||
export declare type IBootstrap<T = object, P = any> = (props?: BIComponentLifecycleProps<{ | ||
registComponentMeta?: (rawComponentMetas: T) => void; | ||
}>) => void | Promise<P>; | ||
/** | ||
* 渲染阶段钩子 | ||
*/ | ||
export declare type IMount<T = object, P = any> = (props?: BIComponentLifecycleProps<T>) => void | Promise<P>; | ||
/** | ||
* 卸载阶段钩子 | ||
*/ | ||
export declare type IUnmount<T = object, P = any> = (props?: BIComponentLifecycleProps<T>) => void | Promise<P>; | ||
/** | ||
* 更新阶段钩子 | ||
*/ | ||
export declare type IUpdate<T = object, P = any> = (props?: BIComponentLifecycleProps<T>) => void | Promise<P>; | ||
/** | ||
* 开放组件生命周期 | ||
*/ | ||
export interface BIComponentLifecycle { | ||
bootstrap?: IBootstrap; | ||
mount?: IMount; | ||
unmount?: IUnmount; | ||
update?: IUpdate; | ||
} |
@@ -5,49 +5,92 @@ /** | ||
*/ | ||
/** | ||
* 环境信息 | ||
*/ | ||
declare enum Env { | ||
/** 电子表格 */ | ||
excel = "excel", | ||
/** pc */ | ||
pc = "pc", | ||
/** 移动 */ | ||
mobile = "mobile" | ||
import { NumberFormat } from './chart-config'; | ||
import { DataCell, AreaModel, GlobalConfig } from './standard-model'; | ||
export interface ComponentPropsGlobalConfig extends GlobalConfig { | ||
/** 预览态 编辑态 */ | ||
renderMode?: 'render' | 'edit'; | ||
} | ||
/** 图表全局配置 */ | ||
export interface IGlobalConfig { | ||
/** 环境 */ | ||
env?: Env[]; | ||
/** 渲染模式 */ | ||
renderMode?: string; | ||
export interface ComponentPropsAction { | ||
/** | ||
* | ||
*/ | ||
changeViewConfig: (newViewConfig: { | ||
[key: string]: any; | ||
}) => void; | ||
/** | ||
* 图表选中, 包含下钻/联动/跳转 | ||
*/ | ||
select: (param: { | ||
dataIndex: number; | ||
}) => void; | ||
/** | ||
* 取消下钻 | ||
*/ | ||
cancelDrill: () => void; | ||
/** | ||
* 取消联动 | ||
*/ | ||
cancelLinkage: () => void; | ||
} | ||
interface ComponentPropsFieldSettingConfig { | ||
/** 字段别名 */ | ||
aliasName: string; | ||
/** 是否有更改 */ | ||
nameChangedFlag: boolean; | ||
/** 数值显示格式 */ | ||
numberFormat: NumberFormat; | ||
[key: string]: any; | ||
} | ||
export interface ComponentPropsColorSeries { | ||
/** 色系key */ | ||
key: string; | ||
/** 色系名称 */ | ||
name: string; | ||
/** 色系颜色 */ | ||
colors: string; | ||
} | ||
export interface ComponentPropsViewConfig { | ||
/** 标题 */ | ||
caption?: string; | ||
/** 主题 */ | ||
setting?: any; | ||
chartColorSeries?: ComponentPropsColorSeries; | ||
/** 皮肤 */ | ||
chartSkin?: 'black' | 'default'; | ||
/** 展示标题 */ | ||
title?: { | ||
/** 展示主标题/备注 */ | ||
show: boolean; | ||
/** 标题备注 */ | ||
viceName?: string; | ||
/** 标题颜色 */ | ||
color?: string; | ||
/** 展示链接跳转 */ | ||
showLink?: boolean; | ||
/** 链接地址 */ | ||
link?: string; | ||
/** 链接文案 */ | ||
linkName?: string; | ||
}; | ||
/** 列设置 */ | ||
fieldSettingMap?: { | ||
[fieldId: string]: ComponentPropsFieldSettingConfig; | ||
}; | ||
[key: string]: any; | ||
} | ||
/** | ||
* 数据格式 | ||
*/ | ||
export interface IDataCell { | ||
/** 所属字段id(一般是度量) */ | ||
fieldId: string; | ||
/** 原始值 */ | ||
originValue: string; | ||
/** 展示值 */ | ||
value: string; | ||
geoInfo?: object; | ||
} | ||
/** | ||
* bi 组件通用属性模型 | ||
*/ | ||
export interface BIComponentProps { | ||
/** 样式信息 */ | ||
viewConfig: object; | ||
/** 数值区域的数据 */ | ||
dataConfig: object; | ||
/** 高级配置 */ | ||
export interface ComponentProps { | ||
/** 样式面板配置 */ | ||
viewConfig: ComponentPropsViewConfig; | ||
/** 数据面板配置 */ | ||
dataConfig: AreaModel[]; | ||
/** 高级面板配置 */ | ||
advancedConfig: object; | ||
/** 全局配置 */ | ||
globalConfig?: IGlobalConfig; | ||
/** 全局配置 */ | ||
data: IDataCell[][]; | ||
/** 图表全局配置 */ | ||
globalConfig?: ComponentPropsGlobalConfig; | ||
/** 数据 */ | ||
data: Pick<DataCell, 'fieldId' | 'geoInfo' | 'originValue' | 'value'>[][]; | ||
/** 操作 */ | ||
action?: ComponentPropsAction; | ||
} | ||
export {}; |
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
export declare type IRuleType = 'dimension' | 'measure' | 'all'; | ||
export declare type DataSchemaRuleType = 'dimension' | 'measure' | 'all'; | ||
/** | ||
@@ -20,6 +20,6 @@ * 区块功能枚举 | ||
* */ | ||
export declare type IAreaType = 'column' | 'row' | 'drill' | 'filters'; | ||
export interface IDataSchemaConfig { | ||
export declare type DataSchemaAreaType = 'column' | 'row' | 'drill' | 'filters'; | ||
export interface DataSchemaBase { | ||
/** Schema所包含的区块 */ | ||
area: IDataOptions[]; | ||
area: DataSchemaArea[]; | ||
/** 是否去重 */ | ||
@@ -32,3 +32,4 @@ distinct: boolean; | ||
} | ||
export interface IDataOptions { | ||
export interface DataSchemaArea { | ||
/** id */ | ||
id?: string; | ||
@@ -38,3 +39,3 @@ /** | ||
* */ | ||
queryAxis?: IAreaType; | ||
queryAxis?: DataSchemaAreaType; | ||
/** 区块名称 */ | ||
@@ -45,9 +46,9 @@ areaName: string; | ||
/** 区块配置规则 */ | ||
rule: IDataRules; | ||
rule: DataSchemaRule; | ||
/** 其他扩展字段 */ | ||
[key: string]: any; | ||
} | ||
export interface IDataRules { | ||
export interface DataSchemaRule { | ||
/** 允许添加的字段类型 */ | ||
type: IRuleType; | ||
type: DataSchemaRuleType; | ||
/** 是否允许为空 */ | ||
@@ -57,3 +58,3 @@ required?: boolean; | ||
maxColNum?: number; | ||
/** 是否显示改区块 */ | ||
/** 是否显示该区块 */ | ||
show?: boolean; | ||
@@ -66,4 +67,4 @@ /** 其他扩展字段 */ | ||
*/ | ||
export interface IDataSchema { | ||
schema: IDataSchemaConfig; | ||
export interface DataSchema { | ||
schema: DataSchemaBase; | ||
} |
export * from './component-props'; | ||
export * from './component-meta'; | ||
export * from './component-lifecycle'; | ||
export * from './style-schema'; | ||
export * from './data-schema'; | ||
export * from './chart-config'; | ||
export * from './standard-model'; |
@@ -6,22 +6,22 @@ /** | ||
/// <reference types="react" /> | ||
declare type DependId = number | string; | ||
export declare type StyleSchemaDependId = number | string; | ||
/** depend 类型 */ | ||
interface IValueDepend { | ||
id: DependId; | ||
interface ValueDepend { | ||
id: StyleSchemaDependId; | ||
value: any | any[]; | ||
} | ||
interface IPatternDepend { | ||
id: DependId; | ||
interface PatternDepend { | ||
id: StyleSchemaDependId; | ||
pattern: string; | ||
} | ||
export declare type IBaseDepend = IValueDepend | IPatternDepend; | ||
interface IAndDepend { | ||
$and?: IDepend[]; | ||
declare type StyleSchemaBaseDepend = ValueDepend | PatternDepend; | ||
interface StyleSchemaAndDepend { | ||
$and?: StyleSchemaDepend[]; | ||
} | ||
interface IOrDepend { | ||
$or?: IDepend[]; | ||
interface StyleSchemaOrDepend { | ||
$or?: StyleSchemaDepend[]; | ||
} | ||
export declare type IDepend = IBaseDepend & IAndDepend & IOrDepend; | ||
export declare type StyleSchemaDepend = StyleSchemaBaseDepend & StyleSchemaAndDepend & StyleSchemaOrDepend; | ||
/** 校验规则配置项类型定义 */ | ||
export interface IValidationRule { | ||
export interface StyleSchemaValidationRule { | ||
/** 必要属性(除存在代理校验属性外的情况下 必须声明):校验错误信息 */ | ||
@@ -34,4 +34,7 @@ message?: string; | ||
} | ||
export interface IValidationResult { | ||
/** 校验结果类型定义(用于 onChange 函数) */ | ||
export interface StyleSchemaValidationResult { | ||
/** 是否通过校验 */ | ||
pass: boolean; | ||
/** 不通过校验时 返回详细字段名和信息 若校验通过则空 */ | ||
details: { | ||
@@ -42,5 +45,12 @@ field: string; | ||
} | ||
export interface IStyleSchema { | ||
export interface StyleSchemaValidation { | ||
[validateFuncName: string]: (rule?: any, currentValue?: any, extras?: { | ||
data?: any; | ||
schema?: Schema; | ||
keyPaths?: string[]; | ||
}) => string | Promise<any> | void; | ||
} | ||
export interface StyleSchema { | ||
/** styleSchema 配置 */ | ||
schema: ISchemaBase; | ||
schema: StyleSchemaBase; | ||
/** 自定义编辑器 */ | ||
@@ -50,7 +60,9 @@ localEditors?: { | ||
}; | ||
/** 自定义校验函数 */ | ||
validation?: StyleSchemaValidation; | ||
/** change 事件处理函数 */ | ||
onChange?: (data?: any, currentSchema?: ISchema, keyPaths?: string[], validation?: IValidationResult) => void; | ||
onChange?: (data?: any, currentSchema?: Schema, keyPaths?: string[], validation?: StyleSchemaValidationResult) => void; | ||
} | ||
/** styleSchema 配置 */ | ||
export interface ISchemaBase<P = any, T = string> { | ||
export interface StyleSchemaBase<P = any, T = string> { | ||
/** 使用的子组件类型 */ | ||
@@ -63,3 +75,3 @@ type: T; | ||
/** 子字段 */ | ||
properties?: ISchemaProperties; | ||
properties?: StyleSchemaProperties; | ||
/** 容器类名 */ | ||
@@ -72,15 +84,15 @@ className?: string; | ||
/** 字段的 id 标识符 */ | ||
id?: DependId; | ||
id?: StyleSchemaDependId; | ||
/** 是否隐藏 */ | ||
hide?: boolean; | ||
/** 显隐依赖 */ | ||
visibleDepends?: IDepend[]; | ||
visibleDepends?: StyleSchemaDepend[]; | ||
/** 是否禁用 */ | ||
disabled?: boolean; | ||
/** 禁用依赖 */ | ||
disableDepends?: IDepend[]; | ||
disableDepends?: StyleSchemaDepend[]; | ||
/** 禁用时隐藏 */ | ||
hideIfDisable?: boolean; | ||
/** 校验规则 */ | ||
validation?: IValidationRule[]; | ||
validation?: StyleSchemaValidationRule[]; | ||
/** 是否显示必填星号标记 */ | ||
@@ -100,5 +112,10 @@ showRequiredMark?: boolean; | ||
suffix?: string; | ||
/** 布局属性 */ | ||
grid?: { | ||
row: number; | ||
col: number; | ||
}; | ||
} | ||
/** type 为 object 的配置 */ | ||
export interface ISchemaContainerObject extends ISchemaBase { | ||
export interface StyleSchemaObject extends StyleSchemaBase { | ||
type: 'object'; | ||
@@ -111,10 +128,5 @@ props?: { | ||
info?: string; | ||
/** 布局属性 */ | ||
grid?: { | ||
row: number; | ||
col: number; | ||
}; | ||
} | ||
/** type 为 array 的配置 */ | ||
export interface ISchemaContainerArray extends ISchemaBase { | ||
export interface StyleSchemaArray extends StyleSchemaBase { | ||
type: 'array'; | ||
@@ -124,8 +136,7 @@ /** 数组元素默认值 */ | ||
} | ||
export declare type ISchemaContainer = ISchemaContainerObject | ISchemaContainerArray; | ||
export declare type ISchema = ISchemaContainer | ISchemaBase; | ||
declare type Schema = StyleSchemaObject | StyleSchemaArray | StyleSchemaBase; | ||
/** properties 属性 */ | ||
export declare type ISchemaProperties = { | ||
[key: string]: ISchema; | ||
export declare type StyleSchemaProperties = { | ||
[key: string]: Schema; | ||
} | string; | ||
export {}; |
@@ -1,9 +0,1 @@ | ||
"use strict"; | ||
var Env; | ||
(function (Env) { | ||
Env["excel"] = "excel"; | ||
Env["pc"] = "pc"; | ||
Env["mobile"] = "mobile"; | ||
})(Env || (Env = {})); | ||
"use strict"; |
@@ -31,2 +31,14 @@ "use strict"; | ||
var _componentLifecycle = require("./component-lifecycle"); | ||
Object.keys(_componentLifecycle).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _componentLifecycle[key]; | ||
} | ||
}); | ||
}); | ||
var _styleSchema = require("./style-schema"); | ||
@@ -54,2 +66,26 @@ | ||
}); | ||
}); | ||
var _chartConfig = require("./chart-config"); | ||
Object.keys(_chartConfig).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _chartConfig[key]; | ||
} | ||
}); | ||
}); | ||
var _standardModel = require("./standard-model"); | ||
Object.keys(_standardModel).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _standardModel[key]; | ||
} | ||
}); | ||
}); |
export * from "./component-props"; | ||
export * from "./component-meta"; | ||
export * from "./component-lifecycle"; | ||
export * from "./style-schema"; | ||
export * from "./data-schema"; | ||
export * from "./data-schema"; | ||
export * from "./chart-config"; | ||
export * from "./standard-model"; |
{ | ||
"name": "bi-types", | ||
"version": "1.0.0-qbi39-open.6", | ||
"version": "2.0.0-beta.2", | ||
"dependencies": {}, | ||
"main": "dist/main", | ||
"module": "dist/module", | ||
"esm5": "dist/esm5", | ||
"types": "declaration/index.d.ts" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23253
33
742
2