@kodaris/krubble-components 1.0.63 → 1.0.64
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 +90 -6
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +60 -8
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +90 -6
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +62 -10
- 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 +90 -6
- 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
|
|
@@ -5947,8 +5976,13 @@ let KRTable = class KRTable extends i$2 {
|
|
|
5947
5976
|
}
|
|
5948
5977
|
/** Renders the scrollable data grid with column headers and rows. */
|
|
5949
5978
|
_renderTable() {
|
|
5979
|
+
const wrapperStyle = {};
|
|
5980
|
+
if (this.variant === 'card') {
|
|
5981
|
+
// Reserve space for header row + pageSize data rows to prevent layout shift
|
|
5982
|
+
wrapperStyle['min-height'] = `${48 + (this._pageSize * 48)}px`;
|
|
5983
|
+
}
|
|
5950
5984
|
return b `
|
|
5951
|
-
<div class="wrapper">
|
|
5985
|
+
<div class="wrapper" style=${o$1(wrapperStyle)}>
|
|
5952
5986
|
<div class="overlay-left"></div>
|
|
5953
5987
|
<div class="overlay-right"></div>
|
|
5954
5988
|
${this._renderStatus()}
|
|
@@ -6016,6 +6050,7 @@ let KRTable = class KRTable extends i$2 {
|
|
|
6016
6050
|
return b `<slot></slot>`;
|
|
6017
6051
|
}
|
|
6018
6052
|
return b `
|
|
6053
|
+
${this._renderCardHeader()}
|
|
6019
6054
|
${this._renderHeader()}
|
|
6020
6055
|
${this._renderTable()}
|
|
6021
6056
|
${this._renderFilterPanel()}
|
|
@@ -6054,7 +6089,7 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6054
6089
|
}
|
|
6055
6090
|
|
|
6056
6091
|
.title {
|
|
6057
|
-
font-size:
|
|
6092
|
+
font-size: 18px;
|
|
6058
6093
|
font-weight: 600;
|
|
6059
6094
|
color: #000;
|
|
6060
6095
|
}
|
|
@@ -6071,7 +6106,6 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6071
6106
|
.content {
|
|
6072
6107
|
height: 100%;
|
|
6073
6108
|
overflow: auto;
|
|
6074
|
-
padding-bottom: 24px;
|
|
6075
6109
|
}
|
|
6076
6110
|
|
|
6077
6111
|
/* -------------------------------------------------------------------------
|
|
@@ -6085,6 +6119,11 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6085
6119
|
min-width: 0;
|
|
6086
6120
|
}
|
|
6087
6121
|
|
|
6122
|
+
/* In card mode, align search left instead of center */
|
|
6123
|
+
:host(.kr-table--card) .search {
|
|
6124
|
+
justify-content: flex-start;
|
|
6125
|
+
}
|
|
6126
|
+
|
|
6088
6127
|
.search-field {
|
|
6089
6128
|
width: 100%;
|
|
6090
6129
|
max-width: 400px;
|
|
@@ -6879,6 +6918,48 @@ KRTable.styles = [krBaseCSS, i$5 `
|
|
|
6879
6918
|
padding: 16px;
|
|
6880
6919
|
}
|
|
6881
6920
|
|
|
6921
|
+
/* Card variant — self-contained card with border, auto height, left-aligned search */
|
|
6922
|
+
:host(.kr-table--card) {
|
|
6923
|
+
height: auto;
|
|
6924
|
+
/* overflow: visible; */
|
|
6925
|
+
overflow: hidden;
|
|
6926
|
+
/* border: 1px solid #e5e7eb; */
|
|
6927
|
+
/* border-radius: 8px; */
|
|
6928
|
+
border: 1px solid #c6c6cd;
|
|
6929
|
+
border-radius: 12px;
|
|
6930
|
+
background: #fff;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
.card-header {
|
|
6934
|
+
padding: 24px 24px 16px;
|
|
6935
|
+
}
|
|
6936
|
+
|
|
6937
|
+
.card-header__title {
|
|
6938
|
+
font-size: 18px;
|
|
6939
|
+
font-weight: 600;
|
|
6940
|
+
color: #1f2937;
|
|
6941
|
+
margin: 0;
|
|
6942
|
+
}
|
|
6943
|
+
|
|
6944
|
+
.card-header__description {
|
|
6945
|
+
font-size: 14px;
|
|
6946
|
+
color: #1f2937;
|
|
6947
|
+
margin: 12px 0 0;
|
|
6948
|
+
}
|
|
6949
|
+
|
|
6950
|
+
:host(.kr-table--card) .header {
|
|
6951
|
+
margin: 0 24px;
|
|
6952
|
+
}
|
|
6953
|
+
|
|
6954
|
+
:host(.kr-table--card) .wrapper {
|
|
6955
|
+
flex: none;
|
|
6956
|
+
overflow: visible;
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6959
|
+
:host(.kr-table--card) .content {
|
|
6960
|
+
height: auto;
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6882
6963
|
`];
|
|
6883
6964
|
__decorate$b([
|
|
6884
6965
|
r$1()
|
|
@@ -6928,6 +7009,9 @@ __decorate$b([
|
|
|
6928
7009
|
__decorate$b([
|
|
6929
7010
|
n$1({ type: Object })
|
|
6930
7011
|
], KRTable.prototype, "def", void 0);
|
|
7012
|
+
__decorate$b([
|
|
7013
|
+
n$1({ type: String, reflect: true })
|
|
7014
|
+
], KRTable.prototype, "variant", void 0);
|
|
6931
7015
|
KRTable = __decorate$b([
|
|
6932
7016
|
t$1('kr-table')
|
|
6933
7017
|
], KRTable);
|