mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
feat(editor): add grouping support for member property of the database block (#12243)
close: BS-3433 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced advanced group-by configurations for database blocks with user membership support. - Added a React hook for fetching and displaying user information in member-related components. - Enabled dynamic user and membership data types in database properties. - **Improvements** - Replaced context-based service access with a dependency injection system for shared services and state. - Enhanced type safety and consistency across group-by UI components and data handling. - Centralized group data management with a new Group class and refined group trait logic. - **Bug Fixes** - Improved reliability and consistency in retrieving and rendering user and group information. - **Style** - Removed obsolete member selection styles for cleaner UI code. - **Chores** - Registered external group-by configurations via dependency injection. - Refactored internal APIs for data sources, views, and group-by matchers to use service-based patterns. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -11,7 +11,10 @@ import { filterTraitKey } from '../../../../core/filter/trait.js';
|
||||
import type { FilterGroup } from '../../../../core/filter/types.js';
|
||||
import { emptyFilterGroup } from '../../../../core/filter/utils.js';
|
||||
import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
||||
import { ShowQuickSettingBarContextKey } from '../../../quick-setting-bar/context.js';
|
||||
import {
|
||||
createDefaultShowQuickSettingBar,
|
||||
ShowQuickSettingBarKey,
|
||||
} from '../../../quick-setting-bar/context.js';
|
||||
|
||||
const styles = css`
|
||||
.affine-database-filter-button {
|
||||
@@ -100,7 +103,10 @@ export class DataViewHeaderToolsFilter extends WidgetBase {
|
||||
}
|
||||
|
||||
toggleShowFilter(show?: boolean) {
|
||||
const map = this.view.contextGet(ShowQuickSettingBarContextKey);
|
||||
const map = this.view.serviceGetOrCreate(
|
||||
ShowQuickSettingBarKey,
|
||||
createDefaultShowQuickSettingBar
|
||||
);
|
||||
map.value = {
|
||||
...map.value,
|
||||
[this.view.id]: show ?? !map.value[this.view.id],
|
||||
|
||||
@@ -10,7 +10,10 @@ import { popCreateSort } from '../../../../core/sort/add-sort.js';
|
||||
import { sortTraitKey } from '../../../../core/sort/manager.js';
|
||||
import { createSortUtils } from '../../../../core/sort/utils.js';
|
||||
import { WidgetBase } from '../../../../core/widget/widget-base.js';
|
||||
import { ShowQuickSettingBarContextKey } from '../../../quick-setting-bar/context.js';
|
||||
import {
|
||||
createDefaultShowQuickSettingBar,
|
||||
ShowQuickSettingBarKey,
|
||||
} from '../../../quick-setting-bar/context.js';
|
||||
import { popSortRoot } from '../../../quick-setting-bar/sort/root-panel.js';
|
||||
|
||||
const styles = css`
|
||||
@@ -106,7 +109,10 @@ export class DataViewHeaderToolsSort extends WidgetBase {
|
||||
}
|
||||
|
||||
toggleShowQuickSettingBar(show?: boolean) {
|
||||
const map = this.view.contextGet(ShowQuickSettingBarContextKey);
|
||||
const map = this.view.serviceGetOrCreate(
|
||||
ShowQuickSettingBarKey,
|
||||
createDefaultShowQuickSettingBar
|
||||
);
|
||||
map.value = {
|
||||
...map.value,
|
||||
[this.view.id]: show ?? !map.value[this.view.id],
|
||||
|
||||
Reference in New Issue
Block a user