@oneflowui/ui 0.5.4 → 0.5.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.
@@ -1,7 +1,7 @@
1
1
  import o from "./TableDataRow.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fe10199c"]]);
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b5ce5f86"]]);
5
5
  export {
6
6
  f as default
7
7
  };
@@ -1,24 +1,24 @@
1
- import { defineComponent as S, computed as p, openBlock as o, createElementBlock as s, normalizeClass as $, withModifiers as B, createElementVNode as D, createCommentVNode as T, Fragment as g, renderList as A, normalizeStyle as d, renderSlot as P, toDisplayString as a } from "vue";
1
+ import { defineComponent as S, computed as m, openBlock as n, createElementBlock as s, normalizeClass as $, withModifiers as B, createElementVNode as D, createCommentVNode as T, Fragment as p, renderList as A, normalizeStyle as d, renderSlot as P, toDisplayString as a } from "vue";
2
2
  import { mergeColorMap as w, DEFAULT_PRIORITY_MAP as R, DEFAULT_STATUS_MAP as _, resolveBadge as h } from "../../composables/useBadge.js";
3
- const E = ["checked"], N = {
3
+ const E = ["aria-selected"], N = ["checked"], V = {
4
4
  key: 0,
5
5
  class: "of-badge of-badge--role"
6
- }, V = {
6
+ }, F = {
7
7
  key: 1,
8
8
  class: "of-td-empty"
9
- }, F = {
9
+ }, I = {
10
10
  key: 3,
11
11
  class: "of-td-text"
12
- }, I = {
12
+ }, L = {
13
13
  key: 4,
14
14
  class: "of-td-id"
15
- }, L = {
15
+ }, U = {
16
16
  key: 5,
17
17
  class: "of-td-title"
18
- }, U = {
18
+ }, z = {
19
19
  key: 6,
20
20
  class: "of-td-text"
21
- }, W = /* @__PURE__ */ S({
21
+ }, G = /* @__PURE__ */ S({
22
22
  __name: "TableDataRow",
23
23
  props: {
24
24
  row: {},
@@ -30,18 +30,18 @@ const E = ["checked"], N = {
30
30
  statusColorMap: {}
31
31
  },
32
32
  emits: ["select", "click"],
33
- setup(r, { emit: b }) {
34
- const i = r, u = b;
33
+ setup(l, { emit: b }) {
34
+ const i = l, u = b;
35
35
  function C(e) {
36
36
  if (e.width === "fill") {
37
- const n = `${e.minWidth ?? 220}px`;
38
- return { flex: `1 1 ${n}`, minWidth: n };
37
+ const o = `${e.minWidth ?? 220}px`;
38
+ return { flex: `1 1 ${o}`, minWidth: o };
39
39
  }
40
40
  return { width: `${e.width}px`, flexShrink: "0", flexGrow: "0" };
41
41
  }
42
- const v = p(
42
+ const v = m(
43
43
  () => w(R, i.priorityColorMap)
44
- ), x = p(() => w(_, i.statusColorMap));
44
+ ), x = m(() => w(_, i.statusColorMap));
45
45
  function c(e) {
46
46
  return h(e, v.value);
47
47
  }
@@ -50,66 +50,70 @@ const E = ["checked"], N = {
50
50
  }
51
51
  function M(e) {
52
52
  if (!e) return "-";
53
- const n = new Date(e);
54
- return isNaN(n.getTime()) ? e : `${n.getMonth() + 1}/${n.getDate()}`;
53
+ const o = new Date(e);
54
+ return isNaN(o.getTime()) ? e : `${o.getMonth() + 1}/${o.getDate()}`;
55
55
  }
56
56
  function y(e) {
57
57
  return i.row[e.key];
58
58
  }
59
59
  function k(e) {
60
- const n = y(e);
61
- return n != null ? String(n) : "-";
60
+ const o = y(e);
61
+ return o != null ? String(o) : "-";
62
62
  }
63
- function l(e) {
64
- const n = y(e);
65
- return typeof n == "string" ? n : "";
63
+ function r(e) {
64
+ const o = y(e);
65
+ return typeof o == "string" ? o : "";
66
66
  }
67
- function m() {
67
+ function g() {
68
68
  const e = i.row[i.rowKey];
69
69
  return e != null ? String(e) : "";
70
70
  }
71
- return (e, n) => (o(), s("div", {
72
- class: $(["of-table-row", { "of-table-row--selected": r.selected }]),
73
- onClick: n[2] || (n[2] = (t) => u("click", r.row))
71
+ return (e, o) => (n(), s("div", {
72
+ class: $(["of-table-row", { "of-table-row--selected": l.selected }]),
73
+ role: "row",
74
+ "aria-selected": l.selected || void 0,
75
+ onClick: o[2] || (o[2] = (t) => u("click", l.row))
74
76
  }, [
75
- r.selectable ? (o(), s("div", {
77
+ l.selectable ? (n(), s("div", {
76
78
  key: 0,
77
79
  class: "of-td of-td-checkbox",
78
- onClick: n[1] || (n[1] = B(() => {
80
+ role: "gridcell",
81
+ onClick: o[1] || (o[1] = B(() => {
79
82
  }, ["stop"]))
80
83
  }, [
81
84
  D("input", {
82
85
  type: "checkbox",
83
86
  class: "of-checkbox",
84
- checked: r.selected,
85
- onChange: n[0] || (n[0] = (t) => u("select", m()))
86
- }, null, 40, E)
87
+ checked: l.selected,
88
+ onChange: o[0] || (o[0] = (t) => u("select", g()))
89
+ }, null, 40, N)
87
90
  ])) : T("", !0),
88
- (o(!0), s(g, null, A(r.columns, (t) => (o(), s("div", {
91
+ (n(!0), s(p, null, A(l.columns, (t) => (n(), s("div", {
89
92
  key: t.key,
90
93
  class: "of-td",
94
+ role: "gridcell",
91
95
  style: d(C(t))
92
96
  }, [
93
97
  P(e.$slots, "cell", {
94
- row: r.row,
98
+ row: l.row,
95
99
  col: t
96
100
  }, () => [
97
- t.key === "status" ? (o(), s("span", {
101
+ t.key === "status" ? (n(), s("span", {
98
102
  key: 0,
99
103
  class: "of-badge",
100
- style: d(f(l(t)).style)
101
- }, a(f(l(t)).label), 5)) : t.key === "priority" ? (o(), s("span", {
104
+ style: d(f(r(t)).style)
105
+ }, a(f(r(t)).label), 5)) : t.key === "priority" ? (n(), s("span", {
102
106
  key: 1,
103
107
  class: "of-badge",
104
- style: d(c(l(t)).style)
105
- }, a(c(l(t)).label), 5)) : t.key === "role" ? (o(), s(g, { key: 2 }, [
106
- l(t) ? (o(), s("span", N, a(l(t)), 1)) : (o(), s("span", V, "-"))
107
- ], 64)) : t.key === "updatedAt" ? (o(), s("span", F, a(M(l(t))), 1)) : t.key === "id" ? (o(), s("span", I, a(m()), 1)) : t.key === "title" ? (o(), s("span", L, a(k(t)), 1)) : (o(), s("span", U, a(k(t)), 1))
108
+ style: d(c(r(t)).style)
109
+ }, a(c(r(t)).label), 5)) : t.key === "role" ? (n(), s(p, { key: 2 }, [
110
+ r(t) ? (n(), s("span", V, a(r(t)), 1)) : (n(), s("span", F, "-"))
111
+ ], 64)) : t.key === "updatedAt" ? (n(), s("span", I, a(M(r(t))), 1)) : t.key === "id" ? (n(), s("span", L, a(g()), 1)) : t.key === "title" ? (n(), s("span", U, a(k(t)), 1)) : (n(), s("span", z, a(k(t)), 1))
108
112
  ], !0)
109
113
  ], 4))), 128))
110
- ], 2));
114
+ ], 10, E));
111
115
  }
112
116
  });
113
117
  export {
114
- W as default
118
+ G as default
115
119
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableGroupRow.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c6e2f1e0"]]);
4
+ const c = /* @__PURE__ */ r(o, [["__scopeId", "data-v-52c60c99"]]);
5
5
  export {
6
- a as default
6
+ c as default
7
7
  };
@@ -1,12 +1,15 @@
1
- import { defineComponent as w, computed as u, openBlock as l, createElementBlock as a, normalizeStyle as p, createCommentVNode as g, createElementVNode as d, normalizeClass as k, createTextVNode as x, toDisplayString as n, Fragment as h, renderList as B } from "vue";
1
+ import { defineComponent as w, computed as c, openBlock as l, createElementBlock as a, normalizeStyle as p, createElementVNode as g, createCommentVNode as d, normalizeClass as k, createTextVNode as x, toDisplayString as s, Fragment as h, renderList as B } from "vue";
2
2
  import { resolveBadge as C } from "../../composables/useBadge.js";
3
3
  const N = {
4
+ class: "of-table-group-row__cell",
5
+ role: "gridcell"
6
+ }, K = {
4
7
  key: 0,
5
8
  class: "of-table-group-row__checkbox-spacer"
6
- }, K = {
9
+ }, L = {
7
10
  key: 2,
8
11
  class: "of-table-group-row__label"
9
- }, L = { class: "of-table-group-row__count" }, T = /* @__PURE__ */ w({
12
+ }, M = { class: "of-table-group-row__count" }, V = /* @__PURE__ */ w({
10
13
  name: "TableGroupRow",
11
14
  __name: "TableGroupRow",
12
15
  props: {
@@ -19,40 +22,43 @@ const N = {
19
22
  aggregations: {}
20
23
  },
21
24
  emits: ["toggle"],
22
- setup(s, { emit: i }) {
23
- const o = s, m = i, r = u(() => o.colorMap ? C(o.groupKey, o.colorMap) : null), b = u(() => o.groupKey || "(空)"), f = u(() => o.level * 16), _ = u(() => o.aggregations ? Object.entries(o.aggregations).map(([c, t]) => {
24
- const [, e] = c.split(":"), y = e === "sum" ? "总计" : e === "avg" ? "平均" : e === "min" ? "最小" : e === "max" ? "最大" : "计数", v = typeof t == "number" && !Number.isInteger(t) ? t.toFixed(2) : String(t);
25
- return { key: c, label: y, value: v };
25
+ setup(n, { emit: i }) {
26
+ const o = n, b = i, r = c(() => o.colorMap ? C(o.groupKey, o.colorMap) : null), m = c(() => o.groupKey || "(空)"), f = c(() => o.level * 16), _ = c(() => o.aggregations ? Object.entries(o.aggregations).map(([u, t]) => {
27
+ const [, e] = u.split(":"), y = e === "sum" ? "总计" : e === "avg" ? "平均" : e === "min" ? "最小" : e === "max" ? "最大" : "计数", v = typeof t == "number" && !Number.isInteger(t) ? t.toFixed(2) : String(t);
28
+ return { key: u, label: y, value: v };
26
29
  }) : []);
27
- return (c, t) => (l(), a("div", {
30
+ return (u, t) => (l(), a("div", {
28
31
  class: "of-table-group-row",
29
- onClick: t[0] || (t[0] = (e) => m("toggle")),
32
+ role: "row",
33
+ onClick: t[0] || (t[0] = (e) => b("toggle")),
30
34
  style: p({ paddingLeft: `${12 + f.value}px` })
31
35
  }, [
32
- s.selectable ? (l(), a("div", N)) : g("", !0),
33
- d("span", {
34
- class: k(["of-table-group-row__chevron", { "of-table-group-row__chevron--collapsed": s.collapsed }])
35
- }, "", 2),
36
- r.value ? (l(), a("span", {
37
- key: 1,
38
- class: "of-table-group-row__badge",
39
- style: p(r.value.style)
40
- }, [
41
- r.value.dot ? (l(), a("span", {
42
- key: 0,
43
- class: "of-table-group-row__badge-dot",
44
- style: p({ background: r.value.dot })
45
- }, null, 4)) : g("", !0),
46
- x(" " + n(r.value.label), 1)
47
- ], 4)) : (l(), a("span", K, n(b.value), 1)),
48
- d("span", L, "(" + n(s.count) + ")", 1),
49
- (l(!0), a(h, null, B(_.value, (e) => (l(), a("span", {
50
- key: e.key,
51
- class: "of-table-group-row__agg"
52
- }, n(e.label) + ": " + n(e.value), 1))), 128))
36
+ g("div", N, [
37
+ n.selectable ? (l(), a("div", K)) : d("", !0),
38
+ g("span", {
39
+ class: k(["of-table-group-row__chevron", { "of-table-group-row__chevron--collapsed": n.collapsed }])
40
+ }, "", 2),
41
+ r.value ? (l(), a("span", {
42
+ key: 1,
43
+ class: "of-table-group-row__badge",
44
+ style: p(r.value.style)
45
+ }, [
46
+ r.value.dot ? (l(), a("span", {
47
+ key: 0,
48
+ class: "of-table-group-row__badge-dot",
49
+ style: p({ background: r.value.dot })
50
+ }, null, 4)) : d("", !0),
51
+ x(" " + s(r.value.label), 1)
52
+ ], 4)) : (l(), a("span", L, s(m.value), 1)),
53
+ g("span", M, "(" + s(n.count) + ")", 1),
54
+ (l(!0), a(h, null, B(_.value, (e) => (l(), a("span", {
55
+ key: e.key,
56
+ class: "of-table-group-row__agg"
57
+ }, s(e.label) + ": " + s(e.value), 1))), 128))
58
+ ])
53
59
  ], 4));
54
60
  }
55
61
  });
56
62
  export {
57
- T as default
63
+ V as default
58
64
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./TableHeaderRow.vue2.js";
2
2
  /* empty css */
3
3
  import a from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-1a914c68"]]);
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-cbab1336"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,8 +1,13 @@
1
- import { defineComponent as v, openBlock as o, createElementBlock as i, createElementVNode as c, createCommentVNode as f, Fragment as x, renderList as z, withModifiers as d, normalizeStyle as C, normalizeClass as w, toDisplayString as B, createBlock as u, unref as r, createVNode as S } from "vue";
2
- import { ChevronUp as $, ChevronDown as k, Plus as g } from "lucide-vue-next";
3
- const D = { class: "of-table-header" }, F = {
1
+ import { defineComponent as v, openBlock as o, createElementBlock as s, createElementVNode as c, createCommentVNode as f, Fragment as x, renderList as z, withModifiers as r, normalizeStyle as C, normalizeClass as w, toDisplayString as B, createBlock as u, unref as d, createVNode as S } from "vue";
2
+ import { ChevronUp as $, ChevronDown as h, Plus as g } from "lucide-vue-next";
3
+ const D = {
4
+ class: "of-table-header",
5
+ role: "row"
6
+ }, F = {
4
7
  key: 0,
5
- class: "of-th of-th-checkbox"
8
+ class: "of-th of-th-checkbox",
9
+ role: "columnheader",
10
+ "aria-label": "选择全部行"
6
11
  }, M = ["checked", "indeterminate"], K = ["aria-sort", "onClick", "onContextmenu", "onDblclick"], O = { class: "of-th-label" }, R = { class: "of-th-sort-icon" }, N = ["onMousedown", "onDblclick"], E = /* @__PURE__ */ v({
7
12
  __name: "TableHeaderRow",
8
13
  props: {
@@ -17,8 +22,8 @@ const D = { class: "of-table-header" }, F = {
17
22
  enableAddField: { type: Boolean, default: !1 }
18
23
  },
19
24
  emits: ["sort", "select-all", "resize-start", "resize-dblclick", "header-contextmenu", "header-dblclick", "add-field"],
20
- setup(e, { emit: h }) {
21
- const s = h;
25
+ setup(e, { emit: k }) {
26
+ const a = k;
22
27
  function y(n) {
23
28
  if (n.width === "fill") {
24
29
  const l = `${n.minWidth ?? 220}px`;
@@ -27,60 +32,62 @@ const D = { class: "of-table-header" }, F = {
27
32
  return { width: `${n.width}px`, flexShrink: "0", flexGrow: "0" };
28
33
  }
29
34
  function m(n) {
30
- s("sort", n);
35
+ a("sort", n);
31
36
  }
32
37
  function b(n, l) {
33
- n.stopPropagation(), s("resize-start", n, l);
38
+ n.stopPropagation(), a("resize-start", n, l);
34
39
  }
35
- return (n, l) => (o(), i("div", D, [
36
- e.selectable ? (o(), i("div", F, [
40
+ return (n, l) => (o(), s("div", D, [
41
+ e.selectable ? (o(), s("div", F, [
37
42
  c("input", {
38
43
  type: "checkbox",
39
44
  class: "of-checkbox",
40
45
  checked: e.allSelected,
41
46
  indeterminate: e.indeterminate,
42
- onChange: l[0] || (l[0] = (t) => s("select-all"))
47
+ onChange: l[0] || (l[0] = (t) => a("select-all"))
43
48
  }, null, 40, M)
44
49
  ])) : f("", !0),
45
- (o(!0), i(x, null, z(e.columns, (t) => (o(), i("div", {
50
+ (o(!0), s(x, null, z(e.columns, (t) => (o(), s("div", {
46
51
  key: t.key,
47
52
  role: "columnheader",
48
53
  class: w(["of-th", { "of-th--sortable": !0, "of-th--active": e.sortKey === t.key }]),
49
54
  style: C(y(t)),
50
55
  "aria-sort": e.sortKey === t.key ? e.sortOrder === "asc" ? "ascending" : "descending" : "none",
51
- onClick: (a) => m(t.key),
52
- onContextmenu: d((a) => e.enableFieldMenu && s("header-contextmenu", a, t.key), ["prevent"]),
53
- onDblclick: d((a) => e.enableFieldMenu && s("header-dblclick", t.key), ["stop"])
56
+ onClick: (i) => m(t.key),
57
+ onContextmenu: r((i) => e.enableFieldMenu && a("header-contextmenu", i, t.key), ["prevent"]),
58
+ onDblclick: r((i) => e.enableFieldMenu && a("header-dblclick", t.key), ["stop"])
54
59
  }, [
55
60
  c("span", O, B(t.label), 1),
56
61
  c("span", R, [
57
- e.sortKey === t.key && e.sortOrder === "asc" ? (o(), u(r($), {
62
+ e.sortKey === t.key && e.sortOrder === "asc" ? (o(), u(d($), {
58
63
  key: 0,
59
64
  size: 12,
60
65
  class: "of-sort-icon-active"
61
- })) : e.sortKey === t.key && e.sortOrder === "desc" ? (o(), u(r(k), {
66
+ })) : e.sortKey === t.key && e.sortOrder === "desc" ? (o(), u(d(h), {
62
67
  key: 1,
63
68
  size: 12,
64
69
  class: "of-sort-icon-active"
65
- })) : (o(), u(r(k), {
70
+ })) : (o(), u(d(h), {
66
71
  key: 2,
67
72
  size: 12,
68
73
  class: "of-sort-icon-idle"
69
74
  }))
70
75
  ]),
71
- e.enableResize ? (o(), i("div", {
76
+ e.enableResize ? (o(), s("div", {
72
77
  key: 0,
73
78
  class: "of-th-resizer",
74
- onMousedown: (a) => b(a, t.key),
75
- onDblclick: d((a) => s("resize-dblclick", t.key), ["stop"])
79
+ onMousedown: (i) => b(i, t.key),
80
+ onDblclick: r((i) => a("resize-dblclick", t.key), ["stop"])
76
81
  }, null, 40, N)) : f("", !0)
77
82
  ], 46, K))), 128)),
78
- e.enableAddField ? (o(), i("div", {
83
+ e.enableAddField ? (o(), s("div", {
79
84
  key: 1,
80
85
  class: "of-th of-th-add",
81
- onClick: l[1] || (l[1] = d((t) => s("add-field"), ["stop"]))
86
+ role: "columnheader",
87
+ "aria-label": "添加字段",
88
+ onClick: l[1] || (l[1] = r((t) => a("add-field"), ["stop"]))
82
89
  }, [
83
- S(r(g), { size: 14 })
90
+ S(d(g), { size: 14 })
84
91
  ])) : f("", !0)
85
92
  ]));
86
93
  }