plain-design 1.0.0-beta.3 → 1.0.0-beta.30
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/plain-design.commonjs.min.js +2 -2
- package/dist/plain-design.min.css +22 -19
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +5 -5
- package/package.json +6 -6
- package/src/packages/build.ts +2 -10
- package/src/packages/components/Alert/alert.scss +1 -1
- package/src/packages/components/Application/theme/theme.ts +2 -3
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +4 -4
- package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +2 -0
- package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -0
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +1 -0
- package/src/packages/components/Badge/badge.scss +1 -1
- package/src/packages/components/Button/button.scss +1 -1
- package/src/packages/components/CarouselGroup/carousel.scss +1 -1
- package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +3 -3
- package/src/packages/components/CheckboxInner/checkbox-inner.scss +1 -1
- package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +8 -5
- package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +7 -4
- package/src/packages/components/DatePicker/date.scss +1 -1
- package/src/packages/components/Dialog/dialog.scss +1 -1
- package/src/packages/components/Dialog/index.tsx +4 -3
- package/src/packages/components/Dialog/useDialogMovable.tsx +7 -4
- package/src/packages/components/Dialog/utils/dialog.mouse.ts +4 -2
- package/src/packages/components/DropdownOption/index.tsx +3 -3
- package/src/packages/components/Image/image.scss +3 -3
- package/src/packages/components/Input/useMultipleInput.tsx +5 -2
- package/src/packages/components/Input/useTextareaInput.tsx +10 -5
- package/src/packages/components/Input/uses/useInputHooks.tsx +11 -11
- package/src/packages/components/InputNumber/NumberResize.tsx +6 -2
- package/src/packages/components/Layout/index.tsx +31 -0
- package/src/packages/components/Layout/layout.scss +227 -0
- package/src/packages/components/Layout/layout.utils.ts +3 -0
- package/src/packages/components/LayoutSection/index.tsx +67 -0
- package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +184 -0
- package/src/packages/components/LoadingMask/index.tsx +1 -1
- package/src/{pages/index/PageThemeUtils.tsx → packages/components/PageThemeUtils/index.tsx} +58 -18
- package/src/packages/components/Pagination/pagination.scss +2 -2
- package/src/packages/components/Popup/index.tsx +24 -10
- package/src/packages/components/ProgressBar/progress-bar.scss +1 -1
- package/src/packages/components/Rate/index.tsx +3 -1
- package/src/packages/components/Scroll/HorizontalScrollbar.tsx +7 -3
- package/src/packages/components/Scroll/VerticalScrollbar.tsx +7 -3
- package/src/packages/components/Select/createPublicSelectRender.tsx +1 -1
- package/src/packages/components/Slider/slider.scss +1 -1
- package/src/packages/components/Slider/useSliderDotDragier.tsx +7 -4
- package/src/packages/components/StepGroup/step-group.scss +9 -9
- package/src/packages/components/TabGroup/TabsInner.tsx +5 -3
- package/src/packages/components/TabGroup/header/horizontal/tabs-header-horizontal.scss +0 -1
- package/src/packages/components/TabGroup/index.tsx +5 -1
- package/src/packages/components/TabGroup/tabs.scss +3 -0
- package/src/packages/components/Table/standard/PlcExpand.tsx +12 -20
- package/src/packages/components/Table/table/Table.tsx +10 -3
- package/src/packages/components/Table/table/head/useHeadCellResize.ts +8 -3
- package/src/packages/components/Table/table/table.scss +1 -0
- package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +10 -5
- package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +11 -6
- package/src/packages/components/Table/table/utils/createTableHooks.ts +3 -1
- package/src/packages/components/Table/table/utils/table.utils.ts +6 -1
- package/src/packages/components/ThemeEditor/index.tsx +172 -0
- package/src/packages/components/ThemeEditor/theme-editor.scss +105 -0
- package/src/packages/components/ThemePrimaryColors/index.ts +5 -0
- package/src/packages/components/Tree/RenderTreeNode.tsx +6 -2
- package/src/packages/components/Tree/index.tsx +3 -3
- package/src/packages/components/Tree/tree.scss +42 -9
- package/src/packages/components/TreeCore/TreeCore.type.tsx +2 -0
- package/src/packages/components/TreeCore/createTreeCore.tsx +5 -1
- package/src/packages/components/TreeCore/createTreeDraggier.tsx +70 -56
- package/src/packages/components/TreeCore/createTreeMethods.tsx +1 -0
- package/src/packages/components/TreeCore/createTreeProps.ts +2 -1
- package/src/packages/components/TreeNodeWithMenu/index.tsx +91 -0
- package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +39 -0
- package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
- package/src/packages/components/VirtualList/index.tsx +3 -3
- package/src/packages/components/VirtualList/useVirtualList.tsx +94 -62
- package/src/packages/components/VirtualTable/index.tsx +6 -6
- package/src/packages/components/createProvider/index.ts +5 -0
- package/src/packages/components/nextPopupId/index.ts +5 -0
- package/src/packages/components/useDialog/DialogService.tsx +13 -1
- package/src/packages/components/useImage/ImageService.tsx +7 -4
- package/src/packages/components/useMessage/Message.tsx +5 -1
- package/src/packages/components/useMessage/message.scss +5 -1
- package/src/packages/components/useNotice/notice.scss +1 -1
- package/src/packages/components/usePopup/PopupItem.tsx +45 -26
- package/src/packages/components/usePopup/popup-item.scss +5 -1
- package/src/packages/components/usePopup/usePopupManager.tsx +2 -1
- package/src/packages/components/usePopup/utils/popup.utils.ts +2 -1
- package/src/packages/components/usePopupManager/index.ts +5 -0
- package/src/packages/components/usePopupTrigger/index.tsx +5 -0
- package/src/packages/components/useReferenceTrigger/index.tsx +5 -0
- package/src/packages/components/useTooltip/index.tsx +2 -0
- package/src/packages/components/useWatchAutoClear/index.ts +5 -0
- package/src/packages/entry.tsx +39 -0
- package/src/packages/uses/useEdit.ts +5 -1
- package/src/packages/uses/useStyle.tsx +10 -2
- package/src/packages/utils/ClientZoom.ts +24 -2
- package/src/packages/utils/useMove.tsx +10 -4
- package/src/pages/index/App.tsx +3 -2
- package/src/pages/index/Demo/DemoRow.scss +9 -6
- package/src/pages/index/Demo/DemoRowController.tsx +2 -2
- package/src/pages/index/app.scss +5 -0
- package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +10 -5
- package/src/pages/index/components/normal/DemoDropdown.tsx +1 -1
- package/src/pages/index/components/normal/DemoLayout.tsx +144 -0
- package/src/pages/index/components/normal/DemoLoading.tsx +3 -0
- package/src/pages/index/components/normal/DemoTab.tsx +6 -6
- package/src/pages/index/components/normal/DemoTree.tsx +86 -2
- package/src/pages/index/components/normal/DemoVirtualList.tsx +9 -9
- package/src/pages/index/components/service/DemoDialogService.tsx +1 -0
- package/src/pages/index/components/service/DemoPopupService.tsx +6 -3
- package/src/pages/index/components/table/DemoTableExpand.tsx +41 -19
- package/src/pages/index/components/table/DemoVirtualTable.tsx +4 -4
- package/src/pages/index/home/AppHead.tsx +6 -93
- package/src/pages/index/home/menus.tsx +1 -0
- package/src/pages/index/home/plain-design.png +0 -0
- package/src/pages/index/main.tsx +0 -4
@@ -0,0 +1,227 @@
|
|
1
|
+
$resize-width: 12px;
|
2
|
+
|
3
|
+
@include comp(layout) {
|
4
|
+
display: flex;
|
5
|
+
align-items: stretch;
|
6
|
+
justify-content: space-between;
|
7
|
+
|
8
|
+
&.layout-vertical {
|
9
|
+
flex-direction: column;
|
10
|
+
}
|
11
|
+
|
12
|
+
& > .#{componentName(layout-section)} {
|
13
|
+
&.layout-section-position-center {
|
14
|
+
flex: 1;
|
15
|
+
position: relative;
|
16
|
+
z-index: 1;
|
17
|
+
}
|
18
|
+
|
19
|
+
&.layout-section-position-top, &.layout-section-position-bottom, &.layout-section-position-left, &.layout-section-position-right {
|
20
|
+
position: relative;
|
21
|
+
flex-shrink: 0;
|
22
|
+
flex-grow: 0;
|
23
|
+
z-index: 2;
|
24
|
+
|
25
|
+
& > .layout-section-inner {
|
26
|
+
overflow: hidden;
|
27
|
+
}
|
28
|
+
|
29
|
+
&.layout-section-fixed {
|
30
|
+
& > .layout-section-inner {
|
31
|
+
position: absolute;
|
32
|
+
top: 0;
|
33
|
+
left: 0;
|
34
|
+
right: 0;
|
35
|
+
bottom: 0;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
& > .layout-section-separator {
|
41
|
+
user-select: none;
|
42
|
+
}
|
43
|
+
|
44
|
+
& > .layout-section-collapse-btn {
|
45
|
+
opacity: 0;
|
46
|
+
transition: all ease 0.3s;
|
47
|
+
cursor: pointer;
|
48
|
+
}
|
49
|
+
|
50
|
+
&:hover {
|
51
|
+
& > .layout-section-collapse-btn {
|
52
|
+
opacity: 1;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
/*---------------------------------------horizontal-------------------------------------------*/
|
58
|
+
|
59
|
+
&.layout-section-position-left, &.layout-section-position-right {
|
60
|
+
|
61
|
+
& > .layout-section-separator {
|
62
|
+
cursor: col-resize;
|
63
|
+
}
|
64
|
+
|
65
|
+
&.layout-section-collapse {
|
66
|
+
width: 0 !important;
|
67
|
+
|
68
|
+
& > .layout-section-collapse-btn {
|
69
|
+
opacity: 1;
|
70
|
+
}
|
71
|
+
|
72
|
+
&.layout-section-position-left {
|
73
|
+
& > .layout-section-collapse-btn {
|
74
|
+
border-top-left-radius: 0;
|
75
|
+
border-bottom-left-radius: 0;
|
76
|
+
right: -$resize-width;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
&.layout-section-position-right {
|
81
|
+
& > .layout-section-collapse-btn {
|
82
|
+
border-top-right-radius: 0;
|
83
|
+
border-bottom-right-radius: 0;
|
84
|
+
left: -$resize-width;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
&.layout-section-position-left {
|
91
|
+
& > .layout-section-separator {
|
92
|
+
position: absolute;
|
93
|
+
right: 0;
|
94
|
+
width: 4px;
|
95
|
+
top: 0;
|
96
|
+
bottom: 0;
|
97
|
+
border-right: solid 1px plv(border-color);
|
98
|
+
}
|
99
|
+
|
100
|
+
& > .layout-section-collapse-btn {
|
101
|
+
position: absolute;
|
102
|
+
right: calc(#{$resize-width} / 2 * -1);
|
103
|
+
top: calc(50% - #{$resize-width} * 3 / 2);
|
104
|
+
font-size: $resize-width;
|
105
|
+
height: calc(#{$resize-width} * 3);
|
106
|
+
width: $resize-width;
|
107
|
+
display: flex;
|
108
|
+
align-items: center;
|
109
|
+
justify-content: center;
|
110
|
+
background-color: plv(background-color);
|
111
|
+
border-radius: 100px;
|
112
|
+
box-shadow: 0 2px 5px plv(secondary-4);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
&.layout-section-position-right {
|
117
|
+
& > .layout-section-separator {
|
118
|
+
position: absolute;
|
119
|
+
left: 0;
|
120
|
+
width: 4px;
|
121
|
+
top: 0;
|
122
|
+
bottom: 0;
|
123
|
+
border-left: solid 1px plv(border-color);
|
124
|
+
}
|
125
|
+
|
126
|
+
& > .layout-section-collapse-btn {
|
127
|
+
position: absolute;
|
128
|
+
left: calc(#{$resize-width} / 2 * -1);
|
129
|
+
top: calc(50% - #{$resize-width} * 3 / 2);
|
130
|
+
font-size: $resize-width;
|
131
|
+
height: calc(#{$resize-width} * 3);
|
132
|
+
width: $resize-width;
|
133
|
+
display: flex;
|
134
|
+
align-items: center;
|
135
|
+
justify-content: center;
|
136
|
+
background-color: plv(background-color);
|
137
|
+
border-radius: 100px;
|
138
|
+
box-shadow: 0 2px 5px plv(secondary-4);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
/*---------------------------------------vertical-------------------------------------------*/
|
143
|
+
|
144
|
+
&.layout-section-position-top, &.layout-section-position-bottom {
|
145
|
+
|
146
|
+
& > .layout-section-separator {
|
147
|
+
cursor: row-resize;
|
148
|
+
}
|
149
|
+
|
150
|
+
&.layout-section-collapse {
|
151
|
+
height: 0 !important;
|
152
|
+
|
153
|
+
& > .layout-section-collapse-btn {
|
154
|
+
opacity: 1;
|
155
|
+
}
|
156
|
+
|
157
|
+
&.layout-section-position-top {
|
158
|
+
& > .layout-section-collapse-btn {
|
159
|
+
border-top-left-radius: 0;
|
160
|
+
border-top-right-radius: 0;
|
161
|
+
bottom: -$resize-width;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
&.layout-section-position-bottom {
|
166
|
+
& > .layout-section-collapse-btn {
|
167
|
+
border-bottom-left-radius: 0;
|
168
|
+
border-bottom-right-radius: 0;
|
169
|
+
top: -$resize-width;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
&.layout-section-position-top {
|
176
|
+
& > .layout-section-separator {
|
177
|
+
position: absolute;
|
178
|
+
bottom: 0;
|
179
|
+
height: 4px;
|
180
|
+
left: 0;
|
181
|
+
right: 0;
|
182
|
+
border-bottom: solid 1px plv(border-color);
|
183
|
+
}
|
184
|
+
|
185
|
+
& > .layout-section-collapse-btn {
|
186
|
+
position: absolute;
|
187
|
+
bottom: calc(#{$resize-width} / 2 * -1);
|
188
|
+
left: calc(50% - #{$resize-width} * 3 / 2);
|
189
|
+
font-size: $resize-width;
|
190
|
+
width: calc(#{$resize-width} * 3);
|
191
|
+
height: $resize-width;
|
192
|
+
display: flex;
|
193
|
+
align-items: center;
|
194
|
+
justify-content: center;
|
195
|
+
background-color: plv(background-color);
|
196
|
+
border-radius: 100px;
|
197
|
+
box-shadow: 0 2px 5px plv(secondary-4);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
&.layout-section-position-bottom {
|
202
|
+
& > .layout-section-separator {
|
203
|
+
position: absolute;
|
204
|
+
top: 0;
|
205
|
+
height: 4px;
|
206
|
+
left: 0;
|
207
|
+
right: 0;
|
208
|
+
border-top: solid 1px plv(border-color);
|
209
|
+
}
|
210
|
+
|
211
|
+
& > .layout-section-collapse-btn {
|
212
|
+
position: absolute;
|
213
|
+
top: calc(#{$resize-width} / 2 * -1);
|
214
|
+
left: calc(50% - #{$resize-width} * 3 / 2);
|
215
|
+
font-size: $resize-width;
|
216
|
+
width: calc(#{$resize-width} * 3);
|
217
|
+
height: $resize-width;
|
218
|
+
display: flex;
|
219
|
+
align-items: center;
|
220
|
+
justify-content: center;
|
221
|
+
background-color: plv(background-color);
|
222
|
+
border-radius: 100px;
|
223
|
+
box-shadow: 0 2px 5px plv(secondary-4);
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import {designComponent, getComponentCls, iHTMLDivElement, onMounted, PropType, useClassCache, useModel, useRefs, useStyleCache} from "plain-design-composition";
|
2
|
+
import {unit} from "plain-utils/string/unit";
|
3
|
+
import Layout from "../Layout";
|
4
|
+
import {eLayoutSectionPosition} from "../Layout/layout.utils";
|
5
|
+
import {useLayoutSectionResizer} from "./useLayoutSectionResizer";
|
6
|
+
|
7
|
+
export const LayoutSection = designComponent({
|
8
|
+
name: 'layout-section',
|
9
|
+
props: {
|
10
|
+
position: { type: String as PropType<typeof eLayoutSectionPosition.TYPE>, default: eLayoutSectionPosition.center },
|
11
|
+
modelValue: { type: Number },
|
12
|
+
collapse: { type: Boolean }
|
13
|
+
},
|
14
|
+
emits: {
|
15
|
+
onUpdateModelValue: (val?: number) => true,
|
16
|
+
onUpdateCollapse: (val?: boolean) => true,
|
17
|
+
},
|
18
|
+
slots: ['default'],
|
19
|
+
setup({ props, slots, event }) {
|
20
|
+
|
21
|
+
const layout = Layout.use.inject();
|
22
|
+
|
23
|
+
const { refs, onRef } = useRefs({ el: iHTMLDivElement });
|
24
|
+
|
25
|
+
const model = useModel(() => props.modelValue, event.emit.onUpdateModelValue);
|
26
|
+
|
27
|
+
const collapseModel = useModel(() => props.collapse, event.emit.onUpdateCollapse);
|
28
|
+
|
29
|
+
const classes = useClassCache(() => [
|
30
|
+
getComponentCls('layout-section'),
|
31
|
+
`layout-section-position-${props.position}`,
|
32
|
+
{
|
33
|
+
'layout-section-fixed': !!model.value,
|
34
|
+
'layout-section-collapse': collapseModel.value,
|
35
|
+
}
|
36
|
+
]);
|
37
|
+
|
38
|
+
const styles = useStyleCache(style => {
|
39
|
+
if (!!model.value) {
|
40
|
+
if (layout.props.vertical) {
|
41
|
+
style.height = unit(model.value);
|
42
|
+
} else {
|
43
|
+
style.width = unit(model.value);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
});
|
47
|
+
|
48
|
+
const resizer = useLayoutSectionResizer({ props, model, collapseModel });
|
49
|
+
|
50
|
+
onMounted(() => {
|
51
|
+
if (!props.modelValue && props.position !== eLayoutSectionPosition.center) {
|
52
|
+
model.value = (layout.props.vertical ? refs.el!.offsetHeight : refs.el!.offsetWidth) + 1;
|
53
|
+
}
|
54
|
+
});
|
55
|
+
|
56
|
+
return () => (
|
57
|
+
<div className={classes.value} ref={onRef.el} style={styles.value}>
|
58
|
+
<div className="layout-section-inner">
|
59
|
+
{slots.default()}
|
60
|
+
</div>
|
61
|
+
{resizer.render()}
|
62
|
+
</div>
|
63
|
+
);
|
64
|
+
},
|
65
|
+
});
|
66
|
+
|
67
|
+
export default LayoutSection;
|
@@ -0,0 +1,184 @@
|
|
1
|
+
import Icon from "../Icon";
|
2
|
+
import {eLayoutSectionPosition} from "../Layout/layout.utils";
|
3
|
+
import {cacheComputed, computed, getComponentCls, iHTMLDivElement, iMouseEvent, useRefs} from "plain-design-composition";
|
4
|
+
import {createEffects} from "plain-utils/utils/createEffects";
|
5
|
+
import {ClientZoom} from "../../utils/ClientZoom";
|
6
|
+
|
7
|
+
export function useLayoutSectionResizer(
|
8
|
+
{
|
9
|
+
model,
|
10
|
+
collapseModel,
|
11
|
+
props
|
12
|
+
}: {
|
13
|
+
model: { value?: number },
|
14
|
+
collapseModel: { value?: boolean },
|
15
|
+
props: { position: typeof eLayoutSectionPosition.TYPE }
|
16
|
+
}
|
17
|
+
) {
|
18
|
+
|
19
|
+
const { refs, onRef } = useRefs({ sep: iHTMLDivElement });
|
20
|
+
|
21
|
+
const isVertical = computed(() => props.position === eLayoutSectionPosition.top || props.position === eLayoutSectionPosition.bottom);
|
22
|
+
|
23
|
+
const icon = cacheComputed(() => {
|
24
|
+
switch (props.position) {
|
25
|
+
case "center":
|
26
|
+
return null;
|
27
|
+
case "left":
|
28
|
+
return collapseModel.value ? 'pi-caret-right' : 'pi-caret-left';
|
29
|
+
case "right":
|
30
|
+
return collapseModel.value ? 'pi-caret-left' : 'pi-caret-right';
|
31
|
+
case "top":
|
32
|
+
return collapseModel.value ? 'pi-caret-down' : 'pi-caret-up';
|
33
|
+
case "bottom":
|
34
|
+
return collapseModel.value ? 'pi-caret-up' : 'pi-caret-down';
|
35
|
+
}
|
36
|
+
return null;
|
37
|
+
});
|
38
|
+
|
39
|
+
const draggier = computed(() => {
|
40
|
+
return isVertical.value ? (() => {
|
41
|
+
const { effects } = createEffects();
|
42
|
+
|
43
|
+
let staticState = null as null | {
|
44
|
+
startY: number,
|
45
|
+
moveY: number,
|
46
|
+
startValue: number,
|
47
|
+
shadowEl: HTMLDivElement,
|
48
|
+
};
|
49
|
+
|
50
|
+
const onMousedown = (e: iMouseEvent) => {
|
51
|
+
|
52
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
53
|
+
|
54
|
+
const shadowEl = (() => {
|
55
|
+
const rect = refs.sep!.getBoundingClientRect();
|
56
|
+
const el = document.createElement('div');
|
57
|
+
el.style.height = '1px';
|
58
|
+
el.style.position = 'fixed';
|
59
|
+
el.style.left = `${rect.left}px`;
|
60
|
+
el.style.top = `${clientY}px`;
|
61
|
+
el.style.width = `${rect.width}px`;
|
62
|
+
el.style.zIndex = "10";
|
63
|
+
el.style.backgroundColor = `var(--${getComponentCls('primary-6')})`;
|
64
|
+
document.body.appendChild(el);
|
65
|
+
effects.push(() => {
|
66
|
+
document.body.removeChild(el);
|
67
|
+
});
|
68
|
+
return el;
|
69
|
+
})();
|
70
|
+
|
71
|
+
staticState = {
|
72
|
+
startY: clientY,
|
73
|
+
moveY: clientY,
|
74
|
+
startValue: model.value!,
|
75
|
+
shadowEl,
|
76
|
+
};
|
77
|
+
|
78
|
+
window.addEventListener('mousemove', onMousemove);
|
79
|
+
window.addEventListener('mouseup', effects.clear);
|
80
|
+
effects.push(() => {
|
81
|
+
if (!staticState) {return;}
|
82
|
+
let durY = staticState!.moveY - staticState!.startY;
|
83
|
+
if (props.position === eLayoutSectionPosition.bottom) {
|
84
|
+
durY = -durY;
|
85
|
+
}
|
86
|
+
model.value = staticState.startValue + durY;
|
87
|
+
staticState = null;
|
88
|
+
window.removeEventListener('mousemove', onMousemove);
|
89
|
+
window.removeEventListener('mouseup', effects.clear);
|
90
|
+
});
|
91
|
+
};
|
92
|
+
|
93
|
+
const onMousemove = (e: MouseEvent) => {
|
94
|
+
if (!staticState) {return;}
|
95
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
96
|
+
staticState.moveY = clientY;
|
97
|
+
staticState.shadowEl.style.top = `${clientY}px`;
|
98
|
+
};
|
99
|
+
|
100
|
+
return {
|
101
|
+
onMousedown
|
102
|
+
};
|
103
|
+
})() : (() => {
|
104
|
+
const { effects } = createEffects();
|
105
|
+
|
106
|
+
let staticState = null as null | {
|
107
|
+
startX: number,
|
108
|
+
moveX: number,
|
109
|
+
startValue: number,
|
110
|
+
shadowEl: HTMLDivElement,
|
111
|
+
};
|
112
|
+
|
113
|
+
const onMousedown = (e: iMouseEvent) => {
|
114
|
+
|
115
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
116
|
+
|
117
|
+
const shadowEl = (() => {
|
118
|
+
const rect = refs.sep!.getBoundingClientRect();
|
119
|
+
const el = document.createElement('div');
|
120
|
+
el.style.width = '1px';
|
121
|
+
el.style.position = 'fixed';
|
122
|
+
el.style.top = `${rect.top}px`;
|
123
|
+
el.style.left = `${clientX}px`;
|
124
|
+
el.style.height = `${rect.height}px`;
|
125
|
+
el.style.zIndex = "10";
|
126
|
+
el.style.backgroundColor = `var(--${getComponentCls('primary-6')})`;
|
127
|
+
document.body.appendChild(el);
|
128
|
+
effects.push(() => {
|
129
|
+
document.body.removeChild(el);
|
130
|
+
});
|
131
|
+
return el;
|
132
|
+
})();
|
133
|
+
|
134
|
+
staticState = {
|
135
|
+
startX: clientX,
|
136
|
+
moveX: clientX,
|
137
|
+
startValue: model.value!,
|
138
|
+
shadowEl,
|
139
|
+
};
|
140
|
+
|
141
|
+
window.addEventListener('mousemove', onMousemove);
|
142
|
+
window.addEventListener('mouseup', effects.clear);
|
143
|
+
effects.push(() => {
|
144
|
+
if (!staticState) {return;}
|
145
|
+
let durX = staticState!.moveX - staticState!.startX;
|
146
|
+
if (props.position === eLayoutSectionPosition.right) {
|
147
|
+
durX = -durX;
|
148
|
+
}
|
149
|
+
model.value = staticState.startValue + durX;
|
150
|
+
staticState = null;
|
151
|
+
window.removeEventListener('mousemove', onMousemove);
|
152
|
+
window.removeEventListener('mouseup', effects.clear);
|
153
|
+
});
|
154
|
+
};
|
155
|
+
|
156
|
+
const onMousemove = (e: MouseEvent) => {
|
157
|
+
if (!staticState) {return;}
|
158
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
159
|
+
staticState.moveX = clientX;
|
160
|
+
staticState.shadowEl.style.left = `${clientX}px`;
|
161
|
+
};
|
162
|
+
|
163
|
+
return {
|
164
|
+
onMousedown
|
165
|
+
};
|
166
|
+
})();
|
167
|
+
});
|
168
|
+
|
169
|
+
const toggleCollapse = () => collapseModel.value = !collapseModel.value;
|
170
|
+
|
171
|
+
const render = () => {
|
172
|
+
return (
|
173
|
+
!icon.value ? null :
|
174
|
+
<>
|
175
|
+
{!collapseModel.value && <div className="layout-section-separator" onMouseDown={draggier.value.onMousedown} ref={onRef.sep}/>}
|
176
|
+
<div className="layout-section-collapse-btn" onClick={toggleCollapse}>
|
177
|
+
<Icon icon={icon.value}/>
|
178
|
+
</div>
|
179
|
+
</>
|
180
|
+
);
|
181
|
+
};
|
182
|
+
|
183
|
+
return { render };
|
184
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import {computed, getComponentCls, reactive} from "plain-design-composition";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
2
|
+
import {createCache} from "../../utils/createCache";
|
3
|
+
import {ThemeShape, ThemeSize} from "../../uses/useStyle";
|
4
|
+
import {DeepPartial} from "../../utils/type";
|
5
|
+
import {iApplicationConfiguration} from "../Application/utils/application.utils";
|
6
6
|
|
7
7
|
export const PageThemeUtils = (() => {
|
8
8
|
|
@@ -24,26 +24,62 @@ export const PageThemeUtils = (() => {
|
|
24
24
|
|
25
25
|
const configuration = computed((): DeepPartial<iApplicationConfiguration> => {
|
26
26
|
const config: DeepPartial<iApplicationConfiguration> = {};
|
27
|
-
if (!config.theme) {
|
28
|
-
|
27
|
+
if (!config.theme) {config.theme = {};}
|
28
|
+
if (!config.theme.base) {config.theme.base = {};}
|
29
|
+
if (!config.theme.vars) {config.theme.vars = {};}
|
30
|
+
|
31
|
+
let { dark, primaryKey, size, shape, inputMode, zoom } = state;
|
32
|
+
|
33
|
+
config.theme.dark = !!dark;
|
34
|
+
|
35
|
+
if (!!primaryKey) {
|
36
|
+
if (dark && primaryKey === 'dark') {
|
37
|
+
primaryKey = 'white';
|
38
|
+
} else if (!dark && primaryKey === 'light') {
|
39
|
+
primaryKey = 'dark';
|
40
|
+
}
|
29
41
|
}
|
30
|
-
|
31
|
-
|
42
|
+
|
43
|
+
config.theme.base.primary = !primaryKey ? undefined : ThemePrimaryColors[primaryKey]?.primary;
|
44
|
+
|
45
|
+
if (primaryKey === 'dark') {
|
46
|
+
Object.assign(config.theme.vars!, {
|
47
|
+
'primary-light-1': '#f2f3f5',
|
48
|
+
'primary-1': '#f2f3f5',
|
49
|
+
'primary-light-2': '#e1e2e7',
|
50
|
+
'primary-2': '#e1e2e7',
|
51
|
+
'primary-light-3': '#c9cdd4',
|
52
|
+
'primary-3': '#c9cdd4',
|
53
|
+
'primary-light-4': '#a9aeb8',
|
54
|
+
'primary-4': '#a9aeb8',
|
55
|
+
'primary-light-5': '#86909c',
|
56
|
+
'primary-5': '#86909c',
|
57
|
+
'primary-light-6': '#0c0e10',
|
58
|
+
'primary-6': '#0b0b0b',
|
59
|
+
'primary-light-7': '#464f5e',
|
60
|
+
'primary-7': '#464f5e',
|
61
|
+
'primary-light-8': '#272e3b',
|
62
|
+
'primary-8': '#272e3b',
|
63
|
+
'primary-light-9': '#1d2129',
|
64
|
+
'primary-9': '#111318',
|
65
|
+
'primary-light-10': '#0c0e10',
|
66
|
+
'primary-10': '#0b0b0b',
|
67
|
+
});
|
32
68
|
}
|
33
|
-
|
34
|
-
|
69
|
+
|
70
|
+
|
35
71
|
if (!config.default) {
|
36
72
|
config.default = {};
|
37
73
|
}
|
38
|
-
if (!!
|
39
|
-
config.default.size =
|
74
|
+
if (!!size) {
|
75
|
+
config.default.size = size;
|
40
76
|
}
|
41
|
-
if (!!
|
42
|
-
config.default.shape =
|
77
|
+
if (!!shape) {
|
78
|
+
config.default.shape = shape;
|
43
79
|
if (!config.theme.vars) {
|
44
80
|
config.theme.vars = {};
|
45
81
|
}
|
46
|
-
if (
|
82
|
+
if (shape === 'square') {
|
47
83
|
Object.assign(config.theme.vars, {
|
48
84
|
'box-size-mini-border-radius': '2px',
|
49
85
|
'box-size-small-border-radius': '2px',
|
@@ -51,7 +87,7 @@ export const PageThemeUtils = (() => {
|
|
51
87
|
'box-size-large-border-radius': '4px',
|
52
88
|
});
|
53
89
|
}
|
54
|
-
if (
|
90
|
+
if (shape === 'none') {
|
55
91
|
Object.assign(config.theme.vars, {
|
56
92
|
'box-size-mini-border-radius': '0',
|
57
93
|
'box-size-small-border-radius': '0',
|
@@ -60,8 +96,8 @@ export const PageThemeUtils = (() => {
|
|
60
96
|
});
|
61
97
|
}
|
62
98
|
}
|
63
|
-
if (!!
|
64
|
-
config.default.inputMode =
|
99
|
+
if (!!inputMode) {
|
100
|
+
config.default.inputMode = inputMode;
|
65
101
|
}
|
66
102
|
return config;
|
67
103
|
});
|
@@ -122,4 +158,8 @@ export const ThemePrimaryColors: Record<string, { label: string, primary: string
|
|
122
158
|
geek: { label: '极客蓝', primary: '#2f54eb', },
|
123
159
|
purple: { label: '酱紫', primary: '#722ed1', },
|
124
160
|
magenta: { label: '洋红', primary: '#eb2f96', },
|
161
|
+
light: { label: '极昼', primary: '#ffffff', },
|
162
|
+
dark: { label: '黑夜', primary: '#000000', },
|
125
163
|
};
|
164
|
+
|
165
|
+
export default PageThemeUtils;
|
@@ -47,7 +47,7 @@
|
|
47
47
|
&:active, &.pagination-pager-button-active {
|
48
48
|
background-color: plv(primary-6);
|
49
49
|
border-color: plv(primary-6);
|
50
|
-
color:
|
50
|
+
color: plv(pbfc);
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
@@ -118,7 +118,7 @@
|
|
118
118
|
&.pagination-pager-button-active {
|
119
119
|
background-color: plv(gray-light-6);
|
120
120
|
border-color: plv(gray-light-6);
|
121
|
-
color:
|
121
|
+
color: plv(pbfc);
|
122
122
|
}
|
123
123
|
}
|
124
124
|
}
|