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