d2aura 23.0.48 → 23.0.49
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.
|
@@ -4,7 +4,8 @@ import { ModalDialog } from "d2coreui/components/modal/modalDialog";
|
|
|
4
4
|
import { Alert, Button, Form, Input } from "antd";
|
|
5
5
|
import { LockOutlined } from "@ant-design/icons";
|
|
6
6
|
import { Key } from "ts-key-enum";
|
|
7
|
-
import {
|
|
7
|
+
import { createStyles } from "antd-style";
|
|
8
|
+
import WithCss from "d2coreui/components/style/withCss";
|
|
8
9
|
export default class ChangePasswordModalDialog extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
@@ -57,8 +58,8 @@ export default class ChangePasswordModalDialog extends React.Component {
|
|
|
57
58
|
paddingBottom: 0,
|
|
58
59
|
},
|
|
59
60
|
}, title: this.props.passwordExpired ? i18n("Password expired") : i18n("Change password"), mode: "NO_BUTTONS", closable: !this.props.passwordExpired, open: this.props.open, onCancel: this.props.onCancel, initialWidth: 400, initialHeight: 440, maskClosable: !this.props.passwordExpired, keyboard: !this.props.passwordExpired, footer: React.createElement(Button, { block: true, type: "primary", disabled: this.isConfirmDisabled(), loading: this.state.loading, onClick: this.onChangePassword }, i18n("Confirm")) },
|
|
60
|
-
React.createElement(
|
|
61
|
-
React.createElement(LockOutlined, { style: { fontSize: 60, color:
|
|
61
|
+
React.createElement(WithCss, { useStyles: createStyles({}) }, (css) => React.createElement(React.Fragment, null,
|
|
62
|
+
React.createElement(LockOutlined, { style: { fontSize: 60, color: css.theme.colorPrimary } }),
|
|
62
63
|
React.createElement(Form, { className: "record-config-form", layout: "horizontal", labelCol: { sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 }, onKeyUp: event => {
|
|
63
64
|
if (event.key === Key.Enter && !this.isConfirmDisabled()) {
|
|
64
65
|
this.onChangePassword();
|
|
@@ -77,7 +78,7 @@ export default class ChangePasswordModalDialog extends React.Component {
|
|
|
77
78
|
this.setState({ newPasswordConfirm: event.target.value });
|
|
78
79
|
} }))),
|
|
79
80
|
this.state.alertType &&
|
|
80
|
-
React.createElement(Alert, { style: { marginTop: 28 }, type: this.state.alertType, message: this.state.alertMessage, showIcon: true }))));
|
|
81
|
+
React.createElement(Alert, { style: { marginTop: 28 }, type: this.state.alertType, message: this.state.alertMessage, showIcon: true })))));
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
//# sourceMappingURL=changePasswordModalDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changePasswordModalDialog.js","sourceRoot":"","sources":["../../../../../coreui/components/changePasswordModalDialog/changePasswordModalDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAkB,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAoB/D,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,KAAK,CAAC,SAAuB;IAChF,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,kBAAkB,EAAE,EAAE;YACtB,OAAO,EAAE,KAAK;SACjB,CAAA;QAED,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAEO,iBAAiB;QACrB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IA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EAAC,EACtB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAChC,QAAQ,SACV,CAEJ,CACI,CACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {ModalDialog, ModalDialogMode} from \"d2coreui/components/modal/modalDialog\";\r\nimport {Alert, Button, Form, Input} from \"antd\";\r\nimport {D2WebApi} from \"d2jsapi\";\r\nimport {LockOutlined} from \"@ant-design/icons\";\r\nimport {Key} from \"ts-key-enum\";\r\nimport {PRIMARY_COLOR} from \"../../../api/constants/constants\";\r\n\r\ninterface Props {\r\n open: boolean\r\n d2api: D2WebApi\r\n passwordExpired?: boolean\r\n\r\n onCancel(): void\r\n}\r\n\r\ninterface State {\r\n oldPassword: string\r\n newPassword: string\r\n newPasswordConfirm: string\r\n loading: boolean\r\n\r\n alertType?: \"success\" | \"info\" | \"warning\" | \"error\"\r\n alertMessage?: string\r\n}\r\n\r\nexport default class ChangePasswordModalDialog extends React.Component<Props, State> {\r\n constructor(props: Readonly<Props>) {\r\n super(props);\r\n\r\n this.state = {\r\n oldPassword: \"\",\r\n newPassword: \"\",\r\n newPasswordConfirm: \"\",\r\n loading: false,\r\n }\r\n\r\n this.onChangePassword = this.onChangePassword.bind(this);\r\n }\r\n\r\n private isConfirmDisabled() {\r\n return !this.state.oldPassword || !this.state.newPassword || !this.state.newPasswordConfirm;\r\n }\r\n\r\n private async onChangePassword() {\r\n const {oldPassword, newPassword, newPasswordConfirm} = this.state;\r\n\r\n if (newPassword !== newPasswordConfirm) {\r\n this.setState({\r\n alertType: \"error\",\r\n alertMessage: i18n(\"Passwords do not match.\")\r\n });\r\n } else if (oldPassword && newPassword) {\r\n this.setState({loading: true});\r\n const changePasswordResultCode = await this.props.d2api.changePassword(oldPassword, newPassword);\r\n if (changePasswordResultCode === \"ok\") {\r\n this.setState({\r\n alertType: \"success\",\r\n alertMessage: i18n(\"Password changed.\")\r\n });\r\n setTimeout(() => window.location.href = \"./do.logout\", 1000);\r\n } else {\r\n this.setState({\r\n alertType: \"error\",\r\n alertMessage: i18n(changePasswordResultCode),\r\n loading: false,\r\n });\r\n }\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <ModalDialog\r\n styles={{\r\n header: {\r\n textAlign: \"center\"\r\n },\r\n body: {\r\n textAlign: \"center\",\r\n paddingTop: 0,\r\n paddingBottom: 0,\r\n },\r\n }}\r\n title={this.props.passwordExpired ? i18n(\"Password expired\") : i18n(\"Change password\")}\r\n mode={ModalDialogMode.NO_BUTTONS}\r\n closable={!this.props.passwordExpired}\r\n open={this.props.open}\r\n onCancel={this.props.onCancel}\r\n initialWidth={400}\r\n initialHeight={440}\r\n maskClosable={!this.props.passwordExpired}\r\n keyboard={!this.props.passwordExpired}\r\n footer={\r\n <Button\r\n block\r\n type=\"primary\"\r\n disabled={this.isConfirmDisabled()}\r\n loading={this.state.loading}\r\n onClick={this.onChangePassword}\r\n >\r\n {i18n(\"Confirm\")}\r\n </Button>\r\n }\r\n >\r\n <div>\r\n <LockOutlined style={{fontSize: 60, color: PRIMARY_COLOR}}/>\r\n <Form\r\n className=\"record-config-form\"\r\n layout=\"horizontal\"\r\n labelCol={{sm: 24, md: 24, lg: 24, xl: 24, xxl: 24}}\r\n onKeyUp={event => {\r\n if (event.key === Key.Enter && !this.isConfirmDisabled()) {\r\n this.onChangePassword();\r\n }\r\n }}\r\n >\r\n <Form.Item label={i18n(\"Old password\")}>\r\n <Input.Password\r\n value={this.state.oldPassword}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({oldPassword: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n <Form.Item label={i18n(\"New password\")}>\r\n <Input.Password\r\n value={this.state.newPassword}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({newPassword: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n <Form.Item label={i18n(\"Confirm password\")}>\r\n <Input.Password\r\n value={this.state.newPasswordConfirm}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({newPasswordConfirm: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n </Form>\r\n {this.state.alertType &&\r\n <Alert\r\n style={{marginTop: 28}}\r\n type={this.state.alertType}\r\n message={this.state.alertMessage}\r\n showIcon\r\n />\r\n }\r\n </div>\r\n </ModalDialog>\r\n );\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"changePasswordModalDialog.js","sourceRoot":"","sources":["../../../../../coreui/components/changePasswordModalDialog/changePasswordModalDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAkB,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,OAAO,MAAM,mCAAmC,CAAC;AAoBxD,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,KAAK,CAAC,SAAuB;IAChF,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,kBAAkB,EAAE,EAAE;YACtB,OAAO,EAAE,KAAK;SACjB,CAAA;QAED,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAEO,iBAAiB;QACrB,OAAO,CAAC,IAAI,CAAC,K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C,CAAA;4BAC3D,CAAC,GACH,CACM,CACT;gBACN,IAAI,CAAC,KAAK,CAAC,SAAS;oBACjB,oBAAC,KAAK,IACF,KAAK,EAAE,EAAC,SAAS,EAAE,EAAE,EAAC,EACtB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAChC,QAAQ,SACV,CAEP,CACI,CACD,CACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {ModalDialog, ModalDialogMode} from \"d2coreui/components/modal/modalDialog\";\r\nimport {Alert, Button, Form, Input} from \"antd\";\r\nimport {D2WebApi} from \"d2jsapi\";\r\nimport {LockOutlined} from \"@ant-design/icons\";\r\nimport {Key} from \"ts-key-enum\";\r\nimport {createStyles} from \"antd-style\";\r\nimport WithCss from \"d2coreui/components/style/withCss\";\r\n\r\ninterface Props {\r\n open: boolean\r\n d2api: D2WebApi\r\n passwordExpired?: boolean\r\n\r\n onCancel(): void\r\n}\r\n\r\ninterface State {\r\n oldPassword: string\r\n newPassword: string\r\n newPasswordConfirm: string\r\n loading: boolean\r\n\r\n alertType?: \"success\" | \"info\" | \"warning\" | \"error\"\r\n alertMessage?: string\r\n}\r\n\r\nexport default class ChangePasswordModalDialog extends React.Component<Props, State> {\r\n constructor(props: Readonly<Props>) {\r\n super(props);\r\n\r\n this.state = {\r\n oldPassword: \"\",\r\n newPassword: \"\",\r\n newPasswordConfirm: \"\",\r\n loading: false,\r\n }\r\n\r\n this.onChangePassword = this.onChangePassword.bind(this);\r\n }\r\n\r\n private isConfirmDisabled() {\r\n return !this.state.oldPassword || !this.state.newPassword || !this.state.newPasswordConfirm;\r\n }\r\n\r\n private async onChangePassword() {\r\n const {oldPassword, newPassword, newPasswordConfirm} = this.state;\r\n\r\n if (newPassword !== newPasswordConfirm) {\r\n this.setState({\r\n alertType: \"error\",\r\n alertMessage: i18n(\"Passwords do not match.\")\r\n });\r\n } else if (oldPassword && newPassword) {\r\n this.setState({loading: true});\r\n const changePasswordResultCode = await this.props.d2api.changePassword(oldPassword, newPassword);\r\n if (changePasswordResultCode === \"ok\") {\r\n this.setState({\r\n alertType: \"success\",\r\n alertMessage: i18n(\"Password changed.\")\r\n });\r\n setTimeout(() => window.location.href = \"./do.logout\", 1000);\r\n } else {\r\n this.setState({\r\n alertType: \"error\",\r\n alertMessage: i18n(changePasswordResultCode),\r\n loading: false,\r\n });\r\n }\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <ModalDialog\r\n styles={{\r\n header: {\r\n textAlign: \"center\"\r\n },\r\n body: {\r\n textAlign: \"center\",\r\n paddingTop: 0,\r\n paddingBottom: 0,\r\n },\r\n }}\r\n title={this.props.passwordExpired ? i18n(\"Password expired\") : i18n(\"Change password\")}\r\n mode={ModalDialogMode.NO_BUTTONS}\r\n closable={!this.props.passwordExpired}\r\n open={this.props.open}\r\n onCancel={this.props.onCancel}\r\n initialWidth={400}\r\n initialHeight={440}\r\n maskClosable={!this.props.passwordExpired}\r\n keyboard={!this.props.passwordExpired}\r\n footer={\r\n <Button\r\n block\r\n type=\"primary\"\r\n disabled={this.isConfirmDisabled()}\r\n loading={this.state.loading}\r\n onClick={this.onChangePassword}\r\n >\r\n {i18n(\"Confirm\")}\r\n </Button>\r\n }\r\n >\r\n <WithCss useStyles={createStyles({})}>{(css) =>\r\n <>\r\n <LockOutlined style={{fontSize: 60, color: css.theme.colorPrimary}}/>\r\n <Form\r\n className=\"record-config-form\"\r\n layout=\"horizontal\"\r\n labelCol={{sm: 24, md: 24, lg: 24, xl: 24, xxl: 24}}\r\n onKeyUp={event => {\r\n if (event.key === Key.Enter && !this.isConfirmDisabled()) {\r\n this.onChangePassword();\r\n }\r\n }}\r\n >\r\n <Form.Item label={i18n(\"Old password\")}>\r\n <Input.Password\r\n value={this.state.oldPassword}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({oldPassword: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n <Form.Item label={i18n(\"New password\")}>\r\n <Input.Password\r\n value={this.state.newPassword}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({newPassword: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n <Form.Item label={i18n(\"Confirm password\")}>\r\n <Input.Password\r\n value={this.state.newPasswordConfirm}\r\n prefix={<LockOutlined/>}\r\n onChange={event => {\r\n this.setState({newPasswordConfirm: event.target.value})\r\n }}\r\n />\r\n </Form.Item>\r\n </Form>\r\n {this.state.alertType &&\r\n <Alert\r\n style={{marginTop: 28}}\r\n type={this.state.alertType}\r\n message={this.state.alertMessage}\r\n showIcon\r\n />\r\n }\r\n </>\r\n }</WithCss>\r\n </ModalDialog>\r\n );\r\n }\r\n}"]}
|
package/coreui/style/index.less
CHANGED
|
@@ -41,24 +41,7 @@
|
|
|
41
41
|
border: 1px solid @warning-color !important;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.record-config-form .ant-form-item {
|
|
45
|
-
margin-bottom: 0 !important;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.record-config-form .ant-col-sm-24.ant-form-item-label {
|
|
49
|
-
height: 24px;
|
|
50
|
-
padding: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.record-config-form .ant-form-item-explain-error {
|
|
54
|
-
font-size: 11px;
|
|
55
|
-
line-height: 1;
|
|
56
|
-
font-weight: 600;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
44
|
.record-config-form .ant-col-sm-24.ant-form-item-label label {
|
|
60
|
-
font-size: @label-font-size;
|
|
61
|
-
color: @label-color;
|
|
62
45
|
font-weight: @label-font-weight;
|
|
63
46
|
}
|
|
64
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "d2aura",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.49",
|
|
4
4
|
"description": "D2 AURA - Advanced User Interface Resource Architecture",
|
|
5
5
|
"author": "Ipesoft s.r.o.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/react-router-dom": "5.3.3",
|
|
42
42
|
"@types/urijs": "1.19.16",
|
|
43
43
|
"antd": "5.21.2",
|
|
44
|
-
"d2core": "23.0.
|
|
44
|
+
"d2core": "23.0.15",
|
|
45
45
|
"d2coreui": "23.0.24",
|
|
46
46
|
"d2jsapi": "21.0.30",
|
|
47
47
|
"echarts": "5.5.1",
|