This repository has been archived by the owner on Nov 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.js
91 lines (79 loc) · 2.99 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SweetAlertService = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _sweetalert = require('sweetalert2');
var _sweetalert2 = _interopRequireDefault(_sweetalert);
require('sweetalert2/dist/sweetalert2.min.css');
var _lodash = require('lodash.assign');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SweetAlertService = exports.SweetAlertService = function () {
function SweetAlertService() {
_classCallCheck(this, SweetAlertService);
}
_createClass(SweetAlertService, [{
key: 'swal',
value: function swal() {
return _sweetalert2.default.apply(undefined, arguments);
}
}, {
key: 'prompt',
value: function prompt(options) {
var baseOptions = {
showCancelButton: true,
confirmButtonText: 'Submit',
input: 'text'
};
return (0, _sweetalert2.default)((0, _lodash2.default)(baseOptions, options));
}
}, {
key: 'confirm',
value: function confirm(options) {
var baseOptions = {
showCancelButton: true,
confirmButtonText: 'Confirm',
type: 'warning'
};
return (0, _sweetalert2.default)((0, _lodash2.default)(baseOptions, options));
}
}, {
key: 'alert',
value: function alert(options) {
var baseOptions = {
confirmButtonText: 'OK',
type: 'info'
};
return (0, _sweetalert2.default)((0, _lodash2.default)(baseOptions, options));
}
}, {
key: 'question',
value: function question(options) {
return this.alert((0, _lodash2.default)({ type: 'question' }, options));
}
}, {
key: 'success',
value: function success(options) {
return this.alert((0, _lodash2.default)({ type: 'success' }, options));
}
}, {
key: 'error',
value: function error(options) {
return this.alert((0, _lodash2.default)({ type: 'error' }, options));
}
}, {
key: 'warn',
value: function warn(options) {
return this.alert((0, _lodash2.default)({ type: 'warn' }, options));
}
}, {
key: 'info',
value: function info(options) {
return this.alert((0, _lodash2.default)({ type: 'info' }, options));
}
}]);
return SweetAlertService;
}();