@mmlogic/components 0.1.9 → 0.1.11
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/README.md +196 -61
- package/dist/cjs/format-DBr-GTvS.js +308 -0
- 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 +108 -117
- package/dist/cjs/mrd-table.cjs.entry.js +318 -62
- package/dist/collection/components/mrd-field/mrd-field.js +26 -2
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +70 -2
- package/dist/collection/components/mrd-file-field/mrd-file-field.scss +13 -0
- package/dist/collection/components/mrd-form/mrd-form.js +28 -1
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +71 -2
- package/dist/collection/components/mrd-image-field/mrd-image-field.scss +26 -2
- package/dist/collection/components/mrd-table/mrd-table.js +386 -62
- package/dist/collection/components/mrd-table/mrd-table.scss +388 -0
- package/dist/collection/dev/app.js +48 -4
- package/dist/collection/dev/sprites.svg +55 -0
- package/dist/collection/utils/i18n.js +144 -0
- package/dist/components/i18n.js +1 -1
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-table.js +1 -1
- package/dist/esm/format-EzhfM0uw.js +299 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_16.entry.js +82 -91
- package/dist/esm/mrd-table.entry.js +318 -62
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-27f6947a.entry.js +1 -0
- package/dist/mosterdcomponents/p-EzhfM0uw.js +1 -0
- package/dist/mosterdcomponents/p-ca5f9919.entry.js +1 -0
- package/dist/types/components/mrd-field/mrd-field.d.ts +5 -0
- package/dist/types/components/mrd-file-field/mrd-file-field.d.ts +10 -0
- package/dist/types/components/mrd-form/mrd-form.d.ts +5 -0
- package/dist/types/components/mrd-image-field/mrd-image-field.d.ts +10 -0
- package/dist/types/components/mrd-table/mrd-table.d.ts +52 -18
- package/dist/types/components.d.ts +53 -3
- package/dist/types/utils/cell-renderer.d.ts +27 -0
- package/package.json +1 -1
- package/dist/cjs/format-CDw-zie_.js +0 -82
- package/dist/esm/format-Dt-aHxkM.js +0 -74
- package/dist/mosterdcomponents/p-2a8cb2eb.entry.js +0 -1
- package/dist/mosterdcomponents/p-Dt-aHxkM.js +0 -1
- package/dist/mosterdcomponents/p-baf08615.entry.js +0 -1
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { ClientLayout, ClientLayoutItem, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
|
|
9
|
-
import { TableColumn } from "./utils/cell-renderer";
|
|
9
|
+
import { ColumnFilter, TableAction, TableColumn } from "./utils/cell-renderer";
|
|
10
10
|
export { ClientLayout, ClientLayoutItem, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
|
|
11
|
-
export { TableColumn } from "./utils/cell-renderer";
|
|
11
|
+
export { ColumnFilter, TableAction, TableColumn } from "./utils/cell-renderer";
|
|
12
12
|
export namespace Components {
|
|
13
13
|
interface MrdBooleanField {
|
|
14
14
|
/**
|
|
@@ -181,6 +181,10 @@ export namespace Components {
|
|
|
181
181
|
* @default false
|
|
182
182
|
*/
|
|
183
183
|
"required": boolean;
|
|
184
|
+
/**
|
|
185
|
+
* @default null
|
|
186
|
+
*/
|
|
187
|
+
"value": unknown;
|
|
184
188
|
}
|
|
185
189
|
interface MrdForm {
|
|
186
190
|
"layout": ClientLayout;
|
|
@@ -268,6 +272,10 @@ export namespace Components {
|
|
|
268
272
|
* @default false
|
|
269
273
|
*/
|
|
270
274
|
"required": boolean;
|
|
275
|
+
/**
|
|
276
|
+
* @default null
|
|
277
|
+
*/
|
|
278
|
+
"value": unknown;
|
|
271
279
|
}
|
|
272
280
|
interface MrdListField {
|
|
273
281
|
/**
|
|
@@ -396,6 +404,11 @@ export namespace Components {
|
|
|
396
404
|
"value": string | string[] | RelationSearchResult | RelationSearchResult[] | null;
|
|
397
405
|
}
|
|
398
406
|
interface MrdTable {
|
|
407
|
+
/**
|
|
408
|
+
* Toolbar action buttons rendered above the table.
|
|
409
|
+
* @default []
|
|
410
|
+
*/
|
|
411
|
+
"actions": TableAction[];
|
|
399
412
|
/**
|
|
400
413
|
* @default []
|
|
401
414
|
*/
|
|
@@ -429,7 +442,7 @@ export namespace Components {
|
|
|
429
442
|
*/
|
|
430
443
|
"rows": Record<string, any>[];
|
|
431
444
|
/**
|
|
432
|
-
* Inject the rows for a given page (0-based). Creates a new Map reference so Stencil detects the state change.
|
|
445
|
+
* Inject the rows for a given page (0-based). Creates a new Map reference so Stencil detects the state change. When the page contains fewer rows than pageSize it is the last page. renderEnd is clamped immediately so no loading-placeholder rows appear beyond the actual data — without requiring the host to update totalElements.
|
|
433
446
|
*/
|
|
434
447
|
"setPage": (pageNumber: number, rows: Record<string, any>[]) => Promise<void>;
|
|
435
448
|
/**
|
|
@@ -694,6 +707,7 @@ declare global {
|
|
|
694
707
|
"mrdBlur": { name: string; value: unknown };
|
|
695
708
|
"mrdSearch": { query: string; relatedClass: string };
|
|
696
709
|
"mrdFetchAll": { name: string; relatedClass: string; mostSignificantClass?: string; commonRelation?: string; filter?: string; filterValue?: string };
|
|
710
|
+
"mrdUpload": { name: string; file: File };
|
|
697
711
|
}
|
|
698
712
|
interface HTMLMrdFieldElement extends Components.MrdField, HTMLStencilElement {
|
|
699
713
|
addEventListener<K extends keyof HTMLMrdFieldElementEventMap>(type: K, listener: (this: HTMLMrdFieldElement, ev: MrdFieldCustomEvent<HTMLMrdFieldElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -712,6 +726,7 @@ declare global {
|
|
|
712
726
|
interface HTMLMrdFileFieldElementEventMap {
|
|
713
727
|
"mrdChange": { name: string; value: File | null };
|
|
714
728
|
"mrdBlur": { name: string; value: File | null };
|
|
729
|
+
"mrdUpload": { name: string; file: File };
|
|
715
730
|
}
|
|
716
731
|
interface HTMLMrdFileFieldElement extends Components.MrdFileField, HTMLStencilElement {
|
|
717
732
|
addEventListener<K extends keyof HTMLMrdFileFieldElementEventMap>(type: K, listener: (this: HTMLMrdFileFieldElement, ev: MrdFileFieldCustomEvent<HTMLMrdFileFieldElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -732,6 +747,7 @@ declare global {
|
|
|
732
747
|
"mrdCancel": void;
|
|
733
748
|
"mrdSearch": { query: string; relatedClass: string };
|
|
734
749
|
"mrdFetchAll": { name: string; relatedClass: string; mostSignificantClass?: string; commonRelation?: string; filter?: string; filterValue?: string };
|
|
750
|
+
"mrdUpload": { name: string; file: File };
|
|
735
751
|
}
|
|
736
752
|
interface HTMLMrdFormElement extends Components.MrdForm, HTMLStencilElement {
|
|
737
753
|
addEventListener<K extends keyof HTMLMrdFormElementEventMap>(type: K, listener: (this: HTMLMrdFormElement, ev: MrdFormCustomEvent<HTMLMrdFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -768,6 +784,7 @@ declare global {
|
|
|
768
784
|
interface HTMLMrdImageFieldElementEventMap {
|
|
769
785
|
"mrdChange": { name: string; value: File | null };
|
|
770
786
|
"mrdBlur": { name: string; value: File | null };
|
|
787
|
+
"mrdUpload": { name: string; file: File };
|
|
771
788
|
}
|
|
772
789
|
interface HTMLMrdImageFieldElement extends Components.MrdImageField, HTMLStencilElement {
|
|
773
790
|
addEventListener<K extends keyof HTMLMrdImageFieldElementEventMap>(type: K, listener: (this: HTMLMrdImageFieldElement, ev: MrdImageFieldCustomEvent<HTMLMrdImageFieldElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -842,6 +859,8 @@ declare global {
|
|
|
842
859
|
interface HTMLMrdTableElementEventMap {
|
|
843
860
|
"mrdLoadPage": { page: number; sort: string };
|
|
844
861
|
"mrdRowClick": Record<string, any>;
|
|
862
|
+
"mrdAction": { action: string };
|
|
863
|
+
"mrdFilter": { filters: ColumnFilter[] };
|
|
845
864
|
}
|
|
846
865
|
interface HTMLMrdTableElement extends Components.MrdTable, HTMLStencilElement {
|
|
847
866
|
addEventListener<K extends keyof HTMLMrdTableElementEventMap>(type: K, listener: (this: HTMLMrdTableElement, ev: MrdTableCustomEvent<HTMLMrdTableElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -1086,6 +1105,7 @@ declare namespace LocalJSX {
|
|
|
1086
1105
|
"onMrdChange"?: (event: MrdFieldCustomEvent<{ name: string; value: unknown }>) => void;
|
|
1087
1106
|
"onMrdFetchAll"?: (event: MrdFieldCustomEvent<{ name: string; relatedClass: string; mostSignificantClass?: string; commonRelation?: string; filter?: string; filterValue?: string }>) => void;
|
|
1088
1107
|
"onMrdSearch"?: (event: MrdFieldCustomEvent<{ query: string; relatedClass: string }>) => void;
|
|
1108
|
+
"onMrdUpload"?: (event: MrdFieldCustomEvent<{ name: string; file: File }>) => void;
|
|
1089
1109
|
"value"?: unknown;
|
|
1090
1110
|
}
|
|
1091
1111
|
interface MrdFileField {
|
|
@@ -1115,10 +1135,18 @@ declare namespace LocalJSX {
|
|
|
1115
1135
|
"name"?: string;
|
|
1116
1136
|
"onMrdBlur"?: (event: MrdFileFieldCustomEvent<{ name: string; value: File | null }>) => void;
|
|
1117
1137
|
"onMrdChange"?: (event: MrdFileFieldCustomEvent<{ name: string; value: File | null }>) => void;
|
|
1138
|
+
/**
|
|
1139
|
+
* Emitted when a file is selected and needs to be uploaded. Host should upload the file and call form.setFieldValue(name, uri) with the result.
|
|
1140
|
+
*/
|
|
1141
|
+
"onMrdUpload"?: (event: MrdFileFieldCustomEvent<{ name: string; file: File }>) => void;
|
|
1118
1142
|
/**
|
|
1119
1143
|
* @default false
|
|
1120
1144
|
*/
|
|
1121
1145
|
"required"?: boolean;
|
|
1146
|
+
/**
|
|
1147
|
+
* @default null
|
|
1148
|
+
*/
|
|
1149
|
+
"value"?: unknown;
|
|
1122
1150
|
}
|
|
1123
1151
|
interface MrdForm {
|
|
1124
1152
|
"layout": ClientLayout;
|
|
@@ -1130,6 +1158,7 @@ declare namespace LocalJSX {
|
|
|
1130
1158
|
"onMrdFetchAll"?: (event: MrdFormCustomEvent<{ name: string; relatedClass: string; mostSignificantClass?: string; commonRelation?: string; filter?: string; filterValue?: string }>) => void;
|
|
1131
1159
|
"onMrdSearch"?: (event: MrdFormCustomEvent<{ query: string; relatedClass: string }>) => void;
|
|
1132
1160
|
"onMrdSubmit"?: (event: MrdFormCustomEvent<Record<string, unknown>>) => void;
|
|
1161
|
+
"onMrdUpload"?: (event: MrdFormCustomEvent<{ name: string; file: File }>) => void;
|
|
1133
1162
|
/**
|
|
1134
1163
|
* The `mostSignificantClass` of the parent/reference object (e.g. `'clientAgreements'`). Used to locate the matching RELATION field.
|
|
1135
1164
|
* @default ''
|
|
@@ -1209,10 +1238,18 @@ declare namespace LocalJSX {
|
|
|
1209
1238
|
"name"?: string;
|
|
1210
1239
|
"onMrdBlur"?: (event: MrdImageFieldCustomEvent<{ name: string; value: File | null }>) => void;
|
|
1211
1240
|
"onMrdChange"?: (event: MrdImageFieldCustomEvent<{ name: string; value: File | null }>) => void;
|
|
1241
|
+
/**
|
|
1242
|
+
* Emitted when an image is selected and needs to be uploaded. Host should upload the file and call form.setFieldValue(name, uri) with the result.
|
|
1243
|
+
*/
|
|
1244
|
+
"onMrdUpload"?: (event: MrdImageFieldCustomEvent<{ name: string; file: File }>) => void;
|
|
1212
1245
|
/**
|
|
1213
1246
|
* @default false
|
|
1214
1247
|
*/
|
|
1215
1248
|
"required"?: boolean;
|
|
1249
|
+
/**
|
|
1250
|
+
* @default null
|
|
1251
|
+
*/
|
|
1252
|
+
"value"?: unknown;
|
|
1216
1253
|
}
|
|
1217
1254
|
interface MrdListField {
|
|
1218
1255
|
/**
|
|
@@ -1346,6 +1383,11 @@ declare namespace LocalJSX {
|
|
|
1346
1383
|
"value"?: string | string[] | RelationSearchResult | RelationSearchResult[] | null;
|
|
1347
1384
|
}
|
|
1348
1385
|
interface MrdTable {
|
|
1386
|
+
/**
|
|
1387
|
+
* Toolbar action buttons rendered above the table.
|
|
1388
|
+
* @default []
|
|
1389
|
+
*/
|
|
1390
|
+
"actions"?: TableAction[];
|
|
1349
1391
|
/**
|
|
1350
1392
|
* @default []
|
|
1351
1393
|
*/
|
|
@@ -1359,6 +1401,14 @@ declare namespace LocalJSX {
|
|
|
1359
1401
|
* @default navigator.language
|
|
1360
1402
|
*/
|
|
1361
1403
|
"locale"?: string;
|
|
1404
|
+
/**
|
|
1405
|
+
* Fired when a toolbar action button is clicked. Detail contains the action identifier.
|
|
1406
|
+
*/
|
|
1407
|
+
"onMrdAction"?: (event: MrdTableCustomEvent<{ action: string }>) => void;
|
|
1408
|
+
/**
|
|
1409
|
+
* Fired when active filters change. Host translates filters to API query params.
|
|
1410
|
+
*/
|
|
1411
|
+
"onMrdFilter"?: (event: MrdTableCustomEvent<{ filters: ColumnFilter[] }>) => void;
|
|
1362
1412
|
/**
|
|
1363
1413
|
* Fired when a page needs to be fetched. Host fetches and calls setPage(). `sort` is the raw query-param value, e.g. "name" or "name,desc".
|
|
1364
1414
|
*/
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { ClientLayoutItem } from '../types/client-layout';
|
|
2
2
|
/** TableColumn is an alias for ClientLayoutItem — used for table column definitions. */
|
|
3
3
|
export type TableColumn = ClientLayoutItem;
|
|
4
|
+
/** Defines a toolbar action button for mrd-table. */
|
|
5
|
+
export interface TableAction {
|
|
6
|
+
/** Machine-readable identifier, e.g. 'create' | 'export'. Emitted in mrdAction event. */
|
|
7
|
+
action: string;
|
|
8
|
+
/** Tooltip text (and label fallback when no icon is provided). */
|
|
9
|
+
label: string;
|
|
10
|
+
/** SVG sprite href, e.g. "assets/sprites.svg#icon-plus". Optional. */
|
|
11
|
+
icon?: string;
|
|
12
|
+
/** Button style variant. Defaults to 'secondary'. */
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Represents an active filter on a single column. */
|
|
17
|
+
export interface ColumnFilter {
|
|
18
|
+
field: string;
|
|
19
|
+
dataType: string;
|
|
20
|
+
/** Text operator — only relevant for text-like data types. */
|
|
21
|
+
operator?: 'contains' | 'startsWith' | 'equals' | 'isEmpty' | 'isNotEmpty';
|
|
22
|
+
/** Single value (boolean, exact text/number/date). */
|
|
23
|
+
value?: string | number | boolean | null;
|
|
24
|
+
/** Range start (≥) — future API support. */
|
|
25
|
+
from?: string | number | null;
|
|
26
|
+
/** Range end (≤) — future API support. */
|
|
27
|
+
to?: string | number | null;
|
|
28
|
+
/** LIST: keys of selected items to include. */
|
|
29
|
+
values?: string[];
|
|
30
|
+
}
|
|
4
31
|
export declare class CellRenderer {
|
|
5
32
|
static render(column: TableColumn, row: Record<string, any>, locale: string): string;
|
|
6
33
|
private static renderValue;
|
package/package.json
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function formatNumber(value, locale, options) {
|
|
4
|
-
if (value === null || value === undefined || isNaN(value))
|
|
5
|
-
return '';
|
|
6
|
-
return new Intl.NumberFormat(locale, options).format(value);
|
|
7
|
-
}
|
|
8
|
-
function formatCurrency(amount, currency, locale) {
|
|
9
|
-
if (amount === null || amount === undefined || isNaN(amount))
|
|
10
|
-
return '';
|
|
11
|
-
return new Intl.NumberFormat(locale, {
|
|
12
|
-
style: 'currency',
|
|
13
|
-
currency,
|
|
14
|
-
minimumFractionDigits: 2,
|
|
15
|
-
maximumFractionDigits: 2,
|
|
16
|
-
}).format(amount);
|
|
17
|
-
}
|
|
18
|
-
function formatPercentage(value, locale, decimalPrecision = 2) {
|
|
19
|
-
if (value === null || value === undefined || isNaN(value))
|
|
20
|
-
return '';
|
|
21
|
-
return new Intl.NumberFormat(locale, {
|
|
22
|
-
style: 'percent',
|
|
23
|
-
minimumFractionDigits: decimalPrecision,
|
|
24
|
-
maximumFractionDigits: decimalPrecision,
|
|
25
|
-
}).format(value / 100);
|
|
26
|
-
}
|
|
27
|
-
function formatDate(value, locale) {
|
|
28
|
-
if (!value)
|
|
29
|
-
return '';
|
|
30
|
-
const date = typeof value === 'string' ? new Date(value) : value;
|
|
31
|
-
if (isNaN(date.getTime()))
|
|
32
|
-
return '';
|
|
33
|
-
return new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);
|
|
34
|
-
}
|
|
35
|
-
function formatDateTime(value, locale) {
|
|
36
|
-
if (!value)
|
|
37
|
-
return '';
|
|
38
|
-
const date = typeof value === 'string' ? new Date(value) : value;
|
|
39
|
-
if (isNaN(date.getTime()))
|
|
40
|
-
return '';
|
|
41
|
-
return new Intl.DateTimeFormat(locale, {
|
|
42
|
-
year: 'numeric',
|
|
43
|
-
month: '2-digit',
|
|
44
|
-
day: '2-digit',
|
|
45
|
-
hour: '2-digit',
|
|
46
|
-
minute: '2-digit',
|
|
47
|
-
}).format(date);
|
|
48
|
-
}
|
|
49
|
-
function formatTime(value, locale) {
|
|
50
|
-
if (!value)
|
|
51
|
-
return '';
|
|
52
|
-
// value is HH:MM or HH:MM:SS
|
|
53
|
-
const [hours, minutes] = value.split(':').map(Number);
|
|
54
|
-
const date = new Date();
|
|
55
|
-
date.setHours(hours, minutes, 0, 0);
|
|
56
|
-
return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date);
|
|
57
|
-
}
|
|
58
|
-
function parseLocalizedNumber(str, locale) {
|
|
59
|
-
var _a, _b, _c, _d;
|
|
60
|
-
if (!str || !str.trim())
|
|
61
|
-
return null;
|
|
62
|
-
// Detect decimal and thousands separators from the locale
|
|
63
|
-
const parts = new Intl.NumberFormat(locale).formatToParts(1234567.89);
|
|
64
|
-
const groupSep = (_b = (_a = parts.find((p) => p.type === 'group')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ',';
|
|
65
|
-
const decimalSep = (_d = (_c = parts.find((p) => p.type === 'decimal')) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '.';
|
|
66
|
-
// Remove group separators, replace decimal separator with '.'
|
|
67
|
-
const normalized = str
|
|
68
|
-
.replace(new RegExp(`\\${groupSep}`, 'g'), '')
|
|
69
|
-
.replace(new RegExp(`\\${decimalSep}`), '.')
|
|
70
|
-
.replace('%', '')
|
|
71
|
-
.trim();
|
|
72
|
-
const parsed = parseFloat(normalized);
|
|
73
|
-
return isNaN(parsed) ? null : parsed;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
exports.formatCurrency = formatCurrency;
|
|
77
|
-
exports.formatDate = formatDate;
|
|
78
|
-
exports.formatDateTime = formatDateTime;
|
|
79
|
-
exports.formatNumber = formatNumber;
|
|
80
|
-
exports.formatPercentage = formatPercentage;
|
|
81
|
-
exports.formatTime = formatTime;
|
|
82
|
-
exports.parseLocalizedNumber = parseLocalizedNumber;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
function formatNumber(value, locale, options) {
|
|
2
|
-
if (value === null || value === undefined || isNaN(value))
|
|
3
|
-
return '';
|
|
4
|
-
return new Intl.NumberFormat(locale, options).format(value);
|
|
5
|
-
}
|
|
6
|
-
function formatCurrency(amount, currency, locale) {
|
|
7
|
-
if (amount === null || amount === undefined || isNaN(amount))
|
|
8
|
-
return '';
|
|
9
|
-
return new Intl.NumberFormat(locale, {
|
|
10
|
-
style: 'currency',
|
|
11
|
-
currency,
|
|
12
|
-
minimumFractionDigits: 2,
|
|
13
|
-
maximumFractionDigits: 2,
|
|
14
|
-
}).format(amount);
|
|
15
|
-
}
|
|
16
|
-
function formatPercentage(value, locale, decimalPrecision = 2) {
|
|
17
|
-
if (value === null || value === undefined || isNaN(value))
|
|
18
|
-
return '';
|
|
19
|
-
return new Intl.NumberFormat(locale, {
|
|
20
|
-
style: 'percent',
|
|
21
|
-
minimumFractionDigits: decimalPrecision,
|
|
22
|
-
maximumFractionDigits: decimalPrecision,
|
|
23
|
-
}).format(value / 100);
|
|
24
|
-
}
|
|
25
|
-
function formatDate(value, locale) {
|
|
26
|
-
if (!value)
|
|
27
|
-
return '';
|
|
28
|
-
const date = typeof value === 'string' ? new Date(value) : value;
|
|
29
|
-
if (isNaN(date.getTime()))
|
|
30
|
-
return '';
|
|
31
|
-
return new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);
|
|
32
|
-
}
|
|
33
|
-
function formatDateTime(value, locale) {
|
|
34
|
-
if (!value)
|
|
35
|
-
return '';
|
|
36
|
-
const date = typeof value === 'string' ? new Date(value) : value;
|
|
37
|
-
if (isNaN(date.getTime()))
|
|
38
|
-
return '';
|
|
39
|
-
return new Intl.DateTimeFormat(locale, {
|
|
40
|
-
year: 'numeric',
|
|
41
|
-
month: '2-digit',
|
|
42
|
-
day: '2-digit',
|
|
43
|
-
hour: '2-digit',
|
|
44
|
-
minute: '2-digit',
|
|
45
|
-
}).format(date);
|
|
46
|
-
}
|
|
47
|
-
function formatTime(value, locale) {
|
|
48
|
-
if (!value)
|
|
49
|
-
return '';
|
|
50
|
-
// value is HH:MM or HH:MM:SS
|
|
51
|
-
const [hours, minutes] = value.split(':').map(Number);
|
|
52
|
-
const date = new Date();
|
|
53
|
-
date.setHours(hours, minutes, 0, 0);
|
|
54
|
-
return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date);
|
|
55
|
-
}
|
|
56
|
-
function parseLocalizedNumber(str, locale) {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
58
|
-
if (!str || !str.trim())
|
|
59
|
-
return null;
|
|
60
|
-
// Detect decimal and thousands separators from the locale
|
|
61
|
-
const parts = new Intl.NumberFormat(locale).formatToParts(1234567.89);
|
|
62
|
-
const groupSep = (_b = (_a = parts.find((p) => p.type === 'group')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ',';
|
|
63
|
-
const decimalSep = (_d = (_c = parts.find((p) => p.type === 'decimal')) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '.';
|
|
64
|
-
// Remove group separators, replace decimal separator with '.'
|
|
65
|
-
const normalized = str
|
|
66
|
-
.replace(new RegExp(`\\${groupSep}`, 'g'), '')
|
|
67
|
-
.replace(new RegExp(`\\${decimalSep}`), '.')
|
|
68
|
-
.replace('%', '')
|
|
69
|
-
.trim();
|
|
70
|
-
const parsed = parseFloat(normalized);
|
|
71
|
-
return isNaN(parsed) ? null : parsed;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { formatDateTime as a, formatDate as b, formatCurrency as c, formatNumber as d, formatPercentage as e, formatTime as f, parseLocalizedNumber as p };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,c as e,h as i,H as d,g as o}from"./p-_tsCCkAi.js";import{ClientLayoutItemFieldDataType as t,ClientLayoutItemType as l,ClientLayoutItemRelationDisplayType as a,ClientLayoutItemRelationEditBehavior as s}from"./index.esm.js";import{p as n,d as m}from"./p-Dt-aHxkM.js";const c=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value=!1,this.required=!1,this.disabled=!1,this.locale=navigator.language,this.checked=!1,this.handleChange=r=>{this.checked=r.target.checked,this.mrdChange.emit({name:this.name,value:this.checked})},this.handleBlur=()=>{this.mrdBlur.emit({name:this.name,value:this.checked})}}componentWillLoad(){this.checked=!!this.value}render(){return i(d,{key:"aed1d936d686870114a12aad9fc4cccb76ecd31e"},i("div",{key:"5cc8aaa0f12d4195d02fce8a810d7d993e2e8c99",class:"mrd-boolean-field"},i("label",{key:"41c3b3e0f01778fc2654ba86e3fe4e5a07c8537a",class:"mrd-boolean-field__toggle-label"},i("input",{key:"c261e6903e050d2f3d8df8abb90c74d99ed20161",class:"mrd-boolean-field__checkbox",type:"checkbox",name:this.name,checked:this.checked,disabled:this.disabled,onChange:this.handleChange,onBlur:this.handleBlur}),i("span",{key:"079ee220fe692536af15a7fb4286626102ae940e",class:"mrd-boolean-field__toggle","aria-hidden":"true"}),this.label&&i("span",{key:"1f4f52a41f0bd6ba4c61cf9d4db74ab2f1aa8877",class:"mrd-boolean-field__text"+(this.required?" mrd-boolean-field__text--required":"")},this.label))))}};c.style=".sc-mrd-boolean-field-h{display:block}.mrd-boolean-field.sc-mrd-boolean-field{display:flex;align-items:center;width:100%}.mrd-boolean-field__toggle-label.sc-mrd-boolean-field{display:flex;align-items:center;gap:var(--mrd-space-3);cursor:pointer;user-select:none}.mrd-boolean-field__checkbox.sc-mrd-boolean-field{position:absolute;opacity:0;width:0;height:0;pointer-events:none}.mrd-boolean-field__checkbox.sc-mrd-boolean-field:checked+.mrd-boolean-field__toggle.sc-mrd-boolean-field{background-color:var(--mrd-color-primary)}.mrd-boolean-field__checkbox.sc-mrd-boolean-field:checked+.mrd-boolean-field__toggle.sc-mrd-boolean-field::after{transform:translateX(20px)}.mrd-boolean-field__checkbox.sc-mrd-boolean-field:focus+.mrd-boolean-field__toggle.sc-mrd-boolean-field{box-shadow:var(--mrd-shadow-focus)}.mrd-boolean-field__checkbox.sc-mrd-boolean-field:disabled+.mrd-boolean-field__toggle.sc-mrd-boolean-field{opacity:0.5;cursor:not-allowed}.mrd-boolean-field__toggle.sc-mrd-boolean-field{position:relative;display:inline-block;width:44px;height:24px;background-color:var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius-full);transition:background-color var(--mrd-transition);flex-shrink:0}.mrd-boolean-field__toggle.sc-mrd-boolean-field::after{content:'';position:absolute;top:2px;left:2px;width:20px;height:20px;background-color:var(--mrd-color-white);border-radius:50%;transition:transform var(--mrd-transition);box-shadow:var(--mrd-shadow-sm)}.mrd-boolean-field__text.sc-mrd-boolean-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-boolean-field__text--required.sc-mrd-boolean-field::after{content:' *';color:var(--mrd-color-danger)}";const f={nl:{required:"Dit veld is verplicht",select_placeholder:"Selecteer een optie",search_placeholder:"Zoeken...",upload_file:"Bestand uploaden",choose_file:"Bestand kiezen",clear:"Wissen",today:"Vandaag",invalid_email:"Voer een geldig e-mailadres in",invalid_url:"Voer een geldige URL in",invalid_number:"Voer een geldig getal in",drop_file_here:"Sleep bestand hierheen of",browse:"bladeren",file_too_large:"Bestand is te groot",search_results:"Zoekresultaten",no_results:"Geen resultaten gevonden",loading:"Laden...",submit:"Opslaan",cancel:"Annuleren",remove:"Verwijderen",add:"Toevoegen",yes:"Ja",no:"Nee"},en:{required:"This field is required",select_placeholder:"Select an option",search_placeholder:"Search...",upload_file:"Upload file",choose_file:"Choose file",clear:"Clear",today:"Today",invalid_email:"Please enter a valid email address",invalid_url:"Please enter a valid URL",invalid_number:"Please enter a valid number",drop_file_here:"Drop file here or",browse:"browse",file_too_large:"File is too large",search_results:"Search results",no_results:"No results found",loading:"Loading...",submit:"Save",cancel:"Cancel",remove:"Remove",add:"Add",yes:"Yes",no:"No"},ar:{required:"هذا الحقل مطلوب",select_placeholder:"اختر خياراً",search_placeholder:"بحث...",upload_file:"رفع ملف",choose_file:"اختر ملفاً",clear:"مسح",today:"اليوم",invalid_email:"يرجى إدخال عنوان بريد إلكتروني صحيح",invalid_url:"يرجى إدخال رابط صحيح",invalid_number:"يرجى إدخال رقم صحيح",drop_file_here:"اسحب الملف هنا أو",browse:"تصفح",file_too_large:"الملف كبير جداً",search_results:"نتائج البحث",no_results:"لم يتم العثور على نتائج",loading:"جار التحميل...",submit:"حفظ",cancel:"إلغاء",remove:"إزالة",add:"إضافة",yes:"نعم",no:"لا"}};function h(r,e){var i,d,o;const t=e.split("-")[0].toLowerCase();return null!==(o=null!==(d=(null!==(i=f[t])&&void 0!==i?i:f.en)[r])&&void 0!==d?d:f.en[r])&&void 0!==o?o:r}function u(r){return null!=r&&("string"==typeof r?r.trim().length>0:Array.isArray(r)?r.length>0:"object"!=typeof r||!("amount"in r)||null!=r.amount&&""!==r.amount)}const b=["EUR","USD","GBP","CHF","JPY","CNY","AUD","CAD","SEK","NOK","DKK","NZD","SGD","HKD","PLN","CZK","HUF","MXN","BRL","INR","TRY","ZAR","AED","SAR"],v=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value={amount:null,currency:"EUR"},this.required=!1,this.disabled=!1,this.locale=navigator.language,this.amountDisplay="",this.currency="EUR",this.error="",this.handleAmountInput=r=>{this.amountDisplay=r.target.value},this.handleAmountBlur=r=>{const e=r.target.value,i=n(e,this.locale);this.error=this.required&&!u(e)?h("required",this.locale):"";const d={amount:i,currency:this.currency};this.mrdChange.emit({name:this.name,value:d}),this.mrdBlur.emit({name:this.name,value:d})},this.handleCurrencyChange=r=>{this.currency=r.target.value;const e=n(this.amountDisplay,this.locale);this.mrdChange.emit({name:this.name,value:{amount:e,currency:this.currency}})}}componentWillLoad(){this.value&&(this.currency=this.value.currency||"EUR",this.amountDisplay=null!==this.value.amount?String(this.value.amount):"")}render(){const r=!!this.error;return i(d,{key:"d3450e9c26b1a755d3e6a5a3561d93b2ac566a28"},i("div",{key:"b66942cc1953daff728504deef8a9cc1330ef549",class:"mrd-currency-field"},this.label&&i("label",{key:"3d3f2f06e9ffea944552f0f7cf3150d0246c54f0",class:"mrd-currency-field__label"+(this.required?" mrd-currency-field__label--required":"")},this.label),i("div",{key:"d30a2adfceefdbefef2d4fe6633a163a753b15d0",class:"mrd-currency-field__row"},i("input",{key:"9af09b19b6cbe24498d6ca8edf7b28f675afdec5",class:"mrd-currency-field__amount"+(r?" mrd-currency-field__amount--error":""),type:"text",inputMode:"decimal",name:`${this.name}_amount`,value:this.amountDisplay,placeholder:"0.00",required:this.required,disabled:this.disabled,onInput:this.handleAmountInput,onBlur:this.handleAmountBlur}),i("select",{key:"21e55b04b7bf16586b5cfaa82d77db45c6dedf21",class:"mrd-currency-field__currency",disabled:this.disabled,onChange:this.handleCurrencyChange},b.map((r=>i("option",{key:r,value:r,selected:r===this.currency},r))))),r&&i("span",{key:"7a0006d4230557cf9c58f82f21de73b5d12f7e17",class:"mrd-currency-field__error"},this.error)))}};v.style=".sc-mrd-currency-field-h{display:block}.mrd-currency-field.sc-mrd-currency-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-currency-field__label.sc-mrd-currency-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-currency-field__label--required.sc-mrd-currency-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-currency-field__row.sc-mrd-currency-field{display:flex;gap:var(--mrd-space-2);align-items:stretch}.mrd-currency-field__amount.sc-mrd-currency-field{flex:1;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;text-align:right;box-sizing:border-box}.mrd-currency-field__amount.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__amount.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__amount--error.sc-mrd-currency-field{border-color:var(--mrd-border-color-error)}.mrd-currency-field__amount--error.sc-mrd-currency-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-currency-field__currency.sc-mrd-currency-field{width:90px;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-input-color);background-color:var(--mrd-color-neutral-50);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;cursor:pointer;box-sizing:border-box;appearance:none;text-align:center}.mrd-currency-field__currency.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__currency.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__error.sc-mrd-currency-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const p=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleChange=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=r=>{this.mrdBlur.emit({name:this.name,value:r.target.value})}}render(){const r=!!this.error;return i(d,{key:"84c777fc68a95e0b1ceb08d61e3af7afa199ce94"},i("div",{key:"6653d94ab79c74342ce792792547018e4464a814",class:"mrd-date-field"},this.label&&i("label",{key:"2fa7b7ec50c784f9410ca48b93d50e39dc6e0bee",class:"mrd-date-field__label"+(this.required?" mrd-date-field__label--required":"")},this.label),i("input",{key:"f79ebbaf0e28ad7668a5400d1df514b66457b72d",class:"mrd-date-field__input"+(r?" mrd-date-field__input--error":""),type:"date",name:this.name,value:this.value,required:this.required,disabled:this.disabled,onChange:this.handleChange,onBlur:this.handleBlur}),r&&i("span",{key:"e52f0b720d76e8ba0586fb40395b6875860762db",class:"mrd-date-field__error"},this.error)))}};p.style=".sc-mrd-date-field-h{display:block}.mrd-date-field.sc-mrd-date-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-date-field__label.sc-mrd-date-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-date-field__label--required.sc-mrd-date-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-date-field__input.sc-mrd-date-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-date-field__input.sc-mrd-date-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-date-field__input.sc-mrd-date-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-date-field__input--error.sc-mrd-date-field{border-color:var(--mrd-border-color-error)}.mrd-date-field__input--error.sc-mrd-date-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-date-field__error.sc-mrd-date-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const _=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleChange=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=r=>{this.mrdBlur.emit({name:this.name,value:r.target.value})}}render(){const r=!!this.error;return i(d,{key:"79331514eedaf208598a440423da6c154d0d516c"},i("div",{key:"a02a65bdef03a4243b700a68e32722a30781fa45",class:"mrd-datetime-field"},this.label&&i("label",{key:"adcf653253f64e8686b33211da4a5e8597b0786a",class:"mrd-datetime-field__label"+(this.required?" mrd-datetime-field__label--required":"")},this.label),i("input",{key:"49a9fba058d2857c476d8ff038766f8b19b21a41",class:"mrd-datetime-field__input"+(r?" mrd-datetime-field__input--error":""),type:"datetime-local",name:this.name,value:this.value,required:this.required,disabled:this.disabled,onChange:this.handleChange,onBlur:this.handleBlur}),r&&i("span",{key:"6d0d822b7cce825121b4abc77425442eb2556d76",class:"mrd-datetime-field__error"},this.error)))}};_.style=".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)}";const g=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleInput=r=>{this.mrdChange.emit({name:this.name,value:r.target.value})},this.handleBlur=r=>{const e=r.target.value;var i;this.error=this.required&&!u(e)?h("required",this.locale):e&&(i=e)&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)?h("invalid_email",this.locale):"",this.mrdBlur.emit({name:this.name,value:e})}}render(){const r=!!this.error;return i(d,{key:"851ec092957ab86e811b292eaabe29d04a600fe0"},i("div",{key:"2d8969d60378f3161656369494549d682de8ec0e",class:"mrd-email-field"},this.label&&i("label",{key:"7a35cc60d4804097e1a54f984c7da1829f6bbd11",class:"mrd-email-field__label"+(this.required?" mrd-email-field__label--required":"")},this.label),i("input",{key:"1fc20e860aa021886f7ed522c3a0c8dd2cb1e093",class:"mrd-email-field__input"+(r?" mrd-email-field__input--error":""),type:"email",name:this.name,value:this.value,placeholder:this.placeholder||"name@example.com",required:this.required,disabled:this.disabled,onInput:this.handleInput,onBlur:this.handleBlur}),r&&i("span",{key:"a44b3b41b7cd6b8c643cc64e6aadd884a2ba4961",class:"mrd-email-field__error"},this.error)))}};g.style=".sc-mrd-email-field-h{display:block}.mrd-email-field.sc-mrd-email-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-email-field__label.sc-mrd-email-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-email-field__label--required.sc-mrd-email-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-email-field__input.sc-mrd-email-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}.mrd-email-field__input.sc-mrd-email-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-email-field__input.sc-mrd-email-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-email-field__input.sc-mrd-email-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-email-field__input--error.sc-mrd-email-field{border-color:var(--mrd-border-color-error)}.mrd-email-field__input--error.sc-mrd-email-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-email-field__error.sc-mrd-email-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const y=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.mrdSearch=e(this,"mrdSearch"),this.mrdFetchAll=e(this,"mrdFetchAll"),this.locale=navigator.language,this.handleChange=r=>{r.stopPropagation(),this.mrdChange.emit(r.detail)},this.handleBlur=r=>{r.stopPropagation(),this.mrdBlur.emit(r.detail)},this.handleSearch=r=>{r.stopPropagation(),this.mrdSearch.emit(r.detail)},this.handleFetchAll=r=>{r.stopPropagation(),this.mrdFetchAll.emit(r.detail)}}render(){var r,e,o,s,n,m,c,f,h,u,b,v,p,_,g,y,x,w,k,z,q,C,j,B,O,D,S,A,F,R,M;const{item:L,locale:E,value:N}=this;if(L.type===l.RELATION&&L.relation){const t=L.relation;return i(d,null,i("mrd-relation-field",{name:t.name,label:t.label,required:t.required,disabled:null!==(r=t.disabled)&&void 0!==r&&r,locale:E,relatedClass:t.relatedClass,mostSignificantClass:null!==(e=t.mostSignificantClass)&&void 0!==e?e:"",displayType:null!==(o=t.displayType)&&void 0!==o?o:a.SEARCH,editBehavior:null!==(s=t.editBehavior)&&void 0!==s?s:null,commonRelation:t.commonRelation,multiple:null!==(n=t.multiple)&&void 0!==n&&n,dropdownValues:null!==(m=t.dropdownValues)&&void 0!==m?m:[],value:N,onMrdChange:this.handleChange,onMrdBlur:this.handleBlur,onMrdSearch:this.handleSearch,onMrdFetchAll:this.handleFetchAll}))}if(L.type!==l.FIELD||!L.field)return i(d,null);const U=L.field,I={name:U.name,label:U.label,required:U.required,disabled:null!==(c=U.disabled)&&void 0!==c&&c,locale:E,onMrdChange:this.handleChange,onMrdBlur:this.handleBlur};switch(U.dataType){case t.TEXT:return i(d,null,i("mrd-text-field",Object.assign({},I,{value:null!==(f=N)&&void 0!==f?f:"",placeholder:null!==(h=U.placeholder)&&void 0!==h?h:""})));case t.TEXTBLOCK:return i(d,null,i("mrd-textarea-field",Object.assign({},I,{value:null!==(u=N)&&void 0!==u?u:"",placeholder:null!==(b=U.placeholder)&&void 0!==b?b:""})));case t.INTEGER:case t.DECIMAL:case t.PERCENTAGE:return i(d,null,i("mrd-number-field",Object.assign({},I,{value:null!==(v=N)&&void 0!==v?v:null,dataType:U.dataType,decimalPrecision:null!==(p=U.decimalPrecision)&&void 0!==p?p:2,placeholder:null!==(_=U.placeholder)&&void 0!==_?_:""})));case t.CURRENCY:return i(d,null,i("mrd-currency-field",Object.assign({},I,{value:null!==(g=N)&&void 0!==g?g:{amount:null,currency:null!==(y=U.currencyCode)&&void 0!==y?y:"EUR"}})));case t.BOOLEAN:return i(d,null,i("mrd-boolean-field",Object.assign({},I,{value:null!==(x=N)&&void 0!==x&&x})));case t.DATE:return i(d,null,i("mrd-date-field",Object.assign({},I,{value:null!==(w=N)&&void 0!==w?w:""})));case t.DATETIME:return i(d,null,i("mrd-datetime-field",Object.assign({},I,{value:null!==(k=N)&&void 0!==k?k:""})));case t.TIME:return i(d,null,i("mrd-time-field",Object.assign({},I,{value:null!==(z=N)&&void 0!==z?z:""})));case t.EMAIL:return i(d,null,i("mrd-email-field",Object.assign({},I,{value:null!==(q=N)&&void 0!==q?q:"",placeholder:null!==(C=U.placeholder)&&void 0!==C?C:""})));case t.HYPERLINK:return i(d,null,i("mrd-hyperlink-field",Object.assign({},I,{value:null!==(j=N)&&void 0!==j?j:"",placeholder:null!==(B=U.placeholder)&&void 0!==B?B:""})));case t.LIST:return i(d,null,i("mrd-list-field",Object.assign({},I,{value:null!==(O=N)&&void 0!==O?O:"",multiple:null!==(D=U.multiple)&&void 0!==D&&D,listItems:null!==(S=U.listItems)&&void 0!==S?S:[]})));case t.FILE:return i(d,null,i("mrd-file-field",Object.assign({},I,{accept:null!==(A=U.accept)&&void 0!==A?A:"",maxSize:null!==(F=U.maxSize)&&void 0!==F?F:0})));case t.IMAGE:return i(d,null,i("mrd-image-field",Object.assign({},I,{accept:null!==(R=U.accept)&&void 0!==R?R:"image/*",maxSize:null!==(M=U.maxSize)&&void 0!==M?M:0})));default:return i(d,null)}}},x=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.accept="",this.maxSize=0,this.fileName="",this.isDragging=!1,this.error="",this.handleInputChange=r=>{var e;const i=r.target.files;this.handleFile(null!==(e=null==i?void 0:i[0])&&void 0!==e?e:null)},this.handleDragOver=r=>{r.preventDefault(),this.isDragging=!0},this.handleDragLeave=()=>{this.isDragging=!1},this.handleDrop=r=>{var e,i,d;r.preventDefault(),this.isDragging=!1;const o=null!==(d=null===(i=null===(e=r.dataTransfer)||void 0===e?void 0:e.files)||void 0===i?void 0:i[0])&&void 0!==d?d:null;this.handleFile(o)},this.handleZoneClick=()=>{var r;this.disabled||null===(r=this.fileInputRef)||void 0===r||r.click()},this.handleClear=r=>{r.stopPropagation(),this.fileName="",this.error="",this.fileInputRef&&(this.fileInputRef.value=""),this.mrdChange.emit({name:this.name,value:null})}}handleFile(r){if(!r)return this.fileName="",void this.mrdChange.emit({name:this.name,value:null});this.maxSize>0&&r.size>this.maxSize?this.error=h("file_too_large",this.locale):(this.error="",this.fileName=r.name,this.mrdChange.emit({name:this.name,value:r}))}render(){const r=!!this.error;return i(d,{key:"6617c70edaf193c204a951ff8116d54742592f84"},i("div",{key:"69a45446da411c1cfdadd9ee7051e3ceea95a2d2",class:"mrd-file-field"},this.label&&i("label",{key:"ca415565514c5a3829b1e4a446493916bd1b5b17",class:"mrd-file-field__label"+(this.required?" mrd-file-field__label--required":"")},this.label),i("div",{key:"abee0fc6a53c9f1266e6ed2d0ec8ab85a20a81ca",class:`mrd-file-field__zone${this.isDragging?" mrd-file-field__zone--dragging":""}${r?" mrd-file-field__zone--error":""}${this.disabled?" mrd-file-field__zone--disabled":""}`,onClick:this.handleZoneClick,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},i("input",{key:"c1dbca750d4115b7d8ea3dcd9ed3405ed11c93a2",ref:r=>this.fileInputRef=r,class:"mrd-file-field__input",type:"file",name:this.name,accept:this.accept,disabled:this.disabled,required:this.required&&!this.fileName,onChange:this.handleInputChange}),this.fileName?i("div",{class:"mrd-file-field__selected"},i("svg",{class:"mrd-file-field__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i("polyline",{points:"14 2 14 8 20 8"})),i("span",{class:"mrd-file-field__filename"},this.fileName),i("button",{class:"mrd-file-field__clear",type:"button",onClick:this.handleClear,"aria-label":h("clear",this.locale)},"✕")):i("div",{class:"mrd-file-field__prompt"},i("svg",{class:"mrd-file-field__upload-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},i("polyline",{points:"16 16 12 12 8 16"}),i("line",{x1:"12",y1:"12",x2:"12",y2:"21"}),i("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"})),i("span",null,h("drop_file_here",this.locale)," ",i("span",{class:"mrd-file-field__browse"},h("browse",this.locale))))),r&&i("span",{key:"91ef6a6240f139e161288cb812d17e13a619ec89",class:"mrd-file-field__error"},this.error)))}};x.style=".sc-mrd-file-field-h{display:block}.mrd-file-field.sc-mrd-file-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-file-field__label.sc-mrd-file-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-file-field__label--required.sc-mrd-file-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-file-field__zone.sc-mrd-file-field{display:flex;align-items:center;justify-content:center;padding:var(--mrd-space-6);border:2px dashed var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);background-color:var(--mrd-color-neutral-50);cursor:pointer;transition:border-color var(--mrd-transition), background-color var(--mrd-transition);min-height:100px;position:relative}.mrd-file-field__zone.sc-mrd-file-field:hover{border-color:var(--mrd-color-primary);background-color:var(--mrd-color-primary-light)}.mrd-file-field__zone--dragging.sc-mrd-file-field{border-color:var(--mrd-color-primary);background-color:var(--mrd-color-primary-light)}.mrd-file-field__zone--error.sc-mrd-file-field{border-color:var(--mrd-border-color-error)}.mrd-file-field__zone--disabled.sc-mrd-file-field{opacity:0.6;cursor:not-allowed}.mrd-file-field__zone--disabled.sc-mrd-file-field:hover{border-color:var(--mrd-border-color);background-color:var(--mrd-color-neutral-50)}.mrd-file-field__input.sc-mrd-file-field{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer;pointer-events:none}.mrd-file-field__prompt.sc-mrd-file-field{display:flex;flex-direction:column;align-items:center;gap:var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);text-align:center}.mrd-file-field__upload-icon.sc-mrd-file-field{width:32px;height:32px;color:var(--mrd-color-neutral-400)}.mrd-file-field__browse.sc-mrd-file-field{color:var(--mrd-color-primary);font-weight:var(--mrd-font-weight-medium);text-decoration:underline}.mrd-file-field__selected.sc-mrd-file-field{display:flex;align-items:center;gap:var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-700)}.mrd-file-field__icon.sc-mrd-file-field{width:20px;height:20px;color:var(--mrd-color-primary);flex-shrink:0}.mrd-file-field__filename.sc-mrd-file-field{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px}.mrd-file-field__clear.sc-mrd-file-field{background:none;border:none;cursor:pointer;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm);padding:var(--mrd-space-1);border-radius:var(--mrd-border-radius-sm);line-height:1}.mrd-file-field__clear.sc-mrd-file-field:hover{color:var(--mrd-color-danger);background-color:var(--mrd-color-danger-light)}.mrd-file-field__error.sc-mrd-file-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const w=class{constructor(i){r(this,i),this.mrdSubmit=e(this,"mrdSubmit"),this.mrdCancel=e(this,"mrdCancel"),this.mrdSearch=e(this,"mrdSearch"),this.mrdFetchAll=e(this,"mrdFetchAll"),this.locale=navigator.language,this.values={},this.referenceHref="",this.referenceClass="",this.showCancel=!1,this.formValues={},this.errors={},this.submitted=!1,this.handleFieldChange=r=>{const{name:e,value:i}=r.detail,d=this.getHref(this.formValues[e]);this.formValues=Object.assign(Object.assign({},this.formValues),{[e]:i}),this.errors[e]&&(this.errors=Object.assign(Object.assign({},this.errors),{[e]:""}));const o=this.getHref(i);if(o!==d)for(const r of this.collectDependentDropdowns())r.commonRelation===e&&(this.formValues=Object.assign(Object.assign({},this.formValues),{[r.name]:null}),this.mrdFetchAll.emit({name:r.name,relatedClass:r.relatedClass,mostSignificantClass:r.mostSignificantClass,commonRelation:r.commonRelation,filter:r.commonRelation,filterValue:o}))},this.handleSearch=r=>{r.stopPropagation(),this.mrdSearch.emit(r.detail)},this.handleFetchAll=r=>{r.stopPropagation(),this.mrdFetchAll.emit(r.detail)},this.handleSubmit=r=>{r.preventDefault(),this.submitted=!0,this.validate()&&this.mrdSubmit.emit(this.buildSubmitPayload())}}componentWillLoad(){var r;this.formValues=Object.assign({},null!==(r=this.values)&&void 0!==r?r:{})}componentDidLoad(){setTimeout((()=>{this.applyReferenceValue(),this.emitDependentFetchAll()}),0)}valuesChanged(r){this.formValues=Object.assign({},null!=r?r:{}),this.applyReferenceValue(),this.errors={},this.submitted=!1,setTimeout((()=>this.emitDependentFetchAll()),0)}applyReferenceValue(){if(!this.referenceHref||!this.referenceClass)return;const r=this.resolveReferenceFieldName();r&&(this.formValues[r]||(this.formValues=Object.assign(Object.assign({},this.formValues),{[r]:this.referenceHref})))}resolveReferenceFieldName(){var r,e;const i=this.collectFields(null!==(e=null===(r=this.layout)||void 0===r?void 0:r.items)&&void 0!==e?e:[]),d=i.find((r=>{var e;return r.type===l.RELATION&&(null===(e=r.relation)||void 0===e?void 0:e.mostSignificantClass)===this.referenceClass}));if(null==d?void 0:d.relation)return d.relation.name;const o=new Set(i.filter((r=>r.type===l.RELATION)).map((r=>r.relation.name)));for(const r of i){const e=r.relation;if(r.type===l.RELATION&&(null==e?void 0:e.editBehavior)===s.DROPDOWN&&e.commonRelation&&!o.has(e.commonRelation))return e.commonRelation}return null}async setFieldValue(r,e){this.formValues=Object.assign(Object.assign({},this.formValues),{[r]:e}),this.errors[r]&&(this.errors=Object.assign(Object.assign({},this.errors),{[r]:""}))}collectDependentDropdowns(){var r,e;return this.collectFields(null!==(e=null===(r=this.layout)||void 0===r?void 0:r.items)&&void 0!==e?e:[]).filter((r=>{var e;return r.type===l.RELATION&&(null===(e=r.relation)||void 0===e?void 0:e.editBehavior)===s.DROPDOWN&&!!r.relation.commonRelation})).map((r=>r.relation))}emitDependentFetchAll(){for(const r of this.collectDependentDropdowns()){const e=this.getHref(this.formValues[r.commonRelation]);e&&this.mrdFetchAll.emit({name:r.name,relatedClass:r.relatedClass,mostSignificantClass:r.mostSignificantClass,commonRelation:r.commonRelation,filter:r.commonRelation,filterValue:e})}}getHref(r){return r?"string"==typeof r?r:"object"==typeof r&&"id"in r?r.id:"":""}collectFields(r){const e=[];for(const i of r)i.type!==l.FIELD&&i.type!==l.RELATION||e.push(i),i.items&&e.push(...this.collectFields(i.items));return e}validate(){var r,e,i;const d={},o=this.collectFields(null!==(e=null===(r=this.layout)||void 0===r?void 0:r.items)&&void 0!==e?e:[]);for(const r of o){const e=null!==(i=r.field)&&void 0!==i?i:r.relation;e&&e.required&&!u(this.formValues[e.name])&&(d[e.name]=h("required",this.locale))}return this.errors=d,0===Object.keys(d).length}buildSubmitPayload(){var r,e;const i={},d=this.collectFields(null!==(e=null===(r=this.layout)||void 0===r?void 0:r.items)&&void 0!==e?e:[]);for(const r of d)if(r.type===l.FIELD&&r.field){const e=r.field.name,d=this.formValues[e];""!==d&&(i[e]=null!=d?d:null)}else if(r.type===l.RELATION&&r.relation){const e=r.relation.name,d=this.formValues[e];null!==d&&"object"==typeof d&&!Array.isArray(d)&&"id"in d?i[e]=d.id:""!==d&&void 0!==d&&(i[e]=null!=d?d:null)}return i}renderItems(r){return r.map((r=>{var e,d,o,t;if(r.type===l.SECTION)return i("fieldset",{class:"mrd-form__section"},r.label&&i("legend",{class:"mrd-form__section-legend"},r.label),i("div",{class:"mrd-form__section-body"},r.items&&this.renderItems(r.items)));if(r.type===l.GROUP)return i("div",{class:"mrd-form__group"},r.label&&i("div",{class:"mrd-form__group-label"},r.label),i("div",{class:"mrd-form__group-body"},r.items&&this.renderItems(r.items)));const a=null!==(t=null!==(d=null===(e=r.field)||void 0===e?void 0:e.name)&&void 0!==d?d:null===(o=r.relation)||void 0===o?void 0:o.name)&&void 0!==t?t:"";return i("div",{class:"mrd-form__field"},i("mrd-field",{item:r,locale:this.locale,value:this.formValues[a],onMrdChange:this.handleFieldChange,onMrdBlur:this.handleFieldChange,onMrdSearch:this.handleSearch,onMrdFetchAll:this.handleFetchAll}),this.errors[a]&&i("span",{class:"mrd-form__field-error"},this.errors[a]))}))}render(){if(!this.layout)return i(d,null);const r=this.locale.startsWith("ar")?"rtl":"ltr";return i(d,null,i("form",{class:"mrd-form",dir:r,onSubmit:this.handleSubmit,noValidate:!0},this.layout.title&&i("h2",{class:"mrd-form__title"},this.layout.title),i("div",{class:"mrd-form__body"},this.renderItems(this.layout.items)),i("div",{class:"mrd-form__footer"},i("button",{type:"submit",class:"mrd-form__submit"},h("submit",this.locale)),this.showCancel&&i("button",{type:"button",class:"mrd-form__cancel",onClick:()=>this.mrdCancel.emit()},h("cancel",this.locale)))))}static get watchers(){return{values:[{valuesChanged:0}]}}};w.style=".sc-mrd-form-h{display:block}.mrd-form.sc-mrd-form{font-family:var(--mrd-font-family);width:100%}.mrd-form__title.sc-mrd-form{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);margin:0 0 var(--mrd-space-6) 0}.mrd-form__body.sc-mrd-form{display:flex;flex-direction:column;gap:var(--mrd-space-5)}.mrd-form__field.sc-mrd-form{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-form__field-error.sc-mrd-form{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}.mrd-form__section.sc-mrd-form{border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);padding:var(--mrd-space-4) var(--mrd-space-5);margin:0}.mrd-form__section-legend.sc-mrd-form{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-700);padding:0 var(--mrd-space-2)}.mrd-form__section-body.sc-mrd-form{display:flex;flex-direction:column;gap:var(--mrd-space-4);margin-top:var(--mrd-space-2)}.mrd-form__group.sc-mrd-form{display:flex;flex-direction:column;gap:var(--mrd-space-2)}.mrd-form__group-label.sc-mrd-form{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);text-transform:uppercase;letter-spacing:0.05em}.mrd-form__group-body.sc-mrd-form{display:flex;flex-direction:column;gap:var(--mrd-space-4);padding-left:var(--mrd-space-4);border-left:3px solid var(--mrd-color-neutral-200)}.mrd-form__footer.sc-mrd-form{margin-top:var(--mrd-space-8);padding-top:var(--mrd-space-5);border-top:var(--mrd-border-width) solid var(--mrd-border-color);display:flex;justify-content:flex-end;gap:var(--mrd-space-3)}.mrd-form__submit.sc-mrd-form{display:inline-flex;align-items:center;justify-content:center;height:var(--mrd-input-height);padding:0 var(--mrd-space-6);background-color:var(--mrd-color-primary);color:var(--mrd-color-white);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-medium);border:none;border-radius:var(--mrd-border-radius);cursor:pointer;transition:background-color var(--mrd-transition)}.mrd-form__submit.sc-mrd-form:hover{background-color:var(--mrd-color-primary-hover)}.mrd-form__submit.sc-mrd-form:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-form__submit.sc-mrd-form:active{background-color:var(--mrd-color-primary-dark)}.mrd-form__cancel.sc-mrd-form{display:inline-flex;align-items:center;justify-content:center;height:var(--mrd-input-height);padding:0 var(--mrd-space-6);background-color:transparent;color:var(--mrd-color-neutral-600);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-medium);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;transition:background-color var(--mrd-transition), color var(--mrd-transition)}.mrd-form__cancel.sc-mrd-form:hover{background-color:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-800)}.mrd-form__cancel.sc-mrd-form:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-form__cancel.sc-mrd-form:active{background-color:var(--mrd-color-neutral-200)}";const k=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleInput=r=>{this.mrdChange.emit({name:this.name,value:r.target.value})},this.handleBlur=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):e&&!function(r){if(!r)return!0;try{return new URL(r),!0}catch(r){return!1}}(e)?h("invalid_url",this.locale):"",this.mrdBlur.emit({name:this.name,value:e})}}render(){const r=!!this.error;return i(d,{key:"4f642cb037c6e25786593dbf0cbead71ce34580c"},i("div",{key:"c679d95924bc2d22089c435ec15a35132a4a062d",class:"mrd-hyperlink-field"},this.label&&i("label",{key:"b391dd2d152c68fe75517926c40779313a23b9d9",class:"mrd-hyperlink-field__label"+(this.required?" mrd-hyperlink-field__label--required":"")},this.label),i("input",{key:"ea0d2aba8520ecbde4df8e4507e0f16bd497baa9",class:"mrd-hyperlink-field__input"+(r?" mrd-hyperlink-field__input--error":""),type:"url",name:this.name,value:this.value,placeholder:this.placeholder||"https://",required:this.required,disabled:this.disabled,onInput:this.handleInput,onBlur:this.handleBlur}),r&&i("span",{key:"fab1d90c726b69c6c43c7997fd1b7480678c2c78",class:"mrd-hyperlink-field__error"},this.error)))}};k.style=".sc-mrd-hyperlink-field-h{display:block}.mrd-hyperlink-field.sc-mrd-hyperlink-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-hyperlink-field__label.sc-mrd-hyperlink-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-hyperlink-field__label--required.sc-mrd-hyperlink-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-hyperlink-field__input.sc-mrd-hyperlink-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}.mrd-hyperlink-field__input.sc-mrd-hyperlink-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-hyperlink-field__input.sc-mrd-hyperlink-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-hyperlink-field__input.sc-mrd-hyperlink-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-hyperlink-field__input--error.sc-mrd-hyperlink-field{border-color:var(--mrd-border-color-error)}.mrd-hyperlink-field__input--error.sc-mrd-hyperlink-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-hyperlink-field__error.sc-mrd-hyperlink-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const z=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.accept="image/*",this.maxSize=0,this.previewUrl="",this.fileName="",this.isDragging=!1,this.error="",this.handleInputChange=r=>{var e;const i=r.target.files;this.handleFile(null!==(e=null==i?void 0:i[0])&&void 0!==e?e:null)},this.handleDragOver=r=>{r.preventDefault(),this.isDragging=!0},this.handleDragLeave=()=>{this.isDragging=!1},this.handleDrop=r=>{var e,i,d;r.preventDefault(),this.isDragging=!1;const o=null!==(d=null===(i=null===(e=r.dataTransfer)||void 0===e?void 0:e.files)||void 0===i?void 0:i[0])&&void 0!==d?d:null;this.handleFile(o)},this.handleZoneClick=()=>{var r;this.disabled||null===(r=this.fileInputRef)||void 0===r||r.click()},this.handleClear=r=>{r.stopPropagation(),this.previewUrl="",this.fileName="",this.error="",this.fileInputRef&&(this.fileInputRef.value=""),this.mrdChange.emit({name:this.name,value:null})}}handleFile(r){if(!r)return this.previewUrl="",this.fileName="",void this.mrdChange.emit({name:this.name,value:null});if(this.maxSize>0&&r.size>this.maxSize)return void(this.error=h("file_too_large",this.locale));if(!r.type.startsWith("image/"))return void(this.error="Please select an image file");this.error="",this.fileName=r.name;const e=new FileReader;e.onload=r=>{var e;this.previewUrl=null===(e=r.target)||void 0===e?void 0:e.result},e.readAsDataURL(r),this.mrdChange.emit({name:this.name,value:r})}render(){const r=!!this.error;return i(d,{key:"c188d49744b7044d46b6c6f42126032f1ecc8a8f"},i("div",{key:"53990650a5109172addca5ae274b180569b08860",class:"mrd-image-field"},this.label&&i("label",{key:"3dc78faca422fcafed31833a11307cace9f2ff13",class:"mrd-image-field__label"+(this.required?" mrd-image-field__label--required":"")},this.label),i("div",{key:"4ca9eb1362c999721742ac3d727326078fe844c7",class:`mrd-image-field__zone${this.isDragging?" mrd-image-field__zone--dragging":""}${r?" mrd-image-field__zone--error":""}${this.disabled?" mrd-image-field__zone--disabled":""}`,onClick:this.handleZoneClick,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},i("input",{key:"9e3a237ffb69ce9f6fb20e6b3e603e4db453e7e9",ref:r=>this.fileInputRef=r,class:"mrd-image-field__input",type:"file",name:this.name,accept:this.accept,disabled:this.disabled,required:this.required&&!this.previewUrl,onChange:this.handleInputChange}),this.previewUrl?i("div",{class:"mrd-image-field__preview-container"},i("div",{class:"mrd-image-field__preview-thumb"},i("img",{class:"mrd-image-field__preview",src:this.previewUrl,alt:this.fileName})),i("div",{class:"mrd-image-field__preview-info"},i("span",{class:"mrd-image-field__preview-name"},this.fileName)),i("button",{class:"mrd-image-field__clear",type:"button",onClick:this.handleClear,"aria-label":h("clear",this.locale)},h("remove",this.locale))):i("div",{class:"mrd-image-field__prompt"},i("svg",{class:"mrd-image-field__upload-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},i("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),i("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),i("polyline",{points:"21 15 16 10 5 21"})),i("span",null,h("drop_file_here",this.locale)," ",i("span",{class:"mrd-image-field__browse"},h("browse",this.locale))))),r&&i("span",{key:"85cf998e1ab26cce7fbf87836df25672971a4eb1",class:"mrd-image-field__error"},this.error)))}};z.style=".sc-mrd-image-field-h{display:block}.mrd-image-field.sc-mrd-image-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-image-field__label.sc-mrd-image-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-image-field__label--required.sc-mrd-image-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-image-field__zone.sc-mrd-image-field{display:flex;align-items:center;justify-content:center;border:2px dashed var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);background-color:var(--mrd-color-neutral-50);cursor:pointer;transition:border-color var(--mrd-transition), background-color var(--mrd-transition);min-height:100px;position:relative}.mrd-image-field__zone.sc-mrd-image-field:hover{border-color:var(--mrd-color-primary);background-color:var(--mrd-color-primary-light)}.mrd-image-field__zone--dragging.sc-mrd-image-field{border-color:var(--mrd-color-primary);background-color:var(--mrd-color-primary-light)}.mrd-image-field__zone--error.sc-mrd-image-field{border-color:var(--mrd-border-color-error)}.mrd-image-field__zone--disabled.sc-mrd-image-field{opacity:0.6;cursor:not-allowed}.mrd-image-field__zone--disabled.sc-mrd-image-field:hover{border-color:var(--mrd-border-color);background-color:var(--mrd-color-neutral-50)}.mrd-image-field__input.sc-mrd-image-field{position:absolute;inset:0;opacity:0;width:100%;height:100%;pointer-events:none}.mrd-image-field__prompt.sc-mrd-image-field{display:flex;flex-direction:column;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-6);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);text-align:center}.mrd-image-field__upload-icon.sc-mrd-image-field{width:40px;height:40px;color:var(--mrd-color-neutral-400)}.mrd-image-field__browse.sc-mrd-image-field{color:var(--mrd-color-primary);font-weight:var(--mrd-font-weight-medium);text-decoration:underline}.mrd-image-field__preview-container.sc-mrd-image-field{display:flex;align-items:center;gap:var(--mrd-space-4);padding:var(--mrd-space-4);width:100%}.mrd-image-field__preview-thumb.sc-mrd-image-field{flex-shrink:0;width:80px;height:80px;border-radius:var(--mrd-border-radius);overflow:hidden;border:var(--mrd-border-width) solid var(--mrd-border-color);background-color:var(--mrd-color-neutral-100)}.mrd-image-field__preview.sc-mrd-image-field{width:100%;height:100%;object-fit:cover;display:block}.mrd-image-field__preview-info.sc-mrd-image-field{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-image-field__preview-name.sc-mrd-image-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mrd-image-field__overlay.sc-mrd-image-field{display:none}.mrd-image-field__clear.sc-mrd-image-field{flex-shrink:0;background-color:var(--mrd-color-white);color:var(--mrd-color-danger);border:var(--mrd-border-width) solid var(--mrd-color-danger);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-1) var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);cursor:pointer;transition:background-color var(--mrd-transition), color var(--mrd-transition)}.mrd-image-field__clear.sc-mrd-image-field:hover{background-color:var(--mrd-color-danger);color:var(--mrd-color-white)}.mrd-image-field__error.sc-mrd-image-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const q=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.required=!1,this.disabled=!1,this.multiple=!1,this.locale=navigator.language,this.listItems=[],this.error="",this.selected=[],this.handleSelectChange=r=>{const e=r.target;if(this.multiple){const r=Array.from(e.selectedOptions).map((r=>r.value));this.selected=r,this.error=this.required&&!u(r)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:r})}else{const r=e.value;this.error=this.required&&!u(r)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:r})}},this.handleBlur=()=>{this.mrdBlur.emit({name:this.name,value:this.multiple?this.selected:this.value})},this.toggleCheckbox=r=>{this.selected=this.selected.includes(r)?this.selected.filter((e=>e!==r)):[...this.selected,r],this.error=this.required&&!u(this.selected)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:this.selected})}}componentWillLoad(){this.multiple&&(this.selected=Array.isArray(this.value)?this.value:this.value?[this.value]:[])}getContrastColor(r){if(!r)return"#000000";const e=r.replace("#","");return(.299*parseInt(e.substr(0,2),16)+.587*parseInt(e.substr(2,2),16)+.114*parseInt(e.substr(4,2),16))/255>.5?"#000000":"#ffffff"}render(){var r,e;const o=!!this.error,t=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return i(d,null,i("div",{class:"mrd-list-field"},this.label&&i("label",{class:"mrd-list-field__label"+(this.required?" mrd-list-field__label--required":"")},this.label),this.multiple?i("div",{class:"mrd-list-field__checkbox-list"+(o?" mrd-list-field__checkbox-list--error":"")},this.listItems.map((r=>{var e,d;return i("label",{key:r.key,class:"mrd-list-field__checkbox-item"},i("input",{type:"checkbox",checked:this.selected.includes(r.key),disabled:this.disabled,onChange:()=>this.toggleCheckbox(r.key)}),(r.color||r.backgroundColor)&&i("span",{class:"mrd-list-field__color-dot",style:{backgroundColor:null!==(d=null!==(e=r.backgroundColor)&&void 0!==e?e:r.color)&&void 0!==d?d:""}}),i("span",null,r.label))}))):i("select",{class:"mrd-list-field__select"+(o?" mrd-list-field__select--error":""),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleSelectChange,onBlur:this.handleBlur},i("option",{value:""},h("select_placeholder",this.locale)),this.listItems.map((r=>{var e,d;const o=null!==(d=null!==(e=r.backgroundColor)&&void 0!==e?e:r.color)&&void 0!==d?d:null,l=o?{backgroundColor:o,color:this.getContrastColor(o)}:{};return i("option",{key:r.key,value:r.key,selected:r.key===t,style:l},r.label)}))),o&&i("span",{class:"mrd-list-field__error"},this.error)))}};q.style=".sc-mrd-list-field-h{display:block}.mrd-list-field.sc-mrd-list-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-list-field__label.sc-mrd-list-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-list-field__label--required.sc-mrd-list-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-list-field__select.sc-mrd-list-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);padding-right:calc(var(--mrd-input-padding-x) + 1.5rem);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right var(--mrd-space-3) center;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;cursor:pointer;box-sizing:border-box}.mrd-list-field__select.sc-mrd-list-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-list-field__select.sc-mrd-list-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-list-field__select--error.sc-mrd-list-field{border-color:var(--mrd-border-color-error)}.mrd-list-field__select--error.sc-mrd-list-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-list-field__checkbox-list.sc-mrd-list-field{display:flex;flex-direction:column;gap:var(--mrd-space-2);padding:var(--mrd-space-3);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);background-color:var(--mrd-input-bg)}.mrd-list-field__checkbox-list--error.sc-mrd-list-field{border-color:var(--mrd-border-color-error)}.mrd-list-field__checkbox-item.sc-mrd-list-field{display:flex;align-items:center;gap:var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);cursor:pointer}.mrd-list-field__checkbox-item.sc-mrd-list-field input[type='checkbox'].sc-mrd-list-field{width:1rem;height:1rem;cursor:pointer;accent-color:var(--mrd-color-primary)}.mrd-list-field__color-dot.sc-mrd-list-field{display:inline-block;width:12px;height:12px;border-radius:50%;flex-shrink:0}.mrd-list-field__error.sc-mrd-list-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const C=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value=null,this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.dataType=t.INTEGER,this.decimalPrecision=2,this.displayValue="",this.error="",this.handleInput=r=>{this.displayValue=r.target.value},this.handleBlur=r=>{const e=r.target.value,i=n(e,this.locale);this.error=!this.required||null!==i&&""!==e?""===e||function(r,e){if(null==r||""===r)return!0;const i=Number(r);return!isNaN(i)&&(e===t.INTEGER?Number.isInteger(i):e!==t.PERCENTAGE||i>=0&&i<=100)}(i,this.dataType)?"":h("invalid_number",this.locale):h("required",this.locale),null!==i&&u(e)&&(this.displayValue=this.formatForDisplay(i)),this.mrdChange.emit({name:this.name,value:i}),this.mrdBlur.emit({name:this.name,value:i})},this.handleFocus=()=>{if(null!=this.value){const r=String(this.value);this.displayValue=r}}}componentWillLoad(){null!=this.value&&(this.displayValue=this.formatForDisplay(this.value))}formatForDisplay(r){return this.dataType===t.PERCENTAGE?m(r,this.locale,{minimumFractionDigits:0,maximumFractionDigits:this.decimalPrecision})+"%":m(r,this.locale,this.dataType===t.DECIMAL?{minimumFractionDigits:this.decimalPrecision,maximumFractionDigits:this.decimalPrecision}:{maximumFractionDigits:0})}render(){const r=!!this.error,e=this.dataType===t.PERCENTAGE?"%":"";return i(d,{key:"68d81012d9180dde4160a507121b83f04698834a"},i("div",{key:"b8e46f6d23527b2c95ad2738fc63a07adfce4fda",class:"mrd-number-field"},this.label&&i("label",{key:"c3271c7a8adfd8bcb3b4f51e580239f928a354a5",class:"mrd-number-field__label"+(this.required?" mrd-number-field__label--required":"")},this.label),i("div",{key:"c46b69affd1e22c539511f6743b6d23fe73fb079",class:"mrd-number-field__input-wrapper"},i("input",{key:"e68188829c2e03c947c5605332a2681de550a0d5",class:"mrd-number-field__input"+(r?" mrd-number-field__input--error":""),type:"text",inputMode:"decimal",name:this.name,value:this.displayValue,placeholder:this.placeholder||(e?`0${e}`:"0"),required:this.required,disabled:this.disabled,onInput:this.handleInput,onBlur:this.handleBlur,onFocus:this.handleFocus})),r&&i("span",{key:"bdc2723e2547517765bd64ad70c5103c7a2b363c",class:"mrd-number-field__error"},this.error)))}};C.style=".sc-mrd-number-field-h{display:block}.mrd-number-field.sc-mrd-number-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-number-field__label.sc-mrd-number-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-number-field__label--required.sc-mrd-number-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-number-field__input-wrapper.sc-mrd-number-field{position:relative;display:flex;align-items:center}.mrd-number-field__input.sc-mrd-number-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;text-align:right}.mrd-number-field__input.sc-mrd-number-field::placeholder{color:var(--mrd-input-placeholder-color);text-align:left}.mrd-number-field__input.sc-mrd-number-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-number-field__input.sc-mrd-number-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-number-field__input--error.sc-mrd-number-field{border-color:var(--mrd-border-color-error)}.mrd-number-field__input--error.sc-mrd-number-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-number-field__error.sc-mrd-number-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const j=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.mrdSearch=e(this,"mrdSearch"),this.mrdFetchAll=e(this,"mrdFetchAll"),this.name="",this.label="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.relatedClass="",this.mostSignificantClass="",this.displayType=a.SEARCH,this.multiple=!1,this.dropdownValues=[],this.value=null,this.searchQuery="",this.searchResults=[],this.allRecords=[],this.isLoading=!1,this.selectedItems=[],this.showResults=!1,this.error="",this.highlightedIndex=-1,this.searchDebounce=null,this.handleKeyDown=r=>{this.showResults&&0!==this.searchResults.length?"ArrowDown"===r.key?(r.preventDefault(),this.highlightedIndex=Math.min(this.highlightedIndex+1,this.searchResults.length-1)):"ArrowUp"===r.key?(r.preventDefault(),this.highlightedIndex=Math.max(this.highlightedIndex-1,0)):"Enter"===r.key?(r.preventDefault(),this.highlightedIndex>=0&&this.handleResultSelect(this.searchResults[this.highlightedIndex])):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1)},this.clearSelection=()=>{this.selectedItems=[],this.searchQuery="",this.searchResults=[],this.showResults=!1,this.highlightedIndex=-1,this.mrdChange.emit({name:this.name,value:this.multiple?[]:null})},this.handleSearchInput=r=>{const e=r.target.value;this.searchQuery=e,this.searchDebounce&&clearTimeout(this.searchDebounce),e.trim().length>=2?(this.isLoading=!0,this.showResults=!0,this.searchDebounce=setTimeout((()=>{this.mrdSearch.emit({query:e,relatedClass:this.mostSignificantClass})}),300)):(this.searchResults=[],this.showResults=!1,this.isLoading=!1)},this.handleResultSelect=r=>{if(this.multiple){this.selectedItems.find((e=>e.id===r.id))||(this.selectedItems=[...this.selectedItems,r]),this.searchQuery="",this.searchResults=[],this.showResults=!1;const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:e})}else this.selectedItems=[r],this.searchQuery=r.label,this.showResults=!1,this.mrdChange.emit({name:this.name,value:r.id});this.error=this.required&&!u(this.selectedItems)?h("required",this.locale):""},this.handleRemoveSelected=r=>{this.selectedItems=this.selectedItems.filter((e=>e.id!==r));const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:this.multiple?e:null})},this.handleDropdownChange=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=()=>{var r,e;setTimeout((()=>{this.showResults=!1,this.highlightedIndex=-1}),200);const i=this.multiple?this.selectedItems.map((r=>r.id)):null!==(e=null===(r=this.selectedItems[0])||void 0===r?void 0:r.id)&&void 0!==e?e:null;this.mrdBlur.emit({name:this.name,value:i})}}async setAllRecords(r){this.allRecords=r}async setSearchResults(r){this.searchResults=r,this.isLoading=!1,this.showResults=!0,this.highlightedIndex=-1}async setLoading(r){this.isLoading=r}componentWillLoad(){var r;this.value&&(Array.isArray(this.value)?this.value.length>0&&"object"==typeof this.value[0]&&(this.selectedItems=this.value,this.searchQuery=""):"object"==typeof this.value&&(this.selectedItems=[this.value],this.searchQuery=null!==(r=this.value.label)&&void 0!==r?r:""))}componentDidLoad(){this.editBehavior!==s.DROPDOWN||this.commonRelation||setTimeout((()=>{this.mrdFetchAll.emit({name:this.name,relatedClass:this.relatedClass,mostSignificantClass:this.mostSignificantClass||void 0})}),0)}render(){var r,e,o,t;const l=!!this.error;if(this.editBehavior===s.DROPDOWN){const o=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return i(d,null,i("div",{class:"mrd-relation-field"},this.label&&i("label",{class:"mrd-relation-field__label"+(this.required?" mrd-relation-field__label--required":"")},this.label),i("select",{class:"mrd-relation-field__select"+(l?" mrd-relation-field__select--error":""),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},i("option",{value:""},h("select_placeholder",this.locale)),this.allRecords.map((r=>i("option",{key:r.id,value:r.id,selected:r.id===o},r.label)))),l&&i("span",{class:"mrd-relation-field__error"},this.error)))}if(this.displayType===a.DROPDOWN){const r=Array.isArray(this.value)?null!==(o=this.value[0])&&void 0!==o?o:"":null!==(t=this.value)&&void 0!==t?t:"";return i(d,null,i("div",{class:"mrd-relation-field"},this.label&&i("label",{class:"mrd-relation-field__label"+(this.required?" mrd-relation-field__label--required":"")},this.label),i("select",{class:"mrd-relation-field__select"+(l?" mrd-relation-field__select--error":""),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},i("option",{value:""},h("select_placeholder",this.locale)),this.dropdownValues.map((e=>i("option",{key:e.key,value:e.key,selected:e.key===r},e.label)))),l&&i("span",{class:"mrd-relation-field__error"},this.error)))}const n=this.label&&i("label",{class:"mrd-relation-field__label"+(this.required?" mrd-relation-field__label--required":"")},this.label);return i(d,null,!this.multiple&&this.selectedItems.length>0?i("div",{class:"mrd-relation-field"},n,i("div",{class:"mrd-relation-field__selected-value"+(l?" mrd-relation-field__selected-value--error":"")},i("span",{class:"mrd-relation-field__selected-name"},this.selectedItems[0].label),i("button",{type:"button",class:"mrd-relation-field__selected-clear",onClick:this.clearSelection,"aria-label":h("remove",this.locale)},"✕")),l&&i("span",{class:"mrd-relation-field__error"},this.error)):i("div",{class:"mrd-relation-field"},n,this.multiple&&this.selectedItems.length>0&&i("div",{class:"mrd-relation-field__tags"},this.selectedItems.map((r=>i("span",{key:r.id,class:"mrd-relation-field__tag"},r.label,i("button",{type:"button",class:"mrd-relation-field__tag-remove",onClick:()=>this.handleRemoveSelected(r.id),"aria-label":h("remove",this.locale)},"✕"))))),i("div",{class:"mrd-relation-field__search-wrapper"},i("input",{class:"mrd-relation-field__search"+(l?" mrd-relation-field__search--error":""),type:"text",value:this.searchQuery,placeholder:h("search_placeholder",this.locale),disabled:this.disabled,onInput:this.handleSearchInput,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur}),this.isLoading&&i("span",{class:"mrd-relation-field__spinner","aria-label":h("loading",this.locale)})),this.showResults&&i("div",{class:"mrd-relation-field__results"},0!==this.searchResults.length||this.isLoading?this.searchResults.map(((r,e)=>i("div",{key:r.id,class:"mrd-relation-field__result-item"+(e===this.highlightedIndex?" mrd-relation-field__result-item--highlighted":""),onMouseDown:()=>this.handleResultSelect(r)},i("span",{class:"mrd-relation-field__result-label"},r.label),r.description&&i("span",{class:"mrd-relation-field__result-desc"},r.description)))):i("div",{class:"mrd-relation-field__no-results"},h("no_results",this.locale))),l&&i("span",{class:"mrd-relation-field__error"},this.error)))}};j.style=".sc-mrd-relation-field-h{display:block}.mrd-relation-field.sc-mrd-relation-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%;position:relative}.mrd-relation-field__label.sc-mrd-relation-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-relation-field__label--required.sc-mrd-relation-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-relation-field__select.sc-mrd-relation-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);padding-right:calc(var(--mrd-input-padding-x) + 1.5rem);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right var(--mrd-space-3) center;border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;appearance:none;cursor:pointer;box-sizing:border-box}.mrd-relation-field__select.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__select.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__select--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__select--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__tags.sc-mrd-relation-field{display:flex;flex-wrap:wrap;gap:var(--mrd-space-1);margin-bottom:var(--mrd-space-1)}.mrd-relation-field__tag.sc-mrd-relation-field{display:inline-flex;align-items:center;gap:var(--mrd-space-1);padding:var(--mrd-space-1) var(--mrd-space-2);background-color:var(--mrd-color-primary-light);color:var(--mrd-color-primary-dark);border-radius:var(--mrd-border-radius-full);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__tag-remove.sc-mrd-relation-field{background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-xs);padding:0;line-height:1;opacity:0.7}.mrd-relation-field__tag-remove.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__search-wrapper.sc-mrd-relation-field{position:relative;display:flex;align-items:center}.mrd-relation-field__search.sc-mrd-relation-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);outline:none;appearance:none;box-sizing:border-box}.mrd-relation-field__search.sc-mrd-relation-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-relation-field__search.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__search.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__search--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__search--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__spinner.sc-mrd-relation-field{position:absolute;right:var(--mrd-space-3);width:16px;height:16px;border:2px solid var(--mrd-color-neutral-200);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-spin 0.7s linear infinite}@keyframes mrd-spin{to{transform:rotate(360deg)}}.mrd-relation-field__results.sc-mrd-relation-field{position:absolute;top:calc(100% + var(--mrd-space-1));left:0;right:0;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md);z-index:var(--mrd-z-dropdown);max-height:240px;overflow-y:auto}.mrd-relation-field__result-item.sc-mrd-relation-field{display:flex;flex-direction:column;padding:var(--mrd-space-2) var(--mrd-space-3);cursor:pointer;transition:background-color var(--mrd-transition-fast)}.mrd-relation-field__result-item.sc-mrd-relation-field:hover{background-color:var(--mrd-color-neutral-50)}.mrd-relation-field__result-item.sc-mrd-relation-field:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.mrd-relation-field__result-label.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__result-desc.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-relation-field__result-item--highlighted.sc-mrd-relation-field{background-color:var(--mrd-color-primary-light)}.mrd-relation-field__selected-value.sc-mrd-relation-field{display:flex;align-items:center;gap:var(--mrd-space-2);height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);background-color:var(--mrd-color-primary-light);border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius);box-sizing:border-box}.mrd-relation-field__selected-value--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error);background-color:var(--mrd-color-danger-light)}.mrd-relation-field__selected-name.sc-mrd-relation-field{flex:1;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary-dark);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-relation-field__selected-clear.sc-mrd-relation-field{flex-shrink:0;background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-sm);padding:0;line-height:1;opacity:0.6;transition:opacity var(--mrd-transition-fast)}.mrd-relation-field__selected-clear.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__no-results.sc-mrd-relation-field{padding:var(--mrd-space-4);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);text-align:center}.mrd-relation-field__error.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const B=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleInput=r=>{this.mrdChange.emit({name:this.name,value:r.target.value})},this.handleBlur=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):"",this.mrdBlur.emit({name:this.name,value:e})}}render(){const r=!!this.error;return i(d,{key:"4ddbcb2f8915235631c6f66449b28e664c24c0a4"},i("div",{key:"91dbb52ed715c92d4ef2bc0924fd378d0dc839a8",class:"mrd-text-field"},this.label&&i("label",{key:"cf3278503107d313c08034273916a4b84a16febd",class:"mrd-text-field__label"+(this.required?" mrd-text-field__label--required":"")},this.label),i("input",{key:"9ab992213bfaa372e453331e1b1e12a853c3ae6e",class:"mrd-text-field__input"+(r?" mrd-text-field__input--error":""),type:"text",name:this.name,value:this.value,placeholder:this.placeholder,required:this.required,disabled:this.disabled,onInput:this.handleInput,onBlur:this.handleBlur}),r&&i("span",{key:"a4ff2fdd2490f644eb97f66f15edc5af0b22e823",class:"mrd-text-field__error"},this.error)))}};B.style=".sc-mrd-text-field-h{display:block}.mrd-text-field.sc-mrd-text-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-text-field__label.sc-mrd-text-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-text-field__label--required.sc-mrd-text-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-text-field__input.sc-mrd-text-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}.mrd-text-field__input.sc-mrd-text-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-text-field__input.sc-mrd-text-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-text-field__input.sc-mrd-text-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-text-field__input--error.sc-mrd-text-field{border-color:var(--mrd-border-color-error)}.mrd-text-field__input--error.sc-mrd-text-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-text-field__error.sc-mrd-text-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const O=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.editorReady=!1}componentDidLoad(){this.initQuill()}async initQuill(){try{const r=(await import("./p-CiuCgGz_.js")).default;if(this.editorEl=this.el.querySelector(".mrd-textarea-field__editor"),!this.editorEl)return;const e=new r(this.editorEl,{theme:"snow",placeholder:this.placeholder,readOnly:this.disabled,modules:{toolbar:[["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,!1]}],["link"],["clean"]]}});this.value&&e.clipboard.dangerouslyPasteHTML(this.value),e.on("text-change",(()=>{var r,e;const i=null!==(e=null===(r=this.editorEl.querySelector(".ql-editor"))||void 0===r?void 0:r.innerHTML)&&void 0!==e?e:"";this.mrdChange.emit({name:this.name,value:i})})),e.on("selection-change",(r=>{var e,i;if(!r){const r=null!==(i=null===(e=this.editorEl.querySelector(".ql-editor"))||void 0===e?void 0:e.innerHTML)&&void 0!==i?i:"";this.error=this.required&&!u(r)?h("required",this.locale):"",this.mrdBlur.emit({name:this.name,value:r})}})),this.editorReady=!0}catch(r){console.error("Failed to load Quill editor:",r)}}render(){return i(d,{key:"8f7544745341ea2eca4450296db53ed8b41af0e2"},i("div",{key:"62937448dd685071e0500b8f7f53fe22b10ffa15",class:"mrd-textarea-field"},this.label&&i("label",{key:"4a7d807d78c2a9abeaf3ff94ee5e71b167475e25",class:"mrd-textarea-field__label"+(this.required?" mrd-textarea-field__label--required":"")},this.label),i("div",{key:"599e28a45b1c161d7cfec3de138e386bf997f9b9",class:"mrd-textarea-field__container"+(this.error?" mrd-textarea-field__container--error":"")},i("div",{key:"5824a225fa6ea29bf02dfd8e4b27a71e853f059e",class:"mrd-textarea-field__editor"})),this.error&&i("span",{key:"1c7693269df8f3fe112a6df419e6cbace75bdaa9",class:"mrd-textarea-field__error"},this.error)))}get el(){return o(this)}};O.style=".sc-mrd-textarea-field-h{display:block}.mrd-textarea-field.sc-mrd-textarea-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-textarea-field__label.sc-mrd-textarea-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-textarea-field__label--required.sc-mrd-textarea-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-textarea-field__container.sc-mrd-textarea-field{border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow:hidden;background-color:var(--mrd-input-bg);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition)}.mrd-textarea-field__container.sc-mrd-textarea-field:focus-within{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-textarea-field__container--error.sc-mrd-textarea-field{border-color:var(--mrd-border-color-error)}.mrd-textarea-field__container--error.sc-mrd-textarea-field:focus-within{box-shadow:var(--mrd-shadow-focus-error)}.mrd-textarea-field__editor.sc-mrd-textarea-field{min-height:150px;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base)}.mrd-textarea-field__editor.sc-mrd-textarea-field .ql-toolbar.sc-mrd-textarea-field{border:none;border-bottom:var(--mrd-border-width) solid var(--mrd-border-color);font-family:var(--mrd-font-family)}.mrd-textarea-field__editor.sc-mrd-textarea-field .ql-container.sc-mrd-textarea-field{border:none;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base)}.mrd-textarea-field__editor.sc-mrd-textarea-field .ql-editor.sc-mrd-textarea-field{min-height:120px;padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x)}.mrd-textarea-field__editor.sc-mrd-textarea-field .ql-editor.ql-blank.sc-mrd-textarea-field::before{color:var(--mrd-input-placeholder-color);font-style:normal}.mrd-textarea-field__error.sc-mrd-textarea-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";const D=class{constructor(i){r(this,i),this.mrdChange=e(this,"mrdChange"),this.mrdBlur=e(this,"mrdBlur"),this.name="",this.label="",this.value="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.error="",this.handleChange=r=>{const e=r.target.value;this.error=this.required&&!u(e)?h("required",this.locale):"",this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=r=>{this.mrdBlur.emit({name:this.name,value:r.target.value})}}render(){const r=!!this.error;return i(d,{key:"0a6e3047eb409b50a7dfa46c724e0d9824bdbad9"},i("div",{key:"1fdcaa9cc0e44edd514d3453df0cfb264989cbca",class:"mrd-time-field"},this.label&&i("label",{key:"ae53864761258ae56e29474c2da68c852fe8db57",class:"mrd-time-field__label"+(this.required?" mrd-time-field__label--required":"")},this.label),i("input",{key:"60336f497545b61656756790cfb5ec096034ecf7",class:"mrd-time-field__input"+(r?" mrd-time-field__input--error":""),type:"time",name:this.name,value:this.value,required:this.required,disabled:this.disabled,onChange:this.handleChange,onBlur:this.handleBlur}),r&&i("span",{key:"f8409b690c67873f6e4fe10f1d404b57005f0557",class:"mrd-time-field__error"},this.error)))}};D.style=".sc-mrd-time-field-h{display:block}.mrd-time-field.sc-mrd-time-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-time-field__label.sc-mrd-time-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-time-field__label--required.sc-mrd-time-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-time-field__input.sc-mrd-time-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-time-field__input.sc-mrd-time-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-time-field__input.sc-mrd-time-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-time-field__input--error.sc-mrd-time-field{border-color:var(--mrd-border-color-error)}.mrd-time-field__input--error.sc-mrd-time-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-time-field__error.sc-mrd-time-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}";export{c as mrd_boolean_field,v as mrd_currency_field,p as mrd_date_field,_ as mrd_datetime_field,g as mrd_email_field,y as mrd_field,x as mrd_file_field,w as mrd_form,k as mrd_hyperlink_field,z as mrd_image_field,q as mrd_list_field,C as mrd_number_field,j as mrd_relation_field,B as mrd_text_field,O as mrd_textarea_field,D as mrd_time_field}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,t).format(n)}function i(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(t,{style:"currency",currency:i,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function t(n,i,t=2){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}).format(n/100)}function e(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}function r(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function u(n,i){if(!n)return"";const[t,e]=n.split(":").map(Number),r=new Date;return r.setHours(t,e,0,0),new Intl.DateTimeFormat(i,{hour:"2-digit",minute:"2-digit"}).format(r)}function a(n,i){var t,e,r,u;if(!n||!n.trim())return null;const a=new Intl.NumberFormat(i).formatToParts(1234567.89),o=null!==(e=null===(t=a.find((n=>"group"===n.type)))||void 0===t?void 0:t.value)&&void 0!==e?e:",",l=null!==(u=null===(r=a.find((n=>"decimal"===n.type)))||void 0===r?void 0:r.value)&&void 0!==u?u:".",s=n.replace(new RegExp(`\\${o}`,"g"),"").replace(new RegExp(`\\${l}`),".").replace("%","").trim(),c=parseFloat(s);return isNaN(c)?null:c}export{r as a,e as b,i as c,n as d,t as e,u as f,a as p}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as r,h as e,H as s,g as a}from"./p-_tsCCkAi.js";import{f as l,a as i,b as o,c as d,d as n,e as c}from"./p-Dt-aHxkM.js";import{ClientLayoutItemType as h}from"./index.esm.js";class m{static render(t,r,e){var s,a,l,i;if(t.type===h.RELATION){const e=null!==(a=null===(s=t.relation)||void 0===s?void 0:s.name)&&void 0!==a?a:"",o=null===(l=null==r?void 0:r._links)||void 0===l?void 0:l[e];return o?Array.isArray(o)?o.map((t=>{var r;return null!==(r=t.name)&&void 0!==r?r:""})).filter(Boolean).join(", "):null!==(i=o.name)&&void 0!==i?i:"":""}if(t.type!==h.FIELD||!t.field)return"";const{name:o,dataType:d,listItems:n}=t.field,c=null==r?void 0:r[o];return null==c||""===c?"":(Array.isArray(c)?c:[c]).map((t=>m.renderValue(null!=d?d:"TEXT",t,null!=n?n:[],e))).filter((t=>""!==t)).join(", ")}static renderValue(t,r,e,s){var a;switch(t){case"INTEGER":return n(Number(r),s,{maximumFractionDigits:0});case"DECIMAL":return n(Number(r),s);case"PERCENTAGE":return c(Number(r),s);case"CURRENCY":{const{amount:t,currency:e}="object"==typeof r&&null!==r?r:{amount:r,currency:""};return e?d(Number(t),e,s):n(Number(t),s)}case"DATE":return o(r,s);case"DATETIME":return i(r,s);case"TIME":return l(r,s);case"BOOLEAN":return r?"✓":"";case"LIST":{const t=e.find((t=>t.key===String(r)));return null!==(a=null==t?void 0:t.label)&&void 0!==a?a:String(r)}case"TEXTBLOCK":return String(r).replace(/<[^>]*>/g,"").trim();default:return String(r)}}}const b=class{constructor(e){t(this,e),this.mrdLoadPage=r(this,"mrdLoadPage"),this.mrdRowClick=r(this,"mrdRowClick"),this.pendingPages=new Set,this.debounceTimer=null,this.columns=[],this.rows=[],this.locale=navigator.language,this.totalElements=0,this.pageSize=20,this.rowHeight=36,this.tableHeight=500,this.defaultSort="",this.loadedPages=new Map,this.requestedPages=new Set,this.renderStart=0,this.renderEnd=0,this.colWidths=[],this.sortField="",this.sortDir="asc",this.handleScroll=t=>{const r=this.totalElements,e=Math.floor(t.currentTarget.scrollTop/this.rowHeight),s=Math.min(e+this.visibleCount(),r-1);this.renderStart=Math.max(0,e-10),this.renderEnd=Math.min(r-1,s+10),this.requestPagesForWindow(this.renderStart,this.renderEnd)}}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.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()+10,this.totalElements-1));const r=this.el.querySelector(".mrd-table__scroll");r&&(r.scrollTop=0)}async setPage(t,r){const e=new Map(this.loadedPages);e.set(t,r),this.loadedPages=e}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,s,a;return null!==(a=null!==(e=null===(r=t.field)||void 0===r?void 0:r.name)&&void 0!==e?e:null===(s=t.relation)||void 0===s?void 0:s.name)&&void 0!==a?a:""}handleSortClick(t){const r=this.colName(t);this.sortField===r?this.sortDir="asc"===this.sortDir?"desc":"asc":(this.sortField=r,this.sortDir="asc"),null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.colWidths=[],this.renderStart=0,this.renderEnd=Math.max(0,Math.min(this.visibleCount()+10,this.totalElements-1));const e=this.el.querySelector(".mrd-table__scroll");e&&(e.scrollTop=0),this.emitPagesForWindow(this.renderStart,this.renderEnd)}emitPagesForWindow(t,r){const e=Math.floor(t/this.pageSize),s=Math.floor(r/this.pageSize),a=new Set(this.requestedPages);let l=!1;for(let t=e;t<=s;t++)this.loadedPages.has(t)||a.has(t)||(a.add(t),this.mrdLoadPage.emit({page:t,sort:this.sortParam()}),l=!0);l&&(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),s=Math.floor(r/this.pageSize);let a=!1;for(let t=e;t<=s;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 s=e*this.pageSize;s+this.pageSize-1<this.renderStart||s>this.renderEnd||(t.add(e),this.mrdLoadPage.emit({page:e,sort:this.sortParam()}),r=!0)}this.pendingPages.clear(),r&&(this.requestedPages=t)}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)))}}render(){var t,r;if(!(null===(t=this.columns)||void 0===t?void 0:t.length))return null;const a=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]);if(0===this.totalElements)return e(s,null,e("div",{class:"mrd-table"},e("table",{class:"mrd-table__table"},e("thead",null,e("tr",null,this.columns.map((t=>{var r,s,a,l;return e("th",{class:"mrd-table__header"},null!==(l=null!==(s=null===(r=t.field)||void 0===r?void 0:r.label)&&void 0!==s?s:null===(a=t.relation)||void 0===a?void 0:a.label)&&void 0!==l?l:"")})))),e("tbody",null,null===(r=this.rows)||void 0===r?void 0:r.map(((t,r)=>e("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=>{var s,l;const i=m.render(r,t,this.locale),o="FIELD"===r.type&&a.has(null!==(l=null===(s=r.field)||void 0===s?void 0:s.dataType)&&void 0!==l?l:"");return e("td",{class:"mrd-table__cell"+(o?" mrd-table__cell--numeric":"")},i)}))))))),(!this.rows||0===this.rows.length)&&e("p",{class:"mrd-table__empty"},"Geen resultaten gevonden.")));const l=this.totalElements,i=this.columns.length,o=this.renderStart*this.rowHeight,d=Math.max(0,(l-1-this.renderEnd)*this.rowHeight),n=[];for(let t=this.renderStart;t<=this.renderEnd;t++){const r=this.getRow(t);n.push(null===r?e("tr",{class:"mrd-table__row mrd-table__row--loading"},e("td",{class:"mrd-table__cell--placeholder",colSpan:i},e("span",{class:"mrd-table__placeholder-bar"}))):e("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=>{var s,l;const i=m.render(t,r,this.locale),o="FIELD"===t.type&&a.has(null!==(l=null===(s=t.field)||void 0===s?void 0:s.dataType)&&void 0!==l?l:"");return e("td",{class:"mrd-table__cell"+(o?" mrd-table__cell--numeric":"")},i)}))))}return e(s,null,e("div",{class:"mrd-table__scroll",style:{height:`${this.tableHeight}px`},onScroll:this.handleScroll},e("table",{class:"mrd-table__table",style:this.colWidths.length>0?{tableLayout:"fixed"}:void 0},e("thead",null,e("tr",null,this.columns.map(((t,r)=>{var s,a,l,i;const o=this.sortField===this.colName(t);return e("th",{class:"mrd-table__header mrd-table__header--sortable"+(o?` mrd-table__header--sorted-${this.sortDir}`:""),style:this.colWidths[r]?{width:`${this.colWidths[r]}px`}:void 0,onClick:()=>this.handleSortClick(t)},e("span",{class:"mrd-table__header-label"},null!==(i=null!==(a=null===(s=t.field)||void 0===s?void 0:s.label)&&void 0!==a?a:null===(l=t.relation)||void 0===l?void 0:l.label)&&void 0!==i?i:""),e("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},o?"asc"===this.sortDir?"▲":"▼":"⇅"))})))),e("tbody",null,o>0&&e("tr",{class:"mrd-table__spacer",style:{height:`${o}px`}},e("td",{colSpan:i})),n,d>0&&e("tr",{class:"mrd-table__spacer",style:{height:`${d}px`}},e("td",{colSpan:i}))))),0===l&&e("p",{class:"mrd-table__empty"},"Geen resultaten gevonden."))}get el(){return a(this)}};b.style=".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.65rem;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__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__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}";export{b as mrd_table}
|