@univerjs/sheets-conditional-formatting 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/index.js +1 -11
  3. package/lib/es/index.js +1380 -8697
  4. package/lib/types/commands/mutations/move-conditional-rule.mutation.d.ts +4 -4
  5. package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +1 -0
  6. package/lib/types/index.d.ts +22 -1
  7. package/lib/types/models/conditional-formatting-rule-model.d.ts +4 -3
  8. package/lib/types/models/type.d.ts +1 -0
  9. package/lib/types/plugin.d.ts +3 -3
  10. package/lib/types/render/type.d.ts +1 -0
  11. package/lib/types/services/conditional-formatting.service.d.ts +3 -1
  12. package/lib/types/{locale/index.d.ts → utils/__test__/anchor.spec.d.ts} +1 -2
  13. package/lib/types/utils/anchor.d.ts +34 -0
  14. package/lib/types/utils/create-cf-id.d.ts +16 -0
  15. package/lib/umd/index.js +1 -11
  16. package/package.json +14 -38
  17. package/lib/index.css +0 -1
  18. package/lib/types/commands/commands/add-average-cf.command.d.ts +0 -11
  19. package/lib/types/commands/commands/add-cf.command.d.ts +0 -10
  20. package/lib/types/commands/commands/add-color-scale-cf.command.d.ts +0 -10
  21. package/lib/types/commands/commands/add-data-bar-cf.command.d.ts +0 -14
  22. package/lib/types/commands/commands/add-duplicate-values-cf.command.d.ts +0 -10
  23. package/lib/types/commands/commands/add-number-cf.command.d.ts +0 -12
  24. package/lib/types/commands/commands/add-rank-cf.command.d.ts +0 -13
  25. package/lib/types/commands/commands/add-text-cf.command.d.ts +0 -12
  26. package/lib/types/commands/commands/add-time-period-cf.command.d.ts +0 -11
  27. package/lib/types/commands/commands/add-unique-values-cf.command.d.ts +0 -10
  28. package/lib/types/commands/commands/clear-range-cf.command.d.ts +0 -8
  29. package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +0 -7
  30. package/lib/types/commands/commands/delete-cf.command.d.ts +0 -8
  31. package/lib/types/commands/commands/move-cf.command.d.ts +0 -9
  32. package/lib/types/commands/commands/set-cf.command.d.ts +0 -9
  33. package/lib/types/commands/operations/open-conditional-formatting-panel.d.ts +0 -15
  34. package/lib/types/components/color-picker/index.d.ts +0 -12
  35. package/lib/types/components/conditional-style-editor/index.d.ts +0 -10
  36. package/lib/types/components/panel/index.d.ts +0 -8
  37. package/lib/types/components/panel/rule-edit/colorScale.d.ts +0 -4
  38. package/lib/types/components/panel/rule-edit/dataBar.d.ts +0 -4
  39. package/lib/types/components/panel/rule-edit/formula.d.ts +0 -4
  40. package/lib/types/components/panel/rule-edit/highlightCell.d.ts +0 -5
  41. package/lib/types/components/panel/rule-edit/iconSet.d.ts +0 -5
  42. package/lib/types/components/panel/rule-edit/index.d.ts +0 -9
  43. package/lib/types/components/panel/rule-edit/rank.d.ts +0 -4
  44. package/lib/types/components/panel/rule-edit/type.d.ts +0 -13
  45. package/lib/types/components/panel/rule-list/index.d.ts +0 -9
  46. package/lib/types/components/preview/index.d.ts +0 -6
  47. package/lib/types/controllers/cf.auto-fill.controller.d.ts +0 -15
  48. package/lib/types/controllers/cf.clear.controller.d.ts +0 -14
  49. package/lib/types/controllers/cf.copy-paste.controller.d.ts +0 -18
  50. package/lib/types/controllers/cf.editor.controller.d.ts +0 -15
  51. package/lib/types/controllers/cf.i18n.controller.d.ts +0 -10
  52. package/lib/types/controllers/cf.menu.controller.d.ts +0 -16
  53. package/lib/types/controllers/cf.ref-range.controller.d.ts +0 -15
  54. package/lib/types/controllers/cf.render.controller.d.ts +0 -21
  55. package/lib/types/locale/en-US.d.ts +0 -4
  56. package/lib/types/locale/zh-CN.d.ts +0 -169
  57. package/lib/types/menu/manage-rule.d.ts +0 -4
  58. /package/lib/types/utils/{getStringFromDataStream.d.ts → get-string-from-data-stream.d.ts} +0 -0
  59. /package/lib/types/utils/{isRangesEqual.d.ts → is-ranges-equal.d.ts} +0 -0
  60. /package/lib/types/utils/{removeUndefinedAttr.d.ts → remove-undefined-attr.d.ts} +0 -0
@@ -1,14 +1,14 @@
1
- import { IAccessor } from '@wendellhu/redi';
1
+ import { IAnchor } from '../../utils/anchor';
2
2
  import { IMutation } from '@univerjs/core';
3
3
 
4
4
  export interface IMoveConditionalRuleMutationParams {
5
5
  unitId: string;
6
6
  subUnitId: string;
7
- cfId: string;
8
- targetCfId: string;
7
+ start: IAnchor;
8
+ end: IAnchor;
9
9
  }
10
10
  export declare const MoveConditionalRuleMutation: IMutation<IMoveConditionalRuleMutationParams>;
11
- export declare const MoveConditionalRuleMutationUndoFactory: (accessor: IAccessor, param: IMoveConditionalRuleMutationParams) => {
11
+ export declare const MoveConditionalRuleMutationUndoFactory: (param: IMoveConditionalRuleMutationParams) => {
12
12
  id: string;
13
13
  params: IMoveConditionalRuleMutationParams;
14
14
  }[];
@@ -5,6 +5,7 @@ import { IMutation } from '@univerjs/core';
5
5
  export interface ISetConditionalRuleMutationParams {
6
6
  unitId: string;
7
7
  subUnitId: string;
8
+ cfId?: string;
8
9
  rule: IConditionFormattingRule;
9
10
  }
10
11
  export declare const SetConditionalRuleMutation: IMutation<ISetConditionalRuleMutationParams>;
@@ -14,4 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { SheetsConditionalFormattingPlugin } from './plugin';
17
- export { enUS, zhCN } from './locale';
17
+ export * from './base/const';
18
+ export * from './commands/mutations/add-conditional-rule.mutation';
19
+ export * from './commands/mutations/delete-conditional-rule.mutation';
20
+ export * from './commands/mutations/move-conditional-rule.mutation';
21
+ export * from './commands/mutations/set-conditional-rule.mutation';
22
+ export * from './models/type';
23
+ export * from './models/conditional-formatting-rule-model';
24
+ export * from './models/conditional-formatting-view-model';
25
+ export * from './utils/get-string-from-data-stream';
26
+ export * from './utils/is-ranges-equal';
27
+ export * from './utils/remove-undefined-attr';
28
+ export * from './utils/type';
29
+ export * from './services/conditional-formatting.service';
30
+ export * from './services/calculate-unit/utils';
31
+ export * from './services/calculate-unit/type';
32
+ export * from './render/data-bar.render';
33
+ export * from './render/icon.render';
34
+ export * from './render/type';
35
+ export * from './models/icon-map';
36
+ export * from './services/conditional-formatting-formula.service';
37
+ export * from './utils/anchor';
38
+ export * from './utils/create-cf-id';
@@ -1,5 +1,6 @@
1
1
  import { ConditionalFormattingViewModel } from './conditional-formatting-view-model';
2
2
  import { IConditionFormattingRule } from './type';
3
+ import { IAnchor } from '../utils/anchor';
3
4
  import { Injector } from '@wendellhu/redi';
4
5
 
5
6
  type RuleOperatorType = 'delete' | 'set' | 'add' | 'sort';
@@ -20,13 +21,13 @@ export declare class ConditionalFormattingRuleModel {
20
21
  getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig>[]> | null;
21
22
  getSubunitRules(unitId: string, subUnitId: string): IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig>[] | null;
22
23
  deleteRule(unitId: string, subUnitId: string, cfId: string): void;
23
- setRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule): void;
24
+ setRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule, oldCfId: string): void;
24
25
  addRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule): void;
25
26
  /**
26
27
  * example [1,2,3,4,5,6],if you move behind 5 to 2, then cfId=5,targetId=2.
27
28
  * if targetId does not exist, it defaults to top
28
29
  */
29
- moveRulePriority(unitId: string, subUnitId: string, cfId: string, targetCfId: string): void;
30
- createCfId(unitId: string, subUnitId: string): string;
30
+ moveRulePriority(unitId: string, subUnitId: string, start: IAnchor, end: IAnchor): void;
31
+ createCfId(_unitId: string, _subUnitId: string): string;
31
32
  }
32
33
  export {};
@@ -54,6 +54,7 @@ export interface IAverageHighlightCell extends IHighlightCell {
54
54
  }
55
55
  export interface IDataBar extends IBaseCfRule {
56
56
  type: CFRuleType.dataBar;
57
+ isShowValue: boolean;
57
58
  config: {
58
59
  min: IValueConfig;
59
60
  max: IValueConfig;
@@ -1,12 +1,12 @@
1
- import { Injector } from '@wendellhu/redi';
1
+ import { Dependency, Injector } from '@wendellhu/redi';
2
2
  import { ICommandService, Plugin, PluginType } from '@univerjs/core';
3
3
 
4
4
  export declare class SheetsConditionalFormattingPlugin extends Plugin {
5
5
  readonly _injector: Injector;
6
6
  private _commandService;
7
7
  static type: PluginType;
8
- static commandList: import('@univerjs/core').ICommand<object, boolean>[];
9
- static mutationList: (import('@univerjs/core').IMutation<import("./commands/mutations/add-conditional-rule.mutation").IAddConditionalRuleMutationParams, boolean> | import('@univerjs/core').IMutation<import("./commands/mutations/delete-conditional-rule.mutation").IDeleteConditionalRuleMutationParams, boolean> | import('@univerjs/core').IMutation<import("./commands/mutations/formula-mark-dirty.mutation").IConditionalFormattingFormulaMarkDirtyParams, boolean>)[];
8
+ static readonly dependencyList: Dependency[];
9
+ static readonly mutationList: (import('@univerjs/core').IMutation<import("./commands/mutations/add-conditional-rule.mutation").IAddConditionalRuleMutationParams, boolean> | import('@univerjs/core').IMutation<import("./commands/mutations/delete-conditional-rule.mutation").IDeleteConditionalRuleMutationParams, boolean> | import('@univerjs/core').IMutation<import("./commands/mutations/move-conditional-rule.mutation").IMoveConditionalRuleMutationParams, boolean> | import('@univerjs/core').IMutation<import("./commands/mutations/formula-mark-dirty.mutation").IConditionalFormattingFormulaMarkDirtyParams, boolean>)[];
10
10
  constructor(_config: unknown, _injector: Injector, _commandService: ICommandService);
11
11
  onStarting(): void;
12
12
  _initCommand(): void;
@@ -6,6 +6,7 @@ export interface IDataBarRenderParams {
6
6
  value: number;
7
7
  startPoint: number;
8
8
  isGradient: boolean;
9
+ isShowValue: boolean;
9
10
  }
10
11
  export interface IDataBarCellData extends ICellData {
11
12
  dataBar?: IDataBarRenderParams;
@@ -34,7 +34,9 @@ export declare class ConditionalFormattingService extends Disposable {
34
34
  constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _injector: Injector, _conditionalFormattingViewModel: ConditionalFormattingViewModel, _univerInstanceService: IUniverInstanceService, _resourceManagerService: IResourceManagerService, _sheetInterceptorService: SheetInterceptorService, _commandService: ICommandService);
35
35
  composeStyle(unitId: string, subUnitId: string, row: number, col: number): ({
36
36
  style?: import('@univerjs/core').IStyleBase | undefined;
37
- } & IDataBarCellData & IIconSetCellData) | null;
37
+ } & IDataBarCellData & IIconSetCellData & {
38
+ isShowValue: boolean;
39
+ }) | null;
38
40
  private _initSnapshot;
39
41
  private _initSheetChange;
40
42
  private _registerCalculationUnit;
@@ -13,5 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { default as enUS } from './en-US';
17
- export { default as zhCN } from './zh-CN';
16
+ export {};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface IAnchor {
17
+ id: string;
18
+ type: 'before' | 'after' | 'self';
19
+ }
20
+ export declare const findIndexByAnchor: <T = unknown[]>(anchor: IAnchor, ruleList: T[], get: (v: T) => string) => number | null;
21
+ /**
22
+ * This function has side effects that modify the ruleList
23
+ * @param {IAnchor} start
24
+ * @param {IAnchor} end
25
+ * @param {ReturnType<ConditionalFormattingRuleModel['getSubunitRules']>} ruleList
26
+ * @return {*}
27
+ */
28
+ export declare const moveByAnchor: <T = unknown[]>(start: IAnchor, end: IAnchor, ruleList: T[], get: (v: T) => string) => null | undefined;
29
+ /**
30
+ * Only [after,after] and [after,before] can support symmetric operations
31
+ */
32
+ export declare const transformSupportSymmetryAnchor: <T = unknown[]>(start: IAnchor, end: IAnchor, ruleList: T[], get: (v: T) => string) => [IAnchor, IAnchor] | null;
33
+ export declare const anchorUndoFactory: (start: IAnchor, end: IAnchor) => [IAnchor, IAnchor] | null;
34
+ export declare const isAnchorEqual: (anchor1: IAnchor, anchor2: IAnchor) => boolean;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const createCfId: () => string;