@svgrid/enterprise 3.1.42 → 3.1.43
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-CZZrEXgj.js → index-BWz7zwBp.js} +1 -1
- package/dist/designer/index.html +1 -1
- package/dist/fields/AutomationAction.svelte +11 -0
- package/dist/fields/RecordView.svelte +33 -6
- package/dist/fields/activity.svelte.d.ts +23 -1
- package/dist/fields/activity.svelte.js +1 -1
- package/dist/fields/automations.svelte.d.ts +7 -1
- package/dist/fields/index.d.ts +1 -1
- package/dist/fields/messages/extras.d.ts +2 -0
- package/dist/fields/messages/extras.js +1 -1
- package/dist/fields/messages/record.d.ts +6 -0
- package/dist/fields/messages/record.js +1 -1
- package/dist/fields/messages.svelte.d.ts +8 -0
- package/dist/fields/record-actions.d.ts +15 -3
- package/dist/fields/record-actions.js +1 -1
- 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 +86 -86
- package/package.json +1 -1
|
@@ -1520,7 +1520,7 @@ ${F}
|
|
|
1520
1520
|
@keyframes st-home-spin { to { transform: rotate(360deg); } }
|
|
1521
1521
|
</style>
|
|
1522
1522
|
`}}function mS(t){for(let a of t)ts(a);let r=new Map(t.map(a=>[a.name,a])),n=t.map(a=>{let l=ase(a,r);return{schema:lse(a,l),infos:l}});return{entries:n,seed:ise(n)}}function yD(t,r={}){let{entries:n,seed:a}=mS(t),{file:l,needs:i}=Tse(n,a,r.sources,r.supabaseConn,r.serverMemory),o=[dse(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(Ase(i));for(let s of i.sqlRoutes)o.push(bse(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(wse(i.memoryRoutes));for(let s of i.memoryRoutes)o.push(yse(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 Ese(t){if(t.length===0)throw Error("emitStudioApp: no schemas to emit");let{files:r,prepared:n}=yD(t),a=n.map(i=>{let o=qa(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. */
|
|
1523
|
-
`};return[...r,...n.map(i=>Mse(i)),vD(a),bD(a),l]}var Rse="3.1.
|
|
1523
|
+
`};return[...r,...n.map(i=>Mse(i)),vD(a),bD(a),l]}var Rse="3.1.43",Ise="3.0.36",bl=(t,r)=>t.some(n=>n.config.kind===r),wD=t=>`activeTab_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,Qm=(t,r)=>`${t}-${r}`,xD=t=>`accOpen_${t.replace(/[^a-zA-Z0-9_$]/g,"_")}`,ev=(t,r)=>`${t}-s${r}`,tv=t=>`md_${t.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function Dse(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: ${Qr(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: ${Qr(t.pattern)} }`:`{ type: '${t.type}' }`}}function Nse(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(${TD(i,b.field)}, { value: ctx.getValue() })`):b.format&&v.push(`format: ${Dse(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 Hd(t,r){let n=[`grid-column: span ${Die(t)}`,"min-width: 0"];r&&n.push(r);let a=Fie(t.style);return a&&n.push(a),`style="${n.join("; ")}"`}var Fse=t=>t&&t.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function ku(t,r){let n=[r,Iie(t)].filter(Boolean).join(" ");return n?` class="${n}"`:""}function By(t){let r=tS(t.className);return r?` ${r}`:""}function Ose(t){let r=wf(t);if(r==="grid"){let n=Xie(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} }
|
|
1524
1524
|
@media (max-width: ${n.mobileBreakpoint}px) { .st-screen { grid-template-columns: 1fr; gap: 12px; } }
|
|
1525
1525
|
`}if(r==="stack"){let n=Jie(t),a=n.maxWidth?` max-width: ${n.maxWidth}px;${n.align==="center"?" margin-inline: auto;":""}`:"",l=n.minHeight?`
|
|
1526
1526
|
.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 o2e(a){for(let p of a)O4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=Epr(p,i);return{schema:wpr(p,f),infos:f}});return{entries:l,seed:Apr(l)}}function Jpr(a,i={}){let{entries:l,seed:p}=o2e(a),{file:f,needs:g}=qpr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[kpr(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(Kpr(g));for(let S of g.sqlRoutes)_.push(Wpr(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(Gpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(zpr(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 Ypr="3.1.
|
|
76335
|
+
`}}function o2e(a){for(let p of a)O4(p);let i=new Map(a.map(p=>[p.name,p])),l=a.map(p=>{let f=Epr(p,i);return{schema:wpr(p,f),infos:f}});return{entries:l,seed:Apr(l)}}function Jpr(a,i={}){let{entries:l,seed:p}=o2e(a),{file:f,needs:g}=qpr(l,p,i.sources,i.supabaseConn,i.serverMemory),_=[kpr(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(Kpr(g));for(let S of g.sqlRoutes)_.push(Wpr(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(Gpr(g.memoryRoutes));for(let S of g.memoryRoutes)_.push(zpr(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 Ypr="3.1.43",Zpr="3.0.36",mb=(a,i)=>a.some(l=>l.config.kind===i),Bit=a=>`activeTab_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,KZ=(a,i)=>`${a}-${i}`,Uit=a=>`accOpen_${a.replace(/[^a-zA-Z0-9_$]/g,"_")}`,QZ=(a,i)=>`${a}-s${i}`,XZ=a=>`md_${a.replace(/[^a-zA-Z0-9]/g,"_")}_rows`;function eur(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: ${gu(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: ${gu(a.pattern)} }`:`{ type: '${a.type}' }`}}function tur(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(${Qit(g,be.field)}, { value: ctx.getValue() })`):be.format&&Ue.push(`format: ${eur(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 HF(a,i){let l=[`grid-column: span ${sM(a)}`,"min-width: 0"];i&&l.push(i);let p=fit(a.style);return p&&l.push(p),`style="${l.join("; ")}"`}var rur=a=>a&&a.replace(/[^#a-zA-Z0-9(),.%\s_-]/g,"").slice(0,40)||"var(--sg-accent)";function L8(a,i){let l=[i,NH(a)].filter(Boolean).join(" ");return l?` class="${l}"`:""}function rfe(a){let i=LZ(a.className);return i?` ${i}`:""}function nur(a){let i=iR(a);if(i==="grid"){let l=VDe(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=Hue(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-BWz7zwBp.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">
|
|
@@ -10,6 +10,17 @@ import{safeColor}from"./palette";import{primaryOf}from"./base-tables";import{get
|
|
|
10
10
|
</select>
|
|
11
11
|
</div>
|
|
12
12
|
<p class="sv-baac-hint">{bm('extras.notifyHint', { fields: fields.slice(0, 3).map((c) => `{${c.header}}`).join(', ') })}</p>
|
|
13
|
+
{@const personFields = fields.filter((c) => c.fieldType === 'user')}
|
|
14
|
+
{@const people = getFieldUsers().slice(0, 40)}
|
|
15
|
+
{#if personFields.length || people.length}
|
|
16
|
+
<p class="sv-baac-hint">{bm('extras.notifyTo')}</p>
|
|
17
|
+
<div class="sv-baac-chips">
|
|
18
|
+
{#each [...personFields.map((c) => ({ key: `field:${c.id}`, label: bm('extras.notifyToField', { field: c.header }) })), ...people.map((u) => ({ key: u.id, label: u.name }))] as who (who.key)}
|
|
19
|
+
{@const on = !!action.to?.includes(who.key)}
|
|
20
|
+
<button type="button" class="sv-baac-chip" class:is-on={on} aria-pressed={on} onclick={() => onChange({ ...action, to: on ? (action.to ?? []).filter((x) => x !== who.key) : [...(action.to ?? []), who.key] })}>{who.label}</button>
|
|
21
|
+
{/each}
|
|
22
|
+
</div>
|
|
23
|
+
{/if}
|
|
13
24
|
{:else if action.type === 'highlight'}
|
|
14
25
|
{#if automation.trigger.type !== 'recordMatches' && !automation.condition}
|
|
15
26
|
<p class="sv-baac-hint">{bm('extras.highlightNeedsCondition')}</p>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,untrack}from"svelte";import{commentDraftsOf,getRecordRequest,holdForRecordEditor}from"./editor-request.svelte";import{SvModal,announce,toast}from"@svgrid/grid";import FieldInput from"./FieldInput.svelte";import{fieldPropsOf,getFieldType,originalColumn}from"./registry.svelte";import{protectionText}from"./field-access.svelte";import{isReadOnlyGrid}from"./base-share";import{canCommentIn,canDeleteIn}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,commentsOf,deleteComment,editComment,historyOf,historyState,loadHistory,markSeen,ownsComment,timeAgo,unseenOf}from"./activity.svelte";import{findFieldUser}from"./sources.svelte";import{encodeMentions,mentionText,parseMentions}from"./mentions";import MentionInput from"./MentionInput.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))):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())})});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 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)}:{}}});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));function send(){if(!row||!comment.trim()||!canComment||isDraft)return;addComment(ctrl,row.id,encodeMentions(comment,picked));comment="";picked=[];announce(bm("record.commentAddedSay"))}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 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")};
|
|
2
|
+
import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,untrack}from"svelte";import{commentDraftsOf,getRecordRequest,holdForRecordEditor}from"./editor-request.svelte";import{SvModal,announce,toast}from"@svgrid/grid";import FieldInput from"./FieldInput.svelte";import{fieldPropsOf,getFieldType,originalColumn}from"./registry.svelte";import{protectionText}from"./field-access.svelte";import{isReadOnlyGrid}from"./base-share";import{canCommentIn,canDeleteIn}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,commentsOf,deleteComment,editComment,historyOf,historyState,loadHistory,markSeen,ownsComment,timeAgo,unseenOf}from"./activity.svelte";import{uploadAttachment}from"./attachments";import{findFieldUser}from"./sources.svelte";import{encodeMentions,mentionText,parseMentions}from"./mentions";import MentionInput from"./MentionInput.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))):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())})});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 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)}:{}}});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=""}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 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")};
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
{#snippet field(c: Col, canEdit: boolean)}
|
|
@@ -68,7 +68,7 @@ import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,unt
|
|
|
68
68
|
{/if}
|
|
69
69
|
</div>
|
|
70
70
|
{/if}
|
|
71
|
-
{@const appActions = recordActionsFor(ctrl?.props?.baseTableId)}
|
|
71
|
+
{@const appActions = recordActionsFor(ctrl?.props?.baseTableId, { rowId: String((row.original as { id?: unknown } | undefined)?.id ?? row.id), row: (row.original ?? {}) as Record<string, unknown> })}
|
|
72
72
|
{#if appActions.length}
|
|
73
73
|
<div class="sv-frv-apps">
|
|
74
74
|
{#each appActions as act (act.id)}
|
|
@@ -100,8 +100,8 @@ import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,unt
|
|
|
100
100
|
<h3 class="sv-frv-activity-title">{bm('record.activity')}</h3>
|
|
101
101
|
<ol class="sv-frv-feed" bind:this={feedBox}>
|
|
102
102
|
{#each feed as item (item.key)}
|
|
103
|
-
<li class="sv-frv-item" class:is-comment={item.kind === 'comment'}>
|
|
104
|
-
<div class="sv-frv-item-head"><strong>{who(item)}</strong>{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>
|
|
103
|
+
<li class="sv-frv-item" class:is-comment={item.kind === 'comment'} class:is-internal={!!item.note?.internal}>
|
|
104
|
+
<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>
|
|
105
105
|
{#if item.note && editingNote === item.note.id}
|
|
106
106
|
<form class="sv-frv-comment" onsubmit={(e) => { e.preventDefault(); saveEdit() }}>
|
|
107
107
|
<MentionInput bind:value={editText} bind:picked={editPicked} bind:box={editBox} onSubmit={saveEdit} />
|
|
@@ -114,6 +114,13 @@ import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,unt
|
|
|
114
114
|
{:else if item.kind !== 'added'}
|
|
115
115
|
<div class="sv-frv-item-body">
|
|
116
116
|
{#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}
|
|
117
|
+
{#if item.note?.files?.length}
|
|
118
|
+
<ul class="sv-frv-files" aria-label={bm('record.commentFiles')}>
|
|
119
|
+
{#each item.note.files as f (f.id)}
|
|
120
|
+
<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>
|
|
121
|
+
{/each}
|
|
122
|
+
</ul>
|
|
123
|
+
{/if}
|
|
117
124
|
</div>
|
|
118
125
|
{#if item.note && canComment}
|
|
119
126
|
{@const note = item.note}
|
|
@@ -152,7 +159,27 @@ import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,unt
|
|
|
152
159
|
>
|
|
153
160
|
<MentionInput bind:value={comment} bind:picked bind:box={commentBox} onSubmit={send} />
|
|
154
161
|
{#if escapeHeld && editingNote == null}<p class="sv-frv-held">{bm('record.commentNotSent')}</p>{/if}
|
|
155
|
-
|
|
162
|
+
{#if commentFiles.length || uploading}
|
|
163
|
+
<ul class="sv-frv-files is-draft" aria-label={bm('record.commentFiles')}>
|
|
164
|
+
{#each commentFiles as f (f.id)}
|
|
165
|
+
<li>{f.name}<button type="button" class="sv-frv-link" aria-label={bm('record.removeFile', { name: f.name })} onclick={() => (commentFiles = commentFiles.filter((x) => x.id !== f.id))}>×</button></li>
|
|
166
|
+
{/each}
|
|
167
|
+
{#if uploading}<li class="sv-frv-none" aria-live="polite">{bm('record.uploading')}</li>{/if}
|
|
168
|
+
</ul>
|
|
169
|
+
{/if}
|
|
170
|
+
<div class="sv-frv-send">
|
|
171
|
+
{#if takesFiles}
|
|
172
|
+
<input bind:this={fileInput} type="file" multiple hidden onchange={(e) => attach(e.currentTarget.files)} />
|
|
173
|
+
<button type="button" class="sv-frv-link sv-frv-attach" onclick={() => fileInput?.click()}>
|
|
174
|
+
<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M10.5 4.5 5.4 9.6a1.3 1.3 0 0 0 1.8 1.8l5.3-5.3a2.6 2.6 0 0 0-3.7-3.7L3.5 7.7a3.9 3.9 0 0 0 5.5 5.5l4.5-4.5" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
175
|
+
{bm('record.attachFiles')}
|
|
176
|
+
</button>
|
|
177
|
+
{/if}
|
|
178
|
+
{#if takesInternal}
|
|
179
|
+
<label class="sv-frv-internal" title={bm('record.internalNoteHint')}><input type="checkbox" bind:checked={internalNote} /> {bm('record.internalNote')}</label>
|
|
180
|
+
{/if}
|
|
181
|
+
<button bind:this={sendButton} type="submit" class="sv-frv-btn" disabled={!canSend}>{bm('record.comment')}</button>
|
|
182
|
+
</div>
|
|
156
183
|
</form>
|
|
157
184
|
{/if}
|
|
158
185
|
</aside>
|
|
@@ -197,5 +224,5 @@ import{recordActionsFor}from"./record-actions";import{onDestroy,onMount,tick,unt
|
|
|
197
224
|
</SvModal>
|
|
198
225
|
|
|
199
226
|
<style>
|
|
200
|
-
.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-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-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-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}
|
|
227
|
+
.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-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-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-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}
|
|
201
228
|
</style>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FieldUser } from './sources.svelte.js';
|
|
2
|
+
import type { Attachment } from './attachments.js';
|
|
2
3
|
export type RecordComment = {
|
|
3
4
|
id: string;
|
|
4
5
|
rowId: string;
|
|
@@ -16,6 +17,13 @@ export type RecordComment = {
|
|
|
16
17
|
mentions?: string[];
|
|
17
18
|
/** When its author last changed it. */
|
|
18
19
|
editedAt?: number;
|
|
20
|
+
/** Files sent with it (a store with `files: true`), uploaded with the app's attachment uploader. */
|
|
21
|
+
files?: Attachment[];
|
|
22
|
+
/**
|
|
23
|
+
* For the team only (a store with `internal: true`): the record view marks
|
|
24
|
+
* it, and the store keeps it from people outside the team (a client portal).
|
|
25
|
+
*/
|
|
26
|
+
internal?: boolean;
|
|
19
27
|
};
|
|
20
28
|
/** Which record a comment store is asked about, beyond its row id. */
|
|
21
29
|
export type RecordCommentContext = {
|
|
@@ -48,6 +56,10 @@ export type RecordCommentStore = {
|
|
|
48
56
|
remove?: (rowId: string, commentId: string, api: unknown, context: RecordCommentContext) => void;
|
|
49
57
|
/** A comment that mentions people was added (after `add`): send the notifications here. */
|
|
50
58
|
onMention?: MentionHandler;
|
|
59
|
+
/** It keeps files sent with a comment: the comment box offers to attach them. */
|
|
60
|
+
files?: boolean;
|
|
61
|
+
/** It keeps internal notes: the comment box offers to mark one for the team only. */
|
|
62
|
+
internal?: boolean;
|
|
51
63
|
};
|
|
52
64
|
export type RecordChange = {
|
|
53
65
|
at: number;
|
|
@@ -196,7 +208,17 @@ export declare function markSeen(scope: ActivityScope, rowId: string): void;
|
|
|
196
208
|
/** Every record of a grid or table was looked at. */
|
|
197
209
|
export declare function markAllSeen(scope: ActivityScope): void;
|
|
198
210
|
export declare function commentsOf(ctrl: any, rowId: string): ReadonlyArray<RecordComment>;
|
|
199
|
-
|
|
211
|
+
/** What the app's comment store keeps besides text: files sent with a comment, internal notes. */
|
|
212
|
+
export declare function commentStoreTakes(what: 'files' | 'internal'): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Add a comment. `extra.files` (a store with `files`) go with it, and a
|
|
215
|
+
* comment of files alone has no text; `extra.internal` (a store with
|
|
216
|
+
* `internal`) keeps it for the team.
|
|
217
|
+
*/
|
|
218
|
+
export declare function addComment(ctrl: any, rowId: string, text: string, extra?: {
|
|
219
|
+
files?: Attachment[];
|
|
220
|
+
internal?: boolean;
|
|
221
|
+
}): void;
|
|
200
222
|
/** Whether this person may change or delete a comment: its author, where the store can do it. */
|
|
201
223
|
export declare function ownsComment(comment: RecordComment, what: 'update' | 'remove'): boolean;
|
|
202
224
|
/** Change a comment's text. Only its author can; someone newly named in it hears of it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{untrack}from"svelte";import{findFieldUser,getCurrentUser}from"./sources.svelte.js";import{mentionIds,parseMentions}from"./mentions.js";import{bm,bmCount}from"./messages.svelte.js";export const RECORDS_KEPT=2e4;let version=$state(0);const changes={bases:new WeakMap,grids:new WeakMap};const memory={bases:new WeakMap,grids:new WeakMap};const unseen={bases:new WeakMap,grids:new WeakMap};const ANY_BASE={};let store=null;let mentionHandler=null;let historyStore=null;const loaded={bases:new WeakMap,grids:new WeakMap};export function tableIdOf(ctrl){const id=ctrl?.props?.baseTableId;return typeof id==="string"&&id?id:void 0}function rowsOf(kept,scope,create){const named=typeof scope==="string"?{tableId:scope}:"tableId"in scope&&typeof scope.tableId==="string"?scope:null;const tableId=named?named.tableId:tableIdOf(scope);if(!tableId){let byRow2=kept.grids.get(scope);if(!byRow2&&create)kept.grids.set(scope,byRow2=new Map);return byRow2}const base=(named?named.base:scope?.props?.baseScope)??ANY_BASE;let byTable=kept.bases.get(base);if(!byTable&&create)kept.bases.set(base,byTable=new Map);let byRow=byTable?.get(tableId);if(!byRow&&byTable&&create)byTable.set(tableId,byRow=new Map);return byRow}export function setRecordComments(next){store=next;untrack(()=>version+=1)}export function setRecordHistory(next){historyStore=next;loaded.bases=new WeakMap;loaded.grids=new WeakMap;untrack(()=>version+=1)}const historyScope=scope=>{if(typeof scope==="string")return{tableId:scope};if("tableId"in scope&&typeof scope.tableId==="string")return{tableId:scope.tableId};const tableId=tableIdOf(scope);return tableId?{tableId}:scope};const historyContext=scope=>{const tableId=typeof scope==="string"?scope:"tableId"in scope&&typeof scope.tableId==="string"?scope.tableId:tableIdOf(scope);const api=typeof scope==="object"&&!("tableId"in scope)?scope?.buildApi?.():void 0;return{...tableId?{tableId}:{},...api?{api}:{}}};function keep(scope,rowId,change){if(!historyStore?.add)return;try{historyStore.add(rowId,change,historyContext(scope))}catch(err){console.error(err)}}export function loadHistory(scope,rowId){const kept=historyStore;if(!kept)return;const byRow=rowsOf(loaded,historyScope(scope),true);const was=byRow.get(rowId)?.[0];const ask=(was?.ask??0)+1;byRow.set(rowId,[{entries:was?.entries??[],loading:true,ask}]);untrack(()=>version+=1);const done=(entries,error)=>{if(historyStore!==kept||byRow.get(rowId)?.[0]?.ask!==ask)return;byRow.set(rowId,[{entries:Array.isArray(entries)?entries:[],loading:false,ask,...error?{error}:{}}]);version+=1};try{const out=kept.list(rowId,historyContext(scope));if(out&&typeof out.then==="function"){;out.then(entries=>done(entries),err=>done(was?.entries??[],err instanceof Error?err.message:String(err)))}else done(out)}catch(err){done(was?.entries??[],err instanceof Error?err.message:String(err))}}export function historyState(scope,rowId){void version;const l=rowsOf(loaded,historyScope(scope),false)?.get(rowId)?.[0];return{loading:!!l?.loading,...l?.error?{error:l.error}:{}}}const changeKey=c=>`${c.at}|${c.columnId}|${c.by??""}|${c.added?1:0}`;export function historyOf(scope,rowId){const session=changesOf(scope,rowId);const stored=rowsOf(loaded,historyScope(scope),false)?.get(rowId)?.[0]?.entries;if(!stored?.length)return session;const seen=new Set(stored.map(changeKey));return[...stored,...session.filter(c=>!seen.has(changeKey(c)))].sort((a,b)=>a.at-b.at)}export function setMentionHandler(next){mentionHandler=next}export function releaseMentionHandler(fn){if(mentionHandler===fn)mentionHandler=null}export function noteChange(scope,rowId,columnId,value,automation,via,how){const change={at:Date.now(),...automation?{automation}:{by:getCurrentUser()?.id},...via?{via}:{},columnId,value:Array.isArray(value)?[...value]:value,...how&&"from"in how?{from:copy(how.from)}:{},...how?.undone?{undone:true}:{},...how?.redone?{redone:true}:{}};const held=unstored.get(rowId);if(held)return void held.push(()=>addChange(scope,rowId,change));addChange(scope,rowId,change)}const unstored=new Map;export function holdChanges(rowId){if(!unstored.has(rowId))unstored.set(rowId,[])}export function releaseChanges(rowId,stored){const held=unstored.get(rowId);unstored.delete(rowId);if(stored&&held?.length)noteAtOnce(()=>held.forEach(note=>note()))}function addChange(scope,rowId,change){const byRow=rowsOf(changes,scope,true);const list=byRow.get(rowId)??[];list.push(change);if(list.length>50)list.splice(0,list.length-50);byRow.set(rowId,list);if(byRow.size>RECORDS_KEPT)byRow.delete(byRow.keys().next().value);if(noting)changedWhileNoting=true;else version+=1;keep(scope,rowId,change)}let noting=false;let changedWhileNoting=false;export function noteAtOnce(notes){const outer=noting;noting=true;try{return notes()}finally{noting=outer;if(!outer&&changedWhileNoting){changedWhileNoting=false;version+=1}}}export function changesOf(scope,rowId){void version;return rowsOf(changes,scope,false)?.get(rowId)??[]}export function noteRemoteChange(scope,rowId,change){const at=Date.now();const fields=change.fields??[];if(!change.added&&!fields.length)return;const byRow=rowsOf(changes,scope,true);const list=byRow.get(rowId)??[];const by=change.by?{by:change.by}:{};if(change.added)list.push({at,...by,remote:true,added:true,columnId:"",value:void 0});for(const f of fields)list.push({at,...by,remote:true,columnId:f.columnId,value:copy(f.to),from:copy(f.from)});if(list.length>50)list.splice(0,list.length-50);byRow.set(rowId,list);if(byRow.size>RECORDS_KEPT)byRow.delete(byRow.keys().next().value);const marks=rowsOf(unseen,scope,true);const was=marks.get(rowId)?.[0];const columns=new Set([...was?.columns??[],...fields.map(f=>f.columnId)]);marks.set(rowId,[{at,...by,columns,...change.added||was?.added?{added:true}:{}}]);version+=1}const copy=v=>Array.isArray(v)?[...v]:v;export function unseenOf(scope,rowId){void version;return rowsOf(unseen,scope,false)?.get(rowId)?.[0]}export function unseenIn(scope){void version;const out=new Map;for(const[id,list]of rowsOf(unseen,scope,false)??[])if(list[0])out.set(id,list[0]);return out}export function markSeen(scope,rowId){const marks=rowsOf(unseen,scope,false);if(marks?.delete(rowId))version+=1}export function markAllSeen(scope){const marks=rowsOf(unseen,scope,false);if(marks?.size){marks.clear();version+=1}}const contextOf=ctrl=>({tableId:tableIdOf(ctrl),api:ctrl?.buildApi?.()});const commentScope=ctrl=>{const tableId=tableIdOf(ctrl);return tableId?{tableId}:ctrl};export function commentsOf(ctrl,rowId){void version;if(store){const context=contextOf(ctrl);return store.list(rowId,context.api,context)}return rowsOf(memory,commentScope(ctrl),false)?.get(rowId)??[]}let seq=0;export function addComment(ctrl,rowId,text){const body=text.trim();if(!body)return;const context=contextOf(ctrl);const mentions=mentionIds(body);const comment={id:`c${Date.now().toString(36)}${seq+=1}`,rowId,...context.tableId?{tableId:context.tableId}:{},text:body,at:Date.now(),by:getCurrentUser()?.id,...mentions.length?{mentions}:{}};const kept=store;if(kept)kept.add(rowId,comment,context.api,context);else{const byRow=rowsOf(memory,commentScope(ctrl),true);byRow.set(rowId,[...byRow.get(rowId)??[],comment])}version+=1;announceMentions(ctrl,rowId,comment,mentions)}function announceMentions(ctrl,rowId,comment,mentions){const kept=store;const context=contextOf(ctrl);if(!mentions.length||!kept?.onMention&&!mentionHandler)return;const written=new Map(parseMentions(comment.text).flatMap(p=>"mention"in p?[[p.mention,p.name]]:[]));const event={comment,mentioned:mentions.map(id=>findFieldUser(id)??{id,name:written.get(id)||id}),rowId,...context.tableId?{tableId:context.tableId}:{},record:(ctrl?.allRows??[]).find(r=>r.id===rowId)?.original,api:context.api};for(const hook of[kept?.onMention,mentionHandler]){try{hook?.(event)}catch(err){console.error(err)}}}export function ownsComment(comment,what){if(store&&!store[what])return false;return comment.by===getCurrentUser()?.id}export function editComment(ctrl,rowId,id,text){const body=text.trim();const was=commentsOf(ctrl,rowId).find(c=>c.id===id);if(!body
|
|
1
|
+
import{untrack}from"svelte";import{findFieldUser,getCurrentUser}from"./sources.svelte.js";import{mentionIds,parseMentions}from"./mentions.js";import{bm,bmCount}from"./messages.svelte.js";export const RECORDS_KEPT=2e4;let version=$state(0);const changes={bases:new WeakMap,grids:new WeakMap};const memory={bases:new WeakMap,grids:new WeakMap};const unseen={bases:new WeakMap,grids:new WeakMap};const ANY_BASE={};let store=null;let mentionHandler=null;let historyStore=null;const loaded={bases:new WeakMap,grids:new WeakMap};export function tableIdOf(ctrl){const id=ctrl?.props?.baseTableId;return typeof id==="string"&&id?id:void 0}function rowsOf(kept,scope,create){const named=typeof scope==="string"?{tableId:scope}:"tableId"in scope&&typeof scope.tableId==="string"?scope:null;const tableId=named?named.tableId:tableIdOf(scope);if(!tableId){let byRow2=kept.grids.get(scope);if(!byRow2&&create)kept.grids.set(scope,byRow2=new Map);return byRow2}const base=(named?named.base:scope?.props?.baseScope)??ANY_BASE;let byTable=kept.bases.get(base);if(!byTable&&create)kept.bases.set(base,byTable=new Map);let byRow=byTable?.get(tableId);if(!byRow&&byTable&&create)byTable.set(tableId,byRow=new Map);return byRow}export function setRecordComments(next){store=next;untrack(()=>version+=1)}export function setRecordHistory(next){historyStore=next;loaded.bases=new WeakMap;loaded.grids=new WeakMap;untrack(()=>version+=1)}const historyScope=scope=>{if(typeof scope==="string")return{tableId:scope};if("tableId"in scope&&typeof scope.tableId==="string")return{tableId:scope.tableId};const tableId=tableIdOf(scope);return tableId?{tableId}:scope};const historyContext=scope=>{const tableId=typeof scope==="string"?scope:"tableId"in scope&&typeof scope.tableId==="string"?scope.tableId:tableIdOf(scope);const api=typeof scope==="object"&&!("tableId"in scope)?scope?.buildApi?.():void 0;return{...tableId?{tableId}:{},...api?{api}:{}}};function keep(scope,rowId,change){if(!historyStore?.add)return;try{historyStore.add(rowId,change,historyContext(scope))}catch(err){console.error(err)}}export function loadHistory(scope,rowId){const kept=historyStore;if(!kept)return;const byRow=rowsOf(loaded,historyScope(scope),true);const was=byRow.get(rowId)?.[0];const ask=(was?.ask??0)+1;byRow.set(rowId,[{entries:was?.entries??[],loading:true,ask}]);untrack(()=>version+=1);const done=(entries,error)=>{if(historyStore!==kept||byRow.get(rowId)?.[0]?.ask!==ask)return;byRow.set(rowId,[{entries:Array.isArray(entries)?entries:[],loading:false,ask,...error?{error}:{}}]);version+=1};try{const out=kept.list(rowId,historyContext(scope));if(out&&typeof out.then==="function"){;out.then(entries=>done(entries),err=>done(was?.entries??[],err instanceof Error?err.message:String(err)))}else done(out)}catch(err){done(was?.entries??[],err instanceof Error?err.message:String(err))}}export function historyState(scope,rowId){void version;const l=rowsOf(loaded,historyScope(scope),false)?.get(rowId)?.[0];return{loading:!!l?.loading,...l?.error?{error:l.error}:{}}}const changeKey=c=>`${c.at}|${c.columnId}|${c.by??""}|${c.added?1:0}`;export function historyOf(scope,rowId){const session=changesOf(scope,rowId);const stored=rowsOf(loaded,historyScope(scope),false)?.get(rowId)?.[0]?.entries;if(!stored?.length)return session;const seen=new Set(stored.map(changeKey));return[...stored,...session.filter(c=>!seen.has(changeKey(c)))].sort((a,b)=>a.at-b.at)}export function setMentionHandler(next){mentionHandler=next}export function releaseMentionHandler(fn){if(mentionHandler===fn)mentionHandler=null}export function noteChange(scope,rowId,columnId,value,automation,via,how){const change={at:Date.now(),...automation?{automation}:{by:getCurrentUser()?.id},...via?{via}:{},columnId,value:Array.isArray(value)?[...value]:value,...how&&"from"in how?{from:copy(how.from)}:{},...how?.undone?{undone:true}:{},...how?.redone?{redone:true}:{}};const held=unstored.get(rowId);if(held)return void held.push(()=>addChange(scope,rowId,change));addChange(scope,rowId,change)}const unstored=new Map;export function holdChanges(rowId){if(!unstored.has(rowId))unstored.set(rowId,[])}export function releaseChanges(rowId,stored){const held=unstored.get(rowId);unstored.delete(rowId);if(stored&&held?.length)noteAtOnce(()=>held.forEach(note=>note()))}function addChange(scope,rowId,change){const byRow=rowsOf(changes,scope,true);const list=byRow.get(rowId)??[];list.push(change);if(list.length>50)list.splice(0,list.length-50);byRow.set(rowId,list);if(byRow.size>RECORDS_KEPT)byRow.delete(byRow.keys().next().value);if(noting)changedWhileNoting=true;else version+=1;keep(scope,rowId,change)}let noting=false;let changedWhileNoting=false;export function noteAtOnce(notes){const outer=noting;noting=true;try{return notes()}finally{noting=outer;if(!outer&&changedWhileNoting){changedWhileNoting=false;version+=1}}}export function changesOf(scope,rowId){void version;return rowsOf(changes,scope,false)?.get(rowId)??[]}export function noteRemoteChange(scope,rowId,change){const at=Date.now();const fields=change.fields??[];if(!change.added&&!fields.length)return;const byRow=rowsOf(changes,scope,true);const list=byRow.get(rowId)??[];const by=change.by?{by:change.by}:{};if(change.added)list.push({at,...by,remote:true,added:true,columnId:"",value:void 0});for(const f of fields)list.push({at,...by,remote:true,columnId:f.columnId,value:copy(f.to),from:copy(f.from)});if(list.length>50)list.splice(0,list.length-50);byRow.set(rowId,list);if(byRow.size>RECORDS_KEPT)byRow.delete(byRow.keys().next().value);const marks=rowsOf(unseen,scope,true);const was=marks.get(rowId)?.[0];const columns=new Set([...was?.columns??[],...fields.map(f=>f.columnId)]);marks.set(rowId,[{at,...by,columns,...change.added||was?.added?{added:true}:{}}]);version+=1}const copy=v=>Array.isArray(v)?[...v]:v;export function unseenOf(scope,rowId){void version;return rowsOf(unseen,scope,false)?.get(rowId)?.[0]}export function unseenIn(scope){void version;const out=new Map;for(const[id,list]of rowsOf(unseen,scope,false)??[])if(list[0])out.set(id,list[0]);return out}export function markSeen(scope,rowId){const marks=rowsOf(unseen,scope,false);if(marks?.delete(rowId))version+=1}export function markAllSeen(scope){const marks=rowsOf(unseen,scope,false);if(marks?.size){marks.clear();version+=1}}const contextOf=ctrl=>({tableId:tableIdOf(ctrl),api:ctrl?.buildApi?.()});const commentScope=ctrl=>{const tableId=tableIdOf(ctrl);return tableId?{tableId}:ctrl};export function commentsOf(ctrl,rowId){void version;if(store){const context=contextOf(ctrl);return store.list(rowId,context.api,context)}return rowsOf(memory,commentScope(ctrl),false)?.get(rowId)??[]}let seq=0;export function commentStoreTakes(what){return!!store?.[what]}export function addComment(ctrl,rowId,text,extra={}){const body=text.trim();const files=store?.files&&extra.files?.length?extra.files:[];if(!body&&!files.length)return;const context=contextOf(ctrl);const mentions=mentionIds(body);const comment={id:`c${Date.now().toString(36)}${seq+=1}`,rowId,...context.tableId?{tableId:context.tableId}:{},text:body,at:Date.now(),by:getCurrentUser()?.id,...mentions.length?{mentions}:{},...files.length?{files}:{},...store?.internal&&extra.internal?{internal:true}:{}};const kept=store;if(kept)kept.add(rowId,comment,context.api,context);else{const byRow=rowsOf(memory,commentScope(ctrl),true);byRow.set(rowId,[...byRow.get(rowId)??[],comment])}version+=1;announceMentions(ctrl,rowId,comment,mentions)}function announceMentions(ctrl,rowId,comment,mentions){const kept=store;const context=contextOf(ctrl);if(!mentions.length||!kept?.onMention&&!mentionHandler)return;const written=new Map(parseMentions(comment.text).flatMap(p=>"mention"in p?[[p.mention,p.name]]:[]));const event={comment,mentioned:mentions.map(id=>findFieldUser(id)??{id,name:written.get(id)||id}),rowId,...context.tableId?{tableId:context.tableId}:{},record:(ctrl?.allRows??[]).find(r=>r.id===rowId)?.original,api:context.api};for(const hook of[kept?.onMention,mentionHandler]){try{hook?.(event)}catch(err){console.error(err)}}}export function ownsComment(comment,what){if(store&&!store[what])return false;return comment.by===getCurrentUser()?.id}export function editComment(ctrl,rowId,id,text){const body=text.trim();const was=commentsOf(ctrl,rowId).find(c=>c.id===id);if(!was||!body&&!was.files?.length||!ownsComment(was,"update")||body===was.text)return;const mentions=mentionIds(body);const{mentions:_old,...rest}=was;const comment={...rest,text:body,editedAt:Date.now(),...mentions.length?{mentions}:{}};const kept=store;const context=contextOf(ctrl);if(kept)kept.update(rowId,comment,context.api,context);else{const byRow=rowsOf(memory,commentScope(ctrl),true);byRow.set(rowId,(byRow.get(rowId)??[]).map(c=>c.id===id?comment:c))}version+=1;announceMentions(ctrl,rowId,comment,mentions.filter(m=>!was.mentions?.includes(m)))}export function deleteComment(ctrl,rowId,id){const was=commentsOf(ctrl,rowId).find(c=>c.id===id);if(!was||!ownsComment(was,"remove"))return;const kept=store;const context=contextOf(ctrl);if(kept)kept.remove(rowId,id,context.api,context);else{const byRow=rowsOf(memory,commentScope(ctrl),true);byRow.set(rowId,(byRow.get(rowId)??[]).filter(c=>c.id!==id))}version+=1}export function timeAgo(at,now=Date.now()){const s=Math.max(0,Math.round((now-at)/1e3));if(s<45)return bm("record.justNow");const m=Math.round(s/60);if(m<60)return bmCount("record.minutesAgo",m);const h=Math.round(m/60);if(h<24)return bmCount("record.hoursAgo",h);return new Date(at).toLocaleDateString()}
|
|
@@ -56,11 +56,17 @@ export type AutomationAction =
|
|
|
56
56
|
values: Record<string, unknown>;
|
|
57
57
|
linkField?: string;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* A notice: `{Field name}` is that field of the record. The page that made
|
|
61
|
+
* the change shows it; `to` also sends it to people's notifications (a
|
|
62
|
+
* server runner's `notify`): user ids, and `field:<column id>` for the
|
|
63
|
+
* people a person field of the record names.
|
|
64
|
+
*/
|
|
60
65
|
| {
|
|
61
66
|
type: 'notify';
|
|
62
67
|
message: string;
|
|
63
68
|
severity?: 'info' | 'success' | 'warning' | 'error';
|
|
69
|
+
to?: string[];
|
|
64
70
|
}
|
|
65
71
|
/** While the record matches the condition, color these fields (or the whole row). */
|
|
66
72
|
| {
|
package/dist/fields/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { runScript, SCRIPT_MAX_LENGTH, type ScriptBridge, type ScriptRecord, typ
|
|
|
30
30
|
export { newWebhookToken } from './automation-edit.js';
|
|
31
31
|
export { setViewActions, type ViewAction } from './view-actions.js';
|
|
32
32
|
export type { RecordTemplate } from './base-tables.js';
|
|
33
|
-
export { setRecordActions, type RecordAction, type RecordActionContext } from './record-actions.js';
|
|
33
|
+
export { setRecordActions, type RecordAction, type RecordActionContext, type RecordActionRecord } from './record-actions.js';
|
|
34
34
|
export { setRecordComments, type RecordComment, type RecordCommentContext, type RecordCommentStore } from './activity.svelte.js';
|
|
35
35
|
export { setBaseMessages, baseMessages, BASE_MESSAGES, type BaseMessages, type BaseMessageKey } from './messages.svelte.js';
|
|
36
36
|
export { setRecordHistory, historyOf, loadHistory, type RecordChange, type RecordHistoryStore, type RecordHistoryContext } from './activity.svelte.js';
|
|
@@ -111,6 +111,8 @@ export declare const EXTRAS_MESSAGES: {
|
|
|
111
111
|
readonly 'extras.severityWarning': "Warning";
|
|
112
112
|
readonly 'extras.severityError': "Error";
|
|
113
113
|
readonly 'extras.notifyHint': "Name a field in braces for its value: {fields}.";
|
|
114
|
+
readonly 'extras.notifyTo': "Also send it to the notifications of:";
|
|
115
|
+
readonly 'extras.notifyToField': "The people in {field}";
|
|
114
116
|
readonly 'extras.highlightNeedsCondition': "Colors records while they match the condition above; add one.";
|
|
115
117
|
readonly 'extras.fill': "Fill";
|
|
116
118
|
readonly 'extras.text': "Text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const EXTRAS_MESSAGES={"extras.whenCreated":"When a record is created","extras.whenCreatedWhere":"When a record is created, where {condition}","extras.whenRecordChanges":"When a record changes","extras.whenRecordChangesWhere":"When a record changes, where {condition}","extras.whenFieldsChange":"When {fields} changes","extras.whenFieldsChangeWhere":"When {fields} changes, where {condition}","extras.fieldsOr":" or ","extras.whenMatches":"When a record matches: {condition}","extras.noConditionYet":"no condition yet","extras.whenForm":"When a form is sent","extras.whenFormWhere":"When a form is sent, where {condition}","extras.whenPressed":"When {field} is pressed","extras.onSchedule":"On a schedule ({cron})","extras.onScheduleWhere":"On a schedule ({cron}), for records where {condition}","extras.actionUpdateRecord":"Update record","extras.actionCreateRecord":"Create record","extras.actionNotify":"Show a notice","extras.actionHighlight":"Color the record","extras.actionWebhook":"Call a webhook","extras.actionEmail":"Send an email","extras.stepStopped":"Stopped","extras.stepLoop":"Automations set each other off {max} times in a row; this one did not run, so they cannot loop.","extras.stepNotice":"Notice","extras.stepWebhook":"Webhook","extras.stepEmail":"Email","extras.stepNotRun":"Not run","extras.stepNoMatch":"The record does not match the condition","extras.stepDone":"Done","extras.noRecordToUpdate":"No record to update","extras.alreadySet":"Already set","extras.noTable":'No table "{table}"',"extras.noAction":'No action "{action}" is registered',"extras.aRecord":"a record","extras.createdIn":"{name} in {table}","extras.saidValue":"{field}: {value}","extras.saidChecked":"{field}: checked","extras.saidUnchecked":"{field}: unchecked","extras.saidEmpty":"empty","extras.title":"Automations in {table}","extras.listLabel":"Automations","extras.untitled":"Untitled","extras.switchOn":"{name} on","extras.noAutomations":"No automations yet. An automation does something when a record is added, changes or matches a condition.","extras.addAutomation":"+ New automation","extras.newAutomation":"New automation","extras.newRecordMessage":"New record: {{field}}","extras.nameFallback":"Name","extras.runs":"Runs","extras.clearRuns":"Clear this page's runs","extras.serverRunsFailed":"The server's runs did not load: {message}","extras.statusDone":"Done","extras.statusFailed":"Failed","extras.statusStopped":"Stopped","extras.runOn":"on {record}","extras.runIn":"in {table}","extras.serverTag":"Server","extras.noRuns":"Nothing has run yet. Runs show here with what each action did.","extras.name":"Name","extras.runsIn":"Runs in","extras.runsInBrowser":"This browser","extras.runsInServer":"The server","extras.serverHint":"Your server runs it (createAutomationServer): it hears changes from the database, whoever made them, reads secrets and sends email.","extras.browserHint":"It runs in the browser of the person who makes the change, right away.","extras.when":"When","extras.trigger":"Trigger","extras.triggerCreated":"A record is created","extras.triggerUpdated":"A record changes","extras.triggerMatches":"A record matches a condition","extras.triggerForm":"A form is sent","extras.triggerButton":"A button is pressed","extras.triggerScheduled":"At a scheduled time","extras.watchSome":"Only when one of these fields changes:","extras.watchAny":"Any field. Pick fields to watch only those:","extras.form":"Form","extras.anyForm":"Any form of this table","extras.buttonField":"Button field","extras.addButtonFirst":"Add a Button field to the table first.","extras.schedule":"Schedule","extras.customSchedule":"Custom","extras.cronExpression":"Cron expression","extras.scheduleHint":"Runs while the base is open in a browser. With a condition, it runs once for each record that matches at that time.","extras.condition":"Condition","extras.onlyWhere":"Only for records where","extras.startsToMatch":"Runs when a record starts to match","extras.addMatchCondition":"Add the condition a record has to start matching.","extras.everyRecord":"Every record. Add a condition to narrow it.","extras.do":"Do","extras.action":"Action","extras.doUpdateRecord":"Update the record","extras.doCreateRecord":"Create a record","extras.doHighlight":"Color the record while it matches","extras.moveUp":"Move up","extras.moveDown":"Move down","extras.moveStepUp":"Move step {step} up","extras.moveStepDown":"Move step {step} down","extras.removeStep":"Remove step {step}","extras.stepMoved":"Step {from} is now step {to}.","extras.removeAction":"Remove action","extras.message":"Message","extras.notifyPlaceholder":"{{field}} needs a look","extras.kind":"Kind","extras.severityInfo":"Info","extras.severitySuccess":"Success","extras.severityWarning":"Warning","extras.severityError":"Error","extras.notifyHint":"Name a field in braces for its value: {fields}.","extras.highlightNeedsCondition":"Colors records while they match the condition above; add one.","extras.fill":"Fill","extras.text":"Text","extras.sample":"Sample","extras.wholeRow":"Whole row","extras.in":"In","extras.table":"Table","extras.linkBack":"Link it back","extras.linkField":"Link field","extras.noLink":"No link","extras.through":"through {field}","extras.valueOf":"{field} value","extras.valuePlaceholder":"a value, or {Field}","extras.numberPlaceholder":"0, or 100% for a percent","extras.linkPlaceholder":"a record name, or {record}","extras.userPlaceholder":"a name","extras.doNotSet":"Do not set {field}","extras.remove":"Remove","extras.setField":"Set a field","extras.addSetField":"+ Set a field","extras.runsApp":"Runs {action}, an action the app registered.","extras.method":"Method","extras.url":"URL","extras.headers":"Headers","extras.body":"Body","extras.webhookHintServer":"Empty body: the record as JSON. {secret} is read on the server only.","extras.webhookHintBrowser":"Empty body: the record as JSON. {secret} is read on the server only; set Runs in to The server to use one.","extras.emailNeedsServer":"Email is sent by the server: set Runs in to The server.","extras.to":"To","extras.toPlaceholder":"team@example.com, {Owner email}","extras.subject":"Subject","extras.emailText":"Email text","extras.addAction":"Add an action","extras.addActionOption":"+ Add an action","extras.deleteIt":"Delete it?","extras.delete":"Delete","extras.keep":"Keep","extras.deleteAutomation":"Delete automation","extras.runsOnServer":"Runs on your server when its trigger happens.","extras.tryRecord":"Record to try it on","extras.noRecord":"No record","extras.runNow":"Run now","extras.pickAutomation":"Pick an automation, or add one.","extras.noName":"(no name)","extras.noRecordValue":"(no record)","extras.pageLabel":"Automations of the base","extras.createAutomation":"+ Create automation","extras.runHistory":"Run history","extras.pageEmpty":"No automations yet. An automation does something on its own: when a record is added or changes, a form is sent, a button is pressed or at a time you set.","extras.pickOne":"Pick an automation on the left, or create one.","extras.triggerCard":"Trigger","extras.whenIn":"{when}, in {table}","extras.conditionCard":"Only for records where","extras.conditionEvery":"Every record","extras.conditionCount.one":"{count} condition","extras.conditionCount.other":"{count} conditions","extras.addCondition":"+ Add a condition","extras.actionCard":"Action {n}","extras.insertAction":"Add an action here","extras.addActionPage":"+ Add an action","extras.flowLabel":"What {name} does","extras.summarySet":"Set {fields}","extras.summaryNothing":"No fields set yet","extras.summaryCreate":"A new record in {table}","extras.summaryEmail":"To {to}","extras.summaryNoTo":"No address yet","extras.summaryColor":"While it matches","extras.tableOfTrigger":"Table","extras.tableMoveHint":"Its trigger, condition and fields are for this table: a new table starts them again.","extras.settingsOf":"Settings","extras.testOn":"Test on","extras.test":"Test","extras.testRuns":"Its runs show in the run history.","extras.allRunsOf":"Runs of {name}","extras.allRuns":"All runs","extras.showAllRuns":"Show every automation's runs","extras.whenWebhook":"When a webhook is received","extras.triggerWebhook":"A webhook is received","extras.webhookAddress":"Webhook address","extras.webhookNoUrl":"This automation listens for the token {token}: give it to your server runner (webhookReceived).","extras.webhookHint":"Send a POST with a JSON body to this address. Its values are {webhook.name} in the steps ({webhook.order.id} inside objects). Anyone with the address can start the automation: keep it secret.","extras.newAddress":"Make a new address","extras.copy":"Copy","extras.copied":"Copied","extras.actionChat":"Send a message","extras.actionRepeat":"Find records","extras.actionIf":"If","extras.actionAi":"Ask AI","extras.actionScript":"Run a script","extras.doChat":"Send a Slack, Teams or Google Chat message","extras.doRepeat":"Find records and, for each, do","extras.doIf":"If a condition holds, do","extras.doAi":"Ask AI","extras.doScript":"Run a script","extras.stepChat":"Message","extras.stepIf":"If","extras.stepIfThen":"It matched: the Then steps ran","extras.stepIfElse":"It did not match: the Otherwise steps ran","extras.stepFound":"Find records","extras.foundIn":"{count} in {table}","extras.stepAi":"AI","extras.stepScript":"Script","extras.noAi":"No AI model is set up here.","extras.aiNoPrompt":"The prompt is empty.","extras.scriptFailed":"The script failed.","extras.noField":"No field named {field}.","extras.noRecordId":"No record {id}.","extras.stepKind":"{list}, step {n}","extras.addStep":"+ Add a step","extras.addStepTo":"Add a step to {list}","extras.chatApp":"Chat app","extras.chatUrl":"Webhook address","extras.chatHintSlack":"In Slack: Apps, Incoming Webhooks, Add to a channel; paste the address it gives here.","extras.chatHintTeams":`In Teams: the channel's Workflows, "Post to a channel when a webhook request is received"; paste the address it gives here.`,"extras.chatHintGoogle":"In Google Chat: the space's Apps and integrations, Webhooks, Add webhook; paste the address it gives here.","extras.actionText":"Send a text message","extras.doText":"Send a text message (SMS or Viber)","extras.stepText":"Text message","extras.textNeedsServer":"Text messages are sent by the server: set Runs in to The server.","extras.textBy":"Send by","extras.textSms":"SMS","extras.textViber":"Viber (SMS if not on Viber)","extras.textTo":"To","extras.textToPlaceholder":"+359 88 123 4567, {Phone}","extras.textMessage":"Message","extras.textHint":"Phone numbers with their country code, or a phone field in braces; several apart with commas. The text names fields in braces.","extras.summarySms":"SMS to {to}","extras.summaryViber":"Viber to {to}","extras.summaryNoPhone":"No phone yet","extras.ifHint":"When the record matches this condition the Then steps run, otherwise the Otherwise steps.","extras.ifAlways":"No condition: Then always runs","extras.then":"Then","extras.otherwise":"Otherwise","extras.findIn":"Find in","extras.whichRecords":"Records where","extras.atMost":"At most","extras.forEach":"For each record found","extras.repeatHint":"In these steps {Field} is the found record's field, {trigger.Field} the field of the record that set the automation off, and {found} how many were found.","extras.aiPrompt":"Prompt","extras.aiPlaceholder":"Write a two-line summary of {{field}} for a weekly report.","extras.aiInto":"Put the answer in","extras.aiNowhere":"No field (use {ai} in the next steps)","extras.aiHint":"Name fields in braces. The answer is {ai} in the next steps.","extras.scriptCode":"Script","extras.scriptNeedsBrowser":"A script runs in the browser: set Runs in to The browser.","extras.scriptHint":"JavaScript, as in Airtable: input.config() has the record's fields by name; base.getTable('Name') reads and changes a table (selectRecordsAsync, updateRecordAsync, createRecordAsync, deleteRecordAsync); output.set('name', value) is {script.name} in the next steps; fetch() calls https addresses that allow it. It runs in a sandbox for up to 30 seconds.","extras.scriptInPageHint":"It runs in the page of the person who made the change, with what they may do. A run with no one's page behind it (a schedule, a webhook, a change through the API) stops at this step and says so.","extras.summaryNoText":"Nothing written yet","extras.stepCount.one":"{count} step","extras.stepCount.other":"{count} steps","extras.summaryRepeat":"{steps} for each record in {table}","extras.summaryIf":"Then {then}; otherwise {otherwise}","extras.summaryScript":"{lines} lines"};
|
|
1
|
+
export const EXTRAS_MESSAGES={"extras.whenCreated":"When a record is created","extras.whenCreatedWhere":"When a record is created, where {condition}","extras.whenRecordChanges":"When a record changes","extras.whenRecordChangesWhere":"When a record changes, where {condition}","extras.whenFieldsChange":"When {fields} changes","extras.whenFieldsChangeWhere":"When {fields} changes, where {condition}","extras.fieldsOr":" or ","extras.whenMatches":"When a record matches: {condition}","extras.noConditionYet":"no condition yet","extras.whenForm":"When a form is sent","extras.whenFormWhere":"When a form is sent, where {condition}","extras.whenPressed":"When {field} is pressed","extras.onSchedule":"On a schedule ({cron})","extras.onScheduleWhere":"On a schedule ({cron}), for records where {condition}","extras.actionUpdateRecord":"Update record","extras.actionCreateRecord":"Create record","extras.actionNotify":"Show a notice","extras.actionHighlight":"Color the record","extras.actionWebhook":"Call a webhook","extras.actionEmail":"Send an email","extras.stepStopped":"Stopped","extras.stepLoop":"Automations set each other off {max} times in a row; this one did not run, so they cannot loop.","extras.stepNotice":"Notice","extras.stepWebhook":"Webhook","extras.stepEmail":"Email","extras.stepNotRun":"Not run","extras.stepNoMatch":"The record does not match the condition","extras.stepDone":"Done","extras.noRecordToUpdate":"No record to update","extras.alreadySet":"Already set","extras.noTable":'No table "{table}"',"extras.noAction":'No action "{action}" is registered',"extras.aRecord":"a record","extras.createdIn":"{name} in {table}","extras.saidValue":"{field}: {value}","extras.saidChecked":"{field}: checked","extras.saidUnchecked":"{field}: unchecked","extras.saidEmpty":"empty","extras.title":"Automations in {table}","extras.listLabel":"Automations","extras.untitled":"Untitled","extras.switchOn":"{name} on","extras.noAutomations":"No automations yet. An automation does something when a record is added, changes or matches a condition.","extras.addAutomation":"+ New automation","extras.newAutomation":"New automation","extras.newRecordMessage":"New record: {{field}}","extras.nameFallback":"Name","extras.runs":"Runs","extras.clearRuns":"Clear this page's runs","extras.serverRunsFailed":"The server's runs did not load: {message}","extras.statusDone":"Done","extras.statusFailed":"Failed","extras.statusStopped":"Stopped","extras.runOn":"on {record}","extras.runIn":"in {table}","extras.serverTag":"Server","extras.noRuns":"Nothing has run yet. Runs show here with what each action did.","extras.name":"Name","extras.runsIn":"Runs in","extras.runsInBrowser":"This browser","extras.runsInServer":"The server","extras.serverHint":"Your server runs it (createAutomationServer): it hears changes from the database, whoever made them, reads secrets and sends email.","extras.browserHint":"It runs in the browser of the person who makes the change, right away.","extras.when":"When","extras.trigger":"Trigger","extras.triggerCreated":"A record is created","extras.triggerUpdated":"A record changes","extras.triggerMatches":"A record matches a condition","extras.triggerForm":"A form is sent","extras.triggerButton":"A button is pressed","extras.triggerScheduled":"At a scheduled time","extras.watchSome":"Only when one of these fields changes:","extras.watchAny":"Any field. Pick fields to watch only those:","extras.form":"Form","extras.anyForm":"Any form of this table","extras.buttonField":"Button field","extras.addButtonFirst":"Add a Button field to the table first.","extras.schedule":"Schedule","extras.customSchedule":"Custom","extras.cronExpression":"Cron expression","extras.scheduleHint":"Runs while the base is open in a browser. With a condition, it runs once for each record that matches at that time.","extras.condition":"Condition","extras.onlyWhere":"Only for records where","extras.startsToMatch":"Runs when a record starts to match","extras.addMatchCondition":"Add the condition a record has to start matching.","extras.everyRecord":"Every record. Add a condition to narrow it.","extras.do":"Do","extras.action":"Action","extras.doUpdateRecord":"Update the record","extras.doCreateRecord":"Create a record","extras.doHighlight":"Color the record while it matches","extras.moveUp":"Move up","extras.moveDown":"Move down","extras.moveStepUp":"Move step {step} up","extras.moveStepDown":"Move step {step} down","extras.removeStep":"Remove step {step}","extras.stepMoved":"Step {from} is now step {to}.","extras.removeAction":"Remove action","extras.message":"Message","extras.notifyPlaceholder":"{{field}} needs a look","extras.kind":"Kind","extras.severityInfo":"Info","extras.severitySuccess":"Success","extras.severityWarning":"Warning","extras.severityError":"Error","extras.notifyHint":"Name a field in braces for its value: {fields}.","extras.notifyTo":"Also send it to the notifications of:","extras.notifyToField":"The people in {field}","extras.highlightNeedsCondition":"Colors records while they match the condition above; add one.","extras.fill":"Fill","extras.text":"Text","extras.sample":"Sample","extras.wholeRow":"Whole row","extras.in":"In","extras.table":"Table","extras.linkBack":"Link it back","extras.linkField":"Link field","extras.noLink":"No link","extras.through":"through {field}","extras.valueOf":"{field} value","extras.valuePlaceholder":"a value, or {Field}","extras.numberPlaceholder":"0, or 100% for a percent","extras.linkPlaceholder":"a record name, or {record}","extras.userPlaceholder":"a name","extras.doNotSet":"Do not set {field}","extras.remove":"Remove","extras.setField":"Set a field","extras.addSetField":"+ Set a field","extras.runsApp":"Runs {action}, an action the app registered.","extras.method":"Method","extras.url":"URL","extras.headers":"Headers","extras.body":"Body","extras.webhookHintServer":"Empty body: the record as JSON. {secret} is read on the server only.","extras.webhookHintBrowser":"Empty body: the record as JSON. {secret} is read on the server only; set Runs in to The server to use one.","extras.emailNeedsServer":"Email is sent by the server: set Runs in to The server.","extras.to":"To","extras.toPlaceholder":"team@example.com, {Owner email}","extras.subject":"Subject","extras.emailText":"Email text","extras.addAction":"Add an action","extras.addActionOption":"+ Add an action","extras.deleteIt":"Delete it?","extras.delete":"Delete","extras.keep":"Keep","extras.deleteAutomation":"Delete automation","extras.runsOnServer":"Runs on your server when its trigger happens.","extras.tryRecord":"Record to try it on","extras.noRecord":"No record","extras.runNow":"Run now","extras.pickAutomation":"Pick an automation, or add one.","extras.noName":"(no name)","extras.noRecordValue":"(no record)","extras.pageLabel":"Automations of the base","extras.createAutomation":"+ Create automation","extras.runHistory":"Run history","extras.pageEmpty":"No automations yet. An automation does something on its own: when a record is added or changes, a form is sent, a button is pressed or at a time you set.","extras.pickOne":"Pick an automation on the left, or create one.","extras.triggerCard":"Trigger","extras.whenIn":"{when}, in {table}","extras.conditionCard":"Only for records where","extras.conditionEvery":"Every record","extras.conditionCount.one":"{count} condition","extras.conditionCount.other":"{count} conditions","extras.addCondition":"+ Add a condition","extras.actionCard":"Action {n}","extras.insertAction":"Add an action here","extras.addActionPage":"+ Add an action","extras.flowLabel":"What {name} does","extras.summarySet":"Set {fields}","extras.summaryNothing":"No fields set yet","extras.summaryCreate":"A new record in {table}","extras.summaryEmail":"To {to}","extras.summaryNoTo":"No address yet","extras.summaryColor":"While it matches","extras.tableOfTrigger":"Table","extras.tableMoveHint":"Its trigger, condition and fields are for this table: a new table starts them again.","extras.settingsOf":"Settings","extras.testOn":"Test on","extras.test":"Test","extras.testRuns":"Its runs show in the run history.","extras.allRunsOf":"Runs of {name}","extras.allRuns":"All runs","extras.showAllRuns":"Show every automation's runs","extras.whenWebhook":"When a webhook is received","extras.triggerWebhook":"A webhook is received","extras.webhookAddress":"Webhook address","extras.webhookNoUrl":"This automation listens for the token {token}: give it to your server runner (webhookReceived).","extras.webhookHint":"Send a POST with a JSON body to this address. Its values are {webhook.name} in the steps ({webhook.order.id} inside objects). Anyone with the address can start the automation: keep it secret.","extras.newAddress":"Make a new address","extras.copy":"Copy","extras.copied":"Copied","extras.actionChat":"Send a message","extras.actionRepeat":"Find records","extras.actionIf":"If","extras.actionAi":"Ask AI","extras.actionScript":"Run a script","extras.doChat":"Send a Slack, Teams or Google Chat message","extras.doRepeat":"Find records and, for each, do","extras.doIf":"If a condition holds, do","extras.doAi":"Ask AI","extras.doScript":"Run a script","extras.stepChat":"Message","extras.stepIf":"If","extras.stepIfThen":"It matched: the Then steps ran","extras.stepIfElse":"It did not match: the Otherwise steps ran","extras.stepFound":"Find records","extras.foundIn":"{count} in {table}","extras.stepAi":"AI","extras.stepScript":"Script","extras.noAi":"No AI model is set up here.","extras.aiNoPrompt":"The prompt is empty.","extras.scriptFailed":"The script failed.","extras.noField":"No field named {field}.","extras.noRecordId":"No record {id}.","extras.stepKind":"{list}, step {n}","extras.addStep":"+ Add a step","extras.addStepTo":"Add a step to {list}","extras.chatApp":"Chat app","extras.chatUrl":"Webhook address","extras.chatHintSlack":"In Slack: Apps, Incoming Webhooks, Add to a channel; paste the address it gives here.","extras.chatHintTeams":`In Teams: the channel's Workflows, "Post to a channel when a webhook request is received"; paste the address it gives here.`,"extras.chatHintGoogle":"In Google Chat: the space's Apps and integrations, Webhooks, Add webhook; paste the address it gives here.","extras.actionText":"Send a text message","extras.doText":"Send a text message (SMS or Viber)","extras.stepText":"Text message","extras.textNeedsServer":"Text messages are sent by the server: set Runs in to The server.","extras.textBy":"Send by","extras.textSms":"SMS","extras.textViber":"Viber (SMS if not on Viber)","extras.textTo":"To","extras.textToPlaceholder":"+359 88 123 4567, {Phone}","extras.textMessage":"Message","extras.textHint":"Phone numbers with their country code, or a phone field in braces; several apart with commas. The text names fields in braces.","extras.summarySms":"SMS to {to}","extras.summaryViber":"Viber to {to}","extras.summaryNoPhone":"No phone yet","extras.ifHint":"When the record matches this condition the Then steps run, otherwise the Otherwise steps.","extras.ifAlways":"No condition: Then always runs","extras.then":"Then","extras.otherwise":"Otherwise","extras.findIn":"Find in","extras.whichRecords":"Records where","extras.atMost":"At most","extras.forEach":"For each record found","extras.repeatHint":"In these steps {Field} is the found record's field, {trigger.Field} the field of the record that set the automation off, and {found} how many were found.","extras.aiPrompt":"Prompt","extras.aiPlaceholder":"Write a two-line summary of {{field}} for a weekly report.","extras.aiInto":"Put the answer in","extras.aiNowhere":"No field (use {ai} in the next steps)","extras.aiHint":"Name fields in braces. The answer is {ai} in the next steps.","extras.scriptCode":"Script","extras.scriptNeedsBrowser":"A script runs in the browser: set Runs in to The browser.","extras.scriptHint":"JavaScript, as in Airtable: input.config() has the record's fields by name; base.getTable('Name') reads and changes a table (selectRecordsAsync, updateRecordAsync, createRecordAsync, deleteRecordAsync); output.set('name', value) is {script.name} in the next steps; fetch() calls https addresses that allow it. It runs in a sandbox for up to 30 seconds.","extras.scriptInPageHint":"It runs in the page of the person who made the change, with what they may do. A run with no one's page behind it (a schedule, a webhook, a change through the API) stops at this step and says so.","extras.summaryNoText":"Nothing written yet","extras.stepCount.one":"{count} step","extras.stepCount.other":"{count} steps","extras.summaryRepeat":"{steps} for each record in {table}","extras.summaryIf":"Then {then}; otherwise {otherwise}","extras.summaryScript":"{lines} lines"};
|
|
@@ -32,6 +32,12 @@ export declare const RECORD_MESSAGES: {
|
|
|
32
32
|
readonly 'record.loadingHistory': "Loading the history...";
|
|
33
33
|
readonly 'record.historyError': "The history could not be read: {error}";
|
|
34
34
|
readonly 'record.comment': "Comment";
|
|
35
|
+
readonly 'record.attachFiles': "Attach files";
|
|
36
|
+
readonly 'record.commentFiles': "Files";
|
|
37
|
+
readonly 'record.commentUploadFailed': "{name} was not uploaded: {error}";
|
|
38
|
+
readonly 'record.internalNote': "Internal note";
|
|
39
|
+
readonly 'record.internalNoteHint': "Only your team sees it, never a client.";
|
|
40
|
+
readonly 'record.internalTag': "Internal";
|
|
35
41
|
readonly 'record.editComment': "Edit";
|
|
36
42
|
readonly 'record.deleteComment': "Delete";
|
|
37
43
|
readonly 'record.deleteCommentAsk': "Delete this comment?";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const RECORD_MESSAGES={"record.untitled":"Untitled","record.record":"Record","record.protected":"protected","record.readOnly":"read-only","record.hiddenInGrid":"hidden in the grid","record.notInGridView":"This row is not in the grid's view any more.","record.showHiddenFields.one":"Show {count} hidden field","record.showHiddenFields.other":"Show {count} hidden fields","record.hideHiddenFields.one":"Hide {count} hidden field","record.hideHiddenFields.other":"Hide {count} hidden fields","record.activity":"Activity","record.someone":"Someone","record.someoneElse":"Someone else","record.you":"You","record.byAutomation":"Automation: {name}","record.acceptedBy":"{source} (accepted by {person})","record.through":"{person} via {source}","record.changedField":"changed {field}","record.undidField":"undid a change to {field}","record.redidField":"redid a change to {field}","record.addedRecord":"added this record","record.changedTo":"to","record.cleared":"(cleared)","record.noActivity":"No changes or comments yet.","record.loadingHistory":"Loading the history...","record.historyError":"The history could not be read: {error}","record.comment":"Comment","record.editComment":"Edit","record.deleteComment":"Delete","record.deleteCommentAsk":"Delete this comment?","record.commentNotSent":"This comment is not sent. Send it, or clear the box, and Esc closes the record.","record.commentNotSaved":"This change is not saved. Save or cancel it, and Esc closes the record.","record.commentHoldsStep":"This change is not saved. Save or cancel it, then move to another record.","record.fileRemoved":"{file} removed.","record.commentAddedSay":"Comment added.","record.commentKept":"Your comment was not sent. It is still in this record, ready to send.","record.commentSavedSay":"Comment saved.","record.commentDeletedSay":"Comment deleted.","record.commentEdited":"(edited)","record.saveComment":"Save","record.cancelComment":"Cancel","record.previousRecord":"Previous record","record.nextRecord":"Next record","record.position":"{index} of {total}","record.newRecord":"New record","record.linkedOf":"{table} of {owner} ({count})","record.filteredOut":"This record is filtered out of this view.","record.notInView.one":"Not in view ({count} record)","record.notInView.other":"Not in view ({count} records)","record.close":"Close","record.justNow":"just now","record.minutesAgo.one":"{count} minute ago","record.minutesAgo.other":"{count} minutes ago","record.hoursAgo.one":"{count} hour ago","record.hoursAgo.other":"{count} hours ago","record.leaveComment":"Leave a comment","record.commentPlaceholder":"Leave a comment, @ to mention","record.peopleToMention":"People to mention","record.empty":"Empty","record.emptyValue":"empty","record.fieldValue":"{label}: {value}","record.fieldValueEdit":"{label}: {value}, edit","record.formProblems.one":"{count} field needs attention","record.formProblems.other":"{count} fields need attention","record.formTitle":"New record","record.formSubmit":"Submit","record.formChoose":"Choose","record.formPickDate":"Pick a date","record.formAddFiles":"Add files","record.formLinkRecords":"Link records","record.formTypeHere":"Type here","record.formRequired":"required","record.formInvalidEmail":"Not a valid email address","record.formInvalidUrl":"Not a valid web address","record.formInvalidPhone":"Not a valid phone number","record.formFieldRequired":"{field} is required","record.formFieldInvalid":"{field} is not valid","record.formSendFailed":"The record could not be sent. Try again.","record.formEmpty":"Fill in at least one field before you send this.","record.formThanks":"Thank you","record.formAdded":"The record was added.","record.formSubmitAnother":"Submit another","record.formNext":"Next","record.formBack":"Back","record.formStepOf":"Question {n} of {count}","record.formPressEnter":"or press Enter","record.unnamed":"Untitled","record.linkedGone":"This record is not in its table any more.","record.openIn":"Open in {table}","record.linkTo":"Link to {table}","record.linkToRecords":"Link to records","record.linkTableMissing":"The table this field links to is not available.","record.searchTable":"Search {table}","record.pickingFromView":'Records of the view "{view}"',"record.noRecordsMatch":"No records match.","record.createRecord":"Create “{name}”","record.showingOf":"Showing {shown} of {total}. Type to narrow.","record.linkedCount":"{count} linked","record.cancel":"Cancel","record.done":"Done","record.attachments":"Attachments","record.fileBadge":"FILE","record.uploadFailed":"Upload failed","record.uploadsFailed.one":"Upload failed","record.uploadsFailed.other":"{count} uploads failed","record.noUrlFound":"No http(s) URL found","record.noFilesYet":"No files yet. Drop files here, paste them, or use Add files.","record.files":"Files","record.fileTile":"{file}. Enter to preview, Delete to remove, Alt+Arrow to move.","record.removeFile":"Remove {name}","record.uploadingFile":"Uploading {name}","record.cancelUpload":"Cancel {name}","record.retry":"Retry","record.remove":"Remove","record.addFiles":"Add files","record.takePhoto":"Take a photo","record.scanCode":"Scan a code","record.scanHint":"Point the camera at a barcode or a QR code.","record.scanUnsupported":"This browser cannot read codes from the camera.","record.scanNoCamera":"The camera is not available: allow it for this site, or close another app using it.","record.pasteUrl":"or paste a URL","record.addByUrl":"Add a file by URL","record.uploadingCount":"Uploading {count}...","record.download":"Download","record.previous":"Previous","record.next":"Next","record.previousFile":"Previous file","record.nextFile":"Next file","record.filePosition":"{index} of {total}","record.noAttachments":"No attachments","record.attachmentList.one":"{count} attachment: {names}","record.attachmentList.other":"{count} attachments: {names}","record.notAdded":"Not added","record.uploading":"Uploading","record.keyMove":"move","record.keySave":"save","record.keyCancel":"cancel","record.checklist":"Checklist","record.checklistDone":"{done} of {total} done","record.noItemsYet":"No items yet","record.noItems":"No items","record.items":"Items","record.item":"item","record.itemNumber":"Item {n}","record.itemDone":"Done: {item}","record.moveItem":"Move {item}","record.deleteItem":"Delete {item}","record.addItem":"Add an item","record.color":"Color","record.hexCode":"Hex code","record.clear":"Clear","record.notAColor":"Not a color: use #rrggbb, #rgb, rgb() or a color name","record.colors":"Colors","record.notATime":"Not a time (9:30 am, 14:05, 2pm)","record.notADate":"Not a date (12/24/2026, 2026-12-24, Dec 24, 2026)","record.dateLabel":"Date","record.dateAndTimeLabel":"Date and time","record.calendarTab":"Date","record.timeTab":"Time","record.openCalendar":"Open the calendar","record.timeOfDay":"Time of day","record.longText":"Long text","record.markupHint":"**bold** *italic* `code` [link](https://...) - list","record.richText":"Rich text","record.removeValue":"Remove {name}","record.findPerson":"Find a person","record.findOption":"Find an option","record.addPerson":"Add a person","record.choosePerson":"Choose a person","record.addOption":"Add an option","record.chooseOption":"Choose an option","record.addNewOption":"Add option","record.everyoneChosen":"Everyone is chosen","record.nobodyMatches":"Nobody matches","record.noPeople":"No people (setFieldUsers)","record.everyOptionChosen":"Every option is chosen","record.noOptionMatches":"No option matches","record.noOptions":"No options","record.notADuration":"Not a duration (1:30, 1h 30m)","record.notANumber":"Not a number","record.noNegative":"Negative numbers are not allowed","record.durationLabel":"Duration ({format})","record.amountIn":"Amount in {symbol}","record.money":"money","record.percent":"Percent","record.number":"Number","record.increaseBy":"Increase by {step}","record.decreaseBy":"Decrease by {step}","record.ratingLabel":"Rating, {value} of {max}","record.aiNeedsPrompt":"Write a prompt for this field first (Edit field).","record.aiGenerating":"Generating...","record.aiWaiting":"Waiting...","record.aiGenerate":"Generate","record.aiGenerateAgain":"Generate again","record.aiNoProvider":"No AI provider","record.aiNoPrompt":"No prompt","record.voted":"{names} voted","record.noVotes":"No votes yet","record.votes.one":"{count} vote","record.votes.other":"{count} votes","record.timerStart":"Start the timer","record.timerStop":"Stop the timer","record.votesMine.one":"{count} vote, including yours","record.votesMine.other":"{count} votes, including yours","record.buttonOpen":"Open","record.nobody":"Nobody"};
|
|
1
|
+
export const RECORD_MESSAGES={"record.untitled":"Untitled","record.record":"Record","record.protected":"protected","record.readOnly":"read-only","record.hiddenInGrid":"hidden in the grid","record.notInGridView":"This row is not in the grid's view any more.","record.showHiddenFields.one":"Show {count} hidden field","record.showHiddenFields.other":"Show {count} hidden fields","record.hideHiddenFields.one":"Hide {count} hidden field","record.hideHiddenFields.other":"Hide {count} hidden fields","record.activity":"Activity","record.someone":"Someone","record.someoneElse":"Someone else","record.you":"You","record.byAutomation":"Automation: {name}","record.acceptedBy":"{source} (accepted by {person})","record.through":"{person} via {source}","record.changedField":"changed {field}","record.undidField":"undid a change to {field}","record.redidField":"redid a change to {field}","record.addedRecord":"added this record","record.changedTo":"to","record.cleared":"(cleared)","record.noActivity":"No changes or comments yet.","record.loadingHistory":"Loading the history...","record.historyError":"The history could not be read: {error}","record.comment":"Comment","record.attachFiles":"Attach files","record.commentFiles":"Files","record.commentUploadFailed":"{name} was not uploaded: {error}","record.internalNote":"Internal note","record.internalNoteHint":"Only your team sees it, never a client.","record.internalTag":"Internal","record.editComment":"Edit","record.deleteComment":"Delete","record.deleteCommentAsk":"Delete this comment?","record.commentNotSent":"This comment is not sent. Send it, or clear the box, and Esc closes the record.","record.commentNotSaved":"This change is not saved. Save or cancel it, and Esc closes the record.","record.commentHoldsStep":"This change is not saved. Save or cancel it, then move to another record.","record.fileRemoved":"{file} removed.","record.commentAddedSay":"Comment added.","record.commentKept":"Your comment was not sent. It is still in this record, ready to send.","record.commentSavedSay":"Comment saved.","record.commentDeletedSay":"Comment deleted.","record.commentEdited":"(edited)","record.saveComment":"Save","record.cancelComment":"Cancel","record.previousRecord":"Previous record","record.nextRecord":"Next record","record.position":"{index} of {total}","record.newRecord":"New record","record.linkedOf":"{table} of {owner} ({count})","record.filteredOut":"This record is filtered out of this view.","record.notInView.one":"Not in view ({count} record)","record.notInView.other":"Not in view ({count} records)","record.close":"Close","record.justNow":"just now","record.minutesAgo.one":"{count} minute ago","record.minutesAgo.other":"{count} minutes ago","record.hoursAgo.one":"{count} hour ago","record.hoursAgo.other":"{count} hours ago","record.leaveComment":"Leave a comment","record.commentPlaceholder":"Leave a comment, @ to mention","record.peopleToMention":"People to mention","record.empty":"Empty","record.emptyValue":"empty","record.fieldValue":"{label}: {value}","record.fieldValueEdit":"{label}: {value}, edit","record.formProblems.one":"{count} field needs attention","record.formProblems.other":"{count} fields need attention","record.formTitle":"New record","record.formSubmit":"Submit","record.formChoose":"Choose","record.formPickDate":"Pick a date","record.formAddFiles":"Add files","record.formLinkRecords":"Link records","record.formTypeHere":"Type here","record.formRequired":"required","record.formInvalidEmail":"Not a valid email address","record.formInvalidUrl":"Not a valid web address","record.formInvalidPhone":"Not a valid phone number","record.formFieldRequired":"{field} is required","record.formFieldInvalid":"{field} is not valid","record.formSendFailed":"The record could not be sent. Try again.","record.formEmpty":"Fill in at least one field before you send this.","record.formThanks":"Thank you","record.formAdded":"The record was added.","record.formSubmitAnother":"Submit another","record.formNext":"Next","record.formBack":"Back","record.formStepOf":"Question {n} of {count}","record.formPressEnter":"or press Enter","record.unnamed":"Untitled","record.linkedGone":"This record is not in its table any more.","record.openIn":"Open in {table}","record.linkTo":"Link to {table}","record.linkToRecords":"Link to records","record.linkTableMissing":"The table this field links to is not available.","record.searchTable":"Search {table}","record.pickingFromView":'Records of the view "{view}"',"record.noRecordsMatch":"No records match.","record.createRecord":"Create “{name}”","record.showingOf":"Showing {shown} of {total}. Type to narrow.","record.linkedCount":"{count} linked","record.cancel":"Cancel","record.done":"Done","record.attachments":"Attachments","record.fileBadge":"FILE","record.uploadFailed":"Upload failed","record.uploadsFailed.one":"Upload failed","record.uploadsFailed.other":"{count} uploads failed","record.noUrlFound":"No http(s) URL found","record.noFilesYet":"No files yet. Drop files here, paste them, or use Add files.","record.files":"Files","record.fileTile":"{file}. Enter to preview, Delete to remove, Alt+Arrow to move.","record.removeFile":"Remove {name}","record.uploadingFile":"Uploading {name}","record.cancelUpload":"Cancel {name}","record.retry":"Retry","record.remove":"Remove","record.addFiles":"Add files","record.takePhoto":"Take a photo","record.scanCode":"Scan a code","record.scanHint":"Point the camera at a barcode or a QR code.","record.scanUnsupported":"This browser cannot read codes from the camera.","record.scanNoCamera":"The camera is not available: allow it for this site, or close another app using it.","record.pasteUrl":"or paste a URL","record.addByUrl":"Add a file by URL","record.uploadingCount":"Uploading {count}...","record.download":"Download","record.previous":"Previous","record.next":"Next","record.previousFile":"Previous file","record.nextFile":"Next file","record.filePosition":"{index} of {total}","record.noAttachments":"No attachments","record.attachmentList.one":"{count} attachment: {names}","record.attachmentList.other":"{count} attachments: {names}","record.notAdded":"Not added","record.uploading":"Uploading","record.keyMove":"move","record.keySave":"save","record.keyCancel":"cancel","record.checklist":"Checklist","record.checklistDone":"{done} of {total} done","record.noItemsYet":"No items yet","record.noItems":"No items","record.items":"Items","record.item":"item","record.itemNumber":"Item {n}","record.itemDone":"Done: {item}","record.moveItem":"Move {item}","record.deleteItem":"Delete {item}","record.addItem":"Add an item","record.color":"Color","record.hexCode":"Hex code","record.clear":"Clear","record.notAColor":"Not a color: use #rrggbb, #rgb, rgb() or a color name","record.colors":"Colors","record.notATime":"Not a time (9:30 am, 14:05, 2pm)","record.notADate":"Not a date (12/24/2026, 2026-12-24, Dec 24, 2026)","record.dateLabel":"Date","record.dateAndTimeLabel":"Date and time","record.calendarTab":"Date","record.timeTab":"Time","record.openCalendar":"Open the calendar","record.timeOfDay":"Time of day","record.longText":"Long text","record.markupHint":"**bold** *italic* `code` [link](https://...) - list","record.richText":"Rich text","record.removeValue":"Remove {name}","record.findPerson":"Find a person","record.findOption":"Find an option","record.addPerson":"Add a person","record.choosePerson":"Choose a person","record.addOption":"Add an option","record.chooseOption":"Choose an option","record.addNewOption":"Add option","record.everyoneChosen":"Everyone is chosen","record.nobodyMatches":"Nobody matches","record.noPeople":"No people (setFieldUsers)","record.everyOptionChosen":"Every option is chosen","record.noOptionMatches":"No option matches","record.noOptions":"No options","record.notADuration":"Not a duration (1:30, 1h 30m)","record.notANumber":"Not a number","record.noNegative":"Negative numbers are not allowed","record.durationLabel":"Duration ({format})","record.amountIn":"Amount in {symbol}","record.money":"money","record.percent":"Percent","record.number":"Number","record.increaseBy":"Increase by {step}","record.decreaseBy":"Decrease by {step}","record.ratingLabel":"Rating, {value} of {max}","record.aiNeedsPrompt":"Write a prompt for this field first (Edit field).","record.aiGenerating":"Generating...","record.aiWaiting":"Waiting...","record.aiGenerate":"Generate","record.aiGenerateAgain":"Generate again","record.aiNoProvider":"No AI provider","record.aiNoPrompt":"No prompt","record.voted":"{names} voted","record.noVotes":"No votes yet","record.votes.one":"{count} vote","record.votes.other":"{count} votes","record.timerStart":"Start the timer","record.timerStop":"Stop the timer","record.votesMine.one":"{count} vote, including yours","record.votesMine.other":"{count} votes, including yours","record.buttonOpen":"Open","record.nobody":"Nobody"};
|
|
@@ -260,6 +260,8 @@ export declare const BASE_MESSAGES: {
|
|
|
260
260
|
readonly 'extras.severityWarning': "Warning";
|
|
261
261
|
readonly 'extras.severityError': "Error";
|
|
262
262
|
readonly 'extras.notifyHint': "Name a field in braces for its value: {fields}.";
|
|
263
|
+
readonly 'extras.notifyTo': "Also send it to the notifications of:";
|
|
264
|
+
readonly 'extras.notifyToField': "The people in {field}";
|
|
263
265
|
readonly 'extras.highlightNeedsCondition': "Colors records while they match the condition above; add one.";
|
|
264
266
|
readonly 'extras.fill': "Fill";
|
|
265
267
|
readonly 'extras.text': "Text";
|
|
@@ -729,6 +731,12 @@ export declare const BASE_MESSAGES: {
|
|
|
729
731
|
readonly 'record.loadingHistory': "Loading the history...";
|
|
730
732
|
readonly 'record.historyError': "The history could not be read: {error}";
|
|
731
733
|
readonly 'record.comment': "Comment";
|
|
734
|
+
readonly 'record.attachFiles': "Attach files";
|
|
735
|
+
readonly 'record.commentFiles': "Files";
|
|
736
|
+
readonly 'record.commentUploadFailed': "{name} was not uploaded: {error}";
|
|
737
|
+
readonly 'record.internalNote': "Internal note";
|
|
738
|
+
readonly 'record.internalNoteHint': "Only your team sees it, never a client.";
|
|
739
|
+
readonly 'record.internalTag': "Internal";
|
|
732
740
|
readonly 'record.editComment': "Edit";
|
|
733
741
|
readonly 'record.deleteComment': "Delete";
|
|
734
742
|
readonly 'record.deleteCommentAsk': "Delete this comment?";
|