@univerjs/sheets-crosshair-highlight 0.4.2-nightly.202411061606 → 0.4.2-nightly.202411081606
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/facade.js +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/facade.js +79 -15
- package/lib/es/index.js +336 -277
- package/lib/{locale → es/locale}/en-US.js +2 -2
- package/lib/{locale → es/locale}/fa-IR.js +2 -2
- package/lib/{locale → es/locale}/ru-RU.js +2 -2
- package/lib/{locale → es/locale}/vi-VN.js +2 -2
- package/lib/{locale → es/locale}/zh-CN.js +2 -2
- package/lib/{locale → es/locale}/zh-TW.js +2 -2
- package/lib/umd/index.js +1 -9
- package/package.json +23 -15
- package/lib/operation-8Cu0xxNn.mjs +0 -86
package/lib/es/index.js
CHANGED
|
@@ -1,201 +1,264 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { SheetSkeletonManagerService, getCoordByCell } from "@univerjs/sheets-ui";
|
|
11
|
-
import { SheetsSelectionsService, DISABLE_NORMAL_SELECTIONS, IRefSelectionsService } from "@univerjs/sheets";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
s =
|
|
17
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var J = (n, e, t) => e in n ? q(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var c = (n, e, t) => J(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Disposable as M, CommandType as R, useDependency as Q, useObservable as ee, UniverInstanceType as E, Inject as u, ICommandService as te, RANGE_TYPE as f, Rectangle as x, IContextService as re, ColorKit as ne, Plugin as se, Injector as ie, IConfigService as oe } from "@univerjs/core";
|
|
5
|
+
import { Shape as ae, Rect as ce, IRenderManagerService as le } from "@univerjs/engine-render";
|
|
6
|
+
import { MenuItemType as he, getMenuHiddenObservable as ge, ContextMenuPosition as de, ContextMenuGroup as ue, ComponentManager as fe, IMenuManagerService as _e } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as P, combineLatest as Se, startWith as ve, tap as pe, merge as T, map as V } from "rxjs";
|
|
8
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
9
|
+
import { forwardRef as A, useRef as Ce, createElement as G, useCallback as me } from "react";
|
|
10
|
+
import { SheetSkeletonManagerService as be, getCoordByCell as j } from "@univerjs/sheets-ui";
|
|
11
|
+
import { SheetsSelectionsService as He, DISABLE_NORMAL_SELECTIONS as Re, IRefSelectionsService as Oe } from "@univerjs/sheets";
|
|
12
|
+
var l = function() {
|
|
13
|
+
return l = Object.assign || function(n) {
|
|
14
|
+
for (var e, t = 1, r = arguments.length; t < r; t++) {
|
|
15
|
+
e = arguments[t];
|
|
16
|
+
for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]);
|
|
18
17
|
}
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
},
|
|
18
|
+
return n;
|
|
19
|
+
}, l.apply(this, arguments);
|
|
20
|
+
}, Ie = function(n, e) {
|
|
22
21
|
var t = {};
|
|
23
|
-
for (var
|
|
24
|
-
if (
|
|
25
|
-
for (var
|
|
26
|
-
e.indexOf(
|
|
22
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && e.indexOf(r) < 0 && (t[r] = n[r]);
|
|
23
|
+
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
24
|
+
for (var s = 0, r = Object.getOwnPropertySymbols(n); s < r.length; s++)
|
|
25
|
+
e.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (t[r[s]] = n[r[s]]);
|
|
27
26
|
return t;
|
|
28
|
-
},
|
|
29
|
-
var
|
|
30
|
-
return
|
|
27
|
+
}, U = A(function(n, e) {
|
|
28
|
+
var t = n.icon, r = n.id, s = n.className, i = n.extend, o = Ie(n, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(r, " ").concat(s || "").trim(), h = Ce("_".concat(Me()));
|
|
29
|
+
return D(t, "".concat(r), { defIds: t.defIds, idSuffix: h.current }, l({ ref: e, className: a }, o), i);
|
|
31
30
|
});
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
return
|
|
31
|
+
function D(n, e, t, r, s) {
|
|
32
|
+
return G(n.tag, l(l({ key: e }, ye(n, t, s)), r), (Ee(n, t).children || []).map(function(i, o) {
|
|
33
|
+
return D(i, "".concat(e, "-").concat(n.tag, "-").concat(o), t, void 0, s);
|
|
35
34
|
}));
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})), attrs;
|
|
36
|
+
function ye(n, e, t) {
|
|
37
|
+
var r = l({}, n.attrs);
|
|
38
|
+
t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1);
|
|
39
|
+
var s = e.defIds;
|
|
40
|
+
return !s || s.length === 0 || (n.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
|
|
41
|
+
var o = i[0], a = i[1];
|
|
42
|
+
typeof a == "string" && (r[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
43
|
+
})), r;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}) }) : node;
|
|
45
|
+
function Ee(n, e) {
|
|
46
|
+
var t, r = e.defIds;
|
|
47
|
+
return !r || r.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? l(l({}, n), { children: n.children.map(function(s) {
|
|
48
|
+
return typeof s.attrs.id == "string" && r && r.indexOf(s.attrs.id) > -1 ? l(l({}, s), { attrs: l(l({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
|
|
49
|
+
}) }) : n;
|
|
53
50
|
}
|
|
54
|
-
|
|
55
|
-
function generateShortUuid() {
|
|
51
|
+
function Me() {
|
|
56
52
|
return Math.random().toString(36).substring(2, 8);
|
|
57
53
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
54
|
+
U.displayName = "UniverIcon";
|
|
55
|
+
var we = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#E5E5E5", d: "M1.6499 3.65002C1.6499 2.54545 2.54533 1.65002 3.6499 1.65002H12.3499C13.4545 1.65002 14.3499 2.54545 14.3499 3.65002V12.35C14.3499 13.4546 13.4545 14.35 12.3499 14.35H3.6499C2.54533 14.35 1.6499 13.4546 1.6499 12.35V3.65002Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M9.9998 1.65002H5.9998V6H1.6499V10H5.9998V14.35H9.9998V10H14.3499V6H9.9998V1.65002Z" } }, { tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, Z = A(function(n, e) {
|
|
56
|
+
return G(U, Object.assign({}, n, {
|
|
62
57
|
id: "cross-highlighting-single",
|
|
63
|
-
ref,
|
|
64
|
-
icon:
|
|
58
|
+
ref: e,
|
|
59
|
+
icon: we
|
|
65
60
|
}));
|
|
66
61
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
Z.displayName = "CrossHighlightingSingle";
|
|
63
|
+
const B = [
|
|
64
|
+
"rgba(158, 109, 227, 0.3)",
|
|
65
|
+
"rgba(254, 75, 75, 0.3)",
|
|
66
|
+
"rgba(255, 140, 81, 0.3)",
|
|
67
|
+
"rgba(164, 220, 22, 0.3)",
|
|
68
|
+
"rgba(45, 174, 255, 0.3)",
|
|
69
|
+
"rgba(58, 96, 247, 0.3)",
|
|
70
|
+
"rgba(242, 72, 166, 0.3)",
|
|
71
|
+
"rgba(153, 153, 153, 0.3)",
|
|
72
|
+
"rgba(158, 109, 227, 0.15)",
|
|
73
|
+
"rgba(254, 75, 75, 0.15)",
|
|
74
|
+
"rgba(255, 140, 81, 0.15)",
|
|
75
|
+
"rgba(164, 220, 22, 0.15)",
|
|
76
|
+
"rgba(45, 174, 255, 0.15)",
|
|
77
|
+
"rgba(58, 96, 247, 0.15)",
|
|
78
|
+
"rgba(242, 72, 166, 0.15)",
|
|
79
|
+
"rgba(153, 153, 153, 0.15)"
|
|
80
|
+
];
|
|
81
|
+
class g extends M {
|
|
82
|
+
constructor() {
|
|
83
|
+
super(...arguments);
|
|
84
|
+
c(this, "_enabled$", new P(!1));
|
|
85
|
+
c(this, "enabled$", this._enabled$.asObservable());
|
|
86
|
+
c(this, "_color$", new P(B[0]));
|
|
87
|
+
c(this, "color$", this._color$.asObservable());
|
|
88
|
+
}
|
|
89
|
+
get enabled() {
|
|
90
|
+
return this._enabled$.getValue();
|
|
91
|
+
}
|
|
92
|
+
get color() {
|
|
93
|
+
return this._color$.getValue();
|
|
94
|
+
}
|
|
95
|
+
dispose() {
|
|
96
|
+
this._enabled$.complete();
|
|
97
|
+
}
|
|
98
|
+
setEnabled(t) {
|
|
99
|
+
this._enabled$.next(t);
|
|
100
|
+
}
|
|
101
|
+
setColor(t) {
|
|
102
|
+
this._color$.next(t);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const w = {
|
|
106
|
+
id: "sheet.operation.toggle-crosshair-highlight",
|
|
107
|
+
type: R.OPERATION,
|
|
108
|
+
handler(n) {
|
|
109
|
+
const e = n.get(g), t = e.enabled;
|
|
110
|
+
return e.setEnabled(!t), !0;
|
|
111
|
+
}
|
|
112
|
+
}, W = {
|
|
113
|
+
id: "sheet.operation.set-crosshair-highlight-color",
|
|
114
|
+
type: R.OPERATION,
|
|
115
|
+
handler(n, { value: e }) {
|
|
116
|
+
const t = n.get(g);
|
|
117
|
+
return t.enabled || t.setEnabled(!0), t.setColor(e), !0;
|
|
118
|
+
}
|
|
119
|
+
}, $e = {
|
|
120
|
+
id: "sheet.operation.enable-crosshair-highlight",
|
|
121
|
+
type: R.OPERATION,
|
|
122
|
+
handler(n) {
|
|
123
|
+
const e = n.get(g);
|
|
124
|
+
return e.enabled ? !1 : (e.setEnabled(!0), !0);
|
|
125
|
+
}
|
|
126
|
+
}, xe = {
|
|
127
|
+
id: "sheet.operation.disable-crosshair-highlight",
|
|
128
|
+
type: R.OPERATION,
|
|
129
|
+
handler(n) {
|
|
130
|
+
const e = n.get(g);
|
|
131
|
+
return e.enabled ? (e.setEnabled(!1), !0) : !1;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function Y(n) {
|
|
135
|
+
var e, t, r = "";
|
|
136
|
+
if (typeof n == "string" || typeof n == "number") r += n;
|
|
137
|
+
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
138
|
+
var s = n.length;
|
|
139
|
+
for (e = 0; e < s; e++) n[e] && (t = Y(n[e])) && (r && (r += " "), r += t);
|
|
140
|
+
} else for (t in n) n[t] && (r && (r += " "), r += t);
|
|
141
|
+
return r;
|
|
76
142
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return n;
|
|
143
|
+
function Pe() {
|
|
144
|
+
for (var n, e, t = 0, r = "", s = arguments.length; t < s; t++) (n = arguments[t]) && (e = Y(n)) && (r && (r += " "), r += e);
|
|
145
|
+
return r;
|
|
81
146
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
crosshairHighlightItemSelected
|
|
147
|
+
const Te = "univer-crosshair-highlight-overlay", Ve = "univer-crosshair-highlight-item", Ne = "univer-crosshair-highlight-item-selected", O = {
|
|
148
|
+
crosshairHighlightOverlay: Te,
|
|
149
|
+
crosshairHighlightItem: Ve,
|
|
150
|
+
crosshairHighlightItemSelected: Ne
|
|
87
151
|
};
|
|
88
|
-
function
|
|
89
|
-
const { onChange } =
|
|
90
|
-
|
|
91
|
-
}, [
|
|
92
|
-
return /* @__PURE__ */
|
|
152
|
+
function je(n) {
|
|
153
|
+
const { onChange: e } = n, t = Q(g), r = ee(t.color$), s = me((i) => {
|
|
154
|
+
e == null || e(i);
|
|
155
|
+
}, [e]);
|
|
156
|
+
return /* @__PURE__ */ N("div", { className: O.crosshairHighlightOverlay, children: B.map((i) => /* @__PURE__ */ N(
|
|
93
157
|
"div",
|
|
94
158
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
[styles.crosshairHighlightItemSelected]: color === currentColor
|
|
159
|
+
className: Pe(O.crosshairHighlightItem, {
|
|
160
|
+
[O.crosshairHighlightItemSelected]: i === r
|
|
98
161
|
}),
|
|
99
|
-
style: { backgroundColor:
|
|
100
|
-
onClick:
|
|
101
|
-
}
|
|
102
|
-
|
|
162
|
+
style: { backgroundColor: i },
|
|
163
|
+
onClick: () => s(i)
|
|
164
|
+
},
|
|
165
|
+
i
|
|
166
|
+
)) });
|
|
103
167
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const crosshairHighlightService = accessor.get(SheetsCrosshairHighlightService);
|
|
168
|
+
const k = "CROSSHAIR_HIGHLIGHT_OVERLAY_COMPONENT";
|
|
169
|
+
function Le(n) {
|
|
170
|
+
const e = n.get(g);
|
|
108
171
|
return {
|
|
109
|
-
id:
|
|
172
|
+
id: w.id,
|
|
110
173
|
tooltip: "crosshair.button.tooltip",
|
|
111
|
-
type:
|
|
174
|
+
type: he.BUTTON_SELECTOR,
|
|
112
175
|
icon: "CrossHighlightingSingle",
|
|
113
176
|
selections: [
|
|
114
177
|
{
|
|
115
178
|
label: {
|
|
116
|
-
name:
|
|
179
|
+
name: k,
|
|
117
180
|
hoverable: !1
|
|
118
181
|
}
|
|
119
182
|
}
|
|
120
183
|
],
|
|
121
|
-
selectionsCommandId:
|
|
122
|
-
activated$:
|
|
123
|
-
hidden$:
|
|
184
|
+
selectionsCommandId: W.id,
|
|
185
|
+
activated$: e.enabled$,
|
|
186
|
+
hidden$: ge(n, E.UNIVER_SHEET)
|
|
124
187
|
};
|
|
125
188
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
[ToggleCrosshairHighlightOperation.id]: {
|
|
189
|
+
const Ae = {
|
|
190
|
+
[de.FOOTER_MENU]: {
|
|
191
|
+
[ue.OTHERS]: {
|
|
192
|
+
[w.id]: {
|
|
131
193
|
order: 0,
|
|
132
|
-
menuItemFactory:
|
|
194
|
+
menuItemFactory: Le
|
|
133
195
|
}
|
|
134
196
|
}
|
|
135
197
|
}
|
|
136
198
|
};
|
|
137
|
-
var
|
|
138
|
-
for (var
|
|
139
|
-
(
|
|
140
|
-
return
|
|
141
|
-
},
|
|
142
|
-
let
|
|
143
|
-
constructor(
|
|
144
|
-
super(), this._componentMgr =
|
|
199
|
+
var Ge = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, De = (n, e, t, r) => {
|
|
200
|
+
for (var s = r > 1 ? void 0 : r ? Ue(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
201
|
+
(o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
202
|
+
return r && s && Ge(e, t, s), s;
|
|
203
|
+
}, I = (n, e) => (t, r) => e(t, r, n);
|
|
204
|
+
let b = class extends M {
|
|
205
|
+
constructor(n, e, t) {
|
|
206
|
+
super(), this._componentMgr = n, this._menuManagerService = e, this._cmdSrv = t, this._initCommands(), this._initMenus(), this._initComponents();
|
|
145
207
|
}
|
|
146
208
|
_initCommands() {
|
|
147
209
|
[
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
].forEach((
|
|
210
|
+
w,
|
|
211
|
+
W,
|
|
212
|
+
$e,
|
|
213
|
+
xe
|
|
214
|
+
].forEach((n) => this._cmdSrv.registerCommand(n));
|
|
153
215
|
}
|
|
154
216
|
_initMenus() {
|
|
155
|
-
this._menuManagerService.mergeMenu(
|
|
217
|
+
this._menuManagerService.mergeMenu(Ae);
|
|
156
218
|
}
|
|
157
219
|
_initComponents() {
|
|
158
|
-
this._componentMgr.register(
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
],
|
|
166
|
-
const
|
|
220
|
+
this._componentMgr.register(k, je), this._componentMgr.register("CrossHighlightingSingle", Z);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
b = De([
|
|
224
|
+
I(0, u(fe)),
|
|
225
|
+
I(1, _e),
|
|
226
|
+
I(2, te)
|
|
227
|
+
], b);
|
|
228
|
+
const Ze = 1;
|
|
229
|
+
class Be {
|
|
167
230
|
constructor() {
|
|
168
|
-
|
|
169
|
-
|
|
231
|
+
c(this, "_selectedRanges", []);
|
|
232
|
+
c(this, "_ranges", []);
|
|
170
233
|
}
|
|
171
|
-
addRange(
|
|
172
|
-
if (
|
|
234
|
+
addRange(e) {
|
|
235
|
+
if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
|
|
173
236
|
return;
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
setSelectedRanges(
|
|
178
|
-
this._selectedRanges =
|
|
179
|
-
}
|
|
180
|
-
_getSplitRanges(
|
|
181
|
-
let
|
|
182
|
-
for (const
|
|
183
|
-
const
|
|
184
|
-
for (const
|
|
185
|
-
const
|
|
186
|
-
|
|
237
|
+
const t = this._getIntersects(e), r = this._getSplitRanges(e, t);
|
|
238
|
+
r.length > 0 && this._ranges.push(...r);
|
|
239
|
+
}
|
|
240
|
+
setSelectedRanges(e) {
|
|
241
|
+
this._selectedRanges = e;
|
|
242
|
+
}
|
|
243
|
+
_getSplitRanges(e, t) {
|
|
244
|
+
let r = [e];
|
|
245
|
+
for (const s of t.concat(this._selectedRanges)) {
|
|
246
|
+
const i = [];
|
|
247
|
+
for (const o of r) {
|
|
248
|
+
const a = x.subtract(o, s);
|
|
249
|
+
a && a.length > 0 && i.push(...a);
|
|
187
250
|
}
|
|
188
|
-
|
|
251
|
+
r = i;
|
|
189
252
|
}
|
|
190
|
-
return
|
|
253
|
+
return r.filter((s) => s.startRow <= s.endRow && s.startColumn <= s.endColumn);
|
|
191
254
|
}
|
|
192
|
-
_getIntersects(
|
|
193
|
-
const
|
|
194
|
-
for (const
|
|
195
|
-
const
|
|
196
|
-
|
|
255
|
+
_getIntersects(e) {
|
|
256
|
+
const t = [];
|
|
257
|
+
for (const r of this._ranges) {
|
|
258
|
+
const s = x.getIntersects(r, e);
|
|
259
|
+
s && t.push(s);
|
|
197
260
|
}
|
|
198
|
-
return
|
|
261
|
+
return t;
|
|
199
262
|
}
|
|
200
263
|
getRanges() {
|
|
201
264
|
return this._ranges;
|
|
@@ -203,187 +266,183 @@ const SHEETS_CROSSHAIR_HIGHLIGHT_Z_INDEX = 1, _CrossHairRangeCollection = class
|
|
|
203
266
|
reset() {
|
|
204
267
|
this._ranges = [], this._selectedRanges = [];
|
|
205
268
|
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
constructor(key, props) {
|
|
211
|
-
super(key, props);
|
|
269
|
+
}
|
|
270
|
+
class We extends ae {
|
|
271
|
+
constructor(t, r) {
|
|
272
|
+
super(t, r);
|
|
212
273
|
// protected _showHighLight = false;
|
|
213
|
-
|
|
214
|
-
|
|
274
|
+
c(this, "_color");
|
|
275
|
+
r && this.setShapeProps(r);
|
|
215
276
|
}
|
|
216
|
-
setShapeProps(
|
|
217
|
-
typeof
|
|
218
|
-
width:
|
|
219
|
-
height:
|
|
277
|
+
setShapeProps(t) {
|
|
278
|
+
typeof t.color < "u" && (this._color = t.color), this.transformByState({
|
|
279
|
+
width: t.width,
|
|
280
|
+
height: t.height
|
|
220
281
|
});
|
|
221
282
|
}
|
|
222
|
-
_draw(
|
|
223
|
-
const
|
|
224
|
-
|
|
283
|
+
_draw(t) {
|
|
284
|
+
const r = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, ${this._color.a})`;
|
|
285
|
+
ce.drawWith(t, {
|
|
225
286
|
width: this.width,
|
|
226
287
|
height: this.height,
|
|
227
|
-
fill:
|
|
288
|
+
fill: r,
|
|
228
289
|
stroke: void 0,
|
|
229
290
|
strokeWidth: 0,
|
|
230
291
|
evented: !1
|
|
231
292
|
});
|
|
232
293
|
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
let SheetCrosshairHighlightRenderController = (_a2 = class extends Disposable {
|
|
242
|
-
constructor(_context, _sheetSkeletonManagerService, _sheetsSelectionsService, _sheetsCrosshairHighlightService, _contextService, _refSelectionsService) {
|
|
294
|
+
}
|
|
295
|
+
var Ye = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, Fe = (n, e, t, r) => {
|
|
296
|
+
for (var s = r > 1 ? void 0 : r ? ke(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
297
|
+
(o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
298
|
+
return r && s && Ye(e, t, s), s;
|
|
299
|
+
}, v = (n, e) => (t, r) => e(t, r, n);
|
|
300
|
+
let H = class extends M {
|
|
301
|
+
constructor(e, t, r, s, i, o) {
|
|
243
302
|
super();
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
this._context =
|
|
303
|
+
c(this, "_shapes", []);
|
|
304
|
+
c(this, "_rangeCollection", new Be());
|
|
305
|
+
c(this, "_color", "rgba(255,0,0,0.5)");
|
|
306
|
+
this._context = e, this._sheetSkeletonManagerService = t, this._sheetsSelectionsService = r, this._sheetsCrosshairHighlightService = s, this._contextService = i, this._refSelectionsService = o, this._initRenderListener();
|
|
248
307
|
}
|
|
249
|
-
_transformSelection(
|
|
250
|
-
if (!
|
|
308
|
+
_transformSelection(e, t) {
|
|
309
|
+
if (!e)
|
|
251
310
|
return;
|
|
252
|
-
const
|
|
253
|
-
for (const
|
|
254
|
-
const { startRow, endRow, startColumn, endColumn } =
|
|
255
|
-
|
|
311
|
+
const r = t.getRowCount(), s = t.getColumnCount(), i = [];
|
|
312
|
+
for (const o of e) {
|
|
313
|
+
const { startRow: a, endRow: h, startColumn: _, endColumn: S } = o.range;
|
|
314
|
+
h - a + 1 === r || S - _ + 1 === s || i.push(o.range);
|
|
256
315
|
}
|
|
257
|
-
this._rangeCollection.setSelectedRanges(
|
|
258
|
-
for (const
|
|
259
|
-
this.addSelection(
|
|
316
|
+
this._rangeCollection.setSelectedRanges(i);
|
|
317
|
+
for (const o of i)
|
|
318
|
+
this.addSelection(o, t);
|
|
260
319
|
}
|
|
261
320
|
_initRenderListener() {
|
|
262
|
-
const
|
|
263
|
-
this.disposeWithMe(
|
|
264
|
-
this._contextService.subscribeContextValue$(
|
|
321
|
+
const e = this._context.unit;
|
|
322
|
+
this.disposeWithMe(Se([
|
|
323
|
+
this._contextService.subscribeContextValue$(Re).pipe(ve(!1)),
|
|
265
324
|
this._sheetSkeletonManagerService.currentSkeleton$,
|
|
266
325
|
this._sheetsCrosshairHighlightService.enabled$,
|
|
267
|
-
this._sheetsCrosshairHighlightService.color$.pipe(
|
|
268
|
-
|
|
326
|
+
this._sheetsCrosshairHighlightService.color$.pipe(pe((t) => this._color = t)),
|
|
327
|
+
T(
|
|
269
328
|
this._sheetsSelectionsService.selectionMoveStart$,
|
|
270
329
|
this._sheetsSelectionsService.selectionMoving$,
|
|
271
330
|
this._sheetsSelectionsService.selectionMoveEnd$,
|
|
272
|
-
|
|
331
|
+
e.activeSheet$.pipe(V(() => this._sheetsSelectionsService.getCurrentSelections()))
|
|
273
332
|
),
|
|
274
|
-
|
|
333
|
+
T(
|
|
275
334
|
this._refSelectionsService.selectionMoveStart$,
|
|
276
335
|
this._refSelectionsService.selectionMoving$,
|
|
277
336
|
this._refSelectionsService.selectionMoveEnd$,
|
|
278
|
-
|
|
337
|
+
e.activeSheet$.pipe(V(() => this._refSelectionsService.getCurrentSelections()))
|
|
279
338
|
)
|
|
280
|
-
]).subscribe(([
|
|
281
|
-
if (this._clear(), !
|
|
282
|
-
const
|
|
283
|
-
this._rangeCollection.reset(), this._transformSelection(
|
|
339
|
+
]).subscribe(([t, r, s, i, o, a]) => {
|
|
340
|
+
if (this._clear(), !s) return;
|
|
341
|
+
const h = t ? a : o;
|
|
342
|
+
this._rangeCollection.reset(), this._transformSelection(h, e.getActiveSheet()), this.render(this._rangeCollection.getRanges());
|
|
284
343
|
}));
|
|
285
344
|
}
|
|
286
|
-
addSelection(
|
|
287
|
-
if (
|
|
345
|
+
addSelection(e, t) {
|
|
346
|
+
if (e.rangeType === f.COLUMN || e.rangeType === f.ROW || e.rangeType === f.ALL)
|
|
288
347
|
return;
|
|
289
|
-
const
|
|
290
|
-
startRow,
|
|
291
|
-
endRow,
|
|
348
|
+
const r = t.getRowCount(), s = t.getColumnCount(), { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = {
|
|
349
|
+
startRow: i,
|
|
350
|
+
endRow: o,
|
|
292
351
|
startColumn: 0,
|
|
293
|
-
endColumn:
|
|
294
|
-
},
|
|
295
|
-
startRow,
|
|
296
|
-
endRow,
|
|
297
|
-
startColumn:
|
|
298
|
-
endColumn:
|
|
299
|
-
},
|
|
352
|
+
endColumn: a - 1
|
|
353
|
+
}, S = {
|
|
354
|
+
startRow: i,
|
|
355
|
+
endRow: o,
|
|
356
|
+
startColumn: h + 1,
|
|
357
|
+
endColumn: s
|
|
358
|
+
}, p = {
|
|
300
359
|
startRow: 0,
|
|
301
|
-
endRow:
|
|
302
|
-
startColumn,
|
|
303
|
-
endColumn
|
|
304
|
-
},
|
|
305
|
-
startRow:
|
|
306
|
-
endRow:
|
|
307
|
-
startColumn,
|
|
308
|
-
endColumn
|
|
360
|
+
endRow: i - 1,
|
|
361
|
+
startColumn: a,
|
|
362
|
+
endColumn: h
|
|
363
|
+
}, C = {
|
|
364
|
+
startRow: o + 1,
|
|
365
|
+
endRow: r,
|
|
366
|
+
startColumn: a,
|
|
367
|
+
endColumn: h
|
|
309
368
|
};
|
|
310
|
-
for (const
|
|
311
|
-
|
|
369
|
+
for (const d of [_, S, p, C])
|
|
370
|
+
d.startRow <= d.endRow && d.startColumn <= d.endColumn && this._rangeCollection.addRange(d);
|
|
312
371
|
}
|
|
313
372
|
_clear() {
|
|
314
|
-
this._shapes.forEach((
|
|
315
|
-
|
|
373
|
+
this._shapes.forEach((e) => {
|
|
374
|
+
e.dispose();
|
|
316
375
|
}), this._shapes = [];
|
|
317
376
|
}
|
|
318
|
-
_addShapes(
|
|
319
|
-
const { startRow, endRow, startColumn, endColumn } =
|
|
320
|
-
left:
|
|
321
|
-
top:
|
|
322
|
-
color: new
|
|
323
|
-
width,
|
|
324
|
-
height,
|
|
325
|
-
zIndex:
|
|
377
|
+
_addShapes(e, t, r, s) {
|
|
378
|
+
const { startRow: i, endRow: o, startColumn: a, endColumn: h } = e, _ = j(i, a, r, s), S = j(o, h, r, s), { startX: p, startY: C } = _, { endX: d, endY: F } = S, X = d - p, K = F - C, z = {
|
|
379
|
+
left: p,
|
|
380
|
+
top: C,
|
|
381
|
+
color: new ne(this._color).toRgb(),
|
|
382
|
+
width: X,
|
|
383
|
+
height: K,
|
|
384
|
+
zIndex: Ze,
|
|
326
385
|
evented: !1
|
|
327
|
-
},
|
|
328
|
-
this._shapes.push(
|
|
386
|
+
}, $ = new We(`crosshair-${t}`, z);
|
|
387
|
+
this._shapes.push($), r.addObject($);
|
|
329
388
|
}
|
|
330
|
-
render(
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
389
|
+
render(e) {
|
|
390
|
+
const t = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
391
|
+
if (!t)
|
|
333
392
|
return;
|
|
334
|
-
const { scene } = this._context;
|
|
393
|
+
const { scene: r } = this._context;
|
|
335
394
|
this._clear();
|
|
336
|
-
for (let
|
|
337
|
-
const
|
|
338
|
-
this._addShapes(
|
|
395
|
+
for (let s = 0; s < e.length; s++) {
|
|
396
|
+
const i = e[s];
|
|
397
|
+
this._addShapes(i, s, r, t);
|
|
339
398
|
}
|
|
340
|
-
|
|
399
|
+
r.makeDirty(!0);
|
|
341
400
|
}
|
|
342
401
|
async dispose() {
|
|
343
402
|
super.dispose();
|
|
344
403
|
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
const
|
|
354
|
-
var
|
|
355
|
-
for (var
|
|
356
|
-
(
|
|
357
|
-
return
|
|
358
|
-
},
|
|
359
|
-
let
|
|
360
|
-
constructor(
|
|
361
|
-
super(), this._config =
|
|
362
|
-
const { ...
|
|
363
|
-
this._configService.setConfig(
|
|
404
|
+
};
|
|
405
|
+
H = Fe([
|
|
406
|
+
v(1, u(be)),
|
|
407
|
+
v(2, u(He)),
|
|
408
|
+
v(3, u(g)),
|
|
409
|
+
v(4, u(re)),
|
|
410
|
+
v(5, Oe)
|
|
411
|
+
], H);
|
|
412
|
+
const Xe = "sheets-crosshair-highlight.config", Ke = {};
|
|
413
|
+
var ze = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, Je = (n, e, t, r) => {
|
|
414
|
+
for (var s = r > 1 ? void 0 : r ? qe(e, t) : e, i = n.length - 1, o; i >= 0; i--)
|
|
415
|
+
(o = n[i]) && (s = (r ? o(e, t, s) : o(s)) || s);
|
|
416
|
+
return r && s && ze(e, t, s), s;
|
|
417
|
+
}, y = (n, e) => (t, r) => e(t, r, n), m;
|
|
418
|
+
let L = (m = class extends se {
|
|
419
|
+
constructor(n = Ke, e, t, r) {
|
|
420
|
+
super(), this._config = n, this._injector = e, this._renderManagerService = t, this._configService = r;
|
|
421
|
+
const { ...s } = this._config;
|
|
422
|
+
this._configService.setConfig(Xe, s);
|
|
364
423
|
}
|
|
365
424
|
onStarting() {
|
|
366
425
|
[
|
|
367
|
-
[
|
|
368
|
-
[
|
|
369
|
-
].forEach((
|
|
426
|
+
[g],
|
|
427
|
+
[b]
|
|
428
|
+
].forEach((n) => this._injector.add(n));
|
|
370
429
|
}
|
|
371
430
|
onReady() {
|
|
372
431
|
[
|
|
373
|
-
[
|
|
374
|
-
].forEach((
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
],
|
|
432
|
+
[H]
|
|
433
|
+
].forEach((n) => this._injector.add(n)), this._injector.get(b), this._renderManagerService.registerRenderModule(E.UNIVER_SHEET, [H]);
|
|
434
|
+
}
|
|
435
|
+
}, c(m, "pluginName", "SHEET_CROSSHAIR_HIGHLIGHT_PLUGIN"), c(m, "type", E.UNIVER_SHEET), m);
|
|
436
|
+
L = Je([
|
|
437
|
+
y(1, u(ie)),
|
|
438
|
+
y(2, le),
|
|
439
|
+
y(3, oe)
|
|
440
|
+
], L);
|
|
382
441
|
export {
|
|
383
|
-
CROSSHAIR_HIGHLIGHT_COLORS,
|
|
384
|
-
DisableCrosshairHighlightOperation,
|
|
385
|
-
EnableCrosshairHighlightOperation,
|
|
386
|
-
SetCrosshairHighlightColorOperation,
|
|
387
|
-
ToggleCrosshairHighlightOperation,
|
|
388
|
-
UniverSheetsCrosshairHighlightPlugin
|
|
442
|
+
B as CROSSHAIR_HIGHLIGHT_COLORS,
|
|
443
|
+
xe as DisableCrosshairHighlightOperation,
|
|
444
|
+
$e as EnableCrosshairHighlightOperation,
|
|
445
|
+
W as SetCrosshairHighlightColorOperation,
|
|
446
|
+
w as ToggleCrosshairHighlightOperation,
|
|
447
|
+
L as UniverSheetsCrosshairHighlightPlugin
|
|
389
448
|
};
|