@webx-ui/module-inbox 0.11.5 → 0.12.0
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/FieldCondition.d.ts +24 -0
- package/dist/FieldDialog.d.ts +6 -0
- package/dist/{FormEditorPage-DC5AjYv6.js → FormEditorPage-BsJTI_wN.js} +172 -171
- package/dist/FormEditorPage-BsJTI_wN.js.map +1 -0
- package/dist/FormGeneral.d.ts +2 -2
- package/dist/{InboxPage-D20_MKcX.js → InboxPage-D1j4r5Wf.js} +52 -51
- package/dist/InboxPage-D1j4r5Wf.js.map +1 -0
- package/dist/{StatusesPage-hBgS8sYt.js → StatusesPage-4pt80oR1.js} +47 -46
- package/dist/StatusesPage-4pt80oR1.js.map +1 -0
- package/dist/{SubmissionPage-3Fhny2qD.js → SubmissionPage-DyygefM1.js} +137 -135
- package/dist/SubmissionPage-DyygefM1.js.map +1 -0
- package/dist/conditions.d.ts +39 -0
- package/dist/index-CAa0K6Q6.js +2768 -0
- package/dist/index-CAa0K6Q6.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/steps.d.ts +18 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +32 -2
- package/package.json +3 -3
- package/dist/FormEditorPage-DC5AjYv6.js.map +0 -1
- package/dist/InboxPage-D20_MKcX.js.map +0 -1
- package/dist/StatusesPage-hBgS8sYt.js.map +0 -1
- package/dist/SubmissionPage-3Fhny2qD.js.map +0 -1
- package/dist/index-C_zPRhNm.js +0 -1807
- package/dist/index-C_zPRhNm.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useAdmin as
|
|
3
|
-
import { useModal as Y, WxDialog as Z, WxFormItem as E, WxInput as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as L, ref as d, watch as H, computed as O, openBlock as v, createBlock as z, unref as e, isRef as J, withCtx as i, createElementVNode as N, createVNode as u, createTextVNode as g, toDisplayString as m, createElementBlock as I, Fragment as D, createCommentVNode as $ } from "vue";
|
|
2
|
+
import { useAdmin as R, useTranslate as q, useErrorText as P, WxCodeField as K, WxListScreen as Q, WxRowMenu as X } from "@webx-ui/module-admin";
|
|
3
|
+
import { useModal as Y, WxDialog as Z, WxFormItem as E, WxInput as ee, WxSelect as ae, WxCheckbox as F, WxSpace as le, WxButton as A, toast as w, createModal as te, WxEmpty as se, WxSortableList as oe, WxBadge as ne, WxText as ue, confirm as re } from "@webx-ui/core";
|
|
4
|
+
import { c as h, u as j, b as ie, _ as G, d as de } from "./index-CAa0K6Q6.js";
|
|
5
|
+
const ce = { class: "wx-inbox-status-form" }, pe = { class: "wx-inbox-status-form__checks" }, me = /* @__PURE__ */ L({
|
|
6
6
|
__name: "StatusDialog",
|
|
7
7
|
props: {
|
|
8
8
|
status: {}
|
|
9
9
|
},
|
|
10
10
|
setup(M) {
|
|
11
|
-
const S = M, { resolve: B, dismiss: W, open: a } = Y(),
|
|
12
|
-
|
|
13
|
-
const n =
|
|
14
|
-
|
|
11
|
+
const S = M, { resolve: B, dismiss: W, open: a } = Y(), C = R(), f = h(C);
|
|
12
|
+
j();
|
|
13
|
+
const n = q("webx-inbox"), U = P(), _ = d(""), c = d({}), p = d("default"), b = d(!1), x = d(!1), k = d(!1), T = d(!1), V = d({});
|
|
14
|
+
H(
|
|
15
15
|
() => S.status,
|
|
16
16
|
(r) => {
|
|
17
17
|
_.value = r?.key ?? "", c.value = { ...r?.title ?? {} }, p.value = r?.color ?? "default", b.value = r?.is_default ?? !1, x.value = r?.is_spam ?? !1, k.value = r?.is_closed ?? !1, V.value = {};
|
|
18
18
|
},
|
|
19
19
|
{ immediate: !0 }
|
|
20
20
|
);
|
|
21
|
-
const t =
|
|
22
|
-
() =>
|
|
21
|
+
const t = O(
|
|
22
|
+
() => ie.map((r) => ({ value: r, label: n(`panel.color-${r}`) }))
|
|
23
23
|
);
|
|
24
24
|
function y(r) {
|
|
25
25
|
return V.value[r]?.[0];
|
|
@@ -40,21 +40,21 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
40
40
|
);
|
|
41
41
|
} catch (l) {
|
|
42
42
|
const o = l.body;
|
|
43
|
-
o?.errors ? (V.value = o.errors, w.danger(n("panel.failed"))) : w.danger(
|
|
43
|
+
o?.errors ? (V.value = o.errors, w.danger(n("panel.failed"))) : w.danger(U(l));
|
|
44
44
|
} finally {
|
|
45
45
|
T.value = !1;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return (r, l) => (v(),
|
|
48
|
+
return (r, l) => (v(), z(e(Z), {
|
|
49
49
|
open: e(a),
|
|
50
|
-
"onUpdate:open": l[7] || (l[7] = (o) =>
|
|
50
|
+
"onUpdate:open": l[7] || (l[7] = (o) => J(a) ? a.value = o : null),
|
|
51
51
|
title: M.status ? e(n)("panel.settings") : e(n)("panel.new-status"),
|
|
52
52
|
width: 520
|
|
53
53
|
}, {
|
|
54
54
|
footer: i(() => [
|
|
55
|
-
u(e(
|
|
55
|
+
u(e(le), { size: "sm" }, {
|
|
56
56
|
default: i(() => [
|
|
57
|
-
u(e(
|
|
57
|
+
u(e(A), {
|
|
58
58
|
variant: "outline",
|
|
59
59
|
onClick: l[6] || (l[6] = (o) => e(W)())
|
|
60
60
|
}, {
|
|
@@ -63,7 +63,7 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
63
63
|
]),
|
|
64
64
|
_: 1
|
|
65
65
|
}),
|
|
66
|
-
u(e(
|
|
66
|
+
u(e(A), {
|
|
67
67
|
type: "primary",
|
|
68
68
|
loading: T.value,
|
|
69
69
|
onClick: s
|
|
@@ -78,14 +78,14 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
78
78
|
})
|
|
79
79
|
]),
|
|
80
80
|
default: i(() => [
|
|
81
|
-
N("div",
|
|
81
|
+
N("div", ce, [
|
|
82
82
|
u(e(E), {
|
|
83
83
|
label: e(n)("panel.title"),
|
|
84
84
|
error: y("title"),
|
|
85
85
|
required: ""
|
|
86
86
|
}, {
|
|
87
87
|
default: i(() => [
|
|
88
|
-
u(e(
|
|
88
|
+
u(e(ee), {
|
|
89
89
|
modelValue: c.value,
|
|
90
90
|
"onUpdate:modelValue": l[0] || (l[0] = (o) => c.value = o),
|
|
91
91
|
localized: ""
|
|
@@ -99,9 +99,10 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
99
99
|
required: ""
|
|
100
100
|
}, {
|
|
101
101
|
default: i(() => [
|
|
102
|
-
u(e(
|
|
102
|
+
u(e(K), {
|
|
103
103
|
modelValue: _.value,
|
|
104
104
|
"onUpdate:modelValue": l[1] || (l[1] = (o) => _.value = o),
|
|
105
|
+
maxlength: 32,
|
|
105
106
|
placeholder: "in-progress"
|
|
106
107
|
}, null, 8, ["modelValue"])
|
|
107
108
|
]),
|
|
@@ -112,7 +113,7 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
112
113
|
error: y("color")
|
|
113
114
|
}, {
|
|
114
115
|
default: i(() => [
|
|
115
|
-
u(e(
|
|
116
|
+
u(e(ae), {
|
|
116
117
|
modelValue: p.value,
|
|
117
118
|
"onUpdate:modelValue": l[2] || (l[2] = (o) => p.value = o),
|
|
118
119
|
options: t.value
|
|
@@ -120,18 +121,18 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
120
121
|
]),
|
|
121
122
|
_: 1
|
|
122
123
|
}, 8, ["label", "error"]),
|
|
123
|
-
N("div",
|
|
124
|
-
u(e(
|
|
124
|
+
N("div", pe, [
|
|
125
|
+
u(e(F), {
|
|
125
126
|
modelValue: b.value,
|
|
126
127
|
"onUpdate:modelValue": l[3] || (l[3] = (o) => b.value = o),
|
|
127
128
|
label: e(n)("panel.status-default")
|
|
128
129
|
}, null, 8, ["modelValue", "label"]),
|
|
129
|
-
u(e(
|
|
130
|
+
u(e(F), {
|
|
130
131
|
modelValue: x.value,
|
|
131
132
|
"onUpdate:modelValue": l[4] || (l[4] = (o) => x.value = o),
|
|
132
133
|
label: e(n)("panel.status-spam")
|
|
133
134
|
}, null, 8, ["modelValue", "label"]),
|
|
134
|
-
u(e(
|
|
135
|
+
u(e(F), {
|
|
135
136
|
modelValue: k.value,
|
|
136
137
|
"onUpdate:modelValue": l[5] || (l[5] = (o) => k.value = o),
|
|
137
138
|
disabled: x.value,
|
|
@@ -143,21 +144,21 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
143
144
|
_: 1
|
|
144
145
|
}, 8, ["open", "title"]));
|
|
145
146
|
}
|
|
146
|
-
}),
|
|
147
|
+
}), fe = /* @__PURE__ */ G(me, [["__scopeId", "data-v-c6d91620"]]), ve = { class: "wx-inbox-statuses" }, be = { class: "wx-inbox-status" }, xe = /* @__PURE__ */ L({
|
|
147
148
|
__name: "StatusesPage",
|
|
148
149
|
props: {
|
|
149
150
|
base: { default: "/inbox" }
|
|
150
151
|
},
|
|
151
152
|
setup(M) {
|
|
152
|
-
const S = M, B =
|
|
153
|
-
|
|
154
|
-
const a =
|
|
153
|
+
const S = M, B = R(), W = h(B);
|
|
154
|
+
j();
|
|
155
|
+
const a = q("webx-inbox"), C = P(), f = d([]), n = d(!0), U = B.can("inbox.manage"), _ = te(fe), c = de();
|
|
155
156
|
async function p() {
|
|
156
157
|
n.value = !0;
|
|
157
158
|
try {
|
|
158
159
|
f.value = await W.statuses();
|
|
159
160
|
} catch (t) {
|
|
160
|
-
w.danger(
|
|
161
|
+
w.danger(C(t));
|
|
161
162
|
} finally {
|
|
162
163
|
n.value = !1;
|
|
163
164
|
}
|
|
@@ -167,7 +168,7 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
167
168
|
await _({ status: t }) && await p();
|
|
168
169
|
}
|
|
169
170
|
async function x(t) {
|
|
170
|
-
if (await
|
|
171
|
+
if (await re({
|
|
171
172
|
title: a("panel.delete-status-title", { status: c(t) }),
|
|
172
173
|
message: a("panel.delete-status-text"),
|
|
173
174
|
confirmText: a("panel.delete"),
|
|
@@ -177,11 +178,11 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
177
178
|
try {
|
|
178
179
|
await W.removeStatus(t.id), w.success(a("panel.deleted")), await p();
|
|
179
180
|
} catch (s) {
|
|
180
|
-
w.danger(
|
|
181
|
+
w.danger(C(s));
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
function k(t) {
|
|
184
|
-
return
|
|
185
|
+
return U ? [
|
|
185
186
|
{ key: "edit", icon: "edit", label: a("panel.settings"), run: () => {
|
|
186
187
|
b(t);
|
|
187
188
|
} },
|
|
@@ -200,8 +201,8 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
200
201
|
] : []
|
|
201
202
|
] : [];
|
|
202
203
|
}
|
|
203
|
-
const T =
|
|
204
|
-
() =>
|
|
204
|
+
const T = O(
|
|
205
|
+
() => U ? [
|
|
205
206
|
{
|
|
206
207
|
key: "new",
|
|
207
208
|
label: a("panel.new-status"),
|
|
@@ -217,10 +218,10 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
217
218
|
try {
|
|
218
219
|
await W.sortStatuses(f.value.map((t) => t.id));
|
|
219
220
|
} catch (t) {
|
|
220
|
-
w.danger(
|
|
221
|
+
w.danger(C(t, a("panel.reorder-failed"))), await p();
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
return (t, y) => (v(), I("div",
|
|
224
|
+
return (t, y) => (v(), I("div", ve, [
|
|
224
225
|
u(e(Q), {
|
|
225
226
|
title: e(a)("panel.statuses"),
|
|
226
227
|
back: S.base,
|
|
@@ -228,10 +229,10 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
228
229
|
actions: T.value
|
|
229
230
|
}, {
|
|
230
231
|
default: i(() => [
|
|
231
|
-
!n.value && f.value.length === 0 ? (v(),
|
|
232
|
+
!n.value && f.value.length === 0 ? (v(), z(e(se), {
|
|
232
233
|
key: 0,
|
|
233
234
|
title: e(a)("panel.no-statuses")
|
|
234
|
-
}, null, 8, ["title"])) : (v(),
|
|
235
|
+
}, null, 8, ["title"])) : (v(), z(e(oe), {
|
|
235
236
|
key: 1,
|
|
236
237
|
modelValue: f.value,
|
|
237
238
|
"onUpdate:modelValue": y[0] || (y[0] = (s) => f.value = s),
|
|
@@ -239,13 +240,13 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
239
240
|
"item-key": "id",
|
|
240
241
|
"item-label": e(c),
|
|
241
242
|
"drag-label": e(a)("panel.reorder"),
|
|
242
|
-
disabled: !e(
|
|
243
|
+
disabled: !e(U),
|
|
243
244
|
"aria-label": e(a)("panel.statuses"),
|
|
244
245
|
onMove: V
|
|
245
246
|
}, {
|
|
246
247
|
default: i(({ item: s }) => [
|
|
247
|
-
N("div",
|
|
248
|
-
u(e(
|
|
248
|
+
N("div", be, [
|
|
249
|
+
u(e(ne), {
|
|
249
250
|
type: s.color
|
|
250
251
|
}, {
|
|
251
252
|
default: i(() => [
|
|
@@ -253,7 +254,7 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
253
254
|
]),
|
|
254
255
|
_: 2
|
|
255
256
|
}, 1032, ["type"]),
|
|
256
|
-
u(e(
|
|
257
|
+
u(e(ue), {
|
|
257
258
|
size: "sm",
|
|
258
259
|
tone: "muted",
|
|
259
260
|
truncate: ""
|
|
@@ -289,8 +290,8 @@ const de = { class: "wx-inbox-status-form" }, ce = { class: "wx-inbox-status-for
|
|
|
289
290
|
}, 8, ["title", "back", "back-label", "actions"])
|
|
290
291
|
]));
|
|
291
292
|
}
|
|
292
|
-
}),
|
|
293
|
+
}), Ve = /* @__PURE__ */ G(xe, [["__scopeId", "data-v-ba548af9"]]);
|
|
293
294
|
export {
|
|
294
|
-
|
|
295
|
+
Ve as default
|
|
295
296
|
};
|
|
296
|
-
//# sourceMappingURL=StatusesPage-
|
|
297
|
+
//# sourceMappingURL=StatusesPage-4pt80oR1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusesPage-4pt80oR1.js","sources":["../src/StatusDialog.vue","../src/StatusesPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport { useAdmin, useErrorText, useTranslate, WxCodeField } from '@webx-ui/module-admin'\nimport {\n toast,\n useModal,\n WxButton,\n WxCheckbox,\n WxDialog,\n WxFormItem,\n WxInput,\n WxSelect,\n WxSpace,\n type LocalizedValue,\n} from '@webx-ui/core'\nimport { createInboxApi } from './api'\nimport { useInboxMessages } from './i18n'\nimport { STATUS_COLORS, type InboxStatus, type StatusColor } from './types'\n\n/**\n * One state, written.\n *\n * The colour is a tone rather than a swatch: the panel has a light theme and a dark one, and\n * a colour picked in one of them is unreadable in the other.\n *\n * Nothing here refuses a second default — the server clears the flag on whoever had it, which\n * is what somebody moving the default from one status to another means, and refusing the save\n * would be the other reading of the same click.\n */\nconst props = defineProps<{ status: InboxStatus | null }>()\n\nconst { resolve, dismiss, open } = useModal<InboxStatus>()\n\nconst context = useAdmin()\nconst api = createInboxApi(context)\nuseInboxMessages()\n\nconst t = useTranslate('webx-inbox')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst key = ref('')\nconst title = ref<LocalizedValue>({})\nconst color = ref<StatusColor>('default')\nconst isDefault = ref(false)\nconst isSpam = ref(false)\nconst isClosed = ref(false)\nconst saving = ref(false)\nconst errors = ref<Record<string, string[]>>({})\n\nwatch(\n () => props.status,\n (status) => {\n key.value = status?.key ?? ''\n title.value = { ...(status?.title ?? {}) }\n color.value = status?.color ?? 'default'\n isDefault.value = status?.is_default ?? false\n isSpam.value = status?.is_spam ?? false\n isClosed.value = status?.is_closed ?? false\n errors.value = {}\n },\n { immediate: true },\n)\n\nconst colors = computed(() =>\n STATUS_COLORS.map((one) => ({ value: one, label: t(`panel.color-${one}`) })),\n)\n\nfunction errorOf(field: string): string | undefined {\n return errors.value[field]?.[0]\n}\n\nasync function save(): Promise<void> {\n saving.value = true\n errors.value = {}\n\n const input = {\n key: key.value.trim(),\n title: title.value,\n color: color.value,\n is_default: isDefault.value,\n is_spam: isSpam.value,\n is_closed: isClosed.value,\n }\n\n try {\n resolve(\n props.status === null\n ? await api.createStatus(input)\n : await api.saveStatus(props.status.id, input),\n )\n } catch (error) {\n const body = (error as { body?: { errors?: Record<string, string[]> } }).body\n\n if (body?.errors) {\n errors.value = body.errors\n toast.danger(t('panel.failed'))\n } else {\n toast.danger(message(error))\n }\n } finally {\n saving.value = false\n }\n}\n</script>\n\n<template>\n <wx-dialog\n v-model:open=\"open\"\n :title=\"status ? t('panel.settings') : t('panel.new-status')\"\n :width=\"520\"\n >\n <div class=\"wx-inbox-status-form\">\n <wx-form-item :label=\"t('panel.title')\" :error=\"errorOf('title')\" required>\n <wx-input v-model=\"title\" localized />\n </wx-form-item>\n\n <wx-form-item :label=\"t('panel.status-key')\" :error=\"errorOf('key')\" required>\n <wx-code-field v-model=\"key\" :maxlength=\"32\" placeholder=\"in-progress\" />\n </wx-form-item>\n\n <wx-form-item :label=\"t('panel.status-color')\" :error=\"errorOf('color')\">\n <wx-select v-model=\"color\" :options=\"colors\" />\n </wx-form-item>\n\n <div class=\"wx-inbox-status-form__checks\">\n <wx-checkbox v-model=\"isDefault\" :label=\"t('panel.status-default')\" />\n <wx-checkbox v-model=\"isSpam\" :label=\"t('panel.status-spam')\" />\n <wx-checkbox v-model=\"isClosed\" :disabled=\"isSpam\" :label=\"t('panel.status-closed')\" />\n </div>\n </div>\n\n <template #footer>\n <wx-space size=\"sm\">\n <wx-button variant=\"outline\" @click=\"dismiss()\">{{ t('panel.cancel') }}</wx-button>\n <wx-button type=\"primary\" :loading=\"saving\" @click=\"save\">{{ t('panel.save') }}</wx-button>\n </wx-space>\n </template>\n </wx-dialog>\n</template>\n\n<style scoped>\n.wx-inbox-status-form {\n display: flex;\n flex-direction: column;\n gap: var(--wx-space-12);\n}\n\n.wx-inbox-status-form__checks {\n display: flex;\n flex-wrap: wrap;\n gap: var(--wx-space-16);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport {\n useAdmin,\n useErrorText,\n useTranslate,\n WxListScreen,\n WxRowMenu,\n type RowAction,\n type ScreenAction,\n} from '@webx-ui/module-admin'\nimport {\n confirm,\n createModal,\n toast,\n WxBadge,\n WxEmpty,\n WxSortableList,\n WxText,\n} from '@webx-ui/core'\nimport StatusDialog from './StatusDialog.vue'\nimport { createInboxApi } from './api'\nimport { useInboxMessages, useStatusName } from './i18n'\nimport type { InboxStatus } from './types'\n\n/**\n * The states a submission can be in (§2.11).\n *\n * Rows rather than an enum, because every panel ends up wanting its own words — and the flags\n * are what the section reads, not the keys, so renaming \"New\" to whatever this client calls\n * it keeps it the status a new submission gets.\n *\n * Their order is the order of the tabs over the list of submissions, which is why it is\n * dragged rather than typed.\n */\nconst props = withDefaults(defineProps<{ base?: string }>(), { base: '/inbox' })\n\nconst context = useAdmin()\nconst api = createInboxApi(context)\nuseInboxMessages()\n\nconst t = useTranslate('webx-inbox')\n/* Not the server's `message`: the panel says how a request failed in its own words. */\nconst message = useErrorText()\n\nconst statuses = ref<InboxStatus[]>([])\nconst loading = ref(true)\n\nconst canManage = context.can('inbox.manage')\n\nconst edit = createModal<InboxStatus, { status: InboxStatus | null }>(StatusDialog)\n\n/* In the panel's language, not the content's: a status is a word of the interface. */\nconst name = useStatusName()\n\nasync function load(): Promise<void> {\n loading.value = true\n\n try {\n statuses.value = await api.statuses()\n } catch (error) {\n toast.danger(message(error))\n } finally {\n loading.value = false\n }\n}\n\nvoid load()\n\nasync function open(status: InboxStatus | null): Promise<void> {\n if (await edit({ status })) await load()\n}\n\nasync function remove(status: InboxStatus): Promise<void> {\n const agreed = await confirm({\n title: t('panel.delete-status-title', { status: name(status) }),\n message: t('panel.delete-status-text'),\n confirmText: t('panel.delete'),\n cancelText: t('panel.cancel'),\n tone: 'danger',\n })\n\n if (!agreed) return\n\n try {\n await api.removeStatus(status.id)\n toast.success(t('panel.deleted'))\n await load()\n } catch (error) {\n toast.danger(message(error))\n }\n}\n\nfunction actionsFor(status: InboxStatus): RowAction[] {\n if (!canManage) return []\n\n return [\n { key: 'edit', icon: 'edit', label: t('panel.settings'), run: () => void open(status) },\n // A status with submissions in them cannot go: they would have nothing to be in. The\n // line is left out rather than greyed, the way every list of the panel does it.\n ...(status.submissions_count === 0\n ? [\n {\n key: 'delete',\n icon: 'trash' as const,\n label: t('panel.delete'),\n danger: true,\n run: () => void remove(status),\n },\n ]\n : []),\n ]\n}\n\n/* What the section offers. Declared, because on a phone the head folds it into the ···. */\nconst actions = computed<ScreenAction[]>(() =>\n canManage\n ? [\n {\n key: 'new',\n label: t('panel.new-status'),\n icon: 'plus',\n primary: true,\n run: () => void open(null),\n },\n ]\n : [],\n)\n\nasync function reorder(): Promise<void> {\n try {\n await api.sortStatuses(statuses.value.map((status) => status.id))\n } catch (error) {\n toast.danger(message(error, t('panel.reorder-failed')))\n await load()\n }\n}\n</script>\n\n<template>\n <div class=\"wx-inbox-statuses\">\n <wx-list-screen\n :title=\"t('panel.statuses')\"\n :back=\"props.base\"\n :back-label=\"t('panel.forms')\"\n :actions=\"actions\"\n >\n <wx-empty v-if=\"!loading && statuses.length === 0\" :title=\"t('panel.no-statuses')\" />\n\n <wx-sortable-list\n v-else\n v-model=\"statuses\"\n plain\n item-key=\"id\"\n :item-label=\"name\"\n :drag-label=\"t('panel.reorder')\"\n :disabled=\"!canManage\"\n :aria-label=\"t('panel.statuses')\"\n @move=\"reorder\"\n >\n <template #default=\"{ item }\">\n <div class=\"wx-inbox-status\">\n <wx-badge :type=\"item.color\">{{ name(item) }}</wx-badge>\n\n <wx-text size=\"sm\" tone=\"muted\" truncate>\n <code>{{ item.key }}</code>\n <template v-if=\"item.is_default\"> · {{ t('panel.status-default') }}</template>\n <template v-if=\"item.is_spam\"> · {{ t('panel.status-spam') }}</template>\n <template v-else-if=\"item.is_closed\"> · {{ t('panel.status-closed') }}</template>\n <template v-if=\"item.submissions_count\">\n · {{ t('panel.in-use') }} ({{ item.submissions_count }})\n </template>\n </wx-text>\n </div>\n </template>\n\n <template #actions=\"{ item }\">\n <wx-row-menu :actions=\"actionsFor(item)\" :label=\"name(item)\" />\n </template>\n </wx-sortable-list>\n </wx-list-screen>\n </div>\n</template>\n\n<style scoped>\n.wx-inbox-statuses {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--wx-space-12);\n}\n\n.wx-inbox-statuses > .wx-list-screen {\n align-self: stretch;\n}\n\n.wx-inbox-status {\n display: flex;\n align-items: center;\n gap: var(--wx-space-8);\n flex: 1 1 auto;\n min-width: 0;\n flex-wrap: wrap;\n}\n</style>\n"],"names":["props","__props","resolve","dismiss","open","useModal","context","useAdmin","api","createInboxApi","useInboxMessages","t","useTranslate","message","useErrorText","key","ref","title","color","isDefault","isSpam","isClosed","saving","errors","watch","status","colors","computed","STATUS_COLORS","one","errorOf","field","save","input","error","body","toast","_createBlock","_unref","WxDialog","$event","_createVNode","WxSpace","WxButton","_createElementVNode","_hoisted_1","WxFormItem","WxInput","WxCodeField","WxSelect","_hoisted_2","WxCheckbox","statuses","loading","canManage","edit","createModal","StatusDialog","name","useStatusName","load","remove","confirm","actionsFor","actions","reorder","_openBlock","_createElementBlock","WxListScreen","WxEmpty","WxSortableList","_withCtx","item","WxBadge","_createTextVNode","_toDisplayString","WxText","_Fragment","WxRowMenu"],"mappings":";;;;;;;;;;AA6BA,UAAMA,IAAQC,GAER,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA,GAE7BC,IAAUC,EAAA,GACVC,IAAMC,EAAeH,CAAO;AAClC,IAAAI,EAAA;AAEA,UAAMC,IAAI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