@deephaven/golden-layout 0.17.1-beta.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LayoutManager.js +1140 -0
- package/dist/LayoutManager.js.map +1 -0
- package/dist/base.js +16 -0
- package/dist/base.js.map +1 -0
- package/dist/config/ItemDefaultConfig.js +8 -0
- package/dist/config/ItemDefaultConfig.js.map +1 -0
- package/dist/config/defaultConfig.js +42 -0
- package/dist/config/defaultConfig.js.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/container/ItemContainer.js +192 -0
- package/dist/container/ItemContainer.js.map +1 -0
- package/dist/container/index.js +5 -0
- package/dist/container/index.js.map +1 -0
- package/dist/controls/BrowserPopout.js +260 -0
- package/dist/controls/BrowserPopout.js.map +1 -0
- package/dist/controls/DragProxy.js +236 -0
- package/dist/controls/DragProxy.js.map +1 -0
- package/dist/controls/DragSource.js +60 -0
- package/dist/controls/DragSource.js.map +1 -0
- package/dist/controls/DragSourceFromEvent.js +75 -0
- package/dist/controls/DragSourceFromEvent.js.map +1 -0
- package/dist/controls/DropTargetIndicator.js +28 -0
- package/dist/controls/DropTargetIndicator.js.map +1 -0
- package/dist/controls/Header.js +698 -0
- package/dist/controls/Header.js.map +1 -0
- package/dist/controls/HeaderButton.js +23 -0
- package/dist/controls/HeaderButton.js.map +1 -0
- package/dist/controls/Splitter.js +45 -0
- package/dist/controls/Splitter.js.map +1 -0
- package/dist/controls/Tab.js +259 -0
- package/dist/controls/Tab.js.map +1 -0
- package/dist/controls/TransitionIndicator.js +64 -0
- package/dist/controls/TransitionIndicator.js.map +1 -0
- package/dist/controls/index.js +23 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/errors/ConfigurationError.js +10 -0
- package/dist/errors/ConfigurationError.js.map +1 -0
- package/dist/errors/index.js +5 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/items/AbstractContentItem.js +617 -0
- package/dist/items/AbstractContentItem.js.map +1 -0
- package/dist/items/Component.js +84 -0
- package/dist/items/Component.js.map +1 -0
- package/dist/items/Root.js +93 -0
- package/dist/items/Root.js.map +1 -0
- package/dist/items/RowOrColumn.js +550 -0
- package/dist/items/RowOrColumn.js.map +1 -0
- package/dist/items/Stack.js +498 -0
- package/dist/items/Stack.js.map +1 -0
- package/dist/items/index.js +13 -0
- package/dist/items/index.js.map +1 -0
- package/dist/utils/BubblingEvent.js +12 -0
- package/dist/utils/BubblingEvent.js.map +1 -0
- package/dist/utils/ConfigMinifier.js +160 -0
- package/dist/utils/ConfigMinifier.js.map +1 -0
- package/dist/utils/DragListener.js +128 -0
- package/dist/utils/DragListener.js.map +1 -0
- package/dist/utils/EventEmitter.js +133 -0
- package/dist/utils/EventEmitter.js.map +1 -0
- package/dist/utils/EventHub.js +147 -0
- package/dist/utils/EventHub.js.map +1 -0
- package/dist/utils/ReactComponentHandler.js +135 -0
- package/dist/utils/ReactComponentHandler.js.map +1 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/utils.js +195 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +20 -47
- package/dist/goldenlayout.js +0 -6314
- package/dist/goldenlayout.min.js +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import utils from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Minifies and unminifies configs by replacing frequent keys
|
|
4
|
+
* and values with one letter substitutes. Config options must
|
|
5
|
+
* retain array position/index, add new options at the end.
|
|
6
|
+
*
|
|
7
|
+
* @constructor
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var ConfigMinifier = function ConfigMinifier() {
|
|
11
|
+
this._keys = ['settings', 'hasHeaders', 'constrainDragToContainer', 'selectionEnabled', 'dimensions', 'borderWidth', 'minItemHeight', 'minItemWidth', 'headerHeight', 'dragProxyWidth', 'dragProxyHeight', 'labels', 'close', 'maximise', 'minimise', 'popout', 'content', 'componentName', 'componentState', 'id', 'width', 'type', 'height', 'isClosable', 'title', 'popoutWholeStack', 'openPopouts', 'parentId', 'activeItemIndex', 'reorderEnabled', 'borderGrabWidth' //Maximum 36 entries, do not cross this line!
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
if (this._keys.length > 36) {
|
|
15
|
+
throw new Error('Too many keys in config minifier map');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this._values = [true, false, 'row', 'column', 'stack', 'component', 'close', 'maximise', 'minimise', 'open in new window'];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
utils.copy(ConfigMinifier.prototype, {
|
|
22
|
+
/**
|
|
23
|
+
* Takes a GoldenLayout configuration object and
|
|
24
|
+
* replaces its keys and values recursively with
|
|
25
|
+
* one letter counterparts
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} config A GoldenLayout config object
|
|
28
|
+
*
|
|
29
|
+
* @returns {Object} minified config
|
|
30
|
+
*/
|
|
31
|
+
minifyConfig: function minifyConfig(config) {
|
|
32
|
+
var min = {};
|
|
33
|
+
|
|
34
|
+
this._nextLevel(config, min, '_min');
|
|
35
|
+
|
|
36
|
+
return min;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Takes a configuration Object that was previously minified
|
|
41
|
+
* using minifyConfig and returns its original version
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} minifiedConfig
|
|
44
|
+
*
|
|
45
|
+
* @returns {Object} the original configuration
|
|
46
|
+
*/
|
|
47
|
+
unminifyConfig: function unminifyConfig(minifiedConfig) {
|
|
48
|
+
var orig = {};
|
|
49
|
+
|
|
50
|
+
this._nextLevel(minifiedConfig, orig, '_max');
|
|
51
|
+
|
|
52
|
+
return orig;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Recursive function, called for every level of the config structure
|
|
57
|
+
*
|
|
58
|
+
* @param {Array|Object} orig
|
|
59
|
+
* @param {Array|Object} min
|
|
60
|
+
* @param {String} translationFn
|
|
61
|
+
*
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
_nextLevel: function _nextLevel(from, to, translationFn) {
|
|
65
|
+
var key, minKey;
|
|
66
|
+
|
|
67
|
+
for (key in from) {
|
|
68
|
+
/**
|
|
69
|
+
* For in returns array indices as keys, so let's cast them to numbers
|
|
70
|
+
*/
|
|
71
|
+
if (from instanceof Array) key = parseInt(key, 10);
|
|
72
|
+
/**
|
|
73
|
+
* In case something has extended Object prototypes
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
if (!from.hasOwnProperty(key)) continue;
|
|
77
|
+
/**
|
|
78
|
+
* Translate the key to a one letter substitute
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
minKey = this[translationFn](key, this._keys);
|
|
82
|
+
/**
|
|
83
|
+
* For Arrays and Objects, create a new Array/Object
|
|
84
|
+
* on the minified object and recurse into it
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
if (typeof from[key] === 'object') {
|
|
88
|
+
to[minKey] = from[key] instanceof Array ? [] : {};
|
|
89
|
+
|
|
90
|
+
this._nextLevel(from[key], to[minKey], translationFn);
|
|
91
|
+
/**
|
|
92
|
+
* For primitive values (Strings, Numbers, Boolean etc.)
|
|
93
|
+
* minify the value
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
} else {
|
|
97
|
+
to[minKey] = this[translationFn](from[key], this._values);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Minifies value based on a dictionary
|
|
104
|
+
*
|
|
105
|
+
* @param {String|Boolean} value
|
|
106
|
+
* @param {Array<String|Boolean>} dictionary
|
|
107
|
+
*
|
|
108
|
+
* @returns {String} The minified version
|
|
109
|
+
*/
|
|
110
|
+
_min: function _min(value, dictionary) {
|
|
111
|
+
/**
|
|
112
|
+
* If a value actually is a single character, prefix it
|
|
113
|
+
* with ___ to avoid mistaking it for a minification code
|
|
114
|
+
*/
|
|
115
|
+
if (typeof value === 'string' && value.length === 1) {
|
|
116
|
+
return '___' + value;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
var index = utils.indexOf(value, dictionary);
|
|
120
|
+
/**
|
|
121
|
+
* value not found in the dictionary, return it unmodified
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
if (index === -1) {
|
|
125
|
+
return value;
|
|
126
|
+
/**
|
|
127
|
+
* value found in dictionary, return its base36 counterpart
|
|
128
|
+
*/
|
|
129
|
+
} else {
|
|
130
|
+
return index.toString(36);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
_max: function _max(value, dictionary) {
|
|
134
|
+
/**
|
|
135
|
+
* value is a single character. Assume that it's a translation
|
|
136
|
+
* and return the original value from the dictionary
|
|
137
|
+
*/
|
|
138
|
+
if (typeof value === 'string' && value.length === 1) {
|
|
139
|
+
return dictionary[parseInt(value, 36)];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* value originally was a single character and was prefixed with ___
|
|
143
|
+
* to avoid mistaking it for a translation. Remove the prefix
|
|
144
|
+
* and return the original character
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if (typeof value === 'string' && value.substr(0, 3) === '___') {
|
|
149
|
+
return value[3];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* value was not minified
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
export default ConfigMinifier;
|
|
160
|
+
//# sourceMappingURL=ConfigMinifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigMinifier.js","names":["utils","ConfigMinifier","_keys","length","Error","_values","copy","prototype","minifyConfig","config","min","_nextLevel","unminifyConfig","minifiedConfig","orig","from","to","translationFn","key","minKey","Array","parseInt","hasOwnProperty","_min","value","dictionary","index","indexOf","toString","_max","substr"],"sources":["../../src/utils/ConfigMinifier.js"],"sourcesContent":["import utils from './utils.js';\n\n/**\n * Minifies and unminifies configs by replacing frequent keys\n * and values with one letter substitutes. Config options must\n * retain array position/index, add new options at the end.\n *\n * @constructor\n */\nconst ConfigMinifier = function () {\n this._keys = [\n 'settings',\n 'hasHeaders',\n 'constrainDragToContainer',\n 'selectionEnabled',\n 'dimensions',\n 'borderWidth',\n 'minItemHeight',\n 'minItemWidth',\n 'headerHeight',\n 'dragProxyWidth',\n 'dragProxyHeight',\n 'labels',\n 'close',\n 'maximise',\n 'minimise',\n 'popout',\n 'content',\n 'componentName',\n 'componentState',\n 'id',\n 'width',\n 'type',\n 'height',\n 'isClosable',\n 'title',\n 'popoutWholeStack',\n 'openPopouts',\n 'parentId',\n 'activeItemIndex',\n 'reorderEnabled',\n 'borderGrabWidth',\n\n //Maximum 36 entries, do not cross this line!\n ];\n if (this._keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n\n this._values = [\n true,\n false,\n 'row',\n 'column',\n 'stack',\n 'component',\n 'close',\n 'maximise',\n 'minimise',\n 'open in new window',\n ];\n};\n\nutils.copy(ConfigMinifier.prototype, {\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter counterparts\n *\n * @param {Object} config A GoldenLayout config object\n *\n * @returns {Object} minified config\n */\n minifyConfig: function (config) {\n var min = {};\n this._nextLevel(config, min, '_min');\n return min;\n },\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n *\n * @param {Object} minifiedConfig\n *\n * @returns {Object} the original configuration\n */\n unminifyConfig: function (minifiedConfig) {\n var orig = {};\n this._nextLevel(minifiedConfig, orig, '_max');\n return orig;\n },\n\n /**\n * Recursive function, called for every level of the config structure\n *\n * @param {Array|Object} orig\n * @param {Array|Object} min\n * @param {String} translationFn\n *\n * @returns {void}\n */\n _nextLevel: function (from, to, translationFn) {\n var key, minKey;\n\n for (key in from) {\n /**\n * For in returns array indices as keys, so let's cast them to numbers\n */\n if (from instanceof Array) key = parseInt(key, 10);\n\n /**\n * In case something has extended Object prototypes\n */\n if (!from.hasOwnProperty(key)) continue;\n\n /**\n * Translate the key to a one letter substitute\n */\n minKey = this[translationFn](key, this._keys);\n\n /**\n * For Arrays and Objects, create a new Array/Object\n * on the minified object and recurse into it\n */\n if (typeof from[key] === 'object') {\n to[minKey] = from[key] instanceof Array ? [] : {};\n this._nextLevel(from[key], to[minKey], translationFn);\n\n /**\n * For primitive values (Strings, Numbers, Boolean etc.)\n * minify the value\n */\n } else {\n to[minKey] = this[translationFn](from[key], this._values);\n }\n }\n },\n\n /**\n * Minifies value based on a dictionary\n *\n * @param {String|Boolean} value\n * @param {Array<String|Boolean>} dictionary\n *\n * @returns {String} The minified version\n */\n _min: function (value, dictionary) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n\n var index = utils.indexOf(value, dictionary);\n\n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n\n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n },\n\n _max: function (value, dictionary) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (typeof value === 'string' && value.length === 1) {\n return dictionary[parseInt(value, 36)];\n }\n\n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (typeof value === 'string' && value.substr(0, 3) === '___') {\n return value[3];\n }\n /**\n * value was not minified\n */\n return value;\n },\n});\n\nexport default ConfigMinifier;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,YAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,GAAY;EACjC,KAAKC,KAAL,GAAa,CACX,UADW,EAEX,YAFW,EAGX,0BAHW,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AAf,EAAkB;MAChB,OAAOF,KAAP;MAEA;AACN;AACA;IACK,CAND,MAMO;MACL,OAAOE,KAAK,CAACE,QAAN,CAAe,EAAf,CAAP;IACD;EACF,CA3GkC;EA6GnCC,IAAI,EAAE,cAAUL,KAAV,EAAiBC,UAAjB,EAA6B;IACjC;AACJ;AACA;AACA;IACI,IAAI,OAAOD,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACrB,MAAN,KAAiB,CAAlD,EAAqD;MACnD,OAAOsB,UAAU,CAACJ,QAAQ,CAACG,KAAD,EAAQ,EAAR,CAAT,CAAjB;IACD;IAED;AACJ;AACA;AACA;AACA;;;IACI,IAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACM,MAAN,CAAa,CAAb,EAAgB,CAAhB,MAAuB,KAAxD,EAA+D;MAC7D,OAAON,KAAK,CAAC,CAAD,CAAZ;IACD;IACD;AACJ;AACA;;;IACI,OAAOA,KAAP;EACD;AAlIkC,CAArC;AAqIA,eAAevB,cAAf"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import utils from './utils.js';
|
|
3
|
+
import EventEmitter from './EventEmitter.js';
|
|
4
|
+
|
|
5
|
+
var DragListener = function DragListener(eElement, destroyAfterMouseUp) {
|
|
6
|
+
EventEmitter.call(this);
|
|
7
|
+
this._eElement = $(eElement);
|
|
8
|
+
this._oDocument = $(document);
|
|
9
|
+
this._eBody = $(document.body); // used by drag sources, to destroy listener at the right time
|
|
10
|
+
|
|
11
|
+
this._destroyAfterMouseUp = destroyAfterMouseUp || false;
|
|
12
|
+
/**
|
|
13
|
+
* The delay after which to start the drag in milliseconds
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
this._nDelay = 400;
|
|
17
|
+
this._timeout = null;
|
|
18
|
+
/**
|
|
19
|
+
* The distance the mouse needs to be moved to qualify as a drag
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
this._nDistance = 10; //TODO - works better with delay only
|
|
23
|
+
|
|
24
|
+
this._nX = 0;
|
|
25
|
+
this._nY = 0;
|
|
26
|
+
this._nOriginalX = 0;
|
|
27
|
+
this._nOriginalY = 0;
|
|
28
|
+
this._bDragging = false;
|
|
29
|
+
this._fMove = utils.fnBind(this.onMouseMove, this);
|
|
30
|
+
this._fUp = utils.fnBind(this.onMouseUp, this);
|
|
31
|
+
this._fDown = utils.fnBind(this.onMouseDown, this);
|
|
32
|
+
|
|
33
|
+
this._eElement.on('mousedown', this._fDown);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
DragListener.timeout = null;
|
|
37
|
+
utils.copy(DragListener.prototype, {
|
|
38
|
+
destroy: function destroy() {
|
|
39
|
+
this._eElement.unbind('mousedown', this._fDown);
|
|
40
|
+
|
|
41
|
+
this._oDocument.unbind('mouseup', this._fUp);
|
|
42
|
+
|
|
43
|
+
this._eElement = null;
|
|
44
|
+
this._oDocument = null;
|
|
45
|
+
this._eBody = null;
|
|
46
|
+
clearTimeout(this._timeout);
|
|
47
|
+
this._timeout = null;
|
|
48
|
+
},
|
|
49
|
+
onMouseDown: function onMouseDown(oEvent) {
|
|
50
|
+
oEvent.preventDefault();
|
|
51
|
+
|
|
52
|
+
if (oEvent.button === 0) {
|
|
53
|
+
var coordinates = this._getCoordinates(oEvent);
|
|
54
|
+
|
|
55
|
+
this._nOriginalX = coordinates.x;
|
|
56
|
+
this._nOriginalY = coordinates.y;
|
|
57
|
+
|
|
58
|
+
this._oDocument.on('mousemove', this._fMove);
|
|
59
|
+
|
|
60
|
+
this._oDocument.one('mouseup', this._fUp);
|
|
61
|
+
|
|
62
|
+
this._timeout = setTimeout(utils.fnBind(this._startDrag, this), this._nDelay);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onMouseMove: function onMouseMove(oEvent) {
|
|
66
|
+
if (this._timeout != null) {
|
|
67
|
+
oEvent.preventDefault();
|
|
68
|
+
|
|
69
|
+
var coordinates = this._getCoordinates(oEvent);
|
|
70
|
+
|
|
71
|
+
this._nX = coordinates.x - this._nOriginalX;
|
|
72
|
+
this._nY = coordinates.y - this._nOriginalY;
|
|
73
|
+
|
|
74
|
+
if (this._bDragging === false) {
|
|
75
|
+
if (Math.abs(this._nX) > this._nDistance || Math.abs(this._nY) > this._nDistance) {
|
|
76
|
+
this._startDrag();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this._bDragging) {
|
|
81
|
+
this.emit('drag', this._nX, this._nY, oEvent);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
onMouseUp: function onMouseUp(oEvent) {
|
|
86
|
+
if (this._timeout != null) {
|
|
87
|
+
clearTimeout(this._timeout);
|
|
88
|
+
|
|
89
|
+
this._oDocument.unbind('mousemove', this._fMove);
|
|
90
|
+
|
|
91
|
+
this._oDocument.unbind('mouseup', this._fUp);
|
|
92
|
+
|
|
93
|
+
this._oDocument.find('iframe').css('pointer-events', '');
|
|
94
|
+
|
|
95
|
+
if (this._bDragging === true) {
|
|
96
|
+
this._bDragging = false;
|
|
97
|
+
this.emit('dragStop', oEvent, this._nOriginalX + this._nX);
|
|
98
|
+
} // after dragStop, so that .lm_dragging is removed after size is processed
|
|
99
|
+
// and any overflow: hidden remains applied during the calculations
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if (this._eBody) this._eBody.removeClass('lm_dragging');
|
|
103
|
+
if (this._eElement) this._eElement.removeClass('lm_dragging');
|
|
104
|
+
if (this._destroyAfterMouseUp) this.destroy();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
_startDrag: function _startDrag() {
|
|
108
|
+
clearTimeout(this._timeout);
|
|
109
|
+
this._bDragging = true;
|
|
110
|
+
|
|
111
|
+
this._eBody.addClass('lm_dragging');
|
|
112
|
+
|
|
113
|
+
this._eElement.addClass('lm_dragging');
|
|
114
|
+
|
|
115
|
+
this._oDocument.find('iframe').css('pointer-events', 'none');
|
|
116
|
+
|
|
117
|
+
this.emit('dragStart', this._nOriginalX, this._nOriginalY);
|
|
118
|
+
},
|
|
119
|
+
_getCoordinates: function _getCoordinates(event) {
|
|
120
|
+
event = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0] : event;
|
|
121
|
+
return {
|
|
122
|
+
x: event.pageX,
|
|
123
|
+
y: event.pageY
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
export default DragListener;
|
|
128
|
+
//# sourceMappingURL=DragListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragListener.js","names":["$","utils","EventEmitter","DragListener","eElement","destroyAfterMouseUp","call","_eElement","_oDocument","document","_eBody","body","_destroyAfterMouseUp","_nDelay","_timeout","_nDistance","_nX","_nY","_nOriginalX","_nOriginalY","_bDragging","_fMove","fnBind","onMouseMove","_fUp","onMouseUp","_fDown","onMouseDown","on","timeout","copy","prototype","destroy","unbind","clearTimeout","oEvent","preventDefault","button","coordinates","_getCoordinates","x","y","one","setTimeout","_startDrag","Math","abs","emit","find","css","removeClass","addClass","event","originalEvent","touches","pageX","pageY"],"sources":["../../src/utils/DragListener.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from './utils.js';\nimport EventEmitter from './EventEmitter.js';\n\nconst DragListener = function (eElement, destroyAfterMouseUp) {\n EventEmitter.call(this);\n\n this._eElement = $(eElement);\n this._oDocument = $(document);\n this._eBody = $(document.body);\n // used by drag sources, to destroy listener at the right time\n this._destroyAfterMouseUp = destroyAfterMouseUp || false;\n\n /**\n * The delay after which to start the drag in milliseconds\n */\n this._nDelay = 400;\n this._timeout = null;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n */\n this._nDistance = 10; //TODO - works better with delay only\n\n this._nX = 0;\n this._nY = 0;\n\n this._nOriginalX = 0;\n this._nOriginalY = 0;\n\n this._bDragging = false;\n\n this._fMove = utils.fnBind(this.onMouseMove, this);\n this._fUp = utils.fnBind(this.onMouseUp, this);\n this._fDown = utils.fnBind(this.onMouseDown, this);\n\n this._eElement.on('mousedown', this._fDown);\n};\n\nDragListener.timeout = null;\n\nutils.copy(DragListener.prototype, {\n destroy: function () {\n this._eElement.unbind('mousedown', this._fDown);\n this._oDocument.unbind('mouseup', this._fUp);\n\n this._eElement = null;\n this._oDocument = null;\n this._eBody = null;\n\n clearTimeout(this._timeout);\n this._timeout = null;\n },\n\n onMouseDown: function (oEvent) {\n oEvent.preventDefault();\n\n if (oEvent.button === 0) {\n var coordinates = this._getCoordinates(oEvent);\n\n this._nOriginalX = coordinates.x;\n this._nOriginalY = coordinates.y;\n\n this._oDocument.on('mousemove', this._fMove);\n this._oDocument.one('mouseup', this._fUp);\n\n this._timeout = setTimeout(\n utils.fnBind(this._startDrag, this),\n this._nDelay\n );\n }\n },\n\n onMouseMove: function (oEvent) {\n if (this._timeout != null) {\n oEvent.preventDefault();\n\n var coordinates = this._getCoordinates(oEvent);\n\n this._nX = coordinates.x - this._nOriginalX;\n this._nY = coordinates.y - this._nOriginalY;\n\n if (this._bDragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this._startDrag();\n }\n }\n\n if (this._bDragging) {\n this.emit('drag', this._nX, this._nY, oEvent);\n }\n }\n },\n\n onMouseUp: function (oEvent) {\n if (this._timeout != null) {\n clearTimeout(this._timeout);\n this._oDocument.unbind('mousemove', this._fMove);\n this._oDocument.unbind('mouseup', this._fUp);\n this._oDocument.find('iframe').css('pointer-events', '');\n\n if (this._bDragging === true) {\n this._bDragging = false;\n this.emit('dragStop', oEvent, this._nOriginalX + this._nX);\n }\n\n // after dragStop, so that .lm_dragging is removed after size is processed\n // and any overflow: hidden remains applied during the calculations\n if (this._eBody) this._eBody.removeClass('lm_dragging');\n if (this._eElement) this._eElement.removeClass('lm_dragging');\n\n if (this._destroyAfterMouseUp) this.destroy();\n }\n },\n\n _startDrag: function () {\n clearTimeout(this._timeout);\n this._bDragging = true;\n this._eBody.addClass('lm_dragging');\n this._eElement.addClass('lm_dragging');\n this._oDocument.find('iframe').css('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n },\n\n _getCoordinates: function (event) {\n event =\n event.originalEvent && event.originalEvent.touches\n ? event.originalEvent.touches[0]\n : event;\n return {\n x: event.pageX,\n y: event.pageY,\n };\n },\n});\n\nexport default DragListener;\n"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,YAAlB;AACA,OAAOC,YAAP,MAAyB,mBAAzB;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAAUC,QAAV,EAAoBC,mBAApB,EAAyC;EAC5DH,YAAY,CAACI,IAAb,CAAkB,IAAlB;EAEA,KAAKC,SAAL,GAAiBP,CAAC,CAACI,QAAD,CAAlB;EACA,KAAKI,UAAL,GAAkBR,CAAC,CAACS,QAAD,CAAnB;EACA,KAAKC,MAAL,GAAcV,CAAC,CAACS,QAAQ,CAACE,IAAV,CAAf,CAL4D,CAM5D;;EACA,KAAKC,oBAAL,GAA4BP,mBAAmB,IAAI,KAAnD;EAEA;AACF;AACA;;EACE,KAAKQ,OAAL,GAAe,GAAf;EACA,KAAKC,QAAL,GAAgB,IAAhB;EAEA;AACF;AACA;;EACE,KAAKC,UAAL,GAAkB,EAAlB,CAlB4D,CAkBtC;;EAEtB,KAAKC,GAAL,GAAW,CAAX;EACA,KAAKC,GAAL,GAAW,CAAX;EAEA,KAAKC,WAAL,GAAmB,CAAnB;EACA,KAAKC,WAAL,GAAmB,CAAnB;EAEA,KAAKC,UAAL,GAAkB,KAAlB;EAEA,KAAKC,MAAL,GAAcpB,KAAK,CAACqB,MAAN,CAAa,KAAKC,WAAlB,EAA+B,IAA/B,CAAd;EACA,KAAKC,IAAL,GAAYvB,KAAK,CAACqB,MAAN,CAAa,KAAKG,SAAlB,EAA6B,IAA7B,CAAZ;EACA,KAAKC,MAAL,GAAczB,KAAK,CAACqB,MAAN,CAAa,KA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AKA,MAAL,CAAYwC,WAAZ,CAAwB,aAAxB;MACjB,IAAI,KAAK3C,SAAT,EAAoB,KAAKA,SAAL,CAAe2C,WAAf,CAA2B,aAA3B;MAEpB,IAAI,KAAKtC,oBAAT,EAA+B,KAAKoB,OAAL;IAChC;EACF,CA3EgC;EA6EjCY,UAAU,EAAE,sBAAY;IACtBV,YAAY,CAAC,KAAKpB,QAAN,CAAZ;IACA,KAAKM,UAAL,GAAkB,IAAlB;;IACA,KAAKV,MAAL,CAAYyC,QAAZ,CAAqB,aAArB;;IACA,KAAK5C,SAAL,CAAe4C,QAAf,CAAwB,aAAxB;;IACA,KAAK3C,UAAL,CAAgBwC,IAAhB,CAAqB,QAArB,EAA+BC,GAA/B,CAAmC,gBAAnC,EAAqD,MAArD;;IACA,KAAKF,IAAL,CAAU,WAAV,EAAuB,KAAK7B,WAA5B,EAAyC,KAAKC,WAA9C;EACD,CApFgC;EAsFjCoB,eAAe,EAAE,yBAAUa,KAAV,EAAiB;IAChCA,KAAK,GACHA,KAAK,CAACC,aAAN,IAAuBD,KAAK,CAACC,aAAN,CAAoBC,OAA3C,GACIF,KAAK,CAACC,aAAN,CAAoBC,OAApB,CAA4B,CAA5B,CADJ,GAEIF,KAHN;IAIA,OAAO;MACLZ,CAAC,EAAEY,KAAK,CAACG,KADJ;MAELd,CAAC,EAAEW,KAAK,CAACI;IAFJ,CAAP;EAID;AA/FgC,CAAnC;AAkGA,eAAerD,YAAf"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import utils from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* A generic and very fast EventEmitter
|
|
4
|
+
* implementation. On top of emitting the
|
|
5
|
+
* actual event it emits an
|
|
6
|
+
*
|
|
7
|
+
* EventEmitter.ALL_EVENT
|
|
8
|
+
*
|
|
9
|
+
* event for every event triggered. This allows
|
|
10
|
+
* to hook into it and proxy events forwards
|
|
11
|
+
*
|
|
12
|
+
* @constructor
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var EventEmitter = function EventEmitter() {
|
|
16
|
+
this._mSubscriptions = {};
|
|
17
|
+
this._mSubscriptions[EventEmitter.ALL_EVENT] = [];
|
|
18
|
+
/**
|
|
19
|
+
* Listen for events
|
|
20
|
+
*
|
|
21
|
+
* @param {String} sEvent The name of the event to listen to
|
|
22
|
+
* @param {Function} fCallback The callback to execute when the event occurs
|
|
23
|
+
* @param {[Object]} oContext The value of the this pointer within the callback function
|
|
24
|
+
*
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
this.on = function (sEvent, fCallback, oContext) {
|
|
29
|
+
if (!utils.isFunction(fCallback)) {
|
|
30
|
+
throw new Error('Tried to listen to event ' + sEvent + ' with non-function callback ' + fCallback);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!this._mSubscriptions[sEvent]) {
|
|
34
|
+
this._mSubscriptions[sEvent] = [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this._mSubscriptions[sEvent].push({
|
|
38
|
+
fn: fCallback,
|
|
39
|
+
ctx: oContext
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Emit an event and notify listeners
|
|
44
|
+
*
|
|
45
|
+
* @param {String} sEvent The name of the event
|
|
46
|
+
* @param {Mixed} various additional arguments that will be passed to the listener
|
|
47
|
+
*
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
this.emit = function (sEvent) {
|
|
53
|
+
var i, ctx, args;
|
|
54
|
+
args = Array.prototype.slice.call(arguments, 1);
|
|
55
|
+
var subs = this._mSubscriptions[sEvent];
|
|
56
|
+
|
|
57
|
+
if (subs) {
|
|
58
|
+
subs = subs.slice();
|
|
59
|
+
|
|
60
|
+
for (i = 0; i < subs.length; i++) {
|
|
61
|
+
ctx = subs[i].ctx || {};
|
|
62
|
+
subs[i].fn.apply(ctx, args);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
args.unshift(sEvent);
|
|
67
|
+
|
|
68
|
+
var allEventSubs = this._mSubscriptions[EventEmitter.ALL_EVENT].slice();
|
|
69
|
+
|
|
70
|
+
for (i = 0; i < allEventSubs.length; i++) {
|
|
71
|
+
ctx = allEventSubs[i].ctx || {};
|
|
72
|
+
allEventSubs[i].fn.apply(ctx, args);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Removes a listener for an event, or all listeners if no callback and context is provided.
|
|
77
|
+
*
|
|
78
|
+
* @param {String} sEvent The name of the event
|
|
79
|
+
* @param {Function} fCallback The previously registered callback method (optional)
|
|
80
|
+
* @param {Object} oContext The previously registered context (optional)
|
|
81
|
+
*
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
this.unbind = function (sEvent, fCallback, oContext) {
|
|
87
|
+
if (!this._mSubscriptions[sEvent]) {
|
|
88
|
+
throw new Error('No subscribtions to unsubscribe for event ' + sEvent);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var i,
|
|
92
|
+
bUnbound = false;
|
|
93
|
+
|
|
94
|
+
for (i = 0; i < this._mSubscriptions[sEvent].length; i++) {
|
|
95
|
+
if ((!fCallback || this._mSubscriptions[sEvent][i].fn === fCallback) && (!oContext || oContext === this._mSubscriptions[sEvent][i].ctx)) {
|
|
96
|
+
this._mSubscriptions[sEvent].splice(i, 1);
|
|
97
|
+
|
|
98
|
+
bUnbound = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (bUnbound === false) {
|
|
103
|
+
throw new Error('Nothing to unbind for ' + sEvent);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Alias for unbind
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
this.off = this.unbind;
|
|
112
|
+
/**
|
|
113
|
+
* Alias for emit
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
this.trigger = this.emit;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The name of the event that's triggered for every other event
|
|
120
|
+
*
|
|
121
|
+
* usage
|
|
122
|
+
*
|
|
123
|
+
* myEmitter.on( EventEmitter.ALL_EVENT, function( eventName, argsArray ){
|
|
124
|
+
* //do stuff
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* @type {String}
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
EventEmitter.ALL_EVENT = '__all';
|
|
132
|
+
export default EventEmitter;
|
|
133
|
+
//# sourceMappingURL=EventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventEmitter.js","names":["utils","EventEmitter","_mSubscriptions","ALL_EVENT","on","sEvent","fCallback","oContext","isFunction","Error","push","fn","ctx","emit","i","args","Array","prototype","slice","call","arguments","subs","length","apply","unshift","allEventSubs","unbind","bUnbound","splice","off","trigger"],"sources":["../../src/utils/EventEmitter.js"],"sourcesContent":["import utils from './utils.js';\n\n/**\n * A generic and very fast EventEmitter\n * implementation. On top of emitting the\n * actual event it emits an\n *\n * EventEmitter.ALL_EVENT\n *\n * event for every event triggered. This allows\n * to hook into it and proxy events forwards\n *\n * @constructor\n */\nconst EventEmitter = function () {\n this._mSubscriptions = {};\n this._mSubscriptions[EventEmitter.ALL_EVENT] = [];\n\n /**\n * Listen for events\n *\n * @param {String} sEvent The name of the event to listen to\n * @param {Function} fCallback The callback to execute when the event occurs\n * @param {[Object]} oContext The value of the this pointer within the callback function\n *\n * @returns {void}\n */\n this.on = function (sEvent, fCallback, oContext) {\n if (!utils.isFunction(fCallback)) {\n throw new Error(\n 'Tried to listen to event ' +\n sEvent +\n ' with non-function callback ' +\n fCallback\n );\n }\n\n if (!this._mSubscriptions[sEvent]) {\n this._mSubscriptions[sEvent] = [];\n }\n\n this._mSubscriptions[sEvent].push({ fn: fCallback, ctx: oContext });\n };\n\n /**\n * Emit an event and notify listeners\n *\n * @param {String} sEvent The name of the event\n * @param {Mixed} various additional arguments that will be passed to the listener\n *\n * @returns {void}\n */\n this.emit = function (sEvent) {\n var i, ctx, args;\n\n args = Array.prototype.slice.call(arguments, 1);\n\n var subs = this._mSubscriptions[sEvent];\n\n if (subs) {\n subs = subs.slice();\n for (i = 0; i < subs.length; i++) {\n ctx = subs[i].ctx || {};\n subs[i].fn.apply(ctx, args);\n }\n }\n\n args.unshift(sEvent);\n\n var allEventSubs = this._mSubscriptions[EventEmitter.ALL_EVENT].slice();\n\n for (i = 0; i < allEventSubs.length; i++) {\n ctx = allEventSubs[i].ctx || {};\n allEventSubs[i].fn.apply(ctx, args);\n }\n };\n\n /**\n * Removes a listener for an event, or all listeners if no callback and context is provided.\n *\n * @param {String} sEvent The name of the event\n * @param {Function} fCallback The previously registered callback method (optional)\n * @param {Object} oContext The previously registered context (optional)\n *\n * @returns {void}\n */\n this.unbind = function (sEvent, fCallback, oContext) {\n if (!this._mSubscriptions[sEvent]) {\n throw new Error('No subscribtions to unsubscribe for event ' + sEvent);\n }\n\n var i,\n bUnbound = false;\n\n for (i = 0; i < this._mSubscriptions[sEvent].length; i++) {\n if (\n (!fCallback || this._mSubscriptions[sEvent][i].fn === fCallback) &&\n (!oContext || oContext === this._mSubscriptions[sEvent][i].ctx)\n ) {\n this._mSubscriptions[sEvent].splice(i, 1);\n bUnbound = true;\n }\n }\n\n if (bUnbound === false) {\n throw new Error('Nothing to unbind for ' + sEvent);\n }\n };\n\n /**\n * Alias for unbind\n */\n this.off = this.unbind;\n\n /**\n * Alias for emit\n */\n this.trigger = this.emit;\n};\n\n/**\n * The name of the event that's triggered for every other event\n *\n * usage\n *\n * myEmitter.on( EventEmitter.ALL_EVENT, function( eventName, argsArray ){\n * \t//do stuff\n * });\n *\n * @type {String}\n */\nEventEmitter.ALL_EVENT = '__all';\n\nexport default EventEmitter;\n"],"mappings":"AAAA,OAAOA,KAAP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AArB,EAA6BuB,MAA7B,CAAoCd,CAApC,EAAuC,CAAvC;;QACAa,QAAQ,GAAG,IAAX;MACD;IACF;;IAED,IAAIA,QAAQ,KAAK,KAAjB,EAAwB;MACtB,MAAM,IAAIlB,KAAJ,CAAU,2BAA2BJ,MAArC,CAAN;IACD;EACF,CArBD;EAuBA;AACF;AACA;;;EACE,KAAKwB,GAAL,GAAW,KAAKH,MAAhB;EAEA;AACF;AACA;;EACE,KAAKI,OAAL,GAAe,KAAKjB,IAApB;AACD,CAxGD;AA0GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACAZ,YAAY,CAACE,SAAb,GAAyB,OAAzB;AAEA,eAAeF,YAAf"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import utils from './utils.js';
|
|
3
|
+
import EventEmitter from './EventEmitter.js';
|
|
4
|
+
/**
|
|
5
|
+
* An EventEmitter singleton that propagates events
|
|
6
|
+
* across multiple windows. This is a little bit trickier since
|
|
7
|
+
* windows are allowed to open childWindows in their own right
|
|
8
|
+
*
|
|
9
|
+
* This means that we deal with a tree of windows. Hence the rules for event propagation are:
|
|
10
|
+
*
|
|
11
|
+
* - Propagate events from this layout to both parents and children
|
|
12
|
+
* - Propagate events from parent to this and children
|
|
13
|
+
* - Propagate events from children to the other children (but not the emitting one) and the parent
|
|
14
|
+
*
|
|
15
|
+
* @constructor
|
|
16
|
+
*
|
|
17
|
+
* @param {lm.LayoutManager} layoutManager
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
var EventHub = function EventHub(layoutManager) {
|
|
21
|
+
EventEmitter.call(this);
|
|
22
|
+
this._layoutManager = layoutManager;
|
|
23
|
+
this._dontPropagateToParent = null;
|
|
24
|
+
this._childEventSource = null;
|
|
25
|
+
this.on(EventEmitter.ALL_EVENT, utils.fnBind(this._onEventFromThis, this));
|
|
26
|
+
this._boundOnEventFromChild = utils.fnBind(this._onEventFromChild, this);
|
|
27
|
+
$(window).on('gl_child_event', this._boundOnEventFromChild);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Called on every event emitted on this eventHub, regardles of origin.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*
|
|
34
|
+
* @param {Mixed}
|
|
35
|
+
*
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
EventHub.prototype._onEventFromThis = function () {
|
|
41
|
+
var args = Array.prototype.slice.call(arguments);
|
|
42
|
+
|
|
43
|
+
if (this._layoutManager.isSubWindow && args[0] !== this._dontPropagateToParent) {
|
|
44
|
+
this._propagateToParent(args);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this._propagateToChildren(args); //Reset
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
this._dontPropagateToParent = null;
|
|
51
|
+
this._childEventSource = null;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Called by the parent layout.
|
|
55
|
+
*
|
|
56
|
+
* @param {Array} args Event name + arguments
|
|
57
|
+
*
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
EventHub.prototype._$onEventFromParent = function (args) {
|
|
63
|
+
this._dontPropagateToParent = args[0];
|
|
64
|
+
this.emit.apply(this, args);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Callback for child events raised on the window
|
|
68
|
+
*
|
|
69
|
+
* @param {DOMEvent} event
|
|
70
|
+
* @private
|
|
71
|
+
*
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
EventHub.prototype._onEventFromChild = function (event) {
|
|
77
|
+
this._childEventSource = event.originalEvent.__gl;
|
|
78
|
+
this.emit.apply(this, event.originalEvent.__glArgs);
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Propagates the event to the parent by emitting
|
|
82
|
+
* it on the parent's DOM window
|
|
83
|
+
*
|
|
84
|
+
* @param {Array} args Event name + arguments
|
|
85
|
+
* @private
|
|
86
|
+
*
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
EventHub.prototype._propagateToParent = function (args) {
|
|
92
|
+
var event,
|
|
93
|
+
eventName = 'gl_child_event';
|
|
94
|
+
|
|
95
|
+
if (document.createEvent) {
|
|
96
|
+
event = window.opener.document.createEvent('HTMLEvents');
|
|
97
|
+
event.initEvent(eventName, true, true);
|
|
98
|
+
} else {
|
|
99
|
+
event = window.opener.document.createEventObject();
|
|
100
|
+
event.eventType = eventName;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
event.eventName = eventName;
|
|
104
|
+
event.__glArgs = args;
|
|
105
|
+
event.__gl = this._layoutManager;
|
|
106
|
+
|
|
107
|
+
if (document.createEvent) {
|
|
108
|
+
window.opener.dispatchEvent(event);
|
|
109
|
+
} else {
|
|
110
|
+
window.opener.fireEvent('on' + event.eventType, event);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Propagate events to children
|
|
115
|
+
*
|
|
116
|
+
* @param {Array} args Event name + arguments
|
|
117
|
+
* @private
|
|
118
|
+
*
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
EventHub.prototype._propagateToChildren = function (args) {
|
|
124
|
+
var childGl, i;
|
|
125
|
+
|
|
126
|
+
for (i = 0; i < this._layoutManager.openPopouts.length; i++) {
|
|
127
|
+
childGl = this._layoutManager.openPopouts[i].getGlInstance();
|
|
128
|
+
|
|
129
|
+
if (childGl && childGl !== this._childEventSource) {
|
|
130
|
+
childGl.eventHub._$onEventFromParent(args);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Destroys the EventHub
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* @returns {void}
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
EventHub.prototype.destroy = function () {
|
|
143
|
+
$(window).off('gl_child_event', this._boundOnEventFromChild);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export default EventHub;
|
|
147
|
+
//# sourceMappingURL=EventHub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHub.js","names":["$","utils","EventEmitter","EventHub","layoutManager","call","_layoutManager","_dontPropagateToParent","_childEventSource","on","ALL_EVENT","fnBind","_onEventFromThis","_boundOnEventFromChild","_onEventFromChild","window","prototype","args","Array","slice","arguments","isSubWindow","_propagateToParent","_propagateToChildren","_$onEventFromParent","emit","apply","event","originalEvent","__gl","__glArgs","eventName","document","createEvent","opener","initEvent","createEventObject","eventType","dispatchEvent","fireEvent","childGl","i","openPopouts","length","getGlInstance","eventHub","destroy","off"],"sources":["../../src/utils/EventHub.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from './utils.js';\nimport EventEmitter from './EventEmitter.js';\n\n/**\n * An EventEmitter singleton that propagates events\n * across multiple windows. This is a little bit trickier since\n * windows are allowed to open childWindows in their own right\n *\n * This means that we deal with a tree of windows. Hence the rules for event propagation are:\n *\n * - Propagate events from this layout to both parents and children\n * - Propagate events from parent to this and children\n * - Propagate events from children to the other children (but not the emitting one) and the parent\n *\n * @constructor\n *\n * @param {lm.LayoutManager} layoutManager\n */\nconst EventHub = function (layoutManager) {\n EventEmitter.call(this);\n this._layoutManager = layoutManager;\n this._dontPropagateToParent = null;\n this._childEventSource = null;\n this.on(EventEmitter.ALL_EVENT, utils.fnBind(this._onEventFromThis, this));\n this._boundOnEventFromChild = utils.fnBind(this._onEventFromChild, this);\n $(window).on('gl_child_event', this._boundOnEventFromChild);\n};\n\n/**\n * Called on every event emitted on this eventHub, regardles of origin.\n *\n * @private\n *\n * @param {Mixed}\n *\n * @returns {void}\n */\nEventHub.prototype._onEventFromThis = function () {\n var args = Array.prototype.slice.call(arguments);\n\n if (\n this._layoutManager.isSubWindow &&\n args[0] !== this._dontPropagateToParent\n ) {\n this._propagateToParent(args);\n }\n this._propagateToChildren(args);\n\n //Reset\n this._dontPropagateToParent = null;\n this._childEventSource = null;\n};\n\n/**\n * Called by the parent layout.\n *\n * @param {Array} args Event name + arguments\n *\n * @returns {void}\n */\nEventHub.prototype._$onEventFromParent = function (args) {\n this._dontPropagateToParent = args[0];\n this.emit.apply(this, args);\n};\n\n/**\n * Callback for child events raised on the window\n *\n * @param {DOMEvent} event\n * @private\n *\n * @returns {void}\n */\nEventHub.prototype._onEventFromChild = function (event) {\n this._childEventSource = event.originalEvent.__gl;\n this.emit.apply(this, event.originalEvent.__glArgs);\n};\n\n/**\n * Propagates the event to the parent by emitting\n * it on the parent's DOM window\n *\n * @param {Array} args Event name + arguments\n * @private\n *\n * @returns {void}\n */\nEventHub.prototype._propagateToParent = function (args) {\n var event,\n eventName = 'gl_child_event';\n\n if (document.createEvent) {\n event = window.opener.document.createEvent('HTMLEvents');\n event.initEvent(eventName, true, true);\n } else {\n event = window.opener.document.createEventObject();\n event.eventType = eventName;\n }\n\n event.eventName = eventName;\n event.__glArgs = args;\n event.__gl = this._layoutManager;\n\n if (document.createEvent) {\n window.opener.dispatchEvent(event);\n } else {\n window.opener.fireEvent('on' + event.eventType, event);\n }\n};\n\n/**\n * Propagate events to children\n *\n * @param {Array} args Event name + arguments\n * @private\n *\n * @returns {void}\n */\nEventHub.prototype._propagateToChildren = function (args) {\n var childGl, i;\n\n for (i = 0; i < this._layoutManager.openPopouts.length; i++) {\n childGl = this._layoutManager.openPopouts[i].getGlInstance();\n\n if (childGl && childGl !== this._childEventSource) {\n childGl.eventHub._$onEventFromParent(args);\n }\n }\n};\n\n/**\n * Destroys the EventHub\n *\n * @public\n * @returns {void}\n */\n\nEventHub.prototype.destroy = function () {\n $(window).off('gl_child_event', this._boundOnEventFromChild);\n};\n\nexport default EventHub;\n"],"mappings":"AAAA,OA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