@firedesktop/react-base 1.51.0 → 1.52.0
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/package.json +1 -1
- package/src/App.test.tsx +0 -9
- package/src/App.tsx +0 -170
- package/src/TestLabelFunction.tsx +0 -17
- package/src/index.tsx +0 -27
- package/src/react-app-env.d.ts +0 -1
- package/src/reportWebVitals.ts +0 -15
- package/src/setupTests.ts +0 -5
package/package.json
CHANGED
package/src/App.test.tsx
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import App from './App';
|
|
4
|
-
|
|
5
|
-
test('renders learn react link', () => {
|
|
6
|
-
render(<App />);
|
|
7
|
-
const linkElement = screen.getByText(/learn react/i);
|
|
8
|
-
expect(linkElement).toBeInTheDocument();
|
|
9
|
-
});
|
package/src/App.tsx
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
2
|
-
import { Provider } from 'react-redux';
|
|
3
|
-
import { createStore } from 'redux';
|
|
4
|
-
|
|
5
|
-
import { Components, ConfigurationLoader, Utils, LanguageLoader, LanguageReturner } from './lib';
|
|
6
|
-
|
|
7
|
-
import DateUtils from './lib/utils/DateUtils';
|
|
8
|
-
|
|
9
|
-
import TestLabelFunction from './TestLabelFunction';
|
|
10
|
-
|
|
11
|
-
import 'bootstrap/dist/css/bootstrap.css';
|
|
12
|
-
import '@syncfusion/ej2-base/styles/bootstrap4.css';
|
|
13
|
-
import '@syncfusion/ej2-buttons/styles/bootstrap4.css';
|
|
14
|
-
import '@syncfusion/ej2-icons/styles/bootstrap4.css';
|
|
15
|
-
import '@syncfusion/ej2-popups/styles/bootstrap4.css';
|
|
16
|
-
|
|
17
|
-
import './lib/styles/base.css';
|
|
18
|
-
import './lib/styles/syncfusion_bootstrap4.css';
|
|
19
|
-
|
|
20
|
-
export const UPDATE_APP_STATE = 'UPDATE_APP_STATE';
|
|
21
|
-
const appReducer = (state = {}, action: any) => {
|
|
22
|
-
switch (action.type) {
|
|
23
|
-
case UPDATE_APP_STATE: {
|
|
24
|
-
const { name, value } = action.payload;
|
|
25
|
-
const newState = { ...state, [name]: value };
|
|
26
|
-
return newState;
|
|
27
|
-
}
|
|
28
|
-
default:
|
|
29
|
-
return state;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function App() {
|
|
34
|
-
const [options, setOptions] = useState<{ value: string }[]>([]);
|
|
35
|
-
const [spinning, setSpinning] = useState(false);
|
|
36
|
-
const [activePage, setActivePage] = useState(1);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function onGenericServerError(status: number) {
|
|
40
|
-
alert(`Error, Status: ${status}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function status_401() {
|
|
44
|
-
alert('Log Out 401');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function status_403() {
|
|
48
|
-
alert('Log Out 403');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function iconClick(event: any) {
|
|
52
|
-
alert('Icon click');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const textFetch = () => {
|
|
56
|
-
if (_referenceRef.current) {
|
|
57
|
-
console.log('dddddddddddddddd');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const labels = { errorGeneric: 'Errore generiro', errorServerNotAvailable: 'No serviziooo', errorSessionExpired: 'Sessione scadurta' } as Utils.Fetch.Types.ILabels;
|
|
61
|
-
|
|
62
|
-
const runner = new Utils.Fetch.FetchWrapper(null, labels, status_401, status_403);
|
|
63
|
-
|
|
64
|
-
// var req = new XMLHttpRequest();
|
|
65
|
-
// req.open('POST', 'https://192.168.12.164:656/flowbot/Authentication/LoginWithForm', true);
|
|
66
|
-
// req.setRequestHeader('Content-Type', 'application/json');
|
|
67
|
-
// req.setRequestHeader('X-Token', '');
|
|
68
|
-
// req.addEventListener('readystatechange', function (ev: Event) {
|
|
69
|
-
// debugger;
|
|
70
|
-
// console.log(ev);
|
|
71
|
-
// // if (this.readyState === 4 && (this.status === 401 || this.status === 403)) {
|
|
72
|
-
// // window.location.href = '#/logoff';
|
|
73
|
-
// // }
|
|
74
|
-
// }, false);
|
|
75
|
-
// req.onreadystatechange = function () {
|
|
76
|
-
// if (req.readyState === 4) {
|
|
77
|
-
// if (req.status >= 200 && req.status < 400) {
|
|
78
|
-
// debugger;
|
|
79
|
-
// } else if (req.status === 400) {
|
|
80
|
-
// debugger;
|
|
81
|
-
// } else if (req.status === 401 || req.status === 403) {
|
|
82
|
-
// debugger;
|
|
83
|
-
// } else {
|
|
84
|
-
// debugger;
|
|
85
|
-
// }
|
|
86
|
-
// }
|
|
87
|
-
// };
|
|
88
|
-
// req.send();
|
|
89
|
-
|
|
90
|
-
setSpinning(true);
|
|
91
|
-
// runner.post('https://192.168.12.164:656/flowbot/Authentication/LoginWithForm', undefined, undefined, { username: 'admin', password: 'a' })
|
|
92
|
-
// .then((authentication: any) => {
|
|
93
|
-
// console.log(authentication);
|
|
94
|
-
// setSpinning(false);
|
|
95
|
-
|
|
96
|
-
// }).catch((errorMessage: any) => {
|
|
97
|
-
// console.log(errorMessage);
|
|
98
|
-
// setSpinning(false);
|
|
99
|
-
// });
|
|
100
|
-
runner.get('https://my-json-server.typicode.com/typicode/demo/posts', null, null, onGenericServerError, null, false, false).then(response => {
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
const values = response.map(x => {
|
|
103
|
-
return { value: x.id, label: x.title };
|
|
104
|
-
});
|
|
105
|
-
setOptions(values);
|
|
106
|
-
setSpinning(false);
|
|
107
|
-
}).catch(errorMessage => {
|
|
108
|
-
setSpinning(false);
|
|
109
|
-
if (errorMessage)
|
|
110
|
-
console.log(errorMessage);
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const updateAppState = (name: string, value: object) => {
|
|
115
|
-
console.log(`updateState name: ${name}, configuration: ${value}`);
|
|
116
|
-
return {
|
|
117
|
-
type: UPDATE_APP_STATE,
|
|
118
|
-
payload: {
|
|
119
|
-
name,
|
|
120
|
-
value,
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const language185Loaded = (language: object) => {
|
|
126
|
-
console.log('185: ->', language);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const onPageChange = (nextPage: number) => {
|
|
130
|
-
setActivePage(nextPage);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
const store = createStore(appReducer);
|
|
135
|
-
const _referenceRef = useRef<any>();
|
|
136
|
-
return (
|
|
137
|
-
|
|
138
|
-
<Provider store={store}>
|
|
139
|
-
<br />
|
|
140
|
-
<Components.AppPagination activePage={activePage} itemsPerPage={7} onPageChange={onPageChange} totalItems={17} maxSize={5} />
|
|
141
|
-
<Components.Spin spinning={spinning} />
|
|
142
|
-
<Components.AppIcon name={'Pin'} className='dark-pink-svg' onClick={iconClick} />
|
|
143
|
-
<TestLabelFunction />
|
|
144
|
-
<ConfigurationLoader updateAppState={updateAppState} path={null} />
|
|
145
|
-
<LanguageLoader updateAppState={updateAppState} language='it-IT' path={null} />
|
|
146
|
-
<LanguageReturner onLanguageLoad={language185Loaded} language='it-IT' path='./labels/185' />
|
|
147
|
-
|
|
148
|
-
<button onClick={textFetch}>Fetch Demo</button>
|
|
149
|
-
{options ? options.map((x: any) => {
|
|
150
|
-
return (<li key={x.value}>ID: {x.value} Post: {x.label}</li>);
|
|
151
|
-
}) : ''}
|
|
152
|
-
|
|
153
|
-
<br />
|
|
154
|
-
<br />
|
|
155
|
-
<br />
|
|
156
|
-
<br />
|
|
157
|
-
{DateUtils().dateToString_Italian(new Date(), '-', undefined)}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<Components.AppInput appIcon={<Components.AppIcon name={'user'} className={'tertiary-svg'}
|
|
161
|
-
iconClassName='login_form_svg' />}
|
|
162
|
-
type='text'
|
|
163
|
-
ref={_referenceRef}
|
|
164
|
-
placeholder='username---'
|
|
165
|
-
name='username' />
|
|
166
|
-
</Provider >
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export default App;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
|
-
import { Utils} from './lib';
|
|
4
|
-
const { getLabel } = Utils.Labels.LanguageManager();
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function TestLabelFunction() {
|
|
8
|
-
const { labels }: any = useSelector(state => state);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<React.Fragment>
|
|
12
|
-
{getLabel(labels, 'demo.label_01', 'Ola')}
|
|
13
|
-
</React.Fragment>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default TestLabelFunction;
|
package/src/index.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { registerLicense } from '@syncfusion/ej2-base';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
|
|
4
|
-
import App from './App';
|
|
5
|
-
import reportWebVitals from './reportWebVitals';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// ****************************************************************************************************
|
|
9
|
-
// Syncfusion Doc
|
|
10
|
-
// https://ej2.syncfusion.com/react/documentation/licensing/license-key-registration/#reactjs
|
|
11
|
-
//
|
|
12
|
-
// ReactJs
|
|
13
|
-
// https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
|
|
14
|
-
//
|
|
15
|
-
// ****************************************************************************************************
|
|
16
|
-
registerLicense('ORg4AjUWIQA/Gnt2VVhhQlFaclhJXGFWfVJpTGpQdk5xdV9DaVZUTWY/P1ZhSXxRdkFjXX5fcXFVT2BeWUE=');
|
|
17
|
-
|
|
18
|
-
const container = document.getElementById('root');
|
|
19
|
-
if (container) {
|
|
20
|
-
const root = createRoot(container);
|
|
21
|
-
root.render(<App />);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// If you want to start measuring performance in your app, pass a function
|
|
25
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
26
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
27
|
-
reportWebVitals();
|
package/src/react-app-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-scripts" />
|
package/src/reportWebVitals.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReportHandler } from 'web-vitals';
|
|
2
|
-
|
|
3
|
-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
-
getCLS(onPerfEntry);
|
|
7
|
-
getFID(onPerfEntry);
|
|
8
|
-
getFCP(onPerfEntry);
|
|
9
|
-
getLCP(onPerfEntry);
|
|
10
|
-
getTTFB(onPerfEntry);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default reportWebVitals;
|
package/src/setupTests.ts
DELETED