bkui-vue 0.0.3-beta.2-3 → 0.0.3-beta.2-5
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/index.cjs.js +1 -1
- package/dist/index.esm.js +33 -13
- package/dist/index.umd.js +1 -1
- package/lib/table/components/table-column.d.ts +1 -0
- package/lib/table/index.d.ts +16 -0
- package/lib/table/index.js +39 -9
- package/lib/table/plugins/head-sort.d.ts +7 -0
- package/lib/table/props.d.ts +10 -0
- package/lib/table/table.d.ts +7 -0
- package/lib/table/use-column.d.ts +3 -0
- package/lib/table/utils.d.ts +3 -3
- package/lib/table-column/index.d.ts +3 -0
- package/lib/table-column/index.js +7 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -11501,6 +11501,13 @@ const OI = {
|
|
11501
11501
|
* 是否显示Head
|
11502
11502
|
*/
|
11503
11503
|
showHead: g.bool.def(!0),
|
11504
|
+
/**
|
11505
|
+
* 排序时对需要排序的字符串数值进行格式化
|
11506
|
+
* 这里需要配置为正则或者回调函数,(str) => string | number | boolean
|
11507
|
+
* 如果配置为正则,程序会提取匹配到的第一个结果尝试转换为数值
|
11508
|
+
* 如果为多个,程序会顺序执行所有正则表达式,直到转换成功
|
11509
|
+
*/
|
11510
|
+
sortValFormat: g.arrayOf(g.any).def([""]),
|
11504
11511
|
/**
|
11505
11512
|
* table header config
|
11506
11513
|
*/
|
@@ -12515,7 +12522,19 @@ const mt = (e, t, n) => {
|
|
12515
12522
|
isShow: t,
|
12516
12523
|
height: n
|
12517
12524
|
}, a);
|
12518
|
-
}, ll = (e, t
|
12525
|
+
}, ll = (e, t, n) => {
|
12526
|
+
let a;
|
12527
|
+
(typeof e == "string" || typeof e == "number" || typeof e == "boolean") && (a = e);
|
12528
|
+
const i = (s, l = "ig") => new RegExp(`${s}`.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), l);
|
12529
|
+
return a = pr(e, t), n != null && n.length && (n.forEach((s) => {
|
12530
|
+
if (typeof s == "function")
|
12531
|
+
a = s(a, e, t);
|
12532
|
+
else if (typeof a == "string") {
|
12533
|
+
const l = a.match(typeof s == "string" ? i(s) : s);
|
12534
|
+
a = (l == null ? void 0 : l[1]) ?? a;
|
12535
|
+
}
|
12536
|
+
}), /^-?\d+.?\d*$/.test(a) && (a = Number(a))), a;
|
12537
|
+
}, cN = (e, t) => pr(e, t), ki = (e, t) => Array.isArray(e) ? e : typeof e == "string" || typeof e == "object" ? [e] : typeof e == "function" ? ki(Reflect.apply(e, globalThis, t), t) : [], uN = (e, t, n) => {
|
12519
12538
|
const a = k9(e, t, n);
|
12520
12539
|
return a !== null ? a : Sn();
|
12521
12540
|
}, k9 = (e, t, n) => typeof t.rowKey == "string" ? t.rowKey === Pe.ROW_INDEX ? `__ROW_INDEX_${n}` : pr(e, t.rowKey) : typeof t.rowKey == "function" ? Reflect.apply(t.rowKey, globalThis, [e]) : null, dN = (e, t, n = 0) => {
|
@@ -12539,13 +12558,13 @@ const mt = (e, t, n) => {
|
|
12539
12558
|
colspan: i,
|
12540
12559
|
rowspan: s
|
12541
12560
|
};
|
12542
|
-
}, nu = (e, t) => {
|
12543
|
-
var
|
12544
|
-
const
|
12545
|
-
const
|
12546
|
-
return typeof
|
12547
|
-
},
|
12548
|
-
return t === et.NULL ? (
|
12561
|
+
}, nu = (e, t, n = []) => {
|
12562
|
+
var r, c;
|
12563
|
+
const a = e.field, i = (o) => ll(o, a, n), s = (o, d) => {
|
12564
|
+
const f = i(o) ?? "", h = i(d) ?? "";
|
12565
|
+
return typeof f == "number" && typeof h == "number" ? f - h : String.prototype.localeCompare.call(f, h);
|
12566
|
+
}, l = typeof ((r = e.sort) == null ? void 0 : r.sortFn) == "function" ? (c = e.sort) == null ? void 0 : c.sortFn : s;
|
12567
|
+
return t === et.NULL ? (o, d) => !0 : (o, d) => l(o, d) * (t === et.DESC ? -1 : 1);
|
12549
12568
|
}, x9 = (e) => {
|
12550
12569
|
const t = {
|
12551
12570
|
[et.NULL]: 3,
|
@@ -12553,7 +12572,7 @@ const mt = (e, t, n) => {
|
|
12553
12572
|
[et.DESC]: 2
|
12554
12573
|
};
|
12555
12574
|
return t[e] === void 0 ? et.ASC : Object.keys(t)[(t[e] + 1) % 3];
|
12556
|
-
}, D9 = (e, t) => typeof e == "string" ? {
|
12575
|
+
}, D9 = (e, t, n = []) => typeof e == "string" ? {
|
12557
12576
|
value: e
|
12558
12577
|
} : typeof e == "boolean" && e ? {
|
12559
12578
|
value: et.NULL
|
@@ -12561,7 +12580,7 @@ const mt = (e, t, n) => {
|
|
12561
12580
|
value: "custom",
|
12562
12581
|
...e
|
12563
12582
|
} : Object.assign({}, {
|
12564
|
-
sortFn: nu(t, e.value ?? et.NULL)
|
12583
|
+
sortFn: nu(t, e.value ?? et.NULL, n)
|
12565
12584
|
}, e) : null, ol = (e, {
|
12566
12585
|
row: t,
|
12567
12586
|
index: n,
|
@@ -13952,7 +13971,8 @@ const SN = /* @__PURE__ */ ue({
|
|
13952
13971
|
props: {
|
13953
13972
|
column: fs,
|
13954
13973
|
defaultSort: g.oneOf(LI).def(et.NULL),
|
13955
|
-
active: g.bool
|
13974
|
+
active: g.bool,
|
13975
|
+
sortValFormat: g.arrayOf(g.any).def([""])
|
13956
13976
|
},
|
13957
13977
|
emits: ["change"],
|
13958
13978
|
setup(e, {
|
@@ -13972,7 +13992,7 @@ const SN = /* @__PURE__ */ ue({
|
|
13972
13992
|
d.stopImmediatePropagation(), d.stopPropagation(), d.preventDefault();
|
13973
13993
|
let h = f;
|
13974
13994
|
f === et.NULL && (h = x9(f)), s.value === f && (h = et.NULL);
|
13975
|
-
const m = nu(e.column, h), v = D9(e.column.sort, e.column);
|
13995
|
+
const m = nu(e.column, h, e.sortValFormat), v = D9(e.column.sort, e.column, e.sortValFormat);
|
13976
13996
|
if ((v == null ? void 0 : v.value) === "custom") {
|
13977
13997
|
t("change", (v == null ? void 0 : v.sortFn) ?? m, h);
|
13978
13998
|
return;
|
@@ -14016,7 +14036,7 @@ const DN = (e, t, n, a) => {
|
|
14016
14036
|
if (!a.getColumnAttribute(y, Me.COL_IS_DRAG) && y.sort && !y.filter) {
|
14017
14037
|
const M = a.getColumnAttribute(y, Me.COL_SORT_TYPE);
|
14018
14038
|
i.value = x9(M);
|
14019
|
-
const I = (S, N) => r(y, nu(y, i.value), S, N);
|
14039
|
+
const I = (S, N) => r(y, nu(y, i.value, e.sortValFormat), S, N);
|
14020
14040
|
a.setColumnAttribute(y, Me.COL_SORT_TYPE, i.value), a.setColumnAttribute(y, Me.COL_SORT_FN, I), a.setColumnSortActive(y, !0), a.sortData(y), t.emit(Ye.COLUMN_SORT, {
|
14021
14041
|
column: Ji(y),
|
14022
14042
|
index: p,
|