@univerjs/sheets-data-validation-ui 0.4.0-alpha.0 → 0.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js
CHANGED
@@ -3,21 +3,20 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
5
5
|
import React, { useState, forwardRef, useRef, createElement, useMemo, useEffect } from "react";
|
6
|
-
import { Inject, LocaleService, Disposable, DataValidationErrorStyle, useDependency, ICommandService, numfmt, CellValueType, UniverInstanceType, toDisposable, IUniverInstanceService, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, CommandType, BuildTextUtils, DataValidationRenderMode, DataValidationType, IConfigService, UndoCommand, RedoCommand, isUnitRangesEqual,
|
6
|
+
import { Inject, LocaleService, Disposable, DataValidationErrorStyle, useDependency, ICommandService, numfmt, CellValueType, UniverInstanceType, toDisposable, IUniverInstanceService, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, CommandType, BuildTextUtils, DataValidationRenderMode, DataValidationType, IConfigService, UndoCommand, RedoCommand, isUnitRangesEqual, debounce, shallowEqual, Injector, DataValidationStatus, ObjectMatrix, Range, Rectangle, queryObjectMatrix, Optional, RxDisposable, InterceptorEffectEnum, sequenceExecute, bufferDebounceTime, createInternalEditorID, isFormulaString, Tools, ThemeService, VerticalAlign, HorizontalAlign, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, DEFAULT_EMPTY_DOCUMENT_VALUE, BooleanNumber, Plugin } from "@univerjs/core";
|
7
7
|
import { Button, DatePanel, RectPopup, Scrollbar, FormLayout, RadioGroup, Radio, Checkbox, Input, Select, DraggableList } from "@univerjs/design";
|
8
8
|
import { SetRangeValuesCommand, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, RangeProtectionPermissionEditPoint, WorksheetEditPermission, checkRangesEditablePermission, WorksheetSetCellStylePermission, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
|
9
|
-
import { SheetDataValidationModel, getCellValueOrigin, getDataValidationCellValue, deserializeListOptions, serializeListOptions, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, createDefaultNewRule, AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, getDataValidationDiffMutations, DataValidationFormulaController, DataValidationFormulaService, getFormulaResult, transformCheckboxValue, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from "@univerjs/sheets-data-validation";
|
9
|
+
import { SheetDataValidationModel, getCellValueOrigin, getDataValidationCellValue, deserializeListOptions, serializeListOptions, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, createDefaultNewRule, AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, getDataValidationDiffMutations, DataValidationCacheService, DataValidationFormulaController, DataValidationFormulaService, getFormulaResult, transformCheckboxValue, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from "@univerjs/sheets-data-validation";
|
10
10
|
import { getPatternType } from "@univerjs/sheets-numfmt";
|
11
|
-
import dayjs from "dayjs";
|
12
11
|
import { DataValidatorRegistryService, DataValidationModel, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
|
13
12
|
import { IEditorBridgeService, SheetCanvasPopManagerService, SheetPermissionInterceptorBaseController, IMarkSelectionService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService } from "@univerjs/sheets-ui";
|
14
13
|
import { IDialogService, ISidebarService, useObservable, ComponentManager, IZenZoneService, KeyCode, useEvent, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
|
15
14
|
import { RichTextEditingMutation } from "@univerjs/docs";
|
16
15
|
import { IRenderManagerService, DeviceInputEventType, fixLineWidthByScale, Transform, Checkbox as Checkbox$1, FontCache, Shape, Rect, getFontStyleString, getDocsSkeletonPageSize, DocumentViewModel, DocumentSkeleton, Documents } from "@univerjs/engine-render";
|
17
16
|
import { filter, BehaviorSubject, distinctUntilChanged, Subject, debounceTime, bufferTime } from "rxjs";
|
18
|
-
import {
|
19
|
-
import {
|
20
|
-
import
|
17
|
+
import { deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
|
18
|
+
import { RangeSelector } from "@univerjs/sheets-formula-ui";
|
19
|
+
import { TextEditor } from "@univerjs/docs-ui";
|
21
20
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
22
21
|
function getDefaultExportFromCjs(x) {
|
23
22
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
@@ -46,7 +45,286 @@ reactJsxRuntime_production_min.Fragment = l;
|
|
46
45
|
reactJsxRuntime_production_min.jsx = q;
|
47
46
|
reactJsxRuntime_production_min.jsxs = q;
|
48
47
|
jsxRuntime.exports = reactJsxRuntime_production_min;
|
49
|
-
var jsxRuntimeExports = jsxRuntime.exports,
|
48
|
+
var jsxRuntimeExports = jsxRuntime.exports, dayjs_min = { exports: {} };
|
49
|
+
(function(module, exports) {
|
50
|
+
(function(t, e) {
|
51
|
+
module.exports = e();
|
52
|
+
})(commonjsGlobal, function() {
|
53
|
+
var t = 1e3, e = 6e4, n2 = 36e5, r2 = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f2 = "quarter", h = "year", d = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: /* @__PURE__ */ __name(function(t2) {
|
54
|
+
var e2 = ["th", "st", "nd", "rd"], n3 = t2 % 100;
|
55
|
+
return "[" + t2 + (e2[(n3 - 20) % 10] || e2[n3] || e2[0]) + "]";
|
56
|
+
}, "ordinal") }, m2 = /* @__PURE__ */ __name(function(t2, e2, n3) {
|
57
|
+
var r3 = String(t2);
|
58
|
+
return !r3 || r3.length >= e2 ? t2 : "" + Array(e2 + 1 - r3.length).join(n3) + t2;
|
59
|
+
}, "m"), v = { s: m2, z: /* @__PURE__ */ __name(function(t2) {
|
60
|
+
var e2 = -t2.utcOffset(), n3 = Math.abs(e2), r3 = Math.floor(n3 / 60), i2 = n3 % 60;
|
61
|
+
return (e2 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i2, 2, "0");
|
62
|
+
}, "z"), m: /* @__PURE__ */ __name(function t2(e2, n3) {
|
63
|
+
if (e2.date() < n3.date()) return -t2(n3, e2);
|
64
|
+
var r3 = 12 * (n3.year() - e2.year()) + (n3.month() - e2.month()), i2 = e2.clone().add(r3, c), s2 = n3 - i2 < 0, u2 = e2.clone().add(r3 + (s2 ? -1 : 1), c);
|
65
|
+
return +(-(r3 + (n3 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
66
|
+
}, "t"), a: /* @__PURE__ */ __name(function(t2) {
|
67
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
68
|
+
}, "a"), p: /* @__PURE__ */ __name(function(t2) {
|
69
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r2, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
70
|
+
}, "p"), u: /* @__PURE__ */ __name(function(t2) {
|
71
|
+
return t2 === void 0;
|
72
|
+
}, "u") }, g = "en", D = {};
|
73
|
+
D[g] = M;
|
74
|
+
var p2 = "$isDayjsObject", S = /* @__PURE__ */ __name(function(t2) {
|
75
|
+
return t2 instanceof _ || !(!t2 || !t2[p2]);
|
76
|
+
}, "S"), w = /* @__PURE__ */ __name(function t2(e2, n3, r3) {
|
77
|
+
var i2;
|
78
|
+
if (!e2) return g;
|
79
|
+
if (typeof e2 == "string") {
|
80
|
+
var s2 = e2.toLowerCase();
|
81
|
+
D[s2] && (i2 = s2), n3 && (D[s2] = n3, i2 = s2);
|
82
|
+
var u2 = e2.split("-");
|
83
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
84
|
+
} else {
|
85
|
+
var a2 = e2.name;
|
86
|
+
D[a2] = e2, i2 = a2;
|
87
|
+
}
|
88
|
+
return !r3 && i2 && (g = i2), i2 || !r3 && g;
|
89
|
+
}, "t"), O = /* @__PURE__ */ __name(function(t2, e2) {
|
90
|
+
if (S(t2)) return t2.clone();
|
91
|
+
var n3 = typeof e2 == "object" ? e2 : {};
|
92
|
+
return n3.date = t2, n3.args = arguments, new _(n3);
|
93
|
+
}, "O"), b = v;
|
94
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
95
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
96
|
+
};
|
97
|
+
var _ = function() {
|
98
|
+
function M2(t2) {
|
99
|
+
this.$L = w(t2.locale, null, !0), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = !0;
|
100
|
+
}
|
101
|
+
__name(M2, "M");
|
102
|
+
var m3 = M2.prototype;
|
103
|
+
return m3.parse = function(t2) {
|
104
|
+
this.$d = function(t3) {
|
105
|
+
var e2 = t3.date, n3 = t3.utc;
|
106
|
+
if (e2 === null) return /* @__PURE__ */ new Date(NaN);
|
107
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
108
|
+
if (e2 instanceof Date) return new Date(e2);
|
109
|
+
if (typeof e2 == "string" && !/Z$/i.test(e2)) {
|
110
|
+
var r3 = e2.match($);
|
111
|
+
if (r3) {
|
112
|
+
var i2 = r3[2] - 1 || 0, s2 = (r3[7] || "0").substring(0, 3);
|
113
|
+
return n3 ? new Date(Date.UTC(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2)) : new Date(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
return new Date(e2);
|
117
|
+
}(t2), this.init();
|
118
|
+
}, m3.init = function() {
|
119
|
+
var t2 = this.$d;
|
120
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
121
|
+
}, m3.$utils = function() {
|
122
|
+
return b;
|
123
|
+
}, m3.isValid = function() {
|
124
|
+
return this.$d.toString() !== l2;
|
125
|
+
}, m3.isSame = function(t2, e2) {
|
126
|
+
var n3 = O(t2);
|
127
|
+
return this.startOf(e2) <= n3 && n3 <= this.endOf(e2);
|
128
|
+
}, m3.isAfter = function(t2, e2) {
|
129
|
+
return O(t2) < this.startOf(e2);
|
130
|
+
}, m3.isBefore = function(t2, e2) {
|
131
|
+
return this.endOf(e2) < O(t2);
|
132
|
+
}, m3.$g = function(t2, e2, n3) {
|
133
|
+
return b.u(t2) ? this[e2] : this.set(n3, t2);
|
134
|
+
}, m3.unix = function() {
|
135
|
+
return Math.floor(this.valueOf() / 1e3);
|
136
|
+
}, m3.valueOf = function() {
|
137
|
+
return this.$d.getTime();
|
138
|
+
}, m3.startOf = function(t2, e2) {
|
139
|
+
var n3 = this, r3 = !!b.u(e2) || e2, f3 = b.p(t2), l3 = /* @__PURE__ */ __name(function(t3, e3) {
|
140
|
+
var i2 = b.w(n3.$u ? Date.UTC(n3.$y, e3, t3) : new Date(n3.$y, e3, t3), n3);
|
141
|
+
return r3 ? i2 : i2.endOf(a);
|
142
|
+
}, "l"), $2 = /* @__PURE__ */ __name(function(t3, e3) {
|
143
|
+
return b.w(n3.toDate()[t3].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n3);
|
144
|
+
}, "$"), y2 = this.$W, M3 = this.$M, m4 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
145
|
+
switch (f3) {
|
146
|
+
case h:
|
147
|
+
return r3 ? l3(1, 0) : l3(31, 11);
|
148
|
+
case c:
|
149
|
+
return r3 ? l3(1, M3) : l3(0, M3 + 1);
|
150
|
+
case o:
|
151
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
152
|
+
return l3(r3 ? m4 - D2 : m4 + (6 - D2), M3);
|
153
|
+
case a:
|
154
|
+
case d:
|
155
|
+
return $2(v2 + "Hours", 0);
|
156
|
+
case u:
|
157
|
+
return $2(v2 + "Minutes", 1);
|
158
|
+
case s:
|
159
|
+
return $2(v2 + "Seconds", 2);
|
160
|
+
case i:
|
161
|
+
return $2(v2 + "Milliseconds", 3);
|
162
|
+
default:
|
163
|
+
return this.clone();
|
164
|
+
}
|
165
|
+
}, m3.endOf = function(t2) {
|
166
|
+
return this.startOf(t2, !1);
|
167
|
+
}, m3.$set = function(t2, e2) {
|
168
|
+
var n3, o2 = b.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a] = f3 + "Date", n3[d] = f3 + "Date", n3[c] = f3 + "Month", n3[h] = f3 + "FullYear", n3[u] = f3 + "Hours", n3[s] = f3 + "Minutes", n3[i] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
169
|
+
if (o2 === c || o2 === h) {
|
170
|
+
var y2 = this.clone().set(d, 1);
|
171
|
+
y2.$d[l3]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
172
|
+
} else l3 && this.$d[l3]($2);
|
173
|
+
return this.init(), this;
|
174
|
+
}, m3.set = function(t2, e2) {
|
175
|
+
return this.clone().$set(t2, e2);
|
176
|
+
}, m3.get = function(t2) {
|
177
|
+
return this[b.p(t2)]();
|
178
|
+
}, m3.add = function(r3, f3) {
|
179
|
+
var d2, l3 = this;
|
180
|
+
r3 = Number(r3);
|
181
|
+
var $2 = b.p(f3), y2 = /* @__PURE__ */ __name(function(t2) {
|
182
|
+
var e2 = O(l3);
|
183
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r3)), l3);
|
184
|
+
}, "y");
|
185
|
+
if ($2 === c) return this.set(c, this.$M + r3);
|
186
|
+
if ($2 === h) return this.set(h, this.$y + r3);
|
187
|
+
if ($2 === a) return y2(1);
|
188
|
+
if ($2 === o) return y2(7);
|
189
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n2, d2[i] = t, d2)[$2] || 1, m4 = this.$d.getTime() + r3 * M3;
|
190
|
+
return b.w(m4, this);
|
191
|
+
}, m3.subtract = function(t2, e2) {
|
192
|
+
return this.add(-1 * t2, e2);
|
193
|
+
}, m3.format = function(t2) {
|
194
|
+
var e2 = this, n3 = this.$locale();
|
195
|
+
if (!this.isValid()) return n3.invalidDate || l2;
|
196
|
+
var r3 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n3.weekdays, c2 = n3.months, f3 = n3.meridiem, h2 = /* @__PURE__ */ __name(function(t3, n4, i3, s3) {
|
197
|
+
return t3 && (t3[n4] || t3(e2, r3)) || i3[n4].slice(0, s3);
|
198
|
+
}, "h"), d2 = /* @__PURE__ */ __name(function(t3) {
|
199
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
200
|
+
}, "d"), $2 = f3 || function(t3, e3, n4) {
|
201
|
+
var r4 = t3 < 12 ? "AM" : "PM";
|
202
|
+
return n4 ? r4.toLowerCase() : r4;
|
203
|
+
};
|
204
|
+
return r3.replace(y, function(t3, r4) {
|
205
|
+
return r4 || function(t4) {
|
206
|
+
switch (t4) {
|
207
|
+
case "YY":
|
208
|
+
return String(e2.$y).slice(-2);
|
209
|
+
case "YYYY":
|
210
|
+
return b.s(e2.$y, 4, "0");
|
211
|
+
case "M":
|
212
|
+
return a2 + 1;
|
213
|
+
case "MM":
|
214
|
+
return b.s(a2 + 1, 2, "0");
|
215
|
+
case "MMM":
|
216
|
+
return h2(n3.monthsShort, a2, c2, 3);
|
217
|
+
case "MMMM":
|
218
|
+
return h2(c2, a2);
|
219
|
+
case "D":
|
220
|
+
return e2.$D;
|
221
|
+
case "DD":
|
222
|
+
return b.s(e2.$D, 2, "0");
|
223
|
+
case "d":
|
224
|
+
return String(e2.$W);
|
225
|
+
case "dd":
|
226
|
+
return h2(n3.weekdaysMin, e2.$W, o2, 2);
|
227
|
+
case "ddd":
|
228
|
+
return h2(n3.weekdaysShort, e2.$W, o2, 3);
|
229
|
+
case "dddd":
|
230
|
+
return o2[e2.$W];
|
231
|
+
case "H":
|
232
|
+
return String(s2);
|
233
|
+
case "HH":
|
234
|
+
return b.s(s2, 2, "0");
|
235
|
+
case "h":
|
236
|
+
return d2(1);
|
237
|
+
case "hh":
|
238
|
+
return d2(2);
|
239
|
+
case "a":
|
240
|
+
return $2(s2, u2, !0);
|
241
|
+
case "A":
|
242
|
+
return $2(s2, u2, !1);
|
243
|
+
case "m":
|
244
|
+
return String(u2);
|
245
|
+
case "mm":
|
246
|
+
return b.s(u2, 2, "0");
|
247
|
+
case "s":
|
248
|
+
return String(e2.$s);
|
249
|
+
case "ss":
|
250
|
+
return b.s(e2.$s, 2, "0");
|
251
|
+
case "SSS":
|
252
|
+
return b.s(e2.$ms, 3, "0");
|
253
|
+
case "Z":
|
254
|
+
return i2;
|
255
|
+
}
|
256
|
+
return null;
|
257
|
+
}(t3) || i2.replace(":", "");
|
258
|
+
});
|
259
|
+
}, m3.utcOffset = function() {
|
260
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
261
|
+
}, m3.diff = function(r3, d2, l3) {
|
262
|
+
var $2, y2 = this, M3 = b.p(d2), m4 = O(r3), v2 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D2 = /* @__PURE__ */ __name(function() {
|
263
|
+
return b.m(y2, m4);
|
264
|
+
}, "D");
|
265
|
+
switch (M3) {
|
266
|
+
case h:
|
267
|
+
$2 = D2() / 12;
|
268
|
+
break;
|
269
|
+
case c:
|
270
|
+
$2 = D2();
|
271
|
+
break;
|
272
|
+
case f2:
|
273
|
+
$2 = D2() / 3;
|
274
|
+
break;
|
275
|
+
case o:
|
276
|
+
$2 = (g2 - v2) / 6048e5;
|
277
|
+
break;
|
278
|
+
case a:
|
279
|
+
$2 = (g2 - v2) / 864e5;
|
280
|
+
break;
|
281
|
+
case u:
|
282
|
+
$2 = g2 / n2;
|
283
|
+
break;
|
284
|
+
case s:
|
285
|
+
$2 = g2 / e;
|
286
|
+
break;
|
287
|
+
case i:
|
288
|
+
$2 = g2 / t;
|
289
|
+
break;
|
290
|
+
default:
|
291
|
+
$2 = g2;
|
292
|
+
}
|
293
|
+
return l3 ? $2 : b.a($2);
|
294
|
+
}, m3.daysInMonth = function() {
|
295
|
+
return this.endOf(c).$D;
|
296
|
+
}, m3.$locale = function() {
|
297
|
+
return D[this.$L];
|
298
|
+
}, m3.locale = function(t2, e2) {
|
299
|
+
if (!t2) return this.$L;
|
300
|
+
var n3 = this.clone(), r3 = w(t2, e2, !0);
|
301
|
+
return r3 && (n3.$L = r3), n3;
|
302
|
+
}, m3.clone = function() {
|
303
|
+
return b.w(this.$d, this);
|
304
|
+
}, m3.toDate = function() {
|
305
|
+
return new Date(this.valueOf());
|
306
|
+
}, m3.toJSON = function() {
|
307
|
+
return this.isValid() ? this.toISOString() : null;
|
308
|
+
}, m3.toISOString = function() {
|
309
|
+
return this.$d.toISOString();
|
310
|
+
}, m3.toString = function() {
|
311
|
+
return this.$d.toUTCString();
|
312
|
+
}, M2;
|
313
|
+
}(), k2 = _.prototype;
|
314
|
+
return O.prototype = k2, [["$ms", r2], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
315
|
+
k2[t2[1]] = function(e2) {
|
316
|
+
return this.$g(e2, t2[0], t2[1]);
|
317
|
+
};
|
318
|
+
}), O.extend = function(t2, e2) {
|
319
|
+
return t2.$i || (t2(e2, _, O), t2.$i = !0), O;
|
320
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
321
|
+
return O(1e3 * t2);
|
322
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
323
|
+
});
|
324
|
+
})(dayjs_min);
|
325
|
+
var dayjs_minExports = dayjs_min.exports;
|
326
|
+
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
|
327
|
+
var utc$1 = { exports: {} };
|
50
328
|
(function(module, exports) {
|
51
329
|
(function(t, i) {
|
52
330
|
module.exports = i();
|
@@ -67,12 +345,12 @@ var jsxRuntimeExports = jsxRuntime.exports, utc$1 = { exports: {} };
|
|
67
345
|
u.parse = function(t2) {
|
68
346
|
t2.utc && (this.$u = !0), this.$utils().u(t2.$offset) || (this.$offset = t2.$offset), o.call(this, t2);
|
69
347
|
};
|
70
|
-
var
|
348
|
+
var r2 = u.init;
|
71
349
|
u.init = function() {
|
72
350
|
if (this.$u) {
|
73
351
|
var t2 = this.$d;
|
74
352
|
this.$y = t2.getUTCFullYear(), this.$M = t2.getUTCMonth(), this.$D = t2.getUTCDate(), this.$W = t2.getUTCDay(), this.$H = t2.getUTCHours(), this.$m = t2.getUTCMinutes(), this.$s = t2.getUTCSeconds(), this.$ms = t2.getUTCMilliseconds();
|
75
|
-
} else
|
353
|
+
} else r2.call(this);
|
76
354
|
};
|
77
355
|
var a = u.utcOffset;
|
78
356
|
u.utcOffset = function(s2, f3) {
|
@@ -88,8 +366,8 @@ var jsxRuntimeExports = jsxRuntime.exports, utc$1 = { exports: {} };
|
|
88
366
|
var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2, o2 = this;
|
89
367
|
if (f3) return o2.$offset = u2, o2.$u = s2 === 0, o2;
|
90
368
|
if (s2 !== 0) {
|
91
|
-
var
|
92
|
-
(o2 = this.local().add(u2 +
|
369
|
+
var r3 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
370
|
+
(o2 = this.local().add(u2 + r3, t)).$offset = u2, o2.$x.$localOffset = r3;
|
93
371
|
} else o2 = this.utc();
|
94
372
|
return o2;
|
95
373
|
};
|
@@ -122,11 +400,11 @@ var jsxRuntimeExports = jsxRuntime.exports, utc$1 = { exports: {} };
|
|
122
400
|
})(utc$1);
|
123
401
|
var utcExports = utc$1.exports;
|
124
402
|
const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
|
125
|
-
var __defProp$
|
126
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
403
|
+
var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
404
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
127
405
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
128
|
-
return kind && result && __defProp$
|
129
|
-
}, "__decorateClass$
|
406
|
+
return kind && result && __defProp$f(target, key, result), result;
|
407
|
+
}, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a;
|
130
408
|
let DataValidationRejectInputController = (_a = class extends Disposable {
|
131
409
|
constructor(_editorBridgeService, _dataValidationModel, _dataValidatorRegistryService, _dialogService, _localeService) {
|
132
410
|
super(), this._editorBridgeService = _editorBridgeService, this._dataValidationModel = _dataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._dialogService = _dialogService, this._localeService = _localeService, this._initEditorBridgeInterceptor();
|
@@ -136,7 +414,7 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
136
414
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
|
137
415
|
{
|
138
416
|
handler: /* @__PURE__ */ __name(async (cellPromise, context, next) => {
|
139
|
-
var
|
417
|
+
var _a18;
|
140
418
|
const cell = await cellPromise, { worksheet, row, col, unitId, subUnitId, workbook } = context, ruleId = this._dataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col), rule = ruleId ? this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId) : void 0;
|
141
419
|
if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP)
|
142
420
|
return next(Promise.resolve(cell));
|
@@ -144,7 +422,7 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
144
422
|
if (!validator || await validator.validator(
|
145
423
|
{
|
146
424
|
value: getCellValueOrigin(cell),
|
147
|
-
interceptValue: getCellValueOrigin((
|
425
|
+
interceptValue: getCellValueOrigin((_a18 = context == null ? void 0 : context.origin) != null ? _a18 : cell),
|
148
426
|
row,
|
149
427
|
column: col,
|
150
428
|
unitId,
|
@@ -210,12 +488,12 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
210
488
|
});
|
211
489
|
}
|
212
490
|
}, __name(_a, "DataValidationRejectInputController"), _a);
|
213
|
-
DataValidationRejectInputController = __decorateClass$
|
214
|
-
__decorateParam$
|
215
|
-
__decorateParam$
|
216
|
-
__decorateParam$
|
217
|
-
__decorateParam$
|
218
|
-
__decorateParam$
|
491
|
+
DataValidationRejectInputController = __decorateClass$f([
|
492
|
+
__decorateParam$f(0, IEditorBridgeService),
|
493
|
+
__decorateParam$f(1, Inject(SheetDataValidationModel)),
|
494
|
+
__decorateParam$f(2, Inject(DataValidatorRegistryService)),
|
495
|
+
__decorateParam$f(3, IDialogService),
|
496
|
+
__decorateParam$f(4, Inject(LocaleService))
|
219
497
|
], DataValidationRejectInputController);
|
220
498
|
const dvDateDropdown = "univer-dv-date-dropdown", dvDateDropdownBtns = "univer-dv-date-dropdown-btns", styles$6 = {
|
221
499
|
dvDateDropdown,
|
@@ -232,15 +510,15 @@ const transformDate = /* @__PURE__ */ __name((value) => {
|
|
232
510
|
return date;
|
233
511
|
}, "transformDate");
|
234
512
|
function DateDropdown(props) {
|
235
|
-
var
|
236
|
-
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (
|
513
|
+
var _a18, _b, _c;
|
514
|
+
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, cellStr = getCellValueOrigin(worksheet.getCellRaw(row, col)), originDate = transformDate(cellStr), [localDate, setLocalDate] = useState(originDate), showTime = !!((_c = rule == null ? void 0 : rule.bizInfo) != null && _c.showTime), date = localDate && localDate.isValid() ? localDate : dayjs(), localeService = useDependency(LocaleService);
|
237
515
|
if (!cellData || !rule || !validator)
|
238
516
|
return;
|
239
517
|
const handleSave = /* @__PURE__ */ __name(async () => {
|
240
|
-
var
|
518
|
+
var _a19, _b2, _c2;
|
241
519
|
if (!date)
|
242
520
|
return;
|
243
|
-
const dateStr = date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), serialTime = (
|
521
|
+
const dateStr = date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), serialTime = (_a19 = numfmt.parseDate(dateStr)) == null ? void 0 : _a19.v, cellStyle = workbook.getStyles().getStyleByCell(cellData), format = (_c2 = (_b2 = cellStyle == null ? void 0 : cellStyle.n) == null ? void 0 : _b2.pattern) != null ? _c2 : "", patternType = getPatternType(format);
|
244
522
|
rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
|
245
523
|
value: serialTime,
|
246
524
|
unitId,
|
@@ -323,15 +601,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
323
601
|
var attrs = __assign({}, node.attrs);
|
324
602
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
325
603
|
var defIds = runtimeProps.defIds;
|
326
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
327
|
-
var key =
|
604
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a18) {
|
605
|
+
var key = _a18[0], value = _a18[1];
|
328
606
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
329
607
|
})), attrs;
|
330
608
|
}
|
331
609
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
332
610
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
333
|
-
var
|
334
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
611
|
+
var _a18, defIds = runtimeProps.defIds;
|
612
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a18 = node.children) === null || _a18 === void 0) && _a18.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
335
613
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
336
614
|
}) }) : node;
|
337
615
|
}
|
@@ -397,11 +675,11 @@ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width:
|
|
397
675
|
}));
|
398
676
|
});
|
399
677
|
SequenceSingle.displayName = "SequenceSingle";
|
400
|
-
var __defProp$
|
401
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
678
|
+
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
679
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
402
680
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
403
|
-
return kind && result && __defProp$
|
404
|
-
}, "__decorateClass$
|
681
|
+
return kind && result && __defProp$e(target, key, result), result;
|
682
|
+
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a2;
|
405
683
|
let DataValidationPanelService = (_a2 = class extends Disposable {
|
406
684
|
constructor(_univerInstanceService, _sidebarService) {
|
407
685
|
super();
|
@@ -415,7 +693,11 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
415
693
|
this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter((sheet) => !sheet)).subscribe(() => {
|
416
694
|
this.close();
|
417
695
|
})
|
418
|
-
)
|
696
|
+
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((info) => {
|
697
|
+
info.id === DATA_VALIDATION_PANEL && (info.visible || setTimeout(() => {
|
698
|
+
this._sidebarService.sidebarOptions$.next({ visible: !1 });
|
699
|
+
}));
|
700
|
+
}));
|
419
701
|
}
|
420
702
|
get activeRule() {
|
421
703
|
return this._activeRule;
|
@@ -424,15 +706,15 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
424
706
|
return this._open$.getValue();
|
425
707
|
}
|
426
708
|
dispose() {
|
427
|
-
var
|
428
|
-
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (
|
709
|
+
var _a18;
|
710
|
+
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a18 = this._closeDisposable) == null || _a18.dispose();
|
429
711
|
}
|
430
712
|
open() {
|
431
713
|
this._open$.next(!0);
|
432
714
|
}
|
433
715
|
close() {
|
434
|
-
var
|
435
|
-
this._open$.next(!1), (
|
716
|
+
var _a18;
|
717
|
+
this._open$.next(!1), (_a18 = this._closeDisposable) == null || _a18.dispose();
|
436
718
|
}
|
437
719
|
setCloseDisposable(disposable) {
|
438
720
|
this._closeDisposable = toDisposable(() => {
|
@@ -443,9 +725,9 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
443
725
|
this._activeRule = rule, this._activeRule$.next(rule);
|
444
726
|
}
|
445
727
|
}, __name(_a2, "DataValidationPanelService"), _a2);
|
446
|
-
DataValidationPanelService = __decorateClass$
|
447
|
-
__decorateParam$
|
448
|
-
__decorateParam$
|
728
|
+
DataValidationPanelService = __decorateClass$e([
|
729
|
+
__decorateParam$e(0, IUniverInstanceService),
|
730
|
+
__decorateParam$e(1, ISidebarService)
|
449
731
|
], DataValidationPanelService);
|
450
732
|
function CellDropdown() {
|
451
733
|
const dropdownManagerService = useDependency(DataValidationDropdownManagerService), activeDropdown = useObservable(dropdownManagerService.activeDropdown$, dropdownManagerService.activeDropdown), componentManager = useDependency(ComponentManager);
|
@@ -468,11 +750,11 @@ function CellDropdown() {
|
|
468
750
|
}
|
469
751
|
__name(CellDropdown, "CellDropdown");
|
470
752
|
const DROP_DOWN_KEY = "sheet.ui.dropdown";
|
471
|
-
var __defProp$
|
472
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
753
|
+
var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
754
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
473
755
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
474
|
-
return kind && result && __defProp$
|
475
|
-
}, "__decorateClass$
|
756
|
+
return kind && result && __defProp$d(target, key, result), result;
|
757
|
+
}, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d"), _a3;
|
476
758
|
let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
477
759
|
constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel, _sheetsSelectionsService) {
|
478
760
|
super();
|
@@ -535,8 +817,8 @@ let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
|
535
817
|
const disposableCollection = new DisposableCollection();
|
536
818
|
disposableCollection.add(popupDisposable), disposableCollection.add({
|
537
819
|
dispose: /* @__PURE__ */ __name(() => {
|
538
|
-
var
|
539
|
-
(_b = (
|
820
|
+
var _a18, _b;
|
821
|
+
(_b = (_a18 = this._activeDropdown) == null ? void 0 : _a18.onHide) == null || _b.call(_a18);
|
540
822
|
}, "dispose")
|
541
823
|
}), this._currentPopup = disposableCollection;
|
542
824
|
}
|
@@ -572,14 +854,14 @@ let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
|
572
854
|
});
|
573
855
|
}
|
574
856
|
}, __name(_a3, "DataValidationDropdownManagerService"), _a3);
|
575
|
-
DataValidationDropdownManagerService = __decorateClass$
|
576
|
-
__decorateParam$
|
577
|
-
__decorateParam$
|
578
|
-
__decorateParam$
|
579
|
-
__decorateParam$
|
580
|
-
__decorateParam$
|
581
|
-
__decorateParam$
|
582
|
-
__decorateParam$
|
857
|
+
DataValidationDropdownManagerService = __decorateClass$d([
|
858
|
+
__decorateParam$d(0, Inject(SheetCanvasPopManagerService)),
|
859
|
+
__decorateParam$d(1, IUniverInstanceService),
|
860
|
+
__decorateParam$d(2, Inject(DataValidatorRegistryService)),
|
861
|
+
__decorateParam$d(3, IZenZoneService),
|
862
|
+
__decorateParam$d(4, IRenderManagerService),
|
863
|
+
__decorateParam$d(5, Inject(SheetDataValidationModel)),
|
864
|
+
__decorateParam$d(6, Inject(SheetsSelectionsService))
|
583
865
|
], DataValidationDropdownManagerService);
|
584
866
|
const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperation = {
|
585
867
|
id: "data-validation.operation.open-validation-panel",
|
@@ -647,8 +929,8 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
647
929
|
dvListDropdownSplit,
|
648
930
|
dvListDropdownEdit
|
649
931
|
}, SelectList = /* @__PURE__ */ __name((props) => {
|
650
|
-
var
|
651
|
-
const { value, onChange, multiple, options, title, onEdit, style, filter: filter2, location } = props, localeService = useDependency(LocaleService), configService = useDependency(IConfigService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), { row, col, unitId, subUnitId } = location, filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0), showEditOnDropdown = (_b = (
|
932
|
+
var _a18, _b;
|
933
|
+
const { value, onChange, multiple, options, title, onEdit, style, filter: filter2, location } = props, localeService = useDependency(LocaleService), configService = useDependency(IConfigService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), { row, col, unitId, subUnitId } = location, filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0), showEditOnDropdown = (_b = (_a18 = configService.getConfig(PLUGIN_CONFIG_KEY)) == null ? void 0 : _a18.showEditOnDropdown) != null ? _b : !0, sheetPermissionInterceptorBaseController = useDependency(SheetPermissionInterceptorBaseController), hasPermission = useMemo(() => sheetPermissionInterceptorBaseController.permissionCheckWithRanges(
|
652
934
|
{
|
653
935
|
workbookTypes: [WorkbookEditablePermission],
|
654
936
|
rangeTypes: [RangeProtectionPermissionEditPoint],
|
@@ -685,18 +967,18 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
685
967
|
] });
|
686
968
|
}, "SelectList");
|
687
969
|
function ListDropDown(props) {
|
688
|
-
var
|
970
|
+
var _a18, _b;
|
689
971
|
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), [editingText, setEditingText] = useState(""), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), instanceService = useDependency(IUniverInstanceService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
|
690
972
|
useObservable(ruleChange$);
|
691
973
|
const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
|
692
974
|
if (useEffect(() => {
|
693
975
|
const dispose = commandService.onCommandExecuted((command) => {
|
694
|
-
var
|
976
|
+
var _a19, _b2;
|
695
977
|
if (command.id === RichTextEditingMutation.id) {
|
696
978
|
const params = command.params, { unitId: unitId2 } = params, unit = instanceService.getUnit(unitId2, UniverInstanceType.UNIVER_DOC);
|
697
979
|
if (!unit)
|
698
980
|
return;
|
699
|
-
const text = BuildTextUtils.transform.getPlainText((_b2 = (
|
981
|
+
const text = BuildTextUtils.transform.getPlainText((_b2 = (_a19 = unit.getSnapshot().body) == null ? void 0 : _a19.dataStream) != null ? _b2 : "");
|
700
982
|
setEditingText(text);
|
701
983
|
}
|
702
984
|
});
|
@@ -705,7 +987,7 @@ function ListDropDown(props) {
|
|
705
987
|
};
|
706
988
|
}, [commandService, instanceService]), !worksheet)
|
707
989
|
return null;
|
708
|
-
const cellData = worksheet.getCell(row, col), rule = (
|
990
|
+
const cellData = worksheet.getCell(row, col), rule = (_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
|
709
991
|
if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
|
710
992
|
return;
|
711
993
|
const multiple = rule.type === DataValidationType.LIST_MULTIPLE, list = validator.getListWithColor(rule, unitId, subUnitId), cellStr = localValue || getDataValidationCellValue(worksheet.getCellRaw(row, col)), value = deserializeListOptions(cellStr), handleEdit = /* @__PURE__ */ __name(() => {
|
@@ -761,7 +1043,7 @@ const dataValidationOptionsButton = "univer-data-validation-options-button", dat
|
|
761
1043
|
dataValidationOptionsButtonIcon
|
762
1044
|
};
|
763
1045
|
function DataValidationOptions(props) {
|
764
|
-
var
|
1046
|
+
var _a18;
|
765
1047
|
const localeService = useDependency(LocaleService), componentManager = useDependency(ComponentManager), { value, onChange, extraComponent } = props, [show, setShow] = useState(!1), ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
|
766
1048
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
767
1049
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.dataValidationOptionsButton, onClick: /* @__PURE__ */ __name(() => setShow(!show), "onClick"), children: [
|
@@ -777,7 +1059,7 @@ function DataValidationOptions(props) {
|
|
777
1059
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
778
1060
|
RadioGroup,
|
779
1061
|
{
|
780
|
-
value: `${(
|
1062
|
+
value: `${(_a18 = value.errorStyle) != null ? _a18 : DataValidationErrorStyle.WARNING}`,
|
781
1063
|
onChange: /* @__PURE__ */ __name((errorStyle) => onChange({ ...value, errorStyle: +errorStyle }), "onChange"),
|
782
1064
|
children: [
|
783
1065
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationErrorStyle.WARNING}`, children: localeService.t("dataValidation.panel.showWarning") }),
|
@@ -821,8 +1103,13 @@ const dataValidationDetail = "univer-data-validation-detail", dataValidationDeta
|
|
821
1103
|
},
|
822
1104
|
1e3
|
823
1105
|
), "debounceExecuteFactory");
|
1106
|
+
function getSheetIdByName(univerInstanceService, unitId, name) {
|
1107
|
+
var _a18, _b, _c, _d;
|
1108
|
+
return unitId ? ((_b = (_a18 = univerInstanceService.getUnit(unitId)) == null ? void 0 : _a18.getSheetBySheetName(name)) == null ? void 0 : _b.getSheetId()) || "" : ((_d = (_c = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _c.getSheetBySheetName(name)) == null ? void 0 : _d.getSheetId()) || "";
|
1109
|
+
}
|
1110
|
+
__name(getSheetIdByName, "getSheetIdByName");
|
824
1111
|
function DataValidationDetail() {
|
825
|
-
const [key, setKey] = useState(0), dataValidationPanelService = useDependency(DataValidationPanelService), activeRuleInfo = useObservable(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule), { unitId, subUnitId, rule } = activeRuleInfo || {}, ruleId = rule.uid, validatorService = useDependency(DataValidatorRegistryService), componentManager = useDependency(ComponentManager), commandService = useDependency(ICommandService), dataValidationModel = useDependency(DataValidationModel), localeService = useDependency(LocaleService), [localRule, setLocalRule] = useState(rule), validator = validatorService.getValidatorItem(localRule.type), [showError, setShowError] = useState(!1), validators = validatorService.getValidatorsByScope(DataValidatorRegistryScope.SHEET), [localRanges, setLocalRanges] = useState(() => localRule.ranges.map((i) => ({ unitId: "", sheetId: "", range: i }))), debounceExecute = useMemo(() => debounceExecuteFactory(commandService), [commandService]), sheetSelectionService = useDependency(SheetsSelectionsService);
|
1112
|
+
const [key, setKey] = useState(0), dataValidationPanelService = useDependency(DataValidationPanelService), activeRuleInfo = useObservable(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule), { unitId, subUnitId, rule } = activeRuleInfo || {}, ruleId = rule.uid, validatorService = useDependency(DataValidatorRegistryService), univerInstanceService = useDependency(IUniverInstanceService), componentManager = useDependency(ComponentManager), commandService = useDependency(ICommandService), dataValidationModel = useDependency(DataValidationModel), localeService = useDependency(LocaleService), [localRule, setLocalRule] = useState(rule), validator = validatorService.getValidatorItem(localRule.type), [showError, setShowError] = useState(!1), validators = validatorService.getValidatorsByScope(DataValidatorRegistryScope.SHEET), [localRanges, setLocalRanges] = useState(() => localRule.ranges.map((i) => ({ unitId: "", sheetId: "", range: i }))), debounceExecute = useMemo(() => debounceExecuteFactory(commandService), [commandService]), rangeSelectorActionsRef = useRef({}), [isFocusRangeSelector, isFocusRangeSelectorSet] = useState(!1), sheetSelectionService = useDependency(SheetsSelectionsService);
|
826
1113
|
if (useEffect(() => () => {
|
827
1114
|
const currentSelection = sheetSelectionService.getCurrentLastSelection();
|
828
1115
|
currentSelection && sheetSelectionService.setSelections([currentSelection]);
|
@@ -837,7 +1124,18 @@ function DataValidationDetail() {
|
|
837
1124
|
return null;
|
838
1125
|
const operators = validator.operators, operatorNames = validator.operatorNames, isTwoFormula = localRule.operator ? TWO_FORMULA_OPERATOR_COUNT.includes(localRule.operator) : !1, handleOk = /* @__PURE__ */ __name(() => {
|
839
1126
|
localRule.ranges.length && (validator.validatorFormula(localRule, unitId, subUnitId).success ? dataValidationPanelService.setActiveRule(null) : setShowError(!0));
|
840
|
-
}, "handleOk"), handleUpdateRuleRanges = useEvent((
|
1127
|
+
}, "handleOk"), handleUpdateRuleRanges = useEvent((rangeText) => {
|
1128
|
+
const unitRanges = rangeText.split(",").map(deserializeRangeWithSheet).map((unitRange) => {
|
1129
|
+
const sheetName = unitRange.sheetName;
|
1130
|
+
if (sheetName) {
|
1131
|
+
const sheetId = getSheetIdByName(univerInstanceService, unitRange.unitId, sheetName);
|
1132
|
+
return { ...unitRange, sheetId };
|
1133
|
+
}
|
1134
|
+
return {
|
1135
|
+
...unitRange,
|
1136
|
+
sheetId: ""
|
1137
|
+
};
|
1138
|
+
});
|
841
1139
|
if (isUnitRangesEqual(unitRanges, localRanges))
|
842
1140
|
return;
|
843
1141
|
setLocalRanges(unitRanges);
|
@@ -917,8 +1215,12 @@ function DataValidationDetail() {
|
|
917
1215
|
options: newOptions
|
918
1216
|
}
|
919
1217
|
));
|
920
|
-
}, "handleUpdateRuleOptions")
|
921
|
-
|
1218
|
+
}, "handleUpdateRuleOptions"), handlePanelClick = /* @__PURE__ */ __name((e) => {
|
1219
|
+
var _a18;
|
1220
|
+
const handleOutClick = (_a18 = rangeSelectorActionsRef.current) == null ? void 0 : _a18.handleOutClick;
|
1221
|
+
handleOutClick && handleOutClick(e, isFocusRangeSelectorSet);
|
1222
|
+
}, "handlePanelClick");
|
1223
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$3.dataValidationDetail, onClick: handlePanelClick, children: [
|
922
1224
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
923
1225
|
FormLayout,
|
924
1226
|
{
|
@@ -927,16 +1229,13 @@ function DataValidationDetail() {
|
|
927
1229
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
928
1230
|
RangeSelector,
|
929
1231
|
{
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
}, "onChange")
|
938
|
-
},
|
939
|
-
key
|
1232
|
+
unitId,
|
1233
|
+
subUnitId,
|
1234
|
+
initValue: rangeStr,
|
1235
|
+
onChange: handleUpdateRuleRanges,
|
1236
|
+
isFocus: isFocusRangeSelector,
|
1237
|
+
actions: rangeSelectorActionsRef.current
|
1238
|
+
}
|
940
1239
|
)
|
941
1240
|
}
|
942
1241
|
),
|
@@ -1013,8 +1312,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
1013
1312
|
}), e.stopPropagation();
|
1014
1313
|
}, "handleDelete");
|
1015
1314
|
return useEffect(() => () => {
|
1016
|
-
var
|
1017
|
-
ids.current && ((
|
1315
|
+
var _a18;
|
1316
|
+
ids.current && ((_a18 = ids.current) == null || _a18.forEach((id) => {
|
1018
1317
|
id && markSelectionService.removeShape(id);
|
1019
1318
|
}));
|
1020
1319
|
}, [markSelectionService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
@@ -1045,8 +1344,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
1045
1344
|
})));
|
1046
1345
|
}, "onMouseEnter"),
|
1047
1346
|
onMouseLeave: /* @__PURE__ */ __name(() => {
|
1048
|
-
var
|
1049
|
-
setIsHover(!1), (
|
1347
|
+
var _a18;
|
1348
|
+
setIsHover(!1), (_a18 = ids.current) == null || _a18.forEach((id) => {
|
1050
1349
|
id && markSelectionService.removeShape(id);
|
1051
1350
|
}), ids.current = void 0;
|
1052
1351
|
}, "onMouseLeave"),
|
@@ -1105,7 +1404,7 @@ function DataValidationListWithWorkbook(props) {
|
|
1105
1404
|
}, "getDvRulesByPermissionCorrect"))(rules), hasDisableRule = rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
|
1106
1405
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dataValidationList, children: [
|
1107
1406
|
rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.map((rule) => {
|
1108
|
-
var
|
1407
|
+
var _a18;
|
1109
1408
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1110
1409
|
DataValidationItem,
|
1111
1410
|
{
|
@@ -1119,7 +1418,7 @@ function DataValidationListWithWorkbook(props) {
|
|
1119
1418
|
});
|
1120
1419
|
}, "onClick"),
|
1121
1420
|
rule,
|
1122
|
-
disable: (
|
1421
|
+
disable: (_a18 = rule.disable) != null ? _a18 : !1
|
1123
1422
|
},
|
1124
1423
|
rule.uid
|
1125
1424
|
);
|
@@ -1137,7 +1436,7 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
1137
1436
|
}, "DataValidationPanel"), LIST_DROPDOWN_KEY = "data-validation.list.dropdown", DATE_DROPDOWN_KEY = "data-validation.date.dropdown", AddSheetDataValidationAndOpenCommand = {
|
1138
1437
|
type: CommandType.COMMAND,
|
1139
1438
|
id: "data-validation.command.addRuleAndOpen",
|
1140
|
-
|
1439
|
+
handler(accessor) {
|
1141
1440
|
const univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
|
1142
1441
|
if (!target) return !1;
|
1143
1442
|
const { workbook, worksheet } = target, rule = createDefaultNewRule(accessor), commandService = accessor.get(ICommandService), unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), addParams = {
|
@@ -1145,17 +1444,17 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
1145
1444
|
unitId,
|
1146
1445
|
subUnitId
|
1147
1446
|
};
|
1148
|
-
return
|
1447
|
+
return commandService.syncExecuteCommand(AddSheetDataValidationCommand.id, addParams) ? (commandService.syncExecuteCommand(OpenValidationPanelOperation.id, {
|
1149
1448
|
ruleId: rule.uid,
|
1150
1449
|
isAdd: !0
|
1151
1450
|
}), !0) : !1;
|
1152
1451
|
}
|
1153
1452
|
};
|
1154
|
-
var __defProp$
|
1155
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1453
|
+
var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1454
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1156
1455
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1157
|
-
return kind && result && __defProp$
|
1158
|
-
}, "__decorateClass$
|
1456
|
+
return kind && result && __defProp$c(target, key, result), result;
|
1457
|
+
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
|
1159
1458
|
const ALERT_KEY = "SHEET_DATA_VALIDATION_ALERT";
|
1160
1459
|
var _a4;
|
1161
1460
|
let DataValidationAlertController = (_a4 = class extends Disposable {
|
@@ -1167,12 +1466,12 @@ let DataValidationAlertController = (_a4 = class extends Disposable {
|
|
1167
1466
|
}
|
1168
1467
|
_initCellAlertPopup() {
|
1169
1468
|
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cellPos) => {
|
1170
|
-
var
|
1469
|
+
var _a18, _b;
|
1171
1470
|
if (cellPos) {
|
1172
1471
|
const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
|
1173
1472
|
if (!worksheet) return;
|
1174
1473
|
const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);
|
1175
|
-
if (((
|
1474
|
+
if (((_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.validStatus) === DataValidationStatus.INVALID) {
|
1176
1475
|
const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_b = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _b.location;
|
1177
1476
|
if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
|
1178
1477
|
return;
|
@@ -1200,18 +1499,18 @@ let DataValidationAlertController = (_a4 = class extends Disposable {
|
|
1200
1499
|
}));
|
1201
1500
|
}
|
1202
1501
|
}, __name(_a4, "DataValidationAlertController"), _a4);
|
1203
|
-
DataValidationAlertController = __decorateClass$
|
1204
|
-
__decorateParam$
|
1205
|
-
__decorateParam$
|
1206
|
-
__decorateParam$
|
1207
|
-
__decorateParam$
|
1208
|
-
__decorateParam$
|
1502
|
+
DataValidationAlertController = __decorateClass$c([
|
1503
|
+
__decorateParam$c(0, Inject(HoverManagerService)),
|
1504
|
+
__decorateParam$c(1, Inject(CellAlertManagerService)),
|
1505
|
+
__decorateParam$c(2, IUniverInstanceService),
|
1506
|
+
__decorateParam$c(3, Inject(LocaleService)),
|
1507
|
+
__decorateParam$c(4, IZenZoneService)
|
1209
1508
|
], DataValidationAlertController);
|
1210
|
-
var __defProp$
|
1211
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1509
|
+
var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1510
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1212
1511
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1213
|
-
return kind && result && __defProp$
|
1214
|
-
}, "__decorateClass$
|
1512
|
+
return kind && result && __defProp$b(target, key, result), result;
|
1513
|
+
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a5;
|
1215
1514
|
let DataValidationAutoFillController = (_a5 = class extends Disposable {
|
1216
1515
|
constructor(_autoFillService, _dataValidationModel, _injector) {
|
1217
1516
|
super(), this._autoFillService = _autoFillService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initAutoFill();
|
@@ -1288,16 +1587,16 @@ let DataValidationAutoFillController = (_a5 = class extends Disposable {
|
|
1288
1587
|
this.disposeWithMe(this._autoFillService.addHook(hook));
|
1289
1588
|
}
|
1290
1589
|
}, __name(_a5, "DataValidationAutoFillController"), _a5);
|
1291
|
-
DataValidationAutoFillController = __decorateClass$
|
1292
|
-
__decorateParam$
|
1293
|
-
__decorateParam$
|
1294
|
-
__decorateParam$
|
1590
|
+
DataValidationAutoFillController = __decorateClass$b([
|
1591
|
+
__decorateParam$b(0, IAutoFillService),
|
1592
|
+
__decorateParam$b(1, Inject(SheetDataValidationModel)),
|
1593
|
+
__decorateParam$b(2, Inject(Injector))
|
1295
1594
|
], DataValidationAutoFillController);
|
1296
|
-
var __defProp$
|
1297
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1595
|
+
var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPropertyDescriptor, __decorateClass$a = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1596
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1298
1597
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1299
|
-
return kind && result && __defProp$
|
1300
|
-
}, "__decorateClass$
|
1598
|
+
return kind && result && __defProp$a(target, key, result), result;
|
1599
|
+
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a6;
|
1301
1600
|
let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
1302
1601
|
constructor(_sheetClipboardService, _sheetDataValidationModel, _injector) {
|
1303
1602
|
super();
|
@@ -1353,8 +1652,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1353
1652
|
if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
|
1354
1653
|
const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(copyInfo.unitId, copyInfo.subUnitId).clone(), additionMatrix = new ObjectMatrix(), addRules = /* @__PURE__ */ new Set(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]), repeatRange = getRepeatRange(vCopyRange, vPastedRange, !0), additionRules = /* @__PURE__ */ new Map();
|
1355
1654
|
repeatRange.forEach(({ startRange }) => {
|
1356
|
-
var
|
1357
|
-
(
|
1655
|
+
var _a18;
|
1656
|
+
(_a18 = this._copyInfo) == null || _a18.matrix.forValue((row, col, ruleId) => {
|
1358
1657
|
const range = Rectangle.getPositionRange(
|
1359
1658
|
{
|
1360
1659
|
startRow: row,
|
@@ -1385,8 +1684,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1385
1684
|
} else {
|
1386
1685
|
const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone(), additionMatrix = new ObjectMatrix(), additionRules = /* @__PURE__ */ new Set(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
|
1387
1686
|
getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
|
1388
|
-
var
|
1389
|
-
(
|
1687
|
+
var _a18;
|
1688
|
+
(_a18 = this._copyInfo) == null || _a18.matrix.forValue((row, col, ruleId) => {
|
1390
1689
|
const range = Rectangle.getPositionRange(
|
1391
1690
|
{
|
1392
1691
|
startRow: row,
|
@@ -1415,16 +1714,16 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1415
1714
|
}
|
1416
1715
|
}
|
1417
1716
|
}, __name(_a6, "DataValidationCopyPasteController"), _a6);
|
1418
|
-
DataValidationCopyPasteController = __decorateClass$
|
1419
|
-
__decorateParam$
|
1420
|
-
__decorateParam$
|
1421
|
-
__decorateParam$
|
1717
|
+
DataValidationCopyPasteController = __decorateClass$a([
|
1718
|
+
__decorateParam$a(0, ISheetClipboardService),
|
1719
|
+
__decorateParam$a(1, Inject(SheetDataValidationModel)),
|
1720
|
+
__decorateParam$a(2, Inject(Injector))
|
1422
1721
|
], DataValidationCopyPasteController);
|
1423
|
-
var __defProp$
|
1424
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1722
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1723
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1425
1724
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1426
|
-
return kind && result && __defProp$
|
1427
|
-
}, "__decorateClass$
|
1725
|
+
return kind && result && __defProp$9(target, key, result), result;
|
1726
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a7;
|
1428
1727
|
let DataValidationPermissionController = (_a7 = class extends Disposable {
|
1429
1728
|
constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
|
1430
1729
|
super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
|
@@ -1445,10 +1744,10 @@ let DataValidationPermissionController = (_a7 = class extends Disposable {
|
|
1445
1744
|
);
|
1446
1745
|
}
|
1447
1746
|
}, __name(_a7, "DataValidationPermissionController"), _a7);
|
1448
|
-
DataValidationPermissionController = __decorateClass$
|
1449
|
-
__decorateParam$
|
1450
|
-
__decorateParam$
|
1451
|
-
__decorateParam$
|
1747
|
+
DataValidationPermissionController = __decorateClass$9([
|
1748
|
+
__decorateParam$9(0, Inject(LocaleService)),
|
1749
|
+
__decorateParam$9(1, ICommandService),
|
1750
|
+
__decorateParam$9(2, Inject(SheetPermissionInterceptorBaseController))
|
1452
1751
|
], DataValidationPermissionController);
|
1453
1752
|
const DataValidationIcon = "data-validation-single", DATA_VALIDATION_MENU_ID = "sheet.menu.data-validation";
|
1454
1753
|
function dataValidationMenuFactory(accessor) {
|
@@ -1494,11 +1793,11 @@ const menuSchema = {
|
|
1494
1793
|
}
|
1495
1794
|
}
|
1496
1795
|
};
|
1497
|
-
var __defProp$
|
1498
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1796
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1797
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1499
1798
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1500
|
-
return kind && result && __defProp$
|
1501
|
-
}, "__decorateClass$
|
1799
|
+
return kind && result && __defProp$8(target, key, result), result;
|
1800
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
|
1502
1801
|
const INVALID_MARK = {
|
1503
1802
|
tr: {
|
1504
1803
|
size: 6,
|
@@ -1507,17 +1806,17 @@ const INVALID_MARK = {
|
|
1507
1806
|
};
|
1508
1807
|
var _a8;
|
1509
1808
|
let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
1510
|
-
constructor(_commandService, _menuManagerService, _renderManagerService, _univerInstanceService, _autoHeightController, _dropdownManagerService, _sheetDataValidationModel, _dataValidatorRegistryService, _sheetInterceptorService, _editorBridgeService) {
|
1511
|
-
super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._autoHeightController = _autoHeightController, this._dropdownManagerService = _dropdownManagerService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._editorBridgeService = _editorBridgeService, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1809
|
+
constructor(_commandService, _menuManagerService, _renderManagerService, _univerInstanceService, _autoHeightController, _dropdownManagerService, _sheetDataValidationModel, _dataValidatorRegistryService, _sheetInterceptorService, _dataValidationCacheService, _editorBridgeService) {
|
1810
|
+
super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._autoHeightController = _autoHeightController, this._dropdownManagerService = _dropdownManagerService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationCacheService = _dataValidationCacheService, this._editorBridgeService = _editorBridgeService, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1512
1811
|
}
|
1513
1812
|
_initMenu() {
|
1514
1813
|
this._menuManagerService.mergeMenu(menuSchema);
|
1515
1814
|
}
|
1516
1815
|
_initDropdown() {
|
1517
1816
|
this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {
|
1518
|
-
var
|
1817
|
+
var _a18;
|
1519
1818
|
if (!visible.visible) {
|
1520
|
-
((
|
1819
|
+
((_a18 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a18.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
|
1521
1820
|
return;
|
1522
1821
|
}
|
1523
1822
|
const state = this._editorBridgeService.getEditCellState();
|
@@ -1567,24 +1866,24 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1567
1866
|
priority: InterceptCellContentPriority.DATA_VALIDATION,
|
1568
1867
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1569
1868
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
1570
|
-
var
|
1869
|
+
var _a18, _b, _c, _d, _e, _f;
|
1571
1870
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
1572
1871
|
if (!ruleId)
|
1573
1872
|
return next(cell);
|
1574
1873
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
1575
1874
|
if (!rule)
|
1576
1875
|
return next(cell);
|
1577
|
-
const validStatus = this.
|
1876
|
+
const validStatus = (_b = (_a18 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) == null ? void 0 : _a18.status) != null ? _b : DataValidationStatus.VALID, validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellOrigin = pos.rawData;
|
1578
1877
|
let cache;
|
1579
1878
|
const cellValue = {
|
1580
1879
|
get value() {
|
1581
|
-
var
|
1582
|
-
return cache !== void 0 || (cache = (
|
1880
|
+
var _a19;
|
1881
|
+
return cache !== void 0 || (cache = (_a19 = getCellValueOrigin(cellOrigin)) != null ? _a19 : null), cache;
|
1583
1882
|
}
|
1584
1883
|
}, valueStr = {
|
1585
1884
|
get value() {
|
1586
|
-
var
|
1587
|
-
return `${(
|
1885
|
+
var _a19;
|
1886
|
+
return `${(_a19 = cellValue.value) != null ? _a19 : ""}`;
|
1588
1887
|
}
|
1589
1888
|
};
|
1590
1889
|
return next({
|
@@ -1600,12 +1899,12 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1600
1899
|
...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
|
1601
1900
|
},
|
1602
1901
|
customRender: [
|
1603
|
-
...(
|
1902
|
+
...(_c = cell == null ? void 0 : cell.customRender) != null ? _c : [],
|
1604
1903
|
...validator != null && validator.canvasRender ? [validator.canvasRender] : []
|
1605
1904
|
],
|
1606
1905
|
fontRenderExtension: {
|
1607
1906
|
...cell == null ? void 0 : cell.fontRenderExtension,
|
1608
|
-
isSkip: ((
|
1907
|
+
isSkip: ((_d = cell == null ? void 0 : cell.fontRenderExtension) == null ? void 0 : _d.isSkip) || ((_e = validator == null ? void 0 : validator.skipDefaultFontRender) == null ? void 0 : _e.call(validator, rule, cellValue.value, pos))
|
1609
1908
|
},
|
1610
1909
|
interceptorStyle: {
|
1611
1910
|
...cell == null ? void 0 : cell.interceptorStyle,
|
@@ -1617,8 +1916,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1617
1916
|
})
|
1618
1917
|
},
|
1619
1918
|
interceptorAutoHeight: /* @__PURE__ */ __name(() => {
|
1620
|
-
var
|
1621
|
-
const skeleton = (_b2 = (
|
1919
|
+
var _a19, _b2, _c2, _d2, _e2, _f2;
|
1920
|
+
const skeleton = (_b2 = (_a19 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a19.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b2.skeleton;
|
1622
1921
|
if (!skeleton)
|
1623
1922
|
return;
|
1624
1923
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col), info = {
|
@@ -1640,9 +1939,9 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1640
1939
|
workbook,
|
1641
1940
|
worksheet
|
1642
1941
|
};
|
1643
|
-
return (
|
1942
|
+
return (_f2 = (_e2 = validator == null ? void 0 : validator.canvasRender) == null ? void 0 : _e2.calcCellAutoHeight) == null ? void 0 : _f2.call(_e2, info);
|
1644
1943
|
}, "interceptorAutoHeight"),
|
1645
|
-
coverable: ((
|
1944
|
+
coverable: ((_f = cell == null ? void 0 : cell.coverable) != null ? _f : !0) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE)
|
1646
1945
|
});
|
1647
1946
|
}, "handler")
|
1648
1947
|
}
|
@@ -1658,8 +1957,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1658
1957
|
).subscribe((infos) => {
|
1659
1958
|
const ranges = [];
|
1660
1959
|
if (infos.forEach((info) => {
|
1661
|
-
var
|
1662
|
-
(
|
1960
|
+
var _a18;
|
1961
|
+
(_a18 = info.rule) != null && _a18.ranges && ranges.push(...info.rule.ranges);
|
1663
1962
|
}), ranges.length) {
|
1664
1963
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
1665
1964
|
sequenceExecute(mutations.redos, this._commandService);
|
@@ -1667,22 +1966,23 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1667
1966
|
});
|
1668
1967
|
}
|
1669
1968
|
}, __name(_a8, "SheetsDataValidationRenderController"), _a8);
|
1670
|
-
SheetsDataValidationRenderController = __decorateClass$
|
1671
|
-
__decorateParam$
|
1672
|
-
__decorateParam$
|
1673
|
-
__decorateParam$
|
1674
|
-
__decorateParam$
|
1675
|
-
__decorateParam$
|
1676
|
-
__decorateParam$
|
1677
|
-
__decorateParam$
|
1678
|
-
__decorateParam$
|
1679
|
-
__decorateParam$
|
1680
|
-
__decorateParam$
|
1969
|
+
SheetsDataValidationRenderController = __decorateClass$8([
|
1970
|
+
__decorateParam$8(0, ICommandService),
|
1971
|
+
__decorateParam$8(1, IMenuManagerService),
|
1972
|
+
__decorateParam$8(2, IRenderManagerService),
|
1973
|
+
__decorateParam$8(3, IUniverInstanceService),
|
1974
|
+
__decorateParam$8(4, Inject(AutoHeightController)),
|
1975
|
+
__decorateParam$8(5, Inject(DataValidationDropdownManagerService)),
|
1976
|
+
__decorateParam$8(6, Inject(SheetDataValidationModel)),
|
1977
|
+
__decorateParam$8(7, Inject(DataValidatorRegistryService)),
|
1978
|
+
__decorateParam$8(8, Inject(SheetInterceptorService)),
|
1979
|
+
__decorateParam$8(9, Inject(DataValidationCacheService)),
|
1980
|
+
__decorateParam$8(10, Optional(IEditorBridgeService))
|
1681
1981
|
], SheetsDataValidationRenderController);
|
1682
1982
|
var _a9;
|
1683
1983
|
let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposable {
|
1684
|
-
constructor(_commandService, _renderManagerService, _autoHeightController, _dataValidatorRegistryService, _sheetInterceptorService, _sheetDataValidationModel) {
|
1685
|
-
super(), this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._autoHeightController = _autoHeightController, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDataValidationModel = _sheetDataValidationModel, this._initViewModelIntercept(), this._initAutoHeight();
|
1984
|
+
constructor(_commandService, _renderManagerService, _autoHeightController, _dataValidatorRegistryService, _sheetInterceptorService, _sheetDataValidationModel, _dataValidationCacheService) {
|
1985
|
+
super(), this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._autoHeightController = _autoHeightController, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._initViewModelIntercept(), this._initAutoHeight();
|
1686
1986
|
}
|
1687
1987
|
// eslint-disable-next-line max-lines-per-function
|
1688
1988
|
_initViewModelIntercept() {
|
@@ -1695,14 +1995,14 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1695
1995
|
priority: InterceptCellContentPriority.DATA_VALIDATION,
|
1696
1996
|
// eslint-disable-next-line complexity
|
1697
1997
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
1698
|
-
var
|
1998
|
+
var _a18, _b, _c, _d, _e, _f;
|
1699
1999
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
1700
2000
|
if (!ruleId)
|
1701
2001
|
return next(cell);
|
1702
2002
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
1703
2003
|
if (!rule)
|
1704
2004
|
return next(cell);
|
1705
|
-
const validStatus = this.
|
2005
|
+
const validStatus = (_b = (_a18 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) == null ? void 0 : _a18.status) != null ? _b : DataValidationStatus.VALID, validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellOrigin = worksheet.getCellRaw(row, col), cellValue = getCellValueOrigin(cellOrigin), valueStr = `${cellValue != null ? cellValue : ""}`;
|
1706
2006
|
return next({
|
1707
2007
|
...cell,
|
1708
2008
|
dataValidation: {
|
@@ -1716,12 +2016,12 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1716
2016
|
...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
|
1717
2017
|
},
|
1718
2018
|
customRender: [
|
1719
|
-
...(
|
2019
|
+
...(_c = cell == null ? void 0 : cell.customRender) != null ? _c : [],
|
1720
2020
|
...validator != null && validator.canvasRender ? [validator.canvasRender] : []
|
1721
2021
|
],
|
1722
2022
|
fontRenderExtension: {
|
1723
2023
|
...cell == null ? void 0 : cell.fontRenderExtension,
|
1724
|
-
isSkip: ((
|
2024
|
+
isSkip: ((_d = cell == null ? void 0 : cell.fontRenderExtension) == null ? void 0 : _d.isSkip) || ((_e = validator == null ? void 0 : validator.skipDefaultFontRender) == null ? void 0 : _e.call(validator, rule, cellValue, pos))
|
1725
2025
|
},
|
1726
2026
|
interceptorStyle: {
|
1727
2027
|
...cell == null ? void 0 : cell.interceptorStyle,
|
@@ -1733,8 +2033,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1733
2033
|
})
|
1734
2034
|
},
|
1735
2035
|
interceptorAutoHeight: /* @__PURE__ */ __name(() => {
|
1736
|
-
var
|
1737
|
-
const skeleton = (_b2 = (
|
2036
|
+
var _a19, _b2, _c2, _d2, _e2, _f2;
|
2037
|
+
const skeleton = (_b2 = (_a19 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a19.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b2.skeleton;
|
1738
2038
|
if (!skeleton)
|
1739
2039
|
return;
|
1740
2040
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col), info = {
|
@@ -1756,9 +2056,9 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1756
2056
|
workbook,
|
1757
2057
|
worksheet
|
1758
2058
|
};
|
1759
|
-
return (
|
2059
|
+
return (_f2 = (_e2 = validator == null ? void 0 : validator.canvasRender) == null ? void 0 : _e2.calcCellAutoHeight) == null ? void 0 : _f2.call(_e2, info);
|
1760
2060
|
}, "interceptorAutoHeight"),
|
1761
|
-
coverable: ((
|
2061
|
+
coverable: ((_f = cell == null ? void 0 : cell.coverable) != null ? _f : !0) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE)
|
1762
2062
|
});
|
1763
2063
|
}, "handler")
|
1764
2064
|
}
|
@@ -1772,8 +2072,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1772
2072
|
).subscribe((infos) => {
|
1773
2073
|
const ranges = [];
|
1774
2074
|
if (infos.forEach((info) => {
|
1775
|
-
var
|
1776
|
-
(
|
2075
|
+
var _a18;
|
2076
|
+
(_a18 = info.rule) != null && _a18.ranges && ranges.push(...info.rule.ranges);
|
1777
2077
|
}), ranges.length) {
|
1778
2078
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
1779
2079
|
sequenceExecute(mutations.redos, this._commandService);
|
@@ -1781,14 +2081,44 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1781
2081
|
});
|
1782
2082
|
}
|
1783
2083
|
}, __name(_a9, "SheetsDataValidationMobileRenderController"), _a9);
|
1784
|
-
SheetsDataValidationMobileRenderController = __decorateClass$
|
1785
|
-
__decorateParam$
|
1786
|
-
__decorateParam$
|
1787
|
-
__decorateParam$
|
1788
|
-
__decorateParam$
|
1789
|
-
__decorateParam$
|
1790
|
-
__decorateParam$
|
2084
|
+
SheetsDataValidationMobileRenderController = __decorateClass$8([
|
2085
|
+
__decorateParam$8(0, ICommandService),
|
2086
|
+
__decorateParam$8(1, IRenderManagerService),
|
2087
|
+
__decorateParam$8(2, Inject(AutoHeightController)),
|
2088
|
+
__decorateParam$8(3, Inject(DataValidatorRegistryService)),
|
2089
|
+
__decorateParam$8(4, Inject(SheetInterceptorService)),
|
2090
|
+
__decorateParam$8(5, Inject(SheetDataValidationModel)),
|
2091
|
+
__decorateParam$8(6, Inject(DataValidationCacheService))
|
1791
2092
|
], SheetsDataValidationMobileRenderController);
|
2093
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
2094
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
2095
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
2096
|
+
return kind && result && __defProp$7(target, key, result), result;
|
2097
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a10;
|
2098
|
+
let SheetsDataValidationReRenderController = (_a10 = class extends Disposable {
|
2099
|
+
constructor(_context, _sheetDataValidationModel, _sheetSkeletonManagerService) {
|
2100
|
+
super(), this._context = _context, this._sheetDataValidationModel = _sheetDataValidationModel, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._initSkeletonChange();
|
2101
|
+
}
|
2102
|
+
_initSkeletonChange() {
|
2103
|
+
const reRender = /* @__PURE__ */ __name((values) => {
|
2104
|
+
var _a18;
|
2105
|
+
if (!values.length)
|
2106
|
+
return;
|
2107
|
+
const sheetIds = /* @__PURE__ */ new Set();
|
2108
|
+
values.forEach((value) => {
|
2109
|
+
sheetIds.add(value.subUnitId);
|
2110
|
+
}), sheetIds.forEach((sheetId) => {
|
2111
|
+
var _a19;
|
2112
|
+
(_a19 = this._sheetSkeletonManagerService.getWorksheetSkeleton(sheetId)) == null || _a19.skeleton.makeDirty(!0);
|
2113
|
+
}), (_a18 = this._context.mainComponent) == null || _a18.makeForceDirty();
|
2114
|
+
}, "reRender");
|
2115
|
+
this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(bufferDebounceTime(16)).subscribe(reRender));
|
2116
|
+
}
|
2117
|
+
}, __name(_a10, "SheetsDataValidationReRenderController"), _a10);
|
2118
|
+
SheetsDataValidationReRenderController = __decorateClass$7([
|
2119
|
+
__decorateParam$7(1, Inject(SheetDataValidationModel)),
|
2120
|
+
__decorateParam$7(2, Inject(SheetSkeletonManagerService))
|
2121
|
+
], SheetsDataValidationReRenderController);
|
1792
2122
|
const dataValidationFormula = "univer-data-validation-formula", dataValidationFormulaAnd = "univer-data-validation-formula-and", dataValidationFormulaListItem = "univer-data-validation-formula-list-item", dataValidationFormulaListItemIcon = "univer-data-validation-formula-list-item-icon", dataValidationFormulaListItemDrag = "univer-data-validation-formula-list-item-drag", dataValidationFormulaListAdd = "univer-data-validation-formula-list-add", dataValidationFormulaColorSelect = "univer-data-validation-formula-color-select", dataValidationFormulaColorSelectPanel = "univer-data-validation-formula-color-select-panel", dataValidationFormulaColorItem = "univer-data-validation-formula-color-item", styles = {
|
1793
2123
|
dataValidationFormula,
|
1794
2124
|
dataValidationFormulaAnd,
|
@@ -1892,12 +2222,12 @@ function CheckboxFormulaInput(props) {
|
|
1892
2222
|
}
|
1893
2223
|
__name(CheckboxFormulaInput, "CheckboxFormulaInput");
|
1894
2224
|
function CustomFormulaInput(props) {
|
1895
|
-
var
|
2225
|
+
var _a18;
|
1896
2226
|
const { unitId, subUnitId, value, onChange, showError, validResult } = props, formula1Res = showError ? validResult == null ? void 0 : validResult.formula1 : "";
|
1897
2227
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: formula1Res, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1898
2228
|
TextEditor,
|
1899
2229
|
{
|
1900
|
-
value: (
|
2230
|
+
value: (_a18 = value == null ? void 0 : value.formula1) != null ? _a18 : "",
|
1901
2231
|
id: createInternalEditorID(`dataValidation-custom-formula-${unitId}-${subUnitId}`),
|
1902
2232
|
onChange: /* @__PURE__ */ __name((newValue) => {
|
1903
2233
|
onChange == null || onChange({
|
@@ -1912,6 +2242,21 @@ function CustomFormulaInput(props) {
|
|
1912
2242
|
) });
|
1913
2243
|
}
|
1914
2244
|
__name(CustomFormulaInput, "CustomFormulaInput");
|
2245
|
+
function r(e) {
|
2246
|
+
var t, f2, n2 = "";
|
2247
|
+
if (typeof e == "string" || typeof e == "number") n2 += e;
|
2248
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
2249
|
+
var o = e.length;
|
2250
|
+
for (t = 0; t < o; t++) e[t] && (f2 = r(e[t])) && (n2 && (n2 += " "), n2 += f2);
|
2251
|
+
} else for (f2 in e) e[f2] && (n2 && (n2 += " "), n2 += f2);
|
2252
|
+
return n2;
|
2253
|
+
}
|
2254
|
+
__name(r, "r");
|
2255
|
+
function clsx() {
|
2256
|
+
for (var e, t, f2 = 0, n2 = "", o = arguments.length; f2 < o; f2++) (e = arguments[f2]) && (t = r(e)) && (n2 && (n2 += " "), n2 += t);
|
2257
|
+
return n2;
|
2258
|
+
}
|
2259
|
+
__name(clsx, "clsx");
|
1915
2260
|
const DEFAULT_COLOR_PRESET = [
|
1916
2261
|
"#FFFFFF",
|
1917
2262
|
"#FEE7E7",
|
@@ -1974,7 +2319,7 @@ const DEFAULT_COLOR_PRESET = [
|
|
1974
2319
|
}, "ColorSelect"), Template = /* @__PURE__ */ __name((props) => {
|
1975
2320
|
const { item, commonProps, style } = props, { onItemChange, onItemDelete } = commonProps;
|
1976
2321
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.dataValidationFormulaListItem, style, children: [
|
1977
|
-
item.isRef ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
2322
|
+
item.isRef ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles.dataValidationFormulaListItemDrag, "draggableHandle"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SequenceSingle, {}) }),
|
1978
2323
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1979
2324
|
ColorSelect,
|
1980
2325
|
{
|
@@ -2171,9 +2516,9 @@ const CUSTOM_FORMULA_INPUT_NAME = "data-validation.custom-formula-input", BASE_F
|
|
2171
2516
|
]
|
2172
2517
|
], LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
|
2173
2518
|
function ListRenderModeInput(props) {
|
2174
|
-
var
|
2519
|
+
var _a18;
|
2175
2520
|
const { value, onChange } = props, localeService = useDependency(LocaleService);
|
2176
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(
|
2521
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(_a18 = value.renderMode) != null ? _a18 : DataValidationRenderMode.CUSTOM}`, onChange: /* @__PURE__ */ __name((renderMode) => onChange({ ...value, renderMode: +renderMode }), "onChange"), children: [
|
2177
2522
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.CUSTOM}`, children: localeService.t("dataValidation.renderMode.chip") }),
|
2178
2523
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.ARROW}`, children: localeService.t("dataValidation.renderMode.arrow") }),
|
2179
2524
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.TEXT}`, children: localeService.t("dataValidation.renderMode.text") })
|
@@ -2183,12 +2528,12 @@ __name(ListRenderModeInput, "ListRenderModeInput");
|
|
2183
2528
|
ListRenderModeInput.componentKey = LIST_RENDER_MODE_OPTION_INPUT;
|
2184
2529
|
const DATE_SHOW_TIME_OPTION = "DATE_SHOW_TIME_OPTION";
|
2185
2530
|
function DateShowTimeOption(props) {
|
2186
|
-
var
|
2531
|
+
var _a18;
|
2187
2532
|
const { value, onChange } = props, localeService = useDependency(LocaleService);
|
2188
2533
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2189
2534
|
Checkbox,
|
2190
2535
|
{
|
2191
|
-
checked: (
|
2536
|
+
checked: (_a18 = value.bizInfo) == null ? void 0 : _a18.showTime,
|
2192
2537
|
onChange: /* @__PURE__ */ __name((showTime) => {
|
2193
2538
|
onChange({
|
2194
2539
|
...value,
|
@@ -2210,14 +2555,14 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
2210
2555
|
return kind && result && __defProp$6(target, key, result), result;
|
2211
2556
|
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
|
2212
2557
|
const MARGIN_H$2 = 6;
|
2213
|
-
var
|
2214
|
-
let CheckboxRender = (
|
2558
|
+
var _a11;
|
2559
|
+
let CheckboxRender = (_a11 = class {
|
2215
2560
|
constructor(_commandService, _formulaService, _themeService) {
|
2216
2561
|
this._commandService = _commandService, this._formulaService = _formulaService, this._themeService = _themeService;
|
2217
2562
|
}
|
2218
2563
|
_calc(cellInfo, style) {
|
2219
|
-
var
|
2220
|
-
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((
|
2564
|
+
var _a18, _b, _c;
|
2565
|
+
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((_a18 = style == null ? void 0 : style.fs) != null ? _a18 : 10) * 1.6;
|
2221
2566
|
let widgetLeft = 0, widgetTop = 0;
|
2222
2567
|
switch (vt) {
|
2223
2568
|
case VerticalAlign.TOP:
|
@@ -2249,21 +2594,21 @@ let CheckboxRender = (_a10 = class {
|
|
2249
2594
|
};
|
2250
2595
|
}
|
2251
2596
|
calcCellAutoHeight(info) {
|
2252
|
-
var
|
2597
|
+
var _a18;
|
2253
2598
|
const { style } = info;
|
2254
|
-
return ((
|
2599
|
+
return ((_a18 = style == null ? void 0 : style.fs) != null ? _a18 : 10) * 1.6;
|
2255
2600
|
}
|
2256
2601
|
async _parseFormula(rule, unitId, subUnitId) {
|
2257
|
-
var
|
2602
|
+
var _a18, _b;
|
2258
2603
|
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
|
2259
2604
|
return {
|
2260
|
-
formula1: isFormulaString(formula1) ? getFormulaResult((
|
2605
|
+
formula1: isFormulaString(formula1) ? getFormulaResult((_a18 = results == null ? void 0 : results[0]) == null ? void 0 : _a18.result) : formula1,
|
2261
2606
|
formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
|
2262
2607
|
};
|
2263
2608
|
}
|
2264
2609
|
drawWith(ctx, info) {
|
2265
|
-
var
|
2266
|
-
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
2610
|
+
var _a18, _b, _c, _d, _e, _f;
|
2611
|
+
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
2267
2612
|
if (!rule || !validator)
|
2268
2613
|
return;
|
2269
2614
|
const colors = this._themeService.getCurrentTheme();
|
@@ -2296,10 +2641,10 @@ let CheckboxRender = (_a10 = class {
|
|
2296
2641
|
return offsetX <= endX && offsetX >= startX && offsetY <= endY && offsetY >= startY;
|
2297
2642
|
}
|
2298
2643
|
async onPointerDown(info, evt) {
|
2299
|
-
var
|
2644
|
+
var _a18, _b, _c;
|
2300
2645
|
if (evt.button === 2)
|
2301
2646
|
return;
|
2302
|
-
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
2647
|
+
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
2303
2648
|
if (!rule || !validator || !((_c = validator.skipDefaultFontRender) != null && _c.call(validator, rule, value, { unitId, subUnitId })))
|
2304
2649
|
return;
|
2305
2650
|
const { formula1, formula2 } = await this._parseFormula(rule, unitId, subUnitId), params = {
|
@@ -2319,7 +2664,7 @@ let CheckboxRender = (_a10 = class {
|
|
2319
2664
|
params
|
2320
2665
|
);
|
2321
2666
|
}
|
2322
|
-
}, __name(
|
2667
|
+
}, __name(_a11, "CheckboxRender"), _a11);
|
2323
2668
|
CheckboxRender = __decorateClass$6([
|
2324
2669
|
__decorateParam$6(0, ICommandService),
|
2325
2670
|
__decorateParam$6(1, Inject(DataValidationFormulaService)),
|
@@ -2329,8 +2674,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
|
|
2329
2674
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
2330
2675
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
2331
2676
|
return kind && result && __defProp$5(target, key, result), result;
|
2332
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"),
|
2333
|
-
let BaseSheetDataValidatorView = (
|
2677
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a12;
|
2678
|
+
let BaseSheetDataValidatorView = (_a12 = class {
|
2334
2679
|
constructor(injector) {
|
2335
2680
|
__publicField(this, "canvasRender", null);
|
2336
2681
|
__publicField(this, "dropdown");
|
@@ -2338,7 +2683,7 @@ let BaseSheetDataValidatorView = (_a11 = class {
|
|
2338
2683
|
__publicField(this, "formulaInput", LIST_FORMULA_INPUT_NAME);
|
2339
2684
|
this.injector = injector;
|
2340
2685
|
}
|
2341
|
-
}, __name(
|
2686
|
+
}, __name(_a12, "BaseSheetDataValidatorView"), _a12);
|
2342
2687
|
BaseSheetDataValidatorView = __decorateClass$5([
|
2343
2688
|
__decorateParam$5(0, Inject(Injector))
|
2344
2689
|
], BaseSheetDataValidatorView);
|
@@ -2443,8 +2788,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
2443
2788
|
return kind && result && __defProp$4(target, key, result), result;
|
2444
2789
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
|
2445
2790
|
const downPath$1 = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
2446
|
-
var
|
2447
|
-
let DropdownMultipleWidget = (
|
2791
|
+
var _a13;
|
2792
|
+
let DropdownMultipleWidget = (_a13 = class {
|
2448
2793
|
constructor(_commandService) {
|
2449
2794
|
__publicField(this, "zIndex");
|
2450
2795
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
@@ -2472,7 +2817,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2472
2817
|
}
|
2473
2818
|
// eslint-disable-next-line max-lines-per-function
|
2474
2819
|
drawWith(ctx, info, skeleton, spreadsheets) {
|
2475
|
-
var
|
2820
|
+
var _a18, _b;
|
2476
2821
|
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, validation = data.dataValidation, map = this._ensureMap(subUnitId), key = this._generateKey(row, col);
|
2477
2822
|
if (!validation)
|
2478
2823
|
return;
|
@@ -2481,7 +2826,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2481
2826
|
endX: _cellBounding.endX - rightOffset,
|
2482
2827
|
startY: _cellBounding.startY + topOffset,
|
2483
2828
|
endY: _cellBounding.endY - downOffset
|
2484
|
-
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (
|
2829
|
+
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (_a18 = typeof cl == "object" ? cl == null ? void 0 : cl.rgb : cl) != null ? _a18 : "#000", fontStyle = getFontStyleString(style != null ? style : void 0), { rule, validator: _validator } = validation, validator = _validator, { vt: _vt, ht } = style || {}, vt = _vt != null ? _vt : VerticalAlign.MIDDLE, cellValue = (_b = getCellValueOrigin(data)) != null ? _b : "", items = validator.parseCellValue(cellValue), labelColorMap = validator.getListWithColorMap(rule), layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
|
2485
2830
|
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt), ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth - ICON_PLACE$1, cellHeight), ctx.clip(), ctx.translateWithPrecision(CELL_PADDING_H, CELL_PADDING_V);
|
2486
2831
|
let top = 0;
|
2487
2832
|
switch (vt) {
|
@@ -2520,7 +2865,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2520
2865
|
});
|
2521
2866
|
}
|
2522
2867
|
calcCellAutoHeight(info) {
|
2523
|
-
var
|
2868
|
+
var _a18;
|
2524
2869
|
const { primaryWithCoord, style, data } = info, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, cellBounding = {
|
2525
2870
|
startX: _cellBounding.startX + leftOffset,
|
2526
2871
|
endX: _cellBounding.endX - rightOffset,
|
@@ -2529,7 +2874,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2529
2874
|
}, validation = data.dataValidation;
|
2530
2875
|
if (!validation)
|
2531
2876
|
return;
|
2532
|
-
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (
|
2877
|
+
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (_a18 = getCellValueOrigin(data)) != null ? _a18 : "", { validator: _validator } = validation, items = _validator.parseCellValue(cellValue), fontStyle = getFontStyleString(style != null ? style : void 0);
|
2533
2878
|
return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
|
2534
2879
|
}
|
2535
2880
|
isHit(position, info) {
|
@@ -2547,7 +2892,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2547
2892
|
};
|
2548
2893
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
2549
2894
|
}
|
2550
|
-
}, __name(
|
2895
|
+
}, __name(_a13, "DropdownMultipleWidget"), _a13);
|
2551
2896
|
DropdownMultipleWidget = __decorateClass$4([
|
2552
2897
|
__decorateParam$4(0, ICommandService)
|
2553
2898
|
], DropdownMultipleWidget);
|
@@ -2663,8 +3008,8 @@ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margi
|
|
2663
3008
|
};
|
2664
3009
|
}
|
2665
3010
|
__name(calcPadding, "calcPadding");
|
2666
|
-
var
|
2667
|
-
let DropdownWidget = (
|
3011
|
+
var _a14;
|
3012
|
+
let DropdownWidget = (_a14 = class {
|
2668
3013
|
constructor(_localeService, _commandService) {
|
2669
3014
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2670
3015
|
__publicField(this, "zIndex");
|
@@ -2697,8 +3042,8 @@ let DropdownWidget = (_a13 = class {
|
|
2697
3042
|
}
|
2698
3043
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2699
3044
|
drawWith(ctx, info, skeleton) {
|
2700
|
-
var
|
2701
|
-
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (
|
3045
|
+
var _a18, _b;
|
3046
|
+
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {};
|
2702
3047
|
if (!rule || !validator || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0 || !validator.skipDefaultFontRender(rule))
|
2703
3048
|
return;
|
2704
3049
|
const cellBounding = {
|
@@ -2709,10 +3054,10 @@ let DropdownWidget = (_a13 = class {
|
|
2709
3054
|
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, map = this._ensureMap(subUnitId), key = this._generateKey(row, col), list = validator.getListWithColor(rule), value = getCellValueOrigin(data), valueStr = `${value != null ? value : ""}`, activeItem = list.find((i) => i.label === valueStr);
|
2710
3055
|
let { tb, vt, ht, pd } = style || {};
|
2711
3056
|
if (tb = tb != null ? tb : WrapStrategy.WRAP, vt = vt != null ? vt : VerticalAlign.BOTTOM, ht = ht != null ? ht : DEFAULT_STYLES.ht, pd = pd != null ? pd : DEFAULT_STYLES.pd, rule.renderMode === DataValidationRenderMode.ARROW) {
|
2712
|
-
const { l: l2 = DEFAULT_STYLES.pd.l, t = DEFAULT_STYLES.pd.t, r = DEFAULT_STYLES.pd.r, b = DEFAULT_STYLES.pd.b } = pd, realWidth = cellWidth - l2 -
|
3057
|
+
const { l: l2 = DEFAULT_STYLES.pd.l, t = DEFAULT_STYLES.pd.t, r: r2 = DEFAULT_STYLES.pd.r, b = DEFAULT_STYLES.pd.b } = pd, realWidth = cellWidth - l2 - r2 - ICON_PLACE - 4, { documentSkeleton, documents, docModel } = createDocuments(valueStr, this._localeService, style);
|
2713
3058
|
tb === WrapStrategy.WRAP && docModel.updateDocumentDataPageSize(Math.max(realWidth, 1)), documentSkeleton.calculate(), documentSkeleton.getActualSize();
|
2714
3059
|
const textLayout = getDocsSkeletonPageSize(documentSkeleton), { height: fontHeight, width: fontWidth } = textLayout, { paddingTop, paddingLeft } = calcPadding(realWidth, cellHeight - t - b, fontWidth, fontHeight, vt, ht, !0);
|
2715
|
-
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd), ctx.save(), ctx.translateWithPrecision(cellBounding.startX + l2, cellBounding.startY + t), ctx.beginPath(), ctx.rect(0, 0, cellWidth - l2 -
|
3060
|
+
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, fontHeight, vt, pd), ctx.save(), ctx.translateWithPrecision(cellBounding.startX + l2, cellBounding.startY + t), ctx.beginPath(), ctx.rect(0, 0, cellWidth - l2 - r2, cellHeight - t - b), ctx.clip(), ctx.translateWithPrecision(0, paddingTop), ctx.save(), ctx.translateWithPrecision(PADDING_H, 0), ctx.beginPath(), ctx.rect(0, 0, realWidth, fontHeight), ctx.clip(), documents.render(ctx), ctx.translateWithPrecision(paddingLeft, 0), ctx.restore(), ctx.restore(), map.set(key, {
|
2716
3061
|
left: cellBounding.endX + l2 + skeleton.rowHeaderWidth - ICON_PLACE,
|
2717
3062
|
top: cellBounding.startY + t + skeleton.columnHeaderHeight,
|
2718
3063
|
width: ICON_PLACE,
|
@@ -2739,8 +3084,8 @@ let DropdownWidget = (_a13 = class {
|
|
2739
3084
|
}
|
2740
3085
|
}
|
2741
3086
|
calcCellAutoHeight(info) {
|
2742
|
-
var
|
2743
|
-
const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (
|
3087
|
+
var _a18;
|
3088
|
+
const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule;
|
2744
3089
|
if (!rule || rule.renderMode === DataValidationRenderMode.TEXT)
|
2745
3090
|
return;
|
2746
3091
|
const cellBounding = {
|
@@ -2783,7 +3128,7 @@ let DropdownWidget = (_a13 = class {
|
|
2783
3128
|
};
|
2784
3129
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
2785
3130
|
}
|
2786
|
-
}, __name(
|
3131
|
+
}, __name(_a14, "DropdownWidget"), _a14);
|
2787
3132
|
DropdownWidget = __decorateClass$3([
|
2788
3133
|
__decorateParam$3(0, Inject(LocaleService)),
|
2789
3134
|
__decorateParam$3(1, ICommandService)
|
@@ -2822,8 +3167,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
2822
3167
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
2823
3168
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
2824
3169
|
return kind && result && __defProp$2(target, key, result), result;
|
2825
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"),
|
2826
|
-
let SheetsDataValidationUIController = (
|
3170
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a15;
|
3171
|
+
let SheetsDataValidationUIController = (_a15 = class extends RxDisposable {
|
2827
3172
|
constructor(_injector, _componentManger, _dataValidatorRegistryService) {
|
2828
3173
|
super(), this._injector = _injector, this._componentManger = _componentManger, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._initComponents(), this._registerValidatorViews();
|
2829
3174
|
}
|
@@ -2859,7 +3204,7 @@ let SheetsDataValidationUIController = (_a14 = class extends RxDisposable {
|
|
2859
3204
|
validator && (validator.formulaInput = view.formulaInput, validator.canvasRender = view.canvasRender, validator.dropdown = view.dropdown, validator.optionsInput = view.optionsInput);
|
2860
3205
|
});
|
2861
3206
|
}
|
2862
|
-
}, __name(
|
3207
|
+
}, __name(_a15, "SheetsDataValidationUIController"), _a15);
|
2863
3208
|
SheetsDataValidationUIController = __decorateClass$2([
|
2864
3209
|
__decorateParam$2(0, Inject(Injector)),
|
2865
3210
|
__decorateParam$2(1, Inject(ComponentManager)),
|
@@ -2871,8 +3216,8 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
2871
3216
|
return kind && result && __defProp$1(target, key, result), result;
|
2872
3217
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
2873
3218
|
const PLUGIN_NAME$1 = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
2874
|
-
var
|
2875
|
-
let UniverSheetsDataValidationUIPlugin = (
|
3219
|
+
var _a16;
|
3220
|
+
let UniverSheetsDataValidationUIPlugin = (_a16 = class extends Plugin {
|
2876
3221
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
2877
3222
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
2878
3223
|
const { menu, ...rest } = this._config;
|
@@ -2903,7 +3248,10 @@ let UniverSheetsDataValidationUIPlugin = (_a15 = class extends Plugin {
|
|
2903
3248
|
});
|
2904
3249
|
}
|
2905
3250
|
onReady() {
|
2906
|
-
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(DataValidationRejectInputController), this._injector.get(DataValidationAlertController)
|
3251
|
+
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(DataValidationRejectInputController), this._injector.get(DataValidationAlertController), this._injector.get(IRenderManagerService).registerRenderModule(
|
3252
|
+
UniverInstanceType.UNIVER_SHEET,
|
3253
|
+
[SheetsDataValidationReRenderController]
|
3254
|
+
);
|
2907
3255
|
}
|
2908
3256
|
onRendered() {
|
2909
3257
|
this._injector.get(SheetsDataValidationUIController), this._injector.get(SheetsDataValidationRenderController);
|
@@ -2911,7 +3259,7 @@ let UniverSheetsDataValidationUIPlugin = (_a15 = class extends Plugin {
|
|
2911
3259
|
onSteady() {
|
2912
3260
|
this._injector.get(DataValidationAutoFillController);
|
2913
3261
|
}
|
2914
|
-
}, __name(
|
3262
|
+
}, __name(_a16, "UniverSheetsDataValidationUIPlugin"), __publicField(_a16, "pluginName", PLUGIN_NAME$1), __publicField(_a16, "type", UniverInstanceType.UNIVER_SHEET), _a16);
|
2915
3263
|
UniverSheetsDataValidationUIPlugin = __decorateClass$1([
|
2916
3264
|
__decorateParam$1(1, Inject(Injector)),
|
2917
3265
|
__decorateParam$1(2, ICommandService),
|
@@ -2923,8 +3271,8 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
2923
3271
|
return kind && result && __defProp2(target, key, result), result;
|
2924
3272
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
2925
3273
|
const PLUGIN_NAME = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
2926
|
-
var
|
2927
|
-
let UniverSheetsDataValidationMobileUIPlugin = (
|
3274
|
+
var _a17;
|
3275
|
+
let UniverSheetsDataValidationMobileUIPlugin = (_a17 = class extends Plugin {
|
2928
3276
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
2929
3277
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
2930
3278
|
const { menu, ...rest } = this._config;
|
@@ -2954,7 +3302,10 @@ let UniverSheetsDataValidationMobileUIPlugin = (_a16 = class extends Plugin {
|
|
2954
3302
|
});
|
2955
3303
|
}
|
2956
3304
|
onReady() {
|
2957
|
-
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController)
|
3305
|
+
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(IRenderManagerService).registerRenderModule(
|
3306
|
+
UniverInstanceType.UNIVER_SHEET,
|
3307
|
+
[SheetsDataValidationReRenderController]
|
3308
|
+
);
|
2958
3309
|
}
|
2959
3310
|
onRendered() {
|
2960
3311
|
this._injector.get(SheetsDataValidationUIController), this._injector.get(SheetsDataValidationRenderController);
|
@@ -2962,7 +3313,7 @@ let UniverSheetsDataValidationMobileUIPlugin = (_a16 = class extends Plugin {
|
|
2962
3313
|
onSteady() {
|
2963
3314
|
this._injector.get(DataValidationAutoFillController);
|
2964
3315
|
}
|
2965
|
-
}, __name(
|
3316
|
+
}, __name(_a17, "UniverSheetsDataValidationMobileUIPlugin"), __publicField(_a17, "pluginName", PLUGIN_NAME), __publicField(_a17, "type", UniverInstanceType.UNIVER_SHEET), _a17);
|
2966
3317
|
UniverSheetsDataValidationMobileUIPlugin = __decorateClass([
|
2967
3318
|
__decorateParam(1, Inject(Injector)),
|
2968
3319
|
__decorateParam(2, ICommandService),
|