@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,117 +1,209 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
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.FlexStyleSetter = void 0
|
|
9
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
10
|
+
const react_1 = require('@formily/react')
|
|
11
|
+
const formily_antd_v6_1 = require('@thienvu18/formily-antd-v6')
|
|
12
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
13
|
+
const InputItems_1 = require('../InputItems')
|
|
14
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
15
|
+
require('./styles.less')
|
|
14
16
|
exports.FlexStyleSetter = (0, react_1.observer)((props) => {
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
17
|
+
const field = (0, react_1.useField)()
|
|
18
|
+
const prefix = (0, designable_react_1.usePrefix)('flex-style-setter')
|
|
19
|
+
return (0, jsx_runtime_1.jsx)('div', {
|
|
20
|
+
className: (0, classnames_1.default)(prefix, props.className),
|
|
21
|
+
style: props.style,
|
|
22
|
+
children: (0, jsx_runtime_1.jsxs)(InputItems_1.InputItems, {
|
|
23
|
+
vertical: true,
|
|
24
|
+
children: [
|
|
25
|
+
(0, jsx_runtime_1.jsx)(react_1.Field, {
|
|
26
|
+
name: 'flexDirection',
|
|
27
|
+
basePath: field.address.parent(),
|
|
28
|
+
dataSource: [
|
|
29
|
+
{
|
|
30
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
31
|
+
infer: 'FlexDirectionRow',
|
|
32
|
+
}),
|
|
33
|
+
value: 'row',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
37
|
+
infer: 'FlexDirectionColumn',
|
|
38
|
+
}),
|
|
39
|
+
value: 'column',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
reactions: (field) => {
|
|
43
|
+
field.decorator[1].title = `Flex Direction : ${field.value || ''}`
|
|
44
|
+
},
|
|
45
|
+
decorator: [InputItems_1.InputItems.Item],
|
|
46
|
+
component: [formily_antd_v6_1.Radio.Group, { optionType: 'button' }],
|
|
47
|
+
}),
|
|
48
|
+
(0, jsx_runtime_1.jsx)(react_1.Field, {
|
|
49
|
+
name: 'flexWrap',
|
|
50
|
+
basePath: field.address.parent(),
|
|
51
|
+
dataSource: [
|
|
52
|
+
{
|
|
53
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
54
|
+
infer: 'FlexNoWrap',
|
|
55
|
+
}),
|
|
56
|
+
value: 'nowrap',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
60
|
+
infer: 'FlexWrap',
|
|
61
|
+
}),
|
|
62
|
+
value: 'wrap',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
reactions: (field) => {
|
|
66
|
+
field.decorator[1].title = `Flex Wrap : ${field.value || ''}`
|
|
67
|
+
},
|
|
68
|
+
decorator: [InputItems_1.InputItems.Item],
|
|
69
|
+
component: [formily_antd_v6_1.Radio.Group, { optionType: 'button' }],
|
|
70
|
+
}),
|
|
71
|
+
(0, jsx_runtime_1.jsx)(react_1.Field, {
|
|
72
|
+
name: 'alignContent',
|
|
73
|
+
basePath: field.address.parent(),
|
|
74
|
+
dataSource: [
|
|
75
|
+
{
|
|
76
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
77
|
+
infer: 'FlexAlignContentCenter',
|
|
78
|
+
}),
|
|
79
|
+
value: 'center',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
83
|
+
infer: 'FlexAlignContentStart',
|
|
84
|
+
}),
|
|
85
|
+
value: 'flex-start',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
89
|
+
infer: 'FlexAlignContentEnd',
|
|
90
|
+
}),
|
|
91
|
+
value: 'flex-end',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
95
|
+
infer: 'FlexAlignContentSpaceAround',
|
|
96
|
+
}),
|
|
97
|
+
value: 'space-around',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
101
|
+
infer: 'FlexAlignContentSpaceBetween',
|
|
102
|
+
}),
|
|
103
|
+
value: 'space-between',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
107
|
+
infer: 'FlexAlignContentStretch',
|
|
108
|
+
}),
|
|
109
|
+
value: 'stretch',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
reactions: (field) => {
|
|
113
|
+
field.decorator[1].title = `Align Content : ${field.value || ''}`
|
|
114
|
+
},
|
|
115
|
+
decorator: [InputItems_1.InputItems.Item],
|
|
116
|
+
component: [formily_antd_v6_1.Radio.Group, { optionType: 'button' }],
|
|
117
|
+
}),
|
|
118
|
+
(0, jsx_runtime_1.jsx)(react_1.Field, {
|
|
119
|
+
name: 'justifyContent',
|
|
120
|
+
basePath: field.address.parent(),
|
|
121
|
+
dataSource: [
|
|
122
|
+
{
|
|
123
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
124
|
+
infer: 'FlexJustifyCenter',
|
|
125
|
+
}),
|
|
126
|
+
value: 'center',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
130
|
+
infer: 'FlexJustifyStart',
|
|
131
|
+
}),
|
|
132
|
+
value: 'flex-start',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
136
|
+
infer: 'FlexJustifyEnd',
|
|
137
|
+
}),
|
|
138
|
+
value: 'flex-end',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
142
|
+
infer: 'FlexJustifySpaceAround',
|
|
143
|
+
}),
|
|
144
|
+
value: 'space-around',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
148
|
+
infer: 'FlexJustifySpaceBetween',
|
|
149
|
+
}),
|
|
150
|
+
value: 'space-between',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
154
|
+
infer: 'FlexJustifySpaceEvenly',
|
|
155
|
+
}),
|
|
156
|
+
value: 'space-evenly',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
reactions: (field) => {
|
|
160
|
+
field.decorator[1].title = `Justify Content : ${field.value || ''}`
|
|
161
|
+
},
|
|
162
|
+
decorator: [InputItems_1.InputItems.Item],
|
|
163
|
+
component: [formily_antd_v6_1.Radio.Group, { optionType: 'button' }],
|
|
164
|
+
}),
|
|
165
|
+
(0, jsx_runtime_1.jsx)(react_1.Field, {
|
|
166
|
+
name: 'alignItems',
|
|
167
|
+
basePath: field.address.parent(),
|
|
168
|
+
dataSource: [
|
|
169
|
+
{
|
|
170
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
171
|
+
infer: 'FlexAlignItemsCenter',
|
|
172
|
+
}),
|
|
173
|
+
value: 'center',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
177
|
+
infer: 'FlexAlignItemsStart',
|
|
178
|
+
}),
|
|
179
|
+
value: 'flex-start',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
183
|
+
infer: 'FlexAlignItemsEnd',
|
|
184
|
+
}),
|
|
185
|
+
value: 'flex-end',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
189
|
+
infer: 'FlexAlignItemsStretch',
|
|
190
|
+
}),
|
|
191
|
+
value: 'stretch',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
195
|
+
infer: 'FlexAlignItemsBaseline',
|
|
196
|
+
}),
|
|
197
|
+
value: 'baseline',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
reactions: (field) => {
|
|
201
|
+
field.decorator[1].title = `Align Items : ${field.value || ''}`
|
|
202
|
+
},
|
|
203
|
+
decorator: [InputItems_1.InputItems.Item],
|
|
204
|
+
component: [formily_antd_v6_1.Radio.Group, { optionType: 'button' }],
|
|
205
|
+
}),
|
|
206
|
+
],
|
|
207
|
+
}),
|
|
208
|
+
})
|
|
209
|
+
})
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import './styles.less'
|
|
4
|
-
export declare const FoldItem: React.FC<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import { IFormItemProps } from '@thienvu18/formily-antd-v6'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import './styles.less'
|
|
4
|
+
export declare const FoldItem: React.FC<
|
|
5
|
+
React.PropsWithChildren<IFormItemProps>
|
|
6
|
+
> & {
|
|
7
|
+
Base?: React.FC<React.PropsWithChildren<{}>>
|
|
8
|
+
Extra?: React.FC<React.PropsWithChildren<{}>>
|
|
9
|
+
}
|
|
@@ -1,78 +1,146 @@
|
|
|
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
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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 __setModuleDefault =
|
|
26
|
+
(this && this.__setModuleDefault) ||
|
|
27
|
+
(Object.create
|
|
28
|
+
? function (o, v) {
|
|
29
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v })
|
|
30
|
+
}
|
|
31
|
+
: function (o, v) {
|
|
32
|
+
o['default'] = v
|
|
33
|
+
})
|
|
34
|
+
var __importStar =
|
|
35
|
+
(this && this.__importStar) ||
|
|
36
|
+
function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod
|
|
38
|
+
var result = {}
|
|
39
|
+
if (mod != null)
|
|
40
|
+
for (var k in mod)
|
|
41
|
+
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k))
|
|
42
|
+
__createBinding(result, mod, k)
|
|
43
|
+
__setModuleDefault(result, mod)
|
|
44
|
+
return result
|
|
45
|
+
}
|
|
46
|
+
var __importDefault =
|
|
47
|
+
(this && this.__importDefault) ||
|
|
48
|
+
function (mod) {
|
|
49
|
+
return mod && mod.__esModule ? mod : { default: mod }
|
|
50
|
+
}
|
|
51
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
52
|
+
exports.FoldItem = void 0
|
|
53
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
54
|
+
const react_1 = __importStar(require('react'))
|
|
55
|
+
const formily_antd_v6_1 = require('@thienvu18/formily-antd-v6')
|
|
56
|
+
const react_2 = require('@formily/react')
|
|
57
|
+
const reactive_1 = require('@formily/reactive')
|
|
58
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
59
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
60
|
+
require('./styles.less')
|
|
61
|
+
const ExpandedMap = new Map()
|
|
62
|
+
exports.FoldItem = (0, react_2.observer)(
|
|
63
|
+
({ className, style, children, ...props }) => {
|
|
64
|
+
const prefix = (0, designable_react_1.usePrefix)('fold-item')
|
|
65
|
+
const field = (0, react_2.useField)()
|
|
66
|
+
const expand = (0, react_1.useMemo)(
|
|
67
|
+
() =>
|
|
68
|
+
reactive_1.observable.ref(
|
|
69
|
+
ExpandedMap.get(field?.address?.toString() || '')
|
|
70
|
+
),
|
|
71
|
+
[field?.address]
|
|
72
|
+
)
|
|
43
73
|
const slots = (0, react_1.useRef)({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
slots.current = { base: null, extra: null }
|
|
74
|
+
base: null,
|
|
75
|
+
extra: null,
|
|
76
|
+
})
|
|
77
|
+
slots.current = { base: null, extra: null }
|
|
48
78
|
react_1.default.Children.forEach(children, (node) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
79
|
+
if (react_1.default.isValidElement(node)) {
|
|
80
|
+
if (node?.type?.displayName === 'FoldItem.Base') {
|
|
81
|
+
slots.current.base = node.props?.children
|
|
82
|
+
}
|
|
83
|
+
if (node?.type?.displayName === 'FoldItem.Extra') {
|
|
84
|
+
slots.current.extra = node.props?.children
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
return (0, jsx_runtime_1.jsxs)('div', {
|
|
89
|
+
className: (0, classnames_1.default)(prefix, className),
|
|
90
|
+
style: style,
|
|
91
|
+
children: [
|
|
92
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
93
|
+
className: prefix + '-base',
|
|
94
|
+
onClick: () => {
|
|
95
|
+
expand.value = !expand.value
|
|
96
|
+
if (field?.address) {
|
|
97
|
+
ExpandedMap.set(field.address.toString(), expand.value)
|
|
52
98
|
}
|
|
53
|
-
|
|
54
|
-
|
|
99
|
+
},
|
|
100
|
+
children: (0, jsx_runtime_1.jsx)(
|
|
101
|
+
formily_antd_v6_1.FormItem.BaseItem,
|
|
102
|
+
{
|
|
103
|
+
...props,
|
|
104
|
+
label: (0, jsx_runtime_1.jsxs)('span', {
|
|
105
|
+
className: (0, classnames_1.default)(prefix + '-title', {
|
|
106
|
+
expand: expand.value,
|
|
107
|
+
}),
|
|
108
|
+
children: [
|
|
109
|
+
slots.current.extra &&
|
|
110
|
+
(0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
111
|
+
infer: 'Expand',
|
|
112
|
+
size: 10,
|
|
113
|
+
}),
|
|
114
|
+
props.label,
|
|
115
|
+
],
|
|
116
|
+
}),
|
|
117
|
+
children: (0, jsx_runtime_1.jsx)('div', {
|
|
118
|
+
style: { width: '100%' },
|
|
119
|
+
onClick: (e) => {
|
|
120
|
+
e.stopPropagation()
|
|
121
|
+
},
|
|
122
|
+
children: slots.current.base,
|
|
123
|
+
}),
|
|
55
124
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
125
|
+
),
|
|
126
|
+
}),
|
|
127
|
+
expand.value &&
|
|
128
|
+
slots.current.extra &&
|
|
129
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
130
|
+
className: prefix + '-extra',
|
|
131
|
+
children: slots.current.extra,
|
|
132
|
+
}),
|
|
133
|
+
],
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
)
|
|
69
137
|
const Base = () => {
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
Base.displayName = 'FoldItem.Base'
|
|
138
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {})
|
|
139
|
+
}
|
|
140
|
+
Base.displayName = 'FoldItem.Base'
|
|
73
141
|
const Extra = () => {
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
Extra.displayName = 'FoldItem.Extra'
|
|
77
|
-
exports.FoldItem.Base = Base
|
|
78
|
-
exports.FoldItem.Extra = Extra
|
|
142
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {})
|
|
143
|
+
}
|
|
144
|
+
Extra.displayName = 'FoldItem.Extra'
|
|
145
|
+
exports.FoldItem.Base = Base
|
|
146
|
+
exports.FoldItem.Extra = Extra
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
export interface IFontStyleSetterProps {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
className?: string
|
|
4
|
+
style?: React.CSSProperties
|
|
5
5
|
}
|
|
6
|
-
export declare const FontStyleSetter: React.FC<IFontStyleSetterProps
|
|
6
|
+
export declare const FontStyleSetter: React.FC<IFontStyleSetterProps>
|