@mmlogic/components 0.3.8 → 0.3.9
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/index.cjs.js +13 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_20.cjs.entry.js → mrd-boolean-field_22.cjs.entry.js} +504 -23
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +1 -1
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +1 -1
- package/dist/collection/components/mrd-date-field/mrd-date-field.js +1 -1
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +1 -1
- package/dist/collection/components/mrd-document-list/mrd-document-list.js +578 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.scss +126 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.js +177 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.scss +121 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.js +1 -1
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +1 -1
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +153 -15
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +46 -3
- 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-secret-field/mrd-secret-field.js +2 -2
- 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 +19 -2
- package/dist/collection/types/client-layout.js +10 -0
- package/dist/collection/utils/i18n.js +24 -0
- package/dist/components/client-layout.js +1 -1
- package/dist/components/format.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-boolean-field2.js +1 -1
- package/dist/components/mrd-currency-field2.js +1 -1
- package/dist/components/mrd-date-field2.js +1 -1
- package/dist/components/mrd-datetime-field2.js +1 -1
- package/dist/components/mrd-document-list.d.ts +11 -0
- package/dist/components/mrd-document-list.js +1 -0
- package/dist/components/mrd-document-list2.js +1 -0
- package/dist/components/mrd-document-view.d.ts +11 -0
- package/dist/components/mrd-document-view.js +1 -0
- package/dist/components/mrd-document-view2.js +1 -0
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- 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/index.js +11 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_20.entry.js → mrd-boolean-field_22.entry.js} +504 -25
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-b547291b.entry.js +1 -0
- package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +108 -0
- package/dist/types/components/mrd-document-view/mrd-document-view.d.ts +36 -0
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +33 -6
- package/dist/types/components.d.ts +290 -15
- package/dist/types/types/client-layout.d.ts +38 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/cell-renderer-CbRwLOo8.js.map +0 -1
- package/dist/mosterdcomponents/client-layout-D88nn5zf.js.map +0 -1
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
- package/dist/mosterdcomponents/i18n-hoGGKbKU.js.map +0 -1
- package/dist/mosterdcomponents/index-6yQUNVww.js.map +0 -1
- package/dist/mosterdcomponents/index-I5SuYv7a.js.map +0 -1
- package/dist/mosterdcomponents/index.esm.js.map +0 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
- package/dist/mosterdcomponents/p-7bfaee51.entry.js +0 -1
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
- package/dist/mosterdcomponents/validation-ixb43cqU.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-_tsCCkAi.js';
|
|
2
|
-
import { ClientLayoutItemFieldDataType, ClientLayoutItemType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior } from './index.js';
|
|
2
|
+
import { ClientLayoutItemFieldDataType, ClientLayoutItemType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, resolveArchetype, ARCHETYPE_DOCUMENT } from './index.js';
|
|
3
3
|
|
|
4
4
|
const mrdBooleanFieldScss = () => `.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)}`;
|
|
5
5
|
|
|
@@ -27,7 +27,7 @@ const MrdBooleanField = class {
|
|
|
27
27
|
this.checked = !!this.value;
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
|
-
return (h(Host, { key: '
|
|
30
|
+
return (h(Host, { key: '38e65a1c7971912f8259d09281b272d7cbd446f2' }, h("div", { key: 'e10919998731d744cc2a13130c5f355c9b8fc9aa', class: "mrd-boolean-field" }, h("label", { key: 'db85a2c80cc62fdfd25237e3f5c7750bf1666819', class: "mrd-boolean-field__toggle-label" }, h("input", { key: 'cddd7004593fa4671abb89f4f805c4a009db99ef', class: "mrd-boolean-field__checkbox", type: "checkbox", name: this.name, checked: this.checked, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), h("span", { key: 'f90f0ed6d74d6688e51b8d85a5397a0597d95ad8', class: "mrd-boolean-field__toggle", "aria-hidden": "true" }), this.label && (h("span", { key: '7e4582b1d9a5b08c00c220bec53baa6c14cbfe43', class: `mrd-boolean-field__text${this.required ? ' mrd-boolean-field__text--required' : ''}` }, this.label))))));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
MrdBooleanField.style = mrdBooleanFieldScss();
|
|
@@ -66,6 +66,9 @@ const translations = {
|
|
|
66
66
|
table_filter_clear_all: 'Alle filters wissen',
|
|
67
67
|
table_new_record: 'Nieuw record',
|
|
68
68
|
table_export_excel: 'Exporteer naar Excel',
|
|
69
|
+
doc_view_switch: 'Weergave wisselen',
|
|
70
|
+
doc_view_tree: 'Boomweergave',
|
|
71
|
+
doc_view_list: 'Lijstweergave',
|
|
69
72
|
// mrd-table filter popup
|
|
70
73
|
filter_sorting: 'Sortering',
|
|
71
74
|
filter_ascending: 'Oplopend',
|
|
@@ -129,6 +132,9 @@ const translations = {
|
|
|
129
132
|
table_filter_clear_all: 'Clear all filters',
|
|
130
133
|
table_new_record: 'New record',
|
|
131
134
|
table_export_excel: 'Export to Excel',
|
|
135
|
+
doc_view_switch: 'Switch view',
|
|
136
|
+
doc_view_tree: 'Tree view',
|
|
137
|
+
doc_view_list: 'List view',
|
|
132
138
|
// mrd-table filter popup
|
|
133
139
|
filter_sorting: 'Sorting',
|
|
134
140
|
filter_ascending: 'Ascending',
|
|
@@ -192,6 +198,9 @@ const translations = {
|
|
|
192
198
|
table_filter_clear_all: 'مسح جميع الفلاتر',
|
|
193
199
|
table_new_record: 'سجل جديد',
|
|
194
200
|
table_export_excel: 'تصدير إلى Excel',
|
|
201
|
+
doc_view_switch: 'تبديل العرض',
|
|
202
|
+
doc_view_tree: 'عرض شجري',
|
|
203
|
+
doc_view_list: 'عرض القائمة',
|
|
195
204
|
// mrd-table filter popup
|
|
196
205
|
filter_sorting: 'الترتيب',
|
|
197
206
|
filter_ascending: 'تصاعدي',
|
|
@@ -255,6 +264,9 @@ const translations = {
|
|
|
255
264
|
table_filter_clear_all: 'Effacer tous les filtres',
|
|
256
265
|
table_new_record: 'Nouvel enregistrement',
|
|
257
266
|
table_export_excel: 'Exporter vers Excel',
|
|
267
|
+
doc_view_switch: 'Changer de vue',
|
|
268
|
+
doc_view_tree: 'Vue arborescente',
|
|
269
|
+
doc_view_list: 'Vue liste',
|
|
258
270
|
// mrd-table filter popup
|
|
259
271
|
filter_sorting: 'Tri',
|
|
260
272
|
filter_ascending: 'Croissant',
|
|
@@ -318,6 +330,9 @@ const translations = {
|
|
|
318
330
|
table_filter_clear_all: 'Alle Filter löschen',
|
|
319
331
|
table_new_record: 'Neuer Eintrag',
|
|
320
332
|
table_export_excel: 'Als Excel exportieren',
|
|
333
|
+
doc_view_switch: 'Ansicht wechseln',
|
|
334
|
+
doc_view_tree: 'Baumansicht',
|
|
335
|
+
doc_view_list: 'Listenansicht',
|
|
321
336
|
// mrd-table filter popup
|
|
322
337
|
filter_sorting: 'Sortierung',
|
|
323
338
|
filter_ascending: 'Aufsteigend',
|
|
@@ -381,6 +396,9 @@ const translations = {
|
|
|
381
396
|
table_filter_clear_all: 'Borrar todos los filtros',
|
|
382
397
|
table_new_record: 'Nuevo registro',
|
|
383
398
|
table_export_excel: 'Exportar a Excel',
|
|
399
|
+
doc_view_switch: 'Cambiar vista',
|
|
400
|
+
doc_view_tree: 'Vista de árbol',
|
|
401
|
+
doc_view_list: 'Vista de lista',
|
|
384
402
|
// mrd-table filter popup
|
|
385
403
|
filter_sorting: 'Ordenación',
|
|
386
404
|
filter_ascending: 'Ascendente',
|
|
@@ -444,6 +462,9 @@ const translations = {
|
|
|
444
462
|
table_filter_clear_all: 'Cancella tutti i filtri',
|
|
445
463
|
table_new_record: 'Nuovo record',
|
|
446
464
|
table_export_excel: 'Esporta in Excel',
|
|
465
|
+
doc_view_switch: 'Cambia vista',
|
|
466
|
+
doc_view_tree: 'Vista ad albero',
|
|
467
|
+
doc_view_list: 'Vista elenco',
|
|
447
468
|
// mrd-table filter popup
|
|
448
469
|
filter_sorting: 'Ordinamento',
|
|
449
470
|
filter_ascending: 'Crescente',
|
|
@@ -507,6 +528,9 @@ const translations = {
|
|
|
507
528
|
table_filter_clear_all: 'Очистити всі фільтри',
|
|
508
529
|
table_new_record: 'Новий запис',
|
|
509
530
|
table_export_excel: 'Експортувати до Excel',
|
|
531
|
+
doc_view_switch: 'Змінити вигляд',
|
|
532
|
+
doc_view_tree: 'Деревоподібний вигляд',
|
|
533
|
+
doc_view_list: 'Список',
|
|
510
534
|
// mrd-table filter popup
|
|
511
535
|
filter_sorting: 'Сортування',
|
|
512
536
|
filter_ascending: 'За зростанням',
|
|
@@ -719,7 +743,7 @@ const MrdCurrencyField = class {
|
|
|
719
743
|
}
|
|
720
744
|
render() {
|
|
721
745
|
const hasError = !!this.error;
|
|
722
|
-
return (h(Host, { key: '
|
|
746
|
+
return (h(Host, { key: 'fe3520c44d831caf36b388cb5968a9518b16cb8b' }, h("div", { key: '50c1fd2d53038e46da575d3e46e1ec26c2da423b', class: "mrd-currency-field" }, this.label && (h("label", { key: 'a2649d41bf6e3765c8a62ba6559c64c41615027a', class: `mrd-currency-field__label${this.required ? ' mrd-currency-field__label--required' : ''}` }, this.label)), h("div", { key: '952b51f315b4a5c05a8373ce3a3f1041086ba8b8', class: "mrd-currency-field__row" }, h("input", { key: '137a72ffc5d79fc8e0a8cf44c012d84a50c26d5b', class: `mrd-currency-field__amount${hasError ? ' 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 }), h("select", { key: '1755854ca9b76dc4b41ad84b6b788685931ace36', class: "mrd-currency-field__currency", disabled: this.disabled, onChange: this.handleCurrencyChange }, COMMON_CURRENCIES.map(c => (h("option", { key: c, value: c, selected: c === this.currency }, c))))), hasError && h("span", { key: '0f10eb98c2e6444651d79d1de92acd0dbcc7133b', class: "mrd-currency-field__error" }, this.error))));
|
|
723
747
|
}
|
|
724
748
|
};
|
|
725
749
|
MrdCurrencyField.style = mrdCurrencyFieldScss();
|
|
@@ -755,7 +779,7 @@ const MrdDateField = class {
|
|
|
755
779
|
}
|
|
756
780
|
render() {
|
|
757
781
|
const hasError = !!this.error;
|
|
758
|
-
return (h(Host, { key: '
|
|
782
|
+
return (h(Host, { key: '2c0dc2311068a5c759fe8efe58a98a71a9cf4b7b' }, h("div", { key: 'ee1cc0e9a2943cc42439825b8f21cd3492eaca05', class: "mrd-date-field" }, this.label && (h("label", { key: '3f836a991e676b6070a8b3800edfce00cc0d3b3d', class: `mrd-date-field__label${this.required ? ' mrd-date-field__label--required' : ''}` }, this.label)), h("input", { key: '575185661987eea3dc91950f51995b2cc75debea', class: `mrd-date-field__input${hasError ? ' 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 }), hasError && h("span", { key: '480ec99200989f3dc543d9afc648d83d31992b3c', class: "mrd-date-field__error" }, this.error))));
|
|
759
783
|
}
|
|
760
784
|
};
|
|
761
785
|
MrdDateField.style = mrdDateFieldScss();
|
|
@@ -818,7 +842,7 @@ const MrdDatetimeField = class {
|
|
|
818
842
|
}
|
|
819
843
|
render() {
|
|
820
844
|
const hasError = !!this.error;
|
|
821
|
-
return (h(Host, { key: '
|
|
845
|
+
return (h(Host, { key: 'ea8b3b68100ffdb316bc5048f82d85d238bb2e4b' }, h("div", { key: 'c192c6998ee474aaf4df7b3b97ae0bd61f6d624d', class: "mrd-datetime-field" }, this.label && (h("label", { key: '1fbd66c17d76508f0d698a2c258be6779e98d85e', class: `mrd-datetime-field__label${this.required ? ' mrd-datetime-field__label--required' : ''}` }, this.label)), h("input", { key: 'fc9612c062a1cab5076a06598cabf227adce996c', class: `mrd-datetime-field__input${hasError ? ' mrd-datetime-field__input--error' : ''}`, type: "datetime-local", name: this.name, value: this.localValue, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), hasError && h("span", { key: '8788ac01739302f6ad61010b238ff38d45e1b68a', class: "mrd-datetime-field__error" }, this.error))));
|
|
822
846
|
}
|
|
823
847
|
static get watchers() { return {
|
|
824
848
|
"value": [{
|
|
@@ -828,6 +852,402 @@ const MrdDatetimeField = class {
|
|
|
828
852
|
};
|
|
829
853
|
MrdDatetimeField.style = mrdDatetimeFieldScss();
|
|
830
854
|
|
|
855
|
+
const mrdDocumentListScss = () => `.sc-mrd-document-list-h{display:block}.mrd-document-list.sc-mrd-document-list{padding:var(--mrd-space-2) 0}.mrd-document-list__row.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:2.125rem;padding:0 var(--mrd-space-4);cursor:pointer;user-select:none;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-document-list__row.sc-mrd-document-list:hover{background:var(--mrd-color-neutral-50)}.mrd-document-list__row--dossier.sc-mrd-document-list .mrd-document-list__label.sc-mrd-document-list{font-weight:var(--mrd-font-weight-semibold)}.mrd-document-list__indent.sc-mrd-document-list{flex:none}.mrd-document-list__chev.sc-mrd-document-list{width:1rem;height:1rem;flex:none;display:grid;place-items:center;color:var(--mrd-color-neutral-400);transition:transform var(--mrd-transition-fast)}.mrd-document-list__chev.sc-mrd-document-list svg.sc-mrd-document-list{width:0.6875rem;height:0.6875rem}.mrd-document-list__chev--open.sc-mrd-document-list{transform:rotate(90deg)}.mrd-document-list__chev--leaf.sc-mrd-document-list{visibility:hidden}.mrd-document-list__icon.sc-mrd-document-list{width:1.0625rem;height:1.0625rem;flex:none}.mrd-document-list__icon--dossier.sc-mrd-document-list{color:var(--mrd-color-primary)}.mrd-document-list__icon--folder.sc-mrd-document-list{color:#d9a441}.mrd-document-list__icon--doc.sc-mrd-document-list{color:var(--mrd-color-neutral-400)}.mrd-document-list__label.sc-mrd-document-list{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-document-list__count.sc-mrd-document-list{flex:none;font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius-full);padding:0.0625rem 0.5rem}.mrd-document-list__date.sc-mrd-document-list{flex:none;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400);font-variant-numeric:tabular-nums}.mrd-document-list__loading.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:1.875rem;padding:0 var(--mrd-space-4);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400)}.mrd-document-list__spinner.sc-mrd-document-list{width:0.75rem;height:0.75rem;border:2px solid var(--mrd-color-neutral-300);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-document-list-spin 0.7s linear infinite}@keyframes mrd-document-list-spin{to{transform:rotate(360deg)}}.mrd-document-list__empty.sc-mrd-document-list{padding:var(--mrd-space-8) var(--mrd-space-4);text-align:center;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm)}`;
|
|
856
|
+
|
|
857
|
+
const MrdDocumentList = class {
|
|
858
|
+
constructor(hostRef) {
|
|
859
|
+
registerInstance(this, hostRef);
|
|
860
|
+
this.mrdLoadDistinct = createEvent(this, "mrdLoadDistinct");
|
|
861
|
+
this.mrdLoadPage = createEvent(this, "mrdLoadPage");
|
|
862
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
863
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
864
|
+
this.item = null;
|
|
865
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
866
|
+
this.parentId = '';
|
|
867
|
+
this.locale = navigator.language;
|
|
868
|
+
this.containers = [];
|
|
869
|
+
this.rootLoading = true;
|
|
870
|
+
/** True when the single-container level is collapsed away (dossier context). */
|
|
871
|
+
this.singleContainer = false;
|
|
872
|
+
this.nodeIndex = new Map();
|
|
873
|
+
}
|
|
874
|
+
componentDidLoad() {
|
|
875
|
+
this.emitContainerDistinct();
|
|
876
|
+
}
|
|
877
|
+
// ── Slot field names ─────────────────────────────────────────────────────
|
|
878
|
+
get containerField() {
|
|
879
|
+
var _a, _b, _c;
|
|
880
|
+
return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.container) !== null && _c !== void 0 ? _c : 'container';
|
|
881
|
+
}
|
|
882
|
+
get folderField() {
|
|
883
|
+
var _a, _b, _c;
|
|
884
|
+
return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.folder) !== null && _c !== void 0 ? _c : 'folder';
|
|
885
|
+
}
|
|
886
|
+
get titleField() {
|
|
887
|
+
var _a, _b, _c;
|
|
888
|
+
return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : 'name';
|
|
889
|
+
}
|
|
890
|
+
get dateField() {
|
|
891
|
+
var _a, _b;
|
|
892
|
+
return (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.date;
|
|
893
|
+
}
|
|
894
|
+
// ── Path / query building (mirrors mrd-table conventions) ────────────────
|
|
895
|
+
/** VIEW: `/{dataClass}`; RELATED_VIEW: `/{fromClass}/{parentId}/{dataClass}`. */
|
|
896
|
+
buildDataPath() {
|
|
897
|
+
var _a, _b, _c;
|
|
898
|
+
const it = this.item;
|
|
899
|
+
const dataClass = (_b = (_a = it === null || it === void 0 ? void 0 : it.dataClass) !== null && _a !== void 0 ? _a : it === null || it === void 0 ? void 0 : it.relatedClass) !== null && _b !== void 0 ? _b : '';
|
|
900
|
+
if ((it === null || it === void 0 ? void 0 : it.type) === ClientLayoutItemType.RELATED_VIEW) {
|
|
901
|
+
return `/${(_c = it.fromClass) !== null && _c !== void 0 ? _c : ''}/${this.parentId}/${dataClass}`;
|
|
902
|
+
}
|
|
903
|
+
return `/${dataClass}`;
|
|
904
|
+
}
|
|
905
|
+
/** View-level static filters + filterClass, shared by every request. */
|
|
906
|
+
baseParams() {
|
|
907
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
908
|
+
const p = new URLSearchParams();
|
|
909
|
+
const filterClass = (_a = this.item) === null || _a === void 0 ? void 0 : _a.filterClass;
|
|
910
|
+
if (filterClass)
|
|
911
|
+
p.set('type', filterClass);
|
|
912
|
+
for (const f of ((_d = (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.view) === null || _c === void 0 ? void 0 : _c.filter) !== null && _d !== void 0 ? _d : [])) {
|
|
913
|
+
if (!f.name)
|
|
914
|
+
continue;
|
|
915
|
+
if (f.operator === 'EMPTY') {
|
|
916
|
+
p.set(f.name, '');
|
|
917
|
+
continue;
|
|
918
|
+
}
|
|
919
|
+
if (f.operator === 'NOT_EMPTY') {
|
|
920
|
+
p.set(f.name + '_notempty', 'true');
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
if (f.operator === 'STARTS_WITH') {
|
|
924
|
+
p.set(f.name + '_startswith', String((_e = f.value) !== null && _e !== void 0 ? _e : ''));
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
if (f.operator === 'FROM') {
|
|
928
|
+
p.set(f.name + '_from', String((_f = f.value) !== null && _f !== void 0 ? _f : ''));
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
if (f.operator === 'TO') {
|
|
932
|
+
p.set(f.name + '_to', String((_g = f.value) !== null && _g !== void 0 ? _g : ''));
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
if (f.value != null) {
|
|
936
|
+
p.set(f.name, String(f.value));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return p;
|
|
940
|
+
}
|
|
941
|
+
emitContainerDistinct() {
|
|
942
|
+
const p = this.baseParams();
|
|
943
|
+
p.set('distinct', this.containerField);
|
|
944
|
+
this.mrdLoadDistinct.emit({
|
|
945
|
+
nodeId: MrdDocumentList.ROOT,
|
|
946
|
+
distinct: this.containerField,
|
|
947
|
+
path: this.buildDataPath() + '/distinct',
|
|
948
|
+
qs: p.toString(),
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
emitFolderDistinct(container) {
|
|
952
|
+
var _a;
|
|
953
|
+
const p = this.baseParams();
|
|
954
|
+
p.set('distinct', this.folderField);
|
|
955
|
+
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
956
|
+
container.loading = true;
|
|
957
|
+
this.mrdLoadDistinct.emit({
|
|
958
|
+
nodeId: container.id,
|
|
959
|
+
distinct: this.folderField,
|
|
960
|
+
path: this.buildDataPath() + '/distinct',
|
|
961
|
+
qs: p.toString(),
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
emitDocuments(container, node) {
|
|
965
|
+
var _a, _b;
|
|
966
|
+
const p = this.baseParams();
|
|
967
|
+
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
968
|
+
p.set(this.folderField, (_b = node.fullPath) !== null && _b !== void 0 ? _b : '');
|
|
969
|
+
node.loading = true;
|
|
970
|
+
this.mrdLoadPage.emit({
|
|
971
|
+
nodeId: node.id,
|
|
972
|
+
page: 0,
|
|
973
|
+
sort: '',
|
|
974
|
+
path: this.buildDataPath(),
|
|
975
|
+
qs: p.toString(),
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
// ── Public injection API ─────────────────────────────────────────────────
|
|
979
|
+
/** Inject distinct values for a node. `nodeId` is the sentinel root (containers)
|
|
980
|
+
* or a container node id (folders). */
|
|
981
|
+
async setDistinct(nodeId, values) {
|
|
982
|
+
if (nodeId === MrdDocumentList.ROOT) {
|
|
983
|
+
this.applyContainers(values);
|
|
984
|
+
}
|
|
985
|
+
else {
|
|
986
|
+
this.applyFolders(nodeId, values);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
/** Inject the documents loaded for one folder node. */
|
|
990
|
+
async setDocuments(nodeId, docs) {
|
|
991
|
+
const node = this.nodeIndex.get(nodeId);
|
|
992
|
+
if (!node)
|
|
993
|
+
return;
|
|
994
|
+
node.docs = docs !== null && docs !== void 0 ? docs : [];
|
|
995
|
+
node.docsLoaded = true;
|
|
996
|
+
node.loading = false;
|
|
997
|
+
this.bump();
|
|
998
|
+
}
|
|
999
|
+
applyContainers(values) {
|
|
1000
|
+
const nodes = [];
|
|
1001
|
+
for (const v of values) {
|
|
1002
|
+
if (!v.value || typeof v.value !== 'object')
|
|
1003
|
+
continue;
|
|
1004
|
+
const href = v.value.href;
|
|
1005
|
+
const node = this.makeContainerNode(href, v.value.name, v.count);
|
|
1006
|
+
nodes.push(node);
|
|
1007
|
+
this.nodeIndex.set(node.id, node);
|
|
1008
|
+
}
|
|
1009
|
+
this.containers = nodes;
|
|
1010
|
+
this.rootLoading = false;
|
|
1011
|
+
this.singleContainer = nodes.length === 1;
|
|
1012
|
+
// Single container (dossier context): collapse the level away, load its folders now.
|
|
1013
|
+
if (this.singleContainer) {
|
|
1014
|
+
const only = nodes[0];
|
|
1015
|
+
only.open = true;
|
|
1016
|
+
this.emitFolderDistinct(only);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
applyFolders(containerId, values) {
|
|
1020
|
+
const container = this.nodeIndex.get(containerId);
|
|
1021
|
+
if (!container)
|
|
1022
|
+
return;
|
|
1023
|
+
container.children = [];
|
|
1024
|
+
container.hasDocs = false;
|
|
1025
|
+
container.docCount = 0;
|
|
1026
|
+
for (const v of values) {
|
|
1027
|
+
const raw = typeof v.value === 'string' ? v.value : v.value == null ? '' : String(v.value);
|
|
1028
|
+
const segs = this.splitFolder(raw);
|
|
1029
|
+
if (segs.length === 0) {
|
|
1030
|
+
// Root documents — the container's own direct documents.
|
|
1031
|
+
container.hasDocs = true;
|
|
1032
|
+
container.docCount = v.count;
|
|
1033
|
+
container.fullPath = raw;
|
|
1034
|
+
continue;
|
|
1035
|
+
}
|
|
1036
|
+
let node = container;
|
|
1037
|
+
const acc = [];
|
|
1038
|
+
for (const seg of segs) {
|
|
1039
|
+
acc.push(seg);
|
|
1040
|
+
let child = node.children.find(c => c.label === seg);
|
|
1041
|
+
if (!child) {
|
|
1042
|
+
child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg);
|
|
1043
|
+
node.children.push(child);
|
|
1044
|
+
this.nodeIndex.set(child.id, child);
|
|
1045
|
+
}
|
|
1046
|
+
node = child;
|
|
1047
|
+
}
|
|
1048
|
+
node.hasDocs = true;
|
|
1049
|
+
node.docCount = v.count;
|
|
1050
|
+
node.fullPath = raw;
|
|
1051
|
+
}
|
|
1052
|
+
this.computeTotals(container);
|
|
1053
|
+
container.foldersLoaded = true;
|
|
1054
|
+
container.loading = false;
|
|
1055
|
+
// If the container has root documents, load them now (they show inline on expand).
|
|
1056
|
+
if (container.hasDocs && !container.docsLoaded) {
|
|
1057
|
+
this.emitDocuments(container, container);
|
|
1058
|
+
}
|
|
1059
|
+
this.bump();
|
|
1060
|
+
}
|
|
1061
|
+
// ── Tree helpers ─────────────────────────────────────────────────────────
|
|
1062
|
+
/** Normalise a folder path: null/""/"/" → root ([]); else split on "/" dropping empties. */
|
|
1063
|
+
splitFolder(path) {
|
|
1064
|
+
if (path == null)
|
|
1065
|
+
return [];
|
|
1066
|
+
const s = String(path).trim();
|
|
1067
|
+
if (s === '' || s === '/')
|
|
1068
|
+
return [];
|
|
1069
|
+
return s.split('/').map(x => x.trim()).filter(Boolean);
|
|
1070
|
+
}
|
|
1071
|
+
makeContainerNode(href, label, count) {
|
|
1072
|
+
return {
|
|
1073
|
+
id: 'c:' + href, kind: 'container', label, href,
|
|
1074
|
+
hasDocs: false, docCount: 0, totalCount: count, children: [],
|
|
1075
|
+
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
makeFolderNode(id, label) {
|
|
1079
|
+
return {
|
|
1080
|
+
id, kind: 'folder', label,
|
|
1081
|
+
hasDocs: false, docCount: 0, totalCount: 0, children: [],
|
|
1082
|
+
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
computeTotals(node) {
|
|
1086
|
+
let total = node.docCount;
|
|
1087
|
+
for (const c of node.children)
|
|
1088
|
+
total += this.computeTotals(c);
|
|
1089
|
+
node.totalCount = total;
|
|
1090
|
+
return total;
|
|
1091
|
+
}
|
|
1092
|
+
/** Force a re-render after mutating nodes in place. */
|
|
1093
|
+
bump() {
|
|
1094
|
+
this.containers = [...this.containers];
|
|
1095
|
+
}
|
|
1096
|
+
// ── Interaction ──────────────────────────────────────────────────────────
|
|
1097
|
+
toggleContainer(node) {
|
|
1098
|
+
node.open = !node.open;
|
|
1099
|
+
if (node.open && !node.foldersLoaded && !node.loading) {
|
|
1100
|
+
this.emitFolderDistinct(node);
|
|
1101
|
+
}
|
|
1102
|
+
this.bump();
|
|
1103
|
+
}
|
|
1104
|
+
toggleFolder(container, node) {
|
|
1105
|
+
node.open = !node.open;
|
|
1106
|
+
if (node.open && node.hasDocs && !node.docsLoaded && !node.loading) {
|
|
1107
|
+
this.emitDocuments(container, node);
|
|
1108
|
+
}
|
|
1109
|
+
this.bump();
|
|
1110
|
+
}
|
|
1111
|
+
openDoc(doc) {
|
|
1112
|
+
var _a, _b, _c, _d;
|
|
1113
|
+
const href = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href;
|
|
1114
|
+
const label = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc[this.titleField]) !== null && _c !== void 0 ? _c : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _d !== void 0 ? _d : '';
|
|
1115
|
+
this.mrdNavigate.emit({ href, label });
|
|
1116
|
+
}
|
|
1117
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
1118
|
+
renderChevron(open, leaf) {
|
|
1119
|
+
return (h("span", { class: `mrd-document-list__chev${leaf ? ' mrd-document-list__chev--leaf' : ''}${open ? ' mrd-document-list__chev--open' : ''}` }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M9 6l6 6-6 6" }))));
|
|
1120
|
+
}
|
|
1121
|
+
renderDossierIcon() {
|
|
1122
|
+
return (h("svg", { class: "mrd-document-list__icon mrd-document-list__icon--dossier", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" })));
|
|
1123
|
+
}
|
|
1124
|
+
renderFolderIcon() {
|
|
1125
|
+
return (h("svg", { class: "mrd-document-list__icon mrd-document-list__icon--folder", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" })));
|
|
1126
|
+
}
|
|
1127
|
+
renderDocIcon() {
|
|
1128
|
+
return (h("svg", { class: "mrd-document-list__icon mrd-document-list__icon--doc", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("path", { d: "M14 2v6h6" })));
|
|
1129
|
+
}
|
|
1130
|
+
indent(depth) {
|
|
1131
|
+
return h("span", { class: "mrd-document-list__indent", style: { width: `${depth * 18}px` } });
|
|
1132
|
+
}
|
|
1133
|
+
renderDocRow(doc, depth) {
|
|
1134
|
+
var _a, _b, _c, _d, _e;
|
|
1135
|
+
const label = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc[this.titleField]) !== null && _a !== void 0 ? _a : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _b !== void 0 ? _b : '';
|
|
1136
|
+
const dateRaw = this.dateField ? doc === null || doc === void 0 ? void 0 : doc[this.dateField] : undefined;
|
|
1137
|
+
const date = dateRaw ? formatDate(dateRaw, this.locale) : '';
|
|
1138
|
+
return (h("div", { class: "mrd-document-list__row mrd-document-list__row--doc", key: (_e = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : label, onClick: () => this.openDoc(doc) }, this.indent(depth), this.renderChevron(false, true), this.renderDocIcon(), h("span", { class: "mrd-document-list__label" }, label), date && h("span", { class: "mrd-document-list__date" }, date)));
|
|
1139
|
+
}
|
|
1140
|
+
renderLoadingRow(depth) {
|
|
1141
|
+
return (h("div", { class: "mrd-document-list__loading", key: "loading" }, this.indent(depth), h("span", { class: "mrd-document-list__spinner" }), t('loading', this.locale)));
|
|
1142
|
+
}
|
|
1143
|
+
renderChildren(container, node, depth) {
|
|
1144
|
+
const out = [];
|
|
1145
|
+
// Direct documents of this node (root docs live on the container node).
|
|
1146
|
+
if (node.hasDocs) {
|
|
1147
|
+
if (node.docsLoaded) {
|
|
1148
|
+
for (const doc of node.docs)
|
|
1149
|
+
out.push(this.renderDocRow(doc, depth));
|
|
1150
|
+
}
|
|
1151
|
+
else if (node.loading) {
|
|
1152
|
+
out.push(this.renderLoadingRow(depth));
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
// Child folders.
|
|
1156
|
+
for (const child of node.children) {
|
|
1157
|
+
out.push(this.renderFolderNode(container, child, depth));
|
|
1158
|
+
}
|
|
1159
|
+
return out;
|
|
1160
|
+
}
|
|
1161
|
+
renderFolderNode(container, node, depth) {
|
|
1162
|
+
const leaf = node.children.length === 0 && !node.hasDocs;
|
|
1163
|
+
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row", onClick: () => this.toggleFolder(container, node) }, this.indent(depth), this.renderChevron(node.open, leaf), this.renderFolderIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && h("div", { class: "mrd-document-list__kids" }, this.renderChildren(container, node, depth + 1))));
|
|
1164
|
+
}
|
|
1165
|
+
renderContainerNode(node, depth) {
|
|
1166
|
+
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row mrd-document-list__row--dossier", onClick: () => this.toggleContainer(node) }, this.indent(depth), this.renderChevron(node.open, false), this.renderDossierIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && (h("div", { class: "mrd-document-list__kids" }, node.loading && !node.foldersLoaded
|
|
1167
|
+
? this.renderLoadingRow(depth + 1)
|
|
1168
|
+
: this.renderChildren(node, node, depth + 1)))));
|
|
1169
|
+
}
|
|
1170
|
+
render() {
|
|
1171
|
+
let body;
|
|
1172
|
+
if (this.rootLoading) {
|
|
1173
|
+
body = this.renderLoadingRow(0);
|
|
1174
|
+
}
|
|
1175
|
+
else if (this.containers.length === 0) {
|
|
1176
|
+
body = h("div", { key: '0c4190bb86543e2d37cc1584b3495eb6eab5664c', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
1177
|
+
}
|
|
1178
|
+
else if (this.singleContainer) {
|
|
1179
|
+
// Dossier context: render the single container's folder tree at the root.
|
|
1180
|
+
const only = this.containers[0];
|
|
1181
|
+
body = only.loading && !only.foldersLoaded
|
|
1182
|
+
? this.renderLoadingRow(0)
|
|
1183
|
+
: this.renderChildren(only, only, 0);
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
body = this.containers.map(c => this.renderContainerNode(c, 0));
|
|
1187
|
+
}
|
|
1188
|
+
return (h(Host, { key: '4e38d9ef5a1df137a41516a47dc5debbea6b2f35' }, h("div", { key: '6d2f162624e5bbc8650a2978a3b045c21fe13ea3', class: "mrd-document-list" }, body)));
|
|
1189
|
+
}
|
|
1190
|
+
get el() { return getElement(this); }
|
|
1191
|
+
};
|
|
1192
|
+
/** Root sentinel id for the container-level distinct request. */
|
|
1193
|
+
MrdDocumentList.ROOT = '__root__';
|
|
1194
|
+
MrdDocumentList.style = mrdDocumentListScss();
|
|
1195
|
+
|
|
1196
|
+
const mrdDocumentViewScss = () => `.sc-mrd-document-view-h{display:block}.mrd-document-view.sc-mrd-document-view{max-width:720px}.mrd-document-view__crumb.sc-mrd-document-view{display:inline-flex;align-items:center;gap:var(--mrd-space-2);margin-bottom:var(--mrd-space-4);padding:var(--mrd-space-1) var(--mrd-space-3);background:var(--mrd-color-primary-light);border:1px solid transparent;border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary-dark);cursor:pointer}.mrd-document-view__crumb.sc-mrd-document-view:hover{border-color:var(--mrd-color-primary)}.mrd-document-view__crumb-icon.sc-mrd-document-view{width:0.875rem;height:0.875rem;flex-shrink:0}.mrd-document-view__title.sc-mrd-document-view{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);letter-spacing:-0.02em;margin:0 0 var(--mrd-space-1) 0}.mrd-document-view__date.sc-mrd-document-view{font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-400);font-variant-numeric:tabular-nums;margin:0 0 var(--mrd-space-6) 0}.mrd-document-view__file.sc-mrd-document-view{display:flex;align-items:center;gap:var(--mrd-space-4);padding:var(--mrd-space-4);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);background:var(--mrd-color-neutral-50);margin-bottom:var(--mrd-space-6)}.mrd-document-view__file-preview.sc-mrd-document-view{width:2.875rem;height:3.625rem;flex-shrink:0;display:grid;place-items:center;border-radius:var(--mrd-border-radius-sm);background:var(--mrd-color-white);border:1px solid var(--mrd-border-color);color:var(--mrd-color-danger);box-shadow:var(--mrd-shadow-sm)}.mrd-document-view__file-preview.sc-mrd-document-view svg.sc-mrd-document-view{width:1.5rem;height:1.5rem}.mrd-document-view__file-meta.sc-mrd-document-view{flex:1;min-width:0}.mrd-document-view__file-name.sc-mrd-document-view{font-weight:var(--mrd-font-weight-semibold);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800);word-break:break-word}.mrd-document-view__download.sc-mrd-document-view{display:inline-flex;align-items:center;gap:var(--mrd-space-2);flex-shrink:0;height:2rem;padding:0 var(--mrd-space-3);background:var(--mrd-color-white);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);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-700);cursor:pointer}.mrd-document-view__download.sc-mrd-document-view:hover{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-900)}.mrd-document-view__download.sc-mrd-document-view svg.sc-mrd-document-view{width:0.9375rem;height:0.9375rem}.mrd-document-view__summary-body.sc-mrd-document-view{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed)}`;
|
|
1197
|
+
|
|
1198
|
+
const MrdDocumentView = class {
|
|
1199
|
+
constructor(hostRef) {
|
|
1200
|
+
registerInstance(this, hostRef);
|
|
1201
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
1202
|
+
this.mrdDownload = createEvent(this, "mrdDownload");
|
|
1203
|
+
/** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
|
|
1204
|
+
this.data = {};
|
|
1205
|
+
this.locale = navigator.language;
|
|
1206
|
+
}
|
|
1207
|
+
/** Value of a value-slot: reads data[field] via the slot→field map. */
|
|
1208
|
+
slotValue(slot) {
|
|
1209
|
+
var _a, _b;
|
|
1210
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
1211
|
+
if (!field)
|
|
1212
|
+
return undefined;
|
|
1213
|
+
return this.data[field];
|
|
1214
|
+
}
|
|
1215
|
+
/** Relation link for a relation-slot: reads data._links[field]. */
|
|
1216
|
+
slotLink(slot) {
|
|
1217
|
+
var _a, _b, _c, _d;
|
|
1218
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
1219
|
+
if (!field)
|
|
1220
|
+
return undefined;
|
|
1221
|
+
const links = ((_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links) !== null && _d !== void 0 ? _d : {});
|
|
1222
|
+
return links[field];
|
|
1223
|
+
}
|
|
1224
|
+
renderContainer() {
|
|
1225
|
+
const link = this.slotLink('container');
|
|
1226
|
+
if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
|
|
1227
|
+
return null;
|
|
1228
|
+
return (h("button", { class: "mrd-document-view__crumb", onClick: () => this.mrdNavigate.emit({ href: link.href, label: link.name }) }, h("svg", { class: "mrd-document-view__crumb-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M19 12H5M12 19l-7-7 7-7" })), link.name));
|
|
1229
|
+
}
|
|
1230
|
+
renderFile() {
|
|
1231
|
+
var _a, _b;
|
|
1232
|
+
const raw = this.slotValue('file');
|
|
1233
|
+
if (!raw)
|
|
1234
|
+
return null;
|
|
1235
|
+
const href = (_a = raw === null || raw === void 0 ? void 0 : raw.href) !== null && _a !== void 0 ? _a : '';
|
|
1236
|
+
const fileName = (_b = raw === null || raw === void 0 ? void 0 : raw.fileName) !== null && _b !== void 0 ? _b : String(raw);
|
|
1237
|
+
return (h("div", { class: "mrd-document-view__file" }, h("div", { class: "mrd-document-view__file-preview", "aria-hidden": "true" }, h("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, h("path", { d: "M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6H6zm7 1.5L18.5 9H13V3.5z" }))), h("div", { class: "mrd-document-view__file-meta" }, h("span", { class: "mrd-document-view__file-name" }, fileName)), href && (h("button", { class: "mrd-document-view__download", onClick: () => this.mrdDownload.emit({ href, fileName }) }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M12 3v12m0 0l-4-4m4 4l4-4M4 21h16" })), t('download', this.locale)))));
|
|
1238
|
+
}
|
|
1239
|
+
render() {
|
|
1240
|
+
const titleRaw = this.slotValue('title');
|
|
1241
|
+
const title = titleRaw != null && titleRaw !== '' ? String(titleRaw) : null;
|
|
1242
|
+
const dateRaw = this.slotValue('date');
|
|
1243
|
+
const date = dateRaw != null && dateRaw !== '' ? formatDate(dateRaw, this.locale) : null;
|
|
1244
|
+
const summaryRaw = this.slotValue('summary');
|
|
1245
|
+
const summary = summaryRaw != null && summaryRaw !== '' ? String(summaryRaw) : null;
|
|
1246
|
+
return (h(Host, { key: 'b6c2dbc45d5cfe551ac16b43b1a152a0d793b794' }, h("div", { key: 'df70848b4aa54ea414ea5d577a600779ee002b13', class: "mrd-document-view" }, this.renderContainer(), title && h("h1", { key: '46ff550fccd6de02972c6ee77b3cd5e7e394481a', class: "mrd-document-view__title" }, title), date && h("p", { key: '501c75cfc78722bd486d4a1db366675a1c519264', class: "mrd-document-view__date" }, date), this.renderFile(), summary && (h("div", { key: 'ee4475d06e5ca81a760e0c9e1e4b5f32ed894d89', class: "mrd-document-view__summary" }, h("div", { key: '9d196abdcc56b84b2b07203d7e5167be196a342a', class: "mrd-document-view__summary-body", innerHTML: summary }))))));
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
MrdDocumentView.style = mrdDocumentViewScss();
|
|
1250
|
+
|
|
831
1251
|
const mrdEmailFieldScss = () => `.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)}`;
|
|
832
1252
|
|
|
833
1253
|
const MrdEmailField = class {
|
|
@@ -863,7 +1283,7 @@ const MrdEmailField = class {
|
|
|
863
1283
|
}
|
|
864
1284
|
render() {
|
|
865
1285
|
const hasError = !!this.error;
|
|
866
|
-
return (h(Host, { key: '
|
|
1286
|
+
return (h(Host, { key: 'bf888feadb6585a845f6d610165e192e342be5d2' }, h("div", { key: 'ab43101242a92df1643d218c0d35bb7b80452fef', class: "mrd-email-field" }, this.label && (h("label", { key: '854c9bd733f5803616ab8b70f0316a7a8a82ffd4', class: `mrd-email-field__label${this.required ? ' mrd-email-field__label--required' : ''}` }, this.label)), h("input", { key: '39ed16119a2329fdc67db578dcc7bafc35f4acf0', class: `mrd-email-field__input${hasError ? ' 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 }), hasError && h("span", { key: 'c5881e21a2314e5d339464b16982add69be9f68a', class: "mrd-email-field__error" }, this.error))));
|
|
867
1287
|
}
|
|
868
1288
|
};
|
|
869
1289
|
MrdEmailField.style = mrdEmailFieldScss();
|
|
@@ -1146,7 +1566,7 @@ const MrdFileField = class {
|
|
|
1146
1566
|
hasError ? 'mrd-file-field__zone--error' : '',
|
|
1147
1567
|
this.disabled || this.uploading ? 'mrd-file-field__zone--disabled' : '',
|
|
1148
1568
|
].filter(Boolean).join(' ');
|
|
1149
|
-
return (h(Host, { key: '
|
|
1569
|
+
return (h(Host, { key: '424a55ff5c141a51ed2e253a126e0046808cf1b1' }, h("div", { key: '49407e31c019a27bbaa3ccbc81cd4597d992d03a', class: "mrd-file-field" }, this.label && (h("label", { key: '0477b203f2b8df03cf9d11153bc547e9490800f7', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), h("div", { key: 'aff3e5f258cfa8320150048af0b0087081cbbc13', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: 'ee4366f0c4b8871524288ca47c98b4749def0b81', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !hasFile, onChange: this.handleInputChange }), hasFile ? (h("div", { class: "mrd-file-field__selected" }, this.uploading ? (h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))), h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (h("div", { class: "mrd-file-field__prompt" }, h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "16 16 12 12 8 16" }), h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'b67b7770e194843a1b75caaff807ea14d62eba6a', class: "mrd-file-field__error" }, this.error))));
|
|
1150
1570
|
}
|
|
1151
1571
|
static get watchers() { return {
|
|
1152
1572
|
"value": [{
|
|
@@ -1707,7 +2127,7 @@ const MrdImageField = class {
|
|
|
1707
2127
|
hasError ? 'mrd-image-field__zone--error' : '',
|
|
1708
2128
|
this.disabled || this.uploading ? 'mrd-image-field__zone--disabled' : '',
|
|
1709
2129
|
].filter(Boolean).join(' ');
|
|
1710
|
-
return (h(Host, { key: '
|
|
2130
|
+
return (h(Host, { key: '105ebf20023291a1e5c8524eedba4f04573943cd' }, h("div", { key: '59e6fe3b81c2ec1c07db7aaba819d79d2525b21f', class: "mrd-image-field" }, this.label && (h("label", { key: '2f3815ad6fe3f35932a8cc4d625751935272b629', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), h("div", { key: '8b45fbf8d0a229110a53068620a316ab6d48dbb8', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: 'b6039e85f3f456e7c8d8e7d4db29e111a7f6d8d9', ref: el => (this.fileInputRef = el), class: "mrd-image-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !this.previewUrl, onChange: this.handleInputChange }), this.previewUrl ? (h("div", { class: "mrd-image-field__preview-container" }, h("div", { class: "mrd-image-field__preview-thumb" }, h("img", { class: "mrd-image-field__preview", src: this.previewUrl, alt: this.fileName }), this.uploading && h("div", { class: "mrd-image-field__preview-overlay" }, h("span", { class: "mrd-image-field__spinner" }))), h("div", { class: "mrd-image-field__preview-info" }, h("span", { class: "mrd-image-field__preview-name" }, this.fileName), this.uploading && (h("span", { class: "mrd-image-field__upload-status" }, t('loading', this.locale)))), !this.uploading && (h("button", { class: "mrd-image-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, t('remove', this.locale))))) : (h("div", { class: "mrd-image-field__prompt" }, h("svg", { class: "mrd-image-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), h("circle", { cx: "8.5", cy: "8.5", r: "1.5" }), h("polyline", { points: "21 15 16 10 5 21" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-image-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'f53ade0f627f3c840bc133690d40034c12665b5c', class: "mrd-image-field__error" }, this.error))));
|
|
1711
2131
|
}
|
|
1712
2132
|
static get watchers() { return {
|
|
1713
2133
|
"value": [{
|
|
@@ -1821,7 +2241,7 @@ class CellRenderer {
|
|
|
1821
2241
|
}
|
|
1822
2242
|
}
|
|
1823
2243
|
|
|
1824
|
-
const mrdLayoutSectionScss = () => `.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;display:inline-flex;align-items:center;gap:var(--mrd-space-1)}.mrd-layout-section__history-wrap.sc-mrd-layout-section{position:relative;display:inline-flex;align-items:center}.mrd-layout-section__history-btn.sc-mrd-layout-section{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;flex-shrink:0;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-layout-section__history-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-700);background-color:var(--mrd-color-neutral-100)}.mrd-layout-section__history-btn.sc-mrd-layout-section:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__history-icon.sc-mrd-layout-section{width:0.875rem;height:0.875rem}.mrd-layout-section__history-popover.sc-mrd-layout-section{position:absolute;top:calc(100% + 0.25rem);left:0;min-width:24rem;max-width:24rem;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);box-shadow:var(--mrd-shadow-md);padding:var(--mrd-space-1) 0;z-index:var(--mrd-z-dropdown)}.mrd-layout-section__history-entry.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-700);padding:var(--mrd-space-2) var(--mrd-space-3);line-height:var(--mrd-line-height-normal)}.mrd-layout-section__history-entry.sc-mrd-layout-section:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.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{display:inline-flex;align-items:center;gap:var(--mrd-space-1);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-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.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__secret-masked.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-label-color);letter-spacing:0.15em;user-select:none;pointer-events:none}.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;max-height:calc(10 * 1.5 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y: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-wrap.sc-mrd-layout-section{position:relative}.mrd-layout-section__search-icon.sc-mrd-layout-section{position:absolute;left:var(--mrd-input-padding-x);top:50%;transform:translateY(-50%);width:1rem;height:1rem;color:var(--mrd-color-neutral-400);pointer-events:none}.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) var(--mrd-input-padding-y) calc(var(--mrd-input-padding-x) + 1rem + var(--mrd-space-2));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}`;
|
|
2244
|
+
const mrdLayoutSectionScss = () => `.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;display:inline-flex;align-items:center;gap:var(--mrd-space-1)}.mrd-layout-section__history-wrap.sc-mrd-layout-section{position:relative;display:inline-flex;align-items:center}.mrd-layout-section__history-btn.sc-mrd-layout-section{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;flex-shrink:0;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-layout-section__history-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-700);background-color:var(--mrd-color-neutral-100)}.mrd-layout-section__history-btn.sc-mrd-layout-section:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__history-icon.sc-mrd-layout-section{width:0.875rem;height:0.875rem}.mrd-layout-section__history-popover.sc-mrd-layout-section{position:absolute;top:calc(100% + 0.25rem);left:0;min-width:24rem;max-width:24rem;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);box-shadow:var(--mrd-shadow-md);padding:var(--mrd-space-1) 0;z-index:var(--mrd-z-dropdown)}.mrd-layout-section__history-entry.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-700);padding:var(--mrd-space-2) var(--mrd-space-3);line-height:var(--mrd-line-height-normal)}.mrd-layout-section__history-entry.sc-mrd-layout-section:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.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{display:inline-flex;align-items:center;gap:var(--mrd-space-1);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-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.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__secret-masked.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-label-color);letter-spacing:0.15em;user-select:none;pointer-events:none}.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;max-height:calc(10 * 1.5 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y: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-xs);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;letter-spacing:0.01em}.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__doc-toolbar.sc-mrd-layout-section{display:flex;align-items:center;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) 0}.mrd-layout-section__seg.sc-mrd-layout-section{display:inline-flex;gap:2px;padding:2px;background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius)}.mrd-layout-section__seg-btn.sc-mrd-layout-section{width:1.875rem;height:1.625rem;display:grid;place-items:center;border:none;background:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-500);cursor:pointer;transition:color var(--mrd-transition-fast), background var(--mrd-transition-fast)}.mrd-layout-section__seg-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-800)}.mrd-layout-section__seg-btn[aria-pressed='true'].sc-mrd-layout-section{background:var(--mrd-color-white);color:var(--mrd-color-primary-dark);box-shadow:var(--mrd-shadow-sm)}.mrd-layout-section__seg-btn.sc-mrd-layout-section svg.sc-mrd-layout-section{width:1rem;height:1rem}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-wrap.sc-mrd-layout-section{position:relative}.mrd-layout-section__search-icon.sc-mrd-layout-section{position:absolute;left:var(--mrd-input-padding-x);top:50%;transform:translateY(-50%);width:1rem;height:1rem;color:var(--mrd-color-neutral-400);pointer-events:none}.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) var(--mrd-input-padding-y) calc(var(--mrd-input-padding-x) + 1rem + var(--mrd-space-2));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}`;
|
|
1825
2245
|
|
|
1826
2246
|
const MrdLayoutSection = class {
|
|
1827
2247
|
constructor(hostRef) {
|
|
@@ -1833,6 +2253,7 @@ const MrdLayoutSection = class {
|
|
|
1833
2253
|
this.mrdLoadImage = createEvent(this, "mrdLoadImage");
|
|
1834
2254
|
this.mrdViewAction = createEvent(this, "mrdViewAction");
|
|
1835
2255
|
this.mrdLoadViewAggregations = createEvent(this, "mrdLoadViewAggregations");
|
|
2256
|
+
this.mrdLoadViewDistinct = createEvent(this, "mrdLoadViewDistinct");
|
|
1836
2257
|
/** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
|
|
1837
2258
|
this.items = [];
|
|
1838
2259
|
/** Record data object; keys are field names, _links holds relation and related-view links. */
|
|
@@ -1842,11 +2263,16 @@ const MrdLayoutSection = class {
|
|
|
1842
2263
|
/** Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format. */
|
|
1843
2264
|
this.links = {};
|
|
1844
2265
|
this.locale = navigator.language;
|
|
2266
|
+
/** Top-level archetypes on the object dashboard. When it contains commons.document,
|
|
2267
|
+
* the record is rendered as a single-document view instead of generic fields. */
|
|
2268
|
+
this.archetypes = [];
|
|
1845
2269
|
this.searchQueryMap = {};
|
|
1846
2270
|
this.searchResultsMap = {};
|
|
1847
2271
|
this.imagePreviewUrl = null;
|
|
1848
2272
|
this.imagePreviews = {};
|
|
1849
2273
|
this.openHistoryField = null;
|
|
2274
|
+
/** Per-view display mode for document collection views. Default 'tree'. */
|
|
2275
|
+
this.docViewMode = {};
|
|
1850
2276
|
this.historyClickOutside = null;
|
|
1851
2277
|
this.searchTimers = {};
|
|
1852
2278
|
this.handleViewLoadPage = (e, name) => {
|
|
@@ -1930,11 +2356,18 @@ const MrdLayoutSection = class {
|
|
|
1930
2356
|
}
|
|
1931
2357
|
}
|
|
1932
2358
|
/**
|
|
1933
|
-
* Inject
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
2359
|
+
* Inject rows for a VIEW / RELATED_VIEW item.
|
|
2360
|
+
* - Table view: injects the page into the embedded mrd-table (pass totalElements/hasNext).
|
|
2361
|
+
* - Document view: pass `nodeId` to route the rows to that folder node in the embedded
|
|
2362
|
+
* mrd-document-list. Folder loading is just a filtered list load, so it reuses this method.
|
|
1936
2363
|
*/
|
|
1937
|
-
async setViewPage(name, page, rows, totalElements, hasNext) {
|
|
2364
|
+
async setViewPage(name, page, rows, totalElements, hasNext, nodeId) {
|
|
2365
|
+
if (nodeId) {
|
|
2366
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2367
|
+
if (list === null || list === void 0 ? void 0 : list.setDocuments)
|
|
2368
|
+
await list.setDocuments(nodeId, rows);
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
1938
2371
|
const table = this.el.querySelector(`mrd-table[data-view="${name}"]`);
|
|
1939
2372
|
if (!table)
|
|
1940
2373
|
return;
|
|
@@ -1950,6 +2383,12 @@ const MrdLayoutSection = class {
|
|
|
1950
2383
|
return;
|
|
1951
2384
|
await table.setAggregations(data);
|
|
1952
2385
|
}
|
|
2386
|
+
/** Inject distinct values into an embedded mrd-document-list for a document view. */
|
|
2387
|
+
async setViewDistinct(name, nodeId, values) {
|
|
2388
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2389
|
+
if (list === null || list === void 0 ? void 0 : list.setDistinct)
|
|
2390
|
+
await list.setDistinct(nodeId, values);
|
|
2391
|
+
}
|
|
1953
2392
|
/** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
|
|
1954
2393
|
async setImagePreview(fieldName, url) {
|
|
1955
2394
|
this.imagePreviews = Object.assign(Object.assign({}, this.imagePreviews), { [fieldName]: url });
|
|
@@ -2098,7 +2537,7 @@ const MrdLayoutSection = class {
|
|
|
2098
2537
|
return (h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, h("div", { class: "mrd-layout-section__search-wrap" }, h("svg", { class: "mrd-layout-section__search-icon", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", "clip-rule": "evenodd" })), h("input", { class: "mrd-layout-section__search-input", type: "text", value: query, placeholder: (_c = item.label) !== null && _c !== void 0 ? _c : '', onInput: e => this.handleSearchInput(dataClass, e.target.value) })), results.length > 0 && (h("ul", { class: "mrd-layout-section__search-results" }, results.map(r => (h("li", { key: r.id, class: "mrd-layout-section__search-result" }, h("button", { class: "mrd-layout-section__search-result-btn", onClick: () => this.mrdNavigate.emit({ href: r.id, label: r.label }) }, h("span", { class: "mrd-layout-section__search-result-label" }, r.label), r.description && h("span", { class: "mrd-layout-section__search-result-desc" }, r.description)))))))));
|
|
2099
2538
|
}
|
|
2100
2539
|
renderRelatedView(item) {
|
|
2101
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2540
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2102
2541
|
const key = this.viewKeyFor(item);
|
|
2103
2542
|
if (!key)
|
|
2104
2543
|
return null;
|
|
@@ -2108,7 +2547,32 @@ const MrdLayoutSection = class {
|
|
|
2108
2547
|
// Extract parentId from data._links.self.href for RELATED_VIEW path construction
|
|
2109
2548
|
const selfHref = (_e = (_d = (_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '';
|
|
2110
2549
|
const parentId = (_f = selfHref.split('/').filter(Boolean).pop()) !== null && _f !== void 0 ? _f : '';
|
|
2111
|
-
|
|
2550
|
+
// The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
|
|
2551
|
+
// (sibling of `view`), not inside `view`.
|
|
2552
|
+
const docArchetype = resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, ARCHETYPE_DOCUMENT);
|
|
2553
|
+
const mode = (_j = this.docViewMode[key]) !== null && _j !== void 0 ? _j : 'tree';
|
|
2554
|
+
return (h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), docArchetype && this.renderDocToolbar(key, mode), docArchetype && mode === 'tree'
|
|
2555
|
+
? this.renderDocumentList(item, key, parentId, docArchetype)
|
|
2556
|
+
: this.renderTable(item, key, parentId)));
|
|
2557
|
+
}
|
|
2558
|
+
/** Tree / list segmented toggle for document collection views (+ upload placeholder). */
|
|
2559
|
+
renderDocToolbar(key, mode) {
|
|
2560
|
+
return (h("div", { class: "mrd-layout-section__doc-toolbar" }, h("div", { class: "mrd-layout-section__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-layout-section__seg-btn", "aria-pressed": String(mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => { this.docViewMode = Object.assign(Object.assign({}, this.docViewMode), { [key]: 'tree' }); } }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-layout-section__seg-btn", "aria-pressed": String(mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => { this.docViewMode = Object.assign(Object.assign({}, this.docViewMode), { [key]: 'list' }); } }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
2561
|
+
}
|
|
2562
|
+
renderDocumentList(item, key, parentId, archetype) {
|
|
2563
|
+
return (h("mrd-document-list", { "data-doclist": key, item: item, archetype: archetype, parentId: parentId, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
2564
|
+
e.stopPropagation();
|
|
2565
|
+
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
2566
|
+
}, onMrdLoadPage: (e) => {
|
|
2567
|
+
e.stopPropagation();
|
|
2568
|
+
this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
|
|
2569
|
+
}, onMrdNavigate: (e) => {
|
|
2570
|
+
e.stopPropagation();
|
|
2571
|
+
this.mrdNavigate.emit(e.detail);
|
|
2572
|
+
} }));
|
|
2573
|
+
}
|
|
2574
|
+
renderTable(item, key, parentId) {
|
|
2575
|
+
return (h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
|
|
2112
2576
|
var _a;
|
|
2113
2577
|
e.stopPropagation();
|
|
2114
2578
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
@@ -2129,7 +2593,7 @@ const MrdLayoutSection = class {
|
|
|
2129
2593
|
parentPath: e.detail.parentPath,
|
|
2130
2594
|
basicType: e.detail.basicType,
|
|
2131
2595
|
});
|
|
2132
|
-
} }))
|
|
2596
|
+
} }));
|
|
2133
2597
|
}
|
|
2134
2598
|
renderItem(item) {
|
|
2135
2599
|
var _a, _b;
|
|
@@ -2161,8 +2625,23 @@ const MrdLayoutSection = class {
|
|
|
2161
2625
|
return null;
|
|
2162
2626
|
return (h("div", { class: "mrd-layout-section__modal-backdrop", onClick: () => { this.imagePreviewUrl = null; } }, h("div", { class: "mrd-layout-section__modal", onClick: (e) => e.stopPropagation() }, h("button", { class: "mrd-layout-section__modal-close", onClick: () => { this.imagePreviewUrl = null; } }, "\u2715"), h("img", { class: "mrd-layout-section__modal-image", src: this.imagePreviewUrl, alt: "" }))));
|
|
2163
2627
|
}
|
|
2628
|
+
/** Single-document view: the record's own type carries commons.document. Renders
|
|
2629
|
+
* a recognisable document instead of generic fields, keeping any related views/
|
|
2630
|
+
* searches below it. */
|
|
2631
|
+
renderDocumentObject(archetype) {
|
|
2632
|
+
const related = this.items.filter(it => it.type === ClientLayoutItemType.VIEW ||
|
|
2633
|
+
it.type === ClientLayoutItemType.RELATED_VIEW ||
|
|
2634
|
+
it.type === ClientLayoutItemType.SEARCH);
|
|
2635
|
+
return [
|
|
2636
|
+
h("mrd-document-view", { archetype: archetype, data: this.data, locale: this.locale, onMrdNavigate: (e) => { e.stopPropagation(); this.mrdNavigate.emit(e.detail); }, onMrdDownload: (e) => { e.stopPropagation(); this.mrdDownload.emit(e.detail); } }),
|
|
2637
|
+
...related.map(it => this.renderItem(it)),
|
|
2638
|
+
];
|
|
2639
|
+
}
|
|
2164
2640
|
render() {
|
|
2165
|
-
|
|
2641
|
+
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
2642
|
+
return (h(Host, { key: '4fbba410f9b8cab2bf21497467f99ff25f109bcc' }, h("div", { key: '679d2c34f1eaff694873ba18d679cbccecdae1a6', class: "mrd-layout-section" }, docArchetype
|
|
2643
|
+
? this.renderDocumentObject(docArchetype)
|
|
2644
|
+
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
2166
2645
|
}
|
|
2167
2646
|
get el() { return getElement(this); }
|
|
2168
2647
|
static get watchers() { return {
|
|
@@ -2302,7 +2781,7 @@ const MrdLongtextField = class {
|
|
|
2302
2781
|
}
|
|
2303
2782
|
render() {
|
|
2304
2783
|
const hasError = !!this.error;
|
|
2305
|
-
return (h(Host, { key: '
|
|
2784
|
+
return (h(Host, { key: '624be9369a37f0901ada13bd0e8a3bb8b40f54c8' }, h("div", { key: '6544e7b10af59a5628a119d5ea907fb968f21d42', class: "mrd-longtext-field" }, this.label && (h("label", { key: 'd56386e3fc2984b522bcbf5ec6908e044ed6f3d3', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: `mrd-longtext-field__input${hasError ? ' mrd-longtext-field__input--error' : ''}`, name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), hasError && h("span", { key: '9423d70dec9c6439cc629746f1038a61a14da5e4', class: "mrd-longtext-field__error" }, this.error))));
|
|
2306
2785
|
}
|
|
2307
2786
|
};
|
|
2308
2787
|
MrdLongtextField.style = mrdLongtextFieldScss();
|
|
@@ -2378,7 +2857,7 @@ const MrdNumberField = class {
|
|
|
2378
2857
|
const hasError = !!this.error;
|
|
2379
2858
|
const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
|
|
2380
2859
|
this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
|
|
2381
|
-
return (h(Host, { key: '
|
|
2860
|
+
return (h(Host, { key: '2c844e94a7cbb3fcf33f9552329443260e9490ab' }, h("div", { key: 'b87bdc2a17552e74b27d6da16e4db9bfd2f7e4ac', class: "mrd-number-field" }, this.label && (h("label", { key: '4aca381054b0ce27c94a9a7c779642d44dbbebcc', class: `mrd-number-field__label${this.required ? ' mrd-number-field__label--required' : ''}` }, this.label)), h("div", { key: 'b7e8d122bfbd92152ce44a7ba56222425eed73f9', class: "mrd-number-field__input-wrapper" }, h("input", { key: '906330075f0b8a50ff45344e865217fd1938f199', class: `mrd-number-field__input${hasError ? ' mrd-number-field__input--error' : ''}`, type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), hasError && h("span", { key: '5f56d6f2e0a878703f35d50b1932a39a82dace3b', class: "mrd-number-field__error" }, this.error))));
|
|
2382
2861
|
}
|
|
2383
2862
|
};
|
|
2384
2863
|
MrdNumberField.style = mrdNumberFieldScss();
|
|
@@ -2672,9 +3151,9 @@ const MrdSecretField = class {
|
|
|
2672
3151
|
}
|
|
2673
3152
|
render() {
|
|
2674
3153
|
const hasError = !!this.error;
|
|
2675
|
-
return (h(Host, { key: '
|
|
3154
|
+
return (h(Host, { key: 'e0d516f7e76c1fab5441567cc371569a8eab07f8' }, h("div", { key: 'fac6fb517a0f37560429c828251f7db3841d3301', class: "mrd-secret-field" }, this.label && (h("label", { key: 'b2dd3189f2fcf3fd3feea741a39dbd5c3f4d437f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
|
|
2676
3155
|
? (h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
|
|
2677
|
-
: (h("input", { class: `mrd-secret-field__input${hasError ? ' mrd-secret-field__input--error' : ''}`, type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), hasError && h("span", { key: '
|
|
3156
|
+
: (h("input", { class: `mrd-secret-field__input${hasError ? ' mrd-secret-field__input--error' : ''}`, type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), hasError && h("span", { key: 'dbd6667d7f2c6ed26220ac83a46235cf3ad777d7', class: "mrd-secret-field__error" }, this.error))));
|
|
2678
3157
|
}
|
|
2679
3158
|
};
|
|
2680
3159
|
MrdSecretField.style = mrdSecretFieldScss();
|
|
@@ -3821,7 +4300,7 @@ const MrdTextField = class {
|
|
|
3821
4300
|
}
|
|
3822
4301
|
render() {
|
|
3823
4302
|
const hasError = !!this.error;
|
|
3824
|
-
return (h(Host, { key: '
|
|
4303
|
+
return (h(Host, { key: '124c46a83d30993aed5045eda42134d5c28ec989' }, h("div", { key: '5497fab2938f875fe9b4cd539a9feaaf907007e1', class: "mrd-text-field" }, this.label && (h("label", { key: '4d43255f45de8e7c4596a211797403479d2240b6', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'df3d61fc60e41731e9783dc4484f3c3ca3ea8b13', class: `mrd-text-field__input${hasError ? ' 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 }), hasError && h("span", { key: '9bf08d3a77d7616674caf3325b6598490f2d50fc', class: "mrd-text-field__error" }, this.error))));
|
|
3825
4304
|
}
|
|
3826
4305
|
};
|
|
3827
4306
|
MrdTextField.style = mrdTextFieldScss();
|
|
@@ -3895,7 +4374,7 @@ const MrdTextareaField = class {
|
|
|
3895
4374
|
}
|
|
3896
4375
|
}
|
|
3897
4376
|
render() {
|
|
3898
|
-
return (h(Host, { key: '
|
|
4377
|
+
return (h(Host, { key: '2413906076dee3f48118d44574dadd36bcedadfe' }, h("div", { key: '59e369a54e906b09a1062c7c5f701b8bbd631479', class: "mrd-textarea-field" }, this.label && (h("label", { key: 'd400c499eb6e35581fc2af9d372917287fcc60eb', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: '62765821b5280e71918db0d070a136ef07e1eecd', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: 'f41b73291542d4582c492bce0a89240a171aba32', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: 'eaba5b735be7aa8deebfbc46eac03be970bb1d13', class: "mrd-textarea-field__error" }, this.error))));
|
|
3899
4378
|
}
|
|
3900
4379
|
get el() { return getElement(this); }
|
|
3901
4380
|
};
|
|
@@ -3932,9 +4411,9 @@ const MrdTimeField = class {
|
|
|
3932
4411
|
}
|
|
3933
4412
|
render() {
|
|
3934
4413
|
const hasError = !!this.error;
|
|
3935
|
-
return (h(Host, { key: '
|
|
4414
|
+
return (h(Host, { key: 'e93a6492a7bdc17f04f5aac0b8ecd63435a6280f' }, h("div", { key: 'b9692c11f21ccd354ba5475e1a60e6afc8ead22e', class: "mrd-time-field" }, this.label && (h("label", { key: '668492f16b6b96065fe65204a4f053c2ef2796e5', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), h("input", { key: 'bd2df39240c42b4a337554b0747c7b89eb5d8760', class: `mrd-time-field__input${hasError ? ' 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 }), hasError && h("span", { key: '19a81211f3b630436a379f785768d28ffa01c12c', class: "mrd-time-field__error" }, this.error))));
|
|
3936
4415
|
}
|
|
3937
4416
|
};
|
|
3938
4417
|
MrdTimeField.style = mrdTimeFieldScss();
|
|
3939
4418
|
|
|
3940
|
-
export { MrdBooleanField as mrd_boolean_field, MrdCurrencyField as mrd_currency_field, MrdDateField as mrd_date_field, MrdDatetimeField as mrd_datetime_field, MrdEmailField as mrd_email_field, MrdField as mrd_field, MrdFileField as mrd_file_field, MrdForm as mrd_form, MrdHyperlinkField as mrd_hyperlink_field, MrdImageField as mrd_image_field, MrdLayoutSection as mrd_layout_section, MrdListField as mrd_list_field, MrdLongtextField as mrd_longtext_field, MrdNumberField as mrd_number_field, MrdRelationField as mrd_relation_field, MrdSecretField as mrd_secret_field, MrdTable as mrd_table, MrdTextField as mrd_text_field, MrdTextareaField as mrd_textarea_field, MrdTimeField as mrd_time_field };
|
|
4419
|
+
export { MrdBooleanField as mrd_boolean_field, MrdCurrencyField as mrd_currency_field, MrdDateField as mrd_date_field, MrdDatetimeField as mrd_datetime_field, MrdDocumentList as mrd_document_list, MrdDocumentView as mrd_document_view, MrdEmailField as mrd_email_field, MrdField as mrd_field, MrdFileField as mrd_file_field, MrdForm as mrd_form, MrdHyperlinkField as mrd_hyperlink_field, MrdImageField as mrd_image_field, MrdLayoutSection as mrd_layout_section, MrdListField as mrd_list_field, MrdLongtextField as mrd_longtext_field, MrdNumberField as mrd_number_field, MrdRelationField as mrd_relation_field, MrdSecretField as mrd_secret_field, MrdTable as mrd_table, MrdTextField as mrd_text_field, MrdTextareaField as mrd_textarea_field, MrdTimeField as mrd_time_field };
|