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,155 @@
|
|
|
1
|
+
// Imports {{{1
|
|
2
|
+
|
|
3
|
+
import _ from 'underscore';
|
|
4
|
+
import jQuery from 'jquery';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
format,
|
|
8
|
+
getPropDef,
|
|
9
|
+
objFromArray,
|
|
10
|
+
} from './misc.js';
|
|
11
|
+
|
|
12
|
+
// addHelpers {{{1
|
|
13
|
+
|
|
14
|
+
function addHelpers(env, data) {
|
|
15
|
+
var ai = objFromArray(['cell', 'group', 'pivot', 'all'], [[]]);
|
|
16
|
+
ai = _.mapObject(ai, function (val, key) {
|
|
17
|
+
return _.filter(
|
|
18
|
+
getPropDef([], data, 'agg', 'info', key),
|
|
19
|
+
function (aggInfo) {
|
|
20
|
+
return !aggInfo.isHidden;
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// rowval {{{2
|
|
26
|
+
|
|
27
|
+
env.define('rowval', function (content) {
|
|
28
|
+
var [ctx, groupField] = content.params;
|
|
29
|
+
|
|
30
|
+
if (['number', 'string'].indexOf(typeof groupField) < 0) {
|
|
31
|
+
throw new Error('In Handlebars "rowval" helper, `groupField` must be a number or string');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var gfi;
|
|
35
|
+
|
|
36
|
+
if (typeof groupField === 'number') {
|
|
37
|
+
gfi = groupField;
|
|
38
|
+
|
|
39
|
+
if (gfi < 0) {
|
|
40
|
+
throw new Error('In Handlebars "rowval" helper, group field index "' + groupField + '" out of range');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
gfi = data.groupFields.indexOf(groupField);
|
|
45
|
+
|
|
46
|
+
if (gfi < 0) {
|
|
47
|
+
throw new Error('In Handlebars "rowval" helper, specified field "' + groupField + '" is not part of group');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return data.rowVals[ctx.rowValIdx][gfi];
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// colval {{{2
|
|
55
|
+
|
|
56
|
+
env.define('colval', function (content) {
|
|
57
|
+
let [ctx, pivotField] = content.params;
|
|
58
|
+
|
|
59
|
+
if (['number', 'string'].indexOf(typeof pivotField) < 0) {
|
|
60
|
+
throw new Error('In Handlebars "rowval" helper, `pivotField` must be a number or string');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var pivotFieldIndex;
|
|
64
|
+
|
|
65
|
+
if (typeof pivotField === 'number') {
|
|
66
|
+
pivotFieldIndex = pivotField;
|
|
67
|
+
|
|
68
|
+
if (pivotFieldIndex < 0) {
|
|
69
|
+
throw new Error('In Handlebars "rowval" helper, pivot field index "' + pivotField + '" out of range');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
pivotFieldIndex = data.pivotFields.indexOf(pivotField);
|
|
74
|
+
|
|
75
|
+
if (pivotFieldIndex < 0) {
|
|
76
|
+
throw new Error('In Handlebars "rowval" helper, specified field "' + pivotField + '" is not part of pivot');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return data.colVals[ctx.colValIdx][pivotFieldIndex];
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// aggregate {{{2
|
|
84
|
+
|
|
85
|
+
env.define('aggregate', function (content) {
|
|
86
|
+
let [ctx, type, aggNum] = content.params;
|
|
87
|
+
|
|
88
|
+
if (data.isPlain) {
|
|
89
|
+
throw new Error('In Handlebars "aggregate" helper, data must be grouped to use this helper');
|
|
90
|
+
}
|
|
91
|
+
else if (data.isGroup && ['group', 'all'].indexOf(type) < 0) {
|
|
92
|
+
throw new Error('In Handlebars "aggregate" helper, `type` must be one of: { group, all }');
|
|
93
|
+
}
|
|
94
|
+
else if (data.isPivot && ['cell', 'group', 'pivot', 'all'].indexOf(type) < 0) {
|
|
95
|
+
throw new Error('In Handlebars "aggregate" helper, `type` must be one of: { cell, group, pivot, all }');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (data.isGroup && ctx.rowValIdx == null) {
|
|
99
|
+
throw new Error('missing rowvalidx from context');
|
|
100
|
+
}
|
|
101
|
+
if (data.isPivot && (ctx.rowValIdx == null || ctx.colValIdx == null)) {
|
|
102
|
+
throw new Error('missing rowValIdx or colValIdx from context');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof aggNum !== 'number' || parseInt(aggNum) != aggNum) {
|
|
106
|
+
return '[HELPER/AGGREGATE: AGGNUM MUST BE AN INT]';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (ai[type].length <= aggNum) {
|
|
110
|
+
return '[HELPER/AGGREGATE: AGGNUM OUT OF RANGE]';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var aggInfo = data.agg.info[type][aggNum];
|
|
114
|
+
var aggResult = data.isGroup ? data.agg.results[type][aggNum][ctx.rowValIdx]
|
|
115
|
+
: data.isPivot ? data.agg.results[type][aggNum][ctx.rowValIdx][ctx.colValIdx]
|
|
116
|
+
: null;
|
|
117
|
+
var text;
|
|
118
|
+
|
|
119
|
+
if (aggResult instanceof jQuery) {
|
|
120
|
+
aggResult = aggResult.get(0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (aggResult instanceof Element) {
|
|
124
|
+
//td.appendChild(aggResult);
|
|
125
|
+
return aggResult;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
if (aggInfo.instance.inheritFormatting) {
|
|
129
|
+
text = format(aggInfo.colConfig[0], aggInfo.typeInfo[0], aggResult, {
|
|
130
|
+
overrideType: aggInfo.instance.getType()
|
|
131
|
+
});
|
|
132
|
+
//setTableCell(td, text, {
|
|
133
|
+
// field: aggInfo.fields[0],
|
|
134
|
+
// colConfig: aggInfo.colConfig[0],
|
|
135
|
+
// typeInfo: aggInfo.typeInfo[0]
|
|
136
|
+
//});
|
|
137
|
+
return text;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
text = format(null, null, aggResult, {
|
|
141
|
+
overrideType: aggInfo.instance.getType(),
|
|
142
|
+
decode: false
|
|
143
|
+
});
|
|
144
|
+
//setTableCell(td, text);
|
|
145
|
+
return text;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Exports {{{1
|
|
152
|
+
|
|
153
|
+
export default {
|
|
154
|
+
addHelpers: addHelpers,
|
|
155
|
+
};
|