Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into fix/edit-other-sheet-r…
Browse files Browse the repository at this point in the history
…ef-range
  • Loading branch information
weird94 committed Feb 19, 2025
2 parents e2cd7ec + 4b38dc6 commit 891213e
Show file tree
Hide file tree
Showing 19 changed files with 1,716 additions and 804 deletions.
45 changes: 36 additions & 9 deletions packages/core/src/facade/f-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ export class FEventName {
* @see {@link IDocCreatedParam}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => {
* const { unitId, type, doc, unit } = params;
* console.log('doc created', params);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get DocCreated() {
Expand All @@ -148,10 +150,12 @@ export class FEventName {
* @see {@link IDocDisposedEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => {
* const { unitId, unitType, snapshot } = params;
* console.log('doc disposed', params);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get DocDisposed() {
Expand All @@ -163,10 +167,12 @@ export class FEventName {
* @see {@link ILifeCycleChangedEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
* const { stage } = params;
* console.log('life cycle changed', params);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get LifeCycleChanged() {
Expand All @@ -178,10 +184,12 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.Redo, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.Redo, (event) => {
* const { params, id, type } = event;
* console.log('redo command executed', event);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get Redo() {
Expand All @@ -193,10 +201,12 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.Undo, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.Undo, (event) => {
* const { params, id, type } = event;
* console.log('undo command executed', event);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get Undo() {
Expand All @@ -208,10 +218,15 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {
* const { params, id, type } = event;
* console.log('before redo command executed', event);
*
* // Cancel the redo operation
* event.cancel = true;
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get BeforeRedo() {
Expand All @@ -223,10 +238,15 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {
* const { params, id, type } = event;
* console.log('before undo command executed', event);
*
* // Cancel the undo operation
* event.cancel = true;
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get BeforeUndo() {
Expand All @@ -238,10 +258,12 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
* const { params, id, type } = event;
* console.log('command executed', event);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get CommandExecuted() {
Expand All @@ -253,10 +275,15 @@ export class FEventName {
* @see {@link ICommandEvent}
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {
* const { params, id, type } = event;
* console.log('before command executed', event);
*
* // Cancel the command execution
* event.cancel = true;
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
get BeforeCommandExecute() {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ export class FUniver extends Disposable {
* @returns {Disposable} The Disposable instance, for remove the listener
* @example
* ```ts
* univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
* // Add life cycle changed event listener
* const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
* const { stage } = params;
* console.log('life cycle changed', params);
* });
*
* // Remove the event listener, use `disposable.dispose()`
* ```
*/
addEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): IDisposable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Disposable,
DrawingTypeEnum,
ICommandService,
ImageSourceType,
Inject,
IUniverInstanceService,
toDisposable,
Expand Down Expand Up @@ -229,9 +230,9 @@ export class ImageUpdateController extends Disposable {

imageShape.setSrcRect(srcRect);
imageShape.setPrstGeom(prstGeom);
// if (source != null && source.length > 0 && (imageSourceType === ImageSourceType.BASE64 || imageSourceType === ImageSourceType.URL)) {
// imageShape.changeSource(source);
// }
if (source != null && source.length > 0 && (imageSourceType === ImageSourceType.BASE64 || imageSourceType === ImageSourceType.URL)) {
imageShape.changeSource(source);
}
});
})
);
Expand Down
50 changes: 29 additions & 21 deletions packages/sheets-conditional-formatting/src/facade/f-range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,48 @@ import { FConditionalFormattingBuilder } from './conditional-formatting-builder'
* @ignore
*/
export interface IFRangeConditionalFormattingMixin {

/**
* Gets all the conditional formatting for the current range
* @returns {*} {IConditionFormattingRule[]}
* @memberof IFWorksheetConditionalFormattingMixin
* @returns {IConditionFormattingRule[]} conditional formatting rules for the current range
* @example
* ```ts
* const workbook = univerAPI.getActiveWorkbook();
* const worksheet = workbook?.getActiveSheet();
* workbook?.setActiveRange(worksheet?.getRange(5, 5, 3, 3)!);
* const rules = univerAPI.getActiveWorkbook()?.getActiveRange()?.getConditionalFormattingRules();
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const fRange = fWorksheet.getRange('A1:T100');
* const rule = fWorksheet.newConditionalFormattingRule()
* .whenCellNotEmpty()
* .setRanges([fRange.getRange()])
* .setItalic(true)
* .setBackground('red')
* .setFontColor('green')
* .build();
* fWorksheet.addConditionalFormattingRule(rule);
*
* const targetRange = fWorksheet.getRange('F6:H8');
* const rules = targetRange.getConditionalFormattingRules();
* console.log(rules);
* ```
*/
getConditionalFormattingRules(): IConditionFormattingRule[];

/**
* Creates a constructor for conditional formatting
* @returns {*} {ConditionalFormatRuleBuilder}
* @memberof IFWorksheetConditionalFormattingMixin
* @returns {FConditionalFormattingBuilder} The conditional formatting builder
* @example
* ```ts
* const workbook = univerAPI.getActiveWorkbook();
* const worksheet = workbook?.getActiveSheet();
* const rule = worksheet?.createConditionalFormattingRule()
* .whenCellNotEmpty()
* .setRanges([{ startRow: 0, endRow: 100, startColumn: 0, endColumn: 100 }])
* .setItalic(true)
* .setItalic(true)
* .setBackground('red')
* .setFontColor('green')
* .build();
* worksheet?.addConditionalFormattingRule(rule!);
* const fWorkbook = univerAPI.getActiveWorkbook();
* const fWorksheet = fWorkbook.getActiveSheet();
* const fRange = fWorksheet.getRange('A1:T100');
* const rule = fRange.createConditionalFormattingRule()
* .whenCellNotEmpty()
* .setItalic(true)
* .setBackground('red')
* .setFontColor('green')
* .build();
* fWorksheet.addConditionalFormattingRule(rule);
* console.log(fRange.getConditionalFormattingRules());
* ```
*/

createConditionalFormattingRule(): FConditionalFormattingBuilder;

/**
Expand Down
Loading

0 comments on commit 891213e

Please sign in to comment.