|
@@ -1014,47 +1014,58 @@ UI.Button.prototype.setLabel = function ( value ) {
|
|
|
};
|
|
|
|
|
|
|
|
|
-// Dialog
|
|
|
+// Modal
|
|
|
|
|
|
-UI.Dialog = function ( value ) {
|
|
|
+UI.Modal = function ( value ) {
|
|
|
|
|
|
var scope = this;
|
|
|
|
|
|
- var dom = document.createElement( 'dialog' );
|
|
|
+ var dom = document.createElement( 'div' );
|
|
|
|
|
|
- if ( dom.showModal === undefined ) {
|
|
|
+ dom.style.position = 'absolute';
|
|
|
+ dom.style.width = '100%';
|
|
|
+ dom.style.height = '100%';
|
|
|
+ dom.style.backgroundColor = 'rgba(0,0,0,0.5)';
|
|
|
+ dom.style.display = 'none';
|
|
|
+ dom.style.alignItems = 'center';
|
|
|
+ dom.style.justifyContent = 'center';
|
|
|
+ dom.addEventListener( 'click', function ( event ) {
|
|
|
|
|
|
- // fallback
|
|
|
+ scope.hide();
|
|
|
|
|
|
- dom = document.createElement( 'div' );
|
|
|
- dom.style.display = 'none';
|
|
|
+ } );
|
|
|
|
|
|
- dom.showModal = function () {
|
|
|
+ this.dom = dom;
|
|
|
|
|
|
- dom.style.position = 'absolute';
|
|
|
- dom.style.left = '100px';
|
|
|
- dom.style.top = '100px';
|
|
|
- dom.style.zIndex = 1;
|
|
|
- dom.style.display = '';
|
|
|
+ this.container = new UI.Panel();
|
|
|
+ this.container.dom.style.width = '200px';
|
|
|
+ this.container.dom.style.padding = '20px';
|
|
|
+ this.container.dom.style.backgroundColor = '#ffffff';
|
|
|
+ this.container.dom.style.boxShadow = '0px 5px 10px rgba(0,0,0,0.5)';
|
|
|
|
|
|
- };
|
|
|
+ this.add( this.container );
|
|
|
|
|
|
- }
|
|
|
+ return this;
|
|
|
|
|
|
- dom.className = 'Dialog';
|
|
|
+};
|
|
|
|
|
|
- this.dom = dom;
|
|
|
+UI.Modal.prototype = Object.create( UI.Element.prototype );
|
|
|
+UI.Modal.prototype.constructor = UI.Modal;
|
|
|
+
|
|
|
+UI.Modal.prototype.show = function ( content ) {
|
|
|
+
|
|
|
+ this.container.clear();
|
|
|
+ this.container.add( content );
|
|
|
+
|
|
|
+ this.dom.style.display = 'flex';
|
|
|
|
|
|
return this;
|
|
|
|
|
|
};
|
|
|
|
|
|
-UI.Dialog.prototype = Object.create( UI.Panel.prototype );
|
|
|
-UI.Dialog.prototype.constructor = UI.Dialog;
|
|
|
-
|
|
|
-UI.Dialog.prototype.showModal = function () {
|
|
|
+UI.Modal.prototype.hide = function () {
|
|
|
|
|
|
- this.dom.showModal();
|
|
|
+ this.dom.style.display = 'none';
|
|
|
|
|
|
return this;
|
|
|
|