Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(core): define Base attachment value type (#7317)

Univer1c2f4a3ba1a1
diff --git a/packages/core/src/bases/index.ts b/packages/core/src/bases/index.ts
index 4fad5afd77..d5ab72fb82 100644
--- a/packages/core/src/bases/index.ts
+++ b/packages/core/src/bases/index.ts
@@ -35,6 +35,7 @@ export type {
FieldConfig,
FieldId,
FieldSnapshot,
+ IBaseAttachment,
IBaseCellData,
IBaseInvalidation,
IBaseRect,
diff --git a/packages/core/src/bases/typedef.ts b/packages/core/src/bases/typedef.ts
index f4506b3876..8fd3450358 100644
--- a/packages/core/src/bases/typedef.ts
+++ b/packages/core/src/bases/typedef.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { ImageSourceType } from '../services/image-io/image-io.service';
import type { CellValueType, LocaleType } from '../types/enum';
import type { IDocumentData } from '../types/interfaces';
@@ -51,6 +52,27 @@ export interface IBaseResources {
attachments?: Record<string, Record<string, unknown>>;
}
+export interface IBaseAttachment {
+ /** Stable attachment identifier. Use the uploaded file id for remote attachments. */
+ id: string;
+ /** Display name, including the file extension when available. */
+ name: string;
+ /** MIME type used to classify and preview the attachment. */
+ mimeType?: string;
+ /** File size in bytes. */
+ size?: number;
+ /** Image width in pixels when known. */
+ width?: number;
+ /** Image height in pixels when known. */
+ height?: number;
+ /** How to interpret `source`, for example UUID, URL, or Base64 data. */
+ sourceType?: ImageSourceType;
+ /** Canonical attachment source: an uploaded file id, URL, or Base64 data URL. */
+ source?: string;
+ /** Optional preview source when it is distinct from the canonical attachment source. */
+ thumbnail?: string;
+}
+
export enum BaseFieldType {
Text = 'text',
SingleSelect = 'singleSelect',