@constructive-io/sheets 0.13.0 → 0.14.1
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/README.md +10 -1
- package/dist/advanced.cjs +555 -680
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +4 -4
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.js +2 -2
- package/dist/{chunk-PZL2BCWF.js → chunk-6Y7CZ5VS.js} +2 -2
- package/dist/chunk-6Y7CZ5VS.js.map +1 -0
- package/dist/{chunk-26J3DVW7.js → chunk-BGL6EBTE.js} +116 -173
- package/dist/chunk-BGL6EBTE.js.map +1 -0
- package/dist/{chunk-MXVNIKES.js → chunk-BYAYBXVB.js} +2 -2
- package/dist/{chunk-CBXNKMN6.js → chunk-ER3FIDK7.js} +444 -458
- package/dist/chunk-ER3FIDK7.js.map +1 -0
- package/dist/chunk-GZM2CSTR.js +279 -0
- package/dist/chunk-GZM2CSTR.js.map +1 -0
- package/dist/{chunk-H5HR5HUJ.js → chunk-YJZFHL2D.js} +1 -1
- package/dist/chunk-YJZFHL2D.js.map +1 -0
- package/dist/{date-editor-ZFNDKYBD.js → date-editor-G26WKILO.js} +2 -2
- package/dist/{grid-cell-types-Pbe2m2tE.d.ts → grid-cell-types-C2-ocDS7.d.cts} +45 -5
- package/dist/{grid-cell-types-Pbe2m2tE.d.cts → grid-cell-types-C2-ocDS7.d.ts} +45 -5
- package/dist/index.cjs +789 -607
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -112
- package/dist/index.d.ts +106 -112
- package/dist/index.js +234 -134
- package/dist/index.js.map +1 -1
- package/dist/{sheets-context-Cu3Ec_ca.d.ts → sheets-context-CHUVJCff.d.ts} +32 -31
- package/dist/{sheets-context-CY1RmDKL.d.cts → sheets-context-C_MkTxXm.d.cts} +32 -31
- package/dist/testing.cjs +128 -57
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +16 -4
- package/dist/testing.js.map +1 -1
- package/package.json +5 -4
- package/dist/chunk-26J3DVW7.js.map +0 -1
- package/dist/chunk-CBXNKMN6.js.map +0 -1
- package/dist/chunk-H5HR5HUJ.js.map +0 -1
- package/dist/chunk-HETVHNMD.js +0 -123
- package/dist/chunk-HETVHNMD.js.map +0 -1
- package/dist/chunk-PZL2BCWF.js.map +0 -1
- /package/dist/{chunk-MXVNIKES.js.map → chunk-BYAYBXVB.js.map} +0 -0
- /package/dist/{date-editor-ZFNDKYBD.js.map → date-editor-G26WKILO.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { MetaQuery } from '@constructive-io/data';
|
|
2
|
+
import { MetaQuery, RowIdentityValue, TableWriteCapability, MetaTable } from '@constructive-io/data';
|
|
3
3
|
|
|
4
4
|
interface FieldMetadata$1 {
|
|
5
5
|
name: string;
|
|
@@ -21,7 +21,7 @@ interface CellTypeResolution {
|
|
|
21
21
|
declare function resolveCellType(fieldName: string, fieldMeta?: FieldMetadata$1): CellTypeResolution;
|
|
22
22
|
declare function isImageField(fieldMeta?: FieldMetadata$1, fieldName?: string): boolean;
|
|
23
23
|
|
|
24
|
-
type CellType = 'text' | 'textarea' | 'email' | 'url' | 'phone' | 'citext' | 'bpchar' | 'number' | 'integer' | 'smallint' | 'decimal' | 'currency' | 'percentage' | 'date' | 'datetime' | 'time' | 'timestamptz' | 'interval' | 'boolean' | 'toggle' | 'bit' | 'json' | 'jsonb' | 'array' | 'text-array' | 'uuid-array' | 'number-array' | 'integer-array' | 'date-array' | 'geometry' | 'geometry-point' | 'geometry-collection' | 'inet' | 'image' | 'file' | 'video' | 'audio' | 'upload' | 'uuid' | 'color' | 'rating' | 'tags' | 'tsvector' | 'origin' | 'relation' | 'unknown';
|
|
24
|
+
type CellType = 'text' | 'textarea' | 'email' | 'url' | 'phone' | 'citext' | 'bpchar' | 'number' | 'integer' | 'smallint' | 'decimal' | 'currency' | 'percentage' | 'date' | 'datetime' | 'time' | 'timestamptz' | 'interval' | 'boolean' | 'toggle' | 'bit' | 'json' | 'jsonb' | 'array' | 'text-array' | 'uuid-array' | 'number-array' | 'integer-array' | 'date-array' | 'geometry' | 'geometry-point' | 'geometry-collection' | 'inet' | 'image' | 'file' | 'video' | 'audio' | 'upload' | 'attachment' | 'uuid' | 'color' | 'rating' | 'tags' | 'tsvector' | 'origin' | 'relation' | 'unknown';
|
|
25
25
|
type CellCategory = 'text' | 'numeric' | 'date' | 'boolean' | 'structured' | 'geometric' | 'network' | 'media' | 'special' | 'other';
|
|
26
26
|
type CellValue = string | number | boolean | Date | null | undefined | Array<any> | Record<string, any>;
|
|
27
27
|
interface FieldMetadata {
|
|
@@ -175,6 +175,12 @@ interface SheetsCell {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
/** Result of submitting a draft row */
|
|
179
|
+
interface DraftSubmitResult {
|
|
180
|
+
/** The created row with its metadata-defined primary-key fields. */
|
|
181
|
+
createdRow: Record<string, unknown> | null;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
type RelationKind = 'belongsTo' | 'hasOne' | 'hasMany' | 'manyToMany';
|
|
179
185
|
interface RelationInfo {
|
|
180
186
|
kind: RelationKind;
|
|
@@ -199,11 +205,45 @@ interface RelationInfoSlice {
|
|
|
199
205
|
}
|
|
200
206
|
declare function buildRelationInfoFromMeta(tableName: string, meta: MetaQuery | undefined): Record<string, RelationInfo> | null;
|
|
201
207
|
|
|
208
|
+
/** A row locator accepted by Sheets CRUD operations. */
|
|
209
|
+
type SheetsRowIdentifier = string | number | Readonly<Record<string, RowIdentityValue>>;
|
|
210
|
+
type SheetsMutationOperation = 'create' | 'update' | 'delete';
|
|
211
|
+
type SheetsRowIdentityResolution = Readonly<{
|
|
212
|
+
status: 'identified';
|
|
213
|
+
/** Backwards-compatible scalar for an ordinary `id` PK; otherwise the PK object. */
|
|
214
|
+
identifier: SheetsRowIdentifier;
|
|
215
|
+
/** GraphQL primary-key input, including renamed and composite keys. */
|
|
216
|
+
primaryKey: Readonly<Record<string, RowIdentityValue>>;
|
|
217
|
+
/** Stable, schema-qualified key used by caches, selection, and editors. */
|
|
218
|
+
key: string;
|
|
219
|
+
}> | Readonly<{
|
|
220
|
+
status: 'unavailable';
|
|
221
|
+
reason: 'no-primary-key' | 'invalid-row';
|
|
222
|
+
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve one server row from `_meta`. The familiar scalar `id` contract is kept
|
|
225
|
+
* for existing adapters, while renamed and composite keys use the full PK input.
|
|
226
|
+
*/
|
|
227
|
+
declare function resolveSheetsRowIdentity(table: MetaTable, row: Readonly<Record<string, unknown>>): SheetsRowIdentityResolution;
|
|
228
|
+
/** Resolve a public CRUD identifier through the same `_meta` identity contract. */
|
|
229
|
+
declare function resolveSheetsIdentifier(table: MetaTable, identifier: SheetsRowIdentifier): SheetsRowIdentityResolution;
|
|
230
|
+
/** Build the PostGraphile connection filter used by `findOne`. */
|
|
231
|
+
declare function sheetsIdentifierToWhere(table: MetaTable, identifier: SheetsRowIdentifier): Record<string, {
|
|
232
|
+
equalTo: RowIdentityValue;
|
|
233
|
+
}> | null;
|
|
234
|
+
/** Use scalar IDs as cache keys for compatibility; use serialized identities otherwise. */
|
|
235
|
+
declare function sheetsIdentifierCacheKey(table: MetaTable, identifier: SheetsRowIdentifier): string | number | null;
|
|
236
|
+
/** Stable TanStack/selection/editor key with an index fallback only for non-writable rows. */
|
|
237
|
+
declare function sheetsRowKey(table: MetaTable, row: Readonly<Record<string, unknown>>, index: number): string;
|
|
238
|
+
declare function getSheetsWriteCapability(table: MetaTable | null): TableWriteCapability | null;
|
|
239
|
+
declare function canRunSheetsMutation(capability: TableWriteCapability | null, operation: SheetsMutationOperation): boolean;
|
|
240
|
+
|
|
202
241
|
interface EditorProps {
|
|
203
242
|
value: unknown;
|
|
204
243
|
cell: SheetsCell;
|
|
205
244
|
colKey: string;
|
|
206
245
|
rowId: string;
|
|
246
|
+
rowIdentifier?: SheetsRowIdentifier | null;
|
|
207
247
|
rowIndex: number;
|
|
208
248
|
tableName?: string;
|
|
209
249
|
fieldMeta?: FieldMetadata$1;
|
|
@@ -224,8 +264,8 @@ interface EditorProps {
|
|
|
224
264
|
onCommitPatch?: (patch: Record<string, unknown>) => void;
|
|
225
265
|
/** Dismiss the overlay with no write. */
|
|
226
266
|
onCancel: () => void;
|
|
227
|
-
/** Self-committing editors: submit a client-side draft row
|
|
228
|
-
onSubmitDraftRow?: (draftRowId: string) => Promise<
|
|
267
|
+
/** Self-committing editors: submit a client-side draft row and return its creation result. */
|
|
268
|
+
onSubmitDraftRow?: (draftRowId: string) => Promise<DraftSubmitResult>;
|
|
229
269
|
/** Self-committing editors: invalidate cached data after an out-of-band mutation. */
|
|
230
270
|
onInvalidateData?: () => void;
|
|
231
271
|
/** Geometry pre-computed by the OverlayManager (reused `computeOverlayGeometry`). */
|
|
@@ -250,4 +290,4 @@ interface CellCreationMetadata {
|
|
|
250
290
|
activationBehavior: 'single-click' | 'double-click';
|
|
251
291
|
}
|
|
252
292
|
|
|
253
|
-
export { type BaseCellProps as B, type CellCreationMetadata as C, type EditorProps as E, type FieldMetadata$1 as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type
|
|
293
|
+
export { type BaseCellProps as B, type CellCreationMetadata as C, type DraftSubmitResult as D, type EditorProps as E, type FieldMetadata$1 as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type SheetsRowIdentifier as e, type CellRegistryEntry as f, type CellRenderer as g, type CellPlugin as h, type ColumnSchema as i, type CellValue as j, type FieldMetadata as k, type RelationKind as l, type RowData as m, type SheetsRowIdentityResolution as n, buildRelationInfoFromMeta as o, canRunSheetsMutation as p, getSheetsWriteCapability as q, isImageField as r, resolveCellType as s, resolveSheetsIdentifier as t, resolveSheetsRowIdentity as u, sheetsIdentifierCacheKey as v, sheetsIdentifierToWhere as w, sheetsRowKey as x };
|