@timlassiter11/yatl 1.2.3 → 1.2.4
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/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +45 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -11
- package/dist/index.mjs.map +1 -1
- package/dist/theme.css +22 -12
- package/dist/yatl.min.global.js +30 -25
- package/dist/yatl.min.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -756,6 +756,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
756
756
|
static styles: lit.CSSResult[];
|
|
757
757
|
private tableElement;
|
|
758
758
|
private virtualizer?;
|
|
759
|
+
private get virtualizerRef();
|
|
759
760
|
private resizeState;
|
|
760
761
|
private dragColumn;
|
|
761
762
|
private useYatlUi;
|
|
@@ -1044,6 +1045,14 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1044
1045
|
*/
|
|
1045
1046
|
findRowIndex(field: NestedKeyOf<T>, value: unknown): number;
|
|
1046
1047
|
updateRow(rowId: RowId, data: Partial<T>): void;
|
|
1048
|
+
/**
|
|
1049
|
+
* This will force the underlying virtual scroller
|
|
1050
|
+
* to re-calculate row sizes and positions and re-render.
|
|
1051
|
+
* This is specifically here to fix virtual scroll tables
|
|
1052
|
+
* that are affected by scale animations.
|
|
1053
|
+
* E.g. when put in a yatl-dialog.
|
|
1054
|
+
*/
|
|
1055
|
+
reflowVirtualizer(): void;
|
|
1047
1056
|
/**
|
|
1048
1057
|
* Updates the data of a row at a specific original index.
|
|
1049
1058
|
* @param index - The original index of the row to update.
|
package/dist/index.d.ts
CHANGED
|
@@ -756,6 +756,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
756
756
|
static styles: lit.CSSResult[];
|
|
757
757
|
private tableElement;
|
|
758
758
|
private virtualizer?;
|
|
759
|
+
private get virtualizerRef();
|
|
759
760
|
private resizeState;
|
|
760
761
|
private dragColumn;
|
|
761
762
|
private useYatlUi;
|
|
@@ -1044,6 +1045,14 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1044
1045
|
*/
|
|
1045
1046
|
findRowIndex(field: NestedKeyOf<T>, value: unknown): number;
|
|
1046
1047
|
updateRow(rowId: RowId, data: Partial<T>): void;
|
|
1048
|
+
/**
|
|
1049
|
+
* This will force the underlying virtual scroller
|
|
1050
|
+
* to re-calculate row sizes and positions and re-render.
|
|
1051
|
+
* This is specifically here to fix virtual scroll tables
|
|
1052
|
+
* that are affected by scale animations.
|
|
1053
|
+
* E.g. when put in a yatl-dialog.
|
|
1054
|
+
*/
|
|
1055
|
+
reflowVirtualizer(): void;
|
|
1047
1056
|
/**
|
|
1048
1057
|
* Updates the data of a row at a specific original index.
|
|
1049
1058
|
* @param index - The original index of the row to update.
|
package/dist/index.js
CHANGED
|
@@ -407,6 +407,7 @@ var import_if_defined = require("lit/directives/if-defined.js");
|
|
|
407
407
|
var import_repeat = require("lit/directives/repeat.js");
|
|
408
408
|
var import_style_map = require("lit/directives/style-map.js");
|
|
409
409
|
var import_virtualizer = require("@lit-labs/virtualizer");
|
|
410
|
+
var import_virtualize = require("@lit-labs/virtualizer/virtualize.js");
|
|
410
411
|
|
|
411
412
|
// src/table-controller/utils.ts
|
|
412
413
|
function getCompareableValue(value) {
|
|
@@ -580,6 +581,7 @@ var YatlTableController = class extends TypedEventTarget {
|
|
|
580
581
|
for (const column of columns) {
|
|
581
582
|
this._columnDefinitionMap.set(column.field, column);
|
|
582
583
|
}
|
|
584
|
+
this.createMetadata();
|
|
583
585
|
this.requestUpdate("columns");
|
|
584
586
|
}
|
|
585
587
|
get displayColumns() {
|
|
@@ -1601,10 +1603,7 @@ var table_styles_default = import_lit2.css`
|
|
|
1601
1603
|
);
|
|
1602
1604
|
|
|
1603
1605
|
--table-header-text: var(--yatl-table-header-text, var(--yatl-text-1));
|
|
1604
|
-
--table-header-bg: var(
|
|
1605
|
-
--yatl-table-header-bg,
|
|
1606
|
-
color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-bg))
|
|
1607
|
-
);
|
|
1606
|
+
--table-header-bg: var(--yatl-table-header-bg, var(--yatl-surface-lowered));
|
|
1608
1607
|
--table-header-hover-bg: var(
|
|
1609
1608
|
--yatl-table-header-hover-bg,
|
|
1610
1609
|
color-mix(in srgb, var(--yatl-color-mix) 4%, var(--table-header-bg))
|
|
@@ -1623,6 +1622,10 @@ var table_styles_default = import_lit2.css`
|
|
|
1623
1622
|
--yatl-table-row-hover-bg,
|
|
1624
1623
|
var(--table-header-bg)
|
|
1625
1624
|
);
|
|
1625
|
+
--table-row-border-color: var(
|
|
1626
|
+
--yatl-table-row-border-color,
|
|
1627
|
+
var(--yatl-border-color-subtle)
|
|
1628
|
+
);
|
|
1626
1629
|
--table-row-stripe-bg: var(
|
|
1627
1630
|
--yatl-table-row-stripe-bg,
|
|
1628
1631
|
color-mix(in srbg, var(--yatl-color-mix) 3%, var(--table-bg))
|
|
@@ -1669,14 +1672,10 @@ var table_styles_default = import_lit2.css`
|
|
|
1669
1672
|
position: relative;
|
|
1670
1673
|
background-color: var(--table-row-bg);
|
|
1671
1674
|
/** Use box-shadow to mimic borders. It works better when virtualized */
|
|
1672
|
-
box-shadow: inset 0 -1px 0 0 var(--table-border-color);
|
|
1675
|
+
box-shadow: inset 0 -1px 0 0 var(--table-row-border-color);
|
|
1673
1676
|
transition: background-color 50ms;
|
|
1674
1677
|
}
|
|
1675
1678
|
|
|
1676
|
-
.row-number-cell {
|
|
1677
|
-
box-shadow: inset 0 -1px 0 0 var(--table-border-color);
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
1679
|
.row.header-row {
|
|
1681
1680
|
background-color: var(--table-header-bg);
|
|
1682
1681
|
border-bottom: 1px solid var(--table-border-color);
|
|
@@ -1702,10 +1701,18 @@ var table_styles_default = import_lit2.css`
|
|
|
1702
1701
|
padding: var(--table-cell-padding);
|
|
1703
1702
|
}
|
|
1704
1703
|
|
|
1704
|
+
.cell.is-number {
|
|
1705
|
+
justify-content: flex-end;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1705
1708
|
.table.resizing * {
|
|
1706
1709
|
cursor: col-resize !important;
|
|
1707
1710
|
}
|
|
1708
1711
|
|
|
1712
|
+
.header {
|
|
1713
|
+
background-color: var(--table-bg);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1709
1716
|
.header .cell {
|
|
1710
1717
|
padding: var(--table-header-padding);
|
|
1711
1718
|
}
|
|
@@ -1973,7 +1980,7 @@ var YatlTable = class extends import_lit3.LitElement {
|
|
|
1973
1980
|
// #endregion
|
|
1974
1981
|
// #region --- Properties ---
|
|
1975
1982
|
this._controller = new YatlTableController(this);
|
|
1976
|
-
this.striped =
|
|
1983
|
+
this.striped = false;
|
|
1977
1984
|
this.sortable = true;
|
|
1978
1985
|
this.resizable = true;
|
|
1979
1986
|
this.enableVirtualScroll = false;
|
|
@@ -2137,6 +2144,11 @@ var YatlTable = class extends import_lit3.LitElement {
|
|
|
2137
2144
|
this.toggleRowSelection(row, selected);
|
|
2138
2145
|
};
|
|
2139
2146
|
}
|
|
2147
|
+
get virtualizerRef() {
|
|
2148
|
+
if (this.virtualizer) {
|
|
2149
|
+
return this.virtualizer[import_virtualize.virtualizerRef];
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2140
2152
|
get controller() {
|
|
2141
2153
|
return this._controller;
|
|
2142
2154
|
}
|
|
@@ -2524,6 +2536,23 @@ var YatlTable = class extends import_lit3.LitElement {
|
|
|
2524
2536
|
updateRow(rowId, data) {
|
|
2525
2537
|
return this.controller.updateRow(rowId, data);
|
|
2526
2538
|
}
|
|
2539
|
+
/**
|
|
2540
|
+
* This will force the underlying virtual scroller
|
|
2541
|
+
* to re-calculate row sizes and positions and re-render.
|
|
2542
|
+
* This is specifically here to fix virtual scroll tables
|
|
2543
|
+
* that are affected by scale animations.
|
|
2544
|
+
* E.g. when put in a yatl-dialog.
|
|
2545
|
+
*/
|
|
2546
|
+
reflowVirtualizer() {
|
|
2547
|
+
const virtualizerRef2 = this.virtualizerRef;
|
|
2548
|
+
if (virtualizerRef2) {
|
|
2549
|
+
virtualizerRef2._itemsChanged = true;
|
|
2550
|
+
virtualizerRef2._rangeChanged = true;
|
|
2551
|
+
virtualizerRef2._measureChildren();
|
|
2552
|
+
virtualizerRef2._itemsChanged = false;
|
|
2553
|
+
virtualizerRef2._rangeChanged = false;
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2527
2556
|
/**
|
|
2528
2557
|
* Updates the data of a row at a specific original index.
|
|
2529
2558
|
* @param index - The original index of the row to update.
|
|
@@ -2660,6 +2689,11 @@ var YatlTable = class extends import_lit3.LitElement {
|
|
|
2660
2689
|
if (Array.isArray(userParts)) {
|
|
2661
2690
|
userParts = userParts.join(" ");
|
|
2662
2691
|
}
|
|
2692
|
+
const isNumber = typeof value === "bigint" || typeof value === "number";
|
|
2693
|
+
const classes = {
|
|
2694
|
+
cell: true,
|
|
2695
|
+
"is-number": isNumber
|
|
2696
|
+
};
|
|
2663
2697
|
if (typeof column.valueFormatter === "function") {
|
|
2664
2698
|
value = column.valueFormatter(value, row);
|
|
2665
2699
|
}
|
|
@@ -2668,7 +2702,7 @@ var YatlTable = class extends import_lit3.LitElement {
|
|
|
2668
2702
|
role="cell"
|
|
2669
2703
|
part="cell body-cell cell-${column.field} ${userParts}"
|
|
2670
2704
|
data-field=${column.field}
|
|
2671
|
-
class
|
|
2705
|
+
class=${(0, import_class_map.classMap)(classes)}
|
|
2672
2706
|
title=${(0, import_if_defined.ifDefined)(value ? String(value) : void 0)}
|
|
2673
2707
|
@click=${(event) => this.handleCellClick(event, row, column.field)}
|
|
2674
2708
|
>
|