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.
Files changed (62) hide show
  1. package/LICENSE +45 -0
  2. package/README.md +129 -0
  3. package/datavis.js +101 -0
  4. package/dist/wcdatavis.css +1957 -0
  5. package/dist/wcdatavis.min.js +1 -0
  6. package/global-jquery.js +4 -0
  7. package/ie-fixes.js +13 -0
  8. package/index.js +70 -0
  9. package/meteor.js +1 -0
  10. package/package.json +102 -0
  11. package/src/flags.js +6 -0
  12. package/src/graph.js +1079 -0
  13. package/src/graph_renderer.js +85 -0
  14. package/src/grid.js +2777 -0
  15. package/src/grid_control.js +1957 -0
  16. package/src/grid_filter.js +1073 -0
  17. package/src/grid_renderer.js +276 -0
  18. package/src/group_fun_win.js +121 -0
  19. package/src/lang/en-US.js +188 -0
  20. package/src/lang/es-MX.js +188 -0
  21. package/src/lang/fr-FR.js +188 -0
  22. package/src/lang/id-ID.js +188 -0
  23. package/src/lang/nl-NL.js +188 -0
  24. package/src/lang/pt-BR.js +188 -0
  25. package/src/lang/ru-RU.js +188 -0
  26. package/src/lang/th-TH.js +188 -0
  27. package/src/lang/vi-VN.js +188 -0
  28. package/src/lang/zh-Hans-CN.js +188 -0
  29. package/src/operations_palette.js +176 -0
  30. package/src/prefs_modules.js +132 -0
  31. package/src/reg/graph_renderer.js +17 -0
  32. package/src/renderers/graph/chartjs.js +457 -0
  33. package/src/renderers/graph/google.js +584 -0
  34. package/src/renderers/graph/jit.js +61 -0
  35. package/src/renderers/graph/svelte-gantt.js +168 -0
  36. package/src/renderers/grid/dummy.js +79 -0
  37. package/src/renderers/grid/handlebars.js +217 -0
  38. package/src/renderers/grid/squirrelly.js +215 -0
  39. package/src/renderers/grid/table/group_detail.js +1404 -0
  40. package/src/renderers/grid/table/group_summary.js +380 -0
  41. package/src/renderers/grid/table/pivot.js +915 -0
  42. package/src/renderers/grid/table/plain.js +1592 -0
  43. package/src/renderers/grid/table.js +2510 -0
  44. package/src/trans.js +101 -0
  45. package/src/ui/collapsible.js +234 -0
  46. package/src/ui/filters/date.js +283 -0
  47. package/src/ui/grid_filter.js +398 -0
  48. package/src/ui/popup_menu.js +224 -0
  49. package/src/ui/popup_window.js +572 -0
  50. package/src/ui/slider.js +156 -0
  51. package/src/ui/tabs.js +202 -0
  52. package/src/ui/templates.js +131 -0
  53. package/src/ui/toolbar.js +63 -0
  54. package/src/ui/toolbars/grid.js +873 -0
  55. package/src/ui/windows/col_config.js +341 -0
  56. package/src/ui/windows/debug.js +164 -0
  57. package/src/ui/windows/grid_table_opts.js +139 -0
  58. package/src/util/handlebars.js +158 -0
  59. package/src/util/jquery.js +630 -0
  60. package/src/util/misc.js +1058 -0
  61. package/src/util/squirrelly.js +155 -0
  62. package/wcdatavis.css +1601 -0
@@ -0,0 +1,176 @@
1
+ // Imports {{{1
2
+
3
+ import _ from 'underscore';
4
+ import jQuery from 'jquery';
5
+
6
+ import { trans } from './trans.js';
7
+ import {
8
+ icon,
9
+ makeSubclass,
10
+ mixinLogging,
11
+ } from './util/misc.js';
12
+
13
+ import { Grid } from './grid.js';
14
+
15
+ // OperationsPalette {{{1
16
+
17
+ var OperationsPalette = makeSubclass('OperationsPalette', Object, function (grid) {
18
+ var self = this;
19
+
20
+ self.ui = {
21
+ root: null,
22
+ title: null,
23
+ palette: null
24
+ };
25
+ self.operations = [];
26
+
27
+ if (!(grid instanceof Grid)) {
28
+ throw new Error('Call Error: `grid` must be a Grid');
29
+ }
30
+
31
+ self.grid = grid;
32
+ self.parent = null;
33
+ });
34
+
35
+ mixinLogging(OperationsPalette);
36
+
37
+ // #draw {{{2
38
+
39
+ OperationsPalette.prototype.draw = function (parent) {
40
+ var self = this;
41
+ self.parent = parent;
42
+
43
+ self.ui.root = jQuery('<div>', {
44
+ 'class': 'wcdv_control_pane'
45
+ }).css({
46
+ 'display': 'block'
47
+ }).appendTo(self.parent);
48
+ self.ui.title = jQuery('<div>')
49
+ .addClass('wcdv_control_title_bar')
50
+ .appendTo(self.ui.root);
51
+ jQuery('<span>', { 'class': 'wcdv_control_title' })
52
+ .text(trans('GRID_CONTROL.OPERATIONS.TITLE'))
53
+ .appendTo(self.ui.title);
54
+ self.ui.palette = jQuery('<div>').css({
55
+ 'overflow-x': 'auto',
56
+ 'white-space': 'nowrap'
57
+ }).appendTo(self.ui.root);
58
+
59
+ self.autoReveal();
60
+
61
+ self.ui.palette.on('click.wcdv_operation', 'button.wcdv_operation', function () {
62
+ var btn = this;
63
+ var opIndex = btn.getAttribute('data-operation-index');
64
+
65
+ var op = self.operations[opIndex];
66
+ if (typeof op.callback === 'function') {
67
+ op.callback({
68
+ rows: self.grid.getSelection().rows,
69
+ opBtn: jQuery(btn)
70
+ });
71
+ }
72
+ });
73
+ };
74
+
75
+ // #drawPalette {{{2
76
+
77
+ /**
78
+ * Draw just the operation buttons themselves.
79
+ */
80
+
81
+ OperationsPalette.prototype.drawPalette = function () {
82
+ var self = this;
83
+
84
+ // Remove the contents of the existing palette.
85
+ self.ui.palette.children().remove();
86
+
87
+ _.each(_.groupBy(self.operations, 'category'), function (ops, c) {
88
+ var catDiv = jQuery('<div>', {
89
+ 'class': 'wcdv_operations_category'
90
+ }).appendTo(self.ui.palette);
91
+ // Make a label for the category, assuming we have one.
92
+ if (c !== 'undefined') {
93
+ var catLabel = jQuery('<span>').text(c).appendTo(catDiv);
94
+ }
95
+ _.each(ops, function (op) {
96
+ var btn = jQuery('<button>', {
97
+ 'type': 'button',
98
+ 'class': 'wcdv_operation',
99
+ 'data-operation-index': op.idx
100
+ }).appendTo(catDiv);
101
+ if (op.label == null) {
102
+ btn.addClass('no_label');
103
+ }
104
+ if (op.icon) {
105
+ btn.append(icon(op.icon));
106
+ }
107
+ if (op.label) {
108
+ btn.append(op.label);
109
+ }
110
+ });
111
+ });
112
+ };
113
+
114
+ // #autoReveal {{{2
115
+
116
+ OperationsPalette.prototype.autoReveal = function () {
117
+ var self = this;
118
+ if (self.operations.length > 0) {
119
+ self.drawPalette();
120
+ self.parent.show();
121
+ }
122
+ else {
123
+ self.parent.hide();
124
+ }
125
+ };
126
+
127
+ // #destroy {{{2
128
+
129
+ /**
130
+ * Remove any event handlers on the palette and remove its container from the DOM.
131
+ */
132
+
133
+ OperationsPalette.prototype.destroy = function () {
134
+ var self = this;
135
+
136
+ self.ui.palette.off('click.wcdv_operation');
137
+ self.ui.root.remove();
138
+ };
139
+
140
+ // #setOperations {{{2
141
+
142
+ /**
143
+ * Set the operations for the palette, after it has already been created.
144
+ */
145
+
146
+ OperationsPalette.prototype.setOperations = function (ops) {
147
+ var self = this;
148
+
149
+ if (ops == null || ops.all == null) {
150
+ // No "all" operations to worry about.
151
+ return;
152
+ }
153
+
154
+ // Add a tracking index, which is used by the generic onClick handler to locate the operation that
155
+ // was actually invoked.
156
+
157
+ var i = 0;
158
+ _.each(ops.all, function (o) {
159
+ o.idx = i;
160
+ i += 1;
161
+ });
162
+
163
+ self.operations = ops.all;
164
+
165
+ self.logDebug(self.makeLogTag('setOperations') + ' New operations = %O', self.operations);
166
+
167
+ if (self.ui.palette != null) {
168
+ self.autoReveal();
169
+ }
170
+ };
171
+
172
+ // Exports {{{1
173
+
174
+ export {
175
+ OperationsPalette,
176
+ };
@@ -0,0 +1,132 @@
1
+ import { PrefsModule, PREFS_MODULE_REGISTRY, OrdMap } from 'datavis-ace';
2
+ import { makeSubclass, deepDefaults } from './util/misc.js';
3
+ import { Grid } from './grid.js';
4
+ import { Graph } from './graph.js';
5
+
6
+ // PrefsModuleGrid {{{1
7
+
8
+ /**
9
+ * Manages configuration of a grid.
10
+ *
11
+ * @param {Grid} target
12
+ * What bound object to interact with.
13
+ *
14
+ * @class
15
+ *
16
+ * @property {Grid} target
17
+ * What bound object to interact with.
18
+ */
19
+
20
+ var PrefsModuleGrid = makeSubclass('PrefsModuleGrid', PrefsModule, function () {
21
+ var self = this
22
+ , args = Array.prototype.slice.call(arguments);
23
+
24
+ self.super['PrefsModule'].ctor.apply(self, args);
25
+
26
+ if (!(self.target instanceof Grid)) {
27
+ throw new Error('Call Error: `target` must be an instance of Grid');
28
+ }
29
+ });
30
+
31
+ // #load {{{2
32
+
33
+ PrefsModuleGrid.prototype.load = function (config) {
34
+ var self = this;
35
+
36
+ if (config == null) {
37
+ return;
38
+ }
39
+
40
+ if (config.colConfig != null) {
41
+ self.target.setColConfig(OrdMap.deserialize(config.colConfig), {
42
+ from: 'prefs',
43
+ redraw: false,
44
+ savePrefs: false
45
+ });
46
+ }
47
+ };
48
+
49
+ // #save {{{2
50
+
51
+ PrefsModuleGrid.prototype.save = function () {
52
+ var self = this;
53
+
54
+ var prefs = {};
55
+
56
+ var colConfig = self.target.getColConfig();
57
+ if (colConfig != null) {
58
+ prefs.colConfig = colConfig.serialize();
59
+ }
60
+
61
+ return prefs;
62
+ };
63
+
64
+ // #reset {{{2
65
+
66
+ PrefsModuleGrid.prototype.reset = function () {
67
+ var self = this;
68
+
69
+ self.target.resetColConfig();
70
+ };
71
+
72
+ // PrefsModuleGraph {{{1
73
+
74
+ /**
75
+ * Manages configuration of a graph.
76
+ *
77
+ * @param {Graph} target
78
+ * What bound object to interact with.
79
+ *
80
+ * @class
81
+ *
82
+ * @property {Graph} target
83
+ * What bound object to interact with.
84
+ */
85
+
86
+ var PrefsModuleGraph = makeSubclass('PrefsModuleGraph', PrefsModule, function () {
87
+ var self = this
88
+ , args = Array.prototype.slice.call(arguments);
89
+
90
+ self.super['PrefsModule'].ctor.apply(self, args);
91
+
92
+ if (!(self.target instanceof Graph)) {
93
+ throw new Error('Call Error: `target` must be an instance of Graph');
94
+ }
95
+ });
96
+
97
+ // #load {{{2
98
+
99
+ PrefsModuleGraph.prototype.load = function (config) {
100
+ var self = this;
101
+
102
+ if (config == null) {
103
+ return;
104
+ }
105
+
106
+ self.target.setUserConfig(config);
107
+ };
108
+
109
+ // #save {{{2
110
+
111
+ PrefsModuleGraph.prototype.save = function () {
112
+ var self = this;
113
+
114
+ var prefs = deepDefaults(self.target.userConfig, {
115
+ plain: {},
116
+ group: {},
117
+ pivot: {}
118
+ });
119
+
120
+
121
+
122
+ return prefs;
123
+ };
124
+
125
+ // #reset {{{2
126
+
127
+ PrefsModuleGraph.prototype.reset = function () {
128
+ var self = this;
129
+ };
130
+
131
+ PREFS_MODULE_REGISTRY.set('grid', PrefsModuleGrid);
132
+ PREFS_MODULE_REGISTRY.set('graph', PrefsModuleGraph);
@@ -0,0 +1,17 @@
1
+ import { OrdMap } from 'datavis-ace';
2
+
3
+ import GraphRendererChartJs from '../renderers/graph/chartjs.js';
4
+ import GraphRendererGoogle from '../renderers/graph/google.js';
5
+ import GraphRendererJit from '../renderers/graph/jit.js';
6
+
7
+ // Registry {{{1
8
+
9
+ var GRAPH_RENDERER_REGISTRY = new OrdMap();
10
+
11
+ GRAPH_RENDERER_REGISTRY.set('chartjs', GraphRendererChartJs);
12
+ GRAPH_RENDERER_REGISTRY.set('google', GraphRendererGoogle);
13
+ GRAPH_RENDERER_REGISTRY.set('jit', GraphRendererJit);
14
+
15
+ // Exports {{{1
16
+
17
+ export default GRAPH_RENDERER_REGISTRY;