mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 13:37:52 +08:00
2341a25d91
* more refactor * chore: motion support * chore: tmp test * test: Hooks * chore: static function * tmp of it * all of it * mv prefix * chore: clean up * chore: clean up * more test case * test: all base test * test: all test case * init * refactor: rm notification.open instance related code * follow up * refactor: singlton * test: notification test case * refactor to destroy * refactor: message base * test: part test case * test: more * test: more * test: all test * chore: clean up * docs: reorder * chore: fix lint * test: fix test case * chore: add act * chore: back * chore: fix style * test: notification test * test: more and more * test: fix more test * test: index * test: more & more * test: fix placement * test: fix coverage * chore: clean up * chore: bundle size * fix: 17 * chore: more * test: message * test: more test * fix: lint * test: rm class in static * chore: clean up * test: coverage * chore: fix lint
29 lines
713 B
TypeScript
29 lines
713 B
TypeScript
import type { CSSMotionProps } from 'rc-motion';
|
|
|
|
export function getMotion(prefixCls: string, transitionName?: string): CSSMotionProps {
|
|
return {
|
|
motionName: transitionName ?? `${prefixCls}-move-up`,
|
|
};
|
|
}
|
|
|
|
/** Wrap message open with promise like function */
|
|
export function wrapPromiseFn(openFn: (resolve: VoidFunction) => VoidFunction) {
|
|
let closeFn: VoidFunction;
|
|
|
|
const closePromise = new Promise<boolean>(resolve => {
|
|
closeFn = openFn(() => {
|
|
resolve(true);
|
|
});
|
|
});
|
|
|
|
const result: any = () => {
|
|
closeFn?.();
|
|
};
|
|
|
|
result.then = (filled: VoidFunction, rejected: VoidFunction) =>
|
|
closePromise.then(filled, rejected);
|
|
result.promise = closePromise;
|
|
|
|
return result;
|
|
}
|