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
@@ -1,4 +1,4 @@
|
|
1
|
-
import {ComponentPropsType, computed, designComponent, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
|
1
|
+
import {ComponentPropsType, computed, designComponent, Fragment, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
|
2
2
|
import {iPopupAnimation, iPopupCustomOption, iPopupDefaultOption, iPopupPlacement, iPopupTrigger, iPopupUseOption, PopupItemProvide} from "../usePopup/utils/popup.utils";
|
3
3
|
import {Reference} from "../Reference";
|
4
4
|
import {usePopup} from "../usePopup";
|
@@ -34,7 +34,8 @@ export const Popup = designComponent({
|
|
34
34
|
beforeHide: { type: Function as PropType<iPopupCustomOption['beforeHide']> }, // 隐藏之前处理动作,返回false则阻止隐藏
|
35
35
|
destroyOnClose: { type: Boolean, default: true, }, // 是否在关闭的时候销毁内容
|
36
36
|
type: { type: String as PropType<iPopupDefaultOption['type']> }, // 类型,在打开一个popup的时候,会将同类型的popup自动关闭
|
37
|
-
|
37
|
+
appendToBody: { type: Boolean as PropType<iPopupDefaultOption['appendToBody']>, default: true }, // 挂载到某个dom节点下
|
38
|
+
transformRefreshOnScroll: { type: Boolean as PropType<iPopupDefaultOption['transformRefreshOnScroll']>, default: true },// scroll的时候refresh使用transform来优化
|
38
39
|
offset: { type: Number as PropType<iPopupDefaultOption['offset']> }, // 在direction方向上的距离
|
39
40
|
autoSwitchDirection: { type: Boolean as PropType<iPopupDefaultOption['autoSwitchDirection']>, default: true },// 当空间不够时,是否自动切换direction
|
40
41
|
size: { type: String as PropType<iPopupDefaultOption['size']> }, // popup内容尺寸
|
@@ -139,7 +140,9 @@ export const Popup = designComponent({
|
|
139
140
|
const reference = computed(() => {
|
140
141
|
let reference: any = props.reference || state.getReference();
|
141
142
|
if (!!reference) {
|
142
|
-
if (typeof reference === "function") {
|
143
|
+
if (typeof reference === "function") {
|
144
|
+
reference = reference();
|
145
|
+
}
|
143
146
|
if (!!reference && !!reference.$el) {
|
144
147
|
reference = reference.$el;
|
145
148
|
}
|
@@ -155,7 +158,9 @@ export const Popup = designComponent({
|
|
155
158
|
const stickyReference = computed(() => {
|
156
159
|
let reference: any = props.stickyReference;
|
157
160
|
if (!!reference) {
|
158
|
-
if (typeof reference === "function") {
|
161
|
+
if (typeof reference === "function") {
|
162
|
+
reference = reference();
|
163
|
+
}
|
159
164
|
if (!!reference && !!reference.$el) {
|
160
165
|
reference = reference.$el;
|
161
166
|
}
|
@@ -226,7 +231,8 @@ export const Popup = designComponent({
|
|
226
231
|
noPadding: props.noPadding,
|
227
232
|
destroyOnClose: props.destroyOnClose,
|
228
233
|
type: props.type,
|
229
|
-
|
234
|
+
appendToBody: props.appendToBody,
|
235
|
+
transformRefreshOnScroll: props.transformRefreshOnScroll,
|
230
236
|
offset: props.offset,
|
231
237
|
autoSwitchDirection: props.autoSwitchDirection,
|
232
238
|
refreshOnScroll: props.refreshOnScroll,
|
@@ -266,12 +272,16 @@ export const Popup = designComponent({
|
|
266
272
|
},
|
267
273
|
/*开启之前检查,如果已经禁用则禁止显示*/
|
268
274
|
beforeShow: () => {
|
269
|
-
if (props.disabled || props.readonly) {
|
275
|
+
if (props.disabled || props.readonly) {
|
276
|
+
return false;
|
277
|
+
}
|
270
278
|
return props.beforeShow?.();
|
271
279
|
},
|
272
280
|
/*关闭之前检查,如果已经禁用则禁止关闭*/
|
273
281
|
beforeHide: () => {
|
274
|
-
if (props.disabled || props.readonly) {
|
282
|
+
if (props.disabled || props.readonly) {
|
283
|
+
return false;
|
284
|
+
}
|
275
285
|
return props.beforeHide?.();
|
276
286
|
},
|
277
287
|
|
@@ -284,7 +294,7 @@ export const Popup = designComponent({
|
|
284
294
|
{(slots.head.isExist() || !!props.title) && (
|
285
295
|
<div className="popper-head">{slots.head(typeof props.title === "function" ? props.title() : props.title)}</div>
|
286
296
|
)}
|
287
|
-
{slots.popper(typeof props.message === "function" ? props.message() : props.message)}
|
297
|
+
<Fragment key="popper">{slots.popper(typeof props.message === "function" ? props.message() : props.message)}</Fragment>
|
288
298
|
</div>
|
289
299
|
);
|
290
300
|
|
@@ -346,14 +356,18 @@ export const Popup = designComponent({
|
|
346
356
|
*/
|
347
357
|
if (!!model.value) {
|
348
358
|
const unwatch = watch(() => reference.value, reference => {
|
349
|
-
if (!reference) {
|
359
|
+
if (!reference) {
|
360
|
+
return;
|
361
|
+
}
|
350
362
|
unwatch();
|
351
363
|
$popup.show(state.getOption());
|
352
364
|
});
|
353
365
|
}
|
354
366
|
|
355
367
|
onBeforeUnmount(
|
356
|
-
watch(() => props.watchData, () => {
|
368
|
+
watch(() => props.watchData, () => {
|
369
|
+
$popup.update(state.getOption());
|
370
|
+
})
|
357
371
|
);
|
358
372
|
|
359
373
|
const refresh = () => {
|
@@ -5,6 +5,7 @@ import {Icon} from "../Icon";
|
|
5
5
|
import './rate.scss';
|
6
6
|
import {EditProps, useEdit} from "../../uses/useEdit";
|
7
7
|
import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
|
8
|
+
import {ClientZoom} from "../ClientZoom";
|
8
9
|
|
9
10
|
export const Rate = designComponent({
|
10
11
|
name: 'rate',
|
@@ -79,7 +80,8 @@ export const Rate = designComponent({
|
|
79
80
|
|
80
81
|
const methods = {
|
81
82
|
reset: (e: MouseEvent | iMouseEvent) => {
|
82
|
-
|
83
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
84
|
+
let dur = clientX - (elLeft.value || 0);
|
83
85
|
let start = 0;
|
84
86
|
let end = totalWidth.value;
|
85
87
|
let step = end / props.count;
|
@@ -5,6 +5,7 @@ import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
|
|
5
5
|
import {Scroll} from "./index";
|
6
6
|
import {delay} from "plain-utils/utils/delay";
|
7
7
|
import Tooltip from "../Tooltip";
|
8
|
+
import {ClientZoom} from "../ClientZoom";
|
8
9
|
|
9
10
|
export const HorizontalScrollbar = designComponent({
|
10
11
|
props: {
|
@@ -41,15 +42,17 @@ export const HorizontalScrollbar = designComponent({
|
|
41
42
|
state.scrollLeft = (e.target as HTMLElement).scrollLeft;
|
42
43
|
},
|
43
44
|
onMousedown: (e: iMouseEvent) => {
|
45
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
44
46
|
scroll.freezeState.isDragging = true;
|
45
47
|
dragState.left = left.value;
|
46
|
-
dragState.clientX =
|
48
|
+
dragState.clientX = clientX;
|
47
49
|
document.addEventListener('mousemove', handler.onMousemove);
|
48
50
|
document.addEventListener('mouseup', handler.onMouseup);
|
49
51
|
disabledUserSelect();
|
50
52
|
},
|
51
53
|
onMousemove: (e: MouseEvent) => {
|
52
|
-
|
54
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
55
|
+
let deltaX = clientX - dragState.clientX;
|
53
56
|
const left = dragState.left + deltaX;
|
54
57
|
let scrollLeft = left * (scroll.state.contentWidth - scroll.state.hostWidth) / (scroll.state.hostWidth - width.value);
|
55
58
|
scrollLeft = Math.max(0, Math.min(scrollLeft, scroll.state.contentWidth - scroll.state.hostWidth));
|
@@ -66,7 +69,8 @@ export const HorizontalScrollbar = designComponent({
|
|
66
69
|
enableUserSelect();
|
67
70
|
|
68
71
|
if (scroll.props.scrollAfterDragEnd) {
|
69
|
-
|
72
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
73
|
+
let deltaX = clientX - dragState.clientX;
|
70
74
|
const left = dragState.left + deltaX;
|
71
75
|
scroll.refs.wrapper!.scrollLeft = left * (scroll.state.contentWidth - scroll.state.hostWidth) / (scroll.state.hostWidth - width.value);
|
72
76
|
}
|
@@ -5,6 +5,7 @@ import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
|
|
5
5
|
import {Scroll} from "./index";
|
6
6
|
import {delay} from "plain-utils/utils/delay";
|
7
7
|
import Tooltip from "../Tooltip";
|
8
|
+
import {ClientZoom} from "../ClientZoom";
|
8
9
|
|
9
10
|
export const VerticalScrollbar = designComponent({
|
10
11
|
props: {
|
@@ -46,15 +47,17 @@ export const VerticalScrollbar = designComponent({
|
|
46
47
|
state.scrollTop = (e.target as HTMLElement).scrollTop;
|
47
48
|
},
|
48
49
|
onMousedown: (e: iMouseEvent) => {
|
50
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
49
51
|
scroll.freezeState.isDragging = true;
|
50
52
|
dragState.top = top.value;
|
51
|
-
dragState.clientY =
|
53
|
+
dragState.clientY = clientY;
|
52
54
|
document.addEventListener('mousemove', handler.onMousemove);
|
53
55
|
document.addEventListener('mouseup', handler.onMouseup);
|
54
56
|
disabledUserSelect();
|
55
57
|
},
|
56
58
|
onMousemove: (e: MouseEvent) => {
|
57
|
-
|
59
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
60
|
+
let deltaY = clientY - dragState.clientY;
|
58
61
|
let top = dragState.top + deltaY;
|
59
62
|
let scrollTop = top * (scroll.state.contentHeight - scroll.state.hostHeight) / (scroll.state.hostHeight - height.value);
|
60
63
|
scrollTop = Math.max(0, Math.min(scrollTop, scroll.state.contentHeight - scroll.state.hostHeight));
|
@@ -72,7 +75,8 @@ export const VerticalScrollbar = designComponent({
|
|
72
75
|
enableUserSelect();
|
73
76
|
|
74
77
|
if (scroll.props.scrollAfterDragEnd) {
|
75
|
-
|
78
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
79
|
+
let deltaY = clientY - dragState.clientY;
|
76
80
|
let top = dragState.top + deltaY;
|
77
81
|
scroll.refs.wrapper!.scrollTop = top * (scroll.state.contentHeight - scroll.state.hostHeight) / (scroll.state.hostHeight - height.value);
|
78
82
|
}
|
@@ -236,7 +236,7 @@ export function createPublicSelectRender(
|
|
236
236
|
const { virtualRowSize } = props;
|
237
237
|
return virtualRowSize == null ? SelectDefaultVirtualRowSize[styleComputed.value.size] : virtualRowSize;
|
238
238
|
})()}>
|
239
|
-
{{ default: ({ item, index }: { item: iSelectOptionProps, index: number }) => <SelectOption {...item} index={index} key={
|
239
|
+
{{ default: ({ item, index, vIndex }: { item: iSelectOptionProps, index: number, vIndex: number }) => <SelectOption {...item} index={index} key={vIndex}/> }}
|
240
240
|
</VirtualList>
|
241
241
|
</div>) : (
|
242
242
|
matchOptionPropsList.map((i, index) => (<SelectOption {...i} index={index}/>))
|
@@ -3,6 +3,7 @@ import {disabledUserSelect} from "plain-utils/dom/disabledUserSelect";
|
|
3
3
|
import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
|
4
4
|
import {iMouseEvent, reactive} from "plain-design-composition";
|
5
5
|
import {iSliderHooks} from "./slider.utils";
|
6
|
+
import {ClientZoom} from "../ClientZoom";
|
6
7
|
|
7
8
|
export function useSliderDotDraggier<InitialState>(
|
8
9
|
hooks: iSliderHooks,
|
@@ -24,10 +25,11 @@ export function useSliderDotDraggier<InitialState>(
|
|
24
25
|
|
25
26
|
const handler = {
|
26
27
|
onMousedown: (e: iMouseEvent) => {
|
28
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
27
29
|
staticState = {
|
28
30
|
start: {
|
29
|
-
x:
|
30
|
-
y:
|
31
|
+
x: clientX,
|
32
|
+
y: clientY,
|
31
33
|
},
|
32
34
|
state: getInitialState(),
|
33
35
|
};
|
@@ -46,8 +48,9 @@ export function useSliderDotDraggier<InitialState>(
|
|
46
48
|
},
|
47
49
|
onMousemove: (e: MouseEvent) => {
|
48
50
|
if (!staticState) {return;}
|
49
|
-
const
|
50
|
-
const
|
51
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
52
|
+
const durX = clientX - staticState.start.x;
|
53
|
+
const durY = clientY - staticState.start.y;
|
51
54
|
handleDraggier({
|
52
55
|
durX,
|
53
56
|
durY,
|
@@ -1,12 +1,12 @@
|
|
1
1
|
@include prefix(step-group) {
|
2
2
|
.#{componentName(step)} {
|
3
3
|
.step-title {
|
4
|
-
font-size:
|
4
|
+
font-size: plv(font-size-normal);
|
5
5
|
color: plv(text-1);
|
6
6
|
}
|
7
7
|
|
8
8
|
.step-content {
|
9
|
-
font-size:
|
9
|
+
font-size: plv(font-size-small);
|
10
10
|
}
|
11
11
|
|
12
12
|
.step-dot {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
.step-icon {
|
22
22
|
width: 32px;
|
23
23
|
height: 32px;
|
24
|
-
font-size:
|
24
|
+
font-size: plv(font-size-normal);
|
25
25
|
line-height: 32px;
|
26
26
|
text-align: center;
|
27
27
|
border-radius: 32px;
|
@@ -200,7 +200,7 @@
|
|
200
200
|
.step-icon {
|
201
201
|
border-color: plv(primary-6);
|
202
202
|
background-color: plv(primary-6);
|
203
|
-
color:
|
203
|
+
color: plv(pbfc);
|
204
204
|
}
|
205
205
|
|
206
206
|
.step-dot {
|
@@ -227,7 +227,7 @@
|
|
227
227
|
.step-icon {
|
228
228
|
border-color: plv(primary-6);
|
229
229
|
background-color: plv(primary-6);
|
230
|
-
color:
|
230
|
+
color: plv(pbfc);
|
231
231
|
}
|
232
232
|
|
233
233
|
.step-title {
|
@@ -266,7 +266,7 @@
|
|
266
266
|
.step-icon {
|
267
267
|
border-color: plv(error-6);
|
268
268
|
background-color: plv(error-6);
|
269
|
-
color:
|
269
|
+
color: plv(pbfc);
|
270
270
|
}
|
271
271
|
|
272
272
|
.step-title {
|
@@ -304,7 +304,7 @@
|
|
304
304
|
.step-icon {
|
305
305
|
width: 20px;
|
306
306
|
height: 20px;
|
307
|
-
font-size:
|
307
|
+
font-size: plv(font-size-small);
|
308
308
|
line-height: 20px;
|
309
309
|
text-align: center;
|
310
310
|
border-radius: 20px;
|
@@ -328,11 +328,11 @@
|
|
328
328
|
}
|
329
329
|
|
330
330
|
.step-title {
|
331
|
-
font-size:
|
331
|
+
font-size: plv(font-size-normal);
|
332
332
|
}
|
333
333
|
|
334
334
|
.step-content {
|
335
|
-
font-size:
|
335
|
+
font-size: plv(font-size-small);
|
336
336
|
}
|
337
337
|
|
338
338
|
&.step-group-vertical {
|
@@ -1,12 +1,14 @@
|
|
1
|
-
import {designComponent, mergeAttrs, nextTick, PropType, reactive, useStyles, watch} from "plain-design-composition";
|
1
|
+
import {designComponent, mergeAttrs, nextTick, PropType, reactive, RenderNode, useStyles, watch} from "plain-design-composition";
|
2
2
|
import {PlTabComponent} from "../Tab";
|
3
3
|
|
4
4
|
export const TabsInner = designComponent({
|
5
5
|
props: {
|
6
6
|
item: { type: Object as PropType<PlTabComponent>, required: true },
|
7
7
|
active: { type: Boolean },
|
8
|
+
render: { type: Function as PropType<() => RenderNode>, required: true }
|
8
9
|
},
|
9
|
-
|
10
|
+
slots: ['default'],
|
11
|
+
setup({ props, slots }) {
|
10
12
|
|
11
13
|
const state = reactive({
|
12
14
|
show: false,
|
@@ -50,7 +52,7 @@ export const TabsInner = designComponent({
|
|
50
52
|
{ class: 'inner-tab', style: styles.value },
|
51
53
|
props.item.attrs
|
52
54
|
)}>
|
53
|
-
{!!state.init && props.
|
55
|
+
{!!state.init && props.render()}
|
54
56
|
</div>
|
55
57
|
)
|
56
58
|
};
|
@@ -6,10 +6,12 @@ import {TabsHeaderHorizontal} from "./header/horizontal/TabsHeaderHorizontal";
|
|
6
6
|
import {TabsHeaderVertical} from "./header/vertical/TabsHeaderVertical";
|
7
7
|
import Tab from "../Tab";
|
8
8
|
import Icon from "../Icon";
|
9
|
+
import {StyleProps, useStyle} from "../../uses/useStyle";
|
9
10
|
|
10
11
|
export const TabGroup = designComponent({
|
11
12
|
name: 'tab-group',
|
12
13
|
props: {
|
14
|
+
...StyleProps,
|
13
15
|
modelValue: { type: [String, Number] }, // 双向绑定值,控制当前显示的tab
|
14
16
|
closeable: { type: Boolean }, // 是否显示关闭按钮,会派发onClose事件
|
15
17
|
fitHeight: { type: Boolean }, // 适配高度
|
@@ -21,6 +23,7 @@ export const TabGroup = designComponent({
|
|
21
23
|
slots: ['default', 'operator'],
|
22
24
|
setup({ props, event: { emit }, slots }) {
|
23
25
|
|
26
|
+
const { styleComputed } = useStyle();
|
24
27
|
const model = useModel(() => props.modelValue, emit.onUpdateModelValue);
|
25
28
|
const items = TabCollector.parent();
|
26
29
|
|
@@ -53,6 +56,7 @@ export const TabGroup = designComponent({
|
|
53
56
|
getComponentCls('tab-group'),
|
54
57
|
`tabs-head-position-${props.headPosition}`,
|
55
58
|
`tabs-head-type-${props.headType}`,
|
59
|
+
`tab-group-size-${styleComputed.value.size}`,
|
56
60
|
{
|
57
61
|
'tabs-fit-height': props.fitHeight
|
58
62
|
},
|
@@ -97,7 +101,7 @@ export const TabGroup = designComponent({
|
|
97
101
|
const body = (
|
98
102
|
<div className="tabs-body">
|
99
103
|
{[...tabs.value].sort((a, b) => String(a.val).localeCompare(String(b.val))).map((tab, index) => (
|
100
|
-
<TabsInner item={tab.item} key={index} active={tab.active}/>
|
104
|
+
<TabsInner item={tab.item} key={index} active={tab.active} render={() => tab.item.slots.default()}/>
|
101
105
|
))}
|
102
106
|
</div>
|
103
107
|
);
|
@@ -65,9 +65,9 @@ export const PlcExpand = designComponent({
|
|
65
65
|
* @author 韦胜健
|
66
66
|
* @date 2022/11/17 10:46
|
67
67
|
*/
|
68
|
-
renderExpand: (node: iTableNode) => {
|
68
|
+
renderExpand: (node: iTableNode, vIndex: number, vid: string, index: number) => {
|
69
69
|
return (
|
70
|
-
<tr className="plt-row plt-expand-row" key={`expand_${
|
70
|
+
<tr className="plt-row plt-expand-row" key={`expand_${table.props.virtualRowType === 'virtualIndex' ? vIndex : index}`} data-vid={vid}>
|
71
71
|
<td className="plt-cell" rowSpan={1} colSpan={totalSpan.value}>
|
72
72
|
<div className="plt-expand-body" style={expandStyles.value}>
|
73
73
|
{scopeSlots.expand({ node, row: node.data })}
|
@@ -128,29 +128,21 @@ export const PlcExpand = designComponent({
|
|
128
128
|
},
|
129
129
|
};
|
130
130
|
|
131
|
-
/**
|
132
|
-
* 不允许启用行虚拟滚动
|
133
|
-
* @author 韦胜健
|
134
|
-
* @date 2022/11/17 13:56
|
135
|
-
*/
|
136
|
-
onBeforeUnmount(table.hooks.onEnableVirtual.use(() => false));
|
137
|
-
|
138
131
|
/**
|
139
132
|
* 拦截行渲染
|
140
133
|
* @author 韦胜健
|
141
134
|
* @date 2022/11/17 14:15
|
142
135
|
*/
|
143
|
-
onBeforeUnmount(table.hooks.
|
144
|
-
const
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
};
|
136
|
+
onBeforeUnmount(table.hooks.onTableMessyData.use(({ data }) => {
|
137
|
+
const newData = [] as any[];
|
138
|
+
data.forEach(item => {
|
139
|
+
newData.push(item);
|
140
|
+
if (typeof item === "function") {return;}
|
141
|
+
if (utils.isExpand(item.data)) {
|
142
|
+
newData.push((param: any) => utils.renderExpand(item, param.vIndex, param.vid, param.index));
|
143
|
+
}
|
144
|
+
});
|
145
|
+
return { data: newData };
|
154
146
|
}));
|
155
147
|
|
156
148
|
/**
|
@@ -108,6 +108,8 @@ export const Table = designComponent({
|
|
108
108
|
*/
|
109
109
|
const { bodyNodes, summaryNodes } = useTableNode({ props, formValidator, dataRef });
|
110
110
|
|
111
|
+
const tableBodyNodes = computed(() => hooks.onTableMessyData.exec({ data: [...bodyNodes.value] }).data);
|
112
|
+
|
111
113
|
const showRows = computed((): number => {
|
112
114
|
const bodyRows = bodyNodes.value.length;
|
113
115
|
if (props.showRows === 'auto') {
|
@@ -323,9 +325,10 @@ export const Table = designComponent({
|
|
323
325
|
<VirtualTable
|
324
326
|
ref={onRefVirtual}
|
325
327
|
height={tableHeight.value || undefined}
|
326
|
-
data={
|
328
|
+
data={tableBodyNodes.value}
|
327
329
|
headData={plcData.value?.headPlcListArray}
|
328
330
|
size={numberState.bodyRowHeight}
|
331
|
+
dynamicSize={props.dynamicSize}
|
329
332
|
headSize={numberState.headRowHeight}
|
330
333
|
width={plcData.value!.targetTableWidth!}
|
331
334
|
summaryData={summaryNodes.value}
|
@@ -351,8 +354,12 @@ export const Table = designComponent({
|
|
351
354
|
</tr>
|
352
355
|
))
|
353
356
|
),
|
354
|
-
default: ({ item,
|
355
|
-
|
357
|
+
default: ({ item, vid, vIndex, index }) => (
|
358
|
+
typeof item !== "function" ? (
|
359
|
+
<PltRow table={refer} node={item} vid={vid} key={props.virtualRowType === 'virtualIndex' ? vIndex : index}/>
|
360
|
+
) : (
|
361
|
+
item({ vid, vIndex, index })
|
362
|
+
)
|
356
363
|
),
|
357
364
|
}}
|
358
365
|
/>
|
@@ -4,6 +4,7 @@ import {Table} from "../../index";
|
|
4
4
|
import {tPlcType} from "../../plc/utils/plc.utils";
|
5
5
|
import {addClass} from "plain-utils/dom/addClass";
|
6
6
|
import {getComponentCls, iMouseEvent} from "plain-design-composition";
|
7
|
+
import {ClientZoom} from "../../../ClientZoom";
|
7
8
|
|
8
9
|
/**
|
9
10
|
* 处理表头拖拽调整宽度的功能
|
@@ -21,6 +22,8 @@ export function useHeadCellResize(table: typeof Table.use.class, getPlc: () => t
|
|
21
22
|
const handler = {
|
22
23
|
mousedown: (e: iMouseEvent) => {
|
23
24
|
|
25
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
26
|
+
|
24
27
|
const tableEl = table.refs.el!;
|
25
28
|
|
26
29
|
e.preventDefault();
|
@@ -29,7 +32,7 @@ export function useHeadCellResize(table: typeof Table.use.class, getPlc: () => t
|
|
29
32
|
window.addEventListener('mousemove', handler.mousemove);
|
30
33
|
window.addEventListener('mouseup', handler.mouseup);
|
31
34
|
disabledUserSelect();
|
32
|
-
state.startX =
|
35
|
+
state.startX = clientX;
|
33
36
|
|
34
37
|
state.indicatorEl = document.createElement('div');
|
35
38
|
|
@@ -55,14 +58,16 @@ export function useHeadCellResize(table: typeof Table.use.class, getPlc: () => t
|
|
55
58
|
document.body.appendChild(state.indicatorEl);
|
56
59
|
},
|
57
60
|
mousemove: (e: MouseEvent) => {
|
58
|
-
|
61
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
62
|
+
state.indicatorEl!.style.transform = `translate3d(${clientX}px,0,0)`;
|
59
63
|
},
|
60
64
|
mouseup: (e: MouseEvent) => {
|
65
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
61
66
|
window.removeEventListener('mousemove', handler.mousemove);
|
62
67
|
window.removeEventListener('mouseup', handler.mouseup);
|
63
68
|
enableUserSelect();
|
64
69
|
document.body.removeChild(state.indicatorEl!);
|
65
|
-
state.endX =
|
70
|
+
state.endX = clientX;
|
66
71
|
let durWidth = state.endX - state.startX!;
|
67
72
|
getPlc().setDurWidth(durWidth);
|
68
73
|
}
|
@@ -12,6 +12,7 @@ import {getComponentCls, iMouseEvent, nextIndex, StyleProperties} from "plain-de
|
|
12
12
|
import {iTableHooks} from "../utils/createTableHooks";
|
13
13
|
import {iElementRect} from "../../../../utils/getRowEl";
|
14
14
|
import {createEnum} from "plain-utils/utils/createEnum";
|
15
|
+
import {ClientZoom} from "../../../ClientZoom";
|
15
16
|
|
16
17
|
export function useTableDraggierCol(
|
17
18
|
{
|
@@ -223,11 +224,12 @@ export function useTableDraggierCol(
|
|
223
224
|
};
|
224
225
|
|
225
226
|
const start = (e: iMouseEvent, plc: tPlcType) => {
|
227
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
226
228
|
staticState = {
|
227
229
|
plc,
|
228
230
|
start: {
|
229
|
-
x:
|
230
|
-
y:
|
231
|
+
x: clientX,
|
232
|
+
y: clientY,
|
231
233
|
},
|
232
234
|
data: null
|
233
235
|
};
|
@@ -237,11 +239,13 @@ export function useTableDraggierCol(
|
|
237
239
|
const update = (e?: MouseEvent) => {
|
238
240
|
if (!staticState) {return;}
|
239
241
|
|
242
|
+
const { clientX, clientY } = !e ? { clientX: 0, clientY: 0 } : ClientZoom.getClientPosition(e);
|
243
|
+
|
240
244
|
let isDragging = !!staticState.data;
|
241
245
|
|
242
246
|
if (!isDragging) {
|
243
247
|
/*拖拽超过一定距离的时候才开始拖拽,避免与点击事件冲突*/
|
244
|
-
if (!!e && Math.abs(
|
248
|
+
if (!!e && Math.abs(clientX - staticState.start.x) > 5) {
|
245
249
|
isDragging = true;
|
246
250
|
initDraggierState();
|
247
251
|
}
|
@@ -253,7 +257,7 @@ export function useTableDraggierCol(
|
|
253
257
|
}
|
254
258
|
|
255
259
|
if (!!e) {
|
256
|
-
staticState.data.move = { x:
|
260
|
+
staticState.data.move = { x: clientX, y: clientY };
|
257
261
|
}
|
258
262
|
const { data: { cloneTable, move, table, left }, start } = staticState;
|
259
263
|
cloneTable.style.top = table.getBoundingClientRect().top + 'px';
|
@@ -470,7 +474,8 @@ export function useTableDraggierCol(
|
|
470
474
|
};
|
471
475
|
const update = (e?: MouseEvent) => {
|
472
476
|
if (!!e) {
|
473
|
-
|
477
|
+
const { clientX } = ClientZoom.getClientPosition(e);
|
478
|
+
staticState!.moveClientX = clientX;
|
474
479
|
} else {
|
475
480
|
staticState!.moveScrollLeft = staticState!.scrollParent!.scrollLeft;
|
476
481
|
}
|