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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.93",
3
+ "version": "1.0.0-beta.94",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -172,7 +172,7 @@
172
172
  .#{componentName(icon)}, .#{componentName(loading)} {
173
173
  //vertical-align: text-top;
174
174
  position: relative;
175
- top: 1px;
175
+ top: 0.15em;
176
176
  }
177
177
 
178
178
  //&:not(.button-icon-only) {
@@ -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;
@@ -105,7 +105,7 @@
105
105
  }
106
106
 
107
107
  &.popup-item-dark-app {
108
- filter: drop-shadow(0 0 0.5px plv(secondary-6));
108
+ filter: drop-shadow(0 0 16px var(--custom-bg-1));
109
109
  }
110
110
 
111
111
  &.popup-item-no-background {
@@ -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,