ronds-metadata 1.2.37 → 1.2.39
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +83 -131
- package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
- package/es/comps/DynamicPorts/comps/DragNode.js +3 -8
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
- package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
- package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
- package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
- package/es/comps/DynamicPorts/constant/index.js +2 -5
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +228 -312
- package/es/comps/DynamicPorts/index.js +39 -58
- package/es/comps/DynamicPorts/utils.js +21 -25
- package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
- package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
- package/es/comps/Editable/DataCell/Input.js +5 -14
- package/es/comps/Editable/DataCell/Number.js +3 -10
- package/es/comps/Editable/DataCell/Select.js +7 -14
- package/es/comps/Editable/DataCell/Switch.js +2 -7
- package/es/comps/Editable/comps/EditableAction.js +8 -12
- package/es/comps/Editable/comps/EditableCell.js +16 -26
- package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
- package/es/comps/Editable/comps/EditableRow.js +49 -59
- package/es/comps/Editable/comps/Texty.js +40 -73
- package/es/comps/Editable/index.js +67 -112
- package/es/comps/Editable/interface.d.ts +1 -1
- package/es/comps/Editable/utils.js +0 -1
- package/es/comps/FileView/index.js +65 -101
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
- package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
- package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
- package/es/comps/FormGenerator/index.js +3 -9
- package/es/comps/FormGenerator/interface.d.ts +1 -1
- package/es/comps/FormGenerator/settings/index.js +12 -11
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
- package/es/comps/FormGenerator/transformer.js +40 -105
- package/es/comps/Icons/index.js +4 -7
- package/es/comps/JsonEdit/index.js +25 -50
- package/es/comps/JsonView/index.js +7 -21
- package/es/comps/MdEdit/index.js +7 -10
- package/es/comps/MdEditPro/index.d.ts +10 -0
- package/es/comps/MdEditPro/index.js +22 -0
- package/es/comps/MdEditPro/index.less +74 -0
- package/es/comps/MdNavbar/index.js +17 -40
- package/es/comps/MdNavbar/utils.js +0 -4
- package/es/comps/MdView/index.js +7 -11
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
- package/es/comps/MetadataEdit/hooks/index.js +3 -11
- package/es/comps/MetadataEdit/index.js +25 -58
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
- package/es/comps/MetadataEditV2/hooks/index.js +5 -12
- package/es/comps/MetadataEditV2/index.js +30 -65
- package/es/comps/MetadataForm/DataCell/Array.js +12 -23
- package/es/comps/MetadataForm/DataCell/Input.js +23 -39
- package/es/comps/MetadataForm/DataCell/Number.js +10 -21
- package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
- package/es/comps/MetadataForm/DataCell/Select.js +131 -226
- package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +98 -169
- package/es/comps/MetadataForm/HOC/index.js +20 -37
- package/es/comps/MetadataForm/hooks/index.js +12 -38
- package/es/comps/MetadataForm/index.js +37 -72
- package/es/comps/MetadataForm/interface.d.ts +3 -3
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +12 -14
- package/es/comps/Split/index.js +40 -38
- package/es/config.js +0 -4
- package/es/framework/RxStore/demo/index.js +9 -10
- package/es/framework/RxStore/hooks.d.ts +9 -9
- package/es/framework/RxStore/hooks.js +10 -35
- package/es/framework/RxStore/store.d.ts +4 -4
- package/es/framework/RxStore/store.js +0 -10
- package/es/framework/fg/index.js +18 -80
- package/es/framework/fg/interface.d.ts +2 -2
- package/es/framework/fg/utils.js +0 -10
- package/es/framework/graph/index.d.ts +2 -2
- package/es/framework/graph/index.js +55 -110
- package/es/framework/hooks/use-async-memo.js +3 -7
- package/es/framework/hooks/use-sync-scroll.js +2 -15
- package/es/framework/http/cache.js +25 -32
- package/es/framework/http/cancel.js +1 -7
- package/es/framework/http/index.js +22 -82
- package/es/framework/http/msgpack.js +0 -4
- package/es/framework/http/msgpack5/index.js +2 -12
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
- package/es/framework/http/msgpack5/lib/decoder.js +10 -68
- package/es/framework/http/msgpack5/lib/encoder.js +8 -36
- package/es/framework/http/msgpack5/lib/helpers.js +3 -2
- package/es/framework/http/msgpack5/lib/streams.js +0 -18
- package/es/framework/libs/jquery.min.js +1009 -1696
- package/es/framework/locale/dil8/di18n.js +4 -15
- package/es/framework/locale/dil8/translate.js +0 -14
- package/es/framework/locale/dil8/util.js +0 -3
- package/es/framework/locale/index.js +2 -3
- package/es/framework/metadata/MetadataService.js +39 -78
- package/es/framework/metadata/index.js +4 -70
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
- package/es/framework/rxjs-hooks/useObservable.js +2 -4
- package/es/framework/rxjs-hooks/useObservableState.js +8 -14
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils.js +58 -97
- package/package.json +4 -2
- package/es/comps/MdEdit/plugin/EditContent.d.ts +0 -5
- package/es/comps/MdEdit/plugin/EditContent.js +0 -34
- package/es/comps/MdEdit/plugin/Mark.d.ts +0 -7
- package/es/comps/MdEdit/plugin/Mark.js +0 -60
- package/es/framework/libs/iconfont/iconfont.json +0 -401
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Observable, BehaviorSubject } from 'rxjs';
|
2
2
|
import { DependencyList } from 'react';
|
3
3
|
import { Store, StoreInitOptions } from './store';
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
4
|
+
export type RestrictArray<T> = T extends any[] ? T : [];
|
5
|
+
export type VoidAsNull<T> = T extends void ? null : T;
|
6
|
+
export type Not<P, T, F> = P extends false ? T : F;
|
7
7
|
/**
|
8
8
|
* 将对象转换为常量
|
9
9
|
*/
|
10
10
|
export declare function useConstant<T>(fn: () => T): T;
|
11
|
-
export
|
12
|
-
export
|
11
|
+
export type InputFactory<State> = (state$: Observable<State>) => Observable<State>;
|
12
|
+
export type InputFactoryWithInputs<State, Inputs> = (state$: Observable<State>, inputs$: Observable<RestrictArray<Inputs>>) => Observable<State>;
|
13
13
|
/**
|
14
14
|
*
|
15
15
|
*
|
@@ -21,8 +21,8 @@ export declare type InputFactoryWithInputs<State, Inputs> = (state$: Observable<
|
|
21
21
|
export declare function useRxObservable<State>(inputFactory: InputFactory<State>): State | null;
|
22
22
|
export declare function useRxObservable<State>(inputFactory: InputFactory<State>, initialState: State): State;
|
23
23
|
export declare function useRxObservable<State, Inputs>(inputFactory: InputFactoryWithInputs<State, Inputs>, initialState: State, inputs: RestrictArray<Inputs>): State;
|
24
|
-
export
|
25
|
-
export
|
24
|
+
export type VoidableEventCallback<EventValue> = EventValue extends void ? () => void : (e: EventValue) => void;
|
25
|
+
export type EventCallbackState<EventValue, State, Inputs = void> = [
|
26
26
|
VoidableEventCallback<EventValue>,
|
27
27
|
[
|
28
28
|
State extends void ? null : State,
|
@@ -30,11 +30,11 @@ export declare type EventCallbackState<EventValue, State, Inputs = void> = [
|
|
30
30
|
BehaviorSubject<RestrictArray<Inputs> | null>
|
31
31
|
]
|
32
32
|
];
|
33
|
-
export
|
33
|
+
export type ReturnedState<EventValue, State, Inputs> = [
|
34
34
|
EventCallbackState<EventValue, State, Inputs>[0],
|
35
35
|
EventCallbackState<EventValue, State, Inputs>[1][0]
|
36
36
|
];
|
37
|
-
export
|
37
|
+
export type EventCallback<EventValue, State, Inputs> = Not<Inputs extends void ? true : false, (eventSource$: Observable<EventValue>, state$: Observable<State>, inputs$: Observable<RestrictArray<Inputs>>) => Observable<State>, (eventSource$: Observable<EventValue>, state$: Observable<State>) => Observable<State>>;
|
38
38
|
export declare function useEventCallback<EventValue>(callback: EventCallback<EventValue, void, void>): ReturnedState<EventValue, void | null, void>;
|
39
39
|
export declare function useEventCallback<EventValue, State>(callback: EventCallback<EventValue, State, void>, initialState: State): ReturnedState<EventValue, State, void>;
|
40
40
|
export declare function useEventCallback<EventValue, State, Inputs>(callback: EventCallback<EventValue, State, Inputs>, initialState: State, inputs: RestrictArray<Inputs>): ReturnedState<EventValue, State, Inputs>;
|
@@ -5,24 +5,20 @@ import { Store } from './store';
|
|
5
5
|
/**
|
6
6
|
* 将对象转换为常量
|
7
7
|
*/
|
8
|
-
|
9
8
|
export function useConstant(fn) {
|
10
9
|
var ref = useRef();
|
11
|
-
|
12
10
|
if (!ref.current) {
|
13
11
|
ref.current = {
|
14
12
|
v: fn()
|
15
13
|
};
|
16
14
|
}
|
17
|
-
|
18
15
|
return ref.current.v;
|
19
16
|
}
|
20
17
|
export function useRxObservable(inputFactory, initialState, inputs) {
|
21
18
|
var _useState = useState(typeof initialState !== 'undefined' ? initialState : null),
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
20
|
+
state = _useState2[0],
|
21
|
+
setState = _useState2[1];
|
26
22
|
var state$ = useConstant(function () {
|
27
23
|
return new BehaviorSubject(initialState);
|
28
24
|
});
|
@@ -34,14 +30,12 @@ export function useRxObservable(inputFactory, initialState, inputs) {
|
|
34
30
|
}, inputs || []);
|
35
31
|
useEffect(function () {
|
36
32
|
var output$;
|
37
|
-
|
38
33
|
if (inputs) {
|
39
34
|
output$ = inputFactory(state$, inputs$);
|
40
35
|
} else {
|
41
36
|
output$ = inputFactory(state$);
|
42
|
-
}
|
43
|
-
|
44
|
-
|
37
|
+
}
|
38
|
+
// console.log('output', output$);
|
45
39
|
var subscription = output$.subscribe(function (value) {
|
46
40
|
state$.next(value);
|
47
41
|
setState(value);
|
@@ -52,17 +46,14 @@ export function useRxObservable(inputFactory, initialState, inputs) {
|
|
52
46
|
state$.complete();
|
53
47
|
};
|
54
48
|
}, []); // immutable forever
|
55
|
-
|
56
49
|
return state;
|
57
50
|
}
|
58
51
|
export function useEventCallback(callback, initialState, inputs) {
|
59
52
|
var initialValue = typeof initialState !== 'undefined' ? initialState : null;
|
60
|
-
|
61
53
|
var _useState3 = useState(initialValue),
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
54
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
55
|
+
state = _useState4[0],
|
56
|
+
setState = _useState4[1];
|
66
57
|
var event$ = useConstant(function () {
|
67
58
|
return new Subject();
|
68
59
|
});
|
@@ -72,11 +63,9 @@ export function useEventCallback(callback, initialState, inputs) {
|
|
72
63
|
var inputs$ = useConstant(function () {
|
73
64
|
return new BehaviorSubject(typeof inputs === 'undefined' ? null : inputs);
|
74
65
|
});
|
75
|
-
|
76
66
|
function eventCallback(e) {
|
77
67
|
return event$.next(e);
|
78
68
|
}
|
79
|
-
|
80
69
|
var returnedCallback = useCallback(eventCallback, []);
|
81
70
|
useEffect(function () {
|
82
71
|
inputs$.next(inputs);
|
@@ -84,13 +73,11 @@ export function useEventCallback(callback, initialState, inputs) {
|
|
84
73
|
useEffect(function () {
|
85
74
|
setState(initialValue);
|
86
75
|
var value$;
|
87
|
-
|
88
76
|
if (!inputs) {
|
89
77
|
value$ = callback(event$, state$);
|
90
78
|
} else {
|
91
79
|
value$ = callback(event$, state$, inputs$);
|
92
80
|
}
|
93
|
-
|
94
81
|
var subscription = value$.subscribe(function (value) {
|
95
82
|
state$.next(value);
|
96
83
|
setState(value);
|
@@ -107,7 +94,6 @@ export function useEventCallback(callback, initialState, inputs) {
|
|
107
94
|
/**
|
108
95
|
* 创建一个可监听的对象
|
109
96
|
*/
|
110
|
-
|
111
97
|
export function useRxStore(options) {
|
112
98
|
var store = useConstant(function () {
|
113
99
|
return new Store(options);
|
@@ -121,22 +107,18 @@ export function useRxStore(options) {
|
|
121
107
|
}
|
122
108
|
var storeFactory = {};
|
123
109
|
/** 处理副作用 */
|
124
|
-
|
125
110
|
export function useRxEffect(factory, deps) {
|
126
111
|
// const event$ = useConstant(() => new Subject<EventValue>());
|
127
112
|
var event$ = useConstant(function () {
|
128
113
|
return new Subject();
|
129
114
|
});
|
130
|
-
|
131
115
|
var eventCallback = function eventCallback(e) {
|
132
116
|
event$.next(e);
|
133
117
|
};
|
134
|
-
|
135
118
|
var returnedCallback = useCallback(eventCallback, []);
|
136
119
|
useEffect(function () {
|
137
120
|
var res = factory(event$);
|
138
121
|
var subscription;
|
139
|
-
|
140
122
|
if (res instanceof Observable) {
|
141
123
|
subscription = res.subscribe(function (p) {
|
142
124
|
// console.log('subscribe', p);
|
@@ -145,11 +127,10 @@ export function useRxEffect(factory, deps) {
|
|
145
127
|
}
|
146
128
|
});
|
147
129
|
}
|
148
|
-
|
149
130
|
return function () {
|
150
131
|
var _subscription;
|
151
|
-
|
152
|
-
|
132
|
+
(_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.unsubscribe();
|
133
|
+
// event$.unsubscribe();
|
153
134
|
};
|
154
135
|
}, deps ? deps : []);
|
155
136
|
useEffect(function () {
|
@@ -160,31 +141,25 @@ export function useRxEffect(factory, deps) {
|
|
160
141
|
return returnedCallback;
|
161
142
|
}
|
162
143
|
/** 创建一个单例的store */
|
163
|
-
|
164
144
|
export function createSingletonStore(options, key) {
|
165
145
|
if (key) {
|
166
146
|
if (storeFactory[key]) {
|
167
147
|
return storeFactory[key];
|
168
148
|
}
|
169
149
|
}
|
170
|
-
|
171
150
|
var store = new Store(options);
|
172
|
-
|
173
151
|
if (key) {
|
174
152
|
storeFactory[key] = store;
|
175
153
|
}
|
176
|
-
|
177
154
|
return store;
|
178
155
|
}
|
179
156
|
/** 通过key获取store */
|
180
|
-
|
181
157
|
export function getStoreByKey(key) {
|
182
158
|
return storeFactory[key];
|
183
159
|
}
|
184
160
|
/**
|
185
161
|
* 转换State到Observable
|
186
162
|
*/
|
187
|
-
|
188
163
|
export function useRxObservableState(v) {
|
189
164
|
var value$ = useConstant(function () {
|
190
165
|
return new BehaviorSubject(v);
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { Observable } from 'rxjs';
|
2
|
-
export
|
2
|
+
export type StoreUpdateChange<T> = {
|
3
3
|
previousValue: T;
|
4
4
|
currentValue: T;
|
5
5
|
label?: string;
|
6
6
|
};
|
7
|
-
export
|
8
|
-
export
|
7
|
+
export type StoreOnUpdateFn<T> = (change: StoreUpdateChange<T>) => void;
|
8
|
+
export type StoreInitOptions<T> = {
|
9
9
|
initialValue: T;
|
10
10
|
};
|
11
|
-
export
|
11
|
+
export type CommandOptions = {
|
12
12
|
label?: string;
|
13
13
|
};
|
14
14
|
export declare const RESET = "store/reset";
|
@@ -8,11 +8,9 @@ export var RESET = 'store/reset';
|
|
8
8
|
/**
|
9
9
|
* 创建一个可监听的对象
|
10
10
|
*/
|
11
|
-
|
12
11
|
export var Store = /*#__PURE__*/function () {
|
13
12
|
function Store(initOptions) {
|
14
13
|
_classCallCheck(this, Store);
|
15
|
-
|
16
14
|
this.valueSubject = void 0;
|
17
15
|
this.storeUpdateChangeSubject = void 0;
|
18
16
|
this.initialValue = void 0;
|
@@ -21,8 +19,6 @@ export var Store = /*#__PURE__*/function () {
|
|
21
19
|
this.initialValue = initOptions.initialValue;
|
22
20
|
}
|
23
21
|
/** 全量更新 */
|
24
|
-
|
25
|
-
|
26
22
|
_createClass(Store, [{
|
27
23
|
key: "valueChanges",
|
28
24
|
get: function get() {
|
@@ -42,7 +38,6 @@ export var Store = /*#__PURE__*/function () {
|
|
42
38
|
key: "dispose",
|
43
39
|
value: function dispose() {
|
44
40
|
var _this$valueSubject;
|
45
|
-
|
46
41
|
(_this$valueSubject = this.valueSubject) === null || _this$valueSubject === void 0 ? void 0 : _this$valueSubject.unsubscribe();
|
47
42
|
this.valueSubject = null;
|
48
43
|
this.storeUpdateChangeSubject.unsubscribe();
|
@@ -63,7 +58,6 @@ export var Store = /*#__PURE__*/function () {
|
|
63
58
|
});
|
64
59
|
}
|
65
60
|
/** 分布更新 */
|
66
|
-
|
67
61
|
}, {
|
68
62
|
key: "updatePartial",
|
69
63
|
value: function updatePartial(value) {
|
@@ -80,7 +74,6 @@ export var Store = /*#__PURE__*/function () {
|
|
80
74
|
/**
|
81
75
|
* 监听一部分属性
|
82
76
|
*/
|
83
|
-
|
84
77
|
}, {
|
85
78
|
key: "select",
|
86
79
|
value: function select(selectFn) {
|
@@ -89,12 +82,10 @@ export var Store = /*#__PURE__*/function () {
|
|
89
82
|
/**
|
90
83
|
* 重置到初始值
|
91
84
|
*/
|
92
|
-
|
93
85
|
}, {
|
94
86
|
key: "reset",
|
95
87
|
value: function reset() {
|
96
88
|
var _this = this;
|
97
|
-
|
98
89
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
99
90
|
label: RESET
|
100
91
|
};
|
@@ -103,6 +94,5 @@ export var Store = /*#__PURE__*/function () {
|
|
103
94
|
}, options);
|
104
95
|
}
|
105
96
|
}]);
|
106
|
-
|
107
97
|
return Store;
|
108
98
|
}();
|
package/es/framework/fg/index.js
CHANGED
@@ -7,27 +7,22 @@ import { renderBasicFormProps, renderLayoutFormProps, renderSetting } from './ut
|
|
7
7
|
/**
|
8
8
|
* 链式调用 组件元数据表单的机器人
|
9
9
|
*/
|
10
|
-
|
11
10
|
export var FormRobot = /*#__PURE__*/function () {
|
12
|
-
/**
|
13
|
-
* 构建每个字段的值
|
14
|
-
*/
|
15
|
-
|
16
|
-
/**
|
17
|
-
* 用来判断是否已经初始化过数据
|
18
|
-
*/
|
19
11
|
function FormRobot(data) {
|
20
12
|
_classCallCheck(this, FormRobot);
|
21
|
-
|
13
|
+
/**
|
14
|
+
* 构建每个字段的值
|
15
|
+
*/
|
22
16
|
this._data = void 0;
|
17
|
+
/**
|
18
|
+
* 用来判断是否已经初始化过数据
|
19
|
+
*/
|
23
20
|
this._hasInitData = void 0;
|
24
|
-
|
25
21
|
/**
|
26
22
|
* 构造函数 正式判断是够已经初始化数据
|
27
23
|
* data -> 如果存在,则作为初始化数据
|
28
24
|
*/
|
29
25
|
this._hasInitData = true;
|
30
|
-
|
31
26
|
if (data === undefined) {
|
32
27
|
this._data = null;
|
33
28
|
this._hasInitData = false;
|
@@ -40,8 +35,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
40
35
|
* @param arr
|
41
36
|
* @returns
|
42
37
|
*/
|
43
|
-
|
44
|
-
|
45
38
|
_createClass(FormRobot, [{
|
46
39
|
key: "create",
|
47
40
|
value: function create(arr) {
|
@@ -49,25 +42,22 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
49
42
|
nodes: [],
|
50
43
|
setting: {}
|
51
44
|
};
|
52
|
-
|
53
45
|
var _data = {
|
54
46
|
nodes: [].concat(_toConsumableArray(_init.nodes), _toConsumableArray(arr)),
|
55
47
|
setting: _init.setting
|
56
48
|
};
|
57
49
|
return new FormRobot(_data);
|
58
|
-
}
|
59
|
-
|
50
|
+
}
|
51
|
+
//*********************************表单基本类型__START************************************//
|
60
52
|
/**
|
61
53
|
* 对象类型 创建表单的入口
|
62
54
|
* @param _id 属性名
|
63
55
|
* @returns
|
64
56
|
*/
|
65
|
-
|
66
57
|
}, {
|
67
58
|
key: "object",
|
68
59
|
value: function object(arr, _id) {
|
69
60
|
var _data = renderLayoutFormProps(arr, _id, 'obj');
|
70
|
-
|
71
61
|
return new FormRobot(_data);
|
72
62
|
}
|
73
63
|
/**
|
@@ -75,12 +65,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
75
65
|
* @param _id 属性名
|
76
66
|
* @returns
|
77
67
|
*/
|
78
|
-
|
79
68
|
}, {
|
80
69
|
key: "input",
|
81
70
|
value: function input(_id) {
|
82
71
|
var _data = renderBasicFormProps(_id, 'input');
|
83
|
-
|
84
72
|
return new FormRobot(_data);
|
85
73
|
}
|
86
74
|
/**
|
@@ -88,12 +76,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
88
76
|
* @param _id
|
89
77
|
* @returns
|
90
78
|
*/
|
91
|
-
|
92
79
|
}, {
|
93
80
|
key: "textarea",
|
94
81
|
value: function textarea(_id) {
|
95
82
|
var _data = renderBasicFormProps(_id, 'textarea');
|
96
|
-
|
97
83
|
return new FormRobot(_data);
|
98
84
|
}
|
99
85
|
/**
|
@@ -101,12 +87,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
101
87
|
* @param _id
|
102
88
|
* @returns
|
103
89
|
*/
|
104
|
-
|
105
90
|
}, {
|
106
91
|
key: "date",
|
107
92
|
value: function date(_id) {
|
108
93
|
var _data = renderBasicFormProps(_id, 'date');
|
109
|
-
|
110
94
|
return new FormRobot(_data);
|
111
95
|
}
|
112
96
|
/**
|
@@ -114,12 +98,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
114
98
|
* @param _id
|
115
99
|
* @returns
|
116
100
|
*/
|
117
|
-
|
118
101
|
}, {
|
119
102
|
key: "number",
|
120
103
|
value: function number(_id) {
|
121
104
|
var _data = renderBasicFormProps(_id, 'number');
|
122
|
-
|
123
105
|
return new FormRobot(_data);
|
124
106
|
}
|
125
107
|
/**
|
@@ -127,12 +109,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
127
109
|
* @param _id
|
128
110
|
* @returns
|
129
111
|
*/
|
130
|
-
|
131
112
|
}, {
|
132
113
|
key: "switch",
|
133
114
|
value: function _switch(_id) {
|
134
115
|
var _data = renderBasicFormProps(_id, 'switch');
|
135
|
-
|
136
116
|
return new FormRobot(_data);
|
137
117
|
}
|
138
118
|
/**
|
@@ -140,12 +120,10 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
140
120
|
* @param _id
|
141
121
|
* @returns
|
142
122
|
*/
|
143
|
-
|
144
123
|
}, {
|
145
124
|
key: "select",
|
146
125
|
value: function select(_id) {
|
147
126
|
var _data = renderBasicFormProps(_id, 'select');
|
148
|
-
|
149
127
|
return new FormRobot(_data);
|
150
128
|
}
|
151
129
|
/**
|
@@ -153,163 +131,130 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
153
131
|
* @param _id
|
154
132
|
* @returns
|
155
133
|
*/
|
156
|
-
|
157
134
|
}, {
|
158
135
|
key: "mutiSelect",
|
159
136
|
value: function mutiSelect(_id) {
|
160
137
|
var _data = renderBasicFormProps(_id, 'mutiSelect');
|
161
|
-
|
162
138
|
return new FormRobot(_data);
|
163
|
-
}
|
139
|
+
}
|
140
|
+
//*********************************表单基本类型__END************************************//
|
164
141
|
//*********************************提供的扩展规则完善表单__START************************************//
|
165
142
|
// common
|
166
|
-
|
167
143
|
}, {
|
168
144
|
key: "label",
|
169
145
|
value: function label(_vaule) {
|
170
146
|
var _init = this._hasInitData ? this._data : {};
|
171
|
-
|
172
147
|
var _data = renderSetting(_init, 'label', _vaule);
|
173
|
-
|
174
148
|
return new FormRobot(_data);
|
175
149
|
}
|
176
150
|
}, {
|
177
151
|
key: "require",
|
178
152
|
value: function require() {
|
179
153
|
var _init = this._hasInitData ? this._data : {};
|
180
|
-
|
181
154
|
var _data = renderSetting(_init, 'require', true);
|
182
|
-
|
183
155
|
return new FormRobot(_data);
|
184
156
|
}
|
185
157
|
}, {
|
186
158
|
key: "color",
|
187
159
|
value: function color(_vaule) {
|
188
160
|
var _init = this._hasInitData ? this._data : {};
|
189
|
-
|
190
161
|
var _data = renderSetting(_init, 'color', _vaule);
|
191
|
-
|
192
162
|
return new FormRobot(_data);
|
193
163
|
}
|
194
164
|
}, {
|
195
165
|
key: "colSpan",
|
196
166
|
value: function colSpan(_vaule) {
|
197
167
|
var _init = this._hasInitData ? this._data : {};
|
198
|
-
|
199
168
|
var _data = renderSetting(_init, 'colSpan', _vaule);
|
200
|
-
|
201
169
|
return new FormRobot(_data);
|
202
170
|
}
|
203
171
|
}, {
|
204
172
|
key: "defaultValue",
|
205
173
|
value: function defaultValue(_vaule) {
|
206
174
|
var _init = this._hasInitData ? this._data : {};
|
207
|
-
|
208
175
|
var _data = renderSetting(_init, 'defaultValue', _vaule);
|
209
|
-
|
210
176
|
return new FormRobot(_data);
|
211
177
|
}
|
212
178
|
}, {
|
213
179
|
key: "help",
|
214
180
|
value: function help(_vaule) {
|
215
181
|
var _init = this._hasInitData ? this._data : {};
|
216
|
-
|
217
182
|
var _data = renderSetting(_init, 'help', _vaule);
|
218
|
-
|
219
183
|
return new FormRobot(_data);
|
220
184
|
}
|
221
185
|
}, {
|
222
186
|
key: "tooltip",
|
223
187
|
value: function tooltip(_vaule) {
|
224
188
|
var _init = this._hasInitData ? this._data : {};
|
225
|
-
|
226
189
|
var _data = renderSetting(_init, 'tooltip', _vaule);
|
227
|
-
|
228
190
|
return new FormRobot(_data);
|
229
191
|
}
|
230
192
|
}, {
|
231
193
|
key: "placeholder",
|
232
194
|
value: function placeholder(_vaule) {
|
233
195
|
var _init = this._hasInitData ? this._data : {};
|
234
|
-
|
235
196
|
var _data = renderSetting(_init, 'placeholder', _vaule);
|
236
|
-
|
237
197
|
return new FormRobot(_data);
|
238
198
|
}
|
239
199
|
}, {
|
240
200
|
key: "disabled",
|
241
201
|
value: function disabled() {
|
242
202
|
var _init = this._hasInitData ? this._data : {};
|
243
|
-
|
244
203
|
var _data = renderSetting(_init, 'disabled', true);
|
245
|
-
|
246
204
|
return new FormRobot(_data);
|
247
205
|
}
|
248
206
|
}, {
|
249
207
|
key: "br",
|
250
208
|
value: function br() {
|
251
209
|
var _init = this._hasInitData ? this._data : {};
|
252
|
-
|
253
210
|
var _data = renderSetting(_init, 'br', true);
|
254
|
-
|
255
211
|
return new FormRobot(_data);
|
256
212
|
}
|
257
213
|
}, {
|
258
214
|
key: "hidden",
|
259
215
|
value: function hidden() {
|
260
216
|
var _init = this._hasInitData ? this._data : {};
|
261
|
-
|
262
217
|
var _data = renderSetting(_init, 'hidden', true);
|
263
|
-
|
264
218
|
return new FormRobot(_data);
|
265
|
-
}
|
266
|
-
|
219
|
+
}
|
220
|
+
// textarea
|
267
221
|
}, {
|
268
222
|
key: "showCount",
|
269
223
|
value: function showCount() {
|
270
224
|
var _init = this._hasInitData ? this._data : {};
|
271
|
-
|
272
225
|
var _data = renderSetting(_init, 'text.showCount', true);
|
273
|
-
|
274
226
|
return new FormRobot(_data);
|
275
227
|
}
|
276
228
|
}, {
|
277
229
|
key: "maxLength",
|
278
230
|
value: function maxLength(_value) {
|
279
231
|
var _init = this._hasInitData ? this._data : {};
|
280
|
-
|
281
232
|
var _data = renderSetting(_init, 'text.maxLength', _value);
|
282
|
-
|
283
233
|
return new FormRobot(_data);
|
284
234
|
}
|
285
235
|
}, {
|
286
236
|
key: "textareaRows",
|
287
237
|
value: function textareaRows(_value) {
|
288
238
|
var _init = this._hasInitData ? this._data : {};
|
289
|
-
|
290
239
|
var _data = renderSetting(_init, 'text.textareaRows', _value);
|
291
|
-
|
292
240
|
return new FormRobot(_data);
|
293
|
-
}
|
294
|
-
|
241
|
+
}
|
242
|
+
// select
|
295
243
|
}, {
|
296
244
|
key: "enum",
|
297
245
|
value: function _enum(_value) {
|
298
246
|
var _init = this._hasInitData ? this._data : {};
|
299
|
-
|
300
247
|
var _data = renderSetting(_init, 'enum.value', _value);
|
301
|
-
|
302
248
|
return new FormRobot(_data);
|
303
|
-
}
|
249
|
+
}
|
250
|
+
//*********************************提供的扩展规则完善表单__END************************************//
|
304
251
|
//*********************************表单布局的扩展规则__START************************************//
|
305
|
-
|
306
252
|
/**
|
307
253
|
* 整体布局
|
308
254
|
* @param this
|
309
255
|
* @param _vaule
|
310
256
|
* @returns
|
311
257
|
*/
|
312
|
-
|
313
258
|
}, {
|
314
259
|
key: "grid",
|
315
260
|
value: function grid(_vaule) {
|
@@ -317,7 +262,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
317
262
|
nodes: [],
|
318
263
|
setting: {}
|
319
264
|
};
|
320
|
-
|
321
265
|
var _data = {
|
322
266
|
nodes: _toConsumableArray(_init.nodes),
|
323
267
|
setting: _objectSpread(_objectSpread({}, _init.setting), {}, {
|
@@ -332,7 +276,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
332
276
|
* @param _vaule
|
333
277
|
* @returns
|
334
278
|
*/
|
335
|
-
|
336
279
|
}, {
|
337
280
|
key: "layout",
|
338
281
|
value: function layout(_vaule) {
|
@@ -340,7 +283,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
340
283
|
nodes: [],
|
341
284
|
setting: {}
|
342
285
|
};
|
343
|
-
|
344
286
|
var _data = {
|
345
287
|
nodes: _toConsumableArray(_init.nodes),
|
346
288
|
setting: _objectSpread(_objectSpread({}, _init.setting), {}, {
|
@@ -355,7 +297,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
355
297
|
* @param _vaule
|
356
298
|
* @returns
|
357
299
|
*/
|
358
|
-
|
359
300
|
}, {
|
360
301
|
key: "labelSpan",
|
361
302
|
value: function labelSpan(_vaule) {
|
@@ -363,7 +304,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
363
304
|
nodes: [],
|
364
305
|
setting: {}
|
365
306
|
};
|
366
|
-
|
367
307
|
var _data = {
|
368
308
|
nodes: _toConsumableArray(_init.nodes),
|
369
309
|
setting: _objectSpread(_objectSpread({}, _init.setting), {}, {
|
@@ -371,14 +311,13 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
371
311
|
})
|
372
312
|
};
|
373
313
|
return new FormRobot(_data);
|
374
|
-
}
|
314
|
+
}
|
315
|
+
//*********************************表单布局的扩展规则__END************************************//
|
375
316
|
//*********************************拿到最终的数据方法__START************************************//
|
376
|
-
|
377
317
|
}, {
|
378
318
|
key: "valueOf",
|
379
319
|
value: function valueOf() {
|
380
320
|
var _this$_data, _this$_data2;
|
381
|
-
|
382
321
|
if (((_this$_data = this._data) === null || _this$_data === void 0 ? void 0 : _this$_data.nodes) && Array.isArray((_this$_data2 = this._data) === null || _this$_data2 === void 0 ? void 0 : _this$_data2.nodes)) {
|
383
322
|
//是数组,说明是create方法,需要转换成元数据
|
384
323
|
return transFG2Schema(this._data.nodes, {
|
@@ -394,7 +333,6 @@ export var FormRobot = /*#__PURE__*/function () {
|
|
394
333
|
return JSON.stringify(this.valueOf());
|
395
334
|
}
|
396
335
|
}]);
|
397
|
-
|
398
336
|
return FormRobot;
|
399
337
|
}();
|
400
338
|
export default new FormRobot();
|
@@ -90,7 +90,7 @@ export interface IReturnMethod {
|
|
90
90
|
valueOf(): void;
|
91
91
|
toString(): void;
|
92
92
|
}
|
93
|
-
export
|
93
|
+
export type ICreateData = {
|
94
94
|
/**
|
95
95
|
* 表单的属性集合
|
96
96
|
*/
|
@@ -100,4 +100,4 @@ export declare type ICreateData = {
|
|
100
100
|
*/
|
101
101
|
setting: {};
|
102
102
|
};
|
103
|
-
export
|
103
|
+
export type IFormRobot = ICreate & IComps;
|