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