import { GlobalOptions } from '../types';

// Modal 全局配置，可被覆盖
export const globalOptions: Required<GlobalOptions> = {
  drawerStyle: 'custom',
  antDrawer: {
    keyboard: true,
    mask: true,
    maskClosable: true,
    width: '50%',
    placement: 'right'
  }
};

// 📝 这里没有用 lodash 的 merge 写起来比较不优雅
export const setGlobalOptions = (options: GlobalOptions) => {
  const tmp = Object.assign(globalOptions.antDrawer, options.antDrawer);
  Object.assign(globalOptions, options);
  globalOptions.antDrawer = tmp;
};
