Skip to content

Commit

Permalink
fix(filter): fix event API export (#4422)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev authored Jan 3, 2025
1 parent 05896c0 commit 5738128
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
12 changes: 8 additions & 4 deletions packages/core/src/facade/f-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import { DataValidationType } from '../types/enum/data-validation-type';
import { FBase } from './f-base';

export class FEnum extends FBase {
static _intance: FEnum | null;
static _instance: FEnum | null;
static get() {
if (this._intance) {
return this._intance;
if (this._instance) {
return this._instance;
}

const instance = new FEnum();
this._intance = instance;
this._instance = instance;
return instance;
}

Expand Down Expand Up @@ -62,4 +62,8 @@ export class FEnum extends FBase {
get DataValidationStatus() {
return DataValidationStatus;
}

constructor() {
super();
}
}
24 changes: 16 additions & 8 deletions packages/sheets-filter/src/facade/f-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ export interface IFSheetFilterEventMixin {
* ```typescript
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFiltered, (params) => {
* const { workbook, worksheet, col, criteria } = params;
*
* // your custom logic
* });
* ```
*/
SheetRangeFiltered: 'SheetRangeFiltered';
readonly SheetRangeFiltered: 'SheetRangeFiltered';
/**
* This event will be emitted beftore the filter criteria on a column is changed.
* Type of the event is {@link ISheetRangeFilteredParams}.
Expand All @@ -42,10 +44,12 @@ export interface IFSheetFilterEventMixin {
* ```typescript
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeFilter, (params) => {
* const { workbook, worksheet, col, criteria } = params;
*
* // your custom logic
* });
* ```
*/
SheetBeforeRangeFilter: 'SheetBeforeRangeFilter';
readonly SheetBeforeRangeFilter: 'SheetBeforeRangeFilter';
/**
* This event will be emitted when the filter on a worksheet is cleared.
* Type of the event is {@link ISheetRangeFilterClearedEventParams}.
Expand All @@ -54,10 +58,12 @@ export interface IFSheetFilterEventMixin {
* ```typescript
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFilterCleared, (params) => {
* const { workbook, worksheet } = params;
*
* // your custom logic
* });
* ```
*/
SheetRangeFilterCleared: 'SheetRangeFilterCleared';
readonly SheetRangeFilterCleared: 'SheetRangeFilterCleared';
/**
* This event will be emitted after the filter on a worksheet is cleared.
* Type of the event is {@link ISheetRangeFilterClearedEventParams}.
Expand All @@ -66,17 +72,19 @@ export interface IFSheetFilterEventMixin {
* ```typescript
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeFilterClear, (params) => {
* const { workbook, worksheet } = params;
*
* // your custom logic
* });
* ```
*/
SheetBeforeRangeFilterClear: 'SheetBeforeRangeFilterClear';
readonly SheetBeforeRangeFilterClear: 'SheetBeforeRangeFilterClear';
}

export class FSheetFilterEventName extends FEventName implements IFSheetFilterEventMixin {
override readonly SheetRangeFiltered = 'SheetRangeFiltered' as const;
override readonly SheetBeforeRangeFilter = 'SheetBeforeRangeFilter' as const;
override readonly SheetRangeFilterCleared = 'SheetRangeFilterCleared' as const;
override readonly SheetBeforeRangeFilterClear = 'SheetBeforeRangeFilterClear' as const;
override get SheetBeforeRangeFilter(): 'SheetBeforeRangeFilter' { return 'SheetBeforeRangeFilter'; }
override get SheetRangeFiltered(): 'SheetRangeFiltered' { return 'SheetRangeFiltered'; }
override get SheetRangeFilterCleared(): 'SheetRangeFilterCleared' { return 'SheetRangeFilterCleared'; };
override get SheetBeforeRangeFilterClear(): 'SheetBeforeRangeFilterClear' { return 'SheetBeforeRangeFilterClear'; }
}

/**
Expand Down

0 comments on commit 5738128

Please sign in to comment.