@ai-table/state 0.0.42 → 0.0.43

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.
@@ -27,9 +27,10 @@ export function getFieldPositionInView(viewId, fields, path, newPath) {
27
27
  }
28
28
  else {
29
29
  const lastField = fields[fields.length - 1];
30
- newPosition = lastField.positions[viewId] + 1;
30
+ const lastPosition = lastField.positions[viewId] + 1;
31
+ newPosition = (targetPosition + lastPosition) / 2;
31
32
  }
32
33
  }
33
34
  return newPosition;
34
35
  }
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW92ZS1maWVsZHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9zdGF0ZS9zcmMvdXRpbHMvZmllbGQvbW92ZS1maWVsZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV2QyxNQUFNLFVBQVUsVUFBVSxDQUFDLE9BQW9CLEVBQUUsT0FBeUIsRUFBRSxXQUFxQztJQUM3RyxNQUFNLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxHQUFHLE9BQU8sQ0FBQztJQUNsQyxPQUFPLENBQUMsU0FBUyxDQUFDLE9BQU8sRUFBRSxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDOUMsQ0FBQztBQUVELE1BQU0sVUFBVSxzQkFBc0IsQ0FBQyxNQUFjLEVBQUUsTUFBcUIsRUFBRSxJQUFnQixFQUFFLE9BQW1CO0lBQy9HLE1BQU0sY0FBYyxHQUFJLE1BQU0sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQXNCLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ2xGLElBQUksV0FBVyxHQUFHLENBQUMsQ0FBQztJ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Bvc2l0aW9uc1t2aWV3SWRdO1xuICAgICAgICAgICAgbmV3UG9zaXRpb24gPSAodGFyZ2V0UG9zaXRpb24gKyB0YXJnZXROZXh0UG9zaXRpb24pIC8gMjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGNvbnN0IGxhc3RGaWVsZCA9IGZpZWxkc1tmaWVsZHMubGVuZ3RoIC0gMV07XG4gICAgICAgICAgICBjb25zdCBsYXN0UG9zaXRpb24gPSAobGFzdEZpZWxkIGFzIEFJVGFibGVWaWV3RmllbGQpLnBvc2l0aW9uc1t2aWV3SWRdICsgMTtcbiAgICAgICAgICAgIG5ld1Bvc2l0aW9uID0gKHRhcmdldFBvc2l0aW9uICsgbGFzdFBvc2l0aW9uKSAvIDI7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIG5ld1Bvc2l0aW9uO1xufVxuIl19
@@ -5,9 +5,9 @@ import { PositionsActions } from '../action/position';
5
5
  export function createDefaultPositions(views, activeId, data, index) {
6
6
  const positions = {};
7
7
  const position = getPosition(data, activeId, index);
8
- const maxPosition = data.length ? data[data.length - 1].positions[activeId] : -1;
9
8
  views.forEach((element) => {
10
- positions[element._id] = element._id === activeId ? position : maxPosition + 1;
9
+ const lastPosition = data.length ? data[data.length - 1].positions[element._id] : -1;
10
+ positions[element._id] = element._id === activeId ? position : lastPosition + 1;
11
11
  });
12
12
  return positions;
13
13
  }
@@ -19,7 +19,8 @@ export function getPosition(data, activeViewId, index) {
19
19
  position = (previousViewPosition + nextViewPosition) / 2;
20
20
  }
21
21
  else {
22
- position = index;
22
+ const lastPosition = data[data.length - 1].positions?.[activeViewId];
23
+ position = lastPosition ? lastPosition + 1 : index;
23
24
  }
24
25
  return position;
25
26
  }
@@ -70,4 +71,4 @@ export function removeView(aiTable, records, fields, activeViewId) {
70
71
  });
71
72
  ViewActions.removeView(aiTable, [activeViewId]);
72
73
  }
73
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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b25zW29yaWdpblZpZXdJZF1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgW2ZpZWxkLl9pZF1cbiAgICAgICAgKTtcbiAgICB9KTtcbiAgICByZXR1cm4gbmV3Vmlldztcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHJlbW92ZVZpZXcoYWlUYWJsZTogQUlWaWV3VGFibGUsIHJlY29yZHM6IEFJVGFibGVWaWV3UmVjb3JkcywgZmllbGRzOiBBSVRhYmxlVmlld0ZpZWxkcywgYWN0aXZlVmlld0lkOiBzdHJpbmcpIHtcbiAgICByZWNvcmRzLmZvckVhY2goKHJlY29yZCkgPT4ge1xuICAgICAgICBQb3NpdGlvbnNBY3Rpb25zLnNldFJlY29yZFBvc2l0aW9ucyhhaVRhYmxlLCB7IFthY3RpdmVWaWV3SWRdOiB1bmRlZmluZWQgfSwgW3JlY29yZC5faWRdKTtcbiAgICB9KTtcbiAgICBmaWVsZHMuZm9yRWFjaCgoZmllbGQpID0+IHtcbiAgICAgICAgY29uc3QgcG9zaXRpb25zID0geyAuLi5maWVsZC5wb3NpdGlvbnMgfTtcbiAgICAgICAgZGVsZXRlIHBvc2l0aW9uc1thY3RpdmVWaWV3SWRdO1xuICAgICAgICBBY3Rpb25zLnNldEZpZWxkPEFJVGFibGVWaWV3RmllbGQ+KFxuICAgICAgICAgICAgYWlUYWJsZSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBwb3NpdGlvbnNcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBbZmllbGQuX2lkXVxuICAgICAgICApO1xuICAgIH0pO1xuICAgIFZpZXdBY3Rpb25zLnJlbW92ZVZpZXcoYWlUYWJsZSwgW2FjdGl2ZVZpZXdJZF0pO1xufVxuIl19
@@ -1241,9 +1241,9 @@ const buildRemoveFieldItem = (getUpdatedInfo) => {
1241
1241
  function createDefaultPositions(views, activeId, data, index) {
1242
1242
  const positions = {};
1243
1243
  const position = getPosition(data, activeId, index);
1244
- const maxPosition = data.length ? data[data.length - 1].positions[activeId] : -1;
1245
1244
  views.forEach((element) => {
1246
- positions[element._id] = element._id === activeId ? position : maxPosition + 1;
1245
+ const lastPosition = data.length ? data[data.length - 1].positions[element._id] : -1;
1246
+ positions[element._id] = element._id === activeId ? position : lastPosition + 1;
1247
1247
  });
1248
1248
  return positions;
1249
1249
  }
@@ -1255,7 +1255,8 @@ function getPosition(data, activeViewId, index) {
1255
1255
  position = (previousViewPosition + nextViewPosition) / 2;
1256
1256
  }
1257
1257
  else {
1258
- position = index;
1258
+ const lastPosition = data[data.length - 1].positions?.[activeViewId];
1259
+ position = lastPosition ? lastPosition + 1 : index;
1259
1260
  }
1260
1261
  return position;
1261
1262
  }
@@ -1388,7 +1389,8 @@ function getFieldPositionInView(viewId, fields, path, newPath) {
1388
1389
  }
1389
1390
  else {
1390
1391
  const lastField = fields[fields.length - 1];
1391
- newPosition = lastField.positions[viewId] + 1;
1392
+ const lastPosition = lastField.positions[viewId] + 1;
1393
+ newPosition = (targetPosition + lastPosition) / 2;
1392
1394
  }
1393
1395
  }
1394
1396
  return newPosition;
@@ -1 +1 @@
1
- {"version":3,"file":"ai-table-state.mjs","sources":["../../../packages/state/src/shared/yjs-table.ts","../../../packages/state/src/types/view.ts","../../../packages/state/src/types/action.ts","../../../packages/state/src/shared/utils/translate.ts","../../../packages/state/src/constants/default.ts","../../../packages/state/src/shared/utils/initialize.ts","../../../packages/state/src/shared/to-table/array-event.ts","../../../packages/state/src/shared/to-table/map-event.ts","../../../packages/state/src/shared/to-table/index.ts","../../../packages/state/src/shared/to-yjs/update-field-value.ts","../../../packages/state/src/shared/to-yjs/set-node.ts","../../../packages/state/src/shared/to-yjs/add-node.ts","../../../packages/state/src/shared/to-yjs/remove-node.ts","../../../packages/state/src/shared/to-yjs/index.ts","../../../packages/state/src/utils/common.ts","../../../packages/state/src/utils/record/sort.ts","../../../packages/state/src/utils/record/filter.ts","../../../packages/state/src/utils/field/sort-fields.ts","../../../packages/state/src/utils/build.ts","../../../packages/state/src/action/field.ts","../../../packages/state/src/action/general.ts","../../../packages/state/src/action/position.ts","../../../packages/state/src/action/record.ts","../../../packages/state/src/action/view.ts","../../../packages/state/src/action/index.ts","../../../packages/state/src/utils/record/update-system-field-value.ts","../../../packages/state/src/utils/field/add-fields.ts","../../../packages/state/src/utils/field/remove-field.ts","../../../packages/state/src/utils/view.ts","../../../packages/state/src/utils/record/add-records.ts","../../../packages/state/src/utils/record/update-field-value.ts","../../../packages/state/src/utils/weak-map.ts","../../../packages/state/src/utils/field/move-fields.ts","../../../packages/state/src/plugins/state.plugin.ts","../../../packages/state/src/constants/field-menu-item.ts","../../../packages/state/src/constants/context-menu-item.ts","../../../packages/state/src/constants/view.ts","../../../packages/state/src/ai-table-state.ts"],"sourcesContent":["import { AITable } from \"@ai-table/grid\";\n\nconst IS_LOCAL: WeakSet<any> = new WeakSet();\nconst IS_REMOTE: WeakSet<any> = new WeakSet();\nconst IS_UNDO: WeakSet<any> = new WeakSet();\n\nexport interface YjsAITable {\n isLocal: () => boolean;\n asLocal: () => void;\n}\n\nexport const YjsAITable = {\n isLocal: (aiTable: AITable): boolean => {\n return IS_LOCAL.has(aiTable);\n },\n\n asLocal: (aiTable: AITable, fn: () => void): void => {\n const wasLocal = YjsAITable.isLocal(aiTable);\n IS_LOCAL.add(aiTable);\n\n fn();\n\n if (!wasLocal) {\n IS_LOCAL.delete(aiTable);\n }\n },\n\n isRemote: (aiTable: AITable): boolean => {\n return IS_REMOTE.has(aiTable);\n },\n\n asRemote: (aiTable: AITable, fn: () => void): void => {\n const wasRemote = YjsAITable.isRemote(aiTable);\n IS_REMOTE.add(aiTable);\n\n fn();\n\n if (!wasRemote) {\n Promise.resolve().then(() => IS_REMOTE.delete(aiTable));\n }\n },\n\n isUndo: (aiTable: AITable): boolean => {\n return IS_UNDO.has(aiTable);\n },\n\n asUndo: (aiTable: AITable, fn: () => void): void => {\n const wasUndo = YjsAITable.isUndo(aiTable);\n IS_UNDO.add(aiTable);\n\n fn();\n\n if (!wasUndo) {\n Promise.resolve().then(() => IS_UNDO.delete(aiTable));\n }\n }\n};\n","import { AITableField, AITableFilterCondition, AITableRecord } from '@ai-table/grid';\nimport { Id } from 'ngx-tethys/types';\n\nexport class Positions {\n [view_id: string]: number;\n}\n\nexport class RemovePositions {\n [view_id: string]: undefined;\n}\n\nexport interface AITableViewRecord extends AITableRecord {\n positions: Positions;\n}\n\nexport interface AITableViewField extends AITableField {\n positions: Positions;\n}\n\nexport type AITableViewRecords = AITableViewRecord[];\n\nexport type AITableViewFields = AITableViewField[];\n\nexport enum Direction {\n default = 0,\n ascending = 1,\n descending = -1\n}\n\nexport enum AITableFilterLogical {\n and = 'and',\n or = 'or'\n}\n\nexport type ViewSettings = AITableSearchOptions & AITableFilterConditions & AITableSortOptions;\n\nexport interface AITableView {\n _id: string;\n short_id: string;\n name: string;\n emoji_icon?: string;\n settings?: ViewSettings;\n}\n\nexport interface AITableFilterConditions<TValue = unknown> {\n condition_logical?: AITableFilterLogical;\n conditions?: AITableFilterCondition<TValue>[];\n}\n\nexport interface AITableSortOptions {\n is_keep_sort?: boolean;\n sorts?: {\n sort_by: Id;\n direction: Direction;\n }[];\n}\n\nexport interface AITableSearchOptions {\n keywords?: string;\n}\n\nexport type AITableViews = AITableView[];\n","import { AIRecordFieldIdPath, AITableField, AITableRecord, AITableRecordUpdatedInfo, IdPath, NumberPath } from '@ai-table/grid';\nimport { AITableView, AITableViewRecord, Positions, RemovePositions } from './view';\n\nexport enum ActionName {\n UpdateFieldValue = 'update_field_value',\n AddRecord = 'add_record',\n AddField = 'add_field',\n MoveField = 'move_field',\n MoveRecord = 'move_record',\n RemoveField = 'remove_field',\n RemoveRecord = 'remove_record',\n SetField = 'set_field',\n SetView = 'set_view',\n AddView = 'add_view',\n RemoveView = 'remove_view',\n SetRecordPositions = 'set_record_positions',\n UpdateSystemFieldValue = 'update_system_field_value'\n}\n\nexport enum ExecuteType {\n Execute,\n Undo,\n Redo\n}\n\nexport type UpdateFieldValueAction = {\n type: ActionName.UpdateFieldValue;\n path: AIRecordFieldIdPath;\n fieldValue: any;\n newFieldValue: any;\n};\n\nexport type AddRecordAction = {\n type: ActionName.AddRecord;\n path: NumberPath;\n record: AITableRecord | AITableViewRecord;\n};\n\nexport type AddFieldAction = {\n type: ActionName.AddField;\n path: NumberPath;\n field: AITableField;\n originId?: string;\n isCopy?: boolean;\n};\n\nexport type MoveRecordAction = {\n type: ActionName.MoveRecord;\n path: NumberPath;\n newPath: NumberPath;\n};\n\nexport type RemoveFieldAction = {\n type: ActionName.RemoveField;\n path: IdPath;\n};\n\nexport type RemoveRecordAction = {\n type: ActionName.RemoveRecord;\n path: IdPath;\n};\n\nexport type SetFieldAction = {\n type: ActionName.SetField;\n path: IdPath;\n properties: Partial<AITableField>;\n newProperties: Partial<AITableField>;\n};\n\nexport interface SetViewAction {\n type: ActionName.SetView;\n properties: Partial<AITableView>;\n newProperties: Partial<AITableView>;\n path: IdPath;\n}\n\nexport interface AddViewAction {\n type: ActionName.AddView;\n view: AITableView;\n path: [number];\n}\n\nexport interface RemoveViewAction {\n type: ActionName.RemoveView;\n path: IdPath;\n}\n\nexport interface SetRecordPositionAction {\n type: ActionName.SetRecordPositions;\n positions: Positions | RemovePositions;\n path: IdPath;\n}\n\nexport interface UpdateSystemFieldValue {\n type: ActionName.UpdateSystemFieldValue;\n updatedInfo: Partial<AITableRecordUpdatedInfo>;\n path: IdPath;\n}\n\nexport type AITableViewAction = SetViewAction | AddViewAction | RemoveViewAction;\n\nexport type AITableSystemFieldAction = SetRecordPositionAction | UpdateSystemFieldValue;\n\nexport type AITableAction =\n | UpdateFieldValueAction\n | AddRecordAction\n | AddFieldAction\n | RemoveRecordAction\n | RemoveFieldAction\n | SetFieldAction\n | MoveRecordAction\n | AITableViewAction\n | AITableSystemFieldAction;\n","import { AITableRecordUpdatedInfo, FieldValue, isSystemField, TrackableEntity } from '@ai-table/grid';\nimport {\n AITableViewField,\n AITableViewFields,\n AITableViewRecord,\n AITableViewRecords,\n CustomFieldValues,\n Positions,\n RecordSyncElement,\n SyncArrayElement,\n SyncMapElement,\n SystemFieldValues\n} from '../../types';\nimport * as Y from 'yjs';\n\nexport enum SystemFieldIndex {\n Id = 0,\n ShortId = 1,\n CreatedAt = 2,\n CreatedBy = 3,\n Positions = 4,\n UpdatedAt = 5,\n UpdatedBy = 6\n}\n\nexport function toSyncElement(node: any): SyncMapElement {\n const element: SyncMapElement = new Y.Map();\n for (const key in node) {\n element.set(key, node[key]);\n }\n return element;\n}\n\nexport function toRecordSyncElement(record: AITableViewRecord, fields: AITableViewFields): Y.Array<Y.Array<any>> {\n const systemFieldValues = new Y.Array();\n // 临时方案:为了解决删除时协同操作无法精准获取删除的 id 的问题,将原来的[idValue] 改为[{'_id': idValue}]\n systemFieldValues.insert(0, getSystemFieldValues(record));\n const customFieldValues = new Y.Array();\n const valuesArray: FieldValue[] = [];\n fields.forEach((field: AITableViewField) => {\n let value = record['values'][field._id];\n // yjs will throw an error if the value is undefined.\n if (value === undefined) {\n value = null;\n }\n valuesArray.push(value);\n });\n customFieldValues.insert(0, valuesArray);\n // To save memory, convert map to array.\n const element: RecordSyncElement = new Y.Array<Y.Array<any>>();\n element.insert(0, [systemFieldValues, customFieldValues]);\n return element;\n}\n\nexport function translatePositionToPath(data: AITableViewRecords | AITableViewFields, position: number, activeViewId: string) {\n let index = data.findIndex((value, index) => {\n if (index === 0) {\n return position < value.positions[activeViewId];\n }\n return position > data[index - 1].positions[activeViewId] && position < value.positions[activeViewId];\n });\n if (index === -1) {\n index = data.length;\n }\n return [index];\n}\n\nexport function getShareTypeNumberPath(path: (string | number)[]): number[] {\n return path.filter((node) => typeof node === 'number') as number[];\n}\n\nexport function getSharedRecordId(records: Y.Array<SyncArrayElement>, recordIndex: number) {\n return records && (records as Y.Array<SyncArrayElement>).get(recordIndex).get(0).get(0)['_id'];\n}\n\nexport function getSharedRecord(records: Y.Array<SyncArrayElement>, recordIndex: number) {\n return records && (records as Y.Array<SyncArrayElement>).get(recordIndex);\n}\n\nexport function getSharedMapValueId(values: Y.Array<SyncMapElement>, index: number) {\n return values && values.get(index).get('_id');\n}\n\nexport function getSharedRecordIndex(sharedRecords: Y.Array<SyncArrayElement>, recordId: string) {\n let recordIndex = -1;\n for (let index = 0; index < sharedRecords.length; index++) {\n const sharedRecordId = getSharedRecordId(sharedRecords, index);\n if (sharedRecordId === recordId) {\n recordIndex = index;\n break;\n }\n }\n return recordIndex;\n}\n\nexport function getSharedMapValueIndex(sharedNodes: Y.Array<SyncMapElement>, id: string) {\n let nodeIndex = -1;\n for (let index = 0; index < sharedNodes.length; index++) {\n const sharedId = getSharedMapValueId(sharedNodes, index);\n if (sharedId === id) {\n nodeIndex = index;\n break;\n }\n }\n return nodeIndex;\n}\n\nexport const getSystemFieldValues = (record: AITableViewRecord): SystemFieldValues => {\n return [\n { _id: record['_id'] },\n record.short_id,\n record.created_at,\n record.created_by,\n record['positions'],\n record.updated_at,\n record.updated_by\n ];\n};\n\nexport const getCustomFieldValues = (record: AITableViewRecord): CustomFieldValues => {\n throw new Error('No implement');\n};\n\nexport const getValuesByCustomFieldValues = (customFieldValues: CustomFieldValues, fields: AITableViewFields) => {\n const fieldIds = fields.map((item) => item._id);\n const recordValue: Record<string, any> = {};\n fieldIds.forEach((item, index) => {\n recordValue[item] = customFieldValues[index];\n });\n return recordValue;\n};\n\nexport const getTrackableEntityBySystemFieldValues = (systemFieldValues: SystemFieldValues): TrackableEntity => {\n return {\n created_at: systemFieldValues[SystemFieldIndex.CreatedAt],\n created_by: systemFieldValues[SystemFieldIndex.CreatedBy],\n updated_at: systemFieldValues[SystemFieldIndex.UpdatedAt],\n updated_by: systemFieldValues[SystemFieldIndex.UpdatedBy]\n };\n};\n\nexport const getIdBySystemFieldValues = (systemFieldValues: SystemFieldValues): string => {\n return systemFieldValues[SystemFieldIndex.Id]['_id'];\n};\n\nexport const getShortIdBySystemFieldValues = (systemFieldValues: SystemFieldValues): string => {\n return systemFieldValues[SystemFieldIndex.ShortId];\n};\n\nexport const getIdBySystemFieldValuesType = (systemFieldValuesType: Y.Array<any>): string => {\n return systemFieldValuesType.get(SystemFieldIndex.Id)['_id'];\n};\n\nexport const getPositionsBySystemFieldValues = (systemFieldValues: SystemFieldValues): Positions => {\n return systemFieldValues[SystemFieldIndex.Positions];\n};\n\nexport const getPositionsByRecordSyncElement = (recordSyncElement: RecordSyncElement) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n const positions = systemFieldType.get(SystemFieldIndex.Positions);\n return positions;\n};\n\nexport const setRecordPositions = (recordSyncElement: RecordSyncElement, newPositions: Positions) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n systemFieldType.delete(SystemFieldIndex.Positions);\n systemFieldType.insert(SystemFieldIndex.Positions, [newPositions]);\n};\n\nexport const setRecordUpdatedInfo = (recordSyncElement: RecordSyncElement, info: AITableRecordUpdatedInfo) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n systemFieldType.delete(SystemFieldIndex.UpdatedAt, 2);\n systemFieldType.insert(SystemFieldIndex.UpdatedAt, [info.updated_at, info.updated_by]);\n};\n","export const AI_TABLE_CONTENT_FIELD_NAME = 'content';","import * as Y from 'yjs';\nimport { AITableViewFields, AITableViewRecords, AITableViews, SharedRecordJsonType, SharedType } from '../../types';\nimport {\n getIdBySystemFieldValues,\n getPositionsBySystemFieldValues,\n getShortIdBySystemFieldValues,\n getTrackableEntityBySystemFieldValues,\n getValuesByCustomFieldValues,\n toRecordSyncElement,\n toSyncElement\n} from './translate';\nimport { AI_TABLE_CONTENT_FIELD_NAME } from '../../constants/default';\n\nexport const createSharedType = (fieldName: string = AI_TABLE_CONTENT_FIELD_NAME) => {\n const doc = new Y.Doc();\n const sharedType = doc.getMap<any>(fieldName);\n return sharedType;\n};\n\nexport const getDataBySharedType = (sharedType: SharedType) => {\n const data = sharedType.toJSON();\n const fields: AITableViewFields = data['fields'];\n const records: AITableViewRecords = getRecordsBySharedJson(data['records'], fields);\n const views = data['views'];\n return {\n records,\n fields,\n views\n };\n};\n\nexport const getSharedTypeByData = (\n doc: Y.Doc,\n initializeValue: {\n fields: AITableViewFields;\n records: AITableViewRecords;\n views: AITableViews;\n }\n) => {\n const sharedType = doc.getMap<any>(AI_TABLE_CONTENT_FIELD_NAME);\n toSharedType(sharedType, initializeValue);\n return sharedType;\n};\n\nexport function toSharedType(\n sharedType: Y.Map<any>,\n data: {\n fields: AITableViewFields;\n records: AITableViewRecords;\n views: AITableViews;\n }\n): void {\n sharedType.doc!.transact(() => {\n const fieldSharedType = new Y.Array();\n fieldSharedType.insert(0, data.fields.map(toSyncElement));\n sharedType.set('fields', fieldSharedType);\n const recordSharedType = new Y.Array<Y.Array<any>>();\n sharedType.set('records', recordSharedType);\n recordSharedType.insert(\n 0,\n data.records.map((record) => {\n return toRecordSyncElement(record, data.fields);\n })\n );\n const viewsSharedType = new Y.Array();\n sharedType.set('views', viewsSharedType);\n viewsSharedType.insert(0, data.views.map(toSyncElement));\n });\n}\n\nexport const getRecordsBySharedJson = (recordJsonArray: SharedRecordJsonType[], fields: AITableViewFields): AITableViewRecords => {\n return recordJsonArray.map((record: SharedRecordJsonType) => {\n const [systemFieldValues, customFieldValues] = record;\n return {\n _id: getIdBySystemFieldValues(systemFieldValues),\n short_id: getShortIdBySystemFieldValues(systemFieldValues),\n ...getTrackableEntityBySystemFieldValues(systemFieldValues),\n positions: getPositionsBySystemFieldValues(systemFieldValues),\n values: getValuesByCustomFieldValues(customFieldValues, fields)\n };\n });\n};\n","import { isArray } from 'ngx-tethys/util';\nimport * as Y from 'yjs';\nimport {\n ActionName,\n AITableAction,\n AITableView,\n AITableViewFields,\n AITableViewRecords,\n AIViewTable,\n Positions,\n SharedType,\n SyncArrayElement,\n SyncMapElement\n} from '../../types';\nimport { getIdBySystemFieldValues, getShareTypeNumberPath, getTrackableEntityBySystemFieldValues, translatePositionToPath } from '../utils';\nimport {\n getPositionsBySystemFieldValues,\n getSharedMapValueId,\n getSharedRecord,\n getSharedRecordId,\n getShortIdBySystemFieldValues,\n getValuesByCustomFieldValues,\n SystemFieldIndex\n} from '../utils/translate';\nimport { AIRecordFieldIdPath, AITableField, AITableQueries, IdPath, NumberPath } from '@ai-table/grid';\n\nexport default function translateArrayEvent(aiTable: AIViewTable, sharedType: SharedType, event: Y.YEvent<any>): AITableAction[] {\n let offset = 0;\n let targetPath = getShareTypeNumberPath(event.path);\n const isRecordsTranslate = event.path.includes('records');\n const isFieldsTranslate = event.path.includes('fields');\n const isViewsTranslate = event.path.includes('views');\n const actions: AITableAction[] = [];\n const activeViewId = aiTable.activeViewId();\n\n event.changes.delta.forEach((delta) => {\n if ('retain' in delta) {\n offset += delta.retain ?? 0;\n }\n\n if ('delete' in delta) {\n if (isAddOrRemove(targetPath)) {\n if (isViewsTranslate) {\n const removeView = aiTable.views()[offset];\n if (removeView) {\n actions.push({\n type: ActionName.RemoveView,\n path: [removeView._id]\n });\n }\n } else {\n const type = isRecordsTranslate ? ActionName.RemoveRecord : ActionName.RemoveField;\n const removeIds = getRemoveIds(event, type);\n if (removeIds.length) {\n removeIds.forEach((path) => {\n actions.push({\n type,\n path\n });\n });\n }\n }\n }\n }\n\n if ('insert' in delta) {\n if (isArray(delta.insert)) {\n if (isRecordsTranslate) {\n if (isAddOrRemove(targetPath)) {\n delta.insert?.map((item: Y.Array<any>) => {\n const data = item.toJSON();\n const [systemFieldValues, customFieldValues] = data;\n const positions = getPositionsBySystemFieldValues(systemFieldValues);\n const position = positions[activeViewId];\n const path = translatePositionToPath(\n aiTable.records() as AITableViewRecords,\n position,\n activeViewId\n ) as NumberPath;\n\n actions.push({\n type: ActionName.AddRecord,\n path: path,\n record: {\n _id: getIdBySystemFieldValues(systemFieldValues),\n short_id: getShortIdBySystemFieldValues(systemFieldValues),\n ...getTrackableEntityBySystemFieldValues(systemFieldValues),\n positions: getPositionsBySystemFieldValues(systemFieldValues),\n values: getValuesByCustomFieldValues(customFieldValues, aiTable.fields() as AITableViewFields)\n }\n });\n });\n } else {\n try {\n const sharedRecords = sharedType.get('records')! as Y.Array<SyncArrayElement>;\n const sharedFields = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n let systemFieldOffset = 0;\n delta.insert?.map((item: any) => {\n const recordIndex = targetPath[0] as number;\n const fieldIndex = offset;\n const record = (aiTable.records() as AITableViewRecords)[recordIndex];\n if (isSystemFieldOperation(targetPath)) {\n if (isPositionsOperation(fieldIndex)) {\n const newPositions: Positions = {};\n for (const key in item) {\n newPositions[key] = item[key];\n }\n actions.push({\n type: ActionName.SetRecordPositions,\n path: [record._id],\n positions: newPositions\n });\n // 此处的循环会包含 updated_at 和 updated_by 各一次,这里只处理 updated_by 同时包含两个字段的修改\n } else if (isUpdatedByOperation(fieldIndex + systemFieldOffset)) {\n const systemFieldValues = getSharedRecord(sharedRecords, recordIndex).get(0).toJSON();\n const { updated_at, updated_by } = getTrackableEntityBySystemFieldValues(systemFieldValues);\n actions.push({\n type: ActionName.UpdateSystemFieldValue,\n path: [record._id],\n updatedInfo: { updated_at, updated_by }\n });\n }\n systemFieldOffset++;\n } else {\n const recordId = getSharedRecordId(sharedRecords, recordIndex);\n const fieldId = getSharedMapValueId(sharedFields, fieldIndex);\n const path = [recordId, fieldId] as AIRecordFieldIdPath;\n const fieldValue = AITableQueries.getFieldValue(aiTable, path);\n // To exclude insert triggered by field inserts.\n if (fieldValue !== item) {\n actions.push({\n type: ActionName.UpdateFieldValue,\n path,\n fieldValue,\n newFieldValue: item\n });\n }\n }\n });\n } catch (error) {}\n }\n }\n if (isFieldsTranslate) {\n delta.insert?.map((item: Y.Map<any>) => {\n const data = item.toJSON();\n const path = translatePositionToPath(\n aiTable.fields() as AITableViewFields,\n data['positions'][activeViewId],\n activeViewId\n ) as NumberPath;\n actions.push({\n type: ActionName.AddField,\n path,\n field: data as AITableField\n });\n });\n }\n if (isViewsTranslate) {\n delta.insert?.map((item: Y.Map<any>, index) => {\n const data = item.toJSON();\n actions.push({\n type: ActionName.AddView,\n path: [offset + index],\n view: data as AITableView\n });\n });\n }\n }\n }\n });\n return actions;\n}\n\nexport function isAddOrRemove(targetPath: number[]): boolean {\n return targetPath.length === 0;\n}\n\nexport function isSystemFieldOperation(targetPath: number[]): boolean {\n if (targetPath.length === 2 && targetPath[1] === 0) {\n return true;\n }\n return false;\n}\n\nexport function isCustomFieldOperation(targetPath: number[]): boolean {\n if (targetPath.length === 2 && targetPath[1] === 1) {\n return true;\n }\n return false;\n}\n\nexport function isPositionsOperation(fieldIndex: number): boolean {\n return fieldIndex === SystemFieldIndex.Positions;\n}\n\nexport function isUpdatedByOperation(fieldIndex: number): boolean {\n return fieldIndex === SystemFieldIndex.UpdatedBy;\n}\n\nexport function getRemoveIds(event: Y.YEvent<any>, type: ActionName.RemoveField | ActionName.RemoveRecord) {\n const ids: [string][] = [];\n if (!type) {\n return ids;\n }\n\n Y.iterateDeletedStructs(\n event.transaction,\n event.transaction.deleteSet,\n // @param {Item|GC} item\n (item) => {\n if (item instanceof Y.Item && item.deleted) {\n if (type === ActionName.RemoveField && item.parentSub === '_id') {\n ids.push(item.content.getContent() as IdPath);\n }\n if (type === ActionName.RemoveRecord) {\n const content = item.content.getContent();\n if (content[0] && content[0]['_id']) {\n ids.push([content[0]['_id']]);\n }\n }\n }\n }\n );\n return ids;\n}\n","import { AITableField } from '@ai-table/grid';\nimport * as Y from 'yjs';\nimport { getShareTypeNumberPath } from '../utils';\nimport { ActionName, AITableAction, AITableView, AIViewTable, SharedType, SyncMapElement } from '../../types';\n\nexport default function translateMapEvent(\n aiTable: AIViewTable,\n sharedType: SharedType,\n event: Y.YMapEvent<unknown>\n): AITableAction[] {\n const isFieldsTranslate = event.path.includes('fields');\n const isViewTranslate = event.path.includes('views');\n\n if (isViewTranslate || isFieldsTranslate) {\n let [targetPath] = getShareTypeNumberPath(event.path) as [number];\n let targetElement;\n const targetSyncElement = event.target as SharedType;\n if (isFieldsTranslate) {\n const field = sharedType.get('fields')?.get(targetPath) as SyncMapElement;\n const fieldId = field && field.get('_id');\n targetElement = fieldId && aiTable.fields().find((item) => item._id === field.get('_id'));\n }\n\n if (isViewTranslate) {\n targetElement = aiTable.views()[targetPath];\n }\n\n if (targetElement) {\n const keyChanges: [string, { action: 'add' | 'update' | 'delete'; oldValue: any }][] = Array.from(event.changes.keys.entries());\n const newProperties: Partial<AITableView | AITableField> = {};\n const properties: Partial<AITableView | AITableField> = {};\n\n const entries: [string, any][] = keyChanges.map(([key, info]) => {\n const value = targetSyncElement.get(key);\n return [key, info.action === 'delete' ? null : value instanceof Y.AbstractType ? value.toJSON() : value];\n });\n\n for (const [key, value] of entries) {\n const k = key as keyof (AITableView | AITableField);\n newProperties[k] = value;\n }\n\n const oldEntries = keyChanges.map(([key]) => [key, (targetElement as any)[key]]);\n for (const [key, value] of oldEntries) {\n const k = key as keyof (AITableView | AITableField);\n properties[k] = value;\n }\n const type = isFieldsTranslate ? ActionName.SetField : ActionName.SetView;\n return [\n {\n type,\n properties: properties,\n newProperties: newProperties,\n path: [targetElement._id]\n }\n ] as AITableAction[];\n }\n }\n return [];\n}\n","import * as Y from 'yjs';\nimport { AITableAction, AIViewTable, SharedType } from '../../types';\nimport { YjsAITable } from '../yjs-table';\nimport translateArrayEvent from './array-event';\nimport translateMapEvent from './map-event';\n\nexport function translateYjsEvent(aiTable: AIViewTable, sharedType: SharedType, event: Y.YEvent<any>): AITableAction[] {\n if (event instanceof Y.YArrayEvent) {\n return translateArrayEvent(aiTable, sharedType, event);\n }\n if (event instanceof Y.YMapEvent) {\n return translateMapEvent(aiTable, sharedType, event);\n }\n return [];\n}\n\nexport function applyEvents(aiTable: AIViewTable, sharedType: SharedType, events: Y.YEvent<any>[]) {\n events.forEach((event) =>\n translateYjsEvent(aiTable, sharedType, event).forEach((item: AITableAction) => {\n aiTable.apply(item);\n })\n );\n}\n\nexport function applyYjsEvents(aiTable: AIViewTable, sharedType: SharedType, events: Y.YEvent<any>[]): void {\n if (YjsAITable.isUndo(aiTable)) {\n applyEvents(aiTable, sharedType, events);\n } else {\n YjsAITable.asRemote(aiTable, () => {\n applyEvents(aiTable, sharedType, events);\n });\n }\n}\n","import { AITable } from '@ai-table/grid';\nimport { SharedType, SyncArrayElement, SyncMapElement, UpdateFieldValueAction } from '../../types';\nimport { getSharedMapValueIndex, getSharedRecordIndex } from '../utils';\nimport * as Y from 'yjs';\n\nexport default function updateFieldValue(aiTable: AITable, sharedType: SharedType, action: UpdateFieldValueAction): SharedType {\n const sharedRecords = sharedType.get('records');\n const sharedFields = sharedType.get('fields')!;\n if (sharedRecords && sharedFields) {\n const recordIndex = getSharedRecordIndex(sharedRecords as Y.Array<SyncArrayElement>, action.path[0]);\n const fieldIndex = getSharedMapValueIndex(sharedFields as Y.Array<SyncMapElement>, action.path[1]);\n if (recordIndex > -1 && fieldIndex > -1) {\n const record = sharedRecords?.get(recordIndex) as SyncArrayElement;\n const customField = record.get(1);\n customField.delete(fieldIndex);\n customField.insert(fieldIndex, [action.newFieldValue]);\n }\n }\n\n return sharedType;\n}\n","import { getSharedMapValueIndex } from '../utils';\nimport { ActionName, SetFieldAction, SetViewAction, SharedType, SyncMapElement } from '../../types';\nimport * as Y from 'yjs';\nimport { AITable } from '@ai-table/grid';\n\nexport default function setNode(aiTable: AITable, sharedType: SharedType, action: SetFieldAction | SetViewAction): SharedType {\n let sharedNodes;\n if (action.type === ActionName.SetField) {\n sharedNodes = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n }\n\n if (action.type === ActionName.SetView) {\n sharedNodes = sharedType.get('views')! as Y.Array<SyncMapElement>;\n }\n\n if (sharedNodes) {\n let nodeIndex = getSharedMapValueIndex(sharedNodes, action.path[0] as string);\n if (nodeIndex > -1) {\n const node = sharedNodes.get(nodeIndex) as SyncMapElement;\n Object.entries(action.newProperties).forEach(([key, value]) => {\n if (value == null) {\n node.delete(key);\n } else {\n node.set(key, value);\n }\n });\n Object.entries(action.properties).forEach(([key]) => {\n if (!action.newProperties.hasOwnProperty(key)) {\n node.delete(key);\n }\n });\n }\n }\n return sharedType;\n}\n","import { AITable } from '@ai-table/grid';\nimport * as Y from 'yjs';\nimport {\n ActionName,\n AddFieldAction,\n AddRecordAction,\n SetRecordPositionAction,\n AddViewAction,\n AITableViewRecord,\n SharedType,\n SyncArrayElement,\n SyncMapElement,\n AITableViewFields,\n UpdateSystemFieldValue\n} from '../../types';\nimport {\n getPositionsByRecordSyncElement,\n getSharedRecordIndex,\n toRecordSyncElement,\n toSyncElement,\n setRecordPositions,\n getIdBySystemFieldValuesType,\n setRecordUpdatedInfo\n} from '../utils';\n\nexport default function addNode(\n aiTable: AITable,\n sharedType: SharedType,\n action: AddFieldAction | AddRecordAction | AddViewAction | SetRecordPositionAction | UpdateSystemFieldValue\n): SharedType {\n const records = sharedType.get('records')! as Y.Array<SyncArrayElement>;\n const views = sharedType.get('views')!;\n const fields = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n switch (action.type) {\n case ActionName.AddRecord:\n records && records.push([toRecordSyncElement(action.record as AITableViewRecord, aiTable.fields() as AITableViewFields)]);\n break;\n case ActionName.AddView:\n views && views.push([toSyncElement(action.view)]);\n break;\n case ActionName.SetRecordPositions:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n const record = records.get(recordIndex);\n const positions = getPositionsByRecordSyncElement(record);\n const newPositions = { ...positions };\n for (const key in action.positions) {\n if (action.positions[key] === null || action.positions[key] === undefined) {\n delete newPositions[key];\n } else {\n newPositions[key] = action.positions[key];\n }\n }\n setRecordPositions(record, newPositions);\n }\n break;\n case ActionName.UpdateSystemFieldValue:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n const record = records.get(recordIndex);\n if (action.updatedInfo.updated_at && action.updatedInfo.updated_by) {\n setRecordUpdatedInfo(record, action.updatedInfo as { updated_at: number; updated_by: string });\n }\n }\n break;\n case ActionName.AddField:\n if (fields && records) {\n const { field, path } = action;\n const [insertIndex] = path;\n const fieldSyncElement = toSyncElement(field);\n fields.insert(insertIndex, [fieldSyncElement]);\n for (let value of records) {\n const customFieldValues = value.get(1);\n const systemFieldValues = value.get(0);\n const recordEntity = aiTable.recordsMap()[getIdBySystemFieldValuesType(systemFieldValues)];\n const newFieldValue = recordEntity.values[action.field._id];\n customFieldValues.insert(insertIndex, [newFieldValue]);\n }\n }\n break;\n }\n\n return sharedType;\n}\n","import * as Y from 'yjs';\nimport {\n ActionName,\n RemoveFieldAction,\n RemoveRecordAction,\n RemoveViewAction,\n SharedType,\n SyncArrayElement,\n SyncMapElement\n} from '../../types';\nimport { getSharedMapValueIndex, getSharedRecordIndex } from '../utils';\nimport { AITable } from '@ai-table/grid';\n\nexport default function removeNode(aiTable: AITable, sharedType: SharedType, action: RemoveFieldAction | RemoveRecordAction | RemoveViewAction): SharedType {\n const fields = sharedType.get('fields') as Y.Array<SyncMapElement>;\n const records = sharedType.get('records') as Y.Array<SyncArrayElement>;\n const views = sharedType.get('views')! as Y.Array<SyncMapElement>;\n\n switch (action.type) {\n case ActionName.RemoveRecord:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n if (recordIndex > -1) {\n records.delete(recordIndex);\n }\n }\n break;\n case ActionName.RemoveView:\n if (views) {\n const viewIndex = getSharedMapValueIndex(views, action.path[0]);\n if (viewIndex > -1) {\n views.delete(viewIndex);\n }\n }\n break;\n case ActionName.RemoveField:\n if (fields && records) {\n const fieldIndex = getSharedMapValueIndex(fields, action.path[0]);\n if (fieldIndex > -1) {\n fields.delete(fieldIndex);\n for (let value of records) {\n value.get(1).delete(fieldIndex);\n }\n }\n }\n break;\n }\n\n return sharedType;\n}\n","import { AITable } from '@ai-table/grid';\nimport updateFieldValue from './update-field-value';\nimport { ActionName, AITableAction, SharedType } from '../../types';\nimport setNode from './set-node';\nimport addNode from './add-node';\nimport removeNode from './remove-node';\n\nexport type ActionMapper<O extends AITableAction = AITableAction> = {\n [K in O['type']]: O extends { type: K } ? ApplyFunc<O> : never;\n};\n\nexport type ApplyFunc<O extends AITableAction = AITableAction> = (aiTable: AITable, sharedType: SharedType, op: O) => SharedType;\n\nexport const actionMappers: Partial<ActionMapper<any>> = {\n [ActionName.AddRecord]: addNode,\n [ActionName.UpdateFieldValue]: updateFieldValue,\n [ActionName.RemoveRecord]: removeNode,\n [ActionName.AddField]: addNode,\n [ActionName.SetField]: setNode,\n [ActionName.RemoveField]: removeNode,\n [ActionName.SetView]: setNode,\n [ActionName.AddView]: addNode,\n [ActionName.RemoveView]: removeNode,\n [ActionName.SetRecordPositions]: addNode,\n [ActionName.UpdateSystemFieldValue]: addNode\n};\n\nexport function applyActionOps(aiTable: AITable, sharedType: SharedType, actions: AITableAction[]): SharedType {\n if (actions.length > 0) {\n sharedType.doc!.transact(() => {\n actions.forEach((action) => {\n const apply = actionMappers[action.type] as ApplyFunc<typeof action>;\n if (apply) {\n return apply(aiTable, sharedType, action);\n }\n return null;\n });\n }, aiTable);\n }\n\n return sharedType;\n}\n","import { Path } from '@ai-table/grid';\nimport { AITableView, AITableViewFields, AITableViewRecords } from '../types';\n\nexport function isPathEqual(path: Path, another: Path): boolean {\n return path.length === another.length && path.every((n, i) => n === another[i]);\n}\n\nexport function sortByViewPosition(data: AITableViewRecords | AITableViewFields, activeView: AITableView) {\n const hasPositions = data.every((item) => item.positions && item.positions);\n if (hasPositions) {\n return [...data].sort((a, b) => a.positions[activeView._id] - b.positions[activeView._id]);\n }\n return data;\n}\n","import { AITable, AITableFieldType, AITableQueries, FieldModelMap } from '@ai-table/grid';\nimport { AITableView, AITableViewRecords } from '../../types';\nimport { sortByViewPosition } from '../common';\n\nexport function getSortRecords(\n aiTable: AITable,\n records: AITableViewRecords,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n if (!activeView?.settings || !activeView.settings.sorts?.length) {\n return records;\n }\n const { is_keep_sort, sorts } = activeView.settings;\n if (is_keep_sort && sorts?.length) {\n return sortRecordsBySortInfo(aiTable, records, activeView, sortKeysMap);\n }\n return sortByViewPosition(records, activeView);\n}\n\nexport function sortRecordsBySortInfo(\n aiTable: AITable,\n records: AITableViewRecords,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n const shallowRows = [...records];\n if (activeView.settings?.sorts?.length) {\n shallowRows.sort((prev, current) => {\n return activeView.settings!.sorts!.reduce((acc, rule) => {\n const field = aiTable.fieldsMap()[rule.sort_by];\n if (!field || acc !== 0) {\n return acc;\n }\n const fieldMethod = FieldModelMap[field.type];\n const sortKey = sortKeysMap?.[field.type];\n\n const cellValue1 = AITableQueries.getFieldValue(aiTable, [prev._id, field._id]);\n const cellValue2 = AITableQueries.getFieldValue(aiTable, [current._id, field._id]);\n const references = aiTable.context!.references();\n const res = fieldMethod.compare(cellValue1, cellValue2, field, references, sortKey);\n return res * rule.direction;\n }, 0);\n });\n return shallowRows;\n }\n return shallowRows;\n}\n","import {\n AITableFieldType,\n AITableFilterCondition,\n AITableRecord,\n FieldValue,\n isSystemField,\n SystemFieldTypes,\n FieldModelMap,\n isEmpty,\n AITableFilterOperation,\n SelectSettings\n} from '@ai-table/grid';\nimport {\n AITableFilterConditions,\n AITableFilterLogical,\n AITableView,\n AITableViewField,\n AITableViewFields,\n AITableViewRecords,\n AIViewTable\n} from '../../types';\n\nexport function getFilteredRecords(aiTable: AIViewTable, records: AITableViewRecords, fields: AITableViewFields, activeView: AITableView) {\n const { conditions, condition_logical } = activeView.settings || {};\n if (!conditions) {\n return records;\n }\n const illegalConditions = conditions.filter((item) => item.operation) || [];\n if (!illegalConditions.length) {\n return records;\n }\n const recordsWillHidden = aiTable.recordsWillHidden();\n return records.filter((record) => {\n if (recordsWillHidden && recordsWillHidden.length && recordsWillHidden.includes(record._id)) {\n return true;\n }\n return checkConditions(fields, record, { conditions: illegalConditions, condition_logical });\n });\n}\n\nfunction checkConditions(fields: AITableViewFields, record: AITableRecord, filterConditions: AITableFilterConditions) {\n if (!record) {\n return false;\n }\n if (!filterConditions?.conditions) {\n return true;\n }\n const { condition_logical, conditions } = filterConditions;\n if (condition_logical === AITableFilterLogical.and) {\n return conditions.every((condition) => doFilterOperations(fields, record, condition));\n }\n if (!condition_logical || condition_logical === AITableFilterLogical.or) {\n return conditions.some((condition) => doFilterOperations(fields, record, condition));\n }\n return false;\n}\n\nfunction doFilterOperations(fields: AITableViewFields, record: AITableRecord, condition: AITableFilterCondition) {\n const { field, cellValue } = getFilterValue(fields, record, condition);\n\n try {\n return field && doFilter(condition, field, cellValue);\n } catch (error) {\n return false;\n }\n}\n\nexport function doFilter(condition: AITableFilterCondition, field: AITableViewField, cellValue: FieldValue) {\n return FieldModelMap[field.type].isMeetFilter(condition, cellValue);\n}\n\nexport function getDefaultRecordDataByFilter(\n recordValues: Record<string, FieldValue>,\n conditions: AITableFilterCondition[],\n fields: AITableViewFields,\n conditionLogical?: AITableFilterLogical\n) {\n const fieldMap = new Map<string, AITableViewField>(fields.map((field) => [field._id, field]));\n const conditionFieldCountMap = new Map<string, number>();\n conditions.forEach((condition) => {\n const fieldId = condition.field_id.toString();\n const tmpFieldCount = conditionFieldCountMap.get(fieldId) || 0;\n conditionFieldCountMap.set(fieldId, tmpFieldCount + 1);\n });\n if (conditionLogical === AITableFilterLogical.and) {\n conditions.forEach((condition) => {\n if (conditionFieldCountMap.get(condition.field_id.toString()) === 1) {\n const field = fieldMap.get(condition.field_id.toString())!;\n const canMultipleOperationCondition =\n (!(field.settings as SelectSettings)?.is_multiple && condition.operation === AITableFilterOperation.eq) ||\n (field?.settings as SelectSettings)?.is_multiple;\n if (\n [AITableFilterOperation.eq, AITableFilterOperation.in].includes(condition.operation) &&\n [AITableFieldType.select, AITableFieldType.member].includes(field?.type) &&\n canMultipleOperationCondition\n ) {\n recordValues[condition.field_id] = condition.value;\n }\n\n if (field?.type === AITableFieldType.date && condition.operation === AITableFilterOperation.eq) {\n recordValues[condition.field_id] = {\n timestamp: condition.value\n };\n }\n\n if (condition.operation === AITableFilterOperation.contain && AITableFieldType.text === field?.type) {\n recordValues[condition.field_id] = condition.value;\n }\n\n if (\n condition.operation === AITableFilterOperation.eq &&\n [AITableFieldType.rate, AITableFieldType.number, AITableFieldType.progress].includes(field?.type)\n ) {\n recordValues[condition.field_id] = condition.value;\n }\n }\n });\n }\n return recordValues;\n}\n\nfunction getFilterValue(fields: AITableViewFields, record: AITableRecord, condition: AITableFilterCondition) {\n const field = fields.find((item) => item._id === condition.field_id);\n let cellValue = null;\n if (field && isSystemField(field)) {\n if ([AITableFieldType.createdAt, AITableFieldType.updatedAt].includes(field.type)) {\n cellValue = { timestamp: record[field.type as SystemFieldTypes] };\n } else {\n cellValue = record[field.type as SystemFieldTypes];\n }\n } else {\n cellValue = record.values[condition.field_id];\n }\n\n if (field && [AITableFieldType.createdBy, AITableFieldType.updatedBy, AITableFieldType.member].includes(field.type)) {\n cellValue = Array.isArray(cellValue) ? cellValue : isEmpty(cellValue) ? [] : [cellValue];\n }\n\n return {\n field,\n cellValue\n };\n}\n","import { AITable } from \"@ai-table/grid\";\nimport { AITableView, AITableViewFields } from \"../../types\";\nimport { sortByViewPosition } from \"../common\";\n\nexport function getSortFields(aiTable: AITable, fields: AITableViewFields, activeView: AITableView) {\n return sortByViewPosition(fields as AITableViewFields, activeView) as AITableViewFields;\n}\n","import { AITableView, AITableViewFields, AITableViewRecords, AIViewTable } from '../types';\nimport { getSortRecords } from './record/sort';\nimport { getFilteredRecords } from './record/filter';\nimport { getSortFields } from './field/sort-fields';\nimport { AITableFieldType } from '@ai-table/grid';\n\nexport function buildRecordsByView(\n aiTable: AIViewTable,\n records: AITableViewRecords,\n fields: AITableViewFields,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n const filteredRecords = getFilteredRecords(aiTable, records, fields, activeView);\n return getSortRecords(aiTable, filteredRecords, activeView, sortKeysMap);\n}\n\nexport function buildFieldsByView(aiTable: AIViewTable, fields: AITableViewFields, activeView: AITableView) {\n return getSortFields(aiTable, fields as AITableViewFields, activeView);\n}\n","import { AITableField, AITableQueries, IdPath, NumberPath } from '@ai-table/grid';\nimport { ActionName, AddFieldAction, RemoveFieldAction, SetFieldAction, AIViewTable } from '../types';\nimport { AITableViewField } from '../types/view';\nimport { isPathEqual, getFieldPositionInView } from '../utils';\n\nexport function addField(aiTable: AIViewTable, field: AITableField, path: NumberPath, originId?: string, isCopy?: boolean) {\n const operation: AddFieldAction = {\n type: ActionName.AddField,\n field,\n path,\n originId,\n isCopy\n };\n aiTable.apply(operation);\n}\n\nexport function moveField(aiTable: AIViewTable, path: NumberPath, newPath: NumberPath) {\n if (isPathEqual(path, newPath)) {\n return;\n }\n const fields = aiTable.gridData().fields;\n const activeView = aiTable.views().find((item) => item._id === aiTable.activeViewId());\n const sourceField = fields[path[0]] as AITableViewField;\n const position = getFieldPositionInView(activeView!._id, fields, path, newPath);\n setField(aiTable, { positions: { ...sourceField.positions, [activeView!._id]: position } }, [sourceField._id]);\n}\n\nexport function removeField(aiTable: AIViewTable, path: IdPath) {\n const operation: RemoveFieldAction = {\n type: ActionName.RemoveField,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function setField<T extends AITableViewField = AITableViewField>(aiTable: AIViewTable, value: Partial<T>, path: IdPath) {\n const field = AITableQueries.getField(aiTable, path) as T;\n if (field) {\n const properties: Partial<T> = {};\n const newProperties: Partial<T> = {};\n for (const key in value) {\n const k = key as keyof T;\n if (JSON.stringify(field[k]) !== JSON.stringify(value[k])) {\n if (field.hasOwnProperty(k)) {\n properties[k] = field[k] as any;\n }\n if (newProperties[k] !== null) {\n newProperties[k] = value[k] as any;\n }\n }\n }\n\n const operation: SetFieldAction = {\n type: ActionName.SetField,\n properties,\n newProperties,\n path\n };\n\n aiTable.apply(operation);\n }\n}\n\nexport const FieldActions = {\n addField,\n moveField,\n removeField,\n setField\n};\n","import {\n ActionName,\n AITableAction,\n AITableView,\n AITableViewField,\n AITableViewFields,\n AITableViewRecord,\n AITableViewRecords,\n AIViewTable\n} from '../types';\nimport { createDraft, finishDraft } from 'immer';\nimport { AITableField, AITableFields, getDefaultFieldValue } from '@ai-table/grid';\nimport { createDefaultPositions, isPathEqual } from '../utils';\n\nconst apply = (aiTable: AIViewTable, records: AITableViewRecords, fields: AITableFields, views: AITableView[], action: AITableAction) => {\n switch (action.type) {\n case ActionName.UpdateFieldValue: {\n const [recordId, fieldId] = action.path;\n if (recordId && fieldId) {\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n records[recordIndex].values[fieldId] = action.newFieldValue;\n }\n break;\n }\n case ActionName.UpdateSystemFieldValue: {\n const [recordId] = action.path;\n if (recordId && action.updatedInfo) {\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n if (action.updatedInfo.updated_at) {\n records[recordIndex].updated_at = action.updatedInfo.updated_at;\n }\n if (action.updatedInfo.updated_by) {\n records[recordIndex].updated_by = action.updatedInfo.updated_by;\n }\n }\n break;\n }\n case ActionName.AddRecord: {\n const [recordIndex] = action.path;\n if (recordIndex > -1) {\n if (!(action.record as AITableViewRecord).positions) {\n const activeView = aiTable.views().find((item) => item._id === aiTable.activeViewId());\n let index = recordIndex;\n if (activeView?.settings?.conditions) {\n index = records.length;\n }\n (action.record as AITableViewRecord).positions = createDefaultPositions(\n aiTable.views(),\n aiTable.activeViewId(),\n aiTable.records() as AITableViewRecords,\n index\n );\n }\n records.splice(recordIndex, 0, action.record as AITableViewRecord);\n }\n break;\n }\n case ActionName.AddField: {\n const [fieldIndex] = action.path;\n if (fieldIndex > -1) {\n const newField = action.field;\n (newField as AITableViewField).positions = createDefaultPositions(\n aiTable.views(),\n aiTable.activeViewId(),\n aiTable.fields() as AITableViewFields,\n action.path[0]\n );\n fields.splice(fieldIndex, 0, newField as AITableViewField);\n records.forEach((item) => {\n item.values[newField._id] =\n action.isCopy && action.originId ? item.values[action.originId] : getDefaultFieldValue(action.field);\n });\n }\n break;\n }\n case ActionName.MoveRecord: {\n if (isPathEqual(action.path, action.newPath)) {\n return;\n }\n const record = records[action.path[0]];\n records.splice(action.path[0], 1);\n records.splice(action.newPath[0], 0, record);\n break;\n }\n case ActionName.RemoveField: {\n const [fieldId] = action.path;\n const fieldIndex = aiTable.fields().findIndex((item) => item._id === fieldId);\n if (fieldIndex > -1) {\n fields.splice(fieldIndex, 1);\n records.forEach((item) => {\n delete item.values[fieldId];\n });\n }\n break;\n }\n case ActionName.RemoveRecord: {\n const [recordId] = action.path;\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n if (recordIndex > -1) {\n records.splice(recordIndex, 1);\n }\n break;\n }\n\n case ActionName.SetField: {\n const field = fields.find((item) => item._id === action.path[0]) as AITableField;\n if (field) {\n for (const key in action.newProperties) {\n const k = key as keyof AITableField;\n const value = action.newProperties[k];\n if (value == null) {\n delete field[k];\n } else {\n (field[k] as any) = value;\n }\n }\n\n // properties that were previously defined, but are now missing, must be deleted\n for (const key in action.properties) {\n if (!action.newProperties.hasOwnProperty(key)) {\n delete field[<keyof AITableField>key];\n }\n }\n }\n break;\n }\n case ActionName.SetView: {\n const view = views.find((item) => item._id === action.path[0]) as AITableView;\n if (view) {\n for (const key in action.newProperties) {\n const k = key as keyof AITableView;\n const value = action.newProperties[k];\n if (value == null) {\n delete view[k];\n } else {\n (view[k] as any) = value;\n }\n }\n\n // properties that were previously defined, but are now missing, must be deleted\n for (const key in action.properties) {\n if (!action.newProperties.hasOwnProperty(key)) {\n delete view[<keyof AITableView>key];\n }\n }\n }\n break;\n }\n case ActionName.AddView: {\n const [viewIndex] = action.path;\n if (viewIndex > -1) {\n views.splice(viewIndex, 0, action.view);\n }\n break;\n }\n case ActionName.RemoveView: {\n const [viewId] = action.path;\n const viewIndex = views.findIndex((item) => item._id === viewId);\n if (viewIndex > -1) {\n views.splice(viewIndex, 1);\n }\n break;\n }\n case ActionName.SetRecordPositions: {\n const { positions, path } = action;\n const record = records.find((item) => item._id === path[0]);\n if (record) {\n const newPositions = { ...record.positions };\n for (const key in positions) {\n if (positions[key] === null || positions[key] === undefined) {\n delete newPositions[key];\n } else {\n newPositions[key] = positions[key] as number;\n }\n }\n record.positions = newPositions;\n }\n break;\n }\n }\n return {\n records,\n fields,\n views\n };\n};\n\nexport const GeneralActions = {\n transform(aiTable: AIViewTable, action: AITableAction): void {\n const records = createDraft(aiTable.records()) as AITableViewRecords;\n const fields = createDraft(aiTable.gridData().fields) as AITableViewFields;\n const views = createDraft(aiTable.views());\n apply(aiTable, records, fields, views, action);\n aiTable.fields.set(finishDraft(fields));\n aiTable.records.set(finishDraft(records));\n aiTable.views.set(finishDraft(views));\n }\n};\n","import { ActionName, SetRecordPositionAction, AIViewTable, Positions, RemovePositions } from '../types';\nimport { IdPath } from '@ai-table/grid';\n\nexport function setRecordPositions(aiTable: AIViewTable, positions: Positions | RemovePositions, path: IdPath) {\n const operation: SetRecordPositionAction = {\n type: ActionName.SetRecordPositions,\n positions,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const PositionsActions = {\n setRecordPositions\n};\n","import { AIRecordFieldIdPath, AITableQueries, AITableRecord, AITableRecordUpdatedInfo, IdPath, NumberPath } from '@ai-table/grid';\nimport {\n UpdateFieldValueAction,\n ActionName,\n AddRecordAction,\n MoveRecordAction,\n RemoveRecordAction,\n AIViewTable,\n UpdateSystemFieldValue\n} from '../types';\n\nexport function updateFieldValue(aiTable: AIViewTable, value: any, path: AIRecordFieldIdPath) {\n const oldValue = AITableQueries.getFieldValue(aiTable, path);\n const operation: UpdateFieldValueAction = {\n type: ActionName.UpdateFieldValue,\n fieldValue: oldValue,\n newFieldValue: value,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function updateSystemFieldValue(aiTable: AIViewTable, path: IdPath, updatedInfo: AITableRecordUpdatedInfo) {\n const operation: UpdateSystemFieldValue = {\n type: ActionName.UpdateSystemFieldValue,\n updatedInfo,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function addRecord(aiTable: AIViewTable, record: AITableRecord, path: NumberPath) {\n const operation: AddRecordAction = {\n type: ActionName.AddRecord,\n record,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function moveRecord(aiTable: AIViewTable, path: NumberPath, newPath: NumberPath) {\n const operation: MoveRecordAction = {\n type: ActionName.MoveRecord,\n path,\n newPath\n };\n aiTable.apply(operation);\n}\n\nexport function removeRecord(aiTable: AIViewTable, path: IdPath) {\n const operation: RemoveRecordAction = {\n type: ActionName.RemoveRecord,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const RecordActions = {\n addRecord,\n updateFieldValue,\n moveRecord,\n removeRecord,\n updateSystemFieldValue\n};\n","import { ActionName, AddViewAction, AITableView, AIViewTable, RemoveViewAction, SetViewAction } from \"../types\";\n\nfunction setView(aiTable: AIViewTable, value: Partial<AITableView>, path: [string]) {\n const view = aiTable.views().find((item) => item._id === path[0]);\n if (view) {\n const properties: Partial<AITableView> = {};\n const newProperties: Partial<AITableView> = {};\n for (const key in value) {\n const k = key as keyof AITableView;\n if (JSON.stringify(view[k]) !== JSON.stringify(value[k])) {\n if (view.hasOwnProperty(k)) {\n properties[k] = view[k] as any;\n }\n if (newProperties[k] !== null) {\n newProperties[k] = value[k] as any;\n }\n }\n }\n\n const operation: SetViewAction = {\n type: ActionName.SetView,\n properties,\n newProperties,\n path\n };\n aiTable.apply(operation);\n }\n}\n\nfunction addView(aiTable: AIViewTable, view: AITableView, path: [number]) {\n const operation: AddViewAction = {\n type: ActionName.AddView,\n view,\n path\n };\n aiTable.apply(operation);\n}\n\nfunction removeView(aiTable: AIViewTable, path: [string]) {\n const operation: RemoveViewAction = {\n type: ActionName.RemoveView,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const ViewActions = {\n setView,\n addView,\n removeView\n};","import { FieldActions } from './field';\nimport { GeneralActions } from './general';\nimport { PositionsActions } from './position';\nimport { RecordActions } from './record';\nimport { ViewActions } from './view';\n\nexport const Actions = {\n ...GeneralActions,\n ...RecordActions,\n ...FieldActions,\n ...ViewActions,\n ...PositionsActions\n};\n","import { AITableRecordUpdatedInfo } from '@ai-table/grid';\nimport { AIViewTable } from '../../types';\nimport { Actions } from '../../action';\n\nexport function updateRecordsUpdatedInfo(aiTable: AIViewTable, updatedInfo: AITableRecordUpdatedInfo) {\n const records = aiTable.records();\n records.forEach((item) => {\n Actions.updateSystemFieldValue(aiTable, [item._id], updatedInfo);\n });\n}\n","import { AddFieldOptions, AITableField, AITableRecordUpdatedInfo, Direction, idsCreator } from '@ai-table/grid';\nimport { getSortFields } from './sort-fields';\nimport { AITableViewFields, AIViewTable } from '../../types';\nimport { Actions } from '../../action';\nimport { updateRecordsUpdatedInfo } from '../record/update-system-field-value';\n\nexport function addFields(aiTable: AIViewTable, options: AddFieldOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const { originId, direction = Direction.after, defaultValue, isDuplicate, count = 1 } = options;\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const fields = getSortFields(aiTable, aiTable.fields() as AITableViewFields, activeView);\n let addIndex = fields.findIndex((item) => item._id === originId);\n if (direction === Direction.after) {\n addIndex++;\n }\n const newFieldIds = idsCreator(count);\n newFieldIds.forEach((id, index) => {\n const newField = { _id: id, ...defaultValue } as AITableField;\n Actions.addField(aiTable, newField, [addIndex + index], options.originId, options.isCopy);\n });\n updateRecordsUpdatedInfo(aiTable, updatedInfo);\n}\n","import { AITable, AITableField, AITableRecordUpdatedInfo } from '@ai-table/grid';\nimport { Signal } from '@angular/core';\nimport { Actions } from '../../action';\nimport { AIViewTable } from '../../types';\nimport { updateRecordsUpdatedInfo } from '../record/update-system-field-value';\n\nexport const buildRemoveFieldItem = (getUpdatedInfo: () => AITableRecordUpdatedInfo) => {\n return {\n type: 'removeField',\n name: '删除列',\n icon: 'trash',\n exec: (aiTable: AITable, field: Signal<AITableField>) => {\n Actions.removeField(aiTable as AIViewTable, [field()._id]);\n updateRecordsUpdatedInfo(aiTable as AIViewTable, getUpdatedInfo());\n }\n };\n};\n","import { idCreator, shortIdCreator } from '@ai-table/grid';\nimport { AITableView, AITableViewField, AITableViewFields, AITableViewRecords, AIViewTable, Positions } from '../types';\nimport { Actions } from '../action';\nimport { ViewActions } from '../action/view';\nimport { PositionsActions } from '../action/position';\n\nexport function createDefaultPositions(\n views: AITableView[],\n activeId: string,\n data: AITableViewRecords | AITableViewFields,\n index: number\n) {\n const positions: Positions = {};\n const position = getPosition(data, activeId, index);\n const maxPosition = data.length ? data[data.length - 1].positions[activeId] : -1;\n views.forEach((element) => {\n positions[element._id] = element._id === activeId ? position : maxPosition + 1;\n });\n return positions;\n}\n\nexport function getPosition(data: AITableViewRecords | AITableViewFields, activeViewId: string, index: number) {\n let position = data.length - 1;\n if (index !== 0 && index !== data.length) {\n const previousViewPosition = data[index - 1].positions[activeViewId];\n const nextViewPosition = data[index].positions[activeViewId!];\n position = (previousViewPosition + nextViewPosition) / 2;\n } else {\n position = index;\n }\n return position;\n}\n\nexport function addView(aiTable: AIViewTable, type: 'add' | 'copy', viewId?: string) {\n let index = aiTable.views().length;\n const newId = idCreator();\n const shortId = shortIdCreator();\n let newView: AITableView = {\n _id: newId,\n short_id: shortId,\n name: '表格视图 ' + index\n };\n let originViewId = aiTable.views()[aiTable.views().length - 1]._id;\n if (type === 'copy') {\n originViewId = viewId ?? aiTable.activeViewId();\n const copyView = aiTable.views().find((item) => item._id === originViewId)!;\n newView = {\n ...copyView,\n _id: newId,\n name: copyView.name + '-副本'\n };\n index = aiTable.views().indexOf(copyView) + 1;\n }\n ViewActions.addView(aiTable, newView, [index]);\n (aiTable.records() as AITableViewRecords).forEach((record) => {\n PositionsActions.setRecordPositions(aiTable, { [newId]: record.positions[originViewId] }, [record._id]);\n });\n (aiTable.fields() as AITableViewFields).forEach((field) => {\n Actions.setField<AITableViewField>(\n aiTable,\n {\n positions: {\n ...field.positions,\n [newId]: field.positions[originViewId]\n }\n },\n [field._id]\n );\n });\n return newView;\n}\n\nexport function removeView(aiTable: AIViewTable, records: AITableViewRecords, fields: AITableViewFields, activeViewId: string) {\n records.forEach((record) => {\n PositionsActions.setRecordPositions(aiTable, { [activeViewId]: undefined }, [record._id]);\n });\n fields.forEach((field) => {\n const positions = { ...field.positions };\n delete positions[activeViewId];\n Actions.setField<AITableViewField>(\n aiTable,\n {\n positions\n },\n [field._id]\n );\n });\n ViewActions.removeView(aiTable, [activeViewId]);\n}\n","import {\n AddRecordOptions,\n AITableRecord,\n Direction,\n FieldValue,\n getDefaultFieldValue,\n idsCreator,\n shortIdsCreator,\n TrackableEntity\n} from '@ai-table/grid';\nimport { AITableViewFields, AITableViewRecords, AIViewTable } from '../../types';\nimport { getSortRecords } from './sort';\nimport { getSortFields } from '../field/sort-fields';\nimport { Actions } from '../../action';\nimport { getDefaultRecordDataByFilter } from './filter';\n\nexport function addRecords(aiTable: AIViewTable, options: AddRecordOptions, trackableEntity: TrackableEntity) {\n const { originId, direction = Direction.after, isDuplicate, count = 1 } = options;\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const records = getSortRecords(aiTable, aiTable.records() as AITableViewRecords, activeView);\n let addIndex = records.findIndex((item) => item._id === originId);\n if (direction === Direction.after) {\n addIndex++;\n }\n const newRecordIds = idsCreator(count);\n const newRecordShortIds = shortIdsCreator(count);\n const newRecordValues = getDefaultRecordValues(aiTable, isDuplicate, originId);\n // TODO: 判断如果存在筛选条件,且 newRecordValues 中没有一项满足筛选条件\n // 把 id 添加到 RECORDS_WILL_HIDDEN 中\n if (activeView.settings?.conditions?.length) {\n aiTable.recordsWillHidden?.update((value) => {\n value.push(...newRecordIds);\n return [...value];\n });\n }\n newRecordIds.forEach((id, index) => {\n const newRecord: AITableRecord = { _id: id, short_id: newRecordShortIds[index], values: newRecordValues, ...trackableEntity };\n Actions.addRecord(aiTable, newRecord, [addIndex + index]);\n });\n}\n\nexport function getDefaultRecordValues(aiTable: AIViewTable, isDuplicate = false, recordId?: string) {\n let newRecordValues: Record<string, FieldValue> = {};\n if (isDuplicate && recordId) {\n newRecordValues = aiTable.recordsMap()[recordId].values;\n } else {\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const fields = getSortFields(aiTable, aiTable.fields() as AITableViewFields, activeView);\n fields.map((item) => {\n newRecordValues[item._id] = getDefaultFieldValue(item);\n });\n const { conditions, condition_logical } = activeView.settings || {};\n if (conditions && conditions.length) {\n newRecordValues = getDefaultRecordDataByFilter(newRecordValues, conditions, fields, condition_logical);\n }\n }\n return newRecordValues;\n}\n","import { AITableQueries, AITableRecordUpdatedInfo, UpdateFieldValueOptions } from '@ai-table/grid';\nimport * as _ from 'lodash';\nimport { Actions } from '../../action';\nimport { AIViewTable } from '../../types';\n\nexport function updateFieldValue(aiTable: AIViewTable, options: UpdateFieldValueOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const oldValue = AITableQueries.getFieldValue(aiTable, options.path);\n if (!_.isEqual(oldValue, options.value)) {\n Actions.updateFieldValue(aiTable, options.value, options.path);\n Actions.updateSystemFieldValue(aiTable, [options.path[0]], updatedInfo);\n }\n}\n","import { AIViewTable } from '../types';\n\nexport const FLUSHING = new WeakMap<AIViewTable, boolean>();\n","import { AITableField, AITableFields, AITableRecordUpdatedInfo, MoveFieldOptions, NumberPath } from '@ai-table/grid';\nimport { AITableViewField, AIViewTable } from '../../types';\nimport { Actions } from '../../action';\n\nexport function moveFields(aiTable: AIViewTable, options: MoveFieldOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const { path, newPath } = options;\n Actions.moveField(aiTable, path, newPath);\n}\n\nexport function getFieldPositionInView(viewId: string, fields: AITableFields, path: NumberPath, newPath: NumberPath) {\n const targetPosition = (fields[newPath[0]] as AITableViewField).positions[viewId];\n let newPosition = 0;\n if (path[0] > newPath[0]) {\n const prevPath = newPath[0] - 1;\n if (prevPath > 0) {\n const targetPrevField = fields[prevPath];\n const targetPrevPosition = (targetPrevField as AITableViewField).positions[viewId];\n newPosition = (targetPosition + targetPrevPosition) / 2;\n } else {\n const firstField = fields[0];\n newPosition = (firstField as AITableViewField).positions[viewId] - 0.1;\n }\n } else {\n const nextPath = newPath[0] + 1;\n if (fields.length > nextPath) {\n const targetNextField = fields[nextPath];\n const targetNextPosition = (targetNextField as AITableViewField).positions[viewId];\n newPosition = (targetPosition + targetNextPosition) / 2;\n } else {\n const lastField = fields[fields.length - 1];\n newPosition = (lastField as AITableViewField).positions[viewId] + 1;\n }\n }\n return newPosition;\n}\n","import { AITable } from '@ai-table/grid';\nimport { AITableAction, AIViewTable } from '../types';\nimport { Actions } from '../action';\nimport { FLUSHING } from '../utils';\n\nexport const withState = (aiTable: AITable) => {\n const viewTable = aiTable as AIViewTable;\n viewTable.actions = [];\n\n viewTable.apply = (action: AITableAction) => {\n viewTable.actions.push(action);\n Actions.transform(viewTable, action as AITableAction);\n\n if (!FLUSHING.get(viewTable)) {\n FLUSHING.set(viewTable, true);\n Promise.resolve().then(() => {\n FLUSHING.set(viewTable, false);\n viewTable.onChange();\n viewTable.actions = [];\n });\n }\n };\n return aiTable;\n};\n","import { AddFieldOptions, AI_TABLE_GRID_FIELD_SERVICE_MAP, AITableField, AITableFieldSetting, idCreator } from '@ai-table/grid';\nimport { ElementRef, Signal } from '@angular/core';\nimport _ from 'lodash';\nimport { Actions } from '../action';\nimport { AIViewTable } from '../types';\n\nexport const DividerMenuItem = {\n type: 'divider'\n};\n\nexport const EditFieldPropertyItem = {\n type: 'editFieldProperty',\n name: '编辑列',\n icon: 'edit',\n exec: (\n aiTable: AIViewTable,\n field: Signal<AITableField>,\n origin?: HTMLElement | ElementRef<any>,\n position?: { x: number; y: number }\n ) => {\n const fieldService = AI_TABLE_GRID_FIELD_SERVICE_MAP.get(aiTable);\n const copyField: AITableField = _.cloneDeep(field());\n if (origin && position) {\n const popoverRef = fieldService?.editFieldProperty(aiTable, {\n field: copyField,\n isUpdate: true,\n origin: origin!,\n position\n });\n if (popoverRef && fieldService && !fieldService.aiFieldConfig?.fieldSettingComponent) {\n (popoverRef.componentInstance as AITableFieldSetting).setField.subscribe((value) => {\n Actions.setField(aiTable, value.field, value.path);\n });\n }\n return popoverRef;\n }\n return undefined;\n }\n};\n\nexport const CopyFieldPropertyItem = (addFieldFn: (data: AddFieldOptions) => void) => {\n return {\n type: 'copyFieldProperty',\n name: '复制列',\n icon: 'copy',\n exec: (aiTable: AIViewTable, field: Signal<AITableField>) => {\n const allFieldNames = (aiTable.fields() || []).map((item) => item.name);\n let newFieldName = `${field().name} 副本`;\n let index = 2;\n while (allFieldNames.includes(newFieldName)) {\n newFieldName = `${field().name} 副本 ${index}`;\n index++;\n }\n\n const fieldOptions: AddFieldOptions = {\n originId: field()._id,\n isCopy: true,\n defaultValue: {\n ...field(),\n _id: idCreator(),\n name: newFieldName\n }\n };\n addFieldFn(fieldOptions);\n }\n };\n};\n","import { AITable, AITableContextMenuItem, AITableGridSelectionService, AITablePasteActions, isMac, writeToAITable } from '@ai-table/grid';\nimport { Actions } from '../action';\nimport { AIViewTable } from '../types';\nimport { buildClipboardData, writeToClipboard } from '@ai-table/grid';\nimport { ThyNotifyService } from 'ngx-tethys/notify';\n\nexport const RemoveRecordsItem: AITableContextMenuItem = {\n type: 'removeRecords',\n name: '删除行',\n icon: 'trash',\n exec: (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService\n ) => {\n let selectedRecordIds = AITable.getActiveRecordIds(aiTable);\n\n selectedRecordIds.forEach((id: string) => {\n Actions.removeRecord(aiTable as AIViewTable, [id]);\n });\n\n aiTableGridSelectionService.clearSelection();\n }\n};\n\nexport const CopyCellsItem: AITableContextMenuItem = {\n type: 'copyCells',\n name: '复制',\n shortcutKey: isMac() ? `⌘ + C` : `Ctrl + C`,\n icon: 'copy',\n exec: (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService,\n notifyService: ThyNotifyService\n ) => {\n const clipboardData = buildClipboardData(aiTable);\n if (clipboardData) {\n writeToClipboard(clipboardData).then(() => {\n const copiedCellsCount = aiTable.selection().selectedCells.size;\n notifyService.success(`已复制 ${copiedCellsCount} 个单元格`, undefined, {\n placement: 'bottomLeft'\n });\n });\n }\n }\n};\n\nexport const PasteCellsItem: (actions: AITablePasteActions) => AITableContextMenuItem = (actions: AITablePasteActions) => {\n return {\n type: 'pasteCells',\n name: '粘贴',\n shortcutKey: isMac() ? `⌘ + V` : `Ctrl + V`,\n icon: 'paste',\n exec: async (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService,\n notifyService: ThyNotifyService\n ) => {\n writeToAITable(aiTable, actions).then((isPasteSuccess) => {\n if (!isPasteSuccess) {\n notifyService.error('粘贴内容不符合当前类型', undefined, {\n placement: 'bottomLeft'\n });\n }\n });\n }\n };\n};\n","import { ActionName } from \"../types\";\n\nexport const VIEW_ACTIONS = [ActionName.SetView, ActionName.AddView, ActionName.RemoveView];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["setRecordPositions","updateFieldValue","addView","removeView","Direction","_"],"mappings":";;;;;;;AAEA,MAAM,QAAQ,GAAiB,IAAI,OAAO,EAAE;AAC5C,MAAM,SAAS,GAAiB,IAAI,OAAO,EAAE;AAC7C,MAAM,OAAO,GAAiB,IAAI,OAAO,EAAE;AAO9B,MAAA,UAAU,GAAG;AACtB,IAAA,OAAO,EAAE,CAAC,OAAgB,KAAa;AACnC,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;KAC/B;AAED,IAAA,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAc,KAAU;QAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;AAC5C,QAAA,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAErB,QAAA,EAAE,EAAE;QAEJ,IAAI,CAAC,QAAQ,EAAE;AACX,YAAA,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;;KAE/B;AAED,IAAA,QAAQ,EAAE,CAAC,OAAgB,KAAa;AACpC,QAAA,OAAO,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;KAChC;AAED,IAAA,QAAQ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tC,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI;gBAC/D,aAAa,CAAC,OAAO,CAAC,CAAA,IAAA,EAAO,gBAAgB,CAAO,KAAA,CAAA,EAAE,SAAS,EAAE;AAC7D,oBAAA,SAAS,EAAE;AACd,iBAAA,CAAC;AACN,aAAC,CAAC;;;;AAKD,MAAA,cAAc,GAA6D,CAAC,OAA4B,KAAI;IACrH,OAAO;AACH,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,KAAK,EAAE,GAAG,CAAO,KAAA,CAAA,GAAG,CAAU,QAAA,CAAA;AAC3C,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,IAAI,EAAE,OACF,OAAgB,EAChB,UAAkB,EAClB,QAAkC,EAClC,2BAAwD,EACxD,aAA+B,KAC/B;YACA,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,KAAI;gBACrD,IAAI,CAAC,cAAc,EAAE;AACjB,oBAAA,aAAa,CAAC,KAAK,CAAC,aAAa,EAAE,SAAS,EAAE;AAC1C,wBAAA,SAAS,EAAE;AACd,qBAAA,CAAC;;AAEV,aAAC,CAAC;;KAET;AACL;;ACtEa,MAAA,YAAY,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU;;ACF1F;;AAEG;;;;"}
1
+ {"version":3,"file":"ai-table-state.mjs","sources":["../../../packages/state/src/shared/yjs-table.ts","../../../packages/state/src/types/view.ts","../../../packages/state/src/types/action.ts","../../../packages/state/src/shared/utils/translate.ts","../../../packages/state/src/constants/default.ts","../../../packages/state/src/shared/utils/initialize.ts","../../../packages/state/src/shared/to-table/array-event.ts","../../../packages/state/src/shared/to-table/map-event.ts","../../../packages/state/src/shared/to-table/index.ts","../../../packages/state/src/shared/to-yjs/update-field-value.ts","../../../packages/state/src/shared/to-yjs/set-node.ts","../../../packages/state/src/shared/to-yjs/add-node.ts","../../../packages/state/src/shared/to-yjs/remove-node.ts","../../../packages/state/src/shared/to-yjs/index.ts","../../../packages/state/src/utils/common.ts","../../../packages/state/src/utils/record/sort.ts","../../../packages/state/src/utils/record/filter.ts","../../../packages/state/src/utils/field/sort-fields.ts","../../../packages/state/src/utils/build.ts","../../../packages/state/src/action/field.ts","../../../packages/state/src/action/general.ts","../../../packages/state/src/action/position.ts","../../../packages/state/src/action/record.ts","../../../packages/state/src/action/view.ts","../../../packages/state/src/action/index.ts","../../../packages/state/src/utils/record/update-system-field-value.ts","../../../packages/state/src/utils/field/add-fields.ts","../../../packages/state/src/utils/field/remove-field.ts","../../../packages/state/src/utils/view.ts","../../../packages/state/src/utils/record/add-records.ts","../../../packages/state/src/utils/record/update-field-value.ts","../../../packages/state/src/utils/weak-map.ts","../../../packages/state/src/utils/field/move-fields.ts","../../../packages/state/src/plugins/state.plugin.ts","../../../packages/state/src/constants/field-menu-item.ts","../../../packages/state/src/constants/context-menu-item.ts","../../../packages/state/src/constants/view.ts","../../../packages/state/src/ai-table-state.ts"],"sourcesContent":["import { AITable } from \"@ai-table/grid\";\n\nconst IS_LOCAL: WeakSet<any> = new WeakSet();\nconst IS_REMOTE: WeakSet<any> = new WeakSet();\nconst IS_UNDO: WeakSet<any> = new WeakSet();\n\nexport interface YjsAITable {\n isLocal: () => boolean;\n asLocal: () => void;\n}\n\nexport const YjsAITable = {\n isLocal: (aiTable: AITable): boolean => {\n return IS_LOCAL.has(aiTable);\n },\n\n asLocal: (aiTable: AITable, fn: () => void): void => {\n const wasLocal = YjsAITable.isLocal(aiTable);\n IS_LOCAL.add(aiTable);\n\n fn();\n\n if (!wasLocal) {\n IS_LOCAL.delete(aiTable);\n }\n },\n\n isRemote: (aiTable: AITable): boolean => {\n return IS_REMOTE.has(aiTable);\n },\n\n asRemote: (aiTable: AITable, fn: () => void): void => {\n const wasRemote = YjsAITable.isRemote(aiTable);\n IS_REMOTE.add(aiTable);\n\n fn();\n\n if (!wasRemote) {\n Promise.resolve().then(() => IS_REMOTE.delete(aiTable));\n }\n },\n\n isUndo: (aiTable: AITable): boolean => {\n return IS_UNDO.has(aiTable);\n },\n\n asUndo: (aiTable: AITable, fn: () => void): void => {\n const wasUndo = YjsAITable.isUndo(aiTable);\n IS_UNDO.add(aiTable);\n\n fn();\n\n if (!wasUndo) {\n Promise.resolve().then(() => IS_UNDO.delete(aiTable));\n }\n }\n};\n","import { AITableField, AITableFilterCondition, AITableRecord } from '@ai-table/grid';\nimport { Id } from 'ngx-tethys/types';\n\nexport class Positions {\n [view_id: string]: number;\n}\n\nexport class RemovePositions {\n [view_id: string]: undefined;\n}\n\nexport interface AITableViewRecord extends AITableRecord {\n positions: Positions;\n}\n\nexport interface AITableViewField extends AITableField {\n positions: Positions;\n}\n\nexport type AITableViewRecords = AITableViewRecord[];\n\nexport type AITableViewFields = AITableViewField[];\n\nexport enum Direction {\n default = 0,\n ascending = 1,\n descending = -1\n}\n\nexport enum AITableFilterLogical {\n and = 'and',\n or = 'or'\n}\n\nexport type ViewSettings = AITableSearchOptions & AITableFilterConditions & AITableSortOptions;\n\nexport interface AITableView {\n _id: string;\n short_id: string;\n name: string;\n emoji_icon?: string;\n settings?: ViewSettings;\n}\n\nexport interface AITableFilterConditions<TValue = unknown> {\n condition_logical?: AITableFilterLogical;\n conditions?: AITableFilterCondition<TValue>[];\n}\n\nexport interface AITableSortOptions {\n is_keep_sort?: boolean;\n sorts?: {\n sort_by: Id;\n direction: Direction;\n }[];\n}\n\nexport interface AITableSearchOptions {\n keywords?: string;\n}\n\nexport type AITableViews = AITableView[];\n","import { AIRecordFieldIdPath, AITableField, AITableRecord, AITableRecordUpdatedInfo, IdPath, NumberPath } from '@ai-table/grid';\nimport { AITableView, AITableViewRecord, Positions, RemovePositions } from './view';\n\nexport enum ActionName {\n UpdateFieldValue = 'update_field_value',\n AddRecord = 'add_record',\n AddField = 'add_field',\n MoveField = 'move_field',\n MoveRecord = 'move_record',\n RemoveField = 'remove_field',\n RemoveRecord = 'remove_record',\n SetField = 'set_field',\n SetView = 'set_view',\n AddView = 'add_view',\n RemoveView = 'remove_view',\n SetRecordPositions = 'set_record_positions',\n UpdateSystemFieldValue = 'update_system_field_value'\n}\n\nexport enum ExecuteType {\n Execute,\n Undo,\n Redo\n}\n\nexport type UpdateFieldValueAction = {\n type: ActionName.UpdateFieldValue;\n path: AIRecordFieldIdPath;\n fieldValue: any;\n newFieldValue: any;\n};\n\nexport type AddRecordAction = {\n type: ActionName.AddRecord;\n path: NumberPath;\n record: AITableRecord | AITableViewRecord;\n};\n\nexport type AddFieldAction = {\n type: ActionName.AddField;\n path: NumberPath;\n field: AITableField;\n originId?: string;\n isCopy?: boolean;\n};\n\nexport type MoveRecordAction = {\n type: ActionName.MoveRecord;\n path: NumberPath;\n newPath: NumberPath;\n};\n\nexport type RemoveFieldAction = {\n type: ActionName.RemoveField;\n path: IdPath;\n};\n\nexport type RemoveRecordAction = {\n type: ActionName.RemoveRecord;\n path: IdPath;\n};\n\nexport type SetFieldAction = {\n type: ActionName.SetField;\n path: IdPath;\n properties: Partial<AITableField>;\n newProperties: Partial<AITableField>;\n};\n\nexport interface SetViewAction {\n type: ActionName.SetView;\n properties: Partial<AITableView>;\n newProperties: Partial<AITableView>;\n path: IdPath;\n}\n\nexport interface AddViewAction {\n type: ActionName.AddView;\n view: AITableView;\n path: [number];\n}\n\nexport interface RemoveViewAction {\n type: ActionName.RemoveView;\n path: IdPath;\n}\n\nexport interface SetRecordPositionAction {\n type: ActionName.SetRecordPositions;\n positions: Positions | RemovePositions;\n path: IdPath;\n}\n\nexport interface UpdateSystemFieldValue {\n type: ActionName.UpdateSystemFieldValue;\n updatedInfo: Partial<AITableRecordUpdatedInfo>;\n path: IdPath;\n}\n\nexport type AITableViewAction = SetViewAction | AddViewAction | RemoveViewAction;\n\nexport type AITableSystemFieldAction = SetRecordPositionAction | UpdateSystemFieldValue;\n\nexport type AITableAction =\n | UpdateFieldValueAction\n | AddRecordAction\n | AddFieldAction\n | RemoveRecordAction\n | RemoveFieldAction\n | SetFieldAction\n | MoveRecordAction\n | AITableViewAction\n | AITableSystemFieldAction;\n","import { AITableRecordUpdatedInfo, FieldValue, isSystemField, TrackableEntity } from '@ai-table/grid';\nimport {\n AITableViewField,\n AITableViewFields,\n AITableViewRecord,\n AITableViewRecords,\n CustomFieldValues,\n Positions,\n RecordSyncElement,\n SyncArrayElement,\n SyncMapElement,\n SystemFieldValues\n} from '../../types';\nimport * as Y from 'yjs';\n\nexport enum SystemFieldIndex {\n Id = 0,\n ShortId = 1,\n CreatedAt = 2,\n CreatedBy = 3,\n Positions = 4,\n UpdatedAt = 5,\n UpdatedBy = 6\n}\n\nexport function toSyncElement(node: any): SyncMapElement {\n const element: SyncMapElement = new Y.Map();\n for (const key in node) {\n element.set(key, node[key]);\n }\n return element;\n}\n\nexport function toRecordSyncElement(record: AITableViewRecord, fields: AITableViewFields): Y.Array<Y.Array<any>> {\n const systemFieldValues = new Y.Array();\n // 临时方案:为了解决删除时协同操作无法精准获取删除的 id 的问题,将原来的[idValue] 改为[{'_id': idValue}]\n systemFieldValues.insert(0, getSystemFieldValues(record));\n const customFieldValues = new Y.Array();\n const valuesArray: FieldValue[] = [];\n fields.forEach((field: AITableViewField) => {\n let value = record['values'][field._id];\n // yjs will throw an error if the value is undefined.\n if (value === undefined) {\n value = null;\n }\n valuesArray.push(value);\n });\n customFieldValues.insert(0, valuesArray);\n // To save memory, convert map to array.\n const element: RecordSyncElement = new Y.Array<Y.Array<any>>();\n element.insert(0, [systemFieldValues, customFieldValues]);\n return element;\n}\n\nexport function translatePositionToPath(data: AITableViewRecords | AITableViewFields, position: number, activeViewId: string) {\n let index = data.findIndex((value, index) => {\n if (index === 0) {\n return position < value.positions[activeViewId];\n }\n return position > data[index - 1].positions[activeViewId] && position < value.positions[activeViewId];\n });\n if (index === -1) {\n index = data.length;\n }\n return [index];\n}\n\nexport function getShareTypeNumberPath(path: (string | number)[]): number[] {\n return path.filter((node) => typeof node === 'number') as number[];\n}\n\nexport function getSharedRecordId(records: Y.Array<SyncArrayElement>, recordIndex: number) {\n return records && (records as Y.Array<SyncArrayElement>).get(recordIndex).get(0).get(0)['_id'];\n}\n\nexport function getSharedRecord(records: Y.Array<SyncArrayElement>, recordIndex: number) {\n return records && (records as Y.Array<SyncArrayElement>).get(recordIndex);\n}\n\nexport function getSharedMapValueId(values: Y.Array<SyncMapElement>, index: number) {\n return values && values.get(index).get('_id');\n}\n\nexport function getSharedRecordIndex(sharedRecords: Y.Array<SyncArrayElement>, recordId: string) {\n let recordIndex = -1;\n for (let index = 0; index < sharedRecords.length; index++) {\n const sharedRecordId = getSharedRecordId(sharedRecords, index);\n if (sharedRecordId === recordId) {\n recordIndex = index;\n break;\n }\n }\n return recordIndex;\n}\n\nexport function getSharedMapValueIndex(sharedNodes: Y.Array<SyncMapElement>, id: string) {\n let nodeIndex = -1;\n for (let index = 0; index < sharedNodes.length; index++) {\n const sharedId = getSharedMapValueId(sharedNodes, index);\n if (sharedId === id) {\n nodeIndex = index;\n break;\n }\n }\n return nodeIndex;\n}\n\nexport const getSystemFieldValues = (record: AITableViewRecord): SystemFieldValues => {\n return [\n { _id: record['_id'] },\n record.short_id,\n record.created_at,\n record.created_by,\n record['positions'],\n record.updated_at,\n record.updated_by\n ];\n};\n\nexport const getCustomFieldValues = (record: AITableViewRecord): CustomFieldValues => {\n throw new Error('No implement');\n};\n\nexport const getValuesByCustomFieldValues = (customFieldValues: CustomFieldValues, fields: AITableViewFields) => {\n const fieldIds = fields.map((item) => item._id);\n const recordValue: Record<string, any> = {};\n fieldIds.forEach((item, index) => {\n recordValue[item] = customFieldValues[index];\n });\n return recordValue;\n};\n\nexport const getTrackableEntityBySystemFieldValues = (systemFieldValues: SystemFieldValues): TrackableEntity => {\n return {\n created_at: systemFieldValues[SystemFieldIndex.CreatedAt],\n created_by: systemFieldValues[SystemFieldIndex.CreatedBy],\n updated_at: systemFieldValues[SystemFieldIndex.UpdatedAt],\n updated_by: systemFieldValues[SystemFieldIndex.UpdatedBy]\n };\n};\n\nexport const getIdBySystemFieldValues = (systemFieldValues: SystemFieldValues): string => {\n return systemFieldValues[SystemFieldIndex.Id]['_id'];\n};\n\nexport const getShortIdBySystemFieldValues = (systemFieldValues: SystemFieldValues): string => {\n return systemFieldValues[SystemFieldIndex.ShortId];\n};\n\nexport const getIdBySystemFieldValuesType = (systemFieldValuesType: Y.Array<any>): string => {\n return systemFieldValuesType.get(SystemFieldIndex.Id)['_id'];\n};\n\nexport const getPositionsBySystemFieldValues = (systemFieldValues: SystemFieldValues): Positions => {\n return systemFieldValues[SystemFieldIndex.Positions];\n};\n\nexport const getPositionsByRecordSyncElement = (recordSyncElement: RecordSyncElement) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n const positions = systemFieldType.get(SystemFieldIndex.Positions);\n return positions;\n};\n\nexport const setRecordPositions = (recordSyncElement: RecordSyncElement, newPositions: Positions) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n systemFieldType.delete(SystemFieldIndex.Positions);\n systemFieldType.insert(SystemFieldIndex.Positions, [newPositions]);\n};\n\nexport const setRecordUpdatedInfo = (recordSyncElement: RecordSyncElement, info: AITableRecordUpdatedInfo) => {\n const systemFieldType = recordSyncElement.get(0) as Y.Array<any>;\n systemFieldType.delete(SystemFieldIndex.UpdatedAt, 2);\n systemFieldType.insert(SystemFieldIndex.UpdatedAt, [info.updated_at, info.updated_by]);\n};\n","export const AI_TABLE_CONTENT_FIELD_NAME = 'content';","import * as Y from 'yjs';\nimport { AITableViewFields, AITableViewRecords, AITableViews, SharedRecordJsonType, SharedType } from '../../types';\nimport {\n getIdBySystemFieldValues,\n getPositionsBySystemFieldValues,\n getShortIdBySystemFieldValues,\n getTrackableEntityBySystemFieldValues,\n getValuesByCustomFieldValues,\n toRecordSyncElement,\n toSyncElement\n} from './translate';\nimport { AI_TABLE_CONTENT_FIELD_NAME } from '../../constants/default';\n\nexport const createSharedType = (fieldName: string = AI_TABLE_CONTENT_FIELD_NAME) => {\n const doc = new Y.Doc();\n const sharedType = doc.getMap<any>(fieldName);\n return sharedType;\n};\n\nexport const getDataBySharedType = (sharedType: SharedType) => {\n const data = sharedType.toJSON();\n const fields: AITableViewFields = data['fields'];\n const records: AITableViewRecords = getRecordsBySharedJson(data['records'], fields);\n const views = data['views'];\n return {\n records,\n fields,\n views\n };\n};\n\nexport const getSharedTypeByData = (\n doc: Y.Doc,\n initializeValue: {\n fields: AITableViewFields;\n records: AITableViewRecords;\n views: AITableViews;\n }\n) => {\n const sharedType = doc.getMap<any>(AI_TABLE_CONTENT_FIELD_NAME);\n toSharedType(sharedType, initializeValue);\n return sharedType;\n};\n\nexport function toSharedType(\n sharedType: Y.Map<any>,\n data: {\n fields: AITableViewFields;\n records: AITableViewRecords;\n views: AITableViews;\n }\n): void {\n sharedType.doc!.transact(() => {\n const fieldSharedType = new Y.Array();\n fieldSharedType.insert(0, data.fields.map(toSyncElement));\n sharedType.set('fields', fieldSharedType);\n const recordSharedType = new Y.Array<Y.Array<any>>();\n sharedType.set('records', recordSharedType);\n recordSharedType.insert(\n 0,\n data.records.map((record) => {\n return toRecordSyncElement(record, data.fields);\n })\n );\n const viewsSharedType = new Y.Array();\n sharedType.set('views', viewsSharedType);\n viewsSharedType.insert(0, data.views.map(toSyncElement));\n });\n}\n\nexport const getRecordsBySharedJson = (recordJsonArray: SharedRecordJsonType[], fields: AITableViewFields): AITableViewRecords => {\n return recordJsonArray.map((record: SharedRecordJsonType) => {\n const [systemFieldValues, customFieldValues] = record;\n return {\n _id: getIdBySystemFieldValues(systemFieldValues),\n short_id: getShortIdBySystemFieldValues(systemFieldValues),\n ...getTrackableEntityBySystemFieldValues(systemFieldValues),\n positions: getPositionsBySystemFieldValues(systemFieldValues),\n values: getValuesByCustomFieldValues(customFieldValues, fields)\n };\n });\n};\n","import { isArray } from 'ngx-tethys/util';\nimport * as Y from 'yjs';\nimport {\n ActionName,\n AITableAction,\n AITableView,\n AITableViewFields,\n AITableViewRecords,\n AIViewTable,\n Positions,\n SharedType,\n SyncArrayElement,\n SyncMapElement\n} from '../../types';\nimport { getIdBySystemFieldValues, getShareTypeNumberPath, getTrackableEntityBySystemFieldValues, translatePositionToPath } from '../utils';\nimport {\n getPositionsBySystemFieldValues,\n getSharedMapValueId,\n getSharedRecord,\n getSharedRecordId,\n getShortIdBySystemFieldValues,\n getValuesByCustomFieldValues,\n SystemFieldIndex\n} from '../utils/translate';\nimport { AIRecordFieldIdPath, AITableField, AITableQueries, IdPath, NumberPath } from '@ai-table/grid';\n\nexport default function translateArrayEvent(aiTable: AIViewTable, sharedType: SharedType, event: Y.YEvent<any>): AITableAction[] {\n let offset = 0;\n let targetPath = getShareTypeNumberPath(event.path);\n const isRecordsTranslate = event.path.includes('records');\n const isFieldsTranslate = event.path.includes('fields');\n const isViewsTranslate = event.path.includes('views');\n const actions: AITableAction[] = [];\n const activeViewId = aiTable.activeViewId();\n\n event.changes.delta.forEach((delta) => {\n if ('retain' in delta) {\n offset += delta.retain ?? 0;\n }\n\n if ('delete' in delta) {\n if (isAddOrRemove(targetPath)) {\n if (isViewsTranslate) {\n const removeView = aiTable.views()[offset];\n if (removeView) {\n actions.push({\n type: ActionName.RemoveView,\n path: [removeView._id]\n });\n }\n } else {\n const type = isRecordsTranslate ? ActionName.RemoveRecord : ActionName.RemoveField;\n const removeIds = getRemoveIds(event, type);\n if (removeIds.length) {\n removeIds.forEach((path) => {\n actions.push({\n type,\n path\n });\n });\n }\n }\n }\n }\n\n if ('insert' in delta) {\n if (isArray(delta.insert)) {\n if (isRecordsTranslate) {\n if (isAddOrRemove(targetPath)) {\n delta.insert?.map((item: Y.Array<any>) => {\n const data = item.toJSON();\n const [systemFieldValues, customFieldValues] = data;\n const positions = getPositionsBySystemFieldValues(systemFieldValues);\n const position = positions[activeViewId];\n const path = translatePositionToPath(\n aiTable.records() as AITableViewRecords,\n position,\n activeViewId\n ) as NumberPath;\n\n actions.push({\n type: ActionName.AddRecord,\n path: path,\n record: {\n _id: getIdBySystemFieldValues(systemFieldValues),\n short_id: getShortIdBySystemFieldValues(systemFieldValues),\n ...getTrackableEntityBySystemFieldValues(systemFieldValues),\n positions: getPositionsBySystemFieldValues(systemFieldValues),\n values: getValuesByCustomFieldValues(customFieldValues, aiTable.fields() as AITableViewFields)\n }\n });\n });\n } else {\n try {\n const sharedRecords = sharedType.get('records')! as Y.Array<SyncArrayElement>;\n const sharedFields = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n let systemFieldOffset = 0;\n delta.insert?.map((item: any) => {\n const recordIndex = targetPath[0] as number;\n const fieldIndex = offset;\n const record = (aiTable.records() as AITableViewRecords)[recordIndex];\n if (isSystemFieldOperation(targetPath)) {\n if (isPositionsOperation(fieldIndex)) {\n const newPositions: Positions = {};\n for (const key in item) {\n newPositions[key] = item[key];\n }\n actions.push({\n type: ActionName.SetRecordPositions,\n path: [record._id],\n positions: newPositions\n });\n // 此处的循环会包含 updated_at 和 updated_by 各一次,这里只处理 updated_by 同时包含两个字段的修改\n } else if (isUpdatedByOperation(fieldIndex + systemFieldOffset)) {\n const systemFieldValues = getSharedRecord(sharedRecords, recordIndex).get(0).toJSON();\n const { updated_at, updated_by } = getTrackableEntityBySystemFieldValues(systemFieldValues);\n actions.push({\n type: ActionName.UpdateSystemFieldValue,\n path: [record._id],\n updatedInfo: { updated_at, updated_by }\n });\n }\n systemFieldOffset++;\n } else {\n const recordId = getSharedRecordId(sharedRecords, recordIndex);\n const fieldId = getSharedMapValueId(sharedFields, fieldIndex);\n const path = [recordId, fieldId] as AIRecordFieldIdPath;\n const fieldValue = AITableQueries.getFieldValue(aiTable, path);\n // To exclude insert triggered by field inserts.\n if (fieldValue !== item) {\n actions.push({\n type: ActionName.UpdateFieldValue,\n path,\n fieldValue,\n newFieldValue: item\n });\n }\n }\n });\n } catch (error) {}\n }\n }\n if (isFieldsTranslate) {\n delta.insert?.map((item: Y.Map<any>) => {\n const data = item.toJSON();\n const path = translatePositionToPath(\n aiTable.fields() as AITableViewFields,\n data['positions'][activeViewId],\n activeViewId\n ) as NumberPath;\n actions.push({\n type: ActionName.AddField,\n path,\n field: data as AITableField\n });\n });\n }\n if (isViewsTranslate) {\n delta.insert?.map((item: Y.Map<any>, index) => {\n const data = item.toJSON();\n actions.push({\n type: ActionName.AddView,\n path: [offset + index],\n view: data as AITableView\n });\n });\n }\n }\n }\n });\n return actions;\n}\n\nexport function isAddOrRemove(targetPath: number[]): boolean {\n return targetPath.length === 0;\n}\n\nexport function isSystemFieldOperation(targetPath: number[]): boolean {\n if (targetPath.length === 2 && targetPath[1] === 0) {\n return true;\n }\n return false;\n}\n\nexport function isCustomFieldOperation(targetPath: number[]): boolean {\n if (targetPath.length === 2 && targetPath[1] === 1) {\n return true;\n }\n return false;\n}\n\nexport function isPositionsOperation(fieldIndex: number): boolean {\n return fieldIndex === SystemFieldIndex.Positions;\n}\n\nexport function isUpdatedByOperation(fieldIndex: number): boolean {\n return fieldIndex === SystemFieldIndex.UpdatedBy;\n}\n\nexport function getRemoveIds(event: Y.YEvent<any>, type: ActionName.RemoveField | ActionName.RemoveRecord) {\n const ids: [string][] = [];\n if (!type) {\n return ids;\n }\n\n Y.iterateDeletedStructs(\n event.transaction,\n event.transaction.deleteSet,\n // @param {Item|GC} item\n (item) => {\n if (item instanceof Y.Item && item.deleted) {\n if (type === ActionName.RemoveField && item.parentSub === '_id') {\n ids.push(item.content.getContent() as IdPath);\n }\n if (type === ActionName.RemoveRecord) {\n const content = item.content.getContent();\n if (content[0] && content[0]['_id']) {\n ids.push([content[0]['_id']]);\n }\n }\n }\n }\n );\n return ids;\n}\n","import { AITableField } from '@ai-table/grid';\nimport * as Y from 'yjs';\nimport { getShareTypeNumberPath } from '../utils';\nimport { ActionName, AITableAction, AITableView, AIViewTable, SharedType, SyncMapElement } from '../../types';\n\nexport default function translateMapEvent(\n aiTable: AIViewTable,\n sharedType: SharedType,\n event: Y.YMapEvent<unknown>\n): AITableAction[] {\n const isFieldsTranslate = event.path.includes('fields');\n const isViewTranslate = event.path.includes('views');\n\n if (isViewTranslate || isFieldsTranslate) {\n let [targetPath] = getShareTypeNumberPath(event.path) as [number];\n let targetElement;\n const targetSyncElement = event.target as SharedType;\n if (isFieldsTranslate) {\n const field = sharedType.get('fields')?.get(targetPath) as SyncMapElement;\n const fieldId = field && field.get('_id');\n targetElement = fieldId && aiTable.fields().find((item) => item._id === field.get('_id'));\n }\n\n if (isViewTranslate) {\n targetElement = aiTable.views()[targetPath];\n }\n\n if (targetElement) {\n const keyChanges: [string, { action: 'add' | 'update' | 'delete'; oldValue: any }][] = Array.from(event.changes.keys.entries());\n const newProperties: Partial<AITableView | AITableField> = {};\n const properties: Partial<AITableView | AITableField> = {};\n\n const entries: [string, any][] = keyChanges.map(([key, info]) => {\n const value = targetSyncElement.get(key);\n return [key, info.action === 'delete' ? null : value instanceof Y.AbstractType ? value.toJSON() : value];\n });\n\n for (const [key, value] of entries) {\n const k = key as keyof (AITableView | AITableField);\n newProperties[k] = value;\n }\n\n const oldEntries = keyChanges.map(([key]) => [key, (targetElement as any)[key]]);\n for (const [key, value] of oldEntries) {\n const k = key as keyof (AITableView | AITableField);\n properties[k] = value;\n }\n const type = isFieldsTranslate ? ActionName.SetField : ActionName.SetView;\n return [\n {\n type,\n properties: properties,\n newProperties: newProperties,\n path: [targetElement._id]\n }\n ] as AITableAction[];\n }\n }\n return [];\n}\n","import * as Y from 'yjs';\nimport { AITableAction, AIViewTable, SharedType } from '../../types';\nimport { YjsAITable } from '../yjs-table';\nimport translateArrayEvent from './array-event';\nimport translateMapEvent from './map-event';\n\nexport function translateYjsEvent(aiTable: AIViewTable, sharedType: SharedType, event: Y.YEvent<any>): AITableAction[] {\n if (event instanceof Y.YArrayEvent) {\n return translateArrayEvent(aiTable, sharedType, event);\n }\n if (event instanceof Y.YMapEvent) {\n return translateMapEvent(aiTable, sharedType, event);\n }\n return [];\n}\n\nexport function applyEvents(aiTable: AIViewTable, sharedType: SharedType, events: Y.YEvent<any>[]) {\n events.forEach((event) =>\n translateYjsEvent(aiTable, sharedType, event).forEach((item: AITableAction) => {\n aiTable.apply(item);\n })\n );\n}\n\nexport function applyYjsEvents(aiTable: AIViewTable, sharedType: SharedType, events: Y.YEvent<any>[]): void {\n if (YjsAITable.isUndo(aiTable)) {\n applyEvents(aiTable, sharedType, events);\n } else {\n YjsAITable.asRemote(aiTable, () => {\n applyEvents(aiTable, sharedType, events);\n });\n }\n}\n","import { AITable } from '@ai-table/grid';\nimport { SharedType, SyncArrayElement, SyncMapElement, UpdateFieldValueAction } from '../../types';\nimport { getSharedMapValueIndex, getSharedRecordIndex } from '../utils';\nimport * as Y from 'yjs';\n\nexport default function updateFieldValue(aiTable: AITable, sharedType: SharedType, action: UpdateFieldValueAction): SharedType {\n const sharedRecords = sharedType.get('records');\n const sharedFields = sharedType.get('fields')!;\n if (sharedRecords && sharedFields) {\n const recordIndex = getSharedRecordIndex(sharedRecords as Y.Array<SyncArrayElement>, action.path[0]);\n const fieldIndex = getSharedMapValueIndex(sharedFields as Y.Array<SyncMapElement>, action.path[1]);\n if (recordIndex > -1 && fieldIndex > -1) {\n const record = sharedRecords?.get(recordIndex) as SyncArrayElement;\n const customField = record.get(1);\n customField.delete(fieldIndex);\n customField.insert(fieldIndex, [action.newFieldValue]);\n }\n }\n\n return sharedType;\n}\n","import { getSharedMapValueIndex } from '../utils';\nimport { ActionName, SetFieldAction, SetViewAction, SharedType, SyncMapElement } from '../../types';\nimport * as Y from 'yjs';\nimport { AITable } from '@ai-table/grid';\n\nexport default function setNode(aiTable: AITable, sharedType: SharedType, action: SetFieldAction | SetViewAction): SharedType {\n let sharedNodes;\n if (action.type === ActionName.SetField) {\n sharedNodes = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n }\n\n if (action.type === ActionName.SetView) {\n sharedNodes = sharedType.get('views')! as Y.Array<SyncMapElement>;\n }\n\n if (sharedNodes) {\n let nodeIndex = getSharedMapValueIndex(sharedNodes, action.path[0] as string);\n if (nodeIndex > -1) {\n const node = sharedNodes.get(nodeIndex) as SyncMapElement;\n Object.entries(action.newProperties).forEach(([key, value]) => {\n if (value == null) {\n node.delete(key);\n } else {\n node.set(key, value);\n }\n });\n Object.entries(action.properties).forEach(([key]) => {\n if (!action.newProperties.hasOwnProperty(key)) {\n node.delete(key);\n }\n });\n }\n }\n return sharedType;\n}\n","import { AITable } from '@ai-table/grid';\nimport * as Y from 'yjs';\nimport {\n ActionName,\n AddFieldAction,\n AddRecordAction,\n SetRecordPositionAction,\n AddViewAction,\n AITableViewRecord,\n SharedType,\n SyncArrayElement,\n SyncMapElement,\n AITableViewFields,\n UpdateSystemFieldValue\n} from '../../types';\nimport {\n getPositionsByRecordSyncElement,\n getSharedRecordIndex,\n toRecordSyncElement,\n toSyncElement,\n setRecordPositions,\n getIdBySystemFieldValuesType,\n setRecordUpdatedInfo\n} from '../utils';\n\nexport default function addNode(\n aiTable: AITable,\n sharedType: SharedType,\n action: AddFieldAction | AddRecordAction | AddViewAction | SetRecordPositionAction | UpdateSystemFieldValue\n): SharedType {\n const records = sharedType.get('records')! as Y.Array<SyncArrayElement>;\n const views = sharedType.get('views')!;\n const fields = sharedType.get('fields')! as Y.Array<SyncMapElement>;\n switch (action.type) {\n case ActionName.AddRecord:\n records && records.push([toRecordSyncElement(action.record as AITableViewRecord, aiTable.fields() as AITableViewFields)]);\n break;\n case ActionName.AddView:\n views && views.push([toSyncElement(action.view)]);\n break;\n case ActionName.SetRecordPositions:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n const record = records.get(recordIndex);\n const positions = getPositionsByRecordSyncElement(record);\n const newPositions = { ...positions };\n for (const key in action.positions) {\n if (action.positions[key] === null || action.positions[key] === undefined) {\n delete newPositions[key];\n } else {\n newPositions[key] = action.positions[key];\n }\n }\n setRecordPositions(record, newPositions);\n }\n break;\n case ActionName.UpdateSystemFieldValue:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n const record = records.get(recordIndex);\n if (action.updatedInfo.updated_at && action.updatedInfo.updated_by) {\n setRecordUpdatedInfo(record, action.updatedInfo as { updated_at: number; updated_by: string });\n }\n }\n break;\n case ActionName.AddField:\n if (fields && records) {\n const { field, path } = action;\n const [insertIndex] = path;\n const fieldSyncElement = toSyncElement(field);\n fields.insert(insertIndex, [fieldSyncElement]);\n for (let value of records) {\n const customFieldValues = value.get(1);\n const systemFieldValues = value.get(0);\n const recordEntity = aiTable.recordsMap()[getIdBySystemFieldValuesType(systemFieldValues)];\n const newFieldValue = recordEntity.values[action.field._id];\n customFieldValues.insert(insertIndex, [newFieldValue]);\n }\n }\n break;\n }\n\n return sharedType;\n}\n","import * as Y from 'yjs';\nimport {\n ActionName,\n RemoveFieldAction,\n RemoveRecordAction,\n RemoveViewAction,\n SharedType,\n SyncArrayElement,\n SyncMapElement\n} from '../../types';\nimport { getSharedMapValueIndex, getSharedRecordIndex } from '../utils';\nimport { AITable } from '@ai-table/grid';\n\nexport default function removeNode(aiTable: AITable, sharedType: SharedType, action: RemoveFieldAction | RemoveRecordAction | RemoveViewAction): SharedType {\n const fields = sharedType.get('fields') as Y.Array<SyncMapElement>;\n const records = sharedType.get('records') as Y.Array<SyncArrayElement>;\n const views = sharedType.get('views')! as Y.Array<SyncMapElement>;\n\n switch (action.type) {\n case ActionName.RemoveRecord:\n if (records) {\n const recordIndex = getSharedRecordIndex(records, action.path[0]);\n if (recordIndex > -1) {\n records.delete(recordIndex);\n }\n }\n break;\n case ActionName.RemoveView:\n if (views) {\n const viewIndex = getSharedMapValueIndex(views, action.path[0]);\n if (viewIndex > -1) {\n views.delete(viewIndex);\n }\n }\n break;\n case ActionName.RemoveField:\n if (fields && records) {\n const fieldIndex = getSharedMapValueIndex(fields, action.path[0]);\n if (fieldIndex > -1) {\n fields.delete(fieldIndex);\n for (let value of records) {\n value.get(1).delete(fieldIndex);\n }\n }\n }\n break;\n }\n\n return sharedType;\n}\n","import { AITable } from '@ai-table/grid';\nimport updateFieldValue from './update-field-value';\nimport { ActionName, AITableAction, SharedType } from '../../types';\nimport setNode from './set-node';\nimport addNode from './add-node';\nimport removeNode from './remove-node';\n\nexport type ActionMapper<O extends AITableAction = AITableAction> = {\n [K in O['type']]: O extends { type: K } ? ApplyFunc<O> : never;\n};\n\nexport type ApplyFunc<O extends AITableAction = AITableAction> = (aiTable: AITable, sharedType: SharedType, op: O) => SharedType;\n\nexport const actionMappers: Partial<ActionMapper<any>> = {\n [ActionName.AddRecord]: addNode,\n [ActionName.UpdateFieldValue]: updateFieldValue,\n [ActionName.RemoveRecord]: removeNode,\n [ActionName.AddField]: addNode,\n [ActionName.SetField]: setNode,\n [ActionName.RemoveField]: removeNode,\n [ActionName.SetView]: setNode,\n [ActionName.AddView]: addNode,\n [ActionName.RemoveView]: removeNode,\n [ActionName.SetRecordPositions]: addNode,\n [ActionName.UpdateSystemFieldValue]: addNode\n};\n\nexport function applyActionOps(aiTable: AITable, sharedType: SharedType, actions: AITableAction[]): SharedType {\n if (actions.length > 0) {\n sharedType.doc!.transact(() => {\n actions.forEach((action) => {\n const apply = actionMappers[action.type] as ApplyFunc<typeof action>;\n if (apply) {\n return apply(aiTable, sharedType, action);\n }\n return null;\n });\n }, aiTable);\n }\n\n return sharedType;\n}\n","import { Path } from '@ai-table/grid';\nimport { AITableView, AITableViewFields, AITableViewRecords } from '../types';\n\nexport function isPathEqual(path: Path, another: Path): boolean {\n return path.length === another.length && path.every((n, i) => n === another[i]);\n}\n\nexport function sortByViewPosition(data: AITableViewRecords | AITableViewFields, activeView: AITableView) {\n const hasPositions = data.every((item) => item.positions && item.positions);\n if (hasPositions) {\n return [...data].sort((a, b) => a.positions[activeView._id] - b.positions[activeView._id]);\n }\n return data;\n}\n","import { AITable, AITableFieldType, AITableQueries, FieldModelMap } from '@ai-table/grid';\nimport { AITableView, AITableViewRecords } from '../../types';\nimport { sortByViewPosition } from '../common';\n\nexport function getSortRecords(\n aiTable: AITable,\n records: AITableViewRecords,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n if (!activeView?.settings || !activeView.settings.sorts?.length) {\n return records;\n }\n const { is_keep_sort, sorts } = activeView.settings;\n if (is_keep_sort && sorts?.length) {\n return sortRecordsBySortInfo(aiTable, records, activeView, sortKeysMap);\n }\n return sortByViewPosition(records, activeView);\n}\n\nexport function sortRecordsBySortInfo(\n aiTable: AITable,\n records: AITableViewRecords,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n const shallowRows = [...records];\n if (activeView.settings?.sorts?.length) {\n shallowRows.sort((prev, current) => {\n return activeView.settings!.sorts!.reduce((acc, rule) => {\n const field = aiTable.fieldsMap()[rule.sort_by];\n if (!field || acc !== 0) {\n return acc;\n }\n const fieldMethod = FieldModelMap[field.type];\n const sortKey = sortKeysMap?.[field.type];\n\n const cellValue1 = AITableQueries.getFieldValue(aiTable, [prev._id, field._id]);\n const cellValue2 = AITableQueries.getFieldValue(aiTable, [current._id, field._id]);\n const references = aiTable.context!.references();\n const res = fieldMethod.compare(cellValue1, cellValue2, field, references, sortKey);\n return res * rule.direction;\n }, 0);\n });\n return shallowRows;\n }\n return shallowRows;\n}\n","import {\n AITableFieldType,\n AITableFilterCondition,\n AITableRecord,\n FieldValue,\n isSystemField,\n SystemFieldTypes,\n FieldModelMap,\n isEmpty,\n AITableFilterOperation,\n SelectSettings\n} from '@ai-table/grid';\nimport {\n AITableFilterConditions,\n AITableFilterLogical,\n AITableView,\n AITableViewField,\n AITableViewFields,\n AITableViewRecords,\n AIViewTable\n} from '../../types';\n\nexport function getFilteredRecords(aiTable: AIViewTable, records: AITableViewRecords, fields: AITableViewFields, activeView: AITableView) {\n const { conditions, condition_logical } = activeView.settings || {};\n if (!conditions) {\n return records;\n }\n const illegalConditions = conditions.filter((item) => item.operation) || [];\n if (!illegalConditions.length) {\n return records;\n }\n const recordsWillHidden = aiTable.recordsWillHidden();\n return records.filter((record) => {\n if (recordsWillHidden && recordsWillHidden.length && recordsWillHidden.includes(record._id)) {\n return true;\n }\n return checkConditions(fields, record, { conditions: illegalConditions, condition_logical });\n });\n}\n\nfunction checkConditions(fields: AITableViewFields, record: AITableRecord, filterConditions: AITableFilterConditions) {\n if (!record) {\n return false;\n }\n if (!filterConditions?.conditions) {\n return true;\n }\n const { condition_logical, conditions } = filterConditions;\n if (condition_logical === AITableFilterLogical.and) {\n return conditions.every((condition) => doFilterOperations(fields, record, condition));\n }\n if (!condition_logical || condition_logical === AITableFilterLogical.or) {\n return conditions.some((condition) => doFilterOperations(fields, record, condition));\n }\n return false;\n}\n\nfunction doFilterOperations(fields: AITableViewFields, record: AITableRecord, condition: AITableFilterCondition) {\n const { field, cellValue } = getFilterValue(fields, record, condition);\n\n try {\n return field && doFilter(condition, field, cellValue);\n } catch (error) {\n return false;\n }\n}\n\nexport function doFilter(condition: AITableFilterCondition, field: AITableViewField, cellValue: FieldValue) {\n return FieldModelMap[field.type].isMeetFilter(condition, cellValue);\n}\n\nexport function getDefaultRecordDataByFilter(\n recordValues: Record<string, FieldValue>,\n conditions: AITableFilterCondition[],\n fields: AITableViewFields,\n conditionLogical?: AITableFilterLogical\n) {\n const fieldMap = new Map<string, AITableViewField>(fields.map((field) => [field._id, field]));\n const conditionFieldCountMap = new Map<string, number>();\n conditions.forEach((condition) => {\n const fieldId = condition.field_id.toString();\n const tmpFieldCount = conditionFieldCountMap.get(fieldId) || 0;\n conditionFieldCountMap.set(fieldId, tmpFieldCount + 1);\n });\n if (conditionLogical === AITableFilterLogical.and) {\n conditions.forEach((condition) => {\n if (conditionFieldCountMap.get(condition.field_id.toString()) === 1) {\n const field = fieldMap.get(condition.field_id.toString())!;\n const canMultipleOperationCondition =\n (!(field.settings as SelectSettings)?.is_multiple && condition.operation === AITableFilterOperation.eq) ||\n (field?.settings as SelectSettings)?.is_multiple;\n if (\n [AITableFilterOperation.eq, AITableFilterOperation.in].includes(condition.operation) &&\n [AITableFieldType.select, AITableFieldType.member].includes(field?.type) &&\n canMultipleOperationCondition\n ) {\n recordValues[condition.field_id] = condition.value;\n }\n\n if (field?.type === AITableFieldType.date && condition.operation === AITableFilterOperation.eq) {\n recordValues[condition.field_id] = {\n timestamp: condition.value\n };\n }\n\n if (condition.operation === AITableFilterOperation.contain && AITableFieldType.text === field?.type) {\n recordValues[condition.field_id] = condition.value;\n }\n\n if (\n condition.operation === AITableFilterOperation.eq &&\n [AITableFieldType.rate, AITableFieldType.number, AITableFieldType.progress].includes(field?.type)\n ) {\n recordValues[condition.field_id] = condition.value;\n }\n }\n });\n }\n return recordValues;\n}\n\nfunction getFilterValue(fields: AITableViewFields, record: AITableRecord, condition: AITableFilterCondition) {\n const field = fields.find((item) => item._id === condition.field_id);\n let cellValue = null;\n if (field && isSystemField(field)) {\n if ([AITableFieldType.createdAt, AITableFieldType.updatedAt].includes(field.type)) {\n cellValue = { timestamp: record[field.type as SystemFieldTypes] };\n } else {\n cellValue = record[field.type as SystemFieldTypes];\n }\n } else {\n cellValue = record.values[condition.field_id];\n }\n\n if (field && [AITableFieldType.createdBy, AITableFieldType.updatedBy, AITableFieldType.member].includes(field.type)) {\n cellValue = Array.isArray(cellValue) ? cellValue : isEmpty(cellValue) ? [] : [cellValue];\n }\n\n return {\n field,\n cellValue\n };\n}\n","import { AITable } from \"@ai-table/grid\";\nimport { AITableView, AITableViewFields } from \"../../types\";\nimport { sortByViewPosition } from \"../common\";\n\nexport function getSortFields(aiTable: AITable, fields: AITableViewFields, activeView: AITableView) {\n return sortByViewPosition(fields as AITableViewFields, activeView) as AITableViewFields;\n}\n","import { AITableView, AITableViewFields, AITableViewRecords, AIViewTable } from '../types';\nimport { getSortRecords } from './record/sort';\nimport { getFilteredRecords } from './record/filter';\nimport { getSortFields } from './field/sort-fields';\nimport { AITableFieldType } from '@ai-table/grid';\n\nexport function buildRecordsByView(\n aiTable: AIViewTable,\n records: AITableViewRecords,\n fields: AITableViewFields,\n activeView: AITableView,\n sortKeysMap?: Partial<Record<AITableFieldType, string>>\n) {\n const filteredRecords = getFilteredRecords(aiTable, records, fields, activeView);\n return getSortRecords(aiTable, filteredRecords, activeView, sortKeysMap);\n}\n\nexport function buildFieldsByView(aiTable: AIViewTable, fields: AITableViewFields, activeView: AITableView) {\n return getSortFields(aiTable, fields as AITableViewFields, activeView);\n}\n","import { AITableField, AITableQueries, IdPath, NumberPath } from '@ai-table/grid';\nimport { ActionName, AddFieldAction, RemoveFieldAction, SetFieldAction, AIViewTable } from '../types';\nimport { AITableViewField } from '../types/view';\nimport { isPathEqual, getFieldPositionInView } from '../utils';\n\nexport function addField(aiTable: AIViewTable, field: AITableField, path: NumberPath, originId?: string, isCopy?: boolean) {\n const operation: AddFieldAction = {\n type: ActionName.AddField,\n field,\n path,\n originId,\n isCopy\n };\n aiTable.apply(operation);\n}\n\nexport function moveField(aiTable: AIViewTable, path: NumberPath, newPath: NumberPath) {\n if (isPathEqual(path, newPath)) {\n return;\n }\n const fields = aiTable.gridData().fields;\n const activeView = aiTable.views().find((item) => item._id === aiTable.activeViewId());\n const sourceField = fields[path[0]] as AITableViewField;\n const position = getFieldPositionInView(activeView!._id, fields, path, newPath);\n setField(aiTable, { positions: { ...sourceField.positions, [activeView!._id]: position } }, [sourceField._id]);\n}\n\nexport function removeField(aiTable: AIViewTable, path: IdPath) {\n const operation: RemoveFieldAction = {\n type: ActionName.RemoveField,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function setField<T extends AITableViewField = AITableViewField>(aiTable: AIViewTable, value: Partial<T>, path: IdPath) {\n const field = AITableQueries.getField(aiTable, path) as T;\n if (field) {\n const properties: Partial<T> = {};\n const newProperties: Partial<T> = {};\n for (const key in value) {\n const k = key as keyof T;\n if (JSON.stringify(field[k]) !== JSON.stringify(value[k])) {\n if (field.hasOwnProperty(k)) {\n properties[k] = field[k] as any;\n }\n if (newProperties[k] !== null) {\n newProperties[k] = value[k] as any;\n }\n }\n }\n\n const operation: SetFieldAction = {\n type: ActionName.SetField,\n properties,\n newProperties,\n path\n };\n\n aiTable.apply(operation);\n }\n}\n\nexport const FieldActions = {\n addField,\n moveField,\n removeField,\n setField\n};\n","import {\n ActionName,\n AITableAction,\n AITableView,\n AITableViewField,\n AITableViewFields,\n AITableViewRecord,\n AITableViewRecords,\n AIViewTable\n} from '../types';\nimport { createDraft, finishDraft } from 'immer';\nimport { AITableField, AITableFields, getDefaultFieldValue } from '@ai-table/grid';\nimport { createDefaultPositions, isPathEqual } from '../utils';\n\nconst apply = (aiTable: AIViewTable, records: AITableViewRecords, fields: AITableFields, views: AITableView[], action: AITableAction) => {\n switch (action.type) {\n case ActionName.UpdateFieldValue: {\n const [recordId, fieldId] = action.path;\n if (recordId && fieldId) {\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n records[recordIndex].values[fieldId] = action.newFieldValue;\n }\n break;\n }\n case ActionName.UpdateSystemFieldValue: {\n const [recordId] = action.path;\n if (recordId && action.updatedInfo) {\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n if (action.updatedInfo.updated_at) {\n records[recordIndex].updated_at = action.updatedInfo.updated_at;\n }\n if (action.updatedInfo.updated_by) {\n records[recordIndex].updated_by = action.updatedInfo.updated_by;\n }\n }\n break;\n }\n case ActionName.AddRecord: {\n const [recordIndex] = action.path;\n if (recordIndex > -1) {\n if (!(action.record as AITableViewRecord).positions) {\n const activeView = aiTable.views().find((item) => item._id === aiTable.activeViewId());\n let index = recordIndex;\n if (activeView?.settings?.conditions) {\n index = records.length;\n }\n (action.record as AITableViewRecord).positions = createDefaultPositions(\n aiTable.views(),\n aiTable.activeViewId(),\n aiTable.records() as AITableViewRecords,\n index\n );\n }\n records.splice(recordIndex, 0, action.record as AITableViewRecord);\n }\n break;\n }\n case ActionName.AddField: {\n const [fieldIndex] = action.path;\n if (fieldIndex > -1) {\n const newField = action.field;\n (newField as AITableViewField).positions = createDefaultPositions(\n aiTable.views(),\n aiTable.activeViewId(),\n aiTable.fields() as AITableViewFields,\n action.path[0]\n );\n fields.splice(fieldIndex, 0, newField as AITableViewField);\n records.forEach((item) => {\n item.values[newField._id] =\n action.isCopy && action.originId ? item.values[action.originId] : getDefaultFieldValue(action.field);\n });\n }\n break;\n }\n case ActionName.MoveRecord: {\n if (isPathEqual(action.path, action.newPath)) {\n return;\n }\n const record = records[action.path[0]];\n records.splice(action.path[0], 1);\n records.splice(action.newPath[0], 0, record);\n break;\n }\n case ActionName.RemoveField: {\n const [fieldId] = action.path;\n const fieldIndex = aiTable.fields().findIndex((item) => item._id === fieldId);\n if (fieldIndex > -1) {\n fields.splice(fieldIndex, 1);\n records.forEach((item) => {\n delete item.values[fieldId];\n });\n }\n break;\n }\n case ActionName.RemoveRecord: {\n const [recordId] = action.path;\n const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);\n if (recordIndex > -1) {\n records.splice(recordIndex, 1);\n }\n break;\n }\n\n case ActionName.SetField: {\n const field = fields.find((item) => item._id === action.path[0]) as AITableField;\n if (field) {\n for (const key in action.newProperties) {\n const k = key as keyof AITableField;\n const value = action.newProperties[k];\n if (value == null) {\n delete field[k];\n } else {\n (field[k] as any) = value;\n }\n }\n\n // properties that were previously defined, but are now missing, must be deleted\n for (const key in action.properties) {\n if (!action.newProperties.hasOwnProperty(key)) {\n delete field[<keyof AITableField>key];\n }\n }\n }\n break;\n }\n case ActionName.SetView: {\n const view = views.find((item) => item._id === action.path[0]) as AITableView;\n if (view) {\n for (const key in action.newProperties) {\n const k = key as keyof AITableView;\n const value = action.newProperties[k];\n if (value == null) {\n delete view[k];\n } else {\n (view[k] as any) = value;\n }\n }\n\n // properties that were previously defined, but are now missing, must be deleted\n for (const key in action.properties) {\n if (!action.newProperties.hasOwnProperty(key)) {\n delete view[<keyof AITableView>key];\n }\n }\n }\n break;\n }\n case ActionName.AddView: {\n const [viewIndex] = action.path;\n if (viewIndex > -1) {\n views.splice(viewIndex, 0, action.view);\n }\n break;\n }\n case ActionName.RemoveView: {\n const [viewId] = action.path;\n const viewIndex = views.findIndex((item) => item._id === viewId);\n if (viewIndex > -1) {\n views.splice(viewIndex, 1);\n }\n break;\n }\n case ActionName.SetRecordPositions: {\n const { positions, path } = action;\n const record = records.find((item) => item._id === path[0]);\n if (record) {\n const newPositions = { ...record.positions };\n for (const key in positions) {\n if (positions[key] === null || positions[key] === undefined) {\n delete newPositions[key];\n } else {\n newPositions[key] = positions[key] as number;\n }\n }\n record.positions = newPositions;\n }\n break;\n }\n }\n return {\n records,\n fields,\n views\n };\n};\n\nexport const GeneralActions = {\n transform(aiTable: AIViewTable, action: AITableAction): void {\n const records = createDraft(aiTable.records()) as AITableViewRecords;\n const fields = createDraft(aiTable.gridData().fields) as AITableViewFields;\n const views = createDraft(aiTable.views());\n apply(aiTable, records, fields, views, action);\n aiTable.fields.set(finishDraft(fields));\n aiTable.records.set(finishDraft(records));\n aiTable.views.set(finishDraft(views));\n }\n};\n","import { ActionName, SetRecordPositionAction, AIViewTable, Positions, RemovePositions } from '../types';\nimport { IdPath } from '@ai-table/grid';\n\nexport function setRecordPositions(aiTable: AIViewTable, positions: Positions | RemovePositions, path: IdPath) {\n const operation: SetRecordPositionAction = {\n type: ActionName.SetRecordPositions,\n positions,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const PositionsActions = {\n setRecordPositions\n};\n","import { AIRecordFieldIdPath, AITableQueries, AITableRecord, AITableRecordUpdatedInfo, IdPath, NumberPath } from '@ai-table/grid';\nimport {\n UpdateFieldValueAction,\n ActionName,\n AddRecordAction,\n MoveRecordAction,\n RemoveRecordAction,\n AIViewTable,\n UpdateSystemFieldValue\n} from '../types';\n\nexport function updateFieldValue(aiTable: AIViewTable, value: any, path: AIRecordFieldIdPath) {\n const oldValue = AITableQueries.getFieldValue(aiTable, path);\n const operation: UpdateFieldValueAction = {\n type: ActionName.UpdateFieldValue,\n fieldValue: oldValue,\n newFieldValue: value,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function updateSystemFieldValue(aiTable: AIViewTable, path: IdPath, updatedInfo: AITableRecordUpdatedInfo) {\n const operation: UpdateSystemFieldValue = {\n type: ActionName.UpdateSystemFieldValue,\n updatedInfo,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function addRecord(aiTable: AIViewTable, record: AITableRecord, path: NumberPath) {\n const operation: AddRecordAction = {\n type: ActionName.AddRecord,\n record,\n path\n };\n aiTable.apply(operation);\n}\n\nexport function moveRecord(aiTable: AIViewTable, path: NumberPath, newPath: NumberPath) {\n const operation: MoveRecordAction = {\n type: ActionName.MoveRecord,\n path,\n newPath\n };\n aiTable.apply(operation);\n}\n\nexport function removeRecord(aiTable: AIViewTable, path: IdPath) {\n const operation: RemoveRecordAction = {\n type: ActionName.RemoveRecord,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const RecordActions = {\n addRecord,\n updateFieldValue,\n moveRecord,\n removeRecord,\n updateSystemFieldValue\n};\n","import { ActionName, AddViewAction, AITableView, AIViewTable, RemoveViewAction, SetViewAction } from \"../types\";\n\nfunction setView(aiTable: AIViewTable, value: Partial<AITableView>, path: [string]) {\n const view = aiTable.views().find((item) => item._id === path[0]);\n if (view) {\n const properties: Partial<AITableView> = {};\n const newProperties: Partial<AITableView> = {};\n for (const key in value) {\n const k = key as keyof AITableView;\n if (JSON.stringify(view[k]) !== JSON.stringify(value[k])) {\n if (view.hasOwnProperty(k)) {\n properties[k] = view[k] as any;\n }\n if (newProperties[k] !== null) {\n newProperties[k] = value[k] as any;\n }\n }\n }\n\n const operation: SetViewAction = {\n type: ActionName.SetView,\n properties,\n newProperties,\n path\n };\n aiTable.apply(operation);\n }\n}\n\nfunction addView(aiTable: AIViewTable, view: AITableView, path: [number]) {\n const operation: AddViewAction = {\n type: ActionName.AddView,\n view,\n path\n };\n aiTable.apply(operation);\n}\n\nfunction removeView(aiTable: AIViewTable, path: [string]) {\n const operation: RemoveViewAction = {\n type: ActionName.RemoveView,\n path\n };\n aiTable.apply(operation);\n}\n\nexport const ViewActions = {\n setView,\n addView,\n removeView\n};","import { FieldActions } from './field';\nimport { GeneralActions } from './general';\nimport { PositionsActions } from './position';\nimport { RecordActions } from './record';\nimport { ViewActions } from './view';\n\nexport const Actions = {\n ...GeneralActions,\n ...RecordActions,\n ...FieldActions,\n ...ViewActions,\n ...PositionsActions\n};\n","import { AITableRecordUpdatedInfo } from '@ai-table/grid';\nimport { AIViewTable } from '../../types';\nimport { Actions } from '../../action';\n\nexport function updateRecordsUpdatedInfo(aiTable: AIViewTable, updatedInfo: AITableRecordUpdatedInfo) {\n const records = aiTable.records();\n records.forEach((item) => {\n Actions.updateSystemFieldValue(aiTable, [item._id], updatedInfo);\n });\n}\n","import { AddFieldOptions, AITableField, AITableRecordUpdatedInfo, Direction, idsCreator } from '@ai-table/grid';\nimport { getSortFields } from './sort-fields';\nimport { AITableViewFields, AIViewTable } from '../../types';\nimport { Actions } from '../../action';\nimport { updateRecordsUpdatedInfo } from '../record/update-system-field-value';\n\nexport function addFields(aiTable: AIViewTable, options: AddFieldOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const { originId, direction = Direction.after, defaultValue, isDuplicate, count = 1 } = options;\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const fields = getSortFields(aiTable, aiTable.fields() as AITableViewFields, activeView);\n let addIndex = fields.findIndex((item) => item._id === originId);\n if (direction === Direction.after) {\n addIndex++;\n }\n const newFieldIds = idsCreator(count);\n newFieldIds.forEach((id, index) => {\n const newField = { _id: id, ...defaultValue } as AITableField;\n Actions.addField(aiTable, newField, [addIndex + index], options.originId, options.isCopy);\n });\n updateRecordsUpdatedInfo(aiTable, updatedInfo);\n}\n","import { AITable, AITableField, AITableRecordUpdatedInfo } from '@ai-table/grid';\nimport { Signal } from '@angular/core';\nimport { Actions } from '../../action';\nimport { AIViewTable } from '../../types';\nimport { updateRecordsUpdatedInfo } from '../record/update-system-field-value';\n\nexport const buildRemoveFieldItem = (getUpdatedInfo: () => AITableRecordUpdatedInfo) => {\n return {\n type: 'removeField',\n name: '删除列',\n icon: 'trash',\n exec: (aiTable: AITable, field: Signal<AITableField>) => {\n Actions.removeField(aiTable as AIViewTable, [field()._id]);\n updateRecordsUpdatedInfo(aiTable as AIViewTable, getUpdatedInfo());\n }\n };\n};\n","import { idCreator, shortIdCreator } from '@ai-table/grid';\nimport { AITableView, AITableViewField, AITableViewFields, AITableViewRecords, AIViewTable, Positions } from '../types';\nimport { Actions } from '../action';\nimport { ViewActions } from '../action/view';\nimport { PositionsActions } from '../action/position';\n\nexport function createDefaultPositions(\n views: AITableView[],\n activeId: string,\n data: AITableViewRecords | AITableViewFields,\n index: number\n) {\n const positions: Positions = {};\n const position = getPosition(data, activeId, index);\n views.forEach((element) => {\n const lastPosition = data.length ? data[data.length - 1].positions[element._id] : -1;\n positions[element._id] = element._id === activeId ? position : lastPosition + 1;\n });\n return positions;\n}\n\nexport function getPosition(data: AITableViewRecords | AITableViewFields, activeViewId: string, index: number) {\n let position = data.length - 1;\n if (index !== 0 && index !== data.length) {\n const previousViewPosition = data[index - 1].positions[activeViewId];\n const nextViewPosition = data[index].positions[activeViewId!];\n position = (previousViewPosition + nextViewPosition) / 2;\n } else {\n const lastPosition = data[data.length - 1].positions?.[activeViewId];\n position = lastPosition ? lastPosition + 1 : index;\n }\n return position;\n}\n\nexport function addView(aiTable: AIViewTable, type: 'add' | 'copy', viewId?: string) {\n let index = aiTable.views().length;\n const newId = idCreator();\n const shortId = shortIdCreator();\n let newView: AITableView = {\n _id: newId,\n short_id: shortId,\n name: '表格视图 ' + index\n };\n let originViewId = aiTable.views()[aiTable.views().length - 1]._id;\n if (type === 'copy') {\n originViewId = viewId ?? aiTable.activeViewId();\n const copyView = aiTable.views().find((item) => item._id === originViewId)!;\n newView = {\n ...copyView,\n _id: newId,\n name: copyView.name + '-副本'\n };\n index = aiTable.views().indexOf(copyView) + 1;\n }\n ViewActions.addView(aiTable, newView, [index]);\n (aiTable.records() as AITableViewRecords).forEach((record) => {\n PositionsActions.setRecordPositions(aiTable, { [newId]: record.positions[originViewId] }, [record._id]);\n });\n (aiTable.fields() as AITableViewFields).forEach((field) => {\n Actions.setField<AITableViewField>(\n aiTable,\n {\n positions: {\n ...field.positions,\n [newId]: field.positions[originViewId]\n }\n },\n [field._id]\n );\n });\n return newView;\n}\n\nexport function removeView(aiTable: AIViewTable, records: AITableViewRecords, fields: AITableViewFields, activeViewId: string) {\n records.forEach((record) => {\n PositionsActions.setRecordPositions(aiTable, { [activeViewId]: undefined }, [record._id]);\n });\n fields.forEach((field) => {\n const positions = { ...field.positions };\n delete positions[activeViewId];\n Actions.setField<AITableViewField>(\n aiTable,\n {\n positions\n },\n [field._id]\n );\n });\n ViewActions.removeView(aiTable, [activeViewId]);\n}\n","import {\n AddRecordOptions,\n AITableRecord,\n Direction,\n FieldValue,\n getDefaultFieldValue,\n idsCreator,\n shortIdsCreator,\n TrackableEntity\n} from '@ai-table/grid';\nimport { AITableViewFields, AITableViewRecords, AIViewTable } from '../../types';\nimport { getSortRecords } from './sort';\nimport { getSortFields } from '../field/sort-fields';\nimport { Actions } from '../../action';\nimport { getDefaultRecordDataByFilter } from './filter';\n\nexport function addRecords(aiTable: AIViewTable, options: AddRecordOptions, trackableEntity: TrackableEntity) {\n const { originId, direction = Direction.after, isDuplicate, count = 1 } = options;\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const records = getSortRecords(aiTable, aiTable.records() as AITableViewRecords, activeView);\n let addIndex = records.findIndex((item) => item._id === originId);\n if (direction === Direction.after) {\n addIndex++;\n }\n const newRecordIds = idsCreator(count);\n const newRecordShortIds = shortIdsCreator(count);\n const newRecordValues = getDefaultRecordValues(aiTable, isDuplicate, originId);\n // TODO: 判断如果存在筛选条件,且 newRecordValues 中没有一项满足筛选条件\n // 把 id 添加到 RECORDS_WILL_HIDDEN 中\n if (activeView.settings?.conditions?.length) {\n aiTable.recordsWillHidden?.update((value) => {\n value.push(...newRecordIds);\n return [...value];\n });\n }\n newRecordIds.forEach((id, index) => {\n const newRecord: AITableRecord = { _id: id, short_id: newRecordShortIds[index], values: newRecordValues, ...trackableEntity };\n Actions.addRecord(aiTable, newRecord, [addIndex + index]);\n });\n}\n\nexport function getDefaultRecordValues(aiTable: AIViewTable, isDuplicate = false, recordId?: string) {\n let newRecordValues: Record<string, FieldValue> = {};\n if (isDuplicate && recordId) {\n newRecordValues = aiTable.recordsMap()[recordId].values;\n } else {\n const activeView = aiTable.viewsMap()[aiTable.activeViewId()];\n const fields = getSortFields(aiTable, aiTable.fields() as AITableViewFields, activeView);\n fields.map((item) => {\n newRecordValues[item._id] = getDefaultFieldValue(item);\n });\n const { conditions, condition_logical } = activeView.settings || {};\n if (conditions && conditions.length) {\n newRecordValues = getDefaultRecordDataByFilter(newRecordValues, conditions, fields, condition_logical);\n }\n }\n return newRecordValues;\n}\n","import { AITableQueries, AITableRecordUpdatedInfo, UpdateFieldValueOptions } from '@ai-table/grid';\nimport * as _ from 'lodash';\nimport { Actions } from '../../action';\nimport { AIViewTable } from '../../types';\n\nexport function updateFieldValue(aiTable: AIViewTable, options: UpdateFieldValueOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const oldValue = AITableQueries.getFieldValue(aiTable, options.path);\n if (!_.isEqual(oldValue, options.value)) {\n Actions.updateFieldValue(aiTable, options.value, options.path);\n Actions.updateSystemFieldValue(aiTable, [options.path[0]], updatedInfo);\n }\n}\n","import { AIViewTable } from '../types';\n\nexport const FLUSHING = new WeakMap<AIViewTable, boolean>();\n","import { AITableField, AITableFields, AITableRecordUpdatedInfo, MoveFieldOptions, NumberPath } from '@ai-table/grid';\nimport { AITableViewField, AIViewTable } from '../../types';\nimport { Actions } from '../../action';\n\nexport function moveFields(aiTable: AIViewTable, options: MoveFieldOptions, updatedInfo: AITableRecordUpdatedInfo) {\n const { path, newPath } = options;\n Actions.moveField(aiTable, path, newPath);\n}\n\nexport function getFieldPositionInView(viewId: string, fields: AITableFields, path: NumberPath, newPath: NumberPath) {\n const targetPosition = (fields[newPath[0]] as AITableViewField).positions[viewId];\n let newPosition = 0;\n if (path[0] > newPath[0]) {\n const prevPath = newPath[0] - 1;\n if (prevPath > 0) {\n const targetPrevField = fields[prevPath];\n const targetPrevPosition = (targetPrevField as AITableViewField).positions[viewId];\n newPosition = (targetPosition + targetPrevPosition) / 2;\n } else {\n const firstField = fields[0];\n newPosition = (firstField as AITableViewField).positions[viewId] - 0.1;\n }\n } else {\n const nextPath = newPath[0] + 1;\n if (fields.length > nextPath) {\n const targetNextField = fields[nextPath];\n const targetNextPosition = (targetNextField as AITableViewField).positions[viewId];\n newPosition = (targetPosition + targetNextPosition) / 2;\n } else {\n const lastField = fields[fields.length - 1];\n const lastPosition = (lastField as AITableViewField).positions[viewId] + 1;\n newPosition = (targetPosition + lastPosition) / 2;\n }\n }\n return newPosition;\n}\n","import { AITable } from '@ai-table/grid';\nimport { AITableAction, AIViewTable } from '../types';\nimport { Actions } from '../action';\nimport { FLUSHING } from '../utils';\n\nexport const withState = (aiTable: AITable) => {\n const viewTable = aiTable as AIViewTable;\n viewTable.actions = [];\n\n viewTable.apply = (action: AITableAction) => {\n viewTable.actions.push(action);\n Actions.transform(viewTable, action as AITableAction);\n\n if (!FLUSHING.get(viewTable)) {\n FLUSHING.set(viewTable, true);\n Promise.resolve().then(() => {\n FLUSHING.set(viewTable, false);\n viewTable.onChange();\n viewTable.actions = [];\n });\n }\n };\n return aiTable;\n};\n","import { AddFieldOptions, AI_TABLE_GRID_FIELD_SERVICE_MAP, AITableField, AITableFieldSetting, idCreator } from '@ai-table/grid';\nimport { ElementRef, Signal } from '@angular/core';\nimport _ from 'lodash';\nimport { Actions } from '../action';\nimport { AIViewTable } from '../types';\n\nexport const DividerMenuItem = {\n type: 'divider'\n};\n\nexport const EditFieldPropertyItem = {\n type: 'editFieldProperty',\n name: '编辑列',\n icon: 'edit',\n exec: (\n aiTable: AIViewTable,\n field: Signal<AITableField>,\n origin?: HTMLElement | ElementRef<any>,\n position?: { x: number; y: number }\n ) => {\n const fieldService = AI_TABLE_GRID_FIELD_SERVICE_MAP.get(aiTable);\n const copyField: AITableField = _.cloneDeep(field());\n if (origin && position) {\n const popoverRef = fieldService?.editFieldProperty(aiTable, {\n field: copyField,\n isUpdate: true,\n origin: origin!,\n position\n });\n if (popoverRef && fieldService && !fieldService.aiFieldConfig?.fieldSettingComponent) {\n (popoverRef.componentInstance as AITableFieldSetting).setField.subscribe((value) => {\n Actions.setField(aiTable, value.field, value.path);\n });\n }\n return popoverRef;\n }\n return undefined;\n }\n};\n\nexport const CopyFieldPropertyItem = (addFieldFn: (data: AddFieldOptions) => void) => {\n return {\n type: 'copyFieldProperty',\n name: '复制列',\n icon: 'copy',\n exec: (aiTable: AIViewTable, field: Signal<AITableField>) => {\n const allFieldNames = (aiTable.fields() || []).map((item) => item.name);\n let newFieldName = `${field().name} 副本`;\n let index = 2;\n while (allFieldNames.includes(newFieldName)) {\n newFieldName = `${field().name} 副本 ${index}`;\n index++;\n }\n\n const fieldOptions: AddFieldOptions = {\n originId: field()._id,\n isCopy: true,\n defaultValue: {\n ...field(),\n _id: idCreator(),\n name: newFieldName\n }\n };\n addFieldFn(fieldOptions);\n }\n };\n};\n","import { AITable, AITableContextMenuItem, AITableGridSelectionService, AITablePasteActions, isMac, writeToAITable } from '@ai-table/grid';\nimport { Actions } from '../action';\nimport { AIViewTable } from '../types';\nimport { buildClipboardData, writeToClipboard } from '@ai-table/grid';\nimport { ThyNotifyService } from 'ngx-tethys/notify';\n\nexport const RemoveRecordsItem: AITableContextMenuItem = {\n type: 'removeRecords',\n name: '删除行',\n icon: 'trash',\n exec: (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService\n ) => {\n let selectedRecordIds = AITable.getActiveRecordIds(aiTable);\n\n selectedRecordIds.forEach((id: string) => {\n Actions.removeRecord(aiTable as AIViewTable, [id]);\n });\n\n aiTableGridSelectionService.clearSelection();\n }\n};\n\nexport const CopyCellsItem: AITableContextMenuItem = {\n type: 'copyCells',\n name: '复制',\n shortcutKey: isMac() ? `⌘ + C` : `Ctrl + C`,\n icon: 'copy',\n exec: (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService,\n notifyService: ThyNotifyService\n ) => {\n const clipboardData = buildClipboardData(aiTable);\n if (clipboardData) {\n writeToClipboard(clipboardData).then(() => {\n const copiedCellsCount = aiTable.selection().selectedCells.size;\n notifyService.success(`已复制 ${copiedCellsCount} 个单元格`, undefined, {\n placement: 'bottomLeft'\n });\n });\n }\n }\n};\n\nexport const PasteCellsItem: (actions: AITablePasteActions) => AITableContextMenuItem = (actions: AITablePasteActions) => {\n return {\n type: 'pasteCells',\n name: '粘贴',\n shortcutKey: isMac() ? `⌘ + V` : `Ctrl + V`,\n icon: 'paste',\n exec: async (\n aiTable: AITable,\n targetName: string,\n position: { x: number; y: number },\n aiTableGridSelectionService: AITableGridSelectionService,\n notifyService: ThyNotifyService\n ) => {\n writeToAITable(aiTable, actions).then((isPasteSuccess) => {\n if (!isPasteSuccess) {\n notifyService.error('粘贴内容不符合当前类型', undefined, {\n placement: 'bottomLeft'\n });\n }\n });\n }\n };\n};\n","import { ActionName } from \"../types\";\n\nexport const VIEW_ACTIONS = [ActionName.SetView, ActionName.AddView, ActionName.RemoveView];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["setRecordPositions","updateFieldValue","addView","removeView","Direction","_"],"mappings":";;;;;;;AAEA,MAAM,QAAQ,GAAiB,IAAI,OAAO,EAAE;AAC5C,MAAM,SAAS,GAAiB,IAAI,OAAO,EAAE;AAC7C,MAAM,OAAO,GAAiB,IAAI,OAAO,EAAE;AAO9B,MAAA,UAAU,GAAG;AACtB,IAAA,OAAO,EAAE,CAAC,OAAgB,KAAa;AACnC,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;KAC/B;AAED,IAAA,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAc,KAAU;QAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,OAA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AS,EAAE;AAC1C,wBAAA,SAAS,EAAE;AACd,qBAAA,CAAC;;AAEV,aAAC,CAAC;;KAET;AACL;;ACtEa,MAAA,YAAY,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU;;ACF1F;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-table/state",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "peerDependencies": {
5
5
  "@ai-table/grid": "^0.0.7"
6
6
  },
@@ -1 +1 @@
1
- {"version":3,"file":"move-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/move-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAoB,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5D,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,wBAAwB,QAGhH;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,UAyBlH"}
1
+ {"version":3,"file":"move-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/move-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAoB,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5D,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,wBAAwB,QAGhH;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,UA0BlH"}
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../packages/state/src/utils/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKxH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,WAAW,EAAE,EACpB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,EAC5C,KAAK,EAAE,MAAM,aAShB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAU5G;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,eAqClF;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,QAgB5H"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../packages/state/src/utils/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKxH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,WAAW,EAAE,EACpB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,EAC5C,KAAK,EAAE,MAAM,aAShB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAW5G;AAED,wBAAgB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