namirasoft-site-react 1.4.351 → 1.4.352
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.
|
@@ -16,6 +16,7 @@ export interface NSButtonProps extends IBaseComponentProps {
|
|
|
16
16
|
export interface NSButtonState {
|
|
17
17
|
clicked: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare class NSButton extends React.Component<NSButtonProps> {
|
|
19
|
+
export declare class NSButton extends React.Component<NSButtonProps, NSButtonState> {
|
|
20
|
+
constructor(props: NSButtonProps);
|
|
20
21
|
render(): React.ReactNode;
|
|
21
22
|
}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Styles from "./NSButton.module.css";
|
|
3
|
-
import React
|
|
3
|
+
import React from "react";
|
|
4
4
|
import { NSLoading } from "./NSLoading";
|
|
5
5
|
export class NSButton extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { clicked: false };
|
|
9
|
+
}
|
|
6
10
|
render() {
|
|
7
11
|
var _a, _b;
|
|
8
|
-
|
|
9
|
-
if (state.clicked)
|
|
12
|
+
if (this.state.clicked)
|
|
10
13
|
return _jsx(NSLoading, Object.assign({ small: true, hideTitle: true, hideDesciption: true }, this.props.loading));
|
|
11
14
|
return (_jsxs("button", { id: this.props.id, className: `${this.props.disabled ? Styles.ns_button_disabled : Styles.ns_button} ${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: this.props.style, onClick: () => {
|
|
12
15
|
var _a;
|
|
13
16
|
if (this.props.onClick.showLoading != false)
|
|
14
|
-
setState({ clicked: true });
|
|
17
|
+
this.setState({ clicked: true });
|
|
15
18
|
try {
|
|
16
19
|
this.props.onClick.action(() => {
|
|
17
|
-
setState({ clicked: false });
|
|
20
|
+
this.setState({ clicked: false });
|
|
18
21
|
});
|
|
19
22
|
}
|
|
20
23
|
catch (error) {
|
|
21
|
-
setState({ clicked: false });
|
|
24
|
+
this.setState({ clicked: false });
|
|
22
25
|
alert((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error);
|
|
23
26
|
}
|
|
24
27
|
}, disabled: this.props.disabled, children: [this.props.icon && _jsx("img", Object.assign({}, this.props.icon, { alt: "Icon", width: 24, height: 24 })), this.props.title] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSButton.js","sourceRoot":"","sources":["../../src/components/NSButton.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAG3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NSButton.js","sourceRoot":"","sources":["../../src/components/NSButton.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAsBxD,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAuC;IAEvE,YAAY,KAAoB;QAE5B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACpC,CAAC;IACQ,MAAM;;QAEX,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO;YAClB,OAAO,KAAC,SAAS,kBACb,KAAK,QACL,SAAS,QACT,cAAc,UACV,IAAI,CAAC,KAAK,CAAC,OAAO,EACb,CAAA;QAEjB,OAAO,CACH,kBAAQ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EACrB,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,SAAS,0CAAE,IAAI,CAAC,GAAG,CAAC,mCAAI,EAAE,EAAE,EAC3H,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,GAAG,EAAE;;gBAEV,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,IAAI,KAAK;oBACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,IACA,CAAC;oBACG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE;wBAE3B,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;oBACtC,CAAC,CAAC,CAAC;gBACP,CAAC;gBAAC,OAAO,KAAU,EACnB,CAAC;oBACG,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;oBAClC,KAAK,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,mCAAI,KAAK,CAAC,CAAC;gBACnC,CAAC;YACL,CAAC,EACD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,aAE5B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,8BAAS,IAAI,CAAC,KAAK,CAAC,IAAI,IAAE,GAAG,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EACjF,IAAI,CAAC,KAAK,CAAC,KAAK,IACX,CACb,CAAC;IACN,CAAC;CACJ;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Styles from "./NSButton.module.css";
|
|
2
2
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
3
3
|
import { IImageProps } from "../props/IImageProps";
|
|
4
|
-
import React
|
|
4
|
+
import React from "react";
|
|
5
5
|
import { NSLoading, NSLoadingProps } from "./NSLoading";
|
|
6
6
|
|
|
7
7
|
export interface NSButtonOnClickProps
|
|
@@ -24,12 +24,16 @@ export interface NSButtonState
|
|
|
24
24
|
clicked: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export class NSButton extends React.Component<NSButtonProps>
|
|
27
|
+
export class NSButton extends React.Component<NSButtonProps, NSButtonState>
|
|
28
28
|
{
|
|
29
|
+
constructor(props: NSButtonProps)
|
|
30
|
+
{
|
|
31
|
+
super(props);
|
|
32
|
+
this.state = { clicked: false };
|
|
33
|
+
}
|
|
29
34
|
override render(): React.ReactNode
|
|
30
35
|
{
|
|
31
|
-
|
|
32
|
-
if (state.clicked)
|
|
36
|
+
if (this.state.clicked)
|
|
33
37
|
return <NSLoading
|
|
34
38
|
small
|
|
35
39
|
hideTitle
|
|
@@ -44,16 +48,16 @@ export class NSButton extends React.Component<NSButtonProps>
|
|
|
44
48
|
onClick={() =>
|
|
45
49
|
{
|
|
46
50
|
if (this.props.onClick.showLoading != false)
|
|
47
|
-
setState({ clicked: true });
|
|
51
|
+
this.setState({ clicked: true });
|
|
48
52
|
try
|
|
49
53
|
{
|
|
50
54
|
this.props.onClick.action(() =>
|
|
51
55
|
{
|
|
52
|
-
setState({ clicked: false });
|
|
56
|
+
this.setState({ clicked: false });
|
|
53
57
|
});
|
|
54
58
|
} catch (error: any)
|
|
55
59
|
{
|
|
56
|
-
setState({ clicked: false });
|
|
60
|
+
this.setState({ clicked: false });
|
|
57
61
|
alert(error?.message ?? error);
|
|
58
62
|
}
|
|
59
63
|
}}
|