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
package/src/pages/index/app.scss
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
import {designPage} from "plain-design-composition";
|
2
2
|
import {useTableOption} from "../../../module/useTableOption";
|
3
3
|
import {AutoTable, Plc, PlcDate, PlcInput, PlcNumber, PlcSelect, SelectOption} from "../../../../packages";
|
4
|
+
import TableOptionSpace from "../../../../packages/components/TableOptionSpace";
|
5
|
+
|
6
|
+
let option: TableOptionSpace.iTableOption;
|
4
7
|
|
5
8
|
export const demo1 = designPage(() => {
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
if (!option) {
|
11
|
+
option = useTableOption({
|
12
|
+
url: '/demo',
|
13
|
+
showRowsMode: 'auto',
|
14
|
+
fill: true,
|
15
|
+
});
|
16
|
+
}
|
12
17
|
|
13
18
|
|
14
19
|
const onClick = () => {
|
@@ -432,7 +432,7 @@ export const demoDropdownScroll = designPage(() => {
|
|
432
432
|
|
433
433
|
export const demoDropdownVirtualList = designPage(() => {
|
434
434
|
|
435
|
-
const options = new Array(
|
435
|
+
const options = new Array(1000).fill({});
|
436
436
|
|
437
437
|
return () => (
|
438
438
|
<DemoRow title="虚拟滚动,长列表">
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import {designPage} from "plain-design-composition";
|
2
|
+
import {DemoRow} from "../../Demo/DemoRow";
|
3
|
+
import {Layout, LayoutSection} from "../../../../packages";
|
4
|
+
|
5
|
+
export const demo1 = designPage(() => {
|
6
|
+
return () => (
|
7
|
+
<DemoRow title="基本用法">
|
8
|
+
<Layout>
|
9
|
+
<LayoutSection position="left">
|
10
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
11
|
+
<div>左侧调节区域</div>
|
12
|
+
<div>(初始化时自动宽度)</div>
|
13
|
+
</div>
|
14
|
+
</LayoutSection>
|
15
|
+
<LayoutSection>
|
16
|
+
<div style={{ height: '200px', padding: '16px', backgroundColor: 'var(--custom-gray-1)' }}>
|
17
|
+
主内容区域
|
18
|
+
</div>
|
19
|
+
</LayoutSection>
|
20
|
+
<LayoutSection position="right" modelValue={80}>
|
21
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
22
|
+
<div>右侧调节区域</div>
|
23
|
+
<div>(初始化固定80px)</div>
|
24
|
+
</div>
|
25
|
+
</LayoutSection>
|
26
|
+
</Layout>
|
27
|
+
</DemoRow>
|
28
|
+
);
|
29
|
+
});
|
30
|
+
|
31
|
+
|
32
|
+
export const demo2 = designPage(() => {
|
33
|
+
return () => (
|
34
|
+
<DemoRow title="纵向">
|
35
|
+
<Layout vertical style={{ height: '500px' }}>
|
36
|
+
<LayoutSection position="top">
|
37
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
38
|
+
<div>上方调节区域</div>
|
39
|
+
<div>(初始化时自动高度)</div>
|
40
|
+
</div>
|
41
|
+
</LayoutSection>
|
42
|
+
<LayoutSection>
|
43
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-1)' }}>
|
44
|
+
主内容区域
|
45
|
+
</div>
|
46
|
+
</LayoutSection>
|
47
|
+
<LayoutSection position="bottom" modelValue={80}>
|
48
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
49
|
+
<div>下方调节区域</div>
|
50
|
+
<div>(初始化固定80px)</div>
|
51
|
+
</div>
|
52
|
+
</LayoutSection>
|
53
|
+
</Layout>
|
54
|
+
</DemoRow>
|
55
|
+
);
|
56
|
+
});
|
57
|
+
|
58
|
+
|
59
|
+
export const demo3 = designPage(() => {
|
60
|
+
return () => (
|
61
|
+
<DemoRow title="嵌套布局">
|
62
|
+
<Layout vertical style={{ height: '500px' }}>
|
63
|
+
<LayoutSection position="top">
|
64
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
65
|
+
<div>上方调节区域</div>
|
66
|
+
<div>(初始化时自动高度)</div>
|
67
|
+
</div>
|
68
|
+
</LayoutSection>
|
69
|
+
<LayoutSection>
|
70
|
+
<div style={{ position: 'absolute', inset: '0' }}>
|
71
|
+
<Layout style={{ height: '100%' }}>
|
72
|
+
<LayoutSection position="left">
|
73
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
74
|
+
<div>左侧调节区域</div>
|
75
|
+
<div>(初始化时自动宽度)</div>
|
76
|
+
</div>
|
77
|
+
</LayoutSection>
|
78
|
+
<LayoutSection>
|
79
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-1)' }}>
|
80
|
+
主内容区域
|
81
|
+
</div>
|
82
|
+
</LayoutSection>
|
83
|
+
<LayoutSection position="right" modelValue={80}>
|
84
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
85
|
+
<div>右侧调节区域</div>
|
86
|
+
<div>(初始化固定80px)</div>
|
87
|
+
</div>
|
88
|
+
</LayoutSection>
|
89
|
+
</Layout>
|
90
|
+
</div>
|
91
|
+
</LayoutSection>
|
92
|
+
<LayoutSection position="bottom" modelValue={80}>
|
93
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
94
|
+
<div>下方调节区域</div>
|
95
|
+
<div>(初始化固定80px)</div>
|
96
|
+
</div>
|
97
|
+
</LayoutSection>
|
98
|
+
</Layout>
|
99
|
+
</DemoRow>
|
100
|
+
);
|
101
|
+
});
|
102
|
+
|
103
|
+
|
104
|
+
export const demo4 = designPage(() => {
|
105
|
+
return () => (
|
106
|
+
<DemoRow title="嵌套布局2">
|
107
|
+
<Layout>
|
108
|
+
<LayoutSection position="left">
|
109
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
110
|
+
<div>左侧调节区域</div>
|
111
|
+
<div>(初始化时自动宽度)</div>
|
112
|
+
</div>
|
113
|
+
</LayoutSection>
|
114
|
+
<LayoutSection>
|
115
|
+
<Layout vertical style={{ height: '500px' }}>
|
116
|
+
<LayoutSection position="top">
|
117
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
118
|
+
<div>上方调节区域</div>
|
119
|
+
<div>(初始化时自动高度)</div>
|
120
|
+
</div>
|
121
|
+
</LayoutSection>
|
122
|
+
<LayoutSection>
|
123
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-1)' }}>
|
124
|
+
主内容区域
|
125
|
+
</div>
|
126
|
+
</LayoutSection>
|
127
|
+
<LayoutSection position="bottom" modelValue={80}>
|
128
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
129
|
+
<div>下方调节区域</div>
|
130
|
+
<div>(初始化固定80px)</div>
|
131
|
+
</div>
|
132
|
+
</LayoutSection>
|
133
|
+
</Layout>
|
134
|
+
</LayoutSection>
|
135
|
+
<LayoutSection position="right" modelValue={80}>
|
136
|
+
<div style={{ padding: '16px', backgroundColor: 'var(--custom-gray-2)', height: '100%' }}>
|
137
|
+
<div>右侧调节区域</div>
|
138
|
+
<div>(初始化固定80px)</div>
|
139
|
+
</div>
|
140
|
+
</LayoutSection>
|
141
|
+
</Layout>
|
142
|
+
</DemoRow>
|
143
|
+
);
|
144
|
+
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import {designPage, getComponentCls, reactive} from "plain-design-composition";
|
2
2
|
import {DemoRow} from "../../Demo/DemoRow";
|
3
3
|
import {Button, Checkbox, Loading, LoadingMask} from "../../../../packages";
|
4
|
+
import {PlainLogo} from 'plain-icons/src/packages/component/logo/react';
|
4
5
|
|
5
6
|
export const demo1 = designPage(() => () => (
|
6
7
|
<DemoRow title="基本用法">
|
@@ -19,6 +20,7 @@ export const demo2 = designPage(() => () => (
|
|
19
20
|
<Loading type="thet"/>
|
20
21
|
<Loading type="iot"/>
|
21
22
|
<Loading type="kappa"/>
|
23
|
+
<PlainLogo loading/>
|
22
24
|
</DemoRow>
|
23
25
|
));
|
24
26
|
export const demo3 = designPage(() => () => (
|
@@ -33,6 +35,7 @@ export const demo3 = designPage(() => () => (
|
|
33
35
|
<Loading type="thet" style={{ fontSize: '32px' }}/>
|
34
36
|
<Loading type="iot" style={{ fontSize: '32px' }}/>
|
35
37
|
<Loading type="kappa" style={{ fontSize: '32px' }}/>
|
38
|
+
<PlainLogo loading style={{ fontSize: '32px' }}/>
|
36
39
|
</DemoRow>
|
37
40
|
));
|
38
41
|
export const demo4 = designPage(() => () => (
|
@@ -313,23 +313,23 @@ export const demoInit = designPage(() => {
|
|
313
313
|
<Tab title="用户管理" style={{ padding: '20px 0' }}>
|
314
314
|
<span>用户管理:</span>
|
315
315
|
<Input
|
316
|
-
onMounted={() => console.log('用户管理
|
317
|
-
|
316
|
+
onMounted={() => console.log('用户管理 mounted',)}
|
317
|
+
onUnmounted={() => console.log('用户管理 unmount',)}
|
318
318
|
/>
|
319
319
|
</Tab>
|
320
320
|
<Tab title="立即初始化" style={{ padding: '20px 0' }} init>
|
321
321
|
<span>子模块数据管理:</span>
|
322
322
|
<Input
|
323
|
-
onMounted={() => console.log('立即初始化
|
324
|
-
|
323
|
+
onMounted={() => console.log('立即初始化 mounted',)}
|
324
|
+
onUnmounted={() => console.log('立即初始化 unmount',)}
|
325
325
|
/>
|
326
326
|
</Tab>
|
327
327
|
<Tab title="关闭的时候销毁" style={{ padding: '20px 0' }} destroyOnHide>
|
328
328
|
<span>数据集:</span>
|
329
329
|
<Input
|
330
330
|
modelValue={'初始值'}
|
331
|
-
onMounted={() => console.log('关闭的时候销毁
|
332
|
-
|
331
|
+
onMounted={() => console.log('关闭的时候销毁 mounted',)}
|
332
|
+
onUnmounted={() => console.log('关闭的时候销毁 unmount',)}
|
333
333
|
/>
|
334
334
|
</Tab>
|
335
335
|
</TabGroup>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {designPage, getComponentCls, reactive, useRefs} from "plain-design-composition";
|
2
2
|
import {DemoRow} from "../../Demo/DemoRow";
|
3
|
-
import {$message, Alert, Button, ButtonGroup, Checkbox, Input, Segment, SegmentGroup, Tree} from "../../../../packages";
|
3
|
+
import {$message, Alert, Button, ButtonGroup, Checkbox, Input, Layout, LayoutSection, Segment, SegmentGroup, Tree, TreeNodeWithMenu} from "../../../../packages";
|
4
4
|
import treeData from '../../../data/tree.data.json';
|
5
5
|
import addressData from '../../../data/address.json';
|
6
6
|
import {iTreeNode} from "../../../../packages/components/TreeCore/createTreeNode";
|
@@ -8,6 +8,7 @@ import {deepcopy} from 'plain-utils/object/deepcopy';
|
|
8
8
|
import {iTreeProps} from "../../../../packages/components/TreeCore/TreeCore.type";
|
9
9
|
import {iTreeDragChangeData} from "../../../../packages/components/TreeCore/createTreeProps";
|
10
10
|
import {delay} from "plain-utils/utils/delay";
|
11
|
+
import {iTreeNodeWithMenuOption} from "../../../../packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils";
|
11
12
|
|
12
13
|
export const demo1 = designPage(() => {
|
13
14
|
|
@@ -1089,7 +1090,7 @@ export const demoVirtualDraggable = designPage(() => {
|
|
1089
1090
|
onDragChange={onDragChange}
|
1090
1091
|
innerAttrs={{
|
1091
1092
|
style: {
|
1092
|
-
backgroundColor: `var(--custom-background-hover)`,
|
1093
|
+
// backgroundColor: `var(--custom-background-hover)`,
|
1093
1094
|
}
|
1094
1095
|
}}
|
1095
1096
|
/>
|
@@ -1097,3 +1098,86 @@ export const demoVirtualDraggable = designPage(() => {
|
|
1097
1098
|
</DemoRow>
|
1098
1099
|
);
|
1099
1100
|
});
|
1101
|
+
|
1102
|
+
|
1103
|
+
export const demoCustomDraggier = designPage(() => {
|
1104
|
+
|
1105
|
+
const { refs, onRef } = useRefs({ tree: Tree });
|
1106
|
+
|
1107
|
+
const state = reactive({
|
1108
|
+
checked: [] as any[],
|
1109
|
+
undoDraggier: false,
|
1110
|
+
});
|
1111
|
+
|
1112
|
+
const onDragChange = (data: iTreeDragChangeData) => {
|
1113
|
+
console.log(data);
|
1114
|
+
if (state.undoDraggier) {
|
1115
|
+
delay(2000).then(() => {data.undo();});
|
1116
|
+
}
|
1117
|
+
};
|
1118
|
+
|
1119
|
+
const getNodeOptions = (treeNode: iTreeNode): iTreeNodeWithMenuOption[] | undefined => {
|
1120
|
+
if (treeNode.level === 0) {
|
1121
|
+
return [
|
1122
|
+
{ label: '新建菜单', onClick: () => {$message(`${treeNode.label()} -> 新建菜单`);} },
|
1123
|
+
{ label: '新建菜单分组', onClick: () => {$message(`${treeNode.label()} -> 新建菜单分组`);} },
|
1124
|
+
];
|
1125
|
+
}
|
1126
|
+
if (treeNode.level === 1) {
|
1127
|
+
return [
|
1128
|
+
{ label: '新建菜单', onClick: () => {$message(`${treeNode.label()} -> 新建菜单`);} },
|
1129
|
+
];
|
1130
|
+
}
|
1131
|
+
};
|
1132
|
+
|
1133
|
+
return () => (
|
1134
|
+
<DemoRow title="自定义拖拽节点">
|
1135
|
+
<ButtonGroup style={{ margin: '4px 0' }}>
|
1136
|
+
<Button label="全部展开" onClick={() => refs.tree!.methods.expandAll()}/>
|
1137
|
+
<Button label="全部收起" onClick={() => refs.tree!.methods.collapseAll()}/>
|
1138
|
+
<Button label="展开特定节点" onClick={() => refs.tree!.methods.expand(['2-2-2'])}/>
|
1139
|
+
<Button label="展开部分节点" onClick={() => refs.tree!.methods.expand(['2-2-2', '3-1-2'])}/>
|
1140
|
+
<Button label="当前选中节点" onClick={() => {
|
1141
|
+
const current = refs.tree!.methods.getCurrent();
|
1142
|
+
$message(!!current ? current.data.name : '未选中任何节点!');
|
1143
|
+
}}/>
|
1144
|
+
<Button label="展开并且设置当前选中节点" onClick={() => {
|
1145
|
+
refs.tree!.methods.expand('2-2-2');
|
1146
|
+
refs.tree!.methods.setCurrent('2-2-2');
|
1147
|
+
}}/>
|
1148
|
+
<Button>
|
1149
|
+
<Checkbox v-model={state.undoDraggier} label="拖拽移动2s后撤回拖拽操作"/>
|
1150
|
+
</Button>
|
1151
|
+
</ButtonGroup>
|
1152
|
+
<Layout style={{ marginTop: '16px' }}>
|
1153
|
+
<LayoutSection position="left" modelValue={120}>
|
1154
|
+
<Tree
|
1155
|
+
v-model={state.checked}
|
1156
|
+
ref={onRef.tree}
|
1157
|
+
data={addressData}
|
1158
|
+
keyField="id"
|
1159
|
+
labelField="name"
|
1160
|
+
childrenField="children"
|
1161
|
+
singleValueType="last"
|
1162
|
+
virtual
|
1163
|
+
onDragChange={onDragChange}
|
1164
|
+
draggable
|
1165
|
+
customDraggier
|
1166
|
+
expandOnClickNode
|
1167
|
+
v-slots={{
|
1168
|
+
default: ({ treeNode }: { treeNode: iTreeNode }) => (
|
1169
|
+
<TreeNodeWithMenu treeNode={treeNode} dropdownOptions={getNodeOptions(treeNode)}/>
|
1170
|
+
)
|
1171
|
+
}}
|
1172
|
+
/>
|
1173
|
+
</LayoutSection>
|
1174
|
+
<LayoutSection>
|
1175
|
+
<div style={{ height: '500px', padding: '0 16px' }}>
|
1176
|
+
内容区域
|
1177
|
+
</div>
|
1178
|
+
</LayoutSection>
|
1179
|
+
</Layout>
|
1180
|
+
|
1181
|
+
</DemoRow>
|
1182
|
+
);
|
1183
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {computed, designPage, getComponentCls, classnames,reactive} from "plain-design-composition";
|
1
|
+
import {computed, designPage, getComponentCls, classnames, reactive} from "plain-design-composition";
|
2
2
|
import data2 from '../../../data/data-2.json';
|
3
3
|
import {DemoRow} from "../../Demo/DemoRow";
|
4
4
|
import {Alert, ApplicationConfigurationProvider, Checkbox, VirtualList} from "../../../../packages";
|
@@ -11,7 +11,7 @@ export const demo1 = designPage(() => {
|
|
11
11
|
if (colors.length === 0) {colors = [...sourceColors];}
|
12
12
|
const palette = colors.splice(Math.floor(Math.random() * colors.length), 1);
|
13
13
|
const backgroundColor = `var(--${getComponentCls(`${palette}-1`)})`;
|
14
|
-
const color = `var(--${getComponentCls(`${palette}-6`)})
|
14
|
+
const color = `var(--${getComponentCls(`${palette}-6`)})`;
|
15
15
|
return { backgroundColor, color };
|
16
16
|
};
|
17
17
|
const list = computed(() => data2.slice(0, 188).map(item => ({ ...item, color: getRandomColor() })));
|
@@ -91,7 +91,7 @@ export const demo2 = designPage(() => {
|
|
91
91
|
if (colors.length === 0) {colors = [...sourceColors];}
|
92
92
|
const palette = colors.splice(Math.floor(Math.random() * colors.length), 1);
|
93
93
|
const backgroundColor = `var(--${getComponentCls(`${palette}-1`)})`;
|
94
|
-
const color = `var(--${getComponentCls(`${palette}-6`)})
|
94
|
+
const color = `var(--${getComponentCls(`${palette}-6`)})`;
|
95
95
|
return { backgroundColor, color };
|
96
96
|
};
|
97
97
|
const list = computed(() => data2.slice(0, 188).map(item => ({ ...item, color: getRandomColor() })));
|
@@ -100,11 +100,11 @@ export const demo2 = designPage(() => {
|
|
100
100
|
<DemoRow title={'动态高度'}>
|
101
101
|
<div style={{ width: '300px', height: '400px', backgroundColor: '#f6f6f6' }}>
|
102
102
|
<VirtualList data={list.value} size={60} dynamicSize v-slots={{
|
103
|
-
default: ({ item, index }) => (
|
103
|
+
default: ({ item, vid, index, vIndex }) => (
|
104
104
|
<div
|
105
|
-
key={
|
106
|
-
data-vid={
|
107
|
-
onClick={() => console.log(
|
105
|
+
key={vIndex}
|
106
|
+
data-vid={vid}
|
107
|
+
onClick={() => console.log(vid, { ...item })}
|
108
108
|
style={{
|
109
109
|
...item.color,
|
110
110
|
height: item.size + 'px',
|
@@ -165,7 +165,7 @@ export const demo3 = designPage(() => {
|
|
165
165
|
if (colors.length === 0) {colors = [...sourceColors];}
|
166
166
|
const palette = colors.splice(Math.floor(Math.random() * colors.length), 1);
|
167
167
|
const backgroundColor = `var(--${getComponentCls(`${palette}-1`)})`;
|
168
|
-
const color = `var(--${getComponentCls(`${palette}-6`)})
|
168
|
+
const color = `var(--${getComponentCls(`${palette}-6`)})`;
|
169
169
|
return { backgroundColor, color };
|
170
170
|
};
|
171
171
|
const list = computed(() => data2.map(item => ({ ...item, color: getRandomColor() })));
|
@@ -250,7 +250,7 @@ export const demo4 = designPage(() => {
|
|
250
250
|
if (colors.length === 0) {colors = [...sourceColors];}
|
251
251
|
const palette = colors.splice(Math.floor(Math.random() * colors.length), 1);
|
252
252
|
const backgroundColor = `var(--${getComponentCls(`${palette}-1`)})`;
|
253
|
-
const color = `var(--${getComponentCls(`${palette}-6`)})
|
253
|
+
const color = `var(--${getComponentCls(`${palette}-6`)})`;
|
254
254
|
return { backgroundColor, color };
|
255
255
|
};
|
256
256
|
const list = computed(() => data2.map(item => ({ ...item, color: getRandomColor() })));
|
@@ -195,6 +195,7 @@ export const demoInput = designPage(() => {
|
|
195
195
|
<Button label={'input'} onClick={() => $dialog({
|
196
196
|
editType: 'input',
|
197
197
|
editValue: inputValue,
|
198
|
+
editRequired: true,
|
198
199
|
handleConfirm: ({ editValue }) => {
|
199
200
|
inputValue = editValue;
|
200
201
|
$message(String(editValue));
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {designPage, getComponentCls, iMouseEvent, reactive, useRefs} from "plain-design-composition";
|
2
|
-
import {Button, Checkbox} from "../../../../packages";
|
2
|
+
import {Button, Checkbox, ClientZoom} from "../../../../packages";
|
3
3
|
import {DemoRow} from "../../Demo/DemoRow";
|
4
4
|
import {usePopup} from "../../../../packages/components/usePopup/usePopup";
|
5
5
|
import {ePopupAnimation, ePopupTrigger, iPopupPlacement, iPopupUseOption} from "../../../../packages/components/usePopup/utils/popup.utils";
|
@@ -295,10 +295,13 @@ export const demoAbsolute = designPage(() => {
|
|
295
295
|
|
296
296
|
const handler = {
|
297
297
|
onContextmenu: (e: iMouseEvent) => {
|
298
|
+
|
299
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
300
|
+
|
298
301
|
e.preventDefault();
|
299
302
|
$popup.absolute({
|
300
|
-
x:
|
301
|
-
y:
|
303
|
+
x: clientX,
|
304
|
+
y: clientY,
|
302
305
|
type: 'demo-absolute',
|
303
306
|
placement: 'right-start',
|
304
307
|
trigger: 'contextmenu',
|
@@ -8,7 +8,19 @@ import {ColorPicker, DatePicker, Form, FormItem, Input, InputNumber, Plc, PlcExp
|
|
8
8
|
export const demoExpand = designPage(() => {
|
9
9
|
|
10
10
|
const state = reactive({
|
11
|
-
data
|
11
|
+
data: data.map((item) => {
|
12
|
+
return {
|
13
|
+
...item,
|
14
|
+
children: new Array(Math.ceil(Math.random() * 5 + 2)).fill(null).map((_, index) => {
|
15
|
+
return {
|
16
|
+
id: index,
|
17
|
+
date: item.date,
|
18
|
+
name: item.name + `_${index + 1}`,
|
19
|
+
address: item.addr,
|
20
|
+
};
|
21
|
+
})
|
22
|
+
};
|
23
|
+
}),
|
12
24
|
});
|
13
25
|
|
14
26
|
const summaryData = deepcopy(data.slice(0, 2));
|
@@ -19,6 +31,8 @@ export const demoExpand = designPage(() => {
|
|
19
31
|
data={state.data}
|
20
32
|
summaryData={summaryData}
|
21
33
|
virtual
|
34
|
+
virtualRowType="realIndex"
|
35
|
+
dynamicSize
|
22
36
|
showRows={10}
|
23
37
|
>
|
24
38
|
<PlcIndex/>
|
@@ -27,14 +41,12 @@ export const demoExpand = designPage(() => {
|
|
27
41
|
v-slots={{
|
28
42
|
expand: ({ row }) => {
|
29
43
|
return (
|
30
|
-
<div style={{ padding: '
|
31
|
-
<
|
32
|
-
<
|
33
|
-
<
|
34
|
-
<
|
35
|
-
|
36
|
-
<FormItem label={'颜色'}><ColorPicker v-model={row.color}/></FormItem>
|
37
|
-
</Form>
|
44
|
+
<div style={{ padding: '20px' }}>
|
45
|
+
<Table data={row.children} showRows="auto" size="small">
|
46
|
+
<Plc title="名称" field="name"/>
|
47
|
+
<Plc title="日期" field="date"/>
|
48
|
+
<Plc title="地址" field="address"/>
|
49
|
+
</Table>
|
38
50
|
</div>
|
39
51
|
);
|
40
52
|
}
|
@@ -68,7 +80,19 @@ export const demoExpand = designPage(() => {
|
|
68
80
|
export const demoExpandVirtualCOlumn = designPage(() => {
|
69
81
|
|
70
82
|
const state = reactive({
|
71
|
-
data
|
83
|
+
data: data.map((item) => {
|
84
|
+
return {
|
85
|
+
...item,
|
86
|
+
children: new Array(Math.ceil(Math.random() * 5 + 2)).fill(null).map((_, index) => {
|
87
|
+
return {
|
88
|
+
id: index,
|
89
|
+
date: item.date,
|
90
|
+
name: item.name + `_${index + 1}`,
|
91
|
+
address: item.addr,
|
92
|
+
};
|
93
|
+
})
|
94
|
+
};
|
95
|
+
}),
|
72
96
|
});
|
73
97
|
|
74
98
|
const summaryData = deepcopy(data.slice(0, 2));
|
@@ -80,23 +104,21 @@ export const demoExpandVirtualCOlumn = designPage(() => {
|
|
80
104
|
summaryData={summaryData}
|
81
105
|
virtual
|
82
106
|
showRows={10}
|
107
|
+
dynamicSize
|
83
108
|
virtualColumn
|
84
109
|
>
|
85
110
|
<PlcIndex/>
|
86
111
|
<PlcExpand
|
87
|
-
toggleOnClickRow
|
88
112
|
fixedWidth
|
89
113
|
v-slots={{
|
90
114
|
expand: ({ row }) => {
|
91
115
|
return (
|
92
|
-
<div style={{ padding: '
|
93
|
-
<
|
94
|
-
<
|
95
|
-
<
|
96
|
-
<
|
97
|
-
|
98
|
-
<FormItem label={'颜色'}><ColorPicker v-model={row.color}/></FormItem>
|
99
|
-
</Form>
|
116
|
+
<div style={{ padding: '20px' }}>
|
117
|
+
<Table data={row.children} showRows="auto" size="small">
|
118
|
+
<Plc title="名称" field="name"/>
|
119
|
+
<Plc title="日期" field="date"/>
|
120
|
+
<Plc title="地址" field="address"/>
|
121
|
+
</Table>
|
100
122
|
</div>
|
101
123
|
);
|
102
124
|
}
|
@@ -69,8 +69,8 @@ export const demo1 = designPage(() => {
|
|
69
69
|
</tr>
|
70
70
|
))
|
71
71
|
),
|
72
|
-
default: ({ item,
|
73
|
-
<tr key={
|
72
|
+
default: ({ item, vid, vIndex }) => (
|
73
|
+
<tr key={vIndex} data-vid={vid} style={{ height: '40px', borderBottom: 'solid 1px #ececec', backgroundColor: "item.color" }}>
|
74
74
|
{Object.keys(DATA[0] as any).map((key: string) => (
|
75
75
|
<td key={key}>{(item as any)[key]}</td>
|
76
76
|
))}
|
@@ -104,8 +104,8 @@ export const demo1 = designPage(() => {
|
|
104
104
|
</tr>
|
105
105
|
))
|
106
106
|
),
|
107
|
-
default: ({ item,
|
108
|
-
<tr key={
|
107
|
+
default: ({ item, vIndex, vid }) => (
|
108
|
+
<tr key={vIndex} data-vid={vid} style={{ height: '40px', borderBottom: 'solid 1px #ececec', backgroundColor: "item.color" }}>
|
109
109
|
{Object.keys(DATA[0] as any).map((key: string) => (
|
110
110
|
<td key={key}>{(item as any)[key]}</td>
|
111
111
|
))}
|