my_assets 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/lib/my_assets/version.rb +3 -0
- data/lib/my_assets.rb +7 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/bootstrap/alert.js +203 -0
- data/vendor/assets/javascripts/bootstrap/button.js +191 -0
- data/vendor/assets/javascripts/bootstrap/carousel.js +566 -0
- data/vendor/assets/javascripts/bootstrap/collapse.js +430 -0
- data/vendor/assets/javascripts/bootstrap/dropdown.js +551 -0
- data/vendor/assets/javascripts/bootstrap/modal.js +633 -0
- data/vendor/assets/javascripts/bootstrap/popover.js +265 -0
- data/vendor/assets/javascripts/bootstrap/scrollspy.js +378 -0
- data/vendor/assets/javascripts/bootstrap/tab.js +277 -0
- data/vendor/assets/javascripts/bootstrap/tooltip.js +733 -0
- data/vendor/assets/javascripts/bootstrap/util.js +143 -0
- data/vendor/assets/javascripts/bootstrap.js +6 -0
- data/vendor/assets/javascripts/data-confirm-modal.js +351 -0
- data/vendor/assets/javascripts/datatables.js +360 -0
- data/vendor/assets/javascripts/jquery.js +4 -0
- data/vendor/assets/javascripts/notify.js +625 -0
- data/vendor/assets/javascripts/popper.js +5 -0
- data/vendor/assets/javascripts/select2.js +1 -0
- data/vendor/assets/stylesheets/bootstrap/_alert.scss +51 -0
- data/vendor/assets/stylesheets/bootstrap/_badge.scss +47 -0
- data/vendor/assets/stylesheets/bootstrap/_breadcrumb.scss +41 -0
- data/vendor/assets/stylesheets/bootstrap/_button-group.scss +172 -0
- data/vendor/assets/stylesheets/bootstrap/_buttons.scss +143 -0
- data/vendor/assets/stylesheets/bootstrap/_card.scss +301 -0
- data/vendor/assets/stylesheets/bootstrap/_carousel.scss +236 -0
- data/vendor/assets/stylesheets/bootstrap/_close.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_code.scss +48 -0
- data/vendor/assets/stylesheets/bootstrap/_custom-forms.scss +433 -0
- data/vendor/assets/stylesheets/bootstrap/_dropdown.scss +166 -0
- data/vendor/assets/stylesheets/bootstrap/_forms.scss +333 -0
- data/vendor/assets/stylesheets/bootstrap/_functions.scss +86 -0
- data/vendor/assets/stylesheets/bootstrap/_grid.scss +52 -0
- data/vendor/assets/stylesheets/bootstrap/_images.scss +42 -0
- data/vendor/assets/stylesheets/bootstrap/_input-group.scss +173 -0
- data/vendor/assets/stylesheets/bootstrap/_jumbotron.scss +16 -0
- data/vendor/assets/stylesheets/bootstrap/_list-group.scss +115 -0
- data/vendor/assets/stylesheets/bootstrap/_media.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/_mixins.scss +41 -0
- data/vendor/assets/stylesheets/bootstrap/_modal.scss +180 -0
- data/vendor/assets/stylesheets/bootstrap/_nav.scss +118 -0
- data/vendor/assets/stylesheets/bootstrap/_navbar.scss +299 -0
- data/vendor/assets/stylesheets/bootstrap/_pagination.scss +78 -0
- data/vendor/assets/stylesheets/bootstrap/_popover.scss +183 -0
- data/vendor/assets/stylesheets/bootstrap/_print.scss +141 -0
- data/vendor/assets/stylesheets/bootstrap/_progress.scss +34 -0
- data/vendor/assets/stylesheets/bootstrap/_reboot.scss +483 -0
- data/vendor/assets/stylesheets/bootstrap/_root.scss +19 -0
- data/vendor/assets/stylesheets/bootstrap/_tables.scss +187 -0
- data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +115 -0
- data/vendor/assets/stylesheets/bootstrap/_transitions.scss +22 -0
- data/vendor/assets/stylesheets/bootstrap/_type.scss +125 -0
- data/vendor/assets/stylesheets/bootstrap/_utilities.scss +15 -0
- data/vendor/assets/stylesheets/bootstrap/_variables.scss +952 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_alert.scss +13 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_background-variant.scss +21 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_badge.scss +12 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_border-radius.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +5 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +123 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_buttons.scss +109 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_caret.scss +66 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_clearfix.scss +7 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_float.scss +11 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_forms.scss +147 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_gradients.scss +45 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +67 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_grid.scss +52 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_hover.scss +37 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_image.scss +36 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_list-group.scss +21 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_pagination.scss +22 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_reset-text.scss +17 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +33 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_size.scss +6 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_table-row.scss +30 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +14 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_text-hide.scss +13 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_transition.scss +13 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_visibility.scss +7 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_align.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_background.scss +19 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_borders.scss +59 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_clearfix.scss +3 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_display.scss +38 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_embed.scss +52 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_flex.scss +51 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_float.scss +9 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_position.scss +37 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +11 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_shadows.scss +6 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_sizing.scss +12 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_spacing.scss +51 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_text.scss +58 -0
- data/vendor/assets/stylesheets/bootstrap/utilities/_visibility.scss +11 -0
- data/vendor/assets/stylesheets/bootstrap.scss +42 -0
- data/vendor/assets/stylesheets/datatables.css +1004 -0
- data/vendor/assets/stylesheets/font-awesome.css.erb +2342 -0
- data/vendor/assets/stylesheets/select2.css +484 -0
- metadata +186 -0
@@ -0,0 +1,633 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
4
|
+
(global.Modal = factory(global.jQuery,global.Util));
|
5
|
+
}(this, (function ($,Util) { 'use strict';
|
6
|
+
|
7
|
+
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
8
|
+
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
9
|
+
|
10
|
+
function _defineProperties(target, props) {
|
11
|
+
for (var i = 0; i < props.length; i++) {
|
12
|
+
var descriptor = props[i];
|
13
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
14
|
+
descriptor.configurable = true;
|
15
|
+
if ("value" in descriptor) descriptor.writable = true;
|
16
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
21
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
22
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
23
|
+
return Constructor;
|
24
|
+
}
|
25
|
+
|
26
|
+
function _defineProperty(obj, key, value) {
|
27
|
+
if (key in obj) {
|
28
|
+
Object.defineProperty(obj, key, {
|
29
|
+
value: value,
|
30
|
+
enumerable: true,
|
31
|
+
configurable: true,
|
32
|
+
writable: true
|
33
|
+
});
|
34
|
+
} else {
|
35
|
+
obj[key] = value;
|
36
|
+
}
|
37
|
+
|
38
|
+
return obj;
|
39
|
+
}
|
40
|
+
|
41
|
+
function _objectSpread(target) {
|
42
|
+
for (var i = 1; i < arguments.length; i++) {
|
43
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
44
|
+
var ownKeys = Object.keys(source);
|
45
|
+
|
46
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
47
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
48
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
49
|
+
}));
|
50
|
+
}
|
51
|
+
|
52
|
+
ownKeys.forEach(function (key) {
|
53
|
+
_defineProperty(target, key, source[key]);
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
return target;
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* --------------------------------------------------------------------------
|
62
|
+
* Bootstrap (v4.1.3): modal.js
|
63
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
64
|
+
* --------------------------------------------------------------------------
|
65
|
+
*/
|
66
|
+
|
67
|
+
var Modal = function ($$$1) {
|
68
|
+
/**
|
69
|
+
* ------------------------------------------------------------------------
|
70
|
+
* Constants
|
71
|
+
* ------------------------------------------------------------------------
|
72
|
+
*/
|
73
|
+
var NAME = 'modal';
|
74
|
+
var VERSION = '4.1.3';
|
75
|
+
var DATA_KEY = 'bs.modal';
|
76
|
+
var EVENT_KEY = "." + DATA_KEY;
|
77
|
+
var DATA_API_KEY = '.data-api';
|
78
|
+
var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
|
79
|
+
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
80
|
+
|
81
|
+
var Default = {
|
82
|
+
backdrop: true,
|
83
|
+
keyboard: true,
|
84
|
+
focus: true,
|
85
|
+
show: true
|
86
|
+
};
|
87
|
+
var DefaultType = {
|
88
|
+
backdrop: '(boolean|string)',
|
89
|
+
keyboard: 'boolean',
|
90
|
+
focus: 'boolean',
|
91
|
+
show: 'boolean'
|
92
|
+
};
|
93
|
+
var Event = {
|
94
|
+
HIDE: "hide" + EVENT_KEY,
|
95
|
+
HIDDEN: "hidden" + EVENT_KEY,
|
96
|
+
SHOW: "show" + EVENT_KEY,
|
97
|
+
SHOWN: "shown" + EVENT_KEY,
|
98
|
+
FOCUSIN: "focusin" + EVENT_KEY,
|
99
|
+
RESIZE: "resize" + EVENT_KEY,
|
100
|
+
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
|
101
|
+
KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY,
|
102
|
+
MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY,
|
103
|
+
MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY,
|
104
|
+
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
105
|
+
};
|
106
|
+
var ClassName = {
|
107
|
+
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
|
108
|
+
BACKDROP: 'modal-backdrop',
|
109
|
+
OPEN: 'modal-open',
|
110
|
+
FADE: 'fade',
|
111
|
+
SHOW: 'show'
|
112
|
+
};
|
113
|
+
var Selector = {
|
114
|
+
DIALOG: '.modal-dialog',
|
115
|
+
DATA_TOGGLE: '[data-toggle="modal"]',
|
116
|
+
DATA_DISMISS: '[data-dismiss="modal"]',
|
117
|
+
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
|
118
|
+
STICKY_CONTENT: '.sticky-top'
|
119
|
+
/**
|
120
|
+
* ------------------------------------------------------------------------
|
121
|
+
* Class Definition
|
122
|
+
* ------------------------------------------------------------------------
|
123
|
+
*/
|
124
|
+
|
125
|
+
};
|
126
|
+
|
127
|
+
var Modal =
|
128
|
+
/*#__PURE__*/
|
129
|
+
function () {
|
130
|
+
function Modal(element, config) {
|
131
|
+
this._config = this._getConfig(config);
|
132
|
+
this._element = element;
|
133
|
+
this._dialog = element.querySelector(Selector.DIALOG);
|
134
|
+
this._backdrop = null;
|
135
|
+
this._isShown = false;
|
136
|
+
this._isBodyOverflowing = false;
|
137
|
+
this._ignoreBackdropClick = false;
|
138
|
+
this._scrollbarWidth = 0;
|
139
|
+
} // Getters
|
140
|
+
|
141
|
+
|
142
|
+
var _proto = Modal.prototype;
|
143
|
+
|
144
|
+
// Public
|
145
|
+
_proto.toggle = function toggle(relatedTarget) {
|
146
|
+
return this._isShown ? this.hide() : this.show(relatedTarget);
|
147
|
+
};
|
148
|
+
|
149
|
+
_proto.show = function show(relatedTarget) {
|
150
|
+
var _this = this;
|
151
|
+
|
152
|
+
if (this._isTransitioning || this._isShown) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
|
156
|
+
if ($$$1(this._element).hasClass(ClassName.FADE)) {
|
157
|
+
this._isTransitioning = true;
|
158
|
+
}
|
159
|
+
|
160
|
+
var showEvent = $$$1.Event(Event.SHOW, {
|
161
|
+
relatedTarget: relatedTarget
|
162
|
+
});
|
163
|
+
$$$1(this._element).trigger(showEvent);
|
164
|
+
|
165
|
+
if (this._isShown || showEvent.isDefaultPrevented()) {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
|
169
|
+
this._isShown = true;
|
170
|
+
|
171
|
+
this._checkScrollbar();
|
172
|
+
|
173
|
+
this._setScrollbar();
|
174
|
+
|
175
|
+
this._adjustDialog();
|
176
|
+
|
177
|
+
$$$1(document.body).addClass(ClassName.OPEN);
|
178
|
+
|
179
|
+
this._setEscapeEvent();
|
180
|
+
|
181
|
+
this._setResizeEvent();
|
182
|
+
|
183
|
+
$$$1(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
|
184
|
+
return _this.hide(event);
|
185
|
+
});
|
186
|
+
$$$1(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
187
|
+
$$$1(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
188
|
+
if ($$$1(event.target).is(_this._element)) {
|
189
|
+
_this._ignoreBackdropClick = true;
|
190
|
+
}
|
191
|
+
});
|
192
|
+
});
|
193
|
+
|
194
|
+
this._showBackdrop(function () {
|
195
|
+
return _this._showElement(relatedTarget);
|
196
|
+
});
|
197
|
+
};
|
198
|
+
|
199
|
+
_proto.hide = function hide(event) {
|
200
|
+
var _this2 = this;
|
201
|
+
|
202
|
+
if (event) {
|
203
|
+
event.preventDefault();
|
204
|
+
}
|
205
|
+
|
206
|
+
if (this._isTransitioning || !this._isShown) {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
|
210
|
+
var hideEvent = $$$1.Event(Event.HIDE);
|
211
|
+
$$$1(this._element).trigger(hideEvent);
|
212
|
+
|
213
|
+
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
214
|
+
return;
|
215
|
+
}
|
216
|
+
|
217
|
+
this._isShown = false;
|
218
|
+
var transition = $$$1(this._element).hasClass(ClassName.FADE);
|
219
|
+
|
220
|
+
if (transition) {
|
221
|
+
this._isTransitioning = true;
|
222
|
+
}
|
223
|
+
|
224
|
+
this._setEscapeEvent();
|
225
|
+
|
226
|
+
this._setResizeEvent();
|
227
|
+
|
228
|
+
$$$1(document).off(Event.FOCUSIN);
|
229
|
+
$$$1(this._element).removeClass(ClassName.SHOW);
|
230
|
+
$$$1(this._element).off(Event.CLICK_DISMISS);
|
231
|
+
$$$1(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
232
|
+
|
233
|
+
if (transition) {
|
234
|
+
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
235
|
+
$$$1(this._element).one(Util.TRANSITION_END, function (event) {
|
236
|
+
return _this2._hideModal(event);
|
237
|
+
}).emulateTransitionEnd(transitionDuration);
|
238
|
+
} else {
|
239
|
+
this._hideModal();
|
240
|
+
}
|
241
|
+
};
|
242
|
+
|
243
|
+
_proto.dispose = function dispose() {
|
244
|
+
$$$1.removeData(this._element, DATA_KEY);
|
245
|
+
$$$1(window, document, this._element, this._backdrop).off(EVENT_KEY);
|
246
|
+
this._config = null;
|
247
|
+
this._element = null;
|
248
|
+
this._dialog = null;
|
249
|
+
this._backdrop = null;
|
250
|
+
this._isShown = null;
|
251
|
+
this._isBodyOverflowing = null;
|
252
|
+
this._ignoreBackdropClick = null;
|
253
|
+
this._scrollbarWidth = null;
|
254
|
+
};
|
255
|
+
|
256
|
+
_proto.handleUpdate = function handleUpdate() {
|
257
|
+
this._adjustDialog();
|
258
|
+
}; // Private
|
259
|
+
|
260
|
+
|
261
|
+
_proto._getConfig = function _getConfig(config) {
|
262
|
+
config = _objectSpread({}, Default, config);
|
263
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
264
|
+
return config;
|
265
|
+
};
|
266
|
+
|
267
|
+
_proto._showElement = function _showElement(relatedTarget) {
|
268
|
+
var _this3 = this;
|
269
|
+
|
270
|
+
var transition = $$$1(this._element).hasClass(ClassName.FADE);
|
271
|
+
|
272
|
+
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
273
|
+
// Don't move modal's DOM position
|
274
|
+
document.body.appendChild(this._element);
|
275
|
+
}
|
276
|
+
|
277
|
+
this._element.style.display = 'block';
|
278
|
+
|
279
|
+
this._element.removeAttribute('aria-hidden');
|
280
|
+
|
281
|
+
this._element.scrollTop = 0;
|
282
|
+
|
283
|
+
if (transition) {
|
284
|
+
Util.reflow(this._element);
|
285
|
+
}
|
286
|
+
|
287
|
+
$$$1(this._element).addClass(ClassName.SHOW);
|
288
|
+
|
289
|
+
if (this._config.focus) {
|
290
|
+
this._enforceFocus();
|
291
|
+
}
|
292
|
+
|
293
|
+
var shownEvent = $$$1.Event(Event.SHOWN, {
|
294
|
+
relatedTarget: relatedTarget
|
295
|
+
});
|
296
|
+
|
297
|
+
var transitionComplete = function transitionComplete() {
|
298
|
+
if (_this3._config.focus) {
|
299
|
+
_this3._element.focus();
|
300
|
+
}
|
301
|
+
|
302
|
+
_this3._isTransitioning = false;
|
303
|
+
$$$1(_this3._element).trigger(shownEvent);
|
304
|
+
};
|
305
|
+
|
306
|
+
if (transition) {
|
307
|
+
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
308
|
+
$$$1(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
|
309
|
+
} else {
|
310
|
+
transitionComplete();
|
311
|
+
}
|
312
|
+
};
|
313
|
+
|
314
|
+
_proto._enforceFocus = function _enforceFocus() {
|
315
|
+
var _this4 = this;
|
316
|
+
|
317
|
+
$$$1(document).off(Event.FOCUSIN) // Guard against infinite focus loop
|
318
|
+
.on(Event.FOCUSIN, function (event) {
|
319
|
+
if (document !== event.target && _this4._element !== event.target && $$$1(_this4._element).has(event.target).length === 0) {
|
320
|
+
_this4._element.focus();
|
321
|
+
}
|
322
|
+
});
|
323
|
+
};
|
324
|
+
|
325
|
+
_proto._setEscapeEvent = function _setEscapeEvent() {
|
326
|
+
var _this5 = this;
|
327
|
+
|
328
|
+
if (this._isShown && this._config.keyboard) {
|
329
|
+
$$$1(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
330
|
+
if (event.which === ESCAPE_KEYCODE) {
|
331
|
+
event.preventDefault();
|
332
|
+
|
333
|
+
_this5.hide();
|
334
|
+
}
|
335
|
+
});
|
336
|
+
} else if (!this._isShown) {
|
337
|
+
$$$1(this._element).off(Event.KEYDOWN_DISMISS);
|
338
|
+
}
|
339
|
+
};
|
340
|
+
|
341
|
+
_proto._setResizeEvent = function _setResizeEvent() {
|
342
|
+
var _this6 = this;
|
343
|
+
|
344
|
+
if (this._isShown) {
|
345
|
+
$$$1(window).on(Event.RESIZE, function (event) {
|
346
|
+
return _this6.handleUpdate(event);
|
347
|
+
});
|
348
|
+
} else {
|
349
|
+
$$$1(window).off(Event.RESIZE);
|
350
|
+
}
|
351
|
+
};
|
352
|
+
|
353
|
+
_proto._hideModal = function _hideModal() {
|
354
|
+
var _this7 = this;
|
355
|
+
|
356
|
+
this._element.style.display = 'none';
|
357
|
+
|
358
|
+
this._element.setAttribute('aria-hidden', true);
|
359
|
+
|
360
|
+
this._isTransitioning = false;
|
361
|
+
|
362
|
+
this._showBackdrop(function () {
|
363
|
+
$$$1(document.body).removeClass(ClassName.OPEN);
|
364
|
+
|
365
|
+
_this7._resetAdjustments();
|
366
|
+
|
367
|
+
_this7._resetScrollbar();
|
368
|
+
|
369
|
+
$$$1(_this7._element).trigger(Event.HIDDEN);
|
370
|
+
});
|
371
|
+
};
|
372
|
+
|
373
|
+
_proto._removeBackdrop = function _removeBackdrop() {
|
374
|
+
if (this._backdrop) {
|
375
|
+
$$$1(this._backdrop).remove();
|
376
|
+
this._backdrop = null;
|
377
|
+
}
|
378
|
+
};
|
379
|
+
|
380
|
+
_proto._showBackdrop = function _showBackdrop(callback) {
|
381
|
+
var _this8 = this;
|
382
|
+
|
383
|
+
var animate = $$$1(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
|
384
|
+
|
385
|
+
if (this._isShown && this._config.backdrop) {
|
386
|
+
this._backdrop = document.createElement('div');
|
387
|
+
this._backdrop.className = ClassName.BACKDROP;
|
388
|
+
|
389
|
+
if (animate) {
|
390
|
+
this._backdrop.classList.add(animate);
|
391
|
+
}
|
392
|
+
|
393
|
+
$$$1(this._backdrop).appendTo(document.body);
|
394
|
+
$$$1(this._element).on(Event.CLICK_DISMISS, function (event) {
|
395
|
+
if (_this8._ignoreBackdropClick) {
|
396
|
+
_this8._ignoreBackdropClick = false;
|
397
|
+
return;
|
398
|
+
}
|
399
|
+
|
400
|
+
if (event.target !== event.currentTarget) {
|
401
|
+
return;
|
402
|
+
}
|
403
|
+
|
404
|
+
if (_this8._config.backdrop === 'static') {
|
405
|
+
_this8._element.focus();
|
406
|
+
} else {
|
407
|
+
_this8.hide();
|
408
|
+
}
|
409
|
+
});
|
410
|
+
|
411
|
+
if (animate) {
|
412
|
+
Util.reflow(this._backdrop);
|
413
|
+
}
|
414
|
+
|
415
|
+
$$$1(this._backdrop).addClass(ClassName.SHOW);
|
416
|
+
|
417
|
+
if (!callback) {
|
418
|
+
return;
|
419
|
+
}
|
420
|
+
|
421
|
+
if (!animate) {
|
422
|
+
callback();
|
423
|
+
return;
|
424
|
+
}
|
425
|
+
|
426
|
+
var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
427
|
+
$$$1(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
|
428
|
+
} else if (!this._isShown && this._backdrop) {
|
429
|
+
$$$1(this._backdrop).removeClass(ClassName.SHOW);
|
430
|
+
|
431
|
+
var callbackRemove = function callbackRemove() {
|
432
|
+
_this8._removeBackdrop();
|
433
|
+
|
434
|
+
if (callback) {
|
435
|
+
callback();
|
436
|
+
}
|
437
|
+
};
|
438
|
+
|
439
|
+
if ($$$1(this._element).hasClass(ClassName.FADE)) {
|
440
|
+
var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
441
|
+
|
442
|
+
$$$1(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
|
443
|
+
} else {
|
444
|
+
callbackRemove();
|
445
|
+
}
|
446
|
+
} else if (callback) {
|
447
|
+
callback();
|
448
|
+
}
|
449
|
+
}; // ----------------------------------------------------------------------
|
450
|
+
// the following methods are used to handle overflowing modals
|
451
|
+
// todo (fat): these should probably be refactored out of modal.js
|
452
|
+
// ----------------------------------------------------------------------
|
453
|
+
|
454
|
+
|
455
|
+
_proto._adjustDialog = function _adjustDialog() {
|
456
|
+
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
457
|
+
|
458
|
+
if (!this._isBodyOverflowing && isModalOverflowing) {
|
459
|
+
this._element.style.paddingLeft = this._scrollbarWidth + "px";
|
460
|
+
}
|
461
|
+
|
462
|
+
if (this._isBodyOverflowing && !isModalOverflowing) {
|
463
|
+
this._element.style.paddingRight = this._scrollbarWidth + "px";
|
464
|
+
}
|
465
|
+
};
|
466
|
+
|
467
|
+
_proto._resetAdjustments = function _resetAdjustments() {
|
468
|
+
this._element.style.paddingLeft = '';
|
469
|
+
this._element.style.paddingRight = '';
|
470
|
+
};
|
471
|
+
|
472
|
+
_proto._checkScrollbar = function _checkScrollbar() {
|
473
|
+
var rect = document.body.getBoundingClientRect();
|
474
|
+
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
|
475
|
+
this._scrollbarWidth = this._getScrollbarWidth();
|
476
|
+
};
|
477
|
+
|
478
|
+
_proto._setScrollbar = function _setScrollbar() {
|
479
|
+
var _this9 = this;
|
480
|
+
|
481
|
+
if (this._isBodyOverflowing) {
|
482
|
+
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
483
|
+
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
484
|
+
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
|
485
|
+
var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)); // Adjust fixed content padding
|
486
|
+
|
487
|
+
$$$1(fixedContent).each(function (index, element) {
|
488
|
+
var actualPadding = element.style.paddingRight;
|
489
|
+
var calculatedPadding = $$$1(element).css('padding-right');
|
490
|
+
$$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
|
491
|
+
}); // Adjust sticky content margin
|
492
|
+
|
493
|
+
$$$1(stickyContent).each(function (index, element) {
|
494
|
+
var actualMargin = element.style.marginRight;
|
495
|
+
var calculatedMargin = $$$1(element).css('margin-right');
|
496
|
+
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
|
497
|
+
}); // Adjust body padding
|
498
|
+
|
499
|
+
var actualPadding = document.body.style.paddingRight;
|
500
|
+
var calculatedPadding = $$$1(document.body).css('padding-right');
|
501
|
+
$$$1(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
|
502
|
+
}
|
503
|
+
};
|
504
|
+
|
505
|
+
_proto._resetScrollbar = function _resetScrollbar() {
|
506
|
+
// Restore fixed content padding
|
507
|
+
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
|
508
|
+
$$$1(fixedContent).each(function (index, element) {
|
509
|
+
var padding = $$$1(element).data('padding-right');
|
510
|
+
$$$1(element).removeData('padding-right');
|
511
|
+
element.style.paddingRight = padding ? padding : '';
|
512
|
+
}); // Restore sticky content
|
513
|
+
|
514
|
+
var elements = [].slice.call(document.querySelectorAll("" + Selector.STICKY_CONTENT));
|
515
|
+
$$$1(elements).each(function (index, element) {
|
516
|
+
var margin = $$$1(element).data('margin-right');
|
517
|
+
|
518
|
+
if (typeof margin !== 'undefined') {
|
519
|
+
$$$1(element).css('margin-right', margin).removeData('margin-right');
|
520
|
+
}
|
521
|
+
}); // Restore body padding
|
522
|
+
|
523
|
+
var padding = $$$1(document.body).data('padding-right');
|
524
|
+
$$$1(document.body).removeData('padding-right');
|
525
|
+
document.body.style.paddingRight = padding ? padding : '';
|
526
|
+
};
|
527
|
+
|
528
|
+
_proto._getScrollbarWidth = function _getScrollbarWidth() {
|
529
|
+
// thx d.walsh
|
530
|
+
var scrollDiv = document.createElement('div');
|
531
|
+
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
|
532
|
+
document.body.appendChild(scrollDiv);
|
533
|
+
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
534
|
+
document.body.removeChild(scrollDiv);
|
535
|
+
return scrollbarWidth;
|
536
|
+
}; // Static
|
537
|
+
|
538
|
+
|
539
|
+
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
540
|
+
return this.each(function () {
|
541
|
+
var data = $$$1(this).data(DATA_KEY);
|
542
|
+
|
543
|
+
var _config = _objectSpread({}, Default, $$$1(this).data(), typeof config === 'object' && config ? config : {});
|
544
|
+
|
545
|
+
if (!data) {
|
546
|
+
data = new Modal(this, _config);
|
547
|
+
$$$1(this).data(DATA_KEY, data);
|
548
|
+
}
|
549
|
+
|
550
|
+
if (typeof config === 'string') {
|
551
|
+
if (typeof data[config] === 'undefined') {
|
552
|
+
throw new TypeError("No method named \"" + config + "\"");
|
553
|
+
}
|
554
|
+
|
555
|
+
data[config](relatedTarget);
|
556
|
+
} else if (_config.show) {
|
557
|
+
data.show(relatedTarget);
|
558
|
+
}
|
559
|
+
});
|
560
|
+
};
|
561
|
+
|
562
|
+
_createClass(Modal, null, [{
|
563
|
+
key: "VERSION",
|
564
|
+
get: function get() {
|
565
|
+
return VERSION;
|
566
|
+
}
|
567
|
+
}, {
|
568
|
+
key: "Default",
|
569
|
+
get: function get() {
|
570
|
+
return Default;
|
571
|
+
}
|
572
|
+
}]);
|
573
|
+
|
574
|
+
return Modal;
|
575
|
+
}();
|
576
|
+
/**
|
577
|
+
* ------------------------------------------------------------------------
|
578
|
+
* Data Api implementation
|
579
|
+
* ------------------------------------------------------------------------
|
580
|
+
*/
|
581
|
+
|
582
|
+
|
583
|
+
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
584
|
+
var _this10 = this;
|
585
|
+
|
586
|
+
var target;
|
587
|
+
var selector = Util.getSelectorFromElement(this);
|
588
|
+
|
589
|
+
if (selector) {
|
590
|
+
target = document.querySelector(selector);
|
591
|
+
}
|
592
|
+
|
593
|
+
var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data());
|
594
|
+
|
595
|
+
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
596
|
+
event.preventDefault();
|
597
|
+
}
|
598
|
+
|
599
|
+
var $target = $$$1(target).one(Event.SHOW, function (showEvent) {
|
600
|
+
if (showEvent.isDefaultPrevented()) {
|
601
|
+
// Only register focus restorer if modal will actually get shown
|
602
|
+
return;
|
603
|
+
}
|
604
|
+
|
605
|
+
$target.one(Event.HIDDEN, function () {
|
606
|
+
if ($$$1(_this10).is(':visible')) {
|
607
|
+
_this10.focus();
|
608
|
+
}
|
609
|
+
});
|
610
|
+
});
|
611
|
+
|
612
|
+
Modal._jQueryInterface.call($$$1(target), config, this);
|
613
|
+
});
|
614
|
+
/**
|
615
|
+
* ------------------------------------------------------------------------
|
616
|
+
* jQuery
|
617
|
+
* ------------------------------------------------------------------------
|
618
|
+
*/
|
619
|
+
|
620
|
+
$$$1.fn[NAME] = Modal._jQueryInterface;
|
621
|
+
$$$1.fn[NAME].Constructor = Modal;
|
622
|
+
|
623
|
+
$$$1.fn[NAME].noConflict = function () {
|
624
|
+
$$$1.fn[NAME] = JQUERY_NO_CONFLICT;
|
625
|
+
return Modal._jQueryInterface;
|
626
|
+
};
|
627
|
+
|
628
|
+
return Modal;
|
629
|
+
}($);
|
630
|
+
|
631
|
+
return Modal;
|
632
|
+
|
633
|
+
})));
|