mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 08:17:10 +08:00
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 -->
49 lines
1.0 KiB
TypeScript
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,
|
|
});
|