bkui-vue 0.0.3-beta.2-2 → 0.0.3-beta.2-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/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,14 @@ const mt = (e, t, n) => {
12515
12522
  isShow: t,
12516
12523
  height: n
12517
12524
  }, a);
12518
- }, ll = (e, t) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : pr(e, t), 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) => {
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
+ typeof s == "function" ? a = s(a, e, t) : a = a.match(typeof s == "string" ? i(s) : s)[1] ?? a;
12531
+ }), /^-?\d+.?\d*$/.test(a) && (a = Number(a))), a;
12532
+ }, 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
12533
  const a = k9(e, t, n);
12520
12534
  return a !== null ? a : Sn();
12521
12535
  }, 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 +12553,13 @@ const mt = (e, t, n) => {
12539
12553
  colspan: i,
12540
12554
  rowspan: s
12541
12555
  };
12542
- }, nu = (e, t) => {
12543
- var l, r;
12544
- const n = e.field, a = (c) => ll(c, n), i = (c, o) => {
12545
- const d = a(c) ?? "", f = a(o) ?? "";
12546
- return typeof d == "number" && typeof f == "number" ? d - f : String.prototype.localeCompare.call(d, f);
12547
- }, s = typeof ((l = e.sort) == null ? void 0 : l.sortFn) == "function" ? (r = e.sort) == null ? void 0 : r.sortFn : i;
12548
- return t === et.NULL ? (c, o) => !0 : (c, o) => s(c, o) * (t === et.DESC ? -1 : 1);
12556
+ }, nu = (e, t, n = []) => {
12557
+ var r, c;
12558
+ const a = e.field, i = (o) => ll(o, a, n), s = (o, d) => {
12559
+ const f = i(o) ?? "", h = i(d) ?? "";
12560
+ return typeof f == "number" && typeof h == "number" ? f - h : String.prototype.localeCompare.call(f, h);
12561
+ }, l = typeof ((r = e.sort) == null ? void 0 : r.sortFn) == "function" ? (c = e.sort) == null ? void 0 : c.sortFn : s;
12562
+ return t === et.NULL ? (o, d) => !0 : (o, d) => l(o, d) * (t === et.DESC ? -1 : 1);
12549
12563
  }, x9 = (e) => {
12550
12564
  const t = {
12551
12565
  [et.NULL]: 3,
@@ -12553,7 +12567,7 @@ const mt = (e, t, n) => {
12553
12567
  [et.DESC]: 2
12554
12568
  };
12555
12569
  return t[e] === void 0 ? et.ASC : Object.keys(t)[(t[e] + 1) % 3];
12556
- }, D9 = (e, t) => typeof e == "string" ? {
12570
+ }, D9 = (e, t, n = []) => typeof e == "string" ? {
12557
12571
  value: e
12558
12572
  } : typeof e == "boolean" && e ? {
12559
12573
  value: et.NULL
@@ -12561,7 +12575,7 @@ const mt = (e, t, n) => {
12561
12575
  value: "custom",
12562
12576
  ...e
12563
12577
  } : Object.assign({}, {
12564
- sortFn: nu(t, e.value ?? et.NULL)
12578
+ sortFn: nu(t, e.value ?? et.NULL, n)
12565
12579
  }, e) : null, ol = (e, {
12566
12580
  row: t,
12567
12581
  index: n,
@@ -13259,7 +13273,7 @@ const yN = (e) => {
13259
13273
  }, d = () => {
13260
13274
  n.value = !0;
13261
13275
  }, f = () => {
13262
- n.value = !1, t.value.textContent = `${l}`, l !== a.value && (a.value = l);
13276
+ n.value = !1, l !== a.value && (a.value = l);
13263
13277
  }, h = (w) => {
13264
13278
  const L = w.target, p = Number(L.textContent);
13265
13279
  !p || p < 1 || p > e.totalPageNum || p === a.value || (l = p);
@@ -13952,7 +13966,8 @@ const SN = /* @__PURE__ */ ue({
13952
13966
  props: {
13953
13967
  column: fs,
13954
13968
  defaultSort: g.oneOf(LI).def(et.NULL),
13955
- active: g.bool
13969
+ active: g.bool,
13970
+ sortValFormat: g.arrayOf(g.any).def([""])
13956
13971
  },
13957
13972
  emits: ["change"],
13958
13973
  setup(e, {
@@ -13972,7 +13987,7 @@ const SN = /* @__PURE__ */ ue({
13972
13987
  d.stopImmediatePropagation(), d.stopPropagation(), d.preventDefault();
13973
13988
  let h = f;
13974
13989
  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);
13990
+ const m = nu(e.column, h, e.sortValFormat), v = D9(e.column.sort, e.column, e.sortValFormat);
13976
13991
  if ((v == null ? void 0 : v.value) === "custom") {
13977
13992
  t("change", (v == null ? void 0 : v.sortFn) ?? m, h);
13978
13993
  return;
@@ -14016,7 +14031,7 @@ const DN = (e, t, n, a) => {
14016
14031
  if (!a.getColumnAttribute(y, Me.COL_IS_DRAG) && y.sort && !y.filter) {
14017
14032
  const M = a.getColumnAttribute(y, Me.COL_SORT_TYPE);
14018
14033
  i.value = x9(M);
14019
- const I = (S, N) => r(y, nu(y, i.value), S, N);
14034
+ const I = (S, N) => r(y, nu(y, i.value, e.sortValFormat), S, N);
14020
14035
  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
14036
  column: Ji(y),
14022
14037
  index: p,