@dashadmin/dash-auto-admin 1.3.24 → 1.3.26

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 (176) hide show
  1. package/dist/DashAutoAdminComponentRegistry.js +64 -1
  2. package/dist/DashAutoAdminForm.js +137 -1
  3. package/dist/DashAutoAdminResizableDrawer.js +63 -1
  4. package/dist/DashAutoAdminSaveButton.js +57 -1
  5. package/dist/DashAutoCreate.js +102 -1
  6. package/dist/DashAutoDrawer.js +256 -1
  7. package/dist/DashAutoEdit.js +99 -1
  8. package/dist/DashAutoFiltersGenerator.js +193 -1
  9. package/dist/DashAutoFormGroups.js +118 -1
  10. package/dist/DashAutoFormLayout.js +68 -1
  11. package/dist/DashAutoFormMuiTabs.js +291 -1
  12. package/dist/DashAutoFormTabs.js +132 -1
  13. package/dist/DashAutoGroup.js +27 -1
  14. package/dist/DashAutoLayout.js +31 -1
  15. package/dist/DashAutoList.js +218 -1
  16. package/dist/DashAutoPostFilterForm.js +47 -1
  17. package/dist/DashAutoReferenceTab.js +10 -1
  18. package/dist/DashAutoResource.js +77 -1
  19. package/dist/DashAutoResourceLayout.js +16 -1
  20. package/dist/DashAutoShow.js +195 -1
  21. package/dist/DashAutoTabbedForm.js +244 -1
  22. package/dist/DashAutoTabbedForm.review.js +221 -1
  23. package/dist/DashAutoTabs.js +11 -1
  24. package/dist/DashFilterWrapper.js +62 -1
  25. package/dist/DashRedirect.js +56 -1
  26. package/dist/TabbedLayout.js +38 -1
  27. package/dist/common/DashAutoTitle.js +33 -1
  28. package/dist/common/components/FabButton.js +59 -1
  29. package/dist/common/components/TranslatedLabel.js +60 -1
  30. package/dist/common/settings/Settings.js +196 -1
  31. package/dist/common/settings/SettingsBarIcons.js +61 -1
  32. package/dist/context/DashAutoAdminFormContext.js +15 -1
  33. package/dist/hooks/useAutoAdminLoadingStateMediator.js +36 -1
  34. package/dist/hooks/useAutoAdminTranslate.js +61 -1
  35. package/dist/hooks/useHash.js +24 -1
  36. package/dist/hooks/useLogger.js +20 -1
  37. package/dist/hooks/useRoutePathPattern.js +20 -1
  38. package/dist/hooks/useVirtualHash.js +28 -1
  39. package/dist/index.js +77 -3406
  40. package/dist/list/DashAutoListActions.js +57 -1
  41. package/dist/list/DashAutoListDatagridWrapper.js +68 -1
  42. package/dist/list/DashAutoListDefaultActionsWrapper.js +14 -1
  43. package/dist/list/DashAutoListFilterFormWithButton.js +80 -1
  44. package/dist/list/DashAutoListTopToolbar.js +180 -1
  45. package/dist/mui/AttributeToField.js +576 -1
  46. package/dist/mui/AttributeToInput.js +630 -1
  47. package/dist/mui/AutoAdminResizableDrawer.js +63 -1
  48. package/dist/mui/AutoDataGrid.js +120 -1
  49. package/dist/mui/AutoReferenceFormTab.js +53 -1
  50. package/dist/mui/AutoReferenceTab.js +46 -1
  51. package/dist/mui/AutoTabs.js +19 -1
  52. package/dist/mui/components/ExtendedPagination.js +34 -1
  53. package/dist/mui/components/ListStringField.js +25 -1
  54. package/dist/providers/DashAuthProvider.js +215 -1
  55. package/dist/providers/DashDataProvider.js +310 -1
  56. package/dist/providers/index.js +10 -1
  57. package/dist/react-admin.d.js +0 -0
  58. package/dist/toolbar/buttons/BottomToolbarButtons.js +65 -1
  59. package/dist/toolbar/buttons/DashResourceButton.js +181 -1
  60. package/dist/toolbar/buttons/ListButtons.js +80 -1
  61. package/dist/toolbar/buttons/ToolbarButtons.js +135 -1
  62. package/dist/types/ActionCallback.d.js +0 -0
  63. package/dist/utils/SimpleLogger.js +52 -1
  64. package/dist/utils/enumToChoices.js +5 -1
  65. package/dist/utils/evalActionPermission.js +11 -1
  66. package/dist/utils/groupByTabs.js +21 -1
  67. package/dist/utils/hashedGroupByTabs.js +12 -1
  68. package/dist/utils/invertMap.js +12 -1
  69. package/dist/utils/isClassComponent.js +7 -1
  70. package/dist/utils/isComponent.js +29 -1
  71. package/dist/utils/isEnum.js +5 -1
  72. package/dist/utils/isFC.js +8 -1
  73. package/dist/utils/replaceParams.js +9 -1
  74. package/dist/utils/validate.js +19 -1
  75. package/dist/wrappers/UserAction.js +60 -1
  76. package/dist/wrappers/index.js +4 -1
  77. package/package.json +135 -120
  78. package/src/DashAutoAdminComponentRegistry.tsx +75 -0
  79. package/src/DashAutoAdminForm.tsx +155 -0
  80. package/src/DashAutoAdminResizableDrawer.tsx +69 -0
  81. package/src/DashAutoAdminSaveButton.tsx +116 -0
  82. package/src/DashAutoCreate.tsx +118 -0
  83. package/src/DashAutoDrawer.tsx +288 -0
  84. package/src/DashAutoEdit.tsx +109 -0
  85. package/src/DashAutoFiltersGenerator.tsx +208 -0
  86. package/src/DashAutoFormGroups.tsx +146 -0
  87. package/src/DashAutoFormLayout.tsx.review +113 -0
  88. package/src/DashAutoFormMuiTabs.tsx +368 -0
  89. package/src/DashAutoFormTabs.tsx +177 -0
  90. package/src/DashAutoGroup.tsx +42 -0
  91. package/src/DashAutoLayout.tsx +57 -0
  92. package/src/DashAutoList.tsx +237 -0
  93. package/src/DashAutoPostFilterForm.tsx +35 -0
  94. package/src/DashAutoReferenceTab.tsx +9 -0
  95. package/src/DashAutoResource.tsx +85 -0
  96. package/src/DashAutoResourceLayout.tsx +50 -0
  97. package/src/DashAutoShow.tsx +200 -0
  98. package/src/DashAutoTabbedForm.review.tsx +262 -0
  99. package/src/DashAutoTabbedForm.tsx +324 -0
  100. package/src/DashAutoTabs.tsx +19 -0
  101. package/src/DashFilterWrapper.tsx +43 -0
  102. package/src/DashRedirect.tsx +46 -0
  103. package/src/TabbedLayout.tsx +29 -0
  104. package/src/common/DashAutoTitle.tsx +24 -0
  105. package/src/common/components/FabButton.tsx +40 -0
  106. package/src/common/components/TranslatedLabel.tsx +81 -0
  107. package/src/common/settings/Settings.tsx +236 -0
  108. package/src/common/settings/SettingsBarIcons.tsx +72 -0
  109. package/src/context/DashAutoAdminFormContext.tsx +31 -0
  110. package/src/hooks/useAutoAdminLoadingStateMediator.tsx +42 -0
  111. package/src/hooks/useAutoAdminTranslate.tsx +106 -0
  112. package/src/hooks/useHash.tsx +27 -0
  113. package/src/hooks/useLogger.tsx +23 -0
  114. package/src/hooks/useRoutePathPattern.tsx +24 -0
  115. package/src/hooks/useVirtualHash.tsx +34 -0
  116. package/src/index.ts +85 -0
  117. package/src/interfaces/ICustomResourceSubComponent.ts +11 -0
  118. package/src/interfaces/IDashApplicationLayoutMainAction.ts +37 -0
  119. package/src/interfaces/IDashApplicationLayoutMenuItem.ts +24 -0
  120. package/src/interfaces/IDashAutoAdminAttribute.ts +104 -0
  121. package/src/interfaces/IDashAutoAdminCustomFieldComponent.ts +18 -0
  122. package/src/interfaces/IDashAutoAdminFormOptions.ts +22 -0
  123. package/src/interfaces/IDashAutoAdminListActions.ts +13 -0
  124. package/src/interfaces/IDashAutoAdminReference.ts +16 -0
  125. package/src/interfaces/IDashAutoAdminResourceConfig.ts +360 -0
  126. package/src/interfaces/IDashAutoForm.ts +24 -0
  127. package/src/interfaces/IDashAutoGridButton.ts +35 -0
  128. package/src/interfaces/IDashAutoShow.ts +12 -0
  129. package/src/interfaces/IGroupExtraData.ts +8 -0
  130. package/src/interfaces/IRecord.ts +7 -0
  131. package/src/interfaces/IReferenceFilter.ts +55 -0
  132. package/src/interfaces/IResourceComponent.ts +8 -0
  133. package/src/interfaces/IToolbarButton.ts +11 -0
  134. package/src/list/DashAutoListActions.tsx +88 -0
  135. package/src/list/DashAutoListDatagridWrapper.tsx +74 -0
  136. package/src/list/DashAutoListDefaultActionsWrapper.tsx +31 -0
  137. package/src/list/DashAutoListFilterFormWithButton.tsx +93 -0
  138. package/src/list/DashAutoListTopToolbar.tsx +240 -0
  139. package/src/mui/AttributeToField.tsx +657 -0
  140. package/src/mui/AttributeToInput.tsx +728 -0
  141. package/src/mui/AutoAdminResizableDrawer.tsx +69 -0
  142. package/src/mui/AutoDataGrid.tsx +127 -0
  143. package/src/mui/AutoReferenceFormTab.tsx +51 -0
  144. package/src/mui/AutoReferenceTab.tsx +45 -0
  145. package/src/mui/AutoTabs.tsx +32 -0
  146. package/src/mui/components/ExtendedPagination.tsx +23 -0
  147. package/src/mui/components/ListStringField.tsx +32 -0
  148. package/src/providers/DashAuthProvider.ts +341 -0
  149. package/src/providers/DashDataProvider.ts +466 -0
  150. package/src/providers/index.ts +17 -0
  151. package/src/toolbar/buttons/BottomToolbarButtons.tsx +59 -0
  152. package/src/toolbar/buttons/DashResourceButton.tsx +223 -0
  153. package/src/toolbar/buttons/ListButtons.tsx +137 -0
  154. package/src/toolbar/buttons/ToolbarButtons.tsx +186 -0
  155. package/src/utils/SimpleLogger.tsx +46 -0
  156. package/src/utils/enumToChoices.tsx +3 -0
  157. package/src/utils/evalActionPermission.tsx +14 -0
  158. package/src/utils/groupByTabs.tsx +23 -0
  159. package/src/utils/hashedGroupByTabs.tsx +16 -0
  160. package/src/utils/invertMap.tsx +10 -0
  161. package/src/utils/isClassComponent.tsx +9 -0
  162. package/src/utils/isComponent.tsx +45 -0
  163. package/src/utils/isEnum.tsx +3 -0
  164. package/src/utils/isFC.tsx +6 -0
  165. package/src/utils/replaceParams.tsx +6 -0
  166. package/src/utils/validate.tsx +24 -0
  167. package/src/wrappers/UserAction.tsx +67 -0
  168. package/src/wrappers/index.tsx +1 -0
  169. /package/{dist → src}/DashAutoAdminSaveButton.tsx.bkup +0 -0
  170. /package/{dist/DashAutoFormLayout.tsx.review → src/DashAutoFormLayout.tsx} +0 -0
  171. /package/{dist → src}/DashAutoFormTabs.review +0 -0
  172. /package/{dist → src}/DashAutoFormTabs.tsx.formcontext.wip +0 -0
  173. /package/{dist → src}/mui/AttributeToField.tsx.review +0 -0
  174. /package/{dist → src}/mui/AttributeToInput.tsx.review +0 -0
  175. /package/{dist → src}/react-admin.d.ts +0 -0
  176. /package/{dist → src}/types/ActionCallback.d.ts +0 -0
@@ -1 +1,33 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useTranslate as s}from"react-admin";const n=({resourceConfig:t,record:a,...r})=>{const e=s(),o=e(t.label,{_:t.label});return l("span",{children:a?`${e("dash.action.edit")} "${a[t.schema[0].attribute]}"`:o})};var c=n;export{c as default};
1
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
4
+ var __objRest = (source, exclude) => {
5
+ var target = {};
6
+ for (var prop in source)
7
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
8
+ target[prop] = source[prop];
9
+ if (source != null && __getOwnPropSymbols)
10
+ for (var prop of __getOwnPropSymbols(source)) {
11
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
12
+ target[prop] = source[prop];
13
+ }
14
+ return target;
15
+ };
16
+ import { jsx } from "react/jsx-runtime";
17
+ import { useTranslate } from "react-admin";
18
+ const DashAutoTitle = (_a) => {
19
+ var _b = _a, {
20
+ resourceConfig,
21
+ record
22
+ } = _b, _props = __objRest(_b, [
23
+ "resourceConfig",
24
+ "record"
25
+ ]);
26
+ const translate = useTranslate();
27
+ const translatedLabel = translate(resourceConfig.label, { _: resourceConfig.label });
28
+ return /* @__PURE__ */ jsx("span", { children: record ? `${translate("dash.action.edit")} "${record[resourceConfig.schema[0].attribute]}"` : translatedLabel });
29
+ };
30
+ var DashAutoTitle_default = DashAutoTitle;
31
+ export {
32
+ DashAutoTitle_default as default
33
+ };
@@ -1 +1,59 @@
1
- import{jsx as t}from"react/jsx-runtime";import{cloneElement as s}from"react";import r from"@mui/icons-material/Settings";import{Fab as c,Tooltip as m}from"@mui/material";const p=o=>{const{icon:e,onClick:n,tooltip:i,children:b,...l}=o,a=e?s(o.icon,{sx:{fontSize:16},fontSize:"small"}):t(r,{sx:{fontSize:16},fontSize:"small"});return t(m,{title:i,children:t(c,{size:"small","aria-label":"settings",color:"primary",onClick:n,style:{position:"absolute"},className:"toolbar-settings-button",...l,children:a})})};var C=p;export{p as FabButton,C as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { jsx } from "react/jsx-runtime";
33
+ import { cloneElement } from "react";
34
+ import Settings from "@mui/icons-material/Settings";
35
+ import { Fab, Tooltip } from "@mui/material";
36
+ const FabButton = (props) => {
37
+ const _a = props, { icon, onClick, tooltip, children } = _a, rest = __objRest(_a, ["icon", "onClick", "tooltip", "children"]);
38
+ const _icon = icon ? cloneElement(props.icon, { sx: { fontSize: 16 }, fontSize: "small" }) : /* @__PURE__ */ jsx(Settings, { sx: { fontSize: 16 }, fontSize: "small" });
39
+ return /* @__PURE__ */ jsx(Tooltip, { title: tooltip, children: /* @__PURE__ */ jsx(
40
+ Fab,
41
+ __spreadProps(__spreadValues({
42
+ size: "small",
43
+ "aria-label": "settings",
44
+ color: "primary",
45
+ onClick,
46
+ style: {
47
+ position: "absolute"
48
+ },
49
+ className: "toolbar-settings-button"
50
+ }, rest), {
51
+ children: _icon
52
+ })
53
+ ) });
54
+ };
55
+ var FabButton_default = FabButton;
56
+ export {
57
+ FabButton,
58
+ FabButton_default as default
59
+ };
@@ -1 +1,60 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useTranslate as i}from"react-admin";import{isTranslationKey as c}from"../../hooks/useAutoAdminTranslate";const m=({label:t,fallback:e="",className:a,component:n="span",componentProps:s={}})=>{const d=i();if(!t)return e?l(n,{className:a,...s,children:e}):null;let r=t;if(c(t)){const o=d(t,{_:t});o===t&&e?r=e:r=o}return l(n,{className:a,...s,children:r})},b=t=>e=>{const a=i();let n=e.label;return e.label&&c(e.label)&&(n=a(e.label,{_:e.label})),l(t,{...e,label:n})};var P=m;export{m as TranslatedLabel,P as default,b as withTranslatedLabel};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { jsx } from "react/jsx-runtime";
21
+ import { useTranslate } from "react-admin";
22
+ import { isTranslationKey } from "../../hooks/useAutoAdminTranslate";
23
+ const TranslatedLabel = ({
24
+ label,
25
+ fallback = "",
26
+ className,
27
+ component: Component = "span",
28
+ componentProps = {}
29
+ }) => {
30
+ const translate = useTranslate();
31
+ if (!label) {
32
+ return fallback ? /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({ className }, componentProps), { children: fallback })) : null;
33
+ }
34
+ let displayText = label;
35
+ if (isTranslationKey(label)) {
36
+ const translated = translate(label, { _: label });
37
+ if (translated === label && fallback) {
38
+ displayText = fallback;
39
+ } else {
40
+ displayText = translated;
41
+ }
42
+ }
43
+ return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({ className }, componentProps), { children: displayText }));
44
+ };
45
+ const withTranslatedLabel = (WrappedComponent) => {
46
+ return (props) => {
47
+ const translate = useTranslate();
48
+ let translatedLabel = props.label;
49
+ if (props.label && isTranslationKey(props.label)) {
50
+ translatedLabel = translate(props.label, { _: props.label });
51
+ }
52
+ return /* @__PURE__ */ jsx(WrappedComponent, __spreadProps(__spreadValues({}, props), { label: translatedLabel }));
53
+ };
54
+ };
55
+ var TranslatedLabel_default = TranslatedLabel;
56
+ export {
57
+ TranslatedLabel,
58
+ TranslatedLabel_default as default,
59
+ withTranslatedLabel
60
+ };
@@ -1 +1,196 @@
1
- import{Fragment as o,jsx as e,jsxs as l}from"react/jsx-runtime";import{Dialog as B,DialogContent as h,Drawer as w,Fade as T,Popover as k,Tooltip as p}from"@mui/material";import f,{memo as D}from"react";import{GearBadge as u,AlertBadge as C,ErrorBadge as S}from"./SettingsBarIcons";const M=({type:a,className:s,children:d,warning:t,error:i,gearIcon:v,...r})=>{t||(t={active:!1,message:""}),i||(i={active:!1,message:""});const[n,c]=f.useState(null),g=!!n,m=N=>{c(N.currentTarget)},E=()=>{c(null)};return l("div",{...s&&{className:s},children:[l("div",{className:"settings-widget-actions",children:[i.active&&e("div",{className:"settings-widget-action",children:e(S,{onClick:()=>{},children:e(o,{})})}),t.active&&e(p,{title:t.message,children:e("div",{className:"settings-widget-action",children:e(C,{onClick:()=>{},children:e(o,{})})})}),e("div",{className:"settings-widget-action",children:e(u,{icon:v,onClick:m,children:e(o,{})})})]}),e(k,{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},id:"fade-menu",anchorEl:n,open:g,onClose:E,TransitionComponent:T,children:e("div",{style:{padding:8},children:d})})]})},y=({type:a,className:s,children:d,warning:t,error:i,...v})=>{t||(t={active:!1,message:""}),i||(i={active:!1,message:""});const[r,n]=f.useState(!1),c=m=>{n(!0)},g=()=>{n(!1)};return l("div",{children:[l("div",{className:"settings-widget-actions",children:[i.active&&e("div",{className:"settings-widget-action",children:e(S,{onClick:()=>{},children:e(o,{})})}),t.active&&e(p,{title:t.message,children:e("div",{className:"settings-widget-action",children:e(C,{onClick:()=>{},children:e(o,{})})})}),e("div",{className:"settings-widget-action",children:e(u,{onClick:c,children:e(o,{})})})]}),e(B,{open:r,onClose:g,children:e(h,{children:d})})]})},A=({type:a,className:s,children:d,warning:t,error:i,...v})=>{t||(t={active:!1,message:""}),i||(i={active:!1,message:""});const[r,n]=f.useState(!1),c=m=>{n(!0)},g=()=>{n(!1)};return l("div",{children:[l("div",{className:"settings-widget-actions",children:[i.active&&e("div",{className:"settings-widget-action",children:e(S,{onClick:()=>{},children:e(o,{})})}),t.active&&e(p,{title:t.message,children:e("div",{className:"settings-widget-action",children:e(C,{onClick:()=>{},children:e(o,{})})})}),e("div",{className:"settings-widget-action",children:e(u,{onClick:c,children:e(o,{})})})]}),e(w,{open:r,onClose:g,anchor:"right",PaperProps:{sx:{width:"20%"}},children:d})]})},F=(a,s)=>a.data===s.data,I=({type:a="dialog",...s})=>{switch(a){case"tooltip":return e(M,{type:a,...s});case"drawer":return e(A,{type:a,...s});default:return e(y,{type:a,...s})}},R=D(I,F);var O=R;export{O as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
+ import {
34
+ Dialog,
35
+ DialogContent,
36
+ Drawer,
37
+ Fade,
38
+ Popover,
39
+ Tooltip
40
+ } from "@mui/material";
41
+ import React, { memo } from "react";
42
+ import { GearBadge, AlertBadge, ErrorBadge } from "./SettingsBarIcons";
43
+ const SettingsTooltip = (_a) => {
44
+ var _b = _a, {
45
+ type,
46
+ className,
47
+ children,
48
+ warning,
49
+ error,
50
+ gearIcon
51
+ } = _b, _props = __objRest(_b, [
52
+ "type",
53
+ "className",
54
+ "children",
55
+ "warning",
56
+ "error",
57
+ "gearIcon"
58
+ ]);
59
+ if (!warning) warning = { active: false, message: "" };
60
+ if (!error) error = { active: false, message: "" };
61
+ const [anchorEl, setAnchorEl] = React.useState(null);
62
+ const open = Boolean(anchorEl);
63
+ const openSettings = (event) => {
64
+ setAnchorEl(event.currentTarget);
65
+ };
66
+ const closeSettings = () => {
67
+ setAnchorEl(null);
68
+ };
69
+ return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, className && { className }), { children: [
70
+ /* @__PURE__ */ jsxs("div", { className: "settings-widget-actions", children: [
71
+ error.active && /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(ErrorBadge, { onClick: () => {
72
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }),
73
+ warning.active && /* @__PURE__ */ jsx(Tooltip, { title: warning.message, children: /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(AlertBadge, { onClick: () => {
74
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }) }),
75
+ /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(GearBadge, { icon: gearIcon, onClick: openSettings, children: /* @__PURE__ */ jsx(Fragment, {}) }) })
76
+ ] }),
77
+ /* @__PURE__ */ jsx(
78
+ Popover,
79
+ {
80
+ anchorOrigin: {
81
+ vertical: "bottom",
82
+ horizontal: "right"
83
+ },
84
+ transformOrigin: {
85
+ vertical: "top",
86
+ horizontal: "left"
87
+ },
88
+ id: "fade-menu",
89
+ anchorEl,
90
+ open,
91
+ onClose: closeSettings,
92
+ TransitionComponent: Fade,
93
+ children: /* @__PURE__ */ jsx("div", { style: { padding: 8 }, children })
94
+ }
95
+ )
96
+ ] }));
97
+ };
98
+ const SettingsDialog = (_c) => {
99
+ var _d = _c, {
100
+ type,
101
+ className,
102
+ children,
103
+ warning,
104
+ error
105
+ } = _d, _props = __objRest(_d, [
106
+ "type",
107
+ "className",
108
+ "children",
109
+ "warning",
110
+ "error"
111
+ ]);
112
+ if (!warning) warning = { active: false, message: "" };
113
+ if (!error) error = { active: false, message: "" };
114
+ const [open, setOpen] = React.useState(false);
115
+ const openSettings = (_event) => {
116
+ setOpen(true);
117
+ };
118
+ const closeSettings = () => {
119
+ setOpen(false);
120
+ };
121
+ return /* @__PURE__ */ jsxs("div", { children: [
122
+ /* @__PURE__ */ jsxs("div", { className: "settings-widget-actions", children: [
123
+ error.active && /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(ErrorBadge, { onClick: () => {
124
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }),
125
+ warning.active && /* @__PURE__ */ jsx(Tooltip, { title: warning.message, children: /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(AlertBadge, { onClick: () => {
126
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }) }),
127
+ /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(GearBadge, { onClick: openSettings, children: /* @__PURE__ */ jsx(Fragment, {}) }) })
128
+ ] }),
129
+ /* @__PURE__ */ jsx(Dialog, { open, onClose: closeSettings, children: /* @__PURE__ */ jsx(DialogContent, { children }) })
130
+ ] });
131
+ };
132
+ const SettingsDrawer = (_e) => {
133
+ var _f = _e, {
134
+ type,
135
+ className,
136
+ children,
137
+ warning,
138
+ error
139
+ } = _f, _props = __objRest(_f, [
140
+ "type",
141
+ "className",
142
+ "children",
143
+ "warning",
144
+ "error"
145
+ ]);
146
+ if (!warning) warning = { active: false, message: "" };
147
+ if (!error) error = { active: false, message: "" };
148
+ const [open, setOpen] = React.useState(false);
149
+ const openSettings = (_event) => {
150
+ setOpen(true);
151
+ };
152
+ const closeSettings = () => {
153
+ setOpen(false);
154
+ };
155
+ return /* @__PURE__ */ jsxs("div", { children: [
156
+ /* @__PURE__ */ jsxs("div", { className: "settings-widget-actions", children: [
157
+ error.active && /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(ErrorBadge, { onClick: () => {
158
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }),
159
+ warning.active && /* @__PURE__ */ jsx(Tooltip, { title: warning.message, children: /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(AlertBadge, { onClick: () => {
160
+ }, children: /* @__PURE__ */ jsx(Fragment, {}) }) }) }),
161
+ /* @__PURE__ */ jsx("div", { className: "settings-widget-action", children: /* @__PURE__ */ jsx(GearBadge, { onClick: openSettings, children: /* @__PURE__ */ jsx(Fragment, {}) }) })
162
+ ] }),
163
+ /* @__PURE__ */ jsx(
164
+ Drawer,
165
+ {
166
+ open,
167
+ onClose: closeSettings,
168
+ anchor: "right",
169
+ PaperProps: {
170
+ sx: { width: "20%" }
171
+ },
172
+ children
173
+ }
174
+ )
175
+ ] });
176
+ };
177
+ const propsAreEqual = (oldProps, newProps) => {
178
+ return oldProps.data === newProps.data;
179
+ };
180
+ const Settings = (_g) => {
181
+ var _h = _g, { type = "dialog" } = _h, props = __objRest(_h, ["type"]);
182
+ switch (type) {
183
+ case "tooltip":
184
+ return /* @__PURE__ */ jsx(SettingsTooltip, __spreadValues({ type }, props));
185
+ case "drawer":
186
+ return /* @__PURE__ */ jsx(SettingsDrawer, __spreadValues({ type }, props));
187
+ case "dialog":
188
+ default:
189
+ return /* @__PURE__ */ jsx(SettingsDialog, __spreadValues({ type }, props));
190
+ }
191
+ };
192
+ const MemoizedSettings = memo(Settings, propsAreEqual);
193
+ var Settings_default = MemoizedSettings;
194
+ export {
195
+ Settings_default as default
196
+ };
@@ -1 +1,61 @@
1
- import{jsx as t}from"react/jsx-runtime";import a from"@mui/material/Badge";import i from"@emotion/styled";import{Settings as l,Error as r,Warning as d}from"@mui/icons-material";import{cloneElement as c}from"react";import{Fab as g}from"@mui/material";const o=i(a)(({theme:e})=>({"& .MuiBadge-badge":{padding:0}})),y=e=>{const n=e.icon?c(e.icon,{sx:{fontSize:16},fontSize:"small"}):t(l,{sx:{fontSize:16},fontSize:"small"});return t(g,{size:"small","aria-label":"settings",color:"primary",onClick:e.onClick,style:{position:"absolute"},className:"toolbar-settings-button",children:n})},k=e=>t(o,{onClick:e.onClick,badgeContent:t(d,{sx:{fontSize:16,color:"orange"},fontSize:"small"}),color:"default",children:e.children}),u=e=>t(o,{onClick:e.onClick,badgeContent:t(r,{sx:{fontSize:16,color:"red"},fontSize:"small"}),color:"default",children:e.children});export{k as AlertBadge,u as ErrorBadge,y as GearBadge};
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Badge from "@mui/material/Badge";
3
+ import styled from "@emotion/styled";
4
+ import { Settings, Error, Warning } from "@mui/icons-material";
5
+ import { cloneElement } from "react";
6
+ import { Fab } from "@mui/material";
7
+ const StyledBadge = styled(Badge)(({ theme: _theme }) => ({
8
+ "& .MuiBadge-badge": {
9
+ padding: 0
10
+ }
11
+ }));
12
+ const GearBadge = (props) => {
13
+ const icon = props.icon ? cloneElement(props.icon, { sx: { fontSize: 16 }, fontSize: "small" }) : /* @__PURE__ */ jsx(Settings, { sx: { fontSize: 16 }, fontSize: "small" });
14
+ return /* @__PURE__ */ jsx(
15
+ Fab,
16
+ {
17
+ size: "small",
18
+ "aria-label": "settings",
19
+ color: "primary",
20
+ onClick: props.onClick,
21
+ style: {
22
+ position: "absolute"
23
+ },
24
+ className: "toolbar-settings-button",
25
+ children: icon
26
+ }
27
+ );
28
+ };
29
+ const AlertBadge = (props) => {
30
+ return /* @__PURE__ */ jsx(
31
+ StyledBadge,
32
+ {
33
+ onClick: props.onClick,
34
+ badgeContent: /* @__PURE__ */ jsx(
35
+ Warning,
36
+ {
37
+ sx: { fontSize: 16, color: "orange" },
38
+ fontSize: "small"
39
+ }
40
+ ),
41
+ color: "default",
42
+ children: props.children
43
+ }
44
+ );
45
+ };
46
+ const ErrorBadge = (props) => {
47
+ return /* @__PURE__ */ jsx(
48
+ StyledBadge,
49
+ {
50
+ onClick: props.onClick,
51
+ badgeContent: /* @__PURE__ */ jsx(Error, { sx: { fontSize: 16, color: "red" }, fontSize: "small" }),
52
+ color: "default",
53
+ children: props.children
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ AlertBadge,
59
+ ErrorBadge,
60
+ GearBadge
61
+ };
@@ -1 +1,15 @@
1
- import{createContext as o,useContext as e}from"react";const t=o({mode:"create"}),a=t.Provider,d=()=>e(t);var i=t;export{a as DashAutoAdminFormProvider,i as default,d as useDashAutoAdminForm};
1
+ import { createContext, useContext } from "react";
2
+ const DashAutoAdminFormContext = createContext({
3
+ mode: "create"
4
+ });
5
+ const DashAutoAdminFormProvider = DashAutoAdminFormContext.Provider;
6
+ const useDashAutoAdminForm = () => {
7
+ const context = useContext(DashAutoAdminFormContext);
8
+ return context;
9
+ };
10
+ var DashAutoAdminFormContext_default = DashAutoAdminFormContext;
11
+ export {
12
+ DashAutoAdminFormProvider,
13
+ DashAutoAdminFormContext_default as default,
14
+ useDashAutoAdminForm
15
+ };
@@ -1 +1,36 @@
1
- import i,{useEffect as r,useState as o}from"react";const d=a=>{const e=o(!1),t=o(null);return r(()=>{t[0]&&(a&&t[0]?.origin&&t[0].origin===a&&e[1](t[0].data)||e[1](t[0]?.data))},[t[0]]),i.useEffect(()=>(window.addEventListener("auto-admin-loading-state",n=>t[1](n)),()=>{window.removeEventListener("auto-admin-loading-state",n=>t[1](n))}),[]),e};var u=d;export{u as default};
1
+ import React, { useEffect, useState } from "react";
2
+ const useAutoAdminLoadingStateMediator = (origin) => {
3
+ const useAutoAdminLoadingState = useState(false);
4
+ const localState = useState(null);
5
+ useEffect(() => {
6
+ var _a, _b;
7
+ if (!localState[0]) return;
8
+ if (origin && ((_a = localState[0]) == null ? void 0 : _a.origin)) {
9
+ if (
10
+ /* @ts-ignore : An expression of type 'void' cannot be tested for truthiness.ts(1345). */
11
+ localState[0].origin === origin && useAutoAdminLoadingState[1](localState[0].data)
12
+ ) {
13
+ return;
14
+ }
15
+ }
16
+ useAutoAdminLoadingState[1]((_b = localState[0]) == null ? void 0 : _b.data);
17
+ return;
18
+ }, [localState[0]]);
19
+ React.useEffect(() => {
20
+ window.addEventListener(
21
+ "auto-admin-loading-state",
22
+ (e) => localState[1](e)
23
+ );
24
+ return () => {
25
+ window.removeEventListener(
26
+ "auto-admin-loading-state",
27
+ (e) => localState[1](e)
28
+ );
29
+ };
30
+ }, []);
31
+ return useAutoAdminLoadingState;
32
+ };
33
+ var useAutoAdminLoadingStateMediator_default = useAutoAdminLoadingStateMediator;
34
+ export {
35
+ useAutoAdminLoadingStateMediator_default as default
36
+ };
@@ -1 +1,61 @@
1
- import{useTranslate as g}from"react-admin";import{useCallback as u,useMemo as d}from"react";const e=t=>!t||typeof t!="string"?!1:/^[a-z][a-z0-9_.]*[a-z0-9]$/i.test(t)&&t.includes("."),c=()=>{const t=g(),o=u((n,s)=>{if(!n)return s||"";if(e(n)){const f=t(n,{_:n});return f===n&&s?s:f}return n},[t]),r=u(n=>n?e(n)?t(n,{_:n}):n:"",[t]),i=u((n,s)=>t(n,s),[t]),a=u(n=>e(n)?t(n,{_:n})!==n:!1,[t]);return d(()=>({translate:t,translateLabel:o,translateIfKey:r,translateWithParams:i,hasTranslation:a,isTranslationKey:e}),[t,o,r,i,a])},_=(t,o,r)=>{if(!t)return r||"";if(e(t)){const i=o(t,{_:t});return i===t&&r?r:i}return t};var x=c;export{x as default,e as isTranslationKey,_ as translateLabelSync,c as useAutoAdminTranslate};
1
+ import { useTranslate } from "react-admin";
2
+ import { useCallback, useMemo } from "react";
3
+ const isTranslationKey = (value) => {
4
+ if (!value || typeof value !== "string") return false;
5
+ return /^[a-z][a-z0-9_.]*[a-z0-9]$/i.test(value) && value.includes(".");
6
+ };
7
+ const useAutoAdminTranslate = () => {
8
+ const translate = useTranslate();
9
+ const translateLabel = useCallback((label, fallback) => {
10
+ if (!label) return fallback || "";
11
+ if (isTranslationKey(label)) {
12
+ const translated = translate(label, { _: label });
13
+ if (translated === label && fallback) {
14
+ return fallback;
15
+ }
16
+ return translated;
17
+ }
18
+ return label;
19
+ }, [translate]);
20
+ const translateIfKey = useCallback((value) => {
21
+ if (!value) return "";
22
+ if (isTranslationKey(value)) {
23
+ return translate(value, { _: value });
24
+ }
25
+ return value;
26
+ }, [translate]);
27
+ const translateWithParams = useCallback((key, params) => {
28
+ return translate(key, params);
29
+ }, [translate]);
30
+ const hasTranslation = useCallback((key) => {
31
+ if (!isTranslationKey(key)) return false;
32
+ const translated = translate(key, { _: key });
33
+ return translated !== key;
34
+ }, [translate]);
35
+ return useMemo(() => ({
36
+ translate,
37
+ translateLabel,
38
+ translateIfKey,
39
+ translateWithParams,
40
+ hasTranslation,
41
+ isTranslationKey
42
+ }), [translate, translateLabel, translateIfKey, translateWithParams, hasTranslation]);
43
+ };
44
+ const translateLabelSync = (label, translate, fallback) => {
45
+ if (!label) return fallback || "";
46
+ if (isTranslationKey(label)) {
47
+ const translated = translate(label, { _: label });
48
+ if (translated === label && fallback) {
49
+ return fallback;
50
+ }
51
+ return translated;
52
+ }
53
+ return label;
54
+ };
55
+ var useAutoAdminTranslate_default = useAutoAdminTranslate;
56
+ export {
57
+ useAutoAdminTranslate_default as default,
58
+ isTranslationKey,
59
+ translateLabelSync,
60
+ useAutoAdminTranslate
61
+ };
@@ -1 +1,24 @@
1
- import a from"react";const o=()=>{const[e,s]=a.useState(()=>window.location.hash),t=a.useCallback(()=>{s(window.location.hash)},[]);a.useEffect(()=>(window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}),[]);const h=a.useCallback(n=>{n!==e&&(window.location.hash=n)},[e]);return[e,h]};var i=o;export{i as default};
1
+ import React from "react";
2
+ const useHash = () => {
3
+ const [hash, setHash] = React.useState(() => window.location.hash);
4
+ const hashChangeHandler = React.useCallback(() => {
5
+ setHash(window.location.hash);
6
+ }, []);
7
+ React.useEffect(() => {
8
+ window.addEventListener("hashchange", hashChangeHandler);
9
+ return () => {
10
+ window.removeEventListener("hashchange", hashChangeHandler);
11
+ };
12
+ }, []);
13
+ const updateHash = React.useCallback(
14
+ (newHash) => {
15
+ if (newHash !== hash) window.location.hash = newHash;
16
+ },
17
+ [hash]
18
+ );
19
+ return [hash, updateHash];
20
+ };
21
+ var useHash_default = useHash;
22
+ export {
23
+ useHash_default as default
24
+ };
@@ -1 +1,20 @@
1
- import{SimpleLogger as e}from"../utils/SimpleLogger";const l=n=>{const o=new e(n,!0);return{info:(...r)=>{o.log(r)},log:(...r)=>{o.log(r)},error:(...r)=>{o.error(r)},warn:(...r)=>{o.warn(r)}}};export{l as useLogger};
1
+ import { SimpleLogger } from "../utils/SimpleLogger";
2
+ const useLogger = (logger) => {
3
+ const _logger = new SimpleLogger(logger, true);
4
+ const log = (...any) => {
5
+ _logger.log(any);
6
+ };
7
+ const info = (...any) => {
8
+ _logger.log(any);
9
+ };
10
+ const error = (...any) => {
11
+ _logger.error(any);
12
+ };
13
+ const warn = (...any) => {
14
+ _logger.warn(any);
15
+ };
16
+ return { info, log, error, warn };
17
+ };
18
+ export {
19
+ useLogger
20
+ };
@@ -1 +1,20 @@
1
- import{useLocation as c,useParams as l}from"react-router";const g=()=>{const o=l();let e=c().pathname;return Object.keys(o).filter(t=>t!=="*").forEach(t=>{const n=o[t],r=new RegExp(`/${n}/`,"g"),a=new RegExp(`/${n}$`,"g");e=e.replaceAll(r,`/:${t}/`),e=e.replaceAll(a,`/:${t}`)}),e};export{g as useRoutePathPattern};
1
+ import { useLocation, useParams } from "react-router";
2
+ const useRoutePathPattern = () => {
3
+ const routeParams = useParams();
4
+ const location = useLocation();
5
+ let routePathPattern = location.pathname;
6
+ Object.keys(routeParams).filter((paramKey) => paramKey !== "*").forEach((paramKey) => {
7
+ const paramValue = routeParams[paramKey];
8
+ const regexMiddle = new RegExp(`/${paramValue}/`, "g");
9
+ const regexEnd = new RegExp(`/${paramValue}$`, "g");
10
+ routePathPattern = routePathPattern.replaceAll(
11
+ regexMiddle,
12
+ `/:${paramKey}/`
13
+ );
14
+ routePathPattern = routePathPattern.replaceAll(regexEnd, `/:${paramKey}`);
15
+ });
16
+ return routePathPattern;
17
+ };
18
+ export {
19
+ useRoutePathPattern
20
+ };
@@ -1 +1,28 @@
1
- import a from"react";const h=()=>{const[e,n]=a.useState(()=>window.location.hash),s=a.useCallback(t=>{n(t.data)},[]);a.useEffect(()=>(window.addEventListener("virtualhash",s),()=>{window.removeEventListener("virtualhash",s)}),[]);const r=a.useCallback(t=>{history.replaceState(null,"",t),window.dispatchEvent(new MessageEvent("virtualhash",{data:t}))},[e]);return{hash:e,setVirtualHash:t=>{r(t)}}};var o=h;export{o as default};
1
+ import React from "react";
2
+ const useVirtualHash = () => {
3
+ const [hash, setHash] = React.useState(() => window.location.hash);
4
+ const hashChangeHandler = React.useCallback((e) => {
5
+ setHash(e.data);
6
+ }, []);
7
+ React.useEffect(() => {
8
+ window.addEventListener("virtualhash", hashChangeHandler);
9
+ return () => {
10
+ window.removeEventListener("virtualhash", hashChangeHandler);
11
+ };
12
+ }, []);
13
+ const _update = React.useCallback(
14
+ (newHash) => {
15
+ history.replaceState(null, "", newHash);
16
+ window.dispatchEvent(new MessageEvent("virtualhash", { data: newHash }));
17
+ },
18
+ [hash]
19
+ );
20
+ const setVirtualHash = (h) => {
21
+ _update(h);
22
+ };
23
+ return { hash, setVirtualHash };
24
+ };
25
+ var useVirtualHash_default = useVirtualHash;
26
+ export {
27
+ useVirtualHash_default as default
28
+ };