@svgrid/enterprise 3.1.21 → 3.1.23

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.
Files changed (89) hide show
  1. package/dist/SvGridBoard.svelte +39 -0
  2. package/dist/SvGridGallery.svelte +23 -0
  3. package/dist/SvGridRowCount.svelte +23 -0
  4. package/dist/SvGridRowCount.svelte.d.ts +6 -0
  5. package/dist/SvGridScheduler.svelte +25 -7
  6. package/dist/cdn/svgrid-enterprise.svelte-external.js +13838 -13554
  7. package/dist/designer/assets/GridFooter-DKMfZpL4.js +2 -0
  8. package/dist/designer/assets/GridMenus-DWDghydL.js +6 -0
  9. package/dist/designer/assets/{PinSplitter-C5AwA1xV.js → PinSplitter-BfIjd7pi.js} +1 -1
  10. package/dist/designer/assets/grid-extension.svelte-G1ng0xd2.js +1 -0
  11. package/dist/designer/assets/index-CHx3F4Ij.css +1 -0
  12. package/dist/designer/assets/{index-DLJjuVA4.js → index-CIxqRzKJ.js} +324 -324
  13. package/dist/designer/assets/merges-Bg-KqPEl.js +1 -0
  14. package/dist/designer/index.html +3 -3
  15. package/dist/expressions/compile.js +11 -7
  16. package/dist/expressions/evaluate.js +4 -0
  17. package/dist/expressions/expression-columns.d.ts +4 -1
  18. package/dist/expressions/expression-columns.js +12 -3
  19. package/dist/expressions/parse.js +19 -7
  20. package/dist/fields/RecordView.svelte +5 -2
  21. package/dist/fields/activity.svelte.d.ts +5 -2
  22. package/dist/fields/activity.svelte.js +4 -3
  23. package/dist/fields/grid-access.d.ts +1 -1
  24. package/dist/fields/grid-access.js +13 -3
  25. package/dist/fields/index.d.ts +18 -0
  26. package/dist/fields/index.js +31 -0
  27. package/dist/filter-labels.d.ts +16 -0
  28. package/dist/filter-labels.js +83 -0
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.js +7 -0
  31. package/dist/install.js +8 -0
  32. package/dist/node/studio.js +12 -5
  33. package/dist/relative-date-core.d.ts +40 -0
  34. package/dist/relative-date-core.js +85 -0
  35. package/dist/relative-dates.d.ts +28 -0
  36. package/dist/relative-dates.js +61 -0
  37. package/dist/review/GhostCell.svelte +60 -0
  38. package/dist/review/GhostCell.svelte.d.ts +14 -0
  39. package/dist/review/RichCellMark.svelte +72 -0
  40. package/dist/review/RichCellMark.svelte.d.ts +8 -0
  41. package/dist/review/SvReviewPanel.svelte +759 -0
  42. package/dist/review/SvReviewPanel.svelte.d.ts +16 -0
  43. package/dist/review/adapters.d.ts +79 -0
  44. package/dist/review/adapters.js +119 -0
  45. package/dist/review/agent.d.ts +52 -0
  46. package/dist/review/agent.js +232 -0
  47. package/dist/review/card-marks.svelte.d.ts +42 -0
  48. package/dist/review/card-marks.svelte.js +51 -0
  49. package/dist/review/cluster.d.ts +26 -0
  50. package/dist/review/cluster.js +377 -0
  51. package/dist/review/equal.d.ts +9 -0
  52. package/dist/review/equal.js +35 -0
  53. package/dist/review/formats.d.ts +31 -0
  54. package/dist/review/formats.js +37 -0
  55. package/dist/review/ghost.d.ts +17 -0
  56. package/dist/review/ghost.js +104 -0
  57. package/dist/review/index.d.ts +42 -0
  58. package/dist/review/index.js +36 -0
  59. package/dist/review/messages.d.ts +113 -0
  60. package/dist/review/messages.js +135 -0
  61. package/dist/review/model.svelte.d.ts +262 -0
  62. package/dist/review/model.svelte.js +883 -0
  63. package/dist/review/pending-filter.d.ts +26 -0
  64. package/dist/review/pending-filter.js +71 -0
  65. package/dist/review/rich-cells.d.ts +1 -0
  66. package/dist/review/rich-cells.js +36 -0
  67. package/dist/review/types.d.ts +83 -0
  68. package/dist/review/types.js +7 -0
  69. package/dist/row-count.d.ts +28 -0
  70. package/dist/row-count.js +39 -0
  71. package/dist/sort-blanks.d.ts +8 -0
  72. package/dist/sort-blanks.js +47 -0
  73. package/dist/studio/ui-components.generated.js +1 -1
  74. package/dist/upgrade-prompt.d.ts +1 -1
  75. package/dist/version.d.ts +2 -2
  76. package/dist/version.js +2 -2
  77. package/dist/wc/GridFooter-CKC4L36O.js +162 -0
  78. package/dist/wc/{GridMenus-DVGuqp2l.js → GridMenus-h7RsvcmI.js} +320 -303
  79. package/dist/wc/{PinSplitter-Btco0txr.js → PinSplitter-BN6ybmjs.js} +1 -1
  80. package/dist/wc/grid-extension.svelte-CDf5EUyz.js +27 -0
  81. package/dist/wc/merges-DQTOlMWM.js +109 -0
  82. package/dist/wc/sv-sheet-element.js +6753 -6792
  83. package/package.json +9 -3
  84. package/dist/designer/assets/GridFooter-CKBVItAU.js +0 -2
  85. package/dist/designer/assets/GridMenus-Dzwu7M9r.js +0 -6
  86. package/dist/designer/assets/grid-extension.svelte-BZ7AqyJI.js +0 -1
  87. package/dist/designer/assets/index-WCxj6WfJ.css +0 -1
  88. package/dist/wc/GridFooter-BgoA77TJ.js +0 -145
  89. package/dist/wc/grid-extension.svelte-CucBS4FL.js +0 -20
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @svgrid/enterprise/review - change review. Writes nobody typed (AI helper
3
+ * results, agent edits, imports, syncs) arrive as proposals held apart from
4
+ * the data, grouped by the transformation they apply, and are accepted or
5
+ * rejected a group at a time. Accepted values are written to the app's data,
6
+ * a cell that changed since the proposal was made is never overwritten, and
7
+ * every decision is one Ctrl+Z.
8
+ *
9
+ * ```svelte
10
+ * <script lang="ts">
11
+ * import { SvGrid } from '@svgrid/grid'
12
+ * import { createReview, reviewSmartFill, SvReviewPanel } from '@svgrid/enterprise/review'
13
+ *
14
+ * let rows = $state(initialRows)
15
+ * let api = $state()
16
+ * const review = createReview({ api: () => api, setRows: (next) => (rows = next) })
17
+ * </script>
18
+ *
19
+ * <SvGrid data={rows} columns={review.columns(columns)} getRowId={(r) => r.id}
20
+ * conditionalFormats={review.formats} onApiReady={(a) => (api = a)} />
21
+ * <SvReviewPanel {review} />
22
+ * ```
23
+ *
24
+ * Adds nothing to `@svgrid/grid`: the tint is `conditionalFormats`, the
25
+ * proposed value is a wrapped `cell`, the undo step is the public command
26
+ * context.
27
+ */
28
+ export { createReview } from './model.svelte.js';
29
+ export { createGridTools, registerWebMcpTools } from './agent.js';
30
+ export { clusterProposals, showValue } from './cluster.js';
31
+ export { sameValue, isBlank } from './equal.js';
32
+ export { REVIEW_MESSAGES } from './messages.js';
33
+ export { pendingFormats, PENDING_BG, PENDING_ICON, CONFLICT_BG, CONFLICT_ICON } from './formats.js';
34
+ export { canGhost } from './ghost.js';
35
+ export { fromSmartFill, fromClassify, fromRows, fromStaged, reviewSmartFill, reviewClassify, blankTargets } from './adapters.js';
36
+ export { default as SvReviewPanel } from './SvReviewPanel.svelte';
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Every string change review shows: the panel, the group labels, the card and
3
+ * cell marks. English defaults; pass any subset as `createReview({ messages })`
4
+ * (and `<SvReviewPanel messages>` for one panel), unset keys stay English. The
5
+ * idiom of the grid's own `localization.text`: a flat map, `{name}`
6
+ * placeholders. Kept free of imports: the clustering uses it in plain Node.
7
+ */
8
+ export declare const REVIEW_MESSAGES: {
9
+ title: string;
10
+ decided: string;
11
+ pendingInGroups: string;
12
+ pendingInOneGroup: string;
13
+ nothingPending: string;
14
+ inConflict: string;
15
+ acceptAll: string;
16
+ rejectAll: string;
17
+ acceptRuleGroups: string;
18
+ resolveFirst: string;
19
+ onlyRowsWithChanges: string;
20
+ confirmAcceptGroup: string;
21
+ confirmRejectGroup: string;
22
+ confirmAcceptAll: string;
23
+ confirmRejectAll: string;
24
+ confirmAcceptRules: string;
25
+ confirmYes: string;
26
+ cancel: string;
27
+ conflictsTitle: string;
28
+ conflictCell: string;
29
+ keep: string;
30
+ badgeRule: string;
31
+ hintRule: string;
32
+ hintMapping: string;
33
+ hintFill: string;
34
+ hintConstant: string;
35
+ hintEach: string;
36
+ oneChange: string;
37
+ changes: string;
38
+ sure: string;
39
+ sureRange: string;
40
+ accept: string;
41
+ reject: string;
42
+ acceptGroupLabel: string;
43
+ rejectGroupLabel: string;
44
+ from: string;
45
+ otherValues: string;
46
+ sampleOf: string;
47
+ everyChange: string;
48
+ firstN: string;
49
+ showRow: string;
50
+ rowId: string;
51
+ acceptOne: string;
52
+ rejectOne: string;
53
+ showAll: string;
54
+ keysHint: string;
55
+ showInGrid: string;
56
+ nextInGrid: string;
57
+ hiddenRows: string;
58
+ allReviewed: string;
59
+ reviewedSummary: string;
60
+ reviewedStale: string;
61
+ noProposals: string;
62
+ noProposalsHint: string;
63
+ notWritten: string;
64
+ rowField: string;
65
+ decidedLabel: string;
66
+ noteCellChanged: string;
67
+ noteRowGone: string;
68
+ noteRowEditing: string;
69
+ noteGridNotReady: string;
70
+ noteSavedStale: string;
71
+ noteConflict: string;
72
+ undoHint: string;
73
+ announceAccepted: string;
74
+ announceRejected: string;
75
+ announceStale: string;
76
+ announceSkipped: string;
77
+ announceCommittedStale: string;
78
+ announceNotSaved: string;
79
+ announceNothing: string;
80
+ undoFailed: string;
81
+ redoFailed: string;
82
+ cardProposed: string;
83
+ proposes: string;
84
+ nowValue: string;
85
+ empty: string;
86
+ labelWhitespace: string;
87
+ labelCase: string;
88
+ caseUpper: string;
89
+ caseLower: string;
90
+ caseTitle: string;
91
+ caseMixed: string;
92
+ labelToNumber: string;
93
+ labelDates: string;
94
+ datesAsDates: string;
95
+ labelShape: string;
96
+ labelPunct: string;
97
+ punctRemove: string;
98
+ punctAdd: string;
99
+ punctSpaces: string;
100
+ labelDivide: string;
101
+ labelMultiply: string;
102
+ labelMapping: string;
103
+ mappingValues: string;
104
+ labelFill: string;
105
+ labelFillVarious: string;
106
+ labelConstant: string;
107
+ labelUnpatterned: string;
108
+ };
109
+ export type ReviewMessages = typeof REVIEW_MESSAGES;
110
+ /** English, with `overrides` laid over it (blank values ignored). */
111
+ export declare function reviewMessages(...overrides: Array<Partial<ReviewMessages> | null | undefined>): ReviewMessages;
112
+ /** A template with its `{name}` placeholders filled. */
113
+ export declare function fill(template: string, vars: Record<string, string | number>): string;
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Every string change review shows: the panel, the group labels, the card and
3
+ * cell marks. English defaults; pass any subset as `createReview({ messages })`
4
+ * (and `<SvReviewPanel messages>` for one panel), unset keys stay English. The
5
+ * idiom of the grid's own `localization.text`: a flat map, `{name}`
6
+ * placeholders. Kept free of imports: the clustering uses it in plain Node.
7
+ */
8
+ export const REVIEW_MESSAGES = {
9
+ // Panel header
10
+ title: 'Review changes',
11
+ decided: '{decided} of {total} decided',
12
+ pendingInGroups: '{count} pending in {groups} groups',
13
+ pendingInOneGroup: '{count} pending in 1 group',
14
+ nothingPending: 'Nothing pending',
15
+ inConflict: ', {count} in conflict',
16
+ acceptAll: 'Accept all',
17
+ rejectAll: 'Reject all',
18
+ acceptRuleGroups: 'Accept rule groups ({count})',
19
+ resolveFirst: 'Resolve the conflicts before accepting everything.',
20
+ onlyRowsWithChanges: 'Only rows with changes',
21
+ // Confirm
22
+ confirmAcceptGroup: 'Accept {count} changes: {label}?',
23
+ confirmRejectGroup: 'Reject {count} changes: {label}?',
24
+ confirmAcceptAll: 'Accept all {count} changes?',
25
+ confirmRejectAll: 'Reject all {count} changes?',
26
+ confirmAcceptRules: 'Accept {groups} rule groups ({count} changes)?',
27
+ confirmYes: 'Yes, {count}',
28
+ cancel: 'Cancel',
29
+ // Conflicts
30
+ conflictsTitle: 'Two sources disagree',
31
+ conflictCell: '{row}, {field}: now {value}',
32
+ keep: 'Keep {value}',
33
+ // Groups
34
+ badgeRule: 'Rule',
35
+ hintRule: 'Every change in this group follows the rule.',
36
+ hintMapping: 'Check the mapping before accepting.',
37
+ hintFill: 'Check the sample: the least sure ones come first.',
38
+ hintConstant: 'Many different values set to one: check what they were.',
39
+ hintEach: 'No shared pattern: look at each change.',
40
+ oneChange: '{count} change',
41
+ changes: '{count} changes',
42
+ sure: '{pct} sure',
43
+ sureRange: '{min} to {avg} sure',
44
+ accept: 'Accept',
45
+ reject: 'Reject',
46
+ acceptGroupLabel: 'Accept {count}: {label}',
47
+ rejectGroupLabel: 'Reject {count}: {label}',
48
+ from: 'From',
49
+ otherValues: 'other values',
50
+ sampleOf: 'Sample of {count}',
51
+ everyChange: 'Every change',
52
+ firstN: 'First {count}',
53
+ showRow: 'Show {row} in the grid',
54
+ rowId: 'Row {row}',
55
+ acceptOne: 'Accept this change',
56
+ rejectOne: 'Reject this change',
57
+ showAll: 'Show all {count}',
58
+ keysHint: 'J / K move between groups, Enter opens one, A accepts it, R rejects it.',
59
+ showInGrid: 'Show in grid',
60
+ nextInGrid: 'Next in grid',
61
+ hiddenRows: '{count} hidden by filters or grouping',
62
+ // Empty and done
63
+ allReviewed: 'All {count} reviewed',
64
+ reviewedSummary: '{accepted} accepted, {rejected} rejected',
65
+ reviewedStale: ', {count} not written because the cell changed',
66
+ noProposals: 'No proposals yet',
67
+ noProposalsHint: 'Edits an agent, an import or an AI helper proposes show up here, grouped by what they change.',
68
+ notWritten: '{count} not written',
69
+ rowField: '{row}, {field}',
70
+ decidedLabel: 'Decided',
71
+ // Why a proposal was not written or is waiting (shown in the panel)
72
+ noteCellChanged: 'the cell changed after this was proposed',
73
+ noteRowGone: 'the row no longer exists',
74
+ noteRowEditing: 'the row is being edited',
75
+ noteGridNotReady: 'the grid is not ready',
76
+ noteSavedStale: 'saved, but the cell changed before it was written here',
77
+ noteConflict: 'another source proposed a different value',
78
+ undoHint: 'Ctrl+Z in the grid undoes the last decision.',
79
+ // Announced after a decision
80
+ announceAccepted: '{count} accepted',
81
+ announceRejected: '{count} rejected',
82
+ announceStale: '{count} not written: the cell changed',
83
+ announceSkipped: '{count} left pending',
84
+ announceCommittedStale: '{count} saved but not shown: the cell changed while saving',
85
+ announceNotSaved: 'not saved: {error}',
86
+ announceNothing: 'Nothing to decide',
87
+ undoFailed: 'Undo not saved: {error}',
88
+ redoFailed: 'Redo not saved: {error}',
89
+ // Marks
90
+ cardProposed: '{count} proposed',
91
+ proposes: '{source} proposes {value}',
92
+ nowValue: 'Now: {value}',
93
+ empty: '(empty)',
94
+ // Group labels ({field} is the column header)
95
+ labelWhitespace: 'Trim spaces in {field}',
96
+ labelCase: 'Change {field} to {case}',
97
+ caseUpper: 'UPPER CASE',
98
+ caseLower: 'lower case',
99
+ caseTitle: 'Title Case',
100
+ caseMixed: 'a different case',
101
+ labelToNumber: 'Convert {field} text to numbers',
102
+ labelDates: 'Reformat {field} dates as {shape}',
103
+ datesAsDates: 'dates',
104
+ labelShape: 'Reformat {field} as {shape}',
105
+ labelPunct: '{change} in {field}',
106
+ punctRemove: 'remove {chars}',
107
+ punctAdd: 'add {chars}',
108
+ punctSpaces: 'spaces',
109
+ labelDivide: 'Divide {field} by {n}',
110
+ labelMultiply: 'Multiply {field} by {n}',
111
+ labelMapping: '{field}: {from} → {to}',
112
+ mappingValues: '{count} values',
113
+ labelFill: 'Fill empty {field} with {value}',
114
+ labelFillVarious: 'Fill empty {field} (different values)',
115
+ labelConstant: 'Set {field} to {value}',
116
+ labelUnpatterned: '{field}: no shared pattern',
117
+ };
118
+ /** English, with `overrides` laid over it (blank values ignored). */
119
+ export function reviewMessages(...overrides) {
120
+ const out = { ...REVIEW_MESSAGES };
121
+ for (const o of overrides) {
122
+ if (!o)
123
+ continue;
124
+ for (const k in o) {
125
+ const v = o[k];
126
+ if (v != null && v !== '')
127
+ out[k] = v;
128
+ }
129
+ }
130
+ return out;
131
+ }
132
+ /** A template with its `{name}` placeholders filled. */
133
+ export function fill(template, vars) {
134
+ return template.replace(/\{(\w+)\}/g, (whole, key) => (key in vars ? String(vars[key]) : whole));
135
+ }
@@ -0,0 +1,262 @@
1
+ /**
2
+ * A change review: proposals held apart from the grid's data until a person
3
+ * accepts them, grouped for review, written to the app's data on accept, and
4
+ * undone with one Ctrl+Z per decision.
5
+ *
6
+ * ```svelte
7
+ * <script lang="ts">
8
+ * import { createReview, SvReviewPanel } from '@svgrid/enterprise/review'
9
+ * let orders = $state(initial)
10
+ * let api = $state()
11
+ * const review = createReview({ api: () => api, setRows: (next) => (orders = next) })
12
+ * review.add({ source: { kind: 'agent', id: 'cleanup', label: 'Cleanup agent' }, proposals })
13
+ * </script>
14
+ *
15
+ * <SvGrid data={orders} columns={review.columns(columns)} getRowId={(r) => r.id}
16
+ * conditionalFormats={review.formats} onApiReady={(a) => (api = a)} />
17
+ * <SvReviewPanel {review} />
18
+ * ```
19
+ *
20
+ * Why the app's data and not the grid's writers: `api.setCellValue` and the
21
+ * command context write by view index into the grid's own copy, which the
22
+ * next `data` prop discards. Reads go through `api.getData()` instead, which
23
+ * includes the grid's own writes (paste, fill, addRows), so `next` carries
24
+ * them forward. `setRows` must apply synchronously.
25
+ */
26
+ import type { ConditionalFormat, SvGridApi } from '@svgrid/grid';
27
+ import { type ClusterOptions } from './cluster.js';
28
+ import { type ReviewMessages } from './messages.js';
29
+ import type { ChangeSet, Proposal, ProposalGroup, ProposalInput, ProposalSource } from './types.js';
30
+ /** The part of the grid api a review uses. Any `SvGridApi` satisfies it. */
31
+ export type ReviewGridApi = Pick<SvGridApi<any, any>, 'getData' | 'getOption' | 'getActiveCell' | 'getRowId' | 'getColumns' | 'getCommandContext' | 'stopEditing' | 'scrollToRow' | 'getDisplayedRows' | 'getAdvancedFilter' | 'setAdvancedFilter' | 'getRowPosition' | 'getPageInfo' | 'setPage' | 'getState'>;
32
+ export type ReviewOptions<TData> = {
33
+ /** The grid api, or a getter for it (it is bound after mount). */
34
+ api: ReviewGridApi | (() => ReviewGridApi | undefined | null);
35
+ /** Replace the app's rows. Required unless `server` is set. Must apply synchronously. */
36
+ setRows?: (next: TData[]) => void;
37
+ /**
38
+ * Server row model: the controller passed to the grid as `rowModel`.
39
+ * Accept and undo commit through `onCommit` and then refresh it.
40
+ */
41
+ server?: {
42
+ refresh(): void;
43
+ };
44
+ /** Persist accepted values. Reject (throw) to keep them pending. Required with `server`. */
45
+ onCommit?: (accepted: Proposal[]) => void | Promise<void>;
46
+ /** Who decides, stamped on each decided proposal. */
47
+ user?: string;
48
+ cluster?: ClusterOptions;
49
+ /** Wording of everything the review shows (panel, group labels, marks); English by default. */
50
+ messages?: Partial<ReviewMessages>;
51
+ /**
52
+ * Called after every decision, its undo and its redo, with copies of the
53
+ * proposals it moved. Write these to an audit log of your own.
54
+ */
55
+ onDecision?: (decision: ReviewDecision) => void;
56
+ /**
57
+ * Called as accepted values (or an undo / redo of them) are written, with
58
+ * the proposals and the new rows just before they go to `setRows`, so
59
+ * bookkeeping that edits a row lands in the same write. SvGrid Base stamps
60
+ * "last modified" and notes the record's activity with
61
+ * `baseReviewApplied(api)` from `@svgrid/enterprise/base`. With a server
62
+ * row model there are no rows to edit: `rows` is undefined.
63
+ */
64
+ onApply?: (applied: Proposal[], how: 'accept' | 'undo' | 'redo', rows?: TData[]) => void;
65
+ /**
66
+ * An undo or redo whose `onCommit` failed: nothing was written and the
67
+ * decision stands. Also kept as `review.lastError`, which the panel announces.
68
+ */
69
+ onError?: (error: unknown, during: 'undo' | 'redo') => void;
70
+ /**
71
+ * What names a row on the panel's lines, such as its company, so a reviewer
72
+ * knows whose record a change is in. Default: the row's first visible text
73
+ * column, left out when that column is the one the change is to.
74
+ */
75
+ rowLabel?: (row: TData) => string | null | undefined;
76
+ };
77
+ export type ReviewDecision = {
78
+ action: 'accept' | 'reject' | 'undo' | 'redo';
79
+ /** For undo / redo: which decision was undone or redone. */
80
+ of?: 'accept' | 'reject';
81
+ proposals: Proposal[];
82
+ by?: string;
83
+ at: number;
84
+ };
85
+ export type ReviewOutcome = {
86
+ accepted: string[];
87
+ rejected: string[];
88
+ /** The cell changed since the proposal was made, or its row is gone. Never written. */
89
+ stale: string[];
90
+ /** Left pending: the row is being edited, the proposal is already being accepted, or the grid is not ready. */
91
+ skipped: string[];
92
+ /**
93
+ * Saved by `onCommit`, then not written here because the cell changed while
94
+ * it was saving. The backend holds the proposed value; reload or save the
95
+ * cell's value back.
96
+ */
97
+ committedStale: string[];
98
+ /** What `onCommit` threw; nothing was written and the proposals stay pending. */
99
+ error?: unknown;
100
+ };
101
+ export type AddInput = {
102
+ source: ProposalSource;
103
+ title?: string;
104
+ id?: string;
105
+ proposals: ReadonlyArray<ProposalInput>;
106
+ };
107
+ export type ReviewJSON = {
108
+ v: 1;
109
+ sets: ChangeSet[];
110
+ };
111
+ export type Review<TData = unknown> = ReturnType<typeof createReview<TData>>;
112
+ export declare function createReview<TData = unknown>(opts: ReviewOptions<TData>): {
113
+ readonly version: number;
114
+ /** The wording in effect: English with `messages` laid over it. */
115
+ messages: {
116
+ title: string;
117
+ decided: string;
118
+ pendingInGroups: string;
119
+ pendingInOneGroup: string;
120
+ nothingPending: string;
121
+ inConflict: string;
122
+ acceptAll: string;
123
+ rejectAll: string;
124
+ acceptRuleGroups: string;
125
+ resolveFirst: string;
126
+ onlyRowsWithChanges: string;
127
+ confirmAcceptGroup: string;
128
+ confirmRejectGroup: string;
129
+ confirmAcceptAll: string;
130
+ confirmRejectAll: string;
131
+ confirmAcceptRules: string;
132
+ confirmYes: string;
133
+ cancel: string;
134
+ conflictsTitle: string;
135
+ conflictCell: string;
136
+ keep: string;
137
+ badgeRule: string;
138
+ hintRule: string;
139
+ hintMapping: string;
140
+ hintFill: string;
141
+ hintConstant: string;
142
+ hintEach: string;
143
+ oneChange: string;
144
+ changes: string;
145
+ sure: string;
146
+ sureRange: string;
147
+ accept: string;
148
+ reject: string;
149
+ acceptGroupLabel: string;
150
+ rejectGroupLabel: string;
151
+ from: string;
152
+ otherValues: string;
153
+ sampleOf: string;
154
+ everyChange: string;
155
+ firstN: string;
156
+ showRow: string;
157
+ rowId: string;
158
+ acceptOne: string;
159
+ rejectOne: string;
160
+ showAll: string;
161
+ keysHint: string;
162
+ showInGrid: string;
163
+ nextInGrid: string;
164
+ hiddenRows: string;
165
+ allReviewed: string;
166
+ reviewedSummary: string;
167
+ reviewedStale: string;
168
+ noProposals: string;
169
+ noProposalsHint: string;
170
+ notWritten: string;
171
+ rowField: string;
172
+ decidedLabel: string;
173
+ noteCellChanged: string;
174
+ noteRowGone: string;
175
+ noteRowEditing: string;
176
+ noteGridNotReady: string;
177
+ noteSavedStale: string;
178
+ noteConflict: string;
179
+ undoHint: string;
180
+ announceAccepted: string;
181
+ announceRejected: string;
182
+ announceStale: string;
183
+ announceSkipped: string;
184
+ announceCommittedStale: string;
185
+ announceNotSaved: string;
186
+ announceNothing: string;
187
+ undoFailed: string;
188
+ redoFailed: string;
189
+ cardProposed: string;
190
+ proposes: string;
191
+ nowValue: string;
192
+ empty: string;
193
+ labelWhitespace: string;
194
+ labelCase: string;
195
+ caseUpper: string;
196
+ caseLower: string;
197
+ caseTitle: string;
198
+ caseMixed: string;
199
+ labelToNumber: string;
200
+ labelDates: string;
201
+ datesAsDates: string;
202
+ labelShape: string;
203
+ labelPunct: string;
204
+ punctRemove: string;
205
+ punctAdd: string;
206
+ punctSpaces: string;
207
+ labelDivide: string;
208
+ labelMultiply: string;
209
+ labelMapping: string;
210
+ mappingValues: string;
211
+ labelFill: string;
212
+ labelFillVarious: string;
213
+ labelConstant: string;
214
+ labelUnpatterned: string;
215
+ };
216
+ /** The last undo or redo whose save failed, or null. */
217
+ readonly lastError: {
218
+ error: unknown;
219
+ during: "undo" | "redo";
220
+ at: number;
221
+ } | null;
222
+ add: (input: AddInput) => ChangeSet;
223
+ get: (id: string) => Proposal | undefined;
224
+ proposals: () => Proposal[];
225
+ /** What names the proposal's row (`rowLabel`), or null. */
226
+ rowLabel: (p: Proposal) => string | null;
227
+ /** A field's column header, as the group labels show it. */
228
+ fieldLabel: (field: string) => string;
229
+ pending: () => Proposal[];
230
+ conflicts: () => Proposal[];
231
+ groups: () => ProposalGroup[];
232
+ pendingFor: (rowId: string, field: string) => Proposal | undefined;
233
+ accept: (ids: ReadonlyArray<string>) => Promise<ReviewOutcome>;
234
+ reject: (ids: ReadonlyArray<string>) => ReviewOutcome;
235
+ acceptGroup: (key: string, shownIds: ReadonlyArray<string>) => Promise<ReviewOutcome>;
236
+ rejectGroup: (key: string, shownIds: ReadonlyArray<string>) => ReviewOutcome;
237
+ resolveConflict: (keepId: string) => void;
238
+ readonly formats: ConditionalFormat<any>[];
239
+ columns: <C extends ReadonlyArray<any>>(cols: C) => C;
240
+ reveal: (ids: ReadonlyArray<string>, fromId?: string) => {
241
+ id: string | null;
242
+ hidden: number;
243
+ };
244
+ showPendingOnly: (on: boolean) => void;
245
+ /** On while our condition is in the grid's advanced filter (the grid's own Clear takes it out too). */
246
+ readonly pendingOnly: boolean;
247
+ toJSON: (opts?: {
248
+ setIds?: ReadonlyArray<string>;
249
+ }) => ReviewJSON;
250
+ load: (json: ReviewJSON) => {
251
+ dropped: number;
252
+ };
253
+ merge: (json: ReviewJSON) => {
254
+ dropped: number;
255
+ };
256
+ log: () => Proposal[];
257
+ revertSet: (setId: string) => ChangeSet | null;
258
+ sets: () => Array<Omit<ChangeSet, "proposals"> & {
259
+ count: number;
260
+ }>;
261
+ clear: () => void;
262
+ };