@inventreedb/ui 0.10.1 → 0.11.1

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.
Files changed (178) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/.vite/manifest.json +421 -1
  3. package/dist/components/Boundary.d.ts +10 -0
  4. package/dist/components/Boundary.js +37 -0
  5. package/dist/components/Boundary.js.map +1 -0
  6. package/dist/components/CopyButton.d.ts +13 -0
  7. package/dist/components/CopyButton.js +51 -0
  8. package/dist/components/CopyButton.js.map +1 -0
  9. package/dist/components/CopyableCell.d.ts +11 -0
  10. package/dist/components/CopyableCell.js +24 -0
  11. package/dist/components/CopyableCell.js.map +1 -0
  12. package/dist/components/InvenTreeTable.d.ts +17 -0
  13. package/dist/components/InvenTreeTable.js +41 -0
  14. package/dist/components/InvenTreeTable.js.map +1 -0
  15. package/dist/components/TableColumnSelect.d.ts +4 -0
  16. package/dist/components/TableColumnSelect.js +38 -0
  17. package/dist/components/TableColumnSelect.js.map +1 -0
  18. package/dist/enums/ApiEndpoints.d.ts +1 -1
  19. package/dist/enums/ApiEndpoints.js +1 -1
  20. package/dist/enums/ApiEndpoints.js.map +1 -1
  21. package/dist/enums/ModelInformation.js +17 -0
  22. package/dist/enums/ModelInformation.js.map +1 -1
  23. package/dist/enums/ModelType.d.ts +1 -0
  24. package/dist/enums/ModelType.js +1 -0
  25. package/dist/enums/ModelType.js.map +1 -1
  26. package/dist/functions/Forms.d.ts +11 -0
  27. package/dist/functions/Forms.js +27 -0
  28. package/dist/functions/Forms.js.map +1 -0
  29. package/dist/functions/Notification.d.ts +16 -0
  30. package/dist/functions/Notification.js +82 -0
  31. package/dist/functions/Notification.js.map +1 -0
  32. package/dist/functions/String.d.ts +13 -0
  33. package/dist/functions/String.js +25 -0
  34. package/dist/functions/String.js.map +1 -0
  35. package/dist/hooks/UseFilterSet.d.ts +2 -0
  36. package/dist/hooks/UseFilterSet.js +35 -0
  37. package/dist/hooks/UseFilterSet.js.map +1 -0
  38. package/dist/hooks/UseTable.d.ts +12 -0
  39. package/dist/hooks/UseTable.js +84 -0
  40. package/dist/hooks/UseTable.js.map +1 -0
  41. package/dist/index.d.ts +13 -2
  42. package/dist/index.js +32 -4
  43. package/dist/index.js.map +1 -1
  44. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js +129 -0
  45. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js.map +1 -0
  46. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js +8 -0
  47. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js.map +1 -0
  48. package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js +11 -0
  49. package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js.map +1 -0
  50. package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js +7 -0
  51. package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js.map +1 -0
  52. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js +5 -0
  53. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js.map +1 -0
  54. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js +6 -0
  55. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js.map +1 -0
  56. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js +54 -0
  57. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js.map +1 -0
  58. package/dist/node_modules/@sentry/core/build/esm/api.js +41 -0
  59. package/dist/node_modules/@sentry/core/build/esm/api.js.map +1 -0
  60. package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js +13 -0
  61. package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js.map +1 -0
  62. package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js +124 -0
  63. package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js.map +1 -0
  64. package/dist/node_modules/@sentry/core/build/esm/carrier.js +22 -0
  65. package/dist/node_modules/@sentry/core/build/esm/carrier.js.map +1 -0
  66. package/dist/node_modules/@sentry/core/build/esm/currentScopes.js +34 -0
  67. package/dist/node_modules/@sentry/core/build/esm/currentScopes.js.map +1 -0
  68. package/dist/node_modules/@sentry/core/build/esm/debug-build.js +5 -0
  69. package/dist/node_modules/@sentry/core/build/esm/debug-build.js.map +1 -0
  70. package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js +13 -0
  71. package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js.map +1 -0
  72. package/dist/node_modules/@sentry/core/build/esm/exports.js +13 -0
  73. package/dist/node_modules/@sentry/core/build/esm/exports.js.map +1 -0
  74. package/dist/node_modules/@sentry/core/build/esm/scope.js +577 -0
  75. package/dist/node_modules/@sentry/core/build/esm/scope.js.map +1 -0
  76. package/dist/node_modules/@sentry/core/build/esm/session.js +61 -0
  77. package/dist/node_modules/@sentry/core/build/esm/session.js.map +1 -0
  78. package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js +39 -0
  79. package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js.map +1 -0
  80. package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js +79 -0
  81. package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js.map +1 -0
  82. package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js +88 -0
  83. package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js.map +1 -0
  84. package/dist/node_modules/@sentry/core/build/esm/utils/is.js +35 -0
  85. package/dist/node_modules/@sentry/core/build/esm/utils/is.js.map +1 -0
  86. package/dist/node_modules/@sentry/core/build/esm/utils/merge.js +19 -0
  87. package/dist/node_modules/@sentry/core/build/esm/utils/merge.js.map +1 -0
  88. package/dist/node_modules/@sentry/core/build/esm/utils/misc.js +32 -0
  89. package/dist/node_modules/@sentry/core/build/esm/utils/misc.js.map +1 -0
  90. package/dist/node_modules/@sentry/core/build/esm/utils/object.js +18 -0
  91. package/dist/node_modules/@sentry/core/build/esm/utils/object.js.map +1 -0
  92. package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js +34 -0
  93. package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js.map +1 -0
  94. package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js +8 -0
  95. package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js.map +1 -0
  96. package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js +27 -0
  97. package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js.map +1 -0
  98. package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js +17 -0
  99. package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js.map +1 -0
  100. package/dist/node_modules/@sentry/core/build/esm/utils/string.js +10 -0
  101. package/dist/node_modules/@sentry/core/build/esm/utils/string.js.map +1 -0
  102. package/dist/node_modules/@sentry/core/build/esm/utils/time.js +26 -0
  103. package/dist/node_modules/@sentry/core/build/esm/utils/time.js.map +1 -0
  104. package/dist/node_modules/@sentry/core/build/esm/utils/version.js +5 -0
  105. package/dist/node_modules/@sentry/core/build/esm/utils/version.js.map +1 -0
  106. package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js +5 -0
  107. package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js.map +1 -0
  108. package/dist/node_modules/@sentry/react/build/esm/debug-build.js +5 -0
  109. package/dist/node_modules/@sentry/react/build/esm/debug-build.js.map +1 -0
  110. package/dist/node_modules/@sentry/react/build/esm/error.js +40 -0
  111. package/dist/node_modules/@sentry/react/build/esm/error.js.map +1 -0
  112. package/dist/node_modules/@sentry/react/build/esm/errorboundary.js +103 -0
  113. package/dist/node_modules/@sentry/react/build/esm/errorboundary.js.map +1 -0
  114. package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -6
  115. package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js.map +1 -1
  116. package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -6
  117. package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js.map +1 -1
  118. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js +8 -0
  119. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js.map +1 -0
  120. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -6
  121. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js.map +1 -1
  122. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +8 -0
  123. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js.map +1 -0
  124. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +0 -6
  125. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -1
  126. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js +0 -6
  127. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js.map +1 -1
  128. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -6
  129. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js.map +1 -1
  130. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js +0 -6
  131. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js.map +1 -1
  132. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js +0 -6
  133. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js.map +1 -1
  134. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +0 -6
  135. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -1
  136. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js +0 -6
  137. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js.map +1 -1
  138. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -6
  139. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js.map +1 -1
  140. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +0 -6
  141. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js.map +1 -1
  142. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +1 -10
  143. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
  144. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +1 -10
  145. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +1 -1
  146. package/dist/node_modules/zustand/esm/middleware.js +202 -0
  147. package/dist/node_modules/zustand/esm/middleware.js.map +1 -0
  148. package/dist/node_modules/zustand/esm/react.js +24 -0
  149. package/dist/node_modules/zustand/esm/react.js.map +1 -0
  150. package/dist/node_modules/zustand/esm/vanilla.js +26 -0
  151. package/dist/node_modules/zustand/esm/vanilla.js.map +1 -0
  152. package/dist/states/StoredTableState.d.ts +37 -0
  153. package/dist/states/StoredTableState.js +58 -0
  154. package/dist/states/StoredTableState.js.map +1 -0
  155. package/dist/types/Forms.d.ts +2 -0
  156. package/dist/types/Plugins.d.ts +14 -7
  157. package/dist/types/Plugins.js +1 -1
  158. package/dist/types/Plugins.js.map +1 -1
  159. package/dist/types/Tables.d.ts +11 -4
  160. package/lib/components/Boundary.tsx +46 -0
  161. package/lib/components/CopyButton.tsx +76 -0
  162. package/lib/components/CopyableCell.tsx +51 -0
  163. package/lib/components/InvenTreeTable.tsx +63 -0
  164. package/lib/components/TableColumnSelect.tsx +40 -0
  165. package/lib/enums/ApiEndpoints.tsx +1 -1
  166. package/lib/enums/ModelInformation.tsx +7 -0
  167. package/lib/enums/ModelType.tsx +1 -0
  168. package/lib/functions/Forms.tsx +47 -0
  169. package/lib/functions/Notification.tsx +50 -0
  170. package/lib/functions/String.tsx +38 -0
  171. package/lib/hooks/UseFilterSet.tsx +47 -0
  172. package/lib/hooks/UseTable.tsx +149 -0
  173. package/lib/index.ts +49 -1
  174. package/lib/states/StoredTableState.tsx +91 -0
  175. package/lib/types/Forms.tsx +2 -0
  176. package/lib/types/Plugins.tsx +15 -7
  177. package/lib/types/Tables.tsx +12 -7
  178. 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,2 @@
1
+ import { FilterSetState, TableFilter } from '../types/Filters';
2
+ export default function useFilterSet(filterKey: string, initialFilters?: TableFilter[]): FilterSetState;
@@ -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,84 @@
1
+ import useFilterSet from "./UseFilterSet.js";
2
+ import { randomId } from "../node_modules/@mantine/hooks/esm/utils/random-id/random-id.js";
3
+ const useCallback = window["React"].useCallback;
4
+ const useMemo = window["React"].useMemo;
5
+ const useState = window["React"].useState;
6
+ function useTable(tableName, tableProps = {
7
+ idAccessor: "pk",
8
+ initialFilters: []
9
+ }) {
10
+ function generateTableName() {
11
+ return `${tableName.replaceAll("-", "")}-${randomId()}`;
12
+ }
13
+ const [tableKey, setTableKey] = useState(generateTableName());
14
+ const refreshTable = useCallback((clearSelection) => {
15
+ setTableKey(generateTableName());
16
+ if (clearSelection) {
17
+ clearSelectedRecords();
18
+ }
19
+ }, [generateTableName]);
20
+ const filterSet = useFilterSet(`table-${tableName}`, tableProps.initialFilters);
21
+ const [expandedRecords, setExpandedRecords] = useState([]);
22
+ const isRowExpanded = useCallback((pk) => {
23
+ return expandedRecords.includes(pk);
24
+ }, [expandedRecords]);
25
+ const [hiddenColumns, setHiddenColumns] = useState([]);
26
+ const [selectedRecords, setSelectedRecords] = useState([]);
27
+ const selectedIds = useMemo(() => selectedRecords.map((r) => r[tableProps.idAccessor || "pk"]), [selectedRecords]);
28
+ const clearSelectedRecords = useCallback(() => {
29
+ setSelectedRecords([]);
30
+ }, []);
31
+ const hasSelectedRecords = useMemo(() => {
32
+ return selectedRecords.length > 0;
33
+ }, [selectedRecords]);
34
+ const [recordCount, setRecordCount] = useState(0);
35
+ const [page, setPage] = useState(1);
36
+ const [searchTerm, setSearchTerm] = useState("");
37
+ const [records, setRecords] = useState([]);
38
+ const updateRecord = useCallback((record) => {
39
+ const _records = [...records];
40
+ const index = _records.findIndex((r) => r[tableProps.idAccessor || "pk"] === record.pk);
41
+ if (index >= 0) {
42
+ _records[index] = {
43
+ ..._records[index],
44
+ ...record
45
+ };
46
+ } else {
47
+ _records.push(record);
48
+ }
49
+ setRecords(_records);
50
+ }, [records]);
51
+ const idAccessor = useMemo(() => tableProps.idAccessor || "pk", [tableProps.idAccessor]);
52
+ const [isLoading, setIsLoading] = useState(false);
53
+ return {
54
+ tableKey,
55
+ refreshTable,
56
+ isLoading,
57
+ setIsLoading,
58
+ filterSet,
59
+ expandedRecords,
60
+ setExpandedRecords,
61
+ isRowExpanded,
62
+ selectedRecords,
63
+ selectedIds,
64
+ setSelectedRecords,
65
+ clearSelectedRecords,
66
+ hasSelectedRecords,
67
+ searchTerm,
68
+ setSearchTerm,
69
+ recordCount,
70
+ setRecordCount,
71
+ hiddenColumns,
72
+ setHiddenColumns,
73
+ page,
74
+ setPage,
75
+ records,
76
+ setRecords,
77
+ updateRecord,
78
+ idAccessor
79
+ };
80
+ }
81
+ export {
82
+ useTable as default
83
+ };
84
+ //# 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';\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 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 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","tableKey","setTableKey","useState","refreshTable","useCallback","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;;;AAiBA,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;AAEA,QAAM,CAACC,UAAUC,WAAW,IAAIC,SAAiBL,mBAAmB;AAGpE,QAAMM,eAAeC,YACnB,CAACC,mBAA6B;AAC5BJ,gBAAYJ,mBAAmB;AAC/B,QAAIQ,gBAAgB;AAClBC,2BAAAA;AAAAA,IACF;AAAA,EACF,GACA,CAACT,iBAAiB,CACpB;AAEA,QAAMU,YAA4BC,aAChC,SAASf,SAAS,IAClBC,WAAWE,cACb;AAGA,QAAM,CAACa,iBAAiBC,kBAAkB,IAAIR,SAAgB,CAAA,CAAE;AAGhE,QAAMS,gBAAgBP,YACpB,CAACQ,OAAe;AACd,WAAOH,gBAAgBI,SAASD,EAAE;AAAA,EACpC,GACA,CAACH,eAAe,CAClB;AAGA,QAAM,CAACK,eAAeC,gBAAgB,IAAIb,SAAmB,CAAA,CAAE;AAG/D,QAAM,CAACc,iBAAiBC,kBAAkB,IAAIf,SAAgB,CAAA,CAAE;AAGhE,QAAMgB,cAAcC,QAClB,MAAMH,gBAAgBI,IAAKC,CAAAA,MAAMA,EAAE3B,WAAWC,cAAc,IAAI,CAAC,GACjE,CAACqB,eAAe,CAClB;AAEA,QAAMV,uBAAuBF,YAAY,MAAM;AAC7Ca,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,IAAIvB,SAAiB,CAAC;AAExD,QAAM,CAACwB,MAAMC,OAAO,IAAIzB,SAAiB,CAAC;AAG1C,QAAM,CAAC0B,YAAYC,aAAa,IAAI3B,SAAiB,EAAE;AAGvD,QAAM,CAAC4B,SAASC,UAAU,IAAI7B,SAAgB,CAAA,CAAE;AAGhD,QAAM8B,eAAe5B,YACnB,CAAC6B,WAAgB;AACf,UAAMC,WAAW,CAAC,GAAGJ,OAAO;AAG5B,UAAMK,QAAQD,SAASE,UACpBf,CAAAA,MAAMA,EAAE3B,WAAWC,cAAc,IAAI,MAAMsC,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,QAAMnC,aAAawB,QACjB,MAAMzB,WAAWC,cAAc,MAC/B,CAACD,WAAWC,UAAU,CACxB;AAEA,QAAM,CAAC2C,WAAWC,YAAY,IAAIrC,SAAkB,KAAK;AAEzD,SAAO;AAAA,IACLF;AAAAA,IACAG;AAAAA,IACAmC;AAAAA,IACAC;AAAAA,IACAhC;AAAAA,IACAE;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,IACArC;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 default2 } from "./hooks/MonitorDataOutput.js";
17
- import { default as default3 } from "./hooks/MonitorBackgroundTask.js";
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
- default3 as useMonitorBackgroundTask,
50
- default2 as useMonitorDataOutput
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,8 @@
1
+ import { createStorage } from "./create-storage.js";
2
+ function useLocalStorage(props) {
3
+ return createStorage("localStorage", "use-local-storage")(props);
4
+ }
5
+ export {
6
+ useLocalStorage
7
+ };
8
+ //# sourceMappingURL=use-local-storage.js.map
@@ -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,7 @@
1
+ function randomId(prefix = "mantine-") {
2
+ return `${prefix}${Math.random().toString(36).slice(2, 11)}`;
3
+ }
4
+ export {
5
+ randomId
6
+ };
7
+ //# sourceMappingURL=random-id.js.map
@@ -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]}
@@ -0,0 +1,5 @@
1
+ const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
2
+ export {
3
+ DEBUG_BUILD
4
+ };
5
+ //# sourceMappingURL=debug-build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-build.js","sources":["../../../../../../../../node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js"],"sourcesContent":["/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nconst DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);\n\nexport { DEBUG_BUILD };\n//# sourceMappingURL=debug-build.js.map\n"],"names":[],"mappings":"AAKK,MAAC,cAAe,OAAO,qBAAqB,eAAe;","x_google_ignoreList":[0]}
@@ -0,0 +1,6 @@
1
+ import { GLOBAL_OBJ } from "../../../../../core/build/esm/utils/worldwide.js";
2
+ const WINDOW = GLOBAL_OBJ;
3
+ export {
4
+ WINDOW
5
+ };
6
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../../../../../../../../node_modules/@sentry/browser/build/npm/esm/prod/helpers.js"],"sourcesContent":["import { GLOBAL_OBJ, getOriginalFunction, markFunctionWrapped, addNonEnumerableProperty, withScope, addExceptionTypeValue, addExceptionMechanism, captureException, getLocationHref } from '@sentry/core';\n\nconst WINDOW = GLOBAL_OBJ ;\n\nlet ignoreOnError = 0;\n\n/**\n * @hidden\n */\nfunction shouldIgnoreOnError() {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nfunction ignoreNextOnError() {\n // onerror should trigger before setTimeout\n ignoreOnError++;\n setTimeout(() => {\n ignoreOnError--;\n });\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap. It is generally safe to pass an unbound function, because the returned wrapper always\n * has a correct `this` context.\n * @returns The wrapped function.\n * @hidden\n */\nfunction wrap(\n fn,\n options\n\n = {},\n) {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n function isFunction(fn) {\n return typeof fn === 'function';\n }\n\n if (!isFunction(fn)) {\n return fn;\n }\n\n try {\n // if we're dealing with a function that was previously wrapped, return\n // the original wrapper.\n const wrapper = (fn ).__sentry_wrapped__;\n if (wrapper) {\n if (typeof wrapper === 'function') {\n return wrapper;\n } else {\n // If we find that the `__sentry_wrapped__` function is not a function at the time of accessing it, it means\n // that something messed with it. In that case we want to return the originally passed function.\n return fn;\n }\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n // Wrap the function itself\n // It is important that `sentryWrapped` is not an arrow function to preserve the context of `this`\n const sentryWrapped = function ( ...args) {\n try {\n // Also wrap arguments that are themselves functions\n const wrappedArguments = args.map(arg => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n // no need to add a mechanism here, we already add it via an event processor above\n captureException(ex);\n });\n\n throw ex;\n }\n } ;\n\n // Wrap the wrapped function in a proxy, to ensure any other properties of the original function remain available\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property ] = fn[property ];\n }\n }\n } catch {\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n }\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name');\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get() {\n return fn.name;\n },\n });\n }\n } catch {\n // This may throw if e.g. the descriptor does not exist, or a browser does not allow redefining `name`.\n // to save some bytes we simply try-catch this\n }\n\n return sentryWrapped;\n}\n\n/**\n * Get HTTP request data from the current page.\n */\nfunction getHttpRequestData() {\n // grab as much info as exists and add it to the event\n const url = getLocationHref();\n const { referrer } = WINDOW.document || {};\n const { userAgent } = WINDOW.navigator || {};\n\n const headers = {\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = {\n url,\n headers,\n };\n\n return request;\n}\n\nexport { WINDOW, getHttpRequestData, ignoreNextOnError, shouldIgnoreOnError, wrap };\n//# sourceMappingURL=helpers.js.map\n"],"names":[],"mappings":";AAEK,MAAC,SAAS;","x_google_ignoreList":[0]}