flexdesk 0.14.0 → 0.14.1
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/README.md +19 -0
- package/dist/charts.js +2 -2
- package/dist/{chunk-M2L4XW2U.js → chunk-FBGP5KN5.js} +33 -21
- package/dist/chunk-FBGP5KN5.js.map +7 -0
- package/dist/{chunk-IYMNDPWH.js → chunk-RQM5Z2MU.js} +2 -2
- package/dist/flow.js +1 -1
- package/dist/tiles.js +11 -3
- package/dist/tiles.js.map +2 -2
- package/dist/widgets.js +1 -1
- package/package.json +1 -1
- package/src/tiles/chart_tiles.js +14 -1
- package/src/ui/components/data_table.js +32 -14
- package/dist/chunk-M2L4XW2U.js.map +0 -7
- /package/dist/{chunk-IYMNDPWH.js.map → chunk-RQM5Z2MU.js.map} +0 -0
package/README.md
CHANGED
|
@@ -907,6 +907,20 @@ list.setColumnVisible(3, true);
|
|
|
907
907
|
A column sorted on and then hidden keeps the order; its arrow comes back with
|
|
908
908
|
the column.
|
|
909
909
|
|
|
910
|
+
### DataTable: the CSV button on every table (0.14.1)
|
|
911
|
+
|
|
912
|
+
`showExportButton: true` draws "Download visible rows as CSV" in the pagination
|
|
913
|
+
strip, and now draws the strip for it on a table that fits on one page too (the
|
|
914
|
+
button alone, no page buttons). `exportFilename` — a string, or `(table) =>
|
|
915
|
+
string` — names the file (default `data.csv`). With a `host` that has `dialogs`
|
|
916
|
+
the button opens the native Save dialog, suggesting that name; without one it
|
|
917
|
+
is a browser download.
|
|
918
|
+
|
|
919
|
+
```js
|
|
920
|
+
DataTable.mount(el, { headers, rows, pagination: true, showExportButton: true,
|
|
921
|
+
exportFilename: 'bugs.csv', host });
|
|
922
|
+
```
|
|
923
|
+
|
|
910
924
|
### DataTable: a select mode (0.12.0)
|
|
911
925
|
|
|
912
926
|
A list whose click opens a row can still let people pick many rows: a toggle
|
|
@@ -1816,6 +1830,11 @@ still drawing. A pie takes `{labels, values}`, a histogram `{values}`. The confi
|
|
|
1816
1830
|
`buildOverlayShapes` gained `verticalLines: [{x, label?, color?, lineStyle?}]` for
|
|
1817
1831
|
the same marker outside a tile.
|
|
1818
1832
|
|
|
1833
|
+
A chart tile's **Download PNG** (0.14.1) goes through the grid's `host`
|
|
1834
|
+
(`new TileGrid({ host })`): with `dialogs`, the native Save dialog — a save
|
|
1835
|
+
toasts where the file went, a cancel says nothing — and with no host, or a
|
|
1836
|
+
`saveFile` that answers null, the browser download it always was.
|
|
1837
|
+
|
|
1819
1838
|
## Styling
|
|
1820
1839
|
|
|
1821
1840
|
Three stylesheets, and that is the whole CSS contract:
|
package/dist/charts.js
CHANGED
|
@@ -42,10 +42,10 @@ import {
|
|
|
42
42
|
strideIndices,
|
|
43
43
|
uid,
|
|
44
44
|
updateChart
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-RQM5Z2MU.js";
|
|
46
46
|
import {
|
|
47
47
|
createRafResizeObserver
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-FBGP5KN5.js";
|
|
49
49
|
import {
|
|
50
50
|
ManagedWindow
|
|
51
51
|
} from "./chunk-6JSOVNID.js";
|
|
@@ -683,6 +683,7 @@ var DataTable = class {
|
|
|
683
683
|
onRowContextMenu: null,
|
|
684
684
|
onCellContextMenu: null,
|
|
685
685
|
showExportButton: false,
|
|
686
|
+
exportFilename: null,
|
|
686
687
|
// The host port. TOP LEVEL, deliberately — NOT inside `services`,
|
|
687
688
|
// which most call sites never pass. Supplies the native save
|
|
688
689
|
// dialog for downloadCSV(); absent => Blob fallback.
|
|
@@ -2400,7 +2401,7 @@ var DataTable = class {
|
|
|
2400
2401
|
const displayedRows = isServerSide ? rows.length : Math.min(pageSize, effectiveTotal - offset);
|
|
2401
2402
|
const endRow = Math.min(offset + displayedRows, effectiveTotal);
|
|
2402
2403
|
const totalPages = Math.max(1, Math.ceil(effectiveTotal / pageSize));
|
|
2403
|
-
if (totalPages <= 1 && !isFiltered) return
|
|
2404
|
+
if (totalPages <= 1 && !isFiltered) return this._createExportOnlyStrip();
|
|
2404
2405
|
const currentPage = Math.floor(offset / pageSize) + 1;
|
|
2405
2406
|
const hasPrev = offset > 0;
|
|
2406
2407
|
const hasNext = offset + pageSize < effectiveTotal;
|
|
@@ -2471,15 +2472,33 @@ var DataTable = class {
|
|
|
2471
2472
|
el.appendChild(lastBtn);
|
|
2472
2473
|
el.appendChild(jumpInput);
|
|
2473
2474
|
el.appendChild(jumpBtn);
|
|
2474
|
-
if (this.config.showExportButton)
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2475
|
+
if (this.config.showExportButton) el.appendChild(this._createExportBtn());
|
|
2476
|
+
return el;
|
|
2477
|
+
}
|
|
2478
|
+
/** The export button: downloadCSV() under the configured file name. */
|
|
2479
|
+
_createExportBtn() {
|
|
2480
|
+
const name = this.config.exportFilename;
|
|
2481
|
+
const filename = (typeof name === "function" ? name(this) : name) || "data.csv";
|
|
2482
|
+
return this._createPaginationBtn(
|
|
2483
|
+
"download",
|
|
2484
|
+
"Download visible rows as CSV",
|
|
2485
|
+
false,
|
|
2486
|
+
() => this.downloadCSV(filename)
|
|
2487
|
+
);
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* The strip on a table with one page: nothing, as always, unless the export
|
|
2491
|
+
* button needs somewhere to be. Then the button alone, with no page
|
|
2492
|
+
* buttons (0.14.1).
|
|
2493
|
+
*/
|
|
2494
|
+
_createExportOnlyStrip() {
|
|
2495
|
+
if (!this.config.showExportButton) return null;
|
|
2496
|
+
const el = document.createElement("div");
|
|
2497
|
+
el.className = "twm-pagination-controls twm-pagination-controls--export-only";
|
|
2498
|
+
el.style.cssText = "display:flex; align-items:center; gap:6px; padding:2px 8px; border-bottom:1px solid #2a2a2a; font-size:11px;";
|
|
2499
|
+
const spacer = document.createElement("div");
|
|
2500
|
+
spacer.style.flex = "1";
|
|
2501
|
+
el.append(spacer, this._createExportBtn());
|
|
2483
2502
|
return el;
|
|
2484
2503
|
}
|
|
2485
2504
|
_createPaginationBtn(icon, tooltip, disabled, onClick, textLabel = null) {
|
|
@@ -4277,8 +4296,8 @@ var DataTable = class {
|
|
|
4277
4296
|
const pn = this._pageNav({ offset, held: drawn, total, hasMore: hasMoreKnown, pageSize });
|
|
4278
4297
|
const { hasPrev, hasNext, page } = pn;
|
|
4279
4298
|
const totalPages = pn.pages;
|
|
4280
|
-
if (known && totalPages <= 1 && !isFiltered && !hasPrev) return
|
|
4281
|
-
if (!known && !hasPrev && !hasNext) return
|
|
4299
|
+
if (known && totalPages <= 1 && !isFiltered && !hasPrev) return this._createExportOnlyStrip();
|
|
4300
|
+
if (!known && !hasPrev && !hasNext) return this._createExportOnlyStrip();
|
|
4282
4301
|
const maxJump = Number.isFinite(c.maxJumpOffset) ? c.maxJumpOffset : null;
|
|
4283
4302
|
const go = (newOffset) => {
|
|
4284
4303
|
if (source) {
|
|
@@ -4372,14 +4391,7 @@ var DataTable = class {
|
|
|
4372
4391
|
}, "Go");
|
|
4373
4392
|
jumpBtn.dataset.pager = "go";
|
|
4374
4393
|
el.append(info, spacer, firstBtn, prevBtn, pageInfo, nextBtn, lastBtn, jumpInput, jumpBtn);
|
|
4375
|
-
if (c.showExportButton)
|
|
4376
|
-
el.appendChild(this._createPaginationBtn(
|
|
4377
|
-
"download",
|
|
4378
|
-
"Download visible rows as CSV",
|
|
4379
|
-
false,
|
|
4380
|
-
() => this.downloadCSV("data.csv")
|
|
4381
|
-
));
|
|
4382
|
-
}
|
|
4394
|
+
if (c.showExportButton) el.appendChild(this._createExportBtn());
|
|
4383
4395
|
return el;
|
|
4384
4396
|
}
|
|
4385
4397
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -6168,4 +6180,4 @@ export {
|
|
|
6168
6180
|
resolvePaging,
|
|
6169
6181
|
DataTable
|
|
6170
6182
|
};
|
|
6171
|
-
//# sourceMappingURL=chunk-
|
|
6183
|
+
//# sourceMappingURL=chunk-FBGP5KN5.js.map
|