mirror of
https://github.com/dream-num/univer.git
synced 2026-09-01 04:45:14 +08:00
docs: update naming convention
This commit is contained in:
@@ -118,6 +118,7 @@ Commands' names should follow the convention below:
|
||||
export interface ISomeCommandParams {
|
||||
// Define the parameters here
|
||||
}
|
||||
|
||||
export const SomeCommand = ICommand<ISomeCommandParams> = {
|
||||
id: '<business-type>.<command-type>.<command-name>',
|
||||
};
|
||||
@@ -128,12 +129,25 @@ For example:
|
||||
```typescript
|
||||
// ✅
|
||||
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
|
||||
id: 'sheet.command.set-selection-frozen',
|
||||
id: 'sheet.command.set-selection-frozen', // note this should be in single format
|
||||
}
|
||||
|
||||
// 🚫
|
||||
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
|
||||
id: 'SetSelectionFrozenCommmand',
|
||||
id: 'sheets.command.set-selection-frozen',
|
||||
}
|
||||
|
||||
// 🚫
|
||||
export const SetSelectionFrozenCommand: ICommand<ISetSelectionFrozenCommandParams> = {
|
||||
id: 'SetSelectionFrozenCommand',
|
||||
}
|
||||
```
|
||||
|
||||
If this command is for general purpose, the `business-type` should be the plugin's name. For example:
|
||||
|
||||
```typescript
|
||||
export const ResolveCommentCommand: ICommand<IResolveCommentCommandParams> = {
|
||||
id: 'thread-comment.command.resolve-comment',
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export function getDataValidationDiffMutations(unitId: string, subUnitId: string
|
||||
|
||||
export const UpdateSheetDataValidationRangeCommand: ICommand<IUpdateSheetDataValidationRangeCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'sheets.command.updateDataValidationRuleRange',
|
||||
id: 'sheet.command.updateDataValidationRuleRange',
|
||||
async handler(accessor, params) {
|
||||
if (!params) {
|
||||
return false;
|
||||
@@ -154,7 +154,7 @@ export interface IAddSheetDataValidationCommandParams {
|
||||
|
||||
export const AddSheetDataValidationCommand: ICommand<IAddSheetDataValidationCommandParams> = {
|
||||
type: CommandType.COMMAND,
|
||||
id: 'sheets.command.addDataValidation',
|
||||
id: 'sheet.command.addDataValidation',
|
||||
async handler(accessor, params) {
|
||||
if (!params) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user