@inventreedb/ui 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/.vite/manifest.json +444 -1
- package/dist/components/Boundary.d.ts +10 -0
- package/dist/components/Boundary.js +37 -0
- package/dist/components/Boundary.js.map +1 -0
- package/dist/components/CopyButton.d.ts +13 -0
- package/dist/components/CopyButton.js +51 -0
- package/dist/components/CopyButton.js.map +1 -0
- package/dist/components/CopyableCell.d.ts +11 -0
- package/dist/components/CopyableCell.js +24 -0
- package/dist/components/CopyableCell.js.map +1 -0
- package/dist/components/InvenTreeTable.d.ts +17 -0
- package/dist/components/InvenTreeTable.js +41 -0
- package/dist/components/InvenTreeTable.js.map +1 -0
- package/dist/components/TableColumnSelect.d.ts +4 -0
- package/dist/components/TableColumnSelect.js +38 -0
- package/dist/components/TableColumnSelect.js.map +1 -0
- package/dist/enums/ApiEndpoints.d.ts +1 -1
- package/dist/enums/ApiEndpoints.js +1 -1
- package/dist/enums/ApiEndpoints.js.map +1 -1
- package/dist/enums/ModelInformation.js +17 -0
- package/dist/enums/ModelInformation.js.map +1 -1
- package/dist/enums/ModelType.d.ts +1 -0
- package/dist/enums/ModelType.js +1 -0
- package/dist/enums/ModelType.js.map +1 -1
- package/dist/functions/Forms.d.ts +11 -0
- package/dist/functions/Forms.js +27 -0
- package/dist/functions/Forms.js.map +1 -0
- package/dist/functions/Notification.d.ts +16 -0
- package/dist/functions/Notification.js +82 -0
- package/dist/functions/Notification.js.map +1 -0
- package/dist/functions/String.d.ts +13 -0
- package/dist/functions/String.js +25 -0
- package/dist/functions/String.js.map +1 -0
- package/dist/hooks/UseFilterSet.d.ts +2 -0
- package/dist/hooks/UseFilterSet.js +35 -0
- package/dist/hooks/UseFilterSet.js.map +1 -0
- package/dist/hooks/UseTable.d.ts +12 -0
- package/dist/hooks/UseTable.js +92 -0
- package/dist/hooks/UseTable.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js +129 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js +8 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js +11 -0
- package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js +7 -0
- package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js.map +1 -0
- package/dist/node_modules/@remix-run/router/dist/router.js +272 -0
- package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js +5 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js +6 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js +54 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/api.js +41 -0
- package/dist/node_modules/@sentry/core/build/esm/api.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js +124 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/carrier.js +22 -0
- package/dist/node_modules/@sentry/core/build/esm/carrier.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/currentScopes.js +34 -0
- package/dist/node_modules/@sentry/core/build/esm/currentScopes.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/debug-build.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/exports.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/exports.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/scope.js +577 -0
- package/dist/node_modules/@sentry/core/build/esm/scope.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/session.js +61 -0
- package/dist/node_modules/@sentry/core/build/esm/session.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js +39 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js +79 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js +88 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/is.js +35 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/is.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/merge.js +19 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/merge.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/misc.js +32 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/misc.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/object.js +18 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/object.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js +34 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js +8 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js +27 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js +17 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/string.js +10 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/string.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/time.js +26 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/time.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/version.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/version.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/debug-build.js +5 -0
- package/dist/node_modules/@sentry/react/build/esm/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/error.js +40 -0
- package/dist/node_modules/@sentry/react/build/esm/error.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/errorboundary.js +103 -0
- package/dist/node_modules/@sentry/react/build/esm/errorboundary.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js.map +1 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +1 -10
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +1 -10
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +1 -1
- package/dist/node_modules/react-router/dist/index.js +377 -0
- package/dist/node_modules/react-router/dist/index.js.map +1 -0
- package/dist/node_modules/react-router-dom/dist/index.js +560 -0
- package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
- package/dist/node_modules/zustand/esm/middleware.js +202 -0
- package/dist/node_modules/zustand/esm/middleware.js.map +1 -0
- package/dist/node_modules/zustand/esm/react.js +24 -0
- package/dist/node_modules/zustand/esm/react.js.map +1 -0
- package/dist/node_modules/zustand/esm/vanilla.js +26 -0
- package/dist/node_modules/zustand/esm/vanilla.js.map +1 -0
- package/dist/states/StoredTableState.d.ts +37 -0
- package/dist/states/StoredTableState.js +58 -0
- package/dist/states/StoredTableState.js.map +1 -0
- package/dist/types/Forms.d.ts +2 -0
- package/dist/types/Plugins.d.ts +14 -7
- package/dist/types/Plugins.js +1 -1
- package/dist/types/Plugins.js.map +1 -1
- package/dist/types/Tables.d.ts +10 -0
- package/lib/components/Boundary.tsx +46 -0
- package/lib/components/CopyButton.tsx +76 -0
- package/lib/components/CopyableCell.tsx +51 -0
- package/lib/components/InvenTreeTable.tsx +63 -0
- package/lib/components/TableColumnSelect.tsx +40 -0
- package/lib/enums/ApiEndpoints.tsx +1 -1
- package/lib/enums/ModelInformation.tsx +7 -0
- package/lib/enums/ModelType.tsx +1 -0
- package/lib/functions/Forms.tsx +47 -0
- package/lib/functions/Notification.tsx +50 -0
- package/lib/functions/String.tsx +38 -0
- package/lib/hooks/UseFilterSet.tsx +47 -0
- package/lib/hooks/UseTable.tsx +160 -0
- package/lib/index.ts +49 -1
- package/lib/states/StoredTableState.tsx +91 -0
- package/lib/types/Forms.tsx +2 -0
- package/lib/types/Plugins.tsx +15 -7
- package/lib/types/Tables.tsx +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const _i18n = window["LinguiCore"].i18n;
|
|
2
|
+
const notifications = window["MantineNotifications"].notifications;
|
|
3
|
+
function notYetImplemented() {
|
|
4
|
+
notifications.hide("not-implemented");
|
|
5
|
+
notifications.show({
|
|
6
|
+
title: _i18n._(
|
|
7
|
+
/*i18n*/
|
|
8
|
+
{
|
|
9
|
+
id: "ipE2p4"
|
|
10
|
+
}
|
|
11
|
+
),
|
|
12
|
+
message: _i18n._(
|
|
13
|
+
/*i18n*/
|
|
14
|
+
{
|
|
15
|
+
id: "WvSApV"
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
color: "red",
|
|
19
|
+
id: "not-implemented"
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function permissionDenied() {
|
|
23
|
+
notifications.show({
|
|
24
|
+
title: _i18n._(
|
|
25
|
+
/*i18n*/
|
|
26
|
+
{
|
|
27
|
+
id: "JUwB5j"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
message: _i18n._(
|
|
31
|
+
/*i18n*/
|
|
32
|
+
{
|
|
33
|
+
id: "3WjGlZ"
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
color: "red"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function invalidResponse(returnCode) {
|
|
40
|
+
notifications.show({
|
|
41
|
+
title: _i18n._(
|
|
42
|
+
/*i18n*/
|
|
43
|
+
{
|
|
44
|
+
id: "J7PX+R"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
message: _i18n._(
|
|
48
|
+
/*i18n*/
|
|
49
|
+
{
|
|
50
|
+
id: "78bD8l",
|
|
51
|
+
values: {
|
|
52
|
+
returnCode
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
color: "red"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function showTimeoutNotification() {
|
|
60
|
+
notifications.show({
|
|
61
|
+
title: _i18n._(
|
|
62
|
+
/*i18n*/
|
|
63
|
+
{
|
|
64
|
+
id: "xY9s5E"
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
message: _i18n._(
|
|
68
|
+
/*i18n*/
|
|
69
|
+
{
|
|
70
|
+
id: "g/KPkG"
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
color: "red"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
invalidResponse,
|
|
78
|
+
notYetImplemented,
|
|
79
|
+
permissionDenied,
|
|
80
|
+
showTimeoutNotification
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=Notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.js","sources":["../../lib/functions/Notification.tsx"],"sourcesContent":["import { t } from '@lingui/core/macro';\nimport { notifications } from '@mantine/notifications';\n\n/**\n * Show a notification that the feature is not yet implemented\n */\nexport function notYetImplemented() {\n notifications.hide('not-implemented');\n\n notifications.show({\n title: t`Not implemented`,\n message: t`This feature is not yet implemented`,\n color: 'red',\n id: 'not-implemented'\n });\n}\n\n/**\n * Show a notification that the user does not have permission to perform the action\n */\nexport function permissionDenied() {\n notifications.show({\n title: t`Permission Denied`,\n message: t`You do not have permission to perform this action`,\n color: 'red'\n });\n}\n\n/**\n * Display a notification on an invalid return code\n */\nexport function invalidResponse(returnCode: number) {\n // TODO: Specific return code messages\n notifications.show({\n title: t`Invalid Return Code`,\n message: t`Server returned status ${returnCode}`,\n color: 'red'\n });\n}\n\n/**\n * Display a notification on timeout\n */\nexport function showTimeoutNotification() {\n notifications.show({\n title: t`Timeout`,\n message: t`The request timed out`,\n color: 'red'\n });\n}\n"],"names":["notYetImplemented","notifications","hide","show","title","_i18n","_","id","message","color","permissionDenied","invalidResponse","returnCode","values","showTimeoutNotification"],"mappings":"AAAA,MAAA,QAAA,OAAA,YAAA,EAAA;AACA,MAAA,gBAAA,OAAA,sBAAA,EAAA;AAKO,SAASA,oBAAoB;AAClCC,gBAAcC,KAAK,iBAAiB;AAEpCD,gBAAcE,KAAK;AAAA,IACjBC,OAAKC,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAiB;AAAA,IACxBC,SAAOH,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAqC;AAAA,IAC9CE,OAAO;AAAA,IACPF,IAAI;AAAA,EAAA,CACL;AACH;AAKO,SAASG,mBAAmB;AACjCT,gBAAcE,KAAK;AAAA,IACjBC,OAAKC,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAmB;AAAA,IAC1BC,SAAOH,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAmD;AAAA,IAC5DE,OAAO;AAAA,EAAA,CACR;AACH;AAKO,SAASE,gBAAgBC,YAAoB;AAElDX,gBAAcE,KAAK;AAAA,IACjBC,OAAKC,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAqB;AAAA,IAC5BC,SAAOH,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,QAAAM,QAAA;AAAA,UAAAD;AAAAA,QAAAA;AAAAA,MAAqC;AAAA,IAAC;AAAA,IAC/CH,OAAO;AAAA,EAAA,CACR;AACH;AAKO,SAASK,0BAA0B;AACxCb,gBAAcE,KAAK;AAAA,IACjBC,OAAKC,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAS;AAAA,IAChBC,SAAOH,MAAAC;AAAAA;AAAAA,MAAE;AAAA,QAAAC,IAAA;AAAA,MAAA;AAAA,IAAuB;AAAA,IAChCE,OAAO;AAAA,EAAA,CACR;AACH;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reduce an input string to a given length, adding an ellipsis if necessary
|
|
3
|
+
* @param str - String to shorten
|
|
4
|
+
* @param len - Length to shorten to
|
|
5
|
+
*/
|
|
6
|
+
export declare function shortenString({ str, len }: {
|
|
7
|
+
str: string | undefined;
|
|
8
|
+
len?: number;
|
|
9
|
+
}): string;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a short hash from a long string
|
|
12
|
+
*/
|
|
13
|
+
export declare function hashString(str: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function shortenString({
|
|
2
|
+
str,
|
|
3
|
+
len = 100
|
|
4
|
+
}) {
|
|
5
|
+
str = str ?? "";
|
|
6
|
+
str = str.toString();
|
|
7
|
+
if (str.length <= len) {
|
|
8
|
+
return str;
|
|
9
|
+
}
|
|
10
|
+
const N = Math.floor(len / 2 - 1);
|
|
11
|
+
return `${str.slice(0, N)} ... ${str.slice(-N)}`;
|
|
12
|
+
}
|
|
13
|
+
function hashString(str) {
|
|
14
|
+
let hash = 0;
|
|
15
|
+
for (let i = 0; i < str.length; i++) {
|
|
16
|
+
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
17
|
+
hash |= 0;
|
|
18
|
+
}
|
|
19
|
+
return hash.toString(36);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
hashString,
|
|
23
|
+
shortenString
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=String.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"String.js","sources":["../../lib/functions/String.tsx"],"sourcesContent":["/**\n * Reduce an input string to a given length, adding an ellipsis if necessary\n * @param str - String to shorten\n * @param len - Length to shorten to\n */\nexport function shortenString({\n str,\n len = 100\n}: {\n str: string | undefined;\n len?: number;\n}) {\n // Ensure that the string is a string\n str = str ?? '';\n str = str.toString();\n\n // If the string is already short enough, return it\n if (str.length <= len) {\n return str;\n }\n\n // Otherwise, shorten it\n const N = Math.floor(len / 2 - 1);\n\n return `${str.slice(0, N)} ... ${str.slice(-N)}`;\n}\n\n/**\n * Generate a short hash from a long string\n */\nexport function hashString(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n return hash.toString(36);\n}\n"],"names":["shortenString","str","len","toString","length","N","Math","floor","slice","hashString","hash","i","charCodeAt"],"mappings":"AAKO,SAASA,cAAc;AAAA,EAC5BC;AAAAA,EACAC,MAAM;AAIR,GAAG;AAEDD,QAAMA,OAAO;AACbA,QAAMA,IAAIE,SAAAA;AAGV,MAAIF,IAAIG,UAAUF,KAAK;AACrB,WAAOD;AAAAA,EACT;AAGA,QAAMI,IAAIC,KAAKC,MAAML,MAAM,IAAI,CAAC;AAEhC,SAAO,GAAGD,IAAIO,MAAM,GAAGH,CAAC,CAAC,QAAQJ,IAAIO,MAAM,CAACH,CAAC,CAAC;AAChD;AAKO,SAASI,WAAWR,KAAqB;AAC9C,MAAIS,OAAO;AACX,WAASC,IAAI,GAAGA,IAAIV,IAAIG,QAAQO,KAAK;AACnCD,YAAQA,QAAQ,KAAKA,OAAOT,IAAIW,WAAWD,CAAC;AAC5CD,YAAQ;AAAA,EACV;AACA,SAAOA,KAAKP,SAAS,EAAE;AACzB;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useLocalStorage } from "../node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js";
|
|
2
|
+
const useCallback = window["React"].useCallback;
|
|
3
|
+
const useMemo = window["React"].useMemo;
|
|
4
|
+
function useFilterSet(filterKey, initialFilters) {
|
|
5
|
+
const [storedFilters, setStoredFilters] = useLocalStorage({
|
|
6
|
+
key: `inventree-filterset-${filterKey}`,
|
|
7
|
+
defaultValue: null,
|
|
8
|
+
sync: false,
|
|
9
|
+
getInitialValueInEffect: false
|
|
10
|
+
});
|
|
11
|
+
const activeFilters = useMemo(() => {
|
|
12
|
+
if (storedFilters == null) {
|
|
13
|
+
const filters = initialFilters || [];
|
|
14
|
+
setStoredFilters(filters);
|
|
15
|
+
return filters;
|
|
16
|
+
}
|
|
17
|
+
return storedFilters || [];
|
|
18
|
+
}, [storedFilters]);
|
|
19
|
+
const clearActiveFilters = useCallback(() => {
|
|
20
|
+
setStoredFilters([]);
|
|
21
|
+
}, []);
|
|
22
|
+
const setActiveFilters = useCallback((filters) => {
|
|
23
|
+
setStoredFilters(filters);
|
|
24
|
+
}, [setStoredFilters]);
|
|
25
|
+
return {
|
|
26
|
+
filterKey,
|
|
27
|
+
activeFilters,
|
|
28
|
+
setActiveFilters,
|
|
29
|
+
clearActiveFilters
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
useFilterSet as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=UseFilterSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseFilterSet.js","sources":["../../lib/hooks/UseFilterSet.tsx"],"sourcesContent":["import { useLocalStorage } from '@mantine/hooks';\nimport { useCallback, useMemo } from 'react';\nimport type { FilterSetState, TableFilter } from '../types/Filters';\n\nexport default function useFilterSet(\n filterKey: string,\n initialFilters?: TableFilter[]\n): FilterSetState {\n // Array of active filters (saved to local storage)\n const [storedFilters, setStoredFilters] = useLocalStorage<\n TableFilter[] | null\n >({\n key: `inventree-filterset-${filterKey}`,\n defaultValue: null,\n sync: false,\n getInitialValueInEffect: false\n });\n\n const activeFilters: TableFilter[] = useMemo(() => {\n if (storedFilters == null) {\n // If there are no stored filters, set initial values\n const filters = initialFilters || [];\n setStoredFilters(filters);\n return filters;\n }\n return storedFilters || [];\n }, [storedFilters]);\n\n // Callback to clear all active filters from the table\n const clearActiveFilters = useCallback(() => {\n setStoredFilters([]);\n }, []);\n\n const setActiveFilters = useCallback(\n (filters: TableFilter[]) => {\n setStoredFilters(filters);\n },\n [setStoredFilters]\n );\n\n return {\n filterKey,\n activeFilters,\n setActiveFilters,\n clearActiveFilters\n };\n}\n"],"names":["useFilterSet","filterKey","initialFilters","storedFilters","setStoredFilters","useLocalStorage","key","defaultValue","sync","getInitialValueInEffect","activeFilters","useMemo","filters","clearActiveFilters","useCallback","setActiveFilters"],"mappings":";AACA,MAAA,cAAA,OAAA,OAAA,EAAA;;AAGA,SAAwBA,aACtBC,WACAC,gBACgB;AAEhB,QAAM,CAACC,eAAeC,gBAAgB,IAAIC,gBAExC;AAAA,IACAC,KAAK,uBAAuBL,SAAS;AAAA,IACrCM,cAAc;AAAA,IACdC,MAAM;AAAA,IACNC,yBAAyB;AAAA,EAAA,CAC1B;AAED,QAAMC,gBAA+BC,QAAQ,MAAM;AACjD,QAAIR,iBAAiB,MAAM;AAEzB,YAAMS,UAAUV,kBAAkB,CAAA;AAClCE,uBAAiBQ,OAAO;AACxB,aAAOA;AAAAA,IACT;AACA,WAAOT,iBAAiB,CAAA;AAAA,EAC1B,GAAG,CAACA,aAAa,CAAC;AAGlB,QAAMU,qBAAqBC,YAAY,MAAM;AAC3CV,qBAAiB,CAAA,CAAE;AAAA,EACrB,GAAG,CAAA,CAAE;AAEL,QAAMW,mBAAmBD,YACvB,CAACF,YAA2B;AAC1BR,qBAAiBQ,OAAO;AAAA,EAC1B,GACA,CAACR,gBAAgB,CACnB;AAEA,SAAO;AAAA,IACLH;AAAAA,IACAS;AAAAA,IACAK;AAAAA,IACAF;AAAAA,EAAAA;AAEJ;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TableFilter } from '../types/Filters';
|
|
2
|
+
import { TableState } from '../types/Tables';
|
|
3
|
+
export type TableStateExtraProps = {
|
|
4
|
+
idAccessor?: string;
|
|
5
|
+
initialFilters?: TableFilter[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A custom hook for managing the state of an <InvenTreeTable> component.
|
|
9
|
+
*
|
|
10
|
+
* Refer to the TableState type definition for more information.
|
|
11
|
+
*/
|
|
12
|
+
export default function useTable(tableName: string, tableProps?: TableStateExtraProps): TableState;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useSearchParams } from "../node_modules/react-router-dom/dist/index.js";
|
|
2
|
+
import useFilterSet from "./UseFilterSet.js";
|
|
3
|
+
import { randomId } from "../node_modules/@mantine/hooks/esm/utils/random-id/random-id.js";
|
|
4
|
+
const useCallback = window["React"].useCallback;
|
|
5
|
+
const useMemo = window["React"].useMemo;
|
|
6
|
+
const useState = window["React"].useState;
|
|
7
|
+
function useTable(tableName, tableProps = {
|
|
8
|
+
idAccessor: "pk",
|
|
9
|
+
initialFilters: []
|
|
10
|
+
}) {
|
|
11
|
+
function generateTableName() {
|
|
12
|
+
return `${tableName.replaceAll("-", "")}-${randomId()}`;
|
|
13
|
+
}
|
|
14
|
+
const [queryFilters, setQueryFilters] = useSearchParams();
|
|
15
|
+
const clearQueryFilters = useCallback(() => {
|
|
16
|
+
setQueryFilters({});
|
|
17
|
+
}, []);
|
|
18
|
+
const [tableKey, setTableKey] = useState(generateTableName());
|
|
19
|
+
const refreshTable = useCallback((clearSelection) => {
|
|
20
|
+
setTableKey(generateTableName());
|
|
21
|
+
if (clearSelection) {
|
|
22
|
+
clearSelectedRecords();
|
|
23
|
+
}
|
|
24
|
+
}, [generateTableName]);
|
|
25
|
+
const filterSet = useFilterSet(`table-${tableName}`, tableProps.initialFilters);
|
|
26
|
+
const [expandedRecords, setExpandedRecords] = useState([]);
|
|
27
|
+
const isRowExpanded = useCallback((pk) => {
|
|
28
|
+
return expandedRecords.includes(pk);
|
|
29
|
+
}, [expandedRecords]);
|
|
30
|
+
const [hiddenColumns, setHiddenColumns] = useState([]);
|
|
31
|
+
const [selectedRecords, setSelectedRecords] = useState([]);
|
|
32
|
+
const selectedIds = useMemo(() => selectedRecords.map((r) => r[tableProps.idAccessor || "pk"]), [selectedRecords]);
|
|
33
|
+
const clearSelectedRecords = useCallback(() => {
|
|
34
|
+
setSelectedRecords([]);
|
|
35
|
+
}, []);
|
|
36
|
+
const hasSelectedRecords = useMemo(() => {
|
|
37
|
+
return selectedRecords.length > 0;
|
|
38
|
+
}, [selectedRecords]);
|
|
39
|
+
const [recordCount, setRecordCount] = useState(0);
|
|
40
|
+
const [page, setPage] = useState(1);
|
|
41
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
42
|
+
const [records, setRecords] = useState([]);
|
|
43
|
+
const updateRecord = useCallback((record) => {
|
|
44
|
+
const _records = [...records];
|
|
45
|
+
const index = _records.findIndex((r) => r[tableProps.idAccessor || "pk"] === record.pk);
|
|
46
|
+
if (index >= 0) {
|
|
47
|
+
_records[index] = {
|
|
48
|
+
..._records[index],
|
|
49
|
+
...record
|
|
50
|
+
};
|
|
51
|
+
} else {
|
|
52
|
+
_records.push(record);
|
|
53
|
+
}
|
|
54
|
+
setRecords(_records);
|
|
55
|
+
}, [records]);
|
|
56
|
+
const idAccessor = useMemo(() => tableProps.idAccessor || "pk", [tableProps.idAccessor]);
|
|
57
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
58
|
+
return {
|
|
59
|
+
tableKey,
|
|
60
|
+
refreshTable,
|
|
61
|
+
isLoading,
|
|
62
|
+
setIsLoading,
|
|
63
|
+
filterSet,
|
|
64
|
+
queryFilters,
|
|
65
|
+
setQueryFilters,
|
|
66
|
+
clearQueryFilters,
|
|
67
|
+
expandedRecords,
|
|
68
|
+
setExpandedRecords,
|
|
69
|
+
isRowExpanded,
|
|
70
|
+
selectedRecords,
|
|
71
|
+
selectedIds,
|
|
72
|
+
setSelectedRecords,
|
|
73
|
+
clearSelectedRecords,
|
|
74
|
+
hasSelectedRecords,
|
|
75
|
+
searchTerm,
|
|
76
|
+
setSearchTerm,
|
|
77
|
+
recordCount,
|
|
78
|
+
setRecordCount,
|
|
79
|
+
hiddenColumns,
|
|
80
|
+
setHiddenColumns,
|
|
81
|
+
page,
|
|
82
|
+
setPage,
|
|
83
|
+
records,
|
|
84
|
+
setRecords,
|
|
85
|
+
updateRecord,
|
|
86
|
+
idAccessor
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
useTable as default
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=UseTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseTable.js","sources":["../../lib/hooks/UseTable.tsx"],"sourcesContent":["import { randomId } from '@mantine/hooks';\nimport { useCallback, useMemo, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\n\nimport type { FilterSetState, TableFilter } from '../types/Filters';\nimport type { TableState } from '../types/Tables';\nimport useFilterSet from './UseFilterSet';\n\nexport type TableStateExtraProps = {\n idAccessor?: string;\n initialFilters?: TableFilter[];\n};\n\n/**\n * A custom hook for managing the state of an <InvenTreeTable> component.\n *\n * Refer to the TableState type definition for more information.\n */\n\nexport default function useTable(\n tableName: string,\n tableProps: TableStateExtraProps = {\n idAccessor: 'pk',\n initialFilters: []\n }\n): TableState {\n // Function to generate a new ID (to refresh the table)\n function generateTableName() {\n return `${tableName.replaceAll('-', '')}-${randomId()}`;\n }\n\n // Extract URL query parameters (e.g. ?active=true&overdue=false)\n const [queryFilters, setQueryFilters] = useSearchParams();\n\n const clearQueryFilters = useCallback(() => {\n setQueryFilters({});\n }, []);\n\n const [tableKey, setTableKey] = useState<string>(generateTableName());\n\n // Callback used to refresh (reload) the table\n const refreshTable = useCallback(\n (clearSelection?: boolean) => {\n setTableKey(generateTableName());\n if (clearSelection) {\n clearSelectedRecords();\n }\n },\n [generateTableName]\n );\n\n const filterSet: FilterSetState = useFilterSet(\n `table-${tableName}`,\n tableProps.initialFilters\n );\n\n // Array of expanded records\n const [expandedRecords, setExpandedRecords] = useState<any[]>([]);\n\n // Function to determine if a record is expanded\n const isRowExpanded = useCallback(\n (pk: number) => {\n return expandedRecords.includes(pk);\n },\n [expandedRecords]\n );\n\n // Array of columns which are hidden\n const [hiddenColumns, setHiddenColumns] = useState<string[]>([]);\n\n // Array of selected records\n const [selectedRecords, setSelectedRecords] = useState<any[]>([]);\n\n // Array of selected primary key values\n const selectedIds = useMemo(\n () => selectedRecords.map((r) => r[tableProps.idAccessor || 'pk']),\n [selectedRecords]\n );\n\n const clearSelectedRecords = useCallback(() => {\n setSelectedRecords([]);\n }, []);\n\n const hasSelectedRecords = useMemo(() => {\n return selectedRecords.length > 0;\n }, [selectedRecords]);\n\n // Total record count\n const [recordCount, setRecordCount] = useState<number>(0);\n\n const [page, setPage] = useState<number>(1);\n\n // Search term\n const [searchTerm, setSearchTerm] = useState<string>('');\n\n // Table records\n const [records, setRecords] = useState<any[]>([]);\n\n // Update a single record in the table, by primary key value\n const updateRecord = useCallback(\n (record: any) => {\n const _records = [...records];\n\n // Find the matching record in the table\n const index = _records.findIndex(\n (r) => r[tableProps.idAccessor || 'pk'] === record.pk\n );\n\n if (index >= 0) {\n _records[index] = {\n ..._records[index],\n ...record\n };\n } else {\n _records.push(record);\n }\n\n setRecords(_records);\n },\n [records]\n );\n\n const idAccessor = useMemo(\n () => tableProps.idAccessor || 'pk',\n [tableProps.idAccessor]\n );\n\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n return {\n tableKey,\n refreshTable,\n isLoading,\n setIsLoading,\n filterSet,\n queryFilters,\n setQueryFilters,\n clearQueryFilters,\n expandedRecords,\n setExpandedRecords,\n isRowExpanded,\n selectedRecords,\n selectedIds,\n setSelectedRecords,\n clearSelectedRecords,\n hasSelectedRecords,\n searchTerm,\n setSearchTerm,\n recordCount,\n setRecordCount,\n hiddenColumns,\n setHiddenColumns,\n page,\n setPage,\n records,\n setRecords,\n updateRecord,\n idAccessor\n };\n}\n"],"names":["useTable","tableName","tableProps","idAccessor","initialFilters","generateTableName","replaceAll","randomId","queryFilters","setQueryFilters","useSearchParams","clearQueryFilters","useCallback","tableKey","setTableKey","useState","refreshTable","clearSelection","clearSelectedRecords","filterSet","useFilterSet","expandedRecords","setExpandedRecords","isRowExpanded","pk","includes","hiddenColumns","setHiddenColumns","selectedRecords","setSelectedRecords","selectedIds","useMemo","map","r","hasSelectedRecords","length","recordCount","setRecordCount","page","setPage","searchTerm","setSearchTerm","records","setRecords","updateRecord","record","_records","index","findIndex","push","isLoading","setIsLoading"],"mappings":";;;AACA,MAAA,cAAA,OAAA,OAAA,EAAA;;;AAkBA,SAAwBA,SACtBC,WACAC,aAAmC;AAAA,EACjCC,YAAY;AAAA,EACZC,gBAAgB,CAAA;AAClB,GACY;AAEZ,WAASC,oBAAoB;AAC3B,WAAO,GAAGJ,UAAUK,WAAW,KAAK,EAAE,CAAC,IAAIC,UAAU;AAAA,EACvD;AAGA,QAAM,CAACC,cAAcC,eAAe,IAAIC,gBAAAA;AAExC,QAAMC,oBAAoBC,YAAY,MAAM;AAC1CH,oBAAgB,CAAA,CAAE;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,QAAM,CAACI,UAAUC,WAAW,IAAIC,SAAiBV,mBAAmB;AAGpE,QAAMW,eAAeJ,YACnB,CAACK,mBAA6B;AAC5BH,gBAAYT,mBAAmB;AAC/B,QAAIY,gBAAgB;AAClBC,2BAAAA;AAAAA,IACF;AAAA,EACF,GACA,CAACb,iBAAiB,CACpB;AAEA,QAAMc,YAA4BC,aAChC,SAASnB,SAAS,IAClBC,WAAWE,cACb;AAGA,QAAM,CAACiB,iBAAiBC,kBAAkB,IAAIP,SAAgB,CAAA,CAAE;AAGhE,QAAMQ,gBAAgBX,YACpB,CAACY,OAAe;AACd,WAAOH,gBAAgBI,SAASD,EAAE;AAAA,EACpC,GACA,CAACH,eAAe,CAClB;AAGA,QAAM,CAACK,eAAeC,gBAAgB,IAAIZ,SAAmB,CAAA,CAAE;AAG/D,QAAM,CAACa,iBAAiBC,kBAAkB,IAAId,SAAgB,CAAA,CAAE;AAGhE,QAAMe,cAAcC,QAClB,MAAMH,gBAAgBI,IAAKC,CAAAA,MAAMA,EAAE/B,WAAWC,cAAc,IAAI,CAAC,GACjE,CAACyB,eAAe,CAClB;AAEA,QAAMV,uBAAuBN,YAAY,MAAM;AAC7CiB,uBAAmB,CAAA,CAAE;AAAA,EACvB,GAAG,CAAA,CAAE;AAEL,QAAMK,qBAAqBH,QAAQ,MAAM;AACvC,WAAOH,gBAAgBO,SAAS;AAAA,EAClC,GAAG,CAACP,eAAe,CAAC;AAGpB,QAAM,CAACQ,aAAaC,cAAc,IAAItB,SAAiB,CAAC;AAExD,QAAM,CAACuB,MAAMC,OAAO,IAAIxB,SAAiB,CAAC;AAG1C,QAAM,CAACyB,YAAYC,aAAa,IAAI1B,SAAiB,EAAE;AAGvD,QAAM,CAAC2B,SAASC,UAAU,IAAI5B,SAAgB,CAAA,CAAE;AAGhD,QAAM6B,eAAehC,YACnB,CAACiC,WAAgB;AACf,UAAMC,WAAW,CAAC,GAAGJ,OAAO;AAG5B,UAAMK,QAAQD,SAASE,UACpBf,CAAAA,MAAMA,EAAE/B,WAAWC,cAAc,IAAI,MAAM0C,OAAOrB,EACrD;AAEA,QAAIuB,SAAS,GAAG;AACdD,eAASC,KAAK,IAAI;AAAA,QAChB,GAAGD,SAASC,KAAK;AAAA,QACjB,GAAGF;AAAAA,MAAAA;AAAAA,IAEP,OAAO;AACLC,eAASG,KAAKJ,MAAM;AAAA,IACtB;AAEAF,eAAWG,QAAQ;AAAA,EACrB,GACA,CAACJ,OAAO,CACV;AAEA,QAAMvC,aAAa4B,QACjB,MAAM7B,WAAWC,cAAc,MAC/B,CAACD,WAAWC,UAAU,CACxB;AAEA,QAAM,CAAC+C,WAAWC,YAAY,IAAIpC,SAAkB,KAAK;AAEzD,SAAO;AAAA,IACLF;AAAAA,IACAG;AAAAA,IACAkC;AAAAA,IACAC;AAAAA,IACAhC;AAAAA,IACAX;AAAAA,IACAC;AAAAA,IACAE;AAAAA,IACAU;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAK;AAAAA,IACAE;AAAAA,IACAD;AAAAA,IACAX;AAAAA,IACAgB;AAAAA,IACAM;AAAAA,IACAC;AAAAA,IACAL;AAAAA,IACAC;AAAAA,IACAX;AAAAA,IACAC;AAAAA,IACAW;AAAAA,IACAC;AAAAA,IACAG;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAzC;AAAAA,EAAAA;AAEJ;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,20 +3,31 @@ export { ApiEndpoints } from './enums/ApiEndpoints';
|
|
|
3
3
|
export { ModelType } from './enums/ModelType';
|
|
4
4
|
export type { ModelDict } from './enums/ModelInformation';
|
|
5
5
|
export { UserRoles, UserPermissions } from './enums/Roles';
|
|
6
|
-
export type { InvenTreePluginContext, InvenTreeFormsContext, PluginVersion, StockAdjustmentFormsContext } from './types/Plugins';
|
|
7
|
-
export type { RowAction, RowViewProps } from './types/Tables';
|
|
6
|
+
export type { InvenTreePluginContext, InvenTreeFormsContext, InvenTreeTablesContext, ImporterDrawerContext, PluginVersion, StockAdjustmentFormsContext } from './types/Plugins';
|
|
7
|
+
export type { RowAction, RowViewProps, TableColumn, TableColumnProps, InvenTreeTableProps, InvenTreeTableRenderProps } from './types/Tables';
|
|
8
8
|
export type { ApiFormFieldChoice, ApiFormFieldHeader, ApiFormFieldType, ApiFormFieldSet, ApiFormProps, ApiFormModalProps, BulkEditApiFormModalProps } from './types/Forms';
|
|
9
9
|
export type { UseModalProps, UseModalReturn } from './types/Modals';
|
|
10
10
|
export { apiUrl } from './functions/Api';
|
|
11
11
|
export { getBaseUrl, getDetailUrl, navigateToLink } from './functions/Navigation';
|
|
12
|
+
export { notYetImplemented, permissionDenied, invalidResponse, showTimeoutNotification } from './functions/Notification';
|
|
12
13
|
export { checkPluginVersion, initPlugin } from './functions/Plugins';
|
|
13
14
|
export { formatCurrencyValue, formatDecimal, formatFileSize } from './functions/Formatting';
|
|
15
|
+
export { constructFormUrl, mapFields, type NestedDict } from './functions/Forms';
|
|
16
|
+
export { shortenString, hashString } from './functions/String';
|
|
14
17
|
export { ActionButton, type ActionButtonProps } from './components/ActionButton';
|
|
15
18
|
export { AddItemButton } from './components/AddItemButton';
|
|
19
|
+
export { Boundary, DefaultFallback } from './components/Boundary';
|
|
16
20
|
export { ButtonMenu } from './components/ButtonMenu';
|
|
21
|
+
export { CopyButton } from './components/CopyButton';
|
|
22
|
+
export { CopyableCell } from './components/CopyableCell';
|
|
17
23
|
export { ProgressBar } from './components/ProgressBar';
|
|
18
24
|
export { PassFailButton, YesNoButton } from './components/YesNoButton';
|
|
19
25
|
export { SearchInput } from './components/SearchInput';
|
|
26
|
+
export { TableColumnSelect } from './components/TableColumnSelect';
|
|
27
|
+
export { default as InvenTreeTable } from './components/InvenTreeTable';
|
|
20
28
|
export { RowViewAction, RowDuplicateAction, RowEditAction, RowDeleteAction, RowCancelAction, RowActions } from './components/RowActions';
|
|
21
29
|
export { default as useMonitorDataOutput, type MonitorDataOutputProps } from './hooks/MonitorDataOutput';
|
|
22
30
|
export { default as useMonitorBackgroundTask, type MonitorBackgroundTaskProps } from './hooks/MonitorBackgroundTask';
|
|
31
|
+
export { default as useFilterSet } from './hooks/UseFilterSet';
|
|
32
|
+
export { default as useTable, type TableStateExtraProps } from './hooks/UseTable';
|
|
33
|
+
export { type StoredTableStateProps, useStoredTableState } from './states/StoredTableState';
|
package/dist/index.js
CHANGED
|
@@ -4,26 +4,42 @@ import { ModelType } from "./enums/ModelType.js";
|
|
|
4
4
|
import { UserPermissions, UserRoles } from "./enums/Roles.js";
|
|
5
5
|
import { apiUrl } from "./functions/Api.js";
|
|
6
6
|
import { getBaseUrl, getDetailUrl, navigateToLink } from "./functions/Navigation.js";
|
|
7
|
+
import { invalidResponse, notYetImplemented, permissionDenied, showTimeoutNotification } from "./functions/Notification.js";
|
|
7
8
|
import { checkPluginVersion, initPlugin } from "./functions/Plugins.js";
|
|
8
9
|
import { formatCurrencyValue, formatDecimal, formatFileSize } from "./functions/Formatting.js";
|
|
10
|
+
import { constructFormUrl, mapFields } from "./functions/Forms.js";
|
|
11
|
+
import { hashString, shortenString } from "./functions/String.js";
|
|
9
12
|
import { ActionButton } from "./components/ActionButton.js";
|
|
10
13
|
import { AddItemButton } from "./components/AddItemButton.js";
|
|
14
|
+
import { Boundary, DefaultFallback } from "./components/Boundary.js";
|
|
11
15
|
import { ButtonMenu } from "./components/ButtonMenu.js";
|
|
16
|
+
import { CopyButton } from "./components/CopyButton.js";
|
|
17
|
+
import { CopyableCell } from "./components/CopyableCell.js";
|
|
12
18
|
import { ProgressBar } from "./components/ProgressBar.js";
|
|
13
19
|
import { PassFailButton, YesNoButton } from "./components/YesNoButton.js";
|
|
14
20
|
import { SearchInput } from "./components/SearchInput.js";
|
|
21
|
+
import { TableColumnSelect } from "./components/TableColumnSelect.js";
|
|
22
|
+
import { default as default2 } from "./components/InvenTreeTable.js";
|
|
15
23
|
import { RowActions, RowCancelAction, RowDeleteAction, RowDuplicateAction, RowEditAction, RowViewAction } from "./components/RowActions.js";
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
24
|
+
import { default as default3 } from "./hooks/MonitorDataOutput.js";
|
|
25
|
+
import { default as default4 } from "./hooks/MonitorBackgroundTask.js";
|
|
26
|
+
import { default as default5 } from "./hooks/UseFilterSet.js";
|
|
27
|
+
import { default as default6 } from "./hooks/UseTable.js";
|
|
28
|
+
import { useStoredTableState } from "./states/StoredTableState.js";
|
|
18
29
|
export {
|
|
19
30
|
ActionButton,
|
|
20
31
|
AddItemButton,
|
|
21
32
|
ApiEndpoints,
|
|
33
|
+
Boundary,
|
|
22
34
|
ButtonMenu,
|
|
35
|
+
CopyButton,
|
|
36
|
+
CopyableCell,
|
|
37
|
+
DefaultFallback,
|
|
23
38
|
INVENTREE_MANTINE_VERSION,
|
|
24
39
|
INVENTREE_PLUGIN_VERSION,
|
|
25
40
|
INVENTREE_REACT_DOM_VERSION,
|
|
26
41
|
INVENTREE_REACT_VERSION,
|
|
42
|
+
default2 as InvenTreeTable,
|
|
27
43
|
ModelType,
|
|
28
44
|
PassFailButton,
|
|
29
45
|
ProgressBar,
|
|
@@ -34,19 +50,31 @@ export {
|
|
|
34
50
|
RowEditAction,
|
|
35
51
|
RowViewAction,
|
|
36
52
|
SearchInput,
|
|
53
|
+
TableColumnSelect,
|
|
37
54
|
UserPermissions,
|
|
38
55
|
UserRoles,
|
|
39
56
|
YesNoButton,
|
|
40
57
|
apiUrl,
|
|
41
58
|
checkPluginVersion,
|
|
59
|
+
constructFormUrl,
|
|
42
60
|
formatCurrencyValue,
|
|
43
61
|
formatDecimal,
|
|
44
62
|
formatFileSize,
|
|
45
63
|
getBaseUrl,
|
|
46
64
|
getDetailUrl,
|
|
65
|
+
hashString,
|
|
47
66
|
initPlugin,
|
|
67
|
+
invalidResponse,
|
|
68
|
+
mapFields,
|
|
48
69
|
navigateToLink,
|
|
49
|
-
|
|
50
|
-
|
|
70
|
+
notYetImplemented,
|
|
71
|
+
permissionDenied,
|
|
72
|
+
shortenString,
|
|
73
|
+
showTimeoutNotification,
|
|
74
|
+
default5 as useFilterSet,
|
|
75
|
+
default4 as useMonitorBackgroundTask,
|
|
76
|
+
default3 as useMonitorDataOutput,
|
|
77
|
+
useStoredTableState,
|
|
78
|
+
default6 as useTable
|
|
51
79
|
};
|
|
52
80
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useWindowEvent } from "../use-window-event/use-window-event.js";
|
|
2
|
+
const useCallback = window["React"].useCallback;
|
|
3
|
+
const useState = window["React"].useState;
|
|
4
|
+
const useEffect = window["React"].useEffect;
|
|
5
|
+
function serializeJSON(value, hookName = "use-local-storage") {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.stringify(value);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
throw new Error(`@mantine/hooks ${hookName}: Failed to serialize the value`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function deserializeJSON(value) {
|
|
13
|
+
try {
|
|
14
|
+
return value && JSON.parse(value);
|
|
15
|
+
} catch {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function createStorageHandler(type) {
|
|
20
|
+
const getItem = (key) => {
|
|
21
|
+
try {
|
|
22
|
+
return window[type].getItem(key);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.warn("use-local-storage: Failed to get value from storage, localStorage is blocked");
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const setItem = (key, value) => {
|
|
29
|
+
try {
|
|
30
|
+
window[type].setItem(key, value);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.warn("use-local-storage: Failed to set value to storage, localStorage is blocked");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const removeItem = (key) => {
|
|
36
|
+
try {
|
|
37
|
+
window[type].removeItem(key);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.warn(
|
|
40
|
+
"use-local-storage: Failed to remove value from storage, localStorage is blocked"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return { getItem, setItem, removeItem };
|
|
45
|
+
}
|
|
46
|
+
function createStorage(type, hookName) {
|
|
47
|
+
const eventName = "mantine-local-storage";
|
|
48
|
+
const { getItem, setItem, removeItem } = createStorageHandler(type);
|
|
49
|
+
return function useStorage({
|
|
50
|
+
key,
|
|
51
|
+
defaultValue,
|
|
52
|
+
getInitialValueInEffect = true,
|
|
53
|
+
sync = true,
|
|
54
|
+
deserialize = deserializeJSON,
|
|
55
|
+
serialize = (value) => serializeJSON(value, hookName)
|
|
56
|
+
}) {
|
|
57
|
+
const readStorageValue = useCallback(
|
|
58
|
+
(skipStorage) => {
|
|
59
|
+
let storageBlockedOrSkipped;
|
|
60
|
+
try {
|
|
61
|
+
storageBlockedOrSkipped = typeof window === "undefined" || !(type in window) || window[type] === null || !!skipStorage;
|
|
62
|
+
} catch (_e) {
|
|
63
|
+
storageBlockedOrSkipped = true;
|
|
64
|
+
}
|
|
65
|
+
if (storageBlockedOrSkipped) {
|
|
66
|
+
return defaultValue;
|
|
67
|
+
}
|
|
68
|
+
const storageValue = getItem(key);
|
|
69
|
+
return storageValue !== null ? deserialize(storageValue) : defaultValue;
|
|
70
|
+
},
|
|
71
|
+
[key, defaultValue]
|
|
72
|
+
);
|
|
73
|
+
const [value, setValue] = useState(readStorageValue(getInitialValueInEffect));
|
|
74
|
+
const setStorageValue = useCallback(
|
|
75
|
+
(val) => {
|
|
76
|
+
if (val instanceof Function) {
|
|
77
|
+
setValue((current) => {
|
|
78
|
+
const result = val(current);
|
|
79
|
+
setItem(key, serialize(result));
|
|
80
|
+
queueMicrotask(() => {
|
|
81
|
+
window.dispatchEvent(
|
|
82
|
+
new CustomEvent(eventName, { detail: { key, value: val(current) } })
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
return result;
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
setItem(key, serialize(val));
|
|
89
|
+
window.dispatchEvent(new CustomEvent(eventName, { detail: { key, value: val } }));
|
|
90
|
+
setValue(val);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
[key]
|
|
94
|
+
);
|
|
95
|
+
const removeStorageValue = useCallback(() => {
|
|
96
|
+
removeItem(key);
|
|
97
|
+
setValue(defaultValue);
|
|
98
|
+
window.dispatchEvent(new CustomEvent(eventName, { detail: { key, value: defaultValue } }));
|
|
99
|
+
}, [key, defaultValue]);
|
|
100
|
+
useWindowEvent("storage", (event) => {
|
|
101
|
+
if (sync) {
|
|
102
|
+
if (event.storageArea === window[type] && event.key === key) {
|
|
103
|
+
setValue(deserialize(event.newValue ?? void 0));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
useWindowEvent(eventName, (event) => {
|
|
108
|
+
if (sync) {
|
|
109
|
+
if (event.detail.key === key) {
|
|
110
|
+
setValue(event.detail.value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (defaultValue !== void 0 && value === void 0) {
|
|
116
|
+
setStorageValue(defaultValue);
|
|
117
|
+
}
|
|
118
|
+
}, [defaultValue, value, setStorageValue]);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const val = readStorageValue();
|
|
121
|
+
val !== void 0 && setStorageValue(val);
|
|
122
|
+
}, [key]);
|
|
123
|
+
return [value === void 0 ? defaultValue : value, setStorageValue, removeStorageValue];
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
createStorage
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=create-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-storage.js","sources":["../../../../../../node_modules/@mantine/hooks/esm/use-local-storage/create-storage.mjs"],"sourcesContent":["'use client';\nimport { useCallback, useState, useEffect } from 'react';\nimport { useWindowEvent } from '../use-window-event/use-window-event.mjs';\n\nfunction serializeJSON(value, hookName = \"use-local-storage\") {\n try {\n return JSON.stringify(value);\n } catch (error) {\n throw new Error(`@mantine/hooks ${hookName}: Failed to serialize the value`);\n }\n}\nfunction deserializeJSON(value) {\n try {\n return value && JSON.parse(value);\n } catch {\n return value;\n }\n}\nfunction createStorageHandler(type) {\n const getItem = (key) => {\n try {\n return window[type].getItem(key);\n } catch (error) {\n console.warn(\"use-local-storage: Failed to get value from storage, localStorage is blocked\");\n return null;\n }\n };\n const setItem = (key, value) => {\n try {\n window[type].setItem(key, value);\n } catch (error) {\n console.warn(\"use-local-storage: Failed to set value to storage, localStorage is blocked\");\n }\n };\n const removeItem = (key) => {\n try {\n window[type].removeItem(key);\n } catch (error) {\n console.warn(\n \"use-local-storage: Failed to remove value from storage, localStorage is blocked\"\n );\n }\n };\n return { getItem, setItem, removeItem };\n}\nfunction createStorage(type, hookName) {\n const eventName = type === \"localStorage\" ? \"mantine-local-storage\" : \"mantine-session-storage\";\n const { getItem, setItem, removeItem } = createStorageHandler(type);\n return function useStorage({\n key,\n defaultValue,\n getInitialValueInEffect = true,\n sync = true,\n deserialize = deserializeJSON,\n serialize = (value) => serializeJSON(value, hookName)\n }) {\n const readStorageValue = useCallback(\n (skipStorage) => {\n let storageBlockedOrSkipped;\n try {\n storageBlockedOrSkipped = typeof window === \"undefined\" || !(type in window) || window[type] === null || !!skipStorage;\n } catch (_e) {\n storageBlockedOrSkipped = true;\n }\n if (storageBlockedOrSkipped) {\n return defaultValue;\n }\n const storageValue = getItem(key);\n return storageValue !== null ? deserialize(storageValue) : defaultValue;\n },\n [key, defaultValue]\n );\n const [value, setValue] = useState(readStorageValue(getInitialValueInEffect));\n const setStorageValue = useCallback(\n (val) => {\n if (val instanceof Function) {\n setValue((current) => {\n const result = val(current);\n setItem(key, serialize(result));\n queueMicrotask(() => {\n window.dispatchEvent(\n new CustomEvent(eventName, { detail: { key, value: val(current) } })\n );\n });\n return result;\n });\n } else {\n setItem(key, serialize(val));\n window.dispatchEvent(new CustomEvent(eventName, { detail: { key, value: val } }));\n setValue(val);\n }\n },\n [key]\n );\n const removeStorageValue = useCallback(() => {\n removeItem(key);\n setValue(defaultValue);\n window.dispatchEvent(new CustomEvent(eventName, { detail: { key, value: defaultValue } }));\n }, [key, defaultValue]);\n useWindowEvent(\"storage\", (event) => {\n if (sync) {\n if (event.storageArea === window[type] && event.key === key) {\n setValue(deserialize(event.newValue ?? void 0));\n }\n }\n });\n useWindowEvent(eventName, (event) => {\n if (sync) {\n if (event.detail.key === key) {\n setValue(event.detail.value);\n }\n }\n });\n useEffect(() => {\n if (defaultValue !== void 0 && value === void 0) {\n setStorageValue(defaultValue);\n }\n }, [defaultValue, value, setStorageValue]);\n useEffect(() => {\n const val = readStorageValue();\n val !== void 0 && setStorageValue(val);\n }, [key]);\n return [value === void 0 ? defaultValue : value, setStorageValue, removeStorageValue];\n };\n}\nfunction readValue(type) {\n const { getItem } = createStorageHandler(type);\n return function read({\n key,\n defaultValue,\n deserialize = deserializeJSON\n }) {\n let storageBlockedOrSkipped;\n try {\n storageBlockedOrSkipped = typeof window === \"undefined\" || !(type in window) || window[type] === null;\n } catch (_e) {\n storageBlockedOrSkipped = true;\n }\n if (storageBlockedOrSkipped) {\n return defaultValue;\n }\n const storageValue = getItem(key);\n return storageValue !== null ? deserialize(storageValue) : defaultValue;\n };\n}\n\nexport { createStorage, readValue };\n//# sourceMappingURL=create-storage.mjs.map\n"],"names":[],"mappings":"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","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-local-storage.js","sources":["../../../../../../node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.mjs"],"sourcesContent":["'use client';\nimport { readValue, createStorage } from './create-storage.mjs';\n\nfunction useLocalStorage(props) {\n return createStorage(\"localStorage\", \"use-local-storage\")(props);\n}\nconst readLocalStorageValue = readValue(\"localStorage\");\n\nexport { readLocalStorageValue, useLocalStorage };\n//# sourceMappingURL=use-local-storage.mjs.map\n"],"names":[],"mappings":";AAGA,SAAS,gBAAgB,OAAO;AAC9B,SAAO,cAAc,gBAAgB,mBAAmB,EAAE,KAAK;AACjE;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const useEffect = window["React"].useEffect;
|
|
2
|
+
function useWindowEvent(type, listener, options) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
window.addEventListener(type, listener, options);
|
|
5
|
+
return () => window.removeEventListener(type, listener, options);
|
|
6
|
+
}, [type, listener]);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
useWindowEvent
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=use-window-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-event.js","sources":["../../../../../../node_modules/@mantine/hooks/esm/use-window-event/use-window-event.mjs"],"sourcesContent":["'use client';\nimport { useEffect } from 'react';\n\nfunction useWindowEvent(type, listener, options) {\n useEffect(() => {\n window.addEventListener(type, listener, options);\n return () => window.removeEventListener(type, listener, options);\n }, [type, listener]);\n}\n\nexport { useWindowEvent };\n//# sourceMappingURL=use-window-event.mjs.map\n"],"names":[],"mappings":"AACA,MAAA,YAAA,OAAA,OAAA,EAAA;AAEA,SAAS,eAAe,MAAM,UAAU,SAAS;AAC/C,YAAU,MAAM;AACd,WAAO,iBAAiB,MAAM,UAAU,OAAO;AAC/C,WAAO,MAAM,OAAO,oBAAoB,MAAM,UAAU,OAAO;AAAA,EACjE,GAAG,CAAC,MAAM,QAAQ,CAAC;AACrB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random-id.js","sources":["../../../../../../../node_modules/@mantine/hooks/esm/utils/random-id/random-id.mjs"],"sourcesContent":["'use client';\nfunction randomId(prefix = \"mantine-\") {\n return `${prefix}${Math.random().toString(36).slice(2, 11)}`;\n}\n\nexport { randomId };\n//# sourceMappingURL=random-id.mjs.map\n"],"names":[],"mappings":"AACA,SAAS,SAAS,SAAS,YAAY;AACrC,SAAO,GAAG,MAAM,GAAG,KAAK,OAAM,EAAG,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAC5D;","x_google_ignoreList":[0]}
|