@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,21 +1,21 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './styles.less'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './styles.less'
|
|
3
3
|
export interface IInput {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
style?: React.CSSProperties
|
|
5
|
+
className?: string
|
|
6
|
+
value: any
|
|
7
|
+
onChange: (value: any) => void
|
|
8
|
+
exclude?: string[]
|
|
9
|
+
include?: string[]
|
|
10
10
|
}
|
|
11
11
|
export interface IPolyType {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
type: string
|
|
13
|
+
title?: string
|
|
14
|
+
icon?: string
|
|
15
|
+
component?: any
|
|
16
|
+
checker: (value: any) => boolean
|
|
17
|
+
toInputValue?: (value: any) => any
|
|
18
|
+
toChangeValue?: (value: any) => any
|
|
19
19
|
}
|
|
20
|
-
export type PolyTypes = IPolyType[]
|
|
21
|
-
export declare function createPolyInput(polyTypes?: PolyTypes): React.FC<IInput
|
|
20
|
+
export type PolyTypes = IPolyType[]
|
|
21
|
+
export declare function createPolyInput(polyTypes?: PolyTypes): React.FC<IInput>
|
|
@@ -1,100 +1,155 @@
|
|
|
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
|
-
|
|
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.createPolyInput = void 0
|
|
53
|
+
const jsx_runtime_1 = require('react/jsx-runtime')
|
|
54
|
+
const react_1 = __importStar(require('react'))
|
|
55
|
+
const antd_1 = require('antd')
|
|
56
|
+
const designable_react_1 = require('@thienvu18/designable-react')
|
|
57
|
+
const classnames_1 = __importDefault(require('classnames'))
|
|
58
|
+
require('./styles.less')
|
|
59
|
+
const isValid = (val) => val !== undefined && val !== null
|
|
37
60
|
const getEventValue = (event) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return event;
|
|
46
|
-
};
|
|
61
|
+
if (event?.target) {
|
|
62
|
+
if (isValid(event.target.value)) return event.target.value
|
|
63
|
+
if (isValid(event.target.checked)) return event.target.checked
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
return event
|
|
67
|
+
}
|
|
47
68
|
const createTypes = (types, exclude, include) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
69
|
+
return types.filter(({ type }) => {
|
|
70
|
+
if (Array.isArray(include) && include.length) {
|
|
71
|
+
return include.includes(type)
|
|
72
|
+
}
|
|
73
|
+
if (Array.isArray(exclude) && exclude.length) {
|
|
74
|
+
return !exclude.includes(type)
|
|
75
|
+
}
|
|
76
|
+
return true
|
|
77
|
+
})
|
|
78
|
+
}
|
|
58
79
|
function createPolyInput(polyTypes = []) {
|
|
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
|
-
|
|
80
|
+
return ({
|
|
81
|
+
className,
|
|
82
|
+
style,
|
|
83
|
+
value,
|
|
84
|
+
onChange,
|
|
85
|
+
exclude,
|
|
86
|
+
include,
|
|
87
|
+
...props
|
|
88
|
+
}) => {
|
|
89
|
+
const prefix = (0, designable_react_1.usePrefix)('poly-input')
|
|
90
|
+
const types = createTypes(polyTypes, exclude, include)
|
|
91
|
+
const [current, setCurrent] = (0, react_1.useState)(types[0]?.type)
|
|
92
|
+
const type = types?.find(({ type }) => type === current)
|
|
93
|
+
const component = type?.component
|
|
94
|
+
const typesValue = (0, react_1.useRef)({})
|
|
95
|
+
;(0, react_1.useEffect)(() => {
|
|
96
|
+
types?.forEach(({ checker, type }) => {
|
|
97
|
+
if (checker(value)) {
|
|
98
|
+
setCurrent(type)
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}, [value])
|
|
102
|
+
const getNextType = () => {
|
|
103
|
+
const currentIndex = types?.findIndex(({ type }) => type === current)
|
|
104
|
+
const nextIndex =
|
|
105
|
+
currentIndex + 1 > types?.length - 1 ? 0 : currentIndex + 1
|
|
106
|
+
return types[nextIndex]
|
|
107
|
+
}
|
|
108
|
+
const transformOnChangeValue = (value, type) => {
|
|
109
|
+
return type?.toChangeValue ? type?.toChangeValue(value) : value
|
|
110
|
+
}
|
|
111
|
+
return (0, jsx_runtime_1.jsxs)('div', {
|
|
112
|
+
className: (0, classnames_1.default)(prefix, className),
|
|
113
|
+
style: style,
|
|
114
|
+
children: [
|
|
115
|
+
component &&
|
|
116
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
117
|
+
className: prefix + '-content',
|
|
118
|
+
children: react_1.default.createElement(component, {
|
|
119
|
+
...props,
|
|
120
|
+
value: type?.toInputValue ? type?.toInputValue(value) : value,
|
|
121
|
+
onChange: (event) => {
|
|
122
|
+
const value = getEventValue(event)
|
|
123
|
+
typesValue.current[type?.type] = value
|
|
124
|
+
onChange?.(transformOnChangeValue(value, type))
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
}),
|
|
128
|
+
(0, jsx_runtime_1.jsx)(antd_1.Button, {
|
|
129
|
+
className: prefix + '-controller',
|
|
130
|
+
style: {
|
|
131
|
+
width: !component ? '100%' : 'auto',
|
|
132
|
+
},
|
|
133
|
+
block: true,
|
|
134
|
+
onClick: () => {
|
|
135
|
+
const nextType = getNextType()
|
|
136
|
+
if (nextType === type) return
|
|
137
|
+
setCurrent(nextType?.type)
|
|
138
|
+
onChange?.(
|
|
139
|
+
transformOnChangeValue(
|
|
140
|
+
typesValue.current[nextType?.type],
|
|
141
|
+
nextType
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
},
|
|
145
|
+
children: type?.icon
|
|
146
|
+
? (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
|
|
147
|
+
infer: type.icon,
|
|
148
|
+
})
|
|
149
|
+
: type?.title || type?.type,
|
|
150
|
+
}),
|
|
151
|
+
],
|
|
152
|
+
})
|
|
153
|
+
}
|
|
99
154
|
}
|
|
100
|
-
exports.createPolyInput = createPolyInput
|
|
155
|
+
exports.createPolyInput = createPolyInput
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './styles.less'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './styles.less'
|
|
3
3
|
export interface IPositionInputProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
className?: string
|
|
5
|
+
style?: React.CSSProperties
|
|
6
|
+
value?: string
|
|
7
|
+
onChange?: (value: string) => void
|
|
8
8
|
}
|
|
9
|
-
export declare const PositionInput: React.FC<IPositionInputProps
|
|
9
|
+
export declare const PositionInput: React.FC<IPositionInputProps>
|
|
@@ -1,29 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
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.PositionInput = 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 classnames_1 = __importDefault(require('classnames'))
|
|
13
|
+
require('./styles.less')
|
|
12
14
|
const PositionInput = (props) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
15
|
+
const prefix = (0, designable_react_1.usePrefix)('position-input')
|
|
16
|
+
const [current, setCurrent] = (0, react_1.useState)(props.value)
|
|
17
|
+
;(0, react_1.useEffect)(() => {
|
|
18
|
+
if (!props.value) {
|
|
19
|
+
setCurrent('center')
|
|
20
|
+
}
|
|
21
|
+
}, [props.value])
|
|
22
|
+
const createCellProps = (type) => ({
|
|
23
|
+
className: (0, classnames_1.default)(prefix + '-cell', {
|
|
24
|
+
active: current === type,
|
|
25
|
+
}),
|
|
26
|
+
onClick() {
|
|
27
|
+
setCurrent(type)
|
|
28
|
+
props.onChange?.(type)
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
return (0, jsx_runtime_1.jsxs)('div', {
|
|
32
|
+
className: (0, classnames_1.default)(prefix, props.className),
|
|
33
|
+
style: props.style,
|
|
34
|
+
children: [
|
|
35
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
36
|
+
className: prefix + '-row',
|
|
37
|
+
children: (0, jsx_runtime_1.jsx)('div', {
|
|
38
|
+
...createCellProps('top'),
|
|
39
|
+
children: '\u2533',
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
(0, jsx_runtime_1.jsxs)('div', {
|
|
43
|
+
className: prefix + '-row',
|
|
44
|
+
children: [
|
|
45
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
46
|
+
...createCellProps('left'),
|
|
47
|
+
children: '\u2523',
|
|
48
|
+
}),
|
|
49
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
50
|
+
...createCellProps('center'),
|
|
51
|
+
children: '\u254B',
|
|
52
|
+
}),
|
|
53
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
54
|
+
...createCellProps('right'),
|
|
55
|
+
children: '\u252B',
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
(0, jsx_runtime_1.jsx)('div', {
|
|
60
|
+
className: prefix + '-row',
|
|
61
|
+
children: (0, jsx_runtime_1.jsx)('div', {
|
|
62
|
+
...createCellProps('bottom'),
|
|
63
|
+
children: '\u253B',
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
exports.PositionInput = PositionInput
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const SizeInput: import(
|
|
3
|
-
|
|
2
|
+
export declare const SizeInput: import('react').FC<
|
|
3
|
+
import('../PolyInput').IInput
|
|
4
|
+
>
|
|
5
|
+
export declare const BackgroundSizeInput: import('react').FC<
|
|
6
|
+
import('../PolyInput').IInput
|
|
7
|
+
>
|
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.BackgroundSizeInput = exports.SizeInput = void 0
|
|
4
|
-
const antd_1 = require(
|
|
5
|
-
const PolyInput_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.BackgroundSizeInput = exports.SizeInput = void 0
|
|
4
|
+
const antd_1 = require('antd')
|
|
5
|
+
const PolyInput_1 = require('../PolyInput')
|
|
6
6
|
const takeNumber = (value) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
7
|
+
const num = String(value)
|
|
8
|
+
.trim()
|
|
9
|
+
.replace(/[^\d\.]+/, '')
|
|
10
|
+
if (num === '') return
|
|
11
|
+
return Number(num)
|
|
12
|
+
}
|
|
14
13
|
const createUnitType = (type) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
checker(value) {
|
|
19
|
-
return String(value).includes(type);
|
|
20
|
-
},
|
|
21
|
-
toInputValue(value) {
|
|
22
|
-
return takeNumber(value);
|
|
23
|
-
},
|
|
24
|
-
toChangeValue(value) {
|
|
25
|
-
return `${value || 0}${type}`;
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const createSpecialSizeOption = (type) => ({
|
|
30
|
-
type: type,
|
|
14
|
+
return {
|
|
15
|
+
type,
|
|
16
|
+
component: antd_1.InputNumber,
|
|
31
17
|
checker(value) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
return String(value).includes(type)
|
|
19
|
+
},
|
|
20
|
+
toInputValue(value) {
|
|
21
|
+
return takeNumber(value)
|
|
35
22
|
},
|
|
36
|
-
toChangeValue() {
|
|
37
|
-
|
|
23
|
+
toChangeValue(value) {
|
|
24
|
+
return `${value || 0}${type}`
|
|
38
25
|
},
|
|
39
|
-
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const createSpecialSizeOption = (type) => ({
|
|
29
|
+
type: type,
|
|
30
|
+
checker(value) {
|
|
31
|
+
if (value === type) return true
|
|
32
|
+
return false
|
|
33
|
+
},
|
|
34
|
+
toChangeValue() {
|
|
35
|
+
return type
|
|
36
|
+
},
|
|
37
|
+
})
|
|
40
38
|
const NormalSizeOptions = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
]
|
|
48
|
-
exports.SizeInput = (0, PolyInput_1.createPolyInput)(NormalSizeOptions)
|
|
39
|
+
createSpecialSizeOption('inherit'),
|
|
40
|
+
createSpecialSizeOption('auto'),
|
|
41
|
+
createUnitType('px'),
|
|
42
|
+
createUnitType('%'),
|
|
43
|
+
createUnitType('vh'),
|
|
44
|
+
createUnitType('em'),
|
|
45
|
+
]
|
|
46
|
+
exports.SizeInput = (0, PolyInput_1.createPolyInput)(NormalSizeOptions)
|
|
49
47
|
exports.BackgroundSizeInput = (0, PolyInput_1.createPolyInput)([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
])
|
|
48
|
+
createSpecialSizeOption('cover'),
|
|
49
|
+
createSpecialSizeOption('contain'),
|
|
50
|
+
createUnitType('px'),
|
|
51
|
+
createUnitType('%'),
|
|
52
|
+
createUnitType('vh'),
|
|
53
|
+
createUnitType('em'),
|
|
54
|
+
])
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
export declare const ValueInput: React.FC<import(
|
|
1
|
+
import React from 'react'
|
|
2
|
+
export declare const ValueInput: React.FC<import('../PolyInput').IInput>
|