@formily-design/react 1.0.0 → 1.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/panels/styles.less +14 -0
- package/lib/panels/styles.less +14 -0
- package/package.json +4 -4
- package/copy.ts +0 -6
- package/dist/designable.react.umd.production.css +0 -1
- package/dist/designable.react.umd.production.js +0 -6
- package/dist/designable.react.umd.production.min.css +0 -1
- package/dist/designable.react.umd.production.min.js +0 -3769
- package/rollup.config.js +0 -3
- package/src/containers/Designer.tsx +0 -50
- package/src/containers/Layout.tsx +0 -50
- package/src/containers/Simulator.tsx +0 -30
- package/src/containers/Viewport.tsx +0 -69
- package/src/containers/Workbench.tsx +0 -15
- package/src/containers/Workspace.tsx +0 -41
- package/src/containers/index.ts +0 -7
- package/src/containers/styles.less +0 -19
- package/src/context.ts +0 -17
- package/src/hooks/index.ts +0 -25
- package/src/hooks/useComponents.ts +0 -3
- package/src/hooks/useCursor.ts +0 -6
- package/src/hooks/useDesigner.ts +0 -19
- package/src/hooks/useHistory.ts +0 -6
- package/src/hooks/useHover.ts +0 -6
- package/src/hooks/useLayout.ts +0 -11
- package/src/hooks/useMoveHelper.ts +0 -6
- package/src/hooks/useNodeIdProps.ts +0 -11
- package/src/hooks/useOperation.ts +0 -6
- package/src/hooks/useOutline.ts +0 -6
- package/src/hooks/usePosition.ts +0 -5
- package/src/hooks/usePrefix.ts +0 -5
- package/src/hooks/useRegistry.ts +0 -6
- package/src/hooks/useScreen.ts +0 -5
- package/src/hooks/useSelected.ts +0 -6
- package/src/hooks/useSelectedNode.ts +0 -14
- package/src/hooks/useSelection.ts +0 -6
- package/src/hooks/useTheme.ts +0 -5
- package/src/hooks/useTransformHelper.ts +0 -6
- package/src/hooks/useTree.ts +0 -6
- package/src/hooks/useTreeNode.ts +0 -6
- package/src/hooks/useValidNodeOffsetRect.ts +0 -48
- package/src/hooks/useViewport.ts +0 -6
- package/src/hooks/useWorkbench.ts +0 -6
- package/src/hooks/useWorkspace.ts +0 -16
- package/src/icons/actions.tsx +0 -138
- package/src/icons/add.tsx +0 -8
- package/src/icons/animations.tsx +0 -325
- package/src/icons/boolean.tsx +0 -7
- package/src/icons/clone.tsx +0 -9
- package/src/icons/close.tsx +0 -7
- package/src/icons/code.tsx +0 -5
- package/src/icons/command.tsx +0 -8
- package/src/icons/component.tsx +0 -5
- package/src/icons/container.tsx +0 -8
- package/src/icons/corner.tsx +0 -26
- package/src/icons/delete.tsx +0 -9
- package/src/icons/design.tsx +0 -7
- package/src/icons/display.tsx +0 -17
- package/src/icons/dragmove.tsx +0 -10
- package/src/icons/expand.tsx +0 -5
- package/src/icons/expression.tsx +0 -5
- package/src/icons/eyes.tsx +0 -15
- package/src/icons/flex.tsx +0 -85
- package/src/icons/flip.tsx +0 -5
- package/src/icons/focus.tsx +0 -5
- package/src/icons/font.tsx +0 -61
- package/src/icons/formula.tsx +0 -5
- package/src/icons/freemove.tsx +0 -10
- package/src/icons/help.tsx +0 -8
- package/src/icons/hidden.tsx +0 -5
- package/src/icons/history.tsx +0 -7
- package/src/icons/image.tsx +0 -9
- package/src/icons/index.ts +0 -53
- package/src/icons/json.tsx +0 -5
- package/src/icons/logo.tsx +0 -5
- package/src/icons/menu.tsx +0 -7
- package/src/icons/mobile.tsx +0 -8
- package/src/icons/move.tsx +0 -5
- package/src/icons/number.tsx +0 -7
- package/src/icons/outline.tsx +0 -5
- package/src/icons/page.tsx +0 -9
- package/src/icons/pc.tsx +0 -7
- package/src/icons/play.tsx +0 -8
- package/src/icons/position.tsx +0 -30
- package/src/icons/pushpin.tsx +0 -29
- package/src/icons/recover.tsx +0 -5
- package/src/icons/redo.tsx +0 -5
- package/src/icons/remove.tsx +0 -5
- package/src/icons/responsive.tsx +0 -9
- package/src/icons/return.tsx +0 -5
- package/src/icons/selection.tsx +0 -5
- package/src/icons/setting.tsx +0 -5
- package/src/icons/shadow.tsx +0 -20
- package/src/icons/shift.tsx +0 -5
- package/src/icons/sources.tsx +0 -3377
- package/src/icons/text.tsx +0 -13
- package/src/icons/undo.tsx +0 -7
- package/src/icons/upload.tsx +0 -8
- package/src/index.ts +0 -9
- package/src/locales/global.ts +0 -16
- package/src/locales/icons.ts +0 -132
- package/src/locales/index.ts +0 -7
- package/src/locales/operations.ts +0 -50
- package/src/locales/panels.ts +0 -26
- package/src/panels/CompositePanel.tsx +0 -195
- package/src/panels/SettingsPanel.tsx +0 -85
- package/src/panels/StudioPanel.tsx +0 -54
- package/src/panels/ToolbarPanel.tsx +0 -19
- package/src/panels/ViewPanel.tsx +0 -62
- package/src/panels/ViewportPanel.tsx +0 -10
- package/src/panels/WorkspacePanel.tsx +0 -31
- package/src/panels/index.ts +0 -8
- package/src/panels/styles.less +0 -331
- package/src/simulators/MobileSimulator/body.tsx +0 -78
- package/src/simulators/MobileSimulator/index.tsx +0 -21
- package/src/simulators/MobileSimulator/styles.less +0 -29
- package/src/simulators/PCSimulator/index.tsx +0 -17
- package/src/simulators/PCSimulator/styles.less +0 -11
- package/src/simulators/ResponsiveSimulator/handle.tsx +0 -29
- package/src/simulators/ResponsiveSimulator/index.tsx +0 -193
- package/src/simulators/ResponsiveSimulator/styles.less +0 -56
- package/src/simulators/index.tsx +0 -3
- package/src/theme.less +0 -224
- package/src/types.ts +0 -41
- package/src/variables.less +0 -1
- package/src/widgets/AuxToolWidget/Copy.tsx +0 -28
- package/src/widgets/AuxToolWidget/Cover.tsx +0 -76
- package/src/widgets/AuxToolWidget/DashedBox.tsx +0 -55
- package/src/widgets/AuxToolWidget/Delete.tsx +0 -29
- package/src/widgets/AuxToolWidget/DragHandler.tsx +0 -29
- package/src/widgets/AuxToolWidget/FreeSelection.tsx +0 -53
- package/src/widgets/AuxToolWidget/Helpers.tsx +0 -116
- package/src/widgets/AuxToolWidget/Insertion.tsx +0 -80
- package/src/widgets/AuxToolWidget/ResizeHandler.tsx +0 -35
- package/src/widgets/AuxToolWidget/Selection.tsx +0 -85
- package/src/widgets/AuxToolWidget/Selector.tsx +0 -125
- package/src/widgets/AuxToolWidget/SnapLine.tsx +0 -40
- package/src/widgets/AuxToolWidget/SpaceBlock.tsx +0 -112
- package/src/widgets/AuxToolWidget/TranslateHandler.tsx +0 -29
- package/src/widgets/AuxToolWidget/index.tsx +0 -40
- package/src/widgets/AuxToolWidget/styles.less +0 -383
- package/src/widgets/ComponentTreeWidget/index.tsx +0 -99
- package/src/widgets/ComponentTreeWidget/styles.less +0 -6
- package/src/widgets/DesignerToolsWidget/index.tsx +0 -206
- package/src/widgets/DesignerToolsWidget/styles.less +0 -29
- package/src/widgets/DroppableWidget/index.tsx +0 -63
- package/src/widgets/DroppableWidget/styles.less +0 -11
- package/src/widgets/EmptyWidget/index.tsx +0 -58
- package/src/widgets/EmptyWidget/styles.less +0 -27
- package/src/widgets/GhostWidget/index.tsx +0 -47
- package/src/widgets/GhostWidget/styles.less +0 -20
- package/src/widgets/HistoryWidget/index.tsx +0 -42
- package/src/widgets/HistoryWidget/styles.less +0 -23
- package/src/widgets/IconWidget/index.tsx +0 -152
- package/src/widgets/IconWidget/styles.less +0 -17
- package/src/widgets/NodeActionsWidget/index.tsx +0 -56
- package/src/widgets/NodeActionsWidget/styles.less +0 -51
- package/src/widgets/NodePathWidget/index.tsx +0 -57
- package/src/widgets/NodePathWidget/styles.less +0 -16
- package/src/widgets/NodeTitleWidget/index.tsx +0 -20
- package/src/widgets/OutlineWidget/Insertion.tsx +0 -63
- package/src/widgets/OutlineWidget/OutlineNode.tsx +0 -198
- package/src/widgets/OutlineWidget/context.ts +0 -9
- package/src/widgets/OutlineWidget/index.tsx +0 -66
- package/src/widgets/OutlineWidget/styles.less +0 -195
- package/src/widgets/ResourceWidget/index.tsx +0 -110
- package/src/widgets/ResourceWidget/styles.less +0 -87
- package/src/widgets/TextWidget/index.tsx +0 -43
- package/src/widgets/ViewToolsWidget/index.tsx +0 -72
- package/src/widgets/index.ts +0 -15
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -5
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
@import '../../variables.less';
|
|
2
|
-
|
|
3
|
-
.@{prefix-cls}-outline-tree {
|
|
4
|
-
&-container {
|
|
5
|
-
position: relative;
|
|
6
|
-
min-height: 100px;
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
height: 100%;
|
|
10
|
-
width: 100%;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
background-color: var(--dn-outline-tree-bg-color);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&-header {
|
|
16
|
-
display: flex;
|
|
17
|
-
padding: 8px;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
align-items: center;
|
|
20
|
-
border-bottom: 1px solid var(--dn-outline-tree-header-border-color);
|
|
21
|
-
color: var(--dn-outline-tree-color);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&-title {
|
|
25
|
-
font-size: 16px;
|
|
26
|
-
font-weight: 500;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&-close {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
transform: scale(1.6);
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&-content {
|
|
37
|
-
position: relative;
|
|
38
|
-
flex-grow: 1;
|
|
39
|
-
height: 100%;
|
|
40
|
-
width: 100%;
|
|
41
|
-
padding-bottom: 20px;
|
|
42
|
-
overflow: overlay;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&-aux {
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: 0;
|
|
48
|
-
left: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&-insertion {
|
|
52
|
-
background-color: var(--dn-outline-tree-insertion-bg-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&-node {
|
|
56
|
-
position: relative;
|
|
57
|
-
user-select: none;
|
|
58
|
-
width: fit-content;
|
|
59
|
-
min-width: 100%;
|
|
60
|
-
|
|
61
|
-
&.expanded {
|
|
62
|
-
& > .@{prefix-cls}-outline-tree-node-header {
|
|
63
|
-
.@{prefix-cls}-outline-tree-node-expand {
|
|
64
|
-
transform: rotate(0);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
& > .@{prefix-cls}-outline-tree-node-children {
|
|
69
|
-
display: block;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&.selected {
|
|
74
|
-
& > .@{prefix-cls}-outline-tree-node-header {
|
|
75
|
-
background-color: var(--dn-panel-active-bg-color);
|
|
76
|
-
|
|
77
|
-
.@{prefix-cls}-outline-tree-node-header-head {
|
|
78
|
-
background-color: var(--dn-panel-active-bg-color);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&.droppable {
|
|
84
|
-
& > .@{prefix-cls}-outline-tree-node-header {
|
|
85
|
-
.@{prefix-cls}-outline-tree-node-header-content {
|
|
86
|
-
.@{prefix-cls}-outline-tree-node-header-base {
|
|
87
|
-
& > .@{prefix-cls}-outline-tree-node-icon {
|
|
88
|
-
transform: scale(1.2);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&-hidden-icon:not(.hidden) {
|
|
96
|
-
display: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&-header {
|
|
100
|
-
display: flex;
|
|
101
|
-
min-height: 32px;
|
|
102
|
-
width: fit-content;
|
|
103
|
-
min-width: 100%;
|
|
104
|
-
align-items: center;
|
|
105
|
-
color: var(--dn-outline-tree-node-header-color);
|
|
106
|
-
position: relative;
|
|
107
|
-
padding-left: 8px;
|
|
108
|
-
|
|
109
|
-
&:hover {
|
|
110
|
-
.@{prefix-cls}-outline-tree-node-header-content {
|
|
111
|
-
color: var(--dn-outline-tree-node-hover-color);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.@{prefix-cls}-outline-tree-node-hidden-icon {
|
|
115
|
-
display: block;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&-header-head {
|
|
121
|
-
position: absolute;
|
|
122
|
-
top: 0;
|
|
123
|
-
left: 0;
|
|
124
|
-
height: 100%;
|
|
125
|
-
pointer-events: none;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&-header-content {
|
|
129
|
-
display: flex;
|
|
130
|
-
align-items: center;
|
|
131
|
-
transition: all 0.15s ease-in;
|
|
132
|
-
transform-origin: left;
|
|
133
|
-
width: fit-content;
|
|
134
|
-
min-width: 100%;
|
|
135
|
-
height: 100%;
|
|
136
|
-
justify-content: space-between;
|
|
137
|
-
font-size: 12px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&-header-base {
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&-header-actions {
|
|
146
|
-
display: flex;
|
|
147
|
-
align-items: center;
|
|
148
|
-
margin-right: 8px;
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
text-overflow: ellipsis;
|
|
151
|
-
white-space: nowrap;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&-expand {
|
|
155
|
-
display: flex;
|
|
156
|
-
align-items: center;
|
|
157
|
-
transition: all 0.15s ease-out;
|
|
158
|
-
transform: rotate(-90deg);
|
|
159
|
-
margin-right: 3px;
|
|
160
|
-
width: 12px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&-icon {
|
|
164
|
-
margin-right: 5px;
|
|
165
|
-
display: flex;
|
|
166
|
-
align-items: center;
|
|
167
|
-
font-size: 12px;
|
|
168
|
-
text-rendering: optimizeLegibility;
|
|
169
|
-
-webkit-font-smoothing: antialiased;
|
|
170
|
-
-moz-osx-font-smoothing: grayscale;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
&-title {
|
|
174
|
-
overflow: hidden;
|
|
175
|
-
text-overflow: ellipsis;
|
|
176
|
-
white-space: nowrap;
|
|
177
|
-
margin-right: 100px;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&-actions {
|
|
181
|
-
font-size: 12px;
|
|
182
|
-
flex-grow: 2;
|
|
183
|
-
overflow: hidden;
|
|
184
|
-
text-overflow: ellipsis;
|
|
185
|
-
white-space: nowrap;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
&-children {
|
|
189
|
-
padding-left: 16px;
|
|
190
|
-
display: none;
|
|
191
|
-
width: fit-content;
|
|
192
|
-
min-width: 100%;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
isResourceHost,
|
|
4
|
-
isResourceList,
|
|
5
|
-
IResourceLike,
|
|
6
|
-
IResource,
|
|
7
|
-
} from '@formily-design/core'
|
|
8
|
-
import { isFn } from '@formily-design/shared'
|
|
9
|
-
import { observer } from '@formily/reactive-react'
|
|
10
|
-
import { usePrefix } from '../../hooks'
|
|
11
|
-
import { IconWidget } from '../IconWidget'
|
|
12
|
-
import { TextWidget } from '../TextWidget'
|
|
13
|
-
import cls from 'classnames'
|
|
14
|
-
import './styles.less'
|
|
15
|
-
|
|
16
|
-
export type SourceMapper = (resource: IResource) => React.ReactChild
|
|
17
|
-
|
|
18
|
-
export interface IResourceWidgetProps {
|
|
19
|
-
title: React.ReactNode
|
|
20
|
-
sources?: IResourceLike[]
|
|
21
|
-
className?: string
|
|
22
|
-
defaultExpand?: boolean
|
|
23
|
-
children?: SourceMapper | React.ReactElement
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const ResourceWidget: React.FC<IResourceWidgetProps> = observer(
|
|
27
|
-
(props) => {
|
|
28
|
-
const prefix = usePrefix('resource')
|
|
29
|
-
const [expand, setExpand] = useState(props.defaultExpand)
|
|
30
|
-
const renderNode = (source: IResource) => {
|
|
31
|
-
const { node, icon, title, thumb, span } = source
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
className={prefix + '-item'}
|
|
35
|
-
style={{ gridColumnStart: `span ${span || 1}` }}
|
|
36
|
-
key={node.id}
|
|
37
|
-
data-designer-source-id={node.id}
|
|
38
|
-
>
|
|
39
|
-
{thumb && <img className={prefix + '-item-thumb'} src={thumb} />}
|
|
40
|
-
{icon && React.isValidElement(icon) ? (
|
|
41
|
-
<>{icon}</>
|
|
42
|
-
) : (
|
|
43
|
-
<IconWidget
|
|
44
|
-
className={prefix + '-item-icon'}
|
|
45
|
-
infer={icon}
|
|
46
|
-
style={{ width: 150, height: 40 }}
|
|
47
|
-
/>
|
|
48
|
-
)}
|
|
49
|
-
<span className={prefix + '-item-text'}>
|
|
50
|
-
{
|
|
51
|
-
<TextWidget>
|
|
52
|
-
{title || node.children[0]?.getMessage('title')}
|
|
53
|
-
</TextWidget>
|
|
54
|
-
}
|
|
55
|
-
</span>
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
const sources = props.sources.reduce<IResource[]>((buf, source) => {
|
|
60
|
-
if (isResourceList(source)) {
|
|
61
|
-
return buf.concat(source)
|
|
62
|
-
} else if (isResourceHost(source)) {
|
|
63
|
-
return buf.concat(source.Resource)
|
|
64
|
-
}
|
|
65
|
-
return buf
|
|
66
|
-
}, [])
|
|
67
|
-
const remainItems =
|
|
68
|
-
sources.reduce((length, source) => {
|
|
69
|
-
return length + (source.span ?? 1)
|
|
70
|
-
}, 0) % 3
|
|
71
|
-
return (
|
|
72
|
-
<div
|
|
73
|
-
className={cls(prefix, props.className, {
|
|
74
|
-
expand,
|
|
75
|
-
})}
|
|
76
|
-
>
|
|
77
|
-
<div
|
|
78
|
-
className={prefix + '-header'}
|
|
79
|
-
onClick={(e) => {
|
|
80
|
-
e.stopPropagation()
|
|
81
|
-
e.preventDefault()
|
|
82
|
-
setExpand(!expand)
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
<div className={prefix + '-header-expand'}>
|
|
86
|
-
<IconWidget infer="Expand" size={10} />
|
|
87
|
-
</div>
|
|
88
|
-
<div className={prefix + '-header-content'}>
|
|
89
|
-
<TextWidget>{props.title}</TextWidget>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
<div className={prefix + '-content-wrapper'}>
|
|
93
|
-
<div className={prefix + '-content'}>
|
|
94
|
-
{sources.map(isFn(props.children) ? props.children : renderNode)}
|
|
95
|
-
{remainItems ? (
|
|
96
|
-
<div
|
|
97
|
-
className={prefix + '-item-remain'}
|
|
98
|
-
style={{ gridColumnStart: `span ${3 - remainItems}` }}
|
|
99
|
-
></div>
|
|
100
|
-
) : null}
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
ResourceWidget.defaultProps = {
|
|
109
|
-
defaultExpand: true,
|
|
110
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
@import '../../variables.less';
|
|
2
|
-
|
|
3
|
-
.@{prefix-cls}-resource {
|
|
4
|
-
flex-wrap: wrap;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
|
|
7
|
-
&-header {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
padding: 5px 8px;
|
|
11
|
-
color: var(--dn-collapse-header-color);
|
|
12
|
-
border-bottom: 1px solid var(--dn-panel-border-color);
|
|
13
|
-
background-color: var(--dn-panel-active-bg-color);
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
transition: all 0.25s ease-in-out;
|
|
16
|
-
font-size: 13px;
|
|
17
|
-
|
|
18
|
-
&-expand {
|
|
19
|
-
transform: rotate(-90deg);
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
transition: all 0.15s ease-in-out;
|
|
22
|
-
margin-right: 3px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&-content-wrapper {
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
background: var(--dn-resource-content-bg-color);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&-content {
|
|
33
|
-
width: 100%;
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-wrap: wrap;
|
|
36
|
-
display: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.expand {
|
|
40
|
-
.@{prefix-cls}-resource-content {
|
|
41
|
-
display: grid;
|
|
42
|
-
grid-template-columns: repeat(3, 33.3333%);
|
|
43
|
-
grid-gap: 1px;
|
|
44
|
-
background-color: var(--dn-panel-border-color);
|
|
45
|
-
border-bottom: 1px solid var(--dn-panel-border-color);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.@{prefix-cls}-resource-header-expand {
|
|
49
|
-
transform: rotate(0);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&-item {
|
|
54
|
-
position: relative;
|
|
55
|
-
user-select: none;
|
|
56
|
-
background: var(--dn-resource-content-bg-color);
|
|
57
|
-
min-height: 40px;
|
|
58
|
-
color: var(--dn-resource-item-color);
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
cursor: grab;
|
|
64
|
-
transition: color 0.1s ease-out;
|
|
65
|
-
|
|
66
|
-
&:hover {
|
|
67
|
-
color: var(--dn-resource-item-hover-color);
|
|
68
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
69
|
-
z-index: 1;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&-icon {
|
|
73
|
-
margin: 12px 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&-text {
|
|
77
|
-
text-align: center;
|
|
78
|
-
font-size: 12px;
|
|
79
|
-
line-height: 1;
|
|
80
|
-
margin-bottom: 12px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&-remain {
|
|
84
|
-
background: var(--dn-resource-content-bg-color);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react'
|
|
2
|
-
import { isStr, isPlainObj } from '@formily-design/shared'
|
|
3
|
-
import { GlobalRegistry, IDesignerMiniLocales } from '@formily-design/core'
|
|
4
|
-
import { observer } from '@formily/reactive-react'
|
|
5
|
-
|
|
6
|
-
export interface ITextWidgetProps {
|
|
7
|
-
children?: React.ReactNode
|
|
8
|
-
componentName?: string
|
|
9
|
-
sourceName?: string
|
|
10
|
-
token?: string | IDesignerMiniLocales
|
|
11
|
-
defaultMessage?: string | IDesignerMiniLocales
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const TextWidget: React.FC<ITextWidgetProps> = observer((props) => {
|
|
15
|
-
const takeLocale = (
|
|
16
|
-
message: string | IDesignerMiniLocales
|
|
17
|
-
): React.ReactNode => {
|
|
18
|
-
if (isStr(message)) return message
|
|
19
|
-
if (isPlainObj(message)) {
|
|
20
|
-
const lang = GlobalRegistry.getDesignerLanguage()
|
|
21
|
-
for (let key in message) {
|
|
22
|
-
if (key.toLocaleLowerCase() === lang) return message[key]
|
|
23
|
-
}
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
return message
|
|
27
|
-
}
|
|
28
|
-
const takeMessage = (token: any) => {
|
|
29
|
-
if (!token) return
|
|
30
|
-
const message = isStr(token)
|
|
31
|
-
? GlobalRegistry.getDesignerMessage(token)
|
|
32
|
-
: token
|
|
33
|
-
if (message) return takeLocale(message)
|
|
34
|
-
return token
|
|
35
|
-
}
|
|
36
|
-
return (
|
|
37
|
-
<Fragment>
|
|
38
|
-
{takeMessage(props.children) ||
|
|
39
|
-
takeMessage(props.token) ||
|
|
40
|
-
takeMessage(props.defaultMessage)}
|
|
41
|
-
</Fragment>
|
|
42
|
-
)
|
|
43
|
-
})
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Button } from 'antd'
|
|
3
|
-
import { observer } from '@formily/reactive-react'
|
|
4
|
-
import { WorkbenchTypes } from '@formily-design/core'
|
|
5
|
-
import { IconWidget } from '../IconWidget'
|
|
6
|
-
import { usePrefix, useWorkbench } from '../../hooks'
|
|
7
|
-
import cls from 'classnames'
|
|
8
|
-
|
|
9
|
-
export interface IViewToolsWidget {
|
|
10
|
-
use?: WorkbenchTypes[]
|
|
11
|
-
style?: React.CSSProperties
|
|
12
|
-
className?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const ViewToolsWidget: React.FC<IViewToolsWidget> = observer(
|
|
16
|
-
({ use, style, className }) => {
|
|
17
|
-
const workbench = useWorkbench()
|
|
18
|
-
const prefix = usePrefix('view-tools')
|
|
19
|
-
return (
|
|
20
|
-
<Button.Group style={style} className={cls(prefix, className)}>
|
|
21
|
-
{use.includes('DESIGNABLE') && (
|
|
22
|
-
<Button
|
|
23
|
-
disabled={workbench.type === 'DESIGNABLE'}
|
|
24
|
-
onClick={() => {
|
|
25
|
-
workbench.type = 'DESIGNABLE'
|
|
26
|
-
}}
|
|
27
|
-
size="small"
|
|
28
|
-
>
|
|
29
|
-
<IconWidget infer="Design" />
|
|
30
|
-
</Button>
|
|
31
|
-
)}
|
|
32
|
-
{use.includes('JSONTREE') && (
|
|
33
|
-
<Button
|
|
34
|
-
disabled={workbench.type === 'JSONTREE'}
|
|
35
|
-
onClick={() => {
|
|
36
|
-
workbench.type = 'JSONTREE'
|
|
37
|
-
}}
|
|
38
|
-
size="small"
|
|
39
|
-
>
|
|
40
|
-
<IconWidget infer="JSON" />
|
|
41
|
-
</Button>
|
|
42
|
-
)}
|
|
43
|
-
{use.includes('MARKUP') && (
|
|
44
|
-
<Button
|
|
45
|
-
disabled={workbench.type === 'MARKUP'}
|
|
46
|
-
onClick={() => {
|
|
47
|
-
workbench.type = 'MARKUP'
|
|
48
|
-
}}
|
|
49
|
-
size="small"
|
|
50
|
-
>
|
|
51
|
-
<IconWidget infer="Code" />
|
|
52
|
-
</Button>
|
|
53
|
-
)}
|
|
54
|
-
{use.includes('PREVIEW') && (
|
|
55
|
-
<Button
|
|
56
|
-
disabled={workbench.type === 'PREVIEW'}
|
|
57
|
-
onClick={() => {
|
|
58
|
-
workbench.type = 'PREVIEW'
|
|
59
|
-
}}
|
|
60
|
-
size="small"
|
|
61
|
-
>
|
|
62
|
-
<IconWidget infer="Play" />
|
|
63
|
-
</Button>
|
|
64
|
-
)}
|
|
65
|
-
</Button.Group>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
ViewToolsWidget.defaultProps = {
|
|
71
|
-
use: ['DESIGNABLE', 'JSONTREE', 'PREVIEW'],
|
|
72
|
-
}
|
package/src/widgets/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './AuxToolWidget'
|
|
2
|
-
export * from './ComponentTreeWidget'
|
|
3
|
-
export * from './DesignerToolsWidget'
|
|
4
|
-
export * from './ViewToolsWidget'
|
|
5
|
-
export * from './ResourceWidget'
|
|
6
|
-
export * from './GhostWidget'
|
|
7
|
-
export * from './EmptyWidget'
|
|
8
|
-
export * from './OutlineWidget'
|
|
9
|
-
export * from './IconWidget'
|
|
10
|
-
export * from './TextWidget'
|
|
11
|
-
export * from './HistoryWidget'
|
|
12
|
-
export * from './NodePathWidget'
|
|
13
|
-
export * from './NodeTitleWidget'
|
|
14
|
-
export * from './DroppableWidget'
|
|
15
|
-
export * from './NodeActionsWidget'
|
package/tsconfig.build.json
DELETED