@univerjs/sheets-sort 0.5.4 → 0.5.5-experimental.20250123-34738ff

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.
package/lib/es/index.js CHANGED
@@ -1,246 +1,251 @@
1
- var H = Object.defineProperty;
2
- var q = (e, t, r) => t in e ? H(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var h = (e, t, r) => q(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { Inject as w, Disposable as y, Rectangle as R, IUniverInstanceService as U, ICommandService as I, CommandType as K, sequenceExecute as W, CellValueType as C, Plugin as Y, merge as z, UniverInstanceType as J, Injector as Q, IConfigService as X } from "@univerjs/core";
5
- import { getSheetCommandTarget as T, ReorderRangeCommand as Z } from "@univerjs/sheets";
6
- import { FormulaDataModel as k } from "@univerjs/engine-formula";
7
- const ee = "sheets-sort.config", N = {};
8
- var f = /* @__PURE__ */ ((e) => (e.DESC = "desc", e.ASC = "asc", e))(f || {});
9
- const D = (e) => e.replace(/-/gi, "").replace(/'/gi, ""), te = (e, t) => {
10
- const r = e === null || e === "", o = t === null || t === "";
11
- return r && o ? 0 : r ? 1 : o ? -1 : null;
12
- }, re = (e, t, r) => {
13
- const o = typeof e == "number", n = typeof t == "number";
14
- return o && n ? e < t ? r === f.ASC ? -1 : 1 : e > t ? r === f.ASC ? 1 : -1 : 0 : o ? r === f.ASC ? 1 : -1 : n ? r === f.ASC ? -1 : 1 : null;
15
- }, ne = (e, t, r) => {
16
- const o = typeof e == "string", n = typeof t == "string";
17
- if (o && (e = D(e.toLocaleLowerCase())), n && (t = D(t.toLocaleLowerCase())), !o && !n)
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { Inject, Disposable, Rectangle, IUniverInstanceService, ICommandService, CommandType, sequenceExecute, CellValueType, Plugin, merge, UniverInstanceType, Injector, IConfigService } from "@univerjs/core";
6
+ import { getSheetCommandTarget, ReorderRangeCommand } from "@univerjs/sheets";
7
+ import { FormulaDataModel } from "@univerjs/engine-formula";
8
+ const SHEETS_SORT_PLUGIN_CONFIG_KEY = "sheets-sort.config", defaultPluginConfig = {};
9
+ var SortType = /* @__PURE__ */ ((SortType2) => (SortType2.DESC = "desc", SortType2.ASC = "asc", SortType2))(SortType || {});
10
+ const removeStringSymbol = /* @__PURE__ */ __name((str) => str.replace(/-/gi, "").replace(/'/gi, ""), "removeStringSymbol"), compareNull = /* @__PURE__ */ __name((a1, a2) => {
11
+ const isA1Null = a1 === null || a1 === "", isA2Null = a2 === null || a2 === "";
12
+ return isA1Null && isA2Null ? 0 : isA1Null ? 1 : isA2Null ? -1 : null;
13
+ }, "compareNull"), compareNumber = /* @__PURE__ */ __name((a1, a2, type) => {
14
+ const isA1Num = typeof a1 == "number", isA2Num = typeof a2 == "number";
15
+ return isA1Num && isA2Num ? a1 < a2 ? type === SortType.ASC ? -1 : 1 : a1 > a2 ? type === SortType.ASC ? 1 : -1 : 0 : isA1Num ? type === SortType.ASC ? 1 : -1 : isA2Num ? type === SortType.ASC ? -1 : 1 : null;
16
+ }, "compareNumber"), compareString = /* @__PURE__ */ __name((a1, a2, type) => {
17
+ const isA1Str = typeof a1 == "string", isA2Str = typeof a2 == "string";
18
+ if (isA1Str && (a1 = removeStringSymbol(a1.toLocaleLowerCase())), isA2Str && (a2 = removeStringSymbol(a2.toLocaleLowerCase())), !isA1Str && !isA2Str)
18
19
  return null;
19
- if (o && n) {
20
- const s = e, i = t;
21
- return s < i ? r === f.ASC ? -1 : 1 : s > i ? r === f.ASC ? 1 : -1 : 0;
22
- }
23
- return o ? r === f.ASC ? 1 : -1 : n ? r === f.ASC ? -1 : 1 : null;
24
- }, M = (e) => !e || Object.keys(e).length === 0 || (e == null ? void 0 : e.v) == null && (e == null ? void 0 : e.p) == null;
25
- var oe = Object.defineProperty, se = Object.getOwnPropertyDescriptor, ie = (e, t, r, o) => {
26
- for (var n = o > 1 ? void 0 : o ? se(t, r) : t, s = e.length - 1, i; s >= 0; s--)
27
- (i = e[s]) && (n = (o ? i(t, r, n) : i(n)) || n);
28
- return o && n && oe(t, r, n), n;
29
- }, p = (e, t) => (r, o) => t(r, o, e);
30
- let g = class extends y {
31
- constructor(t, r, o) {
20
+ if (isA1Str && isA2Str) {
21
+ const a1AsString = a1, a2AsString = a2;
22
+ return a1AsString < a2AsString ? type === SortType.ASC ? -1 : 1 : a1AsString > a2AsString ? type === SortType.ASC ? 1 : -1 : 0;
23
+ }
24
+ return isA1Str ? type === SortType.ASC ? 1 : -1 : isA2Str ? type === SortType.ASC ? -1 : 1 : null;
25
+ }, "compareString"), isNullValue = /* @__PURE__ */ __name((cell) => !cell || Object.keys(cell).length === 0 || (cell == null ? void 0 : cell.v) == null && (cell == null ? void 0 : cell.p) == null, "isNullValue");
26
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
27
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
28
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
29
+ return kind && result && __defProp$2(target, key, result), result;
30
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a;
31
+ let SheetsSortService = (_a = class extends Disposable {
32
+ constructor(_univerInstanceService, _commandService, _formulaDataModel) {
32
33
  super();
33
- h(this, "_compareFns", []);
34
- this._univerInstanceService = t, this._commandService = r, this._formulaDataModel = o;
34
+ __publicField(this, "_compareFns", []);
35
+ this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._formulaDataModel = _formulaDataModel;
35
36
  }
36
- mergeCheck(t) {
37
- var c;
38
- const { unitId: r, subUnitId: o, range: n } = t, s = (c = this._univerInstanceService.getUnit(r)) == null ? void 0 : c.getSheetBySheetId(o);
39
- if (!s)
37
+ mergeCheck(location) {
38
+ var _a4;
39
+ const { unitId, subUnitId, range } = location, sheet = (_a4 = this._univerInstanceService.getUnit(unitId)) == null ? void 0 : _a4.getSheetBySheetId(subUnitId);
40
+ if (!sheet)
40
41
  return !1;
41
- const i = s.getMergeData().filter((u) => R.contains(n, u));
42
- return i.length === 0 ? !0 : ue(n, i);
42
+ const mergeDataInRange = sheet.getMergeData().filter((merge2) => Rectangle.contains(range, merge2));
43
+ return mergeDataInRange.length === 0 ? !0 : isRangeDividedEqually(range, mergeDataInRange);
43
44
  }
44
- emptyCheck(t) {
45
- var i;
46
- const { unitId: r, subUnitId: o, range: n } = t, s = (i = this._univerInstanceService.getUnit(r)) == null ? void 0 : i.getSheetBySheetId(o);
47
- if (!s)
45
+ emptyCheck(location) {
46
+ var _a4;
47
+ const { unitId, subUnitId, range } = location, sheet = (_a4 = this._univerInstanceService.getUnit(unitId)) == null ? void 0 : _a4.getSheetBySheetId(subUnitId);
48
+ if (!sheet)
48
49
  return !1;
49
- for (let c = n.startRow; c <= n.endRow; c++)
50
- for (let u = n.startColumn; u <= n.endColumn; u++)
51
- if (!M(s.getCellRaw(c, u)))
50
+ for (let row = range.startRow; row <= range.endRow; row++)
51
+ for (let col = range.startColumn; col <= range.endColumn; col++)
52
+ if (!isNullValue(sheet.getCellRaw(row, col)))
52
53
  return !0;
53
54
  return !1;
54
55
  }
55
- singleCheck(t) {
56
- return t.range.startRow !== t.range.endRow;
57
- }
58
- formulaCheck(t) {
59
- var i, c;
60
- const { unitId: r, subUnitId: o, range: n } = t, s = (c = (i = this._formulaDataModel.getArrayFormulaRange()) == null ? void 0 : i[r]) == null ? void 0 : c[o];
61
- for (const u in s) {
62
- const a = s[Number(u)];
63
- for (const m in a) {
64
- const d = a[Number(m)];
65
- if (d && R.intersects(n, d))
56
+ singleCheck(location) {
57
+ return location.range.startRow !== location.range.endRow;
58
+ }
59
+ formulaCheck(location) {
60
+ var _a4, _b;
61
+ const { unitId, subUnitId, range } = location, arrayFormulaRange = (_b = (_a4 = this._formulaDataModel.getArrayFormulaRange()) == null ? void 0 : _a4[unitId]) == null ? void 0 : _b[subUnitId];
62
+ for (const row in arrayFormulaRange) {
63
+ const rowData = arrayFormulaRange[Number(row)];
64
+ for (const col in rowData) {
65
+ const arrayFormula = rowData[Number(col)];
66
+ if (arrayFormula && Rectangle.intersects(range, arrayFormula))
66
67
  return !1;
67
68
  }
68
69
  }
69
70
  return !0;
70
71
  }
71
- registerCompareFn(t) {
72
- this._compareFns.unshift(t);
72
+ registerCompareFn(fn) {
73
+ this._compareFns.unshift(fn);
73
74
  }
74
75
  getAllCompareFns() {
75
76
  return this._compareFns;
76
77
  }
77
- applySort(t, r, o) {
78
- var i;
79
- const { unitId: n, subUnitId: s } = T(this._univerInstanceService) || {};
80
- this._commandService.executeCommand($.id, {
81
- orderRules: t.orderRules,
82
- range: t.range,
83
- hasTitle: (i = t.hasTitle) != null ? i : !1,
84
- unitId: r || n,
85
- subUnitId: o || s
78
+ applySort(sortOption, unitId, subUnitId) {
79
+ var _a4;
80
+ const { unitId: _unitId, subUnitId: _subUnitId } = getSheetCommandTarget(this._univerInstanceService) || {};
81
+ this._commandService.executeCommand(SortRangeCommand.id, {
82
+ orderRules: sortOption.orderRules,
83
+ range: sortOption.range,
84
+ hasTitle: (_a4 = sortOption.hasTitle) != null ? _a4 : !1,
85
+ unitId: unitId || _unitId,
86
+ subUnitId: subUnitId || _subUnitId
86
87
  });
87
88
  }
88
- };
89
- g = ie([
90
- p(0, U),
91
- p(1, I),
92
- p(2, w(k))
93
- ], g);
94
- function ue(e, t) {
95
- const r = e.endRow - e.startRow + 1, o = e.endColumn - e.startColumn + 1;
96
- let n = null, s = null;
97
- const i = r * o;
98
- let c = 0;
99
- for (const u of t)
100
- if (u.startRow >= e.startRow && u.endRow <= e.endRow && u.startColumn >= e.startColumn && u.endColumn <= e.endColumn) {
101
- const a = u.endRow - u.startRow + 1, m = u.endColumn - u.startColumn + 1;
102
- if (n === null && s === null)
103
- n = a, s = m;
104
- else if (a !== n || m !== s)
89
+ }, __name(_a, "SheetsSortService"), _a);
90
+ SheetsSortService = __decorateClass$2([
91
+ __decorateParam$2(0, IUniverInstanceService),
92
+ __decorateParam$2(1, ICommandService),
93
+ __decorateParam$2(2, Inject(FormulaDataModel))
94
+ ], SheetsSortService);
95
+ function isRangeDividedEqually(range, merges) {
96
+ const rangeRows = range.endRow - range.startRow + 1, rangeCols = range.endColumn - range.startColumn + 1;
97
+ let mergeRows = null, mergeCols = null;
98
+ const totalArea = rangeRows * rangeCols;
99
+ let totalMergeArea = 0;
100
+ for (const merge2 of merges)
101
+ if (merge2.startRow >= range.startRow && merge2.endRow <= range.endRow && merge2.startColumn >= range.startColumn && merge2.endColumn <= range.endColumn) {
102
+ const currentMergeRows = merge2.endRow - merge2.startRow + 1, currentMergeCols = merge2.endColumn - merge2.startColumn + 1;
103
+ if (mergeRows === null && mergeCols === null)
104
+ mergeRows = currentMergeRows, mergeCols = currentMergeCols;
105
+ else if (currentMergeRows !== mergeRows || currentMergeCols !== mergeCols)
105
106
  return !1;
106
- c += a * m;
107
+ totalMergeArea += currentMergeRows * currentMergeCols;
107
108
  }
108
- return c === i;
109
+ return totalMergeArea === totalArea;
109
110
  }
110
- const $ = {
111
+ __name(isRangeDividedEqually, "isRangeDividedEqually");
112
+ const SortRangeCommand = {
111
113
  id: "sheet.command.sort-range",
112
- type: K.COMMAND,
113
- handler: (e, t) => {
114
- const { range: r, orderRules: o, hasTitle: n, unitId: s, subUnitId: i } = t, c = e.get(g), u = e.get(U), { worksheet: a } = T(u, t) || {};
115
- if (!a)
114
+ type: CommandType.COMMAND,
115
+ handler: /* @__PURE__ */ __name((accessor, params) => {
116
+ const { range, orderRules, hasTitle, unitId, subUnitId } = params, sortService = accessor.get(SheetsSortService), univerInstanceService = accessor.get(IUniverInstanceService), { worksheet } = getSheetCommandTarget(univerInstanceService, params) || {};
117
+ if (!worksheet)
116
118
  return !1;
117
- const m = a.getMergeData().filter((l) => R.contains(r, l)), d = m.map((l) => l.startRow), { startRow: b, endRow: j } = r, x = n ? b + 1 : b, S = [], A = [];
118
- for (let l = x; l <= j; l++)
119
- a.getRowFiltered(l) || a.getRowRawVisible(l) !== !1 && (m.length && !d.includes(l) || (S.push({
120
- index: l,
121
- value: ce(a, l, o)
122
- }), A.push(l)));
123
- const V = c.getAllCompareFns();
124
- S.sort(ae(o, le(V)));
125
- const F = {};
126
- S.forEach(({ index: l, value: Se }, B) => {
127
- F[A[B]] = l;
119
+ const mergeDataInRange = worksheet.getMergeData().filter((mergeData) => Rectangle.contains(range, mergeData)), mergeMainRowIndexes = mergeDataInRange.map((mergeData) => mergeData.startRow), { startRow: rangeStartRow, endRow } = range, startRow = hasTitle ? rangeStartRow + 1 : rangeStartRow, toReorder = [], oldOrder = [];
120
+ for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++)
121
+ worksheet.getRowFiltered(rowIndex) || worksheet.getRowRawVisible(rowIndex) !== !1 && (mergeDataInRange.length && !mergeMainRowIndexes.includes(rowIndex) || (toReorder.push({
122
+ index: rowIndex,
123
+ value: getRowCellData(worksheet, rowIndex, orderRules)
124
+ }), oldOrder.push(rowIndex)));
125
+ const compareFns = sortService.getAllCompareFns();
126
+ toReorder.sort(reorderFnGenerator(orderRules, combineCompareFnsAsOne(compareFns)));
127
+ const order = {};
128
+ toReorder.forEach(({ index, value }, oldIndex) => {
129
+ order[oldOrder[oldIndex]] = index;
128
130
  });
129
- const L = {
130
- id: Z.id,
131
+ const reorderRangeCommand = {
132
+ id: ReorderRangeCommand.id,
131
133
  params: {
132
- unitId: s,
133
- subUnitId: i,
134
- range: r,
135
- order: F
134
+ unitId,
135
+ subUnitId,
136
+ range,
137
+ order
136
138
  }
137
- }, G = e.get(I);
138
- return W([L], G).result;
139
- }
139
+ }, commandService = accessor.get(ICommandService);
140
+ return sequenceExecute([reorderRangeCommand], commandService).result;
141
+ }, "handler")
140
142
  };
141
- function ce(e, t, r) {
142
- const o = [];
143
- return r.forEach(({ colIndex: n }) => {
144
- o.push(e.getCellRaw(t, n));
145
- }), o;
143
+ function getRowCellData(worksheet, rowIndex, orderRules) {
144
+ const result = [];
145
+ return orderRules.forEach(({ colIndex }) => {
146
+ result.push(worksheet.getCellRaw(rowIndex, colIndex));
147
+ }), result;
146
148
  }
147
- function le(e) {
148
- return (t, r, o) => {
149
- for (let n = 0; n < e.length; n++) {
150
- const s = e[n](t, r, o);
151
- if (s != null)
152
- return s;
149
+ __name(getRowCellData, "getRowCellData");
150
+ function combineCompareFnsAsOne(compareFns) {
151
+ return (type, a, b) => {
152
+ for (let i = 0; i < compareFns.length; i++) {
153
+ const res = compareFns[i](type, a, b);
154
+ if (res != null)
155
+ return res;
153
156
  }
154
157
  return 0;
155
158
  };
156
159
  }
157
- function ae(e, t) {
158
- return function(r, o) {
159
- let n = null;
160
- for (let s = 0; s < e.length; s++) {
161
- const i = r.value[s], c = o.value[s];
162
- if (n = t(e[s].type, i, c), n !== 0 && n !== null && n !== void 0)
163
- return n;
160
+ __name(combineCompareFnsAsOne, "combineCompareFnsAsOne");
161
+ function reorderFnGenerator(orderRules, valueCompare) {
162
+ return function(a, b) {
163
+ let ret = null;
164
+ for (let index = 0; index < orderRules.length; index++) {
165
+ const aCellData = a.value[index], bCellData = b.value[index];
166
+ if (ret = valueCompare(orderRules[index].type, aCellData, bCellData), ret !== 0 && ret !== null && ret !== void 0)
167
+ return ret;
164
168
  }
165
169
  return 0;
166
170
  };
167
171
  }
168
- var fe = Object.defineProperty, me = Object.getOwnPropertyDescriptor, ge = (e, t, r, o) => {
169
- for (var n = o > 1 ? void 0 : o ? me(t, r) : t, s = e.length - 1, i; s >= 0; s--)
170
- (i = e[s]) && (n = (o ? i(t, r, n) : i(n)) || n);
171
- return o && n && fe(t, r, n), n;
172
- }, O = (e, t) => (r, o) => t(r, o, e);
173
- let v = class extends y {
174
- constructor(e, t) {
175
- super(), this._commandService = e, this._sortService = t, this._initCommands(), this._registerCompareFns();
172
+ __name(reorderFnGenerator, "reorderFnGenerator");
173
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
174
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
175
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
176
+ return kind && result && __defProp$1(target, key, result), result;
177
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a2;
178
+ let SheetsSortController = (_a2 = class extends Disposable {
179
+ constructor(_commandService, _sortService) {
180
+ super(), this._commandService = _commandService, this._sortService = _sortService, this._initCommands(), this._registerCompareFns();
176
181
  }
177
182
  _initCommands() {
178
183
  [
179
- $
180
- ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
184
+ SortRangeCommand
185
+ ].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
181
186
  }
182
187
  _registerCompareFns() {
183
- const e = (t, r, o) => {
184
- const n = this._getCommonValue(r), s = this._getCommonValue(o), i = [
185
- te,
186
- ne,
187
- re
188
+ const commonFn = /* @__PURE__ */ __name((type, a, b) => {
189
+ const valueA = this._getCommonValue(a), valueB = this._getCommonValue(b), compareTypeFns = [
190
+ compareNull,
191
+ compareString,
192
+ compareNumber
188
193
  ];
189
- for (let c = 0; c < i.length; c++) {
190
- const u = i[c](n, s, t);
191
- if (u !== null)
192
- return u;
194
+ for (let i = 0; i < compareTypeFns.length; i++) {
195
+ const res = compareTypeFns[i](valueA, valueB, type);
196
+ if (res !== null)
197
+ return res;
193
198
  }
194
199
  return null;
195
- };
196
- this._sortService.registerCompareFn(e);
200
+ }, "commonFn");
201
+ this._sortService.registerCompareFn(commonFn);
197
202
  }
198
- _getCommonValue(e) {
199
- var r, o;
200
- if (M(e))
203
+ _getCommonValue(a) {
204
+ var _a4, _b;
205
+ if (isNullValue(a))
201
206
  return null;
202
- const t = (o = (r = e == null ? void 0 : e.p) == null ? void 0 : r.body) == null ? void 0 : o.dataStream;
203
- return t || ((e == null ? void 0 : e.t) === C.NUMBER ? Number.parseFloat(`${e.v}`) : (e == null ? void 0 : e.t) === C.STRING ? typeof e.v == "number" ? e.v : `${e.v}` : (e == null ? void 0 : e.t) === C.BOOLEAN ? `${e.v}` : (e == null ? void 0 : e.t) === C.FORCE_STRING ? Number.parseFloat(`${e.v}`) : `${e == null ? void 0 : e.v}`);
204
- }
205
- };
206
- v = ge([
207
- O(0, I),
208
- O(1, w(g))
209
- ], v);
210
- var de = Object.defineProperty, he = Object.getOwnPropertyDescriptor, Ce = (e, t, r, o) => {
211
- for (var n = o > 1 ? void 0 : o ? he(t, r) : t, s = e.length - 1, i; s >= 0; s--)
212
- (i = e[s]) && (n = (o ? i(t, r, n) : i(n)) || n);
213
- return o && n && de(t, r, n), n;
214
- }, P = (e, t) => (r, o) => t(r, o, e);
215
- const _e = "SHEET_SORT_PLUGIN";
216
- var _;
217
- let E = (_ = class extends Y {
218
- constructor(e = N, t, r) {
219
- super(), this._config = e, this._injector = t, this._configService = r;
220
- const { ...o } = z(
207
+ const richTextValue = (_b = (_a4 = a == null ? void 0 : a.p) == null ? void 0 : _a4.body) == null ? void 0 : _b.dataStream;
208
+ return richTextValue || ((a == null ? void 0 : a.t) === CellValueType.NUMBER ? Number.parseFloat(`${a.v}`) : (a == null ? void 0 : a.t) === CellValueType.STRING ? typeof a.v == "number" ? a.v : `${a.v}` : (a == null ? void 0 : a.t) === CellValueType.BOOLEAN ? `${a.v}` : (a == null ? void 0 : a.t) === CellValueType.FORCE_STRING ? Number.parseFloat(`${a.v}`) : `${a == null ? void 0 : a.v}`);
209
+ }
210
+ }, __name(_a2, "SheetsSortController"), _a2);
211
+ SheetsSortController = __decorateClass$1([
212
+ __decorateParam$1(0, ICommandService),
213
+ __decorateParam$1(1, Inject(SheetsSortService))
214
+ ], SheetsSortController);
215
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
216
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
217
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
218
+ return kind && result && __defProp2(target, key, result), result;
219
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
220
+ const NAME = "SHEET_SORT_PLUGIN";
221
+ var _a3;
222
+ let UniverSheetsSortPlugin = (_a3 = class extends Plugin {
223
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
224
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
225
+ const { ...rest } = merge(
221
226
  {},
222
- N,
227
+ defaultPluginConfig,
223
228
  this._config
224
229
  );
225
- this._configService.setConfig(ee, o);
230
+ this._configService.setConfig(SHEETS_SORT_PLUGIN_CONFIG_KEY, rest);
226
231
  }
227
232
  onStarting() {
228
233
  [
229
- [v],
230
- [g]
231
- ].forEach((e) => this._injector.add(e));
234
+ [SheetsSortController],
235
+ [SheetsSortService]
236
+ ].forEach((d) => this._injector.add(d));
232
237
  }
233
238
  onReady() {
234
- this._injector.get(v);
239
+ this._injector.get(SheetsSortController);
235
240
  }
236
- }, h(_, "type", J.UNIVER_SHEET), h(_, "pluginName", _e), _);
237
- E = Ce([
238
- P(1, w(Q)),
239
- P(2, X)
240
- ], E);
241
+ }, __name(_a3, "UniverSheetsSortPlugin"), __publicField(_a3, "type", UniverInstanceType.UNIVER_SHEET), __publicField(_a3, "pluginName", NAME), _a3);
242
+ UniverSheetsSortPlugin = __decorateClass([
243
+ __decorateParam(1, Inject(Injector)),
244
+ __decorateParam(2, IConfigService)
245
+ ], UniverSheetsSortPlugin);
241
246
  export {
242
- g as SheetsSortService,
243
- $ as SortRangeCommand,
244
- f as SortType,
245
- E as UniverSheetsSortPlugin
247
+ SheetsSortService,
248
+ SortRangeCommand,
249
+ SortType,
250
+ UniverSheetsSortPlugin
246
251
  };
@@ -1,4 +1,4 @@
1
- const o = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "Sort",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const o = {
14
14
  }
15
15
  };
16
16
  export {
17
- o as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const t = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "مرتب‌سازی",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const t = {
14
14
  }
15
15
  };
16
16
  export {
17
- t as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const r = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "Trier",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const r = {
14
14
  }
15
15
  };
16
16
  export {
17
- r as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const o = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "Sort",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const o = {
14
14
  }
15
15
  };
16
16
  export {
17
- o as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const o = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "Sort",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const o = {
14
14
  }
15
15
  };
16
16
  export {
17
- o as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const t = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "排序",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const t = {
14
14
  }
15
15
  };
16
16
  export {
17
- t as default
17
+ locale as default
18
18
  };
@@ -1,4 +1,4 @@
1
- const t = {
1
+ const locale = {
2
2
  sheetsSort: {
3
3
  title: "Sắp xếp",
4
4
  toolbar: {
@@ -14,5 +14,5 @@ const t = {
14
14
  }
15
15
  };
16
16
  export {
17
- t as default
17
+ locale as default
18
18
  };
@@ -1,10 +1,12 @@
1
1
  import { IEventBase, FEventName } from '@univerjs/core';
2
2
  import { FRange, FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
3
+ /**
4
+ * @ignore
5
+ */
3
6
  export interface IFSheetSortEventMixin {
4
7
  /**
5
8
  * This event will be emitted when a range on a worksheet is sorted.
6
9
  * Type of the event is {@link ISheetRangeSortedParams}.
7
- *
8
10
  * @example
9
11
  * ```typescript
10
12
  * const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeSorted, (params) => {
@@ -19,7 +21,6 @@ export interface IFSheetSortEventMixin {
19
21
  /**
20
22
  * This event will be emitted before sorting a range on a worksheet.
21
23
  * Type of the event is {@link ISheetRangeSortParams}.
22
- *
23
24
  * @example
24
25
  * ```typescript
25
26
  * const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeSort, (params) => {
@@ -3,14 +3,14 @@ export type SortColumnSpec = {
3
3
  column: number;
4
4
  ascending: boolean;
5
5
  } | number;
6
+ /**
7
+ * @ignore
8
+ */
6
9
  export interface IFRangeSort {
7
10
  /**
8
11
  * Sorts the cells in the given range, by column(s) and order specified.
9
- *
10
12
  * @param {SortColumnSpec | SortColumnSpec[]} column The column index with order or an array of column indexes with order. The column index starts from 1.
11
- *
12
13
  * @returns The range itself for chaining.
13
- *
14
14
  * @example
15
15
  * ```typescript
16
16
  * const activeSpreadsheet = univerAPI.getActiveWorkbook();
@@ -1,12 +1,13 @@
1
1
  import { FWorksheet } from '@univerjs/sheets/facade';
2
+ /**
3
+ * @ignore
4
+ */
2
5
  export interface IFWorksheetSort {
3
6
  /**
4
7
  * Sort the worksheet by the specified column.
5
- *
6
8
  * @param {number} colIndex The column index to sort by. which starts from 1.
7
9
  * @param {boolean} [asc=true] The sort order. `true` for ascending, `false` for descending.
8
10
  * @returns The worksheet itself for chaining.
9
- *
10
11
  * @example
11
12
  * ```typescript
12
13
  * const activeSpreadsheet = univerAPI.getActiveWorkbook();