juxscript 1.1.239 → 1.1.243
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/index.js +7 -137
- package/lib/components/dataframe.ts +0 -569
- package/lib/components/tag.ts +68 -0
- package/lib/styles/shadcn.css +20 -7
- package/lib/utils/idgen.ts +6 -0
- package/package.json +5 -6
- package/index.d.ts +0 -239
- package/index.d.ts.map +0 -1
- package/lib/components/alert.d.ts +0 -36
- package/lib/components/alert.d.ts.map +0 -1
- package/lib/components/alert.js +0 -172
- package/lib/components/alert.ts +0 -219
- package/lib/components/app.d.ts +0 -89
- package/lib/components/app.d.ts.map +0 -1
- package/lib/components/app.js +0 -175
- package/lib/components/app.ts +0 -247
- package/lib/components/badge.d.ts +0 -26
- package/lib/components/badge.d.ts.map +0 -1
- package/lib/components/badge.js +0 -91
- package/lib/components/badge.ts +0 -118
- package/lib/components/base/Animations.d.ts +0 -36
- package/lib/components/base/Animations.d.ts.map +0 -1
- package/lib/components/base/Animations.js +0 -70
- package/lib/components/base/Animations.ts +0 -112
- package/lib/components/base/BaseComponent.d.ts +0 -294
- package/lib/components/base/BaseComponent.d.ts.map +0 -1
- package/lib/components/base/BaseComponent.js +0 -735
- package/lib/components/base/BaseComponent.ts +0 -884
- package/lib/components/base/FormInput.d.ts +0 -77
- package/lib/components/base/FormInput.d.ts.map +0 -1
- package/lib/components/base/FormInput.js +0 -171
- package/lib/components/base/FormInput.ts +0 -237
- package/lib/components/blueprint.d.ts +0 -40
- package/lib/components/blueprint.d.ts.map +0 -1
- package/lib/components/blueprint.js +0 -327
- package/lib/components/button.d.ts +0 -70
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js +0 -177
- package/lib/components/button.ts +0 -237
- package/lib/components/card.d.ts +0 -35
- package/lib/components/card.d.ts.map +0 -1
- package/lib/components/card.js +0 -130
- package/lib/components/card.ts +0 -177
- package/lib/components/chart.d.ts +0 -49
- package/lib/components/chart.d.ts.map +0 -1
- package/lib/components/chart.js +0 -205
- package/lib/components/chart.ts +0 -254
- package/lib/components/checkbox.d.ts +0 -33
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js +0 -202
- package/lib/components/checkbox.ts +0 -260
- package/lib/components/code.d.ts +0 -52
- package/lib/components/code.d.ts.map +0 -1
- package/lib/components/code.js +0 -201
- package/lib/components/code.ts +0 -260
- package/lib/components/container.d.ts +0 -60
- package/lib/components/container.d.ts.map +0 -1
- package/lib/components/container.js +0 -195
- package/lib/components/container.ts +0 -259
- package/lib/components/data.d.ts +0 -36
- package/lib/components/data.d.ts.map +0 -1
- package/lib/components/data.js +0 -110
- package/lib/components/data.ts +0 -135
- package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
- package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
- package/lib/components/dataframe/DataFrameSource.js +0 -421
- package/lib/components/dataframe/DataFrameSource.ts +0 -532
- package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
- package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
- package/lib/components/dataframe/ImportSettingsModal.js +0 -442
- package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
- package/lib/components/dataframe.d.ts +0 -110
- package/lib/components/dataframe.d.ts.map +0 -1
- package/lib/components/dataframe.js +0 -470
- package/lib/components/datepicker.d.ts +0 -40
- package/lib/components/datepicker.d.ts.map +0 -1
- package/lib/components/datepicker.js +0 -193
- package/lib/components/datepicker.ts +0 -251
- package/lib/components/dialog.d.ts +0 -39
- package/lib/components/dialog.d.ts.map +0 -1
- package/lib/components/dialog.js +0 -131
- package/lib/components/dialog.ts +0 -178
- package/lib/components/divider.d.ts +0 -31
- package/lib/components/divider.d.ts.map +0 -1
- package/lib/components/divider.js +0 -72
- package/lib/components/divider.ts +0 -104
- package/lib/components/dropdown-menu.d.ts +0 -42
- package/lib/components/dropdown-menu.d.ts.map +0 -1
- package/lib/components/dropdown-menu.js +0 -177
- package/lib/components/dropdown-menu.ts +0 -214
- package/lib/components/dropdown.d.ts +0 -41
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -136
- package/lib/components/dropdown.ts +0 -188
- package/lib/components/element.d.ts +0 -51
- package/lib/components/element.d.ts.map +0 -1
- package/lib/components/element.js +0 -209
- package/lib/components/element.ts +0 -271
- package/lib/components/event-chain.d.ts +0 -9
- package/lib/components/event-chain.d.ts.map +0 -1
- package/lib/components/event-chain.js +0 -33
- package/lib/components/fileupload.d.ts +0 -98
- package/lib/components/fileupload.d.ts.map +0 -1
- package/lib/components/fileupload.js +0 -351
- package/lib/components/fileupload.ts +0 -449
- package/lib/components/grid.d.ts +0 -88
- package/lib/components/grid.d.ts.map +0 -1
- package/lib/components/grid.js +0 -208
- package/lib/components/grid.ts +0 -295
- package/lib/components/heading.d.ts +0 -25
- package/lib/components/heading.d.ts.map +0 -1
- package/lib/components/heading.js +0 -83
- package/lib/components/heading.ts +0 -113
- package/lib/components/helpers.d.ts +0 -9
- package/lib/components/helpers.d.ts.map +0 -1
- package/lib/components/helpers.js +0 -30
- package/lib/components/helpers.ts +0 -41
- package/lib/components/hero.d.ts +0 -60
- package/lib/components/hero.d.ts.map +0 -1
- package/lib/components/hero.js +0 -239
- package/lib/components/hero.ts +0 -302
- package/lib/components/history/StateHistory.d.ts +0 -91
- package/lib/components/history/StateHistory.d.ts.map +0 -1
- package/lib/components/history/StateHistory.js +0 -154
- package/lib/components/history/StateHistory.ts +0 -200
- package/lib/components/icon.d.ts +0 -36
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js +0 -135
- package/lib/components/icon.ts +0 -182
- package/lib/components/icons.d.ts +0 -25
- package/lib/components/icons.d.ts.map +0 -1
- package/lib/components/icons.js +0 -440
- package/lib/components/icons.ts +0 -464
- package/lib/components/image.d.ts +0 -42
- package/lib/components/image.d.ts.map +0 -1
- package/lib/components/image.js +0 -204
- package/lib/components/image.ts +0 -260
- package/lib/components/include.d.ts +0 -86
- package/lib/components/include.d.ts.map +0 -1
- package/lib/components/include.js +0 -238
- package/lib/components/include.ts +0 -281
- package/lib/components/input.d.ts +0 -85
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js +0 -362
- package/lib/components/input.ts +0 -473
- package/lib/components/layer.d.ts +0 -72
- package/lib/components/layer.d.ts.map +0 -1
- package/lib/components/layer.js +0 -219
- package/lib/components/layer.ts +0 -304
- package/lib/components/link.d.ts +0 -41
- package/lib/components/link.d.ts.map +0 -1
- package/lib/components/link.js +0 -216
- package/lib/components/link.ts +0 -268
- package/lib/components/list.d.ts +0 -83
- package/lib/components/list.d.ts.map +0 -1
- package/lib/components/list.js +0 -314
- package/lib/components/list.ts +0 -423
- package/lib/components/loading.d.ts +0 -25
- package/lib/components/loading.d.ts.map +0 -1
- package/lib/components/loading.js +0 -76
- package/lib/components/loading.ts +0 -104
- package/lib/components/menu.d.ts +0 -38
- package/lib/components/menu.d.ts.map +0 -1
- package/lib/components/menu.js +0 -205
- package/lib/components/menu.ts +0 -279
- package/lib/components/modal.d.ts +0 -97
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js +0 -463
- package/lib/components/modal.ts +0 -576
- package/lib/components/nav.d.ts +0 -46
- package/lib/components/nav.d.ts.map +0 -1
- package/lib/components/nav.js +0 -193
- package/lib/components/nav.ts +0 -261
- package/lib/components/paragraph.d.ts +0 -30
- package/lib/components/paragraph.d.ts.map +0 -1
- package/lib/components/paragraph.js +0 -93
- package/lib/components/paragraph.ts +0 -123
- package/lib/components/pen.d.ts +0 -125
- package/lib/components/pen.d.ts.map +0 -1
- package/lib/components/pen.js +0 -443
- package/lib/components/pen.ts +0 -567
- package/lib/components/progress.d.ts +0 -40
- package/lib/components/progress.d.ts.map +0 -1
- package/lib/components/progress.js +0 -116
- package/lib/components/progress.ts +0 -163
- package/lib/components/radio.d.ts +0 -43
- package/lib/components/radio.d.ts.map +0 -1
- package/lib/components/radio.js +0 -226
- package/lib/components/radio.ts +0 -303
- package/lib/components/registry.d.ts +0 -34
- package/lib/components/registry.d.ts.map +0 -1
- package/lib/components/registry.js +0 -163
- package/lib/components/registry.ts +0 -193
- package/lib/components/req.d.ts +0 -155
- package/lib/components/req.d.ts.map +0 -1
- package/lib/components/req.js +0 -253
- package/lib/components/req.ts +0 -303
- package/lib/components/script.d.ts +0 -14
- package/lib/components/script.d.ts.map +0 -1
- package/lib/components/script.js +0 -33
- package/lib/components/script.ts +0 -41
- package/lib/components/select.d.ts +0 -42
- package/lib/components/select.d.ts.map +0 -1
- package/lib/components/select.js +0 -209
- package/lib/components/select.ts +0 -281
- package/lib/components/sidebar.d.ts +0 -59
- package/lib/components/sidebar.d.ts.map +0 -1
- package/lib/components/sidebar.js +0 -298
- package/lib/components/sidebar.ts +0 -395
- package/lib/components/stack/BaseStack.d.ts +0 -65
- package/lib/components/stack/BaseStack.d.ts.map +0 -1
- package/lib/components/stack/BaseStack.js +0 -274
- package/lib/components/stack/BaseStack.ts +0 -328
- package/lib/components/stack/HStack.d.ts +0 -18
- package/lib/components/stack/HStack.d.ts.map +0 -1
- package/lib/components/stack/HStack.js +0 -22
- package/lib/components/stack/HStack.ts +0 -25
- package/lib/components/stack/VStack.d.ts +0 -19
- package/lib/components/stack/VStack.d.ts.map +0 -1
- package/lib/components/stack/VStack.js +0 -23
- package/lib/components/stack/VStack.ts +0 -26
- package/lib/components/stack/ZStack.d.ts +0 -18
- package/lib/components/stack/ZStack.d.ts.map +0 -1
- package/lib/components/stack/ZStack.js +0 -22
- package/lib/components/stack/ZStack.ts +0 -25
- package/lib/components/style.d.ts +0 -14
- package/lib/components/style.d.ts.map +0 -1
- package/lib/components/style.js +0 -33
- package/lib/components/style.ts +0 -41
- package/lib/components/switch.d.ts +0 -34
- package/lib/components/switch.d.ts.map +0 -1
- package/lib/components/switch.js +0 -209
- package/lib/components/switch.ts +0 -272
- package/lib/components/table.d.ts +0 -137
- package/lib/components/table.d.ts.map +0 -1
- package/lib/components/table.js +0 -1019
- package/lib/components/table.ts +0 -1225
- package/lib/components/tabs.d.ts +0 -53
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js +0 -275
- package/lib/components/tabs.ts +0 -349
- package/lib/components/theme-toggle.d.ts +0 -45
- package/lib/components/theme-toggle.d.ts.map +0 -1
- package/lib/components/theme-toggle.js +0 -218
- package/lib/components/theme-toggle.ts +0 -297
- package/lib/components/tooltip.d.ts +0 -31
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js +0 -112
- package/lib/components/tooltip.ts +0 -148
- package/lib/components/watcher.d.ts +0 -195
- package/lib/components/watcher.d.ts.map +0 -1
- package/lib/components/watcher.js +0 -241
- package/lib/components/watcher.ts +0 -261
- package/lib/components/write.d.ts +0 -107
- package/lib/components/write.d.ts.map +0 -1
- package/lib/components/write.js +0 -222
- package/lib/components/write.ts +0 -272
- package/lib/data/DataPipeline.d.ts +0 -113
- package/lib/data/DataPipeline.d.ts.map +0 -1
- package/lib/data/DataPipeline.js +0 -359
- package/lib/data/DataPipeline.ts +0 -452
- package/lib/facades/dataframe.jux +0 -0
- package/lib/globals.d.ts +0 -21
- package/lib/reactivity/state.d.ts +0 -36
- package/lib/reactivity/state.d.ts.map +0 -1
- package/lib/reactivity/state.js +0 -67
- package/lib/reactivity/state.ts +0 -78
- package/lib/storage/DataFrame.d.ts +0 -284
- package/lib/storage/DataFrame.d.ts.map +0 -1
- package/lib/storage/DataFrame.js +0 -1022
- package/lib/storage/DataFrame.ts +0 -1195
- package/lib/storage/DataFrameSource.d.ts +0 -158
- package/lib/storage/DataFrameSource.d.ts.map +0 -1
- package/lib/storage/DataFrameSource.js +0 -409
- package/lib/storage/DataFrameSource.ts +0 -556
- package/lib/storage/FileStorage.d.ts +0 -53
- package/lib/storage/FileStorage.d.ts.map +0 -1
- package/lib/storage/FileStorage.js +0 -80
- package/lib/storage/FileStorage.ts +0 -95
- package/lib/storage/IndexedDBDriver.d.ts +0 -75
- package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
- package/lib/storage/IndexedDBDriver.js +0 -177
- package/lib/storage/IndexedDBDriver.ts +0 -226
- package/lib/storage/TabularDriver.d.ts +0 -118
- package/lib/storage/TabularDriver.d.ts.map +0 -1
- package/lib/storage/TabularDriver.js +0 -731
- package/lib/storage/TabularDriver.ts +0 -874
- package/lib/utils/codeparser.d.ts +0 -29
- package/lib/utils/codeparser.d.ts.map +0 -1
- package/lib/utils/codeparser.js +0 -409
- package/lib/utils/fetch.d.ts +0 -176
- package/lib/utils/fetch.d.ts.map +0 -1
- package/lib/utils/fetch.js +0 -427
- package/lib/utils/formatId.d.ts +0 -16
- package/lib/utils/formatId.d.ts.map +0 -1
- package/lib/utils/formatId.js +0 -27
- package/lib/utils/path-resolver.js +0 -23
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
import { DataFrame } from '../storage/DataFrame.js';
|
|
3
|
-
import { FileUpload } from './fileupload.js';
|
|
4
|
-
import { Table } from './table.js';
|
|
5
|
-
import { Tabs } from './tabs.js';
|
|
6
|
-
import { Button } from './button.js';
|
|
7
|
-
import { dataFrameSource } from './dataframe/DataFrameSource.js';
|
|
8
|
-
import { ImportSettingsModal } from './dataframe/ImportSettingsModal.js';
|
|
9
|
-
const TRIGGER_EVENTS = [];
|
|
10
|
-
const CALLBACK_EVENTS = ['load', 'error', 'transform'];
|
|
11
|
-
export class DataFrameComponent extends BaseComponent {
|
|
12
|
-
constructor(id, options = {}) {
|
|
13
|
-
super(id, {
|
|
14
|
-
visible: true,
|
|
15
|
-
disabled: false,
|
|
16
|
-
loading: false,
|
|
17
|
-
style: options.style ?? '',
|
|
18
|
-
class: options.class ?? '',
|
|
19
|
-
loaded: false,
|
|
20
|
-
sourceName: '',
|
|
21
|
-
rowCount: 0,
|
|
22
|
-
colCount: 0
|
|
23
|
-
});
|
|
24
|
-
this._table = null;
|
|
25
|
-
this._tabs = null;
|
|
26
|
-
this._uploadRef = null;
|
|
27
|
-
this._inlineUpload = null;
|
|
28
|
-
this._uploadButtonLabel = 'Upload File';
|
|
29
|
-
this._uploadButtonIcon = 'upload';
|
|
30
|
-
this._uploadButtonVariant = 'outline';
|
|
31
|
-
this._uploadAccept = '.csv,.tsv,.txt,.xlsx,.xls';
|
|
32
|
-
this._uploadDescription = '';
|
|
33
|
-
this._showUploadIcon = true;
|
|
34
|
-
this._pendingSource = null;
|
|
35
|
-
// Initialize data source
|
|
36
|
-
this._source = dataFrameSource({
|
|
37
|
-
maxFileSize: options.maxFileSize ?? 50,
|
|
38
|
-
maxSheetSize: options.maxSheetSize ?? 100000,
|
|
39
|
-
sheetChunkSize: options.sheetChunkSize ?? 10000,
|
|
40
|
-
persistToIndexedDB: options.persistToIndexedDB ?? false,
|
|
41
|
-
dbName: options.dbName ?? 'jux-dataframes',
|
|
42
|
-
storeName: options.storeName ?? 'frames'
|
|
43
|
-
});
|
|
44
|
-
// Wire up source callbacks
|
|
45
|
-
this._source.onLoad((result) => this._handleLoadResult(result));
|
|
46
|
-
this._source.onError((message) => this._handleError(message));
|
|
47
|
-
this._source.onProgress((loaded, total) => this._handleProgress(loaded, total));
|
|
48
|
-
// Initialize import settings modal
|
|
49
|
-
this._importModal = new ImportSettingsModal(id, this._source.driver, {
|
|
50
|
-
maxSheetSize: options.maxSheetSize ?? 100000,
|
|
51
|
-
sheetChunkSize: options.sheetChunkSize ?? 10000
|
|
52
|
-
});
|
|
53
|
-
this._tableOptions = {
|
|
54
|
-
striped: options.striped ?? true,
|
|
55
|
-
hoverable: options.hoverable ?? true,
|
|
56
|
-
sortable: options.sortable ?? true,
|
|
57
|
-
filterable: options.filterable ?? false,
|
|
58
|
-
paginated: options.paginated ?? true,
|
|
59
|
-
rowsPerPage: options.rowsPerPage ?? 25
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
getTriggerEvents() { return TRIGGER_EVENTS; }
|
|
63
|
-
getCallbackEvents() { return CALLBACK_EVENTS; }
|
|
64
|
-
/* ═══════════════════════════════════════════════════
|
|
65
|
-
* DATA SOURCE METHODS (Delegate to DataFrameSource)
|
|
66
|
-
* ═══════════════════════════════════════════════════ */
|
|
67
|
-
/**
|
|
68
|
-
* Load from IndexedDB storage
|
|
69
|
-
*/
|
|
70
|
-
fromStorage(key) {
|
|
71
|
-
const loadFn = async () => {
|
|
72
|
-
this.state.loading = true;
|
|
73
|
-
this._updateStatus('Loading...', 'loading');
|
|
74
|
-
await this._source.fromStorage(key);
|
|
75
|
-
};
|
|
76
|
-
if (this._table) {
|
|
77
|
-
loadFn();
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
this._pendingSource = loadFn;
|
|
81
|
-
}
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Load from a FileUpload component
|
|
86
|
-
*/
|
|
87
|
-
fromUpload(upload) {
|
|
88
|
-
this._uploadRef = upload;
|
|
89
|
-
this._pendingSource = async () => {
|
|
90
|
-
this._source.fromUpload(upload);
|
|
91
|
-
};
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Load from inline data
|
|
96
|
-
*/
|
|
97
|
-
fromData(data) {
|
|
98
|
-
const loadFn = async () => {
|
|
99
|
-
this.state.loading = true;
|
|
100
|
-
this._updateStatus('Loading data...', 'loading');
|
|
101
|
-
this._source.fromData(data);
|
|
102
|
-
};
|
|
103
|
-
if (this._table) {
|
|
104
|
-
loadFn();
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
this._pendingSource = loadFn;
|
|
108
|
-
}
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Load from a URL
|
|
113
|
-
*/
|
|
114
|
-
fromUrl(url) {
|
|
115
|
-
const loadFn = async () => {
|
|
116
|
-
this.state.loading = true;
|
|
117
|
-
this._updateStatus('Fetching...', 'loading');
|
|
118
|
-
await this._source.fromUrl(url);
|
|
119
|
-
};
|
|
120
|
-
if (this._table) {
|
|
121
|
-
loadFn();
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this._pendingSource = loadFn;
|
|
125
|
-
}
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Enable inline file upload UI
|
|
130
|
-
*/
|
|
131
|
-
withUpload(label = 'Upload File', accept = '.csv,.tsv,.txt,.xlsx,.xls', icon = 'upload') {
|
|
132
|
-
this._inlineUpload = { label, accept, icon };
|
|
133
|
-
this._uploadButtonLabel = label;
|
|
134
|
-
this._uploadAccept = accept;
|
|
135
|
-
this._uploadButtonIcon = icon;
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
/* ═══════════════════════════════════════════════════
|
|
139
|
-
* UPLOAD UI CONFIGURATION
|
|
140
|
-
* ═══════════════════════════════════════════════════ */
|
|
141
|
-
uploadLabel(label) { this._uploadButtonLabel = label; return this; }
|
|
142
|
-
uploadIcon(icon) { this._uploadButtonIcon = icon; this._showUploadIcon = !!icon; return this; }
|
|
143
|
-
uploadVariant(variant) { this._uploadButtonVariant = variant; return this; }
|
|
144
|
-
uploadAccept(accept) { this._uploadAccept = accept; return this; }
|
|
145
|
-
uploadDescription(description) { this._uploadDescription = description; return this; }
|
|
146
|
-
showUploadIcon(show) { this._showUploadIcon = show; return this; }
|
|
147
|
-
/* ═══════════════════════════════════════════════════
|
|
148
|
-
* TABLE OPTIONS
|
|
149
|
-
* ═══════════════════════════════════════════════════ */
|
|
150
|
-
striped(v) { this._tableOptions.striped = v; return this; }
|
|
151
|
-
hoverable(v) { this._tableOptions.hoverable = v; return this; }
|
|
152
|
-
sortable(v) { this._tableOptions.sortable = v; return this; }
|
|
153
|
-
filterable(v) { this._tableOptions.filterable = v; return this; }
|
|
154
|
-
paginated(v) { this._tableOptions.paginated = v; return this; }
|
|
155
|
-
rowsPerPage(v) { this._tableOptions.rowsPerPage = v; return this; }
|
|
156
|
-
/* ═══════════════════════════════════════════════════
|
|
157
|
-
* ACCESSORS (Delegate to DataFrameSource)
|
|
158
|
-
* ═══════════════════════════════════════════════════ */
|
|
159
|
-
get df() { return this._source.df; }
|
|
160
|
-
get source() { return this._source; }
|
|
161
|
-
get table() { return this._table; }
|
|
162
|
-
get shape() { return this._source.shape; }
|
|
163
|
-
get columns() { return this._source.columns; }
|
|
164
|
-
toRows() { return this._source.df?.toRows() ?? []; }
|
|
165
|
-
toCSV(delimiter) { return this._source.df?.toCSV(delimiter) ?? ''; }
|
|
166
|
-
describe() { return this._source.df?.describe() ?? null; }
|
|
167
|
-
async save(key) {
|
|
168
|
-
return this._source.save(key);
|
|
169
|
-
}
|
|
170
|
-
/* ═══════════════════════════════════════════════════
|
|
171
|
-
* TRANSFORM API (Operate on underlying DataFrame)
|
|
172
|
-
* ═══════════════════════════════════════════════════ */
|
|
173
|
-
apply(fn) {
|
|
174
|
-
const df = this._source.df;
|
|
175
|
-
if (!df)
|
|
176
|
-
return this;
|
|
177
|
-
const result = fn(df);
|
|
178
|
-
this._source.fromData(result.toRows(), this.state.sourceName + ' (transformed)');
|
|
179
|
-
this._triggerCallback('transform', result, null, this);
|
|
180
|
-
return this;
|
|
181
|
-
}
|
|
182
|
-
filter(predicate) {
|
|
183
|
-
return this.apply(df => df.filter(predicate));
|
|
184
|
-
}
|
|
185
|
-
select(...cols) {
|
|
186
|
-
return this.apply(df => df.select(...cols));
|
|
187
|
-
}
|
|
188
|
-
sort(col, descending) {
|
|
189
|
-
return this.apply(df => df.sort(col, descending));
|
|
190
|
-
}
|
|
191
|
-
head(n = 5) {
|
|
192
|
-
return this.apply(df => df.head(n));
|
|
193
|
-
}
|
|
194
|
-
tail(n = 5) {
|
|
195
|
-
return this.apply(df => df.tail(n));
|
|
196
|
-
}
|
|
197
|
-
/* ═══════════════════════════════════════════════════
|
|
198
|
-
* CLEAR / RESET
|
|
199
|
-
* ═══════════════════════════════════════════════════ */
|
|
200
|
-
async clear() {
|
|
201
|
-
await this._source.clearStorage();
|
|
202
|
-
this._source.clear();
|
|
203
|
-
this.state.loaded = false;
|
|
204
|
-
this.state.sourceName = '';
|
|
205
|
-
this.state.rowCount = 0;
|
|
206
|
-
this.state.colCount = 0;
|
|
207
|
-
if (this._table) {
|
|
208
|
-
this._table.columns([]).rows([]);
|
|
209
|
-
}
|
|
210
|
-
this._hideDataView();
|
|
211
|
-
this._uploadRef?.clear();
|
|
212
|
-
return this;
|
|
213
|
-
}
|
|
214
|
-
/* ═══════════════════════════════════════════════════
|
|
215
|
-
* INTERNAL HANDLERS
|
|
216
|
-
* ═══════════════════════════════════════════════════ */
|
|
217
|
-
_handleLoadResult(result) {
|
|
218
|
-
if (result.error) {
|
|
219
|
-
this._handleError(result.error);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
this.state.loading = false;
|
|
223
|
-
this.state.loaded = true;
|
|
224
|
-
this.state.sourceName = result.sourceName;
|
|
225
|
-
this.state.rowCount = result.df?.height ?? 0;
|
|
226
|
-
this.state.colCount = result.df?.width ?? 0;
|
|
227
|
-
if (result.isMultiSheet && result.sheets) {
|
|
228
|
-
this._renderMultiSheet(result.sheets, result.sourceName);
|
|
229
|
-
}
|
|
230
|
-
else if (result.df) {
|
|
231
|
-
this._renderSingleSheet(result.df);
|
|
232
|
-
}
|
|
233
|
-
this._updateStatus('', 'success');
|
|
234
|
-
this._triggerCallback('load', result.df, null, this);
|
|
235
|
-
}
|
|
236
|
-
_handleError(message) {
|
|
237
|
-
this.state.loading = false;
|
|
238
|
-
this._updateStatus(message, 'error');
|
|
239
|
-
this._triggerCallback('error', message, null, this);
|
|
240
|
-
}
|
|
241
|
-
_handleProgress(loaded, total) {
|
|
242
|
-
const pct = total ? Math.round((loaded / total) * 100) : 0;
|
|
243
|
-
this._updateStatus(`Loading... ${pct}%`, 'loading');
|
|
244
|
-
}
|
|
245
|
-
_renderSingleSheet(df) {
|
|
246
|
-
if (this._table) {
|
|
247
|
-
const columnDefs = df.columns.map(col => ({ key: col, label: col }));
|
|
248
|
-
this._table.columns(columnDefs).rows(df.toRows());
|
|
249
|
-
}
|
|
250
|
-
this._showDataView();
|
|
251
|
-
}
|
|
252
|
-
_renderMultiSheet(sheets, sourceName) {
|
|
253
|
-
const wrapper = document.getElementById(this._id);
|
|
254
|
-
if (!wrapper)
|
|
255
|
-
return;
|
|
256
|
-
// Clear existing tabs
|
|
257
|
-
const existingTabs = wrapper.querySelector('.jux-tabs');
|
|
258
|
-
if (existingTabs)
|
|
259
|
-
existingTabs.remove();
|
|
260
|
-
const sheetNames = Object.keys(sheets);
|
|
261
|
-
const sanitizeId = (name) => name.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
262
|
-
const tabDefs = sheetNames.map(name => ({
|
|
263
|
-
id: sanitizeId(name),
|
|
264
|
-
label: name,
|
|
265
|
-
content: ''
|
|
266
|
-
}));
|
|
267
|
-
this._tabs = new Tabs(`${this._id}-tabs`, {
|
|
268
|
-
tabs: tabDefs,
|
|
269
|
-
activeTab: sanitizeId(sheetNames[0])
|
|
270
|
-
});
|
|
271
|
-
const dataContainer = wrapper.querySelector('.jux-dataframe-data');
|
|
272
|
-
if (dataContainer) {
|
|
273
|
-
dataContainer.style.display = '';
|
|
274
|
-
const tabsContainer = document.createElement('div');
|
|
275
|
-
tabsContainer.className = 'jux-dataframe-tabs';
|
|
276
|
-
dataContainer.appendChild(tabsContainer);
|
|
277
|
-
this._tabs.render(tabsContainer);
|
|
278
|
-
}
|
|
279
|
-
sheetNames.forEach(sheetName => {
|
|
280
|
-
const df = sheets[sheetName];
|
|
281
|
-
const safeId = sanitizeId(sheetName);
|
|
282
|
-
const table = new Table(`${this._id}-table-${safeId}`, this._tableOptions);
|
|
283
|
-
const columnDefs = df.columns.map(col => ({ key: col, label: col }));
|
|
284
|
-
table.columns(columnDefs).rows(df.toRows());
|
|
285
|
-
const settingsBtn = new Button(`${this._id}-settings-${safeId}`, {
|
|
286
|
-
label: '⚙️ Import Settings',
|
|
287
|
-
variant: 'ghost',
|
|
288
|
-
size: 'small'
|
|
289
|
-
});
|
|
290
|
-
settingsBtn.bind('click', () => this._showImportSettings());
|
|
291
|
-
this._tabs.addTabContent(safeId, [settingsBtn, table]);
|
|
292
|
-
});
|
|
293
|
-
this._showDataView();
|
|
294
|
-
}
|
|
295
|
-
/* ═══════════════════════════════════════════════════
|
|
296
|
-
* UI HELPERS
|
|
297
|
-
* ═══════════════════════════════════════════════════ */
|
|
298
|
-
_updateStatus(text, type) {
|
|
299
|
-
const el = document.getElementById(`${this._id}-status`);
|
|
300
|
-
if (!el)
|
|
301
|
-
return;
|
|
302
|
-
if (type === 'loading' || type === 'error') {
|
|
303
|
-
el.style.display = '';
|
|
304
|
-
el.className = `jux-dataframe-status jux-dataframe-status-${type}`;
|
|
305
|
-
el.textContent = text;
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
el.style.display = 'none';
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
_showDataView() {
|
|
312
|
-
const wrapper = document.getElementById(this._id);
|
|
313
|
-
if (!wrapper)
|
|
314
|
-
return;
|
|
315
|
-
const uploadArea = wrapper.querySelector('.jux-dataframe-upload-area');
|
|
316
|
-
if (uploadArea)
|
|
317
|
-
uploadArea.style.display = 'none';
|
|
318
|
-
const dataContainer = wrapper.querySelector('.jux-dataframe-data');
|
|
319
|
-
if (dataContainer)
|
|
320
|
-
dataContainer.style.display = '';
|
|
321
|
-
this._updateSettingsGear();
|
|
322
|
-
}
|
|
323
|
-
_hideDataView() {
|
|
324
|
-
const wrapper = document.getElementById(this._id);
|
|
325
|
-
if (!wrapper)
|
|
326
|
-
return;
|
|
327
|
-
const uploadArea = wrapper.querySelector('.jux-dataframe-upload-area');
|
|
328
|
-
if (uploadArea)
|
|
329
|
-
uploadArea.style.display = '';
|
|
330
|
-
const dataContainer = wrapper.querySelector('.jux-dataframe-data');
|
|
331
|
-
if (dataContainer)
|
|
332
|
-
dataContainer.style.display = 'none';
|
|
333
|
-
}
|
|
334
|
-
_updateSettingsGear() {
|
|
335
|
-
const gear = document.getElementById(`${this._id}-settings-gear`);
|
|
336
|
-
if (!gear || !this._source.df)
|
|
337
|
-
return;
|
|
338
|
-
const isMalformed = this._source.detectMalformed();
|
|
339
|
-
if (isMalformed) {
|
|
340
|
-
gear.classList.add('jux-dataframe-gear-warning');
|
|
341
|
-
gear.title = `${this.state.sourceName} — May need reformatting`;
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
gear.classList.remove('jux-dataframe-gear-warning');
|
|
345
|
-
gear.title = `${this.state.sourceName} — ${this._source.height} rows × ${this._source.width} cols`;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
_showSettingsModal() {
|
|
349
|
-
this._importModal.showSettings({
|
|
350
|
-
fileName: this._source.rawFileData?.file?.name || this.state.sourceName,
|
|
351
|
-
fileSize: this._source.rawFileData?.file?.size,
|
|
352
|
-
rowCount: this._source.height,
|
|
353
|
-
colCount: this._source.width,
|
|
354
|
-
isMalformed: this._source.detectMalformed(),
|
|
355
|
-
hasRawFileData: !!this._source.rawFileData
|
|
356
|
-
}, {
|
|
357
|
-
onClear: async () => { await this.clear(); },
|
|
358
|
-
onAdjustImport: () => { this._showImportSettings(); }
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
_showImportSettings() {
|
|
362
|
-
const rawData = this._source.rawFileData;
|
|
363
|
-
if (!rawData)
|
|
364
|
-
return;
|
|
365
|
-
this._importModal.showImportSettings(rawData, {
|
|
366
|
-
onReimport: async (result, sourceName) => {
|
|
367
|
-
if (result instanceof DataFrame) {
|
|
368
|
-
this._source.fromData(result.toRows(), sourceName);
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
// Multi-sheet - handled by source callbacks
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
onError: (message) => this._handleError(message),
|
|
375
|
-
onStatusUpdate: (text, type) => {
|
|
376
|
-
this.state.loading = type === 'loading';
|
|
377
|
-
this._updateStatus(text, type);
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
/* ═══════════════════════════════════════════════════
|
|
382
|
-
* RENDER
|
|
383
|
-
* ═══════════════════════════════════════════════════ */
|
|
384
|
-
update(_prop, _value) { }
|
|
385
|
-
render(targetId) {
|
|
386
|
-
const container = this._setupContainer(targetId);
|
|
387
|
-
const { style, class: className } = this.state;
|
|
388
|
-
const wrapper = document.createElement('div');
|
|
389
|
-
wrapper.className = 'jux-dataframe';
|
|
390
|
-
wrapper.id = this._id;
|
|
391
|
-
if (className)
|
|
392
|
-
wrapper.className += ` ${className}`;
|
|
393
|
-
if (style)
|
|
394
|
-
wrapper.setAttribute('style', style);
|
|
395
|
-
// Upload area
|
|
396
|
-
if (this._inlineUpload) {
|
|
397
|
-
const uploadArea = document.createElement('div');
|
|
398
|
-
uploadArea.className = 'jux-dataframe-upload-area';
|
|
399
|
-
const uploadOpts = {
|
|
400
|
-
label: this._uploadButtonLabel,
|
|
401
|
-
accept: this._uploadAccept,
|
|
402
|
-
variant: this._uploadButtonVariant,
|
|
403
|
-
};
|
|
404
|
-
if (this._showUploadIcon)
|
|
405
|
-
uploadOpts.icon = this._uploadButtonIcon;
|
|
406
|
-
const upload = new FileUpload(`${this._id}-upload`, uploadOpts);
|
|
407
|
-
this._uploadRef = upload;
|
|
408
|
-
// Wire upload to source
|
|
409
|
-
upload.bind('change', async (files) => {
|
|
410
|
-
if (!files || files.length === 0) {
|
|
411
|
-
await this.clear();
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
this.state.loading = true;
|
|
415
|
-
this._updateStatus(`Parsing ${files[0].name}...`, 'loading');
|
|
416
|
-
await this._source.fromFile(files[0]);
|
|
417
|
-
});
|
|
418
|
-
const uploadContainer = document.createElement('div');
|
|
419
|
-
uploadContainer.className = 'jux-dataframe-upload';
|
|
420
|
-
uploadArea.appendChild(uploadContainer);
|
|
421
|
-
const statusBar = document.createElement('div');
|
|
422
|
-
statusBar.className = 'jux-dataframe-status';
|
|
423
|
-
statusBar.id = `${this._id}-status`;
|
|
424
|
-
statusBar.style.display = 'none';
|
|
425
|
-
uploadArea.appendChild(statusBar);
|
|
426
|
-
if (this._uploadDescription) {
|
|
427
|
-
const descEl = document.createElement('div');
|
|
428
|
-
descEl.className = 'jux-dataframe-upload-description';
|
|
429
|
-
descEl.textContent = this._uploadDescription;
|
|
430
|
-
uploadArea.appendChild(descEl);
|
|
431
|
-
}
|
|
432
|
-
wrapper.appendChild(uploadArea);
|
|
433
|
-
container.appendChild(wrapper);
|
|
434
|
-
upload.render(uploadContainer);
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
container.appendChild(wrapper);
|
|
438
|
-
}
|
|
439
|
-
// Data container
|
|
440
|
-
const dataContainer = document.createElement('div');
|
|
441
|
-
dataContainer.className = 'jux-dataframe-data';
|
|
442
|
-
dataContainer.style.display = 'none';
|
|
443
|
-
const toolbar = document.createElement('div');
|
|
444
|
-
toolbar.className = 'jux-dataframe-toolbar';
|
|
445
|
-
const settingsGear = document.createElement('button');
|
|
446
|
-
settingsGear.className = 'jux-dataframe-gear';
|
|
447
|
-
settingsGear.id = `${this._id}-settings-gear`;
|
|
448
|
-
settingsGear.type = 'button';
|
|
449
|
-
settingsGear.innerHTML = '⚙️';
|
|
450
|
-
settingsGear.title = 'Data Settings';
|
|
451
|
-
settingsGear.addEventListener('click', () => this._showSettingsModal());
|
|
452
|
-
toolbar.appendChild(settingsGear);
|
|
453
|
-
dataContainer.appendChild(toolbar);
|
|
454
|
-
wrapper.appendChild(dataContainer);
|
|
455
|
-
// Table
|
|
456
|
-
const tbl = new Table(`${this._id}-table`, this._tableOptions);
|
|
457
|
-
tbl.render(dataContainer);
|
|
458
|
-
this._table = tbl;
|
|
459
|
-
if (this._pendingSource) {
|
|
460
|
-
const fn = this._pendingSource;
|
|
461
|
-
this._pendingSource = null;
|
|
462
|
-
fn();
|
|
463
|
-
}
|
|
464
|
-
this._wireStandardEvents(wrapper);
|
|
465
|
-
return this;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
export function dataframe(id, options = {}) {
|
|
469
|
-
return new DataFrameComponent(id, options);
|
|
470
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { BaseComponent, BaseState } from './base/BaseComponent.js';
|
|
2
|
-
export interface DatePickerOptions {
|
|
3
|
-
value?: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
name?: string;
|
|
9
|
-
min?: string;
|
|
10
|
-
max?: string;
|
|
11
|
-
style?: string;
|
|
12
|
-
class?: string;
|
|
13
|
-
onValidate?: (value: string) => boolean | string;
|
|
14
|
-
}
|
|
15
|
-
interface DatePickerState extends BaseState {
|
|
16
|
-
value: string;
|
|
17
|
-
placeholder: string;
|
|
18
|
-
min?: string;
|
|
19
|
-
max?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class DatePicker extends BaseComponent<DatePickerState> {
|
|
22
|
-
constructor(id: string, options?: DatePickerOptions);
|
|
23
|
-
protected getTriggerEvents(): readonly string[];
|
|
24
|
-
protected getCallbackEvents(): readonly string[];
|
|
25
|
-
value(value: string): this;
|
|
26
|
-
placeholder(value: string): this;
|
|
27
|
-
min(value: string): this;
|
|
28
|
-
max(value: string): this;
|
|
29
|
-
getValue(): string;
|
|
30
|
-
setValue(value: string): this;
|
|
31
|
-
getDate(): Date | null;
|
|
32
|
-
validate(): boolean;
|
|
33
|
-
isValid(): boolean;
|
|
34
|
-
protected _validateValue(value: string): boolean | string;
|
|
35
|
-
protected _buildInputElement(): HTMLElement;
|
|
36
|
-
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
37
|
-
}
|
|
38
|
-
export declare function datepicker(id: string, options?: DatePickerOptions): DatePicker;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=datepicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker.d.ts","sourceRoot":"","sources":["datepicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,UAAU,eAAgB,SAAQ,SAAS;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAW,SAAQ,aAAa,CAAC,eAAe,CAAC;gBAC9C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB;IAuBvD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKxB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IASxB,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ7B,OAAO,IAAI,IAAI,GAAG,IAAI;IAMtB,QAAQ,IAAI,OAAO;IAcnB,OAAO,IAAI,OAAO;IAKlB,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM;IAuCzD,SAAS,CAAC,kBAAkB,IAAI,WAAW;IAuB3C,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA2DrE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAElF"}
|