@simai-studio/view 0.0.0-stage → 1.1.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.
- package/LICENSE.md +183 -0
- package/README.md +75 -2
- package/dist/package-receipt.json +972 -0
- package/dist/set.json +141 -0
- package/dist/smart/rule.js +278 -0
- package/dist/smart/rule.js.gz +0 -0
- package/dist/smart/view/aliases.json +129 -0
- package/dist/smart/view/aliases.json.gz +0 -0
- package/dist/smart/view/component.json +1628 -0
- package/dist/smart/view/component.json.gz +0 -0
- package/dist/smart/view/css/view.css +208 -0
- package/dist/smart/view/css/view.css.gz +0 -0
- package/dist/smart/view/css/view.min.css +2 -0
- package/dist/smart/view/css/view.min.css.gz +0 -0
- package/dist/smart/view/examples.json +668 -0
- package/dist/smart/view/examples.json.gz +0 -0
- package/dist/smart/view/js/view.js +3955 -0
- package/dist/smart/view/js/view.js.gz +0 -0
- package/dist/smart/view/js/view.min.js +1 -0
- package/dist/smart/view/js/view.min.js.gz +0 -0
- package/dist/smart/view/lang/en.json +61 -0
- package/dist/smart/view/lang/en.json.gz +0 -0
- package/dist/smart/view/lang/ru.json +61 -0
- package/dist/smart/view/lang/ru.json.gz +0 -0
- package/dist/smart/view/probe.json +165 -0
- package/dist/smart/view/probe.json.gz +0 -0
- package/dist/smart/view/smart.manifest.json +1577 -0
- package/dist/smart/view/smart.manifest.json.gz +0 -0
- package/dist/smart/view/static/default/embedded.html +96 -0
- package/dist/smart/view/static/default/embedded.html.gz +0 -0
- package/dist/smart/view/static/default/open-record.html +242 -0
- package/dist/smart/view/static/default/open-record.html.gz +0 -0
- package/dist/smart/view/static/default/reference.html +242 -0
- package/dist/smart/view/static/default/reference.html.gz +0 -0
- package/dist/smart/view/static/sheets.json +282 -0
- package/dist/smart/view/static/sheets.json.gz +0 -0
- package/dist/smart/view-properties/aliases.json +174 -0
- package/dist/smart/view-properties/aliases.json.gz +0 -0
- package/dist/smart/view-properties/component.json +1906 -0
- package/dist/smart/view-properties/component.json.gz +0 -0
- package/dist/smart/view-properties/css/view-properties.css +1158 -0
- package/dist/smart/view-properties/css/view-properties.css.gz +0 -0
- package/dist/smart/view-properties/css/view-properties.min.css +2 -0
- package/dist/smart/view-properties/css/view-properties.min.css.gz +0 -0
- package/dist/smart/view-properties/examples.json +841 -0
- package/dist/smart/view-properties/examples.json.gz +0 -0
- package/dist/smart/view-properties/js/view-properties.js +10551 -0
- package/dist/smart/view-properties/js/view-properties.js.gz +0 -0
- package/dist/smart/view-properties/js/view-properties.min.js +1392 -0
- package/dist/smart/view-properties/js/view-properties.min.js.gz +0 -0
- package/dist/smart/view-properties/lang/en.json +89 -0
- package/dist/smart/view-properties/lang/en.json.gz +0 -0
- package/dist/smart/view-properties/lang/ru.json +89 -0
- package/dist/smart/view-properties/lang/ru.json.gz +0 -0
- package/dist/smart/view-properties/probe.json +188 -0
- package/dist/smart/view-properties/probe.json.gz +0 -0
- package/dist/smart/view-properties/skeleton.html +13 -0
- package/dist/smart/view-properties/skeleton.html.gz +0 -0
- package/dist/smart/view-properties/smart.manifest.json +1593 -0
- package/dist/smart/view-properties/smart.manifest.json.gz +0 -0
- package/dist/smart/view-properties/static/default/full.html +2 -0
- package/dist/smart/view-properties/static/default/full.html.gz +0 -0
- package/dist/smart/view-properties/static/default/panel-closed.html +4 -0
- package/dist/smart/view-properties/static/default/panel-closed.html.gz +0 -0
- package/dist/smart/view-properties/static/default/panel.html +4 -0
- package/dist/smart/view-properties/static/default/panel.html.gz +0 -0
- package/dist/smart/view-properties/static/default/reference.html +2 -0
- package/dist/smart/view-properties/static/default/reference.html.gz +0 -0
- package/dist/smart/view-properties/static/sheets.json +426 -0
- package/dist/smart/view-properties/static/sheets.json.gz +0 -0
- package/dist/smart/view-properties/template/default.css +992 -0
- package/dist/smart/view-properties/template/default.css.gz +0 -0
- package/dist/smart/view-properties/template/default.js +1658 -0
- package/dist/smart/view-properties/template/default.js.gz +0 -0
- package/dist/smart/view-table/aliases.json +448 -0
- package/dist/smart/view-table/aliases.json.gz +0 -0
- package/dist/smart/view-table/component.json +2746 -0
- package/dist/smart/view-table/component.json.gz +0 -0
- package/dist/smart/view-table/css/view-table.css +3658 -0
- package/dist/smart/view-table/css/view-table.css.gz +0 -0
- package/dist/smart/view-table/css/view-table.min.css +2 -0
- package/dist/smart/view-table/css/view-table.min.css.gz +0 -0
- package/dist/smart/view-table/examples.json +499 -0
- package/dist/smart/view-table/examples.json.gz +0 -0
- package/dist/smart/view-table/js/view-table.js +14166 -0
- package/dist/smart/view-table/js/view-table.js.gz +0 -0
- package/dist/smart/view-table/js/view-table.min.js +1440 -0
- package/dist/smart/view-table/js/view-table.min.js.gz +0 -0
- package/dist/smart/view-table/lang/en.json +132 -0
- package/dist/smart/view-table/lang/en.json.gz +0 -0
- package/dist/smart/view-table/lang/ru.json +132 -0
- package/dist/smart/view-table/lang/ru.json.gz +0 -0
- package/dist/smart/view-table/probe.json +275 -0
- package/dist/smart/view-table/probe.json.gz +0 -0
- package/dist/smart/view-table/smart.manifest.json +2531 -0
- package/dist/smart/view-table/smart.manifest.json.gz +0 -0
- package/dist/smart/view-table/static/default/current.html +141 -0
- package/dist/smart/view-table/static/default/current.html.gz +0 -0
- package/dist/smart/view-table/static/default/current.skeleton.html +141 -0
- package/dist/smart/view-table/static/default/current.skeleton.html.gz +0 -0
- package/dist/smart/view-table/static/default/empty.html +149 -0
- package/dist/smart/view-table/static/default/empty.html.gz +0 -0
- package/dist/smart/view-table/static/default/loading.html +180 -0
- package/dist/smart/view-table/static/default/loading.html.gz +0 -0
- package/dist/smart/view-table/static/default/many.html +180 -0
- package/dist/smart/view-table/static/default/many.html.gz +0 -0
- package/dist/smart/view-table/static/default/reference.html +136 -0
- package/dist/smart/view-table/static/default/reference.html.gz +0 -0
- package/dist/smart/view-table/static/default/reference.skeleton.html +136 -0
- package/dist/smart/view-table/static/default/reference.skeleton.html.gz +0 -0
- package/dist/smart/view-table/static/default/typed-cells.html +229 -0
- package/dist/smart/view-table/static/default/typed-cells.html.gz +0 -0
- package/dist/smart/view-table/static/default/typed-cells.skeleton.html +229 -0
- package/dist/smart/view-table/static/default/typed-cells.skeleton.html.gz +0 -0
- package/dist/smart/view-table/static/sheets.json +480 -0
- package/dist/smart/view-table/static/sheets.json.gz +0 -0
- package/dist/smart/view-table/studio.fixture.json +17 -0
- package/dist/smart/view-table/studio.fixture.json.gz +0 -0
- package/dist/smart/view-table/studio.scenario.json +30 -0
- package/dist/smart/view-table/studio.scenario.json.gz +0 -0
- package/dist/smart/view-table/template/default.css +1301 -0
- package/dist/smart/view-table/template/default.css.gz +0 -0
- package/dist/smart/view-table/template/default.js +1215 -0
- package/dist/smart/view-table/template/default.js.gz +0 -0
- package/dist/smart/view-table/template/link-cell-contract.js +48 -0
- package/dist/smart/view-table/template/link-cell-contract.js.gz +0 -0
- package/package.json +29 -4
|
@@ -0,0 +1,1440 @@
|
|
|
1
|
+
(()=>{"use strict";var e={e577837dd70a(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{Yq:()=>l});var i=n("15b4e93ff6ed"),r=e([i]),a=r.then?(await r)():r;i=a[0];function o(e){return"short"===e||"medium"===e||"long"===e||"full"===e}function l(e,{date:t="medium",time:n=null,intl:s=null,gap:r="",...a}={}){const l=(0,i.ay)(e);if(!l)return r;let c=s;return c||(c={},o(t)&&(c.dateStyle=t),o(n)&&(c.timeStyle=n),c.dateStyle||c.timeStyle||(c.dateStyle="medium")),(0,i.Qz)("DateTimeFormat",(0,i.OE)(a),c).format(l)}s()}catch(c){s(c)}})},"15b4e93ff6ed"(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{OE:()=>o,Qz:()=>u,ay:()=>l});var i=n("43090d1c8307"),r=e([i]),a=r.then?(await r)():r;i=a[0];function o({locale:e,node:t}={}){return String(e||"").trim()||(0,i.pageLocale)(t)}function l(e){if(null==e||""===e)return null;const t=e instanceof Date?new Date(e.getTime()):new Date("string"==typeof e&&/^\d+$/u.test(e)?Number(e):e);return Number.isNaN(t.getTime())?null:t}function c(){const e="undefined"!=typeof globalThis?globalThis:{};return e.__sfFormat||(e.__sfFormat={formatters:new Map}),e.__sfFormat.formatters}function u(e,t,n){const s=`${e}|${t}|${JSON.stringify(n)}`,i=c();if(i.has(s))return i.get(s);const r=Intl[e];let a;try{a=new r(t||void 0,n)}catch{try{a=new r(void 0,n)}catch{a=new r(t||void 0,"NumberFormat"===e?{maximumFractionDigits:2}:{})}}return i.size>=256&&i.delete(i.keys().next().value),i.set(s,a),a}s()}catch(d){s(d)}})},"51250bf01ab0"(e,t,n){const s="sf-pref:",i=/^[\w.*:-]+(?:\/[\w.*:/-]+)?$/u;function r(){try{return globalThis.localStorage??null}catch{return null}}function a(e){return"string"==typeof e&&e.length>0&&e.length<=200&&i.test(e)}function o(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function l(e){return null==e?null:JSON.parse(JSON.stringify(e))}"undefined"!=typeof globalThis&&(globalThis.SF=globalThis.SF||{},globalThis.SF.Preferences||(globalThis.SF.Preferences=function(){const e={adapter:null,values:new Map},t=new Map,n=new Map;let i=!1;const c=()=>{if(i)return;const e=globalThis.document?.querySelector?.('script[type="application/json"][data-sf-preferences], script#sf-preferences[type="application/json"]');if(e){i=!0;try{f.preload(JSON.parse(e.textContent||"{}"))}catch{}}},u=(e,n)=>{for(const s of t.get(e)??[])try{s(l(n),e)}catch(t){console.error("SF.Preferences listener failed",e,t)}},d=e=>{const t=r();if(!t)return null;try{const n=t.getItem(s+e);return null===n?null:JSON.parse(n)}catch{return null}},h=(e,t)=>{const n=r();if(n)try{null===t?n.removeItem(s+e):n.setItem(s+e,JSON.stringify(t))}catch{}},p=t=>{clearTimeout(n.get(t)),n.delete(t);const s=e.adapter;if(!s)return;const i=e.values.has(t)?e.values.get(t):d(t);try{const e=null===i?s.remove?.(t):s.save?.(t,l(i));Promise.resolve(e).catch(e=>console.warn("SF.Preferences: the host did not keep",t,e))}catch(e){console.warn("SF.Preferences: the host did not keep",t,e)}},m=t=>{e.adapter&&(clearTimeout(n.get(t)),n.set(t,setTimeout(()=>p(t),400)))},f={read:t=>a(t)?(c(),e.values.has(t)?l(e.values.get(t)):l(d(t))):null,readMerged(...e){const t={};let n=!1;for(const s of e.flat()){const e=f.read(s);e&&"object"==typeof e&&!Array.isArray(e)&&(Object.assign(t,e),n=!0)}return n?t:null},write(t,n){if(!a(t))return!1;const s=l(n);return JSON.stringify(f.read(t))===JSON.stringify(s)||(e.values.has(t)&&e.values.set(t,s),h(t,s),m(t)),!0},remove:t=>!!a(t)&&(e.values.has(t)&&e.values.set(t,null),h(t,null),m(t),u(t,null),!0),subscribe:(e,n)=>a(e)&&"function"==typeof n?(t.has(e)||t.set(e,new Set),t.get(e).add(n),()=>t.get(e)?.delete(n)):()=>{},preload(t){if(t&&"object"==typeof t)for(const[n,s]of Object.entries(t)){if(!a(n))continue;const t=l(s),i=f.read(n);e.values.set(n,t),h(n,t),o(i,t)||u(n,t)}},useHost(t){if(!t||"function"!=typeof t.save)throw new TypeError("A preferences host saves: {save(key, value)}");return e.adapter=t,f},async load(t){const n=[].concat(t).filter(t=>a(t)&&!e.values.has(t));if(n.length&&"function"==typeof e.adapter?.load)try{f.preload(await e.adapter.load(n))}catch(e){console.warn("SF.Preferences: the host did not answer",n,e)}},get hosted(){return Boolean(e.adapter)},flush(){for(const e of[...n.keys()])p(e)}};return globalThis.addEventListener?.("storage",t=>{if(!t.key?.startsWith(s)||t.storageArea!==r())return;const n=t.key.slice(8);if(e.values.has(n))return;let i=null;try{i=null===t.newValue?null:JSON.parse(t.newValue)}catch{i=null}u(n,i)}),globalThis.addEventListener?.("pagehide",()=>f.flush()),c(),Object.freeze(f)}()));const c=globalThis.SF?.Preferences,u=c;n.d(t,["A",0,u])},"9ce1a42b2a85"(e,t,n){n.d(t,{AC:()=>a,MC:()=>d,SB:()=>u,cy:()=>l,d2:()=>o});const s=/^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}):(\d{2})((?::\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/u,i=/^\d{4}-\d{2}-\d{2}$/u;function r(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"value"in e?e.value:e}function a(e){const t=r(e);if(null==t||""===t)return{raw:t??null,known:!0,date:"",time:"",rest:"",zone:""};const n="string"==typeof t?t.trim().match(s):null;return n?{raw:t,known:!0,date:n[1],time:n[2]?`${n[2]}:${n[3]}`:"",rest:n[4]||"",zone:n[5]||""}:{raw:t,known:!1,date:"",time:"",rest:"",zone:""}}function o(e){const t=String(e??"").trim().replace(/[_\s]/gu,"");if(""===t||":"===t)return"";const n=t.match(/^(\d{1,2})[:.]?(\d{2})$/u);if(!n)return null;const s=Number(n[1]),i=Number(n[2]);return s>23||i>59?null:`${String(s).padStart(2,"0")}:${n[2]}`}function l(e,t){const n=String(t?.date??"").trim(),s=o(t?.time);if(null===s)return{error:"timeInvalid"};if(!n&&!s)return{value:null};if(!i.test(n))return{error:n?"dateInvalid":"dateMissing"};if(!s)return{error:"timeMissing"};const r=e?.known?e:null;if(r&&r.date===n&&r.time===s)return{value:r.raw};return{value:`${n}T${s}${r&&r.time===s?r.rest:":00"}${r&&r.time?r.zone:""}`}}const c=/^(\d{2}):(\d{2})((?::\d{2})(?:\.\d+)?)?$/u;function u(e){const t=r(e);if(null==t||""===t)return{raw:t??null,known:!0,time:"",rest:""};const n="string"==typeof t?t.trim().match(c):null;return n&&null!==o(`${n[1]}:${n[2]}`)?{raw:t,known:!0,time:`${n[1]}:${n[2]}`,rest:n[3]||""}:{raw:t,known:!1,time:"",rest:""}}function d(e,t){const n=o(t);if(null===n)return{error:"timeInvalid"};if(!n)return{value:null};const s=e?.known?e:null;return s&&s.time===n?{value:s.raw}:{value:s?.rest?`${n}:00`:n}}},eb06ad68f8d3(e,t,n){n.d(t,{b:()=>I,j:()=>B});Object.freeze(["p","h2","h3","h4","strong","em","a","ul","ol","li","blockquote","br"]);const s=Object.freeze(["p","h2","h3","h4"]),i=Object.freeze(["https:","mailto:","tel:"]),r=Object.freeze(["html","paste"]),a=(Object.freeze(["pre","table"]),new Set(["script","style","template","head","title","meta","link","base","noscript","iframe","frame","frameset","noembed","noframes","object","embed","applet","svg","math","canvas","video","audio","img","picture","source","track","input","select","textarea","xmp","plaintext"])),o=new Set(["address","article","aside","body","caption","center","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h5","h6","header","hgroup","hr","html","legend","listing","main","menu","nav","optgroup","option","pre","section","summary","table","tbody","td","tfoot","th","thead","tr"]),l=new Set(["ul","ol"]),c=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),u=new Set(["script","style","textarea","title","xmp","iframe","noembed","noframes","noscript"]),d=new Set(["td","th","table","caption","button"]),h=/[\u0000-\u001f\u007f-\u009f]/gu,p=/[\u0000- \u007f-\u009f\u00a0\u1680\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]/gu;const m={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",shy:"",hellip:"…",mdash:"—",ndash:"–",minus:"−",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",bull:"•",middot:"·",copy:"©",reg:"®",trade:"™",deg:"°",times:"×",divide:"÷",plusmn:"±",euro:"€",pound:"£",yen:"¥",cent:"¢",sect:"§",para:"¶",thinsp:" ",ensp:" ",emsp:" ",zwj:"",zwnj:"",larr:"←",rarr:"→",uarr:"↑",darr:"↓",numero:"№",prime:"′",Prime:"″"};function f(e){return String(e).replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]*);?/giu,(e,t)=>{if("#"===t[0]){const e="x"===t[1]||"X"===t[1]?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return!Number.isFinite(e)||e<=0||e>1114111||e>=55296&&e<=57343?"�":String.fromCodePoint(e)}return Object.hasOwn(m,t)&&e.endsWith(";")?m[t]:e})}function g(e){const t="string"==typeof e?e:"",n={type:"element",name:"#root",attrs:{},children:[]},i=[n],r=()=>i[i.length-1],a=e=>r().children.push(e),h=e=>{if(!e)return;const t=r().children.at(-1);"text"===t?.type?t.value+=e:a({type:"text",value:e})},p=(e,t=null)=>{for(let n=i.length-1;n>0;n-=1){const s=i[n].name;if(t&&t.has(s))return!1;if(s===e)return i.length=n,!0}return!1};let m=0;const g=t.length;for(;m<g;){const e=t.indexOf("<",m);if(e<0){h(f(t.slice(m)));break}if(e>m&&h(f(t.slice(m,e))),m=e,t.startsWith("\x3c!--",m)){const e=t.indexOf("--\x3e",m+4);m=e<0?g:e+3;continue}const n=t[m+1]??"";if("!"===n||"?"===n){const e=t.indexOf(">",m+2);m=e<0?g:e+1;continue}if("/"===n){const e=/^<\/([a-z][a-z0-9-]*)[^>]*>?/iu.exec(t.slice(m));if(!e){const e=t.indexOf(">",m+2);m=e<0?g:e+1;continue}m+=e[0].length;const n=e[1].toLowerCase();"br"===n?a({type:"element",name:"br",attrs:{},children:[]}):"p"!==n||p("p",d)?p(n):a({type:"element",name:"p",attrs:{},children:[]});continue}const r=/^<([a-z][a-z0-9-]*)/iu.exec(t.slice(m));if(!r){h("<"),m+=1;continue}m+=r[0].length;const b=r[1].toLowerCase(),y={};let v=!1;for(;m<g;){const e=/^[\s/]+/u.exec(t.slice(m));if(e){e[0].includes("/")&&">"===t[m+e[0].length]&&(v=!0),m+=e[0].length;continue}if(">"===t[m]){m+=1;break}const n=/^([^\s/>"'=][^\s/>"'=]*)(?:\s*=\s*(?:"([^"]*)"?|'([^']*)'?|([^\s>]*)))?/u.exec(t.slice(m));if(!n){m+=1;continue}m+=n[0].length;const s=n[1].toLowerCase();Object.hasOwn(y,s)||(y[s]=f(n[2]??n[3]??n[4]??""))}const w={type:"element",name:b,attrs:y,children:[]};if("li"===b&&p("li",l),(s.includes(b)||l.has(b)||"blockquote"===b||o.has(b))&&p("p",d),a(w),"plaintext"===b){m=g;break}if(u.has(b)){const e=new RegExp(`</${b}[\\s/>]`,"iu").exec(t.slice(m)),n=e?m+e.index:g;"textarea"===b||"title"===b?w.children.push({type:"text",value:f(t.slice(m,n))}):w.children.push({type:"text",value:t.slice(m,n)});const s=e?t.indexOf(">",n):-1;m=s<0?g:s+1;continue}c.has(b)||v||i.push(w)}return n}function b(e){const t=e=>{if(3===e.nodeType)return{type:"text",value:e.data};if(11===e.nodeType)return{type:"element",name:"#root",attrs:{},children:[...e.childNodes].map(t).filter(Boolean)};if(1!==e.nodeType)return null;if(e.namespaceURI&&"http://www.w3.org/1999/xhtml"!==e.namespaceURI)return null;const n=e.localName;if(a.has(n))return null;const s={},i=e.getAttribute("href");null!==i&&(s.href=i);const r=e.getAttribute("style");null!==r&&(s.style=r);return{type:"element",name:n,attrs:s,children:"template"===n?[]:[...e.childNodes].map(t).filter(Boolean)}},n=t(e);return n&&"element"===n.type?{...n,name:"#root"}:{type:"element",name:"#root",attrs:{},children:n?[n]:[]}}function y(e,t){const n={...t};"strong"!==e.name&&"b"!==e.name||(n.strong=!0),"em"!==e.name&&"i"!==e.name||(n.em=!0);const s=function(e){const t={};if(!e)return t;const n=/(?:^|;)\s*font-weight\s*:\s*([^;!]+)/iu.exec(e)?.[1]?.trim().toLowerCase();n&&("bold"===n||"bolder"===n||Number(n)>=600?t.strong=!0:("normal"===n||"lighter"===n||Number(n)<600)&&(t.strong=!1));const s=/(?:^|;)\s*font-style\s*:\s*([^;!]+)/iu.exec(e)?.[1]?.trim().toLowerCase();return s&&("italic"===s||s.startsWith("oblique")?t.em=!0:"normal"===s&&(t.em=!1)),t}(e.attrs?.style);return void 0!==s.strong&&(n.strong=s.strong),void 0!==s.em&&(n.em=s.em),n}const v=(e,t,n)=>({kind:e,value:t,strong:Boolean(n.marks.strong),em:Boolean(n.marks.em),href:n.href||null});class w{constructor(e){this.kind=e,this.blocks=[],this.run=[],this.types=["p"],this.starts=[0],this.needBreak=!1}inline(e){"item"===this.kind&&this.needBreak&&this.run.length>0&&("text"!==e.kind||e.value.trim())&&(this.run.push({kind:"br",strong:!1,em:!1,href:null}),this.needBreak=!1),this.run.push(e)}flush(){this.run.length&&("item"===this.kind?this.blocks.push({type:"inline",leaves:this.run}):this.blocks.push({type:this.types[this.types.length-1],leaves:this.run}),this.run=[])}open(e){"item"!==this.kind?(this.flush(),this.types.push(e),this.starts.push(this.blocks.length)):this.needBreak=!0}close(e=!1){if("item"===this.kind)return void(this.needBreak=!0);const t=this.starts[this.starts.length-1];e&&!this.run.length&&this.blocks.length===t&&this.blocks.push({type:this.types[this.types.length-1],leaves:[]}),this.flush(),this.types.length>1&&(this.types.pop(),this.starts.pop())}block(e){this.flush(),this.blocks.push(e),this.needBreak=!1}}function x(e,t,n){for(const s of e)$(s,t,n)}function $(e,t,n){if("text"===e.type)return void function(e,t,n){if(n.pre)return void e.replace(/\r\n?/gu,"\n").split("\n").forEach((e,s)=>{s>0&&t.inline(v("br","",n)),e&&t.inline(v("text",e.replace(/[\t\f]/gu," "),n))});const s=e.replace(/[\t\n\r\f ]+/gu," ");s&&(" "!==s||t.run.length)&&t.inline(v("text",s,n))}(e.value,t,n);const r=e.name;if(a.has(r))return;if("br"===r)return void t.inline(v("br","",n));const c={...n,marks:y(e,n.marks)};if("a"===r){const s=function(e){if("string"!=typeof e)return null;const t=e.trim();if(!t||t.length>2048)return null;const n=t.replace(p,"");if(!n)return null;if(n.startsWith("/")){if(/^\/[/\\]/u.test(n))return null;const e=t.replace(h,"");return/^\/[/\\]/u.test(e)?null:e}const s=/^([a-z][a-z0-9+.-]*):/iu.exec(n)?.[1]?.toLowerCase();if(!s||!i.includes(`${s}:`))return null;let r;try{r=new globalThis.URL(t.replace(h,""))}catch{return null}return r.protocol!==`${s}:`?null:"https:"!==r.protocol||r.hostname?"https:"!==r.protocol&&r.href.length<=r.protocol.length?null:r.href:null}(e.attrs?.href);return void x(e.children,t,s&&!n.href?{...c,href:s}:c)}if(s.includes(r))return t.open(r),x(e.children,t,c),void t.close(!0);if(l.has(r)){const n=T(e,c,r);return void(n.items.length&&t.block(n))}if("blockquote"===r){if("item"===t.kind)return t.open("p"),x(e.children,t,c),void t.close();const n=new w("flow");return x(e.children,n,c),n.flush(),void t.block({type:"blockquote",blocks:n.blocks})}if("li"===r)return t.open("p"),x(e.children,t,c),void t.close();if(!n.paste||"item"===t.kind||"pre"!==r&&"listing"!==r){if(!n.paste||"item"===t.kind||"table"!==r)return o.has(r)?(t.open("p"),x(e.children,t,"pre"===r||"listing"===r?{...c,pre:!0}:c),void t.close()):void x(e.children,t,c);t.block(function(e,t){const n={type:"table",caption:[],rows:[]},s=(e,s)=>{const i=[];for(const n of e.children){if("element"!==n.type||"td"!==n.name&&"th"!==n.name)continue;const e=new w("item");x(n.children,e,{...t,marks:y(n,t.marks)}),e.flush(),i.push({header:"th"===n.name,leaves:k(e.blocks)})}i.length&&n.rows.push({head:s,cells:i})},i=(e,t)=>{for(const n of e.children)"element"===n.type&&"tr"===n.name&&s(n,t)};for(const r of e.children)if("element"===r.type)if("caption"===r.name){const e=new w("item");x(r.children,e,t),e.flush(),n.caption=k(e.blocks)}else"thead"===r.name?i(r,!0):"tbody"===r.name||"tfoot"===r.name?i(r,!1):"tr"===r.name&&s(r,!1);return n}(e,c))}else t.block({type:"pre",text:S(e)})}function S(e){const t=e=>"text"===e.type?e.value:a.has(e.name)?"":"br"===e.name?"\n":e.children.map(t).join("");return e.children.map(t).join("").replace(/\r\n?/gu,"\n").replace(/\u00a0/gu," ").replace(/^\n/u,"").replace(/\s+$/u,"")}function k(e){const t=[],n=e=>{if("inline"===e.type)(s=e.leaves).length&&(t.length&&t.push({kind:"br",strong:!1,em:!1,href:null}),t.push(...s));else for(const t of e.items)t.children.forEach(n);var s};return e.forEach(n),t}function C(e,t){const n=new w("item");return x(e.children,n,t),n.flush(),{children:n.blocks}}function T(e,t,n){const s={type:n,items:[]};let i=null;const r=()=>{i&&(i.flush(),s.items.push({children:i.blocks}),i=null)};for(const n of e.children)if("element"!==n.type||"li"!==n.name){if("element"===n.type&&l.has(n.name)){r();const e=T(n,{...t,marks:y(n,t.marks)},n.name);if(!e.items.length)continue;const i=s.items.at(-1);i?i.children.push(e):s.items.push({children:[e]});continue}("text"!==n.type||n.value.trim())&&("element"===n.type&&a.has(n.name)||(i??=new w("item"),$(n,i,t)))}else r(),s.items.push(C(n,t));return r(),s}const _=" ",A=(e,t)=>e.strong===t.strong&&e.em===t.em&&e.href===t.href;function F(e,t){const n=[];for(const t of e){if("text"===t.kind&&!t.value)continue;const e=n.at(-1);"text"===t.kind&&"text"===e?.kind&&A(e,t)?e.value+=t.value:n.push({...t})}for(let e=0;e<n.length;e+=1){const t=n[e];if("text"!==t.kind)continue;t.value=t.value.replace(/ {2,}/gu,_);const s=n[e-1];t.value.startsWith(_)&&(!s||"br"===s.kind||"text"===s.kind&&s.value.endsWith(_))&&(t.value=t.value.slice(1));const i=n[e+1];!t.value.endsWith(_)||i&&"br"!==i.kind||(t.value=t.value.slice(0,-1))}let s=n.filter(e=>"br"===e.kind||e.value);if("value"===t){for(;"br"===s[0]?.kind;)s.shift();for(;"br"===s.at(-1)?.kind;)s.pop();"text"===s[0]?.kind&&(s[0].value=s[0].value.replace(/^[\s\u00a0]+/u,""));const e=s.at(-1);"text"===e?.kind&&(e.value=e.value.replace(/[\s\u00a0]+$/u,"")),s=s.filter(e=>"br"===e.kind||e.value)}const i=new Map;for(const e of s)e.href&&i.set(e.href,(i.get(e.href)||"")+("text"===e.kind?e.value:"x"));for(const e of s)e.href&&!i.get(e.href).trim()&&(e.href=null);const r=[];for(const e of s){const t=r.at(-1);"text"===e.kind&&"text"===t?.kind&&A(t,e)?t.value+=e.value:r.push(e)}return r}const z=e=>e.some(e=>"text"===e.kind&&""!==e.value.replace(/[\s\u00a0]+/gu,""));function R(e,t){const n=e.items.map(e=>function(e,t){const n=[];for(const s of e.children)if("inline"===s.type){const e=F(s.leaves,t);if(!e.length)continue;const i=n.at(-1);"inline"===i?.type?i.leaves=F([...i.leaves,{kind:"br",strong:!1,em:!1,href:null},...e],t):n.push({type:"inline",leaves:e})}else{const e=R(s,t);if(!e)continue;const i=n.at(-1);i&&i.type===e.type?i.items.push(...e.items):n.push(e)}if("value"===t){const e=n.filter(e=>"inline"!==e.type||z(e.leaves));return e.length?{children:e}:null}return n.length&&"inline"===n[0].type||n.unshift({type:"inline",leaves:[{kind:"br",strong:!1,em:!1,href:null}]}),{children:n}}(e,t)).filter(Boolean);return n.length?{type:e.type,items:n}:null}function E(e,t){const n=[];for(const s of e){let e=null;if("blockquote"===s.type){const n=E(s.blocks,t);n.length?e={type:"blockquote",blocks:n}:"editor"===t&&(e={type:"blockquote",blocks:[{type:"p",leaves:[{kind:"br",strong:!1,em:!1,href:null}]}]})}else if(l.has(s.type))e=R(s,t);else if("pre"===s.type)s.text.trim()&&(e={type:"pre",text:s.text});else if("table"===s.type){const t=s.rows.map(e=>({head:e.head,cells:e.cells.map(e=>({header:e.header,leaves:F(e.leaves,"value")}))})).filter(e=>e.cells.some(e=>z(e.leaves)));t.length&&(e={type:"table",caption:F(s.caption,"value"),rows:t})}else{const n=F(s.leaves,t);"value"===t?z(n)&&(e={type:s.type,leaves:n}):e={type:s.type,leaves:n.length?n:[{kind:"br",strong:!1,em:!1,href:null}]}}if(!e)continue;const i=n.at(-1);i&&l.has(e.type)&&i.type===e.type?i.items.push(...e.items):n.push(e)}return n}function O(e,{mode:t="value",profile:n="html"}={}){if(!r.includes(n))throw new TypeError(`rich_text_profile_unknown: ${n}`);const s=new w("flow");x(e.children??[],s,{marks:{},href:null,pre:!1,paste:"paste"===n}),s.flush();const i=E(s.blocks,t);return"editor"!==t||i.length?i:[{type:"p",leaves:[{kind:"br",strong:!1,em:!1,href:null}]}]}const P=e=>e.replace(/&/gu,"&").replace(/"/gu,""").replace(/</gu,"<").replace(/>/gu,">").replace(/\u00a0/gu," ");function M(e){const t=(e,n)=>{let s="",i=0;const r=["href","strong","em"][n];for(;i<e.length;){const a=r?e[i][r]:null;let o=i+1;for(;o<e.length&&r&&e[o][r]===a;)o+=1;const l=e.slice(i,o);s+=r?"href"===r&&a?`<a href="${P(a)}">${t(l,n+1)}</a>`:"href"!==r&&a?`<${r}>${t(l,n+1)}</${r}>`:t(l,n+1):l.map(e=>"br"===e.kind?"<br>":e.value.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/\u00a0/gu," ")).join(""),i=o}return s};return t(e,0)}function L(e){return`<${e.type}>${e.items.map(e=>`<li>${e.children.map(e=>"inline"===e.type?M(e.leaves):L(e)).join("")}</li>`).join("")}</${e.type}>`}function q(e){return e.map(e=>{if("blockquote"===e.type)return`<blockquote>${q(e.blocks)}</blockquote>`;if(l.has(e.type))return L(e);if("pre"===e.type){return`<p>${M(F(e.text.split("\n").flatMap((e,t)=>[...t?[{kind:"br",strong:!1,em:!1,href:null}]:[],{kind:"text",value:e.replace(/[\t\f]/gu," "),strong:!1,em:!1,href:null}]),"value"))}</p>`}if("table"===e.type){return[{leaves:e.caption},...e.rows.flatMap(e=>e.cells)].filter(e=>z(e.leaves)).map(e=>`<p>${M(e.leaves)}</p>`).join("")}return`<${e.type}>${M(e.leaves)}</${e.type}>`}).join("")}const j=e=>{const t=e&&"object"==typeof e&&!Array.isArray(e)&&"value"in e?e.value:e;return"string"==typeof t?t:""};function I(e){const t=j(e);return t?function(e,{mode:t="value",document:n}={}){let s;if(e&&"object"==typeof e&&"number"==typeof e.nodeType)s=b(e);else{const t="string"==typeof e?e:"",i=void 0===n?globalThis.document:n;if(t&&i?.createElement){const e=i.createElement("template");e.innerHTML=t,s=b(e.content)}else s=g(t)}return q(O(s,{mode:t}))}(t,{mode:"value"}):""}function B(e){const t=j(e);return t?function(e){const t=O(g(e),{mode:"value"}),n=e=>e.map(e=>"br"===e.kind?"\n":e.value).join(""),s=e=>e.items.map(e=>e.children.map(e=>"inline"===e.type?n(e.leaves):s(e)).join("\n")).join("\n"),i=e=>e.map(e=>"blockquote"===e.type?i(e.blocks):l.has(e.type)?s(e):n(e.leaves)).join("\n\n");return i(t)}(t).replace(/\s+/gu," ").trim():""}},e5483002f3ea(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{dV:()=>U,fT:()=>S});var i=n("2a080a730149"),r=n("073f05ff1a81"),a=n("5961360f41f4"),o=n("43090d1c8307"),l=n("fc654eb7fab0"),c=n("9ce1a42b2a85"),u=n("dd6973f77245"),d=n("eb06ad68f8d3"),h=e([i,r,o]);[i,r,o]=h.then?(await h)():h;function p(e){return String(e?.size||"").trim()||"1"}function m(e,t){const n=t.getFilterControlValue(e.key);return i.html`
|
|
2
|
+
<sf-input
|
|
3
|
+
size=${p(t)}
|
|
4
|
+
appearance="filled"
|
|
5
|
+
placeholder="${Me(t,"containsText")}"
|
|
6
|
+
value="${n.value||""}"
|
|
7
|
+
name="sf_filter_${e.key||"text"}"
|
|
8
|
+
@change=${s=>{t.patchTempFilterValue(e.key,{value:s.target?.value||"",operator:n.operator||e.filter?.defaultOperator||"contains"})}}
|
|
9
|
+
></sf-input>
|
|
10
|
+
`}function f(e,t){const n=t.getFilterControlValue(e.key),s=e.filter?.operators||["eq"],r=n.operator||e.filter?.defaultOperator||s[0],a="between"===r,o=a?n.value:Array.isArray(n.value)?n.value[0]:n.value;return i.html`
|
|
11
|
+
<div class="flex gap-1/3 flex-col">
|
|
12
|
+
<div class="sf-filter-operator-range flex gap-1/3 items-cross-center">
|
|
13
|
+
<sf-slider-range
|
|
14
|
+
id="smart-range-slider-single"
|
|
15
|
+
min="0"
|
|
16
|
+
label="tooltip"
|
|
17
|
+
suffix="%"
|
|
18
|
+
max="100"
|
|
19
|
+
multiple=${String(a)}
|
|
20
|
+
.value=${o}
|
|
21
|
+
@onSliderEnd=${n=>{t.patchTempFilterValue(e.key,{value:a?n.detail.values||[]:n.detail.value,operator:r})}}
|
|
22
|
+
></sf-slider-range>
|
|
23
|
+
</div>
|
|
24
|
+
<sf-dropdown
|
|
25
|
+
size=${p(t)}
|
|
26
|
+
appearance="outlined"
|
|
27
|
+
mode="select"
|
|
28
|
+
placeholder="${Me(t,"operator")}"
|
|
29
|
+
root-class="flex-1"
|
|
30
|
+
search="false"
|
|
31
|
+
@change=${n=>{const s=n.detail?.values?.[0]||n.detail?.value||r;t.patchTempFilterValue(e.key,{operator:s})}}
|
|
32
|
+
>
|
|
33
|
+
${s.map(e=>i.html`
|
|
34
|
+
<sf-list-item
|
|
35
|
+
kind="text"
|
|
36
|
+
size=${p(t)}
|
|
37
|
+
text="${t.getFilterOperatorLabel(e)}"
|
|
38
|
+
value="${e}"
|
|
39
|
+
?selected=${e===r}
|
|
40
|
+
></sf-list-item>
|
|
41
|
+
`)}
|
|
42
|
+
</sf-dropdown>
|
|
43
|
+
</div>
|
|
44
|
+
`}function g(e,t){const n=t.getFilterControlValue(e.key),s=e.filter?.operators||["eq"],r=n.operator||e.filter?.defaultOperator||s[0],a="between"===r,o=n.value,l=Array.isArray(o)?o:[o||"",""],c=(n,s)=>{if(!a)return void t.patchTempFilterValue(e.key,{value:s||"",operator:r});const i=[...l];i[n]=s||"",t.patchTempFilterValue(e.key,{value:i,operator:r})};return i.html`
|
|
45
|
+
<div class="flex gap-1/3 flex-col">
|
|
46
|
+
<div class="sf-filter-operator-inputs flex gap-1/3 items-cross-center">
|
|
47
|
+
<sf-input
|
|
48
|
+
size=${p(t)}
|
|
49
|
+
appearance="bordered"
|
|
50
|
+
root-class="flex-1 min-w-0"
|
|
51
|
+
label="${a?Me(t,"rangeFrom"):t.getFilterOperatorLabel(r)}"
|
|
52
|
+
value="${a?l[0]||"":o||""}"
|
|
53
|
+
name="sf_filter_${e.key||"number"}"
|
|
54
|
+
@change=${e=>{c(0,e.target?.value)}}
|
|
55
|
+
></sf-input>
|
|
56
|
+
${a?i.html`
|
|
57
|
+
<sf-input
|
|
58
|
+
size=${p(t)}
|
|
59
|
+
appearance="bordered"
|
|
60
|
+
label="${Me(t,"rangeTo")}"
|
|
61
|
+
root-class="flex-1 min-w-0"
|
|
62
|
+
value="${l[1]||""}"
|
|
63
|
+
name="sf_filter_${e.key||"number"}_second"
|
|
64
|
+
@change=${e=>{c(1,e.target?.value)}}
|
|
65
|
+
></sf-input>`:i.nothing}
|
|
66
|
+
</div>
|
|
67
|
+
<sf-dropdown
|
|
68
|
+
size=${p(t)}
|
|
69
|
+
appearance="outlined"
|
|
70
|
+
mode="select"
|
|
71
|
+
placeholder="${Me(t,"operator")}"
|
|
72
|
+
root-class="flex-1"
|
|
73
|
+
search="false"
|
|
74
|
+
@change=${n=>{const s=n.detail?.values?.[0]||n.detail?.value||r;t.patchTempFilterValue(e.key,{operator:s})}}
|
|
75
|
+
>
|
|
76
|
+
${s.map(e=>i.html`
|
|
77
|
+
<sf-list-item
|
|
78
|
+
kind="text"
|
|
79
|
+
size=${p(t)}
|
|
80
|
+
text="${t.getFilterOperatorLabel(e)}"
|
|
81
|
+
value="${e}"
|
|
82
|
+
?selected=${e===r}
|
|
83
|
+
></sf-list-item>
|
|
84
|
+
`)}
|
|
85
|
+
</sf-dropdown>
|
|
86
|
+
</div>
|
|
87
|
+
`}function b(e,t){const n=t.getFilterControlValue(e.key),s=e.filter?.operators||["eq"],r=n.operator||e.filter?.defaultOperator||s[0],a="between"===r,o=a&&Array.isArray(n.value)?n.value:a?["",""]:n.value||"";return i.html`
|
|
88
|
+
<div class="flex flex-col gap-1/3">
|
|
89
|
+
<sf-input-date
|
|
90
|
+
.value=${o}
|
|
91
|
+
?range=${a}
|
|
92
|
+
name="sf_filter_${e.key||"date"}"
|
|
93
|
+
locale="ru-Ru"
|
|
94
|
+
@change=${n=>{t.patchTempFilterValue(e.key,{value:n.detail.value,operator:r})}}
|
|
95
|
+
></sf-input-date>
|
|
96
|
+
<sf-dropdown
|
|
97
|
+
size=${p(t)}
|
|
98
|
+
appearance="outlined"
|
|
99
|
+
mode="select"
|
|
100
|
+
placeholder="${Me(t,"operator")}"
|
|
101
|
+
root-class="flex-1"
|
|
102
|
+
search="false"
|
|
103
|
+
@change=${n=>{const s=n.detail?.values?.[0]||n.detail?.value||r;t.patchTempFilterValue(e.key,{operator:s})}}
|
|
104
|
+
>
|
|
105
|
+
${s.map(e=>i.html`
|
|
106
|
+
<sf-list-item
|
|
107
|
+
kind="text"
|
|
108
|
+
size=${p(t)}
|
|
109
|
+
text="${t.getFilterOperatorLabel(e)}"
|
|
110
|
+
value="${e}"
|
|
111
|
+
?selected=${e===r}
|
|
112
|
+
></sf-list-item>
|
|
113
|
+
`)}
|
|
114
|
+
</sf-dropdown>
|
|
115
|
+
</div>
|
|
116
|
+
`}function y(e,t){const n=t.getEndpointFilterPage(e),s=t.getVisibleFilterOptions(e),r=t.getFilterControlValue(e.key),a=t.getFilterOptionSearch(e.key),o=new Set(r.values||[]);return i.html`
|
|
117
|
+
<div class="flex flex-col gap-1/2 overflow-x-hidden">
|
|
118
|
+
${!e.filter?.searchable||n&&!n.searchable?"":i.html`
|
|
119
|
+
<sf-input
|
|
120
|
+
size=${p(t)}
|
|
121
|
+
appearance="filled"
|
|
122
|
+
placeholder="${Me(t,"searchInList")}"
|
|
123
|
+
value="${a}"
|
|
124
|
+
name="sf_filter_${e.key||"list"}_search"
|
|
125
|
+
@input=${n=>{t.patchTempFilterOptionSearch(e.key,n.target?.value||"")}}
|
|
126
|
+
@change=${n=>{t.patchTempFilterOptionSearch(e.key,n.target?.value||"")}}
|
|
127
|
+
></sf-input>
|
|
128
|
+
`}
|
|
129
|
+
<div class="flex flex-col gap-1/2 overflow-x-hidden" data-size="4.5">
|
|
130
|
+
${s.map(n=>t.renderFilterOption(e,n,o))}
|
|
131
|
+
</div>
|
|
132
|
+
${s.length||"loading"===n?.status||"error"===n?.status?"":i.html`
|
|
133
|
+
<!-- A list with nothing in it says why, in one line, as every
|
|
134
|
+
list does (simai.interaction-rules, five states). -->
|
|
135
|
+
<sf-empty-state layout="inline" size="1/2" kind=${a?"nothing-found":"no-data"}></sf-empty-state>`}
|
|
136
|
+
${n?i.html`
|
|
137
|
+
<div role="status" aria-live="polite" class="sf-text-1">
|
|
138
|
+
${"loading"===n.status?Me(t,"loadingOptions"):""}
|
|
139
|
+
</div>
|
|
140
|
+
${"error"===n.status?i.html`<sf-empty-state layout="inline" size="1/2" kind="error" text=${Me(t,"optionsError")}
|
|
141
|
+
@sf-empty-state-action=${n=>{"retry"===n.detail?.id&&t.loadEndpointFilterPage(e,null,a)}}></sf-empty-state>`:""}
|
|
142
|
+
${n.nextCursor&&"error"!==n.status?i.html`<sf-button appearance="outline" size=${p(t)} text="${Me(t,"loadMore")}"
|
|
143
|
+
?disabled=${"loading"===n.status}
|
|
144
|
+
@click=${()=>t.loadEndpointFilterPage(e,n.nextCursor,a)}></sf-button>`:""}
|
|
145
|
+
`:""}
|
|
146
|
+
</div>
|
|
147
|
+
`}function v(e,t){return y(e,t)}function w(e,t){const n=e.filter?.options??["image","document","archive","other"].map(e=>({value:e,label:Me(t,`fileKind_${e}`)}));return y({...e,filter:{...e.filter||{},options:n,defaultOperator:e.filter?.defaultOperator??"in"}},t)}function x(e,t){const n=e.filter?.options??(Array.isArray(e.swatches)?e.swatches:[]).map(e=>"string"==typeof e?{value:e,label:e}:e).filter(e=>e?.value).map(e=>({value:e.value,label:e.label??e.value,color:e.value}));return n.length?y({...e,filter:{...e.filter||{},options:n,optionRenderer:e.filter?.optionRenderer??"swatch",defaultOperator:e.filter?.defaultOperator??"in"}},t):m(e,t)}const $={text:m,string:m,number:g,integer:g,date:b,datetime:b,range:f,"date-range":b,"multi-select":y,"single-select":y,choice:y,choices:y,boolean:y,user:y,"entity-multi-select":v,"entity-single-select":v,record:v,relation:v,lookup:v,file:w,color:x};function S(e={},t){const n=e.filter?.control||e.propertyType||e.type||e.dataType||"text";return($[n]||$.text)(e,t)}const k="1/2",C="tonal",T=[[/^image\//u,"image"],[/^video\//u,"movie"],[/^audio\//u,"audiotrack"],[/^text\/(csv|tab-separated-values)$/u,"table"],[/^text\//u,"description"],[/pdf$/u,"picture_as_pdf"],[/(zip|compressed|tar|rar|7z)/u,"folder_zip"],[/(sheet|excel|spreadsheet)/u,"table"],[/(word|document)$/u,"description"],[/(presentation|powerpoint)/u,"slideshow"]];function _(e){const t=String(e||"").toLowerCase(),n=T.find(([e])=>e.test(t));return n?n[1]:"attach_file"}function A(e,t){const n=Je(t);return n?i.html`
|
|
148
|
+
<sf-input-color size="1/2" appearance="plain" value=${String(n)}
|
|
149
|
+
label=${e.label||e.key||""} disabled></sf-input-color>
|
|
150
|
+
`:i.nothing}function F(e,t){const n=Je(t),s=e.inheritedValue??"";return n||s?i.html`
|
|
151
|
+
<sf-input-color
|
|
152
|
+
size="1"
|
|
153
|
+
appearance="plain"
|
|
154
|
+
value=${n?String(n):i.nothing}
|
|
155
|
+
inherited-value=${s?String(s):i.nothing}
|
|
156
|
+
label=${e.label||e.key||""}
|
|
157
|
+
disabled
|
|
158
|
+
></sf-input-color>
|
|
159
|
+
`:i.nothing}function z(e,t,n){const s=Je(t),r=e.inheritedValue??"";return i.html`
|
|
160
|
+
<sf-input-color
|
|
161
|
+
size=${H}
|
|
162
|
+
appearance="bordered"
|
|
163
|
+
name=${J(e)}
|
|
164
|
+
value=${s?String(s):i.nothing}
|
|
165
|
+
inherited-value=${r?String(r):i.nothing}
|
|
166
|
+
swatches=${e.swatches?String(e.swatches):i.nothing}
|
|
167
|
+
?clearable=${Boolean(r)||!0!==e.required}
|
|
168
|
+
?disabled=${!0===e.readonly}
|
|
169
|
+
label=${e.label||e.key||""}
|
|
170
|
+
@change=${t=>n.setFieldValue(e,t.detail?.value??"")}
|
|
171
|
+
></sf-input-color>
|
|
172
|
+
`}function R(e,t){return t&&"object"==typeof t&&t.label?re(e)?E(t):{component:{type:"reference-link",props:{line:k,label:String(t.label),icon:_(t.mime),...t.href?{href:String(t.href)}:{}}}}:null}function E(e){const t=String(e.mime??e.mimeType??""),n=Boolean(e.href)&&/^image\//u.test(t);return{component:{type:"file-preview",props:{compact:!0,fileName:String(e.label),mimeType:t,icon:_(t),...e.href?{href:String(e.href)}:{},...n?{imageUrl:String(e.href),kind:"image"}:{kind:"icon"},actions:!1,downloadAction:!1,removeAction:!1}}}}function O(e,t){if(!Array.isArray(t)||!t.length)return null;if("badges"===String(e.variant??""))return P(e,t);const n=e.options||e.filter?.options||e.constraints?.options,s=e=>{const t=Array.isArray(n)?n.find(t=>String(t?.value)===String(e)):null;return String(t?.label??t?.text??e)};return t.map(e=>({component:{type:"tag",props:{line:k,kind:"default",text:s(e)}}}))}function P(e,t){const n=e.options||e.filter?.options||e.constraints?.options;return t.map(t=>{const s=t&&"object"==typeof t?t.value:t,i=Array.isArray(n)?n.find(e=>String(e?.value)===String(s)):null,r=i?(0,a.f)(i):null,o=t&&"object"==typeof t&&void 0!==t.text?String(t.text):String(i?.label??i?.text??s);return{component:{type:"badge",props:{line:k,text:o,appearance:e.badgeAppearance??C,...r?.scheme?{scheme:r.scheme}:{},...r?.rootStyle?{rootStyle:r.rootStyle}:{}}}}})}const M={string:ne,date:I,datetime:I,time:I,boolean:q,choices:O,file:R,color:A,include:le,choice:j,integer:B,number:B,user:V,record:N,relation:N,lookup:K,html:W};function L(e,t){return{yes:e.trueText??e.labels?.true??Me(t,"yes"),no:e.falseText??e.labels?.false??Me(t,"no")}}function q(e,t,n){if("boolean"!=typeof t)return null;const s=L(e,n);return t?s.yes:s.no}function j(e,t){const n=e.options||e.filter?.options||e.constraints?.options;if(!Array.isArray(n))return null;const s=n.find(e=>String(e?.value)===String(t));if(!s)return null;const i=(0,a.f)(s);return{component:{type:"badge",props:{line:k,text:s.label??s.text??String(t),appearance:e.badgeAppearance??C,...i?.scheme?{scheme:i.scheme}:{},...i?.rootStyle?{rootStyle:i.rootStyle}:{}}}}}function I(e,t,n){const s=n?.formatFieldValue?.(e,t);return"string"==typeof s&&""!==s?s:null}function B(e,t,n){const s=e.variant||e.filter?.variant,i=Number(Je(t));return"scale"===s&&Number.isFinite(i)?i<0||i>100?null:{component:{type:"progress-scale",props:{line:k,value:String(i)}}}:I(e,t,n)}function D(e){return{component:{type:"reference-link",props:{line:k,appearance:"plain",icon:"",label:String(e.label),...e.href?{href:String(e.href)}:{}}}}}function V(e,t){return t&&"object"==typeof t&&t.label?[{component:{type:"avatar",props:{line:k,text:t.avatarText||""}}},t.href?D(t):String(t.label)]:null}function N(e,t){return t&&"object"==typeof t&&t.label?D(t):null}function K(e,t){const n=qe(e,t);return n.length?n.map(e=>e.label).join(", "):null}function W(e,t){return(0,d.j)(t)||null}function U(e={},t,n){const s=e.propertyType||e.type||e.dataType,i=M[s];if(!i)return null;const r=i(e,t,n);return r??null}let H="1";const G={record:Le,relation:Le,user:Le,lookup:je,string:ce,text:de,html:he,integer:ge,number:ge,date:ve,datetime:xe,time:$e,boolean:Se,choice:Fe,choices:Ee,file:Ve,color:z,include:oe};function J(e){return`sf_field_${e.key||"value"}`}function Q(e,t,n){return i.html`
|
|
173
|
+
<sf-input-country
|
|
174
|
+
size=${H}
|
|
175
|
+
name=${J(e)}
|
|
176
|
+
value=${Je(t)??""}
|
|
177
|
+
aria-label=${e.label||e.key||""}
|
|
178
|
+
?required=${Boolean(e.required)}
|
|
179
|
+
?disabled=${!0===e.readonly}
|
|
180
|
+
use-mask="true"
|
|
181
|
+
show-code="true"
|
|
182
|
+
@change=${t=>n.setFieldValue(e,t.detail?.value??t.target?.value??"")}
|
|
183
|
+
></sf-input-country>
|
|
184
|
+
`}function Y(e){return"password"===String(e.variant??"")}function Z(e){return e&&"object"==typeof e&&!Array.isArray(e)?!0===e.set:"string"==typeof e&&""!==e}function X(e,t){return Me(e,Z(t)?"passwordSet":"passwordUnset")}function ee(e){const t=e.currentTarget,n=t?.closest?.(".sf-field-password")?.querySelector?.("sf-input");if(!n)return;const s="false"===t.getAttribute("pressed");n.setAttribute("input-type",s?"text":"password"),t.setAttribute("pressed",s?"":"false"),t.setAttribute("icon",s?"visibility_off":"visibility")}function te(e,t,n){const s=Z(t),r=e.placeholder||(s?Me(n,"passwordKeep"):""),a=t=>{const s=t.target?.value??"";n.setFieldValue(e,""===s?void 0:s)};return i.html`
|
|
185
|
+
<span class="sf-field-password flex items-cross-center gap-1/3 min-w-0" spellcheck="false">
|
|
186
|
+
<sf-input
|
|
187
|
+
size=${H}
|
|
188
|
+
appearance="bordered"
|
|
189
|
+
root-class="flex-1 min-w-0"
|
|
190
|
+
input-type="password"
|
|
191
|
+
autocomplete="new-password"
|
|
192
|
+
name=${J(e)}
|
|
193
|
+
placeholder=${r||i.nothing}
|
|
194
|
+
?required=${Boolean(e.required)&&!s}
|
|
195
|
+
aria-label=${e.label||e.key||""}
|
|
196
|
+
@input=${a}
|
|
197
|
+
@change=${a}
|
|
198
|
+
></sf-input>
|
|
199
|
+
<sf-button-icon
|
|
200
|
+
size=${H}
|
|
201
|
+
appearance="link"
|
|
202
|
+
scheme="on-surface"
|
|
203
|
+
icon="visibility"
|
|
204
|
+
pressed="false"
|
|
205
|
+
aria-label=${Me(n,"showPassword")}
|
|
206
|
+
@click=${ee}
|
|
207
|
+
></sf-button-icon>
|
|
208
|
+
</span>
|
|
209
|
+
`}function ne(e,t,n){return Y(e)?X(n,t):null}function se(e,t,n){return Y(e)?i.html`<span class="sf-field-view">${X(n,t)}</span>`:Ye(e,t,n)}const ie=new Set(["image","image-card","image-list"]);function re(e){return ie.has(String(e.variant??""))}function ae(e,t){const n=Je(t);return n?i.html`
|
|
210
|
+
<pre class="sf-field-include" data-language=${e.language?String(e.language):i.nothing}><code>${String(n)}</code></pre>
|
|
211
|
+
`:i.nothing}function oe(e,t,n){return i.html`
|
|
212
|
+
<sf-input-textarea
|
|
213
|
+
size=${H}
|
|
214
|
+
appearance="bordered"
|
|
215
|
+
class="sf-field-include-edit"
|
|
216
|
+
name=${J(e)}
|
|
217
|
+
value=${Je(t)??""}
|
|
218
|
+
rows="8"
|
|
219
|
+
spellcheck="false"
|
|
220
|
+
?required=${Boolean(e.required)}
|
|
221
|
+
aria-label=${e.label||e.key||""}
|
|
222
|
+
?disabled=${!0===e.readonly}
|
|
223
|
+
@change=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
224
|
+
@input=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
225
|
+
></sf-input-textarea>
|
|
226
|
+
`}function le(e,t){const n=Je(t);if(!n)return i.nothing;const s=String(n).split("\n")[0];return i.html`<code>${s.length>60?`${s.slice(0,60)}…`:s}</code>`}function ce(e,t,n){const s=(0,u.$)(e);return"phone"===String(e.variant??"")?Q(e,t,n):Y(e)?te(e,t,n):s?ue(e,t,n,s):(t=Je(t),i.html`
|
|
227
|
+
<sf-input
|
|
228
|
+
size=${H}
|
|
229
|
+
appearance="bordered"
|
|
230
|
+
name=${J(e)}
|
|
231
|
+
value=${t??""}
|
|
232
|
+
placeholder=${e.placeholder||i.nothing}
|
|
233
|
+
?required=${Boolean(e.required)}
|
|
234
|
+
aria-label=${e.label||e.key||""}
|
|
235
|
+
@input=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
236
|
+
@change=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
237
|
+
></sf-input>
|
|
238
|
+
`)}function ue(e,t,n,s){t=Je(t);const r=!1===e.nullable?"":null,a=(t,i)=>{const a=t.currentTarget,o=String(a?.value??""),l=(0,u.C)(o,s);if("incomplete"===l){const t=Me(n,"maskIncomplete");return i&&a&&(a.setAttribute("error-message",t),a.toggleAttribute("invalid",!0)),void("function"==typeof n.setFieldError?(n.setFieldError(e,t),n.setFieldValue(e,o)):n.setFieldValue(e,void 0))}a?.hasAttribute("invalid")&&(a.toggleAttribute("invalid",!1),a.removeAttribute("error-message")),n.setFieldError?.(e,null),n.setFieldValue(e,"empty"===l?r:o)};return i.html`
|
|
239
|
+
<sf-input
|
|
240
|
+
size=${H}
|
|
241
|
+
appearance="bordered"
|
|
242
|
+
name=${J(e)}
|
|
243
|
+
value=${t??""}
|
|
244
|
+
placeholder=${e.placeholder||i.nothing}
|
|
245
|
+
autocomplete="off"
|
|
246
|
+
mask
|
|
247
|
+
mask-pattern=${s}
|
|
248
|
+
?required=${Boolean(e.required)}
|
|
249
|
+
aria-label=${e.label||e.key||""}
|
|
250
|
+
@input=${e=>a(e,!1)}
|
|
251
|
+
@change=${e=>a(e,!0)}
|
|
252
|
+
></sf-input>
|
|
253
|
+
`}function de(e,t,n){return t=Je(t),i.html`
|
|
254
|
+
<sf-input-textarea
|
|
255
|
+
size=${H}
|
|
256
|
+
appearance="bordered"
|
|
257
|
+
name=${J(e)}
|
|
258
|
+
value=${t??""}
|
|
259
|
+
placeholder=${e.placeholder||i.nothing}
|
|
260
|
+
?required=${Boolean(e.required)}
|
|
261
|
+
aria-label=${e.label||e.key||""}
|
|
262
|
+
@input=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
263
|
+
@change=${t=>n.setFieldValue(e,t.target?.value??"")}
|
|
264
|
+
></sf-input-textarea>
|
|
265
|
+
`}function he(e,t,n){t=Je(t);const s=t=>n.setFieldValue(e,t.currentTarget?.value??"");return i.html`
|
|
266
|
+
<sf-input-rich
|
|
267
|
+
size=${H}
|
|
268
|
+
appearance="bordered"
|
|
269
|
+
name=${J(e)}
|
|
270
|
+
value=${"string"==typeof t?t:""}
|
|
271
|
+
placeholder=${e.placeholder||i.nothing}
|
|
272
|
+
?required=${Boolean(e.required)}
|
|
273
|
+
?disabled=${We}
|
|
274
|
+
aria-label=${e.label||e.key||""}
|
|
275
|
+
@input=${s}
|
|
276
|
+
@change=${s}
|
|
277
|
+
></sf-input-rich>
|
|
278
|
+
`}function pe(e){return"stepper"===String(e.variant??"")}function me(e){if(null==e||""===e)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function fe(e,t,n){const s="number"===(e.propertyType||e.type),r=me(e.step),a=s?me(e.precision)||(r?"":"2"):"0",o=t=>n.setFieldValue(e,t.detail?.value??null);return i.html`
|
|
279
|
+
<sf-input-quantity
|
|
280
|
+
size=${H}
|
|
281
|
+
name=${J(e)}
|
|
282
|
+
value=${me(Je(t))}
|
|
283
|
+
min=${me(e.min)||i.nothing}
|
|
284
|
+
max=${me(e.max)||i.nothing}
|
|
285
|
+
step=${r||i.nothing}
|
|
286
|
+
precision=${a||i.nothing}
|
|
287
|
+
aria-label=${e.label||e.key||""}
|
|
288
|
+
?required=${Boolean(e.required)}
|
|
289
|
+
?disabled=${!0===e.readonly}
|
|
290
|
+
@input=${o}
|
|
291
|
+
@change=${o}
|
|
292
|
+
></sf-input-quantity>
|
|
293
|
+
`}function ge(e,t,n){if(pe(e))return fe(e,t,n);const s="number"===(e.propertyType||e.type);return t=Je(t),i.html`
|
|
294
|
+
<sf-input
|
|
295
|
+
size=${H}
|
|
296
|
+
appearance="bordered"
|
|
297
|
+
name=${J(e)}
|
|
298
|
+
value=${t??""}
|
|
299
|
+
inputmode=${s?"decimal":"numeric"}
|
|
300
|
+
?required=${Boolean(e.required)}
|
|
301
|
+
aria-label=${e.label||e.key||""}
|
|
302
|
+
@input=${t=>{const s=t.target?.value??"";n.setFieldValue(e,""===s?null:Number(s))}}
|
|
303
|
+
@change=${t=>{const s=t.target?.value??"";n.setFieldValue(e,""===s?null:Number(s))}}
|
|
304
|
+
></sf-input>
|
|
305
|
+
`}const be=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?)(Z|[+-]\d{2}:?\d{2})?$/;function ye(e){const t="string"==typeof e?e.trim().match(be):null;return t?{date:t[1],suffix:`T${t[2]}${t[3]||""}`}:{date:e,suffix:""}}function ve(e,t,n){t=Je(t);const{date:s,suffix:r}=ye(t);return i.html`
|
|
306
|
+
<sf-input-date
|
|
307
|
+
size=${H}
|
|
308
|
+
name=${J(e)}
|
|
309
|
+
value=${s??""}
|
|
310
|
+
aria-label=${e.label||e.key||""}
|
|
311
|
+
?required=${Boolean(e.required)}
|
|
312
|
+
@change=${t=>{const s=t.detail?.value??t.target?.value??null;n.setFieldValue(e,s&&r?`${s}${r}`:s)}}
|
|
313
|
+
></sf-input-date>
|
|
314
|
+
`}function we(e){const t=Number(e.step);return Number.isInteger(t)&&t>=1&&t<=60?String(t):""}function xe(e,t,n){const s=(0,c.AC)(t),r=s.date?`${s.date}${s.time?`T${s.time}`:""}`:"",a="string"==typeof e.min?e.min:"",o="string"==typeof e.max?e.max:"",l=we(e);return i.html`
|
|
315
|
+
<sf-input-date
|
|
316
|
+
class="sf-field-datetime"
|
|
317
|
+
mode="datetime"
|
|
318
|
+
size=${H}
|
|
319
|
+
name=${J(e)}
|
|
320
|
+
.value=${r}
|
|
321
|
+
min-date=${a||i.nothing}
|
|
322
|
+
max-date=${o||i.nothing}
|
|
323
|
+
minute-step=${l||i.nothing}
|
|
324
|
+
aria-label=${e.label||e.key||""}
|
|
325
|
+
?required=${Boolean(e.required)}
|
|
326
|
+
@change=${t=>{if(t.target!==t.currentTarget)return;const[i="",r=""]=String(t.detail?.value??"").split("T"),a=(0,c.cy)(s,{date:i,time:r});if(a.error)return;const o=null===a.value?s.known&&!s.date:a.value===s.raw;n.setFieldValue(e,o?void 0:a.value)}}
|
|
327
|
+
></sf-input-date>
|
|
328
|
+
`}function $e(e,t,n){const s=(0,c.SB)(t),r="string"==typeof e.min?e.min:"",a="string"==typeof e.max?e.max:"",o=we(e);return i.html`
|
|
329
|
+
<sf-input-date
|
|
330
|
+
class="sf-field-time"
|
|
331
|
+
mode="time"
|
|
332
|
+
size=${H}
|
|
333
|
+
name=${J(e)}
|
|
334
|
+
.value=${s.time}
|
|
335
|
+
min-time=${r||i.nothing}
|
|
336
|
+
max-time=${a||i.nothing}
|
|
337
|
+
minute-step=${o||i.nothing}
|
|
338
|
+
aria-label=${e.label||e.key||""}
|
|
339
|
+
?required=${Boolean(e.required)}
|
|
340
|
+
@change=${t=>{if(t.target!==t.currentTarget)return;const i=(0,c.MC)(s,String(t.detail?.value??""));if(i.error)return;const r=null===i.value?s.known&&!s.time:i.value===s.raw;n.setFieldValue(e,r?void 0:i.value)}}
|
|
341
|
+
></sf-input-date>
|
|
342
|
+
`}function Se(e,t,n){if(!(!0!==e.required))return i.html`
|
|
343
|
+
<sf-switch
|
|
344
|
+
size=${H}
|
|
345
|
+
name=${J(e)}
|
|
346
|
+
?checked=${!0===t}
|
|
347
|
+
aria-label=${e.label||e.key||""}
|
|
348
|
+
@change=${t=>n.setFieldValue(e,Boolean(t.target?.checked))}
|
|
349
|
+
></sf-switch>
|
|
350
|
+
`;const s=L(e,n),r=JSON.stringify([{value:"yes",label:s.yes},{value:"no",label:s.no}]);return i.html`
|
|
351
|
+
<sf-button-group
|
|
352
|
+
size=${H}
|
|
353
|
+
items=${r}
|
|
354
|
+
value=${!0===t?"yes":!1===t?"no":i.nothing}
|
|
355
|
+
aria-label=${e.label||e.key||""}
|
|
356
|
+
@change=${t=>{const s=t.detail?.value;n.setFieldValue(e,"yes"===s||"no"!==s&&null)}}
|
|
357
|
+
></sf-button-group>
|
|
358
|
+
`}function ke(e,t,n){const s=e.options||e.filter?.options||e.constraints?.options||[],i=n?new Set((Array.isArray(t)?t:[]).map(e=>String(e))):new Set([String(t??"")]);return s.map(e=>({type:"text",size:"1",text:e.label??e.text??String(e.value),value:String(e.value),selected:i.has(String(e.value))}))}const Ce=new Set(["1/2","1","2"]),Te=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"," ","Enter"]);function _e(e){return"buttons"===String(e.variant??"")}function Ae(e,t,n){t=Je(t);const s=(e.options||e.filter?.options||e.constraints?.options||[]).filter(e=>e&&null!==e.value&&void 0!==e.value&&""!==String(e.value)),r=s.map(e=>({value:String(e.value),label:String(e.label??e.text??e.value),...e.icon?{icon:String(e.icon)}:{},...e.disabled?{disabled:!0}:{}})),a=String(e.size??""),o=Ce.has(a)?a:H,l=We,c=!l&&!0===e.readonly,u=!0!==e.required&&!c&&!l,d=null==t?"":String(t),h={capture:!0,handleEvent(e){const t=e.currentTarget,n=e.target?.closest?.("[data-sf-button-group-value]");if(t&&n&&t.contains(n))return c?(e.preventDefault(),void e.stopPropagation()):void(u&&!n.disabled&&n.getAttribute("data-sf-button-group-value")===t.value&&(e.preventDefault(),e.stopPropagation(),t.clear?.()))}},p={capture:!0,handleEvent(e){c&&Te.has(e.key)&&(e.preventDefault(),e.stopPropagation())}};return i.html`
|
|
359
|
+
<sf-button-group
|
|
360
|
+
class="sf-field-choice-buttons"
|
|
361
|
+
appearance="segmented"
|
|
362
|
+
size=${o}
|
|
363
|
+
root-class=${c?"flex-wrap pointer-event-none":"flex-wrap"}
|
|
364
|
+
name=${J(e)}
|
|
365
|
+
items=${JSON.stringify(r)}
|
|
366
|
+
value=${d||i.nothing}
|
|
367
|
+
?disabled=${l}
|
|
368
|
+
data-readonly=${c?"true":i.nothing}
|
|
369
|
+
aria-label=${e.label||e.key||""}
|
|
370
|
+
@click=${h}
|
|
371
|
+
@keydown=${p}
|
|
372
|
+
@change=${t=>{const i=String(t.detail?.value??"");var r;n.setFieldValue(e,""===i?null:(r=i,s.find(e=>String(e.value)===r)?.value??r))}}
|
|
373
|
+
></sf-button-group>
|
|
374
|
+
`}function Fe(e,t,n){return _e(e)?Ae(e,t,n):(t=Je(t),i.html`
|
|
375
|
+
<sf-dropdown
|
|
376
|
+
size=${H}
|
|
377
|
+
appearance="outlined"
|
|
378
|
+
mode="select"
|
|
379
|
+
search="false"
|
|
380
|
+
name=${J(e)}
|
|
381
|
+
?required=${Boolean(e.required)}
|
|
382
|
+
value=${t??""}
|
|
383
|
+
aria-label=${e.label||e.key||""}
|
|
384
|
+
.options=${ke(e,t,!1)}
|
|
385
|
+
@change=${t=>n.setFieldValue(e,t.detail?.value??null)}
|
|
386
|
+
></sf-dropdown>
|
|
387
|
+
`)}const ze=13;function Re(e,t,n){const s=e.options||e.filter?.options||e.constraints?.options||[],r=new Set((Array.isArray(t)?t:[]).map(e=>String(e)));return i.html`
|
|
388
|
+
<div class="sf-field-checklist grid gap-1/3 w-full min-w-0" role="group" aria-label=${e.label||e.key||""}
|
|
389
|
+
style="grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr))">
|
|
390
|
+
${s.map(t=>i.html`<sf-checkbox size=${H}
|
|
391
|
+
name=${J(e)} value=${String(t.value)}
|
|
392
|
+
label=${t.label??t.text??String(t.value)}
|
|
393
|
+
.checked=${r.has(String(t.value))}
|
|
394
|
+
@change=${i=>((t,i)=>{const a=s.filter(e=>String(e.value)===String(t.value)?i:r.has(String(e.value))).map(e=>e.value);n.setFieldValue(e,a)})(t,Boolean(i.target?.checked??i.detail?.checked))}></sf-checkbox>`)}
|
|
395
|
+
</div>
|
|
396
|
+
`}function Ee(e,t,n){const s=e.options||e.filter?.options||e.constraints?.options||[],r=String(e.variant??"");return"checklist"===r||"select"!==r&&s.length>=ze?Re(e,t,n):i.html`
|
|
397
|
+
<sf-dropdown
|
|
398
|
+
size=${H}
|
|
399
|
+
appearance="outlined"
|
|
400
|
+
mode="select"
|
|
401
|
+
multiple
|
|
402
|
+
search="false"
|
|
403
|
+
name=${J(e)}
|
|
404
|
+
?required=${Boolean(e.required)}
|
|
405
|
+
aria-label=${e.label||e.key||""}
|
|
406
|
+
.options=${ke(e,t,!0)}
|
|
407
|
+
@change=${t=>{const s=t.detail?.values??t.detail?.value;n.setFieldValue(e,Array.isArray(s)?s:s?[s]:[])}}
|
|
408
|
+
></sf-dropdown>
|
|
409
|
+
`}const Oe={en:{yes:"Yes",no:"No",searchInList:"Find in the list",containsText:"Contains…",fileKind_image:"Images",fileKind_document:"Documents",fileKind_archive:"Archives",fileKind_other:"Other files",operator:"Operator",rangeFrom:"From",rangeTo:"To",loadingOptions:"Loading the options",optionsError:"The options could not be loaded",pickRecord:"Choose a record",pickFromList:"Choose from the list",searchRecords:"Find a record",loadingRecords:"Loading records",recordsError:"The records could not be loaded",retry:"Try again",loadMore:"Load more",removeFile:"Remove",passwordSet:"Set",passwordUnset:"Not set",passwordKeep:"Set; type a new one to replace it",showPassword:"Show password",maskIncomplete:"Complete the field"},ru:{yes:"Да",no:"Нет",searchInList:"Найти в списке",containsText:"Содержит…",fileKind_image:"Изображения",fileKind_document:"Документы",fileKind_archive:"Архивы",fileKind_other:"Прочие файлы",operator:"Оператор",rangeFrom:"От",rangeTo:"До",loadingOptions:"Загрузка вариантов",optionsError:"Не удалось загрузить варианты",pickRecord:"Выберите запись",pickFromList:"Выберите из списка",searchRecords:"Найти запись",loadingRecords:"Загрузка записей",recordsError:"Не удалось загрузить записи",retry:"Повторить",loadMore:"Загрузить ещё",removeFile:"Удалить",passwordSet:"Задан",passwordUnset:"Не задан",passwordKeep:"Задан; введите новый, чтобы заменить",showPassword:"Показать пароль",maskIncomplete:"Заполните поле полностью"}},Pe="sf-field-renderers";function Me(e,t){return e?.getFieldText?.(t)??(0,o.pageText)(Oe,t,e??null,Pe)}function Le(e,t,n){if(!n.loadFieldOptions||!n.getFieldOptionsPage)return null;const s=n.getFieldOptionsPage(e)||null;if("unsupported"===s?.status)return null;const r=n.getFieldOptionSearch?.(e)??"",a=t&&"object"==typeof t?t:null,o=Array.isArray(s?.items)?s.items:[],l=[...a&&!o.some(e=>String(e.value)===String(a.value))?[a]:[],...o].map(e=>({type:"text",size:"1",text:String(e.label??e.value),value:String(e.value),selected:Boolean(a&&String(a.value)===String(e.value))}));return i.html`
|
|
410
|
+
<div class="sf-field-picker flex flex-col gap-1/3" data-field-picker=${e.key||i.nothing}>
|
|
411
|
+
<sf-dropdown
|
|
412
|
+
size=${H}
|
|
413
|
+
appearance="outlined"
|
|
414
|
+
mode="select"
|
|
415
|
+
search="true"
|
|
416
|
+
name=${J(e)}
|
|
417
|
+
?required=${Boolean(e.required)}
|
|
418
|
+
value=${a?String(a.value):""}
|
|
419
|
+
placeholder=${e.placeholder||Me(n,"pickRecord")}
|
|
420
|
+
search-placeholder=${e.searchPlaceholder||Me(n,"searchRecords")}
|
|
421
|
+
aria-label=${e.label||e.key||""}
|
|
422
|
+
.options=${l}
|
|
423
|
+
@change=${t=>(t=>{if(!t)return void n.setFieldValue(e,null);const s=[a,...o].find(e=>e&&String(e.value)===String(t));n.setFieldValue(e,s?{value:s.value,label:s.label}:{value:t})})(t.detail?.value??null)}
|
|
424
|
+
@input=${t=>{const s=t.target?.value??"";n.setFieldOptionSearch?.(e,s),n.loadFieldOptions(e,{cursor:null,search:s})}}
|
|
425
|
+
></sf-dropdown>
|
|
426
|
+
${s?i.html`
|
|
427
|
+
<div class="sf-field-picker-state flex items-cross-center gap-1/3">
|
|
428
|
+
<div role="status" aria-live="polite" class="sf-text-1">
|
|
429
|
+
${"loading"!==s.status||s.quiet?"error"===s.status?Me(n,"recordsError"):"":Me(n,"loadingRecords")}
|
|
430
|
+
</div>
|
|
431
|
+
${"error"===s.status?i.html`
|
|
432
|
+
<sf-button appearance="outline" size="1" text=${Me(n,"retry")}
|
|
433
|
+
@click=${()=>n.loadFieldOptions(e,{cursor:null,search:r})}
|
|
434
|
+
></sf-button>
|
|
435
|
+
`:i.nothing}
|
|
436
|
+
${s.nextCursor&&"error"!==s.status?i.html`
|
|
437
|
+
<sf-button appearance="outline" size="1" text=${Me(n,"loadMore")}
|
|
438
|
+
?disabled=${"loading"===s.status}
|
|
439
|
+
@click=${()=>n.loadFieldOptions(e,{cursor:s.nextCursor,search:r})}
|
|
440
|
+
></sf-button>
|
|
441
|
+
`:i.nothing}
|
|
442
|
+
</div>
|
|
443
|
+
`:i.nothing}
|
|
444
|
+
</div>
|
|
445
|
+
`}function qe(e,t){const n=Array.isArray(t)?t:[t],s=Array.isArray(e.options)?e.options:[];return n.filter(e=>null!=e&&""!==e).map(e=>{if("object"==typeof e)return{value:e.value,label:String(e.label??e.value??"")};const t=s.find(t=>String(t?.value)===String(e));return{value:e,label:String(t?.label??t?.text??e)}})}function je(e,t,n){const s=!0===e.multiple,r=Array.isArray(e.options)&&e.options.length>0;if(!(r||n.loadFieldOptions&&n.getFieldOptionsPage))return null;const a=r?null:n.getFieldOptionsPage(e)||null;if("unsupported"===a?.status)return null;const o=r?"":n.getFieldOptionSearch?.(e)??"",l=qe(e,t),c=(r?e.options:Array.isArray(a?.items)?a.items:[]).filter(e=>e&&"object"==typeof e).map(e=>({value:e.value,label:String(e.label??e.text??e.value)})),u=e=>l.some(t=>String(t.value)===String(e.value)),d=[...l.filter(e=>!c.some(t=>String(t.value)===String(e.value))),...c].map(e=>({type:"text",size:"1",text:e.label,value:String(e.value),selected:u(e)})),h=[...l,...c],p=e=>{const t=h.find(t=>String(t.value)===String(e));return t?{value:t.value,label:t.label}:{value:e,label:String(e)}};return i.html`
|
|
446
|
+
<div class="sf-field-picker flex flex-col gap-1/3" data-field-picker=${e.key||i.nothing}>
|
|
447
|
+
<sf-dropdown
|
|
448
|
+
size=${H}
|
|
449
|
+
appearance="outlined"
|
|
450
|
+
mode="select"
|
|
451
|
+
?multiple=${s}
|
|
452
|
+
search="true"
|
|
453
|
+
name=${J(e)}
|
|
454
|
+
?required=${Boolean(e.required)}
|
|
455
|
+
value=${s?i.nothing:l[0]?String(l[0].value):""}
|
|
456
|
+
placeholder=${e.placeholder||Me(n,"pickFromList")}
|
|
457
|
+
search-placeholder=${e.searchPlaceholder||Me(n,"searchInList")}
|
|
458
|
+
aria-label=${e.label||e.key||""}
|
|
459
|
+
.options=${d}
|
|
460
|
+
@change=${t=>{if(s){const s=t.detail?.values??t.detail?.value,i=(Array.isArray(s)?s:s?[s]:[]).filter(e=>""!==e);return void n.setFieldValue(e,i.map(p))}const i=t.detail?.value??null;n.setFieldValue(e,null===i||""===i?null:p(i))}}
|
|
461
|
+
@input=${r?i.nothing:t=>{const s=t.target?.value??"";n.setFieldOptionSearch?.(e,s),n.loadFieldOptions(e,{cursor:null,search:s})}}
|
|
462
|
+
></sf-dropdown>
|
|
463
|
+
${a?i.html`
|
|
464
|
+
<div class="sf-field-picker-state flex items-cross-center gap-1/3">
|
|
465
|
+
<div role="status" aria-live="polite" class="sf-text-1">
|
|
466
|
+
${"loading"!==a.status||a.quiet?"error"===a.status?Me(n,"optionsError"):"":Me(n,"loadingOptions")}
|
|
467
|
+
</div>
|
|
468
|
+
${"error"===a.status?i.html`
|
|
469
|
+
<sf-button appearance="outline" size="1" text=${Me(n,"retry")}
|
|
470
|
+
@click=${()=>n.loadFieldOptions(e,{cursor:null,search:o})}
|
|
471
|
+
></sf-button>
|
|
472
|
+
`:i.nothing}
|
|
473
|
+
${a.nextCursor&&"error"!==a.status?i.html`
|
|
474
|
+
<sf-button appearance="outline" size="1" text=${Me(n,"loadMore")}
|
|
475
|
+
?disabled=${"loading"===a.status}
|
|
476
|
+
@click=${()=>n.loadFieldOptions(e,{cursor:a.nextCursor,search:o})}
|
|
477
|
+
></sf-button>
|
|
478
|
+
`:i.nothing}
|
|
479
|
+
</div>
|
|
480
|
+
`:i.nothing}
|
|
481
|
+
</div>
|
|
482
|
+
`}function Ie(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e):e&&"object"==typeof e?[e]:[]}function Be(e,t){return"image"===String(e.variant??"")&&!0!==e.multiple&&Ie(t).length<=1}function De(e,t,n){const s=Ie(t)[0]??null,r=Array.isArray(t);return i.html`
|
|
483
|
+
<sf-input-image
|
|
484
|
+
size=${H}
|
|
485
|
+
name=${J(e)}
|
|
486
|
+
accept=${e.accept?String(e.accept):i.nothing}
|
|
487
|
+
hint=${e.uploadSupportingText||i.nothing}
|
|
488
|
+
.value=${s}
|
|
489
|
+
aria-label=${e.label||e.key||""}
|
|
490
|
+
?required=${Boolean(e.required)}
|
|
491
|
+
?disabled=${!0===e.readonly}
|
|
492
|
+
@change=${t=>{const s=t.detail?.value??null;n.setFieldValue(e,r?s?[s]:[]:s);const i=t.detail?.file;i&&n.startFieldUpload&&n.startFieldUpload(e,[{name:i.name,state:"process",progress:0,file:i}])}}
|
|
493
|
+
></sf-input-image>
|
|
494
|
+
`}function Ve(e,t,n){if(Be(e,t))return De(e,t,n);const s=Ie(t),r=!0===e.multiple||Array.isArray(t),a=Boolean(n.startFieldUpload&&n.getFieldUploads),o=a?n.getFieldUploads(e):null,l=Array.isArray(o)?o:[];return i.html`
|
|
495
|
+
<div class="sf-field-file flex flex-col">
|
|
496
|
+
${s.map((t,a)=>i.html`
|
|
497
|
+
<sf-file-preview
|
|
498
|
+
file-name=${String(t.label??t.name??"File")}
|
|
499
|
+
file-size=${String(t.size??"")}
|
|
500
|
+
icon=${_(t.mime??t.mimeType)}
|
|
501
|
+
mime-type=${String(t.mime??t.mimeType??"")}
|
|
502
|
+
href=${t.href?String(t.href):i.nothing}
|
|
503
|
+
download-action=${t.href?"true":"false"}
|
|
504
|
+
remove-action="true"
|
|
505
|
+
remove-label=${`${Me(n,"removeFile")} ${t.label??t.name??""}`.trim()}
|
|
506
|
+
@sf-file-preview-detach=${()=>(t=>{const i=s.filter((e,n)=>n!==t);n.setFieldValue(e,r?i:i[0]??null)})(a)}
|
|
507
|
+
></sf-file-preview>
|
|
508
|
+
`)}
|
|
509
|
+
|
|
510
|
+
${a?i.html`
|
|
511
|
+
<sf-file-upload
|
|
512
|
+
size=${H}
|
|
513
|
+
name=${J(e)}
|
|
514
|
+
accept=${String(e.accept??"")}
|
|
515
|
+
formats=${String(e.formats??"")}
|
|
516
|
+
link-text=${e.uploadText||i.nothing}
|
|
517
|
+
text=${e.uploadHint||i.nothing}
|
|
518
|
+
supporting-text=${e.uploadSupportingText||i.nothing}
|
|
519
|
+
?multiple=${r}
|
|
520
|
+
?disabled=${!0===e.readonly}
|
|
521
|
+
aria-label=${e.label||e.key||""}
|
|
522
|
+
.items=${l}
|
|
523
|
+
@sf-file-upload:select=${t=>{const s=t.detail?.files,i=Array.isArray(s)?s:[];i.length&&n.startFieldUpload(e,i)}}
|
|
524
|
+
@sf-file-upload:retry=${t=>{n.retryFieldUpload?.(e,Number(t.detail?.index??-1))}}
|
|
525
|
+
></sf-file-upload>
|
|
526
|
+
`:i.nothing}
|
|
527
|
+
</div>
|
|
528
|
+
`}const Ne=e=>"1/2"===e?.size?"1/2":"1",Ke=(e,t)=>"choice"===e&&_e(t);let We=!1;function Ue(e={},t,n,s={}){const i=e.propertyType||e.type||e.dataType,r=!0===s?.disabled;if((!0===e.readonly||r)&<[i]&&!Ke(i,e))return ct(e,t,n,s);const a=G[i];if(!a||!n?.setFieldValue)return null;const o=H,l=We;H=Ne(s),We=r;try{return a(e,t,n)}finally{H=o,We=l}}let He="1";function Ge(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)&&"string"==typeof e.text}function Je(e){return Ge(e)?e.value:e}function Qe(e,t,n){const s=n?.formatFieldValue?.(e,t);if("string"==typeof s)return s;if(Ge(t))return t.text;const i=Je(t);return null==i?"":String(i)}function Ye(e,t,n){const s=Qe(e,t,n);return s?i.html`<span class="sf-field-view">${s}</span>`:i.nothing}function Ze(e,t){const n=(0,d.b)(t);return n?i.html`<div class="sf-field-view sf-field-html">${(0,r.unsafeHTML)(n)}</div>`:i.nothing}function Xe(e,t,n){if(null==t||""===t)return i.nothing;const s=e.variant||e.filter?.variant,r=Number(Je(t));if("scale"===s&&Number.isFinite(r)&&r>=0&&r<=100)return i.html`<sf-progress-scale size="1" value=${String(r)}></sf-progress-scale>`;const a=Qe(e,t,n);return i.html`<span class="sf-field-view">${e.unit?`${a} ${e.unit}`:a}</span>`}function et(e,t,n){const s=Qe(e,t,n);return s?i.html`<span class="sf-field-view">${s}</span>`:i.nothing}function tt(e,t,n){if("boolean"!=typeof t)return i.nothing;const s=L(e,n);return i.html`<span class="sf-field-view">${t?s.yes:s.no}</span>`}function nt(e,t){const n=e.options||e.filter?.options||e.constraints?.options,s=Array.isArray(n)?n.find(e=>String(e?.value)===String(t)):null;if(!s)return i.nothing;const r=(0,a.f)(s);return i.html`
|
|
529
|
+
<sf-badge
|
|
530
|
+
line=${He}
|
|
531
|
+
appearance=${e.badgeAppearance??C}
|
|
532
|
+
scheme=${r.scheme}
|
|
533
|
+
style=${r.rootStyle||i.nothing}
|
|
534
|
+
text=${String(s.label??s.text??t)}
|
|
535
|
+
></sf-badge>
|
|
536
|
+
`}function st(e,t){if(!Array.isArray(t)||!t.length)return i.nothing;const n=e.options||e.filter?.options||e.constraints?.options;return i.html`
|
|
537
|
+
<span class="sf-field-view flex flex-wrap items-cross-center gap-1/3 min-w-0">
|
|
538
|
+
${t.map(e=>i.html`<sf-tag root-class="flex-none" line=${He} kind="default" text=${(e=>{const t=Array.isArray(n)?n.find(t=>String(t?.value)===String(e)):null;return String(t?.label??t?.text??e)})(e)}></sf-tag>`)}
|
|
539
|
+
</span>
|
|
540
|
+
`}function it(e,t){return t&&"object"==typeof t&&t.label?i.html`
|
|
541
|
+
<span class="sf-field-view flex items-cross-center gap-1/3">
|
|
542
|
+
<sf-avatar line=${He} text=${t.avatarText||""}></sf-avatar>
|
|
543
|
+
${t.href?i.html`<sf-reference-link appearance="plain" icon="" line=${He}
|
|
544
|
+
label=${String(t.label)} href=${String(t.href)}></sf-reference-link>`:i.html`<span>${String(t.label)}</span>`}
|
|
545
|
+
</span>
|
|
546
|
+
`:i.nothing}function rt(e,t){return t&&"object"==typeof t&&t.label?i.html`
|
|
547
|
+
<sf-reference-link
|
|
548
|
+
appearance="plain"
|
|
549
|
+
icon=""
|
|
550
|
+
line=${He}
|
|
551
|
+
label=${String(t.label)}
|
|
552
|
+
href=${t.href?String(t.href):i.nothing}
|
|
553
|
+
></sf-reference-link>
|
|
554
|
+
`:i.nothing}function at(e,t){const n=qe(e,t);return n.length?1===n.length&&!0!==e.multiple?i.html`<span class="sf-field-view">${n[0].label}</span>`:i.html`
|
|
555
|
+
<span class="sf-field-view flex flex-wrap items-cross-center gap-1/3 min-w-0">
|
|
556
|
+
${n.map(e=>i.html`<sf-tag root-class="flex-none" line=${He} kind="default" text=${e.label}></sf-tag>`)}
|
|
557
|
+
</span>
|
|
558
|
+
`:i.nothing}function ot(e,t){const n=Ie(t);if(!n.length)return i.nothing;const s=re(e),r="image-card"===String(e.variant??"");return i.html`
|
|
559
|
+
<span class="sf-field-view flex ${r?"flex-row":"flex-col"} gap-1/3">
|
|
560
|
+
${n.map(e=>i.html`
|
|
561
|
+
<sf-file-preview
|
|
562
|
+
file-name=${String(e.label??e.name??"File")}
|
|
563
|
+
file-size=${String(e.size??"")}
|
|
564
|
+
icon=${_(e.mime??e.mimeType)}
|
|
565
|
+
mime-type=${String(e.mime??e.mimeType??"")}
|
|
566
|
+
href=${e.href?String(e.href):i.nothing}
|
|
567
|
+
image-url=${s&&e.href?String(e.href):i.nothing}
|
|
568
|
+
kind=${s?"image":i.nothing}
|
|
569
|
+
download-action=${e.href?"true":"false"}
|
|
570
|
+
remove-action="false"
|
|
571
|
+
></sf-file-preview>
|
|
572
|
+
`)}
|
|
573
|
+
</span>
|
|
574
|
+
`}const lt={string:se,text:Ye,html:Ze,integer:Xe,number:Xe,date:et,datetime:et,time:et,boolean:tt,choice:nt,choices:st,user:it,record:rt,relation:rt,lookup:at,file:ot,color:F,include:ae};function ct(e={},t,n,s={}){const i=e.propertyType||e.type||e.dataType,r=lt[i];if(!r)return null;const a=He;He=Ne(s);try{return r(e,t,n)}finally{He=a}}"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.fieldRenderers={...window.SF.fieldRenderers||{},renderCellField:U,renderEditField:Ue,renderFilterField:S,renderViewField:ct,FILTER_RENDERERS:$,dateTime:{split:c.AC,compose:c.cy,normalizeTime:c.d2,splitTime:c.SB,composeTime:c.MC},registry:l.u.map(e=>{return{...e,modes:(t=e.type,(0,l.U)(t,{view:lt,edit:G,cell:M,filter:$}))};var t})},globalThis.document?.dispatchEvent?.(new CustomEvent("sf-field-renderers-ready"))),s()}catch(ut){s(ut)}})},dd6973f77245(e,t,n){n.d(t,{$:()=>o,C:()=>l});const s={0:"\\d",a:"\\p{L}","*":"[\\s\\S]"},i={0:e=>/\d/u.test(e),a:e=>/\p{L}/u.test(e),"*":()=>!0},r=e=>e.replace(/[\\^$.*+?()[\]{}|/]/gu,"\\$&");const a=new Map;function o(e){const t=e?.mask;return"string"==typeof t&&""!==t?t:null}function l(e,t,n="_"){const o=String(e??"");a.has(t)||a.set(t,function(e){let t="";const n=[];for(let a=0;a<e.length;a+=1){const o=e[a];"\\"===o?(a+=1,a<e.length&&(t+=r(e[a]),n.push({fixed:e[a]}))):"{"===o||"}"===o||"["===o||"]"===o||(s[o]?(t+=s[o],n.push({test:i[o]})):(t+=r(o),n.push({fixed:o})))}return{complete:new RegExp(`^${t}$`,"u"),tokens:n}}(t));const{complete:l,tokens:c}=a.get(t);return l.test(o)?"complete":0===function(e,t,n){let s=0,i=0;for(const r of e){for(;i<t.length&&void 0!==t[i].fixed&&t[i].fixed!==r;)i+=1;if(i>=t.length)break;const e=t[i];void 0!==e.fixed||r===n?i+=1:e.test(r)&&(s+=1,i+=1)}return s}(o,c,n)?"empty":"incomplete"}},fc654eb7fab0(e,t,n){n.d(t,{U:()=>i});const s=Object.freeze([{type:"string",label:{ru:"Строка",en:"String"},variants:[{id:"phone",label:{ru:"Телефон",en:"Phone"}},{id:"password",label:{ru:"Пароль",en:"Password"},writeOnly:!0}],params:["placeholder","mask","nullable","required","readonly"]},{type:"text",label:{ru:"Текст",en:"Text"},variants:[],params:["placeholder","required","readonly"]},{type:"html",label:{ru:"Форматированный текст",en:"Formatted text"},variants:[],params:["placeholder","required","readonly"]},{type:"integer",label:{ru:"Целое число",en:"Integer"},variants:[{id:"stepper",label:{ru:"Кнопками «−» и «+»",en:"With steppers"}}],params:["unit","min","max","step","required","readonly"]},{type:"number",label:{ru:"Число",en:"Number"},variants:[{id:"scale",label:{ru:"Шкала 0–100",en:"Scale 0–100"}},{id:"stepper",label:{ru:"Кнопками «−» и «+»",en:"With steppers"}}],params:["unit","min","max","step","precision","required","readonly"]},{type:"date",label:{ru:"Дата",en:"Date"},variants:[],params:["required","readonly"]},{type:"datetime",label:{ru:"Дата и время",en:"Date and time"},variants:[],params:["min","max","step","required","readonly"]},{type:"time",label:{ru:"Время",en:"Time"},variants:[],params:["min","max","step","required","readonly"]},{type:"boolean",label:{ru:"Да или нет",en:"Yes or no"},variants:[],params:["trueText","falseText","required","readonly"]},{type:"choice",label:{ru:"Одно из списка",en:"One of a list"},variants:[{id:"buttons",label:{ru:"Кнопками",en:"As buttons"}}],params:["options","badgeAppearance","size","required","readonly"]},{type:"choices",label:{ru:"Несколько из списка",en:"Several of a list"},variants:[{id:"badges",label:{ru:"Значками",en:"As badges"}},{id:"checklist",label:{ru:"Флажками",en:"As a checklist"}},{id:"select",label:{ru:"Выпадающим списком",en:"As a dropdown"}}],params:["options","badgeAppearance","required","readonly"]},{type:"user",label:{ru:"Пользователь",en:"User"},variants:[],params:["placeholder","searchPlaceholder","required","readonly"]},{type:"record",label:{ru:"Запись",en:"Record"},variants:[],params:["placeholder","searchPlaceholder","required","readonly"]},{type:"relation",label:{ru:"Связь",en:"Relation"},variants:[],params:["placeholder","searchPlaceholder","required","readonly"]},{type:"lookup",label:{ru:"Из справочника",en:"From a reference list"},variants:[],params:["options","multiple","placeholder","searchPlaceholder","required","readonly"]},{type:"file",label:{ru:"Файл",en:"File"},variants:[{id:"image",label:{ru:"Изображение",en:"Image"}},{id:"image-card",label:{ru:"Изображение карточкой",en:"Image card"}},{id:"image-list",label:{ru:"Изображения списком",en:"Image list"}}],params:["accept","multiple","formats","uploadText","uploadSupportingText","uploadHint","required","readonly"]},{type:"color",label:{ru:"Цвет",en:"Colour"},variants:[],params:["swatches","required","readonly"]},{type:"include",label:{ru:"Код",en:"Code"},variants:[],params:["language","required","readonly"]}]);function i(e,t){return{view:Boolean(t.view?.[e]),edit:Boolean(t.edit?.[e]),cell:t.cell?.[e]?"own":"text",filter:t.filter?.[e]?"own":"text"}}n.d(t,["u",0,s])},"926043d18700"(e,t,n){function s(e){const t=e.values().next().value,n=t?.value;if(!n)return;const s=n.parentNode;var i;return s?{gap:(i=s,parseFloat(getComputedStyle(i).rowGap)||0),item:n,parent:s}:void 0}function i(e){let t=e;for(;t;){if(t.nodeName.toLowerCase().startsWith("sf-"))return t.parentNode;t=t.parentNode}return null}n.d(t,{PA:()=>i,lF:()=>s})},"870b5dfddc25"(e,t,n){function s(e){if("undefined"==typeof SF||!SF.Loader)return;const t=SF.Loader,n=Number(t.dragObserverLockCount||0);t.dragObserverLockCount=e?n+1:Math.max(n-1,0),t.stopObserver=t.dragObserverLockCount>0}n.d(t,{J:()=>s})},"5961360f41f4"(e,t,n){n.d(t,{f:()=>c});const s=Object.freeze(["main","tonal","outline"]),i=Object.freeze(["neutral","primary","secondary","tertiary","info","success","warning","error","on-surface"]),r=Object.freeze({danger:"error"}),a=Object.freeze(["1/3","1/2","1"]);function o(e){const t=String(e??"").trim().toLowerCase(),n=r[t]??t;return i.includes(n)?n:""}Object.freeze(i.flatMap(e=>s.filter(t=>!("on-surface"===e&&"tonal"===t)).flatMap(t=>a.map(n=>Object.freeze({type:t,scheme:e,size:n})))));const l=/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function c(e={}){const t=e?.scheme??e?.color,n="string"==typeof t?t.trim():"",s=o(n);return s?{scheme:s,rootStyle:""}:l.test(n)?{scheme:"neutral",rootStyle:`--sf-badge--background-color: color-mix(in srgb, ${n} 24%, transparent); --sf-badge--color: var(--sf-on-surface)`}:{scheme:"neutral",rootStyle:""}}},"94d60d3691b5"(e,t,n){n.a(e,async(e,t)=>{try{var s=n("deb1a4d61565"),i=n("5b7d7695b41b"),r=n("17828be41e75"),a=n("c1f17ed5a348"),o=n("f8651e83c6c6"),l=n("678dc07d76bf"),c=n("32294b89604f"),u=n("9d9caaf4f796"),d=n("5961360f41f4"),h=n("e5483002f3ea"),p=n("eb06ad68f8d3"),m=n("2f31b00ad99a"),f=n("2a080a730149"),g=n("8137feb490e0"),b=n("43090d1c8307"),y=n("926043d18700"),v=n("870b5dfddc25"),w=n("116963e5e31b"),x=n("51250bf01ab0"),$=e([s,i,u,h,m,f,g,b,w]);[s,i,u,h,m,f,g,b,w]=$.then?(await $)():$;var S=n.n(s),k=n.n(w);const C=()=>globalThis.SF?.Preferences||x.A,T=e=>`sf-table/${String(e).replace(/[^\w.:-]+/gu,"-")}`,_=new Set(["sf-badge","sf-tag","sf-avatar"]),A="sf-table/*",F=Object.freeze({density:"normal",stripes:!1,lines:!1,singleLine:!1,stickyHead:!0});function z(e){for(let t=e;t;t=t.parentElement??t.getRootNode?.()?.host??null){if(t===document.body||t===document.documentElement)return null;const e=getComputedStyle(t);if(/(auto|scroll|overlay)/u.test(e.overflowY)&&t.scrollHeight>t.clientHeight+1)return t}return null}const R=(e={})=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e.replace(/-([a-z0-9])/gu,(e,t)=>t.toUpperCase()),t])),E={en:R(l.runtime),ru:R(c.runtime)},O=new Set(["select","settings","actions"]),P=()=>globalThis.SF?.Position||k(),M=Object.freeze({outputs:Object.freeze({selection:"record-ids.v1"}),inputs:Object.freeze({context:"record-ids.v1"})}),L=1e3;function q(e){for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<32||127===n)return!0}return!1}function j(e){if(!Array.isArray(e)||e.length>L||Array.from(e).some(e=>!("string"==typeof e&&e.length>0&&e.length<=256&&!q(e)||Number.isSafeInteger(e)))||new Set(Array.from(e,e=>`${typeof e}:${e}`)).size!==e.length)throw new TypeError("Record identities must be unique nonempty strings or safe integers");return Object.freeze([...e])}let I=0;const B=300,D=20,V=60,N=40,K=new Set(["text","textarea","markdown","html"]);function W(e){return"contents"===getComputedStyle(e).display?e.firstElementChild??e:e}function U(e){return 4*Math.ceil((Math.ceil(e)+1)/4)}const H=(0,i.elementFromManifest)(a,{base:S(),lang:{en:l,ru:c},source:"ru",aliases:o});function G(e,t){const n=new Map;return e.forEach((e,t)=>{null!=e?.id&&n.set(String(e.id),t)}),t.some((e,t)=>{if(null==e?.id)return!1;const s=n.get(String(e.id));return void 0!==s&&s!==t})}class J extends H{static get sfPorts(){return M}static get props(){return{templateName:{attribute:"template",default:"default"},ariaLabel:{attribute:"aria-label",default:"Data table"},current:{attribute:"current",default:""},selectable:{type:Boolean,default:!0},verticalScroll:{attribute:"vertical-scroll",default:"self",values:["self","page"]},layout:{default:"table",values:["auto","table","list"]},listBelow:{attribute:"list-below",type:Number,default:600},listFields:{attribute:"list-fields",type:Number,default:3},toolbar:{type:Boolean,default:!0},settings:{type:Boolean,default:!0},pagin:{type:Boolean,default:!1},actions:{type:Boolean,default:!0},rowActions:{attribute:"row-actions",type:Boolean,default:!0},dragRows:{attribute:"drag-rows",type:Boolean,default:!1},rowReorder:{attribute:"row-reorder",type:Boolean,default:!1},inlineEdit:{attribute:"inline-edit",type:Boolean,default:!1},rowActionsVisible:{attribute:"row-actions-visible",default:"hover"},creatable:{type:Boolean,default:!0},filterTemplates:{attribute:"filter-templates",type:Boolean,default:!0},settingsMenu:{attribute:"settings-menu",type:Boolean,default:!0},size:{default:"1",values:["1/2","1"]},filterText:{attribute:"filter-text",default:"Filter"},clearText:{attribute:"clear-text",default:"Clear"},searchPlaceholder:{attribute:"search-placeholder",default:"Search"},createText:{attribute:"create-text",default:"Create"},pinColumnLabel:{attribute:"pin-column-label",default:"Pin the column"},unpinColumnLabel:{attribute:"unpin-column-label",default:"Unpin the column"},paginationTotal:{attribute:"pagination-total",type:Number,default:10},paginationPageSize:{attribute:"pagination-page-size",type:Number,default:10},pageSizes:{attribute:"page-sizes",default:"10,20,30,40"},contextMenuColumns:{attribute:"context-menu-columns",type:Number,default:1},rememberWidths:{attribute:"remember-widths",type:Boolean,default:!1},preferencesKey:{attribute:"preferences-key",default:""},tableSettingsKey:{attribute:"table-settings-key",default:""},dataState:{attribute:"data-state",default:"auto",values:["auto","loading","populated","empty","error"]},loadingText:{attribute:"loading-text",default:"Loading"},emptyText:{attribute:"empty-text",default:"No data"},errorText:{attribute:"error-text",default:"The data could not be loaded"},retryText:{attribute:"retry-text",default:"Try again"},columnMoveLabel:{attribute:"column-move-label",default:"Move the column"},filterApplyText:{attribute:"filter-apply-text",default:"Apply"},columnSearchPlaceholder:{attribute:"column-search-placeholder",default:"Search the fields"},columnSearchEmptyText:{attribute:"column-search-empty-text",default:"No field matches"}}}get contextMenuColumns(){const e=this.getNumberAttr?.("context-menu-columns",1)??1;return Number.isFinite(e)&&e>0?e:1}get tableSettingsKey(){return this.getAttribute?.("table-settings-key")||""}constructor(){super(),this._emptyContext=null,this.rowPointerDown=e=>this.handleRowPointerDown(e),this._windowRange=null,this._windowed=!1,this._rowHeight=0,this.addEventListener("sf-empty-state-action",e=>{const t=e.detail?.id;"retry"===t?(e.stopPropagation(),this.requestRetry()):"create"===t?(e.stopPropagation(),this.requestCreateIntent()):"reset-query"===t&&(e.stopPropagation(),this.resetQuery(this._emptyContext?.reset??"both"))}),this._portalContainer=null,this._instanceId="sf-table-"+ ++I,this._selectionPortKey="[]",this._routeContext=null,this._querySequence=0,this._pendingQuerySequence=null,this._abandonedQuery=!1,this._filterOptionPages=new Map,this._contextViewportBound=!1,this.contextKeyEvent=this.contextKeyEvent.bind(this),this.contextViewportEvent=this.contextViewportEvent.bind(this),this.ACTIONS_SETTINGS_ROW=[{name:this.text("editActionText"),id:"edit",component:{type:"button-icon",props:{kind:"icon",size:"1",appearance:"link",scheme:"on-surface",icon:"edit",ariaLabel:this.text("editActionText"),value:"edit"}}},{name:this.text("viewActionText"),id:"view",component:{type:"button-icon",props:{kind:"icon",size:"1",appearance:"link",scheme:"on-surface",icon:"visibility",ariaLabel:this.text("viewActionText"),value:"view"}}},{name:this.text("deleteActionText"),id:"delete",danger:!0,component:{type:"button-icon",props:{kind:"icon",size:"1",appearance:"link",scheme:"on-surface",status:"error",icon:"delete",ariaLabel:this.text("deleteActionText"),value:"delete"}}}],this.TABLE_ACTIONS_COLUMN={key:"actions",label:this.text("actionsColumnLabel"),system:!0},this.TABLE_SETTINGS_COLUMN={key:"settings",label:"settings",system:!0,width:"calc(var(--sf-text-height-1) + (var(--sf-ui-1--space-y-tightness-default) * 2) + var(--sf-b6))",component:{type:"button-icon",props:{size:"1",appearance:"link",scheme:"on-surface",icon:"settings",ariaLabel:this.text("settingsColumnLabel"),value:"settings","@click":e=>{const t=this.state.contextMenu?.open&&"table-settings"===this.state.contextMenu?.menu;t&&e.timeStamp-(this._settingsOpenedAt??0)>200?this.closeContextMenu():t||(this._settingsOpenedAt=e.timeStamp,this.openContextMenu(e,{menu:"table-settings"}))}}}},this.contextEvent=this.contextEvent.bind(this),this.hoverEvents=this.hoverEvents.bind(this),this.outEvent=this.outEvent.bind(this),this._contextEventBound=!1,this._hoverEventBound=!1,this._columnResizeEventBound=!1,this._headerSortableRow=null,this._headerSortableDetach=null,this._columnResizeState=null,this.searchChange=this.scheduleSearchChange.bind(this),this._searchDebounceTimer=null,this._searchPendingProps=null,this._searchHoldKey="",this.refs={contextMenu:this.createRef(),items:new Map,templateForm:this.createRef(),renameInput:this.createRef(),table:this.createRef(),scroll:this.createRef(),rail:this.createRef(),resizeGuide:this.createRef()},this._currentRowId=null,this._checkboxMeasureToken=0,this._responsiveWidth=0,this._responsiveObserver=null,this._filterTemplatesLoaded=!1,this.tempSettings=null,this.state={settingsChecked:!1,bulkActions:[],createItems:[],toolbarActions:[],columnSettingsQuery:"",sort:{key:null,direction:null},saveInputValue:"",search:{searchActive:!1,value:""},contextMenu:{open:!1},actions:this.getActions().map(e=>Object.assign(e,{visible:!0})),actionActive:this.getProp("actions"),columnSettings:{},selectIndeterminate:!1,filterDataDirty:!1,filter:{selectedTemplateKey:"default",fields:[],templates:[],edit:{rename:""}}},this.TABLE_SELECT_COLUMN={key:"select",label:"select",system:!0,width:"calc(var(--sf-text-height-1) + var(--sf-b6) + calc(var(--sf-px) * 2))",component:{type:"checkbox",props:{position:"end",rootClass:"content-main-between",size:this.size,"@change":e=>{const t=Boolean(e.target.checked);this._selectionAnchorId=null,this.set({selectIndeterminate:!1,settingsChecked:t}),this.updateRows(e=>({...e,select:this.getDefaultRowCell(this.TABLE_SELECT_COLUMN,{...e,selected:t,checked:t})}),"select-all")},indeterminate:this.state.selectIndeterminate,checked:this.state.settingsChecked,ariaLabel:this.text("selectAllLabel")}},rowComponent:{type:"checkbox",props:{position:"end",rootClass:"content-main-between",size:this.size}}}}get rows(){return this.getTableData().rows||[]}set rows(e){this.setRows(Array.isArray(e)?e:[])}get columns(){return this.getTableData().columns||[]}set columns(e){this.setColumns(Array.isArray(e)?e:[])}get tableData(){return this.getTableData()}set tableData(e){this.setTableData(e&&"object"==typeof e?e:{})}get tableSettings(){return this.getColumnSettings()}set tableSettings(e){this.setTableSettings(e&&"object"==typeof e?e:{})}get bulkActions(){return this.state?.bulkActions??[]}set bulkActions(e){this.setBulkActions(e)}get createItems(){return this.state?.createItems??[]}set createItems(e){this.setCreateItems(e)}get toolbarActions(){return this.getToolbarActions()}set toolbarActions(e){this.setToolbarActions(e)}get filterFields(){return this.getFilterFields()}set filterFields(e){this.setFilterFields(e)}get activeFilterFields(){return this.getActiveFilterFieldKeys()}set activeFilterFields(e){this.setActiveFilterFields(e)}get templates(){return this.getFilterTemplates()}set templates(e){this.setTemplates(e)}get sort(){const{key:e,direction:t}=this.state?.sort??{};return e&&t?[{key:e,direction:t}]:[]}set sort(e){const t=Array.isArray(e)?e[0]:e,n=t?.key??t?.field??null,s=t?.direction??t?.dir??null;n&&["asc","desc"].includes(s)?this.setSort(n,s):this.setSort(null,null)}get current(){return this._currentRowId??""}set current(e){const t=null==e?"":String(e);this._currentRowId=t||null,(this.getAttribute("current")??"")!==t?t?this.setAttribute("current",t):this.removeAttribute("current"):this.requestComponentUpdate("current")}attributeChangedCallback(e,t,n){"current"===e&&t!==n&&(this._currentRowId=n||null),super.attributeChangedCallback?.(e,t,n)}get selected(){return this._currentRowId??void 0}get selection(){return this.getSelectedRecordIds()}isActionParameters(e,t){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype&&t.some(t=>Object.hasOwn(e,t))}focusRowAction({id:e}={}){return null==e||""===e?{outcome:"refused",reason:"empty"}:(this.focusRow(String(e),{reveal:!0}),{outcome:"applied"})}sfAliasAdapters(){return{"sf-table-action-intent":e=>Object.freeze({action_id:e.action,record_ids:e.ids}),"sf-port-output":e=>Object.freeze({port:"selection",value:e.ids}),onSearchEnd:e=>e.search}}getActions(){return this.getProp("actions")?this.ACTIONS_SETTINGS_ROW.map(e=>{const{name:t,id:n}=e;return{name:t,id:n}}):[]}isSearchHoldKey(e=""){return"Backspace"===e||"Delete"===e}clearSearchDebounce(){this._searchDebounceTimer&&(clearTimeout(this._searchDebounceTimer),this._searchDebounceTimer=null)}scheduleSearchChange(e={}){return this._searchPendingProps=e,this.clearSearchDebounce(),this._searchHoldKey||(this._searchDebounceTimer=setTimeout(()=>{const e=this._searchPendingProps||{};this._searchPendingProps=null,this._searchDebounceTimer=null,this.updateSearchState(e)},500)),this}handleSearchKeyDown(e){return this.isSearchHoldKey(e?.key)?(this._searchHoldKey=e.key,this.clearSearchDebounce(),this):this}handleSearchKeyUp(e){return this._searchHoldKey&&e?.key===this._searchHoldKey?(this._searchHoldKey="",this._searchPendingProps&&this.scheduleSearchChange(this._searchPendingProps),this):this}updateSearchState(e={},t=!0){const n=this.state.search||{};let s=!1;for(const[t,i]of Object.entries(e))if(!Object.is(n[t],i)){s=!0;break}return s?(this.set(t=>({search:{...t.search,...e}})),t?(this.emitTableEvent("search-change",{search:this.state.search.value}),this):this):this}emitTableEvent(e,t={},n={}){return this.sfEmit(e,t,n)}requestActionIntent(e,t,n={}){if(this.isActionParameters?.(e,["action-id","actionId"])&&({actionId:e,recordIds:t}={actionId:e["action-id"]??e.actionId,recordIds:e["record-ids"]??e.recordIds}),"string"!=typeof e||!e.trim()||!Array.isArray(t)||0===t.length||Array.from(t).some(e=>!("string"==typeof e&&e.length>0||Number.isSafeInteger(e))))throw new TypeError("Action intent requires an opaque action ID and nonempty typed record IDs");const s=Object.freeze([...t]),i=this.getTableData().rows||[],r={};for(const e of s){const t=i.find(t=>t?.id===e)?.revision;null!=t&&(r[e]=t)}const a=n?.scope??(1===s.length?"entry":"selection");return this.emitTableEvent("apply",Object.freeze({action:e,scope:a,ids:s,revisions:Object.freeze(r)})),{outcome:"applied"}}getSelectedRecordIds(){return this.getTableData().rows.filter(e=>!0===e.select?.component?.props?.checked).map(e=>e.id)}setBulkActions(e=[]){if(!Array.isArray(e)||Array.from(e).some(e=>!e||"object"!=typeof e||"string"!=typeof e.id||!e.id.trim()||"string"!=typeof e.name||!e.name.trim()||Object.keys(e).some(e=>"id"!==e&&"name"!==e)))throw new TypeError("Bulk actions require opaque id and name only");return this.set({bulkActions:e.map(({id:e,name:t})=>({id:e,name:t}))})}renderBulkActions(){if(!this.state.bulkActions?.length)return f.nothing;const e=this.getSelectedRecordIds();return f.html`<div class="flex flex-wrap gap-1/3">
|
|
575
|
+
${this.state.bulkActions.map(t=>f.html`<sf-button
|
|
576
|
+
text=${t.name} ?disabled=${0===e.length}
|
|
577
|
+
@click=${()=>{const e=this.getSelectedRecordIds();e.length&&this.requestActionIntent(t.id,e,{scope:"selection"})}}></sf-button>`)}
|
|
578
|
+
</div>`}setCreateItems(e=[]){if(!Array.isArray(e)||Array.from(e).some(e=>!e||"object"!=typeof e||"string"!=typeof e.id||!e.id.trim()||"string"!=typeof e.name||!e.name.trim()||Object.keys(e).some(e=>"id"!==e&&"name"!==e)))throw new TypeError("Create items require opaque id and name only");return this.set({createItems:e.map(({id:e,name:t})=>({id:e,name:t}))})}requestCreateIntent(e=null){if(this.isActionParameters?.(e,["item-id","itemId"])&&(e=e["item-id"]??e.itemId??null),null!==e&&!this.state.createItems.some(t=>t.id===e))throw new TypeError(`sf-view-table has no create item ${String(e)}`);return this.emitTableEvent("create",Object.freeze({item:e})),{outcome:"applied"}}setToolbarActions(e=[]){if(!Array.isArray(e)||Array.from(e).some(e=>!e||"object"!=typeof e||"string"!=typeof e.id||!e.id.trim()||"string"!=typeof e.label||!e.label.trim()||null!=e.icon&&"string"!=typeof e.icon||null!=e.href&&!this.isSameSiteHref(e.href)||Object.keys(e).some(e=>!["id","label","icon","href"].includes(e))))throw new TypeError("Toolbar actions require id and label, and an optional icon and same-site href");return this.set({toolbarActions:e.map(({id:e,label:t,icon:n,href:s})=>({id:e,label:t,...n?{icon:n}:{},...s?{href:s}:{}}))})}getToolbarActions(){return(this.state.toolbarActions||[]).map(e=>({...e}))}isSameSiteHref(e=""){const t=String(e??"").trim();if(!t||t.startsWith("//"))return!1;try{return new URL(t,document.baseURI).origin===new URL(document.baseURI).origin}catch{return!1}}requestToolbarAction(e){const t=this.getToolbarActions().find(t=>t.id===e);if(!t)throw new TypeError(`sf-view-table has no toolbar action ${String(e)}`);return this.emitTableEvent("toolbar-action",Object.freeze({action:t.id,href:t.href??null}),{cancelable:!0})&&t.href&&this.isSameSiteHref(t.href)&&window.location.assign(t.href),this}renderToolbarActionsContextMenu(e){const{x:t,y:n}=e,s=this.getToolbarActions(),i=s.map(e=>({id:String(e.id),text:e.label,...e.icon?{icon:e.icon}:{}}));return f.html`
|
|
579
|
+
<sf-menu-context
|
|
580
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
581
|
+
:key=${t+n}
|
|
582
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"toolbar-actions"})}
|
|
583
|
+
style="
|
|
584
|
+
position: fixed;
|
|
585
|
+
left: ${t}px;
|
|
586
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
587
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
588
|
+
"
|
|
589
|
+
data-context-main-menu
|
|
590
|
+
.entries=${i}
|
|
591
|
+
@sf-menu-context-select=${e=>{const t=s.find(t=>String(t.id)===e.detail?.id);this.closeContextMenu(),t&&this.requestToolbarAction(t.id)}}
|
|
592
|
+
></sf-menu-context>
|
|
593
|
+
`}renderListSortContextMenu(e){const{x:t,y:n}=e,s=this.state.sort||{},i=(e,t)=>{this.closeContextMenu(),this.setSort(e,t),this.emitTableEvent("sort-change",Object.freeze({key:e,direction:t}))},r=new Map,a=(e,t,n)=>{const i=`${t??""}:${n??""}`;return r.set(i,[t,n]),{id:i,text:e,kind:"radio",checked:s.key===t&&s.direction===n}},o=this.getColumns().filter(e=>e?.sortable&&!e.system&&!["select","settings","actions"].includes(e.key)),l=[a(this.text("sortNone"),null,null),...o.flatMap(e=>[a(`${e.label??e.key}, ${this.text("sortAscending")}`,e.key,"asc"),a(`${e.label??e.key}, ${this.text("sortDescending")}`,e.key,"desc")])];return f.html`
|
|
594
|
+
<sf-menu-context
|
|
595
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
596
|
+
:key=${t+n}
|
|
597
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"list-sort"})}
|
|
598
|
+
style="
|
|
599
|
+
position: fixed;
|
|
600
|
+
left: ${t}px;
|
|
601
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
602
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
603
|
+
"
|
|
604
|
+
data-context-main-menu
|
|
605
|
+
.entries=${l}
|
|
606
|
+
@sf-menu-context-select=${e=>{const t=r.get(e.detail?.id);t&&i(...t)}}
|
|
607
|
+
></sf-menu-context>
|
|
608
|
+
`}renderCreateContextMenu(e){const{x:t,y:n}=e,s=this.state.createItems,i=s.map(e=>({id:String(e.id),text:e.name}));return f.html`
|
|
609
|
+
<sf-menu-context
|
|
610
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
611
|
+
:key=${t+n}
|
|
612
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"create"})}
|
|
613
|
+
style="
|
|
614
|
+
position: fixed;
|
|
615
|
+
left: ${t}px;
|
|
616
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
617
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
618
|
+
"
|
|
619
|
+
data-context-main-menu
|
|
620
|
+
.entries=${i}
|
|
621
|
+
@sf-menu-context-select=${e=>{const t=s.find(t=>String(t.id)===e.detail?.id);this.closeContextMenu(),t&&this.requestCreateIntent(t.id)}}
|
|
622
|
+
></sf-menu-context>
|
|
623
|
+
`}getSort(){return{...this.state.sort}}setSort(e=null,t=null){if(this.isActionParameters?.(e,["key","direction"])&&({key:e=null,direction:t=null}=e),null===e||null===t)return this.set({sort:{key:null,direction:null}}),{outcome:"applied"};if("string"!=typeof e||!e||!["asc","desc"].includes(t))throw new TypeError("Sort requires a column key and direction asc or desc");return this.set({sort:{key:e,direction:t}}),{outcome:"applied"}}toggleSort(e){const t=this.state.sort||{},n=t.key!==e?"asc":"asc"===t.direction?"desc":"desc"===t.direction?null:"asc";return this.setSort(n?e:null,n),this.emitTableEvent("sort-change",Object.freeze({key:e,direction:n}))}suppressNextHeaderClick(){this._suppressHeaderClick=!0,setTimeout(()=>{this._suppressHeaderClick=!1},0)}handleHeaderSortClick(e,t={}){if(!0!==t.sortable||t.system||this._suppressHeaderClick)return;const n=e.composedPath?.()[0]||e.target;n instanceof Element&&n.closest(".sf-table-column-resizer")||this.toggleSort(t.key)}syncSelectionPort(){if(!this._isMounted)return this;const e=this.getSelectedRecordIds(),t=JSON.stringify(e.map(e=>[typeof e,e]));return t===this._selectionPortKey||(this._selectionPortKey=t,this.emitTableEvent("select",Object.freeze({ids:Object.freeze([...e])}))),this}applyRowSelection(e,t,{range:n=!1}={}){const s=this.getTableData().rows,i=(e,t)=>String(e?.id??"")===String(t??""),r=s.findIndex(t=>i(t,e));if(r<0)return this;const a=n&&null!=this._selectionAnchorId?s.findIndex(e=>i(e,this._selectionAnchorId)):-1,o=a<0?r:Math.min(a,r),l=a<0?r:Math.max(a,r);return this.set({settingsChecked:!1}),this.updateRows((e,n)=>n<o||n>l?e:{...e,selected:t,checked:t,select:this.getDefaultRowCell(this.TABLE_SELECT_COLUMN,{...e,selected:t,checked:t})},n&&a>=0?"select-range":"select-row"),this._selectionAnchorId=e,this.syncSelectAllState()}syncSelectAllState(){const e=this.getSelectedRecordIds().length,t=this.getTableData().rows.length;return this.set({settingsChecked:t>0&&e===t,selectIndeterminate:e>0&&e<t})}handleRowPointerDown(e){return this._selectRangeModifier=!0===e?.shiftKey,(!0===e?.shiftKey||e?.detail>1)&&e.preventDefault?.(),this}isRowControlTarget(e){return e instanceof Element&&Boolean(e.closest('td[data-key="select"], td[data-key="settings"], a[href], button, input, select, textarea, [role="button"], [role="link"], sf-checkbox, sf-dropdown, sf-button, sf-button-icon'))}handleRowClick(e,t,n=-1){return this.focusRow(this.getRowKey(t,n)),this.openReferenceFromCell(e,t),this}openReferenceFromCell(e,t){if(e.defaultPrevented||e.button>0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const n=e.target?.closest?.("a[href]"),s=n?.closest?.("td[data-key]");if(!n||!s||!this.contains(s))return;const i=s.dataset.key,r=t?.[i],a=n.getAttribute("href");if(!a||a.startsWith("#")||"_blank"===n.target||n.hasAttribute("download"))return;this.emitTableEvent("reference-open",{recordId:t?.id??null,field:i,value:r??null,href:a},{cancelable:!0})||e.preventDefault()}getRowKey(e,t=-1){const n=e?.id??e?.value;return null!=n&&""!==String(n)?String(n):t>=0?`index:${t}`:""}actionsShownFor(e){if("always"===this.getAttribute("row-actions-visible"))return!0;const t=String(e?.id??e?.value??"");return!t||(t===this._pointerRowKey||t===this._focusRowKey||String(this._currentRowId??"")===t)}setActionsRow(e,t){const n="focus"===e?"_focusRowKey":"_pointerRowKey",s=t?String(t):null;this[n]!==s&&(this[n]=s,this._layoutUnchanged=!0,this.requestComponentUpdate("row-actions"))}bindRowActionsEvents(e){if(!e||this._rowActionsTable===e)return;this._rowActionsAbort?.abort(),this._rowActionsAbort=new AbortController,this._rowActionsTable=e;const{signal:t}=this._rowActionsAbort,n=e=>e?.closest?.("tbody tr[data-row-id]")?.dataset.rowId??null;e.addEventListener("pointerover",e=>this.setActionsRow("pointer",n(e.target)),{signal:t}),e.addEventListener("dragstart",e=>{const t=n(e.target);if(!t||!this.hasAttribute("drag-rows")||!e.dataTransfer)return;const s=this.getSelectedRecordIds?.()??[],i=s.map(String).includes(t)?s.map(String):[t],r=this.getAttribute("preferences-key")||this.getAttribute("table-settings-key")||this.id||null;e.dataTransfer.setData("application/x-sf-records+json",JSON.stringify({ids:i,source:r})),e.dataTransfer.setData("text/plain",i.join(", ")),e.dataTransfer.effectAllowed="copyMove",this.emitTableEvent("rows-drag",Object.freeze({ids:i,source:r}))},{signal:t});const s=()=>"true"===this.getAttribute("row-reorder"),i=(t,n)=>{for(const t of e.querySelectorAll("tbody tr[data-sf-drop-before], tbody tr[data-sf-drop-after]"))t.removeAttribute("data-sf-drop-before"),t.removeAttribute("data-sf-drop-after");t&&t.setAttribute(n?"data-sf-drop-after":"data-sf-drop-before","")},r=e=>{const t=e.target?.closest?.("tbody tr[data-row-id]");if(!t)return null;const n=t.getBoundingClientRect();return{row:t,after:e.clientY>n.top+n.height/2}};e.addEventListener("dragstart",e=>{const t=n(e.target);t&&s()&&e.dataTransfer&&(this._reorderDrag=[t],e.dataTransfer.setData("application/x-sf-row-order",t),e.dataTransfer.effectAllowed="move")},{signal:t}),e.addEventListener("dragover",e=>{if(!this._reorderDrag||!s())return;const t=r(e);t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",i(t.row,t.after))},{signal:t}),e.addEventListener("drop",t=>{if(!this._reorderDrag||!s())return;const n=r(t);i(null);const a=this._reorderDrag;if(this._reorderDrag=null,!n)return;t.preventDefault();const o=[...e.querySelectorAll("tbody tr[data-row-id]")].map(e=>e.dataset.rowId),l=o.indexOf(n.row.dataset.rowId)+(n.after?1:0),c=o.slice(l).filter(e=>!a.includes(e))[0]??null,u=o.filter(e=>!a.includes(e)),d=null===c?u.length:u.indexOf(c),h=[...u.slice(0,d),...a,...u.slice(d)];h.join("\0")!==o.join("\0")&&this.emitTableEvent("move",Object.freeze({ids:[...a],before:c,order:h}))},{signal:t}),e.addEventListener("dragend",()=>{this._reorderDrag=null,i(null)},{signal:t}),e.addEventListener("pointerleave",()=>this.setActionsRow("pointer",null),{signal:t}),e.addEventListener("focusin",e=>this.setActionsRow("focus",n(e.target)),{signal:t}),e.addEventListener("focusout",t=>{e.contains(t.relatedTarget)||this.setActionsRow("focus",null)},{signal:t})}isCurrentRow(e,t=-1){const n=this.getRowKey(e,t);return""!==n&&String(this._currentRowId??"")===n}windowSlice(e=[]){const t=e.length;if(t<B||this.isList)return this._windowed=!1,this._windowCount=t,null;this._windowed=!0,this._windowCount=t;const n=this._rowHeight||N,s=this.clampWindow(this._windowRange??{first:0,last:V-1},t);return this._windowRange=s,{first:s.first,last:s.last,before:s.first*n,after:Math.max(0,t-1-s.last)*n}}clampWindow({first:e=0,last:t=0}={},n=0){const s=Math.max(0,n-1),i=Math.min(Math.max(0,Math.floor(e)),s);return{first:i,last:Math.min(Math.max(i,Math.floor(t)),s)}}windowRowCount(){return this._windowed?String((this._windowCount??0)+1):null}seenRows(e){const t=this.refs.table?.value?.tBodies?.[0];if(!t||!e)return null;const n=t.getBoundingClientRect();let s=0,i=globalThis.innerHeight||document.documentElement.clientHeight||0;const r=this.refs.scroll?.value;if(r){const e=r.getBoundingClientRect();s=Math.max(s,e.top),i=Math.min(i,e.bottom)}const a=this._rowHeight||N,o=e-1,l=Math.min(o,Math.max(0,Math.floor((s-n.top)/a)));return{first:l,last:Math.min(o,Math.max(l,Math.ceil((i-n.top)/a)))}}syncWindow(){if(!this._windowed)return!1;const e=this.refs.table?.value,t=e?.querySelectorAll?.("tbody tr[data-row-id]")??[];let n=!1;if(t.length){const e=t[0].getBoundingClientRect(),s=(t[t.length-1].getBoundingClientRect().bottom-e.top)/t.length;s>0&&Math.abs(s-(this._rowHeight||0))>.5&&(this._rowHeight=s,n=!0)}const s=this._windowCount??0,i=this.seenRows(s);if(!i)return!1;const r=this._windowRange??{first:0,last:V-1},a=r.first>0?r.first+D/2:0,o=r.last<s-1?r.last-D/2:s-1;if((i.first<a||i.last>o)&&(this._windowRange=this.clampWindow({first:i.first-D,last:i.last+D},s),n=!0),!n)return!1;this._windowOnly=!0,this.requestComponentUpdate("window");const{first:l,last:c}=this._windowRange;return this._reportedWindow!==`${l}-${c}`&&(this._reportedWindow=`${l}-${c}`,this.emitTableEvent("window",{first:l,last:c})),!0}bindWindowScroll(){if(this._windowScrollAbort)return;this._windowScrollAbort=new AbortController;const e=this._windowScrollAbort.signal,t=()=>{this._windowed&&!this._windowFrame&&(this._windowFrame=requestAnimationFrame(()=>{this._windowFrame=0,this.isConnected&&this.syncWindow()}))};document.addEventListener("scroll",t,{capture:!0,passive:!0,signal:e}),globalThis.addEventListener?.("resize",t,{passive:!0,signal:e})}unbindWindowScroll(){this._windowScrollAbort?.abort(),this._windowScrollAbort=null,this._windowFrame&&cancelAnimationFrame(this._windowFrame),this._windowFrame=0}rowMarkupCell(e,t){const n=t?.key;if(!n||!e)return null;const i="1/2"===this.size?"1/2":"1";if("select"===n){const t=e.select?.component;return"checkbox"!==t?.type||"function"!=typeof t.props?.["@change"]?null:{kind:"box",size:i,checked:!0===t.props.checked,value:String(t.props.value??e.id??""),label:t.props.ariaLabel??"",change:t.props["@change"]}}if("settings"===n){const t=e.settings?.component;return"sf-button-icon"!==(0,s.canonicalTag)(`sf-${String(t?.type??"").replace(/^sf-/u,"")}`)||"menu"!==t.props?.icon||"function"!=typeof t.props?.["@click"]?null:{kind:"menu",size:i,label:t.props.ariaLabel??this.text("menuLabel"),click:t.props["@click"]}}if(t.system||t.component||"link"===t.renderer||"title"===t.role)return null;if(this.isTree()||e.path||this.cellEditable(e,t))return null;const r=e[n];if(null==r)return{kind:"empty"};if("string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r)return null;if(K.has(t.propertyType??t.property_type??t.type)&&"boolean"!=typeof r){const e=this.cellText(t,r);return{kind:"text",className:"sf-table-cell-clip",text:e,title:e}}const a=this.getTypedCellValue(t,r);if(null!=a)return"string"!=typeof a&&"number"!=typeof a?null:{kind:"text",className:"sf-table-cell-bare",text:String(a)};if("boolean"==typeof r)return null;const o=String(r);return{kind:"text",className:"sf-table-cell-text",text:o,title:o.length>80?o:null}}keyboardRows(){return(this.getTableData().rows||[]).filter(e=>e&&!e.__tree?.more)}focusRow(e,{reveal:t=!1}={}){if(e&&"object"==typeof e)return this.focusRowAction(e);if(null==e||""===e)return this;this._currentRowId=String(e);const n=this.refs.table?.value;if(!n)return this;const s=`tbody tr[data-row-id="${String(e).replace(/"/gu,'\\"')}"]`;for(const e of n.querySelectorAll("tbody tr[data-current]"))e.removeAttribute("data-current");const i=n.querySelector(s);if(!i&&this._windowed){const t=this.getTableData().rows||[],n=t.findIndex((t,n)=>this.getRowKey(t,n)===String(e));return n>=0&&(this._windowRange=this.clampWindow({first:n-D,last:n+D},t.length),this._pendingFocusRow=String(e),this._windowOnly=!0,this.requestComponentUpdate("window")),this}return i?.setAttribute("data-current",""),t&&i?.scrollIntoView?.({block:"nearest",behavior:"instant"}),i?.focus?.({preventScroll:!0}),this}canOpenRow(e){return Array.isArray(e?.actions)&&e.actions.includes("view")}handleRowOpen(e,t){if(this.isRowControlTarget(e?.target)||!this.canOpenRow(t))return this;const n=t?.id;return null==n?this:this.requestActionIntent("view",[n])}isTree(){const e=this.getTableData?.().rows??[];return this._treeMemo?.rows!==e&&(this._treeMemo={rows:e,tree:e.some(e=>e?.__tree)}),this._treeMemo.tree}treeColumnKey(e=this.getColumns()){if(!this.isTree())return null;const t=e.filter(e=>e?.key&&!["select","settings","actions"].includes(e.key)&&!e.system);return(t.find(e=>"title"===e.role)??t[0])?.key??null}toggleTreeRow(e){return this.isActionParameters?.(e,["row"])&&!e.__tree&&(e=e.row),e?.__tree?.hasChildren?(this.emitTableEvent("expand",Object.freeze({id:e.id,expanded:!0===e.__tree.expanded})),{outcome:"applied"}):{outcome:"refused",reason:"no-children"}}requestTreeMore(e){return this.isActionParameters?.(e,["row"])&&!e.__tree&&(e=e.row),e?.__tree?.more?(this.emitTableEvent("load-more",Object.freeze({direction:"after",parent:e.__tree.parent,cursor:e.__tree.cursor??null})),{outcome:"applied"}):{outcome:"refused",reason:"no-more"}}handleRowKeydown(e,t){if(e?.target!==e?.currentTarget)return this;if(t?.__tree?.hasChildren&&("ArrowRight"===e.key||"ArrowLeft"===e.key)){const n=!0===t.__tree.expanded;if("ArrowRight"===e.key!==n)return e.preventDefault?.(),this.toggleTreeRow(t)}if("Enter"===e.key)return this.handleRowOpen({target:e.currentTarget},t);if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&!e.altKey&&!e.metaKey&&!e.ctrlKey){const n=this.keyboardRows(),s=n.findIndex(e=>String(e?.id??e?.value)===String(t?.id??t?.value)),i={ArrowDown:s+1,ArrowUp:s-1,Home:0,End:n.length-1}[e.key];return s>=0&&i>=0&&i<n.length&&i!==s&&(e.preventDefault?.(),this.focusRow(this.getRowKey(n[i],i),{reveal:!0})),this}if(" "===e.key||"Spacebar"===e.key){e.preventDefault?.();const n=!0!==t?.select?.component?.props?.checked;return this.applyRowSelection(t?.id,n,{range:!0===e.shiftKey})}return this}clearSelection(){return this._selectionAnchorId=null,this.set({settingsChecked:!1,selectIndeterminate:!1}),this.getSelectedRecordIds().length?(this.updateRows(e=>({...e,selected:!1,checked:!1,select:this.getDefaultRowCell(this.TABLE_SELECT_COLUMN,{...e,selected:!1,checked:!1})}),"select-clear"),{outcome:"applied"}):{outcome:"applied"}}sfPortInput(e,t,n={}){if(!Object.hasOwn(M.inputs,e))throw new TypeError(`sf-view-table has no input port ${String(e)}`);const s=j(t),i=Number.isSafeInteger(n?.sequence)&&n.sequence>this._querySequence?n.sequence:this._querySequence+1;this._routeContext=Object.freeze({record_ids:s}),this._querySequence=i,this.clearSelection(),this.requestContextQuery(i)}requestContextQuery(e){return this._pendingQuerySequence=e,this._abandonedQuery=!1,this.setDataState("loading"),this.emitTableEvent("query",Object.freeze({reason:"context",context:this._routeContext,sequence:e}))}onConnected(){if(super.onConnected(),!this._lateLayoutAbort){this._lateLayoutAbort=new AbortController;const e=this._lateLayoutAbort.signal,t=()=>{this._lateLayoutFrame||(this._lateLayoutFrame=requestAnimationFrame(()=>{this._lateLayoutFrame=0,this.isConnected&&this.measureContentWidths()&&this.widthsChanged()}))};document.fonts?.addEventListener?.("loadingdone",t,{signal:e}),document.fonts?.ready?.then?.(()=>{e.aborted||t()}),document.addEventListener("load",e=>{"link"===e.target?.localName&&/stylesheet/u.test(e.target.rel)&&t()},{capture:!0,signal:e})}"undefined"==typeof ResizeObserver||this._responsiveObserver||(this._responsiveObserver=new ResizeObserver(([e])=>{const t=Math.floor(e.contentRect.width);t>0&&t!==this._responsiveWidth&&(this._responsiveWidth=t,this.requestComponentUpdate("responsive-columns")),this.measurePinnedColumns()}),this._observeResponsiveBox()),this._abandonedQuery&&this._routeContext&&(this._querySequence+=1,this.requestContextQuery(this._querySequence))}applyQueryResult(e,t){return this.isActionParameters?.(e,["sequence","rows"])&&({sequence:e,rows:t}=e),Number.isSafeInteger(e)&&e===this._pendingQuerySequence&&Array.isArray(t)?(this._pendingQuerySequence=null,this.setRows(t),this.setDataState("auto"),{outcome:"applied"}):{outcome:"refused",reason:"stale"}}getQueryContext(){return this._routeContext}getItemRef(e){return this.refs.items.has(e)||this.refs.items.set(e,this.createRef()),this.refs.items.get(e)}setIndeterminate(){return this.state.data.rows.filter(e=>e.select.component.props.checked).length}getTableData(){const e=this.state?.data;return e&&"object"==typeof e?e:{columns:[],rows:[]}}isContextMenuEvent(e){const t=e?.target;if(!(t instanceof Node))return!1;const n=this._portalContainer;if(n instanceof Node&&(n===t||n.contains(t)))return!0;const s=this.refs?.contextMenu?.value;return s instanceof Node&&(!(s!==t&&!s.contains(t))||(e.composedPath?.().includes(s)||!1))}contextEvent(e){this.isContextMenuEvent(e)||(this.tempSettings=null,this.closeContextMenu(!1))}splitItemsByColumns(e=[],t=1){const n=Array.isArray(e)?e:[],s=Math.max(1,Number(t)||1),i=Math.ceil(n.length/s);return i?Array.from({length:s},(e,t)=>n.slice(t*i,(t+1)*i)).filter(e=>e.length):[]}getPendingFilterState(e=this.state?.filter||{}){const t=this.tempSettings?.filter||{},n=Object.prototype.hasOwnProperty.call(t,"selectedTemplateKey");return{...e,...t,selectedTemplateKey:n?t.selectedTemplateKey:e.selectedTemplateKey,templates:t.templates||e.templates||[]}}getSortedFilterTemplates(e=this.state?.filter||{}){return this.getFilterTemplates(e).map((e,t)=>({...e,sourceIndex:t,order:"number"==typeof e.order?e.order:t})).sort((e,t)=>Boolean(e.pinned)!==Boolean(t.pinned)?e.pinned?-1:1:e.order!==t.order?e.order-t.order:e.sourceIndex-t.sourceIndex)}changeTempFilterTemplateSettings(e,t={}){if(!e)return;const n=this.getPendingFilterState(),s=this.getFilterTemplates(n).map(n=>{for(const[s,i]of Object.entries(t))n[s]=e===n.key?i:!i;return n});this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},selectedTemplateKey:n.selectedTemplateKey,templates:s}},this.requestComponentUpdate("temp-filter-template")}patchTempFilterTemplateSettings(e,t={}){if(!e)return;const n=this.getPendingFilterState(),s=this.getFilterTemplates(n).map(n=>n.key===e?{...n,..."function"==typeof t?t(n):t}:n);this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},selectedTemplateKey:n.selectedTemplateKey,templates:s}},this.requestComponentUpdate("temp-filter-template")}selectTempFilterTemplate(e){if(!e)return;const t=this.getPendingFilterState(),n=this.getFilterTemplates(t).map(t=>({...t,selected:t.key===e}));this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},selectedTemplateKey:e,templates:n}},this.requestComponentUpdate("temp-filter-template")}normalizeFilterTemplate(e={},t=0){const n=e.key||`filter_template_${t+1}`,s=e.data&&"object"==typeof e.data?e.data:{};return{...e,key:n,label:e.label||s.template_name||n,data:{...s,values:{...s.values||{}},tags:{...s.tags||{}}}}}getFilterTemplates(e=this.state?.filter||{}){const t=(e.templates||[]).map((e,t)=>this.normalizeFilterTemplate(e,t));return t.length?t:[this.normalizeFilterTemplate({key:e.selectedTemplateKey||"default",label:this.text("defaultTemplateText"),selected:!0,order:0,data:{}})]}getFilterTemplateByKey(e,t=this.state?.filter||{}){return e&&t&&this.getFilterTemplates(t).find(t=>t.key===e)||null}getSelectedFilterTemplate(e=this.state?.filter||{}){const t=this.getFilterTemplates(e);if(Object.prototype.hasOwnProperty.call(e,"selectedTemplateKey")&&""===e.selectedTemplateKey)return null;const n=e.selectedTemplateKey||t.find(e=>e.selected)?.key||t[0]?.key||"";return this.getFilterTemplateByKey(n,{...e,templates:t})||t[0]||null}getCurrentFilterValues(e=this.state?.filter||{}){const t=this.getSelectedFilterTemplate(e);return{...t?.data?.values||{}}}getCurrentFilterTags(e=this.state?.filter||{}){const t=this.getSelectedFilterTemplate(e);return{...t?.data?.tags||{}}}normalizeFilterDataForCompare(e){return Array.isArray(e)?e.map(e=>this.normalizeFilterDataForCompare(e)):e&&"object"==typeof e?Object.keys(e).sort().reduce((t,n)=>({...t,[n]:this.normalizeFilterDataForCompare(e[n])}),{}):e}isSameFilterData(e,t){return JSON.stringify(this.normalizeFilterDataForCompare(e||{}))===JSON.stringify(this.normalizeFilterDataForCompare(t||{}))}getMergedFilterDraftData(e=this.state?.filter||{},t=this.tempSettings?.filter||{}){const n=this.getPendingFilterState({...e,selectedTemplateKey:Object.prototype.hasOwnProperty.call(t,"selectedTemplateKey")?t.selectedTemplateKey:e.selectedTemplateKey,templates:t.templates||e.templates||[]}),s=this.getCurrentFilterTags(n),i=this.getCurrentFilterValues(n),r=t.replaceTags?{...t.tags||{}}:{...s,...t.tags||{}},a=t.replaceValues?{...t.values||{}}:{...i,...t.values||{}};return Object.entries(t.values||{}).forEach(([e,t])=>{this.isEmptyFilterEntry(t)&&(delete a[e],delete r[e])}),{filter:n,tags:r,values:a}}hasPendingFilterDataChanges(e=this.state?.filter||{}){const t=this.tempSettings?.filter;if(!t||!Object.prototype.hasOwnProperty.call(t,"tags")&&!Object.prototype.hasOwnProperty.call(t,"values")&&!t.replaceTags&&!t.replaceValues)return!1;const n=this.getMergedFilterDraftData(e,t);return!this.isSameFilterData(this.getCurrentFilterTags(n.filter),n.tags)||!this.isSameFilterData(this.getCurrentFilterValues(n.filter),n.values)}countPendingFilterConditionChanges(e=this.state?.filter||{}){const t=this.tempSettings?.filter;if(!t)return 0;const n=this.getMergedFilterDraftData(e,t),s={tags:this.getCurrentFilterTags(n.filter),values:this.getCurrentFilterValues(n.filter)},i=(e,t)=>this.isSameFilterData(e,t),r=new Set([...Object.keys(s.tags||{}),...Object.keys(n.tags||{}),...Object.keys(s.values||{}),...Object.keys(n.values||{})]);let a=0;for(const e of r){Boolean((s.tags||{})[e]?.active)===Boolean((n.tags||{})[e]?.active)?i((s.values||{})[e],(n.values||{})[e])||(a+=1):a+=1}return a}hasUnsavedFilterDataChanges(){return Boolean(this.state?.filterDataDirty&&this.getSelectedFilterTemplate(this.state?.filter||{}))}saveCurrentFilterTemplateData(){const e=this.getSelectedFilterTemplate(this.state?.filter||{});return e?this.set({filterDataDirty:!1},()=>{this.dispatchFilterTemplateSave(e.key,this.state.filter,this.getFilterTemplateByKey(e.key))}):this}mergeObjectDeep(e={},t={}){return Object.entries(t||{}).reduce((e,[t,n])=>{const s=e[t],i=n&&"object"==typeof n&&!Array.isArray(n)&&s&&"object"==typeof s&&!Array.isArray(s);return{...e,[t]:i?this.mergeObjectDeep(s,n):n}},{...e||{}})}patchFilterTemplateByKey(e,t=this.state.filter,n={}){if(!e||!t)return{filter:t,template:null};let s=null;return{filter:{...t,templates:this.getFilterTemplates(t).map(t=>{if(e!==t.key)return t;const i="function"==typeof n?n(t):n;return s=this.mergeObjectDeep(t,i),s})},template:s}}createFilterTemplatePatchState(e,t={}){const n={filter:e};return Object.prototype.hasOwnProperty.call(t,"saveInputValue")&&(n.saveInputValue=t.saveInputValue),n}getActiveFilterFieldKeys(e=this.state?.filter||{}){const t=this.getCurrentFilterTags(e),n=this.getFilterFields().map(e=>e?.key),s=Object.keys(t).filter(e=>t[e]?.active);return[...n.filter(e=>s.includes(e)),...s.filter(e=>!n.includes(e))]}setActiveFilterFields(e=[],t=this.state?.filter||{}){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||!e.trim()))throw new TypeError("Filter field keys must be nonempty strings");const n=this.getSelectedFilterTemplate(t);if(!n?.key)return this;const s=this.getFilterFields(),i=this.getCurrentFilterTags(t),r={};for(const e of Object.keys(i))r[e]={...i[e],active:!1};for(const t of e){const e=s.find(e=>e?.key===t);r[t]={...i[t]||{},active:!0,label:e?.label??i[t]?.label??t,control:e?.filter?.control||e?.type||e?.dataType||i[t]?.control||"text"}}const a=this.patchFilterTemplateByKey(n.key,t,e=>({...e,data:{...e.data||{},tags:r}}));return this.set({filter:a.filter})}withFilterFieldSettings(e,t=this.state?.filter||{}){if(Array.isArray(e))return e.map(e=>this.withFilterFieldSettings(e,t));if(!e||"object"!=typeof e)return e;const n=Array.isArray(e.data?.tags)?[]:Object.keys(e.data?.tags||{}).filter(t=>e.data.tags[t]?.active);return{...e,settings:{...e.settings||{},filter_fields:n.length?n:this.getActiveFilterFieldKeys(t)}}}dispatchFilterTemplateSave(e,t,n=null){const s=this.withFilterFieldSettings(n||this.getFilterTemplateByKey(e,t),t);return this.emitTableEvent("template-save",s),this}getChangedFilterTemplates(e={},t={},n=[]){const s=new Map(this.getFilterTemplates(e).map(e=>[e.key,e]));return this.getFilterTemplates(t).filter(e=>{const t=s.get(e.key);return!t||n.some(n=>!Object.is(t[n],e[n]))})}dispatchFilterTemplatesSave(e=[]){const t=e.filter(e=>e?.key);if(!t.length)return this;const n=this.withFilterFieldSettings(1===t.length?t[0]:t);return this.emitTableEvent("template-save",n),this}saveFilterTemplatePatch(e,t={},n={},s=this.state.filter){if(!e||!s)return this;const i=this.patchFilterTemplateByKey(e,s,t),r={...i.filter,...n.filterPatch||{}};return this.set(()=>this.createFilterTemplatePatchState(r,n),()=>{!1!==n.dispatch&&this.dispatchFilterTemplateSave(e,r,i.template)})}setDefaultFilterTemplate(e){return e?this.set(t=>{const n=t.filter||{};return{filter:{...n,templates:this.getFilterTemplates(n).map(t=>({...t,default:t.key===e}))}}}):this}patchFilterTemplateData(e={},t={}){const n={...e};delete n.tags,delete n.values;const s=this.getFilterTemplates(n),i=this.getSelectedFilterTemplate({...n,templates:s});if(!i)return{...n,templates:s};const r=Object.prototype.hasOwnProperty.call(t,"values")?t.values||{}:i.data?.values||{},a=Object.prototype.hasOwnProperty.call(t,"tags")?t.tags||{}:i.data?.tags||{},o=s.map(e=>e.key===i.key?{...e,data:{...e.data||{},...t.data||{},values:r,tags:a}}:e);return{...n,selectedTemplateKey:i.key,templates:o}}getFilterPayload(e=this.state?.filter||{}){const t=this.getSelectedFilterTemplate(e);return{...t?.data||{},templateKey:t?.key||"",templateLabel:t?.label||"",values:this.getCurrentFilterValues(e),tags:this.getCurrentFilterTags(e)}}selectFilterTemplate(e){return e&&this.state?.filter?.selectedTemplateKey!==e?(this.set(t=>{const n={...t.filter||{},selectedTemplateKey:e,templates:(t.filter?.templates||[]).map(t=>({...t,selected:t.key===e}))},s=this.getFilterTemplateByKey(e,n)||n.templates[0]||null;return{filter:n,saveInputValue:s?.label||""}}),this):this}static reorderedKeys(e,t,n){const s=[...e.querySelectorAll("[data-sf-sortable-item]")].filter(t=>t.closest("sf-sortable")===e).map(e=>e.getAttribute("data-sf-sortable-item")).filter(e=>e!==t);return s.splice(Math.max(0,Math.min(n,s.length)),0,t),s}onFilterTemplateIntent(e){const t=e.target,{item:n,index:s}=e.detail??{};if(!(t instanceof Element&&n))return;const i=J.reorderedKeys(t,n,s),r="pinned"===t.getAttribute("data-group")?"pinned":"normal",a={pinned:new Map,normal:new Map};i.forEach((e,t)=>a[r].set(e,t)),this.syncFilterTemplateOrder(a)}onColumnSettingsIntent(e){const t=e.target,{item:n,index:s}=e.detail??{};if(!(t instanceof Element&&n))return;const i="pinned"===t.getAttribute("data-group"),r=J.reorderedKeys(t,n,s),a=r.indexOf(n),o=this.getColumnItems().filter(e=>e?.key&&!e.system),l=o.filter(e=>this.isColumnPinned(e)===i).map(e=>e.key).filter(e=>e!==n),c=r[a+1],u=r[a-1];let d=void 0!==c?l.indexOf(c):-1;-1===d&&(d=void 0!==u?l.indexOf(u)+1:l.length),l.splice(-1===d?l.length:d,0,n);const h=o.filter(e=>this.isColumnPinned(e)!==i).map(e=>e.key);(i?[...l,...h]:[...h,...l]).forEach((e,t)=>this.patchTempColumnSettings(e,{order:10*(t+1)})),this.requestComponentUpdate("column-order"),this.commitColumnSettings("column-order")}syncFilterTemplateOrder(e){const t=this.getPendingFilterState(),n=this.getFilterTemplates(t).map((t,n)=>{const s=t.pinned?"pinned":"normal",i=e[s].get(t.key);return"number"!=typeof i?t:{...t,order:i,sourceIndex:n}});this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},selectedTemplateKey:t.selectedTemplateKey,templates:n.sort((e,t)=>Boolean(e.pinned)!==Boolean(t.pinned)?e.pinned?-1:1:e.order!==t.order?e.order-t.order:e.sourceIndex-t.sourceIndex)}},this.requestComponentUpdate("temp-filter-template-order")}get columnsAreCramped(){if(this._layoutReads?.has("cramped"))return this._layoutReads.get("cramped");const e=this.readColumnsAreCramped();return this._layoutReads?.set("cramped",e),e}readColumnsAreCramped(){const e=this.refs.scroll?.value?.clientWidth||this._responsiveWidth;if(!e)return!1;const t=(this.getColumns?.()??[]).filter(e=>this.columnTakesFloor(e));if(!t.length)return!1;const n=this.querySelector(".sf-table")??this,s=globalThis.getComputedStyle?.(n)?.getPropertyValue("--sf-table--column-min-inline-size")?.trim();if(!s)return!1;const i=Number.parseFloat(globalThis.getComputedStyle?.(document.documentElement)?.fontSize)||16,r=s.endsWith("rem")?Number.parseFloat(s)*i:Number.parseFloat(s);if(!Number.isFinite(r)||r<=0)return!1;return e-[...this.querySelectorAll("thead th")].filter(e=>!t.some(t=>t.key===e.dataset.key)).reduce((e,t)=>e+("actions"===t.dataset.key?Math.min(t.getBoundingClientRect().width,r):t.getBoundingClientRect().width),0)<t.length*r}get isList(){const e=this.getProp?.("layout")??"table";if("list"===e)return!0;if("table"===e)return!1;const t=Number(this.getProp?.("listBelow"))||600;return this._responsiveWidth>0&&this._responsiveWidth<t}get actionsColumnWidth(){const e=(this.ACTIONS_SETTINGS_ROW??[]).filter(e=>!1!==e?.inline).length;return e?`calc(${e} * (var(--sf-text-height-1) + var(--sf-ui-1--space-y-tightness-default) * 2) + ${e-1} * var(--sf-space-1\\/3) + var(--sf-b6))`:""}measureContentWidths(){const e=this.refs.table?.value;if(!(e instanceof HTMLTableElement&&e.isConnected))return!1;if(this._columnResizeState||this.columnDragActive)return!1;if(e.querySelector("tbody[data-state]")||e.querySelector("tbody[data-busy]")||!e.querySelector("tbody tr td"))return!1;const t=new Map;let n=0;const s=this.columnWidthCap(),i=e.parentElement?.clientWidth??0,r=new Map;for(const t of e.querySelectorAll("thead th[data-key]"))O.has(t.dataset.key)&&r.set(t,Math.ceil(t.getBoundingClientRect().width));if(e.classList.add("sf-table-measuring"),"auto"!==getComputedStyle(e).tableLayout)return e.classList.remove("sf-table-measuring"),!1;try{n=e.getBoundingClientRect().width;for(const n of e.querySelectorAll("thead th[data-key]")){const e=n.dataset.key;O.has(e)||t.set(e,U(n.getBoundingClientRect().width))}}finally{e.classList.remove("sf-table-measuring")}let a=0;for(const n of e.querySelectorAll("thead th[data-key]")){const e=n.dataset.key;a+=O.has(e)?r.get(n)??0:Math.min(t.get(e)??0,s)}const o=a!==(this._contentInlineSize??0);this._contentInlineSize=a;const l=i>0&&n>0&&n<i,c=l!==Boolean(this._contentSurplus);this._contentSurplus=l,this.remeasureWhenDrawn(e);const u=this._contentWidths??new Map,d=t.size!==u.size||[...t].some(([e,t])=>Math.abs((u.get(e)??0)-t)>2);return d&&(this._contentWidths=t),d||c||o}fitCellValues(){const e=new Set;for(const t of this.querySelectorAll("tbody .sf-table-cell-values > :not(.sf-table-cell-more)"))!t.localName.includes("-")||customElements.get(t.localName)&&W(t).getBoundingClientRect().width||e.add(t.localName);if(e.size&&(this._fitRetries??0)<3){this._fitRetries=(this._fitRetries??0)+1;const t=this._fitToken=(this._fitToken??0)+1;Promise.all([...e].map(e=>customElements.whenDefined(e))).then(()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))).then(()=>{t===this._fitToken&&this.isConnected&&this.fitCellValues()})}else e.size||(this._fitRetries=0);const t=[];for(const e of this.querySelectorAll("tbody .sf-table-cell-values")){const n=e.querySelector(":scope > .sf-table-cell-more"),s=[...e.children].filter(e=>e!==n),i=s.map(e=>W(e));t.push({box:e,more:n,items:s,valueBoxes:i})}for(const{more:e,valueBoxes:n}of t){for(const e of n)e.classList.remove("sf-table-cell-folded");e&&(e.hidden=!0,e.removeAttribute("title"))}const n=t.filter(({box:e,more:t})=>t&&e.scrollWidth>e.clientWidth+1);for(const{box:e,more:t,items:s,valueBoxes:i}of n){t.hidden=!1,t.textContent=`+${s.length}`;const n=[];for(let r=s.length-1;r>0&&e.scrollWidth>e.clientWidth+1;r-=1)i[r].classList.add("sf-table-cell-folded"),n.unshift(s[r]),t.textContent=`+${n.length}`;n.length?t.title=n.map(e=>e.textContent.trim()).filter(Boolean).join(", "):t.hidden=!0}}measureWhenCellsDrawn(){const e=this.refs.table?.value;if(!(e instanceof HTMLTableElement)||this._columnResizeState||this.columnDragActive)return!1;if(e.querySelector("tbody[data-state]")||e.querySelector("tbody[data-busy]"))return!1;const t=[];for(const n of e.querySelectorAll("tbody td *"))if(n.localName.includes("-")){if(!customElements.get(n.localName)||"function"!=typeof n.whenRendered)return!1;if(n.hasAttribute("data-sf-style-pending"))return!1;!0!==n.isRendered&&t.push(n)}if(!t.length)return!1;const n=this._cellsDrawnToken=(this._cellsDrawnToken??0)+1,s=new Promise(e=>requestAnimationFrame(e));return Promise.race([Promise.all(t.map(e=>e.whenRendered())),s]).catch(()=>{}).then(()=>{n===this._cellsDrawnToken&&this.isConnected&&(this.measureContentWidths()&&this.applyColumnWidths(),this._contentRetries=0,this.fitCellValues(),this.measurePinnedColumns(),this.hasAttribute("data-sf-page-scroll")&&this.syncRail())}),!0}remeasureWhenDrawn(e){const t=new Set;for(const n of e.querySelectorAll("tbody td *"))n.localName.includes("-")&&(customElements.get(n.localName)&&n.childElementCount||t.add(n.localName));if(!t.size)return void(this._remeasureTries=0);if((this._remeasureTries??0)>=3)return;this._remeasureTries=(this._remeasureTries??0)+1;const n=this._remeasureToken=(this._remeasureToken??0)+1,s=[...e.querySelectorAll("tbody td *")].filter(e=>t.has(e.localName)&&"function"==typeof e.whenRendered);[...t].every(e=>customElements.get(e))&&s.length?Promise.all(s.map(e=>!0===e.isRendered?null:e.whenRendered())).then(()=>{n===this._remeasureToken&&this.isConnected&&this.measureContentWidths()&&this.widthsChanged()}):Promise.all([...t].map(e=>customElements.whenDefined(e))).then(()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))).then(()=>{n===this._remeasureToken&&this.isConnected&&this.measureContentWidths()&&this.widthsChanged()})}widthsChanged(){this.applyColumnWidths(),this.fitCellValues(),this.measurePinnedColumns(),this.hasAttribute("data-sf-page-scroll")&&this.syncRail()}applyColumnWidths(){const e=this.refs.table?.value;if(!(e instanceof HTMLTableElement))return;const t=new Map((this.getColumns?.()??[]).map(e=>[String(e?.key),e])),n=[...e.querySelectorAll(":scope > colgroup > col[data-key]")],s=this.readingLayout(()=>n.map(e=>{const n=t.get(e.dataset.key);return n?(0,u.Y5)(this,n):null}));n.forEach((e,t)=>{const n=s[t];null!==n&&(e.getAttribute("style")??"")!==n&&(n?e.setAttribute("style",n):e.removeAttribute("style"))}),e.classList.toggle("sf-table-content-sized",this.hasContentWidths),e.classList.toggle("w-max",!this.hasContentWidths),this.hasContentWidths&&this._contentInlineSize?e.style.setProperty("--sf-table--content-inline-size",`${this._contentInlineSize}px`):e.style.removeProperty("--sf-table--content-inline-size")}contentWidth(e){const t=this._contentWidths?.get(e?.key);return t?e?.key===this.spareRoomColumnKey()?"":`${Math.min(t,this.columnWidthCap())}px`:""}spareRoomColumnKey(){const e=this.getColumns?.()??[];for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n?.key&&!O.has(n.key))return n.colWidth??n.width??n.size?null:n.key}return null}get hasContentWidths(){return Boolean(this._contentWidths?.size)}readingLayout(e){if(this._layoutReads)return e();this._layoutReads=new Map;try{return e()}finally{this._layoutReads=null}}columnWidthCap(){if(this._layoutReads?.has("cap"))return this._layoutReads.get("cap");const e=this.readColumnWidthCap();return this._layoutReads?.set("cap",e),e}readColumnWidthCap(){const e=getComputedStyle(this).getPropertyValue("--sf-table--column-max-inline-size").trim(),t=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,n=Number.parseFloat(e);return!Number.isFinite(n)||n<=0?320:e.endsWith("rem")?n*t:n}columnTakesFloor(e){return!(!e?.key||O.has(e.key))&&!(e.colWidth??e.width??e.size??e.min_width??e.minWidth)}settingsColumnHasUse(e=this.getPropsContext()){return!1!==e.settingsMenu||(!0===e.rowReorder||(this.ACTIONS_SETTINGS_ROW??[]).length>0)}getSystemColumns(){const e=[],t=this.getPropsContext();return t.selectable&&e.push(this.getSelectColumn()),t.settings&&this.settingsColumnHasUse(t)&&e.push(this.TABLE_SETTINGS_COLUMN),t.actions&&t.rowActions&&this.state.actionActive&&e.push(this.TABLE_ACTIONS_COLUMN),e}setTemplates(e){const t=Object.values(e||{}).map((e,t)=>this.normalizeFilterTemplate(e,t));return this.set(e=>{const n=e.filter||{},s=new Map;this.getFilterTemplates(n).forEach(e=>{s.set(e.key,e)}),t.forEach(e=>{s.set(e.key,{...s.get(e.key)||{},...e})});const i=Array.from(s.values()),r=Object.prototype.hasOwnProperty.call(n,"selectedTemplateKey"),a=i.find(e=>!0===e.default),o=t.find(e=>e?.selected)?.key,l=a?.key||i[0]?.key||"",c=this._filterTemplatesLoaded?o??(r?n.selectedTemplateKey:l):o??l,u={...n,selectedTemplateKey:c,templates:i.map(e=>({...e,selected:e.key===c}))},d=""===c?null:this.getFilterTemplateByKey(c,{...u,templates:i})||i[0]||null;return this._filterTemplatesLoaded=!0,{filter:u,saveInputValue:d?.label||""}})}getInstanceId(){return this.id||this._instanceId}getColumnResizerId(e){return`${this.getInstanceId()}--column-resizer--${e}`}getTableSettingsKey(){return this.tableSettingsKey||this.getAttribute?.("table-settings-key")||this.id||this.getInstanceId()}normalizeTableSettings(e={},t=this.getTableSettingsKey()){const n=!e?.tableSettings||"object"!=typeof e.tableSettings||Array.isArray(e.tableSettings)||e.tableSettings.columnSettings?null:e.tableSettings,s=e?.item||n?.[t]||e?.tableSettings||e?.settings||e||{},i=s?.columnSettings||e?.columnSettings||{};return{...s,columnSettings:i&&"object"==typeof i&&!Array.isArray(i)?i:{}}}setTableSettings(e={},t="table-settings-load",n=this.getTableSettingsKey()){const s=this.normalizeTableSettings(e,n);return this.setColumnSettings(s.columnSettings,t,!1)}getContextMenuLabel(e={}){switch(e.menu||e.type){case"filter-favorites":return this.text("contextSaveTemplateLabel");case"filter-settings":return this.text("contextFilterSettingsLabel");case"filter-template-actions":return`${this.text("contextTemplateActionsLabel")}: ${e.template?.label||e.template?.key||""}`.trim();case"tag-settings":{const t=e.fieldKey||"",n=this.getFilterField(t),s=n?.label||this.getCurrentFilterTags()?.[t]?.label||t;return`${this.text("contextFieldFilterLabel")}: ${s||this.text("fieldWordText")}`}case"row-settings":return this.text("contextRowActionsLabel");case"create":return this.text("contextCreateOptionsLabel");case"list-sort":return this.text("sortLabel");case"toolbar-actions":return this.text("contextViewActionsLabel");default:return this.text("contextTableSettingsLabel")}}renderFilterFavoritesContextMenu(e){const{x:t,y:n,position:s}=e,i=this.getSelectedFilterTemplate();return f.html`
|
|
624
|
+
<sf-menu-context
|
|
625
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
626
|
+
:key=${t+n+this._renderToken}
|
|
627
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"filter-favorites"})}
|
|
628
|
+
style="
|
|
629
|
+
position: fixed;
|
|
630
|
+
left: ${t}px;
|
|
631
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
632
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
633
|
+
"
|
|
634
|
+
root-class="sf-table-context-menu ${"1/2"===this.size?"sf-table-context-menu--dense ":""}flex flex-col"
|
|
635
|
+
data-context-main-menu
|
|
636
|
+
position="${s||""}"
|
|
637
|
+
>
|
|
638
|
+
<div class="flex flex-col flex-1 gap-2" slot="content">
|
|
639
|
+
<div class="sf-table-context-top"><span class="sf-text-2 bold">Сохранение шаблона</span></div>
|
|
640
|
+
<div class="sf-table-context-main">
|
|
641
|
+
<form ${(0,g.ref)(this.refs.templateForm)} id="save_template" class="flex flex-col gap-1/2">
|
|
642
|
+
<sf-input
|
|
643
|
+
size=${this.size}
|
|
644
|
+
appearance="filled"
|
|
645
|
+
placeholder="${this.text("templateNamePlaceholder")}"
|
|
646
|
+
value="${this.state.saveInputValue}"
|
|
647
|
+
name="template_name"
|
|
648
|
+
@change=${e=>{this.set({saveInputValue:e.target.value})}}
|
|
649
|
+
@input=${e=>{this.set({saveInputValue:e.target.value})}}
|
|
650
|
+
></sf-input>
|
|
651
|
+
<div class="flex flex-col gap-1/2">
|
|
652
|
+
<sf-checkbox size=${this.size}
|
|
653
|
+
name="template_default"
|
|
654
|
+
position="end"
|
|
655
|
+
root-class="content-main-between"
|
|
656
|
+
value="1"
|
|
657
|
+
?checked=${i.data.template_default}
|
|
658
|
+
label="${this.text("makeDefaultLabel")}"
|
|
659
|
+
></sf-checkbox>
|
|
660
|
+
<sf-checkbox size=${this.size}
|
|
661
|
+
name="template_save_for_all"
|
|
662
|
+
position="end"
|
|
663
|
+
root-class="content-main-between"
|
|
664
|
+
value="1"
|
|
665
|
+
?checked=${i.data.template_save_for_all}
|
|
666
|
+
label="${this.text("saveForEveryoneLabel")}"
|
|
667
|
+
></sf-checkbox>
|
|
668
|
+
</form>
|
|
669
|
+
</div>
|
|
670
|
+
</div>
|
|
671
|
+
<div class="sf-table-context-bottom sf-context-menu-footer">
|
|
672
|
+
<sf-button size=${this.size} @click="${()=>{this.tempSettings=null,this.requestComponentUpdate("table")}}" appearance="outline" scheme="on-surface" root-class="flex-1"
|
|
673
|
+
text="${this.text("resetText")}"></sf-button>
|
|
674
|
+
<sf-button size=${this.size}
|
|
675
|
+
?disabled=${0===this.state.saveInputValue.length}
|
|
676
|
+
@click="${()=>{this.saveFilterTemplate()}}" root-class="flex-1" text="${this.text("applyText")}"></sf-button>
|
|
677
|
+
</div>
|
|
678
|
+
</div>
|
|
679
|
+
</sf-menu-context>
|
|
680
|
+
`}saveFilterTemplate(){const e=this.refs.templateForm.value;if(!e)return!1;const t=Object.fromEntries(new FormData(e)),{templates:n}=this.state.filter,s=n.filter(e=>e.label===t.template_name)?.[0],i=this.getCurrentFilterValues(),r=this.getCurrentFilterTags();let a={key:s?s.key:`filter_template_${n.length+1}`,label:t.template_name,selected:!0,data:{...t,values:i,tags:r}};const o=this.withFilterFieldSettings(a);this.emitTableEvent("template-save",o),this.tempSettings=null,this.closeContextMenu()}renderRowSettingsContextMenu(e){const{x:t,y:n,position:s,transform:i,items:r=this.getActionRowItems(e.row||{}).map(e=>({component:"sf-button",props:{appearance:"link",scheme:"on-surface",text:e.name,"@click":t=>{const n=e.component.props["@click"]||e.component.props.onClick;n?.(t),this.closeContextMenu()}}}))}=e;let a=`translateY(calc(${void 0!==i?i:-50}%))`;if(s)switch(s){case"left-bottom":case"right-bottom":a=`translateY(calc(${void 0!==i?i:-100}% + var(--sf-context-menu-tail-corner-offset)))`}return f.html`
|
|
681
|
+
<sf-menu-context
|
|
682
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
683
|
+
:key=${t+n}
|
|
684
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"row-settings"})}
|
|
685
|
+
style="
|
|
686
|
+
position: fixed;
|
|
687
|
+
left: calc(${t}px + var(--sf-context-menu-tail-corner-offset));
|
|
688
|
+
inset-block-start: ${n}px;
|
|
689
|
+
transform: ${a};
|
|
690
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
691
|
+
"
|
|
692
|
+
.entries=${r.map((e,t)=>{const n=e.props||e.component?.props||{};return{id:String(t),text:n.text??e.name??"",icon:n.iconLeft??n.iconStart??n.icon??void 0,danger:"error"===n.scheme||!0===e.danger,disabled:Boolean(n.disabled)}})}
|
|
693
|
+
@sf-menu-context-select=${e=>{const t=r[Number(e.detail?.id)],n=t?.props||t?.component?.props||{},s=n["@click"]??n.onClick;"function"==typeof s&&s({currentTarget:e.target,target:e.target,preventDefault(){},stopPropagation(){}}),this.closeContextMenu()}}
|
|
694
|
+
position="${s||"left"}"
|
|
695
|
+
>
|
|
696
|
+
</sf-menu-context>
|
|
697
|
+
`}getColumnItems(){const e=this.getTableData().columns||[],t=new Map(e.map((e,t)=>[e?.key,t])),n=e=>{const n=e?.order;return null!=n&&""!==n&&Number.isFinite(Number(n))?Number(n):t.get(e?.key)??0};return e.map(e=>{const t=this.getColumnSetting(e?.key),n={...e,...t};return t.width&&(n.colWidth=t.width),n}).sort((e,s)=>{const i=e=>this.isColumnPinned(e)?0:this.isColumnVisible(e)?1:2,r=i(e),a=i(s);if(r!==a)return r-a;const o=n(e),l=n(s);return o===l?(t.get(e.key)??0)-(t.get(s.key)??0):o-l})}isColumnVisible(e){if(!e?.key)return!1;const t=this.tempSettings?.cols?.[e.key],n=this.getColumnSetting(e.key)||{};return t?.visible??n.visible??!1!==e.visible}getColumnSettings(){const e=this.getTableData().columnSettings,t=this.state?.columnSettings,n=this._columnSettingsMemo;if(n&&n.data===e&&n.state===t)return n.value;const s=this.mergedColumnSettings(e,t);return this._columnSettingsMemo={data:e,state:t,value:s},s}mergedColumnSettings(e,t){return{...e&&"object"==typeof e&&!Array.isArray(e)?e:{},...t&&"object"==typeof t&&!Array.isArray(t)?t:{}}}getColumnSetting(e){if(!e)return{};const t=this.getColumnSettings()?.[e];return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}normalizeColumnSetting(e={}){const t={};return Object.entries(e||{}).forEach(([e,n])=>{void 0!==n&&("colWidth"!==e?t[e]=n:t.width=n)}),void 0!==t.order&&null!==t.order&&""!==t.order&&(t.order=Number(t.order)),t}mergeColumnSettings(e={},t={}){const n={...e||{}};return Object.entries(t||{}).forEach(([e,t])=>{e&&t&&"object"==typeof t&&(n[e]=this.normalizeColumnSetting({...n[e]||{},...t}))}),n}requestColumnSettingsReset(){if(this.viewPreferenceKey){const{columnSettings:e,widths:t,...n}=C()?.read(this.viewPreferenceKey)??{};C()?.write(this.viewPreferenceKey,n)}return this.emitTableEvent("column-settings-reset",Object.freeze({target:"personal",tableSettingsKey:this.getTableSettingsKey?.()??null}))}emitColumnSettingsChange(e="column-settings"){"preferences"!==e&&this.viewPreferenceKey&&this.writeTablePreference(this.viewPreferenceKey,{columnSettings:this.getColumnSettings()});const t={reason:e,columnSettings:this.getColumnSettings(),tableSettingsKey:this.getTableSettingsKey()};return this.emitTableEvent("save",{kind:"columns",...t}),this}setColumnSettings(e={},t="column-settings",n=!0){const s="function"==typeof e?e(this.getColumnSettings()):e;return this.set({columnSettings:s&&"object"==typeof s?s:{}},t,()=>!!n&&this.emitColumnSettingsChange(t))}patchColumnSettings(e,t={},n="column-settings"){if(!e)return this;const s=this.getColumnSetting(e),i="function"==typeof t?t(s):t;return this.patchColumnSettingsBatch({[e]:i||{}},n)}patchColumnSettingsBatch(e={},t="column-settings"){const n=this.getColumnSettings(),s=this.mergeColumnSettings(n,e);return JSON.stringify(n)===JSON.stringify(s)?this:this.setColumnSettings(s,t)}getFilterFields(){const e=this.state?.filter?.fields;return Array.isArray(e)?e:[]}offersFilter(e=0){const t=this.state?.filter?.templates;return this.getFilterFields().length>0||Array.isArray(t)&&t.length>0||e>0}getFilterField(e){return e&&this.getFilterFields().find(t=>t?.key===e)||null}setFilterFields(e=[],t="filter-fields"){for(const e of this._filterOptionPages.values())e.controller?.abort(),clearTimeout(e.searchTimer);return this._filterOptionPages.clear(),this.set(t=>({filter:{...t.filter||{},fields:Array.isArray(e)?e:[]}}),t)}patchTempColumnSettings(e,t={}){e&&(this.tempSettings={...this.tempSettings||{},cols:{...this.tempSettings?.cols||{},[e]:{...this.tempSettings?.cols?.[e]||{},..."function"==typeof t?t():t}}})}patchTempFilterTagSettings(e,t={}){e&&(this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},tags:{...this.tempSettings?.filter?.tags||{},[e]:{...this.tempSettings?.filter?.tags?.[e]||{},..."function"==typeof t?t():t}}}},this.requestComponentUpdate("filter-tag"))}patchTempFilterValue(e,t={}){if(!e)return;const n=this.getCurrentFilterValues(this.getPendingFilterState()),s=this.tempSettings?.filter?.values?.[e]||n[e]||{},i="function"==typeof t?t(s):t,r={...s,...i||{}};Object.keys(r).some(e=>{return t=s[e],n=r[e],!(Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every((e,t)=>Object.is(e,n[t])):Object.is(t,n));var t,n})&&(this.tempSettings={...this.tempSettings||{},filter:{...this.tempSettings?.filter||{},values:{...this.tempSettings?.filter?.values||{},[e]:r}}},this.requestComponentUpdate("temp-filter-value"))}isEmptyFilterValue(e){return null==e||(Array.isArray(e)?e.every(e=>this.isEmptyFilterValue(e)):"string"==typeof e?""===e.trim():!(!e||"object"!=typeof e)&&Object.values(e).every(e=>this.isEmptyFilterValue(e)))}isEmptyFilterEntry(e){return e&&"object"==typeof e?Object.prototype.hasOwnProperty.call(e,"values")?this.isEmptyFilterValue(e.values):Object.prototype.hasOwnProperty.call(e,"value")?this.isEmptyFilterValue(e.value):Object.entries(e).filter(([e])=>!["operator","control","type"].includes(e)).every(([,e])=>this.isEmptyFilterValue(e)):this.isEmptyFilterValue(e)}mergeFilterState(e={},t={}){const{filter:n,tags:s,values:i}=this.getMergedFilterDraftData(e,t);return this.patchFilterTemplateData(n,{tags:s,values:i})}setColumnSettingsQuery(e=""){return this.set({columnSettingsQuery:String(e??"")})}matchesColumnQuery(e="",t=""){const n=e=>String(e??"").toLowerCase().replace(/ё/gu,"е"),s=n(t).trim();return!s||n(e).includes(s)}getColumnCheckboxItems(e={}){const{checked:t,onChange:n,refPrefix:s="column"}=e,{pin:i=!1,handle:r=!1,query:a="",group:o=""}=e,l=e=>!o||("pinned"===o?e.system||this.isColumnPinned(e):!e.system&&!this.isColumnPinned(e));return this.getColumnItems().filter(e=>l(e)&&(!i||e.system||this.matchesColumnQuery(e.label,a))).map(e=>{const a=this.getItemRef(`${s}:${e.key}`)||!1,o="function"==typeof t?Boolean(t(e)):Boolean(t),l=f.html`
|
|
698
|
+
<sf-checkbox
|
|
699
|
+
size=${this.size}
|
|
700
|
+
label=${e.label}
|
|
701
|
+
position="end"
|
|
702
|
+
root-class="content-main-between"
|
|
703
|
+
?checked=${o}
|
|
704
|
+
${(0,g.ref)(a)}
|
|
705
|
+
@change=${t=>n?.(e,t)}
|
|
706
|
+
></sf-checkbox>
|
|
707
|
+
`;if(!i||e.system)return l;const c=this.isColumnPinned(e);return f.html`
|
|
708
|
+
<div class="sf-table-column-option flex items-cross-center gap-1/3"
|
|
709
|
+
data-column-key=${e.key}
|
|
710
|
+
data-sf-sortable-item=${e.key}
|
|
711
|
+
data-pinned=${c?"1":"0"}>
|
|
712
|
+
${r?f.html`<sf-button-icon
|
|
713
|
+
size="1/2"
|
|
714
|
+
appearance="link"
|
|
715
|
+
scheme="on-surface"
|
|
716
|
+
icon="drag_indicator"
|
|
717
|
+
data-move
|
|
718
|
+
data-sf-sortable-handle
|
|
719
|
+
root-class="sf-table-column-move cursor-grab"
|
|
720
|
+
aria-label=${`${this.text("columnMoveLabel","column-move-label")}: ${e.label||e.key}`}
|
|
721
|
+
></sf-button-icon>`:f.nothing}
|
|
722
|
+
<span class="flex-1 min-w-0">${l}</span>
|
|
723
|
+
<!-- A pinned column's pin is filled and a loose one's is
|
|
724
|
+
outlined, the way a pinned filter template already
|
|
725
|
+
shows itself. Colour alone had to carry the state, and
|
|
726
|
+
the two schemes are close enough that a person reading
|
|
727
|
+
a list of twenty pins could not tell which were set. -->
|
|
728
|
+
<sf-button-icon
|
|
729
|
+
size="1/2"
|
|
730
|
+
appearance="link"
|
|
731
|
+
scheme=${c?"primary":"on-surface"}
|
|
732
|
+
?filled=${c}
|
|
733
|
+
icon="push_pin"
|
|
734
|
+
title=${c?this.text("unpinColumnLabel","unpin-column-label"):this.text("pinColumnLabel","pin-column-label")}
|
|
735
|
+
aria-label=${c?this.text("unpinColumnLabel","unpin-column-label"):this.text("pinColumnLabel","pin-column-label")}
|
|
736
|
+
aria-pressed=${c?"true":"false"}
|
|
737
|
+
@click=${()=>this.toggleColumnPinned(e)}
|
|
738
|
+
></sf-button-icon>
|
|
739
|
+
</div>
|
|
740
|
+
`})}restoreColumnSettingsOnOpen(e="column-settings-restore"){const t=JSON.parse(JSON.stringify(this._columnSettingsOnOpen||{}));return this.tempSettings=null,this.set(e=>({...e,columnSettings:t}),e,()=>this.emitColumnSettingsChange(e)),this}commitColumnSettings(e="table-settings"){const t=this.tempSettings||{},{cols:n,...s}=t;if(!n)return this;const i=this.mergeColumnSettings(this.getColumnSettings(),n);return this.tempSettings=Object.keys(s).length?s:null,this.set(e=>({...e,columnSettings:i}),e,()=>this.emitColumnSettingsChange(e)),this}toggleColumnPinned(e){if(!e?.key||e.system)return this;const t=!this.isColumnPinned(e),n=this.getColumnItems().filter(e=>e?.key&&!e.system),s=n.map((e,t)=>{const n=this.tempSettings?.cols?.[e.key],s=this.getColumnSetting(e.key)||{},i=Number(n?.order??s.order??e.order);return Number.isFinite(i)?i:10*(t+1)}),i=n.map((e,t)=>({column:e,order:s[t]})).filter(n=>n.column.key!==e.key&&this.isColumnPinned(n.column)===t),r=t?Math.max(0,...i.map(e=>e.order))+10:Math.max(0,Math.min(...i.map(e=>e.order),10)-10);return this.patchTempColumnSettings(e.key,{pinned:t,order:r}),this.requestComponentUpdate("column-pin"),this.commitColumnSettings("column-pin"),this}renderSortableGroups(e,t,{name:n,label:s,onIntent:i}){const r=(e,t)=>t.length?f.html`<sf-sortable
|
|
741
|
+
group=${`${n}-${e}`}
|
|
742
|
+
data-group=${e}
|
|
743
|
+
label=${s}
|
|
744
|
+
class="flex flex-col gap-1/3"
|
|
745
|
+
@sf-sortable-intent=${i}>${t}</sf-sortable>`:f.nothing;return f.html`${r("pinned",e)}${r("loose",t)}`}getTableColsData(e=""){return this.getColumnCheckboxItems({group:e,pin:!0,handle:!0,query:this.state.columnSettingsQuery||"",refPrefix:"table-column",checked:e=>this.isColumnVisible(e),onChange:(e,t)=>{this.patchTempColumnSettings(e.key,{visible:Boolean(t.target?.checked)}),this.commitColumnSettings("column-visibility")}})}getFilterTagColsData(){const e=this.getFilterFields().filter(e=>!1!==e?.filter?.enabled);return(e.length?e:this.getColumnItems()).map(e=>{const t=this.tempSettings?.filter?.tags?.[e.key],n=this.getCurrentFilterTags(this.getPendingFilterState())?.[e.key],s={type:"checkbox",props:{size:this.size,label:e.label,position:"end",rootClass:"content-main-between",checked:t?.active??n?.active??!1,":ref":this.getItemRef(`filter-tag-column:${e.key}`)||!1,"@change":t=>{this.patchTempFilterTagSettings(e.key,{active:Boolean(t.target?.checked),label:e.label,control:e.filter?.control||e.type||e.dataType||"text"})}}};return this.renderSmartElement(s.type,s.props)})}getFilterControlValue(e){return{...this.getCurrentFilterValues()?.[e]||{},...this.tempSettings?.filter?.values?.[e]||{}}}getFilterOptions(e={}){const t=e.filter||{},n=t.optionsSource||{};if("endpoint"===n.type){const t=this.getEndpointFilterPage(e),n=new Set(this.getFilterControlValue(e.key).values||[]),s=new Map;for(const e of[...t?.selected||[],...t?.items||[]])"string"==typeof e?.value&&"string"==typeof e?.label&&(n.has(e.value)||(t?.items||[]).includes(e))&&s.set(e.value,e);return[...s.values()]}return Array.isArray(t.options)?t.options:Array.isArray(n.items)?n.items:[]}getEndpointFilterPage(e={}){const t=e.filter?.optionsSource;if("endpoint"!==t?.type||"string"!=typeof t.url||!t.url.trim()||!e.key)return null;let n=this._filterOptionPages.get(e.key);return n&&n.url===t.url||(n?.controller?.abort(),n={url:t.url,items:[],selected:[],nextCursor:null,status:"idle",sequence:0,searchable:!1},this._filterOptionPages.set(e.key,n),queueMicrotask(()=>{this.isConnected&&this._filterOptionPages.get(e.key)===n&&this.loadEndpointFilterPage(e)})),n}async loadEndpointFilterPage(e={},t=null,n=""){const s=this.getEndpointFilterPage(e);if(!s||!this.isConnected)return!1;let i;try{if(i=new URL(s.url,globalThis.location?.href),i.origin!==globalThis.location?.origin)throw new TypeError("filter_options_cross_origin")}catch{return s.status="error",this.requestComponentUpdate("filter-options"),!1}s.controller?.abort();const r=new AbortController,a=++s.sequence;s.controller=r,s.status="loading",i.searchParams.set("limit","50"),i.searchParams.set("sequence",String(a)),t?i.searchParams.set("cursor",t):i.searchParams.delete("cursor"),n&&s.searchable?i.searchParams.set("search",n):i.searchParams.delete("search"),i.searchParams.delete("selected_values[]");for(const t of this.getFilterControlValue(e.key).values||[])"string"==typeof t&&i.searchParams.append("selected_values[]",t);this.requestComponentUpdate("filter-options");try{const n=await fetch(i,{credentials:"same-origin",signal:r.signal,headers:{Accept:"application/json"}}),o=await n.json();if(s.sequence!==a||this._filterOptionPages.get(e.key)!==s||!this.isConnected)return!1;if(!n.ok||"ok"!==o?.status||o.sequence!==a||!Array.isArray(o.items)||!Array.isArray(o.selected)||null!==o.next_cursor&&"string"!=typeof o.next_cursor)throw new TypeError("filter_options_answer_invalid");const l=e=>e.filter(e=>"string"==typeof e?.value&&e.value&&"string"==typeof e?.label&&e.label).map(({value:e,label:t})=>({value:e,label:t})),c=new Map((t?s.items:[]).map(e=>[e.value,e]));for(const e of l(o.items))c.set(e.value,e);return s.items=[...c.values()],s.selected=l(o.selected),s.nextCursor=o.next_cursor,s.searchable=!0===o.searchable,s.status="ready",this.requestComponentUpdate("filter-options"),!0}catch(e){return s.sequence!==a||"AbortError"===e?.name||(s.status="error",this.requestComponentUpdate("filter-options")),!1}}getFilterOptionSearch(e){return e&&this.tempSettings?.filterSearch?.[e]||""}patchTempFilterOptionSearch(e,t=""){if(!e)return;this.tempSettings={...this.tempSettings||{},filterSearch:{...this.tempSettings?.filterSearch||{},[e]:String(t||"")}},this.requestComponentUpdate("filter-option-search");const n=this.getFilterField(e),s=n&&this.getEndpointFilterPage(n);s?.searchable&&(clearTimeout(s.searchTimer),s.searchTimer=setTimeout(()=>this.loadEndpointFilterPage(n,null,String(t||"").trim()),200))}filterUpdate(){return this.getFilterPayload()}getFilterOptionSearchKeys(e={}){const t=e.filter?.searchKeys||e.filter?.optionSearchKeys;return Array.isArray(t)&&t.length?t:["label","title","name","text","value","id"]}getObjectPathValue(e={},t=""){return String(t||"").split(".").filter(Boolean).reduce((e,t)=>null==e?"":e[t],e)}normalizeFilterSearchValue(e=""){return String(e||"").trim().toLowerCase()}optionMatchesSearch(e={},t="",n=[]){const s=this.normalizeFilterSearchValue(t);return!s||n.some(t=>{const n=this.getObjectPathValue(e,t);return this.normalizeFilterSearchValue(n).includes(s)})}getVisibleFilterOptions(e={}){const t=this.getFilterOptions(e),n=this.getFilterOptionSearch(e.key);if(!n)return t;const s=this.getFilterOptionSearchKeys(e);return t.filter(e=>this.optionMatchesSearch(e,n,s))}cellEditable(e={},t={}){return"true"===this.getAttribute("inline-edit")&&("boolean"===(t.propertyType??t.property_type??t.type)&&(Array.isArray(e.editable)&&e.editable.map(String).includes(String(t.key))))}cellPending(e={},t={}){return!0===this._pendingCells?.has(`${this.getRowKey(e)}\0${t.key}`)}setCellValue(e={},t={},n){const s=this.getRowKey(e);this._pendingCells??=new Set,this._pendingCells.add(`${s}\0${t.key}`),this.requestComponentUpdate("cell-pending"),this.emitTableEvent("cell-set",Object.freeze({id:e.id??s,key:t.key,value:n,revision:e._revision??e.revision??null}))}clearCellPending(e,t){this._pendingCells?.delete(`${e}\0${t}`)&&this.requestComponentUpdate("cell-pending")}resetCellControl(e,t,n){const s=e=>String(e).replace(/"/gu,'\\"'),i=this.querySelector(`tbody tr[data-row-id="${s(e)}"] [data-cell-edit="${s(t)}"]`);if(!i)return;const r=!0===n;i.checked=r,i.toggleAttribute("checked",r);const a=i.querySelector("input");a&&(a.checked=r)}getTypedCellValue(e={},t){const n=this.cellHost??null,s=e.propertyType??e.property_type??e.type;if("file"===s&&Array.isArray(t)){const s=t.map(t=>(0,h.dV)(e,t,n)).filter(e=>null!=e);return s.length?s:null}const i=(0,h.dV)(e,t,n);return null!=i?i:m.J.has(s)&&(0,m.x)(s,t,this)||null}cellText(e={},t){return"html"===(e.propertyType??e.property_type??e.type)?(0,p.j)(t):String(t)}renderFilterControl(e={}){return(0,h.fT)(e,{size:this.size,getFilterControlValue:e=>this.getFilterControlValue(e),patchTempFilterValue:(e,t)=>this.patchTempFilterValue(e,t),getFilterOperatorLabel:e=>this.getFilterOperatorLabel(e),getFilterOptionSearch:e=>this.getFilterOptionSearch(e),patchTempFilterOptionSearch:(e,t)=>this.patchTempFilterOptionSearch(e,t),getVisibleFilterOptions:e=>this.getVisibleFilterOptions(e),renderFilterOption:(e,t)=>this.renderFilterOption(e,t),getEndpointFilterPage:e=>this.getEndpointFilterPage(e),loadEndpointFilterPage:(e,t,n)=>this.loadEndpointFilterPage(e,t,n)})}renderFilterOption(e={},t={},n=new Set){const s=t.value??t.id??t.key??t.label??t.title,i=t.label||t.title||String(s||""),r="badge"===e.filter?.optionRenderer?(0,d.f)(t):null;return f.html`
|
|
746
|
+
<div
|
|
747
|
+
${(0,g.ref)(this.getItemRef(t.label))}
|
|
748
|
+
class="flex items-cross-center gap-1/2 content-main-between">
|
|
749
|
+
<div class="flex items-cross-center gap-1/2 min-w-0">
|
|
750
|
+
${r?f.html`
|
|
751
|
+
<sf-badge
|
|
752
|
+
appearance="tonal"
|
|
753
|
+
scheme=${r.scheme}
|
|
754
|
+
root-style=${r.rootStyle||f.nothing}
|
|
755
|
+
icon=${t.icon||f.nothing}
|
|
756
|
+
text=${i}
|
|
757
|
+
></sf-badge>
|
|
758
|
+
`:f.html`
|
|
759
|
+
${this.renderFilterOptionVisual(e,t)}
|
|
760
|
+
<span class="sf-text-1 truncate">${i}</span>
|
|
761
|
+
`}
|
|
762
|
+
</div>
|
|
763
|
+
<sf-checkbox
|
|
764
|
+
size=${this.size}
|
|
765
|
+
position="end"
|
|
766
|
+
root-class="content-main-between"
|
|
767
|
+
?checked=${n.has(s)}
|
|
768
|
+
@change=${t=>{const i=new Set(n);t.target?.checked?i.add(s):i.delete(s),this.patchTempFilterValue(e.key,{values:Array.from(i),operator:e.filter?.defaultOperator||"in"})}}
|
|
769
|
+
></sf-checkbox>
|
|
770
|
+
</div>
|
|
771
|
+
`}renderFilterOptionVisual(e={},t={}){return"swatch"===e.filter?.optionRenderer&&t.color?f.html`<span class="sf-table-filter-swatch" aria-hidden="true" style=${`background-color: ${t.color}`}></span>`:"avatar-checkbox"!==e.filter?.optionRenderer?"":t.imageUrl?f.html`
|
|
772
|
+
<sf-avatar
|
|
773
|
+
size=${this.size}
|
|
774
|
+
image-url="${t.imageUrl}"
|
|
775
|
+
heading="${t.title||t.label||""}"
|
|
776
|
+
></sf-avatar>
|
|
777
|
+
`:f.html`
|
|
778
|
+
<sf-avatar
|
|
779
|
+
size=${this.size}
|
|
780
|
+
heading="${t.avatarText||t.title||t.label||""}"
|
|
781
|
+
></sf-avatar>
|
|
782
|
+
`}getFilterOperatorLabel(e){const t={eq:"operatorEq",gt:"operatorGt",gte:"operatorGte",lt:"operatorLt",lte:"operatorLte",between:"operatorBetween",contains:"operatorContains",startsWith:"operatorStartsWith",any:"operatorAny",today:"operatorToday",week:"operatorWeek",month:"operatorMonth",in:"operatorIn"};return t[e]?this.text(t[e]):e}renderFilterSettingsContextMenu(e){const{x:t,y:n,position:s,columnCount:i,columnsCount:r,transform:a}=e;let o=`translateX(${void 0!==a?a:0}%)`;const l=this.getPendingFilterState(),c=this.countPendingFilterConditionChanges(),u=l.selectedTemplateKey,d=this.getSortedFilterTemplates(l),h=d.map(e=>{let t;const n=this.state.filter.rename===e.key;if(this.state.filter.rename!==e.key){const n={type:"radio",props:{size:this.size,label:e.label||this.text("untitledTemplateText"),name:"filter_templates",checked:u?u===e.key:e.selected||!1,"@change":()=>{this.selectTempFilterTemplate(e.key)}}};t=this.renderSmartElement(n.type,n.props)}else t=f.html`
|
|
783
|
+
<div class="flex items-cross-center gap-1/4 flex-1">
|
|
784
|
+
<sf-input size=${this.size} ${(0,g.ref)(this.refs.renameInput)} root-class="flex-1"
|
|
785
|
+
default-value="${e.label}"></sf-input>
|
|
786
|
+
<div class="flex items-cross-center flex-none">
|
|
787
|
+
<sf-button-icon size=${this.size} segment="start" appearance="outline" scheme="on-surface" @click="${()=>{this.set(e=>({filter:{...e.filter||{},rename:""}}))}}"
|
|
788
|
+
icon="close"></sf-button-icon>
|
|
789
|
+
<sf-button-icon size=${this.size} segment="end" icon="check" @click="${()=>{const t=this.refs.renameInput.value?.value;this.saveFilterTemplatePatch(e.key,{label:t},{filterPatch:{rename:""},saveInputValue:t})}}"></sf-button-icon>
|
|
790
|
+
</div>
|
|
791
|
+
</div>`;return f.html`
|
|
792
|
+
<div
|
|
793
|
+
:key=${e.key}
|
|
794
|
+
${(0,g.ref)(this.getItemRef(e.label))}
|
|
795
|
+
class="sf-settings-context-menu-item flex items-cross-center flex-1 gap-1/3 ${e.deleted?"opacity-3":""}"
|
|
796
|
+
data-filter-template-key="${e.key}"
|
|
797
|
+
data-sf-sortable-item=${e.key}
|
|
798
|
+
data-pinned="${e.pinned?"1":"0"}"
|
|
799
|
+
>
|
|
800
|
+
${n?f.nothing:f.html`
|
|
801
|
+
<sf-button-icon size=${this.size}
|
|
802
|
+
id="${this.getInstanceId()}--template-move--${e.key}"
|
|
803
|
+
appearance="link"
|
|
804
|
+
data-move
|
|
805
|
+
data-sf-sortable-handle
|
|
806
|
+
scheme="on-surface"
|
|
807
|
+
aria-label=${`${this.text("templateMoveLabel")}: ${e.label}`}
|
|
808
|
+
icon="drag_indicator"
|
|
809
|
+
root-class="cursor-move"
|
|
810
|
+
></sf-button-icon>`}
|
|
811
|
+
${t}
|
|
812
|
+
${n?f.nothing:f.html`
|
|
813
|
+
<div class="flex items-cross-center m-inline-start-auto gap-1/3">
|
|
814
|
+
<sf-button-icon
|
|
815
|
+
appearance="link"
|
|
816
|
+
data-keep
|
|
817
|
+
size="1/3"
|
|
818
|
+
scheme="on-surface"
|
|
819
|
+
aria-label=${`${this.text("templatePinLabel")}: ${e.label}`}
|
|
820
|
+
?filled="${e.pinned}"
|
|
821
|
+
root-class="${e.pinned?"sf-button-pinned":""}"
|
|
822
|
+
icon="keep"
|
|
823
|
+
@click=${()=>{this.patchTempFilterTemplateSettings(e.key,{pinned:!e.pinned})}}
|
|
824
|
+
></sf-button-icon>
|
|
825
|
+
<sf-button-icon size=${this.size}
|
|
826
|
+
appearance="link"
|
|
827
|
+
data-settings
|
|
828
|
+
data-context-submenu-anchor="${e.key}"
|
|
829
|
+
scheme="on-surface"
|
|
830
|
+
aria-label=${`${this.text("templateActionsLabel")}: ${e.label}`}
|
|
831
|
+
icon="more_vert"
|
|
832
|
+
@click=${t=>{this.openContextSubmenu(t,{type:"filter-template-actions",template:e})}}
|
|
833
|
+
></sf-button-icon>
|
|
834
|
+
</div>`}
|
|
835
|
+
</div>`}),p=i??r??this.contextMenuColumns??1,m=this.getFilterTagColsData(),b=this.splitItemsByColumns(m,p);let y=`${this.text("templatesTabText")}|${this.text("fieldsTabText")}`;return f.html`
|
|
836
|
+
<sf-menu-context
|
|
837
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
838
|
+
:key=${t+n+this._renderToken}
|
|
839
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"filter-settings"})}
|
|
840
|
+
style="
|
|
841
|
+
position: fixed;
|
|
842
|
+
left: ${t}px;
|
|
843
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
844
|
+
transform: ${o};
|
|
845
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
846
|
+
--sf-table-context-menu--max-block-size: calc(100dvh - ${n}px - var(--sf-space-4));
|
|
847
|
+
"
|
|
848
|
+
root-class="sf-table-context-menu ${"1/2"===this.size?"sf-table-context-menu--dense ":""}flex flex-col"
|
|
849
|
+
position="${s||""}"
|
|
850
|
+
role="dialog"
|
|
851
|
+
tabs=${y}
|
|
852
|
+
active-tab=${"fields"===this._filterTab?"1":"0"}
|
|
853
|
+
closable
|
|
854
|
+
@sf-menu-context-tab=${e=>{e.stopPropagation(),this._filterTab=1===e.detail?.index?"fields":"templates",this.requestComponentUpdate("filter-tab")}}
|
|
855
|
+
@sf-menu-context-close=${e=>{e.stopPropagation(),this.closeContextMenu()}}
|
|
856
|
+
>
|
|
857
|
+
<!-- The Framework's panel with tabs (owner, 2026-10-15): the
|
|
858
|
+
tabs stay while the rows scroll, the buttons stay at the
|
|
859
|
+
bottom, and the window keeps its width -- it grew under
|
|
860
|
+
the pointer when «Применить (2)» got longer. -->
|
|
861
|
+
<div class="sf-table-context-body flex flex-col flex-1" slot="content">
|
|
862
|
+
${"fields"!==this._filterTab?f.html`
|
|
863
|
+
<div
|
|
864
|
+
class="sf-context-menu-columns flex flex-col gap-1/4 overflow-auto flex-1"
|
|
865
|
+
data-filter-template-list
|
|
866
|
+
>
|
|
867
|
+
${this.renderSortableGroups(h.filter((e,t)=>d[t].pinned),h.filter((e,t)=>!d[t].pinned),{name:"filter-templates",label:this.text("templatesTabText"),onIntent:e=>this.onFilterTemplateIntent(e)})}
|
|
868
|
+
</div>`:f.html`
|
|
869
|
+
<div class="sf-context-menu-columns flex flex-1 gap-1 overflow-auto">
|
|
870
|
+
${b.map(e=>f.html`
|
|
871
|
+
<div class="flex flex-col gap-1 flex-1">
|
|
872
|
+
${e}
|
|
873
|
+
</div>
|
|
874
|
+
`)}
|
|
875
|
+
</div>`}
|
|
876
|
+
</div>
|
|
877
|
+
<sf-button slot="footer" size=${this.size} @click="${()=>{this.tempSettings=null,this.requestComponentUpdate("table"),this.requestColumnSettingsReset()}}" appearance="outline" scheme="on-surface" root-class="flex-1"
|
|
878
|
+
text="${this.text("resetText")}"></sf-button>
|
|
879
|
+
<sf-button slot="footer" size=${this.size} @click="${()=>{const e=this.tempSettings?.filter;if(e){let t=[],n=[],s=null;this.set(i=>{const r=this.hasPendingFilterDataChanges(i.filter||{}),a=this.mergeFilterState(i.filter||{},e),o=this.getSelectedFilterTemplate(a);t=e.templates?this.getChangedFilterTemplates(i.filter||{},a,["order","pinned","deleted","selected","default"]):[],n=a.templates.filter(e=>e.deleted&&e.key).map(e=>e.key),a.templates=a.templates.filter(e=>!e.deleted);const l=this.getSelectedFilterTemplate(i.filter||{})?.key||null;return s=o?.key&&o.key!==l?o.key:null,{filter:a,filterDataDirty:i.filterDataDirty||r,saveInputValue:o?.label||""}},()=>{t.length&&this.dispatchFilterTemplatesSave(t);for(const e of n)this.emitTableEvent("template-delete",Object.freeze({key:e}));s&&this.emitTableEvent("template-select",Object.freeze({key:s}))})}this.tempSettings=null,this.closeContextMenu()}}" root-class="flex-1"
|
|
880
|
+
aria-label=${c?`${this.text("filterApplyText","filter-apply-text")}: ${c}`:this.text("filterApplyText","filter-apply-text")}
|
|
881
|
+
text=${c?`${this.text("filterApplyText","filter-apply-text")} (${c})`:this.text("filterApplyText","filter-apply-text")}></sf-button>
|
|
882
|
+
</sf-menu-context>
|
|
883
|
+
`}renderTagsSettingsContextMenu(e){const{x:t,y:n,position:s,fieldKey:i}=e,r=this.getFilterField(i)||{key:i,label:this.getCurrentFilterTags()?.[i]?.label||i||"",filter:{control:this.getCurrentFilterTags()?.[i]?.control||"text"}};return f.html`
|
|
884
|
+
<sf-menu-context
|
|
885
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
886
|
+
:key=${t+n+this._renderToken}
|
|
887
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"tag-settings"})}
|
|
888
|
+
style="
|
|
889
|
+
position: fixed;
|
|
890
|
+
left: ${t}px;
|
|
891
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
892
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
893
|
+
"
|
|
894
|
+
root-class="sf-table-context-menu ${"1/2"===this.size?"sf-table-context-menu--dense ":""}flex flex-col"
|
|
895
|
+
position="${s||""}"
|
|
896
|
+
>
|
|
897
|
+
<div class="flex flex-col flex-1 ${"1/2"===this.size?"p-top-1":"p-top-3"}" slot="content">
|
|
898
|
+
<div class="sf-table-context-main">
|
|
899
|
+
<div class="sf-table-tags-search flex flex-col">
|
|
900
|
+
<div class="flex flex-col ${"1/2"===this.size?"p-bottom-1":"p-bottom-3"}">
|
|
901
|
+
${this.renderFilterControl(r)}
|
|
902
|
+
</div>
|
|
903
|
+
</div>
|
|
904
|
+
</div>
|
|
905
|
+
<div class="sf-table-context-bottom sf-context-menu-footer">
|
|
906
|
+
<sf-button size=${this.size} @click="${()=>{this.tempSettings=null,this.requestComponentUpdate("table")}}" appearance="outline" scheme="on-surface" root-class="flex-1"
|
|
907
|
+
text="${this.text("resetText")}"></sf-button>
|
|
908
|
+
<sf-button size=${this.size} @click="${()=>{const e=this.tempSettings?.filter;e&&this.set(t=>{const n=this.hasPendingFilterDataChanges(t.filter||{});return{filter:this.mergeFilterState(t.filter||{},e),filterDataDirty:t.filterDataDirty||n}},()=>{const e=this.filterUpdate();this.emitTableEvent("filter-change",e)}),this.tempSettings=null,this.closeContextMenu()}}" root-class="flex-1" text="${this.text("applyText")}"></sf-button>
|
|
909
|
+
</div>
|
|
910
|
+
</div>
|
|
911
|
+
</sf-menu-context>
|
|
912
|
+
`}removeFilterTag(e=null){return e?(this.tempSettings=null,this.set(t=>{const n=t.filter||{},s={...this.getCurrentFilterTags(n)},i={...this.getCurrentFilterValues(n)};return delete s[e],delete i[e],{filter:this.patchFilterTemplateData(n,{tags:s,values:i}),filterDataDirty:!0}},()=>{const e=this.filterUpdate();this.emitTableEvent("filter-change",e)}),this):(this.tempSettings=null,this.set(e=>{const t=e.filter||{};return{filter:{...t,selectedTemplateKey:"",templates:this.getFilterTemplates(t).map(e=>({...e,selected:!1}))},saveInputValue:"",filterDataDirty:!1}},()=>{const e=this.filterUpdate();this.emitTableEvent("filter-change",e)}),this)}renderTableSettingsContextMenu(e){const{x:t,y:n,position:s,transform:i,columnCount:r,columnsCount:a}=e;let o=`translateX(${void 0!==i?i:0}%)`;r??a??this.contextMenuColumns;const l=this.getTableColsData(),c=this.getTableColsData("pinned"),u=this.getTableColsData("loose"),d=this.state.columnSettingsQuery||"";return f.html`
|
|
913
|
+
<sf-menu-context
|
|
914
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
915
|
+
:key=${t+n+this._renderToken}
|
|
916
|
+
aria-label=${this.getContextMenuLabel({...e,menu:"table-settings"})}
|
|
917
|
+
style="
|
|
918
|
+
position: fixed;
|
|
919
|
+
left: ${t}px;
|
|
920
|
+
inset-block-start: calc(${n}px + calc(var(--sf-focus-outline-width) * 2));
|
|
921
|
+
transform: ${o};
|
|
922
|
+
z-index: var(--sf-table-context-menu--z-index, var(--sf-z-index-9));
|
|
923
|
+
--sf-table-context-menu--max-block-size: calc(100dvh - ${n}px - var(--sf-space-4));
|
|
924
|
+
"
|
|
925
|
+
root-class="sf-table-context-menu ${"1/2"===this.size?"sf-table-context-menu--dense ":""}flex flex-col"
|
|
926
|
+
position="${s||""}"
|
|
927
|
+
role="dialog"
|
|
928
|
+
tabs=${`${this.text("settingsFieldsTab")}|${this.text("settingsViewTab")}`}
|
|
929
|
+
active-tab=${"view"===this._settingsTab?"1":"0"}
|
|
930
|
+
closable
|
|
931
|
+
@sf-menu-context-tab=${e=>{e.stopPropagation(),this._settingsTab=1===e.detail?.index?"view":"fields",this.requestComponentUpdate("settings-tab")}}
|
|
932
|
+
@sf-menu-context-close=${e=>{e.stopPropagation(),this.closeContextMenu()}}
|
|
933
|
+
>
|
|
934
|
+
<!-- Two tabs (owner, 2026-10-14) in the Framework's panel
|
|
935
|
+
(2026-10-15): its head -- the tabs and the way out --
|
|
936
|
+
stays while the rows scroll, and its width is its own.
|
|
937
|
+
Esc, a click outside and the gear again close it too. -->
|
|
938
|
+
<div class="sf-table-context-body flex flex-col flex-1" slot="content">
|
|
939
|
+
${"view"===this._settingsTab?this.renderTableViewSettings():f.html`
|
|
940
|
+
<!-- The search: a site can have hundreds of fields, and
|
|
941
|
+
scrolling for one is not an answer. -->
|
|
942
|
+
<label class="sf-table-column-search flex flex-col">
|
|
943
|
+
<sf-input
|
|
944
|
+
size=${this.size}
|
|
945
|
+
appearance="bordered"
|
|
946
|
+
root-class="sf-table-column-search-input"
|
|
947
|
+
name="sf_table_column_search"
|
|
948
|
+
.value=${d}
|
|
949
|
+
placeholder=${this.text("columnSearchPlaceholder","column-search-placeholder")}
|
|
950
|
+
aria-label=${this.text("columnSearchPlaceholder","column-search-placeholder")}
|
|
951
|
+
@input=${e=>this.setColumnSettingsQuery(e.target?.value??"")}
|
|
952
|
+
></sf-input>
|
|
953
|
+
</label>
|
|
954
|
+
<div class="sf-context-menu-columns flex flex-col flex-1 gap-1/3 overflow-auto"
|
|
955
|
+
data-column-settings-list>
|
|
956
|
+
${l.length?this.renderSortableGroups(c,u,{name:"table-columns",label:this.text("settingsColumnLabel"),onIntent:e=>this.onColumnSettingsIntent(e)}):f.html`<div class="sf-table-column-empty p-1 color-on-surface-variant">
|
|
957
|
+
${this.text("columnSearchEmptyText","column-search-empty-text")}
|
|
958
|
+
</div>`}
|
|
959
|
+
</div>
|
|
960
|
+
`}
|
|
961
|
+
</div>
|
|
962
|
+
<!-- «Применить» went with the consumer owner's decision of
|
|
963
|
+
2026-10-05: every control in this window applies as it is
|
|
964
|
+
pressed. «Сбросить» is the way back -- for the fields, the
|
|
965
|
+
settings as they stood when the window was opened; for the
|
|
966
|
+
view, the defaults. -->
|
|
967
|
+
<!-- One button that stays, its words and act following the
|
|
968
|
+
tab: the panel took its footer once, at the start. -->
|
|
969
|
+
<sf-button slot="footer" size=${this.size} appearance="outline" scheme="on-surface" root-class="flex-1"
|
|
970
|
+
text=${"view"===this._settingsTab?this.text("viewReset"):this.text("resetText")}
|
|
971
|
+
@click=${()=>"view"===this._settingsTab?this.resetTableView():this.restoreColumnSettingsOnOpen()}></sf-button>
|
|
972
|
+
</sf-menu-context>
|
|
973
|
+
`}renderTableViewSettings(){const e=this.tableView,t="1/2"===this.size?"1/2":"1",n=!0===this._viewEverywhere,s={compact:"viewDensityCompact",normal:"viewDensityNormal",spacious:"viewDensitySpacious"},i=(s,i)=>f.html`<label class="sf-table-settings-row" data-view-option=${s}>
|
|
974
|
+
<sf-checkbox size=${t} ?checked=${!0===e[s]}
|
|
975
|
+
@change=${e=>this.setTableView({[s]:Boolean(e.target?.checked??e.detail?.checked)},{everywhere:n})}></sf-checkbox>
|
|
976
|
+
<span>${this.text(i)}</span></label>`;return f.html`
|
|
977
|
+
<div class="sf-table-view-settings flex flex-col flex-1 gap-1/3" data-table-view-settings>
|
|
978
|
+
<div class="sf-table-settings-heading">${this.text("viewDensity")}</div>
|
|
979
|
+
<div role="radiogroup" aria-label=${this.text("viewDensity")} class="flex flex-col">
|
|
980
|
+
${["compact","normal","spacious"].map(i=>f.html`<label class="sf-table-settings-row" data-view-density=${i}>
|
|
981
|
+
<sf-radio size=${t} name=${`${this.getInstanceId()}-density`} value=${i} ?checked=${e.density===i}
|
|
982
|
+
@change=${()=>this.setTableView({density:i},{everywhere:n})}></sf-radio>
|
|
983
|
+
<span>${this.text(s[i])}</span></label>`)}
|
|
984
|
+
</div>
|
|
985
|
+
${i("stripes","viewStripes")}
|
|
986
|
+
${i("lines","viewLines")}
|
|
987
|
+
${i("singleLine","viewSingleLine")}
|
|
988
|
+
${"page"===this.getAttribute("vertical-scroll")?i("stickyHead","viewStickyHead"):f.nothing}
|
|
989
|
+
${this.viewPreferenceKey?f.html`<div class="sf-table-settings-separator" role="separator"></div>
|
|
990
|
+
${((e,t)=>f.html`<div class="sf-table-settings-row">${t}<span>${e}</span></div>`)(this.text("viewEverywhere"),f.html`<sf-checkbox size=${t} data-view-everywhere ?checked=${n}
|
|
991
|
+
@change=${e=>{this._viewEverywhere=Boolean(e.target?.checked??e.detail?.checked),this.requestComponentUpdate("view-everywhere")}}></sf-checkbox>`)}`:f.nothing}
|
|
992
|
+
</div>`}renderMainContextMenu(e){switch(e.menu||e.menuType||e.contextMenu){case"row-settings":return this.renderRowSettingsContextMenu(e);case"create":return this.renderCreateContextMenu(e);case"list-sort":return this.renderListSortContextMenu(e);case"toolbar-actions":return this.renderToolbarActionsContextMenu(e);case"filter-favorites":return this.renderFilterFavoritesContextMenu(e);case"filter-settings":return this.renderFilterSettingsContextMenu(e);case"table-settings":return this.renderTableSettingsContextMenu(e);case"tag-settings":return this.renderTagsSettingsContextMenu(e);default:return"left"===e.type?this.renderRowSettingsContextMenu(e):this.renderTableSettingsContextMenu(e)}}renderTemplateActionsContextSubmenu(e){const{x:t,y:n,position:s,transform:i,template:r={}}=e;let a=`translateY(${void 0!==i?i:0}%)`;const o=this.getFilterTemplateByKey(r.key,this.tempSettings?.filter||null);let l=(o||r).deleted;const c=!0===(o||r).default;return f.html`
|
|
993
|
+
<sf-menu-context
|
|
994
|
+
size=${"1/2"===this.size?"1/2":"1"}
|
|
995
|
+
:key=${`${r.key||""}-${t}-${n}`}
|
|
996
|
+
aria-label=${this.getContextMenuLabel({...e,type:"filter-template-actions"})}
|
|
997
|
+
style="
|
|
998
|
+
position: fixed;
|
|
999
|
+
left: calc(${t}px + var(--sf-context-menu-tail-corner-offset));
|
|
1000
|
+
inset-block-start: ${n}px;
|
|
1001
|
+
z-index: var(--sf-table-context-submenu--z-index, var(--sf-z-index-9));
|
|
1002
|
+
transform: ${a}
|
|
1003
|
+
"
|
|
1004
|
+
data-context-submenu
|
|
1005
|
+
root-class="sf-table-context-submenu flex flex-col"
|
|
1006
|
+
position="${s||"right"}"
|
|
1007
|
+
.entries=${[{id:"rename",text:this.text("renameText"),icon:"edit"},{id:"default",text:c?this.text("defaultTemplateText"):this.text("makeDefaultLabel"),icon:c?"remove":"check"},{id:"delete",text:l?this.text("restoreText"):this.text("deleteActionText"),icon:l?"restore_from_trash":"delete",danger:!l,keepOpen:!0}]}
|
|
1008
|
+
@sf-menu-context-select=${e=>{const t=e.detail?.id;"rename"===t?this.set(e=>({filter:{...e.filter||{},rename:r.key},contextMenu:{...e.contextMenu||{},submenu:null}})):"default"===t?(this.changeTempFilterTemplateSettings(r.key,{default:!r.default}),this.closeContextSubmenu()):"delete"===t&&this.patchTempFilterTemplateSettings(r.key,{deleted:!l})}}
|
|
1009
|
+
>
|
|
1010
|
+
</sf-menu-context>
|
|
1011
|
+
`}renderContextSubmenu(e){return"filter-template-actions"===e?.type?this.renderTemplateActionsContextSubmenu(e):f.nothing}renderContextMenu(e){return e?.open&&globalThis.SF?.Loader?.ensure?.("tag-settings"===e.menu?["sf-input-date","sf-slider-range"]:["sf-sortable","sf-radio","sf-tabs"]),e?.open?((0,f.render)(f.html`
|
|
1012
|
+
<div
|
|
1013
|
+
class="sf-table-context-layer"
|
|
1014
|
+
data-sf-sheet=${this.isList&&["filter-settings","tag-settings"].includes(e.menu)?"":f.nothing}
|
|
1015
|
+
${(0,g.ref)(this.refs.contextMenu)}
|
|
1016
|
+
@click=${e=>this.handleContextLayerClick(e)}
|
|
1017
|
+
>
|
|
1018
|
+
${this.renderMainContextMenu(e)}
|
|
1019
|
+
${e.submenu?.open?this.renderContextSubmenu(e.submenu):f.nothing}
|
|
1020
|
+
${this.isList&&["filter-settings","tag-settings"].includes(e.menu)?f.html`
|
|
1021
|
+
<div class="sf-table-sheet-close">
|
|
1022
|
+
<sf-button-icon size=${this.size} appearance="link" scheme="on-surface"
|
|
1023
|
+
icon="close" aria-label=${this.text("closeText")}
|
|
1024
|
+
@click=${()=>this.closeContextMenu()}></sf-button-icon>
|
|
1025
|
+
</div>`:f.nothing}
|
|
1026
|
+
</div>
|
|
1027
|
+
`,this.getPortalContainer()),this.showPortal(),this.bindContextEvent(),this.bindContextViewport(),requestAnimationFrame(()=>{this.clampContextMenusToViewport(),this.redrawWhenComponentsUpgrade(this.getPortalContainer())}),f.nothing):((0,f.render)(null,this.getPortalContainer()),this.hidePortal(),f.nothing)}getActionItems(){return this.state.actions.map(e=>{const t={type:"checkbox",props:{size:this.size,label:e.name,position:"end",rootClass:"content-main-between",checked:e.visible,"@change":t=>{let n=!1;const s=(this.tempSettings&&this.tempSettings.actions?this.tempSettings.actions:this.state.actions).map(s=>{let i=s.id===e.id?t.target.checked:s.visible;return i&&(n=!0),{...s,visible:i}});this.tempSettings={...this.tempSettings||{},actionActive:n,actions:s}}}};return this.renderSmartElement(t.type,t.props)})}hoverEvents(e){if(this._columnResizeState||this.columnDragActive)return;const t=e.target.closest("th");if(!t)return;t.querySelector(".sidebar-resizer")&&(t.classList.add("hover"),this.getColumnResizeHandle(e.target)?this.showColumnResizeGuide(t):this.hideColumnResizeGuide())}outEvent(e){if(this._columnResizeState||this.columnDragActive)return;const t=e.target.closest("th");if(!t)return;t.querySelector(".sidebar-resizer")&&(t.classList.remove("hover"),this.hideColumnResizeGuide())}showColumnResizeGuide(e){const t=this.refs.resizeGuide?.value,n=this.refs.scroll?.value,s=this.refs.table?.value;if(!(t&&n&&e&&s))return;const i=s.querySelector("thead"),r=s.querySelector("tbody");if(!i||!r)return void this.hideColumnResizeGuide();const a=n.getBoundingClientRect(),o=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=r.getBoundingClientRect();if(c.height<=0)return void this.hideColumnResizeGuide();const u=parseFloat(getComputedStyle(e).borderInlineEndWidth)||0,d=this.isRightToLeft()?o.left-a.left+n.scrollLeft:o.right-a.left+n.scrollLeft-u;t.style.insetInlineStart=`${d}px`,t.style.insetBlockStart=`${l.bottom-a.top+n.scrollTop}px`,t.style.blockSize=`${c.height}px`,t.hidden=!1}hideColumnResizeGuide(){const e=this.refs.resizeGuide?.value;e&&(e.hidden=!0)}isRightToLeft(){return"rtl"===getComputedStyle(this).direction}bindHoverEvent(){if(this._hoverEventBound)return;this._hoverEventBound=!0;const e=this.refs.table?.value;e?.addEventListener("mouseover",this.hoverEvents),e?.addEventListener("mouseout",this.outEvent)}unBindHoverEvent(){if(!this._hoverEventBound)return;const e=this.refs.table?.value;e?.removeEventListener("mouseover",this.hoverEvents),e?.removeEventListener("mouseout",this.outEvent),this._hoverEventBound=!1}bindColumnResizeEvent(){const e=this.refs.table?.value;if(!e||this._columnResizeTable===e)return;const t=globalThis.SF?.Resizer?.attach;"function"==typeof t?(this._columnResizeDetach?.(),this._columnResizeTable=e,this._columnResizeDetach=t(e,{handles:".sf-table-column-resizer",session:e=>this.columnResizeSession(e)})):globalThis.SF?.Loader?.ensure?.(["sf-resizer"],{timeout:1/0}).then(({missing:e})=>{!e.length&&this.isConnected&&this.bindColumnResizeEvent()})}unbindColumnResizeEvent(){this._columnResizeDetach?.(),this._columnResizeDetach=null,this._columnResizeTable=null}columnResizeSession(e){const t=e?.closest?.("th"),n=t?.dataset?.key,s=n?this.getColumns().find(e=>e?.key===n):null;if(!t||!s||s.system||!1===s.resizable)return null;const i=this.refs.table?.value,r=i?.querySelector(`col[data-key="${this.escapeColumnKey(n)}"]`),a={key:n,th:t,col:r,frozenWidths:null,dragging:!1},o=()=>{this._columnResizeState=null,t.style.width=""};return{measure:()=>t.getBoundingClientRect().width,limits:()=>{const{minWidth:e,maxWidth:n}=this.getColumnResizeLimits(s,t.getBoundingClientRect().width);return{min:e,max:n}},direction:()=>i&&"rtl"===getComputedStyle(i).direction?-1:1,step:this.resolveCssLength(getComputedStyle(this).getPropertyValue("--sf-space-1"),16),start:()=>{a.dragging=!0,this._columnResizeState=a,(0,v.J)(!0),document.documentElement.classList.add("sf-table-column-resizing")},apply:e=>(a.frozenWidths??=this.freezeColumnsWidthForResize(i),this._columnResizeState=a,r&&(r.style.width=`${e}px`),t.style.width=`${e}px`,this.showColumnResizeGuide(t),e),commit:e=>{const t=a.frozenWidths??{};o(),this.applyColumnResizeWidths(n,e,t)},end:()=>{document.documentElement.classList.remove("sf-table-column-resizing"),(0,v.J)(!1),this.suppressNextHeaderClick(),o(),this.hideColumnResizeGuide()},reset:()=>{o(),this.resetColumnWidth(n)}}}get rememberedWidthsKey(){return this.viewPreferenceKey?this.viewPreferenceKey:this.hasAttribute("remember-widths")?T(this.getTableSettingsKey()||this.id||globalThis.location?.pathname||"table"):""}readRememberedWidths(){const e=this.rememberedWidthsKey;if(!e)return{};const t=C()?.read(e)?.widths;return t&&"object"==typeof t?t:{}}writeTablePreference(e,t){e&&C()?.write(e,{...C()?.read(e)??{},v:1,...t})}storeRememberedWidths(e={}){this.writeTablePreference(this.rememberedWidthsKey,{widths:{...this.readRememberedWidths(),...e}})}forgetRememberedWidth(e){const t=this.readRememberedWidths();delete t[e],this.writeTablePreference(this.rememberedWidthsKey,{widths:t})}get viewPreferenceKey(){const e=this.getAttribute("preferences-key")||this.getAttribute("table-settings-key")||"";return e?T(e):""}applyTablePreference(e,{render:t=!1}={}){const n=e?.columnSettings;if(!n||"object"!=typeof n)return!1;const s=this.getTableData().columnSettings,i=s&&"object"==typeof s&&!Array.isArray(s)?s:{},r=this.mergeColumnSettings(i,n);return t?this.setColumnSettings(r,"preferences",!1):this.state.columnSettings=r,!0}connectTablePreference(){const e=this.viewPreferenceKey;if(e===this._preferenceKeyBound)return;if(this._preferenceUnsubscribe?.(),this._preferenceKeyBound=e,this._preferenceUnsubscribe=null,this.applyTableView(),!e)return;this.applyTablePreference(C()?.read(e));const t=C()?.subscribe(e,e=>{if(e)this.applyTablePreference(e,{render:!0});else{const e=this.getTableData().columnSettings;this.setColumnSettings(e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},"preferences",!1)}this.applyTableView()}),n=C()?.subscribe(A,()=>this.applyTableView());this._preferenceUnsubscribe=()=>{t?.(),n?.()}}get tableView(){const e=this.viewPreferenceKey,t=C()?.read(A)?.view??{},n=e?C()?.read(e)?.view??{}:this._sessionView??{};return{...F,...t,...n}}applyTableView(){const e=this.tableView,t=(e,t)=>t?this.setAttribute(e,""):this.removeAttribute(e);"normal"===e.density?this.removeAttribute("data-sf-view-density"):this.setAttribute("data-sf-view-density",e.density),t("data-sf-view-stripes",!0===e.stripes),t("data-sf-view-lines",!0===e.lines),t("data-sf-view-single-line",!0===e.singleLine);const n="page"===this.getAttribute("vertical-scroll")&&!this.isList;t("data-sf-page-scroll",n),t("data-sf-sticky-head",n&&!1!==e.stickyHead)}syncStickyHead(){const e=this.refs.table?.value,t=e?.tHead;if(!t)return;let n=0;if(this.hasAttribute("data-sf-sticky-head")&&e.isConnected){const s=z(this.refs.scroll?.value?.parentElement??this),i=s?s.getBoundingClientRect().top:0,r=this.querySelector(":scope > .sf-table > .sf-table-toolbar"),a=Math.max(i,r?r.getBoundingClientRect().bottom:i),o=e.getBoundingClientRect(),l=o.height-t.offsetHeight;n=Math.round(Math.min(Math.max(a-o.top,0),Math.max(l,0)))}t.style.transform=n?`translateY(${n}px)`:"",this.toggleAttribute("data-sf-head-stuck",n>0)}syncRail(){const e=this.refs.rail?.value,t=this.refs.scroll?.value;if(!e||!t)return;const n=t.scrollWidth>t.clientWidth+1;e.hidden=!n;const s=e.firstElementChild;if(s&&(s.style.inlineSize=`${t.scrollWidth}px`),e._sfBound!==t){e._sfBound=t;let n=!1;const s=(e,t)=>()=>{n||(n=!0,t.scrollLeft=e.scrollLeft,n=!1)};t.addEventListener("scroll",s(t,e),{passive:!0}),e.addEventListener("scroll",s(e,t),{passive:!0}),this._railObserver?.disconnect(),"undefined"!=typeof ResizeObserver&&(this._railObserver=new ResizeObserver(()=>this.syncRail()),this._railObserver.observe(t),this.refs.table?.value&&this._railObserver.observe(this.refs.table.value))}n&&(e.scrollLeft=t.scrollLeft)}bindPageScroll(){if(this._pageScrollAbort)return;this._pageScrollAbort=new AbortController;const{signal:e}=this._pageScrollAbort,t=()=>{this._pageScrollFrame||(this._pageScrollFrame=requestAnimationFrame(()=>{this._pageScrollFrame=0,this.isConnected&&this.syncStickyHead()}))};document.addEventListener("scroll",t,{capture:!0,passive:!0,signal:e}),globalThis.addEventListener("resize",()=>{t(),this.syncRail()},{passive:!0,signal:e})}unbindPageScroll(){this._railObserver?.disconnect(),this._railObserver=null;const e=this.refs.rail?.value;e&&(e._sfBound=null),this._pageScrollAbort?.abort(),this._pageScrollAbort=null,cancelAnimationFrame(this._pageScrollFrame??0),this._pageScrollFrame=0}setTableView(e={},{everywhere:t=!1}={}){const n=this.viewPreferenceKey;if(t||!n){if(t){const t=C()?.read(A)??{};C()?.write(A,{...t,v:1,view:{...t.view??{},...e}})}if(n){const t={...C()?.read(n)?.view??{}};for(const n of Object.keys(e))delete t[n];this.writeTablePreference(n,{view:t})}else t||(this._sessionView={...this._sessionView??{},...e})}else this.writeTablePreference(n,{view:{...C()?.read(n)?.view??{},...e}});return this.applyTableView(),this.requestComponentUpdate("table-view"),this.emitTableEvent("view-change",Object.freeze({view:this.tableView,everywhere:t})),this}resetTableView(){const e=this.viewPreferenceKey;return e&&this.writeTablePreference(e,{view:{}}),this._sessionView=null,this.applyTableView(),this.requestComponentUpdate("table-view"),this}restoreRememberedWidths(){const e=this.readRememberedWidths(),t=new Set((this.getColumns?.()??[]).map(e=>e?.key)),n=Object.fromEntries(Object.entries(e).filter(([e,n])=>t.has(e)&&"string"==typeof n).map(([e,t])=>[e,{width:t}]));Object.keys(n).length&&this.patchColumnSettingsBatch(n,"column-widths-restore")}resetColumnWidth(e){return e?(this.forgetRememberedWidth(e),this.patchColumnSettingsBatch({[e]:{width:null}},"column-resize-reset")):this}get columnDragActive(){return document.documentElement.hasAttribute("data-sf-sortable-active")}bindColumnDragEvent(){const e=this.refs.table?.value,t=e?.tHead?.rows?.[0];if(!t||this._headerSortableRow===t)return;const n=globalThis.SF?.Sortable?.attach;"function"==typeof n?(this._headerSortableDetach?.(),this._headerSortableRow=t,this._headerSortableDetach=n(t,{items:"th[data-key]",extent:e,preview:"line",label:this.text("settingsColumnLabel"),groupOf:e=>this.headerColumnGroup(e.dataset.key),canStart:(e,t)=>!this._columnResizeState&&!this.getColumnResizeHandle(e.target)&&["pinned","loose"].includes(this.headerColumnGroup(t.dataset.key)),cellsOf:t=>[...e.rows].map(e=>e.cells[t.cellIndex]).filter(Boolean),onIntent:e=>this.onHeaderColumnIntent(e)})):globalThis.SF?.Loader?.ensure?.(["sf-sortable"],{timeout:1/0}).then(({missing:e})=>{!e.length&&this.isConnected&&this.bindColumnDragEvent()})}unbindColumnDragEvent(){this._headerSortableDetach?.(),this._headerSortableDetach=null,this._headerSortableRow=null}headerColumnGroup(e){if(this.getSystemColumns().some(t=>String(t.key)===e))return"system";const t=this.getColumns().find(t=>String(t.key)===e);return!t||t.system||!1===t.draggable?"fixed":this.isColumnPinned(t)?"pinned":"loose"}onHeaderColumnIntent({item:e,index:t,group:n}){const s=this.refs.table?.value,i=[...s?.tHead?.rows?.[0]?.cells??[]].map(e=>e.dataset?.key).filter(e=>e&&["pinned","loose","fixed"].includes(this.headerColumnGroup(e))),r=i.filter(t=>t!==e&&this.headerColumnGroup(t)===n),a=i.filter(t=>t!==e),o=r[t],l=r[t-1],c=void 0!==o?a.indexOf(o):void 0!==l?a.indexOf(l)+1:a.length;return a.splice(c,0,e),a.join("|")===i.join("|")?this:this.applyColumnOrder(a,{})}getColumnResizeHandle(e){return e instanceof Element?e.closest("[data-sf-column-resizer]"):null}parseColumnSize(e,t=null){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){const t=e.trim();if(/^-?\d+(\.\d+)?px$/.test(t))return parseFloat(t)}return t}resolveCssLength(e,t=0){const n=String(e||"").trim().match(/^(-?\d+(?:\.\d+)?)(px|rem|em)$/);if(!n)return t;const s=Number(n[1]),i=n[2];if("px"===i)return s;const r="rem"===i?document.documentElement:this,a=parseFloat(getComputedStyle(r).fontSize);return Number.isFinite(a)?s*a:t}getColumnResizeLimits(e={},t=0){const n=this.resolveCssLength(getComputedStyle(this).getPropertyValue("--sf-c4"),t),s=this.parseColumnSize(e.minWidth,null)??n,i=this.parseColumnSize(e.maxWidth,1/0);return{minWidth:s,maxWidth:Math.max(i,s)}}hasColumnSize(e={}){return[e.colWidth,e.width,e.size].some(e=>null!=e&&""!==String(e).trim())}escapeColumnKey(e){const t=String(e||"");return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}freezeColumnsWidthForResize(e){const t={};return this.getColumns().forEach(n=>{if(!n?.key)return;const s=String(n.key),i=this.escapeColumnKey(s),r=e?.querySelector(`th[data-key="${i}"]`),a=e?.querySelector(`col[data-key="${i}"]`),o=r?.getBoundingClientRect?.().width||0;if(!o)return;const l=`${Math.round(o)}px`;a&&(a.style.width=l),n.system||this.hasColumnSize(n)||(t[s]=l)}),t}applyColumnResizeWidths(e,t,n={}){if(!e)return this;const s={...n||{},[e]:`${Math.round(t)}px`};this.storeRememberedWidths(s);const i=Object.fromEntries(Object.entries(s).map(([e,t])=>[e,{width:t}]));return this.patchColumnSettingsBatch(i,"column-resize")}reorderColumnDomByKeys(e,t=[]){if(!e||!Array.isArray(t)||!t.length)return;const n=(e,n)=>{if(!e)return;const s=new Set(t);let i=null;for(const t of Array.from(e.children||[])){const e=t?.dataset?.key;if(e&&s.has(e))break;e&&(i=t)}t.forEach(t=>{const s=this.escapeColumnKey(t),r=e.querySelector(`${n}[data-key="${s}"]`);r&&(e.insertBefore(r,i?.nextSibling||e.firstChild),i=r)})};n(e.querySelector("colgroup"),"col"),n(e.tHead?.rows?.[0],"th"),Array.from(e.tBodies||[]).forEach(e=>{Array.from(e.rows||[]).forEach(e=>{n(e,"td")})})}applyColumnOrder(e=[],t={}){if(!Array.isArray(e)||!e.length)return this;const n={},s=this.getColumnOrderSlots(e);return e.forEach((e,i)=>{n[e]={order:s[i]},t?.[e]&&(n[e].width=t[e])}),this.patchColumnSettingsBatch(n,"column-drag")}getColumnOrderSlots(e=[]){const t=(this.getTableData().columns||[]).filter(e=>e?.key&&!e.system),n=(e,t)=>{const n=(this.getColumnSetting(e.key)||{}).order??e.order,s=Number(n);return Number.isFinite(s)?s:10*(t+1)},s=new Map(t.map((e,t)=>[String(e.key),n(e,t)])),i=e.map(e=>s.get(String(e))).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),r=new Set(i);return i.length!==e.length||r.size!==i.length?e.map((e,t)=>10*(t+1)):i}setColumnResizeClasses(e,t=0){e&&(e.classList.add("is-resizing"),e.classList.toggle("is-resizing-forward",t>=0),e.classList.toggle("is-resizing-backward",t<0),this.showColumnResizeGuide(e),this.measurePinnedColumns())}clearColumnResizeClasses(e){e&&(e.classList.remove("is-resizing","is-resizing-forward","is-resizing-backward"),this.hideColumnResizeGuide(),this.measurePinnedColumns())}bindContextEvent(){this._contextEventBound||(document.addEventListener("click",this.contextEvent),document.addEventListener("keydown",this.contextKeyEvent),this._contextEventBound=!0)}unbindContextEvent(){this._contextEventBound&&(document.removeEventListener("click",this.contextEvent),document.removeEventListener("keydown",this.contextKeyEvent),this._contextEventBound=!1)}contextKeyEvent(e){"Escape"===e.key&&this.state.contextMenu?.open&&(e.preventDefault(),e.stopPropagation(),this.closeContextMenu(!0))}getPortalContainer(){if(this._portalContainer?.isConnected)return this._portalContainer;const e=document.createElement("form");e.className="sf-table-portal",e.noValidate=!0,e.dataset.tableSettingsKey=this.getTableSettingsKey(),e.dataset.sfInstance=this.getInstanceId(),"function"==typeof e.showPopover&&e.setAttribute("popover","manual"),e.addEventListener("submit",e=>e.preventDefault());for(const t of["change","input"])e.addEventListener(t,e=>e.stopPropagation());return this.insertBefore(e,this.firstChild),globalThis.SF?.Loader?.watch?.(e),this._portalContainer=e,e}showPortal(){const e=this._portalContainer;e?.isConnected&&"function"==typeof e.showPopover&&(e.matches(":popover-open")||e.showPopover())}hidePortal(){const e=this._portalContainer;e?.isConnected&&"function"==typeof e.hidePopover&&e.matches(":popover-open")&&e.hidePopover()}getVisualViewportRect(){const e=window.visualViewport;return{left:e?.offsetLeft||0,top:e?.offsetTop||0,right:(e?.offsetLeft||0)+(e?.width||window.innerWidth),bottom:(e?.offsetTop||0)+(e?.height||window.innerHeight)}}clampContextMenusToViewport(){const e=this._portalContainer;if(!e?.isConnected)return;const t=this.getVisualViewportRect(),n=getComputedStyle(document.documentElement),s=parseFloat(n.getPropertyValue("--sf-space-1/3"))||0,i=new Set;e.querySelectorAll("sf-menu-context").forEach(e=>{if(this.anchorContextMenu(e,t,s))return void i.add(e);const n=Math.max(0,t.right-t.left-2*s),r=Math.max(0,t.bottom-t.top-2*s);e.style.setProperty("--sf-table-context-menu--available-inline-size",`${n}px`),e.style.setProperty("--sf-context-menu-available-inline-size",`${n}px`),e.style.setProperty("--sf-context-menu-available-block-size",`${r}px`),e.style.translate="";const a=(e.querySelector(":scope > .sf-context-menu")||e).getBoundingClientRect();let o=0,l=0;a.left<t.left+s?o=t.left+s-a.left:a.right>t.right-s&&(o=t.right-s-a.right),a.top<t.top+s?l=t.top+s-a.top:a.bottom>t.bottom-s&&(l=t.bottom-s-a.bottom),(o||l)&&(e.style.translate=`${o}px ${l}px`)});for(const[e,t]of this._contextPositions||[])i.has(e)||(t.controller.stop(),this._contextPositions.delete(e))}describeContextAnchor(e){if(!(e instanceof Element))return null;const t=e.closest("[data-item], th[data-key], [id]");if(!t||!this.contains(t))return null;const n=void 0!==t.dataset.item?`[data-item="${this.escapeColumnKey(t.dataset.item)}"]`:t.matches("th[data-key]")?`th[data-key="${this.escapeColumnKey(t.dataset.key)}"]`:`[id="${this.escapeColumnKey(t.id)}"]`,s=e.tagName.toLowerCase();return{selector:n,tag:s,index:t===e?-1:Array.from(t.querySelectorAll(s)).indexOf(e)}}resolveContextAnchor(e){if(e?.anchor instanceof Element&&e.anchor.isConnected)return e.anchor;const t=e?.anchorRef,n=t?this.querySelector(t.selector):null,s=n&&(t.index<0?n:n.querySelectorAll(t.tag)[t.index]);return s?(e.anchor=s,s):null}getContextMenuPlacement(e){const t=e.hasAttribute("data-context-submenu"),n=t?this.state.contextMenu?.submenu:this.state.contextMenu,s=this.resolveContextAnchor(n);if(!s)return null;const i=String(n.position||(t||"left"===n.type?"left":"")),r=/^(left|right)(-top|-bottom)?$/.exec(i);if(!r){return{anchor:s,side:"block-end",align:["create","toolbar-actions"].includes(n.menu)?"end":"start",tail:null}}const a=r[2]||"";return{anchor:s,side:"left"===r[1]?"inline-end":"inline-start",align:"-top"===a?"start":"-bottom"===a?"end":"center",tail:a}}anchorContextMenu(e,t,n){const s=this.getContextMenuPlacement(e);if(!s)return!1;const i=e.querySelector(":scope > .sf-context-menu");if(!i)return!1;this._contextPositions=this._contextPositions||new Map;const r=this._contextPositions.get(e),a=r?.cssCap??(parseFloat(getComputedStyle(i).maxWidth)||1/0),o=`${Math.max(0,Math.min(t.right-t.left-2*n,a))}px`;i.style.setProperty("--sf-table-context-menu--available-inline-size",o),i.style.setProperty("--sf-context-menu-available-inline-size",o);const l=`${s.side}|${s.align}`;if(r&&r.anchor===s.anchor&&r.surface===i&&r.key===l)return r.controller.update(),!0;r?.controller.stop(),i.style.transform="none",i.style.translate="none",i.style.setProperty("--sf-context-menu-available-block-size",`${Math.max(0,t.bottom-t.top-2*n)}px`);const c=P(),u=null===s.tail?c.resolveLength("calc(var(--sf-focus-outline-width) * 2)",i):c.resolveLength("var(--sf-context-menu-tail-corner-offset)",i),d=s.anchor.getBoundingClientRect(),h=c.anchor(s.anchor,i,{side:s.side,align:s.align,offset:u,alignmentOffset:"center"===s.align||null===s.tail?0:Math.max(0,d.height/2-u),padding:n,fitHeight:!1,onPosition:({side:t})=>{const r=s.anchor.getBoundingClientRect(),a=this.getVisualViewportRect(),o="block-end"===t?a.bottom-n-r.bottom-u:"block-start"===t?r.top-u-n-a.top:a.bottom-a.top-2*n,l=`${Math.max(0,Math.floor(o))}px`;if(i.style.getPropertyValue("--sf-context-menu-available-block-size")!==l&&i.style.setProperty("--sf-context-menu-available-block-size",l),null!==s.tail){const n=`${"inline-end"===t?"left":"right"}${s.tail}`;e.getAttribute("position")!==n&&e.setAttribute("position",n)}}});return this._contextPositions.set(e,{controller:h,anchor:s.anchor,surface:i,key:l,cssCap:a}),document.fonts?.ready?.then(()=>{this._contextPositions?.get(e)?.controller===h&&h.update()}).catch(()=>{}),!0}stopContextMenuPositions(){for(const e of this._contextPositions?.values()||[])e.controller.stop();this._contextPositions?.clear()}contextViewportEvent(){requestAnimationFrame(()=>this.clampContextMenusToViewport())}bindContextViewport(){this._contextViewportBound||(window.addEventListener("resize",this.contextViewportEvent),window.visualViewport?.addEventListener("resize",this.contextViewportEvent),window.visualViewport?.addEventListener("scroll",this.contextViewportEvent),this._contextViewportBound=!0)}unbindContextViewport(){this._contextViewportBound&&(window.removeEventListener("resize",this.contextViewportEvent),window.visualViewport?.removeEventListener("resize",this.contextViewportEvent),window.visualViewport?.removeEventListener("scroll",this.contextViewportEvent),this._contextViewportBound=!1)}openContextMenu(e,t={}){this.closeContextMenu(!1),this.contextTarget?.classList.remove("active");const n=e.currentTarget instanceof Element?e.currentTarget:e.target instanceof Element?e.target:null;if(!n)return;const s=(e.composedPath?.()||[]).filter(e=>e instanceof Element).map(e=>e.closest?.('button, input, select, textarea, a[href], [role="button"]')).find(e=>e&&(e===n||n.contains(e))),i=e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0},r=s||i(n)?n:Array.from((n.shadowRoot||n).querySelectorAll?.("*")||[]).find(i)||n;this.contextTarget=s||r,this.contextTarget.classList.add("active");let a=t.anchorSelector&&this.contextTarget.closest?.(t.anchorSelector)||this.contextTarget,o=a.getBoundingClientRect();e.preventDefault(),e.stopPropagation();let l={open:!0,id:this.contextTarget,...t},c={};switch(t.type){case"left":c={x:o.left+o.width,y:o.y+o.height/2};break;case"bottom":{let n=null;t.parent&&(n=(0,y.PA)(e.target),o=n.getBoundingClientRect(),a=n),c={x:o.left,y:o.y+o.height};break}default:c={x:o.left,y:o.y+o.height}}l={...l,...c,anchor:a,anchorRef:this.describeContextAnchor(a)},"table-settings"===l.menu&&(this._columnSettingsOnOpen=JSON.parse(JSON.stringify(this.getColumnSettings()||{}))),this.set({contextMenu:{...l}})}resolveBoxedAnchor(e,t){if(!(t instanceof Element))return t;const n=e=>{const t=e?.getBoundingClientRect?.();return Boolean(t)&&(t.width>0||t.height>0)},s=(e?.composedPath?.()||[]).filter(e=>e instanceof Element).map(e=>e.closest?.('button, input, select, textarea, a[href], [role="button"]')).find(e=>e&&(e===t||t.contains(e)));if(s&&n(s))return s;if(n(t))return t;return Array.from((t.shadowRoot||t).querySelectorAll?.("*")||[]).find(n)||t}redrawWhenComponentsUpgrade(e=this){if(!e?.querySelectorAll)return this;this._awaitedComponents=this._awaitedComponents||new Set;const t=new Set(Array.from(e.querySelectorAll("*")).map(e=>e.tagName.toLowerCase()).filter(e=>e.includes("-")&&!customElements.get(e)));for(const e of t)this._awaitedComponents.has(e)||(this._awaitedComponents.add(e),customElements.whenDefined(e).then(()=>{this.requestComponentUpdate("component-upgrade")}).catch(()=>{}));return this}openContextSubmenu(e,t={}){e.preventDefault(),e.stopPropagation();const n=e.target instanceof Element?e.target:null,s=e.currentTarget instanceof Element?e.currentTarget:n;if(!s)return;const i=this.resolveBoxedAnchor(e,s),r=i.getBoundingClientRect(),a=t.anchorKey||t.template?.key||s.dataset?.contextSubmenuAnchor||"";if(a&&this.state.contextMenu?.submenu?.open&&this.state.contextMenu.submenu.anchorKey===a)return void this.closeContextSubmenu();const o={open:!0,type:t.type,anchorKey:a,x:r.left+r.width,y:r.y+r.height/2,position:t.position||"left",transform:-50,...t,anchor:i,anchorRef:this.describeContextAnchor(i)};this.set(e=>({contextMenu:{...e.contextMenu||{},submenu:o}}))}handleContextLayerClick(e){const t=e.target;t instanceof Element&&(t.closest("[data-context-submenu]")||t.closest("[data-context-submenu-anchor]")||this.state.contextMenu?.submenu?.open&&!t.closest("[data-context-main-menu]")&&this.closeContextSubmenu())}closeContextSubmenu(){this.set(e=>({contextMenu:{...e.contextMenu||{},submenu:null}}))}renderCellElement(e,t={}){const n=(0,s.canonicalTag)(`sf-${String(e??"").replace(/^sf-/u,"")}`);if(!(_.has(n)&&!0!==t.interactive&&!0!==t.closable&&"checkbox"!==t.type&&!Object.keys(t).some(e=>e.startsWith("@")||/^on[A-Z]/u.test(e))?customElements.get(n):null))return this.renderSmartElement(e,t);this._lightCells??=new Map;let i=this._lightCells.get(n);if(i||(i=document.createElement(n),this._lightCells.set(n,i)),"function"!=typeof i.template)return this.renderSmartElement(e,t);for(const e of[...i.getAttributeNames()])i.removeAttribute(e);const r="1"!==this.size&&"1"===String(t.size)?this.size:t.size;for(const[e,n]of Object.entries({...t,...void 0!==r?{size:r}:{}})){if(null==n||!1===n)continue;const t=e.replace(/[A-Z]/gu,e=>`-${e.toLowerCase()}`);"object"==typeof n||"function"==typeof n?i[e]=n:i.setAttribute(t,!0===n?"":String(n))}try{return i.template()}catch{return this.renderSmartElement(e,t)}}renderSmartElement(e,t={}){e=(0,s.canonicalTag)(`sf-${String(e??"").replace(/^sf-/u,"")}`);const n=this.size;return"1"!==n&&t&&"1"===String(t.size)?super.renderSmartElement(e,{...t,size:n}):super.renderSmartElement(e,t)}get size(){return this.getEnumAttr("size",["1/2","1"],"1")}getSelectColumn(){return{...this.TABLE_SELECT_COLUMN,component:{...this.TABLE_SELECT_COLUMN.component,props:{...this.TABLE_SELECT_COLUMN.component?.props||{},checked:Boolean(this.state?.settingsChecked),indeterminate:Boolean(this.state?.selectIndeterminate)}}}}getColumns(){const e=this.getTableData().columns||[],t=this.getSystemColumns(),n=new Set(t.map(e=>e.key)),s=new Set(["actions"]),i=new Map(e.map((e,t)=>[e?.key,t])),r=e.filter(e=>e?.key&&!n.has(e.key)).map(e=>{const t=this.getColumnSetting(e.key),n={...e,...t};return t.width&&(n.colWidth=t.width),n}).sort((e,t)=>{const n=e=>{const t=e?.order;return null!=t&&""!==t&&Number.isFinite(Number(t))?Number(t):i.get(e?.key)??0},s=n(e),r=n(t);return s===r?(i.get(e.key)??0)-(i.get(t.key)??0):s-r}),a=t.filter(e=>!s.has(e?.key)),o=t.filter(e=>s.has(e?.key)),l=[...a,...r.filter(e=>this.isColumnPinned(e)),...r.filter(e=>!this.isColumnPinned(e)),...o].filter(e=>!1!==e?.visible),c=this._responsiveWidth||this.clientWidth||0;if(this.isList||!c||!r.some(e=>void 0!==e.priority))return l;const u=e=>{const t=e.min_width??e.minWidth??e.width,n="number"==typeof t?t:Number.parseFloat(String(t??""));return Number.isFinite(n)&&n>0?n:e.system?48:160},d=new Set(l);let h=l.reduce((e,t)=>e+u(t),0);const p=r.filter(e=>!1!==e.visible).sort((e,t)=>(t.priority??0)-(e.priority??0));for(const e of p){if(h<=c||d.size<=t.length+1)break;d.delete(e),h-=u(e)}return l.filter(e=>d.has(e))}isColumnPinned(e){if(!e?.key)return!1;if("select"===e.key||"settings"===e.key)return!0;if(e.system)return!1;const t=this.tempSettings?.cols?.[e.key],n=this.getColumnSetting(e.key)||{},s=t?.pinned??n.pinned??e.pinned;return"boolean"==typeof s?s:"title"===e.role}getPinnedColumnKeys(e=this.getColumns()){return e.filter(e=>e?.key&&this.isColumnPinned(e)).map(e=>e.key)}isPinnedColumn(e){return!!e?.key&&(!!["start","end"].includes(e.sticky)||this.isColumnPinned(e))}getStickyCellStyle(e,t){const n=e[t];if(!this.isPinnedColumn(n))return"";return`position: sticky; inset-inline-${["start","end"].includes(n.sticky)?n.sticky:"start"}: var(--sf-table-pin-${n.key}, 0px); z-index: 2;`}measurePinnedColumns(){const e=this.refs.table?.value,t=this.refs.scroll?.value;if(!e)return this;const n=this.getPinnedColumnKeys(),s=e.querySelector("thead tr"),i=n.map(e=>{const t=s?.querySelector(`th[data-key="${e}"]`);return t?t.getBoundingClientRect().width:0});let r=0;n.forEach((t,n)=>{const s=`${Math.round(r)}px`;e.style.getPropertyValue(`--sf-table-pin-${t}`)!==s&&e.style.setProperty(`--sf-table-pin-${t}`,s),r+=i[n]});const a=n[n.length-1],o=new Set(a?e.querySelectorAll(`[data-key="${a}"]`):[]);for(const t of e.querySelectorAll("[data-sf-pin-edge]"))o.has(t)||t.removeAttribute("data-sf-pin-edge");for(const e of o)e.hasAttribute("data-sf-pin-edge")||e.setAttribute("data-sf-pin-edge","");if(t){Math.abs(t.scrollLeft)>0?t.setAttribute("data-sf-pin-scrolled",""):t.removeAttribute("data-sf-pin-scrolled")}return this}bindPinnedColumnScroll(){const e=this.refs.scroll?.value;return e&&this._pinnedScrollBound!==e?(this._pinnedScrollBound=e,e.addEventListener("scroll",()=>this.measurePinnedColumns(),{passive:!0}),this):this}getRowSelectLabel(e){const t=this._labelColumnBatch,n=t&&"column"in t?t.column:this.getColumnItems().find(e=>e?.key&&!e.system&&"select"!==e.key&&"settings"!==e.key);t&&(t.column=n);const s=n?e?.[n.key]:void 0,i=null!==s&&"object"==typeof s?s.text??s.label??s.value??"":s,r=String(i??"").trim()||String(e?.id??"").trim();return r?`${this.text("selectRowLabel")}: ${r}`:this.text("selectRowLabel")}createRowComponentCell(e,t={}){return e?.type?{component:{type:e.type,props:{...e.props||{},...t}}}:null}async openRowMenu(e,t={}){const n=e?.currentTarget?.querySelector?.("button")??e?.target?.closest?.("button")??e?.currentTarget;if(!(n instanceof Element))return null;const s=Array.isArray(t.actions)&&t.actions.every(e=>"string"==typeof e)?t.actions:null,i=this.getActionRowItems(t),r=e=>e?.icon??e?.component?.props?.icon??void 0,a=i.map(e=>Array.isArray(e.members)?{id:e.id,text:e.name,icon:r(e),submenu:e.members.filter(e=>!s||s.includes(e.id)).map(e=>({id:e.id,text:e.name,icon:r(e),danger:!0===e.danger}))}:{id:e.id,text:e.name,icon:r(e),danger:!0===e.danger});await(globalThis.SF?.Loader?.ensure?.(["sf-menu-context"]));const o=this.rowMenu();return o.setAttribute("aria-label",this.getContextMenuLabel({row:t,menu:"row-settings"})),o.entries=a,this._rowMenuContext={row:t,items:i,anchor:n},o.toggleFor(n)}rowMenu(){if(this._rowMenu?.isConnected)return this._rowMenu;const e=document.createElement("sf-menu-context");return e.setAttribute("popup",""),e.dataset.sfTableMenu="row",e.addEventListener("sf-menu-context-select",e=>{const t=this._rowMenuContext;if(!t)return;const n=e.detail?.id,{row:s,items:i,anchor:r}=t,a=i.find(e=>e.id===n),o=a?null:i.flatMap(e=>e.members??[]).find(e=>e.id===n);if(o)return void this.requestActionIntent(o.id,[s.id]);const l=a?.component?.props?.["@click"]??a?.component?.props?.onClick;"function"==typeof l?l({currentTarget:r,target:r,preventDefault(){},stopPropagation(){}}):a&&this.requestActionIntent(a.id,[s.id])}),(this.closest("dialog[open]")||document.body).append(e),this._rowMenu=e,e}rowActionItems(e={}){const t=Array.isArray(e?.actions)&&e.actions.every(e=>"string"==typeof e)?e.actions.join(","):"*",n=(this.ACTIONS_SETTINGS_ROW??[]).map(e=>e?.id??"").join(",");this._rowActionListKey!==n&&(this._rowActionListKey=n,this._rowActionItems=new Map);const s=`${e?.id??""}|${t}`;return this._rowActionItems||(this._rowActionItems=new Map),this._rowActionItems.has(s)||this._rowActionItems.set(s,this.getActionRowItems(e)),this._rowActionItems.get(s)}getActionRowItems(e={},t=this.ACTIONS_SETTINGS_ROW){const n=Array.isArray(e.actions)&&e.actions.every(e=>"string"==typeof e)?e.actions:null,s=e=>(e.members||[]).filter(e=>!n||n.includes(e.id));return t.filter(e=>Array.isArray(e.members)?s(e).length>0:!n||n.includes(e.id)).map(t=>{if(Array.isArray(t.members)){const n=s(t),i={...t.component?.props||{}};return i["@click"]=s=>this.openContextMenu(s,{type:"left",row:e,action:t,menu:"row-settings",items:n.map(t=>({component:"sf-button",props:{appearance:"link",scheme:t.danger?"error":"on-surface",text:t.name,"@click":()=>{this.requestActionIntent(t.id,[e.id]),this.closeContextMenu()}}}))}),{...t,component:{...t.component||{},props:i}}}const n=t.component||{},i={...t.props||{},...n.props||{}},r=t.menu||i.menu,a="function"==typeof i["@click"]||"function"==typeof i.onClick;return r&&!a?i["@click"]=n=>{const s=r&&"object"==typeof r?r:{menu:r};this.openContextMenu(n,{type:"left",row:e,action:t,...s})}:a||(i["@click"]=()=>this.requestActionIntent(t.id,[e.id])),{...t,component:{...n,props:i}}})}getDefaultRowCell(e,t){return e?.key?"select"===e.key?this.createRowComponentCell(e.rowComponent,{checked:!!this.state.settingsChecked||Boolean(t?.selected||t?.checked),value:t?.id??t?.value??"",ariaLabel:this.getRowSelectLabel(t),"@change":e=>{this.applyRowSelection(t.id,Boolean(e.target.checked),{range:!0===this._selectRangeModifier})}}):"settings"===e.key?this.createRowComponentCell(e.rowComponent||{type:"button-icon",props:{size:"1",appearance:"link",scheme:"on-surface",icon:"menu",ariaLabel:this.text("menuLabel"),value:"menu","@click":e=>this.openRowMenu(e,t)}}):"actions"===e.key?this.getActionRowItems(t):null:null}normalizeRow(e={},t=this.getSystemColumns()){if(!e||"object"!=typeof e||Array.isArray(e))return e;if(t.every(t=>!t?.key||!1===t.visible||void 0!==e[t.key]))return e;const n={...e};return t.forEach(e=>{if(!e?.key||void 0!==n[e.key]||!1===e.visible)return;const t=this.getDefaultRowCell(e,n);t&&(n[e.key]=t)}),n}normalizeRows(e=[]){if(!Array.isArray(e))return[];const t=this.getSystemColumns();this._labelColumnBatch={};try{return e.map(e=>this.normalizeRow(e,t))}finally{this._labelColumnBatch=null}}setTableData(e={},t="data"){const n=this.getTableData(),s="function"==typeof e?e(n):e;if(!s||"object"!=typeof s)return this;const i=this.set({data:{...n,...s}},t);return this.syncSelectionPort(),Object.prototype.hasOwnProperty.call(s,"rows")&&this.syncSelectAllState(),i}setColumns(e=[],t="columns"){const n=this.getTableData().columns||[],s="function"==typeof e?e(n):e,i=this.setTableData({columns:Array.isArray(s)?s:[]},t);return this.rememberedWidthsKey&&this.restoreRememberedWidths(),i}addColumns(e=[]){const t=Array.isArray(e)?e:[e];return this.setColumns(e=>[...e,...t.filter(Boolean)])}updateColumn(e,t={},n="columns"){return e?this.setColumns(n=>n.map((n,s)=>{if(!n||n.key!==e)return n;const i="function"==typeof t?t(n,s):t;return{...n,...i||{}}}),n):this}rowsGeneration(){return this._rowsGeneration??0}setRows(e=[],t="rows"){const n=this.getTableData().rows||[],s="function"==typeof e?e(n):e;return"result"===t&&Array.isArray(s)&&G(n,s)&&(this._rowsGeneration=(this._rowsGeneration??0)+1),this.setTableData({rows:this.normalizeRows(s)},t)}addRows(e=[],t="rows"){this.isActionParameters?.(e,["rows"])&&(e=e.rows??[]);const n=Array.isArray(e)?e:[e];return this.setRows(e=>[...e,...n.filter(Boolean)],t),{outcome:"applied"}}updateRowsByKey(e,t,n={},s="rows"){if(!e)return this;const i="function"==typeof n?n:e=>({...e,...n||{}});return this.setRows(n=>n.map((n,s)=>{if(!n||n[e]!==t)return n;const r=i(n,s);return r&&"object"==typeof r?r:n}),s)}updateRowByKey(e,t,n={},s="row"){return this._entryOnly=!0,this.updateRowsByKey(e,t,n,s)}updateRows(e={},t="rows"){const n="function"==typeof e?e:t=>({...t,...e||{}});return this.setRows(e=>e.map((e,t)=>{const s=n(e,t);return s&&"object"==typeof s?s:e}),t)}updateRowCell(e,t,n,s={},i="cell"){return n?this.updateRowsByKey(e,t,e=>{const t=e&&e[n]&&"object"==typeof e[n]?e[n]:{},i="function"==typeof s?s(t,e):s;return{...e,[n]:{...t,...i||{}}}},i):this}updateRowCellProps(e,t,n,s={},i="cell-props"){return this.updateRowCell(e,t,n,e=>({component:{...e.component||{},props:{...e.component?.props||{},..."function"==typeof s?s(e.component?.props||{},e):s||{}}}}),i)}closeContextMenu(e=!0){const t=this.contextTarget;this.set({contextMenu:{open:!1}}),this.stopContextMenuPositions(),(0,f.render)(null,this.getPortalContainer()),this.hidePortal(),this.refs.contextMenu&&(this.refs.contextMenu.value=null),this.unbindContextEvent(),this.unbindContextViewport(),this.contextTarget?.classList.remove("active"),this.contextTarget=null,e&&t?.isConnected&&"function"==typeof t.focus&&requestAnimationFrame(()=>t.focus())}get templateName(){return this.getAttribute("template")||"default"}get dataState(){const e=this.getEnumAttr("data-state",["loading","ready","populated","empty","error"],"auto");return"ready"===e?"populated":e}setDataState(e="auto"){const t="ready"===e?"populated":e,n=["loading","populated","empty","error"].includes(t)?t:"auto";return"auto"===n?this.removeAttribute("data-state"):this.setAttribute("data-state",n),this}requestRetry(){return this.emitTableEvent("refresh",{}),{outcome:"applied"}}get emptyContext(){return this._emptyContext}set emptyContext(e){this._emptyContext=e&&"object"==typeof e?{...e}:null,this.requestComponentUpdate("empty-context")}resetQuery(e="both"){return"search"!==e&&this.removeFilterTag(),"filters"!==e&&(this.clearSearchDebounce(),this._searchPendingProps=null,this.state.search?.value?this.updateSearchState({value:""}):this.emitTableEvent("search-change",{search:""})),this}emptyBrick(e){const t=this._emptyContext??{},n="1/2"===this.size?"1/2":"1",s=String(t.headingLevel??3),i="string"==typeof t.message?t.message.trim():"";if("error"===e)return{kind:"error",size:n,headingLevel:s,title:i||this.getAttribute("error-text")||"",text:"",live:t.caused?"alert":"auto",actions:[{id:"retry",text:this.text("retryText","retry-text"),appearance:"outline"}]};const r=["no-access","nothing-found"].includes(t.kind)?t.kind:"no-data";if("no-access"===r)return{kind:r,size:n,headingLevel:s,title:i,text:"",actions:[]};if("nothing-found"===r){const e={search:"resetSearchText",filters:"resetFiltersText"}[t.reset]??"resetBothText";return{kind:r,size:n,headingLevel:s,title:"",text:"",actions:[{id:"reset-query",text:this.text(e),appearance:"outline"}]}}const a=this.getBooleanAttr("actions",!0)&&this.getBooleanAttr("creatable",!0);return{kind:r,size:n,headingLevel:s,title:this.getAttribute("empty-text")||"",text:this.getAttribute("empty-description")||"",actions:a?[{id:"create",text:this.text("createText","create-text")}]:[]}}disconnectedCallback(){this.unbindWindowScroll(),this._rowMenu?.close?.({restoreFocus:!1}),this._rowMenu?.remove(),this._rowMenu=null;for(const e of this._filterOptionPages.values())e.controller?.abort(),clearTimeout(e.searchTimer);this._filterOptionPages.clear(),this._responsiveObserver?.disconnect(),this._responsiveObserver=null,this._responsiveWidth=0,this._responsiveTarget=null,this._preferenceUnsubscribe?.(),this._preferenceUnsubscribe=null,this._preferenceKeyBound=void 0,this._rowActionsAbort?.abort(),this._rowActionsAbort=null,this._rowActionsTable=null,this.unbindPageScroll(),this._lateLayoutAbort?.abort(),this._lateLayoutAbort=null,cancelAnimationFrame(this._lateLayoutFrame??0),this._lateLayoutFrame=0,this.clearSearchDebounce(),this._searchPendingProps=null,this._searchHoldKey="",this.stopContextMenuPositions(),this.unbindContextEvent(),this.unbindContextViewport(),this.unBindHoverEvent(),this.unbindColumnResizeEvent(),this.unbindColumnDragEvent(),this.tempSettings=null,this._selectionPortKey="[]",this._abandonedQuery=null!==this._pendingQuerySequence,this._pendingQuerySequence=null,this.state.contextMenu={open:!1},this.state.settingsChecked=!1,this.state.selectIndeterminate=!1;const e=this.getTableData();this.state.data={...e,rows:e.rows.map(e=>({...e,selected:!1,checked:!1,...e.select?.component?{select:{...e.select,component:{...e.select.component,props:{...e.select.component.props,checked:!1}}}}:{}}))},this.refs.contextMenu&&(this.refs.contextMenu.value=null),this.contextTarget?.classList?.remove("active"),this.contextTarget=null,this._portalContainer&&((0,f.render)(null,this._portalContainer),this._portalContainer.remove(),this._portalContainer=null),super.disconnectedCallback()}text(e,t){return t&&this.getAttribute(t)||(0,b.pageText)(E,e,this)}templateContext(){this._renderedCramped=this.columnsAreCramped;const e=this.getPropsContext();return this.createTemplateContext({...e,component:this,list:this.isList,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),filterText:this.text("filterText","filter-text"),clearText:this.text("clearText","clear-text"),searchPlaceholder:this.text("searchPlaceholder","search-placeholder"),createText:this.text("createText","create-text"),pinColumnLabel:this.text("pinColumnLabel","pin-column-label"),unpinColumnLabel:this.text("unpinColumnLabel","unpin-column-label"),loadingText:this.text("loadingText","loading-text"),emptyText:this.text("emptyText","empty-text"),errorText:this.text("errorText","error-text"),retryText:this.text("retryText","retry-text"),columnMoveLabel:this.text("columnMoveLabel","column-move-label"),filterApplyText:this.text("filterApplyText","filter-apply-text"),columnSearchPlaceholder:this.text("columnSearchPlaceholder","column-search-placeholder"),columnSearchEmptyText:this.text("columnSearchEmptyText","column-search-empty-text")})}setCheckboxHeight(){if(!this.refs.items.size)return;const e=++this._checkboxMeasureToken;requestAnimationFrame(()=>{if(!this.isConnected||e!==this._checkboxMeasureToken)return;const t=(0,y.lF)(this.refs.items);if(!t)return;const{item:n,gap:s,parent:i}=t;this.parentGap=s;const r=n.tagName.toLowerCase().startsWith("sf-")?n.children[0]?.clientHeight:n.clientHeight;if(!r)return;const a=(r+s)*(i.dataset.size||8);if(i.clientHeight<=a)return!1;i.setAttribute("style",`height: ${a}px; overflow: auto;`)})}beforeRender(){super.beforeRender(),this.connectTablePreference(),this.applyTableView(),this._checkboxMeasureToken++,this.refs.items=new Map}_observeResponsiveBox(){if(!this._responsiveObserver||this._responsiveTarget?.isConnected)return;const e=[this.querySelector(".sf-table"),this.parentElement,this.getRootNode()?.host],t=e.find(e=>e?.getBoundingClientRect?.().width>0)??e.find(Boolean)??this;this._responsiveTarget&&this._responsiveObserver.unobserve(this._responsiveTarget),this._responsiveTarget=t,this._responsiveObserver.observe(t)}afterRender(){if(this._observeResponsiveBox(),this.bindRowActionsEvents(this.refs.table?.value),this._windowed&&this.bindWindowScroll(),this._pendingFocusRow){const e=this._pendingFocusRow;return this._pendingFocusRow=null,this._windowOnly=!1,this._entryOnly=!1,void this.focusRow(e,{reveal:!0})}if(this._windowOnly||this._entryOnly)return this._windowOnly=!1,this._entryOnly=!1,this._layoutUnchanged=!1,this.fitCellValues(),this.measurePinnedColumns(),void this.syncWindow();if(this._layoutUnchanged)this._layoutUnchanged=!1;else{if(this.measureWhenCellsDrawn()||(this.measureContentWidths()&&this.applyColumnWidths(),this._contentRetries=0,this.fitCellValues(),this.measurePinnedColumns()),this.hasAttribute("data-sf-page-scroll"))this.bindPageScroll(),this.syncRail(),this.syncStickyHead();else{this.unbindPageScroll();const e=this.refs.table?.value?.tHead;e?.style.transform&&(e.style.transform="")}this.columnsAreCramped!==this._renderedCramped&&(this._crampedRetries??0)<2?(this._crampedRetries=(this._crampedRetries??0)+1,this.requestComponentUpdate("cramped-columns")):this._crampedRetries=0,this.bindPinnedColumnScroll(),this.setCheckboxHeight(),this.bindHoverEvent(),this.bindColumnResizeEvent(),this.bindColumnDragEvent(),this.syncWindow()}}template(){return this.readingLayout(()=>(0,u.b1)(this.templateContext()))}}(0,r.l6)(J,a),J.define("sf-view-table"),t()}catch(Q){t(Q)}})},"2f31b00ad99a"(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{x:()=>h});var i=n("e577837dd70a"),r=e([i]),a=r.then?(await r)():r;i=a[0];const o=/^(\d{4})-(\d{2})-(\d{2})$/u,l=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/u,c=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?$/u,u=new Set(["date","datetime","time"]);function d(e,t){const n=o.exec(t);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));const s=l.exec(t);if(s)return"time"===e?new Date(2e3,0,1,Number(s[1]),Number(s[2]),Number(s[3]??0)):null;const i=c.exec(t);if(!i)return null;if(i[7]){const e=new Date(t.replace(" ","T"));return Number.isNaN(e.getTime())?null:e}return new Date(Number(i[1]),Number(i[2])-1,Number(i[3]),Number(i[4]),Number(i[5]),Number(i[6]??0))}function h(e,t,n){if(!u.has(e)||"string"!=typeof t||!t.trim())return"";const s=t.trim(),r=d(e,s);if(!r)return"";const a="date"!==e&&!o.test(s);return"time"===e?(0,i.Yq)(r,{date:null,time:"short",node:n}):(0,i.Yq)(r,{date:"medium",time:a?"short":null,node:n})}n.d(t,["J",0,u]),s()}catch(p){s(p)}})},"17828be41e75"(e,t,n){n.d(t,{l6:()=>i});const s=e=>String(e).replace(/-([a-z0-9])/gu,(e,t)=>t.toUpperCase());function i(e,t){const n=e.prototype;for(const[e,i]of Object.entries(t.settings||{})){if(["list","object","state"].includes(i?.type))continue;const t=s(e);let r=n,a=null;for(;r&&r!==globalThis.HTMLElement?.prototype&&r!==Object.prototype&&(a=Object.getOwnPropertyDescriptor(r,t),!a);)r=Object.getPrototypeOf(r);a&&a.get&&!a.set&&Object.defineProperty(r,t,{configurable:!0,get:a.get,set(t){"boolean"===i.type?!0===t||""===t||"true"===t?this.setAttribute(e,""):!1===t&&!0===i.default?this.setAttribute(e,"false"):this.removeAttribute(e):null==t?this.removeAttribute(e):this.setAttribute(e,String(t))}})}return e}},"9d9caaf4f796"(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{Y5:()=>T,b1:()=>M});var i=n("2a080a730149"),r=n("9d9903b87148"),a=n("efa66f8927d1"),o=n("8137feb490e0"),l=n("80c480e5196c"),c=n("5bfdd9ec12a1"),u=e([i,r,a,o,l]);[i,r,a,o,l]=u.then?(await u)():u;function d(e,t=""){const n=e?.composedPath?.()?.[0],s=[n,e?.target,e?.currentTarget];for(const e of s){if(!e)continue;if(void 0!==e.value)return e.value;const t=e.querySelector?.("input, textarea");if(t&&void 0!==t.value)return t.value}return t}function h(e){const{state:t}=e.component,{value:n}=t.search,s=e.component.getCurrentFilterTags(),r=e.component.getCurrentFilterValues(),a=Object.entries(s||{}).filter(([,e])=>!1!==e?.active);return i.html`
|
|
1028
|
+
<div class="sf-table-toolbar sf-table-toolbar--list flex flex-col gap-1/3 flex-none"
|
|
1029
|
+
data-sf-filter-tags="${a.length?"1":"0"}">
|
|
1030
|
+
<div class="flex items-cross-center gap-1/3 min-w-0">
|
|
1031
|
+
<sf-input
|
|
1032
|
+
size=${e.size}
|
|
1033
|
+
root-class="sf-search-input flex-1 min-w-0"
|
|
1034
|
+
appearance="bordered"
|
|
1035
|
+
value="${n}"
|
|
1036
|
+
placeholder=${e.searchPlaceholder}
|
|
1037
|
+
name="sf_table_search"
|
|
1038
|
+
aria-label=${e.searchPlaceholder}
|
|
1039
|
+
@input=${t=>e.component.searchChange({value:d(t,n)})}
|
|
1040
|
+
@keydown=${t=>e.component.handleSearchKeyDown(t)}
|
|
1041
|
+
@keyup=${t=>e.component.handleSearchKeyUp(t)}
|
|
1042
|
+
hint-icon="search"
|
|
1043
|
+
></sf-input>
|
|
1044
|
+
${e.component.offersFilter(a.length)?i.html`<span class="sf-table-list-filter">
|
|
1045
|
+
<sf-button-icon
|
|
1046
|
+
size=${e.size}
|
|
1047
|
+
appearance=${a.length?"default":"outline"}
|
|
1048
|
+
scheme="primary"
|
|
1049
|
+
icon="filter_list"
|
|
1050
|
+
aria-label=${a.length?e.component.text("listFilterLabel").replace("{count}",String(a.length)):e.filterText}
|
|
1051
|
+
@click=${t=>e.component.openContextMenu(t,{type:"bottom",menu:"filter-settings"})}
|
|
1052
|
+
></sf-button-icon>
|
|
1053
|
+
${a.length?i.html`<span class="sf-table-list-filter-count" aria-hidden="true">${a.length}</span>`:i.nothing}
|
|
1054
|
+
</span>`:i.nothing}
|
|
1055
|
+
${e.component.getColumns().some(e=>e?.sortable&&!e.system)?i.html`
|
|
1056
|
+
<sf-button-icon
|
|
1057
|
+
size=${e.size}
|
|
1058
|
+
appearance=${t.sort?.key?"default":"outline"}
|
|
1059
|
+
scheme=${t.sort?.key?"primary":"on-surface"}
|
|
1060
|
+
icon="swap_vert"
|
|
1061
|
+
aria-label=${e.component.text("sortLabel")}
|
|
1062
|
+
aria-haspopup="menu"
|
|
1063
|
+
@click=${t=>e.component.openContextMenu(t,{type:"bottom",menu:"list-sort"})}
|
|
1064
|
+
></sf-button-icon>`:i.nothing}
|
|
1065
|
+
${e.actions&&e.creatable?i.html`
|
|
1066
|
+
<sf-button-icon
|
|
1067
|
+
size=${e.size}
|
|
1068
|
+
appearance="outline"
|
|
1069
|
+
scheme="on-surface"
|
|
1070
|
+
icon="add"
|
|
1071
|
+
aria-label=${e.createText}
|
|
1072
|
+
@click=${n=>t.createItems?.length?e.component.openContextMenu(n,{type:"bottom",menu:"create"}):e.component.requestCreateIntent(null)}
|
|
1073
|
+
></sf-button-icon>`:i.nothing}
|
|
1074
|
+
</div>
|
|
1075
|
+
${a.length?i.html`
|
|
1076
|
+
<div class="sf-table-list-tags flex items-cross-center gap-1/3">
|
|
1077
|
+
${a.map(([t,n])=>{const s=r?.[t]||{},a=Array.isArray(s.values)?s.values.length:n.count||"";return i.html`
|
|
1078
|
+
<sf-tag type="default" size=${e.size} text='${n.label}' interactive closable :key=${t}
|
|
1079
|
+
root-class="active" count='${a}'
|
|
1080
|
+
@close="${()=>e.component.removeFilterTag(t)}"
|
|
1081
|
+
@click=${n=>e.component.openContextMenu(n,{type:"bottom",menu:"tag-settings",fieldKey:t,anchorSelector:".sf-tag"})}
|
|
1082
|
+
></sf-tag>`})}
|
|
1083
|
+
<sf-button size=${e.size} appearance="link" scheme="on-surface" text=${e.clearText}
|
|
1084
|
+
@click="${()=>e.component.removeFilterTag()}"></sf-button>
|
|
1085
|
+
</div>`:i.nothing}
|
|
1086
|
+
</div>
|
|
1087
|
+
`}function p(e){const{state:t}=e.component,{value:n}=t.search,s=e.component.getCurrentFilterTags(),r=e.component.getCurrentFilterValues(),a=e.component.hasUnsavedFilterDataChanges(),o=Object.entries(s||{}).filter(([,e])=>!1!==e?.active);return i.html`
|
|
1088
|
+
<div
|
|
1089
|
+
class="sf-table-toolbar flex gap-1/2 content-main-between flex-none"
|
|
1090
|
+
data-sf-filter-tags="${o.length?"1":"0"}"
|
|
1091
|
+
>
|
|
1092
|
+
<div class="sf-table-toolbar-start flex items-cross-center gap-1/3 flex-wrap min-w-0">
|
|
1093
|
+
${e.component.offersFilter(o.length)?i.html`<div class="flex items-cross-center">
|
|
1094
|
+
<sf-button
|
|
1095
|
+
size=${e.size}
|
|
1096
|
+
appearance="default"
|
|
1097
|
+
scheme="primary"
|
|
1098
|
+
text=${e.filterText}
|
|
1099
|
+
segment=${e.filterTemplates?"start":i.nothing}
|
|
1100
|
+
icon-start="filter_list"
|
|
1101
|
+
@click=${t=>{e.component.openContextMenu(t,{type:"bottom",menu:"filter-settings"})}}
|
|
1102
|
+
></sf-button>
|
|
1103
|
+
${e.filterTemplates?i.html`
|
|
1104
|
+
<sf-button-icon
|
|
1105
|
+
size=${e.size}
|
|
1106
|
+
appearance="default"
|
|
1107
|
+
scheme="primary"
|
|
1108
|
+
aria-label="Сохранить шаблон фильтра"
|
|
1109
|
+
?disabled=${!o.length}
|
|
1110
|
+
segment="end"
|
|
1111
|
+
icon="bookmark_add"
|
|
1112
|
+
@click=${t=>{e.component.openContextMenu(t,{type:"bottom",menu:"filter-favorites",parent:!0})}}
|
|
1113
|
+
></sf-button-icon>`:i.nothing}
|
|
1114
|
+
</div>`:i.nothing}
|
|
1115
|
+
${o.map(([t,n])=>{const s=r?.[t]||{},a=Object.prototype.hasOwnProperty.call(r||{},t),o=Array.isArray(s.values)?s.values.length:n.count||"";return i.html`
|
|
1116
|
+
<div class="sf-table-tags">
|
|
1117
|
+
<sf-tag
|
|
1118
|
+
type="default"
|
|
1119
|
+
size=${e.size}
|
|
1120
|
+
text='${n.label}'
|
|
1121
|
+
interactive
|
|
1122
|
+
closable
|
|
1123
|
+
:key=${t}
|
|
1124
|
+
root-class="${a?"active":""}"
|
|
1125
|
+
@close="${()=>{e.component.removeFilterTag(t)}}"
|
|
1126
|
+
@click=${n=>{e.component.openContextMenu(n,{type:"bottom",menu:"tag-settings",fieldKey:t,anchorSelector:".sf-tag"})}}
|
|
1127
|
+
count='${o}'
|
|
1128
|
+
></sf-tag>
|
|
1129
|
+
</div>`})}
|
|
1130
|
+
${o.length||a?i.html`
|
|
1131
|
+
${a?i.html`
|
|
1132
|
+
<sf-button
|
|
1133
|
+
size=${e.size}
|
|
1134
|
+
appearance="default"
|
|
1135
|
+
scheme="primary"
|
|
1136
|
+
text="Сохранить"
|
|
1137
|
+
@click="${()=>e.component.saveCurrentFilterTemplateData()}"
|
|
1138
|
+
></sf-button>
|
|
1139
|
+
`:i.nothing}
|
|
1140
|
+
${o.length?i.html`
|
|
1141
|
+
<sf-button
|
|
1142
|
+
size=${e.size}
|
|
1143
|
+
appearance="outline"
|
|
1144
|
+
scheme="on-surface"
|
|
1145
|
+
text=${e.clearText}
|
|
1146
|
+
@click="${()=>e.component.removeFilterTag()}"
|
|
1147
|
+
></sf-button>
|
|
1148
|
+
`:i.nothing}
|
|
1149
|
+
`:i.nothing}
|
|
1150
|
+
</div>
|
|
1151
|
+
|
|
1152
|
+
<div class="sf-table-toolbar-end flex items-cross-center gap-1/3 flex-wrap flex-auto min-w-0">
|
|
1153
|
+
<sf-input
|
|
1154
|
+
size=${e.size}
|
|
1155
|
+
root-class="sf-search-input m-inline-start-auto"
|
|
1156
|
+
appearance="bordered"
|
|
1157
|
+
value="${n}"
|
|
1158
|
+
placeholder=${e.searchPlaceholder}
|
|
1159
|
+
name="sf_table_search"
|
|
1160
|
+
@input=${t=>{e.component.searchChange({value:d(t,n)})}}
|
|
1161
|
+
@keydown=${t=>{e.component.handleSearchKeyDown(t)}}
|
|
1162
|
+
@keyup=${t=>{e.component.handleSearchKeyUp(t)}}
|
|
1163
|
+
hint-icon="search"
|
|
1164
|
+
>
|
|
1165
|
+
<span slot="right">
|
|
1166
|
+
<sf-button-icon
|
|
1167
|
+
size=${e.size}
|
|
1168
|
+
appearance="link"
|
|
1169
|
+
scheme="on-surface"
|
|
1170
|
+
icon=${n.length?"close":"search"}
|
|
1171
|
+
aria-label=${n.length?"Очистить поиск":"Поиск"}
|
|
1172
|
+
@click=${t=>{if(t.preventDefault(),t.stopPropagation(),!n.length)return!1;e.component.updateSearchState({value:""})}}
|
|
1173
|
+
></sf-button-icon>
|
|
1174
|
+
|
|
1175
|
+
</span>
|
|
1176
|
+
</sf-input>
|
|
1177
|
+
|
|
1178
|
+
${e.actions&&e.creatable?i.html`
|
|
1179
|
+
<div class="flex items-cross-center">
|
|
1180
|
+
<sf-button
|
|
1181
|
+
size=${e.size}
|
|
1182
|
+
appearance="outline"
|
|
1183
|
+
scheme="on-surface"
|
|
1184
|
+
text=${e.createText}
|
|
1185
|
+
segment=${t.createItems?.length?"start":i.nothing}
|
|
1186
|
+
@click=${()=>e.component.requestCreateIntent(null)}
|
|
1187
|
+
></sf-button>
|
|
1188
|
+
${t.createItems?.length?i.html`
|
|
1189
|
+
<sf-button-icon
|
|
1190
|
+
size=${e.size}
|
|
1191
|
+
appearance="outline"
|
|
1192
|
+
scheme="primary"
|
|
1193
|
+
segment="end"
|
|
1194
|
+
icon="keyboard_arrow_down"
|
|
1195
|
+
aria-label="Дополнительные действия создания"
|
|
1196
|
+
aria-haspopup="menu"
|
|
1197
|
+
@click=${t=>{e.component.openContextMenu(t,{type:"bottom",menu:"create"})}}
|
|
1198
|
+
></sf-button-icon>
|
|
1199
|
+
`:i.nothing}
|
|
1200
|
+
</div>
|
|
1201
|
+
`:i.nothing}
|
|
1202
|
+
|
|
1203
|
+
<!-- The extra actions of the view, from the host. Column
|
|
1204
|
+
settings are not here: they are the gear in the table's own
|
|
1205
|
+
head, where they have always been. Without actions there is
|
|
1206
|
+
no control, because an empty menu is a dead end. -->
|
|
1207
|
+
${e.settings&&t.toolbarActions?.length?i.html`
|
|
1208
|
+
<sf-button-icon
|
|
1209
|
+
size=${e.size}
|
|
1210
|
+
appearance="outline"
|
|
1211
|
+
scheme="primary"
|
|
1212
|
+
icon="more_vert"
|
|
1213
|
+
aria-label="Действия с представлением"
|
|
1214
|
+
aria-haspopup="menu"
|
|
1215
|
+
@click=${t=>{e.component.openContextMenu(t,{menu:"toolbar-actions"})}}
|
|
1216
|
+
></sf-button-icon>
|
|
1217
|
+
`:i.nothing}
|
|
1218
|
+
</div>
|
|
1219
|
+
</div>
|
|
1220
|
+
`}function m(e,t){const n=e.component;if(n?.hasSlotContent?.("empty"))return n.getSlotContent("empty");const s=n.emptyBrick(t);return i.html`<sf-empty-state kind=${s.kind} size=${s.size} heading-level=${s.headingLevel}
|
|
1221
|
+
heading=${s.title||i.nothing} text=${s.text||i.nothing} live=${s.live||i.nothing}
|
|
1222
|
+
.actions=${s.actions}></sf-empty-state>`}function f(e){if("auto"!==e.dataState)return e.dataState;const t=e.component?.getTableData?.()??{};return(t.rows||[]).length?"populated":(t.columns||[]).length?"empty":"loading"}function g(e,t){if("actions"===t.key&&!t.component)return i.html`<span class="sf-table-visually-hidden">${t.label}</span>`;if("settings"===t.key&&!1===e.settingsMenu)return i.html`<span class="sf-table-visually-hidden">${e.component.text("settingsColumnLabel")}</span>`;const n=t.component?e.component.renderSmartElement(t.component.type,t.component.props):t.label;if(!0!==t.sortable||t.system)return n;const s=e.component.state.sort||{},r=s.key===t.key?s.direction:null,a="asc"===r?"arrow_upward":"desc"===r?"arrow_downward":"unfold_more";return i.html`
|
|
1223
|
+
<button type="button" class="sf-table-sort-button flex items-cross-center gap-1/4 min-w-0"
|
|
1224
|
+
data-direction=${r||i.nothing}>
|
|
1225
|
+
<span class="truncate">${n}</span>
|
|
1226
|
+
<i class="sf-icon sf-table-sort-icon" aria-hidden="true">${a}</i>
|
|
1227
|
+
</button>
|
|
1228
|
+
`}function b(e,t){if(!0!==t.sortable||t.system)return i.nothing;const n=e.component.state.sort||{};return n.key!==t.key?"none":"asc"===n.direction?"ascending":"descending"}function y(e){if(e.component?.hasSlotContent?.("head"))return e.component.getSlotContent("head");const t=e.component?.getColumns?.()||[];return i.html`
|
|
1229
|
+
<thead class="sticky top-0 z-5">
|
|
1230
|
+
<tr>
|
|
1231
|
+
${t.map((n,s)=>(0,r.keyed)(`head:${n.key}`,i.html`
|
|
1232
|
+
<th
|
|
1233
|
+
class="relative"
|
|
1234
|
+
data-key="${n.key}"
|
|
1235
|
+
data-label="${n.label||n.key||""}"
|
|
1236
|
+
data-sf-pinned=${e.component.isPinnedColumn(n)?"":i.nothing}
|
|
1237
|
+
style=${e.component.getStickyCellStyle(t,s)||i.nothing}
|
|
1238
|
+
aria-sort=${b(e,n)}
|
|
1239
|
+
@click=${!0===n.sortable?t=>e.component.handleHeaderSortClick(t,n):i.nothing}
|
|
1240
|
+
>
|
|
1241
|
+
${n.system||s===t.length-1?g(e,n):i.html`<div
|
|
1242
|
+
class="sidebar-resizer flex items-cross-center h-full select-none"
|
|
1243
|
+
>
|
|
1244
|
+
${g(e,n)}
|
|
1245
|
+
<!-- The width is taken by the line between
|
|
1246
|
+
two headers. There is no handle to find
|
|
1247
|
+
first: this is the line's own hit strip,
|
|
1248
|
+
invisible, astride the separator, and
|
|
1249
|
+
still a button, so the keyboard keeps
|
|
1250
|
+
the name and the arrows it had. -->
|
|
1251
|
+
<button type="button"
|
|
1252
|
+
role="separator"
|
|
1253
|
+
aria-orientation="vertical"
|
|
1254
|
+
class="sf-table-column-resizer"
|
|
1255
|
+
id=${e.component.getColumnResizerId(n.key)}
|
|
1256
|
+
data-sf-column-resizer=${n.key}
|
|
1257
|
+
aria-label="Изменить ширину столбца: ${n.label||n.key}"
|
|
1258
|
+
aria-keyshortcuts="ArrowLeft ArrowRight Home End Enter"
|
|
1259
|
+
></button>
|
|
1260
|
+
</div>`}
|
|
1261
|
+
</th>`))}
|
|
1262
|
+
</tr>
|
|
1263
|
+
</thead>
|
|
1264
|
+
`}function v(e){return null==e||""===e?"":"number"==typeof e?`${e}px`:String(e)}const w=new Set(["text","textarea","markdown","html"]),x=new Set(["select","settings","actions"]),$=6,S=["w-3/4","w-1/2","w-2/3","w-1/3","w-2/5","w-3/5"],k=i.html`<div class="sf-table-skeleton-control" aria-hidden="true"></div>`,C=(e,t)=>i.html`<div class="sf-skeleton sf-skeleton--animation-pulse" aria-hidden="true">
|
|
1265
|
+
<div class="sf-skeleton-text sf-skeleton-text--size-1/2 ${S[(e+2*t)%S.length]}"></div>
|
|
1266
|
+
</div>`;function T(e,t){const n=v(t.colWidth??t.width??t.size)||("actions"===t.key?e?.actionsColumnWidth||"var(--sf-table--actions-column-width, var(--sf-f0))":"")||e?.contentWidth?.(t)||(e?.columnsAreCramped&&e?.columnTakesFloor?.(t)?"var(--sf-table--column-min-inline-size)":""),s=v(t.min_width??t.minWidth),i=v(t.maxWidth);return[n?`width: ${n}`:"",s?`min-width: ${s}`:"",i?`max-width: ${i}`:""].filter(Boolean).join("; ")}function _(e){const t=e.component?.getColumns?.()||[];return t.length?i.html`
|
|
1267
|
+
<colgroup>
|
|
1268
|
+
${t.map(t=>{const n=T(e.component,t);return(0,r.keyed)(`col:${t.key}`,i.html`
|
|
1269
|
+
<col
|
|
1270
|
+
data-key=${t.key||i.nothing}
|
|
1271
|
+
style=${n||i.nothing}
|
|
1272
|
+
/>
|
|
1273
|
+
`)})}
|
|
1274
|
+
</colgroup>
|
|
1275
|
+
`:i.nothing}function A(e,t){return i.html`
|
|
1276
|
+
<div class="sf-table-cell-values flex items-cross-center gap-1/3">
|
|
1277
|
+
${e.map(e=>z(e,t))}
|
|
1278
|
+
<span class="sf-table-cell-more" aria-hidden="true" hidden></span>
|
|
1279
|
+
</div>
|
|
1280
|
+
`}function F(e,t){if(!e?.type)return i.nothing;const n={...e.props||{}};return t.renderCellElement?t.renderCellElement(e.type,n):t.renderSmartElement(e.type,n)}function z(e,t){if(null==e)return i.nothing;if((0,l.isTemplateResult)(e))return e;if("object"==typeof e){const{component:n,props:s,...r}=e;return n?.type?F({...n,props:{...r,...s||{},...n.props||{}}},t):i.nothing}return e}function R(e){const t=(0,c.O)(e);if(!t)return i.nothing;const n=i.html`
|
|
1281
|
+
<span class="sf-table-link-cell-content flex flex-col min-w-0">
|
|
1282
|
+
<span class="sf-table-link-cell-text">${t.text}</span>
|
|
1283
|
+
${null===t.subtext?i.nothing:i.html`
|
|
1284
|
+
<span class="sf-table-link-cell-subtext sf-text-1/2">${t.subtext}</span>
|
|
1285
|
+
`}
|
|
1286
|
+
</span>
|
|
1287
|
+
`;return t.href?i.html`<a class="sf-table-link-cell" href=${t.href}>${n}</a>`:i.html`<span class="sf-table-link-cell">${n}</span>`}const E=Symbol("row-hole"),O=new Map;function P(e){const t=e.join("|"),n=O.get(t);if(n)return n;const s=["<tr data-selected=",E," draggable=",E," aria-level=",E," aria-expanded=",E," aria-setsize=",E," aria-posinset=",E," aria-busy=",E," aria-rowindex=",E," data-row-id=",E," data-current=",E," aria-current=",E,' tabindex="-1" @mousedown=',E," @click=",E," @dblclick=",E," @keydown=",E,">"];for(const t of e)s.push("<td data-key=",E," data-item=",E," data-sf-pinned=",E," style=",E,">"),"box"===t?s.push("<label class=",E,'><span class="sf-checkbox-box transition flex"><input type="checkbox" data-sf-row-box value=',E," .checked=",E," aria-label=",E," @change=",E,"></span></label>"):"menu"===t?s.push('<button type="button" class=',E," aria-label=",E,' value="menu" data-sf-row-menu @click=',E,'><i class="sf-icon sf-icon--weight-regular pointer-event-none" aria-hidden="true">menu</i></button>'):"text"===t?s.push("<span class=",E," title=",E," .textContent=",E,"></span>"):"node"===t&&s.push(E),s.push("</td>");s.push("</tr>");const i=[""];for(const e of s)e===E?i.push(""):i[i.length-1]+=e;const r=Object.freeze(Object.assign(i,{raw:Object.freeze(i.slice())}));return O.set(t,r),r}function M(e){const{state:t}=e.component;function n(e,t,n){return e.component.canOpenRow?.(t)&&null!=t?.id?i.html`<a class="sf-table-title-link" href=${t.href??t.url??"#"}
|
|
1288
|
+
@click=${n=>{(n.button>0||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey)&&(t.href??t.url)||(n.preventDefault(),n.stopPropagation(),n.detail>1||e.component.requestActionIntent("view",[t.id]))}}>${n}</a>`:n}function s(e,t,s,{busy:r=!1}={}){const o=e.component,u=o.treeColumnKey?.(t),d=t.find(e=>"title"===e?.role&&!e.system)?.key??null,h=o.windowSlice?.(s)??null,p=h?s.slice(h.first,h.last+1):s,m=h?h.first:0,f=String(Math.max(t.length,1)),g=o.hasAttribute("drag-rows")||"true"===o.getAttribute("row-reorder"),b=t.map((e,n)=>o.getStickyCellStyle(t,n)||i.nothing),y=t.map(e=>o.isPinnedColumn(e)?"":i.nothing),v=(e,t)=>i.html`<tr class="sf-table-window-spacer" aria-hidden="true" data-sf-window-spacer=${t}><td colspan=${f} style=${`block-size: ${Math.max(0,Math.round(e))}px`}></td></tr>`,w=(s,r)=>{const a=r+m,p=o.isCurrentRow(s,a),f=[],v=[!0===s.select?.component?.props?.checked?"":i.nothing,g&&!s.__tree?.more?"true":i.nothing,s.__tree?String(s.__tree.level+1):i.nothing,s.__tree?.hasChildren?String(!0===s.__tree.expanded):i.nothing,s.__tree?String(s.__tree.setsize):i.nothing,s.__tree?String(s.__tree.posinset):i.nothing,s.__tree?.loading?"true":i.nothing,h?String(a+2):i.nothing,o.getRowKey(s,a),p?"":i.nothing,p?"true":i.nothing,o.rowPointerDown,e=>o.handleRowClick(e,s,a),e=>o.handleRowOpen(e,s),e=>o.handleRowKeydown(e,s)];return t.forEach((t,r)=>{const a=o.rowMarkupCell?.(s,t)??null;v.push(t.key,`${s.id}_${t.key}`,y[r],b[r]),"box"===a?.kind?(f.push("box"),v.push(`sf-checkbox sf-checkbox--size-${a.size} flex content-main-between cursor-pointer`,a.value,a.checked,a.label,a.change)):"menu"===a?.kind?(f.push("menu"),v.push(`sf-icon-button sf-icon-button--size-${a.size} sf-icon-button--icon sf-icon-button--link flex items-cross-center sf-icon-button--on-surface`,a.label,a.click)):"text"===a?.kind?(f.push("text"),v.push(a.className,a.title??i.nothing,a.text)):"empty"===a?.kind?f.push("empty"):(f.push("node"),v.push(((t,s)=>s.key===u?l(e,t,s.key===d?n(e,t,c(t,s)):c(t,s)):s.key===d?n(e,t,c(t,s)):c(t,s))(s,t)))}),(0,i.html)(P(f),...v)};return i.html`<tbody data-busy=${r?"":i.nothing} data-sf-window=${h?`${h.first}-${h.last}`:i.nothing}>${h?v(h.before,"before"):i.nothing}${h&&h.first%2==0?v(0,"parity"):i.nothing}${(0,a.repeat)(p,(e,t)=>e.__tree?.more?`more:${e.id}`:`row:${o.rowsGeneration?.()??0}:${e.id??e.value??t+m}`,(n,s)=>n.__tree?.more?function(e,t,n){return i.html`
|
|
1289
|
+
<tr class="sf-table-tree-more" aria-level=${String(n.__tree.level+1)}>
|
|
1290
|
+
<td colspan=${String(t.length)}>
|
|
1291
|
+
<span class="sf-table-tree-cell" style=${`--sf-table-tree--level: ${n.__tree.level}`}>
|
|
1292
|
+
<span class="sf-table-tree-toggle" aria-hidden="true"></span>
|
|
1293
|
+
<sf-button appearance="link" size="1/2" text=${e.component.text("treeMore")}
|
|
1294
|
+
@click=${()=>e.component.requestTreeMore(n)}></sf-button>
|
|
1295
|
+
</span>
|
|
1296
|
+
</td>
|
|
1297
|
+
</tr>`}(e,t,n):w(n,s))}${h?v(h.after,"after"):i.nothing}</tbody>`}function l(e,t,n){const s=t.__tree,r=Array.isArray(t.path)&&t.path.length?t.path.map(e=>e?.label??e).join(" / "):"";if(!s&&!r)return n;const a=s?.level??0,o=s?.hasChildren?i.html`<button type="button" class="sf-table-tree-toggle"
|
|
1298
|
+
data-expanded=${s.expanded?"":i.nothing}
|
|
1299
|
+
aria-label=${e.component.text(s.expanded?"treeCollapse":"treeExpand")}
|
|
1300
|
+
@click=${n=>{n.stopPropagation(),e.component.toggleTreeRow(t)}}><i class="sf-icon" aria-hidden="true">chevron_right</i></button>`:s?i.html`<span class="sf-table-tree-toggle" aria-hidden="true"></span>`:i.nothing,l=s?(s.expanded?t.icon_expanded??t.icon:t.icon)??(s.hasChildren?s.expanded?"folder_open":"folder":"description"):t.icon;return i.html`
|
|
1301
|
+
<span class="sf-table-tree-cell" style=${`--sf-table-tree--level: ${a}`}>
|
|
1302
|
+
${o}
|
|
1303
|
+
${l?i.html`<i class="sf-icon sf-table-tree-icon" aria-hidden="true">${l}</i>`:i.nothing}
|
|
1304
|
+
<span class="sf-table-tree-value flex flex-col min-w-0">
|
|
1305
|
+
<span class="min-w-0">${n}</span>
|
|
1306
|
+
${r?i.html`<span class="sf-table-tree-path">${r}</span>`:i.nothing}
|
|
1307
|
+
</span>
|
|
1308
|
+
</span>`}function c(n,s){if(!s||!n)return i.nothing;let r=n[s.key];if("link"===s.renderer)return R(r);if("actions"===s.key&&e.component?.getActionRowItems){Array.isArray(r)&&r.length&&r.every(e=>e&&"object"==typeof e)||(r=e.component.rowActionItems(n))}if(e.component?.cellEditable?.(n,s))return i.html`<sf-checkbox size=${"1/2"===e.size?"1/2":"1"} data-cell-edit=${s.key}
|
|
1309
|
+
?checked=${!0===r} ?disabled=${e.component.cellPending(n,s)}
|
|
1310
|
+
aria-label=${s.label??s.key}
|
|
1311
|
+
@change=${t=>e.component.setCellValue(n,s,Boolean(t.target?.checked??t.detail?.checked))}></sf-checkbox>`;if(s.component)return null==r||Array.isArray(r)&&!r.length?"settings"!==s.key||r&&(!Array.isArray(r)||r.length)?F(s.rowComponent||s.component,e.component):F({type:"button-icon",props:{size:"1",appearance:"link",scheme:"on-surface",icon:"menu",ariaLabel:"Меню",value:"menu"}},e.component):z(r,e.component);if(null==r)return i.nothing;if(w.has(s.propertyType??s.property_type??s.type)&&("string"==typeof r||"number"==typeof r)){const t=e.component?.cellText?.(s,r)??String(r);return i.html`<span class="sf-table-cell-clip" title=${t}>${t}</span>`}if(!("object"==typeof r&&!Array.isArray(r)&&Boolean(r.component?.type))){const t=e.component?.getTypedCellValue?.(s,r);if(null!=t)return Array.isArray(t)?"avatar"===t[0]?.component?.type?i.html`
|
|
1312
|
+
<div class="flex flex-nowrap items-cross-center gap-1/3">
|
|
1313
|
+
${z(t[0],e.component)}
|
|
1314
|
+
<span style="min-inline-size: 0">
|
|
1315
|
+
${t.slice(1).map(t=>z(t,e.component))}
|
|
1316
|
+
</span>
|
|
1317
|
+
</div>
|
|
1318
|
+
`:A(t,e.component):z(t,e.component)}if(Array.isArray(r))return"actions"===s.key&&(r=r.filter(e=>{const{actions:n}=t,s=e.id||e.component?.props?.value,i=n.find(e=>e.id===s);return!1!==e.inline&&(i?.visible??!0)})),"actions"===s.key?e.component.actionsShownFor?.(n)?i.html`
|
|
1319
|
+
<div class="sf-table-row-actions flex items-cross-center gap-1/3">
|
|
1320
|
+
${r.map(t=>z(t,e.component))}
|
|
1321
|
+
</div>
|
|
1322
|
+
`:i.html`<div class="sf-table-row-actions" data-row-actions="idle"></div>`:A(r,e.component);if("object"==typeof r)return z(r,e.component);const a=String(r);return i.html`<span class="sf-table-cell-text" title=${a.length>80?a:i.nothing}>${a}</span>`}return i.html`
|
|
1323
|
+
<section
|
|
1324
|
+
class="sf-table ${e.list?"sf-table--list":""} min-w-0 flex flex-col gap-1/3 flex-1 min-h-0 ${e.rootClass||""}"
|
|
1325
|
+
style=${e.rootStyle||i.nothing}
|
|
1326
|
+
data-sf-instance=${e.component.getInstanceId()}
|
|
1327
|
+
data-state=${f(e)}
|
|
1328
|
+
aria-busy=${"loading"===f(e)?"true":i.nothing}
|
|
1329
|
+
>
|
|
1330
|
+
${e.toolbar?e.list?h(e):p(e):i.nothing}
|
|
1331
|
+
${e.component.renderBulkActions()}
|
|
1332
|
+
|
|
1333
|
+
<div class="table-wrap min-w-0 max-w-full flex flex-col flex-1 min-h-0">
|
|
1334
|
+
<div class="sf-table-scroll min-h-0 min-w-0 overflow-auto flex-1 relative"
|
|
1335
|
+
${(0,o.ref)(e.component.refs.scroll)}
|
|
1336
|
+
data-sf-vertical-scroll=${e.verticalScroll}>
|
|
1337
|
+
<div class="sf-table-resize-guide" aria-hidden="true" hidden
|
|
1338
|
+
${(0,o.ref)(e.component.refs.resizeGuide)}></div>
|
|
1339
|
+
${"loading"===f(e)&&(e.component.getTableData()?.rows?.length??0)>0?i.html`
|
|
1340
|
+
<div class="sf-table-busy" role="status">
|
|
1341
|
+
<sf-spinner size=${e.size} label="" aria-label=${e.loadingText}></sf-spinner>
|
|
1342
|
+
</div>
|
|
1343
|
+
`:i.nothing}
|
|
1344
|
+
${e.list?function(){const s=e.component?.getColumns?.()||[],{rows:a=[]}=t.data||{},o=f(e);if("populated"!==o&&("loading"!==o||!a.length))return"loading"===o?i.html`<div class="sf-table-list sf-table-skeleton flex flex-col" data-state="loading">
|
|
1345
|
+
${Array.from({length:$},(e,t)=>i.html`<div class="sf-table-list-item flex flex-col gap-1/3 p-1" aria-hidden="true">
|
|
1346
|
+
${C(t,0)}${C(t,1)}
|
|
1347
|
+
</div>`)}
|
|
1348
|
+
<span class="sf-table-visually-hidden" role="status">${e.loadingText}</span>
|
|
1349
|
+
</div>`:i.html`<div class="sf-table-state" data-state=${o}>${m(e,o)}</div>`;const u=s.find(e=>"select"===e.key),d=s.find(e=>"settings"===e.key),h=s.filter(e=>e?.key&&!["select","settings","actions"].includes(e.key)&&!e.system&&!1!==e.visible),p=h.find(e=>"title"===e.role)??h[0],g=t=>"title"===p.role?n(e,t,c(t,p)):c(t,p),b=Math.max(0,Number(e.component.getProp?.("listFields")??3)||0),y=h.filter(e=>e!==p).map((e,t)=>({column:e,order:t})).sort((e,t)=>(e.column.priority??1e6)-(t.column.priority??1e6)||e.order-t.order).slice(0,b).map(({column:e})=>e),v=e=>!(null==e||""===e||Array.isArray(e)&&!e.length);return i.html`
|
|
1350
|
+
<ul class="sf-table-list" role="list" aria-label=${e.ariaLabel||i.nothing}
|
|
1351
|
+
aria-busy=${"loading"===o?"true":i.nothing}>
|
|
1352
|
+
${a.map((t,n)=>t.__tree?.more?(0,r.keyed)(`item:${t.id}`,i.html`
|
|
1353
|
+
<li class="sf-table-list-more" style=${`--sf-table-tree--level: ${t.__tree.level}`}>
|
|
1354
|
+
<sf-button appearance="link" size="1/2" text=${e.component.text("treeMore")}
|
|
1355
|
+
@click=${()=>e.component.requestTreeMore(t)}></sf-button>
|
|
1356
|
+
</li>`):(0,r.keyed)(`item:${e.component.rowsGeneration?.()??0}:${t.id??n}`,i.html`
|
|
1357
|
+
<li class="sf-table-list-item"
|
|
1358
|
+
data-row-id=${e.component.getRowKey(t,n)}
|
|
1359
|
+
data-selected=${!0===t.select?.component?.props?.checked?"":i.nothing}
|
|
1360
|
+
data-current=${e.component.isCurrentRow(t,n)?"":i.nothing}
|
|
1361
|
+
aria-level=${t.__tree?String(t.__tree.level+1):i.nothing}
|
|
1362
|
+
aria-expanded=${t.__tree?.hasChildren?String(!0===t.__tree.expanded):i.nothing}
|
|
1363
|
+
tabindex="-1"
|
|
1364
|
+
@mousedown=${t=>e.component.handleRowPointerDown(t)}
|
|
1365
|
+
@click=${s=>e.component.handleRowClick(s,t,n)}
|
|
1366
|
+
@dblclick=${n=>e.component.handleRowOpen(n,t)}
|
|
1367
|
+
@keydown=${n=>e.component.handleRowKeydown(n,t)}>
|
|
1368
|
+
${u?i.html`<span class="sf-table-list-select">${c(t,u)}</span>`:i.nothing}
|
|
1369
|
+
<div class="sf-table-list-main">
|
|
1370
|
+
<div class="sf-table-list-title">${p?t.__tree||t.path?l(e,t,g(t)):g(t):i.nothing}</div>
|
|
1371
|
+
${y.some(e=>v(t[e.key]))?i.html`
|
|
1372
|
+
<div class="sf-table-list-fields">
|
|
1373
|
+
${y.filter(e=>v(t[e.key])).map(e=>i.html`
|
|
1374
|
+
<span class="sf-table-list-field">
|
|
1375
|
+
<span class="sf-table-list-label">${e.label??e.key}</span>
|
|
1376
|
+
<span class="sf-table-list-value">${c(t,e)}</span>
|
|
1377
|
+
</span>`)}
|
|
1378
|
+
</div>`:i.nothing}
|
|
1379
|
+
</div>
|
|
1380
|
+
${d?i.html`<span class="sf-table-list-menu">${c(t,d)}</span>`:i.nothing}
|
|
1381
|
+
</li>`))}
|
|
1382
|
+
</ul>`}():i.html`
|
|
1383
|
+
<table
|
|
1384
|
+
${(0,o.ref)(e.component.refs.table)}
|
|
1385
|
+
class="table border-separate border-spacing-0 min-w-full ${e.component?.hasContentWidths?"sf-table-content-sized":"w-max"} table-fixed transition"
|
|
1386
|
+
role=${e.component.isTree?.()?"treegrid":i.nothing}
|
|
1387
|
+
aria-label=${e.ariaLabel||i.nothing}
|
|
1388
|
+
aria-rowcount=${e.component.windowRowCount?.()??i.nothing}
|
|
1389
|
+
>
|
|
1390
|
+
${_(e)}
|
|
1391
|
+
${y(e)}
|
|
1392
|
+
${function(){if(e.component?.hasSlotContent?.("body"))return i.html`
|
|
1393
|
+
<tbody>
|
|
1394
|
+
${e.component.getSlotContent("body")}
|
|
1395
|
+
</tbody>`;const{state:t}=e.component,n=e.component?.getColumns?.()||[],{rows:r=[]}=t.data||{},a=f(e);if("loading"===a&&r.length)return s(e,n,r,{busy:!0});if("populated"!==a){const t={loading:null,error:m(e,"error"),empty:m(e,"empty")}[a]||m(e,"empty");return"loading"===a?i.html`
|
|
1396
|
+
<tbody data-state="loading" class="sf-table-skeleton">
|
|
1397
|
+
${Array.from({length:$},(e,t)=>i.html`<tr aria-hidden="true">
|
|
1398
|
+
${n.some(e=>!x.has(e?.key))?n.map((e,n)=>i.html`<td>${x.has(e?.key)?k:C(t,n)}</td>`):i.html`<td colspan=${String(Math.max(n.length,1))}>
|
|
1399
|
+
<div class="flex gap-2">${[0,1,2].map(e=>i.html`<div class="flex-1">${C(t,e)}</div>`)}</div>
|
|
1400
|
+
</td>`}
|
|
1401
|
+
</tr>`)}
|
|
1402
|
+
</tbody>
|
|
1403
|
+
<tbody><tr><td colspan=${String(Math.max(n.length,1))} class="sf-table-visually-hidden">
|
|
1404
|
+
<span role="status">${e.loadingText}</span>
|
|
1405
|
+
</td></tr></tbody>
|
|
1406
|
+
`:i.html`
|
|
1407
|
+
<tbody data-state=${a}>
|
|
1408
|
+
<tr>
|
|
1409
|
+
<td colspan=${String(Math.max(n.length,1))}>
|
|
1410
|
+
<div class="sf-table-state">${t}</div>
|
|
1411
|
+
</td>
|
|
1412
|
+
</tr>
|
|
1413
|
+
</tbody>
|
|
1414
|
+
`}return s(e,n,r)}()}
|
|
1415
|
+
</table>`}
|
|
1416
|
+
</div>
|
|
1417
|
+
${"page"!==e.verticalScroll||e.list?i.nothing:i.html`<div class="sf-table-rail" aria-hidden="true" hidden ${(0,o.ref)(e.component.refs.rail)}>
|
|
1418
|
+
<div class="sf-table-rail-track"></div></div>`}
|
|
1419
|
+
|
|
1420
|
+
${e.pagin?i.html`
|
|
1421
|
+
<sf-pagination
|
|
1422
|
+
current="1"
|
|
1423
|
+
total=${String(e.paginationTotal)}
|
|
1424
|
+
bottom="true"
|
|
1425
|
+
show-action-for-all
|
|
1426
|
+
page-size=${String(e.paginationPageSize)}
|
|
1427
|
+
page-sizes=${e.pageSizes}
|
|
1428
|
+
show-page-size
|
|
1429
|
+
top-class="content-main-center"
|
|
1430
|
+
main-class="items-cross-center content-main-between"
|
|
1431
|
+
bottom-class="items-cross-center gap-2"
|
|
1432
|
+
></sf-pagination>`:i.nothing}
|
|
1433
|
+
</div>
|
|
1434
|
+
</section>
|
|
1435
|
+
${t.contextMenu?.open?e.component.renderContextMenu(e.state.contextMenu):i.nothing}
|
|
1436
|
+
<!-- A demo panel used to stand here, open to nothing, titled after a
|
|
1437
|
+
ticket. Closed, it still took a box of its own, and in a card that
|
|
1438
|
+
spaces its parts that box became the gap above Show more: three
|
|
1439
|
+
spacings instead of one. -->
|
|
1440
|
+
`}s()}catch(L){s(L)}})},"5bfdd9ec12a1"(e,t,n){n.d(t,{O:()=>r});const s=["/","./","../","#","?"];function i(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;if(t.startsWith("//"))return null;if(s.some(e=>t.startsWith(e)))return t;try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol?t:null}catch{return null}}function r(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;const t=null===e.text||void 0===e.text?"":String(e.text),n=null===e.subtext||void 0===e.subtext?null:String(e.subtext);return{href:i(e.href),subtext:n,text:t}}},"5b7d7695b41b"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("element-manifest",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("element-manifest",1).then(e,t),{once:!0}))},"80c480e5196c"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directive-helpers.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directive-helpers.js",1).then(e,t),{once:!0}))},"9d9903b87148"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/keyed.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directives/keyed.js",1).then(e,t),{once:!0}))},"8137feb490e0"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/ref.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directives/ref.js",1).then(e,t),{once:!0}))},efa66f8927d1(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/repeat.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directives/repeat.js",1).then(e,t),{once:!0}))},"073f05ff1a81"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/unsafe-html.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directives/unsafe-html.js",1).then(e,t),{once:!0}))},"2a080a730149"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit",1).then(e,t),{once:!0}))},"43090d1c8307"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("page-language",1).then(e,t),{once:!0}))},"116963e5e31b"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("position",1).then(e,t),{once:!0}))},deb1a4d61565(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("smart-base",1).then(e,t),{once:!0}))},f8651e83c6c6(e){e.exports=JSON.parse('{"$comment":"Dated aliases of sf-view-table for the shim (core/js/aliases.js, standard §16 item 20, vocabulary §9). mode: same-detail (the shim sends the new and the old name), detail-adds (the old name gets the larger new detail), split (the old detail from the element\'s adapter, sfAliasAdapters), host-attribute (no shim).","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","aliases":[{"from":"aria-label","to":null,"kind":"attribute","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"host-attribute","section":"§3.1, §4.8","note":"stays a host attribute, read for the accessible name; no shim"},{"from":"sf-table-action-intent","to":"sf-table-apply","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"split","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 apply {action, scope, ids, revisions}; the old detail {action_id, record_ids} is made by the element\'s adapter (vocabulary §9: sf-table-action-intent → sf-table-apply)"},{"from":"sf-table-create-intent","to":"sf-table-create","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 create; the detail {item} is unchanged"},{"from":"sf-port-output","to":"sf-table-select","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"split","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 select {ids}; the composition port\'s old detail {port: selection, value} is made by the element\'s adapter"},{"from":"sf-table-query-intent","to":"sf-table-query","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5.1: sf-table-query-intent → sf-table-query; the detail {reason, context, sequence} is unchanged"},{"from":"sf-table-retry","to":"sf-table-refresh","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 refresh (table-retry)"},{"from":"sf-table-tree-toggle","to":"sf-table-expand","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 expand; the detail {id, expanded} is unchanged"},{"from":"sf-table-tree-more","to":"sf-table-load-more","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"detail-adds","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 load-more; the new detail adds direction: after to {parent, cursor}"},{"from":"sf-table-rows-reorder","to":"sf-table-move","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 move; the detail {ids, before, order} is unchanged"},{"from":"sf-table-column-settings-change","to":"sf-table-save","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"detail-adds","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5 save {kind: columns}; the new detail adds kind to {reason, columnSettings, tableSettingsKey}","when":{"kind":"columns"}},{"from":"sf-table:column-settings-change","to":"sf-table-save","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"detail-adds","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"vocabulary §5.1: sf-table:column-settings-change → sf-table-save {kind: columns}; a colon name (§8)","when":{"kind":"columns"}},{"from":"onColumnSettingsChange","to":"sf-table-save","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"detail-adds","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"a camelCase name outside §8 (simai/ui-pro#1); ui-admin listens to it (src/main.ts, src/smart-component-catalog.ts)","when":{"kind":"columns"}},{"from":"onSearchEnd","to":"sf-table-search-change","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"split","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"a camelCase name outside §8 (simai/ui-pro#1); its detail was the search text itself, made by the element\'s adapter; ui-admin listens to it (src/main.ts, src/smart-component-catalog.ts)"},{"from":"onTemplateSave","to":"sf-table-template-save","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"a camelCase name outside §8 (simai/ui-pro#1); ui-admin listens to it"},{"from":"onFilterUpdate","to":"sf-table-filter-change","kind":"event","component":"sf-view-table","since":"2026-10-27","remove_after":"2026-12-01","mode":"same-detail","cancelable":false,"section":"§8, §16 item 20, vocabulary §9","note":"a camelCase name outside §8 (simai/ui-pro#1); ui-admin listens to it"},{"from":"sf-table","to":"sf-view-table","kind":"tag","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","section":"rename plan R2 (ui-control RENAME-PLAN-2026-11-03), naming decision 2026-11-02","note":"the element is sf-view-table; sf-table is a subclass defined beside it until the date"},{"from":"sf-table-select","to":"sf-view-table-select","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-apply","to":"sf-view-table-apply","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-save","to":"sf-view-table-save","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-column-settings-reset","to":"sf-view-table-column-settings-reset","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-create","to":"sf-view-table-create","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-filter-change","to":"sf-view-table-filter-change","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-query","to":"sf-view-table-query","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-refresh","to":"sf-view-table-refresh","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-search-change","to":"sf-view-table-search-change","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-sort-change","to":"sf-view-table-sort-change","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-template-delete","to":"sf-view-table-template-delete","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-template-save","to":"sf-view-table-template-save","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-template-select","to":"sf-view-table-template-select","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-toolbar-action","to":"sf-view-table-toolbar-action","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-reference-open","to":"sf-view-table-reference-open","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-expand","to":"sf-view-table-expand","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-load-more","to":"sf-view-table-load-more","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-rows-drag","to":"sf-view-table-rows-drag","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-move","to":"sf-view-table-move","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-cell-set","to":"sf-view-table-cell-set","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-view-change","to":"sf-view-table-view-change","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"},{"from":"sf-table-window","to":"sf-view-table-window","kind":"event","component":"sf-view-table","since":"2026-11-03","remove_after":"2027-01-01","mode":"same-detail","section":"§8","note":"the event name carries the tag"}]}')},c1f17ed5a348(e){e.exports=JSON.parse('{"id":"smart.view-table","tag":"sf-view-table","version":"1.15.0","kind":"leaf","settings":{"selectable":{"type":"boolean","default":true},"settings":{"type":"boolean","default":true},"actions":{"type":"boolean","default":true},"row-actions":{"type":"boolean","default":true},"creatable":{"type":"boolean","default":true},"filter-templates":{"type":"boolean","default":true},"settings-menu":{"type":"boolean","default":true},"pagin":{"type":"boolean","default":false},"filter-text":{"type":"string","default-from":"runtime.filter-text"},"clear-text":{"type":"string","default-from":"runtime.clear-text"},"search-placeholder":{"type":"string","default-from":"runtime.search-placeholder"},"create-text":{"type":"string","default-from":"runtime.create-text"},"pagination-total":{"type":"number","default":10,"integer":true,"min":0},"pagination-page-size":{"type":"number","default":10,"integer":true,"min":1,"max":100},"page-sizes":{"type":"string","default":"10,20,30,40"},"context-menu-columns":{"type":"number","default":1,"integer":true,"min":1,"max":4},"remember-widths":{"type":"boolean","default":false},"table-settings-key":{"type":"string","default":""},"data-state":{"type":"enum","values":["auto","loading","ready","populated","empty","error"],"default":"auto","x-alias":{"populated":"ready"}},"loading-text":{"type":"string","default-from":"runtime.loading-text"},"empty-text":{"type":"string","default-from":"runtime.empty-text"},"empty-description":{"type":"string"},"error-text":{"type":"string","default-from":"runtime.error-text"},"retry-text":{"type":"string","default-from":"runtime.retry-text"},"toolbar":{"type":"boolean","default":true},"pin-column-label":{"type":"string","default-from":"runtime.pin-column-label"},"unpin-column-label":{"type":"string","default-from":"runtime.unpin-column-label"},"column-move-label":{"type":"string","default-from":"runtime.column-move-label"},"column-search-placeholder":{"type":"string","default-from":"runtime.column-search-placeholder"},"column-search-empty-text":{"type":"string","default-from":"runtime.column-search-empty-text"},"vertical-scroll":{"type":"enum","values":["self","page"],"default":"self"},"filter-apply-text":{"type":"string","default-from":"runtime.filter-apply-text"},"layout":{"type":"enum","values":["auto","table","list"],"default":"table"},"list-below":{"type":"number","default":600},"list-fields":{"type":"number","default":3},"size":{"type":"enum","values":["1/2","1"],"default":"1"},"preferences-key":{"type":"string","default":""},"row-actions-visible":{"type":"enum","values":["hover","always"],"default":"hover"},"drag-rows":{"type":"boolean","default":false},"row-reorder":{"type":"boolean","default":false},"inline-edit":{"type":"boolean","default":false},"active-filter-fields":{"type":"list","entries":{"key":"id"}},"bulk-actions":{"type":"list"},"columns":{"type":"list","of":{"key":"string","label":"string"}},"create-items":{"type":"list"},"filter-fields":{"type":"list"},"rows":{"type":"list","entries":{"key":"id","changes":"revision"},"of":{"id":"id","revision":{"type":"string","optional":true}}},"table-data":{"type":"object"},"table-settings":{"type":"object"},"templates":{"type":"list"},"toolbar-actions":{"type":"list"},"sort":{"type":"list","of":{"key":"string","direction":{"type":"enum","values":["asc","desc"]}},"controlled":true},"current":{"type":"string","default":""}},"values":{"selected":{"type":"id","optional":true},"selection":{"type":"list","default":[]}},"events":{"select":{"carries":{"ids":"list"}},"apply":{"carries":{"action":"string","scope":{"type":"enum","values":["entry","selection","filter"]},"ids":"list","revisions":{"type":"object","optional":true}}},"save":{"carries":{"kind":{"type":"enum","values":["columns"]},"reason":"string","column-settings":{"type":"object"},"table-settings-key":{"type":"string"}}},"column-settings-reset":{"carries":{"target":{"type":"enum","values":["personal"]},"table-settings-key":{"type":"string","nullable":true}},"own-verb":true},"create":{"carries":{"item":{"type":"string","nullable":true,"optional":true}}},"filter-change":{"carries":{"template-key":{"type":"string"},"template-label":{"type":"string"},"values":{"type":"object"},"tags":{"type":"object"}},"own-verb":true},"query":{"carries":{"reason":"string","context":"object","sequence":{"type":"number","integer":true}}},"refresh":{"carries":{}},"search-change":{"carries":{"search":"string"},"own-verb":true},"sort-change":{"carries":{"key":{"type":"string","schema":{"minLength":1}},"direction":{"type":"enum","values":["asc","desc",null],"nullable":true}},"own-verb":true},"template-delete":{"carries":{"key":{"type":"string","schema":{"minLength":1}}},"own-verb":true},"template-save":{"carries":{},"own-verb":true},"template-select":{"carries":{"key":{"type":"string","schema":{"minLength":1}}},"own-verb":true},"toolbar-action":{"carries":{"action":"string","href":{"type":"string","nullable":true,"optional":true}},"cancelable":true,"own-verb":true},"reference-open":{"carries":{"field":"string","value":"object","href":"string"},"cancelable":true,"own-verb":true},"expand":{"carries":{"id":"id","expanded":{"type":"boolean","optional":true}}},"load-more":{"carries":{"direction":{"type":"enum","values":["after"]},"parent":{"type":"id","nullable":true},"cursor":{"type":"string","nullable":true}}},"rows-drag":{"carries":{"ids":{"type":"list","schema":{"items":{"type":"string"},"minItems":1}},"source":{"type":"string","nullable":true}},"own-verb":true},"move":{"carries":{"ids":"list","before":{"type":"id","nullable":true},"order":"list"}},"cell-set":{"carries":{"id":"object","key":"string","value":"object","revision":"object"},"own-verb":true},"view-change":{"carries":{"view":"object","everywhere":"boolean"},"own-verb":true},"window":{"carries":{"first":{"type":"number","integer":true},"last":{"type":"number","integer":true}},"own-verb":true}},"actions":{"add-rows":{"with":{"rows":"list"}},"apply-query-result":{"with":{"sequence":{"type":"number","integer":true,"schema":{"minimum":1}},"rows":"list"}},"clear-selection":{},"request-action-intent":{"with":{"action-id":{"type":"string","schema":{"minLength":1}},"record-ids":{"type":"list","schema":{"items":{"type":["string","integer"],"minLength":1},"minItems":1}}},"emits":"apply"},"request-create-intent":{"with":{"item-id":{"type":"string","optional":true,"nullable":true}},"emits":"create"},"request-retry":{"emits":"refresh"},"set-sort":{"with":{"key":{"type":"string","nullable":true},"direction":{"type":"enum","values":["asc","desc"],"nullable":true}}},"toggle-tree-row":{"with":{"row":"object"},"emits":"expand"},"request-tree-more":{"with":{"row":"object"},"emits":"load-more"},"focus-row":{"with":{"id":"id"}}},"port":{"id":"simai.dataview-port","version":"1.0.0","contract":"src/core/contracts/ports/simai.dataview-port/1.0.0/port.json"},"presentation":{"skeleton":{"late":["rows"]}},"host-states":{"data-sf-view-stripes":"boolean","data-sf-page-scroll":"boolean"},"css-variables":{"--sf-table-row-block-size-1/2":{"type":"length","state":"default"},"--sf-table-row-block-size-1":{"type":"length","state":"default"},"--sf-table-row-2-lines-block-size-1/2":{"type":"length","state":"default"},"--sf-table-row-2-lines-block-size-1":{"type":"length","state":"default"},"--sf-table-head-block-size-1/2":{"type":"length","state":"default"},"--sf-table-head-block-size-1":{"type":"length","state":"default"},"--sf-table-toolbar-block-size-1/2":{"type":"length","state":"default"},"--sf-table-toolbar-block-size-1":{"type":"length","state":"default"},"--sf-table-toolbar-gap":{"type":"length","state":"default"},"--sf-table-head--background-color":{"type":"color","state":"default"},"--sf-table-row--background-color":{"type":"color","state":"default"},"--sf-table--cell-spacing":{"type":"length","state":"default"},"--sf-table-cell--line-clamp":{"type":"number","state":"default"},"--sf-table-context-menu--z-index":{"type":"number","state":"open"},"--sf-table-context-menu--max-width":{"type":"length","state":"open"}}}')},"678dc07d76bf"(e){e.exports=JSON.parse('{"title":"Table","events":{"column-settings-reset":{"label":"Column settings reset"},"filter-change":{"label":"Filter changed"},"search-change":{"label":"Search changed"},"sort-change":{"label":"Order changed"},"template-delete":{"label":"Template deleted"},"template-save":{"label":"Template saved"},"template-select":{"label":"Template chosen"},"toolbar-action":{"label":"Toolbar action"},"reference-open":{"label":"Open the linked record"},"rows-drag":{"label":"Rows dragged"},"cell-set":{"label":"Cell value changed"},"view-change":{"label":"Table view changed"},"window":{"label":"Rows shown"}},"runtime":{"actions-column-label":"Actions","apply-text":"Apply","clear-text":"Clear","close-text":"Close","column-move-label":"Move the column","column-search-empty-text":"No field matches","column-search-placeholder":"Search the fields","context-create-options-label":"Ways to create","context-field-filter-label":"Filtering by","context-filter-settings-label":"Filter settings","context-row-actions-label":"Row actions","context-save-template-label":"Saving the filter as a template","context-table-settings-label":"Table settings","context-template-actions-label":"Template actions","context-view-actions-label":"View actions","create-options-label":"Ways to create","create-text":"Create","default-template-text":"Default","delete-action-text":"Delete","edit-action-text":"Edit","empty-text":"No data","error-text":"The data could not be loaded","field-word-text":"field","fields-tab-text":"Fields","filter-apply-text":"Apply","filter-settings-label":"Filter settings","filter-text":"Filter","list-filter-label":"Filter, {count} active","loading-text":"Loading","make-default-label":"Make it the default","menu-label":"Menu","operator-any":"Any date","operator-between":"Range","operator-contains":"Contains","operator-eq":"Exactly","operator-gt":"Greater than","operator-gte":"Greater or equal","operator-in":"In the list","operator-lt":"Less than","operator-lte":"Less or equal","operator-month":"This month","operator-starts-with":"Starts with","operator-today":"Today","operator-week":"This week","pin-column-label":"Pin the column","rename-text":"Rename","reset-both-text":"Reset the search and filters","reset-filters-text":"Reset the filters","reset-search-text":"Clear the search","reset-text":"Reset","restore-text":"Restore","retry-text":"Try again","row-actions-label":"Row actions","save-for-everyone-label":"Save for everyone","save-template-label":"Save the filter as a template","search-placeholder":"Search","select-all-label":"Select every row","select-row-label":"Select the row","settings-column-label":"Settings","settings-fields-tab":"Fields","settings-view-tab":"View","sort-ascending":"ascending","sort-descending":"descending","sort-label":"Sort","sort-none":"As the host orders it","template-actions-label":"Template actions","template-move-label":"Move the template","template-name-placeholder":"Name","template-pin-label":"Keep the template at the top","templates-tab-text":"Templates","tree-collapse":"Collapse","tree-expand":"Expand","tree-more":"Show more","unpin-column-label":"Unpin the column","untitled-template-text":"All records","view-action-text":"View","view-density":"Rows","view-density-compact":"Compact","view-density-normal":"Normal","view-density-spacious":"Spacious","view-everywhere":"For all my tables","view-lines":"Lines between columns","view-reset":"Reset the view","view-single-line":"Text on one line","view-sticky-head":"Keep the filter and the head in view","view-stripes":"Alternate rows"}}')},"32294b89604f"(e){e.exports=JSON.parse('{"title":"Таблица","events":{"column-settings-reset":{"label":"Настройки столбцов сброшены"},"filter-change":{"label":"Фильтр изменён"},"search-change":{"label":"Поиск изменён"},"sort-change":{"label":"Порядок изменён"},"template-delete":{"label":"Шаблон удалён"},"template-save":{"label":"Шаблон сохранён"},"template-select":{"label":"Шаблон выбран"},"toolbar-action":{"label":"Действие панели"},"reference-open":{"label":"Открыть связанную запись"},"rows-drag":{"label":"Строки перетащены"},"cell-set":{"label":"Значение в ячейке изменено"},"view-change":{"label":"Вид таблицы изменён"},"window":{"label":"Показаны строки"}},"runtime":{"actions-column-label":"Действия","apply-text":"Применить","clear-text":"Очистить","close-text":"Закрыть","column-move-label":"Переместить столбец","column-search-empty-text":"Поля не найдены","column-search-placeholder":"Поиск по полям","context-create-options-label":"Варианты создания","context-field-filter-label":"Настройка фильтра","context-filter-settings-label":"Настройки фильтра","context-row-actions-label":"Действия со строкой","context-save-template-label":"Сохранение шаблона фильтра","context-table-settings-label":"Настройки таблицы","context-template-actions-label":"Действия с шаблоном","context-view-actions-label":"Действия с представлением","create-options-label":"Варианты создания","create-text":"Создать","default-template-text":"По умолчанию","delete-action-text":"Удалить","edit-action-text":"Редактировать","empty-text":"Нет данных","error-text":"Не удалось загрузить данные","field-word-text":"поле","fields-tab-text":"Поля","filter-apply-text":"Применить","filter-settings-label":"Настройки фильтра","filter-text":"Фильтр","list-filter-label":"Фильтр, активных условий: {count}","loading-text":"Загрузка данных","make-default-label":"Сделать по умолчанию","menu-label":"Меню","operator-any":"Любая дата","operator-between":"Диапазон","operator-contains":"Содержит","operator-eq":"Точно","operator-gt":"Больше чем","operator-gte":"Больше или равно","operator-in":"В списке","operator-lt":"Меньше чем","operator-lte":"Меньше или равно","operator-month":"Месяц","operator-starts-with":"Начинается с","operator-today":"Сегодня","operator-week":"Неделя","pin-column-label":"Закрепить столбец","rename-text":"Переименовать","reset-both-text":"Сбросить поиск и фильтры","reset-filters-text":"Сбросить фильтры","reset-search-text":"Очистить поиск","reset-text":"Сбросить","restore-text":"Восстановить","retry-text":"Повторить","row-actions-label":"Действия со строкой","save-for-everyone-label":"Сохранить для всех","save-template-label":"Сохранение шаблона фильтра","search-placeholder":"Поиск","select-all-label":"Выбрать все строки","select-row-label":"Выбрать строку","settings-column-label":"Настройки","settings-fields-tab":"Поля","settings-view-tab":"Вид","sort-ascending":"по возрастанию","sort-descending":"по убыванию","sort-label":"Сортировка","sort-none":"Как задано источником","template-actions-label":"Действия с шаблоном","template-move-label":"Переместить шаблон","template-name-placeholder":"Название","template-pin-label":"Закрепить шаблон сверху","templates-tab-text":"Шаблоны","tree-collapse":"Свернуть","tree-expand":"Развернуть","tree-more":"Показать ещё","unpin-column-label":"Открепить столбец","untitled-template-text":"Все записи","view-action-text":"Посмотреть","view-density":"Строки","view-density-compact":"Компактно","view-density-normal":"Обычно","view-density-spacious":"Просторно","view-everywhere":"Для всех моих таблиц","view-lines":"Линии между столбцами","view-reset":"Сбросить вид","view-single-line":"Текст в одну строку","view-sticky-head":"Закреплять фильтр и шапку","view-stripes":"Чередовать строки"}}')}};const t={};function n(s){const i=t[s];if(void 0!==i)return i.exports;const r=t[s]={exports:{}};return e[s](r,r.exports,n),r.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",s=e?Symbol("webpack exports"):"__webpack_exports__",i=e?Symbol("webpack error"):"__webpack_error__",r=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};n.a=(e,n,a)=>{let o;a&&((o=[]).d=-1);const l=new Set,c=e.exports;let u,d,h;const p=new Promise((e,t)=>{h=t,d=e});p[s]=c,p[t]=e=>(o&&e(o),l.forEach(e),p.catch(e=>{})),e.exports=p;n(e=>{let n;u=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const n=[];n.d=0,e.then(e=>{a[s]=e,r(n)},e=>{a[i]=e,r(n)});const a={};return a[t]=e=>e(n),a}}const n={};return n[t]=e=>{},n[s]=e,n}))(e);const a=()=>u.map(e=>{if(e[i])throw e[i];return e[s]}),c=new Promise(e=>{n=()=>e(a),n.r=0;const s=e=>e!==o&&!l.has(e)&&(l.add(e),e&&!e.d&&(n.r++,e.push(n)));u.map(e=>e[t](s))});return n.r?c:a()},e=>(e?h(p[i]=e):d(c),r(o))),o?.d<0&&(o.d=0)}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var s=0;s<t.length;){var i=t[s++],r=t[s++];n.o(e,i)?0===r&&s++:0===r?Object.defineProperty(e,i,{enumerable:!0,value:t[s++]}):Object.defineProperty(e,i,{enumerable:!0,get:r})}else for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);n("94d60d3691b5")})();
|