2018-05-27 09:12:39 +00:00
|
|
|
import OS from '../../mios';
|
2018-02-18 03:35:18 +00:00
|
|
|
import InputDialog from '../views/components/input-dialog.vue';
|
|
|
|
|
2018-05-27 09:12:39 +00:00
|
|
|
export default (os: OS) => opts => {
|
2018-02-18 03:35:18 +00:00
|
|
|
return new Promise<string>((res, rej) => {
|
|
|
|
const o = opts || {};
|
2018-05-27 09:12:39 +00:00
|
|
|
const d = os.new(InputDialog, {
|
|
|
|
title: o.title,
|
|
|
|
placeholder: o.placeholder,
|
|
|
|
default: o.default,
|
|
|
|
type: o.type || 'text',
|
|
|
|
allowEmpty: o.allowEmpty
|
|
|
|
});
|
2018-02-18 03:35:18 +00:00
|
|
|
d.$once('done', text => {
|
|
|
|
res(text);
|
|
|
|
});
|
|
|
|
document.body.appendChild(d.$el);
|
|
|
|
});
|
2018-05-27 09:12:39 +00:00
|
|
|
};
|