@svgrid/enterprise 3.1.34 → 3.1.36
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/ExpressionEditorHarness.svelte +1 -1
- package/dist/SvAdvancedFilter.svelte +1 -1
- package/dist/SvAlertRuleEditor.svelte +1 -1
- package/dist/SvAlertsManager.svelte +1 -1
- package/dist/SvAlertsPanel.svelte +1 -1
- package/dist/SvExpressionEditor.svelte +1 -1
- package/dist/SvGridBoard.svelte +1 -1
- package/dist/SvGridBulkEditDrawer.svelte +1 -1
- package/dist/SvGridEditPanel.svelte +1 -1
- package/dist/SvGridGallery.svelte +1 -1
- package/dist/SvGridMasterDetail.svelte +1 -1
- package/dist/SvGridScheduler.svelte +1 -1
- package/dist/SvGridSelectionBar.svelte +1 -1
- package/dist/SvPivotDesigner.svelte +1 -1
- package/dist/SvSchemaChart.svelte +1 -1
- package/dist/SvSchemaDashboard.svelte +1 -1
- package/dist/SvSheet.svelte +1 -1
- package/dist/SvSheetChartSetup.svelte +1 -1
- package/dist/SvSheetConditionalFormat.svelte +1 -1
- package/dist/SvSheetDataValidation.svelte +1 -1
- package/dist/SvSheetEditRanges.svelte +1 -1
- package/dist/SvSheetErrors.svelte +1 -1
- package/dist/SvSheetEvaluate.svelte +1 -1
- package/dist/SvSheetFindReplace.svelte +1 -1
- package/dist/SvSheetFormatCells.svelte +1 -1
- package/dist/SvSheetGoalSeek.svelte +1 -1
- package/dist/SvSheetInsertFunction.svelte +1 -1
- package/dist/SvSheetIteration.svelte +1 -1
- package/dist/SvSheetLink.svelte +1 -1
- package/dist/SvSheetManageRules.svelte +1 -1
- package/dist/SvSheetNameManager.svelte +1 -1
- package/dist/SvSheetPageSetup.svelte +1 -1
- package/dist/SvSheetPasteSpecial.svelte +1 -1
- package/dist/SvSheetPivot.svelte +1 -1
- package/dist/SvSheetProtectSheet.svelte +1 -1
- package/dist/SvSheetRemoveDuplicates.svelte +1 -1
- package/dist/SvSheetRibbon.svelte +1 -1
- package/dist/SvSheetSizeDialog.svelte +1 -1
- package/dist/SvSheetSort.svelte +1 -1
- package/dist/SvSheetSparklines.svelte +1 -1
- package/dist/SvSheetTable.svelte +1 -1
- package/dist/SvSheetTabs.svelte +1 -1
- package/dist/SvSheetTextToColumns.svelte +1 -1
- package/dist/SvSheetValidationAlert.svelte +1 -1
- package/dist/cdn/svgrid-enterprise.svelte-external.js +2 -2
- package/dist/designer/assets/{index-v61ZvIWw.js → index-CsdyIRos.js} +3 -3
- package/dist/designer/assets/{src-DkFgWld_.js → src-CSmsOfsG.js} +15 -15
- package/dist/designer/index.html +2 -2
- package/dist/fields/AiCell.svelte +41 -0
- package/dist/fields/AiCell.svelte.d.ts +5 -0
- package/dist/fields/AttachmentCell.svelte +1 -1
- package/dist/fields/AttachmentDialog.svelte +1 -1
- package/dist/fields/AttachmentEditor.svelte +1 -1
- package/dist/fields/AttachmentPreview.svelte +1 -1
- package/dist/fields/BaseAutomations.svelte +1 -1
- package/dist/fields/BaseChartView.svelte +1 -1
- package/dist/fields/BaseDashboardView.svelte +133 -0
- package/dist/fields/BaseDashboardView.svelte.d.ts +17 -0
- package/dist/fields/BaseImport.svelte +89 -0
- package/dist/fields/BaseImport.svelte.d.ts +15 -0
- package/dist/fields/BaseInboxView.svelte +112 -0
- package/dist/fields/BaseInboxView.svelte.d.ts +8 -0
- package/dist/fields/BaseListView.svelte +90 -0
- package/dist/fields/BaseListView.svelte.d.ts +8 -0
- package/dist/fields/BaseSearch.svelte +78 -0
- package/dist/fields/BaseSearch.svelte.d.ts +10 -0
- package/dist/fields/BaseTableView.svelte +28 -3
- package/dist/fields/BaseTableView.svelte.d.ts +5 -1
- package/dist/fields/BaseTabs.svelte +45 -8
- package/dist/fields/BaseTabs.svelte.d.ts +25 -1
- package/dist/fields/BaseTrash.svelte +63 -0
- package/dist/fields/BaseTrash.svelte.d.ts +15 -0
- package/dist/fields/CheckboxCell.svelte +1 -1
- package/dist/fields/ChecklistCell.svelte +22 -0
- package/dist/fields/ChecklistCell.svelte.d.ts +10 -0
- package/dist/fields/ChecklistEditor.svelte +81 -0
- package/dist/fields/ChecklistEditor.svelte.d.ts +12 -0
- package/dist/fields/ColorCell.svelte +13 -0
- package/dist/fields/ColorCell.svelte.d.ts +8 -0
- package/dist/fields/ColorEditor.svelte +60 -0
- package/dist/fields/ColorEditor.svelte.d.ts +11 -0
- package/dist/fields/DashboardRecords.svelte +35 -0
- package/dist/fields/DashboardRecords.svelte.d.ts +11 -0
- package/dist/fields/DashboardTileEditor.svelte +138 -0
- package/dist/fields/DashboardTileEditor.svelte.d.ts +15 -0
- package/dist/fields/DeleteFieldConfirm.svelte +1 -1
- package/dist/fields/DeleteRecordConfirm.svelte +1 -1
- package/dist/fields/FieldEditor.svelte +32 -3
- package/dist/fields/FieldInput.svelte +1 -1
- package/dist/fields/FieldsHeaderEnd.svelte +1 -1
- package/dist/fields/FootRowAdder.svelte +1 -1
- package/dist/fields/GroupHeader.svelte +3 -3
- package/dist/fields/LinkPickerEditor.svelte +1 -1
- package/dist/fields/LinkPreview.svelte +1 -1
- package/dist/fields/LinkedRecordView.svelte +1 -1
- package/dist/fields/LinkedRecordsCell.svelte +1 -1
- package/dist/fields/ListChips.svelte +21 -0
- package/dist/fields/ListChips.svelte.d.ts +9 -0
- package/dist/fields/LongTextEditor.svelte +1 -1
- package/dist/fields/MentionInput.svelte +59 -0
- package/dist/fields/MentionInput.svelte.d.ts +11 -0
- package/dist/fields/NumberEditor.svelte +1 -1
- package/dist/fields/OptionsEditor.svelte +1 -1
- package/dist/fields/PercentCell.svelte +1 -1
- package/dist/fields/PropertyInput.svelte +13 -10
- package/dist/fields/RatingCell.svelte +1 -1
- package/dist/fields/RatingEditor.svelte +1 -1
- package/dist/fields/RecordView.svelte +20 -25
- package/dist/fields/RowHeader.svelte +1 -1
- package/dist/fields/SelectCell.svelte +1 -1
- package/dist/fields/SelectEditor.svelte +1 -1
- package/dist/fields/SummaryCell.svelte +1 -1
- package/dist/fields/SvBase.svelte +48 -9
- package/dist/fields/SvBase.svelte.d.ts +33 -1
- package/dist/fields/SvBaseForm.svelte +2 -2
- package/dist/fields/SvBaseForm.svelte.d.ts +14 -0
- package/dist/fields/SvBaseViewBar.svelte +33 -12
- package/dist/fields/SvBaseViewBar.svelte.d.ts +2 -0
- package/dist/fields/TimeOfDayEditor.svelte +39 -0
- package/dist/fields/TimeOfDayEditor.svelte.d.ts +12 -0
- package/dist/fields/UserCell.svelte +1 -1
- package/dist/fields/activity.svelte.d.ts +29 -0
- package/dist/fields/activity.svelte.js +1 -1
- package/dist/fields/ai-field.svelte.d.ts +91 -0
- package/dist/fields/ai-field.svelte.js +1 -0
- package/dist/fields/ai-prompt.d.ts +64 -0
- package/dist/fields/ai-prompt.js +7 -0
- package/dist/fields/airtable.d.ts +90 -0
- package/dist/fields/airtable.js +1 -0
- package/dist/fields/bar-request.svelte.d.ts +1 -1
- package/dist/fields/base-history.d.ts +56 -0
- package/dist/fields/base-history.js +1 -0
- package/dist/fields/base-import.d.ts +54 -0
- package/dist/fields/base-import.js +2 -0
- package/dist/fields/base-search.d.ts +34 -0
- package/dist/fields/base-search.js +1 -0
- package/dist/fields/base-share.d.ts +45 -0
- package/dist/fields/base-share.js +1 -0
- package/dist/fields/base-sql.js +3 -3
- package/dist/fields/base-trash.d.ts +51 -0
- package/dist/fields/base-trash.js +1 -0
- package/dist/fields/builtin-types.js +1 -1
- package/dist/fields/chart-view.d.ts +12 -0
- package/dist/fields/chart-view.js +1 -1
- package/dist/fields/checklist.d.ts +36 -0
- package/dist/fields/checklist.js +4 -0
- package/dist/fields/color-value.d.ts +14 -0
- package/dist/fields/color-value.js +1 -0
- package/dist/fields/convert.js +1 -1
- package/dist/fields/copy-text.d.ts +1 -1
- package/dist/fields/copy-text.js +1 -1
- package/dist/fields/dashboard.d.ts +143 -0
- package/dist/fields/dashboard.js +1 -0
- package/dist/fields/field-access.svelte.d.ts +37 -0
- package/dist/fields/field-access.svelte.js +1 -0
- package/dist/fields/field-ops.js +1 -1
- package/dist/fields/filter-model.d.ts +4 -11
- package/dist/fields/filter-model.js +1 -1
- package/dist/fields/form-logic.d.ts +69 -0
- package/dist/fields/form-logic.js +1 -0
- package/dist/fields/formula.js +1 -1
- package/dist/fields/grid-access.d.ts +8 -0
- package/dist/fields/grid-access.js +1 -1
- package/dist/fields/index.d.ts +16 -0
- package/dist/fields/index.js +1 -1
- package/dist/fields/list-view.d.ts +40 -0
- package/dist/fields/list-view.js +1 -0
- package/dist/fields/mentions.d.ts +50 -0
- package/dist/fields/mentions.js +1 -0
- package/dist/fields/palette.d.ts +4 -2
- package/dist/fields/palette.js +1 -1
- package/dist/fields/record-menu.js +1 -1
- package/dist/fields/registry.svelte.d.ts +5 -0
- package/dist/fields/registry.svelte.js +1 -1
- package/dist/fields/time-of-day.d.ts +28 -0
- package/dist/fields/time-of-day.js +1 -0
- package/dist/fields/view-model.d.ts +24 -2
- package/dist/fields/view-model.js +1 -1
- package/dist/fields/viewbar/ChartPanel.svelte +1 -1
- package/dist/fields/viewbar/ColorPanel.svelte +1 -1
- package/dist/fields/viewbar/ConditionValue.svelte +4 -4
- package/dist/fields/viewbar/FilterPanel.svelte +1 -1
- package/dist/fields/viewbar/GanttPanel.svelte +1 -1
- package/dist/fields/viewbar/HideFieldsPanel.svelte +1 -1
- package/dist/fields/viewbar/ListPanel.svelte +36 -0
- package/dist/fields/viewbar/ListPanel.svelte.d.ts +11 -0
- package/dist/fields/viewbar/SortPanel.svelte +1 -1
- package/dist/fields/viewbar/ViewsMenu.svelte +27 -4
- package/dist/fields/viewbar/ViewsMenu.svelte.d.ts +6 -0
- package/dist/gantt/SvGridGantt.svelte +1 -1
- package/dist/node/studio.js +1 -1
- package/dist/review/RichCellMark.svelte +1 -1
- package/dist/review/SvReviewPanel.svelte +1 -1
- package/dist/server/SvGroupCell.svelte +1 -1
- package/dist/server/SvRowGroupPanel.svelte +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/dist/wc/GridFind-DsTvdUXq.js +1 -0
- package/dist/wc/GridFooter-D-i8boBh.js +1 -0
- package/dist/wc/GridMenus-CYe9Fw2I.js +20 -0
- package/dist/wc/PinSplitter-LvyyrLhe.js +6 -0
- package/dist/wc/SvChartMenu-XKW_LOYw.js +1 -0
- package/dist/wc/SvDateRangeInput-CSOxqTB1.js +1 -0
- package/dist/wc/SvDateTimePicker-DvvFs2T9.js +4 -0
- package/dist/wc/SvField-BmQphyOs.js +20 -0
- package/dist/wc/SvForm-HD7y5vmk.js +46 -0
- package/dist/wc/SvGridCellEditor-776KAOe1.js +3 -0
- package/dist/wc/SvGridChart-DC7ZUhp8.js +171 -0
- package/dist/wc/SvGridChartBuilder-Dd3vWBvq.js +7 -0
- package/dist/wc/SvGridChartPanel-CwYjF46U.js +5 -0
- package/dist/wc/SvGridChartView-CSF38rBs.js +3 -0
- package/dist/wc/SvGridDropdown-4S1G7gsP.js +30 -0
- package/dist/wc/SvMenuList-D3ZLXjL_.js +1 -0
- package/dist/wc/SvModal-Dk0YwPWp.js +7 -0
- package/dist/wc/SvSwitchButton-DdZmc3ew.js +1 -0
- package/dist/wc/SvTabs-BI2cQHyw.js +2 -0
- package/dist/wc/base-react.d.ts +38 -0
- package/dist/wc/base-react.js +1 -0
- package/dist/wc/base-vue.d.ts +29 -0
- package/dist/wc/base-vue.js +1 -0
- package/dist/wc/board-RQp5fHPR.js +21 -0
- package/dist/wc/board-view.svelte-CpxuZcEg.js +1 -0
- package/dist/wc/card-marks.svelte-QwxIcKcZ.js +1 -0
- package/dist/wc/client-DNdLmGcu.js +3 -0
- package/dist/wc/createOverlay.svelte-CDw3RXgs.js +1 -0
- package/dist/wc/custom-filter-Dp8JxlQu.js +2 -0
- package/dist/wc/date-format-DtSmFyEB.js +18 -0
- package/dist/wc/editor-registry-CkKfcVLc.js +1 -0
- package/dist/wc/export-format-CGfE9_O5.js +5 -0
- package/dist/wc/gallery-CNOHNWEJ.js +4 -0
- package/dist/wc/gallery-view.svelte-27X-wCQH.js +1 -0
- package/dist/wc/grid-extension.svelte-hgqOteka.js +1 -0
- package/dist/wc/import-B9mIERCl.js +4 -0
- package/dist/wc/js-scroller.svelte-BP8Up6_q.js +1 -0
- package/dist/wc/license-CWVWqb-i.js +27 -0
- package/dist/wc/list-option-CI4nMshZ.js +1 -0
- package/dist/wc/react.d.ts +1 -0
- package/dist/wc/react.js +1 -1
- package/dist/wc/scheduler-CkVY4od-.js +147 -0
- package/dist/wc/scheduler-view.svelte-SzG7rU8b.js +1 -0
- package/dist/wc/sparkline-DWRBQubt.js +1 -0
- package/dist/wc/sv-base-element.d.ts +87 -0
- package/dist/wc/sv-base-element.js +273 -0
- package/dist/wc/sv-sheet-element.d.ts +2 -0
- package/dist/wc/sv-sheet-element.js +55 -55
- package/dist/wc/svelte-virtualizer.svelte-CSBwEZt9.js +1 -0
- package/dist/wc/types/sv-base-element.d.ts +87 -0
- package/dist/wc/vue.d.ts +1 -0
- package/dist/wc/vue.js +1 -1
- package/package.json +19 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{attachmentsFromText,limitAttachments,rejectReason,toAttachments,uploadAttachment}from"./attachments";let{value,title="Attachments",props,row,columnId,onDone,onCancel}=$props();let items=$state(toAttachments(value));let pending=$state([]);let rejected=$state([]);let urlText=$state("");let previewIndex=$state(null);let dragFrom=$state(null);let dropping=$state(false);let fileInput=$state(null);let open=$state(true);let finished=false;const busy=$derived(pending.some(p=>!p.error));function addFiles(files){rejected=[];for(const file of files){const why=rejectReason(file,props,items.length+pending.length);if(why){rejected=[...rejected,`${file.name}: ${why}`];continue}start({key:`${file.name}-${file.size}-${Math.random()}`,file,progress:0,error:null,ctl:new AbortController})}}function start(p){pending=[...pending.filter(x=>x.key!==p.key),p];const set=patch=>pending=pending.map(x=>x.key===p.key?{...x,...patch}:x);uploadAttachment(p.file,props,{row,columnId,signal:p.ctl.signal,onProgress:f=>set({progress:Math.max(0,Math.min(1,f))})}).then(att=>{if(p.ctl.signal.aborted)return;items=[...items,att];pending=pending.filter(x=>x.key!==p.key)},err=>{if(p.ctl.signal.aborted)return;set({error:err instanceof Error?err.message:"Upload failed"})})}function retry(p){start({...p,progress:0,error:null,ctl:new AbortController})}function drop(p){p.ctl.abort();pending=pending.filter(x=>x.key!==p.key)}function onPick(e){const input=e.currentTarget;if(input.files)addFiles(input.files);input.value=""}function addUrls(){const found=attachmentsFromText(urlText);if(!found.length){rejected=["No http(s) URL found"];return}const{kept,rejected:refused}=limitAttachments(found,props,items.length+pending.length);items=[...items,...kept];urlText="";rejected=refused}function remove(i){items=items.filter((_,j)=>j!==i)}function move(from,to){if(to<0||to>=items.length||from===to)return;const next=items.slice();const[it]=next.splice(from,1);next.splice(to,0,it);items=next}function onTileKey(e,i){if(e.altKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")){e.preventDefault();const to=i+(e.key==="ArrowRight"?1:-1);move(i,to);queueMicrotask(()=>document.querySelectorAll(".sv-attd-tile")[to]?.focus())}else if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault();remove(i)}else if(e.key==="Enter"||e.key===" "){e.preventDefault();previewIndex=i}}function onPaste(e){const files=[...e.clipboardData?.files??[]];if(files.length){e.preventDefault();addFiles(files);return}const text=e.clipboardData?.getData("text")??"";if(!e.target.closest("input")&&attachmentsFromText(text).length){e.preventDefault();urlText=text;addUrls()}}function done(){if(busy)return;finished=true;open=false;onDone(items)}function cancel(){if(finished)return;finished=true;for(const p of pending)p.ctl.abort();open=false;onCancel()}const ext=a=>(a.name.split(".").pop()??"").slice(0,4).toUpperCase()||"FILE";
|
|
2
|
+
import{SvModal}from"@svgrid/grid";import AttachmentPreview from"./AttachmentPreview.svelte";import{attachmentsFromText,formatBytes,isImage,limitAttachments,rejectReason,safeUrl,toAttachments,uploadAttachment}from"./attachments";let{value,title="Attachments",props,row,columnId,onDone,onCancel}=$props();let items=$state(toAttachments(value));let pending=$state([]);let rejected=$state([]);let urlText=$state("");let previewIndex=$state(null);let dragFrom=$state(null);let dropping=$state(false);let fileInput=$state(null);let open=$state(true);let finished=false;const busy=$derived(pending.some(p=>!p.error));function addFiles(files){rejected=[];for(const file of files){const why=rejectReason(file,props,items.length+pending.length);if(why){rejected=[...rejected,`${file.name}: ${why}`];continue}start({key:`${file.name}-${file.size}-${Math.random()}`,file,progress:0,error:null,ctl:new AbortController})}}function start(p){pending=[...pending.filter(x=>x.key!==p.key),p];const set=patch=>pending=pending.map(x=>x.key===p.key?{...x,...patch}:x);uploadAttachment(p.file,props,{row,columnId,signal:p.ctl.signal,onProgress:f=>set({progress:Math.max(0,Math.min(1,f))})}).then(att=>{if(p.ctl.signal.aborted)return;items=[...items,att];pending=pending.filter(x=>x.key!==p.key)},err=>{if(p.ctl.signal.aborted)return;set({error:err instanceof Error?err.message:"Upload failed"})})}function retry(p){start({...p,progress:0,error:null,ctl:new AbortController})}function drop(p){p.ctl.abort();pending=pending.filter(x=>x.key!==p.key)}function onPick(e){const input=e.currentTarget;if(input.files)addFiles(input.files);input.value=""}function addUrls(){const found=attachmentsFromText(urlText);if(!found.length){rejected=["No http(s) URL found"];return}const{kept,rejected:refused}=limitAttachments(found,props,items.length+pending.length);items=[...items,...kept];urlText="";rejected=refused}function remove(i){items=items.filter((_,j)=>j!==i)}function move(from,to){if(to<0||to>=items.length||from===to)return;const next=items.slice();const[it]=next.splice(from,1);next.splice(to,0,it);items=next}function onTileKey(e,i){if(e.altKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")){e.preventDefault();const to=i+(e.key==="ArrowRight"?1:-1);move(i,to);queueMicrotask(()=>document.querySelectorAll(".sv-attd-tile")[to]?.focus())}else if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault();remove(i)}else if(e.key==="Enter"||e.key===" "){e.preventDefault();previewIndex=i}}function onPaste(e){const files=[...e.clipboardData?.files??[]];if(files.length){e.preventDefault();addFiles(files);return}const text=e.clipboardData?.getData("text")??"";if(!e.target.closest("input")&&attachmentsFromText(text).length){e.preventDefault();urlText=text;addUrls()}}function done(){if(busy)return;finished=true;open=false;onDone(items)}function cancel(){if(finished)return;finished=true;for(const p of pending)p.ctl.abort();open=false;onCancel()}const ext=a=>(a.name.split(".").pop()??"").slice(0,4).toUpperCase()||"FILE";
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<SvModal bind:open {title} width={680} onClose={cancel}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{fieldPropsOf}from"./registry.svelte";let{value,columnDef,columnId,row,onCommit,onCancel}=$props();const props=$derived(fieldPropsOf(columnDef??{}));const title=$derived(typeof columnDef?.header==="string"?columnDef.header:"Attachments");
|
|
2
|
+
import AttachmentDialog from"./AttachmentDialog.svelte";import{fieldPropsOf}from"./registry.svelte";let{value,columnDef,columnId,row,onCommit,onCancel}=$props();const props=$derived(fieldPropsOf(columnDef??{}));const title=$derived(typeof columnDef?.header==="string"?columnDef.header:"Attachments");
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<span class="sv-att-editing" aria-hidden="true"></span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{isImage,safeUrl}from"./attachments";let{items,index=$bindable()}=$props();let open=$state(true);const item=$derived(index==null?null:items[index]??null);const src=$derived(item?safeUrl(item.url,isImage(item)):null);function step(d){if(index==null||items.length<2)return;index=(index+d+items.length)%items.length}function close(){open=false;index=null}
|
|
2
|
+
import{SvModal}from"@svgrid/grid";import{formatBytes,isImage,isPdf,safeUrl}from"./attachments";let{items,index=$bindable()}=$props();let open=$state(true);const item=$derived(index==null?null:items[index]??null);const src=$derived(item?safeUrl(item.url,isImage(item)):null);function step(d){if(index==null||items.length<2)return;index=(index+d+items.length)%items.length}function close(){open=false;index=null}
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<SvModal bind:open title={item ? `${item.name}${item.size ? ` (${formatBytes(item.size)})` : ''}` : ''} width={900} onClose={close}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{CRON_PRESETS}from"../scheduling";import{primaryOf,rowIdOf}from"./base-tables";import{getFieldUsers}from"./sources.svelte";import{listAutomationActions,tableFields}from"./automations.svelte";let{open=$bindable(false),table,tables,ctrl,views=[],runner,serverRuns,onChange}=$props();let list=$state($state.snapshot(table.automations??[]));let selectedId=$state(list[0]?.id??null);let tab=$state("edit");const selected=$derived(list.find(a=>a.id===selectedId)??null);const fields=$derived([...tableFields(table).values()]);const fieldsOf=t=>t?[...tableFields(t).values()]:[];const COMPUTED=new Set(["formula","lookup","rollup","count","button","autoNumber","createdTime","lastModifiedTime","createdBy","lastModifiedBy"]);const writable=t=>fieldsOf(t).filter(c=>!COMPUTED.has(String(c.fieldType??"")));const forms=$derived(views.filter(v=>v.type==="form"));const buttons=$derived(fields.filter(c=>c.fieldType==="button"));const appActions=listAutomationActions();function save(next){list=next;onChange($state.snapshot(next))}function patch(change){if(!selected)return;save(list.map(a=>a.id===selected.id?{...a,...change}:a))}function add(){const primary=fields.find(c=>c.id===primaryOf(table))??fields[0];const a={id:`auto-${Date.now().toString(36)}`,name:"New automation",enabled:true,trigger:{type:"recordCreated"},actions:[{type:"notify",message:`New record: {${primary?.header??"Name"}}`}]};save([...list,a]);selectedId=a.id;tab="edit"}let deleting=$state(null);function remove(id){const next=list.filter(a=>a.id!==id);save(next);selectedId=next[0]?.id??null}const TRIGGERS=[{value:"recordCreated",label:"A record is created"},{value:"recordUpdated",label:"A record changes"},{value:"recordMatches",label:"A record matches a condition"},{value:"formSubmitted",label:"A form is sent"},{value:"button",label:"A button is pressed"},{value:"scheduled",label:"At a scheduled time"}];function setTrigger(type){const trigger=type==="recordUpdated"?{type,fields:[]}:type==="formSubmitted"?{type}:type==="button"?{type,field:buttons[0]?.id??""}:type==="scheduled"?{type,cron:CRON_PRESETS[3].cron}:{type};patch({trigger})}function toggleWatched(id){if(selected?.trigger.type!=="recordUpdated")return;const now=new Set(selected.trigger.fields??[]);if(now.has(id))now.delete(id);else now.add(id);patch({trigger:{type:"recordUpdated",fields:[...now]}})}const EMPTY={kind:"fieldFilter",conjunction:"and",conditions:[]};function setCondition(f){patch({condition:f.conditions.length?f:void 0})}const ACTIONS=[{value:"updateRecord",label:"Update the record"},{value:"createRecord",label:"Create a record"},{value:"notify",label:"Show a notice"},{value:"highlight",label:"Color the record while it matches"},{value:"webhook",label:"Call a webhook"},{value:"email",label:"Send an email"},...appActions.map(a=>({value:`run:${a.id}`,label:a.label}))];function newAction(value){if(value.startsWith("run:"))return{type:"run",action:value.slice(4)};switch(value){case"updateRecord":return{type:"updateRecord",values:{}};case"createRecord":return{type:"createRecord",table:table.id,values:{}};case"highlight":return{type:"highlight",background:"#fee2e2",color:"#991b1b"};case"webhook":return{type:"webhook",url:"https://",body:""};case"email":return{type:"email",to:"",subject:"",body:""};default:return{type:"notify",message:"",severity:"info"}}}const actionKey=a=>a.type==="run"?`run:${a.action}`:a.type;function setAction(i,next){if(!selected)return;const actions=[...selected.actions];if(next)actions[i]=next;else actions.splice(i,1);patch({actions})}function moveAction(i,dir){if(!selected)return;const actions=[...selected.actions];const j=i+dir;if(j<0||j>=actions.length)return;[actions[i],actions[j]]=[actions[j],actions[i]];patch({actions})}function setValue(i,values,id,value){const a=selected?.actions[i];if(!a||a.type!=="updateRecord"&&a.type!=="createRecord")return;setAction(i,{...a,values:{...values,[id]:value}})}function dropValue(i,id){const a=selected?.actions[i];if(!a||a.type!=="updateRecord"&&a.type!=="createRecord")return;const{[id]:_gone,...values}=a.values;setAction(i,{...a,values})}function suggestions(t,c){const tokens=fields.map(f=>`{${f.header}}`);switch(c.fieldType){case"singleSelect":case"multiSelect":return(c.def.fieldProps?.options??[]).map(o=>o.value);case"user":return getFieldUsers().map(u=>u.name);case"checkbox":return["true","false"];case"date":return["today","today+1","today+7","today-1","now"];case"link":{const target=tables.find(x=>x.id===c.def.fieldProps?.table);const names=target?target.data.slice(0,50).map(r=>String(r?.[primaryOf(target)]??"")).filter(Boolean):[];return[...target?.id===table.id||c.def.fieldProps?.table===table.id?["{record}"]:[],...names]}default:return t?tokens:[]}}const PLACEHOLDER={date:"today+7",checkbox:"true",number:"0, or 100% for a percent",link:"a record name, or {record}",user:"a name"};let tryRecord=$state("");const records=$derived(table.data.filter(Boolean).slice(0,200).map(r=>({id:rowIdOf(table,r),name:String(r[primaryOf(table)]??"")||"(no name)"})));function tryNow(){if(!selected)return;void runner.runNow($state.snapshot(selected),table.id,tryRecord||null);tab="runs"}let fromServer=$state.raw([]);let serverError=$state("");function showRuns(){tab="runs";if(!serverRuns)return;serverRuns().then(r=>{fromServer=r;serverError=""},e=>serverError=e instanceof Error?e.message:String(e))}const allRuns=$derived([...runner.runs.map(r=>({...r,side:"browser"})),...fromServer.map(r=>({...r,side:"server"}))].sort((x,y)=>y.at-x.at));function parseHeaders(text){const out={};for(const line of text.split("\n")){const at=line.indexOf(":");if(at>0)out[line.slice(0,at).trim()]=line.slice(at+1).trim()}return out}const headerText=h=>Object.entries(h??{}).map(([k,v])=>`${k}: ${v}`).join("\n");const time=at=>new Date(at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});
|
|
2
|
+
import{SvModal,SvSwitchButton}from"@svgrid/grid";import FilterPanel from"./viewbar/FilterPanel.svelte";import{CRON_PRESETS}from"../scheduling";import{primaryOf,rowIdOf}from"./base-tables";import{getFieldUsers}from"./sources.svelte";import{actionLabel,listAutomationActions,tableFields,triggerText}from"./automations.svelte";let{open=$bindable(false),table,tables,ctrl,views=[],runner,serverRuns,onChange}=$props();let list=$state($state.snapshot(table.automations??[]));let selectedId=$state(list[0]?.id??null);let tab=$state("edit");const selected=$derived(list.find(a=>a.id===selectedId)??null);const fields=$derived([...tableFields(table).values()]);const fieldsOf=t=>t?[...tableFields(t).values()]:[];const COMPUTED=new Set(["formula","lookup","rollup","count","button","autoNumber","createdTime","lastModifiedTime","createdBy","lastModifiedBy"]);const writable=t=>fieldsOf(t).filter(c=>!COMPUTED.has(String(c.fieldType??"")));const forms=$derived(views.filter(v=>v.type==="form"));const buttons=$derived(fields.filter(c=>c.fieldType==="button"));const appActions=listAutomationActions();function save(next){list=next;onChange($state.snapshot(next))}function patch(change){if(!selected)return;save(list.map(a=>a.id===selected.id?{...a,...change}:a))}function add(){const primary=fields.find(c=>c.id===primaryOf(table))??fields[0];const a={id:`auto-${Date.now().toString(36)}`,name:"New automation",enabled:true,trigger:{type:"recordCreated"},actions:[{type:"notify",message:`New record: {${primary?.header??"Name"}}`}]};save([...list,a]);selectedId=a.id;tab="edit"}let deleting=$state(null);function remove(id){const next=list.filter(a=>a.id!==id);save(next);selectedId=next[0]?.id??null}const TRIGGERS=[{value:"recordCreated",label:"A record is created"},{value:"recordUpdated",label:"A record changes"},{value:"recordMatches",label:"A record matches a condition"},{value:"formSubmitted",label:"A form is sent"},{value:"button",label:"A button is pressed"},{value:"scheduled",label:"At a scheduled time"}];function setTrigger(type){const trigger=type==="recordUpdated"?{type,fields:[]}:type==="formSubmitted"?{type}:type==="button"?{type,field:buttons[0]?.id??""}:type==="scheduled"?{type,cron:CRON_PRESETS[3].cron}:{type};patch({trigger})}function toggleWatched(id){if(selected?.trigger.type!=="recordUpdated")return;const now=new Set(selected.trigger.fields??[]);if(now.has(id))now.delete(id);else now.add(id);patch({trigger:{type:"recordUpdated",fields:[...now]}})}const EMPTY={kind:"fieldFilter",conjunction:"and",conditions:[]};function setCondition(f){patch({condition:f.conditions.length?f:void 0})}const ACTIONS=[{value:"updateRecord",label:"Update the record"},{value:"createRecord",label:"Create a record"},{value:"notify",label:"Show a notice"},{value:"highlight",label:"Color the record while it matches"},{value:"webhook",label:"Call a webhook"},{value:"email",label:"Send an email"},...appActions.map(a=>({value:`run:${a.id}`,label:a.label}))];function newAction(value){if(value.startsWith("run:"))return{type:"run",action:value.slice(4)};switch(value){case"updateRecord":return{type:"updateRecord",values:{}};case"createRecord":return{type:"createRecord",table:table.id,values:{}};case"highlight":return{type:"highlight",background:"#fee2e2",color:"#991b1b"};case"webhook":return{type:"webhook",url:"https://",body:""};case"email":return{type:"email",to:"",subject:"",body:""};default:return{type:"notify",message:"",severity:"info"}}}const actionKey=a=>a.type==="run"?`run:${a.action}`:a.type;function setAction(i,next){if(!selected)return;const actions=[...selected.actions];if(next)actions[i]=next;else actions.splice(i,1);patch({actions})}function moveAction(i,dir){if(!selected)return;const actions=[...selected.actions];const j=i+dir;if(j<0||j>=actions.length)return;[actions[i],actions[j]]=[actions[j],actions[i]];patch({actions})}function setValue(i,values,id,value){const a=selected?.actions[i];if(!a||a.type!=="updateRecord"&&a.type!=="createRecord")return;setAction(i,{...a,values:{...values,[id]:value}})}function dropValue(i,id){const a=selected?.actions[i];if(!a||a.type!=="updateRecord"&&a.type!=="createRecord")return;const{[id]:_gone,...values}=a.values;setAction(i,{...a,values})}function suggestions(t,c){const tokens=fields.map(f=>`{${f.header}}`);switch(c.fieldType){case"singleSelect":case"multiSelect":return(c.def.fieldProps?.options??[]).map(o=>o.value);case"user":return getFieldUsers().map(u=>u.name);case"checkbox":return["true","false"];case"date":return["today","today+1","today+7","today-1","now"];case"link":{const target=tables.find(x=>x.id===c.def.fieldProps?.table);const names=target?target.data.slice(0,50).map(r=>String(r?.[primaryOf(target)]??"")).filter(Boolean):[];return[...target?.id===table.id||c.def.fieldProps?.table===table.id?["{record}"]:[],...names]}default:return t?tokens:[]}}const PLACEHOLDER={date:"today+7",checkbox:"true",number:"0, or 100% for a percent",link:"a record name, or {record}",user:"a name"};let tryRecord=$state("");const records=$derived(table.data.filter(Boolean).slice(0,200).map(r=>({id:rowIdOf(table,r),name:String(r[primaryOf(table)]??"")||"(no name)"})));function tryNow(){if(!selected)return;void runner.runNow($state.snapshot(selected),table.id,tryRecord||null);tab="runs"}let fromServer=$state.raw([]);let serverError=$state("");function showRuns(){tab="runs";if(!serverRuns)return;serverRuns().then(r=>{fromServer=r;serverError=""},e=>serverError=e instanceof Error?e.message:String(e))}const allRuns=$derived([...runner.runs.map(r=>({...r,side:"browser"})),...fromServer.map(r=>({...r,side:"server"}))].sort((x,y)=>y.at-x.at));function parseHeaders(text){const out={};for(const line of text.split("\n")){const at=line.indexOf(":");if(at>0)out[line.slice(0,at).trim()]=line.slice(at+1).trim()}return out}const headerText=h=>Object.entries(h??{}).map(([k,v])=>`${k}: ${v}`).join("\n");const time=at=>new Date(at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<SvModal bind:open title={`Automations in ${table.name}`} width={1000} resizable>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import{dataRows,gridOf}from"./grid-access";import{chartFormatter,chartSpec}from"./chart-view";let{api,setting}=$props();const ctrl=$derived(api?gridOf(api):null);const rows=$derived(ctrl?dataRows(ctrl).map(r=>r.original):[]);const formatValue=$derived(ctrl&&setting?chartFormatter(ctrl,setting):void 0);const spec=$derived.by(()=>{const s=ctrl&&setting?chartSpec(ctrl,setting,rows):null;
|
|
2
|
+
import{SvChart}from"@svgrid/grid";import{dataRows,gridOf}from"./grid-access";import{chartFormatter,chartSpec,withValueGutter}from"./chart-view";let{api,setting}=$props();const ctrl=$derived(api?gridOf(api):null);const rows=$derived(ctrl?dataRows(ctrl).map(r=>r.original):[]);const formatValue=$derived(ctrl&&setting?chartFormatter(ctrl,setting):void 0);const spec=$derived.by(()=>{const s=ctrl&&setting?chartSpec(ctrl,setting,rows):null;return s?withValueGutter(s,formatValue):s});const isPie=$derived(setting?.kind==="pie"||setting?.kind==="donut");
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<div class="sv-fchart">
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import{SvChart}from"@svgrid/grid";import DashboardTileEditor from"./DashboardTileEditor.svelte";import DashboardRecords from"./DashboardRecords.svelte";import{TILE_SIZES,moveTile,newTile,putTile,removeTile,tileRecords,tileResult,tileSize,tileTitle}from"./dashboard";let{tiles=[],tables,home,locked=false,onChange,onOpen}=$props();let editing=$state(false);let editor=$state(null);let editorOpen=$state(false);let dragFrom=$state(null);let dropAt=$state(null);let drilled=$state(null);let drillOpen=$state(false);const canEdit=$derived(!locked&&!!onChange);const shown=$derived(tiles.map(tile=>({tile,title:tileTitle(tile,tables,home),result:tileResult(tile,tables,home),size:tileSize(tile)})));const plural=(n,one,many)=>`${n.toLocaleString()} ${n===1?one:many}`;const percent=r=>`${Math.round(r*100)}%`;const counted=r=>r.kind==="number"?r.records:r.kind==="progress"?r.part:0;function drill(tile,title,category){const records=tileRecords(tile,tables,home,category);if(!records)return;drilled={title:category!=null?`${title}: ${category}`:title,records};drillOpen=true}const save=next=>onChange?.(next);function edit(tile,isNew=false){editor={tile,isNew};editorOpen=true}const add=()=>edit(newTile("number",tables.find(t=>t.id===home)??tables[0],home),true);const resize=(tile,size)=>save(putTile(tiles,{...tile,size}));const onResize=tile=>e=>resize(tile,e.currentTarget.value);function dragStart(e,i){dragFrom=i;e.dataTransfer?.setData("text/plain",String(i));if(e.dataTransfer)e.dataTransfer.effectAllowed="move"}function dragOver(e,i){if(dragFrom==null)return;e.preventDefault();if(e.dataTransfer)e.dataTransfer.dropEffect="move";dropAt=i}function drop(e,i){e.preventDefault();if(dragFrom!=null&&dragFrom!==i)save(moveTile(tiles,dragFrom,i));dragEnd()}function dragEnd(){dragFrom=null;dropAt=null}
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{#snippet glyph(path: string, size = 14)}
|
|
6
|
+
<svg viewBox="0 0 24 24" width={size} height={size} aria-hidden="true"><path d={path} fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
7
|
+
{/snippet}
|
|
8
|
+
|
|
9
|
+
<div class="sv-fdash" class:is-editing={editing}>
|
|
10
|
+
{#if canEdit}
|
|
11
|
+
<div class="sv-fdash-head">
|
|
12
|
+
{#if editing}
|
|
13
|
+
<button type="button" class="sv-fdash-btn" onclick={add}>{@render glyph('M12 5v14M5 12h14')}<span>Add tile</span></button>
|
|
14
|
+
<span class="sv-fdash-hint">Drag a tile to move it.</span>
|
|
15
|
+
{/if}
|
|
16
|
+
<button type="button" class="sv-fdash-btn" class:is-on={editing} aria-pressed={editing} onclick={() => (editing = !editing)}>
|
|
17
|
+
{#if editing}Done{:else}{@render glyph('M4 20h4L19 9l-4-4L4 16z')}<span>Edit dashboard</span>{/if}
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
22
|
+
{#if !shown.length}
|
|
23
|
+
<div class="sv-fdash-none">
|
|
24
|
+
<p>This dashboard has no tiles yet.</p>
|
|
25
|
+
{#if canEdit}
|
|
26
|
+
<button type="button" class="sv-fdash-btn" onclick={() => {
|
|
27
|
+
editing = true
|
|
28
|
+
add()
|
|
29
|
+
}}>{@render glyph('M12 5v14M5 12h14')}<span>Add a tile</span></button>
|
|
30
|
+
{/if}
|
|
31
|
+
</div>
|
|
32
|
+
{:else}
|
|
33
|
+
<ul class="sv-fdash-tiles" role="list" aria-label="Dashboard tiles">
|
|
34
|
+
{#each shown as s, i (s.tile.id)}
|
|
35
|
+
{@const r = s.result}
|
|
36
|
+
<li
|
|
37
|
+
class="sv-fdash-tile is-{s.size} is-{s.tile.kind}"
|
|
38
|
+
class:is-drop={dropAt === i && dragFrom !== i}
|
|
39
|
+
class:is-dragged={dragFrom === i}
|
|
40
|
+
draggable={editing}
|
|
41
|
+
ondragstart={(e) => dragStart(e, i)}
|
|
42
|
+
ondragover={(e) => dragOver(e, i)}
|
|
43
|
+
ondrop={(e) => drop(e, i)}
|
|
44
|
+
ondragend={dragEnd}
|
|
45
|
+
aria-label={s.title}
|
|
46
|
+
>
|
|
47
|
+
<div class="sv-fdash-tile-head">
|
|
48
|
+
<h3 class="sv-fdash-title" title={s.title}>{s.title}</h3>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="sv-fdash-body">
|
|
51
|
+
{#if r.kind === 'missing'}
|
|
52
|
+
<p class="sv-fdash-empty">{r.message}</p>
|
|
53
|
+
{:else if r.kind === 'number'}
|
|
54
|
+
<p class="sv-fdash-number" class:is-blank={r.value == null}>{r.text}</p>
|
|
55
|
+
{#if s.tile.caption}
|
|
56
|
+
<p class="sv-fdash-meta">{s.tile.caption}</p>
|
|
57
|
+
{:else if r.records === 0}
|
|
58
|
+
<p class="sv-fdash-meta">No records match.</p>
|
|
59
|
+
{:else if (s.tile.aggregation ?? 'count') !== 'count'}
|
|
60
|
+
<p class="sv-fdash-meta">{plural(r.records, 'record', 'records')}</p>
|
|
61
|
+
{/if}
|
|
62
|
+
{:else if r.kind === 'progress'}
|
|
63
|
+
<p class="sv-fdash-number">{percent(r.percent)}</p>
|
|
64
|
+
<div class="sv-fdash-bar" role="progressbar" aria-valuemin={0} aria-valuemax={r.whole} aria-valuenow={r.part} aria-label={s.title}>
|
|
65
|
+
<span style:width={percent(r.percent)}></span>
|
|
66
|
+
</div>
|
|
67
|
+
<p class="sv-fdash-meta">{r.whole ? `${r.part.toLocaleString()} of ${plural(r.whole, 'record', 'records')}` : 'No records yet.'}</p>
|
|
68
|
+
{:else if r.kind === 'chart'}
|
|
69
|
+
{#if r.spec && r.spec.categories.length && r.records}
|
|
70
|
+
{@const pie = s.tile.chart?.kind === 'pie' || s.tile.chart?.kind === 'donut'}
|
|
71
|
+
<div class="sv-fdash-chart">
|
|
72
|
+
<SvChart spec={r.spec} formatValue={r.formatValue} autosize legend={pie} dataLabels={pie} onSelect={editing ? undefined : (sel) => drill(s.tile, s.title, sel.category)} />
|
|
73
|
+
</div>
|
|
74
|
+
{:else}
|
|
75
|
+
<p class="sv-fdash-empty">No records to chart.</p>
|
|
76
|
+
{/if}
|
|
77
|
+
{:else if r.kind === 'list'}
|
|
78
|
+
{#if r.items.length}
|
|
79
|
+
<ol class="sv-fdash-list">
|
|
80
|
+
{#each r.items as item (item.id)}
|
|
81
|
+
<li>
|
|
82
|
+
<button type="button" class="sv-fdash-item" disabled={!onOpen || editing} onclick={() => onOpen?.(s.tile.table || home, item.id)}>
|
|
83
|
+
<span class="sv-fdash-item-name">{item.title}</span>
|
|
84
|
+
{#if item.detail}<span class="sv-fdash-item-detail">{item.detail}</span>{/if}
|
|
85
|
+
</button>
|
|
86
|
+
</li>
|
|
87
|
+
{/each}
|
|
88
|
+
</ol>
|
|
89
|
+
{#if r.records > r.items.length}<p class="sv-fdash-meta">{r.items.length} of {plural(r.records, 'record', 'records')}</p>{/if}
|
|
90
|
+
{:else}
|
|
91
|
+
<p class="sv-fdash-empty">No records match.</p>
|
|
92
|
+
{/if}
|
|
93
|
+
{/if}
|
|
94
|
+
</div>
|
|
95
|
+
{#if !editing && counted(r) > 0}
|
|
96
|
+
{@const label = `Open the ${plural(counted(r), 'record', 'records')}`}
|
|
97
|
+
|
|
98
|
+
<button type="button" class="sv-fdash-hit" aria-label={label} title={label} onclick={() => drill(s.tile, s.title)}></button>
|
|
99
|
+
{/if}
|
|
100
|
+
{#if editing}
|
|
101
|
+
<div class="sv-fdash-tools">
|
|
102
|
+
<span class="sv-fdash-grip" aria-hidden="true">{@render glyph('M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', 16)}</span>
|
|
103
|
+
<select class="sv-fdash-size" aria-label={`Size of ${s.title}`} value={s.size} onchange={onResize(s.tile)}>
|
|
104
|
+
{#each TILE_SIZES as z (z.size)}<option value={z.size}>{z.label}</option>{/each}
|
|
105
|
+
</select>
|
|
106
|
+
<span class="sv-fdash-gap"></span>
|
|
107
|
+
<button type="button" class="sv-fdash-icon" aria-label={`Move ${s.title} earlier`} title="Move earlier" disabled={i === 0} onclick={() => save(moveTile(tiles, i, i - 1))}>{@render glyph('M15 6l-6 6 6 6')}</button>
|
|
108
|
+
<button type="button" class="sv-fdash-icon" aria-label={`Move ${s.title} later`} title="Move later" disabled={i === shown.length - 1} onclick={() => save(moveTile(tiles, i, i + 1))}>{@render glyph('M9 6l6 6-6 6')}</button>
|
|
109
|
+
<button type="button" class="sv-fdash-icon" aria-label={`Edit ${s.title}`} title="Edit tile" onclick={() => edit(s.tile)}>{@render glyph('M4 20h4L19 9l-4-4L4 16z')}</button>
|
|
110
|
+
<button type="button" class="sv-fdash-icon" aria-label={`Remove ${s.title}`} title="Remove tile" onclick={() => save(removeTile(tiles, s.tile.id))}>{@render glyph('M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13')}</button>
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
113
|
+
</li>
|
|
114
|
+
{/each}
|
|
115
|
+
</ul>
|
|
116
|
+
{/if}
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{#if drilled}
|
|
120
|
+
{#key drilled}
|
|
121
|
+
<DashboardRecords bind:open={drillOpen} title={drilled.title} records={drilled.records} {onOpen} />
|
|
122
|
+
{/key}
|
|
123
|
+
{/if}
|
|
124
|
+
|
|
125
|
+
{#if editor}
|
|
126
|
+
{#key editor}
|
|
127
|
+
<DashboardTileEditor bind:open={editorOpen} tile={editor.tile} isNew={editor.isNew} {tables} {home} onSave={(t) => save(putTile(tiles, t))} />
|
|
128
|
+
{/key}
|
|
129
|
+
{/if}
|
|
130
|
+
|
|
131
|
+
<style>
|
|
132
|
+
.sv-fdash{position:absolute;inset:0;overflow:auto;box-sizing:border-box;padding:12px 16px 20px;background:color-mix(in srgb,var(--sg-fg, #0f172a) 3%,var(--sg-bg, #fff));color:var(--sg-fg, #0f172a);font-family:var(--sg-font, inherit);font-size:13px;container-type:inline-size}.sv-fdash-head{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-bottom:10px}.sv-fdash-hint{margin-inline-end:auto;color:var(--sg-muted, #64748b);font-size:12px}.sv-fdash-btn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;font:inherit;cursor:pointer;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:var(--sg-bg, #fff);color:inherit}.sv-fdash-btn:hover{background:var(--sg-row-hover-bg, #f1f5f9)}.sv-fdash-btn.is-on{font-weight:600}.sv-fdash-none{display:grid;justify-items:center;gap:10px;margin:64px auto;color:var(--sg-muted, #64748b)}.sv-fdash-none p{margin:0}.sv-fdash-tiles{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));grid-auto-rows:150px;grid-auto-flow:dense;gap:12px}.sv-fdash-tile{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;box-sizing:border-box;padding:12px 14px;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius-lg, 10px);background:var(--sg-bg, #fff)}.sv-fdash-tile.is-2x1{grid-column:span 2}.sv-fdash-tile.is-2x2{grid-column:span 2;grid-row:span 2}.is-editing .sv-fdash-tile{cursor:grab}.sv-fdash-tile.is-dragged{opacity:.5}.sv-fdash-tile.is-drop{outline:2px dashed var(--sg-accent, #2563eb);outline-offset:2px}.sv-fdash-hit{position:absolute;inset:0;z-index:1;width:100%;padding:0;border:0;border-radius:inherit;background:none;cursor:pointer}.sv-fdash-tile:has(.sv-fdash-hit:hover){border-color:color-mix(in srgb,var(--sg-fg, #0f172a) 24%,var(--sg-border, #e2e8f0))}.sv-fdash-tile-head{display:flex;align-items:center;gap:6px;min-width:0}.sv-fdash-title{flex:1;min-width:0;margin:0;font-size:13px;font-weight:600;color:var(--sg-muted, #64748b);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-fdash-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:4px}.is-chart .sv-fdash-body,.is-list .sv-fdash-body{justify-content:flex-start;padding-top:6px}.sv-fdash-number{margin:0;font-size:30px;line-height:1.15;font-weight:600;font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-fdash-number.is-blank{font-size:15px;font-weight:400;color:var(--sg-muted, #64748b)}.sv-fdash-meta{margin:0;font-size:12px;color:var(--sg-muted, #64748b);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-fdash-empty{margin:auto;text-align:center;color:var(--sg-muted, #64748b)}.sv-fdash-bar{height:8px;border-radius:999px;overflow:hidden;background:color-mix(in srgb,var(--sg-fg, #0f172a) 9%,transparent)}.sv-fdash-bar>span{display:block;height:100%;border-radius:inherit;background:var(--sg-chart-1, #2d7ff9)}.sv-fdash-chart{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.sv-fdash-chart>:global(*){flex:1 1 auto;min-height:0}.sv-fdash-list{list-style:none;margin:0;padding:0;overflow:auto;min-height:0}.sv-fdash-list li+li{border-top:1px solid var(--sg-border, #e2e8f0)}.sv-fdash-item{display:flex;align-items:baseline;gap:10px;width:100%;padding:7px 2px;border:0;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.sv-fdash-item:disabled{cursor:inherit}.sv-fdash-item:not(:disabled):hover .sv-fdash-item-name{text-decoration:underline}.sv-fdash-item-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-fdash-item-detail{flex:none;max-width:50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sg-muted, #64748b);font-variant-numeric:tabular-nums}.sv-fdash-tools{display:flex;align-items:center;gap:2px;margin:6px -6px -6px;padding-top:6px;border-top:1px solid var(--sg-border, #e2e8f0)}.sv-fdash-grip{display:inline-flex;color:var(--sg-muted, #64748b)}.sv-fdash-gap{flex:1}.sv-fdash-size{height:24px;padding:0 4px;font:inherit;font-size:12px;color:inherit;background:var(--sg-bg, #fff);border:1px solid var(--sg-border, #e2e8f0);border-radius:6px}.sv-fdash-icon{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:6px;background:none;color:var(--sg-muted, #64748b);cursor:pointer}.sv-fdash-icon:hover:not(:disabled){background:var(--sg-row-hover-bg, #f1f5f9);color:var(--sg-fg, #0f172a)}.sv-fdash-icon:disabled{opacity:.35;cursor:default}.sv-fdash-btn:focus-visible,.sv-fdash-icon:focus-visible,.sv-fdash-item:focus-visible,.sv-fdash-size:focus-visible,.sv-fdash-hit:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:1px}@container (max-width: 451px){.sv-fdash{padding:10px}.sv-fdash-tile.is-2x1,.sv-fdash-tile.is-2x2{grid-column:auto}}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BaseTable } from './base-tables.js';
|
|
2
|
+
import { type DashboardTile } from './dashboard.js';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
tiles?: ReadonlyArray<DashboardTile>;
|
|
5
|
+
/** Every table of the base (the view's own included). */
|
|
6
|
+
tables: ReadonlyArray<BaseTable>;
|
|
7
|
+
/** The table the view is on: a tile without a `table` reads it. */
|
|
8
|
+
home: string;
|
|
9
|
+
/** A locked view: its tiles cannot be changed. */
|
|
10
|
+
locked?: boolean;
|
|
11
|
+
onChange?: (tiles: DashboardTile[]) => void;
|
|
12
|
+
/** A record picked in a list tile, or in the records a tile opens. */
|
|
13
|
+
onOpen?: (tableId: string, rowId: string) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const BaseDashboardView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
type BaseDashboardView = ReturnType<typeof BaseDashboardView>;
|
|
17
|
+
export default BaseDashboardView;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import{SvModal}from"@svgrid/grid";import{guessField,importTargets,importTypeOf,matchColumns,recordsFromMatrix,tableFromMatrix}from"./base-import";import{BUILTIN_FIELD_TYPES}from"./builtin-types";let{open=$bindable(false),tables,current,mode=$bindable("new"),file=null,onImport}=$props();const TYPES=["text","longText","number","currency","percent","checkbox","singleSelect","multiSelect","date","email","url","phone","rating","duration"];const typeLabel=id=>BUILTIN_FIELD_TYPES.find(t=>t.id===id)?.label??id;let matrix=$state.raw(null);let fileName=$state("");let error=$state("");let busy=$state(false);let name=$state("");let types=$state({});let targets=$state([]);let input=$state(null);let dragging=$state(false);const headers=$derived((matrix?.[0]??[]).map((h,i)=>String(h??"").trim()||`Field ${i+1}`));const body=$derived((matrix??[]).slice(1).filter(r=>r.some(c=>String(c??"").trim()!=="")));const guesses=$derived(headers.map((h,i)=>guessField(h,body.map(r=>String(r[i]??"")))));const fields=$derived(current?importTargets(current):[]);const mapped=$derived(targets.filter(Boolean).length);$effect(()=>{if(open&&file)void read(file)});$effect(()=>{if(!open){matrix=null;error="";types={}}});async function read(f){busy=true;error="";try{const{readImportMatrix}=await import("../import");const out=await readImportMatrix(f,"auto",{maxBytes:20*1024*1024});if(out.matrix.length<2)throw new Error("The file has a header row and no records.");fileName=f.name;const base=f.name.replace(/\.[^.]+$/,"").replace(/[-_]+/g," ").trim();name=base?base[0].toUpperCase()+base.slice(1):"Imported";matrix=out.matrix;types={};targets=current?matchColumns(out.matrix[0].map(h=>String(h??"")),current):[]}catch(e){error=e instanceof Error?e.message:String(e)}finally{busy=false}}function pick(e){const f=e.currentTarget.files?.[0];if(f)void read(f)}function drop(e){e.preventDefault();dragging=false;const f=e.dataTransfer?.files?.[0];if(f)void read(f)}function run(){if(!matrix)return;if(mode==="new"){onImport({mode:"new",table:tableFromMatrix(matrix,tables,name,types)})}else if(current){const out=recordsFromMatrix(matrix,current,targets);onImport({mode:"append",table:current.id,rows:out.rows,columns:out.columns})}open=false}const preview=i=>body.slice(0,3).map(r=>String(r[i]??"")).filter(Boolean).join(", ");const selectValue=e=>e.currentTarget.value;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<SvModal bind:open title={mode === 'new' ? 'Import a file as a new table' : `Import records into ${current?.name ?? 'this table'}`} width={680}>
|
|
6
|
+
<div class="sv-bimp">
|
|
7
|
+
{#if !matrix}
|
|
8
|
+
<div
|
|
9
|
+
class="sv-bimp-drop"
|
|
10
|
+
class:is-over={dragging}
|
|
11
|
+
role="button"
|
|
12
|
+
tabindex="0"
|
|
13
|
+
aria-label="Choose a CSV or Excel file"
|
|
14
|
+
onclick={() => input?.click()}
|
|
15
|
+
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && (e.preventDefault(), input?.click())}
|
|
16
|
+
ondragover={(e) => { e.preventDefault(); dragging = true }}
|
|
17
|
+
ondragleave={() => (dragging = false)}
|
|
18
|
+
ondrop={drop}
|
|
19
|
+
>
|
|
20
|
+
<svg viewBox="0 0 24 24" width="28" height="28" aria-hidden="true"><path d="M12 15V4M7 9l5-5 5 5M5 15v4h14v-4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
21
|
+
<strong>{busy ? 'Reading the file…' : 'Drop a file here, or click to choose one'}</strong>
|
|
22
|
+
<span>CSV, TSV, Excel (.xlsx) or JSON. The first row names the columns.</span>
|
|
23
|
+
</div>
|
|
24
|
+
<input bind:this={input} type="file" accept=".csv,.tsv,.txt,.xlsx,.json,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden onchange={pick} />
|
|
25
|
+
{#if error}<p class="sv-bimp-error" role="alert">{error}</p>{/if}
|
|
26
|
+
{:else}
|
|
27
|
+
<div class="sv-bimp-head">
|
|
28
|
+
<span class="sv-bimp-file">{fileName}: {body.length} {body.length === 1 ? 'record' : 'records'}, {headers.length} columns</span>
|
|
29
|
+
<button type="button" class="sv-bimp-link" onclick={() => (matrix = null)}>Choose another file</button>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="sv-bimp-modes" role="radiogroup" aria-label="Import into">
|
|
32
|
+
<label class="sv-bimp-mode"><input type="radio" bind:group={mode} value="new" /> A new table</label>
|
|
33
|
+
<label class="sv-bimp-mode"><input type="radio" bind:group={mode} value="append" disabled={!current} /> Add records to {current?.name ?? 'the shown table'}</label>
|
|
34
|
+
</div>
|
|
35
|
+
{#if mode === 'new'}
|
|
36
|
+
<label class="sv-bimp-name">Table name <input type="text" bind:value={name} /></label>
|
|
37
|
+
<table class="sv-bimp-map">
|
|
38
|
+
<thead><tr><th>Column</th><th>Field type</th><th>First values</th></tr></thead>
|
|
39
|
+
<tbody>
|
|
40
|
+
{#each headers as h, i (i)}
|
|
41
|
+
<tr>
|
|
42
|
+
<td class="sv-bimp-col">{h}{#if i === 0}<span class="sv-bimp-tag">names the records</span>{/if}</td>
|
|
43
|
+
<td>
|
|
44
|
+
<select aria-label={`Field type of ${h}`} value={types[i] ?? (i === 0 || !guesses[i] ? 'text' : importTypeOf(guesses[i]))} onchange={(e) => (types[i] = selectValue(e))}>
|
|
45
|
+
{#each TYPES as t (t)}<option value={t}>{typeLabel(t)}</option>{/each}
|
|
46
|
+
</select>
|
|
47
|
+
</td>
|
|
48
|
+
<td class="sv-bimp-sample">{preview(i)}</td>
|
|
49
|
+
</tr>
|
|
50
|
+
{/each}
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
{:else}
|
|
54
|
+
<table class="sv-bimp-map">
|
|
55
|
+
<thead><tr><th>Column in the file</th><th>Goes to field</th><th>First values</th></tr></thead>
|
|
56
|
+
<tbody>
|
|
57
|
+
{#each headers as h, i (i)}
|
|
58
|
+
<tr>
|
|
59
|
+
<td class="sv-bimp-col">{h}</td>
|
|
60
|
+
<td>
|
|
61
|
+
<select aria-label={`Field for ${h}`} value={targets[i] ?? ''} onchange={(e) => (targets[i] = selectValue(e) || null)}>
|
|
62
|
+
<option value="">Skip this column</option>
|
|
63
|
+
{#each fields as f (f.id)}
|
|
64
|
+
<option value={f.id} disabled={targets.includes(f.id) && targets[i] !== f.id}>{f.header}</option>
|
|
65
|
+
{/each}
|
|
66
|
+
</select>
|
|
67
|
+
</td>
|
|
68
|
+
<td class="sv-bimp-sample">{preview(i)}</td>
|
|
69
|
+
</tr>
|
|
70
|
+
{/each}
|
|
71
|
+
</tbody>
|
|
72
|
+
</table>
|
|
73
|
+
{#if !mapped}<p class="sv-bimp-error">No column goes to a field yet.</p>{/if}
|
|
74
|
+
{/if}
|
|
75
|
+
{/if}
|
|
76
|
+
</div>
|
|
77
|
+
{#snippet footer()}
|
|
78
|
+
<div class="sv-bimp-foot">
|
|
79
|
+
<button type="button" class="sv-bimp-btn" onclick={() => (open = false)}>Cancel</button>
|
|
80
|
+
<button type="button" class="sv-bimp-btn is-primary" disabled={!matrix || (mode === 'append' && !mapped) || (mode === 'new' && !name.trim())} onclick={run}>
|
|
81
|
+
Import {body.length} {body.length === 1 ? 'record' : 'records'}
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
{/snippet}
|
|
85
|
+
</SvModal>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
.sv-bimp{display:flex;flex-direction:column;gap:12px;font-size:13px;color:var(--sg-fg, #1c1917)}.sv-bimp-drop{display:flex;flex-direction:column;align-items:center;gap:6px;padding:36px 16px;text-align:center;cursor:pointer;border:2px dashed var(--sg-border, #e7e5e4);border-radius:var(--sg-radius-lg, 10px);color:var(--sg-muted, #78716c)}.sv-bimp-drop strong{color:var(--sg-fg, #1c1917);font-weight:600}.sv-bimp-drop.is-over,.sv-bimp-drop:hover{border-color:var(--sg-accent, #2563eb)}.sv-bimp-drop:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:2px}.sv-bimp-error{margin:0;color:var(--sg-danger, #dc2626)}.sv-bimp-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}.sv-bimp-file{font-weight:600}.sv-bimp-link{padding:0;border:0;background:none;color:var(--sg-accent, #2563eb);font:inherit;cursor:pointer}.sv-bimp-modes{display:flex;flex-wrap:wrap;gap:16px}.sv-bimp-mode{display:inline-flex;align-items:center;gap:6px;cursor:pointer}.sv-bimp-name{display:flex;align-items:center;gap:8px}.sv-bimp-name input,.sv-bimp-map select{height:30px;padding:0 8px;box-sizing:border-box;font:inherit;color:var(--sg-fg, #1c1917);background:var(--sg-input-bg, var(--sg-bg, #fff));border:1px solid var(--sg-border, #e7e5e4);border-radius:var(--sg-radius, 6px)}.sv-bimp-name input{flex:1 1 auto;max-width:320px}.sv-bimp-map{width:100%;border-collapse:collapse}.sv-bimp-map th{padding:6px 8px;text-align:start;font-weight:600;font-size:12px;color:var(--sg-muted, #78716c);border-bottom:1px solid var(--sg-border, #e7e5e4)}.sv-bimp-map td{padding:5px 8px;border-bottom:1px solid var(--sg-border, #e7e5e4);vertical-align:middle}.sv-bimp-map select{width:100%;min-width:150px}.sv-bimp-col{font-weight:500}.sv-bimp-tag{display:block;font-size:11px;font-weight:400;color:var(--sg-muted, #78716c)}.sv-bimp-sample{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sg-muted, #78716c)}.sv-bimp-foot{display:flex;justify-content:flex-end;gap:8px;width:100%}.sv-bimp-btn{height:32px;padding:0 14px;font:inherit;font-size:13px;cursor:pointer;border-radius:var(--sg-radius, 6px);background:transparent;color:var(--sg-fg, #1c1917);border:1px solid var(--sg-border, #e7e5e4)}.sv-bimp-btn.is-primary{background:var(--sg-accent, #2563eb);border-color:var(--sg-accent, #2563eb);color:var(--sg-accent-fg, #fff)}.sv-bimp-btn:disabled{opacity:.55;cursor:default}@media(max-width:560px){.sv-bimp-sample{display:none}}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseTable } from './base-tables.js';
|
|
2
|
+
import { type BaseImportResult } from './base-import.js';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
tables: ReadonlyArray<BaseTable>;
|
|
6
|
+
/** The shown table: the one records are added to. */
|
|
7
|
+
current: BaseTable | undefined;
|
|
8
|
+
mode?: 'new' | 'append';
|
|
9
|
+
/** A file to start with (dropped on the base, or handed over by the app). */
|
|
10
|
+
file?: File | null;
|
|
11
|
+
onImport: (result: BaseImportResult) => void;
|
|
12
|
+
};
|
|
13
|
+
declare const BaseImport: import("svelte").Component<$$ComponentProps, {}, "mode" | "open">;
|
|
14
|
+
type BaseImport = ReturnType<typeof BaseImport>;
|
|
15
|
+
export default BaseImport;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import FieldInput from"./FieldInput.svelte";import ListChips from"./ListChips.svelte";import{cellText,cellValue,fieldColumns,gridOf,writeCell}from"./grid-access";import{inboxRecords,listColumns,timeOf,titleColumn}from"./list-view";import{changesOf,commentsOf,markAllSeen,markSeen,timeAgo,unseenOf}from"./activity.svelte";import{findFieldUser}from"./sources.svelte";import{openRecord}from"./editor-request.svelte";let{api,view}=$props();const ctrl=$derived(api?gridOf(api):null);const rows=$derived(ctrl?inboxRecords(ctrl,view):[]);const title=$derived(ctrl?titleColumn(ctrl):void 0);const fields=$derived(ctrl?listColumns(ctrl,view):[]);const dateCol=$derived(ctrl&&view?.inboxDateField?fieldColumns(ctrl).find(c=>c.id===view.inboxDateField):void 0);const unread=$derived(ctrl?rows.filter(r=>unseenOf(ctrl,r.id)).length:0);let selectedId=$state(null);const selected=$derived(rows.find(r=>r.id===selectedId)??null);let width=$state(0);const narrow=$derived(width>0&&width<640);let showDetail=$state(false);let listBox=$state(null);const itemOf=id=>[...listBox?.querySelectorAll("[data-row-id]")??[]].find(el=>el.dataset.rowId===id);function pick(row,focus=false){selectedId=row.id;showDetail=true;editing=null;if(ctrl&&unseenOf(ctrl,row.id))markSeen(ctrl,row.id);if(focus)queueMicrotask(()=>itemOf(row.id)?.focus())}function step(by){if(!rows.length)return;const at=rows.findIndex(r=>r.id===selectedId);const next=at<0?by>0?0:rows.length-1:Math.max(0,Math.min(rows.length-1,at+by));pick(rows[next],!narrow||!showDetail)}function back(){showDetail=false;const id=selectedId;if(id)queueMicrotask(()=>itemOf(id)?.focus())}function expand(row,focus){if(!ctrl)return;if(!(ctrl.allRows??[]).some(r=>r.id===row.id))api.expandAllGroups?.();openRecord({ctrl,rowId:row.id,...focus?{focus}:{}})}const typing=t=>t instanceof HTMLElement&&(t.isContentEditable||!!t.closest('input, textarea, select, [contenteditable="true"], [role="dialog"], .sv-pop__panel'));function onKeydown(e){if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||typing(e.target)||editing)return;const inList=!!listBox?.contains(e.target);if(e.key==="j"||inList&&e.key==="ArrowDown")step(1);else if(e.key==="k"||inList&&e.key==="ArrowUp")step(-1);else if(inList&&e.key==="Home"&&rows[0])pick(rows[0],true);else if(inList&&e.key==="End"&&rows.length)pick(rows[rows.length-1],true);else if(e.key==="Escape"&&narrow&&showDetail)back();else return;e.preventDefault()}const titleOf=row=>(title?cellText(title,cellValue(ctrl,row,title),row):"")||"Untitled";const dateOf=row=>dateCol?cellText(dateCol,cellValue(ctrl,row,dateCol),row):"";const shortDate=row=>{const t=dateCol?timeOf(cellValue(ctrl,row,dateCol)):NaN;if(Number.isNaN(t))return dateOf(row);const d=new Date(t);const today=new Date().toDateString()===d.toDateString();const timed=!!dateCol?.def.fieldProps?.time;return today&&timed?d.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):d.toLocaleDateString(void 0,{month:"short",day:"numeric"})};const tabStop=$derived(rows.some(r=>r.id===selectedId)?selectedId:rows[0]?.id??null);let editing=$state(null);const colOf=c=>({id:c.id,columnDef:(ctrl?.allColumns??[]).find(x=>x.id===c.id)?.columnDef??c.def});const detailFields=$derived(ctrl?fieldColumns(ctrl).filter(c=>c.visible&&c.id!==title?.id):[]);function editable(c){if(!ctrl||!selected||!ctrl.editingEnabled)return false;const ri=(ctrl.allRows??[]).findIndex(r=>r.id===selected.id);const ci=(ctrl.allColumns??[]).findIndex(x=>x.id===c.id);if(ri<0||ci<0)return false;return ctrl.isCellEditableAt?!!ctrl.isCellEditableAt(ri,ci):c.def.editable!==false}function commit(c,v){editing=null;if(!ctrl||!selected||v===void 0)return;writeCell(ctrl,selected.id,c.id,v)}const changes=$derived.by(()=>{if(!ctrl||!selected)return[];const cols=fieldColumns(ctrl);return[...changesOf(ctrl,selected.id)].reverse().slice(0,5).map((ch,i)=>{const c=cols.find(x=>x.id===ch.columnId);const show=v=>c?cellText(c,v,selected):String(v??"");const who=ch.automation?`Automation: ${ch.automation}`:ch.by?findFieldUser(ch.by)?.name??"Someone":ch.remote?"Someone else":"You";return{key:`${ch.at}-${i}`,at:ch.at,who,what:ch.added?"added this record":`changed ${c?.header??ch.columnId}`,from:!ch.added&&"from"in ch?show(ch.from):"",to:ch.added?"":show(ch.value)||"(cleared)"}})});const comments=$derived(ctrl&&selected?commentsOf(ctrl,selected.id).length:0);
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<div class="sv-finbox" class:is-narrow={narrow} bind:clientWidth={width} onkeydown={onKeydown}>
|
|
7
|
+
{#if ctrl}
|
|
8
|
+
<div class="sv-finbox-side" class:is-off={narrow && showDetail && !!selected}>
|
|
9
|
+
<div class="sv-finbox-head">
|
|
10
|
+
<span class="sv-finbox-unread" aria-live="polite">{unread ? `${unread} unread` : 'All read'}</span>
|
|
11
|
+
<button type="button" class="sv-finbox-btn" disabled={!unread} onclick={() => markAllSeen(ctrl)}>Mark all read</button>
|
|
12
|
+
</div>
|
|
13
|
+
{#if rows.length}
|
|
14
|
+
<ul class="sv-finbox-list" role="list" aria-label="Records" bind:this={listBox}>
|
|
15
|
+
{#each rows as row (row.id)}
|
|
16
|
+
{@const isUnread = !!unseenOf(ctrl, row.id)}
|
|
17
|
+
<li>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
class="sv-finbox-item"
|
|
21
|
+
class:is-unread={isUnread}
|
|
22
|
+
class:is-picked={row.id === selectedId}
|
|
23
|
+
aria-current={row.id === selectedId ? 'true' : undefined}
|
|
24
|
+
data-row-id={row.id}
|
|
25
|
+
tabindex={tabStop === row.id ? 0 : -1}
|
|
26
|
+
onclick={() => pick(row)}
|
|
27
|
+
onkeydown={(e) => {
|
|
28
|
+
if (e.key === 'Enter') {
|
|
29
|
+
e.preventDefault()
|
|
30
|
+
pick(row)
|
|
31
|
+
expand(row)
|
|
32
|
+
}
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<span class="sv-finbox-line">
|
|
36
|
+
<span class="sv-finbox-dot" class:is-on={isUnread} aria-hidden="true"></span>
|
|
37
|
+
<span class="sv-finbox-title">{#if isUnread}<span class="sv-finbox-sr">Unread: </span>{/if}{titleOf(row)}</span>
|
|
38
|
+
{#if dateCol}<span class="sv-finbox-date" title={dateOf(row)}>{shortDate(row)}</span>{/if}
|
|
39
|
+
</span>
|
|
40
|
+
<span class="sv-finbox-sub"><ListChips {ctrl} {row} columns={fields} /></span>
|
|
41
|
+
</button>
|
|
42
|
+
</li>
|
|
43
|
+
{/each}
|
|
44
|
+
</ul>
|
|
45
|
+
{:else}
|
|
46
|
+
<p class="sv-finbox-none">No records. The view's filter may hide them all.</p>
|
|
47
|
+
{/if}
|
|
48
|
+
</div>
|
|
49
|
+
<section class="sv-finbox-detail" class:is-off={narrow && (!showDetail || !selected)} aria-label="Record">
|
|
50
|
+
{#if selected}
|
|
51
|
+
{@const row = selected}
|
|
52
|
+
<header class="sv-finbox-dhead">
|
|
53
|
+
{#if narrow}
|
|
54
|
+
<button type="button" class="sv-finbox-btn sv-finbox-icon" aria-label="Back to the list" title="Back" onclick={back}>
|
|
55
|
+
<svg viewBox="0 0 24 24" width="15" height="15" aria-hidden="true"><path d="M15 6l-6 6 6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
56
|
+
</button>
|
|
57
|
+
{/if}
|
|
58
|
+
<h2 class="sv-finbox-dtitle">{titleOf(row)}</h2>
|
|
59
|
+
<button type="button" class="sv-finbox-btn sv-finbox-icon" aria-label="Previous record" title="Previous (k)" onclick={() => step(-1)}>
|
|
60
|
+
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 15l6-6 6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
61
|
+
</button>
|
|
62
|
+
<button type="button" class="sv-finbox-btn sv-finbox-icon" aria-label="Next record" title="Next (j)" onclick={() => step(1)}>
|
|
63
|
+
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
64
|
+
</button>
|
|
65
|
+
<button type="button" class="sv-finbox-btn" onclick={() => expand(row)}>Expand</button>
|
|
66
|
+
</header>
|
|
67
|
+
<div class="sv-finbox-dbody">
|
|
68
|
+
{#if changes.length}
|
|
69
|
+
<ol class="sv-finbox-changes" aria-label="Latest changes">
|
|
70
|
+
{#each changes as ch (ch.key)}
|
|
71
|
+
<li>
|
|
72
|
+
<strong>{ch.who}</strong> {ch.what}{#if ch.to}: {#if ch.from}<span class="sv-finbox-from">{ch.from}</span><span class="sv-finbox-arrow" aria-label="to">→</span>{/if}{ch.to}{/if}
|
|
73
|
+
<span class="sv-finbox-ago">{timeAgo(ch.at)}</span>
|
|
74
|
+
</li>
|
|
75
|
+
{/each}
|
|
76
|
+
</ol>
|
|
77
|
+
{/if}
|
|
78
|
+
<div class="sv-finbox-fields">
|
|
79
|
+
{#each detailFields as c (c.id)}
|
|
80
|
+
{@const can = editable(c)}
|
|
81
|
+
<div class="sv-finbox-field">
|
|
82
|
+
<span class="sv-finbox-label">{c.header}</span>
|
|
83
|
+
<FieldInput
|
|
84
|
+
{ctrl}
|
|
85
|
+
column={colOf(c)}
|
|
86
|
+
value={cellValue(ctrl, row, c)}
|
|
87
|
+
row={{ id: row.id, original: row.original }}
|
|
88
|
+
rowId={row.id}
|
|
89
|
+
label={c.header}
|
|
90
|
+
editable={can}
|
|
91
|
+
editing={editing === c.id}
|
|
92
|
+
onStart={() => (editing = c.id)}
|
|
93
|
+
onStop={() => (editing = null)}
|
|
94
|
+
onCommit={(v) => commit(c, v)}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
{/each}
|
|
98
|
+
</div>
|
|
99
|
+
<button type="button" class="sv-finbox-link" onclick={() => expand(row, 'comment')}>
|
|
100
|
+
{comments ? `${comments} comment${comments === 1 ? '' : 's'}` : 'Add a comment'}
|
|
101
|
+
</button>
|
|
102
|
+
</div>
|
|
103
|
+
{:else}
|
|
104
|
+
<p class="sv-finbox-none">{rows.length ? 'Pick a record to read it here. j and k move through the list.' : ''}</p>
|
|
105
|
+
{/if}
|
|
106
|
+
</section>
|
|
107
|
+
{/if}
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<style>
|
|
111
|
+
.sv-finbox{position:absolute;inset:0;display:grid;grid-template-columns:minmax(260px,38%) minmax(0,1fr);box-sizing:border-box;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);font-family:var(--sg-font, inherit);font-size:13px}.sv-finbox.is-narrow{grid-template-columns:minmax(0,1fr)}.sv-finbox-side{display:flex;flex-direction:column;min-height:0;min-width:0;border-inline-end:1px solid var(--sg-border, #e2e8f0)}.sv-finbox.is-narrow .sv-finbox-side{border-inline-end:0}.is-off{display:none!important}.sv-finbox-head{display:flex;align-items:center;gap:8px;padding:6px 8px 6px 16px;border-bottom:1px solid var(--sg-border, #e2e8f0)}.sv-finbox-unread{flex:1;font-size:12px;color:var(--sg-muted, #64748b)}.sv-finbox-list{flex:1 1 auto;min-height:0;overflow:auto;list-style:none;margin:0;padding:0}.sv-finbox-item{display:flex;flex-direction:column;gap:2px;width:100%;box-sizing:border-box;padding:8px 12px 8px 8px;border:0;border-bottom:1px solid var(--sg-border, #e2e8f0);background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.sv-finbox-item:hover{background:var(--sg-row-hover-bg, #f8fafc)}.sv-finbox-item.is-picked{background:color-mix(in srgb,var(--sg-accent, #2563eb) 10%,transparent)}.sv-finbox-item:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:-2px}.sv-finbox-line{display:flex;align-items:center;gap:6px;min-width:0}.sv-finbox-dot{flex:none;width:7px;height:7px;border-radius:50%}.sv-finbox-dot.is-on{background:var(--sg-accent, #2563eb)}.sv-finbox-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.sv-finbox-item.is-unread .sv-finbox-title{font-weight:700}.sv-finbox-date{flex:none;font-size:12px;color:var(--sg-muted, #64748b)}.sv-finbox-item.is-unread .sv-finbox-date{color:var(--sg-fg, #0f172a);font-weight:600}.sv-finbox-sub{padding-inline-start:13px;min-width:0}.sv-finbox-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-finbox-detail{display:flex;flex-direction:column;min-height:0;min-width:0}.sv-finbox-dhead{display:flex;align-items:center;gap:4px;padding:8px 12px 8px 20px;border-bottom:1px solid var(--sg-border, #e2e8f0)}.sv-finbox.is-narrow .sv-finbox-dhead{padding-inline-start:8px}.sv-finbox-dtitle{flex:1;min-width:0;margin:0;font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sv-finbox-dbody{flex:1 1 auto;min-height:0;overflow:auto;padding:14px 20px 20px;display:flex;flex-direction:column;gap:14px}.sv-finbox-changes{list-style:none;margin:0;padding:8px 10px;display:flex;flex-direction:column;gap:4px;font-size:12px;border-radius:var(--sg-radius, 6px);background:color-mix(in srgb,var(--sg-fg, #0f172a) 4%,transparent)}.sv-finbox-changes strong{font-weight:600}.sv-finbox-from{color:var(--sg-muted, #64748b);text-decoration:line-through}.sv-finbox-arrow{margin:0 5px;color:var(--sg-muted, #64748b)}.sv-finbox-ago{margin-inline-start:6px;color:var(--sg-muted, #64748b)}.sv-finbox-fields{display:flex;flex-direction:column;gap:12px}.sv-finbox-field{display:flex;flex-direction:column;gap:4px}.sv-finbox-label{font-size:12px;font-weight:600;color:var(--sg-muted, #64748b)}.sv-finbox-none{margin:auto;padding:24px;text-align:center;font-size:14px;color:var(--sg-muted, #64748b)}.sv-finbox-btn{display:inline-flex;align-items:center;justify-content:center;height:28px;min-width:28px;padding:0 10px;flex:none;border:1px solid var(--sg-border, #e2e8f0);border-radius:var(--sg-radius, 6px);background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);font:inherit;font-size:12px;cursor:pointer}.sv-finbox-btn.sv-finbox-icon{padding:0}.sv-finbox-btn:disabled{opacity:.45;cursor:default}.sv-finbox-btn:focus-visible,.sv-finbox-link:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:2px}.sv-finbox-link{align-self:flex-start;padding:0;border:0;background:none;font:inherit;font-size:13px;color:var(--sg-fg, #0f172a);text-decoration:underline;text-underline-offset:2px;cursor:pointer}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FieldView } from './view-model.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
api: any;
|
|
4
|
+
view: FieldView | undefined;
|
|
5
|
+
};
|
|
6
|
+
declare const BaseInboxView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type BaseInboxView = ReturnType<typeof BaseInboxView>;
|
|
8
|
+
export default BaseInboxView;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import{SvelteSet}from"svelte/reactivity";import FieldCell from"./FieldCell.svelte";import ListChips from"./ListChips.svelte";import{typeDrawsCell}from"./registry.svelte";import{cellText,cellValue,dataRows,gridOf}from"./grid-access";import{listColumns,listGroups,titleColumn}from"./list-view";import{unseenOf}from"./activity.svelte";import{openRecord}from"./editor-request.svelte";import{cardGrid}from"./view-model";let{api,view}=$props();const ctrl=$derived(api?gridOf(api):null);const groups=$derived(ctrl?listGroups(ctrl):null);const flat=$derived(ctrl&&!groups?dataRows(ctrl):[]);const title=$derived(ctrl?titleColumn(ctrl):void 0);const fields=$derived(ctrl?listColumns(ctrl,view):[]);const total=$derived(groups?groups.reduce((n,g)=>n+g.rows.length,0):flat.length);const folded=new SvelteSet;const entries=$derived.by(()=>{if(!groups)return flat.map(row=>({key:`r:${row.id}`,row}));const out=[];const walk=(list,parent)=>{for(const g of list){const key=`g:${g.id}`;out.push({key,group:g,parent});if(folded.has(g.id))continue;if(g.groups)walk(g.groups,key);else for(const row of g.rows)out.push({key:`r:${row.id}`,row,parent:key})}};walk(groups,void 0);return out});let active=$state("");const tabStop=$derived(entries.some(e=>e.key===active)?active:entries[0]?.key??"");let box=$state(null);function focusEntry(key){active=key;[...box?.querySelectorAll("[data-entry]")??[]].find(el=>el.dataset.entry===key)?.focus()}function onKeydown(e){if(!entries.length)return;const at=Math.max(0,entries.findIndex(x=>x.key===tabStop));let next=-1;if(e.key==="ArrowDown")next=Math.min(entries.length-1,at+1);else if(e.key==="ArrowUp")next=Math.max(0,at-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=entries.length-1;else if(e.key==="Enter"&&entries[at]?.row){e.preventDefault();open(entries[at].row);return}else if(e.key==="ArrowLeft"||e.key==="ArrowRight"){const here=entries[at];const g=here?.group;if(g&&folded.has(g.id)===(e.key==="ArrowRight"))toggle(g);else if(e.key==="ArrowLeft"&&here?.parent){e.preventDefault();focusEntry(here.parent)}return}if(next<0)return;e.preventDefault();focusEntry(entries[next].key)}function toggle(g){if(folded.has(g.id))folded.delete(g.id);else folded.add(g.id)}function open(row){if(!ctrl)return;active=`r:${row.id}`;const shown=(ctrl.allRows??[]).some(r=>r.id===row.id);if(!shown)api.expandAllGroups?.();openRecord({ctrl,rowId:row.id})}const titleOf=row=>(title?cellText(title,cellValue(ctrl,row,title),row):"")||"Untitled";const card=$derived(ctrl?cardGrid(ctrl)(200):null);const drawsGroup=g=>!!g.column&&g.column.def.cell==null&&!!g.column.fieldType&&typeDrawsCell(g.column.def);const emptyValue=v=>v==null||v===""||Array.isArray(v)&&v.length===0;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="sv-flist" bind:this={box}>
|
|
6
|
+
{#if ctrl && total}
|
|
7
|
+
|
|
8
|
+
<div class="sv-flist-body" onkeydown={onKeydown}>
|
|
9
|
+
{#if groups}
|
|
10
|
+
{#each groups as g (g.id)}
|
|
11
|
+
{@render group(g)}
|
|
12
|
+
{/each}
|
|
13
|
+
{:else}
|
|
14
|
+
<ul class="sv-flist-list" role="list">
|
|
15
|
+
{#each flat as row (row.id)}
|
|
16
|
+
{@render item(row)}
|
|
17
|
+
{/each}
|
|
18
|
+
</ul>
|
|
19
|
+
{/if}
|
|
20
|
+
</div>
|
|
21
|
+
{:else if ctrl}
|
|
22
|
+
<p class="sv-flist-none">No records. The view's filter may hide them all.</p>
|
|
23
|
+
{/if}
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
{#snippet group(g: ListGroup)}
|
|
28
|
+
{@const unfolded = !folded.has(g.id)}
|
|
29
|
+
<section class="sv-flist-group" class:is-nested={g.depth > 0} style:--sv-flist-indent={`${g.depth * 18}px`} aria-label={`${g.column?.header ?? 'Group'}: ${g.column && !emptyValue(g.value) ? cellText(g.column, g.value) : 'Empty'}`}>
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
class="sv-flist-ghead"
|
|
33
|
+
data-entry={`g:${g.id}`}
|
|
34
|
+
data-depth={g.depth}
|
|
35
|
+
tabindex={tabStop === `g:${g.id}` ? 0 : -1}
|
|
36
|
+
aria-expanded={unfolded}
|
|
37
|
+
onclick={() => toggle(g)}
|
|
38
|
+
onfocus={() => (active = `g:${g.id}`)}
|
|
39
|
+
>
|
|
40
|
+
<svg class="sv-flist-chev" class:is-folded={!unfolded} viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
41
|
+
<span class="sv-flist-glabel">{g.column?.header ?? ''}</span>
|
|
42
|
+
<span class="sv-flist-gvalue">
|
|
43
|
+
{#if g.column && emptyValue(g.value)}
|
|
44
|
+
<span class="sv-flist-gempty">Empty</span>
|
|
45
|
+
{:else if g.column && card && drawsGroup(g)}
|
|
46
|
+
<FieldCell ctrl={card} row={{ id: g.rows[0]!.id, original: g.rows[0]!.original }} column={{ id: g.column.id, columnDef: g.column.def }} value={g.value} />
|
|
47
|
+
{:else if g.column}
|
|
48
|
+
{cellText(g.column, g.value)}
|
|
49
|
+
{/if}
|
|
50
|
+
</span>
|
|
51
|
+
<span class="sv-flist-gcount">{g.rows.length}</span>
|
|
52
|
+
</button>
|
|
53
|
+
{#if unfolded && g.groups}
|
|
54
|
+
{#each g.groups as sub (sub.id)}
|
|
55
|
+
{@render group(sub)}
|
|
56
|
+
{/each}
|
|
57
|
+
{:else if unfolded}
|
|
58
|
+
<ul class="sv-flist-list" role="list">
|
|
59
|
+
{#each g.rows as row (row.id)}
|
|
60
|
+
{@render item(row)}
|
|
61
|
+
{/each}
|
|
62
|
+
</ul>
|
|
63
|
+
{/if}
|
|
64
|
+
</section>
|
|
65
|
+
{/snippet}
|
|
66
|
+
|
|
67
|
+
{#snippet item(row: GridRow)}
|
|
68
|
+
{@const unseen = !!unseenOf(ctrl, row.id)}
|
|
69
|
+
<li>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
class="sv-flist-item"
|
|
73
|
+
class:is-unseen={unseen}
|
|
74
|
+
data-entry={`r:${row.id}`}
|
|
75
|
+
data-row-id={row.id}
|
|
76
|
+
tabindex={tabStop === `r:${row.id}` ? 0 : -1}
|
|
77
|
+
onclick={() => open(row)}
|
|
78
|
+
onfocus={() => (active = `r:${row.id}`)}
|
|
79
|
+
>
|
|
80
|
+
<span class="sv-flist-title">
|
|
81
|
+
{#if unseen}<span class="sv-flist-dot" title="Changed by someone else"></span><span class="sv-flist-sr">Changed: </span>{/if}{titleOf(row)}
|
|
82
|
+
</span>
|
|
83
|
+
<ListChips {ctrl} {row} columns={fields} />
|
|
84
|
+
</button>
|
|
85
|
+
</li>
|
|
86
|
+
{/snippet}
|
|
87
|
+
|
|
88
|
+
<style>
|
|
89
|
+
.sv-flist{position:absolute;inset:0;display:flex;flex-direction:column;box-sizing:border-box;background:var(--sg-bg, #fff);color:var(--sg-fg, #0f172a);font-family:var(--sg-font, inherit);font-size:13px}.sv-flist-body{flex:1 1 auto;min-height:0;overflow:auto}.sv-flist-list{list-style:none;margin:0;padding:0}.sv-flist-item{display:flex;flex-direction:column;align-items:stretch;gap:2px;width:100%;box-sizing:border-box;padding:8px 16px;padding-inline-start:calc(16px + var(--sv-flist-indent, 0px));border:0;border-bottom:1px solid var(--sg-border, #e2e8f0);background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.sv-flist-item:hover{background:var(--sg-row-hover-bg, #f8fafc)}.sv-flist-item:focus-visible,.sv-flist-ghead:focus-visible{outline:2px solid var(--sg-focus-ring, var(--sg-accent, #2563eb));outline-offset:-2px}.sv-flist-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;font-size:14px;font-weight:600;line-height:20px;overflow-wrap:anywhere}.sv-flist-dot{display:inline-block;width:7px;height:7px;margin-inline-end:6px;vertical-align:2px;border-radius:50%;background:var(--sg-accent, #2563eb)}.sv-flist-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sv-flist-ghead{position:sticky;top:0;z-index:1;display:flex;align-items:center;gap:8px;width:100%;box-sizing:border-box;padding:6px 12px;padding-inline-start:calc(12px + var(--sv-flist-indent, 0px));border:0;border-bottom:1px solid var(--sg-border, #e2e8f0);cursor:pointer;background:var(--sg-header-bg, #f8fafc);color:inherit;font:inherit;text-align:start}.sv-flist-group.is-nested>.sv-flist-ghead{position:static;background:color-mix(in srgb,var(--sg-header-bg, #f8fafc) 50%,var(--sg-bg, #fff))}.sv-flist-chev{flex:none;color:var(--sg-muted, #64748b);transition:transform .12s}.sv-flist-chev.is-folded{transform:rotate(-90deg)}.sv-flist-chev.is-folded:dir(rtl){transform:rotate(90deg)}.sv-flist-glabel{flex:none;font-size:12px;color:var(--sg-muted, #64748b)}.sv-flist-gvalue{display:inline-flex;align-items:center;min-width:0;overflow:hidden;font-weight:600}.sv-flist-gempty{font-weight:400;color:var(--sg-muted, #64748b)}.sv-flist-gcount{margin-inline-start:auto;font-size:12px;color:var(--sg-muted, #64748b)}.sv-flist-none{margin:auto;padding:24px;font-size:14px;color:var(--sg-muted, #64748b)}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FieldView } from './view-model.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
api: any;
|
|
4
|
+
view: FieldView | undefined;
|
|
5
|
+
};
|
|
6
|
+
declare const BaseListView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type BaseListView = ReturnType<typeof BaseListView>;
|
|
8
|
+
export default BaseListView;
|