pixl-xyapp 2.1.26 → 2.1.28
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/js/page.js +1 -42
- package/js/popover.js +5 -0
- package/js/tools.js +17 -9
- package/package.json +1 -1
package/js/page.js
CHANGED
|
@@ -228,48 +228,7 @@ window.Page = class Page {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
html += '<select multiple ' + compose_attribs(args) + '>';
|
|
231
|
-
|
|
232
|
-
var item = opts[idx];
|
|
233
|
-
var item_name = '';
|
|
234
|
-
var item_value = '';
|
|
235
|
-
var attribs = {};
|
|
236
|
-
|
|
237
|
-
if (isa_hash(item)) {
|
|
238
|
-
if (('label' in item) && ('data' in item)) {
|
|
239
|
-
item_name = item.label;
|
|
240
|
-
item_value = item.data;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
item_name = item.title;
|
|
244
|
-
item_value = item.id;
|
|
245
|
-
}
|
|
246
|
-
if (item.icon) attribs['data-icon'] = item.icon;
|
|
247
|
-
if (item.abbrev) attribs['data-abbrev'] = item.abbrev;
|
|
248
|
-
if (item.class) attribs['data-class'] = item.class;
|
|
249
|
-
if (item.group) attribs['data-group'] = item.group;
|
|
250
|
-
}
|
|
251
|
-
else if (isa_array(item)) {
|
|
252
|
-
item_value = item[0];
|
|
253
|
-
item_name = item[1];
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
item_name = item_value = item;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
attribs.value = item_value;
|
|
260
|
-
if (find_in_array(values, item_value)) attribs.selected = 'selected';
|
|
261
|
-
html += '<option ' + compose_attribs(attribs) + '>' + encode_entities(item_name) + '</option>';
|
|
262
|
-
opt_values.push( item_value );
|
|
263
|
-
} // foreach opt
|
|
264
|
-
|
|
265
|
-
if (auto_add) {
|
|
266
|
-
values.forEach( function(value) {
|
|
267
|
-
if (!find_in_array(opt_values, value)) {
|
|
268
|
-
html += '<option value="' + encode_attrib_entities(value) + '" selected="selected">' + encode_entities(value) + '</option>';
|
|
269
|
-
}
|
|
270
|
-
} );
|
|
271
|
-
} // auto-add
|
|
272
|
-
|
|
231
|
+
html += render_menu_options( opts, values, auto_add );
|
|
273
232
|
html += '</select>';
|
|
274
233
|
return html;
|
|
275
234
|
}
|
package/js/popover.js
CHANGED
|
@@ -36,6 +36,11 @@ var Popover = {
|
|
|
36
36
|
else {
|
|
37
37
|
$box.css('top', '' + Math.floor( rect.bottom + 16 ) + 'px');
|
|
38
38
|
$box.addClass('top');
|
|
39
|
+
|
|
40
|
+
if (rect.bottom + 16 + height > win.height) {
|
|
41
|
+
// off bottom of window, nudge back into bounds
|
|
42
|
+
$box.css('top', '' + Math.floor( (win.height - height) - 16 ) + 'px');
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
if (shrinkwrap) {
|
package/js/tools.js
CHANGED
|
@@ -323,10 +323,13 @@ function pluralize(word, num) {
|
|
|
323
323
|
else return word;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
function render_menu_options(items,
|
|
326
|
+
function render_menu_options(items, sel_values, auto_add) {
|
|
327
327
|
// return HTML for menu options
|
|
328
328
|
var html = '';
|
|
329
|
-
var
|
|
329
|
+
var sel_map = {};
|
|
330
|
+
|
|
331
|
+
if (!sel_values) sel_values = [];
|
|
332
|
+
if (!Array.isArray(sel_values)) sel_values = [sel_values];
|
|
330
333
|
|
|
331
334
|
for (var idx = 0, len = items.length; idx < len; idx++) {
|
|
332
335
|
var item = items[idx];
|
|
@@ -343,7 +346,7 @@ function render_menu_options(items, sel_value, auto_add) {
|
|
|
343
346
|
}
|
|
344
347
|
|
|
345
348
|
html += '<optgroup label="' + encode_attrib_entities(item.label) + '">';
|
|
346
|
-
html += render_menu_options( sub_items,
|
|
349
|
+
html += render_menu_options( sub_items, sel_values, false );
|
|
347
350
|
html += '</optgroup>';
|
|
348
351
|
continue;
|
|
349
352
|
}
|
|
@@ -356,6 +359,7 @@ function render_menu_options(items, sel_value, auto_add) {
|
|
|
356
359
|
item_value = item.id;
|
|
357
360
|
}
|
|
358
361
|
if (item.icon) attribs['data-icon'] = item.icon;
|
|
362
|
+
if (item.abbrev) attribs['data-abbrev'] = item.abbrev;
|
|
359
363
|
if (item.class) attribs['data-class'] = item.class;
|
|
360
364
|
if (item.group) attribs['data-group'] = item.group;
|
|
361
365
|
}
|
|
@@ -368,15 +372,19 @@ function render_menu_options(items, sel_value, auto_add) {
|
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
attribs.value = item_value;
|
|
371
|
-
if (item_value
|
|
375
|
+
if (sel_values.includes(item_value)) {
|
|
376
|
+
attribs.selected = 'selected';
|
|
377
|
+
sel_map[item_value] = 1;
|
|
378
|
+
}
|
|
372
379
|
html += '<option ' + compose_attribs(attribs) + '>' + encode_entities(item_name) + '</option>';
|
|
373
|
-
|
|
374
|
-
if (item_value == sel_value) found = true;
|
|
375
380
|
}
|
|
376
381
|
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
|
|
382
|
+
if (sel_values.length && auto_add) {
|
|
383
|
+
sel_values.forEach( function(sel_value) {
|
|
384
|
+
if (sel_map[sel_value]) return;
|
|
385
|
+
html += '<option value="' + encode_attrib_entities(sel_value) + '" selected="selected">' + encode_entities(sel_value) + '</option>';
|
|
386
|
+
} ); // foreach selected value
|
|
387
|
+
} // yes add
|
|
380
388
|
|
|
381
389
|
return html;
|
|
382
390
|
}
|
package/package.json
CHANGED