@streamline-pulse/formkrafter-wc 0.28.1 → 0.29.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 (63) 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-not-found.js +1 -1
  6. package/dist/components/fk-brick-render.js +1 -1
  7. package/dist/components/fk-data-grid.js +1 -1
  8. package/dist/components/fk-document-reader.d.ts +11 -0
  9. package/dist/components/fk-document-reader.js +1 -0
  10. package/dist/components/fk-drop-area.js +1 -1
  11. package/dist/components/fk-empty-form.js +1 -1
  12. package/dist/components/fk-file-input.js +1 -1
  13. package/dist/components/fk-form-builder.js +1 -1
  14. package/dist/components/fk-form-render.js +1 -1
  15. package/dist/components/fk-form-review.js +1 -1
  16. package/dist/components/fk-geo-map.js +1 -1
  17. package/dist/components/fk-property-panel.js +1 -1
  18. package/dist/components/fk-rules-editor.js +1 -1
  19. package/dist/components/fk-select-input.js +1 -1
  20. package/dist/components/fk-signature-input.js +1 -1
  21. package/dist/components/fk-slot-picker.js +1 -1
  22. package/dist/components/fk-stepper.js +1 -1
  23. package/dist/components/fk-tabs.js +1 -1
  24. package/dist/components/fk-variable-picker.js +1 -1
  25. package/dist/components/index.js +1 -1
  26. package/dist/components/{p-DK2UgrV9.js → p-4Q-3Ver4.js} +1 -1
  27. package/dist/components/p-4m9rWHxf.js +1 -0
  28. package/dist/components/{p-Dt5tFknh.js → p-B10DgHR6.js} +1 -1
  29. package/dist/components/{p-DJxeNTfC.js → p-BDpEUqN2.js} +1 -1
  30. package/dist/components/{p-C8yXvs3g.js → p-BHIeIlFC.js} +1 -1
  31. package/dist/components/{p-CIZUeonQ.js → p-BUhr7oBc.js} +1 -1
  32. package/dist/components/p-Bvcoal_I.js +1 -0
  33. package/dist/components/{p-Di7uMflS.js → p-Bys4WPXJ.js} +1 -1
  34. package/dist/components/p-CIgvEKbO.js +1 -0
  35. package/dist/components/{p-CuF0gbWB.js → p-C_Pmu3Ks.js} +1 -1
  36. package/dist/components/{p-YMLbA4H2.js → p-CeeOFuGt.js} +1 -1
  37. package/dist/components/{p-lOT7NMxD.js → p-CpzxDHMT.js} +1 -1
  38. package/dist/components/{p-CVsWXbzX.js → p-CsEICbNO.js} +1 -1
  39. package/dist/components/{p-Ddiv4Djm.js → p-Cxo64gUs.js} +5 -5
  40. package/dist/components/{p-BEft-cf2.js → p-D0hs1wGD.js} +1 -1
  41. package/dist/components/p-DOptnd38.js +1 -0
  42. package/dist/components/{p-DskfAsd6.js → p-DP103_4D.js} +1 -1
  43. package/dist/components/{p-DtPhC0nx.js → p-DSP-Orjw.js} +1 -1
  44. package/dist/components/p-DTPZ6Tcw.js +1 -0
  45. package/dist/components/{p-B5gG7fHb.js → p-DpJEAEkV.js} +1 -1
  46. package/dist/components/{p-BGax6QkM.js → p-USwwkbqI.js} +1 -1
  47. package/dist/components/{p-xvN-OJAU.js → p-cJsQ9IYB.js} +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-1d604a4a.entry.js +1 -0
  51. package/dist/formkrafter-wc/{p-7bc82da2.entry.js → p-4535f1d5.entry.js} +1 -1
  52. package/dist/formkrafter-wc/{p-730cac62.entry.js → p-974ac7cb.entry.js} +1 -1
  53. package/dist/formkrafter-wc/{p-D3ItRsmP.js → p-BAt0IfOE.js} +5 -5
  54. package/dist/formkrafter-wc/{p-CiXmtjEN.js → p-DcT7JnEy.js} +1 -1
  55. package/dist/types/components/fk-document-reader/fk-document-reader.d.ts +44 -0
  56. package/dist/types/components.d.ts +135 -2
  57. package/dist/types/registry/default-bricks.d.ts +18 -0
  58. package/package.json +2 -2
  59. package/dist/components/p-DIW5FtAy.js +0 -1
  60. package/dist/components/p-DMLnAgzb.js +0 -1
  61. package/dist/components/p-FSCguIuu.js +0 -1
  62. package/dist/components/p-t-OoJsHu.js +0 -1
  63. package/dist/formkrafter-wc/p-f867357b.entry.js +0 -1
@@ -1 +1 @@
1
- import{t,p as e,H as s,c as r,h as i}from"./p-8ICOcloT.js";import{u as p,v as o,b as a}from"./p-Ddiv4Djm.js";const c=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=r(this,"stepTouch"),this.stepperSubmit=r(this,"stepperSubmit"),this.stepLabels=[],this.editable=!1,this.readOnly=!1,this.active=0,this.next=t=>{t.preventDefault(),this.readOnly||!this.config("validateSteps",!1)||this.stepValid(this.active)?this.active=Math.min(this.active+1,this.stepLabels.length-1):this.stepTouch.emit({keys:this.stepKeys(this.active)})},this.back=t=>{t.preventDefault(),this.active=Math.max(this.active-1,0)},this.submit=t=>{t.preventDefault(),this.readOnly||!this.config("validateSteps",!1)||this.stepValid(this.active)?this.stepperSubmit.emit():this.stepTouch.emit({keys:this.stepKeys(this.active)})}}clampActive(){this.active>Math.max(this.stepLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-stepper__body");t&&Array.from(t.children).forEach(((t,e)=>{const s=t;this.editable?s.style.removeProperty("display"):s.style.display=e===this.active?"":"none"}))}config(t,e){var s,r;const i=null===(r=null===(s=this.spec)||void 0===s?void 0:s.configs)||void 0===r?void 0:r[t];return"boolean"==typeof i?i:e}stepSpec(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(i&&this.spec)return(null===(r=this.stepCache)||void 0===r?void 0:r.source)!==this.spec&&(this.stepCache={source:this.spec,specs:[]}),this.stepCache.specs[t]||(this.stepCache.specs[t]={type:"panel",id:"step",name:"Step",configs:{key:`step_${t}`},children:[i]}),this.stepCache.specs[t]}stepKeys(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(!i)return[];const o=[];for(const t of p(i))(null===(r=t.configs)||void 0===r?void 0:r.key)&&o.push(t.configs.key);return o}stepValid(t){var e;const s=this.stepSpec(t);if(!s)return!0;const r=Object.fromEntries(Object.entries(null!==(e=this.dataMap)&&void 0!==e?e:{}).filter((([,t])=>""!==t&&null!=t)));return o(s,r,this.locale).valid}goToStep(t){if(this.editable||this.readOnly||t<=this.active)this.active=t;else if(this.config("allowStepClick",!0)){if(this.config("validateSteps",!1))for(let e=this.active;e<t;e++)if(!this.stepValid(e))return this.active=e,void this.stepTouch.emit({keys:this.stepKeys(e)});this.active=t}}render(){const t=Math.max(this.stepLabels.length-1,0),e=!this.editable&&this.config("showSubmit",!1)&&this.active===t;return i("div",{key:"82088e94eb172f4d316546a7294ccc9d9069c7da",class:"fk-stepper"},i("ol",{key:"c23fd1645031ecda9ca6c0a4206a6cb4830316e7",class:"fk-stepper__nav"},this.stepLabels.map(((t,e)=>i("li",{key:`${e}-${t}`,class:{"fk-stepper__step":!0,"fk-stepper__step--active":e===this.active,"fk-stepper__step--done":!this.editable&&e<this.active}},i("button",{type:"button",class:"fk-stepper__step-button","aria-current":e===this.active?"step":void 0,onClick:t=>{t.preventDefault(),this.goToStep(e)}},i("span",{class:"fk-stepper__index"},e+1),i("span",{class:"fk-stepper__label"},t)))))),i("div",{key:"b36c92ad51a8ce66f7b41e7b5896da9ea709c6b5",class:"fk-stepper__body"},i("slot",{key:"47cf02fb10d25413453215de5bcae757cd31e8b2"})),!this.editable&&this.stepLabels.length>1?i("div",{class:"fk-stepper__actions"},i("button",{type:"button",class:"fk-stepper__button",disabled:0===this.active,onClick:this.back},a("stepper.back")),this.active<t?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.next},a("stepper.next")):null,e&&!this.readOnly?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.submit},a("stepper.submit")):null):null)}get host(){return this}static get watchers(){return{stepLabels:[{clampActive:0}]}}static get style(){return".sc-fk-stepper-h{display:block}.fk-stepper.sc-fk-stepper{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-stepper__nav.sc-fk-stepper{display:flex;flex-wrap:wrap;gap:calc(var(--fk-spacing) * 1.5);margin:0;padding:0 0 var(--fk-spacing);list-style:none;border-bottom:1px solid var(--fk-color-border)}.fk-stepper__step.sc-fk-stepper{display:flex;align-items:center;min-height:24px;gap:calc(var(--fk-spacing) / 2);cursor:pointer;color:var(--fk-color-muted);font-size:0.85rem}.fk-stepper__index.sc-fk-stepper{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;border:1px solid var(--fk-color-border);font-size:0.72rem;font-weight:700}.fk-stepper__step--active.sc-fk-stepper{color:var(--fk-color-text);font-weight:600}.fk-stepper__step--active.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:var(--fk-color-surface)}.fk-stepper__step--done.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-stepper__actions.sc-fk-stepper{display:flex;justify-content:space-between;padding-top:var(--fk-spacing);border-top:1px solid var(--fk-color-border)}.fk-stepper__button.sc-fk-stepper{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) calc(var(--fk-spacing) * 1.5);min-height:24px;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-stepper__button--primary.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:var(--fk-color-surface)}.fk-stepper__button.sc-fk-stepper:disabled{opacity:0.45;cursor:not-allowed}.fk-stepper__step-button.sc-fk-stepper{all:unset;display:inline-flex;align-items:center;gap:inherit;cursor:pointer}.fk-stepper__step-button.sc-fk-stepper:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:2px;border-radius:calc(var(--fk-radius) / 2)}"}},[262,"fk-stepper",{stepLabels:[16],editable:[4],readOnly:[4,"read-only"],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{stepLabels:[{clampActive:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-stepper"].forEach((e=>{"fk-stepper"===e&&(customElements.get(t(e))||customElements.define(t(e),c))}))}n();export{c as F,n as d}
1
+ import{t,p as e,H as s,c as r,h as i}from"./p-8ICOcloT.js";import{u as p,v as o,b as a}from"./p-Cxo64gUs.js";const c=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=r(this,"stepTouch"),this.stepperSubmit=r(this,"stepperSubmit"),this.stepLabels=[],this.editable=!1,this.readOnly=!1,this.active=0,this.next=t=>{t.preventDefault(),this.readOnly||!this.config("validateSteps",!1)||this.stepValid(this.active)?this.active=Math.min(this.active+1,this.stepLabels.length-1):this.stepTouch.emit({keys:this.stepKeys(this.active)})},this.back=t=>{t.preventDefault(),this.active=Math.max(this.active-1,0)},this.submit=t=>{t.preventDefault(),this.readOnly||!this.config("validateSteps",!1)||this.stepValid(this.active)?this.stepperSubmit.emit():this.stepTouch.emit({keys:this.stepKeys(this.active)})}}clampActive(){this.active>Math.max(this.stepLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-stepper__body");t&&Array.from(t.children).forEach(((t,e)=>{const s=t;this.editable?s.style.removeProperty("display"):s.style.display=e===this.active?"":"none"}))}config(t,e){var s,r;const i=null===(r=null===(s=this.spec)||void 0===s?void 0:s.configs)||void 0===r?void 0:r[t];return"boolean"==typeof i?i:e}stepSpec(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(i&&this.spec)return(null===(r=this.stepCache)||void 0===r?void 0:r.source)!==this.spec&&(this.stepCache={source:this.spec,specs:[]}),this.stepCache.specs[t]||(this.stepCache.specs[t]={type:"panel",id:"step",name:"Step",configs:{key:`step_${t}`},children:[i]}),this.stepCache.specs[t]}stepKeys(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(!i)return[];const o=[];for(const t of p(i))(null===(r=t.configs)||void 0===r?void 0:r.key)&&o.push(t.configs.key);return o}stepValid(t){var e;const s=this.stepSpec(t);if(!s)return!0;const r=Object.fromEntries(Object.entries(null!==(e=this.dataMap)&&void 0!==e?e:{}).filter((([,t])=>""!==t&&null!=t)));return o(s,r,this.locale).valid}goToStep(t){if(this.editable||this.readOnly||t<=this.active)this.active=t;else if(this.config("allowStepClick",!0)){if(this.config("validateSteps",!1))for(let e=this.active;e<t;e++)if(!this.stepValid(e))return this.active=e,void this.stepTouch.emit({keys:this.stepKeys(e)});this.active=t}}render(){const t=Math.max(this.stepLabels.length-1,0),e=!this.editable&&this.config("showSubmit",!1)&&this.active===t;return i("div",{key:"6b24a758fde11296ce45b27c2b893d6071b371b1",class:"fk-stepper"},i("ol",{key:"4c274463b5243bb1656172183440955469a47c83",class:"fk-stepper__nav"},this.stepLabels.map(((t,e)=>i("li",{key:`${e}-${t}`,class:{"fk-stepper__step":!0,"fk-stepper__step--active":e===this.active,"fk-stepper__step--done":!this.editable&&e<this.active}},i("button",{type:"button",class:"fk-stepper__step-button","aria-current":e===this.active?"step":void 0,onClick:t=>{t.preventDefault(),this.goToStep(e)}},i("span",{class:"fk-stepper__index"},e+1),i("span",{class:"fk-stepper__label"},t)))))),i("div",{key:"fb33fb2685acac88b80a48eb356dd6fa055ec850",class:"fk-stepper__body"},i("slot",{key:"1ce5c7f7700dc87d96b0db89c6ebe6c9507a3e67"})),!this.editable&&this.stepLabels.length>1?i("div",{class:"fk-stepper__actions"},i("button",{type:"button",class:"fk-stepper__button",disabled:0===this.active,onClick:this.back},a("stepper.back")),this.active<t?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.next},a("stepper.next")):null,e&&!this.readOnly?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.submit},a("stepper.submit")):null):null)}get host(){return this}static get watchers(){return{stepLabels:[{clampActive:0}]}}static get style(){return".sc-fk-stepper-h{display:block}.fk-stepper.sc-fk-stepper{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-stepper__nav.sc-fk-stepper{display:flex;flex-wrap:wrap;gap:calc(var(--fk-spacing) * 1.5);margin:0;padding:0 0 var(--fk-spacing);list-style:none;border-bottom:1px solid var(--fk-color-border)}.fk-stepper__step.sc-fk-stepper{display:flex;align-items:center;min-height:24px;gap:calc(var(--fk-spacing) / 2);cursor:pointer;color:var(--fk-color-muted);font-size:0.85rem}.fk-stepper__index.sc-fk-stepper{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;border:1px solid var(--fk-color-border);font-size:0.72rem;font-weight:700}.fk-stepper__step--active.sc-fk-stepper{color:var(--fk-color-text);font-weight:600}.fk-stepper__step--active.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:var(--fk-color-surface)}.fk-stepper__step--done.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-stepper__actions.sc-fk-stepper{display:flex;justify-content:space-between;padding-top:var(--fk-spacing);border-top:1px solid var(--fk-color-border)}.fk-stepper__button.sc-fk-stepper{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) calc(var(--fk-spacing) * 1.5);min-height:24px;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-stepper__button--primary.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:var(--fk-color-surface)}.fk-stepper__button.sc-fk-stepper:disabled{opacity:0.45;cursor:not-allowed}.fk-stepper__step-button.sc-fk-stepper{all:unset;display:inline-flex;align-items:center;gap:inherit;cursor:pointer}.fk-stepper__step-button.sc-fk-stepper:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:2px;border-radius:calc(var(--fk-radius) / 2)}"}},[262,"fk-stepper",{stepLabels:[16],editable:[4],readOnly:[4,"read-only"],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{stepLabels:[{clampActive:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-stepper"].forEach((e=>{"fk-stepper"===e&&(customElements.get(t(e))||customElements.define(t(e),c))}))}n();export{c as F,n as d}
@@ -0,0 +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-Cxo64gUs.js";import{registerDefaultBricks as m}from"./index.js";import{d as f}from"./p-BHIeIlFC.js";import{d as p}from"./p-BDpEUqN2.js";import{d as u}from"./p-CIgvEKbO.js";import{d as b}from"./p-Bvcoal_I.js";import{d as k}from"./p-BE5v8BN3.js";import{d as v}from"./p-cJsQ9IYB.js";import{d as j}from"./p-4m9rWHxf.js";import{d as E}from"./p-B10DgHR6.js";import{d as g}from"./p-DpJEAEkV.js";import{d as O}from"./p-DP103_4D.js";import{d as y}from"./p-DSP-Orjw.js";import{d as S}from"./p-Bys4WPXJ.js";import{d as D}from"./p-CeeOFuGt.js";import{d as C}from"./p-D0hs1wGD.js";import{d as x}from"./p-USwwkbqI.js";import{d as w}from"./p-CsEICbNO.js";const B=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 F(){"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-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),B);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))||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))||O();break;case"fk-select-input":customElements.get(t(s))||y();break;case"fk-signature-input":customElements.get(t(s))||S();break;case"fk-slot-picker":customElements.get(t(s))||D();break;case"fk-stepper":customElements.get(t(s))||C();break;case"fk-tabs":customElements.get(t(s))||x();break;case"fk-variable-picker":customElements.get(t(s))||w()}}))}F();export{B as F,F 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-Ddiv4Djm.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-CuF0gbWB.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:"ba4c59daf0ed18f7702ef91fe8b400dd1f3021fd",class:{"fk-geo":!0,"fk-geo--locked":this.locked}},a("div",{key:"341d1e70707f152ff067e4ee39df140eb56c4994",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-Cxo64gUs.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-C_Pmu3Ks.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 +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-Ddiv4Djm.js";let p=0;const f=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-"+ ++p,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()}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)||"";if(s){if(t||s!==this.lastCatalogRef){this.lastCatalogRef=s;try{this.catalogError=void 0,this.catalogOptions=await l.optionSourceService.fetchOptions(s)}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:"0bab538ee319b32424b144f1bbeaf780bb01a0c3",class:{"fk-select":!0,"fk-select--disabled":this.disabled}},o("div",{key:"53ea29e53ab810c00eea61f211e214cec578dd81",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:"dd48f9909cc830a59c113e86444399b7d434414d",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:"363c2c91c960e7c4e677951c202dda8591da9a88",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),f))}))}u();export{f as F,u as d}
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 c,p as a,s as l,n,m as h,b as d}from"./p-Cxo64gUs.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()}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=c(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=a(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)||"";if(s){if(t||s!==this.lastCatalogRef){this.lastCatalogRef=s;try{this.catalogError=void 0,this.catalogOptions=await l.optionSourceService.fetchOptions(s)}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 c=(null===(t=this.configs)||void 0===t?void 0:t.labelKey)||void 0,a=(null===(e=this.configs)||void 0===e?void 0:e.valueKey)||void 0;switch(this.source()){case"remote":return{options:n(this.remoteOptions,c,a),error:this.remoteError};case"catalog":return{options:n(this.catalogOptions,c,a),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]:[],c,a)}}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,c,a)}}default:return{options:n(null===(r=this.configs)||void 0===r?void 0:r.options,c,a)}}}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(),c=this.filteredOptions(s);return o("div",{key:"cc834cc96c60b834d98faada23d6c3ddb142e320",class:{"fk-select":!0,"fk-select--disabled":this.disabled}},o("div",{key:"dffca39b507ce68a40681b2dccab7867c06b86b7",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:"7cf146710fd42e93f41a1c950dc0a0cfd45f84ca",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:"fe3b8f3204e931175be40e35a7c9ee6fe42fca53",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":c.length?`${this.instanceId}-opt-${Math.min(this.activeIndex,c.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,c)}),o("div",{class:"fk-select__options",role:"listbox",id:`${this.instanceId}-listbox`,"aria-multiselectable":this.multiple?"true":void 0},c.map(((t,e)=>{const s=r.includes(t.value),i=e===Math.min(this.activeIndex,c.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===c.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}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as s,c as l,h as r}from"./p-8ICOcloT.js";import{b as o,j as a,f as i}from"./p-Cxo64gUs.js";import{d as n}from"./p-BE5v8BN3.js";import{d as p}from"./p-4Q-3Ver4.js";const c=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.brickConfigsChange=l(this,"brickConfigsChange"),this.brickValidationsChange=l(this,"brickValidationsChange"),this.brickStylesChange=l(this,"brickStylesChange"),this.fields=[],this.locales=[],this.activeTab="config",this.newStyleKey=""}onBrickChange(){this.availableTabs().some((e=>e.id===this.activeTab))||(this.activeTab="config")}availableTabs(){const e=[{id:"config",label:o("panel.tab.config")}];return"input"===this.brick.type&&e.push({id:"validation",label:o("panel.tab.validation")}),e.push({id:"styles",label:o("panel.tab.styles")},{id:"rules",label:o("panel.tab.rules")}),e}localized(e,t){var s;if(this.locales.length<=1)return t||void 0;const l=a(e)?Object.assign({},e):{};return"string"==typeof e&&e&&!a(e)&&(l[this.locales[0]]=e),l[null!==(s=this.editLocale)&&void 0!==s?s:this.locales[0]]=t,l}readLocalized(e){var t,s,l;return a(e)?null!==(s=e[null!==(t=this.editLocale)&&void 0!==t?t:this.locales[0]])&&void 0!==s?s:"":null!==(l=e)&&void 0!==l?l:""}writeTextConfig(e,t){var s;this.emitConfigs({[e]:this.localized(null===(s=this.brick.configs)||void 0===s?void 0:s[e],t)})}emitConfigs(e){this.path&&this.brickConfigsChange.emit({configs:e,path:this.path})}emitValidations(e){this.path&&this.brickValidationsChange.emit({validations:e,path:this.path})}emitStyles(e){this.path&&this.brickStylesChange.emit({styles:e,path:this.path})}validationOf(e){var t;return null===(t=this.brick.validations)||void 0===t?void 0:t.find((t=>t.validator===e))}setValidation(e,t,s={}){var l;const r=this.validationOf(e),o=(null!==(l=this.brick.validations)&&void 0!==l?l:[]).filter((t=>t.validator!==e));this.emitValidations(t?[...o,Object.assign(Object.assign(Object.assign({},r),{validator:e}),s)]:o)}addStyle(e){const t=this.newStyleKey.trim();t&&(this.emitStyles({[t]:e}),this.newStyleKey="")}textField(e,t,s){var l;return r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},e),r("input",{class:"fk-props__input",type:"text",value:null!==(l=t)&&void 0!==l?l:"",onChange:e=>s(e.target.value)}))}optionsFields(){var e,t,s;const l=this.brick.configs;if(!l||!("options"in l)&&!("optionsSource"in l))return[];const a="optionsSource"in l,i=a&&null!==(e=l.optionsSource)&&void 0!==e?e:"static",n=a?[r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},o("panel.optionsSource")),r("select",{class:"fk-props__input",onChange:e=>this.emitConfigs({optionsSource:e.target.value})},["static","dataMap","remote","js","catalog"].map((e=>r("option",{value:e,selected:e===i},e)))))]:[];return"static"===i&&n.push(r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},o("panel.options")),r("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.writeTextConfig("options",e.target.value)},this.readLocalized(l.options)))),"dataMap"===i&&n.push(this.textField(o("panel.dataKey"),l.optionsPath,(e=>this.emitConfigs({optionsPath:e})))),"remote"===i&&n.push(this.textField(o("panel.url"),l.optionsUrl,(e=>this.emitConfigs({optionsUrl:e}))),this.textField(o("panel.responsePath"),l.optionsPath,(e=>this.emitConfigs({optionsPath:e||void 0}))),r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},o("panel.headers")),r("textarea",{class:"fk-props__input fk-props__input--textarea",placeholder:"Authorization: Bearer {token}",onChange:e=>this.emitConfigs({optionsHeaders:e.target.value||void 0})},null!==(t=l.optionsHeaders)&&void 0!==t?t:"")),this.textField(o("panel.searchParam"),l.searchParam,(e=>this.emitConfigs({searchParam:e||void 0})))),"js"===i&&n.push(r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},"Code"),r("fk-code-editor",{completions:this.fields,value:null!==(s=l.optionsCode)&&void 0!==s?s:"",placeholder:"return dataMap.country === 'BJ' ? ['Cotonou'] : ['Paris'];",onCodeChange:e=>this.emitConfigs({optionsCode:e.detail})}))),"catalog"===i&&n.push(this.textField(o("panel.optionsRef"),l.optionsRef,(e=>this.emitConfigs({optionsRef:e})))),"remote"!==i&&"js"!==i&&"catalog"!==i||n.push(this.textField(o("panel.labelKey"),l.labelKey,(e=>this.emitConfigs({labelKey:e}))),this.textField(o("panel.valueKey"),l.valueKey,(e=>this.emitConfigs({valueKey:e})))),n}renderConfigTab(){const e=this.brick.configs,t="input"===this.brick.type;return r("section",{class:"fk-props__section"},this.textField(o("panel.key"),null==e?void 0:e.key,(e=>this.emitConfigs({key:e}))),this.textField(o("panel.label"),this.readLocalized(null==e?void 0:e.label),(e=>this.writeTextConfig("label",e))),t?[this.textField(o("panel.placeholder"),this.readLocalized(null==e?void 0:e.placeholder),(e=>this.writeTextConfig("placeholder",e))),this.textField(o("panel.prefix"),null==e?void 0:e.prefix,(e=>this.emitConfigs({prefix:e||void 0}))),this.textField(o("panel.suffix"),null==e?void 0:e.suffix,(e=>this.emitConfigs({suffix:e||void 0})))]:null,e&&"specRef"in e?this.textField(i("panel.specRef","Referenced form (specRef)"),e.specRef,(e=>this.emitConfigs({specRef:e}))):null,e&&"mask"in e?this.textField(i("panel.mask","Input mask (9=digit, a=letter, *=any)"),e.mask,(e=>this.emitConfigs({mask:e}))):null,e&&"searchUrl"in e?[this.textField(i("panel.searchUrl","Geocoding URL ({q} = query)"),e.searchUrl,(e=>this.emitConfigs({searchUrl:e}))),this.textField(i("panel.countryCodes","Country codes (bj, tg)"),e.countryCodes,(e=>this.emitConfigs({countryCodes:e})))]:null,e&&"layerUrl"in e?[this.textField(i("panel.layerUrl","Reference layer URL (GeoJSON)"),e.layerUrl,(e=>this.emitConfigs({layerUrl:e}))),this.textField(i("panel.codeProperty","Code property"),e.codeProperty,(e=>this.emitConfigs({codeProperty:e||"code"}))),this.textField(i("panel.nameProperty","Name property"),e.nameProperty,(e=>this.emitConfigs({nameProperty:e||"name"})))]:null,e&&"idFormat"in e?this.textField(i("panel.idFormat","Identifier format (fr-nir, bj-npi, digits-10…)"),e.idFormat,(e=>this.emitConfigs({idFormat:e}))):null,e&&"currencies"in e?[this.textField(i("panel.currencies","Currencies offered (XOF, EUR, USD)"),e.currencies,(e=>this.emitConfigs({currencies:e}))),this.textField(i("panel.currency","Default currency"),e.currency,(e=>this.emitConfigs({currency:e.toUpperCase()})))]:null,e&&"slotsUrl"in e?[this.textField(i("panel.slotsUrl","Slots URL (empty = opening rules)"),e.slotsUrl,(e=>this.emitConfigs({slotsUrl:e}))),this.textField(i("panel.slotDays","Open days (1 = Monday … 7 = Sunday)"),e.days,(e=>this.emitConfigs({days:e}))),this.textField(i("panel.slotFrom","Opens at"),e.from,(e=>this.emitConfigs({from:e}))),this.textField(i("panel.slotTo","Closes at"),e.to,(e=>this.emitConfigs({to:e}))),this.textField(i("panel.slotDuration","Slot length (minutes)"),e.duration,(e=>this.emitConfigs({duration:""===e?void 0:Number(e)}))),this.textField(i("panel.slotHorizon","Bookable days ahead"),e.horizonDays,(e=>this.emitConfigs({horizonDays:""===e?void 0:Number(e)}))),this.textField(i("panel.slotNotice","Notice (hours)"),e.noticeHours,(e=>this.emitConfigs({noticeHours:""===e?void 0:Number(e)}))),this.textField(i("panel.slotExclude","Closed dates (YYYY-MM-DD, comma-separated)"),e.exclude,(e=>this.emitConfigs({exclude:e})))]:null,e&&"readUrl"in e?[this.textField(i("panel.readUrl","Reader URL (empty = host default)"),e.readUrl,(e=>this.emitConfigs({readUrl:e}))),r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.documentFields","Fields to read (key|Label per line)")),r("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.emitConfigs({fields:e.target.value})},"string"==typeof e.fields?e.fields:"")),r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.documentFills","Fill the form (field=formKey per line)")),r("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.emitConfigs({fills:e.target.value})},"string"==typeof e.fills?e.fills:"")),this.textField(i("panel.documentLanguage","Document language (fr, en…)"),e.language,(e=>this.emitConfigs({language:e}))),this.textField(i("panel.accept","Accepted files"),e.accept,(e=>this.emitConfigs({accept:e}))),this.textField(i("panel.uploadUrl","Upload URL"),e.uploadUrl,(e=>this.emitConfigs({uploadUrl:e})))]:null,e&&"tileUrl"in e?[this.textField(i("panel.center","Initial center (lat, lng)"),e.center,(e=>this.emitConfigs({center:e}))),this.textField(i("panel.zoom","Initial zoom"),e.zoom,(e=>this.emitConfigs({zoom:""===e?void 0:Number(e)}))),this.textField(i("panel.height","Height (px)"),e.height,(e=>this.emitConfigs({height:""===e?void 0:Number(e)}))),this.textField(i("panel.tileUrl","Tile URL"),e.tileUrl,(e=>this.emitConfigs({tileUrl:e}))),"shape"in e?this.textField(i("panel.shape","Shape (polygon or line)"),e.shape,(e=>this.emitConfigs({shape:"line"===e?"line":"polygon"}))):null]:null,e&&"accept"in e?this.textField(i("panel.accept","Accepted file types"),e.accept,(e=>this.emitConfigs({accept:e}))):null,e&&"uploadUrl"in e?this.textField(i("panel.uploadUrl","Upload URL"),e.uploadUrl,(e=>this.emitConfigs({uploadUrl:e}))):null,this.optionsFields(),Object.entries(null!=e?e:{}).filter((([,e])=>"boolean"==typeof e)).map((([e,t])=>r("label",{class:"fk-props__field fk-props__field--inline",key:e},r("input",{type:"checkbox",checked:!0===t,onChange:t=>this.emitConfigs({[e]:t.target.checked})}),r("span",{class:"fk-props__label"},i(`panel.cfg.${e}`,e))))),e&&"content"in e?r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},o("panel.content")),r("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.writeTextConfig("content",e.target.value)},this.readLocalized(e.content))):null)}validationRow(e,t,s){const l=this.validationOf(e);return r("div",{class:"fk-props__vrule"},r("label",{class:"fk-props__field fk-props__field--inline"},r("input",{type:"checkbox",checked:!!l,onChange:t=>this.setValidation(e,t.target.checked)}),r("span",{class:"fk-props__label"},t)),l&&s?r("input",{class:"fk-props__input",type:s,placeholder:"number"===s?"value":"regex",value:null==l.value?"":String(l.value),onChange:t=>{const l=t.target.value;this.setValidation(e,!0,{value:"number"===s?""===l?void 0:Number(l):l||void 0})}}):null,l?this.textField(o("panel.errorMessage"),this.readLocalized(l.message),(t=>this.setValidation(e,!0,{message:this.localized(l.message,t)}))):null)}renderValidationTab(){var e;const t=this.brick.dataType,s=this.validationOf("custom");return r("section",{class:"fk-props__section"},this.validationRow("required",o("panel.required")),"string"===t?[this.validationRow("minLength",o("panel.minLength"),"number"),this.validationRow("maxLength",o("panel.maxLength"),"number"),this.validationRow("pattern",o("panel.pattern"),"text"),this.validationRow("email",o("panel.emailFormat")),this.validationRow("url",o("panel.urlFormat"))]:null,"number"===t?[this.validationRow("min",o("panel.min"),"number"),this.validationRow("max",o("panel.max"),"number")]:null,"array"===t?[this.validationRow("minItems",o("panel.minItems"),"number"),this.validationRow("maxItems",o("panel.maxItems"),"number")]:null,r("div",{class:"fk-props__vrule"},r("label",{class:"fk-props__field fk-props__field--inline"},r("input",{type:"checkbox",checked:!!s,onChange:e=>{var t;return this.setValidation("custom",e.target.checked,{customValidator:null!==(t=null==s?void 0:s.customValidator)&&void 0!==t?t:"return true;"})}}),r("span",{class:"fk-props__label"},o("panel.custom"))),s?r("fk-code-editor",{completions:this.fields,value:null!==(e=s.customValidator)&&void 0!==e?e:"",placeholder:'return value?.startsWith("BJ-") ? true : "Must start with BJ-";',onCodeChange:e=>this.setValidation("custom",!0,{customValidator:e.detail})}):null,s?this.textField(o("panel.fallbackMessage"),this.readLocalized(s.message),(e=>this.setValidation("custom",!0,{message:this.localized(s.message,e)}))):null))}renderStylesTab(){var e;return r("section",{class:"fk-props__section"},Object.entries(null!==(e=this.brick.styles)&&void 0!==e?e:{}).map((([e,t])=>r("div",{class:"fk-props__style-row",key:e},r("span",{class:"fk-props__style-key"},e),r("input",{class:"fk-props__input fk-props__input--grow",type:"text",value:String(null!=t?t:""),onChange:t=>this.emitStyles({[e]:t.target.value})}),r("button",{type:"button",class:"fk-props__remove",title:"Remove style",onClick:()=>this.emitStyles({[e]:void 0})},"✕")))),r("div",{class:"fk-props__style-row"},r("input",{class:"fk-props__input",type:"text",placeholder:o("panel.styleProperty"),value:this.newStyleKey,onInput:e=>this.newStyleKey=e.target.value}),r("input",{class:"fk-props__input fk-props__input--grow",type:"text",placeholder:o("panel.styleValue"),onChange:e=>{const t=e.target;this.addStyle(t.value),t.value=""}})))}render(){return r("div",{key:"88fb703a0d60cd27bf787d6d79e1870669103cdf",class:"fk-props"},r("header",{key:"f543f8c5b8577778e86c1352a521fdff47009e3b",class:"fk-props__header"},r("span",{key:"ca98f6ba31f53da5c6f5b526ce92bab3917da6ca",class:"fk-props__type"},this.brick.type),r("h4",{key:"0220a2ab3ca43382ee3a36f78afa004225fba7e4",class:"fk-props__title"},i(`brick.${this.brick.id}.name`,this.brick.name))),r("div",{key:"07de74eb57cb5ea699b8bff0002c22d531d70ce8",class:"fk-props__tabs"},this.availableTabs().map((e=>r("button",{key:e.id,type:"button",class:{"fk-props__tab":!0,"fk-props__tab--active":this.activeTab===e.id},onClick:()=>this.activeTab=e.id},e.label)))),"config"===this.activeTab?this.renderConfigTab():null,"validation"===this.activeTab?this.renderValidationTab():null,"styles"===this.activeTab?this.renderStylesTab():null,"rules"===this.activeTab?r("section",{class:"fk-props__section"},r("fk-rules-editor",{brick:this.brick,path:this.path,fields:this.fields})):null)}static get watchers(){return{brick:[{onBrickChange:0}]}}static get style(){return".sc-fk-property-panel-h{display:block}.fk-props.sc-fk-property-panel{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) * 1.5)}.fk-props__header.sc-fk-property-panel{display:flex;flex-direction:column;gap:2px}.fk-props__type.sc-fk-property-panel{font-size:0.65rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--fk-color-primary)}.fk-props__title.sc-fk-property-panel{margin:0;font-size:0.95rem;color:var(--fk-color-text)}.fk-props__section.sc-fk-property-panel{display:flex;flex-direction:column;gap:var(--fk-spacing);padding-top:var(--fk-spacing)}.fk-props__tabs.sc-fk-property-panel{display:flex;gap:2px;border-bottom:1px solid var(--fk-color-border)}.fk-props__tab.sc-fk-property-panel{font:inherit;font-size:0.72rem;font-weight:600;padding:5px 9px;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-props__tab.sc-fk-property-panel:hover{color:var(--fk-color-text)}.fk-props__tab--active.sc-fk-property-panel{color:var(--fk-color-primary);border-bottom-color:var(--fk-color-primary)}.fk-props__section-title.sc-fk-property-panel{margin:0;font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--fk-color-muted)}.fk-props__field.sc-fk-property-panel{display:flex;flex-direction:column;gap:4px;font-style:normal;text-decoration:none}.fk-props__field--inline.sc-fk-property-panel{flex-direction:row;align-items:center;gap:8px}.fk-props__label.sc-fk-property-panel{font-size:0.75rem;font-weight:600;color:var(--fk-color-muted);font-style:normal;text-decoration:none}.fk-props__input.sc-fk-property-panel{font:inherit;font-size:0.85rem;padding:6px 8px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);color:var(--fk-color-text)}.fk-props__input.sc-fk-property-panel:focus{outline:none;border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-props__input--textarea.sc-fk-property-panel{min-height:72px;resize:vertical}.fk-props__vrule.sc-fk-property-panel{display:flex;flex-direction:column;gap:6px;padding:calc(var(--fk-spacing) / 1.5);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5)}.fk-props__style-row.sc-fk-property-panel{display:flex;align-items:center;gap:6px}.fk-props__style-key.sc-fk-property-panel{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:0.75rem;color:var(--fk-color-text);min-width:72px}.fk-props__input--grow.sc-fk-property-panel{flex:1;min-width:0}.fk-props__remove.sc-fk-property-panel{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.75rem;cursor:pointer;padding:2px 4px;border-radius:calc(var(--fk-radius) / 2)}.fk-props__remove.sc-fk-property-panel:hover{color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}"}},[2,"fk-property-panel",{brick:[16],path:[1],fields:[16],locales:[16],locale:[1],editLocale:[1,"edit-locale"],activeTab:[32],newStyleKey:[32]},void 0,{brick:[{onBrickChange:0}]}]);function h(){"undefined"!=typeof customElements&&["fk-property-panel","fk-code-editor","fk-rules-editor"].forEach((t=>{switch(t){case"fk-property-panel":customElements.get(e(t))||customElements.define(e(t),c);break;case"fk-code-editor":customElements.get(e(t))||n();break;case"fk-rules-editor":customElements.get(e(t))||p()}}))}h();export{c as F,h as d}
@@ -1 +1 @@
1
- import{t as i,p as e,H as s,c as t,h as r}from"./p-8ICOcloT.js";import{s as o,b as l,f as a}from"./p-Ddiv4Djm.js";const f=e(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.fileValueChange=t(this,"fileValueChange"),this.disabled=!1,this.multiple=!1,this.uploading=!1,this.handleFile=async i=>{var e;const s=i.target,t=Array.from(null!==(e=s.files)&&void 0!==e?e:[]);if(t.length){this.uploading=!0,this.uploadError=void 0;try{const i=[];for(const e of this.multiple?t:t.slice(0,1))i.push(await o.fileUploadService.upload(e,{url:this.uploadUrl}));this.emitFiles(this.multiple?[...this.files,...i]:i)}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.uploading=!1,s.value=""}}},this.handleRemove=async i=>{var e,s;this.removingUrl=i.url,this.uploadError=void 0;try{await(null===(s=(e=o.fileUploadService).remove)||void 0===s?void 0:s.call(e,i,{url:this.uploadUrl}))}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.removingUrl=void 0,this.emitFiles(this.files.filter((e=>e!==i)))}}}get files(){return Array.isArray(this.value)?this.value:this.value?[this.value]:[]}emitFiles(i){this.fileValueChange.emit(this.multiple?i.length?i:void 0:i[0])}formatSize(i){return i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1048576).toFixed(1)} MB`}renderFile(i){const e=void 0!==this.removingUrl&&this.removingUrl===i.url;return r("div",{class:"fk-file__selected",key:`${i.url}:${i.name}`},r("span",{class:"fk-file__icon","aria-hidden":"true"},r("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r("polyline",{points:"14 2 14 8 20 8"}))),r("span",{class:"fk-file__meta"},r("span",{class:"fk-file__name",title:i.name},i.name),r("span",{class:"fk-file__size"},this.formatSize(i.size))),r("button",{type:"button",class:"fk-file__remove",title:l("file.remove"),disabled:this.disabled||e,onClick:e=>{e.preventDefault(),this.handleRemove(i)}},e?"…":"✕"))}render(){const i=this.files,e=this.multiple||0===i.length;return r("div",{key:"ddbfcc44d0673306aecb70e80acccc9c69ac6770",class:"fk-file"},i.map((i=>this.renderFile(i))),e?r("button",{type:"button",class:"fk-file__choose",disabled:this.disabled||this.uploading,onClick:i=>{var e;i.preventDefault(),null===(e=this.inputEl)||void 0===e||e.click()}},this.uploading?l("file.uploading"):this.multiple&&i.length?a("file.addAnother","+ Add a file"):l("file.choose")):null,r("input",{key:"aad19b5f8143e41f445c05c2b7fcef409761f26a",class:"fk-file__native",type:"file",accept:this.accept,multiple:this.multiple,disabled:this.disabled,ref:i=>this.inputEl=i,onChange:this.handleFile}),this.uploadError?r("span",{class:"fk-field__error"},this.uploadError):null)}static get style(){return".sc-fk-file-input-h{display:block}.fk-file.sc-fk-file-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-file__native.sc-fk-file-input{display:none}.fk-file__choose.sc-fk-file-input{font:inherit;font-size:0.85rem;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-file__choose.sc-fk-file-input:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-file__choose.sc-fk-file-input:disabled{opacity:0.55;cursor:not-allowed}.fk-file__selected.sc-fk-file-input{display:flex;align-items:center;gap:var(--fk-spacing);width:100%;box-sizing:border-box;padding:calc(var(--fk-spacing) * 0.75) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-file__icon.sc-fk-file-input{display:inline-flex;flex-shrink:0;color:var(--fk-color-primary)}.fk-file__meta.sc-fk-file-input{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.fk-file__name.sc-fk-file-input{font-size:0.85rem;font-weight:600;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fk-file__size.sc-fk-file-input{font-size:0.72rem;color:var(--fk-color-muted);white-space:nowrap}.fk-file__remove.sc-fk-file-input{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;border-radius:calc(var(--fk-radius) / 2);flex-shrink:0}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent)}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){color:var(--fk-color-danger)}"}},[2,"fk-file-input",{value:[16],disabled:[4],accept:[1],uploadUrl:[1,"upload-url"],multiple:[4],uploading:[32],removingUrl:[32],uploadError:[32]}]);function n(){"undefined"!=typeof customElements&&["fk-file-input"].forEach((e=>{"fk-file-input"===e&&(customElements.get(i(e))||customElements.define(i(e),f))}))}n();export{f as F,n as d}
1
+ import{t as i,p as e,H as s,c as t,h as r}from"./p-8ICOcloT.js";import{s as o,b as l,f as a}from"./p-Cxo64gUs.js";const f=e(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.fileValueChange=t(this,"fileValueChange"),this.disabled=!1,this.multiple=!1,this.uploading=!1,this.handleFile=async i=>{var e;const s=i.target,t=Array.from(null!==(e=s.files)&&void 0!==e?e:[]);if(t.length){this.uploading=!0,this.uploadError=void 0;try{const i=[];for(const e of this.multiple?t:t.slice(0,1))i.push(await o.fileUploadService.upload(e,{url:this.uploadUrl}));this.emitFiles(this.multiple?[...this.files,...i]:i)}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.uploading=!1,s.value=""}}},this.handleRemove=async i=>{var e,s;this.removingUrl=i.url,this.uploadError=void 0;try{await(null===(s=(e=o.fileUploadService).remove)||void 0===s?void 0:s.call(e,i,{url:this.uploadUrl}))}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.removingUrl=void 0,this.emitFiles(this.files.filter((e=>e!==i)))}}}get files(){return Array.isArray(this.value)?this.value:this.value?[this.value]:[]}emitFiles(i){this.fileValueChange.emit(this.multiple?i.length?i:void 0:i[0])}formatSize(i){return i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1048576).toFixed(1)} MB`}renderFile(i){const e=void 0!==this.removingUrl&&this.removingUrl===i.url;return r("div",{class:"fk-file__selected",key:`${i.url}:${i.name}`},r("span",{class:"fk-file__icon","aria-hidden":"true"},r("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r("polyline",{points:"14 2 14 8 20 8"}))),r("span",{class:"fk-file__meta"},r("span",{class:"fk-file__name",title:i.name},i.name),r("span",{class:"fk-file__size"},this.formatSize(i.size))),r("button",{type:"button",class:"fk-file__remove",title:l("file.remove"),disabled:this.disabled||e,onClick:e=>{e.preventDefault(),this.handleRemove(i)}},e?"…":"✕"))}render(){const i=this.files,e=this.multiple||0===i.length;return r("div",{key:"423b1bd452ac810e8b84b2b63769fa93feab2a0e",class:"fk-file"},i.map((i=>this.renderFile(i))),e?r("button",{type:"button",class:"fk-file__choose",disabled:this.disabled||this.uploading,onClick:i=>{var e;i.preventDefault(),null===(e=this.inputEl)||void 0===e||e.click()}},this.uploading?l("file.uploading"):this.multiple&&i.length?a("file.addAnother","+ Add a file"):l("file.choose")):null,r("input",{key:"1e2912ced33b3aff036f488e927a136eabc9470b",class:"fk-file__native",type:"file",accept:this.accept,multiple:this.multiple,disabled:this.disabled,ref:i=>this.inputEl=i,onChange:this.handleFile}),this.uploadError?r("span",{class:"fk-field__error"},this.uploadError):null)}static get style(){return".sc-fk-file-input-h{display:block}.fk-file.sc-fk-file-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-file__native.sc-fk-file-input{display:none}.fk-file__choose.sc-fk-file-input{font:inherit;font-size:0.85rem;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-file__choose.sc-fk-file-input:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-file__choose.sc-fk-file-input:disabled{opacity:0.55;cursor:not-allowed}.fk-file__selected.sc-fk-file-input{display:flex;align-items:center;gap:var(--fk-spacing);width:100%;box-sizing:border-box;padding:calc(var(--fk-spacing) * 0.75) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-file__icon.sc-fk-file-input{display:inline-flex;flex-shrink:0;color:var(--fk-color-primary)}.fk-file__meta.sc-fk-file-input{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.fk-file__name.sc-fk-file-input{font-size:0.85rem;font-weight:600;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fk-file__size.sc-fk-file-input{font-size:0.72rem;color:var(--fk-color-muted);white-space:nowrap}.fk-file__remove.sc-fk-file-input{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;border-radius:calc(var(--fk-radius) / 2);flex-shrink:0}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent)}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){color:var(--fk-color-danger)}"}},[2,"fk-file-input",{value:[16],disabled:[4],accept:[1],uploadUrl:[1,"upload-url"],multiple:[4],uploading:[32],removingUrl:[32],uploadError:[32]}]);function n(){"undefined"!=typeof customElements&&["fk-file-input"].forEach((e=>{"fk-file-input"===e&&(customElements.get(i(e))||customElements.define(i(e),f))}))}n();export{f as F,n as 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-Ddiv4Djm.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:"6d83e21a9a681364e60ac72d91694794776923b2",class:"fk-tabs"},e("div",{key:"eeb1788ff839d99e24dae420c27c27b0d1450cc4",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:"8f3c9fc7f058181ee51a95be9f12c884e89fc9cd",class:"fk-tabs__body"},e("slot",{key:"6ab2524291fd6da41d845bc9374d7706ebc92871"})))}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-Cxo64gUs.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:"2cda1718715ed9e865a830d6c5e4de14fc821cee",class:"fk-tabs"},e("div",{key:"4eaf05f24626f1b340b4cb979304abfa4177a1f8",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:"2623c20e0299fcc07759d30d9147a184ffcb88e3",class:"fk-tabs__body"},e("slot",{key:"08fd24aca27d3840ae69d4cf1ac56888a2415da2"})))}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 +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-Ddiv4Djm.js";import{d as n}from"./p-DJxeNTfC.js";import{d as c}from"./p-DMLnAgzb.js";import{d as l}from"./p-DIW5FtAy.js";import{d as f}from"./p-Dt5tFknh.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)}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return s("div",{key:"8b21d16c70ad5b7744b15495064a429628748122",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: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:"65f6ec87f79a4bfd5b3eb8142636b4c863880c79",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],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
+ 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-Cxo64gUs.js";import{d as n}from"./p-BDpEUqN2.js";import{d as c}from"./p-CIgvEKbO.js";import{d as l}from"./p-Bvcoal_I.js";import{d as f}from"./p-B10DgHR6.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)}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return s("div",{key:"a1dc359954c394b6385538de0b9d42ec6eda2d58",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: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:"0e42a9e1b8e05f92677f8d25c107a26518b104bb",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],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{p as e,b as a}from"./p-BDqOS1za.js";export{s as setNonce}from"./p-BDqOS1za.js";import{g as l}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((async e=>(await l(),a([["p-730cac62",[[0,"fk-form-review",{spec:[16],data:[16],context:[16],locale:[1],reviews:[16],notes:[16],current:[32]},[[0,"brickReviewChange","handleBrickReviewChange"]],{reviews:[{syncReviews:0}]}]]],["p-7bc82da2",[[2,"fk-empty-form"]]],["p-f867357b",[[2,"fk-form-builder",{spec:[16],data:[16],context:[16],locales:[16],locale:[1],currentSpec:[32],currentData:[32],selectedUid:[32],copied:[32],importError:[32],editLocale:[32]},[[0,"brickDrop","handleBrickDrop"],[0,"brickRemove","handleBrickRemove"],[0,"brickDuplicate","handleBrickDuplicate"],[0,"brickConfigsChange","handleConfigsChange"],[0,"brickStylesChange","handleStylesChange"],[0,"brickValidationsChange","handleValidationsChange"],[0,"brickRulesChange","handleRulesChange"],[0,"formDataChange","handleDataChange"],[4,"paste","handlePaste"],[0,"brickSelect","handleBrickSelect"]],{spec:[{syncSpec:0}]}],[2,"fk-property-panel",{brick:[16],path:[1],fields:[16],locales:[16],locale:[1],editLocale:[1,"edit-locale"],activeTab:[32],newStyleKey:[32]},null,{brick:[{onBrickChange:0}]}],[2,"fk-brick-list",{locale:[1],query:[32],collapsed:[32]}],[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}]}],[2,"fk-rules-editor",{brick:[16],path:[1],fields:[16],forcedModes:[32],jsonErrors:[32],codeErrors:[32]}],[2,"fk-brick-mold-item",{brickMold:[16],isDragging:[32]}],[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],touched:[32],validateRows:[64]},[[0,"brickReviewChange","handleRowReviewChange"],[0,"brickDataChange","handleRowChange"]]],[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]},null,{value:[{onValueChange:0}]}],[2,"fk-file-input",{value:[16],disabled:[4],accept:[1],uploadUrl:[1,"upload-url"],multiple:[4],uploading:[32],removingUrl:[32],uploadError:[32]}],[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]},null,{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}],[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]},null,{configs:[{onConfigsChange:0}],dataMap:[{onDataMapChange:0}]}],[2,"fk-signature-input",{value:[1],disabled:[4]},null,{value:[{onValueChange:0}]}],[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]},null,{slotsUrl:[{reload:0}],rules:[{reload:0}],value:[{onValueChange:0}]}],[262,"fk-stepper",{stepLabels:[16],editable:[4],readOnly:[4,"read-only"],spec:[16],dataMap:[16],locale:[1],active:[32]},null,{stepLabels:[{clampActive:0}]}],[262,"fk-tabs",{tabLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},null,{tabLabels:[{clampActive:0}]}],[2,"fk-variable-picker",{variables:[16],open:[32],query:[32],index:[32]}],[0,"fk-brick-render",{brickSpec:[16],rootSpec:[16],data:[16],dataMap:[16],path:[1],editable:[4],readOnly:[4,"read-only"],disabled:[4],selectedPath:[1,"selected-path"],errors:[16],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],locale:[1],utils:[16]}],[262,"fk-brick-actions",{path:[1],selected:[4],isDragging:[32],isDropTarget:[32]}],[262,"fk-brick-not-found"],[2,"fk-code-editor",{value:[1],placeholder:[1],completions:[16]},null,{value:[{syncValue:0}]}],[2,"fk-drop-area",{path:[1],empty:[4],isOver:[32]}]]]],e))));
1
+ import{p as e,b as a}from"./p-BDqOS1za.js";export{s as setNonce}from"./p-BDqOS1za.js";import{g as l}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((async e=>(await l(),a([["p-974ac7cb",[[0,"fk-form-review",{spec:[16],data:[16],context:[16],locale:[1],reviews:[16],notes:[16],current:[32]},[[0,"brickReviewChange","handleBrickReviewChange"]],{reviews:[{syncReviews:0}]}]]],["p-4535f1d5",[[2,"fk-empty-form"]]],["p-1d604a4a",[[2,"fk-form-builder",{spec:[16],data:[16],context:[16],locales:[16],locale:[1],currentSpec:[32],currentData:[32],selectedUid:[32],copied:[32],importError:[32],editLocale:[32]},[[0,"brickDrop","handleBrickDrop"],[0,"brickRemove","handleBrickRemove"],[0,"brickDuplicate","handleBrickDuplicate"],[0,"brickConfigsChange","handleConfigsChange"],[0,"brickStylesChange","handleStylesChange"],[0,"brickValidationsChange","handleValidationsChange"],[0,"brickRulesChange","handleRulesChange"],[0,"formDataChange","handleDataChange"],[4,"paste","handlePaste"],[0,"brickSelect","handleBrickSelect"]],{spec:[{syncSpec:0}]}],[2,"fk-property-panel",{brick:[16],path:[1],fields:[16],locales:[16],locale:[1],editLocale:[1,"edit-locale"],activeTab:[32],newStyleKey:[32]},null,{brick:[{onBrickChange:0}]}],[2,"fk-brick-list",{locale:[1],query:[32],collapsed:[32]}],[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}]}],[2,"fk-rules-editor",{brick:[16],path:[1],fields:[16],forcedModes:[32],jsonErrors:[32],codeErrors:[32]}],[2,"fk-brick-mold-item",{brickMold:[16],isDragging:[32]}],[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],touched:[32],validateRows:[64]},[[0,"brickReviewChange","handleRowReviewChange"],[0,"brickDataChange","handleRowChange"]]],[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]},null,{value:[{onValueChange:0}]}],[2,"fk-document-reader",{value:[16],accept:[1],capture:[4],readUrl:[1,"read-url"],uploadUrl:[1,"upload-url"],keepFile:[4,"keep-file"],fields:[16],language:[1],context:[16],disabled:[4],readOnly:[4,"read-only"],reading:[32],error:[32],showText:[32]}],[2,"fk-file-input",{value:[16],disabled:[4],accept:[1],uploadUrl:[1,"upload-url"],multiple:[4],uploading:[32],removingUrl:[32],uploadError:[32]}],[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]},null,{value:[{onValueChange:0}],disabled:[{onLockChange:0}],readOnly:[{onLockChange:0}],selected:[{onSelectedChange:0}],layerUrl:[{onLayerUrlChange:0}]}],[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]},null,{configs:[{onConfigsChange:0}],dataMap:[{onDataMapChange:0}]}],[2,"fk-signature-input",{value:[1],disabled:[4]},null,{value:[{onValueChange:0}]}],[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]},null,{slotsUrl:[{reload:0}],rules:[{reload:0}],value:[{onValueChange:0}]}],[262,"fk-stepper",{stepLabels:[16],editable:[4],readOnly:[4,"read-only"],spec:[16],dataMap:[16],locale:[1],active:[32]},null,{stepLabels:[{clampActive:0}]}],[262,"fk-tabs",{tabLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},null,{tabLabels:[{clampActive:0}]}],[2,"fk-variable-picker",{variables:[16],open:[32],query:[32],index:[32]}],[0,"fk-brick-render",{brickSpec:[16],rootSpec:[16],data:[16],dataMap:[16],path:[1],editable:[4],readOnly:[4,"read-only"],disabled:[4],selectedPath:[1,"selected-path"],errors:[16],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],locale:[1],utils:[16]}],[262,"fk-brick-actions",{path:[1],selected:[4],isDragging:[32],isDropTarget:[32]}],[262,"fk-brick-not-found"],[2,"fk-code-editor",{value:[1],placeholder:[1],completions:[16]},null,{value:[{syncValue:0}]}],[2,"fk-drop-area",{path:[1],empty:[4],isOver:[32]}]]]],e))));