@anov/cic-standard-sdk 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cic-sdk.cjs.js +6 -6
- package/dist/cic-sdk.es.js +1226 -1209
- package/dist/cic-sdk.umd.js +6 -6
- package/dist/sdk/CICSDK.d.ts +13 -14
- package/dist/sdk/generators/ajv.d.ts +1 -0
- package/dist/sdk/generators/meta.d.ts +5 -5
- package/dist/types/componets.d.ts +1 -0
- package/dist/types/dataSources.d.ts +1 -0
- package/dist/types/deps.d.ts +1 -3
- package/dist/types/index.d.ts +10 -5
- package/dist/types/meta.d.ts +4 -3
- package/dist/types/page.d.ts +4 -3
- package/dist/types/registry.d.ts +1 -36
- package/package.json +1 -1
package/dist/sdk/CICSDK.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { CICConfig } from '../types';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { CICPage } from '../types/page';
|
|
1
|
+
import type { CICConfig, ComponentInstance, DataSourceItem, CICPage, Meta, Layout, Registry, Variables, Dependency } from '../types';
|
|
2
|
+
import type { ICICSDK } from './ICICSDK';
|
|
3
|
+
export type { CICConfig, ComponentInstance, DataSourceItem, CICPage, Meta, Layout, Registry, Variables, Dependency, ICICSDK };
|
|
5
4
|
/**
|
|
6
5
|
* CIC SDK 类
|
|
7
6
|
* 提供对 CIC 配置的封装访问与操作
|
|
@@ -38,9 +37,9 @@ export declare class CICSDK implements ICICSDK {
|
|
|
38
37
|
*/
|
|
39
38
|
static traverseTree(root: ComponentInstance | ComponentInstance[], callback: (component: ComponentInstance, parent?: ComponentInstance) => void | boolean, parent?: ComponentInstance): void;
|
|
40
39
|
/** 创建 DataSource */
|
|
41
|
-
static createDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<
|
|
40
|
+
static createDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<DataSourceItem>;
|
|
42
41
|
static validateDataSource: (input: unknown) => import("./generators/common").Result<null>;
|
|
43
|
-
static normalizeDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) =>
|
|
42
|
+
static normalizeDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) => DataSourceItem;
|
|
44
43
|
/** 创建 Component */
|
|
45
44
|
static createComponent: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<ComponentInstance>;
|
|
46
45
|
static validateComponent: (input: unknown) => import("./generators/common").Result<null>;
|
|
@@ -50,20 +49,20 @@ export declare class CICSDK implements ICICSDK {
|
|
|
50
49
|
static validatePage: (input: unknown) => import("./generators/common").Result<null>;
|
|
51
50
|
static normalizePage: (input: unknown, options?: import("./generators/common").CreateOptions) => CICPage;
|
|
52
51
|
/** 创建 Meta/Layout */
|
|
53
|
-
static createMeta: (input: unknown) => import("./generators/common").Result<
|
|
54
|
-
static createLayout: (input: unknown) => import("./generators/common").Result<
|
|
52
|
+
static createMeta: (input: unknown) => import("./generators/common").Result<Meta>;
|
|
53
|
+
static createLayout: (input: unknown) => import("./generators/common").Result<Layout>;
|
|
55
54
|
static validateMeta: (input: unknown) => import("./generators/common").Result<null>;
|
|
56
55
|
static validateLayout: (input: unknown) => import("./generators/common").Result<null>;
|
|
57
|
-
static normalizeMeta: (input: unknown) =>
|
|
58
|
-
static normalizeLayout: (input: unknown) =>
|
|
56
|
+
static normalizeMeta: (input: unknown) => Meta;
|
|
57
|
+
static normalizeLayout: (input: unknown) => Layout;
|
|
59
58
|
/** 创建 Variables */
|
|
60
|
-
static createVariables: (input: unknown) => import("./generators/common").Result<
|
|
59
|
+
static createVariables: (input: unknown) => import("./generators/common").Result<Variables>;
|
|
61
60
|
static validateVariables: (input: unknown) => import("./generators/common").Result<null>;
|
|
62
|
-
static normalizeVariables: (input: unknown) =>
|
|
61
|
+
static normalizeVariables: (input: unknown) => Variables;
|
|
63
62
|
/** 创建 Dependency */
|
|
64
|
-
static createDependency: (input: unknown) => import("./generators/common").Result<
|
|
63
|
+
static createDependency: (input: unknown) => import("./generators/common").Result<Dependency>;
|
|
65
64
|
static validateDependency: (input: unknown) => import("./generators/common").Result<null>;
|
|
66
|
-
static normalizeDependency: (input: unknown) =>
|
|
65
|
+
static normalizeDependency: (input: unknown) => Dependency;
|
|
67
66
|
/** 创建 Registry 组件项 */
|
|
68
67
|
static createRegistryComponent: (input: unknown) => import("./generators/common").Result<import("../types/registry").RegistryComponents>;
|
|
69
68
|
static validateRegistryComponent: (input: unknown) => import("./generators/common").Result<null>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Result } from './common';
|
|
2
|
-
import {
|
|
2
|
+
import { Meta, Layout } from '../../types/meta';
|
|
3
3
|
export declare const validateMeta: (input: unknown) => Result<null>;
|
|
4
4
|
export declare const validateLayout: (input: unknown) => Result<null>;
|
|
5
|
-
export declare const createMeta: (input: unknown) => Result<
|
|
6
|
-
export declare const createLayout: (input: unknown) => Result<
|
|
7
|
-
export declare const normalizeMeta: (input: unknown) =>
|
|
8
|
-
export declare const normalizeLayout: (input: unknown) =>
|
|
5
|
+
export declare const createMeta: (input: unknown) => Result<Meta>;
|
|
6
|
+
export declare const createLayout: (input: unknown) => Result<Layout>;
|
|
7
|
+
export declare const normalizeMeta: (input: unknown) => Meta;
|
|
8
|
+
export declare const normalizeLayout: (input: unknown) => Layout;
|
|
@@ -45,4 +45,5 @@ export interface LogicComponentInstanceRef extends ComponentBase {
|
|
|
45
45
|
component: LogicRef;
|
|
46
46
|
children?: never;
|
|
47
47
|
}
|
|
48
|
+
/** 组件实例(view/container/logic 类型) */
|
|
48
49
|
export type ComponentInstance = ViewComponentInstance | ContainerComponentInstance | LogicComponentInstanceRef;
|
|
@@ -34,4 +34,5 @@ export interface DataSourceFunction extends DataSourceBase {
|
|
|
34
34
|
code: string;
|
|
35
35
|
timeout?: Milliseconds;
|
|
36
36
|
}
|
|
37
|
+
/** 数据源项(rest/websocket/static/function 类型) */
|
|
37
38
|
export type DataSourceItem = DataSourceRest | DataSourceWebSocket | DataSourceStatic | DataSourceFunction;
|
package/dist/types/deps.d.ts
CHANGED
|
@@ -67,7 +67,5 @@ export interface OtherDependency extends BaseDependency {
|
|
|
67
67
|
type: 'other';
|
|
68
68
|
kind?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
70
|
+
/** 依赖项 */
|
|
71
71
|
export type Dependency = JSDependency | CSSDependency | FontDependency | ImageDependency | JSONDependency | WasmDependency | OtherDependency;
|
|
72
|
-
/** 依赖数组 */
|
|
73
|
-
export type Dependencies = Dependency[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Meta, Layout } from './meta';
|
|
2
2
|
import { Registry } from './registry';
|
|
3
3
|
import { Variables } from './variables';
|
|
4
|
-
import {
|
|
5
|
-
import { CICPage } from './page';
|
|
4
|
+
import { Dependency } from './deps';
|
|
5
|
+
import { CICPage, ComponentInstance, DataSourceItem } from './page';
|
|
6
6
|
/**
|
|
7
7
|
* CIC 配置定义
|
|
8
8
|
* 说明:定义了 CIC 项目的全局配置,包含版本、元数据、页面、组件、变量、依赖等。
|
|
9
9
|
*/
|
|
10
10
|
export interface CICConfig {
|
|
11
11
|
version: string;
|
|
12
|
-
meta:
|
|
12
|
+
meta: Meta;
|
|
13
13
|
pages: CICPage[];
|
|
14
14
|
registry?: Registry;
|
|
15
15
|
variables?: Variables;
|
|
16
|
-
deps?:
|
|
16
|
+
deps?: Dependency[];
|
|
17
17
|
extensions?: Record<string, any>;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* CIC 类型定义
|
|
21
|
+
* 说明:定义了 CIC 项目中使用的各种类型,包括元数据、布局、页面、组件、变量、依赖项等。
|
|
22
|
+
*/
|
|
23
|
+
export type { Meta, Layout, CICPage, Registry, Variables, Dependency, ComponentInstance, DataSourceItem };
|
package/dist/types/meta.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/**布局配置 */
|
|
2
|
+
export interface Layout {
|
|
2
3
|
/** 布局类型: free(自由布局) 或 grid(网格布局) */
|
|
3
4
|
type: "free" | "grid";
|
|
4
5
|
config: {
|
|
@@ -25,7 +26,7 @@ export interface LayoutConfig {
|
|
|
25
26
|
* 项目元信息
|
|
26
27
|
* 包含项目的基本信息、布局配置、语言、创建时间、更新时间、作者和扩展信息。
|
|
27
28
|
*/
|
|
28
|
-
export interface
|
|
29
|
+
export interface Meta {
|
|
29
30
|
/** 项目唯一标识符 */
|
|
30
31
|
projectId?: string;
|
|
31
32
|
/** 项目名称 */
|
|
@@ -33,7 +34,7 @@ export interface MetaInfo {
|
|
|
33
34
|
/** 项目描述 */
|
|
34
35
|
description?: string;
|
|
35
36
|
/** 布局配置 */
|
|
36
|
-
layout?:
|
|
37
|
+
layout?: Layout;
|
|
37
38
|
/** 语言代码 (e.g. zh-CN, en-US) */
|
|
38
39
|
language?: string;
|
|
39
40
|
/**
|
package/dist/types/page.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ComponentInstance } from './componets';
|
|
2
2
|
import { DataSourceItem } from './dataSources';
|
|
3
|
-
import {
|
|
3
|
+
import { Layout } from './meta';
|
|
4
4
|
/**
|
|
5
5
|
* CIC 页面定义
|
|
6
6
|
* 说明:定义了 CIC 中页面的结构,包含页面 ID、名称、路径、布局、组件等。
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
interface CICPage {
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
path: string;
|
|
12
|
-
layout?:
|
|
12
|
+
layout?: Layout;
|
|
13
13
|
components?: ComponentInstance[];
|
|
14
14
|
dataSources?: DataSourceItem[];
|
|
15
15
|
extensions?: Record<string, any>;
|
|
16
16
|
}
|
|
17
|
+
export type { CICPage, ComponentInstance, DataSourceItem };
|
package/dist/types/registry.d.ts
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 注册中心组件项
|
|
3
3
|
* 说明:定义了 CIC 项目中组件注册中心的组件项,包含组件 ID、类型和配置。
|
|
4
|
-
|
|
5
|
-
* {
|
|
6
|
-
* "id": "comp_echarts_line",
|
|
7
|
-
* "name": "折线图",
|
|
8
|
-
* "description": "用于展示时间序列数据的折线图组件",
|
|
9
|
-
* "version": "1.0.0",
|
|
10
|
-
* "author": "component_dev",
|
|
11
|
-
* "defaultProps": {
|
|
12
|
-
* "title": {
|
|
13
|
-
* "type": "string",
|
|
14
|
-
* "default": "折线图标题",
|
|
15
|
-
* "description": "图表的标题"
|
|
16
|
-
* },
|
|
17
|
-
* "xAxis": {
|
|
18
|
-
* "type": "array",
|
|
19
|
-
* "default": [],
|
|
20
|
-
* "description": "X轴数据"
|
|
21
|
-
* },
|
|
22
|
-
* "yAxis": {
|
|
23
|
-
* "type": "array",
|
|
24
|
-
* "default": [],
|
|
25
|
-
* "description": "Y轴数据"
|
|
26
|
-
* },
|
|
27
|
-
* "lineColor": {
|
|
28
|
-
* "type": "string",
|
|
29
|
-
* "default": "#5470C6",
|
|
30
|
-
* "description": "折线颜色"
|
|
31
|
-
* }
|
|
32
|
-
* },
|
|
33
|
-
* "data": {
|
|
34
|
-
* "x": 123,
|
|
35
|
-
* "y": 456
|
|
36
|
-
* },
|
|
37
|
-
* "deps": ["1", "2"]
|
|
38
|
-
* }
|
|
39
|
-
*/
|
|
4
|
+
*/
|
|
40
5
|
export interface RegistryComponents {
|
|
41
6
|
id: string;
|
|
42
7
|
name?: string;
|