datavis-glide 4.0.0-PRE.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/LICENSE +45 -0
- package/README.md +129 -0
- package/datavis.js +101 -0
- package/dist/wcdatavis.css +1957 -0
- package/dist/wcdatavis.min.js +1 -0
- package/global-jquery.js +4 -0
- package/ie-fixes.js +13 -0
- package/index.js +70 -0
- package/meteor.js +1 -0
- package/package.json +102 -0
- package/src/flags.js +6 -0
- package/src/graph.js +1079 -0
- package/src/graph_renderer.js +85 -0
- package/src/grid.js +2777 -0
- package/src/grid_control.js +1957 -0
- package/src/grid_filter.js +1073 -0
- package/src/grid_renderer.js +276 -0
- package/src/group_fun_win.js +121 -0
- package/src/lang/en-US.js +188 -0
- package/src/lang/es-MX.js +188 -0
- package/src/lang/fr-FR.js +188 -0
- package/src/lang/id-ID.js +188 -0
- package/src/lang/nl-NL.js +188 -0
- package/src/lang/pt-BR.js +188 -0
- package/src/lang/ru-RU.js +188 -0
- package/src/lang/th-TH.js +188 -0
- package/src/lang/vi-VN.js +188 -0
- package/src/lang/zh-Hans-CN.js +188 -0
- package/src/operations_palette.js +176 -0
- package/src/prefs_modules.js +132 -0
- package/src/reg/graph_renderer.js +17 -0
- package/src/renderers/graph/chartjs.js +457 -0
- package/src/renderers/graph/google.js +584 -0
- package/src/renderers/graph/jit.js +61 -0
- package/src/renderers/graph/svelte-gantt.js +168 -0
- package/src/renderers/grid/dummy.js +79 -0
- package/src/renderers/grid/handlebars.js +217 -0
- package/src/renderers/grid/squirrelly.js +215 -0
- package/src/renderers/grid/table/group_detail.js +1404 -0
- package/src/renderers/grid/table/group_summary.js +380 -0
- package/src/renderers/grid/table/pivot.js +915 -0
- package/src/renderers/grid/table/plain.js +1592 -0
- package/src/renderers/grid/table.js +2510 -0
- package/src/trans.js +101 -0
- package/src/ui/collapsible.js +234 -0
- package/src/ui/filters/date.js +283 -0
- package/src/ui/grid_filter.js +398 -0
- package/src/ui/popup_menu.js +224 -0
- package/src/ui/popup_window.js +572 -0
- package/src/ui/slider.js +156 -0
- package/src/ui/tabs.js +202 -0
- package/src/ui/templates.js +131 -0
- package/src/ui/toolbar.js +63 -0
- package/src/ui/toolbars/grid.js +873 -0
- package/src/ui/windows/col_config.js +341 -0
- package/src/ui/windows/debug.js +164 -0
- package/src/ui/windows/grid_table_opts.js +139 -0
- package/src/util/handlebars.js +158 -0
- package/src/util/jquery.js +630 -0
- package/src/util/misc.js +1058 -0
- package/src/util/squirrelly.js +155 -0
- package/wcdatavis.css +1601 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import _ from 'underscore';
|
|
2
|
+
|
|
3
|
+
import jQuery from 'jquery';
|
|
4
|
+
|
|
5
|
+
import { trans } from '../../trans.js';
|
|
6
|
+
import {
|
|
7
|
+
getPropDef,
|
|
8
|
+
icon,
|
|
9
|
+
makeSubclass,
|
|
10
|
+
moveArrayElement,
|
|
11
|
+
} from '../../util/misc.js';
|
|
12
|
+
import { PopupWindow } from '../popup_window.js';
|
|
13
|
+
|
|
14
|
+
// ColConfigWin {{{1
|
|
15
|
+
|
|
16
|
+
var ColConfigWin = makeSubclass('ColConfigWin', Object, function (grid) {
|
|
17
|
+
var self = this;
|
|
18
|
+
|
|
19
|
+
self.grid = grid;
|
|
20
|
+
|
|
21
|
+
grid.on('colConfigUpdate', function (colConfig, initColConfig) {
|
|
22
|
+
self.colConfig = colConfig;
|
|
23
|
+
self.initColConfig = initColConfig;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// #show {{{2
|
|
28
|
+
|
|
29
|
+
ColConfigWin.prototype.show = function (posElt, onSave) {
|
|
30
|
+
var self = this;
|
|
31
|
+
|
|
32
|
+
var current = self.colConfig.clone();
|
|
33
|
+
|
|
34
|
+
var pw = new PopupWindow({
|
|
35
|
+
title: trans('GRID.COLCONFIG_WIN.TITLE'),
|
|
36
|
+
width: 600
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
pw.on('close', function () {
|
|
40
|
+
pw.destroy();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var pinnedCount = 0;
|
|
44
|
+
|
|
45
|
+
var contentDiv = jQuery('<div>');
|
|
46
|
+
|
|
47
|
+
var colTable = jQuery('<table>')
|
|
48
|
+
.addClass('wcdv_colconfigwin_table')
|
|
49
|
+
.appendTo(jQuery('<div>').css({
|
|
50
|
+
'max-height': '40ex',
|
|
51
|
+
'overflow-y': 'scroll'
|
|
52
|
+
}).appendTo(contentDiv));
|
|
53
|
+
|
|
54
|
+
var colTableHeader = jQuery('<thead>' +
|
|
55
|
+
'<th class="wcdv_bottom_border_teal wcdv_width_1em"></th>' +
|
|
56
|
+
'<th class="wcdv_bottom_border_teal">' + trans('GRID.COLCONFIG_WIN.TBL.FIELD') + '</th>' +
|
|
57
|
+
'<th class="wcdv_bottom_border_teal">' + trans('GRID.COLCONFIG_WIN.TBL.DISPLAY') + '</th>' +
|
|
58
|
+
'<th colspan="7" class="wcdv_bottom_border_teal">' + trans('GRID.COLCONFIG_WIN.TBL.OPTIONS') + '</th>' +
|
|
59
|
+
'</thead>')
|
|
60
|
+
.appendTo(colTable);
|
|
61
|
+
|
|
62
|
+
var keys = current.keys();
|
|
63
|
+
|
|
64
|
+
var colTableBody = jQuery('<tbody>')
|
|
65
|
+
._makeSortableTable(function (oldIndex, newIndex) {
|
|
66
|
+
colTableBody.children('tr').eq(newIndex).effect('highlight', 750);
|
|
67
|
+
moveArrayElement(keys, oldIndex, newIndex);
|
|
68
|
+
})
|
|
69
|
+
.appendTo(colTable);
|
|
70
|
+
|
|
71
|
+
var trsByField = {};
|
|
72
|
+
var clearRenderCache = [];
|
|
73
|
+
|
|
74
|
+
current.each(function (colConfig, field) {
|
|
75
|
+
var tr, td;
|
|
76
|
+
|
|
77
|
+
tr = jQuery('<tr>', {
|
|
78
|
+
'data-field': field
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
trsByField[field] = tr;
|
|
82
|
+
|
|
83
|
+
td = jQuery('<td>')
|
|
84
|
+
.addClass('wcdv_width_1em')
|
|
85
|
+
.appendTo(tr);
|
|
86
|
+
|
|
87
|
+
jQuery('<button>', {
|
|
88
|
+
'type': 'button',
|
|
89
|
+
'title': trans('GRID.COLCONFIG_WIN.REORDER_COLS')
|
|
90
|
+
})
|
|
91
|
+
.addClass('wcdv_icon_button drag-handle wcdv_button_right')
|
|
92
|
+
.append(icon('menu'))
|
|
93
|
+
.appendTo(td);
|
|
94
|
+
|
|
95
|
+
td = jQuery('<td>')
|
|
96
|
+
.text(field)
|
|
97
|
+
.appendTo(tr);
|
|
98
|
+
|
|
99
|
+
td = jQuery('<td>')
|
|
100
|
+
.css('color', colConfig.displayText ? '#000000' : '#C0C0C0')
|
|
101
|
+
.text(colConfig.displayText || field)
|
|
102
|
+
.appendTo(tr);
|
|
103
|
+
var displayTextTd = td;
|
|
104
|
+
|
|
105
|
+
td = jQuery('<td>')
|
|
106
|
+
.addClass('wcdv_width_1em')
|
|
107
|
+
.appendTo(tr);
|
|
108
|
+
|
|
109
|
+
var renameBtn = jQuery('<button>', {
|
|
110
|
+
'type': 'button',
|
|
111
|
+
'title': trans('GRID.COLCONFIG_WIN.RENAME_COL')
|
|
112
|
+
})
|
|
113
|
+
.addClass('wcdv_icon_button')
|
|
114
|
+
.append(icon('pencil'))
|
|
115
|
+
.on('click', function () {
|
|
116
|
+
var newName = prompt(trans('GRID.COLCONFIG_WIN.RENAME_COL.PROMPT', field));
|
|
117
|
+
|
|
118
|
+
if (newName) {
|
|
119
|
+
colConfig.displayText = newName;
|
|
120
|
+
displayTextTd
|
|
121
|
+
.css('color', colConfig.displayText ? '#000000' : '#C0C0C0')
|
|
122
|
+
.text(newName);
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
.appendTo(td)
|
|
126
|
+
;
|
|
127
|
+
|
|
128
|
+
td = jQuery('<td>', {
|
|
129
|
+
'data-prop': 'isPinned'
|
|
130
|
+
})
|
|
131
|
+
.addClass('wcdv_width_1em')
|
|
132
|
+
.appendTo(tr);
|
|
133
|
+
|
|
134
|
+
var isPinnedCheckbox = jQuery('<input>', {
|
|
135
|
+
'type': 'checkbox',
|
|
136
|
+
'title': trans('GRID.COLCONFIG_WIN.PIN_COL')
|
|
137
|
+
})
|
|
138
|
+
.prop('checked', getPropDef(false, colConfig, 'isPinned'))
|
|
139
|
+
.on('change', function () {
|
|
140
|
+
colConfig.isPinned = isPinnedCheckbox.prop('checked');
|
|
141
|
+
if (colConfig.isPinned) {
|
|
142
|
+
pinnedCount += 1;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
pinnedCount -= 1;
|
|
146
|
+
}
|
|
147
|
+
if (pinnedCount > 0) {
|
|
148
|
+
pinnedMsg.show();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
pinnedMsg.hide();
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
.appendTo(td)
|
|
155
|
+
._makeIconCheckbox('pin');
|
|
156
|
+
|
|
157
|
+
if (getPropDef(false, colConfig, 'isPinned')) {
|
|
158
|
+
pinnedCount += 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
td = jQuery('<td>', {
|
|
162
|
+
'data-prop': 'isHidden'
|
|
163
|
+
})
|
|
164
|
+
.addClass('wcdv_width_1em')
|
|
165
|
+
.appendTo(tr);
|
|
166
|
+
|
|
167
|
+
var isHiddenCheckbox = jQuery('<input>', {
|
|
168
|
+
'type': 'checkbox',
|
|
169
|
+
'title': trans('GRID.COLCONFIG_WIN.HIDE_COL')
|
|
170
|
+
})
|
|
171
|
+
.prop('disabled', !getPropDef(true, colConfig, 'canHide'))
|
|
172
|
+
.prop('checked', getPropDef(false, colConfig, 'isHidden'))
|
|
173
|
+
.on('change', function () {
|
|
174
|
+
colConfig.isHidden = isHiddenCheckbox.prop('checked');
|
|
175
|
+
})
|
|
176
|
+
.appendTo(td)
|
|
177
|
+
._makeIconCheckbox('ban');
|
|
178
|
+
|
|
179
|
+
td = jQuery('<td>', {
|
|
180
|
+
'data-prop': 'allowHtml'
|
|
181
|
+
})
|
|
182
|
+
.addClass('wcdv_width_1em')
|
|
183
|
+
.appendTo(tr);
|
|
184
|
+
|
|
185
|
+
var allowHtmlCheckbox = jQuery('<input>', {
|
|
186
|
+
'type': 'checkbox',
|
|
187
|
+
'title': trans('GRID.COLCONFIG_WIN.ALLOW_HTML')
|
|
188
|
+
})
|
|
189
|
+
.prop('checked', getPropDef(false, colConfig, 'allowHtml'))
|
|
190
|
+
.on('change', function () {
|
|
191
|
+
colConfig.allowHtml = allowHtmlCheckbox.prop('checked');
|
|
192
|
+
})
|
|
193
|
+
.appendTo(td)
|
|
194
|
+
._makeIconCheckbox('code');
|
|
195
|
+
|
|
196
|
+
td = jQuery('<td>', {
|
|
197
|
+
'data-prop': 'allowFormatting'
|
|
198
|
+
})
|
|
199
|
+
.addClass('wcdv_width_1em')
|
|
200
|
+
.appendTo(tr);
|
|
201
|
+
|
|
202
|
+
var allowFormattingCheckbox = jQuery('<input>', {
|
|
203
|
+
'type': 'checkbox',
|
|
204
|
+
'title': trans('GRID.COLCONFIG_WIN.ALLOW_FORMATTING')
|
|
205
|
+
})
|
|
206
|
+
.prop('checked', getPropDef(false, colConfig, 'allowFormatting'))
|
|
207
|
+
.on('change', function () {
|
|
208
|
+
if (clearRenderCache.indexOf(field) >= 0) {
|
|
209
|
+
clearRenderCache = _.without(clearRenderCache, field);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
clearRenderCache.push(field);
|
|
213
|
+
}
|
|
214
|
+
colConfig.allowFormatting = allowFormattingCheckbox.prop('checked');
|
|
215
|
+
})
|
|
216
|
+
.appendTo(td)
|
|
217
|
+
._makeIconCheckbox('paintbrush');
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
td = jQuery('<td>')
|
|
221
|
+
.addClass('wcdv_width_1em')
|
|
222
|
+
.appendTo(tr);
|
|
223
|
+
|
|
224
|
+
var configBtn = jQuery('<button>', {'type': 'button', 'title': 'Click to configure column'})
|
|
225
|
+
.addClass('wcdv_icon_button')
|
|
226
|
+
.append(icon('settings'))
|
|
227
|
+
.on('click', function () {
|
|
228
|
+
self.showConfigWin(field);
|
|
229
|
+
})
|
|
230
|
+
.appendTo(td);
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
td = jQuery('<td>')
|
|
234
|
+
.addClass('wcdv_width_1em')
|
|
235
|
+
.appendTo(tr);
|
|
236
|
+
|
|
237
|
+
jQuery('<button>', {
|
|
238
|
+
'type': 'button',
|
|
239
|
+
'title': trans('GRID.COLCONFIG_WIN.MOVE_COL_TO_TOP')
|
|
240
|
+
})
|
|
241
|
+
.addClass('wcdv_icon_button wcdv_button_left')
|
|
242
|
+
.on('click', function () {
|
|
243
|
+
var oldIndex = tr.index();
|
|
244
|
+
colTableBody.prepend(tr);
|
|
245
|
+
var newIndex = tr.index();
|
|
246
|
+
colTableBody.children('tr').eq(oldIndex).effect('highlight', 750);
|
|
247
|
+
colTableBody.children('tr').eq(newIndex).effect('highlight', 750);
|
|
248
|
+
moveArrayElement(keys, oldIndex, newIndex);
|
|
249
|
+
})
|
|
250
|
+
.append(icon('chevrons-up'))
|
|
251
|
+
.appendTo(td);
|
|
252
|
+
|
|
253
|
+
td = jQuery('<td>')
|
|
254
|
+
.addClass('wcdv_width_1em')
|
|
255
|
+
.appendTo(tr);
|
|
256
|
+
|
|
257
|
+
jQuery('<button>', {
|
|
258
|
+
'type': 'button',
|
|
259
|
+
'title': trans('GRID.COLCONFIG_WIN.MOVE_COL_TO_BOTTOM')
|
|
260
|
+
})
|
|
261
|
+
.addClass('wcdv_icon_button wcdv_button_left')
|
|
262
|
+
.on('click', function () {
|
|
263
|
+
var oldIndex = tr.index();
|
|
264
|
+
colTableBody.append(tr);
|
|
265
|
+
var newIndex = tr.index();
|
|
266
|
+
colTableBody.children('tr').eq(oldIndex).effect('highlight', 750);
|
|
267
|
+
colTableBody.children('tr').eq(newIndex).effect('highlight', 750);
|
|
268
|
+
moveArrayElement(keys, oldIndex, newIndex);
|
|
269
|
+
})
|
|
270
|
+
.append(icon('chevrons-down'))
|
|
271
|
+
.appendTo(td);
|
|
272
|
+
|
|
273
|
+
tr.appendTo(colTableBody);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
var pinnedMsg = jQuery('<div>')
|
|
277
|
+
.addClass('wcdv_dlg_info_banner')
|
|
278
|
+
.append(icon('info'))
|
|
279
|
+
.append(' ')
|
|
280
|
+
.append(trans('GRID.COLCONFIG_WIN.PINNED_COL_WARNING'))
|
|
281
|
+
.hide()
|
|
282
|
+
.appendTo(contentDiv);
|
|
283
|
+
|
|
284
|
+
if (pinnedCount > 0) {
|
|
285
|
+
pinnedMsg.show();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
pw.setContent(contentDiv);
|
|
289
|
+
|
|
290
|
+
var buttons = [];
|
|
291
|
+
|
|
292
|
+
if (self.initColConfig) {
|
|
293
|
+
buttons.push({
|
|
294
|
+
icon: 'undo-2',
|
|
295
|
+
label: trans('GRID.COLCONFIG_WIN.RESET_COL_ORDER'),
|
|
296
|
+
callback: function () {
|
|
297
|
+
keys = self.initColConfig.keys();
|
|
298
|
+
_.each(keys, function (k) {
|
|
299
|
+
if (trsByField[k] !== null) {
|
|
300
|
+
colTableBody.append(trsByField[k]);
|
|
301
|
+
trsByField[k].effect('highlight', 750);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
buttons.push({
|
|
309
|
+
icon: 'check',
|
|
310
|
+
label: trans('DIALOG.OK'),
|
|
311
|
+
attrs: {'data-role': 'ok'},
|
|
312
|
+
callback: function () {
|
|
313
|
+
self.colConfig.clear();
|
|
314
|
+
_.each(keys, function (k) {
|
|
315
|
+
self.colConfig.set(k, current.get(k));
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
pw.close();
|
|
319
|
+
onSave(self.colConfig, {
|
|
320
|
+
clearRenderCache: clearRenderCache.length > 0 ? clearRenderCache : null
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
buttons.push({
|
|
326
|
+
icon: 'ban',
|
|
327
|
+
label: trans('DIALOG.CANCEL'),
|
|
328
|
+
attrs: {'data-role': 'cancel'},
|
|
329
|
+
callback: function () {
|
|
330
|
+
pw.close();
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
pw.setButtons(buttons);
|
|
335
|
+
|
|
336
|
+
pw.open();
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
ColConfigWin
|
|
341
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import _ from 'underscore';
|
|
2
|
+
import JSONFormatter from 'json-formatter-js';
|
|
3
|
+
|
|
4
|
+
import { OrdMap } from 'datavis-ace';
|
|
5
|
+
|
|
6
|
+
import jQuery from 'jquery';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
makeSubclass,
|
|
10
|
+
ordmapAsHtmlDefnList,
|
|
11
|
+
} from '../../util/misc.js';
|
|
12
|
+
import { PopupWindow } from '../popup_window.js';
|
|
13
|
+
import { Tabs } from '../tabs.js';
|
|
14
|
+
import { Collapsible } from '../collapsible.js';
|
|
15
|
+
|
|
16
|
+
// DebugWin {{{1
|
|
17
|
+
|
|
18
|
+
var DebugWin = makeSubclass('DebugWin', Object, function () {
|
|
19
|
+
var self = this;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// #show {{{2
|
|
23
|
+
|
|
24
|
+
DebugWin.prototype.show = function (grid, view, source) {
|
|
25
|
+
var self = this;
|
|
26
|
+
|
|
27
|
+
var pw = new PopupWindow({
|
|
28
|
+
title: 'Debug Info',
|
|
29
|
+
width: 600,
|
|
30
|
+
maxHeight: 600,
|
|
31
|
+
position: {
|
|
32
|
+
my: 'center',
|
|
33
|
+
at: 'middle',
|
|
34
|
+
of: window
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
pw.on('close', function () {
|
|
39
|
+
pw.destroy();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var tabs = [{
|
|
43
|
+
name: 'Source',
|
|
44
|
+
id: 'sourceTab',
|
|
45
|
+
items: [{
|
|
46
|
+
name: 'Configuration',
|
|
47
|
+
elt: (function () {
|
|
48
|
+
var info = new OrdMap();
|
|
49
|
+
info.set('Source type', source.type);
|
|
50
|
+
info.set('Source name', source.name);
|
|
51
|
+
info.set('Source spec', source.origin.spec);
|
|
52
|
+
return jQuery('<div>')
|
|
53
|
+
.append(ordmapAsHtmlDefnList(info));
|
|
54
|
+
})()
|
|
55
|
+
}, {
|
|
56
|
+
name: 'Params',
|
|
57
|
+
elt: jQuery('<div>')
|
|
58
|
+
.append(new JSONFormatter(source.params, 0).render())
|
|
59
|
+
}, {
|
|
60
|
+
name: 'Type Info',
|
|
61
|
+
elt: jQuery('<div>')
|
|
62
|
+
.append(new JSONFormatter(source.cache.typeInfo.asMap(), 0).render())
|
|
63
|
+
}]
|
|
64
|
+
}, {
|
|
65
|
+
name: 'View',
|
|
66
|
+
id: 'viewTab',
|
|
67
|
+
items: [{
|
|
68
|
+
name: 'Current Config',
|
|
69
|
+
elt: (function () {
|
|
70
|
+
var info = new OrdMap();
|
|
71
|
+
info.set('View name', view.name);
|
|
72
|
+
info.set('Filter config', view.getFilter());
|
|
73
|
+
info.set('Group config', view.getGroup());
|
|
74
|
+
info.set('Pivot config', view.getPivot());
|
|
75
|
+
info.set('Aggregate config', view.getAggregate());
|
|
76
|
+
return jQuery('<div>')
|
|
77
|
+
.append(ordmapAsHtmlDefnList(info));
|
|
78
|
+
})()
|
|
79
|
+
}]
|
|
80
|
+
}, {
|
|
81
|
+
name: 'Grid',
|
|
82
|
+
id: 'gridTab',
|
|
83
|
+
items: [{
|
|
84
|
+
name: 'Columns',
|
|
85
|
+
elt: jQuery('<div>')
|
|
86
|
+
.append(new JSONFormatter(grid.colConfig.asMap(), 0).render())
|
|
87
|
+
}]
|
|
88
|
+
}, {
|
|
89
|
+
name: 'Prefs',
|
|
90
|
+
id: 'prefsTab',
|
|
91
|
+
items: [{
|
|
92
|
+
name: 'Configuration',
|
|
93
|
+
elt: (function () {
|
|
94
|
+
var info = new OrdMap();
|
|
95
|
+
info.set('Auto-Save', grid.prefs.opts.autoSave);
|
|
96
|
+
info.set('Backend Type', grid.prefs.opts.backend.type);
|
|
97
|
+
info.set('Current Perspective', jQuery('<span>' + grid.prefs.currentPerspective.id + '<br/><i>' + grid.prefs.currentPerspective.name + '</i></span>'));
|
|
98
|
+
info.set('Bardo', grid.prefs.bardo);
|
|
99
|
+
return jQuery('<div>')
|
|
100
|
+
.append(ordmapAsHtmlDefnList(info));
|
|
101
|
+
})()
|
|
102
|
+
}, {
|
|
103
|
+
name: 'Perspectives',
|
|
104
|
+
elt: (function () {
|
|
105
|
+
var info = new OrdMap();
|
|
106
|
+
_.each(grid.prefs.perspectives, function (p) {
|
|
107
|
+
info.set(p.id, {
|
|
108
|
+
'Name': p.name,
|
|
109
|
+
'Config': p.config,
|
|
110
|
+
'Status': p.isUnsaved ? 'Modified' : 'Saved'
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return jQuery('<div>')
|
|
114
|
+
.append(ordmapAsHtmlDefnList(info));
|
|
115
|
+
})()
|
|
116
|
+
}]
|
|
117
|
+
}];
|
|
118
|
+
|
|
119
|
+
var tabsDiv = jQuery('<div>').css({
|
|
120
|
+
'flex': 'auto',
|
|
121
|
+
'overflow': 'hidden',
|
|
122
|
+
'display': 'flex',
|
|
123
|
+
'flex-direction': 'column'
|
|
124
|
+
});
|
|
125
|
+
var tabsWidget = new Tabs(tabsDiv);
|
|
126
|
+
_.each(tabs, function (t) {
|
|
127
|
+
var container = jQuery('<div>').css({
|
|
128
|
+
'flex-grow': '1',
|
|
129
|
+
'flex-shrink': '1',
|
|
130
|
+
'flex-basis': 'auto',
|
|
131
|
+
'overflow': 'scroll'
|
|
132
|
+
});
|
|
133
|
+
var collapsible = new Collapsible(container);
|
|
134
|
+
_.each(t.items, function (ti) {
|
|
135
|
+
collapsible.addSection(ti.name, ti.elt);
|
|
136
|
+
});
|
|
137
|
+
tabsWidget.addPage(t.name, container);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
var contentDiv = jQuery('<div>').css({
|
|
141
|
+
'display': 'flex',
|
|
142
|
+
'flex-direction': 'column',
|
|
143
|
+
'flex': '1',
|
|
144
|
+
'overflow': 'hidden',
|
|
145
|
+
'min-height': '0'
|
|
146
|
+
}).append(tabsDiv);
|
|
147
|
+
|
|
148
|
+
pw.setContent(contentDiv);
|
|
149
|
+
|
|
150
|
+
var words = ['Very Cool', 'Thanks', 'Nice!', 'All Right', 'Whatever'];
|
|
151
|
+
pw.setButtons([{
|
|
152
|
+
icon: 'thumbs-up',
|
|
153
|
+
label: words[Math.floor(Math.random() * words.length)],
|
|
154
|
+
callback: function () {
|
|
155
|
+
pw.close();
|
|
156
|
+
}
|
|
157
|
+
}]);
|
|
158
|
+
|
|
159
|
+
pw.open();
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export {
|
|
163
|
+
DebugWin
|
|
164
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _ from 'underscore';
|
|
2
|
+
|
|
3
|
+
import jQuery from 'jquery';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
deepCopy,
|
|
7
|
+
deepDefaults,
|
|
8
|
+
makeSubclass,
|
|
9
|
+
getPropDef,
|
|
10
|
+
} from '../../util/misc.js';
|
|
11
|
+
|
|
12
|
+
import GridTable from '../../renderers/grid/table.js';
|
|
13
|
+
import { PopupWindow } from '../popup_window.js';
|
|
14
|
+
|
|
15
|
+
// GridTableOptsWin {{{1
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @class
|
|
19
|
+
*
|
|
20
|
+
* @property {GridTable} renderer
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var GridTableOptsWin = makeSubclass('GridTableOptsWin', Object, function (renderer) {
|
|
24
|
+
var self = this;
|
|
25
|
+
|
|
26
|
+
if (!(renderer instanceof GridTable)) {
|
|
27
|
+
throw new Error('Call Error: `renderer` must be an instance of GridTable');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
self.renderer = renderer;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// #show {{{2
|
|
34
|
+
|
|
35
|
+
GridTableOptsWin.prototype.show = function (onSave) {
|
|
36
|
+
var self = this;
|
|
37
|
+
|
|
38
|
+
var curOpts = deepCopy(self.renderer.opts);
|
|
39
|
+
var canGroup = self.renderer.canRender('group');
|
|
40
|
+
var canPivot = self.renderer.canRender('pivot');
|
|
41
|
+
|
|
42
|
+
var ui = {};
|
|
43
|
+
|
|
44
|
+
var pw = new PopupWindow({
|
|
45
|
+
title: 'Columns',
|
|
46
|
+
width: 600,
|
|
47
|
+
buttons: [{
|
|
48
|
+
icon: 'check',
|
|
49
|
+
label: 'OK',
|
|
50
|
+
callback: function () {
|
|
51
|
+
curOpts = deepDefaults(curOpts, {
|
|
52
|
+
displayFormat: {}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (canPivot && ui.cellChk.prop('checked')) {
|
|
56
|
+
curOpts.displayFormat.cell = [ui.cellText.val()];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
if ((canGroup || canPivot) && ui.groupChk.prop('checked')) {
|
|
61
|
+
curOpts.displayFormat.group = [ui.groupText.val()];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (canPivot && ui.pivotChk.prop('checked')) {
|
|
65
|
+
curOpts.displayFormat.pivot = [ui.pivotText.val()];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if ((canGroup || canPivot) && ui.allChk.prop('checked')) {
|
|
69
|
+
curOpts.displayFormat.all = [ui.allText.val()];
|
|
70
|
+
}
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
pw.close();
|
|
74
|
+
onSave(curOpts);
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
icon: 'ban',
|
|
78
|
+
label: 'Cancel',
|
|
79
|
+
callback: function () {
|
|
80
|
+
pw.close();
|
|
81
|
+
}
|
|
82
|
+
}]
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
pw.on('close', function () {
|
|
86
|
+
pw.destroy();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
ui.root = jQuery('<div>');
|
|
90
|
+
|
|
91
|
+
var inputs = [{
|
|
92
|
+
field: 'cell',
|
|
93
|
+
available: canPivot,
|
|
94
|
+
label: 'Customize cell display',
|
|
95
|
+
}/*, {
|
|
96
|
+
field: 'group',
|
|
97
|
+
available: canGroup || canPivot,
|
|
98
|
+
label: 'Customize group display',
|
|
99
|
+
}, {
|
|
100
|
+
field: 'pivot',
|
|
101
|
+
available: canPivot,
|
|
102
|
+
label: 'Customize pivot display',
|
|
103
|
+
}, {
|
|
104
|
+
field: 'all',
|
|
105
|
+
available: canGroup || canPivot,
|
|
106
|
+
label: 'Customize total display',
|
|
107
|
+
}*/];
|
|
108
|
+
|
|
109
|
+
_.each(inputs, function (input) {
|
|
110
|
+
if (input.available) {
|
|
111
|
+
var curVal = getPropDef('', curOpts, 'displayFormat', input.field);
|
|
112
|
+
|
|
113
|
+
var checkbox = jQuery('<input>', {type: 'checkbox', checked: !!curVal});
|
|
114
|
+
var textarea = jQuery('<textarea>', {cols: 60}).css({display: 'block', fontFamily: 'monospace', marginTop: '1ex'}).val(curVal);
|
|
115
|
+
var label = jQuery('<label>').css({display: 'block', marginTop: '1ex'}).append(checkbox).append(input.label);
|
|
116
|
+
|
|
117
|
+
checkbox.on('change', function () {
|
|
118
|
+
textarea.toggle();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
ui[input.field + 'Chk'] = checkbox;
|
|
122
|
+
ui[input.field + 'Text'] = textarea;
|
|
123
|
+
|
|
124
|
+
ui.root.append(label);
|
|
125
|
+
ui.root.append(textarea);
|
|
126
|
+
|
|
127
|
+
if (!curVal) {
|
|
128
|
+
textarea.hide();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
pw.setContent(ui.root);
|
|
134
|
+
pw.open();
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
GridTableOptsWin
|
|
139
|
+
};
|