@yudaocode/univer-bases 0.0.0-stage → 1.6.219

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.
@@ -0,0 +1,1078 @@
1
+ import * as _univerjs_core from '@univerjs/core';
2
+ import { Disposable, UnitModel, UniverInstanceType, IMutation, ICommand, Plugin, Injector, IUniverInstanceService, ICommandService } from '@univerjs/core';
3
+ import { Observable } from 'rxjs';
4
+
5
+ declare const UNIVER_BASE_SCHEMA = "univer.base.unit.v1";
6
+ declare const UNIVER_BASE_SCHEMA_VERSION = 1;
7
+ /**
8
+ * Complete set of field types supported by Univer Bases:
9
+ * - Basic & Rich (17): text, url, email, phone, number, currency, percent, date, duration,
10
+ * singleSelect, multiSelect, checkbox, rating, person, attachment, barcode, button
11
+ * - System Auto (5): autoNumber, createdTime, lastModifiedTime, createdBy, lastModifiedBy
12
+ * - Relational & Computed (5): link, lookup, rollup, count, formula
13
+ */
14
+ type BaseFieldType = 'text' | 'url' | 'email' | 'phone' | 'number' | 'currency' | 'percent' | 'date' | 'duration' | 'singleSelect' | 'multiSelect' | 'checkbox' | 'rating' | 'person' | 'attachment' | 'barcode' | 'button' | 'autoNumber' | 'createdTime' | 'lastModifiedTime' | 'createdBy' | 'lastModifiedBy' | 'link' | 'lookup' | 'rollup' | 'count' | 'formula';
15
+ declare const ALL_BASE_FIELD_TYPES: readonly BaseFieldType[];
16
+ declare const COMPUTED_BASE_FIELD_TYPES: ReadonlySet<BaseFieldType>;
17
+ declare function isComputedBaseField(type: BaseFieldType): boolean;
18
+ type BaseRollupFunction = 'sum' | 'avg' | 'min' | 'max' | 'count' | 'countValues' | 'values';
19
+ interface IBaseSelectOption {
20
+ id: string;
21
+ name: string;
22
+ color: string;
23
+ }
24
+ interface IBasePerson {
25
+ id: string;
26
+ name: string;
27
+ email?: string;
28
+ department?: string;
29
+ avatarColor?: string;
30
+ }
31
+ interface IBaseAttachment {
32
+ id: string;
33
+ name: string;
34
+ size?: number;
35
+ mimeType?: string;
36
+ url?: string;
37
+ }
38
+ interface IBaseFieldConfig {
39
+ /** Options for `singleSelect` and `multiSelect` fields */
40
+ options?: IBaseSelectOption[];
41
+ /** Decimal precision for `number`, `currency`, `percent`, `rollup`, `formula` */
42
+ precision?: number;
43
+ /** Currency symbol for `currency` fields (default `'¥'`) */
44
+ currencySymbol?: string;
45
+ /** Date format string (`'YYYY-MM-DD' | 'YYYY-MM-DD HH:mm' | 'YYYY/MM/DD'`) */
46
+ dateFormat?: 'YYYY-MM-DD' | 'YYYY-MM-DD HH:mm' | 'YYYY/MM/DD';
47
+ /** Duration display format (`'h:mm' | 'h:mm:ss' | 'd:h:mm'`) */
48
+ durationFormat?: 'h:mm' | 'h:mm:ss' | 'd:h:mm';
49
+ /** Max rating stars for `rating` fields (default `5`) */
50
+ maxRating?: number;
51
+ /** Barcode symbology for `barcode` fields */
52
+ barcodeFormat?: 'CODE128' | 'EAN13' | 'QR';
53
+ /** Action button config for `button` fields */
54
+ buttonLabel?: string;
55
+ buttonStyle?: 'primary' | 'default' | 'success' | 'warning';
56
+ buttonActionType?: 'url' | 'webhook' | 'toast';
57
+ buttonUrlTemplate?: string;
58
+ /** Cross-table relation config for `link` fields */
59
+ linkedTableId?: string;
60
+ symmetricFieldId?: string;
61
+ allowMultiple?: boolean;
62
+ /** Computed relation config for `lookup`, `rollup`, and `count` fields */
63
+ linkFieldId?: string;
64
+ lookupFieldId?: string;
65
+ rollupFunction?: BaseRollupFunction;
66
+ /** Formula expression for `formula` fields, e.g. `{单价} * {数量}` */
67
+ formula?: string;
68
+ }
69
+ interface IBaseField {
70
+ id: string;
71
+ name: string;
72
+ type: BaseFieldType;
73
+ isPrimary?: boolean;
74
+ width?: number;
75
+ hidden?: boolean;
76
+ required?: boolean;
77
+ description?: string;
78
+ config?: IBaseFieldConfig;
79
+ }
80
+ type BaseCellValue = string | number | boolean | string[] | IBasePerson[] | IBaseAttachment[] | null | undefined;
81
+ interface IBaseRecord {
82
+ id: string;
83
+ cells: Record<string, BaseCellValue>;
84
+ createdTime: string;
85
+ lastModifiedTime: string;
86
+ createdBy?: string;
87
+ lastModifiedBy?: string;
88
+ autoNumber?: number;
89
+ }
90
+ type BaseViewType = 'grid' | 'kanban' | 'calendar' | 'gallery' | 'gantt' | 'timeline' | 'form' | 'list';
91
+ type BaseFilterOperator = 'is' | 'isNot' | 'contains' | 'notContains' | 'gt' | 'gte' | 'lt' | 'lte' | 'isEmpty' | 'isNotEmpty';
92
+ type BaseFilterConjunction = 'and' | 'or';
93
+ interface IBaseFilterRule {
94
+ id: string;
95
+ fieldId: string;
96
+ operator: BaseFilterOperator;
97
+ value?: unknown;
98
+ }
99
+ interface IBaseSortRule {
100
+ id: string;
101
+ fieldId: string;
102
+ direction: 'asc' | 'desc';
103
+ }
104
+ interface IBaseGroupRule {
105
+ fieldId: string;
106
+ direction?: 'asc' | 'desc';
107
+ collapsedValues?: string[];
108
+ }
109
+ interface IBaseColorRule {
110
+ id: string;
111
+ fieldId: string;
112
+ operator: BaseFilterOperator;
113
+ value?: unknown;
114
+ color: string;
115
+ label?: string;
116
+ }
117
+ type BaseSummaryType = 'none' | 'count' | 'empty' | 'filled' | 'percentFilled' | 'sum' | 'avg' | 'min' | 'max';
118
+ type BaseGanttZoom = 'day' | 'week' | 'month';
119
+ interface IBaseFormFieldItem {
120
+ fieldId: string;
121
+ visible: boolean;
122
+ required?: boolean;
123
+ label?: string;
124
+ placeholder?: string;
125
+ helpText?: string;
126
+ visibleWhenConjunction?: BaseFilterConjunction;
127
+ visibleWhen?: IBaseFilterRule[];
128
+ conditionalRequired?: boolean;
129
+ }
130
+ type IBaseFormFieldConfig = IBaseFormFieldItem;
131
+ interface IBaseFormFieldRule {
132
+ visibleWhenConjunction?: BaseFilterConjunction;
133
+ visibleWhen?: IBaseFilterRule[];
134
+ conditionalRequired?: boolean;
135
+ }
136
+ interface IBaseFormConfig {
137
+ title: string;
138
+ description?: string;
139
+ headerColor?: string;
140
+ submitButtonText?: string;
141
+ successMessage?: string;
142
+ fields: IBaseFormFieldItem[];
143
+ fieldRules?: Record<string, IBaseFormFieldRule>;
144
+ }
145
+ interface IBaseDetailSection {
146
+ id: string;
147
+ title: string;
148
+ collapsed?: boolean;
149
+ fieldIds: string[];
150
+ }
151
+ interface IBaseDetailLayout {
152
+ columns?: 1 | 2;
153
+ sections?: IBaseDetailSection[];
154
+ }
155
+ interface IBaseView {
156
+ id: string;
157
+ name: string;
158
+ type: BaseViewType;
159
+ description?: string;
160
+ filterConjunction?: BaseFilterConjunction;
161
+ filters?: IBaseFilterRule[];
162
+ sorts?: IBaseSortRule[];
163
+ groups?: IBaseGroupRule[];
164
+ colorRules?: IBaseColorRule[];
165
+ hiddenFieldIds?: string[];
166
+ summaryConfig?: Record<string, BaseSummaryType>;
167
+ rowHeight?: 'compact' | 'medium' | 'tall';
168
+ searchQuery?: string;
169
+ kanbanGroupFieldId?: string;
170
+ kanbanSumFieldId?: string;
171
+ cardVisibleFieldIds?: string[];
172
+ calendarDateFieldId?: string;
173
+ calendarColorFieldId?: string;
174
+ galleryCoverFieldId?: string;
175
+ galleryAccentColor?: string;
176
+ ganttStartDateFieldId?: string;
177
+ ganttEndDateFieldId?: string;
178
+ ganttProgressFieldId?: string;
179
+ ganttDependencyFieldId?: string;
180
+ ganttGroupFieldId?: string;
181
+ ganttZoom?: BaseGanttZoom;
182
+ formConfig?: IBaseFormConfig;
183
+ listParentFieldId?: string;
184
+ listCollapsedRecordIds?: string[];
185
+ listBadgeFieldIds?: string[];
186
+ detailLayout?: IBaseDetailLayout;
187
+ }
188
+ interface IBaseTable {
189
+ id: string;
190
+ name: string;
191
+ icon?: string;
192
+ description?: string;
193
+ primaryFieldId: string;
194
+ fieldOrder: string[];
195
+ fields: Record<string, IBaseField>;
196
+ recordOrder: string[];
197
+ records: Record<string, IBaseRecord>;
198
+ viewOrder: string[];
199
+ views: Record<string, IBaseView>;
200
+ activeViewId: string;
201
+ nextAutoNumber?: number;
202
+ detailLayout?: IBaseDetailLayout;
203
+ }
204
+ type BaseDashboardChartType = 'kpi' | 'bar' | 'line' | 'pie' | 'doughnut';
205
+ type BaseDashboardAggregation = 'count' | 'sum' | 'avg' | 'min' | 'max';
206
+ interface IBaseDashboardWidget {
207
+ id: string;
208
+ title: string;
209
+ type: BaseDashboardChartType;
210
+ tableId: string;
211
+ groupByFieldId?: string;
212
+ valueFieldId?: string;
213
+ aggregation: BaseDashboardAggregation;
214
+ color?: string;
215
+ widthSpan?: 1 | 2;
216
+ subtitle?: string;
217
+ }
218
+ interface IBaseDashboard {
219
+ id: string;
220
+ name: string;
221
+ widgets: IBaseDashboardWidget[];
222
+ }
223
+ type BaseAutomationTriggerType = 'recordCreated' | 'recordUpdated' | 'fieldChanged' | 'conditionMatched' | 'scheduled' | 'webhookReceived' | 'fieldMatches';
224
+ type BaseAutomationStepType = 'updateRecord' | 'createLinkedRecord' | 'ifElse' | 'loopRecords' | 'httpWebhook' | 'notify';
225
+ type BaseAutomationActionType = BaseAutomationStepType | 'webhook';
226
+ interface IBaseAutomationStep {
227
+ id: string;
228
+ type: BaseAutomationStepType;
229
+ name?: string;
230
+ /** For 'updateRecord': map of fieldId or fieldName -> static value or `{字段名}` / `=FORMULA` */
231
+ fieldUpdates?: Record<string, BaseCellValue>;
232
+ /** For 'createLinkedRecord' */
233
+ targetTableId?: string;
234
+ linkBackFieldId?: string;
235
+ recordCells?: Record<string, BaseCellValue>;
236
+ /** For 'ifElse' */
237
+ conditionConjunction?: BaseFilterConjunction;
238
+ conditions?: IBaseFilterRule[];
239
+ thenSteps?: IBaseAutomationStep[];
240
+ elseSteps?: IBaseAutomationStep[];
241
+ /** For 'loopRecords' */
242
+ loopTableId?: string;
243
+ loopConditionConjunction?: BaseFilterConjunction;
244
+ loopConditions?: IBaseFilterRule[];
245
+ loopSteps?: IBaseAutomationStep[];
246
+ /** For 'httpWebhook' */
247
+ webhookUrl?: string;
248
+ webhookMethod?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
249
+ webhookHeaders?: Record<string, string>;
250
+ webhookBodyTemplate?: unknown;
251
+ /** For 'notify' */
252
+ notifyChannel?: string;
253
+ notifyMessage?: string;
254
+ }
255
+ interface IBaseAutomationRule {
256
+ id: string;
257
+ name: string;
258
+ description?: string;
259
+ tableId: string;
260
+ enabled: boolean;
261
+ trigger: BaseAutomationTriggerType;
262
+ triggerFieldIds?: string[];
263
+ /** Backward-compatible single field trigger */
264
+ triggerFieldId?: string;
265
+ triggerValue?: unknown;
266
+ conditionConjunction?: BaseFilterConjunction;
267
+ conditions?: IBaseFilterRule[];
268
+ scheduleCron?: string;
269
+ steps?: IBaseAutomationStep[];
270
+ /** Backward-compatible legacy single action */
271
+ action?: BaseAutomationActionType;
272
+ actionConfig?: Record<string, unknown>;
273
+ }
274
+ interface IBaseQueuedWebhook {
275
+ id: string;
276
+ ruleId: string;
277
+ ruleName: string;
278
+ url: string;
279
+ method: string;
280
+ headers?: Record<string, string>;
281
+ body: unknown;
282
+ timestamp: string;
283
+ }
284
+ interface IBaseAutomationRunLog {
285
+ id: string;
286
+ ruleId: string;
287
+ ruleName: string;
288
+ tableId?: string;
289
+ recordId?: string;
290
+ trigger?: BaseAutomationTriggerType | 'manual';
291
+ status: 'success' | 'skipped' | 'error';
292
+ executedSteps: number;
293
+ timestamp: string;
294
+ summary: string;
295
+ queuedWebhooks?: IBaseQueuedWebhook[];
296
+ }
297
+ interface IBaseRowAccessRule {
298
+ id: string;
299
+ tableId: string;
300
+ roles?: string[];
301
+ userIds?: string[];
302
+ allowAllRecords?: boolean;
303
+ ownerFieldId?: string;
304
+ filterConjunction?: BaseFilterConjunction;
305
+ filters?: IBaseFilterRule[];
306
+ restrictedFieldIds?: string[];
307
+ maskMode?: 'mask' | 'hide';
308
+ maskValue?: BaseCellValue;
309
+ }
310
+ interface IBaseSyncMapping {
311
+ sourceKeyField?: string;
312
+ targetKeyField?: string;
313
+ fieldMap?: Record<string, string>;
314
+ sourceFilters?: IBaseFilterRule[];
315
+ conflictStrategy?: 'latestWins' | 'sourceWins' | 'targetWins';
316
+ syncTimestamp?: string;
317
+ }
318
+ interface IBaseUnitData {
319
+ schema?: string;
320
+ schemaVersion?: number;
321
+ id: string;
322
+ name: string;
323
+ rev: number;
324
+ activeTableId: string;
325
+ activeViewId: string;
326
+ activeDashboardId?: string;
327
+ workspaceMode?: 'table' | 'dashboard';
328
+ tableOrder: string[];
329
+ tables: Record<string, IBaseTable>;
330
+ dashboards?: IBaseDashboard[];
331
+ automations?: IBaseAutomationRule[];
332
+ automationLogs?: IBaseAutomationRunLog[];
333
+ queuedWebhooks?: IBaseQueuedWebhook[];
334
+ collaborators?: IBasePerson[];
335
+ metadata?: Record<string, unknown>;
336
+ }
337
+ declare const BASE_SELECT_PALETTE: readonly string[];
338
+ declare const BASE_ROW_COLOR_PALETTE: readonly {
339
+ label: string;
340
+ color: string;
341
+ }[];
342
+
343
+ interface IResolvedLinkedRecordItem {
344
+ id: string;
345
+ title: string;
346
+ record: IBaseRecord;
347
+ }
348
+ declare function normalizeLinkIds(raw: BaseCellValue): string[];
349
+ declare function toNumericValue(val: unknown): number | null;
350
+ declare function roundToPrecision(num: number, precision?: number): number;
351
+ declare function isCellValueEmpty(val: BaseCellValue): boolean;
352
+ declare function resolveLinkedRecordItems(unitData: IBaseUnitData, record: IBaseRecord, linkField: IBaseField, visited?: Set<string>): IResolvedLinkedRecordItem[];
353
+ declare function resolveBaseCellValue(unitData: IBaseUnitData, tableId: string, record: IBaseRecord, field: IBaseField, visited?: Set<string>): BaseCellValue;
354
+ declare function formatDurationSeconds(secondsOrStr: BaseCellValue, format?: string): string;
355
+ declare function formatBaseCellValue(unitData: IBaseUnitData, tableId: string, field: IBaseField, value: BaseCellValue): string;
356
+ declare function evaluateBaseFormula(expression: string, record: IBaseRecord, table: IBaseTable, unitData: IBaseUnitData, visited?: Set<string>): string | number | boolean | null;
357
+
358
+ interface IBaseEvaluatedRow {
359
+ recordId: string;
360
+ rowIndex: number;
361
+ record: IBaseRecord;
362
+ values: Record<string, BaseCellValue>;
363
+ displayValues: Record<string, string>;
364
+ rowColor?: string;
365
+ }
366
+ interface IBaseGroupNode {
367
+ key: string;
368
+ fieldId: string;
369
+ fieldName: string;
370
+ value: string;
371
+ label: string;
372
+ color?: string;
373
+ depth: number;
374
+ count: number;
375
+ collapsed: boolean;
376
+ rows: IBaseEvaluatedRow[];
377
+ children: IBaseGroupNode[];
378
+ summaryByField: Record<string, number | string | null>;
379
+ }
380
+ interface IBaseViewQueryOverrides {
381
+ filters?: IBaseFilterRule[];
382
+ filterConjunction?: BaseFilterConjunction;
383
+ sorts?: IBaseSortRule[];
384
+ groups?: IBaseGroupRule[];
385
+ colorRules?: IBaseColorRule[];
386
+ searchQuery?: string;
387
+ summaryConfig?: Record<string, BaseSummaryType>;
388
+ }
389
+ interface IBaseViewQueryResult {
390
+ table: IBaseTable;
391
+ view: IBaseView;
392
+ visibleFields: IBaseField[];
393
+ allFields: IBaseField[];
394
+ rows: IBaseEvaluatedRow[];
395
+ groups: IBaseGroupNode[];
396
+ summaryByField: Record<string, number | string | null>;
397
+ rowColors: Record<string, string>;
398
+ totalRecordCount: number;
399
+ filteredRecordCount: number;
400
+ }
401
+ interface IBaseDashboardSeriesItem {
402
+ key: string;
403
+ label: string;
404
+ value: number;
405
+ count: number;
406
+ color: string;
407
+ percent: number;
408
+ }
409
+ interface IBaseDashboardWidgetResult {
410
+ widgetId: string;
411
+ title: string;
412
+ type: IBaseDashboardWidget['type'];
413
+ totalValue: number;
414
+ formattedTotal: string;
415
+ recordCount: number;
416
+ series: IBaseDashboardSeriesItem[];
417
+ }
418
+ interface IBaseGanttTaskItem {
419
+ recordId: string;
420
+ title: string;
421
+ rowIndex: number;
422
+ startDate: string;
423
+ endDate: string;
424
+ startMs: number;
425
+ endMs: number;
426
+ startOffsetDays: number;
427
+ durationDays: number;
428
+ isMilestone: boolean;
429
+ progress: number;
430
+ color: string;
431
+ predecessorIds: string[];
432
+ row: IBaseEvaluatedRow;
433
+ }
434
+ interface IBaseGanttDependencyEdge {
435
+ id: string;
436
+ fromRecordId: string;
437
+ toRecordId: string;
438
+ fromRowIndex: number;
439
+ toRowIndex: number;
440
+ fromEndOffsetDays: number;
441
+ toStartOffsetDays: number;
442
+ }
443
+ interface IBaseGanttLayoutResult {
444
+ tasks: IBaseGanttTaskItem[];
445
+ dependencies: IBaseGanttDependencyEdge[];
446
+ rangeStartDate: string;
447
+ rangeEndDate: string;
448
+ rangeStartMs: number;
449
+ totalDays: number;
450
+ }
451
+ declare function matchesBaseFilterRule(rule: IBaseFilterRule, field: IBaseField | undefined, rawVal: BaseCellValue, displayVal: string): boolean;
452
+ declare function computeFieldSummary(rows: IBaseEvaluatedRow[], field: IBaseField, summaryType: BaseSummaryType): number | string | null;
453
+ declare function queryBaseTableView(unitData: IBaseUnitData, tableId?: string, viewId?: string, overrides?: IBaseViewQueryOverrides): IBaseViewQueryResult;
454
+ declare function computeBaseDashboardWidget(unitData: IBaseUnitData, widget: IBaseDashboardWidget): IBaseDashboardWidgetResult;
455
+ declare function computeBaseGanttTasks(unitData: IBaseUnitData, tableId?: string, viewId?: string): IBaseGanttLayoutResult;
456
+ interface IBaseHierarchicalListNode {
457
+ recordId: string;
458
+ parentId: string | null;
459
+ depth: number;
460
+ title: string;
461
+ row: IBaseEvaluatedRow;
462
+ collapsed: boolean;
463
+ cycleDetected: boolean;
464
+ children: IBaseHierarchicalListNode[];
465
+ descendantCount: number;
466
+ }
467
+ interface IBaseHierarchicalListResult {
468
+ table: IBaseTable;
469
+ view: IBaseView;
470
+ parentField: IBaseField | null;
471
+ roots: IBaseHierarchicalListNode[];
472
+ flattenedVisibleNodes: IBaseHierarchicalListNode[];
473
+ totalNodeCount: number;
474
+ maxDepth: number;
475
+ }
476
+ declare function computeBaseHierarchicalList(unitData: IBaseUnitData, tableId?: string, viewId?: string, options?: {
477
+ parentFieldId?: string;
478
+ collapsedRecordIds?: string[];
479
+ overrides?: IBaseViewQueryOverrides;
480
+ }): IBaseHierarchicalListResult;
481
+ declare function isFormFieldVisible(item: IBaseFormFieldItem, values: Record<string, BaseCellValue>, table: IBaseTable, unitData: IBaseUnitData, formConfig?: IBaseFormConfig): boolean;
482
+ declare function isFormFieldRequired(item: IBaseFormFieldItem, values: Record<string, BaseCellValue>, table: IBaseTable, unitData: IBaseUnitData, formConfig?: IBaseFormConfig): boolean;
483
+ interface IResolvedDetailSection {
484
+ id: string;
485
+ title: string;
486
+ collapsed: boolean;
487
+ fields: IBaseField[];
488
+ }
489
+ interface IResolvedDetailLayout {
490
+ columns: 1 | 2;
491
+ sections: IResolvedDetailSection[];
492
+ }
493
+ declare function resolveBaseDetailLayout(table: IBaseTable, view?: IBaseView, explicitLayout?: IBaseDetailLayout): IResolvedDetailLayout;
494
+
495
+ declare const MAX_AUTOMATION_RECURSION_DEPTH = 3;
496
+ interface IBaseWebhookRequest {
497
+ url: string;
498
+ method: string;
499
+ headers?: Record<string, string>;
500
+ body: unknown;
501
+ }
502
+ interface IBaseWebhookResponse {
503
+ status: number;
504
+ data?: unknown;
505
+ }
506
+ type BaseWebhookExecutor = (req: IBaseWebhookRequest) => Promise<IBaseWebhookResponse> | IBaseWebhookResponse;
507
+ interface IBaseAutomationTriggerEvent {
508
+ trigger: BaseAutomationTriggerType | 'manual';
509
+ tableId: string;
510
+ recordId?: string;
511
+ ruleId?: string;
512
+ changedFieldIds?: string[];
513
+ previousCells?: Record<string, BaseCellValue>;
514
+ webhookPayload?: unknown;
515
+ depth?: number;
516
+ }
517
+ interface IBaseAutomationExecutionOptions {
518
+ webhookExecutor?: BaseWebhookExecutor;
519
+ timestamp?: string;
520
+ maxLogs?: number;
521
+ }
522
+ interface IBaseAutomationExecutionResult {
523
+ unitData: IBaseUnitData;
524
+ logs: IBaseAutomationRunLog[];
525
+ queuedWebhooks: IBaseQueuedWebhook[];
526
+ executedRuleIds: string[];
527
+ }
528
+ interface IBaseAutomationService {
529
+ setWebhookExecutor(executor: BaseWebhookExecutor | undefined): void;
530
+ getWebhookExecutor(): BaseWebhookExecutor | undefined;
531
+ }
532
+ declare const IBaseAutomationService: _univerjs_core.IdentifierDecorator<IBaseAutomationService>;
533
+ declare class BaseAutomationService extends Disposable implements IBaseAutomationService {
534
+ private _webhookExecutor;
535
+ setWebhookExecutor(executor: BaseWebhookExecutor | undefined): void;
536
+ getWebhookExecutor(): BaseWebhookExecutor | undefined;
537
+ }
538
+ declare function evaluateAutomationConditions(conditions: IBaseFilterRule[] | undefined, conjunction: BaseFilterConjunction | undefined, unitData: IBaseUnitData, table: IBaseTable, record: IBaseRecord | undefined): boolean;
539
+ declare function interpolateAutomationString(template: string, unitData: IBaseUnitData, table: IBaseTable, record: IBaseRecord | undefined, webhookPayload?: unknown): string;
540
+ declare function interpolateAutomationCellValue(rawTemplate: BaseCellValue, targetField: IBaseField | undefined, unitData: IBaseUnitData, sourceTable: IBaseTable, sourceRecord: IBaseRecord | undefined, webhookPayload?: unknown): BaseCellValue;
541
+ declare function normalizeAutomationSteps(rule: IBaseAutomationRule): IBaseAutomationStep[];
542
+ declare function doesAutomationTriggerMatch(rule: IBaseAutomationRule, event: IBaseAutomationTriggerEvent, unitData: IBaseUnitData, table: IBaseTable, record: IBaseRecord | undefined): {
543
+ triggerMatched: boolean;
544
+ conditionsMatched: boolean;
545
+ };
546
+ /**
547
+ * Synchronous in-place runner used inside Univer `ICommand` transitions so all mutations,
548
+ * created linked records, cascaded updates, and `automationLogs` commit atomically with Undo/Redo.
549
+ */
550
+ declare function runBaseAutomationsInPlaceSync(workingUnit: IBaseUnitData, initialEvent: IBaseAutomationTriggerEvent, options?: IBaseAutomationExecutionOptions): {
551
+ logs: IBaseAutomationRunLog[];
552
+ queuedWebhooks: IBaseQueuedWebhook[];
553
+ executedRuleIds: string[];
554
+ };
555
+ /**
556
+ * Pure async-capable automation execution engine returning a new `IBaseUnitData` snapshot
557
+ * and awaiting any async `webhookExecutor` responses.
558
+ */
559
+ declare function executeBaseAutomations(unitData: IBaseUnitData, initialEvent: IBaseAutomationTriggerEvent, options?: IBaseAutomationExecutionOptions): Promise<IBaseAutomationExecutionResult>;
560
+
561
+ interface IBaseRowScopeContext {
562
+ userId: string;
563
+ userName?: string;
564
+ roles?: string[];
565
+ rules: IBaseRowAccessRule[];
566
+ }
567
+ declare function applyBaseRowReadScope(unitData: IBaseUnitData, context: IBaseRowScopeContext): IBaseUnitData;
568
+ interface IBaseSyncResult {
569
+ targetUnit: IBaseUnitData;
570
+ insertedCount: number;
571
+ updatedCount: number;
572
+ unchangedCount: number;
573
+ totalTargetRecords: number;
574
+ }
575
+ interface IBaseTwoWaySyncResult {
576
+ unitA: IBaseUnitData;
577
+ unitB: IBaseUnitData;
578
+ insertedInA: number;
579
+ updatedInA: number;
580
+ insertedInB: number;
581
+ updatedInB: number;
582
+ conflictsResolved: number;
583
+ }
584
+ interface IBaseMultiSourceMergeResult extends IBaseSyncResult {
585
+ deduplicatedCount: number;
586
+ }
587
+ declare function syncOneWayBaseTable(sourceUnit: IBaseUnitData, sourceTableId: string, targetUnit: IBaseUnitData, targetTableId: string, mapping?: IBaseSyncMapping): IBaseSyncResult;
588
+ declare function syncTwoWayBaseTables(unitA: IBaseUnitData, tableIdA: string, unitB: IBaseUnitData, tableIdB: string, mapping?: IBaseSyncMapping): IBaseTwoWaySyncResult;
589
+ declare function mergeMultipleSourcesIntoBaseTable(sources: Array<{
590
+ unit: IBaseUnitData;
591
+ tableId: string;
592
+ sourceTag?: string;
593
+ }>, targetUnit: IBaseUnitData, targetTableId: string, keyFieldName: string, options?: {
594
+ sourceTagFieldName?: string;
595
+ conflictStrategy?: 'latestWins' | 'firstWins' | 'lastWins';
596
+ syncTimestamp?: string;
597
+ }): IBaseMultiSourceMergeResult;
598
+ declare const syncBaseTables: {
599
+ readonly oneWay: typeof syncOneWayBaseTable;
600
+ readonly twoWay: typeof syncTwoWayBaseTables;
601
+ readonly mergeMultipleSources: typeof mergeMultipleSourcesIntoBaseTable;
602
+ };
603
+
604
+ declare function createSampleProjectBaseData(options?: {
605
+ id?: string;
606
+ name?: string;
607
+ }): IBaseUnitData;
608
+ declare function createSampleCrmBaseData(options?: {
609
+ id?: string;
610
+ name?: string;
611
+ }): IBaseUnitData;
612
+ declare function createDefaultBaseUnitData(partial?: Partial<IBaseUnitData>): IBaseUnitData;
613
+
614
+ declare class BaseUnitModel extends UnitModel<IBaseUnitData, UniverInstanceType.UNIVER_BASE> {
615
+ readonly type = UniverInstanceType.UNIVER_BASE;
616
+ private _snapshot;
617
+ private readonly _name$;
618
+ readonly name$: Observable<string>;
619
+ private readonly _snapshotChanged$;
620
+ readonly snapshotChanged$: Observable<IBaseUnitData>;
621
+ constructor(snapshot?: Partial<IBaseUnitData>);
622
+ dispose(): void;
623
+ getUnitId(): string;
624
+ setName(name: string): void;
625
+ getName(): string;
626
+ getSnapshot(): IBaseUnitData;
627
+ save(): IBaseUnitData;
628
+ getRev(): number;
629
+ incrementRev(): void;
630
+ setRev(rev: number): void;
631
+ getTables(): IBaseTable[];
632
+ getTable(tableId: string): IBaseTable | undefined;
633
+ getActiveTableId(): string;
634
+ getActiveTable(): IBaseTable | undefined;
635
+ getActiveViewId(): string;
636
+ getActiveView(): IBaseView | undefined;
637
+ getWorkspaceMode(): 'table' | 'dashboard';
638
+ getDashboards(): IBaseDashboard[];
639
+ getActiveDashboard(): IBaseDashboard | undefined;
640
+ evaluateCell(tableId: string, record: IBaseRecord, field: IBaseField): BaseCellValue;
641
+ formatCell(tableId: string, field: IBaseField, value: BaseCellValue): string;
642
+ queryView(tableId?: string, viewId?: string, overrides?: IBaseViewQueryOverrides): IBaseViewQueryResult;
643
+ computeGanttTasks(tableId?: string, viewId?: string): IBaseGanttLayoutResult;
644
+ computeHierarchicalList(tableId?: string, viewId?: string): IBaseHierarchicalListResult;
645
+ computeDashboardWidget(widget: IBaseDashboardWidget): IBaseDashboardWidgetResult;
646
+ getAutomations(): IBaseAutomationRule[];
647
+ getAutomationLogs(): IBaseAutomationRunLog[];
648
+ __replaceSnapshot(nextSnapshot: IBaseUnitData): void;
649
+ __applyTablesState(params: {
650
+ tableOrder: string[];
651
+ tables: Record<string, IBaseTable>;
652
+ activeTableId?: string;
653
+ activeViewId?: string;
654
+ workspaceMode?: 'table' | 'dashboard';
655
+ automations?: IBaseAutomationRule[];
656
+ automationLogs?: IBaseAutomationRunLog[];
657
+ queuedWebhooks?: IBaseQueuedWebhook[];
658
+ }): void;
659
+ __setActiveNavigation(params: {
660
+ activeTableId?: string;
661
+ activeViewId?: string;
662
+ activeDashboardId?: string;
663
+ workspaceMode?: 'table' | 'dashboard';
664
+ }): void;
665
+ __applyDashboardsState(params: {
666
+ dashboards: IBaseDashboard[];
667
+ activeDashboardId?: string;
668
+ workspaceMode?: 'table' | 'dashboard';
669
+ }): void;
670
+ private _notifyChange;
671
+ }
672
+
673
+ interface IApplyBaseTablesStateMutationParams {
674
+ unitId: string;
675
+ tableOrder: string[];
676
+ tables: Record<string, IBaseTable>;
677
+ activeTableId?: string;
678
+ activeViewId?: string;
679
+ workspaceMode?: 'table' | 'dashboard';
680
+ automations?: IBaseAutomationRule[];
681
+ automationLogs?: IBaseAutomationRunLog[];
682
+ queuedWebhooks?: IBaseQueuedWebhook[];
683
+ }
684
+ declare const ApplyBaseTablesStateMutation: IMutation<IApplyBaseTablesStateMutationParams>;
685
+ interface ISetBaseActiveNavigationMutationParams {
686
+ unitId: string;
687
+ activeTableId?: string;
688
+ activeViewId?: string;
689
+ activeDashboardId?: string;
690
+ workspaceMode?: 'table' | 'dashboard';
691
+ }
692
+ declare const SetBaseActiveNavigationMutation: IMutation<ISetBaseActiveNavigationMutationParams>;
693
+ interface IApplyBaseDashboardsStateMutationParams {
694
+ unitId: string;
695
+ dashboards: IBaseDashboard[];
696
+ activeDashboardId?: string;
697
+ workspaceMode?: 'table' | 'dashboard';
698
+ }
699
+ declare const ApplyBaseDashboardsStateMutation: IMutation<IApplyBaseDashboardsStateMutationParams>;
700
+ interface IReplaceBaseSnapshotMutationParams {
701
+ unitId: string;
702
+ snapshot: IBaseUnitData;
703
+ }
704
+ declare const ReplaceBaseSnapshotMutation: IMutation<IReplaceBaseSnapshotMutationParams>;
705
+
706
+ interface IAddBaseTableCommandParams {
707
+ unitId?: string;
708
+ tableId?: string;
709
+ name?: string;
710
+ description?: string;
711
+ fields?: IBaseField[];
712
+ makeActive?: boolean;
713
+ onCreated?: (tableId: string) => void;
714
+ }
715
+ declare const AddBaseTableCommand: ICommand<IAddBaseTableCommandParams>;
716
+ interface IUpdateBaseTableCommandParams {
717
+ unitId?: string;
718
+ tableId: string;
719
+ patch: {
720
+ name?: string;
721
+ description?: string;
722
+ icon?: string;
723
+ };
724
+ }
725
+ declare const UpdateBaseTableCommand: ICommand<IUpdateBaseTableCommandParams>;
726
+ interface IDeleteBaseTableCommandParams {
727
+ unitId?: string;
728
+ tableId: string;
729
+ }
730
+ declare const DeleteBaseTableCommand: ICommand<IDeleteBaseTableCommandParams>;
731
+ interface ISetActiveBaseTableCommandParams {
732
+ unitId?: string;
733
+ tableId: string;
734
+ viewId?: string;
735
+ }
736
+ declare const SetActiveBaseTableCommand: ICommand<ISetActiveBaseTableCommandParams>;
737
+ interface ISetBaseWorkspaceModeCommandParams {
738
+ unitId?: string;
739
+ mode: 'table' | 'dashboard';
740
+ dashboardId?: string;
741
+ }
742
+ declare const SetBaseWorkspaceModeCommand: ICommand<ISetBaseWorkspaceModeCommandParams>;
743
+ interface IAddBaseFieldCommandParams {
744
+ unitId?: string;
745
+ tableId?: string;
746
+ fieldId?: string;
747
+ name: string;
748
+ type: BaseFieldType;
749
+ width?: number;
750
+ required?: boolean;
751
+ description?: string;
752
+ config?: IBaseFieldConfig;
753
+ createSymmetric?: boolean;
754
+ symmetricFieldName?: string;
755
+ index?: number;
756
+ onCreated?: (fieldId: string) => void;
757
+ }
758
+ declare const AddBaseFieldCommand: ICommand<IAddBaseFieldCommandParams>;
759
+ interface IUpdateBaseFieldCommandParams {
760
+ unitId?: string;
761
+ tableId?: string;
762
+ fieldId: string;
763
+ patch: Partial<Omit<IBaseField, 'id'>>;
764
+ }
765
+ declare const UpdateBaseFieldCommand: ICommand<IUpdateBaseFieldCommandParams>;
766
+ interface IDeleteBaseFieldCommandParams {
767
+ unitId?: string;
768
+ tableId?: string;
769
+ fieldId: string;
770
+ }
771
+ declare const DeleteBaseFieldCommand: ICommand<IDeleteBaseFieldCommandParams>;
772
+ interface IReorderBaseFieldsCommandParams {
773
+ unitId?: string;
774
+ tableId?: string;
775
+ fieldOrder: string[];
776
+ }
777
+ declare const ReorderBaseFieldsCommand: ICommand<IReorderBaseFieldsCommandParams>;
778
+ interface IAddBaseRecordCommandParams {
779
+ unitId?: string;
780
+ tableId?: string;
781
+ recordId?: string;
782
+ cells?: Record<string, BaseCellValue>;
783
+ createdBy?: string;
784
+ index?: number;
785
+ onCreated?: (recordId: string) => void;
786
+ }
787
+ declare const AddBaseRecordCommand: ICommand<IAddBaseRecordCommandParams>;
788
+ interface IUpdateBaseRecordCommandParams {
789
+ unitId?: string;
790
+ tableId?: string;
791
+ recordId: string;
792
+ cells: Record<string, BaseCellValue>;
793
+ modifiedBy?: string;
794
+ }
795
+ declare const UpdateBaseRecordCommand: ICommand<IUpdateBaseRecordCommandParams>;
796
+ interface IDeleteBaseRecordsCommandParams {
797
+ unitId?: string;
798
+ tableId?: string;
799
+ recordIds: string[];
800
+ }
801
+ declare const DeleteBaseRecordsCommand: ICommand<IDeleteBaseRecordsCommandParams>;
802
+ interface IBatchInsertBaseRecordsCommandParams {
803
+ unitId?: string;
804
+ tableId?: string;
805
+ records: Array<{
806
+ id?: string;
807
+ cells: Record<string, BaseCellValue>;
808
+ }>;
809
+ onCreated?: (recordIds: string[]) => void;
810
+ }
811
+ declare const BatchInsertBaseRecordsCommand: ICommand<IBatchInsertBaseRecordsCommandParams>;
812
+ interface ISubmitBaseFormResponseCommandParams {
813
+ unitId?: string;
814
+ tableId?: string;
815
+ viewId?: string;
816
+ values: Record<string, BaseCellValue>;
817
+ submittedBy?: string;
818
+ onSubmitted?: (recordId: string) => void;
819
+ }
820
+ declare const SubmitBaseFormResponseCommand: ICommand<ISubmitBaseFormResponseCommandParams>;
821
+ interface IAddBaseViewCommandParams {
822
+ unitId?: string;
823
+ tableId?: string;
824
+ viewId?: string;
825
+ name?: string;
826
+ type: BaseViewType;
827
+ view?: Partial<IBaseView>;
828
+ makeActive?: boolean;
829
+ onCreated?: (viewId: string) => void;
830
+ }
831
+ declare const AddBaseViewCommand: ICommand<IAddBaseViewCommandParams>;
832
+ interface IUpdateBaseViewCommandParams {
833
+ unitId?: string;
834
+ tableId?: string;
835
+ viewId?: string;
836
+ patch: Partial<Omit<IBaseView, 'id'>>;
837
+ }
838
+ declare const UpdateBaseViewCommand: ICommand<IUpdateBaseViewCommandParams>;
839
+ interface IDeleteBaseViewCommandParams {
840
+ unitId?: string;
841
+ tableId?: string;
842
+ viewId: string;
843
+ }
844
+ declare const DeleteBaseViewCommand: ICommand<IDeleteBaseViewCommandParams>;
845
+ interface ISetActiveBaseViewCommandParams {
846
+ unitId?: string;
847
+ tableId?: string;
848
+ viewId: string;
849
+ }
850
+ declare const SetActiveBaseViewCommand: ICommand<ISetActiveBaseViewCommandParams>;
851
+ interface IAddBaseDashboardWidgetCommandParams {
852
+ unitId?: string;
853
+ dashboardId?: string;
854
+ widget: Omit<IBaseDashboardWidget, 'id'> & {
855
+ id?: string;
856
+ };
857
+ onCreated?: (widgetId: string) => void;
858
+ }
859
+ declare const AddBaseDashboardWidgetCommand: ICommand<IAddBaseDashboardWidgetCommandParams>;
860
+ interface IUpdateBaseDashboardWidgetCommandParams {
861
+ unitId?: string;
862
+ dashboardId?: string;
863
+ widgetId: string;
864
+ patch: Partial<Omit<IBaseDashboardWidget, 'id'>>;
865
+ }
866
+ declare const UpdateBaseDashboardWidgetCommand: ICommand<IUpdateBaseDashboardWidgetCommandParams>;
867
+ interface IDeleteBaseDashboardWidgetCommandParams {
868
+ unitId?: string;
869
+ dashboardId?: string;
870
+ widgetId: string;
871
+ }
872
+ declare const DeleteBaseDashboardWidgetCommand: ICommand<IDeleteBaseDashboardWidgetCommandParams>;
873
+ interface IReplaceBaseSnapshotCommandParams {
874
+ unitId?: string;
875
+ snapshot: IBaseUnitData;
876
+ }
877
+ declare const ReplaceBaseSnapshotCommand: ICommand<IReplaceBaseSnapshotCommandParams>;
878
+ interface IUpdateBaseDetailLayoutCommandParams {
879
+ unitId?: string;
880
+ tableId?: string;
881
+ viewId?: string;
882
+ detailLayout: IBaseDetailLayout;
883
+ }
884
+ declare const UpdateBaseDetailLayoutCommand: ICommand<IUpdateBaseDetailLayoutCommandParams>;
885
+ interface ISaveBaseAutomationRuleCommandParams {
886
+ unitId?: string;
887
+ rule: Omit<IBaseAutomationRule, 'id'> & {
888
+ id?: string;
889
+ };
890
+ onSaved?: (ruleId: string) => void;
891
+ }
892
+ declare const SaveBaseAutomationRuleCommand: ICommand<ISaveBaseAutomationRuleCommandParams>;
893
+ interface IDeleteBaseAutomationRuleCommandParams {
894
+ unitId?: string;
895
+ ruleId: string;
896
+ }
897
+ declare const DeleteBaseAutomationRuleCommand: ICommand<IDeleteBaseAutomationRuleCommandParams>;
898
+ interface IToggleBaseAutomationRuleCommandParams {
899
+ unitId?: string;
900
+ ruleId: string;
901
+ enabled?: boolean;
902
+ }
903
+ declare const ToggleBaseAutomationRuleCommand: ICommand<IToggleBaseAutomationRuleCommandParams>;
904
+ interface ITriggerBaseAutomationCommandParams {
905
+ unitId?: string;
906
+ ruleId?: string;
907
+ tableId?: string;
908
+ recordId?: string;
909
+ trigger?: BaseAutomationTriggerType | 'manual';
910
+ webhookPayload?: unknown;
911
+ webhookExecutor?: BaseWebhookExecutor;
912
+ onExecuted?: (logs: IBaseAutomationRunLog[]) => void;
913
+ }
914
+ declare const TriggerBaseAutomationCommand: ICommand<ITriggerBaseAutomationCommandParams>;
915
+
916
+ declare function parseDelimitedText(text: string, delimiter?: ',' | '\t'): string[][];
917
+ declare function serializeDelimitedText(rows: ReadonlyArray<ReadonlyArray<string>>, delimiter?: ',' | '\t'): string;
918
+ declare function inferFieldFromColumnSamples(rawSamples: ReadonlyArray<string>): {
919
+ type: BaseFieldType;
920
+ options?: IBaseSelectOption[];
921
+ };
922
+ declare function coerceImportedCellValue(raw: string, type: BaseFieldType): BaseCellValue;
923
+ interface IExportBaseCsvOptions {
924
+ delimiter?: ',' | '\t';
925
+ viewId?: string;
926
+ includeBom?: boolean;
927
+ }
928
+ declare function exportBaseTableToCsv(unitData: IBaseUnitData, tableId?: string, options?: IExportBaseCsvOptions): string;
929
+ interface IImportCsvToTableOptions {
930
+ tableId?: string;
931
+ tableName?: string;
932
+ delimiter?: ',' | '\t';
933
+ }
934
+ declare function buildBaseTableFromGridRows(gridRows: string[][], options?: {
935
+ tableId?: string;
936
+ tableName?: string;
937
+ }): IBaseTable;
938
+ declare function importCsvToBaseTable(csvText: string, options?: IImportCsvToTableOptions): IBaseTable;
939
+
940
+ interface IExportBaseXlsxOptions {
941
+ tableIds?: string[];
942
+ }
943
+ declare function exportBaseToXlsxBytes(unitData: IBaseUnitData, options?: IExportBaseXlsxOptions): Uint8Array;
944
+ interface IImportXlsxToBaseOptions {
945
+ id?: string;
946
+ name?: string;
947
+ }
948
+ declare function importXlsxBytesToBase(bytes: Uint8Array, options?: IImportXlsxToBaseOptions): IBaseUnitData;
949
+
950
+ type BaseIoFormat = 'xlsx' | 'csv' | 'tsv' | 'json';
951
+ interface IBaseIoAdapter {
952
+ name?: string;
953
+ importBase?: (source: Uint8Array | string, format: BaseIoFormat, options?: {
954
+ id?: string;
955
+ name?: string;
956
+ }) => Promise<IBaseUnitData> | IBaseUnitData;
957
+ exportBase?: (snapshot: IBaseUnitData, format: BaseIoFormat, options?: {
958
+ tableId?: string;
959
+ }) => Promise<Uint8Array | string> | Uint8Array | string;
960
+ onSave?: (snapshot: IBaseUnitData) => Promise<void> | void;
961
+ }
962
+ interface IBaseSavedEvent {
963
+ unitId: string;
964
+ snapshot: IBaseUnitData;
965
+ savedAt: string;
966
+ }
967
+ interface IBaseIoService {
968
+ readonly saved$: Observable<IBaseSavedEvent>;
969
+ setAdapter(adapter: IBaseIoAdapter): void;
970
+ getAdapter(): IBaseIoAdapter;
971
+ importBase(source: Uint8Array | string, format: BaseIoFormat, options?: {
972
+ id?: string;
973
+ name?: string;
974
+ }): Promise<IBaseUnitData>;
975
+ exportBase(snapshot: IBaseUnitData, format: BaseIoFormat, options?: {
976
+ tableId?: string;
977
+ }): Promise<Uint8Array | string>;
978
+ saveBase(snapshot: IBaseUnitData): Promise<void>;
979
+ }
980
+ declare const IBaseIoService: _univerjs_core.IdentifierDecorator<IBaseIoService>;
981
+ declare class BaseIoService extends Disposable implements IBaseIoService {
982
+ private _adapter;
983
+ private readonly _saved$;
984
+ readonly saved$: Observable<IBaseSavedEvent>;
985
+ dispose(): void;
986
+ setAdapter(adapter: IBaseIoAdapter): void;
987
+ getAdapter(): IBaseIoAdapter;
988
+ importBase(source: Uint8Array | string, format: BaseIoFormat, options?: {
989
+ id?: string;
990
+ name?: string;
991
+ }): Promise<IBaseUnitData>;
992
+ exportBase(snapshot: IBaseUnitData, format: BaseIoFormat, options?: {
993
+ tableId?: string;
994
+ }): Promise<Uint8Array | string>;
995
+ saveBase(snapshot: IBaseUnitData): Promise<void>;
996
+ }
997
+
998
+ type BaseModalType = null | 'import' | 'export' | 'addField' | 'addView' | 'addWidget' | 'linkPicker' | 'automationBuilder';
999
+ interface ILinkPickerSession {
1000
+ tableId: string;
1001
+ recordId: string;
1002
+ fieldId: string;
1003
+ linkedTableId: string;
1004
+ allowMultiple: boolean;
1005
+ }
1006
+ interface IBaseSelectionState {
1007
+ selectedRecordIds: string[];
1008
+ activeRecordDrawerId: string | null;
1009
+ searchQuery: string;
1010
+ activeModal: BaseModalType;
1011
+ linkPickerSession: ILinkPickerSession | null;
1012
+ editingAutomationRuleId: string | null;
1013
+ lastToastMessage: string | null;
1014
+ }
1015
+ interface IBaseSelectionService {
1016
+ readonly state$: Observable<IBaseSelectionState>;
1017
+ getState(): IBaseSelectionState;
1018
+ setSelectedRecords(recordIds: string[]): void;
1019
+ toggleRecordSelected(recordId: string): void;
1020
+ clearSelection(): void;
1021
+ openRecordDrawer(recordId: string | null): void;
1022
+ setSearchQuery(query: string): void;
1023
+ openModal(modal: BaseModalType): void;
1024
+ openLinkPicker(session: ILinkPickerSession | null): void;
1025
+ openAutomationBuilder(ruleId?: string | null): void;
1026
+ notifyToast(message: string | null): void;
1027
+ }
1028
+ declare const IBaseSelectionService: _univerjs_core.IdentifierDecorator<IBaseSelectionService>;
1029
+ declare class BaseSelectionService extends Disposable implements IBaseSelectionService {
1030
+ private readonly _state$;
1031
+ readonly state$: Observable<IBaseSelectionState>;
1032
+ dispose(): void;
1033
+ getState(): IBaseSelectionState;
1034
+ setSelectedRecords(recordIds: string[]): void;
1035
+ toggleRecordSelected(recordId: string): void;
1036
+ clearSelection(): void;
1037
+ openRecordDrawer(recordId: string | null): void;
1038
+ setSearchQuery(query: string): void;
1039
+ openModal(modal: BaseModalType): void;
1040
+ openLinkPicker(session: ILinkPickerSession | null): void;
1041
+ openAutomationBuilder(ruleId?: string | null): void;
1042
+ notifyToast(message: string | null): void;
1043
+ }
1044
+
1045
+ /**
1046
+ * Deterministic pure-TS barcode bar pattern & QR matrix generator for browser + SSR rendering.
1047
+ * Requires zero DOM (`document`/`canvas`) access so SSR `renderToStaticMarkup` and UI badges render crisply.
1048
+ */
1049
+ interface IBarcodeBarSegment {
1050
+ x: number;
1051
+ width: number;
1052
+ }
1053
+ declare function buildLinearBarcodeBars(value: string): {
1054
+ bars: IBarcodeBarSegment[];
1055
+ totalWidth: number;
1056
+ };
1057
+
1058
+ interface IUniverBasesConfig {
1059
+ /** Optional pluggable Import / Export / Save IO adapter */
1060
+ io?: IBaseIoAdapter;
1061
+ /** Optional pluggable HTTP Webhook executor for automation workflows */
1062
+ webhookExecutor?: BaseWebhookExecutor;
1063
+ }
1064
+ declare const UNIVER_BASES_PLUGIN_NAME = "UNIVER_BASES_PLUGIN";
1065
+ declare class UniverBasesPlugin extends Plugin {
1066
+ private readonly _config;
1067
+ protected readonly _injector: Injector;
1068
+ private readonly _univerInstanceService;
1069
+ private readonly _commandService;
1070
+ static pluginName: string;
1071
+ static packageName: string;
1072
+ constructor(_config: Partial<IUniverBasesConfig> | undefined, _injector: Injector, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
1073
+ onStarting(): void;
1074
+ }
1075
+
1076
+ declare const VERSION = "1.6.219";
1077
+
1078
+ export { ALL_BASE_FIELD_TYPES, AddBaseDashboardWidgetCommand, AddBaseFieldCommand, AddBaseRecordCommand, AddBaseTableCommand, AddBaseViewCommand, ApplyBaseDashboardsStateMutation, ApplyBaseTablesStateMutation, BASE_ROW_COLOR_PALETTE, BASE_SELECT_PALETTE, type BaseAutomationActionType, BaseAutomationService, type BaseAutomationStepType, type BaseAutomationTriggerType, type BaseCellValue, type BaseDashboardAggregation, type BaseDashboardChartType, type BaseFieldType, type BaseFilterConjunction, type BaseFilterOperator, type BaseGanttZoom, type BaseIoFormat, BaseIoService, type BaseModalType, type BaseRollupFunction, BaseSelectionService, type BaseSummaryType, BaseUnitModel, type BaseViewType, type BaseWebhookExecutor, BatchInsertBaseRecordsCommand, COMPUTED_BASE_FIELD_TYPES, DeleteBaseAutomationRuleCommand, DeleteBaseDashboardWidgetCommand, DeleteBaseFieldCommand, DeleteBaseRecordsCommand, DeleteBaseTableCommand, DeleteBaseViewCommand, type IAddBaseDashboardWidgetCommandParams, type IAddBaseFieldCommandParams, type IAddBaseRecordCommandParams, type IAddBaseTableCommandParams, type IAddBaseViewCommandParams, type IApplyBaseDashboardsStateMutationParams, type IApplyBaseTablesStateMutationParams, type IBarcodeBarSegment, type IBaseAttachment, type IBaseAutomationExecutionOptions, type IBaseAutomationExecutionResult, type IBaseAutomationRule, type IBaseAutomationRunLog, IBaseAutomationService, type IBaseAutomationStep, type IBaseAutomationTriggerEvent, type IBaseColorRule, type IBaseDashboard, type IBaseDashboardSeriesItem, type IBaseDashboardWidget, type IBaseDashboardWidgetResult, type IBaseDetailLayout, type IBaseDetailSection, type IBaseEvaluatedRow, type IBaseField, type IBaseFieldConfig, type IBaseFilterRule, type IBaseFormConfig, type IBaseFormFieldConfig, type IBaseFormFieldItem, type IBaseFormFieldRule, type IBaseGanttDependencyEdge, type IBaseGanttLayoutResult, type IBaseGanttTaskItem, type IBaseGroupNode, type IBaseGroupRule, type IBaseHierarchicalListNode, type IBaseHierarchicalListResult, type IBaseIoAdapter, IBaseIoService, type IBaseMultiSourceMergeResult, type IBasePerson, type IBaseQueuedWebhook, type IBaseRecord, type IBaseRowAccessRule, type IBaseRowScopeContext, type IBaseSavedEvent, type IBaseSelectOption, IBaseSelectionService, type IBaseSelectionState, type IBaseSortRule, type IBaseSyncMapping, type IBaseSyncResult, type IBaseTable, type IBaseTwoWaySyncResult, type IBaseUnitData, type IBaseView, type IBaseViewQueryOverrides, type IBaseViewQueryResult, type IBaseWebhookRequest, type IBaseWebhookResponse, type IBatchInsertBaseRecordsCommandParams, type IDeleteBaseAutomationRuleCommandParams, type IDeleteBaseDashboardWidgetCommandParams, type IDeleteBaseFieldCommandParams, type IDeleteBaseRecordsCommandParams, type IDeleteBaseTableCommandParams, type IDeleteBaseViewCommandParams, type IExportBaseCsvOptions, type IExportBaseXlsxOptions, type IImportCsvToTableOptions, type IImportXlsxToBaseOptions, type ILinkPickerSession, type IReorderBaseFieldsCommandParams, type IReplaceBaseSnapshotCommandParams, type IReplaceBaseSnapshotMutationParams, type IResolvedDetailLayout, type IResolvedDetailSection, type IResolvedLinkedRecordItem, type ISaveBaseAutomationRuleCommandParams, type ISetActiveBaseTableCommandParams, type ISetActiveBaseViewCommandParams, type ISetBaseActiveNavigationMutationParams, type ISetBaseWorkspaceModeCommandParams, type ISubmitBaseFormResponseCommandParams, type IToggleBaseAutomationRuleCommandParams, type ITriggerBaseAutomationCommandParams, type IUniverBasesConfig, type IUpdateBaseDashboardWidgetCommandParams, type IUpdateBaseDetailLayoutCommandParams, type IUpdateBaseFieldCommandParams, type IUpdateBaseRecordCommandParams, type IUpdateBaseTableCommandParams, type IUpdateBaseViewCommandParams, MAX_AUTOMATION_RECURSION_DEPTH, ReorderBaseFieldsCommand, ReplaceBaseSnapshotCommand, ReplaceBaseSnapshotMutation, SaveBaseAutomationRuleCommand, SetActiveBaseTableCommand, SetActiveBaseViewCommand, SetBaseActiveNavigationMutation, SetBaseWorkspaceModeCommand, SubmitBaseFormResponseCommand, ToggleBaseAutomationRuleCommand, TriggerBaseAutomationCommand, UNIVER_BASES_PLUGIN_NAME, UNIVER_BASE_SCHEMA, UNIVER_BASE_SCHEMA_VERSION, UniverBasesPlugin, UpdateBaseDashboardWidgetCommand, UpdateBaseDetailLayoutCommand, UpdateBaseFieldCommand, UpdateBaseRecordCommand, UpdateBaseTableCommand, UpdateBaseViewCommand, VERSION, applyBaseRowReadScope, buildBaseTableFromGridRows, buildLinearBarcodeBars, coerceImportedCellValue, computeBaseDashboardWidget, computeBaseGanttTasks, computeBaseHierarchicalList, computeFieldSummary, createDefaultBaseUnitData, createSampleCrmBaseData, createSampleProjectBaseData, doesAutomationTriggerMatch, evaluateAutomationConditions, evaluateBaseFormula, executeBaseAutomations, exportBaseTableToCsv, exportBaseToXlsxBytes, formatBaseCellValue, formatDurationSeconds, importCsvToBaseTable, importXlsxBytesToBase, inferFieldFromColumnSamples, interpolateAutomationCellValue, interpolateAutomationString, isCellValueEmpty, isComputedBaseField, isFormFieldRequired, isFormFieldVisible, matchesBaseFilterRule, mergeMultipleSourcesIntoBaseTable, normalizeAutomationSteps, normalizeLinkIds, parseDelimitedText, queryBaseTableView, resolveBaseCellValue, resolveBaseDetailLayout, resolveLinkedRecordItems, roundToPrecision, runBaseAutomationsInPlaceSync, serializeDelimitedText, syncBaseTables, syncOneWayBaseTable, syncTwoWayBaseTables, toNumericValue };