educoreapp2 1.0.77 → 1.0.79
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/dist/App.css +111 -0
- package/dist/EduApp.js +309 -0
- package/dist/Tools.js +235 -0
- package/dist/Translate.js +33 -0
- package/dist/img/404.png +0 -0
- package/dist/img/lang_en.svg +10 -0
- package/dist/img/lang_pl.svg +4 -0
- package/dist/img/logo.png +0 -0
- package/dist/img/nointernet.png +0 -0
- package/dist/img/update.png +0 -0
- package/dist/index.js +236 -0
- package/dist/lib/API.js +65 -0
- package/dist/lib/APIFaker.js +57 -0
- package/dist/lib/APILocal.js +76 -0
- package/dist/lib/APIServer.js +76 -0
- package/dist/lib/ApiCode.js +11 -0
- package/dist/spxbasecode/EduLog.js +16 -0
- package/dist/spxbasecode/Request.js +43 -0
- package/dist/spxbasecode/Validators.js +66 -0
- package/dist/spxbasecode/WS.js +71 -0
- package/dist/spxbasecode/cmps/8.jpg +0 -0
- package/dist/spxbasecode/cmps/BaseAnimation.js +76 -0
- package/dist/spxbasecode/cmps/BaseAutocomplete.js +81 -0
- package/dist/spxbasecode/cmps/BaseButton.js +41 -0
- package/dist/spxbasecode/cmps/BaseButtonCountry.js +48 -0
- package/dist/spxbasecode/cmps/BaseButtonIcon.js +78 -0
- package/dist/spxbasecode/cmps/BaseButtonImage.js +66 -0
- package/dist/spxbasecode/cmps/BaseCard.js +95 -0
- package/dist/spxbasecode/cmps/BaseCenter.js +33 -0
- package/dist/spxbasecode/cmps/BaseError.js +48 -0
- package/dist/spxbasecode/cmps/BaseForm.js +141 -0
- package/dist/spxbasecode/cmps/BaseForm2.js +78 -0
- package/dist/spxbasecode/cmps/BaseImage.js +45 -0
- package/dist/spxbasecode/cmps/BaseImg.js +62 -0
- package/dist/spxbasecode/cmps/BaseInputString.js +269 -0
- package/dist/spxbasecode/cmps/BaseLabel.js +48 -0
- package/dist/spxbasecode/cmps/BaseLang.js +51 -0
- package/dist/spxbasecode/cmps/BaseList.js +79 -0
- package/dist/spxbasecode/cmps/BaseListFile.js +79 -0
- package/dist/spxbasecode/cmps/BasePage.js +26 -0
- package/dist/spxbasecode/cmps/BaseReadTextButton.js +40 -0
- package/dist/spxbasecode/cmps/BaseSSOLogin.js +31 -0
- package/dist/spxbasecode/cmps/BaseSlimPage.js +82 -0
- package/dist/spxbasecode/cmps/EduPage.js +20 -0
- package/dist/spxbasecode/cmps/LogoEdupanel.js +41 -0
- package/dist/spxbasecode/cmps/Menu.js +169 -0
- package/dist/spxbasecode/cmps/PageWithMenu.js +55 -0
- package/dist/spxbasecode/cmps/ProfileMenu.js +25 -0
- package/dist/spxbasecode/cmps/SpeechToText.js +48 -0
- package/dist/spxbasecode/cmps/TextToCommand.js +98 -0
- package/dist/spxbasecode/img/soundOff.svg +1 -0
- package/dist/spxbasecode/img/soundOn.png +0 -0
- package/package.json +1 -1
@@ -0,0 +1,141 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _reactstrap = require("reactstrap");
|
9
|
+
var _educoreapp = require("educoreapp2");
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
+
class BaseForm extends _react.Component {
|
13
|
+
constructor(props) {
|
14
|
+
super();
|
15
|
+
this.props = props;
|
16
|
+
this.extraButt = props.extraButt;
|
17
|
+
this.className = !_educoreapp.Tools.empty(props.className) ? props.className : "row";
|
18
|
+
this.label = !_educoreapp.Tools.empty(props.label) ? props.label : "";
|
19
|
+
this.isLocal = !_educoreapp.Tools.empty(props.isLocal) ? props.isLocal : false;
|
20
|
+
this.module = props.module;
|
21
|
+
this.act = props.act;
|
22
|
+
this.objs = {};
|
23
|
+
let this2 = this;
|
24
|
+
setTimeout(() => {
|
25
|
+
this2.props.parent.form = this2;
|
26
|
+
this2.props.parent.initForm();
|
27
|
+
}, 240);
|
28
|
+
this.state = {
|
29
|
+
components: []
|
30
|
+
};
|
31
|
+
}
|
32
|
+
init(data) {
|
33
|
+
for (let k in data) {
|
34
|
+
if (_educoreapp.Tools.empty(this.objs[k])) {
|
35
|
+
continue;
|
36
|
+
}
|
37
|
+
this.objs[k].setValue(data[k]);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
async valid() {
|
41
|
+
let isValid = true;
|
42
|
+
for (let k in this.objs) {
|
43
|
+
let el = this.objs[k];
|
44
|
+
let v = await el.valid();
|
45
|
+
isValid = isValid && v;
|
46
|
+
}
|
47
|
+
return isValid;
|
48
|
+
}
|
49
|
+
addObj(obj) {
|
50
|
+
this.objs[obj.states.name] = obj;
|
51
|
+
}
|
52
|
+
async getData() {
|
53
|
+
let res = {};
|
54
|
+
for (let k in this.objs) {
|
55
|
+
let el = this.objs[k];
|
56
|
+
let v = el.getValue();
|
57
|
+
res[k] = v;
|
58
|
+
}
|
59
|
+
return res;
|
60
|
+
}
|
61
|
+
async setErrorBadLoginOrPasswd() {
|
62
|
+
for (let k in this.objs) {
|
63
|
+
let el = this.objs[k];
|
64
|
+
el.setError('BAD_LOGIN_OR_PASSWORD');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
async setError(ee) {
|
68
|
+
if (ee.code != 500) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
if (ee.error.type == 'BAD_LOGIN_OR_PASSWORD') {
|
72
|
+
await this.setErrorBadLoginOrPasswd();
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
async handle2() {
|
77
|
+
let x = await this.valid();
|
78
|
+
if (!x) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
let params = await this.getData();
|
82
|
+
let this2 = this;
|
83
|
+
window.App.API.exec(this.isLocal, this.module, this.act, params, ss => {
|
84
|
+
//console.log("XxxxkkkkkkXX",ss);
|
85
|
+
let params = [];
|
86
|
+
this2.props.onSucc(ss.data);
|
87
|
+
}, ee => {
|
88
|
+
//if ()
|
89
|
+
this2.setError(ee);
|
90
|
+
console.log("XxxiiiixXX3eeee", ee);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
handleSubmit = event => {
|
94
|
+
event.preventDefault();
|
95
|
+
this.handle2();
|
96
|
+
};
|
97
|
+
submit() {
|
98
|
+
this.handle2();
|
99
|
+
}
|
100
|
+
render() {
|
101
|
+
let error = null;
|
102
|
+
let lab1 = this.props.lab1;
|
103
|
+
let label = this.label;
|
104
|
+
let extraButt = !_educoreapp.Tools.empty(this.extraButt) ? this.extraButt : /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
105
|
+
color: "primary",
|
106
|
+
type: "submit"
|
107
|
+
}, lab1);
|
108
|
+
if (_educoreapp.Tools.empty(lab1)) {
|
109
|
+
lab1 = "Login";
|
110
|
+
}
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Form, {
|
112
|
+
className: this.className,
|
113
|
+
onSubmit: this.handleSubmit
|
114
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
115
|
+
className: "row"
|
116
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
117
|
+
className: "col-1 col-sm-2"
|
118
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
119
|
+
className: "col-10 col-sm-8",
|
120
|
+
style: {
|
121
|
+
display: "inline-flex"
|
122
|
+
}
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_educoreapp.BaseImg, {
|
124
|
+
height: "80px",
|
125
|
+
width: "80px",
|
126
|
+
photo: window.App.Config.logo
|
127
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
128
|
+
style: {
|
129
|
+
textAlign: "center",
|
130
|
+
fontSize: "2em"
|
131
|
+
}
|
132
|
+
}, label), /*#__PURE__*/_react.default.createElement(_educoreapp.BaseImg, {
|
133
|
+
height: "80px",
|
134
|
+
width: "80px",
|
135
|
+
photo: window.App.Config.logo
|
136
|
+
}))), error && /*#__PURE__*/_react.default.createElement(_reactstrap.Alert, {
|
137
|
+
color: "danger"
|
138
|
+
}, error), this.props.children, extraButt);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
var _default = exports.default = BaseForm;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _reactstrap = require("reactstrap");
|
9
|
+
var _BaseInputString = _interopRequireDefault(require("./BaseInputString"));
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13
|
+
class BaseForm2 extends _react.Component {
|
14
|
+
constructor(props) {
|
15
|
+
super();
|
16
|
+
this.props = props;
|
17
|
+
this.objs = {};
|
18
|
+
let this2 = this;
|
19
|
+
setTimeout(() => {
|
20
|
+
this2.props.parent.form = this2;
|
21
|
+
}, 240);
|
22
|
+
this.state = {
|
23
|
+
components: []
|
24
|
+
};
|
25
|
+
}
|
26
|
+
addObj(obj) {
|
27
|
+
this.objs[obj.states.name] = obj;
|
28
|
+
}
|
29
|
+
handleSubmit = event => {
|
30
|
+
event.preventDefault();
|
31
|
+
let xx = this.objs.login;
|
32
|
+
this.addCh();
|
33
|
+
};
|
34
|
+
addXXX(type, props) {
|
35
|
+
if (type == "BaseInputString") {
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_BaseInputString.default, {
|
37
|
+
key: props.key,
|
38
|
+
id: props.id,
|
39
|
+
label: props.label,
|
40
|
+
name: props.name,
|
41
|
+
placeholder: props.placeholder,
|
42
|
+
value: props.value,
|
43
|
+
parent: props.parent
|
44
|
+
});
|
45
|
+
}
|
46
|
+
}
|
47
|
+
addCh() {
|
48
|
+
let pp = {
|
49
|
+
key: this.state.components.length + 1,
|
50
|
+
id: "aaa1",
|
51
|
+
label: "aaa1",
|
52
|
+
name: "aaa1",
|
53
|
+
placeholder: "aaa1",
|
54
|
+
value: "",
|
55
|
+
parent: this.props.parent
|
56
|
+
};
|
57
|
+
let xx = this.addXXX("BaseInputString", pp);
|
58
|
+
let this2 = this;
|
59
|
+
setTimeout(() => {
|
60
|
+
this2.setState(prevState => ({
|
61
|
+
components: [...prevState.components, xx]
|
62
|
+
}));
|
63
|
+
// this2.forceUpdate();
|
64
|
+
}, 500);
|
65
|
+
}
|
66
|
+
render() {
|
67
|
+
let error = null;
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Form, {
|
69
|
+
onSubmit: this.handleSubmit
|
70
|
+
}, error && /*#__PURE__*/_react.default.createElement(_reactstrap.Alert, {
|
71
|
+
color: "danger"
|
72
|
+
}, error), this.state.components, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
73
|
+
color: "primary",
|
74
|
+
type: "submit"
|
75
|
+
}, "Login"));
|
76
|
+
}
|
77
|
+
}
|
78
|
+
var _default = exports.default = BaseForm2;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _reactBootstrap = require("react-bootstrap");
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
11
|
+
class BaseImage extends _react.Component {
|
12
|
+
constructor(props) {
|
13
|
+
super();
|
14
|
+
this.props = props;
|
15
|
+
}
|
16
|
+
render() {
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_reactBootstrap.Card, {
|
18
|
+
onClick: event => this.props.click(event)
|
19
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
20
|
+
style: {
|
21
|
+
position: 'relative',
|
22
|
+
textAlign: 'center'
|
23
|
+
}
|
24
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
25
|
+
src: this.props.src,
|
26
|
+
alt: "Obrazek",
|
27
|
+
style: {
|
28
|
+
width: '100%'
|
29
|
+
}
|
30
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
31
|
+
style: {
|
32
|
+
position: 'absolute',
|
33
|
+
top: '50%',
|
34
|
+
left: '50%',
|
35
|
+
transform: 'translate(-50%, -50%)'
|
36
|
+
}
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Card.Body, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Card.Title, {
|
38
|
+
style: {
|
39
|
+
fontSize: "40px",
|
40
|
+
color: 'white'
|
41
|
+
}
|
42
|
+
}, this.props.title)))));
|
43
|
+
}
|
44
|
+
}
|
45
|
+
var _default = exports.default = BaseImage;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _educoreapp = require("educoreapp2");
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
11
|
+
class BaseImg extends _react.Component {
|
12
|
+
constructor(props) {
|
13
|
+
super();
|
14
|
+
this.states = {};
|
15
|
+
this.initFromProps(props);
|
16
|
+
}
|
17
|
+
initFromProps(props) {
|
18
|
+
if (_educoreapp.Tools.empty(props)) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
//this.setState("onClick",props.onClick);
|
22
|
+
this.states.onClick = props.onClick;
|
23
|
+
this.states.backgroundColor = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.backgroundColor) ? props.backgroundColor : "inherit";
|
24
|
+
this.states.label = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.label) ? props.label : "";
|
25
|
+
this.states.photo = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.photo) ? props.photo : null;
|
26
|
+
this.states.alt = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.alt) ? props.alt : "";
|
27
|
+
this.states.nvdiscrpt = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.nvdiscrpt) ? props.nvdiscrpt : "";
|
28
|
+
this.states.width = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.width) ? props.width : "250px";
|
29
|
+
this.states.height = !_educoreapp.Tools.empty(props) && !_educoreapp.Tools.empty(props.height) ? props.height : "50px";
|
30
|
+
}
|
31
|
+
render() {
|
32
|
+
this.initFromProps(this.props);
|
33
|
+
let props = this.states;
|
34
|
+
/*<img style={{width:props.width, height:props.height,
|
35
|
+
backgroundColor: props.backgroundColor}} src={props.photo} alt={props.alt} />
|
36
|
+
*/
|
37
|
+
if (!_educoreapp.Tools.empty(props.photo)) {
|
38
|
+
let src = props.photo;
|
39
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
40
|
+
role: "figure",
|
41
|
+
"aria-description": this.states.label,
|
42
|
+
style: {
|
43
|
+
backgroundImage: `url(${src})`,
|
44
|
+
backgroundRepeat: "no-repeat",
|
45
|
+
backgroundSize: "100% 100%",
|
46
|
+
backgroundPosition: 'center',
|
47
|
+
width: props.width,
|
48
|
+
height: props.height
|
49
|
+
}
|
50
|
+
});
|
51
|
+
} else {
|
52
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
53
|
+
style: {
|
54
|
+
width: props.width,
|
55
|
+
height: props.height,
|
56
|
+
backgroundColor: props.backgroundColor
|
57
|
+
}
|
58
|
+
});
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
var _default = exports.default = BaseImg;
|
@@ -0,0 +1,269 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _reactstrap = require("reactstrap");
|
9
|
+
var _educoreapp = require("educoreapp2");
|
10
|
+
var _Validators = _interopRequireDefault(require("../Validators"));
|
11
|
+
var _BaseError = _interopRequireDefault(require("./BaseError"));
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
15
|
+
class BaseInputString extends _react.Component {
|
16
|
+
constructor(props) {
|
17
|
+
super();
|
18
|
+
this.isLoadData = false;
|
19
|
+
this.isNeedLoad = false;
|
20
|
+
this.props = props;
|
21
|
+
this.list = [];
|
22
|
+
this.isReadOnly = false;
|
23
|
+
if (!_educoreapp.Tools.empty(props.readonly)) {
|
24
|
+
this.isReadOnly = props.readonly;
|
25
|
+
}
|
26
|
+
this.module = props.module;
|
27
|
+
this.pageName = props.pageName;
|
28
|
+
this.value = null;
|
29
|
+
if (this.props.type == "select") {
|
30
|
+
this.isNeedLoad = true;
|
31
|
+
}
|
32
|
+
this.state = {
|
33
|
+
value: this.value
|
34
|
+
};
|
35
|
+
this.states = {
|
36
|
+
rq: 1,
|
37
|
+
id: props.id,
|
38
|
+
className2: "inputStringNeutral",
|
39
|
+
label: props.label,
|
40
|
+
name: props.name,
|
41
|
+
error: "",
|
42
|
+
placeholder: props.placeholder,
|
43
|
+
validator: {
|
44
|
+
maxLength: props.maxlength,
|
45
|
+
minLength: props.minlength,
|
46
|
+
require: props.require
|
47
|
+
}
|
48
|
+
};
|
49
|
+
this.validator = this.states.validator;
|
50
|
+
let this2 = this;
|
51
|
+
setTimeout(() => {
|
52
|
+
this2.props.parent.form.addObj(this2);
|
53
|
+
}, 500);
|
54
|
+
//this.states.type="text";
|
55
|
+
}
|
56
|
+
setNeutral() {
|
57
|
+
this.states.error = null;
|
58
|
+
this.states.className2 = "inputStringNeutral";
|
59
|
+
this.upd();
|
60
|
+
}
|
61
|
+
setOK() {
|
62
|
+
this.states.error = null;
|
63
|
+
this.states.className2 = "inputStringOK";
|
64
|
+
this.upd();
|
65
|
+
}
|
66
|
+
upd() {
|
67
|
+
this.setState({
|
68
|
+
rq: this.states.rq++
|
69
|
+
});
|
70
|
+
}
|
71
|
+
setError(error) {
|
72
|
+
let TT = _educoreapp.Translate.getT(window.App.lang, "Error", "Error");
|
73
|
+
let xx = "inputStringError";
|
74
|
+
this.states.className2 = xx;
|
75
|
+
let str = TT[error];
|
76
|
+
console.log(error, this.states.validator.minLength);
|
77
|
+
let MAP = {
|
78
|
+
"label": this.states.label,
|
79
|
+
"minLength": this.states.validator.minLength,
|
80
|
+
"maxLength": this.states.validator.maxLength
|
81
|
+
};
|
82
|
+
for (let k in MAP) {
|
83
|
+
//console.log(k);
|
84
|
+
let val = MAP[k];
|
85
|
+
str = str.replaceAll("$" + k + "$", val);
|
86
|
+
}
|
87
|
+
//console.log(str,TT[error]);
|
88
|
+
this.states.error = str;
|
89
|
+
this.upd();
|
90
|
+
}
|
91
|
+
async valid() {
|
92
|
+
this.setNeutral();
|
93
|
+
let val = this.getValue();
|
94
|
+
let val1 = await _Validators.default.IsRequire(this, val);
|
95
|
+
if (!val1) {
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
let val2 = await _Validators.default.HasMinLength(this, val);
|
99
|
+
if (!val2) {
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
let val3 = await _Validators.default.HasMaxLength(this, val);
|
103
|
+
if (!val3) {
|
104
|
+
return false;
|
105
|
+
}
|
106
|
+
let val4 = true;
|
107
|
+
if (["passwordNumber"].indexOf(this.props.type) >= 0) {
|
108
|
+
val4 = await _Validators.default.IsNumeric(this, val);
|
109
|
+
}
|
110
|
+
if (!val4) {
|
111
|
+
console.log("EEEEEE", this.states.name, val);
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
this.render();
|
115
|
+
return val1 && val2 && val3;
|
116
|
+
}
|
117
|
+
getValue() {
|
118
|
+
if (this.props.type != "select") {
|
119
|
+
return this.value;
|
120
|
+
}
|
121
|
+
{
|
122
|
+
let inp = document.getElementById(this.states.id);
|
123
|
+
this.value = inp.value;
|
124
|
+
return this.value;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
setValue(data) {
|
128
|
+
this.value = data;
|
129
|
+
this.state.value = this.value;
|
130
|
+
let inp = document.getElementById(this.states.id);
|
131
|
+
if (inp !== null) {
|
132
|
+
inp.value = this.value;
|
133
|
+
}
|
134
|
+
this.upd();
|
135
|
+
}
|
136
|
+
handleChange = event => {
|
137
|
+
this.setNeutral();
|
138
|
+
const {
|
139
|
+
name,
|
140
|
+
value
|
141
|
+
} = event.target;
|
142
|
+
//console.log(value);
|
143
|
+
this.value = _educoreapp.Tools.copy(value, true);
|
144
|
+
//this.states.value=Tools.copy(value,true);
|
145
|
+
//value={this.state.value}
|
146
|
+
};
|
147
|
+
renderString(typ) {
|
148
|
+
let className3 = this.states.className2 + "";
|
149
|
+
if (this.isReadOnly) {
|
150
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
151
|
+
className: className3,
|
152
|
+
type: typ,
|
153
|
+
name: this.states.name,
|
154
|
+
readOnly: true,
|
155
|
+
id: this.states.id,
|
156
|
+
placeholder: this.states.placeholder,
|
157
|
+
onChange: this.handleChange
|
158
|
+
});
|
159
|
+
} else {
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
161
|
+
className: className3,
|
162
|
+
type: typ,
|
163
|
+
name: this.states.name,
|
164
|
+
id: this.states.id,
|
165
|
+
placeholder: this.states.placeholder,
|
166
|
+
onChange: this.handleChange
|
167
|
+
});
|
168
|
+
}
|
169
|
+
}
|
170
|
+
renderText() {
|
171
|
+
let className3 = this.states.className2 + "";
|
172
|
+
if (this.isReadOnly) {
|
173
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
174
|
+
className: className3,
|
175
|
+
type: typ,
|
176
|
+
name: this.states.name,
|
177
|
+
readOnly: true,
|
178
|
+
id: this.states.id,
|
179
|
+
placeholder: this.states.placeholder,
|
180
|
+
onChange: this.handleChange
|
181
|
+
});
|
182
|
+
} else {
|
183
|
+
return /*#__PURE__*/_react.default.createElement("textarea", {
|
184
|
+
className: className3,
|
185
|
+
type: typ,
|
186
|
+
name: this.states.name,
|
187
|
+
id: this.states.id,
|
188
|
+
placeholder: this.states.placeholder,
|
189
|
+
rows: "40",
|
190
|
+
cols: "100",
|
191
|
+
onChange: this.handleChange
|
192
|
+
});
|
193
|
+
}
|
194
|
+
}
|
195
|
+
renderSelect() {
|
196
|
+
let className3 = "form-select " + this.states.className2 + "";
|
197
|
+
return /*#__PURE__*/_react.default.createElement("select", {
|
198
|
+
name: this.states.name,
|
199
|
+
id: this.states.id,
|
200
|
+
className: className3,
|
201
|
+
size: "3",
|
202
|
+
"aria-label": "size 3 select example"
|
203
|
+
}, Object.keys(this.list).map(function (key) {
|
204
|
+
let el = this.list[key];
|
205
|
+
let vname = el.vname;
|
206
|
+
let id = el.id;
|
207
|
+
return /*#__PURE__*/_react.default.createElement("option", {
|
208
|
+
key: id,
|
209
|
+
value: id
|
210
|
+
}, vname);
|
211
|
+
}.bind(this)));
|
212
|
+
}
|
213
|
+
loadData() {
|
214
|
+
//console.log("loadData",this.props);
|
215
|
+
let listName = this.props.list;
|
216
|
+
let this2 = this;
|
217
|
+
window.App.getList(listName, function (data) {
|
218
|
+
this2.isLoadData = true;
|
219
|
+
// console.log("loadData data",data);
|
220
|
+
this2.list = data;
|
221
|
+
this2.upd();
|
222
|
+
});
|
223
|
+
}
|
224
|
+
render() {
|
225
|
+
if (this.isNeedLoad) {
|
226
|
+
if (!this.isLoadData) {
|
227
|
+
this.loadData();
|
228
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "Not load");
|
229
|
+
}
|
230
|
+
}
|
231
|
+
let rendObj = this.renderString("string");
|
232
|
+
switch (this.props.type) {
|
233
|
+
case "passwordNumber":
|
234
|
+
rendObj = this.renderString("password");
|
235
|
+
break;
|
236
|
+
case "text":
|
237
|
+
rendObj = this.renderText();
|
238
|
+
break;
|
239
|
+
case "select":
|
240
|
+
rendObj = this.renderSelect();
|
241
|
+
break;
|
242
|
+
case "date":
|
243
|
+
rendObj = this.renderString("date");
|
244
|
+
break;
|
245
|
+
default:
|
246
|
+
break;
|
247
|
+
}
|
248
|
+
|
249
|
+
/*
|
250
|
+
<FormGroup>
|
251
|
+
<Label style={{color:'white'}} for="email">{this.states.label}</Label>*/
|
252
|
+
let label2 = "";
|
253
|
+
let isShowLabel = true;
|
254
|
+
if (isShowLabel) {
|
255
|
+
label2 = /*#__PURE__*/_react.default.createElement(_reactstrap.Label, {
|
256
|
+
style: {
|
257
|
+
color: 'black'
|
258
|
+
},
|
259
|
+
for: "email"
|
260
|
+
}, this.states.label);
|
261
|
+
}
|
262
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
263
|
+
className: "row mb-3"
|
264
|
+
}, label2, rendObj, /*#__PURE__*/_react.default.createElement(_BaseError.default, {
|
265
|
+
text: this.states.error
|
266
|
+
}));
|
267
|
+
}
|
268
|
+
}
|
269
|
+
var _default = exports.default = BaseInputString;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
+
var _educoreapp = require("educoreapp2");
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
|
+
class BaseLabel extends _react.default.Component {
|
12
|
+
render() {
|
13
|
+
let {
|
14
|
+
text,
|
15
|
+
color,
|
16
|
+
font,
|
17
|
+
size,
|
18
|
+
data
|
19
|
+
} = this.props;
|
20
|
+
if (!_educoreapp.Tools.empty(data)) {
|
21
|
+
color = data.color;
|
22
|
+
font = data.font;
|
23
|
+
size = data.font_size;
|
24
|
+
text = data.text;
|
25
|
+
}
|
26
|
+
const labelStyle = {
|
27
|
+
color: color,
|
28
|
+
fontFamily: font,
|
29
|
+
fontSize: size
|
30
|
+
//textAlign:"center"
|
31
|
+
};
|
32
|
+
return /*#__PURE__*/_react.default.createElement("label", {
|
33
|
+
style: labelStyle
|
34
|
+
}, text);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
BaseLabel.propTypes = {
|
38
|
+
content: _propTypes.default.string,
|
39
|
+
color: _propTypes.default.string,
|
40
|
+
font: _propTypes.default.string,
|
41
|
+
size: _propTypes.default.string
|
42
|
+
};
|
43
|
+
BaseLabel.defaultProps = {
|
44
|
+
color: 'black',
|
45
|
+
font: 'Arial',
|
46
|
+
size: '14px'
|
47
|
+
};
|
48
|
+
var _default = exports.default = BaseLabel;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _lang_pl = require("../../img/lang_pl.svg");
|
9
|
+
var _lang_en = require("../../img/lang_en.svg");
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
+
function BaseFlag(props) {
|
13
|
+
if (props.lang === "pl_PL") {
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_lang_pl.ReactComponent, {
|
15
|
+
width: props.width,
|
16
|
+
height: props.height
|
17
|
+
});
|
18
|
+
} else if (props.lang === "en_GB") {
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_lang_en.ReactComponent, {
|
20
|
+
width: props.width,
|
21
|
+
height: props.height
|
22
|
+
});
|
23
|
+
} else {
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_lang_en.ReactComponent, {
|
25
|
+
width: props.width,
|
26
|
+
height: props.height
|
27
|
+
});
|
28
|
+
}
|
29
|
+
}
|
30
|
+
class BaseLang extends _react.Component {
|
31
|
+
constructor(props) {
|
32
|
+
super();
|
33
|
+
this.props = props;
|
34
|
+
}
|
35
|
+
render() {
|
36
|
+
let lang = "pl_PL";
|
37
|
+
if (window.App.lang === 'pl_PL') {
|
38
|
+
lang = "en_GB";
|
39
|
+
}
|
40
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
41
|
+
onClick: event => window.App.changeLang(lang),
|
42
|
+
width: "50",
|
43
|
+
height: "50"
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(BaseFlag, {
|
45
|
+
width: "50",
|
46
|
+
height: "50",
|
47
|
+
lang: lang
|
48
|
+
}));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
var _default = exports.default = BaseLang;
|