@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.
Files changed (89) hide show
  1. package/esm/components/DataSourceSetter/DataSettingPanel.d.ts +8 -8
  2. package/esm/components/DataSourceSetter/DataSettingPanel.js +124 -52
  3. package/esm/components/DataSourceSetter/Header.d.ts +5 -5
  4. package/esm/components/DataSourceSetter/Header.js +16 -7
  5. package/esm/components/DataSourceSetter/Title.d.ts +5 -5
  6. package/esm/components/DataSourceSetter/Title.js +57 -44
  7. package/esm/components/DataSourceSetter/TreePanel.d.ts +10 -10
  8. package/esm/components/DataSourceSetter/TreePanel.js +129 -89
  9. package/esm/components/DataSourceSetter/index.d.ts +16 -16
  10. package/esm/components/DataSourceSetter/index.js +81 -24
  11. package/esm/components/DataSourceSetter/shared.d.ts +14 -7
  12. package/esm/components/DataSourceSetter/shared.js +39 -41
  13. package/esm/components/DataSourceSetter/styles.less +4 -3
  14. package/esm/components/DataSourceSetter/types.d.ts +12 -12
  15. package/esm/components/DataSourceSetter/types.js +1 -1
  16. package/esm/components/ReactionsSetter/FieldPropertySetter.d.ts +6 -6
  17. package/esm/components/ReactionsSetter/FieldPropertySetter.js +140 -63
  18. package/esm/components/ReactionsSetter/PathSelector.d.ts +10 -9
  19. package/esm/components/ReactionsSetter/PathSelector.js +97 -100
  20. package/esm/components/ReactionsSetter/declarations.d.ts +3 -3
  21. package/esm/components/ReactionsSetter/declarations.js +31 -18
  22. package/esm/components/ReactionsSetter/helpers.d.ts +20 -10
  23. package/esm/components/ReactionsSetter/helpers.js +10 -10
  24. package/esm/components/ReactionsSetter/index.d.ts +6 -6
  25. package/esm/components/ReactionsSetter/index.js +412 -230
  26. package/esm/components/ReactionsSetter/properties.d.ts +14 -11
  27. package/esm/components/ReactionsSetter/properties.js +49 -40
  28. package/esm/components/ReactionsSetter/styles.less +2 -2
  29. package/esm/components/ReactionsSetter/types.d.ts +11 -11
  30. package/esm/components/ReactionsSetter/types.js +1 -1
  31. package/esm/components/ValidatorSetter/index.d.ts +4 -4
  32. package/esm/components/ValidatorSetter/index.js +148 -125
  33. package/esm/components/index.d.ts +3 -3
  34. package/esm/components/index.js +3 -3
  35. package/esm/index.d.ts +2 -2
  36. package/esm/index.js +2 -2
  37. package/esm/locales/en-US.d.ts +92 -92
  38. package/esm/locales/en-US.js +96 -93
  39. package/esm/locales/index.d.ts +1 -1
  40. package/esm/locales/index.js +5 -5
  41. package/esm/locales/ko-KR.d.ts +92 -92
  42. package/esm/locales/ko-KR.js +94 -93
  43. package/esm/locales/zh-CN.d.ts +92 -92
  44. package/esm/locales/zh-CN.js +94 -93
  45. package/lib/components/DataSourceSetter/DataSettingPanel.d.ts +8 -8
  46. package/lib/components/DataSourceSetter/DataSettingPanel.js +129 -55
  47. package/lib/components/DataSourceSetter/Header.d.ts +5 -5
  48. package/lib/components/DataSourceSetter/Header.js +19 -10
  49. package/lib/components/DataSourceSetter/Title.d.ts +5 -5
  50. package/lib/components/DataSourceSetter/Title.js +70 -47
  51. package/lib/components/DataSourceSetter/TreePanel.d.ts +10 -10
  52. package/lib/components/DataSourceSetter/TreePanel.js +134 -92
  53. package/lib/components/DataSourceSetter/index.d.ts +16 -16
  54. package/lib/components/DataSourceSetter/index.js +94 -30
  55. package/lib/components/DataSourceSetter/shared.d.ts +14 -7
  56. package/lib/components/DataSourceSetter/shared.js +48 -47
  57. package/lib/components/DataSourceSetter/styles.less +4 -3
  58. package/lib/components/DataSourceSetter/types.d.ts +12 -12
  59. package/lib/components/DataSourceSetter/types.js +2 -2
  60. package/lib/components/ReactionsSetter/FieldPropertySetter.d.ts +6 -6
  61. package/lib/components/ReactionsSetter/FieldPropertySetter.js +150 -67
  62. package/lib/components/ReactionsSetter/PathSelector.d.ts +10 -9
  63. package/lib/components/ReactionsSetter/PathSelector.js +101 -104
  64. package/lib/components/ReactionsSetter/declarations.d.ts +3 -3
  65. package/lib/components/ReactionsSetter/declarations.js +35 -22
  66. package/lib/components/ReactionsSetter/helpers.d.ts +20 -10
  67. package/lib/components/ReactionsSetter/helpers.js +23 -13
  68. package/lib/components/ReactionsSetter/index.d.ts +6 -6
  69. package/lib/components/ReactionsSetter/index.js +434 -234
  70. package/lib/components/ReactionsSetter/properties.d.ts +14 -11
  71. package/lib/components/ReactionsSetter/properties.js +43 -43
  72. package/lib/components/ReactionsSetter/styles.less +2 -2
  73. package/lib/components/ReactionsSetter/types.d.ts +11 -11
  74. package/lib/components/ReactionsSetter/types.js +2 -2
  75. package/lib/components/ValidatorSetter/index.d.ts +4 -4
  76. package/lib/components/ValidatorSetter/index.js +151 -128
  77. package/lib/components/index.d.ts +3 -3
  78. package/lib/components/index.js +35 -19
  79. package/lib/index.d.ts +2 -2
  80. package/lib/index.js +34 -18
  81. package/lib/locales/en-US.d.ts +92 -92
  82. package/lib/locales/en-US.js +98 -95
  83. package/lib/locales/index.d.ts +1 -1
  84. package/lib/locales/index.js +16 -10
  85. package/lib/locales/ko-KR.d.ts +92 -92
  86. package/lib/locales/ko-KR.js +96 -95
  87. package/lib/locales/zh-CN.d.ts +92 -92
  88. package/lib/locales/zh-CN.js +96 -95
  89. package/package.json +5 -5
@@ -1,27 +1,84 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment, useMemo, useState } from 'react';
3
- import cls from 'classnames';
4
- import { Modal, Button } from 'antd';
5
- import { observable } from '@formily/reactive';
6
- import { observer } from '@formily/reactive-react';
7
- import { usePrefix, useTheme, TextWidget } from '@thienvu18/designable-react';
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
- const { className, value = [], onChange, allowTree = true, allowExtendOption = true, defaultOptionValue, effects = () => { }, } = props;
14
- const theme = useTheme();
15
- const prefix = usePrefix('data-source-setter');
16
- const [modalVisible, setModalVisible] = useState(false);
17
- const treeDataSource = useMemo(() => observable({
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
- }), [value, modalVisible]);
21
- const openModal = () => setModalVisible(true);
22
- const closeModal = () => setModalVisible(false);
23
- return (_jsxs(Fragment, { children: [_jsx(Button, { block: true, onClick: openModal, children: _jsx(TextWidget, { token: "SettingComponents.DataSourceSetter.configureDataSource" }) }), _jsx(Modal, { title: _jsx(TextWidget, { token: "SettingComponents.DataSourceSetter.configureDataSource" }), width: "65%", styles: { body: { padding: 10 } }, transitionName: "", maskTransitionName: "", open: modalVisible, onCancel: closeModal, onOk: () => {
24
- onChange(transformDataToValue(treeDataSource.dataSource));
25
- closeModal();
26
- }, children: _jsxs("div", { className: `${cls(prefix, className)} ${prefix + '-' + theme} ${prefix + '-layout'}`, children: [_jsx("div", { className: `${prefix + '-layout-item left'}`, children: _jsx(TreePanel, { defaultOptionValue: defaultOptionValue, allowTree: allowTree, treeDataSource: treeDataSource }) }), _jsx("div", { className: `${prefix + '-layout-item right'}`, children: _jsx(DataSettingPanel, { allowExtendOption: allowExtendOption, treeDataSource: treeDataSource, effects: effects }) })] }) })] }));
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
- key?: string;
4
- map?: any;
5
- children?: INode[];
3
+ key?: string
4
+ map?: any
5
+ children?: INode[]
6
6
  }
7
- export declare const traverseTree: <T extends INode>(data: T[], callback: (dataItem: T, i: number, data: T[]) => any) => void;
8
- export declare const transformValueToData: (value: IDataSourceItem[]) => INodeItem[];
9
- export declare const transformDataToValue: (data: INodeItem[]) => IDataSourceItem[];
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 { uid, clone, toArr } from '@formily/shared';
1
+ import { clone, toArr, uid } from '@formily/shared'
2
2
  export const traverseTree = (data, callback) => {
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);
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
- 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')
21
- dataItem.map.push({ label: key, value: value });
22
- }
23
- const uuid = uid();
24
- dataItem.key = uuid;
25
- dataItem.duplicateKey = uuid;
26
- dataItem.children = dataSource[i].children || [];
27
- dataSource[i] = dataItem;
28
- });
29
- return data;
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
- const value = clone(data);
33
- traverseTree(value, (item, i, dataSource) => {
34
- const valueItem = {
35
- children: [],
36
- };
37
- toArr(dataSource[i].map).forEach((item) => {
38
- if (item.label)
39
- valueItem[item.label] = item.value;
40
- });
41
- valueItem.children = dataSource[i]?.children || [];
42
- dataSource[i] = valueItem;
43
- });
44
- return value;
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 var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
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 var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
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
- label?: '';
3
- value?: any;
4
- children?: any[];
2
+ label?: ''
3
+ value?: any
4
+ children?: any[]
5
5
  }
6
6
  export interface INodeItem {
7
- key: string;
8
- duplicateKey?: string;
9
- map?: {
10
- label: string;
11
- value: any;
12
- }[];
13
- children?: INodeItem[];
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
- dataSource: INodeItem[];
17
- selectedKey: string;
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
- [key: string]: string;
3
+ [key: string]: string
4
4
  }
5
5
  export interface IFieldPropertySetterProps {
6
- extraLib?: string;
7
- value?: IFieldProperty;
8
- onChange?: (value: IFieldProperty) => void;
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { TextWidget, usePrefix } from '@thienvu18/designable-react';
4
- import { Menu } from 'antd';
5
- import { MonacoInput } from '@thienvu18/designable-react-settings-form';
6
- import { isPlainObj, reduce } from '@formily/shared';
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
- if (!code)
10
- return;
11
- return code.trim();
12
- };
9
+ if (!code) return
10
+ return code.trim()
11
+ }
13
12
  export const FieldPropertySetter = (props) => {
14
- const [selectKeys, setSelectKeys] = useState(['visible']);
15
- const prefix = usePrefix('field-property-setter');
16
- const value = { ...props.value };
17
- const parseExpression = (expression) => {
18
- if (!expression)
19
- return '';
20
- return String(expression).match(/^\{\{([\s\S]*)\}\}$/)?.[1] || '';
21
- };
22
- const filterEmpty = (value) => {
23
- return reduce(value, (buf, value, key) => {
24
- if (!value || value === '{{}}')
25
- return buf;
26
- buf[key] = value;
27
- return buf;
28
- }, {});
29
- };
30
- const currentProperty = FieldProperties.find((item) => item.key === selectKeys[0]);
31
- return (_jsxs("div", { className: prefix, children: [_jsx(Menu, { mode: "vertical", style: {
32
- width: 200,
33
- height: 300,
34
- paddingRight: 4,
35
- overflowY: 'auto',
36
- overflowX: 'hidden',
37
- }, defaultSelectedKeys: selectKeys, selectedKeys: selectKeys, onSelect: ({ selectedKeys }) => {
38
- setSelectKeys(selectedKeys);
39
- }, children: FieldProperties.map((key) => {
40
- if (isPlainObj(key)) {
41
- return (_jsx(Menu.Item, { children: _jsx(TextWidget, { token: `SettingComponents.ReactionsSetter.${key.token || key.key}` }) }, key.key));
42
- }
43
- return (_jsx(Menu.Item, { children: _jsx(TextWidget, { token: `SettingComponents.ReactionsSetter.${key}` }) }, key));
44
- }) }), _jsxs("div", { className: prefix + '-coder-wrapper', children: [_jsxs("div", { className: prefix + '-coder-start', children: [`$self.${selectKeys[0]} = (`, _jsxs("span", { style: {
45
- fontSize: 14,
46
- marginLeft: 10,
47
- color: '#888',
48
- fontWeight: 'normal',
49
- }, children: ['//', ' ', _jsx(TextWidget, { token: "SettingComponents.ReactionsSetter.expressionValueTypeIs" }), ' ', '`', currentProperty?.type, '`'] })] }), _jsx("div", { className: prefix + '-coder', children: _jsx(MonacoInput, { language: "javascript.expression", extraLib: props.extraLib, helpCode: template(currentProperty?.helpCode), value: parseExpression(value[selectKeys[0]]), options: {
50
- lineNumbers: 'off',
51
- wordWrap: 'on',
52
- glyphMargin: false,
53
- folding: false,
54
- lineDecorationsWidth: 0,
55
- lineNumbersMinChars: 0,
56
- minimap: {
57
- enabled: false,
58
- },
59
- }, onChange: (expression) => {
60
- props.onChange?.(filterEmpty({
61
- ...value,
62
- [selectKeys[0]]: `{{${expression}}}`,
63
- }));
64
- } }, selectKeys[0]) }), _jsx("div", { className: prefix + '-coder-end', children: `)` })] })] }));
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 React from 'react';
2
- import { TreeNode } from '@thienvu18/designable-core';
3
- import { TreeSelectProps } from 'antd';
4
- export interface IPathSelectorProps extends Omit<TreeSelectProps<any>, 'onChange'> {
5
- value?: string;
6
- onChange?: (value: string, node: TreeNode) => void;
7
- style?: React.CSSProperties;
8
- className?: string;
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>