@univerjs/sheets-crosshair-highlight 0.10.12 → 0.10.13-nightly.202510290902
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/cjs/index.js +1 -1
- package/lib/es/index.js +221 -203
- package/lib/index.js +221 -203
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { BehaviorSubject as
|
|
6
|
-
import { Shape as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { SheetsSelectionsService as
|
|
12
|
-
import { SheetSkeletonManagerService as
|
|
13
|
-
const
|
|
1
|
+
var X = Object.defineProperty;
|
|
2
|
+
var z = (s, e, t) => e in s ? X(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var c = (s, e, t) => z(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Disposable as E, CommandType as b, UniverInstanceType as O, Inject as d, ICommandService as K, RANGE_TYPE as u, Rectangle as M, IContextService as q, ColorKit as J, Plugin as Q, merge as ee, Injector as te, IConfigService as re } from "@univerjs/core";
|
|
5
|
+
import { BehaviorSubject as y, combineLatest as se, merge as T, startWith as ie, tap as ne, map as x } from "rxjs";
|
|
6
|
+
import { Shape as oe, Rect as ae, IRenderManagerService as ce } from "@univerjs/engine-render";
|
|
7
|
+
import { useRef as le, createElement as A, forwardRef as he, useCallback as ge } from "react";
|
|
8
|
+
import { useDependency as de, useObservable as ue, getMenuHiddenObservable as _e, MenuItemType as fe, ContextMenuPosition as Se, ContextMenuGroup as pe, ComponentManager as ve, IMenuManagerService as Ce } from "@univerjs/ui";
|
|
9
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
10
|
+
import { clsx as me, borderClassName as Re } from "@univerjs/design";
|
|
11
|
+
import { SheetsSelectionsService as be, IRefSelectionsService as He, REF_SELECTIONS_ENABLED as Ie } from "@univerjs/sheets";
|
|
12
|
+
import { SheetSkeletonManagerService as Oe, getCoordByCell as V } from "@univerjs/sheets-ui";
|
|
13
|
+
const j = [
|
|
14
14
|
"rgba(158, 109, 227, 0.3)",
|
|
15
15
|
"rgba(254, 75, 75, 0.3)",
|
|
16
16
|
"rgba(255, 140, 81, 0.3)",
|
|
@@ -28,12 +28,12 @@ const G = [
|
|
|
28
28
|
"rgba(242, 72, 166, 0.15)",
|
|
29
29
|
"rgba(153, 153, 153, 0.15)"
|
|
30
30
|
];
|
|
31
|
-
class
|
|
31
|
+
class h extends E {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
|
-
c(this, "_enabled$", new
|
|
34
|
+
c(this, "_enabled$", new y(!1));
|
|
35
35
|
c(this, "enabled$", this._enabled$.asObservable());
|
|
36
|
-
c(this, "_color$", new
|
|
36
|
+
c(this, "_color$", new y(j[0]));
|
|
37
37
|
c(this, "color$", this._color$.asObservable());
|
|
38
38
|
}
|
|
39
39
|
get enabled() {
|
|
@@ -52,174 +52,192 @@ class g extends y {
|
|
|
52
52
|
this._color$.next(t);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const $ = {
|
|
56
56
|
id: "sheet.operation.toggle-crosshair-highlight",
|
|
57
|
-
type:
|
|
58
|
-
handler(
|
|
59
|
-
const e =
|
|
57
|
+
type: b.OPERATION,
|
|
58
|
+
handler(s) {
|
|
59
|
+
const e = s.get(h), t = e.enabled;
|
|
60
60
|
return e.setEnabled(!t), !0;
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, k = {
|
|
63
63
|
id: "sheet.operation.set-crosshair-highlight-color",
|
|
64
|
-
type:
|
|
65
|
-
handler(
|
|
66
|
-
const t =
|
|
64
|
+
type: b.OPERATION,
|
|
65
|
+
handler(s, { value: e }) {
|
|
66
|
+
const t = s.get(h);
|
|
67
67
|
return t.enabled || t.setEnabled(!0), t.setColor(e), !0;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, Ee = {
|
|
70
70
|
id: "sheet.operation.enable-crosshair-highlight",
|
|
71
|
-
type:
|
|
72
|
-
handler(
|
|
73
|
-
const e =
|
|
71
|
+
type: b.OPERATION,
|
|
72
|
+
handler(s) {
|
|
73
|
+
const e = s.get(h);
|
|
74
74
|
return e.enabled ? !1 : (e.setEnabled(!0), !0);
|
|
75
75
|
}
|
|
76
|
-
},
|
|
76
|
+
}, $e = {
|
|
77
77
|
id: "sheet.operation.disable-crosshair-highlight",
|
|
78
|
-
type:
|
|
79
|
-
handler(
|
|
80
|
-
const e =
|
|
78
|
+
type: b.OPERATION,
|
|
79
|
+
handler(s) {
|
|
80
|
+
const e = s.get(h);
|
|
81
81
|
return e.enabled ? (e.setEnabled(!1), !0) : !1;
|
|
82
82
|
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return B(t, "".concat(r), { defIds: t.defIds, idSuffix: h.current }, l({ ref: e, className: a }, o), s);
|
|
102
|
-
});
|
|
103
|
-
function B(n, e, t, r, i) {
|
|
104
|
-
return A(n.tag, l(l({ key: e }, xe(n, t, i)), r), (Te(n, t).children || []).map(function(s, o) {
|
|
105
|
-
return B(s, "".concat(e, "-").concat(n.tag, "-").concat(o), t, void 0, i);
|
|
106
|
-
}));
|
|
83
|
+
}, we = "sheets-crosshair-highlight.config", L = {};
|
|
84
|
+
function G({ ref: s, ...e }) {
|
|
85
|
+
const { icon: t, id: r, className: i, extend: n, ...o } = e, a = `univerjs-icon univerjs-icon-${r} ${i || ""}`.trim(), l = le(`_${Te()}`);
|
|
86
|
+
return U(t, `${r}`, {
|
|
87
|
+
defIds: t.defIds,
|
|
88
|
+
idSuffix: l.current
|
|
89
|
+
}, {
|
|
90
|
+
ref: s,
|
|
91
|
+
className: a,
|
|
92
|
+
...o
|
|
93
|
+
}, n);
|
|
94
|
+
}
|
|
95
|
+
function U(s, e, t, r, i) {
|
|
96
|
+
return A(s.tag, {
|
|
97
|
+
key: e,
|
|
98
|
+
...Me(s, t, i),
|
|
99
|
+
...r
|
|
100
|
+
}, (ye(s, t).children || []).map((n, o) => U(n, `${e}-${s.tag}-${o}`, t, void 0, i)));
|
|
107
101
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1),
|
|
111
|
-
|
|
112
|
-
o === "mask" && typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
102
|
+
function Me(s, e, t) {
|
|
103
|
+
const r = { ...s.attrs };
|
|
104
|
+
t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1), s.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(([n, o]) => {
|
|
105
|
+
n === "mask" && typeof o == "string" && (r[n] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
113
106
|
});
|
|
114
|
-
|
|
115
|
-
return !i || i.length === 0 || (
|
|
116
|
-
|
|
117
|
-
typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
107
|
+
const { defIds: i } = e;
|
|
108
|
+
return !i || i.length === 0 || (s.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(([n, o]) => {
|
|
109
|
+
typeof o == "string" && (r[n] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
118
110
|
})), r;
|
|
119
111
|
}
|
|
120
|
-
function
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
function ye(s, e) {
|
|
113
|
+
var r;
|
|
114
|
+
const { defIds: t } = e;
|
|
115
|
+
return !t || t.length === 0 ? s : s.tag === "defs" && ((r = s.children) != null && r.length) ? {
|
|
116
|
+
...s,
|
|
117
|
+
children: s.children.map((i) => typeof i.attrs.id == "string" && t && t.includes(i.attrs.id) ? {
|
|
118
|
+
...i,
|
|
119
|
+
attrs: {
|
|
120
|
+
...i.attrs,
|
|
121
|
+
id: i.attrs.id + e.idSuffix
|
|
122
|
+
}
|
|
123
|
+
} : i)
|
|
124
|
+
} : s;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Te() {
|
|
127
127
|
return Math.random().toString(36).substring(2, 8);
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
G.displayName = "UniverIcon";
|
|
130
|
+
const xe = {
|
|
131
|
+
tag: "svg",
|
|
132
|
+
attrs: {
|
|
133
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
134
|
+
fill: "none",
|
|
135
|
+
viewBox: "0 0 16 16",
|
|
136
|
+
width: "1em",
|
|
137
|
+
height: "1em"
|
|
138
|
+
},
|
|
139
|
+
children: [{
|
|
140
|
+
tag: "path",
|
|
141
|
+
attrs: {
|
|
142
|
+
fill: "currentColor",
|
|
143
|
+
d: "M3.6498 1.05005C2.21386 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V3.65005C14.9498 2.21411 13.7857 1.05005 12.3498 1.05005H3.6498ZM5.4002 2.25005H3.6498C2.87661 2.25005 2.2498 2.87685 2.2498 3.65005V5.40002H5.4002V2.25005ZM2.2498 10.6V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H5.4002V10.6H2.2498ZM6.60019 13.75H9.4002V9.40002H13.7498V6.60002H9.4002V2.25005H6.60019V6.60002H2.25029V9.40002H6.60019V13.75ZM10.6002 2.25005V5.40002H13.7498V3.65005C13.7498 2.87685 13.123 2.25005 12.3498 2.25005H10.6002ZM13.7498 10.6H10.6002V13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.6Z",
|
|
144
|
+
fillRule: "evenodd",
|
|
145
|
+
clipRule: "evenodd"
|
|
146
|
+
}
|
|
147
|
+
}]
|
|
148
|
+
}, D = he(function(e, t) {
|
|
149
|
+
return A(G, Object.assign({}, e, {
|
|
132
150
|
id: "cross-highlighting-icon",
|
|
133
|
-
ref:
|
|
134
|
-
icon:
|
|
151
|
+
ref: t,
|
|
152
|
+
icon: xe
|
|
135
153
|
}));
|
|
136
154
|
});
|
|
137
|
-
|
|
138
|
-
function
|
|
139
|
-
const { onChange: e } =
|
|
140
|
-
e == null || e(
|
|
155
|
+
D.displayName = "CrossHighlightingIcon";
|
|
156
|
+
function Ne(s) {
|
|
157
|
+
const { onChange: e } = s, t = de(h), r = ue(t.color$), i = ge((n) => {
|
|
158
|
+
e == null || e(n);
|
|
141
159
|
}, [e]);
|
|
142
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ N("div", { className: "univer-grid univer-grid-cols-8 univer-gap-x-2 univer-gap-y-3", children: j.map((n) => /* @__PURE__ */ N(
|
|
143
161
|
"div",
|
|
144
162
|
{
|
|
145
|
-
className:
|
|
146
|
-
"univer-ring-[1.5px] univer-ring-primary-600 hover:univer-ring-primary-600":
|
|
163
|
+
className: me("hover:univer-ring-primary-600/40 hover:univer-ring-[1.5px] univer-box-border univer-size-5 univer-cursor-pointer univer-rounded univer-ring-offset-1 univer-transition-shadow", Re, {
|
|
164
|
+
"univer-ring-[1.5px] univer-ring-primary-600 hover:univer-ring-primary-600": n === r
|
|
147
165
|
}),
|
|
148
|
-
style: { backgroundColor:
|
|
149
|
-
onClick: () => i(
|
|
166
|
+
style: { backgroundColor: n },
|
|
167
|
+
onClick: () => i(n)
|
|
150
168
|
},
|
|
151
|
-
|
|
169
|
+
n
|
|
152
170
|
)) });
|
|
153
171
|
}
|
|
154
|
-
const
|
|
155
|
-
function
|
|
156
|
-
const e =
|
|
172
|
+
const B = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
|
|
173
|
+
function Ve(s) {
|
|
174
|
+
const e = s.get(h);
|
|
157
175
|
return {
|
|
158
|
-
id:
|
|
176
|
+
id: $.id,
|
|
159
177
|
tooltip: "crosshair.button.tooltip",
|
|
160
178
|
type: fe.BUTTON_SELECTOR,
|
|
161
179
|
icon: "CrossHighlightingIcon",
|
|
162
180
|
selections: [
|
|
163
181
|
{
|
|
164
182
|
label: {
|
|
165
|
-
name:
|
|
183
|
+
name: B,
|
|
166
184
|
hoverable: !1,
|
|
167
185
|
selectable: !1
|
|
168
186
|
}
|
|
169
187
|
}
|
|
170
188
|
],
|
|
171
|
-
selectionsCommandId:
|
|
189
|
+
selectionsCommandId: k.id,
|
|
172
190
|
activated$: e.enabled$,
|
|
173
|
-
hidden$:
|
|
191
|
+
hidden$: _e(s, O.UNIVER_SHEET)
|
|
174
192
|
};
|
|
175
193
|
}
|
|
176
194
|
const Le = {
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
[
|
|
195
|
+
[Se.FOOTER_MENU]: {
|
|
196
|
+
[pe.OTHERS]: {
|
|
197
|
+
[$.id]: {
|
|
180
198
|
order: 0,
|
|
181
|
-
menuItemFactory:
|
|
199
|
+
menuItemFactory: Ve
|
|
182
200
|
}
|
|
183
201
|
}
|
|
184
202
|
}
|
|
185
203
|
};
|
|
186
|
-
var
|
|
187
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
188
|
-
(o = n
|
|
204
|
+
var Pe = Object.getOwnPropertyDescriptor, Ae = (s, e, t, r) => {
|
|
205
|
+
for (var i = r > 1 ? void 0 : r ? Pe(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
|
206
|
+
(o = s[n]) && (i = o(i) || i);
|
|
189
207
|
return i;
|
|
190
|
-
},
|
|
191
|
-
let
|
|
192
|
-
constructor(
|
|
193
|
-
super(), this._componentMgr =
|
|
208
|
+
}, H = (s, e) => (t, r) => e(t, r, s);
|
|
209
|
+
let m = class extends E {
|
|
210
|
+
constructor(s, e, t) {
|
|
211
|
+
super(), this._componentMgr = s, this._menuManagerService = e, this._cmdSrv = t, this._initCommands(), this._initMenus(), this._initComponents();
|
|
194
212
|
}
|
|
195
213
|
_initCommands() {
|
|
196
214
|
[
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
].forEach((
|
|
215
|
+
$,
|
|
216
|
+
k,
|
|
217
|
+
Ee,
|
|
218
|
+
$e
|
|
219
|
+
].forEach((s) => this._cmdSrv.registerCommand(s));
|
|
202
220
|
}
|
|
203
221
|
_initMenus() {
|
|
204
222
|
this._menuManagerService.mergeMenu(Le);
|
|
205
223
|
}
|
|
206
224
|
_initComponents() {
|
|
207
|
-
this._componentMgr.register(
|
|
225
|
+
this._componentMgr.register(B, Ne), this._componentMgr.register("CrossHighlightingIcon", D);
|
|
208
226
|
}
|
|
209
227
|
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
],
|
|
215
|
-
const
|
|
216
|
-
class
|
|
228
|
+
m = Ae([
|
|
229
|
+
H(0, d(ve)),
|
|
230
|
+
H(1, Ce),
|
|
231
|
+
H(2, K)
|
|
232
|
+
], m);
|
|
233
|
+
const je = 1;
|
|
234
|
+
class ke {
|
|
217
235
|
constructor() {
|
|
218
236
|
c(this, "_selectedRanges", []);
|
|
219
237
|
c(this, "_ranges", []);
|
|
220
238
|
}
|
|
221
239
|
addRange(e) {
|
|
222
|
-
if (e.rangeType ===
|
|
240
|
+
if (e.rangeType === u.COLUMN || e.rangeType === u.ROW || e.rangeType === u.ALL)
|
|
223
241
|
return;
|
|
224
242
|
const t = this._getIntersects(e), r = this._getSplitRanges(e, t);
|
|
225
243
|
r.length > 0 && this._ranges.push(...r);
|
|
@@ -230,19 +248,19 @@ class Ue {
|
|
|
230
248
|
_getSplitRanges(e, t) {
|
|
231
249
|
let r = [e];
|
|
232
250
|
for (const i of t.concat(this._selectedRanges)) {
|
|
233
|
-
const
|
|
251
|
+
const n = [];
|
|
234
252
|
for (const o of r) {
|
|
235
|
-
const a =
|
|
236
|
-
a && a.length > 0 &&
|
|
253
|
+
const a = M.subtract(o, i);
|
|
254
|
+
a && a.length > 0 && n.push(...a);
|
|
237
255
|
}
|
|
238
|
-
r =
|
|
256
|
+
r = n;
|
|
239
257
|
}
|
|
240
258
|
return r.filter((i) => i.startRow <= i.endRow && i.startColumn <= i.endColumn);
|
|
241
259
|
}
|
|
242
260
|
_getIntersects(e) {
|
|
243
261
|
const t = [];
|
|
244
262
|
for (const r of this._ranges) {
|
|
245
|
-
const i =
|
|
263
|
+
const i = M.getIntersects(r, e);
|
|
246
264
|
i && t.push(i);
|
|
247
265
|
}
|
|
248
266
|
return t;
|
|
@@ -254,7 +272,7 @@ class Ue {
|
|
|
254
272
|
this._ranges = [], this._selectedRanges = [];
|
|
255
273
|
}
|
|
256
274
|
}
|
|
257
|
-
class
|
|
275
|
+
class Ge extends oe {
|
|
258
276
|
constructor(t, r) {
|
|
259
277
|
super(t, r);
|
|
260
278
|
// protected _showHighLight = false;
|
|
@@ -268,9 +286,9 @@ class De extends ce {
|
|
|
268
286
|
});
|
|
269
287
|
}
|
|
270
288
|
_draw(t) {
|
|
271
|
-
var i,
|
|
272
|
-
const r = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${(
|
|
273
|
-
|
|
289
|
+
var i, n;
|
|
290
|
+
const r = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${(n = (i = this._color) == null ? void 0 : i.a) != null ? n : 0.5})`;
|
|
291
|
+
ae.drawWith(t, {
|
|
274
292
|
width: this.width,
|
|
275
293
|
height: this.height,
|
|
276
294
|
fill: r,
|
|
@@ -280,84 +298,84 @@ class De extends ce {
|
|
|
280
298
|
});
|
|
281
299
|
}
|
|
282
300
|
}
|
|
283
|
-
var
|
|
284
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
285
|
-
(o = n
|
|
301
|
+
var Ue = Object.getOwnPropertyDescriptor, De = (s, e, t, r) => {
|
|
302
|
+
for (var i = r > 1 ? void 0 : r ? Ue(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
|
303
|
+
(o = s[n]) && (i = o(i) || i);
|
|
286
304
|
return i;
|
|
287
|
-
}, S = (
|
|
288
|
-
let R = class extends
|
|
289
|
-
constructor(e, t, r, i,
|
|
305
|
+
}, S = (s, e) => (t, r) => e(t, r, s);
|
|
306
|
+
let R = class extends E {
|
|
307
|
+
constructor(e, t, r, i, n, o) {
|
|
290
308
|
super();
|
|
291
309
|
c(this, "_shapes", []);
|
|
292
|
-
c(this, "_rangeCollection", new
|
|
310
|
+
c(this, "_rangeCollection", new ke());
|
|
293
311
|
c(this, "_color", "rgba(255,0,0,0.5)");
|
|
294
|
-
this._context = e, this._sheetSkeletonManagerService = t, this._sheetsSelectionsService = r, this._sheetsCrosshairHighlightService = i, this._contextService =
|
|
312
|
+
this._context = e, this._sheetSkeletonManagerService = t, this._sheetsSelectionsService = r, this._sheetsCrosshairHighlightService = i, this._contextService = n, this._refSelectionsService = o, this._initRenderListener();
|
|
295
313
|
}
|
|
296
314
|
_transformSelection(e, t) {
|
|
297
315
|
if (!e)
|
|
298
316
|
return;
|
|
299
|
-
const r = t.getRowCount(), i = t.getColumnCount(),
|
|
317
|
+
const r = t.getRowCount(), i = t.getColumnCount(), n = [];
|
|
300
318
|
for (const o of e) {
|
|
301
|
-
const { startRow: a, endRow:
|
|
302
|
-
|
|
319
|
+
const { startRow: a, endRow: l, startColumn: _, endColumn: f } = o.range;
|
|
320
|
+
l - a + 1 === r || f - _ + 1 === i || n.push(o.range);
|
|
303
321
|
}
|
|
304
|
-
this._rangeCollection.setSelectedRanges(
|
|
305
|
-
for (const o of
|
|
322
|
+
this._rangeCollection.setSelectedRanges(n);
|
|
323
|
+
for (const o of n)
|
|
306
324
|
this.addSelection(o, t);
|
|
307
325
|
}
|
|
308
326
|
_initRenderListener() {
|
|
309
327
|
const e = this._context.unit;
|
|
310
328
|
this.disposeWithMe(se([
|
|
311
|
-
this._contextService.subscribeContextValue$(Ie).pipe(
|
|
329
|
+
this._contextService.subscribeContextValue$(Ie).pipe(ie(!1)),
|
|
312
330
|
this._sheetSkeletonManagerService.currentSkeleton$,
|
|
313
331
|
this._sheetsCrosshairHighlightService.enabled$,
|
|
314
|
-
this._sheetsCrosshairHighlightService.color$.pipe(
|
|
332
|
+
this._sheetsCrosshairHighlightService.color$.pipe(ne((t) => this._color = t)),
|
|
315
333
|
T(
|
|
316
334
|
this._sheetsSelectionsService.selectionMoveStart$,
|
|
317
335
|
this._sheetsSelectionsService.selectionMoving$,
|
|
318
336
|
this._sheetsSelectionsService.selectionMoveEnd$,
|
|
319
337
|
this._sheetsSelectionsService.selectionSet$,
|
|
320
|
-
e.activeSheet$.pipe(
|
|
338
|
+
e.activeSheet$.pipe(x(() => this._sheetsSelectionsService.getCurrentSelections()))
|
|
321
339
|
),
|
|
322
340
|
T(
|
|
323
341
|
this._refSelectionsService.selectionMoveStart$,
|
|
324
342
|
this._refSelectionsService.selectionMoving$,
|
|
325
343
|
this._refSelectionsService.selectionMoveEnd$,
|
|
326
344
|
this._sheetsSelectionsService.selectionSet$,
|
|
327
|
-
e.activeSheet$.pipe(
|
|
345
|
+
e.activeSheet$.pipe(x(() => this._refSelectionsService.getCurrentSelections()))
|
|
328
346
|
)
|
|
329
|
-
]).subscribe(([t, r, i,
|
|
347
|
+
]).subscribe(([t, r, i, n, o, a]) => {
|
|
330
348
|
if (this._clear(), !i) return;
|
|
331
|
-
const
|
|
332
|
-
this._rangeCollection.reset(), this._transformSelection(
|
|
349
|
+
const l = t ? a : o;
|
|
350
|
+
this._rangeCollection.reset(), this._transformSelection(l, e.getActiveSheet()), this.render(this._rangeCollection.getRanges());
|
|
333
351
|
}));
|
|
334
352
|
}
|
|
335
353
|
addSelection(e, t) {
|
|
336
|
-
if (e.rangeType ===
|
|
354
|
+
if (e.rangeType === u.COLUMN || e.rangeType === u.ROW || e.rangeType === u.ALL)
|
|
337
355
|
return;
|
|
338
|
-
const r = t.getRowCount(), i = t.getColumnCount(), { startRow:
|
|
339
|
-
startRow:
|
|
356
|
+
const r = t.getRowCount(), i = t.getColumnCount(), { startRow: n, endRow: o, startColumn: a, endColumn: l } = e, _ = {
|
|
357
|
+
startRow: n,
|
|
340
358
|
endRow: o,
|
|
341
359
|
startColumn: 0,
|
|
342
360
|
endColumn: a - 1
|
|
343
|
-
},
|
|
344
|
-
startRow:
|
|
361
|
+
}, f = {
|
|
362
|
+
startRow: n,
|
|
345
363
|
endRow: o,
|
|
346
|
-
startColumn:
|
|
364
|
+
startColumn: l + 1,
|
|
347
365
|
endColumn: i
|
|
348
366
|
}, p = {
|
|
349
367
|
startRow: 0,
|
|
350
|
-
endRow:
|
|
368
|
+
endRow: n - 1,
|
|
351
369
|
startColumn: a,
|
|
352
|
-
endColumn:
|
|
353
|
-
},
|
|
370
|
+
endColumn: l
|
|
371
|
+
}, v = {
|
|
354
372
|
startRow: o + 1,
|
|
355
373
|
endRow: r,
|
|
356
374
|
startColumn: a,
|
|
357
|
-
endColumn:
|
|
375
|
+
endColumn: l
|
|
358
376
|
};
|
|
359
|
-
for (const
|
|
360
|
-
|
|
377
|
+
for (const g of [_, f, p, v])
|
|
378
|
+
g.startRow <= g.endRow && g.startColumn <= g.endColumn && this._rangeCollection.addRange(g);
|
|
361
379
|
}
|
|
362
380
|
_clear() {
|
|
363
381
|
this._shapes.forEach((e) => {
|
|
@@ -365,16 +383,16 @@ let R = class extends y {
|
|
|
365
383
|
}), this._shapes = [];
|
|
366
384
|
}
|
|
367
385
|
_addShapes(e, t, r, i) {
|
|
368
|
-
const { startRow:
|
|
386
|
+
const { startRow: n, endRow: o, startColumn: a, endColumn: l } = e, _ = V(n, a, r, i), f = V(o, l, r, i), { startX: p, startY: v } = _, { endX: g, endY: Z } = f, W = g - p, Y = Z - v, F = {
|
|
369
387
|
left: p,
|
|
370
|
-
top:
|
|
371
|
-
color: new
|
|
372
|
-
width:
|
|
373
|
-
height:
|
|
374
|
-
zIndex:
|
|
388
|
+
top: v,
|
|
389
|
+
color: new J(this._color).toRgb(),
|
|
390
|
+
width: W,
|
|
391
|
+
height: Y,
|
|
392
|
+
zIndex: je,
|
|
375
393
|
evented: !1
|
|
376
|
-
},
|
|
377
|
-
this._shapes.push(
|
|
394
|
+
}, w = new Ge(`crosshair-${t}`, F);
|
|
395
|
+
this._shapes.push(w), r.addObject(w);
|
|
378
396
|
}
|
|
379
397
|
render(e) {
|
|
380
398
|
const t = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
@@ -383,8 +401,8 @@ let R = class extends y {
|
|
|
383
401
|
const { scene: r } = this._context;
|
|
384
402
|
this._clear();
|
|
385
403
|
for (let i = 0; i < e.length; i++) {
|
|
386
|
-
const
|
|
387
|
-
this._addShapes(
|
|
404
|
+
const n = e[i];
|
|
405
|
+
this._addShapes(n, i, r, t);
|
|
388
406
|
}
|
|
389
407
|
r.makeDirty(!0);
|
|
390
408
|
}
|
|
@@ -392,51 +410,51 @@ let R = class extends y {
|
|
|
392
410
|
super.dispose();
|
|
393
411
|
}
|
|
394
412
|
};
|
|
395
|
-
R =
|
|
396
|
-
S(1,
|
|
397
|
-
S(2,
|
|
398
|
-
S(3,
|
|
399
|
-
S(4,
|
|
400
|
-
S(5,
|
|
413
|
+
R = De([
|
|
414
|
+
S(1, d(Oe)),
|
|
415
|
+
S(2, d(be)),
|
|
416
|
+
S(3, d(h)),
|
|
417
|
+
S(4, d(q)),
|
|
418
|
+
S(5, He)
|
|
401
419
|
], R);
|
|
402
|
-
var
|
|
403
|
-
for (var i = r > 1 ? void 0 : r ?
|
|
404
|
-
(o = n
|
|
420
|
+
var Be = Object.getOwnPropertyDescriptor, Ze = (s, e, t, r) => {
|
|
421
|
+
for (var i = r > 1 ? void 0 : r ? Be(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
|
422
|
+
(o = s[n]) && (i = o(i) || i);
|
|
405
423
|
return i;
|
|
406
|
-
}, I = (
|
|
407
|
-
let
|
|
408
|
-
constructor(
|
|
409
|
-
super(), this._config =
|
|
410
|
-
const { ...i } =
|
|
424
|
+
}, I = (s, e) => (t, r) => e(t, r, s), C;
|
|
425
|
+
let P = (C = class extends Q {
|
|
426
|
+
constructor(s = L, e, t, r) {
|
|
427
|
+
super(), this._config = s, this._injector = e, this._renderManagerService = t, this._configService = r;
|
|
428
|
+
const { ...i } = ee(
|
|
411
429
|
{},
|
|
412
|
-
|
|
430
|
+
L,
|
|
413
431
|
this._config
|
|
414
432
|
);
|
|
415
|
-
this._configService.setConfig(
|
|
433
|
+
this._configService.setConfig(we, i);
|
|
416
434
|
}
|
|
417
435
|
onStarting() {
|
|
418
436
|
[
|
|
419
|
-
[
|
|
420
|
-
[
|
|
421
|
-
].forEach((
|
|
437
|
+
[h],
|
|
438
|
+
[m]
|
|
439
|
+
].forEach((s) => this._injector.add(s));
|
|
422
440
|
}
|
|
423
441
|
onReady() {
|
|
424
442
|
[
|
|
425
443
|
[R]
|
|
426
|
-
].forEach((
|
|
427
|
-
}
|
|
428
|
-
}, c(
|
|
429
|
-
|
|
430
|
-
I(1,
|
|
431
|
-
I(2,
|
|
432
|
-
I(3,
|
|
433
|
-
],
|
|
444
|
+
].forEach((s) => this._injector.add(s)), this._injector.get(m), this._renderManagerService.registerRenderModule(O.UNIVER_SHEET, [R]);
|
|
445
|
+
}
|
|
446
|
+
}, c(C, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), c(C, "type", O.UNIVER_SHEET), C);
|
|
447
|
+
P = Ze([
|
|
448
|
+
I(1, d(te)),
|
|
449
|
+
I(2, ce),
|
|
450
|
+
I(3, re)
|
|
451
|
+
], P);
|
|
434
452
|
export {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
453
|
+
j as CROSSHAIR_HIGHLIGHT_COLORS,
|
|
454
|
+
$e as DisableCrosshairHighlightOperation,
|
|
455
|
+
Ee as EnableCrosshairHighlightOperation,
|
|
456
|
+
k as SetCrosshairHighlightColorOperation,
|
|
457
|
+
h as SheetsCrosshairHighlightService,
|
|
458
|
+
$ as ToggleCrosshairHighlightOperation,
|
|
459
|
+
P as UniverSheetsCrosshairHighlightPlugin
|
|
442
460
|
};
|