@etsoo/react 1.5.78 → 1.5.81
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/README.md +7 -2
- package/__tests__/ReactUtils.ts +6 -0
- package/lib/{mu → components}/DnDList.d.ts +1 -14
- package/lib/{mu → components}/DnDList.js +1 -24
- package/lib/components/GridMethodRef.d.ts +11 -0
- package/lib/{mu → components}/GridMethodRef.js +0 -0
- package/lib/components/ScrollerGrid.d.ts +6 -6
- package/lib/components/ScrollerList.d.ts +3 -3
- package/lib/index.d.ts +2 -74
- package/lib/index.js +2 -75
- package/lib/notifier/Notifier.d.ts +2 -3
- package/lib/uses/useWindowScroll.d.ts +10 -0
- package/lib/uses/useWindowScroll.js +46 -0
- package/lib/uses/useWindowSize.js +11 -5
- package/package.json +9 -21
- package/src/{mu → components}/DnDList.tsx +11 -34
- package/src/components/GridMethodRef.ts +12 -0
- package/src/components/ScrollerGrid.tsx +6 -6
- package/src/components/ScrollerList.tsx +5 -3
- package/src/index.ts +2 -78
- package/src/notifier/Notifier.ts +2 -3
- package/src/uses/useWindowScroll.ts +60 -0
- package/src/uses/useWindowSize.ts +14 -5
- package/__tests__/mu/MUGlobalTests.tsx +0 -58
- package/__tests__/mu/NotifierMUTests.tsx +0 -213
- package/lib/app/CommonApp.d.ts +0 -39
- package/lib/app/CommonApp.js +0 -149
- package/lib/app/IServiceAppSettings.d.ts +0 -11
- package/lib/app/IServiceAppSettings.js +0 -1
- package/lib/app/IServicePage.d.ts +0 -6
- package/lib/app/IServicePage.js +0 -1
- package/lib/app/IServiceUser.d.ts +0 -14
- package/lib/app/IServiceUser.js +0 -1
- package/lib/app/ISmartERPUser.d.ts +0 -14
- package/lib/app/ISmartERPUser.js +0 -1
- package/lib/app/Labels.d.ts +0 -65
- package/lib/app/Labels.js +0 -62
- package/lib/app/ReactApp.d.ts +0 -194
- package/lib/app/ReactApp.js +0 -298
- package/lib/app/ServiceApp.d.ts +0 -78
- package/lib/app/ServiceApp.js +0 -244
- package/lib/components/ShowDataComparison.d.ts +0 -20
- package/lib/components/ShowDataComparison.js +0 -60
- package/lib/mu/AuditDisplay.d.ts +0 -33
- package/lib/mu/AuditDisplay.js +0 -52
- package/lib/mu/AutocompleteExtendedProps.d.ts +0 -66
- package/lib/mu/AutocompleteExtendedProps.js +0 -1
- package/lib/mu/BackButton.d.ts +0 -13
- package/lib/mu/BackButton.js +0 -33
- package/lib/mu/BridgeCloseButton.d.ts +0 -23
- package/lib/mu/BridgeCloseButton.js +0 -32
- package/lib/mu/ButtonLink.d.ts +0 -17
- package/lib/mu/ButtonLink.js +0 -19
- package/lib/mu/ComboBox.d.ts +0 -40
- package/lib/mu/ComboBox.js +0 -108
- package/lib/mu/CountdownButton.d.ts +0 -23
- package/lib/mu/CountdownButton.js +0 -81
- package/lib/mu/CustomFabProps.d.ts +0 -27
- package/lib/mu/CustomFabProps.js +0 -1
- package/lib/mu/DataGridEx.d.ts +0 -96
- package/lib/mu/DataGridEx.js +0 -331
- package/lib/mu/DataGridRenderers.d.ts +0 -22
- package/lib/mu/DataGridRenderers.js +0 -99
- package/lib/mu/DialogButton.d.ts +0 -54
- package/lib/mu/DialogButton.js +0 -45
- package/lib/mu/DraggablePaperComponent.d.ts +0 -8
- package/lib/mu/DraggablePaperComponent.js +0 -12
- package/lib/mu/EmailInput.d.ts +0 -11
- package/lib/mu/EmailInput.js +0 -15
- package/lib/mu/FabBox.d.ts +0 -21
- package/lib/mu/FabBox.js +0 -31
- package/lib/mu/FlexBox.d.ts +0 -14
- package/lib/mu/FlexBox.js +0 -18
- package/lib/mu/GridDataFormat.d.ts +0 -10
- package/lib/mu/GridDataFormat.js +0 -43
- package/lib/mu/GridMethodRef.d.ts +0 -11
- package/lib/mu/IconButtonLink.d.ts +0 -17
- package/lib/mu/IconButtonLink.js +0 -16
- package/lib/mu/InputField.d.ts +0 -21
- package/lib/mu/InputField.js +0 -39
- package/lib/mu/ItemList.d.ts +0 -55
- package/lib/mu/ItemList.js +0 -77
- package/lib/mu/ListItemRightIcon.d.ts +0 -4
- package/lib/mu/ListItemRightIcon.js +0 -8
- package/lib/mu/ListMoreDisplay.d.ts +0 -35
- package/lib/mu/ListMoreDisplay.js +0 -99
- package/lib/mu/LoadingButton.d.ts +0 -16
- package/lib/mu/LoadingButton.js +0 -41
- package/lib/mu/MUGlobal.d.ts +0 -102
- package/lib/mu/MUGlobal.js +0 -184
- package/lib/mu/MaskInput.d.ts +0 -34
- package/lib/mu/MaskInput.js +0 -43
- package/lib/mu/MobileListItemRenderer.d.ts +0 -17
- package/lib/mu/MobileListItemRenderer.js +0 -35
- package/lib/mu/MoreFab.d.ts +0 -45
- package/lib/mu/MoreFab.js +0 -95
- package/lib/mu/NotifierMU.d.ts +0 -47
- package/lib/mu/NotifierMU.js +0 -387
- package/lib/mu/NotifierPromptProps.d.ts +0 -22
- package/lib/mu/NotifierPromptProps.js +0 -1
- package/lib/mu/OptionGroup.d.ts +0 -62
- package/lib/mu/OptionGroup.js +0 -81
- package/lib/mu/PList.d.ts +0 -15
- package/lib/mu/PList.js +0 -12
- package/lib/mu/ProgressCount.d.ts +0 -44
- package/lib/mu/ProgressCount.js +0 -79
- package/lib/mu/PullToRefreshUI.d.ts +0 -9
- package/lib/mu/PullToRefreshUI.js +0 -18
- package/lib/mu/RLink.d.ts +0 -14
- package/lib/mu/RLink.js +0 -37
- package/lib/mu/ResponsibleContainer.d.ts +0 -89
- package/lib/mu/ResponsibleContainer.js +0 -159
- package/lib/mu/ScrollTopFab.d.ts +0 -7
- package/lib/mu/ScrollTopFab.js +0 -25
- package/lib/mu/ScrollerListEx.d.ts +0 -81
- package/lib/mu/ScrollerListEx.js +0 -167
- package/lib/mu/SearchBar.d.ts +0 -29
- package/lib/mu/SearchBar.js +0 -262
- package/lib/mu/SearchField.d.ts +0 -21
- package/lib/mu/SearchField.js +0 -39
- package/lib/mu/SearchOptionGroup.d.ts +0 -9
- package/lib/mu/SearchOptionGroup.js +0 -14
- package/lib/mu/SelectBool.d.ts +0 -14
- package/lib/mu/SelectBool.js +0 -22
- package/lib/mu/SelectEx.d.ts +0 -54
- package/lib/mu/SelectEx.js +0 -156
- package/lib/mu/Switch.d.ts +0 -29
- package/lib/mu/Switch.js +0 -34
- package/lib/mu/SwitchAnt.d.ts +0 -25
- package/lib/mu/SwitchAnt.js +0 -40
- package/lib/mu/TabBox.d.ts +0 -54
- package/lib/mu/TabBox.js +0 -31
- package/lib/mu/TableEx.d.ts +0 -68
- package/lib/mu/TableEx.js +0 -271
- package/lib/mu/TextFieldEx.d.ts +0 -101
- package/lib/mu/TextFieldEx.js +0 -127
- package/lib/mu/Tiplist.d.ts +0 -18
- package/lib/mu/Tiplist.js +0 -158
- package/lib/mu/TooltipClick.d.ts +0 -15
- package/lib/mu/TooltipClick.js +0 -40
- package/lib/mu/UserAvatar.d.ts +0 -24
- package/lib/mu/UserAvatar.js +0 -25
- package/lib/mu/UserAvatarEditor.d.ts +0 -53
- package/lib/mu/UserAvatarEditor.js +0 -129
- package/lib/mu/pages/CommonPage.d.ts +0 -11
- package/lib/mu/pages/CommonPage.js +0 -60
- package/lib/mu/pages/CommonPageProps.d.ts +0 -60
- package/lib/mu/pages/CommonPageProps.js +0 -1
- package/lib/mu/pages/DataGridPage.d.ts +0 -9
- package/lib/mu/pages/DataGridPage.js +0 -81
- package/lib/mu/pages/DataGridPageProps.d.ts +0 -17
- package/lib/mu/pages/DataGridPageProps.js +0 -1
- package/lib/mu/pages/EditPage.d.ts +0 -33
- package/lib/mu/pages/EditPage.js +0 -29
- package/lib/mu/pages/FixedListPage.d.ts +0 -15
- package/lib/mu/pages/FixedListPage.js +0 -72
- package/lib/mu/pages/ListPage.d.ts +0 -9
- package/lib/mu/pages/ListPage.js +0 -51
- package/lib/mu/pages/ListPageProps.d.ts +0 -7
- package/lib/mu/pages/ListPageProps.js +0 -1
- package/lib/mu/pages/ResponsivePage.d.ts +0 -9
- package/lib/mu/pages/ResponsivePage.js +0 -45
- package/lib/mu/pages/ResponsivePageProps.d.ts +0 -39
- package/lib/mu/pages/ResponsivePageProps.js +0 -1
- package/lib/mu/pages/SearchPageProps.d.ts +0 -30
- package/lib/mu/pages/SearchPageProps.js +0 -1
- package/lib/mu/pages/TablePage.d.ts +0 -9
- package/lib/mu/pages/TablePage.js +0 -71
- package/lib/mu/pages/TablePageProps.d.ts +0 -7
- package/lib/mu/pages/TablePageProps.js +0 -1
- package/lib/mu/pages/ViewPage.d.ts +0 -66
- package/lib/mu/pages/ViewPage.js +0 -105
- package/lib/mu/texts/DateText.d.ts +0 -34
- package/lib/mu/texts/DateText.js +0 -25
- package/lib/mu/texts/MoneyText.d.ts +0 -21
- package/lib/mu/texts/MoneyText.js +0 -14
- package/lib/mu/texts/NumberText.d.ts +0 -25
- package/lib/mu/texts/NumberText.js +0 -14
- package/src/app/CommonApp.ts +0 -225
- package/src/app/IServiceAppSettings.ts +0 -13
- package/src/app/IServicePage.ts +0 -6
- package/src/app/IServiceUser.ts +0 -17
- package/src/app/ISmartERPUser.ts +0 -16
- package/src/app/Labels.ts +0 -77
- package/src/app/ReactApp.ts +0 -500
- package/src/app/ServiceApp.ts +0 -353
- package/src/components/ShowDataComparison.tsx +0 -108
- package/src/mu/AuditDisplay.tsx +0 -117
- package/src/mu/AutocompleteExtendedProps.ts +0 -84
- package/src/mu/BackButton.tsx +0 -55
- package/src/mu/BridgeCloseButton.tsx +0 -69
- package/src/mu/ButtonLink.tsx +0 -32
- package/src/mu/ComboBox.tsx +0 -244
- package/src/mu/CountdownButton.tsx +0 -119
- package/src/mu/CustomFabProps.ts +0 -32
- package/src/mu/DataGridEx.tsx +0 -712
- package/src/mu/DataGridRenderers.tsx +0 -140
- package/src/mu/DialogButton.tsx +0 -163
- package/src/mu/DraggablePaperComponent.tsx +0 -19
- package/src/mu/EmailInput.tsx +0 -24
- package/src/mu/FabBox.tsx +0 -51
- package/src/mu/FlexBox.tsx +0 -20
- package/src/mu/GridDataFormat.tsx +0 -77
- package/src/mu/GridMethodRef.ts +0 -12
- package/src/mu/IconButtonLink.tsx +0 -29
- package/src/mu/InputField.tsx +0 -82
- package/src/mu/ItemList.tsx +0 -201
- package/src/mu/ListItemRightIcon.tsx +0 -9
- package/src/mu/ListMoreDisplay.tsx +0 -205
- package/src/mu/LoadingButton.tsx +0 -75
- package/src/mu/MUGlobal.ts +0 -220
- package/src/mu/MaskInput.tsx +0 -107
- package/src/mu/MobileListItemRenderer.tsx +0 -79
- package/src/mu/MoreFab.tsx +0 -211
- package/src/mu/NotifierMU.tsx +0 -654
- package/src/mu/NotifierPromptProps.ts +0 -26
- package/src/mu/OptionGroup.tsx +0 -218
- package/src/mu/PList.tsx +0 -27
- package/src/mu/ProgressCount.tsx +0 -166
- package/src/mu/PullToRefreshUI.tsx +0 -21
- package/src/mu/RLink.tsx +0 -64
- package/src/mu/ResponsibleContainer.tsx +0 -394
- package/src/mu/ScrollTopFab.tsx +0 -34
- package/src/mu/ScrollerListEx.tsx +0 -387
- package/src/mu/SearchBar.tsx +0 -398
- package/src/mu/SearchField.tsx +0 -82
- package/src/mu/SearchOptionGroup.tsx +0 -25
- package/src/mu/SelectBool.tsx +0 -40
- package/src/mu/SelectEx.tsx +0 -285
- package/src/mu/Switch.tsx +0 -94
- package/src/mu/SwitchAnt.tsx +0 -95
- package/src/mu/TabBox.tsx +0 -118
- package/src/mu/TableEx.tsx +0 -561
- package/src/mu/TextFieldEx.tsx +0 -250
- package/src/mu/Tiplist.tsx +0 -304
- package/src/mu/TooltipClick.tsx +0 -84
- package/src/mu/UserAvatar.tsx +0 -64
- package/src/mu/UserAvatarEditor.tsx +0 -287
- package/src/mu/pages/CommonPage.tsx +0 -128
- package/src/mu/pages/CommonPageProps.ts +0 -71
- package/src/mu/pages/DataGridPage.tsx +0 -137
- package/src/mu/pages/DataGridPageProps.ts +0 -24
- package/src/mu/pages/EditPage.tsx +0 -114
- package/src/mu/pages/FixedListPage.tsx +0 -134
- package/src/mu/pages/ListPage.tsx +0 -86
- package/src/mu/pages/ListPageProps.ts +0 -11
- package/src/mu/pages/ResponsivePage.tsx +0 -68
- package/src/mu/pages/ResponsivePageProps.ts +0 -57
- package/src/mu/pages/SearchPageProps.ts +0 -39
- package/src/mu/pages/TablePage.tsx +0 -119
- package/src/mu/pages/TablePageProps.ts +0 -11
- package/src/mu/pages/ViewPage.tsx +0 -285
- package/src/mu/texts/DateText.tsx +0 -74
- package/src/mu/texts/MoneyText.tsx +0 -49
- package/src/mu/texts/NumberText.tsx +0 -40
package/lib/app/CommonApp.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { CoreConstants } from './CoreConstants';
|
|
2
|
-
import { ReactApp } from './ReactApp';
|
|
3
|
-
/**
|
|
4
|
-
* Common independent application
|
|
5
|
-
* 通用独立程序
|
|
6
|
-
*/
|
|
7
|
-
export class CommonApp extends ReactApp {
|
|
8
|
-
/**
|
|
9
|
-
* Override persistedFields
|
|
10
|
-
*/
|
|
11
|
-
get persistedFields() {
|
|
12
|
-
return [...super.persistedFields, CoreConstants.FieldUserIdSaved];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Init call update fields in local storage
|
|
16
|
-
* @returns Fields
|
|
17
|
-
*/
|
|
18
|
-
initCallEncryptedUpdateFields() {
|
|
19
|
-
const fields = super.initCallEncryptedUpdateFields();
|
|
20
|
-
fields.push(CoreConstants.FieldUserIdSaved);
|
|
21
|
-
return fields;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Do user login
|
|
25
|
-
* @param data User data
|
|
26
|
-
* @param refreshToken Refresh token
|
|
27
|
-
* @param keep Keep login
|
|
28
|
-
* @returns Success data
|
|
29
|
-
*/
|
|
30
|
-
doUserLogin(data, refreshToken, keep) {
|
|
31
|
-
this.userLogin(data, refreshToken, keep);
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Refresh token
|
|
36
|
-
* @param props Props
|
|
37
|
-
*/
|
|
38
|
-
async refreshToken(props) {
|
|
39
|
-
// Destruct
|
|
40
|
-
const { callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
|
|
41
|
-
// Token
|
|
42
|
-
const token = this.getCacheToken();
|
|
43
|
-
if (token == null || token === '') {
|
|
44
|
-
if (callback)
|
|
45
|
-
callback(false);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
// Reqest data
|
|
49
|
-
const rq = {
|
|
50
|
-
deviceId: this.deviceId,
|
|
51
|
-
timezone: this.getTimeZone(),
|
|
52
|
-
...data
|
|
53
|
-
};
|
|
54
|
-
// Payload
|
|
55
|
-
const payload = {
|
|
56
|
-
// No loading bar needed to avoid screen flicks
|
|
57
|
-
showLoading,
|
|
58
|
-
config: { headers: { [CoreConstants.TokenHeaderRefresh]: token } },
|
|
59
|
-
onError: (error) => {
|
|
60
|
-
if (callback)
|
|
61
|
-
callback(error);
|
|
62
|
-
// Prevent further processing
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
// Success callback
|
|
67
|
-
const success = (result, failCallback) => {
|
|
68
|
-
// Token
|
|
69
|
-
const refreshToken = this.getResponseToken(payload.response);
|
|
70
|
-
if (refreshToken == null || result.data == null) {
|
|
71
|
-
if (failCallback)
|
|
72
|
-
failCallback(this.get('noData'));
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
// Keep
|
|
76
|
-
const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
|
|
77
|
-
// User login
|
|
78
|
-
var successData = this.doUserLogin(result.data, refreshToken, keep);
|
|
79
|
-
// Callback
|
|
80
|
-
if (failCallback)
|
|
81
|
-
failCallback(true, successData);
|
|
82
|
-
return true;
|
|
83
|
-
};
|
|
84
|
-
// Call API
|
|
85
|
-
const result = await this.api.put('Auth/RefreshToken', rq, payload);
|
|
86
|
-
if (result == null)
|
|
87
|
-
return false;
|
|
88
|
-
if (!result.ok) {
|
|
89
|
-
if (result.type === 'TokenExpired' && relogin) {
|
|
90
|
-
// Try login
|
|
91
|
-
// Dialog to receive password
|
|
92
|
-
var labels = this.getLabels('reloginTip', 'login');
|
|
93
|
-
this.notifier.prompt(labels.reloginTip, async (pwd) => {
|
|
94
|
-
if (pwd == null) {
|
|
95
|
-
this.toLoginPage();
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
// Set password for the action
|
|
99
|
-
rq.pwd = this.encrypt(this.hash(pwd));
|
|
100
|
-
// Submit again
|
|
101
|
-
const result = await this.api.put('Auth/RefreshToken', rq, payload);
|
|
102
|
-
if (result == null)
|
|
103
|
-
return;
|
|
104
|
-
if (result.ok) {
|
|
105
|
-
success(result, (loginResult) => {
|
|
106
|
-
if (loginResult === true) {
|
|
107
|
-
if (callback)
|
|
108
|
-
callback(true);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const message = this.formatRefreshTokenResult(loginResult);
|
|
112
|
-
if (message)
|
|
113
|
-
this.notifier.alert(message);
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
// Popup message
|
|
118
|
-
this.alertResult(result);
|
|
119
|
-
return false;
|
|
120
|
-
}, labels.login, { type: 'password' });
|
|
121
|
-
// Fake truth to avoid reloading
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
if (callback)
|
|
125
|
-
callback(result);
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return success(result, callback);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Try login
|
|
132
|
-
* @param data Additional data
|
|
133
|
-
* @param showLoading Show loading bar or not
|
|
134
|
-
* @returns Result
|
|
135
|
-
*/
|
|
136
|
-
async tryLogin(data, showLoading) {
|
|
137
|
-
// Reset user state
|
|
138
|
-
const result = await super.tryLogin(data);
|
|
139
|
-
if (!result)
|
|
140
|
-
return false;
|
|
141
|
-
// Refresh token
|
|
142
|
-
return await this.refreshToken({
|
|
143
|
-
callback: (result) => this.doRefreshTokenResult(result),
|
|
144
|
-
data,
|
|
145
|
-
showLoading,
|
|
146
|
-
relogin: true
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IAppSettings } from '@etsoo/appscript';
|
|
2
|
-
import { DataTypes } from '@etsoo/shared';
|
|
3
|
-
/**
|
|
4
|
-
* Service app settings interface
|
|
5
|
-
*/
|
|
6
|
-
export interface IServiceAppSettings<S extends DataTypes.IdType = number> extends IAppSettings {
|
|
7
|
-
/**
|
|
8
|
-
* Service id
|
|
9
|
-
*/
|
|
10
|
-
readonly serviceId: S;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/app/IServicePage.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
|
-
/**
|
|
3
|
-
* Service user interface
|
|
4
|
-
*/
|
|
5
|
-
export interface IServiceUser extends IUser {
|
|
6
|
-
/**
|
|
7
|
-
* Service device id
|
|
8
|
-
*/
|
|
9
|
-
serviceDeviceId: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Service user login result
|
|
13
|
-
*/
|
|
14
|
-
export declare type ServiceLoginResult<U extends IServiceUser = IServiceUser> = IActionResult<U>;
|
package/lib/app/IServiceUser.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
|
-
/**
|
|
3
|
-
* SmartERP user interface
|
|
4
|
-
*/
|
|
5
|
-
export interface ISmartERPUser extends IUser {
|
|
6
|
-
/**
|
|
7
|
-
* Service refresh token
|
|
8
|
-
*/
|
|
9
|
-
readonly serviceToken?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* SmartERP user login result
|
|
13
|
-
*/
|
|
14
|
-
export declare type SmartERPLoginResult = IActionResult<ISmartERPUser>;
|
package/lib/app/ISmartERPUser.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/app/Labels.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { DataTypes } from '@etsoo/shared';
|
|
2
|
-
/**
|
|
3
|
-
* Labels
|
|
4
|
-
*/
|
|
5
|
-
export declare namespace Labels {
|
|
6
|
-
/**
|
|
7
|
-
* Common page labels
|
|
8
|
-
*/
|
|
9
|
-
const CommonPage: {
|
|
10
|
-
add: string;
|
|
11
|
-
back: string;
|
|
12
|
-
delete: string;
|
|
13
|
-
more: string;
|
|
14
|
-
pullToRefresh: string;
|
|
15
|
-
refresh: string;
|
|
16
|
-
refreshing: string;
|
|
17
|
-
releaseToRefresh: string;
|
|
18
|
-
reset: string;
|
|
19
|
-
save: string;
|
|
20
|
-
scrollTop: string;
|
|
21
|
-
submit: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Notification MU labels
|
|
25
|
-
*/
|
|
26
|
-
const NotificationMU: {
|
|
27
|
-
alertTitle: string;
|
|
28
|
-
alertOK: string;
|
|
29
|
-
confirmTitle: string;
|
|
30
|
-
confirmYes: string;
|
|
31
|
-
confirmNo: string;
|
|
32
|
-
promptTitle: string;
|
|
33
|
-
promptCancel: string;
|
|
34
|
-
promptOK: string;
|
|
35
|
-
loading: string;
|
|
36
|
-
success: string;
|
|
37
|
-
warning: string;
|
|
38
|
-
info: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* UserAvatarEditor labels
|
|
42
|
-
*/
|
|
43
|
-
const UserAvatarEditor: {
|
|
44
|
-
done: string;
|
|
45
|
-
reset: string;
|
|
46
|
-
rotateLeft: string;
|
|
47
|
-
rotateRight: string;
|
|
48
|
-
upload: string;
|
|
49
|
-
zoom: string;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* setLabelReference key reference
|
|
53
|
-
*/
|
|
54
|
-
interface setLabelsReference {
|
|
55
|
-
commonPage?: DataTypes.StringDictionary;
|
|
56
|
-
notificationMU?: DataTypes.StringDictionary;
|
|
57
|
-
userAvatarEditor?: DataTypes.StringDictionary;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Set components' labels
|
|
61
|
-
* @param labels Labels
|
|
62
|
-
* @param reference Key reference
|
|
63
|
-
*/
|
|
64
|
-
const setLabels: (labels: DataTypes.StringRecord, reference?: setLabelsReference) => void;
|
|
65
|
-
}
|
package/lib/app/Labels.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Utils } from '@etsoo/shared';
|
|
2
|
-
/**
|
|
3
|
-
* Labels
|
|
4
|
-
*/
|
|
5
|
-
export var Labels;
|
|
6
|
-
(function (Labels) {
|
|
7
|
-
/**
|
|
8
|
-
* Common page labels
|
|
9
|
-
*/
|
|
10
|
-
Labels.CommonPage = {
|
|
11
|
-
add: 'Add',
|
|
12
|
-
back: 'Back',
|
|
13
|
-
delete: 'Delete',
|
|
14
|
-
more: 'More',
|
|
15
|
-
pullToRefresh: 'Pull down to refresh',
|
|
16
|
-
refresh: 'Refresh',
|
|
17
|
-
refreshing: 'Refreshing',
|
|
18
|
-
releaseToRefresh: 'Release to refresh',
|
|
19
|
-
reset: 'Reset',
|
|
20
|
-
save: 'Save',
|
|
21
|
-
scrollTop: 'Scroll to top',
|
|
22
|
-
submit: 'Submit'
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Notification MU labels
|
|
26
|
-
*/
|
|
27
|
-
Labels.NotificationMU = {
|
|
28
|
-
alertTitle: 'Warning',
|
|
29
|
-
alertOK: 'OK',
|
|
30
|
-
confirmTitle: 'Confirm',
|
|
31
|
-
confirmYes: 'OK',
|
|
32
|
-
confirmNo: 'Cancel',
|
|
33
|
-
promptTitle: 'Input',
|
|
34
|
-
promptCancel: 'Cancel',
|
|
35
|
-
promptOK: 'OK',
|
|
36
|
-
loading: 'Loading',
|
|
37
|
-
success: 'Success',
|
|
38
|
-
warning: 'Warning',
|
|
39
|
-
info: 'Information'
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* UserAvatarEditor labels
|
|
43
|
-
*/
|
|
44
|
-
Labels.UserAvatarEditor = {
|
|
45
|
-
done: 'Done',
|
|
46
|
-
reset: 'Reset',
|
|
47
|
-
rotateLeft: 'Rotate left 90°',
|
|
48
|
-
rotateRight: 'Rotate right 90°',
|
|
49
|
-
upload: 'Upload',
|
|
50
|
-
zoom: 'Zoom'
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Set components' labels
|
|
54
|
-
* @param labels Labels
|
|
55
|
-
* @param reference Key reference
|
|
56
|
-
*/
|
|
57
|
-
Labels.setLabels = (labels, reference = {}) => {
|
|
58
|
-
Utils.setLabels(Labels.CommonPage, labels, reference.commonPage);
|
|
59
|
-
Utils.setLabels(Labels.NotificationMU, labels, reference.notificationMU);
|
|
60
|
-
Utils.setLabels(Labels.UserAvatarEditor, labels, reference.userAvatarEditor);
|
|
61
|
-
};
|
|
62
|
-
})(Labels || (Labels = {}));
|
package/lib/app/ReactApp.d.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { CoreApp, IActionResult, IAppSettings, ICoreApp, IUser } from '@etsoo/appscript';
|
|
2
|
-
import { NotificationRenderProps, NotificationReturn } from '@etsoo/notificationbase';
|
|
3
|
-
import { DataTypes } from '@etsoo/shared';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { INotificationReact, NotificationReactCallProps } from '../notifier/Notifier';
|
|
6
|
-
import { CultureAction, CultureState } from '../states/CultureState';
|
|
7
|
-
import { IStateProps } from '../states/IState';
|
|
8
|
-
import { IPageData, PageAction, PageState } from '../states/PageState';
|
|
9
|
-
import { UserAction, UserState } from '../states/UserState';
|
|
10
|
-
import { InputDialogProps } from './InputDialogProps';
|
|
11
|
-
import { History } from 'history';
|
|
12
|
-
/**
|
|
13
|
-
* Global application
|
|
14
|
-
*/
|
|
15
|
-
export declare let globalApp: IReactApp<IAppSettings, any, IPageData>;
|
|
16
|
-
/**
|
|
17
|
-
* React app state detector
|
|
18
|
-
* Case 1: undefined, when refresh the whole page
|
|
19
|
-
* Case 2: false, unauthorized
|
|
20
|
-
* Case 3: true, authorized or considered as authorized (maynot, like token expiry)
|
|
21
|
-
* Case 4: property or properties changed
|
|
22
|
-
* @param props Props
|
|
23
|
-
* @returns Component
|
|
24
|
-
*/
|
|
25
|
-
export declare function ReactAppStateDetector(props: IStateProps): React.FunctionComponentElement<{
|
|
26
|
-
children?: React.ReactNode;
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Core application interface
|
|
30
|
-
*/
|
|
31
|
-
export interface IReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends ICoreApp<D, S, React.ReactNode, NotificationReactCallProps> {
|
|
32
|
-
/**
|
|
33
|
-
* User state
|
|
34
|
-
*/
|
|
35
|
-
readonly userState: UserState<D>;
|
|
36
|
-
/**
|
|
37
|
-
* Router history
|
|
38
|
-
*/
|
|
39
|
-
readonly history: History;
|
|
40
|
-
/**
|
|
41
|
-
* Is screen size down 'sm'
|
|
42
|
-
*/
|
|
43
|
-
smDown?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Is screen size up 'md'
|
|
46
|
-
*/
|
|
47
|
-
mdUp?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Set page data
|
|
50
|
-
* @param data Page data
|
|
51
|
-
*/
|
|
52
|
-
setPageData(data: P): void;
|
|
53
|
-
/**
|
|
54
|
-
* Set page title and data
|
|
55
|
-
* @param key Page title resource key
|
|
56
|
-
*/
|
|
57
|
-
setPageKey(key: string): void;
|
|
58
|
-
/**
|
|
59
|
-
* Set page title and data
|
|
60
|
-
* @param title Page title
|
|
61
|
-
*/
|
|
62
|
-
setPageTitle(title: string): void;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* React application
|
|
66
|
-
*/
|
|
67
|
-
export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends CoreApp<D, S, React.ReactNode, NotificationReactCallProps> implements IReactApp<S, D, P> {
|
|
68
|
-
private static _notifierProvider;
|
|
69
|
-
/**
|
|
70
|
-
* Get notifier provider
|
|
71
|
-
*/
|
|
72
|
-
static get notifierProvider(): React.FunctionComponent<NotificationRenderProps>;
|
|
73
|
-
private static createApi;
|
|
74
|
-
private static createNotifier;
|
|
75
|
-
/**
|
|
76
|
-
* Culture state
|
|
77
|
-
*/
|
|
78
|
-
readonly cultureState: CultureState;
|
|
79
|
-
/**
|
|
80
|
-
* Router history
|
|
81
|
-
*/
|
|
82
|
-
readonly history: History;
|
|
83
|
-
/**
|
|
84
|
-
* Page state
|
|
85
|
-
*/
|
|
86
|
-
readonly pageState: PageState<P>;
|
|
87
|
-
/**
|
|
88
|
-
* User state
|
|
89
|
-
*/
|
|
90
|
-
readonly userState: UserState<D>;
|
|
91
|
-
/**
|
|
92
|
-
* Is screen size down 'sm'
|
|
93
|
-
*/
|
|
94
|
-
smDown?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Is screen size up 'md'
|
|
97
|
-
*/
|
|
98
|
-
mdUp?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Page state dispatch
|
|
101
|
-
*/
|
|
102
|
-
pageStateDispatch?: React.Dispatch<PageAction<P>>;
|
|
103
|
-
/**
|
|
104
|
-
* User state dispatch
|
|
105
|
-
*/
|
|
106
|
-
userStateDispatch?: React.Dispatch<UserAction<D>>;
|
|
107
|
-
/**
|
|
108
|
-
* Constructor
|
|
109
|
-
* @param settings Settings
|
|
110
|
-
* @param name Application name
|
|
111
|
-
*/
|
|
112
|
-
constructor(settings: S, name: string);
|
|
113
|
-
/**
|
|
114
|
-
* Override alert action result
|
|
115
|
-
* @param result Action result
|
|
116
|
-
* @param callback Callback
|
|
117
|
-
*/
|
|
118
|
-
alertResult(result: IActionResult, callback?: NotificationReturn<void>): void;
|
|
119
|
-
/**
|
|
120
|
-
* Change culture
|
|
121
|
-
* @param culture New culture definition
|
|
122
|
-
*/
|
|
123
|
-
changeCulture(culture: DataTypes.CultureDefinition): void;
|
|
124
|
-
/**
|
|
125
|
-
* Change culture extended
|
|
126
|
-
* @param dispatch Dispatch method
|
|
127
|
-
* @param culture New culture definition
|
|
128
|
-
*/
|
|
129
|
-
changeCultureEx(dispatch: React.Dispatch<CultureAction>, culture: DataTypes.CultureDefinition): void;
|
|
130
|
-
/**
|
|
131
|
-
* Get date format props
|
|
132
|
-
* @returns Props
|
|
133
|
-
*/
|
|
134
|
-
getDateFormatProps(): {
|
|
135
|
-
culture: string;
|
|
136
|
-
timeZone: string | undefined;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Get money format props
|
|
140
|
-
* @param currency Currency, if undefined, default currency applied
|
|
141
|
-
* @returns Props
|
|
142
|
-
*/
|
|
143
|
-
getMoneyFormatProps(currency?: string): {
|
|
144
|
-
culture: string;
|
|
145
|
-
currency: string;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Fresh countdown UI
|
|
149
|
-
* @param callback Callback
|
|
150
|
-
*/
|
|
151
|
-
freshCountdownUI(callback?: () => PromiseLike<unknown>): void;
|
|
152
|
-
/**
|
|
153
|
-
* Redirect to the Url
|
|
154
|
-
* @param url Url
|
|
155
|
-
*/
|
|
156
|
-
redirectTo(url: string): void;
|
|
157
|
-
/**
|
|
158
|
-
* Set page data
|
|
159
|
-
* @param data Page data
|
|
160
|
-
*/
|
|
161
|
-
setPageData(data: P): void;
|
|
162
|
-
/**
|
|
163
|
-
* Set page title and data
|
|
164
|
-
* @param title Page title
|
|
165
|
-
*/
|
|
166
|
-
setPageTitle(title: string): void;
|
|
167
|
-
/**
|
|
168
|
-
* Set page title and data
|
|
169
|
-
* @param key Page title resource key
|
|
170
|
-
*/
|
|
171
|
-
setPageKey(key: string): void;
|
|
172
|
-
/**
|
|
173
|
-
* Show input dialog
|
|
174
|
-
* @param props Props
|
|
175
|
-
*/
|
|
176
|
-
showInputDialog({ title, message, callback, ...rest }: InputDialogProps): INotificationReact;
|
|
177
|
-
/**
|
|
178
|
-
* User login extended
|
|
179
|
-
* @param user New user
|
|
180
|
-
* @param refreshToken Refresh token
|
|
181
|
-
* @param keep Keep in local storage or not
|
|
182
|
-
* @param dispatch User state dispatch
|
|
183
|
-
*/
|
|
184
|
-
userLogin(user: D, refreshToken: string, keep?: boolean, dispatch?: boolean): void;
|
|
185
|
-
/**
|
|
186
|
-
* User logout
|
|
187
|
-
* @param clearToken Clear refresh token or not
|
|
188
|
-
*/
|
|
189
|
-
userLogout(clearToken?: boolean): void;
|
|
190
|
-
/**
|
|
191
|
-
* User unauthorized
|
|
192
|
-
*/
|
|
193
|
-
userUnauthorized(): void;
|
|
194
|
-
}
|