datastake-daf 0.6.506 → 0.6.508

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.
@@ -31,28 +31,6 @@ const useResizeContext = () => {
31
31
  return values;
32
32
  };
33
33
 
34
- /* eslint-disable react/prop-types */
35
- const NOTIFICATION_MODE = {
36
- EMPTY: 'EMPTY',
37
- PROJECT_SOURCES: 'PROJECT_SOURCES'
38
- };
39
- const FormsContext = /*#__PURE__*/o.createContext({
40
- onYesNotification: () => {},
41
- onNoNotification: () => {},
42
- notificationMode: NOTIFICATION_MODE.EMPTY,
43
- notificationState: {},
44
- setNotificationMode: () => {},
45
- changeNotificationState: () => {},
46
- authenticationLinks: [],
47
- setAuthenticationLinks: () => {},
48
- addCheck: () => {},
49
- removeCheck: () => {}
50
- });
51
- const useForms = () => {
52
- const value = o.useContext(FormsContext);
53
- return value;
54
- };
55
-
56
34
  /************* ✨ Codeium Command ⭐ *************/
57
35
  /**
58
36
  * Given an array of classnames (some of which may be empty), joins them all
@@ -5263,19 +5241,16 @@ const Sidenav = ({
5263
5241
  const checkOnClick = ({
5264
5242
  event
5265
5243
  }) => {
5266
- console.log("checkOnClick", changeNotificationState);
5267
- // If no changeNotificationState or no unsaved changes, execute immediately
5268
- if (!changeNotificationState) {
5269
- if (typeof event === 'function') {
5270
- event();
5271
- }
5272
- return;
5244
+ console.log("Click 1");
5245
+ if (changeNotificationState && typeof changeNotificationState === 'function') {
5246
+ console.log("Change notification state", changeNotificationState);
5247
+ changeNotificationState({
5248
+ onYes: event
5249
+ });
5250
+ } else if (typeof event === 'function') {
5251
+ console.log("Event", event);
5252
+ event();
5273
5253
  }
5274
-
5275
- // Otherwise, use the notification state mechanism
5276
- changeNotificationState({
5277
- onYes: event
5278
- });
5279
5254
  };
5280
5255
  const {
5281
5256
  hoverContent,
@@ -5342,11 +5317,12 @@ const Sidenav = ({
5342
5317
  children: [renderModule({
5343
5318
  module: userModule,
5344
5319
  isCollapsed,
5345
- onClick: () => checkOnClick({
5346
- event: () => {
5347
- goTo(getRedirectLink(`/app`));
5348
- }
5349
- }),
5320
+ onClick: () => {
5321
+ const redirectPath = getRedirectLink(`/app`);
5322
+ checkOnClick({
5323
+ event: () => goTo(redirectPath)
5324
+ });
5325
+ },
5350
5326
  mod,
5351
5327
  user,
5352
5328
  userHelpers
@@ -6129,13 +6105,13 @@ const UserDropdownMenu = ({
6129
6105
  const isDemoEnv = isDev;
6130
6106
 
6131
6107
  // Helper function to handle navigation with notification check
6132
- const handleNavigate = path => {
6108
+ const handlegoTo = path => {
6133
6109
  if (changeNotificationState) {
6134
6110
  changeNotificationState({
6135
- onYes: () => goTo(getRedirectLink(path))
6111
+ onYes: () => goTo?.(path)
6136
6112
  });
6137
6113
  } else {
6138
- goTo(getRedirectLink(path));
6114
+ goTo?.(path);
6139
6115
  }
6140
6116
  };
6141
6117
 
@@ -6161,7 +6137,6 @@ const UserDropdownMenu = ({
6161
6137
  drawerOpened: settingsDrawerOpened,
6162
6138
  user: user,
6163
6139
  goTo: goTo,
6164
- getRedirectLink: getRedirectLink,
6165
6140
  t: t,
6166
6141
  checkPermission: checkPermission,
6167
6142
  logOut: logOut,
@@ -6173,44 +6148,35 @@ const UserDropdownMenu = ({
6173
6148
  placement: "bottomLeft",
6174
6149
  rootClassName: formatClassname(['user-dropdown-layout', appName]),
6175
6150
  menu: {
6176
- items: [
6177
- // Only show Users option if conditions met
6178
- ...(user.company && !isDemoEnv && canViewUsers && !isAdmin ? [{
6179
- label: t('Users'),
6180
- key: 'users',
6181
- onClick: () => handleNavigate(getRedirectLink(`/app/users`))
6182
- }] : []),
6183
- // Only show Settings option if conditions met
6184
- ...(canViewSettings && !isAppNavigation && !isAdmin ? [{
6185
- label: t('Settings'),
6186
- key: 'settings',
6187
- onClick: () => handleNavigate(getRedirectLink(`/app/view/settings`))
6188
- }] : []),
6189
- // Always show logout
6190
- {
6191
- label: t('Log out'),
6192
- key: 'logout',
6193
- onClick: handleLogout
6194
- }],
6195
- // Add the header as a separate component
6196
- onClick: info => {
6197
- // This will be called when any menu item is clicked
6198
- console.log('Menu item clicked:', info.key);
6199
- }
6151
+ items: [{
6152
+ label: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6153
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
6154
+ className: "drop-header",
6155
+ children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
6156
+ children: user?.company?.name || ''
6157
+ }), /*#__PURE__*/jsxRuntime.jsxs("p", {
6158
+ children: [user?.firstName || '', " ", user?.lastName || '']
6159
+ })]
6160
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6161
+ className: "list",
6162
+ children: [user.company && !isDemoEnv && canViewUsers && !isAdmin ? /*#__PURE__*/jsxRuntime.jsx("div", {
6163
+ className: "list-item",
6164
+ onClick: () => handlegoTo(getRedirectLink(`/app/users`)),
6165
+ children: t('Users')
6166
+ }) : null, canViewSettings && !isAppNavigation && !isAdmin ? /*#__PURE__*/jsxRuntime.jsx("div", {
6167
+ className: "list-item",
6168
+ onClick: () => handlegoTo(getRedirectLink(`/app/view/settings`)),
6169
+ children: t('Settings')
6170
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
6171
+ className: "list-item",
6172
+ onClick: handleLogout,
6173
+ children: t('Log out')
6174
+ })]
6175
+ })]
6176
+ }),
6177
+ key: 'userMenu'
6178
+ }]
6200
6179
  },
6201
- dropdownRender: menu => /*#__PURE__*/jsxRuntime.jsxs("div", {
6202
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
6203
- className: "drop-header",
6204
- children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
6205
- children: user?.company?.name || ''
6206
- }), /*#__PURE__*/jsxRuntime.jsxs("p", {
6207
- children: [user?.firstName || '', " ", user?.lastName || '']
6208
- })]
6209
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
6210
- className: "list",
6211
- children: /*#__PURE__*/o__default["default"].cloneElement(menu)
6212
- })]
6213
- }),
6214
6180
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
6215
6181
  className: "d-flex flex-column justify-content-center",
6216
6182
  children: /*#__PURE__*/jsxRuntime.jsx(UserIcon, {
@@ -7023,6 +6989,8 @@ function AppLayout({
7023
6989
  // Notifications (injected from app)
7024
6990
  notificationHandlers = {},
7025
6991
  NotificationsHistoryProvider,
6992
+ changeNotificationState,
6993
+ notificationMode,
7026
6994
  // Config
7027
6995
  sidenavConfig = {},
7028
6996
  appName = 'app',
@@ -7050,10 +7018,6 @@ function AppLayout({
7050
7018
  // Children
7051
7019
  children
7052
7020
  }) {
7053
- const {
7054
- notificationMode,
7055
- changeNotificationState
7056
- } = useForms();
7057
7021
  const [userPreferences, setUserPreferences] = o.useState(null);
7058
7022
  const isAppNavigation = module === 'app';
7059
7023
  const [drawerOpened, setDrawerOpened] = o.useState(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.506",
3
+ "version": "0.6.508",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -163,17 +163,14 @@ const Sidenav = ({
163
163
  };
164
164
 
165
165
  const checkOnClick = ({ event }) => {
166
- console.log("checkOnClick", changeNotificationState);
167
- // If no changeNotificationState or no unsaved changes, execute immediately
168
- if (!changeNotificationState) {
169
- if (typeof event === 'function') {
170
- event();
171
- }
172
- return;
166
+ console.log("Click 1")
167
+ if (changeNotificationState && typeof changeNotificationState === 'function') {
168
+ console.log("Change notification state", changeNotificationState);
169
+ changeNotificationState({ onYes: event });
170
+ } else if (typeof event === 'function') {
171
+ console.log("Event", event);
172
+ event();
173
173
  }
174
-
175
- // Otherwise, use the notification state mechanism
176
- changeNotificationState({ onYes: event });
177
174
  };
178
175
 
179
176
  const { hoverContent, hoverContentSecond } = useMenu({
@@ -250,11 +247,12 @@ const Sidenav = ({
250
247
  {renderModule({
251
248
  module: userModule,
252
249
  isCollapsed,
253
- onClick: () => checkOnClick({
254
- event: () => {
255
- goTo(getRedirectLink(`/app`));
256
- }
257
- }),
250
+ onClick: () => {
251
+ const redirectPath = getRedirectLink(`/app`);
252
+ checkOnClick({
253
+ event: () => goTo(redirectPath)
254
+ });
255
+ },
258
256
  mod,
259
257
  user,
260
258
  userHelpers
@@ -51,11 +51,11 @@ export const UserDropdownMenu = ({
51
51
  const isDemoEnv = isDev;
52
52
 
53
53
  // Helper function to handle navigation with notification check
54
- const handleNavigate = (path) => {
54
+ const handlegoTo = (path) => {
55
55
  if (changeNotificationState) {
56
- changeNotificationState({ onYes: () => goTo(getRedirectLink(path)) });
56
+ changeNotificationState({ onYes: () => goTo?.(path) });
57
57
  } else {
58
- goTo(getRedirectLink(path));
58
+ goTo?.(path);
59
59
  }
60
60
  };
61
61
 
@@ -78,7 +78,6 @@ export const UserDropdownMenu = ({
78
78
  drawerOpened={settingsDrawerOpened}
79
79
  user={user}
80
80
  goTo={goTo}
81
- getRedirectLink={getRedirectLink}
82
81
  t={t}
83
82
  checkPermission={checkPermission}
84
83
  logOut={logOut}
@@ -93,42 +92,45 @@ export const UserDropdownMenu = ({
93
92
  rootClassName={formatClassname(['user-dropdown-layout', appName])}
94
93
  menu={{
95
94
  items: [
96
- // Only show Users option if conditions met
97
- ...(user.company && !isDemoEnv && canViewUsers && !isAdmin ? [{
98
- label: t('Users'),
99
- key: 'users',
100
- onClick: () => handleNavigate(getRedirectLink(`/app/users`))
101
- }] : []),
102
- // Only show Settings option if conditions met
103
- ...(canViewSettings && !isAppNavigation && !isAdmin ? [{
104
- label: t('Settings'),
105
- key: 'settings',
106
- onClick: () => handleNavigate(getRedirectLink(`/app/view/settings`))
107
- }] : []),
108
- // Always show logout
109
95
  {
110
- label: t('Log out'),
111
- key: 'logout',
112
- onClick: handleLogout
96
+ label: (
97
+ <>
98
+ <div className="drop-header">
99
+ <h4>{user?.company?.name || ''}</h4>
100
+ <p>{user?.firstName || ''} {user?.lastName || ''}</p>
101
+ </div>
102
+ <div className='list'>
103
+ {user.company && !isDemoEnv && canViewUsers && !isAdmin ? (
104
+ <div
105
+ className='list-item'
106
+ onClick={() => handlegoTo(getRedirectLink(`/app/users`))}
107
+ >
108
+ {t('Users')}
109
+ </div>
110
+ ) : null}
111
+
112
+ {canViewSettings && !isAppNavigation && !isAdmin ? (
113
+ <div
114
+ className='list-item'
115
+ onClick={() => handlegoTo(getRedirectLink(`/app/view/settings`))}
116
+ >
117
+ {t('Settings')}
118
+ </div>
119
+ ) : null}
120
+
121
+ <div
122
+ className='list-item'
123
+ onClick={handleLogout}
124
+ >
125
+ {t('Log out')}
126
+ </div>
127
+ </div>
128
+ </>
129
+ ),
130
+ key: 'userMenu'
113
131
  }
114
- ],
115
- // Add the header as a separate component
116
- onClick: (info) => {
117
- // This will be called when any menu item is clicked
118
- console.log('Menu item clicked:', info.key);
119
- }
132
+ ]
120
133
  }}
121
- dropdownRender={(menu) => (
122
- <div>
123
- <div className="drop-header">
124
- <h4>{user?.company?.name || ''}</h4>
125
- <p>{user?.firstName || ''} {user?.lastName || ''}</p>
126
- </div>
127
- <div className='list'>
128
- {React.cloneElement(menu)}
129
- </div>
130
- </div>
131
- )}
132
134
  >
133
135
  <div className="d-flex flex-column justify-content-center">
134
136
  <UserIcon companyLogo={companyLogo} />
@@ -92,6 +92,8 @@ function AppLayout({
92
92
  // Notifications (injected from app)
93
93
  notificationHandlers = {},
94
94
  NotificationsHistoryProvider,
95
+ changeNotificationState,
96
+ notificationMode,
95
97
 
96
98
  // Config
97
99
  sidenavConfig = {},
@@ -115,7 +117,6 @@ function AppLayout({
115
117
  // Children
116
118
  children,
117
119
  }) {
118
- const { notificationMode, changeNotificationState } = useForms();
119
120
  const [userPreferences, setUserPreferences] = useState(null);
120
121
  const isAppNavigation = module === 'app';
121
122
  const [drawerOpened, setDrawerOpened] = useState(false);