perf: add truthProp util (#8522)

* perf: add TruthyProp util

* chore: rename

* chore: upd
This commit is contained in:
neverland
2021-04-14 10:26:21 +08:00
committed by GitHub
parent 9381640d2e
commit bd609e1df0
59 changed files with 226 additions and 460 deletions
+9 -21
View File
@@ -1,41 +1,29 @@
import { PropType, CSSProperties, TeleportProps } from 'vue';
import { UnknownProp } from '../utils';
import { truthProp, unknownProp } from '../utils';
export const popupSharedProps = {
// whether to show popup
show: Boolean,
// z-index
zIndex: [Number, String],
// whether to show overlay
overlay: truthProp,
// transition duration
duration: [Number, String],
// teleport
teleport: [String, Object] as PropType<TeleportProps['to']>,
// prevent body scroll
lockScroll: truthProp,
// whether to lazy render
lazyRender: truthProp,
// overlay custom style
overlayStyle: Object as PropType<CSSProperties>,
// overlay custom class name
overlayClass: UnknownProp,
overlayClass: unknownProp,
// Initial rendering animation
transitionAppear: Boolean,
// whether to show overlay
overlay: {
type: Boolean,
default: true,
},
// prevent body scroll
lockScroll: {
type: Boolean,
default: true,
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true,
},
// whether to close popup when overlay is clicked
closeOnClickOverlay: {
type: Boolean,
default: true,
},
closeOnClickOverlay: truthProp,
};
export type PopupSharedPropKeys = Array<keyof typeof popupSharedProps>;