@nice2dev/ui-erp 1.0.17 → 1.0.18
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/index.cjs +100 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +100 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
2
|
import { ForwardRefExoticComponent } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { NiceStandardProps } from '@nice2dev/ui-core';
|
|
4
4
|
import { RefAttributes } from 'react';
|
|
5
5
|
|
|
6
6
|
export declare interface Address {
|
|
@@ -232,7 +232,7 @@ export declare const NICE_VAT_PRESETS: Record<'PL' | 'EU' | 'UK', VatRate[]>;
|
|
|
232
232
|
|
|
233
233
|
export declare const NiceHRDashboard: default_2.ForwardRefExoticComponent<NiceHRDashboardProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
234
234
|
|
|
235
|
-
export declare interface NiceHRDashboardProps extends
|
|
235
|
+
export declare interface NiceHRDashboardProps extends NiceStandardProps {
|
|
236
236
|
employees: Employee[];
|
|
237
237
|
/** Custom widget labels. */
|
|
238
238
|
labels?: Partial<{
|
|
@@ -277,7 +277,7 @@ export declare interface NiceInventoryManagerProps {
|
|
|
277
277
|
|
|
278
278
|
export declare const NiceInvoiceView: default_2.ForwardRefExoticComponent<NiceInvoiceViewProps & default_2.RefAttributes<HTMLElement>>;
|
|
279
279
|
|
|
280
|
-
export declare interface NiceInvoiceViewProps extends
|
|
280
|
+
export declare interface NiceInvoiceViewProps extends NiceStandardProps {
|
|
281
281
|
invoice: Invoice;
|
|
282
282
|
/** Locale for formatting amounts and dates. */
|
|
283
283
|
locale?: string;
|
|
@@ -324,7 +324,7 @@ export declare interface NiceInvoiceViewProps extends NiceBaseProps {
|
|
|
324
324
|
|
|
325
325
|
export declare const NiceJpkExporter: ForwardRefExoticComponent<NiceJpkExporterProps & RefAttributes<HTMLDivElement>>;
|
|
326
326
|
|
|
327
|
-
export declare interface NiceJpkExporterProps extends
|
|
327
|
+
export declare interface NiceJpkExporterProps extends NiceStandardProps {
|
|
328
328
|
invoices: Invoice[];
|
|
329
329
|
taxpayer: JpkExportOptions['taxpayer'];
|
|
330
330
|
/** Default export format. */
|
|
@@ -369,7 +369,7 @@ export declare interface NicePurchaseOrderProps {
|
|
|
369
369
|
className?: string;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
export declare interface NicePurchaseOrderViewProps extends NicePurchaseOrderProps,
|
|
372
|
+
export declare interface NicePurchaseOrderViewProps extends NicePurchaseOrderProps, NiceStandardProps {
|
|
373
373
|
/** Show in list+detail master/detail mode (default `true`). */
|
|
374
374
|
selectable?: boolean;
|
|
375
375
|
/** Initial selection. */
|
|
@@ -416,7 +416,7 @@ export declare interface NiceResourceAllocationProps {
|
|
|
416
416
|
|
|
417
417
|
export declare const NiceVatTable: ForwardRefExoticComponent<NiceVatTableProps & RefAttributes<HTMLDivElement>>;
|
|
418
418
|
|
|
419
|
-
export declare interface NiceVatTableProps extends
|
|
419
|
+
export declare interface NiceVatTableProps extends NiceStandardProps {
|
|
420
420
|
/** Country/preset (used when `rates` not supplied). */
|
|
421
421
|
country?: 'PL' | 'EU' | 'UK';
|
|
422
422
|
/** Explicit rates (override preset). */
|
|
@@ -444,7 +444,7 @@ export declare interface NiceVatTableProps extends NiceBaseProps {
|
|
|
444
444
|
|
|
445
445
|
export declare const NiceWarehouseView: default_2.ForwardRefExoticComponent<NiceWarehouseViewProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
446
446
|
|
|
447
|
-
export declare interface NiceWarehouseViewProps extends
|
|
447
|
+
export declare interface NiceWarehouseViewProps extends NiceStandardProps {
|
|
448
448
|
/** Warehouse identifier (used in the title). */
|
|
449
449
|
warehouseName: string;
|
|
450
450
|
/** Cells to render. */
|
package/dist/index.mjs
CHANGED
|
@@ -1284,14 +1284,28 @@ function lineVat(line) {
|
|
|
1284
1284
|
function fmtMoney$1(amount, currency, locale) {
|
|
1285
1285
|
const code = typeof currency === "string" ? currency : currency.code;
|
|
1286
1286
|
const decimals = typeof currency === "string" ? 2 : currency.decimalPlaces ?? 2;
|
|
1287
|
-
return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(
|
|
1287
|
+
return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(
|
|
1288
|
+
amount / Math.pow(10, decimals)
|
|
1289
|
+
);
|
|
1288
1290
|
}
|
|
1289
1291
|
function fmtDate$1(d, locale) {
|
|
1290
1292
|
const dt = d instanceof Date ? d : new Date(d);
|
|
1291
1293
|
return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(dt);
|
|
1292
1294
|
}
|
|
1293
1295
|
const NiceInvoiceView = forwardRef(
|
|
1294
|
-
function NiceInvoiceView2({
|
|
1296
|
+
function NiceInvoiceView2({
|
|
1297
|
+
invoice,
|
|
1298
|
+
locale,
|
|
1299
|
+
currency,
|
|
1300
|
+
hideSections,
|
|
1301
|
+
labels,
|
|
1302
|
+
onAction,
|
|
1303
|
+
showActions = false,
|
|
1304
|
+
density = "comfortable",
|
|
1305
|
+
className,
|
|
1306
|
+
style,
|
|
1307
|
+
id
|
|
1308
|
+
}, ref) {
|
|
1295
1309
|
var _a;
|
|
1296
1310
|
const cur = currency ?? invoice.currency ?? ((_a = invoice.lines[0]) == null ? void 0 : _a.unitPrice.currency) ?? "EUR";
|
|
1297
1311
|
const L = {
|
|
@@ -1360,11 +1374,18 @@ const NiceInvoiceView = forwardRef(
|
|
|
1360
1374
|
] })
|
|
1361
1375
|
] })
|
|
1362
1376
|
] }),
|
|
1363
|
-
/* @__PURE__ */ jsxs(
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1377
|
+
/* @__PURE__ */ jsxs(
|
|
1378
|
+
"div",
|
|
1379
|
+
{
|
|
1380
|
+
className: "nice-invoice-view__status",
|
|
1381
|
+
style: { color: STATUS_COLOR[invoice.status] },
|
|
1382
|
+
children: [
|
|
1383
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "●" }),
|
|
1384
|
+
" ",
|
|
1385
|
+
invoice.status
|
|
1386
|
+
]
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1368
1389
|
showActions && /* @__PURE__ */ jsxs("div", { className: "nice-invoice-view__actions", children: [
|
|
1369
1390
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onAction == null ? void 0 : onAction("download"), children: "↓" }),
|
|
1370
1391
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onAction == null ? void 0 : onAction("print"), children: "⎙" }),
|
|
@@ -1457,7 +1478,14 @@ const NiceInvoiceView = forwardRef(
|
|
|
1457
1478
|
/* @__PURE__ */ jsx("h4", { children: L.timeline }),
|
|
1458
1479
|
/* @__PURE__ */ jsx("ol", { children: invoice.history.map((h, i) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1459
1480
|
/* @__PURE__ */ jsx("span", { className: "nice-invoice-view__t-date", children: fmtDate$1(h.at, locale) }),
|
|
1460
|
-
/* @__PURE__ */ jsx(
|
|
1481
|
+
/* @__PURE__ */ jsx(
|
|
1482
|
+
"span",
|
|
1483
|
+
{
|
|
1484
|
+
className: "nice-invoice-view__t-status",
|
|
1485
|
+
style: { color: STATUS_COLOR[h.status] },
|
|
1486
|
+
children: h.status
|
|
1487
|
+
}
|
|
1488
|
+
),
|
|
1461
1489
|
h.note && /* @__PURE__ */ jsxs("span", { className: "nice-invoice-view__t-note", children: [
|
|
1462
1490
|
" — ",
|
|
1463
1491
|
h.note
|
|
@@ -1748,7 +1776,17 @@ const NicePurchaseOrder = forwardRef(
|
|
|
1748
1776
|
}
|
|
1749
1777
|
);
|
|
1750
1778
|
const NiceHRDashboard = forwardRef(
|
|
1751
|
-
function NiceHRDashboard2({
|
|
1779
|
+
function NiceHRDashboard2({
|
|
1780
|
+
employees,
|
|
1781
|
+
labels,
|
|
1782
|
+
hideWidgets,
|
|
1783
|
+
locale,
|
|
1784
|
+
density = "comfortable",
|
|
1785
|
+
onWidgetClick,
|
|
1786
|
+
className,
|
|
1787
|
+
style,
|
|
1788
|
+
id
|
|
1789
|
+
}, ref) {
|
|
1752
1790
|
const L = {
|
|
1753
1791
|
headcount: "Headcount",
|
|
1754
1792
|
fte: "FTE",
|
|
@@ -1768,7 +1806,14 @@ const NiceHRDashboard = forwardRef(
|
|
|
1768
1806
|
const k = e.department ?? "—";
|
|
1769
1807
|
byDepartment.set(k, (byDepartment.get(k) ?? 0) + 1);
|
|
1770
1808
|
}
|
|
1771
|
-
return {
|
|
1809
|
+
return {
|
|
1810
|
+
headcount: employees.length,
|
|
1811
|
+
active: active.length,
|
|
1812
|
+
fte,
|
|
1813
|
+
vacationAvg,
|
|
1814
|
+
sickAvg,
|
|
1815
|
+
byDepartment
|
|
1816
|
+
};
|
|
1772
1817
|
}, [employees]);
|
|
1773
1818
|
const fmt = (n, d = 1) => n.toLocaleString(locale, { maximumFractionDigits: d });
|
|
1774
1819
|
const Widget = ({ kind, label, value, hint }) => /* @__PURE__ */ jsxs(
|
|
@@ -1784,25 +1829,51 @@ const NiceHRDashboard = forwardRef(
|
|
|
1784
1829
|
]
|
|
1785
1830
|
}
|
|
1786
1831
|
);
|
|
1787
|
-
return /* @__PURE__ */ jsxs(
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1832
|
+
return /* @__PURE__ */ jsxs(
|
|
1833
|
+
"div",
|
|
1834
|
+
{
|
|
1835
|
+
ref,
|
|
1836
|
+
id,
|
|
1837
|
+
className: `nice-hr-dashboard nice-hr-dashboard--${density} ${className ?? ""}`,
|
|
1838
|
+
style,
|
|
1839
|
+
role: "group",
|
|
1840
|
+
"aria-label": "HR dashboard",
|
|
1841
|
+
children: [
|
|
1842
|
+
!(hideWidgets == null ? void 0 : hideWidgets.headcount) && /* @__PURE__ */ jsx(
|
|
1843
|
+
Widget,
|
|
1844
|
+
{
|
|
1845
|
+
kind: "headcount",
|
|
1846
|
+
label: L.headcount,
|
|
1847
|
+
value: fmt(stats.headcount, 0),
|
|
1848
|
+
hint: `${L.activeEmployees}: ${fmt(stats.active, 0)}`
|
|
1849
|
+
}
|
|
1850
|
+
),
|
|
1851
|
+
!(hideWidgets == null ? void 0 : hideWidgets.fte) && /* @__PURE__ */ jsx(Widget, { kind: "fte", label: L.fte, value: fmt(stats.fte, 2) }),
|
|
1852
|
+
!(hideWidgets == null ? void 0 : hideWidgets.vacation) && /* @__PURE__ */ jsx(
|
|
1853
|
+
Widget,
|
|
1854
|
+
{
|
|
1855
|
+
kind: "vacation",
|
|
1856
|
+
label: L.vacationBalance,
|
|
1857
|
+
value: `${fmt(stats.vacationAvg, 1)} d`
|
|
1858
|
+
}
|
|
1859
|
+
),
|
|
1860
|
+
!(hideWidgets == null ? void 0 : hideWidgets.sick) && /* @__PURE__ */ jsx(Widget, { kind: "sick", label: L.sickLeave, value: `${fmt(stats.sickAvg, 1)} d` }),
|
|
1861
|
+
!(hideWidgets == null ? void 0 : hideWidgets.departments) && /* @__PURE__ */ jsx(
|
|
1862
|
+
Widget,
|
|
1863
|
+
{
|
|
1864
|
+
kind: "departments",
|
|
1865
|
+
label: L.departments,
|
|
1866
|
+
value: fmt(stats.byDepartment.size, 0),
|
|
1867
|
+
hint: /* @__PURE__ */ jsx("ul", { className: "nice-hr-dashboard__dept-list", children: [...stats.byDepartment.entries()].slice(0, 5).map(([d, n]) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1868
|
+
d,
|
|
1869
|
+
": ",
|
|
1870
|
+
n
|
|
1871
|
+
] }, d)) })
|
|
1872
|
+
}
|
|
1873
|
+
)
|
|
1874
|
+
]
|
|
1875
|
+
}
|
|
1876
|
+
);
|
|
1806
1877
|
}
|
|
1807
1878
|
);
|
|
1808
1879
|
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|