@thienvu18/designable-react-settings-form 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/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 +26 -27
|
@@ -1,88 +1,172 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
1
|
+
import { Field, observer, useField } from '@formily/react'
|
|
2
|
+
import { IconWidget, usePrefix } from '@thienvu18/designable-react'
|
|
3
|
+
import { NumberPicker, Radio, Select } from '@thienvu18/formily-antd-v6'
|
|
4
|
+
import cls from 'classnames'
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
|
|
6
|
+
import { ColorInput } from '../ColorInput'
|
|
7
|
+
import { FoldItem } from '../FoldItem'
|
|
8
|
+
import { InputItems } from '../InputItems'
|
|
9
|
+
import { SizeInput } from '../SizeInput'
|
|
10
10
|
const createFontFamilyOptions = (fonts) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
11
|
+
return fonts.map((font) => {
|
|
12
|
+
const splited = font.split('=')
|
|
13
|
+
const label = splited?.[0]
|
|
14
|
+
const value = splited?.[1]
|
|
15
|
+
return {
|
|
16
|
+
label: _jsx('span', { style: { fontFamily: value }, children: label }),
|
|
17
|
+
value,
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
21
|
const FontFamilyOptions = createFontFamilyOptions([
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
])
|
|
22
|
+
'宋体=SimSun',
|
|
23
|
+
'微软雅黑=Microsoft Yahei',
|
|
24
|
+
'苹方=PingFang SC',
|
|
25
|
+
'Andale Mono=andale mono,monospace',
|
|
26
|
+
'Arial=arial,helvetica,sans-serif',
|
|
27
|
+
'Arial Black=arial black,sans-serif',
|
|
28
|
+
'Book Antiqua=book antiqua,palatino,serif',
|
|
29
|
+
'Comic Sans MS=comic sans ms,sans-serif',
|
|
30
|
+
'Courier New=courier new,courier,monospace',
|
|
31
|
+
'Georgia=georgia,palatino,serif',
|
|
32
|
+
'Helvetica Neue=Helvetica Neue',
|
|
33
|
+
'Helvetica=helvetica,arial,sans-serif',
|
|
34
|
+
'Impact=impact,sans-serif',
|
|
35
|
+
'Symbol=symbol',
|
|
36
|
+
'Tahoma=tahoma,arial,helvetica,sans-serif',
|
|
37
|
+
'Terminal=terminal,monaco,monospace',
|
|
38
|
+
'Times New Roman=times new roman,times,serif',
|
|
39
|
+
'Trebuchet MS=trebuchet ms,geneva,sans-serif',
|
|
40
|
+
'Verdana=verdana,geneva,sans-serif',
|
|
41
|
+
])
|
|
42
42
|
export const FontStyleSetter = observer((props) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
43
|
+
const field = useField()
|
|
44
|
+
const prefix = usePrefix('font-style-setter')
|
|
45
|
+
return _jsxs(FoldItem, {
|
|
46
|
+
label: field.title,
|
|
47
|
+
className: cls(prefix, props.className),
|
|
48
|
+
style: props.style,
|
|
49
|
+
children: [
|
|
50
|
+
_jsx(FoldItem.Base, {
|
|
51
|
+
children: _jsx(Field, {
|
|
52
|
+
name: 'fontFamily',
|
|
53
|
+
basePath: field.address.parent(),
|
|
54
|
+
component: [
|
|
55
|
+
Select,
|
|
56
|
+
{ style: { width: '100%' }, placeholder: 'Helvetica Neue' },
|
|
57
|
+
],
|
|
58
|
+
dataSource: FontFamilyOptions,
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
_jsx(FoldItem.Extra, {
|
|
62
|
+
children: _jsxs(InputItems, {
|
|
63
|
+
children: [
|
|
64
|
+
_jsx(InputItems.Item, {
|
|
65
|
+
icon: 'FontWeight',
|
|
66
|
+
width: '50%',
|
|
67
|
+
children: _jsx(Field, {
|
|
68
|
+
name: 'fontWeight',
|
|
69
|
+
basePath: field.address.parent(),
|
|
70
|
+
component: [NumberPicker, { placeholder: '400' }],
|
|
71
|
+
}),
|
|
72
|
+
}),
|
|
73
|
+
_jsx(InputItems.Item, {
|
|
74
|
+
icon: 'FontStyle',
|
|
75
|
+
width: '50%',
|
|
76
|
+
children: _jsx(Field, {
|
|
77
|
+
name: 'fontStyle',
|
|
78
|
+
basePath: field.address.parent(),
|
|
79
|
+
dataSource: [
|
|
80
|
+
{
|
|
81
|
+
label: _jsx(IconWidget, { infer: 'NormalFontStyle' }),
|
|
82
|
+
value: 'normal',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: _jsx(IconWidget, { infer: 'ItalicFontStyle' }),
|
|
86
|
+
value: 'italic',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
component: [Radio.Group, { optionType: 'button' }],
|
|
90
|
+
}),
|
|
91
|
+
}),
|
|
92
|
+
_jsx(InputItems.Item, {
|
|
93
|
+
icon: 'FontColor',
|
|
94
|
+
width: '100%',
|
|
95
|
+
children: _jsx(Field, {
|
|
96
|
+
name: 'color',
|
|
97
|
+
basePath: field.address.parent(),
|
|
98
|
+
component: [ColorInput],
|
|
99
|
+
}),
|
|
100
|
+
}),
|
|
101
|
+
_jsx(InputItems.Item, {
|
|
102
|
+
icon: 'FontSize',
|
|
103
|
+
width: '50%',
|
|
104
|
+
children: _jsx(Field, {
|
|
105
|
+
name: 'fontSize',
|
|
106
|
+
basePath: field.address.parent(),
|
|
107
|
+
component: [SizeInput, { exclude: ['auto'] }],
|
|
108
|
+
}),
|
|
109
|
+
}),
|
|
110
|
+
_jsx(InputItems.Item, {
|
|
111
|
+
icon: 'LineHeight',
|
|
112
|
+
width: '50%',
|
|
113
|
+
children: _jsx(Field, {
|
|
114
|
+
name: 'lineHeight',
|
|
115
|
+
basePath: field.address.parent(),
|
|
116
|
+
component: [SizeInput, { exclude: ['auto'] }],
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
_jsx(InputItems.Item, {
|
|
120
|
+
icon: 'TextAlign',
|
|
121
|
+
children: _jsx(Field, {
|
|
122
|
+
name: 'textAlign',
|
|
123
|
+
basePath: field.address.parent(),
|
|
124
|
+
dataSource: [
|
|
125
|
+
{
|
|
126
|
+
label: _jsx(IconWidget, { infer: 'TextAlignLeft' }),
|
|
127
|
+
value: 'left',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: _jsx(IconWidget, { infer: 'TextAlignCenter' }),
|
|
131
|
+
value: 'center',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
label: _jsx(IconWidget, { infer: 'TextAlignRight' }),
|
|
135
|
+
value: 'right',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: _jsx(IconWidget, { infer: 'TextAlignJustify' }),
|
|
139
|
+
value: 'justify',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
component: [Radio.Group, { optionType: 'button' }],
|
|
143
|
+
}),
|
|
144
|
+
}),
|
|
145
|
+
_jsx(InputItems.Item, {
|
|
146
|
+
icon: 'TextDecoration',
|
|
147
|
+
children: _jsx(Field, {
|
|
148
|
+
name: 'textDecoration',
|
|
149
|
+
basePath: field.address.parent(),
|
|
150
|
+
dataSource: [
|
|
151
|
+
{
|
|
152
|
+
label: '--',
|
|
153
|
+
value: 'none',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: _jsx(IconWidget, { infer: 'TextUnderline' }),
|
|
157
|
+
value: 'underline',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: _jsx(IconWidget, { infer: 'TextLineThrough' }),
|
|
161
|
+
value: 'line-through',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
component: [Radio.Group, { optionType: 'button' }],
|
|
165
|
+
}),
|
|
166
|
+
}),
|
|
167
|
+
],
|
|
168
|
+
}),
|
|
169
|
+
}),
|
|
170
|
+
],
|
|
171
|
+
})
|
|
172
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import './styles.less'
|
|
1
|
+
import { InputProps } from 'antd'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import './styles.less'
|
|
4
4
|
export interface ImageInputProps extends Omit<InputProps, 'onChange'> {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
value?: string
|
|
6
|
+
onChange?: (value: string) => void
|
|
7
7
|
}
|
|
8
|
-
export declare const ImageInput: React.FC<ImageInputProps
|
|
9
|
-
export declare const BackgroundImageInput: React.FC<ImageInputProps
|
|
8
|
+
export declare const ImageInput: React.FC<ImageInputProps>
|
|
9
|
+
export declare const BackgroundImageInput: React.FC<ImageInputProps>
|
|
@@ -1,41 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import './styles.less'
|
|
1
|
+
import { IconWidget, usePrefix } from '@thienvu18/designable-react'
|
|
2
|
+
import { Input, Upload } from 'antd'
|
|
3
|
+
import cls from 'classnames'
|
|
4
|
+
import { useContext } from 'react'
|
|
5
|
+
import { jsx as _jsx } from 'react/jsx-runtime'
|
|
6
|
+
import { SettingsFormContext } from '../../shared/context'
|
|
7
|
+
import './styles.less'
|
|
8
8
|
export const ImageInput = ({ className, style, ...props }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const prefix = usePrefix('image-input')
|
|
10
|
+
const context = useContext(SettingsFormContext)
|
|
11
|
+
return _jsx('div', {
|
|
12
|
+
className: cls(prefix, className),
|
|
13
|
+
style: style,
|
|
14
|
+
children: _jsx(Input, {
|
|
15
|
+
...props,
|
|
16
|
+
onChange: (e) => {
|
|
17
|
+
props.onChange?.(e?.target?.['value'])
|
|
18
|
+
},
|
|
19
|
+
prefix: _jsx(Upload, {
|
|
20
|
+
action: context.uploadAction,
|
|
21
|
+
itemRender: () => null,
|
|
22
|
+
maxCount: 1,
|
|
23
|
+
onChange: (params) => {
|
|
24
|
+
const response = params.file?.response
|
|
25
|
+
const url =
|
|
26
|
+
response?.url ||
|
|
27
|
+
response?.downloadURL ||
|
|
28
|
+
response?.imageURL ||
|
|
29
|
+
response?.thumbUrl
|
|
30
|
+
if (!url) return
|
|
31
|
+
props.onChange?.(url)
|
|
32
|
+
},
|
|
33
|
+
children: _jsx(IconWidget, {
|
|
34
|
+
infer: 'CloudUpload',
|
|
35
|
+
style: { cursor: 'pointer' },
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
40
|
+
}
|
|
24
41
|
export const BackgroundImageInput = (props) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const addBgValue = (value) => {
|
|
43
|
+
if (/url\([^)]+\)/.test(value)) {
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
return `url(${value})`
|
|
47
|
+
}
|
|
48
|
+
const removeBgValue = (value) => {
|
|
49
|
+
const matched = String(value).match(/url\(\s*([^)]+)\s*\)/)
|
|
50
|
+
if (matched?.[1]) {
|
|
51
|
+
return matched?.[1]
|
|
52
|
+
}
|
|
53
|
+
return value
|
|
54
|
+
}
|
|
55
|
+
return _jsx(ImageInput, {
|
|
56
|
+
value: removeBgValue(props.value),
|
|
57
|
+
onChange: (url) => {
|
|
58
|
+
props.onChange?.(addBgValue(url))
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './styles.less'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './styles.less'
|
|
3
3
|
export interface IInputItemsContext {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
width?: string | number
|
|
5
|
+
vertical?: boolean
|
|
6
6
|
}
|
|
7
7
|
export interface IInputItemsProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
className?: string
|
|
9
|
+
style?: React.CSSProperties
|
|
10
|
+
width?: string | number
|
|
11
|
+
vertical?: boolean
|
|
12
12
|
}
|
|
13
13
|
export interface IInputItemProps {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
className?: string
|
|
15
|
+
style?: React.CSSProperties
|
|
16
|
+
icon?: React.ReactNode
|
|
17
|
+
width?: string | number
|
|
18
|
+
vertical?: boolean
|
|
19
|
+
title?: React.ReactNode
|
|
20
|
+
}
|
|
21
|
+
export declare const InputItems: React.FC<
|
|
22
|
+
React.PropsWithChildren<IInputItemsProps>
|
|
23
|
+
> & {
|
|
24
|
+
Item: React.FC<React.PropsWithChildren<IInputItemProps>>
|
|
20
25
|
}
|
|
21
|
-
export declare const InputItems: React.FC<React.PropsWithChildren<IInputItemsProps>> & {
|
|
22
|
-
Item: React.FC<React.PropsWithChildren<IInputItemProps>>;
|
|
23
|
-
};
|
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import './styles.less'
|
|
6
|
-
const InputItemsContext = React.createContext(null)
|
|
1
|
+
import { IconWidget, usePrefix } from '@thienvu18/designable-react'
|
|
2
|
+
import cls from 'classnames'
|
|
3
|
+
import React, { useContext } from 'react'
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime'
|
|
5
|
+
import './styles.less'
|
|
6
|
+
const InputItemsContext = React.createContext(null)
|
|
7
7
|
export const InputItems = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
const { width = '100%', className, style, children } = props
|
|
9
|
+
const prefix = usePrefix('input-items')
|
|
10
|
+
return _jsx(InputItemsContext.Provider, {
|
|
11
|
+
value: { width, vertical: props.vertical },
|
|
12
|
+
children: _jsx('div', {
|
|
13
|
+
className: cls(prefix, className),
|
|
14
|
+
style: style,
|
|
15
|
+
children: children,
|
|
16
|
+
}),
|
|
17
|
+
})
|
|
18
|
+
}
|
|
12
19
|
InputItems.Item = (props) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
20
|
+
const prefix = usePrefix('input-items-item')
|
|
21
|
+
const ctx = useContext(InputItemsContext)
|
|
22
|
+
return _jsxs('div', {
|
|
23
|
+
className: cls(prefix, props.className, {
|
|
24
|
+
vertical: props.vertical || ctx?.vertical,
|
|
25
|
+
}),
|
|
26
|
+
style: { width: props.width || ctx?.width, ...props.style },
|
|
27
|
+
children: [
|
|
28
|
+
props.icon &&
|
|
29
|
+
_jsx('div', {
|
|
30
|
+
className: prefix + '-icon',
|
|
31
|
+
children:
|
|
32
|
+
typeof props.icon === 'string'
|
|
33
|
+
? _jsx(IconWidget, { infer: props.icon, size: 16 })
|
|
34
|
+
: props.icon,
|
|
35
|
+
}),
|
|
36
|
+
props.title &&
|
|
37
|
+
_jsx('div', { className: prefix + '-title', children: props.title }),
|
|
38
|
+
_jsx('div', {
|
|
39
|
+
className: prefix + '-controller',
|
|
40
|
+
children: props.children,
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initMonaco: () => void
|
|
1
|
+
export declare const initMonaco: () => void
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import { loader } from '@monaco-editor/react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
let initialized = false
|
|
1
|
+
import { loader } from '@monaco-editor/react'
|
|
2
|
+
import { format } from './format'
|
|
3
|
+
import chromeTheme from './themes/chrome'
|
|
4
|
+
import monokaiTheme from './themes/monokai'
|
|
5
|
+
let initialized = false
|
|
6
6
|
export const initMonaco = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
7
|
+
if (initialized) return
|
|
8
|
+
loader.init().then((monaco) => {
|
|
9
|
+
monaco.editor.defineTheme('monokai', monokaiTheme)
|
|
10
|
+
monaco.editor.defineTheme('chrome-devtools', chromeTheme)
|
|
11
|
+
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
12
|
+
target: monaco.languages.typescript.ScriptTarget.Latest,
|
|
13
|
+
allowNonTsExtensions: true,
|
|
14
|
+
moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
15
|
+
module: monaco.languages.typescript.ModuleKind.CommonJS,
|
|
16
|
+
noEmit: true,
|
|
17
|
+
esModuleInterop: true,
|
|
18
|
+
jsx: monaco.languages.typescript.JsxEmit.React,
|
|
19
|
+
reactNamespace: 'React',
|
|
20
|
+
allowJs: true,
|
|
21
|
+
})
|
|
22
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
23
|
+
noSemanticValidation: false,
|
|
24
|
+
noSyntaxValidation: true,
|
|
25
|
+
})
|
|
26
|
+
monaco.languages.registerDocumentFormattingEditProvider('typescript', {
|
|
27
|
+
async provideDocumentFormattingEdits(model) {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
text: await format(
|
|
31
|
+
model['getDesignerLanguage']?.() || 'typescript',
|
|
32
|
+
model.getValue()
|
|
33
|
+
),
|
|
34
|
+
range: model.getFullModelRange(),
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
initialized = true
|
|
40
|
+
})
|
|
41
|
+
}
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { parse } from '@babel/parser'
|
|
2
|
-
import { getNpmCDNRegistry } from '../../registry'
|
|
1
|
+
import { parse } from '@babel/parser'
|
|
2
|
+
import { getNpmCDNRegistry } from '../../registry'
|
|
3
3
|
const cache = {
|
|
4
|
-
|
|
5
|
-
}
|
|
4
|
+
prettier: null,
|
|
5
|
+
}
|
|
6
6
|
export const format = async (language, source) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
cache.prettier =
|
|
8
|
+
cache.prettier ||
|
|
9
|
+
new Function(
|
|
10
|
+
`return import("${getNpmCDNRegistry()}/prettier@2.x/esm/standalone.mjs")`
|
|
11
|
+
)()
|
|
12
|
+
return cache.prettier.then((module) => {
|
|
13
|
+
if (
|
|
14
|
+
language === 'javascript.expression' ||
|
|
15
|
+
language === 'typescript.expression'
|
|
16
|
+
) {
|
|
17
|
+
return source
|
|
18
|
+
}
|
|
19
|
+
if (/(?:javascript|typescript)/gi.test(language)) {
|
|
20
|
+
return module.default.format(source, {
|
|
21
|
+
semi: false,
|
|
22
|
+
parser(text) {
|
|
23
|
+
return parse(text, {
|
|
24
|
+
sourceType: 'module',
|
|
25
|
+
plugins: ['typescript', 'jsx'],
|
|
26
|
+
})
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
if (language === 'json') {
|
|
31
|
+
return JSON.stringify(JSON.parse(source), null, 2)
|
|
32
|
+
}
|
|
33
|
+
return source
|
|
34
|
+
})
|
|
35
|
+
}
|