@mmlogic/components 0.3.8 → 0.3.10
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_23.cjs.entry.js} +1059 -23
- package/dist/collection/collection-manifest.json +3 -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-container/mrd-document-container.js +375 -0
- package/dist/collection/components/mrd-document-container/mrd-document-container.scss +79 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.js +1129 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.scss +181 -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 +288 -14
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +2 -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 +66 -2
- package/dist/collection/types/client-layout.js +10 -0
- package/dist/collection/utils/i18n.js +34 -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-container.d.ts +11 -0
- package/dist/components/mrd-document-container.js +1 -0
- package/dist/components/mrd-document-container2.js +1 -0
- 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_23.entry.js} +1058 -25
- package/dist/mosterdcomponents/{cell-renderer-CbRwLOo8.js.map → cell-renderer-B-AJDBcj.js.map} +1 -1
- package/dist/mosterdcomponents/{client-layout-D88nn5zf.js.map → client-layout-ChqRA3AF.js.map} +1 -1
- package/dist/mosterdcomponents/i18n-s1XrKcD2.js.map +1 -0
- package/dist/mosterdcomponents/index-DkY-NQj0.js.map +1 -0
- package/dist/mosterdcomponents/index-DwF_Sp__.js.map +1 -0
- 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-69452249.entry.js +1 -0
- package/dist/mosterdcomponents/{validation-ixb43cqU.js.map → validation-Br9k2Ztw.js.map} +1 -1
- package/dist/types/components/mrd-document-container/mrd-document-container.d.ts +94 -0
- package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +210 -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 +57 -6
- package/dist/types/components.d.ts +507 -15
- package/dist/types/types/client-layout.d.ts +38 -0
- package/package.json +1 -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/p-7bfaee51.entry.js +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',
|
|
@@ -95,6 +98,11 @@ const translations = {
|
|
|
95
98
|
history_until: 'tot',
|
|
96
99
|
history_badge_tooltip: 'Vorige waarden',
|
|
97
100
|
hyperlink_name: 'Linktekst (optioneel)',
|
|
101
|
+
// mrd-document-list
|
|
102
|
+
new_folder: 'Nieuwe folder',
|
|
103
|
+
folder_name_placeholder: 'Foldernaam',
|
|
104
|
+
folder_no_slash: "Een foldernaam mag geen '/' bevatten",
|
|
105
|
+
folder_duplicate: 'Er bestaat al een folder met deze naam',
|
|
98
106
|
},
|
|
99
107
|
en: {
|
|
100
108
|
required: 'This field is required',
|
|
@@ -129,6 +137,9 @@ const translations = {
|
|
|
129
137
|
table_filter_clear_all: 'Clear all filters',
|
|
130
138
|
table_new_record: 'New record',
|
|
131
139
|
table_export_excel: 'Export to Excel',
|
|
140
|
+
doc_view_switch: 'Switch view',
|
|
141
|
+
doc_view_tree: 'Tree view',
|
|
142
|
+
doc_view_list: 'List view',
|
|
132
143
|
// mrd-table filter popup
|
|
133
144
|
filter_sorting: 'Sorting',
|
|
134
145
|
filter_ascending: 'Ascending',
|
|
@@ -158,6 +169,11 @@ const translations = {
|
|
|
158
169
|
history_until: 'until',
|
|
159
170
|
history_badge_tooltip: 'Previous values',
|
|
160
171
|
hyperlink_name: 'Link text (optional)',
|
|
172
|
+
// mrd-document-list
|
|
173
|
+
new_folder: 'New folder',
|
|
174
|
+
folder_name_placeholder: 'Folder name',
|
|
175
|
+
folder_no_slash: "A folder name cannot contain '/'",
|
|
176
|
+
folder_duplicate: 'A folder with this name already exists',
|
|
161
177
|
},
|
|
162
178
|
ar: {
|
|
163
179
|
required: 'هذا الحقل مطلوب',
|
|
@@ -192,6 +208,9 @@ const translations = {
|
|
|
192
208
|
table_filter_clear_all: 'مسح جميع الفلاتر',
|
|
193
209
|
table_new_record: 'سجل جديد',
|
|
194
210
|
table_export_excel: 'تصدير إلى Excel',
|
|
211
|
+
doc_view_switch: 'تبديل العرض',
|
|
212
|
+
doc_view_tree: 'عرض شجري',
|
|
213
|
+
doc_view_list: 'عرض القائمة',
|
|
195
214
|
// mrd-table filter popup
|
|
196
215
|
filter_sorting: 'الترتيب',
|
|
197
216
|
filter_ascending: 'تصاعدي',
|
|
@@ -255,6 +274,9 @@ const translations = {
|
|
|
255
274
|
table_filter_clear_all: 'Effacer tous les filtres',
|
|
256
275
|
table_new_record: 'Nouvel enregistrement',
|
|
257
276
|
table_export_excel: 'Exporter vers Excel',
|
|
277
|
+
doc_view_switch: 'Changer de vue',
|
|
278
|
+
doc_view_tree: 'Vue arborescente',
|
|
279
|
+
doc_view_list: 'Vue liste',
|
|
258
280
|
// mrd-table filter popup
|
|
259
281
|
filter_sorting: 'Tri',
|
|
260
282
|
filter_ascending: 'Croissant',
|
|
@@ -318,6 +340,9 @@ const translations = {
|
|
|
318
340
|
table_filter_clear_all: 'Alle Filter löschen',
|
|
319
341
|
table_new_record: 'Neuer Eintrag',
|
|
320
342
|
table_export_excel: 'Als Excel exportieren',
|
|
343
|
+
doc_view_switch: 'Ansicht wechseln',
|
|
344
|
+
doc_view_tree: 'Baumansicht',
|
|
345
|
+
doc_view_list: 'Listenansicht',
|
|
321
346
|
// mrd-table filter popup
|
|
322
347
|
filter_sorting: 'Sortierung',
|
|
323
348
|
filter_ascending: 'Aufsteigend',
|
|
@@ -381,6 +406,9 @@ const translations = {
|
|
|
381
406
|
table_filter_clear_all: 'Borrar todos los filtros',
|
|
382
407
|
table_new_record: 'Nuevo registro',
|
|
383
408
|
table_export_excel: 'Exportar a Excel',
|
|
409
|
+
doc_view_switch: 'Cambiar vista',
|
|
410
|
+
doc_view_tree: 'Vista de árbol',
|
|
411
|
+
doc_view_list: 'Vista de lista',
|
|
384
412
|
// mrd-table filter popup
|
|
385
413
|
filter_sorting: 'Ordenación',
|
|
386
414
|
filter_ascending: 'Ascendente',
|
|
@@ -444,6 +472,9 @@ const translations = {
|
|
|
444
472
|
table_filter_clear_all: 'Cancella tutti i filtri',
|
|
445
473
|
table_new_record: 'Nuovo record',
|
|
446
474
|
table_export_excel: 'Esporta in Excel',
|
|
475
|
+
doc_view_switch: 'Cambia vista',
|
|
476
|
+
doc_view_tree: 'Vista ad albero',
|
|
477
|
+
doc_view_list: 'Vista elenco',
|
|
447
478
|
// mrd-table filter popup
|
|
448
479
|
filter_sorting: 'Ordinamento',
|
|
449
480
|
filter_ascending: 'Crescente',
|
|
@@ -507,6 +538,9 @@ const translations = {
|
|
|
507
538
|
table_filter_clear_all: 'Очистити всі фільтри',
|
|
508
539
|
table_new_record: 'Новий запис',
|
|
509
540
|
table_export_excel: 'Експортувати до Excel',
|
|
541
|
+
doc_view_switch: 'Змінити вигляд',
|
|
542
|
+
doc_view_tree: 'Деревоподібний вигляд',
|
|
543
|
+
doc_view_list: 'Список',
|
|
510
544
|
// mrd-table filter popup
|
|
511
545
|
filter_sorting: 'Сортування',
|
|
512
546
|
filter_ascending: 'За зростанням',
|
|
@@ -719,7 +753,7 @@ const MrdCurrencyField = class {
|
|
|
719
753
|
}
|
|
720
754
|
render() {
|
|
721
755
|
const hasError = !!this.error;
|
|
722
|
-
return (h(Host, { key: '
|
|
756
|
+
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
757
|
}
|
|
724
758
|
};
|
|
725
759
|
MrdCurrencyField.style = mrdCurrencyFieldScss();
|
|
@@ -755,7 +789,7 @@ const MrdDateField = class {
|
|
|
755
789
|
}
|
|
756
790
|
render() {
|
|
757
791
|
const hasError = !!this.error;
|
|
758
|
-
return (h(Host, { key: '
|
|
792
|
+
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
793
|
}
|
|
760
794
|
};
|
|
761
795
|
MrdDateField.style = mrdDateFieldScss();
|
|
@@ -818,7 +852,7 @@ const MrdDatetimeField = class {
|
|
|
818
852
|
}
|
|
819
853
|
render() {
|
|
820
854
|
const hasError = !!this.error;
|
|
821
|
-
return (h(Host, { key: '
|
|
855
|
+
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
856
|
}
|
|
823
857
|
static get watchers() { return {
|
|
824
858
|
"value": [{
|
|
@@ -828,6 +862,916 @@ const MrdDatetimeField = class {
|
|
|
828
862
|
};
|
|
829
863
|
MrdDatetimeField.style = mrdDatetimeFieldScss();
|
|
830
864
|
|
|
865
|
+
const mrdDocumentContainerScss = () => `.sc-mrd-document-container-h{display:block}.mrd-document-container__toolbar.sc-mrd-document-container{display:flex;align-items:center;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-color-neutral-100)}.mrd-document-container__action.sc-mrd-document-container{display:inline-flex;align-items:center;gap:var(--mrd-space-2);height:1.625rem;padding:0 var(--mrd-space-3);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-700);background:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);cursor:pointer;transition:background var(--mrd-transition-fast), border-color var(--mrd-transition-fast)}.mrd-document-container__action.sc-mrd-document-container svg.sc-mrd-document-container{width:1rem;height:1rem;color:#d9a441}.mrd-document-container__action.sc-mrd-document-container:hover:not(:disabled){background:var(--mrd-color-neutral-50);border-color:var(--mrd-color-neutral-300)}.mrd-document-container__action.sc-mrd-document-container:disabled{opacity:0.5;cursor:not-allowed}.mrd-document-container__seg.sc-mrd-document-container{display:inline-flex;gap:2px;padding:2px;background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius)}.mrd-document-container__seg-btn.sc-mrd-document-container{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-document-container__seg-btn.sc-mrd-document-container:hover{color:var(--mrd-color-neutral-800)}.mrd-document-container__seg-btn[aria-pressed='true'].sc-mrd-document-container{background:var(--mrd-color-white);color:var(--mrd-color-primary-dark);box-shadow:var(--mrd-shadow-sm)}.mrd-document-container__seg-btn.sc-mrd-document-container svg.sc-mrd-document-container{width:1rem;height:1rem}`;
|
|
866
|
+
|
|
867
|
+
const MrdDocumentContainer = class {
|
|
868
|
+
constructor(hostRef) {
|
|
869
|
+
registerInstance(this, hostRef);
|
|
870
|
+
this.mrdLoadPage = createEvent(this, "mrdLoadPage");
|
|
871
|
+
this.mrdLoadDistinct = createEvent(this, "mrdLoadDistinct");
|
|
872
|
+
this.mrdLoadAggregations = createEvent(this, "mrdLoadAggregations");
|
|
873
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
874
|
+
this.mrdAction = createEvent(this, "mrdAction");
|
|
875
|
+
this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
|
|
876
|
+
this.mrdUpload = createEvent(this, "mrdUpload");
|
|
877
|
+
this.mrdCreateObject = createEvent(this, "mrdCreateObject");
|
|
878
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
879
|
+
this.item = null;
|
|
880
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
881
|
+
this.parentId = '';
|
|
882
|
+
/** Lookup key used for the embedded `data-doclist` / `data-view` attributes. */
|
|
883
|
+
this.viewKey = '';
|
|
884
|
+
this.locale = navigator.language;
|
|
885
|
+
/** Active body: folder tree or flat table. */
|
|
886
|
+
this.mode = 'tree';
|
|
887
|
+
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
888
|
+
this.canCreate = false;
|
|
889
|
+
/** Whether the currently mounted table has been init()'d. Reset on every mode switch. */
|
|
890
|
+
this.tableInited = false;
|
|
891
|
+
this.createFolder = () => {
|
|
892
|
+
var _a, _b;
|
|
893
|
+
(_b = (_a = this.listEl) === null || _a === void 0 ? void 0 : _a.createFolder) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
/** The embedded table does not self-load: like every mrd-table it waits for the
|
|
897
|
+
* host to call init() (which emits mrdLoadPage, and — once page 0 lands —
|
|
898
|
+
* mrdLoadAggregations). The section only init()s tables mounted at load time, so
|
|
899
|
+
* when the user switches to list view we init the freshly mounted table here. */
|
|
900
|
+
componentDidRender() {
|
|
901
|
+
var _a;
|
|
902
|
+
if (this.mode === 'list' && this.tableEl && !this.tableInited) {
|
|
903
|
+
this.tableInited = true;
|
|
904
|
+
const table = this.tableEl;
|
|
905
|
+
Promise.resolve((_a = table.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(table)).then(() => { var _a; return (_a = table.init) === null || _a === void 0 ? void 0 : _a.call(table); });
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
setMode(mode) {
|
|
909
|
+
if (mode === this.mode)
|
|
910
|
+
return;
|
|
911
|
+
// The tree remounts on switch and re-emits mrdCanCreate; until then, disable.
|
|
912
|
+
this.canCreate = false;
|
|
913
|
+
// The table remounts on switch; re-init it once it is back in the DOM.
|
|
914
|
+
this.tableInited = false;
|
|
915
|
+
this.mode = mode;
|
|
916
|
+
}
|
|
917
|
+
// ── Toolbar ────────────────────────────────────────────────────────────────
|
|
918
|
+
renderToolbar() {
|
|
919
|
+
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, onClick: this.createFolder }, 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 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" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('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-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('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" }))))));
|
|
920
|
+
}
|
|
921
|
+
// ── Bodies ───────────────────────────────────────────────────────────────
|
|
922
|
+
renderTree() {
|
|
923
|
+
return (h("mrd-document-list", { "data-doclist": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
924
|
+
e.stopPropagation();
|
|
925
|
+
this.mrdLoadDistinct.emit(e.detail);
|
|
926
|
+
}, onMrdLoadPage: (e) => {
|
|
927
|
+
e.stopPropagation();
|
|
928
|
+
this.mrdLoadPage.emit(e.detail);
|
|
929
|
+
}, onMrdNavigate: (e) => {
|
|
930
|
+
e.stopPropagation();
|
|
931
|
+
this.mrdNavigate.emit(e.detail);
|
|
932
|
+
}, onMrdCanCreate: (e) => {
|
|
933
|
+
e.stopPropagation();
|
|
934
|
+
this.canCreate = e.detail;
|
|
935
|
+
}, onMrdUpdateObject: (e) => {
|
|
936
|
+
e.stopPropagation();
|
|
937
|
+
this.mrdUpdateObject.emit(e.detail);
|
|
938
|
+
}, onMrdUpload: (e) => {
|
|
939
|
+
e.stopPropagation();
|
|
940
|
+
this.mrdUpload.emit(e.detail);
|
|
941
|
+
}, onMrdCreateObject: (e) => {
|
|
942
|
+
e.stopPropagation();
|
|
943
|
+
this.mrdCreateObject.emit(e.detail);
|
|
944
|
+
} }));
|
|
945
|
+
}
|
|
946
|
+
renderList() {
|
|
947
|
+
return (h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, onMrdLoadPage: (e) => {
|
|
948
|
+
e.stopPropagation();
|
|
949
|
+
this.mrdLoadPage.emit(e.detail);
|
|
950
|
+
}, onMrdLoadAggregations: (e) => {
|
|
951
|
+
e.stopPropagation();
|
|
952
|
+
this.mrdLoadAggregations.emit(e.detail);
|
|
953
|
+
}, onMrdRowClick: (e) => {
|
|
954
|
+
var _a, _b, _c;
|
|
955
|
+
e.stopPropagation();
|
|
956
|
+
const row = e.detail;
|
|
957
|
+
this.mrdNavigate.emit({ href: (_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href, label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '' });
|
|
958
|
+
}, onMrdAction: (e) => {
|
|
959
|
+
e.stopPropagation();
|
|
960
|
+
this.mrdAction.emit(e.detail);
|
|
961
|
+
} }));
|
|
962
|
+
}
|
|
963
|
+
render() {
|
|
964
|
+
return (h(Host, { key: 'a5393d484bdc202b57c6d32d9ce917e760aff95a' }, this.renderToolbar(), h("div", { key: '52f82de8f7734e13f34d323e3e831e6de5676f46', class: "mrd-document-container__body" }, this.mode === 'tree' ? this.renderTree() : this.renderList())));
|
|
965
|
+
}
|
|
966
|
+
get el() { return getElement(this); }
|
|
967
|
+
};
|
|
968
|
+
MrdDocumentContainer.style = mrdDocumentContainerScss();
|
|
969
|
+
|
|
970
|
+
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--selected.sc-mrd-document-list{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--selected.sc-mrd-document-list:hover{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--pending.sc-mrd-document-list .mrd-document-list__label.sc-mrd-document-list{font-style:italic;color:var(--mrd-color-neutral-500)}.mrd-document-list__row--doc.sc-mrd-document-list{cursor:grab}.mrd-document-list__row--doc.sc-mrd-document-list:active{cursor:grabbing}.mrd-document-list__row--drop.sc-mrd-document-list{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1));box-shadow:inset 0 0 0 1px var(--mrd-color-primary)}.mrd-document-list__row--drop.sc-mrd-document-list:hover{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--edit.sc-mrd-document-list{cursor:default}.mrd-document-list__name-input.sc-mrd-document-list{flex:1;min-width:0;height:1.625rem;padding:0 var(--mrd-space-2);font-size:var(--mrd-font-size-sm);font-family:inherit;color:var(--mrd-color-neutral-800);border:1px solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius);outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-document-list__error.sc-mrd-document-list{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-danger, #dc2626);padding-top:0.125rem;padding-bottom:0.25rem}.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)}`;
|
|
971
|
+
|
|
972
|
+
const MrdDocumentList = class {
|
|
973
|
+
constructor(hostRef) {
|
|
974
|
+
registerInstance(this, hostRef);
|
|
975
|
+
this.mrdLoadDistinct = createEvent(this, "mrdLoadDistinct");
|
|
976
|
+
this.mrdLoadPage = createEvent(this, "mrdLoadPage");
|
|
977
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
978
|
+
this.mrdCanCreate = createEvent(this, "mrdCanCreate");
|
|
979
|
+
this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
|
|
980
|
+
this.mrdUpload = createEvent(this, "mrdUpload");
|
|
981
|
+
this.mrdCreateObject = createEvent(this, "mrdCreateObject");
|
|
982
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
983
|
+
this.item = null;
|
|
984
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
985
|
+
this.parentId = '';
|
|
986
|
+
this.locale = navigator.language;
|
|
987
|
+
this.containers = [];
|
|
988
|
+
this.rootLoading = true;
|
|
989
|
+
/** True when the single-container level is collapsed away (dossier context). */
|
|
990
|
+
this.singleContainer = false;
|
|
991
|
+
/** Currently selected node id — the target for "New folder" and (later) drops. */
|
|
992
|
+
this.selectedId = null;
|
|
993
|
+
/** Node id currently highlighted as a drag-drop target (null = none). */
|
|
994
|
+
this.dropTargetId = null;
|
|
995
|
+
/** Node id showing an "uploading…" indicator while a dropped file is processed. */
|
|
996
|
+
this.uploadingNodeId = null;
|
|
997
|
+
this.nodeIndex = new Map();
|
|
998
|
+
// ── New-folder editing state ───────────────────────────────────────────────
|
|
999
|
+
/** The pending node whose inline name input is open (null = not creating). */
|
|
1000
|
+
this.pendingNode = null;
|
|
1001
|
+
/** The node the pending folder is being created under. */
|
|
1002
|
+
this.pendingParent = null;
|
|
1003
|
+
/** The container the pending folder belongs to. */
|
|
1004
|
+
this.pendingContainer = null;
|
|
1005
|
+
/** Current text in the inline name input. */
|
|
1006
|
+
this.pendingName = '';
|
|
1007
|
+
/** Ref to the inline input, so we can focus it after it mounts. */
|
|
1008
|
+
this.pendingInputEl = null;
|
|
1009
|
+
/** Set when a fresh input needs focus on the next render. */
|
|
1010
|
+
this.pendingNeedsFocus = false;
|
|
1011
|
+
/** Monotonic counter for unique temporary pending-node ids. */
|
|
1012
|
+
this.newFolderSeq = 0;
|
|
1013
|
+
/** Last emitted canCreateFolder value, to only emit mrdCanCreate on change. */
|
|
1014
|
+
this.lastCanCreate = false;
|
|
1015
|
+
// ── Drag & drop (move a document into another folder) ──────────────────────
|
|
1016
|
+
/** The document row currently being dragged. */
|
|
1017
|
+
this.dragDoc = null;
|
|
1018
|
+
/** Id of the node the dragged document currently lives in. */
|
|
1019
|
+
this.dragFromId = null;
|
|
1020
|
+
/** External file dropped onto a node, awaiting its upload to complete. */
|
|
1021
|
+
this.pendingUpload = null;
|
|
1022
|
+
/** The optimistic document row awaiting its self href from the create POST. */
|
|
1023
|
+
this.lastOptimisticDoc = null;
|
|
1024
|
+
this.startCreateFolder = () => {
|
|
1025
|
+
const resolved = this.resolveTarget();
|
|
1026
|
+
if (!resolved || this.pendingNode)
|
|
1027
|
+
return;
|
|
1028
|
+
const { target, container } = resolved;
|
|
1029
|
+
const tempId = `${container.id}/__new__${this.newFolderSeq++}`;
|
|
1030
|
+
const node = this.makeFolderNode(tempId, '', container.id);
|
|
1031
|
+
node.pending = true;
|
|
1032
|
+
node.editing = true;
|
|
1033
|
+
target.children = [...target.children, node];
|
|
1034
|
+
target.open = true;
|
|
1035
|
+
this.nodeIndex.set(node.id, node);
|
|
1036
|
+
this.pendingNode = node;
|
|
1037
|
+
this.pendingParent = target;
|
|
1038
|
+
this.pendingContainer = container;
|
|
1039
|
+
this.pendingName = '';
|
|
1040
|
+
this.pendingNeedsFocus = true;
|
|
1041
|
+
this.bump();
|
|
1042
|
+
};
|
|
1043
|
+
this.onPendingInput = (e) => {
|
|
1044
|
+
var _a;
|
|
1045
|
+
this.pendingName = e.target.value;
|
|
1046
|
+
if ((_a = this.pendingNode) === null || _a === void 0 ? void 0 : _a.error) {
|
|
1047
|
+
this.pendingNode.error = undefined;
|
|
1048
|
+
this.bump();
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
this.onPendingKeyDown = (e) => {
|
|
1052
|
+
if (e.key === 'Enter') {
|
|
1053
|
+
e.preventDefault();
|
|
1054
|
+
this.commitFolder();
|
|
1055
|
+
}
|
|
1056
|
+
else if (e.key === 'Escape') {
|
|
1057
|
+
e.preventDefault();
|
|
1058
|
+
this.cancelFolder();
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
// ── Drag & drop: move a document into another folder / container ────────────
|
|
1062
|
+
this.onDocDragStart = (e, doc, node) => {
|
|
1063
|
+
var _a, _b, _c;
|
|
1064
|
+
this.dragDoc = doc;
|
|
1065
|
+
this.dragFromId = node.id;
|
|
1066
|
+
if (e.dataTransfer) {
|
|
1067
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
1068
|
+
// A payload is required for a drag to start in some browsers.
|
|
1069
|
+
e.dataTransfer.setData('text/plain', (_c = (_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) !== null && _c !== void 0 ? _c : '');
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
this.onDocDragEnd = () => {
|
|
1073
|
+
this.dragDoc = null;
|
|
1074
|
+
this.dragFromId = null;
|
|
1075
|
+
if (this.dropTargetId !== null)
|
|
1076
|
+
this.dropTargetId = null;
|
|
1077
|
+
};
|
|
1078
|
+
/** A folder/container node (or a document inside it) accepts an internal move
|
|
1079
|
+
* or an external file drop. Always claims the event so it never bubbles to the
|
|
1080
|
+
* root drop-zone; a different node is highlighted (its own folder = no-op). */
|
|
1081
|
+
this.onNodeDragOver = (e, node) => {
|
|
1082
|
+
const file = this.isFileDrag(e);
|
|
1083
|
+
if (!this.dragDoc && !file)
|
|
1084
|
+
return;
|
|
1085
|
+
e.preventDefault();
|
|
1086
|
+
e.stopPropagation();
|
|
1087
|
+
if (e.dataTransfer)
|
|
1088
|
+
e.dataTransfer.dropEffect = file ? 'copy' : 'move';
|
|
1089
|
+
const target = !file && node.id === this.dragFromId ? null : node.id;
|
|
1090
|
+
if (this.dropTargetId !== target)
|
|
1091
|
+
this.dropTargetId = target;
|
|
1092
|
+
};
|
|
1093
|
+
this.onNodeDragLeave = (node) => {
|
|
1094
|
+
if (this.dropTargetId === node.id)
|
|
1095
|
+
this.dropTargetId = null;
|
|
1096
|
+
};
|
|
1097
|
+
this.onNodeDrop = (e, node, container) => {
|
|
1098
|
+
if (this.isFileDrag(e)) {
|
|
1099
|
+
e.preventDefault();
|
|
1100
|
+
e.stopPropagation();
|
|
1101
|
+
this.startFileUpload(e, node, container);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
if (!this.dragDoc)
|
|
1105
|
+
return;
|
|
1106
|
+
e.preventDefault();
|
|
1107
|
+
e.stopPropagation();
|
|
1108
|
+
this.moveDocument(node, container);
|
|
1109
|
+
this.onDocDragEnd();
|
|
1110
|
+
};
|
|
1111
|
+
/** Root-zone drop (dossier context): target the single container's root. */
|
|
1112
|
+
this.onRootDragOver = (e) => {
|
|
1113
|
+
if (!this.singleContainer)
|
|
1114
|
+
return;
|
|
1115
|
+
const file = this.isFileDrag(e);
|
|
1116
|
+
if (!this.dragDoc && !file)
|
|
1117
|
+
return;
|
|
1118
|
+
e.preventDefault();
|
|
1119
|
+
if (e.dataTransfer)
|
|
1120
|
+
e.dataTransfer.dropEffect = file ? 'copy' : 'move';
|
|
1121
|
+
};
|
|
1122
|
+
this.onRootDrop = (e) => {
|
|
1123
|
+
if (!this.singleContainer)
|
|
1124
|
+
return;
|
|
1125
|
+
const only = this.containers[0];
|
|
1126
|
+
if (this.isFileDrag(e)) {
|
|
1127
|
+
e.preventDefault();
|
|
1128
|
+
this.startFileUpload(e, only, only);
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (!this.dragDoc)
|
|
1132
|
+
return;
|
|
1133
|
+
e.preventDefault();
|
|
1134
|
+
this.moveDocument(only, only);
|
|
1135
|
+
this.onDocDragEnd();
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
componentDidLoad() {
|
|
1139
|
+
this.emitContainerDistinct();
|
|
1140
|
+
}
|
|
1141
|
+
componentDidRender() {
|
|
1142
|
+
if (this.pendingNeedsFocus && this.pendingInputEl) {
|
|
1143
|
+
this.pendingInputEl.focus();
|
|
1144
|
+
this.pendingInputEl.select();
|
|
1145
|
+
this.pendingNeedsFocus = false;
|
|
1146
|
+
}
|
|
1147
|
+
const can = this.canCreateFolder;
|
|
1148
|
+
if (can !== this.lastCanCreate) {
|
|
1149
|
+
this.lastCanCreate = can;
|
|
1150
|
+
this.mrdCanCreate.emit(can);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
// ── Slot field names ─────────────────────────────────────────────────────
|
|
1154
|
+
get containerField() {
|
|
1155
|
+
var _a, _b, _c;
|
|
1156
|
+
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';
|
|
1157
|
+
}
|
|
1158
|
+
get folderField() {
|
|
1159
|
+
var _a, _b, _c;
|
|
1160
|
+
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';
|
|
1161
|
+
}
|
|
1162
|
+
get titleField() {
|
|
1163
|
+
var _a, _b, _c;
|
|
1164
|
+
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';
|
|
1165
|
+
}
|
|
1166
|
+
get fileField() {
|
|
1167
|
+
var _a, _b, _c;
|
|
1168
|
+
return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.file) !== null && _c !== void 0 ? _c : 'file';
|
|
1169
|
+
}
|
|
1170
|
+
get dateField() {
|
|
1171
|
+
var _a, _b;
|
|
1172
|
+
return (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.date;
|
|
1173
|
+
}
|
|
1174
|
+
// ── Path / query building (mirrors mrd-table conventions) ────────────────
|
|
1175
|
+
/** VIEW: `/{dataClass}`; RELATED_VIEW: `/{fromClass}/{parentId}/{dataClass}`. */
|
|
1176
|
+
buildDataPath() {
|
|
1177
|
+
var _a, _b, _c;
|
|
1178
|
+
const it = this.item;
|
|
1179
|
+
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 : '';
|
|
1180
|
+
if ((it === null || it === void 0 ? void 0 : it.type) === ClientLayoutItemType.RELATED_VIEW) {
|
|
1181
|
+
return `/${(_c = it.fromClass) !== null && _c !== void 0 ? _c : ''}/${this.parentId}/${dataClass}`;
|
|
1182
|
+
}
|
|
1183
|
+
return `/${dataClass}`;
|
|
1184
|
+
}
|
|
1185
|
+
/** View-level static filters + filterClass, shared by every request. */
|
|
1186
|
+
baseParams() {
|
|
1187
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1188
|
+
const p = new URLSearchParams();
|
|
1189
|
+
const filterClass = (_a = this.item) === null || _a === void 0 ? void 0 : _a.filterClass;
|
|
1190
|
+
if (filterClass)
|
|
1191
|
+
p.set('type', filterClass);
|
|
1192
|
+
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 : [])) {
|
|
1193
|
+
if (!f.name)
|
|
1194
|
+
continue;
|
|
1195
|
+
if (f.operator === 'EMPTY') {
|
|
1196
|
+
p.set(f.name, '');
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
if (f.operator === 'NOT_EMPTY') {
|
|
1200
|
+
p.set(f.name + '_notempty', 'true');
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
if (f.operator === 'STARTS_WITH') {
|
|
1204
|
+
p.set(f.name + '_startswith', String((_e = f.value) !== null && _e !== void 0 ? _e : ''));
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
if (f.operator === 'FROM') {
|
|
1208
|
+
p.set(f.name + '_from', String((_f = f.value) !== null && _f !== void 0 ? _f : ''));
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
if (f.operator === 'TO') {
|
|
1212
|
+
p.set(f.name + '_to', String((_g = f.value) !== null && _g !== void 0 ? _g : ''));
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
if (f.value != null) {
|
|
1216
|
+
p.set(f.name, String(f.value));
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return p;
|
|
1220
|
+
}
|
|
1221
|
+
emitContainerDistinct() {
|
|
1222
|
+
const p = this.baseParams();
|
|
1223
|
+
p.set('distinct', this.containerField);
|
|
1224
|
+
this.mrdLoadDistinct.emit({
|
|
1225
|
+
nodeId: MrdDocumentList.ROOT,
|
|
1226
|
+
distinct: this.containerField,
|
|
1227
|
+
path: this.buildDataPath() + '/distinct',
|
|
1228
|
+
qs: p.toString(),
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
emitFolderDistinct(container) {
|
|
1232
|
+
var _a;
|
|
1233
|
+
const p = this.baseParams();
|
|
1234
|
+
p.set('distinct', this.folderField);
|
|
1235
|
+
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
1236
|
+
container.loading = true;
|
|
1237
|
+
this.mrdLoadDistinct.emit({
|
|
1238
|
+
nodeId: container.id,
|
|
1239
|
+
distinct: this.folderField,
|
|
1240
|
+
path: this.buildDataPath() + '/distinct',
|
|
1241
|
+
qs: p.toString(),
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
emitDocuments(container, node) {
|
|
1245
|
+
var _a, _b;
|
|
1246
|
+
const p = this.baseParams();
|
|
1247
|
+
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
1248
|
+
p.set(this.folderField, (_b = node.fullPath) !== null && _b !== void 0 ? _b : '');
|
|
1249
|
+
node.loading = true;
|
|
1250
|
+
this.mrdLoadPage.emit({
|
|
1251
|
+
nodeId: node.id,
|
|
1252
|
+
page: 0,
|
|
1253
|
+
sort: '',
|
|
1254
|
+
path: this.buildDataPath(),
|
|
1255
|
+
qs: p.toString(),
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
// ── Public injection API ─────────────────────────────────────────────────
|
|
1259
|
+
/** Inject distinct values for a node. `nodeId` is the sentinel root (containers)
|
|
1260
|
+
* or a container node id (folders). */
|
|
1261
|
+
async setDistinct(nodeId, values) {
|
|
1262
|
+
if (nodeId === MrdDocumentList.ROOT) {
|
|
1263
|
+
this.applyContainers(values);
|
|
1264
|
+
}
|
|
1265
|
+
else {
|
|
1266
|
+
this.applyFolders(nodeId, values);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
/** Inject the documents loaded for one folder node. */
|
|
1270
|
+
async setDocuments(nodeId, docs) {
|
|
1271
|
+
const node = this.nodeIndex.get(nodeId);
|
|
1272
|
+
if (!node)
|
|
1273
|
+
return;
|
|
1274
|
+
node.docs = docs !== null && docs !== void 0 ? docs : [];
|
|
1275
|
+
node.docsLoaded = true;
|
|
1276
|
+
node.loading = false;
|
|
1277
|
+
this.bump();
|
|
1278
|
+
}
|
|
1279
|
+
applyContainers(values) {
|
|
1280
|
+
const nodes = [];
|
|
1281
|
+
for (const v of values) {
|
|
1282
|
+
if (!v.value || typeof v.value !== 'object')
|
|
1283
|
+
continue;
|
|
1284
|
+
const href = v.value.href;
|
|
1285
|
+
const node = this.makeContainerNode(href, v.value.name, v.count);
|
|
1286
|
+
nodes.push(node);
|
|
1287
|
+
this.nodeIndex.set(node.id, node);
|
|
1288
|
+
}
|
|
1289
|
+
this.containers = nodes;
|
|
1290
|
+
this.rootLoading = false;
|
|
1291
|
+
this.singleContainer = nodes.length === 1;
|
|
1292
|
+
// Single container (dossier context): collapse the level away, load its folders now.
|
|
1293
|
+
if (this.singleContainer) {
|
|
1294
|
+
const only = nodes[0];
|
|
1295
|
+
only.open = true;
|
|
1296
|
+
this.emitFolderDistinct(only);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
applyFolders(containerId, values) {
|
|
1300
|
+
const container = this.nodeIndex.get(containerId);
|
|
1301
|
+
if (!container)
|
|
1302
|
+
return;
|
|
1303
|
+
container.children = [];
|
|
1304
|
+
container.hasDocs = false;
|
|
1305
|
+
container.docCount = 0;
|
|
1306
|
+
for (const v of values) {
|
|
1307
|
+
const raw = typeof v.value === 'string' ? v.value : v.value == null ? '' : String(v.value);
|
|
1308
|
+
const segs = this.splitFolder(raw);
|
|
1309
|
+
if (segs.length === 0) {
|
|
1310
|
+
// Root documents — the container's own direct documents.
|
|
1311
|
+
container.hasDocs = true;
|
|
1312
|
+
container.docCount = v.count;
|
|
1313
|
+
container.fullPath = raw;
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1316
|
+
let node = container;
|
|
1317
|
+
const acc = [];
|
|
1318
|
+
for (const seg of segs) {
|
|
1319
|
+
acc.push(seg);
|
|
1320
|
+
let child = node.children.find(c => c.label === seg);
|
|
1321
|
+
if (!child) {
|
|
1322
|
+
child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg, container.id);
|
|
1323
|
+
node.children.push(child);
|
|
1324
|
+
this.nodeIndex.set(child.id, child);
|
|
1325
|
+
}
|
|
1326
|
+
node = child;
|
|
1327
|
+
}
|
|
1328
|
+
node.hasDocs = true;
|
|
1329
|
+
node.docCount = v.count;
|
|
1330
|
+
node.fullPath = raw;
|
|
1331
|
+
}
|
|
1332
|
+
this.computeTotals(container);
|
|
1333
|
+
container.foldersLoaded = true;
|
|
1334
|
+
container.loading = false;
|
|
1335
|
+
// If the container has root documents, load them now (they show inline on expand).
|
|
1336
|
+
if (container.hasDocs && !container.docsLoaded) {
|
|
1337
|
+
this.emitDocuments(container, container);
|
|
1338
|
+
}
|
|
1339
|
+
this.bump();
|
|
1340
|
+
}
|
|
1341
|
+
// ── Tree helpers ─────────────────────────────────────────────────────────
|
|
1342
|
+
/** Normalise a folder path: null/""/"/" → root ([]); else split on "/" dropping empties. */
|
|
1343
|
+
splitFolder(path) {
|
|
1344
|
+
if (path == null)
|
|
1345
|
+
return [];
|
|
1346
|
+
const s = String(path).trim();
|
|
1347
|
+
if (s === '' || s === '/')
|
|
1348
|
+
return [];
|
|
1349
|
+
return s.split('/').map(x => x.trim()).filter(Boolean);
|
|
1350
|
+
}
|
|
1351
|
+
makeContainerNode(href, label, count) {
|
|
1352
|
+
return {
|
|
1353
|
+
id: 'c:' + href, kind: 'container', label, href,
|
|
1354
|
+
hasDocs: false, docCount: 0, totalCount: count, children: [],
|
|
1355
|
+
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
makeFolderNode(id, label, containerId) {
|
|
1359
|
+
return {
|
|
1360
|
+
id, kind: 'folder', label, containerId,
|
|
1361
|
+
hasDocs: false, docCount: 0, totalCount: 0, children: [],
|
|
1362
|
+
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
computeTotals(node) {
|
|
1366
|
+
let total = node.docCount;
|
|
1367
|
+
for (const c of node.children)
|
|
1368
|
+
total += this.computeTotals(c);
|
|
1369
|
+
node.totalCount = total;
|
|
1370
|
+
return total;
|
|
1371
|
+
}
|
|
1372
|
+
/** Force a re-render after mutating nodes in place. */
|
|
1373
|
+
bump() {
|
|
1374
|
+
this.containers = [...this.containers];
|
|
1375
|
+
}
|
|
1376
|
+
// ── Interaction ──────────────────────────────────────────────────────────
|
|
1377
|
+
toggleContainer(node) {
|
|
1378
|
+
this.selectedId = node.id;
|
|
1379
|
+
node.open = !node.open;
|
|
1380
|
+
if (node.open && !node.foldersLoaded && !node.loading) {
|
|
1381
|
+
this.emitFolderDistinct(node);
|
|
1382
|
+
}
|
|
1383
|
+
this.bump();
|
|
1384
|
+
}
|
|
1385
|
+
toggleFolder(container, node) {
|
|
1386
|
+
this.selectedId = node.id;
|
|
1387
|
+
node.open = !node.open;
|
|
1388
|
+
if (node.open && node.hasDocs && !node.docsLoaded && !node.loading) {
|
|
1389
|
+
this.emitDocuments(container, node);
|
|
1390
|
+
}
|
|
1391
|
+
this.bump();
|
|
1392
|
+
}
|
|
1393
|
+
// ── New folder (client-side pending, materialises on document drop) ─────────
|
|
1394
|
+
/** Resolve the node a new folder should be created under, and its container.
|
|
1395
|
+
* Uses the current selection; falls back to the single container (dossier). */
|
|
1396
|
+
resolveTarget() {
|
|
1397
|
+
if (this.selectedId) {
|
|
1398
|
+
const n = this.nodeIndex.get(this.selectedId);
|
|
1399
|
+
if (n && n.kind === 'container')
|
|
1400
|
+
return { target: n, container: n };
|
|
1401
|
+
if (n && n.kind === 'folder') {
|
|
1402
|
+
const container = n.containerId ? this.nodeIndex.get(n.containerId) : undefined;
|
|
1403
|
+
if (container)
|
|
1404
|
+
return { target: n, container };
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
if (this.singleContainer && this.containers[0]) {
|
|
1408
|
+
const only = this.containers[0];
|
|
1409
|
+
return { target: only, container: only };
|
|
1410
|
+
}
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
get canCreateFolder() {
|
|
1414
|
+
return !this.pendingNode && this.resolveTarget() !== null;
|
|
1415
|
+
}
|
|
1416
|
+
/** Start creating a folder under the current target. Called by the host toolbar
|
|
1417
|
+
* (mrd-document-container). No-op when there is no valid target. */
|
|
1418
|
+
async createFolder() {
|
|
1419
|
+
this.startCreateFolder();
|
|
1420
|
+
}
|
|
1421
|
+
/** Folder path segments of a node relative to its container (derived from its id). */
|
|
1422
|
+
segmentsOf(node, container) {
|
|
1423
|
+
if (node.kind === 'container')
|
|
1424
|
+
return [];
|
|
1425
|
+
const prefix = container.id + '/';
|
|
1426
|
+
const rest = node.id.startsWith(prefix) ? node.id.slice(prefix.length) : '';
|
|
1427
|
+
return rest ? rest.split('/') : [];
|
|
1428
|
+
}
|
|
1429
|
+
commitFolder() {
|
|
1430
|
+
const node = this.pendingNode;
|
|
1431
|
+
const parent = this.pendingParent;
|
|
1432
|
+
const container = this.pendingContainer;
|
|
1433
|
+
if (!node || !parent || !container)
|
|
1434
|
+
return;
|
|
1435
|
+
const name = this.pendingName.trim();
|
|
1436
|
+
if (!name) {
|
|
1437
|
+
this.cancelFolder();
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
if (name.includes('/')) {
|
|
1441
|
+
node.error = t('folder_no_slash', this.locale);
|
|
1442
|
+
this.bump();
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
const dup = parent.children.some(c => c !== node && c.label.toLowerCase() === name.toLowerCase());
|
|
1446
|
+
if (dup) {
|
|
1447
|
+
node.error = t('folder_duplicate', this.locale);
|
|
1448
|
+
this.bump();
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
// Finalise: swap the temp id for the real path-derived id so a later distinct
|
|
1452
|
+
// value with the same folder string merges onto this node.
|
|
1453
|
+
const segs = [...this.segmentsOf(parent, container), name];
|
|
1454
|
+
this.nodeIndex.delete(node.id);
|
|
1455
|
+
node.id = container.id + '/' + segs.join('/');
|
|
1456
|
+
node.fullPath = '/' + segs.join('/');
|
|
1457
|
+
node.label = name;
|
|
1458
|
+
node.editing = false;
|
|
1459
|
+
node.error = undefined;
|
|
1460
|
+
node.open = true;
|
|
1461
|
+
this.nodeIndex.set(node.id, node);
|
|
1462
|
+
this.selectedId = node.id;
|
|
1463
|
+
this.clearPending();
|
|
1464
|
+
this.bump();
|
|
1465
|
+
}
|
|
1466
|
+
cancelFolder() {
|
|
1467
|
+
const node = this.pendingNode;
|
|
1468
|
+
const parent = this.pendingParent;
|
|
1469
|
+
if (node && parent) {
|
|
1470
|
+
parent.children = parent.children.filter(c => c !== node);
|
|
1471
|
+
this.nodeIndex.delete(node.id);
|
|
1472
|
+
}
|
|
1473
|
+
this.clearPending();
|
|
1474
|
+
this.bump();
|
|
1475
|
+
}
|
|
1476
|
+
clearPending() {
|
|
1477
|
+
this.pendingNode = null;
|
|
1478
|
+
this.pendingParent = null;
|
|
1479
|
+
this.pendingContainer = null;
|
|
1480
|
+
this.pendingName = '';
|
|
1481
|
+
this.pendingInputEl = null;
|
|
1482
|
+
this.pendingNeedsFocus = false;
|
|
1483
|
+
}
|
|
1484
|
+
/** True when the drag carries external files (an OS file drop, not an internal move). */
|
|
1485
|
+
isFileDrag(e) {
|
|
1486
|
+
return !this.dragDoc && !!e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files');
|
|
1487
|
+
}
|
|
1488
|
+
// ── External file drop → upload → create document ──────────────────────────
|
|
1489
|
+
/** Begin an upload: emit mrdUpload; the host uploads and calls setFileReference. */
|
|
1490
|
+
startFileUpload(e, node, container) {
|
|
1491
|
+
var _a, _b;
|
|
1492
|
+
const file = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]; // single file per drop
|
|
1493
|
+
this.dropTargetId = null;
|
|
1494
|
+
if (!file)
|
|
1495
|
+
return;
|
|
1496
|
+
this.pendingUpload = { file, node, container };
|
|
1497
|
+
node.open = true;
|
|
1498
|
+
this.uploadingNodeId = node.id;
|
|
1499
|
+
this.bump();
|
|
1500
|
+
this.mrdUpload.emit({ file });
|
|
1501
|
+
}
|
|
1502
|
+
/** Strip a single trailing extension for the document title. */
|
|
1503
|
+
stripExtension(name) {
|
|
1504
|
+
return name.replace(/\.[^./\\]+$/, '');
|
|
1505
|
+
}
|
|
1506
|
+
/** Host callback with the uploaded file reference. Builds the create payload
|
|
1507
|
+
* from the archetype slots and requests the new document. */
|
|
1508
|
+
async setFileReference(uri) {
|
|
1509
|
+
const up = this.pendingUpload;
|
|
1510
|
+
if (!up)
|
|
1511
|
+
return;
|
|
1512
|
+
const { file, node, container } = up;
|
|
1513
|
+
const folder = this.folderStringOf(node, container);
|
|
1514
|
+
const values = {
|
|
1515
|
+
[this.fileField]: uri,
|
|
1516
|
+
[this.titleField]: this.stripExtension(file.name),
|
|
1517
|
+
[this.folderField]: folder,
|
|
1518
|
+
[this.containerField]: container.href,
|
|
1519
|
+
};
|
|
1520
|
+
this.mrdCreateObject.emit({ path: this.buildDataPath(), values });
|
|
1521
|
+
// Optimistically show the new document (no href until a reload).
|
|
1522
|
+
const optimistic = { [this.titleField]: this.stripExtension(file.name), _optimistic: true };
|
|
1523
|
+
const wasUnloadedEmpty = !node.docsLoaded && node.docCount === 0;
|
|
1524
|
+
node.hasDocs = true;
|
|
1525
|
+
node.pending = false;
|
|
1526
|
+
node.docCount += 1;
|
|
1527
|
+
if (wasUnloadedEmpty) {
|
|
1528
|
+
node.docsLoaded = true;
|
|
1529
|
+
node.docs = [optimistic];
|
|
1530
|
+
}
|
|
1531
|
+
else if (node.docsLoaded)
|
|
1532
|
+
node.docs = [...node.docs, optimistic];
|
|
1533
|
+
this.recomputeContainerTotals(container, 1);
|
|
1534
|
+
this.lastOptimisticDoc = optimistic;
|
|
1535
|
+
this.pendingUpload = null;
|
|
1536
|
+
this.uploadingNodeId = null;
|
|
1537
|
+
this.bump();
|
|
1538
|
+
}
|
|
1539
|
+
/** Host callback with the created document's self href, so the optimistic row
|
|
1540
|
+
* becomes navigable without waiting for a reload. */
|
|
1541
|
+
async setCreatedHref(href) {
|
|
1542
|
+
var _a;
|
|
1543
|
+
const doc = this.lastOptimisticDoc;
|
|
1544
|
+
if (!doc || !href)
|
|
1545
|
+
return;
|
|
1546
|
+
doc._links = Object.assign(Object.assign({}, ((_a = doc._links) !== null && _a !== void 0 ? _a : {})), { self: { href } });
|
|
1547
|
+
doc._optimistic = false;
|
|
1548
|
+
this.lastOptimisticDoc = null;
|
|
1549
|
+
this.bump();
|
|
1550
|
+
}
|
|
1551
|
+
/** Folder string a node represents: the raw distinct value when it holds
|
|
1552
|
+
* documents, else derived from its path segments; null for a container root. */
|
|
1553
|
+
folderStringOf(node, container) {
|
|
1554
|
+
if (node.kind === 'container')
|
|
1555
|
+
return null;
|
|
1556
|
+
if (node.fullPath != null && node.fullPath !== '')
|
|
1557
|
+
return node.fullPath;
|
|
1558
|
+
const segs = this.segmentsOf(node, container);
|
|
1559
|
+
return segs.length ? '/' + segs.join('/') : null;
|
|
1560
|
+
}
|
|
1561
|
+
moveDocument(toNode, toContainer) {
|
|
1562
|
+
var _a, _b;
|
|
1563
|
+
const doc = this.dragDoc;
|
|
1564
|
+
const fromNode = this.dragFromId ? this.nodeIndex.get(this.dragFromId) : undefined;
|
|
1565
|
+
if (!doc || !fromNode)
|
|
1566
|
+
return;
|
|
1567
|
+
const fromContainer = fromNode.kind === 'container'
|
|
1568
|
+
? fromNode
|
|
1569
|
+
: (fromNode.containerId ? this.nodeIndex.get(fromNode.containerId) : undefined);
|
|
1570
|
+
if (!fromContainer)
|
|
1571
|
+
return;
|
|
1572
|
+
const targetFolder = this.folderStringOf(toNode, toContainer);
|
|
1573
|
+
const sourceFolder = this.folderStringOf(fromNode, fromContainer);
|
|
1574
|
+
const sameContainer = toContainer === fromContainer;
|
|
1575
|
+
// No-op: dropped back onto its own folder.
|
|
1576
|
+
if (toNode === fromNode || (sameContainer && targetFolder === sourceFolder))
|
|
1577
|
+
return;
|
|
1578
|
+
// ── Optimistic tree update (fire-and-forget; no refetch) ──
|
|
1579
|
+
fromNode.docs = fromNode.docs.filter(d => d !== doc);
|
|
1580
|
+
fromNode.docCount = Math.max(0, fromNode.docCount - 1);
|
|
1581
|
+
// A now-empty folder should stop showing an expand chevron (it disappears on
|
|
1582
|
+
// the next reload anyway, since it is derived from document folder strings).
|
|
1583
|
+
if (fromNode.docsLoaded)
|
|
1584
|
+
fromNode.hasDocs = fromNode.docs.length > 0;
|
|
1585
|
+
toNode.hasDocs = true;
|
|
1586
|
+
toNode.pending = false; // a pending folder is now materialised
|
|
1587
|
+
toNode.docCount += 1;
|
|
1588
|
+
if (toNode.kind === 'folder')
|
|
1589
|
+
toNode.fullPath = targetFolder !== null && targetFolder !== void 0 ? targetFolder : '';
|
|
1590
|
+
if (toNode.docsLoaded)
|
|
1591
|
+
toNode.docs = [...toNode.docs, doc];
|
|
1592
|
+
this.recomputeContainerTotals(fromContainer, -1);
|
|
1593
|
+
if (!sameContainer)
|
|
1594
|
+
this.recomputeContainerTotals(toContainer, 1);
|
|
1595
|
+
// ── Emit the generic update; host PATCHes the document ──
|
|
1596
|
+
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;
|
|
1597
|
+
if (href) {
|
|
1598
|
+
const values = { [this.folderField]: targetFolder };
|
|
1599
|
+
if (!sameContainer)
|
|
1600
|
+
values[this.containerField] = toContainer.href;
|
|
1601
|
+
this.mrdUpdateObject.emit({ href, values });
|
|
1602
|
+
}
|
|
1603
|
+
this.bump();
|
|
1604
|
+
}
|
|
1605
|
+
/** Recompute a container's subtree totals from docCounts when its folders are
|
|
1606
|
+
* loaded; otherwise just nudge the aggregate badge by the delta. */
|
|
1607
|
+
recomputeContainerTotals(container, delta) {
|
|
1608
|
+
if (container.foldersLoaded) {
|
|
1609
|
+
this.computeTotals(container);
|
|
1610
|
+
}
|
|
1611
|
+
else {
|
|
1612
|
+
container.totalCount = Math.max(0, container.totalCount + delta);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
openDoc(doc) {
|
|
1616
|
+
var _a, _b, _c, _d;
|
|
1617
|
+
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;
|
|
1618
|
+
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 : '';
|
|
1619
|
+
this.mrdNavigate.emit({ href, label });
|
|
1620
|
+
}
|
|
1621
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
1622
|
+
renderChevron(open, leaf) {
|
|
1623
|
+
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" }))));
|
|
1624
|
+
}
|
|
1625
|
+
renderDossierIcon() {
|
|
1626
|
+
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" })));
|
|
1627
|
+
}
|
|
1628
|
+
renderFolderIcon() {
|
|
1629
|
+
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" })));
|
|
1630
|
+
}
|
|
1631
|
+
renderDocIcon() {
|
|
1632
|
+
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" })));
|
|
1633
|
+
}
|
|
1634
|
+
indent(depth) {
|
|
1635
|
+
return h("span", { class: "mrd-document-list__indent", style: { width: `${depth * 18}px` } });
|
|
1636
|
+
}
|
|
1637
|
+
renderDocRow(doc, node, container, depth) {
|
|
1638
|
+
var _a, _b, _c, _d, _e;
|
|
1639
|
+
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 : '';
|
|
1640
|
+
const dateRaw = this.dateField ? doc === null || doc === void 0 ? void 0 : doc[this.dateField] : undefined;
|
|
1641
|
+
const date = dateRaw ? formatDate(dateRaw, this.locale) : '';
|
|
1642
|
+
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, draggable: true, onClick: () => this.openDoc(doc), onDragStart: (e) => this.onDocDragStart(e, doc, node), onDragEnd: this.onDocDragEnd, onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, container) }, 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)));
|
|
1643
|
+
}
|
|
1644
|
+
renderLoadingRow(depth) {
|
|
1645
|
+
return (h("div", { class: "mrd-document-list__loading", key: "loading" }, this.indent(depth), h("span", { class: "mrd-document-list__spinner" }), t('loading', this.locale)));
|
|
1646
|
+
}
|
|
1647
|
+
renderChildren(container, node, depth) {
|
|
1648
|
+
const out = [];
|
|
1649
|
+
// Direct documents of this node (root docs live on the container node).
|
|
1650
|
+
if (node.hasDocs) {
|
|
1651
|
+
if (node.docsLoaded) {
|
|
1652
|
+
for (const doc of node.docs)
|
|
1653
|
+
out.push(this.renderDocRow(doc, node, container, depth));
|
|
1654
|
+
}
|
|
1655
|
+
else if (node.loading) {
|
|
1656
|
+
out.push(this.renderLoadingRow(depth));
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
// Child folders.
|
|
1660
|
+
for (const child of node.children) {
|
|
1661
|
+
out.push(this.renderFolderNode(container, child, depth));
|
|
1662
|
+
}
|
|
1663
|
+
// An uploading file dropped onto this node.
|
|
1664
|
+
if (node.id === this.uploadingNodeId)
|
|
1665
|
+
out.push(this.renderUploadingRow(depth));
|
|
1666
|
+
return out;
|
|
1667
|
+
}
|
|
1668
|
+
renderUploadingRow(depth) {
|
|
1669
|
+
return (h("div", { class: "mrd-document-list__loading", key: "uploading" }, this.indent(depth), h("span", { class: "mrd-document-list__spinner" }), t('upload_file', this.locale)));
|
|
1670
|
+
}
|
|
1671
|
+
renderFolderEditRow(node, depth) {
|
|
1672
|
+
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row mrd-document-list__row--edit" }, this.indent(depth), this.renderChevron(false, true), this.renderFolderIcon(), h("input", { class: "mrd-document-list__name-input", type: "text", placeholder: t('folder_name_placeholder', this.locale), ref: el => (this.pendingInputEl = el), onInput: this.onPendingInput, onKeyDown: this.onPendingKeyDown, onBlur: () => this.cancelFolder() })), node.error && (h("div", { class: "mrd-document-list__error", style: { paddingLeft: `${depth * 18 + 52}px` } }, node.error))));
|
|
1673
|
+
}
|
|
1674
|
+
renderFolderNode(container, node, depth) {
|
|
1675
|
+
if (node.editing)
|
|
1676
|
+
return this.renderFolderEditRow(node, depth);
|
|
1677
|
+
const leaf = node.children.length === 0 && !node.hasDocs;
|
|
1678
|
+
const selected = node.id === this.selectedId;
|
|
1679
|
+
const cls = 'mrd-document-list__row'
|
|
1680
|
+
+ (selected ? ' mrd-document-list__row--selected' : '')
|
|
1681
|
+
+ (node.pending ? ' mrd-document-list__row--pending' : '')
|
|
1682
|
+
+ (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
|
|
1683
|
+
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: cls, onClick: () => this.toggleFolder(container, node), onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, container) }, 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))));
|
|
1684
|
+
}
|
|
1685
|
+
renderContainerNode(node, depth) {
|
|
1686
|
+
const selected = node.id === this.selectedId;
|
|
1687
|
+
const cls = 'mrd-document-list__row mrd-document-list__row--dossier'
|
|
1688
|
+
+ (selected ? ' mrd-document-list__row--selected' : '')
|
|
1689
|
+
+ (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
|
|
1690
|
+
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: cls, onClick: () => this.toggleContainer(node), onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, 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
|
|
1691
|
+
? this.renderLoadingRow(depth + 1)
|
|
1692
|
+
: this.renderChildren(node, node, depth + 1)))));
|
|
1693
|
+
}
|
|
1694
|
+
render() {
|
|
1695
|
+
let body;
|
|
1696
|
+
if (this.rootLoading) {
|
|
1697
|
+
body = this.renderLoadingRow(0);
|
|
1698
|
+
}
|
|
1699
|
+
else if (this.containers.length === 0) {
|
|
1700
|
+
body = h("div", { key: 'b8c3297cd7cff5bf79ce694d2ee1a64c570df5ce', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
1701
|
+
}
|
|
1702
|
+
else if (this.singleContainer) {
|
|
1703
|
+
// Dossier context: render the single container's folder tree at the root.
|
|
1704
|
+
const only = this.containers[0];
|
|
1705
|
+
body = only.loading && !only.foldersLoaded
|
|
1706
|
+
? this.renderLoadingRow(0)
|
|
1707
|
+
: this.renderChildren(only, only, 0);
|
|
1708
|
+
}
|
|
1709
|
+
else {
|
|
1710
|
+
body = this.containers.map(c => this.renderContainerNode(c, 0));
|
|
1711
|
+
}
|
|
1712
|
+
return (h(Host, { key: 'ff3b024a79ba2270aa28861923bc6406f98061aa' }, h("div", { key: '9db121e5336a4e3c82443257f6424db5ab4f0baf', class: "mrd-document-list", onDragOver: this.onRootDragOver, onDrop: this.onRootDrop }, body)));
|
|
1713
|
+
}
|
|
1714
|
+
get el() { return getElement(this); }
|
|
1715
|
+
};
|
|
1716
|
+
/** Root sentinel id for the container-level distinct request. */
|
|
1717
|
+
MrdDocumentList.ROOT = '__root__';
|
|
1718
|
+
MrdDocumentList.style = mrdDocumentListScss();
|
|
1719
|
+
|
|
1720
|
+
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)}`;
|
|
1721
|
+
|
|
1722
|
+
const MrdDocumentView = class {
|
|
1723
|
+
constructor(hostRef) {
|
|
1724
|
+
registerInstance(this, hostRef);
|
|
1725
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
1726
|
+
this.mrdDownload = createEvent(this, "mrdDownload");
|
|
1727
|
+
/** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
|
|
1728
|
+
this.data = {};
|
|
1729
|
+
this.locale = navigator.language;
|
|
1730
|
+
}
|
|
1731
|
+
/** Value of a value-slot: reads data[field] via the slot→field map. */
|
|
1732
|
+
slotValue(slot) {
|
|
1733
|
+
var _a, _b;
|
|
1734
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
1735
|
+
if (!field)
|
|
1736
|
+
return undefined;
|
|
1737
|
+
return this.data[field];
|
|
1738
|
+
}
|
|
1739
|
+
/** Relation link for a relation-slot: reads data._links[field]. */
|
|
1740
|
+
slotLink(slot) {
|
|
1741
|
+
var _a, _b, _c, _d;
|
|
1742
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
1743
|
+
if (!field)
|
|
1744
|
+
return undefined;
|
|
1745
|
+
const links = ((_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links) !== null && _d !== void 0 ? _d : {});
|
|
1746
|
+
return links[field];
|
|
1747
|
+
}
|
|
1748
|
+
renderContainer() {
|
|
1749
|
+
const link = this.slotLink('container');
|
|
1750
|
+
if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
|
|
1751
|
+
return null;
|
|
1752
|
+
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));
|
|
1753
|
+
}
|
|
1754
|
+
renderFile() {
|
|
1755
|
+
var _a, _b;
|
|
1756
|
+
const raw = this.slotValue('file');
|
|
1757
|
+
if (!raw)
|
|
1758
|
+
return null;
|
|
1759
|
+
const href = (_a = raw === null || raw === void 0 ? void 0 : raw.href) !== null && _a !== void 0 ? _a : '';
|
|
1760
|
+
const fileName = (_b = raw === null || raw === void 0 ? void 0 : raw.fileName) !== null && _b !== void 0 ? _b : String(raw);
|
|
1761
|
+
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)))));
|
|
1762
|
+
}
|
|
1763
|
+
render() {
|
|
1764
|
+
const titleRaw = this.slotValue('title');
|
|
1765
|
+
const title = titleRaw != null && titleRaw !== '' ? String(titleRaw) : null;
|
|
1766
|
+
const dateRaw = this.slotValue('date');
|
|
1767
|
+
const date = dateRaw != null && dateRaw !== '' ? formatDate(dateRaw, this.locale) : null;
|
|
1768
|
+
const summaryRaw = this.slotValue('summary');
|
|
1769
|
+
const summary = summaryRaw != null && summaryRaw !== '' ? String(summaryRaw) : null;
|
|
1770
|
+
return (h(Host, { key: '0a2071925ecdb21738376d66fa4babf4590e694c' }, h("div", { key: 'a2d29c0b6e211cab142adc780466bc885a602e96', class: "mrd-document-view" }, this.renderContainer(), title && h("h1", { key: '7f5ac202c21bc8a70f0dd15e2e1fa06e651b5bce', class: "mrd-document-view__title" }, title), date && h("p", { key: 'b1dce94d5fd8bfd5e078644f631a38f91b87e7ff', class: "mrd-document-view__date" }, date), this.renderFile(), summary && (h("div", { key: '588b9ca40a49ae9ea303852620bde75333b440ab', class: "mrd-document-view__summary" }, h("div", { key: 'd3b8adb85ac346b72451e789c10aedd539c966de', class: "mrd-document-view__summary-body", innerHTML: summary }))))));
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
MrdDocumentView.style = mrdDocumentViewScss();
|
|
1774
|
+
|
|
831
1775
|
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
1776
|
|
|
833
1777
|
const MrdEmailField = class {
|
|
@@ -863,7 +1807,7 @@ const MrdEmailField = class {
|
|
|
863
1807
|
}
|
|
864
1808
|
render() {
|
|
865
1809
|
const hasError = !!this.error;
|
|
866
|
-
return (h(Host, { key: '
|
|
1810
|
+
return (h(Host, { key: '0d442ab2a711c26c83fcdbf0fd8cd006d8dd8649' }, h("div", { key: 'ceb2a80679514c4c5b888fe096c90ed6cc973f64', class: "mrd-email-field" }, this.label && (h("label", { key: '663f95eff1002ee56cfc3104514bf31b47e26750', class: `mrd-email-field__label${this.required ? ' mrd-email-field__label--required' : ''}` }, this.label)), h("input", { key: '42dbdec25a47b37cfd68d00d0b8a481f96fe8241', 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: '626ee856ceaa7051fb9dd1de8b7cbd708e83f617', class: "mrd-email-field__error" }, this.error))));
|
|
867
1811
|
}
|
|
868
1812
|
};
|
|
869
1813
|
MrdEmailField.style = mrdEmailFieldScss();
|
|
@@ -1146,7 +2090,7 @@ const MrdFileField = class {
|
|
|
1146
2090
|
hasError ? 'mrd-file-field__zone--error' : '',
|
|
1147
2091
|
this.disabled || this.uploading ? 'mrd-file-field__zone--disabled' : '',
|
|
1148
2092
|
].filter(Boolean).join(' ');
|
|
1149
|
-
return (h(Host, { key: '
|
|
2093
|
+
return (h(Host, { key: '095bb39f3cb1680cf5e7e51bdfd06d8eb087f237' }, h("div", { key: '7e5b5fe6e63b6530221083c8bcb82bcac59a5fe7', class: "mrd-file-field" }, this.label && (h("label", { key: 'c34723f4199371d6fe8ea87463d878b89c038590', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), h("div", { key: '4727667345d3cd4a5c65a431744a09f366943c13', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: '45ed41c0f094dbe269561c8586e473f908cdf4a4', 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: '00ce94ead3c32ed63e903cfd9d8480084a308d84', class: "mrd-file-field__error" }, this.error))));
|
|
1150
2094
|
}
|
|
1151
2095
|
static get watchers() { return {
|
|
1152
2096
|
"value": [{
|
|
@@ -1707,7 +2651,7 @@ const MrdImageField = class {
|
|
|
1707
2651
|
hasError ? 'mrd-image-field__zone--error' : '',
|
|
1708
2652
|
this.disabled || this.uploading ? 'mrd-image-field__zone--disabled' : '',
|
|
1709
2653
|
].filter(Boolean).join(' ');
|
|
1710
|
-
return (h(Host, { key: '
|
|
2654
|
+
return (h(Host, { key: '97db2df72839f36b7a46e153a5dd1c208c52b522' }, h("div", { key: 'c8f2d3d858f90d322d26082aaf5adb57acfc78f4', class: "mrd-image-field" }, this.label && (h("label", { key: '6625e5031ff0b7c06f76c1ea0387f1bd5c1858a4', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), h("div", { key: '364216e6a96e845e21c42e821fdff02bd2612ff8', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: '0487706ddd9f48cda1cb0c2a178809d90674486b', 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: 'bd505ef4f4b67c4e9138d8825c6e600f583f4cab', class: "mrd-image-field__error" }, this.error))));
|
|
1711
2655
|
}
|
|
1712
2656
|
static get watchers() { return {
|
|
1713
2657
|
"value": [{
|
|
@@ -1821,7 +2765,7 @@ class CellRenderer {
|
|
|
1821
2765
|
}
|
|
1822
2766
|
}
|
|
1823
2767
|
|
|
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}`;
|
|
2768
|
+
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__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
2769
|
|
|
1826
2770
|
const MrdLayoutSection = class {
|
|
1827
2771
|
constructor(hostRef) {
|
|
@@ -1833,6 +2777,10 @@ const MrdLayoutSection = class {
|
|
|
1833
2777
|
this.mrdLoadImage = createEvent(this, "mrdLoadImage");
|
|
1834
2778
|
this.mrdViewAction = createEvent(this, "mrdViewAction");
|
|
1835
2779
|
this.mrdLoadViewAggregations = createEvent(this, "mrdLoadViewAggregations");
|
|
2780
|
+
this.mrdLoadViewDistinct = createEvent(this, "mrdLoadViewDistinct");
|
|
2781
|
+
this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
|
|
2782
|
+
this.mrdViewUpload = createEvent(this, "mrdViewUpload");
|
|
2783
|
+
this.mrdCreateObject = createEvent(this, "mrdCreateObject");
|
|
1836
2784
|
/** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
|
|
1837
2785
|
this.items = [];
|
|
1838
2786
|
/** Record data object; keys are field names, _links holds relation and related-view links. */
|
|
@@ -1842,6 +2790,9 @@ const MrdLayoutSection = class {
|
|
|
1842
2790
|
/** Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format. */
|
|
1843
2791
|
this.links = {};
|
|
1844
2792
|
this.locale = navigator.language;
|
|
2793
|
+
/** Top-level archetypes on the object dashboard. When it contains commons.document,
|
|
2794
|
+
* the record is rendered as a single-document view instead of generic fields. */
|
|
2795
|
+
this.archetypes = [];
|
|
1845
2796
|
this.searchQueryMap = {};
|
|
1846
2797
|
this.searchResultsMap = {};
|
|
1847
2798
|
this.imagePreviewUrl = null;
|
|
@@ -1930,11 +2881,18 @@ const MrdLayoutSection = class {
|
|
|
1930
2881
|
}
|
|
1931
2882
|
}
|
|
1932
2883
|
/**
|
|
1933
|
-
* Inject
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
2884
|
+
* Inject rows for a VIEW / RELATED_VIEW item.
|
|
2885
|
+
* - Table view: injects the page into the embedded mrd-table (pass totalElements/hasNext).
|
|
2886
|
+
* - Document view: pass `nodeId` to route the rows to that folder node in the embedded
|
|
2887
|
+
* mrd-document-list. Folder loading is just a filtered list load, so it reuses this method.
|
|
1936
2888
|
*/
|
|
1937
|
-
async setViewPage(name, page, rows, totalElements, hasNext) {
|
|
2889
|
+
async setViewPage(name, page, rows, totalElements, hasNext, nodeId) {
|
|
2890
|
+
if (nodeId) {
|
|
2891
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2892
|
+
if (list === null || list === void 0 ? void 0 : list.setDocuments)
|
|
2893
|
+
await list.setDocuments(nodeId, rows);
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
1938
2896
|
const table = this.el.querySelector(`mrd-table[data-view="${name}"]`);
|
|
1939
2897
|
if (!table)
|
|
1940
2898
|
return;
|
|
@@ -1950,6 +2908,26 @@ const MrdLayoutSection = class {
|
|
|
1950
2908
|
return;
|
|
1951
2909
|
await table.setAggregations(data);
|
|
1952
2910
|
}
|
|
2911
|
+
/** Inject distinct values into an embedded mrd-document-list for a document view. */
|
|
2912
|
+
async setViewDistinct(name, nodeId, values) {
|
|
2913
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2914
|
+
if (list === null || list === void 0 ? void 0 : list.setDistinct)
|
|
2915
|
+
await list.setDistinct(nodeId, values);
|
|
2916
|
+
}
|
|
2917
|
+
/** Inject the uploaded file reference for a dropped file, so the document view
|
|
2918
|
+
* can request creation of the new document (see mrdViewUpload). */
|
|
2919
|
+
async setViewFileReference(name, uri) {
|
|
2920
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2921
|
+
if (list === null || list === void 0 ? void 0 : list.setFileReference)
|
|
2922
|
+
await list.setFileReference(uri);
|
|
2923
|
+
}
|
|
2924
|
+
/** Inject the created document's href after a file-drop create, so the
|
|
2925
|
+
* optimistic row becomes navigable (see mrdCreateObject). */
|
|
2926
|
+
async setViewCreatedObject(name, href) {
|
|
2927
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2928
|
+
if (list === null || list === void 0 ? void 0 : list.setCreatedHref)
|
|
2929
|
+
await list.setCreatedHref(href);
|
|
2930
|
+
}
|
|
1953
2931
|
/** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
|
|
1954
2932
|
async setImagePreview(fieldName, url) {
|
|
1955
2933
|
this.imagePreviews = Object.assign(Object.assign({}, this.imagePreviews), { [fieldName]: url });
|
|
@@ -2098,7 +3076,7 @@ const MrdLayoutSection = class {
|
|
|
2098
3076
|
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
3077
|
}
|
|
2100
3078
|
renderRelatedView(item) {
|
|
2101
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3079
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2102
3080
|
const key = this.viewKeyFor(item);
|
|
2103
3081
|
if (!key)
|
|
2104
3082
|
return null;
|
|
@@ -2108,7 +3086,47 @@ const MrdLayoutSection = class {
|
|
|
2108
3086
|
// Extract parentId from data._links.self.href for RELATED_VIEW path construction
|
|
2109
3087
|
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
3088
|
const parentId = (_f = selfHref.split('/').filter(Boolean).pop()) !== null && _f !== void 0 ? _f : '';
|
|
2111
|
-
|
|
3089
|
+
// The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
|
|
3090
|
+
// (sibling of `view`), not inside `view`.
|
|
3091
|
+
const docArchetype = resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, ARCHETYPE_DOCUMENT);
|
|
3092
|
+
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
|
|
3093
|
+
? this.renderDocumentContainer(item, key, parentId, docArchetype)
|
|
3094
|
+
: this.renderTable(item, key, parentId)));
|
|
3095
|
+
}
|
|
3096
|
+
/** Document collection view: owns the view-switch + collection actions and
|
|
3097
|
+
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
3098
|
+
* the host with the view key, exactly as the raw list/table events were. */
|
|
3099
|
+
renderDocumentContainer(item, key, parentId, archetype) {
|
|
3100
|
+
return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
3101
|
+
e.stopPropagation();
|
|
3102
|
+
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
3103
|
+
}, onMrdLoadPage: (e) => {
|
|
3104
|
+
e.stopPropagation();
|
|
3105
|
+
this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
|
|
3106
|
+
}, onMrdLoadAggregations: (e) => {
|
|
3107
|
+
var _a;
|
|
3108
|
+
e.stopPropagation();
|
|
3109
|
+
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
3110
|
+
}, onMrdNavigate: (e) => {
|
|
3111
|
+
e.stopPropagation();
|
|
3112
|
+
this.mrdNavigate.emit(e.detail);
|
|
3113
|
+
}, onMrdAction: (e) => {
|
|
3114
|
+
var _a;
|
|
3115
|
+
e.stopPropagation();
|
|
3116
|
+
this.mrdViewAction.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
3117
|
+
}, onMrdUpdateObject: (e) => {
|
|
3118
|
+
e.stopPropagation();
|
|
3119
|
+
this.mrdUpdateObject.emit(e.detail);
|
|
3120
|
+
}, onMrdUpload: (e) => {
|
|
3121
|
+
e.stopPropagation();
|
|
3122
|
+
this.mrdViewUpload.emit(Object.assign({ name: key }, e.detail));
|
|
3123
|
+
}, onMrdCreateObject: (e) => {
|
|
3124
|
+
e.stopPropagation();
|
|
3125
|
+
this.mrdCreateObject.emit(Object.assign({ name: key }, e.detail));
|
|
3126
|
+
} }));
|
|
3127
|
+
}
|
|
3128
|
+
renderTable(item, key, parentId) {
|
|
3129
|
+
return (h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
|
|
2112
3130
|
var _a;
|
|
2113
3131
|
e.stopPropagation();
|
|
2114
3132
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
@@ -2129,7 +3147,7 @@ const MrdLayoutSection = class {
|
|
|
2129
3147
|
parentPath: e.detail.parentPath,
|
|
2130
3148
|
basicType: e.detail.basicType,
|
|
2131
3149
|
});
|
|
2132
|
-
} }))
|
|
3150
|
+
} }));
|
|
2133
3151
|
}
|
|
2134
3152
|
renderItem(item) {
|
|
2135
3153
|
var _a, _b;
|
|
@@ -2161,8 +3179,23 @@ const MrdLayoutSection = class {
|
|
|
2161
3179
|
return null;
|
|
2162
3180
|
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
3181
|
}
|
|
3182
|
+
/** Single-document view: the record's own type carries commons.document. Renders
|
|
3183
|
+
* a recognisable document instead of generic fields, keeping any related views/
|
|
3184
|
+
* searches below it. */
|
|
3185
|
+
renderDocumentObject(archetype) {
|
|
3186
|
+
const related = this.items.filter(it => it.type === ClientLayoutItemType.VIEW ||
|
|
3187
|
+
it.type === ClientLayoutItemType.RELATED_VIEW ||
|
|
3188
|
+
it.type === ClientLayoutItemType.SEARCH);
|
|
3189
|
+
return [
|
|
3190
|
+
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); } }),
|
|
3191
|
+
...related.map(it => this.renderItem(it)),
|
|
3192
|
+
];
|
|
3193
|
+
}
|
|
2164
3194
|
render() {
|
|
2165
|
-
|
|
3195
|
+
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
3196
|
+
return (h(Host, { key: '6e737354daec0137b6ebe304efcce9990f02739f' }, h("div", { key: '31a73a8a78999793f5dacee5f2da41df5f23156e', class: "mrd-layout-section" }, docArchetype
|
|
3197
|
+
? this.renderDocumentObject(docArchetype)
|
|
3198
|
+
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
2166
3199
|
}
|
|
2167
3200
|
get el() { return getElement(this); }
|
|
2168
3201
|
static get watchers() { return {
|
|
@@ -2302,7 +3335,7 @@ const MrdLongtextField = class {
|
|
|
2302
3335
|
}
|
|
2303
3336
|
render() {
|
|
2304
3337
|
const hasError = !!this.error;
|
|
2305
|
-
return (h(Host, { key: '
|
|
3338
|
+
return (h(Host, { key: 'f00f81944748f8f09e22d44befe5e288456b7cc8' }, h("div", { key: '7b0ae9cf5b6b684cddb648fe4db6005494322535', class: "mrd-longtext-field" }, this.label && (h("label", { key: '3fc6a8710d0e98fe685c45d214a88ae1b0947973', 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: 'e96f1dbc6c00a1602f4ce3c97d514a229aeb7cb7', class: "mrd-longtext-field__error" }, this.error))));
|
|
2306
3339
|
}
|
|
2307
3340
|
};
|
|
2308
3341
|
MrdLongtextField.style = mrdLongtextFieldScss();
|
|
@@ -2378,7 +3411,7 @@ const MrdNumberField = class {
|
|
|
2378
3411
|
const hasError = !!this.error;
|
|
2379
3412
|
const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
|
|
2380
3413
|
this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
|
|
2381
|
-
return (h(Host, { key: '
|
|
3414
|
+
return (h(Host, { key: 'b034a3cc8d841641c0ec167e138904586b044121' }, h("div", { key: '7379bfadb8bd0c4e0a945a37013053a4e22477ab', class: "mrd-number-field" }, this.label && (h("label", { key: '5518d40b7158e17704633c2b95ac7e3efc0c5568', class: `mrd-number-field__label${this.required ? ' mrd-number-field__label--required' : ''}` }, this.label)), h("div", { key: '38ad9f3c945d66c23bd77c743306e916eaefed7f', class: "mrd-number-field__input-wrapper" }, h("input", { key: 'ac8b4bc1ea4431cc9306664522ebfda21760ae83', 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: '09f5a58b769c81acdf4bdd48f9325934c4bb875d', class: "mrd-number-field__error" }, this.error))));
|
|
2382
3415
|
}
|
|
2383
3416
|
};
|
|
2384
3417
|
MrdNumberField.style = mrdNumberFieldScss();
|
|
@@ -2672,9 +3705,9 @@ const MrdSecretField = class {
|
|
|
2672
3705
|
}
|
|
2673
3706
|
render() {
|
|
2674
3707
|
const hasError = !!this.error;
|
|
2675
|
-
return (h(Host, { key: '
|
|
3708
|
+
return (h(Host, { key: 'c850ec5bc5967ca0aefca7d7cb65ecae121a9dc1' }, h("div", { key: '3249ffbc441422af054a20806dd8dfce954a8ffc', class: "mrd-secret-field" }, this.label && (h("label", { key: '0b4a86da9cafad32f153af1bc5487a4e9b941e2f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
|
|
2676
3709
|
? (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: '
|
|
3710
|
+
: (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: 'b0d0105f3d43d2e214f070b24e745dbce0e33977', class: "mrd-secret-field__error" }, this.error))));
|
|
2678
3711
|
}
|
|
2679
3712
|
};
|
|
2680
3713
|
MrdSecretField.style = mrdSecretFieldScss();
|
|
@@ -3821,7 +4854,7 @@ const MrdTextField = class {
|
|
|
3821
4854
|
}
|
|
3822
4855
|
render() {
|
|
3823
4856
|
const hasError = !!this.error;
|
|
3824
|
-
return (h(Host, { key: '
|
|
4857
|
+
return (h(Host, { key: 'e9252b251faf98ab190e643b97c13fa32d12ef22' }, h("div", { key: '37f4259a111c293f2fe12f321f08c00c25e77feb', class: "mrd-text-field" }, this.label && (h("label", { key: 'c59e0346fb71a765ea38629b03c06341567ed210', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'dc09953a672472348719f29904d900966d945843', 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: '037653857a372854a16b28ebf8994b23e3e0d696', class: "mrd-text-field__error" }, this.error))));
|
|
3825
4858
|
}
|
|
3826
4859
|
};
|
|
3827
4860
|
MrdTextField.style = mrdTextFieldScss();
|
|
@@ -3895,7 +4928,7 @@ const MrdTextareaField = class {
|
|
|
3895
4928
|
}
|
|
3896
4929
|
}
|
|
3897
4930
|
render() {
|
|
3898
|
-
return (h(Host, { key: '
|
|
4931
|
+
return (h(Host, { key: 'fe7824c81e082c3f2c1cf18c11dde20cb1f40f2c' }, h("div", { key: 'adf394a7e146d16bc79006873a209b11d88b2e17', class: "mrd-textarea-field" }, this.label && (h("label", { key: '1b0dd2b4cf26c55a0af05c67a3178edc0c9d56c4', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: '7c8fe88b222af0beed08db492aa9f6d890e0dc5b', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: '295968283e94812cb04660117c5bdeaf3647469c', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: '5b5ab61053ab0792d4c249de04bd1d13b51469bf', class: "mrd-textarea-field__error" }, this.error))));
|
|
3899
4932
|
}
|
|
3900
4933
|
get el() { return getElement(this); }
|
|
3901
4934
|
};
|
|
@@ -3932,9 +4965,9 @@ const MrdTimeField = class {
|
|
|
3932
4965
|
}
|
|
3933
4966
|
render() {
|
|
3934
4967
|
const hasError = !!this.error;
|
|
3935
|
-
return (h(Host, { key: '
|
|
4968
|
+
return (h(Host, { key: '579219a478e31325b5a676465807c1d936724a2b' }, h("div", { key: '51b25f6e083a29989505c0ad79edbcd3b0060736', class: "mrd-time-field" }, this.label && (h("label", { key: '67d98bebb8803deea2d2a4a63f36706789ccd8c7', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), h("input", { key: '734741e0db1bdd5886fef37bba3b2f8d7200a0ab', 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: '0dbd168d14966dc56a77c97cd8fd8f9b208a4bf5', class: "mrd-time-field__error" }, this.error))));
|
|
3936
4969
|
}
|
|
3937
4970
|
};
|
|
3938
4971
|
MrdTimeField.style = mrdTimeFieldScss();
|
|
3939
4972
|
|
|
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 };
|
|
4973
|
+
export { MrdBooleanField as mrd_boolean_field, MrdCurrencyField as mrd_currency_field, MrdDateField as mrd_date_field, MrdDatetimeField as mrd_datetime_field, MrdDocumentContainer as mrd_document_container, 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 };
|