rich-core 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 +215 -0
- package/dist/rich-core.css +2 -0
- package/dist/rich-core.umd.min.js +9 -0
- package/package.json +72 -0
- package/styles/cssvar.scss +17 -0
- package/styles/form-design.scss +133 -0
- package/styles/index.scss +6 -0
- package/styles/richform.scss +950 -0
- package/styles/split-layout.scss +167 -0
- package/styles/variable.scss +12 -0
- package/types/component.d.ts +30 -0
- package/types/form-design.d.ts +41 -0
- package/types/index.d.ts +17 -0
- package/types/richform.d.ts +184 -0
- package/types/split-layout.d.ts +10 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
@mixin triangle($width, $height, $color, $direction) {
|
|
2
|
+
$width: calc($width / 2);
|
|
3
|
+
$color-border-style: $height solid $color;
|
|
4
|
+
$transparent-border-style: $width solid transparent;
|
|
5
|
+
height: 0;
|
|
6
|
+
width: 0;
|
|
7
|
+
|
|
8
|
+
@if $direction==up {
|
|
9
|
+
border-bottom: $color-border-style;
|
|
10
|
+
border-left: $transparent-border-style;
|
|
11
|
+
border-right: $transparent-border-style;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@else if $direction==right {
|
|
15
|
+
border-left: $color-border-style;
|
|
16
|
+
border-top: $transparent-border-style;
|
|
17
|
+
border-bottom: $transparent-border-style;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@else if $direction==down {
|
|
21
|
+
border-top: $color-border-style;
|
|
22
|
+
border-left: $transparent-border-style;
|
|
23
|
+
border-right: $transparent-border-style;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@else if $direction==left {
|
|
27
|
+
border-right: $color-border-style;
|
|
28
|
+
border-top: $transparent-border-style;
|
|
29
|
+
border-bottom: $transparent-border-style;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$split-bar-bg-color: darken(#fbfbfb, 4%);
|
|
34
|
+
$split-bar-ear-bg-color: darken(#fbfbfb, 7%);
|
|
35
|
+
$split-bar-ear-border-color: #fbfbfb;
|
|
36
|
+
$split-bar-ear-hover-color: #fff;
|
|
37
|
+
|
|
38
|
+
.split-layout {
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
position: relative;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
|
|
45
|
+
&.hori {
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.vert {
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.center {
|
|
54
|
+
flex: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.panel {
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.splitbar {
|
|
62
|
+
background: $split-bar-bg-color;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
|
|
67
|
+
// &.splitbar-border-right {
|
|
68
|
+
// border-right: 1px solid $split-bar-ear-border-color;
|
|
69
|
+
// }
|
|
70
|
+
|
|
71
|
+
// &.splitbar-border-bottom {
|
|
72
|
+
// border-bottom: 1px solid $split-bar-ear-border-color;
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
// &.splitbar-border-left {
|
|
76
|
+
// border-left: 1px solid $split-bar-ear-border-color;
|
|
77
|
+
// }
|
|
78
|
+
|
|
79
|
+
// &.splitbar-border-top {
|
|
80
|
+
// border-top: 1px solid $split-bar-ear-border-color;
|
|
81
|
+
// }
|
|
82
|
+
|
|
83
|
+
&.hori {
|
|
84
|
+
height: 100%;
|
|
85
|
+
width: 8px;
|
|
86
|
+
cursor: e-resize;
|
|
87
|
+
|
|
88
|
+
>.vbg-ear {
|
|
89
|
+
height: 10%;
|
|
90
|
+
width: 100%;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
background: $split-bar-ear-bg-color;
|
|
93
|
+
position: relative;
|
|
94
|
+
|
|
95
|
+
&:hover {
|
|
96
|
+
color: $split-bar-ear-hover-color;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
>.triangle-dire-left {
|
|
101
|
+
&::before {
|
|
102
|
+
content: "";
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 10px;
|
|
105
|
+
position: absolute;
|
|
106
|
+
right: 1px;
|
|
107
|
+
top: 50%;
|
|
108
|
+
@include triangle(10px, 5px, currentColor, left);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
>.triangle-dire-right {
|
|
113
|
+
&::before {
|
|
114
|
+
content: "";
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 10px;
|
|
117
|
+
position: absolute;
|
|
118
|
+
right: 1px;
|
|
119
|
+
top: 50%;
|
|
120
|
+
@include triangle(10px, 5px, currentColor, right);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.vert {
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 8px;
|
|
128
|
+
cursor: s-resize;
|
|
129
|
+
|
|
130
|
+
>.vbg-ear {
|
|
131
|
+
width: 10%;
|
|
132
|
+
height: 8px;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
background: $split-bar-ear-bg-color;
|
|
135
|
+
position: relative;
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
color: $split-bar-ear-hover-color;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
>.triangle-dire-up {
|
|
143
|
+
&::before {
|
|
144
|
+
content: "";
|
|
145
|
+
width: 10px;
|
|
146
|
+
height: 100%;
|
|
147
|
+
position: absolute;
|
|
148
|
+
right: 50%;
|
|
149
|
+
bottom: 1px;
|
|
150
|
+
@include triangle(10px, 5px, currentColor, up);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
>.triangle-dire-down {
|
|
155
|
+
&::before {
|
|
156
|
+
content: "";
|
|
157
|
+
width: 10px;
|
|
158
|
+
height: 100%;
|
|
159
|
+
position: absolute;
|
|
160
|
+
right: 50%;
|
|
161
|
+
bottom: 1px;
|
|
162
|
+
@include triangle(10px, 5px, currentColor, down);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*richform*/
|
|
2
|
+
$form-background-color: #ffffff !default;
|
|
3
|
+
$form-font-color: #303133 !default;
|
|
4
|
+
$form-font-size: 13px !default;
|
|
5
|
+
$form-border-color: #ddd !default;
|
|
6
|
+
$form-primary-color: #409eff !default;
|
|
7
|
+
$form-active-design-border-color: #4F9FFE !default;
|
|
8
|
+
|
|
9
|
+
$form-field-title-color: #303133 !default;
|
|
10
|
+
$form-field-value-color: #303133 !default;
|
|
11
|
+
$form-field-question-bgcolor: #13ce66 !default;
|
|
12
|
+
$form-field-error-font-color: #e83030 !default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type VComponent<
|
|
4
|
+
P = { [key: string]: any },
|
|
5
|
+
E = { [key: string]: any },
|
|
6
|
+
S = { [key: string]: (...args: any[]) => any }
|
|
7
|
+
> = ({
|
|
8
|
+
new(): {
|
|
9
|
+
$props: P & E,
|
|
10
|
+
$slots: S
|
|
11
|
+
}
|
|
12
|
+
} & {
|
|
13
|
+
install(app: App): void
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export interface VComponentBase {
|
|
17
|
+
vID: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface VEvent {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface VProps {
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface VSlots {
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type } from 'ramda'
|
|
2
|
+
import { VComponent, VProps, VEvent } from './component'
|
|
3
|
+
|
|
4
|
+
export const FormDesign: VComponent<VProps, VEvent, FormDesignSlots>
|
|
5
|
+
|
|
6
|
+
export interface FormDesignSlots {
|
|
7
|
+
headerLeft: () => any
|
|
8
|
+
headerRight: () => any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const FD_METAS: {
|
|
12
|
+
button: object,
|
|
13
|
+
cascader: object,
|
|
14
|
+
checkbox: object,
|
|
15
|
+
colorpicker: object,
|
|
16
|
+
datetimepicker: object,
|
|
17
|
+
draggablelist: object,
|
|
18
|
+
expression: object,
|
|
19
|
+
icon: object,
|
|
20
|
+
input: object,
|
|
21
|
+
inputnumber: object,
|
|
22
|
+
ipinput: object,
|
|
23
|
+
multiexp: object,
|
|
24
|
+
radio: object,
|
|
25
|
+
rate: object,
|
|
26
|
+
select: object,
|
|
27
|
+
slider: object,
|
|
28
|
+
slot: object,
|
|
29
|
+
switch: object,
|
|
30
|
+
table: object,
|
|
31
|
+
text: object,
|
|
32
|
+
timepicker: object,
|
|
33
|
+
transfer: object,
|
|
34
|
+
tree: object,
|
|
35
|
+
treeselect: object,
|
|
36
|
+
upload: object,
|
|
37
|
+
layout: {
|
|
38
|
+
layout: any,
|
|
39
|
+
widgets: any
|
|
40
|
+
},
|
|
41
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Richform } from './richform'
|
|
2
|
+
import { SplitLayout } from './split-layout'
|
|
3
|
+
import { FormDesign } from './form-design'
|
|
4
|
+
|
|
5
|
+
declare module '@vue/runtime-core' {
|
|
6
|
+
export interface GlobalComponents {
|
|
7
|
+
"Richform": typeof Richform,
|
|
8
|
+
"SplitLayout": typeof SplitLayout,
|
|
9
|
+
"FormDesign": typeof FormDesign,
|
|
10
|
+
"FD_METAS": Object,
|
|
11
|
+
"AJValidate": Function
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export * from './richform'
|
|
16
|
+
export * from './split-layout'
|
|
17
|
+
export * from './form-design'
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Component } from 'vue'
|
|
2
|
+
import { VComponent } from './component'
|
|
3
|
+
|
|
4
|
+
export const Richform: VComponent<RichformProps, RichformEventProps, RichformSlots> & Plugin;
|
|
5
|
+
|
|
6
|
+
export type SizeType = 'default' | 'large' | 'mini'
|
|
7
|
+
|
|
8
|
+
declare function AJValidate(schema: object, values: object, errors: object): boolean
|
|
9
|
+
|
|
10
|
+
export type FormType = {
|
|
11
|
+
border?: boolean
|
|
12
|
+
grid?: boolean
|
|
13
|
+
labelSuffix?: string
|
|
14
|
+
labelWidth?: string
|
|
15
|
+
labelAlign?: string
|
|
16
|
+
labelInline?: boolean
|
|
17
|
+
size?: SizeType
|
|
18
|
+
colors?: object
|
|
19
|
+
actions?: Array<any>
|
|
20
|
+
layout?: Array<any>
|
|
21
|
+
widget?: string
|
|
22
|
+
activeField?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface RichformConstructor { // extends RichformMethods
|
|
26
|
+
id: string
|
|
27
|
+
props: RichformProps,
|
|
28
|
+
friendSchema?: SchemaType,
|
|
29
|
+
friendForm?: FormType,
|
|
30
|
+
topActions?: any,
|
|
31
|
+
buttomActions?: any,
|
|
32
|
+
noReady?: boolean,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface RichformProps {
|
|
36
|
+
values?: RichformProps.values,
|
|
37
|
+
form?: RichformProps.form,
|
|
38
|
+
schema?: RichformProps.schema,
|
|
39
|
+
isDesign?: RichformProps.isDesign,
|
|
40
|
+
showBtns?: RichformProps.showBtns,
|
|
41
|
+
deepValues?: RichformProps.deepValues,
|
|
42
|
+
isFriendValue?: RichformProps.isFriendValue,
|
|
43
|
+
authorization?: RichformProps.authorization,
|
|
44
|
+
item?: RichformPropsTypes.item,
|
|
45
|
+
fieldErrors?: RichformPropsTypes.fieldErrors,
|
|
46
|
+
language?: RichformPropsTypes.language,
|
|
47
|
+
theme?: RichformPropsTypes.theme,
|
|
48
|
+
_limitLoop?: RichformPropsTypes.limitLoop,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export namespace RichformPropsTypes {
|
|
52
|
+
export type values = object
|
|
53
|
+
export type form = FormType
|
|
54
|
+
export type schema = SchemaType
|
|
55
|
+
export type isDesign = boolean
|
|
56
|
+
export type showBtns = boolean
|
|
57
|
+
export type deepValues = boolean
|
|
58
|
+
export type isFriendValue = boolean
|
|
59
|
+
export type authorization = {
|
|
60
|
+
key?: string
|
|
61
|
+
value?: string
|
|
62
|
+
codeKey?: string
|
|
63
|
+
codeVal?: string
|
|
64
|
+
baseUrl?: string
|
|
65
|
+
msgkey?: string
|
|
66
|
+
expireCode?: string,
|
|
67
|
+
}
|
|
68
|
+
export type item = object
|
|
69
|
+
export type fieldErrors = object
|
|
70
|
+
export type language = string
|
|
71
|
+
export type theme = "dark" | "light" | ''
|
|
72
|
+
export type limitLoop = number
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface RichformEventProps {
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface RichformSlots {
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface RichformMethods {
|
|
84
|
+
globalValidate(schema: object, values: object, fieldErrors?: object): boolean,
|
|
85
|
+
resetValues(): void
|
|
86
|
+
validateForm(schema: object, values: object): boolean
|
|
87
|
+
clickCanvas(event: Event): void
|
|
88
|
+
clickFormPs(event: Event): void
|
|
89
|
+
updateTheme(theme: any): void
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type SchemaType = {
|
|
93
|
+
$schema?: string
|
|
94
|
+
title?: string
|
|
95
|
+
description?: string
|
|
96
|
+
type?: string
|
|
97
|
+
properties?: object
|
|
98
|
+
errorMessage?: object
|
|
99
|
+
if?: object
|
|
100
|
+
then?: object
|
|
101
|
+
else?: object
|
|
102
|
+
required?: Array<any>
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type ButtonType = {
|
|
106
|
+
name: string
|
|
107
|
+
type: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
|
|
108
|
+
title: string
|
|
109
|
+
icon: string
|
|
110
|
+
tips: string
|
|
111
|
+
right: boolean
|
|
112
|
+
visible: boolean
|
|
113
|
+
top: boolean
|
|
114
|
+
size: SizeType
|
|
115
|
+
nativeType?: 'button' | 'submit' | 'reset'
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface RichformReactData {
|
|
119
|
+
hideFields: object
|
|
120
|
+
dependencies: object
|
|
121
|
+
flatFields: object
|
|
122
|
+
requireds: Array<any>
|
|
123
|
+
context: ContextType
|
|
124
|
+
regExpFields: object
|
|
125
|
+
clickedField: any
|
|
126
|
+
fieldErrors: any
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type ContextType = {
|
|
130
|
+
loadDebounce: any,
|
|
131
|
+
loadCompleted: boolean,
|
|
132
|
+
deepValueKeys: Array<any>,
|
|
133
|
+
uploadCount: number,
|
|
134
|
+
uploadSuccess: number,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type GroupType = {
|
|
138
|
+
name: string
|
|
139
|
+
title: string
|
|
140
|
+
widget: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type CollapseType = {
|
|
144
|
+
name: string
|
|
145
|
+
title: string
|
|
146
|
+
widget: string
|
|
147
|
+
expand: boolean
|
|
148
|
+
actions: Array<any>
|
|
149
|
+
fields: Array<any>
|
|
150
|
+
isClicked?: boolean
|
|
151
|
+
style?: object
|
|
152
|
+
activeDesign?: boolean
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type TabsType = {
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**子组件 */
|
|
160
|
+
export const Button: DefineComponent<{}, {}, any>;
|
|
161
|
+
export const Cascader: DefineComponent<{}, {}, any>;
|
|
162
|
+
export const Checkbox: DefineComponent<{}, {}, any>;
|
|
163
|
+
export const Colorpicker: DefineComponent<{}, {}, any>;
|
|
164
|
+
export const Datetimepicker: DefineComponent<{}, {}, any>;
|
|
165
|
+
export const Draggablelist: DefineComponent<{}, {}, any>;
|
|
166
|
+
export const Expression: DefineComponent<{}, {}, any>;
|
|
167
|
+
export const Icon: DefineComponent<{}, {}, any>;
|
|
168
|
+
export const Input: DefineComponent<{}, {}, any>;
|
|
169
|
+
export const Inputnumber: DefineComponent<{}, {}, any>;
|
|
170
|
+
export const Ipinput: DefineComponent<{}, {}, any>;
|
|
171
|
+
export const Multiexp: DefineComponent<{}, {}, any>;
|
|
172
|
+
export const Radio: DefineComponent<{}, {}, any>;
|
|
173
|
+
export const Rate: DefineComponent<{}, {}, any>;
|
|
174
|
+
export const Select: DefineComponent<{}, {}, any>;
|
|
175
|
+
export const Slider: DefineComponent<{}, {}, any>;
|
|
176
|
+
export const Slot: DefineComponent<{}, {}, any>;
|
|
177
|
+
export const Switch: DefineComponent<{}, {}, any>;
|
|
178
|
+
export const Table: DefineComponent<{}, {}, any>;
|
|
179
|
+
export const Text: DefineComponent<{}, {}, any>;
|
|
180
|
+
export const Timepicker: DefineComponent<{}, {}, any>;
|
|
181
|
+
export const Transfer: DefineComponent<{}, {}, any>;
|
|
182
|
+
export const Tree: DefineComponent<{}, {}, any>;
|
|
183
|
+
export const Treeselect: DefineComponent<{}, {}, any>;
|
|
184
|
+
export const Upload: DefineComponent<{}, {}, any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VComponent, VProps, VEvent, VSlots } from './component'
|
|
2
|
+
|
|
3
|
+
export const SplitLayout: VComponent<VProps, VEvent, VSplitLayoutSlots & VSlots>
|
|
4
|
+
|
|
5
|
+
export interface VSplitLayoutSlots {
|
|
6
|
+
default: () => any
|
|
7
|
+
first: () => any
|
|
8
|
+
center: () => any
|
|
9
|
+
last: () => any
|
|
10
|
+
}
|