mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
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 -->
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
|
|
import { ShadowlessElement } from '@blocksuite/std';
|
|
import { css, html } from 'lit';
|
|
import { property } from 'lit/decorators.js';
|
|
import { repeat } from 'lit/directives/repeat.js';
|
|
|
|
import type { Group } from '../../../core/group-by/trait.js';
|
|
import { LEFT_TOOL_BAR_WIDTH, STATS_BAR_HEIGHT } from '../consts.js';
|
|
import type { TableSingleView } from '../table-view-manager.js';
|
|
|
|
const styles = css`
|
|
affine-database-column-stats {
|
|
margin-left: ${LEFT_TOOL_BAR_WIDTH}px;
|
|
height: ${STATS_BAR_HEIGHT}px;
|
|
display: flex;
|
|
}
|
|
`;
|
|
|
|
export class DataBaseColumnStats extends SignalWatcher(
|
|
WithDisposable(ShadowlessElement)
|
|
) {
|
|
static override styles = styles;
|
|
|
|
protected override render() {
|
|
const cols = this.view.properties$.value;
|
|
return html`
|
|
${repeat(
|
|
cols,
|
|
col => col.id,
|
|
col => {
|
|
return html`<affine-database-column-stats-cell
|
|
.column=${col}
|
|
.group=${this.group}
|
|
></affine-database-column-stats-cell>`;
|
|
}
|
|
)}
|
|
`;
|
|
}
|
|
|
|
@property({ attribute: false })
|
|
accessor group: Group | undefined = undefined;
|
|
|
|
@property({ attribute: false })
|
|
accessor view!: TableSingleView;
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
'affine-database-column-stats': DataBaseColumnStats;
|
|
}
|
|
}
|