@saltcorn/server 0.6.4 → 0.7.0-beta.2

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.
@@ -0,0 +1,554 @@
1
+ /*!========================================================================
2
+ * File: bootstrap-iconpicker.js v1.10.0 by @victor-valencia
3
+ * https://victor-valencia.github.com/bootstrap-iconpicker
4
+ * ========================================================================
5
+ * Copyright 2013-2018 Victor Valencia Rico.
6
+ * Licensed under MIT license.
7
+ * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE
8
+ * ========================================================================
9
+ */
10
+
11
+ ;(function($){ "use strict";
12
+
13
+ // ICONPICKER PUBLIC CLASS DEFINITION
14
+ // ==============================
15
+ var Iconpicker = function (element, options) {
16
+
17
+ if (typeof $.fn.popover === 'undefined' || typeof $.fn.popover.Constructor.VERSION === 'undefined') {
18
+ throw new TypeError('Bootstrap iconpicker require Bootstrap popover');
19
+ }
20
+
21
+ this.$element = $(element);
22
+ this.options = $.extend({}, Iconpicker.DEFAULTS, this.$element.data());
23
+ this.options = $.extend({}, this.options, options);
24
+
25
+ };
26
+
27
+ // ICONPICKER VERSION
28
+ // ==============================
29
+ Iconpicker.VERSION = '1.10.0';
30
+
31
+ // ICONPICKER ICONSET_EMPTY
32
+ // ==============================
33
+ Iconpicker.ICONSET_EMPTY = {
34
+ iconClass: '',
35
+ iconClassFix: '',
36
+ icons: []
37
+ };
38
+
39
+ // ICONPICKER ICONSET
40
+ // ==============================
41
+ Iconpicker.ICONSET = {
42
+ _custom: null,
43
+ elusiveicon: $.iconset_elusiveicon || Iconpicker.ICONSET_EMPTY,
44
+ flagicon: $.iconset_flagicon || Iconpicker.ICONSET_EMPTY,
45
+ fontawesome4: $.iconset_fontawesome_4 || Iconpicker.ICONSET_EMPTY,
46
+ fontawesome5: $.iconset_fontawesome_5 || Iconpicker.ICONSET_EMPTY,
47
+ glyphicon: $.iconset_glyphicon || Iconpicker.ICONSET_EMPTY,
48
+ ionicon: $.iconset_ionicon || Iconpicker.ICONSET_EMPTY,
49
+ mapicon: $.iconset_mapicon || Iconpicker.ICONSET_EMPTY,
50
+ materialdesign: $.iconset_materialdesign || Iconpicker.ICONSET_EMPTY,
51
+ octicon: $.iconset_octicon || Iconpicker.ICONSET_EMPTY,
52
+ typicon: $.iconset_typicon || Iconpicker.ICONSET_EMPTY,
53
+ weathericon: $.iconset_weathericon || Iconpicker.ICONSET_EMPTY
54
+ };
55
+
56
+ // ICONPICKER DEFAULTS
57
+ // ==============================
58
+ Iconpicker.DEFAULTS = {
59
+ align: 'center',
60
+ arrowClass: 'btn-primary',
61
+ arrowNextIconClass: 'fas fa-arrow-right',
62
+ arrowPrevIconClass: 'fas fa-arrow-left',
63
+ cols: 4,
64
+ icon: '',
65
+ iconset: 'fontawesome5',
66
+ iconsetVersion: 'lastest',
67
+ header: true,
68
+ labelHeader: '{0} / {1}',
69
+ footer: true,
70
+ labelFooter: '{0} - {1} of {2}',
71
+ placement: 'bottom',
72
+ rows: 4,
73
+ search: true,
74
+ searchText: 'Search icon',
75
+ selectedClass: 'btn-warning',
76
+ unselectedClass: 'btn-secondary'
77
+ };
78
+
79
+ // ICONPICKER PRIVATE METHODS
80
+ // ==============================
81
+ Iconpicker.prototype.bindEvents = function () {
82
+ var op = this.options;
83
+ var el = this;
84
+ op.table.find('.btn-previous, .btn-next').off('click').on('click', function(e) {
85
+ e.preventDefault();
86
+ if(!$(this).hasClass('disabled')){
87
+ var inc = parseInt($(this).val(), 10);
88
+ el.changeList(op.page + inc);
89
+ }
90
+ });
91
+ op.table.find('.btn-icon').off('click').on('click', function(e) {
92
+ e.preventDefault();
93
+ el.select($(this).val());
94
+ if(op.inline === false){
95
+ el.$element.popover(($.fn.bsVersion() === '3.x') ? 'destroy' : 'dispose');
96
+ }
97
+ else{
98
+ op.table.find("i[class$='" + $(this).val() + "']").parent().addClass(op.selectedClass);
99
+ }
100
+ });
101
+ op.table.find('.search-control').off('keyup').on('keyup', function() {
102
+ el.changeList(1);
103
+ });
104
+ };
105
+
106
+ Iconpicker.prototype.changeList = function (page) {
107
+ this.filterIcons();
108
+ this.updateLabels(page);
109
+ this.updateIcons(page);
110
+ this.options.page = page;
111
+ this.bindEvents();
112
+ };
113
+
114
+ Iconpicker.prototype.filterIcons = function () {
115
+ var op = this.options;
116
+ var search = op.table.find('.search-control').val();
117
+ var icons = [];
118
+ if(op.iconsetVersion != 'lastest' && typeof Iconpicker.ICONSET[op.iconset].allVersions != 'undefined'){
119
+ $.each(Iconpicker.ICONSET[op.iconset].allVersions, function(i, v){
120
+ if(op.iconsetVersion == v.version){
121
+ icons = v.icons;
122
+ }
123
+ });
124
+ }
125
+ else
126
+ icons = Iconpicker.ICONSET[op.iconset].icons;
127
+
128
+ if (search === "") {
129
+ op.icons = icons;
130
+ }
131
+ else {
132
+ var result = [];
133
+ $.each(icons, function(i, v) {
134
+ if (v.toLowerCase().indexOf(search) > -1) {
135
+ result.push(v);
136
+ }
137
+ });
138
+ op.icons = result;
139
+ }
140
+ };
141
+
142
+ Iconpicker.prototype.removeAddClass = function (target, remove, add) {
143
+ this.options.table.find(target).removeClass(remove).addClass(add);
144
+ return add;
145
+ };
146
+
147
+ Iconpicker.prototype.reset = function () {
148
+ this.updatePicker();
149
+ this.changeList(1);
150
+ };
151
+
152
+ Iconpicker.prototype.select = function (icon) {
153
+ var op = this.options;
154
+ var el = this.$element;
155
+ op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons);
156
+ if (op.selected === -1) {
157
+ op.selected = 0;
158
+ icon = op.iconClassFix + op.icons[op.selected];
159
+ }
160
+ if (icon !== '' && op.selected >= 0) {
161
+ op.icon = icon;
162
+ if(op.inline === false){
163
+ el.find('input').val(icon);
164
+ el.find('i').attr('class', '').addClass(op.iconClass).addClass(icon);
165
+ }
166
+ if(icon === op.iconClassFix){
167
+ el.trigger({ type: "change", icon: 'empty' });
168
+ }
169
+ else {
170
+ el.trigger({ type: "change", icon: icon });
171
+ el.find('input').val(icon);
172
+ }
173
+ op.table.find('button.' + op.selectedClass).removeClass(op.selectedClass);
174
+ }
175
+ };
176
+
177
+ Iconpicker.prototype.switchPage = function (icon) {
178
+ var op = this.options;
179
+ op.selected = $.inArray(icon.replace(op.iconClassFix, ''), op.icons);
180
+
181
+ if(op.selected >= 0) {
182
+ var page = Math.ceil((op.selected + 1) / this.totalIconsPerPage());
183
+ this.changeList(page);
184
+ }
185
+ if(icon === ''){
186
+ //if(op.iconClassFix !== '')
187
+ op.table.find('i.' + op.iconClassFix).parent().addClass(op.selectedClass);
188
+ //else
189
+ }
190
+ else{
191
+ op.table.find('i.' + icon).parent().addClass(op.selectedClass);
192
+ }
193
+ };
194
+
195
+ Iconpicker.prototype.totalPages = function () {
196
+ return Math.ceil(this.totalIcons() / this.totalIconsPerPage());
197
+ };
198
+
199
+ Iconpicker.prototype.totalIcons = function () {
200
+ return this.options.icons.length;
201
+ };
202
+
203
+ Iconpicker.prototype.totalIconsPerPage = function () {
204
+ if(this.options.rows === 0){
205
+ return this.options.icons.length;
206
+ }
207
+ else{
208
+ return this.options.cols * this.options.rows;
209
+ }
210
+ };
211
+
212
+ Iconpicker.prototype.updateArrows = function (page) {
213
+ var op = this.options;
214
+ var total_pages = this.totalPages();
215
+ if (page === 1) {
216
+ op.table.find('.btn-previous').addClass('disabled');
217
+ }
218
+ else {
219
+ op.table.find('.btn-previous').removeClass('disabled');
220
+ }
221
+ if (page === total_pages || total_pages === 0) {
222
+ op.table.find('.btn-next').addClass('disabled');
223
+ }
224
+ else {
225
+ op.table.find('.btn-next').removeClass('disabled');
226
+ }
227
+ };
228
+
229
+ Iconpicker.prototype.updateIcons = function (page) {
230
+ var op = this.options;
231
+ var tbody = op.table.find('tbody').empty();
232
+ var offset = (page - 1) * this.totalIconsPerPage();
233
+ var length = op.rows;
234
+ if(op.rows === 0){
235
+ length = op.icons.length;
236
+ }
237
+ for (var i = 0; i < length; i++) {
238
+ var tr = $('<tr></tr>');
239
+ for (var j = 0; j < op.cols; j++) {
240
+ var pos = offset + (i * op.cols) + j;
241
+ var btn = $('<button class="btn ' + op.unselectedClass + ' btn-icon"></button>').hide();
242
+ if (pos < op.icons.length) {
243
+ var v = op.iconClassFix + op.icons[pos];
244
+ btn.val(v).attr('title', v).append('<i class="' + op.iconClass + ' ' + v + '"></i>').show();
245
+ if (op.icon === v) {
246
+ btn.addClass(op.selectedClass).addClass('btn-icon-selected');
247
+ }
248
+ }
249
+ tr.append($('<td></td>').append(btn));
250
+ }
251
+ tbody.append(tr);
252
+ }
253
+ };
254
+
255
+ Iconpicker.prototype.updateIconsCount = function () {
256
+ var op = this.options;
257
+ if(op.footer === true){
258
+ var icons_count = [
259
+ '<tr>',
260
+ ' <td colspan="' + op.cols + '" class="text-center">',
261
+ ' <span class="icons-count"></span>',
262
+ ' </td>',
263
+ '</tr>'
264
+ ];
265
+ op.table.find('tfoot').empty().append(icons_count.join(''));
266
+ }
267
+ };
268
+
269
+ Iconpicker.prototype.updateLabels = function (page) {
270
+ var op = this.options;
271
+ var total_icons = this.totalIcons();
272
+ var total_pages = this.totalPages();
273
+ op.table.find('.page-count').html(op.labelHeader.replace('{0}', (total_pages === 0 ) ? 0 : page).replace('{1}', total_pages));
274
+ var offset = (page - 1) * this.totalIconsPerPage();
275
+ var total = page * this.totalIconsPerPage();
276
+ op.table.find('.icons-count').html(op.labelFooter.replace('{0}', total_icons ? offset + 1 : 0).replace('{1}', (total < total_icons) ? total: total_icons).replace('{2}', total_icons));
277
+ this.updateArrows(page);
278
+ };
279
+
280
+ Iconpicker.prototype.updatePagesCount = function () {
281
+ var op = this.options;
282
+ if(op.header === true){
283
+ var tr = $('<tr></tr>');
284
+ for (var i = 0; i < op.cols; i++) {
285
+ var td = $('<td class="text-center"></td>');
286
+ if (i === 0 || i === op.cols - 1) {
287
+ var arrow = [
288
+ '<button class="btn btn-arrow ' + ((i === 0) ? 'btn-previous' : 'btn-next') + ' ' + op.arrowClass + '" value="' + ((i === 0) ? -1 : 1) + '">',
289
+ '<span class="' + ((i === 0) ? op.arrowPrevIconClass : op.arrowNextIconClass) + '"></span>',
290
+ '</button>'
291
+ ];
292
+ td.append(arrow.join(''));
293
+ tr.append(td);
294
+ }
295
+ else if (tr.find('.page-count').length === 0) {
296
+ td.attr('colspan', op.cols - 2).append('<span class="page-count"></span>');
297
+ tr.append(td);
298
+ }
299
+ }
300
+ op.table.find('thead').empty().append(tr);
301
+ }
302
+ };
303
+
304
+ Iconpicker.prototype.updatePicker = function () {
305
+ var op = this.options;
306
+ if (op.cols < 4) {
307
+ throw 'Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = ' + op.cols + ']';
308
+ }
309
+ else if (op.rows < 0) {
310
+ throw 'Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = ' + op.rows + ']';
311
+ }
312
+ else {
313
+ this.updatePagesCount();
314
+ this.updateSearch();
315
+ this.updateIconsCount();
316
+ }
317
+ };
318
+
319
+ Iconpicker.prototype.updateSearch = function () {
320
+ var op = this.options;
321
+ var search = [
322
+ '<tr>',
323
+ ' <td colspan="' + op.cols + '">',
324
+ ' <input type="text" class="form-control search-control" style="width: ' + op.cols * (($.fn.bsVersion() === '3.x') ? 39 : 41) + 'px;" placeholder="' + op.searchText + '">',
325
+ ' </td>',
326
+ '</tr>'
327
+ ];
328
+ search = $(search.join(''));
329
+ if (op.search === true) {
330
+ search.show();
331
+ }
332
+ else {
333
+ search.hide();
334
+ }
335
+ op.table.find('thead').append(search);
336
+ };
337
+
338
+ // ICONPICKER PUBLIC METHODS
339
+ // ==============================
340
+ Iconpicker.prototype.setAlign = function (value) {
341
+ this.$element.removeClass(this.options.align).addClass(value);
342
+ this.options.align = value;
343
+ };
344
+
345
+ Iconpicker.prototype.setArrowClass = function (value) {
346
+ this.options.arrowClass = this.removeAddClass('.btn-arrow', this.options.arrowClass, value);
347
+ };
348
+
349
+ Iconpicker.prototype.setArrowNextIconClass = function (value) {
350
+ this.options.arrowNextIconClass = this.removeAddClass('.btn-next > span', this.options.arrowNextIconClass, value);
351
+ };
352
+
353
+ Iconpicker.prototype.setArrowPrevIconClass = function (value) {
354
+ this.options.arrowPrevIconClass = this.removeAddClass('.btn-previous > span', this.options.arrowPrevIconClass, value);
355
+ };
356
+
357
+ Iconpicker.prototype.setCols = function (value) {
358
+ this.options.cols = value;
359
+ this.reset();
360
+ };
361
+
362
+ Iconpicker.prototype.setFooter = function (value) {
363
+ var footer = this.options.table.find('tfoot');
364
+ if (value === true) {
365
+ footer.show();
366
+ }
367
+ else {
368
+ footer.hide();
369
+ }
370
+ this.options.footer = value;
371
+ };
372
+
373
+ Iconpicker.prototype.setHeader = function (value) {
374
+ var header = this.options.table.find('thead');
375
+ if (value === true) {
376
+ header.show();
377
+ }
378
+ else {
379
+ header.hide();
380
+ }
381
+ this.options.header = value;
382
+ };
383
+
384
+ Iconpicker.prototype.setIcon = function (value) {
385
+ this.select(value);
386
+ };
387
+
388
+ Iconpicker.prototype.setIconset = function (value) {
389
+ var op = this.options;
390
+ if ($.isPlainObject(value)) {
391
+ Iconpicker.ICONSET._custom = $.extend(Iconpicker.ICONSET_EMPTY, value);
392
+ op.iconset = '_custom';
393
+ }
394
+ else if (!Iconpicker.ICONSET.hasOwnProperty(value)) {
395
+ op.iconset = Iconpicker.DEFAULTS.iconset;
396
+ }
397
+ else {
398
+ op.iconset = value;
399
+ }
400
+ op = $.extend(op, Iconpicker.ICONSET[op.iconset]);
401
+ this.reset();
402
+ this.select(op.icon);
403
+ };
404
+
405
+ Iconpicker.prototype.setLabelHeader = function (value) {
406
+ this.options.labelHeader = value;
407
+ this.updateLabels(this.options.page);
408
+ };
409
+
410
+ Iconpicker.prototype.setLabelFooter = function (value) {
411
+ this.options.labelFooter = value;
412
+ this.updateLabels(this.options.page);
413
+ };
414
+
415
+ Iconpicker.prototype.setPlacement = function (value) {
416
+ this.options.placement = value;
417
+ };
418
+
419
+ Iconpicker.prototype.setRows = function (value) {
420
+ this.options.rows = value;
421
+ this.reset();
422
+ };
423
+
424
+ Iconpicker.prototype.setSearch = function (value) {
425
+ var search = this.options.table.find('.search-control');
426
+ if (value === true) {
427
+ search.show();
428
+ }
429
+ else {
430
+ search.hide();
431
+ }
432
+ search.val('');
433
+ this.changeList(1);
434
+ this.options.search = value;
435
+ };
436
+
437
+ Iconpicker.prototype.setSearchText = function (value) {
438
+ this.options.table.find('.search-control').attr('placeholder', value);
439
+ this.options.searchText = value;
440
+ };
441
+
442
+ Iconpicker.prototype.setSelectedClass = function (value) {
443
+ this.options.selectedClass = this.removeAddClass('.btn-icon-selected', this.options.selectedClass, value);
444
+ };
445
+
446
+ Iconpicker.prototype.setUnselectedClass = function (value) {
447
+ this.options.unselectedClass = this.removeAddClass('.btn-icon', this.options.unselectedClass, value);
448
+ };
449
+
450
+ // ICONPICKER PLUGIN DEFINITION
451
+ // ========================
452
+ var old = $.fn.iconpicker;
453
+ $.fn.iconpicker = function (option, params) {
454
+ return this.each(function () {
455
+ var $this = $(this);
456
+ var data = $this.data('bs.iconpicker');
457
+ var options = typeof option === 'object' && option;
458
+ if (!data) {
459
+ $this.data('bs.iconpicker', (data = new Iconpicker(this, options)));
460
+ }
461
+ if (typeof option === 'string') {
462
+ if (typeof data[option] === 'undefined') {
463
+ throw 'Iconpicker => The "' + option + '" method does not exists.';
464
+ }
465
+ else {
466
+ data[option](params);
467
+ }
468
+ }
469
+ else{
470
+ var op = data.options;
471
+ op = $.extend(op, {
472
+ inline: false,
473
+ page: 1,
474
+ selected: -1,
475
+ table: $('<table class="table-icons"><thead></thead><tbody></tbody><tfoot></tfoot></table>')
476
+ });
477
+ var name = (typeof $this.attr('name') !== 'undefined') ? 'name="' + $this.attr('name') + '"' : '';
478
+
479
+ if($this.prop('tagName') === 'BUTTON'){
480
+ $this.empty()
481
+ .append('<i></i>')
482
+ .append('<input type="hidden" ' + name + '></input>')
483
+ .append('<span class="caret"></span>')
484
+ .addClass('iconpicker ' + (($.fn.bsVersion() === '3.x') ? '' : 'dropdown-toggle'));
485
+ data.setIconset(op.iconset);
486
+ $this.on('click', function(e) {
487
+ e.preventDefault();
488
+ $this.popover({
489
+ animation: false,
490
+ trigger: 'manual',
491
+ html: true,
492
+ content: op.table,
493
+ container: 'body',
494
+ placement: op.placement
495
+ }).on('inserted.bs.popover', function() {
496
+ var el = $this.data('bs.popover');
497
+ var tip = ($.fn.bsVersion() === '3.x') ? el.tip()
498
+ : ($.fn.bsVersion() === '5.x')
499
+ ? $(bootstrap.Popover.getInstance($this).getTipElement())
500
+ : $(el.getTipElement())
501
+
502
+ tip.addClass('iconpicker-popover');
503
+ }).on('shown.bs.popover', function () {
504
+ data.switchPage(op.icon);
505
+ data.bindEvents();
506
+ });
507
+ //console.log($.fn.bsVersion());
508
+ $this.popover('show');
509
+ });
510
+ }
511
+ else{
512
+ op.inline = true;
513
+ data.setIconset(op.iconset);
514
+ $this.empty()
515
+ .append('<input type="hidden" ' + name + '></input>')
516
+ .append(op.table)
517
+ .addClass('iconpicker')
518
+ .addClass(op.align);
519
+ data.switchPage(op.icon);
520
+ data.bindEvents();
521
+ }
522
+
523
+ }
524
+ });
525
+ };
526
+
527
+ $.fn.iconpicker.Constructor = Iconpicker;
528
+
529
+ // ICONPICKER NO CONFLICT
530
+ // ==================
531
+ $.fn.iconpicker.noConflict = function () {
532
+ $.fn.iconpicker = old;
533
+ return this;
534
+ };
535
+
536
+ $.fn.bsVersion = function() {
537
+ return $.fn.popover.Constructor.VERSION.substr(0,2) + 'x';
538
+ };
539
+
540
+ // ICONPICKER DATA-API
541
+ // ===============
542
+ $(document).on('click', 'body', function (e) {
543
+ $('.iconpicker').each(function () {
544
+ //the 'is' for buttons that trigger popups
545
+ //the 'has' for icons within a button that triggers a popup
546
+ if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
547
+ $(this).popover(($.fn.bsVersion() === '3.x') ? 'destroy' : 'dispose');
548
+ }
549
+ });
550
+ });
551
+
552
+ $('button[role="iconpicker"],div[role="iconpicker"]').iconpicker();
553
+
554
+ })(jQuery);
@@ -169,8 +169,7 @@ function tabulator_error_handler(request) {
169
169
  function tabulator_show_error(errtxt) {
170
170
  $("#jsGridNotify").html(`<div class="alert alert-danger" role="alert">
171
171
  ${errtxt}
172
- <button type="button" class="close" data-dismiss="alert" aria-label="Close">
173
- <span aria-hidden="true">&times;</span>
172
+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
174
173
  </button>
175
174
  </div>`);
176
175
  }