@thienvu18/designable-react-settings-form 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/SchemaField.d.ts +5115 -1578
- package/esm/SchemaField.js +76 -41
- package/esm/SettingsForm.d.ts +4 -4
- package/esm/SettingsForm.js +99 -49
- package/esm/components/BackgroundStyleSetter/index.d.ts +4 -4
- package/esm/components/BackgroundStyleSetter/index.js +95 -42
- package/esm/components/BorderRadiusStyleSetter/index.d.ts +4 -4
- package/esm/components/BorderRadiusStyleSetter/index.js +13 -10
- package/esm/components/BorderStyleSetter/index.d.ts +5 -5
- package/esm/components/BorderStyleSetter/index.js +121 -68
- package/esm/components/BoxShadowStyleSetter/index.d.ts +6 -6
- package/esm/components/BoxShadowStyleSetter/index.js +72 -24
- package/esm/components/BoxStyleSetter/index.d.ts +7 -7
- package/esm/components/BoxStyleSetter/index.js +98 -46
- package/esm/components/CollapseItem/index.d.ts +6 -6
- package/esm/components/CollapseItem/index.js +35 -15
- package/esm/components/ColorInput/index.d.ts +5 -5
- package/esm/components/ColorInput/index.js +35 -17
- package/esm/components/ColorInput/styles.less +0 -5
- package/esm/components/CornerInput/index.d.ts +7 -7
- package/esm/components/CornerInput/index.js +50 -21
- package/esm/components/DisplayStyleSetter/index.d.ts +7 -7
- package/esm/components/DisplayStyleSetter/index.js +62 -33
- package/esm/components/DrawerSetter/index.d.ts +6 -6
- package/esm/components/DrawerSetter/index.js +82 -42
- package/esm/components/DrawerSetter/styles.less +2 -2
- package/esm/components/FlexStyleSetter/index.d.ts +5 -5
- package/esm/components/FlexStyleSetter/index.js +160 -110
- package/esm/components/FoldItem/index.d.ts +9 -7
- package/esm/components/FoldItem/index.js +80 -46
- package/esm/components/FontStyleSetter/index.d.ts +4 -4
- package/esm/components/FontStyleSetter/index.js +169 -85
- package/esm/components/ImageInput/index.d.ts +7 -7
- package/esm/components/ImageInput/index.js +59 -39
- package/esm/components/InputItems/index.d.ts +19 -17
- package/esm/components/InputItems/index.js +42 -16
- package/esm/components/MonacoInput/config.d.ts +1 -1
- package/esm/components/MonacoInput/config.js +40 -38
- package/esm/components/MonacoInput/format.d.ts +4 -1
- package/esm/components/MonacoInput/format.js +33 -29
- package/esm/components/MonacoInput/index.d.ts +13 -13
- package/esm/components/MonacoInput/index.js +298 -212
- package/esm/components/MonacoInput/themes/chrome.d.ts +44 -38
- package/esm/components/MonacoInput/themes/chrome.js +105 -105
- package/esm/components/MonacoInput/themes/monokai.d.ts +34 -30
- package/esm/components/MonacoInput/themes/monokai.js +139 -139
- package/esm/components/PolyInput/index.d.ts +17 -17
- package/esm/components/PolyInput/index.js +96 -66
- package/esm/components/PositionInput/index.d.ts +7 -7
- package/esm/components/PositionInput/index.js +48 -21
- package/esm/components/PositionInput/styles.less +0 -1
- package/esm/components/SizeInput/index.d.ts +6 -2
- package/esm/components/SizeInput/index.js +44 -46
- package/esm/components/SizeInput/styles.less +0 -1
- package/esm/components/ValueInput/index.d.ts +2 -2
- package/esm/components/ValueInput/index.js +89 -72
- package/esm/components/index.d.ts +20 -20
- package/esm/components/index.js +20 -20
- package/esm/effects/index.d.ts +2 -2
- package/esm/effects/index.js +2 -2
- package/esm/effects/useLocales.d.ts +2 -2
- package/esm/effects/useLocales.js +57 -59
- package/esm/effects/useSnapshot.d.ts +2 -2
- package/esm/effects/useSnapshot.js +9 -9
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/locales/en-US.d.ts +12 -12
- package/esm/locales/en-US.js +10 -10
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/index.js +5 -5
- package/esm/locales/ko-KR.d.ts +12 -12
- package/esm/locales/ko-KR.js +10 -10
- package/esm/locales/zh-CN.d.ts +12 -12
- package/esm/locales/zh-CN.js +10 -10
- package/esm/registry.d.ts +2 -2
- package/esm/registry.js +11 -11
- package/esm/shared/context.d.ts +2 -2
- package/esm/shared/context.js +2 -2
- package/esm/shared/loadScript.d.ts +5 -5
- package/esm/shared/loadScript.js +27 -28
- package/esm/styles.less +5 -4
- package/esm/types.d.ts +8 -8
- package/esm/types.js +1 -1
- package/lib/SchemaField.d.ts +5115 -1578
- package/lib/SchemaField.js +44 -44
- package/lib/SettingsForm.d.ts +4 -4
- package/lib/SettingsForm.js +108 -55
- package/lib/components/BackgroundStyleSetter/index.d.ts +4 -4
- package/lib/components/BackgroundStyleSetter/index.js +106 -48
- package/lib/components/BorderRadiusStyleSetter/index.d.ts +4 -4
- package/lib/components/BorderRadiusStyleSetter/index.js +33 -14
- package/lib/components/BorderStyleSetter/index.d.ts +5 -5
- package/lib/components/BorderStyleSetter/index.js +138 -74
- package/lib/components/BoxShadowStyleSetter/index.d.ts +6 -6
- package/lib/components/BoxShadowStyleSetter/index.js +82 -30
- package/lib/components/BoxStyleSetter/index.d.ts +7 -7
- package/lib/components/BoxStyleSetter/index.js +122 -52
- package/lib/components/CollapseItem/index.d.ts +6 -6
- package/lib/components/CollapseItem/index.js +49 -21
- package/lib/components/ColorInput/index.d.ts +5 -5
- package/lib/components/ColorInput/index.js +39 -21
- package/lib/components/ColorInput/styles.less +0 -5
- package/lib/components/CornerInput/index.d.ts +7 -7
- package/lib/components/CornerInput/index.js +70 -28
- package/lib/components/DisplayStyleSetter/index.d.ts +7 -7
- package/lib/components/DisplayStyleSetter/index.js +75 -39
- package/lib/components/DrawerSetter/index.d.ts +6 -6
- package/lib/components/DrawerSetter/index.js +99 -48
- package/lib/components/DrawerSetter/styles.less +2 -2
- package/lib/components/FlexStyleSetter/index.d.ts +5 -5
- package/lib/components/FlexStyleSetter/index.js +208 -116
- package/lib/components/FoldItem/index.d.ts +9 -7
- package/lib/components/FoldItem/index.js +140 -72
- package/lib/components/FontStyleSetter/index.d.ts +4 -4
- package/lib/components/FontStyleSetter/index.js +216 -91
- package/lib/components/ImageInput/index.d.ts +7 -7
- package/lib/components/ImageInput/index.js +69 -47
- package/lib/components/InputItems/index.d.ts +19 -17
- package/lib/components/InputItems/index.js +101 -46
- package/lib/components/MonacoInput/config.d.ts +1 -1
- package/lib/components/MonacoInput/config.js +49 -45
- package/lib/components/MonacoInput/format.d.ts +4 -1
- package/lib/components/MonacoInput/format.js +38 -33
- package/lib/components/MonacoInput/index.d.ts +13 -13
- package/lib/components/MonacoInput/index.js +347 -241
- package/lib/components/MonacoInput/themes/chrome.d.ts +44 -38
- package/lib/components/MonacoInput/themes/chrome.js +107 -107
- package/lib/components/MonacoInput/themes/monokai.d.ts +34 -30
- package/lib/components/MonacoInput/themes/monokai.js +141 -141
- package/lib/components/PolyInput/index.d.ts +17 -17
- package/lib/components/PolyInput/index.js +151 -96
- package/lib/components/PositionInput/index.d.ts +7 -7
- package/lib/components/PositionInput/index.js +68 -28
- package/lib/components/PositionInput/styles.less +0 -1
- package/lib/components/SizeInput/index.d.ts +6 -2
- package/lib/components/SizeInput/index.js +47 -49
- package/lib/components/SizeInput/styles.less +0 -1
- package/lib/components/ValueInput/index.d.ts +2 -2
- package/lib/components/ValueInput/index.js +92 -75
- package/lib/components/index.d.ts +20 -20
- package/lib/components/index.js +52 -36
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +34 -18
- package/lib/effects/useLocales.d.ts +2 -2
- package/lib/effects/useLocales.js +67 -63
- package/lib/effects/useSnapshot.d.ts +2 -2
- package/lib/effects/useSnapshot.js +13 -13
- package/lib/index.d.ts +5 -5
- package/lib/index.js +37 -21
- package/lib/locales/en-US.d.ts +12 -12
- package/lib/locales/en-US.js +12 -12
- package/lib/locales/index.d.ts +1 -1
- package/lib/locales/index.js +16 -10
- package/lib/locales/ko-KR.d.ts +12 -12
- package/lib/locales/ko-KR.js +12 -12
- package/lib/locales/zh-CN.d.ts +12 -12
- package/lib/locales/zh-CN.js +12 -12
- package/lib/registry.d.ts +2 -2
- package/lib/registry.js +21 -19
- package/lib/shared/context.d.ts +2 -2
- package/lib/shared/context.js +5 -5
- package/lib/shared/loadScript.d.ts +5 -5
- package/lib/shared/loadScript.js +32 -32
- package/lib/styles.less +5 -4
- package/lib/types.d.ts +8 -8
- package/lib/types.js +2 -2
- package/package.json +4 -4
|
@@ -1,84 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.ValueInput = void 0
|
|
4
|
-
const jsx_runtime_1 = require(
|
|
5
|
-
const PolyInput_1 = require(
|
|
6
|
-
const antd_1 = require(
|
|
7
|
-
const MonacoInput_1 = require(
|
|
8
|
-
const designable_react_1 = require(
|
|
9
|
-
const STARTTAG_REX =
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.ValueInput = void 0
|
|
4
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
5
|
+
const PolyInput_1 = require('../PolyInput')
|
|
6
|
+
const antd_1 = require('antd')
|
|
7
|
+
const MonacoInput_1 = require('../MonacoInput')
|
|
8
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
9
|
+
const STARTTAG_REX =
|
|
10
|
+
/<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
|
|
11
|
+
const EXPRESSION_REX = /^\{\{([\s\S]*)\}\}$/
|
|
12
|
+
const isNumber = (value) => typeof value === 'number'
|
|
13
|
+
const isBoolean = (value) => typeof value === 'boolean'
|
|
13
14
|
const isExpression = (value) => {
|
|
14
|
-
|
|
15
|
-
}
|
|
15
|
+
return typeof value === 'string' && EXPRESSION_REX.test(value)
|
|
16
|
+
}
|
|
16
17
|
const isRichText = (value) => {
|
|
17
|
-
|
|
18
|
-
}
|
|
18
|
+
return typeof value === 'string' && STARTTAG_REX.test(value)
|
|
19
|
+
}
|
|
19
20
|
const isNormalText = (value) => {
|
|
20
|
-
|
|
21
|
-
}
|
|
21
|
+
return typeof value === 'string' && !isExpression(value) && !isRichText(value)
|
|
22
|
+
}
|
|
22
23
|
const takeNumber = (value) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
24
|
+
const num = String(value).replace(/[^\d\.]+/, '')
|
|
25
|
+
if (num === '') return
|
|
26
|
+
return Number(num)
|
|
27
|
+
}
|
|
28
28
|
exports.ValueInput = (0, PolyInput_1.createPolyInput)([
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
{
|
|
30
|
+
type: 'TEXT',
|
|
31
|
+
icon: 'Text',
|
|
32
|
+
component: antd_1.Input,
|
|
33
|
+
checker: isNormalText,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'EXPRESSION',
|
|
37
|
+
icon: 'Expression',
|
|
38
|
+
component: (props) => {
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(antd_1.Popover, {
|
|
40
|
+
content: (0, jsx_runtime_1.jsx)('div', {
|
|
41
|
+
style: {
|
|
42
|
+
width: 400,
|
|
43
|
+
height: 200,
|
|
44
|
+
marginLeft: -16,
|
|
45
|
+
marginRight: -16,
|
|
46
|
+
marginBottom: -12,
|
|
47
|
+
},
|
|
48
|
+
children: (0, jsx_runtime_1.jsx)(MonacoInput_1.MonacoInput, {
|
|
49
|
+
...props,
|
|
50
|
+
language: 'javascript.expression',
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
trigger: 'click',
|
|
54
|
+
children: (0, jsx_runtime_1.jsx)(antd_1.Button, {
|
|
55
|
+
block: true,
|
|
56
|
+
children: (0, jsx_runtime_1.jsx)(designable_react_1.TextWidget, {
|
|
57
|
+
token: 'SettingComponents.ValueInput.expression',
|
|
58
|
+
}),
|
|
59
|
+
}),
|
|
60
|
+
})
|
|
34
61
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
width: 400,
|
|
41
|
-
height: 200,
|
|
42
|
-
marginLeft: -16,
|
|
43
|
-
marginRight: -16,
|
|
44
|
-
marginBottom: -12,
|
|
45
|
-
}, children: (0, jsx_runtime_1.jsx)(MonacoInput_1.MonacoInput, { ...props, language: "javascript.expression" }) }), trigger: "click", children: (0, jsx_runtime_1.jsx)(antd_1.Button, { block: true, children: (0, jsx_runtime_1.jsx)(designable_react_1.TextWidget, { token: "SettingComponents.ValueInput.expression" }) }) }));
|
|
46
|
-
},
|
|
47
|
-
checker: isExpression,
|
|
48
|
-
toInputValue: (value) => {
|
|
49
|
-
if (!value || value === '{{}}')
|
|
50
|
-
return;
|
|
51
|
-
const matched = String(value).match(EXPRESSION_REX);
|
|
52
|
-
return matched?.[1] || value || '';
|
|
53
|
-
},
|
|
54
|
-
toChangeValue: (value) => {
|
|
55
|
-
if (!value || value === '{{}}')
|
|
56
|
-
return;
|
|
57
|
-
const matched = String(value).match(EXPRESSION_REX);
|
|
58
|
-
return `{{${matched?.[1] || value || ''}}}`;
|
|
59
|
-
},
|
|
62
|
+
checker: isExpression,
|
|
63
|
+
toInputValue: (value) => {
|
|
64
|
+
if (!value || value === '{{}}') return
|
|
65
|
+
const matched = String(value).match(EXPRESSION_REX)
|
|
66
|
+
return matched?.[1] || value || ''
|
|
60
67
|
},
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
{ label: 'True', value: true },
|
|
66
|
-
{ label: 'False', value: false },
|
|
67
|
-
] })),
|
|
68
|
-
checker: isBoolean,
|
|
69
|
-
toInputValue: (value) => {
|
|
70
|
-
return !!value;
|
|
71
|
-
},
|
|
72
|
-
toChangeValue: (value) => {
|
|
73
|
-
return !!value;
|
|
74
|
-
},
|
|
68
|
+
toChangeValue: (value) => {
|
|
69
|
+
if (!value || value === '{{}}') return
|
|
70
|
+
const matched = String(value).match(EXPRESSION_REX)
|
|
71
|
+
return `{{${matched?.[1] || value || ''}}}`
|
|
75
72
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'BOOLEAN',
|
|
76
|
+
icon: 'Boolean',
|
|
77
|
+
component: (props) =>
|
|
78
|
+
(0, jsx_runtime_1.jsx)(antd_1.Select, {
|
|
79
|
+
...props,
|
|
80
|
+
options: [
|
|
81
|
+
{ label: 'True', value: true },
|
|
82
|
+
{ label: 'False', value: false },
|
|
83
|
+
],
|
|
84
|
+
}),
|
|
85
|
+
checker: isBoolean,
|
|
86
|
+
toInputValue: (value) => {
|
|
87
|
+
return !!value
|
|
83
88
|
},
|
|
84
|
-
|
|
89
|
+
toChangeValue: (value) => {
|
|
90
|
+
return !!value
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'NUMBER',
|
|
95
|
+
icon: 'Number',
|
|
96
|
+
component: antd_1.InputNumber,
|
|
97
|
+
checker: isNumber,
|
|
98
|
+
toInputValue: takeNumber,
|
|
99
|
+
toChangeValue: takeNumber,
|
|
100
|
+
},
|
|
101
|
+
])
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
1
|
+
export * from './BackgroundStyleSetter'
|
|
2
|
+
export * from './BorderRadiusStyleSetter'
|
|
3
|
+
export * from './BorderStyleSetter'
|
|
4
|
+
export * from './BoxShadowStyleSetter'
|
|
5
|
+
export * from './BoxStyleSetter'
|
|
6
|
+
export * from './CollapseItem'
|
|
7
|
+
export * from './ColorInput'
|
|
8
|
+
export * from './CornerInput'
|
|
9
|
+
export * from './DisplayStyleSetter'
|
|
10
|
+
export * from './DrawerSetter'
|
|
11
|
+
export * from './FlexStyleSetter'
|
|
12
|
+
export * from './FoldItem'
|
|
13
|
+
export * from './FontStyleSetter'
|
|
14
|
+
export * from './ImageInput'
|
|
15
|
+
export * from './InputItems'
|
|
16
|
+
export * from './MonacoInput'
|
|
17
|
+
export * from './PolyInput'
|
|
18
|
+
export * from './PositionInput'
|
|
19
|
+
export * from './SizeInput'
|
|
20
|
+
export * from './ValueInput'
|
package/lib/components/index.js
CHANGED
|
@@ -1,36 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
__exportStar
|
|
26
|
-
__exportStar
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
__exportStar(require(
|
|
34
|
-
__exportStar(require(
|
|
35
|
-
__exportStar(require(
|
|
36
|
-
__exportStar(require(
|
|
1
|
+
'use strict'
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
8
|
+
if (
|
|
9
|
+
!desc ||
|
|
10
|
+
('get' in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
+
) {
|
|
12
|
+
desc = {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return m[k]
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc)
|
|
20
|
+
}
|
|
21
|
+
: function (o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k
|
|
23
|
+
o[k2] = m[k]
|
|
24
|
+
})
|
|
25
|
+
var __exportStar =
|
|
26
|
+
(this && this.__exportStar) ||
|
|
27
|
+
function (m, exports) {
|
|
28
|
+
for (var p in m)
|
|
29
|
+
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
+
__createBinding(exports, m, p)
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
33
|
+
__exportStar(require('./ColorInput'), exports)
|
|
34
|
+
__exportStar(require('./CornerInput'), exports)
|
|
35
|
+
__exportStar(require('./ImageInput'), exports)
|
|
36
|
+
__exportStar(require('./PositionInput'), exports)
|
|
37
|
+
__exportStar(require('./SizeInput'), exports)
|
|
38
|
+
__exportStar(require('./PolyInput'), exports)
|
|
39
|
+
__exportStar(require('./ValueInput'), exports)
|
|
40
|
+
__exportStar(require('./MonacoInput'), exports)
|
|
41
|
+
__exportStar(require('./DrawerSetter'), exports)
|
|
42
|
+
__exportStar(require('./BoxStyleSetter'), exports)
|
|
43
|
+
__exportStar(require('./BorderStyleSetter'), exports)
|
|
44
|
+
__exportStar(require('./BorderRadiusStyleSetter'), exports)
|
|
45
|
+
__exportStar(require('./BackgroundStyleSetter'), exports)
|
|
46
|
+
__exportStar(require('./BoxShadowStyleSetter'), exports)
|
|
47
|
+
__exportStar(require('./FontStyleSetter'), exports)
|
|
48
|
+
__exportStar(require('./DisplayStyleSetter'), exports)
|
|
49
|
+
__exportStar(require('./FlexStyleSetter'), exports)
|
|
50
|
+
__exportStar(require('./FoldItem'), exports)
|
|
51
|
+
__exportStar(require('./CollapseItem'), exports)
|
|
52
|
+
__exportStar(require('./InputItems'), exports)
|
package/lib/effects/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './useLocales'
|
|
2
|
-
export * from './useSnapshot'
|
|
1
|
+
export * from './useLocales'
|
|
2
|
+
export * from './useSnapshot'
|
package/lib/effects/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
8
|
+
if (
|
|
9
|
+
!desc ||
|
|
10
|
+
('get' in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
+
) {
|
|
12
|
+
desc = {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return m[k]
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc)
|
|
20
|
+
}
|
|
21
|
+
: function (o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k
|
|
23
|
+
o[k2] = m[k]
|
|
24
|
+
})
|
|
25
|
+
var __exportStar =
|
|
26
|
+
(this && this.__exportStar) ||
|
|
27
|
+
function (m, exports) {
|
|
28
|
+
for (var p in m)
|
|
29
|
+
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
+
__createBinding(exports, m, p)
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
33
|
+
__exportStar(require('./useLocales'), exports)
|
|
34
|
+
__exportStar(require('./useSnapshot'), exports)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TreeNode } from '@thienvu18/designable-core'
|
|
2
|
-
export declare const useLocales: (node: TreeNode) => void
|
|
1
|
+
import { TreeNode } from '@thienvu18/designable-core'
|
|
2
|
+
export declare const useLocales: (node: TreeNode) => void
|
|
@@ -1,67 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.useLocales = void 0
|
|
4
|
-
const jsx_runtime_1 = require(
|
|
5
|
-
const core_1 = require(
|
|
6
|
-
const designable_core_1 = require(
|
|
7
|
-
const designable_shared_1 = require(
|
|
8
|
-
const designable_react_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.useLocales = void 0
|
|
4
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
5
|
+
const core_1 = require('@formily/core')
|
|
6
|
+
const designable_core_1 = require('@thienvu18/designable-core')
|
|
7
|
+
const designable_shared_1 = require('@thienvu18/designable-shared')
|
|
8
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
9
9
|
const takeIcon = (message) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
};
|
|
10
|
+
if (!(0, designable_shared_1.isStr)(message)) return
|
|
11
|
+
const matched = message.match(/@([^:\s]+)(?:\s*\:\s*([\s\S]+))?/)
|
|
12
|
+
if (matched) return [matched[1], matched[2]]
|
|
13
|
+
return
|
|
14
|
+
}
|
|
17
15
|
const mapEnum = (dataSource) => (item, index) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const label = dataSource[index] || dataSource[item.value] || item.label
|
|
17
|
+
const icon = takeIcon(label)
|
|
18
|
+
return {
|
|
19
|
+
...item,
|
|
20
|
+
value: item?.value ?? null,
|
|
21
|
+
label: icon
|
|
22
|
+
? (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
23
|
+
infer: icon[0],
|
|
24
|
+
tooltip: icon[1],
|
|
25
|
+
})
|
|
26
|
+
: label?.label ?? label ?? 'Unknow',
|
|
27
|
+
}
|
|
28
|
+
}
|
|
26
29
|
const useLocales = (node) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
;(0, core_1.onFieldReact)('*', (field) => {
|
|
31
|
+
const path = field.path.toString().replace(/\.[\d+]/g, '')
|
|
32
|
+
const takeMessage = (prop) => {
|
|
33
|
+
const token = `settings.${path}${prop ? `.${prop}` : ''}`
|
|
34
|
+
return (
|
|
35
|
+
node.getMessage(token) ||
|
|
36
|
+
designable_core_1.GlobalRegistry.getDesignerMessage(token)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
const title = takeMessage('title') || takeMessage()
|
|
40
|
+
const description = takeMessage('description')
|
|
41
|
+
const tooltip = takeMessage('tooltip')
|
|
42
|
+
const dataSource = takeMessage('dataSource')
|
|
43
|
+
const placeholder = takeMessage('placeholder')
|
|
44
|
+
if (title) {
|
|
45
|
+
field.title = title
|
|
46
|
+
}
|
|
47
|
+
if (description) {
|
|
48
|
+
field.description = description
|
|
49
|
+
}
|
|
50
|
+
if (tooltip) {
|
|
51
|
+
field.decorator[1] = field.decorator[1] || []
|
|
52
|
+
field.decorator[1].tooltip = tooltip
|
|
53
|
+
}
|
|
54
|
+
if (placeholder) {
|
|
55
|
+
field.component[1] = field.component[1] || []
|
|
56
|
+
field.component[1].placeholder = placeholder
|
|
57
|
+
}
|
|
58
|
+
if (!(0, core_1.isVoidField)(field)) {
|
|
59
|
+
if (dataSource?.length) {
|
|
60
|
+
if (field.dataSource?.length) {
|
|
61
|
+
field.dataSource = field.dataSource.map(mapEnum(dataSource))
|
|
62
|
+
} else {
|
|
63
|
+
field.dataSource = dataSource.slice()
|
|
40
64
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (placeholder) {
|
|
49
|
-
field.component[1] = field.component[1] || [];
|
|
50
|
-
field.component[1].placeholder = placeholder;
|
|
51
|
-
}
|
|
52
|
-
if (!(0, core_1.isVoidField)(field)) {
|
|
53
|
-
if (dataSource?.length) {
|
|
54
|
-
if (field.dataSource?.length) {
|
|
55
|
-
field.dataSource = field.dataSource.map(mapEnum(dataSource));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
field.dataSource = dataSource.slice();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
field.dataSource = field.dataSource?.filter(Boolean);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
exports.useLocales = useLocales;
|
|
65
|
+
} else {
|
|
66
|
+
field.dataSource = field.dataSource?.filter(Boolean)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
exports.useLocales = useLocales
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Operation } from '@thienvu18/designable-core'
|
|
2
|
-
export declare const useSnapshot: (operation: Operation) => void
|
|
1
|
+
import { Operation } from '@thienvu18/designable-core'
|
|
2
|
+
export declare const useSnapshot: (operation: Operation) => void
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.useSnapshot = void 0
|
|
4
|
-
const core_1 = require(
|
|
5
|
-
let timeRequest = null
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.useSnapshot = void 0
|
|
4
|
+
const core_1 = require('@formily/core')
|
|
5
|
+
let timeRequest = null
|
|
6
6
|
const useSnapshot = (operation) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
exports.useSnapshot = useSnapshot
|
|
7
|
+
;(0, core_1.onFieldInputValueChange)('*', () => {
|
|
8
|
+
clearTimeout(timeRequest)
|
|
9
|
+
timeRequest = setTimeout(() => {
|
|
10
|
+
operation.snapshot('update:node:props')
|
|
11
|
+
}, 1000)
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
exports.useSnapshot = useSnapshot
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './locales'
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
1
|
+
import './locales'
|
|
2
|
+
export * from './SchemaField'
|
|
3
|
+
export * from './SettingsForm'
|
|
4
|
+
export * from './components'
|
|
5
|
+
export * from './registry'
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
8
|
+
if (
|
|
9
|
+
!desc ||
|
|
10
|
+
('get' in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
+
) {
|
|
12
|
+
desc = {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return m[k]
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc)
|
|
20
|
+
}
|
|
21
|
+
: function (o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k
|
|
23
|
+
o[k2] = m[k]
|
|
24
|
+
})
|
|
25
|
+
var __exportStar =
|
|
26
|
+
(this && this.__exportStar) ||
|
|
27
|
+
function (m, exports) {
|
|
28
|
+
for (var p in m)
|
|
29
|
+
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
+
__createBinding(exports, m, p)
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
33
|
+
require('./locales')
|
|
34
|
+
__exportStar(require('./registry'), exports)
|
|
35
|
+
__exportStar(require('./components'), exports)
|
|
36
|
+
__exportStar(require('./SchemaField'), exports)
|
|
37
|
+
__exportStar(require('./SettingsForm'), exports)
|
package/lib/locales/en-US.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export default _default
|
|
2
|
+
'en-US': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: string
|
|
6
|
+
}
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default _default
|