juxscript 1.1.240 → 1.1.244

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 (297) hide show
  1. package/index.js +7 -137
  2. package/lib/components/dataframe.ts +0 -569
  3. package/lib/components/include.ts +229 -229
  4. package/lib/components/tag.ts +68 -0
  5. package/lib/styles/shadcn.css +17 -5
  6. package/lib/utils/idgen.ts +6 -0
  7. package/package.json +5 -6
  8. package/index.d.ts +0 -239
  9. package/index.d.ts.map +0 -1
  10. package/lib/components/alert.d.ts +0 -36
  11. package/lib/components/alert.d.ts.map +0 -1
  12. package/lib/components/alert.js +0 -172
  13. package/lib/components/alert.ts +0 -219
  14. package/lib/components/app.d.ts +0 -89
  15. package/lib/components/app.d.ts.map +0 -1
  16. package/lib/components/app.js +0 -175
  17. package/lib/components/app.ts +0 -247
  18. package/lib/components/badge.d.ts +0 -26
  19. package/lib/components/badge.d.ts.map +0 -1
  20. package/lib/components/badge.js +0 -91
  21. package/lib/components/badge.ts +0 -118
  22. package/lib/components/base/Animations.d.ts +0 -36
  23. package/lib/components/base/Animations.d.ts.map +0 -1
  24. package/lib/components/base/Animations.js +0 -70
  25. package/lib/components/base/Animations.ts +0 -112
  26. package/lib/components/base/BaseComponent.d.ts +0 -294
  27. package/lib/components/base/BaseComponent.d.ts.map +0 -1
  28. package/lib/components/base/BaseComponent.js +0 -735
  29. package/lib/components/base/BaseComponent.ts +0 -884
  30. package/lib/components/base/FormInput.d.ts +0 -77
  31. package/lib/components/base/FormInput.d.ts.map +0 -1
  32. package/lib/components/base/FormInput.js +0 -171
  33. package/lib/components/base/FormInput.ts +0 -237
  34. package/lib/components/blueprint.d.ts +0 -40
  35. package/lib/components/blueprint.d.ts.map +0 -1
  36. package/lib/components/blueprint.js +0 -327
  37. package/lib/components/button.d.ts +0 -70
  38. package/lib/components/button.d.ts.map +0 -1
  39. package/lib/components/button.js +0 -177
  40. package/lib/components/button.ts +0 -237
  41. package/lib/components/card.d.ts +0 -35
  42. package/lib/components/card.d.ts.map +0 -1
  43. package/lib/components/card.js +0 -130
  44. package/lib/components/card.ts +0 -177
  45. package/lib/components/chart.d.ts +0 -49
  46. package/lib/components/chart.d.ts.map +0 -1
  47. package/lib/components/chart.js +0 -205
  48. package/lib/components/chart.ts +0 -254
  49. package/lib/components/checkbox.d.ts +0 -33
  50. package/lib/components/checkbox.d.ts.map +0 -1
  51. package/lib/components/checkbox.js +0 -202
  52. package/lib/components/checkbox.ts +0 -260
  53. package/lib/components/code.d.ts +0 -52
  54. package/lib/components/code.d.ts.map +0 -1
  55. package/lib/components/code.js +0 -201
  56. package/lib/components/code.ts +0 -260
  57. package/lib/components/container.d.ts +0 -60
  58. package/lib/components/container.d.ts.map +0 -1
  59. package/lib/components/container.js +0 -195
  60. package/lib/components/container.ts +0 -259
  61. package/lib/components/data.d.ts +0 -36
  62. package/lib/components/data.d.ts.map +0 -1
  63. package/lib/components/data.js +0 -110
  64. package/lib/components/data.ts +0 -135
  65. package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
  66. package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
  67. package/lib/components/dataframe/DataFrameSource.js +0 -421
  68. package/lib/components/dataframe/DataFrameSource.ts +0 -532
  69. package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
  70. package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
  71. package/lib/components/dataframe/ImportSettingsModal.js +0 -442
  72. package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
  73. package/lib/components/dataframe.d.ts +0 -110
  74. package/lib/components/dataframe.d.ts.map +0 -1
  75. package/lib/components/dataframe.js +0 -470
  76. package/lib/components/datepicker.d.ts +0 -40
  77. package/lib/components/datepicker.d.ts.map +0 -1
  78. package/lib/components/datepicker.js +0 -193
  79. package/lib/components/datepicker.ts +0 -251
  80. package/lib/components/dialog.d.ts +0 -39
  81. package/lib/components/dialog.d.ts.map +0 -1
  82. package/lib/components/dialog.js +0 -131
  83. package/lib/components/dialog.ts +0 -178
  84. package/lib/components/divider.d.ts +0 -31
  85. package/lib/components/divider.d.ts.map +0 -1
  86. package/lib/components/divider.js +0 -72
  87. package/lib/components/divider.ts +0 -104
  88. package/lib/components/dropdown-menu.d.ts +0 -42
  89. package/lib/components/dropdown-menu.d.ts.map +0 -1
  90. package/lib/components/dropdown-menu.js +0 -177
  91. package/lib/components/dropdown-menu.ts +0 -214
  92. package/lib/components/dropdown.d.ts +0 -41
  93. package/lib/components/dropdown.d.ts.map +0 -1
  94. package/lib/components/dropdown.js +0 -136
  95. package/lib/components/dropdown.ts +0 -188
  96. package/lib/components/element.d.ts +0 -51
  97. package/lib/components/element.d.ts.map +0 -1
  98. package/lib/components/element.js +0 -209
  99. package/lib/components/element.ts +0 -271
  100. package/lib/components/event-chain.d.ts +0 -9
  101. package/lib/components/event-chain.d.ts.map +0 -1
  102. package/lib/components/event-chain.js +0 -33
  103. package/lib/components/fileupload.d.ts +0 -98
  104. package/lib/components/fileupload.d.ts.map +0 -1
  105. package/lib/components/fileupload.js +0 -351
  106. package/lib/components/fileupload.ts +0 -449
  107. package/lib/components/grid.d.ts +0 -88
  108. package/lib/components/grid.d.ts.map +0 -1
  109. package/lib/components/grid.js +0 -208
  110. package/lib/components/grid.ts +0 -295
  111. package/lib/components/heading.d.ts +0 -25
  112. package/lib/components/heading.d.ts.map +0 -1
  113. package/lib/components/heading.js +0 -83
  114. package/lib/components/heading.ts +0 -113
  115. package/lib/components/helpers.d.ts +0 -9
  116. package/lib/components/helpers.d.ts.map +0 -1
  117. package/lib/components/helpers.js +0 -30
  118. package/lib/components/helpers.ts +0 -41
  119. package/lib/components/hero.d.ts +0 -60
  120. package/lib/components/hero.d.ts.map +0 -1
  121. package/lib/components/hero.js +0 -239
  122. package/lib/components/hero.ts +0 -302
  123. package/lib/components/history/StateHistory.d.ts +0 -91
  124. package/lib/components/history/StateHistory.d.ts.map +0 -1
  125. package/lib/components/history/StateHistory.js +0 -154
  126. package/lib/components/history/StateHistory.ts +0 -200
  127. package/lib/components/icon.d.ts +0 -36
  128. package/lib/components/icon.d.ts.map +0 -1
  129. package/lib/components/icon.js +0 -135
  130. package/lib/components/icon.ts +0 -182
  131. package/lib/components/icons.d.ts +0 -25
  132. package/lib/components/icons.d.ts.map +0 -1
  133. package/lib/components/icons.js +0 -440
  134. package/lib/components/icons.ts +0 -464
  135. package/lib/components/image.d.ts +0 -42
  136. package/lib/components/image.d.ts.map +0 -1
  137. package/lib/components/image.js +0 -204
  138. package/lib/components/image.ts +0 -260
  139. package/lib/components/include.d.ts +0 -86
  140. package/lib/components/include.d.ts.map +0 -1
  141. package/lib/components/include.js +0 -238
  142. package/lib/components/input.d.ts +0 -85
  143. package/lib/components/input.d.ts.map +0 -1
  144. package/lib/components/input.js +0 -362
  145. package/lib/components/input.ts +0 -473
  146. package/lib/components/layer.d.ts +0 -72
  147. package/lib/components/layer.d.ts.map +0 -1
  148. package/lib/components/layer.js +0 -219
  149. package/lib/components/layer.ts +0 -304
  150. package/lib/components/link.d.ts +0 -41
  151. package/lib/components/link.d.ts.map +0 -1
  152. package/lib/components/link.js +0 -216
  153. package/lib/components/link.ts +0 -268
  154. package/lib/components/list.d.ts +0 -83
  155. package/lib/components/list.d.ts.map +0 -1
  156. package/lib/components/list.js +0 -314
  157. package/lib/components/list.ts +0 -423
  158. package/lib/components/loading.d.ts +0 -25
  159. package/lib/components/loading.d.ts.map +0 -1
  160. package/lib/components/loading.js +0 -76
  161. package/lib/components/loading.ts +0 -104
  162. package/lib/components/menu.d.ts +0 -38
  163. package/lib/components/menu.d.ts.map +0 -1
  164. package/lib/components/menu.js +0 -205
  165. package/lib/components/menu.ts +0 -279
  166. package/lib/components/modal.d.ts +0 -97
  167. package/lib/components/modal.d.ts.map +0 -1
  168. package/lib/components/modal.js +0 -463
  169. package/lib/components/modal.ts +0 -576
  170. package/lib/components/nav.d.ts +0 -46
  171. package/lib/components/nav.d.ts.map +0 -1
  172. package/lib/components/nav.js +0 -193
  173. package/lib/components/nav.ts +0 -261
  174. package/lib/components/paragraph.d.ts +0 -30
  175. package/lib/components/paragraph.d.ts.map +0 -1
  176. package/lib/components/paragraph.js +0 -93
  177. package/lib/components/paragraph.ts +0 -123
  178. package/lib/components/pen.d.ts +0 -125
  179. package/lib/components/pen.d.ts.map +0 -1
  180. package/lib/components/pen.js +0 -443
  181. package/lib/components/pen.ts +0 -567
  182. package/lib/components/progress.d.ts +0 -40
  183. package/lib/components/progress.d.ts.map +0 -1
  184. package/lib/components/progress.js +0 -116
  185. package/lib/components/progress.ts +0 -163
  186. package/lib/components/radio.d.ts +0 -43
  187. package/lib/components/radio.d.ts.map +0 -1
  188. package/lib/components/radio.js +0 -226
  189. package/lib/components/radio.ts +0 -303
  190. package/lib/components/registry.d.ts +0 -34
  191. package/lib/components/registry.d.ts.map +0 -1
  192. package/lib/components/registry.js +0 -163
  193. package/lib/components/registry.ts +0 -193
  194. package/lib/components/req.d.ts +0 -155
  195. package/lib/components/req.d.ts.map +0 -1
  196. package/lib/components/req.js +0 -253
  197. package/lib/components/req.ts +0 -303
  198. package/lib/components/script.d.ts +0 -14
  199. package/lib/components/script.d.ts.map +0 -1
  200. package/lib/components/script.js +0 -33
  201. package/lib/components/script.ts +0 -41
  202. package/lib/components/select.d.ts +0 -42
  203. package/lib/components/select.d.ts.map +0 -1
  204. package/lib/components/select.js +0 -209
  205. package/lib/components/select.ts +0 -281
  206. package/lib/components/sidebar.d.ts +0 -59
  207. package/lib/components/sidebar.d.ts.map +0 -1
  208. package/lib/components/sidebar.js +0 -298
  209. package/lib/components/sidebar.ts +0 -395
  210. package/lib/components/stack/BaseStack.d.ts +0 -65
  211. package/lib/components/stack/BaseStack.d.ts.map +0 -1
  212. package/lib/components/stack/BaseStack.js +0 -274
  213. package/lib/components/stack/BaseStack.ts +0 -328
  214. package/lib/components/stack/HStack.d.ts +0 -18
  215. package/lib/components/stack/HStack.d.ts.map +0 -1
  216. package/lib/components/stack/HStack.js +0 -22
  217. package/lib/components/stack/HStack.ts +0 -25
  218. package/lib/components/stack/VStack.d.ts +0 -19
  219. package/lib/components/stack/VStack.d.ts.map +0 -1
  220. package/lib/components/stack/VStack.js +0 -23
  221. package/lib/components/stack/VStack.ts +0 -26
  222. package/lib/components/stack/ZStack.d.ts +0 -18
  223. package/lib/components/stack/ZStack.d.ts.map +0 -1
  224. package/lib/components/stack/ZStack.js +0 -22
  225. package/lib/components/stack/ZStack.ts +0 -25
  226. package/lib/components/style.d.ts +0 -14
  227. package/lib/components/style.d.ts.map +0 -1
  228. package/lib/components/style.js +0 -33
  229. package/lib/components/style.ts +0 -41
  230. package/lib/components/switch.d.ts +0 -34
  231. package/lib/components/switch.d.ts.map +0 -1
  232. package/lib/components/switch.js +0 -209
  233. package/lib/components/switch.ts +0 -272
  234. package/lib/components/table.d.ts +0 -137
  235. package/lib/components/table.d.ts.map +0 -1
  236. package/lib/components/table.js +0 -1019
  237. package/lib/components/table.ts +0 -1225
  238. package/lib/components/tabs.d.ts +0 -53
  239. package/lib/components/tabs.d.ts.map +0 -1
  240. package/lib/components/tabs.js +0 -275
  241. package/lib/components/tabs.ts +0 -349
  242. package/lib/components/theme-toggle.d.ts +0 -45
  243. package/lib/components/theme-toggle.d.ts.map +0 -1
  244. package/lib/components/theme-toggle.js +0 -218
  245. package/lib/components/theme-toggle.ts +0 -297
  246. package/lib/components/tooltip.d.ts +0 -31
  247. package/lib/components/tooltip.d.ts.map +0 -1
  248. package/lib/components/tooltip.js +0 -112
  249. package/lib/components/tooltip.ts +0 -148
  250. package/lib/components/watcher.d.ts +0 -195
  251. package/lib/components/watcher.d.ts.map +0 -1
  252. package/lib/components/watcher.js +0 -241
  253. package/lib/components/watcher.ts +0 -261
  254. package/lib/components/write.d.ts +0 -107
  255. package/lib/components/write.d.ts.map +0 -1
  256. package/lib/components/write.js +0 -222
  257. package/lib/components/write.ts +0 -272
  258. package/lib/data/DataPipeline.d.ts +0 -113
  259. package/lib/data/DataPipeline.d.ts.map +0 -1
  260. package/lib/data/DataPipeline.js +0 -359
  261. package/lib/data/DataPipeline.ts +0 -452
  262. package/lib/facades/dataframe.jux +0 -0
  263. package/lib/globals.d.ts +0 -21
  264. package/lib/reactivity/state.d.ts +0 -36
  265. package/lib/reactivity/state.d.ts.map +0 -1
  266. package/lib/reactivity/state.js +0 -67
  267. package/lib/reactivity/state.ts +0 -78
  268. package/lib/storage/DataFrame.d.ts +0 -284
  269. package/lib/storage/DataFrame.d.ts.map +0 -1
  270. package/lib/storage/DataFrame.js +0 -1022
  271. package/lib/storage/DataFrame.ts +0 -1195
  272. package/lib/storage/DataFrameSource.d.ts +0 -158
  273. package/lib/storage/DataFrameSource.d.ts.map +0 -1
  274. package/lib/storage/DataFrameSource.js +0 -409
  275. package/lib/storage/DataFrameSource.ts +0 -556
  276. package/lib/storage/FileStorage.d.ts +0 -53
  277. package/lib/storage/FileStorage.d.ts.map +0 -1
  278. package/lib/storage/FileStorage.js +0 -80
  279. package/lib/storage/FileStorage.ts +0 -95
  280. package/lib/storage/IndexedDBDriver.d.ts +0 -75
  281. package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
  282. package/lib/storage/IndexedDBDriver.js +0 -177
  283. package/lib/storage/IndexedDBDriver.ts +0 -226
  284. package/lib/storage/TabularDriver.d.ts +0 -118
  285. package/lib/storage/TabularDriver.d.ts.map +0 -1
  286. package/lib/storage/TabularDriver.js +0 -731
  287. package/lib/storage/TabularDriver.ts +0 -874
  288. package/lib/utils/codeparser.d.ts +0 -29
  289. package/lib/utils/codeparser.d.ts.map +0 -1
  290. package/lib/utils/codeparser.js +0 -409
  291. package/lib/utils/fetch.d.ts +0 -176
  292. package/lib/utils/fetch.d.ts.map +0 -1
  293. package/lib/utils/fetch.js +0 -427
  294. package/lib/utils/formatId.d.ts +0 -16
  295. package/lib/utils/formatId.d.ts.map +0 -1
  296. package/lib/utils/formatId.js +0 -27
  297. 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"}