@4399ywkf/editor 0.14.2 → 0.16.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/dist/{DocView-VTKFMW46.js → DocView-7QBKHBU4.js} +4 -3
- package/dist/DocView-7QBKHBU4.js.map +1 -0
- package/dist/SheetView-WP4DKSDS.js +3 -0
- package/dist/{SheetView-6Z5EPBN4.js.map → SheetView-WP4DKSDS.js.map} +1 -1
- package/dist/base-model.d.ts +131 -0
- package/dist/base-model.js +3 -0
- package/dist/base-model.js.map +1 -0
- package/dist/base.d.ts +978 -0
- package/dist/base.js +14180 -0
- package/dist/base.js.map +1 -0
- package/dist/{chunk-FMTC3EDQ.js → chunk-4SIP4BYI.js} +3 -3
- package/dist/{chunk-FMTC3EDQ.js.map → chunk-4SIP4BYI.js.map} +1 -1
- package/dist/chunk-F4LWFKIA.js +2931 -0
- package/dist/chunk-F4LWFKIA.js.map +1 -0
- package/dist/chunk-S57WFYWY.js +2014 -0
- package/dist/chunk-S57WFYWY.js.map +1 -0
- package/dist/{chunk-ZLEGKX2U.js → chunk-X2JCKZP2.js} +9385 -9998
- package/dist/chunk-X2JCKZP2.js.map +1 -0
- package/dist/{chunk-OBKIMG6G.js → chunk-X4BUO2RH.js} +4 -4
- package/dist/{chunk-OBKIMG6G.js.map → chunk-X4BUO2RH.js.map} +1 -1
- package/dist/csv.js +1 -1
- package/dist/doc-standalone.js +11425 -9116
- package/dist/doc-standalone.js.map +1 -1
- package/dist/doc.d.ts +4 -379
- package/dist/doc.js +3 -2
- package/dist/doc.js.map +1 -1
- package/dist/editor-config-context-DvLRd7Gx.d.ts +382 -0
- package/dist/form-DqUOPVKI.d.ts +475 -0
- package/dist/{import-XL3AH3QH.js → import-TEZ37G5R.js} +5 -5
- package/dist/{import-XL3AH3QH.js.map → import-TEZ37G5R.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/sheet.js +1 -1
- package/dist/style.css +2 -2
- package/dist/xlsx.js +4 -4
- package/package.json +10 -2
- package/dist/DocView-VTKFMW46.js.map +0 -1
- package/dist/SheetView-6Z5EPBN4.js +0 -3
- package/dist/chunk-ZLEGKX2U.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NotionEditor } from './chunk-X2JCKZP2.js';
|
|
2
2
|
import './chunk-MGSVKKK7.js';
|
|
3
|
+
import { EditorConfigProvider } from './chunk-F4LWFKIA.js';
|
|
3
4
|
import './chunk-UD6MDBTN.js';
|
|
4
5
|
import './chunk-ABMZOL26.js';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -18,5 +19,5 @@ function DocView({ content, contentFormat, readOnly, room, className, onReady })
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export { DocView as default };
|
|
21
|
-
//# sourceMappingURL=DocView-
|
|
22
|
-
//# sourceMappingURL=DocView-
|
|
22
|
+
//# sourceMappingURL=DocView-7QBKHBU4.js.map
|
|
23
|
+
//# sourceMappingURL=DocView-7QBKHBU4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-7QBKHBU4.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"SheetView-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"SheetView-WP4DKSDS.js"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { B as BaseField, F as FilterConfig, S as SortRule, U as UserValue, a as SelectOption, b as BaseViewConfig } from './form-DqUOPVKI.js';
|
|
2
|
+
export { A as AttachmentValue, c as BASE_VIEW_TYPES, d as BaseModelError, e as BaseTableInfo, f as BaseViewType, C as CURRENCY_SYMBOLS, g as CellChange, h as CellValue, i as ColumnInfo, j as ComputeViewInput, k as ComputedView, D as DEFAULT_RECORD_COUNT, l as DEFAULT_TABLE_FIELDS, m as DEFAULT_TIME_ZONE, n as DEFAULT_VIEW_NAMES, o as DateFilterValue, p as FIELD_UI_TYPE, q as FieldPatch, r as FieldPosition, s as FieldProperty, t as FieldPropertyInput, u as FieldType, v as FieldTypeId, w as FilterCondition, x as FilterOperator, y as FormQuestion, z as FormSubmitError, G as GroupHeader, E as GroupRows, H as GroupRule, M as MAX_RECORDS_PER_TABLE, N as NUMBER_UI_TYPES, I as NewFieldInput, J as NewTableInput, K as NewViewInput, L as NumberUiType, R as RECORD_META, O as RowHeightLevel, P as STAT_LABELS, Q as StatType, T as TextSegment, V as UrlValue, W as ViewPatch, X as WallTime, Y as addDaysIn, Z as addField, _ as addRecords, $ as addTable, a0 as addView, a1 as cellValueToText, a2 as compareCellValues, a3 as computeView, a4 as copyName, a5 as createBaseUndoManager, a6 as dateFilterRange, a7 as defaultFieldProperty, a8 as deleteField, a9 as deleteRecords, aa as deleteTable, ab as deleteView, ac as duplicateField, ad as duplicateTable, ae as duplicateView, af as fieldUiType, ag as fieldValueKey, ah as filterKind, ai as filterOperatorsFor, aj as formQuestions, ak as formatNumberField, al as fromWallTime, am as initBase, an as isBaseViewType, ao as isComputedFieldType, ap as isEmptyCellValue, aq as isFieldType, ar as isFormFieldType, as as isKanbanGroupFieldType, at as isNumberUiType, au as isRecordMetaKey, av as moveRecords, aw as moveTable, ax as moveViewField, ay as normalizeCellValue, az as orderedRecordIds, aA as readCellValue, aB as readFieldMap, aC as readFieldValue, aD as readFields, aE as readTable, aF as readTables, aG as readView, aH as readViewMap, aI as readViews, aJ as renameTable, aK as repairAutoNumbers, aL as resolveStat, aM as setBaseActor, aN as setCells, aO as setColumnInfo, aP as setKanbanGroupField, aQ as startOfDayIn, aR as startOfMonthIn, aS as statText, aT as statTypesFor, aU as submitForm, aV as toWallTime, aW as uniqueName, aX as updateField, aY as updateView, aZ as weekdayIn, a_ as writeViewExtras } from './form-DqUOPVKI.js';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
|
|
5
|
+
/** id 前缀照飞书:数据表 tbl、字段 fld、记录 rec、视图 vew、选项 opt */
|
|
6
|
+
type BaseIdPrefix = "tbl" | "fld" | "rec" | "vew" | "opt";
|
|
7
|
+
declare function newBaseId(prefix: BaseIdPrefix, length?: number): string;
|
|
8
|
+
|
|
9
|
+
/** 看板的一列:单选按选项、人员按同一组人;没填分组字段的记录在「未分类」(key 为空串) */
|
|
10
|
+
interface KanbanColumn {
|
|
11
|
+
key: string;
|
|
12
|
+
/** 拖进这一列时写入分组字段的值:选项 id、人员数组;未分类为 null */
|
|
13
|
+
value: string | UserValue[] | null;
|
|
14
|
+
option?: SelectOption;
|
|
15
|
+
users?: UserValue[];
|
|
16
|
+
recordIds: string[];
|
|
17
|
+
}
|
|
18
|
+
interface ComputeKanbanInput {
|
|
19
|
+
/** 分组依据(单选或人员字段) */
|
|
20
|
+
field: BaseField;
|
|
21
|
+
fields: BaseField[];
|
|
22
|
+
/** 表内顺序 */
|
|
23
|
+
recordIds: string[];
|
|
24
|
+
getValue: (recordId: string, fieldId: string) => unknown;
|
|
25
|
+
filter?: FilterConfig | null;
|
|
26
|
+
sort?: SortRule[];
|
|
27
|
+
timeZone?: string;
|
|
28
|
+
now?: number;
|
|
29
|
+
}
|
|
30
|
+
/** 记录落在哪一列:单选是选项 id(选项被删了算未分类),人员是按存储顺序连起来的用户 id */
|
|
31
|
+
declare function kanbanColumnKey(field: BaseField, value: unknown): string;
|
|
32
|
+
/**
|
|
33
|
+
* 看板的列(纯函数,浏览器和服务端共用):先按视图的筛选、排序算出记录顺序,再按分组字段分列。
|
|
34
|
+
* 单选:每个选项一列(按选项顺序,空列也在);人员:每组人一列(按出现的先后)。未分类有记录时排在最前。
|
|
35
|
+
*/
|
|
36
|
+
declare function computeKanban(input: ComputeKanbanInput): KanbanColumn[];
|
|
37
|
+
interface KanbanMove {
|
|
38
|
+
recordId: string;
|
|
39
|
+
/** 目标列的 value(KanbanColumn.value) */
|
|
40
|
+
value: string | UserValue[] | null;
|
|
41
|
+
/** 放到目标列里这条记录的前面;没有时放到 afterId 后面;两个都没有(或视图有排序)只改分组值 */
|
|
42
|
+
beforeId?: string | null;
|
|
43
|
+
afterId?: string | null;
|
|
44
|
+
}
|
|
45
|
+
/** 拖动看板卡片:改分组字段的值,并按落点调整记录在表内的顺序;同一个事务里完成,撤销一步回去 */
|
|
46
|
+
declare function moveKanbanRecord(doc: Y.Doc, tableId: string, groupFieldId: string, move: KanbanMove, origin?: unknown): void;
|
|
47
|
+
|
|
48
|
+
declare class RankError extends Error {
|
|
49
|
+
}
|
|
50
|
+
/** 生成一个介于 a、b 之间的键(null 表示开头 / 末尾) */
|
|
51
|
+
declare function rankBetween(a: string | null, b: string | null): string;
|
|
52
|
+
/** 一次生成 n 个介于 a、b 之间、依次递增的键(批量插入用,比逐个生成更短) */
|
|
53
|
+
declare function ranksBetween(a: string | null, b: string | null, n: number): string[];
|
|
54
|
+
/** 记录排序:先比顺序键(字节序),相同再比 recordId;没有键的排在最后 */
|
|
55
|
+
declare function compareRank(rankA: string | undefined, idA: string, rankB: string | undefined, idB: string): number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 多维表格的 Y.Doc 结构(一份文档 = 一个多维表格,可含多张数据表):
|
|
59
|
+
*
|
|
60
|
+
* base Y.Map { schemaVersion }
|
|
61
|
+
* tableOrder Y.Array tableId
|
|
62
|
+
* tables Y.Map tableId → Y.Map { name, primaryFieldId }
|
|
63
|
+
* fields:<tbl> Y.Map fieldId → Y.Map { name, type, property, description }
|
|
64
|
+
* views:<tbl> Y.Map viewId → Y.Map { name, type, fields: Y.Array<fieldId>, colInfos: Y.Map,
|
|
65
|
+
* frozenColCount, rowHeightLevel, filter, sort, group }
|
|
66
|
+
* viewOrder:<tbl> Y.Array viewId
|
|
67
|
+
* records:<tbl> Y.Map recordId → Y.Map<fieldId, 单元格值>
|
|
68
|
+
* ranks:<tbl> Y.Map recordId → 顺序键(分数索引,见 rank.ts)
|
|
69
|
+
*
|
|
70
|
+
* 每条记录一个嵌套 Y.Map:两人同时改同一行的不同字段互不覆盖,改同一格后写入的生效。
|
|
71
|
+
* 顶层类型删不掉,删表时清空内容。tableOrder 用顶层数组而不是放进 base 里,
|
|
72
|
+
* 这样并发初始化也不会出现「两个客户端各建一个数组、其中一个被覆盖」。
|
|
73
|
+
*/
|
|
74
|
+
declare const SCHEMA_VERSION = 1;
|
|
75
|
+
declare const tableKeys: (tableId: string) => {
|
|
76
|
+
fields: string;
|
|
77
|
+
views: string;
|
|
78
|
+
viewOrder: string;
|
|
79
|
+
records: string;
|
|
80
|
+
ranks: string;
|
|
81
|
+
};
|
|
82
|
+
declare const baseRoot: (doc: Y.Doc) => Y.Map<unknown>;
|
|
83
|
+
declare const tableOrderArray: (doc: Y.Doc) => Y.Array<string>;
|
|
84
|
+
declare const tablesMap: (doc: Y.Doc) => Y.Map<Y.Map<unknown>>;
|
|
85
|
+
declare const fieldsMap: (doc: Y.Doc, tableId: string) => Y.Map<Y.Map<unknown>>;
|
|
86
|
+
declare const viewsMap: (doc: Y.Doc, tableId: string) => Y.Map<Y.Map<unknown>>;
|
|
87
|
+
declare const viewOrderArray: (doc: Y.Doc, tableId: string) => Y.Array<string>;
|
|
88
|
+
declare const recordsMap: (doc: Y.Doc, tableId: string) => Y.Map<Y.Map<unknown>>;
|
|
89
|
+
declare const ranksMap: (doc: Y.Doc, tableId: string) => Y.Map<string>;
|
|
90
|
+
/** 一张数据表涉及的全部顶层类型(撤销范围、变更订阅用) */
|
|
91
|
+
declare const tableTypes: (doc: Y.Doc, tableId: string) => (Y.Array<string> | Y.Map<Y.Map<unknown>> | Y.Map<string>)[];
|
|
92
|
+
declare const isBaseInitialized: (doc: Y.Doc) => boolean;
|
|
93
|
+
|
|
94
|
+
interface BaseSnapshotField extends Omit<BaseField, "uiType"> {
|
|
95
|
+
/** 同飞书开放接口的 ui_type(数字字段细分为 Number / Progress / Currency / Rating) */
|
|
96
|
+
uiType: string;
|
|
97
|
+
}
|
|
98
|
+
/** 记录元数据(系统字段的值从这里算) */
|
|
99
|
+
interface BaseRecordMeta {
|
|
100
|
+
createdTime?: number;
|
|
101
|
+
createdUser?: UserValue;
|
|
102
|
+
modifiedTime?: number;
|
|
103
|
+
modifiedUser?: UserValue;
|
|
104
|
+
autoNumber?: number;
|
|
105
|
+
}
|
|
106
|
+
interface BaseSnapshotRecord {
|
|
107
|
+
id: string;
|
|
108
|
+
rank: string;
|
|
109
|
+
fields: Record<string, unknown>;
|
|
110
|
+
meta?: BaseRecordMeta;
|
|
111
|
+
}
|
|
112
|
+
interface BaseSnapshotTable {
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
primaryFieldId: string;
|
|
116
|
+
fields: BaseSnapshotField[];
|
|
117
|
+
views: BaseViewConfig[];
|
|
118
|
+
records: BaseSnapshotRecord[];
|
|
119
|
+
}
|
|
120
|
+
/** 存盘用的 JSON 快照(docs-collab 存盘、导出、给服务端读) */
|
|
121
|
+
interface BaseSnapshot {
|
|
122
|
+
schemaVersion: number;
|
|
123
|
+
tables: BaseSnapshotTable[];
|
|
124
|
+
}
|
|
125
|
+
declare function toSnapshot(doc: Y.Doc): BaseSnapshot;
|
|
126
|
+
/** 把快照写进一份空文档(docs-collab 首次载入房间时用;只做一次) */
|
|
127
|
+
declare function loadSnapshot(doc: Y.Doc, snapshot: BaseSnapshot, origin?: unknown): void;
|
|
128
|
+
/** 纯文本(全文搜索、摘要用):每张表一段,表名、字段名一行,之后每条记录一行,单元格用制表符隔开 */
|
|
129
|
+
declare function toPlainText(doc: Y.Doc): string;
|
|
130
|
+
|
|
131
|
+
export { BaseField, type BaseIdPrefix, type BaseRecordMeta, type BaseSnapshot, type BaseSnapshotField, type BaseSnapshotRecord, type BaseSnapshotTable, BaseViewConfig, type ComputeKanbanInput, FilterConfig, type KanbanColumn, type KanbanMove, RankError, SCHEMA_VERSION, SelectOption, SortRule, UserValue, baseRoot, compareRank, computeKanban, fieldsMap, isBaseInitialized, kanbanColumnKey, loadSnapshot, moveKanbanRecord, newBaseId, rankBetween, ranksBetween, ranksMap, recordsMap, tableKeys, tableOrderArray, tableTypes, tablesMap, toPlainText, toSnapshot, viewOrderArray, viewsMap };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BASE_VIEW_TYPES, BaseModelError, CURRENCY_SYMBOLS, DEFAULT_RECORD_COUNT, DEFAULT_TABLE_FIELDS, DEFAULT_TIME_ZONE, DEFAULT_VIEW_NAMES, FIELD_UI_TYPE, FieldType, FormSubmitError, MAX_RECORDS_PER_TABLE, NUMBER_UI_TYPES, RECORD_META, RankError, SCHEMA_VERSION, STAT_LABELS, addDaysIn, addField, addRecords, addTable, addView, baseRoot, cellValueToText, compareCellValues, compareRank, computeKanban, computeView, copyName, createBaseUndoManager, dateFilterRange, defaultFieldProperty, deleteField, deleteRecords, deleteTable, deleteView, duplicateField, duplicateTable, duplicateView, fieldUiType, fieldValueKey, fieldsMap, filterKind, filterOperatorsFor, formQuestions, formatNumberField, fromWallTime, initBase, isBaseInitialized, isBaseViewType, isComputedFieldType, isEmptyCellValue, isFieldType, isFormFieldType, isKanbanGroupFieldType, isNumberUiType, isRecordMetaKey, kanbanColumnKey, loadSnapshot, moveKanbanRecord, moveRecords, moveTable, moveViewField, newBaseId, normalizeCellValue, orderedRecordIds, rankBetween, ranksBetween, ranksMap, readCellValue, readFieldMap, readFieldValue, readFields, readTable, readTables, readView, readViewMap, readViews, recordsMap, renameTable, repairAutoNumbers, resolveStat, setBaseActor, setCells, setColumnInfo, setKanbanGroupField, startOfDayIn, startOfMonthIn, statText, statTypesFor, submitForm, tableKeys, tableOrderArray, tableTypes, tablesMap, toPlainText, toSnapshot, toWallTime, uniqueName, updateField, updateView, viewOrderArray, viewsMap, weekdayIn, writeViewExtras } from './chunk-S57WFYWY.js';
|
|
2
|
+
//# sourceMappingURL=base-model.js.map
|
|
3
|
+
//# sourceMappingURL=base-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"base-model.js"}
|