@surfaces-ui/components 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +50 -0
- package/dist/appComponents.d.ts +9 -0
- package/dist/appComponents.js +105 -1
- package/dist/appComponents.js.map +1 -1
- package/dist/brand/MovingMark.d.ts +15 -0
- package/dist/brand/MovingMark.js +52 -0
- package/dist/brand/MovingMark.js.map +1 -0
- package/dist/brand/SurfacesMark.d.ts +9 -0
- package/dist/brand/SurfacesMark.js +12 -0
- package/dist/brand/SurfacesMark.js.map +1 -0
- package/dist/brand/index.d.ts +3 -0
- package/dist/brand/index.js +3 -0
- package/dist/brand/index.js.map +1 -0
- package/dist/brand/markMotion.d.ts +29 -0
- package/dist/brand/markMotion.js +89 -0
- package/dist/brand/markMotion.js.map +1 -0
- package/dist/chart/Chart.d.ts +8 -4
- package/dist/chart/Chart.js +19 -8
- package/dist/chart/Chart.js.map +1 -1
- package/dist/chart/advice.d.ts +4 -2
- package/dist/chart/advice.js +14 -1
- package/dist/chart/advice.js.map +1 -1
- package/dist/chart/option.d.ts +17 -2
- package/dist/chart/option.js +146 -3
- package/dist/chart/option.js.map +1 -1
- package/dist/controls/ConfirmDialog.d.ts +17 -2
- package/dist/controls/ConfirmDialog.js +37 -11
- package/dist/controls/ConfirmDialog.js.map +1 -1
- package/dist/controls/ItemControls.d.ts +6 -2
- package/dist/controls/ItemControls.js +8 -3
- package/dist/controls/ItemControls.js.map +1 -1
- package/dist/controls/OutlineIcon.d.ts +9 -0
- package/dist/controls/OutlineIcon.js +12 -0
- package/dist/controls/OutlineIcon.js.map +1 -0
- package/dist/data/DataSourceProvider.d.ts +2 -0
- package/dist/data/DataSourceProvider.js +5 -0
- package/dist/data/DataSourceProvider.js.map +1 -1
- package/dist/feedback/ErrorPage.d.ts +27 -0
- package/dist/feedback/ErrorPage.js +12 -0
- package/dist/feedback/ErrorPage.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/loading/ChartArt.d.ts +8 -0
- package/dist/loading/ChartArt.js +29 -0
- package/dist/loading/ChartArt.js.map +1 -0
- package/dist/loading/DraftCard.d.ts +10 -0
- package/dist/loading/DraftCard.js +38 -0
- package/dist/loading/DraftCard.js.map +1 -0
- package/dist/loading/Loading.d.ts +49 -0
- package/dist/loading/Loading.js +38 -0
- package/dist/loading/Loading.js.map +1 -0
- package/dist/locale/locale.d.ts +42 -0
- package/dist/locale/locale.js +43 -0
- package/dist/locale/locale.js.map +1 -1
- package/dist/record/RecordForm.d.ts +85 -0
- package/dist/record/RecordForm.js +221 -0
- package/dist/record/RecordForm.js.map +1 -0
- package/dist/record/record.d.ts +82 -0
- package/dist/record/record.js +125 -0
- package/dist/record/record.js.map +1 -0
- package/dist/result/QueryResult.js +2 -1
- package/dist/result/QueryResult.js.map +1 -1
- package/dist/review/ActionReceipt.d.ts +2 -1
- package/dist/review/ActionReceipt.js +1 -0
- package/dist/review/ActionReceipt.js.map +1 -1
- package/dist/schema/SchemaExplorer.d.ts +4 -0
- package/dist/schema/SchemaExplorer.js +46 -28
- package/dist/schema/SchemaExplorer.js.map +1 -1
- package/dist/site/Site.d.ts +9 -4
- package/dist/site/Site.js +14 -8
- package/dist/site/Site.js.map +1 -1
- package/dist/styles.css +1097 -100
- package/dist/styles.layer.css +1097 -100
- package/dist/text/Markdown.js +21 -8
- package/dist/text/Markdown.js.map +1 -1
- package/dist/workspace/icons.js +2 -1
- package/dist/workspace/icons.js.map +1 -1
- package/package.json +12 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/locale/locale.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,OAAO,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;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B,EAAE,eAAe;IACrC,iBAAiB,EAAE,qCAAqC;IACxD,oBAAoB,EAAE,qEAAqE;IAC3F,mBAAmB,EAAE,8IAA8I;IACnK,kBAAkB,EAAE,4DAA4D;CACxE,CAAC;AAOX,IAAI,MAAM,GAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,UAAU,SAAS,CAAC,OAAwB;IAChD,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,GAAG,IAAI,aAAa;YAAE,IAAI,CAAC,GAAe,CAAC,GAAG,IAAI,CAAC;IACrF,CAAC;IACD,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;AAChC,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,KAAK,CAAC,GAAa,EAAE,IAAsC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/**\n * The locale every number and date in the components is written in, and the\n * words they show. Both are page-wide: one locale and one set of words per\n * page. A host sets them once, before the components render, with\n * `setLocale` and `setLabels` or the `SurfacesText` component.\n */\n\nlet current = \"en-US\";\nconst formats = new Map<string, Intl.NumberFormat>();\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Sets the locale (a BCP 47 tag such as \"de-DE\") for every number and date the\n * components write. Platform forms with an underscore (\"en_US\", as iOS and\n * Android write them) are accepted.\n */\nexport function setLocale(locale: string): void {\n // Throws a RangeError on a malformed tag here rather than on the next render.\n current = Intl.getCanonicalLocales(locale.replaceAll(\"_\", \"-\"))[0] ?? \"en-US\";\n}\n\n/** The locale numbers and dates are written in. Defaults to \"en-US\". */\nexport function getLocale(): string {\n return current;\n}\n\n/** A number format in the current locale, kept for reuse. Call it when formatting, not once at load, so a later `setLocale` applies. */\nexport function numberFormat(options: Intl.NumberFormatOptions = {}): Intl.NumberFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = formats.get(key);\n if (!format) {\n format = new Intl.NumberFormat(current, options);\n formats.set(key, format);\n }\n return format;\n}\n\n/** A date and time format in the current locale, kept for reuse. */\nexport function dateFormat(options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(current, options);\n dateFormats.set(key, format);\n }\n return format;\n}\n\n/**\n * Every word the data-display components show, in English. `{name}` marks a\n * value filled in when the words are shown. Replace any of them with\n * `setLabels`, for another language or plainer words.\n */\nexport const defaultLabels = {\n // Cell values\n \"cell.null\": \"null\",\n \"cell.true\": \"true\",\n \"cell.false\": \"false\",\n\n // DataGrid\n \"grid.label\": \"Query result\",\n \"grid.sortAscending\": \"Sort ascending\",\n \"grid.sortDescending\": \"Sort descending\",\n \"grid.clearSorting\": \"Clear sorting\",\n \"grid.moveLeft\": \"Move left\",\n \"grid.moveRight\": \"Move right\",\n \"grid.hideColumn\": \"Hide column\",\n \"grid.showAllColumns\": \"Show all columns\",\n \"grid.showAllColumnsHidden\": \"Show all columns ({count} hidden)\",\n \"grid.resetWidth\": \"Reset width\",\n \"grid.resetWidthHint\": \"Double-click edge\",\n \"grid.resetLayout\": \"Reset column layout\",\n \"grid.copyColumnName\": \"Copy column name\",\n \"grid.sqlCountValues\": \"SQL: count each value\",\n \"grid.sqlRange\": \"SQL: range and missing values\",\n \"grid.copyValue\": \"Copy value\",\n \"grid.copyRowJson\": \"Copy row as JSON\",\n \"grid.filterToValue\": \"Filter to this value\",\n \"grid.leaveValueOut\": \"Leave this value out\",\n \"grid.copied\": \"Copied {what}.\",\n \"grid.copiedCell\": \"the cell\",\n \"grid.copiedRow\": \"the row\",\n \"grid.copiedColumnName\": \"the column name\",\n \"grid.copiedSql\": \"the SQL\",\n \"grid.copyFailed\": \"Could not copy: the browser refused access to the clipboard.\",\n \"grid.movedLeft\": \"Moved {name} left.\",\n \"grid.movedRight\": \"Moved {name} right.\",\n \"grid.moved\": \"Moved {name}.\",\n \"grid.columnMenu\": \"{name} column\",\n \"grid.cellMenu\": \"{name} cell\",\n \"grid.activeCellMenu\": \"Cell\",\n \"grid.failed\": \"Query failed\",\n \"grid.loading\": \"Loading…\",\n \"grid.rows\": \"{count} rows\",\n \"grid.rowsOne\": \"{count} row\",\n \"grid.noRows\": \"No rows match.\",\n \"grid.showHidden\": \"Show {count} hidden columns\",\n \"grid.showHiddenOne\": \"Show {count} hidden column\",\n \"grid.elapsed\": \"{ms} ms\",\n \"grid.asOf\": \"As of {time}\",\n \"grid.runAgain\": \"Run again\",\n \"grid.previous\": \"Previous\",\n \"grid.next\": \"Next\",\n \"grid.page\": \"Page {page} of {pages}\",\n\n // PivotTable\n \"pivot.label\": \"Pivot table\",\n \"pivot.loading\": \"Loading…\",\n \"pivot.choose\": \"Choose rows or columns and a measure.\",\n \"pivot.empty\": \"No rows match.\",\n \"pivot.total\": \"Total\",\n \"pivot.all\": \"All\",\n \"pivot.none\": \"(none)\",\n \"pivot.truncated\": \"This pivot has more than {limit} cells, so some are missing. Add a filter or choose columns with fewer values.\",\n \"pivot.hiddenColumns\": \"Showing the first {shown} of {total} column values.\",\n\n // Chart\n \"chart.empty\": \"No data to chart.\",\n \"chart.missingX\": \"Rows with no {x} are not drawn{detail}.\",\n \"chart.description\": \"{type} chart of {measures} by {x}\",\n \"chart.coloursRepeat\": \"{count} series share {colours} colours, so some repeat. Filter, or split by a column with fewer values.\",\n \"chart.advice\": \"{message} Better: {instead}\",\n \"chart.sampleNote\": \"Showing a random sample of {count} rows.\",\n \"chart.firstNote\": \"Showing the first {count} points.\",\n \"chart.largestNote\": \"Showing the largest {count} points.\",\n\n // RowList\n \"rows.loading\": \"Loading…\",\n \"rows.empty\": \"Nothing to show.\",\n \"rows.more\": \"Show more\",\n \"rows.some\": \"Showing the first {count}.\",\n \"rows.full\": \"Showing the first {count}. Filter to find others.\",\n\n // Metric, Sparkline, BulletGraph\n \"metric.loading\": \"…\",\n \"metric.none\": \"–\",\n \"sparkline.summary\": \"{label}: {now} now, from {first}; low {low}, high {high} over {count} {grain}s.\",\n \"sparkline.empty\": \"{label}: no data.\",\n \"bullet.loading\": \"{label}: loading.\",\n \"bullet.empty\": \"{label}: no data.\",\n \"bullet.reading\": \"{label}: {value}{band}{target}.\",\n \"bullet.targetMet\": \"; target {target}, met\",\n \"bullet.targetNotMet\": \"; target {target}, not met\",\n \"bullet.target\": \"Target {target}\",\n\n // FilterBar\n \"filter.active\": \"Active filters\",\n \"filter.remove\": \"Remove filter {filter}\",\n \"filter.form\": \"Add a filter\",\n \"filter.column\": \"Column\",\n \"filter.comparison\": \"Comparison\",\n \"filter.value\": \"Value\",\n \"filter.typeOrPick\": \"Type or pick a value\",\n \"filter.add\": \"Add filter\",\n \"filter.quickRange\": \"Quick date range\",\n \"filter.quickRangeChoose\": \"Quick range…\",\n \"filter.range7d\": \"Last 7 days\",\n \"filter.range30d\": \"Last 30 days\",\n \"filter.range90d\": \"Last 90 days\",\n \"filter.range12m\": \"Last 12 months\",\n \"filter.rangeMonth\": \"This month\",\n \"filter.rangeYear\": \"This year\",\n \"filter.isEmpty\": \"is empty\",\n \"filter.isNotEmpty\": \"is not empty\",\n \"filter.contains\": \"contains\",\n \"filter.is\": \"is\",\n \"filter.isNot\": \"is not\",\n \"filter.startsWith\": \"starts with\",\n \"filter.endsWith\": \"ends with\",\n \"filter.enterWholeNumber\": \"Enter a whole number.\",\n \"filter.enterNumber\": \"Enter a number.\",\n \"filter.enterTrueFalse\": \"Enter true or false.\",\n \"filter.enterDate\": \"Enter a date like 2026-01-31.\",\n \"filter.enterValue\": \"Enter a value.\",\n\n // QueryResult\n \"result.views\": \"Result view\",\n \"result.tabTable\": \"Table\",\n \"result.tabChart\": \"Chart\",\n \"result.tabPivot\": \"Pivot\",\n \"result.stopExport\": \"Stop export\",\n \"result.downloadCsv\": \"Download CSV\",\n \"result.copySql\": \"Copy SQL\",\n \"result.cancelQuery\": \"Cancel query\",\n \"result.format\": \"Format\",\n \"result.formatColumn\": \"Column to format\",\n \"result.chooseColumn\": \"Choose a column…\",\n \"result.howToShow\": \"How to show {column}\",\n \"result.asItIs\": \"As it is\",\n \"result.formatNumber\": \"Number\",\n \"result.formatCompact\": \"Short number (1.2M)\",\n \"result.formatCurrency\": \"Currency\",\n \"result.formatPercent\": \"Percent\",\n \"result.formatText\": \"Plain text\",\n \"result.formatDate\": \"Date only\",\n \"result.formatDatetime\": \"Date and time\",\n \"result.preparing\": \"Preparing the file…\",\n \"result.rowsSoFar\": \"{count} rows so far…\",\n \"result.saved\": \"Saved {count} rows.\",\n \"result.savedTruncated\": \"Saved {count} rows. The server's row limit was reached, so the file is not the whole result.\",\n \"result.exportStopped\": \"Export stopped.\",\n \"result.sqlCopied\": \"SQL copied.\",\n \"result.copyNotAllowed\": \"Copying is not allowed here.\",\n \"result.sqlSent\": \"SQL sent to the engine\",\n \"result.plan\": \"How the engine will run it\",\n \"result.stored\": \"The query ran once and its result was kept, so sorting, filtering and paging read the kept rows instead of running it again.\",\n \"result.chooseChart\": \"Choose columns to chart.\",\n \"result.choosePivot\": \"Choose what goes in the rows and the values.\",\n \"result.chartType\": \"Type\",\n \"result.slices\": \"Slices\",\n \"result.xAxis\": \"X axis\",\n \"result.yAxis\": \"Y axis\",\n \"result.every\": \"Every\",\n \"result.bins\": \"Bins\",\n \"result.binsEach\": \"each value\",\n \"result.binsAbout\": \"about {count}\",\n \"result.splitBy\": \"Split by\",\n \"result.nothing\": \"nothing\",\n \"result.legend\": \"Legend\",\n \"result.automatic\": \"automatic\",\n \"result.legendHidden\": \"hidden\",\n \"result.stack\": \"Stack\",\n \"result.plotEachRow\": \"Plot each row\",\n \"result.series\": \"Series {number}\",\n \"result.of\": \"of\",\n \"result.drawnAs\": \"Drawn as\",\n \"result.drawnAsChart\": \"chart type ({type})\",\n \"result.scale\": \"Scale\",\n \"result.leftAxis\": \"left axis\",\n \"result.rightAxis\": \"right axis\",\n \"result.removeSeries\": \"Remove series {number}\",\n \"result.remove\": \"Remove\",\n \"result.addSeries\": \"Add series\",\n \"result.rows\": \"Rows\",\n \"result.columns\": \"Columns\",\n \"result.none\": \"none\",\n \"result.datesBy\": \"Dates by\",\n \"result.values\": \"Values\",\n \"result.sum\": \"sum\",\n \"result.avg\": \"average\",\n \"result.median\": \"median\",\n \"result.count\": \"count of rows\",\n \"result.countDistinct\": \"distinct count\",\n \"result.min\": \"minimum\",\n \"result.max\": \"maximum\",\n \"result.stddev\": \"standard deviation\",\n \"result.p90\": \"90th percentile\",\n\n // Form\n \"form.submit\": \"Submit\",\n \"form.choose\": \"Choose…\",\n \"form.required\": \"(required)\",\n \"form.needsAttention\": \"Nothing was sent. {count} fields need attention.\",\n \"form.needsAttentionOne\": \"Nothing was sent. One field needs attention.\",\n \"form.sent\": \"Sent.\",\n \"form.notSaved\": \"The backend did not save it.\",\n \"form.saved\": \"Saved.\",\n \"form.couldNotSend\": \"Could not send: {error}\",\n \"form.sending\": \"Sending…\",\n \"form.connected\": \"Saved by the backend this page is connected to.\",\n \"form.notConnected\": \"Not connected to a backend: what you submit goes only to this page.\",\n\n // StepFlow\n \"flow.done\": \"Done\",\n \"flow.current\": \"In progress\",\n \"flow.waiting\": \"Waiting for you\",\n \"flow.pending\": \"Not started\",\n \"flow.failed\": \"Failed\",\n \"flow.skipped\": \"Skipped\",\n \"flow.count\": \"{done} of {total} done\",\n\n // PlanReview\n \"plan.riskLow\": \"Low risk\",\n \"plan.riskMedium\": \"Check this\",\n \"plan.riskHigh\": \"Changes or removes data\",\n \"plan.proposedBy\": \"Proposed by {who}. Nothing runs until you approve.\",\n \"plan.required\": \"Required\",\n \"plan.affects\": \"Affects: {what}\",\n \"plan.whatItWouldRun\": \"What it would run\",\n \"plan.approved\": \"Approved {count} of {total} steps.\",\n \"plan.rejected\": \"Rejected. Nothing was run.\",\n \"plan.decisionNote\": \" Note: {note}\",\n \"plan.noteLabel\": \"Note for the record (optional)\",\n \"plan.approve\": \"Approve {count} steps\",\n \"plan.approveOne\": \"Approve {count} step\",\n \"plan.reject\": \"Reject\",\n\n // ActionReceipt\n \"receipt.done\": \"Done\",\n \"receipt.partial\": \"Partly done\",\n \"receipt.failed\": \"Failed\",\n \"receipt.ran\": \"Ran\",\n \"receipt.by\": \"by {who}\",\n \"receipt.approved\": \"Approved\",\n \"receipt.noApproval\": \"No one approved this.\",\n \"receipt.whatChanged\": \"What changed\",\n \"receipt.what\": \"What\",\n \"receipt.before\": \"Before\",\n \"receipt.after\": \"After\",\n \"receipt.whatRan\": \"What ran\",\n \"receipt.cannotUndo\": \"This cannot be undone from here.\",\n \"receipt.undoClosed\": \"It could be undone until {time}; that time has passed.\",\n \"receipt.undoUntil\": \"Can be undone until {time}.\",\n \"receipt.undoRequested\": \"Undo requested. You will be asked to confirm it.\",\n\n // DataTable\n \"table.selectPage\": \"Select every row on this page\",\n \"table.selectRow\": \"Select {name}\",\n \"table.empty\": \"Nothing to show.\",\n \"table.loading\": \"Loading…\",\n \"table.rowControls\": \"{name} actions\",\n \"table.actions\": \"Actions\",\n \"table.select\": \"Select\",\n\n // SelectionBar\n \"selection.label\": \"With the selected rows\",\n \"selection.count\": \"{count} selected\",\n \"selection.pageSelected\": \"All {count} on this page are selected.\",\n \"selection.selectAllMatching\": \"Select all {total} that match\",\n \"selection.allMatching\": \"All {total} that match are selected.\",\n \"selection.onlyPage\": \"Only this page\",\n \"selection.clear\": \"Clear\",\n\n // Pagination\n \"pages.label\": \"Pages\",\n \"pages.range\": \"{from}–{to} of {total}\",\n \"pages.previous\": \"Previous\",\n \"pages.next\": \"Next\",\n\n // ConfirmDialog\n \"confirm.confirm\": \"Confirm\",\n \"confirm.cancel\": \"Cancel\",\n\n // Combobox\n \"combobox.loading\": \"Looking…\",\n \"combobox.none\": \"Nothing matches.\",\n \"combobox.count\": \"{count} suggestions\",\n \"combobox.countOne\": \"1 suggestion\",\n\n // ReportBuilder\n \"report.untitled\": \"Untitled\",\n \"report.untitledReport\": \"Untitled report\",\n \"report.title\": \"Report title\",\n \"report.tileTitle\": \"Title of {title}\",\n \"report.tileControls\": \"{title} controls\",\n \"report.mode\": \"Mode\",\n \"report.build\": \"Build\",\n \"report.view\": \"View\",\n \"report.builder\": \"Build a view\",\n \"report.body\": \"Report\",\n \"report.changing\": \"Changing “{title}”.\",\n \"report.leaveAsItWas\": \"Leave it as it was\",\n \"report.leftAsItWas\": \"Left as it was.\",\n \"report.updateView\": \"Update view\",\n \"report.addToReport\": \"Add to report\",\n \"report.maxViews\": \"A report holds at most {max} views.\",\n \"report.needMeasure\": \"Put a metric on “Measure” first: a view needs something to measure.\",\n \"report.emptyBuild\": \"Nothing on the report yet. Make a view above and press “Add to report”; each one you add appears here, and they all follow the same filters.\",\n \"report.emptyView\": \"This report has no views yet. Switch to Build to make one.\",\n} as const;\n\n/** The name of one replaceable word or sentence. A name not in `defaultLabels` is a type error. */\nexport type LabelKey = keyof typeof defaultLabels;\n/** Every label, by name. */\nexport type Labels = Record<LabelKey, string>;\n\nlet labels: Labels = { ...defaultLabels };\n\n/** Replaces some of the words. Names not given keep their current text. */\nexport function setLabels(partial: Partial<Labels>): void {\n const next = { ...labels };\n for (const [key, text] of Object.entries(partial)) {\n if (typeof text === \"string\" && key in defaultLabels) next[key as LabelKey] = text;\n }\n labels = next;\n}\n\n/** Puts every word back to its English default. */\nexport function resetLabels(): void {\n labels = { ...defaultLabels };\n}\n\n/** The text for a label, with each `{name}` replaced by `vars.name`. A name with no value is left as written. */\nexport function label(key: LabelKey, vars?: Record<string, string | number>): string {\n const text = labels[key];\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in vars ? String(vars[name]) : whole));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/locale/locale.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,OAAO,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,8EAA8E;IAC9E,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;AAChF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,wIAAwI;AACxI,MAAM,UAAU,YAAY,CAAC,OAAO,GAA6B,EAAE;IACjE,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AACh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AAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/**\n * The locale every number and date in the components is written in, and the\n * words they show. Both are page-wide: one locale and one set of words per\n * page. A host sets them once, before the components render, with\n * `setLocale` and `setLabels` or the `SurfacesText` component.\n */\n\nlet current = \"en-US\";\nconst formats = new Map<string, Intl.NumberFormat>();\nconst dateFormats = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Sets the locale (a BCP 47 tag such as \"de-DE\") for every number and date the\n * components write. Platform forms with an underscore (\"en_US\", as iOS and\n * Android write them) are accepted.\n */\nexport function setLocale(locale: string): void {\n // Throws a RangeError on a malformed tag here rather than on the next render.\n current = Intl.getCanonicalLocales(locale.replaceAll(\"_\", \"-\"))[0] ?? \"en-US\";\n}\n\n/** The locale numbers and dates are written in. Defaults to \"en-US\". */\nexport function getLocale(): string {\n return current;\n}\n\n/** A number format in the current locale, kept for reuse. Call it when formatting, not once at load, so a later `setLocale` applies. */\nexport function numberFormat(options: Intl.NumberFormatOptions = {}): Intl.NumberFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = formats.get(key);\n if (!format) {\n format = new Intl.NumberFormat(current, options);\n formats.set(key, format);\n }\n return format;\n}\n\n/** A date and time format in the current locale, kept for reuse. */\nexport function dateFormat(options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n const key = `${current}|${JSON.stringify(options)}`;\n let format = dateFormats.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(current, options);\n dateFormats.set(key, format);\n }\n return format;\n}\n\n/**\n * Every word the data-display components show, in English. `{name}` marks a\n * value filled in when the words are shown. Replace any of them with\n * `setLabels`, for another language or plainer words.\n */\nexport const defaultLabels = {\n // Cell values\n \"cell.null\": \"null\",\n \"cell.true\": \"true\",\n \"cell.false\": \"false\",\n\n // DataGrid\n \"grid.label\": \"Query result\",\n \"grid.sortAscending\": \"Sort ascending\",\n \"grid.sortDescending\": \"Sort descending\",\n \"grid.clearSorting\": \"Clear sorting\",\n \"grid.moveLeft\": \"Move left\",\n \"grid.moveRight\": \"Move right\",\n \"grid.hideColumn\": \"Hide column\",\n \"grid.showAllColumns\": \"Show all columns\",\n \"grid.showAllColumnsHidden\": \"Show all columns ({count} hidden)\",\n \"grid.resetWidth\": \"Reset width\",\n \"grid.resetWidthHint\": \"Double-click edge\",\n \"grid.resetLayout\": \"Reset column layout\",\n \"grid.copyColumnName\": \"Copy column name\",\n \"grid.sqlCountValues\": \"SQL: count each value\",\n \"grid.sqlRange\": \"SQL: range and missing values\",\n \"grid.copyValue\": \"Copy value\",\n \"grid.copyRowJson\": \"Copy row as JSON\",\n \"grid.filterToValue\": \"Filter to this value\",\n \"grid.leaveValueOut\": \"Leave this value out\",\n \"grid.copied\": \"Copied {what}.\",\n \"grid.copiedCell\": \"the cell\",\n \"grid.copiedRow\": \"the row\",\n \"grid.copiedColumnName\": \"the column name\",\n \"grid.copiedSql\": \"the SQL\",\n \"code.copyFailed\": \"Could not copy: the browser did not allow it. The code is selected, so you can copy it yourself.\",\n \"grid.copyFailed\": \"Could not copy: the browser refused access to the clipboard.\",\n \"grid.movedLeft\": \"Moved {name} left.\",\n \"grid.movedRight\": \"Moved {name} right.\",\n \"grid.moved\": \"Moved {name}.\",\n \"grid.columnMenu\": \"{name} column\",\n \"grid.cellMenu\": \"{name} cell\",\n \"grid.activeCellMenu\": \"Cell\",\n \"grid.failed\": \"Query failed\",\n \"grid.loading\": \"Loading…\",\n \"grid.rows\": \"{count} rows\",\n \"grid.rowsOne\": \"{count} row\",\n \"grid.noRows\": \"No rows match.\",\n \"grid.showHidden\": \"Show {count} hidden columns\",\n \"grid.showHiddenOne\": \"Show {count} hidden column\",\n \"grid.elapsed\": \"{ms} ms\",\n \"grid.asOf\": \"As of {time}\",\n \"grid.runAgain\": \"Run again\",\n \"grid.previous\": \"Previous\",\n \"grid.next\": \"Next\",\n \"grid.page\": \"Page {page} of {pages}\",\n\n // PivotTable\n \"pivot.label\": \"Pivot table\",\n \"pivot.loading\": \"Loading…\",\n \"pivot.choose\": \"Choose rows or columns and a measure.\",\n \"pivot.empty\": \"No rows match.\",\n \"pivot.total\": \"Total\",\n \"pivot.all\": \"All\",\n \"pivot.none\": \"(none)\",\n \"pivot.truncated\": \"This pivot has more than {limit} cells, so some are missing. Add a filter or choose columns with fewer values.\",\n \"pivot.hiddenColumns\": \"Showing the first {shown} of {total} column values.\",\n\n // Chart\n \"chart.empty\": \"No data to chart.\",\n \"chart.missingX\": \"Rows with no {x} are not drawn{detail}.\",\n \"chart.description\": \"{type} chart of {measures} by {x}\",\n \"chart.coloursRepeat\": \"{count} series share {colours} colours, so some repeat. Filter, or split by a column with fewer values.\",\n \"chart.advice\": \"{message} Better: {instead}\",\n \"chart.sampleNote\": \"Showing a random sample of {count} rows.\",\n \"chart.firstNote\": \"Showing the first {count} points.\",\n \"chart.largestNote\": \"Showing the largest {count} points.\",\n\n // RowList\n \"rows.loading\": \"Loading…\",\n \"rows.empty\": \"Nothing to show.\",\n \"rows.more\": \"Show more\",\n \"rows.some\": \"Showing the first {count}.\",\n \"rows.full\": \"Showing the first {count}. Filter to find others.\",\n\n // Metric, Sparkline, BulletGraph\n \"metric.loading\": \"…\",\n \"metric.none\": \"–\",\n \"sparkline.summary\": \"{label}: {now} now, from {first}; low {low}, high {high} over {count} {grain}s.\",\n \"sparkline.empty\": \"{label}: no data.\",\n \"bullet.loading\": \"{label}: loading.\",\n \"bullet.empty\": \"{label}: no data.\",\n \"bullet.reading\": \"{label}: {value}{band}{target}.\",\n \"bullet.targetMet\": \"; target {target}, met\",\n \"bullet.targetNotMet\": \"; target {target}, not met\",\n \"bullet.target\": \"Target {target}\",\n\n // FilterBar\n \"filter.active\": \"Active filters\",\n \"filter.remove\": \"Remove filter {filter}\",\n \"filter.form\": \"Add a filter\",\n \"filter.column\": \"Column\",\n \"filter.comparison\": \"Comparison\",\n \"filter.value\": \"Value\",\n \"filter.typeOrPick\": \"Type or pick a value\",\n \"filter.add\": \"Add filter\",\n \"filter.quickRange\": \"Quick date range\",\n \"filter.quickRangeChoose\": \"Quick range…\",\n \"filter.range7d\": \"Last 7 days\",\n \"filter.range30d\": \"Last 30 days\",\n \"filter.range90d\": \"Last 90 days\",\n \"filter.range12m\": \"Last 12 months\",\n \"filter.rangeMonth\": \"This month\",\n \"filter.rangeYear\": \"This year\",\n \"filter.isEmpty\": \"is empty\",\n \"filter.isNotEmpty\": \"is not empty\",\n \"filter.contains\": \"contains\",\n \"filter.is\": \"is\",\n \"filter.isNot\": \"is not\",\n \"filter.startsWith\": \"starts with\",\n \"filter.endsWith\": \"ends with\",\n \"filter.enterWholeNumber\": \"Enter a whole number.\",\n \"filter.enterNumber\": \"Enter a number.\",\n \"filter.enterTrueFalse\": \"Enter true or false.\",\n \"filter.enterDate\": \"Enter a date like 2026-01-31.\",\n \"filter.enterValue\": \"Enter a value.\",\n\n // QueryResult\n \"result.views\": \"Result view\",\n \"result.tabTable\": \"Table\",\n \"result.tabChart\": \"Chart\",\n \"result.tabPivot\": \"Pivot\",\n \"result.stopExport\": \"Stop export\",\n \"result.downloadCsv\": \"Download CSV\",\n \"result.copySql\": \"Copy SQL\",\n \"result.cancelQuery\": \"Cancel query\",\n \"result.format\": \"Format\",\n \"result.formatColumn\": \"Column to format\",\n \"result.chooseColumn\": \"Choose a column…\",\n \"result.howToShow\": \"How to show {column}\",\n \"result.asItIs\": \"As it is\",\n \"result.formatNumber\": \"Number\",\n \"result.formatCompact\": \"Short number (1.2M)\",\n \"result.formatCurrency\": \"Currency\",\n \"result.formatPercent\": \"Percent\",\n \"result.formatText\": \"Plain text\",\n \"result.formatDate\": \"Date only\",\n \"result.formatDatetime\": \"Date and time\",\n \"result.preparing\": \"Preparing the file…\",\n \"result.rowsSoFar\": \"{count} rows so far…\",\n \"result.saved\": \"Saved {count} rows.\",\n \"result.savedTruncated\": \"Saved {count} rows. The server's row limit was reached, so the file is not the whole result.\",\n \"result.exportStopped\": \"Export stopped.\",\n \"result.sqlCopied\": \"SQL copied.\",\n \"result.copyNotAllowed\": \"Copying is not allowed here.\",\n \"result.sqlSent\": \"SQL sent to the engine\",\n \"result.plan\": \"How the engine will run it\",\n \"result.stored\": \"The query ran once and its result was kept, so sorting, filtering and paging read the kept rows instead of running it again.\",\n \"result.chooseChart\": \"Choose columns to chart.\",\n \"result.choosePivot\": \"Choose what goes in the rows and the values.\",\n \"result.chartType\": \"Type\",\n \"result.slices\": \"Slices\",\n \"result.xAxis\": \"X axis\",\n \"result.yAxis\": \"Y axis\",\n \"result.every\": \"Every\",\n \"result.bins\": \"Bins\",\n \"result.binsEach\": \"each value\",\n \"result.binsAbout\": \"about {count}\",\n \"result.splitBy\": \"Split by\",\n \"result.nothing\": \"nothing\",\n \"result.legend\": \"Legend\",\n \"result.automatic\": \"automatic\",\n \"result.legendHidden\": \"hidden\",\n \"result.stack\": \"Stack\",\n \"result.plotEachRow\": \"Plot each row\",\n \"result.series\": \"Series {number}\",\n \"result.of\": \"of\",\n \"result.drawnAs\": \"Drawn as\",\n \"result.drawnAsChart\": \"chart type ({type})\",\n \"result.scale\": \"Scale\",\n \"result.leftAxis\": \"left axis\",\n \"result.rightAxis\": \"right axis\",\n \"result.removeSeries\": \"Remove series {number}\",\n \"result.remove\": \"Remove\",\n \"result.addSeries\": \"Add series\",\n \"result.rows\": \"Rows\",\n \"result.columns\": \"Columns\",\n \"result.none\": \"none\",\n \"result.datesBy\": \"Dates by\",\n \"result.values\": \"Values\",\n \"result.sum\": \"sum\",\n \"result.avg\": \"average\",\n \"result.median\": \"median\",\n \"result.count\": \"count of rows\",\n \"result.countDistinct\": \"distinct count\",\n \"result.min\": \"minimum\",\n \"result.max\": \"maximum\",\n \"result.stddev\": \"standard deviation\",\n \"result.p90\": \"90th percentile\",\n\n // Form\n \"form.submit\": \"Submit\",\n \"form.choose\": \"Choose…\",\n \"form.required\": \"(required)\",\n \"form.needsAttention\": \"Nothing was sent. {count} fields need attention.\",\n \"form.needsAttentionOne\": \"Nothing was sent. One field needs attention.\",\n \"form.sent\": \"Sent.\",\n \"form.notSaved\": \"The backend did not save it.\",\n \"form.saved\": \"Saved.\",\n \"form.couldNotSend\": \"Could not send: {error}\",\n \"form.sending\": \"Sending…\",\n \"form.connected\": \"Saved by the backend this page is connected to.\",\n \"form.notConnected\": \"Not connected to a backend: what you submit goes only to this page.\",\n\n // StepFlow\n \"flow.done\": \"Done\",\n \"flow.current\": \"In progress\",\n \"flow.waiting\": \"Waiting for you\",\n \"flow.pending\": \"Not started\",\n \"flow.failed\": \"Failed\",\n \"flow.skipped\": \"Skipped\",\n \"flow.count\": \"{done} of {total} done\",\n\n // PlanReview\n \"plan.riskLow\": \"Low risk\",\n \"plan.riskMedium\": \"Check this\",\n \"plan.riskHigh\": \"Changes or removes data\",\n \"plan.proposedBy\": \"Proposed by {who}. Nothing runs until you approve.\",\n \"plan.required\": \"Required\",\n \"plan.affects\": \"Affects: {what}\",\n \"plan.whatItWouldRun\": \"What it would run\",\n \"plan.approved\": \"Approved {count} of {total} steps.\",\n \"plan.rejected\": \"Rejected. Nothing was run.\",\n \"plan.decisionNote\": \" Note: {note}\",\n \"plan.noteLabel\": \"Note for the record (optional)\",\n \"plan.approve\": \"Approve {count} steps\",\n \"plan.approveOne\": \"Approve {count} step\",\n \"plan.reject\": \"Reject\",\n\n // ActionReceipt\n \"receipt.done\": \"Done\",\n \"receipt.partial\": \"Partly done\",\n \"receipt.none\": \"Nothing changed\",\n \"receipt.failed\": \"Failed\",\n \"receipt.ran\": \"Ran\",\n \"receipt.by\": \"by {who}\",\n \"receipt.approved\": \"Approved\",\n \"receipt.noApproval\": \"No one approved this.\",\n \"receipt.whatChanged\": \"What changed\",\n \"receipt.what\": \"What\",\n \"receipt.before\": \"Before\",\n \"receipt.after\": \"After\",\n \"receipt.whatRan\": \"What ran\",\n \"receipt.cannotUndo\": \"This cannot be undone from here.\",\n \"receipt.undoClosed\": \"It could be undone until {time}; that time has passed.\",\n \"receipt.undoUntil\": \"Can be undone until {time}.\",\n \"receipt.undoRequested\": \"Undo requested. You will be asked to confirm it.\",\n\n // DataTable\n \"table.selectPage\": \"Select every row on this page\",\n \"table.selectRow\": \"Select {name}\",\n \"table.empty\": \"Nothing to show.\",\n \"table.loading\": \"Loading…\",\n \"table.rowControls\": \"{name} actions\",\n \"table.actions\": \"Actions\",\n \"table.select\": \"Select\",\n\n // SelectionBar\n \"selection.label\": \"With the selected rows\",\n \"selection.count\": \"{count} selected\",\n \"selection.pageSelected\": \"All {count} on this page are selected.\",\n \"selection.selectAllMatching\": \"Select all {total} that match\",\n \"selection.allMatching\": \"All {total} that match are selected.\",\n \"selection.onlyPage\": \"Only this page\",\n \"selection.clear\": \"Clear\",\n\n // Pagination\n \"pages.label\": \"Pages\",\n \"pages.range\": \"{from}–{to} of {total}\",\n \"pages.previous\": \"Previous\",\n \"pages.next\": \"Next\",\n\n // ConfirmDialog\n \"confirm.confirm\": \"Confirm\",\n \"confirm.cancel\": \"Cancel\",\n \"confirm.typeWord\": \"Type “{word}” to go ahead\",\n \"confirm.reason\": \"Reason (optional)\",\n \"confirm.reasonRequired\": \"Reason (required)\",\n \"confirm.needWord\": \"Type “{word}” in the box first. Nothing has run.\",\n \"confirm.needReason\": \"Give a reason first. Nothing has run.\",\n \"run.working\": \"Working…\",\n \"run.you\": \"You\",\n \"run.reread\": \"Read it again\",\n \"run.continue\": \"Continue\",\n \"run.leftAlone\": \"Left alone\",\n \"run.andMore\": \"and {count} more\",\n \"run.changed\": \"Changed\",\n \"run.highRisk\": \"High risk\",\n \"run.irreversible\": \"Cannot be undone\",\n \"run.rows\": \"Rows it applies to\",\n \"run.operation\": \"Operation\",\n \"run.expires\": \"Ask again after {time}\",\n\n // RecordForm\n \"record.save\": \"Save\",\n \"record.saving\": \"Saving…\",\n \"record.saved\": \"Saved.\",\n \"record.edit\": \"Edit\",\n \"record.cancel\": \"Cancel\",\n \"record.unchanged\": \"Nothing has changed, so nothing was saved.\",\n \"record.notSaved\": \"Not saved: {count} fields need attention.\",\n \"record.notSavedOne\": \"Not saved: one field needs attention.\",\n \"record.problems\": \"There are {count} problems\",\n \"record.problemsOne\": \"There is a problem\",\n \"record.reading\": \"Reading the record…\",\n \"record.notFound\": \"This {label} was not found. It may have been removed.\",\n \"record.many\": \"More than one record has this key, so none is shown.\",\n \"record.unread\": \"The record could not be read.\",\n \"record.noOperation\": \"This form cannot be shown: the operation that saves it is not one this backend has.\",\n \"record.back\": \"Go back\",\n \"record.savedValue\": \"Saved now: {value}.\",\n \"record.leaveTitle\": \"Leave without saving?\",\n \"record.leaveBody\": \"Your changes to {what} have not been saved. If you leave, they are lost.\",\n \"record.leave\": \"Leave\",\n \"record.stay\": \"Stay\",\n \"record.yes\": \"Yes\",\n \"record.no\": \"No\",\n\n // Combobox\n \"combobox.loading\": \"Looking…\",\n \"combobox.none\": \"Nothing matches.\",\n \"combobox.count\": \"{count} suggestions\",\n \"combobox.countOne\": \"1 suggestion\",\n\n // ReportBuilder\n \"report.untitled\": \"Untitled\",\n \"report.untitledReport\": \"Untitled report\",\n \"report.title\": \"Report title\",\n \"report.tileTitle\": \"Title of {title}\",\n \"report.tileControls\": \"{title} controls\",\n \"report.mode\": \"Mode\",\n \"report.build\": \"Build\",\n \"report.view\": \"View\",\n \"report.builder\": \"Build a view\",\n \"report.body\": \"Report\",\n \"report.changing\": \"Changing “{title}”.\",\n \"report.leaveAsItWas\": \"Leave it as it was\",\n \"report.leftAsItWas\": \"Left as it was.\",\n \"report.updateView\": \"Update view\",\n \"report.addToReport\": \"Add to report\",\n \"report.maxViews\": \"A report holds at most {max} views.\",\n \"report.needMeasure\": \"Put a metric on “Measure” first: a view needs something to measure.\",\n \"report.emptyBuild\": \"Nothing on the report yet. Make a view above and press “Add to report”; each one you add appears here, and they all follow the same filters.\",\n \"report.emptyView\": \"This report has no views yet. Switch to Build to make one.\",\n} as const;\n\n/** The name of one replaceable word or sentence. A name not in `defaultLabels` is a type error. */\nexport type LabelKey = keyof typeof defaultLabels;\n/** Every label, by name. */\nexport type Labels = Record<LabelKey, string>;\n\nlet labels: Labels = { ...defaultLabels };\n\n/** Replaces some of the words. Names not given keep their current text. */\nexport function setLabels(partial: Partial<Labels>): void {\n const next = { ...labels };\n for (const [key, text] of Object.entries(partial)) {\n if (typeof text === \"string\" && key in defaultLabels) next[key as LabelKey] = text;\n }\n labels = next;\n}\n\n/** Puts every word back to its English default. */\nexport function resetLabels(): void {\n labels = { ...defaultLabels };\n}\n\n/** The text for a label, with each `{name}` replaced by `vars.name`. A name with no value is left as written. */\nexport function label(key: LabelKey, vars?: Record<string, string | number>): string {\n const text = labels[key];\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in vars ? String(vars[name]) : whole));\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type JsonObject } from "@bufbuild/protobuf";
|
|
2
|
+
import { type DataSource, type Operations } from "@surfaces-ui/data";
|
|
3
|
+
import { type MouseEvent } from "react";
|
|
4
|
+
import type { OnContext } from "../controls/context.js";
|
|
5
|
+
import { type RecordOperation, type RecordRow } from "./record.js";
|
|
6
|
+
/**
|
|
7
|
+
* How the last save stands, as whoever ran the operation reports it. It is the shape of an app shell's run state
|
|
8
|
+
* (`/@run/<id>`), so a renderer passes that straight in.
|
|
9
|
+
*/
|
|
10
|
+
export interface RecordSaveState {
|
|
11
|
+
status: "running" | "approving" | "done" | "partial" | "invalid" | "refused" | "stale" | "failed";
|
|
12
|
+
/** The server's sentence for the person. */
|
|
13
|
+
message?: string;
|
|
14
|
+
/** For `invalid`: what the server would not take, by argument. */
|
|
15
|
+
errors?: Record<string, string>;
|
|
16
|
+
/** When this was reported: a new answer is a new time. */
|
|
17
|
+
at: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RecordFormProps {
|
|
20
|
+
/** What the record is, for assistive technology: "Ticket". */
|
|
21
|
+
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* The operation that saves, as the backend defines it: its `args` are the fields (label, type, required, options,
|
|
24
|
+
* limits, what waits on what). `null` when the backend has no such operation. Left out, it is asked for from
|
|
25
|
+
* `operations`, and while there is neither the form waits.
|
|
26
|
+
*/
|
|
27
|
+
definition?: RecordOperation | null;
|
|
28
|
+
/** The operation's id, to ask `operations` for its definition when `definition` is not given. */
|
|
29
|
+
operationId?: string;
|
|
30
|
+
/** Where to ask for the definition. The form never runs an operation itself: saving calls `onSave`. */
|
|
31
|
+
operations?: Pick<Operations, "getOperation">;
|
|
32
|
+
/** Where the record is read from. With no `recordKey` the form is for a new record and reads nothing. */
|
|
33
|
+
sourceId?: string;
|
|
34
|
+
/** One read-only SELECT. The key is added as a filter, bound as a parameter. */
|
|
35
|
+
sql?: string;
|
|
36
|
+
/** The column that tells records apart, and the key of the one to show. No value (yet) is "not found". */
|
|
37
|
+
recordKey?: {
|
|
38
|
+
column: string;
|
|
39
|
+
value: string | number | boolean | null | undefined;
|
|
40
|
+
};
|
|
41
|
+
/** A record the host already read, shown at once (a server render); it is read again when `notBefore` changes. */
|
|
42
|
+
record?: RecordRow;
|
|
43
|
+
/** Which fields to show, in order: arguments of the operation to edit, other columns of the record to read. Left out: every argument. */
|
|
44
|
+
fields?: readonly string[];
|
|
45
|
+
/** The column that changes whenever the record does. Sent with a save, so the server can refuse a stale one. */
|
|
46
|
+
version?: string;
|
|
47
|
+
/** `read` shows the record with an Edit button; `edit` (the default) opens on the fields. */
|
|
48
|
+
mode?: "read" | "edit";
|
|
49
|
+
/** What the person changed and has not saved, by field: only the fields that differ from the record. Leave out to let the form keep its own. */
|
|
50
|
+
draft?: JsonObject;
|
|
51
|
+
onDraftChange?(draft: JsonObject): void;
|
|
52
|
+
/** Saves: run the operation with these arguments, and report how it went through `save`. */
|
|
53
|
+
onSave(args: JsonObject): void;
|
|
54
|
+
/** How the last save stands. */
|
|
55
|
+
save?: RecordSaveState;
|
|
56
|
+
/** For a save that ended `stale`: have views of the same source read again, and clear the state. The form reads its own record again. */
|
|
57
|
+
onReread?(): void;
|
|
58
|
+
/** Told the record each time it is read, and `undefined` when there is none. */
|
|
59
|
+
onRecord?(record: RecordRow | undefined): void;
|
|
60
|
+
/** ISO 8601 time of the last change to the source: the record is read again when it changes. */
|
|
61
|
+
notBefore?: string;
|
|
62
|
+
/** Where "not found" links back to. */
|
|
63
|
+
back?: {
|
|
64
|
+
href: string;
|
|
65
|
+
label?: string;
|
|
66
|
+
onClick?(event: MouseEvent<HTMLAnchorElement>): void;
|
|
67
|
+
};
|
|
68
|
+
saveLabel?: string;
|
|
69
|
+
/** In place of the engine's text when the record cannot be read. */
|
|
70
|
+
errorMessage?: string;
|
|
71
|
+
/** Something above says each finished save in a live region of its own, so the form does not say "Saved" twice. */
|
|
72
|
+
announced?: boolean;
|
|
73
|
+
/** Told what the person did: which fields a save changed, never their values. */
|
|
74
|
+
onContext?: OnContext;
|
|
75
|
+
dataSource?: DataSource;
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* One record, shown and changed. The fields come from the operation that saves it, so a field is described once
|
|
80
|
+
* and what the form checks is what the server checks. The record is read once through the `DataSource`; what a
|
|
81
|
+
* person changes is a draft holding only the changed fields; saving hands the arguments to `onSave`, which runs the
|
|
82
|
+
* operation (an app shell's `run`, with its approvals and receipts), and the answer comes back through `save`: a
|
|
83
|
+
* refused value is shown beside its field, a stale save keeps the draft and offers to read again.
|
|
84
|
+
*/
|
|
85
|
+
export declare function RecordForm(props: RecordFormProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import { fieldAsked, queryErrorInfo } from "@surfaces-ui/data";
|
|
4
|
+
import { FieldType, FormDefinitionSchema } from "@surfaces-ui/proto";
|
|
5
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { useOptionalDataSource } from "../data/DataSourceProvider.js";
|
|
7
|
+
import { FieldInput } from "../form/Form.js";
|
|
8
|
+
import { label as text } from "../locale/locale.js";
|
|
9
|
+
import { draftWith, fieldSpec, recordPlan, recordReader, recordSave } from "./record.js";
|
|
10
|
+
const shownValue = (value, type) => (value === null || value === undefined || value === "" ? "–" : type === FieldType.BOOLEAN || typeof value === "boolean" ? text(value === true ? "record.yes" : "record.no") : String(value));
|
|
11
|
+
/**
|
|
12
|
+
* One record, shown and changed. The fields come from the operation that saves it, so a field is described once
|
|
13
|
+
* and what the form checks is what the server checks. The record is read once through the `DataSource`; what a
|
|
14
|
+
* person changes is a draft holding only the changed fields; saving hands the arguments to `onSave`, which runs the
|
|
15
|
+
* operation (an app shell's `run`, with its approvals and receipts), and the answer comes back through `save`: a
|
|
16
|
+
* refused value is shown beside its field, a stale save keeps the draft and offers to read again.
|
|
17
|
+
*/
|
|
18
|
+
export function RecordForm(props) {
|
|
19
|
+
const { label, fields, version, recordKey, sourceId, sql, save, notBefore } = props;
|
|
20
|
+
const formId = useId();
|
|
21
|
+
const source = useOptionalDataSource(props.dataSource);
|
|
22
|
+
const isNew = recordKey === undefined;
|
|
23
|
+
// The operation's definition: given, or asked for once.
|
|
24
|
+
const [asked, setAsked] = useState();
|
|
25
|
+
const { operations, operationId } = props;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (props.definition !== undefined || !operations || !operationId)
|
|
28
|
+
return;
|
|
29
|
+
let alive = true;
|
|
30
|
+
operations.getOperation({ id: operationId }).then((reply) => alive && setAsked({ id: operationId, definition: reply.operation ?? null }), () => alive && setAsked({ id: operationId, definition: null }));
|
|
31
|
+
return () => {
|
|
32
|
+
alive = false;
|
|
33
|
+
};
|
|
34
|
+
}, [props.definition, operations, operationId]);
|
|
35
|
+
const definition = props.definition !== undefined ? props.definition : asked && asked.id === operationId ? asked.definition : undefined;
|
|
36
|
+
// The record: read once, and again when the source changed or the person asks.
|
|
37
|
+
const [reloads, setReloads] = useState(0);
|
|
38
|
+
const keyValue = recordKey?.value;
|
|
39
|
+
const wanted = JSON.stringify([sourceId, sql, recordKey?.column, keyValue]);
|
|
40
|
+
const [read, setRead] = useState(() => ({ wanted, reading: isNew ? { status: "new" } : props.record ? { status: "ready" } : { status: "loading" }, row: props.record }));
|
|
41
|
+
const first = useRef(props.record !== undefined);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isNew)
|
|
44
|
+
return setRead({ wanted, reading: { status: "new" } });
|
|
45
|
+
// A record the host handed over is what is shown until something says it changed.
|
|
46
|
+
if (first.current) {
|
|
47
|
+
first.current = false;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (keyValue === null || keyValue === undefined || keyValue === "")
|
|
51
|
+
return setRead({ wanted, reading: { status: "missing" } });
|
|
52
|
+
if (!source || !sourceId || !sql)
|
|
53
|
+
return setRead({ wanted, reading: { status: "failed", error: "No DataSource, source or SQL to read the record with." } });
|
|
54
|
+
const controller = new AbortController();
|
|
55
|
+
// Reading the same record again keeps what is shown until the new row arrives.
|
|
56
|
+
setRead((current) => (current.wanted === wanted && current.row ? current : { wanted, reading: { status: "loading" } }));
|
|
57
|
+
recordReader(source)({ sourceId, sql, key: { column: recordKey.column, value: keyValue }, notBefore, signal: controller.signal }).then((rows) => {
|
|
58
|
+
if (controller.signal.aborted)
|
|
59
|
+
return;
|
|
60
|
+
setRead(rows.length === 1 ? { wanted, reading: { status: "ready" }, row: rows[0] } : { wanted, reading: { status: rows.length === 0 ? "missing" : "many" } });
|
|
61
|
+
}, (error) => {
|
|
62
|
+
if (!controller.signal.aborted)
|
|
63
|
+
setRead({ wanted, reading: { status: "failed", error: queryErrorInfo(error).message } });
|
|
64
|
+
});
|
|
65
|
+
return () => controller.abort();
|
|
66
|
+
}, [source, wanted, notBefore, reloads]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
67
|
+
const reading = read.wanted === wanted ? read.reading : isNew ? { status: "new" } : { status: "loading" };
|
|
68
|
+
const record = read.wanted === wanted && !isNew ? read.row : undefined;
|
|
69
|
+
const onRecord = useRef(props.onRecord);
|
|
70
|
+
onRecord.current = props.onRecord;
|
|
71
|
+
useEffect(() => onRecord.current?.(record), [record]);
|
|
72
|
+
// The draft: only what differs from the record.
|
|
73
|
+
const [own, setOwn] = useState({});
|
|
74
|
+
const draft = props.draft ?? own;
|
|
75
|
+
const setDraft = (next) => {
|
|
76
|
+
if (props.draft === undefined)
|
|
77
|
+
setOwn(next);
|
|
78
|
+
props.onDraftChange?.(next);
|
|
79
|
+
};
|
|
80
|
+
const changes = Object.keys(draft).length;
|
|
81
|
+
const [mode, setMode] = useState(props.mode ?? "edit");
|
|
82
|
+
const [errors, setErrors] = useState({ at: 0, by: {} });
|
|
83
|
+
const [note, setNote] = useState();
|
|
84
|
+
const [compare, setCompare] = useState(false);
|
|
85
|
+
const box = useRef(null);
|
|
86
|
+
const summary = useRef(null);
|
|
87
|
+
const editButton = useRef(null);
|
|
88
|
+
const moveTo = useRef(undefined);
|
|
89
|
+
const plan = useMemo(() => (definition ? recordPlan(definition, { fields, key: recordKey?.column, version, record }) : undefined), [definition, fields, recordKey?.column, version, record]);
|
|
90
|
+
const form = useMemo(() => create(FormDefinitionSchema, { fields: definition?.args ?? [] }), [definition]);
|
|
91
|
+
const current = { ...Object.fromEntries(Object.entries(record ?? {}).filter(([name]) => plan?.editable.some((field) => field.name === name))), ...draft };
|
|
92
|
+
const visible = (plan?.shown ?? []).filter((entry) => entry.kind === "column" || fieldAsked(form, entry.field, current));
|
|
93
|
+
const fieldNames = new Set(visible.flatMap((entry) => (entry.kind === "field" ? [entry.field.name] : [])));
|
|
94
|
+
const labelOf = (name) => definition?.args.find((field) => field.name === name)?.label || name;
|
|
95
|
+
const inputOf = (name) => [...(box.current?.querySelectorAll("[data-field]") ?? [])].find((element) => element.dataset.field === name)?.querySelector("input, select, textarea");
|
|
96
|
+
// One thing wrong: focus goes to it. Several: to the list of them, which links to each.
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (errors.at === 0)
|
|
99
|
+
return;
|
|
100
|
+
const names = Object.keys(errors.by);
|
|
101
|
+
if (names.length === 1 && fieldNames.has(names[0]))
|
|
102
|
+
inputOf(names[0])?.focus();
|
|
103
|
+
else
|
|
104
|
+
summary.current?.focus();
|
|
105
|
+
}, [errors.at]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const to = moveTo.current;
|
|
108
|
+
moveTo.current = undefined;
|
|
109
|
+
if (to === "edit")
|
|
110
|
+
editButton.current?.focus();
|
|
111
|
+
else if (to === "first")
|
|
112
|
+
box.current?.querySelector("[data-field] input, [data-field] select, [data-field] textarea")?.focus();
|
|
113
|
+
}, [mode]);
|
|
114
|
+
// The answer to a save, once: what the server refused, or that it is done.
|
|
115
|
+
const answered = useRef(undefined);
|
|
116
|
+
const sent = useRef([]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!save || save.at === answered.current || save.status === "running" || save.status === "approving")
|
|
119
|
+
return;
|
|
120
|
+
answered.current = save.at;
|
|
121
|
+
if (save.status === "invalid") {
|
|
122
|
+
const by = save.errors ?? {};
|
|
123
|
+
const count = Object.keys(by).length;
|
|
124
|
+
setErrors({ at: Date.now(), by });
|
|
125
|
+
setNote({ kind: "attention", text: count === 1 ? text("record.notSavedOne") : text("record.notSaved", { count }) });
|
|
126
|
+
}
|
|
127
|
+
else if (save.status === "done" || save.status === "partial") {
|
|
128
|
+
setErrors({ at: 0, by: {} });
|
|
129
|
+
setDraft({});
|
|
130
|
+
setCompare(false);
|
|
131
|
+
setNote({ kind: "saved", text: save.message || text("record.saved") });
|
|
132
|
+
setReloads((count) => count + 1);
|
|
133
|
+
props.onContext?.({ kind: isNew ? "record.created" : "record.saved", summary: isNew ? `Created a ${label} record.` : `Saved changes to ${label}: ${sent.current.map(labelOf).join(", ") || "no fields"}.`, subject: { record: label, fields: sent.current } });
|
|
134
|
+
if (props.mode === "read") {
|
|
135
|
+
moveTo.current = "edit";
|
|
136
|
+
setMode("read");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
// Refused, stale or failed: said beside the button, and whatever an earlier answer said about a field no longer stands.
|
|
141
|
+
setErrors({ at: 0, by: {} });
|
|
142
|
+
setNote(undefined);
|
|
143
|
+
}
|
|
144
|
+
}, [save?.at, save?.status]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
145
|
+
const busy = save?.status === "running" || save?.status === "approving";
|
|
146
|
+
const change = (name, value) => {
|
|
147
|
+
const field = definition?.args.find((candidate) => candidate.name === name);
|
|
148
|
+
if (!field)
|
|
149
|
+
return;
|
|
150
|
+
setDraft(draftWith(draft, record, field, value));
|
|
151
|
+
if (errors.by[name])
|
|
152
|
+
setErrors(({ at, by: { [name]: _gone, ...rest } }) => ({ at: Object.keys(rest).length ? at : 0, by: rest }));
|
|
153
|
+
};
|
|
154
|
+
const submit = (event) => {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
if (busy || !definition)
|
|
157
|
+
return;
|
|
158
|
+
if (!isNew && changes === 0)
|
|
159
|
+
return setNote({ kind: "unchanged", text: text("record.unchanged") });
|
|
160
|
+
const plan = recordSave(definition, { record, draft, key: recordKey && keyValue !== null && keyValue !== undefined ? { column: recordKey.column, value: keyValue } : undefined, version });
|
|
161
|
+
const count = Object.keys(plan.errors).length;
|
|
162
|
+
if (!plan.args) {
|
|
163
|
+
setErrors({ at: Date.now(), by: plan.errors });
|
|
164
|
+
setNote({ kind: "attention", text: count === 1 ? text("record.notSavedOne") : text("record.notSaved", { count }) });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
setErrors({ at: 0, by: {} });
|
|
168
|
+
setNote(undefined);
|
|
169
|
+
sent.current = plan.changed;
|
|
170
|
+
props.onSave(plan.args);
|
|
171
|
+
};
|
|
172
|
+
const reread = () => {
|
|
173
|
+
setCompare(true);
|
|
174
|
+
setReloads((count) => count + 1);
|
|
175
|
+
props.onReread?.();
|
|
176
|
+
};
|
|
177
|
+
const className = ["sf-form", "sf-record", props.className].filter(Boolean).join(" ");
|
|
178
|
+
if (reading.status === "missing" || reading.status === "many" || reading.status === "failed") {
|
|
179
|
+
return (_jsx("div", { className: className, "data-record": reading.status, children: _jsxs("div", { className: "sf-record-missing", role: "alert", "data-error": reading.status === "failed" ? reading.error : undefined, children: [_jsx("p", { children: reading.status === "missing" ? text("record.notFound", { label }) : reading.status === "many" ? text("record.many") : (props.errorMessage ?? text("record.unread")) }), props.back && (_jsx("p", { children: _jsx("a", { className: "sf-a2-link", href: props.back.href, onClick: props.back.onClick, children: props.back.label ?? text("record.back") }) }))] }) }));
|
|
180
|
+
}
|
|
181
|
+
if (definition === null) {
|
|
182
|
+
return (_jsx("div", { className: className, "data-record": "undefined", children: _jsx("p", { className: "sf-record-missing", role: "alert", children: text("record.noOperation") }) }));
|
|
183
|
+
}
|
|
184
|
+
if (!definition || (reading.status === "loading" && !record)) {
|
|
185
|
+
return (_jsx("div", { className: className, "data-record": "loading", "aria-busy": "true", children: _jsx("p", { className: "sf-form-status", role: "status", children: text("record.reading") }) }));
|
|
186
|
+
}
|
|
187
|
+
const alert = save && save.at === answered.current && (save.status === "refused" || save.status === "stale" || save.status === "failed") ? save : undefined;
|
|
188
|
+
const alertBox = alert && (_jsxs("div", { className: "sf-run-alert", role: "alert", "data-status": alert.status, children: [_jsx("p", { children: alert.message }), alert.status === "stale" && (_jsx("button", { type: "button", className: "sf-button", onClick: reread, children: text("run.reread") }))] }));
|
|
189
|
+
if (mode === "read") {
|
|
190
|
+
return (_jsxs("div", { className: className, "data-record": "read", role: "group", "aria-label": label, children: [_jsx("dl", { className: "sf-record-facts", children: visible.map((entry) => {
|
|
191
|
+
const name = entry.kind === "field" ? entry.field.name : entry.name;
|
|
192
|
+
return (_jsxs("div", { children: [_jsx("dt", { children: entry.kind === "field" ? entry.field.label || name : entry.label }), _jsx("dd", { children: shownValue(record?.[name], entry.kind === "field" ? entry.field.type : undefined) })] }, name));
|
|
193
|
+
}) }), _jsxs("div", { className: "sf-form-actions", children: [_jsx("button", { ref: editButton, type: "button", className: "sf-button", onClick: () => {
|
|
194
|
+
moveTo.current = "first";
|
|
195
|
+
setMode("edit");
|
|
196
|
+
}, children: text("record.edit") }), _jsx("p", { className: "sf-form-status", role: "status", "aria-live": "polite", children: note?.kind === "saved" && !props.announced ? note.text : "" }), note?.kind === "saved" && props.announced && _jsx("p", { className: "sf-form-status", children: note.text })] })] }));
|
|
197
|
+
}
|
|
198
|
+
const problems = Object.entries(errors.by);
|
|
199
|
+
const listed = problems.length > 1 || problems.some(([name]) => !fieldNames.has(name));
|
|
200
|
+
const quiet = note?.kind === "saved" && props.announced;
|
|
201
|
+
return (_jsxs("form", { ref: box, className: className, "data-record": "edit", onSubmit: submit, noValidate: true, "aria-label": label, children: [listed && (_jsxs("div", { ref: summary, className: "sf-record-summary", role: "group", "aria-labelledby": `${formId}-problems`, tabIndex: -1, children: [_jsx("p", { id: `${formId}-problems`, className: "sf-record-summary-title", children: problems.length === 1 ? text("record.problemsOne") : text("record.problems", { count: problems.length }) }), _jsx("ul", { children: problems.map(([name, message]) => (_jsx("li", { children: fieldNames.has(name) ? (_jsx("a", { href: `#${formId}-${name}`, onClick: (event) => {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
inputOf(name)?.focus();
|
|
204
|
+
}, children: `${labelOf(name)}: ${message}` })) : (`${labelOf(name)}: ${message}`) }, name))) })] })), visible.map((entry) => {
|
|
205
|
+
if (entry.kind === "column") {
|
|
206
|
+
return (_jsx("dl", { className: "sf-record-facts", children: _jsxs("div", { children: [_jsx("dt", { children: entry.label }), _jsx("dd", { children: shownValue(record?.[entry.name]) })] }) }, entry.name));
|
|
207
|
+
}
|
|
208
|
+
const spec = fieldSpec(entry.field);
|
|
209
|
+
const name = spec.name;
|
|
210
|
+
// After a stale save was read again, a changed field says what is saved now, so the person can compare.
|
|
211
|
+
const was = compare && record && Object.hasOwn(draft, name) ? text("record.savedValue", { value: shownValue(record[name], entry.field.type) }) : "";
|
|
212
|
+
return (_jsx("div", { id: `${formId}-${name}`, className: "sf-record-field", "data-field": name, "data-changed": Object.hasOwn(draft, name) || undefined, children: _jsx(FieldInput, { field: { ...spec, help: [spec.help, was].filter(Boolean).join(" ") || undefined }, value: current[name], error: errors.by[name], onChange: (value) => change(name, value) }) }, name));
|
|
213
|
+
}), alertBox, _jsxs("div", { className: "sf-form-actions", children: [_jsx("button", { type: "submit", className: "sf-button", "data-variant": "primary", "aria-disabled": busy || undefined, children: busy ? text("record.saving") : (props.saveLabel ?? text("record.save")) }), props.mode === "read" && (_jsx("button", { type: "button", className: "sf-button", onClick: () => {
|
|
214
|
+
setDraft({});
|
|
215
|
+
setErrors({ at: 0, by: {} });
|
|
216
|
+
setNote(undefined);
|
|
217
|
+
moveTo.current = "edit";
|
|
218
|
+
setMode("read");
|
|
219
|
+
}, children: text("record.cancel") })), _jsx("p", { className: note?.kind === "attention" ? "sf-form-error" : "sf-form-status", role: "status", "aria-live": "polite", children: note && !quiet ? note.text : "" }), quiet && _jsx("p", { className: "sf-form-status", children: note.text })] })] }));
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=RecordForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordForm.js","sourceRoot":"","sources":["../../src/record/RecordForm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAoC,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAmD,SAAS,EAAE,KAAK,EAAE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ue } from \"@bufbuild/protobuf\";\nimport { type DataSource, type Operations, fieldAsked, queryErrorInfo } from \"@surfaces-ui/data\";\nimport { FieldType, FormDefinitionSchema } from \"@surfaces-ui/proto\";\nimport { type FormEvent, type MouseEvent, type ReactNode, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { OnContext } from \"../controls/context.js\";\nimport { useOptionalDataSource } from \"../data/DataSourceProvider.js\";\nimport { FieldInput } from \"../form/Form.js\";\nimport { label as text } from \"../locale/locale.js\";\nimport { type RecordOperation, type RecordRow, draftWith, fieldSpec, recordPlan, recordReader, recordSave } from \"./record.js\";\n\n/**\n * How the last save stands, as whoever ran the operation reports it. It is the shape of an app shell's run state\n * (`/@run/<id>`), so a renderer passes that straight in.\n */\nexport interface RecordSaveState {\n status: \"running\" | \"approving\" | \"done\" | \"partial\" | \"invalid\" | \"refused\" | \"stale\" | \"failed\";\n /** The server's sentence for the person. */\n message?: string;\n /** For `invalid`: what the server would not take, by argument. */\n errors?: Record<string, string>;\n /** When this was reported: a new answer is a new time. */\n at: string;\n}\n\nexport interface RecordFormProps {\n /** What the record is, for assistive technology: \"Ticket\". */\n label: string;\n /**\n * The operation that saves, as the backend defines it: its `args` are the fields (label, type, required, options,\n * limits, what waits on what). `null` when the backend has no such operation. Left out, it is asked for from\n * `operations`, and while there is neither the form waits.\n */\n definition?: RecordOperation | null;\n /** The operation's id, to ask `operations` for its definition when `definition` is not given. */\n operationId?: string;\n /** Where to ask for the definition. The form never runs an operation itself: saving calls `onSave`. */\n operations?: Pick<Operations, \"getOperation\">;\n /** Where the record is read from. With no `recordKey` the form is for a new record and reads nothing. */\n sourceId?: string;\n /** One read-only SELECT. The key is added as a filter, bound as a parameter. */\n sql?: string;\n /** The column that tells records apart, and the key of the one to show. No value (yet) is \"not found\". */\n recordKey?: { column: string; value: string | number | boolean | null | undefined };\n /** A record the host already read, shown at once (a server render); it is read again when `notBefore` changes. */\n record?: RecordRow;\n /** Which fields to show, in order: arguments of the operation to edit, other columns of the record to read. Left out: every argument. */\n fields?: readonly string[];\n /** The column that changes whenever the record does. Sent with a save, so the server can refuse a stale one. */\n version?: string;\n /** `read` shows the record with an Edit button; `edit` (the default) opens on the fields. */\n mode?: \"read\" | \"edit\";\n /** What the person changed and has not saved, by field: only the fields that differ from the record. Leave out to let the form keep its own. */\n draft?: JsonObject;\n onDraftChange?(draft: JsonObject): void;\n /** Saves: run the operation with these arguments, and report how it went through `save`. */\n onSave(args: JsonObject): void;\n /** How the last save stands. */\n save?: RecordSaveState;\n /** For a save that ended `stale`: have views of the same source read again, and clear the state. The form reads its own record again. */\n onReread?(): void;\n /** Told the record each time it is read, and `undefined` when there is none. */\n onRecord?(record: RecordRow | undefined): void;\n /** ISO 8601 time of the last change to the source: the record is read again when it changes. */\n notBefore?: string;\n /** Where \"not found\" links back to. */\n back?: { href: string; label?: string; onClick?(event: MouseEvent<HTMLAnchorElement>): void };\n saveLabel?: string;\n /** In place of the engine's text when the record cannot be read. */\n errorMessage?: string;\n /** Something above says each finished save in a live region of its own, so the form does not say \"Saved\" twice. */\n announced?: boolean;\n /** Told what the person did: which fields a save changed, never their values. */\n onContext?: OnContext;\n dataSource?: DataSource;\n className?: string;\n}\n\ntype Reading = { status: \"new\" } | { status: \"loading\" | \"missing\" | \"many\" } | { status: \"failed\"; error: string } | { status: \"ready\" };\n\nconst shownValue = (value: unknown, type?: FieldType): string => (value === null || value === undefined || value === \"\" ? \"–\" : type === FieldType.BOOLEAN || typeof value === \"boolean\" ? text(value === true ? \"record.yes\" : \"record.no\") : String(value));\n\n/**\n * One record, shown and changed. The fields come from the operation that saves it, so a field is described once\n * and what the form checks is what the server checks. The record is read once through the `DataSource`; what a\n * person changes is a draft holding only the changed fields; saving hands the arguments to `onSave`, which runs the\n * operation (an app shell's `run`, with its approvals and receipts), and the answer comes back through `save`: a\n * refused value is shown beside its field, a stale save keeps the draft and offers to read again.\n */\nexport function RecordForm(props: RecordFormProps) {\n const { label, fields, version, recordKey, sourceId, sql, save, notBefore } = props;\n const formId = useId();\n const source = useOptionalDataSource(props.dataSource);\n const isNew = recordKey === undefined;\n\n // The operation's definition: given, or asked for once.\n const [asked, setAsked] = useState<{ id: string; definition: RecordOperation | null }>();\n const { operations, operationId } = props;\n useEffect(() => {\n if (props.definition !== undefined || !operations || !operationId) return;\n let alive = true;\n operations.getOperation({ id: operationId }).then(\n (reply) => alive && setAsked({ id: operationId, definition: reply.operation ?? null }),\n () => alive && setAsked({ id: operationId, definition: null }),\n );\n return () => {\n alive = false;\n };\n }, [props.definition, operations, operationId]);\n const definition = props.definition !== undefined ? props.definition : asked && asked.id === operationId ? asked.definition : undefined;\n\n // The record: read once, and again when the source changed or the person asks.\n const [reloads, setReloads] = useState(0);\n const keyValue = recordKey?.value;\n const wanted = JSON.stringify([sourceId, sql, recordKey?.column, keyValue]);\n const [read, setRead] = useState<{ wanted: string; reading: Reading; row?: RecordRow }>(() => ({ wanted, reading: isNew ? { status: \"new\" } : props.record ? { status: \"ready\" } : { status: \"loading\" }, row: props.record }));\n const first = useRef(props.record !== undefined);\n useEffect(() => {\n if (isNew) return setRead({ wanted, reading: { status: \"new\" } });\n // A record the host handed over is what is shown until something says it changed.\n if (first.current) {\n first.current = false;\n return;\n }\n if (keyValue === null || keyValue === undefined || keyValue === \"\") return setRead({ wanted, reading: { status: \"missing\" } });\n if (!source || !sourceId || !sql) return setRead({ wanted, reading: { status: \"failed\", error: \"No DataSource, source or SQL to read the record with.\" } });\n const controller = new AbortController();\n // Reading the same record again keeps what is shown until the new row arrives.\n setRead((current) => (current.wanted === wanted && current.row ? current : { wanted, reading: { status: \"loading\" } }));\n recordReader(source)({ sourceId, sql, key: { column: recordKey!.column, value: keyValue }, notBefore, signal: controller.signal }).then(\n (rows) => {\n if (controller.signal.aborted) return;\n setRead(rows.length === 1 ? { wanted, reading: { status: \"ready\" }, row: rows[0] } : { wanted, reading: { status: rows.length === 0 ? \"missing\" : \"many\" } });\n },\n (error: unknown) => {\n if (!controller.signal.aborted) setRead({ wanted, reading: { status: \"failed\", error: queryErrorInfo(error).message } });\n },\n );\n return () => controller.abort();\n }, [source, wanted, notBefore, reloads]); // eslint-disable-line react-hooks/exhaustive-deps\n const reading: Reading = read.wanted === wanted ? read.reading : isNew ? { status: \"new\" } : { status: \"loading\" };\n const record = read.wanted === wanted && !isNew ? read.row : undefined;\n const onRecord = useRef(props.onRecord);\n onRecord.current = props.onRecord;\n useEffect(() => onRecord.current?.(record), [record]);\n\n // The draft: only what differs from the record.\n const [own, setOwn] = useState<JsonObject>({});\n const draft = props.draft ?? own;\n const setDraft = (next: JsonObject) => {\n if (props.draft === undefined) setOwn(next);\n props.onDraftChange?.(next);\n };\n const changes = Object.keys(draft).length;\n\n const [mode, setMode] = useState(props.mode ?? \"edit\");\n const [errors, setErrors] = useState<{ at: number; by: Record<string, string> }>({ at: 0, by: {} });\n const [note, setNote] = useState<{ kind: \"saved\" | \"attention\" | \"unchanged\"; text: string }>();\n const [compare, setCompare] = useState(false);\n const box = useRef<HTMLFormElement>(null);\n const summary = useRef<HTMLDivElement>(null);\n const editButton = useRef<HTMLButtonElement>(null);\n const moveTo = useRef<\"edit\" | \"first\" | undefined>(undefined);\n\n const plan = useMemo(() => (definition ? recordPlan(definition, { fields, key: recordKey?.column, version, record }) : undefined), [definition, fields, recordKey?.column, version, record]);\n const form = useMemo(() => create(FormDefinitionSchema, { fields: definition?.args ?? [] }), [definition]);\n const current: JsonObject = { ...Object.fromEntries(Object.entries(record ?? {}).filter(([name]) => plan?.editable.some((field) => field.name === name))), ...draft };\n const visible = (plan?.shown ?? []).filter((entry) => entry.kind === \"column\" || fieldAsked(form, entry.field, current));\n const fieldNames = new Set(visible.flatMap((entry) => (entry.kind === \"field\" ? [entry.field.name] : [])));\n const labelOf = (name: string) => definition?.args.find((field) => field.name === name)?.label || name;\n\n const inputOf = (name: string) => [...(box.current?.querySelectorAll<HTMLElement>(\"[data-field]\") ?? [])].find((element) => element.dataset.field === name)?.querySelector<HTMLElement>(\"input, select, textarea\");\n // One thing wrong: focus goes to it. Several: to the list of them, which links to each.\n useEffect(() => {\n if (errors.at === 0) return;\n const names = Object.keys(errors.by);\n if (names.length === 1 && fieldNames.has(names[0]!)) inputOf(names[0]!)?.focus();\n else summary.current?.focus();\n }, [errors.at]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(() => {\n const to = moveTo.current;\n moveTo.current = undefined;\n if (to === \"edit\") editButton.current?.focus();\n else if (to === \"first\") box.current?.querySelector<HTMLElement>(\"[data-field] input, [data-field] select, [data-field] textarea\")?.focus();\n }, [mode]);\n\n // The answer to a save, once: what the server refused, or that it is done.\n const answered = useRef<string | undefined>(undefined);\n const sent = useRef<string[]>([]);\n useEffect(() => {\n if (!save || save.at === answered.current || save.status === \"running\" || save.status === \"approving\") return;\n answered.current = save.at;\n if (save.status === \"invalid\") {\n const by = save.errors ?? {};\n const count = Object.keys(by).length;\n setErrors({ at: Date.now(), by });\n setNote({ kind: \"attention\", text: count === 1 ? text(\"record.notSavedOne\") : text(\"record.notSaved\", { count }) });\n } else if (save.status === \"done\" || save.status === \"partial\") {\n setErrors({ at: 0, by: {} });\n setDraft({});\n setCompare(false);\n setNote({ kind: \"saved\", text: save.message || text(\"record.saved\") });\n setReloads((count) => count + 1);\n props.onContext?.({ kind: isNew ? \"record.created\" : \"record.saved\", summary: isNew ? `Created a ${label} record.` : `Saved changes to ${label}: ${sent.current.map(labelOf).join(\", \") || \"no fields\"}.`, subject: { record: label, fields: sent.current } });\n if (props.mode === \"read\") {\n moveTo.current = \"edit\";\n setMode(\"read\");\n }\n } else {\n // Refused, stale or failed: said beside the button, and whatever an earlier answer said about a field no longer stands.\n setErrors({ at: 0, by: {} });\n setNote(undefined);\n }\n }, [save?.at, save?.status]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const busy = save?.status === \"running\" || save?.status === \"approving\";\n const change = (name: string, value: JsonValue) => {\n const field = definition?.args.find((candidate) => candidate.name === name);\n if (!field) return;\n setDraft(draftWith(draft, record, field, value));\n if (errors.by[name]) setErrors(({ at, by: { [name]: _gone, ...rest } }) => ({ at: Object.keys(rest).length ? at : 0, by: rest }));\n };\n const submit = (event: FormEvent) => {\n event.preventDefault();\n if (busy || !definition) return;\n if (!isNew && changes === 0) return setNote({ kind: \"unchanged\", text: text(\"record.unchanged\") });\n const plan = recordSave(definition, { record, draft, key: recordKey && keyValue !== null && keyValue !== undefined ? { column: recordKey.column, value: keyValue } : undefined, version });\n const count = Object.keys(plan.errors).length;\n if (!plan.args) {\n setErrors({ at: Date.now(), by: plan.errors });\n setNote({ kind: \"attention\", text: count === 1 ? text(\"record.notSavedOne\") : text(\"record.notSaved\", { count }) });\n return;\n }\n setErrors({ at: 0, by: {} });\n setNote(undefined);\n sent.current = plan.changed;\n props.onSave(plan.args);\n };\n const reread = () => {\n setCompare(true);\n setReloads((count) => count + 1);\n props.onReread?.();\n };\n\n const className = [\"sf-form\", \"sf-record\", props.className].filter(Boolean).join(\" \");\n if (reading.status === \"missing\" || reading.status === \"many\" || reading.status === \"failed\") {\n return (\n <div className={className} data-record={reading.status}>\n <div className=\"sf-record-missing\" role=\"alert\" data-error={reading.status === \"failed\" ? reading.error : undefined}>\n <p>{reading.status === \"missing\" ? text(\"record.notFound\", { label }) : reading.status === \"many\" ? text(\"record.many\") : (props.errorMessage ?? text(\"record.unread\"))}</p>\n {props.back && (\n <p>\n <a className=\"sf-a2-link\" href={props.back.href} onClick={props.back.onClick}>\n {props.back.label ?? text(\"record.back\")}\n </a>\n </p>\n )}\n </div>\n </div>\n );\n }\n if (definition === null) {\n return (\n <div className={className} data-record=\"undefined\">\n <p className=\"sf-record-missing\" role=\"alert\">\n {text(\"record.noOperation\")}\n </p>\n </div>\n );\n }\n if (!definition || (reading.status === \"loading\" && !record)) {\n return (\n <div className={className} data-record=\"loading\" aria-busy=\"true\">\n <p className=\"sf-form-status\" role=\"status\">\n {text(\"record.reading\")}\n </p>\n </div>\n );\n }\n\n const alert = save && save.at === answered.current && (save.status === \"refused\" || save.status === \"stale\" || save.status === \"failed\") ? save : undefined;\n const alertBox: ReactNode = alert && (\n <div className=\"sf-run-alert\" role=\"alert\" data-status={alert.status}>\n <p>{alert.message}</p>\n {alert.status === \"stale\" && (\n <button type=\"button\" className=\"sf-button\" onClick={reread}>\n {text(\"run.reread\")}\n </button>\n )}\n </div>\n );\n\n if (mode === \"read\") {\n return (\n <div className={className} data-record=\"read\" role=\"group\" aria-label={label}>\n <dl className=\"sf-record-facts\">\n {visible.map((entry) => {\n const name = entry.kind === \"field\" ? entry.field.name : entry.name;\n return (\n <div key={name}>\n <dt>{entry.kind === \"field\" ? entry.field.label || name : entry.label}</dt>\n <dd>{shownValue(record?.[name], entry.kind === \"field\" ? entry.field.type : undefined)}</dd>\n </div>\n );\n })}\n </dl>\n <div className=\"sf-form-actions\">\n <button\n ref={editButton}\n type=\"button\"\n className=\"sf-button\"\n onClick={() => {\n moveTo.current = \"first\";\n setMode(\"edit\");\n }}\n >\n {text(\"record.edit\")}\n </button>\n <p className=\"sf-form-status\" role=\"status\" aria-live=\"polite\">\n {note?.kind === \"saved\" && !props.announced ? note.text : \"\"}\n </p>\n {note?.kind === \"saved\" && props.announced && <p className=\"sf-form-status\">{note.text}</p>}\n </div>\n </div>\n );\n }\n\n const problems = Object.entries(errors.by);\n const listed = problems.length > 1 || problems.some(([name]) => !fieldNames.has(name));\n const quiet = note?.kind === \"saved\" && props.announced;\n return (\n <form ref={box} className={className} data-record=\"edit\" onSubmit={submit} noValidate aria-label={label}>\n {listed && (\n <div ref={summary} className=\"sf-record-summary\" role=\"group\" aria-labelledby={`${formId}-problems`} tabIndex={-1}>\n <p id={`${formId}-problems`} className=\"sf-record-summary-title\">\n {problems.length === 1 ? text(\"record.problemsOne\") : text(\"record.problems\", { count: problems.length })}\n </p>\n <ul>\n {problems.map(([name, message]) => (\n <li key={name}>\n {fieldNames.has(name) ? (\n <a\n href={`#${formId}-${name}`}\n onClick={(event) => {\n event.preventDefault();\n inputOf(name)?.focus();\n }}\n >\n {`${labelOf(name)}: ${message}`}\n </a>\n ) : (\n `${labelOf(name)}: ${message}`\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n {visible.map((entry) => {\n if (entry.kind === \"column\") {\n return (\n <dl key={entry.name} className=\"sf-record-facts\">\n <div>\n <dt>{entry.label}</dt>\n <dd>{shownValue(record?.[entry.name])}</dd>\n </div>\n </dl>\n );\n }\n const spec = fieldSpec(entry.field);\n const name = spec.name;\n // After a stale save was read again, a changed field says what is saved now, so the person can compare.\n const was = compare && record && Object.hasOwn(draft, name) ? text(\"record.savedValue\", { value: shownValue(record[name], entry.field.type) }) : \"\";\n return (\n <div key={name} id={`${formId}-${name}`} className=\"sf-record-field\" data-field={name} data-changed={Object.hasOwn(draft, name) || undefined}>\n <FieldInput field={{ ...spec, help: [spec.help, was].filter(Boolean).join(\" \") || undefined }} value={current[name]} error={errors.by[name]} onChange={(value) => change(name, value)} />\n </div>\n );\n })}\n {alertBox}\n <div className=\"sf-form-actions\">\n <button type=\"submit\" className=\"sf-button\" data-variant=\"primary\" aria-disabled={busy || undefined}>\n {busy ? text(\"record.saving\") : (props.saveLabel ?? text(\"record.save\"))}\n </button>\n {props.mode === \"read\" && (\n <button\n type=\"button\"\n className=\"sf-button\"\n onClick={() => {\n setDraft({});\n setErrors({ at: 0, by: {} });\n setNote(undefined);\n moveTo.current = \"edit\";\n setMode(\"read\");\n }}\n >\n {text(\"record.cancel\")}\n </button>\n )}\n <p className={note?.kind === \"attention\" ? \"sf-form-error\" : \"sf-form-status\"} role=\"status\" aria-live=\"polite\">\n {note && !quiet ? note.text : \"\"}\n </p>\n {quiet && <p className=\"sf-form-status\">{note.text}</p>}\n </div>\n </form>\n );\n}\n"]}
|