@mmlogic/components 0.1.16 → 0.1.18
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_16.cjs.entry.js +38 -6
- package/dist/cjs/mrd-table.cjs.entry.js +74 -3
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +41 -7
- package/dist/collection/components/mrd-table/mrd-table.js +117 -3
- package/dist/collection/components/mrd-table/mrd-table.scss +21 -0
- package/dist/collection/dev/api.js +1 -0
- package/dist/collection/dev/app.js +25 -0
- package/dist/components/mrd-datetime-field2.js +1 -1
- package/dist/components/mrd-table.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_16.entry.js +38 -6
- package/dist/esm/mrd-table.entry.js +74 -3
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-05b585bb.entry.js +1 -0
- package/dist/mosterdcomponents/p-a3d8feb8.entry.js +1 -0
- package/dist/types/components/mrd-datetime-field/mrd-datetime-field.d.ts +5 -0
- package/dist/types/components/mrd-table/mrd-table.d.ts +17 -0
- package/dist/types/components.d.ts +11 -0
- package/dist/types/types/client-layout.d.ts +8 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-1e0d88fd.entry.js +0 -1
- package/dist/mosterdcomponents/p-829b9b6f.entry.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { CellRenderer } from "../../utils/cell-renderer";
|
|
3
3
|
import { t } from "../../utils/i18n";
|
|
4
|
+
import { formatNumber, formatPercentage, formatCurrency } from "../../utils/format";
|
|
4
5
|
const BUFFER = 10;
|
|
5
6
|
/** Wacht deze tijd (ms) na het laatste scroll-event voordat pagina's worden
|
|
6
7
|
* aangevraagd. Pagina's die de gebruiker snel voorbij scrollt worden zo geskipt. */
|
|
@@ -58,6 +59,8 @@ export class MrdTable {
|
|
|
58
59
|
this.scrollTop = 0;
|
|
59
60
|
/** Full text shown in the TEXTBLOCK expand modal (null = closed). */
|
|
60
61
|
this.textblockModal = null;
|
|
62
|
+
/** Aggregation totals received from the host via setAggregations(). Null = not yet loaded. */
|
|
63
|
+
this.aggregations = null;
|
|
61
64
|
this.handleScroll = (e) => {
|
|
62
65
|
const scroller = e.currentTarget;
|
|
63
66
|
const scrollTop = scroller.scrollTop;
|
|
@@ -108,6 +111,8 @@ export class MrdTable {
|
|
|
108
111
|
const scroller = this.el.querySelector('.mrd-table__scroll');
|
|
109
112
|
if (scroller)
|
|
110
113
|
scroller.scrollTop = 0;
|
|
114
|
+
this.aggregations = null;
|
|
115
|
+
this.emitLoadAggregations();
|
|
111
116
|
}
|
|
112
117
|
/**
|
|
113
118
|
* Inject the rows for a given page (0-based).
|
|
@@ -128,6 +133,10 @@ export class MrdTable {
|
|
|
128
133
|
next.set(pageNumber, rows);
|
|
129
134
|
this.loadedPages = next;
|
|
130
135
|
}
|
|
136
|
+
/** Inject aggregation totals returned by the /aggregations endpoint. */
|
|
137
|
+
async setAggregations(data) {
|
|
138
|
+
this.aggregations = data;
|
|
139
|
+
}
|
|
131
140
|
// ── Lifecycle ──────────────────────────────────────────────────────────────
|
|
132
141
|
disconnectedCallback() {
|
|
133
142
|
if (this.outsideClickHandler) {
|
|
@@ -166,6 +175,49 @@ export class MrdTable {
|
|
|
166
175
|
return 'RELATION';
|
|
167
176
|
return (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : 'TEXT';
|
|
168
177
|
}
|
|
178
|
+
// ── Aggregation helpers ────────────────────────────────────────────────────
|
|
179
|
+
buildAggregationParams() {
|
|
180
|
+
var _a;
|
|
181
|
+
const groups = { sum: [], avg: [], count: [] };
|
|
182
|
+
for (const col of this.columns) {
|
|
183
|
+
if (col.type !== 'FIELD' || !((_a = col.field) === null || _a === void 0 ? void 0 : _a.aggregate))
|
|
184
|
+
continue;
|
|
185
|
+
const fn = col.field.aggregate.toLowerCase();
|
|
186
|
+
if (fn in groups)
|
|
187
|
+
groups[fn].push(col.field.name);
|
|
188
|
+
}
|
|
189
|
+
const params = {};
|
|
190
|
+
if (groups.sum.length)
|
|
191
|
+
params.sum = groups.sum;
|
|
192
|
+
if (groups.avg.length)
|
|
193
|
+
params.avg = groups.avg;
|
|
194
|
+
if (groups.count.length)
|
|
195
|
+
params.count = groups.count;
|
|
196
|
+
return Object.keys(params).length > 0 ? params : null;
|
|
197
|
+
}
|
|
198
|
+
emitLoadAggregations() {
|
|
199
|
+
const params = this.buildAggregationParams();
|
|
200
|
+
if (params)
|
|
201
|
+
this.mrdLoadAggregations.emit(params);
|
|
202
|
+
}
|
|
203
|
+
renderAggregationValue(col) {
|
|
204
|
+
var _a, _b;
|
|
205
|
+
if (col.type !== 'FIELD' || !((_a = col.field) === null || _a === void 0 ? void 0 : _a.aggregate) || !this.aggregations)
|
|
206
|
+
return '';
|
|
207
|
+
const fn = col.field.aggregate.toLowerCase();
|
|
208
|
+
const val = (_b = this.aggregations[fn]) === null || _b === void 0 ? void 0 : _b[col.field.name];
|
|
209
|
+
if (val == null)
|
|
210
|
+
return '';
|
|
211
|
+
const dt = col.field.dataType;
|
|
212
|
+
if (dt === 'INTEGER')
|
|
213
|
+
return formatNumber(val, this.locale, { maximumFractionDigits: 0 });
|
|
214
|
+
if (dt === 'PERCENTAGE')
|
|
215
|
+
return formatPercentage(val, this.locale);
|
|
216
|
+
if (dt === 'CURRENCY' && col.field.currencyCode)
|
|
217
|
+
return formatCurrency(val, col.field.currencyCode, this.locale);
|
|
218
|
+
return formatNumber(val, this.locale);
|
|
219
|
+
}
|
|
220
|
+
// ── Reset pagination ───────────────────────────────────────────────────────
|
|
169
221
|
/** Reset pagination state and scroll to top (used after sort or filter change). */
|
|
170
222
|
resetPages() {
|
|
171
223
|
if (this.debounceTimer !== null) {
|
|
@@ -429,6 +481,8 @@ export class MrdTable {
|
|
|
429
481
|
this.activeFilters = next;
|
|
430
482
|
this.closeFilterPopup();
|
|
431
483
|
this.mrdFilter.emit({ filters: Array.from(this.activeFilters.values()) });
|
|
484
|
+
this.aggregations = null;
|
|
485
|
+
this.emitLoadAggregations();
|
|
432
486
|
if (this.totalElements > 0) {
|
|
433
487
|
this.resetPages();
|
|
434
488
|
this.emitPagesForWindow(this.renderStart, this.renderEnd);
|
|
@@ -442,6 +496,8 @@ export class MrdTable {
|
|
|
442
496
|
this.activeFilters = next;
|
|
443
497
|
this.closeFilterPopup();
|
|
444
498
|
this.mrdFilter.emit({ filters: Array.from(this.activeFilters.values()) });
|
|
499
|
+
this.aggregations = null;
|
|
500
|
+
this.emitLoadAggregations();
|
|
445
501
|
if (this.totalElements > 0) {
|
|
446
502
|
this.resetPages();
|
|
447
503
|
this.emitPagesForWindow(this.renderStart, this.renderEnd);
|
|
@@ -450,6 +506,8 @@ export class MrdTable {
|
|
|
450
506
|
clearAllFilters() {
|
|
451
507
|
this.activeFilters = new Map();
|
|
452
508
|
this.mrdFilter.emit({ filters: [] });
|
|
509
|
+
this.aggregations = null;
|
|
510
|
+
this.emitLoadAggregations();
|
|
453
511
|
if (this.totalElements > 0) {
|
|
454
512
|
this.resetPages();
|
|
455
513
|
this.emitPagesForWindow(this.renderStart, this.renderEnd);
|
|
@@ -573,6 +631,19 @@ export class MrdTable {
|
|
|
573
631
|
const value = CellRenderer.render(col, row, this.locale);
|
|
574
632
|
return (h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
575
633
|
}
|
|
634
|
+
// ── Render: totals row ────────────────────────────────────────────────────
|
|
635
|
+
renderTotalsRow() {
|
|
636
|
+
if (!this.aggregations)
|
|
637
|
+
return null;
|
|
638
|
+
if (!this.columns.some(c => { var _a; return c.type === 'FIELD' && ((_a = c.field) === null || _a === void 0 ? void 0 : _a.aggregate); }))
|
|
639
|
+
return null;
|
|
640
|
+
return (h("tfoot", null, h("tr", { class: "mrd-table__totals-row" }, this.columns.map(col => {
|
|
641
|
+
var _a, _b;
|
|
642
|
+
const val = this.renderAggregationValue(col);
|
|
643
|
+
const isNumeric = col.type === 'FIELD' && NUMERIC_TYPES.has((_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : '');
|
|
644
|
+
return (h("td", { class: `mrd-table__totals-cell${isNumeric ? ' mrd-table__totals-cell--numeric' : ''}` }, val));
|
|
645
|
+
}))));
|
|
646
|
+
}
|
|
576
647
|
// ── Render ─────────────────────────────────────────────────────────────────
|
|
577
648
|
render() {
|
|
578
649
|
var _a, _b, _c;
|
|
@@ -590,7 +661,7 @@ export class MrdTable {
|
|
|
590
661
|
this.filterMode ? 'mrd-table__header--sortable' : '',
|
|
591
662
|
].filter(Boolean).join(' ');
|
|
592
663
|
return (h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, h("span", { class: "mrd-table__header-label" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''), isFiltered && this.renderFilterIcon()));
|
|
593
|
-
}))), h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(row) }, this.columns.map(col => this.renderCell(col, row))))))), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
664
|
+
}))), h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(row) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
594
665
|
}
|
|
595
666
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
596
667
|
// Derive the authoritative row count from loaded pages:
|
|
@@ -633,7 +704,7 @@ export class MrdTable {
|
|
|
633
704
|
isFiltered ? 'mrd-table__header--filtered' : '',
|
|
634
705
|
].filter(Boolean).join(' ');
|
|
635
706
|
return (h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: (e) => this.filterMode ? this.handleFilterOpen(col, e) : this.handleSortClick(col) }, h("span", { class: "mrd-table__header-label" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''), isActive && (h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, this.sortDir === 'asc' ? '▲' : '▼')), !isActive && !this.filterMode && (h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, "\u21C5")), isFiltered && this.renderFilterIcon()));
|
|
636
|
-
}))), h("tbody", null, topSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${topSpacerHeight}px` } }, h("td", { colSpan: colCount }))), renderedRows, bottomSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${bottomSpacerHeight}px` } }, h("td", { colSpan: colCount })))))), effectiveTotal === 0 && this.loadedPages.has(0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale))), effectiveTotal > 0 && this.renderFooter(undefined, effectiveTotal), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
707
|
+
}))), h("tbody", null, topSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${topSpacerHeight}px` } }, h("td", { colSpan: colCount }))), renderedRows, bottomSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${bottomSpacerHeight}px` } }, h("td", { colSpan: colCount })))), this.renderTotalsRow())), effectiveTotal === 0 && this.loadedPages.has(0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale))), effectiveTotal > 0 && this.renderFooter(undefined, effectiveTotal), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
637
708
|
}
|
|
638
709
|
renderFilterIcon() {
|
|
639
710
|
return (h("span", { class: "mrd-table__filter-icon", "aria-hidden": "true" }, h("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "currentColor" }, h("path", { d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" }))));
|
|
@@ -867,7 +938,8 @@ export class MrdTable {
|
|
|
867
938
|
"pendingFilter": {},
|
|
868
939
|
"popupPos": {},
|
|
869
940
|
"scrollTop": {},
|
|
870
|
-
"textblockModal": {}
|
|
941
|
+
"textblockModal": {},
|
|
942
|
+
"aggregations": {}
|
|
871
943
|
};
|
|
872
944
|
}
|
|
873
945
|
static get events() {
|
|
@@ -958,6 +1030,21 @@ export class MrdTable {
|
|
|
958
1030
|
"resolved": "{ href: string; fileName: string; }",
|
|
959
1031
|
"references": {}
|
|
960
1032
|
}
|
|
1033
|
+
}, {
|
|
1034
|
+
"method": "mrdLoadAggregations",
|
|
1035
|
+
"name": "mrdLoadAggregations",
|
|
1036
|
+
"bubbles": true,
|
|
1037
|
+
"cancelable": true,
|
|
1038
|
+
"composed": true,
|
|
1039
|
+
"docs": {
|
|
1040
|
+
"tags": [],
|
|
1041
|
+
"text": "Fired when aggregation totals need to be (re-)fetched.\nDetail contains the fields grouped by aggregate function.\nHost calls the /aggregations endpoint and passes the result to setAggregations()."
|
|
1042
|
+
},
|
|
1043
|
+
"complexType": {
|
|
1044
|
+
"original": "{ sum?: string[]; avg?: string[]; count?: string[] }",
|
|
1045
|
+
"resolved": "{ sum?: string[] | undefined; avg?: string[] | undefined; count?: string[] | undefined; }",
|
|
1046
|
+
"references": {}
|
|
1047
|
+
}
|
|
961
1048
|
}];
|
|
962
1049
|
}
|
|
963
1050
|
static get methods() {
|
|
@@ -1011,6 +1098,33 @@ export class MrdTable {
|
|
|
1011
1098
|
"text": "Inject the rows for a given page (0-based).\nCreates a new Map reference so Stencil detects the state change.\n\nWhen the page contains fewer rows than pageSize it is the last page.\nrenderEnd is clamped immediately so no loading-placeholder rows appear\nbeyond the actual data \u2014 without requiring the host to update totalElements.",
|
|
1012
1099
|
"tags": []
|
|
1013
1100
|
}
|
|
1101
|
+
},
|
|
1102
|
+
"setAggregations": {
|
|
1103
|
+
"complexType": {
|
|
1104
|
+
"signature": "(data: AggregationResult) => Promise<void>",
|
|
1105
|
+
"parameters": [{
|
|
1106
|
+
"name": "data",
|
|
1107
|
+
"type": "AggregationResult",
|
|
1108
|
+
"docs": ""
|
|
1109
|
+
}],
|
|
1110
|
+
"references": {
|
|
1111
|
+
"Promise": {
|
|
1112
|
+
"location": "global",
|
|
1113
|
+
"id": "global::Promise"
|
|
1114
|
+
},
|
|
1115
|
+
"AggregationResult": {
|
|
1116
|
+
"location": "import",
|
|
1117
|
+
"path": "../../types/client-layout",
|
|
1118
|
+
"id": "src/types/client-layout.ts::AggregationResult",
|
|
1119
|
+
"referenceLocation": "AggregationResult"
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
"return": "Promise<void>"
|
|
1123
|
+
},
|
|
1124
|
+
"docs": {
|
|
1125
|
+
"text": "Inject aggregation totals returned by the /aggregations endpoint.",
|
|
1126
|
+
"tags": []
|
|
1127
|
+
}
|
|
1014
1128
|
}
|
|
1015
1129
|
};
|
|
1016
1130
|
}
|
|
@@ -527,6 +527,27 @@
|
|
|
527
527
|
border-color: var(--mrd-color-primary-dark, var(--mrd-color-primary));
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
+
/* ── Totals row ─────────────────────────────────────────────────────────── */
|
|
531
|
+
.mrd-table__totals-row {
|
|
532
|
+
border-top: 2px solid var(--mrd-border-color);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.mrd-table__totals-cell {
|
|
536
|
+
position: sticky;
|
|
537
|
+
bottom: 0;
|
|
538
|
+
z-index: 2;
|
|
539
|
+
padding: var(--mrd-space-2) var(--mrd-space-4);
|
|
540
|
+
background: var(--mrd-color-white);
|
|
541
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
542
|
+
font-variant-numeric: tabular-nums;
|
|
543
|
+
white-space: nowrap;
|
|
544
|
+
border-top: 2px solid var(--mrd-border-color);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.mrd-table__totals-cell--numeric {
|
|
548
|
+
text-align: right;
|
|
549
|
+
}
|
|
550
|
+
|
|
530
551
|
/* ── Pagination footer ─────────────────────────────────────────────────── */
|
|
531
552
|
.mrd-table__footer {
|
|
532
553
|
padding: var(--mrd-space-1) var(--mrd-space-2);
|
|
@@ -252,6 +252,31 @@ function renderTable(columns, totalElements, pageSize, page0Rows, dataHref, defa
|
|
|
252
252
|
_activeFilters = e.detail.filters;
|
|
253
253
|
});
|
|
254
254
|
|
|
255
|
+
// Fetch aggregation totals from /aggregations endpoint with same filter params
|
|
256
|
+
table.addEventListener('mrdLoadAggregations', async (e) => {
|
|
257
|
+
const { sum, avg, count } = e.detail;
|
|
258
|
+
try {
|
|
259
|
+
const aggUrl = dataHref.split('?')[0] + '/aggregations';
|
|
260
|
+
const params = new URLSearchParams();
|
|
261
|
+
if (sum?.length) params.set('sum', sum.join(','));
|
|
262
|
+
if (avg?.length) params.set('avg', avg.join(','));
|
|
263
|
+
if (count?.length) params.set('count', count.join(','));
|
|
264
|
+
_activeFilters.forEach(f => {
|
|
265
|
+
if (f.operator === 'isEmpty') { params.set(f.field, ''); return; }
|
|
266
|
+
if (f.operator === 'isNotEmpty') { params.set(f.field + '_notempty', 'true'); return; }
|
|
267
|
+
if (f.values?.length) { params.set(f.field, f.values.join(',')); return; }
|
|
268
|
+
if (f.value != null && f.value !== '') params.set(f.field, String(f.value));
|
|
269
|
+
if (f.from != null && f.from !== '') params.set(f.field + '_from', String(f.from));
|
|
270
|
+
if (f.to != null && f.to !== '') params.set(f.field + '_to', String(f.to));
|
|
271
|
+
});
|
|
272
|
+
const qs = params.toString();
|
|
273
|
+
const result = await apiRequest('GET', qs ? `${aggUrl}?${qs}` : aggUrl, authGetToken());
|
|
274
|
+
if (result.ok) await table.setAggregations(result.body);
|
|
275
|
+
} catch (err) {
|
|
276
|
+
console.error('[mrdLoadAggregations] mislukt', err);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
255
280
|
await table.init();
|
|
256
281
|
await table.setPage(0, page0Rows); // inject pre-fetched page 0 — no extra request
|
|
257
282
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as r,createEvent as
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as r,createEvent as t,h as i,Host as d,transformTag as a}from"@stencil/core/internal/client";import{t as o}from"./i18n.js";import{v as s}from"./validation.js";const l=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.mrdChange=t(this,"mrdChange",7),this.mrdBlur=t(this,"mrdBlur",7),this.name="",this.label="",this.value="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.localValue="",this.handleChange=e=>{const r=e.target.value;this.localValue=r,this.error=this.required&&!s(r)?o("required",this.locale):"",this.mrdChange.emit({name:this.name,value:this.localToUtc(r)})},this.handleBlur=e=>{this.mrdBlur.emit({name:this.name,value:this.localToUtc(e.target.value)})}}componentWillLoad(){this.localValue=this.utcToLocal(this.value)}valueChanged(e){this.localValue=this.utcToLocal(e)}utcToLocal(e){if(!e)return"";const r=new Date(e);if(isNaN(r.getTime()))return"";const t=e=>String(e).padStart(2,"0");return`${r.getFullYear()}-${t(r.getMonth()+1)}-${t(r.getDate())}T${t(r.getHours())}:${t(r.getMinutes())}`}localToUtc(e){if(!e)return"";const r=new Date(e);return isNaN(r.getTime())?"":r.toISOString().replace(/\.\d{3}Z$/,"Z")}render(){const e=!!this.error;return i(d,{key:"6052b08238484bee345ae4bb9b3025c7f2474c35"},i("div",{key:"f9073be4496e35a7d40405ae4e6a27a5c1607626",class:"mrd-datetime-field"},this.label&&i("label",{key:"5933c3b2dfcae9bfad378441210ada6b625657a2",class:"mrd-datetime-field__label"+(this.required?" mrd-datetime-field__label--required":"")},this.label),i("input",{key:"7a947b104c38960d2326a4877e4ca52db9fd9d84",class:"mrd-datetime-field__input"+(e?" mrd-datetime-field__input--error":""),type:"datetime-local",name:this.name,value:this.localValue,required:this.required,disabled:this.disabled,onChange:this.handleChange,onBlur:this.handleBlur}),e&&i("span",{key:"cea3dba7e14e18a3a08394ef3027b661f1808969",class:"mrd-datetime-field__error"},this.error)))}static get watchers(){return{value:[{valueChanged:0}]}}static get style(){return".sc-mrd-datetime-field-h{display:block}.mrd-datetime-field.sc-mrd-datetime-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-datetime-field__label.sc-mrd-datetime-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-datetime-field__label--required.sc-mrd-datetime-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-datetime-field__input.sc-mrd-datetime-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition);outline:none;appearance:none;box-sizing:border-box;cursor:pointer}.mrd-datetime-field__input.sc-mrd-datetime-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-datetime-field__input.sc-mrd-datetime-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-datetime-field__input--error.sc-mrd-datetime-field{border-color:var(--mrd-border-color-error)}.mrd-datetime-field__input--error.sc-mrd-datetime-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-datetime-field__error.sc-mrd-datetime-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}"}},[2,"mrd-datetime-field",{name:[1],label:[1],value:[1],required:[4],disabled:[4],locale:[1],error:[32],localValue:[32]},void 0,{value:[{valueChanged:0}]}]);function m(){"undefined"!=typeof customElements&&["mrd-datetime-field"].forEach((e=>{"mrd-datetime-field"===e&&(customElements.get(a(e))||customElements.define(a(e),l))}))}export{l as M,m as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as r,HTMLElement as t,createEvent as e,h as l,Host as a,transformTag as i}from"@stencil/core/internal/client";import{a as o,b as s,c as d,d as n,f as c,e as m}from"./format.js";import{a as h}from"./client-layout.js";import{t as b}from"./i18n.js";class u{static render(r,t,e){var l,a,i,o;if(r.type===h.RELATION){const e=null!==(a=null===(l=r.relation)||void 0===l?void 0:l.name)&&void 0!==a?a:"",s=null===(i=null==t?void 0:t._links)||void 0===i?void 0:i[e];return s?Array.isArray(s)?s.map((r=>{var t;return null!==(t=r.name)&&void 0!==t?t:""})).filter(Boolean).join(", "):null!==(o=s.name)&&void 0!==o?o:"":""}if(r.type!==h.FIELD||!r.field)return"";const{name:s,dataType:d,listItems:n}=r.field,c=null==t?void 0:t[s];return null==c||""===c?"":(Array.isArray(c)?c:[c]).map((r=>u.renderValue(null!=d?d:"TEXT",r,null!=n?n:[],e))).filter((r=>""!==r)).join(", ")}static renderValue(r,t,e,l){var a,i;switch(r){case"INTEGER":return c(Number(t),l,{maximumFractionDigits:0});case"DECIMAL":return c(Number(t),l);case"PERCENTAGE":return m(Number(t),l);case"CURRENCY":{const{amount:r,currency:e}="object"==typeof t&&null!==t?t:{amount:t,currency:""};return e?n(Number(r),e,l):c(Number(r),l)}case"DATE":return d(t,l);case"DATETIME":return s(t,l);case"TIME":return o(t,l);case"BOOLEAN":return t?"✓":"";case"FILE":case"IMAGE":return"object"==typeof t&&null!==t&&null!==(a=t.fileName)&&void 0!==a?a:"";case"LIST":{const r=e.find((r=>r.key===t+""));return null!==(i=null==r?void 0:r.label)&&void 0!==i?i:t+""}case"TEXTBLOCK":return(t+"").replace(/<[^>]*>/g,"").trim();default:return t+""}}}const _=new Set(["TEXT","TEXTBLOCK","EMAIL","HYPERLINK"]),p=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),v=new Set(["DATE","DATETIME","TIME"]),f=new Set(["FILE","IMAGE"]),g=r(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdLoadPage=e(this,"mrdLoadPage",7),this.mrdRowClick=e(this,"mrdRowClick",7),this.mrdAction=e(this,"mrdAction",7),this.mrdFilter=e(this,"mrdFilter",7),this.mrdDownload=e(this,"mrdDownload",7),this.pendingPages=new Set,this.debounceTimer=null,this.outsideClickHandler=null,this.keydownHandler=null,this.columns=[],this.rows=[],this.locale=navigator.language,this.totalElements=0,this.pageSize=20,this.rowHeight=36,this.tableHeight=500,this.defaultSort="",this.actions=[],this.loadedPages=new Map,this.requestedPages=new Set,this.renderStart=0,this.renderEnd=0,this.colWidths=[],this.sortField="",this.sortDir="asc",this.filterMode=!1,this.activeFilters=new Map,this.openFilterCol=null,this.pendingFilter=null,this.popupPos={top:0,left:0},this.scrollTop=0,this.textblockModal=null,this.handleScroll=r=>{const t=r.currentTarget.scrollTop,e=this.totalElements,l=Math.floor(t/this.rowHeight),a=Math.min(l+this.visibleCount(),e-1);this.scrollTop=t,this.renderStart=Math.max(0,l-10),this.renderEnd=Math.min(e-1,a+10),this.requestPagesForWindow(this.renderStart,this.renderEnd)}}totalElementsChanged(r){this.renderEnd=Math.min(this.renderEnd,Math.max(0,r-1))}async init(){var r;if(null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.colWidths=[],this.defaultSort){const t=this.defaultSort.split(",");this.sortField=t[0].trim(),this.sortDir="desc"===(null===(r=t[1])||void 0===r?void 0:r.trim())?"desc":"asc"}else this.sortField="",this.sortDir="asc";this.scrollTop=0,this.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()-1,this.totalElements-1));const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0)}async setPage(r,t){t.length<this.pageSize&&(this.renderEnd=Math.min(this.renderEnd,r*this.pageSize+t.length-1));const e=new Map(this.loadedPages);e.set(r,t),this.loadedPages=e}disconnectedCallback(){this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}componentDidRender(){if(0===this.colWidths.length&&this.loadedPages.size>0&&this.totalElements>0){const r=this.el.querySelectorAll(".mrd-table__header");r.length>0&&(this.colWidths=Array.from(r).map((r=>r.offsetWidth)))}}visibleCount(){return Math.ceil(this.tableHeight/this.rowHeight)}sortParam(){return this.sortField?"desc"===this.sortDir?this.sortField+",desc":this.sortField:""}colName(r){var t,e,l,a;return null!==(a=null!==(e=null===(t=r.field)||void 0===t?void 0:t.name)&&void 0!==e?e:null===(l=r.relation)||void 0===l?void 0:l.name)&&void 0!==a?a:""}colDataType(r){var t,e;return"RELATION"===r.type?"RELATION":null!==(e=null===(t=r.field)||void 0===t?void 0:t.dataType)&&void 0!==e?e:"TEXT"}resetPages(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.colWidths=[],this.scrollTop=0,this.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()-1,this.totalElements-1));const r=this.el.querySelector(".mrd-table__scroll");r&&(r.scrollTop=0)}handleSortClick(r){const t=this.colName(r);this.sortField===t?this.sortDir="asc"===this.sortDir?"desc":"asc":(this.sortField=t,this.sortDir="asc"),this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}applySort(r,t){this.sortField=this.colName(r),this.sortDir=t,this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}emitPagesForWindow(r,t){const e=Math.floor(r/this.pageSize),l=Math.floor(t/this.pageSize),a=new Set(this.requestedPages);let i=!1;for(let r=e;r<=l;r++)this.loadedPages.has(r)||a.has(r)||(a.add(r),this.mrdLoadPage.emit({page:r,sort:this.sortParam()}),i=!0);i&&(this.requestedPages=a)}getRow(r){var t;const e=this.loadedPages.get(Math.floor(r/this.pageSize));return null!==(t=null==e?void 0:e[r%this.pageSize])&&void 0!==t?t:null}requestPagesForWindow(r,t){const e=Math.floor(r/this.pageSize),l=Math.floor(t/this.pageSize);let a=!1;for(let r=e;r<=l;r++)this.loadedPages.has(r)||this.requestedPages.has(r)||this.pendingPages.has(r)||(this.pendingPages.add(r),a=!0);a&&(null!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this.flushPendingPages()),150))}flushPendingPages(){if(this.debounceTimer=null,0===this.pendingPages.size)return;const r=new Set(this.requestedPages);let t=!1;for(const e of this.pendingPages){if(this.loadedPages.has(e)||r.has(e))continue;const l=e*this.pageSize;l+this.pageSize-1<this.renderStart||l>this.renderEnd||(r.add(e),this.mrdLoadPage.emit({page:e,sort:this.sortParam()}),t=!0)}this.pendingPages.clear(),t&&(this.requestedPages=r)}handleFilterToggle(){this.filterMode=!this.filterMode,this.filterMode||this.closeFilterPopup()}handleFilterOpen(r,t){t.stopPropagation();const e=t.currentTarget.getBoundingClientRect();let l=e.left;l+280>window.innerWidth-8&&(l=e.right-280),this.popupPos={top:e.bottom+4,left:Math.max(8,l)};const a=this.colName(r),i=this.colDataType(r),o=this.activeFilters.get(a),s=_.has(i)||"RELATION"===i?"startsWith":void 0;if("DATETIME"===i&&o){const r=Object.assign({},o);"string"==typeof r.from&&r.from&&(r.from=this.utcISOToLocalDate(r.from)),"string"==typeof r.to&&r.to&&(r.to=this.utcISOToLocalDateExclusiveEnd(r.to)),this.pendingFilter=r.from&&r.to&&r.from===r.to?Object.assign(Object.assign({},r),{value:r.from,from:void 0,to:void 0}):r}else this.pendingFilter=o?Object.assign({},o):{field:a,dataType:i,operator:s};this.openFilterCol=a,this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=r=>{const t=this.el.querySelector(".mrd-table__filter-popup");t&&!t.contains(r.target)&&this.closeFilterPopup()},document.addEventListener("click",this.outsideClickHandler)}closeFilterPopup(){this.openFilterCol=null,this.pendingFilter=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null)}openTextblockModal(r){this.textblockModal=r,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=r=>{"Escape"===r.key&&this.closeTextblockModal()},document.addEventListener("keydown",this.keydownHandler)}closeTextblockModal(){this.textblockModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}setPending(r,t){this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{[r]:t})}togglePendingValue(r,t){var e,l;const a=null!==(l=null===(e=this.pendingFilter)||void 0===e?void 0:e.values)&&void 0!==l?l:[];this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{values:t?[...a,r]:a.filter((t=>t!==r))})}filterHasValue(r){return"isEmpty"===r.operator||"isNotEmpty"===r.operator||void 0!==r.values&&r.values.length>0||null!=r.value&&""!==r.value||"boolean"==typeof r.value||null!=r.from&&""!==r.from||null!=r.to&&""!==r.to}dateLocalToUTCStart(r){if(!r)return r;const[t,e,l]=r.split("-").map(Number);return new Date(t,e-1,l).toISOString().replace(/\.\d{3}Z$/,"Z")}dateLocalToUTCEndExclusive(r){if(!r)return r;const[t,e,l]=r.split("-").map(Number);return new Date(t,e-1,l+1).toISOString().replace(/\.\d{3}Z$/,"Z")}utcISOToLocalDate(r){if(!r)return r;const t=new Date(r);return isNaN(t.getTime())?r:`${t.getFullYear()}-${(t.getMonth()+1+"").padStart(2,"0")}-${(t.getDate()+"").padStart(2,"0")}`}utcISOToLocalDateExclusiveEnd(r){if(!r)return r;const t=new Date(r);return isNaN(t.getTime())?r:(t.setDate(t.getDate()-1),`${t.getFullYear()}-${(t.getMonth()+1+"").padStart(2,"0")}-${(t.getDate()+"").padStart(2,"0")}`)}applyFilter(){const r=this.pendingFilter;if(!(null==r?void 0:r.field))return void this.closeFilterPopup();let t=Object.assign({},r);"DATETIME"===r.dataType&&("string"==typeof t.value&&t.value?(t.from=this.dateLocalToUTCStart(t.value),t.to=this.dateLocalToUTCEndExclusive(t.value),t.value=void 0):("string"==typeof t.from&&t.from&&(t.from=this.dateLocalToUTCStart(t.from)),"string"==typeof t.to&&t.to&&(t.to=this.dateLocalToUTCEndExclusive(t.to))));const e=new Map(this.activeFilters);this.filterHasValue(t)?e.set(t.field,t):e.delete(t.field),this.activeFilters=e,this.closeFilterPopup(),this.mrdFilter.emit({filters:Array.from(this.activeFilters.values())}),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearFilter(){const r=this.openFilterCol,t=new Map(this.activeFilters);r&&t.delete(r),this.activeFilters=t,this.closeFilterPopup(),this.mrdFilter.emit({filters:Array.from(this.activeFilters.values())}),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearAllFilters(){this.activeFilters=new Map,this.mrdFilter.emit({filters:[]}),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}renderToolbar(){var r;const t=this.activeFilters.size,e=(null===(r=this.actions)||void 0===r?void 0:r.length)>0;return l("div",{class:"mrd-table__toolbar"},l("div",{class:"mrd-table__toolbar-left"},l("button",{class:"mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle"+(this.filterMode?" mrd-table__filter-toggle--active":""),onClick:()=>this.handleFilterToggle()},l("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})),t>0&&l("span",{class:"mrd-table__filter-badge"},t),l("span",{class:"mrd-table__action-tooltip"},b(this.filterMode?"table_filter_hide":"table_filter",this.locale),t>0?` (${t} ${b("table_filter_active",this.locale)})`:"")),t>0&&l("button",{class:"mrd-table__action mrd-table__action--secondary",onClick:()=>this.clearAllFilters()},l("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",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"})),l("span",{class:"mrd-table__action-tooltip"},b("table_filter_clear_all",this.locale)))),e&&l("div",{class:"mrd-table__toolbar-right"},this.actions.map((r=>{var t;return l("button",{class:"mrd-table__action mrd-table__action--"+(null!==(t=r.variant)&&void 0!==t?t:"secondary"),disabled:r.disabled,onClick:()=>this.mrdAction.emit({action:r.action})},r.icon?l("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},l("use",{href:r.icon})):r.label,l("span",{class:"mrd-table__action-tooltip"},r.label))}))))}renderFilterEditor(r){var t,e,a,i,o,s,d,n;const c=null!==(t=this.pendingFilter)&&void 0!==t?t:{},m=this.colDataType(r);if(f.has(m))return l("p",{class:"mrd-table__filter-no-support"},b("filter_no_support",this.locale));if("BOOLEAN"===m)return l("div",{class:"mrd-table__filter-radio-group"},[{labelKey:"filter_all",value:null},{labelKey:"yes",value:!0},{labelKey:"no",value:!1}].map((r=>l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"bf-"+this.openFilterCol,checked:c.value===r.value,onChange:()=>this.setPending("value",r.value)}),b(r.labelKey,this.locale)))));if("LIST"===m){const t=null!==(a=null===(e=r.field)||void 0===e?void 0:e.listItems)&&void 0!==a?a:[],o=null!==(i=c.values)&&void 0!==i?i:[];return l("div",{class:"mrd-table__filter-list"},l("div",{class:"mrd-table__filter-list-controls"},l("button",{class:"mrd-table__filter-list-btn",onClick:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{values:t.map((r=>r.key))})}},b("filter_select_all",this.locale)),l("button",{class:"mrd-table__filter-list-btn",onClick:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{values:[]})}},b("filter_select_none",this.locale))),t.map((r=>l("label",{class:"mrd-table__filter-checkbox-label"},l("input",{type:"checkbox",checked:o.includes(r.key),onChange:t=>this.togglePendingValue(r.key,t.target.checked)}),r.label))))}if(_.has(m)||"RELATION"===m){const r=null!==(o=c.operator)&&void 0!==o?o:"startsWith",t="isEmpty"===r||"isNotEmpty"===r;return l("div",{class:"mrd-table__filter-editor"},l("select",{class:"mrd-table__filter-select",onChange:r=>this.setPending("operator",r.target.value)},[{val:"startsWith",labelKey:"filter_starts_with"},{val:"equals",labelKey:"filter_equals"},{val:"isEmpty",labelKey:"filter_is_empty"},{val:"isNotEmpty",labelKey:"filter_is_not_empty"}].map((t=>l("option",{value:t.val,selected:r===t.val},b(t.labelKey,this.locale))))),!t&&l("input",{type:"text",class:"mrd-table__filter-input",value:(null!==(s=c.value)&&void 0!==s?s:"")+"",placeholder:b("filter_search_value",this.locale),onInput:r=>this.setPending("value",r.target.value)}))}if(p.has(m)){const r=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"nm-"+this.openFilterCol,checked:!r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"nm-"+this.openFilterCol,checked:r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),r?l("div",{class:"mrd-table__filter-range"},l("input",{type:"number",class:"mrd-table__filter-input",placeholder:b("filter_from",this.locale),value:null!=c.from?c.from+"":"",onInput:r=>this.setPending("from",r.target.value)}),l("span",{class:"mrd-table__filter-range-sep"},"–"),l("input",{type:"number",class:"mrd-table__filter-input",placeholder:b("filter_to",this.locale),value:null!=c.to?c.to+"":"",onInput:r=>this.setPending("to",r.target.value)})):l("input",{type:"number",class:"mrd-table__filter-input",value:null!=c.value?c.value+"":"",onInput:r=>this.setPending("value",r.target.value)}))}if("DATETIME"===m){const r=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:!r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),r?l("div",{class:"mrd-table__filter-range mrd-table__filter-range--stacked"},l("label",{class:"mrd-table__filter-range-label"},b("filter_from",this.locale)),l("input",{type:"date",class:"mrd-table__filter-input",value:null!=c.from?c.from+"":"",onInput:r=>this.setPending("from",r.target.value)}),l("label",{class:"mrd-table__filter-range-label"},b("filter_to",this.locale)),l("input",{type:"date",class:"mrd-table__filter-input",value:null!=c.to?c.to+"":"",onInput:r=>this.setPending("to",r.target.value)})):l("input",{type:"date",class:"mrd-table__filter-input",value:(null!==(d=c.value)&&void 0!==d?d:"")+"",onInput:r=>this.setPending("value",r.target.value)}))}if(v.has(m)){const r="DATE"===m?"date":"time",t=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:!t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),t?l("div",{class:"mrd-table__filter-range"},l("input",{type:r,class:"mrd-table__filter-input",placeholder:b("filter_from",this.locale),value:null!=c.from?c.from+"":"",onInput:r=>this.setPending("from",r.target.value)}),l("input",{type:r,class:"mrd-table__filter-input",placeholder:b("filter_to",this.locale),value:null!=c.to?c.to+"":"",onInput:r=>this.setPending("to",r.target.value)})):l("input",{type:r,class:"mrd-table__filter-input",value:(null!==(n=c.value)&&void 0!==n?n:"")+"",onInput:r=>this.setPending("value",r.target.value)}))}return null}renderFilterPopup(){var r,t,e,a;if(!this.openFilterCol||!this.pendingFilter)return null;const i=this.columns.find((r=>this.colName(r)===this.openFilterCol));if(!i)return null;const o=null!==(a=null!==(t=null===(r=i.field)||void 0===r?void 0:r.label)&&void 0!==t?t:null===(e=i.relation)||void 0===e?void 0:e.label)&&void 0!==a?a:this.openFilterCol,s=this.sortField===this.openFilterCol;return l("div",{class:"mrd-table__filter-popup",style:{top:this.popupPos.top+"px",left:this.popupPos.left+"px"},onClick:r=>r.stopPropagation()},l("div",{class:"mrd-table__filter-popup-header"},l("span",{class:"mrd-table__filter-popup-title"},o),l("button",{class:"mrd-table__filter-close",onClick:()=>this.closeFilterPopup()},"✕")),l("div",{class:"mrd-table__filter-section"},l("div",{class:"mrd-table__filter-section-label"},b("filter_sorting",this.locale)),l("div",{class:"mrd-table__filter-sort-buttons"},l("button",{class:"mrd-table__filter-sort-btn"+(s&&"asc"===this.sortDir?" mrd-table__filter-sort-btn--active":""),onClick:()=>this.applySort(i,"asc")},"▲ ",b("filter_ascending",this.locale)),l("button",{class:"mrd-table__filter-sort-btn"+(s&&"desc"===this.sortDir?" mrd-table__filter-sort-btn--active":""),onClick:()=>this.applySort(i,"desc")},"▼ ",b("filter_descending",this.locale)))),l("div",{class:"mrd-table__filter-divider"}),l("div",{class:"mrd-table__filter-section"},l("div",{class:"mrd-table__filter-section-label"},b("filter_section",this.locale)),this.renderFilterEditor(i)),l("div",{class:"mrd-table__filter-popup-footer"},l("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--clear",onClick:()=>this.clearFilter()},b("filter_clear",this.locale)),l("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--apply",onClick:()=>this.applyFilter()},b("filter_apply",this.locale))))}renderFooter(r,t){const e=this.totalElements;if(0===e){const t=null!=r?r:0;return 0===t?null:l("div",{class:"mrd-table__footer"},t," ",b("table_of",this.locale)," ",t)}if(!this.loadedPages.has(0))return null;const a=null!=t?t:e;return l("div",{class:"mrd-table__footer"},Math.min(Math.floor(this.scrollTop/this.rowHeight)+1,a),"–",Math.min(Math.ceil((this.scrollTop+this.tableHeight)/this.rowHeight),a)," ",b("table_of",this.locale)," ",a)}renderCell(r,t){var e,a,i,o;const s=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),d=null!==(a=null===(e=r.field)||void 0===e?void 0:e.dataType)&&void 0!==a?a:"",n="FIELD"===r.type&&s.has(d);if("FIELD"===r.type&&("FILE"===d||"IMAGE"===d)){const e=null!==(o=null===(i=r.field)||void 0===i?void 0:i.name)&&void 0!==o?o:"",a=null==t?void 0:t[e],s=null==a?void 0:a.href,d=null==a?void 0:a.fileName;return l("td",{class:"mrd-table__cell"},s&&d?l("button",{class:"mrd-table__file-btn",title:d,onClick:r=>{r.stopPropagation(),this.mrdDownload.emit({href:s,fileName:d})}},l("svg",{class:"mrd-table__file-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z"})),b("download",this.locale)):"")}if("TEXTBLOCK"===d){const e=u.render(r,t,this.locale);if(e.length<=200)return l("td",{class:"mrd-table__cell"},e);const a=e.slice(0,200)+"…";return l("td",{class:"mrd-table__cell"},a,l("button",{class:"mrd-table__textblock-btn",onClick:r=>{r.stopPropagation(),this.openTextblockModal(e)},"aria-label":b("textblock_show_more",this.locale)},"⋯"))}const c=u.render(r,t,this.locale);return l("td",{class:"mrd-table__cell"+(n?" mrd-table__cell--numeric":"")},c)}render(){var r,t,e;if(!(null===(r=this.columns)||void 0===r?void 0:r.length))return null;if(0===this.totalElements)return l(a,null,this.renderToolbar(),l("div",{class:"mrd-table"},l("table",{class:"mrd-table__table"},l("thead",null,l("tr",null,this.columns.map((r=>{var t,e,a,i;const o=this.colName(r),s=this.activeFilters.has(o),d=["mrd-table__header",s?"mrd-table__header--filtered":"",this.filterMode?"mrd-table__header--sortable":""].filter(Boolean).join(" ");return l("th",{class:d,onClick:this.filterMode?t=>this.handleFilterOpen(r,t):void 0},l("span",{class:"mrd-table__header-label"},null!==(i=null!==(e=null===(t=r.field)||void 0===t?void 0:t.label)&&void 0!==e?e:null===(a=r.relation)||void 0===a?void 0:a.label)&&void 0!==i?i:""),s&&this.renderFilterIcon())})))),l("tbody",null,null===(t=this.rows)||void 0===t?void 0:t.map(((r,t)=>l("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:t%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit(r)},this.columns.map((t=>this.renderCell(t,r)))))))),(!this.rows||0===this.rows.length)&&l("p",{class:"mrd-table__empty"},b("no_results",this.locale))),this.renderFooter(null===(e=this.rows)||void 0===e?void 0:e.length),this.renderFilterPopup(),this.renderTextblockModal());let i=this.totalElements;for(const[r,t]of this.loadedPages)t.length<this.pageSize&&(i=Math.min(i,r*this.pageSize+t.length));const o=Math.min(this.renderEnd,i-1),s=this.columns.length,d=this.renderStart*this.rowHeight,n=Math.max(0,(i-1-o)*this.rowHeight),c=this.colWidths.length>0?{tableLayout:"fixed"}:void 0,m=[];for(let r=this.renderStart;r<=o;r++){const t=this.getRow(r);m.push(null===t?l("tr",{class:"mrd-table__row mrd-table__row--loading"},l("td",{class:"mrd-table__cell--placeholder",colSpan:s},l("span",{class:"mrd-table__placeholder-bar"}))):l("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:r%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit(t)},this.columns.map((r=>this.renderCell(r,t)))))}return l(a,null,this.renderToolbar(),l("div",{class:"mrd-table__scroll",style:{height:this.tableHeight+"px"},onScroll:this.handleScroll},l("table",{class:"mrd-table__table",style:c},l("thead",null,l("tr",null,this.columns.map(((r,t)=>{var e,a,i,o;const s=this.colName(r),d=this.sortField===s,n=this.activeFilters.has(s),c=["mrd-table__header","mrd-table__header--sortable",d?"mrd-table__header--sorted-"+this.sortDir:"",n?"mrd-table__header--filtered":""].filter(Boolean).join(" ");return l("th",{class:c,style:this.colWidths[t]?{width:this.colWidths[t]+"px"}:void 0,onClick:t=>this.filterMode?this.handleFilterOpen(r,t):this.handleSortClick(r)},l("span",{class:"mrd-table__header-label"},null!==(o=null!==(a=null===(e=r.field)||void 0===e?void 0:e.label)&&void 0!==a?a:null===(i=r.relation)||void 0===i?void 0:i.label)&&void 0!==o?o:""),d&&l("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"asc"===this.sortDir?"▲":"▼"),!d&&!this.filterMode&&l("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"⇅"),n&&this.renderFilterIcon())})))),l("tbody",null,d>0&&l("tr",{class:"mrd-table__spacer",style:{height:d+"px"}},l("td",{colSpan:s})),m,n>0&&l("tr",{class:"mrd-table__spacer",style:{height:n+"px"}},l("td",{colSpan:s}))))),0===i&&this.loadedPages.has(0)&&l("p",{class:"mrd-table__empty"},b("no_results",this.locale)),i>0&&this.renderFooter(void 0,i),this.renderFilterPopup(),this.renderTextblockModal())}renderFilterIcon(){return l("span",{class:"mrd-table__filter-icon","aria-hidden":"true"},l("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},l("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})))}renderTextblockModal(){return null===this.textblockModal?null:l("div",{class:"mrd-table__modal-backdrop",onClick:()=>this.closeTextblockModal(),role:"dialog","aria-modal":"true"},l("div",{class:"mrd-table__modal",onClick:r=>r.stopPropagation()},l("button",{class:"mrd-table__modal-close",onClick:()=>this.closeTextblockModal(),"aria-label":b("close",this.locale)},"✕"),l("p",{class:"mrd-table__modal-text"},this.textblockModal)))}get el(){return this}static get watchers(){return{totalElements:[{totalElementsChanged:0}]}}static get style(){return".sc-mrd-table-h{display:block;width:100%}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.85rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__filter-icon.sc-mrd-table{display:inline-flex;align-items:center;vertical-align:middle;margin-left:var(--mrd-space-1);color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__row--clickable.sc-mrd-table{cursor:pointer}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient( 90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75% );background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.mrd-table__toolbar.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--mrd-space-2)}.mrd-table__toolbar-left.sc-mrd-table,.mrd-table__toolbar-right.sc-mrd-table{display:flex;gap:var(--mrd-space-2);align-items:center}.mrd-table__action.sc-mrd-table{position:relative;display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;background:transparent;border:1px solid transparent;border-radius:var(--mrd-border-radius);cursor:pointer;color:var(--mrd-color-neutral-400);transition:background-color 0.15s, border-color 0.15s, color 0.15s}.mrd-table__action.sc-mrd-table:hover{background-color:var(--mrd-color-neutral-100);border-color:var(--mrd-color-neutral-300);color:var(--mrd-color-neutral-700)}.mrd-table__action.sc-mrd-table:disabled{opacity:0.4;cursor:not-allowed}.mrd-table__action--primary.sc-mrd-table{color:var(--mrd-color-neutral-500)}.mrd-table__action--primary.sc-mrd-table:hover{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__action--danger.sc-mrd-table{color:var(--mrd-color-error)}.mrd-table__action--danger.sc-mrd-table:hover{background-color:var(--mrd-color-error-light, #fef2f2);border-color:var(--mrd-color-error)}.mrd-table__action-icon.sc-mrd-table{width:1.25rem;height:1.25rem;pointer-events:none;fill:currentColor}.mrd-table__action-tooltip.sc-mrd-table{display:none;position:absolute;bottom:calc(100% + 6px);right:0;padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);white-space:nowrap;background:var(--mrd-color-tooltip, #fffce1);color:var(--mrd-color-neutral-900);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-sm, var(--mrd-border-radius));pointer-events:none;z-index:10}.mrd-table__action.sc-mrd-table:hover .mrd-table__action-tooltip.sc-mrd-table{display:block}.mrd-table__filter-toggle--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-toggle--active.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary));color:var(--mrd-color-white)}.mrd-table__filter-badge.sc-mrd-table{position:absolute;top:-6px;right:-6px;min-width:1.25rem;height:1.25rem;padding:0 3px;background:var(--mrd-color-error, #e53e3e);color:var(--mrd-color-white);border-radius:9999px;font-size:0.65rem;font-weight:var(--mrd-font-weight-medium);line-height:1.25rem;text-align:center;pointer-events:none}.mrd-table__header--filtered.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__filter-popup.sc-mrd-table{position:fixed;width:280px;background:var(--mrd-color-white);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0,0,0,.12));z-index:var(--mrd-z-dropdown, 200);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-popup-header.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding:var(--mrd-space-2) var(--mrd-space-3);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__filter-popup-title.sc-mrd-table{font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-close.sc-mrd-table{background:transparent;border:none;cursor:pointer;color:var(--mrd-color-neutral-500);font-size:0.9rem;padding:2px 4px;border-radius:3px;line-height:1}.mrd-table__filter-close.sc-mrd-table:hover{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-800)}.mrd-table__filter-section.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-3)}.mrd-table__filter-section-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);text-transform:uppercase;letter-spacing:0.04em;color:var(--mrd-color-neutral-500);margin-bottom:var(--mrd-space-2)}.mrd-table__filter-sort-buttons.sc-mrd-table{display:flex;gap:var(--mrd-space-2)}.mrd-table__filter-sort-btn.sc-mrd-table{flex:1;padding:var(--mrd-space-1) var(--mrd-space-2);background:transparent;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-700)}.mrd-table__filter-sort-btn.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-sort-btn--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-divider.sc-mrd-table{height:1px;background:var(--mrd-border-color);margin:0}.mrd-table__filter-editor.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-2)}.mrd-table__filter-select.sc-mrd-table,.mrd-table__filter-input.sc-mrd-table{width:100%;padding:var(--mrd-space-1) var(--mrd-space-2);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900);background:var(--mrd-color-white);box-sizing:border-box}.mrd-table__filter-select.sc-mrd-table:focus,.mrd-table__filter-input.sc-mrd-table:focus{outline:none;border-color:var(--mrd-color-primary);box-shadow:0 0 0 2px rgba(0,0,0,.06)}.mrd-table__filter-range.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__filter-range.sc-mrd-table .mrd-table__filter-input.sc-mrd-table{flex:1;min-width:0}.mrd-table__filter-range-sep.sc-mrd-table{color:var(--mrd-color-neutral-400);flex-shrink:0}.mrd-table__filter-range--stacked.sc-mrd-table{flex-direction:column;align-items:stretch;gap:var(--mrd-space-2)}.mrd-table__filter-range-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-bottom:2px}.mrd-table__filter-radio-group.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-table__filter-radio-group--inline.sc-mrd-table{flex-direction:row;gap:var(--mrd-space-3)}.mrd-table__filter-radio-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-list.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1);max-height:180px;overflow-y:auto}.mrd-table__filter-list-controls.sc-mrd-table{display:flex;gap:var(--mrd-space-2);margin-bottom:var(--mrd-space-1)}.mrd-table__filter-list-btn.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-primary);background:transparent;border:none;cursor:pointer;padding:0;text-decoration:underline}.mrd-table__filter-checkbox-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-no-support.sc-mrd-table{font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);margin:0;font-style:italic}.mrd-table__filter-popup-footer.sc-mrd-table{display:flex;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);border-top:1px solid var(--mrd-border-color)}.mrd-table__filter-btn.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-3);border-radius:var(--mrd-border-radius);border:1px solid var(--mrd-border-color);font-size:var(--mrd-font-size-sm);cursor:pointer}.mrd-table__filter-btn--clear.sc-mrd-table{background:transparent;color:var(--mrd-color-neutral-600)}.mrd-table__filter-btn--clear.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-btn--apply.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-btn--apply.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary))}.mrd-table__footer.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);text-align:right}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}.mrd-table__file-btn.sc-mrd-table{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;max-width:100%;overflow:hidden}.mrd-table__file-btn.sc-mrd-table:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-table__file-icon.sc-mrd-table{flex-shrink:0;width:1rem;height:1rem}.mrd-table__textblock-btn.sc-mrd-table{display:inline;background:none;border:none;padding:0 0 0 var(--mrd-space-1);cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;line-height:inherit;vertical-align:middle}.mrd-table__textblock-btn.sc-mrd-table:hover{color:var(--mrd-color-primary-dark)}.mrd-table__modal-backdrop.sc-mrd-table{position:fixed;inset:0;background:rgba(0, 0, 0, 0.4);z-index:var(--mrd-z-modal, 300);display:flex;align-items:center;justify-content:center}.mrd-table__modal.sc-mrd-table{background:#fff;border-radius:var(--mrd-radius-md, 0.5rem);padding:var(--mrd-space-6);max-width:min(600px, 90vw);max-height:70vh;overflow-y:auto;position:relative;box-shadow:var(--mrd-shadow-lg)}.mrd-table__modal-close.sc-mrd-table{position:absolute;top:var(--mrd-space-3);right:var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:1.25rem;line-height:1;color:var(--mrd-color-text-muted, #6b7280);padding:0}.mrd-table__modal-close.sc-mrd-table:hover{color:var(--mrd-color-text, #111827)}.mrd-table__modal-text.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);white-space:pre-wrap;word-break:break-word;font-size:var(--mrd-font-size-sm);line-height:1.6}"}},[2,"mrd-table",{columns:[16],rows:[16],locale:[1],totalElements:[2,"total-elements"],pageSize:[2,"page-size"],rowHeight:[2,"row-height"],tableHeight:[2,"table-height"],defaultSort:[1,"default-sort"],actions:[16],loadedPages:[32],requestedPages:[32],renderStart:[32],renderEnd:[32],colWidths:[32],sortField:[32],sortDir:[32],filterMode:[32],activeFilters:[32],openFilterCol:[32],pendingFilter:[32],popupPos:[32],scrollTop:[32],textblockModal:[32],init:[64],setPage:[64]},void 0,{totalElements:[{totalElementsChanged:0}]}]),y=g,x=function(){"undefined"!=typeof customElements&&["mrd-table"].forEach((r=>{"mrd-table"===r&&(customElements.get(i(r))||customElements.define(i(r),g))}))};export{y as MrdTable,x as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as r,createEvent as e,h as l,Host as a,transformTag as i}from"@stencil/core/internal/client";import{a as o,b as s,c as d,d as n,f as c,e as m}from"./format.js";import{a as h}from"./client-layout.js";import{t as b}from"./i18n.js";class u{static render(t,r,e){var l,a,i,o;if(t.type===h.RELATION){const e=null!==(a=null===(l=t.relation)||void 0===l?void 0:l.name)&&void 0!==a?a:"",s=null===(i=null==r?void 0:r._links)||void 0===i?void 0:i[e];return s?Array.isArray(s)?s.map((t=>{var r;return null!==(r=t.name)&&void 0!==r?r:""})).filter(Boolean).join(", "):null!==(o=s.name)&&void 0!==o?o:"":""}if(t.type!==h.FIELD||!t.field)return"";const{name:s,dataType:d,listItems:n}=t.field,c=null==r?void 0:r[s];return null==c||""===c?"":(Array.isArray(c)?c:[c]).map((t=>u.renderValue(null!=d?d:"TEXT",t,null!=n?n:[],e))).filter((t=>""!==t)).join(", ")}static renderValue(t,r,e,l){var a,i;switch(t){case"INTEGER":return c(Number(r),l,{maximumFractionDigits:0});case"DECIMAL":return c(Number(r),l);case"PERCENTAGE":return m(Number(r),l);case"CURRENCY":{const{amount:t,currency:e}="object"==typeof r&&null!==r?r:{amount:r,currency:""};return e?n(Number(t),e,l):c(Number(t),l)}case"DATE":return d(r,l);case"DATETIME":return s(r,l);case"TIME":return o(r,l);case"BOOLEAN":return r?"✓":"";case"FILE":case"IMAGE":return"object"==typeof r&&null!==r&&null!==(a=r.fileName)&&void 0!==a?a:"";case"LIST":{const t=e.find((t=>t.key===r+""));return null!==(i=null==t?void 0:t.label)&&void 0!==i?i:r+""}case"TEXTBLOCK":return(r+"").replace(/<[^>]*>/g,"").trim();default:return r+""}}}const _=new Set(["TEXT","TEXTBLOCK","EMAIL","HYPERLINK"]),p=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),v=new Set(["DATE","DATETIME","TIME"]),f=new Set(["FILE","IMAGE"]),g=t(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.mrdLoadPage=e(this,"mrdLoadPage",7),this.mrdRowClick=e(this,"mrdRowClick",7),this.mrdAction=e(this,"mrdAction",7),this.mrdFilter=e(this,"mrdFilter",7),this.mrdDownload=e(this,"mrdDownload",7),this.mrdLoadAggregations=e(this,"mrdLoadAggregations",7),this.pendingPages=new Set,this.debounceTimer=null,this.outsideClickHandler=null,this.keydownHandler=null,this.columns=[],this.rows=[],this.locale=navigator.language,this.totalElements=0,this.pageSize=20,this.rowHeight=36,this.tableHeight=500,this.defaultSort="",this.actions=[],this.loadedPages=new Map,this.requestedPages=new Set,this.renderStart=0,this.renderEnd=0,this.colWidths=[],this.sortField="",this.sortDir="asc",this.filterMode=!1,this.activeFilters=new Map,this.openFilterCol=null,this.pendingFilter=null,this.popupPos={top:0,left:0},this.scrollTop=0,this.textblockModal=null,this.aggregations=null,this.handleScroll=t=>{const r=t.currentTarget.scrollTop,e=this.totalElements,l=Math.floor(r/this.rowHeight),a=Math.min(l+this.visibleCount(),e-1);this.scrollTop=r,this.renderStart=Math.max(0,l-10),this.renderEnd=Math.min(e-1,a+10),this.requestPagesForWindow(this.renderStart,this.renderEnd)}}totalElementsChanged(t){this.renderEnd=Math.min(this.renderEnd,Math.max(0,t-1))}async init(){var t;if(null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.colWidths=[],this.defaultSort){const r=this.defaultSort.split(",");this.sortField=r[0].trim(),this.sortDir="desc"===(null===(t=r[1])||void 0===t?void 0:t.trim())?"desc":"asc"}else this.sortField="",this.sortDir="asc";this.scrollTop=0,this.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()-1,this.totalElements-1));const r=this.el.querySelector(".mrd-table__scroll");r&&(r.scrollTop=0),this.aggregations=null,this.emitLoadAggregations()}async setPage(t,r){r.length<this.pageSize&&(this.renderEnd=Math.min(this.renderEnd,t*this.pageSize+r.length-1));const e=new Map(this.loadedPages);e.set(t,r),this.loadedPages=e}async setAggregations(t){this.aggregations=t}disconnectedCallback(){this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}componentDidRender(){if(0===this.colWidths.length&&this.loadedPages.size>0&&this.totalElements>0){const t=this.el.querySelectorAll(".mrd-table__header");t.length>0&&(this.colWidths=Array.from(t).map((t=>t.offsetWidth)))}}visibleCount(){return Math.ceil(this.tableHeight/this.rowHeight)}sortParam(){return this.sortField?"desc"===this.sortDir?this.sortField+",desc":this.sortField:""}colName(t){var r,e,l,a;return null!==(a=null!==(e=null===(r=t.field)||void 0===r?void 0:r.name)&&void 0!==e?e:null===(l=t.relation)||void 0===l?void 0:l.name)&&void 0!==a?a:""}colDataType(t){var r,e;return"RELATION"===t.type?"RELATION":null!==(e=null===(r=t.field)||void 0===r?void 0:r.dataType)&&void 0!==e?e:"TEXT"}buildAggregationParams(){var t;const r={sum:[],avg:[],count:[]};for(const e of this.columns){if("FIELD"!==e.type||!(null===(t=e.field)||void 0===t?void 0:t.aggregate))continue;const l=e.field.aggregate.toLowerCase();l in r&&r[l].push(e.field.name)}const e={};return r.sum.length&&(e.sum=r.sum),r.avg.length&&(e.avg=r.avg),r.count.length&&(e.count=r.count),Object.keys(e).length>0?e:null}emitLoadAggregations(){const t=this.buildAggregationParams();t&&this.mrdLoadAggregations.emit(t)}renderAggregationValue(t){var r,e;if("FIELD"!==t.type||!(null===(r=t.field)||void 0===r?void 0:r.aggregate)||!this.aggregations)return"";const l=t.field.aggregate.toLowerCase(),a=null===(e=this.aggregations[l])||void 0===e?void 0:e[t.field.name];if(null==a)return"";const i=t.field.dataType;return"INTEGER"===i?c(a,this.locale,{maximumFractionDigits:0}):"PERCENTAGE"===i?m(a,this.locale):"CURRENCY"===i&&t.field.currencyCode?n(a,t.field.currencyCode,this.locale):c(a,this.locale)}resetPages(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.colWidths=[],this.scrollTop=0,this.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()-1,this.totalElements-1));const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0)}handleSortClick(t){const r=this.colName(t);this.sortField===r?this.sortDir="asc"===this.sortDir?"desc":"asc":(this.sortField=r,this.sortDir="asc"),this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}applySort(t,r){this.sortField=this.colName(t),this.sortDir=r,this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}emitPagesForWindow(t,r){const e=Math.floor(t/this.pageSize),l=Math.floor(r/this.pageSize),a=new Set(this.requestedPages);let i=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||a.has(t)||(a.add(t),this.mrdLoadPage.emit({page:t,sort:this.sortParam()}),i=!0);i&&(this.requestedPages=a)}getRow(t){var r;const e=this.loadedPages.get(Math.floor(t/this.pageSize));return null!==(r=null==e?void 0:e[t%this.pageSize])&&void 0!==r?r:null}requestPagesForWindow(t,r){const e=Math.floor(t/this.pageSize),l=Math.floor(r/this.pageSize);let a=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||this.requestedPages.has(t)||this.pendingPages.has(t)||(this.pendingPages.add(t),a=!0);a&&(null!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this.flushPendingPages()),150))}flushPendingPages(){if(this.debounceTimer=null,0===this.pendingPages.size)return;const t=new Set(this.requestedPages);let r=!1;for(const e of this.pendingPages){if(this.loadedPages.has(e)||t.has(e))continue;const l=e*this.pageSize;l+this.pageSize-1<this.renderStart||l>this.renderEnd||(t.add(e),this.mrdLoadPage.emit({page:e,sort:this.sortParam()}),r=!0)}this.pendingPages.clear(),r&&(this.requestedPages=t)}handleFilterToggle(){this.filterMode=!this.filterMode,this.filterMode||this.closeFilterPopup()}handleFilterOpen(t,r){r.stopPropagation();const e=r.currentTarget.getBoundingClientRect();let l=e.left;l+280>window.innerWidth-8&&(l=e.right-280),this.popupPos={top:e.bottom+4,left:Math.max(8,l)};const a=this.colName(t),i=this.colDataType(t),o=this.activeFilters.get(a),s=_.has(i)||"RELATION"===i?"startsWith":void 0;if("DATETIME"===i&&o){const t=Object.assign({},o);"string"==typeof t.from&&t.from&&(t.from=this.utcISOToLocalDate(t.from)),"string"==typeof t.to&&t.to&&(t.to=this.utcISOToLocalDateExclusiveEnd(t.to)),this.pendingFilter=t.from&&t.to&&t.from===t.to?Object.assign(Object.assign({},t),{value:t.from,from:void 0,to:void 0}):t}else this.pendingFilter=o?Object.assign({},o):{field:a,dataType:i,operator:s};this.openFilterCol=a,this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=t=>{const r=this.el.querySelector(".mrd-table__filter-popup");r&&!r.contains(t.target)&&this.closeFilterPopup()},document.addEventListener("click",this.outsideClickHandler)}closeFilterPopup(){this.openFilterCol=null,this.pendingFilter=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null)}openTextblockModal(t){this.textblockModal=t,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=t=>{"Escape"===t.key&&this.closeTextblockModal()},document.addEventListener("keydown",this.keydownHandler)}closeTextblockModal(){this.textblockModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}setPending(t,r){this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{[t]:r})}togglePendingValue(t,r){var e,l;const a=null!==(l=null===(e=this.pendingFilter)||void 0===e?void 0:e.values)&&void 0!==l?l:[];this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{values:r?[...a,t]:a.filter((r=>r!==t))})}filterHasValue(t){return"isEmpty"===t.operator||"isNotEmpty"===t.operator||void 0!==t.values&&t.values.length>0||null!=t.value&&""!==t.value||"boolean"==typeof t.value||null!=t.from&&""!==t.from||null!=t.to&&""!==t.to}dateLocalToUTCStart(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l).toISOString().replace(/\.\d{3}Z$/,"Z")}dateLocalToUTCEndExclusive(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l+1).toISOString().replace(/\.\d{3}Z$/,"Z")}utcISOToLocalDate(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:`${r.getFullYear()}-${(r.getMonth()+1+"").padStart(2,"0")}-${(r.getDate()+"").padStart(2,"0")}`}utcISOToLocalDateExclusiveEnd(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:(r.setDate(r.getDate()-1),`${r.getFullYear()}-${(r.getMonth()+1+"").padStart(2,"0")}-${(r.getDate()+"").padStart(2,"0")}`)}applyFilter(){const t=this.pendingFilter;if(!(null==t?void 0:t.field))return void this.closeFilterPopup();let r=Object.assign({},t);"DATETIME"===t.dataType&&("string"==typeof r.value&&r.value?(r.from=this.dateLocalToUTCStart(r.value),r.to=this.dateLocalToUTCEndExclusive(r.value),r.value=void 0):("string"==typeof r.from&&r.from&&(r.from=this.dateLocalToUTCStart(r.from)),"string"==typeof r.to&&r.to&&(r.to=this.dateLocalToUTCEndExclusive(r.to))));const e=new Map(this.activeFilters);this.filterHasValue(r)?e.set(r.field,r):e.delete(r.field),this.activeFilters=e,this.closeFilterPopup(),this.mrdFilter.emit({filters:Array.from(this.activeFilters.values())}),this.aggregations=null,this.emitLoadAggregations(),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearFilter(){const t=this.openFilterCol,r=new Map(this.activeFilters);t&&r.delete(t),this.activeFilters=r,this.closeFilterPopup(),this.mrdFilter.emit({filters:Array.from(this.activeFilters.values())}),this.aggregations=null,this.emitLoadAggregations(),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearAllFilters(){this.activeFilters=new Map,this.mrdFilter.emit({filters:[]}),this.aggregations=null,this.emitLoadAggregations(),this.totalElements>0&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}renderToolbar(){var t;const r=this.activeFilters.size,e=(null===(t=this.actions)||void 0===t?void 0:t.length)>0;return l("div",{class:"mrd-table__toolbar"},l("div",{class:"mrd-table__toolbar-left"},l("button",{class:"mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle"+(this.filterMode?" mrd-table__filter-toggle--active":""),onClick:()=>this.handleFilterToggle()},l("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})),r>0&&l("span",{class:"mrd-table__filter-badge"},r),l("span",{class:"mrd-table__action-tooltip"},b(this.filterMode?"table_filter_hide":"table_filter",this.locale),r>0?` (${r} ${b("table_filter_active",this.locale)})`:"")),r>0&&l("button",{class:"mrd-table__action mrd-table__action--secondary",onClick:()=>this.clearAllFilters()},l("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",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"})),l("span",{class:"mrd-table__action-tooltip"},b("table_filter_clear_all",this.locale)))),e&&l("div",{class:"mrd-table__toolbar-right"},this.actions.map((t=>{var r;return l("button",{class:"mrd-table__action mrd-table__action--"+(null!==(r=t.variant)&&void 0!==r?r:"secondary"),disabled:t.disabled,onClick:()=>this.mrdAction.emit({action:t.action})},t.icon?l("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},l("use",{href:t.icon})):t.label,l("span",{class:"mrd-table__action-tooltip"},t.label))}))))}renderFilterEditor(t){var r,e,a,i,o,s,d,n;const c=null!==(r=this.pendingFilter)&&void 0!==r?r:{},m=this.colDataType(t);if(f.has(m))return l("p",{class:"mrd-table__filter-no-support"},b("filter_no_support",this.locale));if("BOOLEAN"===m)return l("div",{class:"mrd-table__filter-radio-group"},[{labelKey:"filter_all",value:null},{labelKey:"yes",value:!0},{labelKey:"no",value:!1}].map((t=>l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"bf-"+this.openFilterCol,checked:c.value===t.value,onChange:()=>this.setPending("value",t.value)}),b(t.labelKey,this.locale)))));if("LIST"===m){const r=null!==(a=null===(e=t.field)||void 0===e?void 0:e.listItems)&&void 0!==a?a:[],o=null!==(i=c.values)&&void 0!==i?i:[];return l("div",{class:"mrd-table__filter-list"},l("div",{class:"mrd-table__filter-list-controls"},l("button",{class:"mrd-table__filter-list-btn",onClick:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{values:r.map((t=>t.key))})}},b("filter_select_all",this.locale)),l("button",{class:"mrd-table__filter-list-btn",onClick:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{values:[]})}},b("filter_select_none",this.locale))),r.map((t=>l("label",{class:"mrd-table__filter-checkbox-label"},l("input",{type:"checkbox",checked:o.includes(t.key),onChange:r=>this.togglePendingValue(t.key,r.target.checked)}),t.label))))}if(_.has(m)||"RELATION"===m){const t=null!==(o=c.operator)&&void 0!==o?o:"startsWith",r="isEmpty"===t||"isNotEmpty"===t;return l("div",{class:"mrd-table__filter-editor"},l("select",{class:"mrd-table__filter-select",onChange:t=>this.setPending("operator",t.target.value)},[{val:"startsWith",labelKey:"filter_starts_with"},{val:"equals",labelKey:"filter_equals"},{val:"isEmpty",labelKey:"filter_is_empty"},{val:"isNotEmpty",labelKey:"filter_is_not_empty"}].map((r=>l("option",{value:r.val,selected:t===r.val},b(r.labelKey,this.locale))))),!r&&l("input",{type:"text",class:"mrd-table__filter-input",value:(null!==(s=c.value)&&void 0!==s?s:"")+"",placeholder:b("filter_search_value",this.locale),onInput:t=>this.setPending("value",t.target.value)}))}if(p.has(m)){const t=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"nm-"+this.openFilterCol,checked:!t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"nm-"+this.openFilterCol,checked:t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),t?l("div",{class:"mrd-table__filter-range"},l("input",{type:"number",class:"mrd-table__filter-input",placeholder:b("filter_from",this.locale),value:null!=c.from?c.from+"":"",onInput:t=>this.setPending("from",t.target.value)}),l("span",{class:"mrd-table__filter-range-sep"},"–"),l("input",{type:"number",class:"mrd-table__filter-input",placeholder:b("filter_to",this.locale),value:null!=c.to?c.to+"":"",onInput:t=>this.setPending("to",t.target.value)})):l("input",{type:"number",class:"mrd-table__filter-input",value:null!=c.value?c.value+"":"",onInput:t=>this.setPending("value",t.target.value)}))}if("DATETIME"===m){const t=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:!t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:t,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),t?l("div",{class:"mrd-table__filter-range mrd-table__filter-range--stacked"},l("label",{class:"mrd-table__filter-range-label"},b("filter_from",this.locale)),l("input",{type:"date",class:"mrd-table__filter-input",value:null!=c.from?c.from+"":"",onInput:t=>this.setPending("from",t.target.value)}),l("label",{class:"mrd-table__filter-range-label"},b("filter_to",this.locale)),l("input",{type:"date",class:"mrd-table__filter-input",value:null!=c.to?c.to+"":"",onInput:t=>this.setPending("to",t.target.value)})):l("input",{type:"date",class:"mrd-table__filter-input",value:(null!==(d=c.value)&&void 0!==d?d:"")+"",onInput:t=>this.setPending("value",t.target.value)}))}if(v.has(m)){const t="DATE"===m?"date":"time",r=void 0!==c.from||void 0!==c.to;return l("div",{class:"mrd-table__filter-editor"},l("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:!r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{from:void 0,to:void 0})}}),b("filter_exact",this.locale)),l("label",{class:"mrd-table__filter-radio-label"},l("input",{type:"radio",name:"dt-"+this.openFilterCol,checked:r,onChange:()=>{this.pendingFilter=Object.assign(Object.assign({},c),{value:void 0,from:null,to:null})}}),b("filter_range",this.locale))),r?l("div",{class:"mrd-table__filter-range"},l("input",{type:t,class:"mrd-table__filter-input",placeholder:b("filter_from",this.locale),value:null!=c.from?c.from+"":"",onInput:t=>this.setPending("from",t.target.value)}),l("input",{type:t,class:"mrd-table__filter-input",placeholder:b("filter_to",this.locale),value:null!=c.to?c.to+"":"",onInput:t=>this.setPending("to",t.target.value)})):l("input",{type:t,class:"mrd-table__filter-input",value:(null!==(n=c.value)&&void 0!==n?n:"")+"",onInput:t=>this.setPending("value",t.target.value)}))}return null}renderFilterPopup(){var t,r,e,a;if(!this.openFilterCol||!this.pendingFilter)return null;const i=this.columns.find((t=>this.colName(t)===this.openFilterCol));if(!i)return null;const o=null!==(a=null!==(r=null===(t=i.field)||void 0===t?void 0:t.label)&&void 0!==r?r:null===(e=i.relation)||void 0===e?void 0:e.label)&&void 0!==a?a:this.openFilterCol,s=this.sortField===this.openFilterCol;return l("div",{class:"mrd-table__filter-popup",style:{top:this.popupPos.top+"px",left:this.popupPos.left+"px"},onClick:t=>t.stopPropagation()},l("div",{class:"mrd-table__filter-popup-header"},l("span",{class:"mrd-table__filter-popup-title"},o),l("button",{class:"mrd-table__filter-close",onClick:()=>this.closeFilterPopup()},"✕")),l("div",{class:"mrd-table__filter-section"},l("div",{class:"mrd-table__filter-section-label"},b("filter_sorting",this.locale)),l("div",{class:"mrd-table__filter-sort-buttons"},l("button",{class:"mrd-table__filter-sort-btn"+(s&&"asc"===this.sortDir?" mrd-table__filter-sort-btn--active":""),onClick:()=>this.applySort(i,"asc")},"▲ ",b("filter_ascending",this.locale)),l("button",{class:"mrd-table__filter-sort-btn"+(s&&"desc"===this.sortDir?" mrd-table__filter-sort-btn--active":""),onClick:()=>this.applySort(i,"desc")},"▼ ",b("filter_descending",this.locale)))),l("div",{class:"mrd-table__filter-divider"}),l("div",{class:"mrd-table__filter-section"},l("div",{class:"mrd-table__filter-section-label"},b("filter_section",this.locale)),this.renderFilterEditor(i)),l("div",{class:"mrd-table__filter-popup-footer"},l("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--clear",onClick:()=>this.clearFilter()},b("filter_clear",this.locale)),l("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--apply",onClick:()=>this.applyFilter()},b("filter_apply",this.locale))))}renderFooter(t,r){const e=this.totalElements;if(0===e){const r=null!=t?t:0;return 0===r?null:l("div",{class:"mrd-table__footer"},r," ",b("table_of",this.locale)," ",r)}if(!this.loadedPages.has(0))return null;const a=null!=r?r:e;return l("div",{class:"mrd-table__footer"},Math.min(Math.floor(this.scrollTop/this.rowHeight)+1,a),"–",Math.min(Math.ceil((this.scrollTop+this.tableHeight)/this.rowHeight),a)," ",b("table_of",this.locale)," ",a)}renderCell(t,r){var e,a,i,o;const s=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),d=null!==(a=null===(e=t.field)||void 0===e?void 0:e.dataType)&&void 0!==a?a:"",n="FIELD"===t.type&&s.has(d);if("FIELD"===t.type&&("FILE"===d||"IMAGE"===d)){const e=null!==(o=null===(i=t.field)||void 0===i?void 0:i.name)&&void 0!==o?o:"",a=null==r?void 0:r[e],s=null==a?void 0:a.href,d=null==a?void 0:a.fileName;return l("td",{class:"mrd-table__cell"},s&&d?l("button",{class:"mrd-table__file-btn",title:d,onClick:t=>{t.stopPropagation(),this.mrdDownload.emit({href:s,fileName:d})}},l("svg",{class:"mrd-table__file-icon",viewBox:"0 0 24 24","aria-hidden":"true"},l("path",{fill:"currentColor",d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z"})),b("download",this.locale)):"")}if("TEXTBLOCK"===d){const e=u.render(t,r,this.locale);if(e.length<=200)return l("td",{class:"mrd-table__cell"},e);const a=e.slice(0,200)+"…";return l("td",{class:"mrd-table__cell"},a,l("button",{class:"mrd-table__textblock-btn",onClick:t=>{t.stopPropagation(),this.openTextblockModal(e)},"aria-label":b("textblock_show_more",this.locale)},"⋯"))}const c=u.render(t,r,this.locale);return l("td",{class:"mrd-table__cell"+(n?" mrd-table__cell--numeric":"")},c)}renderTotalsRow(){return this.aggregations&&this.columns.some((t=>{var r;return"FIELD"===t.type&&(null===(r=t.field)||void 0===r?void 0:r.aggregate)}))?l("tfoot",null,l("tr",{class:"mrd-table__totals-row"},this.columns.map((t=>{var r,e;const a=this.renderAggregationValue(t),i="FIELD"===t.type&&p.has(null!==(e=null===(r=t.field)||void 0===r?void 0:r.dataType)&&void 0!==e?e:"");return l("td",{class:"mrd-table__totals-cell"+(i?" mrd-table__totals-cell--numeric":"")},a)})))):null}render(){var t,r,e;if(!(null===(t=this.columns)||void 0===t?void 0:t.length))return null;if(0===this.totalElements)return l(a,null,this.renderToolbar(),l("div",{class:"mrd-table"},l("table",{class:"mrd-table__table"},l("thead",null,l("tr",null,this.columns.map((t=>{var r,e,a,i;const o=this.colName(t),s=this.activeFilters.has(o),d=["mrd-table__header",s?"mrd-table__header--filtered":"",this.filterMode?"mrd-table__header--sortable":""].filter(Boolean).join(" ");return l("th",{class:d,onClick:this.filterMode?r=>this.handleFilterOpen(t,r):void 0},l("span",{class:"mrd-table__header-label"},null!==(i=null!==(e=null===(r=t.field)||void 0===r?void 0:r.label)&&void 0!==e?e:null===(a=t.relation)||void 0===a?void 0:a.label)&&void 0!==i?i:""),s&&this.renderFilterIcon())})))),l("tbody",null,null===(r=this.rows)||void 0===r?void 0:r.map(((t,r)=>l("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:r%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit(t)},this.columns.map((r=>this.renderCell(r,t))))))),this.renderTotalsRow()),(!this.rows||0===this.rows.length)&&l("p",{class:"mrd-table__empty"},b("no_results",this.locale))),this.renderFooter(null===(e=this.rows)||void 0===e?void 0:e.length),this.renderFilterPopup(),this.renderTextblockModal());let i=this.totalElements;for(const[t,r]of this.loadedPages)r.length<this.pageSize&&(i=Math.min(i,t*this.pageSize+r.length));const o=Math.min(this.renderEnd,i-1),s=this.columns.length,d=this.renderStart*this.rowHeight,n=Math.max(0,(i-1-o)*this.rowHeight),c=this.colWidths.length>0?{tableLayout:"fixed"}:void 0,m=[];for(let t=this.renderStart;t<=o;t++){const r=this.getRow(t);m.push(null===r?l("tr",{class:"mrd-table__row mrd-table__row--loading"},l("td",{class:"mrd-table__cell--placeholder",colSpan:s},l("span",{class:"mrd-table__placeholder-bar"}))):l("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:t%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit(r)},this.columns.map((t=>this.renderCell(t,r)))))}return l(a,null,this.renderToolbar(),l("div",{class:"mrd-table__scroll",style:{height:this.tableHeight+"px"},onScroll:this.handleScroll},l("table",{class:"mrd-table__table",style:c},l("thead",null,l("tr",null,this.columns.map(((t,r)=>{var e,a,i,o;const s=this.colName(t),d=this.sortField===s,n=this.activeFilters.has(s),c=["mrd-table__header","mrd-table__header--sortable",d?"mrd-table__header--sorted-"+this.sortDir:"",n?"mrd-table__header--filtered":""].filter(Boolean).join(" ");return l("th",{class:c,style:this.colWidths[r]?{width:this.colWidths[r]+"px"}:void 0,onClick:r=>this.filterMode?this.handleFilterOpen(t,r):this.handleSortClick(t)},l("span",{class:"mrd-table__header-label"},null!==(o=null!==(a=null===(e=t.field)||void 0===e?void 0:e.label)&&void 0!==a?a:null===(i=t.relation)||void 0===i?void 0:i.label)&&void 0!==o?o:""),d&&l("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"asc"===this.sortDir?"▲":"▼"),!d&&!this.filterMode&&l("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"⇅"),n&&this.renderFilterIcon())})))),l("tbody",null,d>0&&l("tr",{class:"mrd-table__spacer",style:{height:d+"px"}},l("td",{colSpan:s})),m,n>0&&l("tr",{class:"mrd-table__spacer",style:{height:n+"px"}},l("td",{colSpan:s}))),this.renderTotalsRow())),0===i&&this.loadedPages.has(0)&&l("p",{class:"mrd-table__empty"},b("no_results",this.locale)),i>0&&this.renderFooter(void 0,i),this.renderFilterPopup(),this.renderTextblockModal())}renderFilterIcon(){return l("span",{class:"mrd-table__filter-icon","aria-hidden":"true"},l("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},l("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})))}renderTextblockModal(){return null===this.textblockModal?null:l("div",{class:"mrd-table__modal-backdrop",onClick:()=>this.closeTextblockModal(),role:"dialog","aria-modal":"true"},l("div",{class:"mrd-table__modal",onClick:t=>t.stopPropagation()},l("button",{class:"mrd-table__modal-close",onClick:()=>this.closeTextblockModal(),"aria-label":b("close",this.locale)},"✕"),l("p",{class:"mrd-table__modal-text"},this.textblockModal)))}get el(){return this}static get watchers(){return{totalElements:[{totalElementsChanged:0}]}}static get style(){return".sc-mrd-table-h{display:block;width:100%}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.85rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__filter-icon.sc-mrd-table{display:inline-flex;align-items:center;vertical-align:middle;margin-left:var(--mrd-space-1);color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__row--clickable.sc-mrd-table{cursor:pointer}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient( 90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75% );background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.mrd-table__toolbar.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--mrd-space-2)}.mrd-table__toolbar-left.sc-mrd-table,.mrd-table__toolbar-right.sc-mrd-table{display:flex;gap:var(--mrd-space-2);align-items:center}.mrd-table__action.sc-mrd-table{position:relative;display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;background:transparent;border:1px solid transparent;border-radius:var(--mrd-border-radius);cursor:pointer;color:var(--mrd-color-neutral-400);transition:background-color 0.15s, border-color 0.15s, color 0.15s}.mrd-table__action.sc-mrd-table:hover{background-color:var(--mrd-color-neutral-100);border-color:var(--mrd-color-neutral-300);color:var(--mrd-color-neutral-700)}.mrd-table__action.sc-mrd-table:disabled{opacity:0.4;cursor:not-allowed}.mrd-table__action--primary.sc-mrd-table{color:var(--mrd-color-neutral-500)}.mrd-table__action--primary.sc-mrd-table:hover{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__action--danger.sc-mrd-table{color:var(--mrd-color-error)}.mrd-table__action--danger.sc-mrd-table:hover{background-color:var(--mrd-color-error-light, #fef2f2);border-color:var(--mrd-color-error)}.mrd-table__action-icon.sc-mrd-table{width:1.25rem;height:1.25rem;pointer-events:none;fill:currentColor}.mrd-table__action-tooltip.sc-mrd-table{display:none;position:absolute;bottom:calc(100% + 6px);right:0;padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);white-space:nowrap;background:var(--mrd-color-tooltip, #fffce1);color:var(--mrd-color-neutral-900);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-sm, var(--mrd-border-radius));pointer-events:none;z-index:10}.mrd-table__action.sc-mrd-table:hover .mrd-table__action-tooltip.sc-mrd-table{display:block}.mrd-table__filter-toggle--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-toggle--active.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary));color:var(--mrd-color-white)}.mrd-table__filter-badge.sc-mrd-table{position:absolute;top:-6px;right:-6px;min-width:1.25rem;height:1.25rem;padding:0 3px;background:var(--mrd-color-error, #e53e3e);color:var(--mrd-color-white);border-radius:9999px;font-size:0.65rem;font-weight:var(--mrd-font-weight-medium);line-height:1.25rem;text-align:center;pointer-events:none}.mrd-table__header--filtered.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__filter-popup.sc-mrd-table{position:fixed;width:280px;background:var(--mrd-color-white);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0,0,0,.12));z-index:var(--mrd-z-dropdown, 200);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-popup-header.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding:var(--mrd-space-2) var(--mrd-space-3);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__filter-popup-title.sc-mrd-table{font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-close.sc-mrd-table{background:transparent;border:none;cursor:pointer;color:var(--mrd-color-neutral-500);font-size:0.9rem;padding:2px 4px;border-radius:3px;line-height:1}.mrd-table__filter-close.sc-mrd-table:hover{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-800)}.mrd-table__filter-section.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-3)}.mrd-table__filter-section-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);text-transform:uppercase;letter-spacing:0.04em;color:var(--mrd-color-neutral-500);margin-bottom:var(--mrd-space-2)}.mrd-table__filter-sort-buttons.sc-mrd-table{display:flex;gap:var(--mrd-space-2)}.mrd-table__filter-sort-btn.sc-mrd-table{flex:1;padding:var(--mrd-space-1) var(--mrd-space-2);background:transparent;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-700)}.mrd-table__filter-sort-btn.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-sort-btn--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-divider.sc-mrd-table{height:1px;background:var(--mrd-border-color);margin:0}.mrd-table__filter-editor.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-2)}.mrd-table__filter-select.sc-mrd-table,.mrd-table__filter-input.sc-mrd-table{width:100%;padding:var(--mrd-space-1) var(--mrd-space-2);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900);background:var(--mrd-color-white);box-sizing:border-box}.mrd-table__filter-select.sc-mrd-table:focus,.mrd-table__filter-input.sc-mrd-table:focus{outline:none;border-color:var(--mrd-color-primary);box-shadow:0 0 0 2px rgba(0,0,0,.06)}.mrd-table__filter-range.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__filter-range.sc-mrd-table .mrd-table__filter-input.sc-mrd-table{flex:1;min-width:0}.mrd-table__filter-range-sep.sc-mrd-table{color:var(--mrd-color-neutral-400);flex-shrink:0}.mrd-table__filter-range--stacked.sc-mrd-table{flex-direction:column;align-items:stretch;gap:var(--mrd-space-2)}.mrd-table__filter-range-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-bottom:2px}.mrd-table__filter-radio-group.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-table__filter-radio-group--inline.sc-mrd-table{flex-direction:row;gap:var(--mrd-space-3)}.mrd-table__filter-radio-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-list.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1);max-height:180px;overflow-y:auto}.mrd-table__filter-list-controls.sc-mrd-table{display:flex;gap:var(--mrd-space-2);margin-bottom:var(--mrd-space-1)}.mrd-table__filter-list-btn.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-primary);background:transparent;border:none;cursor:pointer;padding:0;text-decoration:underline}.mrd-table__filter-checkbox-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-no-support.sc-mrd-table{font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);margin:0;font-style:italic}.mrd-table__filter-popup-footer.sc-mrd-table{display:flex;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);border-top:1px solid var(--mrd-border-color)}.mrd-table__filter-btn.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-3);border-radius:var(--mrd-border-radius);border:1px solid var(--mrd-border-color);font-size:var(--mrd-font-size-sm);cursor:pointer}.mrd-table__filter-btn--clear.sc-mrd-table{background:transparent;color:var(--mrd-color-neutral-600)}.mrd-table__filter-btn--clear.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-btn--apply.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-btn--apply.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary))}.mrd-table__totals-row.sc-mrd-table{border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell.sc-mrd-table{position:sticky;bottom:0;z-index:2;padding:var(--mrd-space-2) var(--mrd-space-4);background:var(--mrd-color-white);font-weight:var(--mrd-font-weight-medium);font-variant-numeric:tabular-nums;white-space:nowrap;border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell--numeric.sc-mrd-table{text-align:right}.mrd-table__footer.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);text-align:right}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}.mrd-table__file-btn.sc-mrd-table{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;max-width:100%;overflow:hidden}.mrd-table__file-btn.sc-mrd-table:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-table__file-icon.sc-mrd-table{flex-shrink:0;width:1rem;height:1rem}.mrd-table__textblock-btn.sc-mrd-table{display:inline;background:none;border:none;padding:0 0 0 var(--mrd-space-1);cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;line-height:inherit;vertical-align:middle}.mrd-table__textblock-btn.sc-mrd-table:hover{color:var(--mrd-color-primary-dark)}.mrd-table__modal-backdrop.sc-mrd-table{position:fixed;inset:0;background:rgba(0, 0, 0, 0.4);z-index:var(--mrd-z-modal, 300);display:flex;align-items:center;justify-content:center}.mrd-table__modal.sc-mrd-table{background:#fff;border-radius:var(--mrd-radius-md, 0.5rem);padding:var(--mrd-space-6);max-width:min(600px, 90vw);max-height:70vh;overflow-y:auto;position:relative;box-shadow:var(--mrd-shadow-lg)}.mrd-table__modal-close.sc-mrd-table{position:absolute;top:var(--mrd-space-3);right:var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:1.25rem;line-height:1;color:var(--mrd-color-text-muted, #6b7280);padding:0}.mrd-table__modal-close.sc-mrd-table:hover{color:var(--mrd-color-text, #111827)}.mrd-table__modal-text.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);white-space:pre-wrap;word-break:break-word;font-size:var(--mrd-font-size-sm);line-height:1.6}"}},[2,"mrd-table",{columns:[16],rows:[16],locale:[1],totalElements:[2,"total-elements"],pageSize:[2,"page-size"],rowHeight:[2,"row-height"],tableHeight:[2,"table-height"],defaultSort:[1,"default-sort"],actions:[16],loadedPages:[32],requestedPages:[32],renderStart:[32],renderEnd:[32],colWidths:[32],sortField:[32],sortDir:[32],filterMode:[32],activeFilters:[32],openFilterCol:[32],pendingFilter:[32],popupPos:[32],scrollTop:[32],textblockModal:[32],aggregations:[32],init:[64],setPage:[64],setAggregations:[64]},void 0,{totalElements:[{totalElementsChanged:0}]}]),y=g,x=function(){"undefined"!=typeof customElements&&["mrd-table"].forEach((t=>{"mrd-table"===t&&(customElements.get(i(t))||customElements.define(i(t),g))}))};export{y as MrdTable,x as defineCustomElement}
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["mrd-table",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"actions":[16],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"scrollTop":[32],"textblockModal":[32],"init":[64],"setPage":[64]},null,{"totalElements":[{"totalElementsChanged":0}]}]]],["mrd-boolean-field_16",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["mrd-table",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"actions":[16],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"scrollTop":[32],"textblockModal":[32],"aggregations":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}]}]]],["mrd-boolean-field_16",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["mrd-table",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"actions":[16],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"scrollTop":[32],"textblockModal":[32],"init":[64],"setPage":[64]},null,{"totalElements":[{"totalElementsChanged":0}]}]]],["mrd-boolean-field_16",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["mrd-table",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"actions":[16],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"scrollTop":[32],"textblockModal":[32],"aggregations":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}]}]]],["mrd-boolean-field_16",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"uploading":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
21
21
|
});
|