@tesouro/embedded-components-react 0.5.154 → 0.5.155
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/README.md +1 -2
- package/dist/index.css +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/lib/SettingsWidget.d.ts +0 -3
- package/dist/lib/WidgetSuite.d.ts +0 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index3.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +56 -64
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +34 -34
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +191 -231
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +91 -147
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index.js +0 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index10.js +0 -28
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index2.js +0 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index3.js +0 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index4.js +0 -34
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index5.js +0 -35
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index6.js +0 -33
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index7.js +0 -22
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index8.js +0 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index9.js +0 -26
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js +0 -62
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js +0 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index12.js +0 -107
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index2.js +0 -5
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index3.js +0 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js +0 -14
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js +0 -28
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js +0 -99
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js +0 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js +0 -80
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js +0 -146
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index.js +0 -5
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index2.js +0 -41
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index3.js +0 -143
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index4.js +0 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index5.js +0 -127
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { extractApiErrorMessage as e } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
2
|
-
import { TAG_CATEGORY_LABELS_EN as t, TAG_MESSAGE_LABELS_EN as n } from "./index5.js";
|
|
3
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js
|
|
4
|
-
var r = {
|
|
5
|
-
createdAtLabel: "created_at",
|
|
6
|
-
updatedAtLabel: "updated_at"
|
|
7
|
-
};
|
|
8
|
-
function i(e) {
|
|
9
|
-
return e && r[e] || "created_at";
|
|
10
|
-
}
|
|
11
|
-
var a = {
|
|
12
|
-
year: "numeric",
|
|
13
|
-
month: "short",
|
|
14
|
-
day: "numeric"
|
|
15
|
-
};
|
|
16
|
-
function o(e, t) {
|
|
17
|
-
return e.replace("{name}", () => t);
|
|
18
|
-
}
|
|
19
|
-
var s;
|
|
20
|
-
function c(e) {
|
|
21
|
-
if (!e) return "";
|
|
22
|
-
let t = new Date(e);
|
|
23
|
-
return Number.isNaN(t.getTime()) ? "" : (s ??= new Intl.DateTimeFormat(void 0, a), s.format(t));
|
|
24
|
-
}
|
|
25
|
-
function l() {
|
|
26
|
-
let e = globalThis.getSelection?.();
|
|
27
|
-
return !!(e && e.toString().length > 0);
|
|
28
|
-
}
|
|
29
|
-
function u(e) {
|
|
30
|
-
let t = {};
|
|
31
|
-
for (let n of e ?? []) t[n.tag_id] = n.keywords;
|
|
32
|
-
return t;
|
|
33
|
-
}
|
|
34
|
-
function d(e) {
|
|
35
|
-
let t = {};
|
|
36
|
-
for (let n of e ?? []) t[n.id] = `${n.first_name ?? ""} ${n.last_name ?? ""}`.trim();
|
|
37
|
-
return t;
|
|
38
|
-
}
|
|
39
|
-
function f({ tags: e, keywordsByTagId: t, userNamesById: n }) {
|
|
40
|
-
return e.map((e) => ({
|
|
41
|
-
id: e.id,
|
|
42
|
-
name: e.name,
|
|
43
|
-
categoryLabel: h(e.category),
|
|
44
|
-
keywords: (t[e.id] ?? []).join(", "),
|
|
45
|
-
createdAtLabel: c(e.created_at),
|
|
46
|
-
updatedAtLabel: c(e.updated_at),
|
|
47
|
-
createdByLabel: e.created_by_entity_user_id ? n[e.created_by_entity_user_id] ?? "" : ""
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
function p(e, t, n) {
|
|
51
|
-
let r = e ?? [], i = r.filter((e) => e.tag_id !== t), a = Array.from(new Set(n));
|
|
52
|
-
return i.length === r.length && a.length === 0 ? {
|
|
53
|
-
changed: !1,
|
|
54
|
-
next: r
|
|
55
|
-
} : {
|
|
56
|
-
changed: !0,
|
|
57
|
-
next: a.length ? [...i, {
|
|
58
|
-
tag_id: t,
|
|
59
|
-
keywords: a,
|
|
60
|
-
enabled: !0
|
|
61
|
-
}] : i
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
var m = [
|
|
65
|
-
"document_type",
|
|
66
|
-
"department",
|
|
67
|
-
"project",
|
|
68
|
-
"cost_center",
|
|
69
|
-
"vendor_type",
|
|
70
|
-
"payment_method",
|
|
71
|
-
"approval_status"
|
|
72
|
-
];
|
|
73
|
-
function h(e, n) {
|
|
74
|
-
return e ? n?.[e] ?? t[e] ?? "" : "";
|
|
75
|
-
}
|
|
76
|
-
function g(e) {
|
|
77
|
-
return m.map((t) => ({
|
|
78
|
-
value: t,
|
|
79
|
-
label: h(t, e)
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
function _(e, t = n) {
|
|
83
|
-
let r = {}, i = e.name.trim();
|
|
84
|
-
i.length === 0 ? r.name = t.nameRequired : i.length > 255 && (r.name = t.nameTooLong);
|
|
85
|
-
let a = e.keywords.some((e) => e.length < 2), o = e.keywords.some((e) => e.length > 25);
|
|
86
|
-
return a ? r.keywords = t.keywordTooShort : o && (r.keywords = t.keywordTooLong), r;
|
|
87
|
-
}
|
|
88
|
-
function v(e) {
|
|
89
|
-
return !!(e.name || e.keywords);
|
|
90
|
-
}
|
|
91
|
-
function y(e) {
|
|
92
|
-
return e === "This tag already exists.";
|
|
93
|
-
}
|
|
94
|
-
function b(t, r = n, { preferApiMessage: i = !1 } = {}) {
|
|
95
|
-
let a = e(t);
|
|
96
|
-
return y(a) ? { name: r.duplicateName } : { form: (i ? a : void 0) ?? r.genericError };
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
export { m as TAG_CATEGORIES, u as buildKeywordsByTagId, f as buildTagRows, d as buildUserNamesById, p as computeNextOcrAutoTagging, c as formatTagDate, g as getCategoryOptions, h as getTagCategoryLabel, v as hasFormErrors, l as hasSelectedText, y as isDuplicateTagNameError, b as resolveTagSubmitError, i as sortFieldForColumn, _ as validateTagForm, o as withTagName };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { buildKeywordsByTagId as e, buildUserNamesById as t } from "./index6.js";
|
|
6
|
-
import { useMyEntityQuery as n } from "../../data-access/dist/index7.js";
|
|
7
|
-
import { useEntitySettingsQuery as r } from "../../data-access/dist/index8.js";
|
|
8
|
-
import { useEntityUsersQuery as i } from "../../data-access/dist/index10.js";
|
|
9
|
-
import "../../data-access/dist/index.js";
|
|
10
|
-
import { useCallback as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
11
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js
|
|
12
|
-
function l({ messages: l }) {
|
|
13
|
-
let u = n().data?.id, d = r(u), f = i(), p = o(() => e(d.data?.payables_ocr_auto_tagging), [d.data]), m = o(() => t(f.data?.data), [f.data]), h = a(async () => (await d.refetch()).data ?? d.data, [d]), g = s(Promise.resolve()), _ = s(0), [v, y] = c(!1), b = a((e) => {
|
|
14
|
-
_.current += 1, y(!0);
|
|
15
|
-
let t = g.current.then(e, e), n = () => {
|
|
16
|
-
--_.current, _.current === 0 && y(!1);
|
|
17
|
-
};
|
|
18
|
-
return g.current = t.then(n, n), t;
|
|
19
|
-
}, []), x = a(async () => {
|
|
20
|
-
let e = await h();
|
|
21
|
-
if (!e) throw Error(l.genericError);
|
|
22
|
-
return e;
|
|
23
|
-
}, [l.genericError, h]);
|
|
24
|
-
return {
|
|
25
|
-
entityId: u,
|
|
26
|
-
keywordsByTagId: p,
|
|
27
|
-
userNamesById: m,
|
|
28
|
-
settingsData: d.data,
|
|
29
|
-
refetchSettings: h,
|
|
30
|
-
requireFreshSettings: x,
|
|
31
|
-
withSettingsLock: b,
|
|
32
|
-
settingsBusy: v
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { l as useEntitySettings };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import "../../../../shared/ui/dist/index.js";
|
|
7
|
-
import { extractApiErrorMessage as t } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
8
|
-
import { computeNextOcrAutoTagging as n, withTagName as r } from "./index6.js";
|
|
9
|
-
import { useDeleteTagMutation as i } from "../../data-access/dist/index6.js";
|
|
10
|
-
import { useUpdateEntitySettingsMutation as a } from "../../data-access/dist/index9.js";
|
|
11
|
-
import "../../data-access/dist/index.js";
|
|
12
|
-
import { useCallback as o, useEffect as s, useRef as c, useState as l } from "react";
|
|
13
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
|
|
14
|
-
function u({ selectedTag: u, setSelectedTag: d, settings: f, messages: p, canWrite: m, canMutate: h }) {
|
|
15
|
-
let { entityId: g, requireFreshSettings: _, withSettingsLock: v, settingsBusy: y } = f, b = i(), x = a(), [S, C] = l(!1), [w, T] = l(), E = c(0), D = o(() => {
|
|
16
|
-
E.current += 1;
|
|
17
|
-
}, []), O = c(h);
|
|
18
|
-
O.current = h, s(() => {
|
|
19
|
-
m || (D(), C(!1));
|
|
20
|
-
}, [m, D]);
|
|
21
|
-
let k = o((e) => {
|
|
22
|
-
m && (D(), d(e), T(void 0), C(!0));
|
|
23
|
-
}, [
|
|
24
|
-
m,
|
|
25
|
-
D,
|
|
26
|
-
d
|
|
27
|
-
]), A = o((e) => {
|
|
28
|
-
e || (D(), T(void 0), C(!1));
|
|
29
|
-
}, [D]), j = o(() => {
|
|
30
|
-
D(), T(void 0), C(!1);
|
|
31
|
-
}, [D]);
|
|
32
|
-
return {
|
|
33
|
-
open: S,
|
|
34
|
-
error: w,
|
|
35
|
-
requestDelete: k,
|
|
36
|
-
onOpenChange: A,
|
|
37
|
-
confirm: o(async () => {
|
|
38
|
-
if (!h || !u) return;
|
|
39
|
-
let i = u;
|
|
40
|
-
T(void 0);
|
|
41
|
-
let a = E.current, o = () => E.current === a;
|
|
42
|
-
await v(async () => {
|
|
43
|
-
let a;
|
|
44
|
-
try {
|
|
45
|
-
if (a = g ? await _() : void 0, !O.current) return;
|
|
46
|
-
await b.mutateAsync({ path: { tag_id: i.id } });
|
|
47
|
-
} catch (n) {
|
|
48
|
-
let r = t(n) ?? p.deleteError;
|
|
49
|
-
o() ? T(r) : e.error(r);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (e.success(r(p.tagDeleted, i.name)), o() && (C(!1), d(void 0)), !g || !a) return;
|
|
53
|
-
let { changed: s, next: c } = n(a.payables_ocr_auto_tagging, i.id, []);
|
|
54
|
-
if (s && O.current) try {
|
|
55
|
-
await x.mutateAsync({
|
|
56
|
-
path: { entity_id: g },
|
|
57
|
-
body: { payables_ocr_auto_tagging: c }
|
|
58
|
-
});
|
|
59
|
-
} catch {
|
|
60
|
-
e.error(r(p.keywordCleanupError, i.name));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}, [
|
|
64
|
-
h,
|
|
65
|
-
u,
|
|
66
|
-
g,
|
|
67
|
-
_,
|
|
68
|
-
v,
|
|
69
|
-
b,
|
|
70
|
-
x,
|
|
71
|
-
d,
|
|
72
|
-
p
|
|
73
|
-
]),
|
|
74
|
-
cancel: j,
|
|
75
|
-
isDeleting: b.isPending,
|
|
76
|
-
confirmDisabled: y
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
export { u as useTagDelete };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import "../../../../shared/ui/dist/index.js";
|
|
7
|
-
import { EMPTY_FORM_VALUES as t } from "./index4.js";
|
|
8
|
-
import { buildKeywordsByTagId as n, computeNextOcrAutoTagging as r, getCategoryOptions as i, hasFormErrors as a, resolveTagSubmitError as o, validateTagForm as s, withTagName as c } from "./index6.js";
|
|
9
|
-
import { useCreateTagMutation as l } from "../../data-access/dist/index4.js";
|
|
10
|
-
import { useUpdateTagMutation as u } from "../../data-access/dist/index5.js";
|
|
11
|
-
import { useUpdateEntitySettingsMutation as d } from "../../data-access/dist/index9.js";
|
|
12
|
-
import "../../data-access/dist/index.js";
|
|
13
|
-
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
14
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
|
|
15
|
-
function _({ selectedTag: _, setSelectedTag: v, settings: y, messages: b, canWrite: x, canMutate: S }) {
|
|
16
|
-
let { entityId: C, settingsData: w, refetchSettings: T, requireFreshSettings: E, withSettingsLock: D, settingsBusy: O } = y, k = l(), A = u(), j = d(), [M, N] = g(!1), [P, F] = g("create"), [I, L] = g(t), [R, z] = g({}), B = m(() => i(), []), V = h(0), H = O || k.isPending || A.isPending || j.isPending, U = f(() => {
|
|
17
|
-
V.current += 1;
|
|
18
|
-
}, []);
|
|
19
|
-
p(() => {
|
|
20
|
-
x || (U(), N(!1));
|
|
21
|
-
}, [x, U]);
|
|
22
|
-
let W = h(x);
|
|
23
|
-
W.current = x;
|
|
24
|
-
let G = h(S);
|
|
25
|
-
return G.current = S, {
|
|
26
|
-
open: M,
|
|
27
|
-
mode: P,
|
|
28
|
-
values: I,
|
|
29
|
-
errors: R,
|
|
30
|
-
categoryOptions: B,
|
|
31
|
-
isSubmitting: H,
|
|
32
|
-
openCreate: f(() => {
|
|
33
|
-
x && (U(), F("create"), v(void 0), L(t), z({}), N(!0));
|
|
34
|
-
}, [
|
|
35
|
-
x,
|
|
36
|
-
U,
|
|
37
|
-
v
|
|
38
|
-
]),
|
|
39
|
-
openEdit: f((e) => {
|
|
40
|
-
if (!x) return;
|
|
41
|
-
U();
|
|
42
|
-
let t = V.current;
|
|
43
|
-
(async () => {
|
|
44
|
-
let r = w ?? await T();
|
|
45
|
-
if (!W.current || V.current !== t) return;
|
|
46
|
-
let i = n(r?.payables_ocr_auto_tagging);
|
|
47
|
-
v(e), F("edit"), L({
|
|
48
|
-
name: e.name,
|
|
49
|
-
category: e.category ?? "",
|
|
50
|
-
keywords: i[e.id] ?? [],
|
|
51
|
-
keywordsInput: ""
|
|
52
|
-
}), z({}), N(!0);
|
|
53
|
-
})();
|
|
54
|
-
}, [
|
|
55
|
-
x,
|
|
56
|
-
U,
|
|
57
|
-
w,
|
|
58
|
-
T,
|
|
59
|
-
v
|
|
60
|
-
]),
|
|
61
|
-
onOpenChange: f((e) => {
|
|
62
|
-
e || (U(), N(!1));
|
|
63
|
-
}, [U]),
|
|
64
|
-
close: f(() => {
|
|
65
|
-
U(), N(!1);
|
|
66
|
-
}, [U]),
|
|
67
|
-
onNameChange: f((e) => L((t) => ({
|
|
68
|
-
...t,
|
|
69
|
-
name: e
|
|
70
|
-
})), []),
|
|
71
|
-
onCategoryChange: f((e) => L((t) => ({
|
|
72
|
-
...t,
|
|
73
|
-
category: e
|
|
74
|
-
})), []),
|
|
75
|
-
onKeywordsChange: f((e) => L((t) => ({
|
|
76
|
-
...t,
|
|
77
|
-
keywords: e
|
|
78
|
-
})), []),
|
|
79
|
-
onKeywordsInputChange: f((e) => L((t) => ({
|
|
80
|
-
...t,
|
|
81
|
-
keywordsInput: e
|
|
82
|
-
})), []),
|
|
83
|
-
submit: f(async () => {
|
|
84
|
-
if (!S) return;
|
|
85
|
-
let t = s(I, b);
|
|
86
|
-
if (a(t)) {
|
|
87
|
-
z(t);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
z({});
|
|
91
|
-
let n = I.name.trim(), i = I.category === "" ? void 0 : I.category, l = {
|
|
92
|
-
name: n,
|
|
93
|
-
...i ? { category: i } : {}
|
|
94
|
-
}, u = V.current, d = () => V.current === u, f = (t) => {
|
|
95
|
-
d() ? (v(t), F("edit"), z({ form: b.keywordsNotSaved })) : e.error(c(b.keywordSyncError, n));
|
|
96
|
-
}, p;
|
|
97
|
-
await D(async () => {
|
|
98
|
-
try {
|
|
99
|
-
let t = I.keywords.length > 0 || P === "edit", i = C && t ? await E() : void 0;
|
|
100
|
-
if (!G.current) return;
|
|
101
|
-
let a = P === "edit" && _ ? await A.mutateAsync({
|
|
102
|
-
path: { tag_id: _.id },
|
|
103
|
-
body: l
|
|
104
|
-
}) : await k.mutateAsync({ body: l });
|
|
105
|
-
if (p = a, C && i) {
|
|
106
|
-
let { changed: e, next: t } = r(i.payables_ocr_auto_tagging, a.id, I.keywords);
|
|
107
|
-
if (e) {
|
|
108
|
-
if (!G.current) {
|
|
109
|
-
f(a);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
await j.mutateAsync({
|
|
113
|
-
path: { entity_id: C },
|
|
114
|
-
body: { payables_ocr_auto_tagging: t }
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
e.success(c(P === "edit" ? b.tagUpdated : b.tagCreated, n)), d() && N(!1);
|
|
119
|
-
} catch (t) {
|
|
120
|
-
if (p) {
|
|
121
|
-
f(p);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
let n = o(t, b, { preferApiMessage: !0 });
|
|
125
|
-
d() ? z(n) : e.error(n.form ?? n.name ?? b.genericError);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}, [
|
|
129
|
-
S,
|
|
130
|
-
I,
|
|
131
|
-
P,
|
|
132
|
-
F,
|
|
133
|
-
v,
|
|
134
|
-
_,
|
|
135
|
-
C,
|
|
136
|
-
k,
|
|
137
|
-
A,
|
|
138
|
-
j,
|
|
139
|
-
b,
|
|
140
|
-
E,
|
|
141
|
-
D
|
|
142
|
-
])
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
//#endregion
|
|
146
|
-
export { _ as useTagForm };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index2.js
|
|
2
|
-
var e = {
|
|
3
|
-
createButton: "Create",
|
|
4
|
-
columnName: "Name",
|
|
5
|
-
columnCategory: "Category",
|
|
6
|
-
columnKeywords: "Keywords",
|
|
7
|
-
columnCreatedAt: "Created at",
|
|
8
|
-
columnUpdatedAt: "Updated at",
|
|
9
|
-
columnCreatedBy: "Created by",
|
|
10
|
-
columnActions: "Actions",
|
|
11
|
-
openRow: (e) => `Edit tag — ${e}`,
|
|
12
|
-
actionDelete: "Delete",
|
|
13
|
-
openActionsMenu: "Open actions menu",
|
|
14
|
-
emptyTitle: "No tags",
|
|
15
|
-
emptyDescription: "You don't have any tags yet. You can create your first tag.",
|
|
16
|
-
emptyDescriptionNoAction: "You don't have any tags yet.",
|
|
17
|
-
emptyAction: "Create new tag",
|
|
18
|
-
errorTitle: "Failed to load tags",
|
|
19
|
-
errorDescription: "Something went wrong while fetching your tags. Please try again.",
|
|
20
|
-
errorRetry: "Try again"
|
|
21
|
-
}, t = {
|
|
22
|
-
title: "Delete “{name}” tag?",
|
|
23
|
-
message: "This action can't be undone.",
|
|
24
|
-
confirmButton: "Delete",
|
|
25
|
-
cancelButton: "Cancel"
|
|
26
|
-
}, n = {
|
|
27
|
-
createTitle: "Create new tag",
|
|
28
|
-
editTitle: "Edit tag “{name}”",
|
|
29
|
-
nameLabel: "Name",
|
|
30
|
-
categoryLabel: "Category",
|
|
31
|
-
categoryPlaceholder: "Not set",
|
|
32
|
-
keywordsLabel: "Keywords",
|
|
33
|
-
keywordsPlaceholder: "Add a keyword…",
|
|
34
|
-
removeKeyword: "Remove {keyword}",
|
|
35
|
-
cancelButton: "Cancel",
|
|
36
|
-
createButton: "Create",
|
|
37
|
-
saveButton: "Save",
|
|
38
|
-
deleteButton: "Delete"
|
|
39
|
-
};
|
|
40
|
-
//#endregion
|
|
41
|
-
export { e as TAGS_SCREEN_LABELS_EN, t as TAG_DELETE_DIALOG_LABELS_EN, n as TAG_FORM_SHEET_LABELS_EN };
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Button as e, DataTable as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import { EmptyState as o } from "../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
|
|
3
|
-
import { ErrorState as s } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
4
|
-
import "../../../../shared/ui/dist/index.js";
|
|
5
|
-
import { TAGS_SCREEN_LABELS_EN as c } from "./index2.js";
|
|
6
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
-
import { ArrowDownIcon as d, ArrowUpDownIcon as f, ArrowUpIcon as p, MoreVerticalIcon as m, PlusIcon as h, Trash2Icon as g } from "lucide-react";
|
|
8
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index3.js
|
|
9
|
-
var _ = [
|
|
10
|
-
10,
|
|
11
|
-
25,
|
|
12
|
-
50,
|
|
13
|
-
100
|
|
14
|
-
];
|
|
15
|
-
function v({ label: t, isSorted: n, onToggle: r }) {
|
|
16
|
-
return /* @__PURE__ */ u("div", {
|
|
17
|
-
className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
|
|
18
|
-
children: [t, /* @__PURE__ */ l(e, {
|
|
19
|
-
variant: "ghost",
|
|
20
|
-
size: "icon-sm",
|
|
21
|
-
onClick: r,
|
|
22
|
-
children: l(n === "asc" ? p : n === "desc" ? d : f, { className: "ttw:size-4" })
|
|
23
|
-
})]
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function y({ tags: d, isLoading: f, isError: p, sorting: y, onSortingChange: b, pageSize: x, onPageSizeChange: S, pageSizeOptions: C = _, hasNextPage: w, hasPrevPage: T, onNextPage: E, onPrevPage: D, onCreateClick: O, onRowClick: k, onDeleteClick: A, onRetry: j, labels: M, emptyStateTestId: N }) {
|
|
27
|
-
let P = {
|
|
28
|
-
...c,
|
|
29
|
-
...M
|
|
30
|
-
}, F = [
|
|
31
|
-
{
|
|
32
|
-
accessorKey: "name",
|
|
33
|
-
header: P.columnName
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
accessorKey: "categoryLabel",
|
|
37
|
-
header: P.columnCategory
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
accessorKey: "keywords",
|
|
41
|
-
header: P.columnKeywords
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
accessorKey: "createdAtLabel",
|
|
45
|
-
enableSorting: !0,
|
|
46
|
-
header: ({ column: e }) => /* @__PURE__ */ l(v, {
|
|
47
|
-
label: P.columnCreatedAt,
|
|
48
|
-
isSorted: e.getIsSorted(),
|
|
49
|
-
onToggle: () => e.toggleSorting(e.getIsSorted() === "asc")
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
accessorKey: "updatedAtLabel",
|
|
54
|
-
enableSorting: !0,
|
|
55
|
-
header: ({ column: e }) => /* @__PURE__ */ l(v, {
|
|
56
|
-
label: P.columnUpdatedAt,
|
|
57
|
-
isSorted: e.getIsSorted(),
|
|
58
|
-
onToggle: () => e.toggleSorting(e.getIsSorted() === "asc")
|
|
59
|
-
})
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
accessorKey: "createdByLabel",
|
|
63
|
-
header: P.columnCreatedBy
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
A && F.push({
|
|
67
|
-
id: "actions",
|
|
68
|
-
header: () => /* @__PURE__ */ l("div", {
|
|
69
|
-
className: "ttw:text-right",
|
|
70
|
-
children: P.columnActions
|
|
71
|
-
}),
|
|
72
|
-
cell: ({ row: t }) => /* @__PURE__ */ l("div", {
|
|
73
|
-
className: "ttw:flex ttw:justify-end",
|
|
74
|
-
children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
75
|
-
asChild: !0,
|
|
76
|
-
children: /* @__PURE__ */ u(e, {
|
|
77
|
-
variant: "ghost",
|
|
78
|
-
size: "icon-sm",
|
|
79
|
-
onClick: (e) => e.stopPropagation(),
|
|
80
|
-
children: [/* @__PURE__ */ l("span", {
|
|
81
|
-
className: "ttw:sr-only",
|
|
82
|
-
children: P.openActionsMenu
|
|
83
|
-
}), /* @__PURE__ */ l(m, { className: "ttw:size-4" })]
|
|
84
|
-
})
|
|
85
|
-
}), /* @__PURE__ */ l(r, {
|
|
86
|
-
align: "end",
|
|
87
|
-
children: /* @__PURE__ */ u(i, {
|
|
88
|
-
variant: "destructive",
|
|
89
|
-
onClick: (e) => {
|
|
90
|
-
e.stopPropagation(), A(t.original);
|
|
91
|
-
},
|
|
92
|
-
children: [/* @__PURE__ */ l(g, { className: "ttw:size-4" }), P.actionDelete]
|
|
93
|
-
})
|
|
94
|
-
})] })
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
let I = k ? {
|
|
98
|
-
onRowClick: k,
|
|
99
|
-
rowAriaLabel: (e) => P.openRow(e.name)
|
|
100
|
-
} : {};
|
|
101
|
-
return /* @__PURE__ */ u("div", {
|
|
102
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
103
|
-
children: [O && /* @__PURE__ */ l("div", {
|
|
104
|
-
className: "ttw:flex ttw:items-center ttw:justify-end",
|
|
105
|
-
children: /* @__PURE__ */ u(e, {
|
|
106
|
-
size: "sm",
|
|
107
|
-
onClick: O,
|
|
108
|
-
children: [/* @__PURE__ */ l(h, {
|
|
109
|
-
"aria-hidden": !0,
|
|
110
|
-
className: "ttw:size-4"
|
|
111
|
-
}), P.createButton]
|
|
112
|
-
})
|
|
113
|
-
}), p ? /* @__PURE__ */ l(s, {
|
|
114
|
-
title: P.errorTitle,
|
|
115
|
-
description: P.errorDescription,
|
|
116
|
-
retryLabel: j ? P.errorRetry : void 0,
|
|
117
|
-
onRetry: j
|
|
118
|
-
}) : /* @__PURE__ */ l(t, {
|
|
119
|
-
columns: F,
|
|
120
|
-
data: d,
|
|
121
|
-
isLoading: f,
|
|
122
|
-
sorting: y,
|
|
123
|
-
onSortingChange: b,
|
|
124
|
-
pageSize: x,
|
|
125
|
-
onPageSizeChange: S,
|
|
126
|
-
pageSizeOptions: C,
|
|
127
|
-
hasNextPage: w,
|
|
128
|
-
hasPrevPage: T,
|
|
129
|
-
onNextPage: E,
|
|
130
|
-
onPrevPage: D,
|
|
131
|
-
...I,
|
|
132
|
-
children: /* @__PURE__ */ l(o, {
|
|
133
|
-
testId: N,
|
|
134
|
-
title: P.emptyTitle,
|
|
135
|
-
description: O ? P.emptyDescription : P.emptyDescriptionNoAction,
|
|
136
|
-
actionLabel: P.emptyAction,
|
|
137
|
-
onAction: O
|
|
138
|
-
})
|
|
139
|
-
})]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
|
-
export { y as TagsScreen, y as default };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import { TAG_DELETE_DIALOG_LABELS_EN as s } from "./index2.js";
|
|
3
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
-
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index4.js
|
|
5
|
-
function u({ open: u, onOpenChange: d, tagName: f, isDeleting: p, error: m, confirmDisabled: h, onConfirm: g, onCancel: _, labels: v }) {
|
|
6
|
-
let y = {
|
|
7
|
-
...s,
|
|
8
|
-
...v
|
|
9
|
-
};
|
|
10
|
-
return /* @__PURE__ */ c(e, {
|
|
11
|
-
open: u,
|
|
12
|
-
onOpenChange: d,
|
|
13
|
-
children: /* @__PURE__ */ l(t, { children: [
|
|
14
|
-
/* @__PURE__ */ l(i, { children: [/* @__PURE__ */ c(a, { children: y.title.replace("{name}", f) }), /* @__PURE__ */ c(n, { children: y.message })] }),
|
|
15
|
-
m ? /* @__PURE__ */ c("p", {
|
|
16
|
-
role: "alert",
|
|
17
|
-
className: "ttw:text-sm ttw:text-destructive",
|
|
18
|
-
children: m
|
|
19
|
-
}) : null,
|
|
20
|
-
/* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(o, {
|
|
21
|
-
variant: "ghost",
|
|
22
|
-
onClick: _,
|
|
23
|
-
disabled: p,
|
|
24
|
-
children: y.cancelButton
|
|
25
|
-
}), /* @__PURE__ */ c(o, {
|
|
26
|
-
variant: "destructive",
|
|
27
|
-
onClick: g,
|
|
28
|
-
disabled: p || h,
|
|
29
|
-
loading: p,
|
|
30
|
-
children: y.confirmButton
|
|
31
|
-
})] })
|
|
32
|
-
] })
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { u as TagDeleteDialog, u as default };
|