hiplot-mm 0.0.1__py3-none-any.whl → 0.0.3rc0__py3-none-any.whl
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.
- hiplot/ipython.py +38 -6
- hiplot/pkginfo.py +18 -2
- hiplot/server.py +8 -2
- hiplot/static/built/hiplot.bundle.js +1 -1
- hiplot/static/built/streamlit_component/hiplot_streamlit.bundle.js +1 -1
- hiplot/streamlit_helpers.py +11 -2
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/METADATA +51 -27
- hiplot_mm-0.0.3rc0.dist-info/RECORD +33 -0
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/WHEEL +1 -1
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/entry_points.txt +0 -1
- hiplot/static/built/component.d.ts +0 -109
- hiplot/static/built/component.js +0 -528
- hiplot/static/built/contextmenu.d.ts +0 -26
- hiplot/static/built/contextmenu.js +0 -90
- hiplot/static/built/controls.d.ts +0 -52
- hiplot/static/built/controls.js +0 -163
- hiplot/static/built/filters.d.ts +0 -21
- hiplot/static/built/filters.js +0 -96
- hiplot/static/built/header.d.ts +0 -39
- hiplot/static/built/header.js +0 -176
- hiplot/static/built/hiplot-mm-0.0.0.tar.gz +0 -0
- hiplot/static/built/hiplot.bundle.js.LICENSE.txt +0 -88
- hiplot/static/built/hiplot.bundle.js.map +0 -1
- hiplot/static/built/hiplot.d.ts +0 -8
- hiplot/static/built/hiplot.js +0 -14
- hiplot/static/built/hiplot.lib.js +0 -57712
- hiplot/static/built/hiplot.lib.js.map +0 -1
- hiplot/static/built/hiplot.licenses.txt +0 -682
- hiplot/static/built/hiplot_mm-0.0.0-py3-none-any.whl +0 -0
- hiplot/static/built/hiplot_streamlit.bundle.js +0 -3
- hiplot/static/built/hiplot_streamlit.bundle.js.LICENSE.txt +0 -97
- hiplot/static/built/hiplot_streamlit.bundle.js.map +0 -1
- hiplot/static/built/hiplot_streamlit.d.ts +0 -1
- hiplot/static/built/hiplot_streamlit.js +0 -85
- hiplot/static/built/hiplot_streamlit.licenses.txt +0 -689
- hiplot/static/built/hiplot_test.bundle.js +0 -3
- hiplot/static/built/hiplot_test.bundle.js.LICENSE.txt +0 -88
- hiplot/static/built/hiplot_test.bundle.js.map +0 -1
- hiplot/static/built/hiplot_test.d.ts +0 -46
- hiplot/static/built/hiplot_test.js +0 -238
- hiplot/static/built/hiplot_test.licenses.txt +0 -682
- hiplot/static/built/hiplot_web.d.ts +0 -3
- hiplot/static/built/hiplot_web.js +0 -54
- hiplot/static/built/infertypes.d.ts +0 -38
- hiplot/static/built/infertypes.js +0 -316
- hiplot/static/built/plotxy.d.ts +0 -62
- hiplot/static/built/plotxy.js +0 -602
- hiplot/static/built/plugin.d.ts +0 -38
- hiplot/static/built/plugin.js +0 -8
- hiplot/static/built/rowsdisplaytable.d.ts +0 -35
- hiplot/static/built/rowsdisplaytable.js +0 -284
- hiplot/static/built/streamlit_component/hiplot.bundle.js +0 -3
- hiplot/static/built/types.d.ts +0 -64
- hiplot/static/built/types.js +0 -55
- hiplot_mm-0.0.1.dist-info/RECORD +0 -77
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info/licenses}/LICENSE +0 -0
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info/licenses}/NOTICE +0 -0
- {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/top_level.txt +0 -0
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
var __extends = (this && this.__extends) || (function () {
|
|
8
|
-
var extendStatics = function (d, b) {
|
|
9
|
-
extendStatics = Object.setPrototypeOf ||
|
|
10
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
11
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
12
|
-
return extendStatics(d, b);
|
|
13
|
-
};
|
|
14
|
-
return function (d, b) {
|
|
15
|
-
extendStatics(d, b);
|
|
16
|
-
function __() { this.constructor = d; }
|
|
17
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
import $ from "jquery";
|
|
21
|
-
import React from "react";
|
|
22
|
-
//@ts-ignore
|
|
23
|
-
import dtBs4 from "datatables.net-bs4";
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
import dtReorder from "datatables.net-colreorder";
|
|
26
|
-
//@ts-ignore
|
|
27
|
-
import dtReorderBs4 from "datatables.net-colreorder-bs4";
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
import dtButtons from "datatables.net-buttons";
|
|
30
|
-
//@ts-ignore
|
|
31
|
-
import dtButtonsBs4 from "datatables.net-buttons-bs4";
|
|
32
|
-
dtBs4(window, $);
|
|
33
|
-
dtReorder(window, $);
|
|
34
|
-
dtReorderBs4(window, $);
|
|
35
|
-
dtButtons(window, $);
|
|
36
|
-
dtButtonsBs4(window, $);
|
|
37
|
-
import style from "./hiplot.scss";
|
|
38
|
-
import _ from "underscore";
|
|
39
|
-
import { FilterType } from "./filters";
|
|
40
|
-
;
|
|
41
|
-
;
|
|
42
|
-
;
|
|
43
|
-
var RowsDisplayTable = /** @class */ (function (_super) {
|
|
44
|
-
__extends(RowsDisplayTable, _super);
|
|
45
|
-
function RowsDisplayTable(props) {
|
|
46
|
-
var _this = _super.call(this, props) || this;
|
|
47
|
-
_this.table_ref = React.createRef();
|
|
48
|
-
_this.table_container = React.createRef();
|
|
49
|
-
_this.dt = null;
|
|
50
|
-
_this.ordered_cols = [];
|
|
51
|
-
_this.setSelected_debounced = _.debounce(_this.setSelected, 150);
|
|
52
|
-
_this.state = {};
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
RowsDisplayTable.prototype.componentDidMount = function () {
|
|
56
|
-
this.mountDt();
|
|
57
|
-
};
|
|
58
|
-
RowsDisplayTable.prototype.mountDt = function () {
|
|
59
|
-
if (!this.props.params_def["uid"]) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
var dom = $(this.table_ref.current);
|
|
63
|
-
this.ordered_cols = ['uid'];
|
|
64
|
-
var me = this;
|
|
65
|
-
$.each(this.props.params_def, function (k, def) {
|
|
66
|
-
if (k == 'uid') {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
me.ordered_cols.push(k);
|
|
70
|
-
});
|
|
71
|
-
if (me.props.order) {
|
|
72
|
-
var columnOrderScore_1 = function (col) {
|
|
73
|
-
var index = me.props.order.indexOf(col);
|
|
74
|
-
if (index == -1) {
|
|
75
|
-
return me.props.order.length;
|
|
76
|
-
}
|
|
77
|
-
return index;
|
|
78
|
-
};
|
|
79
|
-
me.ordered_cols.sort(function (a, b) {
|
|
80
|
-
// Return negative if `a` comes first
|
|
81
|
-
return columnOrderScore_1(a) - columnOrderScore_1(b);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
me.ordered_cols.unshift('');
|
|
85
|
-
var uidColIndex = me.ordered_cols.indexOf('uid');
|
|
86
|
-
dom.empty();
|
|
87
|
-
var columns = this.ordered_cols.map(function (x) {
|
|
88
|
-
var pd = me.props.params_def[x];
|
|
89
|
-
return {
|
|
90
|
-
'title': x == '' ? '' : $("<span />").attr("class", pd.label_css).html(pd.label_html)[0].outerHTML,
|
|
91
|
-
'defaultContent': 'null',
|
|
92
|
-
'type': x == '' ? 'html' : (pd.numeric ? "num" : "string"),
|
|
93
|
-
'visible': !me.props.hide || !me.props.hide.includes(x),
|
|
94
|
-
'orderable': x != ''
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
var order_by = this.props.order_by.map(function (col_otype) {
|
|
98
|
-
var col_idx = me.ordered_cols.indexOf(col_otype[0]);
|
|
99
|
-
console.assert(col_idx >= 0, "TABLE: Column for ordering " + col_otype[0] + " does not exist. Available columns: " + me.ordered_cols.join(","));
|
|
100
|
-
return [col_idx, col_otype[1]];
|
|
101
|
-
});
|
|
102
|
-
columns[0]['render'] = function (data, type, row, meta) {
|
|
103
|
-
if (!me.dt) {
|
|
104
|
-
return '';
|
|
105
|
-
}
|
|
106
|
-
var individualUidColIdx = me.dt.colReorder.order().indexOf(uidColIndex);
|
|
107
|
-
var color = me.props.get_color_for_row(me.props.dp_lookup[row[individualUidColIdx]], 1.0);
|
|
108
|
-
return "<span class=\"" + style.colorBlock + "\" style=\"background-color: " + color + "\" />";
|
|
109
|
-
};
|
|
110
|
-
this.dt = dom.DataTable({
|
|
111
|
-
columns: columns,
|
|
112
|
-
data: [],
|
|
113
|
-
order: order_by,
|
|
114
|
-
deferRender: true,
|
|
115
|
-
headerCallback: function headerCallback(thead, data, start, end, display) {
|
|
116
|
-
Array.from(thead.cells).forEach(function (th, i) {
|
|
117
|
-
var col = th.innerText;
|
|
118
|
-
if (col != '' && me.dt === null && me.props.context_menu_ref !== undefined) {
|
|
119
|
-
th.addEventListener('contextmenu', function (e) {
|
|
120
|
-
me.props.context_menu_ref.current.show(e.pageX, e.pageY, col);
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
e.stopPropagation();
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
//@ts-ignore
|
|
128
|
-
buttons: [
|
|
129
|
-
{
|
|
130
|
-
text: 'Select results',
|
|
131
|
-
className: 'btn-sm btn-outline-primary d-none',
|
|
132
|
-
action: this.setSelectedToSearchResult.bind(this)
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
//@ts-ignore
|
|
136
|
-
colReorder: true
|
|
137
|
-
});
|
|
138
|
-
var btnsContainer = $(this.table_container.current).find('.col-md-6:eq(1)');
|
|
139
|
-
btnsContainer.addClass("btn-group");
|
|
140
|
-
this.dt.buttons().container().appendTo(btnsContainer);
|
|
141
|
-
btnsContainer.find(".dt-buttons").removeClass("btn-group");
|
|
142
|
-
dom.on('search.dt', function () {
|
|
143
|
-
if (!this.dt) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
var node = this.dt.buttons()[0].node;
|
|
147
|
-
node.classList.remove("d-none");
|
|
148
|
-
node.classList.remove("btn-secondary");
|
|
149
|
-
var searchResults = this.dt.rows({ filter: 'applied' });
|
|
150
|
-
if (this.dt.search() == "" || searchResults.nodes().length == 0) {
|
|
151
|
-
node.classList.add("d-none");
|
|
152
|
-
}
|
|
153
|
-
}.bind(this));
|
|
154
|
-
this.empty = true;
|
|
155
|
-
dom.find('tbody')
|
|
156
|
-
.on('mouseenter', 'td', function () {
|
|
157
|
-
if (!me.dt || me.empty) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
var rowIdx = me.dt.cell(this).index().row;
|
|
161
|
-
var row = me.dt.row(rowIdx);
|
|
162
|
-
var individualUidColIdx = me.dt.colReorder.order().indexOf(uidColIndex);
|
|
163
|
-
dom.find(".table-primary").removeClass("table-primary");
|
|
164
|
-
$(row.nodes()).addClass("table-primary");
|
|
165
|
-
me.props.setHighlighted([me.props.dp_lookup[row.data()[individualUidColIdx]]]);
|
|
166
|
-
})
|
|
167
|
-
.on("mouseout", "td", function () {
|
|
168
|
-
if (!me.dt || me.empty) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
var rowIdx = me.dt.cell(this).index().row;
|
|
172
|
-
$(me.dt.row(rowIdx).nodes()).removeClass("table-primary");
|
|
173
|
-
me.props.setHighlighted([]);
|
|
174
|
-
});
|
|
175
|
-
me.setSelected(me.props.rows_selected);
|
|
176
|
-
};
|
|
177
|
-
RowsDisplayTable.prototype.componentDidUpdate = function (prevProps) {
|
|
178
|
-
/* Sometimes we need to redraw the entire table
|
|
179
|
-
* but this is super expensive, so let's do it only if
|
|
180
|
-
* strictly necessary
|
|
181
|
-
* aka when changing `numeric` status of a column
|
|
182
|
-
* or when we add/remove columns
|
|
183
|
-
*/
|
|
184
|
-
var shouldRemountTable = false;
|
|
185
|
-
if (prevProps.params_def != this.props.params_def) {
|
|
186
|
-
var k1 = Object.keys(prevProps.params_def);
|
|
187
|
-
var k2 = Object.keys(this.props.params_def);
|
|
188
|
-
k1.sort();
|
|
189
|
-
k2.sort();
|
|
190
|
-
if (k1.length != k2.length) {
|
|
191
|
-
shouldRemountTable = true;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
for (var i = 0; i < k1.length; ++i) {
|
|
195
|
-
if (k1[i] != k2[i] ||
|
|
196
|
-
prevProps.params_def[k1[i]].numeric != this.props.params_def[k2[i]].numeric) {
|
|
197
|
-
shouldRemountTable = true;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (shouldRemountTable) {
|
|
204
|
-
this.destroyDt();
|
|
205
|
-
this.mountDt();
|
|
206
|
-
}
|
|
207
|
-
else if ( // Rows changed
|
|
208
|
-
prevProps.rows_selected != this.props.rows_selected ||
|
|
209
|
-
// Color changed - need redraw with the correct color
|
|
210
|
-
prevProps.colorby != this.props.colorby ||
|
|
211
|
-
// Color scale changed - need redraw with the correct color
|
|
212
|
-
prevProps.params_def != this.props.params_def) {
|
|
213
|
-
this.setSelected_debounced(this.props.rows_selected);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
RowsDisplayTable.prototype.setSelectedToSearchResult = function () {
|
|
217
|
-
var dt = this.dt;
|
|
218
|
-
if (!dt) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
var searchResults = dt.rows({ filter: 'applied' });
|
|
222
|
-
var uidIdx = this.ordered_cols.indexOf("uid");
|
|
223
|
-
var searchResultsDatapoints = [];
|
|
224
|
-
$.each(searchResults.data(), function (index, value) {
|
|
225
|
-
searchResultsDatapoints.push(this.props.dp_lookup[value[uidIdx]]);
|
|
226
|
-
}.bind(this));
|
|
227
|
-
var filter = {
|
|
228
|
-
type: FilterType.Search,
|
|
229
|
-
data: dt.search()
|
|
230
|
-
};
|
|
231
|
-
if (this.props.rows_selected_filter) {
|
|
232
|
-
filter = {
|
|
233
|
-
type: FilterType.All,
|
|
234
|
-
data: [this.props.rows_selected_filter, filter]
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
this.props.setSelected(searchResultsDatapoints, filter);
|
|
238
|
-
};
|
|
239
|
-
RowsDisplayTable.prototype.setSelected = function (selected) {
|
|
240
|
-
var dt = this.dt;
|
|
241
|
-
if (!dt) {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
var ordered_cols = this.ordered_cols;
|
|
245
|
-
var ock = dt.colReorder.transpose(Array.from(Array(ordered_cols.length).keys()), 'toOriginal');
|
|
246
|
-
dt.clear();
|
|
247
|
-
dt.rows.add(selected.map(function (row) {
|
|
248
|
-
return ock.map(function (x) { return x == '' ? '' : row[ordered_cols[x]]; });
|
|
249
|
-
}));
|
|
250
|
-
if (dt.search() == "") {
|
|
251
|
-
// Hack to redraw faster
|
|
252
|
-
dt.settings()[0].oFeatures.bFilter = false;
|
|
253
|
-
dt.draw();
|
|
254
|
-
dt.settings()[0].oFeatures.bFilter = true;
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
dt.draw();
|
|
258
|
-
}
|
|
259
|
-
this.empty = selected.length == 0;
|
|
260
|
-
};
|
|
261
|
-
RowsDisplayTable.prototype.render = function () {
|
|
262
|
-
return (React.createElement("div", { className: style.wrap + " container-fluid " + style["horizontal-scrollable"] },
|
|
263
|
-
React.createElement("div", { className: "row" },
|
|
264
|
-
React.createElement("div", { ref: this.table_container, className: "col-md-12 sample-table-container" },
|
|
265
|
-
React.createElement("table", { ref: this.table_ref, className: "table-hover table-sm sample-rows-table display table-striped table-bordered dataTable" })))));
|
|
266
|
-
};
|
|
267
|
-
RowsDisplayTable.prototype.destroyDt = function () {
|
|
268
|
-
if (this.dt) {
|
|
269
|
-
var dt_1 = this.dt;
|
|
270
|
-
this.dt = null;
|
|
271
|
-
dt_1.destroy();
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
RowsDisplayTable.prototype.componentWillUnmount = function () {
|
|
275
|
-
this.destroyDt();
|
|
276
|
-
this.setSelected_debounced.cancel();
|
|
277
|
-
};
|
|
278
|
-
RowsDisplayTable.defaultProps = {
|
|
279
|
-
hide: [],
|
|
280
|
-
order_by: [['uid', 'asc']]
|
|
281
|
-
};
|
|
282
|
-
return RowsDisplayTable;
|
|
283
|
-
}(React.Component));
|
|
284
|
-
export { RowsDisplayTable };
|