@kine-design/crud 0.0.1-beta.2 → 0.0.1-beta.4
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/dist/crud.js +381 -1
- package/package.json +4 -3
package/dist/crud.js
CHANGED
|
@@ -2,7 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { defineComponent, ref, watch, provide, createVNode, inject, computed, Fragment, Comment, createTextVNode, mergeProps, isRef, toRef, reactive, createApp, shallowRef, triggerRef, resolveComponent, h, onMounted, onBeforeUnmount, onUnmounted } from "vue";
|
|
5
|
-
import { PaginationCore, usePagination } from "@kine-design/core";
|
|
6
5
|
import { useQueryClient, useMutation, useQuery, QueryClient, VueQueryPlugin } from "@tanstack/vue-query";
|
|
7
6
|
import { createPinia, defineStore } from "pinia";
|
|
8
7
|
import { useRouter, useRoute } from "vue-router";
|
|
@@ -314,6 +313,387 @@ const KTable = /* @__PURE__ */ defineComponent((_props, {
|
|
|
314
313
|
name: "KTable",
|
|
315
314
|
props
|
|
316
315
|
});
|
|
316
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
317
|
+
var dayjs_min = { exports: {} };
|
|
318
|
+
(function(module, exports$1) {
|
|
319
|
+
!function(t, e) {
|
|
320
|
+
module.exports = e();
|
|
321
|
+
}(commonjsGlobal, function() {
|
|
322
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h2 = "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: function(t2) {
|
|
323
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
324
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
325
|
+
} }, m = function(t2, e2, n2) {
|
|
326
|
+
var r2 = String(t2);
|
|
327
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
328
|
+
}, v = { s: m, z: function(t2) {
|
|
329
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
330
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
331
|
+
}, m: function t2(e2, n2) {
|
|
332
|
+
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
333
|
+
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);
|
|
334
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
335
|
+
}, a: function(t2) {
|
|
336
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
337
|
+
}, p: function(t2) {
|
|
338
|
+
return { M: c, y: h2, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
339
|
+
}, u: function(t2) {
|
|
340
|
+
return void 0 === t2;
|
|
341
|
+
} }, g = "en", D = {};
|
|
342
|
+
D[g] = M;
|
|
343
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
344
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
345
|
+
}, w = function t2(e2, n2, r2) {
|
|
346
|
+
var i2;
|
|
347
|
+
if (!e2) return g;
|
|
348
|
+
if ("string" == typeof e2) {
|
|
349
|
+
var s2 = e2.toLowerCase();
|
|
350
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
351
|
+
var u2 = e2.split("-");
|
|
352
|
+
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
353
|
+
} else {
|
|
354
|
+
var a2 = e2.name;
|
|
355
|
+
D[a2] = e2, i2 = a2;
|
|
356
|
+
}
|
|
357
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
358
|
+
}, O = function(t2, e2) {
|
|
359
|
+
if (S(t2)) return t2.clone();
|
|
360
|
+
var n2 = "object" == typeof e2 ? e2 : {};
|
|
361
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
362
|
+
}, b = v;
|
|
363
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
364
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
365
|
+
};
|
|
366
|
+
var _ = function() {
|
|
367
|
+
function M2(t2) {
|
|
368
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
369
|
+
}
|
|
370
|
+
var m2 = M2.prototype;
|
|
371
|
+
return m2.parse = function(t2) {
|
|
372
|
+
this.$d = function(t3) {
|
|
373
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
374
|
+
if (null === e2) return /* @__PURE__ */ new Date(NaN);
|
|
375
|
+
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
376
|
+
if (e2 instanceof Date) return new Date(e2);
|
|
377
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
378
|
+
var r2 = e2.match($);
|
|
379
|
+
if (r2) {
|
|
380
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
381
|
+
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);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return new Date(e2);
|
|
385
|
+
}(t2), this.init();
|
|
386
|
+
}, m2.init = function() {
|
|
387
|
+
var t2 = this.$d;
|
|
388
|
+
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();
|
|
389
|
+
}, m2.$utils = function() {
|
|
390
|
+
return b;
|
|
391
|
+
}, m2.isValid = function() {
|
|
392
|
+
return !(this.$d.toString() === l);
|
|
393
|
+
}, m2.isSame = function(t2, e2) {
|
|
394
|
+
var n2 = O(t2);
|
|
395
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
396
|
+
}, m2.isAfter = function(t2, e2) {
|
|
397
|
+
return O(t2) < this.startOf(e2);
|
|
398
|
+
}, m2.isBefore = function(t2, e2) {
|
|
399
|
+
return this.endOf(e2) < O(t2);
|
|
400
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
401
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
402
|
+
}, m2.unix = function() {
|
|
403
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
404
|
+
}, m2.valueOf = function() {
|
|
405
|
+
return this.$d.getTime();
|
|
406
|
+
}, m2.startOf = function(t2, e2) {
|
|
407
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
408
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
409
|
+
return r2 ? i2 : i2.endOf(a);
|
|
410
|
+
}, $2 = function(t3, e3) {
|
|
411
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
412
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
413
|
+
switch (f2) {
|
|
414
|
+
case h2:
|
|
415
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
416
|
+
case c:
|
|
417
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
418
|
+
case o:
|
|
419
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
420
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
421
|
+
case a:
|
|
422
|
+
case d:
|
|
423
|
+
return $2(v2 + "Hours", 0);
|
|
424
|
+
case u:
|
|
425
|
+
return $2(v2 + "Minutes", 1);
|
|
426
|
+
case s:
|
|
427
|
+
return $2(v2 + "Seconds", 2);
|
|
428
|
+
case i:
|
|
429
|
+
return $2(v2 + "Milliseconds", 3);
|
|
430
|
+
default:
|
|
431
|
+
return this.clone();
|
|
432
|
+
}
|
|
433
|
+
}, m2.endOf = function(t2) {
|
|
434
|
+
return this.startOf(t2, false);
|
|
435
|
+
}, m2.$set = function(t2, e2) {
|
|
436
|
+
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[h2] = 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;
|
|
437
|
+
if (o2 === c || o2 === h2) {
|
|
438
|
+
var y2 = this.clone().set(d, 1);
|
|
439
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
440
|
+
} else l2 && this.$d[l2]($2);
|
|
441
|
+
return this.init(), this;
|
|
442
|
+
}, m2.set = function(t2, e2) {
|
|
443
|
+
return this.clone().$set(t2, e2);
|
|
444
|
+
}, m2.get = function(t2) {
|
|
445
|
+
return this[b.p(t2)]();
|
|
446
|
+
}, m2.add = function(r2, f2) {
|
|
447
|
+
var d2, l2 = this;
|
|
448
|
+
r2 = Number(r2);
|
|
449
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
450
|
+
var e2 = O(l2);
|
|
451
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
452
|
+
};
|
|
453
|
+
if ($2 === c) return this.set(c, this.$M + r2);
|
|
454
|
+
if ($2 === h2) return this.set(h2, this.$y + r2);
|
|
455
|
+
if ($2 === a) return y2(1);
|
|
456
|
+
if ($2 === o) return y2(7);
|
|
457
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
458
|
+
return b.w(m3, this);
|
|
459
|
+
}, m2.subtract = function(t2, e2) {
|
|
460
|
+
return this.add(-1 * t2, e2);
|
|
461
|
+
}, m2.format = function(t2) {
|
|
462
|
+
var e2 = this, n2 = this.$locale();
|
|
463
|
+
if (!this.isValid()) return n2.invalidDate || l;
|
|
464
|
+
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, h3 = function(t3, n3, i3, s3) {
|
|
465
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
466
|
+
}, d2 = function(t3) {
|
|
467
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
468
|
+
}, $2 = f2 || function(t3, e3, n3) {
|
|
469
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
470
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
471
|
+
};
|
|
472
|
+
return r2.replace(y, function(t3, r3) {
|
|
473
|
+
return r3 || function(t4) {
|
|
474
|
+
switch (t4) {
|
|
475
|
+
case "YY":
|
|
476
|
+
return String(e2.$y).slice(-2);
|
|
477
|
+
case "YYYY":
|
|
478
|
+
return b.s(e2.$y, 4, "0");
|
|
479
|
+
case "M":
|
|
480
|
+
return a2 + 1;
|
|
481
|
+
case "MM":
|
|
482
|
+
return b.s(a2 + 1, 2, "0");
|
|
483
|
+
case "MMM":
|
|
484
|
+
return h3(n2.monthsShort, a2, c2, 3);
|
|
485
|
+
case "MMMM":
|
|
486
|
+
return h3(c2, a2);
|
|
487
|
+
case "D":
|
|
488
|
+
return e2.$D;
|
|
489
|
+
case "DD":
|
|
490
|
+
return b.s(e2.$D, 2, "0");
|
|
491
|
+
case "d":
|
|
492
|
+
return String(e2.$W);
|
|
493
|
+
case "dd":
|
|
494
|
+
return h3(n2.weekdaysMin, e2.$W, o2, 2);
|
|
495
|
+
case "ddd":
|
|
496
|
+
return h3(n2.weekdaysShort, e2.$W, o2, 3);
|
|
497
|
+
case "dddd":
|
|
498
|
+
return o2[e2.$W];
|
|
499
|
+
case "H":
|
|
500
|
+
return String(s2);
|
|
501
|
+
case "HH":
|
|
502
|
+
return b.s(s2, 2, "0");
|
|
503
|
+
case "h":
|
|
504
|
+
return d2(1);
|
|
505
|
+
case "hh":
|
|
506
|
+
return d2(2);
|
|
507
|
+
case "a":
|
|
508
|
+
return $2(s2, u2, true);
|
|
509
|
+
case "A":
|
|
510
|
+
return $2(s2, u2, false);
|
|
511
|
+
case "m":
|
|
512
|
+
return String(u2);
|
|
513
|
+
case "mm":
|
|
514
|
+
return b.s(u2, 2, "0");
|
|
515
|
+
case "s":
|
|
516
|
+
return String(e2.$s);
|
|
517
|
+
case "ss":
|
|
518
|
+
return b.s(e2.$s, 2, "0");
|
|
519
|
+
case "SSS":
|
|
520
|
+
return b.s(e2.$ms, 3, "0");
|
|
521
|
+
case "Z":
|
|
522
|
+
return i2;
|
|
523
|
+
}
|
|
524
|
+
return null;
|
|
525
|
+
}(t3) || i2.replace(":", "");
|
|
526
|
+
});
|
|
527
|
+
}, m2.utcOffset = function() {
|
|
528
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
529
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
530
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
531
|
+
return b.m(y2, m3);
|
|
532
|
+
};
|
|
533
|
+
switch (M3) {
|
|
534
|
+
case h2:
|
|
535
|
+
$2 = D2() / 12;
|
|
536
|
+
break;
|
|
537
|
+
case c:
|
|
538
|
+
$2 = D2();
|
|
539
|
+
break;
|
|
540
|
+
case f:
|
|
541
|
+
$2 = D2() / 3;
|
|
542
|
+
break;
|
|
543
|
+
case o:
|
|
544
|
+
$2 = (g2 - v2) / 6048e5;
|
|
545
|
+
break;
|
|
546
|
+
case a:
|
|
547
|
+
$2 = (g2 - v2) / 864e5;
|
|
548
|
+
break;
|
|
549
|
+
case u:
|
|
550
|
+
$2 = g2 / n;
|
|
551
|
+
break;
|
|
552
|
+
case s:
|
|
553
|
+
$2 = g2 / e;
|
|
554
|
+
break;
|
|
555
|
+
case i:
|
|
556
|
+
$2 = g2 / t;
|
|
557
|
+
break;
|
|
558
|
+
default:
|
|
559
|
+
$2 = g2;
|
|
560
|
+
}
|
|
561
|
+
return l2 ? $2 : b.a($2);
|
|
562
|
+
}, m2.daysInMonth = function() {
|
|
563
|
+
return this.endOf(c).$D;
|
|
564
|
+
}, m2.$locale = function() {
|
|
565
|
+
return D[this.$L];
|
|
566
|
+
}, m2.locale = function(t2, e2) {
|
|
567
|
+
if (!t2) return this.$L;
|
|
568
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
569
|
+
return r2 && (n2.$L = r2), n2;
|
|
570
|
+
}, m2.clone = function() {
|
|
571
|
+
return b.w(this.$d, this);
|
|
572
|
+
}, m2.toDate = function() {
|
|
573
|
+
return new Date(this.valueOf());
|
|
574
|
+
}, m2.toJSON = function() {
|
|
575
|
+
return this.isValid() ? this.toISOString() : null;
|
|
576
|
+
}, m2.toISOString = function() {
|
|
577
|
+
return this.$d.toISOString();
|
|
578
|
+
}, m2.toString = function() {
|
|
579
|
+
return this.$d.toUTCString();
|
|
580
|
+
}, M2;
|
|
581
|
+
}(), k = _.prototype;
|
|
582
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h2], ["$D", d]].forEach(function(t2) {
|
|
583
|
+
k[t2[1]] = function(e2) {
|
|
584
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
585
|
+
};
|
|
586
|
+
}), O.extend = function(t2, e2) {
|
|
587
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
588
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
589
|
+
return O(1e3 * t2);
|
|
590
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
591
|
+
});
|
|
592
|
+
})(dayjs_min);
|
|
593
|
+
const props$r = {
|
|
594
|
+
total: { type: Number, default: 0 },
|
|
595
|
+
modelValue: { type: Number, default: void 0 },
|
|
596
|
+
defaultCurrent: { type: Number, default: 1 },
|
|
597
|
+
pageSize: { type: Number, default: 10 },
|
|
598
|
+
pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50, 100] },
|
|
599
|
+
layout: { type: String, default: "prev, pager, next, total" },
|
|
600
|
+
foldedMaxPageBtn: { type: Number, default: 5 },
|
|
601
|
+
maxPageBtn: { type: Number, default: 10 },
|
|
602
|
+
showEdgePageNum: { type: Boolean, default: true }
|
|
603
|
+
};
|
|
604
|
+
const oddNum = (num) => {
|
|
605
|
+
return num % 2 === 0 ? num + 1 : num;
|
|
606
|
+
};
|
|
607
|
+
function usePagination(props2, currentValue) {
|
|
608
|
+
const getPageBtnLength = () => {
|
|
609
|
+
const total = props2.total ?? 0;
|
|
610
|
+
const pageSize = props2.pageSize ?? 10;
|
|
611
|
+
return Math.ceil(total / pageSize);
|
|
612
|
+
};
|
|
613
|
+
const toPager = (value, config) => {
|
|
614
|
+
return {
|
|
615
|
+
value,
|
|
616
|
+
type: (config == null ? void 0 : config.type) ?? "number",
|
|
617
|
+
isCurrent: currentValue.value === value,
|
|
618
|
+
jump: (config == null ? void 0 : config.jump) ?? value
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
const toFoldedPager = (jump) => {
|
|
622
|
+
return toPager("...", { type: "folded", jump });
|
|
623
|
+
};
|
|
624
|
+
const getPageNumListRange = (start, length) => {
|
|
625
|
+
return Array.from({ length }, (_, i) => toPager(i + start));
|
|
626
|
+
};
|
|
627
|
+
const getPageNumList = () => {
|
|
628
|
+
const pageBtnLength = getPageBtnLength();
|
|
629
|
+
const total = props2.total ?? 0;
|
|
630
|
+
const pageSize = props2.pageSize ?? 10;
|
|
631
|
+
const foldedMaxPageBtn = props2.foldedMaxPageBtn ?? 5;
|
|
632
|
+
const maxPageBtn = props2.maxPageBtn ?? 10;
|
|
633
|
+
const showEdgePageNum = props2.showEdgePageNum ?? true;
|
|
634
|
+
if (total <= pageSize) {
|
|
635
|
+
return [toPager(1)];
|
|
636
|
+
}
|
|
637
|
+
if (!maxPageBtn || pageBtnLength <= maxPageBtn || foldedMaxPageBtn && foldedMaxPageBtn >= pageBtnLength - 1) {
|
|
638
|
+
return getPageNumListRange(1, pageBtnLength);
|
|
639
|
+
}
|
|
640
|
+
const foldedMaxPageBtnOdd = Math.max(oddNum(foldedMaxPageBtn ?? 5), 1);
|
|
641
|
+
const edgeConfig = {
|
|
642
|
+
// showEdgePageNum 时首尾各占 1 个槽位
|
|
643
|
+
length: showEdgePageNum ? 1 : 0,
|
|
644
|
+
// 右侧起始位置的偏移修正
|
|
645
|
+
rightStartSub: showEdgePageNum ? 0 : 1
|
|
646
|
+
};
|
|
647
|
+
const btnNumWithoutEdge = foldedMaxPageBtnOdd - (showEdgePageNum ? 2 : 0);
|
|
648
|
+
const pageEdge = (btnNumWithoutEdge - 1) / 2;
|
|
649
|
+
const leftEdgeNum = pageEdge + 2;
|
|
650
|
+
const rightEdgeNum = pageBtnLength - pageEdge - 1;
|
|
651
|
+
const rightStart = pageBtnLength - foldedMaxPageBtnOdd + 2 - edgeConfig.rightStartSub;
|
|
652
|
+
if (currentValue.value <= leftEdgeNum) {
|
|
653
|
+
const numLength = foldedMaxPageBtnOdd - edgeConfig.length;
|
|
654
|
+
const res2 = [
|
|
655
|
+
...getPageNumListRange(1, numLength),
|
|
656
|
+
toFoldedPager(1 + numLength)
|
|
657
|
+
];
|
|
658
|
+
if (showEdgePageNum) {
|
|
659
|
+
res2.push(toPager(pageBtnLength));
|
|
660
|
+
}
|
|
661
|
+
return res2;
|
|
662
|
+
}
|
|
663
|
+
if (currentValue.value >= rightEdgeNum) {
|
|
664
|
+
const res2 = [];
|
|
665
|
+
if (showEdgePageNum) {
|
|
666
|
+
res2.push(toPager(1));
|
|
667
|
+
}
|
|
668
|
+
res2.push(toFoldedPager(rightStart - 1), ...getPageNumListRange(rightStart, foldedMaxPageBtnOdd - edgeConfig.length));
|
|
669
|
+
return res2;
|
|
670
|
+
}
|
|
671
|
+
const leftStart = currentValue.value - pageEdge;
|
|
672
|
+
const rightEnd = currentValue.value + pageEdge;
|
|
673
|
+
const leftFolded = Math.abs(leftStart - 1) > 2 || !showEdgePageNum ? toFoldedPager(leftStart - 1) : toPager(showEdgePageNum ? 2 : 1);
|
|
674
|
+
const rightFolded = Math.abs(rightEnd - pageBtnLength) > 2 || !showEdgePageNum ? toFoldedPager(rightEnd + 1) : toPager(showEdgePageNum ? pageBtnLength - 1 : pageBtnLength);
|
|
675
|
+
const res = [];
|
|
676
|
+
if (showEdgePageNum) {
|
|
677
|
+
res.push(toPager(1));
|
|
678
|
+
}
|
|
679
|
+
res.push(
|
|
680
|
+
leftFolded,
|
|
681
|
+
...getPageNumListRange(leftStart, foldedMaxPageBtnOdd - edgeConfig.length * 2),
|
|
682
|
+
rightFolded
|
|
683
|
+
);
|
|
684
|
+
if (showEdgePageNum) {
|
|
685
|
+
res.push(toPager(pageBtnLength));
|
|
686
|
+
}
|
|
687
|
+
return res;
|
|
688
|
+
};
|
|
689
|
+
return {
|
|
690
|
+
getPageNumList,
|
|
691
|
+
getPageBtnLength
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
const PaginationCore = {
|
|
695
|
+
props: props$r
|
|
696
|
+
};
|
|
317
697
|
const {
|
|
318
698
|
props: paginationProps
|
|
319
699
|
} = PaginationCore;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kine-design/crud",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/crud.js",
|
|
6
6
|
"module": "./dist/crud.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/crud.js"
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"./dist/crud.css": "./dist/crud.css"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist"
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"@kine-design/core": "0.0.1-beta.1",
|
|
21
22
|
"@tanstack/vue-query": "^5.92.9",
|
|
22
|
-
"kine-ui": "0.0.1-beta.
|
|
23
|
+
"kine-ui": "0.0.1-beta.2",
|
|
23
24
|
"pinia": "^3.0.3",
|
|
24
25
|
"vue": "^3.4.0",
|
|
25
26
|
"vue-router": "^4.6.4"
|