@xeplr/ui-table 1.1.1 → 1.1.2
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 +2 -2
- package/package.json +1 -1
- package/src/XeplrTable.jsx +2 -1
- package/src/pageSizes.js +9 -0
- package/src/xeplr-table.css +19 -5
package/README.md
CHANGED
|
@@ -48,9 +48,9 @@ The package ships its `src/` as ES modules with JSX and imports its own styleshe
|
|
|
48
48
|
| `data` | — | row array. Rows need an `id` for editing, selection and the changeset |
|
|
49
49
|
| `schema` | — | `{ 0: { key, columns }, 1: { key, columns, header? }, … }` — see below |
|
|
50
50
|
| `onCommit` | — | `async (changeSet) => …`. **Omit it and the table is read-only** |
|
|
51
|
-
| `rowActions` | — | custom per-row buttons, replacing the built-in set |
|
|
51
|
+
| `rowActions` | — | custom per-row buttons, replacing the built-in set. Labelled ones share one outlined look; `variant: 'danger'` turns one red |
|
|
52
52
|
| `childDisplay` | `'popup'` | `'popup'` or `'inner'` — how level-1 children show |
|
|
53
|
-
| `pageSize` | `20` | initial page size (the page-size menu offers 100, 200, 500, 1000) |
|
|
53
|
+
| `pageSize` | `20` | initial page size (the page-size menu offers 100, 200, 500, 1000, plus this size when it is not one of them) |
|
|
54
54
|
| `enableSorting`, `enableFiltering`, `enablePagination` | `true` | |
|
|
55
55
|
| `showToolbar` | `true` | `false` leaves the toolbar row out (a small table that offers no filtering or sorting). Editing tables keep it for Add/Delete/Commit. |
|
|
56
56
|
| `minDetectionRows` | `10` | non-empty samples a column needs before its detected type is final |
|
package/package.json
CHANGED
package/src/XeplrTable.jsx
CHANGED
|
@@ -15,6 +15,7 @@ import ChildTable from './actions/ChildTable.jsx';
|
|
|
15
15
|
import RecordModal from './actions/RecordModal.jsx';
|
|
16
16
|
import RecordDetail from './actions/RecordDetail.jsx';
|
|
17
17
|
import { resolveCellStyle } from './resolveCellStyle.js';
|
|
18
|
+
import { pageSizeOptions } from './pageSizes.js';
|
|
18
19
|
import './xeplr-table.css';
|
|
19
20
|
|
|
20
21
|
var filterComponentMap = {
|
|
@@ -707,7 +708,7 @@ export default function XeplrTable(props) {
|
|
|
707
708
|
<button type="button" onClick={function() { table.setPageIndex(table.getPageCount() - 1); }} disabled={!table.getCanNextPage()}>»»</button>
|
|
708
709
|
<select className="xeplr-table-page-size" value={table.getState().pagination.pageSize}
|
|
709
710
|
onChange={function(e) { table.setPageSize(Number(e.target.value)); }}>
|
|
710
|
-
{
|
|
711
|
+
{pageSizeOptions(table.getState().pagination.pageSize).map(function(size) { return <option key={size} value={size}>{size} rows</option>; })}
|
|
711
712
|
</select>
|
|
712
713
|
<span className="xeplr-table-row-count">({table.getFilteredRowModel().rows.length} total)</span>
|
|
713
714
|
</div>
|
package/src/pageSizes.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The rows-per-page choices ALWAYS include the size in use. The list was a
|
|
2
|
+
// fixed 100/200/500/1000, so a table given pageSize 10 showed 10 rows while
|
|
3
|
+
// its dropdown claimed "100 rows" — the one control on the bar that was lying.
|
|
4
|
+
var PAGE_SIZES = [100, 200, 500, 1000];
|
|
5
|
+
|
|
6
|
+
export function pageSizeOptions(current) {
|
|
7
|
+
if (!current || PAGE_SIZES.indexOf(current) !== -1) return PAGE_SIZES;
|
|
8
|
+
return [current].concat(PAGE_SIZES).sort(function(a, b) { return a - b; });
|
|
9
|
+
}
|
package/src/xeplr-table.css
CHANGED
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
|
|
688
688
|
.xeplr-table-actions-cell {
|
|
689
689
|
display: flex;
|
|
690
|
-
gap:
|
|
690
|
+
gap: 6px;
|
|
691
691
|
align-items: center;
|
|
692
692
|
}
|
|
693
693
|
|
|
@@ -720,22 +720,36 @@
|
|
|
720
720
|
cursor: not-allowed;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
-
/* ── Custom row actions (props.rowActions) — text-label buttons, e.g. Rollback/Delete ──
|
|
723
|
+
/* ── Custom row actions (props.rowActions) — text-label buttons, e.g. Rollback/Delete ──
|
|
724
|
+
ONE LOOK FOR ALL OF THEM: the same outlined button, differing only in
|
|
725
|
+
colour. (A plain label was grey borderless text beside a red outlined
|
|
726
|
+
Delete, so Edit read as disabled.) A danger action is red; every other one
|
|
727
|
+
takes the accent on hover. All of them visibly give under a press. */
|
|
724
728
|
.xeplr-table-action-label {
|
|
725
729
|
width: auto;
|
|
726
730
|
height: auto;
|
|
727
|
-
padding: 4px
|
|
731
|
+
padding: 4px 12px;
|
|
728
732
|
font-size: 12px;
|
|
729
733
|
font-weight: 600;
|
|
730
734
|
white-space: nowrap;
|
|
735
|
+
border-color: var(--xeplr-input-border, #3a3a5a);
|
|
736
|
+
color: var(--xeplr-text-primary, #e0e0e0);
|
|
737
|
+
transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.08s;
|
|
731
738
|
}
|
|
739
|
+
.xeplr-table-action-label:hover:not(:disabled) {
|
|
740
|
+
border-color: var(--xeplr-accent, #7c7cff);
|
|
741
|
+
color: var(--xeplr-accent, #7c7cff);
|
|
742
|
+
background: var(--xeplr-bg-hover, #2a2a4a);
|
|
743
|
+
}
|
|
744
|
+
.xeplr-table-action-btn:active:not(:disabled) { transform: scale(0.95); }
|
|
732
745
|
|
|
733
746
|
.xeplr-table-action-danger {
|
|
734
|
-
border-color: var(--xeplr-danger, #ff6b6b);
|
|
747
|
+
border-color: color-mix(in srgb, var(--xeplr-danger, #ff6b6b) 55%, transparent);
|
|
735
748
|
color: var(--xeplr-danger, #ff6b6b);
|
|
736
749
|
}
|
|
737
750
|
|
|
738
|
-
.xeplr-table-action-danger:hover:not(:disabled) {
|
|
751
|
+
.xeplr-table-action-label.xeplr-table-action-danger:hover:not(:disabled) {
|
|
752
|
+
border-color: var(--xeplr-danger, #ff6b6b);
|
|
739
753
|
background: var(--xeplr-danger-bg, #3a1a1a);
|
|
740
754
|
color: var(--xeplr-danger, #ff8a8a);
|
|
741
755
|
}
|