@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,80 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
require(
|
|
20
|
-
const
|
|
1
|
+
'use strict'
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
8
|
+
exports.BorderStyleSetter = void 0
|
|
9
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
10
|
+
const react_1 = require('react')
|
|
11
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
12
|
+
const shared_1 = require('@formily/shared')
|
|
13
|
+
const formily_antd_v6_1 = require('@thienvu18/formily-antd-v6')
|
|
14
|
+
const reactive_1 = require('@formily/reactive')
|
|
15
|
+
const react_2 = require('@formily/react')
|
|
16
|
+
const FoldItem_1 = require('../FoldItem')
|
|
17
|
+
const ColorInput_1 = require('../ColorInput')
|
|
18
|
+
const SizeInput_1 = require('../SizeInput')
|
|
19
|
+
const PositionInput_1 = require('../PositionInput')
|
|
20
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
21
|
+
require('./styles.less')
|
|
22
|
+
const Positions = ['center', 'top', 'right', 'bottom', 'left']
|
|
21
23
|
const BorderStyleOptions = [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
{
|
|
25
|
+
label: 'None',
|
|
26
|
+
value: 'none',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: (0, jsx_runtime_1.jsx)('span', {
|
|
30
|
+
className: 'border-style-solid-line',
|
|
31
|
+
}),
|
|
32
|
+
value: 'solid',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: (0, jsx_runtime_1.jsx)('span', {
|
|
36
|
+
className: 'border-style-dashed-line',
|
|
37
|
+
}),
|
|
38
|
+
value: 'dashed',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: (0, jsx_runtime_1.jsx)('span', {
|
|
42
|
+
className: 'border-style-dotted-line',
|
|
43
|
+
}),
|
|
44
|
+
value: 'dotted',
|
|
45
|
+
},
|
|
46
|
+
]
|
|
39
47
|
const createBorderProp = (position, key) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
48
|
+
const insert = position === 'center' ? '' : `-${position}`
|
|
49
|
+
return (0, shared_1.camelCase)(`border${insert}-${key}`)
|
|
50
|
+
}
|
|
43
51
|
const parseInitPosition = (field) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const basePath = field.address.parent()
|
|
53
|
+
for (let i = 0; i < Positions.length; i++) {
|
|
54
|
+
const position = Positions[i]
|
|
55
|
+
const stylePath = `${basePath}.${createBorderProp(position, 'style')}`
|
|
56
|
+
const widthPath = `${basePath}.${createBorderProp(position, 'width')}`
|
|
57
|
+
const colorPath = `${basePath}.${createBorderProp(position, 'color')}`
|
|
58
|
+
if (
|
|
59
|
+
field.query(stylePath).value() ||
|
|
60
|
+
field.query(widthPath).value() ||
|
|
61
|
+
field.query(colorPath).value()
|
|
62
|
+
) {
|
|
63
|
+
return position
|
|
55
64
|
}
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
}
|
|
66
|
+
return 'center'
|
|
67
|
+
}
|
|
58
68
|
exports.BorderStyleSetter = (0, react_2.observer)(({ className, style }) => {
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
const field = (0, react_2.useField)()
|
|
70
|
+
const currentPosition = (0, react_1.useMemo)(
|
|
71
|
+
() =>
|
|
72
|
+
(0, reactive_1.observable)({
|
|
61
73
|
value: parseInitPosition(field),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
}),
|
|
75
|
+
[field.value]
|
|
76
|
+
)
|
|
77
|
+
const prefix = (0, designable_react_1.usePrefix)('border-style-setter')
|
|
78
|
+
const createReaction = (position) => (field) => {
|
|
79
|
+
field.display = currentPosition.value === position ? 'visible' : 'hidden'
|
|
80
|
+
if (position !== 'center') {
|
|
81
|
+
const borderStyle = field.query('.borderStyle').value()
|
|
82
|
+
const borderWidth = field.query('.borderWidth').value()
|
|
83
|
+
const borderColor = field.query('.borderColor').value()
|
|
84
|
+
if (borderStyle || borderWidth || borderColor) {
|
|
85
|
+
field.value = undefined
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem, {
|
|
90
|
+
label: field.title,
|
|
91
|
+
children: (0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem.Extra, {
|
|
92
|
+
children: (0, jsx_runtime_1.jsxs)('div', {
|
|
93
|
+
className: (0, classnames_1.default)(prefix, className),
|
|
94
|
+
style: style,
|
|
95
|
+
children: [
|
|
96
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
97
|
+
className: prefix + '-position',
|
|
98
|
+
children: (0, jsx_runtime_1.jsx)(PositionInput_1.PositionInput, {
|
|
99
|
+
value: currentPosition.value,
|
|
100
|
+
onChange: (value) => {
|
|
101
|
+
currentPosition.value = value
|
|
102
|
+
},
|
|
103
|
+
}),
|
|
104
|
+
}),
|
|
105
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
106
|
+
className: prefix + '-input',
|
|
107
|
+
children: Positions.map((position, key) => {
|
|
108
|
+
return (0, jsx_runtime_1.jsxs)(
|
|
109
|
+
react_1.Fragment,
|
|
110
|
+
{
|
|
111
|
+
children: [
|
|
112
|
+
(0, jsx_runtime_1.jsx)(react_2.Field, {
|
|
113
|
+
name: createBorderProp(position, 'style'),
|
|
114
|
+
basePath: field.address.parent(),
|
|
115
|
+
dataSource: BorderStyleOptions,
|
|
116
|
+
reactions: createReaction(position),
|
|
117
|
+
component: [
|
|
118
|
+
formily_antd_v6_1.Select,
|
|
119
|
+
{ placeholder: 'Please Select' },
|
|
120
|
+
],
|
|
121
|
+
}),
|
|
122
|
+
(0, jsx_runtime_1.jsx)(react_2.Field, {
|
|
123
|
+
name: createBorderProp(position, 'width'),
|
|
124
|
+
basePath: field.address.parent(),
|
|
125
|
+
reactions: createReaction(position),
|
|
126
|
+
component: [SizeInput_1.SizeInput, { exclude: ['auto'] }],
|
|
127
|
+
}),
|
|
128
|
+
(0, jsx_runtime_1.jsx)(react_2.Field, {
|
|
129
|
+
name: createBorderProp(position, 'color'),
|
|
130
|
+
basePath: field.address.parent(),
|
|
131
|
+
reactions: createReaction(position),
|
|
132
|
+
component: [ColorInput_1.ColorInput],
|
|
133
|
+
}),
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
key
|
|
137
|
+
)
|
|
138
|
+
}),
|
|
139
|
+
}),
|
|
140
|
+
],
|
|
141
|
+
}),
|
|
142
|
+
}),
|
|
143
|
+
})
|
|
144
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
export interface IBoxShadowStyleSetterProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
className?: string
|
|
4
|
+
style?: React.CSSProperties
|
|
5
|
+
value?: string
|
|
6
|
+
onChange?: (value: string) => void
|
|
7
7
|
}
|
|
8
|
-
export declare const BoxShadowStyleSetter: React.FC<IBoxShadowStyleSetterProps
|
|
8
|
+
export declare const BoxShadowStyleSetter: React.FC<IBoxShadowStyleSetterProps>
|
|
@@ -1,31 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
1
|
+
'use strict'
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
8
|
+
exports.BoxShadowStyleSetter = void 0
|
|
9
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
10
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
11
|
+
const react_1 = require('@formily/react')
|
|
12
|
+
const FoldItem_1 = require('../FoldItem')
|
|
13
|
+
const ColorInput_1 = require('../ColorInput')
|
|
14
|
+
const SizeInput_1 = require('../SizeInput')
|
|
15
|
+
const InputItems_1 = require('../InputItems')
|
|
16
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
15
17
|
exports.BoxShadowStyleSetter = (0, react_1.observer)((props) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
18
|
+
const field = (0, react_1.useField)()
|
|
19
|
+
const prefix = (0, designable_react_1.usePrefix)('shadow-style-setter')
|
|
20
|
+
const createBoxShadowConnector = (position) => {
|
|
21
|
+
const splited = String(props.value || '')
|
|
22
|
+
.trim()
|
|
23
|
+
.split(' ')
|
|
24
|
+
return {
|
|
25
|
+
value: splited[position],
|
|
26
|
+
onChange: (value) => {
|
|
27
|
+
splited[position] = value
|
|
28
|
+
props.onChange?.(
|
|
29
|
+
`${splited[0] || ''} ${splited[1] || ''} ${splited[2] || ''} ${
|
|
30
|
+
splited[3] || ''
|
|
31
|
+
} ${splited[4] || ''}`
|
|
32
|
+
)
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return (0, jsx_runtime_1.jsxs)(FoldItem_1.FoldItem, {
|
|
37
|
+
className: (0, classnames_1.default)(prefix, props.className),
|
|
38
|
+
style: props.style,
|
|
39
|
+
label: field.title,
|
|
40
|
+
children: [
|
|
41
|
+
(0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem.Base, {
|
|
42
|
+
children: (0, jsx_runtime_1.jsx)(ColorInput_1.ColorInput, {
|
|
43
|
+
...createBoxShadowConnector(4),
|
|
44
|
+
}),
|
|
45
|
+
}),
|
|
46
|
+
(0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem.Extra, {
|
|
47
|
+
children: (0, jsx_runtime_1.jsxs)(InputItems_1.InputItems, {
|
|
48
|
+
width: '50%',
|
|
49
|
+
children: [
|
|
50
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
51
|
+
icon: 'AxisX',
|
|
52
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
53
|
+
exclude: ['inherit', 'auto'],
|
|
54
|
+
...createBoxShadowConnector(0),
|
|
55
|
+
}),
|
|
56
|
+
}),
|
|
57
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
58
|
+
icon: 'AxisY',
|
|
59
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
60
|
+
exclude: ['inherit', 'auto'],
|
|
61
|
+
...createBoxShadowConnector(1),
|
|
62
|
+
}),
|
|
63
|
+
}),
|
|
64
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
65
|
+
icon: 'Blur',
|
|
66
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
67
|
+
exclude: ['inherit', 'auto'],
|
|
68
|
+
...createBoxShadowConnector(2),
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
72
|
+
icon: 'Shadow',
|
|
73
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
74
|
+
exclude: ['inherit', 'auto'],
|
|
75
|
+
...createBoxShadowConnector(3),
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
}),
|
|
80
|
+
}),
|
|
81
|
+
],
|
|
82
|
+
})
|
|
83
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
export interface IMarginStyleSetterProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
className?: string
|
|
4
|
+
style?: React.CSSProperties
|
|
5
|
+
labels?: React.ReactNode[]
|
|
6
|
+
value?: string
|
|
7
|
+
onChange?: (value: string) => void
|
|
8
8
|
}
|
|
9
|
-
export declare const BoxStyleSetter: React.FC<IMarginStyleSetterProps
|
|
9
|
+
export declare const BoxStyleSetter: React.FC<IMarginStyleSetterProps>
|
|
@@ -1,55 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
1
|
+
'use strict'
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
8
|
+
exports.BoxStyleSetter = void 0
|
|
9
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
10
|
+
const react_1 = require('@formily/react')
|
|
11
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
12
|
+
const FoldItem_1 = require('../FoldItem')
|
|
13
|
+
const SizeInput_1 = require('../SizeInput')
|
|
14
|
+
const InputItems_1 = require('../InputItems')
|
|
15
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
14
16
|
const PositionMap = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
const BoxRex =
|
|
17
|
+
top: 1,
|
|
18
|
+
right: 2,
|
|
19
|
+
bottom: 3,
|
|
20
|
+
left: 4,
|
|
21
|
+
all: 1,
|
|
22
|
+
}
|
|
23
|
+
const BoxRex =
|
|
24
|
+
/([\d\.]+[^\d\s\.+-]+)(?:\s+([\d\.]+[^\d\s\.+-]+)(?:\s+([\d\.]+[^\d\s\.+-]+)(?:\s+([\d\.]+[^\d\s\.+-]+))?)?)?/
|
|
22
25
|
const defaultLabels = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
(0, jsx_runtime_1.jsx)(
|
|
27
|
+
designable_react_1.IconWidget,
|
|
28
|
+
{ infer: 'Top', size: 16 },
|
|
29
|
+
'1'
|
|
30
|
+
),
|
|
31
|
+
(0, jsx_runtime_1.jsx)(
|
|
32
|
+
designable_react_1.IconWidget,
|
|
33
|
+
{ infer: 'Right', size: 16 },
|
|
34
|
+
'2'
|
|
35
|
+
),
|
|
36
|
+
(0, jsx_runtime_1.jsx)(
|
|
37
|
+
designable_react_1.IconWidget,
|
|
38
|
+
{ infer: 'Bottom', size: 16 },
|
|
39
|
+
'3'
|
|
40
|
+
),
|
|
41
|
+
(0, jsx_runtime_1.jsx)(
|
|
42
|
+
designable_react_1.IconWidget,
|
|
43
|
+
{ infer: 'Left', size: 16 },
|
|
44
|
+
'4'
|
|
45
|
+
),
|
|
46
|
+
]
|
|
28
47
|
exports.BoxStyleSetter = (0, react_1.observer)((props) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
48
|
+
const { labels = defaultLabels, className } = props
|
|
49
|
+
const field = (0, react_1.useField)()
|
|
50
|
+
const prefix = (0, designable_react_1.usePrefix)('box-style-setter')
|
|
51
|
+
const createPositionHandler = (position, setterProps) => {
|
|
52
|
+
const matched = String(setterProps.value).match(BoxRex) || []
|
|
53
|
+
const value = matched[PositionMap[position]]
|
|
54
|
+
const v1 = matched[1]
|
|
55
|
+
const v2 = matched[2]
|
|
56
|
+
const v3 = matched[3]
|
|
57
|
+
const v4 = matched[4]
|
|
58
|
+
const allEqualls = v1 === v2 && v2 === v3 && v3 === v4
|
|
59
|
+
return {
|
|
60
|
+
...setterProps,
|
|
61
|
+
value: position === 'all' ? (allEqualls ? v1 : undefined) : value,
|
|
62
|
+
onChange(val) {
|
|
63
|
+
if (position === 'all') {
|
|
64
|
+
setterProps.onChange?.(
|
|
65
|
+
`${val || '0px'} ${val || '0px'} ${val || '0px'} ${val || '0px'}`
|
|
66
|
+
)
|
|
67
|
+
} else {
|
|
68
|
+
matched[PositionMap[position]] = val
|
|
69
|
+
setterProps.onChange?.(
|
|
70
|
+
`${matched[1] || '0px'} ${matched[2] || '0px'} ${
|
|
71
|
+
matched[3] || '0px'
|
|
72
|
+
} ${matched[4] || '0px'}`
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return (0, jsx_runtime_1.jsxs)(FoldItem_1.FoldItem, {
|
|
79
|
+
className: (0, classnames_1.default)(prefix, className),
|
|
80
|
+
label: field.title,
|
|
81
|
+
children: [
|
|
82
|
+
(0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem.Base, {
|
|
83
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
84
|
+
...createPositionHandler('all', props),
|
|
85
|
+
exclude: ['inherit', 'auto'],
|
|
86
|
+
}),
|
|
87
|
+
}),
|
|
88
|
+
(0, jsx_runtime_1.jsx)(FoldItem_1.FoldItem.Extra, {
|
|
89
|
+
children: (0, jsx_runtime_1.jsxs)(InputItems_1.InputItems, {
|
|
90
|
+
width: '50%',
|
|
91
|
+
children: [
|
|
92
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
93
|
+
icon: labels[0],
|
|
94
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
95
|
+
...createPositionHandler('top', props),
|
|
96
|
+
exclude: ['inherit', 'auto'],
|
|
97
|
+
}),
|
|
98
|
+
}),
|
|
99
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
100
|
+
icon: labels[1],
|
|
101
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
102
|
+
...createPositionHandler('right', props),
|
|
103
|
+
exclude: ['inherit', 'auto'],
|
|
104
|
+
}),
|
|
105
|
+
}),
|
|
106
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
107
|
+
icon: labels[2],
|
|
108
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
109
|
+
...createPositionHandler('bottom', props),
|
|
110
|
+
exclude: ['inherit', 'auto'],
|
|
111
|
+
}),
|
|
112
|
+
}),
|
|
113
|
+
(0, jsx_runtime_1.jsx)(InputItems_1.InputItems.Item, {
|
|
114
|
+
icon: labels[3],
|
|
115
|
+
children: (0, jsx_runtime_1.jsx)(SizeInput_1.SizeInput, {
|
|
116
|
+
...createPositionHandler('left', props),
|
|
117
|
+
exclude: ['inherit', 'auto'],
|
|
118
|
+
}),
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
],
|
|
124
|
+
})
|
|
125
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './styles.less'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './styles.less'
|
|
3
3
|
export interface ICollapseItemProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
className?: string
|
|
5
|
+
style?: React.CSSProperties
|
|
6
|
+
defaultExpand?: boolean
|
|
7
7
|
}
|
|
8
|
-
export declare const CollapseItem: React.FC<ICollapseItemProps
|
|
8
|
+
export declare const CollapseItem: React.FC<ICollapseItemProps>
|
|
@@ -1,22 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
require(
|
|
1
|
+
'use strict'
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
8
|
+
exports.CollapseItem = void 0
|
|
9
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
10
|
+
const react_1 = require('react')
|
|
11
|
+
const react_2 = require('@formily/react')
|
|
12
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
13
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
14
|
+
require('./styles.less')
|
|
13
15
|
exports.CollapseItem = (0, react_2.observer)((props) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const prefix = (0, designable_react_1.usePrefix)('collapse-item')
|
|
17
|
+
const field = (0, react_2.useField)()
|
|
18
|
+
const [expand, setExpand] = (0, react_1.useState)(props.defaultExpand ?? true)
|
|
19
|
+
return (0, jsx_runtime_1.jsxs)('div', {
|
|
20
|
+
className: (0, classnames_1.default)(prefix, props.className, { expand }),
|
|
21
|
+
style: props.style,
|
|
22
|
+
children: [
|
|
23
|
+
(0, jsx_runtime_1.jsxs)('div', {
|
|
24
|
+
className: prefix + '-header',
|
|
25
|
+
onClick: (e) => {
|
|
26
|
+
e.stopPropagation()
|
|
27
|
+
e.preventDefault()
|
|
28
|
+
setExpand(!expand)
|
|
29
|
+
},
|
|
30
|
+
children: [
|
|
31
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
32
|
+
className: prefix + '-header-expand',
|
|
33
|
+
children: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
34
|
+
infer: 'Expand',
|
|
35
|
+
size: 10,
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
39
|
+
className: prefix + '-header-content',
|
|
40
|
+
children: field.title,
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
}),
|
|
44
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
45
|
+
className: prefix + '-content',
|
|
46
|
+
children: props.children,
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
49
|
+
})
|
|
50
|
+
})
|