@thienvu18/designable-formily-setters 2.0.0 → 2.0.2
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/esm/components/DataSourceSetter/DataSettingPanel.d.ts +8 -8
- package/esm/components/DataSourceSetter/DataSettingPanel.js +124 -52
- package/esm/components/DataSourceSetter/Header.d.ts +5 -5
- package/esm/components/DataSourceSetter/Header.js +16 -7
- package/esm/components/DataSourceSetter/Title.d.ts +5 -5
- package/esm/components/DataSourceSetter/Title.js +57 -44
- package/esm/components/DataSourceSetter/TreePanel.d.ts +10 -10
- package/esm/components/DataSourceSetter/TreePanel.js +129 -89
- package/esm/components/DataSourceSetter/index.d.ts +16 -16
- package/esm/components/DataSourceSetter/index.js +81 -24
- package/esm/components/DataSourceSetter/shared.d.ts +14 -7
- package/esm/components/DataSourceSetter/shared.js +39 -41
- package/esm/components/DataSourceSetter/styles.less +4 -3
- package/esm/components/DataSourceSetter/types.d.ts +12 -12
- package/esm/components/DataSourceSetter/types.js +1 -1
- package/esm/components/ReactionsSetter/FieldPropertySetter.d.ts +6 -6
- package/esm/components/ReactionsSetter/FieldPropertySetter.js +140 -63
- package/esm/components/ReactionsSetter/PathSelector.d.ts +10 -9
- package/esm/components/ReactionsSetter/PathSelector.js +97 -100
- package/esm/components/ReactionsSetter/declarations.d.ts +3 -3
- package/esm/components/ReactionsSetter/declarations.js +31 -18
- package/esm/components/ReactionsSetter/helpers.d.ts +20 -10
- package/esm/components/ReactionsSetter/helpers.js +10 -10
- package/esm/components/ReactionsSetter/index.d.ts +6 -6
- package/esm/components/ReactionsSetter/index.js +412 -230
- package/esm/components/ReactionsSetter/properties.d.ts +14 -11
- package/esm/components/ReactionsSetter/properties.js +49 -40
- package/esm/components/ReactionsSetter/styles.less +2 -2
- package/esm/components/ReactionsSetter/types.d.ts +11 -11
- package/esm/components/ReactionsSetter/types.js +1 -1
- package/esm/components/ValidatorSetter/index.d.ts +4 -4
- package/esm/components/ValidatorSetter/index.js +148 -125
- package/esm/components/index.d.ts +3 -3
- package/esm/components/index.js +3 -3
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/locales/en-US.d.ts +92 -92
- package/esm/locales/en-US.js +96 -93
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/index.js +5 -5
- package/esm/locales/ko-KR.d.ts +92 -92
- package/esm/locales/ko-KR.js +94 -93
- package/esm/locales/zh-CN.d.ts +92 -92
- package/esm/locales/zh-CN.js +94 -93
- package/lib/components/DataSourceSetter/DataSettingPanel.d.ts +8 -8
- package/lib/components/DataSourceSetter/DataSettingPanel.js +129 -55
- package/lib/components/DataSourceSetter/Header.d.ts +5 -5
- package/lib/components/DataSourceSetter/Header.js +19 -10
- package/lib/components/DataSourceSetter/Title.d.ts +5 -5
- package/lib/components/DataSourceSetter/Title.js +70 -47
- package/lib/components/DataSourceSetter/TreePanel.d.ts +10 -10
- package/lib/components/DataSourceSetter/TreePanel.js +134 -92
- package/lib/components/DataSourceSetter/index.d.ts +16 -16
- package/lib/components/DataSourceSetter/index.js +94 -30
- package/lib/components/DataSourceSetter/shared.d.ts +14 -7
- package/lib/components/DataSourceSetter/shared.js +48 -47
- package/lib/components/DataSourceSetter/styles.less +4 -3
- package/lib/components/DataSourceSetter/types.d.ts +12 -12
- package/lib/components/DataSourceSetter/types.js +2 -2
- package/lib/components/ReactionsSetter/FieldPropertySetter.d.ts +6 -6
- package/lib/components/ReactionsSetter/FieldPropertySetter.js +150 -67
- package/lib/components/ReactionsSetter/PathSelector.d.ts +10 -9
- package/lib/components/ReactionsSetter/PathSelector.js +101 -104
- package/lib/components/ReactionsSetter/declarations.d.ts +3 -3
- package/lib/components/ReactionsSetter/declarations.js +35 -22
- package/lib/components/ReactionsSetter/helpers.d.ts +20 -10
- package/lib/components/ReactionsSetter/helpers.js +23 -13
- package/lib/components/ReactionsSetter/index.d.ts +6 -6
- package/lib/components/ReactionsSetter/index.js +434 -234
- package/lib/components/ReactionsSetter/properties.d.ts +14 -11
- package/lib/components/ReactionsSetter/properties.js +43 -43
- package/lib/components/ReactionsSetter/styles.less +2 -2
- package/lib/components/ReactionsSetter/types.d.ts +11 -11
- package/lib/components/ReactionsSetter/types.js +2 -2
- package/lib/components/ValidatorSetter/index.d.ts +4 -4
- package/lib/components/ValidatorSetter/index.js +151 -128
- package/lib/components/index.d.ts +3 -3
- package/lib/components/index.js +35 -19
- package/lib/index.d.ts +2 -2
- package/lib/index.js +34 -18
- package/lib/locales/en-US.d.ts +92 -92
- package/lib/locales/en-US.js +98 -95
- package/lib/locales/index.d.ts +1 -1
- package/lib/locales/index.js +16 -10
- package/lib/locales/ko-KR.d.ts +92 -92
- package/lib/locales/ko-KR.js +96 -95
- package/lib/locales/zh-CN.d.ts +92 -92
- package/lib/locales/zh-CN.js +96 -95
- package/package.json +25 -25
|
@@ -1,84 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { clone, uid } from '@formily/shared'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { requestIdle } from '@thienvu18/designable-shared'
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import '
|
|
1
|
+
import { createForm, isVoidField } from '@formily/core'
|
|
2
|
+
import { createSchemaField } from '@formily/react'
|
|
3
|
+
import { clone, uid } from '@formily/shared'
|
|
4
|
+
import { GlobalRegistry } from '@thienvu18/designable-core'
|
|
5
|
+
import { TextWidget, usePrefix } from '@thienvu18/designable-react'
|
|
6
|
+
import { MonacoInput } from '@thienvu18/designable-react-settings-form'
|
|
7
|
+
import { requestIdle } from '@thienvu18/designable-shared'
|
|
8
|
+
import {
|
|
9
|
+
ArrayTable,
|
|
10
|
+
Form,
|
|
11
|
+
FormCollapse,
|
|
12
|
+
FormItem,
|
|
13
|
+
Input,
|
|
14
|
+
Select,
|
|
15
|
+
} from '@thienvu18/formily-antd-v6'
|
|
16
|
+
import { Button, Card, Modal, Tag, Tooltip } from 'antd'
|
|
17
|
+
import { useEffect, useMemo, useState } from 'react'
|
|
18
|
+
import {
|
|
19
|
+
Fragment as _Fragment,
|
|
20
|
+
jsx as _jsx,
|
|
21
|
+
jsxs as _jsxs,
|
|
22
|
+
} from 'react/jsx-runtime'
|
|
23
|
+
import { FieldPropertySetter } from './FieldPropertySetter'
|
|
24
|
+
import { PathSelector } from './PathSelector'
|
|
25
|
+
import { initDeclaration } from './declarations'
|
|
26
|
+
import { FulfillRunHelper } from './helpers'
|
|
27
|
+
import './styles.less'
|
|
17
28
|
const TypeView = ({ value }) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
const text = String(value)
|
|
30
|
+
if (text.length <= 26) return _jsx(Tag, { children: text })
|
|
31
|
+
return _jsx(Tag, {
|
|
32
|
+
children: _jsxs(Tooltip, {
|
|
33
|
+
title: _jsx('div', {
|
|
34
|
+
style: { fontSize: 12 },
|
|
35
|
+
children: _jsx('code', {
|
|
36
|
+
children: _jsx('pre', {
|
|
37
|
+
style: { whiteSpace: 'pre-wrap', padding: 0, margin: 0 },
|
|
38
|
+
children: text,
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
children: [text.substring(0, 24), '...'],
|
|
43
|
+
}),
|
|
44
|
+
})
|
|
45
|
+
}
|
|
23
46
|
const SchemaField = createSchemaField({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
47
|
+
components: {
|
|
48
|
+
Card,
|
|
49
|
+
FormCollapse,
|
|
50
|
+
Input,
|
|
51
|
+
TypeView,
|
|
52
|
+
Select,
|
|
53
|
+
FormItem,
|
|
54
|
+
PathSelector,
|
|
55
|
+
FieldPropertySetter,
|
|
56
|
+
ArrayTable,
|
|
57
|
+
MonacoInput,
|
|
58
|
+
},
|
|
59
|
+
})
|
|
37
60
|
const FieldStateProperties = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]
|
|
61
|
+
'value',
|
|
62
|
+
'initialValue',
|
|
63
|
+
'inputValue',
|
|
64
|
+
'inputValues',
|
|
65
|
+
'modified',
|
|
66
|
+
'initialized',
|
|
67
|
+
'title',
|
|
68
|
+
'description',
|
|
69
|
+
'mounted',
|
|
70
|
+
'unmounted',
|
|
71
|
+
'active',
|
|
72
|
+
'visited',
|
|
73
|
+
'loading',
|
|
74
|
+
'errors',
|
|
75
|
+
'warnings',
|
|
76
|
+
'successes',
|
|
77
|
+
'feedbacks',
|
|
78
|
+
'valid',
|
|
79
|
+
'invalid',
|
|
80
|
+
'pattern',
|
|
81
|
+
'display',
|
|
82
|
+
'disabled',
|
|
83
|
+
'readOnly',
|
|
84
|
+
'readPretty',
|
|
85
|
+
'visible',
|
|
86
|
+
'hidden',
|
|
87
|
+
'editable',
|
|
88
|
+
'validateStatus',
|
|
89
|
+
'validating',
|
|
90
|
+
]
|
|
68
91
|
const FieldStateValueTypes = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
modified: 'boolean',
|
|
93
|
+
initialized: 'boolean',
|
|
94
|
+
title: 'string',
|
|
95
|
+
description: 'string',
|
|
96
|
+
mounted: 'boolean',
|
|
97
|
+
unmounted: 'boolean',
|
|
98
|
+
active: 'boolean',
|
|
99
|
+
visited: 'boolean',
|
|
100
|
+
loading: 'boolean',
|
|
101
|
+
errors: 'string[]',
|
|
102
|
+
warnings: 'string[]',
|
|
103
|
+
successes: 'string[]',
|
|
104
|
+
feedbacks: `Array<
|
|
82
105
|
triggerType?: 'onInput' | 'onFocus' | 'onBlur'
|
|
83
106
|
type?: 'error' | 'success' | 'warning'
|
|
84
107
|
code?:
|
|
@@ -91,161 +114,320 @@ const FieldStateValueTypes = {
|
|
|
91
114
|
messages?: string[]
|
|
92
115
|
>
|
|
93
116
|
`,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
117
|
+
valid: 'boolean',
|
|
118
|
+
invalid: 'boolean',
|
|
119
|
+
pattern: "'editable' | 'disabled' | 'readOnly' | 'readPretty'",
|
|
120
|
+
display: "'visible' | 'hidden' | 'none'",
|
|
121
|
+
disabled: 'boolean',
|
|
122
|
+
readOnly: 'boolean',
|
|
123
|
+
readPretty: 'boolean',
|
|
124
|
+
visible: 'boolean',
|
|
125
|
+
hidden: 'boolean',
|
|
126
|
+
editable: 'boolean',
|
|
127
|
+
validateStatus: "'error' | 'warning' | 'success' | 'validating'",
|
|
128
|
+
validating: 'boolean',
|
|
129
|
+
}
|
|
107
130
|
export const ReactionsSetter = (props) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
const [modalVisible, setModalVisible] = useState(false)
|
|
132
|
+
const [innerVisible, setInnerVisible] = useState(false)
|
|
133
|
+
const prefix = usePrefix('reactions-setter')
|
|
134
|
+
const form = useMemo(() => {
|
|
135
|
+
return createForm({
|
|
136
|
+
values: clone(props.value),
|
|
137
|
+
})
|
|
138
|
+
}, [modalVisible, props.value])
|
|
139
|
+
const formCollapse = useMemo(
|
|
140
|
+
() => FormCollapse.createFormCollapse(['deps', 'state']),
|
|
141
|
+
[modalVisible]
|
|
142
|
+
)
|
|
143
|
+
const openModal = () => setModalVisible(true)
|
|
144
|
+
const closeModal = () => setModalVisible(false)
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (modalVisible) {
|
|
147
|
+
requestIdle(
|
|
148
|
+
() => {
|
|
149
|
+
initDeclaration().then(() => {
|
|
150
|
+
setInnerVisible(true)
|
|
151
|
+
})
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
timeout: 400,
|
|
128
155
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
156
|
+
)
|
|
157
|
+
} else {
|
|
158
|
+
setInnerVisible(false)
|
|
159
|
+
}
|
|
160
|
+
}, [modalVisible])
|
|
161
|
+
return _jsxs(_Fragment, {
|
|
162
|
+
children: [
|
|
163
|
+
_jsx(Button, {
|
|
164
|
+
block: true,
|
|
165
|
+
onClick: openModal,
|
|
166
|
+
children: _jsx(TextWidget, {
|
|
167
|
+
token: 'SettingComponents.ReactionsSetter.configureReactions',
|
|
168
|
+
}),
|
|
169
|
+
}),
|
|
170
|
+
_jsx(Modal, {
|
|
171
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
172
|
+
'SettingComponents.ReactionsSetter.configureReactions'
|
|
173
|
+
),
|
|
174
|
+
width: '70%',
|
|
175
|
+
centered: true,
|
|
176
|
+
styles: { body: { padding: 10 } },
|
|
177
|
+
transitionName: '',
|
|
178
|
+
maskTransitionName: '',
|
|
179
|
+
open: modalVisible,
|
|
180
|
+
onCancel: closeModal,
|
|
181
|
+
destroyOnHidden: true,
|
|
182
|
+
onOk: () => {
|
|
183
|
+
form.submit((values) => {
|
|
184
|
+
props.onChange?.(values)
|
|
185
|
+
})
|
|
186
|
+
closeModal()
|
|
187
|
+
},
|
|
188
|
+
children: _jsx('div', {
|
|
189
|
+
className: prefix,
|
|
190
|
+
children:
|
|
191
|
+
innerVisible &&
|
|
192
|
+
_jsx(Form, {
|
|
193
|
+
form: form,
|
|
194
|
+
children: _jsx(SchemaField, {
|
|
195
|
+
children: _jsxs(SchemaField.Void, {
|
|
196
|
+
'x-component': 'FormCollapse',
|
|
197
|
+
'x-component-props': {
|
|
198
|
+
formCollapse,
|
|
199
|
+
defaultActiveKey: ['deps', 'state'],
|
|
200
|
+
style: { marginBottom: 10 },
|
|
201
|
+
},
|
|
202
|
+
children: [
|
|
203
|
+
_jsx(SchemaField.Void, {
|
|
204
|
+
'x-component': 'FormCollapse.CollapsePanel',
|
|
205
|
+
'x-component-props': {
|
|
206
|
+
key: 'deps',
|
|
207
|
+
header: GlobalRegistry.getDesignerMessage(
|
|
208
|
+
'SettingComponents.ReactionsSetter.relationsFields'
|
|
209
|
+
),
|
|
210
|
+
},
|
|
211
|
+
children: _jsxs(SchemaField.Array, {
|
|
212
|
+
name: 'dependencies',
|
|
213
|
+
default: [{}],
|
|
214
|
+
'x-component': 'ArrayTable',
|
|
215
|
+
children: [
|
|
216
|
+
_jsxs(SchemaField.Object, {
|
|
217
|
+
children: [
|
|
218
|
+
_jsx(SchemaField.Void, {
|
|
219
|
+
'x-component': 'ArrayTable.Column',
|
|
220
|
+
'x-component-props': {
|
|
221
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
222
|
+
'SettingComponents.ReactionsSetter.sourceField'
|
|
223
|
+
),
|
|
224
|
+
width: 240,
|
|
225
|
+
},
|
|
226
|
+
children: _jsx(SchemaField.String, {
|
|
227
|
+
name: 'source',
|
|
228
|
+
'x-decorator': 'FormItem',
|
|
229
|
+
'x-component': 'PathSelector',
|
|
230
|
+
'x-component-props': {
|
|
231
|
+
placeholder:
|
|
232
|
+
GlobalRegistry.getDesignerMessage(
|
|
233
|
+
'SettingComponents.ReactionsSetter.pleaseSelect'
|
|
234
|
+
),
|
|
235
|
+
},
|
|
236
|
+
}),
|
|
237
|
+
}),
|
|
238
|
+
_jsx(SchemaField.Void, {
|
|
239
|
+
'x-component': 'ArrayTable.Column',
|
|
240
|
+
'x-component-props': {
|
|
241
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
242
|
+
'SettingComponents.ReactionsSetter.sourceProperty'
|
|
243
|
+
),
|
|
244
|
+
width: 200,
|
|
245
|
+
},
|
|
246
|
+
children: _jsx(SchemaField.String, {
|
|
247
|
+
name: 'property',
|
|
248
|
+
default: 'value',
|
|
249
|
+
'x-decorator': 'FormItem',
|
|
250
|
+
'x-component': 'Select',
|
|
251
|
+
'x-component-props': { showSearch: true },
|
|
252
|
+
enum: FieldStateProperties,
|
|
253
|
+
}),
|
|
254
|
+
}),
|
|
255
|
+
_jsx(SchemaField.Void, {
|
|
256
|
+
'x-component': 'ArrayTable.Column',
|
|
257
|
+
'x-component-props': {
|
|
258
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
259
|
+
'SettingComponents.ReactionsSetter.variableName'
|
|
260
|
+
),
|
|
261
|
+
width: 200,
|
|
262
|
+
},
|
|
263
|
+
children: _jsx(SchemaField.String, {
|
|
264
|
+
name: 'name',
|
|
265
|
+
'x-decorator': 'FormItem',
|
|
266
|
+
'x-validator': {
|
|
267
|
+
pattern: /^[$_a-zA-Z]+[$_a-zA-Z0-9]*$/,
|
|
268
|
+
message: GlobalRegistry.getDesignerMessage(
|
|
269
|
+
'SettingComponents.ReactionsSetter.variableNameValidateMessage'
|
|
270
|
+
),
|
|
271
|
+
},
|
|
272
|
+
'x-component': 'Input',
|
|
273
|
+
'x-component-props': {
|
|
274
|
+
addonBefore: '$deps.',
|
|
275
|
+
placeholder:
|
|
276
|
+
GlobalRegistry.getDesignerMessage(
|
|
277
|
+
'SettingComponents.ReactionsSetter.pleaseInput'
|
|
278
|
+
),
|
|
279
|
+
},
|
|
280
|
+
'x-reactions': (field) => {
|
|
281
|
+
if (isVoidField(field)) return
|
|
282
|
+
field.query('.source').take((source) => {
|
|
283
|
+
if (isVoidField(source)) return
|
|
284
|
+
if (
|
|
285
|
+
source.value &&
|
|
286
|
+
!field.value &&
|
|
287
|
+
!field.modified
|
|
288
|
+
) {
|
|
289
|
+
field.value =
|
|
290
|
+
source.inputValues[1]?.props?.name ||
|
|
291
|
+
`v_${uid()}`
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
},
|
|
295
|
+
}),
|
|
296
|
+
}),
|
|
297
|
+
_jsx(SchemaField.Void, {
|
|
298
|
+
'x-component': 'ArrayTable.Column',
|
|
299
|
+
'x-component-props': {
|
|
300
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
301
|
+
'SettingComponents.ReactionsSetter.variableType'
|
|
302
|
+
),
|
|
303
|
+
ellipsis: {
|
|
304
|
+
showTitle: false,
|
|
305
|
+
},
|
|
306
|
+
width: 200,
|
|
307
|
+
align: 'center',
|
|
308
|
+
},
|
|
309
|
+
children: _jsx(SchemaField.String, {
|
|
310
|
+
name: 'type',
|
|
311
|
+
default: 'any',
|
|
312
|
+
'x-decorator': 'FormItem',
|
|
313
|
+
'x-component': 'TypeView',
|
|
314
|
+
'x-reactions': (field) => {
|
|
315
|
+
if (isVoidField(field)) return
|
|
316
|
+
const property = field
|
|
317
|
+
.query('.property')
|
|
318
|
+
.get('inputValues')
|
|
319
|
+
if (!property) return
|
|
320
|
+
property[0] = property[0] || 'value'
|
|
321
|
+
field.query('.source').take((source) => {
|
|
322
|
+
if (isVoidField(source)) return
|
|
323
|
+
if (source.value) {
|
|
324
|
+
if (
|
|
325
|
+
property[0] === 'value' ||
|
|
326
|
+
property[0] === 'initialValue' ||
|
|
327
|
+
property[0] === 'inputValue'
|
|
328
|
+
) {
|
|
329
|
+
field.value =
|
|
330
|
+
source.inputValues[1]?.props
|
|
331
|
+
?.type || 'any'
|
|
332
|
+
} else if (
|
|
333
|
+
property[0] === 'inputValues'
|
|
334
|
+
) {
|
|
335
|
+
field.value = `any[]`
|
|
336
|
+
} else if (property[0]) {
|
|
337
|
+
field.value =
|
|
338
|
+
FieldStateValueTypes[property[0]]
|
|
339
|
+
} else {
|
|
340
|
+
field.value = 'any'
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
})
|
|
344
|
+
},
|
|
345
|
+
}),
|
|
346
|
+
}),
|
|
347
|
+
_jsx(SchemaField.Void, {
|
|
348
|
+
'x-component': 'ArrayTable.Column',
|
|
349
|
+
'x-component-props': {
|
|
350
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
351
|
+
'SettingComponents.ReactionsSetter.operations'
|
|
352
|
+
),
|
|
353
|
+
align: 'center',
|
|
354
|
+
width: 80,
|
|
355
|
+
},
|
|
356
|
+
children: _jsx(SchemaField.Markup, {
|
|
357
|
+
type: 'void',
|
|
358
|
+
'x-component': 'ArrayTable.Remove',
|
|
359
|
+
}),
|
|
360
|
+
}),
|
|
361
|
+
],
|
|
362
|
+
}),
|
|
363
|
+
_jsx(SchemaField.Void, {
|
|
364
|
+
title: GlobalRegistry.getDesignerMessage(
|
|
365
|
+
'SettingComponents.ReactionsSetter.addRelationField'
|
|
366
|
+
),
|
|
367
|
+
'x-component': 'ArrayTable.Addition',
|
|
368
|
+
'x-component-props': { style: { marginTop: 8 } },
|
|
369
|
+
}),
|
|
370
|
+
],
|
|
371
|
+
}),
|
|
372
|
+
}),
|
|
373
|
+
_jsx(SchemaField.Void, {
|
|
374
|
+
'x-component': 'FormCollapse.CollapsePanel',
|
|
375
|
+
'x-component-props': {
|
|
376
|
+
header: GlobalRegistry.getDesignerMessage(
|
|
377
|
+
'SettingComponents.ReactionsSetter.propertyReactions'
|
|
378
|
+
),
|
|
379
|
+
key: 'state',
|
|
380
|
+
className: 'reaction-state',
|
|
381
|
+
},
|
|
382
|
+
children: _jsx(SchemaField.Markup, {
|
|
383
|
+
name: 'fulfill.state',
|
|
384
|
+
'x-component': 'FieldPropertySetter',
|
|
385
|
+
}),
|
|
386
|
+
}),
|
|
387
|
+
_jsx(SchemaField.Void, {
|
|
388
|
+
'x-component': 'FormCollapse.CollapsePanel',
|
|
389
|
+
'x-component-props': {
|
|
390
|
+
key: 'run',
|
|
391
|
+
header: GlobalRegistry.getDesignerMessage(
|
|
392
|
+
'SettingComponents.ReactionsSetter.actionReactions'
|
|
393
|
+
),
|
|
394
|
+
className: 'reaction-runner',
|
|
395
|
+
},
|
|
396
|
+
children: _jsx(SchemaField.String, {
|
|
397
|
+
name: 'fulfill.run',
|
|
398
|
+
'x-component': 'MonacoInput',
|
|
399
|
+
'x-component-props': {
|
|
400
|
+
width: '100%',
|
|
401
|
+
height: 400,
|
|
402
|
+
language: 'typescript',
|
|
403
|
+
helpCode: FulfillRunHelper,
|
|
404
|
+
options: {
|
|
405
|
+
minimap: {
|
|
406
|
+
enabled: false,
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
'x-reactions': (field) => {
|
|
411
|
+
const deps = field.query('dependencies').value()
|
|
412
|
+
if (Array.isArray(deps)) {
|
|
413
|
+
field.componentProps.extraLib = `
|
|
241
414
|
declare var $deps : {
|
|
242
415
|
${deps.map(({ name, type }) => {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
416
|
+
if (!name) return ''
|
|
417
|
+
return `${name}?:${type || 'any'},`
|
|
418
|
+
})}
|
|
419
|
+
}
|
|
420
|
+
`
|
|
247
421
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
422
|
+
},
|
|
423
|
+
}),
|
|
424
|
+
}),
|
|
425
|
+
],
|
|
426
|
+
}),
|
|
427
|
+
}),
|
|
428
|
+
}),
|
|
429
|
+
}),
|
|
430
|
+
}),
|
|
431
|
+
],
|
|
432
|
+
})
|
|
433
|
+
}
|