Files
AFFiNE-Mirror/blocksuite/affine/data-view/src/property-presets/checkbox/define.ts
DarkSky 8192a492d9 feat: improve kanban grouping & data materialization (#14393)
fix #13512 
fix #13255
fix #9743 

#### PR Dependency Tree


* **PR #14393** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Enhanced Kanban view grouping support for additional property types:
checkboxes, select fields, multi-select fields, members, and created-by
information.
* Improved drag-and-drop visual feedback with more precise drop
indicators in Kanban views.

* **Bug Fixes**
* Refined grouping logic to ensure only compatible properties appear in
group-by options.
* Enhanced column visibility and ordering consistency when managing
Kanban views.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-08 03:48:12 +08:00

49 lines
1.0 KiB
TypeScript

import zod from 'zod';
import { t } from '../../core/logical/type-presets.js';
import { propertyType } from '../../core/property/property-config.js';
export const checkboxPropertyType = propertyType('checkbox');
const FALSE_VALUES = new Set([
'false',
'no',
'0',
'',
'undefined',
'null',
'否',
'不',
'错',
'错误',
'取消',
'关闭',
]);
export const checkboxPropertyModelConfig = checkboxPropertyType.modelConfig({
name: 'Checkbox',
kanbanGroup: {
enabled: true,
mutable: true,
},
propertyData: {
schema: zod.object({}),
default: () => ({}),
},
jsonValue: {
schema: zod.boolean(),
isEmpty: () => false,
type: () => t.boolean.instance(),
},
rawValue: {
schema: zod.boolean(),
default: () => false,
fromString: ({ value }) => ({
value: !FALSE_VALUES.has((value?.trim() ?? '').toLowerCase()),
}),
toString: ({ value }) => (value ? 'True' : 'False'),
toJson: ({ value }) => value,
fromJson: ({ value }) => value,
},
minWidth: 34,
});