@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
|
@@ -4613,6 +4613,7 @@ var __decorate$b = (undefined && undefined.__decorate) || function (decorators,
|
|
|
4613
4613
|
class KRTableModel {
|
|
4614
4614
|
constructor() {
|
|
4615
4615
|
this.title = '';
|
|
4616
|
+
this.description = '';
|
|
4616
4617
|
this.actions = [];
|
|
4617
4618
|
this.columns = [];
|
|
4618
4619
|
this.displayedColumns = [];
|
|
@@ -4655,6 +4656,13 @@ let KRTable = class KRTable extends i$2 {
|
|
|
4655
4656
|
this._columnWidthsLocked = false;
|
|
4656
4657
|
this._model = new KRTableModel();
|
|
4657
4658
|
this.def = { columns: [] };
|
|
4659
|
+
/**
|
|
4660
|
+
* Table layout variant.
|
|
4661
|
+
* - 'default': Full-page table that fills parent height with centered search.
|
|
4662
|
+
* - 'card': Embedded table that sizes itself to content, left-aligns search, and
|
|
4663
|
+
* reserves space for pageSize rows to prevent layout shift.
|
|
4664
|
+
*/
|
|
4665
|
+
this.variant = 'default';
|
|
4658
4666
|
this._handleClickOutside = (e) => {
|
|
4659
4667
|
const path = e.composedPath();
|
|
4660
4668
|
if (this._columnPickerOpen) {
|
|
@@ -4713,6 +4721,9 @@ let KRTable = class KRTable extends i$2 {
|
|
|
4713
4721
|
if (this.def.title) {
|
|
4714
4722
|
this._model.title = this.def.title;
|
|
4715
4723
|
}
|
|
4724
|
+
if (this.def.description) {
|
|
4725
|
+
this._model.description = this.def.description;
|
|
4726
|
+
}
|
|
4716
4727
|
if (this.def.actions) {
|
|
4717
4728
|
this._model.actions = this.def.actions;
|
|
4718
4729
|
}
|
|
@@ -4727,6 +4738,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
4727
4738
|
}
|
|
4728
4739
|
if (typeof this.def.pageSize === 'number') {
|
|
4729
4740
|
this._model.pageSize = this.def.pageSize;
|
|
4741
|
+
this._pageSize = this.def.pageSize;
|
|
4730
4742
|
}
|
|
4731
4743
|
if (this.def.rowClickable) {
|
|
4732
4744
|
this._model.rowClickable = this.def.rowClickable;
|
|
@@ -4784,6 +4796,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
4784
4796
|
}
|
|
4785
4797
|
}
|
|
4786
4798
|
updated(changedProperties) {
|
|
4799
|
+
this.classList.toggle('kr-table--card', this.variant === 'card');
|
|
4787
4800
|
this._updateScrollFlags();
|
|
4788
4801
|
this._syncSlottedContent();
|
|
4789
4802
|
}
|
|
@@ -5081,6 +5094,9 @@ let KRTable = class KRTable extends i$2 {
|
|
|
5081
5094
|
// Skip if already locked (prevents shifts on pagination changes)
|
|
5082
5095
|
if (this._searchPositionLocked)
|
|
5083
5096
|
return;
|
|
5097
|
+
// In card mode, search is left-aligned via CSS — no position locking needed
|
|
5098
|
+
if (this.variant === 'card')
|
|
5099
|
+
return;
|
|
5084
5100
|
const search = this.shadowRoot?.querySelector('.search');
|
|
5085
5101
|
const searchField = search?.querySelector('.search-field');
|
|
5086
5102
|
if (!search || !searchField)
|
|
@@ -5555,10 +5571,23 @@ let KRTable = class KRTable extends i$2 {
|
|
|
5555
5571
|
</div>
|
|
5556
5572
|
`;
|
|
5557
5573
|
}
|
|
5574
|
+
/** Renders the card title block (title + description) above the toolbar in card mode. */
|
|
5575
|
+
_renderCardHeader() {
|
|
5576
|
+
if (this.variant !== 'card')
|
|
5577
|
+
return A;
|
|
5578
|
+
if (!this._model.title && !this._model.description)
|
|
5579
|
+
return A;
|
|
5580
|
+
return b `
|
|
5581
|
+
<div class="card-header">
|
|
5582
|
+
${this._model.title ? b `<h2 class="card-header__title">${this._model.title}</h2>` : A}
|
|
5583
|
+
${this._model.description ? b `<p class="card-header__description">${this._model.description}</p>` : A}
|
|
5584
|
+
</div>
|
|
5585
|
+
`;
|
|
5586
|
+
}
|
|
5558
5587
|
/**
|
|
5559
5588
|
* Renders the header toolbar containing:
|
|
5560
|
-
* - Title (left)
|
|
5561
|
-
* - Search bar with view selector dropdown (center)
|
|
5589
|
+
* - Title (left, default variant only)
|
|
5590
|
+
* - Search bar with view selector dropdown (center, or left-aligned in card variant)
|
|
5562
5591
|
* - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown
|
|
5563
5592
|
*
|
|
5564
5593
|
* Hidden when there's no title, no actions, and data fits on one page.
|
|
@@ -5569,7 +5598,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
5569
5598
|
}
|
|
5570
5599
|
return b `
|
|
5571
5600
|
<div class="header">
|
|
5572
|
-
|
|
5601
|
+
${this._model.title && this.variant !== 'card' ? b `<div class="title">${this._model.title}</div>` : A}
|
|
5573
5602
|
${this._model.dataSource?.mode === 'db' && !this._model.columns.some(col => col.searchable) ? b `<div class="search"></div>` : b `
|
|
5574
5603
|
<div class="search">
|
|
5575
5604
|
<!-- TODO: Saved views dropdown
|
|
@@ -6016,6 +6045,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
6016
6045
|
return b `<slot></slot>`;
|
|
6017
6046
|
}
|
|
6018
6047
|
return b `
|
|
6048
|
+
${this._renderCardHeader()}
|
|
6019
6049
|
${this._renderHeader()}
|
|
6020
6050
|
${this._renderTable()}
|
|
6021
6051
|
${this._renderFilterPanel()}
|
|
@@ -6054,7 +6084,7 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6054
6084
|
}
|
|
6055
6085
|
|
|
6056
6086
|
.title {
|
|
6057
|
-
font-size:
|
|
6087
|
+
font-size: 18px;
|
|
6058
6088
|
font-weight: 600;
|
|
6059
6089
|
color: #000;
|
|
6060
6090
|
}
|
|
@@ -6071,7 +6101,6 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6071
6101
|
.content {
|
|
6072
6102
|
height: 100%;
|
|
6073
6103
|
overflow: auto;
|
|
6074
|
-
padding-bottom: 24px;
|
|
6075
6104
|
}
|
|
6076
6105
|
|
|
6077
6106
|
/* -------------------------------------------------------------------------
|
|
@@ -6085,6 +6114,11 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6085
6114
|
min-width: 0;
|
|
6086
6115
|
}
|
|
6087
6116
|
|
|
6117
|
+
/* In card mode, align search left instead of center */
|
|
6118
|
+
:host(.kr-table--card) .search {
|
|
6119
|
+
justify-content: flex-start;
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6088
6122
|
.search-field {
|
|
6089
6123
|
width: 100%;
|
|
6090
6124
|
max-width: 400px;
|
|
@@ -6879,6 +6913,49 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6879
6913
|
padding: 16px;
|
|
6880
6914
|
}
|
|
6881
6915
|
|
|
6916
|
+
/* Card variant — self-contained card with border, auto height, left-aligned search */
|
|
6917
|
+
:host(.kr-table--card) {
|
|
6918
|
+
height: auto;
|
|
6919
|
+
/* overflow: visible; */
|
|
6920
|
+
overflow: hidden;
|
|
6921
|
+
/* border: 1px solid #e5e7eb; */
|
|
6922
|
+
/* border-radius: 8px; */
|
|
6923
|
+
border: 1px solid #c6c6cd;
|
|
6924
|
+
border-radius: 12px;
|
|
6925
|
+
background: #fff;
|
|
6926
|
+
}
|
|
6927
|
+
|
|
6928
|
+
.card-header {
|
|
6929
|
+
padding: 24px 24px 16px;
|
|
6930
|
+
}
|
|
6931
|
+
|
|
6932
|
+
.card-header__title {
|
|
6933
|
+
font-size: 18px;
|
|
6934
|
+
font-weight: 600;
|
|
6935
|
+
color: #1f2937;
|
|
6936
|
+
margin: 0;
|
|
6937
|
+
}
|
|
6938
|
+
|
|
6939
|
+
.card-header__description {
|
|
6940
|
+
font-size: 14px;
|
|
6941
|
+
color: #1f2937;
|
|
6942
|
+
margin: 12px 0 0;
|
|
6943
|
+
}
|
|
6944
|
+
|
|
6945
|
+
:host(.kr-table--card) .header {
|
|
6946
|
+
margin: 0 24px;
|
|
6947
|
+
}
|
|
6948
|
+
|
|
6949
|
+
:host(.kr-table--card) .wrapper {
|
|
6950
|
+
flex: none;
|
|
6951
|
+
overflow: visible;
|
|
6952
|
+
min-height: 200px;
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6955
|
+
:host(.kr-table--card) .content {
|
|
6956
|
+
height: auto;
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6882
6959
|
`];
|
|
6883
6960
|
__decorate$b([
|
|
6884
6961
|
r$1()
|
|
@@ -6928,6 +7005,9 @@ __decorate$b([
|
|
|
6928
7005
|
__decorate$b([
|
|
6929
7006
|
n$1({ type: Object })
|
|
6930
7007
|
], KRTable.prototype, "def", void 0);
|
|
7008
|
+
__decorate$b([
|
|
7009
|
+
n$1({ type: String, reflect: true })
|
|
7010
|
+
], KRTable.prototype, "variant", void 0);
|
|
6931
7011
|
KRTable = __decorate$b([
|
|
6932
7012
|
t$1('kr-table')
|
|
6933
7013
|
], KRTable);
|