@tesouro/embedded-components-react 0.5.203 → 0.5.205
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 +15 -14
- package/dist/index.css +9 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +2 -2
- package/dist/lib/ProductsWidget.d.ts +4 -0
- package/dist/lib/ProductsWidget.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +40 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +26 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +79 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +53 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +81 -283
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +47 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +303 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +68 -230
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +253 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +34 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +0 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +259 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +61 -412
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +407 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +73 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js +136 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js +5 -30
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js +9 -19
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js +22 -54
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index7.js +14 -40
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +57 -118
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index9.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +97 -93
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +35 -32
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +213 -202
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +136 -116
- 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/product-catalog/data-access/dist/index10.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +79 -70
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -107
- package/dist/packages/shared-ui-shadcn/dist/index.js +1763 -1749
- package/package.json +1 -1
|
@@ -2,125 +2,64 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "../../../shared/feature/dist/index.js";
|
|
8
|
-
import { ProductFormSheet as n } from "../../../shared/product-catalog/ui/dist/index3.js";
|
|
9
|
-
import { MeasureUnitsManagerContainer as r } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
5
|
+
import { buildProductRows as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
+
import { useProductsQuery as t } from "../../../shared/product-catalog/data-access/dist/index2.js";
|
|
10
7
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import { PAGE_SIZE_OPTIONS as o } from "./index3.js";
|
|
13
|
-
import { useProductsWidget as s } from "./index7.js";
|
|
14
|
-
import { ProductsScreen as c } from "../../ui/dist/index4.js";
|
|
15
|
-
import { ProductDetailsSheet as l } from "../../ui/dist/index5.js";
|
|
16
|
-
import { ProductDeleteDialog as u } from "../../ui/dist/index6.js";
|
|
17
|
-
import "../../ui/dist/index.js";
|
|
18
|
-
import { useEffect as d } from "react";
|
|
19
|
-
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
20
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js
|
|
21
|
-
function
|
|
22
|
-
let x =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
labels: h
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ p(l, {
|
|
77
|
-
open: S === "details",
|
|
78
|
-
onOpenChange: (e) => {
|
|
79
|
-
e || E.close();
|
|
80
|
-
},
|
|
81
|
-
product: T.detailsView,
|
|
82
|
-
isLoading: T.isLoading,
|
|
83
|
-
isError: T.isError,
|
|
84
|
-
onEdit: E.openEdit,
|
|
85
|
-
onDelete: D.requestDelete,
|
|
86
|
-
labels: g
|
|
87
|
-
}),
|
|
88
|
-
/* @__PURE__ */ p(u, {
|
|
89
|
-
open: D.open,
|
|
90
|
-
onOpenChange: D.onOpenChange,
|
|
91
|
-
productName: T.productName,
|
|
92
|
-
isDeleting: D.isDeleting,
|
|
93
|
-
onConfirm: D.confirm,
|
|
94
|
-
onCancel: D.cancel,
|
|
95
|
-
labels: _
|
|
96
|
-
}),
|
|
97
|
-
/* @__PURE__ */ p(r, {
|
|
98
|
-
open: O,
|
|
99
|
-
onClose: j,
|
|
100
|
-
managerLabels: v,
|
|
101
|
-
deleteLabels: y,
|
|
102
|
-
messageLabels: b
|
|
103
|
-
})
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
|
-
function g({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: m, providerLabels: g, ..._ }) {
|
|
107
|
-
return /* @__PURE__ */ p(t, {
|
|
108
|
-
widgetName: a,
|
|
109
|
-
baseUrl: e,
|
|
110
|
-
widgetToken: n,
|
|
111
|
-
organizationId: r,
|
|
112
|
-
configClient: i,
|
|
113
|
-
gatewayRouting: o,
|
|
114
|
-
linkComponent: s,
|
|
115
|
-
implementation: c,
|
|
116
|
-
uiFramework: l,
|
|
117
|
-
errorFallback: u,
|
|
118
|
-
onError: d,
|
|
119
|
-
analytics: f,
|
|
120
|
-
disclosuresAcceptance: m,
|
|
121
|
-
providerLabels: g,
|
|
122
|
-
children: /* @__PURE__ */ p(h, { ..._ })
|
|
123
|
-
});
|
|
10
|
+
function o({ unitNamesById: o, enabled: s = !0 }) {
|
|
11
|
+
let [c, l] = a([]), [u, d] = a(10), [f, p] = a(), [m, h] = a(""), [g, _] = a(""), [v, y] = a("all"), [b, x] = a("all");
|
|
12
|
+
r(() => {
|
|
13
|
+
let e = setTimeout(() => {
|
|
14
|
+
_(m), p(void 0);
|
|
15
|
+
}, 400);
|
|
16
|
+
return () => clearTimeout(e);
|
|
17
|
+
}, [m]);
|
|
18
|
+
let S = c[0]?.id === "name" ? "name" : void 0, C = c[0] ? c[0].desc ? "desc" : "asc" : void 0, w = t({
|
|
19
|
+
...S ? {
|
|
20
|
+
sort: S,
|
|
21
|
+
order: C
|
|
22
|
+
} : {},
|
|
23
|
+
limit: u,
|
|
24
|
+
pagination_token: f,
|
|
25
|
+
name__icontains: g || void 0,
|
|
26
|
+
type: v === "all" ? void 0 : v,
|
|
27
|
+
measure_unit_id: b === "all" ? void 0 : b,
|
|
28
|
+
enabled: s
|
|
29
|
+
}), T = i(() => e({
|
|
30
|
+
products: w.data?.data ?? [],
|
|
31
|
+
unitNamesById: o
|
|
32
|
+
}), [w.data, o]), E = !!g || v !== "all" || b !== "all", D = n((e) => {
|
|
33
|
+
let t = typeof e == "function" ? e(c) : e;
|
|
34
|
+
l(t), p(void 0);
|
|
35
|
+
}, [c]), O = n((e) => {
|
|
36
|
+
d(e), p(void 0);
|
|
37
|
+
}, []), k = n(() => p(w.data?.next_pagination_token ?? void 0), [w.data?.next_pagination_token]), A = n(() => p(w.data?.prev_pagination_token ?? void 0), [w.data?.prev_pagination_token]), j = n(() => {
|
|
38
|
+
w.refetch();
|
|
39
|
+
}, [w]), M = n((e) => (t) => {
|
|
40
|
+
e(t), p(void 0);
|
|
41
|
+
}, []);
|
|
42
|
+
return {
|
|
43
|
+
rows: T,
|
|
44
|
+
isLoading: w.isLoading,
|
|
45
|
+
isError: w.isError,
|
|
46
|
+
sorting: c,
|
|
47
|
+
onSortingChange: D,
|
|
48
|
+
pageSize: u,
|
|
49
|
+
onPageSizeChange: O,
|
|
50
|
+
hasNextPage: !!w.data?.next_pagination_token,
|
|
51
|
+
hasPrevPage: !!w.data?.prev_pagination_token,
|
|
52
|
+
onNextPage: k,
|
|
53
|
+
onPrevPage: A,
|
|
54
|
+
searchValue: m,
|
|
55
|
+
onSearchChange: h,
|
|
56
|
+
typeFilter: v,
|
|
57
|
+
onTypeFilterChange: M(y),
|
|
58
|
+
unitFilter: b,
|
|
59
|
+
onUnitFilterChange: M(x),
|
|
60
|
+
isFiltering: E,
|
|
61
|
+
onRetry: j
|
|
62
|
+
};
|
|
124
63
|
}
|
|
125
64
|
//#endregion
|
|
126
|
-
export {
|
|
65
|
+
export { o as useProductsTable };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useRefetchWidget as e, useWidgetConfig as t, useWidgetError as n, useWidgetInitStaleForToken as r, useWidgetLoading as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
6
|
+
import "../../../shared/feature/dist/index.js";
|
|
7
|
+
import { PRODUCT_MESSAGE_LABELS_EN as a } from "../../../shared/product-catalog/feature/dist/lib/labels.js";
|
|
8
|
+
import { hasSelectedText as o } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
9
|
+
import { useMeasureUnits as s } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
10
|
+
import { useProductForm as c } from "../../../shared/product-catalog/feature/dist/lib/useProductForm.js";
|
|
11
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
12
|
+
import { getProductPermissions as l } from "./index5.js";
|
|
13
|
+
import { useProductDelete as u } from "./index6.js";
|
|
14
|
+
import { useProductDetails as d } from "./index7.js";
|
|
15
|
+
import { useProductsTable as f } from "./index8.js";
|
|
16
|
+
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
17
|
+
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index9.js
|
|
18
|
+
function g({ messageLabels: g }) {
|
|
19
|
+
let _ = m(() => ({
|
|
20
|
+
...a,
|
|
21
|
+
...g
|
|
22
|
+
}), [g]), { initResponse: v, widgetToken: y } = t(), b = i(), x = n(), S = r(), C = e(), w = m(() => l(S ? void 0 : v?.scopes), [S, v?.scopes]), T = !(!y || v || x) || b && !v || S, E = !!x && (!v || S), [D, O] = h("none"), [k, A] = h(), [j, M] = h(!1), N = s({ enabled: w.canRead }), P = f({
|
|
23
|
+
unitNamesById: N.unitNamesById,
|
|
24
|
+
enabled: w.canRead
|
|
25
|
+
}), F = d({
|
|
26
|
+
selectedProductId: k,
|
|
27
|
+
unitNamesById: N.unitNamesById,
|
|
28
|
+
enabled: w.canRead
|
|
29
|
+
}), I = c({
|
|
30
|
+
view: D,
|
|
31
|
+
setView: O,
|
|
32
|
+
selectedProductId: k,
|
|
33
|
+
setSelectedProductId: A,
|
|
34
|
+
product: F.product,
|
|
35
|
+
messages: _
|
|
36
|
+
}), L = u({
|
|
37
|
+
selectedProductId: k,
|
|
38
|
+
setSelectedProductId: A,
|
|
39
|
+
setView: O
|
|
40
|
+
});
|
|
41
|
+
if (!S) {
|
|
42
|
+
let { canRead: e, canCreate: t, canUpdate: n, canDelete: r } = w;
|
|
43
|
+
(!e && (D !== "none" || k) || D === "create" && !t || D === "edit" && !n) && (O("none"), A(void 0)), L.open && !(e && r) && L.cancel(), j && !(e && t) && M(!1);
|
|
44
|
+
}
|
|
45
|
+
let R = p((e) => {
|
|
46
|
+
w.canRead && !o() && (A(e.id), O("details"));
|
|
47
|
+
}, [w.canRead]), z = p(() => {
|
|
48
|
+
w.canCreate && M(!0);
|
|
49
|
+
}, [w.canCreate]), B = p(() => M(!1), []), V = p(() => S ? void 0 : I.submit(), [S, I.submit]), H = p(() => S ? void 0 : L.confirm(), [S, L.confirm]);
|
|
50
|
+
return {
|
|
51
|
+
view: D,
|
|
52
|
+
units: N,
|
|
53
|
+
table: P,
|
|
54
|
+
details: F,
|
|
55
|
+
form: I,
|
|
56
|
+
del: L,
|
|
57
|
+
permissions: w,
|
|
58
|
+
isPermissionLoading: T,
|
|
59
|
+
isTableLoading: P.isLoading || T && P.rows.length === 0,
|
|
60
|
+
hasInitError: E,
|
|
61
|
+
refetchWidgetInit: C,
|
|
62
|
+
measureUnitsOpen: j,
|
|
63
|
+
actionsSuspended: S,
|
|
64
|
+
handleRowClick: R,
|
|
65
|
+
openMeasureUnits: z,
|
|
66
|
+
closeMeasureUnits: B,
|
|
67
|
+
submitForm: V,
|
|
68
|
+
confirmDelete: H
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { g as useProductsWidget };
|
|
@@ -23,6 +23,8 @@ var e = {
|
|
|
23
23
|
errorTitle: "Failed to load products",
|
|
24
24
|
errorDescription: "Something went wrong while fetching your products. Please try again.",
|
|
25
25
|
errorRetry: "Try again",
|
|
26
|
+
accessRestrictedTitle: "Access restricted",
|
|
27
|
+
accessRestrictedDescription: "You don't have permission to view products.",
|
|
26
28
|
openRow: (e) => `View product — ${e}`,
|
|
27
29
|
typeBadge: {
|
|
28
30
|
product: "Product",
|
|
@@ -4,104 +4,107 @@ import { ErrorState as d } from "../../../shared/ui/dist/lib/ErrorState/ErrorSta
|
|
|
4
4
|
import "../../../shared/ui/dist/index.js";
|
|
5
5
|
import { PRODUCTS_SCREEN_LABELS_EN as f } from "./index2.js";
|
|
6
6
|
import { ProductTypeBadge as p } from "./index3.js";
|
|
7
|
-
import {
|
|
8
|
-
import { ArrowDownIcon as
|
|
7
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { ArrowDownIcon as _, ArrowUpDownIcon as v, ArrowUpIcon as y, Plus as b, Search as x } from "lucide-react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js
|
|
10
|
-
var
|
|
10
|
+
var S = [
|
|
11
11
|
10,
|
|
12
12
|
25,
|
|
13
13
|
50,
|
|
14
14
|
100
|
|
15
|
-
],
|
|
16
|
-
function
|
|
17
|
-
return /* @__PURE__ */
|
|
15
|
+
], C = "all";
|
|
16
|
+
function w({ labels: e, searchValue: t, onSearchChange: u, typeFilter: d, onTypeFilterChange: f, unitFilter: p, onUnitFilterChange: m, unitOptions: _, headerActions: v }) {
|
|
17
|
+
return /* @__PURE__ */ g("div", {
|
|
18
18
|
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2 ttw:px-4",
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ g(n, {
|
|
21
21
|
className: "ttw:w-80",
|
|
22
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ h(r, {
|
|
23
23
|
align: "inline-start",
|
|
24
|
-
children: /* @__PURE__ */
|
|
25
|
-
}), /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ h(x, { className: "ttw:size-4" })
|
|
25
|
+
}), /* @__PURE__ */ h(i, {
|
|
26
26
|
"data-has-start-addon": !0,
|
|
27
27
|
placeholder: e.searchPlaceholder,
|
|
28
28
|
value: t,
|
|
29
29
|
onChange: (e) => u(e.target.value)
|
|
30
30
|
})]
|
|
31
31
|
}),
|
|
32
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ g(a, {
|
|
33
33
|
value: d,
|
|
34
34
|
onValueChange: f,
|
|
35
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ h(c, {
|
|
36
36
|
className: "ttw:w-44",
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
-
}), /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
value:
|
|
37
|
+
children: /* @__PURE__ */ h(l, {})
|
|
38
|
+
}), /* @__PURE__ */ g(o, { children: [
|
|
39
|
+
/* @__PURE__ */ h(s, {
|
|
40
|
+
value: C,
|
|
41
41
|
children: e.typeFilterAll
|
|
42
42
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ h(s, {
|
|
44
44
|
value: "product",
|
|
45
45
|
children: e.typeFilterProduct
|
|
46
46
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ h(s, {
|
|
48
48
|
value: "service",
|
|
49
49
|
children: e.typeFilterService
|
|
50
50
|
})
|
|
51
51
|
] })]
|
|
52
52
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
children:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
/* @__PURE__ */ g("div", {
|
|
54
|
+
className: "ttw:ml-auto ttw:flex ttw:items-center ttw:gap-2",
|
|
55
|
+
children: [/* @__PURE__ */ g(a, {
|
|
56
|
+
value: p,
|
|
57
|
+
onValueChange: m,
|
|
58
|
+
children: [/* @__PURE__ */ h(c, {
|
|
59
|
+
className: "ttw:w-44",
|
|
60
|
+
children: /* @__PURE__ */ h(l, {})
|
|
61
|
+
}), /* @__PURE__ */ g(o, { children: [/* @__PURE__ */ h(s, {
|
|
62
|
+
value: C,
|
|
63
|
+
children: e.unitFilterAll
|
|
64
|
+
}), _.map((e) => /* @__PURE__ */ h(s, {
|
|
65
|
+
value: e.value,
|
|
66
|
+
children: e.label
|
|
67
|
+
}, e.value))] })]
|
|
68
|
+
}), v]
|
|
66
69
|
})
|
|
67
70
|
]
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
|
-
function
|
|
71
|
-
let
|
|
73
|
+
function T({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange: o, pageSize: s, onPageSizeChange: c, pageSizeOptions: l = S, hasNextPage: x, hasPrevPage: C, onNextPage: T, onPrevPage: E, searchValue: D, onSearchChange: O, typeFilter: k, onTypeFilterChange: A, unitFilter: j, onUnitFilterChange: M, unitOptions: N, isFiltering: P, onCreateClick: F, onManageUnitsClick: I, onRowClick: L, onRetry: R, canCreate: z = !0, canManageUnits: B = !0, isAccessRestricted: V, labels: H, testIds: U }) {
|
|
74
|
+
let W = {
|
|
72
75
|
...f,
|
|
73
|
-
...
|
|
74
|
-
},
|
|
76
|
+
...H
|
|
77
|
+
}, G = [
|
|
75
78
|
{
|
|
76
79
|
accessorKey: "name",
|
|
77
80
|
enableSorting: !0,
|
|
78
81
|
header: ({ column: t }) => {
|
|
79
82
|
let n = t.getIsSorted();
|
|
80
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ g("div", {
|
|
81
84
|
className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
|
|
82
|
-
children: [
|
|
85
|
+
children: [W.columnName, /* @__PURE__ */ h(e, {
|
|
83
86
|
variant: "ghost",
|
|
84
87
|
size: "icon-sm",
|
|
85
88
|
onClick: () => t.toggleSorting(n === "asc"),
|
|
86
|
-
children:
|
|
89
|
+
children: h(n === "asc" ? y : n === "desc" ? _ : v, { className: "ttw:size-4" })
|
|
87
90
|
})]
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
93
|
},
|
|
91
94
|
{
|
|
92
95
|
accessorKey: "type",
|
|
93
|
-
header:
|
|
94
|
-
cell: ({ row: e }) => e.original.type ? /* @__PURE__ */
|
|
96
|
+
header: W.columnType,
|
|
97
|
+
cell: ({ row: e }) => e.original.type ? /* @__PURE__ */ h(p, {
|
|
95
98
|
type: e.original.type,
|
|
96
|
-
labels:
|
|
99
|
+
labels: W.typeBadge
|
|
97
100
|
}) : null
|
|
98
101
|
},
|
|
99
102
|
{
|
|
100
103
|
accessorKey: "description",
|
|
101
|
-
header:
|
|
102
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
104
|
+
header: W.columnDescription,
|
|
105
|
+
cell: ({ row: e }) => /* @__PURE__ */ h("div", {
|
|
103
106
|
className: "ttw:w-120",
|
|
104
|
-
children: /* @__PURE__ */
|
|
107
|
+
children: /* @__PURE__ */ h("span", {
|
|
105
108
|
className: "ttw:w-full ttw:inline-block ttw:truncate",
|
|
106
109
|
children: e.original.description
|
|
107
110
|
})
|
|
@@ -109,42 +112,42 @@ function w({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange:
|
|
|
109
112
|
},
|
|
110
113
|
{
|
|
111
114
|
accessorKey: "priceLabel",
|
|
112
|
-
header: () => /* @__PURE__ */
|
|
115
|
+
header: () => /* @__PURE__ */ h("div", {
|
|
113
116
|
className: "ttw:text-right",
|
|
114
|
-
children:
|
|
117
|
+
children: W.columnPrice
|
|
115
118
|
}),
|
|
116
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
119
|
+
cell: ({ row: e }) => /* @__PURE__ */ g("div", {
|
|
117
120
|
className: "ttw:flex ttw:justify-end ttw:items-center ttw:gap-1",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ h("span", { children: e.original.priceLabel }), e.original.unitLabel && /* @__PURE__ */ h("span", {
|
|
119
122
|
className: "ttw:text-muted-foreground ttw:text-xs",
|
|
120
123
|
children: e.original.unitLabel
|
|
121
124
|
})]
|
|
122
125
|
})
|
|
123
126
|
}
|
|
124
|
-
]
|
|
127
|
+
], K = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(e, {
|
|
128
|
+
variant: "ghost",
|
|
129
|
+
className: "ttw:text-primary ttw:hover:text-primary",
|
|
130
|
+
onClick: I,
|
|
131
|
+
disabled: !B,
|
|
132
|
+
children: W.manageUnitsButton
|
|
133
|
+
}), /* @__PURE__ */ g(e, {
|
|
134
|
+
onClick: F,
|
|
135
|
+
disabled: !z,
|
|
136
|
+
children: [/* @__PURE__ */ h(b, { className: "ttw:size-4" }), W.createButton]
|
|
137
|
+
})] });
|
|
125
138
|
return /* @__PURE__ */ h("div", {
|
|
126
139
|
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
127
|
-
children:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
children: [/* @__PURE__ */ m(y, { className: "ttw:size-4" }), B.createButton]
|
|
139
|
-
})]
|
|
140
|
-
})
|
|
141
|
-
}), i ? /* @__PURE__ */ m(d, {
|
|
142
|
-
title: B.errorTitle,
|
|
143
|
-
description: B.errorDescription,
|
|
144
|
-
retryLabel: L ? B.errorRetry : void 0,
|
|
145
|
-
onRetry: L
|
|
146
|
-
}) : /* @__PURE__ */ m(t, {
|
|
147
|
-
columns: V,
|
|
140
|
+
children: V ? /* @__PURE__ */ h(d, {
|
|
141
|
+
testId: U?.accessRestricted,
|
|
142
|
+
title: W.accessRestrictedTitle,
|
|
143
|
+
description: W.accessRestrictedDescription
|
|
144
|
+
}) : i ? /* @__PURE__ */ h(d, {
|
|
145
|
+
title: W.errorTitle,
|
|
146
|
+
description: W.errorDescription,
|
|
147
|
+
retryLabel: R ? W.errorRetry : void 0,
|
|
148
|
+
onRetry: R
|
|
149
|
+
}) : /* @__PURE__ */ h(t, {
|
|
150
|
+
columns: G,
|
|
148
151
|
data: n,
|
|
149
152
|
isLoading: r,
|
|
150
153
|
sorting: a,
|
|
@@ -152,31 +155,32 @@ function w({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange:
|
|
|
152
155
|
pageSize: s,
|
|
153
156
|
onPageSizeChange: c,
|
|
154
157
|
pageSizeOptions: l,
|
|
155
|
-
hasNextPage:
|
|
156
|
-
hasPrevPage:
|
|
157
|
-
onNextPage:
|
|
158
|
-
onPrevPage:
|
|
159
|
-
onRowClick:
|
|
160
|
-
rowAriaLabel: (e) =>
|
|
161
|
-
filterComponent: /* @__PURE__ */
|
|
162
|
-
labels:
|
|
163
|
-
searchValue:
|
|
164
|
-
onSearchChange:
|
|
165
|
-
typeFilter:
|
|
166
|
-
onTypeFilterChange:
|
|
167
|
-
unitFilter:
|
|
168
|
-
onUnitFilterChange:
|
|
169
|
-
unitOptions:
|
|
158
|
+
hasNextPage: x,
|
|
159
|
+
hasPrevPage: C,
|
|
160
|
+
onNextPage: T,
|
|
161
|
+
onPrevPage: E,
|
|
162
|
+
onRowClick: L,
|
|
163
|
+
rowAriaLabel: (e) => W.openRow(e.name),
|
|
164
|
+
filterComponent: /* @__PURE__ */ h(w, {
|
|
165
|
+
labels: W,
|
|
166
|
+
searchValue: D,
|
|
167
|
+
onSearchChange: O,
|
|
168
|
+
typeFilter: k,
|
|
169
|
+
onTypeFilterChange: A,
|
|
170
|
+
unitFilter: j,
|
|
171
|
+
onUnitFilterChange: M,
|
|
172
|
+
unitOptions: N,
|
|
173
|
+
headerActions: K
|
|
170
174
|
}),
|
|
171
|
-
children: /* @__PURE__ */
|
|
172
|
-
testId:
|
|
173
|
-
title:
|
|
174
|
-
description:
|
|
175
|
-
actionLabel:
|
|
176
|
-
onAction:
|
|
175
|
+
children: /* @__PURE__ */ h(u, {
|
|
176
|
+
testId: U?.empty,
|
|
177
|
+
title: P ? W.filterEmptyTitle : W.emptyTitle,
|
|
178
|
+
description: P ? W.filterEmptyDescription : W.emptyDescription,
|
|
179
|
+
actionLabel: P || !z ? void 0 : W.emptyAction,
|
|
180
|
+
onAction: P || !z ? void 0 : F
|
|
177
181
|
})
|
|
178
|
-
})
|
|
182
|
+
})
|
|
179
183
|
});
|
|
180
184
|
}
|
|
181
185
|
//#endregion
|
|
182
|
-
export {
|
|
186
|
+
export { T as ProductsScreen, T as default };
|