@streamline-pulse/formkrafter-wc 0.32.0 → 0.33.0

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.
Files changed (62) hide show
  1. package/dist/components/fk-address-search.js +1 -1
  2. package/dist/components/fk-brick-actions.js +1 -1
  3. package/dist/components/fk-brick-list.js +1 -1
  4. package/dist/components/fk-brick-mold-item.js +1 -1
  5. package/dist/components/fk-brick-render.js +1 -1
  6. package/dist/components/fk-data-grid.js +1 -1
  7. package/dist/components/fk-document-reader.js +1 -1
  8. package/dist/components/fk-drop-area.js +1 -1
  9. package/dist/components/fk-empty-form.js +1 -1
  10. package/dist/components/fk-file-input.js +1 -1
  11. package/dist/components/fk-form-builder.js +1 -1
  12. package/dist/components/fk-form-render.js +1 -1
  13. package/dist/components/fk-form-review.js +1 -1
  14. package/dist/components/fk-geo-map.js +1 -1
  15. package/dist/components/fk-key-value.js +1 -1
  16. package/dist/components/fk-property-panel.js +1 -1
  17. package/dist/components/fk-rules-editor.js +1 -1
  18. package/dist/components/fk-select-input.js +1 -1
  19. package/dist/components/fk-signature-input.js +1 -1
  20. package/dist/components/fk-slot-picker.js +1 -1
  21. package/dist/components/fk-stepper.js +1 -1
  22. package/dist/components/fk-tabs.js +1 -1
  23. package/dist/components/fk-variable-picker.js +1 -1
  24. package/dist/components/index.js +1 -1
  25. package/dist/components/p-1h77B3u4.js +1 -0
  26. package/dist/components/p-B5ahd_Cw.js +1 -0
  27. package/dist/components/{p-CiCus-k6.js → p-B9r10hw5.js} +1 -1
  28. package/dist/{formkrafter-wc/p-BTmgi7Os.js → components/p-BUNfBGJk.js} +1 -1
  29. package/dist/components/{p-DhMqRur8.js → p-Bp6ZBvZw.js} +1 -1
  30. package/dist/components/p-BwjcQm3z.js +1 -0
  31. package/dist/components/{p-Btv_oIu9.js → p-C1-BDfRz.js} +1 -1
  32. package/dist/components/{p-DSzmy6gE.js → p-C2_pMHW6.js} +1 -1
  33. package/dist/components/{p-Ddzv9Kss.js → p-C8z1D4cx.js} +1 -1
  34. package/dist/components/{p-XQBGaG8e.js → p-CB944u0q.js} +1 -1
  35. package/dist/components/p-CpJ54lk4.js +1 -0
  36. package/dist/components/{p-CEmIhc_b.js → p-CxH5d3E-.js} +1 -1
  37. package/dist/components/{p-D0mccXXB.js → p-D4KN8-B1.js} +1 -1
  38. package/dist/components/{p-CN7geIpq.js → p-DKURyEzf.js} +1 -1
  39. package/dist/components/p-D_HjV-j7.js +1 -0
  40. package/dist/components/{p-CjvAazPE.js → p-D_acWh61.js} +1 -1
  41. package/dist/components/{p-BjJfExeL.js → p-DpABp6LB.js} +1 -1
  42. package/dist/components/{p-CgJq9YFB.js → p-DvkJXOeH.js} +1 -1
  43. package/dist/components/{p-CGqbwBEB.js → p-YMqkgoWm.js} +1 -1
  44. package/dist/components/{p-DffIT6x6.js → p-cQx9YzoT.js} +1 -1
  45. package/dist/components/{p-D5ogjPcr.js → p-hY3kCpWp.js} +1 -1
  46. package/dist/components/{p-BcLjqaMC.js → p-iUvATvRT.js} +1 -1
  47. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  48. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  49. package/dist/formkrafter-wc/index.esm.js +1 -1
  50. package/dist/formkrafter-wc/p-24938237.entry.js +1 -0
  51. package/dist/formkrafter-wc/{p-0ba94634.entry.js → p-27895d32.entry.js} +1 -1
  52. package/dist/formkrafter-wc/{p-99e845ac.entry.js → p-807c20de.entry.js} +1 -1
  53. package/dist/formkrafter-wc/{p-BUOXWE9N.js → p-Bsi8X7Pm.js} +1 -1
  54. package/dist/{components/p-CxPTgcpX.js → formkrafter-wc/p-CHC4tD9O.js} +1 -1
  55. package/dist/types/components/fk-property-panel/fk-property-panel.d.ts +5 -0
  56. package/package.json +2 -2
  57. package/dist/components/p-BIViIbf-.js +0 -1
  58. package/dist/components/p-CHD0vvEI.js +0 -1
  59. package/dist/components/p-D5TzK0gS.js +0 -1
  60. package/dist/components/p-Dtl7_dcJ.js +0 -1
  61. package/dist/components/p-InuRlsz8.js +0 -1
  62. package/dist/formkrafter-wc/p-0f5d973f.entry.js +0 -1
@@ -1 +1 @@
1
- import{t,p as s,H as i,c as e,h as r}from"./p-8ICOcloT.js";import{b as a}from"./p-CN7geIpq.js";const n=s(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.signatureChange=e(this,"signatureChange"),this.disabled=!1,this.drawing=!1,this.start=t=>{if(this.disabled||!this.canvas)return;this.drawing=!0,this.canvas.setPointerCapture(t.pointerId);const s=this.context();s&&(s.lineWidth=2,s.lineCap="round",s.strokeStyle=getComputedStyle(this.canvas).color,s.beginPath(),s.moveTo(...this.position(t)))},this.move=t=>{if(!this.drawing)return;const s=this.context();s&&(s.lineTo(...this.position(t)),s.stroke())},this.end=()=>{this.drawing&&this.canvas&&(this.drawing=!1,this.lastEmitted=this.canvas.toDataURL("image/png"),this.signatureChange.emit(this.lastEmitted))},this.clear=()=>{const t=this.context();t&&this.canvas&&(t.clearRect(0,0,this.canvas.width,this.canvas.height),this.lastEmitted=void 0,this.signatureChange.emit(void 0))}}componentDidLoad(){this.restore()}onValueChange(t){t!==this.lastEmitted&&this.restore()}context(){var t,s;return null!==(s=null===(t=this.canvas)||void 0===t?void 0:t.getContext("2d"))&&void 0!==s?s:void 0}restore(){const t=this.context();if(!t||!this.canvas)return;if(t.clearRect(0,0,this.canvas.width,this.canvas.height),!this.value)return;const s=new Image;s.onload=()=>t.drawImage(s,0,0),s.src=this.value}position(t){const s=this.canvas.getBoundingClientRect();return[(t.clientX-s.left)*this.canvas.width/s.width,(t.clientY-s.top)*this.canvas.height/s.height]}render(){return r("div",{key:"7b391a7d20301ba7a06b402351b565830744e031",class:{"fk-signature":!0,"fk-signature--disabled":this.disabled}},r("canvas",{key:"2e3e59abbcea729a1b898d713d8e16de59763e13",class:"fk-signature__canvas",width:480,height:140,ref:t=>this.canvas=t,onPointerDown:this.start,onPointerMove:this.move,onPointerUp:this.end,onPointerLeave:this.end}),r("button",{key:"dc07b0f222a4c7f85765f0dece119443ce0fd244",type:"button",class:"fk-signature__clear",disabled:this.disabled,onClick:this.clear},a("signature.clear")))}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return".sc-fk-signature-input-h{display:block}.fk-signature.sc-fk-signature-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-signature__canvas.sc-fk-signature-input{width:100%;max-width:480px;border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);color:var(--fk-color-text);touch-action:none;cursor:crosshair}.fk-signature--disabled.sc-fk-signature-input .fk-signature__canvas.sc-fk-signature-input{cursor:not-allowed;opacity:0.6}.fk-signature__clear.sc-fk-signature-input{font:inherit;font-size:0.75rem;padding:3px 10px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-signature__clear.sc-fk-signature-input:hover:not(:disabled){color:var(--fk-color-danger);border-color:var(--fk-color-danger)}"}},[2,"fk-signature-input",{value:[1],disabled:[4]},void 0,{value:[{onValueChange:0}]}]);function o(){"undefined"!=typeof customElements&&["fk-signature-input"].forEach((s=>{"fk-signature-input"===s&&(customElements.get(t(s))||customElements.define(t(s),n))}))}o();export{n as F,o as d}
1
+ import{t,p as s,H as i,c as e,h as r}from"./p-8ICOcloT.js";import{b as a}from"./p-DKURyEzf.js";const n=s(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.signatureChange=e(this,"signatureChange"),this.disabled=!1,this.drawing=!1,this.start=t=>{if(this.disabled||!this.canvas)return;this.drawing=!0,this.canvas.setPointerCapture(t.pointerId);const s=this.context();s&&(s.lineWidth=2,s.lineCap="round",s.strokeStyle=getComputedStyle(this.canvas).color,s.beginPath(),s.moveTo(...this.position(t)))},this.move=t=>{if(!this.drawing)return;const s=this.context();s&&(s.lineTo(...this.position(t)),s.stroke())},this.end=()=>{this.drawing&&this.canvas&&(this.drawing=!1,this.lastEmitted=this.canvas.toDataURL("image/png"),this.signatureChange.emit(this.lastEmitted))},this.clear=()=>{const t=this.context();t&&this.canvas&&(t.clearRect(0,0,this.canvas.width,this.canvas.height),this.lastEmitted=void 0,this.signatureChange.emit(void 0))}}componentDidLoad(){this.restore()}onValueChange(t){t!==this.lastEmitted&&this.restore()}context(){var t,s;return null!==(s=null===(t=this.canvas)||void 0===t?void 0:t.getContext("2d"))&&void 0!==s?s:void 0}restore(){const t=this.context();if(!t||!this.canvas)return;if(t.clearRect(0,0,this.canvas.width,this.canvas.height),!this.value)return;const s=new Image;s.onload=()=>t.drawImage(s,0,0),s.src=this.value}position(t){const s=this.canvas.getBoundingClientRect();return[(t.clientX-s.left)*this.canvas.width/s.width,(t.clientY-s.top)*this.canvas.height/s.height]}render(){return r("div",{key:"7b391a7d20301ba7a06b402351b565830744e031",class:{"fk-signature":!0,"fk-signature--disabled":this.disabled}},r("canvas",{key:"2e3e59abbcea729a1b898d713d8e16de59763e13",class:"fk-signature__canvas",width:480,height:140,ref:t=>this.canvas=t,onPointerDown:this.start,onPointerMove:this.move,onPointerUp:this.end,onPointerLeave:this.end}),r("button",{key:"dc07b0f222a4c7f85765f0dece119443ce0fd244",type:"button",class:"fk-signature__clear",disabled:this.disabled,onClick:this.clear},a("signature.clear")))}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return".sc-fk-signature-input-h{display:block}.fk-signature.sc-fk-signature-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-signature__canvas.sc-fk-signature-input{width:100%;max-width:480px;border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);color:var(--fk-color-text);touch-action:none;cursor:crosshair}.fk-signature--disabled.sc-fk-signature-input .fk-signature__canvas.sc-fk-signature-input{cursor:not-allowed;opacity:0.6}.fk-signature__clear.sc-fk-signature-input{font:inherit;font-size:0.75rem;padding:3px 10px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-signature__clear.sc-fk-signature-input:hover:not(:disabled){color:var(--fk-color-danger);border-color:var(--fk-color-danger)}"}},[2,"fk-signature-input",{value:[1],disabled:[4]},void 0,{value:[{onValueChange:0}]}]);function o(){"undefined"!=typeof customElements&&["fk-signature-input"].forEach((s=>{"fk-signature-input"===s&&(customElements.get(t(s))||customElements.define(t(s),n))}))}o();export{n as F,o as d}
@@ -0,0 +1 @@
1
+ import{t,p as e,H as s,c as i,h as o}from"./p-8ICOcloT.js";import{k as r,l as a,p as c,s as l,n,m as h,b as d}from"./p-DKURyEzf.js";let f=0;const p=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectValueChange=i(this,"selectValueChange"),this.disabled=!1,this.multiple=!1,this.invalid=!1,this.open=!1,this.query="",this.activeIndex=0,this.instanceId="fk-select-"+ ++f,this.remoteOptions=[],this.catalogOptions=[],this.outsideClick=t=>{this.host.contains(t.target)||this.close()},this.onTriggerKeyDown=t=>{this.disabled||(["Enter"," ","ArrowDown","ArrowUp"].includes(t.key)?(t.preventDefault(),this.openDropdown()):"Escape"===t.key&&this.open&&(t.preventDefault(),this.close()))}}componentWillLoad(){return Promise.all([this.resolveRemote(),this.resolveCatalog()])}disconnectedCallback(){this.unbindOutsideClick()}onConfigsChange(){this.resolveRemote(),this.resolveCatalog()}onDataMapChange(){this.resolveRemote(),this.resolveCatalog()}searchParam(){var t;return(null===(t=this.configs)||void 0===t?void 0:t.searchParam)||void 0}remoteUrl(){var t;const e=null===(t=this.configs)||void 0===t?void 0:t.optionsUrl;if(!e)return;let s=r(e,this.dataMap);const i=this.searchParam();return i&&(s=a(s,i,this.query.trim())),s}bindOutsideClick(){document.addEventListener("mousedown",this.outsideClick)}unbindOutsideClick(){document.removeEventListener("mousedown",this.outsideClick)}toggleOpen(){this.disabled||(this.open?this.close():this.openDropdown())}openDropdown(){if(this.disabled||this.open)return;this.open=!0,this.query="";const{options:t}=this.resolve(),e=this.selectedValues(),s=t.findIndex((t=>e.includes(t.value)));this.activeIndex=s>=0?s:0,this.bindOutsideClick()}close(t=!1){var e;this.open=!1,this.unbindOutsideClick(),t&&(null===(e=this.triggerEl)||void 0===e||e.focus())}moveActive(t,e){e&&(this.activeIndex=(this.activeIndex+t+e)%e,this.scrollActiveIntoView())}scrollActiveIntoView(){requestAnimationFrame((()=>{var t;const e=this.host.querySelector(`#${this.instanceId}-opt-${this.activeIndex}`);null===(t=null==e?void 0:e.scrollIntoView)||void 0===t||t.call(e,{block:"nearest"})}))}onSearchKeyDown(t,e){var s;switch(t.key){case"ArrowDown":t.preventDefault(),this.moveActive(1,e.length);break;case"ArrowUp":t.preventDefault(),this.moveActive(-1,e.length);break;case"Home":t.preventDefault(),this.activeIndex=0,this.scrollActiveIntoView();break;case"End":t.preventDefault(),this.activeIndex=Math.max(e.length-1,0),this.scrollActiveIntoView();break;case"Enter":{t.preventDefault();const i=null!==(s=e[this.activeIndex])&&void 0!==s?s:e[0];i&&this.pick(i);break}case"Escape":t.preventDefault(),this.close(!0);break;case"Tab":this.close()}}source(){var t,e;return null!==(e=null===(t=this.configs)||void 0===t?void 0:t.optionsSource)&&void 0!==e?e:"static"}async resolveRemote(t=!1){var e,s;if("remote"!==this.source())return;const i=this.remoteUrl();if(!i)return void(this.remoteOptions=[]);const o=c(null===(e=this.configs)||void 0===e?void 0:e.optionsHeaders,this.dataMap),r=`${i}|${JSON.stringify(null!=o?o:{})}`;if(t||r!==this.lastRemoteSignature){this.lastRemoteSignature=r;try{this.remoteError=void 0;const t=null===(s=this.configs)||void 0===s?void 0:s.optionsPath;this.remoteOptions=await l.dataSourceService.fetchOptions(i,o||t?Object.assign(Object.assign({},o?{headers:o}:{}),t?{path:t}:{}):void 0)}catch(t){this.remoteOptions=[],this.remoteError=t instanceof Error?t.message:String(t)}}}async resolveCatalog(t=!1){var e;if("catalog"!==this.source())return;const s=(null===(e=this.configs)||void 0===e?void 0:e.optionsRef)||"",i=s?r(s,this.dataMap):"";if(i){if(t||i!==this.lastCatalogRef){this.lastCatalogRef=i;try{this.catalogError=void 0,this.catalogOptions=await l.optionSourceService.fetchOptions(i)}catch(t){this.catalogOptions=[],this.catalogError=t instanceof Error?t.message:String(t)}}}else this.catalogOptions=[]}onSearchInput(t){this.query=t,"remote"===this.source()&&this.searchParam()&&(this.searchTimer&&clearTimeout(this.searchTimer),this.searchTimer=setTimeout((()=>this.resolveRemote()),250))}resolve(){var t,e,s,i,o,r;const a=(null===(t=this.configs)||void 0===t?void 0:t.labelKey)||void 0,c=(null===(e=this.configs)||void 0===e?void 0:e.valueKey)||void 0;switch(this.source()){case"remote":return{options:n(this.remoteOptions,a,c),error:this.remoteError};case"catalog":return{options:n(this.catalogOptions,a,c),error:this.catalogError};case"dataMap":{const t=null===(s=this.configs)||void 0===s?void 0:s.optionsPath;return{options:n(t?null===(i=this.dataMap)||void 0===i?void 0:i[t]:[],a,c)}}case"js":{const t=null===(o=this.configs)||void 0===o?void 0:o.optionsCode;if(!t)return{options:[]};const e=h(t,this.dataMap);return e instanceof Error?{options:[],error:e.message}:{options:n(e,a,c)}}default:return{options:n(null===(r=this.configs)||void 0===r?void 0:r.options,a,c)}}}selectedValues(){return this.multiple?Array.isArray(this.value)?this.value:[]:"string"==typeof this.value&&""!==this.value?[this.value]:[]}labelOf(t,e){var s,i;return null!==(i=null===(s=e.find((e=>e.value===t)))||void 0===s?void 0:s.label)&&void 0!==i?i:t}pick(t){if(this.multiple){const e=this.selectedValues(),s=e.includes(t.value)?e.filter((e=>e!==t.value)):[...e,t.value];this.selectValueChange.emit(s.length?s:void 0)}else this.selectValueChange.emit(t.value),this.close(!0)}unpick(t){const e=this.selectedValues().filter((e=>e!==t));this.selectValueChange.emit(e.length?e:void 0)}filteredOptions(t){if("remote"===this.source()&&this.searchParam())return t;const e=this.query.trim().toLowerCase();return e?t.filter((t=>t.label.toLowerCase().includes(e))):t}render(){var t,e;const{options:s,error:i}=this.resolve(),r=this.selectedValues(),a=this.filteredOptions(s);return o("div",{key:"f77b463c7b945dfbbb106f6b144e5b773dd43cb0",class:{"fk-select":!0,"fk-select--disabled":this.disabled}},o("div",{key:"b9076ccd460a654289fce68f1c5900733b645390",class:{"fk-select__trigger":!0,"fk-select__trigger--open":this.open},role:"combobox",tabIndex:this.disabled?void 0:0,"aria-label":this.accessibleLabel,"aria-expanded":this.open?"true":"false","aria-haspopup":"listbox","aria-controls":`${this.instanceId}-listbox`,"aria-disabled":this.disabled?"true":void 0,"aria-invalid":this.invalid?"true":void 0,ref:t=>this.triggerEl=t,onKeyDown:this.onTriggerKeyDown,onClick:t=>{t.preventDefault(),this.toggleOpen()}},o("div",{key:"f15a47199afd2fd8fc89aef57740d7525da31143",class:"fk-select__values"},0===r.length?o("span",{class:"fk-select__placeholder"},String(null!==(e=null===(t=this.configs)||void 0===t?void 0:t.placeholder)&&void 0!==e?e:"")):this.multiple?r.map((t=>o("span",{class:"fk-select__chip",key:t},this.labelOf(t,s),o("button",{type:"button",class:"fk-select__chip-remove","aria-label":`${d("select.clear")} — ${this.labelOf(t,s)}`,disabled:this.disabled,onClick:e=>{e.preventDefault(),e.stopPropagation(),this.unpick(t)}},"✕")))):o("span",{class:"fk-select__value"},this.labelOf(r[0],s))),!this.multiple&&r.length>0&&!this.disabled?o("button",{type:"button",class:"fk-select__clear",title:d("select.clear"),"aria-label":d("select.clear"),onClick:t=>{t.preventDefault(),t.stopPropagation(),this.selectValueChange.emit(void 0)}},"✕"):null,o("span",{key:"7d7f2112170971d626418a8996149a8e3bdff5f8",class:"fk-select__caret"},"▾")),this.open?o("div",{class:"fk-select__dropdown"},o("input",{class:"fk-select__search",type:"text",placeholder:d("select.search"),value:this.query,role:"combobox","aria-label":this.accessibleLabel,"aria-expanded":"true","aria-autocomplete":"list","aria-controls":`${this.instanceId}-listbox`,"aria-activedescendant":a.length?`${this.instanceId}-opt-${Math.min(this.activeIndex,a.length-1)}`:void 0,ref:t=>setTimeout((()=>null==t?void 0:t.focus()),0),onInput:t=>{this.activeIndex=0,this.onSearchInput(t.target.value)},onKeyDown:t=>this.onSearchKeyDown(t,a)}),o("div",{class:"fk-select__options",role:"listbox",id:`${this.instanceId}-listbox`,"aria-multiselectable":this.multiple?"true":void 0},a.map(((t,e)=>{const s=r.includes(t.value),i=e===Math.min(this.activeIndex,a.length-1);return o("div",{key:t.value,id:`${this.instanceId}-opt-${e}`,role:"option","aria-selected":s?"true":"false",class:{"fk-select__option":!0,"fk-select__option--selected":s,"fk-select__option--active":i},onMouseEnter:()=>this.activeIndex=e,onClick:e=>{e.preventDefault(),this.pick(t)}},o("span",{class:"fk-select__option-label"},t.label),s?o("span",{class:"fk-select__check"},"✓"):null)})),0===a.length?o("p",{class:"fk-select__empty"},d("select.empty")):null)):null,i?o("span",{class:"fk-field__error"},i):null)}get host(){return this}static get watchers(){return{configs:[{onConfigsChange:0}],dataMap:[{onDataMapChange:0}]}}static get style(){return".sc-fk-select-input-h{display:block}.fk-select.sc-fk-select-input{position:relative;font-family:var(--fk-font)}.fk-select__trigger.sc-fk-select-input{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2);min-height:38px;padding:calc(var(--fk-spacing) / 2) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);color:var(--fk-color-text);cursor:pointer}.fk-select--disabled.sc-fk-select-input .fk-select__trigger.sc-fk-select-input{cursor:not-allowed;opacity:0.6}.fk-select__trigger--open.sc-fk-select-input{border-color:var(--fk-color-primary)}.fk-select__values.sc-fk-select-input{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:4px;min-width:0;font-size:0.9rem}.fk-select__placeholder.sc-fk-select-input{color:var(--fk-color-muted)}.fk-select__chip.sc-fk-select-input{display:inline-flex;align-items:center;gap:4px;padding:1px 8px;border-radius:999px;background:color-mix(in srgb, var(--fk-color-primary) 14%, transparent);color:var(--fk-color-primary);font-size:0.8rem;font-weight:600}.fk-select__chip-remove.sc-fk-select-input,.fk-select__clear.sc-fk-select-input{border:none;background:transparent;color:inherit;font-size:0.7rem;cursor:pointer;padding:0 2px}.fk-select__clear.sc-fk-select-input{color:var(--fk-color-muted)}.fk-select__clear.sc-fk-select-input:hover{color:var(--fk-color-danger)}.fk-select__caret.sc-fk-select-input{color:var(--fk-color-muted);font-size:0.8rem}.fk-select__dropdown.sc-fk-select-input{position:absolute;top:calc(100% + 4px);inset-inline:0;z-index:20;display:flex;flex-direction:column;border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);box-shadow:0 8px 24px var(--fk-color-shadow);overflow:hidden}.fk-select__search.sc-fk-select-input{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:none;border-bottom:1px solid var(--fk-color-border);background:transparent;color:var(--fk-color-text)}.fk-select__search.sc-fk-select-input:focus{outline:none}.fk-select__options.sc-fk-select-input{max-height:220px;overflow-y:auto}.fk-select__option.sc-fk-select-input{display:flex;align-items:center;justify-content:space-between;gap:var(--fk-spacing);padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);font-size:0.9rem;color:var(--fk-color-text);cursor:pointer}.fk-select__option.sc-fk-select-input:hover{background:color-mix(in srgb, var(--fk-color-primary) 8%, transparent)}.fk-select__option--selected.sc-fk-select-input{color:var(--fk-color-primary);font-weight:600}.fk-select__check.sc-fk-select-input{font-size:0.8rem}.fk-select__empty.sc-fk-select-input{margin:0;padding:var(--fk-spacing);font-size:0.85rem;color:var(--fk-color-muted)}.fk-select__trigger.sc-fk-select-input:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:1px}.fk-select__option--active.sc-fk-select-input{background:color-mix(in srgb, var(--fk-color-primary) 12%, transparent)}"}},[2,"fk-select-input",{configs:[16],value:[1],disabled:[4],multiple:[4],invalid:[4],dataMap:[16],accessibleLabel:[1,"accessible-label"],open:[32],query:[32],activeIndex:[32],remoteOptions:[32],remoteError:[32],catalogOptions:[32],catalogError:[32]},void 0,{configs:[{onConfigsChange:0}],dataMap:[{onDataMapChange:0}]}]);function u(){"undefined"!=typeof customElements&&["fk-select-input"].forEach((e=>{"fk-select-input"===e&&(customElements.get(t(e))||customElements.define(t(e),p))}))}u();export{p as F,u as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as o,c as l,h as a}from"./p-8ICOcloT.js";import{b as i}from"./p-CN7geIpq.js";const r=new Map,n=e=>Math.round(1e6*e)/1e6,s=e=>[n(e.lng),n(e.lat)],f=t(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.geoChange=l(this,"geoChange"),this.layerChange=l(this,"layerChange"),this.mode="point",this.zoom=6,this.tileUrl="https://tile.openstreetmap.org/{z}/{x}/{y}.png",this.attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',this.height=320,this.disabled=!1,this.readOnly=!1,this.manual=!0,this.layerCodeProperty="code",this.layerNameProperty="name",this.selected=[],this.multiple=!1,this.failed=!1,this.vertexCount=0,this.zones=[],this.layerFailed=!1,this.shapes=[],this.vertices=[],this.lastEmitted="",this.clear=()=>{this.locked||this.setVertices([])}}get locked(){return this.disabled||this.readOnly}async componentDidLoad(){var e;"layer"===this.mode&&this.fetchLayer();try{const t=await import("./p-CxPTgcpX.js").then((function(e){return e.l}));this.L=null!==(e=t.default)&&void 0!==e?e:t}catch(e){return void(this.failed=!0)}this.container&&this.initMap()}disconnectedCallback(){var e,t;null===(e=this.observer)||void 0===e||e.disconnect(),null===(t=this.map)||void 0===t||t.remove(),this.map=void 0}onValueChange(e){JSON.stringify(null!=e?e:null)!==this.lastEmitted&&this.draw(e)}onLockChange(){this.draw(this.value),this.restyleLayer()}onSelectedChange(){this.restyleLayer()}onLayerUrlChange(){this.fetchLayer()}initMap(){var e;const t=this.L,o=this.container,l=t.map(o,{attributionControl:!0,zoomControl:!this.locked});t.tileLayer(this.tileUrl,{attribution:this.attribution,maxZoom:19}).addTo(l),l.setView(null!==(e=this.center)&&void 0!==e?e:[0,0],this.center?this.zoom:2),this.locked&&(l.dragging.disable(),l.scrollWheelZoom.disable()),l.on("click",(e=>{this.locked||"layer"===this.mode||this.setVertices("point"===this.mode?[e.latlng]:[...this.vertices,e.latlng])})),this.map=l,this.draw(this.value),this.drawLayer(),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>l.invalidateSize())),this.observer.observe(o)),setTimeout((()=>l.invalidateSize()),50)}draw(e){var t;const o=this.L,l=this.map;if(!o||!l)return void(this.vertexCount=this.countVertices(e));const a=[];if("Point"===(null==e?void 0:e.type)&&a.push(o.latLng(e.coordinates[1],e.coordinates[0])),"LineString"===(null==e?void 0:e.type))for(const[t,l]of e.coordinates)a.push(o.latLng(l,t));if("Polygon"===(null==e?void 0:e.type)){const l=null!==(t=e.coordinates[0])&&void 0!==t?t:[],i=l.length>1&&l[0][0]===l[l.length-1][0]&&l[0][1]===l[l.length-1][1]?l.slice(0,-1):l;for(const[e,t]of i)a.push(o.latLng(t,e))}this.vertices=a,this.vertexCount=a.length,this.render_shapes(),1===a.length?l.setView(a[0],Math.max(l.getZoom(),this.zoom)):a.length>1&&l.fitBounds(o.latLngBounds(a),{padding:[24,24]})}countVertices(e){var t,o;return e?"Point"===e.type?1:"LineString"===e.type?e.coordinates.length:Math.max((null!==(o=null===(t=e.coordinates[0])||void 0===t?void 0:t.length)&&void 0!==o?o:1)-1,0):0}render_shapes(){const e=this.L,t=this.map;if(!e||!t)return;for(const e of this.shapes)e.remove();this.shapes=[];const o=this.vertices;"polygon"===this.mode&&o.length>=3&&this.shapes.push(e.polygon(o,{className:"fk-geo__shape"}).addTo(t)),"line"===this.mode&&o.length>=2&&this.shapes.push(e.polyline(o,{className:"fk-geo__shape"}).addTo(t)),o.forEach(((o,l)=>{const a=e.marker(o,{draggable:!this.locked,icon:e.divIcon({className:"fk-geo__marker",iconSize:[14,14],iconAnchor:[7,7]})}).addTo(t);a.on("dragend",(()=>{const e=[...this.vertices];e[l]=a.getLatLng(),this.setVertices(e)})),"point"!==this.mode&&a.on("contextmenu",(()=>{this.locked||this.setVertices(this.vertices.filter(((e,t)=>t!==l)))})),this.shapes.push(a)}))}setVertices(e){this.vertices=e,this.vertexCount=e.length,this.render_shapes(),this.emit()}geometry(){const e=this.vertices;if("point"===this.mode)return e[0]?{type:"Point",coordinates:s(e[0])}:void 0;if("line"===this.mode)return e.length>=2?{type:"LineString",coordinates:e.map(s)}:void 0;if(e.length<3)return;const t=e.map(s);return{type:"Polygon",coordinates:[[...t,t[0]]]}}emit(){const e=this.geometry();this.lastEmitted=JSON.stringify(null!=e?e:null),this.geoChange.emit(e)}setManual(e,t){var o,l,a;if(this.locked)return;if(""===t.trim())return this.vertices=[],this.vertexCount=0,this.render_shapes(),void this.emit();const i="Point"===(null===(o=this.value)||void 0===o?void 0:o.type)?this.value.coordinates:void 0,r="lat"===e?Number(t):null!==(l=null==i?void 0:i[1])&&void 0!==l?l:NaN,n="lng"===e?Number(t):null!==(a=null==i?void 0:i[0])&&void 0!==a?a:NaN;if(Number.isNaN(r)||Number.isNaN(n))return;const s=this.L?this.L.latLng(r,n):{lat:r,lng:n};this.vertices=[s],this.vertexCount=1,this.render_shapes(),this.map&&this.map.setView(s,Math.max(this.map.getZoom(),this.zoom)),this.emit()}componentDidRender(){var e;this.selectEl&&"layer"===this.mode&&(this.selectEl.value=null!==(e=this.selected[0])&&void 0!==e?e:"")}zoneOf(e){var t;const o=null!==(t=e.properties)&&void 0!==t?t:{},l=o[this.layerCodeProperty],a=o[this.layerNameProperty];return null==l||""===l?null:{code:String(l),name:String(null==a?l:a)}}async fetchLayer(){var e;if(this.layerFailed=!1,!this.layerUrl)return this.layerData=void 0,this.zones=[],void this.drawLayer();try{const t=await(e=>{let t=r.get(e);return t||(t=fetch(e,{headers:{Accept:"application/geo+json, application/json"}}).then((async e=>{if(!e.ok)throw new Error(String(e.status));return await e.json()})),t.catch((()=>r.delete(e))),r.set(e,t)),t})(this.layerUrl);this.layerData=t,this.zones=(null!==(e=t.features)&&void 0!==e?e:[]).map((e=>this.zoneOf(e))).filter((e=>null!==e)).sort(((e,t)=>e.name.localeCompare(t.name))),this.drawLayer()}catch(e){this.layerFailed=!0}}layerStyle(e){const t=null!==e&&this.selected.includes(e);return{className:t?"fk-geo__zone fk-geo__zone--selected":"fk-geo__zone",weight:t?2:1,fillOpacity:t?.45:.1}}drawLayer(){var e;const t=this.L,o=this.map;if(!t||!o||"layer"!==this.mode)return;if(null===(e=this.layer)||void 0===e||e.remove(),this.layer=void 0,!this.layerData)return;const l=t.geoJSON(this.layerData,{style:e=>{var t,o;return this.layerStyle(e&&null!==(o=null===(t=this.zoneOf(e))||void 0===t?void 0:t.code)&&void 0!==o?o:null)},onEachFeature:(e,t)=>{const o=this.zoneOf(e);o&&(t.bindTooltip(o.name,{sticky:!0}),t.on("click",(()=>{this.locked||this.toggleZone(o)})))}}).addTo(o);this.layer=l;const a=l.getBounds();(a.isValid()&&!this.selected.length||a.isValid()&&this.selected.length)&&o.fitBounds(a,{padding:[16,16]})}restyleLayer(){const e=this.layer;e&&e.setStyle((e=>{var t,o;return this.layerStyle(e&&null!==(o=null===(t=this.zoneOf(e))||void 0===t?void 0:t.code)&&void 0!==o?o:null)}))}toggleZone(e){const t=this.selected.includes(e.code),o=this.multiple?t?this.selected.filter((t=>t!==e.code)):[...this.selected,e.code]:t?[]:[e.code];this.emitZones(o)}emitZones(e){const t=new Map(this.zones.map((e=>[e.code,e])));this.layerChange.emit(e.map((e=>{var o;return null!==(o=t.get(e))&&void 0!==o?o:{code:e,name:e}})))}renderLayerBar(){const e=this.selected.map((e=>{var t;return null!==(t=this.zones.find((t=>t.code===e)))&&void 0!==t?t:{code:e,name:e}}));return a("div",{class:"fk-geo__bar"},this.layerFailed?a("span",{class:"fk-geo__summary"},i("layer.unavailable")):this.multiple?a("span",{class:"fk-geo__chips"},0===e.length?a("span",{class:"fk-geo__summary"},i("layer.pickMany")):e.map((e=>a("span",{class:"fk-geo__chip"},e.name,this.locked?null:a("button",{type:"button",class:"fk-geo__chip-remove","aria-label":i("geo.clear"),onClick:()=>this.toggleZone(e)},"×"))))):a("select",{class:"fk-field__input fk-geo__select",ref:e=>{this.selectEl=e},disabled:this.locked,onChange:e=>{const t=e.target.value;this.emitZones(t?[t]:[])}},a("option",{value:"",selected:!this.selected.length},i("layer.pick")),this.zones.map((e=>a("option",{value:e.code,selected:this.selected[0]===e.code},e.name)))),this.locked||this.layerFailed?null:a("span",{class:"fk-geo__hint"},i("layer.hint")))}render(){var e;const t="Point"===(null===(e=this.value)||void 0===e?void 0:e.type)?this.value.coordinates:void 0,o=i("point"===this.mode?"geo.hintPoint":"geo.hintArea");return a("div",{key:"3adf67d52e87de730d1f33c1f4aa5d56d93c9201",class:{"fk-geo":!0,"fk-geo--locked":this.locked}},a("div",{key:"f78144732a57ea5f25d1d15b1608823b2cab50e7",class:"fk-geo__map",style:{height:`${this.height}px`},ref:e=>{this.container=e}},this.failed?a("div",{class:"fk-geo__unavailable"},i("geo.unavailable")):null),"layer"===this.mode?this.renderLayerBar():a("div",{class:"fk-geo__bar"},"point"===this.mode&&this.manual?a("div",{class:"fk-geo__manual"},a("label",{class:"fk-geo__coord"},a("span",null,i("geo.latitude")),a("input",{class:"fk-field__input",type:"number",step:"any",min:"-90",max:"90",value:t?String(t[1]):"",disabled:this.disabled,readOnly:this.readOnly,onChange:e=>this.setManual("lat",e.target.value)})),a("label",{class:"fk-geo__coord"},a("span",null,i("geo.longitude")),a("input",{class:"fk-field__input",type:"number",step:"any",min:"-180",max:"180",value:t?String(t[0]):"",disabled:this.disabled,readOnly:this.readOnly,onChange:e=>this.setManual("lng",e.target.value)}))):a("span",{class:"fk-geo__summary"},this.vertexCount," ",i("geo.points")),this.locked?null:a("span",{class:"fk-geo__actions"},a("span",{class:"fk-geo__hint"},o),this.vertexCount>0?a("button",{type:"button",class:"fk-geo__clear",onClick:this.clear},i("geo.clear")):null)))}get el(){return this}static get watchers(){return{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}}static get style(){return'.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none !important;max-height:none !important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none !important;max-height:none !important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51, 181, 229, 0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform 0.25s cubic-bezier(0,0,0.25,1);-moz-transition:-moz-transform 0.25s cubic-bezier(0,0,0.25,1);transition:transform 0.25s cubic-bezier(0,0,0.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078A8}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,0.5)}.leaflet-container{font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;font-size:12px;font-size:0.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,0.65);border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:black}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px \'Lucida Console\', Monaco, monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,0.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255, 255, 255, 0.8);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline !important;vertical-align:baseline !important;width:1em;height:0.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:rgba(255, 255, 255, 0.8);text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,0.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:17px 0;margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:white;color:#333;box-shadow:0 3px 14px rgba(0,0,0,0.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma, Verdana, sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,0.4)}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}fk-geo-map{display:block;width:100%}.fk-geo__map{width:100%;border:1px solid var(--fk-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);overflow:hidden;background:var(--fk-bg-muted, #f4f4f5);position:relative}.fk-geo--locked .fk-geo__map{cursor:default}.fk-geo__unavailable{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:0.875rem;color:var(--fk-text-muted, #71717a)}.fk-geo__marker{width:14px;height:14px;border-radius:50%;background:var(--fk-primary, #16a34a);border:2px solid #fff;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25)}.fk-geo__shape{stroke:var(--fk-primary, #16a34a);fill:var(--fk-primary, #16a34a);fill-opacity:0.15}.fk-geo__bar{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:0.5rem 1rem;margin-top:0.5rem}.fk-geo__manual{display:flex;gap:0.75rem}.fk-geo__coord{display:flex;flex-direction:column;gap:0.25rem;font-size:0.75rem;color:var(--fk-text-muted, #71717a)}.fk-geo__coord input{width:9rem}.fk-geo__summary,.fk-geo__hint{font-size:0.75rem;color:var(--fk-text-muted, #71717a)}.fk-geo__actions{display:flex;align-items:center;gap:0.75rem}.fk-geo__clear{border:1px solid var(--fk-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);background:transparent;color:inherit;font:inherit;font-size:0.75rem;padding:0.25rem 0.625rem;cursor:pointer}.fk-geo__clear:hover{background:var(--fk-bg-muted, rgba(127, 127, 127, 0.12))}.fk-geo__zone{stroke:var(--fk-primary, #16a34a);fill:var(--fk-primary, #16a34a);cursor:pointer}.fk-geo__select{min-width:14rem}.fk-geo__chips{display:flex;flex-wrap:wrap;gap:0.375rem}.fk-geo__chip{display:inline-flex;align-items:center;gap:0.25rem;padding:0.125rem 0.5rem;border-radius:999px;background:var(--fk-bg-muted, rgba(127, 127, 127, 0.12));font-size:0.75rem}.fk-geo__chip-remove{border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;line-height:1}'}},[0,"fk-geo-map",{value:[16],mode:[1],center:[16],zoom:[2],tileUrl:[1,"tile-url"],attribution:[1],height:[2],disabled:[4],readOnly:[4,"read-only"],manual:[4],layerUrl:[1,"layer-url"],layerCodeProperty:[1,"layer-code-property"],layerNameProperty:[1,"layer-name-property"],selected:[16],multiple:[4],failed:[32],vertexCount:[32],zones:[32],layerFailed:[32]},void 0,{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}]);function p(){"undefined"!=typeof customElements&&["fk-geo-map"].forEach((t=>{"fk-geo-map"===t&&(customElements.get(e(t))||customElements.define(e(t),f))}))}p();export{f as F,p as d}
1
+ import{t as e,p as t,H as o,c as l,h as a}from"./p-8ICOcloT.js";import{b as i}from"./p-DKURyEzf.js";const r=new Map,n=e=>Math.round(1e6*e)/1e6,s=e=>[n(e.lng),n(e.lat)],f=t(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.geoChange=l(this,"geoChange"),this.layerChange=l(this,"layerChange"),this.mode="point",this.zoom=6,this.tileUrl="https://tile.openstreetmap.org/{z}/{x}/{y}.png",this.attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',this.height=320,this.disabled=!1,this.readOnly=!1,this.manual=!0,this.layerCodeProperty="code",this.layerNameProperty="name",this.selected=[],this.multiple=!1,this.failed=!1,this.vertexCount=0,this.zones=[],this.layerFailed=!1,this.shapes=[],this.vertices=[],this.lastEmitted="",this.clear=()=>{this.locked||this.setVertices([])}}get locked(){return this.disabled||this.readOnly}async componentDidLoad(){var e;"layer"===this.mode&&this.fetchLayer();try{const t=await import("./p-BUNfBGJk.js").then((function(e){return e.l}));this.L=null!==(e=t.default)&&void 0!==e?e:t}catch(e){return void(this.failed=!0)}this.container&&this.initMap()}disconnectedCallback(){var e,t;null===(e=this.observer)||void 0===e||e.disconnect(),null===(t=this.map)||void 0===t||t.remove(),this.map=void 0}onValueChange(e){JSON.stringify(null!=e?e:null)!==this.lastEmitted&&this.draw(e)}onLockChange(){this.draw(this.value),this.restyleLayer()}onSelectedChange(){this.restyleLayer()}onLayerUrlChange(){this.fetchLayer()}initMap(){var e;const t=this.L,o=this.container,l=t.map(o,{attributionControl:!0,zoomControl:!this.locked});t.tileLayer(this.tileUrl,{attribution:this.attribution,maxZoom:19}).addTo(l),l.setView(null!==(e=this.center)&&void 0!==e?e:[0,0],this.center?this.zoom:2),this.locked&&(l.dragging.disable(),l.scrollWheelZoom.disable()),l.on("click",(e=>{this.locked||"layer"===this.mode||this.setVertices("point"===this.mode?[e.latlng]:[...this.vertices,e.latlng])})),this.map=l,this.draw(this.value),this.drawLayer(),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>l.invalidateSize())),this.observer.observe(o)),setTimeout((()=>l.invalidateSize()),50)}draw(e){var t;const o=this.L,l=this.map;if(!o||!l)return void(this.vertexCount=this.countVertices(e));const a=[];if("Point"===(null==e?void 0:e.type)&&a.push(o.latLng(e.coordinates[1],e.coordinates[0])),"LineString"===(null==e?void 0:e.type))for(const[t,l]of e.coordinates)a.push(o.latLng(l,t));if("Polygon"===(null==e?void 0:e.type)){const l=null!==(t=e.coordinates[0])&&void 0!==t?t:[],i=l.length>1&&l[0][0]===l[l.length-1][0]&&l[0][1]===l[l.length-1][1]?l.slice(0,-1):l;for(const[e,t]of i)a.push(o.latLng(t,e))}this.vertices=a,this.vertexCount=a.length,this.render_shapes(),1===a.length?l.setView(a[0],Math.max(l.getZoom(),this.zoom)):a.length>1&&l.fitBounds(o.latLngBounds(a),{padding:[24,24]})}countVertices(e){var t,o;return e?"Point"===e.type?1:"LineString"===e.type?e.coordinates.length:Math.max((null!==(o=null===(t=e.coordinates[0])||void 0===t?void 0:t.length)&&void 0!==o?o:1)-1,0):0}render_shapes(){const e=this.L,t=this.map;if(!e||!t)return;for(const e of this.shapes)e.remove();this.shapes=[];const o=this.vertices;"polygon"===this.mode&&o.length>=3&&this.shapes.push(e.polygon(o,{className:"fk-geo__shape"}).addTo(t)),"line"===this.mode&&o.length>=2&&this.shapes.push(e.polyline(o,{className:"fk-geo__shape"}).addTo(t)),o.forEach(((o,l)=>{const a=e.marker(o,{draggable:!this.locked,icon:e.divIcon({className:"fk-geo__marker",iconSize:[14,14],iconAnchor:[7,7]})}).addTo(t);a.on("dragend",(()=>{const e=[...this.vertices];e[l]=a.getLatLng(),this.setVertices(e)})),"point"!==this.mode&&a.on("contextmenu",(()=>{this.locked||this.setVertices(this.vertices.filter(((e,t)=>t!==l)))})),this.shapes.push(a)}))}setVertices(e){this.vertices=e,this.vertexCount=e.length,this.render_shapes(),this.emit()}geometry(){const e=this.vertices;if("point"===this.mode)return e[0]?{type:"Point",coordinates:s(e[0])}:void 0;if("line"===this.mode)return e.length>=2?{type:"LineString",coordinates:e.map(s)}:void 0;if(e.length<3)return;const t=e.map(s);return{type:"Polygon",coordinates:[[...t,t[0]]]}}emit(){const e=this.geometry();this.lastEmitted=JSON.stringify(null!=e?e:null),this.geoChange.emit(e)}setManual(e,t){var o,l,a;if(this.locked)return;if(""===t.trim())return this.vertices=[],this.vertexCount=0,this.render_shapes(),void this.emit();const i="Point"===(null===(o=this.value)||void 0===o?void 0:o.type)?this.value.coordinates:void 0,r="lat"===e?Number(t):null!==(l=null==i?void 0:i[1])&&void 0!==l?l:NaN,n="lng"===e?Number(t):null!==(a=null==i?void 0:i[0])&&void 0!==a?a:NaN;if(Number.isNaN(r)||Number.isNaN(n))return;const s=this.L?this.L.latLng(r,n):{lat:r,lng:n};this.vertices=[s],this.vertexCount=1,this.render_shapes(),this.map&&this.map.setView(s,Math.max(this.map.getZoom(),this.zoom)),this.emit()}componentDidRender(){var e;this.selectEl&&"layer"===this.mode&&(this.selectEl.value=null!==(e=this.selected[0])&&void 0!==e?e:"")}zoneOf(e){var t;const o=null!==(t=e.properties)&&void 0!==t?t:{},l=o[this.layerCodeProperty],a=o[this.layerNameProperty];return null==l||""===l?null:{code:String(l),name:String(null==a?l:a)}}async fetchLayer(){var e;if(this.layerFailed=!1,!this.layerUrl)return this.layerData=void 0,this.zones=[],void this.drawLayer();try{const t=await(e=>{let t=r.get(e);return t||(t=fetch(e,{headers:{Accept:"application/geo+json, application/json"}}).then((async e=>{if(!e.ok)throw new Error(String(e.status));return await e.json()})),t.catch((()=>r.delete(e))),r.set(e,t)),t})(this.layerUrl);this.layerData=t,this.zones=(null!==(e=t.features)&&void 0!==e?e:[]).map((e=>this.zoneOf(e))).filter((e=>null!==e)).sort(((e,t)=>e.name.localeCompare(t.name))),this.drawLayer()}catch(e){this.layerFailed=!0}}layerStyle(e){const t=null!==e&&this.selected.includes(e);return{className:t?"fk-geo__zone fk-geo__zone--selected":"fk-geo__zone",weight:t?2:1,fillOpacity:t?.45:.1}}drawLayer(){var e;const t=this.L,o=this.map;if(!t||!o||"layer"!==this.mode)return;if(null===(e=this.layer)||void 0===e||e.remove(),this.layer=void 0,!this.layerData)return;const l=t.geoJSON(this.layerData,{style:e=>{var t,o;return this.layerStyle(e&&null!==(o=null===(t=this.zoneOf(e))||void 0===t?void 0:t.code)&&void 0!==o?o:null)},onEachFeature:(e,t)=>{const o=this.zoneOf(e);o&&(t.bindTooltip(o.name,{sticky:!0}),t.on("click",(()=>{this.locked||this.toggleZone(o)})))}}).addTo(o);this.layer=l;const a=l.getBounds();(a.isValid()&&!this.selected.length||a.isValid()&&this.selected.length)&&o.fitBounds(a,{padding:[16,16]})}restyleLayer(){const e=this.layer;e&&e.setStyle((e=>{var t,o;return this.layerStyle(e&&null!==(o=null===(t=this.zoneOf(e))||void 0===t?void 0:t.code)&&void 0!==o?o:null)}))}toggleZone(e){const t=this.selected.includes(e.code),o=this.multiple?t?this.selected.filter((t=>t!==e.code)):[...this.selected,e.code]:t?[]:[e.code];this.emitZones(o)}emitZones(e){const t=new Map(this.zones.map((e=>[e.code,e])));this.layerChange.emit(e.map((e=>{var o;return null!==(o=t.get(e))&&void 0!==o?o:{code:e,name:e}})))}renderLayerBar(){const e=this.selected.map((e=>{var t;return null!==(t=this.zones.find((t=>t.code===e)))&&void 0!==t?t:{code:e,name:e}}));return a("div",{class:"fk-geo__bar"},this.layerFailed?a("span",{class:"fk-geo__summary"},i("layer.unavailable")):this.multiple?a("span",{class:"fk-geo__chips"},0===e.length?a("span",{class:"fk-geo__summary"},i("layer.pickMany")):e.map((e=>a("span",{class:"fk-geo__chip"},e.name,this.locked?null:a("button",{type:"button",class:"fk-geo__chip-remove","aria-label":i("geo.clear"),onClick:()=>this.toggleZone(e)},"×"))))):a("select",{class:"fk-field__input fk-geo__select",ref:e=>{this.selectEl=e},disabled:this.locked,onChange:e=>{const t=e.target.value;this.emitZones(t?[t]:[])}},a("option",{value:"",selected:!this.selected.length},i("layer.pick")),this.zones.map((e=>a("option",{value:e.code,selected:this.selected[0]===e.code},e.name)))),this.locked||this.layerFailed?null:a("span",{class:"fk-geo__hint"},i("layer.hint")))}render(){var e;const t="Point"===(null===(e=this.value)||void 0===e?void 0:e.type)?this.value.coordinates:void 0,o=i("point"===this.mode?"geo.hintPoint":"geo.hintArea");return a("div",{key:"3adf67d52e87de730d1f33c1f4aa5d56d93c9201",class:{"fk-geo":!0,"fk-geo--locked":this.locked}},a("div",{key:"f78144732a57ea5f25d1d15b1608823b2cab50e7",class:"fk-geo__map",style:{height:`${this.height}px`},ref:e=>{this.container=e}},this.failed?a("div",{class:"fk-geo__unavailable"},i("geo.unavailable")):null),"layer"===this.mode?this.renderLayerBar():a("div",{class:"fk-geo__bar"},"point"===this.mode&&this.manual?a("div",{class:"fk-geo__manual"},a("label",{class:"fk-geo__coord"},a("span",null,i("geo.latitude")),a("input",{class:"fk-field__input",type:"number",step:"any",min:"-90",max:"90",value:t?String(t[1]):"",disabled:this.disabled,readOnly:this.readOnly,onChange:e=>this.setManual("lat",e.target.value)})),a("label",{class:"fk-geo__coord"},a("span",null,i("geo.longitude")),a("input",{class:"fk-field__input",type:"number",step:"any",min:"-180",max:"180",value:t?String(t[0]):"",disabled:this.disabled,readOnly:this.readOnly,onChange:e=>this.setManual("lng",e.target.value)}))):a("span",{class:"fk-geo__summary"},this.vertexCount," ",i("geo.points")),this.locked?null:a("span",{class:"fk-geo__actions"},a("span",{class:"fk-geo__hint"},o),this.vertexCount>0?a("button",{type:"button",class:"fk-geo__clear",onClick:this.clear},i("geo.clear")):null)))}get el(){return this}static get watchers(){return{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}}static get style(){return'.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none !important;max-height:none !important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none !important;max-height:none !important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51, 181, 229, 0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform 0.25s cubic-bezier(0,0,0.25,1);-moz-transition:-moz-transform 0.25s cubic-bezier(0,0,0.25,1);transition:transform 0.25s cubic-bezier(0,0,0.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078A8}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,0.5)}.leaflet-container{font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;font-size:12px;font-size:0.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,0.65);border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:black}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px \'Lucida Console\', Monaco, monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,0.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255, 255, 255, 0.8);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline !important;vertical-align:baseline !important;width:1em;height:0.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:rgba(255, 255, 255, 0.8);text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,0.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:17px 0;margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:white;color:#333;box-shadow:0 3px 14px rgba(0,0,0,0.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma, Verdana, sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,0.4)}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}fk-geo-map{display:block;width:100%}.fk-geo__map{width:100%;border:1px solid var(--fk-color-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);overflow:hidden;background:var(--fk-color-hover, #f4f4f5);position:relative}.fk-geo--locked .fk-geo__map{cursor:default}.fk-geo__unavailable{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:0.875rem;color:var(--fk-color-muted, #71717a)}.fk-geo__marker{width:14px;height:14px;border-radius:50%;background:var(--fk-color-primary, #16a34a);border:2px solid #fff;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25)}.fk-geo__shape{stroke:var(--fk-color-primary, #16a34a);fill:var(--fk-color-primary, #16a34a);fill-opacity:0.15}.fk-geo__bar{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:0.5rem 1rem;margin-top:0.5rem}.fk-geo__manual{display:flex;gap:0.75rem}.fk-geo__coord{display:flex;flex-direction:column;gap:0.25rem;font-size:0.75rem;color:var(--fk-color-muted, #71717a)}.fk-geo__coord input{width:9rem}.fk-geo__summary,.fk-geo__hint{font-size:0.75rem;color:var(--fk-color-muted, #71717a)}.fk-geo__actions{display:flex;align-items:center;gap:0.75rem}.fk-geo__clear{border:1px solid var(--fk-color-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);background:transparent;color:inherit;font:inherit;font-size:0.75rem;padding:0.25rem 0.625rem;cursor:pointer}.fk-geo__clear:hover{background:var(--fk-color-hover, rgba(127, 127, 127, 0.12))}.fk-geo__zone{stroke:var(--fk-color-primary, #16a34a);fill:var(--fk-color-primary, #16a34a);cursor:pointer}.fk-geo__select{min-width:14rem}.fk-geo__chips{display:flex;flex-wrap:wrap;gap:0.375rem}.fk-geo__chip{display:inline-flex;align-items:center;gap:0.25rem;padding:0.125rem 0.5rem;border-radius:999px;background:var(--fk-color-hover, rgba(127, 127, 127, 0.12));font-size:0.75rem}.fk-geo__chip-remove{border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;line-height:1}'}},[0,"fk-geo-map",{value:[16],mode:[1],center:[16],zoom:[2],tileUrl:[1,"tile-url"],attribution:[1],height:[2],disabled:[4],readOnly:[4,"read-only"],manual:[4],layerUrl:[1,"layer-url"],layerCodeProperty:[1,"layer-code-property"],layerNameProperty:[1,"layer-name-property"],selected:[16],multiple:[4],failed:[32],vertexCount:[32],zones:[32],layerFailed:[32]},void 0,{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}]);function p(){"undefined"!=typeof customElements&&["fk-geo-map"].forEach((t=>{"fk-geo-map"===t&&(customElements.get(e(t))||customElements.define(e(t),f))}))}p();export{f as F,p as d}
@@ -1 +1 @@
1
- import{t as r,p as i,H as t,c as o,h as s}from"./p-8ICOcloT.js";import{v as e,b as a,f as d}from"./p-CN7geIpq.js";import{d as n}from"./p-Ddzv9Kss.js";import{d as c}from"./p-CIgvEKbO.js";import{d as l}from"./p-D5ogjPcr.js";import{d as f}from"./p-CgJq9YFB.js";const h=i(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.gridValueChange=o(this,"gridValueChange"),this.brickReviewChange=o(this,"brickReviewChange"),this.disabled=!1,this.readOnly=!1,this.reviewable=!1,this.touched={},this.addRow=r=>{r.preventDefault(),this.gridValueChange.emit([...this.rows(),{}])}}gridKey(){var r,i;return null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid"}rowScoped(r,i){if(!r)return;const t=`${this.gridKey()}[${i}].`,o={};for(const[i,s]of Object.entries(r))i.startsWith(t)&&(o[i.slice(t.length)]=s);return o}rowEditableKeys(r){if(void 0===this.editableKeys||this.editableKeys.includes(this.gridKey()))return;const i=`${this.gridKey()}[${r}].`;return this.editableKeys.filter((r=>r.startsWith(i))).map((r=>r.slice(i.length)))}rowsLocked(){return void 0!==this.editableKeys&&!this.editableKeys.includes(this.gridKey())}handleRowReviewChange(r){if(r.target===this.host)return;r.stopPropagation();const i=r.target.closest("[data-grid-row]"),t=null==i?void 0:i.getAttribute("data-grid-row");null!=t&&this.brickReviewChange.emit({key:`${this.gridKey()}[${t}].${r.detail.key}`,annotation:r.detail.annotation})}rows(){return Array.isArray(this.value)?this.value:[]}rowSpec(){var r,i;return(null===(r=this.rowSpecCache)||void 0===r?void 0:r.source)!==this.spec&&(this.rowSpecCache={source:this.spec,rowSpec:{type:"panel",id:"grid-row",name:"Row",configs:{key:"row"},children:null!==(i=this.spec.children)&&void 0!==i?i:[]}}),this.rowSpecCache.rowSpec}rowErrors(r){const i=Object.fromEntries(Object.entries(r).filter((([,r])=>""!==r&&null!=r)));return e(this.rowSpec(),i,this.locale).errors}visibleRowErrors(r){var i,t;const o=null!==(i=this.rows()[r])&&void 0!==i?i:{},s=null!==(t=this.touched[r])&&void 0!==t?t:{},e={};for(const[r,i]of Object.entries(this.rowErrors(o)))s[r]&&(e[r]=i);return e}handleRowChange(r){var i,t;r.stopPropagation();const o=r.target.closest("[data-grid-row]"),s=Number(null!==(i=null==o?void 0:o.getAttribute("data-grid-row"))&&void 0!==i?i:-1);if(s<0)return;const e=Object.assign({},null!==(t=this.touched[s])&&void 0!==t?t:{});for(const i of Object.keys(r.detail))e[i]=!0;this.touched=Object.assign(Object.assign({},this.touched),{[s]:e});const a=this.rows().map(((i,t)=>t===s?Object.assign(Object.assign({},i),r.detail):i));this.gridValueChange.emit(a)}async validateRows(){var r,i;const t=this.rows(),o=null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid",s={},e={};return t.forEach(((r,i)=>{var t,a;const d={};for(const r of null!==(t=this.spec.children)&&void 0!==t?t:[])(null===(a=r.configs)||void 0===a?void 0:a.key)&&(d[r.configs.key]=!0);s[i]=d;for(const[t,s]of Object.entries(this.rowErrors(r)))e[`${o}[${i}].${t}`]=s})),this.touched=s,{valid:0===Object.keys(e).length,errors:e}}moveRow(r,i){const t=[...this.rows()],o=r+i;if(o<0||o>=t.length)return;const[s]=t.splice(r,1);t.splice(o,0,s);const e=Object.assign({},this.touched),a=e[r];e[r]=e[o],e[o]=a,this.touched=e,this.gridValueChange.emit(t)}removeRow(r){const i=this.rows().filter(((i,t)=>t!==r)),t={};for(const[i,o]of Object.entries(this.touched)){const s=Number(i);s<r?t[s]=o:s>r&&(t[s-1]=o)}this.touched=t,this.gridValueChange.emit(i.length?i:void 0)}contextMap(){var r;return Object.fromEntries(Object.entries(null!==(r=this.dataMap)&&void 0!==r?r:{}).filter((([r])=>r.startsWith("_"))))}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return s("div",{key:"cd1bc1f56eb15927e4ac7562764e95528b1e054c",class:"fk-grid"},0===t.length?s("p",{class:"fk-grid__empty"},a("grid.empty")):null,t.map(((r,o)=>s("div",{class:"fk-grid__row","data-grid-row":o,key:o},s("div",{class:"fk-grid__cells"},i.map(((i,t)=>s("fk-brick-render",{brickSpec:i,data:r,dataMap:Object.assign(Object.assign({},this.contextMap()),r),errors:this.visibleRowErrors(o),annotations:this.rowScoped(this.annotations,o),notes:this.rowScoped(this.notes,o),reviewable:this.reviewable,editableKeys:this.rowEditableKeys(o),locale:this.locale,readOnly:this.readOnly,disabled:this.disabled&&!this.readOnly,path:`grid.${o}.${t}`,utils:this.utils})))),s("div",{class:"fk-grid__row-actions"},s("button",{type:"button",class:"fk-grid__move",title:d("grid.moveUp","Move row up"),"aria-label":d("grid.moveUp","Move row up"),disabled:this.disabled||this.rowsLocked()||0===o,onClick:r=>{r.preventDefault(),this.moveRow(o,-1)}},"↑"),s("button",{type:"button",class:"fk-grid__move",title:d("grid.moveDown","Move row down"),"aria-label":d("grid.moveDown","Move row down"),disabled:this.disabled||this.rowsLocked()||o===t.length-1,onClick:r=>{r.preventDefault(),this.moveRow(o,1)}},"↓"),s("button",{type:"button",class:"fk-grid__remove",title:a("grid.removeRow"),"aria-label":a("grid.removeRow"),disabled:this.disabled||this.rowsLocked(),onClick:r=>{r.preventDefault(),this.removeRow(o)}},"✕"))))),s("button",{key:"0d70026f45faffb24ba344fe773852ce0cb74121",type:"button",class:"fk-grid__add",disabled:this.disabled||this.rowsLocked(),onClick:this.addRow},a("grid.addRow")))}get host(){return this}static get style(){return".sc-fk-data-grid-h{display:block}.fk-grid.sc-fk-data-grid{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-grid__empty.sc-fk-data-grid{margin:0;padding:var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);font-size:0.85rem;color:var(--fk-color-muted);text-align:center}.fk-grid__row.sc-fk-data-grid{display:flex;align-items:flex-start;gap:var(--fk-spacing);padding:var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:color-mix(in srgb, var(--fk-color-surface) 60%, transparent)}.fk-grid__cells.sc-fk-data-grid{display:flex;flex:1;flex-wrap:wrap;gap:var(--fk-spacing);min-width:0}.fk-grid__cells.sc-fk-data-grid>*.sc-fk-data-grid{flex:1;min-width:160px}.fk-grid__remove.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__remove.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}.fk-grid__add.sc-fk-data-grid{align-self:flex-start;font:inherit;font-size:0.8rem;font-weight:600;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-grid__add.sc-fk-data-grid:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-grid__row-actions.sc-fk-data-grid{display:flex;flex-direction:column;gap:2px;flex-shrink:0}.fk-grid__move.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:2px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__move.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-primary);background:color-mix(in srgb, var(--fk-color-primary) 10%, transparent)}.fk-grid__move.sc-fk-data-grid:disabled{opacity:0.3;cursor:default}.fk-grid__move.sc-fk-data-grid:focus-visible,.fk-grid__remove.sc-fk-data-grid:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:1px}"}},[2,"fk-data-grid",{spec:[16],value:[16],disabled:[4],readOnly:[4,"read-only"],locale:[1],utils:[16],annotations:[16],notes:[16],reviewable:[4],editableKeys:[16],dataMap:[16],touched:[32],validateRows:[64]},[[0,"brickReviewChange","handleRowReviewChange"],[0,"brickDataChange","handleRowChange"]]]);function g(){"undefined"!=typeof customElements&&["fk-data-grid","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((i=>{switch(i){case"fk-data-grid":customElements.get(r(i))||customElements.define(r(i),h);break;case"fk-brick-actions":customElements.get(r(i))||n();break;case"fk-brick-not-found":customElements.get(r(i))||c();break;case"fk-brick-render":customElements.get(r(i))||l();break;case"fk-drop-area":customElements.get(r(i))||f()}}))}g();export{h as F,g as d}
1
+ import{t as r,p as i,H as t,c as o,h as e}from"./p-8ICOcloT.js";import{v as s,b as a,f as d}from"./p-DKURyEzf.js";import{d as n}from"./p-C8z1D4cx.js";import{d as c}from"./p-CIgvEKbO.js";import{d as l}from"./p-hY3kCpWp.js";import{d as f}from"./p-DvkJXOeH.js";const h=i(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.gridValueChange=o(this,"gridValueChange"),this.brickReviewChange=o(this,"brickReviewChange"),this.disabled=!1,this.readOnly=!1,this.reviewable=!1,this.touched={},this.addRow=r=>{r.preventDefault(),this.gridValueChange.emit([...this.rows(),{}])}}gridKey(){var r,i;return null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid"}rowScoped(r,i){if(!r)return;const t=`${this.gridKey()}[${i}].`,o={};for(const[i,e]of Object.entries(r))i.startsWith(t)&&(o[i.slice(t.length)]=e);return o}rowEditableKeys(r){if(void 0===this.editableKeys||this.editableKeys.includes(this.gridKey()))return;const i=`${this.gridKey()}[${r}].`;return this.editableKeys.filter((r=>r.startsWith(i))).map((r=>r.slice(i.length)))}rowsLocked(){return void 0!==this.editableKeys&&!this.editableKeys.includes(this.gridKey())}handleRowReviewChange(r){if(r.target===this.host)return;r.stopPropagation();const i=r.target.closest("[data-grid-row]"),t=null==i?void 0:i.getAttribute("data-grid-row");null!=t&&this.brickReviewChange.emit({key:`${this.gridKey()}[${t}].${r.detail.key}`,annotation:r.detail.annotation})}rows(){return Array.isArray(this.value)?this.value:[]}rowSpec(){var r,i;return(null===(r=this.rowSpecCache)||void 0===r?void 0:r.source)!==this.spec&&(this.rowSpecCache={source:this.spec,rowSpec:{type:"panel",id:"grid-row",name:"Row",configs:{key:"row"},children:null!==(i=this.spec.children)&&void 0!==i?i:[]}}),this.rowSpecCache.rowSpec}rowErrors(r){const i=Object.fromEntries(Object.entries(r).filter((([,r])=>""!==r&&null!=r)));return s(this.rowSpec(),i,this.locale).errors}visibleRowErrors(r){var i,t;const o=null!==(i=this.rows()[r])&&void 0!==i?i:{},e=null!==(t=this.touched[r])&&void 0!==t?t:{},s={};for(const[r,i]of Object.entries(this.rowErrors(o)))e[r]&&(s[r]=i);return s}handleRowChange(r){var i,t;r.stopPropagation();const o=r.target.closest("[data-grid-row]"),e=Number(null!==(i=null==o?void 0:o.getAttribute("data-grid-row"))&&void 0!==i?i:-1);if(e<0)return;const s=Object.assign({},null!==(t=this.touched[e])&&void 0!==t?t:{});for(const i of Object.keys(r.detail))s[i]=!0;this.touched=Object.assign(Object.assign({},this.touched),{[e]:s});const a=this.rows().map(((i,t)=>t===e?Object.assign(Object.assign({},i),r.detail):i));this.gridValueChange.emit(a)}async validateRows(){var r,i;const t=this.rows(),o=null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid",e={},s={};return t.forEach(((r,i)=>{var t,a;const d={};for(const r of null!==(t=this.spec.children)&&void 0!==t?t:[])(null===(a=r.configs)||void 0===a?void 0:a.key)&&(d[r.configs.key]=!0);e[i]=d;for(const[t,e]of Object.entries(this.rowErrors(r)))s[`${o}[${i}].${t}`]=e})),this.touched=e,{valid:0===Object.keys(s).length,errors:s}}moveRow(r,i){const t=[...this.rows()],o=r+i;if(o<0||o>=t.length)return;const[e]=t.splice(r,1);t.splice(o,0,e);const s=Object.assign({},this.touched),a=s[r];s[r]=s[o],s[o]=a,this.touched=s,this.gridValueChange.emit(t)}removeRow(r){const i=this.rows().filter(((i,t)=>t!==r)),t={};for(const[i,o]of Object.entries(this.touched)){const e=Number(i);e<r?t[e]=o:e>r&&(t[e-1]=o)}this.touched=t,this.gridValueChange.emit(i.length?i:void 0)}contextMap(){var r;return Object.fromEntries(Object.entries(null!==(r=this.dataMap)&&void 0!==r?r:{}).filter((([r])=>r.startsWith("_"))))}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return e("div",{key:"cd1bc1f56eb15927e4ac7562764e95528b1e054c",class:"fk-grid"},0===t.length?e("p",{class:"fk-grid__empty"},a("grid.empty")):null,t.map(((r,o)=>e("div",{class:"fk-grid__row","data-grid-row":o,key:o},e("div",{class:"fk-grid__cells"},i.map(((i,t)=>e("fk-brick-render",{brickSpec:i,data:r,dataMap:Object.assign(Object.assign({},this.contextMap()),r),errors:this.visibleRowErrors(o),annotations:this.rowScoped(this.annotations,o),notes:this.rowScoped(this.notes,o),reviewable:this.reviewable,editableKeys:this.rowEditableKeys(o),locale:this.locale,readOnly:this.readOnly,disabled:this.disabled&&!this.readOnly,path:`grid.${o}.${t}`,utils:this.utils})))),e("div",{class:"fk-grid__row-actions"},e("button",{type:"button",class:"fk-grid__move",title:d("grid.moveUp","Move row up"),"aria-label":d("grid.moveUp","Move row up"),disabled:this.disabled||this.rowsLocked()||0===o,onClick:r=>{r.preventDefault(),this.moveRow(o,-1)}},"↑"),e("button",{type:"button",class:"fk-grid__move",title:d("grid.moveDown","Move row down"),"aria-label":d("grid.moveDown","Move row down"),disabled:this.disabled||this.rowsLocked()||o===t.length-1,onClick:r=>{r.preventDefault(),this.moveRow(o,1)}},"↓"),e("button",{type:"button",class:"fk-grid__remove",title:a("grid.removeRow"),"aria-label":a("grid.removeRow"),disabled:this.disabled||this.rowsLocked(),onClick:r=>{r.preventDefault(),this.removeRow(o)}},"✕"))))),e("button",{key:"0d70026f45faffb24ba344fe773852ce0cb74121",type:"button",class:"fk-grid__add",disabled:this.disabled||this.rowsLocked(),onClick:this.addRow},a("grid.addRow")))}get host(){return this}static get style(){return".sc-fk-data-grid-h{display:block}.fk-grid.sc-fk-data-grid{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-grid__empty.sc-fk-data-grid{margin:0;padding:var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);font-size:0.85rem;color:var(--fk-color-muted);text-align:center}.fk-grid__row.sc-fk-data-grid{display:flex;align-items:flex-start;gap:var(--fk-spacing);padding:var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:color-mix(in srgb, var(--fk-color-surface) 60%, transparent)}.fk-grid__cells.sc-fk-data-grid{display:flex;flex:1;flex-wrap:wrap;gap:var(--fk-spacing);min-width:0}.fk-grid__cells.sc-fk-data-grid>*.sc-fk-data-grid{flex:1;min-width:160px}.fk-grid__remove.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__remove.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}.fk-grid__add.sc-fk-data-grid{align-self:flex-start;font:inherit;font-size:0.8rem;font-weight:600;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-grid__add.sc-fk-data-grid:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-grid__row-actions.sc-fk-data-grid{display:flex;flex-direction:column;gap:2px;flex-shrink:0}.fk-grid__move.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:2px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__move.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-primary);background:color-mix(in srgb, var(--fk-color-primary) 10%, transparent)}.fk-grid__move.sc-fk-data-grid:disabled{opacity:0.3;cursor:default}.fk-grid__move.sc-fk-data-grid:focus-visible,.fk-grid__remove.sc-fk-data-grid:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:1px}"}},[2,"fk-data-grid",{spec:[16],value:[16],disabled:[4],readOnly:[4,"read-only"],locale:[1],utils:[16],annotations:[16],notes:[16],reviewable:[4],editableKeys:[16],dataMap:[16],touched:[32],validateRows:[64]},[[0,"brickReviewChange","handleRowReviewChange"],[0,"brickDataChange","handleRowChange"]]]);function k(){"undefined"!=typeof customElements&&["fk-data-grid","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((i=>{switch(i){case"fk-data-grid":customElements.get(r(i))||customElements.define(r(i),h);break;case"fk-brick-actions":customElements.get(r(i))||n();break;case"fk-brick-not-found":customElements.get(r(i))||c();break;case"fk-brick-render":customElements.get(r(i))||l();break;case"fk-drop-area":customElements.get(r(i))||f()}}))}k();export{h as F,k as d}
@@ -1 +1 @@
1
- import{t,p as o,H as i,c as r,h as s}from"./p-8ICOcloT.js";import{d as a,a as c}from"./p-92BozD8S.js";import{t as n}from"./p-D-Ecxaih.js";import{b as e}from"./p-CN7geIpq.js";const k=o(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.brickRemove=r(this,"brickRemove"),this.brickDuplicate=r(this,"brickDuplicate"),this.brickDrop=r(this,"brickDrop"),this.brickSelect=r(this,"brickSelect"),this.selected=!1,this.isDragging=!1,this.isDropTarget=!1,this.cleanups=[]}componentDidLoad(){this.handleEl&&this.cleanups.push(a({element:this.handleEl,getInitialData:()=>({kind:"move-brick",path:this.path}),onDragStart:()=>this.isDragging=!0,onDrop:()=>this.isDragging=!1})),this.cleanups.push(c({element:this.host,onDrag:({location:t})=>{var o;return this.isDropTarget=(null===(o=t.current.dropTargets[0])||void 0===o?void 0:o.element)===this.host},onDragLeave:()=>this.isDropTarget=!1,onDrop:({source:t,location:o})=>{var i;if(this.isDropTarget=!1,(null===(i=o.current.dropTargets[0])||void 0===i?void 0:i.element)!==this.host)return;const r=this.path.split("."),s=n(t.data,r.slice(0,-1).join("."),Number(r[r.length-1]));s&&this.brickDrop.emit(s)}}))}disconnectedCallback(){this.cleanups.forEach((t=>t())),this.cleanups=[]}render(){return s("div",{key:"285faf7d173290158bf5071fca5e824ac1585521",class:{"fk-actions":!0,"fk-actions--dragging":this.isDragging,"fk-actions--drop-before":this.isDropTarget,"fk-actions--selected":this.selected},onClick:t=>{t.stopPropagation(),this.brickSelect.emit({path:this.path})}},s("div",{key:"c77331010bbbd87712b63071fd83c2131a4ea3e5",class:"fk-actions__toolbar"},s("button",{key:"89a8956ba6c77d3556fb6c0c48593b8915279d5a",type:"button",class:"fk-actions__button fk-actions__handle",ref:t=>this.handleEl=t,title:e("actions.move")},"⠿"),s("button",{key:"de34c2c65fbd48f3f5b1b9f3c300202a3d2938d2",type:"button",class:"fk-actions__button",title:e("actions.duplicate"),onClick:t=>{t.stopPropagation(),this.brickDuplicate.emit({path:this.path})}},"⧉"),s("button",{key:"e34439670d7449dde7cd58aa25e30d45a780df1f",type:"button",class:"fk-actions__button fk-actions__button--danger",title:e("actions.delete"),onClick:t=>{t.stopPropagation(),this.brickRemove.emit({path:this.path})}},"✕")),s("slot",{key:"92dc91b6efae3e50672f8c83a4342138dace6b93"}))}get host(){return this}static get style(){return".fk-actions.sc-fk-brick-actions{position:relative;padding:calc(var(--fk-spacing) / 2);border:1px solid transparent;border-radius:var(--fk-radius)}.fk-actions.sc-fk-brick-actions:hover{border-color:var(--fk-color-border)}.fk-actions--selected.sc-fk-brick-actions,.fk-actions--selected.sc-fk-brick-actions:hover{border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-actions--dragging.sc-fk-brick-actions{opacity:0.5}.fk-actions--drop-before.sc-fk-brick-actions::before{content:'';position:absolute;top:-2px;inset-inline:0;height:3px;border-radius:2px;background:var(--fk-color-primary)}.fk-actions__toolbar.sc-fk-brick-actions{position:absolute;top:calc(var(--fk-spacing) / -2);inset-inline-end:var(--fk-spacing);z-index:1;display:none;gap:2px;padding:2px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);box-shadow:0 2px 6px var(--fk-color-shadow)}.fk-actions.sc-fk-brick-actions:hover>.fk-actions__toolbar.sc-fk-brick-actions{display:flex}.fk-actions__button.sc-fk-brick-actions{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:calc(var(--fk-radius) / 2);background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer}.fk-actions__button.sc-fk-brick-actions:hover{background:color-mix(in srgb, var(--fk-color-primary) 12%, transparent);color:var(--fk-color-primary)}.fk-actions__button--danger.sc-fk-brick-actions:hover{background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent);color:var(--fk-color-danger)}.fk-actions__handle.sc-fk-brick-actions{cursor:grab}"}},[262,"fk-brick-actions",{path:[1],selected:[4],isDragging:[32],isDropTarget:[32]}]);function d(){"undefined"!=typeof customElements&&["fk-brick-actions"].forEach((o=>{"fk-brick-actions"===o&&(customElements.get(t(o))||customElements.define(t(o),k))}))}d();export{k as F,d}
1
+ import{t,p as o,H as i,c as r,h as s}from"./p-8ICOcloT.js";import{d as a,a as c}from"./p-92BozD8S.js";import{t as n}from"./p-D-Ecxaih.js";import{b as e}from"./p-DKURyEzf.js";const k=o(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.brickRemove=r(this,"brickRemove"),this.brickDuplicate=r(this,"brickDuplicate"),this.brickDrop=r(this,"brickDrop"),this.brickSelect=r(this,"brickSelect"),this.selected=!1,this.isDragging=!1,this.isDropTarget=!1,this.cleanups=[]}componentDidLoad(){this.handleEl&&this.cleanups.push(a({element:this.handleEl,getInitialData:()=>({kind:"move-brick",path:this.path}),onDragStart:()=>this.isDragging=!0,onDrop:()=>this.isDragging=!1})),this.cleanups.push(c({element:this.host,onDrag:({location:t})=>{var o;return this.isDropTarget=(null===(o=t.current.dropTargets[0])||void 0===o?void 0:o.element)===this.host},onDragLeave:()=>this.isDropTarget=!1,onDrop:({source:t,location:o})=>{var i;if(this.isDropTarget=!1,(null===(i=o.current.dropTargets[0])||void 0===i?void 0:i.element)!==this.host)return;const r=this.path.split("."),s=n(t.data,r.slice(0,-1).join("."),Number(r[r.length-1]));s&&this.brickDrop.emit(s)}}))}disconnectedCallback(){this.cleanups.forEach((t=>t())),this.cleanups=[]}render(){return s("div",{key:"285faf7d173290158bf5071fca5e824ac1585521",class:{"fk-actions":!0,"fk-actions--dragging":this.isDragging,"fk-actions--drop-before":this.isDropTarget,"fk-actions--selected":this.selected},onClick:t=>{t.stopPropagation(),this.brickSelect.emit({path:this.path})}},s("div",{key:"c77331010bbbd87712b63071fd83c2131a4ea3e5",class:"fk-actions__toolbar"},s("button",{key:"89a8956ba6c77d3556fb6c0c48593b8915279d5a",type:"button",class:"fk-actions__button fk-actions__handle",ref:t=>this.handleEl=t,title:e("actions.move")},"⠿"),s("button",{key:"de34c2c65fbd48f3f5b1b9f3c300202a3d2938d2",type:"button",class:"fk-actions__button",title:e("actions.duplicate"),onClick:t=>{t.stopPropagation(),this.brickDuplicate.emit({path:this.path})}},"⧉"),s("button",{key:"e34439670d7449dde7cd58aa25e30d45a780df1f",type:"button",class:"fk-actions__button fk-actions__button--danger",title:e("actions.delete"),onClick:t=>{t.stopPropagation(),this.brickRemove.emit({path:this.path})}},"✕")),s("slot",{key:"92dc91b6efae3e50672f8c83a4342138dace6b93"}))}get host(){return this}static get style(){return".fk-actions.sc-fk-brick-actions{position:relative;padding:calc(var(--fk-spacing) / 2);border:1px solid transparent;border-radius:var(--fk-radius)}.fk-actions.sc-fk-brick-actions:hover{border-color:var(--fk-color-border)}.fk-actions--selected.sc-fk-brick-actions,.fk-actions--selected.sc-fk-brick-actions:hover{border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-actions--dragging.sc-fk-brick-actions{opacity:0.5}.fk-actions--drop-before.sc-fk-brick-actions::before{content:'';position:absolute;top:-2px;inset-inline:0;height:3px;border-radius:2px;background:var(--fk-color-primary)}.fk-actions__toolbar.sc-fk-brick-actions{position:absolute;top:calc(var(--fk-spacing) / -2);inset-inline-end:var(--fk-spacing);z-index:1;display:none;gap:2px;padding:2px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);box-shadow:0 2px 6px var(--fk-color-shadow)}.fk-actions.sc-fk-brick-actions:hover>.fk-actions__toolbar.sc-fk-brick-actions{display:flex}.fk-actions__button.sc-fk-brick-actions{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:calc(var(--fk-radius) / 2);background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer}.fk-actions__button.sc-fk-brick-actions:hover{background:color-mix(in srgb, var(--fk-color-primary) 12%, transparent);color:var(--fk-color-primary)}.fk-actions__button--danger.sc-fk-brick-actions:hover{background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent);color:var(--fk-color-danger)}.fk-actions__handle.sc-fk-brick-actions{cursor:grab}"}},[262,"fk-brick-actions",{path:[1],selected:[4],isDragging:[32],isDropTarget:[32]}]);function d(){"undefined"!=typeof customElements&&["fk-brick-actions"].forEach((o=>{"fk-brick-actions"===o&&(customElements.get(t(o))||customElements.define(t(o),k))}))}d();export{k as F,d}
@@ -1 +1 @@
1
- import{t,p as s,H as a,c as i,h as e}from"./p-8ICOcloT.js";import{u as o,v as r}from"./p-CN7geIpq.js";const c=s(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=i(this,"stepTouch"),this.tabLabels=[],this.editable=!1,this.active=0}clampActive(){this.active>Math.max(this.tabLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-tabs__body");t&&Array.from(t.children).forEach(((t,s)=>{const a=t;this.editable?a.style.removeProperty("display"):a.style.display=s===this.active?"":"none"}))}validateTabs(){var t,s;return!0===(null===(s=null===(t=this.spec)||void 0===t?void 0:t.configs)||void 0===s?void 0:s.validateTabs)}tabSpec(t){var s,a,i;const e=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(e&&this.spec)return(null===(i=this.tabCache)||void 0===i?void 0:i.source)!==this.spec&&(this.tabCache={source:this.spec,specs:[]}),this.tabCache.specs[t]||(this.tabCache.specs[t]={type:"panel",id:"tab",name:"Tab",configs:{key:`tab_${t}`},children:[e]}),this.tabCache.specs[t]}tabKeys(t){var s,a,i;const e=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(!e)return[];const r=[];for(const t of o(e))(null===(i=t.configs)||void 0===i?void 0:i.key)&&r.push(t.configs.key);return r}tabValid(t){var s;const a=this.tabSpec(t);if(!a)return!0;const i=Object.fromEntries(Object.entries(null!==(s=this.dataMap)&&void 0!==s?s:{}).filter((([,t])=>""!==t&&null!=t)));return r(a,i,this.locale).valid}goToTab(t){t!==this.active&&(this.editable||!this.validateTabs()||this.tabValid(this.active)?this.active=t:this.stepTouch.emit({keys:this.tabKeys(this.active)}))}render(){return e("div",{key:"cdafc62322154779cb7ce22b0fd246897f10d35e",class:"fk-tabs"},e("div",{key:"e9a8dc067ff9f7a877d6a0c9330dc3f1cd821243",class:"fk-tabs__nav",role:"tablist"},this.tabLabels.map(((t,s)=>e("button",{key:`${s}-${t}`,type:"button",role:"tab","aria-selected":s===this.active?"true":"false",tabIndex:s===this.active?0:-1,class:{"fk-tabs__tab":!0,"fk-tabs__tab--active":s===this.active},onKeyDown:t=>{const a=this.tabLabels.length;!a||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(t.preventDefault(),this.goToTab((s+("ArrowRight"===t.key?1:-1)+a)%a),requestAnimationFrame((()=>{var t;null===(t=this.host.querySelector(".fk-tabs__tab--active"))||void 0===t||t.focus()})))},onClick:t=>{t.preventDefault(),this.goToTab(s)}},t)))),e("div",{key:"6ffcc7a0bceb19873c318c62b9695e98f6afba0a",class:"fk-tabs__body"},e("slot",{key:"2091e64b09722f3ce33d35550247b3f0963610c3"})))}get host(){return this}static get watchers(){return{tabLabels:[{clampActive:0}]}}static get style(){return".sc-fk-tabs-h{display:block}.fk-tabs.sc-fk-tabs{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-tabs__nav.sc-fk-tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--fk-color-border)}.fk-tabs__tab.sc-fk-tabs{font:inherit;font-size:0.85rem;font-weight:500;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);min-height:24px;border:none;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:var(--fk-color-muted);text-transform:none;letter-spacing:normal;cursor:pointer}.fk-tabs__tab.sc-fk-tabs:hover{color:var(--fk-color-text)}.fk-tabs__tab--active.sc-fk-tabs{color:var(--fk-color-primary);border-bottom-color:var(--fk-color-primary);font-weight:600}"}},[262,"fk-tabs",{tabLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{tabLabels:[{clampActive:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-tabs"].forEach((s=>{"fk-tabs"===s&&(customElements.get(t(s))||customElements.define(t(s),c))}))}n();export{c as F,n as d}
1
+ import{t,p as s,H as a,c as i,h as e}from"./p-8ICOcloT.js";import{u as o,v as r}from"./p-DKURyEzf.js";const c=s(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=i(this,"stepTouch"),this.tabLabels=[],this.editable=!1,this.active=0}clampActive(){this.active>Math.max(this.tabLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-tabs__body");t&&Array.from(t.children).forEach(((t,s)=>{const a=t;this.editable?a.style.removeProperty("display"):a.style.display=s===this.active?"":"none"}))}validateTabs(){var t,s;return!0===(null===(s=null===(t=this.spec)||void 0===t?void 0:t.configs)||void 0===s?void 0:s.validateTabs)}tabSpec(t){var s,a,i;const e=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(e&&this.spec)return(null===(i=this.tabCache)||void 0===i?void 0:i.source)!==this.spec&&(this.tabCache={source:this.spec,specs:[]}),this.tabCache.specs[t]||(this.tabCache.specs[t]={type:"panel",id:"tab",name:"Tab",configs:{key:`tab_${t}`},children:[e]}),this.tabCache.specs[t]}tabKeys(t){var s,a,i;const e=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(!e)return[];const r=[];for(const t of o(e))(null===(i=t.configs)||void 0===i?void 0:i.key)&&r.push(t.configs.key);return r}tabValid(t){var s;const a=this.tabSpec(t);if(!a)return!0;const i=Object.fromEntries(Object.entries(null!==(s=this.dataMap)&&void 0!==s?s:{}).filter((([,t])=>""!==t&&null!=t)));return r(a,i,this.locale).valid}goToTab(t){t!==this.active&&(this.editable||!this.validateTabs()||this.tabValid(this.active)?this.active=t:this.stepTouch.emit({keys:this.tabKeys(this.active)}))}render(){return e("div",{key:"cdafc62322154779cb7ce22b0fd246897f10d35e",class:"fk-tabs"},e("div",{key:"e9a8dc067ff9f7a877d6a0c9330dc3f1cd821243",class:"fk-tabs__nav",role:"tablist"},this.tabLabels.map(((t,s)=>e("button",{key:`${s}-${t}`,type:"button",role:"tab","aria-selected":s===this.active?"true":"false",tabIndex:s===this.active?0:-1,class:{"fk-tabs__tab":!0,"fk-tabs__tab--active":s===this.active},onKeyDown:t=>{const a=this.tabLabels.length;!a||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(t.preventDefault(),this.goToTab((s+("ArrowRight"===t.key?1:-1)+a)%a),requestAnimationFrame((()=>{var t;null===(t=this.host.querySelector(".fk-tabs__tab--active"))||void 0===t||t.focus()})))},onClick:t=>{t.preventDefault(),this.goToTab(s)}},t)))),e("div",{key:"6ffcc7a0bceb19873c318c62b9695e98f6afba0a",class:"fk-tabs__body"},e("slot",{key:"2091e64b09722f3ce33d35550247b3f0963610c3"})))}get host(){return this}static get watchers(){return{tabLabels:[{clampActive:0}]}}static get style(){return".sc-fk-tabs-h{display:block}.fk-tabs.sc-fk-tabs{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-tabs__nav.sc-fk-tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--fk-color-border)}.fk-tabs__tab.sc-fk-tabs{font:inherit;font-size:0.85rem;font-weight:500;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);min-height:24px;border:none;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:var(--fk-color-muted);text-transform:none;letter-spacing:normal;cursor:pointer}.fk-tabs__tab.sc-fk-tabs:hover{color:var(--fk-color-text)}.fk-tabs__tab--active.sc-fk-tabs{color:var(--fk-color-primary);border-bottom-color:var(--fk-color-primary);font-weight:600}"}},[262,"fk-tabs",{tabLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{tabLabels:[{clampActive:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-tabs"].forEach((s=>{"fk-tabs"===s&&(customElements.get(t(s))||customElements.define(t(s),c))}))}n();export{c as F,n as d}
@@ -0,0 +1 @@
1
+ import{t as s,p as t,H as l,c as o,h as e}from"./p-8ICOcloT.js";import{o as r,q as i,t as a,b as c}from"./p-DKURyEzf.js";const n=(s,t)=>{const[l,o,e]=s.split("-").map(Number);return new Date(l,o-1,e).toLocaleDateString(t,{weekday:"short",day:"numeric",month:"short"})},k=s=>s.slice(11,16),d=t(class extends l{constructor(s){super(),!1!==s&&this.__registerHost(),this.slotPick=o(this,"slotPick"),this.rules={},this.disabled=!1,this.readOnly=!1,this.slots=[],this.day="",this.loading=!1,this.failed=!1}componentWillLoad(){return this.day=this.value?this.value.start.slice(0,10):"",this.load()}reload(){return this.load()}onValueChange(s){s&&(this.day=s.start.slice(0,10))}get locked(){return this.disabled||this.readOnly}async load(){if(this.failed=!1,this.slotsUrl){this.loading=!0;try{const s=await fetch(this.slotsUrl,{headers:{Accept:"application/json"}});if(!s.ok)throw new Error(String(s.status));this.slots=i(await s.json())}catch(s){this.failed=!0,this.slots=[]}finally{this.loading=!1}}else this.slots=r(this.rules)}pick(s){this.locked||this.slotPick.emit({id:s.id,start:s.start,end:s.end})}render(){var s;const t=a(this.slots),l=this.value,o=null!==(s=t.find((s=>s.day===this.day)))&&void 0!==s?s:t[0];return this.locked?e("div",{class:"fk-slots fk-slots--locked"},l?e("span",{class:"fk-slots__picked"},n(l.start.slice(0,10),this.locale)," · ",k(l.start),"–",k(l.end)):e("span",{class:"fk-slots__empty"},c("slots.none"))):e("div",{class:"fk-slots"},this.loading?e("span",{class:"fk-slots__empty"},c("slots.loading")):null,this.failed?e("span",{class:"fk-slots__empty"},c("slots.unavailable")):null,this.loading||this.failed||0!==t.length?null:e("span",{class:"fk-slots__empty"},c("slots.empty")),t.length?e("div",{class:"fk-slots__days",role:"tablist"},t.map((s=>e("button",{type:"button",role:"tab","aria-selected":s.day===(null==o?void 0:o.day)?"true":"false",class:{"fk-slots__day":!0,"fk-slots__day--active":s.day===(null==o?void 0:o.day)},onClick:()=>{this.day=s.day}},n(s.day,this.locale))))):null,o?e("div",{class:"fk-slots__times"},o.slots.map((s=>e("button",{type:"button",class:{"fk-slots__time":!0,"fk-slots__time--picked":(null==l?void 0:l.id)===s.id},"aria-pressed":(null==l?void 0:l.id)===s.id?"true":"false",onClick:()=>this.pick(s)},k(s.start),void 0!==s.remaining?e("small",null," · ",s.remaining):null)))):null,l?e("p",{class:"fk-slots__picked"},c("slots.picked")," ",n(l.start.slice(0,10),this.locale)," · ",k(l.start),"–",k(l.end),e("button",{type:"button",class:"fk-slots__clear",onClick:()=>this.slotPick.emit(void 0)},c("geo.clear"))):null)}static get watchers(){return{slotsUrl:[{reload:0}],rules:[{reload:0}],value:[{onValueChange:0}]}}static get style(){return".sc-fk-slot-picker-h{display:block}.fk-slots__days.sc-fk-slot-picker{display:flex;gap:0.375rem;overflow-x:auto;padding-bottom:0.25rem}.fk-slots__day.sc-fk-slot-picker,.fk-slots__time.sc-fk-slot-picker{border:1px solid var(--fk-color-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);background:transparent;color:inherit;font:inherit;font-size:0.8125rem;padding:0.375rem 0.625rem;cursor:pointer;white-space:nowrap}.fk-slots__day--active.sc-fk-slot-picker,.fk-slots__time--picked.sc-fk-slot-picker{border-color:var(--fk-color-primary, #16a34a);background:var(--fk-color-primary, #16a34a);color:#fff}.fk-slots__times.sc-fk-slot-picker{display:flex;flex-wrap:wrap;gap:0.375rem;margin-top:0.5rem}.fk-slots__time.sc-fk-slot-picker small.sc-fk-slot-picker{opacity:0.7}.fk-slots__picked.sc-fk-slot-picker,.fk-slots__empty.sc-fk-slot-picker{display:block;margin:0.5rem 0 0;font-size:0.8125rem}.fk-slots__empty.sc-fk-slot-picker{color:var(--fk-color-muted, #71717a)}.fk-slots__clear.sc-fk-slot-picker{margin-left:0.5rem;border:0;background:transparent;color:var(--fk-color-muted, #71717a);font:inherit;font-size:0.75rem;text-decoration:underline;cursor:pointer}"}},[2,"fk-slot-picker",{value:[16],slotsUrl:[1,"slots-url"],rules:[16],locale:[1],disabled:[4],readOnly:[4,"read-only"],slots:[32],day:[32],loading:[32],failed:[32]},void 0,{slotsUrl:[{reload:0}],rules:[{reload:0}],value:[{onValueChange:0}]}]);function f(){"undefined"!=typeof customElements&&["fk-slot-picker"].forEach((t=>{"fk-slot-picker"===t&&(customElements.get(s(t))||customElements.define(s(t),d))}))}f();export{d as F,f as d}
@@ -1 +1 @@
1
- import{t,p as s,H as e,c as i,h as r}from"./p-8ICOcloT.js";import{b as a,d as o,h as n,e as c,i as h,g as d,v as l}from"./p-CN7geIpq.js";import{registerDefaultBricks as m}from"./index.js";import{d as f}from"./p-D0mccXXB.js";import{d as u}from"./p-Ddzv9Kss.js";import{d as p}from"./p-CIgvEKbO.js";import{d as b}from"./p-D5ogjPcr.js";import{d as k}from"./p-BE5v8BN3.js";import{d as v}from"./p-DSzmy6gE.js";import{d as j}from"./p-Dtl7_dcJ.js";import{d as E}from"./p-CgJq9YFB.js";import{d as g}from"./p-CGqbwBEB.js";import{d as y}from"./p-Btv_oIu9.js";import{d as O}from"./p-DffIT6x6.js";import{d as S}from"./p-InuRlsz8.js";import{d as D}from"./p-DhMqRur8.js";import{d as C}from"./p-BIViIbf-.js";import{d as x}from"./p-CjvAazPE.js";import{d as w}from"./p-XQBGaG8e.js";import{d as B}from"./p-CHD0vvEI.js";const I=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=i(this,"formDataChange"),this.formSubmit=i(this,"formSubmit"),this.validityChange=i(this,"validityChange"),this.editable=!1,this.readOnly=!1,this.disabled=!1,this.showSubmit=!1,this.reviewable=!1,this.currentData={},this.touched={},this.expanding=!1,this.utils={validateForm:()=>({isValid:this.runValidation().valid})}}componentWillLoad(){return m(),this.attachFormInternals(),this.currentData=this.seeded(this.data),this.runExpansion()}syncData(t){this.currentData=this.seeded(t)}onSpecChange(){this.currentData=this.seeded(this.data),this.runExpansion()}componentDidLoad(){this.emitValidity()}emitValidity(t){const{valid:s,errors:e}=null!=t?t:this.runValidation(),i=`${s}|${Object.keys(e).sort().join(",")}`;i!==this.lastValidity&&(this.lastValidity=i,this.validityChange.emit({valid:s,errors:e}),this.reportToForm(s,e))}attachFormInternals(){const t=this.host;if("function"==typeof t.attachInternals)try{this.internals=t.attachInternals()}catch(t){this.internals=void 0}}reportToForm(t,s){var e,i,r;if(null===(e=this.internals)||void 0===e?void 0:e.setValidity)try{this.internals.setFormValue(JSON.stringify(this.publicData())),t?this.internals.setValidity({}):this.internals.setValidity({customError:!0},null!==(i=Object.values(s)[0])&&void 0!==i?i:a("form.invalid"),null!==(r=this.host.querySelector("input, select, textarea"))&&void 0!==r?r:void 0)}catch(t){}}handleHostFormSubmit(t){var s;const e=null===(s=this.internals)||void 0===s?void 0:s.form;e&&t.target===e&&(t.preventDefault(),this.submit())}seeded(t){return Object.assign(Object.assign({},o(this.effectiveSpec())),t)}effectiveSpec(){var t;return null!==(t=this.expandedSpec)&&void 0!==t?t:this.spec}async runExpansion(){if(this.expandError=void 0,this.editable||!n(this.spec))return void(this.expandedSpec=void 0);const t=this.spec;this.expanding=!0;try{const s=await c(t);this.spec===t&&(this.expandedSpec=s,this.currentData=this.seeded(this.currentData))}catch(s){this.spec===t&&(this.expandedSpec=void 0,this.expandError=s instanceof Error?s.message:String(s))}finally{this.spec===t&&(this.expanding=!1)}}publicData(){return Object.fromEntries(Object.entries(this.currentData).filter((([t])=>!t.startsWith("_"))))}dataMap(t=this.currentData){return this.context?Object.assign(Object.assign({},t),this.context):t}handleBrickDataChange(t){t.stopPropagation(),this.currentData=this.applyValueEffects(Object.assign(Object.assign({},this.currentData),t.detail));const s=Object.assign({},this.touched);for(const e of Object.keys(t.detail))s[e]=!0;this.touched=s;const{valid:e,errors:i}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:e,errors:i}),this.emitValidity({valid:e,errors:i})}applyValueEffects(t){var s,e;let i=t;for(const{brick:t}of h(this.effectiveSpec())){const r=null===(s=t.configs)||void 0===s?void 0:s.key;if(!r||!(null===(e=t.rules)||void 0===e?void 0:e.length))continue;const a=d(t.rules,this.dataMap(i));void 0!==a.value&&i[r]!==a.value&&(i=Object.assign(Object.assign({},i),{[r]:a.value}))}return i}async validate(){var t;const s={};for(const{brick:e}of h(this.effectiveSpec())){const i=null===(t=e.configs)||void 0===t?void 0:t.key;i&&(s[i]=!0)}this.touched=s;const e=this.runValidation(),i=Object.assign({},e.errors);let r=e.valid;const a=Array.from(this.host.querySelectorAll("fk-data-grid"));for(const t of a){const s=await t.validateRows();r=r&&s.valid,Object.assign(i,s.errors)}const o={valid:r,errors:i};return this.emitValidity(o),this.formDataChange.emit({data:this.publicData(),isValid:o.valid,errors:o.errors}),o}async submit(){const t=await this.validate();return!t.valid||this.readOnly||this.disabled||this.formSubmit.emit({data:this.publicData(),isValid:!0,errors:{}}),t}handleStepTouch(t){t.stopPropagation();const s=Object.assign({},this.touched);for(const e of t.detail.keys)s[e]=!0;this.touched=s}async handleStepperSubmit(t){t.stopPropagation(),await this.submit()}runValidation(){const t=Object.fromEntries(Object.entries(this.currentData).filter((([,t])=>""!==t&&null!=t)));return l(this.effectiveSpec(),t,this.locale,this.context?this.dataMap(t):void 0)}visibleErrors(){if(this.editable)return{};const t={};for(const[s,e]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=e);return t}render(){var t;return this.spec?this.expanding?r("p",{class:"fk-form__expanding"},a("nestedForm.loading")):r("form",{class:"fk-form",onSubmit:t=>t.preventDefault()},this.expandError?r("span",{class:"fk-field__error",role:"alert"},this.expandError):null,r("fk-brick-render",{brickSpec:this.effectiveSpec(),rootSpec:this.effectiveSpec(),data:this.currentData,dataMap:this.dataMap(),errors:this.visibleErrors(),annotations:this.annotations,notes:this.notes,editableKeys:this.editableKeys,reviewable:this.reviewable,locale:this.locale,path:"0",editable:this.editable,readOnly:this.readOnly,disabled:this.disabled,selectedPath:this.selectedPath,utils:this.utils}),!this.showSubmit||this.editable||this.readOnly||this.disabled?null:r("button",{type:"submit",class:"fk-form__submit",onClick:t=>{t.preventDefault(),this.submit()}},null!==(t=this.submitLabel)&&void 0!==t?t:a("form.submit"))):null}static get formAssociated(){return!0}get host(){return this}static get watchers(){return{data:[{syncData:0}],spec:[{onSpecChange:0}]}}static get style(){return".fk-form.sc-fk-form-render{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font);color:var(--fk-color-text)}"}},[66,"fk-form-render",{spec:[16],data:[16],context:[16],editable:[4],readOnly:[4,"read-only"],disabled:[4],showSubmit:[4,"show-submit"],submitLabel:[1,"submit-label"],selectedPath:[1,"selected-path"],locale:[1],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],currentData:[32],touched:[32],expandedSpec:[32],expanding:[32],expandError:[32],validate:[64],submit:[64]},[[8,"submit","handleHostFormSubmit"],[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{data:[{syncData:0}],spec:[{onSpecChange:0}]}]);function _(){"undefined"!=typeof customElements&&["fk-form-render","fk-address-search","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-document-reader","fk-drop-area","fk-file-input","fk-geo-map","fk-key-value","fk-select-input","fk-signature-input","fk-slot-picker","fk-stepper","fk-tabs","fk-variable-picker"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),I);break;case"fk-address-search":customElements.get(t(s))||f();break;case"fk-brick-actions":customElements.get(t(s))||u();break;case"fk-brick-not-found":customElements.get(t(s))||p();break;case"fk-brick-render":customElements.get(t(s))||b();break;case"fk-code-editor":customElements.get(t(s))||k();break;case"fk-data-grid":customElements.get(t(s))||v();break;case"fk-document-reader":customElements.get(t(s))||j();break;case"fk-drop-area":customElements.get(t(s))||E();break;case"fk-file-input":customElements.get(t(s))||g();break;case"fk-geo-map":customElements.get(t(s))||y();break;case"fk-key-value":customElements.get(t(s))||O();break;case"fk-select-input":customElements.get(t(s))||S();break;case"fk-signature-input":customElements.get(t(s))||D();break;case"fk-slot-picker":customElements.get(t(s))||C();break;case"fk-stepper":customElements.get(t(s))||x();break;case"fk-tabs":customElements.get(t(s))||w();break;case"fk-variable-picker":customElements.get(t(s))||B()}}))}_();export{I as F,_ as d}
1
+ import{t,p as s,H as e,c as i,h as r}from"./p-8ICOcloT.js";import{b as a,d as o,h as n,e as c,i as h,g as d,v as l}from"./p-DKURyEzf.js";import{registerDefaultBricks as m}from"./index.js";import{d as f}from"./p-D4KN8-B1.js";import{d as p}from"./p-C8z1D4cx.js";import{d as u}from"./p-CIgvEKbO.js";import{d as k}from"./p-hY3kCpWp.js";import{d as b}from"./p-BE5v8BN3.js";import{d as v}from"./p-C2_pMHW6.js";import{d as j}from"./p-B5ahd_Cw.js";import{d as y}from"./p-DvkJXOeH.js";import{d as E}from"./p-YMqkgoWm.js";import{d as g}from"./p-C1-BDfRz.js";import{d as O}from"./p-cQx9YzoT.js";import{d as S}from"./p-BwjcQm3z.js";import{d as C}from"./p-Bp6ZBvZw.js";import{d as D}from"./p-CpJ54lk4.js";import{d as x}from"./p-D_acWh61.js";import{d as w}from"./p-CB944u0q.js";import{d as B}from"./p-D_HjV-j7.js";const _=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=i(this,"formDataChange"),this.formSubmit=i(this,"formSubmit"),this.validityChange=i(this,"validityChange"),this.editable=!1,this.readOnly=!1,this.disabled=!1,this.showSubmit=!1,this.reviewable=!1,this.currentData={},this.touched={},this.expanding=!1,this.utils={validateForm:()=>({isValid:this.runValidation().valid})}}componentWillLoad(){return m(),this.attachFormInternals(),this.currentData=this.seeded(this.data),this.runExpansion()}syncData(t){this.currentData=this.seeded(t)}onSpecChange(){this.currentData=this.seeded(this.data),this.runExpansion()}componentDidLoad(){this.emitValidity()}emitValidity(t){const{valid:s,errors:e}=null!=t?t:this.runValidation(),i=`${s}|${Object.keys(e).sort().join(",")}`;i!==this.lastValidity&&(this.lastValidity=i,this.validityChange.emit({valid:s,errors:e}),this.reportToForm(s,e))}attachFormInternals(){const t=this.host;if("function"==typeof t.attachInternals)try{this.internals=t.attachInternals()}catch(t){this.internals=void 0}}reportToForm(t,s){var e,i,r;if(null===(e=this.internals)||void 0===e?void 0:e.setValidity)try{this.internals.setFormValue(JSON.stringify(this.publicData())),t?this.internals.setValidity({}):this.internals.setValidity({customError:!0},null!==(i=Object.values(s)[0])&&void 0!==i?i:a("form.invalid"),null!==(r=this.host.querySelector("input, select, textarea"))&&void 0!==r?r:void 0)}catch(t){}}handleHostFormSubmit(t){var s;const e=null===(s=this.internals)||void 0===s?void 0:s.form;e&&t.target===e&&(t.preventDefault(),this.submit())}seeded(t){return Object.assign(Object.assign({},o(this.effectiveSpec())),t)}effectiveSpec(){var t;return null!==(t=this.expandedSpec)&&void 0!==t?t:this.spec}async runExpansion(){if(this.expandError=void 0,this.editable||!n(this.spec))return void(this.expandedSpec=void 0);const t=this.spec;this.expanding=!0;try{const s=await c(t);this.spec===t&&(this.expandedSpec=s,this.currentData=this.seeded(this.currentData))}catch(s){this.spec===t&&(this.expandedSpec=void 0,this.expandError=s instanceof Error?s.message:String(s))}finally{this.spec===t&&(this.expanding=!1)}}publicData(){return Object.fromEntries(Object.entries(this.currentData).filter((([t])=>!t.startsWith("_"))))}dataMap(t=this.currentData){return this.context?Object.assign(Object.assign({},t),this.context):t}handleBrickDataChange(t){t.stopPropagation(),this.currentData=this.applyValueEffects(Object.assign(Object.assign({},this.currentData),t.detail));const s=Object.assign({},this.touched);for(const e of Object.keys(t.detail))s[e]=!0;this.touched=s;const{valid:e,errors:i}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:e,errors:i}),this.emitValidity({valid:e,errors:i})}applyValueEffects(t){var s,e;let i=t;for(const{brick:t}of h(this.effectiveSpec())){const r=null===(s=t.configs)||void 0===s?void 0:s.key;if(!r||!(null===(e=t.rules)||void 0===e?void 0:e.length))continue;const a=d(t.rules,this.dataMap(i));void 0!==a.value&&i[r]!==a.value&&(i=Object.assign(Object.assign({},i),{[r]:a.value}))}return i}async validate(){var t;const s={};for(const{brick:e}of h(this.effectiveSpec())){const i=null===(t=e.configs)||void 0===t?void 0:t.key;i&&(s[i]=!0)}this.touched=s;const e=this.runValidation(),i=Object.assign({},e.errors);let r=e.valid;const a=Array.from(this.host.querySelectorAll("fk-data-grid"));for(const t of a){const s=await t.validateRows();r=r&&s.valid,Object.assign(i,s.errors)}const o={valid:r,errors:i};return this.emitValidity(o),this.formDataChange.emit({data:this.publicData(),isValid:o.valid,errors:o.errors}),o}async submit(){const t=await this.validate();return!t.valid||this.readOnly||this.disabled||this.formSubmit.emit({data:this.publicData(),isValid:!0,errors:{}}),t}handleStepTouch(t){t.stopPropagation();const s=Object.assign({},this.touched);for(const e of t.detail.keys)s[e]=!0;this.touched=s}async handleStepperSubmit(t){t.stopPropagation(),await this.submit()}runValidation(){const t=Object.fromEntries(Object.entries(this.currentData).filter((([,t])=>""!==t&&null!=t)));return l(this.effectiveSpec(),t,this.locale,this.context?this.dataMap(t):void 0)}visibleErrors(){if(this.editable)return{};const t={};for(const[s,e]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=e);return t}render(){var t;return this.spec?this.expanding?r("p",{class:"fk-form__expanding"},a("nestedForm.loading")):r("form",{class:"fk-form",onSubmit:t=>t.preventDefault()},this.expandError?r("span",{class:"fk-field__error",role:"alert"},this.expandError):null,r("fk-brick-render",{brickSpec:this.effectiveSpec(),rootSpec:this.effectiveSpec(),data:this.currentData,dataMap:this.dataMap(),errors:this.visibleErrors(),annotations:this.annotations,notes:this.notes,editableKeys:this.editableKeys,reviewable:this.reviewable,locale:this.locale,path:"0",editable:this.editable,readOnly:this.readOnly,disabled:this.disabled,selectedPath:this.selectedPath,utils:this.utils}),!this.showSubmit||this.editable||this.readOnly||this.disabled?null:r("button",{type:"submit",class:"fk-form__submit",onClick:t=>{t.preventDefault(),this.submit()}},null!==(t=this.submitLabel)&&void 0!==t?t:a("form.submit"))):null}static get formAssociated(){return!0}get host(){return this}static get watchers(){return{data:[{syncData:0}],spec:[{onSpecChange:0}]}}static get style(){return".fk-form.sc-fk-form-render{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font);color:var(--fk-color-text)}"}},[66,"fk-form-render",{spec:[16],data:[16],context:[16],editable:[4],readOnly:[4,"read-only"],disabled:[4],showSubmit:[4,"show-submit"],submitLabel:[1,"submit-label"],selectedPath:[1,"selected-path"],locale:[1],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],currentData:[32],touched:[32],expandedSpec:[32],expanding:[32],expandError:[32],validate:[64],submit:[64]},[[8,"submit","handleHostFormSubmit"],[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{data:[{syncData:0}],spec:[{onSpecChange:0}]}]);function V(){"undefined"!=typeof customElements&&["fk-form-render","fk-address-search","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-document-reader","fk-drop-area","fk-file-input","fk-geo-map","fk-key-value","fk-select-input","fk-signature-input","fk-slot-picker","fk-stepper","fk-tabs","fk-variable-picker"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),_);break;case"fk-address-search":customElements.get(t(s))||f();break;case"fk-brick-actions":customElements.get(t(s))||p();break;case"fk-brick-not-found":customElements.get(t(s))||u();break;case"fk-brick-render":customElements.get(t(s))||k();break;case"fk-code-editor":customElements.get(t(s))||b();break;case"fk-data-grid":customElements.get(t(s))||v();break;case"fk-document-reader":customElements.get(t(s))||j();break;case"fk-drop-area":customElements.get(t(s))||y();break;case"fk-file-input":customElements.get(t(s))||E();break;case"fk-geo-map":customElements.get(t(s))||g();break;case"fk-key-value":customElements.get(t(s))||O();break;case"fk-select-input":customElements.get(t(s))||S();break;case"fk-signature-input":customElements.get(t(s))||C();break;case"fk-slot-picker":customElements.get(t(s))||D();break;case"fk-stepper":customElements.get(t(s))||x();break;case"fk-tabs":customElements.get(t(s))||w();break;case"fk-variable-picker":customElements.get(t(s))||B()}}))}V();export{_ as F,V as d}
@@ -1 +1 @@
1
- import{t as s,p as t,H as e,c as i,h as r}from"./p-8ICOcloT.js";import{b as a}from"./p-CN7geIpq.js";const d=s=>Math.round(1e6*s)/1e6,o=s=>{var t,e,i,r,a,o,n,h,l;const c=null!==(t=s.address)&&void 0!==t?t:{},u=[c.house_number,null!==(i=null!==(e=c.road)&&void 0!==e?e:c.pedestrian)&&void 0!==i?i:c.footway].filter(Boolean).join(" ");return{type:"Feature",geometry:{type:"Point",coordinates:[d(Number(s.lon)),d(Number(s.lat))]},properties:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({label:s.display_name},u&&{street:u}),(null!==(o=null!==(a=null!==(r=c.city)&&void 0!==r?r:c.town)&&void 0!==a?a:c.village)&&void 0!==o?o:c.municipality)&&{city:null!==(l=null!==(h=null!==(n=c.city)&&void 0!==n?n:c.town)&&void 0!==h?h:c.village)&&void 0!==l?l:c.municipality}),c.postcode&&{postcode:c.postcode}),c.country&&{country:c.country}),c.country_code&&{countryCode:c.country_code}),void 0!==s.place_id&&{placeId:String(s.place_id)})}},n=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.addressChange=i(this,"addressChange"),this.searchUrl="https://nominatim.openstreetmap.org/search?format=jsonv2&addressdetails=1&limit=5&q={q}",this.disabled=!1,this.readOnly=!1,this.minChars=3,this.query="",this.results=[],this.open=!1,this.loading=!1,this.failed=!1,this.index=0,this.request=0,this.focused=!1,this.onInput=s=>{const t=s.target.value;if(this.query=t,this.timer&&clearTimeout(this.timer),this.addressChange.emit(t.trim()?{type:"Feature",geometry:null,properties:{label:t}}:void 0),t.trim().length<this.minChars)return this.open=!1,void(this.results=[]);this.timer=setTimeout((()=>{this.search(t.trim())}),400)},this.onKeyDown=s=>{this.open&&this.results.length&&("ArrowDown"===s.key?(this.index=(this.index+1)%this.results.length,s.preventDefault()):"ArrowUp"===s.key?(this.index=(this.index-1+this.results.length)%this.results.length,s.preventDefault()):"Enter"===s.key?(this.pick(this.results[this.index]),s.preventDefault()):"Escape"===s.key&&(this.open=!1))}}componentWillLoad(){var s,t;this.query=null!==(t=null===(s=this.value)||void 0===s?void 0:s.properties.label)&&void 0!==t?t:""}onValueChange(s){var t;const e=null!==(t=null==s?void 0:s.properties.label)&&void 0!==t?t:"";this.focused||e===this.query||(this.query=e)}get locked(){return this.disabled||this.readOnly}buildUrl(s){let t=this.searchUrl.replace("{q}",encodeURIComponent(s));return this.countryCodes&&(t+=`${t.includes("?")?"&":"?"}countrycodes=${encodeURIComponent(this.countryCodes)}`),this.language&&(t+=`${t.includes("?")?"&":"?"}accept-language=${encodeURIComponent(this.language)}`),t}async search(s){const t=++this.request;this.loading=!0,this.failed=!1;try{const e=await fetch(this.buildUrl(s),{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(String(e.status));const i=await e.json();if(t!==this.request)return;this.results=Array.isArray(i)?i.map(o):[],this.index=0,this.open=!0}catch(s){if(t!==this.request)return;this.results=[],this.failed=!0,this.open=!0}finally{t===this.request&&(this.loading=!1)}}pick(s){this.query=s.properties.label,this.open=!1,this.results=[],this.addressChange.emit(s)}render(){var s,t;const e=!!(null===(s=this.value)||void 0===s?void 0:s.geometry);return r("div",{key:"d5d4f73ae70e094df80b2b71ae0462a628af886d",class:"fk-address"},r("input",{key:"1911fe734e37dd07698629d8e5229bac432b299c",class:"fk-field__input",type:"text",autocomplete:"off",value:this.query,placeholder:null!==(t=this.placeholder)&&void 0!==t?t:a("address.search"),disabled:this.disabled,readOnly:this.readOnly,onInput:this.onInput,onKeyDown:this.onKeyDown,onFocus:()=>{this.focused=!0},onBlur:()=>{this.focused=!1,setTimeout((()=>{this.open=!1}),120)}}),this.query&&!this.locked?r("span",{class:{"fk-address__status":!0,"fk-address__status--located":e}},a(this.loading?"address.searching":e?"address.located":"address.notLocated")):null,this.open&&!this.locked?r("div",{class:"fk-address__list",role:"listbox"},this.failed?r("div",{class:"fk-address__empty"},a("address.unavailable")):0===this.results.length?r("div",{class:"fk-address__empty"},a("address.noResult")):this.results.map(((s,t)=>r("button",{type:"button",role:"option","aria-selected":t===this.index?"true":"false",class:{"fk-address__item":!0,"fk-address__item--active":t===this.index},onMouseDown:t=>{t.preventDefault(),this.pick(s)},onMouseEnter:()=>{this.index=t}},s.properties.label)))):null)}get el(){return this}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return".sc-fk-address-search-h{display:block}.fk-address.sc-fk-address-search{position:relative}.fk-address__status.sc-fk-address-search{display:block;margin-top:0.25rem;font-size:0.75rem;color:var(--fk-text-muted, #71717a)}.fk-address__status--located.sc-fk-address-search{color:var(--fk-primary, #16a34a)}.fk-address__list.sc-fk-address-search{position:absolute;z-index:20;left:0;right:0;margin-top:0.25rem;max-height:14rem;overflow-y:auto;border:1px solid var(--fk-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);background:var(--fk-bg, #fff);box-shadow:0 8px 24px rgba(0, 0, 0, 0.12)}.fk-address__item.sc-fk-address-search{display:block;width:100%;padding:0.375rem 0.625rem;border:0;background:transparent;color:inherit;font:inherit;font-size:0.8125rem;text-align:left;cursor:pointer}.fk-address__item--active.sc-fk-address-search,.fk-address__item.sc-fk-address-search:hover{background:var(--fk-bg-muted, rgba(127, 127, 127, 0.12))}.fk-address__empty.sc-fk-address-search{padding:0.5rem 0.625rem;font-size:0.75rem;color:var(--fk-text-muted, #71717a)}"}},[2,"fk-address-search",{value:[16],searchUrl:[1,"search-url"],countryCodes:[1,"country-codes"],language:[1],placeholder:[1],disabled:[4],readOnly:[4,"read-only"],minChars:[2,"min-chars"],query:[32],results:[32],open:[32],loading:[32],failed:[32],index:[32]},void 0,{value:[{onValueChange:0}]}]);function h(){"undefined"!=typeof customElements&&["fk-address-search"].forEach((t=>{"fk-address-search"===t&&(customElements.get(s(t))||customElements.define(s(t),n))}))}h();export{n as F,h as d}
1
+ import{t as s,p as t,H as e,c as i,h as r}from"./p-8ICOcloT.js";import{b as a}from"./p-DKURyEzf.js";const o=s=>Math.round(1e6*s)/1e6,d=s=>{var t,e,i,r,a,d,h,n,l;const c=null!==(t=s.address)&&void 0!==t?t:{},u=[c.house_number,null!==(i=null!==(e=c.road)&&void 0!==e?e:c.pedestrian)&&void 0!==i?i:c.footway].filter(Boolean).join(" ");return{type:"Feature",geometry:{type:"Point",coordinates:[o(Number(s.lon)),o(Number(s.lat))]},properties:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({label:s.display_name},u&&{street:u}),(null!==(d=null!==(a=null!==(r=c.city)&&void 0!==r?r:c.town)&&void 0!==a?a:c.village)&&void 0!==d?d:c.municipality)&&{city:null!==(l=null!==(n=null!==(h=c.city)&&void 0!==h?h:c.town)&&void 0!==n?n:c.village)&&void 0!==l?l:c.municipality}),c.postcode&&{postcode:c.postcode}),c.country&&{country:c.country}),c.country_code&&{countryCode:c.country_code}),void 0!==s.place_id&&{placeId:String(s.place_id)})}},h=t(class extends e{constructor(s){super(),!1!==s&&this.__registerHost(),this.addressChange=i(this,"addressChange"),this.searchUrl="https://nominatim.openstreetmap.org/search?format=jsonv2&addressdetails=1&limit=5&q={q}",this.disabled=!1,this.readOnly=!1,this.minChars=3,this.query="",this.results=[],this.open=!1,this.loading=!1,this.failed=!1,this.index=0,this.request=0,this.focused=!1,this.onInput=s=>{const t=s.target.value;if(this.query=t,this.timer&&clearTimeout(this.timer),this.addressChange.emit(t.trim()?{type:"Feature",geometry:null,properties:{label:t}}:void 0),t.trim().length<this.minChars)return this.open=!1,void(this.results=[]);this.timer=setTimeout((()=>{this.search(t.trim())}),400)},this.onKeyDown=s=>{this.open&&this.results.length&&("ArrowDown"===s.key?(this.index=(this.index+1)%this.results.length,s.preventDefault()):"ArrowUp"===s.key?(this.index=(this.index-1+this.results.length)%this.results.length,s.preventDefault()):"Enter"===s.key?(this.pick(this.results[this.index]),s.preventDefault()):"Escape"===s.key&&(this.open=!1))}}componentWillLoad(){var s,t;this.query=null!==(t=null===(s=this.value)||void 0===s?void 0:s.properties.label)&&void 0!==t?t:""}onValueChange(s){var t;const e=null!==(t=null==s?void 0:s.properties.label)&&void 0!==t?t:"";this.focused||e===this.query||(this.query=e)}get locked(){return this.disabled||this.readOnly}buildUrl(s){let t=this.searchUrl.replace("{q}",encodeURIComponent(s));return this.countryCodes&&(t+=`${t.includes("?")?"&":"?"}countrycodes=${encodeURIComponent(this.countryCodes)}`),this.language&&(t+=`${t.includes("?")?"&":"?"}accept-language=${encodeURIComponent(this.language)}`),t}async search(s){const t=++this.request;this.loading=!0,this.failed=!1;try{const e=await fetch(this.buildUrl(s),{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(String(e.status));const i=await e.json();if(t!==this.request)return;this.results=Array.isArray(i)?i.map(d):[],this.index=0,this.open=!0}catch(s){if(t!==this.request)return;this.results=[],this.failed=!0,this.open=!0}finally{t===this.request&&(this.loading=!1)}}pick(s){this.query=s.properties.label,this.open=!1,this.results=[],this.addressChange.emit(s)}render(){var s,t;const e=!!(null===(s=this.value)||void 0===s?void 0:s.geometry);return r("div",{key:"d5d4f73ae70e094df80b2b71ae0462a628af886d",class:"fk-address"},r("input",{key:"1911fe734e37dd07698629d8e5229bac432b299c",class:"fk-field__input",type:"text",autocomplete:"off",value:this.query,placeholder:null!==(t=this.placeholder)&&void 0!==t?t:a("address.search"),disabled:this.disabled,readOnly:this.readOnly,onInput:this.onInput,onKeyDown:this.onKeyDown,onFocus:()=>{this.focused=!0},onBlur:()=>{this.focused=!1,setTimeout((()=>{this.open=!1}),120)}}),this.query&&!this.locked?r("span",{class:{"fk-address__status":!0,"fk-address__status--located":e}},a(this.loading?"address.searching":e?"address.located":"address.notLocated")):null,this.open&&!this.locked?r("div",{class:"fk-address__list",role:"listbox"},this.failed?r("div",{class:"fk-address__empty"},a("address.unavailable")):0===this.results.length?r("div",{class:"fk-address__empty"},a("address.noResult")):this.results.map(((s,t)=>r("button",{type:"button",role:"option","aria-selected":t===this.index?"true":"false",class:{"fk-address__item":!0,"fk-address__item--active":t===this.index},onMouseDown:t=>{t.preventDefault(),this.pick(s)},onMouseEnter:()=>{this.index=t}},s.properties.label)))):null)}get el(){return this}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return".sc-fk-address-search-h{display:block}.fk-address.sc-fk-address-search{position:relative}.fk-address__status.sc-fk-address-search{display:block;margin-top:0.25rem;font-size:0.75rem;color:var(--fk-color-muted, #71717a)}.fk-address__status--located.sc-fk-address-search{color:var(--fk-color-primary, #16a34a)}.fk-address__list.sc-fk-address-search{position:absolute;z-index:20;left:0;right:0;margin-top:0.25rem;max-height:14rem;overflow-y:auto;border:1px solid var(--fk-color-border, #d4d4d8);border-radius:var(--fk-radius, 0.375rem);background:var(--fk-color-surface, #fff);box-shadow:0 8px 24px rgba(0, 0, 0, 0.12)}.fk-address__item.sc-fk-address-search{display:block;width:100%;padding:0.375rem 0.625rem;border:0;background:transparent;color:inherit;font:inherit;font-size:0.8125rem;text-align:left;cursor:pointer}.fk-address__item--active.sc-fk-address-search,.fk-address__item.sc-fk-address-search:hover{background:var(--fk-color-hover, rgba(127, 127, 127, 0.12))}.fk-address__empty.sc-fk-address-search{padding:0.5rem 0.625rem;font-size:0.75rem;color:var(--fk-color-muted, #71717a)}"}},[2,"fk-address-search",{value:[16],searchUrl:[1,"search-url"],countryCodes:[1,"country-codes"],language:[1],placeholder:[1],disabled:[4],readOnly:[4,"read-only"],minChars:[2,"min-chars"],query:[32],results:[32],open:[32],loading:[32],failed:[32],index:[32]},void 0,{value:[{onValueChange:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-address-search"].forEach((t=>{"fk-address-search"===t&&(customElements.get(s(t))||customElements.define(s(t),h))}))}n();export{h as F,n as d}