zenz-contract 0.0.1
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 +14 -0
- package/dist/index.js +1 -0
- package/dist/typings/Editor.d.ts +260 -0
- package/dist/typings/Loader.d.ts +81 -0
- package/dist/typings/Utils.d.ts +33 -0
- package/dist/typings/index.d.ts +12 -0
- package/dist/typings/lib/BaseElement.d.ts +120 -0
- package/dist/typings/lib/ContentElement.d.ts +32 -0
- package/dist/typings/lib/LayoutElement.d.ts +124 -0
- package/dist/typings/lib/SignatureAndSealElement.d.ts +37 -0
- package/dist/typings/lib/TableElement.d.ts +37 -0
- package/dist/typings/lib/TextElement.d.ts +17 -0
- package/dist/typings/lib/VariableElement.d.ts +47 -0
- package/dist/typings/lib/interface.d.ts +232 -0
- package/package.json +57 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Content } from './interface';
|
|
2
|
+
import { VariableElement } from './VariableElement';
|
|
3
|
+
/**
|
|
4
|
+
* 表格元素
|
|
5
|
+
* @param options 选项
|
|
6
|
+
*/
|
|
7
|
+
export declare class TableElement<T extends TableElement.Options = TableElement.Options, E extends TableElement.EventMap = TableElement.EventMap> extends VariableElement<T, E> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(options?: Partial<T>);
|
|
10
|
+
set data(value: string | Array<number | string>[]);
|
|
11
|
+
get data(): string | Array<number | string>[];
|
|
12
|
+
init(): void;
|
|
13
|
+
onUpdateData(value: string): void;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace TableElement {
|
|
16
|
+
/**
|
|
17
|
+
* 事件列表
|
|
18
|
+
*/
|
|
19
|
+
interface EventMap extends VariableElement.EventMap {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 选项
|
|
23
|
+
*/
|
|
24
|
+
interface Options extends Content {
|
|
25
|
+
/**
|
|
26
|
+
* 表头
|
|
27
|
+
*/
|
|
28
|
+
heading: string[];
|
|
29
|
+
}
|
|
30
|
+
namespace Options {
|
|
31
|
+
/**
|
|
32
|
+
* 获取默认值
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
function getDefault(): Options;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Content } from './interface';
|
|
2
|
+
import { ContentElement } from './ContentElement';
|
|
3
|
+
/**
|
|
4
|
+
* 文本元素
|
|
5
|
+
* @param options 选项
|
|
6
|
+
*/
|
|
7
|
+
export declare class TextElement<T extends Content = Content, E extends TextElement.EventMap = TextElement.EventMap> extends ContentElement<T, E> {
|
|
8
|
+
constructor(options?: Partial<T>);
|
|
9
|
+
init(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace TextElement {
|
|
12
|
+
/**
|
|
13
|
+
* 事件列表
|
|
14
|
+
*/
|
|
15
|
+
interface EventMap extends ContentElement.EventMap {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Content } from './interface';
|
|
2
|
+
import { ContentElement } from './ContentElement';
|
|
3
|
+
/**
|
|
4
|
+
* 变量元素
|
|
5
|
+
* @param options 选项
|
|
6
|
+
*/
|
|
7
|
+
export declare class VariableElement<T extends Content = Content, E extends VariableElement.EventMap = VariableElement.EventMap> extends ContentElement<T, E> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(options?: Partial<T>);
|
|
10
|
+
set data(value: any);
|
|
11
|
+
/**
|
|
12
|
+
* 变量数据
|
|
13
|
+
*/
|
|
14
|
+
get data(): any;
|
|
15
|
+
init(): void;
|
|
16
|
+
/**
|
|
17
|
+
* 变量值改变生命周期
|
|
18
|
+
* @param value
|
|
19
|
+
* @param oldValue
|
|
20
|
+
*/
|
|
21
|
+
onChange(value: string, oldValue: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* 变量数据更新生命周期
|
|
24
|
+
* @param value
|
|
25
|
+
*/
|
|
26
|
+
onUpdateData(value: string): void;
|
|
27
|
+
}
|
|
28
|
+
export declare namespace VariableElement {
|
|
29
|
+
/**
|
|
30
|
+
* 事件列表
|
|
31
|
+
*/
|
|
32
|
+
interface EventMap extends ContentElement.EventMap {
|
|
33
|
+
/**
|
|
34
|
+
* 变量值改变
|
|
35
|
+
* @param value
|
|
36
|
+
* @param oldValue
|
|
37
|
+
*/
|
|
38
|
+
change(value: string, oldValue: string): void;
|
|
39
|
+
(event: 'change', value: string, oldValue: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* 变量数据更新
|
|
42
|
+
* @param value
|
|
43
|
+
*/
|
|
44
|
+
updateData(value: string): void;
|
|
45
|
+
(event: 'updateData', value: string): void;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 对齐方式
|
|
3
|
+
*/
|
|
4
|
+
export declare enum Alignment {
|
|
5
|
+
/**
|
|
6
|
+
* 开始
|
|
7
|
+
*/
|
|
8
|
+
Start = "flex-start",
|
|
9
|
+
/**
|
|
10
|
+
* 居中
|
|
11
|
+
*/
|
|
12
|
+
Center = "center",
|
|
13
|
+
/**
|
|
14
|
+
* 结束
|
|
15
|
+
*/
|
|
16
|
+
End = "flex-end"
|
|
17
|
+
}
|
|
18
|
+
export declare namespace Alignment {
|
|
19
|
+
/**
|
|
20
|
+
* 获取描述
|
|
21
|
+
* @param value
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
function getDescription(value: Alignment): "开始" | "居中" | "结束" | "枚举错误";
|
|
25
|
+
/**
|
|
26
|
+
* 获取选项
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
function getOptions(): {
|
|
30
|
+
label: string;
|
|
31
|
+
value: Alignment;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 布局
|
|
36
|
+
*/
|
|
37
|
+
export interface Layout {
|
|
38
|
+
/**
|
|
39
|
+
* 布局类型
|
|
40
|
+
*/
|
|
41
|
+
type?: Layout.Type;
|
|
42
|
+
/**
|
|
43
|
+
* 内边距
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
padding?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
|
|
47
|
+
/**
|
|
48
|
+
* 间隔
|
|
49
|
+
* @default 0
|
|
50
|
+
*/
|
|
51
|
+
gap?: number | [number] | [number, number];
|
|
52
|
+
/**
|
|
53
|
+
* 水平对齐方式
|
|
54
|
+
* @default start
|
|
55
|
+
*/
|
|
56
|
+
horAlign?: Alignment;
|
|
57
|
+
/**
|
|
58
|
+
* 垂直对齐方式
|
|
59
|
+
* @default start
|
|
60
|
+
*/
|
|
61
|
+
verAlign?: Alignment;
|
|
62
|
+
/**
|
|
63
|
+
* 内容
|
|
64
|
+
* @default []
|
|
65
|
+
*/
|
|
66
|
+
content?: Array<Layout | Content>;
|
|
67
|
+
}
|
|
68
|
+
export declare namespace Layout {
|
|
69
|
+
/**
|
|
70
|
+
* 获取默认值
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
function getDefault(): Layout;
|
|
74
|
+
/**
|
|
75
|
+
* 布局类型
|
|
76
|
+
*/
|
|
77
|
+
enum Type {
|
|
78
|
+
/**
|
|
79
|
+
* 行
|
|
80
|
+
*/
|
|
81
|
+
Row = "row",
|
|
82
|
+
/**
|
|
83
|
+
* 列
|
|
84
|
+
*/
|
|
85
|
+
Column = "column"
|
|
86
|
+
}
|
|
87
|
+
namespace Type {
|
|
88
|
+
/**
|
|
89
|
+
* 获取描述
|
|
90
|
+
* @param value
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
function getDescription(value: Type): "枚举错误" | "行" | "列";
|
|
94
|
+
/**
|
|
95
|
+
* 获取选项
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
function getOptions(): {
|
|
99
|
+
label: string;
|
|
100
|
+
value: Type;
|
|
101
|
+
}[];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 文本样式
|
|
106
|
+
*/
|
|
107
|
+
export interface TextStyle {
|
|
108
|
+
/**
|
|
109
|
+
* 文本颜色
|
|
110
|
+
* @default #000
|
|
111
|
+
*/
|
|
112
|
+
color?: string;
|
|
113
|
+
/**
|
|
114
|
+
* 文本大小
|
|
115
|
+
* @default 16
|
|
116
|
+
*/
|
|
117
|
+
fontSize?: number;
|
|
118
|
+
/**
|
|
119
|
+
* 粗体
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
bolder?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* 斜体
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
italic?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* 下划线
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
underline?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* 水平对齐
|
|
135
|
+
* @default start
|
|
136
|
+
*/
|
|
137
|
+
horAlign?: Alignment;
|
|
138
|
+
/**
|
|
139
|
+
* 垂直对齐
|
|
140
|
+
* @default start
|
|
141
|
+
*/
|
|
142
|
+
verAlign?: Alignment;
|
|
143
|
+
}
|
|
144
|
+
export declare namespace TextStyle {
|
|
145
|
+
/**
|
|
146
|
+
* 获取默认值
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
function getDefault(): TextStyle;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 内容
|
|
153
|
+
*/
|
|
154
|
+
export interface Content {
|
|
155
|
+
/**
|
|
156
|
+
* 内容类型
|
|
157
|
+
*/
|
|
158
|
+
type: Content.Type;
|
|
159
|
+
/**
|
|
160
|
+
* 内容值
|
|
161
|
+
*/
|
|
162
|
+
value: string;
|
|
163
|
+
/**
|
|
164
|
+
* 宽度
|
|
165
|
+
* @default auto
|
|
166
|
+
*/
|
|
167
|
+
width?: number | 'auto';
|
|
168
|
+
/**
|
|
169
|
+
* 高度
|
|
170
|
+
* @default auto
|
|
171
|
+
*/
|
|
172
|
+
height?: number | 'auto';
|
|
173
|
+
/**
|
|
174
|
+
* 文本样式
|
|
175
|
+
*/
|
|
176
|
+
textStyle?: TextStyle;
|
|
177
|
+
}
|
|
178
|
+
export declare namespace Content {
|
|
179
|
+
/**
|
|
180
|
+
* 获取默认值
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
function getDefault(): Content;
|
|
184
|
+
/**
|
|
185
|
+
* 判断是否为内容
|
|
186
|
+
* @param target 需要判断的目标
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
function isContent(target: any): target is Content;
|
|
190
|
+
/**
|
|
191
|
+
* 内容类型
|
|
192
|
+
*/
|
|
193
|
+
enum Type {
|
|
194
|
+
/**
|
|
195
|
+
* 文本
|
|
196
|
+
*/
|
|
197
|
+
Text = "text",
|
|
198
|
+
/**
|
|
199
|
+
* 变量
|
|
200
|
+
*/
|
|
201
|
+
Variable = "variable",
|
|
202
|
+
/**
|
|
203
|
+
* 表格数据
|
|
204
|
+
*/
|
|
205
|
+
Table = "table",
|
|
206
|
+
/**
|
|
207
|
+
* 签名盖章处
|
|
208
|
+
*/
|
|
209
|
+
SignatureAndSeal = "signatureAndSeal"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 变量
|
|
214
|
+
*/
|
|
215
|
+
export interface Variable<T = string> {
|
|
216
|
+
/**
|
|
217
|
+
* 键
|
|
218
|
+
*/
|
|
219
|
+
key: T;
|
|
220
|
+
/**
|
|
221
|
+
* 标签
|
|
222
|
+
*/
|
|
223
|
+
label: string;
|
|
224
|
+
}
|
|
225
|
+
export declare namespace Variable {
|
|
226
|
+
/**
|
|
227
|
+
* 是否为变量
|
|
228
|
+
* @param target 需要判断的目标
|
|
229
|
+
* @returns
|
|
230
|
+
*/
|
|
231
|
+
function isVariable(target: any): target is Variable;
|
|
232
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zenz-contract",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "合同模板",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/typings/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "webpack server --hot --config webpack.dev.js",
|
|
9
|
+
"demo": "webpack --config webpack.demo.js",
|
|
10
|
+
"build": "webpack --config webpack.prod.js",
|
|
11
|
+
"prebuild": "tsc -p src",
|
|
12
|
+
"build:patch": "webpack --config webpack.prod.js",
|
|
13
|
+
"prebuild:patch": "npm version patch && tsc -p src",
|
|
14
|
+
"build:minor": "webpack --config webpack.prod.js",
|
|
15
|
+
"prebuild:minor": "npm version minor && tsc -p src",
|
|
16
|
+
"build:major": "webpack --config webpack.prod.js",
|
|
17
|
+
"prebuild:major": "npm version major && tsc -p src"
|
|
18
|
+
},
|
|
19
|
+
"author": "GT",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@babel/core": "^7.18.6",
|
|
23
|
+
"@babel/preset-env": "^7.18.6",
|
|
24
|
+
"@kotron/fortress-ui": "^0.2.0",
|
|
25
|
+
"@kotron/global": "0.0.5",
|
|
26
|
+
"@types/element-resize-detector": "^1.1.6",
|
|
27
|
+
"@types/node": "^22.10.2",
|
|
28
|
+
"@vue/compiler-sfc": "^3.2.37",
|
|
29
|
+
"babel-loader": "^8.2.5",
|
|
30
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
31
|
+
"core-js": "^3.23.3",
|
|
32
|
+
"css-loader": "^6.7.1",
|
|
33
|
+
"html-webpack-plugin": "^5.5.0",
|
|
34
|
+
"md-editor-v3": "^4.13.3",
|
|
35
|
+
"node-sass": "^7.0.1",
|
|
36
|
+
"raw-loader": "^4.0.2",
|
|
37
|
+
"sass-loader": "^13.0.2",
|
|
38
|
+
"style-loader": "^3.3.1",
|
|
39
|
+
"ts-loader": "^9.3.1",
|
|
40
|
+
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
41
|
+
"typescript": "^4.7.4",
|
|
42
|
+
"vue": "3.4.23",
|
|
43
|
+
"vue-loader": "^17.0.0",
|
|
44
|
+
"vue-router": "4.3.2",
|
|
45
|
+
"webpack": "^5.73.0",
|
|
46
|
+
"webpack-cli": "^4.10.0",
|
|
47
|
+
"webpack-dev-server": "^4.9.3",
|
|
48
|
+
"webpack-merge": "^5.8.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@kotron/watcher": "0.0.1",
|
|
52
|
+
"@~crazy/eventmanager": "^0.0.1",
|
|
53
|
+
"@~crazy/keywatch": "^0.0.17",
|
|
54
|
+
"@~crazy/spanner": "^0.0.13",
|
|
55
|
+
"element-resize-detector": "^1.2.4"
|
|
56
|
+
}
|
|
57
|
+
}
|