@kodaris/krubble-components 1.0.63 → 1.0.65
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 +30 -4
- package/dist/krubble-components.bundled.js +85 -5
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +59 -6
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +85 -5
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +61 -8
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/dist/table/table.d.ts +13 -2
- package/dist/table/table.d.ts.map +1 -1
- package/dist/table/table.js +85 -5
- package/dist/table/table.js.map +1 -1
- package/package.json +1 -1
|
@@ -4619,6 +4619,7 @@
|
|
|
4619
4619
|
class KRTableModel {
|
|
4620
4620
|
constructor() {
|
|
4621
4621
|
this.title = '';
|
|
4622
|
+
this.description = '';
|
|
4622
4623
|
this.actions = [];
|
|
4623
4624
|
this.columns = [];
|
|
4624
4625
|
this.displayedColumns = [];
|
|
@@ -4661,6 +4662,13 @@
|
|
|
4661
4662
|
this._columnWidthsLocked = false;
|
|
4662
4663
|
this._model = new KRTableModel();
|
|
4663
4664
|
this.def = { columns: [] };
|
|
4665
|
+
/**
|
|
4666
|
+
* Table layout variant.
|
|
4667
|
+
* - 'default': Full-page table that fills parent height with centered search.
|
|
4668
|
+
* - 'card': Embedded table that sizes itself to content, left-aligns search, and
|
|
4669
|
+
* reserves space for pageSize rows to prevent layout shift.
|
|
4670
|
+
*/
|
|
4671
|
+
this.variant = 'default';
|
|
4664
4672
|
this._handleClickOutside = (e) => {
|
|
4665
4673
|
const path = e.composedPath();
|
|
4666
4674
|
if (this._columnPickerOpen) {
|
|
@@ -4719,6 +4727,9 @@
|
|
|
4719
4727
|
if (this.def.title) {
|
|
4720
4728
|
this._model.title = this.def.title;
|
|
4721
4729
|
}
|
|
4730
|
+
if (this.def.description) {
|
|
4731
|
+
this._model.description = this.def.description;
|
|
4732
|
+
}
|
|
4722
4733
|
if (this.def.actions) {
|
|
4723
4734
|
this._model.actions = this.def.actions;
|
|
4724
4735
|
}
|
|
@@ -4733,6 +4744,7 @@
|
|
|
4733
4744
|
}
|
|
4734
4745
|
if (typeof this.def.pageSize === 'number') {
|
|
4735
4746
|
this._model.pageSize = this.def.pageSize;
|
|
4747
|
+
this._pageSize = this.def.pageSize;
|
|
4736
4748
|
}
|
|
4737
4749
|
if (this.def.rowClickable) {
|
|
4738
4750
|
this._model.rowClickable = this.def.rowClickable;
|
|
@@ -4790,6 +4802,7 @@
|
|
|
4790
4802
|
}
|
|
4791
4803
|
}
|
|
4792
4804
|
updated(changedProperties) {
|
|
4805
|
+
this.classList.toggle('kr-table--card', this.variant === 'card');
|
|
4793
4806
|
this._updateScrollFlags();
|
|
4794
4807
|
this._syncSlottedContent();
|
|
4795
4808
|
}
|
|
@@ -5087,6 +5100,9 @@
|
|
|
5087
5100
|
// Skip if already locked (prevents shifts on pagination changes)
|
|
5088
5101
|
if (this._searchPositionLocked)
|
|
5089
5102
|
return;
|
|
5103
|
+
// In card mode, search is left-aligned via CSS — no position locking needed
|
|
5104
|
+
if (this.variant === 'card')
|
|
5105
|
+
return;
|
|
5090
5106
|
const search = this.shadowRoot?.querySelector('.search');
|
|
5091
5107
|
const searchField = search?.querySelector('.search-field');
|
|
5092
5108
|
if (!search || !searchField)
|
|
@@ -5559,12 +5575,25 @@
|
|
|
5559
5575
|
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
5560
5576
|
</span>
|
|
5561
5577
|
</div>
|
|
5578
|
+
`;
|
|
5579
|
+
}
|
|
5580
|
+
/** Renders the card title block (title + description) above the toolbar in card mode. */
|
|
5581
|
+
_renderCardHeader() {
|
|
5582
|
+
if (this.variant !== 'card')
|
|
5583
|
+
return A;
|
|
5584
|
+
if (!this._model.title && !this._model.description)
|
|
5585
|
+
return A;
|
|
5586
|
+
return b `
|
|
5587
|
+
<div class="card-header">
|
|
5588
|
+
${this._model.title ? b `<h2 class="card-header__title">${this._model.title}</h2>` : A}
|
|
5589
|
+
${this._model.description ? b `<p class="card-header__description">${this._model.description}</p>` : A}
|
|
5590
|
+
</div>
|
|
5562
5591
|
`;
|
|
5563
5592
|
}
|
|
5564
5593
|
/**
|
|
5565
5594
|
* Renders the header toolbar containing:
|
|
5566
|
-
* - Title (left)
|
|
5567
|
-
* - Search bar with view selector dropdown (center)
|
|
5595
|
+
* - Title (left, default variant only)
|
|
5596
|
+
* - Search bar with view selector dropdown (center, or left-aligned in card variant)
|
|
5568
5597
|
* - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown
|
|
5569
5598
|
*
|
|
5570
5599
|
* Hidden when there's no title, no actions, and data fits on one page.
|
|
@@ -5575,7 +5604,7 @@
|
|
|
5575
5604
|
}
|
|
5576
5605
|
return b `
|
|
5577
5606
|
<div class="header">
|
|
5578
|
-
|
|
5607
|
+
${this._model.title && this.variant !== 'card' ? b `<div class="title">${this._model.title}</div>` : A}
|
|
5579
5608
|
${this._model.dataSource?.mode === 'db' && !this._model.columns.some(col => col.searchable) ? b `<div class="search"></div>` : b `
|
|
5580
5609
|
<div class="search">
|
|
5581
5610
|
<!-- TODO: Saved views dropdown
|
|
@@ -6022,6 +6051,7 @@
|
|
|
6022
6051
|
return b `<slot></slot>`;
|
|
6023
6052
|
}
|
|
6024
6053
|
return b `
|
|
6054
|
+
${this._renderCardHeader()}
|
|
6025
6055
|
${this._renderHeader()}
|
|
6026
6056
|
${this._renderTable()}
|
|
6027
6057
|
${this._renderFilterPanel()}
|
|
@@ -6060,7 +6090,7 @@
|
|
|
6060
6090
|
}
|
|
6061
6091
|
|
|
6062
6092
|
.title {
|
|
6063
|
-
font-size:
|
|
6093
|
+
font-size: 18px;
|
|
6064
6094
|
font-weight: 600;
|
|
6065
6095
|
color: #000;
|
|
6066
6096
|
}
|
|
@@ -6077,7 +6107,6 @@
|
|
|
6077
6107
|
.content {
|
|
6078
6108
|
height: 100%;
|
|
6079
6109
|
overflow: auto;
|
|
6080
|
-
padding-bottom: 24px;
|
|
6081
6110
|
}
|
|
6082
6111
|
|
|
6083
6112
|
/* -------------------------------------------------------------------------
|
|
@@ -6091,6 +6120,11 @@
|
|
|
6091
6120
|
min-width: 0;
|
|
6092
6121
|
}
|
|
6093
6122
|
|
|
6123
|
+
/* In card mode, align search left instead of center */
|
|
6124
|
+
:host(.kr-table--card) .search {
|
|
6125
|
+
justify-content: flex-start;
|
|
6126
|
+
}
|
|
6127
|
+
|
|
6094
6128
|
.search-field {
|
|
6095
6129
|
width: 100%;
|
|
6096
6130
|
max-width: 400px;
|
|
@@ -6885,6 +6919,49 @@
|
|
|
6885
6919
|
padding: 16px;
|
|
6886
6920
|
}
|
|
6887
6921
|
|
|
6922
|
+
/* Card variant — self-contained card with border, auto height, left-aligned search */
|
|
6923
|
+
:host(.kr-table--card) {
|
|
6924
|
+
height: auto;
|
|
6925
|
+
/* overflow: visible; */
|
|
6926
|
+
overflow: hidden;
|
|
6927
|
+
/* border: 1px solid #e5e7eb; */
|
|
6928
|
+
/* border-radius: 8px; */
|
|
6929
|
+
border: 1px solid #c6c6cd;
|
|
6930
|
+
border-radius: 12px;
|
|
6931
|
+
background: #fff;
|
|
6932
|
+
}
|
|
6933
|
+
|
|
6934
|
+
.card-header {
|
|
6935
|
+
padding: 24px 24px 16px;
|
|
6936
|
+
}
|
|
6937
|
+
|
|
6938
|
+
.card-header__title {
|
|
6939
|
+
font-size: 18px;
|
|
6940
|
+
font-weight: 600;
|
|
6941
|
+
color: #1f2937;
|
|
6942
|
+
margin: 0;
|
|
6943
|
+
}
|
|
6944
|
+
|
|
6945
|
+
.card-header__description {
|
|
6946
|
+
font-size: 14px;
|
|
6947
|
+
color: #1f2937;
|
|
6948
|
+
margin: 12px 0 0;
|
|
6949
|
+
}
|
|
6950
|
+
|
|
6951
|
+
:host(.kr-table--card) .header {
|
|
6952
|
+
margin: 0 24px;
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6955
|
+
:host(.kr-table--card) .wrapper {
|
|
6956
|
+
flex: none;
|
|
6957
|
+
overflow: visible;
|
|
6958
|
+
min-height: 200px;
|
|
6959
|
+
}
|
|
6960
|
+
|
|
6961
|
+
:host(.kr-table--card) .content {
|
|
6962
|
+
height: auto;
|
|
6963
|
+
}
|
|
6964
|
+
|
|
6888
6965
|
`];
|
|
6889
6966
|
__decorate$b([
|
|
6890
6967
|
r$1()
|
|
@@ -6934,6 +7011,9 @@
|
|
|
6934
7011
|
__decorate$b([
|
|
6935
7012
|
n$1({ type: Object })
|
|
6936
7013
|
], exports.KRTable.prototype, "def", void 0);
|
|
7014
|
+
__decorate$b([
|
|
7015
|
+
n$1({ type: String, reflect: true })
|
|
7016
|
+
], exports.KRTable.prototype, "variant", void 0);
|
|
6937
7017
|
exports.KRTable = __decorate$b([
|
|
6938
7018
|
t$1('kr-table')
|
|
6939
7019
|
], exports.KRTable);
|