@tesouro/embedded-components-react 0.11.71 → 0.11.72
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 -0
- package/dist/index.css +35 -192
- package/dist/index.d.ts +75 -71
- package/dist/lib/SettingsWidget.d.ts +5 -1
- package/dist/lib/WidgetSuite.d.ts +4 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +196 -131
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +11 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +38 -32
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +103 -75
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +140 -168
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +97 -87
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +11 -7
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index8.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index2.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +134 -177
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index4.js +110 -176
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index5.js +28 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +13 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -24
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +35 -31
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -5
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +22 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +54 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +75 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +42 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +39 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index3.js +56 -71
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index10.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +86 -66
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index13.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index15.js +146 -132
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +95 -99
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index4.js +8 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +69 -72
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index6.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +9 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index10.js +83 -298
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index11.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +122 -75
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index13.js +41 -15
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index14.js +7 -131
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index15.js +147 -48
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +240 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +15 -173
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index2.js +38 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index3.js +5 -46
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index4.js +52 -45
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +101 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index6.js +40 -98
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index7.js +415 -40
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +261 -332
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js +15 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +136 -122
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +16 -17
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index12.js +99 -100
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index17.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +10 -55
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index19.js +34 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +8 -84
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index21.js +86 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +17 -18
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +33 -42
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +24 -24
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/FileDropZone/FileDropZone.js +62 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +1 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +2301 -2283
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index18.js +0 -291
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index19.js +0 -22
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/avatarSwatch.js +0 -26
|
@@ -1,107 +1,117 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ExpenseApprovalsPageLabels as
|
|
3
|
-
import { formatAmount as
|
|
4
|
-
import { EmptyApprovalRules as
|
|
5
|
-
import { ApprovalRuleCard as
|
|
6
|
-
import { ApprovalRuleForm as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { Alert as e, AlertDescription as t, AlertTitle as n, Button as r, Skeleton as i } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ExpenseApprovalsPageLabels as a, GapCalloutLabels as o } from "./index3.js";
|
|
3
|
+
import { formatAmount as s } from "./index4.js";
|
|
4
|
+
import { EmptyApprovalRules as c } from "./index5.js";
|
|
5
|
+
import { ApprovalRuleCard as l } from "./index6.js";
|
|
6
|
+
import { ApprovalRuleForm as u } from "./index7.js";
|
|
7
|
+
import { createPortal as d } from "react-dom";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
import { CircleCheck as h, Info as g } from "lucide-react";
|
|
9
10
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js
|
|
10
|
-
function
|
|
11
|
-
return e.to === null ? `${
|
|
11
|
+
function _(e, t) {
|
|
12
|
+
return e.to === null ? `${t.Above} ${s(e.from)}` : `${s(e.from)} ${t.RangeSeparator} ${s(e.to)}`;
|
|
12
13
|
}
|
|
13
|
-
var
|
|
14
|
-
let
|
|
15
|
-
|
|
14
|
+
var v = ({ rules: s, labels: v, isBusy: y, isLoading: b, isAddingRule: x, newRuleFormValues: S, newRuleValidationErrors: C, editingRuleId: w, editingRuleFormValues: T, editingRuleValidationErrors: E, approverOptions: D, allExpensesAreCovered: O, gapIntervals: k, onAddRuleClick: A, headerActionContainer: j, onCancelAddRule: M, onSaveNewRule: N, onNewRuleFormChange: P, onEditRule: F, onCancelEditRule: I, onSaveEditRule: L, onEditRuleFormChange: R, onDeleteRule: z, onLearnMore: B, testIds: V }) => {
|
|
15
|
+
let H = {
|
|
16
|
+
...a,
|
|
17
|
+
...v?.page
|
|
18
|
+
}, U = {
|
|
19
|
+
...o,
|
|
20
|
+
...v?.gap
|
|
21
|
+
}, W = s.length > 0;
|
|
22
|
+
return /* @__PURE__ */ p("div", {
|
|
16
23
|
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
17
|
-
children:
|
|
24
|
+
children: b && !W && !x && !w ? /* @__PURE__ */ m("div", {
|
|
18
25
|
role: "status",
|
|
19
26
|
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ p("span", {
|
|
21
28
|
className: "ttw:sr-only",
|
|
22
|
-
children:
|
|
23
|
-
}), Array.from({ length: 2 }).map((e,
|
|
29
|
+
children: H.LoadingRules
|
|
30
|
+
}), Array.from({ length: 2 }).map((e, t) => /* @__PURE__ */ m("div", {
|
|
24
31
|
className: "ttw:border ttw:border-border ttw:rounded-lg ttw:p-4 ttw:flex ttw:flex-col ttw:gap-3",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
32
|
+
children: [/* @__PURE__ */ m("div", {
|
|
26
33
|
className: "ttw:flex ttw:items-center ttw:justify-between",
|
|
27
|
-
children: [/* @__PURE__ */
|
|
34
|
+
children: [/* @__PURE__ */ p(i, { className: "ttw:h-4 ttw:w-64" }), /* @__PURE__ */ m("div", {
|
|
28
35
|
className: "ttw:flex ttw:gap-1",
|
|
29
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ p(i, { className: "ttw:h-8 ttw:w-8" }), /* @__PURE__ */ p(i, { className: "ttw:h-8 ttw:w-8" })]
|
|
30
37
|
})]
|
|
31
|
-
}), /* @__PURE__ */
|
|
32
|
-
},
|
|
33
|
-
}) : !
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}), /* @__PURE__ */ p(i, { className: "ttw:h-6 ttw:w-32" })]
|
|
39
|
+
}, t))]
|
|
40
|
+
}) : !W && !x ? /* @__PURE__ */ p(c, {
|
|
41
|
+
labels: v?.empty,
|
|
42
|
+
onAddRule: A,
|
|
43
|
+
onLearnMore: B
|
|
44
|
+
}) : /* @__PURE__ */ m(f, { children: [
|
|
45
|
+
!O && !x && !w && W && (j === void 0 ? /* @__PURE__ */ p("div", {
|
|
46
|
+
className: "ttw:flex ttw:justify-end",
|
|
47
|
+
children: /* @__PURE__ */ p(r, {
|
|
48
|
+
size: "sm",
|
|
49
|
+
onClick: A,
|
|
50
|
+
disabled: y,
|
|
51
|
+
children: H.AddRule
|
|
52
|
+
})
|
|
53
|
+
}) : j ? d(/* @__PURE__ */ p(r, {
|
|
54
|
+
size: "sm",
|
|
55
|
+
onClick: A,
|
|
56
|
+
disabled: y,
|
|
57
|
+
children: H.AddRule
|
|
58
|
+
}), j) : null),
|
|
59
|
+
s.map((e) => w === e.id && T ? /* @__PURE__ */ p(u, {
|
|
60
|
+
labels: v?.ruleForm,
|
|
61
|
+
values: T,
|
|
62
|
+
approverOptions: D,
|
|
63
|
+
validationErrors: E,
|
|
41
64
|
isEditing: !0,
|
|
42
|
-
disabled:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, e.id) : /* @__PURE__ */ l(o, {
|
|
65
|
+
disabled: y,
|
|
66
|
+
onValuesChange: R,
|
|
67
|
+
onSave: L,
|
|
68
|
+
onCancel: I,
|
|
69
|
+
onDelete: () => z(e.id),
|
|
70
|
+
testIds: V?.ruleForm
|
|
71
|
+
}, e.id) : /* @__PURE__ */ p(l, {
|
|
50
72
|
rule: e,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
labels: v?.ruleCard,
|
|
74
|
+
onEdit: F,
|
|
75
|
+
onDelete: z,
|
|
76
|
+
disabled: y,
|
|
77
|
+
testIds: V?.ruleCard
|
|
55
78
|
}, e.id)),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
x && !w && /* @__PURE__ */ p(u, {
|
|
80
|
+
labels: v?.ruleForm,
|
|
81
|
+
values: S,
|
|
82
|
+
approverOptions: D,
|
|
83
|
+
validationErrors: C,
|
|
60
84
|
isEditing: !1,
|
|
61
|
-
disabled:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
testIds: I?.ruleForm
|
|
67
|
-
}),
|
|
68
|
-
R && /* @__PURE__ */ u("div", {
|
|
69
|
-
className: "ttw:flex ttw:items-center ttw:justify-between ttw:border ttw:border-dashed ttw:border-border ttw:rounded-lg ttw:px-4 ttw:py-3",
|
|
70
|
-
children: [/* @__PURE__ */ l("span", {
|
|
71
|
-
className: "ttw:text-sm ttw:font-bold ttw:text-foreground",
|
|
72
|
-
children: n.CreateAnotherRule
|
|
73
|
-
}), /* @__PURE__ */ u(e, {
|
|
74
|
-
size: "sm",
|
|
75
|
-
onClick: E,
|
|
76
|
-
disabled: h,
|
|
77
|
-
children: [/* @__PURE__ */ l(p, {}), n.AddRule]
|
|
78
|
-
})]
|
|
85
|
+
disabled: y,
|
|
86
|
+
onValuesChange: P,
|
|
87
|
+
onSave: N,
|
|
88
|
+
onCancel: M,
|
|
89
|
+
testIds: V?.ruleForm
|
|
79
90
|
}),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})] })]
|
|
91
|
+
O && /* @__PURE__ */ m(e, {
|
|
92
|
+
variant: "success",
|
|
93
|
+
role: "status",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ p(h, { "aria-hidden": "true" }),
|
|
96
|
+
/* @__PURE__ */ p(n, { children: H.AllExpensesCoveredTitle }),
|
|
97
|
+
/* @__PURE__ */ p(t, { children: H.AllExpensesCoveredBody })
|
|
98
|
+
]
|
|
89
99
|
}),
|
|
90
|
-
!
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
})]
|
|
100
|
+
!O && k.length > 0 && /* @__PURE__ */ m(e, {
|
|
101
|
+
variant: "info",
|
|
102
|
+
role: "status",
|
|
103
|
+
children: [/* @__PURE__ */ p(g, { "aria-hidden": "true" }), /* @__PURE__ */ p(t, { children: /* @__PURE__ */ m("p", { children: [
|
|
104
|
+
U.Prefix,
|
|
105
|
+
" ",
|
|
106
|
+
/* @__PURE__ */ p("strong", { children: U.Default }),
|
|
107
|
+
" ",
|
|
108
|
+
U.AfterDefault,
|
|
109
|
+
" ",
|
|
110
|
+
/* @__PURE__ */ p("strong", { children: k.map((e) => _(e, U)).join(", ") }),
|
|
111
|
+
U.Suffix
|
|
112
|
+
] }) })]
|
|
103
113
|
})
|
|
104
114
|
] })
|
|
105
115
|
});
|
|
106
116
|
};
|
|
107
|
-
export {
|
|
117
|
+
export { v as ExpenseApprovalsPage };
|
|
@@ -64,7 +64,12 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
|
|
|
64
64
|
name: j.name.trim(),
|
|
65
65
|
nominal_code: j.nominal_code.trim(),
|
|
66
66
|
description: j.description.trim()
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
|
+
if (D === "edit" && k && r.name === k.name.trim() && r.nominal_code === k.nominal_code.trim() && r.description === (k.description ?? "").trim()) {
|
|
69
|
+
E(!1);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let i = R.current, a = () => R.current === i;
|
|
68
73
|
B(!0);
|
|
69
74
|
try {
|
|
70
75
|
D === "edit" && k ? (await w(k.id, r), e.success(g(x.accountUpdated, r.name))) : (await C(r), e.success(g(x.accountCreated, r.name))), a() && E(!1);
|
|
@@ -109,19 +114,18 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
|
|
|
109
114
|
V
|
|
110
115
|
]), le = d(() => {
|
|
111
116
|
k && Q(k);
|
|
112
|
-
}, [k, Q]), ue =
|
|
117
|
+
}, [k, Q]), ue = S.descriptionCounter.replace("{count}", () => String(j.description.length)).replace("{max}", () => String(a.description)), de = D === "edit" ? k?.name ?? "" : S.createTitle, fe = D === "edit" ? S.editDescription : S.createDescription, pe = g(ee.title, I?.name ?? "");
|
|
113
118
|
return {
|
|
114
119
|
form: {
|
|
115
120
|
open: te,
|
|
116
121
|
mode: D,
|
|
117
|
-
title:
|
|
118
|
-
description:
|
|
122
|
+
title: de,
|
|
123
|
+
description: fe,
|
|
119
124
|
values: j,
|
|
120
125
|
errors: N,
|
|
121
126
|
editing: k,
|
|
122
127
|
inProgress: z,
|
|
123
|
-
|
|
124
|
-
descriptionCounterText: de,
|
|
128
|
+
descriptionCounterText: ue,
|
|
125
129
|
onOpenChange: W,
|
|
126
130
|
onNameChange: K,
|
|
127
131
|
onGlCodeChange: q,
|
|
@@ -131,7 +135,7 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
|
|
|
131
135
|
},
|
|
132
136
|
deleteDialog: {
|
|
133
137
|
open: ne,
|
|
134
|
-
title:
|
|
138
|
+
title: pe,
|
|
135
139
|
error: ie,
|
|
136
140
|
isDeleting: oe,
|
|
137
141
|
onOpenChange: ce,
|
|
@@ -90,7 +90,6 @@ function b({ onEdit: r, onDelete: o, onAdd: b, screenLabels: x, formLabels: S, d
|
|
|
90
90
|
values: k.form.values,
|
|
91
91
|
errors: k.form.errors,
|
|
92
92
|
inProgress: k.form.inProgress,
|
|
93
|
-
submitDisabled: k.form.submitDisabled,
|
|
94
93
|
descriptionCounterText: k.form.descriptionCounterText,
|
|
95
94
|
onNameChange: k.form.onNameChange,
|
|
96
95
|
onGlCodeChange: k.form.onGlCodeChange,
|
|
@@ -9,12 +9,14 @@ var e = {
|
|
|
9
9
|
actionDelete: "Delete",
|
|
10
10
|
sortByName: "Sort by account name",
|
|
11
11
|
openActionsMenu: "Open actions menu",
|
|
12
|
+
editAccount: "Edit account",
|
|
13
|
+
loading: "Loading accounts",
|
|
12
14
|
addAccount: "Add account",
|
|
13
15
|
emptyTitle: "No accounts created yet",
|
|
14
16
|
emptyDescription: "Add your first ledger account.",
|
|
15
17
|
emptyPageTitle: "Nothing left on this page",
|
|
16
18
|
emptyPageDescription: "Every account on this page has been removed. Go back to see the rest.",
|
|
17
|
-
errorTitle: "
|
|
19
|
+
errorTitle: "Couldn't load chart of accounts",
|
|
18
20
|
errorDescription: "Something went wrong while fetching your accounts. Please try again.",
|
|
19
21
|
paginationPrev: "Previous",
|
|
20
22
|
paginationNext: "Next"
|
|
@@ -1,210 +1,167 @@
|
|
|
1
|
-
import { Button as e,
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { Button as e, ContextMenuItem as t, ContextMenuSeparator as n, DataTable as r, DropdownMenu as i, DropdownMenuContent as a, DropdownMenuItem as o, DropdownMenuSeparator as s, DropdownMenuTrigger as c, Tooltip as l, TooltipContent as u, TooltipProvider as d, TooltipTrigger as f } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { EmptyState as p } from "../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
|
|
3
|
+
import { ErrorState as m } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
4
|
+
import "../../../../shared/ui/dist/index.js";
|
|
5
|
+
import { CHART_OF_ACCOUNTS_LABELS_EN as h } from "./index2.js";
|
|
6
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
7
|
+
import { ArrowDownIcon as y, ArrowUpDownIcon as b, ArrowUpIcon as x, MoreVerticalIcon as S, PencilIcon as C, Trash2Icon as w } from "lucide-react";
|
|
6
8
|
// ../../libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
className: "ttw:mb-4 ttw:flex ttw:h-14 ttw:w-14 ttw:items-center ttw:justify-center ttw:rounded-2xl ttw:bg-destructive/10",
|
|
13
|
-
children: /* @__PURE__ */ h(_, { className: "ttw:h-6 ttw:w-6 ttw:text-destructive" })
|
|
14
|
-
}),
|
|
15
|
-
/* @__PURE__ */ h("h3", {
|
|
16
|
-
className: "ttw:mb-2 ttw:text-lg ttw:font-bold ttw:tracking-tight ttw:text-foreground",
|
|
17
|
-
children: e.errorTitle
|
|
18
|
-
}),
|
|
19
|
-
/* @__PURE__ */ h("p", {
|
|
20
|
-
className: "ttw:max-w-sm ttw:text-sm ttw:text-muted-foreground",
|
|
21
|
-
children: e.errorDescription
|
|
22
|
-
})
|
|
23
|
-
]
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function D({ title: t, description: n, addLabel: r, onAdd: i, testId: a }) {
|
|
27
|
-
return /* @__PURE__ */ g("div", {
|
|
28
|
-
"data-testid": a,
|
|
29
|
-
className: "ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:px-4 ttw:py-14 ttw:text-center",
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ h("div", {
|
|
32
|
-
className: "ttw:mb-4 ttw:flex ttw:h-14 ttw:w-14 ttw:items-center ttw:justify-center ttw:rounded-2xl ttw:bg-muted",
|
|
33
|
-
children: /* @__PURE__ */ h(x, { className: "ttw:h-6 ttw:w-6 ttw:text-muted-foreground" })
|
|
34
|
-
}),
|
|
35
|
-
/* @__PURE__ */ h("h3", {
|
|
36
|
-
className: "ttw:mb-2 ttw:text-lg ttw:font-bold ttw:tracking-tight ttw:text-foreground",
|
|
37
|
-
children: t
|
|
38
|
-
}),
|
|
39
|
-
/* @__PURE__ */ h("p", {
|
|
40
|
-
className: "ttw:mb-6 ttw:max-w-sm ttw:text-sm ttw:text-muted-foreground",
|
|
41
|
-
children: n
|
|
42
|
-
}),
|
|
43
|
-
i && /* @__PURE__ */ g(e, {
|
|
44
|
-
onClick: i,
|
|
45
|
-
children: [/* @__PURE__ */ h(w, { className: "ttw:mr-1 ttw:h-4 ttw:w-4" }), r]
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function O({ labels: t, hasActions: n, children: r }) {
|
|
51
|
-
return /* @__PURE__ */ h("div", {
|
|
52
|
-
className: "ttw:overflow-hidden ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card",
|
|
53
|
-
children: /* @__PURE__ */ g(s, { children: [/* @__PURE__ */ h(d, { children: /* @__PURE__ */ g(f, { children: [
|
|
54
|
-
/* @__PURE__ */ h(u, { children: t.columnGlCode }),
|
|
55
|
-
/* @__PURE__ */ h(u, { children: /* @__PURE__ */ h(e, {
|
|
56
|
-
variant: "ghost",
|
|
57
|
-
disabled: !0,
|
|
58
|
-
className: "ttw:-ml-3",
|
|
59
|
-
children: t.columnName
|
|
60
|
-
}) }),
|
|
61
|
-
/* @__PURE__ */ h(u, { children: t.columnDescription }),
|
|
62
|
-
n && /* @__PURE__ */ h(u, {
|
|
63
|
-
className: "ttw:w-16 ttw:text-right",
|
|
64
|
-
children: t.columnActions
|
|
65
|
-
})
|
|
66
|
-
] }) }), /* @__PURE__ */ h(c, { children: r })] })
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function k({ data: s, isLoading: c, isError: u, sorting: d, onSortingChange: _, pageSize: x, onPageSizeChange: k, pageSizeOptions: A, hasNextPage: j, hasPrevPage: M, onNextPage: N, onPrevPage: P, labels: F, emptyStateTestId: I, onEdit: L, onDelete: R, onAdd: z }) {
|
|
70
|
-
let B = {
|
|
71
|
-
...p,
|
|
72
|
-
...F
|
|
73
|
-
}, V = !!(L ?? R), H = B.subtitle ? /* @__PURE__ */ h("div", {
|
|
9
|
+
function T({ data: T, isLoading: E, isError: D, sorting: O, onSortingChange: k, pageSize: A, onPageSizeChange: j, pageSizeOptions: M, hasNextPage: N, hasPrevPage: P, onNextPage: F, onPrevPage: I, labels: L, emptyStateTestId: R, onEdit: z, onDelete: B, onAdd: V }) {
|
|
10
|
+
let H = {
|
|
11
|
+
...h,
|
|
12
|
+
...L
|
|
13
|
+
}, U = !!(z ?? B), W = H.subtitle ? /* @__PURE__ */ _("div", {
|
|
74
14
|
className: "ttw:mb-4",
|
|
75
|
-
children: /* @__PURE__ */
|
|
15
|
+
children: /* @__PURE__ */ _("p", {
|
|
76
16
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
77
|
-
children:
|
|
17
|
+
children: H.subtitle
|
|
78
18
|
})
|
|
79
|
-
}) : null,
|
|
19
|
+
}) : null, G = T.length === 0 && !P, K = /* @__PURE__ */ v(g, { children: [W, V && !G && /* @__PURE__ */ _("div", {
|
|
80
20
|
className: "ttw:mb-4 ttw:flex ttw:items-center ttw:justify-end",
|
|
81
|
-
children: /* @__PURE__ */
|
|
82
|
-
onClick:
|
|
83
|
-
children:
|
|
21
|
+
children: /* @__PURE__ */ _(e, {
|
|
22
|
+
onClick: V,
|
|
23
|
+
children: H.addAccount
|
|
84
24
|
})
|
|
85
|
-
})] }),
|
|
25
|
+
})] }), q = (t) => t.is_external ? null : /* @__PURE__ */ _("div", {
|
|
26
|
+
className: "ttw:flex ttw:justify-end",
|
|
27
|
+
children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(d, { children: /* @__PURE__ */ v(l, { children: [/* @__PURE__ */ _(f, {
|
|
28
|
+
asChild: !0,
|
|
29
|
+
children: /* @__PURE__ */ _(c, {
|
|
30
|
+
asChild: !0,
|
|
31
|
+
children: /* @__PURE__ */ _(e, {
|
|
32
|
+
variant: "ghost",
|
|
33
|
+
size: "icon-sm",
|
|
34
|
+
"aria-label": H.openActionsMenu,
|
|
35
|
+
onClick: (e) => e.stopPropagation(),
|
|
36
|
+
children: /* @__PURE__ */ _(S, { className: "ttw:h-4 ttw:w-4" })
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
}), /* @__PURE__ */ _(u, { children: H.openActionsMenu })] }) }), /* @__PURE__ */ v(a, {
|
|
40
|
+
align: "end",
|
|
41
|
+
onClick: (e) => e.stopPropagation(),
|
|
42
|
+
children: [
|
|
43
|
+
z && /* @__PURE__ */ v(o, {
|
|
44
|
+
onClick: () => z(t),
|
|
45
|
+
children: [/* @__PURE__ */ _(C, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), H.actionEdit]
|
|
46
|
+
}),
|
|
47
|
+
z && B && /* @__PURE__ */ _(s, {}),
|
|
48
|
+
B && /* @__PURE__ */ v(o, {
|
|
49
|
+
variant: "destructive",
|
|
50
|
+
onClick: () => B(t),
|
|
51
|
+
children: [/* @__PURE__ */ _(w, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), H.actionDelete]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})] })
|
|
55
|
+
}), J = [
|
|
86
56
|
{
|
|
87
57
|
accessorKey: "nominal_code",
|
|
88
|
-
header:
|
|
58
|
+
header: H.columnGlCode,
|
|
59
|
+
meta: { fitContent: !0 }
|
|
89
60
|
},
|
|
90
61
|
{
|
|
91
62
|
accessorKey: "name",
|
|
92
63
|
enableSorting: !0,
|
|
93
64
|
header: ({ column: t }) => {
|
|
94
65
|
let n = t.getIsSorted();
|
|
95
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ v("div", {
|
|
96
67
|
className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
|
|
97
|
-
children: [
|
|
68
|
+
children: [H.columnName, /* @__PURE__ */ _(e, {
|
|
98
69
|
variant: "ghost",
|
|
99
|
-
"aria-label":
|
|
70
|
+
"aria-label": H.sortByName,
|
|
100
71
|
onClick: () => t.toggleSorting(n === "asc"),
|
|
101
|
-
children:
|
|
72
|
+
children: _(n === "asc" ? x : n === "desc" ? y : b, { className: "ttw:size-4" })
|
|
102
73
|
})]
|
|
103
74
|
});
|
|
104
75
|
}
|
|
105
76
|
},
|
|
106
77
|
{
|
|
107
78
|
accessorKey: "description",
|
|
108
|
-
header:
|
|
79
|
+
header: H.columnDescription,
|
|
80
|
+
cell: ({ row: e }) => /* @__PURE__ */ _("span", {
|
|
81
|
+
className: "ttw:block ttw:max-w-50 ttw:truncate",
|
|
82
|
+
title: e.original.description,
|
|
83
|
+
children: e.original.description
|
|
84
|
+
})
|
|
109
85
|
},
|
|
110
|
-
...
|
|
86
|
+
...U ? [{
|
|
111
87
|
id: "actions",
|
|
112
|
-
header: () => /* @__PURE__ */
|
|
88
|
+
header: () => /* @__PURE__ */ _("div", {
|
|
113
89
|
className: "ttw:flex ttw:justify-end",
|
|
114
|
-
children:
|
|
90
|
+
children: H.columnActions
|
|
115
91
|
}),
|
|
116
|
-
cell: ({ row:
|
|
117
|
-
|
|
118
|
-
children: /* @__PURE__ */ g(n, { children: [/* @__PURE__ */ h(a, {
|
|
119
|
-
asChild: !0,
|
|
120
|
-
children: /* @__PURE__ */ h(e, {
|
|
121
|
-
variant: "ghost",
|
|
122
|
-
size: "icon-sm",
|
|
123
|
-
"aria-label": B.openActionsMenu,
|
|
124
|
-
children: /* @__PURE__ */ h(S, { className: "ttw:h-4 ttw:w-4" })
|
|
125
|
-
})
|
|
126
|
-
}), /* @__PURE__ */ g(r, {
|
|
127
|
-
align: "end",
|
|
128
|
-
children: [L && /* @__PURE__ */ g(i, {
|
|
129
|
-
onClick: () => L(t.original),
|
|
130
|
-
children: [/* @__PURE__ */ h(C, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), B.actionEdit]
|
|
131
|
-
}), R && /* @__PURE__ */ g(i, {
|
|
132
|
-
variant: "destructive",
|
|
133
|
-
onClick: () => R(t.original),
|
|
134
|
-
children: [/* @__PURE__ */ h(T, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), B.actionDelete]
|
|
135
|
-
})]
|
|
136
|
-
})] })
|
|
137
|
-
})
|
|
92
|
+
cell: ({ row: e }) => q(e.original),
|
|
93
|
+
meta: { fitContent: !0 }
|
|
138
94
|
}] : []
|
|
139
|
-
]
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
columns: G,
|
|
159
|
-
data: s,
|
|
160
|
-
sorting: d,
|
|
161
|
-
onSortingChange: _,
|
|
162
|
-
pageSize: x,
|
|
163
|
-
onPageSizeChange: k,
|
|
164
|
-
pageSizeOptions: A,
|
|
165
|
-
hasNextPage: j,
|
|
166
|
-
hasPrevPage: M,
|
|
167
|
-
onNextPage: N,
|
|
168
|
-
onPrevPage: P,
|
|
95
|
+
], Y = z ? {
|
|
96
|
+
onRowClick: (e) => z(e),
|
|
97
|
+
rowAriaLabel: (e) => `${H.editAccount}: ${e.name}, ${e.nominal_code}`,
|
|
98
|
+
isRowActionable: (e) => !e.is_external
|
|
99
|
+
} : {};
|
|
100
|
+
return /* @__PURE__ */ v(g, { children: [K, /* @__PURE__ */ _(r, {
|
|
101
|
+
columns: J,
|
|
102
|
+
data: D ? [] : T,
|
|
103
|
+
sorting: O,
|
|
104
|
+
onSortingChange: k,
|
|
105
|
+
pageSize: A,
|
|
106
|
+
onPageSizeChange: j,
|
|
107
|
+
pageSizeOptions: M,
|
|
108
|
+
hasNextPage: N,
|
|
109
|
+
hasPrevPage: P,
|
|
110
|
+
onNextPage: F,
|
|
111
|
+
onPrevPage: I,
|
|
112
|
+
showPagination: T.length > 0 || !!P,
|
|
113
|
+
isLoading: !(!E || T.length !== 0 || D),
|
|
169
114
|
labels: {
|
|
170
|
-
|
|
171
|
-
|
|
115
|
+
loading: H.loading,
|
|
116
|
+
previousPage: H.paginationPrev,
|
|
117
|
+
nextPage: H.paginationNext
|
|
172
118
|
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
title: B.emptyTitle,
|
|
186
|
-
description: B.emptyDescription,
|
|
187
|
-
addLabel: B.addAccount,
|
|
188
|
-
onAdd: z,
|
|
189
|
-
testId: I
|
|
119
|
+
getRowId: (e) => e.id,
|
|
120
|
+
...Y,
|
|
121
|
+
rowContextMenu: (e) => !e.is_external && (z || B) ? /* @__PURE__ */ v(g, { children: [
|
|
122
|
+
z && /* @__PURE__ */ _(t, {
|
|
123
|
+
onClick: () => z(e),
|
|
124
|
+
children: H.actionEdit
|
|
125
|
+
}),
|
|
126
|
+
z && B && /* @__PURE__ */ _(n, {}),
|
|
127
|
+
B && /* @__PURE__ */ _(t, {
|
|
128
|
+
variant: "destructive",
|
|
129
|
+
onClick: () => B(e),
|
|
130
|
+
children: H.actionDelete
|
|
190
131
|
})
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
132
|
+
] }) : void 0,
|
|
133
|
+
renderCard: !D && T.length > 0 ? (e) => /* @__PURE__ */ v("div", {
|
|
134
|
+
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
135
|
+
children: [/* @__PURE__ */ v("div", {
|
|
136
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ _("span", {
|
|
139
|
+
className: "ttw:truncate ttw:font-medium",
|
|
140
|
+
title: e.name,
|
|
141
|
+
children: e.name
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ _("span", { children: e.nominal_code }),
|
|
144
|
+
/* @__PURE__ */ _("span", {
|
|
145
|
+
className: "ttw:truncate ttw:text-muted-foreground",
|
|
146
|
+
title: e.description,
|
|
147
|
+
children: e.description
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}), U && q(e)]
|
|
151
|
+
}) : void 0,
|
|
152
|
+
children: D ? /* @__PURE__ */ _(m, {
|
|
153
|
+
title: H.errorTitle,
|
|
154
|
+
description: H.errorDescription
|
|
155
|
+
}) : P ? /* @__PURE__ */ _(p, {
|
|
156
|
+
title: H.emptyPageTitle,
|
|
157
|
+
description: H.emptyPageDescription
|
|
158
|
+
}) : /* @__PURE__ */ _(p, {
|
|
159
|
+
title: H.emptyTitle,
|
|
160
|
+
description: H.emptyDescription,
|
|
161
|
+
actionLabel: H.addAccount,
|
|
162
|
+
onAction: V,
|
|
163
|
+
testId: R
|
|
164
|
+
})
|
|
208
165
|
})] });
|
|
209
166
|
}
|
|
210
|
-
export {
|
|
167
|
+
export { T as ChartOfAccountsTable, T as default };
|