@thienvu18/designable-formily-setters 2.0.1 → 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 +5 -5
|
@@ -1,27 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DataSettingPanel } from './DataSettingPanel'
|
|
9
|
-
import { TreePanel } from './TreePanel'
|
|
10
|
-
import { transformDataToValue, transformValueToData } from './shared'
|
|
11
|
-
import './styles.less'
|
|
1
|
+
import { observable } from '@formily/reactive'
|
|
2
|
+
import { observer } from '@formily/reactive-react'
|
|
3
|
+
import { TextWidget, usePrefix, useTheme } from '@thienvu18/designable-react'
|
|
4
|
+
import { Button, Modal } from 'antd'
|
|
5
|
+
import cls from 'classnames'
|
|
6
|
+
import { Fragment, useMemo, useState } from 'react'
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
|
|
8
|
+
import { DataSettingPanel } from './DataSettingPanel'
|
|
9
|
+
import { TreePanel } from './TreePanel'
|
|
10
|
+
import { transformDataToValue, transformValueToData } from './shared'
|
|
11
|
+
import './styles.less'
|
|
12
12
|
export const DataSourceSetter = observer((props) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const {
|
|
14
|
+
className,
|
|
15
|
+
value = [],
|
|
16
|
+
onChange,
|
|
17
|
+
allowTree = true,
|
|
18
|
+
allowExtendOption = true,
|
|
19
|
+
defaultOptionValue,
|
|
20
|
+
effects = () => {},
|
|
21
|
+
} = props
|
|
22
|
+
const theme = useTheme()
|
|
23
|
+
const prefix = usePrefix('data-source-setter')
|
|
24
|
+
const [modalVisible, setModalVisible] = useState(false)
|
|
25
|
+
const treeDataSource = useMemo(
|
|
26
|
+
() =>
|
|
27
|
+
observable({
|
|
18
28
|
dataSource: transformValueToData(value),
|
|
19
29
|
selectedKey: '',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
}),
|
|
31
|
+
[value, modalVisible]
|
|
32
|
+
)
|
|
33
|
+
const openModal = () => setModalVisible(true)
|
|
34
|
+
const closeModal = () => setModalVisible(false)
|
|
35
|
+
return _jsxs(Fragment, {
|
|
36
|
+
children: [
|
|
37
|
+
_jsx(Button, {
|
|
38
|
+
block: true,
|
|
39
|
+
onClick: openModal,
|
|
40
|
+
children: _jsx(TextWidget, {
|
|
41
|
+
token: 'SettingComponents.DataSourceSetter.configureDataSource',
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
_jsx(Modal, {
|
|
45
|
+
title: _jsx(TextWidget, {
|
|
46
|
+
token: 'SettingComponents.DataSourceSetter.configureDataSource',
|
|
47
|
+
}),
|
|
48
|
+
width: '65%',
|
|
49
|
+
styles: { body: { padding: 10 } },
|
|
50
|
+
transitionName: '',
|
|
51
|
+
maskTransitionName: '',
|
|
52
|
+
open: modalVisible,
|
|
53
|
+
onCancel: closeModal,
|
|
54
|
+
onOk: () => {
|
|
55
|
+
onChange(transformDataToValue(treeDataSource.dataSource))
|
|
56
|
+
closeModal()
|
|
57
|
+
},
|
|
58
|
+
children: _jsxs('div', {
|
|
59
|
+
className: `${cls(prefix, className)} ${prefix + '-' + theme} ${
|
|
60
|
+
prefix + '-layout'
|
|
61
|
+
}`,
|
|
62
|
+
children: [
|
|
63
|
+
_jsx('div', {
|
|
64
|
+
className: `${prefix + '-layout-item left'}`,
|
|
65
|
+
children: _jsx(TreePanel, {
|
|
66
|
+
defaultOptionValue: defaultOptionValue,
|
|
67
|
+
allowTree: allowTree,
|
|
68
|
+
treeDataSource: treeDataSource,
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
_jsx('div', {
|
|
72
|
+
className: `${prefix + '-layout-item right'}`,
|
|
73
|
+
children: _jsx(DataSettingPanel, {
|
|
74
|
+
allowExtendOption: allowExtendOption,
|
|
75
|
+
treeDataSource: treeDataSource,
|
|
76
|
+
effects: effects,
|
|
77
|
+
}),
|
|
78
|
+
}),
|
|
79
|
+
],
|
|
80
|
+
}),
|
|
81
|
+
}),
|
|
82
|
+
],
|
|
83
|
+
})
|
|
84
|
+
})
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { IDataSourceItem, INodeItem } from './types'
|
|
1
|
+
import { IDataSourceItem, INodeItem } from './types'
|
|
2
2
|
export interface INode {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
key?: string
|
|
4
|
+
map?: any
|
|
5
|
+
children?: INode[]
|
|
6
6
|
}
|
|
7
|
-
export declare const traverseTree: <T extends INode>(
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export declare const traverseTree: <T extends INode>(
|
|
8
|
+
data: T[],
|
|
9
|
+
callback: (dataItem: T, i: number, data: T[]) => any
|
|
10
|
+
) => void
|
|
11
|
+
export declare const transformValueToData: (
|
|
12
|
+
value: IDataSourceItem[]
|
|
13
|
+
) => INodeItem[]
|
|
14
|
+
export declare const transformDataToValue: (
|
|
15
|
+
data: INodeItem[]
|
|
16
|
+
) => IDataSourceItem[]
|
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clone, toArr, uid } from '@formily/shared'
|
|
2
2
|
export const traverseTree = (data, callback) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
for (let i = 0; i < data.length; i++) {
|
|
4
|
+
callback(data[i], i, data)
|
|
5
|
+
if (data[i]?.children) {
|
|
6
|
+
traverseTree(data[i]?.children, callback)
|
|
8
7
|
}
|
|
9
|
-
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
10
|
export const transformValueToData = (value) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
11
|
+
const data = clone(value)
|
|
12
|
+
traverseTree(data, (item, i, dataSource) => {
|
|
13
|
+
const dataItem = {
|
|
14
|
+
key: '',
|
|
15
|
+
duplicateKey: '',
|
|
16
|
+
map: [],
|
|
17
|
+
children: [],
|
|
18
|
+
}
|
|
19
|
+
for (const [key, value] of Object.entries(dataSource[i] || {})) {
|
|
20
|
+
if (key !== 'children') dataItem.map.push({ label: key, value: value })
|
|
21
|
+
}
|
|
22
|
+
const uuid = uid()
|
|
23
|
+
dataItem.key = uuid
|
|
24
|
+
dataItem.duplicateKey = uuid
|
|
25
|
+
dataItem.children = dataSource[i].children || []
|
|
26
|
+
dataSource[i] = dataItem
|
|
27
|
+
})
|
|
28
|
+
return data
|
|
29
|
+
}
|
|
31
30
|
export const transformDataToValue = (data) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
31
|
+
const value = clone(data)
|
|
32
|
+
traverseTree(value, (item, i, dataSource) => {
|
|
33
|
+
const valueItem = {
|
|
34
|
+
children: [],
|
|
35
|
+
}
|
|
36
|
+
toArr(dataSource[i].map).forEach((item) => {
|
|
37
|
+
if (item.label) valueItem[item.label] = item.value
|
|
38
|
+
})
|
|
39
|
+
valueItem.children = dataSource[i]?.children || []
|
|
40
|
+
dataSource[i] = valueItem
|
|
41
|
+
})
|
|
42
|
+
return value
|
|
43
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
.dn-data-source-setter {
|
|
3
2
|
::-webkit-scrollbar {
|
|
4
3
|
width: 5px;
|
|
@@ -51,7 +50,8 @@
|
|
|
51
50
|
|
|
52
51
|
&.left {
|
|
53
52
|
width: 40%;
|
|
54
|
-
border-right: 1px solid
|
|
53
|
+
border-right: 1px solid
|
|
54
|
+
var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
&.right {
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
justify-content: space-between;
|
|
66
66
|
height: 40px;
|
|
67
67
|
padding: 8px 12px 9px;
|
|
68
|
-
border-bottom: 1px solid
|
|
68
|
+
border-bottom: 1px solid
|
|
69
|
+
var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
|
|
69
70
|
border-radius: 2px 2px 0 0;
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export interface IDataSourceItem {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
label?: ''
|
|
3
|
+
value?: any
|
|
4
|
+
children?: any[]
|
|
5
5
|
}
|
|
6
6
|
export interface INodeItem {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
key: string
|
|
8
|
+
duplicateKey?: string
|
|
9
|
+
map?: {
|
|
10
|
+
label: string
|
|
11
|
+
value: any
|
|
12
|
+
}[]
|
|
13
|
+
children?: INodeItem[]
|
|
14
14
|
}
|
|
15
15
|
export interface ITreeDataSource {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
dataSource: INodeItem[]
|
|
17
|
+
selectedKey: string
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
export interface IFieldProperty {
|
|
3
|
-
|
|
3
|
+
[key: string]: string
|
|
4
4
|
}
|
|
5
5
|
export interface IFieldPropertySetterProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
extraLib?: string
|
|
7
|
+
value?: IFieldProperty
|
|
8
|
+
onChange?: (value: IFieldProperty) => void
|
|
9
9
|
}
|
|
10
|
-
export declare const FieldPropertySetter: React.FC<IFieldPropertySetterProps
|
|
10
|
+
export declare const FieldPropertySetter: React.FC<IFieldPropertySetterProps>
|
|
@@ -1,65 +1,142 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Menu } from 'antd'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { FieldProperties } from './properties'
|
|
1
|
+
import { isPlainObj, reduce } from '@formily/shared'
|
|
2
|
+
import { TextWidget, usePrefix } from '@thienvu18/designable-react'
|
|
3
|
+
import { MonacoInput } from '@thienvu18/designable-react-settings-form'
|
|
4
|
+
import { Menu } from 'antd'
|
|
5
|
+
import { useState } from 'react'
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
|
|
7
|
+
import { FieldProperties } from './properties'
|
|
8
8
|
const template = (code) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
9
|
+
if (!code) return
|
|
10
|
+
return code.trim()
|
|
11
|
+
}
|
|
13
12
|
export const FieldPropertySetter = (props) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
}
|
|
13
|
+
const [selectKeys, setSelectKeys] = useState(['visible'])
|
|
14
|
+
const prefix = usePrefix('field-property-setter')
|
|
15
|
+
const value = { ...props.value }
|
|
16
|
+
const parseExpression = (expression) => {
|
|
17
|
+
if (!expression) return ''
|
|
18
|
+
return String(expression).match(/^\{\{([\s\S]*)\}\}$/)?.[1] || ''
|
|
19
|
+
}
|
|
20
|
+
const filterEmpty = (value) => {
|
|
21
|
+
return reduce(
|
|
22
|
+
value,
|
|
23
|
+
(buf, value, key) => {
|
|
24
|
+
if (!value || value === '{{}}') return buf
|
|
25
|
+
buf[key] = value
|
|
26
|
+
return buf
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
const currentProperty = FieldProperties.find(
|
|
32
|
+
(item) => item.key === selectKeys[0]
|
|
33
|
+
)
|
|
34
|
+
return _jsxs('div', {
|
|
35
|
+
className: prefix,
|
|
36
|
+
children: [
|
|
37
|
+
_jsx(Menu, {
|
|
38
|
+
mode: 'vertical',
|
|
39
|
+
style: {
|
|
40
|
+
width: 200,
|
|
41
|
+
height: 300,
|
|
42
|
+
paddingRight: 4,
|
|
43
|
+
overflowY: 'auto',
|
|
44
|
+
overflowX: 'hidden',
|
|
45
|
+
},
|
|
46
|
+
defaultSelectedKeys: selectKeys,
|
|
47
|
+
selectedKeys: selectKeys,
|
|
48
|
+
onSelect: ({ selectedKeys }) => {
|
|
49
|
+
setSelectKeys(selectedKeys)
|
|
50
|
+
},
|
|
51
|
+
children: FieldProperties.map((key) => {
|
|
52
|
+
if (isPlainObj(key)) {
|
|
53
|
+
return _jsx(
|
|
54
|
+
Menu.Item,
|
|
55
|
+
{
|
|
56
|
+
children: _jsx(TextWidget, {
|
|
57
|
+
token: `SettingComponents.ReactionsSetter.${
|
|
58
|
+
key.token || key.key
|
|
59
|
+
}`,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
key.key
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
return _jsx(
|
|
66
|
+
Menu.Item,
|
|
67
|
+
{
|
|
68
|
+
children: _jsx(TextWidget, {
|
|
69
|
+
token: `SettingComponents.ReactionsSetter.${key}`,
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
key
|
|
73
|
+
)
|
|
74
|
+
}),
|
|
75
|
+
}),
|
|
76
|
+
_jsxs('div', {
|
|
77
|
+
className: prefix + '-coder-wrapper',
|
|
78
|
+
children: [
|
|
79
|
+
_jsxs('div', {
|
|
80
|
+
className: prefix + '-coder-start',
|
|
81
|
+
children: [
|
|
82
|
+
`$self.${selectKeys[0]} = (`,
|
|
83
|
+
_jsxs('span', {
|
|
84
|
+
style: {
|
|
85
|
+
fontSize: 14,
|
|
86
|
+
marginLeft: 10,
|
|
87
|
+
color: '#888',
|
|
88
|
+
fontWeight: 'normal',
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
'//',
|
|
92
|
+
' ',
|
|
93
|
+
_jsx(TextWidget, {
|
|
94
|
+
token:
|
|
95
|
+
'SettingComponents.ReactionsSetter.expressionValueTypeIs',
|
|
96
|
+
}),
|
|
97
|
+
' ',
|
|
98
|
+
'`',
|
|
99
|
+
currentProperty?.type,
|
|
100
|
+
'`',
|
|
101
|
+
],
|
|
102
|
+
}),
|
|
103
|
+
],
|
|
104
|
+
}),
|
|
105
|
+
_jsx('div', {
|
|
106
|
+
className: prefix + '-coder',
|
|
107
|
+
children: _jsx(
|
|
108
|
+
MonacoInput,
|
|
109
|
+
{
|
|
110
|
+
language: 'javascript.expression',
|
|
111
|
+
extraLib: props.extraLib,
|
|
112
|
+
helpCode: template(currentProperty?.helpCode),
|
|
113
|
+
value: parseExpression(value[selectKeys[0]]),
|
|
114
|
+
options: {
|
|
115
|
+
lineNumbers: 'off',
|
|
116
|
+
wordWrap: 'on',
|
|
117
|
+
glyphMargin: false,
|
|
118
|
+
folding: false,
|
|
119
|
+
lineDecorationsWidth: 0,
|
|
120
|
+
lineNumbersMinChars: 0,
|
|
121
|
+
minimap: {
|
|
122
|
+
enabled: false,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
onChange: (expression) => {
|
|
126
|
+
props.onChange?.(
|
|
127
|
+
filterEmpty({
|
|
128
|
+
...value,
|
|
129
|
+
[selectKeys[0]]: `{{${expression}}}`,
|
|
130
|
+
})
|
|
131
|
+
)
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
selectKeys[0]
|
|
135
|
+
),
|
|
136
|
+
}),
|
|
137
|
+
_jsx('div', { className: prefix + '-coder-end', children: `)` }),
|
|
138
|
+
],
|
|
139
|
+
}),
|
|
140
|
+
],
|
|
141
|
+
})
|
|
142
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
export interface IPathSelectorProps
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { TreeNode } from '@thienvu18/designable-core'
|
|
2
|
+
import { TreeSelectProps } from 'antd'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
export interface IPathSelectorProps
|
|
5
|
+
extends Omit<TreeSelectProps<any>, 'onChange'> {
|
|
6
|
+
value?: string
|
|
7
|
+
onChange?: (value: string, node: TreeNode) => void
|
|
8
|
+
style?: React.CSSProperties
|
|
9
|
+
className?: string
|
|
9
10
|
}
|
|
10
|
-
export declare const PathSelector: React.FC<IPathSelectorProps
|
|
11
|
+
export declare const PathSelector: React.FC<IPathSelectorProps>
|