@mmlogic/components 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_19.cjs.entry.js +3150 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +715 -0
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +339 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +1 -1
- package/dist/collection/components/mrd-table/mrd-table.js +41 -4
- package/dist/collection/components/mrd-table/mrd-table.scss +23 -0
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/dev/app.js +109 -3
- package/dist/collection/dev/example-data.js +324 -0
- package/dist/collection/utils/cell-renderer.js +26 -0
- package/dist/components/mrd-layout-section.d.ts +11 -0
- package/dist/components/mrd-layout-section.js +1 -0
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-table.js +1 -1
- package/dist/components/mrd-table2.js +1 -0
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_19.entry.js +3130 -0
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-a3255fc4.entry.js +1 -0
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +92 -0
- package/dist/types/components/mrd-table/mrd-table.d.ts +5 -0
- package/dist/types/components.d.ts +128 -8
- package/dist/types/types/client-layout.d.ts +19 -0
- package/dist/types/utils/cell-renderer.d.ts +9 -1
- package/package.json +1 -1
- package/dist/cjs/format-DExY8_nu.js +0 -328
- package/dist/cjs/mrd-boolean-field_17.cjs.entry.js +0 -1554
- package/dist/cjs/mrd-table.cjs.entry.js +0 -888
- package/dist/esm/format-CcRjWvcb.js +0 -319
- package/dist/esm/mrd-boolean-field_17.entry.js +0 -1536
- package/dist/esm/mrd-table.entry.js +0 -886
- package/dist/mosterdcomponents/p-17fe94c6.entry.js +0 -1
- package/dist/mosterdcomponents/p-3d856b27.entry.js +0 -1
- package/dist/mosterdcomponents/p-CcRjWvcb.js +0 -1
|
@@ -41,12 +41,97 @@ function logEvent(type, data) {
|
|
|
41
41
|
===================================================================== */
|
|
42
42
|
|
|
43
43
|
function showTab(name) {
|
|
44
|
+
const names = ['embedded', 'field-types', 'detail-view', 'live-api'];
|
|
44
45
|
document.querySelectorAll('.tab-btn').forEach((btn, i) => {
|
|
45
|
-
const names = ['embedded', 'live-api'];
|
|
46
46
|
btn.classList.toggle('active', names[i] === name);
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
names.forEach(n => {
|
|
49
|
+
document.getElementById('tab-' + n).classList.toggle('active', n === name);
|
|
50
|
+
});
|
|
51
|
+
if (name === 'detail-view') initDetailViewTab();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* =====================================================================
|
|
55
|
+
DETAIL VIEW TAB
|
|
56
|
+
===================================================================== */
|
|
57
|
+
|
|
58
|
+
let _detailViewInitialized = false;
|
|
59
|
+
|
|
60
|
+
function initDetailViewTab() {
|
|
61
|
+
if (_detailViewInitialized) return;
|
|
62
|
+
_detailViewInitialized = true;
|
|
63
|
+
|
|
64
|
+
const table = document.getElementById('companies-table');
|
|
65
|
+
const meta = window.EXAMPLE_COMPANY_METADATA;
|
|
66
|
+
|
|
67
|
+
table.columns = window.EXAMPLE_COMPANY_COLUMNS;
|
|
68
|
+
table.totalElements = window.EXAMPLE_COMPANIES.length;
|
|
69
|
+
table.pageSize = 20;
|
|
70
|
+
table.locale = 'nl-NL';
|
|
71
|
+
|
|
72
|
+
table.addEventListener('mrdLoadPage', async (e) => {
|
|
73
|
+
await table.setPage(e.detail.page, window.EXAMPLE_COMPANIES);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
table.addEventListener('mrdRowClick', (e) => {
|
|
77
|
+
showCompanyDetail(e.detail);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
table.init().then(() => table.setPage(0, window.EXAMPLE_COMPANIES));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function showCompanyDetail(row) {
|
|
84
|
+
document.getElementById('detail-table-panel').style.display = 'none';
|
|
85
|
+
document.getElementById('detail-record-panel').style.display = 'block';
|
|
86
|
+
|
|
87
|
+
// Use the static example company (in a real app: fetch /data/:tenant/companies/:id)
|
|
88
|
+
const company = window.EXAMPLE_COMPANY;
|
|
89
|
+
const meta = window.EXAMPLE_COMPANY_METADATA;
|
|
90
|
+
const container = document.getElementById('detail-sections');
|
|
91
|
+
container.innerHTML = '';
|
|
92
|
+
|
|
93
|
+
meta.layouts.forEach((layout, idx) => {
|
|
94
|
+
const wrapper = document.createElement('div');
|
|
95
|
+
wrapper.style.marginBottom = '2rem';
|
|
96
|
+
|
|
97
|
+
if (layout.label) {
|
|
98
|
+
const heading = document.createElement('h3');
|
|
99
|
+
heading.style.cssText = 'font-size:1.1rem;font-weight:600;margin:0 0 .75rem;padding-bottom:.5rem;border-bottom:2px solid #e5e7eb';
|
|
100
|
+
heading.textContent = layout.label;
|
|
101
|
+
wrapper.appendChild(heading);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const section = document.createElement('mrd-layout-section');
|
|
105
|
+
section.items = layout.items;
|
|
106
|
+
section.data = company;
|
|
107
|
+
section.views = meta.views;
|
|
108
|
+
section.locale = 'nl-NL';
|
|
109
|
+
|
|
110
|
+
section.addEventListener('mrdNavigate', (e) => {
|
|
111
|
+
logEvent('mrdNavigate', e.detail);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
section.addEventListener('mrdLoadView', async (e) => {
|
|
115
|
+
const { name, viewConfig } = e.detail;
|
|
116
|
+
const mockRows = name === 'view0' ? window.EXAMPLE_APPOINTMENTS : window.EXAMPLE_SHARE_CLASSES;
|
|
117
|
+
await section.setViewPage(name, 0, mockRows, mockRows.length);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
section.addEventListener('mrdLoadViewPage', async (e) => {
|
|
121
|
+
// No more pages in the mock — just set the same rows again
|
|
122
|
+
const { name } = e.detail;
|
|
123
|
+
const mockRows = name === 'view0' ? window.EXAMPLE_APPOINTMENTS : window.EXAMPLE_SHARE_CLASSES;
|
|
124
|
+
await section.setViewPage(name, e.detail.page, mockRows);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
wrapper.appendChild(section);
|
|
128
|
+
container.appendChild(wrapper);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function showCompanyList() {
|
|
133
|
+
document.getElementById('detail-record-panel').style.display = 'none';
|
|
134
|
+
document.getElementById('detail-table-panel').style.display = 'block';
|
|
50
135
|
}
|
|
51
136
|
|
|
52
137
|
/* =====================================================================
|
|
@@ -204,6 +289,7 @@ function renderTable(columns, totalElements, pageSize, page0Rows, dataHref, defa
|
|
|
204
289
|
|
|
205
290
|
// Mutable closure state — reassigned on view switch so subsequent handlers see new values
|
|
206
291
|
let _activeFilters = [];
|
|
292
|
+
let _pageLinks = {}; // _links from the most recent page 0 response (self, excel, etc.)
|
|
207
293
|
let viewLabel = initialViewLabel;
|
|
208
294
|
let alternativeViews = initialAlternativeViews;
|
|
209
295
|
let viewFilter = initialViewFilter; // static filters from view definition
|
|
@@ -639,6 +725,26 @@ document.getElementById('btn-inject-results').addEventListener('click', () => {
|
|
|
639
725
|
===================================================================== */
|
|
640
726
|
|
|
641
727
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
728
|
+
// Initialize Field Types tab (static, no auth needed)
|
|
729
|
+
const ftSection = document.getElementById('field-types-section');
|
|
730
|
+
ftSection.items = window.EXAMPLE_FIELD_TYPES_ITEMS;
|
|
731
|
+
ftSection.data = window.EXAMPLE_FIELD_TYPES_DATA;
|
|
732
|
+
ftSection.locale = 'nl-NL';
|
|
733
|
+
|
|
734
|
+
// Simulate host resolving a signed URL for IMAGE fields (thumbnail on load).
|
|
735
|
+
ftSection.addEventListener('mrdLoadImage', (e) => {
|
|
736
|
+
const staticUrl = 'https://picsum.photos/seed/mosterd/800/600';
|
|
737
|
+
ftSection.setImagePreview(e.detail.fieldName, staticUrl);
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
ftSection.addEventListener('mrdNavigate', (e) => {
|
|
741
|
+
logEvent('mrdNavigate', e.detail);
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
ftSection.addEventListener('mrdDownload', (e) => {
|
|
745
|
+
logEvent('mrdDownload', e.detail);
|
|
746
|
+
});
|
|
747
|
+
|
|
642
748
|
authRestoreSession();
|
|
643
749
|
await authHandleCallback();
|
|
644
750
|
|
|
@@ -254,3 +254,327 @@ window.EXAMPLE_VALUES = {
|
|
|
254
254
|
startDate: "2026-01-15",
|
|
255
255
|
contactEmail: "team@mosterd.nl"
|
|
256
256
|
};
|
|
257
|
+
|
|
258
|
+
// ─── Companies detail view demo ────────────────────────────────────────────────
|
|
259
|
+
|
|
260
|
+
/** Column definitions for the companies list table. */
|
|
261
|
+
window.EXAMPLE_COMPANY_COLUMNS = [
|
|
262
|
+
{ type: 'FIELD', label: 'Company name', field: { name: 'name', dataType: 'TEXT', required: true } },
|
|
263
|
+
{ type: 'FIELD', label: 'Reg. number', field: { name: 'registrationNumber', dataType: 'TEXT', required: false } },
|
|
264
|
+
{ type: 'FIELD', label: 'Legal form', field: { name: 'legalForm', dataType: 'TEXT', required: false } },
|
|
265
|
+
{ type: 'FIELD', label: 'Start date', field: { name: 'startDate', dataType: 'DATE', required: false } },
|
|
266
|
+
{ type: 'FIELD', label: 'Employees', field: { name: 'totalEmployees', dataType: 'INTEGER', required: false } },
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
/** Rows for the companies list table. */
|
|
270
|
+
window.EXAMPLE_COMPANIES = [
|
|
271
|
+
{
|
|
272
|
+
name: 'Alpha Holding B.V.',
|
|
273
|
+
registrationNumber: '10000001',
|
|
274
|
+
legalForm: 'Besloten Vennootschap',
|
|
275
|
+
startDate: '2001-03-01',
|
|
276
|
+
totalEmployees: 1,
|
|
277
|
+
_links: { self: { href: '/data/demo/companies/company-1' } },
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'Beta Services N.V.',
|
|
281
|
+
registrationNumber: '20000002',
|
|
282
|
+
legalForm: 'Naamloze Vennootschap',
|
|
283
|
+
startDate: '2010-07-15',
|
|
284
|
+
totalEmployees: 45,
|
|
285
|
+
_links: { self: { href: '/data/demo/companies/company-2' } },
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'Gamma & Partners B.V.',
|
|
289
|
+
registrationNumber: '30000003',
|
|
290
|
+
legalForm: 'Besloten Vennootschap',
|
|
291
|
+
startDate: '2008-11-01',
|
|
292
|
+
totalEmployees: 12,
|
|
293
|
+
_links: { self: { href: '/data/demo/companies/company-3' } },
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'Delta Vastgoed B.V.',
|
|
297
|
+
registrationNumber: '40000004',
|
|
298
|
+
legalForm: 'Besloten Vennootschap',
|
|
299
|
+
startDate: '2020-06-15',
|
|
300
|
+
totalEmployees: 3,
|
|
301
|
+
_links: { self: { href: '/data/demo/companies/company-4' } },
|
|
302
|
+
},
|
|
303
|
+
];
|
|
304
|
+
|
|
305
|
+
/** Single company data object (result of GET /data/:tenant/companies/:id). */
|
|
306
|
+
window.EXAMPLE_COMPANY = {
|
|
307
|
+
name: 'Alpha Holding B.V.',
|
|
308
|
+
legalName: 'Alpha Holding B.V.',
|
|
309
|
+
registrationNumber: '10000001',
|
|
310
|
+
registrationDate: null,
|
|
311
|
+
legalForm: 'Besloten Vennootschap',
|
|
312
|
+
legalFormExtended: 'Besloten Vennootschap',
|
|
313
|
+
rsin: '100000001',
|
|
314
|
+
startDate: '2001-03-01',
|
|
315
|
+
endDate: null,
|
|
316
|
+
primaryActivityDescription: 'Activiteiten van houdstermaatschappijen',
|
|
317
|
+
primaryActivityCode: '64100',
|
|
318
|
+
totalEmployees: 1,
|
|
319
|
+
noMailing: false,
|
|
320
|
+
verificationDate: '2024-01-15T09:00:00.000Z',
|
|
321
|
+
visitAddress: 'Voorbeeldstraat 1',
|
|
322
|
+
visitPostalCode: '1234AB',
|
|
323
|
+
visitCity: 'Amsterdam',
|
|
324
|
+
mailingAddress: null,
|
|
325
|
+
mailingPostalCode: null,
|
|
326
|
+
mailingCity: null,
|
|
327
|
+
_links: {
|
|
328
|
+
self: { href: '/data/demo/companies/company-1' },
|
|
329
|
+
country: { href: '/data/demo/countries/nl', name: 'Nederland' },
|
|
330
|
+
appointments: { href: '/data/demo/companies/company-1/appointments' },
|
|
331
|
+
shareClasses: { href: '/data/demo/companies/company-1/shareClasses' },
|
|
332
|
+
shareAllocations: { href: '/data/demo/shareholders/company-1/shareAllocations' },
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/** Dashboard metadata (GET /metadata/:tenant/dataObject?types=companies,...). */
|
|
337
|
+
window.EXAMPLE_COMPANY_METADATA = {
|
|
338
|
+
layoutType: 'OBJECT_DASHBOARD',
|
|
339
|
+
layouts: [
|
|
340
|
+
{
|
|
341
|
+
type: 'OBJECT_DASHBOARD',
|
|
342
|
+
label: '',
|
|
343
|
+
tabPage: false,
|
|
344
|
+
items: [
|
|
345
|
+
{ type: 'FIELD', label: 'company name', field: { name: 'name', dataType: 'TEXT', required: true, header: true } },
|
|
346
|
+
{ type: 'FIELD', label: 'legal name', field: { name: 'legalName', dataType: 'TEXT', required: true } },
|
|
347
|
+
{ type: 'FIELD', label: 'registration number', field: { name: 'registrationNumber', dataType: 'TEXT', required: false } },
|
|
348
|
+
{ type: 'FIELD', label: 'registration date', field: { name: 'registrationDate', dataType: 'DATE', required: false } },
|
|
349
|
+
// ACTION items are silently ignored by mrd-layout-section
|
|
350
|
+
{ type: 'ACTION', label: 'company register', name: 'CompanyRegister' },
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
type: 'OBJECT_DASHBOARD',
|
|
355
|
+
label: 'Registration details',
|
|
356
|
+
tabPage: true,
|
|
357
|
+
items: [
|
|
358
|
+
{ type: 'FIELD', label: 'legal form', field: { name: 'legalForm', dataType: 'TEXT', required: false } },
|
|
359
|
+
{ type: 'FIELD', label: 'legal form extended', field: { name: 'legalFormExtended', dataType: 'TEXT', required: false } },
|
|
360
|
+
{ type: 'FIELD', label: 'rsin', field: { name: 'rsin', dataType: 'TEXT', required: false } },
|
|
361
|
+
{ type: 'FIELD', label: 'start date', field: { name: 'startDate', dataType: 'DATE', required: false } },
|
|
362
|
+
{ type: 'FIELD', label: 'end date', field: { name: 'endDate', dataType: 'DATE', required: false } },
|
|
363
|
+
{ type: 'FIELD', label: 'primary activity description', field: { name: 'primaryActivityDescription', dataType: 'TEXT', required: false } },
|
|
364
|
+
{ type: 'FIELD', label: 'primary activity code', field: { name: 'primaryActivityCode', dataType: 'TEXT', required: false } },
|
|
365
|
+
{ type: 'FIELD', label: 'total employees', field: { name: 'totalEmployees', dataType: 'INTEGER', required: false } },
|
|
366
|
+
{ type: 'FIELD', label: 'no mailing', field: { name: 'noMailing', dataType: 'BOOLEAN', required: false } },
|
|
367
|
+
{ type: 'FIELD', label: 'verification date', field: { name: 'verificationDate', dataType: 'DATETIME', required: false } },
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
type: 'OBJECT_DASHBOARD',
|
|
372
|
+
label: 'Contact information',
|
|
373
|
+
tabPage: true,
|
|
374
|
+
items: [
|
|
375
|
+
{ type: 'FIELD', label: 'visit address', field: { name: 'visitAddress', dataType: 'TEXT', required: false } },
|
|
376
|
+
{ type: 'FIELD', label: 'visit postal code', field: { name: 'visitPostalCode', dataType: 'TEXT', required: false } },
|
|
377
|
+
{ type: 'FIELD', label: 'visit city', field: { name: 'visitCity', dataType: 'TEXT', required: false } },
|
|
378
|
+
{ type: 'FIELD', label: 'mailing address', field: { name: 'mailingAddress', dataType: 'TEXT', required: false } },
|
|
379
|
+
{ type: 'FIELD', label: 'mailing postal code', field: { name: 'mailingPostalCode', dataType: 'TEXT', required: false } },
|
|
380
|
+
{ type: 'FIELD', label: 'mailing city', field: { name: 'mailingCity', dataType: 'TEXT', required: false } },
|
|
381
|
+
{
|
|
382
|
+
type: 'RELATION',
|
|
383
|
+
label: 'country',
|
|
384
|
+
relation: { name: 'country', label: 'country', relatedClass: 'commons.country', mostSignificantClass: 'countries', required: false },
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
type: 'OBJECT_DASHBOARD',
|
|
390
|
+
label: 'Appointments',
|
|
391
|
+
tabPage: true,
|
|
392
|
+
items: [
|
|
393
|
+
{
|
|
394
|
+
type: 'RELATED_VIEW',
|
|
395
|
+
label: 'Appointments',
|
|
396
|
+
name: 'view0',
|
|
397
|
+
relatedView: { name: 'view0', relatedClass: 'appointments', showTitle: false },
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
type: 'OBJECT_DASHBOARD',
|
|
403
|
+
label: 'Share classes',
|
|
404
|
+
tabPage: true,
|
|
405
|
+
items: [
|
|
406
|
+
{
|
|
407
|
+
type: 'RELATED_VIEW',
|
|
408
|
+
label: 'Share classes',
|
|
409
|
+
name: 'view1',
|
|
410
|
+
relatedView: { name: 'view1', relatedClass: 'shareClasses', showTitle: false },
|
|
411
|
+
},
|
|
412
|
+
],
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
views: {
|
|
416
|
+
view0: {
|
|
417
|
+
name: null,
|
|
418
|
+
defaultView: true,
|
|
419
|
+
defaultSort: 'name',
|
|
420
|
+
values: [
|
|
421
|
+
{ type: 'FIELD', label: 'name', field: { name: 'name', dataType: 'TEXT', required: true } },
|
|
422
|
+
{
|
|
423
|
+
type: 'RELATION', label: 'Officer',
|
|
424
|
+
relation: { name: 'officer', label: 'Officer', relatedClass: 'housekeeping.officer', mostSignificantClass: 'entities', required: true },
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
type: 'FIELD', label: 'Authority',
|
|
428
|
+
field: {
|
|
429
|
+
name: 'authority', dataType: 'LIST', required: false,
|
|
430
|
+
listItems: [
|
|
431
|
+
{ key: 'SOLE', label: 'Sole authority' },
|
|
432
|
+
{ key: 'JOINT', label: 'Joint authority' },
|
|
433
|
+
],
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
{ type: 'FIELD', label: 'start date', field: { name: 'activeDate', dataType: 'DATE', required: false } },
|
|
437
|
+
{ type: 'FIELD', label: 'end date', field: { name: 'inactiveDate', dataType: 'DATE', required: false } },
|
|
438
|
+
],
|
|
439
|
+
type: 'appointments',
|
|
440
|
+
singularLabel: 'Appointment',
|
|
441
|
+
pluralLabel: 'Appointments',
|
|
442
|
+
},
|
|
443
|
+
view1: {
|
|
444
|
+
name: null,
|
|
445
|
+
defaultView: true,
|
|
446
|
+
defaultSort: 'name',
|
|
447
|
+
values: [
|
|
448
|
+
{ type: 'FIELD', label: 'name', field: { name: 'name', dataType: 'TEXT', required: true } },
|
|
449
|
+
{ type: 'FIELD', label: 'Nominal value', field: { name: 'nominalValue', dataType: 'TEXT', required: false } },
|
|
450
|
+
{ type: 'FIELD', label: 'Currency', field: { name: 'currency', dataType: 'TEXT', required: false } },
|
|
451
|
+
{ type: 'FIELD', label: 'Authorised shares', field: { name: 'authorizedShares', dataType: 'INTEGER', required: false } },
|
|
452
|
+
],
|
|
453
|
+
type: 'shareClasses',
|
|
454
|
+
singularLabel: 'Share class',
|
|
455
|
+
pluralLabel: 'Share classes',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
_links: {
|
|
459
|
+
view0: { href: '/data/demo/appointments' },
|
|
460
|
+
view1: { href: '/data/demo/shareClasses' },
|
|
461
|
+
},
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
/** Mock appointment rows for the embedded table. */
|
|
465
|
+
window.EXAMPLE_APPOINTMENTS = [
|
|
466
|
+
{
|
|
467
|
+
name: 'Directeur',
|
|
468
|
+
authority: 'SOLE',
|
|
469
|
+
activeDate: '2001-03-01',
|
|
470
|
+
inactiveDate: null,
|
|
471
|
+
_links: {
|
|
472
|
+
self: { href: '/data/demo/appointments/apt-1' },
|
|
473
|
+
officer: { href: '/data/demo/entities/person-1', name: 'A. Jansen' },
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: 'Commissaris',
|
|
478
|
+
authority: 'JOINT',
|
|
479
|
+
activeDate: '2018-03-01',
|
|
480
|
+
inactiveDate: null,
|
|
481
|
+
_links: {
|
|
482
|
+
self: { href: '/data/demo/appointments/apt-2' },
|
|
483
|
+
officer: { href: '/data/demo/entities/person-2', name: 'B. de Wit' },
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
];
|
|
487
|
+
|
|
488
|
+
/** Mock share class rows for the embedded table. */
|
|
489
|
+
window.EXAMPLE_SHARE_CLASSES = [
|
|
490
|
+
{
|
|
491
|
+
name: 'Gewone aandelen',
|
|
492
|
+
nominalValue: '1.00',
|
|
493
|
+
currency: 'EUR',
|
|
494
|
+
authorizedShares: 1800,
|
|
495
|
+
_links: { self: { href: '/data/demo/shareClasses/sc-1' } },
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'Preferente aandelen',
|
|
499
|
+
nominalValue: '1.00',
|
|
500
|
+
currency: 'EUR',
|
|
501
|
+
authorizedShares: 200,
|
|
502
|
+
_links: { self: { href: '/data/demo/shareClasses/sc-2' } },
|
|
503
|
+
},
|
|
504
|
+
];
|
|
505
|
+
|
|
506
|
+
// ─── Field Types demo ─────────────────────────────────────────────────────────
|
|
507
|
+
|
|
508
|
+
window.EXAMPLE_FIELD_TYPES_ITEMS = [
|
|
509
|
+
{ type: 'FIELD', label: 'Name (header)', field: { name: 'fHeader', dataType: 'TEXT', required: false, header: true } },
|
|
510
|
+
{ type: 'FIELD', label: 'Text', field: { name: 'fText', dataType: 'TEXT', required: false } },
|
|
511
|
+
{ type: 'FIELD', label: 'Email', field: { name: 'fEmail', dataType: 'EMAIL', required: false } },
|
|
512
|
+
{ type: 'FIELD', label: 'Hyperlink', field: { name: 'fHyperlink', dataType: 'HYPERLINK', required: false } },
|
|
513
|
+
{ type: 'FIELD', label: 'Integer', field: { name: 'fInteger', dataType: 'INTEGER', required: false } },
|
|
514
|
+
{ type: 'FIELD', label: 'Decimal', field: { name: 'fDecimal', dataType: 'DECIMAL', required: false } },
|
|
515
|
+
{ type: 'FIELD', label: 'Percentage', field: { name: 'fPercentage', dataType: 'PERCENTAGE', required: false } },
|
|
516
|
+
{ type: 'FIELD', label: 'Currency', field: { name: 'fCurrency', dataType: 'CURRENCY', required: false } },
|
|
517
|
+
{ type: 'FIELD', label: 'Boolean (true)', field: { name: 'fBoolTrue', dataType: 'BOOLEAN', required: false } },
|
|
518
|
+
{ type: 'FIELD', label: 'Boolean (false)', field: { name: 'fBoolFalse', dataType: 'BOOLEAN', required: false } },
|
|
519
|
+
{ type: 'FIELD', label: 'Date', field: { name: 'fDate', dataType: 'DATE', required: false } },
|
|
520
|
+
{ type: 'FIELD', label: 'DateTime', field: { name: 'fDatetime', dataType: 'DATETIME', required: false } },
|
|
521
|
+
{ type: 'FIELD', label: 'Time', field: { name: 'fTime', dataType: 'TIME', required: false } },
|
|
522
|
+
{
|
|
523
|
+
type: 'FIELD', label: 'List (no color)', field: {
|
|
524
|
+
name: 'fListPlain', dataType: 'LIST', required: false,
|
|
525
|
+
listItems: [{ key: 'a', label: 'Option A' }, { key: 'b', label: 'Option B' }],
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
type: 'FIELD', label: 'List (color only)', field: {
|
|
530
|
+
name: 'fListColor', dataType: 'LIST', required: false,
|
|
531
|
+
listItems: [
|
|
532
|
+
{ key: 'active', label: 'Active', color: '#16a34a' },
|
|
533
|
+
{ key: 'inactive', label: 'Inactive', color: '#dc2626' },
|
|
534
|
+
],
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
type: 'FIELD', label: 'List (color + bg)', field: {
|
|
539
|
+
name: 'fListBadge', dataType: 'LIST', required: false,
|
|
540
|
+
listItems: [
|
|
541
|
+
{ key: 'approved', label: 'Approved', color: '#14532d', backgroundColor: '#dcfce7' },
|
|
542
|
+
{ key: 'rejected', label: 'Rejected', color: '#7f1d1d', backgroundColor: '#fee2e2' },
|
|
543
|
+
{ key: 'pending', label: 'Pending', color: '#78350f', backgroundColor: '#fef3c7' },
|
|
544
|
+
],
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
{ type: 'RELATION', label: 'Relation (single)', relation: { name: 'fRelation', label: 'Relation', relatedClass: 'demo.entity', required: false } },
|
|
548
|
+
{ type: 'FIELD', label: 'File', field: { name: 'fFile', dataType: 'FILE', required: false } },
|
|
549
|
+
{ type: 'FIELD', label: 'Image', field: { name: 'fImage', dataType: 'IMAGE', required: false } },
|
|
550
|
+
{ type: 'FIELD', label: 'Textblock', field: { name: 'fTextblock', dataType: 'TEXTBLOCK', required: false } },
|
|
551
|
+
{ type: 'FIELD', label: 'Longtext', field: { name: 'fLongtext', dataType: 'LONGTEXT', required: false } },
|
|
552
|
+
{ type: 'FIELD', label: 'JSON', field: { name: 'fJson', dataType: 'JSON', required: false } },
|
|
553
|
+
];
|
|
554
|
+
|
|
555
|
+
window.EXAMPLE_FIELD_TYPES_DATA = {
|
|
556
|
+
fHeader: 'Voorbeeld Bedrijf B.V.',
|
|
557
|
+
fText: 'Voorbeeld tekst',
|
|
558
|
+
fEmail: 'info@example.com',
|
|
559
|
+
fHyperlink: { href: 'https://example.com', text: 'example.com' },
|
|
560
|
+
fInteger: 42,
|
|
561
|
+
fDecimal: 3.14159,
|
|
562
|
+
fPercentage: 0.7825,
|
|
563
|
+
fCurrency: { amount: 1250.50, currency: 'EUR' },
|
|
564
|
+
fBoolTrue: true,
|
|
565
|
+
fBoolFalse: false,
|
|
566
|
+
fDate: '2024-03-15',
|
|
567
|
+
fDatetime: '2024-03-15T14:30:00.000Z',
|
|
568
|
+
fTime: '14:30:00',
|
|
569
|
+
fListPlain: 'a',
|
|
570
|
+
fListColor: 'active',
|
|
571
|
+
fListBadge: 'approved',
|
|
572
|
+
fFile: { href: '/api/files/example-document', fileName: 'voorbeeld-document.pdf' },
|
|
573
|
+
fImage: { href: '/api/files/example-photo', fileName: 'voorbeeld-foto.jpg' },
|
|
574
|
+
fTextblock: '<p>Dit is een <strong>opgemaakte</strong> tekst met <em>html</em>-inhoud. Geschikt voor langere beschrijvingen met opmaak.</p>',
|
|
575
|
+
fLongtext: 'Dit is een langere stuk platte tekst zonder opmaak.\nHet kan meerdere regels bevatten en wordt getoond in een pre-blok zodat witruimte bewaard blijft.',
|
|
576
|
+
fJson: { id: 1, status: 'active', tags: ['alpha', 'beta'], meta: { created: '2024-01-01', valid: true } },
|
|
577
|
+
_links: {
|
|
578
|
+
fRelation: { href: '/data/demo/entities/person-1', name: 'A. Jansen' },
|
|
579
|
+
},
|
|
580
|
+
};
|
|
@@ -72,4 +72,30 @@ export class CellRenderer {
|
|
|
72
72
|
return String(value);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns syntax-highlighted JSON as an HTML string with inline styles.
|
|
77
|
+
* compact=true → single line (no indentation); compact=false → pretty-printed.
|
|
78
|
+
*/
|
|
79
|
+
static formatJson(value, compact = false) {
|
|
80
|
+
try {
|
|
81
|
+
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
82
|
+
const json = compact ? JSON.stringify(parsed) : JSON.stringify(parsed, null, 2);
|
|
83
|
+
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, match => {
|
|
84
|
+
let style = 'color:#2aa198';
|
|
85
|
+
if (/^"/.test(match)) {
|
|
86
|
+
style = /:$/.test(match) ? 'color:#881391' : 'color:#268bd2';
|
|
87
|
+
}
|
|
88
|
+
else if (/true|false/.test(match)) {
|
|
89
|
+
style = 'color:#b58900';
|
|
90
|
+
}
|
|
91
|
+
else if (/null/.test(match)) {
|
|
92
|
+
style = 'color:#dc322f';
|
|
93
|
+
}
|
|
94
|
+
return `<span style="${style}">${match}</span>`;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (_a) {
|
|
98
|
+
return String(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
75
101
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MrdLayoutSection extends Components.MrdLayoutSection, HTMLElement {}
|
|
4
|
+
export const MrdLayoutSection: {
|
|
5
|
+
prototype: MrdLayoutSection;
|
|
6
|
+
new (): MrdLayoutSection;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{proxyCustomElement as r,HTMLElement as t,createEvent as o,h as e,Host as i,transformTag as a}from"@stencil/core/internal/client";import{a as s,b as n}from"./client-layout.js";import{C as l,d}from"./mrd-table2.js";import{t as c}from"./i18n.js";const u=r(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdNavigate=o(this,"mrdNavigate",7),this.mrdSearch=o(this,"mrdSearch",7),this.mrdDownload=o(this,"mrdDownload",7),this.mrdLoadView=o(this,"mrdLoadView",7),this.mrdLoadViewPage=o(this,"mrdLoadViewPage",7),this.mrdLoadImage=o(this,"mrdLoadImage",7),this.mrdViewAction=o(this,"mrdViewAction",7),this.items=[],this.data={},this.views={},this.links={},this.locale=navigator.language,this.searchQueryMap={},this.searchResultsMap={},this.imagePreviewUrl=null,this.imagePreviews={},this.viewLinksMap={},this.searchTimers={},this.handleViewLoadPage=(r,t)=>{r.stopPropagation(),this.mrdLoadViewPage.emit({name:t,page:r.detail.page,sort:r.detail.sort})},this.handleSearchInput=(r,t)=>{this.searchQueryMap=Object.assign(Object.assign({},this.searchQueryMap),{[r]:t}),this.searchTimers[r]&&clearTimeout(this.searchTimers[r]),t.length<2?this.searchResultsMap=Object.assign(Object.assign({},this.searchResultsMap),{[r]:[]}):this.searchTimers[r]=setTimeout((()=>{this.mrdSearch.emit({query:t,dataClass:r})}),300)}}componentDidLoad(){setTimeout((()=>{this.emitLoadViews(),this.emitLoadImages()}),0)}linksChanged(r){Object.keys(null!=r?r:{}).length>0&&this.emitLoadViews()}dataChanged(r){var t;r&&Object.keys(null!==(t=null==r?void 0:r._links)&&void 0!==t?t:{}).length>0&&this.emitLoadViews()}emitLoadViews(){var r,t,o,e,i,a;const n=null!==(t=null===(r=this.data)||void 0===r?void 0:r._links)&&void 0!==t?t:{};for(const r of this.flattenItems(this.items))if(r.type===s.RELATED_VIEW&&r.relatedView){const t=r.relatedView,e=this.views[t.name];if(!e)continue;const i=null===(o=n[t.relatedClass])||void 0===o?void 0:o.href;this.mrdLoadView.emit({name:t.name,href:i,viewConfig:e})}else if(r.type===s.VIEW){const t=null!==(i=null===(e=r.view)||void 0===e?void 0:e.name)&&void 0!==i?i:r.name;if(!t)continue;const o=this.views[t];if(!o)continue;const s=null===(a=this.links[t])||void 0===a?void 0:a.href;this.mrdLoadView.emit({name:t,href:s,viewConfig:o})}}emitLoadImages(){var r;for(const t of this.flattenItems(this.items))if(t.type===s.FIELD&&(null===(r=t.field)||void 0===r?void 0:r.dataType)===n.IMAGE){const r=t.field.name,o=this.data[r],e=null==o?void 0:o.href;e&&this.mrdLoadImage.emit({fieldName:r,href:e})}}flattenItems(r){const t=[];for(const o of r)t.push(o),o.items&&t.push(...this.flattenItems(o.items));return t}async setSearchResults(r,t){const o=null!=t?t:this.resolveSearchKey();o&&(this.searchResultsMap=Object.assign(Object.assign({},this.searchResultsMap),{[o]:r}))}async setViewPage(r,t,o,e,i){i&&(this.viewLinksMap=Object.assign(Object.assign({},this.viewLinksMap),{[r]:i}));const a=this.el.querySelector(`mrd-table[data-view="${r}"]`);a&&(void 0!==e&&(a.totalElements=e,await a.init()),await a.setPage(t,o))}async setImagePreview(r,t){this.imagePreviews=Object.assign(Object.assign({},this.imagePreviews),{[r]:t})}async openImagePreview(r){this.imagePreviewUrl=r}resolveSearchKey(){const r=this.flattenItems(this.items).filter((r=>r.type===s.SEARCH));return 1===r.length&&r[0].search?r[0].search.dataClass:null}renderSingleFieldValue(r,t){var o,i,a,s,d,u,m,h,v,y;const f=r.field,p=f.dataType;switch(p){case n.HYPERLINK:{const r=null!==(o=null==t?void 0:t.href)&&void 0!==o?o:t+"",s=null!==(a=null!==(i=null==t?void 0:t.text)&&void 0!==i?i:null==t?void 0:t.label)&&void 0!==a?a:r;return e("a",{class:"mrd-layout-section__link",href:r,target:"_blank",rel:"noopener noreferrer"},s)}case n.TEXTBLOCK:return e("span",{innerHTML:t+""});case n.LONGTEXT:return e("pre",{class:"mrd-layout-section__pre"},t+"");case n.JSON:return e("pre",{class:"mrd-layout-section__pre",innerHTML:l.formatJson(t)});case n.FILE:{const r=null!==(s=null==t?void 0:t.fileName)&&void 0!==s?s:t+"",o=null!==(d=null==t?void 0:t.href)&&void 0!==d?d:"";return e("button",{class:"mrd-layout-section__download-link",onClick:()=>o&&this.mrdDownload.emit({href:o,fileName:r})},c("download",this.locale))}case n.IMAGE:{const r=null!==(u=null==t?void 0:t.href)&&void 0!==u?u:"",o=null!==(m=null==t?void 0:t.fileName)&&void 0!==m?m:"",i=this.imagePreviews[f.name];return i?e("button",{class:"mrd-layout-section__image-thumb-btn",onClick:()=>{this.imagePreviewUrl=i},title:o||void 0},e("img",{class:"mrd-layout-section__image-thumb",src:i,alt:o})):e("button",{class:"mrd-layout-section__download-link",onClick:()=>r&&this.mrdDownload.emit({href:r,fileName:o})},o||r)}case n.BOOLEAN:return e("span",{class:"mrd-layout-section__boolean mrd-layout-section__boolean--"+(t?"true":"false")},c(t?"yes":"no",this.locale));case n.LIST:{const r=(null!==(h=f.listItems)&&void 0!==h?h:[]).find((r=>r.key===t+"")),o=null!==(v=null==r?void 0:r.label)&&void 0!==v?v:t+"",i=null==r?void 0:r.color,a=null==r?void 0:r.backgroundColor;return i&&a?e("span",{class:"mrd-layout-section__badge",style:{color:i,backgroundColor:a}},o):i?e("span",{class:"mrd-layout-section__badge-dot-row"},e("span",{class:"mrd-layout-section__badge-dot",style:{backgroundColor:i}}),o):o}default:return l.renderValue(p,t,null!==(y=f.listItems)&&void 0!==y?y:[],this.locale)||null}}renderFieldValue(r,t){if(null==t||""===t)return null;if(r.field.multiple&&Array.isArray(t)){const o=t.map((t=>this.renderSingleFieldValue(r,t)));return o.every((r=>"string"==typeof r||null==r))?o.filter(Boolean).join(", ")||null:e("span",null,o.map(((r,t)=>e("span",{key:t+""},r,t<o.length-1?", ":""))))}return this.renderSingleFieldValue(r,t)}renderField(r){if(!r.field)return null;const t=r.field,o=this.data[t.name],i=this.renderFieldValue(r,o);return t.header?e("h1",{class:"mrd-layout-section__field-header",key:t.name},"string"==typeof i?i:null!=o?o+"":r.label):null==i?null:e("div",{class:"mrd-layout-section__field"+(t.dataType===n.TEXTBLOCK||t.dataType===n.LONGTEXT||t.dataType===n.JSON?" mrd-layout-section__field--block":""),key:t.name},e("span",{class:"mrd-layout-section__field-label"},r.label),e("span",{class:"mrd-layout-section__field-value"},i))}renderRelation(r){var t,o,i;if(!r.relation)return null;const a=(null!==(o=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==o?o:{})[r.relation.name];if(!a)return null;const s=(r,t)=>e("button",{key:r,class:"mrd-layout-section__relation-link",onClick:()=>this.mrdNavigate.emit({href:r,label:t})},t);let n;return(null===(i=a.values)||void 0===i?void 0:i.length)?n=a.values.map((r=>s(r.href,r.name))):a.name&&(n=s(a.href,a.name)),n?e("div",{class:"mrd-layout-section__field",key:r.relation.name},e("span",{class:"mrd-layout-section__field-label"},r.label),e("span",{class:"mrd-layout-section__field-value"},n)):null}renderSearch(r){var t,o,i;if(!r.search)return null;const a=r.search.dataClass,s=null!==(t=this.searchQueryMap[a])&&void 0!==t?t:"",n=null!==(o=this.searchResultsMap[a])&&void 0!==o?o:[];return e("div",{class:"mrd-layout-section__search",key:"search-"+a},e("input",{class:"mrd-layout-section__search-input",type:"text",value:s,placeholder:null!==(i=r.label)&&void 0!==i?i:"",onInput:r=>this.handleSearchInput(a,r.target.value)}),n.length>0&&e("ul",{class:"mrd-layout-section__search-results"},n.map((r=>e("li",{key:r.id,class:"mrd-layout-section__search-result"},e("button",{class:"mrd-layout-section__search-result-btn",onClick:()=>this.mrdNavigate.emit({href:r.id,label:r.label})},e("span",{class:"mrd-layout-section__search-result-label"},r.label),r.description&&e("span",{class:"mrd-layout-section__search-result-desc"},r.description)))))))}renderRelatedView(r){var t,o,i,a,n,l,d,u,m;const h=r.type===s.RELATED_VIEW,v=h?null===(t=r.relatedView)||void 0===t?void 0:t.name:null!==(i=null===(o=r.view)||void 0===o?void 0:o.name)&&void 0!==i?i:r.name;if(!v)return null;const y=this.views[v];if(!y)return null;const f=h?null===(a=r.relatedView)||void 0===a?void 0:a.showTitle:null!==(d=null!==(l=null===(n=r.view)||void 0===n?void 0:n.showTitle)&&void 0!==l?l:r.showTitle)&&void 0!==d&&d,p=h?void 0:r.alternativeViews,_=(null!==(u=r.actions)&&void 0!==u?u:["NEW","EXPORT"]).reduce(((r,t)=>("NEW"===t&&r.push({action:"create",label:c("table_new_record",this.locale),icon:"assets/sprites.svg#icon-plus",variant:"primary"}),"EXPORT"===t&&r.push({action:"export",label:c("table_export_excel",this.locale),icon:"assets/sprites.svg#icon-file-excel"}),r)),[]);return e("div",{class:"mrd-layout-section__related-view",key:"view-"+v},f&&r.label&&e("h3",{class:"mrd-layout-section__related-view-title"},r.label),e("mrd-table",{"data-view":v,columns:y.values,locale:this.locale,defaultSort:null!==(m=y.defaultSort)&&void 0!==m?m:"",alternativeViews:p,actions:_,onMrdLoadPage:r=>this.handleViewLoadPage(r,v),onMrdAction:r=>{var t,o,e;r.stopPropagation();const i=null!==(t=this.viewLinksMap[v])&&void 0!==t?t:{},a="export"===r.detail.action?null===(o=i.excel)||void 0===o?void 0:o.href:null===(e=i.self)||void 0===e?void 0:e.href;this.mrdViewAction.emit({name:v,action:r.detail.action,href:a})}}))}renderItem(r){var t,o;switch(r.type){case s.FIELD:return this.renderField(r);case s.RELATION:return this.renderRelation(r);case s.HEADER:return e("h2",{class:"mrd-layout-section__header",key:"header-"+r.label},r.label);case s.TEXT:return e("div",{class:"mrd-layout-section__text",key:"text-"+r.label,innerHTML:null!==(t=r.label)&&void 0!==t?t:""});case s.NAVIGATE:return e("button",{class:"mrd-layout-section__navigate",key:"nav-"+r.label,onClick:()=>{var t;return this.mrdNavigate.emit({label:null!==(t=r.label)&&void 0!==t?t:"",navigate:r.navigate})}},r.label);case s.SEARCH:return this.renderSearch(r);case s.SECTION:case s.GROUP:return e("div",{class:"mrd-layout-section__group",key:"group-"+r.label},r.label&&e("h3",{class:"mrd-layout-section__group-title"},r.label),(null!==(o=r.items)&&void 0!==o?o:[]).map((r=>this.renderItem(r))));case s.RELATED_VIEW:case s.VIEW:return this.renderRelatedView(r);default:return null}}renderImageModal(){return this.imagePreviewUrl?e("div",{class:"mrd-layout-section__modal-backdrop",onClick:()=>{this.imagePreviewUrl=null}},e("div",{class:"mrd-layout-section__modal",onClick:r=>r.stopPropagation()},e("button",{class:"mrd-layout-section__modal-close",onClick:()=>{this.imagePreviewUrl=null}},"✕"),e("img",{class:"mrd-layout-section__modal-image",src:this.imagePreviewUrl,alt:""}))):null}render(){return e(i,{key:"007077c73ddcc5c9e6ce546f083f42c07f8b94a4"},e("div",{key:"e9904536e9361d9a36d613c20af55ddf8d9acda6",class:"mrd-layout-section"},this.items.map((r=>this.renderItem(r)))),this.renderImageModal())}get el(){return this}static get watchers(){return{links:[{linksChanged:0}],data:[{dataChanged:0}]}}static get style(){return".mrd-layout-section.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-layout-section__field.sc-mrd-layout-section{display:grid;grid-template-columns:200px 1fr;align-items:baseline;gap:0 var(--mrd-space-2);padding:var(--mrd-space-1) 0}.mrd-layout-section__field-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-500);padding-top:1px}.mrd-layout-section__field-value.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);word-break:break-word}.mrd-layout-section__field-header.sc-mrd-layout-section{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-4) 0;padding:0}.mrd-layout-section__header.sc-mrd-layout-section{font-size:var(--mrd-font-size-xl);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:var(--mrd-space-4) 0 var(--mrd-space-2) 0;padding:0}.mrd-layout-section__text.sc-mrd-layout-section{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed);margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:1px solid var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light);border-color:var(--mrd-color-primary)}.mrd-layout-section__link.sc-mrd-layout-section{color:var(--mrd-color-primary);text-decoration:none}.mrd-layout-section__link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__relation-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__relation-link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__download-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;text-decoration:underline;text-align:left}.mrd-layout-section__boolean--true.sc-mrd-layout-section{color:var(--mrd-color-success);font-weight:var(--mrd-font-weight-semibold)}.mrd-layout-section__boolean--false.sc-mrd-layout-section{color:var(--mrd-color-neutral-400)}.mrd-layout-section__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.mrd-layout-section__badge.sc-mrd-layout-section{display:inline-block;font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);padding:2px var(--mrd-space-3);border-radius:10px}.mrd-layout-section__badge-dot-row.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2)}.mrd-layout-section__badge-dot.sc-mrd-layout-section{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.mrd-layout-section__pre.sc-mrd-layout-section{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);background-color:var(--mrd-color-neutral-50);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);margin:0;overflow-x:auto;white-space:pre-wrap;word-break:break-word}.mrd-layout-section__group.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__group-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;text-transform:uppercase;letter-spacing:0.05em}.mrd-layout-section__related-view.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__related-view-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-lg);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:0 0 var(--mrd-space-3) 0}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-input.sc-mrd-layout-section{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-layout-section__search-input.sc-mrd-layout-section:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__search-input.sc-mrd-layout-section::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-layout-section__search-results.sc-mrd-layout-section{position:absolute;top:100%;left:0;right:0;background-color:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-300);border-top:none;border-radius:0 0 var(--mrd-border-radius) var(--mrd-border-radius);box-shadow:var(--mrd-shadow-sm);z-index:100;max-height:300px;overflow-y:auto;list-style:none;margin:0;padding:var(--mrd-space-1) 0}.mrd-layout-section__search-result.sc-mrd-layout-section{margin:0;padding:0}.mrd-layout-section__search-result-btn.sc-mrd-layout-section{display:flex;flex-direction:column;width:100%;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;text-align:left;cursor:pointer;font-family:var(--mrd-font-family)}.mrd-layout-section__search-result-btn.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light)}.mrd-layout-section__search-result-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800)}.mrd-layout-section__search-result-desc.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section{background:none;border:none;padding:0;cursor:pointer;display:inline-block;border-radius:var(--mrd-border-radius);overflow:hidden;line-height:0}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section:hover .mrd-layout-section__image-thumb.sc-mrd-layout-section{opacity:0.85}.mrd-layout-section__image-thumb.sc-mrd-layout-section{display:block;max-width:160px;max-height:100px;border-radius:var(--mrd-border-radius);object-fit:cover;transition:opacity 0.15s}.mrd-layout-section__modal-backdrop.sc-mrd-layout-section{position:fixed;inset:0;background:rgba(0, 0, 0, 0.6);z-index:300;display:flex;align-items:center;justify-content:center}.mrd-layout-section__modal.sc-mrd-layout-section{position:relative;background:#fff;border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);max-width:min(90vw, 900px);max-height:90vh;display:flex;align-items:center;justify-content:center;box-shadow:var(--mrd-shadow-lg)}.mrd-layout-section__modal-close.sc-mrd-layout-section{position:absolute;top:var(--mrd-space-2);right:var(--mrd-space-2);background:rgba(0, 0, 0, 0.5);border:none;border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;font-size:var(--mrd-font-size-sm);line-height:1;z-index:1}.mrd-layout-section__modal-close.sc-mrd-layout-section:hover{background:rgba(0, 0, 0, 0.8)}.mrd-layout-section__modal-image.sc-mrd-layout-section{display:block;max-width:100%;max-height:calc(90vh - 2rem);border-radius:var(--mrd-border-radius);object-fit:contain}"}},[2,"mrd-layout-section",{items:[16],data:[16],views:[16],links:[16],locale:[1],searchQueryMap:[32],searchResultsMap:[32],imagePreviewUrl:[32],imagePreviews:[32],setSearchResults:[64],setViewPage:[64],setImagePreview:[64],openImagePreview:[64]},void 0,{links:[{linksChanged:0}],data:[{dataChanged:0}]}]),m=u,h=function(){"undefined"!=typeof customElements&&["mrd-layout-section","mrd-table"].forEach((r=>{switch(r){case"mrd-layout-section":customElements.get(a(r))||customElements.define(a(r),u);break;case"mrd-table":customElements.get(a(r))||d()}}))};export{m as MrdLayoutSection,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as r,HTMLElement as e,createEvent as t,h as d,Host as o,transformTag as i}from"@stencil/core/internal/client";import{t as l}from"./i18n.js";import{v as
|
|
1
|
+
import{proxyCustomElement as r,HTMLElement as e,createEvent as t,h as d,Host as o,transformTag as i}from"@stencil/core/internal/client";import{t as l}from"./i18n.js";import{v as n}from"./validation.js";const a=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=t(this,"mrdChange",7),this.mrdBlur=t(this,"mrdBlur",7),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&&!n(e)?l("required",this.locale):"",this.mrdBlur.emit({name:this.name,value:e})}}render(){const r=!!this.error;return d(o,{key:"3142f97e26fdef5547c8dd9d236ed8bc40d5c65f"},d("div",{key:"b78567596d8c6459c8e9b28ea6b02d3fe65fd16c",class:"mrd-longtext-field"},this.label&&d("label",{key:"e85d8657fcc49fc7e15c06b8a98b34c03738ef5b",class:"mrd-longtext-field__label"+(this.required?" mrd-longtext-field__label--required":"")},this.label),this.disabled?d("pre",{class:"mrd-longtext-field__content"},this.value):d("textarea",{class:"mrd-longtext-field__input"+(r?" mrd-longtext-field__input--error":""),name:this.name,placeholder:this.placeholder,required:this.required,rows:10,onInput:this.handleInput,onBlur:this.handleBlur},this.value),r&&d("span",{key:"63cdcaf136e345197c42516f150752ec1d8665fa",class:"mrd-longtext-field__error"},this.error)))}static get style(){return".sc-mrd-longtext-field-h{display:block}.mrd-longtext-field.sc-mrd-longtext-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-longtext-field__label.sc-mrd-longtext-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-longtext-field__label--required.sc-mrd-longtext-field::after{content:' *';color:var(--mrd-color-danger)}.mrd-longtext-field__input.sc-mrd-longtext-field{display:block;width:100%;min-height:calc(var(--mrd-input-height) * 5);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;resize:vertical;box-sizing:border-box;line-height:1.5}.mrd-longtext-field__input.sc-mrd-longtext-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-longtext-field__input.sc-mrd-longtext-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-longtext-field__input--error.sc-mrd-longtext-field{border-color:var(--mrd-border-color-error)}.mrd-longtext-field__input--error.sc-mrd-longtext-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-longtext-field__content.sc-mrd-longtext-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);white-space:pre-wrap;word-break:break-word;margin:0;padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);background-color:var(--mrd-input-bg-disabled);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);line-height:1.5}.mrd-longtext-field__error.sc-mrd-longtext-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}"}},[2,"mrd-longtext-field",{name:[1],label:[1],value:[1],placeholder:[1],required:[4],disabled:[4],locale:[1],error:[32]}]);function s(){"undefined"!=typeof customElements&&["mrd-longtext-field"].forEach((r=>{"mrd-longtext-field"===r&&(customElements.get(i(r))||customElements.define(i(r),a))}))}export{a as M,s as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as r,HTMLElement as
|
|
1
|
+
import{proxyCustomElement as r,HTMLElement as e,createEvent as i,h as d,Host as t,transformTag as s}from"@stencil/core/internal/client";import{t as a}from"./i18n.js";import{c as o,v as l}from"./validation.js";import{p as n,f as m}from"./format.js";import{b as c}from"./client-layout.js";const u=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=i(this,"mrdChange",7),this.mrdBlur=i(this,"mrdBlur",7),this.name="",this.label="",this.value=null,this.placeholder="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.dataType=c.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||o(i,this.dataType)?"":a("invalid_number",this.locale):a("required",this.locale),null!==i&&l(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===c.PERCENTAGE?m(r,this.locale,{minimumFractionDigits:0,maximumFractionDigits:this.decimalPrecision})+"%":m(r,this.locale,this.dataType===c.DECIMAL?{minimumFractionDigits:this.decimalPrecision,maximumFractionDigits:this.decimalPrecision}:{maximumFractionDigits:0})}render(){const r=!!this.error,e=this.dataType===c.PERCENTAGE?"%":"";return d(t,{key:"ba3488fb12f72bb04164e3e94c028fb8a085f1f2"},d("div",{key:"582e30a2a256c16cc3b0cab6e64460a0a5ec1fa2",class:"mrd-number-field"},this.label&&d("label",{key:"87fe77ce80e888406ecedaa450e8c3d2a61c790a",class:"mrd-number-field__label"+(this.required?" mrd-number-field__label--required":"")},this.label),d("div",{key:"e3d8cf06f585add372e385d6e6ef7d60ece8071b",class:"mrd-number-field__input-wrapper"},d("input",{key:"04710b67ee0dcb9db327e25b2467b1b3499bc9a8",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&&d("span",{key:"9713244d784c82213ea835a5a6d47d468ccb0bb9",class:"mrd-number-field__error"},this.error)))}static get style(){return".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)}"}},[2,"mrd-number-field",{name:[1],label:[1],value:[2],placeholder:[1],required:[4],disabled:[4],locale:[1],dataType:[1,"data-type"],decimalPrecision:[2,"decimal-precision"],displayValue:[32],error:[32]}]);function b(){"undefined"!=typeof customElements&&["mrd-number-field"].forEach((r=>{"mrd-number-field"===r&&(customElements.get(s(r))||customElements.define(s(r),u))}))}export{u as M,b as d}
|