press-plus
Version:
58 lines (44 loc) • 1.38 kB
text/typescript
import { showFunctionalComponent } from 'press-ui/common/functional-component/index';
export const FUNCTIONAL_ID_MAP = {
POPUP_CELL: 'press-popup-cell-functional',
POPUP_CELL_2: 'press-popup-cell-functional-2',
PICKER: 'press-picker-functional',
DATE_TIME_PICKER: 'press-datetime-picker-popup-functional',
};
export function showPopupCellAndClose(options?: any) {
showFunctionalComponent({
selector: `#${FUNCTIONAL_ID_MAP.POPUP_CELL}`,
...options,
}).then((resp: any) => {
const { context: popupContext = {} } = resp || {};
popupContext.closeDialog();
})
.catch((err) => {
const { context: popupContext = {} } = err || {};
popupContext.closeDialog();
});
}
export function showPopupCell(options?: any): Promise<any> {
return showFunctionalComponent({
selector: `#${FUNCTIONAL_ID_MAP.POPUP_CELL}`,
...options,
});
}
export function showPopupCell2(options?: any): Promise<any> {
return showFunctionalComponent({
selector: `#${FUNCTIONAL_ID_MAP.POPUP_CELL_2}`,
...options,
});
}
export function showPicker(options?: any) {
return showFunctionalComponent({
selector: `#${FUNCTIONAL_ID_MAP.PICKER}`,
...options,
});
}
export function showDateTimePicker(options?: any) {
return showFunctionalComponent({
selector: `#${FUNCTIONAL_ID_MAP.DATE_TIME_PICKER}`,
...options,
});
}