@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,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,63 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isStr } from '@thienvu18/designable-shared'
|
|
5
|
-
import {
|
|
1
|
+
import { isVoidField, onFieldReact } from '@formily/core'
|
|
2
|
+
import { GlobalRegistry } from '@thienvu18/designable-core'
|
|
3
|
+
import { IconWidget } from '@thienvu18/designable-react'
|
|
4
|
+
import { isStr } from '@thienvu18/designable-shared'
|
|
5
|
+
import { jsx as _jsx } from 'react/jsx-runtime'
|
|
6
6
|
const takeIcon = (message) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return;
|
|
13
|
-
};
|
|
7
|
+
if (!isStr(message)) return
|
|
8
|
+
const matched = message.match(/@([^:\s]+)(?:\s*\:\s*([\s\S]+))?/)
|
|
9
|
+
if (matched) return [matched[1], matched[2]]
|
|
10
|
+
return
|
|
11
|
+
}
|
|
14
12
|
const mapEnum = (dataSource) => (item, index) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const label = dataSource[index] || dataSource[item.value] || item.label
|
|
14
|
+
const icon = takeIcon(label)
|
|
15
|
+
return {
|
|
16
|
+
...item,
|
|
17
|
+
value: item?.value ?? null,
|
|
18
|
+
label: icon
|
|
19
|
+
? _jsx(IconWidget, { infer: icon[0], tooltip: icon[1] })
|
|
20
|
+
: label?.label ?? label ?? 'Unknow',
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
23
|
export const useLocales = (node) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
onFieldReact('*', (field) => {
|
|
25
|
+
const path = field.path.toString().replace(/\.[\d+]/g, '')
|
|
26
|
+
const takeMessage = (prop) => {
|
|
27
|
+
const token = `settings.${path}${prop ? `.${prop}` : ''}`
|
|
28
|
+
return node.getMessage(token) || GlobalRegistry.getDesignerMessage(token)
|
|
29
|
+
}
|
|
30
|
+
const title = takeMessage('title') || takeMessage()
|
|
31
|
+
const description = takeMessage('description')
|
|
32
|
+
const tooltip = takeMessage('tooltip')
|
|
33
|
+
const dataSource = takeMessage('dataSource')
|
|
34
|
+
const placeholder = takeMessage('placeholder')
|
|
35
|
+
if (title) {
|
|
36
|
+
field.title = title
|
|
37
|
+
}
|
|
38
|
+
if (description) {
|
|
39
|
+
field.description = description
|
|
40
|
+
}
|
|
41
|
+
if (tooltip) {
|
|
42
|
+
field.decorator[1] = field.decorator[1] || []
|
|
43
|
+
field.decorator[1].tooltip = tooltip
|
|
44
|
+
}
|
|
45
|
+
if (placeholder) {
|
|
46
|
+
field.component[1] = field.component[1] || []
|
|
47
|
+
field.component[1].placeholder = placeholder
|
|
48
|
+
}
|
|
49
|
+
if (!isVoidField(field)) {
|
|
50
|
+
if (dataSource?.length) {
|
|
51
|
+
if (field.dataSource?.length) {
|
|
52
|
+
field.dataSource = field.dataSource.map(mapEnum(dataSource))
|
|
53
|
+
} else {
|
|
54
|
+
field.dataSource = dataSource.slice()
|
|
37
55
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
if (placeholder) {
|
|
46
|
-
field.component[1] = field.component[1] || [];
|
|
47
|
-
field.component[1].placeholder = placeholder;
|
|
48
|
-
}
|
|
49
|
-
if (!isVoidField(field)) {
|
|
50
|
-
if (dataSource?.length) {
|
|
51
|
-
if (field.dataSource?.length) {
|
|
52
|
-
field.dataSource = field.dataSource.map(mapEnum(dataSource));
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
field.dataSource = dataSource.slice();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
field.dataSource = field.dataSource?.filter(Boolean);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
};
|
|
56
|
+
} else {
|
|
57
|
+
field.dataSource = field.dataSource?.filter(Boolean)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -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,10 +1,10 @@
|
|
|
1
|
-
import { onFieldInputValueChange } from '@formily/core'
|
|
2
|
-
let timeRequest = null
|
|
1
|
+
import { onFieldInputValueChange } from '@formily/core'
|
|
2
|
+
let timeRequest = null
|
|
3
3
|
export const useSnapshot = (operation) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
4
|
+
onFieldInputValueChange('*', () => {
|
|
5
|
+
clearTimeout(timeRequest)
|
|
6
|
+
timeRequest = setTimeout(() => {
|
|
7
|
+
operation.snapshot('update:node:props')
|
|
8
|
+
}, 1000)
|
|
9
|
+
})
|
|
10
|
+
}
|
package/esm/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/esm/index.js
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/esm/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
|
package/esm/locales/en-US.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
2
|
+
'en-US': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: 'Expression',
|
|
6
|
+
},
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: 'Help Documents',
|
|
9
|
+
},
|
|
11
10
|
},
|
|
12
|
-
}
|
|
11
|
+
},
|
|
12
|
+
}
|
package/esm/locales/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
package/esm/locales/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GlobalRegistry } from '@thienvu18/designable-core'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
GlobalRegistry.registerDesignerLocales(zhCN, enUS, koKR)
|
|
1
|
+
import { GlobalRegistry } from '@thienvu18/designable-core'
|
|
2
|
+
import enUS from './en-US'
|
|
3
|
+
import koKR from './ko-KR'
|
|
4
|
+
import zhCN from './zh-CN'
|
|
5
|
+
GlobalRegistry.registerDesignerLocales(zhCN, enUS, koKR)
|
package/esm/locales/ko-KR.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
|
+
'ko-KR': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: string
|
|
6
|
+
}
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default _default
|
package/esm/locales/ko-KR.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
2
|
+
'ko-KR': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: '표현식',
|
|
6
|
+
},
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: '도움말 문서',
|
|
9
|
+
},
|
|
11
10
|
},
|
|
12
|
-
}
|
|
11
|
+
},
|
|
12
|
+
}
|
package/esm/locales/zh-CN.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
|
+
'zh-CN': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: string
|
|
6
|
+
}
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default _default
|
package/esm/locales/zh-CN.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
2
|
+
'zh-CN': {
|
|
3
|
+
SettingComponents: {
|
|
4
|
+
ValueInput: {
|
|
5
|
+
expression: '表达式',
|
|
6
|
+
},
|
|
7
|
+
MonacoInput: {
|
|
8
|
+
helpDocument: '帮助文档',
|
|
9
|
+
},
|
|
11
10
|
},
|
|
12
|
-
}
|
|
11
|
+
},
|
|
12
|
+
}
|
package/esm/registry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const setNpmCDNRegistry: (registry: string) => void
|
|
2
|
-
export declare const getNpmCDNRegistry: () => string
|
|
1
|
+
export declare const setNpmCDNRegistry: (registry: string) => void
|
|
2
|
+
export declare const getNpmCDNRegistry: () => string
|
package/esm/registry.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import loader from '@monaco-editor/loader'
|
|
1
|
+
import loader from '@monaco-editor/loader'
|
|
2
2
|
const Registry = {
|
|
3
|
-
|
|
4
|
-
}
|
|
3
|
+
cdn: '//cdn.jsdelivr.net/npm',
|
|
4
|
+
}
|
|
5
5
|
export const setNpmCDNRegistry = (registry) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export const getNpmCDNRegistry = () => String(Registry.cdn).replace(/\/$/, '')
|
|
6
|
+
Registry.cdn = registry
|
|
7
|
+
loader.config({
|
|
8
|
+
paths: {
|
|
9
|
+
vs: `${registry}/monaco-editor@0.30.1/min/vs`,
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
export const getNpmCDNRegistry = () => String(Registry.cdn).replace(/\/$/, '')
|
package/esm/shared/context.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ISettingFormProps } from '../types'
|
|
3
|
-
export declare const SettingsFormContext: import(
|
|
2
|
+
import { ISettingFormProps } from '../types'
|
|
3
|
+
export declare const SettingsFormContext: import('react').Context<ISettingFormProps>
|
package/esm/shared/context.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { createContext } from 'react'
|
|
2
|
-
export const SettingsFormContext = createContext(null)
|
|
1
|
+
import { createContext } from 'react'
|
|
2
|
+
export const SettingsFormContext = createContext(null)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface ILoadScriptProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
package: string
|
|
3
|
+
entry: string
|
|
4
|
+
root: string
|
|
5
|
+
base?: string
|
|
6
6
|
}
|
|
7
|
-
export declare const loadScript: (props: ILoadScriptProps) => Promise<any
|
|
7
|
+
export declare const loadScript: (props: ILoadScriptProps) => Promise<any>
|
package/esm/shared/loadScript.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { globalThisPolyfill } from '@thienvu18/designable-shared'
|
|
2
|
+
import { getNpmCDNRegistry } from '../registry'
|
|
3
3
|
export const loadScript = async (props) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
4
|
+
const options = {
|
|
5
|
+
base: getNpmCDNRegistry(),
|
|
6
|
+
...props,
|
|
7
|
+
}
|
|
8
|
+
if (globalThisPolyfill[props.root]) return globalThisPolyfill[options.root]
|
|
9
|
+
const path = `${options.base}/${options.package}/${options.entry}`
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
const script = document.createElement('script')
|
|
12
|
+
script.type = 'text/javascript'
|
|
13
|
+
script.async = false
|
|
14
|
+
script.src = path
|
|
15
|
+
script.onload = () => {
|
|
16
|
+
const module = globalThisPolyfill[options.root]
|
|
17
|
+
globalThisPolyfill['define'] = define
|
|
18
|
+
resolve(module)
|
|
19
|
+
script.remove()
|
|
20
|
+
}
|
|
21
|
+
script.onerror = (err) => {
|
|
22
|
+
reject(err)
|
|
23
|
+
}
|
|
24
|
+
const define = globalThisPolyfill['define']
|
|
25
|
+
globalThisPolyfill['define'] = undefined
|
|
26
|
+
document.body.appendChild(script)
|
|
27
|
+
})
|
|
28
|
+
}
|
package/esm/styles.less
CHANGED
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.@{ant-prefix}-formily-item {
|
|
70
|
-
border-bottom: 1px solid
|
|
70
|
+
border-bottom: 1px solid
|
|
71
|
+
var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
|
|
71
72
|
padding-bottom: 8px;
|
|
72
73
|
margin-bottom: 8px;
|
|
73
74
|
margin-top: 8px;
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
align-items: center;
|
|
82
83
|
justify-content: flex-end;
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
& > .@{ant-prefix}-radio-group {
|
|
85
86
|
display: flex !important;
|
|
86
87
|
width: 100%;
|
|
87
88
|
|
|
@@ -94,13 +95,13 @@
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
& > .@{ant-prefix}-slider {
|
|
98
99
|
flex-shrink: 0;
|
|
99
100
|
min-width: 0;
|
|
100
101
|
width: 100%;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
& > .@{ant-prefix}-select {
|
|
104
105
|
max-width: 140px;
|
|
105
106
|
}
|
|
106
107
|
}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Form } from '@formily/core'
|
|
2
|
+
import React from 'react'
|
|
3
3
|
export interface ISettingFormProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
className?: string
|
|
5
|
+
style?: React.CSSProperties
|
|
6
|
+
uploadAction?: string
|
|
7
|
+
components?: Record<string, React.FC<any>>
|
|
8
|
+
effects?: (form: Form) => void
|
|
9
|
+
scope?: any
|
|
10
10
|
}
|
package/esm/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|