@oneflowui/ui 0.8.2 → 0.8.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/components/table/DataTable.vue.js +3 -3
- package/dist/components/table/DataTable.vue2.js +531 -504
- package/dist/components/table/FieldCell.vue.d.ts +6 -0
- package/dist/components/table/FieldCell.vue.js +2 -2
- package/dist/components/table/FieldCell.vue2.js +48 -41
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -18,17 +18,23 @@ type __VLS_Props = {
|
|
|
18
18
|
field: FieldDef;
|
|
19
19
|
value?: CellValue;
|
|
20
20
|
readonly?: boolean;
|
|
21
|
+
editing?: boolean;
|
|
21
22
|
};
|
|
22
23
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
24
|
cancel: () => any;
|
|
24
25
|
commit: (rowId: string, fieldId: string, value: CellValue) => any;
|
|
25
26
|
tabNext: () => any;
|
|
27
|
+
"request-cancel": () => any;
|
|
28
|
+
"request-edit": (rowId: string, fieldId: string) => any;
|
|
26
29
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
30
|
onCancel?: (() => any) | undefined;
|
|
28
31
|
onCommit?: ((rowId: string, fieldId: string, value: CellValue) => any) | undefined;
|
|
29
32
|
onTabNext?: (() => any) | undefined;
|
|
33
|
+
"onRequest-cancel"?: (() => any) | undefined;
|
|
34
|
+
"onRequest-edit"?: ((rowId: string, fieldId: string) => any) | undefined;
|
|
30
35
|
}>, {
|
|
31
36
|
value: string | number | boolean | string[] | null;
|
|
37
|
+
editing: boolean;
|
|
32
38
|
readonly: boolean;
|
|
33
39
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
34
40
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FieldCell.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-22598b04"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { defineComponent as F, computed as
|
|
1
|
+
import { defineComponent as F, computed as o, defineAsyncComponent as e, openBlock as a, createBlock as c, resolveDynamicComponent as s, withKeys as p, withModifiers as v, normalizeClass as K, withCtx as m, Suspense as M, createElementVNode as D, createElementBlock as y, Fragment as T, unref as V, toDisplayString as $ } from "vue";
|
|
2
2
|
import { useInlineEdit as j } from "../../composables/useInlineEdit.js";
|
|
3
3
|
const z = {
|
|
4
4
|
key: 1,
|
|
5
5
|
class: "of-field-cell__display"
|
|
6
|
-
},
|
|
6
|
+
}, G = /* @__PURE__ */ F({
|
|
7
7
|
__name: "FieldCell",
|
|
8
8
|
props: {
|
|
9
9
|
rowId: {},
|
|
10
10
|
field: {},
|
|
11
11
|
value: { type: [String, Number, Boolean, Array, null], default: void 0 },
|
|
12
|
-
readonly: { type: Boolean, default: !1 }
|
|
12
|
+
readonly: { type: Boolean, default: !1 },
|
|
13
|
+
editing: { type: Boolean, default: void 0 }
|
|
13
14
|
},
|
|
14
|
-
emits: ["commit", "cancel", "tabNext"],
|
|
15
|
-
setup(
|
|
16
|
-
const t =
|
|
17
|
-
function
|
|
18
|
-
n.value
|
|
15
|
+
emits: ["commit", "cancel", "request-cancel", "tabNext", "request-edit"],
|
|
16
|
+
setup(l, { emit: b }) {
|
|
17
|
+
const t = l, r = b, { isEditing: g, activate: w, commit: h, cancel: k } = j(), x = o(() => g(t.rowId, t.field.id)), d = o(() => t.editing ?? x.value), n = o(() => t.readonly || t.field.readonly), C = o(() => !n.value);
|
|
18
|
+
function u() {
|
|
19
|
+
if (!n.value) {
|
|
20
|
+
if (t.editing !== void 0) {
|
|
21
|
+
r("request-edit", t.rowId, t.field.id);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
w(t.rowId, t.field.id);
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
27
|
+
function E(i) {
|
|
28
|
+
h(t.rowId, t.field.id, i), r("commit", t.rowId, t.field.id, i);
|
|
22
29
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
30
|
+
function I() {
|
|
31
|
+
t.editing === void 0 && k(), r("request-cancel"), r("cancel");
|
|
25
32
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
33
|
+
function A() {
|
|
34
|
+
r("tabNext");
|
|
28
35
|
}
|
|
29
|
-
const
|
|
36
|
+
const B = {
|
|
30
37
|
text: e(() => import("../field/FieldText.vue.js")),
|
|
31
38
|
number: e(() => import("../field/FieldNumber.vue.js")),
|
|
32
39
|
checkbox: e(() => import("../field/FieldCheckbox.vue.js")),
|
|
@@ -47,46 +54,46 @@ const z = {
|
|
|
47
54
|
phone: e(() => import("../field/FieldPhone.vue.js"))
|
|
48
55
|
}, N = e(
|
|
49
56
|
() => import("../field/FieldMarkdownPreview.vue.js")
|
|
50
|
-
),
|
|
51
|
-
const
|
|
52
|
-
return
|
|
57
|
+
), q = o(() => B[t.field.type]), S = o(() => {
|
|
58
|
+
const i = t.value;
|
|
59
|
+
return i == null || i === "" ? "—" : Array.isArray(i) ? i.join(", ") : typeof i == "boolean" ? i ? "✓" : "—" : String(i);
|
|
53
60
|
});
|
|
54
|
-
return (
|
|
61
|
+
return (i, f) => (a(), c(s(n.value || d.value ? "div" : "button"), {
|
|
55
62
|
class: K(["of-field-cell", {
|
|
56
|
-
"of-field-cell--editing":
|
|
63
|
+
"of-field-cell--editing": d.value,
|
|
57
64
|
"of-field-cell--readonly": n.value,
|
|
58
65
|
"of-field-cell--actionable": C.value
|
|
59
66
|
}]),
|
|
60
|
-
type: n.value ||
|
|
61
|
-
"aria-label": `${
|
|
62
|
-
title: n.value ? void 0 : `点击编辑 ${
|
|
63
|
-
onClick:
|
|
67
|
+
type: n.value || d.value ? void 0 : "button",
|
|
68
|
+
"aria-label": `${l.field.label}字段`,
|
|
69
|
+
title: n.value ? void 0 : `点击编辑 ${l.field.label}`,
|
|
70
|
+
onClick: u,
|
|
64
71
|
onKeydown: [
|
|
65
|
-
p(v(
|
|
66
|
-
p(v(
|
|
72
|
+
p(v(u, ["prevent"]), ["enter"]),
|
|
73
|
+
p(v(u, ["prevent"]), ["space"])
|
|
67
74
|
]
|
|
68
75
|
}, {
|
|
69
|
-
default:
|
|
70
|
-
|
|
71
|
-
fallback:
|
|
76
|
+
default: m(() => [
|
|
77
|
+
d.value ? (a(), c(M, { key: 0 }, {
|
|
78
|
+
fallback: m(() => [...f[0] || (f[0] = [
|
|
72
79
|
D("span", { class: "of-field-cell__loading" }, "...", -1)
|
|
73
80
|
])]),
|
|
74
|
-
default:
|
|
75
|
-
(
|
|
76
|
-
value:
|
|
77
|
-
field:
|
|
78
|
-
onCommit:
|
|
79
|
-
onCancel:
|
|
80
|
-
onTabNext:
|
|
81
|
+
default: m(() => [
|
|
82
|
+
(a(), c(s(q.value), {
|
|
83
|
+
value: l.value,
|
|
84
|
+
field: l.field,
|
|
85
|
+
onCommit: E,
|
|
86
|
+
onCancel: I,
|
|
87
|
+
onTabNext: A
|
|
81
88
|
}, null, 40, ["value", "field"]))
|
|
82
89
|
]),
|
|
83
90
|
_: 1
|
|
84
|
-
})) : (
|
|
85
|
-
|
|
91
|
+
})) : (a(), y(T, { key: 1 }, [
|
|
92
|
+
l.field.type === "richtext" && typeof l.value == "string" && l.value ? (a(), c(V(N), {
|
|
86
93
|
key: 0,
|
|
87
|
-
content:
|
|
94
|
+
content: l.value,
|
|
88
95
|
"max-lines": 2
|
|
89
|
-
}, null, 8, ["content"])) : (
|
|
96
|
+
}, null, 8, ["content"])) : (a(), y("span", z, $(S.value), 1))
|
|
90
97
|
], 64))
|
|
91
98
|
]),
|
|
92
99
|
_: 1
|
|
@@ -94,5 +101,5 @@ const z = {
|
|
|
94
101
|
}
|
|
95
102
|
});
|
|
96
103
|
export {
|
|
97
|
-
|
|
104
|
+
G as default
|
|
98
105
|
};
|