@mmlogic/components 0.4.3 → 0.5.1
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/client-layout-RZ3Ix-4a.js +87 -0
- package/dist/cjs/{index-CAzwGt9u.js → index-DzRfoAPz.js} +36 -9
- package/dist/cjs/index.cjs.js +56 -81
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mosterdcomponents.cjs.js +3 -3
- package/dist/cjs/{mrd-boolean-field_24.cjs.entry.js → mrd-boolean-field_23.cjs.entry.js} +159 -286
- package/dist/collection/collection-manifest.json +1 -2
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.css +0 -17
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +12 -4
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.css +9 -43
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +14 -6
- package/dist/collection/components/documents/mrd-document-view/mrd-document-view.css +30 -68
- package/dist/collection/components/documents/mrd-document-view/mrd-document-view.js +49 -90
- package/dist/collection/components/fields/mrd-boolean-field/mrd-boolean-field.css +0 -10
- package/dist/collection/components/fields/mrd-currency-field/mrd-currency-field.css +0 -7
- package/dist/collection/components/fields/mrd-file-field/mrd-file-field.css +0 -11
- package/dist/collection/components/fields/mrd-hyperlink-field/mrd-hyperlink-field.css +0 -3
- package/dist/collection/components/fields/mrd-image-field/mrd-image-field.css +6 -20
- package/dist/collection/components/fields/mrd-list-field/mrd-list-field.css +0 -4
- package/dist/collection/components/fields/mrd-longtext-field/mrd-longtext-field.css +0 -1
- package/dist/collection/components/fields/mrd-relation-field/mrd-relation-field.css +9 -35
- package/dist/collection/components/fields/mrd-textarea-field/mrd-textarea-field.css +0 -9
- package/dist/collection/components/form/mrd-field/mrd-field.css +0 -13
- package/dist/collection/components/form/mrd-form/mrd-form.css +0 -19
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +3 -58
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +25 -66
- package/dist/collection/components/table/mrd-table/mrd-table.css +38 -185
- package/dist/collection/components/table/mrd-table/mrd-table.js +3 -5
- package/dist/collection/components/table/mrd-table/table-parts.js +2 -5
- package/dist/collection/dev/app.js +76 -40
- package/dist/collection/dev/example-data.js +2 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/document-attachments.js +20 -0
- package/dist/collection/{components/documents/mrd-file-preview → utils}/file-preview-kind.js +4 -4
- package/dist/collection/utils/i18n.js +0 -32
- package/dist/components/document-attachments.js +1 -0
- package/dist/components/field-helpers.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-document-container2.js +1 -1
- package/dist/components/mrd-document-list2.js +1 -1
- package/dist/components/mrd-document-view2.js +1 -1
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-hyperlink-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-number-field2.js +1 -1
- package/dist/components/mrd-relation-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/client-layout-DCOAAH92.js +84 -0
- package/dist/esm/{index-DiSEJMA8.js → index-DiSe6vjv.js} +36 -9
- package/dist/esm/index.js +30 -80
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mosterdcomponents.js +4 -4
- package/dist/esm/{mrd-boolean-field_24.entry.js → mrd-boolean-field_23.entry.js} +69 -195
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.css +7 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-DCOAAH92.js +1 -0
- package/dist/mosterdcomponents/p-DiSe6vjv.js +2 -0
- package/dist/mosterdcomponents/p-cdecc698.entry.js +1 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +4 -2
- package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +6 -2
- package/dist/types/components/documents/mrd-document-view/mrd-document-view.d.ts +27 -29
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +12 -15
- package/dist/types/components.d.ts +61 -195
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/types/client-layout.d.ts +10 -3
- package/dist/types/utils/document-attachments.d.ts +8 -0
- package/dist/types/utils/file-preview-kind.d.ts +9 -0
- package/package.json +10 -12
- package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.css +0 -59
- package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.js +0 -212
- package/dist/components/mrd-file-preview.d.ts +0 -11
- package/dist/components/mrd-file-preview.js +0 -1
- package/dist/components/mrd-file-preview2.js +0 -1
- package/dist/mosterdcomponents/p-DiSEJMA8.js +0 -2
- package/dist/mosterdcomponents/p-e816d459.entry.js +0 -1
- package/dist/types/components/documents/mrd-file-preview/file-preview-kind.d.ts +0 -9
- package/dist/types/components/documents/mrd-file-preview/mrd-file-preview.d.ts +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as r,HTMLElement as e,createEvent as i,h as t,Host as o,transformTag as l}from"@stencil/core/internal/client";import{t as a}from"./i18n.js";import{c as d,d as s}from"./client-layout.js";import{r as n,F as m,c as h,a as c}from"./field-helpers.js";const f=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=i(this,"mrdChange",7),this.mrdBlur=i(this,"mrdBlur",7),this.mrdSearch=i(this,"mrdSearch",7),this.mrdFetchAll=i(this,"mrdFetchAll",7),this.name="",this.label="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.relatedClass="",this.mostSignificantClass="",this.displayType=d.SEARCH,this.multiple=!1,this.dropdownValues=[],this.value=null,this.searchQuery="",this.searchResults=[],this.allRecords=[],this.isLoading=!1,this.selectedItems=[],this.showResults=!1,this.error="",this.highlightedIndex=-1,this.searchDebounce=null,this.handleKeyDown=r=>{this.showResults&&0!==this.searchResults.length?"ArrowDown"===r.key?(r.preventDefault(),this.highlightedIndex=Math.min(this.highlightedIndex+1,this.searchResults.length-1)):"ArrowUp"===r.key?(r.preventDefault(),this.highlightedIndex=Math.max(this.highlightedIndex-1,0)):"Enter"===r.key?(r.preventDefault(),this.highlightedIndex>=0&&this.handleResultSelect(this.searchResults[this.highlightedIndex])):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1)},this.clearSelection=()=>{this.selectedItems=[],this.searchQuery="",this.searchResults=[],this.showResults=!1,this.highlightedIndex=-1,this.mrdChange.emit({name:this.name,value:this.multiple?[]:null})},this.handleSearchInput=r=>{const e=r.target.value;this.searchQuery=e,this.searchDebounce&&clearTimeout(this.searchDebounce),e.trim().length>=2?(this.isLoading=!0,this.showResults=!0,this.searchDebounce=setTimeout((()=>{this.mrdSearch.emit({name:this.name,query:e,relatedClass:this.mostSignificantClass})}),300)):(this.searchResults=[],this.showResults=!1,this.isLoading=!1)},this.handleResultSelect=r=>{if(this.multiple){this.selectedItems.find((e=>e.id===r.id))||(this.selectedItems=[...this.selectedItems,r]),this.searchQuery="",this.searchResults=[],this.showResults=!1;const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:e})}else this.selectedItems=[r],this.searchQuery=r.label,this.showResults=!1,this.mrdChange.emit({name:this.name,value:r.id});this.error=n(this.selectedItems,this.required,this.locale)},this.handleRemoveSelected=r=>{this.selectedItems=this.selectedItems.filter((e=>e.id!==r));const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:this.multiple?e:null})},this.handleDropdownChange=r=>{const e=r.target.value;this.error=n(e,this.required,this.locale),this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=()=>{var r,e;setTimeout((()=>{this.showResults=!1,this.highlightedIndex=-1}),200);const i=this.multiple?this.selectedItems.map((r=>r.id)):null!==(e=null===(r=this.selectedItems[0])||void 0===r?void 0:r.id)&&void 0!==e?e:null;this.mrdBlur.emit({name:this.name,value:i})}}async setAllRecords(r){this.allRecords=r}getValueHref(){var r,e,i;const t=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return t?"object"==typeof t?null!==(i=t.id)&&void 0!==i?i:"":t:""}allRecordsChanged(){if(this.editBehavior!==s.DROPDOWN)return;const r=this.getValueHref();r&&setTimeout((()=>{var e;const i=null===(e=this.el)||void 0===e?void 0:e.querySelector("select");i&&(i.value=r)}),0)}async setSearchResults(r){this.searchResults=r,this.isLoading=!1,this.showResults=!0,this.highlightedIndex=-1}async setLoading(r){this.isLoading=r}toSearchResult(r){var e,i,t,o;return{id:null!==(i=null!==(e=r.id)&&void 0!==e?e:r.href)&&void 0!==i?i:"",label:null!==(o=null!==(t=r.label)&&void 0!==t?t:r.name)&&void 0!==o?o:"",description:r.description}}applyValuePrefill(r){if(r)if(Array.isArray(r))r.length>0&&"object"==typeof r[0]&&(this.selectedItems=r.map((r=>this.toSearchResult(r))),this.searchQuery="");else if("object"==typeof r){const e=r;if(Array.isArray(e.values))this.selectedItems=e.values.map((r=>this.toSearchResult(r))),this.searchQuery="";else if(!this.multiple&&(e.id||e.name||e.label)){const r=this.toSearchResult(e);this.selectedItems=[r],this.searchQuery=r.label}}}componentWillLoad(){this.applyValuePrefill(this.value)}valueChanged(r){this.applyValuePrefill(r)}componentDidLoad(){this.editBehavior!==s.DROPDOWN||this.commonRelation||setTimeout((()=>{this.mrdFetchAll.emit({name:this.name,relatedClass:this.relatedClass,mostSignificantClass:this.mostSignificantClass||void 0})}),0)}render(){var r,e;const i=!!this.error;if(this.editBehavior===s.DROPDOWN){const r=this.getValueHref();return t(o,null,t("div",{class:"mrd-relation-field"},t(m,{base:"mrd-relation-field",label:this.label,required:this.required}),t("select",{class:h("mrd-relation-field",i,"select"),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},t("option",{value:""},a("select_placeholder",this.locale)),this.allRecords.map((e=>t("option",{key:e.id,value:e.id,selected:e.id===r},e.label)))),t(c,{base:"mrd-relation-field",error:this.error})))}if(this.displayType===d.DROPDOWN){const l=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return t(o,null,t("div",{class:"mrd-relation-field"},t(m,{base:"mrd-relation-field",label:this.label,required:this.required}),t("select",{class:h("mrd-relation-field",i,"select"),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},t("option",{value:""},a("select_placeholder",this.locale)),this.dropdownValues.map((r=>t("option",{key:r.key,value:r.key,selected:r.key===l},r.label)))),t(c,{base:"mrd-relation-field",error:this.error})))}const l=t(m,{base:"mrd-relation-field",label:this.label,required:this.required});return t(o,null,!this.multiple&&this.selectedItems.length>0?t("div",{class:"mrd-relation-field"},l,t("div",{class:"mrd-relation-field__selected-value"+(i?" mrd-relation-field__selected-value--error":"")},t("span",{class:"mrd-relation-field__selected-name"},this.selectedItems[0].label),t("button",{type:"button",class:"mrd-relation-field__selected-clear",onClick:this.clearSelection,"aria-label":a("remove",this.locale)},"✕")),t(c,{base:"mrd-relation-field",error:this.error})):t("div",{class:"mrd-relation-field"},l,this.multiple&&this.selectedItems.length>0&&t("div",{class:"mrd-relation-field__tags"},this.selectedItems.map((r=>t("span",{key:r.id,class:"mrd-relation-field__tag"},r.label,t("button",{type:"button",class:"mrd-relation-field__tag-remove",onClick:()=>this.handleRemoveSelected(r.id),"aria-label":a("remove",this.locale)},"✕"))))),t("div",{class:"mrd-relation-field__search-wrapper"},t("input",{class:"mrd-relation-field__search"+(i?" mrd-relation-field__search--error":""),type:"text",value:this.searchQuery,placeholder:a("search_placeholder",this.locale),disabled:this.disabled,onInput:this.handleSearchInput,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur}),this.isLoading&&t("span",{class:"mrd-relation-field__spinner","aria-label":a("loading",this.locale)})),this.showResults&&t("div",{class:"mrd-relation-field__results"},0!==this.searchResults.length||this.isLoading?this.searchResults.map(((r,e)=>t("div",{key:r.id,class:"mrd-relation-field__result-item"+(e===this.highlightedIndex?" mrd-relation-field__result-item--highlighted":""),onMouseDown:()=>this.handleResultSelect(r)},t("span",{class:"mrd-relation-field__result-label"},r.label),r.description&&t("span",{class:"mrd-relation-field__result-desc"},r.description)))):t("div",{class:"mrd-relation-field__no-results"},a("no_results",this.locale))),t(c,{base:"mrd-relation-field",error:this.error})))}get el(){return this}static get watchers(){return{allRecords:[{allRecordsChanged:0}],value:[{valueChanged:0}]}}static get style(){return".sc-mrd-relation-field-h{display:block}.mrd-relation-field.sc-mrd-relation-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%;position:relative}.mrd-relation-field__label.sc-mrd-relation-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-relation-field__label--required.sc-mrd-relation-field::after{content:\" *\";color:var(--mrd-color-danger)}.mrd-relation-field__select.sc-mrd-relation-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);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-relation-field__select.sc-mrd-relation-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-relation-field__select.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__select.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__select--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__select--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__select.sc-mrd-relation-field{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right var(--mrd-space-3) center;padding-right:calc(var(--mrd-input-padding-x) + 1.5rem);cursor:pointer}.mrd-relation-field__search.sc-mrd-relation-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition);outline:none;appearance:none;box-sizing:border-box}.mrd-relation-field__search.sc-mrd-relation-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-relation-field__search.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__search.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__search--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__search--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__error.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}.mrd-relation-field__tags.sc-mrd-relation-field{display:flex;flex-wrap:wrap;gap:var(--mrd-space-1);margin-bottom:var(--mrd-space-1)}.mrd-relation-field__tag.sc-mrd-relation-field{display:inline-flex;align-items:center;gap:var(--mrd-space-1);padding:var(--mrd-space-1) var(--mrd-space-2);background-color:var(--mrd-color-primary-light);color:var(--mrd-color-primary-dark);border-radius:var(--mrd-border-radius-full);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__tag-remove.sc-mrd-relation-field{background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-xs);padding:0;line-height:1;opacity:0.7}.mrd-relation-field__tag-remove.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__search-wrapper.sc-mrd-relation-field{position:relative;display:flex;align-items:center}.mrd-relation-field__spinner.sc-mrd-relation-field{position:absolute;right:var(--mrd-space-3);width:16px;height:16px;border:2px solid var(--mrd-color-neutral-200);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-spin 0.7s linear infinite}@keyframes mrd-spin{to{transform:rotate(360deg)}}.mrd-relation-field__results.sc-mrd-relation-field{position:absolute;top:calc(100% + var(--mrd-space-1));left:0;right:0;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md);z-index:var(--mrd-z-dropdown);max-height:240px;overflow-y:auto}.mrd-relation-field__result-item.sc-mrd-relation-field{display:flex;flex-direction:column;padding:var(--mrd-space-2) var(--mrd-space-3);cursor:pointer;transition:background-color var(--mrd-transition-fast)}.mrd-relation-field__result-item.sc-mrd-relation-field:hover{background-color:var(--mrd-color-neutral-50)}.mrd-relation-field__result-item.sc-mrd-relation-field:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.mrd-relation-field__result-label.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__result-desc.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-relation-field__result-item--highlighted.sc-mrd-relation-field{background-color:var(--mrd-color-primary-light)}.mrd-relation-field__selected-value.sc-mrd-relation-field{display:flex;align-items:center;gap:var(--mrd-space-2);height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);background-color:var(--mrd-color-primary-light);border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius);box-sizing:border-box}.mrd-relation-field__selected-value--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error);background-color:var(--mrd-color-danger-light)}.mrd-relation-field__selected-name.sc-mrd-relation-field{flex:1;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary-dark);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-relation-field__selected-clear.sc-mrd-relation-field{flex-shrink:0;background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-sm);padding:0;line-height:1;opacity:0.6;transition:opacity var(--mrd-transition-fast)}.mrd-relation-field__selected-clear.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__no-results.sc-mrd-relation-field{padding:var(--mrd-space-4);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);text-align:center}"}},[2,"mrd-relation-field",{name:[1],label:[1],required:[4],disabled:[4],locale:[1],relatedClass:[1,"related-class"],mostSignificantClass:[1,"most-significant-class"],displayType:[1,"display-type"],editBehavior:[1,"edit-behavior"],commonRelation:[1,"common-relation"],multiple:[4],dropdownValues:[16],value:[1],searchQuery:[32],searchResults:[32],allRecords:[32],isLoading:[32],selectedItems:[32],showResults:[32],error:[32],highlightedIndex:[32],setAllRecords:[64],setSearchResults:[64],setLoading:[64]},void 0,{allRecords:[{allRecordsChanged:0}],value:[{valueChanged:0}]}]);function u(){"undefined"!=typeof customElements&&["mrd-relation-field"].forEach((r=>{"mrd-relation-field"===r&&(customElements.get(l(r))||customElements.define(l(r),f))}))}export{f as M,u as d}
|
|
1
|
+
import{proxyCustomElement as r,HTMLElement as e,createEvent as i,h as t,Host as o,transformTag as l}from"@stencil/core/internal/client";import{t as a}from"./i18n.js";import{c as d,d as s}from"./client-layout.js";import{r as n,F as m,c as h,a as c}from"./field-helpers.js";const f=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=i(this,"mrdChange",7),this.mrdBlur=i(this,"mrdBlur",7),this.mrdSearch=i(this,"mrdSearch",7),this.mrdFetchAll=i(this,"mrdFetchAll",7),this.name="",this.label="",this.required=!1,this.disabled=!1,this.locale=navigator.language,this.relatedClass="",this.mostSignificantClass="",this.displayType=d.SEARCH,this.multiple=!1,this.dropdownValues=[],this.value=null,this.searchQuery="",this.searchResults=[],this.allRecords=[],this.isLoading=!1,this.selectedItems=[],this.showResults=!1,this.error="",this.highlightedIndex=-1,this.searchDebounce=null,this.handleKeyDown=r=>{this.showResults&&0!==this.searchResults.length?"ArrowDown"===r.key?(r.preventDefault(),this.highlightedIndex=Math.min(this.highlightedIndex+1,this.searchResults.length-1)):"ArrowUp"===r.key?(r.preventDefault(),this.highlightedIndex=Math.max(this.highlightedIndex-1,0)):"Enter"===r.key?(r.preventDefault(),this.highlightedIndex>=0&&this.handleResultSelect(this.searchResults[this.highlightedIndex])):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1):"Escape"===r.key&&(this.showResults=!1,this.highlightedIndex=-1)},this.clearSelection=()=>{this.selectedItems=[],this.searchQuery="",this.searchResults=[],this.showResults=!1,this.highlightedIndex=-1,this.mrdChange.emit({name:this.name,value:this.multiple?[]:null})},this.handleSearchInput=r=>{const e=r.target.value;this.searchQuery=e,this.searchDebounce&&clearTimeout(this.searchDebounce),e.trim().length>=2?(this.isLoading=!0,this.showResults=!0,this.searchDebounce=setTimeout((()=>{this.mrdSearch.emit({name:this.name,query:e,relatedClass:this.mostSignificantClass})}),300)):(this.searchResults=[],this.showResults=!1,this.isLoading=!1)},this.handleResultSelect=r=>{if(this.multiple){this.selectedItems.find((e=>e.id===r.id))||(this.selectedItems=[...this.selectedItems,r]),this.searchQuery="",this.searchResults=[],this.showResults=!1;const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:e})}else this.selectedItems=[r],this.searchQuery=r.label,this.showResults=!1,this.mrdChange.emit({name:this.name,value:r.id});this.error=n(this.selectedItems,this.required,this.locale)},this.handleRemoveSelected=r=>{this.selectedItems=this.selectedItems.filter((e=>e.id!==r));const e=this.selectedItems.map((r=>r.id));this.mrdChange.emit({name:this.name,value:this.multiple?e:null})},this.handleDropdownChange=r=>{const e=r.target.value;this.error=n(e,this.required,this.locale),this.mrdChange.emit({name:this.name,value:e})},this.handleBlur=()=>{var r,e;setTimeout((()=>{this.showResults=!1,this.highlightedIndex=-1}),200);const i=this.multiple?this.selectedItems.map((r=>r.id)):null!==(e=null===(r=this.selectedItems[0])||void 0===r?void 0:r.id)&&void 0!==e?e:null;this.mrdBlur.emit({name:this.name,value:i})}}async setAllRecords(r){this.allRecords=r}getValueHref(){var r,e,i;const t=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return t?"object"==typeof t?null!==(i=t.id)&&void 0!==i?i:"":t:""}allRecordsChanged(){if(this.editBehavior!==s.DROPDOWN)return;const r=this.getValueHref();r&&setTimeout((()=>{var e;const i=null===(e=this.el)||void 0===e?void 0:e.querySelector("select");i&&(i.value=r)}),0)}async setSearchResults(r){this.searchResults=r,this.isLoading=!1,this.showResults=!0,this.highlightedIndex=-1}async setLoading(r){this.isLoading=r}toSearchResult(r){var e,i,t,o;return{id:null!==(i=null!==(e=r.id)&&void 0!==e?e:r.href)&&void 0!==i?i:"",label:null!==(o=null!==(t=r.label)&&void 0!==t?t:r.name)&&void 0!==o?o:"",description:r.description}}applyValuePrefill(r){if(r)if(Array.isArray(r))r.length>0&&"object"==typeof r[0]&&(this.selectedItems=r.map((r=>this.toSearchResult(r))),this.searchQuery="");else if("object"==typeof r){const e=r;if(Array.isArray(e.values))this.selectedItems=e.values.map((r=>this.toSearchResult(r))),this.searchQuery="";else if(!this.multiple&&(e.id||e.name||e.label)){const r=this.toSearchResult(e);this.selectedItems=[r],this.searchQuery=r.label}}}componentWillLoad(){this.applyValuePrefill(this.value)}valueChanged(r){this.applyValuePrefill(r)}componentDidLoad(){this.editBehavior!==s.DROPDOWN||this.commonRelation||setTimeout((()=>{this.mrdFetchAll.emit({name:this.name,relatedClass:this.relatedClass,mostSignificantClass:this.mostSignificantClass||void 0})}),0)}render(){var r,e;const i=!!this.error;if(this.editBehavior===s.DROPDOWN){const r=this.getValueHref();return t(o,null,t("div",{class:"mrd-relation-field"},t(m,{base:"mrd-relation-field",label:this.label,required:this.required}),t("select",{class:h("mrd-relation-field",i,"select"),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},t("option",{value:""},a("select_placeholder",this.locale)),this.allRecords.map((e=>t("option",{key:e.id,value:e.id,selected:e.id===r},e.label)))),t(c,{base:"mrd-relation-field",error:this.error})))}if(this.displayType===d.DROPDOWN){const l=Array.isArray(this.value)?null!==(r=this.value[0])&&void 0!==r?r:"":null!==(e=this.value)&&void 0!==e?e:"";return t(o,null,t("div",{class:"mrd-relation-field"},t(m,{base:"mrd-relation-field",label:this.label,required:this.required}),t("select",{class:h("mrd-relation-field",i,"select"),name:this.name,required:this.required,disabled:this.disabled,onChange:this.handleDropdownChange},t("option",{value:""},a("select_placeholder",this.locale)),this.dropdownValues.map((r=>t("option",{key:r.key,value:r.key,selected:r.key===l},r.label)))),t(c,{base:"mrd-relation-field",error:this.error})))}const l=t(m,{base:"mrd-relation-field",label:this.label,required:this.required});return t(o,null,!this.multiple&&this.selectedItems.length>0?t("div",{class:"mrd-relation-field"},l,t("div",{class:"mrd-relation-field__selected-value"+(i?" mrd-relation-field__selected-value--error":"")},t("span",{class:"mrd-relation-field__selected-name"},this.selectedItems[0].label),t("button",{type:"button",class:"mrd-relation-field__selected-clear",onClick:this.clearSelection,"aria-label":a("remove",this.locale)},"✕")),t(c,{base:"mrd-relation-field",error:this.error})):t("div",{class:"mrd-relation-field"},l,this.multiple&&this.selectedItems.length>0&&t("div",{class:"mrd-relation-field__tags"},this.selectedItems.map((r=>t("span",{key:r.id,class:"mrd-relation-field__tag"},r.label,t("button",{type:"button",class:"mrd-relation-field__tag-remove",onClick:()=>this.handleRemoveSelected(r.id),"aria-label":a("remove",this.locale)},"✕"))))),t("div",{class:"mrd-relation-field__search-wrapper"},t("input",{class:"mrd-relation-field__search"+(i?" mrd-relation-field__search--error":""),type:"text",value:this.searchQuery,placeholder:a("search_placeholder",this.locale),disabled:this.disabled,onInput:this.handleSearchInput,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur}),this.isLoading&&t("span",{class:"mrd-relation-field__spinner","aria-label":a("loading",this.locale)})),this.showResults&&t("div",{class:"mrd-relation-field__results"},0!==this.searchResults.length||this.isLoading?this.searchResults.map(((r,e)=>t("div",{key:r.id,class:"mrd-relation-field__result-item"+(e===this.highlightedIndex?" mrd-relation-field__result-item--highlighted":""),onMouseDown:()=>this.handleResultSelect(r)},t("span",{class:"mrd-relation-field__result-label"},r.label),r.description&&t("span",{class:"mrd-relation-field__result-desc"},r.description)))):t("div",{class:"mrd-relation-field__no-results"},a("no_results",this.locale))),t(c,{base:"mrd-relation-field",error:this.error})))}get el(){return this}static get watchers(){return{allRecords:[{allRecordsChanged:0}],value:[{valueChanged:0}]}}static get style(){return".sc-mrd-relation-field-h{display:block}.mrd-relation-field.sc-mrd-relation-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%;position:relative}.mrd-relation-field__label.sc-mrd-relation-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-relation-field__label--required.sc-mrd-relation-field::after{content:\" *\";color:var(--mrd-color-danger)}.mrd-relation-field__select.sc-mrd-relation-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);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-relation-field__select.sc-mrd-relation-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-relation-field__select.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__select.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__select--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__select--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__select.sc-mrd-relation-field{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right var(--mrd-space-3) center;padding-right:calc(var(--mrd-input-padding-x) + 1.5rem);cursor:pointer}.mrd-relation-field__search.sc-mrd-relation-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition);outline:none;appearance:none;box-sizing:border-box}.mrd-relation-field__search.sc-mrd-relation-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-relation-field__search.sc-mrd-relation-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-relation-field__search.sc-mrd-relation-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-relation-field__search--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error)}.mrd-relation-field__search--error.sc-mrd-relation-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-relation-field__error.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}.mrd-relation-field__tags.sc-mrd-relation-field{display:flex;flex-wrap:wrap;gap:var(--mrd-space-1);margin-bottom:var(--mrd-space-1)}.mrd-relation-field__tag.sc-mrd-relation-field{display:inline-flex;align-items:center;gap:var(--mrd-space-1);padding:var(--mrd-space-1) var(--mrd-space-2);background-color:var(--mrd-color-primary-light);color:var(--mrd-color-primary-dark);border-radius:var(--mrd-border-radius-full);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__tag-remove.sc-mrd-relation-field{background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-xs);padding:0;line-height:1;opacity:0.7}.mrd-relation-field__tag-remove.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__search-wrapper.sc-mrd-relation-field{position:relative;display:flex;align-items:center}.mrd-relation-field__spinner.sc-mrd-relation-field{position:absolute;right:var(--mrd-space-3);width:16px;height:16px;border:2px solid var(--mrd-color-neutral-200);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-spin 0.7s linear infinite}.mrd-relation-field__results.sc-mrd-relation-field{position:absolute;top:calc(100% + var(--mrd-space-1));left:0;right:0;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md);z-index:var(--mrd-z-dropdown);max-height:240px;overflow-y:auto}.mrd-relation-field__result-item.sc-mrd-relation-field{display:flex;flex-direction:column;padding:var(--mrd-space-2) var(--mrd-space-3);cursor:pointer;transition:background-color var(--mrd-transition-fast)}.mrd-relation-field__result-item.sc-mrd-relation-field:hover{background-color:var(--mrd-color-neutral-50)}.mrd-relation-field__result-item.sc-mrd-relation-field:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.mrd-relation-field__result-item--highlighted.sc-mrd-relation-field{background-color:var(--mrd-color-primary-light)}.mrd-relation-field__result-label.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800);font-weight:var(--mrd-font-weight-medium)}.mrd-relation-field__result-desc.sc-mrd-relation-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-relation-field__selected-value.sc-mrd-relation-field{display:flex;align-items:center;gap:var(--mrd-space-2);height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);background-color:var(--mrd-color-primary-light);border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius);box-sizing:border-box}.mrd-relation-field__selected-value--error.sc-mrd-relation-field{border-color:var(--mrd-border-color-error);background-color:var(--mrd-color-danger-light)}.mrd-relation-field__selected-name.sc-mrd-relation-field{flex:1;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary-dark);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-relation-field__selected-clear.sc-mrd-relation-field{flex-shrink:0;background:none;border:none;cursor:pointer;color:var(--mrd-color-primary-dark);font-size:var(--mrd-font-size-sm);padding:0;line-height:1;opacity:0.6;transition:opacity var(--mrd-transition-fast)}.mrd-relation-field__selected-clear.sc-mrd-relation-field:hover{opacity:1}.mrd-relation-field__no-results.sc-mrd-relation-field{padding:var(--mrd-space-4);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);text-align:center}@keyframes mrd-spin{to{transform:rotate(360deg)}}"}},[2,"mrd-relation-field",{name:[1],label:[1],required:[4],disabled:[4],locale:[1],relatedClass:[1,"related-class"],mostSignificantClass:[1,"most-significant-class"],displayType:[1,"display-type"],editBehavior:[1,"edit-behavior"],commonRelation:[1,"common-relation"],multiple:[4],dropdownValues:[16],value:[1],searchQuery:[32],searchResults:[32],allRecords:[32],isLoading:[32],selectedItems:[32],showResults:[32],error:[32],highlightedIndex:[32],setAllRecords:[64],setSearchResults:[64],setLoading:[64]},void 0,{allRecords:[{allRecordsChanged:0}],value:[{valueChanged:0}]}]);function u(){"undefined"!=typeof customElements&&["mrd-relation-field"].forEach((r=>{"mrd-relation-field"===r&&(customElements.get(l(r))||customElements.define(l(r),f))}))}export{f as M,u as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,proxyCustomElement as r,HTMLElement as e,createEvent as l,writeTask as i,Host as a,transformTag as o}from"@stencil/core/internal/client";import{t as s}from"./i18n.js";import{a as n,b as d}from"./query-params.js";import{b as c,c as m,f as b,d as h,a as u,e as p}from"./format.js";import{a as _}from"./client-layout.js";const v=new Set(["TEXT","TEXTBLOCK","EMAIL","HYPERLINK"]),f=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),g=new Set(["DATE","DATETIME","TIME"]),y=new Set(["FILE","IMAGE"]),w=new Set(["LONGTEXT","JSON","FILE","IMAGE"]);function k(t,r){var e,l,i;const a=new URLSearchParams(t);a.delete("page"),a.delete("sort");const o=function(t){var r;const e={sum:[],avg:[],count:[]};for(const l of t){if("FIELD"!==l.type||!l.aggregate)continue;const t=l.aggregate.toLowerCase();t in e&&e[t].push(null!==(r=l.name)&&void 0!==r?r:"")}const l={};return e.sum.length&&(l.sum=e.sum),e.avg.length&&(l.avg=e.avg),e.count.length&&(l.count=e.count),Object.keys(l).length>0?l:null}(r);return(null===(e=null==o?void 0:o.sum)||void 0===e?void 0:e.length)&&a.set("sum",o.sum.join(",")),(null===(l=null==o?void 0:o.avg)||void 0===l?void 0:l.length)&&a.set("avg",o.avg.join(",")),(null===(i=null==o?void 0:o.count)||void 0===i?void 0:i.length)&&a.set("count",o.count.join(",")),a.toString()}function x(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l).toISOString().replace(/\.\d{3}Z$/,"Z")}function E(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l+1).toISOString().replace(/\.\d{3}Z$/,"Z")}class C{static render(t,r,e){var l,i,a,o;if(t.type===_.RELATION){const e=null!==(l=t.name)&&void 0!==l?l:"",o=null===(i=null==r?void 0:r._links)||void 0===i?void 0:i[e];return o?Array.isArray(o)?o.map((t=>{var r;return null!==(r=t.name)&&void 0!==r?r:""})).filter(Boolean).join(", "):null!==(a=o.name)&&void 0!==a?a:"":""}if(t.type!==_.FIELD)return"";const s=null!==(o=t.name)&&void 0!==o?o:"",n=t.dataType,d=t.listItems,c=null==r?void 0:r[s];return null==c||""===c?"":(Array.isArray(c)?c:[c]).map((t=>C.renderValue(null!=n?n:"TEXT",t,null!=d?d:[],e))).filter((t=>""!==t)).join(", ")}static renderValue(t,r,e,l){var i,a;switch(t){case"INTEGER":return u(Number(r),l,{maximumFractionDigits:0});case"DECIMAL":return u(Number(r),l);case"PERCENTAGE":return p(Number(r),l);case"CURRENCY":{const{amount:t,currency:e}="object"==typeof r&&null!==r?r:{amount:r,currency:""};return e?h(Number(t),e,l):u(Number(t),l)}case"DATE":return b(r,l);case"DATETIME":return m(r,l);case"TIME":return c(r,l);case"BOOLEAN":return r?"✓":"";case"FILE":case"IMAGE":return"object"==typeof r&&null!==r&&null!==(i=r.fileName)&&void 0!==i?i:"";case"LIST":{const t=e.find((t=>t.key===String(r)));return null!==(a=null==t?void 0:t.label)&&void 0!==a?a:String(r)}case"TEXTBLOCK":{const t=String(r).replace(/<[^>]*>/g,""),e=document.createElement("textarea");return e.innerHTML=t,e.value.trim()}case"LONGTEXT":return String(r).replace(/[\r\n]+/g," ").trim();case"JSON":return("object"==typeof r?JSON.stringify(r):String(r)).replace(/[\r\n]+/g," ").trim();case"SECRET":return r?"••••••••":"";default:return String(r)}}static formatJson(t,r=!1){try{const e="string"==typeof t?JSON.parse(t):t;return(r?JSON.stringify(e):JSON.stringify(e,null,2)).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(t=>{let r="color:#2aa198";return/^"/.test(t)?r=/:$/.test(t)?"color:#881391":"color:#268bd2":/true|false/.test(t)?r="color:#b58900":/null/.test(t)&&(r="color:#dc322f"),`<span style="${r}">${t}</span>`}))}catch(r){return String(t)}}}const T=()=>t("span",{class:"mrd-table__filter-icon","aria-hidden":"true"},t("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},t("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}))),z=({col:r,row:e,locale:l,onDownload:i,onOpenTextblock:a,onOpenJson:o})=>{var n,d,c;const m=null!==(n=r.dataType)&&void 0!==n?n:"",b="FIELD"===r.type&&f.has(m);if("FIELD"===r.type&&("FILE"===m||"IMAGE"===m)){const a=null!==(d=r.name)&&void 0!==d?d:"",o=null==e?void 0:e[a],n=null==o?void 0:o.href,c=null==o?void 0:o.fileName;return t("td",{class:"mrd-table__cell"},n&&c?t("button",{class:"mrd-table__file-btn",title:c,onClick:t=>{t.stopPropagation(),i({href:n,fileName:c})}},t("svg",{class:"mrd-table__file-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z"})),s("download",l)):"")}if("JSON"===m){const i=null!==(c=r.name)&&void 0!==c?c:"",a=i?null==e?void 0:e[i]:void 0;if(null==a||""===a)return t("td",{class:"mrd-table__cell"});const n=C.formatJson(a,!0),d=C.formatJson(a,!1);return t("td",{class:"mrd-table__cell"},t("span",{class:"mrd-table__json-preview",innerHTML:n}),t("button",{class:"mrd-table__textblock-btn",onClick:t=>{t.stopPropagation(),o(d)},"aria-label":s("textblock_show_more",l)},"⋯"))}if("TEXTBLOCK"===m){const i=C.render(r,e,l);if(i.length<=200)return t("td",{class:"mrd-table__cell"},i);const o=i.slice(0,200)+"…";return t("td",{class:"mrd-table__cell"},o,t("button",{class:"mrd-table__textblock-btn",onClick:t=>{t.stopPropagation(),a(i)},"aria-label":s("textblock_show_more",l)},"⋯"))}const h=C.render(r,e,l);return t("td",{class:"mrd-table__cell"+(b?" mrd-table__cell--numeric":"")},h)},S=({columns:r,aggregations:e,locale:l})=>e&&r.some((t=>"FIELD"===t.type&&t.aggregate))?t("tfoot",null,t("tr",{class:"mrd-table__totals-row"},r.map((r=>{var i;const a=function(t,r,e){var l;if("FIELD"!==t.type||!t.aggregate||!r)return"";const i=r[t.aggregate.toLowerCase()],a="object"==typeof i&&null!==i?i[null!==(l=t.name)&&void 0!==l?l:""]:void 0;if(null==a)return"";const o=t.dataType;return"INTEGER"===o?u(a,e,{maximumFractionDigits:0}):"PERCENTAGE"===o?p(a,e):"CURRENCY"===o&&t.currencyCode?h(a,t.currencyCode,e):u(a,e)}(r,e,l),o="FIELD"===r.type&&f.has(null!==(i=r.dataType)&&void 0!==i?i:"");return t("td",{class:"mrd-table__totals-cell"+(o?" mrd-table__totals-cell--numeric":"")},a)})))):null,O=({text:r,locale:e,onClose:l})=>null===r?null:t("div",{class:"mrd-table__modal-backdrop",onClick:l,role:"dialog","aria-modal":"true"},t("div",{class:"mrd-table__modal",onClick:t=>t.stopPropagation()},t("button",{class:"mrd-table__modal-close",onClick:l,"aria-label":s("close",e)},"✕"),t("p",{class:"mrd-table__modal-text"},r))),M=({html:r,locale:e,onClose:l})=>null===r?null:t("div",{class:"mrd-table__modal-backdrop",onClick:l,role:"dialog","aria-modal":"true"},t("div",{class:"mrd-table__modal",onClick:t=>t.stopPropagation()},t("button",{class:"mrd-table__modal-close",onClick:l,"aria-label":s("close",e)},"✕"),t("pre",{class:"mrd-table__modal-json",innerHTML:r}))),N=({locale:r,filterMode:e,filterCount:l,actions:i,views:a,activeViewIdx:o,viewPopoverOpen:n,createPickerOpen:d,createTypes:c,cb:m})=>{var b;const h=i.length>0,u=a.length>1;return t("div",{class:"mrd-table__toolbar"},t("div",{class:"mrd-table__toolbar-left"},t("button",{class:"mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle"+(e?" mrd-table__filter-toggle--active":""),onClick:m.onFilterToggle},t("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})),l>0&&t("span",{class:"mrd-table__filter-badge"},l),t("span",{class:"mrd-table__action-tooltip"},s(e?"table_filter_hide":"table_filter",r),l>0?` (${l} ${s("table_filter_active",r)})`:"")),l>0&&t("button",{class:"mrd-table__action mrd-table__action--secondary",onClick:m.onClearAllFilters},t("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),t("span",{class:"mrd-table__action-tooltip"},s("table_filter_clear_all",r)))),u&&t("div",{class:"mrd-table__toolbar-center"},t("div",{class:"mrd-table__view-switcher"},t("button",{class:"mrd-table__view-arrow","aria-label":"Previous view",onClick:()=>m.onViewSwitch((o-1+a.length)%a.length)},"◀"),t("div",{class:"mrd-table__view-title-wrap"},t("button",{class:"mrd-table__view-title",onClick:t=>m.onToggleViewPopover(t)},null===(b=a[o])||void 0===b?void 0:b.label),n&&t("div",{class:"mrd-table__view-popover",onClick:t=>t.stopPropagation()},a.map(((r,e)=>t("button",{key:String(e),class:"mrd-table__view-popover-item"+(e===o?" mrd-table__view-popover-item--active":""),onClick:()=>{e!==o&&m.onViewSwitch(e),m.onCloseViewPopover()}},r.label))))),t("button",{class:"mrd-table__view-arrow","aria-label":"Next view",onClick:()=>m.onViewSwitch((o+1)%a.length)},"▶"))),h&&t("div",{class:"mrd-table__toolbar-right"},i.map((r=>{var e,l;const i="create"===r.action?c:null;return(null==i?void 0:i.length)?t("div",{class:"mrd-table__create-picker-wrap",key:`action-${r.action}`},t("button",{class:`mrd-table__action mrd-table__action--${null!==(e=r.variant)&&void 0!==e?e:"secondary"}`,onClick:m.onToggleCreatePicker},r.icon?t("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},t("use",{href:r.icon})):r.label,t("span",{class:"mrd-table__action-tooltip"},r.label)),d&&t("div",{class:"mrd-table__create-picker"},i.map((r=>t("button",{key:r.type,class:"mrd-table__create-picker-item",onClick:()=>m.onCreate(r.type)},r.label))))):t("button",{key:`action-${r.action}`,class:`mrd-table__action mrd-table__action--${null!==(l=r.variant)&&void 0!==l?l:"secondary"}`,disabled:r.disabled,onClick:()=>m.onAction(r.action)},r.icon?t("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},t("use",{href:r.icon})):r.label,t("span",{class:"mrd-table__action-tooltip"},r.label))}))))},j=({col:r,dataType:e,openFilterCol:l,pendingFilter:i,locale:a,cb:o})=>{var n,d,c,m,b,h;const u=i;if(y.has(e))return t("p",{class:"mrd-table__filter-no-support"},s("filter_no_support",a));if("BOOLEAN"===e){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r;return t("div",{class:"mrd-table__filter-radio-group"},[{labelKey:"filter_all",value:null},{labelKey:"yes",value:!0},{labelKey:"no",value:!1}].map((r=>t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:!e&&u.value===r.value,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:void 0,value:r.value}))}),s(r.labelKey,a)))),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:"isEmpty"===r,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:"isEmpty",value:void 0}))}),s("filter_is_empty",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:"isNotEmpty"===r,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:"isNotEmpty",value:void 0}))}),s("filter_is_not_empty",a)))}if("LIST"===e){const e=null!==(n=r.listItems)&&void 0!==n?n:[],l=null!==(d=u.values)&&void 0!==d?d:[];return t("div",{class:"mrd-table__filter-list"},t("div",{class:"mrd-table__filter-list-controls"},t("button",{class:"mrd-table__filter-list-btn",onClick:()=>o.onReplacePending(Object.assign(Object.assign({},u),{values:e.map((t=>t.key))}))},s("filter_select_all",a)),t("button",{class:"mrd-table__filter-list-btn",onClick:()=>o.onReplacePending(Object.assign(Object.assign({},u),{values:[]}))},s("filter_select_none",a))),e.map((r=>t("label",{class:"mrd-table__filter-checkbox-label"},t("input",{type:"checkbox",checked:l.includes(r.key),onChange:t=>o.onToggleValue(r.key,t.target.checked)}),r.label))))}if(v.has(e)||"RELATION"===e){const r=null!==(c=u.operator)&&void 0!==c?c:"startsWith",e="isEmpty"===r||"isNotEmpty"===r;return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>o.onSetPending("operator",t.target.value)},[{val:"startsWith",labelKey:"filter_starts_with"},{val:"equals",labelKey:"filter_equals"},{val:"isEmpty",labelKey:"filter_is_empty"},{val:"isNotEmpty",labelKey:"filter_is_not_empty"}].map((e=>t("option",{value:e.val,selected:r===e.val},s(e.labelKey,a))))),!e&&t("input",{type:"text",class:"mrd-table__filter-input",value:String(null!==(m=u.value)&&void 0!==m?m:""),placeholder:s("filter_search_value",a),onInput:t=>o.onSetPending("value",t.target.value)}))}if(f.has(e)){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r,i=!e&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!e},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===r},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===r},s("filter_is_not_empty",a))),!e&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`nm-${l}`,checked:!i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`nm-${l}`,checked:i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),i?t("div",{class:"mrd-table__filter-range"},t("input",{type:"number",class:"mrd-table__filter-input",placeholder:s("filter_from",a),value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("span",{class:"mrd-table__filter-range-sep"},"–"),t("input",{type:"number",class:"mrd-table__filter-input",placeholder:s("filter_to",a),value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:"number",class:"mrd-table__filter-input",value:null!=u.value?String(u.value):"",onInput:t=>o.onSetPending("value",t.target.value)})))}if("DATETIME"===e){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r,i=!e&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!e},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===r},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===r},s("filter_is_not_empty",a))),!e&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:!i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),i?t("div",{class:"mrd-table__filter-range mrd-table__filter-range--stacked"},t("label",{class:"mrd-table__filter-range-label"},s("filter_from",a)),t("input",{type:"date",class:"mrd-table__filter-input",value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("label",{class:"mrd-table__filter-range-label"},s("filter_to",a)),t("input",{type:"date",class:"mrd-table__filter-input",value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:"date",class:"mrd-table__filter-input",value:String(null!==(b=u.value)&&void 0!==b?b:""),onInput:t=>o.onSetPending("value",t.target.value)})))}if(g.has(e)){const r="DATE"===e?"date":"time",i=u.operator,n="isEmpty"===i||"isNotEmpty"===i,d=!n&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!n},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===i},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===i},s("filter_is_not_empty",a))),!n&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:!d,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:d,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),d?t("div",{class:"mrd-table__filter-range"},t("input",{type:r,class:"mrd-table__filter-input",placeholder:s("filter_from",a),value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("input",{type:r,class:"mrd-table__filter-input",placeholder:s("filter_to",a),value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:r,class:"mrd-table__filter-input",value:String(null!==(h=u.value)&&void 0!==h?h:""),onInput:t=>o.onSetPending("value",t.target.value)})))}return null},I=r=>{var e;const{col:l,openFilterCol:i,popupPos:a,sortField:o,sortDir:n,locale:d,cb:c}=r,m=null!==(e=l.label)&&void 0!==e?e:i,b=o===i;return t("div",{class:"mrd-table__filter-popup",style:{top:`${a.top}px`,left:`${a.left}px`},onClick:t=>t.stopPropagation()},t("div",{class:"mrd-table__filter-popup-header"},t("span",{class:"mrd-table__filter-popup-title"},m),t("button",{class:"mrd-table__filter-close",onClick:c.onClose},"✕")),t("div",{class:"mrd-table__filter-section"},t("div",{class:"mrd-table__filter-section-label"},s("filter_sorting",d)),t("div",{class:"mrd-table__filter-sort-buttons"},t("button",{class:"mrd-table__filter-sort-btn"+(b&&"asc"===n?" mrd-table__filter-sort-btn--active":""),onClick:()=>c.onApplySort("asc")},"▲ ",s("filter_ascending",d)),t("button",{class:"mrd-table__filter-sort-btn"+(b&&"desc"===n?" mrd-table__filter-sort-btn--active":""),onClick:()=>c.onApplySort("desc")},"▼ ",s("filter_descending",d)))),t("div",{class:"mrd-table__filter-divider"}),t("div",{class:"mrd-table__filter-section"},t("div",{class:"mrd-table__filter-section-label"},s("filter_section",d)),t(j,Object.assign({},r))),t("div",{class:"mrd-table__filter-popup-footer"},t("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--clear",onClick:c.onClear},s("filter_clear",d)),t("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--apply",onClick:c.onApply},s("filter_apply",d))))};function P(t,r){return Math.ceil(t/r)}function L(t,r,e){return{firstPage:Math.floor(t/e),lastPage:Math.floor(r/e)}}const A=r(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.mrdLoadPage=l(this,"mrdLoadPage",7),this.mrdPageError=l(this,"mrdPageError",7),this.mrdRowClick=l(this,"mrdRowClick",7),this.mrdAction=l(this,"mrdAction",7),this.mrdDownload=l(this,"mrdDownload",7),this.mrdLoadAggregations=l(this,"mrdLoadAggregations",7),this.pendingPages=new Set,this.debounceTimer=null,this.requestedAt=new Map,this.retryAttempts=new Map,this.staleCheckTimer=null,this.outsideClickHandler=null,this.keydownHandler=null,this.createPickerClickHandler=null,this.viewPopoverClickHandler=null,this.colWidthMeasureScheduled=!1,this.item=null,this.parentId="",this.rows=[],this.locale=navigator.language,this.totalElements=0,this.pageSize=20,this.rowHeight=36,this.tableHeight=500,this.requestTimeoutMs=15e3,this.activeViewIdx=0,this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.renderStart=0,this.renderEnd=0,this.colWidths=[],this.sortField="",this.sortDir="asc",this.filterMode=!1,this.activeFilters=new Map,this.openFilterCol=null,this.pendingFilter=null,this.popupPos={top:0,left:0},this.createPickerOpen=!1,this.viewPopoverOpen=!1,this.scrollTop=0,this.textblockModal=null,this.jsonModal=null,this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!1,this.minKnownTotal=0,this.handleScroll=t=>{const r=t.currentTarget,{renderStart:e,renderEnd:l}=function(t,r,e,l){const i=Math.floor(t/r),a=Math.min(i+P(e,r),l-1);return{renderStart:Math.max(0,i-10),renderEnd:Math.min(l-1,a+10)}}(r.scrollTop,this.rowHeight,this.tableHeight,this.baseTotal);this.scrollTop=r.scrollTop,this.renderStart=e,this.renderEnd=l,this.requestPagesForWindow(this.renderStart,this.renderEnd)}}totalElementsChanged(t){this.renderEnd=Math.min(this.renderEnd,Math.max(0,t-1))}itemChanged(t){var r,e;this.activeViewIdx=0,this.applyDefaultSort(null!==(e=null===(r=null==t?void 0:t.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:"")}componentWillLoad(){var t,r,e;this.applyDefaultSort(null!==(e=null===(r=null===(t=this.item)||void 0===t?void 0:t.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:"")}componentDidLoad(){this.staleCheckTimer=setInterval((()=>this.checkStalePages()),2e3)}applyDefaultSort(t){const{field:r,dir:e}=function(t){var r;if(!t)return{field:"",dir:"asc"};const e=t.split(",");return{field:e[0].trim(),dir:"desc"===(null===(r=e[1])||void 0===r?void 0:r.trim())?"desc":"asc"}}(t);this.sortField=r,this.sortDir=e}async init(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.requestedAt.clear(),this.retryAttempts.clear(),this.colWidths=[],this.colWidthMeasureScheduled=!1,this.scrollTop=0,this.renderStart=0,this.renderEnd=this.visibleCount()-1;const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,this.minKnownTotal=0,this.emitLoadPage(0),this.requestedPages=new Set([0])}async setPage(t,r,e){const l=void 0!==e?!e:r.length<this.pageSize;l?(this.renderEnd=Math.min(this.renderEnd,t*this.pageSize+r.length-1),this.minKnownTotal=t*this.pageSize+r.length):this.minKnownTotal=Math.max(this.minKnownTotal,(t+1)*this.pageSize+1);const i=new Map(this.loadedPages);if(i.set(t,r),this.loadedPages=i,this.requestedAt.delete(t),this.retryAttempts.delete(t),this.failedPages.has(t)){const r=new Set(this.failedPages);r.delete(t),this.failedPages=r}if(0===t&&this.aggregationsPending){this.aggregationsPending=!1;const t=this.columns.some((t=>"FIELD"===t.type&&t.aggregate));l&&!t||this.emitLoadAggregations()}}async setAggregations(t){var r;const e=null!==(r=t.total)&&void 0!==r?r:"number"==typeof t.count?t.count:void 0;null!=e&&(this.aggregationsTotal=e),this.aggregations=t}disconnectedCallback(){null!==this.staleCheckTimer&&(clearInterval(this.staleCheckTimer),this.staleCheckTimer=null),this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.createPickerClickHandler&&(document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.viewPopoverClickHandler&&(document.removeEventListener("click",this.viewPopoverClickHandler),this.viewPopoverClickHandler=null)}componentDidRender(){0===this.colWidths.length&&!this.colWidthMeasureScheduled&&this.loadedPages.size>0&&this.totalElements>0&&(this.colWidthMeasureScheduled=!0,i((()=>{if(this.colWidthMeasureScheduled=!1,0!==this.colWidths.length)return;const t=this.el.querySelectorAll(".mrd-table__header");t.length>0&&(this.colWidths=Array.from(t).map((t=>t.offsetWidth)))})))}visibleCount(){return P(this.tableHeight,this.rowHeight)}sortParam(){return(t=this.sortField)?"desc"===this.sortDir?`${t},desc`:t:"";var t}get allViews(){var t,r,e,l,i,a,o;if(!this.item)return[];const s=this.item;return[{label:null!==(i=null!==(l=null!==(e=null!==(t=s.label)&&void 0!==t?t:null===(r=s.view)||void 0===r?void 0:r.pluralLabel)&&void 0!==e?e:s.dataClass)&&void 0!==l?l:s.relatedClass)&&void 0!==i?i:"",dataClass:null!==(a=s.dataClass)&&void 0!==a?a:s.relatedClass,fromClass:s.fromClass,filterClass:s.filterClass,view:s.view},...(null!==(o=s.alternativeViews)&&void 0!==o?o:[]).map((t=>{var r,e,l,i;return{label:null!==(i=null!==(l=null!==(r=t.label)&&void 0!==r?r:null===(e=t.view)||void 0===e?void 0:e.pluralLabel)&&void 0!==l?l:t.dataClass)&&void 0!==i?i:"",dataClass:t.dataClass,fromClass:t.fromClass,filterClass:t.filterClass,view:t.view}}))]}buildExcelPath(){var t;const r=this.allViews[this.activeViewIdx];return r?"/excel"+d({isRelatedView:"RELATED_VIEW"===(null===(t=this.item)||void 0===t?void 0:t.type),fromClass:r.fromClass,parentId:this.parentId,dataClass:r.dataClass}):""}buildActionDetail(t,r){var e,l,i;if("export"===t)return{action:t,path:this.buildExcelPath(),qs:this.buildQueryParams(0)};if("create"===t){const a=this.allViews[this.activeViewIdx],o="RELATED_VIEW"===(null===(e=this.item)||void 0===e?void 0:e.type)?`/${null!==(l=null==a?void 0:a.fromClass)&&void 0!==l?l:""}/${this.parentId}`:null;return Object.assign({action:t,dataClass:null!==(i=null==a?void 0:a.dataClass)&&void 0!==i?i:"",parentPath:o},r?{basicType:r}:{})}return{action:t}}buildDataPath(){var t;const r=this.allViews[this.activeViewIdx];return r?d({isRelatedView:"RELATED_VIEW"===(null===(t=this.item)||void 0===t?void 0:t.type),fromClass:r.fromClass,parentId:this.parentId,dataClass:r.dataClass}):""}buildQueryParams(t){var r;const e=this.allViews[this.activeViewIdx];return function(t){var r,e;const l=new URLSearchParams;t.page>0&&l.set("page",String(t.page)),t.sort&&l.set("sort",t.sort),t.filterClass&&l.set("type",t.filterClass),n(l,t.viewFilters);for(const i of t.activeFilters)"isEmpty"!==i.operator?"isNotEmpty"!==i.operator?"startsWith"!==i.operator?(null===(e=i.values)||void 0===e?void 0:e.length)?l.set(i.field,i.values.join(",")):(null!=i.value&&l.set(i.field,String(i.value)),null!=i.from&&l.set(i.field+"_from",String(i.from)),null!=i.to&&l.set(i.field+"_to",String(i.to))):l.set(i.field+"_startswith",String(null!==(r=i.value)&&void 0!==r?r:"")):l.set(i.field+"_notempty","true"):l.set(i.field,"");return l.toString()}({page:t,sort:this.sortParam(),filterClass:null==e?void 0:e.filterClass,viewFilters:null===(r=null==e?void 0:e.view)||void 0===r?void 0:r.filter,activeFilters:this.activeFilters.values()})}get columns(){var t,r,e;return null!==(e=null===(r=null===(t=this.allViews[this.activeViewIdx])||void 0===t?void 0:t.view)||void 0===r?void 0:r.values)&&void 0!==e?e:[]}get tableActions(){var t,r;const e=null!==(r=null===(t=this.item)||void 0===t?void 0:t.actions)&&void 0!==r?r:[];return(null!=e?e:[]).reduce(((t,r)=>("NEW"===r&&t.push({action:"create",label:s("table_new_record",this.locale),icon:"assets/sprites.svg#icon-plus",variant:"primary"}),"EXPORT"===r&&t.push({action:"export",label:s("table_export_excel",this.locale),icon:"assets/sprites.svg#icon-file-excel"}),t)),[])}toggleCreatePicker(){this.createPickerOpen?this.closeCreatePicker():(this.createPickerOpen=!0,this.createPickerClickHandler&&document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=t=>{const r=this.el.querySelector(".mrd-table__create-picker-wrap");r&&!r.contains(t.target)&&this.closeCreatePicker()},document.addEventListener("click",this.createPickerClickHandler))}closeCreatePicker(){this.createPickerOpen=!1,this.createPickerClickHandler&&(document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=null)}colName(t){var r;return null!==(r=t.name)&&void 0!==r?r:""}colDataType(t){var r;return"RELATION"===t.type?"RELATION":null!==(r=t.dataType)&&void 0!==r?r:"TEXT"}isTotalKnown(){return null!=this.aggregationsTotal||function(t,r){for(const e of t.values())if(e.length<r)return!0;return!1}(this.loadedPages,this.pageSize)}get baseTotal(){return null!=this.aggregationsTotal?this.aggregationsTotal:this.totalElements>0?this.totalElements:this.minKnownTotal}emitLoadAggregations(){const t=this.buildQueryParams(0);this.mrdLoadAggregations.emit({path:this.buildDataPath(),qs:t,aggQs:k(t,this.columns)})}resetPages(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.requestedAt.clear(),this.retryAttempts.clear(),this.colWidths=[],this.colWidthMeasureScheduled=!1,this.scrollTop=0,this.renderStart=0,this.minKnownTotal=0,this.renderEnd=this.visibleCount()-1;const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0)}handleSortClick(t){const r=this.colName(t);this.sortField===r?this.sortDir="asc"===this.sortDir?"desc":"asc":(this.sortField=r,this.sortDir="asc"),this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}applySort(t,r){this.sortField=this.colName(t),this.sortDir=r,this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}emitLoadPage(t){this.mrdLoadPage.emit({page:t,sort:this.sortParam(),path:this.buildDataPath(),qs:this.buildQueryParams(t)}),this.requestedAt.set(t,Date.now())}emitPagesForWindow(t,r){const{firstPage:e,lastPage:l}=L(t,r,this.pageSize),i=new Set(this.requestedPages);let a=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||i.has(t)||(i.add(t),this.emitLoadPage(t),a=!0);a&&(this.requestedPages=i)}getRow(t){return function(t,r,e){var l;const i=t.get(Math.floor(r/e));return null!==(l=null==i?void 0:i[r%e])&&void 0!==l?l:null}(this.loadedPages,t,this.pageSize)}requestPagesForWindow(t,r){const{firstPage:e,lastPage:l}=L(t,r,this.pageSize);let i=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||this.requestedPages.has(t)||this.pendingPages.has(t)||(this.pendingPages.add(t),i=!0);i&&(null!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this.flushPendingPages()),150))}flushPendingPages(){if(this.debounceTimer=null,0===this.pendingPages.size)return;const t=new Set(this.requestedPages);let r=!1;for(const e of this.pendingPages){if(this.loadedPages.has(e)||t.has(e))continue;const l=e*this.pageSize;l+this.pageSize-1<this.renderStart||l>this.renderEnd||(t.add(e),this.emitLoadPage(e),r=!0)}this.pendingPages.clear(),r&&(this.requestedPages=t)}checkStalePages(){var t;if(0===this.requestedAt.size)return;const r=function(t,r,e){const l=[];for(const[i,a]of t)r-a>=e&&l.push(i);return l}(this.requestedAt,Date.now(),this.requestTimeoutMs).filter((t=>!this.loadedPages.has(t)));if(0===r.length)return;let e=null;for(const l of r){const r=null!==(t=this.retryAttempts.get(l))&&void 0!==t?t:0;r<3?(this.retryAttempts.set(l,r+1),this.emitLoadPage(l)):(this.requestedAt.delete(l),this.retryAttempts.delete(l),e||(e=new Set(this.failedPages)),e.add(l),this.mrdPageError.emit({page:l}))}e&&(this.failedPages=e)}retryPage(t){const r=new Set(this.failedPages);r.delete(t),this.failedPages=r,this.retryAttempts.delete(t),this.emitLoadPage(t);const e=new Set(this.requestedPages);e.add(t),this.requestedPages=e}handleFilterToggle(){this.filterMode=!this.filterMode,this.filterMode||this.closeFilterPopup()}handleFilterOpen(t,r){r.stopPropagation();const e=r.currentTarget.getBoundingClientRect();let l=e.left;l+280>window.innerWidth-8&&(l=e.right-280),this.popupPos={top:e.bottom+4,left:Math.max(8,l)};const i=this.colName(t),a=this.colDataType(t),o=this.activeFilters.get(i),s=v.has(a)||"RELATION"===a?"startsWith":void 0;this.pendingFilter="DATETIME"===a&&o&&"isEmpty"!==o.operator&&"isNotEmpty"!==o.operator?function(t){const r=Object.assign({},t);return"string"==typeof r.from&&r.from&&(r.from=function(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}(r.from)),"string"==typeof r.to&&r.to&&(r.to=function(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:(r.setDate(r.getDate()-1),`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`)}(r.to)),r.from&&r.to&&r.from===r.to?Object.assign(Object.assign({},r),{value:r.from,from:void 0,to:void 0}):r}(o):o?Object.assign({},o):{field:i,dataType:a,operator:s},this.openFilterCol=i,this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=t=>{const r=this.el.querySelector(".mrd-table__filter-popup");r&&!r.contains(t.target)&&this.closeFilterPopup()},document.addEventListener("click",this.outsideClickHandler)}closeFilterPopup(){this.openFilterCol=null,this.pendingFilter=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null)}openTextblockModal(t){this.textblockModal=t,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=t=>{"Escape"===t.key&&this.closeTextblockModal()},document.addEventListener("keydown",this.keydownHandler)}closeTextblockModal(){this.textblockModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}openJsonModal(t){this.jsonModal=t,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=t=>{"Escape"===t.key&&this.closeJsonModal()},document.addEventListener("keydown",this.keydownHandler)}closeJsonModal(){this.jsonModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}setPending(t,r){this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{[t]:r})}togglePendingValue(t,r){var e,l;const i=null!==(l=null===(e=this.pendingFilter)||void 0===e?void 0:e.values)&&void 0!==l?l:[];this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{values:r?[...i,t]:i.filter((r=>r!==t))})}applyFilter(){const t=this.pendingFilter;if(!(null==t?void 0:t.field))return void this.closeFilterPopup();const r=function(t){const r=Object.assign({},t);return"DATETIME"===t.dataType&&"isEmpty"!==t.operator&&"isNotEmpty"!==t.operator&&("string"==typeof r.value&&r.value?(r.from=x(r.value),r.to=E(r.value),r.value=void 0):("string"==typeof r.from&&r.from&&(r.from=x(r.from)),"string"==typeof r.to&&r.to&&(r.to=E(r.to)))),r}(t),e=new Map(this.activeFilters);!function(t){return"isEmpty"===t.operator||"isNotEmpty"===t.operator||void 0!==t.values&&t.values.length>0||null!=t.value&&""!==t.value||"boolean"==typeof t.value||null!=t.from&&""!==t.from||null!=t.to&&""!==t.to}(r)?e.delete(r.field):e.set(r.field,r),this.activeFilters=e,this.closeFilterPopup(),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearFilter(){const t=this.openFilterCol,r=new Map(this.activeFilters);t&&r.delete(t),this.activeFilters=r,this.closeFilterPopup(),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearAllFilters(){this.activeFilters=new Map,this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}handleViewSwitch(t){var r,e;const l=this.allViews[t];(null==l?void 0:l.view)&&(this.activeViewIdx=t,this.applyDefaultSort(null!==(e=null===(r=l.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:""),this.activeFilters=new Map,this.init())}toggleViewPopover(t){t.stopPropagation(),this.viewPopoverOpen?this.closeViewPopover():(this.viewPopoverOpen=!0,this.viewPopoverClickHandler=()=>this.closeViewPopover(),document.addEventListener("click",this.viewPopoverClickHandler))}closeViewPopover(){this.viewPopoverOpen=!1,this.viewPopoverClickHandler&&(document.removeEventListener("click",this.viewPopoverClickHandler),this.viewPopoverClickHandler=null)}renderToolbar(){var r;return t(N,{locale:this.locale,filterMode:this.filterMode,filterCount:this.activeFilters.size,actions:this.tableActions,views:this.allViews,activeViewIdx:this.activeViewIdx,viewPopoverOpen:this.viewPopoverOpen,createPickerOpen:this.createPickerOpen,createTypes:null===(r=this.item)||void 0===r?void 0:r.createTypes,cb:{onFilterToggle:()=>this.handleFilterToggle(),onClearAllFilters:()=>this.clearAllFilters(),onViewSwitch:t=>this.handleViewSwitch(t),onToggleViewPopover:t=>this.toggleViewPopover(t),onCloseViewPopover:()=>this.closeViewPopover(),onToggleCreatePicker:()=>this.toggleCreatePicker(),onCreate:t=>{this.mrdAction.emit(this.buildActionDetail("create",t)),this.closeCreatePicker()},onAction:t=>this.mrdAction.emit(this.buildActionDetail(t))}})}renderFilterPopup(){if(!this.openFilterCol||!this.pendingFilter)return null;const r=this.columns.find((t=>this.colName(t)===this.openFilterCol));return r?t(I,{col:r,dataType:this.colDataType(r),openFilterCol:this.openFilterCol,pendingFilter:this.pendingFilter,popupPos:this.popupPos,sortField:this.sortField,sortDir:this.sortDir,locale:this.locale,cb:{onSetPending:(t,r)=>this.setPending(t,r),onReplacePending:t=>this.pendingFilter=t,onToggleValue:(t,r)=>this.togglePendingValue(t,r),onApplySort:t=>this.applySort(r,t),onApply:()=>this.applyFilter(),onClear:()=>this.clearFilter(),onClose:()=>this.closeFilterPopup()}}):null}renderFooter(r,e,l=!0){if(0===this.totalElements&&0===this.loadedPages.size){const e=null!=r?r:0;return 0===e?null:t("div",{class:"mrd-table__footer"},e," ",s("table_of",this.locale)," ",e)}if(!this.loadedPages.has(0))return null;const i=null!=e?e:this.baseTotal,a=Math.min(Math.floor(this.scrollTop/this.rowHeight)+1,i),o=Math.min(Math.ceil((this.scrollTop+this.tableHeight)/this.rowHeight),i),n=l?String(i):"…";return t("div",{class:"mrd-table__footer"},a,"–",o," ",s("table_of",this.locale)," ",n)}renderCell(r,e){return t(z,{col:r,row:e,locale:this.locale,onDownload:t=>this.mrdDownload.emit(t),onOpenTextblock:t=>this.openTextblockModal(t),onOpenJson:t=>this.openJsonModal(t)})}renderTotalsRow(){return t(S,{columns:this.columns,aggregations:this.aggregations,locale:this.locale})}render(){var r,e,l;if(!(null===(r=this.columns)||void 0===r?void 0:r.length))return null;if(0===this.totalElements&&0===this.loadedPages.size)return t(a,null,this.renderToolbar(),t("div",{class:"mrd-table"},t("table",{class:"mrd-table__table"},t("thead",null,t("tr",null,this.columns.map((r=>{var e;const l=this.colName(r),i=this.activeFilters.has(l),a=["mrd-table__header",i?"mrd-table__header--filtered":"",this.filterMode?"mrd-table__header--sortable":""].filter(Boolean).join(" ");return t("th",{class:a,onClick:this.filterMode?t=>this.handleFilterOpen(r,t):void 0},t("span",{class:"mrd-table__header-label"},null!==(e=r.label)&&void 0!==e?e:""),i&&t(T,null))})))),t("tbody",null,null===(e=this.rows)||void 0===e?void 0:e.map(((r,e)=>t("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:e%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit({row:r})},this.columns.map((t=>this.renderCell(t,r))))))),this.renderTotalsRow()),(!this.rows||0===this.rows.length)&&t("p",{class:"mrd-table__empty"},s("no_results",this.locale))),this.renderFooter(null===(l=this.rows)||void 0===l?void 0:l.length),this.renderFilterPopup(),this.renderTextblockModal(),this.renderJsonModal());const i=function(t,r,e){let l=e;for(const[e,i]of t)i.length<r&&(l=Math.min(l,e*r+i.length));return l}(this.loadedPages,this.pageSize,this.baseTotal),o=Math.min(this.renderEnd,i-1),n=this.columns.length,d=this.renderStart*this.rowHeight,c=Math.max(0,(i-1-o)*this.rowHeight),m=this.colWidths.length>0?{tableLayout:"fixed"}:void 0,b=[];for(let r=this.renderStart;r<=o;r++){const e=this.getRow(r);if(null===e){const e=Math.floor(r/this.pageSize);this.failedPages.has(e)?b.push(t("tr",{class:"mrd-table__row mrd-table__row--failed"},t("td",{class:"mrd-table__cell--failed",colSpan:n},t("button",{type:"button",class:"mrd-table__retry-button",onClick:()=>this.retryPage(e)},s("load_failed_retry",this.locale))))):b.push(t("tr",{class:"mrd-table__row mrd-table__row--loading"},t("td",{class:"mrd-table__cell--placeholder",colSpan:n},t("span",{class:"mrd-table__placeholder-bar"}))))}else b.push(t("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:r%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit({row:e,listContext:{index:r,sort:this.sortParam(),path:this.buildDataPath(),qs:this.buildQueryParams(0)}})},this.columns.map((t=>this.renderCell(t,e)))))}return t(a,null,this.renderToolbar(),t("div",{class:"mrd-table__scroll",style:{height:`${this.tableHeight}px`},onScroll:this.handleScroll},t("table",{class:"mrd-table__table",style:m},t("thead",null,t("tr",null,this.columns.map(((r,e)=>{var l;const i=this.colName(r),a=this.sortField===i,o=this.activeFilters.has(i),s=!w.has(this.colDataType(r)),n=["mrd-table__header",s?"mrd-table__header--sortable":"",a?`mrd-table__header--sorted-${this.sortDir}`:"",o?"mrd-table__header--filtered":""].filter(Boolean).join(" ");return t("th",{class:n,style:this.colWidths[e]?{width:`${this.colWidths[e]}px`}:void 0,onClick:s?t=>this.filterMode?this.handleFilterOpen(r,t):this.handleSortClick(r):void 0},t("span",{class:"mrd-table__header-label"},null!==(l=r.label)&&void 0!==l?l:""),s&&a&&t("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"asc"===this.sortDir?"▲":"▼"),s&&!a&&!this.filterMode&&t("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"⇅"),s&&o&&t(T,null))})))),t("tbody",null,d>0&&t("tr",{class:"mrd-table__spacer",style:{height:`${d}px`}},t("td",{colSpan:n})),b,c>0&&t("tr",{class:"mrd-table__spacer",style:{height:`${c}px`}},t("td",{colSpan:n}))),this.renderTotalsRow())),0===i&&this.loadedPages.has(0)&&t("p",{class:"mrd-table__empty"},s("no_results",this.locale)),i>0&&this.renderFooter(void 0,i,this.isTotalKnown()),this.renderFilterPopup(),this.renderTextblockModal(),this.renderJsonModal())}renderTextblockModal(){return t(O,{text:this.textblockModal,locale:this.locale,onClose:()=>this.closeTextblockModal()})}renderJsonModal(){return t(M,{html:this.jsonModal,locale:this.locale,onClose:()=>this.closeJsonModal()})}get el(){return this}static get watchers(){return{totalElements:[{totalElementsChanged:0}],item:[{itemChanged:0}]}}static get style(){return'@charset "UTF-8";.sc-mrd-table-h{display:block;width:100%}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.85rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__filter-icon.sc-mrd-table{display:inline-flex;align-items:center;vertical-align:middle;margin-left:var(--mrd-space-1);color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__row--clickable.sc-mrd-table{cursor:pointer}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient(90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75%);background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.mrd-table__row--failed.sc-mrd-table{background:transparent}.mrd-table__cell--failed.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__retry-button.sc-mrd-table{border:none;background:none;padding:0;color:var(--mrd-color-danger);font-size:inherit;cursor:pointer;text-decoration:underline}.mrd-table__toolbar.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--mrd-space-2)}.mrd-table__toolbar-left.sc-mrd-table,.mrd-table__toolbar-right.sc-mrd-table{display:flex;gap:var(--mrd-space-2);align-items:center}.mrd-table__toolbar-center.sc-mrd-table{flex:1;display:flex;justify-content:center;align-items:center;gap:var(--mrd-space-1)}.mrd-table__view-switcher.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__view-arrow.sc-mrd-table{background:none;border:none;cursor:pointer;padding:0 var(--mrd-space-1);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-xs);line-height:1}.mrd-table__view-arrow.sc-mrd-table:hover{color:var(--mrd-color-neutral-800)}.mrd-table__view-title-wrap.sc-mrd-table{position:relative}.mrd-table__view-title.sc-mrd-table{font-size:var(--mrd-font-size-sm);font-weight:600;color:var(--mrd-color-neutral-800);font-family:var(--mrd-font-family);background:none;border:none;outline:none;cursor:pointer;padding:0 var(--mrd-space-1);max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-table__view-title.sc-mrd-table:hover{color:var(--mrd-color-primary)}.mrd-table__view-popover.sc-mrd-table{position:absolute;top:calc(100% + var(--mrd-space-1));left:50%;transform:translateX(-50%);background:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-radius-md);box-shadow:var(--mrd-shadow-md);z-index:100;min-width:160px;padding:var(--mrd-space-1) 0}.mrd-table__view-popover-item.sc-mrd-table{display:block;width:100%;text-align:left;background:none;border:none;cursor:pointer;padding:var(--mrd-space-2) var(--mrd-space-3);font-size:var(--mrd-font-size-sm);font-family:var(--mrd-font-family);color:var(--mrd-color-neutral-700);white-space:nowrap}.mrd-table__view-popover-item.sc-mrd-table:hover{background:var(--mrd-color-neutral-50)}.mrd-table__view-popover-item--active.sc-mrd-table{font-weight:600;color:var(--mrd-color-primary)}.mrd-table__action.sc-mrd-table{position:relative;display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;background:transparent;border:1px solid transparent;border-radius:var(--mrd-border-radius);cursor:pointer;color:var(--mrd-color-neutral-400);transition:background-color 0.15s, border-color 0.15s, color 0.15s}.mrd-table__action.sc-mrd-table:hover{background-color:var(--mrd-color-neutral-100);border-color:var(--mrd-color-neutral-300);color:var(--mrd-color-neutral-700)}.mrd-table__action.sc-mrd-table:disabled{opacity:0.4;cursor:not-allowed}.mrd-table__action--primary.sc-mrd-table{color:var(--mrd-color-neutral-500)}.mrd-table__action--primary.sc-mrd-table:hover{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__action--danger.sc-mrd-table{color:var(--mrd-color-error)}.mrd-table__action--danger.sc-mrd-table:hover{background-color:var(--mrd-color-error-light, #fef2f2);border-color:var(--mrd-color-error)}.mrd-table__action-icon.sc-mrd-table{width:1.25rem;height:1.25rem;pointer-events:none;fill:currentColor}.mrd-table__action-tooltip.sc-mrd-table{display:none;position:absolute;bottom:calc(100% + 6px);right:0;padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);white-space:nowrap;background:var(--mrd-color-tooltip, #fffce1);color:var(--mrd-color-neutral-900);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-sm, var(--mrd-border-radius));pointer-events:none;z-index:10}.mrd-table__action.sc-mrd-table:hover .mrd-table__action-tooltip.sc-mrd-table{display:block}.mrd-table__create-picker-wrap.sc-mrd-table{position:relative}.mrd-table__create-picker.sc-mrd-table{position:absolute;right:0;top:calc(100% + 4px);background:var(--mrd-color-white, #fff);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));z-index:10;min-width:10rem;padding:var(--mrd-space-1) 0}.mrd-table__create-picker-item.sc-mrd-table{display:block;width:100%;text-align:left;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:var(--mrd-font-size-sm);font-family:var(--mrd-font-family);color:var(--mrd-color-neutral-800)}.mrd-table__create-picker-item.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-900)}.mrd-table__filter-toggle--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-toggle--active.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary));color:var(--mrd-color-white)}.mrd-table__filter-badge.sc-mrd-table{position:absolute;top:-6px;right:-6px;min-width:1.25rem;height:1.25rem;padding:0 3px;background:var(--mrd-color-error, #e53e3e);color:var(--mrd-color-white);border-radius:9999px;font-size:0.65rem;font-weight:var(--mrd-font-weight-medium);line-height:1.25rem;text-align:center;pointer-events:none}.mrd-table__header--filtered.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__filter-popup.sc-mrd-table{position:fixed;width:280px;background:var(--mrd-color-white);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));z-index:var(--mrd-z-dropdown, 200);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-popup-header.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding:var(--mrd-space-2) var(--mrd-space-3);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__filter-popup-title.sc-mrd-table{font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-close.sc-mrd-table{background:transparent;border:none;cursor:pointer;color:var(--mrd-color-neutral-500);font-size:0.9rem;padding:2px 4px;border-radius:3px;line-height:1}.mrd-table__filter-close.sc-mrd-table:hover{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-800)}.mrd-table__filter-section.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-3)}.mrd-table__filter-section-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);text-transform:uppercase;letter-spacing:0.04em;color:var(--mrd-color-neutral-500);margin-bottom:var(--mrd-space-2)}.mrd-table__filter-sort-buttons.sc-mrd-table{display:flex;gap:var(--mrd-space-2)}.mrd-table__filter-sort-btn.sc-mrd-table{flex:1;padding:var(--mrd-space-1) var(--mrd-space-2);background:transparent;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-700)}.mrd-table__filter-sort-btn.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-sort-btn--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-divider.sc-mrd-table{height:1px;background:var(--mrd-border-color);margin:0}.mrd-table__filter-editor.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-2)}.mrd-table__filter-select.sc-mrd-table,.mrd-table__filter-input.sc-mrd-table{width:100%;padding:var(--mrd-space-1) var(--mrd-space-2);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900);background:var(--mrd-color-white);box-sizing:border-box}.mrd-table__filter-select.sc-mrd-table:focus,.mrd-table__filter-input.sc-mrd-table:focus{outline:none;border-color:var(--mrd-color-primary);box-shadow:0 0 0 2px rgba(0, 0, 0, 0.06)}.mrd-table__filter-range.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__filter-range.sc-mrd-table .mrd-table__filter-input.sc-mrd-table{flex:1;min-width:0}.mrd-table__filter-range-sep.sc-mrd-table{color:var(--mrd-color-neutral-400);flex-shrink:0}.mrd-table__filter-range--stacked.sc-mrd-table{flex-direction:column;align-items:stretch;gap:var(--mrd-space-2)}.mrd-table__filter-range-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-bottom:2px}.mrd-table__filter-radio-group.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-table__filter-radio-group--inline.sc-mrd-table{flex-direction:row;gap:var(--mrd-space-3)}.mrd-table__filter-radio-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-list.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1);max-height:180px;overflow-y:auto}.mrd-table__filter-list-controls.sc-mrd-table{display:flex;gap:var(--mrd-space-2);margin-bottom:var(--mrd-space-1)}.mrd-table__filter-list-btn.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-primary);background:transparent;border:none;cursor:pointer;padding:0;text-decoration:underline}.mrd-table__filter-checkbox-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-no-support.sc-mrd-table{font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);margin:0;font-style:italic}.mrd-table__filter-popup-footer.sc-mrd-table{display:flex;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);border-top:1px solid var(--mrd-border-color)}.mrd-table__filter-btn.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-3);border-radius:var(--mrd-border-radius);border:1px solid var(--mrd-border-color);font-size:var(--mrd-font-size-sm);cursor:pointer}.mrd-table__filter-btn--clear.sc-mrd-table{background:transparent;color:var(--mrd-color-neutral-600)}.mrd-table__filter-btn--clear.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-btn--apply.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-btn--apply.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary))}.mrd-table__totals-row.sc-mrd-table{border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell.sc-mrd-table{position:sticky;bottom:0;z-index:2;padding:var(--mrd-space-2) var(--mrd-space-4);background:var(--mrd-color-white);font-weight:var(--mrd-font-weight-medium);font-variant-numeric:tabular-nums;white-space:nowrap;border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell--numeric.sc-mrd-table{text-align:right}.mrd-table__footer.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);text-align:right}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}.mrd-table__file-btn.sc-mrd-table{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;max-width:100%;overflow:hidden}.mrd-table__file-btn.sc-mrd-table:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-table__file-icon.sc-mrd-table{flex-shrink:0;width:1rem;height:1rem}.mrd-table__textblock-btn.sc-mrd-table{display:inline;background:none;border:none;padding:0 0 0 var(--mrd-space-1);cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;line-height:inherit;vertical-align:middle}.mrd-table__textblock-btn.sc-mrd-table:hover{color:var(--mrd-color-primary-dark)}.mrd-table__modal-backdrop.sc-mrd-table{position:fixed;inset:0;background:rgba(0, 0, 0, 0.4);z-index:var(--mrd-z-modal, 300);display:flex;align-items:center;justify-content:center}.mrd-table__modal.sc-mrd-table{background:#fff;border-radius:var(--mrd-radius-md, 0.5rem);padding:var(--mrd-space-6);max-width:min(600px, 90vw);max-height:70vh;overflow-y:auto;position:relative;box-shadow:var(--mrd-shadow-lg)}.mrd-table__modal-close.sc-mrd-table{position:absolute;top:var(--mrd-space-3);right:var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:1.25rem;line-height:1;color:var(--mrd-color-text-muted, #6b7280);padding:0}.mrd-table__modal-close.sc-mrd-table:hover{color:var(--mrd-color-text, #111827)}.mrd-table__modal-text.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);white-space:pre-wrap;word-break:break-word;font-size:var(--mrd-font-size-sm);line-height:1.6}.mrd-table__json-preview.sc-mrd-table{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inline-block;max-width:calc(100% - 1.5rem);vertical-align:middle}.mrd-table__modal-json.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);white-space:pre-wrap;word-break:break-word;line-height:1.6;background:none;border:none}'}},[2,"mrd-table",{item:[16],parentId:[1,"parent-id"],rows:[16],locale:[1],totalElements:[2,"total-elements"],pageSize:[2,"page-size"],rowHeight:[2,"row-height"],tableHeight:[2,"table-height"],requestTimeoutMs:[2,"request-timeout-ms"],activeViewIdx:[32],loadedPages:[32],requestedPages:[32],failedPages:[32],renderStart:[32],renderEnd:[32],colWidths:[32],sortField:[32],sortDir:[32],filterMode:[32],activeFilters:[32],openFilterCol:[32],pendingFilter:[32],popupPos:[32],createPickerOpen:[32],viewPopoverOpen:[32],scrollTop:[32],textblockModal:[32],jsonModal:[32],aggregations:[32],aggregationsTotal:[32],minKnownTotal:[32],init:[64],setPage:[64],setAggregations:[64]},void 0,{totalElements:[{totalElementsChanged:0}],item:[{itemChanged:0}]}]);function D(){"undefined"!=typeof customElements&&["mrd-table"].forEach((t=>{"mrd-table"===t&&(customElements.get(o(t))||customElements.define(o(t),A))}))}export{C,A as M,D as d}
|
|
1
|
+
import{h as t,proxyCustomElement as r,HTMLElement as e,createEvent as l,writeTask as i,Host as a,transformTag as o}from"@stencil/core/internal/client";import{t as s}from"./i18n.js";import{a as n,b as d}from"./query-params.js";import{b as c,c as m,f as b,d as h,a as u,e as p}from"./format.js";import{a as _}from"./client-layout.js";const v=new Set(["TEXT","TEXTBLOCK","EMAIL","HYPERLINK"]),f=new Set(["INTEGER","DECIMAL","PERCENTAGE","CURRENCY"]),g=new Set(["DATE","DATETIME","TIME"]),y=new Set(["FILE","IMAGE"]),w=new Set(["LONGTEXT","JSON","FILE","IMAGE"]);function k(t,r){var e,l,i;const a=new URLSearchParams(t);a.delete("page"),a.delete("sort");const o=function(t){var r;const e={sum:[],avg:[],count:[]};for(const l of t){if("FIELD"!==l.type||!l.aggregate)continue;const t=l.aggregate.toLowerCase();t in e&&e[t].push(null!==(r=l.name)&&void 0!==r?r:"")}const l={};return e.sum.length&&(l.sum=e.sum),e.avg.length&&(l.avg=e.avg),e.count.length&&(l.count=e.count),Object.keys(l).length>0?l:null}(r);return(null===(e=null==o?void 0:o.sum)||void 0===e?void 0:e.length)&&a.set("sum",o.sum.join(",")),(null===(l=null==o?void 0:o.avg)||void 0===l?void 0:l.length)&&a.set("avg",o.avg.join(",")),(null===(i=null==o?void 0:o.count)||void 0===i?void 0:i.length)&&a.set("count",o.count.join(",")),a.toString()}function x(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l).toISOString().replace(/\.\d{3}Z$/,"Z")}function E(t){if(!t)return t;const[r,e,l]=t.split("-").map(Number);return new Date(r,e-1,l+1).toISOString().replace(/\.\d{3}Z$/,"Z")}class C{static render(t,r,e){var l,i,a,o;if(t.type===_.RELATION){const e=null!==(l=t.name)&&void 0!==l?l:"",o=null===(i=null==r?void 0:r._links)||void 0===i?void 0:i[e];return o?Array.isArray(o)?o.map((t=>{var r;return null!==(r=t.name)&&void 0!==r?r:""})).filter(Boolean).join(", "):null!==(a=o.name)&&void 0!==a?a:"":""}if(t.type!==_.FIELD)return"";const s=null!==(o=t.name)&&void 0!==o?o:"",n=t.dataType,d=t.listItems,c=null==r?void 0:r[s];return null==c||""===c?"":(Array.isArray(c)?c:[c]).map((t=>C.renderValue(null!=n?n:"TEXT",t,null!=d?d:[],e))).filter((t=>""!==t)).join(", ")}static renderValue(t,r,e,l){var i,a;switch(t){case"INTEGER":return u(Number(r),l,{maximumFractionDigits:0});case"DECIMAL":return u(Number(r),l);case"PERCENTAGE":return p(Number(r),l);case"CURRENCY":{const{amount:t,currency:e}="object"==typeof r&&null!==r?r:{amount:r,currency:""};return e?h(Number(t),e,l):u(Number(t),l)}case"DATE":return b(r,l);case"DATETIME":return m(r,l);case"TIME":return c(r,l);case"BOOLEAN":return r?"✓":"";case"FILE":case"IMAGE":return"object"==typeof r&&null!==r&&null!==(i=r.fileName)&&void 0!==i?i:"";case"LIST":{const t=e.find((t=>t.key===String(r)));return null!==(a=null==t?void 0:t.label)&&void 0!==a?a:String(r)}case"TEXTBLOCK":{const t=String(r).replace(/<[^>]*>/g,""),e=document.createElement("textarea");return e.innerHTML=t,e.value.trim()}case"LONGTEXT":return String(r).replace(/[\r\n]+/g," ").trim();case"JSON":return("object"==typeof r?JSON.stringify(r):String(r)).replace(/[\r\n]+/g," ").trim();case"SECRET":return r?"••••••••":"";default:return String(r)}}static formatJson(t,r=!1){try{const e="string"==typeof t?JSON.parse(t):t;return(r?JSON.stringify(e):JSON.stringify(e,null,2)).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(t=>{let r="color:#2aa198";return/^"/.test(t)?r=/:$/.test(t)?"color:#881391":"color:#268bd2":/true|false/.test(t)?r="color:#b58900":/null/.test(t)&&(r="color:#dc322f"),`<span style="${r}">${t}</span>`}))}catch(r){return String(t)}}}const z=()=>t("span",{class:"mrd-table__filter-icon","aria-hidden":"true"},t("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor"},t("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}))),T=({col:r,row:e,locale:l,onDownload:i,onOpenTextblock:a,onOpenJson:o})=>{var n,d,c;const m=null!==(n=r.dataType)&&void 0!==n?n:"",b="FIELD"===r.type&&f.has(m);if("FIELD"===r.type&&("FILE"===m||"IMAGE"===m)){const a=null!==(d=r.name)&&void 0!==d?d:"",o=null==e?void 0:e[a],n=null==o?void 0:o.href,c=null==o?void 0:o.fileName;return t("td",{class:"mrd-table__cell"},n&&c?t("button",{class:"mrd-table__file-btn",title:c,onClick:t=>{t.stopPropagation(),i({href:n,fileName:c})}},t("svg",{class:"mrd-table__file-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z"})),s("download",l)):"")}if("JSON"===m){const i=null!==(c=r.name)&&void 0!==c?c:"",a=i?null==e?void 0:e[i]:void 0;if(null==a||""===a)return t("td",{class:"mrd-table__cell"});const n=C.formatJson(a,!0),d=C.formatJson(a,!1);return t("td",{class:"mrd-table__cell"},t("span",{class:"mrd-table__json-preview",innerHTML:n}),t("button",{class:"mrd-table__textblock-btn",onClick:t=>{t.stopPropagation(),o(d)},"aria-label":s("textblock_show_more",l)},"⋯"))}if("TEXTBLOCK"===m){const i=C.render(r,e,l);if(i.length<=200)return t("td",{class:"mrd-table__cell"},i);const o=i.slice(0,200)+"…";return t("td",{class:"mrd-table__cell"},o,t("button",{class:"mrd-table__textblock-btn",onClick:t=>{t.stopPropagation(),a(i)},"aria-label":s("textblock_show_more",l)},"⋯"))}const h=C.render(r,e,l);return t("td",{class:"mrd-table__cell"+(b?" mrd-table__cell--numeric":"")},h)},S=({columns:r,aggregations:e,locale:l})=>e&&r.some((t=>"FIELD"===t.type&&t.aggregate))?t("tfoot",null,t("tr",{class:"mrd-table__totals-row"},r.map((r=>{var i;const a=function(t,r,e){var l,i;if("FIELD"!==t.type||!t.aggregate||!r)return"";const a=null===(l=r[t.aggregate.toLowerCase()])||void 0===l?void 0:l[null!==(i=t.name)&&void 0!==i?i:""];if(null==a)return"";const o=t.dataType;return"INTEGER"===o?u(a,e,{maximumFractionDigits:0}):"PERCENTAGE"===o?p(a,e):"CURRENCY"===o&&t.currencyCode?h(a,t.currencyCode,e):u(a,e)}(r,e,l),o="FIELD"===r.type&&f.has(null!==(i=r.dataType)&&void 0!==i?i:"");return t("td",{class:"mrd-table__totals-cell"+(o?" mrd-table__totals-cell--numeric":"")},a)})))):null,O=({text:r,locale:e,onClose:l})=>null===r?null:t("div",{class:"mrd-table__modal-backdrop",onClick:l,role:"dialog","aria-modal":"true"},t("div",{class:"mrd-table__modal",onClick:t=>t.stopPropagation()},t("button",{class:"mrd-table__modal-close",onClick:l,"aria-label":s("close",e)},"✕"),t("p",{class:"mrd-table__modal-text"},r))),M=({html:r,locale:e,onClose:l})=>null===r?null:t("div",{class:"mrd-table__modal-backdrop",onClick:l,role:"dialog","aria-modal":"true"},t("div",{class:"mrd-table__modal",onClick:t=>t.stopPropagation()},t("button",{class:"mrd-table__modal-close",onClick:l,"aria-label":s("close",e)},"✕"),t("pre",{class:"mrd-table__modal-json",innerHTML:r}))),N=({locale:r,filterMode:e,filterCount:l,actions:i,views:a,activeViewIdx:o,viewPopoverOpen:n,createPickerOpen:d,createTypes:c,cb:m})=>{var b;const h=i.length>0,u=a.length>1;return t("div",{class:"mrd-table__toolbar"},t("div",{class:"mrd-table__toolbar-left"},t("button",{class:"mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle"+(e?" mrd-table__filter-toggle--active":""),onClick:m.onFilterToggle},t("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"})),l>0&&t("span",{class:"mrd-table__filter-badge"},l),t("span",{class:"mrd-table__action-tooltip"},s(e?"table_filter_hide":"table_filter",r),l>0?` (${l} ${s("table_filter_active",r)})`:"")),l>0&&t("button",{class:"mrd-table__action mrd-table__action--secondary",onClick:m.onClearAllFilters},t("svg",{class:"mrd-table__action-icon",viewBox:"0 0 24 24","aria-hidden":"true"},t("path",{fill:"currentColor",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),t("span",{class:"mrd-table__action-tooltip"},s("table_filter_clear_all",r)))),u&&t("div",{class:"mrd-table__toolbar-center"},t("div",{class:"mrd-table__view-switcher"},t("button",{class:"mrd-table__view-arrow","aria-label":"Previous view",onClick:()=>m.onViewSwitch((o-1+a.length)%a.length)},"◀"),t("div",{class:"mrd-table__view-title-wrap"},t("button",{class:"mrd-table__view-title",onClick:t=>m.onToggleViewPopover(t)},null===(b=a[o])||void 0===b?void 0:b.label),n&&t("div",{class:"mrd-table__view-popover",onClick:t=>t.stopPropagation()},a.map(((r,e)=>t("button",{key:String(e),class:"mrd-table__view-popover-item"+(e===o?" mrd-table__view-popover-item--active":""),onClick:()=>{e!==o&&m.onViewSwitch(e),m.onCloseViewPopover()}},r.label))))),t("button",{class:"mrd-table__view-arrow","aria-label":"Next view",onClick:()=>m.onViewSwitch((o+1)%a.length)},"▶"))),h&&t("div",{class:"mrd-table__toolbar-right"},i.map((r=>{var e,l;const i="create"===r.action?c:null;return(null==i?void 0:i.length)?t("div",{class:"mrd-table__create-picker-wrap",key:`action-${r.action}`},t("button",{class:`mrd-table__action mrd-table__action--${null!==(e=r.variant)&&void 0!==e?e:"secondary"}`,onClick:m.onToggleCreatePicker},r.icon?t("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},t("use",{href:r.icon})):r.label,t("span",{class:"mrd-table__action-tooltip"},r.label)),d&&t("div",{class:"mrd-table__create-picker"},i.map((r=>t("button",{key:r.type,class:"mrd-table__create-picker-item",onClick:()=>m.onCreate(r.type)},r.label))))):t("button",{key:`action-${r.action}`,class:`mrd-table__action mrd-table__action--${null!==(l=r.variant)&&void 0!==l?l:"secondary"}`,disabled:r.disabled,onClick:()=>m.onAction(r.action)},r.icon?t("svg",{class:"mrd-table__action-icon","aria-hidden":"true"},t("use",{href:r.icon})):r.label,t("span",{class:"mrd-table__action-tooltip"},r.label))}))))},j=({col:r,dataType:e,openFilterCol:l,pendingFilter:i,locale:a,cb:o})=>{var n,d,c,m,b,h;const u=i;if(y.has(e))return t("p",{class:"mrd-table__filter-no-support"},s("filter_no_support",a));if("BOOLEAN"===e){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r;return t("div",{class:"mrd-table__filter-radio-group"},[{labelKey:"filter_all",value:null},{labelKey:"yes",value:!0},{labelKey:"no",value:!1}].map((r=>t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:!e&&u.value===r.value,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:void 0,value:r.value}))}),s(r.labelKey,a)))),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:"isEmpty"===r,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:"isEmpty",value:void 0}))}),s("filter_is_empty",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`bf-${l}`,checked:"isNotEmpty"===r,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{operator:"isNotEmpty",value:void 0}))}),s("filter_is_not_empty",a)))}if("LIST"===e){const e=null!==(n=r.listItems)&&void 0!==n?n:[],l=null!==(d=u.values)&&void 0!==d?d:[];return t("div",{class:"mrd-table__filter-list"},t("div",{class:"mrd-table__filter-list-controls"},t("button",{class:"mrd-table__filter-list-btn",onClick:()=>o.onReplacePending(Object.assign(Object.assign({},u),{values:e.map((t=>t.key))}))},s("filter_select_all",a)),t("button",{class:"mrd-table__filter-list-btn",onClick:()=>o.onReplacePending(Object.assign(Object.assign({},u),{values:[]}))},s("filter_select_none",a))),e.map((r=>t("label",{class:"mrd-table__filter-checkbox-label"},t("input",{type:"checkbox",checked:l.includes(r.key),onChange:t=>o.onToggleValue(r.key,t.target.checked)}),r.label))))}if(v.has(e)||"RELATION"===e){const r=null!==(c=u.operator)&&void 0!==c?c:"startsWith",e="isEmpty"===r||"isNotEmpty"===r;return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>o.onSetPending("operator",t.target.value)},[{val:"startsWith",labelKey:"filter_starts_with"},{val:"equals",labelKey:"filter_equals"},{val:"isEmpty",labelKey:"filter_is_empty"},{val:"isNotEmpty",labelKey:"filter_is_not_empty"}].map((e=>t("option",{value:e.val,selected:r===e.val},s(e.labelKey,a))))),!e&&t("input",{type:"text",class:"mrd-table__filter-input",value:String(null!==(m=u.value)&&void 0!==m?m:""),placeholder:s("filter_search_value",a),onInput:t=>o.onSetPending("value",t.target.value)}))}if(f.has(e)){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r,i=!e&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!e},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===r},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===r},s("filter_is_not_empty",a))),!e&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`nm-${l}`,checked:!i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`nm-${l}`,checked:i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),i?t("div",{class:"mrd-table__filter-range"},t("input",{type:"number",class:"mrd-table__filter-input",placeholder:s("filter_from",a),value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("span",{class:"mrd-table__filter-range-sep"},"–"),t("input",{type:"number",class:"mrd-table__filter-input",placeholder:s("filter_to",a),value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:"number",class:"mrd-table__filter-input",value:null!=u.value?String(u.value):"",onInput:t=>o.onSetPending("value",t.target.value)})))}if("DATETIME"===e){const r=u.operator,e="isEmpty"===r||"isNotEmpty"===r,i=!e&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!e},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===r},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===r},s("filter_is_not_empty",a))),!e&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:!i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:i,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),i?t("div",{class:"mrd-table__filter-range mrd-table__filter-range--stacked"},t("label",{class:"mrd-table__filter-range-label"},s("filter_from",a)),t("input",{type:"date",class:"mrd-table__filter-input",value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("label",{class:"mrd-table__filter-range-label"},s("filter_to",a)),t("input",{type:"date",class:"mrd-table__filter-input",value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:"date",class:"mrd-table__filter-input",value:String(null!==(b=u.value)&&void 0!==b?b:""),onInput:t=>o.onSetPending("value",t.target.value)})))}if(g.has(e)){const r="DATE"===e?"date":"time",i=u.operator,n="isEmpty"===i||"isNotEmpty"===i,d=!n&&(void 0!==u.from||void 0!==u.to);return t("div",{class:"mrd-table__filter-editor"},t("select",{class:"mrd-table__filter-select",onChange:t=>{const r=t.target.value;o.onReplacePending(Object.assign(Object.assign({},u),"isEmpty"===r||"isNotEmpty"===r?{operator:r,value:void 0,from:void 0,to:void 0}:{operator:void 0}))}},t("option",{value:"",selected:!n},s("filter_has_value",a)),t("option",{value:"isEmpty",selected:"isEmpty"===i},s("filter_is_empty",a)),t("option",{value:"isNotEmpty",selected:"isNotEmpty"===i},s("filter_is_not_empty",a))),!n&&t("div",{class:"mrd-table__filter-editor"},t("div",{class:"mrd-table__filter-radio-group mrd-table__filter-radio-group--inline"},t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:!d,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{from:void 0,to:void 0}))}),s("filter_exact",a)),t("label",{class:"mrd-table__filter-radio-label"},t("input",{type:"radio",name:`dt-${l}`,checked:d,onChange:()=>o.onReplacePending(Object.assign(Object.assign({},u),{value:void 0,from:null,to:null}))}),s("filter_range",a))),d?t("div",{class:"mrd-table__filter-range"},t("input",{type:r,class:"mrd-table__filter-input",placeholder:s("filter_from",a),value:null!=u.from?String(u.from):"",onInput:t=>o.onSetPending("from",t.target.value)}),t("input",{type:r,class:"mrd-table__filter-input",placeholder:s("filter_to",a),value:null!=u.to?String(u.to):"",onInput:t=>o.onSetPending("to",t.target.value)})):t("input",{type:r,class:"mrd-table__filter-input",value:String(null!==(h=u.value)&&void 0!==h?h:""),onInput:t=>o.onSetPending("value",t.target.value)})))}return null},I=r=>{var e;const{col:l,openFilterCol:i,popupPos:a,sortField:o,sortDir:n,locale:d,cb:c}=r,m=null!==(e=l.label)&&void 0!==e?e:i,b=o===i;return t("div",{class:"mrd-table__filter-popup",style:{top:`${a.top}px`,left:`${a.left}px`},onClick:t=>t.stopPropagation()},t("div",{class:"mrd-table__filter-popup-header"},t("span",{class:"mrd-table__filter-popup-title"},m),t("button",{class:"mrd-table__filter-close",onClick:c.onClose},"✕")),t("div",{class:"mrd-table__filter-section"},t("div",{class:"mrd-table__filter-section-label"},s("filter_sorting",d)),t("div",{class:"mrd-table__filter-sort-buttons"},t("button",{class:"mrd-table__filter-sort-btn"+(b&&"asc"===n?" mrd-table__filter-sort-btn--active":""),onClick:()=>c.onApplySort("asc")},"▲ ",s("filter_ascending",d)),t("button",{class:"mrd-table__filter-sort-btn"+(b&&"desc"===n?" mrd-table__filter-sort-btn--active":""),onClick:()=>c.onApplySort("desc")},"▼ ",s("filter_descending",d)))),t("div",{class:"mrd-table__filter-divider"}),t("div",{class:"mrd-table__filter-section"},t("div",{class:"mrd-table__filter-section-label"},s("filter_section",d)),t(j,Object.assign({},r))),t("div",{class:"mrd-table__filter-popup-footer"},t("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--clear",onClick:c.onClear},s("filter_clear",d)),t("button",{class:"mrd-table__filter-btn mrd-table__filter-btn--apply",onClick:c.onApply},s("filter_apply",d))))};function P(t,r){return Math.ceil(t/r)}function L(t,r,e){return{firstPage:Math.floor(t/e),lastPage:Math.floor(r/e)}}const A=r(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.mrdLoadPage=l(this,"mrdLoadPage",7),this.mrdPageError=l(this,"mrdPageError",7),this.mrdRowClick=l(this,"mrdRowClick",7),this.mrdAction=l(this,"mrdAction",7),this.mrdDownload=l(this,"mrdDownload",7),this.mrdLoadAggregations=l(this,"mrdLoadAggregations",7),this.pendingPages=new Set,this.debounceTimer=null,this.requestedAt=new Map,this.retryAttempts=new Map,this.staleCheckTimer=null,this.outsideClickHandler=null,this.keydownHandler=null,this.createPickerClickHandler=null,this.viewPopoverClickHandler=null,this.colWidthMeasureScheduled=!1,this.item=null,this.parentId="",this.rows=[],this.locale=navigator.language,this.totalElements=0,this.pageSize=20,this.rowHeight=36,this.tableHeight=500,this.requestTimeoutMs=15e3,this.activeViewIdx=0,this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.renderStart=0,this.renderEnd=0,this.colWidths=[],this.sortField="",this.sortDir="asc",this.filterMode=!1,this.activeFilters=new Map,this.openFilterCol=null,this.pendingFilter=null,this.popupPos={top:0,left:0},this.createPickerOpen=!1,this.viewPopoverOpen=!1,this.scrollTop=0,this.textblockModal=null,this.jsonModal=null,this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!1,this.minKnownTotal=0,this.handleScroll=t=>{const r=t.currentTarget,{renderStart:e,renderEnd:l}=function(t,r,e,l){const i=Math.floor(t/r),a=Math.min(i+P(e,r),l-1);return{renderStart:Math.max(0,i-10),renderEnd:Math.min(l-1,a+10)}}(r.scrollTop,this.rowHeight,this.tableHeight,this.baseTotal);this.scrollTop=r.scrollTop,this.renderStart=e,this.renderEnd=l,this.requestPagesForWindow(this.renderStart,this.renderEnd)}}totalElementsChanged(t){this.renderEnd=Math.min(this.renderEnd,Math.max(0,t-1))}itemChanged(t){var r,e;this.activeViewIdx=0,this.applyDefaultSort(null!==(e=null===(r=null==t?void 0:t.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:"")}componentWillLoad(){var t,r,e;this.applyDefaultSort(null!==(e=null===(r=null===(t=this.item)||void 0===t?void 0:t.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:"")}componentDidLoad(){this.staleCheckTimer=setInterval((()=>this.checkStalePages()),2e3)}applyDefaultSort(t){const{field:r,dir:e}=function(t){var r;if(!t)return{field:"",dir:"asc"};const e=t.split(",");return{field:e[0].trim(),dir:"desc"===(null===(r=e[1])||void 0===r?void 0:r.trim())?"desc":"asc"}}(t);this.sortField=r,this.sortDir=e}async init(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.requestedAt.clear(),this.retryAttempts.clear(),this.colWidths=[],this.colWidthMeasureScheduled=!1,this.scrollTop=0,this.renderStart=0,this.renderEnd=this.visibleCount()-1;const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,this.minKnownTotal=0,this.emitLoadPage(0),this.requestedPages=new Set([0])}async setPage(t,r,e){const l=void 0!==e?!e:r.length<this.pageSize;l?(this.renderEnd=Math.min(this.renderEnd,t*this.pageSize+r.length-1),this.minKnownTotal=t*this.pageSize+r.length):this.minKnownTotal=Math.max(this.minKnownTotal,(t+1)*this.pageSize+1);const i=new Map(this.loadedPages);if(i.set(t,r),this.loadedPages=i,this.requestedAt.delete(t),this.retryAttempts.delete(t),this.failedPages.has(t)){const r=new Set(this.failedPages);r.delete(t),this.failedPages=r}if(0===t&&this.aggregationsPending){this.aggregationsPending=!1;const t=this.columns.some((t=>"FIELD"===t.type&&t.aggregate));l&&!t||this.emitLoadAggregations()}}async setAggregations(t){null!=t.total&&(this.aggregationsTotal=t.total),this.aggregations=t}disconnectedCallback(){null!==this.staleCheckTimer&&(clearInterval(this.staleCheckTimer),this.staleCheckTimer=null),this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.createPickerClickHandler&&(document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.viewPopoverClickHandler&&(document.removeEventListener("click",this.viewPopoverClickHandler),this.viewPopoverClickHandler=null)}componentDidRender(){0===this.colWidths.length&&!this.colWidthMeasureScheduled&&this.loadedPages.size>0&&this.totalElements>0&&(this.colWidthMeasureScheduled=!0,i((()=>{if(this.colWidthMeasureScheduled=!1,0!==this.colWidths.length)return;const t=this.el.querySelectorAll(".mrd-table__header");t.length>0&&(this.colWidths=Array.from(t).map((t=>t.offsetWidth)))})))}visibleCount(){return P(this.tableHeight,this.rowHeight)}sortParam(){return(t=this.sortField)?"desc"===this.sortDir?`${t},desc`:t:"";var t}get allViews(){var t,r,e,l,i,a,o;if(!this.item)return[];const s=this.item;return[{label:null!==(i=null!==(l=null!==(e=null!==(t=s.label)&&void 0!==t?t:null===(r=s.view)||void 0===r?void 0:r.pluralLabel)&&void 0!==e?e:s.dataClass)&&void 0!==l?l:s.relatedClass)&&void 0!==i?i:"",dataClass:null!==(a=s.dataClass)&&void 0!==a?a:s.relatedClass,fromClass:s.fromClass,filterClass:s.filterClass,view:s.view},...(null!==(o=s.alternativeViews)&&void 0!==o?o:[]).map((t=>{var r,e,l,i;return{label:null!==(i=null!==(l=null!==(r=t.label)&&void 0!==r?r:null===(e=t.view)||void 0===e?void 0:e.pluralLabel)&&void 0!==l?l:t.dataClass)&&void 0!==i?i:"",dataClass:t.dataClass,fromClass:t.fromClass,filterClass:t.filterClass,view:t.view}}))]}buildExcelPath(){var t;const r=this.allViews[this.activeViewIdx];return r?"/excel"+d({isRelatedView:"RELATED_VIEW"===(null===(t=this.item)||void 0===t?void 0:t.type),fromClass:r.fromClass,parentId:this.parentId,dataClass:r.dataClass}):""}buildActionDetail(t,r){var e,l,i;if("export"===t)return{action:t,path:this.buildExcelPath(),qs:this.buildQueryParams(0)};if("create"===t){const a=this.allViews[this.activeViewIdx],o="RELATED_VIEW"===(null===(e=this.item)||void 0===e?void 0:e.type)?`/${null!==(l=null==a?void 0:a.fromClass)&&void 0!==l?l:""}/${this.parentId}`:null;return Object.assign({action:t,dataClass:null!==(i=null==a?void 0:a.dataClass)&&void 0!==i?i:"",parentPath:o},r?{basicType:r}:{})}return{action:t}}buildDataPath(){var t;const r=this.allViews[this.activeViewIdx];return r?d({isRelatedView:"RELATED_VIEW"===(null===(t=this.item)||void 0===t?void 0:t.type),fromClass:r.fromClass,parentId:this.parentId,dataClass:r.dataClass}):""}buildQueryParams(t){var r;const e=this.allViews[this.activeViewIdx];return function(t){var r,e;const l=new URLSearchParams;t.page>0&&l.set("page",String(t.page)),t.sort&&l.set("sort",t.sort),t.filterClass&&l.set("type",t.filterClass),n(l,t.viewFilters);for(const i of t.activeFilters)"isEmpty"!==i.operator?"isNotEmpty"!==i.operator?"startsWith"!==i.operator?(null===(e=i.values)||void 0===e?void 0:e.length)?l.set(i.field,i.values.join(",")):(null!=i.value&&l.set(i.field,String(i.value)),null!=i.from&&l.set(i.field+"_from",String(i.from)),null!=i.to&&l.set(i.field+"_to",String(i.to))):l.set(i.field+"_startswith",String(null!==(r=i.value)&&void 0!==r?r:"")):l.set(i.field+"_notempty","true"):l.set(i.field,"");return l.toString()}({page:t,sort:this.sortParam(),filterClass:null==e?void 0:e.filterClass,viewFilters:null===(r=null==e?void 0:e.view)||void 0===r?void 0:r.filter,activeFilters:this.activeFilters.values()})}get columns(){var t,r,e;return null!==(e=null===(r=null===(t=this.allViews[this.activeViewIdx])||void 0===t?void 0:t.view)||void 0===r?void 0:r.values)&&void 0!==e?e:[]}get tableActions(){var t,r;const e=null!==(r=null===(t=this.item)||void 0===t?void 0:t.actions)&&void 0!==r?r:[];return(null!=e?e:[]).reduce(((t,r)=>("NEW"===r&&t.push({action:"create",label:s("table_new_record",this.locale),icon:"assets/sprites.svg#icon-plus",variant:"primary"}),"EXPORT"===r&&t.push({action:"export",label:s("table_export_excel",this.locale),icon:"assets/sprites.svg#icon-file-excel"}),t)),[])}toggleCreatePicker(){this.createPickerOpen?this.closeCreatePicker():(this.createPickerOpen=!0,this.createPickerClickHandler&&document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=t=>{const r=this.el.querySelector(".mrd-table__create-picker-wrap");r&&!r.contains(t.target)&&this.closeCreatePicker()},document.addEventListener("click",this.createPickerClickHandler))}closeCreatePicker(){this.createPickerOpen=!1,this.createPickerClickHandler&&(document.removeEventListener("click",this.createPickerClickHandler),this.createPickerClickHandler=null)}colName(t){var r;return null!==(r=t.name)&&void 0!==r?r:""}colDataType(t){var r;return"RELATION"===t.type?"RELATION":null!==(r=t.dataType)&&void 0!==r?r:"TEXT"}isTotalKnown(){return null!=this.aggregationsTotal||function(t,r){for(const e of t.values())if(e.length<r)return!0;return!1}(this.loadedPages,this.pageSize)}get baseTotal(){return null!=this.aggregationsTotal?this.aggregationsTotal:this.totalElements>0?this.totalElements:this.minKnownTotal}emitLoadAggregations(){const t=this.buildQueryParams(0);this.mrdLoadAggregations.emit({path:this.buildDataPath(),qs:t,aggQs:k(t,this.columns)})}resetPages(){null!==this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.pendingPages.clear(),this.loadedPages=new Map,this.requestedPages=new Set,this.failedPages=new Set,this.requestedAt.clear(),this.retryAttempts.clear(),this.colWidths=[],this.colWidthMeasureScheduled=!1,this.scrollTop=0,this.renderStart=0,this.minKnownTotal=0,this.renderEnd=this.visibleCount()-1;const t=this.el.querySelector(".mrd-table__scroll");t&&(t.scrollTop=0)}handleSortClick(t){const r=this.colName(t);this.sortField===r?this.sortDir="asc"===this.sortDir?"desc":"asc":(this.sortField=r,this.sortDir="asc"),this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}applySort(t,r){this.sortField=this.colName(t),this.sortDir=r,this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd)}emitLoadPage(t){this.mrdLoadPage.emit({page:t,sort:this.sortParam(),path:this.buildDataPath(),qs:this.buildQueryParams(t)}),this.requestedAt.set(t,Date.now())}emitPagesForWindow(t,r){const{firstPage:e,lastPage:l}=L(t,r,this.pageSize),i=new Set(this.requestedPages);let a=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||i.has(t)||(i.add(t),this.emitLoadPage(t),a=!0);a&&(this.requestedPages=i)}getRow(t){return function(t,r,e){var l;const i=t.get(Math.floor(r/e));return null!==(l=null==i?void 0:i[r%e])&&void 0!==l?l:null}(this.loadedPages,t,this.pageSize)}requestPagesForWindow(t,r){const{firstPage:e,lastPage:l}=L(t,r,this.pageSize);let i=!1;for(let t=e;t<=l;t++)this.loadedPages.has(t)||this.requestedPages.has(t)||this.pendingPages.has(t)||(this.pendingPages.add(t),i=!0);i&&(null!==this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this.flushPendingPages()),150))}flushPendingPages(){if(this.debounceTimer=null,0===this.pendingPages.size)return;const t=new Set(this.requestedPages);let r=!1;for(const e of this.pendingPages){if(this.loadedPages.has(e)||t.has(e))continue;const l=e*this.pageSize;l+this.pageSize-1<this.renderStart||l>this.renderEnd||(t.add(e),this.emitLoadPage(e),r=!0)}this.pendingPages.clear(),r&&(this.requestedPages=t)}checkStalePages(){var t;if(0===this.requestedAt.size)return;const r=function(t,r,e){const l=[];for(const[i,a]of t)r-a>=e&&l.push(i);return l}(this.requestedAt,Date.now(),this.requestTimeoutMs).filter((t=>!this.loadedPages.has(t)));if(0===r.length)return;let e=null;for(const l of r){const r=null!==(t=this.retryAttempts.get(l))&&void 0!==t?t:0;r<3?(this.retryAttempts.set(l,r+1),this.emitLoadPage(l)):(this.requestedAt.delete(l),this.retryAttempts.delete(l),e||(e=new Set(this.failedPages)),e.add(l),this.mrdPageError.emit({page:l}))}e&&(this.failedPages=e)}retryPage(t){const r=new Set(this.failedPages);r.delete(t),this.failedPages=r,this.retryAttempts.delete(t),this.emitLoadPage(t);const e=new Set(this.requestedPages);e.add(t),this.requestedPages=e}handleFilterToggle(){this.filterMode=!this.filterMode,this.filterMode||this.closeFilterPopup()}handleFilterOpen(t,r){r.stopPropagation();const e=r.currentTarget.getBoundingClientRect();let l=e.left;l+280>window.innerWidth-8&&(l=e.right-280),this.popupPos={top:e.bottom+4,left:Math.max(8,l)};const i=this.colName(t),a=this.colDataType(t),o=this.activeFilters.get(i),s=v.has(a)||"RELATION"===a?"startsWith":void 0;this.pendingFilter="DATETIME"===a&&o&&"isEmpty"!==o.operator&&"isNotEmpty"!==o.operator?function(t){const r=Object.assign({},t);return"string"==typeof r.from&&r.from&&(r.from=function(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}(r.from)),"string"==typeof r.to&&r.to&&(r.to=function(t){if(!t)return t;const r=new Date(t);return isNaN(r.getTime())?t:(r.setDate(r.getDate()-1),`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`)}(r.to)),r.from&&r.to&&r.from===r.to?Object.assign(Object.assign({},r),{value:r.from,from:void 0,to:void 0}):r}(o):o?Object.assign({},o):{field:i,dataType:a,operator:s},this.openFilterCol=i,this.outsideClickHandler&&document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=t=>{const r=this.el.querySelector(".mrd-table__filter-popup");r&&!r.contains(t.target)&&this.closeFilterPopup()},document.addEventListener("click",this.outsideClickHandler)}closeFilterPopup(){this.openFilterCol=null,this.pendingFilter=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null)}openTextblockModal(t){this.textblockModal=t,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=t=>{"Escape"===t.key&&this.closeTextblockModal()},document.addEventListener("keydown",this.keydownHandler)}closeTextblockModal(){this.textblockModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}openJsonModal(t){this.jsonModal=t,this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=t=>{"Escape"===t.key&&this.closeJsonModal()},document.addEventListener("keydown",this.keydownHandler)}closeJsonModal(){this.jsonModal=null,this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}setPending(t,r){this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{[t]:r})}togglePendingValue(t,r){var e,l;const i=null!==(l=null===(e=this.pendingFilter)||void 0===e?void 0:e.values)&&void 0!==l?l:[];this.pendingFilter=Object.assign(Object.assign({},this.pendingFilter),{values:r?[...i,t]:i.filter((r=>r!==t))})}applyFilter(){const t=this.pendingFilter;if(!(null==t?void 0:t.field))return void this.closeFilterPopup();const r=function(t){const r=Object.assign({},t);return"DATETIME"===t.dataType&&"isEmpty"!==t.operator&&"isNotEmpty"!==t.operator&&("string"==typeof r.value&&r.value?(r.from=x(r.value),r.to=E(r.value),r.value=void 0):("string"==typeof r.from&&r.from&&(r.from=x(r.from)),"string"==typeof r.to&&r.to&&(r.to=E(r.to)))),r}(t),e=new Map(this.activeFilters);!function(t){return"isEmpty"===t.operator||"isNotEmpty"===t.operator||void 0!==t.values&&t.values.length>0||null!=t.value&&""!==t.value||"boolean"==typeof t.value||null!=t.from&&""!==t.from||null!=t.to&&""!==t.to}(r)?e.delete(r.field):e.set(r.field,r),this.activeFilters=e,this.closeFilterPopup(),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearFilter(){const t=this.openFilterCol,r=new Map(this.activeFilters);t&&r.delete(t),this.activeFilters=r,this.closeFilterPopup(),this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}clearAllFilters(){this.activeFilters=new Map,this.aggregations=null,this.aggregationsTotal=null,this.aggregationsPending=!0,(this.totalElements>0||this.minKnownTotal>0)&&(this.resetPages(),this.emitPagesForWindow(this.renderStart,this.renderEnd))}handleViewSwitch(t){var r,e;const l=this.allViews[t];(null==l?void 0:l.view)&&(this.activeViewIdx=t,this.applyDefaultSort(null!==(e=null===(r=l.view)||void 0===r?void 0:r.defaultSort)&&void 0!==e?e:""),this.activeFilters=new Map,this.init())}toggleViewPopover(t){t.stopPropagation(),this.viewPopoverOpen?this.closeViewPopover():(this.viewPopoverOpen=!0,this.viewPopoverClickHandler=()=>this.closeViewPopover(),document.addEventListener("click",this.viewPopoverClickHandler))}closeViewPopover(){this.viewPopoverOpen=!1,this.viewPopoverClickHandler&&(document.removeEventListener("click",this.viewPopoverClickHandler),this.viewPopoverClickHandler=null)}renderToolbar(){var r;return t(N,{locale:this.locale,filterMode:this.filterMode,filterCount:this.activeFilters.size,actions:this.tableActions,views:this.allViews,activeViewIdx:this.activeViewIdx,viewPopoverOpen:this.viewPopoverOpen,createPickerOpen:this.createPickerOpen,createTypes:null===(r=this.item)||void 0===r?void 0:r.createTypes,cb:{onFilterToggle:()=>this.handleFilterToggle(),onClearAllFilters:()=>this.clearAllFilters(),onViewSwitch:t=>this.handleViewSwitch(t),onToggleViewPopover:t=>this.toggleViewPopover(t),onCloseViewPopover:()=>this.closeViewPopover(),onToggleCreatePicker:()=>this.toggleCreatePicker(),onCreate:t=>{this.mrdAction.emit(this.buildActionDetail("create",t)),this.closeCreatePicker()},onAction:t=>this.mrdAction.emit(this.buildActionDetail(t))}})}renderFilterPopup(){if(!this.openFilterCol||!this.pendingFilter)return null;const r=this.columns.find((t=>this.colName(t)===this.openFilterCol));return r?t(I,{col:r,dataType:this.colDataType(r),openFilterCol:this.openFilterCol,pendingFilter:this.pendingFilter,popupPos:this.popupPos,sortField:this.sortField,sortDir:this.sortDir,locale:this.locale,cb:{onSetPending:(t,r)=>this.setPending(t,r),onReplacePending:t=>this.pendingFilter=t,onToggleValue:(t,r)=>this.togglePendingValue(t,r),onApplySort:t=>this.applySort(r,t),onApply:()=>this.applyFilter(),onClear:()=>this.clearFilter(),onClose:()=>this.closeFilterPopup()}}):null}renderFooter(r,e,l=!0){if(0===this.totalElements&&0===this.loadedPages.size){const e=null!=r?r:0;return 0===e?null:t("div",{class:"mrd-table__footer"},e," ",s("table_of",this.locale)," ",e)}if(!this.loadedPages.has(0))return null;const i=null!=e?e:this.baseTotal,a=Math.min(Math.floor(this.scrollTop/this.rowHeight)+1,i),o=Math.min(Math.ceil((this.scrollTop+this.tableHeight)/this.rowHeight),i),n=l?String(i):"…";return t("div",{class:"mrd-table__footer"},a,"–",o," ",s("table_of",this.locale)," ",n)}renderCell(r,e){return t(T,{col:r,row:e,locale:this.locale,onDownload:t=>this.mrdDownload.emit(t),onOpenTextblock:t=>this.openTextblockModal(t),onOpenJson:t=>this.openJsonModal(t)})}renderTotalsRow(){return t(S,{columns:this.columns,aggregations:this.aggregations,locale:this.locale})}render(){var r,e,l;if(!(null===(r=this.columns)||void 0===r?void 0:r.length))return null;if(0===this.totalElements&&0===this.loadedPages.size)return t(a,null,this.renderToolbar(),t("div",{class:"mrd-table"},t("table",{class:"mrd-table__table"},t("thead",null,t("tr",null,this.columns.map((r=>{var e;const l=this.colName(r),i=this.activeFilters.has(l),a=["mrd-table__header",i?"mrd-table__header--filtered":"",this.filterMode?"mrd-table__header--sortable":""].filter(Boolean).join(" ");return t("th",{class:a,onClick:this.filterMode?t=>this.handleFilterOpen(r,t):void 0},t("span",{class:"mrd-table__header-label"},null!==(e=r.label)&&void 0!==e?e:""),i&&t(z,null))})))),t("tbody",null,null===(e=this.rows)||void 0===e?void 0:e.map(((r,e)=>t("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:e%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit({row:r})},this.columns.map((t=>this.renderCell(t,r))))))),this.renderTotalsRow()),(!this.rows||0===this.rows.length)&&t("p",{class:"mrd-table__empty"},s("no_results",this.locale))),this.renderFooter(null===(l=this.rows)||void 0===l?void 0:l.length),this.renderFilterPopup(),this.renderTextblockModal(),this.renderJsonModal());const i=function(t,r,e){let l=e;for(const[e,i]of t)i.length<r&&(l=Math.min(l,e*r+i.length));return l}(this.loadedPages,this.pageSize,this.baseTotal),o=Math.min(this.renderEnd,i-1),n=this.columns.length,d=this.renderStart*this.rowHeight,c=Math.max(0,(i-1-o)*this.rowHeight),m=this.colWidths.length>0?{tableLayout:"fixed"}:void 0,b=[];for(let r=this.renderStart;r<=o;r++){const e=this.getRow(r);if(null===e){const e=Math.floor(r/this.pageSize);this.failedPages.has(e)?b.push(t("tr",{class:"mrd-table__row mrd-table__row--failed"},t("td",{class:"mrd-table__cell--failed",colSpan:n},t("button",{type:"button",class:"mrd-table__retry-button",onClick:()=>this.retryPage(e)},s("load_failed_retry",this.locale))))):b.push(t("tr",{class:"mrd-table__row mrd-table__row--loading"},t("td",{class:"mrd-table__cell--placeholder",colSpan:n},t("span",{class:"mrd-table__placeholder-bar"}))))}else b.push(t("tr",{class:"mrd-table__row mrd-table__row--clickable",style:{background:r%2==0?"":"var(--mrd-color-neutral-100)"},onClick:()=>this.mrdRowClick.emit({row:e,listContext:{index:r,sort:this.sortParam(),path:this.buildDataPath(),qs:this.buildQueryParams(0)}})},this.columns.map((t=>this.renderCell(t,e)))))}return t(a,null,this.renderToolbar(),t("div",{class:"mrd-table__scroll",style:{height:`${this.tableHeight}px`},onScroll:this.handleScroll},t("table",{class:"mrd-table__table",style:m},t("thead",null,t("tr",null,this.columns.map(((r,e)=>{var l;const i=this.colName(r),a=this.sortField===i,o=this.activeFilters.has(i),s=!w.has(this.colDataType(r)),n=["mrd-table__header",s?"mrd-table__header--sortable":"",a?`mrd-table__header--sorted-${this.sortDir}`:"",o?"mrd-table__header--filtered":""].filter(Boolean).join(" ");return t("th",{class:n,style:this.colWidths[e]?{width:`${this.colWidths[e]}px`}:void 0,onClick:s?t=>this.filterMode?this.handleFilterOpen(r,t):this.handleSortClick(r):void 0},t("span",{class:"mrd-table__header-label"},null!==(l=r.label)&&void 0!==l?l:""),s&&a&&t("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"asc"===this.sortDir?"▲":"▼"),s&&!a&&!this.filterMode&&t("span",{class:"mrd-table__sort-icon","aria-hidden":"true"},"⇅"),s&&o&&t(z,null))})))),t("tbody",null,d>0&&t("tr",{class:"mrd-table__spacer",style:{height:`${d}px`}},t("td",{colSpan:n})),b,c>0&&t("tr",{class:"mrd-table__spacer",style:{height:`${c}px`}},t("td",{colSpan:n}))),this.renderTotalsRow())),0===i&&this.loadedPages.has(0)&&t("p",{class:"mrd-table__empty"},s("no_results",this.locale)),i>0&&this.renderFooter(void 0,i,this.isTotalKnown()),this.renderFilterPopup(),this.renderTextblockModal(),this.renderJsonModal())}renderTextblockModal(){return t(O,{text:this.textblockModal,locale:this.locale,onClose:()=>this.closeTextblockModal()})}renderJsonModal(){return t(M,{html:this.jsonModal,locale:this.locale,onClose:()=>this.closeJsonModal()})}get el(){return this}static get watchers(){return{totalElements:[{totalElementsChanged:0}],item:[{itemChanged:0}]}}static get style(){return".sc-mrd-table-h{display:block;width:100%}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header--filtered.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.85rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__filter-icon.sc-mrd-table{display:inline-flex;align-items:center;vertical-align:middle;margin-left:var(--mrd-space-1);color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__row--clickable.sc-mrd-table{cursor:pointer}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__row--failed.sc-mrd-table{background:transparent}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__cell--failed.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient(90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75%);background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}.mrd-table__retry-button.sc-mrd-table{border:none;background:none;padding:0;color:var(--mrd-color-danger);font-size:inherit;cursor:pointer;text-decoration:underline}.mrd-table__toolbar.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--mrd-space-2)}.mrd-table__toolbar-left.sc-mrd-table,.mrd-table__toolbar-right.sc-mrd-table{display:flex;gap:var(--mrd-space-2);align-items:center}.mrd-table__toolbar-center.sc-mrd-table{flex:1;display:flex;justify-content:center;align-items:center;gap:var(--mrd-space-1)}.mrd-table__view-switcher.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__view-arrow.sc-mrd-table{background:none;border:none;cursor:pointer;padding:0 var(--mrd-space-1);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-xs);line-height:1}.mrd-table__view-arrow.sc-mrd-table:hover{color:var(--mrd-color-neutral-800)}.mrd-table__view-title-wrap.sc-mrd-table{position:relative}.mrd-table__view-title.sc-mrd-table{font-size:var(--mrd-font-size-sm);font-weight:600;color:var(--mrd-color-neutral-800);font-family:var(--mrd-font-family);background:none;border:none;outline:none;cursor:pointer;padding:0 var(--mrd-space-1);max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-table__view-title.sc-mrd-table:hover{color:var(--mrd-color-primary)}.mrd-table__view-popover.sc-mrd-table{position:absolute;top:calc(100% + var(--mrd-space-1));left:50%;transform:translateX(-50%);background:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-radius-md);box-shadow:var(--mrd-shadow-md);z-index:100;min-width:160px;padding:var(--mrd-space-1) 0}.mrd-table__view-popover-item.sc-mrd-table{display:block;width:100%;text-align:left;background:none;border:none;cursor:pointer;padding:var(--mrd-space-2) var(--mrd-space-3);font-size:var(--mrd-font-size-sm);font-family:var(--mrd-font-family);color:var(--mrd-color-neutral-700);white-space:nowrap}.mrd-table__view-popover-item.sc-mrd-table:hover{background:var(--mrd-color-neutral-50)}.mrd-table__view-popover-item--active.sc-mrd-table{font-weight:600;color:var(--mrd-color-primary)}.mrd-table__action.sc-mrd-table{position:relative;display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;background:transparent;border:1px solid transparent;border-radius:var(--mrd-border-radius);cursor:pointer;color:var(--mrd-color-neutral-400);transition:background-color 0.15s, border-color 0.15s, color 0.15s}.mrd-table__action.sc-mrd-table:hover{background-color:var(--mrd-color-neutral-100);border-color:var(--mrd-color-neutral-300);color:var(--mrd-color-neutral-700)}.mrd-table__action.sc-mrd-table:hover .mrd-table__action-tooltip.sc-mrd-table{display:block}.mrd-table__action.sc-mrd-table:disabled{opacity:0.4;cursor:not-allowed}.mrd-table__action--primary.sc-mrd-table{color:var(--mrd-color-neutral-500)}.mrd-table__action--primary.sc-mrd-table:hover{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__action--danger.sc-mrd-table{color:var(--mrd-color-error)}.mrd-table__action--danger.sc-mrd-table:hover{background-color:var(--mrd-color-error-light, #fef2f2);border-color:var(--mrd-color-error)}.mrd-table__action-icon.sc-mrd-table{width:1.25rem;height:1.25rem;pointer-events:none;fill:currentColor}.mrd-table__action-tooltip.sc-mrd-table{display:none;position:absolute;bottom:calc(100% + 6px);right:0;padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);white-space:nowrap;background:var(--mrd-color-tooltip, #fffce1);color:var(--mrd-color-neutral-900);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-sm, var(--mrd-border-radius));pointer-events:none;z-index:10}.mrd-table__create-picker-wrap.sc-mrd-table{position:relative}.mrd-table__create-picker.sc-mrd-table{position:absolute;right:0;top:calc(100% + 4px);background:var(--mrd-color-white, #fff);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));z-index:10;min-width:10rem;padding:var(--mrd-space-1) 0}.mrd-table__create-picker-item.sc-mrd-table{display:block;width:100%;text-align:left;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:var(--mrd-font-size-sm);font-family:var(--mrd-font-family);color:var(--mrd-color-neutral-800)}.mrd-table__create-picker-item.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-900)}.mrd-table__filter-toggle--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-toggle--active.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary));color:var(--mrd-color-white)}.mrd-table__filter-badge.sc-mrd-table{position:absolute;top:-6px;right:-6px;min-width:1.25rem;height:1.25rem;padding:0 3px;background:var(--mrd-color-error, #e53e3e);color:var(--mrd-color-white);border-radius:9999px;font-size:0.65rem;font-weight:var(--mrd-font-weight-medium);line-height:1.25rem;text-align:center;pointer-events:none}.mrd-table__filter-popup.sc-mrd-table{position:fixed;width:280px;background:var(--mrd-color-white);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);box-shadow:var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));z-index:var(--mrd-z-dropdown, 200);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-popup-header.sc-mrd-table{display:flex;align-items:center;justify-content:space-between;padding:var(--mrd-space-2) var(--mrd-space-3);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__filter-popup-title.sc-mrd-table{font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);font-size:var(--mrd-font-size-sm)}.mrd-table__filter-close.sc-mrd-table{background:transparent;border:none;cursor:pointer;color:var(--mrd-color-neutral-500);font-size:0.9rem;padding:2px 4px;border-radius:3px;line-height:1}.mrd-table__filter-close.sc-mrd-table:hover{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-800)}.mrd-table__filter-section.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-3)}.mrd-table__filter-section-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);text-transform:uppercase;letter-spacing:0.04em;color:var(--mrd-color-neutral-500);margin-bottom:var(--mrd-space-2)}.mrd-table__filter-sort-buttons.sc-mrd-table{display:flex;gap:var(--mrd-space-2)}.mrd-table__filter-sort-btn.sc-mrd-table{flex:1;padding:var(--mrd-space-1) var(--mrd-space-2);background:transparent;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-700)}.mrd-table__filter-sort-btn.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-sort-btn--active.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-divider.sc-mrd-table{height:1px;background:var(--mrd-border-color);margin:0}.mrd-table__filter-editor.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-2)}.mrd-table__filter-select.sc-mrd-table,.mrd-table__filter-input.sc-mrd-table{width:100%;padding:var(--mrd-space-1) var(--mrd-space-2);border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900);background:var(--mrd-color-white);box-sizing:border-box}.mrd-table__filter-select.sc-mrd-table:focus,.mrd-table__filter-input.sc-mrd-table:focus{outline:none;border-color:var(--mrd-color-primary);box-shadow:0 0 0 2px rgba(0, 0, 0, 0.06)}.mrd-table__filter-range.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1)}.mrd-table__filter-range.sc-mrd-table .mrd-table__filter-input.sc-mrd-table{flex:1;min-width:0}.mrd-table__filter-range--stacked.sc-mrd-table{flex-direction:column;align-items:stretch;gap:var(--mrd-space-2)}.mrd-table__filter-range-sep.sc-mrd-table{color:var(--mrd-color-neutral-400);flex-shrink:0}.mrd-table__filter-range-label.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-bottom:2px}.mrd-table__filter-radio-group.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-table__filter-radio-group--inline.sc-mrd-table{flex-direction:row;gap:var(--mrd-space-3)}.mrd-table__filter-radio-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-list.sc-mrd-table{display:flex;flex-direction:column;gap:var(--mrd-space-1);max-height:180px;overflow-y:auto}.mrd-table__filter-list-controls.sc-mrd-table{display:flex;gap:var(--mrd-space-2);margin-bottom:var(--mrd-space-1)}.mrd-table__filter-list-btn.sc-mrd-table{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-primary);background:transparent;border:none;cursor:pointer;padding:0;text-decoration:underline}.mrd-table__filter-checkbox-label.sc-mrd-table{display:flex;align-items:center;gap:var(--mrd-space-1);cursor:pointer;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-table__filter-no-support.sc-mrd-table{font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-500);margin:0;font-style:italic}.mrd-table__filter-popup-footer.sc-mrd-table{display:flex;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);border-top:1px solid var(--mrd-border-color)}.mrd-table__filter-btn.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-3);border-radius:var(--mrd-border-radius);border:1px solid var(--mrd-border-color);font-size:var(--mrd-font-size-sm);cursor:pointer}.mrd-table__filter-btn--clear.sc-mrd-table{background:transparent;color:var(--mrd-color-neutral-600)}.mrd-table__filter-btn--clear.sc-mrd-table:hover{background:var(--mrd-color-neutral-100)}.mrd-table__filter-btn--apply.sc-mrd-table{background:var(--mrd-color-primary);border-color:var(--mrd-color-primary);color:var(--mrd-color-white)}.mrd-table__filter-btn--apply.sc-mrd-table:hover{background:var(--mrd-color-primary-dark, var(--mrd-color-primary));border-color:var(--mrd-color-primary-dark, var(--mrd-color-primary))}.mrd-table__totals-row.sc-mrd-table{border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell.sc-mrd-table{position:sticky;bottom:0;z-index:2;padding:var(--mrd-space-2) var(--mrd-space-4);background:var(--mrd-color-white);font-weight:var(--mrd-font-weight-medium);font-variant-numeric:tabular-nums;white-space:nowrap;border-top:2px solid var(--mrd-border-color)}.mrd-table__totals-cell--numeric.sc-mrd-table{text-align:right}.mrd-table__footer.sc-mrd-table{padding:var(--mrd-space-1) var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);text-align:right}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}.mrd-table__file-btn.sc-mrd-table{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;max-width:100%;overflow:hidden}.mrd-table__file-btn.sc-mrd-table:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-table__file-icon.sc-mrd-table{flex-shrink:0;width:1rem;height:1rem}.mrd-table__textblock-btn.sc-mrd-table{display:inline;background:none;border:none;padding:0 0 0 var(--mrd-space-1);cursor:pointer;color:var(--mrd-color-primary);font-size:var(--mrd-font-size-sm);font-family:inherit;line-height:inherit;vertical-align:middle}.mrd-table__textblock-btn.sc-mrd-table:hover{color:var(--mrd-color-primary-dark)}.mrd-table__modal-backdrop.sc-mrd-table{position:fixed;inset:0;background:rgba(0, 0, 0, 0.4);z-index:var(--mrd-z-modal, 300);display:flex;align-items:center;justify-content:center}.mrd-table__modal.sc-mrd-table{background:#fff;border-radius:var(--mrd-radius-md, 0.5rem);padding:var(--mrd-space-6);max-width:min(600px, 90vw);max-height:70vh;overflow-y:auto;position:relative;box-shadow:var(--mrd-shadow-lg)}.mrd-table__modal-close.sc-mrd-table{position:absolute;top:var(--mrd-space-3);right:var(--mrd-space-3);background:none;border:none;cursor:pointer;font-size:1.25rem;line-height:1;color:var(--mrd-color-text-muted, #6b7280);padding:0}.mrd-table__modal-close.sc-mrd-table:hover{color:var(--mrd-color-text, #111827)}.mrd-table__modal-text.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);white-space:pre-wrap;word-break:break-word;font-size:var(--mrd-font-size-sm);line-height:1.6}.mrd-table__json-preview.sc-mrd-table{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inline-block;max-width:calc(100% - 1.5rem);vertical-align:middle}.mrd-table__modal-json.sc-mrd-table{margin:0;padding-right:var(--mrd-space-6);font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);white-space:pre-wrap;word-break:break-word;line-height:1.6;background:none;border:none}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}"}},[2,"mrd-table",{item:[16],parentId:[1,"parent-id"],rows:[16],locale:[1],totalElements:[2,"total-elements"],pageSize:[2,"page-size"],rowHeight:[2,"row-height"],tableHeight:[2,"table-height"],requestTimeoutMs:[2,"request-timeout-ms"],activeViewIdx:[32],loadedPages:[32],requestedPages:[32],failedPages:[32],renderStart:[32],renderEnd:[32],colWidths:[32],sortField:[32],sortDir:[32],filterMode:[32],activeFilters:[32],openFilterCol:[32],pendingFilter:[32],popupPos:[32],createPickerOpen:[32],viewPopoverOpen:[32],scrollTop:[32],textblockModal:[32],jsonModal:[32],aggregations:[32],aggregationsTotal:[32],minKnownTotal:[32],init:[64],setPage:[64],setAggregations:[64]},void 0,{totalElements:[{totalElementsChanged:0}],item:[{itemChanged:0}]}]);function D(){"undefined"!=typeof customElements&&["mrd-table"].forEach((t=>{"mrd-table"===t&&(customElements.get(o(t))||customElements.define(o(t),A))}))}export{C,A as M,D as d}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// ─── Layout type ──────────────────────────────────────────────────────────────
|
|
2
|
+
var ClientLayoutType;
|
|
3
|
+
(function (ClientLayoutType) {
|
|
4
|
+
ClientLayoutType["OBJECT_FORM_DASHBOARD"] = "OBJECT_FORM_DASHBOARD";
|
|
5
|
+
ClientLayoutType["CLASS_DASHBOARD"] = "CLASS_DASHBOARD";
|
|
6
|
+
ClientLayoutType["GENERAL_DASHBOARD"] = "GENERAL_DASHBOARD";
|
|
7
|
+
ClientLayoutType["NAVIGATION_PANE"] = "NAVIGATION_PANE";
|
|
8
|
+
})(ClientLayoutType || (ClientLayoutType = {}));
|
|
9
|
+
// ─── Item types ───────────────────────────────────────────────────────────────
|
|
10
|
+
var ClientLayoutItemType;
|
|
11
|
+
(function (ClientLayoutItemType) {
|
|
12
|
+
// Form / data input
|
|
13
|
+
ClientLayoutItemType["FIELD"] = "FIELD";
|
|
14
|
+
ClientLayoutItemType["RELATION"] = "RELATION";
|
|
15
|
+
// Layout structure
|
|
16
|
+
ClientLayoutItemType["SECTION"] = "SECTION";
|
|
17
|
+
ClientLayoutItemType["GROUP"] = "GROUP";
|
|
18
|
+
// Read-only / display
|
|
19
|
+
ClientLayoutItemType["HEADER"] = "HEADER";
|
|
20
|
+
ClientLayoutItemType["TEXT"] = "TEXT";
|
|
21
|
+
// Navigation / actions
|
|
22
|
+
ClientLayoutItemType["NAVIGATE"] = "NAVIGATE";
|
|
23
|
+
ClientLayoutItemType["ACTION"] = "ACTION";
|
|
24
|
+
ClientLayoutItemType["SEARCH"] = "SEARCH";
|
|
25
|
+
// Dashboard views
|
|
26
|
+
ClientLayoutItemType["VIEW"] = "VIEW";
|
|
27
|
+
ClientLayoutItemType["RELATED_VIEW"] = "RELATED_VIEW";
|
|
28
|
+
ClientLayoutItemType["RELATED_OBJECT"] = "RELATED_OBJECT";
|
|
29
|
+
})(ClientLayoutItemType || (ClientLayoutItemType = {}));
|
|
30
|
+
// ─── Field data types ─────────────────────────────────────────────────────────
|
|
31
|
+
var ClientLayoutItemFieldDataType;
|
|
32
|
+
(function (ClientLayoutItemFieldDataType) {
|
|
33
|
+
ClientLayoutItemFieldDataType["TEXT"] = "TEXT";
|
|
34
|
+
ClientLayoutItemFieldDataType["TEXTBLOCK"] = "TEXTBLOCK";
|
|
35
|
+
ClientLayoutItemFieldDataType["INTEGER"] = "INTEGER";
|
|
36
|
+
ClientLayoutItemFieldDataType["DECIMAL"] = "DECIMAL";
|
|
37
|
+
ClientLayoutItemFieldDataType["PERCENTAGE"] = "PERCENTAGE";
|
|
38
|
+
ClientLayoutItemFieldDataType["CURRENCY"] = "CURRENCY";
|
|
39
|
+
ClientLayoutItemFieldDataType["BOOLEAN"] = "BOOLEAN";
|
|
40
|
+
ClientLayoutItemFieldDataType["DATE"] = "DATE";
|
|
41
|
+
ClientLayoutItemFieldDataType["DATETIME"] = "DATETIME";
|
|
42
|
+
ClientLayoutItemFieldDataType["TIME"] = "TIME";
|
|
43
|
+
ClientLayoutItemFieldDataType["EMAIL"] = "EMAIL";
|
|
44
|
+
ClientLayoutItemFieldDataType["HYPERLINK"] = "HYPERLINK";
|
|
45
|
+
ClientLayoutItemFieldDataType["LIST"] = "LIST";
|
|
46
|
+
ClientLayoutItemFieldDataType["FILE"] = "FILE";
|
|
47
|
+
ClientLayoutItemFieldDataType["IMAGE"] = "IMAGE";
|
|
48
|
+
ClientLayoutItemFieldDataType["LONGTEXT"] = "LONGTEXT";
|
|
49
|
+
ClientLayoutItemFieldDataType["JSON"] = "JSON";
|
|
50
|
+
ClientLayoutItemFieldDataType["SECRET"] = "SECRET";
|
|
51
|
+
})(ClientLayoutItemFieldDataType || (ClientLayoutItemFieldDataType = {}));
|
|
52
|
+
// ─── Relation display / edit behaviour ───────────────────────────────────────
|
|
53
|
+
var ClientLayoutItemRelationDisplayType;
|
|
54
|
+
(function (ClientLayoutItemRelationDisplayType) {
|
|
55
|
+
ClientLayoutItemRelationDisplayType["SEARCH"] = "SEARCH";
|
|
56
|
+
ClientLayoutItemRelationDisplayType["DROPDOWN"] = "DROPDOWN";
|
|
57
|
+
ClientLayoutItemRelationDisplayType["CHECKBOX"] = "CHECKBOX";
|
|
58
|
+
})(ClientLayoutItemRelationDisplayType || (ClientLayoutItemRelationDisplayType = {}));
|
|
59
|
+
var ClientLayoutItemRelationEditBehavior;
|
|
60
|
+
(function (ClientLayoutItemRelationEditBehavior) {
|
|
61
|
+
ClientLayoutItemRelationEditBehavior["SEARCH"] = "SEARCH";
|
|
62
|
+
ClientLayoutItemRelationEditBehavior["DROPDOWN"] = "DROPDOWN";
|
|
63
|
+
ClientLayoutItemRelationEditBehavior["CHECKBOX"] = "CHECKBOX";
|
|
64
|
+
})(ClientLayoutItemRelationEditBehavior || (ClientLayoutItemRelationEditBehavior = {}));
|
|
65
|
+
// ─── VIEW / RELATED_VIEW navigate behaviour ──────────────────────────────────
|
|
66
|
+
/** How navigating from a row/document in this VIEW or RELATED_VIEW should open
|
|
67
|
+
* its target: a full page navigation, or an overlay on top of the current page. */
|
|
68
|
+
var ClientLayoutNavigateBehaviour;
|
|
69
|
+
(function (ClientLayoutNavigateBehaviour) {
|
|
70
|
+
ClientLayoutNavigateBehaviour["PAGE"] = "PAGE";
|
|
71
|
+
ClientLayoutNavigateBehaviour["OVERLAY_PAGE"] = "OVERLAY_PAGE";
|
|
72
|
+
})(ClientLayoutNavigateBehaviour || (ClientLayoutNavigateBehaviour = {}));
|
|
73
|
+
/** Well-known archetype ids the client renders specially. */
|
|
74
|
+
const ARCHETYPE_DOCUMENT = 'commons.document';
|
|
75
|
+
/**
|
|
76
|
+
* Find a binding for `archetypeId` in a published `archetypes` list.
|
|
77
|
+
* Returns `undefined` when the archetype is absent — callers fall back to the
|
|
78
|
+
* generic table/field rendering.
|
|
79
|
+
*/
|
|
80
|
+
function resolveArchetype(archetypes, archetypeId) {
|
|
81
|
+
return (archetypes !== null && archetypes !== void 0 ? archetypes : []).find(a => a.archetype === archetypeId);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { ARCHETYPE_DOCUMENT as A, ClientLayoutType as C, ClientLayoutItemType as a, ClientLayoutItemFieldDataType as b, ClientLayoutItemRelationDisplayType as c, ClientLayoutItemRelationEditBehavior as d, ClientLayoutNavigateBehaviour as e, resolveArchetype as r };
|
|
@@ -2,7 +2,7 @@ const NAMESPACE = 'mosterdcomponents';
|
|
|
2
2
|
const BUILD = /* mosterdcomponents */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
|
-
Stencil Client Platform v4.43.
|
|
5
|
+
Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
|
|
@@ -444,6 +444,31 @@ var convertToPrivate = (node) => {
|
|
|
444
444
|
return vnode;
|
|
445
445
|
};
|
|
446
446
|
|
|
447
|
+
// src/runtime/normalize-watchers.ts
|
|
448
|
+
var normalizeWatchers = (raw) => {
|
|
449
|
+
if (!raw) return void 0;
|
|
450
|
+
const keys = Object.keys(raw);
|
|
451
|
+
if (keys.length === 0) return void 0;
|
|
452
|
+
let hasLegacy = false;
|
|
453
|
+
for (const propName of keys) {
|
|
454
|
+
if (hasLegacy) break;
|
|
455
|
+
for (const h2 of raw[propName]) {
|
|
456
|
+
if (typeof h2 === "string") {
|
|
457
|
+
hasLegacy = true;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (!hasLegacy) return raw;
|
|
463
|
+
const out = {};
|
|
464
|
+
for (const propName of keys) {
|
|
465
|
+
out[propName] = raw[propName].map(
|
|
466
|
+
(h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
return out;
|
|
470
|
+
};
|
|
471
|
+
|
|
447
472
|
// src/runtime/parse-property-value.ts
|
|
448
473
|
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
449
474
|
if (propValue != null && !isComplexType(propValue)) {
|
|
@@ -1165,7 +1190,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1165
1190
|
if (cmpMeta.$members$ || BUILD.propChangeCallback) {
|
|
1166
1191
|
{
|
|
1167
1192
|
if (Cstr.watchers && !cmpMeta.$watchers$) {
|
|
1168
|
-
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1193
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1169
1194
|
}
|
|
1170
1195
|
if (Cstr.deserializers && !cmpMeta.$deserializers$) {
|
|
1171
1196
|
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
@@ -1291,11 +1316,13 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1291
1316
|
return;
|
|
1292
1317
|
}
|
|
1293
1318
|
const propFlags = members.find(([m]) => m === propName);
|
|
1294
|
-
|
|
1319
|
+
const isBooleanTarget = propFlags && propFlags[1][0] & 4 /* Boolean */;
|
|
1320
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
1321
|
+
if (isBooleanTarget) {
|
|
1295
1322
|
newValue = newValue === null || newValue === "false" ? false : true;
|
|
1296
1323
|
}
|
|
1297
1324
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
1298
|
-
if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
1325
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
1299
1326
|
this[propName] = newValue;
|
|
1300
1327
|
}
|
|
1301
1328
|
});
|
|
@@ -1336,7 +1363,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1336
1363
|
}
|
|
1337
1364
|
if (!Cstr.isProxied) {
|
|
1338
1365
|
{
|
|
1339
|
-
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1366
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1340
1367
|
cmpMeta.$serializers$ = Cstr.serializers;
|
|
1341
1368
|
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
1342
1369
|
}
|
|
@@ -1489,7 +1516,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1489
1516
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1490
1517
|
lazyBundles.map((lazyBundle) => {
|
|
1491
1518
|
lazyBundle[1].map((compactMeta) => {
|
|
1492
|
-
var _a2, _b
|
|
1519
|
+
var _a2, _b;
|
|
1493
1520
|
const cmpMeta = {
|
|
1494
1521
|
$flags$: compactMeta[0],
|
|
1495
1522
|
$tagName$: compactMeta[1],
|
|
@@ -1500,9 +1527,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1500
1527
|
cmpMeta.$members$ = compactMeta[2];
|
|
1501
1528
|
}
|
|
1502
1529
|
{
|
|
1503
|
-
cmpMeta.$watchers$ = (
|
|
1504
|
-
cmpMeta.$serializers$ = (
|
|
1505
|
-
cmpMeta.$deserializers$ = (
|
|
1530
|
+
cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
|
|
1531
|
+
cmpMeta.$serializers$ = (_a2 = compactMeta[5]) != null ? _a2 : {};
|
|
1532
|
+
cmpMeta.$deserializers$ = (_b = compactMeta[6]) != null ? _b : {};
|
|
1506
1533
|
}
|
|
1507
1534
|
const tagName = transformTag(cmpMeta.$tagName$);
|
|
1508
1535
|
const HostElement = class extends HTMLElement {
|