plain-design 1.0.0-beta.3 → 1.0.0-beta.31
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 +20 -3
- package/src/packages/components/InputNumber/input-number.utils.tsx +7 -5
- package/src/packages/components/InputNumber/useInputNumber.public.tsx +25 -6
- 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/DemoNumber.tsx +4 -1
- 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
@@ -29,7 +29,7 @@ export const VirtualTable = designComponent({
|
|
29
29
|
},
|
30
30
|
slots: ['colgroup', 'head', 'headColgroup'],
|
31
31
|
scopeSlots: {
|
32
|
-
default: (scope: { item: any, index: number,
|
32
|
+
default: (scope: { item: any, index: number, vIndex: number, vid: string }) => {},
|
33
33
|
},
|
34
34
|
setup({ props, slots, scopeSlots, event: { emit } }) {
|
35
35
|
|
@@ -70,7 +70,7 @@ export const VirtualTable = designComponent({
|
|
70
70
|
const strutStyles = useStyles(style => {
|
71
71
|
Object.assign(style, virtual.strutStyles.value);
|
72
72
|
!!props.width && (style.width = unit(props.width));
|
73
|
-
style.minHeight = bodyTableWrapperStyles.value.minHeight
|
73
|
+
style.minHeight = bodyTableWrapperStyles.value.minHeight;
|
74
74
|
});
|
75
75
|
|
76
76
|
const contentStyles = useStyles(style => {
|
@@ -157,7 +157,7 @@ export const VirtualTable = designComponent({
|
|
157
157
|
<>
|
158
158
|
{!!headHeight.value && (
|
159
159
|
<div className="virtual-table-head-table-wrapper" ref={onRef.head}>
|
160
|
-
<table className="virtual-table-head-table" style={headTableStyles.value} {...PublicTableAttrs}>
|
160
|
+
<table className="virtual-table-head-table" style={headTableStyles.value} {...PublicTableAttrs} data-virtual-head>
|
161
161
|
{slots.headColgroup()}
|
162
162
|
<thead>{slots.head()}</thead>
|
163
163
|
</table>
|
@@ -168,16 +168,16 @@ export const VirtualTable = designComponent({
|
|
168
168
|
<div className="virtual-table-body-table-wrapper" ref={onRef.body} style={bodyTableWrapperStyles.value}>
|
169
169
|
<table className="virtual-table-body-table" {...{ ...PublicTableAttrs, style: tableStyles.value }}>
|
170
170
|
{slots.colgroup()}
|
171
|
-
<tbody>{list.map((
|
171
|
+
<tbody>{list.map((item, vIndex) => scopeSlots.default({ ...item, vIndex, vid: item.id }))}</tbody>
|
172
172
|
</table>
|
173
173
|
</div>
|
174
174
|
</div>
|
175
175
|
</div>
|
176
176
|
{!!props.summaryData?.length && (
|
177
177
|
<div className="virtual-table-summary-table-wrapper" ref={onRef.summary}>
|
178
|
-
<table className="virtual-table-summary-table" style={summaryTableStyles.value}{...PublicTableAttrs}>
|
178
|
+
<table className="virtual-table-summary-table" style={summaryTableStyles.value}{...PublicTableAttrs} data-virtual-foot>
|
179
179
|
{slots.colgroup()}
|
180
|
-
<tbody>{!props.summaryData ? null : props.summaryData.map((item, index) => scopeSlots.default({ item, index,
|
180
|
+
<tbody>{!props.summaryData ? null : props.summaryData.map((item, index) => scopeSlots.default({ item, index, vIndex: index, vid: `__smy__${index}` }))}</tbody>
|
181
181
|
</table>
|
182
182
|
</div>
|
183
183
|
)}
|
@@ -10,6 +10,7 @@ import Icon from "../Icon";
|
|
10
10
|
import {ThemeStatusIcons} from "../Application/theme/theme.utils";
|
11
11
|
import Input from "../Input";
|
12
12
|
import InputNumber from "../InputNumber";
|
13
|
+
import $message from "../$message";
|
13
14
|
|
14
15
|
/**
|
15
16
|
* 弹框服务单个组件
|
@@ -133,7 +134,15 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
|
|
133
134
|
const dialogProps = { ...targetOption.value.dialogProps };
|
134
135
|
|
135
136
|
/*wrap handleConfirm*/
|
136
|
-
dialogProps.handleConfirm = async (close: () => void) =>
|
137
|
+
dialogProps.handleConfirm = async (close: () => void) => {
|
138
|
+
if (!!targetOption.value.customOption.editRequired) {
|
139
|
+
if (state.editValue == null || !state.editValue.trim().length) {
|
140
|
+
$message.warn('不能为空!');
|
141
|
+
return false;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
return targetOption.value.customOption.handleConfirm?.({ close, editValue: state.editValue });
|
145
|
+
};
|
137
146
|
|
138
147
|
/*wrap onClose*/
|
139
148
|
dialogProps.onClose = () => onClose.exec(undefined);
|
@@ -165,6 +174,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
|
|
165
174
|
v-model={state.editValue}
|
166
175
|
readonly={option.editReadonly}
|
167
176
|
onEnter={onEnter}
|
177
|
+
status={option.editRequired ? 'warn' : undefined}
|
168
178
|
/>
|
169
179
|
);
|
170
180
|
break;
|
@@ -176,6 +186,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
|
|
176
186
|
v-model={state.editValue}
|
177
187
|
readonly={option.editReadonly}
|
178
188
|
onEnter={onEnter}
|
189
|
+
status={option.editRequired ? 'warn' : undefined}
|
179
190
|
/>
|
180
191
|
);
|
181
192
|
break;
|
@@ -189,6 +200,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
|
|
189
200
|
v-model={state.editValue}
|
190
201
|
readonly={option.editReadonly}
|
191
202
|
onEnter={onEnter}
|
203
|
+
status={option.editRequired ? 'warn' : undefined}
|
192
204
|
/>
|
193
205
|
);
|
194
206
|
break;
|
@@ -8,6 +8,7 @@ import {Icon} from "../Icon";
|
|
8
8
|
import i18n from "../i18n";
|
9
9
|
import Transition from "../Transition";
|
10
10
|
import {APPLICATION_SERVICE_CONTAINER_CLASS} from "../Application/utils/application.utils";
|
11
|
+
import {ClientZoom} from "../ClientZoom";
|
11
12
|
|
12
13
|
const nextCount = createCounter("image_preview");
|
13
14
|
|
@@ -167,18 +168,20 @@ export const ImageService = createApplicationServiceComponent<ImageServicePrevie
|
|
167
168
|
startY: 0,
|
168
169
|
};
|
169
170
|
const mousedown = (e: MouseEvent) => {
|
171
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
170
172
|
freezeState = {
|
171
173
|
startTop: state.adjust.top || 0,
|
172
174
|
startLeft: state.adjust.left || 0,
|
173
|
-
startX:
|
174
|
-
startY:
|
175
|
+
startX: clientX,
|
176
|
+
startY: clientY,
|
175
177
|
};
|
176
178
|
document.addEventListener('mousemove', mousemove);
|
177
179
|
document.addEventListener('mouseup', mouseup);
|
178
180
|
};
|
179
181
|
const mousemove = (e: MouseEvent) => {
|
180
|
-
|
181
|
-
state.adjust.
|
182
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
183
|
+
state.adjust.left = clientX - freezeState.startX + freezeState.startLeft;
|
184
|
+
state.adjust.top = clientY - freezeState.startY + freezeState.startTop;
|
182
185
|
};
|
183
186
|
const mouseup = (e: MouseEvent) => {
|
184
187
|
document.removeEventListener('mousemove', mousemove);
|
@@ -2,6 +2,7 @@ import {designComponent, getComponentCls, iMouseEvent, nextIndex, onMounted, Pro
|
|
2
2
|
import {closeMessageServiceHook, iMessageServiceOption} from "./message.service.utils";
|
3
3
|
import Icon from "../Icon";
|
4
4
|
import './message.scss';
|
5
|
+
import {useStyle} from "../../uses/useStyle";
|
5
6
|
|
6
7
|
export const Message = designComponent({
|
7
8
|
name: 'message-service',
|
@@ -16,9 +17,12 @@ export const Message = designComponent({
|
|
16
17
|
|
17
18
|
onMounted(() => emit.onReady());
|
18
19
|
|
20
|
+
const { styleComputed } = useStyle();
|
21
|
+
|
19
22
|
const classes = useClasses(() => [
|
20
23
|
getComponentCls('message'),
|
21
|
-
`message-status-${props.option.status}
|
24
|
+
`message-status-${props.option.status}`,
|
25
|
+
`message-size-${styleComputed.value.size}`
|
22
26
|
]);
|
23
27
|
const styles = { zIndex: nextIndex() };
|
24
28
|
|
@@ -128,7 +128,7 @@
|
|
128
128
|
}
|
129
129
|
.message-close {
|
130
130
|
@include prefix(icon) {
|
131
|
-
|
131
|
+
color: plv(pbfc);
|
132
132
|
}
|
133
133
|
|
134
134
|
&:after {
|
@@ -142,4 +142,8 @@
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
}
|
145
|
+
|
146
|
+
@include sizeMixin(message, (font-size)) {
|
147
|
+
padding: calc(#{plv(dropdown-size-#{$name}-padding-y)} * 2);
|
148
|
+
}
|
145
149
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {designComponent, getComponentCls, iHTMLDivElement, iHTMLElement, iTransitionEvent, nextIndex, onBeforeUnmount, onMounted, Portal, PropType, reactive, SimpleFunction, useClassCache, useRefs, useStyleCache} from "plain-design-composition";
|
1
|
+
import {designComponent, getComponentCls, iHTMLDivElement, iHTMLElement, iMouseEvent, iTransitionEvent, nextIndex, onBeforeUnmount, onMounted, Portal, PropType, reactive, SimpleFunction, useClassCache, useRefs, useStyleCache} from "plain-design-composition";
|
2
2
|
import {ePopupAnimation, iPopupOption, iPopupRefs, PopupItemProvide} from "./utils/popup.utils";
|
3
3
|
import {createEffects} from "plain-utils/utils/createEffects";
|
4
4
|
import {delay} from "plain-utils/utils/delay";
|
@@ -82,6 +82,7 @@ export const PopupItem = designComponent({
|
|
82
82
|
'popup-item-is-dark': !application.value.theme.dark && !state.option.status && !!state.option.dark,
|
83
83
|
[`popup-item-status-${state.option.status}`]: !!state.option.status,
|
84
84
|
'popup-item-dark-app': application.value.theme.dark,
|
85
|
+
'popup-item-no-interactive': !state.option.interactive,
|
85
86
|
}
|
86
87
|
]);
|
87
88
|
|
@@ -193,7 +194,7 @@ export const PopupItem = designComponent({
|
|
193
194
|
clearTimeout(timer);
|
194
195
|
timer = null;
|
195
196
|
}
|
196
|
-
methods.refresh(
|
197
|
+
methods.refresh(state.option.transformRefreshOnScroll);
|
197
198
|
timer = setTimeout(() => {
|
198
199
|
methods.refresh();
|
199
200
|
}, 100);
|
@@ -262,6 +263,14 @@ export const PopupItem = designComponent({
|
|
262
263
|
};
|
263
264
|
return check;
|
264
265
|
})(),
|
266
|
+
/**
|
267
|
+
* 阻止点击popup的事件冒泡,如果有div包裹popup几点,在react中即使popup不是这个div的子节点也会导致事件冒泡到div上
|
268
|
+
* @author 韦胜健
|
269
|
+
* @date 2023/8/10 11:27
|
270
|
+
*/
|
271
|
+
onClickPopup: (e: iMouseEvent) => {
|
272
|
+
e.stopPropagation();
|
273
|
+
},
|
265
274
|
};
|
266
275
|
|
267
276
|
onMounted(async () => {
|
@@ -361,34 +370,44 @@ export const PopupItem = designComponent({
|
|
361
370
|
PopupItemProvide.provide(state);
|
362
371
|
|
363
372
|
return () => (
|
364
|
-
!!state.option.reference &&
|
365
|
-
|
366
|
-
|
367
|
-
ref={onRef.popup}
|
368
|
-
className={classes.value}
|
369
|
-
data-popup-show={String(state.isShow)}
|
370
|
-
onTransitionEnd={handler.onTransitionend}
|
371
|
-
style={styles.value}
|
372
|
-
>
|
373
|
-
{/*slide的情况下,arrow得放body外面,避免被overflow:hidden*/}
|
374
|
-
{!!state.option.arrowSize && !state.option.noArrow && state.option.animation !== ePopupAnimation.scale && (<div className="popup-item-arrow" ref={onRef.arrow}/>)}
|
375
|
-
<div
|
376
|
-
ref={onRef.body}
|
377
|
-
className="popup-item-body"
|
378
|
-
>
|
379
|
-
{/*scale的情况下,arrow得放body里边,一遍能够继承body的transform:scale*/}
|
380
|
-
{!!state.option.arrowSize && !state.option.noArrow && state.option.animation === ePopupAnimation.scale && (<div className="popup-item-arrow" ref={onRef.arrow}/>)}
|
373
|
+
!!state.option.reference && (
|
374
|
+
(() => {
|
375
|
+
const content = (
|
381
376
|
<div
|
382
|
-
|
383
|
-
|
384
|
-
className=
|
377
|
+
data-id={state.option.id}
|
378
|
+
ref={onRef.popup}
|
379
|
+
className={classes.value}
|
380
|
+
data-popup-show={String(state.isShow)}
|
385
381
|
onTransitionEnd={handler.onTransitionend}
|
382
|
+
style={styles.value}
|
383
|
+
onClick={handler.onClickPopup}
|
386
384
|
>
|
387
|
-
{
|
385
|
+
{/*slide的情况下,arrow得放body外面,避免被overflow:hidden*/}
|
386
|
+
{!!state.option.arrowSize && !state.option.noArrow && state.option.animation !== ePopupAnimation.scale && (<div className="popup-item-arrow" ref={onRef.arrow}/>)}
|
387
|
+
<div
|
388
|
+
ref={onRef.body}
|
389
|
+
className="popup-item-body"
|
390
|
+
>
|
391
|
+
{/*scale的情况下,arrow得放body里边,一遍能够继承body的transform:scale*/}
|
392
|
+
{!!state.option.arrowSize && !state.option.noArrow && state.option.animation === ePopupAnimation.scale && (<div className="popup-item-arrow" ref={onRef.arrow}/>)}
|
393
|
+
<div
|
394
|
+
ref={onRef.content}
|
395
|
+
style={contentStyles.value}
|
396
|
+
className="popup-item-content"
|
397
|
+
onTransitionEnd={handler.onTransitionend}
|
398
|
+
>
|
399
|
+
{slots.default.isExist() ? slots.default() : state.option.render()}
|
400
|
+
</div>
|
401
|
+
</div>
|
388
402
|
</div>
|
389
|
-
|
390
|
-
|
391
|
-
|
403
|
+
);
|
404
|
+
return state.option.appendToBody ? (
|
405
|
+
<Portal to={`.${getComponentCls(APPLICATION_SERVICE_CONTAINER_CLASS)}`}>
|
406
|
+
{content}
|
407
|
+
</Portal>
|
408
|
+
) : content;
|
409
|
+
})()
|
410
|
+
)
|
392
411
|
);
|
393
412
|
},
|
394
413
|
});
|
@@ -97,7 +97,7 @@
|
|
97
97
|
|
98
98
|
&.popup-item-is-dark {
|
99
99
|
--#{componentName('popup-item-background')}: rgba(0, 0, 0, 0.88);
|
100
|
-
color:
|
100
|
+
color: plv(pbfc);
|
101
101
|
filter: none;
|
102
102
|
}
|
103
103
|
|
@@ -112,6 +112,10 @@
|
|
112
112
|
&.popup-item-no-border {
|
113
113
|
filter: none !important;
|
114
114
|
}
|
115
|
+
|
116
|
+
&.popup-item-no-interactive {
|
117
|
+
pointer-events: none;
|
118
|
+
}
|
115
119
|
/*---------------------------------------animation-------------------------------------------*/
|
116
120
|
|
117
121
|
&.popup-item-animation-fade {
|
@@ -62,7 +62,8 @@ export function usePopupManager({ getSize }: { getSize: () => typeof ThemeSize.T
|
|
62
62
|
trigger: ePopupTrigger.hover,
|
63
63
|
animation: ePopupAnimation.fade,
|
64
64
|
destroyOnClose: true,
|
65
|
-
|
65
|
+
appendToBody: true,
|
66
|
+
transformRefreshOnScroll: true,
|
66
67
|
offset: 0,
|
67
68
|
offsetAlign: 0,
|
68
69
|
autoSwitchDirection: true,
|
@@ -62,7 +62,8 @@ export interface iPopupDefaultOption {
|
|
62
62
|
trigger: iPopupTrigger, // 触发类型
|
63
63
|
animation: iPopupAnimation, // 动画类型
|
64
64
|
destroyOnClose: boolean, // 关闭的时候销毁popup
|
65
|
-
|
65
|
+
appendToBody: boolean, // 挂载到某个dom节点下
|
66
|
+
transformRefreshOnScroll: boolean, // scroll的时候refresh使用transform来优化
|
66
67
|
offset: number, // 在direction方向上的距离
|
67
68
|
offsetAlign: number, // 在align方向上的偏移距离
|
68
69
|
autoSwitchDirection: boolean, // 当空间不够时,是否自动切换direction
|
@@ -46,6 +46,8 @@ export function createTooltip(option: iTooltipServiceOption, popup: iPopupServic
|
|
46
46
|
if (option.overflow) {
|
47
47
|
if (staticState.reference!.scrollWidth > staticState.reference!.offsetWidth) {
|
48
48
|
state.isOverflow = true;
|
49
|
+
} else {
|
50
|
+
state.isOverflow = false;
|
49
51
|
}
|
50
52
|
}
|
51
53
|
},
|
package/src/packages/entry.tsx
CHANGED
@@ -54,6 +54,7 @@ export {TabGroup} from './components/TabGroup';
|
|
54
54
|
export {Tab} from './components/Tab';
|
55
55
|
export {Tag} from './components/Tag';
|
56
56
|
export {Tree} from './components/Tree';
|
57
|
+
export {TreeNodeWithMenu} from './components/TreeNodeWithMenu';
|
57
58
|
export {ColorPicker} from './components/ColorPicker';
|
58
59
|
export {TimePicker} from './components/TimePicker';
|
59
60
|
export {DatePicker} from './components/DatePicker';
|
@@ -85,9 +86,28 @@ export {CascadePanel} from './components/CascadePanel';
|
|
85
86
|
export {usePopup} from './components/usePopup';
|
86
87
|
export {Popup} from './components/Popup';
|
87
88
|
export {createPopup} from './components/createPopup';
|
89
|
+
export type {
|
90
|
+
iPopupAlign,
|
91
|
+
iPopupAnimation,
|
92
|
+
iPopupBoundary,
|
93
|
+
iPopupCustomOption,
|
94
|
+
iPopupDefaultOption,
|
95
|
+
iPopupDirection,
|
96
|
+
iPopupManager,
|
97
|
+
iPopupOption,
|
98
|
+
iPopupPlacement,
|
99
|
+
iPopupRects,
|
100
|
+
iPopupRefreshBuildParams,
|
101
|
+
iPopupRefreshParams,
|
102
|
+
iPopupRefs,
|
103
|
+
iPopupTrigger,
|
104
|
+
iPopupUseOption,
|
105
|
+
} from './components/usePopup/utils/popup.utils';
|
88
106
|
export {createScrollUtils} from './components/createScrollUtils';
|
89
107
|
export {useAutoScrollUtils} from './components/useAutoScrollUtils';
|
90
108
|
export {ClientZoom} from './components/ClientZoom';
|
109
|
+
export {Layout} from './components/Layout';
|
110
|
+
export {LayoutSection} from './components/LayoutSection';
|
91
111
|
|
92
112
|
export {VirtualTable} from './components/VirtualTable';
|
93
113
|
export {Table} from './components/Table';
|
@@ -127,12 +147,18 @@ export type {iOvMeta} from './components/$ov/ov.utils';
|
|
127
147
|
export {$configuration} from './components/$configuration';
|
128
148
|
export {createAddressService} from './components/createAddressService';
|
129
149
|
export {createHttp} from './components/createHttp';
|
150
|
+
export type {
|
151
|
+
iHttpRequestConfig,
|
152
|
+
iPlainResponseDataType,
|
153
|
+
iHttpResponseDataType
|
154
|
+
} from './components/createHttp/http.utils';
|
130
155
|
|
131
156
|
export {Address} from './components/Address';
|
132
157
|
export {AddressCascade} from './components/AddressCascade';
|
133
158
|
export {eAddressTypeEnum} from './components/$address/address.utils';
|
134
159
|
export type {iAddressSyncMeta, iAddressLazyMeta} from './components/$address/address.utils';
|
135
160
|
export type {iPlainAddressData} from './components/createPlainAddressService';
|
161
|
+
export {Empty} from './components/Empty';
|
136
162
|
|
137
163
|
export {FormInput} from './components/FormInput';
|
138
164
|
export {FormSelect} from './components/FormSelect';
|
@@ -162,5 +188,18 @@ export type {
|
|
162
188
|
iTableOptionCacheRegistryConfig,
|
163
189
|
iTableOptionGetCacheParam
|
164
190
|
} from './components/AutoTable/use/useTableOption.cache.utils';
|
191
|
+
export {PageThemeUtils} from './components/PageThemeUtils';
|
192
|
+
export {ThemePrimaryColors} from './components/ThemePrimaryColors';
|
193
|
+
export {ThemeEditor} from './components/ThemeEditor';
|
194
|
+
export {useReferenceTrigger} from './components/useReferenceTrigger';
|
195
|
+
export {usePopupTrigger} from './components/usePopupTrigger';
|
196
|
+
export {useWatchAutoClear} from './components/useWatchAutoClear';
|
197
|
+
export {nextPopupId} from './components/nextPopupId';
|
198
|
+
export {createProvider} from './components/createProvider';
|
199
|
+
export {usePopupManager} from './components/usePopupManager';
|
200
|
+
export {useEdit, EditProps, EDIT_PROVIDER} from './uses/useEdit';
|
201
|
+
export type {tEditComputed, tEditControl, EditProvideData} from './uses/useEdit';
|
202
|
+
export {useStyle, StyleProps, ThemeShape, ThemeSize, ThemeStatus} from './uses/useStyle';
|
203
|
+
export type {tStyleComputed, UseStyleProvideData} from './uses/useStyle';
|
165
204
|
|
166
205
|
setComponentPrefix(globalComponentPrefix);
|
@@ -14,7 +14,7 @@ export const EditProps = {
|
|
14
14
|
multiple: { type: Boolean }, // 是否多选
|
15
15
|
} as const;
|
16
16
|
|
17
|
-
interface EditProvideData {
|
17
|
+
export interface EditProvideData {
|
18
18
|
disabled: boolean | null,
|
19
19
|
readonly: boolean | null,
|
20
20
|
loading: boolean | null,
|
@@ -74,6 +74,10 @@ export const useEdit = useFunctionWrapper(
|
|
74
74
|
}
|
75
75
|
}
|
76
76
|
|
77
|
+
onBeforeUnmount(() => {
|
78
|
+
editComputed.effect.stop();
|
79
|
+
});
|
80
|
+
|
77
81
|
return {
|
78
82
|
editState,
|
79
83
|
editComputed,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {computed, inject, PropType, provide} from "plain-design-composition";
|
1
|
+
import {computed, inject, onBeforeUnmount, PropType, provide} from "plain-design-composition";
|
2
2
|
import {useFunctionWrapper} from "./useFunctionWrapper";
|
3
3
|
import {createEnum} from "plain-utils/utils/createEnum";
|
4
4
|
import {ApplicationConfigurationProvider} from "../components/Application/utils/application.utils";
|
@@ -19,7 +19,7 @@ export const StyleProps = {
|
|
19
19
|
status: { type: String as PropType<typeof ThemeStatus.TYPE> }, // 'secondary', 'primary', 'success', 'warn', 'error'
|
20
20
|
} as const;
|
21
21
|
|
22
|
-
interface UseStyleProvideData {
|
22
|
+
export interface UseStyleProvideData {
|
23
23
|
shape: typeof ThemeShape.TYPE,
|
24
24
|
size: typeof ThemeSize.TYPE,
|
25
25
|
status?: typeof ThemeStatus.TYPE,
|
@@ -62,6 +62,14 @@ export const useStyle = useFunctionWrapper('style', (ctx, option: UseStyleOption
|
|
62
62
|
|
63
63
|
provide(USE_STYLE_PROVIDER, styleComputed);
|
64
64
|
|
65
|
+
onBeforeUnmount(() => {
|
66
|
+
setTimeout(() => {
|
67
|
+
(styleComputed.value as any).ctx = null;
|
68
|
+
(styleComputed.value as any).parent = null;
|
69
|
+
styleComputed.effect.stop();
|
70
|
+
});
|
71
|
+
});
|
72
|
+
|
65
73
|
return { styleComputed };
|
66
74
|
});
|
67
75
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
import {iMouseEvent} from 'plain-design-composition';
|
2
|
+
|
1
3
|
export const ClientZoom = (() => {
|
2
4
|
let zoom: '' | number = '';
|
3
5
|
return {
|
4
|
-
get: () => {
|
5
|
-
return zoom;
|
6
|
+
get: (): number => {
|
7
|
+
return zoom === '' ? 1 : zoom;
|
6
8
|
},
|
7
9
|
set: (_zoom: number | null) => {
|
8
10
|
const __zoom = _zoom == null ? '' : _zoom;
|
@@ -24,5 +26,25 @@ export const ClientZoom = (() => {
|
|
24
26
|
};
|
25
27
|
}
|
26
28
|
},
|
29
|
+
getClientPosition: (e: iMouseEvent | MouseEvent): { clientX: number, clientY: number, offsetX: number, offsetY: number, } => {
|
30
|
+
const { clientX, clientY, offsetX, offsetY } = 'nativeEvent' in e ? e.nativeEvent : e;
|
31
|
+
return {
|
32
|
+
clientX: ClientZoom.formatClientValue(clientX),
|
33
|
+
clientY: ClientZoom.formatClientValue(clientY),
|
34
|
+
offsetX: ClientZoom.formatClientValue(offsetX),
|
35
|
+
offsetY: ClientZoom.formatClientValue(offsetY),
|
36
|
+
};
|
37
|
+
},
|
38
|
+
formatClientValue: (val: number) => {
|
39
|
+
return ClientZoom.zoomPosition(val);
|
40
|
+
},
|
41
|
+
zoomPosition(val: number) {
|
42
|
+
const zoom = ClientZoom.get();
|
43
|
+
return Number((val / zoom).toFixed(2));
|
44
|
+
},
|
45
|
+
zoomSize(val: number) {
|
46
|
+
const zoom = ClientZoom.get();
|
47
|
+
return Number((val * zoom).toFixed(2));
|
48
|
+
},
|
27
49
|
};
|
28
50
|
})();
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import {createEffects} from "plain-utils/utils/createEffects";
|
2
2
|
import {watch} from "plain-design-composition";
|
3
3
|
import {removeUnit} from "plain-utils/string/removeUnit";
|
4
|
+
import {ClientZoom} from "../components/ClientZoom";
|
4
5
|
|
5
6
|
export function useMove(
|
6
7
|
{
|
@@ -26,6 +27,8 @@ export function useMove(
|
|
26
27
|
|
27
28
|
const onMousedown = (e: MouseEvent) => {
|
28
29
|
|
30
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
31
|
+
|
29
32
|
const { effects: draggierEffects } = createEffects();
|
30
33
|
|
31
34
|
const el = e.currentTarget as HTMLElement;
|
@@ -35,16 +38,19 @@ export function useMove(
|
|
35
38
|
const dragState = {
|
36
39
|
isDragging: false,
|
37
40
|
start: {
|
38
|
-
x:
|
39
|
-
y:
|
41
|
+
x: clientX,
|
42
|
+
y: clientY,
|
40
43
|
left: Number(removeUnit(style.left) || 0),
|
41
44
|
top: Number(removeUnit(style.top) || 0),
|
42
45
|
}
|
43
46
|
};
|
44
47
|
|
45
48
|
const onMousemove = (e: MouseEvent) => {
|
46
|
-
|
47
|
-
const
|
49
|
+
|
50
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
51
|
+
|
52
|
+
const durX = clientX - dragState.start.x;
|
53
|
+
const durY = clientY - dragState.start.y;
|
48
54
|
|
49
55
|
if (!dragState.isDragging) {
|
50
56
|
if (durX >= 5 || durY >= 5) {
|
package/src/pages/index/App.tsx
CHANGED
@@ -2,8 +2,9 @@ import {designPage} from 'plain-design-composition';
|
|
2
2
|
import './app.scss';
|
3
3
|
import {AppHome} from "./home/AppHome";
|
4
4
|
import {DemoRowController} from "./Demo/DemoRowController";
|
5
|
-
import {Application} from "../../packages";
|
6
|
-
|
5
|
+
import {Application, ClientZoom, PageThemeUtils} from "../../packages";
|
6
|
+
|
7
|
+
PageThemeUtils.state.zoom != null && ClientZoom.set(PageThemeUtils.state.zoom);
|
7
8
|
|
8
9
|
export const App = designPage(() => {
|
9
10
|
return () => (
|
@@ -93,8 +93,8 @@
|
|
93
93
|
|
94
94
|
.demo-row-collector-operator {
|
95
95
|
position: fixed;
|
96
|
-
bottom:
|
97
|
-
right:
|
96
|
+
bottom: 8px;
|
97
|
+
right: 0;
|
98
98
|
display: flex;
|
99
99
|
align-items: center;
|
100
100
|
|
@@ -105,16 +105,19 @@
|
|
105
105
|
font-size: 12px;
|
106
106
|
cursor: pointer;
|
107
107
|
color: plv(text-2);
|
108
|
+
display: flex;
|
109
|
+
align-items: center;
|
108
110
|
|
109
111
|
&:first-child {
|
110
112
|
border-right: none;
|
111
|
-
border-bottom-left-radius:
|
112
|
-
border-top-left-radius:
|
113
|
+
border-bottom-left-radius: plv(box-size-normal-border-radius);
|
114
|
+
border-top-left-radius: plv(box-size-normal-border-radius);
|
113
115
|
}
|
114
116
|
|
115
117
|
&:last-child {
|
116
|
-
border-bottom-right-radius:
|
117
|
-
border-top-right-radius:
|
118
|
+
border-bottom-right-radius: 0;
|
119
|
+
border-top-right-radius: 0;
|
120
|
+
border-right: none;
|
118
121
|
}
|
119
122
|
|
120
123
|
& > span {
|
@@ -26,11 +26,11 @@ export const DemoRowController = designComponent({
|
|
26
26
|
<div className="demo-row-collector-operator">
|
27
27
|
<div onClick={() => methods.changeAll(false)}>
|
28
28
|
<span>全部收起</span>
|
29
|
-
<Icon icon="pi-
|
29
|
+
<Icon icon="pi-fullscreen-exit"/>
|
30
30
|
</div>
|
31
31
|
<div onClick={() => methods.changeAll(true)}>
|
32
32
|
<span>全部展开</span>
|
33
|
-
<Icon icon="pi-
|
33
|
+
<Icon icon="pi-fullscreen"/>
|
34
34
|
</div>
|
35
35
|
</div>
|
36
36
|
</>
|