@holoviz/panel 1.0.0-b.17 → 1.0.0-b.18
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/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/contextmenu/jspanel.contextmenu.js +137 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/dock/jspanel.dock.js +266 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/hint/jspanel.hint.js +43 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/layout/jspanel.layout.js +187 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/modal/jspanel.modal.js +108 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/tooltip/jspanel.tooltip.js +348 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/jspanel.css +653 -0
- package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/jspanel.js +5807 -0
- package/dist/bundled/notificationarea/panel/1.0.0-b.18/dist/bundled/font-awesome/css/all.min.css +2 -0
- package/dist/bundled/panel/1.0.0-b.18/dist/bundled/bootstrap5/css/bootstrap.min.css +2 -0
- package/dist/bundled/panel/1.0.0-b.18/dist/bundled/bootstrap5/js/bootstrap.bundle.min.js +2 -0
- package/dist/bundled/panel/1.0.0-b.18/dist/bundled/font-awesome/css/all.min.css +2 -0
- package/dist/bundled/panel/1.0.0-b.18/dist/bundled/jquery/jquery.slim.min.js +2 -0
- package/dist/bundled/plotlyplot/panel/1.0.0-b.18/dist/bundled/jquery/jquery.slim.min.js +2 -0
- package/dist/bundled/theme/default.css +2 -2
- package/dist/lib/models/reactive_html.d.ts +1 -0
- package/dist/lib/models/reactive_html.js +3 -0
- package/dist/lib/models/reactive_html.js.map +1 -1
- package/dist/panel.js +6 -3
- package/dist/panel.js.map +1 -1
- package/dist/panel.json +1 -1
- package/dist/panel.min.js +3 -3
- package/dist/wheels/{panel-1.0.0b17-py3-none-any.whl → panel-1.0.0b18-py3-none-any.whl} +0 -0
- package/package.json +1 -1
- package/dist/bundled/notificationarea/panel/1.0.0-b.17/dist/bundled/font-awesome/css/all.min.css +0 -2
- package/dist/bundled/panel/1.0.0-b.17/dist/bundled/bootstrap5/css/bootstrap.min.css +0 -2
- package/dist/bundled/panel/1.0.0-b.17/dist/bundled/bootstrap5/js/bootstrap.bundle.min.js +0 -2
- package/dist/bundled/panel/1.0.0-b.17/dist/bundled/font-awesome/css/all.min.css +0 -2
- package/dist/bundled/panel/1.0.0-b.17/dist/bundled/jquery/jquery.slim.min.js +0 -2
- package/dist/bundled/plotlyplot/panel/1.0.0-b.17/dist/bundled/jquery/jquery.slim.min.js +0 -2
package/dist/bundled/floatpanel/jspanel4@4.12.0/dist/extensions/contextmenu/jspanel.contextmenu.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
|
|
3
|
+
* @version v4.12.0
|
|
4
|
+
* @homepage https://jspanel.de/
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @author Stefan Sträßer - info@jspanel.de
|
|
7
|
+
* @github https://github.com/Flyer53/jsPanel4.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
if (!jsPanel.contextmenu) {
|
|
12
|
+
jsPanel.contextmenu = {
|
|
13
|
+
version: '1.2.0',
|
|
14
|
+
date: '2021-01-13 10:40',
|
|
15
|
+
defaults: {
|
|
16
|
+
//position: is set in jsPanel.contextmenu.create()
|
|
17
|
+
//container: is set in jsPanel.contextmenu.create()
|
|
18
|
+
dragit: false,
|
|
19
|
+
resizeit: false,
|
|
20
|
+
header: false,
|
|
21
|
+
headerControls: 'none',
|
|
22
|
+
closeOnMouseleave: true
|
|
23
|
+
},
|
|
24
|
+
cmOverflow: function cmOverflow(elmt) {
|
|
25
|
+
var cltX = elmt.cmEvent.clientX,
|
|
26
|
+
cltY = elmt.cmEvent.clientY,
|
|
27
|
+
panelW = elmt.offsetWidth,
|
|
28
|
+
panelH = elmt.offsetHeight,
|
|
29
|
+
corrLeft = window.innerWidth - (cltX + panelW),
|
|
30
|
+
corrTop = window.innerHeight - (cltY + panelH);
|
|
31
|
+
|
|
32
|
+
if (corrLeft < 0) {
|
|
33
|
+
elmt.style.left = cltX + (window.scrollX || window.pageXOffset) - panelW + 'px';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (corrTop < 0) {
|
|
37
|
+
elmt.style.top = cltY + (window.scrollY || window.pageYOffset) - panelH + 'px';
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
create: function create() {
|
|
41
|
+
var _this = this;
|
|
42
|
+
|
|
43
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
44
|
+
var evt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contextmenu';
|
|
45
|
+
options.paneltype = 'contextmenu';
|
|
46
|
+
var target = options.target;
|
|
47
|
+
|
|
48
|
+
if (!target) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof target === 'string') {
|
|
53
|
+
target = document.querySelector(target);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
target.addEventListener(evt, function (e) {
|
|
57
|
+
e.preventDefault(); // close all contextmenus first
|
|
58
|
+
|
|
59
|
+
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {
|
|
60
|
+
item.close();
|
|
61
|
+
});
|
|
62
|
+
var l = (e.pageX || e.touches[0].pageX) + 'px',
|
|
63
|
+
t = (e.pageY || e.touches[0].pageY) + 'px',
|
|
64
|
+
opts = options;
|
|
65
|
+
|
|
66
|
+
if (options.config) {
|
|
67
|
+
opts = Object.assign({}, options.config, options);
|
|
68
|
+
delete opts.config;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
opts = Object.assign({}, _this.defaults, opts, {
|
|
72
|
+
position: false,
|
|
73
|
+
container: 'body'
|
|
74
|
+
});
|
|
75
|
+
jsPanel.create(opts, function (cm) {
|
|
76
|
+
jsPanel.setStyle(cm, {
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
left: l,
|
|
79
|
+
top: t
|
|
80
|
+
}); // check whether contextmenu is triggered from within a modal panel or panel and if so update z-index
|
|
81
|
+
|
|
82
|
+
var closestModal = target.closest('.jsPanel-modal');
|
|
83
|
+
|
|
84
|
+
if (closestModal) {
|
|
85
|
+
cm.style.zIndex = closestModal.style.zIndex;
|
|
86
|
+
} else {
|
|
87
|
+
var closestPanel = target.closest('.jsPanel');
|
|
88
|
+
|
|
89
|
+
if (closestPanel) {
|
|
90
|
+
closestPanel.front();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
cm.style.zIndex = jsPanel.zi.next();
|
|
94
|
+
} // save event object as property of cm outer div (needed in checkContextmenuOverflow())
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
cm.cmEvent = e; // update left/top values if menu overflows browser viewport
|
|
98
|
+
|
|
99
|
+
jsPanel.contextmenu.cmOverflow(cm);
|
|
100
|
+
|
|
101
|
+
if (opts.closeOnMouseleave) {
|
|
102
|
+
cm.addEventListener('mouseleave', function () {
|
|
103
|
+
cm.close();
|
|
104
|
+
}, false);
|
|
105
|
+
} // don't close contextmenu on mousedown in contextmenu
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
jsPanel.pointerdown.forEach(function (evt) {
|
|
109
|
+
cm.addEventListener(evt, function (e) {
|
|
110
|
+
e.stopPropagation();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}, false);
|
|
115
|
+
}
|
|
116
|
+
}; // add overflow check to jsPanel.contentAjax always callback
|
|
117
|
+
|
|
118
|
+
jsPanel.ajaxAlwaysCallbacks.push(function (xhr, obj) {
|
|
119
|
+
if (obj && obj.classList && obj.classList.contains('jsPanel-contextmenu')) {
|
|
120
|
+
jsPanel.contextmenu.cmOverflow(obj);
|
|
121
|
+
}
|
|
122
|
+
}); // close tooltips on pointerdown in document
|
|
123
|
+
|
|
124
|
+
jsPanel.pointerdown.forEach(function (evt) {
|
|
125
|
+
document.addEventListener(evt, function (e) {
|
|
126
|
+
document.querySelectorAll('.jsPanel-contextmenu').forEach(function (item) {
|
|
127
|
+
if (!e.target.closest('.jsPanel-contextmenu')) {
|
|
128
|
+
item.close();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}, false);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Add CommonJS module exports, so it can be imported using require() in Node.js
|
|
136
|
+
// https://nodejs.org/docs/latest/api/modules.html
|
|
137
|
+
if (typeof module !== 'undefined') { module.exports = jsPanel; }
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
|
|
3
|
+
* @version v4.12.0
|
|
4
|
+
* @homepage https://jspanel.de/
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @author Stefan Sträßer - info@jspanel.de
|
|
7
|
+
* @github https://github.com/Flyer53/jsPanel4.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
if (!jsPanel.dock) {
|
|
12
|
+
jsPanel.dock = {
|
|
13
|
+
version: '1.1.3',
|
|
14
|
+
date: '2020-06-04 08:38',
|
|
15
|
+
defaults: {
|
|
16
|
+
position: {
|
|
17
|
+
my: 'left-top',
|
|
18
|
+
at: 'right-top'
|
|
19
|
+
},
|
|
20
|
+
linkSlaveHeight: false,
|
|
21
|
+
linkSlaveWidth: false,
|
|
22
|
+
callback: false
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var dockPanel = function dockPanel(config) {
|
|
27
|
+
var master,
|
|
28
|
+
slave = this; // this refers to slave panel
|
|
29
|
+
|
|
30
|
+
this.slaveconfig = Object.assign({}, jsPanel.dock.defaults, config);
|
|
31
|
+
|
|
32
|
+
if (this.slaveconfig.master && this.slaveconfig.master.nodeType === 1) {
|
|
33
|
+
master = this.slaveconfig.master;
|
|
34
|
+
} else {
|
|
35
|
+
master = document.querySelector(this.slaveconfig.master);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!master) {
|
|
39
|
+
// if master does not exist show error panel return false
|
|
40
|
+
if (this.errorReporting) {
|
|
41
|
+
var err = '◀ COULD NOT DOCK PANEL ►<br>The configured master panel to does not exist';
|
|
42
|
+
jsPanel.errorpanel(err);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return false;
|
|
46
|
+
} else {
|
|
47
|
+
if (!master.slaves) {
|
|
48
|
+
master.slaves = new Set();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!master.handlers) {
|
|
52
|
+
master.handlers = {};
|
|
53
|
+
} // set interactions between master and slaves
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if (!master.handlers.fronted) {
|
|
57
|
+
master.options.onfronted.push(function () {
|
|
58
|
+
var zI = master.style.zIndex;
|
|
59
|
+
master.slaves.forEach(function (sl) {
|
|
60
|
+
sl.style.zIndex = zI;
|
|
61
|
+
});
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
master.handlers.fronted = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!master.handlers.smallified) {
|
|
68
|
+
master.options.onsmallified.push(function () {
|
|
69
|
+
master.slaves.forEach(function (sl) {
|
|
70
|
+
sl.smallify().reposition();
|
|
71
|
+
});
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
master.handlers.smallified = true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!master.handlers.unsmallified) {
|
|
78
|
+
master.options.onunsmallified.push(function () {
|
|
79
|
+
master.slaves.forEach(function (sl) {
|
|
80
|
+
sl.unsmallify().reposition();
|
|
81
|
+
});
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
84
|
+
master.handlers.unsmallified = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!master.handlers.closed) {
|
|
88
|
+
master.options.onclosed.push(function () {
|
|
89
|
+
master.slaves.forEach(function (sl) {
|
|
90
|
+
sl.close();
|
|
91
|
+
});
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
master.handlers.closed = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!master.handlers.minimized) {
|
|
98
|
+
master.options.onminimized.push(function () {
|
|
99
|
+
master.slaves.forEach(function (sl) {
|
|
100
|
+
sl.minimize();
|
|
101
|
+
});
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
master.handlers.minimized = true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!master.handlers.maximized) {
|
|
108
|
+
master.options.onmaximized.push(function () {
|
|
109
|
+
master.slaves.forEach(function (sl) {
|
|
110
|
+
sl.normalize();
|
|
111
|
+
|
|
112
|
+
if (sl.slaveconfig.linkSlaveHeight) {
|
|
113
|
+
var height = window.getComputedStyle(master).height;
|
|
114
|
+
sl.resize({
|
|
115
|
+
height: height
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (sl.slaveconfig.linkSlaveWidth) {
|
|
120
|
+
var width = window.getComputedStyle(master).width;
|
|
121
|
+
sl.resize({
|
|
122
|
+
width: width
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
sl.reposition();
|
|
127
|
+
});
|
|
128
|
+
return true;
|
|
129
|
+
});
|
|
130
|
+
master.handlers.maximized = true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!master.handlers.normalized) {
|
|
134
|
+
master.options.onnormalized.push(function () {
|
|
135
|
+
master.slaves.forEach(function (sl) {
|
|
136
|
+
sl.normalize();
|
|
137
|
+
|
|
138
|
+
if (sl.slaveconfig.linkSlaveHeight) {
|
|
139
|
+
var height = window.getComputedStyle(master).height;
|
|
140
|
+
sl.resize({
|
|
141
|
+
height: height
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (sl.slaveconfig.linkSlaveWidth) {
|
|
146
|
+
var width = window.getComputedStyle(master).width;
|
|
147
|
+
sl.resize({
|
|
148
|
+
width: width
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
sl.reposition();
|
|
153
|
+
});
|
|
154
|
+
return true;
|
|
155
|
+
});
|
|
156
|
+
master.handlers.normalized = true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var position = Object.assign({}, this.slaveconfig.position, {
|
|
161
|
+
of: master,
|
|
162
|
+
minLeft: false,
|
|
163
|
+
minTop: false,
|
|
164
|
+
maxLeft: false,
|
|
165
|
+
maxTop: false,
|
|
166
|
+
autoposition: false,
|
|
167
|
+
modify: false
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (!position.my) {
|
|
171
|
+
position.my = jsPanel.dock.defaults.position.my;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!position.at) {
|
|
175
|
+
position.at = jsPanel.dock.defaults.position.at;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
slave.options.position = position;
|
|
179
|
+
['smallify', 'minimize', 'normalize', 'maximize'].forEach(function (ctrl) {
|
|
180
|
+
slave.setControlStatus(ctrl, 'remove');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if (this.slaveconfig.linkSlaveHeight) {
|
|
184
|
+
var height = window.getComputedStyle(master).height;
|
|
185
|
+
slave.resize({
|
|
186
|
+
height: height
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (this.slaveconfig.linkSlaveWidth) {
|
|
191
|
+
var width = window.getComputedStyle(master).width;
|
|
192
|
+
slave.resize({
|
|
193
|
+
width: width
|
|
194
|
+
});
|
|
195
|
+
} // position slave
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
slave.reposition(position); // set necessary slave panel options
|
|
199
|
+
|
|
200
|
+
slave.dragit('disable');
|
|
201
|
+
slave.resizeit('disable');
|
|
202
|
+
slave.options.minimizeTo = false; // remove slave from master.slaves Set when slave is closed
|
|
203
|
+
|
|
204
|
+
slave.options.onclosed.push(function () {
|
|
205
|
+
master.slaves["delete"](slave);
|
|
206
|
+
});
|
|
207
|
+
slave.options.onfronted.push(function (panel) {
|
|
208
|
+
var zI = panel.style.zIndex;
|
|
209
|
+
master.style.zIndex = zI;
|
|
210
|
+
master.slaves.forEach(function (sl) {
|
|
211
|
+
sl.style.zIndex = zI;
|
|
212
|
+
});
|
|
213
|
+
}); // set necessary master options
|
|
214
|
+
|
|
215
|
+
master.reposSlave = function () {
|
|
216
|
+
if (document.querySelector('#' + slave.id)) {
|
|
217
|
+
slave.reposition();
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
if (master.options.dragit) {
|
|
222
|
+
master.options.dragit.drag.push(master.reposSlave);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
master.resizeSlave = function () {
|
|
226
|
+
if (document.querySelector('#' + slave.id)) {
|
|
227
|
+
slave.reposition();
|
|
228
|
+
|
|
229
|
+
if (slave.slaveconfig.linkSlaveHeight) {
|
|
230
|
+
var h = window.getComputedStyle(master).height;
|
|
231
|
+
slave.resize({
|
|
232
|
+
height: h
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (slave.slaveconfig.linkSlaveWidth) {
|
|
237
|
+
var w = window.getComputedStyle(master).width;
|
|
238
|
+
slave.resize({
|
|
239
|
+
width: w
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
if (master.options.resizeit) {
|
|
246
|
+
master.options.resizeit.resize.push(master.resizeSlave);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
master.slaves.add(slave);
|
|
250
|
+
slave.dockedTo = master.id;
|
|
251
|
+
|
|
252
|
+
if (this.slaveconfig.callback) {
|
|
253
|
+
this.slaveconfig.callback.call(slave, master, slave);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return slave;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
jsPanel.extend({
|
|
260
|
+
dock: dockPanel
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Add CommonJS module exports, so it can be imported using require() in Node.js
|
|
265
|
+
// https://nodejs.org/docs/latest/api/modules.html
|
|
266
|
+
if (typeof module !== 'undefined') { module.exports = jsPanel; }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
|
|
3
|
+
* @version v4.12.0
|
|
4
|
+
* @homepage https://jspanel.de/
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @author Stefan Sträßer - info@jspanel.de
|
|
7
|
+
* @github https://github.com/Flyer53/jsPanel4.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
if (!jsPanel.hint) {
|
|
12
|
+
jsPanel.hint = {
|
|
13
|
+
version: '1.2.3',
|
|
14
|
+
date: '2019-05-18 10:50',
|
|
15
|
+
defaults: {
|
|
16
|
+
autoclose: true,
|
|
17
|
+
dragit: false,
|
|
18
|
+
resizeit: false,
|
|
19
|
+
headerControls: 'closeonly xs'
|
|
20
|
+
},
|
|
21
|
+
create: function create() {
|
|
22
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
|
+
options.paneltype = 'hint';
|
|
24
|
+
var opts = options;
|
|
25
|
+
|
|
26
|
+
if (options.config) {
|
|
27
|
+
opts = Object.assign({}, options.config, options);
|
|
28
|
+
delete opts.config;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
opts = Object.assign({}, this.defaults, opts);
|
|
32
|
+
return jsPanel.create(opts, function (hint) {
|
|
33
|
+
hint.style.zIndex = 9999;
|
|
34
|
+
hint.header.style.cursor = 'default';
|
|
35
|
+
hint.footer.style.cursor = 'default';
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Add CommonJS module exports, so it can be imported using require() in Node.js
|
|
42
|
+
// https://nodejs.org/docs/latest/api/modules.html
|
|
43
|
+
if (typeof module !== 'undefined') { module.exports = jsPanel; }
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jsPanel - A JavaScript library to create highly configurable multifunctional floating panels that can also be used as modal, tooltip, hint or contextmenu
|
|
3
|
+
* @version v4.12.0
|
|
4
|
+
* @homepage https://jspanel.de/
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @author Stefan Sträßer - info@jspanel.de
|
|
7
|
+
* @github https://github.com/Flyer53/jsPanel4.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
12
|
+
|
|
13
|
+
if (!jsPanel.layout) {
|
|
14
|
+
jsPanel.layout = {
|
|
15
|
+
version: '1.4.1',
|
|
16
|
+
date: '2021-01-19 10:50',
|
|
17
|
+
storage: localStorage,
|
|
18
|
+
save: function save() {
|
|
19
|
+
var saveConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
|
+
var selector = saveConfig.selector ? saveConfig.selector : '.jsPanel-standard';
|
|
21
|
+
var storageName = saveConfig.storagename ? saveConfig.storagename : 'jspanels';
|
|
22
|
+
var collection = document.querySelectorAll(selector);
|
|
23
|
+
var panels = [];
|
|
24
|
+
collection.forEach(function (item) {
|
|
25
|
+
var panelData = item.currentData;
|
|
26
|
+
panelData.status = item.status;
|
|
27
|
+
panelData.zIndex = item.style.zIndex;
|
|
28
|
+
panelData.id = item.id;
|
|
29
|
+
panelData.data = item.options.data || undefined;
|
|
30
|
+
panels.push(panelData);
|
|
31
|
+
});
|
|
32
|
+
panels.sort(function (a, b) {
|
|
33
|
+
return a.zIndex - b.zIndex;
|
|
34
|
+
});
|
|
35
|
+
this.storage.removeItem(storageName);
|
|
36
|
+
var storedData = JSON.stringify(panels);
|
|
37
|
+
this.storage.setItem(storageName, storedData);
|
|
38
|
+
return storedData;
|
|
39
|
+
},
|
|
40
|
+
getAll: function getAll() {
|
|
41
|
+
var storagename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'jspanels';
|
|
42
|
+
|
|
43
|
+
if (this.storage[storagename]) {
|
|
44
|
+
return JSON.parse(this.storage[storagename]);
|
|
45
|
+
} else {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
getDataset: function getDataset(value) {
|
|
50
|
+
var attr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
|
51
|
+
var storagename = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'jspanels';
|
|
52
|
+
var findall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
53
|
+
|
|
54
|
+
if (this.storage[storagename]) {
|
|
55
|
+
var datasets = this.getAll(storagename),
|
|
56
|
+
set; // findall true will return an array with all matches or at least an empty array
|
|
57
|
+
|
|
58
|
+
if (findall) {
|
|
59
|
+
set = [];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
datasets.forEach(function (item) {
|
|
63
|
+
var type = _typeof(item[attr]);
|
|
64
|
+
|
|
65
|
+
if (type === 'string' || type === 'number') {
|
|
66
|
+
if (item[attr] === value) {
|
|
67
|
+
if (!set) {
|
|
68
|
+
set = item;
|
|
69
|
+
} else {
|
|
70
|
+
set.push(item);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} else if (Array.isArray(item[attr])) {
|
|
74
|
+
if (item[attr].includes(value)) {
|
|
75
|
+
if (!set) {
|
|
76
|
+
set = item;
|
|
77
|
+
} else {
|
|
78
|
+
set.push(item);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} else if (_typeof(item[attr]) === 'object') {
|
|
82
|
+
for (var prop in item[attr]) {
|
|
83
|
+
if (item[attr][prop] === value) {
|
|
84
|
+
if (!set) {
|
|
85
|
+
set = item;
|
|
86
|
+
break;
|
|
87
|
+
} else {
|
|
88
|
+
set.push(item);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return set ? set : false;
|
|
95
|
+
} else {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
restoreId: function restoreId() {
|
|
100
|
+
var restoreConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
101
|
+
var id, config, storageName;
|
|
102
|
+
|
|
103
|
+
if (!restoreConfig.id || !restoreConfig.config) {
|
|
104
|
+
// eslint-disable-next-line no-console
|
|
105
|
+
console.error('Id or predefined panel configuration is missing!');
|
|
106
|
+
return false;
|
|
107
|
+
} else {
|
|
108
|
+
id = restoreConfig.id;
|
|
109
|
+
config = restoreConfig.config;
|
|
110
|
+
storageName = restoreConfig.storagename ? restoreConfig.storagename : 'jspanels';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var storedpanel = this.getDataset(id, 'id', storageName);
|
|
114
|
+
|
|
115
|
+
if (storedpanel) {
|
|
116
|
+
var savedConfig = {
|
|
117
|
+
id: storedpanel.id,
|
|
118
|
+
panelSize: {
|
|
119
|
+
width: storedpanel.width,
|
|
120
|
+
height: storedpanel.height
|
|
121
|
+
},
|
|
122
|
+
position: "left-top ".concat(storedpanel.left, " ").concat(storedpanel.top),
|
|
123
|
+
zIndex: storedpanel.zIndex
|
|
124
|
+
};
|
|
125
|
+
var useConfig = Object.assign({}, config, savedConfig);
|
|
126
|
+
return jsPanel.create(useConfig, function (panel) {
|
|
127
|
+
panel.style.zIndex = savedConfig.zIndex;
|
|
128
|
+
panel.saveCurrentDimensions();
|
|
129
|
+
panel.saveCurrentPosition();
|
|
130
|
+
panel.calcSizeFactors(); // don't put code below in savedConfig.setStatus
|
|
131
|
+
|
|
132
|
+
if (storedpanel.status !== 'normalized') {
|
|
133
|
+
if (storedpanel.status === 'minimized') {
|
|
134
|
+
panel.minimize();
|
|
135
|
+
} else if (storedpanel.status === 'maximized') {
|
|
136
|
+
panel.maximize();
|
|
137
|
+
} else if (storedpanel.status === 'smallified') {
|
|
138
|
+
panel.smallify();
|
|
139
|
+
} else if (storedpanel.status === 'smallifiedmax') {
|
|
140
|
+
panel.maximize().smallify();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
restore: function restore() {
|
|
147
|
+
var restoreConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
148
|
+
var predefinedConfigs, storageName;
|
|
149
|
+
|
|
150
|
+
if (!restoreConfig.configs) {
|
|
151
|
+
// eslint-disable-next-line no-console
|
|
152
|
+
console.error('Object with predefined panel configurations is missing!');
|
|
153
|
+
return false;
|
|
154
|
+
} else {
|
|
155
|
+
predefinedConfigs = restoreConfig.configs;
|
|
156
|
+
storageName = restoreConfig.storagename ? restoreConfig.storagename : 'jspanels';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (this.storage[storageName]) {
|
|
160
|
+
var storedPanels = this.getAll(storageName); // loop over all panels in storageName
|
|
161
|
+
|
|
162
|
+
storedPanels.forEach(function (item) {
|
|
163
|
+
var pId = item.id; // loop over predefined configs to find config with pId
|
|
164
|
+
// this makes it unnecessary that identifiers for a certain config is the same as id in config
|
|
165
|
+
|
|
166
|
+
for (var conf in predefinedConfigs) {
|
|
167
|
+
if (Object.prototype.hasOwnProperty.call(predefinedConfigs, conf)) {
|
|
168
|
+
if (predefinedConfigs[conf].id === pId) {
|
|
169
|
+
jsPanel.layout.restoreId({
|
|
170
|
+
id: pId,
|
|
171
|
+
config: predefinedConfigs[conf],
|
|
172
|
+
storagename: storageName
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Add CommonJS module exports, so it can be imported using require() in Node.js
|
|
186
|
+
// https://nodejs.org/docs/latest/api/modules.html
|
|
187
|
+
if (typeof module !== 'undefined') { module.exports = jsPanel; }
|