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