@kodaris/krubble-components 1.0.74 → 1.0.75
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 +1109 -47
- package/dist/grid/grid.d.ts +187 -0
- package/dist/grid/grid.d.ts.map +1 -0
- package/dist/grid/grid.js +2419 -0
- package/dist/grid/grid.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/krubble-components.bundled.js +2521 -116
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +1361 -131
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +2520 -115
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +1319 -89
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/package.json +5 -1
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
96
96
|
*/function e$3(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$4(n,s,{get(){return o(this)}})}}
|
|
97
97
|
|
|
98
|
-
var __decorate$
|
|
98
|
+
var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
99
99
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
100
100
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
101
101
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -202,13 +202,13 @@
|
|
|
202
202
|
padding: 16px 16px 8px 16px;
|
|
203
203
|
}
|
|
204
204
|
`;
|
|
205
|
-
__decorate$
|
|
205
|
+
__decorate$o([
|
|
206
206
|
n$1({ type: String })
|
|
207
207
|
], exports.KRAccordion.prototype, "header", void 0);
|
|
208
|
-
__decorate$
|
|
208
|
+
__decorate$o([
|
|
209
209
|
n$1({ type: Boolean, reflect: true })
|
|
210
210
|
], exports.KRAccordion.prototype, "expanded", void 0);
|
|
211
|
-
exports.KRAccordion = __decorate$
|
|
211
|
+
exports.KRAccordion = __decorate$o([
|
|
212
212
|
t$1('kr-accordion')
|
|
213
213
|
], exports.KRAccordion);
|
|
214
214
|
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
226
226
|
*/const e$1=e$2(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
|
|
227
227
|
|
|
228
|
-
var __decorate$
|
|
228
|
+
var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
229
229
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
230
230
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
231
231
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -423,23 +423,23 @@
|
|
|
423
423
|
outline-offset: 2px;
|
|
424
424
|
}
|
|
425
425
|
`;
|
|
426
|
-
__decorate$
|
|
426
|
+
__decorate$n([
|
|
427
427
|
n$1({ type: String })
|
|
428
428
|
], exports.KRAlert.prototype, "type", void 0);
|
|
429
|
-
__decorate$
|
|
429
|
+
__decorate$n([
|
|
430
430
|
n$1({ type: String })
|
|
431
431
|
], exports.KRAlert.prototype, "title", void 0);
|
|
432
|
-
__decorate$
|
|
432
|
+
__decorate$n([
|
|
433
433
|
n$1({ type: Boolean })
|
|
434
434
|
], exports.KRAlert.prototype, "dismissible", void 0);
|
|
435
|
-
__decorate$
|
|
435
|
+
__decorate$n([
|
|
436
436
|
n$1({ type: Boolean })
|
|
437
437
|
], exports.KRAlert.prototype, "visible", void 0);
|
|
438
|
-
exports.KRAlert = __decorate$
|
|
438
|
+
exports.KRAlert = __decorate$n([
|
|
439
439
|
t$1('kr-alert')
|
|
440
440
|
], exports.KRAlert);
|
|
441
441
|
|
|
442
|
-
var __decorate$
|
|
442
|
+
var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
443
443
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
444
444
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
445
445
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1161,43 +1161,43 @@
|
|
|
1161
1161
|
opacity: 0.6;
|
|
1162
1162
|
}
|
|
1163
1163
|
`;
|
|
1164
|
-
__decorate$
|
|
1164
|
+
__decorate$m([
|
|
1165
1165
|
n$1({ type: String, reflect: true })
|
|
1166
1166
|
], exports.KRButton.prototype, "variant", void 0);
|
|
1167
|
-
__decorate$
|
|
1167
|
+
__decorate$m([
|
|
1168
1168
|
n$1({ type: String, reflect: true })
|
|
1169
1169
|
], exports.KRButton.prototype, "color", void 0);
|
|
1170
|
-
__decorate$
|
|
1170
|
+
__decorate$m([
|
|
1171
1171
|
n$1({ type: String, reflect: true })
|
|
1172
1172
|
], exports.KRButton.prototype, "size", void 0);
|
|
1173
|
-
__decorate$
|
|
1173
|
+
__decorate$m([
|
|
1174
1174
|
n$1({ type: Boolean, reflect: true })
|
|
1175
1175
|
], exports.KRButton.prototype, "disabled", void 0);
|
|
1176
|
-
__decorate$
|
|
1176
|
+
__decorate$m([
|
|
1177
1177
|
n$1({ type: String })
|
|
1178
1178
|
], exports.KRButton.prototype, "href", void 0);
|
|
1179
|
-
__decorate$
|
|
1179
|
+
__decorate$m([
|
|
1180
1180
|
n$1({ type: String })
|
|
1181
1181
|
], exports.KRButton.prototype, "target", void 0);
|
|
1182
|
-
__decorate$
|
|
1182
|
+
__decorate$m([
|
|
1183
1183
|
n$1({ type: Array })
|
|
1184
1184
|
], exports.KRButton.prototype, "options", void 0);
|
|
1185
|
-
__decorate$
|
|
1185
|
+
__decorate$m([
|
|
1186
1186
|
n$1({ type: String, reflect: true, attribute: 'icon-position' })
|
|
1187
1187
|
], exports.KRButton.prototype, "iconPosition", void 0);
|
|
1188
|
-
__decorate$
|
|
1188
|
+
__decorate$m([
|
|
1189
1189
|
n$1({ type: Boolean, reflect: true })
|
|
1190
1190
|
], exports.KRButton.prototype, "split", void 0);
|
|
1191
|
-
__decorate$
|
|
1191
|
+
__decorate$m([
|
|
1192
1192
|
r$1()
|
|
1193
1193
|
], exports.KRButton.prototype, "_state", void 0);
|
|
1194
|
-
__decorate$
|
|
1194
|
+
__decorate$m([
|
|
1195
1195
|
r$1()
|
|
1196
1196
|
], exports.KRButton.prototype, "_stateText", void 0);
|
|
1197
|
-
__decorate$
|
|
1197
|
+
__decorate$m([
|
|
1198
1198
|
r$1()
|
|
1199
1199
|
], exports.KRButton.prototype, "_dropdownOpened", void 0);
|
|
1200
|
-
exports.KRButton = __decorate$
|
|
1200
|
+
exports.KRButton = __decorate$m([
|
|
1201
1201
|
t$1('kr-button')
|
|
1202
1202
|
], exports.KRButton);
|
|
1203
1203
|
|
|
@@ -1207,7 +1207,7 @@
|
|
|
1207
1207
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1208
1208
|
*/class e extends i$1{constructor(i){if(super(i),this.it=A,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o$2=e$2(e);
|
|
1209
1209
|
|
|
1210
|
-
var __decorate$
|
|
1210
|
+
var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1211
1211
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1212
1212
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1213
1213
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1441,26 +1441,26 @@
|
|
|
1441
1441
|
.hljs-property { color: #005cc5; }
|
|
1442
1442
|
|
|
1443
1443
|
`];
|
|
1444
|
-
__decorate$
|
|
1444
|
+
__decorate$l([
|
|
1445
1445
|
n$1({ type: String })
|
|
1446
1446
|
], exports.KRCodeDemo.prototype, "language", void 0);
|
|
1447
|
-
__decorate$
|
|
1447
|
+
__decorate$l([
|
|
1448
1448
|
r$1()
|
|
1449
1449
|
], exports.KRCodeDemo.prototype, "code", void 0);
|
|
1450
|
-
__decorate$
|
|
1450
|
+
__decorate$l([
|
|
1451
1451
|
r$1()
|
|
1452
1452
|
], exports.KRCodeDemo.prototype, "activeTab", void 0);
|
|
1453
|
-
__decorate$
|
|
1453
|
+
__decorate$l([
|
|
1454
1454
|
r$1()
|
|
1455
1455
|
], exports.KRCodeDemo.prototype, "copied", void 0);
|
|
1456
|
-
__decorate$
|
|
1456
|
+
__decorate$l([
|
|
1457
1457
|
r$1()
|
|
1458
1458
|
], exports.KRCodeDemo.prototype, "highlightedCode", void 0);
|
|
1459
|
-
exports.KRCodeDemo = __decorate$
|
|
1459
|
+
exports.KRCodeDemo = __decorate$l([
|
|
1460
1460
|
t$1('kr-code-demo')
|
|
1461
1461
|
], exports.KRCodeDemo);
|
|
1462
1462
|
|
|
1463
|
-
var __decorate$
|
|
1463
|
+
var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1464
1464
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1465
1465
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1466
1466
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1629,10 +1629,10 @@
|
|
|
1629
1629
|
margin: 4px 0;
|
|
1630
1630
|
}
|
|
1631
1631
|
`;
|
|
1632
|
-
__decorate$
|
|
1632
|
+
__decorate$k([
|
|
1633
1633
|
r$1()
|
|
1634
1634
|
], exports.KRContextMenu.prototype, "items", void 0);
|
|
1635
|
-
exports.KRContextMenu = __decorate$
|
|
1635
|
+
exports.KRContextMenu = __decorate$k([
|
|
1636
1636
|
t$1('kr-context-menu')
|
|
1637
1637
|
], exports.KRContextMenu);
|
|
1638
1638
|
|
|
@@ -1642,7 +1642,7 @@
|
|
|
1642
1642
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1643
1643
|
*/const n="important",i=" !"+n,o$1=e$2(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return E}});
|
|
1644
1644
|
|
|
1645
|
-
var __decorate$
|
|
1645
|
+
var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1646
1646
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1647
1647
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1648
1648
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1669,7 +1669,7 @@
|
|
|
1669
1669
|
font-weight: 600;
|
|
1670
1670
|
}
|
|
1671
1671
|
`;
|
|
1672
|
-
KRDialogHeader = __decorate$
|
|
1672
|
+
KRDialogHeader = __decorate$j([
|
|
1673
1673
|
t$1('kr-dialog-header')
|
|
1674
1674
|
], KRDialogHeader);
|
|
1675
1675
|
let KRDialogContent = class KRDialogContent extends i$2 {
|
|
@@ -1685,7 +1685,7 @@
|
|
|
1685
1685
|
flex: 1 1 auto;
|
|
1686
1686
|
}
|
|
1687
1687
|
`;
|
|
1688
|
-
KRDialogContent = __decorate$
|
|
1688
|
+
KRDialogContent = __decorate$j([
|
|
1689
1689
|
t$1('kr-dialog-content')
|
|
1690
1690
|
], KRDialogContent);
|
|
1691
1691
|
let KRDialogFooter = class KRDialogFooter extends i$2 {
|
|
@@ -1705,7 +1705,7 @@
|
|
|
1705
1705
|
justify-content: flex-end;
|
|
1706
1706
|
}
|
|
1707
1707
|
`;
|
|
1708
|
-
KRDialogFooter = __decorate$
|
|
1708
|
+
KRDialogFooter = __decorate$j([
|
|
1709
1709
|
t$1('kr-dialog-footer')
|
|
1710
1710
|
], KRDialogFooter);
|
|
1711
1711
|
/**
|
|
@@ -1921,23 +1921,23 @@
|
|
|
1921
1921
|
flex-direction: column;
|
|
1922
1922
|
}
|
|
1923
1923
|
`;
|
|
1924
|
-
__decorate$
|
|
1924
|
+
__decorate$j([
|
|
1925
1925
|
r$1()
|
|
1926
1926
|
], exports.KRDialog.prototype, "_contentElement", void 0);
|
|
1927
|
-
__decorate$
|
|
1927
|
+
__decorate$j([
|
|
1928
1928
|
n$1({ type: Boolean, reflect: true })
|
|
1929
1929
|
], exports.KRDialog.prototype, "opened", void 0);
|
|
1930
|
-
__decorate$
|
|
1930
|
+
__decorate$j([
|
|
1931
1931
|
n$1({ type: String })
|
|
1932
1932
|
], exports.KRDialog.prototype, "label", void 0);
|
|
1933
|
-
__decorate$
|
|
1933
|
+
__decorate$j([
|
|
1934
1934
|
n$1({ type: String })
|
|
1935
1935
|
], exports.KRDialog.prototype, "width", void 0);
|
|
1936
|
-
exports.KRDialog = __decorate$
|
|
1936
|
+
exports.KRDialog = __decorate$j([
|
|
1937
1937
|
t$1('kr-dialog')
|
|
1938
1938
|
], exports.KRDialog);
|
|
1939
1939
|
|
|
1940
|
-
var __decorate$
|
|
1940
|
+
var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1941
1941
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1942
1942
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1943
1943
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -2457,47 +2457,47 @@
|
|
|
2457
2457
|
border-top: 1px solid #e5e7eb;
|
|
2458
2458
|
}
|
|
2459
2459
|
`;
|
|
2460
|
-
__decorate$
|
|
2460
|
+
__decorate$i([
|
|
2461
2461
|
n$1({ type: Object })
|
|
2462
2462
|
], exports.KRDateRangePicker.prototype, "value", void 0);
|
|
2463
|
-
__decorate$
|
|
2463
|
+
__decorate$i([
|
|
2464
2464
|
n$1({ type: Array })
|
|
2465
2465
|
], exports.KRDateRangePicker.prototype, "relativeOptions", void 0);
|
|
2466
|
-
__decorate$
|
|
2466
|
+
__decorate$i([
|
|
2467
2467
|
n$1({ type: Boolean })
|
|
2468
2468
|
], exports.KRDateRangePicker.prototype, "disabled", void 0);
|
|
2469
|
-
__decorate$
|
|
2469
|
+
__decorate$i([
|
|
2470
2470
|
n$1({ type: Boolean })
|
|
2471
2471
|
], exports.KRDateRangePicker.prototype, "invalid", void 0);
|
|
2472
|
-
__decorate$
|
|
2472
|
+
__decorate$i([
|
|
2473
2473
|
n$1({ type: String })
|
|
2474
2474
|
], exports.KRDateRangePicker.prototype, "placeholder", void 0);
|
|
2475
|
-
__decorate$
|
|
2475
|
+
__decorate$i([
|
|
2476
2476
|
n$1({ type: String })
|
|
2477
2477
|
], exports.KRDateRangePicker.prototype, "startDate", void 0);
|
|
2478
|
-
__decorate$
|
|
2478
|
+
__decorate$i([
|
|
2479
2479
|
n$1({ type: String })
|
|
2480
2480
|
], exports.KRDateRangePicker.prototype, "endDate", void 0);
|
|
2481
|
-
__decorate$
|
|
2481
|
+
__decorate$i([
|
|
2482
2482
|
n$1({ type: String })
|
|
2483
2483
|
], exports.KRDateRangePicker.prototype, "mode", void 0);
|
|
2484
|
-
__decorate$
|
|
2484
|
+
__decorate$i([
|
|
2485
2485
|
r$1()
|
|
2486
2486
|
], exports.KRDateRangePicker.prototype, "_isOpen", void 0);
|
|
2487
|
-
__decorate$
|
|
2487
|
+
__decorate$i([
|
|
2488
2488
|
r$1()
|
|
2489
2489
|
], exports.KRDateRangePicker.prototype, "_activeTab", void 0);
|
|
2490
|
-
__decorate$
|
|
2490
|
+
__decorate$i([
|
|
2491
2491
|
r$1()
|
|
2492
2492
|
], exports.KRDateRangePicker.prototype, "_tempStartDate", void 0);
|
|
2493
|
-
__decorate$
|
|
2493
|
+
__decorate$i([
|
|
2494
2494
|
r$1()
|
|
2495
2495
|
], exports.KRDateRangePicker.prototype, "_tempEndDate", void 0);
|
|
2496
|
-
exports.KRDateRangePicker = __decorate$
|
|
2496
|
+
exports.KRDateRangePicker = __decorate$i([
|
|
2497
2497
|
t$1('kr-date-range-picker')
|
|
2498
2498
|
], exports.KRDateRangePicker);
|
|
2499
2499
|
|
|
2500
|
-
var __decorate$
|
|
2500
|
+
var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2501
2501
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2502
2502
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2503
2503
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -2799,23 +2799,23 @@
|
|
|
2799
2799
|
`;
|
|
2800
2800
|
/** Track active snackbars for stacking */
|
|
2801
2801
|
exports.KRSnackbar.activeSnackbars = [];
|
|
2802
|
-
__decorate$
|
|
2802
|
+
__decorate$h([
|
|
2803
2803
|
n$1({ type: String })
|
|
2804
2804
|
], exports.KRSnackbar.prototype, "type", void 0);
|
|
2805
|
-
__decorate$
|
|
2805
|
+
__decorate$h([
|
|
2806
2806
|
n$1({ type: String })
|
|
2807
2807
|
], exports.KRSnackbar.prototype, "title", void 0);
|
|
2808
|
-
__decorate$
|
|
2808
|
+
__decorate$h([
|
|
2809
2809
|
n$1({ type: String })
|
|
2810
2810
|
], exports.KRSnackbar.prototype, "message", void 0);
|
|
2811
|
-
__decorate$
|
|
2811
|
+
__decorate$h([
|
|
2812
2812
|
n$1({ type: Number })
|
|
2813
2813
|
], exports.KRSnackbar.prototype, "duration", void 0);
|
|
2814
|
-
exports.KRSnackbar = KRSnackbar_1 = __decorate$
|
|
2814
|
+
exports.KRSnackbar = KRSnackbar_1 = __decorate$h([
|
|
2815
2815
|
t$1('kr-snackbar')
|
|
2816
2816
|
], exports.KRSnackbar);
|
|
2817
2817
|
|
|
2818
|
-
var __decorate$
|
|
2818
|
+
var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2819
2819
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2820
2820
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2821
2821
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3118,20 +3118,20 @@
|
|
|
3118
3118
|
}
|
|
3119
3119
|
`,
|
|
3120
3120
|
];
|
|
3121
|
-
__decorate$
|
|
3121
|
+
__decorate$g([
|
|
3122
3122
|
n$1({ type: String, attribute: 'active-tab-id' })
|
|
3123
3123
|
], exports.KRTabGroup.prototype, "activeTabId", void 0);
|
|
3124
|
-
__decorate$
|
|
3124
|
+
__decorate$g([
|
|
3125
3125
|
n$1({ type: Boolean })
|
|
3126
3126
|
], exports.KRTabGroup.prototype, "justified", void 0);
|
|
3127
|
-
__decorate$
|
|
3127
|
+
__decorate$g([
|
|
3128
3128
|
n$1({ type: String, reflect: true })
|
|
3129
3129
|
], exports.KRTabGroup.prototype, "size", void 0);
|
|
3130
|
-
exports.KRTabGroup = __decorate$
|
|
3130
|
+
exports.KRTabGroup = __decorate$g([
|
|
3131
3131
|
t$1('kr-tab-group')
|
|
3132
3132
|
], exports.KRTabGroup);
|
|
3133
3133
|
|
|
3134
|
-
var __decorate$
|
|
3134
|
+
var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3135
3135
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3136
3136
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3137
3137
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3212,35 +3212,35 @@
|
|
|
3212
3212
|
}
|
|
3213
3213
|
`,
|
|
3214
3214
|
];
|
|
3215
|
-
__decorate$
|
|
3215
|
+
__decorate$f([
|
|
3216
3216
|
n$1({ type: String, reflect: true })
|
|
3217
3217
|
], exports.KRTab.prototype, "id", void 0);
|
|
3218
|
-
__decorate$
|
|
3218
|
+
__decorate$f([
|
|
3219
3219
|
n$1({ type: String })
|
|
3220
3220
|
], exports.KRTab.prototype, "label", void 0);
|
|
3221
|
-
__decorate$
|
|
3221
|
+
__decorate$f([
|
|
3222
3222
|
n$1({ type: String })
|
|
3223
3223
|
], exports.KRTab.prototype, "badge", void 0);
|
|
3224
|
-
__decorate$
|
|
3224
|
+
__decorate$f([
|
|
3225
3225
|
n$1({ type: String, attribute: 'badge-background' })
|
|
3226
3226
|
], exports.KRTab.prototype, "badgeBackground", void 0);
|
|
3227
|
-
__decorate$
|
|
3227
|
+
__decorate$f([
|
|
3228
3228
|
n$1({ type: String, attribute: 'badge-color' })
|
|
3229
3229
|
], exports.KRTab.prototype, "badgeColor", void 0);
|
|
3230
|
-
__decorate$
|
|
3230
|
+
__decorate$f([
|
|
3231
3231
|
n$1({ type: Boolean })
|
|
3232
3232
|
], exports.KRTab.prototype, "disabled", void 0);
|
|
3233
|
-
__decorate$
|
|
3233
|
+
__decorate$f([
|
|
3234
3234
|
n$1({ type: Boolean })
|
|
3235
3235
|
], exports.KRTab.prototype, "dismissible", void 0);
|
|
3236
|
-
__decorate$
|
|
3236
|
+
__decorate$f([
|
|
3237
3237
|
n$1({ type: Boolean, reflect: true })
|
|
3238
3238
|
], exports.KRTab.prototype, "active", void 0);
|
|
3239
|
-
exports.KRTab = __decorate$
|
|
3239
|
+
exports.KRTab = __decorate$f([
|
|
3240
3240
|
t$1('kr-tab')
|
|
3241
3241
|
], exports.KRTab);
|
|
3242
3242
|
|
|
3243
|
-
var __decorate$
|
|
3243
|
+
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3244
3244
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3245
3245
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3246
3246
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3712,47 +3712,47 @@
|
|
|
3712
3712
|
`];
|
|
3713
3713
|
// Enable form association
|
|
3714
3714
|
exports.KRSelectField.formAssociated = true;
|
|
3715
|
-
__decorate$
|
|
3715
|
+
__decorate$e([
|
|
3716
3716
|
n$1({ type: String })
|
|
3717
3717
|
], exports.KRSelectField.prototype, "label", void 0);
|
|
3718
|
-
__decorate$
|
|
3718
|
+
__decorate$e([
|
|
3719
3719
|
n$1({ type: String })
|
|
3720
3720
|
], exports.KRSelectField.prototype, "name", void 0);
|
|
3721
|
-
__decorate$
|
|
3721
|
+
__decorate$e([
|
|
3722
3722
|
n$1({ type: String })
|
|
3723
3723
|
], exports.KRSelectField.prototype, "value", void 0);
|
|
3724
|
-
__decorate$
|
|
3724
|
+
__decorate$e([
|
|
3725
3725
|
n$1({ type: String })
|
|
3726
3726
|
], exports.KRSelectField.prototype, "placeholder", void 0);
|
|
3727
|
-
__decorate$
|
|
3727
|
+
__decorate$e([
|
|
3728
3728
|
n$1({ type: Boolean })
|
|
3729
3729
|
], exports.KRSelectField.prototype, "disabled", void 0);
|
|
3730
|
-
__decorate$
|
|
3730
|
+
__decorate$e([
|
|
3731
3731
|
n$1({ type: Boolean })
|
|
3732
3732
|
], exports.KRSelectField.prototype, "required", void 0);
|
|
3733
|
-
__decorate$
|
|
3733
|
+
__decorate$e([
|
|
3734
3734
|
n$1({ type: Boolean })
|
|
3735
3735
|
], exports.KRSelectField.prototype, "readonly", void 0);
|
|
3736
|
-
__decorate$
|
|
3736
|
+
__decorate$e([
|
|
3737
3737
|
n$1({ type: String })
|
|
3738
3738
|
], exports.KRSelectField.prototype, "hint", void 0);
|
|
3739
|
-
__decorate$
|
|
3739
|
+
__decorate$e([
|
|
3740
3740
|
r$1()
|
|
3741
3741
|
], exports.KRSelectField.prototype, "_isOpen", void 0);
|
|
3742
|
-
__decorate$
|
|
3742
|
+
__decorate$e([
|
|
3743
3743
|
r$1()
|
|
3744
3744
|
], exports.KRSelectField.prototype, "_highlightedIndex", void 0);
|
|
3745
|
-
__decorate$
|
|
3745
|
+
__decorate$e([
|
|
3746
3746
|
r$1()
|
|
3747
3747
|
], exports.KRSelectField.prototype, "_touched", void 0);
|
|
3748
|
-
__decorate$
|
|
3748
|
+
__decorate$e([
|
|
3749
3749
|
e$3('.select-trigger')
|
|
3750
3750
|
], exports.KRSelectField.prototype, "_triggerElement", void 0);
|
|
3751
|
-
exports.KRSelectField = __decorate$
|
|
3751
|
+
exports.KRSelectField = __decorate$e([
|
|
3752
3752
|
t$1('kr-select-field')
|
|
3753
3753
|
], exports.KRSelectField);
|
|
3754
3754
|
|
|
3755
|
-
var __decorate$
|
|
3755
|
+
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3756
3756
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3757
3757
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3758
3758
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3789,13 +3789,13 @@
|
|
|
3789
3789
|
display: none;
|
|
3790
3790
|
}
|
|
3791
3791
|
`;
|
|
3792
|
-
__decorate$
|
|
3792
|
+
__decorate$d([
|
|
3793
3793
|
n$1({ type: String })
|
|
3794
3794
|
], exports.KRSelectOption.prototype, "value", void 0);
|
|
3795
|
-
__decorate$
|
|
3795
|
+
__decorate$d([
|
|
3796
3796
|
n$1({ type: Boolean })
|
|
3797
3797
|
], exports.KRSelectOption.prototype, "disabled", void 0);
|
|
3798
|
-
exports.KRSelectOption = __decorate$
|
|
3798
|
+
exports.KRSelectOption = __decorate$d([
|
|
3799
3799
|
t$1('kr-select-option')
|
|
3800
3800
|
], exports.KRSelectOption);
|
|
3801
3801
|
|
|
@@ -4843,7 +4843,7 @@
|
|
|
4843
4843
|
}
|
|
4844
4844
|
}
|
|
4845
4845
|
|
|
4846
|
-
var __decorate$
|
|
4846
|
+
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4847
4847
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4848
4848
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4849
4849
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -7200,61 +7200,2466 @@
|
|
|
7200
7200
|
}
|
|
7201
7201
|
|
|
7202
7202
|
`];
|
|
7203
|
-
__decorate$
|
|
7203
|
+
__decorate$c([
|
|
7204
7204
|
r$1()
|
|
7205
7205
|
], exports.KRTable.prototype, "_data", void 0);
|
|
7206
|
-
__decorate$
|
|
7206
|
+
__decorate$c([
|
|
7207
7207
|
r$1()
|
|
7208
7208
|
], exports.KRTable.prototype, "_dataState", void 0);
|
|
7209
|
-
__decorate$
|
|
7209
|
+
__decorate$c([
|
|
7210
7210
|
r$1()
|
|
7211
7211
|
], exports.KRTable.prototype, "_page", void 0);
|
|
7212
|
-
__decorate$
|
|
7212
|
+
__decorate$c([
|
|
7213
7213
|
r$1()
|
|
7214
7214
|
], exports.KRTable.prototype, "_pageSize", void 0);
|
|
7215
|
-
__decorate$
|
|
7215
|
+
__decorate$c([
|
|
7216
7216
|
r$1()
|
|
7217
7217
|
], exports.KRTable.prototype, "_totalItems", void 0);
|
|
7218
|
-
__decorate$
|
|
7218
|
+
__decorate$c([
|
|
7219
7219
|
r$1()
|
|
7220
7220
|
], exports.KRTable.prototype, "_totalPages", void 0);
|
|
7221
|
-
__decorate$
|
|
7221
|
+
__decorate$c([
|
|
7222
7222
|
r$1()
|
|
7223
7223
|
], exports.KRTable.prototype, "_searchQuery", void 0);
|
|
7224
|
-
__decorate$
|
|
7224
|
+
__decorate$c([
|
|
7225
7225
|
r$1()
|
|
7226
7226
|
], exports.KRTable.prototype, "_canScrollLeft", void 0);
|
|
7227
|
-
__decorate$
|
|
7227
|
+
__decorate$c([
|
|
7228
7228
|
r$1()
|
|
7229
7229
|
], exports.KRTable.prototype, "_canScrollRight", void 0);
|
|
7230
|
-
__decorate$
|
|
7230
|
+
__decorate$c([
|
|
7231
7231
|
r$1()
|
|
7232
7232
|
], exports.KRTable.prototype, "_canScrollHorizontal", void 0);
|
|
7233
|
-
__decorate$
|
|
7233
|
+
__decorate$c([
|
|
7234
7234
|
r$1()
|
|
7235
7235
|
], exports.KRTable.prototype, "_columnPickerOpen", void 0);
|
|
7236
|
-
__decorate$
|
|
7236
|
+
__decorate$c([
|
|
7237
7237
|
r$1()
|
|
7238
7238
|
], exports.KRTable.prototype, "_filterPanelOpened", void 0);
|
|
7239
|
-
__decorate$
|
|
7239
|
+
__decorate$c([
|
|
7240
7240
|
r$1()
|
|
7241
7241
|
], exports.KRTable.prototype, "_filterPanelTab", void 0);
|
|
7242
|
-
__decorate$
|
|
7242
|
+
__decorate$c([
|
|
7243
7243
|
r$1()
|
|
7244
7244
|
], exports.KRTable.prototype, "_buckets", void 0);
|
|
7245
|
-
__decorate$
|
|
7245
|
+
__decorate$c([
|
|
7246
7246
|
r$1()
|
|
7247
7247
|
], exports.KRTable.prototype, "_sorts", void 0);
|
|
7248
|
-
__decorate$
|
|
7248
|
+
__decorate$c([
|
|
7249
7249
|
n$1({ type: Object })
|
|
7250
7250
|
], exports.KRTable.prototype, "def", void 0);
|
|
7251
|
-
__decorate$
|
|
7251
|
+
__decorate$c([
|
|
7252
7252
|
n$1({ type: String, reflect: true })
|
|
7253
7253
|
], exports.KRTable.prototype, "variant", void 0);
|
|
7254
|
-
exports.KRTable = __decorate$
|
|
7254
|
+
exports.KRTable = __decorate$c([
|
|
7255
7255
|
t$1('kr-table')
|
|
7256
7256
|
], exports.KRTable);
|
|
7257
7257
|
|
|
7258
|
+
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
7259
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7260
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7261
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7262
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7263
|
+
};
|
|
7264
|
+
/** Internal grid model built from user-provided def. */
|
|
7265
|
+
class KRGridModel {
|
|
7266
|
+
constructor() {
|
|
7267
|
+
this.title = '';
|
|
7268
|
+
this.description = '';
|
|
7269
|
+
this.actions = [];
|
|
7270
|
+
this.columns = [];
|
|
7271
|
+
this.displayedColumns = [];
|
|
7272
|
+
this.data = null;
|
|
7273
|
+
this.dataSource = null;
|
|
7274
|
+
this.refreshInterval = 0;
|
|
7275
|
+
this.pageSize = 0;
|
|
7276
|
+
this.rowClickable = false;
|
|
7277
|
+
this.rowHref = null;
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
exports.KRGrid = class KRGrid extends i$2 {
|
|
7281
|
+
constructor() {
|
|
7282
|
+
super(...arguments);
|
|
7283
|
+
/**
|
|
7284
|
+
* Internal flag to switch between scroll edge modes:
|
|
7285
|
+
* - 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge)
|
|
7286
|
+
* - 'edge': Padding scrolls with content, allowing table to reach edges when scrolling
|
|
7287
|
+
*/
|
|
7288
|
+
this._scrollStyle = 'edge';
|
|
7289
|
+
this._data = [];
|
|
7290
|
+
this._dataState = 'idle';
|
|
7291
|
+
this._page = 1;
|
|
7292
|
+
this._pageSize = 50;
|
|
7293
|
+
this._totalItems = 0;
|
|
7294
|
+
this._totalPages = 0;
|
|
7295
|
+
this._searchQuery = '';
|
|
7296
|
+
this._canScrollLeft = false;
|
|
7297
|
+
this._canScrollRight = false;
|
|
7298
|
+
this._canScrollHorizontal = false;
|
|
7299
|
+
this._columnPickerOpen = false;
|
|
7300
|
+
this._filterPanelOpened = null;
|
|
7301
|
+
this._filterPanelTab = 'filter';
|
|
7302
|
+
this._buckets = new Map();
|
|
7303
|
+
this._filterPanelPos = { top: 0, left: 0 };
|
|
7304
|
+
this._sorts = [];
|
|
7305
|
+
this._resizing = null;
|
|
7306
|
+
this._resizeObserver = null;
|
|
7307
|
+
this._searchPositionLocked = false;
|
|
7308
|
+
this._columnWidthsLocked = false;
|
|
7309
|
+
this._model = new KRGridModel();
|
|
7310
|
+
this.def = { columns: [] };
|
|
7311
|
+
/**
|
|
7312
|
+
* Table layout variant.
|
|
7313
|
+
* - 'default': Full-page table that fills parent height with centered search.
|
|
7314
|
+
* - 'card': Embedded table that sizes itself to content, left-aligns search, and
|
|
7315
|
+
* reserves space for pageSize rows to prevent layout shift.
|
|
7316
|
+
*/
|
|
7317
|
+
this.variant = 'default';
|
|
7318
|
+
this._handleClickOutside = (e) => {
|
|
7319
|
+
const path = e.composedPath();
|
|
7320
|
+
if (this._columnPickerOpen) {
|
|
7321
|
+
const picker = this.shadowRoot?.querySelector('.column-picker-wrapper');
|
|
7322
|
+
if (picker && !path.includes(picker)) {
|
|
7323
|
+
this._columnPickerOpen = false;
|
|
7324
|
+
}
|
|
7325
|
+
}
|
|
7326
|
+
if (this._filterPanelOpened) {
|
|
7327
|
+
if (!path.some((el) => el.classList?.contains('filter-panel'))) {
|
|
7328
|
+
this._handleFilterApply();
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7331
|
+
};
|
|
7332
|
+
this._handleResizeMove = (e) => {
|
|
7333
|
+
if (!this._resizing)
|
|
7334
|
+
return;
|
|
7335
|
+
const col = this._model.columns.find(c => c.id === this._resizing.columnId);
|
|
7336
|
+
if (col) {
|
|
7337
|
+
const newWidth = this._resizing.startWidth + (e.clientX - this._resizing.startX);
|
|
7338
|
+
col.width = `${Math.min(900, Math.max(50, newWidth))}px`;
|
|
7339
|
+
this.requestUpdate();
|
|
7340
|
+
}
|
|
7341
|
+
};
|
|
7342
|
+
this._handleResizeEnd = () => {
|
|
7343
|
+
this._resizing = null;
|
|
7344
|
+
document.removeEventListener('mousemove', this._handleResizeMove);
|
|
7345
|
+
document.removeEventListener('mouseup', this._handleResizeEnd);
|
|
7346
|
+
};
|
|
7347
|
+
}
|
|
7348
|
+
connectedCallback() {
|
|
7349
|
+
super.connectedCallback();
|
|
7350
|
+
this.classList.toggle('kr-table--scroll-overlay', this._scrollStyle === 'overlay');
|
|
7351
|
+
this.classList.toggle('kr-table--scroll-edge', this._scrollStyle === 'edge');
|
|
7352
|
+
this._fetch();
|
|
7353
|
+
this._initRefresh();
|
|
7354
|
+
document.addEventListener('click', this._handleClickOutside);
|
|
7355
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
7356
|
+
// Unlock and recalculate on resize since layout changes
|
|
7357
|
+
this._searchPositionLocked = false;
|
|
7358
|
+
this._updateSearchPosition();
|
|
7359
|
+
});
|
|
7360
|
+
this._resizeObserver.observe(this);
|
|
7361
|
+
}
|
|
7362
|
+
disconnectedCallback() {
|
|
7363
|
+
super.disconnectedCallback();
|
|
7364
|
+
clearInterval(this._refreshTimer);
|
|
7365
|
+
document.removeEventListener('click', this._handleClickOutside);
|
|
7366
|
+
this._resizeObserver?.disconnect();
|
|
7367
|
+
}
|
|
7368
|
+
willUpdate(changedProperties) {
|
|
7369
|
+
if (changedProperties.has('def')) {
|
|
7370
|
+
// Build internal model from user-provided def
|
|
7371
|
+
this._columnWidthsLocked = false;
|
|
7372
|
+
this._model = new KRGridModel();
|
|
7373
|
+
if (this.def.title) {
|
|
7374
|
+
this._model.title = this.def.title;
|
|
7375
|
+
}
|
|
7376
|
+
if (this.def.description) {
|
|
7377
|
+
this._model.description = this.def.description;
|
|
7378
|
+
}
|
|
7379
|
+
if (this.def.actions) {
|
|
7380
|
+
this._model.actions = this.def.actions;
|
|
7381
|
+
}
|
|
7382
|
+
if (this.def.data) {
|
|
7383
|
+
this._model.data = this.def.data;
|
|
7384
|
+
}
|
|
7385
|
+
if (this.def.dataSource) {
|
|
7386
|
+
this._model.dataSource = this.def.dataSource;
|
|
7387
|
+
}
|
|
7388
|
+
if (typeof this.def.refreshInterval === 'number') {
|
|
7389
|
+
this._model.refreshInterval = this.def.refreshInterval;
|
|
7390
|
+
}
|
|
7391
|
+
if (typeof this.def.pageSize === 'number') {
|
|
7392
|
+
this._model.pageSize = this.def.pageSize;
|
|
7393
|
+
this._pageSize = this.def.pageSize;
|
|
7394
|
+
}
|
|
7395
|
+
if (this.def.rowClickable) {
|
|
7396
|
+
this._model.rowClickable = this.def.rowClickable;
|
|
7397
|
+
}
|
|
7398
|
+
if (this.def.rowHref) {
|
|
7399
|
+
this._model.rowHref = this.def.rowHref;
|
|
7400
|
+
}
|
|
7401
|
+
this._sorts = [];
|
|
7402
|
+
this._model.columns = this.def.columns.map(col => {
|
|
7403
|
+
const column = {
|
|
7404
|
+
...col,
|
|
7405
|
+
filter: null
|
|
7406
|
+
};
|
|
7407
|
+
if (!column.type) {
|
|
7408
|
+
column.type = 'string';
|
|
7409
|
+
}
|
|
7410
|
+
if (col.sort) {
|
|
7411
|
+
this._sorts.push({
|
|
7412
|
+
sortBy: col.id,
|
|
7413
|
+
sortDirection: col.sort
|
|
7414
|
+
});
|
|
7415
|
+
}
|
|
7416
|
+
if (column.type === 'actions') {
|
|
7417
|
+
column.label = col.label ?? '';
|
|
7418
|
+
column.sticky = 'right';
|
|
7419
|
+
column.resizable = false;
|
|
7420
|
+
return column;
|
|
7421
|
+
}
|
|
7422
|
+
if (col.filterable || col.facetable) {
|
|
7423
|
+
column.filter = new KRQuery();
|
|
7424
|
+
column.filter.field = col.id;
|
|
7425
|
+
column.filter.type = column.type;
|
|
7426
|
+
if (col.filter) {
|
|
7427
|
+
column.filter.setOperator(col.filter.operator);
|
|
7428
|
+
column.filter.setValue(col.filter.value);
|
|
7429
|
+
}
|
|
7430
|
+
else if (col.facetable && !col.filterable) {
|
|
7431
|
+
column.filter.operator = 'in';
|
|
7432
|
+
column.filter.value = [];
|
|
7433
|
+
}
|
|
7434
|
+
else if (column.filter.type === 'string') {
|
|
7435
|
+
column.filter.operator = 'contains';
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
return column;
|
|
7439
|
+
});
|
|
7440
|
+
if (this.def.displayedColumns) {
|
|
7441
|
+
this._model.displayedColumns = this.def.displayedColumns;
|
|
7442
|
+
}
|
|
7443
|
+
else {
|
|
7444
|
+
this._model.displayedColumns = this._model.columns.map(c => c.id);
|
|
7445
|
+
}
|
|
7446
|
+
this._fetch();
|
|
7447
|
+
this._initRefresh();
|
|
7448
|
+
}
|
|
7449
|
+
}
|
|
7450
|
+
updated(changedProperties) {
|
|
7451
|
+
this.classList.toggle('kr-table--card', this.variant === 'card');
|
|
7452
|
+
this._updateScrollFlags();
|
|
7453
|
+
this._syncSlottedContent();
|
|
7454
|
+
this._lockColumnWidths();
|
|
7455
|
+
}
|
|
7456
|
+
/** Measures header cell widths and locks them to prevent column shift on subsequent data changes. */
|
|
7457
|
+
_lockColumnWidths() {
|
|
7458
|
+
if (this._columnWidthsLocked || this._data.length === 0)
|
|
7459
|
+
return;
|
|
7460
|
+
const headerCells = this.shadowRoot?.querySelectorAll('.header-row > .header-cell');
|
|
7461
|
+
if (!headerCells)
|
|
7462
|
+
return;
|
|
7463
|
+
const cols = this.getDisplayedColumns();
|
|
7464
|
+
headerCells.forEach((cell, i) => {
|
|
7465
|
+
const cellWidth = cell.offsetWidth;
|
|
7466
|
+
if (i < cols.length && !cols[i].width && cols[i].type !== 'actions' && cellWidth > 0) {
|
|
7467
|
+
cols[i].width = `${cellWidth}px`;
|
|
7468
|
+
this._columnWidthsLocked = true;
|
|
7469
|
+
}
|
|
7470
|
+
});
|
|
7471
|
+
}
|
|
7472
|
+
/** Syncs light DOM content for cells with custom render functions */
|
|
7473
|
+
_syncSlottedContent() {
|
|
7474
|
+
const columns = this.getDisplayedColumns().filter(col => col.render);
|
|
7475
|
+
if (!columns.length)
|
|
7476
|
+
return;
|
|
7477
|
+
// Clear old slotted content
|
|
7478
|
+
this.querySelectorAll('[slot^="cell-"]').forEach(el => el.remove());
|
|
7479
|
+
// Create new slotted content
|
|
7480
|
+
this._data.forEach((row, rowIndex) => {
|
|
7481
|
+
columns.forEach(col => {
|
|
7482
|
+
const result = col.render(row);
|
|
7483
|
+
if (!result)
|
|
7484
|
+
return;
|
|
7485
|
+
const el = document.createElement('span');
|
|
7486
|
+
el.slot = `cell-${rowIndex}-${col.id}`;
|
|
7487
|
+
if (col.type === 'actions') {
|
|
7488
|
+
el.style.display = 'flex';
|
|
7489
|
+
el.style.gap = '8px';
|
|
7490
|
+
}
|
|
7491
|
+
if (typeof result === 'string') {
|
|
7492
|
+
el.innerHTML = result;
|
|
7493
|
+
}
|
|
7494
|
+
else {
|
|
7495
|
+
D(result, el);
|
|
7496
|
+
}
|
|
7497
|
+
this.appendChild(el);
|
|
7498
|
+
});
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7501
|
+
// ----------------------------------------------------------------------------
|
|
7502
|
+
// Public Interface
|
|
7503
|
+
// ----------------------------------------------------------------------------
|
|
7504
|
+
refresh() {
|
|
7505
|
+
this._fetch();
|
|
7506
|
+
}
|
|
7507
|
+
goToPrevPage() {
|
|
7508
|
+
if (this._page > 1) {
|
|
7509
|
+
this._page--;
|
|
7510
|
+
this._fetch();
|
|
7511
|
+
}
|
|
7512
|
+
}
|
|
7513
|
+
goToNextPage() {
|
|
7514
|
+
if (this._page < this._totalPages) {
|
|
7515
|
+
this._page++;
|
|
7516
|
+
this._fetch();
|
|
7517
|
+
}
|
|
7518
|
+
}
|
|
7519
|
+
goToPage(page) {
|
|
7520
|
+
if (page >= 1 && page <= this._totalPages) {
|
|
7521
|
+
this._page = page;
|
|
7522
|
+
this._fetch();
|
|
7523
|
+
}
|
|
7524
|
+
}
|
|
7525
|
+
// ----------------------------------------------------------------------------
|
|
7526
|
+
// Data Fetching
|
|
7527
|
+
// ----------------------------------------------------------------------------
|
|
7528
|
+
_toSolrData() {
|
|
7529
|
+
const request = {
|
|
7530
|
+
page: this._page - 1,
|
|
7531
|
+
size: this._pageSize,
|
|
7532
|
+
sorts: this._sorts,
|
|
7533
|
+
filterFields: [],
|
|
7534
|
+
queryFields: [],
|
|
7535
|
+
facetFields: []
|
|
7536
|
+
};
|
|
7537
|
+
for (const col of this._model.columns) {
|
|
7538
|
+
if (!col.filter || col.filter.isEmpty() || !col.filter.isValid()) {
|
|
7539
|
+
continue;
|
|
7540
|
+
}
|
|
7541
|
+
const filterData = col.filter.toSolrData();
|
|
7542
|
+
if (col.facetable && (col.filter.operator === 'in' || col.filter.operator === 'n_in')) {
|
|
7543
|
+
filterData.tagged = true;
|
|
7544
|
+
}
|
|
7545
|
+
request.filterFields.push(filterData);
|
|
7546
|
+
}
|
|
7547
|
+
for (const col of this._model.columns) {
|
|
7548
|
+
if (!col.facetable) {
|
|
7549
|
+
continue;
|
|
7550
|
+
}
|
|
7551
|
+
request.facetFields.push({
|
|
7552
|
+
name: col.id,
|
|
7553
|
+
type: 'FIELD',
|
|
7554
|
+
limit: 100,
|
|
7555
|
+
sort: 'count',
|
|
7556
|
+
minimumCount: 1
|
|
7557
|
+
});
|
|
7558
|
+
}
|
|
7559
|
+
if (this._searchQuery?.trim().length) {
|
|
7560
|
+
request.queryFields.push({
|
|
7561
|
+
name: '_text_',
|
|
7562
|
+
operation: 'IS',
|
|
7563
|
+
value: termify(this._searchQuery, false)
|
|
7564
|
+
});
|
|
7565
|
+
}
|
|
7566
|
+
return request;
|
|
7567
|
+
}
|
|
7568
|
+
_toDbParams() {
|
|
7569
|
+
const request = {
|
|
7570
|
+
page: this._page - 1,
|
|
7571
|
+
size: this._pageSize,
|
|
7572
|
+
sorts: this._sorts,
|
|
7573
|
+
filterFields: [],
|
|
7574
|
+
queryFields: [],
|
|
7575
|
+
facetFields: []
|
|
7576
|
+
};
|
|
7577
|
+
for (const col of this._model.columns) {
|
|
7578
|
+
if (!col.filter || col.filter.isEmpty() || !col.filter.isValid()) {
|
|
7579
|
+
continue;
|
|
7580
|
+
}
|
|
7581
|
+
request.filterFields.push(col.filter.toDbParams());
|
|
7582
|
+
}
|
|
7583
|
+
if (this._searchQuery?.trim().length) {
|
|
7584
|
+
this._model.columns.filter(col => col.searchable).forEach(col => {
|
|
7585
|
+
request.queryFields.push({
|
|
7586
|
+
name: col.id,
|
|
7587
|
+
operation: 'CONTAINS',
|
|
7588
|
+
value: this._searchQuery,
|
|
7589
|
+
and: false
|
|
7590
|
+
});
|
|
7591
|
+
});
|
|
7592
|
+
}
|
|
7593
|
+
return request;
|
|
7594
|
+
}
|
|
7595
|
+
/**
|
|
7596
|
+
* Fetches data from the API and updates the table.
|
|
7597
|
+
* Shows a loading spinner while fetching, then displays rows on success
|
|
7598
|
+
* or an error snackbar on failure.
|
|
7599
|
+
* Request/response format depends on dataSource.mode (solr, opensearch, db).
|
|
7600
|
+
*/
|
|
7601
|
+
_fetch() {
|
|
7602
|
+
if (this._model.data) {
|
|
7603
|
+
this._data = this._model.data;
|
|
7604
|
+
this._totalItems = this._model.data.length;
|
|
7605
|
+
this._totalPages = Math.ceil(this._model.data.length / this._pageSize);
|
|
7606
|
+
this._dataState = 'success';
|
|
7607
|
+
return;
|
|
7608
|
+
}
|
|
7609
|
+
if (!this._model.dataSource)
|
|
7610
|
+
return;
|
|
7611
|
+
this._dataState = 'loading';
|
|
7612
|
+
let request;
|
|
7613
|
+
if (this._model.dataSource.mode === 'db') {
|
|
7614
|
+
request = this._toDbParams();
|
|
7615
|
+
}
|
|
7616
|
+
else {
|
|
7617
|
+
request = this._toSolrData();
|
|
7618
|
+
}
|
|
7619
|
+
this._model.dataSource.fetch(request)
|
|
7620
|
+
.then(response => {
|
|
7621
|
+
// Parse response based on mode
|
|
7622
|
+
switch (this._model.dataSource?.mode) {
|
|
7623
|
+
case 'opensearch': {
|
|
7624
|
+
throw Error('Opensearch not supported yet');
|
|
7625
|
+
}
|
|
7626
|
+
case 'db': {
|
|
7627
|
+
const res = response;
|
|
7628
|
+
this._data = res.data.content;
|
|
7629
|
+
this._totalItems = res.data.totalElements;
|
|
7630
|
+
this._totalPages = res.data.totalPages;
|
|
7631
|
+
this._pageSize = res.data.size;
|
|
7632
|
+
break;
|
|
7633
|
+
}
|
|
7634
|
+
default: { // solr
|
|
7635
|
+
const res = response;
|
|
7636
|
+
this._data = res.data.content;
|
|
7637
|
+
this._totalItems = res.data.totalElements;
|
|
7638
|
+
this._totalPages = res.data.totalPages;
|
|
7639
|
+
this._pageSize = res.data.size;
|
|
7640
|
+
this._parseFacetResults(res);
|
|
7641
|
+
}
|
|
7642
|
+
}
|
|
7643
|
+
this._dataState = 'success';
|
|
7644
|
+
this._updateSearchPosition();
|
|
7645
|
+
})
|
|
7646
|
+
.catch(err => {
|
|
7647
|
+
this._dataState = 'error';
|
|
7648
|
+
exports.KRSnackbar.show({
|
|
7649
|
+
message: err instanceof Error ? err.message : 'Failed to load data',
|
|
7650
|
+
type: 'error'
|
|
7651
|
+
});
|
|
7652
|
+
});
|
|
7653
|
+
}
|
|
7654
|
+
_parseFacetResults(response) {
|
|
7655
|
+
if (!response.data.facetFields) {
|
|
7656
|
+
return;
|
|
7657
|
+
}
|
|
7658
|
+
for (const col of this._model.columns) {
|
|
7659
|
+
if (!col.facetable) {
|
|
7660
|
+
continue;
|
|
7661
|
+
}
|
|
7662
|
+
const rawBuckets = response.data.facetFields[col.id];
|
|
7663
|
+
if (!rawBuckets) {
|
|
7664
|
+
this._buckets.set(col.id, []);
|
|
7665
|
+
continue;
|
|
7666
|
+
}
|
|
7667
|
+
const buckets = [];
|
|
7668
|
+
for (const raw of rawBuckets) {
|
|
7669
|
+
// Solr returns boolean facet values as strings — coerce to actual booleans
|
|
7670
|
+
// so they match the filter values stored by toggle().
|
|
7671
|
+
let val = raw.name;
|
|
7672
|
+
if (col.type === 'boolean' && typeof raw.name === 'string') {
|
|
7673
|
+
if (raw.name === 'true') {
|
|
7674
|
+
val = true;
|
|
7675
|
+
}
|
|
7676
|
+
else if (raw.name === 'false') {
|
|
7677
|
+
val = false;
|
|
7678
|
+
}
|
|
7679
|
+
}
|
|
7680
|
+
if (raw.name === null && raw.count > 0) {
|
|
7681
|
+
buckets.unshift({
|
|
7682
|
+
val: null,
|
|
7683
|
+
count: raw.count
|
|
7684
|
+
});
|
|
7685
|
+
}
|
|
7686
|
+
if (raw.name !== null) {
|
|
7687
|
+
buckets.push({
|
|
7688
|
+
val: val,
|
|
7689
|
+
count: raw.count
|
|
7690
|
+
});
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
// Bucket sync: ensure selected values appear even with 0 results
|
|
7694
|
+
if (col.filter && (col.filter.operator === 'in' || col.filter.operator === 'n_in') && Array.isArray(col.filter.value)) {
|
|
7695
|
+
for (const selectedVal of col.filter.value) {
|
|
7696
|
+
if (!buckets.some(b => b.val === selectedVal)) {
|
|
7697
|
+
buckets.push({
|
|
7698
|
+
val: selectedVal,
|
|
7699
|
+
count: 0
|
|
7700
|
+
});
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
this._buckets.set(col.id, buckets);
|
|
7705
|
+
}
|
|
7706
|
+
// Trigger re-render since Map mutation doesn't trigger Lit updates
|
|
7707
|
+
this._buckets = new Map(this._buckets);
|
|
7708
|
+
}
|
|
7709
|
+
/**
|
|
7710
|
+
* Sets up auto-refresh so the table automatically fetches fresh data
|
|
7711
|
+
* at a regular interval (useful for dashboards, monitoring views).
|
|
7712
|
+
* Configured via def.refreshInterval in milliseconds.
|
|
7713
|
+
*/
|
|
7714
|
+
_initRefresh() {
|
|
7715
|
+
clearInterval(this._refreshTimer);
|
|
7716
|
+
if (this._model.refreshInterval && this._model.refreshInterval > 0) {
|
|
7717
|
+
this._refreshTimer = window.setInterval(() => {
|
|
7718
|
+
this._fetch();
|
|
7719
|
+
}, this._model.refreshInterval);
|
|
7720
|
+
}
|
|
7721
|
+
}
|
|
7722
|
+
_handleSearch(e) {
|
|
7723
|
+
const input = e.target;
|
|
7724
|
+
this._searchQuery = input.value;
|
|
7725
|
+
this._page = 1;
|
|
7726
|
+
this._fetch();
|
|
7727
|
+
}
|
|
7728
|
+
_getGridTemplateColumns() {
|
|
7729
|
+
const cols = this.getDisplayedColumns();
|
|
7730
|
+
return cols.map((col) => {
|
|
7731
|
+
// If column has explicit width, use it
|
|
7732
|
+
if (col.width) {
|
|
7733
|
+
return col.width;
|
|
7734
|
+
}
|
|
7735
|
+
// Actions columns: fit content without minimum
|
|
7736
|
+
if (col.type === 'actions') {
|
|
7737
|
+
return 'max-content';
|
|
7738
|
+
}
|
|
7739
|
+
// No width specified - use content-based sizing with minimum
|
|
7740
|
+
return 'minmax(80px, auto)';
|
|
7741
|
+
}).join(' ');
|
|
7742
|
+
}
|
|
7743
|
+
/**
|
|
7744
|
+
* Updates search position to be centered with equal gaps from title and tools.
|
|
7745
|
+
* On first call: resets to flex centering, measures position, then locks with fixed margin.
|
|
7746
|
+
* Subsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize).
|
|
7747
|
+
*/
|
|
7748
|
+
_updateSearchPosition() {
|
|
7749
|
+
// Skip if already locked (prevents shifts on pagination changes)
|
|
7750
|
+
if (this._searchPositionLocked)
|
|
7751
|
+
return;
|
|
7752
|
+
// In card mode, search is left-aligned via CSS — no position locking needed
|
|
7753
|
+
if (this.variant === 'card')
|
|
7754
|
+
return;
|
|
7755
|
+
const search = this.shadowRoot?.querySelector('.search');
|
|
7756
|
+
const searchField = search?.querySelector('.search-field');
|
|
7757
|
+
if (!search || !searchField)
|
|
7758
|
+
return;
|
|
7759
|
+
// Reset to flex centering
|
|
7760
|
+
search.style.justifyContent = 'center';
|
|
7761
|
+
searchField.style.marginLeft = '';
|
|
7762
|
+
requestAnimationFrame(() => {
|
|
7763
|
+
const searchRect = search.getBoundingClientRect();
|
|
7764
|
+
const fieldRect = searchField.getBoundingClientRect();
|
|
7765
|
+
// Calculate how far from the left of search container the field currently is
|
|
7766
|
+
const currentOffset = fieldRect.left - searchRect.left;
|
|
7767
|
+
// Lock position: switch to flex-start and use fixed margin
|
|
7768
|
+
search.style.justifyContent = 'flex-start';
|
|
7769
|
+
searchField.style.marginLeft = `${currentOffset}px`;
|
|
7770
|
+
// Mark as locked so pagination changes don't shift the search
|
|
7771
|
+
this._searchPositionLocked = true;
|
|
7772
|
+
});
|
|
7773
|
+
}
|
|
7774
|
+
// ----------------------------------------------------------------------------
|
|
7775
|
+
// Columns
|
|
7776
|
+
// ----------------------------------------------------------------------------
|
|
7777
|
+
_toggleColumnPicker() {
|
|
7778
|
+
this._columnPickerOpen = !this._columnPickerOpen;
|
|
7779
|
+
}
|
|
7780
|
+
_toggleColumn(columnId) {
|
|
7781
|
+
if (this._model.displayedColumns.includes(columnId)) {
|
|
7782
|
+
this._model.displayedColumns = this._model.displayedColumns.filter(id => id !== columnId);
|
|
7783
|
+
}
|
|
7784
|
+
else {
|
|
7785
|
+
this._model.displayedColumns = [...this._model.displayedColumns, columnId];
|
|
7786
|
+
}
|
|
7787
|
+
this.requestUpdate();
|
|
7788
|
+
}
|
|
7789
|
+
// Clear any existing text selection on mousedown so we only detect
|
|
7790
|
+
// selections made during this click gesture, not stale selections from elsewhere
|
|
7791
|
+
_handleRowMouseDown() {
|
|
7792
|
+
if (!this._model.rowClickable && !this._model.rowHref) {
|
|
7793
|
+
return;
|
|
7794
|
+
}
|
|
7795
|
+
window.getSelection()?.removeAllRanges();
|
|
7796
|
+
}
|
|
7797
|
+
_handleRowClick(e, row, rowIndex) {
|
|
7798
|
+
if (!this._model.rowClickable && !this._model.rowHref) {
|
|
7799
|
+
return;
|
|
7800
|
+
}
|
|
7801
|
+
const selection = window.getSelection();
|
|
7802
|
+
if (selection && selection.toString().length > 0) {
|
|
7803
|
+
e.preventDefault();
|
|
7804
|
+
return;
|
|
7805
|
+
}
|
|
7806
|
+
this.dispatchEvent(new CustomEvent('row-click', {
|
|
7807
|
+
detail: { row, rowIndex },
|
|
7808
|
+
bubbles: true,
|
|
7809
|
+
composed: true
|
|
7810
|
+
}));
|
|
7811
|
+
}
|
|
7812
|
+
// When a user toggles a column on via the column picker, it gets appended
|
|
7813
|
+
// to _displayedColumns. By mapping over _displayedColumns (not def.columns),
|
|
7814
|
+
// the new column appears at the right edge of the table instead of jumping
|
|
7815
|
+
// back to its original position in the column definition.
|
|
7816
|
+
// Actions columns are always moved to the end.
|
|
7817
|
+
getDisplayedColumns() {
|
|
7818
|
+
return this._model.displayedColumns
|
|
7819
|
+
.map(id => this._model.columns.find(col => col.id === id))
|
|
7820
|
+
.sort((a, b) => {
|
|
7821
|
+
if (a.type === 'actions' && b.type !== 'actions')
|
|
7822
|
+
return 1;
|
|
7823
|
+
if (a.type !== 'actions' && b.type === 'actions')
|
|
7824
|
+
return -1;
|
|
7825
|
+
return 0;
|
|
7826
|
+
});
|
|
7827
|
+
}
|
|
7828
|
+
// ----------------------------------------------------------------------------
|
|
7829
|
+
// Scrolling
|
|
7830
|
+
// ----------------------------------------------------------------------------
|
|
7831
|
+
/**
|
|
7832
|
+
* Scroll event handler that updates scroll flags in real-time as user scrolls.
|
|
7833
|
+
* Updates shadow indicators to show if more content exists left/right.
|
|
7834
|
+
*/
|
|
7835
|
+
_handleScroll(e) {
|
|
7836
|
+
const container = e.target;
|
|
7837
|
+
this._canScrollLeft = container.scrollLeft > 0;
|
|
7838
|
+
this._canScrollRight = container.scrollLeft < container.scrollWidth - container.clientWidth - 1;
|
|
7839
|
+
}
|
|
7840
|
+
/**
|
|
7841
|
+
* Updates scroll state flags for the table content container.
|
|
7842
|
+
* - _canScrollLeft: true if scrolled right (can scroll back left)
|
|
7843
|
+
* - _canScrollRight: true if more content exists to the right
|
|
7844
|
+
* - _canScrollHorizontal: true if content is wider than container
|
|
7845
|
+
* These flags control scroll shadow indicators and CSS classes.
|
|
7846
|
+
*/
|
|
7847
|
+
_updateScrollFlags() {
|
|
7848
|
+
const container = this.shadowRoot?.querySelector('.content');
|
|
7849
|
+
if (container) {
|
|
7850
|
+
this._canScrollLeft = container.scrollLeft > 0;
|
|
7851
|
+
this._canScrollRight = container.scrollWidth > container.clientWidth && container.scrollLeft < container.scrollWidth - container.clientWidth - 1;
|
|
7852
|
+
this._canScrollHorizontal = container.scrollWidth > container.clientWidth;
|
|
7853
|
+
}
|
|
7854
|
+
this.classList.toggle('kr-table--scroll-left-available', this._canScrollLeft);
|
|
7855
|
+
this.classList.toggle('kr-table--scroll-right-available', this._canScrollRight);
|
|
7856
|
+
this.classList.toggle('kr-table--scroll-horizontal-available', this._canScrollHorizontal);
|
|
7857
|
+
this.classList.toggle('kr-table--sticky-left', this.getDisplayedColumns().some(c => c.sticky === 'left'));
|
|
7858
|
+
this.classList.toggle('kr-table--sticky-right', this.getDisplayedColumns().some(c => c.sticky === 'right'));
|
|
7859
|
+
}
|
|
7860
|
+
// ----------------------------------------------------------------------------
|
|
7861
|
+
// Column Resizing
|
|
7862
|
+
// ----------------------------------------------------------------------------
|
|
7863
|
+
_handleResizeStart(e, columnId) {
|
|
7864
|
+
e.preventDefault();
|
|
7865
|
+
const headerCell = this.shadowRoot?.querySelector(`.header-cell[data-column-id="${columnId}"]`);
|
|
7866
|
+
this._resizing = {
|
|
7867
|
+
columnId,
|
|
7868
|
+
startX: e.clientX,
|
|
7869
|
+
startWidth: headerCell?.offsetWidth || 200
|
|
7870
|
+
};
|
|
7871
|
+
document.addEventListener('mousemove', this._handleResizeMove);
|
|
7872
|
+
document.addEventListener('mouseup', this._handleResizeEnd);
|
|
7873
|
+
}
|
|
7874
|
+
// ----------------------------------------------------------------------------
|
|
7875
|
+
// Sorting
|
|
7876
|
+
// ----------------------------------------------------------------------------
|
|
7877
|
+
_handleSortClick(e, column) {
|
|
7878
|
+
if (e.shiftKey) {
|
|
7879
|
+
// Multi-sort: add or cycle existing
|
|
7880
|
+
const existingIndex = this._sorts.findIndex(s => s.sortBy === column.id);
|
|
7881
|
+
if (existingIndex === -1) {
|
|
7882
|
+
this._sorts.push({ sortBy: column.id, sortDirection: 'asc' });
|
|
7883
|
+
}
|
|
7884
|
+
else {
|
|
7885
|
+
const existing = this._sorts[existingIndex];
|
|
7886
|
+
if (existing.sortDirection === 'asc') {
|
|
7887
|
+
existing.sortDirection = 'desc';
|
|
7888
|
+
}
|
|
7889
|
+
else {
|
|
7890
|
+
// on third click, remove sorting for the column
|
|
7891
|
+
this._sorts.splice(existingIndex, 1);
|
|
7892
|
+
}
|
|
7893
|
+
}
|
|
7894
|
+
this.requestUpdate();
|
|
7895
|
+
}
|
|
7896
|
+
else {
|
|
7897
|
+
// Single sort: replace all
|
|
7898
|
+
let existing = null;
|
|
7899
|
+
if (this._sorts.length === 1) {
|
|
7900
|
+
existing = this._sorts.find(s => s.sortBy === column.id);
|
|
7901
|
+
}
|
|
7902
|
+
if (!existing) {
|
|
7903
|
+
this._sorts = [{ sortBy: column.id, sortDirection: 'asc' }];
|
|
7904
|
+
}
|
|
7905
|
+
else if (existing.sortDirection === 'asc') {
|
|
7906
|
+
this._sorts = [{ sortBy: column.id, sortDirection: 'desc' }];
|
|
7907
|
+
}
|
|
7908
|
+
else {
|
|
7909
|
+
this._sorts = [];
|
|
7910
|
+
}
|
|
7911
|
+
}
|
|
7912
|
+
this._page = 1;
|
|
7913
|
+
this._fetch();
|
|
7914
|
+
}
|
|
7915
|
+
_renderSortIndicator(column) {
|
|
7916
|
+
if (!column.sortable) {
|
|
7917
|
+
return A;
|
|
7918
|
+
}
|
|
7919
|
+
const sortIndex = this._sorts.findIndex(s => s.sortBy === column.id);
|
|
7920
|
+
if (sortIndex === -1) {
|
|
7921
|
+
// Ghost arrow: visible only on hover via CSS
|
|
7922
|
+
return b `
|
|
7923
|
+
<span class="header-cell__sort" @click=${(e) => this._handleSortClick(e, column)}>
|
|
7924
|
+
<svg class="header-cell__sort-arrow header-cell__sort-arrow--ghost" viewBox="0 0 24 24" fill="currentColor">
|
|
7925
|
+
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
7926
|
+
</svg>
|
|
7927
|
+
</span>
|
|
7928
|
+
`;
|
|
7929
|
+
}
|
|
7930
|
+
let arrowStyle = {};
|
|
7931
|
+
if (this._sorts[sortIndex].sortDirection === 'desc') {
|
|
7932
|
+
arrowStyle = { transform: 'rotate(180deg)' };
|
|
7933
|
+
}
|
|
7934
|
+
return b `
|
|
7935
|
+
<span class="header-cell__sort" @click=${(e) => this._handleSortClick(e, column)}>
|
|
7936
|
+
<svg class="header-cell__sort-arrow" viewBox="0 0 24 24" fill="currentColor" style=${o$1(arrowStyle)}>
|
|
7937
|
+
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
7938
|
+
</svg>
|
|
7939
|
+
${this._sorts.length > 1 ? b `
|
|
7940
|
+
<span class="header-cell__sort-priority">${sortIndex + 1}</span>
|
|
7941
|
+
` : A}
|
|
7942
|
+
</span>
|
|
7943
|
+
`;
|
|
7944
|
+
}
|
|
7945
|
+
// ----------------------------------------------------------------------------
|
|
7946
|
+
// Header
|
|
7947
|
+
// ----------------------------------------------------------------------------
|
|
7948
|
+
_handleAction(action) {
|
|
7949
|
+
if (action.href) {
|
|
7950
|
+
return;
|
|
7951
|
+
}
|
|
7952
|
+
this.dispatchEvent(new CustomEvent('action', {
|
|
7953
|
+
detail: { action: action.id },
|
|
7954
|
+
bubbles: true,
|
|
7955
|
+
composed: true
|
|
7956
|
+
}));
|
|
7957
|
+
}
|
|
7958
|
+
// ----------------------------------------------------------------------------
|
|
7959
|
+
// Filter Handlers
|
|
7960
|
+
// ----------------------------------------------------------------------------
|
|
7961
|
+
_handleKqlChange(e, column) {
|
|
7962
|
+
const kql = e.target.value.trim();
|
|
7963
|
+
if (!kql) {
|
|
7964
|
+
column.filter.clear();
|
|
7965
|
+
this.requestUpdate();
|
|
7966
|
+
}
|
|
7967
|
+
else {
|
|
7968
|
+
column.filter.setKql(kql);
|
|
7969
|
+
this.requestUpdate();
|
|
7970
|
+
if (!column.filter.isValid()) {
|
|
7971
|
+
return;
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
this._page = 1;
|
|
7975
|
+
this._fetch();
|
|
7976
|
+
}
|
|
7977
|
+
_handleFilterPanelToggle(e, column) {
|
|
7978
|
+
e.stopPropagation();
|
|
7979
|
+
if (this._filterPanelOpened === column.id) {
|
|
7980
|
+
this._filterPanelOpened = null;
|
|
7981
|
+
}
|
|
7982
|
+
else {
|
|
7983
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
7984
|
+
let left = rect.left;
|
|
7985
|
+
if (left + 328 > window.innerWidth) {
|
|
7986
|
+
left = window.innerWidth - 328;
|
|
7987
|
+
}
|
|
7988
|
+
this._filterPanelPos = {
|
|
7989
|
+
top: rect.bottom + 4,
|
|
7990
|
+
left
|
|
7991
|
+
};
|
|
7992
|
+
this._filterPanelOpened = column.id;
|
|
7993
|
+
if (column.facetable) {
|
|
7994
|
+
this._filterPanelTab = 'counts';
|
|
7995
|
+
}
|
|
7996
|
+
else {
|
|
7997
|
+
this._filterPanelTab = 'filter';
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
_handleKqlClear(column) {
|
|
8002
|
+
column.filter.clear();
|
|
8003
|
+
this._page = 1;
|
|
8004
|
+
this._fetch();
|
|
8005
|
+
}
|
|
8006
|
+
_handleFilterClear() {
|
|
8007
|
+
const column = this._model.columns.find(c => c.id === this._filterPanelOpened);
|
|
8008
|
+
if (column) {
|
|
8009
|
+
column.filter.clear();
|
|
8010
|
+
if (column.facetable && !column.filterable) {
|
|
8011
|
+
column.filter.operator = 'in';
|
|
8012
|
+
column.filter.value = [];
|
|
8013
|
+
}
|
|
8014
|
+
}
|
|
8015
|
+
this._filterPanelOpened = null;
|
|
8016
|
+
this._page = 1;
|
|
8017
|
+
this._fetch();
|
|
8018
|
+
}
|
|
8019
|
+
_handleFilterTextKeydown(e, column) {
|
|
8020
|
+
if (e.key === 'Enter') {
|
|
8021
|
+
e.preventDefault();
|
|
8022
|
+
this._handleFilterApply();
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
_handleOperatorChange(e, column) {
|
|
8026
|
+
column.filter.setOperator(e.target.value);
|
|
8027
|
+
this.requestUpdate();
|
|
8028
|
+
}
|
|
8029
|
+
_handleFilterStringChange(e, column) {
|
|
8030
|
+
column.filter.setValue(e.target.value);
|
|
8031
|
+
this.requestUpdate();
|
|
8032
|
+
}
|
|
8033
|
+
_handleFilterNumberChange(e, column) {
|
|
8034
|
+
column.filter.setValue(Number(e.target.value));
|
|
8035
|
+
this.requestUpdate();
|
|
8036
|
+
}
|
|
8037
|
+
_handleFilterDateChange(e, column) {
|
|
8038
|
+
column.filter.setValue(new Date(e.target.value), 'day');
|
|
8039
|
+
this.requestUpdate();
|
|
8040
|
+
}
|
|
8041
|
+
_handleFilterBooleanChange(e, column) {
|
|
8042
|
+
column.filter.setValue(e.target.value === 'true');
|
|
8043
|
+
this.requestUpdate();
|
|
8044
|
+
}
|
|
8045
|
+
_handleFilterDateStartChange(e, column) {
|
|
8046
|
+
column.filter.setStart(new Date(e.target.value), 'day');
|
|
8047
|
+
this.requestUpdate();
|
|
8048
|
+
}
|
|
8049
|
+
_handleFilterDateEndChange(e, column) {
|
|
8050
|
+
column.filter.setEnd(new Date(e.target.value), 'day');
|
|
8051
|
+
this.requestUpdate();
|
|
8052
|
+
}
|
|
8053
|
+
_handleFilterNumberStartChange(e, column) {
|
|
8054
|
+
column.filter.setStart(Number(e.target.value));
|
|
8055
|
+
this.requestUpdate();
|
|
8056
|
+
}
|
|
8057
|
+
_handleFilterNumberEndChange(e, column) {
|
|
8058
|
+
column.filter.setEnd(Number(e.target.value));
|
|
8059
|
+
this.requestUpdate();
|
|
8060
|
+
}
|
|
8061
|
+
_handleFilterListChange(e, column) {
|
|
8062
|
+
const items = e.target.value.split(',').map((v) => v.trim()).filter((v) => v !== '');
|
|
8063
|
+
if (column.type === 'number') {
|
|
8064
|
+
column.filter.setValue(items.map((v) => Number(v)));
|
|
8065
|
+
}
|
|
8066
|
+
else {
|
|
8067
|
+
column.filter.setValue(items);
|
|
8068
|
+
}
|
|
8069
|
+
this.requestUpdate();
|
|
8070
|
+
}
|
|
8071
|
+
_handleFilterApply() {
|
|
8072
|
+
this._filterPanelOpened = null;
|
|
8073
|
+
this._page = 1;
|
|
8074
|
+
this._fetch();
|
|
8075
|
+
}
|
|
8076
|
+
_handleFilterPanelTabChange(e) {
|
|
8077
|
+
this._filterPanelTab = e.detail.activeTabId;
|
|
8078
|
+
}
|
|
8079
|
+
_handleBucketToggle(e, column, bucket) {
|
|
8080
|
+
column.filter.toggle(bucket.val);
|
|
8081
|
+
this._page = 1;
|
|
8082
|
+
this._fetch();
|
|
8083
|
+
}
|
|
8084
|
+
// ----------------------------------------------------------------------------
|
|
8085
|
+
// Rendering
|
|
8086
|
+
// ----------------------------------------------------------------------------
|
|
8087
|
+
_renderCellContent(column, row, rowIndex) {
|
|
8088
|
+
const value = row[column.id];
|
|
8089
|
+
if (column.render) {
|
|
8090
|
+
// Use slot to project content from light DOM so external styles apply
|
|
8091
|
+
return b `<slot name="cell-${rowIndex}-${column.id}"></slot>`;
|
|
8092
|
+
}
|
|
8093
|
+
if (value === null || value === undefined) {
|
|
8094
|
+
return '';
|
|
8095
|
+
}
|
|
8096
|
+
switch (column.type) {
|
|
8097
|
+
case 'number':
|
|
8098
|
+
if (column.format === 'currency' && typeof value === 'number') {
|
|
8099
|
+
return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
|
8100
|
+
}
|
|
8101
|
+
return String(value);
|
|
8102
|
+
case 'date': {
|
|
8103
|
+
let date;
|
|
8104
|
+
if (value instanceof Date) {
|
|
8105
|
+
date = value;
|
|
8106
|
+
}
|
|
8107
|
+
else if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(value)) {
|
|
8108
|
+
// MySQL datetime format (UTC): "2026-01-28 01:33:44:517"
|
|
8109
|
+
// Replace last colon before ms with dot, append Z for UTC
|
|
8110
|
+
const isoString = value.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/, '$1.$2').replace(' ', 'T') + 'Z';
|
|
8111
|
+
date = new Date(isoString);
|
|
8112
|
+
}
|
|
8113
|
+
else {
|
|
8114
|
+
date = new Date(value);
|
|
8115
|
+
}
|
|
8116
|
+
// Show date and time for datetime values in UTC
|
|
8117
|
+
return date.toLocaleString(undefined, {
|
|
8118
|
+
year: 'numeric', month: 'short', day: 'numeric',
|
|
8119
|
+
hour: 'numeric', minute: '2-digit',
|
|
8120
|
+
timeZone: 'UTC'
|
|
8121
|
+
});
|
|
8122
|
+
}
|
|
8123
|
+
case 'boolean':
|
|
8124
|
+
if (value === true)
|
|
8125
|
+
return 'Yes';
|
|
8126
|
+
if (value === false)
|
|
8127
|
+
return 'No';
|
|
8128
|
+
return '';
|
|
8129
|
+
default:
|
|
8130
|
+
return String(value);
|
|
8131
|
+
}
|
|
8132
|
+
}
|
|
8133
|
+
/**
|
|
8134
|
+
* Returns CSS classes for a header cell based on column config.
|
|
8135
|
+
*/
|
|
8136
|
+
_getHeaderCellClasses(column, index) {
|
|
8137
|
+
return {
|
|
8138
|
+
'header-cell': true,
|
|
8139
|
+
'header-cell--sortable': !!column.sortable,
|
|
8140
|
+
'header-cell--align-center': column.align === 'center',
|
|
8141
|
+
'header-cell--align-right': column.align === 'right',
|
|
8142
|
+
'header-cell--sticky-left': column.sticky === 'left',
|
|
8143
|
+
'header-cell--sticky-left-last': column.sticky === 'left' &&
|
|
8144
|
+
!this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'),
|
|
8145
|
+
'header-cell--sticky-right': column.sticky === 'right',
|
|
8146
|
+
'header-cell--sticky-right-first': column.sticky === 'right' &&
|
|
8147
|
+
!this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right')
|
|
8148
|
+
};
|
|
8149
|
+
}
|
|
8150
|
+
/**
|
|
8151
|
+
* Returns CSS classes for a table cell based on column config:
|
|
8152
|
+
* - Alignment (center, right)
|
|
8153
|
+
* - Sticky positioning (left, right)
|
|
8154
|
+
* - Border classes for the last left-sticky or first right-sticky column
|
|
8155
|
+
*/
|
|
8156
|
+
_getCellClasses(column, index) {
|
|
8157
|
+
return {
|
|
8158
|
+
'cell': true,
|
|
8159
|
+
'cell--actions': column.type === 'actions',
|
|
8160
|
+
'cell--align-center': column.align === 'center',
|
|
8161
|
+
'cell--align-right': column.align === 'right',
|
|
8162
|
+
'cell--sticky-left': column.sticky === 'left',
|
|
8163
|
+
'cell--sticky-left-last': column.sticky === 'left' &&
|
|
8164
|
+
!this.getDisplayedColumns().slice(index + 1).some(c => c.sticky === 'left'),
|
|
8165
|
+
'cell--sticky-right': column.sticky === 'right',
|
|
8166
|
+
'cell--sticky-right-first': column.sticky === 'right' &&
|
|
8167
|
+
!this.getDisplayedColumns().slice(0, index).some(c => c.sticky === 'right')
|
|
8168
|
+
};
|
|
8169
|
+
}
|
|
8170
|
+
/**
|
|
8171
|
+
* Returns inline styles for a table cell:
|
|
8172
|
+
* - Width (from column config or default 150px)
|
|
8173
|
+
* - Min-width (if specified)
|
|
8174
|
+
* - Left/right offset for sticky columns (calculated from widths of preceding sticky columns)
|
|
8175
|
+
*/
|
|
8176
|
+
_getCellStyle(column, index) {
|
|
8177
|
+
const styles = {};
|
|
8178
|
+
if (column.sticky === 'left') {
|
|
8179
|
+
let leftOffset = 0;
|
|
8180
|
+
for (let i = 0; i < index; i++) {
|
|
8181
|
+
const col = this.getDisplayedColumns()[i];
|
|
8182
|
+
if (col.sticky === 'left') {
|
|
8183
|
+
leftOffset += parseInt(col.width || '0', 10);
|
|
8184
|
+
}
|
|
8185
|
+
}
|
|
8186
|
+
styles.left = `${leftOffset}px`;
|
|
8187
|
+
}
|
|
8188
|
+
if (column.sticky === 'right') {
|
|
8189
|
+
let rightOffset = 0;
|
|
8190
|
+
for (let i = index + 1; i < this.getDisplayedColumns().length; i++) {
|
|
8191
|
+
const col = this.getDisplayedColumns()[i];
|
|
8192
|
+
if (col.sticky === 'right') {
|
|
8193
|
+
rightOffset += parseInt(col.width || '0', 10);
|
|
8194
|
+
}
|
|
8195
|
+
}
|
|
8196
|
+
styles.right = `${rightOffset}px`;
|
|
8197
|
+
}
|
|
8198
|
+
return styles;
|
|
8199
|
+
}
|
|
8200
|
+
/**
|
|
8201
|
+
* Renders the pagination controls:
|
|
8202
|
+
* - Previous page arrow (disabled on first page)
|
|
8203
|
+
* - Range text showing "1-50 of 150" format
|
|
8204
|
+
* - Next page arrow (disabled on last page)
|
|
8205
|
+
*
|
|
8206
|
+
* Hidden when there's no data or all data fits on one page.
|
|
8207
|
+
*/
|
|
8208
|
+
_renderPagination() {
|
|
8209
|
+
const start = (this._page - 1) * this._pageSize + 1;
|
|
8210
|
+
const end = Math.min(this._page * this._pageSize, this._totalItems);
|
|
8211
|
+
return b `
|
|
8212
|
+
<div class="pagination">
|
|
8213
|
+
<span
|
|
8214
|
+
class="pagination-icon ${this._page === 1 ? 'pagination-icon--disabled' : ''}"
|
|
8215
|
+
@click=${this.goToPrevPage}
|
|
8216
|
+
>
|
|
8217
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
|
8218
|
+
</span>
|
|
8219
|
+
<span class="pagination-info">${start}-${end} of ${this._totalItems}</span>
|
|
8220
|
+
<span
|
|
8221
|
+
class="pagination-icon ${this._page === this._totalPages ? 'pagination-icon--disabled' : ''}"
|
|
8222
|
+
@click=${this.goToNextPage}
|
|
8223
|
+
>
|
|
8224
|
+
<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>
|
|
8225
|
+
</span>
|
|
8226
|
+
</div>
|
|
8227
|
+
`;
|
|
8228
|
+
}
|
|
8229
|
+
/** Renders the card title block (title + description) above the toolbar in card mode. */
|
|
8230
|
+
_renderCardHeader() {
|
|
8231
|
+
if (this.variant !== 'card')
|
|
8232
|
+
return A;
|
|
8233
|
+
if (!this._model.title && !this._model.description)
|
|
8234
|
+
return A;
|
|
8235
|
+
return b `
|
|
8236
|
+
<div class="card-header">
|
|
8237
|
+
${this._model.title ? b `<h2 class="card-header__title">${this._model.title}</h2>` : A}
|
|
8238
|
+
${this._model.description ? b `<p class="card-header__description">${this._model.description}</p>` : A}
|
|
8239
|
+
</div>
|
|
8240
|
+
`;
|
|
8241
|
+
}
|
|
8242
|
+
/**
|
|
8243
|
+
* Renders the header toolbar containing:
|
|
8244
|
+
* - Title (left, default variant only)
|
|
8245
|
+
* - Search bar with view selector dropdown (center, or left-aligned in card variant)
|
|
8246
|
+
* - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown
|
|
8247
|
+
*
|
|
8248
|
+
* Hidden when there's no title, no actions, and data fits on one page.
|
|
8249
|
+
*/
|
|
8250
|
+
_renderHeader() {
|
|
8251
|
+
if (!this._model.title && !this._model.actions?.length && this._totalPages <= 1) {
|
|
8252
|
+
return A;
|
|
8253
|
+
}
|
|
8254
|
+
return b `
|
|
8255
|
+
<div class="header">
|
|
8256
|
+
${this._model.title && this.variant !== 'card' ? b `<div class="title">${this._model.title}</div>` : A}
|
|
8257
|
+
${this._model.dataSource?.mode === 'db' && !this._model.columns.some(col => col.searchable) ? b `<div class="search"></div>` : b `
|
|
8258
|
+
<div class="search">
|
|
8259
|
+
<!-- TODO: Saved views dropdown
|
|
8260
|
+
<div class="views">
|
|
8261
|
+
<span>Default View</span>
|
|
8262
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>
|
|
8263
|
+
</div>
|
|
8264
|
+
-->
|
|
8265
|
+
<div class="search-field">
|
|
8266
|
+
<svg class="search-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>
|
|
8267
|
+
<input
|
|
8268
|
+
type="text"
|
|
8269
|
+
class="search-input"
|
|
8270
|
+
placeholder="Search..."
|
|
8271
|
+
.value=${this._searchQuery}
|
|
8272
|
+
@input=${this._handleSearch}
|
|
8273
|
+
/>
|
|
8274
|
+
</div>
|
|
8275
|
+
</div>
|
|
8276
|
+
`}
|
|
8277
|
+
<div class="tools">
|
|
8278
|
+
${this._renderPagination()}
|
|
8279
|
+
<span class="refresh" title="Refresh" @click=${() => this.refresh()}>
|
|
8280
|
+
<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"/></svg>
|
|
8281
|
+
</span>
|
|
8282
|
+
<div class="column-picker-wrapper">
|
|
8283
|
+
<span class="header-icon" title="Columns" @click=${this._toggleColumnPicker}>
|
|
8284
|
+
<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"/></svg>
|
|
8285
|
+
</span>
|
|
8286
|
+
<div class="column-picker ${this._columnPickerOpen ? 'open' : ''}">
|
|
8287
|
+
${[...this._model.columns].filter(col => col.type !== 'actions').sort((a, b) => (a.label ?? a.id).localeCompare(b.label ?? b.id)).map(col => b `
|
|
8288
|
+
<div class="column-picker-item" @click=${() => this._toggleColumn(col.id)}>
|
|
8289
|
+
<div class="column-picker-checkbox ${this._model.displayedColumns.includes(col.id) ? 'checked' : ''}">
|
|
8290
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>
|
|
8291
|
+
</div>
|
|
8292
|
+
<span class="column-picker-label">${col.label ?? col.id}</span>
|
|
8293
|
+
</div>
|
|
8294
|
+
`)}
|
|
8295
|
+
</div>
|
|
8296
|
+
</div>
|
|
8297
|
+
${this._model.actions?.length === 1 ? b `
|
|
8298
|
+
<kr-button
|
|
8299
|
+
class="actions"
|
|
8300
|
+
.href=${this._model.actions[0].href}
|
|
8301
|
+
.target=${this._model.actions[0].target}
|
|
8302
|
+
@click=${() => this._handleAction(this._model.actions[0])}
|
|
8303
|
+
>
|
|
8304
|
+
${this._model.actions[0].label}
|
|
8305
|
+
</kr-button>
|
|
8306
|
+
` : this._model.actions?.length ? b `
|
|
8307
|
+
<kr-button
|
|
8308
|
+
class="actions"
|
|
8309
|
+
.options=${this._model.actions.map(a => ({ id: a.id, label: a.label }))}
|
|
8310
|
+
@option-select=${(e) => this._handleAction({ id: e.detail.id, label: e.detail.label })}
|
|
8311
|
+
>
|
|
8312
|
+
Actions
|
|
8313
|
+
</kr-button>
|
|
8314
|
+
` : A}
|
|
8315
|
+
</div>
|
|
8316
|
+
</div>
|
|
8317
|
+
`;
|
|
8318
|
+
}
|
|
8319
|
+
/** Renders status message (loading, error, empty) */
|
|
8320
|
+
_renderStatus() {
|
|
8321
|
+
if (this._dataState === 'loading' && this._data.length === 0) {
|
|
8322
|
+
return b `<div class="status">Loading...</div>`;
|
|
8323
|
+
}
|
|
8324
|
+
if (this._dataState === 'error' && this._data.length === 0) {
|
|
8325
|
+
return b `<div class="status status--error">Error loading data</div>`;
|
|
8326
|
+
}
|
|
8327
|
+
if (this._data.length === 0) {
|
|
8328
|
+
return b `<div class="status">No data available</div>`;
|
|
8329
|
+
}
|
|
8330
|
+
return A;
|
|
8331
|
+
}
|
|
8332
|
+
_renderFilterPanel() {
|
|
8333
|
+
if (!this._filterPanelOpened) {
|
|
8334
|
+
return A;
|
|
8335
|
+
}
|
|
8336
|
+
const column = this._model.columns.find(c => c.id === this._filterPanelOpened);
|
|
8337
|
+
// Build filter content (operator + value input)
|
|
8338
|
+
let valueInput = b ``;
|
|
8339
|
+
if (column.filter.operator === 'empty' || column.filter.operator === 'n_empty') {
|
|
8340
|
+
valueInput = b `
|
|
8341
|
+
<input
|
|
8342
|
+
type="text"
|
|
8343
|
+
class="filter-panel__input"
|
|
8344
|
+
disabled
|
|
8345
|
+
.value=${column.filter.text}
|
|
8346
|
+
/>
|
|
8347
|
+
`;
|
|
8348
|
+
}
|
|
8349
|
+
else if (column.filter.operator === 'between' && column.type === 'date') {
|
|
8350
|
+
valueInput = b `
|
|
8351
|
+
<input
|
|
8352
|
+
type="date"
|
|
8353
|
+
class="filter-panel__input"
|
|
8354
|
+
.valueAsDate=${column.filter.value?.start ?? null}
|
|
8355
|
+
@change=${(e) => this._handleFilterDateStartChange(e, column)}
|
|
8356
|
+
/>
|
|
8357
|
+
<input
|
|
8358
|
+
type="date"
|
|
8359
|
+
class="filter-panel__input"
|
|
8360
|
+
.valueAsDate=${column.filter.value?.end ?? null}
|
|
8361
|
+
@change=${(e) => this._handleFilterDateEndChange(e, column)}
|
|
8362
|
+
/>
|
|
8363
|
+
`;
|
|
8364
|
+
}
|
|
8365
|
+
else if (column.filter.operator === 'between' && column.type === 'number') {
|
|
8366
|
+
valueInput = b `
|
|
8367
|
+
<input
|
|
8368
|
+
type="number"
|
|
8369
|
+
class="filter-panel__input"
|
|
8370
|
+
placeholder="Start"
|
|
8371
|
+
.value=${column.filter.value?.start ?? ''}
|
|
8372
|
+
@input=${(e) => this._handleFilterNumberStartChange(e, column)}
|
|
8373
|
+
@keydown=${(e) => this._handleFilterTextKeydown(e, column)}
|
|
8374
|
+
/>
|
|
8375
|
+
<input
|
|
8376
|
+
type="number"
|
|
8377
|
+
class="filter-panel__input"
|
|
8378
|
+
placeholder="End"
|
|
8379
|
+
.value=${column.filter.value?.end ?? ''}
|
|
8380
|
+
@input=${(e) => this._handleFilterNumberEndChange(e, column)}
|
|
8381
|
+
@keydown=${(e) => this._handleFilterTextKeydown(e, column)}
|
|
8382
|
+
/>
|
|
8383
|
+
`;
|
|
8384
|
+
}
|
|
8385
|
+
else if (column.filter.operator === 'in' || column.filter.operator === 'n_in') {
|
|
8386
|
+
valueInput = b `
|
|
8387
|
+
<textarea
|
|
8388
|
+
class="filter-panel__textarea"
|
|
8389
|
+
rows="3"
|
|
8390
|
+
placeholder="Values (comma-separated)"
|
|
8391
|
+
.value=${column.filter.text}
|
|
8392
|
+
@input=${(e) => this._handleFilterListChange(e, column)}
|
|
8393
|
+
@keydown=${(e) => this._handleFilterTextKeydown(e, column)}
|
|
8394
|
+
></textarea>
|
|
8395
|
+
`;
|
|
8396
|
+
}
|
|
8397
|
+
else if (column.type === 'boolean') {
|
|
8398
|
+
valueInput = b `
|
|
8399
|
+
<kr-select-field
|
|
8400
|
+
placeholder="Value"
|
|
8401
|
+
.value=${String(column.filter.value ?? '')}
|
|
8402
|
+
@change=${(e) => this._handleFilterBooleanChange(e, column)}
|
|
8403
|
+
>
|
|
8404
|
+
<kr-select-option value="true">Yes</kr-select-option>
|
|
8405
|
+
<kr-select-option value="false">No</kr-select-option>
|
|
8406
|
+
</kr-select-field>
|
|
8407
|
+
`;
|
|
8408
|
+
}
|
|
8409
|
+
else if (column.type === 'date') {
|
|
8410
|
+
valueInput = b `
|
|
8411
|
+
<input
|
|
8412
|
+
type="date"
|
|
8413
|
+
class="filter-panel__input"
|
|
8414
|
+
.valueAsDate=${column.filter.value}
|
|
8415
|
+
@change=${(e) => this._handleFilterDateChange(e, column)}
|
|
8416
|
+
/>
|
|
8417
|
+
`;
|
|
8418
|
+
}
|
|
8419
|
+
else if (column.type === 'number') {
|
|
8420
|
+
valueInput = b `
|
|
8421
|
+
<input
|
|
8422
|
+
type="number"
|
|
8423
|
+
class="filter-panel__input"
|
|
8424
|
+
placeholder="Value"
|
|
8425
|
+
min="0"
|
|
8426
|
+
.value=${column.filter.text}
|
|
8427
|
+
@input=${(e) => this._handleFilterNumberChange(e, column)}
|
|
8428
|
+
@keydown=${(e) => this._handleFilterTextKeydown(e, column)}
|
|
8429
|
+
/>
|
|
8430
|
+
`;
|
|
8431
|
+
}
|
|
8432
|
+
else {
|
|
8433
|
+
valueInput = b `
|
|
8434
|
+
<input
|
|
8435
|
+
type="text"
|
|
8436
|
+
class="filter-panel__input"
|
|
8437
|
+
placeholder="Value"
|
|
8438
|
+
.value=${column.filter.text}
|
|
8439
|
+
@input=${(e) => this._handleFilterStringChange(e, column)}
|
|
8440
|
+
@keydown=${(e) => this._handleFilterTextKeydown(e, column)}
|
|
8441
|
+
/>
|
|
8442
|
+
`;
|
|
8443
|
+
}
|
|
8444
|
+
const filterContent = b `
|
|
8445
|
+
<div class="filter-panel__content">
|
|
8446
|
+
<kr-select-field
|
|
8447
|
+
.value=${column.filter.operator}
|
|
8448
|
+
@change=${(e) => this._handleOperatorChange(e, column)}
|
|
8449
|
+
>
|
|
8450
|
+
${getOperatorsForType(column.type).map(op => b `
|
|
8451
|
+
<kr-select-option value=${op.key}>${op.label}</kr-select-option>
|
|
8452
|
+
`)}
|
|
8453
|
+
</kr-select-field>
|
|
8454
|
+
${valueInput}
|
|
8455
|
+
</div>
|
|
8456
|
+
`;
|
|
8457
|
+
// Build bucket list content
|
|
8458
|
+
const buckets = this._buckets.get(column.id) || [];
|
|
8459
|
+
let bucketContent;
|
|
8460
|
+
if (!buckets.length) {
|
|
8461
|
+
bucketContent = b `<div class="bucket-empty">No data</div>`;
|
|
8462
|
+
}
|
|
8463
|
+
else {
|
|
8464
|
+
bucketContent = b `
|
|
8465
|
+
<div class="buckets">
|
|
8466
|
+
${buckets.map(bucket => {
|
|
8467
|
+
let bucketLabel = '(Empty)';
|
|
8468
|
+
if (bucket.val !== null && bucket.val !== undefined) {
|
|
8469
|
+
if (column.type === 'boolean') {
|
|
8470
|
+
if (bucket.val === true || bucket.val === 'true') {
|
|
8471
|
+
bucketLabel = 'Yes';
|
|
8472
|
+
}
|
|
8473
|
+
else {
|
|
8474
|
+
bucketLabel = 'No';
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
else {
|
|
8478
|
+
bucketLabel = String(bucket.val);
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
// When using n_in, the user sees all buckets checked by default and unchecks
|
|
8482
|
+
// the ones they want to hide. Under the hood, has() returns true for values
|
|
8483
|
+
// in the exclusion list, so we invert the check state for n_in.
|
|
8484
|
+
let checked = column.filter.has(bucket.val);
|
|
8485
|
+
if (column.filter.operator === 'n_in') {
|
|
8486
|
+
checked = !checked;
|
|
8487
|
+
}
|
|
8488
|
+
let checkIcon = A;
|
|
8489
|
+
if (checked) {
|
|
8490
|
+
checkIcon = b `
|
|
8491
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
8492
|
+
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
8493
|
+
</svg>
|
|
8494
|
+
`;
|
|
8495
|
+
}
|
|
8496
|
+
return b `
|
|
8497
|
+
<div
|
|
8498
|
+
class="bucket"
|
|
8499
|
+
@click=${(e) => this._handleBucketToggle(e, column, bucket)}
|
|
8500
|
+
>
|
|
8501
|
+
<div class=${e$1({
|
|
8502
|
+
'bucket__checkbox': true,
|
|
8503
|
+
'bucket__checkbox--checked': checked
|
|
8504
|
+
})}>
|
|
8505
|
+
${checkIcon}
|
|
8506
|
+
</div>
|
|
8507
|
+
<span class="bucket__label">${bucketLabel}</span>
|
|
8508
|
+
<span class="bucket__count">${bucket.count}</span>
|
|
8509
|
+
</div>
|
|
8510
|
+
`;
|
|
8511
|
+
})}
|
|
8512
|
+
</div>
|
|
8513
|
+
`;
|
|
8514
|
+
}
|
|
8515
|
+
// Build panel body — tabs if both filterable+facetable, otherwise just the relevant content
|
|
8516
|
+
let panelBody;
|
|
8517
|
+
if (column.facetable && column.filterable) {
|
|
8518
|
+
panelBody = b `
|
|
8519
|
+
<kr-tab-group
|
|
8520
|
+
size="small"
|
|
8521
|
+
active-tab-id=${this._filterPanelTab}
|
|
8522
|
+
@tab-change=${(e) => this._handleFilterPanelTabChange(e)}
|
|
8523
|
+
>
|
|
8524
|
+
<kr-tab id="filter" label="Filter">
|
|
8525
|
+
${filterContent}
|
|
8526
|
+
</kr-tab>
|
|
8527
|
+
<kr-tab id="counts" label="Counts">
|
|
8528
|
+
${bucketContent}
|
|
8529
|
+
</kr-tab>
|
|
8530
|
+
</kr-tab-group>
|
|
8531
|
+
`;
|
|
8532
|
+
}
|
|
8533
|
+
else if (column.facetable) {
|
|
8534
|
+
panelBody = bucketContent;
|
|
8535
|
+
}
|
|
8536
|
+
else {
|
|
8537
|
+
panelBody = filterContent;
|
|
8538
|
+
}
|
|
8539
|
+
return b `
|
|
8540
|
+
<div
|
|
8541
|
+
class="filter-panel"
|
|
8542
|
+
style=${o$1({
|
|
8543
|
+
top: this._filterPanelPos.top + 'px',
|
|
8544
|
+
left: this._filterPanelPos.left + 'px'
|
|
8545
|
+
})}
|
|
8546
|
+
>
|
|
8547
|
+
${panelBody}
|
|
8548
|
+
<div class="filter-panel__actions">
|
|
8549
|
+
<kr-button variant="outline" color="secondary" size="small" @click=${this._handleFilterClear}>
|
|
8550
|
+
Clear
|
|
8551
|
+
</kr-button>
|
|
8552
|
+
<kr-button size="small" @click=${this._handleFilterApply}>
|
|
8553
|
+
Apply
|
|
8554
|
+
</kr-button>
|
|
8555
|
+
</div>
|
|
8556
|
+
</div>
|
|
8557
|
+
`;
|
|
8558
|
+
}
|
|
8559
|
+
/**
|
|
8560
|
+
* Renders filter row below column headers.
|
|
8561
|
+
* Only displays for columns with filterable: true.
|
|
8562
|
+
*/
|
|
8563
|
+
_renderFilterRow() {
|
|
8564
|
+
const columns = this.getDisplayedColumns();
|
|
8565
|
+
if (!columns.some(col => col.filterable || col.facetable)) {
|
|
8566
|
+
return A;
|
|
8567
|
+
}
|
|
8568
|
+
return b `
|
|
8569
|
+
<div class="filter-row">
|
|
8570
|
+
${columns.map((col, i) => {
|
|
8571
|
+
if (!col.filterable && !col.facetable) {
|
|
8572
|
+
return b `<div
|
|
8573
|
+
class=${e$1({
|
|
8574
|
+
'filter-cell': true,
|
|
8575
|
+
'filter-cell--sticky-left': col.sticky === 'left',
|
|
8576
|
+
'filter-cell--sticky-right': col.sticky === 'right',
|
|
8577
|
+
'filter-cell--sticky-right-first': col.sticky === 'right' &&
|
|
8578
|
+
!columns.slice(0, i).some((c) => c.sticky === 'right')
|
|
8579
|
+
})}
|
|
8580
|
+
style=${o$1(this._getCellStyle(col, i))}
|
|
8581
|
+
></div>`;
|
|
8582
|
+
}
|
|
8583
|
+
return b `
|
|
8584
|
+
<div
|
|
8585
|
+
class=${e$1({
|
|
8586
|
+
'filter-cell': true,
|
|
8587
|
+
'filter-cell--sticky-left': col.sticky === 'left',
|
|
8588
|
+
'filter-cell--sticky-right': col.sticky === 'right',
|
|
8589
|
+
'filter-cell--sticky-right-first': col.sticky === 'right' &&
|
|
8590
|
+
!columns.slice(0, i).some((c) => c.sticky === 'right')
|
|
8591
|
+
})}
|
|
8592
|
+
style=${o$1(this._getCellStyle(col, i))}
|
|
8593
|
+
>
|
|
8594
|
+
<div class="filter-cell__wrapper">
|
|
8595
|
+
<input
|
|
8596
|
+
type="text"
|
|
8597
|
+
class=${e$1({
|
|
8598
|
+
'filter-cell__input': true,
|
|
8599
|
+
'filter-cell__input--invalid': !col.filter.isValid()
|
|
8600
|
+
})}
|
|
8601
|
+
.value=${col.filter.kql}
|
|
8602
|
+
@change=${(e) => this._handleKqlChange(e, col)}
|
|
8603
|
+
/>
|
|
8604
|
+
${col.filter?.kql?.length > 0 ? b `
|
|
8605
|
+
<button
|
|
8606
|
+
class="filter-cell__clear"
|
|
8607
|
+
@click=${() => this._handleKqlClear(col)}
|
|
8608
|
+
>
|
|
8609
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
8610
|
+
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
8611
|
+
</svg>
|
|
8612
|
+
</button>
|
|
8613
|
+
` : A}
|
|
8614
|
+
<button
|
|
8615
|
+
class=${e$1({
|
|
8616
|
+
'filter-cell__advanced': true,
|
|
8617
|
+
'filter-cell__advanced--opened': this._filterPanelOpened === col.id
|
|
8618
|
+
})}
|
|
8619
|
+
@click=${(e) => this._handleFilterPanelToggle(e, col)}
|
|
8620
|
+
>
|
|
8621
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
8622
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
8623
|
+
</svg>
|
|
8624
|
+
</button>
|
|
8625
|
+
</div>
|
|
8626
|
+
</div>
|
|
8627
|
+
`;
|
|
8628
|
+
})}
|
|
8629
|
+
</div>
|
|
8630
|
+
`;
|
|
8631
|
+
}
|
|
8632
|
+
/** Renders the scrollable data grid with column headers and rows. */
|
|
8633
|
+
_renderTable() {
|
|
8634
|
+
return b `
|
|
8635
|
+
<div class="wrapper">
|
|
8636
|
+
<div class="overlay-left"></div>
|
|
8637
|
+
<div class="overlay-right"></div>
|
|
8638
|
+
${this._renderStatus()}
|
|
8639
|
+
<div class="content" @scroll=${this._handleScroll}>
|
|
8640
|
+
<div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
|
|
8641
|
+
<div class="header-row">
|
|
8642
|
+
${this.getDisplayedColumns().map((col, i) => b `
|
|
8643
|
+
<div
|
|
8644
|
+
class=${e$1(this._getHeaderCellClasses(col, i))}
|
|
8645
|
+
style=${o$1(this._getCellStyle(col, i))}
|
|
8646
|
+
data-column-id=${col.id}
|
|
8647
|
+
>
|
|
8648
|
+
<span class="header-cell__label">${col.label ?? col.id}</span>
|
|
8649
|
+
${this._renderSortIndicator(col)}
|
|
8650
|
+
${col.resizable !== false ? b `<div
|
|
8651
|
+
class="header-cell__resize"
|
|
8652
|
+
@mousedown=${(e) => this._handleResizeStart(e, col.id)}
|
|
8653
|
+
></div>` : A}
|
|
8654
|
+
</div>
|
|
8655
|
+
`)}
|
|
8656
|
+
</div>
|
|
8657
|
+
${this._renderFilterRow()}
|
|
8658
|
+
${this._data.map((row, rowIndex) => {
|
|
8659
|
+
const cells = this.getDisplayedColumns().map((col, i) => b `
|
|
8660
|
+
<div
|
|
8661
|
+
class=${e$1(this._getCellClasses(col, i))}
|
|
8662
|
+
style=${o$1(this._getCellStyle(col, i))}
|
|
8663
|
+
data-column-id=${col.id}
|
|
8664
|
+
>
|
|
8665
|
+
${this._renderCellContent(col, row, rowIndex)}
|
|
8666
|
+
</div>
|
|
8667
|
+
`);
|
|
8668
|
+
if (this._model.rowHref) {
|
|
8669
|
+
return b `
|
|
8670
|
+
<a
|
|
8671
|
+
href=${this._model.rowHref(row)}
|
|
8672
|
+
draggable="false"
|
|
8673
|
+
class=${e$1({ 'row': true, 'row--clickable': true, 'row--link': true })}
|
|
8674
|
+
@mousedown=${() => this._handleRowMouseDown()}
|
|
8675
|
+
@click=${(e) => this._handleRowClick(e, row, rowIndex)}
|
|
8676
|
+
>${cells}</a>
|
|
8677
|
+
`;
|
|
8678
|
+
}
|
|
8679
|
+
return b `
|
|
8680
|
+
<div
|
|
8681
|
+
class=${e$1({ 'row': true, 'row--clickable': !!this._model.rowClickable })}
|
|
8682
|
+
@mousedown=${() => this._handleRowMouseDown()}
|
|
8683
|
+
@click=${(e) => this._handleRowClick(e, row, rowIndex)}
|
|
8684
|
+
>${cells}</div>
|
|
8685
|
+
`;
|
|
8686
|
+
})}
|
|
8687
|
+
</div>
|
|
8688
|
+
</div>
|
|
8689
|
+
</div>
|
|
8690
|
+
`;
|
|
8691
|
+
}
|
|
8692
|
+
/**
|
|
8693
|
+
* Renders a data table with:
|
|
8694
|
+
* - Header bar with title, search input with view selector, and tools (pagination, refresh, column visibility, actions dropdown)
|
|
8695
|
+
* - Scrollable grid with sticky header row and optional sticky left/right columns
|
|
8696
|
+
* - Loading, error message, or empty state when no data
|
|
8697
|
+
*/
|
|
8698
|
+
render() {
|
|
8699
|
+
if (!this._model.columns.length) {
|
|
8700
|
+
return b `<slot></slot>`;
|
|
8701
|
+
}
|
|
8702
|
+
return b `
|
|
8703
|
+
${this._renderCardHeader()}
|
|
8704
|
+
${this._renderHeader()}
|
|
8705
|
+
${this._renderTable()}
|
|
8706
|
+
${this._renderFilterPanel()}
|
|
8707
|
+
`;
|
|
8708
|
+
}
|
|
8709
|
+
};
|
|
8710
|
+
exports.KRGrid.styles = [krBaseCSS, i$5 `
|
|
8711
|
+
/* -------------------------------------------------------------------------
|
|
8712
|
+
* Host
|
|
8713
|
+
* ----------------------------------------------------------------------- */
|
|
8714
|
+
:host {
|
|
8715
|
+
display: flex;
|
|
8716
|
+
flex-direction: column;
|
|
8717
|
+
width: 100%;
|
|
8718
|
+
height: 100%;
|
|
8719
|
+
overflow: hidden;
|
|
8720
|
+
container-type: inline-size;
|
|
8721
|
+
}
|
|
8722
|
+
|
|
8723
|
+
/* -------------------------------------------------------------------------
|
|
8724
|
+
* Header
|
|
8725
|
+
* ----------------------------------------------------------------------- */
|
|
8726
|
+
.header {
|
|
8727
|
+
flex-shrink: 0;
|
|
8728
|
+
display: flex;
|
|
8729
|
+
align-items: center;
|
|
8730
|
+
gap: 16px;
|
|
8731
|
+
margin: 0 24px;
|
|
8732
|
+
height: 64px;
|
|
8733
|
+
border-bottom: 1px solid #e5e7eb;
|
|
8734
|
+
background: #fff;
|
|
8735
|
+
}
|
|
8736
|
+
|
|
8737
|
+
:host(.kr-table--scroll-edge) .header {
|
|
8738
|
+
border-bottom: none;
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8741
|
+
.title {
|
|
8742
|
+
font-size: 18px;
|
|
8743
|
+
font-weight: 600;
|
|
8744
|
+
color: #000;
|
|
8745
|
+
}
|
|
8746
|
+
|
|
8747
|
+
/* -------------------------------------------------------------------------
|
|
8748
|
+
* Content
|
|
8749
|
+
* ----------------------------------------------------------------------- */
|
|
8750
|
+
.wrapper {
|
|
8751
|
+
flex: 1;
|
|
8752
|
+
position: relative;
|
|
8753
|
+
overflow: hidden;
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8756
|
+
.content {
|
|
8757
|
+
height: 100%;
|
|
8758
|
+
overflow: auto;
|
|
8759
|
+
}
|
|
8760
|
+
|
|
8761
|
+
/* -------------------------------------------------------------------------
|
|
8762
|
+
* Search
|
|
8763
|
+
* ----------------------------------------------------------------------- */
|
|
8764
|
+
.search {
|
|
8765
|
+
flex: 1;
|
|
8766
|
+
display: flex;
|
|
8767
|
+
align-items: center;
|
|
8768
|
+
justify-content: center;
|
|
8769
|
+
min-width: 0;
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
/* In card mode, align search left instead of center */
|
|
8773
|
+
:host(.kr-table--card) .search {
|
|
8774
|
+
justify-content: flex-start;
|
|
8775
|
+
}
|
|
8776
|
+
|
|
8777
|
+
.search-field {
|
|
8778
|
+
width: 100%;
|
|
8779
|
+
max-width: 400px;
|
|
8780
|
+
position: relative;
|
|
8781
|
+
display: flex;
|
|
8782
|
+
align-items: center;
|
|
8783
|
+
border: 1px solid #00000038;
|
|
8784
|
+
border-radius: 18px;
|
|
8785
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
8786
|
+
}
|
|
8787
|
+
|
|
8788
|
+
.search-field:focus-within {
|
|
8789
|
+
border-color: #163052;
|
|
8790
|
+
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
8791
|
+
}
|
|
8792
|
+
|
|
8793
|
+
/* TODO: Uncomment when views dropdown is added
|
|
8794
|
+
.search-field:focus-within .views {
|
|
8795
|
+
border-color: #163052;
|
|
8796
|
+
}
|
|
8797
|
+
*/
|
|
8798
|
+
|
|
8799
|
+
.search-icon {
|
|
8800
|
+
position: absolute;
|
|
8801
|
+
left: 16px;
|
|
8802
|
+
width: 20px;
|
|
8803
|
+
height: 20px;
|
|
8804
|
+
color: #656871;
|
|
8805
|
+
pointer-events: none;
|
|
8806
|
+
}
|
|
8807
|
+
|
|
8808
|
+
.search-input {
|
|
8809
|
+
height: 36px;
|
|
8810
|
+
padding: 0 16px 0 42px;
|
|
8811
|
+
border: none;
|
|
8812
|
+
border-radius: 16px;
|
|
8813
|
+
font-size: 14px;
|
|
8814
|
+
font-weight: 400;
|
|
8815
|
+
font-family: inherit;
|
|
8816
|
+
color: #163052;
|
|
8817
|
+
background: transparent;
|
|
8818
|
+
outline: none;
|
|
8819
|
+
flex: 1;
|
|
8820
|
+
min-width: 0;
|
|
8821
|
+
width: 100%;
|
|
8822
|
+
}
|
|
8823
|
+
|
|
8824
|
+
.search-input::placeholder {
|
|
8825
|
+
color: #656871;
|
|
8826
|
+
font-weight: 400;
|
|
8827
|
+
}
|
|
8828
|
+
|
|
8829
|
+
.search-input:focus {
|
|
8830
|
+
outline: none;
|
|
8831
|
+
}
|
|
8832
|
+
|
|
8833
|
+
@container (max-width: 800px) {
|
|
8834
|
+
.search-field {
|
|
8835
|
+
max-width: 250px;
|
|
8836
|
+
}
|
|
8837
|
+
}
|
|
8838
|
+
|
|
8839
|
+
.views {
|
|
8840
|
+
display: flex;
|
|
8841
|
+
align-items: center;
|
|
8842
|
+
gap: 4px;
|
|
8843
|
+
height: 36px;
|
|
8844
|
+
padding: 0 16px;
|
|
8845
|
+
border: 1px solid #00000038;
|
|
8846
|
+
border-right: none;
|
|
8847
|
+
border-radius: 16px 0 0 16px;
|
|
8848
|
+
font-size: 14px;
|
|
8849
|
+
font-family: inherit;
|
|
8850
|
+
color: #163052;
|
|
8851
|
+
background: transparent;
|
|
8852
|
+
cursor: pointer;
|
|
8853
|
+
white-space: nowrap;
|
|
8854
|
+
transition: border-color 0.2s;
|
|
8855
|
+
}
|
|
8856
|
+
|
|
8857
|
+
.views:hover {
|
|
8858
|
+
background: #e8f0f8;
|
|
8859
|
+
}
|
|
8860
|
+
|
|
8861
|
+
.views svg {
|
|
8862
|
+
width: 16px;
|
|
8863
|
+
height: 16px;
|
|
8864
|
+
color: #163052;
|
|
8865
|
+
}
|
|
8866
|
+
|
|
8867
|
+
/* -------------------------------------------------------------------------
|
|
8868
|
+
* Pagination
|
|
8869
|
+
* ----------------------------------------------------------------------- */
|
|
8870
|
+
.tools {
|
|
8871
|
+
display: flex;
|
|
8872
|
+
align-items: center;
|
|
8873
|
+
gap: 8px;
|
|
8874
|
+
}
|
|
8875
|
+
|
|
8876
|
+
.pagination {
|
|
8877
|
+
display: flex;
|
|
8878
|
+
align-items: center;
|
|
8879
|
+
gap: 2px;
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8882
|
+
.pagination-info {
|
|
8883
|
+
font-size: 13px;
|
|
8884
|
+
color: var(--kr-primary);
|
|
8885
|
+
white-space: nowrap;
|
|
8886
|
+
}
|
|
8887
|
+
|
|
8888
|
+
.pagination-icon {
|
|
8889
|
+
display: flex;
|
|
8890
|
+
color: var(--kr-primary);
|
|
8891
|
+
cursor: pointer;
|
|
8892
|
+
}
|
|
8893
|
+
|
|
8894
|
+
.pagination-icon--disabled {
|
|
8895
|
+
opacity: 0.3;
|
|
8896
|
+
pointer-events: none;
|
|
8897
|
+
}
|
|
8898
|
+
|
|
8899
|
+
.pagination-icon svg {
|
|
8900
|
+
width: 24px;
|
|
8901
|
+
height: 24px;
|
|
8902
|
+
}
|
|
8903
|
+
|
|
8904
|
+
/* -------------------------------------------------------------------------
|
|
8905
|
+
* Header Icons
|
|
8906
|
+
* ----------------------------------------------------------------------- */
|
|
8907
|
+
.refresh,
|
|
8908
|
+
.header-icon {
|
|
8909
|
+
display: flex;
|
|
8910
|
+
align-items: center;
|
|
8911
|
+
justify-content: center;
|
|
8912
|
+
color: var(--kr-primary);
|
|
8913
|
+
background: #EBF1FA;
|
|
8914
|
+
cursor: pointer;
|
|
8915
|
+
padding: 6px;
|
|
8916
|
+
border-radius: 50%;
|
|
8917
|
+
transition: background 0.15s;
|
|
8918
|
+
}
|
|
8919
|
+
|
|
8920
|
+
.refresh:hover,
|
|
8921
|
+
.header-icon:hover {
|
|
8922
|
+
background: #e8f0f8;
|
|
8923
|
+
}
|
|
8924
|
+
|
|
8925
|
+
.refresh svg,
|
|
8926
|
+
.header-icon svg {
|
|
8927
|
+
width: 24px;
|
|
8928
|
+
height: 24px;
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
/* -------------------------------------------------------------------------
|
|
8932
|
+
* Column Picker
|
|
8933
|
+
* ----------------------------------------------------------------------- */
|
|
8934
|
+
.column-picker-wrapper {
|
|
8935
|
+
position: relative;
|
|
8936
|
+
}
|
|
8937
|
+
|
|
8938
|
+
.column-picker {
|
|
8939
|
+
position: absolute;
|
|
8940
|
+
top: 100%;
|
|
8941
|
+
right: 0;
|
|
8942
|
+
margin-top: 4px;
|
|
8943
|
+
min-width: 200px;
|
|
8944
|
+
max-height: calc(100vh - 120px);
|
|
8945
|
+
overflow-y: auto;
|
|
8946
|
+
background: white;
|
|
8947
|
+
border: 1px solid #9ba7b6;
|
|
8948
|
+
border-radius: 8px;
|
|
8949
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
8950
|
+
padding: 8px 0;
|
|
8951
|
+
z-index: 100;
|
|
8952
|
+
display: none;
|
|
8953
|
+
transform-origin: top;
|
|
8954
|
+
}
|
|
8955
|
+
|
|
8956
|
+
.column-picker.open {
|
|
8957
|
+
display: block;
|
|
8958
|
+
animation: column-picker-fade-in 150ms ease-out;
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8961
|
+
@keyframes column-picker-fade-in {
|
|
8962
|
+
from {
|
|
8963
|
+
opacity: 0;
|
|
8964
|
+
transform: translateY(-4px);
|
|
8965
|
+
}
|
|
8966
|
+
to {
|
|
8967
|
+
opacity: 1;
|
|
8968
|
+
transform: translateY(0);
|
|
8969
|
+
}
|
|
8970
|
+
}
|
|
8971
|
+
|
|
8972
|
+
.column-picker-item {
|
|
8973
|
+
display: flex;
|
|
8974
|
+
align-items: center;
|
|
8975
|
+
gap: 10px;
|
|
8976
|
+
padding: 8px 16px;
|
|
8977
|
+
cursor: pointer;
|
|
8978
|
+
white-space: nowrap;
|
|
8979
|
+
}
|
|
8980
|
+
|
|
8981
|
+
.column-picker-item:hover {
|
|
8982
|
+
background: #f3f4f6;
|
|
8983
|
+
}
|
|
8984
|
+
|
|
8985
|
+
.column-picker-checkbox {
|
|
8986
|
+
width: 16px;
|
|
8987
|
+
height: 16px;
|
|
8988
|
+
border: 1.5px solid #9ca3af;
|
|
8989
|
+
border-radius: 3px;
|
|
8990
|
+
display: flex;
|
|
8991
|
+
align-items: center;
|
|
8992
|
+
justify-content: center;
|
|
8993
|
+
flex-shrink: 0;
|
|
8994
|
+
transition: all 0.15s;
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8997
|
+
.column-picker-checkbox.checked {
|
|
8998
|
+
background: var(--kr-primary);
|
|
8999
|
+
border-color: var(--kr-primary);
|
|
9000
|
+
}
|
|
9001
|
+
|
|
9002
|
+
.column-picker-checkbox svg {
|
|
9003
|
+
width: 12px;
|
|
9004
|
+
height: 12px;
|
|
9005
|
+
color: white;
|
|
9006
|
+
opacity: 0;
|
|
9007
|
+
}
|
|
9008
|
+
|
|
9009
|
+
.column-picker-checkbox.checked svg {
|
|
9010
|
+
opacity: 1;
|
|
9011
|
+
}
|
|
9012
|
+
|
|
9013
|
+
.column-picker-label {
|
|
9014
|
+
font-size: 14px;
|
|
9015
|
+
color: #374151;
|
|
9016
|
+
}
|
|
9017
|
+
|
|
9018
|
+
/* -------------------------------------------------------------------------
|
|
9019
|
+
* Table Structure
|
|
9020
|
+
* ----------------------------------------------------------------------- */
|
|
9021
|
+
.table {
|
|
9022
|
+
display: grid;
|
|
9023
|
+
width: max-content;
|
|
9024
|
+
min-width: 100%;
|
|
9025
|
+
font-size: 13px;
|
|
9026
|
+
}
|
|
9027
|
+
|
|
9028
|
+
.row {
|
|
9029
|
+
display: contents;
|
|
9030
|
+
}
|
|
9031
|
+
|
|
9032
|
+
.row:hover .cell {
|
|
9033
|
+
background: #f8f9fa;
|
|
9034
|
+
}
|
|
9035
|
+
|
|
9036
|
+
.row--clickable {
|
|
9037
|
+
cursor: pointer;
|
|
9038
|
+
}
|
|
9039
|
+
|
|
9040
|
+
.row--link {
|
|
9041
|
+
color: inherit;
|
|
9042
|
+
text-decoration: none;
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9045
|
+
.header-row {
|
|
9046
|
+
display: contents;
|
|
9047
|
+
}
|
|
9048
|
+
|
|
9049
|
+
.cell {
|
|
9050
|
+
padding: 8px 12px;
|
|
9051
|
+
display: flex;
|
|
9052
|
+
align-items: center;
|
|
9053
|
+
white-space: nowrap;
|
|
9054
|
+
overflow: hidden;
|
|
9055
|
+
text-overflow: ellipsis;
|
|
9056
|
+
box-sizing: border-box;
|
|
9057
|
+
}
|
|
9058
|
+
|
|
9059
|
+
.cell--actions {
|
|
9060
|
+
gap: 8px;
|
|
9061
|
+
}
|
|
9062
|
+
|
|
9063
|
+
.header-cell {
|
|
9064
|
+
position: sticky;
|
|
9065
|
+
top: 0;
|
|
9066
|
+
padding: 10px 12px;
|
|
9067
|
+
white-space: nowrap;
|
|
9068
|
+
box-sizing: border-box;
|
|
9069
|
+
background: #173153;
|
|
9070
|
+
color: #fff;
|
|
9071
|
+
font-weight: 600;
|
|
9072
|
+
font-size: 12px;
|
|
9073
|
+
text-transform: uppercase;
|
|
9074
|
+
letter-spacing: 0.5px;
|
|
9075
|
+
display: flex;
|
|
9076
|
+
align-items: center;
|
|
9077
|
+
}
|
|
9078
|
+
|
|
9079
|
+
.header-cell__resize {
|
|
9080
|
+
position: absolute;
|
|
9081
|
+
right: -7px;
|
|
9082
|
+
top: 0;
|
|
9083
|
+
bottom: 0;
|
|
9084
|
+
width: 14px;
|
|
9085
|
+
cursor: col-resize;
|
|
9086
|
+
z-index: 10;
|
|
9087
|
+
}
|
|
9088
|
+
|
|
9089
|
+
.header-cell--sortable {
|
|
9090
|
+
user-select: none;
|
|
9091
|
+
}
|
|
9092
|
+
|
|
9093
|
+
.header-cell__label {
|
|
9094
|
+
overflow: hidden;
|
|
9095
|
+
text-overflow: ellipsis;
|
|
9096
|
+
min-width: 0;
|
|
9097
|
+
line-height: 20px;
|
|
9098
|
+
}
|
|
9099
|
+
|
|
9100
|
+
.header-cell__sort {
|
|
9101
|
+
flex-grow: 1;
|
|
9102
|
+
display: flex;
|
|
9103
|
+
align-items: center;
|
|
9104
|
+
height: 100%;
|
|
9105
|
+
margin-left: 6px;
|
|
9106
|
+
cursor: pointer;
|
|
9107
|
+
}
|
|
9108
|
+
|
|
9109
|
+
.header-cell__sort-arrow {
|
|
9110
|
+
width: 16px;
|
|
9111
|
+
height: 16px;
|
|
9112
|
+
color: #fff;
|
|
9113
|
+
stroke: currentColor;
|
|
9114
|
+
stroke-width: 1px;
|
|
9115
|
+
}
|
|
9116
|
+
|
|
9117
|
+
.header-cell__sort-arrow--ghost {
|
|
9118
|
+
opacity: 0;
|
|
9119
|
+
color: rgba(255, 255, 255, 0.6);
|
|
9120
|
+
transition: opacity 0.15s;
|
|
9121
|
+
}
|
|
9122
|
+
|
|
9123
|
+
.header-cell--sortable:hover .header-cell__sort-arrow--ghost {
|
|
9124
|
+
opacity: 0.4;
|
|
9125
|
+
}
|
|
9126
|
+
|
|
9127
|
+
.header-cell__sort-priority {
|
|
9128
|
+
font-size: 10px;
|
|
9129
|
+
font-weight: 600;
|
|
9130
|
+
color: #fff;
|
|
9131
|
+
line-height: 1;
|
|
9132
|
+
}
|
|
9133
|
+
|
|
9134
|
+
.cell {
|
|
9135
|
+
background: #fff;
|
|
9136
|
+
border-bottom: 1px solid rgb(238, 239, 241);
|
|
9137
|
+
color: #1f2937;
|
|
9138
|
+
}
|
|
9139
|
+
|
|
9140
|
+
.cell--align-center {
|
|
9141
|
+
text-align: center;
|
|
9142
|
+
}
|
|
9143
|
+
|
|
9144
|
+
.cell--align-right {
|
|
9145
|
+
text-align: right;
|
|
9146
|
+
}
|
|
9147
|
+
|
|
9148
|
+
.cell--sticky-left,
|
|
9149
|
+
.cell--sticky-right {
|
|
9150
|
+
position: sticky;
|
|
9151
|
+
z-index: 1;
|
|
9152
|
+
}
|
|
9153
|
+
|
|
9154
|
+
.header-cell--sticky-left,
|
|
9155
|
+
.header-cell--sticky-right {
|
|
9156
|
+
position: sticky;
|
|
9157
|
+
z-index: 3;
|
|
9158
|
+
}
|
|
9159
|
+
|
|
9160
|
+
.header-cell--align-center {
|
|
9161
|
+
text-align: center;
|
|
9162
|
+
}
|
|
9163
|
+
|
|
9164
|
+
.header-cell--align-right {
|
|
9165
|
+
text-align: right;
|
|
9166
|
+
}
|
|
9167
|
+
|
|
9168
|
+
.header-cell--sticky-left-last,
|
|
9169
|
+
.cell--sticky-left-last {
|
|
9170
|
+
border-right: 1px solid #d1d5db;
|
|
9171
|
+
}
|
|
9172
|
+
|
|
9173
|
+
.header-cell--sticky-right-first,
|
|
9174
|
+
.cell--sticky-right-first {
|
|
9175
|
+
border-left: 1px solid #d1d5db;
|
|
9176
|
+
}
|
|
9177
|
+
|
|
9178
|
+
/* -------------------------------------------------------------------------
|
|
9179
|
+
* Scroll Mode: Edge
|
|
9180
|
+
* Padding scrolls with content, table can reach edges when scrolling
|
|
9181
|
+
* ----------------------------------------------------------------------- */
|
|
9182
|
+
/* Only add right padding when no horizontal scroll is needed */
|
|
9183
|
+
:host(.kr-table--scroll-edge):not(.kr-table--scroll-horizontal-available) .table {
|
|
9184
|
+
padding-right: 24px;
|
|
9185
|
+
}
|
|
9186
|
+
|
|
9187
|
+
:host(.kr-table--scroll-edge) .header-row .header-cell:first-child,
|
|
9188
|
+
:host(.kr-table--scroll-edge) .row .cell:first-child {
|
|
9189
|
+
padding-left: 24px;
|
|
9190
|
+
}
|
|
9191
|
+
|
|
9192
|
+
:host(.kr-table--scroll-edge) .header-row .header-cell:last-child,
|
|
9193
|
+
:host(.kr-table--scroll-edge) .row .cell:last-child {
|
|
9194
|
+
padding-right: 24px;
|
|
9195
|
+
}
|
|
9196
|
+
|
|
9197
|
+
:host(.kr-table--scroll-edge) .filter-row .filter-cell:first-child .filter-cell__input {
|
|
9198
|
+
padding-left: 24px;
|
|
9199
|
+
}
|
|
9200
|
+
|
|
9201
|
+
:host(.kr-table--scroll-edge) .filter-row .filter-cell:last-child .filter-cell__input {
|
|
9202
|
+
padding-right: 52px;
|
|
9203
|
+
}
|
|
9204
|
+
|
|
9205
|
+
/* -------------------------------------------------------------------------
|
|
9206
|
+
* Scroll Mode: Overlay
|
|
9207
|
+
* Fixed padding with overlay elements that hide content at edges
|
|
9208
|
+
* ----------------------------------------------------------------------- */
|
|
9209
|
+
:host(.kr-table--scroll-overlay) .content {
|
|
9210
|
+
padding-left: 24px;
|
|
9211
|
+
}
|
|
9212
|
+
|
|
9213
|
+
.overlay-left,
|
|
9214
|
+
.overlay-right {
|
|
9215
|
+
display: none;
|
|
9216
|
+
position: absolute;
|
|
9217
|
+
top: 0;
|
|
9218
|
+
bottom: 0;
|
|
9219
|
+
width: 24px;
|
|
9220
|
+
z-index: 5;
|
|
9221
|
+
pointer-events: none;
|
|
9222
|
+
transition: box-shadow 0.15s ease;
|
|
9223
|
+
}
|
|
9224
|
+
|
|
9225
|
+
:host(.kr-table--scroll-overlay) .overlay-left,
|
|
9226
|
+
:host(.kr-table--scroll-overlay) .overlay-right {
|
|
9227
|
+
display: block;
|
|
9228
|
+
}
|
|
9229
|
+
|
|
9230
|
+
.overlay-left {
|
|
9231
|
+
left: 0;
|
|
9232
|
+
background: #fff;
|
|
9233
|
+
}
|
|
9234
|
+
|
|
9235
|
+
.overlay-right {
|
|
9236
|
+
right: 0;
|
|
9237
|
+
background: #fff;
|
|
9238
|
+
}
|
|
9239
|
+
|
|
9240
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-left-available:not(.kr-table--sticky-left)) .overlay-left {
|
|
9241
|
+
border-right: 1px solid #d1d5db54;
|
|
9242
|
+
}
|
|
9243
|
+
|
|
9244
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-right-available:not(.kr-table--sticky-right)) .overlay-right {
|
|
9245
|
+
border-left: 1px solid #d1d5db54;
|
|
9246
|
+
}
|
|
9247
|
+
|
|
9248
|
+
/* -------------------------------------------------------------------------
|
|
9249
|
+
* Status (Loading, Error, Empty)
|
|
9250
|
+
* ----------------------------------------------------------------------- */
|
|
9251
|
+
.status {
|
|
9252
|
+
position: absolute;
|
|
9253
|
+
top: 0;
|
|
9254
|
+
left: 0;
|
|
9255
|
+
right: 0;
|
|
9256
|
+
bottom: 0;
|
|
9257
|
+
display: flex;
|
|
9258
|
+
align-items: center;
|
|
9259
|
+
justify-content: center;
|
|
9260
|
+
font-size: 14px;
|
|
9261
|
+
font-weight: 400;
|
|
9262
|
+
color: #5f6368;
|
|
9263
|
+
pointer-events: none;
|
|
9264
|
+
}
|
|
9265
|
+
|
|
9266
|
+
.status--error {
|
|
9267
|
+
color: #dc2626;
|
|
9268
|
+
}
|
|
9269
|
+
|
|
9270
|
+
/* -------------------------------------------------------------------------
|
|
9271
|
+
* Filter Row
|
|
9272
|
+
* ----------------------------------------------------------------------- */
|
|
9273
|
+
.filter-row {
|
|
9274
|
+
display: contents;
|
|
9275
|
+
}
|
|
9276
|
+
|
|
9277
|
+
.filter-cell {
|
|
9278
|
+
position: sticky;
|
|
9279
|
+
top: 40px;
|
|
9280
|
+
z-index: 2;
|
|
9281
|
+
height: 36px;
|
|
9282
|
+
padding: 0;
|
|
9283
|
+
display: flex;
|
|
9284
|
+
align-items: center;
|
|
9285
|
+
background: #fff;
|
|
9286
|
+
border-bottom: 1px solid #d1d5db;
|
|
9287
|
+
border-right: 1px solid #e5e7ebba;
|
|
9288
|
+
box-sizing: border-box;
|
|
9289
|
+
box-shadow: inset 0 0 0 0 #163052;
|
|
9290
|
+
transition: box-shadow 0.15s;
|
|
9291
|
+
}
|
|
9292
|
+
|
|
9293
|
+
.filter-cell:focus-within {
|
|
9294
|
+
box-shadow: inset 0 0 0 1px #163052;
|
|
9295
|
+
}
|
|
9296
|
+
|
|
9297
|
+
|
|
9298
|
+
.filter-cell--sticky-left,
|
|
9299
|
+
.filter-cell--sticky-right {
|
|
9300
|
+
position: sticky;
|
|
9301
|
+
z-index: 3;
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
.filter-cell--sticky-right-first {
|
|
9305
|
+
border-left: 1px solid #d1d5db;
|
|
9306
|
+
}
|
|
9307
|
+
|
|
9308
|
+
.filter-cell__wrapper {
|
|
9309
|
+
position: relative;
|
|
9310
|
+
display: flex;
|
|
9311
|
+
align-items: center;
|
|
9312
|
+
width: 100%;
|
|
9313
|
+
height: 100%;
|
|
9314
|
+
}
|
|
9315
|
+
|
|
9316
|
+
.filter-cell__input {
|
|
9317
|
+
width: 100%;
|
|
9318
|
+
height: 100%;
|
|
9319
|
+
padding: 0 60px 0 16px;
|
|
9320
|
+
border: none;
|
|
9321
|
+
border-radius: 0;
|
|
9322
|
+
font-size: 14px;
|
|
9323
|
+
font-family: inherit;
|
|
9324
|
+
color: #111827;
|
|
9325
|
+
background: transparent;
|
|
9326
|
+
outline: none;
|
|
9327
|
+
}
|
|
9328
|
+
|
|
9329
|
+
.filter-cell__input--invalid {
|
|
9330
|
+
border-color: #dc2626;
|
|
9331
|
+
}
|
|
9332
|
+
|
|
9333
|
+
.filter-cell__input--invalid:focus {
|
|
9334
|
+
border-color: #dc2626;
|
|
9335
|
+
box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
|
|
9336
|
+
}
|
|
9337
|
+
|
|
9338
|
+
.filter-cell__input::placeholder {
|
|
9339
|
+
color: #9ca3af;
|
|
9340
|
+
font-size: 13px;
|
|
9341
|
+
}
|
|
9342
|
+
|
|
9343
|
+
.filter-cell__clear {
|
|
9344
|
+
position: absolute;
|
|
9345
|
+
right: 36px;
|
|
9346
|
+
top: 50%;
|
|
9347
|
+
transform: translateY(-50%);
|
|
9348
|
+
display: flex;
|
|
9349
|
+
align-items: center;
|
|
9350
|
+
justify-content: center;
|
|
9351
|
+
width: 24px;
|
|
9352
|
+
height: 24px;
|
|
9353
|
+
padding: 0;
|
|
9354
|
+
border: none;
|
|
9355
|
+
border-radius: 4px;
|
|
9356
|
+
background: transparent;
|
|
9357
|
+
color: #6b7280;
|
|
9358
|
+
cursor: pointer;
|
|
9359
|
+
transition: background 0.15s, color 0.15s;
|
|
9360
|
+
}
|
|
9361
|
+
|
|
9362
|
+
.filter-cell__clear:hover {
|
|
9363
|
+
background: #e5e7eb;
|
|
9364
|
+
color: #374151;
|
|
9365
|
+
}
|
|
9366
|
+
|
|
9367
|
+
.filter-cell__clear svg {
|
|
9368
|
+
width: 16px;
|
|
9369
|
+
height: 16px;
|
|
9370
|
+
}
|
|
9371
|
+
|
|
9372
|
+
.filter-cell__advanced {
|
|
9373
|
+
position: absolute;
|
|
9374
|
+
right: 12px;
|
|
9375
|
+
top: 50%;
|
|
9376
|
+
transform: translateY(-50%);
|
|
9377
|
+
display: flex;
|
|
9378
|
+
align-items: center;
|
|
9379
|
+
justify-content: center;
|
|
9380
|
+
width: 24px;
|
|
9381
|
+
height: 24px;
|
|
9382
|
+
padding: 0;
|
|
9383
|
+
border: none;
|
|
9384
|
+
border-radius: 4px;
|
|
9385
|
+
background: transparent;
|
|
9386
|
+
color: #163052;
|
|
9387
|
+
cursor: pointer;
|
|
9388
|
+
transition: background 0.15s, color 0.15s;
|
|
9389
|
+
}
|
|
9390
|
+
|
|
9391
|
+
.filter-cell__advanced:hover {
|
|
9392
|
+
background: #e5e7eb;
|
|
9393
|
+
}
|
|
9394
|
+
|
|
9395
|
+
.filter-cell__advanced svg {
|
|
9396
|
+
width: 16px;
|
|
9397
|
+
height: 16px;
|
|
9398
|
+
}
|
|
9399
|
+
|
|
9400
|
+
.filter-cell__advanced--opened {
|
|
9401
|
+
background: #163052;
|
|
9402
|
+
color: #fff;
|
|
9403
|
+
}
|
|
9404
|
+
|
|
9405
|
+
.filter-cell__advanced--opened:hover {
|
|
9406
|
+
background: #1a3a5f;
|
|
9407
|
+
color: #fff;
|
|
9408
|
+
}
|
|
9409
|
+
|
|
9410
|
+
/* -------------------------------------------------------------------------
|
|
9411
|
+
* Filter Panel (Advanced)
|
|
9412
|
+
* ----------------------------------------------------------------------- */
|
|
9413
|
+
.filter-panel {
|
|
9414
|
+
position: fixed;
|
|
9415
|
+
min-width: 320px;
|
|
9416
|
+
background: white;
|
|
9417
|
+
border: 1px solid #9ba7b6;
|
|
9418
|
+
border-radius: 8px;
|
|
9419
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
9420
|
+
z-index: 100;
|
|
9421
|
+
animation: filter-panel-fade-in 150ms ease-out;
|
|
9422
|
+
}
|
|
9423
|
+
|
|
9424
|
+
@keyframes filter-panel-fade-in {
|
|
9425
|
+
from {
|
|
9426
|
+
opacity: 0;
|
|
9427
|
+
transform: translateY(-4px);
|
|
9428
|
+
}
|
|
9429
|
+
to {
|
|
9430
|
+
opacity: 1;
|
|
9431
|
+
transform: translateY(0);
|
|
9432
|
+
}
|
|
9433
|
+
}
|
|
9434
|
+
|
|
9435
|
+
.filter-panel__content {
|
|
9436
|
+
padding: 16px;
|
|
9437
|
+
display: flex;
|
|
9438
|
+
flex-direction: column;
|
|
9439
|
+
gap: 12px;
|
|
9440
|
+
}
|
|
9441
|
+
|
|
9442
|
+
.filter-panel__actions {
|
|
9443
|
+
padding: 12px 16px;
|
|
9444
|
+
border-top: 1px solid #e5e7eb;
|
|
9445
|
+
display: flex;
|
|
9446
|
+
justify-content: flex-end;
|
|
9447
|
+
align-items: center;
|
|
9448
|
+
gap: 12px;
|
|
9449
|
+
}
|
|
9450
|
+
|
|
9451
|
+
|
|
9452
|
+
.filter-panel__input {
|
|
9453
|
+
width: 100%;
|
|
9454
|
+
padding: 10px 12px;
|
|
9455
|
+
border: 1px solid #d1d5db;
|
|
9456
|
+
border-radius: 8px;
|
|
9457
|
+
font-size: 14px;
|
|
9458
|
+
font-family: inherit;
|
|
9459
|
+
color: #111827;
|
|
9460
|
+
background: #fff;
|
|
9461
|
+
outline: none;
|
|
9462
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
9463
|
+
}
|
|
9464
|
+
|
|
9465
|
+
.filter-panel__input:focus {
|
|
9466
|
+
border-color: #163052;
|
|
9467
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
9468
|
+
}
|
|
9469
|
+
|
|
9470
|
+
.filter-panel__input::placeholder {
|
|
9471
|
+
color: #9ca3af;
|
|
9472
|
+
}
|
|
9473
|
+
|
|
9474
|
+
.filter-panel__textarea {
|
|
9475
|
+
width: 100%;
|
|
9476
|
+
padding: 10px 12px;
|
|
9477
|
+
border: 1px solid #d1d5db;
|
|
9478
|
+
border-radius: 8px;
|
|
9479
|
+
font-size: 14px;
|
|
9480
|
+
font-family: inherit;
|
|
9481
|
+
color: #111827;
|
|
9482
|
+
background: #fff;
|
|
9483
|
+
outline: none;
|
|
9484
|
+
resize: vertical;
|
|
9485
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
9486
|
+
}
|
|
9487
|
+
|
|
9488
|
+
.filter-panel__textarea:focus {
|
|
9489
|
+
border-color: #163052;
|
|
9490
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
9491
|
+
}
|
|
9492
|
+
|
|
9493
|
+
.filter-panel__textarea::placeholder {
|
|
9494
|
+
color: #9ca3af;
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
/* -------------------------------------------------------------------------
|
|
9498
|
+
* Bucket List
|
|
9499
|
+
* ----------------------------------------------------------------------- */
|
|
9500
|
+
.buckets {
|
|
9501
|
+
max-height: 280px;
|
|
9502
|
+
overflow-y: auto;
|
|
9503
|
+
padding: 8px 0;
|
|
9504
|
+
}
|
|
9505
|
+
|
|
9506
|
+
.bucket {
|
|
9507
|
+
display: flex;
|
|
9508
|
+
align-items: center;
|
|
9509
|
+
gap: 16px;
|
|
9510
|
+
height: 32px;
|
|
9511
|
+
padding: 0 16px;
|
|
9512
|
+
cursor: pointer;
|
|
9513
|
+
transition: background 0.1s;
|
|
9514
|
+
}
|
|
9515
|
+
|
|
9516
|
+
.bucket:hover {
|
|
9517
|
+
background: #f3f4f6;
|
|
9518
|
+
}
|
|
9519
|
+
|
|
9520
|
+
.bucket__checkbox {
|
|
9521
|
+
width: 16px;
|
|
9522
|
+
height: 16px;
|
|
9523
|
+
border: 1.5px solid #9ca3af;
|
|
9524
|
+
border-radius: 3px;
|
|
9525
|
+
display: flex;
|
|
9526
|
+
align-items: center;
|
|
9527
|
+
justify-content: center;
|
|
9528
|
+
flex-shrink: 0;
|
|
9529
|
+
transition: all 0.15s;
|
|
9530
|
+
}
|
|
9531
|
+
|
|
9532
|
+
.bucket__checkbox--checked {
|
|
9533
|
+
background: var(--kr-primary, #163052);
|
|
9534
|
+
border-color: var(--kr-primary, #163052);
|
|
9535
|
+
}
|
|
9536
|
+
|
|
9537
|
+
.bucket__checkbox svg {
|
|
9538
|
+
width: 12px;
|
|
9539
|
+
height: 12px;
|
|
9540
|
+
color: white;
|
|
9541
|
+
}
|
|
9542
|
+
|
|
9543
|
+
.bucket__label {
|
|
9544
|
+
flex: 1;
|
|
9545
|
+
font-size: 14px;
|
|
9546
|
+
color: #000;
|
|
9547
|
+
overflow: hidden;
|
|
9548
|
+
text-overflow: ellipsis;
|
|
9549
|
+
white-space: nowrap;
|
|
9550
|
+
}
|
|
9551
|
+
|
|
9552
|
+
.bucket__count {
|
|
9553
|
+
font-size: 14px;
|
|
9554
|
+
color: #000;
|
|
9555
|
+
flex-shrink: 0;
|
|
9556
|
+
}
|
|
9557
|
+
|
|
9558
|
+
.bucket-empty {
|
|
9559
|
+
font-size: 14px;
|
|
9560
|
+
color: #000;
|
|
9561
|
+
padding: 16px;
|
|
9562
|
+
}
|
|
9563
|
+
|
|
9564
|
+
/* Card variant — self-contained card with border, auto height, left-aligned search */
|
|
9565
|
+
:host(.kr-table--card) {
|
|
9566
|
+
height: auto;
|
|
9567
|
+
/* overflow: visible; */
|
|
9568
|
+
overflow: hidden;
|
|
9569
|
+
/* border: 1px solid #e5e7eb; */
|
|
9570
|
+
/* border-radius: 8px; */
|
|
9571
|
+
border: 1px solid #c6c6cd;
|
|
9572
|
+
border-radius: 12px;
|
|
9573
|
+
background: #fff;
|
|
9574
|
+
}
|
|
9575
|
+
|
|
9576
|
+
.card-header {
|
|
9577
|
+
padding: 24px 24px 16px;
|
|
9578
|
+
}
|
|
9579
|
+
|
|
9580
|
+
.card-header__title {
|
|
9581
|
+
font-size: 18px;
|
|
9582
|
+
font-weight: 600;
|
|
9583
|
+
color: #1f2937;
|
|
9584
|
+
margin: 0;
|
|
9585
|
+
}
|
|
9586
|
+
|
|
9587
|
+
.card-header__description {
|
|
9588
|
+
font-size: 14px;
|
|
9589
|
+
color: #1f2937;
|
|
9590
|
+
margin: 12px 0 0;
|
|
9591
|
+
}
|
|
9592
|
+
|
|
9593
|
+
:host(.kr-table--card) .header {
|
|
9594
|
+
margin: 0 24px;
|
|
9595
|
+
}
|
|
9596
|
+
|
|
9597
|
+
:host(.kr-table--card) .wrapper {
|
|
9598
|
+
flex: none;
|
|
9599
|
+
overflow: visible;
|
|
9600
|
+
min-height: 200px;
|
|
9601
|
+
}
|
|
9602
|
+
|
|
9603
|
+
:host(.kr-table--card) .content {
|
|
9604
|
+
height: auto;
|
|
9605
|
+
}
|
|
9606
|
+
|
|
9607
|
+
`];
|
|
9608
|
+
__decorate$b([
|
|
9609
|
+
r$1()
|
|
9610
|
+
], exports.KRGrid.prototype, "_data", void 0);
|
|
9611
|
+
__decorate$b([
|
|
9612
|
+
r$1()
|
|
9613
|
+
], exports.KRGrid.prototype, "_dataState", void 0);
|
|
9614
|
+
__decorate$b([
|
|
9615
|
+
r$1()
|
|
9616
|
+
], exports.KRGrid.prototype, "_page", void 0);
|
|
9617
|
+
__decorate$b([
|
|
9618
|
+
r$1()
|
|
9619
|
+
], exports.KRGrid.prototype, "_pageSize", void 0);
|
|
9620
|
+
__decorate$b([
|
|
9621
|
+
r$1()
|
|
9622
|
+
], exports.KRGrid.prototype, "_totalItems", void 0);
|
|
9623
|
+
__decorate$b([
|
|
9624
|
+
r$1()
|
|
9625
|
+
], exports.KRGrid.prototype, "_totalPages", void 0);
|
|
9626
|
+
__decorate$b([
|
|
9627
|
+
r$1()
|
|
9628
|
+
], exports.KRGrid.prototype, "_searchQuery", void 0);
|
|
9629
|
+
__decorate$b([
|
|
9630
|
+
r$1()
|
|
9631
|
+
], exports.KRGrid.prototype, "_canScrollLeft", void 0);
|
|
9632
|
+
__decorate$b([
|
|
9633
|
+
r$1()
|
|
9634
|
+
], exports.KRGrid.prototype, "_canScrollRight", void 0);
|
|
9635
|
+
__decorate$b([
|
|
9636
|
+
r$1()
|
|
9637
|
+
], exports.KRGrid.prototype, "_canScrollHorizontal", void 0);
|
|
9638
|
+
__decorate$b([
|
|
9639
|
+
r$1()
|
|
9640
|
+
], exports.KRGrid.prototype, "_columnPickerOpen", void 0);
|
|
9641
|
+
__decorate$b([
|
|
9642
|
+
r$1()
|
|
9643
|
+
], exports.KRGrid.prototype, "_filterPanelOpened", void 0);
|
|
9644
|
+
__decorate$b([
|
|
9645
|
+
r$1()
|
|
9646
|
+
], exports.KRGrid.prototype, "_filterPanelTab", void 0);
|
|
9647
|
+
__decorate$b([
|
|
9648
|
+
r$1()
|
|
9649
|
+
], exports.KRGrid.prototype, "_buckets", void 0);
|
|
9650
|
+
__decorate$b([
|
|
9651
|
+
r$1()
|
|
9652
|
+
], exports.KRGrid.prototype, "_sorts", void 0);
|
|
9653
|
+
__decorate$b([
|
|
9654
|
+
n$1({ type: Object })
|
|
9655
|
+
], exports.KRGrid.prototype, "def", void 0);
|
|
9656
|
+
__decorate$b([
|
|
9657
|
+
n$1({ type: String, reflect: true })
|
|
9658
|
+
], exports.KRGrid.prototype, "variant", void 0);
|
|
9659
|
+
exports.KRGrid = __decorate$b([
|
|
9660
|
+
t$1('kr-grid')
|
|
9661
|
+
], exports.KRGrid);
|
|
9662
|
+
|
|
7258
9663
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
7259
9664
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7260
9665
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|