@valaxyjs/devtools 0.19.5 → 0.19.6

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.
@@ -0,0 +1,122 @@
1
+ import { d as defineComponent, e as ref, f as onMounted, x as getGlobalValaxyProperty, o as openBlock, j as createBlock, w as withCtx, u as unref, m as createVNode, h as createBaseVNode, a as createElementBlock, k as renderList, F as Fragment, B as withDirectives, C as vModelCheckbox, t as toDisplayString, D as vModelText } from './index-CPK49_y2.js';
2
+ import { g, M, a as axios } from './splitpanes.es-tsc-z8w6.js';
3
+
4
+ const _hoisted_1 = {
5
+ class: "h-full",
6
+ overflow: "auto",
7
+ pl: "12",
8
+ pr: "4",
9
+ py: "4"
10
+ };
11
+ const _hoisted_2 = ["name", "value"];
12
+ const _hoisted_3 = ["for"];
13
+ const _hoisted_4 = /* @__PURE__ */ createBaseVNode("h2", null, "原frontmatter字段->新字段", -1);
14
+ const _hoisted_5 = {
15
+ class: "h-full",
16
+ overflow: "auto",
17
+ pl: "12",
18
+ pr: "4",
19
+ py: "4"
20
+ };
21
+ const _hoisted_6 = ["for"];
22
+ const _hoisted_7 = ["onUpdate:modelValue", "name"];
23
+ const _sfc_main = /* @__PURE__ */ defineComponent({
24
+ __name: "migration",
25
+ setup(__props) {
26
+ const postList = ref([]);
27
+ const mapper = ref({});
28
+ onMounted(() => {
29
+ postList.value = getGlobalValaxyProperty("postList").value;
30
+ postList.value.forEach((element) => {
31
+ const keys = Object.keys(element);
32
+ for (const key of keys)
33
+ mapper.value[key] = "";
34
+ });
35
+ });
36
+ const checkedPosts = ref([]);
37
+ function clearPosts(select) {
38
+ checkedPosts.value.length = 0;
39
+ if (select)
40
+ checkedPosts.value = checkedPosts.value.concat(postList.value.map((i) => i.path));
41
+ }
42
+ async function migration() {
43
+ const update = {};
44
+ for (const key in mapper.value) {
45
+ if (mapper.value[key] !== "")
46
+ update[key] = mapper.value[key];
47
+ }
48
+ const res = await axios.post("/valaxy-devtools-api/migration", {
49
+ pageData: checkedPosts.value,
50
+ frontmatter: update
51
+ });
52
+ if (res.data === "ok") ;
53
+ }
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createBlock(unref(M), { class: "h-full" }, {
56
+ default: withCtx(() => [
57
+ createVNode(unref(g), null, {
58
+ default: withCtx(() => [
59
+ createBaseVNode("button", {
60
+ onClick: _cache[0] || (_cache[0] = ($event) => clearPosts(true))
61
+ }, " 全选 "),
62
+ createBaseVNode("button", {
63
+ onClick: _cache[1] || (_cache[1] = ($event) => clearPosts(false))
64
+ }, " 清空 "),
65
+ createBaseVNode("ul", _hoisted_1, [
66
+ (openBlock(true), createElementBlock(Fragment, null, renderList(postList.value, (post) => {
67
+ return openBlock(), createElementBlock("li", {
68
+ key: post.path,
69
+ class: "list-decimal"
70
+ }, [
71
+ withDirectives(createBaseVNode("input", {
72
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => checkedPosts.value = $event),
73
+ type: "checkbox",
74
+ name: post.path,
75
+ value: post.path
76
+ }, null, 8, _hoisted_2), [
77
+ [vModelCheckbox, checkedPosts.value]
78
+ ]),
79
+ createBaseVNode("label", {
80
+ for: post.path
81
+ }, toDisplayString(post.title), 9, _hoisted_3)
82
+ ]);
83
+ }), 128))
84
+ ])
85
+ ]),
86
+ _: 1
87
+ }),
88
+ createVNode(unref(g), null, {
89
+ default: withCtx(() => [
90
+ _hoisted_4,
91
+ createBaseVNode("button", { onClick: migration }, " 提交 "),
92
+ createBaseVNode("ul", _hoisted_5, [
93
+ (openBlock(true), createElementBlock(Fragment, null, renderList(mapper.value, (_, key) => {
94
+ return openBlock(), createElementBlock("li", { key }, [
95
+ createBaseVNode("label", {
96
+ for: key,
97
+ style: { "margin-right": "20px" }
98
+ }, toDisplayString(key) + " ->", 9, _hoisted_6),
99
+ withDirectives(createBaseVNode("input", {
100
+ "onUpdate:modelValue": ($event) => mapper.value[key] = $event,
101
+ name: key
102
+ }, null, 8, _hoisted_7), [
103
+ [vModelText, mapper.value[key]]
104
+ ])
105
+ ]);
106
+ }), 128))
107
+ ])
108
+ ]),
109
+ _: 1
110
+ })
111
+ ]),
112
+ _: 1
113
+ });
114
+ };
115
+ }
116
+ });
117
+
118
+ /* Injected with object hook! */
119
+
120
+ /* Injected with object hook! */
121
+
122
+ export { _sfc_main as default };