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,7 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
-
|
5
4
|
/*
|
6
5
|
* @Author: your name
|
7
6
|
* @Date: 2021-09-18 14:15:04
|
@@ -10,59 +9,51 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
9
|
import { getLocale } from '../../../framework/locale';
|
11
10
|
import moment from 'moment';
|
12
11
|
import React from 'react';
|
13
|
-
import { STREAM_EVENT_TYPE } from '../constants';
|
14
|
-
|
12
|
+
import { STREAM_EVENT_TYPE } from '../constants';
|
13
|
+
// 主题样式名映射
|
15
14
|
var languageMap = {
|
16
15
|
'zh-CN': 'common',
|
17
16
|
'en-US': 'common-en-US'
|
18
17
|
};
|
19
18
|
export var useGetExtraInfo = function useGetExtraInfo(fields, id, form, type) {
|
20
19
|
var _React$useState = React.useState({}),
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
21
|
+
extra = _React$useState2[0],
|
22
|
+
setExtra = _React$useState2[1];
|
25
23
|
React.useEffect(function () {
|
26
24
|
if (fields) {
|
27
25
|
var extraInfo = fields.get(id);
|
28
|
-
|
29
26
|
if (extraInfo) {
|
30
27
|
// 将map转化为对象
|
31
28
|
var _extraInfo = {};
|
32
|
-
|
33
29
|
for (var k in extraInfo) {
|
34
30
|
_extraInfo[k] = extraInfo[k];
|
35
31
|
}
|
36
|
-
|
37
32
|
// 兼容 common公共的属性
|
38
33
|
if (_extraInfo['common-en-US']) {
|
39
34
|
_extraInfo = _objectSpread(_objectSpread(_objectSpread({}, _extraInfo), _extraInfo[languageMap[getLocale()]]), _extraInfo[type]);
|
40
35
|
} else {
|
41
36
|
_extraInfo = _objectSpread(_objectSpread(_objectSpread({}, _extraInfo), _extraInfo.common), _extraInfo[type]);
|
42
37
|
}
|
43
|
-
|
44
38
|
delete _extraInfo.common;
|
45
39
|
delete _extraInfo['common-en-US'];
|
46
40
|
delete _extraInfo[type];
|
47
|
-
|
48
41
|
// 时间格式转化
|
49
42
|
if (_extraInfo.type === 'datePicker' && form.getFieldValue(id)) {
|
50
43
|
form.setFieldsValue(_defineProperty({}, id, moment(form.getFieldValue(id), 'YYYY-MM-DD HH:mm:ss')));
|
51
44
|
}
|
52
|
-
|
53
45
|
setExtra(_objectSpread({}, _extraInfo));
|
54
46
|
}
|
55
47
|
}
|
56
48
|
}, [fields, form, id]);
|
57
49
|
return extra;
|
58
|
-
};
|
59
|
-
|
50
|
+
};
|
51
|
+
// 处理depend联动
|
60
52
|
export var useWatchDepend = function useWatchDepend(_depends, stream$, name) {
|
61
53
|
var _React$useState3 = React.useState({}),
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
54
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
55
|
+
depends = _React$useState4[0],
|
56
|
+
setDepends = _React$useState4[1];
|
66
57
|
var dependsRef = React.useRef({});
|
67
58
|
React.useEffect(function () {
|
68
59
|
if (_depends && stream$) {
|
@@ -70,31 +61,23 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$, name) {
|
|
70
61
|
if ((p === null || p === void 0 ? void 0 : p.type) === STREAM_EVENT_TYPE.ON_VALUES_CHANGE) {
|
71
62
|
if (_depends === null || _depends === void 0 ? void 0 : _depends.hidden) {
|
72
63
|
var _p$payload;
|
73
|
-
|
74
64
|
var _hidden = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.hidden, p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.allVals, stream$, name);
|
75
|
-
|
76
65
|
var _dr = dependsRef.current;
|
77
66
|
_dr.hidden = _hidden;
|
78
67
|
setDepends(_objectSpread({}, _dr));
|
79
68
|
dependsRef.current = _dr;
|
80
69
|
}
|
81
|
-
|
82
70
|
if (_depends === null || _depends === void 0 ? void 0 : _depends.show) {
|
83
71
|
var _p$payload2;
|
84
|
-
|
85
72
|
var _show = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.show, p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.allVals, stream$, name);
|
86
|
-
|
87
73
|
var _dr2 = dependsRef.current;
|
88
74
|
_dr2.show = _show;
|
89
75
|
setDepends(_objectSpread({}, _dr2));
|
90
76
|
dependsRef.current = _dr2;
|
91
77
|
}
|
92
|
-
|
93
78
|
if (_depends === null || _depends === void 0 ? void 0 : _depends.notRequire) {
|
94
79
|
var _p$payload3;
|
95
|
-
|
96
80
|
var _show2 = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.notRequire, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals, stream$, name);
|
97
|
-
|
98
81
|
var _dr3 = dependsRef.current;
|
99
82
|
_dr3.notRequire = _show2;
|
100
83
|
setDepends(_objectSpread({}, _dr3));
|
@@ -106,32 +89,24 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$, name) {
|
|
106
89
|
}, [_depends, stream$]);
|
107
90
|
return depends;
|
108
91
|
};
|
109
|
-
|
110
92
|
var processDependHiddenOrShow = function processDependHiddenOrShow(depend, changeData, stream$, name) {
|
111
93
|
try {
|
112
94
|
// const regex = /\w+(\.\w+)?[=<>!]{1}/g;
|
113
95
|
var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('.+'\)[=<>!]{1})/g;
|
114
96
|
var keys = depend.trim().match(regex);
|
115
|
-
|
116
97
|
if (!keys) {
|
117
98
|
return false;
|
118
99
|
}
|
119
|
-
|
120
100
|
var expression = depend;
|
121
|
-
|
122
101
|
for (var i = 0; i < keys.length; i++) {
|
123
|
-
var key = keys[i].substring(0, keys[i].length - 1);
|
124
|
-
|
102
|
+
var key = keys[i].substring(0, keys[i].length - 1);
|
103
|
+
// 处理.length 之类的状况
|
125
104
|
var _key = key.split('.');
|
126
|
-
|
127
105
|
var evalString = 'changeData';
|
128
|
-
|
129
106
|
for (var _i = 0; _i < name.length; _i++) {
|
130
107
|
evalString = "".concat(evalString, "[name[").concat(_i, "]]");
|
131
108
|
}
|
132
|
-
|
133
109
|
var _changeData = eval("".concat(evalString, "['").concat(_key[0], "']"));
|
134
|
-
|
135
110
|
if (_changeData || _changeData === 0) {
|
136
111
|
var r = key === _key[0] ? "'".concat(_changeData, "'") : eval("_changeData.".concat(_key[1]));
|
137
112
|
expression = expression.replace(key, r);
|
@@ -139,7 +114,6 @@ var processDependHiddenOrShow = function processDependHiddenOrShow(depend, chang
|
|
139
114
|
expression = expression.replace(key, undefined);
|
140
115
|
}
|
141
116
|
}
|
142
|
-
|
143
117
|
return eval(expression);
|
144
118
|
} catch (error) {
|
145
119
|
console.error("useWatchDepend.expression is error", error);
|
@@ -14,80 +14,68 @@ import useObservable from '../../framework/rxjs-hooks/useObservable';
|
|
14
14
|
import moment from 'moment';
|
15
15
|
import { DEFAULT_DATE_FORMAT } from './DataCell/Input';
|
16
16
|
import { STREAM_EVENT_TYPE } from './constants';
|
17
|
-
|
18
17
|
var MetadataForm = function MetadataForm(props) {
|
19
18
|
var _Form$useForm = _Form.useForm(),
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
20
|
+
form = _Form$useForm2[0];
|
23
21
|
var schema = props.schema,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
22
|
+
initialValues = props.initialValues,
|
23
|
+
refId = props.refId,
|
24
|
+
_props$colSpan = props.colSpan,
|
25
|
+
colSpan = _props$colSpan === void 0 ? 24 : _props$colSpan,
|
26
|
+
labelSpan = props.labelSpan,
|
27
|
+
_props$labelWrap = props.labelWrap,
|
28
|
+
labelWrap = _props$labelWrap === void 0 ? true : _props$labelWrap,
|
29
|
+
_props$layout = props.layout,
|
30
|
+
layout = _props$layout === void 0 ? 'vertical' : _props$layout,
|
31
|
+
_props$disabled = props.disabled,
|
32
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
33
|
+
_props$isRefForm = props.isRefForm,
|
34
|
+
isRefForm = _props$isRefForm === void 0 ? true : _props$isRefForm,
|
35
|
+
_props$isFoldForm = props.isFoldForm,
|
36
|
+
isFoldForm = _props$isFoldForm === void 0 ? false : _props$isFoldForm,
|
37
|
+
_props$isShowTypeInfo = props.isShowTypeInfo,
|
38
|
+
isShowTypeInfo = _props$isShowTypeInfo === void 0 ? false : _props$isShowTypeInfo,
|
39
|
+
initEnumValue = props.initEnumValue,
|
40
|
+
onFinish = props.onFinish,
|
41
|
+
getFormInstance = props.getFormInstance,
|
42
|
+
onValuesChange = props.onValuesChange,
|
43
|
+
onSelectChange = props.onSelectChange,
|
44
|
+
onCellButtonClick = props.onCellButtonClick;
|
48
45
|
var _React$useState = React.useState([]),
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
47
|
+
mySchma = _React$useState2[0],
|
48
|
+
setMySchema = _React$useState2[1];
|
53
49
|
var _React$useState3 = React.useState(),
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
51
|
+
innerSchemas = _React$useState4[0],
|
52
|
+
setInnerSchemas = _React$useState4[1];
|
58
53
|
var _React$useState5 = React.useState(),
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
55
|
+
fields = _React$useState6[0],
|
56
|
+
setFields = _React$useState6[1];
|
63
57
|
var _React$useState7 = React.useState(),
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
59
|
+
formFieldValue = _React$useState8[0],
|
60
|
+
setFormFieldValue = _React$useState8[1];
|
68
61
|
var firstLoadRef = React.useRef(true);
|
69
62
|
var firstLoadForm = React.useRef(true);
|
70
63
|
var firstLoadValue = React.useRef(true);
|
71
64
|
var stream$ = useMemoSubject();
|
72
65
|
var processStreamEvent = React.useCallback(function (p) {
|
73
66
|
var _p$payload;
|
74
|
-
|
75
67
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
76
68
|
case STREAM_EVENT_TYPE.ON_SELECT_CHANGE:
|
77
69
|
onSelectChange && onSelectChange(p.payload);
|
78
70
|
break;
|
79
|
-
|
80
71
|
case STREAM_EVENT_TYPE.ON_BUTTON_CELL_CLICK:
|
81
72
|
onCellButtonClick && onCellButtonClick(p.payload);
|
82
73
|
break;
|
83
|
-
|
84
74
|
case STREAM_EVENT_TYPE.ON_VALUES_CHANGE:
|
85
75
|
if (!(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.trigger)) {
|
86
76
|
var _p$payload2, _p$payload3;
|
87
|
-
|
88
77
|
onValuesChange && onValuesChange(p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.val, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals);
|
89
78
|
}
|
90
|
-
|
91
79
|
break;
|
92
80
|
}
|
93
81
|
}, []);
|
@@ -105,19 +93,16 @@ var MetadataForm = function MetadataForm(props) {
|
|
105
93
|
/**
|
106
94
|
* 获取form的实例
|
107
95
|
*/
|
108
|
-
|
109
96
|
React.useEffect(function () {
|
110
97
|
if (form && stream$ && firstLoadForm.current) {
|
111
98
|
// 改写setFiedldsValue;
|
112
99
|
var e = form.setFieldsValue;
|
113
|
-
|
114
100
|
var setFieldsValue = function setFieldsValue(vals) {
|
115
101
|
e(vals);
|
116
102
|
stream$.next({
|
117
103
|
type: 'setFieldsValue',
|
118
104
|
payload: vals
|
119
105
|
});
|
120
|
-
|
121
106
|
if (firstLoadValue.current) {
|
122
107
|
firstLoadValue.current = false;
|
123
108
|
stream$.next({
|
@@ -130,7 +115,6 @@ var MetadataForm = function MetadataForm(props) {
|
|
130
115
|
});
|
131
116
|
}
|
132
117
|
};
|
133
|
-
|
134
118
|
form.setFieldsValue = setFieldsValue;
|
135
119
|
getFormInstance && getFormInstance(form);
|
136
120
|
firstLoadForm.current = false;
|
@@ -147,7 +131,6 @@ var MetadataForm = function MetadataForm(props) {
|
|
147
131
|
var server = new MetadataService();
|
148
132
|
server.GetMetadataDetailById(refId).then(function (res) {
|
149
133
|
var _schema = JSON.parse(res.schema) || [];
|
150
|
-
|
151
134
|
setMySchema(_toConsumableArray(_schema));
|
152
135
|
});
|
153
136
|
}
|
@@ -155,7 +138,6 @@ var MetadataForm = function MetadataForm(props) {
|
|
155
138
|
React.useEffect(function () {
|
156
139
|
if (mySchma && mySchma.length > 0) {
|
157
140
|
var _mySchma$, _mySchma$2, _mySchma$3, _mySchma$3$fields$;
|
158
|
-
|
159
141
|
var provider = new JsonMetadataProvider();
|
160
142
|
provider.add_types(mySchma);
|
161
143
|
var FormCls = provider.get_type(mySchma[0].id);
|
@@ -168,7 +150,6 @@ var MetadataForm = function MetadataForm(props) {
|
|
168
150
|
provider = null;
|
169
151
|
};
|
170
152
|
}
|
171
|
-
|
172
153
|
return function () {};
|
173
154
|
}, [mySchma]);
|
174
155
|
React.useEffect(function () {
|
@@ -177,10 +158,8 @@ var MetadataForm = function MetadataForm(props) {
|
|
177
158
|
// 处理时间格式
|
178
159
|
fields.forEach(function (v, k) {
|
179
160
|
var _v$text;
|
180
|
-
|
181
161
|
if (((v === null || v === void 0 ? void 0 : (_v$text = v.text) === null || _v$text === void 0 ? void 0 : _v$text.type) === 'datePicker' || (v === null || v === void 0 ? void 0 : v.type) === 'datePicker') && initialValues[k]) {
|
182
162
|
var _v$text2;
|
183
|
-
|
184
163
|
initialValues[k] = moment(initialValues[k], (v === null || v === void 0 ? void 0 : (_v$text2 = v.text) === null || _v$text2 === void 0 ? void 0 : _v$text2.format) || DEFAULT_DATE_FORMAT);
|
185
164
|
}
|
186
165
|
});
|
@@ -197,37 +176,28 @@ var MetadataForm = function MetadataForm(props) {
|
|
197
176
|
}, [initialValues, fields]);
|
198
177
|
var myLabelSpan = React.useMemo(function () {
|
199
178
|
var _labelSpan = undefined;
|
200
|
-
|
201
179
|
if (labelSpan || (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.labelSpan)) {
|
202
180
|
_labelSpan = (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.labelSpan) ? formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.labelSpan : labelSpan;
|
203
181
|
}
|
204
|
-
|
205
182
|
return _labelSpan;
|
206
183
|
}, [labelSpan, formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.labelSpan]);
|
207
184
|
var myLayout = React.useMemo(function () {
|
208
185
|
var _layout = 'vertical';
|
209
|
-
|
210
186
|
if (layout || (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout)) {
|
211
187
|
_layout = (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout) ? formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout : layout;
|
212
188
|
}
|
213
|
-
|
214
189
|
return _layout;
|
215
190
|
}, [layout, formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout]);
|
216
|
-
|
217
191
|
var onMyValuesChange = function onMyValuesChange(value, allValues) {
|
218
192
|
var _extra$text;
|
219
|
-
|
220
193
|
// 处理时间格式
|
221
194
|
var key = Object.keys(value);
|
222
195
|
var extra = fields.get(key[0]);
|
223
|
-
|
224
196
|
if ((extra === null || extra === void 0 ? void 0 : (_extra$text = extra.text) === null || _extra$text === void 0 ? void 0 : _extra$text.type) === 'datePicker' || (extra === null || extra === void 0 ? void 0 : extra.type) === 'datePicker') {
|
225
197
|
var _extra$text2, _extra$text3;
|
226
|
-
|
227
198
|
value[key[0]] = moment(value[key[0]]).format((extra === null || extra === void 0 ? void 0 : (_extra$text2 = extra.text) === null || _extra$text2 === void 0 ? void 0 : _extra$text2.format) || DEFAULT_DATE_FORMAT);
|
228
199
|
allValues[key[0]] = moment(value[key[0]]).format((extra === null || extra === void 0 ? void 0 : (_extra$text3 = extra.text) === null || _extra$text3 === void 0 ? void 0 : _extra$text3.format) || DEFAULT_DATE_FORMAT);
|
229
200
|
}
|
230
|
-
|
231
201
|
stream$.next({
|
232
202
|
type: STREAM_EVENT_TYPE.ON_VALUES_CHANGE,
|
233
203
|
payload: {
|
@@ -236,21 +206,17 @@ var MetadataForm = function MetadataForm(props) {
|
|
236
206
|
}
|
237
207
|
});
|
238
208
|
};
|
239
|
-
|
240
209
|
var onMyFinish = function onMyFinish(values) {
|
241
210
|
// 处理时间格式
|
242
211
|
fields.forEach(function (v, k) {
|
243
212
|
var _v$text3;
|
244
|
-
|
245
213
|
if (((v === null || v === void 0 ? void 0 : (_v$text3 = v.text) === null || _v$text3 === void 0 ? void 0 : _v$text3.type) === 'datePicker' || (v === null || v === void 0 ? void 0 : v.type) === 'datePicker') && values[k]) {
|
246
214
|
var _v$text4;
|
247
|
-
|
248
215
|
values[k] = moment(values[k]).format((v === null || v === void 0 ? void 0 : (_v$text4 = v.text) === null || _v$text4 === void 0 ? void 0 : _v$text4.format) || DEFAULT_DATE_FORMAT);
|
249
216
|
}
|
250
217
|
});
|
251
218
|
onFinish && onFinish(values);
|
252
219
|
};
|
253
|
-
|
254
220
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MetadataFormContext.Provider, {
|
255
221
|
value: {
|
256
222
|
fields: fields,
|
@@ -282,5 +248,4 @@ var MetadataForm = function MetadataForm(props) {
|
|
282
248
|
onValuesChange: onMyValuesChange
|
283
249
|
}, renderForm(mySchma, options, (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.colSpan) || colSpan))));
|
284
250
|
};
|
285
|
-
|
286
251
|
export default MetadataForm;
|
@@ -50,13 +50,13 @@ export interface IMetaFormProps {
|
|
50
50
|
refId?: string;
|
51
51
|
};
|
52
52
|
}
|
53
|
-
export
|
53
|
+
export type IFiledDepend = {
|
54
54
|
hidden: string;
|
55
55
|
show: string;
|
56
56
|
notRequire: string;
|
57
57
|
};
|
58
|
-
export
|
59
|
-
export
|
58
|
+
export type IStreamEventType = 'onSelectChange' | 'onButtonCellClick' | 'onValuesChange' | 'onWatchDepend' | string;
|
59
|
+
export type IStreamEvent = {
|
60
60
|
type: IStreamEventType;
|
61
61
|
payload: any;
|
62
62
|
};
|
@@ -14,3 +14,4 @@ export declare function getDataCell(item: any, options: IFormOptions, colSpan: n
|
|
14
14
|
export declare function renderForm(schemaRef: any[], options: IFormOptions, colSpan?: number): JSX.Element;
|
15
15
|
export declare function getLabelByProps(data: any): any;
|
16
16
|
export declare function assign(pathArr: string[], val: any, obj: any): void;
|
17
|
+
export declare function assignReplace(pathArr: string[], val: any, obj: any): void;
|
@@ -3,11 +3,10 @@ import _Row from "antd/es/row";
|
|
3
3
|
import "antd/es/spin/style";
|
4
4
|
import _Spin from "antd/es/spin";
|
5
5
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
6
|
-
|
7
6
|
/*
|
8
7
|
* @Author: wangxian
|
9
8
|
* @Date: 2021-09-18 14:15:04
|
10
|
-
* @LastEditTime: 2023-04-
|
9
|
+
* @LastEditTime: 2023-04-28 10:22:47
|
11
10
|
*/
|
12
11
|
import React from 'react';
|
13
12
|
import Input from './DataCell/Input';
|
@@ -28,11 +27,8 @@ var DataCellMap = {
|
|
28
27
|
export function getDataCell(item, options, colSpan) {
|
29
28
|
if (item.type && DataCellMap[item.type]) {
|
30
29
|
var Comm = DataCellMap[item.type];
|
31
|
-
|
32
30
|
if (colSpan === 23) {}
|
33
|
-
|
34
31
|
if (item.type === 'ref') {}
|
35
|
-
|
36
32
|
var isDisabled = function isDisabled(b) {
|
37
33
|
if (typeof b === 'boolean') {
|
38
34
|
return b;
|
@@ -41,10 +37,8 @@ export function getDataCell(item, options, colSpan) {
|
|
41
37
|
}) > -1) {
|
42
38
|
return true;
|
43
39
|
}
|
44
|
-
|
45
40
|
return false;
|
46
41
|
};
|
47
|
-
|
48
42
|
return /*#__PURE__*/React.createElement(Comm, _extends({
|
49
43
|
key: item.id
|
50
44
|
}, item, {
|
@@ -58,7 +52,6 @@ export function getDataCell(item, options, colSpan) {
|
|
58
52
|
colSpan: colSpan
|
59
53
|
}));
|
60
54
|
}
|
61
|
-
|
62
55
|
return null;
|
63
56
|
}
|
64
57
|
/**
|
@@ -72,19 +65,16 @@ export function getDataCell(item, options, colSpan) {
|
|
72
65
|
* @param isObj 是否是个对象
|
73
66
|
* @returns
|
74
67
|
*/
|
75
|
-
|
76
68
|
export function renderForm(schemaRef, options) {
|
77
69
|
var colSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 24;
|
78
70
|
if (schemaRef.length === 0) return /*#__PURE__*/React.createElement(_Spin, null);
|
79
71
|
var _schema = schemaRef[0];
|
80
72
|
var _properties = _schema.properties;
|
81
73
|
var _form = [];
|
82
|
-
|
83
74
|
for (var i = 0; i < _properties.length; i++) {
|
84
75
|
// const depend = useWatchDepend({});
|
85
76
|
_form.push( /*#__PURE__*/React.createElement(React.Fragment, null, getDataCell(_properties[i], options, colSpan)));
|
86
77
|
}
|
87
|
-
|
88
78
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
89
79
|
gutter: 16
|
90
80
|
}, _form));
|
@@ -92,10 +82,8 @@ export function renderForm(schemaRef, options) {
|
|
92
82
|
export function getLabelByProps(data) {
|
93
83
|
if (data.fields && data.fields.length > 0) {
|
94
84
|
var _data$fields$0$value, _data$fields$0$value$, _data$fields$, _data$fields$$value;
|
95
|
-
|
96
85
|
return ((_data$fields$0$value = data.fields[0].value) === null || _data$fields$0$value === void 0 ? void 0 : (_data$fields$0$value$ = _data$fields$0$value.common) === null || _data$fields$0$value$ === void 0 ? void 0 : _data$fields$0$value$.label) || ((_data$fields$ = data.fields[0]) === null || _data$fields$ === void 0 ? void 0 : (_data$fields$$value = _data$fields$.value) === null || _data$fields$$value === void 0 ? void 0 : _data$fields$$value.label) || data.id;
|
97
86
|
}
|
98
|
-
|
99
87
|
return data.id;
|
100
88
|
}
|
101
89
|
export function assign(pathArr, val, obj) {
|
@@ -112,7 +100,17 @@ export function assign(pathArr, val, obj) {
|
|
112
100
|
cur[key] = {};
|
113
101
|
}
|
114
102
|
}
|
115
|
-
|
103
|
+
return cur[key];
|
104
|
+
}, obj);
|
105
|
+
}
|
106
|
+
export function assignReplace(pathArr, val, obj) {
|
107
|
+
var len = pathArr.length - 1;
|
108
|
+
pathArr.reduce(function (cur, key, index) {
|
109
|
+
if (index === len) {
|
110
|
+
cur[key] = val;
|
111
|
+
} else {
|
112
|
+
cur[key] = {};
|
113
|
+
}
|
116
114
|
return cur[key];
|
117
115
|
}, obj);
|
118
116
|
}
|
package/es/comps/Split/index.js
CHANGED
@@ -8,45 +8,47 @@ import Split from 'react-split';
|
|
8
8
|
import './index.less';
|
9
9
|
import classNames from 'classnames';
|
10
10
|
/** antd的card不能直接放在children里 外层套一个div */
|
11
|
-
|
12
11
|
var Index = function Index(props) {
|
13
12
|
var className = props.className,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
return
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
13
|
+
style = props.style,
|
14
|
+
_props$sizes = props.sizes,
|
15
|
+
sizes = _props$sizes === void 0 ? [20, 80] : _props$sizes,
|
16
|
+
_props$gutterSize = props.gutterSize,
|
17
|
+
gutterSize = _props$gutterSize === void 0 ? 5 : _props$gutterSize,
|
18
|
+
_props$dragInterval = props.dragInterval,
|
19
|
+
dragInterval = _props$dragInterval === void 0 ? 1 : _props$dragInterval,
|
20
|
+
_props$minSize = props.minSize,
|
21
|
+
minSize = _props$minSize === void 0 ? 0 : _props$minSize,
|
22
|
+
children = props.children,
|
23
|
+
_props$direction = props.direction,
|
24
|
+
direction = _props$direction === void 0 ? 'horizontal' : _props$direction,
|
25
|
+
_props$cursor = props.cursor,
|
26
|
+
cursor = _props$cursor === void 0 ? 'col-resize' : _props$cursor,
|
27
|
+
gutter = props.gutter,
|
28
|
+
elementStyle = props.elementStyle,
|
29
|
+
gutterStyle = props.gutterStyle,
|
30
|
+
onDrag = props.onDrag,
|
31
|
+
onDragStart = props.onDragStart,
|
32
|
+
onDragEnd = props.onDragEnd;
|
33
|
+
return (
|
34
|
+
/*#__PURE__*/
|
35
|
+
// @ts-ignore
|
36
|
+
React.createElement(Split, {
|
37
|
+
className: classNames('split-panel', className),
|
38
|
+
dragInterval: dragInterval,
|
39
|
+
gutterSize: gutterSize,
|
40
|
+
sizes: sizes,
|
41
|
+
minSize: minSize,
|
42
|
+
direction: direction,
|
43
|
+
style: style,
|
44
|
+
cursor: cursor,
|
45
|
+
gutter: gutter,
|
46
|
+
elementStyle: elementStyle,
|
47
|
+
gutterStyle: gutterStyle,
|
48
|
+
onDrag: onDrag,
|
49
|
+
onDragStart: onDragStart,
|
50
|
+
onDragEnd: onDragEnd
|
51
|
+
}, children)
|
52
|
+
);
|
50
53
|
};
|
51
|
-
|
52
54
|
export default Index;
|
package/es/config.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
|
3
2
|
/*
|
4
3
|
* @Author: wangxian
|
5
4
|
* @Date: 2021-09-18 14:15:04
|
@@ -34,17 +33,14 @@ globalSettingStream.pipe(map(function (p) {
|
|
34
33
|
});
|
35
34
|
var config = defaultConfig;
|
36
35
|
/** 设置配置 */
|
37
|
-
|
38
36
|
export var setConfig = function setConfig(opts) {
|
39
37
|
config = _objectSpread(_objectSpread({}, config), opts);
|
40
38
|
};
|
41
39
|
/** 获取单个配置 */
|
42
|
-
|
43
40
|
export function getConfigByKey(key) {
|
44
41
|
return config[key];
|
45
42
|
}
|
46
43
|
/** 获取全部配置 */
|
47
|
-
|
48
44
|
export var getConfig = function getConfig() {
|
49
45
|
return config;
|
50
46
|
};
|
@@ -18,9 +18,9 @@ export default function () {
|
|
18
18
|
return store.select(function (p) {
|
19
19
|
return p;
|
20
20
|
});
|
21
|
-
});
|
21
|
+
});
|
22
|
+
// console.log('storeVal', storeVal);
|
22
23
|
// 将流转换为state
|
23
|
-
|
24
24
|
var a = useRxObservable(function () {
|
25
25
|
return store.select(function (p) {
|
26
26
|
return p.a;
|
@@ -55,22 +55,21 @@ export default function () {
|
|
55
55
|
});
|
56
56
|
});
|
57
57
|
});
|
58
|
-
|
59
58
|
var _useState = useState(1),
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
60
|
+
count = _useState2[0],
|
61
|
+
setCount = _useState2[1];
|
64
62
|
var getData = function getData() {
|
65
63
|
return new Promise(function (resolve, reject) {
|
66
64
|
setTimeout(function () {
|
67
|
-
resolve(store.value.a * store.value.b);
|
65
|
+
resolve(store.value.a * store.value.b);
|
66
|
+
// reject('dddd');
|
68
67
|
}, 3000);
|
69
68
|
});
|
70
69
|
};
|
71
|
-
|
72
70
|
var e = useRxEffect(function (event$) {
|
73
|
-
return event$.pipe(
|
71
|
+
return event$.pipe(
|
72
|
+
// debounceTime(1000),
|
74
73
|
// distinctUntilChanged(),
|
75
74
|
switchMap(function (p) {
|
76
75
|
return from(getData()).pipe(map(function (p) {
|