@etsoo/materialui 1.5.33 → 1.5.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/DnDList.d.ts +5 -7
- package/lib/cjs/DnDList.js +2 -2
- package/lib/cjs/app/ReactApp.d.ts +5 -0
- package/lib/cjs/app/ReactApp.js +10 -1
- package/lib/cjs/app/ServiceApp.d.ts +5 -0
- package/lib/cjs/app/ServiceApp.js +11 -2
- package/lib/cjs/html/HtmlDiv.js +1 -1
- package/lib/mjs/DnDList.d.ts +5 -7
- package/lib/mjs/DnDList.js +2 -2
- package/lib/mjs/app/ReactApp.d.ts +5 -0
- package/lib/mjs/app/ReactApp.js +10 -1
- package/lib/mjs/app/ServiceApp.d.ts +5 -0
- package/lib/mjs/app/ServiceApp.js +11 -2
- package/lib/mjs/html/HtmlDiv.js +1 -1
- package/package.json +3 -3
- package/src/DnDList.tsx +6 -16
- package/src/app/ReactApp.ts +11 -1
- package/src/app/ServiceApp.ts +14 -2
- package/src/html/HtmlDiv.tsx +1 -1
package/lib/cjs/DnDList.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ export interface DnDListRef<D extends object> {
|
|
|
48
48
|
/**
|
|
49
49
|
* DnD sortable list properties
|
|
50
50
|
*/
|
|
51
|
-
export interface DnDListPros<D extends
|
|
51
|
+
export interface DnDListPros<D extends {
|
|
52
|
+
id: UniqueIdentifier;
|
|
53
|
+
}> {
|
|
52
54
|
/**
|
|
53
55
|
* Get list item style callback
|
|
54
56
|
*/
|
|
@@ -65,14 +67,10 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
65
67
|
* List items
|
|
66
68
|
*/
|
|
67
69
|
items: D[];
|
|
68
|
-
/**
|
|
69
|
-
* Unique key field
|
|
70
|
-
*/
|
|
71
|
-
keyField: K;
|
|
72
70
|
/**
|
|
73
71
|
* Label field
|
|
74
72
|
*/
|
|
75
|
-
labelField:
|
|
73
|
+
labelField: DataTypes.Keys<D>;
|
|
76
74
|
/**
|
|
77
75
|
* Methods ref
|
|
78
76
|
*/
|
|
@@ -101,4 +99,4 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
101
99
|
*/
|
|
102
100
|
export declare function DnDList<D extends {
|
|
103
101
|
id: UniqueIdentifier;
|
|
104
|
-
}
|
|
102
|
+
}>(props: DnDListPros<D>): import("react/jsx-runtime").JSX.Element;
|
package/lib/cjs/DnDList.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.DnDItemStyle = DnDItemStyle;
|
|
|
54
54
|
*/
|
|
55
55
|
function DnDList(props) {
|
|
56
56
|
// Destruct
|
|
57
|
-
const {
|
|
57
|
+
const { height = 360, itemRenderer, labelField, mRef, sortingStrategy, onChange, onFormChange, onDragEnd } = props;
|
|
58
58
|
// Theme
|
|
59
59
|
const theme = (0, styles_1.useTheme)();
|
|
60
60
|
// States
|
|
@@ -210,7 +210,7 @@ function DnDList(props) {
|
|
|
210
210
|
.forEach((input) => input.addEventListener("change", () => doFormChange()));
|
|
211
211
|
};
|
|
212
212
|
const children = ((0, jsx_runtime_1.jsx)(DndContextType, { onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: (0, jsx_runtime_1.jsx)(SortableContextType, { items: items, strategy: strategy, children: items.map((item, index) => {
|
|
213
|
-
const id = item
|
|
213
|
+
const id = item.id;
|
|
214
214
|
return ((0, jsx_runtime_1.jsx)(SortableItem, { id: id, useSortableType: useSortableType, CSSType: CSSType, style: getItemStyle(index, id === activeId), itemRenderer: (nodeRef, actionNodeRef) => itemRenderer(item, index, nodeRef, actionNodeRef) }, id));
|
|
215
215
|
}) }) }));
|
|
216
216
|
if (onFormChange) {
|
|
@@ -183,6 +183,11 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
183
183
|
* @param dispatch User state dispatch
|
|
184
184
|
*/
|
|
185
185
|
userLogin(user: D, refreshToken: string, dispatch?: boolean): void;
|
|
186
|
+
/**
|
|
187
|
+
* User login dispatch
|
|
188
|
+
* @param user New user
|
|
189
|
+
*/
|
|
190
|
+
protected doLoginDispatch(user: D): void;
|
|
186
191
|
/**
|
|
187
192
|
* User logout
|
|
188
193
|
* @param clearToken Clear refresh token or not
|
package/lib/cjs/app/ReactApp.js
CHANGED
|
@@ -311,7 +311,16 @@ class ReactApp extends appscript_1.CoreApp {
|
|
|
311
311
|
// Super call, set token
|
|
312
312
|
super.userLogin(user, refreshToken);
|
|
313
313
|
// Dispatch action
|
|
314
|
-
if (
|
|
314
|
+
if (dispatch !== false) {
|
|
315
|
+
this.doLoginDispatch(user);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* User login dispatch
|
|
320
|
+
* @param user New user
|
|
321
|
+
*/
|
|
322
|
+
doLoginDispatch(user) {
|
|
323
|
+
if (this.userStateDispatch != null)
|
|
315
324
|
this.userStateDispatch({
|
|
316
325
|
type: react_2.UserActionType.Login,
|
|
317
326
|
user
|
|
@@ -70,6 +70,11 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
|
|
|
70
70
|
* @param data Data
|
|
71
71
|
*/
|
|
72
72
|
protected saveCoreToken(data: ApiRefreshTokenDto): void;
|
|
73
|
+
/**
|
|
74
|
+
* On switch organization handler
|
|
75
|
+
* This method is called when the organization is switched successfully
|
|
76
|
+
*/
|
|
77
|
+
protected onSwitchOrg(): Promise<void> | void;
|
|
73
78
|
/**
|
|
74
79
|
* Switch organization
|
|
75
80
|
* @param organizationId Organization ID
|
|
@@ -157,6 +157,11 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
157
157
|
// Exchange tokens
|
|
158
158
|
this.exchangeTokenAll(data);
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* On switch organization handler
|
|
162
|
+
* This method is called when the organization is switched successfully
|
|
163
|
+
*/
|
|
164
|
+
onSwitchOrg() { }
|
|
160
165
|
/**
|
|
161
166
|
* Switch organization
|
|
162
167
|
* @param organizationId Organization ID
|
|
@@ -183,8 +188,12 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
183
188
|
}
|
|
184
189
|
// Override the user data's refresh token
|
|
185
190
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
186
|
-
// User login
|
|
187
|
-
this.userLoginEx(user, core,
|
|
191
|
+
// User login without dispatch
|
|
192
|
+
this.userLoginEx(user, core, false);
|
|
193
|
+
// Handle the switch organization
|
|
194
|
+
await this.onSwitchOrg();
|
|
195
|
+
// Trigger the dispatch at last
|
|
196
|
+
this.doLoginDispatch(user);
|
|
188
197
|
return result;
|
|
189
198
|
}
|
|
190
199
|
async refreshTokenSucceed(user, token, callback) {
|
package/lib/cjs/html/HtmlDiv.js
CHANGED
package/lib/mjs/DnDList.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ export interface DnDListRef<D extends object> {
|
|
|
48
48
|
/**
|
|
49
49
|
* DnD sortable list properties
|
|
50
50
|
*/
|
|
51
|
-
export interface DnDListPros<D extends
|
|
51
|
+
export interface DnDListPros<D extends {
|
|
52
|
+
id: UniqueIdentifier;
|
|
53
|
+
}> {
|
|
52
54
|
/**
|
|
53
55
|
* Get list item style callback
|
|
54
56
|
*/
|
|
@@ -65,14 +67,10 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
65
67
|
* List items
|
|
66
68
|
*/
|
|
67
69
|
items: D[];
|
|
68
|
-
/**
|
|
69
|
-
* Unique key field
|
|
70
|
-
*/
|
|
71
|
-
keyField: K;
|
|
72
70
|
/**
|
|
73
71
|
* Label field
|
|
74
72
|
*/
|
|
75
|
-
labelField:
|
|
73
|
+
labelField: DataTypes.Keys<D>;
|
|
76
74
|
/**
|
|
77
75
|
* Methods ref
|
|
78
76
|
*/
|
|
@@ -101,4 +99,4 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
101
99
|
*/
|
|
102
100
|
export declare function DnDList<D extends {
|
|
103
101
|
id: UniqueIdentifier;
|
|
104
|
-
}
|
|
102
|
+
}>(props: DnDListPros<D>): import("react/jsx-runtime").JSX.Element;
|
package/lib/mjs/DnDList.js
CHANGED
|
@@ -46,7 +46,7 @@ export const DnDItemStyle = (index, isDragging, theme) => ({
|
|
|
46
46
|
*/
|
|
47
47
|
export function DnDList(props) {
|
|
48
48
|
// Destruct
|
|
49
|
-
const {
|
|
49
|
+
const { height = 360, itemRenderer, labelField, mRef, sortingStrategy, onChange, onFormChange, onDragEnd } = props;
|
|
50
50
|
// Theme
|
|
51
51
|
const theme = useTheme();
|
|
52
52
|
// States
|
|
@@ -202,7 +202,7 @@ export function DnDList(props) {
|
|
|
202
202
|
.forEach((input) => input.addEventListener("change", () => doFormChange()));
|
|
203
203
|
};
|
|
204
204
|
const children = (_jsx(DndContextType, { onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: _jsx(SortableContextType, { items: items, strategy: strategy, children: items.map((item, index) => {
|
|
205
|
-
const id = item
|
|
205
|
+
const id = item.id;
|
|
206
206
|
return (_jsx(SortableItem, { id: id, useSortableType: useSortableType, CSSType: CSSType, style: getItemStyle(index, id === activeId), itemRenderer: (nodeRef, actionNodeRef) => itemRenderer(item, index, nodeRef, actionNodeRef) }, id));
|
|
207
207
|
}) }) }));
|
|
208
208
|
if (onFormChange) {
|
|
@@ -183,6 +183,11 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
183
183
|
* @param dispatch User state dispatch
|
|
184
184
|
*/
|
|
185
185
|
userLogin(user: D, refreshToken: string, dispatch?: boolean): void;
|
|
186
|
+
/**
|
|
187
|
+
* User login dispatch
|
|
188
|
+
* @param user New user
|
|
189
|
+
*/
|
|
190
|
+
protected doLoginDispatch(user: D): void;
|
|
186
191
|
/**
|
|
187
192
|
* User logout
|
|
188
193
|
* @param clearToken Clear refresh token or not
|
package/lib/mjs/app/ReactApp.js
CHANGED
|
@@ -303,7 +303,16 @@ export class ReactApp extends CoreApp {
|
|
|
303
303
|
// Super call, set token
|
|
304
304
|
super.userLogin(user, refreshToken);
|
|
305
305
|
// Dispatch action
|
|
306
|
-
if (
|
|
306
|
+
if (dispatch !== false) {
|
|
307
|
+
this.doLoginDispatch(user);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* User login dispatch
|
|
312
|
+
* @param user New user
|
|
313
|
+
*/
|
|
314
|
+
doLoginDispatch(user) {
|
|
315
|
+
if (this.userStateDispatch != null)
|
|
307
316
|
this.userStateDispatch({
|
|
308
317
|
type: UserActionType.Login,
|
|
309
318
|
user
|
|
@@ -70,6 +70,11 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
|
|
|
70
70
|
* @param data Data
|
|
71
71
|
*/
|
|
72
72
|
protected saveCoreToken(data: ApiRefreshTokenDto): void;
|
|
73
|
+
/**
|
|
74
|
+
* On switch organization handler
|
|
75
|
+
* This method is called when the organization is switched successfully
|
|
76
|
+
*/
|
|
77
|
+
protected onSwitchOrg(): Promise<void> | void;
|
|
73
78
|
/**
|
|
74
79
|
* Switch organization
|
|
75
80
|
* @param organizationId Organization ID
|
|
@@ -154,6 +154,11 @@ export class ServiceApp extends ReactApp {
|
|
|
154
154
|
// Exchange tokens
|
|
155
155
|
this.exchangeTokenAll(data);
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* On switch organization handler
|
|
159
|
+
* This method is called when the organization is switched successfully
|
|
160
|
+
*/
|
|
161
|
+
onSwitchOrg() { }
|
|
157
162
|
/**
|
|
158
163
|
* Switch organization
|
|
159
164
|
* @param organizationId Organization ID
|
|
@@ -180,8 +185,12 @@ export class ServiceApp extends ReactApp {
|
|
|
180
185
|
}
|
|
181
186
|
// Override the user data's refresh token
|
|
182
187
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
183
|
-
// User login
|
|
184
|
-
this.userLoginEx(user, core,
|
|
188
|
+
// User login without dispatch
|
|
189
|
+
this.userLoginEx(user, core, false);
|
|
190
|
+
// Handle the switch organization
|
|
191
|
+
await this.onSwitchOrg();
|
|
192
|
+
// Trigger the dispatch at last
|
|
193
|
+
this.doLoginDispatch(user);
|
|
185
194
|
return result;
|
|
186
195
|
}
|
|
187
196
|
async refreshTokenSucceed(user, token, callback) {
|
package/lib/mjs/html/HtmlDiv.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.35",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@dnd-kit/sortable": "^10.0.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.0",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.29",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.60",
|
|
45
45
|
"@etsoo/react": "^1.8.40",
|
|
46
46
|
"@etsoo/shared": "^1.2.69",
|
|
47
47
|
"@mui/icons-material": "^7.0.2",
|
|
48
48
|
"@mui/material": "^7.0.2",
|
|
49
|
-
"@mui/x-data-grid": "^8.
|
|
49
|
+
"@mui/x-data-grid": "^8.1.0",
|
|
50
50
|
"chart.js": "^4.4.9",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"dompurify": "^3.2.5",
|
package/src/DnDList.tsx
CHANGED
|
@@ -119,7 +119,7 @@ export interface DnDListRef<D extends object> {
|
|
|
119
119
|
/**
|
|
120
120
|
* DnD sortable list properties
|
|
121
121
|
*/
|
|
122
|
-
export interface DnDListPros<D extends
|
|
122
|
+
export interface DnDListPros<D extends { id: UniqueIdentifier }> {
|
|
123
123
|
/**
|
|
124
124
|
* Get list item style callback
|
|
125
125
|
*/
|
|
@@ -145,15 +145,10 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
145
145
|
*/
|
|
146
146
|
items: D[];
|
|
147
147
|
|
|
148
|
-
/**
|
|
149
|
-
* Unique key field
|
|
150
|
-
*/
|
|
151
|
-
keyField: K;
|
|
152
|
-
|
|
153
148
|
/**
|
|
154
149
|
* Label field
|
|
155
150
|
*/
|
|
156
|
-
labelField:
|
|
151
|
+
labelField: DataTypes.Keys<D>;
|
|
157
152
|
|
|
158
153
|
/**
|
|
159
154
|
* Methods ref
|
|
@@ -191,16 +186,11 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
|
|
|
191
186
|
* @param props Props
|
|
192
187
|
* @returns Component
|
|
193
188
|
*/
|
|
194
|
-
export function DnDList<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
D,
|
|
198
|
-
UniqueIdentifier
|
|
199
|
-
>
|
|
200
|
-
>(props: DnDListPros<D, K>) {
|
|
189
|
+
export function DnDList<D extends { id: UniqueIdentifier }>(
|
|
190
|
+
props: DnDListPros<D>
|
|
191
|
+
) {
|
|
201
192
|
// Destruct
|
|
202
193
|
const {
|
|
203
|
-
keyField,
|
|
204
194
|
height = 360,
|
|
205
195
|
itemRenderer,
|
|
206
196
|
labelField,
|
|
@@ -465,7 +455,7 @@ export function DnDList<
|
|
|
465
455
|
<DndContextType onDragStart={handleDragStart} onDragEnd={handleDragEnd}>
|
|
466
456
|
<SortableContextType items={items} strategy={strategy}>
|
|
467
457
|
{items.map((item, index) => {
|
|
468
|
-
const id = item
|
|
458
|
+
const id = item.id;
|
|
469
459
|
return (
|
|
470
460
|
<SortableItem
|
|
471
461
|
id={id}
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -483,7 +483,17 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
|
|
|
483
483
|
super.userLogin(user, refreshToken);
|
|
484
484
|
|
|
485
485
|
// Dispatch action
|
|
486
|
-
if (
|
|
486
|
+
if (dispatch !== false) {
|
|
487
|
+
this.doLoginDispatch(user);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* User login dispatch
|
|
493
|
+
* @param user New user
|
|
494
|
+
*/
|
|
495
|
+
protected doLoginDispatch(user: D) {
|
|
496
|
+
if (this.userStateDispatch != null)
|
|
487
497
|
this.userStateDispatch({
|
|
488
498
|
type: UserActionType.Login,
|
|
489
499
|
user
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -209,6 +209,12 @@ export class ServiceApp<
|
|
|
209
209
|
this.exchangeTokenAll(data);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* On switch organization handler
|
|
214
|
+
* This method is called when the organization is switched successfully
|
|
215
|
+
*/
|
|
216
|
+
protected onSwitchOrg(): Promise<void> | void {}
|
|
217
|
+
|
|
212
218
|
/**
|
|
213
219
|
* Switch organization
|
|
214
220
|
* @param organizationId Organization ID
|
|
@@ -248,8 +254,14 @@ export class ServiceApp<
|
|
|
248
254
|
// Override the user data's refresh token
|
|
249
255
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
250
256
|
|
|
251
|
-
// User login
|
|
252
|
-
this.userLoginEx(user, core,
|
|
257
|
+
// User login without dispatch
|
|
258
|
+
this.userLoginEx(user, core, false);
|
|
259
|
+
|
|
260
|
+
// Handle the switch organization
|
|
261
|
+
await this.onSwitchOrg();
|
|
262
|
+
|
|
263
|
+
// Trigger the dispatch at last
|
|
264
|
+
this.doLoginDispatch(user);
|
|
253
265
|
|
|
254
266
|
return result;
|
|
255
267
|
}
|
package/src/html/HtmlDiv.tsx
CHANGED