@svgrid/enterprise 3.1.67 → 3.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/svgrid-enterprise.svelte-external.js +1 -1
- package/dist/designer/assets/{index-D7rq61o4.js → index-Dwe1MXA7.js} +1 -1
- package/dist/designer/index.html +1 -1
- package/dist/fields/BaseTabs.svelte +30 -6
- package/dist/fields/RecordView.svelte +101 -57
- package/dist/fields/activity.svelte.d.ts +37 -0
- package/dist/fields/activity.svelte.js +1 -1
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/fields/messages/record.d.ts +14 -0
- package/dist/fields/messages/record.js +1 -1
- package/dist/fields/messages.svelte.d.ts +14 -0
- package/dist/node/studio.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wc/sv-base-element.js +96 -94
- package/package.json +1 -1
|
@@ -1527,7 +1527,7 @@ ${O}
|
|
|
1527
1527
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
1528
1528
|
</style>
|
|
1529
1529
|
`}}function $S(t){for(let a of t)ss(a);let r=new Map(t.map(a=>[a.name,a])),n=t.map(a=>{let l=xse(a,r);return{schema:kse(a,l),infos:l}});return{entries:n,seed:_se(n)}}function ED(t,r={}){let{entries:n,seed:a}=$S(t),{file:l,needs:i}=Vse(n,a,r.sources,r.supabaseConn,r.serverMemory),o=[Cse(n),l];(i.supabase||r.supabaseAuth)&&!i.supabaseUrl&&(r.supabaseConn?.url||r.supabaseConn?.key)&&(i.supabaseUrl=r.supabaseConn.url,i.supabaseKey=r.supabaseConn.key),(i.supabase||r.supabaseAuth)&&o.push(Hse(i));for(let s of i.sqlRoutes)o.push(Fse(s.schema,s.table,s.dialect,{access:r.accessEnabled,audit:r.auditEnabled,screenIds:r.screensByEntity?.get(s.schema.name)??[],triggers:r.triggers?.[s.schema.name],dbSchema:s.dbSchema,tenantField:r.tenantField&&r.tenantScoped?.(s.schema.name)!==!1?r.tenantField:void 0}));if(i.memoryRoutes.length){o.push(Lse(i.memoryRoutes));for(let s of i.memoryRoutes)o.push(Ose(s.schema,{access:r.accessEnabled,audit:r.auditEnabled,screenIds:r.screensByEntity?.get(s.schema.name)??[],triggers:r.triggers?.[s.schema.name],tenantField:r.tenantField&&r.tenantScoped?.(s.schema.name)!==!1?r.tenantField:void 0}))}return{files:o,prepared:n.map(s=>s.schema)}}function Kse(t){if(t.length===0)throw Error("emitStudioApp: no schemas to emit");let{files:r,prepared:n}=ED(t),a=n.map(i=>{let o=Oa(i);return{href:`/${o.route}`,label:o.label}}),l={path:"src/custom.css",description:"Your custom styles (imported after app.css so it overrides).",userOwned:!0,contents:`/* Your custom styles. Imported after app.css, so these rules override the defaults. */
|
|
1530
|
-
`};return[...r,...n.map(i=>Wse(i)),AD(a),MD(a),l]}var Gse="3.1.
|
|
1530
|
+
`};return[...r,...n.map(i=>Wse(i)),AD(a),MD(a),l]}var Gse="3.1.68",Yse="3.0.40",hl=(t,r)=>t.some(n=>n.config.kind===r),RD=t=>`activeTab_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,Zm=(t,r)=>`${t}-${r}`,ID=t=>`accOpen_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,Qm=(t,r)=>`${t}-s${r}`,ev=t=>`md_${t.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function Xse(t){switch(t.type){case"number":{let r=t.decimals;return r==null?"{ type: 'number' }":`{ type: 'number', options: { minimumFractionDigits: ${r}, maximumFractionDigits: ${r} } }`}case"currency":return`{ type: 'currency', currency: ${en(t.currency||"USD")} }`;case"percent":{let r=["type: 'percent'"];return t.valueIsPercentPoints&&r.push("valueIsPercentPoints: true"),t.decimals!=null&&r.push(`options: { minimumFractionDigits: ${t.decimals}, maximumFractionDigits: ${t.decimals} }`),`{ ${r.join(", ")} }`}case"date":case"datetime":return t.pattern?`{ type: '${t.type}', pattern: ${en(t.pattern)} }`:`{ type: '${t.type}' }`}}function Jse(t,r,n,a){if(r.config.kind!=="grid")return`schemaToColumns(${t})`;let l=r.config,i=r.id.replace(/-/g,"_"),o=l.columns.filter(b=>b.show),s=new Set(o.map(b=>b.field)),c=new Set,d=o.map(b=>{let w=a?.get(b.field);return{c:b,col:w&&!s.has(w)?w:b.field}}).filter(b=>!c.has(b.col)&&!!c.add(b.col)),u=l.editing==="inline"?"":", editable: false";if(d.length===0)return u?`schemaToColumns(${t}).map((c) => ({ ...c${u} }))`:`schemaToColumns(${t})`;let p=d.map(b=>`'${b.col}'`),f=d.map(({c:b,col:w})=>{let v=[];return b.header&&v.push(`header: ${JSON.stringify(b.header)}`),b.width!=null&&v.push(`width: ${b.width}`),b.align&&v.push(`align: '${b.align}'`),b.aggregate&&v.push(`aggregate: '${b.aggregate}'`),l.treeData&&b.field===l.treeData.labelField&&n?v.push(`cell: (ctx: CellContext<${n}>) => renderSnippet(treeCell_${i}, { value: ctx.getValue(), row: ctx.row.original })`):b.cellType&&n?v.push(`cell: (ctx: CellContext<${n}>) => renderSnippet(${zD(i,b.field)}, { value: ctx.getValue() })`):b.format&&v.push(`format: ${Xse(b.format)}`),v.length?`'${w}': { ${v.join(", ")} }`:null}).filter(b=>!!b),y=f.length?` const ov: Record<string, Partial<(typeof all)[number]>> = { ${f.join(", ")} };`:"",h=f.length?", ...(ov[String(c.field)] ?? {})":"",_=`[${p.join(", ")}].map((f) => all.find((c) => c.field === f)).filter((c): c is (typeof all)[number] => !!c)`;return`(() => { const all = schemaToColumns(${t});${y} return ${u||h?`${_}.map((c) => ({ ...c${u}${h} }))`:_} })()`}function tc(t,r){let n=[`grid-column: span ${Xie(t)}`,"min-width: 0"];r&&n.push(r);let a=Zie(t.style);return a&&n.push(a),`style="${n.join("; ")}"`}var Zse=t=>t&&t.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function Nu(t,r){let n=[r,Yie(t)].filter(Boolean).join(" ");return n?` class="${n}"`:""}function n1(t){let r=cS(t.className);return r?` ${r}`:""}function Qse(t){let r=Af(t);if(r==="grid"){let n=goe(t),a=n.maxWidth?` max-width: ${n.maxWidth}px; margin-inline: auto;`:"";return` .st-screen { grid-template-columns: repeat(12, 1fr); gap: ${n.rowGap}px ${n.colGap}px; align-items: ${n.align};${a} }
|
|
1531
1531
|
@media (max-width: ${n.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
1532
1532
|
`}if(r==="stack"){let n=foe(t),a=n.maxWidth?` max-width: ${n.maxWidth}px;${n.align==="center"?" margin-inline: auto;":""}`:"",l=n.minHeight?`
|
|
1533
1533
|
.st-stack > * { min-height: ${n.minHeight}px; }`:"",i=n.dividers?`
|
|
@@ -76332,7 +76332,7 @@ ${st}
|
|
|
76332
76332
|
.st-home a { color: var(--sg-accent, #6366f1); font-weight: 600; }
|
|
76333
76333
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
76334
76334
|
</style>
|
|
76335
|
-
`}}function s2e(a){for(let p of a)G4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=kpr(p,i);return{schema:Ppr(p,f),infos:f}});return{entries:l,seed:Cpr(l)}}function rur(a,i={}){let{entries:l,seed:p}=s2e(a),{file:f,needs:g}=Ypr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[Opr(l),f];(g.supabase||i.supabaseAuth)&&!g.supabaseUrl&&(i.supabaseConn?.url||i.supabaseConn?.key)&&(g.supabaseUrl=i.supabaseConn.url,g.supabaseKey=i.supabaseConn.key),(g.supabase||i.supabaseAuth)&&_.push(Zpr(g));for(let S of g.sqlRoutes)_.push(Upr(S.schema,S.table,S.dialect,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],dbSchema:S.dbSchema,tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}));if(g.memoryRoutes.length){_.push(Hpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(Vpr(S.schema,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}))}return{files:_,prepared:l.map(S=>S.schema)}}var nur="3.1.
|
|
76335
|
+
`}}function s2e(a){for(let p of a)G4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=kpr(p,i);return{schema:Ppr(p,f),infos:f}});return{entries:l,seed:Cpr(l)}}function rur(a,i={}){let{entries:l,seed:p}=s2e(a),{file:f,needs:g}=Ypr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[Opr(l),f];(g.supabase||i.supabaseAuth)&&!g.supabaseUrl&&(i.supabaseConn?.url||i.supabaseConn?.key)&&(g.supabaseUrl=i.supabaseConn.url,g.supabaseKey=i.supabaseConn.key),(g.supabase||i.supabaseAuth)&&_.push(Zpr(g));for(let S of g.sqlRoutes)_.push(Upr(S.schema,S.table,S.dialect,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],dbSchema:S.dbSchema,tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}));if(g.memoryRoutes.length){_.push(Hpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(Vpr(S.schema,{access:i.accessEnabled,audit:i.auditEnabled,screenIds:i.screensByEntity?.get(S.schema.name)??[],triggers:i.triggers?.[S.schema.name],tenantField:i.tenantField&&i.tenantScoped?.(S.schema.name)!==!1?i.tenantField:void 0}))}return{files:_,prepared:l.map(S=>S.schema)}}var nur="3.1.68",our="3.0.40",sb=(a,i)=>a.some(l=>l.config.kind===i),qit=a=>`activeTab_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,XZ=(a,i)=>`${a}-${i}`,Kit=a=>`accOpen_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,JZ=(a,i)=>`${a}-s${i}`,YZ=a=>`md_${a.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function aur(a){switch(a.type){case"number":{let i=a.decimals;return i==null?"{ type: 'number' }":`{ type: 'number', options: { minimumFractionDigits: ${i}, maximumFractionDigits: ${i} } }`}case"currency":return`{ type: 'currency', currency: ${cu(a.currency||"USD")} }`;case"percent":{let i=["type: 'percent'"];return a.valueIsPercentPoints&&i.push("valueIsPercentPoints: true"),a.decimals!=null&&i.push(`options: { minimumFractionDigits: ${a.decimals}, maximumFractionDigits: ${a.decimals} }`),`{ ${i.join(", ")} }`}case"date":case"datetime":return a.pattern?`{ type: '${a.type}', pattern: ${cu(a.pattern)} }`:`{ type: '${a.type}' }`}}function iur(a,i,l,p){if(i.config.kind!=="grid")return`schemaToColumns(${a})`;let f=i.config,g=i.id.replace(/-/g,"_"),_=f.columns.filter(be=>be.show),S=new Set(_.map(be=>be.field)),A=new Set,k=_.map(be=>{let Be=p?.get(be.field);return{c:be,col:Be&&!S.has(Be)?Be:be.field}}).filter(be=>!A.has(be.col)&&!!A.add(be.col)),L=f.editing==="inline"?"":", editable: false";if(k.length===0)return L?`schemaToColumns(${a}).map((c) => ({ ...c${L} }))`:`schemaToColumns(${a})`;let F=k.map(be=>`'${be.col}'`),ee=k.map(({c:be,col:Be})=>{let Ue=[];return be.header&&Ue.push(`header: ${JSON.stringify(be.header)}`),be.width!=null&&Ue.push(`width: ${be.width}`),be.align&&Ue.push(`align: '${be.align}'`),be.aggregate&&Ue.push(`aggregate: '${be.aggregate}'`),f.treeData&&be.field===f.treeData.labelField&&l?Ue.push(`cell: (ctx: CellContext<${l}>) => renderSnippet(treeCell_${g}, { value: ctx.getValue(), row: ctx.row.original })`):be.cellType&&l?Ue.push(`cell: (ctx: CellContext<${l}>) => renderSnippet(${est(g,be.field)}, { value: ctx.getValue() })`):be.format&&Ue.push(`format: ${aur(be.format)}`),Ue.length?`'${Be}': { ${Ue.join(", ")} }`:null}).filter(be=>!!be),J=ee.length?` const ov: Record<string, Partial<(typeof all)[number]>> = { ${ee.join(", ")} };`:"",te=ee.length?", ...(ov[String(c.field)] ?? {})":"",Ie=`[${F.join(", ")}].map((f) => all.find((c) => c.field === f)).filter((c): c is (typeof all)[number] => !!c)`;return`(() => { const all = schemaToColumns(${a});${J} return ${L||te?`${Ie}.map((c) => ({ ...c${L}${te} }))`:Ie} })()`}function eW(a,i){let l=[`grid-column: span ${yM(a)}`,"min-width: 0"];i&&l.push(i);let p=vit(a.style);return p&&l.push(p),`style="${l.join("; ")}"`}var sur=a=>a&&a.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function z8(a,i){let l=[i,LH(a)].filter(Boolean).join(" ");return l?` class="${l}"`:""}function ofe(a){let i=WZ(a.className);return i?` ${i}`:""}function lur(a){let i=iR(a);if(i==="grid"){let l=qDe(a),p=l.maxWidth?` max-width: ${l.maxWidth}px; margin-inline: auto;`:"";return` .st-screen { grid-template-columns: repeat(12, 1fr); gap: ${l.rowGap}px ${l.colGap}px; align-items: ${l.align};${p} }
|
|
76336
76336
|
@media (max-width: ${l.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
76337
76337
|
`}if(i==="stack"){let l=que(a),p=l.maxWidth?` max-width: ${l.maxWidth}px;${l.align==="center"?" margin-inline: auto;":""}`:"",f=l.minHeight?`
|
|
76338
76338
|
.st-stack > * { min-height: ${l.minHeight}px; }`:"",g=l.dividers?`
|
package/dist/designer/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>SvGrid Studio - Designer</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-Dwe1MXA7.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-Dd_uD5pT.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/index-client-CwjHmKgT.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/disclose-version-xihTtKlq.js">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import{tick}from"svelte";import{keepFocus,menuFocus,SvModal,SvPopover}from"@svgrid/grid";import{linkReaders}from"./base-tables";import BaseSearch from"./BaseSearch.svelte";import{bm,bmCount}from"./messages.svelte";let{tables,activeId,onSwitch,onAdd,onRename,onDuplicate,onDelete,onExportSql,onExportView,onExportFiles,excelReady,status=null,undo=null,trashCount=0,onOpenTrash,onImport,readOnly=false,schema=true,importRecords=true,search=null,slot=$bindable(null),side=false,onSide,onSection}=$props();let stripW=$state(0);const compact=$derived(stripW>0&&stripW<=600);const statusTitle=$derived(status&&status.title&&status.title!==status.text?`${status.text}
|
|
3
3
|
${status.title}`:status?.text);const statusMore=$derived(status?.title&&status.title!==status.text?status.title:"");const statusOpenable=$derived(!!statusMore||status?.tone==="error");const statusKey=$derived(status?`${status.text}
|
|
4
|
-
${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statusOpenable&&openStatus===statusKey);$effect(()=>{if(openStatus!==null&&openStatus!==statusKey)openStatus=null});let searchBox=$state(null);let searchedFrom=null;let escaping=false;export function focusSearch(){const from=document.activeElement;if(from instanceof HTMLElement&&from!==document.body&&!from.closest(".sv-btabs-end"))searchedFrom=from;searchBox?.focus();return!!searchBox}function noteEscape(e){if(e.key!=="Escape")return;escaping=true;setTimeout(()=>escaping=false,0)}function leftSearch(e){if(escaping&&!e.relatedTarget&&searchedFrom?.isConnected)searchedFrom.focus()}let menuOpen=$state(false);let listOpen=$state(false);let addOpen=$state(false);let excelMissing=$state(false);$effect(()=>{if(listOpen&&onExportView&&excelReady)void excelReady().then(ok=>excelMissing=!ok)});const uid=`sv-btabs-${Math.random().toString(36).slice(2,8)}`;let renaming=$state(null);let draft=$state("");let deleting=$state(null);let confirmOpen=$state(false);let strip=$state(null);const active=$derived(tables.find(t=>t.id===activeId));function linksTo(t){const out=[];for(const o of tables){if(o.id===t.id)continue;for(const d of o.columns){if(d.fieldType!=="link"||d.fieldProps?.table!==t.id)continue;const name=String(d.header??d.field);out.push(`${o.name}: ${name}`);for(const r of linkReaders(o,d))out.push(bm("shell.readsLink",{table:o.name,field:String(r.header??r.field),link:name}))}}return out}async function startRename(id){if(readOnly||!schema)return;menuOpen=false;renaming=id;draft=tables.find(t=>t.id===id)?.name??"";await tick();const input=strip?.querySelector(".sv-btabs-input");input?.focus();input?.select()}function commitRename(){const id=renaming;renaming=null;const name=draft.trim();if(id&&name&&name!==tables.find(t=>t.id===id)?.name)onRename(id,name)}function renameKey(e){if(e.isComposing)return;if(e.key==="Enter")commitRename();else if(e.key==="Escape")renaming=null}function askDelete(){menuOpen=false;deleting=active??null;confirmOpen=!!deleting}function confirmDelete(){const t=deleting;confirmOpen=false;deleting=null;if(t)onDelete(t.id)}function tabKey(e,i){const order=
|
|
4
|
+
${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statusOpenable&&openStatus===statusKey);$effect(()=>{if(openStatus!==null&&openStatus!==statusKey)openStatus=null});let searchBox=$state(null);let searchedFrom=null;let escaping=false;export function focusSearch(){const from=document.activeElement;if(from instanceof HTMLElement&&from!==document.body&&!from.closest(".sv-btabs-end"))searchedFrom=from;searchBox?.focus();return!!searchBox}function noteEscape(e){if(e.key!=="Escape")return;escaping=true;setTimeout(()=>escaping=false,0)}function leftSearch(e){if(escaping&&!e.relatedTarget&&searchedFrom?.isConnected)searchedFrom.focus()}let menuOpen=$state(false);let listOpen=$state(false);let addOpen=$state(false);let excelMissing=$state(false);$effect(()=>{if(listOpen&&onExportView&&excelReady)void excelReady().then(ok=>excelMissing=!ok)});const uid=`sv-btabs-${Math.random().toString(36).slice(2,8)}`;let renaming=$state(null);let draft=$state("");let deleting=$state(null);let confirmOpen=$state(false);let strip=$state(null);const active=$derived(tables.find(t=>t.id===activeId));function linksTo(t){const out=[];for(const o of tables){if(o.id===t.id)continue;for(const d of o.columns){if(d.fieldType!=="link"||d.fieldProps?.table!==t.id)continue;const name=String(d.header??d.field);out.push(`${o.name}: ${name}`);for(const r of linkReaders(o,d))out.push(bm("shell.readsLink",{table:o.name,field:String(r.header??r.field),link:name}))}}return out}async function startRename(id){if(readOnly||!schema)return;menuOpen=false;renaming=id;draft=tables.find(t=>t.id===id)?.name??"";await tick();const input=strip?.querySelector(".sv-btabs-input");input?.focus();input?.select()}function commitRename(){const id=renaming;renaming=null;const name=draft.trim();if(id&&name&&name!==tables.find(t=>t.id===id)?.name)onRename(id,name)}function renameKey(e){if(e.isComposing)return;if(e.key==="Enter")commitRename();else if(e.key==="Escape")renaming=null}function askDelete(){menuOpen=false;deleting=active??null;confirmOpen=!!deleting}function confirmDelete(){const t=deleting;confirmOpen=false;deleting=null;if(t)onDelete(t.id)}function tabKey(e,i){const order=compact?tables.map(t=>t.id):shownOrder;const at=order.indexOf(tables[i].id);const next=sided?"ArrowDown":"ArrowRight";const back=sided?"ArrowUp":"ArrowLeft";let to=-1;if(e.key===next)to=(at+1)%order.length;else if(e.key===back)to=(at-1+order.length)%order.length;else if(e.key==="Home")to=0;else if(e.key==="End")to=order.length-1;else if(e.key==="F2"){e.preventDefault();void startRename(tables[i].id);return}if(to<0||!order[to])return;e.preventDefault();const id=order[to];onSwitch(id);void tick().then(()=>document.getElementById(`${uid}-${id}`)?.focus())}let hostW=$state(0);$effect(()=>{const host=strip?.parentElement;if(!host||typeof ResizeObserver!=="function")return;const watch=new ResizeObserver(()=>hostW=host.clientWidth);watch.observe(host);hostW=host.clientWidth;return()=>watch.disconnect()});const sided=$derived(side&&hostW>760);$effect(()=>{const host=strip?.parentElement;if(!host)return;host.classList.toggle("sv-btabs-sided",sided);return()=>host.classList.remove("sv-btabs-sided")});const groups=$derived.by(()=>{const out=[{name:"",items:[]}];tables.forEach((t,i)=>{const name=(t.section??"").trim();let g=out.find(x=>x.name===name);if(!g)out.push(g={name,items:[]});g.items.push({t,i})});return out.filter(g=>g.items.length)});const FOLD_KEY="svgrid-table-groups-folded";const readFolded=()=>{try{const v=JSON.parse(localStorage.getItem(FOLD_KEY)??"[]");return Array.isArray(v)?v.filter(x=>typeof x==="string"):[]}catch{return[]}};let folded=$state(typeof localStorage==="undefined"?[]:readFolded());function fold(name){folded=folded.includes(name)?folded.filter(x=>x!==name):[...folded,name];try{localStorage.setItem(FOLD_KEY,JSON.stringify(folded))}catch{}}const shows=(g,t)=>!g.name||!folded.includes(g.name)||t.id===activeId;const shownOrder=$derived(groups.flatMap(g=>g.items.filter(x=>shows(g,x.t)).map(x=>x.t.id)));const groupColor=g=>g.items.find(x=>x.t.color)?.t.color??null;const hiddenIn=g=>g.items.filter(x=>!shows(g,x.t)).length;let sectioning=$state(null);let sectionDraft=$state("");const sectionNames=$derived([...new Set(tables.map(t=>(t.section??"").trim()).filter(Boolean))]);async function startSection(id){menuOpen=false;sectioning=id;sectionDraft=tables.find(t=>t.id===id)?.section??"";await tick();const input=strip?.parentElement?.querySelector(".sv-btabs-section-input");input?.focus();input?.select()}function commitSection(){const id=sectioning;sectioning=null;if(id==null)return;const name=sectionDraft.trim();if(name!==(tables.find(t=>t.id===id)?.section??"").trim())onSection?.(id,name)}function sectionKey(e){if(e.key==="Enter"){e.preventDefault();commitSection()}else if(e.key==="Escape"){e.preventDefault();e.stopPropagation();sectioning=null}}const inputValue=e=>e.currentTarget.value;
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
{#snippet tabItem(t: BaseTable, i: number)}
|
|
@@ -55,7 +55,7 @@ ${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statu
|
|
|
55
55
|
{#if onImport && importRecords}
|
|
56
56
|
<button type="button" role="menuitem" class="sv-btabs-item" onclick={() => { menuOpen = false; onImport('append') }}>{bm('shell.importRecordsFromFile')}</button>
|
|
57
57
|
{/if}
|
|
58
|
-
{#if schema && onSection
|
|
58
|
+
{#if schema && onSection}
|
|
59
59
|
<button type="button" role="menuitem" class="sv-btabs-item" onclick={() => startSection(t.id)}>{bm('shell.moveTableToSection')}</button>
|
|
60
60
|
{/if}
|
|
61
61
|
{#if schema}
|
|
@@ -71,7 +71,7 @@ ${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statu
|
|
|
71
71
|
<div class="sv-btabs" class:has-open-status={statusOpen} class:is-compact={compact} class:is-sided={sided} bind:this={strip} bind:clientWidth={stripW}>
|
|
72
72
|
<div class="sv-btabs-list">
|
|
73
73
|
|
|
74
|
-
<div role="tablist" aria-label={bm('shell.tablesLabel')} aria-orientation={sided ? 'vertical' : 'horizontal'} aria-owns={(
|
|
74
|
+
<div role="tablist" aria-label={bm('shell.tablesLabel')} aria-orientation={sided ? 'vertical' : 'horizontal'} aria-owns={(compact ? tables.map((t) => t.id) : shownOrder).map((id) => `${uid}-${id}`).join(' ')}></div>
|
|
75
75
|
{#if sided}
|
|
76
76
|
<div class="sv-btabs-side-head" aria-hidden="true">{bm('shell.tablesHeading')}</div>
|
|
77
77
|
{#each groups as g (g.name)}
|
|
@@ -92,10 +92,34 @@ ${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statu
|
|
|
92
92
|
<span>{bm('shell.addTable')}</span>
|
|
93
93
|
</button>
|
|
94
94
|
{/if}
|
|
95
|
-
|
|
96
|
-
{:else}
|
|
95
|
+
{:else if compact}
|
|
97
96
|
{#each tables as t, i (t.id)}{@render tabItem(t, i)}{/each}
|
|
97
|
+
{:else}
|
|
98
|
+
{#each groups as g (g.name)}
|
|
99
|
+
{#if g.name}
|
|
100
|
+
{@const shut = folded.includes(g.name)}
|
|
101
|
+
{@const hidden = hiddenIn(g)}
|
|
102
|
+
<button
|
|
103
|
+
type="button"
|
|
104
|
+
class="sv-btabs-group is-top"
|
|
105
|
+
class:is-shut={shut}
|
|
106
|
+
class:has-color={!!groupColor(g)}
|
|
107
|
+
style:--sv-btabs-c={groupColor(g)}
|
|
108
|
+
aria-expanded={!shut}
|
|
109
|
+
title={g.name}
|
|
110
|
+
onclick={() => fold(g.name)}
|
|
111
|
+
>
|
|
112
|
+
<span>{g.name}</span>
|
|
113
|
+
{#if shut && hidden}<span class="sv-btabs-group-n">+{hidden}</span>{/if}
|
|
114
|
+
<svg viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" /></svg>
|
|
115
|
+
</button>
|
|
116
|
+
{/if}
|
|
117
|
+
{#each g.items as x (x.t.id)}
|
|
118
|
+
{#if shows(g, x.t)}{@render tabItem(x.t, x.i)}{/if}
|
|
119
|
+
{/each}
|
|
120
|
+
{/each}
|
|
98
121
|
{/if}
|
|
122
|
+
<datalist id={`${uid}-sections`}>{#each sectionNames as n (n)}<option value={n}></option>{/each}</datalist>
|
|
99
123
|
</div>
|
|
100
124
|
<div class="sv-btabs-tools">
|
|
101
125
|
|
|
@@ -283,5 +307,5 @@ ${statusMore}`:null);let openStatus=$state(null);const statusOpen=$derived(statu
|
|
|
283
307
|
{/if}
|
|
284
308
|
|
|
285
309
|
<style>
|
|
286
|
-
.sv-btabs{--sv-btabs-h: 33px;flex:none;display:flex;align-items:flex-end;gap:2px;box-sizing:border-box;height:calc(var(--sv-btabs-h) + 7px);padding:0 6px 0 0;font-family:var(--sg-font, inherit);font-size:13px;line-height:1;background:var(--sg-muted-bg, var(--sg-header-bg, #f5f5f4));box-shadow:inset 0 -1px 0 var(--sg-border, #e7e5e4)}.sv-btabs-list{display:flex;align-items:flex-end;min-width:0;height:100%;padding:0 0 0 8px;overflow-x:auto;scrollbar-width:none}.sv-btabs-tab.has-color:not(.is-active){background:color-mix(in srgb,var(--sv-btabs-c) 18%,transparent);color:color-mix(in srgb,var(--sv-btabs-c) 72%,var(--sg-fg, #1c1917))}.sv-btabs-tab.has-color:not(.is-active):hover{background:color-mix(in srgb,var(--sv-btabs-c) 28%,transparent)}.sv-btabs-tab.has-color:not(.is-active):before,.sv-btabs-tab.has-color+.sv-btabs-tab:before{opacity:0}.sv-btabs-tab.has-color.is-active{color:var(--sv-btabs-c);box-shadow:inset 0 3px 0 var(--sv-btabs-c)}:global(.sv-btabs-sided){position:relative;padding-inline-start:var(--sv-btabs-side-w, 228px)}.sv-btabs.is-sided .sv-btabs-list{position:absolute;inset-block:0;inset-inline-start:0;width:var(--sv-btabs-side-w, 228px);height:auto;box-sizing:border-box;flex-direction:column;align-items:stretch;gap:1px;padding:10px 8px 16px;overflow:hidden auto;background:var(--sg-muted-bg, var(--sg-header-bg, #f5f5f4));border-inline-end:1px solid var(--sg-border, #e7e5e4)}.sv-btabs-side-head{margin:2px 8px 6px;font-size:11px;font-weight:650;letter-spacing:.06em;text-transform:uppercase;color:var(--sg-muted, #78716c)}.sv-btabs-group{display:flex;align-items:center;gap:6px;margin:8px 0 2px;padding:4px 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #57534e);font:inherit;font-size:12px;font-weight:650;text-align:start;cursor:pointer}.sv-btabs-group:hover{color:var(--sg-fg, #1c1917)}.sv-btabs-group svg{flex:none;transition:transform .12s ease}.sv-btabs-group.is-shut svg{transform:rotate(-90deg)}.sv-btabs.is-sided .sv-btabs-tab{flex:none;height:32px;margin:0;padding:0 4px 0 6px;border:0;border-radius:var(--sg-radius, 6px)}.sv-btabs.is-sided .sv-btabs-tab:before{display:none}.sv-btabs.is-sided .sv-btabs-tab:not(.is-active):hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs.is-sided .sv-btabs-name{flex:1;min-width:0;max-width:none;text-align:start;display:flex;align-items:center;gap:9px}.sv-btabs.is-sided .sv-btabs-name:before{content:"";flex:none;width:10px;height:10px;border-radius:3px;background:var(--sv-btabs-c, var(--sg-border, #d6d3d1))}.sv-btabs.is-sided .sv-btabs-tab.is-active{height:32px;margin:0;padding-bottom:0;background:var(--sg-bg, #fff);box-shadow:inset 3px 0 0 var(--sv-btabs-c, var(--sg-accent, #2563eb)),0 1px 2px #0f172a14}.sv-btabs.is-sided .sv-btabs-tab.has-color:not(.is-active){background:none;color:var(--sg-fg, #1c1917)}.sv-btabs.is-sided .sv-btabs-tab.has-color:not(.is-active):hover{background:color-mix(in srgb,var(--sv-btabs-c) 12%,transparent)}.sv-btabs.is-sided .sv-btabs-input{width:100%}.sv-btabs-side-add{display:flex;align-items:center;gap:8px;margin-top:10px;padding:7px 10px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);font:inherit;text-align:start;cursor:pointer}.sv-btabs-side-add:hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs-list::-webkit-scrollbar{display:none}.sv-btabs-tab{position:relative;flex:none;display:flex;align-items:center;gap:2px;box-sizing:border-box;height:var(--sv-btabs-h);padding:0 6px 1px 4px;border:1px solid transparent;border-bottom:0;border-radius:var(--sg-radius, 6px) var(--sg-radius, 6px) 0 0;color:var(--sg-muted, #78716c);transition:color .12s ease,background-color .12s ease}.sv-btabs-tab:not(.is-active)+.sv-btabs-tab:not(.is-active):before{content:"";position:absolute;left:-2px;top:10px;bottom:10px;width:1px;background:var(--sg-border, #e7e5e4)}.sv-btabs-tab:hover:before,.sv-btabs-tab:hover+.sv-btabs-tab:before{opacity:0}.sv-btabs-tab:not(.is-active):hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-bg, #fff) 55%,transparent)}.sv-btabs-tab.is-active{z-index:1;height:calc(var(--sv-btabs-h) + 1px);margin-bottom:-1px;padding-bottom:2px;color:var(--sg-fg, #1c1917);background:var(--sg-bg, #fff);border-color:var(--sg-border, #e7e5e4);box-shadow:inset 0 2px 0 var(--sg-accent, #2563eb)}.sv-btabs-name{max-width:220px;height:26px;padding:0 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:inherit;font:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.is-active .sv-btabs-name{font-weight:600;padding-right:2px}.sv-btabs-more{display:grid;place-items:center;width:22px;height:22px;padding:0;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);cursor:pointer}.sv-btabs-more:hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 10%,transparent);color:var(--sg-fg, #1c1917)}.sv-btabs-input{width:160px;height:24px;margin:0 2px;padding:0 6px;box-sizing:border-box;font:inherit;font-weight:600;color:var(--sg-fg, #1c1917);background:var(--sg-input-bg, var(--sg-bg, #fff));border:1px solid var(--sg-accent, #2563eb);border-radius:var(--sg-radius, 6px);outline:none}.sv-btabs-tools{flex:none;display:flex;align-items:center;gap:2px;height:var(--sv-btabs-h);margin-left:0}.sv-btabs-end .sv-btabs-tools{display:contents}.sv-btabs-end{flex:none;display:flex;align-items:center;gap:2px;height:var(--sv-btabs-h);margin-left:auto}.sv-btabs-status~.sv-btabs-end{margin-left:0}.sv-btabs-tool:disabled{opacity:.4;cursor:default;background:none}.sv-btabs-tool[aria-busy=true]{cursor:progress}.sv-btabs-trash{gap:4px;padding:0 6px}.sv-btabs-end>:global(.sv-pop__anchor){margin-right:4px}.sv-btabs-badge{display:inline-flex;align-items:center;gap:5px;height:22px;margin:0 2px;padding:0 8px;border-radius:999px;white-space:nowrap;font-size:12px;color:var(--sg-muted, #78716c);background:color-mix(in srgb,var(--sg-fg, #1c1917) 7%,transparent)}.sv-btabs-count{font-size:12px;font-variant-numeric:tabular-nums}.sv-btabs-status{display:inline-grid;grid-auto-flow:column;grid-template-columns:minmax(0,auto);align-items:center;flex:0 1 auto;align-self:center;margin-left:auto;padding:0 12px;white-space:nowrap;font-size:12px;color:var(--sg-muted, #78716c)}.sv-btabs-status-text{overflow:hidden;text-overflow:ellipsis}button.sv-btabs-status-text{display:block;min-width:0;padding:0;border:0;background:none;color:inherit;font:inherit;line-height:inherit;white-space:inherit;text-align:start;cursor:pointer}button.sv-btabs-status-text:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:2px}.sv-btabs-status-more{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs.has-open-status{height:auto;min-height:calc(var(--sv-btabs-h) + 7px)}.sv-btabs-status.is-open{white-space:normal;padding-block:6px;line-height:1.35}.sv-btabs-status.is-open .sv-btabs-status-text{overflow:visible}.sv-btabs-status.is-open .sv-btabs-status-more{position:static;display:block;width:auto;height:auto;margin-top:2px;clip:auto;white-space:normal;overflow-wrap:anywhere}.sv-btabs-status.is-error{color:var(--sg-danger, #dc2626)}.sv-btabs-status-x{margin-inline-start:6px;padding:0 4px;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sv-btabs-status-stop{margin-inline-start:8px;padding:0 6px;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:none;color:inherit;font:inherit;cursor:pointer}.sv-btabs-tool{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);font:inherit;cursor:pointer;white-space:nowrap;transition:color .12s ease,background-color .12s ease}.sv-btabs-icon{width:26px;padding:0;justify-content:center}.sv-btabs-split{display:inline-flex;align-items:center;flex:none;border-radius:var(--sg-radius, 6px)}.sv-btabs-split.has-more .sv-btabs-add{border-start-end-radius:0;border-end-end-radius:0;padding-inline-end:6px}.sv-btabs-addmore{width:24px;padding:0;justify-content:center;border-start-start-radius:0;border-end-start-radius:0}.sv-btabs-split:hover .sv-btabs-addmore,.sv-btabs-addmore[aria-expanded=true]{box-shadow:inset 1px 0 0 var(--sg-border, #e2e8f0)}.sv-btabs-addmore[aria-expanded=true],.sv-btabs-tool:hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-bg, #fff) 55%,transparent)}@media(forced-colors:active){.sv-btabs-tab.is-active{border:1px solid Highlight;border-bottom-color:Canvas;box-shadow:none}.sv-btabs-tab.is-active .sv-btabs-name{color:Highlight;forced-color-adjust:none;text-decoration:underline}}@media print{.sv-btabs{display:none}}.sv-btabs-name:focus-visible,.sv-btabs-more:focus-visible,.sv-btabs-tool:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:-2px}@media(prefers-reduced-motion:reduce){.sv-btabs-tab,.sv-btabs-tool{transition:none}}.sv-btabs.is-compact{align-items:center;padding-right:0}.sv-btabs.is-compact .sv-btabs-list{flex:none;max-width:42%}.sv-btabs.is-compact .sv-btabs-tab:not(.is-active){display:none}.sv-btabs.is-compact .sv-btabs-list{padding-left:4px;align-items:center}.sv-btabs.is-compact .sv-btabs-tab.is-active{height:30px;margin:0;padding:0;border:0;border-radius:var(--sg-radius, 6px);background:none;box-shadow:none}.sv-btabs.is-compact .sv-btabs-tab.is-active .sv-btabs-name{height:30px;padding:0 2px 0 8px;font-size:14px}.sv-btabs.is-compact .sv-btabs-tools{margin-left:-2px}.sv-btabs.is-compact .sv-btabs-tools .sv-btabs-icon{height:30px;color:var(--sg-fg, #1c1917)}.sv-btabs.is-compact .sv-btabs-tab.is-active:hover,.sv-btabs.is-compact .sv-btabs-tools .sv-btabs-icon:hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs.is-compact .sv-btabs-end{display:none}.sv-btabs.is-compact .sv-btabs-status:not(.has-stop){display:none}.sv-btabs-slot{flex:1 1 auto;min-width:0;align-self:stretch;display:flex;align-items:center}.sv-btabs-slot>:global(.sv-fvb){flex:1 1 auto;min-width:0;min-height:0;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:0 4px;border-bottom:0;background:transparent;scroll-padding-inline:6px}.sv-btabs-slot>:global(.sv-fvb::-webkit-scrollbar){display:none}.sv-btabs-slot>:global(.sv-fvb>*){flex:none}.sv-btabs-slot>:global(.sv-fvb>.sv-fvb-spacer){flex:1 0 0}@container (max-width: 600px){.sv-btabs-add span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs-add{flex:none;width:26px;padding:0;justify-content:center}.sv-btabs-badge span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs-badge{padding:0 6px}.sv-btabs-status:not(.has-stop){display:none}.sv-btabs-name{max-width:130px}}.sv-btabs-menu{display:flex;flex-direction:column;min-width:190px;max-height:320px;overflow-y:auto;padding:4px;font-size:13px}.sv-btabs-sep{flex:none;height:1px;margin:4px 6px;background:var(--sg-border, #e2e8f0)}.sv-btabs-item{flex:none;display:flex;align-items:center;gap:6px;height:32px;padding:0 10px;text-align:start;border:0;border-radius:6px;background:none;color:var(--sg-fg, #0f172a);font:inherit;cursor:pointer}.sv-btabs-item:hover:not(:disabled),.sv-btabs-item:focus-visible{background:color-mix(in srgb,var(--sg-fg, #0f172a) 6%,transparent);outline:none}@media(forced-colors:active){.sv-btabs-item:focus-visible{outline:2px solid Highlight;outline-offset:-2px}}.sv-btabs-item[aria-disabled=true]{color:var(--sg-muted, #64748b);cursor:default}.sv-btabs-item.is-why{height:auto;min-height:32px;padding-block:6px;align-items:flex-start;color:var(--sg-muted, #64748b);cursor:default}.sv-btabs-why{display:block;max-width:260px;font-size:12px;line-height:1.4;white-space:normal}.sv-btabs-item.is-danger:not(:disabled){color:var(--sg-danger, #dc2626)}.sv-btabs-item.is-current{font-weight:600}.sv-btabs-check{width:14px;flex:none;color:var(--sg-muted, #64748b)}.sv-btabs-warn{margin:0 0 8px;font-size:14px;color:var(--sg-fg, #0f172a)}.sv-btabs-links{margin:0 0 4px;padding-left:18px;font-size:13px;color:var(--sg-muted, #64748b)}.sv-btabs-foot{display:flex;justify-content:flex-end;gap:8px;width:100%}.sv-btabs-btn{height:32px;padding:0 14px;font:inherit;font-size:13px;cursor:pointer;border-radius:var(--sg-radius, 6px);background:transparent;color:var(--sg-fg, #0f172a);border:1px solid var(--sg-border, #e2e8f0)}.sv-btabs-btn.is-danger{background:var(--sg-danger, #dc2626);border-color:var(--sg-danger, #dc2626);color:#fff}
|
|
310
|
+
.sv-btabs{--sv-btabs-h: 33px;flex:none;display:flex;align-items:flex-end;gap:2px;box-sizing:border-box;height:calc(var(--sv-btabs-h) + 7px);padding:0 6px 0 0;font-family:var(--sg-font, inherit);font-size:13px;line-height:1;background:var(--sg-muted-bg, var(--sg-header-bg, #f5f5f4));box-shadow:inset 0 -1px 0 var(--sg-border, #e7e5e4)}.sv-btabs-list{display:flex;align-items:flex-end;min-width:0;height:100%;padding:0 0 0 8px;overflow-x:auto;scrollbar-width:none}.sv-btabs-tab.has-color,.sv-btabs-tab.has-color.is-active{box-shadow:inset 0 3px 0 var(--sv-btabs-c)}:global(.sv-btabs-sided){position:relative;padding-inline-start:var(--sv-btabs-side-w, 228px)}.sv-btabs.is-sided .sv-btabs-list{position:absolute;inset-block:0;inset-inline-start:0;width:var(--sv-btabs-side-w, 228px);height:auto;box-sizing:border-box;flex-direction:column;align-items:stretch;gap:1px;padding:10px 8px 16px;overflow:hidden auto;background:var(--sg-muted-bg, var(--sg-header-bg, #f5f5f4));border-inline-end:1px solid var(--sg-border, #e7e5e4)}.sv-btabs-side-head{margin:2px 8px 6px;font-size:11px;font-weight:650;letter-spacing:.06em;text-transform:uppercase;color:var(--sg-muted, #78716c)}.sv-btabs-group{display:flex;align-items:center;gap:6px;margin:8px 0 2px;padding:4px 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #57534e);font:inherit;font-size:12px;font-weight:650;text-align:start;cursor:pointer}.sv-btabs-group:hover{color:var(--sg-fg, #1c1917)}.sv-btabs-group svg{flex:none;transition:transform .12s ease}.sv-btabs-group.is-shut svg{transform:rotate(-90deg)}.sv-btabs-group.is-top{flex:none;align-self:center;gap:4px;max-width:160px;height:22px;margin:0 2px 3px 8px;padding:0 7px 0 9px;border-radius:999px;background:color-mix(in srgb,var(--sg-fg, #1c1917) 8%,transparent);color:var(--sg-fg, #1c1917);font-size:12px;font-weight:600}.sv-btabs-group.is-top span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-btabs-group.is-top:hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 14%,transparent)}.sv-btabs-group.is-top.has-color{background:color-mix(in srgb,var(--sv-btabs-c) 16%,transparent);color:color-mix(in srgb,var(--sv-btabs-c) 70%,var(--sg-fg, #1c1917))}.sv-btabs-group.is-top.has-color:hover{background:color-mix(in srgb,var(--sv-btabs-c) 26%,transparent)}.sv-btabs-group.is-top:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:1px}.sv-btabs-group-n{font-weight:500;opacity:.8}.sv-btabs.is-sided .sv-btabs-tab{flex:none;height:32px;margin:0;padding:0 4px 0 6px;border:0;border-radius:var(--sg-radius, 6px)}.sv-btabs.is-sided .sv-btabs-tab:before{display:none}.sv-btabs.is-sided .sv-btabs-tab:not(.is-active):hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs.is-sided .sv-btabs-name{flex:1;min-width:0;max-width:none;text-align:start;display:flex;align-items:center;gap:9px}.sv-btabs.is-sided .sv-btabs-name:before{content:"";flex:none;width:10px;height:10px;border-radius:3px;background:var(--sv-btabs-c, var(--sg-border, #d6d3d1))}.sv-btabs.is-sided .sv-btabs-tab.is-active{height:32px;margin:0;padding-bottom:0;background:var(--sg-bg, #fff);box-shadow:inset 3px 0 0 var(--sv-btabs-c, var(--sg-accent, #2563eb)),0 1px 2px #0f172a14}.sv-btabs.is-sided .sv-btabs-tab.has-color:not(.is-active){background:none;color:var(--sg-fg, #1c1917);box-shadow:none}.sv-btabs.is-sided .sv-btabs-tab.has-color:not(.is-active):hover{background:color-mix(in srgb,var(--sv-btabs-c) 12%,transparent)}.sv-btabs.is-sided .sv-btabs-input{width:100%}.sv-btabs-side-add{display:flex;align-items:center;gap:8px;margin-top:10px;padding:7px 10px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);font:inherit;text-align:start;cursor:pointer}.sv-btabs-side-add:hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs-list::-webkit-scrollbar{display:none}.sv-btabs-tab{position:relative;flex:none;display:flex;align-items:center;gap:2px;box-sizing:border-box;height:var(--sv-btabs-h);padding:0 6px 1px 4px;border:1px solid transparent;border-bottom:0;border-radius:var(--sg-radius, 6px) var(--sg-radius, 6px) 0 0;color:var(--sg-muted, #78716c);transition:color .12s ease,background-color .12s ease}.sv-btabs-tab:not(.is-active)+.sv-btabs-tab:not(.is-active):before{content:"";position:absolute;left:-2px;top:10px;bottom:10px;width:1px;background:var(--sg-border, #e7e5e4)}.sv-btabs-tab:hover:before,.sv-btabs-tab:hover+.sv-btabs-tab:before{opacity:0}.sv-btabs-tab:not(.is-active):hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-bg, #fff) 55%,transparent)}.sv-btabs-tab.is-active{z-index:1;height:calc(var(--sv-btabs-h) + 1px);margin-bottom:-1px;padding-bottom:2px;color:var(--sg-fg, #1c1917);background:var(--sg-bg, #fff);border-color:var(--sg-border, #e7e5e4);box-shadow:inset 0 2px 0 var(--sg-accent, #2563eb)}.sv-btabs-name{max-width:220px;height:26px;padding:0 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:inherit;font:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.is-active .sv-btabs-name{font-weight:600;padding-right:2px}.sv-btabs-more{display:grid;place-items:center;width:22px;height:22px;padding:0;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);cursor:pointer}.sv-btabs-more:hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 10%,transparent);color:var(--sg-fg, #1c1917)}.sv-btabs-input{width:160px;height:24px;margin:0 2px;padding:0 6px;box-sizing:border-box;font:inherit;font-weight:600;color:var(--sg-fg, #1c1917);background:var(--sg-input-bg, var(--sg-bg, #fff));border:1px solid var(--sg-accent, #2563eb);border-radius:var(--sg-radius, 6px);outline:none}.sv-btabs-tools{flex:none;display:flex;align-items:center;gap:2px;height:var(--sv-btabs-h);margin-left:0}.sv-btabs-end .sv-btabs-tools{display:contents}.sv-btabs-end{flex:none;display:flex;align-items:center;gap:2px;height:var(--sv-btabs-h);margin-left:auto}.sv-btabs-status~.sv-btabs-end{margin-left:0}.sv-btabs-tool:disabled{opacity:.4;cursor:default;background:none}.sv-btabs-tool[aria-busy=true]{cursor:progress}.sv-btabs-trash{gap:4px;padding:0 6px}.sv-btabs-end>:global(.sv-pop__anchor){margin-right:4px}.sv-btabs-badge{display:inline-flex;align-items:center;gap:5px;height:22px;margin:0 2px;padding:0 8px;border-radius:999px;white-space:nowrap;font-size:12px;color:var(--sg-muted, #78716c);background:color-mix(in srgb,var(--sg-fg, #1c1917) 7%,transparent)}.sv-btabs-count{font-size:12px;font-variant-numeric:tabular-nums}.sv-btabs-status{display:inline-grid;grid-auto-flow:column;grid-template-columns:minmax(0,auto);align-items:center;flex:0 1 auto;align-self:center;margin-left:auto;padding:0 12px;white-space:nowrap;font-size:12px;color:var(--sg-muted, #78716c)}.sv-btabs-status-text{overflow:hidden;text-overflow:ellipsis}button.sv-btabs-status-text{display:block;min-width:0;padding:0;border:0;background:none;color:inherit;font:inherit;line-height:inherit;white-space:inherit;text-align:start;cursor:pointer}button.sv-btabs-status-text:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:2px}.sv-btabs-status-more{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs.has-open-status{height:auto;min-height:calc(var(--sv-btabs-h) + 7px)}.sv-btabs-status.is-open{white-space:normal;padding-block:6px;line-height:1.35}.sv-btabs-status.is-open .sv-btabs-status-text{overflow:visible}.sv-btabs-status.is-open .sv-btabs-status-more{position:static;display:block;width:auto;height:auto;margin-top:2px;clip:auto;white-space:normal;overflow-wrap:anywhere}.sv-btabs-status.is-error{color:var(--sg-danger, #dc2626)}.sv-btabs-status-x{margin-inline-start:6px;padding:0 4px;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.sv-btabs-status-stop{margin-inline-start:8px;padding:0 6px;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:none;color:inherit;font:inherit;cursor:pointer}.sv-btabs-tool{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 8px;border:0;border-radius:var(--sg-radius, 6px);background:none;color:var(--sg-muted, #78716c);font:inherit;cursor:pointer;white-space:nowrap;transition:color .12s ease,background-color .12s ease}.sv-btabs-icon{width:26px;padding:0;justify-content:center}.sv-btabs-split{display:inline-flex;align-items:center;flex:none;border-radius:var(--sg-radius, 6px)}.sv-btabs-split.has-more .sv-btabs-add{border-start-end-radius:0;border-end-end-radius:0;padding-inline-end:6px}.sv-btabs-addmore{width:24px;padding:0;justify-content:center;border-start-start-radius:0;border-end-start-radius:0}.sv-btabs-split:hover .sv-btabs-addmore,.sv-btabs-addmore[aria-expanded=true]{box-shadow:inset 1px 0 0 var(--sg-border, #e2e8f0)}.sv-btabs-addmore[aria-expanded=true],.sv-btabs-tool:hover{color:var(--sg-fg, #1c1917);background:color-mix(in srgb,var(--sg-bg, #fff) 55%,transparent)}@media(forced-colors:active){.sv-btabs-tab.is-active{border:1px solid Highlight;border-bottom-color:Canvas;box-shadow:none}.sv-btabs-tab.is-active .sv-btabs-name{color:Highlight;forced-color-adjust:none;text-decoration:underline}}@media print{.sv-btabs{display:none}}.sv-btabs-name:focus-visible,.sv-btabs-more:focus-visible,.sv-btabs-tool:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:-2px}@media(prefers-reduced-motion:reduce){.sv-btabs-tab,.sv-btabs-tool{transition:none}}.sv-btabs.is-compact{align-items:center;padding-right:0}.sv-btabs.is-compact .sv-btabs-list{flex:none;max-width:42%}.sv-btabs.is-compact .sv-btabs-tab:not(.is-active){display:none}.sv-btabs.is-compact .sv-btabs-list{padding-left:4px;align-items:center}.sv-btabs.is-compact .sv-btabs-tab.is-active{height:30px;margin:0;padding:0;border:0;border-radius:var(--sg-radius, 6px);background:none;box-shadow:none}.sv-btabs.is-compact .sv-btabs-tab.is-active .sv-btabs-name{height:30px;padding:0 2px 0 8px;font-size:14px}.sv-btabs.is-compact .sv-btabs-tools{margin-left:-2px}.sv-btabs.is-compact .sv-btabs-tools .sv-btabs-icon{height:30px;color:var(--sg-fg, #1c1917)}.sv-btabs.is-compact .sv-btabs-tab.is-active:hover,.sv-btabs.is-compact .sv-btabs-tools .sv-btabs-icon:hover{background:color-mix(in srgb,var(--sg-fg, #1c1917) 6%,transparent)}.sv-btabs.is-compact .sv-btabs-end{display:none}.sv-btabs.is-compact .sv-btabs-status:not(.has-stop){display:none}.sv-btabs-slot{flex:1 1 auto;min-width:0;align-self:stretch;display:flex;align-items:center}.sv-btabs-slot>:global(.sv-fvb){flex:1 1 auto;min-width:0;min-height:0;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:0 4px;border-bottom:0;background:transparent;scroll-padding-inline:6px}.sv-btabs-slot>:global(.sv-fvb::-webkit-scrollbar){display:none}.sv-btabs-slot>:global(.sv-fvb>*){flex:none}.sv-btabs-slot>:global(.sv-fvb>.sv-fvb-spacer){flex:1 0 0}@container (max-width: 600px){.sv-btabs-add span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs-add{flex:none;width:26px;padding:0;justify-content:center}.sv-btabs-badge span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-btabs-badge{padding:0 6px}.sv-btabs-status:not(.has-stop){display:none}.sv-btabs-name{max-width:130px}}.sv-btabs-menu{display:flex;flex-direction:column;min-width:190px;max-height:320px;overflow-y:auto;padding:4px;font-size:13px}.sv-btabs-sep{flex:none;height:1px;margin:4px 6px;background:var(--sg-border, #e2e8f0)}.sv-btabs-item{flex:none;display:flex;align-items:center;gap:6px;height:32px;padding:0 10px;text-align:start;border:0;border-radius:6px;background:none;color:var(--sg-fg, #0f172a);font:inherit;cursor:pointer}.sv-btabs-item:hover:not(:disabled),.sv-btabs-item:focus-visible{background:color-mix(in srgb,var(--sg-fg, #0f172a) 6%,transparent);outline:none}@media(forced-colors:active){.sv-btabs-item:focus-visible{outline:2px solid Highlight;outline-offset:-2px}}.sv-btabs-item[aria-disabled=true]{color:var(--sg-muted, #64748b);cursor:default}.sv-btabs-item.is-why{height:auto;min-height:32px;padding-block:6px;align-items:flex-start;color:var(--sg-muted, #64748b);cursor:default}.sv-btabs-why{display:block;max-width:260px;font-size:12px;line-height:1.4;white-space:normal}.sv-btabs-item.is-danger:not(:disabled){color:var(--sg-danger, #dc2626)}.sv-btabs-item.is-current{font-weight:600}.sv-btabs-check{width:14px;flex:none;color:var(--sg-muted, #64748b)}.sv-btabs-warn{margin:0 0 8px;font-size:14px;color:var(--sg-fg, #0f172a)}.sv-btabs-links{margin:0 0 4px;padding-left:18px;font-size:13px;color:var(--sg-muted, #64748b)}.sv-btabs-foot{display:flex;justify-content:flex-end;gap:8px;width:100%}.sv-btabs-btn{height:32px;padding:0 14px;font:inherit;font-size:13px;cursor:pointer;border-radius:var(--sg-radius, 6px);background:transparent;color:var(--sg-fg, #0f172a);border:1px solid var(--sg-border, #e2e8f0)}.sv-btabs-btn.is-danger{background:var(--sg-danger, #dc2626);border-color:var(--sg-danger, #dc2626);color:#fff}
|
|
287
311
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{recordActionsFor}from"./record-actions";import{commentSnippets}from"./comment-snippets.svelte";import{onDestroy,onMount,tick,untrack}from"svelte";import{commentDraftsOf,getRecordRequest,holdForRecordEditor}from"./editor-request.svelte";import{SvModal,announce,portalToBody,toast}from"@svgrid/grid";import{DOCK_MAX,DOCK_MIN,DOCK_NARROW,recordDock,recordDockWidth,setRecordDock,setRecordDockWidth}from"./record-dock.svelte";import FieldInput from"./FieldInput.svelte";import{fieldPropsOf,getFieldType,originalColumn,ruleFieldNames}from"./registry.svelte";import{protectionText}from"./field-access.svelte";import{isReadOnlyGrid}from"./base-share";import{canCommentIn,canDeleteRecord}from"./base-permissions";import{askDeleteRecord}from"./record-delete.svelte";import{cellText,dataRows,fieldColumns,leafFilter,primaryIdOf}from"./grid-access";import{recordWalkOf}from"./record-walk";import{addComment,commentStoreTakes,commentVotes,commentsOf,commentsTakeVotes,deleteComment,editComment,historyOf,historyState,loadHistory,markSeen,mayVoteComment,myCommentVote,ownsComment,timeAgo,unseenOf,voteComment}from"./activity.svelte";import{uploadAttachment}from"./attachments";import{findFieldUser}from"./sources.svelte";import{encodeMentions,mentionText,parseMentions}from"./mentions";import MentionInput from"./MentionInput.svelte";import{dictationSupported,dictate,withSaid}from"./dictation.svelte";import UserFace from"./UserFace.svelte";import{recordProposalsFor}from"../review/card-marks.svelte";import{bm,bmCount}from"./messages.svelte";let{ctrl,rowId,editPrimary=false,focus,onClose}=$props();let current=$state(rowId);let open=$state(true);let editing=$state(null);let showHidden=$state(false);let comment=$state("");let picked=$state([]);const rows=$derived(ctrl.allRows??[]);let lastAt=-1;function rowIndexOf(list,id){if(id==null)return-1;for(const near of[lastAt,untrack(()=>ctrl.activeCell?.rowIndex??-1)]){if(near<0)continue;for(let d=0;d<=200;d++){if(list[near+d]?.id===id)return lastAt=near+d;if(d&&near-d>=0&&list[near-d]?.id===id)return lastAt=near-d}}return lastAt=list.findIndex(r=>r.id===id)}const index=$derived(rowIndexOf(rows,current));const row=$derived(index>=0?rows[index]:null);const isDraft=$derived(!!ctrl.props?.baseIsDraft?.(current));let lastIndex=0;const at=$derived.by(()=>{if(index>=0)lastIndex=index;return lastIndex});const walk=$derived(recordWalkOf(ctrl));const model=$derived(ctrl.props?.rowModel);const grouped=$derived((ctrl.groupingColumns??[]).length>0);const notRead=r=>String(r.id).startsWith("sv-ph:");function isRecord(r){const kind=r.original?.__group?.kind;return kind?kind==="leaf":r.__treeRow||!(typeof r.getCanExpand==="function"&&r.getCanExpand())}function rowFrom(from,by){for(let i=from+by;i>=0&&i<rows.length;i+=by){const r=rows[i];if(notRead(r)||isRecord(r))return i}return-1}function rowBeside(by){const seen=at;return rowFrom(index>=0?index:by>0?seen-1:seen,by)}let located=$state(0);const walkPlace=$derived(walk&&!isDraft?(void located,walk.place(current)):null);let lastPlace=-1;const walkAt=$derived.by(()=>{if(walkPlace!=null)lastPlace=walkPlace;return lastPlace});const walkFrom=by=>walkPlace!=null?walkAt:by>0?walkAt-1:walkAt;const canPrev=$derived(walk?walkAt>=0&&walk.has(walkFrom(-1),-1):rowBeside(-1)>=0);const canNext=$derived(walk?walkAt>=0&&walk.has(walkFrom(1),1):rowBeside(1)>=0);const records=$derived(!model&&grouped?dataRows(ctrl):null);const total=$derived(walk?walk.total():model?.getState?model.recordCount?.()??model.getState().rowCount??rows.length:(records??rows).length);const locale=$derived(ctrl.props?.localization?.locale);const place=$derived.by(()=>{if(isDraft)return null;if(walk)return walkPlace;if(index<0)return null;if(model)return grouped||model.isPinned?.(current)?null:index-Math.max(0,rows.length-total);return records?records.findIndex(r=>r.id===current):index});const positionText=$derived.by(()=>{if(isDraft)return bm("record.newRecord");if(!walk&&index<0)return bmCount("record.notInView",total,{count:total.toLocaleString(locale)});if(place==null)return bmCount("viewbar.records",total);return bm("record.position",{index:(place+1).toLocaleString(locale),total:total.toLocaleString(locale)})});const filteredOut=$derived.by(()=>{if(!row)return false;const keep=leafFilter(ctrl);return!!keep&&!keep(row)});const columns=$derived((ctrl.allColumns??[]).filter(c=>!c.id.startsWith("__")&&(c.columnDef.field!=null||c.columnDef.fieldFn!=null)));const hidden=$derived.by(()=>{const shownIds=new Set(columns.map(c=>c.id));return fieldColumns(ctrl).filter(c=>!shownIds.has(c.id)).map(c=>({id:c.id,columnDef:c.def}))});function valueOf(c){if(!row)return void 0;const base=c.columnDef.fieldFn?c.columnDef.fieldFn(row.original):row.original?.[c.columnDef.field];return ctrl.getCellDisplayValue(row.id,c.id,columns.includes(c)?row.getCellValueByColumnId(c.id):base)}const asField=c=>({id:c.id,field:String(c.columnDef.field??c.id),header:label(c),fieldType:c.columnDef.fieldType,def:c.columnDef,visible:true});const primaryId=$derived(primaryIdOf(ctrl));const primary=$derived(columns.find(c=>c.id===primaryId)??columns.find(c=>c.columnDef.fieldType==="text"||!c.columnDef.fieldType&&c.columnDef.editorType==null)??columns[0]);const title=$derived(row&&primary?cellText(asField(primary),valueOf(primary),row)||bm("record.untitled"):bm("record.record"));function label(c){return typeof c.columnDef.header==="string"?c.columnDef.header:c.id}const protectionOf=c=>c.columnDef.fieldType?protectionText(originalColumn(c.columnDef),fieldPropsOf(originalColumn(c.columnDef)),ruleFieldNames(c.columnDef)):null;const iconOf=c=>c.columnDef.fieldType?getFieldType(c.columnDef.fieldType)?.icon:void 0;function editable(c){if(!row||!ctrl.editingEnabled)return false;const ci=ctrl.allColumns.findIndex(x=>x.id===c.id);if(ci<0)return false;return ctrl.isCellEditableAt?!!ctrl.isCellEditableAt(index,ci):c.columnDef.editable!==false}const editorOpen=$derived(editing!=null);$effect(()=>{if(editorOpen)return untrack(holdForRecordEditor)});onMount(()=>{if(editPrimary&&primary&&editable(primary))editing=primary.id});let settled=$state(false);const settling=setTimeout(()=>settled=true,400);onDestroy(()=>{clearTimeout(settling);walk?.stop?.()});let locating=null;$effect(()=>{const w=walk;const r=row;if(!w?.locate||!r||isDraft||walkPlace!=null||locating===r.id)return;locating=r.id;untrack(()=>void w.locate(r.id,r.original).finally(()=>located+=1))});let commentBox=$state(null);const commentFocusFor=r=>r?.focus==="comment"&&r.ctrl===ctrl;const initialFocus=()=>focus==="comment"||commentFocusFor(getRecordRequest())?commentBox:null;$effect(()=>{const r=getRecordRequest();if(!commentFocusFor(r))return;untrack(()=>{if(r.rowId!==current)current=r.rowId;queueMicrotask(()=>commentBox?.focus())})});let listening=$state(null);const speakable=c=>dictationSupported()&&(c.columnDef.fieldType==="text"||c.columnDef.fieldType==="longText");async function speakInto(c){if(listening)return;listening=c.id;try{const said=await dictate();if(said)commit(c,withSaid(row?.getCellValueByColumnId?.(c.id),said,c.columnDef.fieldType==="longText"))}finally{listening=null}}async function speakComment(){if(listening)return;listening=":comment";try{const said=await dictate();if(said)comment=withSaid(comment,said,false)}finally{listening=null}}function sameValue(a,b){const none=x=>x==null||x===""||Array.isArray(x)&&!x.length;if(none(a)&&none(b))return true;return typeof a==="object"||typeof b==="object"?JSON.stringify(a)===JSON.stringify(b):String(a)===String(b)}function commit(c,v){editing=null;if(!row||v===void 0)return;const none=x=>x==null||x===""||Array.isArray(x)&&!x.length;if(none(v)&&none(row.getCellValueByColumnId?.(c.id)))return;const at2=rowIndexOf(ctrl.allRows,current);if(at2<0||!ctrl.startEditing(at2,c.id))return;ctrl.updateEditingCellValue(v);ctrl.saveEditingCell()}let fieldsBox=$state(null);const focusField=id=>[...fieldsBox?.querySelectorAll("[data-frv-field]")??[]].find(el=>el.dataset.frvField===id)?.querySelector(".sv-frv-open")?.focus();function stopEditing(c){editing=null;setTimeout(()=>{const now=document.activeElement;if(editing==null&&(!now||now===document.body||now.getAttribute("role")==="dialog"))focusField(c.id)},0)}const typedInto=c=>["text","number","textarea","fieldNumber","fieldTime",void 0].includes(c.columnDef.editorType);function escapeBox(e){if(e.key!=="Escape"||e.isComposing)return;if((unsaved||deletingNote!=null)&&editing==null)return escapeComment(e);const c=editing!=null?columns.find(x=>x.id===editing):void 0;if(!c||!(typedInto(c)||c.columnDef.editorType==="fieldRating"))return;e.stopPropagation();stopEditing(c)}function editBeside(c,dir){const at2=columns.findIndex(x=>x.id===c.id);for(let i=at2+dir;i>=0&&i<columns.length;i+=dir){const next=columns[i];if(!editable(next)||next.columnDef.editorType==="checkbox")continue;if(typedInto(next))editing=next.id;else{editing=null;void tick().then(()=>focusField(next.id))}return}}let awaited=$state(null);let awaitedRow=$state(null);let stepping=false;let pressed=0;function arrived(){stepping=false;if(!pressed)return;const by=pressed>0?1:-1;pressed-=by;queueMicrotask(()=>void go(by))}$effect(()=>{const id=awaited;if(id!=null&&rowIndexOf(rows,id)>=0)untrack(()=>{current=id;awaited=null;arrived()})});$effect(()=>{const at2=awaitedRow;const r=at2==null?void 0:rows[at2];if(r&&!notRead(r))untrack(()=>{awaitedRow=null;lastAt=at2;if(isRecord(r))current=r.id;arrived()})});let swipeAt=null;function swipeStart(e){const t=e.touches[0];const from=e.target;const busy=!!from?.closest?.('input, textarea, select, [contenteditable="true"], .sv-frv-files, [data-no-swipe]');swipeAt=e.touches.length===1&&t&&!busy?{x:t.clientX,y:t.clientY,t:Date.now()}:null}function swipeEnd(e){const s0=swipeAt;swipeAt=null;const t=e.changedTouches[0];if(!s0||!t||editing!=null)return;const dx=t.clientX-s0.x;const dy=t.clientY-s0.y;if(Math.abs(dx)<70||Math.abs(dx)<Math.abs(dy)*1.8||Date.now()-s0.t>700)return;if(dx<0&&canNext)void go(1);else if(dx>0&&canPrev)void go(-1)}function keepInSight(e){const el=e.target;if(!el?.matches?.('input, textarea, [contenteditable="true"]')||typeof window==="undefined"||window.innerWidth>600)return;setTimeout(()=>el.scrollIntoView?.({block:"center",behavior:"smooth"}),320)}async function go(by){if(stepping){pressed+=by;return}if(editingNote!=null){stepHeld=true;announce(bm("record.commentHoldsStep"));editBox?.focus();return}editing=null;if(walk){stepping=true;const id=await walk.step(walkFrom(by),by);if(id==null){stepping=false;pressed=0;return}awaited=id;setTimeout(()=>{if(awaited!==id)return;awaited=null;stepping=false;pressed=0},3e3);return}const to=rowBeside(by);if(to<0)return;const next=rows[to];if(!notRead(next)){lastAt=to;current=next.id;return}stepping=true;awaitedRow=to;ctrl.buildApi?.().scrollToRow?.(to)}const allCols=$derived([...columns,...hidden]);const restorable=c=>!!c&&c.columnDef.editorType!=="attachment"&&c.columnDef.editorType!=="fieldLink";const feed=$derived.by(()=>{if(!row)return[];const edits=historyOf(ctrl,row.id).map((ch,i)=>{if(ch.added)return{key:`a${ch.at}-${i}`,at:ch.at,by:ch.by,remote:true,kind:"added",field:"",text:""};const c=allCols.find(x=>x.id===ch.columnId);const show=v=>c?cellText(asField(c),v,row):String(v??"");return{key:`e${ch.at}${ch.columnId}-${i}`,at:ch.at,by:ch.by,automation:ch.automation,via:ch.via,through:ch.through,remote:ch.remote,undone:ch.undone,redone:ch.redone,kind:"edit",field:c?label(c):ch.columnId,text:show(ch.value),..."from"in ch&&show(ch.from)?{from:show(ch.from)}:{},..."from"in ch&&restorable(c)?{restore:{col:c,value:ch.from??null}}:{}}});const notes=commentsOf(ctrl,row.id).map(n=>({key:n.id,at:n.at,by:n.by,kind:"comment",field:"",text:n.text,parts:parseMentions(n.text),note:n}));return[...edits,...notes].sort((a,b)=>a.at-b.at)});const person=item=>item.by?findFieldUser(item.by)?.name??bm("record.someone"):item.remote?bm("record.someoneElse"):bm("record.you");const who=item=>item.automation?bm("record.byAutomation",{name:item.automation}):item.via?bm("record.acceptedBy",{source:item.via,person:person(item)}):item.through?bm("record.through",{person:person(item),source:item.through}):person(item);const shownId=$derived(row?.id);$effect(()=>{const id=shownId;if(id!=null)untrack(()=>loadHistory(ctrl,id))});const history=$derived(row?historyState(ctrl,row.id):{loading:false});$effect(()=>{const id=row?.id;if(id!=null&&unseenOf(ctrl,id))untrack(()=>markSeen(ctrl,id))});const proposals=$derived(row?recordProposalsFor(ctrl.props?.getRowId,row.original,row.id):null);const proposalOf=c=>proposals?.list.find(p=>p.field===String(c.columnDef.field??c.id));const proposedText=(c,p)=>cellText(asField(c),p.after,row)||proposals?.messages.empty||"";let deciding=$state(false);async function decide(ids,how){if(!proposals||deciding||!ids.length)return;deciding=true;try{await(how==="accept"?proposals.accept(ids):proposals.reject(ids))}finally{deciding=false}}const readOnly=$derived(isReadOnlyGrid(ctrl));const canComment=$derived(canCommentIn(ctrl));const takesFiles=$derived(commentStoreTakes("files"));const takesInternal=$derived(commentStoreTakes("internal"));let commentFiles=$state([]);let uploading=$state(0);let internalNote=$state(false);let fileInput=$state(null);const canSend=$derived((!!comment.trim()||commentFiles.length>0)&&uploading===0);async function attach(list){if(!list||!row)return;const forRow=row.id;for(const file of Array.from(list)){uploading+=1;try{const done=await uploadAttachment(file,{},{row:row?.original,columnId:"",signal:new AbortController().signal,onProgress:()=>{}});if(row?.id===forRow)commentFiles=[...commentFiles,done]}catch(e){toast.error(bm("record.commentUploadFailed",{name:file.name,error:e instanceof Error?e.message:String(e)}))}finally{uploading-=1}}if(fileInput)fileInput.value=""}const snippets=$derived(commentSnippets());let repliesOpen=$state(false);let replies=$state(null);let repliesError=$state("");let replyQuery=$state("");let replyName=$state("");let naming=$state(false);const shownReplies=$derived((replies??[]).filter(r=>!replyQuery.trim()||(r.title+" "+r.text).toLowerCase().includes(replyQuery.trim().toLowerCase())));const recordRef=()=>({rowId:String(row?.original?.id??row?.id??""),row:row?.original??{}});async function openReplies(){if(repliesOpen){repliesOpen=false;return}const list=snippets;if(!list||!row)return;repliesOpen=true;replies=null;repliesError="";replyQuery="";naming=false;const forRow=row.id;try{const got=await list.list(ctrl?.props?.baseTableId,recordRef());if(row?.id===forRow)replies=Array.isArray(got)?got:[]}catch(e){repliesError=e instanceof Error?e.message:String(e);replies=[]}}function pickReply(reply){comment=comment.trim()?comment.replace(/\s+$/,"")+"\n\n"+reply.text:reply.text;if(reply.files?.length)commentFiles=[...commentFiles,...reply.files.filter(f=>!commentFiles.some(x=>x.id===f.id))];repliesOpen=false;void tick().then(()=>commentBox?.focus())}async function saveReply(){const keep=snippets?.save;const title2=replyName.trim();if(!keep||!title2||!comment.trim())return;try{await keep(ctrl?.props?.baseTableId,{title:title2,text:comment});toast.success(bm("record.replySaved"));naming=false;replyName="";replies=null;repliesOpen=false}catch(e){toast.error(bm("record.replyNotSaved",{error:e instanceof Error?e.message:String(e)}))}}$effect(()=>{void current;repliesOpen=false});function send(){if(!row||!canSend||!canComment||isDraft)return;addComment(ctrl,row.id,encodeMentions(comment,picked),{files:commentFiles,internal:internalNote});comment="";picked=[];commentFiles=[];internalNote=false;announce(bm("record.commentAddedSay"))}const fileSize=n=>n==null?"":n<1024?`${n} B`:n<1048576?`${Math.round(n/1024)} KB`:`${(n/1048576).toFixed(1)} MB`;let editingNote=$state(null);let editText=$state("");let editPicked=$state([]);let deletingNote=$state(null);let editBox=$state(null);let sendButton=$state(null);const unsaved=$derived(!!row&&(!!comment.trim()||editingNote!=null));$effect(()=>{const id=current;const drafts=commentDraftsOf(ctrl);const kept=drafts.get(id);comment=kept?.text??"";picked=kept?.picked??[];editingNote=null;deletingNote=null});$effect(()=>{const drafts=commentDraftsOf(ctrl);if(comment.trim())drafts.set(current,{text:comment,picked});else drafts.delete(current)});function closing(){if(comment.trim())toast.info(bm("record.commentKept"));onClose()}let narrow=$state(typeof window!=="undefined"&&window.innerWidth<DOCK_NARROW);$effect(()=>{const look=()=>narrow=window.innerWidth<DOCK_NARROW;window.addEventListener("resize",look);return()=>window.removeEventListener("resize",look)});const mode=$derived(narrow?"center":recordDock());const DOCKS=[{id:"center",key:"record.dockCenter",icon:"M3 4.5h14v11H3zM6.5 7.5h7v5h-7z"},{id:"right",key:"record.dockRight",icon:"M3 4.5h14v11H3zM11.5 4.5v11"},{id:"full",key:"record.dockFull",icon:"M3 4.5h14v11H3zM3 7.5h14"}];function dockAt(next){if(next===mode)return;editing=null;setRecordDock(next);announce(bm(DOCKS.find(d=>d.id===next).key))}let anchor=$state(null);let side=$state(null);let sideTop=$state(0);const sideTitleId=`sv-frv-side-${Math.random().toString(36).slice(2,9)}`;$effect(()=>{if(mode!=="right"||!anchor)return;const width=recordDockWidth();const host=anchor.closest(".sv-fbase-tables")??anchor.closest(".sv-grid-root");const before=host?.style.marginInlineEnd??"";if(host)host.style.marginInlineEnd=`${width}px`;const place2=()=>{const top=host?host.getBoundingClientRect().top:0;sideTop=Math.round(Math.min(Math.max(0,top),window.innerHeight*.3))};place2();const watch=typeof ResizeObserver==="function"&&host?new ResizeObserver(place2):null;if(host)watch?.observe(host);window.addEventListener("resize",place2);window.addEventListener("scroll",place2,{passive:true,capture:true});return()=>{if(host)host.style.marginInlineEnd=before;watch?.disconnect();window.removeEventListener("resize",place2);window.removeEventListener("scroll",place2,{capture:true})}});$effect(()=>{if(mode!=="right"||!side)return;const panel=side;void tick().then(()=>{if(panel.contains(document.activeElement))return;const to=initialFocus()??panel.querySelector('.sv-frv-side-body button:not(:disabled), .sv-frv-side-body input, .sv-frv-side-body textarea, .sv-frv-side-body [tabindex="0"]');(to??panel).focus({preventScroll:true})})});function sideKey(e){if(e.key!=="Escape"||e.defaultPrevented||e.isComposing)return;if(unsaved||deletingNote!=null)return;e.stopPropagation();closeSide()}function closeSide(){open=false;closing()}const activeId=$derived(mode==="right"?(ctrl.allRows??[])[ctrl.activeCell?.rowIndex??-1]?.id??void 0:void 0);let seenActive=null;$effect(()=>{const id=activeId;const docked=mode==="right";untrack(()=>{if(!docked||seenActive===null){seenActive=docked?id:null;return}if(id===seenActive)return;seenActive=id;if(!id||id===current||editingNote!=null)return;if(!dataRows(ctrl).some(r=>r.id===id))return;editing=null;current=id})});let dragFrom=null;function edgeDown(e){dragFrom={x:e.clientX,w:recordDockWidth()};e.currentTarget.setPointerCapture(e.pointerId)}function edgeMove(e){if(!dragFrom)return;setRecordDockWidth(Math.min(DOCK_MAX,Math.max(DOCK_MIN,dragFrom.w+(dragFrom.x-e.clientX))))}function edgeUp(e){if(!dragFrom)return;dragFrom=null;e.currentTarget.releasePointerCapture(e.pointerId)}function edgeKey(e){const by=e.key==="ArrowLeft"?24:e.key==="ArrowRight"?-24:0;if(!by)return;e.preventDefault();setRecordDockWidth(recordDockWidth()+by)}let escapeHeld=$state(false);let stepHeld=$state(false);$effect(()=>{void comment;void editText;escapeHeld=false;stepHeld=false});$effect(()=>{if(!unsaved)return;const onDown=e=>{if(!e.target?.classList?.contains("sv-modal__backdrop"))return;escapeHeld=true;announce(bm(editingNote!=null?"record.commentNotSaved":"record.commentNotSent"))};window.addEventListener("pointerdown",onDown,true);return()=>window.removeEventListener("pointerdown",onDown,true)});function escapeComment(e){const at2=e.target;if(!fieldsBox?.closest('[role="dialog"]')?.contains(at2))return;if(at2.getAttribute("aria-controls"))return;e.stopPropagation();if(deletingNote!=null)return keepNote();if(editingNote!=null&&at2.closest("form")?.contains(editBox))return cancelEdit();if(at2===commentBox)sendButton?.focus();escapeHeld=true;announce(bm(editingNote!=null?"record.commentNotSaved":"record.commentNotSent"))}let feedBox=$state(null);const focusNote=id=>void tick().then(()=>[...feedBox?.querySelectorAll("[data-note]")??[]].find(n=>n.dataset.note===id)?.querySelector("button")?.focus());function keepNote(){const id=deletingNote;deletingNote=null;if(id)focusNote(id)}const takeFocus=node=>node.focus();function startEdit(n){deletingNote=null;editingNote=n.id;editText=mentionText(n.text,id=>findFieldUser(id)?.name);editPicked=parseMentions(n.text).flatMap(p=>"mention"in p?[mentioned(p.mention,p.name)]:[]);void tick().then(()=>{editBox?.focus();editBox?.setSelectionRange(editText.length,editText.length)})}function saveEdit(){const id=editingNote;if(row&&id&&editText.trim()){editComment(ctrl,row.id,id,encodeMentions(editText,editPicked));announce(bm("record.commentSavedSay"))}editingNote=null;if(id)focusNote(id)}function cancelEdit(){const id=editingNote;editingNote=null;if(id)focusNote(id)}const mentioned=(id,name)=>findFieldUser(id)??{id,name:name||bm("record.someone")};function voteTitle(dir,ids){if(!ids.length)return bm(dir==="up"?"record.voteUp":"record.voteDown");const names=ids.map(id=>findFieldUser(id)?.name??bm("record.someone"));const list=names.join(", ");return bm(dir==="up"?"record.votedUpBy":"record.votedDownBy",{names:list})}
|
|
2
|
+
import{recordActionsFor}from"./record-actions";import{commentSnippets}from"./comment-snippets.svelte";import{onDestroy,onMount,tick,untrack}from"svelte";import{commentDraftsOf,getRecordRequest,holdForRecordEditor}from"./editor-request.svelte";import{SvModal,announce,portalToBody,toast}from"@svgrid/grid";import{DOCK_MAX,DOCK_MIN,DOCK_NARROW,recordDock,recordDockWidth,setRecordDock,setRecordDockWidth}from"./record-dock.svelte";import FieldInput from"./FieldInput.svelte";import{fieldPropsOf,getFieldType,originalColumn,ruleFieldNames}from"./registry.svelte";import{protectionText}from"./field-access.svelte";import{isReadOnlyGrid}from"./base-share";import{canCommentIn,canDeleteRecord}from"./base-permissions";import{askDeleteRecord}from"./record-delete.svelte";import{cellText,dataRows,fieldColumns,leafFilter,primaryIdOf}from"./grid-access";import{recordWalkOf}from"./record-walk";import{addComment,commentStoreTakes,commentThreads,commentVotes,commentsOf,commentsResolve,commentsTakeReplies,commentsTakeVotes,deleteComment,editComment,historyOf,historyState,loadHistory,markSeen,mayVoteComment,myCommentVote,ownsComment,resolveComment,timeAgo,unseenOf,voteComment}from"./activity.svelte";import{uploadAttachment}from"./attachments";import{findFieldUser}from"./sources.svelte";import{encodeMentions,mentionText,parseMentions}from"./mentions";import MentionInput from"./MentionInput.svelte";import{dictationSupported,dictate,withSaid}from"./dictation.svelte";import UserFace from"./UserFace.svelte";import{recordProposalsFor}from"../review/card-marks.svelte";import{bm,bmCount}from"./messages.svelte";let{ctrl,rowId,editPrimary=false,focus,onClose}=$props();let current=$state(rowId);let open=$state(true);let editing=$state(null);let showHidden=$state(false);let comment=$state("");let picked=$state([]);const rows=$derived(ctrl.allRows??[]);let lastAt=-1;function rowIndexOf(list,id){if(id==null)return-1;for(const near of[lastAt,untrack(()=>ctrl.activeCell?.rowIndex??-1)]){if(near<0)continue;for(let d=0;d<=200;d++){if(list[near+d]?.id===id)return lastAt=near+d;if(d&&near-d>=0&&list[near-d]?.id===id)return lastAt=near-d}}return lastAt=list.findIndex(r=>r.id===id)}const index=$derived(rowIndexOf(rows,current));const row=$derived(index>=0?rows[index]:null);const isDraft=$derived(!!ctrl.props?.baseIsDraft?.(current));let lastIndex=0;const at=$derived.by(()=>{if(index>=0)lastIndex=index;return lastIndex});const walk=$derived(recordWalkOf(ctrl));const model=$derived(ctrl.props?.rowModel);const grouped=$derived((ctrl.groupingColumns??[]).length>0);const notRead=r=>String(r.id).startsWith("sv-ph:");function isRecord(r){const kind=r.original?.__group?.kind;return kind?kind==="leaf":r.__treeRow||!(typeof r.getCanExpand==="function"&&r.getCanExpand())}function rowFrom(from,by){for(let i=from+by;i>=0&&i<rows.length;i+=by){const r=rows[i];if(notRead(r)||isRecord(r))return i}return-1}function rowBeside(by){const seen=at;return rowFrom(index>=0?index:by>0?seen-1:seen,by)}let located=$state(0);const walkPlace=$derived(walk&&!isDraft?(void located,walk.place(current)):null);let lastPlace=-1;const walkAt=$derived.by(()=>{if(walkPlace!=null)lastPlace=walkPlace;return lastPlace});const walkFrom=by=>walkPlace!=null?walkAt:by>0?walkAt-1:walkAt;const canPrev=$derived(walk?walkAt>=0&&walk.has(walkFrom(-1),-1):rowBeside(-1)>=0);const canNext=$derived(walk?walkAt>=0&&walk.has(walkFrom(1),1):rowBeside(1)>=0);const records=$derived(!model&&grouped?dataRows(ctrl):null);const total=$derived(walk?walk.total():model?.getState?model.recordCount?.()??model.getState().rowCount??rows.length:(records??rows).length);const locale=$derived(ctrl.props?.localization?.locale);const place=$derived.by(()=>{if(isDraft)return null;if(walk)return walkPlace;if(index<0)return null;if(model)return grouped||model.isPinned?.(current)?null:index-Math.max(0,rows.length-total);return records?records.findIndex(r=>r.id===current):index});const positionText=$derived.by(()=>{if(isDraft)return bm("record.newRecord");if(!walk&&index<0)return bmCount("record.notInView",total,{count:total.toLocaleString(locale)});if(place==null)return bmCount("viewbar.records",total);return bm("record.position",{index:(place+1).toLocaleString(locale),total:total.toLocaleString(locale)})});const filteredOut=$derived.by(()=>{if(!row)return false;const keep=leafFilter(ctrl);return!!keep&&!keep(row)});const columns=$derived((ctrl.allColumns??[]).filter(c=>!c.id.startsWith("__")&&(c.columnDef.field!=null||c.columnDef.fieldFn!=null)));const hidden=$derived.by(()=>{const shownIds=new Set(columns.map(c=>c.id));return fieldColumns(ctrl).filter(c=>!shownIds.has(c.id)).map(c=>({id:c.id,columnDef:c.def}))});function valueOf(c){if(!row)return void 0;const base=c.columnDef.fieldFn?c.columnDef.fieldFn(row.original):row.original?.[c.columnDef.field];return ctrl.getCellDisplayValue(row.id,c.id,columns.includes(c)?row.getCellValueByColumnId(c.id):base)}const asField=c=>({id:c.id,field:String(c.columnDef.field??c.id),header:label(c),fieldType:c.columnDef.fieldType,def:c.columnDef,visible:true});const primaryId=$derived(primaryIdOf(ctrl));const primary=$derived(columns.find(c=>c.id===primaryId)??columns.find(c=>c.columnDef.fieldType==="text"||!c.columnDef.fieldType&&c.columnDef.editorType==null)??columns[0]);const title=$derived(row&&primary?cellText(asField(primary),valueOf(primary),row)||bm("record.untitled"):bm("record.record"));function label(c){return typeof c.columnDef.header==="string"?c.columnDef.header:c.id}const protectionOf=c=>c.columnDef.fieldType?protectionText(originalColumn(c.columnDef),fieldPropsOf(originalColumn(c.columnDef)),ruleFieldNames(c.columnDef)):null;const iconOf=c=>c.columnDef.fieldType?getFieldType(c.columnDef.fieldType)?.icon:void 0;function editable(c){if(!row||!ctrl.editingEnabled)return false;const ci=ctrl.allColumns.findIndex(x=>x.id===c.id);if(ci<0)return false;return ctrl.isCellEditableAt?!!ctrl.isCellEditableAt(index,ci):c.columnDef.editable!==false}const editorOpen=$derived(editing!=null);$effect(()=>{if(editorOpen)return untrack(holdForRecordEditor)});onMount(()=>{if(editPrimary&&primary&&editable(primary))editing=primary.id});let settled=$state(false);const settling=setTimeout(()=>settled=true,400);onDestroy(()=>{clearTimeout(settling);walk?.stop?.()});let locating=null;$effect(()=>{const w=walk;const r=row;if(!w?.locate||!r||isDraft||walkPlace!=null||locating===r.id)return;locating=r.id;untrack(()=>void w.locate(r.id,r.original).finally(()=>located+=1))});let commentBox=$state(null);const commentFocusFor=r=>r?.focus==="comment"&&r.ctrl===ctrl;const initialFocus=()=>focus==="comment"||commentFocusFor(getRecordRequest())?commentBox:null;$effect(()=>{const r=getRecordRequest();if(!commentFocusFor(r))return;untrack(()=>{if(r.rowId!==current)current=r.rowId;queueMicrotask(()=>commentBox?.focus())})});let listening=$state(null);const speakable=c=>dictationSupported()&&(c.columnDef.fieldType==="text"||c.columnDef.fieldType==="longText");async function speakInto(c){if(listening)return;listening=c.id;try{const said=await dictate();if(said)commit(c,withSaid(row?.getCellValueByColumnId?.(c.id),said,c.columnDef.fieldType==="longText"))}finally{listening=null}}async function speakComment(){if(listening)return;listening=":comment";try{const said=await dictate();if(said)comment=withSaid(comment,said,false)}finally{listening=null}}function sameValue(a,b){const none=x=>x==null||x===""||Array.isArray(x)&&!x.length;if(none(a)&&none(b))return true;return typeof a==="object"||typeof b==="object"?JSON.stringify(a)===JSON.stringify(b):String(a)===String(b)}function commit(c,v){editing=null;if(!row||v===void 0)return;const none=x=>x==null||x===""||Array.isArray(x)&&!x.length;if(none(v)&&none(row.getCellValueByColumnId?.(c.id)))return;const at2=rowIndexOf(ctrl.allRows,current);if(at2<0||!ctrl.startEditing(at2,c.id))return;ctrl.updateEditingCellValue(v);ctrl.saveEditingCell()}let fieldsBox=$state(null);const focusField=id=>[...fieldsBox?.querySelectorAll("[data-frv-field]")??[]].find(el=>el.dataset.frvField===id)?.querySelector(".sv-frv-open")?.focus();function stopEditing(c){editing=null;setTimeout(()=>{const now=document.activeElement;if(editing==null&&(!now||now===document.body||now.getAttribute("role")==="dialog"))focusField(c.id)},0)}const typedInto=c=>["text","number","textarea","fieldNumber","fieldTime",void 0].includes(c.columnDef.editorType);function escapeBox(e){if(e.key!=="Escape"||e.isComposing)return;if((unsaved||deletingNote!=null)&&editing==null)return escapeComment(e);const c=editing!=null?columns.find(x=>x.id===editing):void 0;if(!c||!(typedInto(c)||c.columnDef.editorType==="fieldRating"))return;e.stopPropagation();stopEditing(c)}function editBeside(c,dir){const at2=columns.findIndex(x=>x.id===c.id);for(let i=at2+dir;i>=0&&i<columns.length;i+=dir){const next=columns[i];if(!editable(next)||next.columnDef.editorType==="checkbox")continue;if(typedInto(next))editing=next.id;else{editing=null;void tick().then(()=>focusField(next.id))}return}}let awaited=$state(null);let awaitedRow=$state(null);let stepping=false;let pressed=0;function arrived(){stepping=false;if(!pressed)return;const by=pressed>0?1:-1;pressed-=by;queueMicrotask(()=>void go(by))}$effect(()=>{const id=awaited;if(id!=null&&rowIndexOf(rows,id)>=0)untrack(()=>{current=id;awaited=null;arrived()})});$effect(()=>{const at2=awaitedRow;const r=at2==null?void 0:rows[at2];if(r&&!notRead(r))untrack(()=>{awaitedRow=null;lastAt=at2;if(isRecord(r))current=r.id;arrived()})});let swipeAt=null;function swipeStart(e){const t=e.touches[0];const from=e.target;const busy=!!from?.closest?.('input, textarea, select, [contenteditable="true"], .sv-frv-files, [data-no-swipe]');swipeAt=e.touches.length===1&&t&&!busy?{x:t.clientX,y:t.clientY,t:Date.now()}:null}function swipeEnd(e){const s0=swipeAt;swipeAt=null;const t=e.changedTouches[0];if(!s0||!t||editing!=null)return;const dx=t.clientX-s0.x;const dy=t.clientY-s0.y;if(Math.abs(dx)<70||Math.abs(dx)<Math.abs(dy)*1.8||Date.now()-s0.t>700)return;if(dx<0&&canNext)void go(1);else if(dx>0&&canPrev)void go(-1)}function keepInSight(e){const el=e.target;if(!el?.matches?.('input, textarea, [contenteditable="true"]')||typeof window==="undefined"||window.innerWidth>600)return;setTimeout(()=>el.scrollIntoView?.({block:"center",behavior:"smooth"}),320)}async function go(by){if(stepping){pressed+=by;return}if(editingNote!=null){stepHeld=true;announce(bm("record.commentHoldsStep"));editBox?.focus();return}editing=null;if(walk){stepping=true;const id=await walk.step(walkFrom(by),by);if(id==null){stepping=false;pressed=0;return}awaited=id;setTimeout(()=>{if(awaited!==id)return;awaited=null;stepping=false;pressed=0},3e3);return}const to=rowBeside(by);if(to<0)return;const next=rows[to];if(!notRead(next)){lastAt=to;current=next.id;return}stepping=true;awaitedRow=to;ctrl.buildApi?.().scrollToRow?.(to)}const allCols=$derived([...columns,...hidden]);const restorable=c=>!!c&&c.columnDef.editorType!=="attachment"&&c.columnDef.editorType!=="fieldLink";const feed=$derived.by(()=>{if(!row)return[];const edits=historyOf(ctrl,row.id).map((ch,i)=>{if(ch.added)return{key:`a${ch.at}-${i}`,at:ch.at,by:ch.by,remote:true,kind:"added",field:"",text:""};const c=allCols.find(x=>x.id===ch.columnId);const show=v=>c?cellText(asField(c),v,row):String(v??"");return{key:`e${ch.at}${ch.columnId}-${i}`,at:ch.at,by:ch.by,automation:ch.automation,via:ch.via,through:ch.through,remote:ch.remote,undone:ch.undone,redone:ch.redone,kind:"edit",field:c?label(c):ch.columnId,text:show(ch.value),..."from"in ch&&show(ch.from)?{from:show(ch.from)}:{},..."from"in ch&&restorable(c)?{restore:{col:c,value:ch.from??null}}:{}}});const notes=commentThreads(commentsOf(ctrl,row.id)).top.map(noteItem);return[...edits,...notes].sort((a,b)=>a.at-b.at)});const noteItem=n=>({key:n.id,at:n.at,by:n.by,kind:"comment",field:"",text:n.text,parts:parseMentions(n.text),note:n});const threads=$derived(row?commentThreads(commentsOf(ctrl,row.id)).replies:new Map);let answering=$state(null);let openThreads=$state(new Set);const nameOf=id=>id?findFieldUser(id)?.name??bm("record.someone"):bm("record.someone");function replyTo(note){answering=note;void tick().then(()=>commentBox?.focus())}const preview=item=>{const text=(item.parts??[]).map(p=>"mention"in p?"@"+mentioned(p.mention,p.name).name:p.text).join("").replace(/\s+/g," ").trim();return text.length>90?text.slice(0,89)+"…":text};function toggleThread(id){const next=new Set(openThreads);if(next.has(id))next.delete(id);else next.add(id);openThreads=next}function resolveThread(note,on){if(!row)return;resolveComment(ctrl,row.id,note.id,on);if(on)openThreads=new Set([...openThreads].filter(x=>x!==note.id));if(on&&answering?.id===note.id)answering=null;announce(bm(on?"record.threadResolvedSay":"record.threadReopenedSay"))}const person=item=>item.by?findFieldUser(item.by)?.name??bm("record.someone"):item.remote?bm("record.someoneElse"):bm("record.you");const who=item=>item.automation?bm("record.byAutomation",{name:item.automation}):item.via?bm("record.acceptedBy",{source:item.via,person:person(item)}):item.through?bm("record.through",{person:person(item),source:item.through}):person(item);const shownId=$derived(row?.id);$effect(()=>{const id=shownId;if(id!=null)untrack(()=>loadHistory(ctrl,id))});const history=$derived(row?historyState(ctrl,row.id):{loading:false});$effect(()=>{const id=row?.id;if(id!=null&&unseenOf(ctrl,id))untrack(()=>markSeen(ctrl,id))});const proposals=$derived(row?recordProposalsFor(ctrl.props?.getRowId,row.original,row.id):null);const proposalOf=c=>proposals?.list.find(p=>p.field===String(c.columnDef.field??c.id));const proposedText=(c,p)=>cellText(asField(c),p.after,row)||proposals?.messages.empty||"";let deciding=$state(false);async function decide(ids,how){if(!proposals||deciding||!ids.length)return;deciding=true;try{await(how==="accept"?proposals.accept(ids):proposals.reject(ids))}finally{deciding=false}}const readOnly=$derived(isReadOnlyGrid(ctrl));const canComment=$derived(canCommentIn(ctrl));const takesFiles=$derived(commentStoreTakes("files"));const takesInternal=$derived(commentStoreTakes("internal"));let commentFiles=$state([]);let uploading=$state(0);let internalNote=$state(false);let fileInput=$state(null);const canSend=$derived((!!comment.trim()||commentFiles.length>0)&&uploading===0);async function attach(list){if(!list||!row)return;const forRow=row.id;for(const file of Array.from(list)){uploading+=1;try{const done=await uploadAttachment(file,{},{row:row?.original,columnId:"",signal:new AbortController().signal,onProgress:()=>{}});if(row?.id===forRow)commentFiles=[...commentFiles,done]}catch(e){toast.error(bm("record.commentUploadFailed",{name:file.name,error:e instanceof Error?e.message:String(e)}))}finally{uploading-=1}}if(fileInput)fileInput.value=""}const snippets=$derived(commentSnippets());let repliesOpen=$state(false);let replies=$state(null);let repliesError=$state("");let replyQuery=$state("");let replyName=$state("");let naming=$state(false);const shownReplies=$derived((replies??[]).filter(r=>!replyQuery.trim()||(r.title+" "+r.text).toLowerCase().includes(replyQuery.trim().toLowerCase())));const recordRef=()=>({rowId:String(row?.original?.id??row?.id??""),row:row?.original??{}});async function openReplies(){if(repliesOpen){repliesOpen=false;return}const list=snippets;if(!list||!row)return;repliesOpen=true;replies=null;repliesError="";replyQuery="";naming=false;const forRow=row.id;try{const got=await list.list(ctrl?.props?.baseTableId,recordRef());if(row?.id===forRow)replies=Array.isArray(got)?got:[]}catch(e){repliesError=e instanceof Error?e.message:String(e);replies=[]}}function pickReply(reply){comment=comment.trim()?comment.replace(/\s+$/,"")+"\n\n"+reply.text:reply.text;if(reply.files?.length)commentFiles=[...commentFiles,...reply.files.filter(f=>!commentFiles.some(x=>x.id===f.id))];repliesOpen=false;void tick().then(()=>commentBox?.focus())}async function saveReply(){const keep=snippets?.save;const title2=replyName.trim();if(!keep||!title2||!comment.trim())return;try{await keep(ctrl?.props?.baseTableId,{title:title2,text:comment});toast.success(bm("record.replySaved"));naming=false;replyName="";replies=null;repliesOpen=false}catch(e){toast.error(bm("record.replyNotSaved",{error:e instanceof Error?e.message:String(e)}))}}$effect(()=>{void current;repliesOpen=false});function send(){if(!row||!canSend||!canComment||isDraft)return;const answered=answering&&commentsOf(ctrl,row.id).some(c=>c.id===answering.id)?answering:null;addComment(ctrl,row.id,encodeMentions(comment,picked),{files:commentFiles,internal:internalNote,...answered?{replyTo:answered.id}:{}});comment="";picked=[];commentFiles=[];internalNote=false;answering=null;announce(bm(answered?"record.replyAddedSay":"record.commentAddedSay"))}const fileSize=n=>n==null?"":n<1024?`${n} B`:n<1048576?`${Math.round(n/1024)} KB`:`${(n/1048576).toFixed(1)} MB`;let editingNote=$state(null);let editText=$state("");let editPicked=$state([]);let deletingNote=$state(null);let editBox=$state(null);let sendButton=$state(null);const unsaved=$derived(!!row&&(!!comment.trim()||editingNote!=null));$effect(()=>{const id=current;const drafts=commentDraftsOf(ctrl);const kept=drafts.get(id);comment=kept?.text??"";picked=kept?.picked??[];editingNote=null;deletingNote=null;answering=null});$effect(()=>{const drafts=commentDraftsOf(ctrl);if(comment.trim())drafts.set(current,{text:comment,picked});else drafts.delete(current)});function closing(){if(comment.trim())toast.info(bm("record.commentKept"));onClose()}let narrow=$state(typeof window!=="undefined"&&window.innerWidth<DOCK_NARROW);$effect(()=>{const look=()=>narrow=window.innerWidth<DOCK_NARROW;window.addEventListener("resize",look);return()=>window.removeEventListener("resize",look)});const mode=$derived(narrow?"center":recordDock());const DOCKS=[{id:"center",key:"record.dockCenter",icon:"M3 4.5h14v11H3zM6.5 7.5h7v5h-7z"},{id:"right",key:"record.dockRight",icon:"M3 4.5h14v11H3zM11.5 4.5v11"},{id:"full",key:"record.dockFull",icon:"M3 4.5h14v11H3zM3 7.5h14"}];function dockAt(next){if(next===mode)return;editing=null;setRecordDock(next);announce(bm(DOCKS.find(d=>d.id===next).key))}let anchor=$state(null);let side=$state(null);let sideTop=$state(0);const sideTitleId=`sv-frv-side-${Math.random().toString(36).slice(2,9)}`;$effect(()=>{if(mode!=="right"||!anchor)return;const width=recordDockWidth();const host=anchor.closest(".sv-fbase-tables")??anchor.closest(".sv-grid-root");const before=host?.style.marginInlineEnd??"";if(host)host.style.marginInlineEnd=`${width}px`;const place2=()=>{const top=host?host.getBoundingClientRect().top:0;sideTop=Math.round(Math.min(Math.max(0,top),window.innerHeight*.3))};place2();const watch=typeof ResizeObserver==="function"&&host?new ResizeObserver(place2):null;if(host)watch?.observe(host);window.addEventListener("resize",place2);window.addEventListener("scroll",place2,{passive:true,capture:true});return()=>{if(host)host.style.marginInlineEnd=before;watch?.disconnect();window.removeEventListener("resize",place2);window.removeEventListener("scroll",place2,{capture:true})}});$effect(()=>{if(mode!=="right"||!side)return;const panel=side;void tick().then(()=>{if(panel.contains(document.activeElement))return;const to=initialFocus()??panel.querySelector('.sv-frv-side-body button:not(:disabled), .sv-frv-side-body input, .sv-frv-side-body textarea, .sv-frv-side-body [tabindex="0"]');(to??panel).focus({preventScroll:true})})});function sideKey(e){if(e.key!=="Escape"||e.defaultPrevented||e.isComposing)return;if(unsaved||deletingNote!=null)return;e.stopPropagation();closeSide()}function closeSide(){open=false;closing()}const activeId=$derived(mode==="right"?(ctrl.allRows??[])[ctrl.activeCell?.rowIndex??-1]?.id??void 0:void 0);let seenActive=null;$effect(()=>{const id=activeId;const docked=mode==="right";untrack(()=>{if(!docked||seenActive===null){seenActive=docked?id:null;return}if(id===seenActive)return;seenActive=id;if(!id||id===current||editingNote!=null)return;if(!dataRows(ctrl).some(r=>r.id===id))return;editing=null;current=id})});let dragFrom=null;function edgeDown(e){dragFrom={x:e.clientX,w:recordDockWidth()};e.currentTarget.setPointerCapture(e.pointerId)}function edgeMove(e){if(!dragFrom)return;setRecordDockWidth(Math.min(DOCK_MAX,Math.max(DOCK_MIN,dragFrom.w+(dragFrom.x-e.clientX))))}function edgeUp(e){if(!dragFrom)return;dragFrom=null;e.currentTarget.releasePointerCapture(e.pointerId)}function edgeKey(e){const by=e.key==="ArrowLeft"?24:e.key==="ArrowRight"?-24:0;if(!by)return;e.preventDefault();setRecordDockWidth(recordDockWidth()+by)}let escapeHeld=$state(false);let stepHeld=$state(false);$effect(()=>{void comment;void editText;escapeHeld=false;stepHeld=false});$effect(()=>{if(!unsaved)return;const onDown=e=>{if(!e.target?.classList?.contains("sv-modal__backdrop"))return;escapeHeld=true;announce(bm(editingNote!=null?"record.commentNotSaved":"record.commentNotSent"))};window.addEventListener("pointerdown",onDown,true);return()=>window.removeEventListener("pointerdown",onDown,true)});function escapeComment(e){const at2=e.target;if(!fieldsBox?.closest('[role="dialog"]')?.contains(at2))return;if(at2.getAttribute("aria-controls"))return;e.stopPropagation();if(deletingNote!=null)return keepNote();if(editingNote!=null&&at2.closest("form")?.contains(editBox))return cancelEdit();if(at2===commentBox)sendButton?.focus();escapeHeld=true;announce(bm(editingNote!=null?"record.commentNotSaved":"record.commentNotSent"))}let feedBox=$state(null);const focusNote=id=>void tick().then(()=>[...feedBox?.querySelectorAll("[data-note]")??[]].find(n=>n.dataset.note===id)?.querySelector("button")?.focus());function keepNote(){const id=deletingNote;deletingNote=null;if(id)focusNote(id)}const takeFocus=node=>node.focus();function startEdit(n){deletingNote=null;editingNote=n.id;editText=mentionText(n.text,id=>findFieldUser(id)?.name);editPicked=parseMentions(n.text).flatMap(p=>"mention"in p?[mentioned(p.mention,p.name)]:[]);void tick().then(()=>{editBox?.focus();editBox?.setSelectionRange(editText.length,editText.length)})}function saveEdit(){const id=editingNote;if(row&&id&&editText.trim()){editComment(ctrl,row.id,id,encodeMentions(editText,editPicked));announce(bm("record.commentSavedSay"))}editingNote=null;if(id)focusNote(id)}function cancelEdit(){const id=editingNote;editingNote=null;if(id)focusNote(id)}const mentioned=(id,name)=>findFieldUser(id)??{id,name:name||bm("record.someone")};function voteTitle(dir,ids){if(!ids.length)return bm(dir==="up"?"record.voteUp":"record.voteDown");const names=ids.map(id=>findFieldUser(id)?.name??bm("record.someone"));const list=names.join(", ");return bm(dir==="up"?"record.votedUpBy":"record.votedDownBy",{names:list})}
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
{#snippet field(c: Col, canEdit: boolean)}
|
|
@@ -113,68 +113,106 @@ import{recordActionsFor}from"./record-actions";import{commentSnippets}from"./com
|
|
|
113
113
|
{/if}
|
|
114
114
|
{/if}
|
|
115
115
|
</div>
|
|
116
|
+
{#snippet entry(item: FeedItem)}
|
|
117
|
+
<div class="sv-frv-item-head"><strong>{who(item)}</strong>{#if item.note?.internal}<span class="sv-frv-internal-tag">{bm('record.internalTag')}</span>{/if}{item.kind === 'edit' ? ` ${bm(item.undone ? 'record.undidField' : item.redone ? 'record.redidField' : 'record.changedField', { field: item.field })}` : item.kind === 'added' ? ` ${bm('record.addedRecord')}` : ''}<span class="sv-frv-when">{timeAgo(item.at)}</span></div>
|
|
118
|
+
{#if item.note && editingNote === item.note.id}
|
|
119
|
+
<form class="sv-frv-comment" onsubmit={(e) => { e.preventDefault(); saveEdit() }}>
|
|
120
|
+
<MentionInput bind:value={editText} bind:picked={editPicked} bind:box={editBox} onSubmit={saveEdit} />
|
|
121
|
+
{#if stepHeld}<p class="sv-frv-held">{bm('record.commentHoldsStep')}</p>{:else if escapeHeld}<p class="sv-frv-held">{bm('record.commentNotSaved')}</p>{/if}
|
|
122
|
+
<div class="sv-frv-note-acts">
|
|
123
|
+
<button type="button" class="sv-frv-link" onclick={cancelEdit}>{bm('record.cancelComment')}</button>
|
|
124
|
+
<button type="submit" class="sv-frv-btn" disabled={!editText.trim()}>{bm('record.saveComment')}</button>
|
|
125
|
+
</div>
|
|
126
|
+
</form>
|
|
127
|
+
{:else if item.kind !== 'added'}
|
|
128
|
+
<div class="sv-frv-item-body">
|
|
129
|
+
{#if item.parts}{#each item.parts as part, i (i)}{#if 'mention' in part}{@const user = mentioned(part.mention, part.name)}<span class="sv-frv-mention" title={user.email ?? user.name}><UserFace {user} size={14} />@{user.name}</span>{:else}{part.text}{/if}{/each}{:else}{#if item.from !== undefined}<span class="sv-frv-from">{item.from}</span><span class="sv-frv-arrow" aria-label={bm('record.changedTo')}>→</span>{/if}{item.text || (item.kind === 'edit' ? bm('record.cleared') : '')}{/if}{#if item.note?.editedAt} <span class="sv-frv-when">{bm('record.commentEdited')}</span>{/if}
|
|
130
|
+
{#if item.note?.files?.length}
|
|
131
|
+
<ul class="sv-frv-files" aria-label={bm('record.commentFiles')}>
|
|
132
|
+
{#each item.note.files as f (f.id)}
|
|
133
|
+
<li><a href={f.url} target="_blank" rel="noopener noreferrer" download={f.name}>{f.name}</a>{#if f.size != null}<span class="sv-frv-when">{fileSize(f.size)}</span>{/if}</li>
|
|
134
|
+
{/each}
|
|
135
|
+
</ul>
|
|
136
|
+
{/if}
|
|
137
|
+
</div>
|
|
138
|
+
{#if item.restore && !readOnly && editable(item.restore.col) && !sameValue(row?.getCellValueByColumnId?.(item.restore.col.id), item.restore.value)}
|
|
139
|
+
{@const back = item.restore}
|
|
140
|
+
<button type="button" class="sv-frv-link sv-frv-restore" title={bm('record.restoreHint', { field: item.field })} onclick={() => commit(back.col, back.value)}>{bm('record.restoreValue')}</button>
|
|
141
|
+
{/if}
|
|
142
|
+
{#if item.note}
|
|
143
|
+
{@const note = item.note}
|
|
144
|
+
{@const votes = commentVotes(note)}
|
|
145
|
+
{@const mine = myCommentVote(note)}
|
|
146
|
+
{@const voting = canComment && mayVoteComment(note)}
|
|
147
|
+
{@const showVotes = commentsTakeVotes() && (voting || votes.up.length > 0 || votes.down.length > 0)}
|
|
148
|
+
{@const owns = canComment && (ownsComment(note, 'update') || ownsComment(note, 'remove'))}
|
|
149
|
+
{#if canComment && deletingNote === note.id}
|
|
150
|
+
<div class="sv-frv-note-acts" role="group" aria-label={bm('record.deleteCommentAsk')}>
|
|
151
|
+
<span>{bm('record.deleteCommentAsk')}</span>
|
|
152
|
+
<button type="button" class="sv-frv-link" onclick={() => { if (row) deleteComment(ctrl, row.id, note.id); deletingNote = null; announce(bm('record.commentDeletedSay')) }}>{bm('record.deleteComment')}</button>
|
|
153
|
+
<button type="button" class="sv-frv-link" use:takeFocus onclick={keepNote}>{bm('record.cancelComment')}</button>
|
|
154
|
+
</div>
|
|
155
|
+
{:else if showVotes || owns}
|
|
156
|
+
<div class="sv-frv-note-acts" data-note={note.id}>
|
|
157
|
+
{#if showVotes}
|
|
158
|
+
|
|
159
|
+
<span class="sv-frv-votes" role="group" aria-label={bm('record.commentVotes')}>
|
|
160
|
+
<button type="button" class="sv-frv-vote" class:is-mine={mine === 'up'} aria-pressed={mine === 'up'} aria-label={bm('record.voteUpCount', { count: votes.up.length })} title={voteTitle('up', votes.up)} disabled={!voting} onclick={() => { if (row) voteComment(ctrl, row.id, note.id, 'up') }}>
|
|
161
|
+
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><path d="M7 10v11H3V10h4zm2 11h8.3a2 2 0 0 0 2-1.6l1.4-7A2 2 0 0 0 18.7 10H14V5.5A2.5 2.5 0 0 0 11.5 3L9 10v11z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg>
|
|
162
|
+
<span>{votes.up.length}</span>
|
|
163
|
+
</button>
|
|
164
|
+
<button type="button" class="sv-frv-vote is-down" class:is-mine={mine === 'down'} aria-pressed={mine === 'down'} aria-label={bm('record.voteDownCount', { count: votes.down.length })} title={voteTitle('down', votes.down)} disabled={!voting} onclick={() => { if (row) voteComment(ctrl, row.id, note.id, 'down') }}>
|
|
165
|
+
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><path d="M17 14V3h4v11h-4zM15 3H6.7a2 2 0 0 0-2 1.6l-1.4 7A2 2 0 0 0 5.3 14H10v4.5a2.5 2.5 0 0 0 2.5 2.5L15 14V3z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg>
|
|
166
|
+
<span>{votes.down.length}</span>
|
|
167
|
+
</button>
|
|
168
|
+
</span>
|
|
169
|
+
{/if}
|
|
170
|
+
{#if owns && ownsComment(note, 'update')}<button type="button" class="sv-frv-link" onclick={() => startEdit(note)}>{bm('record.editComment')}</button>{/if}
|
|
171
|
+
{#if owns && ownsComment(note, 'remove')}<button type="button" class="sv-frv-link" onclick={() => { editingNote = null; deletingNote = note.id }}>{bm('record.deleteComment')}</button>{/if}
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
174
|
+
{/if}
|
|
175
|
+
{/if}
|
|
176
|
+
{/snippet}
|
|
116
177
|
<aside class="sv-frv-activity" aria-label={bm('record.activity')}>
|
|
117
178
|
<h3 class="sv-frv-activity-title">{bm('record.activity')}</h3>
|
|
118
179
|
<ol class="sv-frv-feed" bind:this={feedBox}>
|
|
119
180
|
{#each feed as item (item.key)}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{#if item.parts}{#each item.parts as part, i (i)}{#if 'mention' in part}{@const user = mentioned(part.mention, part.name)}<span class="sv-frv-mention" title={user.email ?? user.name}><UserFace {user} size={14} />@{user.name}</span>{:else}{part.text}{/if}{/each}{:else}{#if item.from !== undefined}<span class="sv-frv-from">{item.from}</span><span class="sv-frv-arrow" aria-label={bm('record.changedTo')}>→</span>{/if}{item.text || (item.kind === 'edit' ? bm('record.cleared') : '')}{/if}{#if item.note?.editedAt} <span class="sv-frv-when">{bm('record.commentEdited')}</span>{/if}
|
|
134
|
-
{#if item.note?.files?.length}
|
|
135
|
-
<ul class="sv-frv-files" aria-label={bm('record.commentFiles')}>
|
|
136
|
-
{#each item.note.files as f (f.id)}
|
|
137
|
-
<li><a href={f.url} target="_blank" rel="noopener noreferrer" download={f.name}>{f.name}</a>{#if f.size != null}<span class="sv-frv-when">{fileSize(f.size)}</span>{/if}</li>
|
|
138
|
-
{/each}
|
|
139
|
-
</ul>
|
|
140
|
-
{/if}
|
|
181
|
+
{@const thread = item.note ? (threads.get(item.note.id) ?? []) : []}
|
|
182
|
+
{@const folded = !!item.note?.resolved && !openThreads.has(item.note.id)}
|
|
183
|
+
<li class="sv-frv-item" class:is-comment={item.kind === 'comment'} class:is-internal={!!item.note?.internal} class:is-resolved={!!item.note?.resolved}>
|
|
184
|
+
{#if folded && item.note?.resolved}
|
|
185
|
+
{@const note = item.note}
|
|
186
|
+
|
|
187
|
+
<div class="sv-frv-resolved">
|
|
188
|
+
<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M3 8.5l3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
189
|
+
<span><strong>{who(item)}</strong>: {preview(item)}</span>
|
|
190
|
+
</div>
|
|
191
|
+
<div class="sv-frv-thread-acts">
|
|
192
|
+
<span class="sv-frv-when">{bm('record.threadResolvedBy', { person: nameOf(item.note.resolved.by) })}, {timeAgo(item.note.resolved.at)}</span>
|
|
193
|
+
<button type="button" class="sv-frv-link" aria-expanded="false" onclick={() => toggleThread(note.id)}>{bmCount('record.showThread', 1 + thread.length)}</button>
|
|
141
194
|
</div>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
195
|
+
{:else}
|
|
196
|
+
{@render entry(item)}
|
|
197
|
+
{#if thread.length}
|
|
198
|
+
<ol class="sv-frv-thread" aria-label={bm('record.threadReplies')}>
|
|
199
|
+
{#each thread as answer (answer.id)}
|
|
200
|
+
<li class="sv-frv-item is-comment is-reply" class:is-internal={!!answer.internal}>{@render entry(noteItem(answer))}</li>
|
|
201
|
+
{/each}
|
|
202
|
+
</ol>
|
|
145
203
|
{/if}
|
|
146
|
-
{#if item.note}
|
|
204
|
+
{#if item.note && ((canComment && !isDraft && (commentsTakeReplies() || commentsResolve())) || item.note.resolved)}
|
|
147
205
|
{@const note = item.note}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
</div>
|
|
159
|
-
{:else if showVotes || owns}
|
|
160
|
-
<div class="sv-frv-note-acts" data-note={note.id}>
|
|
161
|
-
{#if showVotes}
|
|
162
|
-
|
|
163
|
-
<span class="sv-frv-votes" role="group" aria-label={bm('record.commentVotes')}>
|
|
164
|
-
<button type="button" class="sv-frv-vote" class:is-mine={mine === 'up'} aria-pressed={mine === 'up'} aria-label={bm('record.voteUpCount', { count: votes.up.length })} title={voteTitle('up', votes.up)} disabled={!voting} onclick={() => { if (row) voteComment(ctrl, row.id, note.id, 'up') }}>
|
|
165
|
-
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><path d="M7 10v11H3V10h4zm2 11h8.3a2 2 0 0 0 2-1.6l1.4-7A2 2 0 0 0 18.7 10H14V5.5A2.5 2.5 0 0 0 11.5 3L9 10v11z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg>
|
|
166
|
-
<span>{votes.up.length}</span>
|
|
167
|
-
</button>
|
|
168
|
-
<button type="button" class="sv-frv-vote is-down" class:is-mine={mine === 'down'} aria-pressed={mine === 'down'} aria-label={bm('record.voteDownCount', { count: votes.down.length })} title={voteTitle('down', votes.down)} disabled={!voting} onclick={() => { if (row) voteComment(ctrl, row.id, note.id, 'down') }}>
|
|
169
|
-
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><path d="M17 14V3h4v11h-4zM15 3H6.7a2 2 0 0 0-2 1.6l-1.4 7A2 2 0 0 0 5.3 14H10v4.5a2.5 2.5 0 0 0 2.5 2.5L15 14V3z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg>
|
|
170
|
-
<span>{votes.down.length}</span>
|
|
171
|
-
</button>
|
|
172
|
-
</span>
|
|
173
|
-
{/if}
|
|
174
|
-
{#if owns && ownsComment(note, 'update')}<button type="button" class="sv-frv-link" onclick={() => startEdit(note)}>{bm('record.editComment')}</button>{/if}
|
|
175
|
-
{#if owns && ownsComment(note, 'remove')}<button type="button" class="sv-frv-link" onclick={() => { editingNote = null; deletingNote = note.id }}>{bm('record.deleteComment')}</button>{/if}
|
|
176
|
-
</div>
|
|
177
|
-
{/if}
|
|
206
|
+
<div class="sv-frv-thread-acts">
|
|
207
|
+
{#if note.resolved}
|
|
208
|
+
<span class="sv-frv-when">{bm('record.threadResolvedBy', { person: nameOf(note.resolved.by) })}</span>
|
|
209
|
+
{#if canComment && commentsResolve()}<button type="button" class="sv-frv-link" onclick={() => resolveThread(note, false)}>{bm('record.reopenThread')}</button>{/if}
|
|
210
|
+
<button type="button" class="sv-frv-link" aria-expanded="true" onclick={() => toggleThread(note.id)}>{bm('record.hideThread')}</button>
|
|
211
|
+
{:else}
|
|
212
|
+
{#if commentsTakeReplies()}<button type="button" class="sv-frv-link" class:is-on={answering?.id === note.id} onclick={() => replyTo(note)}>{bm('record.replyComment')}</button>{/if}
|
|
213
|
+
{#if commentsResolve()}<button type="button" class="sv-frv-link" title={bm('record.resolveThreadHint')} onclick={() => resolveThread(note, true)}>{bm('record.resolveThread')}</button>{/if}
|
|
214
|
+
{/if}
|
|
215
|
+
</div>
|
|
178
216
|
{/if}
|
|
179
217
|
{/if}
|
|
180
218
|
</li>
|
|
@@ -196,6 +234,12 @@ import{recordActionsFor}from"./record-actions";import{commentSnippets}from"./com
|
|
|
196
234
|
send()
|
|
197
235
|
}}
|
|
198
236
|
>
|
|
237
|
+
{#if answering}
|
|
238
|
+
<div class="sv-frv-answering">
|
|
239
|
+
<span>{bm('record.replyingTo', { person: nameOf(answering.by) })}</span>
|
|
240
|
+
<button type="button" class="sv-frv-link" aria-label={bm('record.cancelReply')} title={bm('record.cancelReply')} onclick={() => (answering = null)}>×</button>
|
|
241
|
+
</div>
|
|
242
|
+
{/if}
|
|
199
243
|
<MentionInput bind:value={comment} bind:picked bind:box={commentBox} onSubmit={send} />
|
|
200
244
|
{#if escapeHeld && editingNote == null}<p class="sv-frv-held">{bm('record.commentNotSent')}</p>{/if}
|
|
201
245
|
{#if commentFiles.length || uploading}
|
|
@@ -354,5 +398,5 @@ import{recordActionsFor}from"./record-actions";import{commentSnippets}from"./com
|
|
|
354
398
|
{/if}
|
|
355
399
|
|
|
356
400
|
<style>
|
|
357
|
-
.sv-frv-dock{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--sg-border, #e2e8f0);border-radius:8px;background:var(--sg-header-bg, #f8fafc)}.sv-frv-dock-btn{display:grid;place-items:center;width:28px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-dock-btn:hover{color:var(--sg-fg, #0f172a)}.sv-frv-dock-btn.is-on{background:var(--sg-bg, #fff);color:var(--sg-accent, #2563eb);box-shadow:0 1px 2px #0f172a26}.sv-frv-dock-btn:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:1px}.sv-frv-side{position:fixed;right:0;bottom:0;z-index:9000;display:flex;flex-direction:column;box-sizing:border-box;max-width:100vw;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);border-inline-start:1px solid var(--sg-border, #e2e8f0);box-shadow:-12px 0 32px -16px #0f172a59;font-size:13.5px;line-height:1.6}.sv-frv-side:focus{outline:none}.sv-frv-edge{position:absolute;inset-block:0;inset-inline-start:-4px;width:8px;cursor:ew-resize;touch-action:none;z-index:1}.sv-frv-edge:hover,.sv-frv-edge:focus-visible{background:color-mix(in srgb,var(--sg-accent, #2563eb) 25%,transparent);outline:none}.sv-frv-side-head{display:flex;align-items:center;gap:10px;padding:11px 14px;border-bottom:1px solid var(--sg-border, #e2e8f0)}.sv-frv-side-title{flex:1;min-width:0;margin:0;font-size:15px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-frv-side-x{flex:none;width:28px;height:28px;display:grid;place-items:center;background:none;border:0;color:var(--sg-muted, #64748b);cursor:pointer;border-radius:6px;font-size:20px;line-height:1}.sv-frv-side-x:hover{background:var(--sg-row-hover-bg, #f1f5f9);color:var(--sg-fg, #0f172a)}.sv-frv-side-body{flex:1;min-height:0;overflow:auto;padding:14px}.sv-frv-side-foot{padding:10px 14px;border-top:1px solid var(--sg-border, #e2e8f0)}.sv-frv-side .sv-frv-layout{grid-template-columns:minmax(0,1fr)}.sv-frv-proposals{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:8px 12px;border-radius:var(--sg-radius, 6px);font-size:13px;background:color-mix(in srgb,var(--sg-accent, #2563eb) 8%,var(--sg-bg, #fff));border:1px solid color-mix(in srgb,var(--sg-accent, #2563eb) 30%,var(--sg-border, #e2e8f0))}.sv-frv-proposal{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;margin-top:6px;padding:6px 8px;font-size:13px;border-inline-start:3px solid var(--sg-accent, #2563eb);border-radius:0 var(--sg-radius, 6px) var(--sg-radius, 6px) 0;background:color-mix(in srgb,var(--sg-accent, #2563eb) 6%,var(--sg-bg, #fff))}.sv-frv-proposal-by{color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-filtered{display:flex;align-items:center;gap:6px;margin:0 0 12px;font-size:12px;color:var(--sg-muted, #64748b)}.sv-frv-filtered svg{flex:none}.sv-frv-proposal-value{font-weight:600;overflow-wrap:anywhere}.sv-frv-proposal-acts{display:inline-flex;gap:6px;margin-inline-start:auto}.sv-frv-proposal-acts .sv-frv-btn{height:26px;padding:0 10px}.sv-frv-btn.is-accept{background:var(--sg-accent, #2563eb);border-color:var(--sg-accent, #2563eb);color:var(--sg-on-accent, #fff)}.sv-frv-proposal-why{flex-basis:100%;color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:20px;align-items:start}.sv-frv-fields{display:flex;flex-direction:column;gap:14px;min-width:0}.sv-frv-field{display:flex;flex-direction:column;gap:6px}.sv-frv-label{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--sg-muted, #64748b)}.sv-frv-mic{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;margin:-8px -6px -8px auto;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sg-accent, #2563eb);cursor:pointer}.sv-frv-mic:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent, #2563eb) 12%,transparent)}.sv-frv-mic:disabled:not(.is-on){opacity:.4;cursor:default}.sv-frv-mic.is-on,.sv-frv-mic-comment.is-on{color:var(--sg-danger, #dc2626);animation:sv-frv-listen 1s ease-in-out infinite}.sv-frv-mic-comment{display:inline-flex;align-items:center;gap:4px}@keyframes sv-frv-listen{50%{opacity:.45}}@media(prefers-reduced-motion:reduce){.sv-frv-mic.is-on,.sv-frv-mic-comment.is-on{animation:none}}.sv-frv-ro{font-weight:400;font-size:11px;opacity:.8}.sv-frv-hidden-toggle{align-self:flex-start;border:0;padding:2px 0;background:none;font:inherit;font-size:13px;color:var(--sg-fg, #0f172a);text-decoration:underline;cursor:pointer}.sv-frv-activity{position:sticky;top:0;display:flex;flex-direction:column;gap:8px;max-height:70vh;padding-inline-start:16px;border-inline-start:1px solid var(--sg-border, #e2e8f0)}.sv-frv-activity-title{margin:0;font-size:13px;font-weight:600}.sv-frv-feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;overflow:auto;min-height:60px}.sv-frv-item{font-size:12px}.sv-frv-item-head{color:var(--sg-muted, #64748b)}.sv-frv-item-head strong{color:var(--sg-fg, #0f172a);font-weight:600}.sv-frv-from{color:var(--sg-muted, #64748b);text-decoration:line-through}.sv-frv-arrow{margin:0 5px;color:var(--sg-muted, #64748b)}.sv-frv-when{margin-inline-start:6px;color:var(--sg-fg, #0f172a)}.sv-frv-note-acts{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:4px;font-size:12px;color:var(--sg-muted, #64748b)}.sv-frv-link{padding:0;border:0;background:none;font:inherit;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-link:hover{color:var(--sg-fg, #0f172a);text-decoration:underline}.sv-frv-restore{margin-top:2px}.sv-frv-votes{display:inline-flex;gap:4px;margin-right:auto}.sv-frv-vote{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:2px 8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:999px;background:var(--sg-bg, #fff);font:inherit;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-vote:hover:not(:disabled){color:var(--sg-fg, #0f172a);border-color:color-mix(in srgb,var(--sg-fg, #0f172a) 30%,transparent)}.sv-frv-vote:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:2px}.sv-frv-vote:disabled{cursor:default}.sv-frv-vote.is-mine{color:var(--sg-accent, #2563eb);border-color:var(--sg-accent, #2563eb);background:color-mix(in srgb,var(--sg-accent, #2563eb) 10%,transparent)}.sv-frv-vote.is-down.is-mine{color:#b42318;border-color:#b42318;background:color-mix(in srgb,#b42318 10%,transparent)}.sv-frv-link:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:2px}.sv-frv-item-body{margin-top:2px;white-space:pre-wrap;word-break:break-word}.sv-frv-item.is-comment .sv-frv-item-body{padding:6px 8px;border-radius:8px;background:color-mix(in srgb,var(--sg-fg, #0f172a) 5%,transparent)}.sv-frv-none{color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-comment{display:grid;gap:6px}.sv-frv-held{margin:0;font-size:12px;color:var(--sg-fg, #0f172a)}.sv-frv-mention{display:inline-flex;align-items:center;gap:3px;padding:0 5px 0 2px;border-radius:999px;vertical-align:baseline;font-weight:600;color:var(--sg-accent, #2563eb);background:color-mix(in srgb,var(--sg-accent, #2563eb) 12%,transparent)}.sv-frv-comment .sv-frv-btn{justify-self:end}.sv-frv-send{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}.sv-frv-attach{display:inline-flex;align-items:center;gap:4px;margin-inline-end:auto}.sv-frv-internal{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-files{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:3px}.sv-frv-replies-open{display:inline-flex;align-items:center;gap:4px}.sv-frv-replies{display:flex;flex-direction:column;gap:6px;padding:8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:8px;background:var(--sg-bg, #fff)}.sv-frv-replies-search,.sv-frv-replies-save input{font:inherit;font-size:13px;padding:5px 8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:6px;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);min-width:0}.sv-frv-replies-list{list-style:none;margin:0;padding:0;max-height:220px;overflow:auto;display:flex;flex-direction:column;gap:2px}.sv-frv-reply{display:flex;flex-direction:column;gap:2px;width:100%;text-align:start;padding:6px 8px;border:0;border-radius:6px;background:none;font:inherit;font-size:13px;color:inherit;cursor:pointer}.sv-frv-reply:hover,.sv-frv-reply:focus-visible{background:var(--sg-hover, #f1f5f9)}.sv-frv-reply span{color:var(--sg-muted, #64748b);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-frv-replies-save{display:flex;gap:6px}.sv-frv-replies-save input{flex:1}.sv-frv-files li{display:flex;align-items:baseline;gap:6px;min-width:0;overflow-wrap:anywhere}.sv-frv-files a{color:var(--sg-accent, #2563eb)}.sv-frv-files.is-draft{margin:0;font-size:12px}.sv-frv-internal-tag{margin-inline-start:6px;padding:0 6px;border-radius:999px;font-size:11px;font-weight:600;color:#92400e;background:#fef3c7}.sv-frv-item.is-comment.is-internal .sv-frv-item-body{background:color-mix(in srgb,#f59e0b 12%,transparent)}.sv-frv-gone{color:var(--sg-muted, #64748b)}.sv-frv-footer{display:flex;align-items:center;gap:6px;width:100%}.sv-frv-pos{flex:1;font-size:13px;color:var(--sg-muted, #64748b)}.sv-frv-btn{display:inline-flex;align-items:center;justify-content:center;height:32px;min-width:32px;padding:0 12px;font:inherit;font-size:13px;cursor:pointer;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a)}.sv-frv-btn:disabled{opacity:.4;cursor:default}.sv-frv-btn.is-primary{background:var(--sg-fg, #0f172a);color:var(--sg-bg, #fff);border-color:var(--sg-fg, #0f172a)}.sv-frv-btn.is-danger{color:var(--sg-danger, #b91c1c)}@media(max-width:760px){.sv-frv-layout{grid-template-columns:minmax(0,1fr)}.sv-frv-activity{position:static;padding-inline-start:0;border-inline-start:0;border-top:1px solid var(--sg-border, #e2e8f0);padding-top:12px}}@media(max-width:600px){:global(.sv-modal:has(.sv-frv-layout)){width:100vw!important;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}}.sv-frv-apps{display:flex;flex-wrap:wrap;gap:14px;justify-content:flex-end;margin:0 0 8px}.sv-frv-app{display:inline-flex;align-items:center;gap:5px}
|
|
401
|
+
.sv-frv-dock{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--sg-border, #e2e8f0);border-radius:8px;background:var(--sg-header-bg, #f8fafc)}.sv-frv-dock-btn{display:grid;place-items:center;width:28px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-dock-btn:hover{color:var(--sg-fg, #0f172a)}.sv-frv-dock-btn.is-on{background:var(--sg-bg, #fff);color:var(--sg-accent, #2563eb);box-shadow:0 1px 2px #0f172a26}.sv-frv-dock-btn:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:1px}.sv-frv-side{position:fixed;right:0;bottom:0;z-index:9000;display:flex;flex-direction:column;box-sizing:border-box;max-width:100vw;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);border-inline-start:1px solid var(--sg-border, #e2e8f0);box-shadow:-12px 0 32px -16px #0f172a59;font-size:13.5px;line-height:1.6}.sv-frv-side:focus{outline:none}.sv-frv-edge{position:absolute;inset-block:0;inset-inline-start:-4px;width:8px;cursor:ew-resize;touch-action:none;z-index:1}.sv-frv-edge:hover,.sv-frv-edge:focus-visible{background:color-mix(in srgb,var(--sg-accent, #2563eb) 25%,transparent);outline:none}.sv-frv-side-head{display:flex;align-items:center;gap:10px;padding:11px 14px;border-bottom:1px solid var(--sg-border, #e2e8f0)}.sv-frv-side-title{flex:1;min-width:0;margin:0;font-size:15px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-frv-side-x{flex:none;width:28px;height:28px;display:grid;place-items:center;background:none;border:0;color:var(--sg-muted, #64748b);cursor:pointer;border-radius:6px;font-size:20px;line-height:1}.sv-frv-side-x:hover{background:var(--sg-row-hover-bg, #f1f5f9);color:var(--sg-fg, #0f172a)}.sv-frv-side-body{flex:1;min-height:0;overflow:auto;padding:14px}.sv-frv-side-foot{padding:10px 14px;border-top:1px solid var(--sg-border, #e2e8f0)}.sv-frv-side .sv-frv-layout{grid-template-columns:minmax(0,1fr)}.sv-frv-proposals{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:8px 12px;border-radius:var(--sg-radius, 6px);font-size:13px;background:color-mix(in srgb,var(--sg-accent, #2563eb) 8%,var(--sg-bg, #fff));border:1px solid color-mix(in srgb,var(--sg-accent, #2563eb) 30%,var(--sg-border, #e2e8f0))}.sv-frv-proposal{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;margin-top:6px;padding:6px 8px;font-size:13px;border-inline-start:3px solid var(--sg-accent, #2563eb);border-radius:0 var(--sg-radius, 6px) var(--sg-radius, 6px) 0;background:color-mix(in srgb,var(--sg-accent, #2563eb) 6%,var(--sg-bg, #fff))}.sv-frv-proposal-by{color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-filtered{display:flex;align-items:center;gap:6px;margin:0 0 12px;font-size:12px;color:var(--sg-muted, #64748b)}.sv-frv-filtered svg{flex:none}.sv-frv-proposal-value{font-weight:600;overflow-wrap:anywhere}.sv-frv-proposal-acts{display:inline-flex;gap:6px;margin-inline-start:auto}.sv-frv-proposal-acts .sv-frv-btn{height:26px;padding:0 10px}.sv-frv-btn.is-accept{background:var(--sg-accent, #2563eb);border-color:var(--sg-accent, #2563eb);color:var(--sg-on-accent, #fff)}.sv-frv-proposal-why{flex-basis:100%;color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:20px;align-items:start}.sv-frv-fields{display:flex;flex-direction:column;gap:14px;min-width:0}.sv-frv-field{display:flex;flex-direction:column;gap:6px}.sv-frv-label{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--sg-muted, #64748b)}.sv-frv-mic{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;margin:-8px -6px -8px auto;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sg-accent, #2563eb);cursor:pointer}.sv-frv-mic:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent, #2563eb) 12%,transparent)}.sv-frv-mic:disabled:not(.is-on){opacity:.4;cursor:default}.sv-frv-mic.is-on,.sv-frv-mic-comment.is-on{color:var(--sg-danger, #dc2626);animation:sv-frv-listen 1s ease-in-out infinite}.sv-frv-mic-comment{display:inline-flex;align-items:center;gap:4px}@keyframes sv-frv-listen{50%{opacity:.45}}@media(prefers-reduced-motion:reduce){.sv-frv-mic.is-on,.sv-frv-mic-comment.is-on{animation:none}}.sv-frv-ro{font-weight:400;font-size:11px;opacity:.8}.sv-frv-hidden-toggle{align-self:flex-start;border:0;padding:2px 0;background:none;font:inherit;font-size:13px;color:var(--sg-fg, #0f172a);text-decoration:underline;cursor:pointer}.sv-frv-activity{position:sticky;top:0;display:flex;flex-direction:column;gap:8px;max-height:70vh;padding-inline-start:16px;border-inline-start:1px solid var(--sg-border, #e2e8f0)}.sv-frv-activity-title{margin:0;font-size:13px;font-weight:600}.sv-frv-feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;overflow:auto;min-height:60px}.sv-frv-item{font-size:12px}.sv-frv-item-head{color:var(--sg-muted, #64748b)}.sv-frv-item-head strong{color:var(--sg-fg, #0f172a);font-weight:600}.sv-frv-from{color:var(--sg-muted, #64748b);text-decoration:line-through}.sv-frv-arrow{margin:0 5px;color:var(--sg-muted, #64748b)}.sv-frv-when{margin-inline-start:6px;color:var(--sg-fg, #0f172a)}.sv-frv-note-acts{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:4px;font-size:12px;color:var(--sg-muted, #64748b)}.sv-frv-link{padding:0;border:0;background:none;font:inherit;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-link:hover{color:var(--sg-fg, #0f172a);text-decoration:underline}.sv-frv-restore{margin-top:2px}.sv-frv-votes{display:inline-flex;gap:4px;margin-right:auto}.sv-frv-vote{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:2px 8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:999px;background:var(--sg-bg, #fff);font:inherit;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-vote:hover:not(:disabled){color:var(--sg-fg, #0f172a);border-color:color-mix(in srgb,var(--sg-fg, #0f172a) 30%,transparent)}.sv-frv-vote:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:2px}.sv-frv-vote:disabled{cursor:default}.sv-frv-vote.is-mine{color:var(--sg-accent, #2563eb);border-color:var(--sg-accent, #2563eb);background:color-mix(in srgb,var(--sg-accent, #2563eb) 10%,transparent)}.sv-frv-vote.is-down.is-mine{color:#b42318;border-color:#b42318;background:color-mix(in srgb,#b42318 10%,transparent)}.sv-frv-link:focus-visible{outline:2px solid var(--sg-accent, #2563eb);outline-offset:2px}.sv-frv-item-body{margin-top:2px;white-space:pre-wrap;word-break:break-word}.sv-frv-item.is-comment .sv-frv-item-body{padding:6px 8px;border-radius:8px;background:color-mix(in srgb,var(--sg-fg, #0f172a) 5%,transparent)}.sv-frv-none{color:var(--sg-muted, #64748b);font-size:12px}.sv-frv-comment{display:grid;gap:6px}.sv-frv-held{margin:0;font-size:12px;color:var(--sg-fg, #0f172a)}.sv-frv-mention{display:inline-flex;align-items:center;gap:3px;padding:0 5px 0 2px;border-radius:999px;vertical-align:baseline;font-weight:600;color:var(--sg-accent, #2563eb);background:color-mix(in srgb,var(--sg-accent, #2563eb) 12%,transparent)}.sv-frv-comment .sv-frv-btn{justify-self:end}.sv-frv-send{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}.sv-frv-attach{display:inline-flex;align-items:center;gap:4px;margin-inline-end:auto}.sv-frv-internal{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--sg-muted, #64748b);cursor:pointer}.sv-frv-files{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:3px}.sv-frv-replies-open{display:inline-flex;align-items:center;gap:4px}.sv-frv-replies{display:flex;flex-direction:column;gap:6px;padding:8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:8px;background:var(--sg-bg, #fff)}.sv-frv-replies-search,.sv-frv-replies-save input{font:inherit;font-size:13px;padding:5px 8px;border:1px solid var(--sg-border, #e2e8f0);border-radius:6px;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);min-width:0}.sv-frv-replies-list{list-style:none;margin:0;padding:0;max-height:220px;overflow:auto;display:flex;flex-direction:column;gap:2px}.sv-frv-reply{display:flex;flex-direction:column;gap:2px;width:100%;text-align:start;padding:6px 8px;border:0;border-radius:6px;background:none;font:inherit;font-size:13px;color:inherit;cursor:pointer}.sv-frv-reply:hover,.sv-frv-reply:focus-visible{background:var(--sg-hover, #f1f5f9)}.sv-frv-reply span{color:var(--sg-muted, #64748b);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-frv-replies-save{display:flex;gap:6px}.sv-frv-replies-save input{flex:1}.sv-frv-files li{display:flex;align-items:baseline;gap:6px;min-width:0;overflow-wrap:anywhere}.sv-frv-files a{color:var(--sg-accent, #2563eb)}.sv-frv-files.is-draft{margin:0;font-size:12px}.sv-frv-internal-tag{margin-inline-start:6px;padding:0 6px;border-radius:999px;font-size:11px;font-weight:600;color:#92400e;background:#fef3c7}.sv-frv-item.is-comment.is-internal .sv-frv-item-body{background:color-mix(in srgb,#f59e0b 12%,transparent)}.sv-frv-gone{color:var(--sg-muted, #64748b)}.sv-frv-thread{list-style:none;margin:6px 0 0;padding:0 0 0 12px;border-inline-start:2px solid var(--sg-border, #e2e8f0);display:flex;flex-direction:column;gap:8px}.sv-frv-thread-acts{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;margin-top:4px;font-size:12px}.sv-frv-thread-acts .sv-frv-link{white-space:nowrap}.sv-frv-thread-acts .sv-frv-when{margin-inline-start:0;color:var(--sg-muted, #64748b)}.sv-frv-thread-acts .sv-frv-link.is-on{color:var(--sg-accent, #2563eb);font-weight:600}.sv-frv-resolved{display:flex;align-items:flex-start;gap:6px;padding:6px 8px;border-radius:8px;color:var(--sg-muted, #64748b);background:color-mix(in srgb,#16a34a 8%,transparent);overflow:hidden}.sv-frv-resolved svg{flex:none;margin-top:2px;color:#16a34a}.sv-frv-resolved span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-frv-resolved strong{color:var(--sg-fg, #0f172a);font-weight:600}.sv-frv-answering{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px;border-radius:6px;font-size:12px;color:var(--sg-accent, #2563eb);background:color-mix(in srgb,var(--sg-accent, #2563eb) 8%,transparent)}.sv-frv-answering .sv-frv-link{font-size:15px;line-height:1}.sv-frv-footer{display:flex;align-items:center;gap:6px;width:100%}.sv-frv-pos{flex:1;font-size:13px;color:var(--sg-muted, #64748b)}.sv-frv-btn{display:inline-flex;align-items:center;justify-content:center;height:32px;min-width:32px;padding:0 12px;font:inherit;font-size:13px;cursor:pointer;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a)}.sv-frv-btn:disabled{opacity:.4;cursor:default}.sv-frv-btn.is-primary{background:var(--sg-fg, #0f172a);color:var(--sg-bg, #fff);border-color:var(--sg-fg, #0f172a)}.sv-frv-btn.is-danger{color:var(--sg-danger, #b91c1c)}@media(max-width:760px){.sv-frv-layout{grid-template-columns:minmax(0,1fr)}.sv-frv-activity{position:static;padding-inline-start:0;border-inline-start:0;border-top:1px solid var(--sg-border, #e2e8f0);padding-top:12px}}@media(max-width:600px){:global(.sv-modal:has(.sv-frv-layout)){width:100vw!important;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}}.sv-frv-apps{display:flex;flex-wrap:wrap;gap:14px;justify-content:flex-end;margin:0 0 8px}.sv-frv-app{display:inline-flex;align-items:center;gap:5px}
|
|
358
402
|
</style>
|