@univerjs/sheets-sort 0.17.0 → 0.18.0

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 (77) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -102
  16. package/lib/es/index.js +1 -252
  17. package/lib/es/locale/ca-ES.js +1 -18
  18. package/lib/es/locale/en-US.js +1 -18
  19. package/lib/es/locale/es-ES.js +1 -18
  20. package/lib/es/locale/fa-IR.js +1 -18
  21. package/lib/es/locale/fr-FR.js +1 -18
  22. package/lib/es/locale/ja-JP.js +1 -18
  23. package/lib/es/locale/ko-KR.js +1 -18
  24. package/lib/es/locale/ru-RU.js +1 -18
  25. package/lib/es/locale/sk-SK.js +1 -18
  26. package/lib/es/locale/vi-VN.js +1 -18
  27. package/lib/es/locale/zh-CN.js +1 -18
  28. package/lib/es/locale/zh-TW.js +1 -18
  29. package/lib/facade.js +1 -102
  30. package/lib/index.js +1 -252
  31. package/lib/locale/ca-ES.js +1 -18
  32. package/lib/locale/en-US.js +1 -18
  33. package/lib/locale/es-ES.js +1 -18
  34. package/lib/locale/fa-IR.js +1 -18
  35. package/lib/locale/fr-FR.js +1 -18
  36. package/lib/locale/ja-JP.js +1 -18
  37. package/lib/locale/ko-KR.js +1 -18
  38. package/lib/locale/ru-RU.js +1 -18
  39. package/lib/locale/sk-SK.js +1 -18
  40. package/lib/locale/vi-VN.js +1 -18
  41. package/lib/locale/zh-CN.js +1 -18
  42. package/lib/locale/zh-TW.js +1 -18
  43. package/lib/types/commands/commands/sheets-sort.command.d.ts +18 -3
  44. package/lib/types/controllers/sheets-sort.controller.d.ts +15 -0
  45. package/lib/types/controllers/utils.d.ts +17 -2
  46. package/lib/types/facade/f-event.d.ts +17 -2
  47. package/lib/types/facade/f-range.d.ts +15 -0
  48. package/lib/types/facade/f-worksheet.d.ts +15 -0
  49. package/lib/types/locale/ca-ES.d.ts +16 -1
  50. package/lib/types/locale/es-ES.d.ts +16 -1
  51. package/lib/types/locale/fa-IR.d.ts +16 -1
  52. package/lib/types/locale/fr-FR.d.ts +16 -1
  53. package/lib/types/locale/ja-JP.d.ts +16 -1
  54. package/lib/types/locale/ko-KR.d.ts +16 -1
  55. package/lib/types/locale/ru-RU.d.ts +16 -1
  56. package/lib/types/locale/sk-SK.d.ts +16 -1
  57. package/lib/types/locale/vi-VN.d.ts +16 -1
  58. package/lib/types/locale/zh-CN.d.ts +16 -1
  59. package/lib/types/locale/zh-TW.d.ts +16 -1
  60. package/lib/types/plugin.d.ts +16 -1
  61. package/lib/types/services/interface.d.ts +16 -1
  62. package/lib/types/services/sheets-sort.service.d.ts +18 -3
  63. package/lib/umd/facade.js +1 -1
  64. package/lib/umd/index.js +1 -1
  65. package/lib/umd/locale/ca-ES.js +1 -1
  66. package/lib/umd/locale/en-US.js +1 -1
  67. package/lib/umd/locale/es-ES.js +1 -1
  68. package/lib/umd/locale/fa-IR.js +1 -1
  69. package/lib/umd/locale/fr-FR.js +1 -1
  70. package/lib/umd/locale/ja-JP.js +1 -1
  71. package/lib/umd/locale/ko-KR.js +1 -1
  72. package/lib/umd/locale/ru-RU.js +1 -1
  73. package/lib/umd/locale/sk-SK.js +1 -1
  74. package/lib/umd/locale/vi-VN.js +1 -1
  75. package/lib/umd/locale/zh-CN.js +1 -1
  76. package/lib/umd/locale/zh-TW.js +1 -1
  77. package/package.json +9 -8
@@ -1,18 +1 @@
1
- const t = {
2
- sheetsSort: {
3
- title: "Sort",
4
- toolbar: {
5
- "sort-asc": "по возрастанию",
6
- "sort-desc": "по убыванию",
7
- "sort-custom": "пользовательский выбор"
8
- },
9
- "context-menu": {
10
- "sort-asc": "по возрастанию",
11
- "sort-desc": "по убыванию",
12
- "sort-custom": "пользовательский выбор"
13
- }
14
- }
15
- };
16
- export {
17
- t as default
18
- };
1
+ const e={sheetsSort:{title:`Sort`,toolbar:{"sort-asc":`по возрастанию`,"sort-desc":`по убыванию`,"sort-custom":`пользовательский выбор`},"context-menu":{"sort-asc":`по возрастанию`,"sort-desc":`по убыванию`,"sort-custom":`пользовательский выбор`}}};export{e as default};
@@ -1,18 +1 @@
1
- const o = {
2
- sheetsSort: {
3
- title: "Triedenie",
4
- toolbar: {
5
- "sort-asc": "vzostupné poradie",
6
- "sort-desc": "zostupné poradie",
7
- "sort-custom": "vlastné poradie"
8
- },
9
- "context-menu": {
10
- "sort-asc": "vzostupné poradie",
11
- "sort-desc": "zostupné poradie",
12
- "sort-custom": "vlastné poradie"
13
- }
14
- }
15
- };
16
- export {
17
- o as default
18
- };
1
+ const e={sheetsSort:{title:`Triedenie`,toolbar:{"sort-asc":`vzostupné poradie`,"sort-desc":`zostupné poradie`,"sort-custom":`vlastné poradie`},"context-menu":{"sort-asc":`vzostupné poradie`,"sort-desc":`zostupné poradie`,"sort-custom":`vlastné poradie`}}};export{e as default};
@@ -1,18 +1 @@
1
- const o = {
2
- sheetsSort: {
3
- title: "Sort",
4
- toolbar: {
5
- "sort-asc": "ascending order",
6
- "sort-desc": "descending order",
7
- "sort-custom": "custom order"
8
- },
9
- "context-menu": {
10
- "sort-asc": "ascending order",
11
- "sort-desc": "descending order",
12
- "sort-custom": "custom order"
13
- }
14
- }
15
- };
16
- export {
17
- o as default
18
- };
1
+ const e={sheetsSort:{title:`Sort`,toolbar:{"sort-asc":`ascending order`,"sort-desc":`descending order`,"sort-custom":`custom order`},"context-menu":{"sort-asc":`ascending order`,"sort-desc":`descending order`,"sort-custom":`custom order`}}};export{e as default};
@@ -1,18 +1 @@
1
- const t = {
2
- sheetsSort: {
3
- title: "排序",
4
- toolbar: {
5
- "sort-asc": "升序",
6
- "sort-desc": "降序",
7
- "sort-custom": "自定义排序"
8
- },
9
- "context-menu": {
10
- "sort-asc": "升序",
11
- "sort-desc": "降序",
12
- "sort-custom": "自定义排序"
13
- }
14
- }
15
- };
16
- export {
17
- t as default
18
- };
1
+ const e={sheetsSort:{title:`排序`,toolbar:{"sort-asc":`升序`,"sort-desc":`降序`,"sort-custom":`自定义排序`},"context-menu":{"sort-asc":`升序`,"sort-desc":`降序`,"sort-custom":`自定义排序`}}};export{e as default};
@@ -1,18 +1 @@
1
- const t = {
2
- sheetsSort: {
3
- title: "Sắp xếp",
4
- toolbar: {
5
- "sort-asc": "Tăng dần",
6
- "sort-desc": "Giảm dần",
7
- "sort-custom": "Sắp xếp tùy chỉnh"
8
- },
9
- "context-menu": {
10
- "sort-asc": "Tăng dần",
11
- "sort-desc": "Giảm dần",
12
- "sort-custom": "Sắp xếp tùy chỉnh"
13
- }
14
- }
15
- };
16
- export {
17
- t as default
18
- };
1
+ const e={sheetsSort:{title:`Sắp xếp`,toolbar:{"sort-asc":`Tăng dần`,"sort-desc":`Giảm dần`,"sort-custom":`Sắp xếp tùy chỉnh`},"context-menu":{"sort-asc":`Tăng dần`,"sort-desc":`Giảm dần`,"sort-custom":`Sắp xếp tùy chỉnh`}}};export{e as default};
@@ -1,6 +1,21 @@
1
- import { ICellData, ICommand, IRange, Nullable } from '@univerjs/core';
2
- import { ISheetCommandSharedParams } from '@univerjs/sheets';
3
- import { IOrderRule, SortType } from '../../services/interface';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { ICellData, ICommand, IRange, Nullable } from '@univerjs/core';
17
+ import type { ISheetCommandSharedParams } from '@univerjs/sheets';
18
+ import type { IOrderRule, SortType } from '../../services/interface';
4
19
  export interface ISortRangeCommandParams extends ISheetCommandSharedParams {
5
20
  range: IRange;
6
21
  orderRules: IOrderRule[];
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ */
1
16
  import { Disposable, ICommandService } from '@univerjs/core';
2
17
  import { SheetsSortService } from '../services/sheets-sort.service';
3
18
  export type ICommonComparableCellValue = number | string | null;
@@ -1,5 +1,20 @@
1
- import { ICellData, Nullable } from '@univerjs/core';
2
- import { ICommonComparableCellValue } from './sheets-sort.controller';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { ICellData, Nullable } from '@univerjs/core';
17
+ import type { ICommonComparableCellValue } from './sheets-sort.controller';
3
18
  import { SortType } from '../services/interface';
4
19
  export declare enum ORDER {
5
20
  POSITIVE = 1,
@@ -1,5 +1,20 @@
1
- import { IEventBase } from '@univerjs/core/facade';
2
- import { FRange, FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IEventBase } from '@univerjs/core/facade';
17
+ import type { FRange, FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
3
18
  /**
4
19
  * @ignore
5
20
  */
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ */
1
16
  import { FRange } from '@univerjs/sheets/facade';
2
17
  export type SortColumnSpec = {
3
18
  column: number;
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ */
1
16
  import { FWorksheet } from '@univerjs/sheets/facade';
2
17
  /**
3
18
  * @ignore
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,3 +1,18 @@
1
- import { default as enUS } from './en-US';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type enUS from './en-US';
2
17
  declare const locale: typeof enUS;
3
18
  export default locale;
@@ -1,4 +1,19 @@
1
- import { IUniverSheetsSortConfig } from './config/config';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IUniverSheetsSortConfig } from './config/config';
2
17
  import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
18
  export declare class UniverSheetsSortPlugin extends Plugin {
4
19
  private readonly _config;
@@ -1,4 +1,19 @@
1
- import { IRange } from '@univerjs/core';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { IRange } from '@univerjs/core';
2
17
  export interface ISortOption {
3
18
  range: IRange;
4
19
  orderRules: IOrderRule[];
@@ -1,6 +1,21 @@
1
- import { ISheetRangeLocation } from '@univerjs/sheets';
2
- import { ICellValueCompareFn } from '../commands/commands/sheets-sort.command';
3
- import { ISortOption } from './interface';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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
+ import type { ISheetRangeLocation } from '@univerjs/sheets';
17
+ import type { ICellValueCompareFn } from '../commands/commands/sheets-sort.command';
18
+ import type { ISortOption } from './interface';
4
19
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
5
20
  import { FormulaDataModel } from '@univerjs/engine-formula';
6
21
  export declare class SheetsSortService extends Disposable {
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,s){typeof exports=="object"&&typeof module<"u"?s(require("@univerjs/sheets-sort"),require("@univerjs/sheets/facade"),require("@univerjs/core"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["@univerjs/sheets-sort","@univerjs/sheets/facade","@univerjs/core","@univerjs/core/facade"],s):(e=typeof globalThis<"u"?globalThis:e||self,s(e.UniverSheetsSort,e.UniverSheetsFacade,e.UniverCore,e.UniverCoreFacade))})(this,(function(e,s,R,u){"use strict";class v extends s.FRange{sort(o){const t=this._range.startColumn,i=(Array.isArray(o)?o:[o]).map(r=>typeof r=="number"?{colIndex:r+t,type:e.SortType.ASC}:{colIndex:r.column+t,type:r.ascending?e.SortType.ASC:e.SortType.DESC});return this._commandService.syncExecuteCommand(e.SortRangeCommand.id,{orderRules:i,range:this._range,hasTitle:!1,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}}s.FRange.extend(v);class C extends s.FWorksheet{sort(o,t=!0){const n=[{colIndex:o,type:t?e.SortType.ASC:e.SortType.DESC}],i={startRow:0,startColumn:0,endRow:this._worksheet.getRowCount()-1,endColumn:this._worksheet.getColumnCount()-1,rangeType:R.RANGE_TYPE.ALL};return this._commandService.syncExecuteCommand(e.SortRangeCommand.id,{orderRules:n,range:i,hasTitle:!1,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}}s.FWorksheet.extend(C);class l{get SheetRangeSorted(){return"SheetRangeSorted"}get SheetBeforeRangeSort(){return"SheetBeforeRangeSort"}}u.FEventName.extend(s.FSheetEventName);class f extends u.FUniver{_initialize(o){const t=o.get(R.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetBeforeRangeSort,()=>t.beforeCommandExecuted(n=>{n.id===e.SortRangeCommand.id&&this._beforeRangeSort(n)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetRangeSorted,()=>t.onCommandExecuted(n=>{n.id===e.SortRangeCommand.id&&this._onRangeSorted(n)})))}_beforeRangeSort(o){const t=o.params,n=this.getUniverSheet(t.unitId),i=n.getSheetBySheetId(t.subUnitId),{startColumn:r,endColumn:m,startRow:a,endRow:S}=t.range,g=i.getRange(a,r,S-a+1,m-r+1),d={workbook:n,worksheet:i,range:g,sortColumn:t.orderRules.map(h=>({column:h.colIndex-r,ascending:h.type===e.SortType.ASC}))};if(this.fireEvent(this.Event.SheetBeforeRangeSort,d),d.cancel)throw new Error("SortRangeCommand canceled.")}_onRangeSorted(o){const t=o.params,n=this.getUniverSheet(t.unitId),i=n.getSheetBySheetId(t.subUnitId),{startColumn:r,endColumn:m,startRow:a,endRow:S}=t.range,g=i.getRange(a,r,S-a+1,m-r+1),d={workbook:n,worksheet:i,range:g,sortColumn:t.orderRules.map(h=>({column:h.colIndex-r,ascending:h.type===e.SortType.ASC}))};if(this.fireEvent(this.Event.SheetRangeSorted,d),d.cancel)throw new Error("SortRangeCommand canceled.")}}u.FUniver.extend(f),u.FEventName.extend(l)}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/sheets-sort`),require(`@univerjs/sheets/facade`),require(`@univerjs/core`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`@univerjs/sheets-sort`,`@univerjs/sheets/facade`,`@univerjs/core`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsSort,e.UniverSheetsFacade,e.UniverCore,e.UniverCoreFacade))})(this,function(e,t,n,r){var i=class extends t.FRange{sort(t){let n=this._range.startColumn,r=(Array.isArray(t)?t:[t]).map(t=>typeof t==`number`?{colIndex:t+n,type:e.SortType.ASC}:{colIndex:t.column+n,type:t.ascending?e.SortType.ASC:e.SortType.DESC});return this._commandService.syncExecuteCommand(e.SortRangeCommand.id,{orderRules:r,range:this._range,hasTitle:!1,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}};t.FRange.extend(i);var a=class extends t.FWorksheet{sort(t,r=!0){let i=[{colIndex:t,type:r?e.SortType.ASC:e.SortType.DESC}],a={startRow:0,startColumn:0,endRow:this._worksheet.getRowCount()-1,endColumn:this._worksheet.getColumnCount()-1,rangeType:n.RANGE_TYPE.ALL};return this._commandService.syncExecuteCommand(e.SortRangeCommand.id,{orderRules:i,range:a,hasTitle:!1,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}};t.FWorksheet.extend(a);var o=class{get SheetRangeSorted(){return`SheetRangeSorted`}get SheetBeforeRangeSort(){return`SheetBeforeRangeSort`}};r.FEventName.extend(t.FSheetEventName);var s=class extends r.FUniver{_initialize(t){let r=t.get(n.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetBeforeRangeSort,()=>r.beforeCommandExecuted(t=>{t.id===e.SortRangeCommand.id&&this._beforeRangeSort(t)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetRangeSorted,()=>r.onCommandExecuted(t=>{t.id===e.SortRangeCommand.id&&this._onRangeSorted(t)})))}_beforeRangeSort(t){let n=t.params,r=this.getUniverSheet(n.unitId),i=r.getSheetBySheetId(n.subUnitId),{startColumn:a,endColumn:o,startRow:s,endRow:c}=n.range,l={workbook:r,worksheet:i,range:i.getRange(s,a,c-s+1,o-a+1),sortColumn:n.orderRules.map(t=>({column:t.colIndex-a,ascending:t.type===e.SortType.ASC}))};if(this.fireEvent(this.Event.SheetBeforeRangeSort,l),l.cancel)throw Error(`SortRangeCommand canceled.`)}_onRangeSorted(t){let n=t.params,r=this.getUniverSheet(n.unitId),i=r.getSheetBySheetId(n.subUnitId),{startColumn:a,endColumn:o,startRow:s,endRow:c}=n.range,l={workbook:r,worksheet:i,range:i.getRange(s,a,c-s+1,o-a+1),sortColumn:n.orderRules.map(t=>({column:t.colIndex-a,ascending:t.type===e.SortType.ASC}))};if(this.fireEvent(this.Event.SheetRangeSorted,l),l.cancel)throw Error(`SortRangeCommand canceled.`)}};r.FUniver.extend(s),r.FEventName.extend(o)});
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,(function(l,o,S,w){"use strict";var te=Object.defineProperty;var ne=(l,o,S)=>o in l?te(l,o,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[o]=S;var T=(l,o,S)=>ne(l,typeof o!="symbol"?o+"":o,S);var g=(e=>(e.DESC="desc",e.ASC="asc",e))(g||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),E=(e,n)=>{const t=e===null||e==="",r=n===null||n==="";return t&&r?0:t?1:r?-1:null},O=(e,n,t)=>{const r=typeof e=="number",s=typeof n=="number";return r&&s?e<n?t===g.ASC?-1:1:e>n?t===g.ASC?1:-1:0:r?t===g.ASC?1:-1:s?t===g.ASC?-1:1:null},j=(e,n,t)=>{const r=typeof e=="string",s=typeof n=="string";if(r&&(e=b(e.toLocaleLowerCase())),s&&(n=b(n.toLocaleLowerCase())),!r&&!s)return null;if(r&&s){const i=e,u=n;return i<u?t===g.ASC?-1:1:i>u?t===g.ASC?1:-1:0}return r?t===g.ASC?1:-1:s?t===g.ASC?-1:1:null},U=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.getOwnPropertyDescriptor,V=(e,n,t,r)=>{for(var s=r>1?void 0:r?M(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},_=(e,n)=>(t,r)=>n(t,r,e);l.SheetsSortService=class extends o.Disposable{constructor(t,r,s){super();T(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=s}mergeCheck(t){var a;const{unitId:r,subUnitId:s,range:i}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(s);if(!u)return!1;const c=u.getMergeData().filter(m=>o.Rectangle.contains(i,m));return c.length===0?!0:$(i,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:s,range:i}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(s);if(!u)return!1;for(let a=i.startRow;a<=i.endRow;a++)for(let m=i.startColumn;m<=i.endColumn;m++)if(!U(u.getCellRaw(a,m)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:s,range:i}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[s];for(const m in u){const d=u[Number(m)];for(const R in d){const v=d[Number(R)];if(v&&o.Rectangle.intersects(i,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,s){var c;const{unitId:i,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(p.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||i,subUnitId:s||u})}},l.SheetsSortService=V([_(0,o.IUniverInstanceService),_(1,o.ICommandService),_(2,o.Inject(w.FormulaDataModel))],l.SheetsSortService);function $(e,n){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let s=null,i=null;const u=t*r;let c=0;for(const a of n)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const m=a.endRow-a.startRow+1,d=a.endColumn-a.startColumn+1;if(s===null&&i===null)s=m,i=d;else if(m!==s||d!==i)return!1;c+=m*d}return c===u}const p={id:"sheet.command.sort-range",type:o.CommandType.COMMAND,handler:(e,n)=>{const{range:t,orderRules:r,hasTitle:s,unitId:i,subUnitId:u}=n,c=e.get(l.SheetsSortService),a=e.get(o.IUniverInstanceService),{worksheet:m}=S.getSheetCommandTarget(a,n)||{};if(!m)return!1;const d=m.getMergeData().filter(f=>o.Rectangle.contains(t,f)),R=d.map(f=>f.startRow),{startRow:v,endRow:J}=t,Q=s?v+1:v,I=[],D=[];for(let f=Q;f<=J;f++)m.getRowFiltered(f)||m.getRowRawVisible(f)!==!1&&(d.length&&!R.includes(f)||(I.push({index:f,value:L(m,f,r)}),D.push(f)));const X=c.getAllCompareFns();I.sort(q(r,G(X)));const N={};I.forEach(({index:f,value:oe},ee)=>{N[D[ee]]=f});const Z={id:S.ReorderRangeCommand.id,params:{unitId:i,subUnitId:u,range:t,order:N}},x=e.get(o.ICommandService);return o.sequenceExecute([Z],x).result}};function L(e,n,t){const r=[];return t.forEach(({colIndex:s})=>{r.push(e.getCellRaw(n,s))}),r}function G(e){return(n,t,r)=>{for(let s=0;s<e.length;s++){const i=e[s](n,t,r);if(i!=null)return i}return 0}}function q(e,n){return function(t,r){let s=null;for(let i=0;i<e.length;i++){const u=t.value[i],c=r.value[i];if(s=n(e[i].type,u,c),s!==0&&s!==null&&s!==void 0)return s}return 0}}const y={name:"@univerjs/sheets-sort",version:"0.17.0"},B="sheets-sort.config",P={};var H=Object.getOwnPropertyDescriptor,k=(e,n,t,r)=>{for(var s=r>1?void 0:r?H(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},A=(e,n)=>(t,r)=>n(t,r,e);let h=class extends o.Disposable{constructor(e,n){super(),this._commandService=e,this._sortService=n,this._initCommands(),this._registerCompareFns()}_initCommands(){[p].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(n,t,r)=>{const s=this._getCommonValue(t),i=this._getCommonValue(r),u=[E,j,O];for(let c=0;c<u.length;c++){const a=u[c](s,i,n);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(U(e))return null;const n=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return n||((e==null?void 0:e.t)===o.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===o.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===o.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===o.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=k([A(0,o.ICommandService),A(1,o.Inject(l.SheetsSortService))],h);var K=Object.defineProperty,W=Object.getOwnPropertyDescriptor,Y=(e,n,t)=>n in e?K(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,z=(e,n,t,r)=>{for(var s=r>1?void 0:r?W(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},F=(e,n)=>(t,r)=>n(t,r,e),C=(e,n,t)=>Y(e,typeof n!="symbol"?n+"":n,t);l.UniverSheetsSortPlugin=class extends o.Plugin{constructor(n=P,t,r){super(),this._config=n,this._injector=t,this._configService=r;const{...s}=o.merge({},P,this._config);this._configService.setConfig(B,s)}onStarting(){[[h],[l.SheetsSortService]].forEach(n=>this._injector.add(n))}onReady(){this._injector.get(h)}},C(l.UniverSheetsSortPlugin,"type",o.UniverInstanceType.UNIVER_SHEET),C(l.UniverSheetsSortPlugin,"pluginName","SHEET_SORT_PLUGIN"),C(l.UniverSheetsSortPlugin,"packageName",y.name),C(l.UniverSheetsSortPlugin,"version",y.version),l.UniverSheetsSortPlugin=z([o.DependentOn(S.UniverSheetsPlugin,w.UniverFormulaEnginePlugin),F(1,o.Inject(o.Injector)),F(2,o.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=p,l.SortType=g,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`@univerjs/engine-formula`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/engine-formula`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsSort={},e.UniverCore,e.UniverSheets,e.UniverEngineFormula))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let i=function(e){return e.DESC=`desc`,e.ASC=`asc`,e}({}),a=function(e){return e[e.POSITIVE=1]=`POSITIVE`,e[e.NEGATIVE=-1]=`NEGATIVE`,e[e.ZERO=0]=`ZERO`,e}({}),o=e=>e.replace(/-/gi,``).replace(/'/gi,``),s=(e,t)=>{let n=e===null||e===``,r=t===null||t===``;return n&&r?a.ZERO:n?a.POSITIVE:r?a.NEGATIVE:null},c=(e,t,n)=>{let r=typeof e==`number`,o=typeof t==`number`;return r&&o?e<t?n===i.ASC?a.NEGATIVE:a.POSITIVE:e>t?n===i.ASC?a.POSITIVE:a.NEGATIVE:a.ZERO:r?n===i.ASC?a.POSITIVE:a.NEGATIVE:o?n===i.ASC?a.NEGATIVE:a.POSITIVE:null},l=(e,t,n)=>{let r=typeof e==`string`,s=typeof t==`string`;if(r&&(e=o(e.toLocaleLowerCase())),s&&(t=o(t.toLocaleLowerCase())),!r&&!s)return null;if(r&&s){let r=e,o=t;return r<o?n===i.ASC?a.NEGATIVE:a.POSITIVE:r>o?n===i.ASC?a.POSITIVE:a.NEGATIVE:a.ZERO}return r?n===i.ASC?a.POSITIVE:a.NEGATIVE:s?n===i.ASC?a.NEGATIVE:a.POSITIVE:null},u=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let _=class extends t.Disposable{constructor(e,t,n){super(),this._univerInstanceService=e,this._commandService=t,this._formulaDataModel=n,m(this,`_compareFns`,[])}mergeCheck(e){var n;let{unitId:r,subUnitId:i,range:a}=e,o=(n=this._univerInstanceService.getUnit(r))==null?void 0:n.getSheetBySheetId(i);if(!o)return!1;let s=o.getMergeData().filter(e=>t.Rectangle.contains(a,e));return s.length===0?!0:v(a,s)}emptyCheck(e){var t;let{unitId:n,subUnitId:r,range:i}=e,a=(t=this._univerInstanceService.getUnit(n))==null?void 0:t.getSheetBySheetId(r);if(!a)return!1;for(let e=i.startRow;e<=i.endRow;e++)for(let t=i.startColumn;t<=i.endColumn;t++)if(!u(a.getCellRaw(e,t)))return!0;return!1}singleCheck(e){return e.range.startRow!==e.range.endRow}formulaCheck(e){var n;let{unitId:r,subUnitId:i,range:a}=e,o=(n=this._formulaDataModel.getArrayFormulaRange())==null||(n=n[r])==null?void 0:n[i];for(let e in o){let n=o[Number(e)];for(let e in n){let r=n[Number(e)];if(r&&t.Rectangle.intersects(a,r))return!1}}return!0}registerCompareFn(e){this._compareFns.unshift(e)}getAllCompareFns(){return this._compareFns}applySort(e,t,r){var i;let{unitId:a,subUnitId:o}=(0,n.getSheetCommandTarget)(this._univerInstanceService)||{};this._commandService.executeCommand(y.id,{orderRules:e.orderRules,range:e.range,hasTitle:(i=e.hasTitle)==null?!1:i,unitId:t||a,subUnitId:r||o})}};_=g([h(0,t.IUniverInstanceService),h(1,t.ICommandService),h(2,(0,t.Inject)(r.FormulaDataModel))],_);function v(e,t){let n=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1,i=null,a=null,o=n*r,s=0;for(let n of t)if(n.startRow>=e.startRow&&n.endRow<=e.endRow&&n.startColumn>=e.startColumn&&n.endColumn<=e.endColumn){let e=n.endRow-n.startRow+1,t=n.endColumn-n.startColumn+1;if(i===null&&a===null)i=e,a=t;else if(e!==i||t!==a)return!1;s+=e*t}return s===o}let y={id:`sheet.command.sort-range`,type:t.CommandType.COMMAND,handler:(e,r)=>{let{range:i,orderRules:a,hasTitle:o,unitId:s,subUnitId:c}=r,l=e.get(_),{worksheet:u}=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r)||{};if(!u)return!1;let d=u.getMergeData().filter(e=>t.Rectangle.contains(i,e)),f=d.map(e=>e.startRow),{startRow:p,endRow:m}=i,h=o?p+1:p,g=[],v=[];for(let e=h;e<=m;e++)u.getRowFiltered(e)||u.getRowRawVisible(e)!==!1&&(d.length&&!f.includes(e)||(g.push({index:e,value:b(u,e,a)}),v.push(e)));let y=l.getAllCompareFns();g.sort(S(a,x(y)));let C={};g.forEach(({index:e,value:t},n)=>{C[v[n]]=e});let w={id:n.ReorderRangeCommand.id,params:{unitId:s,subUnitId:c,range:i,order:C}},T=e.get(t.ICommandService);return(0,t.sequenceExecute)([w],T).result}};function b(e,t,n){let r=[];return n.forEach(({colIndex:n})=>{r.push(e.getCellRaw(t,n))}),r}function x(e){return(t,n,r)=>{for(let i=0;i<e.length;i++){let a=e[i](t,n,r);if(a!=null)return a}return 0}}function S(e,t){return function(n,r){let i=null;for(let a=0;a<e.length;a++){let o=n.value[a],s=r.value[a];if(i=t(e[a].type,o,s),i!==0&&i!=null)return i}return 0}}var C=`@univerjs/sheets-sort`,w=`0.18.0`;let T=`sheets-sort.config`;Symbol(T);let E={},D=class extends t.Disposable{constructor(e,t){super(),this._commandService=e,this._sortService=t,this._initCommands(),this._registerCompareFns()}_initCommands(){[y].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){this._sortService.registerCompareFn((e,t,n)=>{let r=this._getCommonValue(t),i=this._getCommonValue(n),a=[s,l,c];for(let t=0;t<a.length;t++){let n=a[t](r,i,e);if(n!==null)return n}return null})}_getCommonValue(e){var n;return u(e)?null:(e==null||(n=e.p)==null||(n=n.body)==null?void 0:n.dataStream)||((e==null?void 0:e.t)===t.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===t.CellValueType.STRING?typeof e.v==`number`?e.v:`${e.v}`:(e==null?void 0:e.t)===t.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===t.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};D=g([h(0,t.ICommandService),h(1,(0,t.Inject)(_))],D);let O=class extends t.Plugin{constructor(e=E,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},E,this._config);this._configService.setConfig(T,i)}onStarting(){[[D],[_]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(D)}};m(O,`type`,t.UniverInstanceType.UNIVER_SHEET),m(O,`pluginName`,`SHEET_SORT_PLUGIN`),m(O,`packageName`,C),m(O,`version`,w),O=g([(0,t.DependentOn)(n.UniverSheetsPlugin,r.UniverFormulaEnginePlugin),h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService)],O),Object.defineProperty(e,`SheetsSortService`,{enumerable:!0,get:function(){return _}}),e.SortRangeCommand=y,e.SortType=i,Object.defineProperty(e,`UniverSheetsSortPlugin`,{enumerable:!0,get:function(){return O}})});
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsSortCaES=t())})(this,(function(){"use strict";return{sheetsSort:{title:"Ordena",toolbar:{"sort-asc":"ordre ascendent","sort-desc":"ordre descendent","sort-custom":"ordre personalitzat"},"context-menu":{"sort-asc":"ordre ascendent","sort-desc":"ordre descendent","sort-custom":"ordre personalitzat"}}}}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsSortCaES=t())})(this,function(){return{sheetsSort:{title:`Ordena`,toolbar:{"sort-asc":`ordre ascendent`,"sort-desc":`ordre descendent`,"sort-custom":`ordre personalitzat`},"context-menu":{"sort-asc":`ordre ascendent`,"sort-desc":`ordre descendent`,"sort-custom":`ordre personalitzat`}}}});
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsSortEnUS=o())})(this,(function(){"use strict";return{sheetsSort:{title:"Sort",toolbar:{"sort-asc":"ascending order","sort-desc":"descending order","sort-custom":"custom order"},"context-menu":{"sort-asc":"ascending order","sort-desc":"descending order","sort-custom":"custom order"}}}}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsSortEnUS=t())})(this,function(){return{sheetsSort:{title:`Sort`,toolbar:{"sort-asc":`ascending order`,"sort-desc":`descending order`,"sort-custom":`custom order`},"context-menu":{"sort-asc":`ascending order`,"sort-desc":`descending order`,"sort-custom":`custom order`}}}});