@univerjs/sheets-data-validation 0.4.0-alpha.0 → 0.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +284 -2
- package/lib/umd/index.js +1 -1
- package/package.json +9 -15
package/lib/es/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import { RemoveSheetMutation, getSheetCommandTarget, SetRangeValuesMutation, Set
|
|
|
9
9
|
import { Subject } from "rxjs";
|
|
10
10
|
import { LexerTreeBuilder, isReferenceString, sequenceNodeType, deserializeRangeWithSheet, ERROR_TYPE_SET } from "@univerjs/engine-formula";
|
|
11
11
|
import { RegisterOtherFormulaService, FormulaRefRangeService } from "@univerjs/sheets-formula";
|
|
12
|
-
import dayjs from "dayjs";
|
|
13
12
|
const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN", _DataValidationCacheService = class _DataValidationCacheService {
|
|
14
13
|
constructor() {
|
|
15
14
|
__publicField(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
@@ -1150,7 +1149,290 @@ const transformCheckboxValue = /* @__PURE__ */ __name((value) => Tools.isDefine(
|
|
|
1150
1149
|
};
|
|
1151
1150
|
__name(_CheckboxValidator, "CheckboxValidator");
|
|
1152
1151
|
let CheckboxValidator = _CheckboxValidator;
|
|
1153
|
-
|
|
1152
|
+
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1153
|
+
function getDefaultExportFromCjs(x) {
|
|
1154
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1155
|
+
}
|
|
1156
|
+
__name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
|
|
1157
|
+
var dayjs_min = { exports: {} };
|
|
1158
|
+
(function(module, exports) {
|
|
1159
|
+
(function(t, e) {
|
|
1160
|
+
module.exports = e();
|
|
1161
|
+
})(commonjsGlobal, function() {
|
|
1162
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "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) {
|
|
1163
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
1164
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
1165
|
+
}, "ordinal") }, m = /* @__PURE__ */ __name(function(t2, e2, n2) {
|
|
1166
|
+
var r2 = String(t2);
|
|
1167
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
1168
|
+
}, "m"), v = { s: m, z: /* @__PURE__ */ __name(function(t2) {
|
|
1169
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
1170
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
1171
|
+
}, "z"), m: /* @__PURE__ */ __name(function t2(e2, n2) {
|
|
1172
|
+
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
1173
|
+
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
1174
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
1175
|
+
}, "t"), a: /* @__PURE__ */ __name(function(t2) {
|
|
1176
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
1177
|
+
}, "a"), p: /* @__PURE__ */ __name(function(t2) {
|
|
1178
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
1179
|
+
}, "p"), u: /* @__PURE__ */ __name(function(t2) {
|
|
1180
|
+
return t2 === void 0;
|
|
1181
|
+
}, "u") }, g = "en", D = {};
|
|
1182
|
+
D[g] = M;
|
|
1183
|
+
var p = "$isDayjsObject", S = /* @__PURE__ */ __name(function(t2) {
|
|
1184
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
1185
|
+
}, "S"), w = /* @__PURE__ */ __name(function t2(e2, n2, r2) {
|
|
1186
|
+
var i2;
|
|
1187
|
+
if (!e2) return g;
|
|
1188
|
+
if (typeof e2 == "string") {
|
|
1189
|
+
var s2 = e2.toLowerCase();
|
|
1190
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
1191
|
+
var u2 = e2.split("-");
|
|
1192
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
1193
|
+
} else {
|
|
1194
|
+
var a2 = e2.name;
|
|
1195
|
+
D[a2] = e2, i2 = a2;
|
|
1196
|
+
}
|
|
1197
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
1198
|
+
}, "t"), O = /* @__PURE__ */ __name(function(t2, e2) {
|
|
1199
|
+
if (S(t2)) return t2.clone();
|
|
1200
|
+
var n2 = typeof e2 == "object" ? e2 : {};
|
|
1201
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
1202
|
+
}, "O"), b = v;
|
|
1203
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
1204
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
1205
|
+
};
|
|
1206
|
+
var _ = function() {
|
|
1207
|
+
function M2(t2) {
|
|
1208
|
+
this.$L = w(t2.locale, null, !0), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = !0;
|
|
1209
|
+
}
|
|
1210
|
+
__name(M2, "M");
|
|
1211
|
+
var m2 = M2.prototype;
|
|
1212
|
+
return m2.parse = function(t2) {
|
|
1213
|
+
this.$d = function(t3) {
|
|
1214
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
1215
|
+
if (e2 === null) return /* @__PURE__ */ new Date(NaN);
|
|
1216
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
1217
|
+
if (e2 instanceof Date) return new Date(e2);
|
|
1218
|
+
if (typeof e2 == "string" && !/Z$/i.test(e2)) {
|
|
1219
|
+
var r2 = e2.match($);
|
|
1220
|
+
if (r2) {
|
|
1221
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
1222
|
+
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return new Date(e2);
|
|
1226
|
+
}(t2), this.init();
|
|
1227
|
+
}, m2.init = function() {
|
|
1228
|
+
var t2 = this.$d;
|
|
1229
|
+
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();
|
|
1230
|
+
}, m2.$utils = function() {
|
|
1231
|
+
return b;
|
|
1232
|
+
}, m2.isValid = function() {
|
|
1233
|
+
return this.$d.toString() !== l;
|
|
1234
|
+
}, m2.isSame = function(t2, e2) {
|
|
1235
|
+
var n2 = O(t2);
|
|
1236
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
1237
|
+
}, m2.isAfter = function(t2, e2) {
|
|
1238
|
+
return O(t2) < this.startOf(e2);
|
|
1239
|
+
}, m2.isBefore = function(t2, e2) {
|
|
1240
|
+
return this.endOf(e2) < O(t2);
|
|
1241
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
1242
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
1243
|
+
}, m2.unix = function() {
|
|
1244
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
1245
|
+
}, m2.valueOf = function() {
|
|
1246
|
+
return this.$d.getTime();
|
|
1247
|
+
}, m2.startOf = function(t2, e2) {
|
|
1248
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = /* @__PURE__ */ __name(function(t3, e3) {
|
|
1249
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
1250
|
+
return r2 ? i2 : i2.endOf(a);
|
|
1251
|
+
}, "l"), $2 = /* @__PURE__ */ __name(function(t3, e3) {
|
|
1252
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
1253
|
+
}, "$"), y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
1254
|
+
switch (f2) {
|
|
1255
|
+
case h:
|
|
1256
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
1257
|
+
case c:
|
|
1258
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
1259
|
+
case o:
|
|
1260
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
1261
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
1262
|
+
case a:
|
|
1263
|
+
case d:
|
|
1264
|
+
return $2(v2 + "Hours", 0);
|
|
1265
|
+
case u:
|
|
1266
|
+
return $2(v2 + "Minutes", 1);
|
|
1267
|
+
case s:
|
|
1268
|
+
return $2(v2 + "Seconds", 2);
|
|
1269
|
+
case i:
|
|
1270
|
+
return $2(v2 + "Milliseconds", 3);
|
|
1271
|
+
default:
|
|
1272
|
+
return this.clone();
|
|
1273
|
+
}
|
|
1274
|
+
}, m2.endOf = function(t2) {
|
|
1275
|
+
return this.startOf(t2, !1);
|
|
1276
|
+
}, m2.$set = function(t2, e2) {
|
|
1277
|
+
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
1278
|
+
if (o2 === c || o2 === h) {
|
|
1279
|
+
var y2 = this.clone().set(d, 1);
|
|
1280
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
1281
|
+
} else l2 && this.$d[l2]($2);
|
|
1282
|
+
return this.init(), this;
|
|
1283
|
+
}, m2.set = function(t2, e2) {
|
|
1284
|
+
return this.clone().$set(t2, e2);
|
|
1285
|
+
}, m2.get = function(t2) {
|
|
1286
|
+
return this[b.p(t2)]();
|
|
1287
|
+
}, m2.add = function(r2, f2) {
|
|
1288
|
+
var d2, l2 = this;
|
|
1289
|
+
r2 = Number(r2);
|
|
1290
|
+
var $2 = b.p(f2), y2 = /* @__PURE__ */ __name(function(t2) {
|
|
1291
|
+
var e2 = O(l2);
|
|
1292
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
1293
|
+
}, "y");
|
|
1294
|
+
if ($2 === c) return this.set(c, this.$M + r2);
|
|
1295
|
+
if ($2 === h) return this.set(h, this.$y + r2);
|
|
1296
|
+
if ($2 === a) return y2(1);
|
|
1297
|
+
if ($2 === o) return y2(7);
|
|
1298
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
1299
|
+
return b.w(m3, this);
|
|
1300
|
+
}, m2.subtract = function(t2, e2) {
|
|
1301
|
+
return this.add(-1 * t2, e2);
|
|
1302
|
+
}, m2.format = function(t2) {
|
|
1303
|
+
var e2 = this, n2 = this.$locale();
|
|
1304
|
+
if (!this.isValid()) return n2.invalidDate || l;
|
|
1305
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = /* @__PURE__ */ __name(function(t3, n3, i3, s3) {
|
|
1306
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
1307
|
+
}, "h"), d2 = /* @__PURE__ */ __name(function(t3) {
|
|
1308
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
1309
|
+
}, "d"), $2 = f2 || function(t3, e3, n3) {
|
|
1310
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
1311
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
1312
|
+
};
|
|
1313
|
+
return r2.replace(y, function(t3, r3) {
|
|
1314
|
+
return r3 || function(t4) {
|
|
1315
|
+
switch (t4) {
|
|
1316
|
+
case "YY":
|
|
1317
|
+
return String(e2.$y).slice(-2);
|
|
1318
|
+
case "YYYY":
|
|
1319
|
+
return b.s(e2.$y, 4, "0");
|
|
1320
|
+
case "M":
|
|
1321
|
+
return a2 + 1;
|
|
1322
|
+
case "MM":
|
|
1323
|
+
return b.s(a2 + 1, 2, "0");
|
|
1324
|
+
case "MMM":
|
|
1325
|
+
return h2(n2.monthsShort, a2, c2, 3);
|
|
1326
|
+
case "MMMM":
|
|
1327
|
+
return h2(c2, a2);
|
|
1328
|
+
case "D":
|
|
1329
|
+
return e2.$D;
|
|
1330
|
+
case "DD":
|
|
1331
|
+
return b.s(e2.$D, 2, "0");
|
|
1332
|
+
case "d":
|
|
1333
|
+
return String(e2.$W);
|
|
1334
|
+
case "dd":
|
|
1335
|
+
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
1336
|
+
case "ddd":
|
|
1337
|
+
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
1338
|
+
case "dddd":
|
|
1339
|
+
return o2[e2.$W];
|
|
1340
|
+
case "H":
|
|
1341
|
+
return String(s2);
|
|
1342
|
+
case "HH":
|
|
1343
|
+
return b.s(s2, 2, "0");
|
|
1344
|
+
case "h":
|
|
1345
|
+
return d2(1);
|
|
1346
|
+
case "hh":
|
|
1347
|
+
return d2(2);
|
|
1348
|
+
case "a":
|
|
1349
|
+
return $2(s2, u2, !0);
|
|
1350
|
+
case "A":
|
|
1351
|
+
return $2(s2, u2, !1);
|
|
1352
|
+
case "m":
|
|
1353
|
+
return String(u2);
|
|
1354
|
+
case "mm":
|
|
1355
|
+
return b.s(u2, 2, "0");
|
|
1356
|
+
case "s":
|
|
1357
|
+
return String(e2.$s);
|
|
1358
|
+
case "ss":
|
|
1359
|
+
return b.s(e2.$s, 2, "0");
|
|
1360
|
+
case "SSS":
|
|
1361
|
+
return b.s(e2.$ms, 3, "0");
|
|
1362
|
+
case "Z":
|
|
1363
|
+
return i2;
|
|
1364
|
+
}
|
|
1365
|
+
return null;
|
|
1366
|
+
}(t3) || i2.replace(":", "");
|
|
1367
|
+
});
|
|
1368
|
+
}, m2.utcOffset = function() {
|
|
1369
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
1370
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
1371
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = /* @__PURE__ */ __name(function() {
|
|
1372
|
+
return b.m(y2, m3);
|
|
1373
|
+
}, "D");
|
|
1374
|
+
switch (M3) {
|
|
1375
|
+
case h:
|
|
1376
|
+
$2 = D2() / 12;
|
|
1377
|
+
break;
|
|
1378
|
+
case c:
|
|
1379
|
+
$2 = D2();
|
|
1380
|
+
break;
|
|
1381
|
+
case f:
|
|
1382
|
+
$2 = D2() / 3;
|
|
1383
|
+
break;
|
|
1384
|
+
case o:
|
|
1385
|
+
$2 = (g2 - v2) / 6048e5;
|
|
1386
|
+
break;
|
|
1387
|
+
case a:
|
|
1388
|
+
$2 = (g2 - v2) / 864e5;
|
|
1389
|
+
break;
|
|
1390
|
+
case u:
|
|
1391
|
+
$2 = g2 / n;
|
|
1392
|
+
break;
|
|
1393
|
+
case s:
|
|
1394
|
+
$2 = g2 / e;
|
|
1395
|
+
break;
|
|
1396
|
+
case i:
|
|
1397
|
+
$2 = g2 / t;
|
|
1398
|
+
break;
|
|
1399
|
+
default:
|
|
1400
|
+
$2 = g2;
|
|
1401
|
+
}
|
|
1402
|
+
return l2 ? $2 : b.a($2);
|
|
1403
|
+
}, m2.daysInMonth = function() {
|
|
1404
|
+
return this.endOf(c).$D;
|
|
1405
|
+
}, m2.$locale = function() {
|
|
1406
|
+
return D[this.$L];
|
|
1407
|
+
}, m2.locale = function(t2, e2) {
|
|
1408
|
+
if (!t2) return this.$L;
|
|
1409
|
+
var n2 = this.clone(), r2 = w(t2, e2, !0);
|
|
1410
|
+
return r2 && (n2.$L = r2), n2;
|
|
1411
|
+
}, m2.clone = function() {
|
|
1412
|
+
return b.w(this.$d, this);
|
|
1413
|
+
}, m2.toDate = function() {
|
|
1414
|
+
return new Date(this.valueOf());
|
|
1415
|
+
}, m2.toJSON = function() {
|
|
1416
|
+
return this.isValid() ? this.toISOString() : null;
|
|
1417
|
+
}, m2.toISOString = function() {
|
|
1418
|
+
return this.$d.toISOString();
|
|
1419
|
+
}, m2.toString = function() {
|
|
1420
|
+
return this.$d.toUTCString();
|
|
1421
|
+
}, M2;
|
|
1422
|
+
}(), k = _.prototype;
|
|
1423
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
1424
|
+
k[t2[1]] = function(e2) {
|
|
1425
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
1426
|
+
};
|
|
1427
|
+
}), O.extend = function(t2, e2) {
|
|
1428
|
+
return t2.$i || (t2(e2, _, O), t2.$i = !0), O;
|
|
1429
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
1430
|
+
return O(1e3 * t2);
|
|
1431
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
1432
|
+
});
|
|
1433
|
+
})(dayjs_min);
|
|
1434
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
1435
|
+
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports), DateOperatorNameMap = {
|
|
1154
1436
|
[DataValidationOperator.BETWEEN]: "dataValidation.date.operators.between",
|
|
1155
1437
|
[DataValidationOperator.EQUAL]: "dataValidation.date.operators.equal",
|
|
1156
1438
|
[DataValidationOperator.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|