mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-21 20:11:43 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { t } from '../../core/logical/type-presets.js';
|
||||
import { propertyType } from '../../core/property/property-config.js';
|
||||
|
||||
export const progressPropertyType = propertyType('progress');
|
||||
|
||||
export const progressPropertyModelConfig =
|
||||
progressPropertyType.modelConfig<number>({
|
||||
name: 'Progress',
|
||||
type: () => t.number.instance(),
|
||||
defaultData: () => ({}),
|
||||
cellToString: ({ value }) => value?.toString() ?? '',
|
||||
cellFromString: ({ value }) => {
|
||||
const num = value ? Number(value) : NaN;
|
||||
return {
|
||||
value: isNaN(num) ? null : num,
|
||||
};
|
||||
},
|
||||
cellToJson: ({ value }) => value ?? null,
|
||||
cellFromJson: ({ value }) => {
|
||||
if (typeof value !== 'number') return undefined;
|
||||
return value;
|
||||
},
|
||||
isEmpty: () => false,
|
||||
});
|
||||
Reference in New Issue
Block a user