keli-ui 0.0.26 → 0.1.0

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.
@@ -0,0 +1,26 @@
1
+ type ButtonType = 'danger' | 'primary' | 'success' | 'warning' | undefined;
2
+
3
+ export interface KeliButton {
4
+ /** 按钮ID */
5
+ id: string;
6
+ /** 按钮名称 */
7
+ label: string;
8
+ /** 按钮提示语 */
9
+ clickTips?: string;
10
+ /** 前端方法 */
11
+ webFunction: Function;
12
+ /** 按钮type */
13
+ type: ButtonType;
14
+ /** 设置指定样式,优先级大于class */
15
+ buttonStyle?: any;
16
+ /** 引用预设的class */
17
+ buttonClass?: string;
18
+ /** 设置指定样式,优先级大于class */
19
+ fontStyle?: any;
20
+ /** 引用预设的class */
21
+ fontClass?: string;
22
+ /**
23
+ * 调用方法的第二个入参
24
+ */
25
+ params?: any;
26
+ }
@@ -0,0 +1,25 @@
1
+
2
+ type Slots = "renderCell" | "renderAsyncCell";
3
+
4
+ interface ComponentFrame {
5
+ /** 字段名 */
6
+ field: string;
7
+ /** 字段标题 */
8
+ title: string;
9
+ /** 是否禁止编辑 */
10
+ disabled?: boolean;
11
+ /** 占位文本 */
12
+ placeholder?: string;
13
+ }
14
+
15
+ /** 下拉框、级联选择器类型数据 */
16
+ export interface OptionInterface {
17
+ value: number | string;
18
+ label: string;
19
+ disabled?: boolean;
20
+ children?: OptionInterface[];
21
+ }
22
+
23
+ export type HttpMethod = 'delete' | 'get' | 'head' | 'patch' | 'post' | 'put';
24
+
25
+ export type Size = 'small' | 'default' | 'large';
@@ -0,0 +1,83 @@
1
+ import type { ComponentFrame, HttpMethod, OptionInterface, Size } from './componentFrame';
2
+
3
+ type LabelPosition = 'left' | 'right';
4
+
5
+ type FormLayout = 'horizontal' | 'inline' | 'vertical';
6
+
7
+ export interface FormFrame extends ComponentFrame {
8
+ /** 表单编辑器 */
9
+ formEditor: string;
10
+ /** 是否禁止编辑 */
11
+ disabled?: boolean;
12
+ /** 组件大小 */
13
+ size?: Size;
14
+ /** 当值发生变化时 通知这些字段的组件 */
15
+ noticeField?: string[];
16
+ /** 接收到字段值发生变化是触发的js函数 */
17
+ noticeReceive?: Function;
18
+ /** 组件其他参数 */
19
+ componentParams?: any;
20
+ /** 格栅占据数 */
21
+ formSpan?: number;
22
+ /** 默认值 */
23
+ defaultValue?: null | string | undefined;
24
+ }
25
+
26
+ /** 下拉框 */
27
+ export interface KeFormSelect extends FormFrame {
28
+ /** 是否多选 */
29
+ multiple?: boolean;
30
+ /** 下拉框选项 */
31
+ options: OptionInterface[];
32
+ }
33
+
34
+ export interface KeFormSelectAsync extends FormFrame {
35
+ /** 是否多选 */
36
+ multiple: boolean;
37
+ /** Http URL */
38
+ optionHttpUrl: string;
39
+ /** http方法 */
40
+ optionHttpMethod: HttpMethod;
41
+ /** http默认参数 */
42
+ optionHttpParams: any;
43
+ /** http其他字段 */
44
+ optionHttpComponentValue: string[];
45
+ }
46
+
47
+ /** 动态表格 */
48
+ export interface FormDynamicTable extends FormFrame {
49
+ width: number;
50
+ column: DynamicTableColumn[];
51
+ }
52
+ interface DynamicTableColumn {
53
+ field: string;
54
+ title: string;
55
+ width: number;
56
+ editor: DynamicComponent;
57
+ [key: string]: any;
58
+ }
59
+
60
+ export interface KeFormRadio extends FormFrame {
61
+ options: OptionInterface[];
62
+ }
63
+
64
+ /** 表单基本配置 */
65
+ export interface KeFormBasicInterface {
66
+ /** 主键的key */
67
+ rowKey: string;
68
+ labelWidth: number;
69
+ span?: number;
70
+ // label对齐方式
71
+ labelPosition?: LabelPosition;
72
+ // 表单布局方式
73
+ layout?: FormLayout;
74
+ formWindowType?: 'default' | 'DialogForm' | 'DrawerForm';
75
+ }
76
+
77
+ /** 嵌入表 */
78
+ export interface KeFormEmbeddedTable {
79
+ /** pageEn */
80
+ embeddedId: number;
81
+ /** tab标题 */
82
+ tabTitle: string;
83
+ }
@@ -0,0 +1,6 @@
1
+ export * from './button';
2
+ export * from './queryFrame';
3
+ export * from './translate';
4
+ export * from './tableFrame';
5
+ export * from './componentFrame';
6
+ export * from './formFrame';
@@ -0,0 +1,24 @@
1
+ import type { OptionInterface, HttpMethod } from './componentFrame';
2
+
3
+ /** 查询配置 */
4
+ export interface TableQueryFrame {
5
+ fieldName: string;
6
+ fieldTitle: string;
7
+ queryEditor: string;
8
+ options?: any[];
9
+ }
10
+
11
+ export interface QuerySelector extends TableQueryFrame {
12
+ /** 是否多选 */
13
+ multiple?: boolean;
14
+ /** Http URL */
15
+ optionHttpUrl: string;
16
+ /** http方法 */
17
+ optionHttpMethod: HttpMethod;
18
+ /** http默认参数 */
19
+ optionHttpParams: any;
20
+ /** http其他字段 */
21
+ optionHttpParamsValue: string[];
22
+ /** 选项默认是空的 需要在render里面进行数据异步获取 不在组件内部进行数据获取 */
23
+ options: OptionInterface[];
24
+ }
@@ -0,0 +1,112 @@
1
+ import type { translateJSON, translateObj } from './translate';
2
+ import type { ComponentFrame, HttpMethod, OptionInterface, Slots } from './componentFrame';
3
+
4
+ /** 表格基础配置 */
5
+ export interface TableConfigInterface {
6
+ /**
7
+ * 页面ID
8
+ */
9
+ pageId?: number;
10
+ /** 主键 */
11
+ rowKey: string;
12
+ /** 是否tree table */
13
+ tree: boolean;
14
+ /** tree的父字段id */
15
+ parentField: null | string;
16
+ /** tree默认值 */
17
+ treeDefault: null | string;
18
+ /** 是否懒加载 */
19
+ treeLazyLoad: boolean;
20
+ /** 某些特定参数,用于类似于异步下拉框取component的值时 */
21
+ params?: any;
22
+ /** 显示类型 */
23
+ showType: 'SidebarTable' | 'TableRender' | 'TableRenderCard';
24
+ /** 封面字段 showType为Card时生效(展示图片) */
25
+ coverField?: string;
26
+ /**
27
+ * 标题字段
28
+ */
29
+ titleField?: string;
30
+ /**
31
+ * 是否有tree过滤器
32
+ */
33
+ hasQueryTreeFilter: boolean;
34
+ /**
35
+ * 允许拖拽排序
36
+ */
37
+ dragSort?: boolean;
38
+ /**
39
+ * 允许粘贴
40
+ */
41
+ paste?: boolean;
42
+ }
43
+
44
+ type Fixed = 'left' | 'right';
45
+
46
+ export interface TableComponentFrame extends ComponentFrame {
47
+ /**
48
+ * 最小宽度
49
+ */
50
+ minWidth: number;
51
+ /**
52
+ * 固定列位置
53
+ */
54
+ fixed?: Fixed;
55
+ /**
56
+ * 允许拖拽
57
+ */
58
+ sortable?: boolean,
59
+ slots?: {
60
+ default: Slots;
61
+ };
62
+ editRender?: {
63
+ /**
64
+ * 组件名称
65
+ */
66
+ name: string;
67
+ props: {
68
+ /**
69
+ * 是否禁止编辑
70
+ */
71
+ disabled: boolean,
72
+ /** 组件其他参数 可参考element-plus或者vant的组件参数 */
73
+ componentParams?: {
74
+ [propName: string]: any;
75
+ };
76
+ }
77
+ };
78
+ /** 翻译类型 */
79
+ tabObj?: translateObj;
80
+ translate?: translateJSON;
81
+ }
82
+
83
+ export interface TableSelector extends TableComponentFrame {
84
+ editRender?: {
85
+ /**
86
+ * 组件名称
87
+ */
88
+ name: string;
89
+ props: {
90
+ /**
91
+ * 是否禁止编辑
92
+ */
93
+ disabled: boolean,
94
+ /** 组件其他参数 可参考element-plus或者vant的组件参数 */
95
+ componentParams?: {
96
+ [propName: string]: any;
97
+ };
98
+ /** 是否多选 */
99
+ multiple?: boolean;
100
+ /** Http URL */
101
+ optionHttpUrl: string;
102
+ /** http方法 */
103
+ optionHttpMethod: HttpMethod;
104
+ /** http默认参数 */
105
+ optionHttpParams: any;
106
+ /** http其他字段 */
107
+ optionHttpParamsValue: string[];
108
+ /** 选项默认是空的 需要在render里面进行数据异步获取 不在组件内部进行数据获取 */
109
+ options: OptionInterface[];
110
+ }
111
+ };
112
+ }
@@ -0,0 +1,20 @@
1
+
2
+ /**
3
+ * 翻译类型 {value: "http", label: "http(下拉框)", disabled: false}, {value: "parseString", label: "toString", disabled: false},
4
+ * {value: "parseInt", label: "parseInt", disabled: false}, {value: "timestamp", label: "timestamp", disabled: false},
5
+ * {value: "translate", label: "字典表翻译JSON", disabled: false},
6
+ */
7
+ export type translateObj =
8
+ | 'http'
9
+ | 'parseInt'
10
+ | 'parseString'
11
+ | 'timestamp'
12
+ | 'translate'
13
+ | null
14
+ | undefined;
15
+ /** 列表翻译json */
16
+ export type translateJSON =
17
+ | { [propName: string]: any }
18
+ | { label: string; value: string }[]
19
+ | null
20
+ | undefined;
@@ -1,2 +1,2 @@
1
- export declare function isEmpty(s: any): boolean;
2
- export declare function isNotEmpty(s: any): boolean;
1
+ export declare function isEmpty<T>(val: '' | null | T | undefined): val is '' | null | undefined;
2
+ export declare function isNotEmpty<T>(val: '' | null | T | undefined): val is T;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "keli-ui",
3
3
  "private": false,
4
- "version": "0.0.26",
4
+ "version": "0.1.0",
5
5
  "author": "Luv Letter",
6
6
  "description": "配置化组件库",
7
7
  "type": "module",