plain-design 1.0.0-beta.93 → 1.0.0-beta.94
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 +4 -3
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/Button/button.scss +1 -1
- package/src/packages/components/ConfirmPopup/confirm-popup.scss +16 -0
- package/src/packages/components/ConfirmPopup/index.tsx +72 -0
- package/src/packages/components/usePopup/popup-item.scss +1 -1
- package/src/packages/entry.tsx +1 -0
package/package.json
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
@include comp(confirm-popup) {
|
2
|
+
.popup-content {
|
3
|
+
.popper-head {
|
4
|
+
color: plv(text-1);
|
5
|
+
text-align: center;
|
6
|
+
padding: 1em 1.25em 0;
|
7
|
+
}
|
8
|
+
|
9
|
+
.confirm-popup-button-bar {
|
10
|
+
display: flex;
|
11
|
+
align-items: center;
|
12
|
+
justify-content: flex-end;
|
13
|
+
padding: 1em 1.25em;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import {designComponent, getComponentCls, PropType, useModel} from "plain-design-composition";
|
2
|
+
import Popup from "../Popup";
|
3
|
+
import Space from "../Space";
|
4
|
+
import Button from "../Button";
|
5
|
+
import i18n from "../i18n";
|
6
|
+
import './confirm-popup.scss';
|
7
|
+
import {ePopupTrigger, iPopupTrigger} from "../usePopup/utils/popup.utils";
|
8
|
+
|
9
|
+
export const ConfirmPopup = designComponent({
|
10
|
+
name: 'confirm-popup',
|
11
|
+
inheritPropsType: Popup,
|
12
|
+
props: {
|
13
|
+
title: { type: String },
|
14
|
+
trigger: { type: String as PropType<iPopupTrigger>, default: ePopupTrigger.click },
|
15
|
+
confirmLabel: { type: String },
|
16
|
+
cancelLabel: { type: String },
|
17
|
+
modelValue: { type: Boolean },
|
18
|
+
},
|
19
|
+
emits: {
|
20
|
+
onConfirm: () => true,
|
21
|
+
onCancel: () => true,
|
22
|
+
onUpdateModelValue: (val: boolean) => true,
|
23
|
+
},
|
24
|
+
slots: ['default'],
|
25
|
+
setup({ props, slots, attrs, event: { emit } }) {
|
26
|
+
|
27
|
+
const model = useModel(() => props.modelValue, emit.onUpdateModelValue);
|
28
|
+
|
29
|
+
const handler = {
|
30
|
+
onConfirm: () => {
|
31
|
+
model.value = false;
|
32
|
+
emit.onConfirm();
|
33
|
+
},
|
34
|
+
onCancel: () => {
|
35
|
+
model.value = false;
|
36
|
+
emit.onCancel();
|
37
|
+
},
|
38
|
+
};
|
39
|
+
|
40
|
+
return () => {
|
41
|
+
const hasTitle = !!props.title;
|
42
|
+
return (
|
43
|
+
<Popup
|
44
|
+
title={props.title}
|
45
|
+
placement={attrs.placement || (hasTitle ? 'bottom-end' : 'bottom-center')}
|
46
|
+
popperClass={getComponentCls('confirm-popup')}
|
47
|
+
v-model={model.value}
|
48
|
+
trigger={props.trigger}
|
49
|
+
noPadding
|
50
|
+
v-slots={{
|
51
|
+
default: () => slots.default(),
|
52
|
+
popper: () => (
|
53
|
+
hasTitle ? (
|
54
|
+
<Space className="confirm-popup-button-bar" size="mini">
|
55
|
+
<Button mode="fill" status="primary" label={props.confirmLabel || i18n.$it('base.confirm').d('确定')} onClick={handler.onConfirm}/>
|
56
|
+
<Button mode="stroke" status="secondary" label={props.cancelLabel || i18n.$it('base.cancel').d('取消')} onClick={handler.onCancel}/>
|
57
|
+
</Space>
|
58
|
+
) : (
|
59
|
+
<Space className="confirm-popup-button-bar">
|
60
|
+
<Button mode="text" status="primary" icon="pi-check" label={props.confirmLabel || i18n.$it('base.confirm').d('确定')} onClick={handler.onConfirm}/>
|
61
|
+
<Button mode="text" status="error" icon="pi-close" label={props.cancelLabel || i18n.$it('base.cancel').d('取消')} onClick={handler.onCancel}/>
|
62
|
+
</Space>
|
63
|
+
)
|
64
|
+
)
|
65
|
+
}}
|
66
|
+
/>
|
67
|
+
);
|
68
|
+
};
|
69
|
+
},
|
70
|
+
});
|
71
|
+
|
72
|
+
export default ConfirmPopup;
|
package/src/packages/entry.tsx
CHANGED
@@ -89,6 +89,7 @@ export type {FileServiceChooseFileConfig, FileServiceSingleFile, FileServiceUplo
|
|
89
89
|
export {CascadePanel} from './components/CascadePanel';
|
90
90
|
export {usePopup} from './components/usePopup';
|
91
91
|
export {Popup} from './components/Popup';
|
92
|
+
export {ConfirmPopup} from './components/ConfirmPopup';
|
92
93
|
export {createPopup} from './components/createPopup';
|
93
94
|
export type {
|
94
95
|
iPopupAlign,
|