@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,107 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.PathSelector = void 0
|
|
4
|
-
const jsx_runtime_1 = require(
|
|
5
|
-
const designable_react_1 = require(
|
|
6
|
-
const antd_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.PathSelector = void 0
|
|
4
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
5
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
6
|
+
const antd_1 = require('antd')
|
|
7
7
|
const transformDataSource = (node) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return dots;
|
|
15
|
-
};
|
|
16
|
-
const targetPath = (parentNode, targetNode) => {
|
|
17
|
-
const path = [];
|
|
18
|
-
const transform = (node) => {
|
|
19
|
-
if (node && node !== parentNode) {
|
|
20
|
-
path.push(node.props.name || node.id);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
transform(node.parent);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
transform(targetNode);
|
|
27
|
-
return path.reverse().join('.');
|
|
28
|
-
};
|
|
29
|
-
const hasNoVoidChildren = (node) => {
|
|
30
|
-
return node.children?.some((node) => {
|
|
31
|
-
if (node.props.type !== 'void' && node !== currentNode)
|
|
32
|
-
return true;
|
|
33
|
-
return hasNoVoidChildren(node);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const findRoot = (node) => {
|
|
37
|
-
if (!node?.parent)
|
|
38
|
-
return node;
|
|
39
|
-
if (node?.parent?.componentName !== node.componentName)
|
|
40
|
-
return node.parent;
|
|
41
|
-
return findRoot(node.parent);
|
|
42
|
-
};
|
|
43
|
-
const findArrayParent = (node) => {
|
|
44
|
-
if (!node?.parent)
|
|
45
|
-
return;
|
|
46
|
-
if (node.parent.props.type === 'array')
|
|
47
|
-
return node.parent;
|
|
48
|
-
if (node.parent === root)
|
|
49
|
-
return;
|
|
50
|
-
return findArrayParent(node.parent);
|
|
51
|
-
};
|
|
52
|
-
const transformRelativePath = (arrayNode, targetNode) => {
|
|
53
|
-
if (targetNode.depth === currentNode.depth)
|
|
54
|
-
return `.${targetNode.props.name || targetNode.id}`;
|
|
55
|
-
return `${dots(currentNode.depth - arrayNode.depth)}[].${targetPath(arrayNode, targetNode)}`;
|
|
56
|
-
};
|
|
57
|
-
const transformChildren = (children, path = []) => {
|
|
58
|
-
return children.reduce((buf, node) => {
|
|
59
|
-
if (node === currentNode)
|
|
60
|
-
return buf;
|
|
61
|
-
if (node.props.type === 'array' && !node.contains(currentNode))
|
|
62
|
-
return buf;
|
|
63
|
-
if (node.props.type === 'void' && !hasNoVoidChildren(node))
|
|
64
|
-
return buf;
|
|
65
|
-
const currentPath = path.concat(node.props.name || node.id);
|
|
66
|
-
const arrayNode = findArrayParent(node);
|
|
67
|
-
const label = node.props.title ||
|
|
68
|
-
node.props['x-component-props']?.title ||
|
|
69
|
-
node.props.name ||
|
|
70
|
-
node.designerProps.title;
|
|
71
|
-
const value = arrayNode
|
|
72
|
-
? transformRelativePath(arrayNode, node)
|
|
73
|
-
: currentPath.join('.');
|
|
74
|
-
return buf.concat({
|
|
75
|
-
label,
|
|
76
|
-
value,
|
|
77
|
-
node,
|
|
78
|
-
children: transformChildren(node.children, currentPath),
|
|
79
|
-
});
|
|
80
|
-
}, []);
|
|
81
|
-
};
|
|
82
|
-
const root = findRoot(node);
|
|
83
|
-
if (root) {
|
|
84
|
-
return transformChildren(root.children);
|
|
8
|
+
const currentNode = node
|
|
9
|
+
const dots = (count) => {
|
|
10
|
+
let dots = ''
|
|
11
|
+
for (let i = 0; i < count; i++) {
|
|
12
|
+
dots += '.'
|
|
85
13
|
}
|
|
86
|
-
return
|
|
87
|
-
}
|
|
14
|
+
return dots
|
|
15
|
+
}
|
|
16
|
+
const targetPath = (parentNode, targetNode) => {
|
|
17
|
+
const path = []
|
|
18
|
+
const transform = (node) => {
|
|
19
|
+
if (node && node !== parentNode) {
|
|
20
|
+
path.push(node.props.name || node.id)
|
|
21
|
+
} else {
|
|
22
|
+
transform(node.parent)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
transform(targetNode)
|
|
26
|
+
return path.reverse().join('.')
|
|
27
|
+
}
|
|
28
|
+
const hasNoVoidChildren = (node) => {
|
|
29
|
+
return node.children?.some((node) => {
|
|
30
|
+
if (node.props.type !== 'void' && node !== currentNode) return true
|
|
31
|
+
return hasNoVoidChildren(node)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
const findRoot = (node) => {
|
|
35
|
+
if (!node?.parent) return node
|
|
36
|
+
if (node?.parent?.componentName !== node.componentName) return node.parent
|
|
37
|
+
return findRoot(node.parent)
|
|
38
|
+
}
|
|
39
|
+
const findArrayParent = (node) => {
|
|
40
|
+
if (!node?.parent) return
|
|
41
|
+
if (node.parent.props.type === 'array') return node.parent
|
|
42
|
+
if (node.parent === root) return
|
|
43
|
+
return findArrayParent(node.parent)
|
|
44
|
+
}
|
|
45
|
+
const transformRelativePath = (arrayNode, targetNode) => {
|
|
46
|
+
if (targetNode.depth === currentNode.depth)
|
|
47
|
+
return `.${targetNode.props.name || targetNode.id}`
|
|
48
|
+
return `${dots(currentNode.depth - arrayNode.depth)}[].${targetPath(
|
|
49
|
+
arrayNode,
|
|
50
|
+
targetNode
|
|
51
|
+
)}`
|
|
52
|
+
}
|
|
53
|
+
const transformChildren = (children, path = []) => {
|
|
54
|
+
return children.reduce((buf, node) => {
|
|
55
|
+
if (node === currentNode) return buf
|
|
56
|
+
if (node.props.type === 'array' && !node.contains(currentNode)) return buf
|
|
57
|
+
if (node.props.type === 'void' && !hasNoVoidChildren(node)) return buf
|
|
58
|
+
const currentPath = path.concat(node.props.name || node.id)
|
|
59
|
+
const arrayNode = findArrayParent(node)
|
|
60
|
+
const label =
|
|
61
|
+
node.props.title ||
|
|
62
|
+
node.props['x-component-props']?.title ||
|
|
63
|
+
node.props.name ||
|
|
64
|
+
node.designerProps.title
|
|
65
|
+
const value = arrayNode
|
|
66
|
+
? transformRelativePath(arrayNode, node)
|
|
67
|
+
: currentPath.join('.')
|
|
68
|
+
return buf.concat({
|
|
69
|
+
label,
|
|
70
|
+
value,
|
|
71
|
+
node,
|
|
72
|
+
children: transformChildren(node.children, currentPath),
|
|
73
|
+
})
|
|
74
|
+
}, [])
|
|
75
|
+
}
|
|
76
|
+
const root = findRoot(node)
|
|
77
|
+
if (root) {
|
|
78
|
+
return transformChildren(root.children)
|
|
79
|
+
}
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
88
82
|
const PathSelector = (props) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
const baseNode = (0, designable_react_1.useSelectedNode)()
|
|
84
|
+
const dataSource = transformDataSource(baseNode)
|
|
85
|
+
const findNode = (dataSource, value) => {
|
|
86
|
+
for (let i = 0; i < dataSource.length; i++) {
|
|
87
|
+
const item = dataSource[i]
|
|
88
|
+
if (item.value === value) return item.node
|
|
89
|
+
if (item.children?.length) {
|
|
90
|
+
const fondedChild = findNode(item.children, value)
|
|
91
|
+
if (fondedChild) return fondedChild
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return (0, jsx_runtime_1.jsx)(antd_1.TreeSelect, {
|
|
96
|
+
...props,
|
|
97
|
+
onChange: (value) => {
|
|
98
|
+
props.onChange(value, findNode(dataSource, value))
|
|
99
|
+
},
|
|
100
|
+
treeDefaultExpandAll: true,
|
|
101
|
+
treeData: dataSource,
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
exports.PathSelector = PathSelector
|
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.initDeclaration = void 0
|
|
4
|
-
const designable_react_settings_form_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.initDeclaration = void 0
|
|
4
|
+
const designable_react_settings_form_1 = require('@thienvu18/designable-react-settings-form')
|
|
5
5
|
const loadDependencies = async (deps) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
return Promise.all(
|
|
7
|
+
deps.map(async ({ name, path }) => ({
|
|
8
|
+
name,
|
|
9
|
+
path,
|
|
10
|
+
library: await fetch(
|
|
11
|
+
`${(0,
|
|
12
|
+
designable_react_settings_form_1.getNpmCDNRegistry)()}/${name}/${path}`
|
|
13
|
+
).then((res) => res.text()),
|
|
14
|
+
}))
|
|
15
|
+
)
|
|
16
|
+
}
|
|
12
17
|
const initDeclaration = async () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
18
|
+
return designable_react_settings_form_1.MonacoInput.loader
|
|
19
|
+
.init()
|
|
20
|
+
.then(async (monaco) => {
|
|
21
|
+
const deps = await loadDependencies([
|
|
22
|
+
{ name: '@formily/core', path: 'dist/formily.core.all.d.ts' },
|
|
23
|
+
])
|
|
24
|
+
deps?.forEach(({ name, library }) => {
|
|
25
|
+
monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
26
|
+
`declare module '${name}'{ ${library} }`,
|
|
27
|
+
`file:///node_modules/${name}/index.d.ts`
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
31
|
+
`
|
|
21
32
|
import { Form, Field } from '@formily/core'
|
|
22
33
|
declare global {
|
|
23
34
|
/*
|
|
@@ -49,7 +60,9 @@ const initDeclaration = async () => {
|
|
|
49
60
|
**/
|
|
50
61
|
declare var $props: (props: any) => void
|
|
51
62
|
}
|
|
52
|
-
`,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
`,
|
|
64
|
+
`file:///node_modules/formily_global.d.ts`
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
exports.initDeclaration = initDeclaration
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
export declare const GlobalHelper =
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
1
|
+
export declare const GlobalHelper =
|
|
2
|
+
'\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n'
|
|
3
|
+
export declare const BooleanHelper =
|
|
4
|
+
"\n/** \n * Example 1\n * Static Boolean\n **/\n\nfalse\n\n/** \n * Example 2\n * Equal Calculation\n **/\n\n$deps.VariableName === 'TARGET_VALUE'\n\n/** \n * Example 3\n * Not Equal Calculation\n **/\n\n$deps.VariableName !== 'TARGET_VALUE'\n\n/** \n * Example 4\n * And Logic Calculation\n **/\n\n$deps.VariableName1 && $deps.VariableName2\n\n/** \n * Example 5\n * Grater Logic Calculation\n **/\n\n$deps.VariableName > 100\n\n/** \n * Example 6\n * Not Logic Calculation\n **/\n\n!$deps.VariableName\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
5
|
+
export declare const DisplayHelper =
|
|
6
|
+
"\n/** \n * Example 1\n * Static Mode\n **/\n\n'none'\n\n/** \n * Example 2\n * Equal Condition Associated\n **/\n\n$deps.VariableName === 'TARGET_VALUE' ? 'visible' : 'none'\n\n/** \n * Example 3\n * Not Equal Condition Associated\n **/\n\n$deps.VariableName !== 'TARGET_VALUE' ? 'visible' : 'hidden'\n\n/** \n * Example 4\n * And Logic Condition Associated\n **/\n\n$deps.VariableName1 && $deps.VariableName2 ? 'visible' : 'none'\n\n/** \n * Example 5\n * Grater Logic Condition Associated\n **/\n\n$deps.VariableName > 100 ? 'visible' : 'hidden'\n\n/** \n * Example 6\n * Not Logic Condition Associated\n **/\n\n!$deps.VariableName ? 'visible' : 'none'\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
7
|
+
export declare const PatternHelper =
|
|
8
|
+
"\n/** \n * Example 1\n * Static Mode\n **/\n\n'readPretty'\n\n/** \n * Example 2\n * Equal Condition Associated\n **/\n\n$deps.VariableName === 'TARGET_VALUE' ? 'editable' : 'disabled'\n\n/** \n * Example 3\n * Not Equal Condition Associated\n **/\n\n$deps.VariableName !== 'TARGET_VALUE' ? 'editable' : 'readOnly'\n\n/** \n * Example 4\n * And Logic Condition Associated\n **/\n\n$deps.VariableName1 && $deps.VariableName2 ? 'editable' : 'readPretty'\n\n/** \n * Example 5\n * Grater Logic Condition Associated\n **/\n\n$deps.VariableName > 100 ? 'editable' : 'readOnly'\n\n/** \n * Example 6\n * Not Logic Condition Associated\n **/\n\n!$deps.VariableName ? 'editable' : 'disabled'\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
9
|
+
export declare const StringHelper =
|
|
10
|
+
"\n/** \n * Example 1\n * Static String\n **/\n\n'Normal String Text'\n\n/** \n * Example 2\n * Associated String\n **/\n\n$deps.VariableName === 'TARGET_VALUE' ? 'Associated String Text' : ''\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
11
|
+
export declare const AnyHelper =
|
|
12
|
+
"\n/** \n * Example 1\n * String Type\n **/\n\n'String'\n\n/** \n * Example 2\n * String Array\n **/\n\n['StringArray']\n\n/** \n * Example 3\n * Object Array\n **/\n\n[{ key: 'ObjectArray' }]\n\n/** \n * Example 4\n * Boolean\n **/\n\ntrue\n\n/** \n * Example 5\n * RegExp\n **/\n\n/d+/\n\n/** \n * Example 1\n * Associated String Value\n **/\n\n$deps.VariableName + 'Compose String'\n\n/** \n * Example 2\n * Associated Array Value\n **/\n\n[ $deps.VariableName ]\n\n/** \n * Example 3\n * Associated Object Value\n **/\n\n{\n key : $deps.VariableName\n}\n\n/** \n * Example 4\n * Associated Boolean Value\n **/\n\n!$deps.VariableName\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
13
|
+
export declare const DataSourceHelper =
|
|
14
|
+
'\n/** \n * Example 1\n * Static DataSource\n **/\n\n[\n { label : "item1", value: "1" },\n { label : "item2", value: "2" }\n]\n\n/** \n * Example 2\n * Associated DataSource\n **/\n\n[\n { label : "item1", value: "1" },\n { label : "item2", value: "2" },\n ...$deps.VariableName\n]\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n'
|
|
15
|
+
export declare const ComponentPropsHelper =
|
|
16
|
+
'\n/** \n * Example 1\n * Static Props\n **/\n\n{\n placeholder: "This is placeholder"\n}\n\n/** \n * Example 2\n * Associated Props\n **/\n\n{\n placeholder: $deps.VariableName\n}\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n'
|
|
17
|
+
export declare const DecoratorPropsHelper =
|
|
18
|
+
'\n/** \n * Example 1\n * Static Props\n **/\n\n{\n labelCol:6\n}\n\n/** \n * Example 2\n * Associated Props\n **/\n\n{\n labelCol: $deps.VariableName\n}\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n'
|
|
19
|
+
export declare const FulfillRunHelper =
|
|
20
|
+
"\n/** \n * Example 1\n * Async Select\n **/\n\n$effect(()=>{\n $self.loading = true\n fetch('//some.domain/getSomething')\n .then(response=>response.json())\n .then(({ data })=>{\n $self.loading = false\n $self.dataSource = data\n },()=>{\n $self.loading = false\n })\n},[])\n \n\n/** \n * Example 2\n * Async Search Select\n **/\n\nconst state = $observable({\n keyword:''\n})\n\n$props({\n onSearch(keyword){\n state.keyword = keyword\n }\n})\n\n$effect(()=>{\n $self.loading = true\n fetch(`//some.domain/getSomething?q=${state.keyword}`)\n .then(response=>response.json())\n .then(({ data })=>{\n $self.loading = false\n $self.dataSource = data\n },()=>{\n $self.loading = false\n })\n},[ state.keyword ])\n\n/** \n * Example 3\n * Async Associated Select\n **/\n\nconst state = $observable({\n keyword:''\n})\n\n$props({\n onSearch(keyword){\n state.keyword = keyword\n }\n})\n\n$effect(()=>{\n $self.loading = true\n fetch(`//some.domain/getSomething?q=${state.keyword}&other=${$deps.VariableName}`)\n .then(response=>response.json())\n .then(({ data })=>{\n $self.loading = false\n $self.dataSource = data\n },()=>{\n $self.loading = false\n })\n},[ state.keyword, $deps.VariableName ])\n\n\n/** \n * You can use the built-in context variables\n * \n * 1. `$self` is the current Field Model \n * \n * 2. `$form` is the current Form Model \n * \n * 3. `$deps` is the dependencies value\n * \n * 4. `$observable` function is used to create an persistent observable state object\n *\n * 5. `$memo` function is is used to create a persistent data\n * \n * 6. `$effect` function is used to handle side-effect logic\n * \n * 7. `$props` function is used to set component props to current field\n * \n * Document Links\n * \n * https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F\n **/\n\n"
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.FulfillRunHelper =
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.FulfillRunHelper =
|
|
4
|
+
exports.DecoratorPropsHelper =
|
|
5
|
+
exports.ComponentPropsHelper =
|
|
6
|
+
exports.DataSourceHelper =
|
|
7
|
+
exports.AnyHelper =
|
|
8
|
+
exports.StringHelper =
|
|
9
|
+
exports.PatternHelper =
|
|
10
|
+
exports.DisplayHelper =
|
|
11
|
+
exports.BooleanHelper =
|
|
12
|
+
exports.GlobalHelper =
|
|
13
|
+
void 0
|
|
4
14
|
exports.GlobalHelper = `
|
|
5
15
|
/**
|
|
6
16
|
* You can use the built-in context variables
|
|
@@ -23,7 +33,7 @@ exports.GlobalHelper = `
|
|
|
23
33
|
*
|
|
24
34
|
* https://react.formilyjs.org/api/shared/schema#%E5%86%85%E7%BD%AE%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BD%9C%E7%94%A8%E5%9F%9F
|
|
25
35
|
**/
|
|
26
|
-
|
|
36
|
+
`
|
|
27
37
|
exports.BooleanHelper = `
|
|
28
38
|
/**
|
|
29
39
|
* Example 1
|
|
@@ -68,7 +78,7 @@ $deps.VariableName > 100
|
|
|
68
78
|
!$deps.VariableName
|
|
69
79
|
|
|
70
80
|
${exports.GlobalHelper}
|
|
71
|
-
|
|
81
|
+
`
|
|
72
82
|
exports.DisplayHelper = `
|
|
73
83
|
/**
|
|
74
84
|
* Example 1
|
|
@@ -113,7 +123,7 @@ $deps.VariableName > 100 ? 'visible' : 'hidden'
|
|
|
113
123
|
!$deps.VariableName ? 'visible' : 'none'
|
|
114
124
|
|
|
115
125
|
${exports.GlobalHelper}
|
|
116
|
-
|
|
126
|
+
`
|
|
117
127
|
exports.PatternHelper = `
|
|
118
128
|
/**
|
|
119
129
|
* Example 1
|
|
@@ -158,7 +168,7 @@ $deps.VariableName > 100 ? 'editable' : 'readOnly'
|
|
|
158
168
|
!$deps.VariableName ? 'editable' : 'disabled'
|
|
159
169
|
|
|
160
170
|
${exports.GlobalHelper}
|
|
161
|
-
|
|
171
|
+
`
|
|
162
172
|
exports.StringHelper = `
|
|
163
173
|
/**
|
|
164
174
|
* Example 1
|
|
@@ -175,7 +185,7 @@ exports.StringHelper = `
|
|
|
175
185
|
$deps.VariableName === 'TARGET_VALUE' ? 'Associated String Text' : ''
|
|
176
186
|
|
|
177
187
|
${exports.GlobalHelper}
|
|
178
|
-
|
|
188
|
+
`
|
|
179
189
|
exports.AnyHelper = `
|
|
180
190
|
/**
|
|
181
191
|
* Example 1
|
|
@@ -243,7 +253,7 @@ $deps.VariableName + 'Compose String'
|
|
|
243
253
|
!$deps.VariableName
|
|
244
254
|
|
|
245
255
|
${exports.GlobalHelper}
|
|
246
|
-
|
|
256
|
+
`
|
|
247
257
|
exports.DataSourceHelper = `
|
|
248
258
|
/**
|
|
249
259
|
* Example 1
|
|
@@ -267,7 +277,7 @@ exports.DataSourceHelper = `
|
|
|
267
277
|
]
|
|
268
278
|
|
|
269
279
|
${exports.GlobalHelper}
|
|
270
|
-
|
|
280
|
+
`
|
|
271
281
|
exports.ComponentPropsHelper = `
|
|
272
282
|
/**
|
|
273
283
|
* Example 1
|
|
@@ -288,7 +298,7 @@ exports.ComponentPropsHelper = `
|
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
${exports.GlobalHelper}
|
|
291
|
-
|
|
301
|
+
`
|
|
292
302
|
exports.DecoratorPropsHelper = `
|
|
293
303
|
/**
|
|
294
304
|
* Example 1
|
|
@@ -309,7 +319,7 @@ exports.DecoratorPropsHelper = `
|
|
|
309
319
|
}
|
|
310
320
|
|
|
311
321
|
${exports.GlobalHelper}
|
|
312
|
-
|
|
322
|
+
`
|
|
313
323
|
exports.FulfillRunHelper = `
|
|
314
324
|
/**
|
|
315
325
|
* Example 1
|
|
@@ -384,4 +394,4 @@ $effect(()=>{
|
|
|
384
394
|
},[ state.keyword, $deps.VariableName ])
|
|
385
395
|
|
|
386
396
|
${exports.GlobalHelper}
|
|
387
|
-
|
|
397
|
+
`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import
|
|
3
|
-
import './
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './styles.less'
|
|
3
|
+
import { IReaction } from './types'
|
|
4
4
|
export interface IReactionsSetterProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
value?: IReaction
|
|
6
|
+
onChange?: (value: IReaction) => void
|
|
7
7
|
}
|
|
8
|
-
export declare const ReactionsSetter: React.FC<IReactionsSetterProps
|
|
8
|
+
export declare const ReactionsSetter: React.FC<IReactionsSetterProps>
|