jsuites 4.12.9 → 4.13.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/jsuites.basic.js +354 -345
- package/dist/jsuites.js +354 -345
- package/package.json +1 -1
package/dist/jsuites.basic.js
CHANGED
|
@@ -15,14 +15,17 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
var Version = '4.13.0';
|
|
19
|
+
|
|
20
|
+
var Events = function() {
|
|
21
21
|
|
|
22
22
|
var find = function(DOMElement, component) {
|
|
23
23
|
if (DOMElement[component.type] && DOMElement[component.type] == component) {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
|
+
if (DOMElement.component && DOMElement.component == component) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
26
29
|
if (DOMElement.parentNode) {
|
|
27
30
|
return find(DOMElement.parentNode, component);
|
|
28
31
|
}
|
|
@@ -30,7 +33,7 @@ var jSuites = function(options) {
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
var isOpened = function(e) {
|
|
33
|
-
if (jSuites.current.length > 0) {
|
|
36
|
+
if (jSuites.current && jSuites.current.length > 0) {
|
|
34
37
|
for (var i = 0; i < jSuites.current.length; i++) {
|
|
35
38
|
if (jSuites.current[i] && ! find(e, jSuites.current[i])) {
|
|
36
39
|
jSuites.current[i].close();
|
|
@@ -39,428 +42,430 @@ var jSuites = function(options) {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var cornerSize = 15;
|
|
45
|
+
// Width of the border
|
|
46
|
+
var cornerSize = 15;
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
// Current element
|
|
49
|
+
var element = null;
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
// Controllers
|
|
52
|
+
var editorAction = false;
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
// Event state
|
|
55
|
+
var state = {
|
|
56
|
+
x: null,
|
|
57
|
+
y: null,
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
// Tooltip element
|
|
61
|
+
var tooltip = document.createElement('div')
|
|
62
|
+
tooltip.classList.add('jtooltip');
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
// Events
|
|
65
|
+
var mouseDown = function(e) {
|
|
66
|
+
// Check if this is the floating
|
|
67
|
+
var item = jSuites.findElement(e.target, 'jpanel');
|
|
68
|
+
// Jfloating found
|
|
69
|
+
if (item && ! item.classList.contains("readonly")) {
|
|
70
|
+
// Add focus to the chart container
|
|
71
|
+
item.focus();
|
|
72
|
+
// Keep the tracking information
|
|
73
|
+
var rect = e.target.getBoundingClientRect();
|
|
74
|
+
editorAction = {
|
|
75
|
+
e: item,
|
|
76
|
+
x: e.clientX,
|
|
77
|
+
y: e.clientY,
|
|
78
|
+
w: rect.width,
|
|
79
|
+
h: rect.height,
|
|
80
|
+
d: item.style.cursor,
|
|
81
|
+
resizing: item.style.cursor ? true : false,
|
|
82
|
+
actioned: false,
|
|
83
|
+
}
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
// Make sure width and height styling is OK
|
|
86
|
+
if (! item.style.width) {
|
|
87
|
+
item.style.width = rect.width + 'px';
|
|
88
|
+
}
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (! item.style.height) {
|
|
91
|
+
item.style.height = rect.height + 'px';
|
|
92
|
+
}
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
94
|
+
// Remove any selection from the page
|
|
95
|
+
var s = window.getSelection();
|
|
96
|
+
if (s.rangeCount) {
|
|
97
|
+
for (var i = 0; i < s.rangeCount; i++) {
|
|
98
|
+
s.removeRange(s.getRangeAt(i));
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
e.stopPropagation();
|
|
102
|
-
} else {
|
|
103
|
-
// No floating action found
|
|
104
|
-
editorAction = false;
|
|
105
100
|
}
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
} else {
|
|
105
|
+
// No floating action found
|
|
106
|
+
editorAction = false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Verify current components tracking
|
|
110
|
+
if (e.changedTouches && e.changedTouches[0]) {
|
|
111
|
+
var x = e.changedTouches[0].clientX;
|
|
112
|
+
var y = e.changedTouches[0].clientY;
|
|
113
|
+
} else {
|
|
114
|
+
var x = e.clientX;
|
|
115
|
+
var y = e.clientY;
|
|
116
|
+
}
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
// Which component I am clicking
|
|
119
|
+
var path = event.path || (event.composedPath && event.composedPath());
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
// If path available get the first element in the chain
|
|
122
|
+
if (path) {
|
|
123
|
+
element = path[0];
|
|
124
|
+
} else {
|
|
125
|
+
// Try to guess using the coordinates
|
|
126
|
+
if (e.target && e.target.shadowRoot) {
|
|
127
|
+
var d = e.target.shadowRoot;
|
|
122
128
|
} else {
|
|
123
|
-
|
|
124
|
-
if (e.target && e.target.shadowRoot) {
|
|
125
|
-
var d = e.target.shadowRoot;
|
|
126
|
-
} else {
|
|
127
|
-
var d = document;
|
|
128
|
-
}
|
|
129
|
-
// Get the first target element
|
|
130
|
-
element = d.elementFromPoint(x, y);
|
|
129
|
+
var d = document;
|
|
131
130
|
}
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
// Get the first target element
|
|
132
|
+
element = d.elementFromPoint(x, y);
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (typeof(editorAction.e.refresh) == 'function' && state.actioned) {
|
|
139
|
-
editorAction.e.refresh();
|
|
140
|
-
}
|
|
141
|
-
editorAction.e.style.cursor = '';
|
|
142
|
-
}
|
|
135
|
+
isOpened(element);
|
|
136
|
+
}
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
var mouseUp = function(e) {
|
|
139
|
+
if (editorAction && editorAction.e) {
|
|
140
|
+
if (typeof(editorAction.e.refresh) == 'function' && state.actioned) {
|
|
141
|
+
editorAction.e.refresh();
|
|
148
142
|
}
|
|
149
|
-
|
|
150
|
-
editorAction = false;
|
|
143
|
+
editorAction.e.style.cursor = '';
|
|
151
144
|
}
|
|
152
145
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// Action on going
|
|
159
|
-
if (! editorAction.resizing) {
|
|
160
|
-
if (state.x == null && state.y == null) {
|
|
161
|
-
state.x = x;
|
|
162
|
-
state.y = y;
|
|
163
|
-
}
|
|
146
|
+
// Reset
|
|
147
|
+
state = {
|
|
148
|
+
x: null,
|
|
149
|
+
y: null,
|
|
150
|
+
}
|
|
164
151
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var top = editorAction.e.offsetTop + dy;
|
|
168
|
-
var left = editorAction.e.offsetLeft + dx;
|
|
152
|
+
editorAction = false;
|
|
153
|
+
}
|
|
169
154
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
155
|
+
var mouseMove = function(e) {
|
|
156
|
+
if (editorAction) {
|
|
157
|
+
var x = e.clientX || e.pageX;
|
|
158
|
+
var y = e.clientY || e.pageY;
|
|
174
159
|
|
|
160
|
+
// Action on going
|
|
161
|
+
if (! editorAction.resizing) {
|
|
162
|
+
if (state.x == null && state.y == null) {
|
|
175
163
|
state.x = x;
|
|
176
164
|
state.y = y;
|
|
165
|
+
}
|
|
177
166
|
|
|
167
|
+
var dx = x - state.x;
|
|
168
|
+
var dy = y - state.y;
|
|
169
|
+
var top = editorAction.e.offsetTop + dy;
|
|
170
|
+
var left = editorAction.e.offsetLeft + dx;
|
|
178
171
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
var width = null;
|
|
186
|
-
var height = null;
|
|
187
|
-
|
|
188
|
-
if (editorAction.d == 'e-resize' || editorAction.d == 'ne-resize' || editorAction.d == 'se-resize') {
|
|
189
|
-
// Update width
|
|
190
|
-
width = editorAction.w + (x - editorAction.x);
|
|
191
|
-
editorAction.e.style.width = width + 'px';
|
|
192
|
-
|
|
193
|
-
// Update Height
|
|
194
|
-
if (e.shiftKey) {
|
|
195
|
-
var newHeight = (x - editorAction.x) * (editorAction.h / editorAction.w);
|
|
196
|
-
height = editorAction.h + newHeight;
|
|
197
|
-
editorAction.e.style.height = height + 'px';
|
|
198
|
-
} else {
|
|
199
|
-
var newHeight = false;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
172
|
+
// Update position
|
|
173
|
+
editorAction.e.style.top = top + 'px';
|
|
174
|
+
editorAction.e.style.left = left + 'px';
|
|
175
|
+
editorAction.e.style.cursor = "move";
|
|
202
176
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
177
|
+
state.x = x;
|
|
178
|
+
state.y = y;
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
// Update element
|
|
182
|
+
if (typeof(editorAction.e.refresh) == 'function') {
|
|
183
|
+
state.actioned = true;
|
|
184
|
+
editorAction.e.refresh('position', top, left);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
var width = null;
|
|
188
|
+
var height = null;
|
|
189
|
+
|
|
190
|
+
if (editorAction.d == 'e-resize' || editorAction.d == 'ne-resize' || editorAction.d == 'se-resize') {
|
|
191
|
+
// Update width
|
|
192
|
+
width = editorAction.w + (x - editorAction.x);
|
|
193
|
+
editorAction.e.style.width = width + 'px';
|
|
194
|
+
|
|
195
|
+
// Update Height
|
|
196
|
+
if (e.shiftKey) {
|
|
197
|
+
var newHeight = (x - editorAction.x) * (editorAction.h / editorAction.w);
|
|
198
|
+
height = editorAction.h + newHeight;
|
|
199
|
+
editorAction.e.style.height = height + 'px';
|
|
200
|
+
} else {
|
|
201
|
+
var newHeight = false;
|
|
208
202
|
}
|
|
203
|
+
}
|
|
209
204
|
|
|
210
|
-
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
editorAction.e.
|
|
205
|
+
if (! newHeight) {
|
|
206
|
+
if (editorAction.d == 's-resize' || editorAction.d == 'se-resize' || editorAction.d == 'sw-resize') {
|
|
207
|
+
height = editorAction.h + (y - editorAction.y);
|
|
208
|
+
editorAction.e.style.height = height + 'px';
|
|
214
209
|
}
|
|
215
210
|
}
|
|
216
|
-
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
item.style.cursor = '
|
|
211
|
+
|
|
212
|
+
// Update element
|
|
213
|
+
if (typeof(editorAction.e.refresh) == 'function') {
|
|
214
|
+
state.actioned = true;
|
|
215
|
+
editorAction.e.refresh('dimensions', width, height);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
// Resizing action
|
|
220
|
+
var item = jSuites.findElement(e.target, 'jpanel');
|
|
221
|
+
// Found eligible component
|
|
222
|
+
if (item) {
|
|
223
|
+
if (item.getAttribute('tabindex')) {
|
|
224
|
+
var rect = item.getBoundingClientRect();
|
|
225
|
+
if (e.clientY - rect.top < cornerSize) {
|
|
226
|
+
if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
227
|
+
item.style.cursor = 'ne-resize';
|
|
228
|
+
} else if (e.clientX - rect.left < cornerSize) {
|
|
229
|
+
item.style.cursor = 'nw-resize';
|
|
230
|
+
} else {
|
|
231
|
+
item.style.cursor = 'n-resize';
|
|
232
|
+
}
|
|
233
|
+
} else if (rect.height - (e.clientY - rect.top) < cornerSize) {
|
|
234
|
+
if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
235
|
+
item.style.cursor = 'se-resize';
|
|
241
236
|
} else if (e.clientX - rect.left < cornerSize) {
|
|
242
|
-
item.style.cursor = '
|
|
237
|
+
item.style.cursor = 'sw-resize';
|
|
243
238
|
} else {
|
|
244
|
-
item.style.cursor = '';
|
|
239
|
+
item.style.cursor = 's-resize';
|
|
245
240
|
}
|
|
241
|
+
} else if (rect.width - (e.clientX - rect.left) < cornerSize) {
|
|
242
|
+
item.style.cursor = 'e-resize';
|
|
243
|
+
} else if (e.clientX - rect.left < cornerSize) {
|
|
244
|
+
item.style.cursor = 'w-resize';
|
|
245
|
+
} else {
|
|
246
|
+
item.style.cursor = '';
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
}
|
|
251
|
+
}
|
|
250
252
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// Position
|
|
258
|
-
if (e.changedTouches && e.changedTouches[0]) {
|
|
259
|
-
var x = e.changedTouches[0].clientX;
|
|
260
|
-
var y = e.changedTouches[0].clientY;
|
|
261
|
-
} else {
|
|
262
|
-
var x = e.clientX;
|
|
263
|
-
var y = e.clientY;
|
|
264
|
-
}
|
|
253
|
+
var mouseOver = function(e) {
|
|
254
|
+
var message = e.target.getAttribute('data-tooltip');
|
|
255
|
+
if (message) {
|
|
256
|
+
// Instructions
|
|
257
|
+
tooltip.innerText = message;
|
|
265
258
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
259
|
+
// Position
|
|
260
|
+
if (e.changedTouches && e.changedTouches[0]) {
|
|
261
|
+
var x = e.changedTouches[0].clientX;
|
|
262
|
+
var y = e.changedTouches[0].clientY;
|
|
263
|
+
} else {
|
|
264
|
+
var x = e.clientX;
|
|
265
|
+
var y = e.clientY;
|
|
272
266
|
}
|
|
273
|
-
}
|
|
274
267
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
268
|
+
tooltip.style.top = y + 'px';
|
|
269
|
+
tooltip.style.left = x + 'px';
|
|
270
|
+
document.body.appendChild(tooltip);
|
|
271
|
+
} else if (tooltip.innerText) {
|
|
272
|
+
tooltip.innerText = '';
|
|
273
|
+
document.body.removeChild(tooltip);
|
|
281
274
|
}
|
|
275
|
+
}
|
|
282
276
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
277
|
+
var dblClick = function(e) {
|
|
278
|
+
var item = jSuites.findElement(e.target, 'jpanel');
|
|
279
|
+
if (item && typeof(item.dblclick) == 'function') {
|
|
280
|
+
// Create edition
|
|
281
|
+
item.dblclick(e);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
288
284
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
return o.tagName && o.getAttribute('aria-contextmenu-id');
|
|
295
|
-
});
|
|
285
|
+
var contextMenu = function(e) {
|
|
286
|
+
var item = document.activeElement;
|
|
287
|
+
if (item && typeof(item.contextmenu) == 'function') {
|
|
288
|
+
// Create edition
|
|
289
|
+
item.contextmenu(e);
|
|
296
290
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
e.stopImmediatePropagation();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
e.stopImmediatePropagation();
|
|
293
|
+
} else {
|
|
294
|
+
// Search for possible context menus
|
|
295
|
+
item = jSuites.findElement(e.target, function(o) {
|
|
296
|
+
return o.tagName && o.getAttribute('aria-contextmenu-id');
|
|
297
|
+
});
|
|
309
298
|
|
|
310
|
-
var keyDown = function(e) {
|
|
311
|
-
var item = document.activeElement;
|
|
312
299
|
if (item) {
|
|
313
|
-
|
|
314
|
-
|
|
300
|
+
var o = document.querySelector('#' + item);
|
|
301
|
+
if (! o) {
|
|
302
|
+
console.error('JSUITES: contextmenu id not found: ' + item);
|
|
303
|
+
} else {
|
|
304
|
+
o.contextmenu.open(e);
|
|
315
305
|
e.preventDefault();
|
|
316
306
|
e.stopImmediatePropagation();
|
|
317
307
|
}
|
|
318
308
|
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
319
311
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
var keyDown = function(e) {
|
|
313
|
+
var item = document.activeElement;
|
|
314
|
+
if (item) {
|
|
315
|
+
if (e.key == "Delete" && typeof(item.delete) == 'function') {
|
|
316
|
+
item.delete();
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
e.stopImmediatePropagation();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (jSuites.current && jSuites.current.length) {
|
|
323
|
+
if (item = jSuites.current[jSuites.current.length - 1]) {
|
|
324
|
+
if (e.key == "Escape" && typeof(item.close) == 'function') {
|
|
325
|
+
item.close();
|
|
326
|
+
e.preventDefault();
|
|
327
|
+
e.stopImmediatePropagation();
|
|
327
328
|
}
|
|
328
329
|
}
|
|
329
330
|
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
document.addEventListener('mouseup', mouseUp);
|
|
334
|
+
document.addEventListener("mousedown", mouseDown);
|
|
335
|
+
document.addEventListener('mousemove', mouseMove);
|
|
336
|
+
document.addEventListener('mouseover', mouseOver);
|
|
337
|
+
document.addEventListener('dblclick', dblClick);
|
|
338
|
+
document.addEventListener('keydown', keyDown);
|
|
339
|
+
document.addEventListener('contextmenu', contextMenu);
|
|
340
|
+
};
|
|
330
341
|
|
|
331
|
-
|
|
332
|
-
document.addEventListener("mousedown", mouseDown);
|
|
333
|
-
document.addEventListener('mousemove', mouseMove);
|
|
334
|
-
document.addEventListener('mouseover', mouseOver);
|
|
335
|
-
document.addEventListener('dblclick', dblClick);
|
|
336
|
-
document.addEventListener('keydown', keyDown);
|
|
337
|
-
document.addEventListener('contextmenu', contextMenu);
|
|
338
|
-
document.dictionary = {};
|
|
342
|
+
var jSuites = {};
|
|
339
343
|
|
|
340
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Global jsuites event
|
|
346
|
+
*/
|
|
347
|
+
if (typeof(document) !== "undefined") {
|
|
348
|
+
if (window.jSuites) {
|
|
349
|
+
jSuites = window.jSuites;
|
|
350
|
+
} else {
|
|
351
|
+
Events();
|
|
341
352
|
}
|
|
353
|
+
}
|
|
342
354
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
355
|
+
jSuites.version = Version;
|
|
356
|
+
|
|
357
|
+
jSuites.setExtensions = function(o) {
|
|
358
|
+
if (typeof(o) == 'object') {
|
|
359
|
+
var k = Object.keys(o);
|
|
360
|
+
for (var i = 0; i < k.length; i++) {
|
|
361
|
+
jSuites[k[i]] = o[k[i]];
|
|
349
362
|
}
|
|
350
363
|
}
|
|
364
|
+
}
|
|
351
365
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
});
|
|
366
|
+
jSuites.tracking = function(component, state) {
|
|
367
|
+
if (! jSuites.current) {
|
|
368
|
+
jSuites.current = [];
|
|
369
|
+
}
|
|
357
370
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
371
|
+
if (state == true) {
|
|
372
|
+
jSuites.current = jSuites.current.filter(function(v) {
|
|
373
|
+
return v !== null;
|
|
374
|
+
});
|
|
362
375
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
376
|
+
// Start after all events
|
|
377
|
+
setTimeout(function() {
|
|
378
|
+
jSuites.current.push(component);
|
|
379
|
+
}, 0);
|
|
380
|
+
|
|
381
|
+
} else {
|
|
382
|
+
var index = jSuites.current.indexOf(component);
|
|
383
|
+
if (index >= 0) {
|
|
384
|
+
jSuites.current.splice(index, 1);
|
|
368
385
|
}
|
|
369
386
|
}
|
|
387
|
+
}
|
|
370
388
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
// Get the property
|
|
381
|
-
p = str.shift();
|
|
382
|
-
// Check if the property exists
|
|
383
|
-
if (o.hasOwnProperty(p)) {
|
|
384
|
-
o = o[p];
|
|
385
|
-
} else {
|
|
386
|
-
// Property does not exists
|
|
387
|
-
if (val === undefined) {
|
|
388
|
-
return undefined;
|
|
389
|
-
} else {
|
|
390
|
-
// Create the property
|
|
391
|
-
o[p] = {};
|
|
392
|
-
// Next property
|
|
393
|
-
o = o[p];
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
389
|
+
/**
|
|
390
|
+
* Get or set a property from a JSON from a string.
|
|
391
|
+
*/
|
|
392
|
+
jSuites.path = function(str, val) {
|
|
393
|
+
str = str.split('.');
|
|
394
|
+
if (str.length) {
|
|
395
|
+
var o = this;
|
|
396
|
+
var p = null;
|
|
397
|
+
while (str.length > 1) {
|
|
397
398
|
// Get the property
|
|
398
399
|
p = str.shift();
|
|
399
|
-
//
|
|
400
|
-
if (
|
|
401
|
-
o[p]
|
|
402
|
-
// Success
|
|
403
|
-
return true;
|
|
400
|
+
// Check if the property exists
|
|
401
|
+
if (o.hasOwnProperty(p)) {
|
|
402
|
+
o = o[p];
|
|
404
403
|
} else {
|
|
405
|
-
//
|
|
406
|
-
if (
|
|
407
|
-
return
|
|
404
|
+
// Property does not exists
|
|
405
|
+
if (val === undefined) {
|
|
406
|
+
return undefined;
|
|
407
|
+
} else {
|
|
408
|
+
// Create the property
|
|
409
|
+
o[p] = {};
|
|
410
|
+
// Next property
|
|
411
|
+
o = o[p];
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
|
-
//
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
for (var i = 0; i < k.length; i++) {
|
|
423
|
-
document.dictionary[k[i]] = d[k[i]];
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// Translations
|
|
427
|
-
var t = null;
|
|
428
|
-
for (var i = 0; i < jSuites.calendar.weekdays.length; i++) {
|
|
429
|
-
t = jSuites.translate(jSuites.calendar.weekdays[i]);
|
|
430
|
-
if (jSuites.calendar.weekdays[i]) {
|
|
431
|
-
jSuites.calendar.weekdays[i] = t;
|
|
432
|
-
jSuites.calendar.weekdaysShort[i] = t.substr(0,3);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
for (var i = 0; i < jSuites.calendar.months.length; i++) {
|
|
436
|
-
t = jSuites.translate(jSuites.calendar.months[i]);
|
|
437
|
-
if (t) {
|
|
438
|
-
jSuites.calendar.months[i] = t;
|
|
439
|
-
jSuites.calendar.monthsShort[i] = t.substr(0,3);
|
|
415
|
+
// Get the property
|
|
416
|
+
p = str.shift();
|
|
417
|
+
// Set or get the value
|
|
418
|
+
if (val !== undefined) {
|
|
419
|
+
o[p] = val;
|
|
420
|
+
// Success
|
|
421
|
+
return true;
|
|
422
|
+
} else {
|
|
423
|
+
// Return the value
|
|
424
|
+
if (o) {
|
|
425
|
+
return o[p];
|
|
440
426
|
}
|
|
441
427
|
}
|
|
442
428
|
}
|
|
429
|
+
// Something went wrong
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
443
432
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
433
|
+
// Update dictionary
|
|
434
|
+
jSuites.setDictionary = function(d) {
|
|
435
|
+
if (! document.dictionary) {
|
|
436
|
+
document.dictionary = {}
|
|
437
|
+
}
|
|
438
|
+
// Replace the key into the dictionary and append the new ones
|
|
439
|
+
var k = Object.keys(d);
|
|
440
|
+
for (var i = 0; i < k.length; i++) {
|
|
441
|
+
document.dictionary[k[i]] = d[k[i]];
|
|
451
442
|
}
|
|
452
443
|
|
|
453
|
-
//
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
444
|
+
// Translations
|
|
445
|
+
var t = null;
|
|
446
|
+
for (var i = 0; i < jSuites.calendar.weekdays.length; i++) {
|
|
447
|
+
t = jSuites.translate(jSuites.calendar.weekdays[i]);
|
|
448
|
+
if (jSuites.calendar.weekdays[i]) {
|
|
449
|
+
jSuites.calendar.weekdays[i] = t;
|
|
450
|
+
jSuites.calendar.weekdaysShort[i] = t.substr(0,3);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
for (var i = 0; i < jSuites.calendar.months.length; i++) {
|
|
454
|
+
t = jSuites.translate(jSuites.calendar.months[i]);
|
|
455
|
+
if (t) {
|
|
456
|
+
jSuites.calendar.months[i] = t;
|
|
457
|
+
jSuites.calendar.monthsShort[i] = t.substr(0,3);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
458
461
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
// Translate
|
|
463
|
+
jSuites.translate = function(t) {
|
|
464
|
+
if (document.dictionary) {
|
|
465
|
+
return document.dictionary[t] || t;
|
|
466
|
+
} else {
|
|
467
|
+
return t;
|
|
468
|
+
}
|
|
464
469
|
}
|
|
465
470
|
|
|
466
471
|
jSuites.ajax = (function(options, complete) {
|
|
@@ -8121,7 +8126,11 @@ jSuites.mask = (function() {
|
|
|
8121
8126
|
parse.call(o);
|
|
8122
8127
|
}
|
|
8123
8128
|
|
|
8124
|
-
|
|
8129
|
+
// New value
|
|
8130
|
+
var newValue = o.values.join('');
|
|
8131
|
+
|
|
8132
|
+
// Add tokens to the end of string only if string is not empty
|
|
8133
|
+
if (isNumeric(o.type) && newValue !== '') {
|
|
8125
8134
|
// Complement things in the end of the mask
|
|
8126
8135
|
while (typeof(o.tokens[o.index]) !== 'undefined') {
|
|
8127
8136
|
var t = getMethod.call(o, o.tokens[o.index]);
|
|
@@ -8137,7 +8146,7 @@ jSuites.mask = (function() {
|
|
|
8137
8146
|
}
|
|
8138
8147
|
|
|
8139
8148
|
// New value
|
|
8140
|
-
|
|
8149
|
+
newValue = o.values.join('');
|
|
8141
8150
|
|
|
8142
8151
|
// Reset value
|
|
8143
8152
|
if (o.input) {
|