@kodaris/krubble-components 1.0.13 → 1.0.14
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/custom-elements.json +412 -400
- package/dist/krubble.bundled.js +29 -8
- package/dist/krubble.bundled.js.map +1 -1
- package/dist/krubble.bundled.min.js +15 -15
- package/dist/krubble.bundled.min.js.map +1 -1
- package/dist/krubble.umd.js +29 -8
- package/dist/krubble.umd.js.map +1 -1
- package/dist/krubble.umd.min.js +9 -9
- package/dist/krubble.umd.min.js.map +1 -1
- package/dist/table/table.d.ts +2 -0
- package/dist/table/table.d.ts.map +1 -1
- package/dist/table/table.js +29 -9
- package/dist/table/table.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble.bundled.js
CHANGED
|
@@ -2299,6 +2299,28 @@ let KRTable = class KRTable extends i$2 {
|
|
|
2299
2299
|
}
|
|
2300
2300
|
updated(changedProperties) {
|
|
2301
2301
|
this._updateScrollFlags();
|
|
2302
|
+
this._syncSlottedContent();
|
|
2303
|
+
}
|
|
2304
|
+
/** Syncs light DOM content for cells with custom render functions */
|
|
2305
|
+
_syncSlottedContent() {
|
|
2306
|
+
const columns = this.getDisplayedColumns().filter(col => col.render);
|
|
2307
|
+
if (!columns.length)
|
|
2308
|
+
return;
|
|
2309
|
+
// Clear old slotted content
|
|
2310
|
+
this.querySelectorAll('[slot^="cell-"]').forEach(el => el.remove());
|
|
2311
|
+
// Create new slotted content
|
|
2312
|
+
this._data.forEach((row, rowIndex) => {
|
|
2313
|
+
columns.forEach(col => {
|
|
2314
|
+
const result = col.render(row);
|
|
2315
|
+
const content = typeof result === 'string' ? result : '';
|
|
2316
|
+
if (content) {
|
|
2317
|
+
const el = document.createElement('span');
|
|
2318
|
+
el.slot = `cell-${rowIndex}-${col.id}`;
|
|
2319
|
+
el.innerHTML = content;
|
|
2320
|
+
this.appendChild(el);
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
});
|
|
2302
2324
|
}
|
|
2303
2325
|
// ----------------------------------------------------------------------------
|
|
2304
2326
|
// Public Interface
|
|
@@ -2541,12 +2563,11 @@ let KRTable = class KRTable extends i$2 {
|
|
|
2541
2563
|
// ----------------------------------------------------------------------------
|
|
2542
2564
|
// Rendering
|
|
2543
2565
|
// ----------------------------------------------------------------------------
|
|
2544
|
-
_renderCellContent(column, row) {
|
|
2566
|
+
_renderCellContent(column, row, rowIndex) {
|
|
2545
2567
|
const value = row[column.id];
|
|
2546
2568
|
if (column.render) {
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
return typeof result === 'string' ? o$2(result) : result;
|
|
2569
|
+
// Use slot to project content from light DOM so external styles apply
|
|
2570
|
+
return b `<slot name="cell-${rowIndex}-${column.id}"></slot>`;
|
|
2550
2571
|
}
|
|
2551
2572
|
if (value === null || value === undefined) {
|
|
2552
2573
|
return '';
|
|
@@ -2774,7 +2795,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
2774
2795
|
></div>` : A}</div>
|
|
2775
2796
|
`)}
|
|
2776
2797
|
</div>
|
|
2777
|
-
${this._data.map(row => b `
|
|
2798
|
+
${this._data.map((row, rowIndex) => b `
|
|
2778
2799
|
<div class="row">
|
|
2779
2800
|
${this.getDisplayedColumns().map((col, i) => b `
|
|
2780
2801
|
<div
|
|
@@ -2782,7 +2803,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
2782
2803
|
style=${o$1(this._getCellStyle(col, i))}
|
|
2783
2804
|
data-column-id=${col.id}
|
|
2784
2805
|
>
|
|
2785
|
-
${this._renderCellContent(col, row)}
|
|
2806
|
+
${this._renderCellContent(col, row, rowIndex)}
|
|
2786
2807
|
</div>
|
|
2787
2808
|
`)}
|
|
2788
2809
|
</div>
|
|
@@ -2841,8 +2862,8 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
2841
2862
|
}
|
|
2842
2863
|
|
|
2843
2864
|
.title {
|
|
2844
|
-
font-size:
|
|
2845
|
-
font-weight:
|
|
2865
|
+
font-size: 18px;
|
|
2866
|
+
font-weight: 600;
|
|
2846
2867
|
color: #000;
|
|
2847
2868
|
}
|
|
2848
2869
|
|