namirasoft-site-react 1.3.251 → 1.3.254
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.js +1 -1
- package/dist/App.js.map +1 -1
- package/dist/components/NSBoxBoolean.d.ts +6 -7
- package/dist/components/NSBoxBoolean.js +8 -12
- package/dist/components/NSBoxBoolean.js.map +1 -1
- package/dist/components/NSBoxDate.d.ts +3 -2
- package/dist/components/NSBoxDate.js +5 -7
- package/dist/components/NSBoxDate.js.map +1 -1
- package/dist/components/NSBoxDateTime.d.ts +3 -2
- package/dist/components/NSBoxDateTime.js +5 -7
- package/dist/components/NSBoxDateTime.js.map +1 -1
- package/dist/components/NSBoxDouble.d.ts +3 -2
- package/dist/components/NSBoxDouble.js +5 -7
- package/dist/components/NSBoxDouble.js.map +1 -1
- package/dist/components/NSBoxDuration.d.ts +3 -2
- package/dist/components/NSBoxDuration.js +5 -7
- package/dist/components/NSBoxDuration.js.map +1 -1
- package/dist/components/NSBoxEmail.d.ts +3 -2
- package/dist/components/NSBoxEmail.js +6 -8
- package/dist/components/NSBoxEmail.js.map +1 -1
- package/dist/components/NSBoxEntity.d.ts +6 -3
- package/dist/components/NSBoxEntity.js +13 -10
- package/dist/components/NSBoxEntity.js.map +1 -1
- package/dist/components/NSBoxEnum.d.ts +3 -2
- package/dist/components/NSBoxEnum.js +5 -8
- package/dist/components/NSBoxEnum.js.map +1 -1
- package/dist/components/NSBoxErrorNotifier.d.ts +1 -0
- package/dist/components/NSBoxErrorNotifier.js +5 -1
- package/dist/components/NSBoxErrorNotifier.js.map +1 -1
- package/dist/components/NSBoxIPV4.d.ts +3 -2
- package/dist/components/NSBoxIPV4.js +5 -7
- package/dist/components/NSBoxIPV4.js.map +1 -1
- package/dist/components/NSBoxIPV6.d.ts +3 -2
- package/dist/components/NSBoxIPV6.js +5 -7
- package/dist/components/NSBoxIPV6.js.map +1 -1
- package/dist/components/NSBoxInteger.d.ts +3 -2
- package/dist/components/NSBoxInteger.js +5 -7
- package/dist/components/NSBoxInteger.js.map +1 -1
- package/dist/components/NSBoxLabel.d.ts +2 -1
- package/dist/components/NSBoxLabel.js +2 -1
- package/dist/components/NSBoxLabel.js.map +1 -1
- package/dist/components/NSBoxOTP.d.ts +2 -0
- package/dist/components/NSBoxOTP.js +2 -1
- package/dist/components/NSBoxOTP.js.map +1 -1
- package/dist/components/NSBoxPassword.d.ts +3 -2
- package/dist/components/NSBoxPassword.js +5 -7
- package/dist/components/NSBoxPassword.js.map +1 -1
- package/dist/components/NSBoxPhone.d.ts +3 -2
- package/dist/components/NSBoxPhone.js +1 -4
- package/dist/components/NSBoxPhone.js.map +1 -1
- package/dist/components/NSBoxPrice.d.ts +3 -2
- package/dist/components/NSBoxPrice.js +6 -8
- package/dist/components/NSBoxPrice.js.map +1 -1
- package/dist/components/NSBoxString.d.ts +3 -2
- package/dist/components/NSBoxString.js +6 -8
- package/dist/components/NSBoxString.js.map +1 -1
- package/dist/components/NSBoxTextArea.d.ts +3 -2
- package/dist/components/NSBoxTextArea.js +7 -9
- package/dist/components/NSBoxTextArea.js.map +1 -1
- package/dist/components/NSBoxTime.d.ts +3 -2
- package/dist/components/NSBoxTime.js +5 -7
- package/dist/components/NSBoxTime.js.map +1 -1
- package/dist/components/NSFilterBoxDialog.js +1 -1
- package/dist/components/NSGroupedList.module.css +1 -0
- package/dist/components/NSPagination.d.ts +15 -2
- package/dist/components/NSPagination.js +73 -44
- package/dist/components/NSPagination.js.map +1 -1
- package/dist/components/NSTable.d.ts +4 -3
- package/dist/components/NSTable.js +8 -6
- package/dist/components/NSTable.js.map +1 -1
- package/dist/props/IBaseComponentProps.d.ts +1 -0
- package/package.json +2 -2
- package/src/App.tsx +2 -2
- package/src/components/NSBoxBoolean.tsx +18 -27
- package/src/components/NSBoxDate.tsx +14 -15
- package/src/components/NSBoxDateTime.tsx +14 -15
- package/src/components/NSBoxDouble.tsx +15 -17
- package/src/components/NSBoxDuration.tsx +14 -14
- package/src/components/NSBoxEmail.tsx +19 -18
- package/src/components/NSBoxEntity.tsx +23 -14
- package/src/components/NSBoxEnum.tsx +10 -13
- package/src/components/NSBoxErrorNotifier.tsx +7 -1
- package/src/components/NSBoxIPV4.tsx +14 -14
- package/src/components/NSBoxIPV6.tsx +14 -14
- package/src/components/NSBoxInteger.tsx +14 -14
- package/src/components/NSBoxLabel.tsx +3 -2
- package/src/components/NSBoxOTP.tsx +19 -15
- package/src/components/NSBoxPassword.tsx +14 -14
- package/src/components/NSBoxPhone.tsx +4 -9
- package/src/components/NSBoxPrice.tsx +15 -15
- package/src/components/NSBoxString.tsx +16 -16
- package/src/components/NSBoxTextArea.tsx +13 -17
- package/src/components/NSBoxTime.tsx +14 -14
- package/src/components/NSFilterBoxDialog.tsx +2 -2
- package/src/components/NSGroupedList.module.css +1 -0
- package/src/components/NSPagination.tsx +154 -117
- package/src/components/NSTable.tsx +8 -8
- package/src/props/IBaseComponentProps.ts +1 -0
|
@@ -10,9 +10,10 @@ import { Validator } from "../Validator";
|
|
|
10
10
|
export interface INSBoxDateProps extends IBaseComponentProps, IValidationProps
|
|
11
11
|
{
|
|
12
12
|
title: string;
|
|
13
|
-
defaultValue?: string;
|
|
14
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
13
|
placeholder?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onChanged?: (e: NSBoxDate) => void;
|
|
16
|
+
onClicked?: (e: NSBoxDate) => void;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export interface INSBoxDateState
|
|
@@ -44,41 +45,39 @@ export class NSBoxDate extends React.Component<INSBoxDateProps, INSBoxDateState>
|
|
|
44
45
|
if (error)
|
|
45
46
|
{
|
|
46
47
|
this.setState({ error });
|
|
47
|
-
setTimeout(() =>
|
|
48
|
-
{
|
|
49
|
-
this.setState({ error: "" });
|
|
50
|
-
}, 7000);
|
|
51
48
|
throw new Error(error);
|
|
52
49
|
}
|
|
53
50
|
return this.state.value;
|
|
54
51
|
}
|
|
55
52
|
setValue(value: string): void
|
|
56
53
|
{
|
|
57
|
-
this.setState({ value })
|
|
54
|
+
this.setState({ value }, () =>
|
|
55
|
+
{
|
|
56
|
+
if (this.props.onChanged)
|
|
57
|
+
this.props.onChanged(this);
|
|
58
|
+
});
|
|
58
59
|
}
|
|
59
60
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
60
61
|
{
|
|
61
62
|
this.setValue(e.target.value);
|
|
62
|
-
if (this.props.onChanged)
|
|
63
|
-
this.props.onChanged(e);
|
|
64
63
|
}
|
|
65
64
|
override render()
|
|
66
65
|
{
|
|
67
66
|
return (
|
|
68
67
|
<>
|
|
69
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
68
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
70
69
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
71
70
|
<input
|
|
72
|
-
id={this.props.id}
|
|
73
|
-
value={this.state.value}
|
|
74
|
-
onChange={this.onChanged}
|
|
75
71
|
type="date"
|
|
72
|
+
name={this.props.name}
|
|
76
73
|
className={Styles.ns_input}
|
|
77
74
|
placeholder={this.props.placeholder}
|
|
78
|
-
|
|
75
|
+
value={this.state.value}
|
|
76
|
+
onChange={this.onChanged}
|
|
77
|
+
onClick={() => this.props.onClicked}
|
|
79
78
|
/>
|
|
80
79
|
</div>
|
|
81
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
80
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
82
81
|
</>
|
|
83
82
|
);
|
|
84
83
|
}
|
|
@@ -10,9 +10,10 @@ import { Validator } from "../Validator";
|
|
|
10
10
|
export interface INSBoxDateTimeProps extends IBaseComponentProps, IValidationProps
|
|
11
11
|
{
|
|
12
12
|
title: string;
|
|
13
|
-
defaultValue?: string;
|
|
14
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
13
|
placeholder?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onChanged?: (e: NSBoxDateTime) => void;
|
|
16
|
+
onClicked?: (e: NSBoxDateTime) => void;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export interface INSBoxDateTimeState
|
|
@@ -44,41 +45,39 @@ export class NSBoxDateTime extends React.Component<INSBoxDateTimeProps, INSBoxDa
|
|
|
44
45
|
if (error)
|
|
45
46
|
{
|
|
46
47
|
this.setState({ error });
|
|
47
|
-
setTimeout(() =>
|
|
48
|
-
{
|
|
49
|
-
this.setState({ error: "" });
|
|
50
|
-
}, 7000);
|
|
51
48
|
throw new Error(error);
|
|
52
49
|
}
|
|
53
50
|
return this.state.value;
|
|
54
51
|
}
|
|
55
52
|
setValue(value: string): void
|
|
56
53
|
{
|
|
57
|
-
this.setState({ value })
|
|
54
|
+
this.setState({ value }, () =>
|
|
55
|
+
{
|
|
56
|
+
if (this.props.onChanged)
|
|
57
|
+
this.props.onChanged(this);
|
|
58
|
+
});
|
|
58
59
|
}
|
|
59
60
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
60
61
|
{
|
|
61
62
|
this.setValue(e.target.value);
|
|
62
|
-
if (this.props.onChanged)
|
|
63
|
-
this.props.onChanged(e);
|
|
64
63
|
}
|
|
65
64
|
override render()
|
|
66
65
|
{
|
|
67
66
|
return (
|
|
68
67
|
<>
|
|
69
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
68
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
70
69
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
71
70
|
<input
|
|
72
|
-
id={this.props.id}
|
|
73
|
-
value={this.state.value}
|
|
74
|
-
onChange={this.onChanged}
|
|
75
71
|
type="datetime-local"
|
|
72
|
+
name={this.props.name}
|
|
76
73
|
className={Styles.ns_input}
|
|
77
74
|
placeholder={this.props.placeholder}
|
|
78
|
-
|
|
75
|
+
value={this.state.value}
|
|
76
|
+
onChange={this.onChanged}
|
|
77
|
+
onClick={() => this.props.onClicked}
|
|
79
78
|
/>
|
|
80
79
|
</div>
|
|
81
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
80
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
82
81
|
</>
|
|
83
82
|
);
|
|
84
83
|
}
|
|
@@ -12,9 +12,10 @@ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
|
12
12
|
export interface INSBoxDoubleProps extends IBaseComponentProps, IValidationProps, IValidationNumberProps
|
|
13
13
|
{
|
|
14
14
|
title: string;
|
|
15
|
-
defaultValue?: number;
|
|
16
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
15
|
placeholder?: string;
|
|
16
|
+
defaultValue?: number;
|
|
17
|
+
onChanged?: (e: NSBoxDouble) => void;
|
|
18
|
+
onClicked?: (e: NSBoxDouble) => void;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface INSBoxDoubleState
|
|
@@ -46,45 +47,42 @@ export class NSBoxDouble extends React.Component<INSBoxDoubleProps, INSBoxDouble
|
|
|
46
47
|
if (error)
|
|
47
48
|
{
|
|
48
49
|
this.setState({ error });
|
|
49
|
-
setTimeout(() =>
|
|
50
|
-
{
|
|
51
|
-
this.setState({ error: "" });
|
|
52
|
-
}, 7000);
|
|
53
50
|
throw new Error(error);
|
|
54
51
|
}
|
|
55
52
|
return this.state.value;
|
|
56
53
|
}
|
|
57
54
|
setValue(value: number | undefined): void
|
|
58
55
|
{
|
|
59
|
-
this.setState({ value })
|
|
56
|
+
this.setState({ value }, () =>
|
|
57
|
+
{
|
|
58
|
+
if (this.props.onChanged)
|
|
59
|
+
this.props.onChanged(this);
|
|
60
|
+
});
|
|
60
61
|
}
|
|
61
62
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
62
63
|
{
|
|
63
64
|
this.setValue(parseFloat(e.target.value));
|
|
64
|
-
if (this.props.onChanged)
|
|
65
|
-
this.props.onChanged(e);
|
|
66
65
|
}
|
|
67
66
|
override render()
|
|
68
67
|
{
|
|
69
68
|
return (
|
|
70
69
|
<>
|
|
71
|
-
<div className={`${Styles.ns_input_parent}
|
|
70
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
72
71
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
73
72
|
<input
|
|
74
|
-
|
|
73
|
+
type="number"
|
|
74
|
+
name={this.props.name}
|
|
75
|
+
className={Styles.ns_input}
|
|
76
|
+
placeholder={this.props.placeholder}
|
|
75
77
|
value={this.state.value}
|
|
76
78
|
onChange={this.onChanged}
|
|
77
|
-
|
|
79
|
+
onClick={() => this.props.onClicked}
|
|
78
80
|
inputMode="decimal"
|
|
79
|
-
//todo: check pattern
|
|
80
81
|
pattern="[0-9]*[.,]?[0-9]*"
|
|
81
|
-
className={Styles.ns_input}
|
|
82
|
-
placeholder={this.props.placeholder}
|
|
83
82
|
style={{ background: `url(${IconInputFloat}) white no-repeat scroll center right 16px` }}
|
|
84
|
-
|
|
85
83
|
/>
|
|
86
84
|
</div>
|
|
87
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
85
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
88
86
|
</>
|
|
89
87
|
);
|
|
90
88
|
}
|
|
@@ -13,9 +13,10 @@ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
|
13
13
|
export interface INSBoxDurationProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, IValidationNumberProps
|
|
14
14
|
{
|
|
15
15
|
title: string;
|
|
16
|
-
defaultValue?: string;
|
|
17
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
16
|
placeholder?: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChanged?: (e: NSBoxDuration) => void;
|
|
19
|
+
onClicked?: (e: NSBoxDuration) => void;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export interface INSBoxDurationState
|
|
@@ -47,42 +48,41 @@ export class NSBoxDuration extends React.Component<INSBoxDurationProps, INSBoxDu
|
|
|
47
48
|
if (error)
|
|
48
49
|
{
|
|
49
50
|
this.setState({ error });
|
|
50
|
-
setTimeout(() =>
|
|
51
|
-
{
|
|
52
|
-
this.setState({ error: "" });
|
|
53
|
-
}, 7000);
|
|
54
51
|
throw new Error(error);
|
|
55
52
|
}
|
|
56
53
|
return this.state.value;
|
|
57
54
|
}
|
|
58
55
|
setValue(value: string): void
|
|
59
56
|
{
|
|
60
|
-
this.setState({ value })
|
|
57
|
+
this.setState({ value }, () =>
|
|
58
|
+
{
|
|
59
|
+
if (this.props.onChanged)
|
|
60
|
+
this.props.onChanged(this);
|
|
61
|
+
});
|
|
61
62
|
}
|
|
62
63
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
63
64
|
{
|
|
64
65
|
this.setValue(e.target.value);
|
|
65
|
-
if (this.props.onChanged)
|
|
66
|
-
this.props.onChanged(e);
|
|
67
66
|
}
|
|
68
67
|
override render()
|
|
69
68
|
{
|
|
70
69
|
return (
|
|
71
70
|
<>
|
|
72
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
71
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
73
72
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
74
73
|
<input
|
|
75
|
-
id={this.props.id}
|
|
76
|
-
value={this.state.value}
|
|
77
|
-
onChange={this.onChanged}
|
|
78
74
|
type="time"
|
|
75
|
+
name={this.props.name}
|
|
79
76
|
className={Styles.ns_input}
|
|
80
77
|
placeholder={this.props.placeholder}
|
|
78
|
+
value={this.state.value}
|
|
79
|
+
onChange={this.onChanged}
|
|
80
|
+
onClick={() => this.props.onClicked}
|
|
81
81
|
step="2"
|
|
82
82
|
style={{ background: `url(${IconInputDuration}) white no-repeat scroll center right 16px` }}
|
|
83
83
|
/>
|
|
84
84
|
</div>
|
|
85
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
85
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
86
86
|
</>
|
|
87
87
|
);
|
|
88
88
|
}
|
|
@@ -15,9 +15,10 @@ import CopyToClipboard from '../CopyToClipboard';
|
|
|
15
15
|
export interface INSBoxEmailProps extends IBaseComponentProps, IValidationProps, IValidationStringProps
|
|
16
16
|
{
|
|
17
17
|
title: string;
|
|
18
|
-
defaultValue?: string;
|
|
19
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
18
|
placeholder?: string;
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
onChanged?: (e: NSBoxEmail) => void;
|
|
21
|
+
onClicked?: (e: NSBoxEmail) => void;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface INSBoxEmailState
|
|
@@ -54,10 +55,6 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
|
|
|
54
55
|
if (error)
|
|
55
56
|
{
|
|
56
57
|
this.setState({ error });
|
|
57
|
-
setTimeout(() =>
|
|
58
|
-
{
|
|
59
|
-
this.setState({ error: "" });
|
|
60
|
-
}, 7000);
|
|
61
58
|
throw new Error(error);
|
|
62
59
|
}
|
|
63
60
|
return this.state.value;
|
|
@@ -65,27 +62,30 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
|
|
|
65
62
|
|
|
66
63
|
setValue(value: string): void
|
|
67
64
|
{
|
|
68
|
-
this.setState({ value })
|
|
65
|
+
this.setState({ value }, () =>
|
|
66
|
+
{
|
|
67
|
+
if (this.props.onChanged)
|
|
68
|
+
{
|
|
69
|
+
this.props.onChanged(this);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
72
75
|
{
|
|
73
76
|
this.setValue(e.target.value);
|
|
74
|
-
if (this.props.onChanged)
|
|
75
|
-
{
|
|
76
|
-
this.props.onChanged(e);
|
|
77
|
-
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
private toggleFullScreen(): void
|
|
81
80
|
{
|
|
82
81
|
this.setState(prevState => ({ isFullScreen: !prevState.isFullScreen }));
|
|
83
82
|
}
|
|
83
|
+
|
|
84
84
|
override render()
|
|
85
85
|
{
|
|
86
86
|
return (
|
|
87
87
|
<>
|
|
88
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
88
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
89
89
|
<div className="d-flex justify-content-between align-items-center">
|
|
90
90
|
<span className={Styles.ns_input_title}>
|
|
91
91
|
{this.props.required && <span style={{ color: "red" }}>*</span>} {this.props.title}
|
|
@@ -112,14 +112,16 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
|
|
|
112
112
|
</div>
|
|
113
113
|
</div>
|
|
114
114
|
<input
|
|
115
|
-
id={this.props.id}
|
|
116
|
-
value={this.state.value}
|
|
117
|
-
onChange={this.onChanged}
|
|
118
115
|
type="email"
|
|
116
|
+
name={this.props.name}
|
|
119
117
|
className={Styles.ns_input}
|
|
120
118
|
placeholder={this.props.placeholder}
|
|
119
|
+
value={this.state.value}
|
|
120
|
+
onChange={this.onChanged}
|
|
121
|
+
onClick={() => this.props.onClicked}
|
|
121
122
|
style={{ background: `url(${IconInputEmail}) white no-repeat scroll center right 16px` }}
|
|
122
123
|
/>
|
|
124
|
+
{/* Todo make a new component for fullscreen */}
|
|
123
125
|
<div className={Styles.ns_input_modal_full_screen} style={{ display: this.state.isFullScreen === false ? "none" : "block" }} >
|
|
124
126
|
<div>
|
|
125
127
|
<img
|
|
@@ -131,16 +133,15 @@ export class NSBoxEmail extends React.Component<INSBoxEmailProps, INSBoxEmailSta
|
|
|
131
133
|
onClick={this.toggleFullScreen}
|
|
132
134
|
/>
|
|
133
135
|
</div>
|
|
134
|
-
<div className={Styles.ns_input_modal_full} onClick={this.toggleFullScreen}
|
|
136
|
+
<div className={Styles.ns_input_modal_full} onClick={this.toggleFullScreen}></div>
|
|
135
137
|
<textarea
|
|
136
138
|
value={this.state.value}
|
|
137
139
|
onChange={(e) => this.setValue(e.target.value)}
|
|
138
140
|
>
|
|
139
|
-
|
|
140
141
|
</textarea>
|
|
141
142
|
</div>
|
|
142
143
|
</div>
|
|
143
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
144
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
144
145
|
</>
|
|
145
146
|
);
|
|
146
147
|
}
|
|
@@ -18,9 +18,12 @@ export interface INSBoxEntitOption extends BaseOptionType
|
|
|
18
18
|
export interface INSBoxEntityProps extends IBaseComponentProps, IValidationProps
|
|
19
19
|
{
|
|
20
20
|
title: string;
|
|
21
|
-
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
onChanged?: (e: NSBoxEntity) => void;
|
|
24
|
+
onClicked?: (e: NSBoxEntity) => void;
|
|
22
25
|
multiple: boolean;
|
|
23
|
-
|
|
26
|
+
options: INSBoxEntitOption[];
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export interface INSBoxEntityState
|
|
@@ -43,7 +46,7 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
|
|
|
43
46
|
this.setValues = this.setValues.bind(this);
|
|
44
47
|
this.setValue = this.setValue.bind(this);
|
|
45
48
|
this.getValue = this.getValue.bind(this);
|
|
46
|
-
this.
|
|
49
|
+
this.onChanged = this.onChanged.bind(this);
|
|
47
50
|
}
|
|
48
51
|
getError(value: string): string | null
|
|
49
52
|
{
|
|
@@ -76,34 +79,40 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
|
|
|
76
79
|
}
|
|
77
80
|
setValue(value: string | null): void
|
|
78
81
|
{
|
|
79
|
-
this.setState({ value })
|
|
82
|
+
this.setState({ value }, () =>
|
|
83
|
+
{
|
|
84
|
+
if (this.props.onChanged)
|
|
85
|
+
this.props.onChanged(this);
|
|
86
|
+
});
|
|
80
87
|
}
|
|
81
88
|
setValues(values: string[]): void
|
|
82
89
|
{
|
|
83
|
-
this.setState({ values })
|
|
90
|
+
this.setState({ values }, () =>
|
|
91
|
+
{
|
|
92
|
+
if (this.props.onChanged)
|
|
93
|
+
this.props.onChanged(this);
|
|
94
|
+
});
|
|
84
95
|
}
|
|
85
|
-
|
|
96
|
+
onChanged(value: string | null | string[]): void
|
|
86
97
|
{
|
|
87
98
|
if (this.props.multiple)
|
|
88
|
-
{
|
|
89
99
|
this.setValues(value as string[]);
|
|
90
|
-
|
|
91
|
-
{
|
|
100
|
+
else
|
|
92
101
|
this.setValue(value as string | null);
|
|
93
|
-
}
|
|
94
102
|
}
|
|
95
103
|
override render()
|
|
96
104
|
{
|
|
97
105
|
return (
|
|
98
106
|
<>
|
|
99
|
-
<div className={`${Styles.ns_input_parent}`}>
|
|
107
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent}`}>
|
|
100
108
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
101
109
|
<Select
|
|
102
110
|
mode={this.props.multiple ? "multiple" : undefined}
|
|
103
111
|
style={{ width: '100%' }}
|
|
104
112
|
className={Styles.ns_input_select}
|
|
105
|
-
placeholder={this.props.
|
|
106
|
-
onChange={this.
|
|
113
|
+
placeholder={this.props.placeholder}
|
|
114
|
+
onChange={this.onChanged}
|
|
115
|
+
onClick={() => this.props.onClicked}
|
|
107
116
|
optionLabelProp="label"
|
|
108
117
|
options={this.props.options}
|
|
109
118
|
optionRender={(option) => (
|
|
@@ -114,7 +123,7 @@ export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntity
|
|
|
114
123
|
suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
|
|
115
124
|
/>
|
|
116
125
|
</div>
|
|
117
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
126
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
118
127
|
</>
|
|
119
128
|
);
|
|
120
129
|
}
|
|
@@ -21,9 +21,10 @@ export interface INSBoxEnumProps extends IBaseComponentProps, IValidationProps
|
|
|
21
21
|
title: string;
|
|
22
22
|
options: INSBoxEnumOption[];
|
|
23
23
|
multiple: boolean;
|
|
24
|
-
placeHolder?: string;
|
|
25
24
|
customClass?: string;
|
|
26
|
-
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
onChanged?: (e: NSBoxEnum) => void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface INSBoxEnumState
|
|
@@ -60,10 +61,6 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
|
|
|
60
61
|
if (error)
|
|
61
62
|
{
|
|
62
63
|
this.setState({ error });
|
|
63
|
-
setTimeout(() =>
|
|
64
|
-
{
|
|
65
|
-
this.setState({ error: "" });
|
|
66
|
-
}, 7000);
|
|
67
64
|
throw new Error(error);
|
|
68
65
|
}
|
|
69
66
|
return this.state.value;
|
|
@@ -85,16 +82,16 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
|
|
|
85
82
|
{
|
|
86
83
|
this.setState({ value }, () =>
|
|
87
84
|
{
|
|
88
|
-
if (this.props.
|
|
89
|
-
this.props.
|
|
85
|
+
if (this.props.onChanged)
|
|
86
|
+
this.props.onChanged(this);
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
89
|
setValues(values: string[]): void
|
|
93
90
|
{
|
|
94
91
|
this.setState({ values }, () =>
|
|
95
92
|
{
|
|
96
|
-
if (this.props.
|
|
97
|
-
this.props.
|
|
93
|
+
if (this.props.onChanged)
|
|
94
|
+
this.props.onChanged(this);
|
|
98
95
|
});
|
|
99
96
|
}
|
|
100
97
|
onChange(value: string | null | string[]): void
|
|
@@ -108,14 +105,14 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
|
|
|
108
105
|
{
|
|
109
106
|
return (
|
|
110
107
|
<>
|
|
111
|
-
<div className={`${Styles.ns_input_parent} ${this.props.customClass}`}>
|
|
108
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.customClass}`}>
|
|
112
109
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
113
110
|
<Select
|
|
114
111
|
showSearch
|
|
115
112
|
mode={this.props.multiple ? "multiple" : undefined}
|
|
116
113
|
style={{ width: '100%' }}
|
|
117
114
|
className={Styles.ns_input_select}
|
|
118
|
-
placeholder={this.props.
|
|
115
|
+
placeholder={this.props.placeholder ?? "Combo Box"}
|
|
119
116
|
onChange={this.onChange}
|
|
120
117
|
optionLabelProp="label"
|
|
121
118
|
options={this.props.options}
|
|
@@ -127,7 +124,7 @@ export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
|
|
|
127
124
|
suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
|
|
128
125
|
/>
|
|
129
126
|
</div>
|
|
130
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
127
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
131
128
|
</>
|
|
132
129
|
);
|
|
133
130
|
}
|
|
@@ -5,14 +5,20 @@ import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
|
5
5
|
export interface INSBoxErrorNotifierProps extends IBaseComponentProps
|
|
6
6
|
{
|
|
7
7
|
error?: string;
|
|
8
|
+
clearError: () => void;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function NSBoxErrorNotifier(props: INSBoxErrorNotifierProps)
|
|
11
12
|
{
|
|
13
|
+
if (props.error)
|
|
14
|
+
setTimeout(() =>
|
|
15
|
+
{
|
|
16
|
+
props.clearError();
|
|
17
|
+
}, 5000);
|
|
12
18
|
return <>
|
|
13
19
|
{
|
|
14
20
|
props.error && (
|
|
15
|
-
<div className="d-flex justify-content-start align-items-center gap-2 ms-2">
|
|
21
|
+
<div id={props.id} className="d-flex justify-content-start align-items-center gap-2 ms-2">
|
|
16
22
|
<img
|
|
17
23
|
className={""}
|
|
18
24
|
src={Danger}
|
|
@@ -14,9 +14,10 @@ const IPV4_PATTERN: string = "^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1
|
|
|
14
14
|
export interface INSBoxIPV4Props extends IBaseComponentProps, IValidationProps, IValidationStringProps
|
|
15
15
|
{
|
|
16
16
|
title: string;
|
|
17
|
-
defaultValue?: string;
|
|
18
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
17
|
placeholder?: string;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
onChanged?: (e: NSBoxIPV4) => void;
|
|
20
|
+
onClicked?: (e: NSBoxIPV4) => void;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface INSBoxIPV4State
|
|
@@ -49,37 +50,36 @@ export class NSBoxIPV4 extends React.Component<INSBoxIPV4Props, INSBoxIPV4State>
|
|
|
49
50
|
if (error)
|
|
50
51
|
{
|
|
51
52
|
this.setState({ error });
|
|
52
|
-
setTimeout(() =>
|
|
53
|
-
{
|
|
54
|
-
this.setState({ error: "" });
|
|
55
|
-
}, 7000);
|
|
56
53
|
throw new Error(error);
|
|
57
54
|
}
|
|
58
55
|
return this.state.value;
|
|
59
56
|
}
|
|
60
57
|
setValue(value: string): void
|
|
61
58
|
{
|
|
62
|
-
this.setState({ value })
|
|
59
|
+
this.setState({ value }, () =>
|
|
60
|
+
{
|
|
61
|
+
if (this.props.onChanged)
|
|
62
|
+
this.props.onChanged(this);
|
|
63
|
+
});
|
|
63
64
|
}
|
|
64
65
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
65
66
|
{
|
|
66
67
|
this.setValue(e.target.value);
|
|
67
|
-
if (this.props.onChanged)
|
|
68
|
-
this.props.onChanged(e);
|
|
69
68
|
}
|
|
70
69
|
override render()
|
|
71
70
|
{
|
|
72
71
|
return (
|
|
73
72
|
<>
|
|
74
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
73
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
75
74
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
76
75
|
<input
|
|
77
|
-
id={this.props.id}
|
|
78
|
-
value={this.state.value}
|
|
79
|
-
onChange={this.onChanged}
|
|
80
76
|
type="text"
|
|
77
|
+
name={this.props.name}
|
|
81
78
|
className={Styles.ns_input}
|
|
82
79
|
placeholder={this.props.placeholder}
|
|
80
|
+
value={this.state.value}
|
|
81
|
+
onChange={this.onChanged}
|
|
82
|
+
onClick={() => this.props.onClicked}
|
|
83
83
|
minLength={7}
|
|
84
84
|
maxLength={15}
|
|
85
85
|
size={15}
|
|
@@ -87,7 +87,7 @@ export class NSBoxIPV4 extends React.Component<INSBoxIPV4Props, INSBoxIPV4State>
|
|
|
87
87
|
style={{ background: `url(${IconInputIP}) white no-repeat scroll center right 16px` }}
|
|
88
88
|
/>
|
|
89
89
|
</div>
|
|
90
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
90
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
91
91
|
</>
|
|
92
92
|
);
|
|
93
93
|
}
|
|
@@ -14,9 +14,10 @@ const IPV6_PATTERN: string = '^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([
|
|
|
14
14
|
export interface INSBoxIPV6Props extends IBaseComponentProps, IValidationProps, IValidationStringProps
|
|
15
15
|
{
|
|
16
16
|
title: string;
|
|
17
|
-
defaultValue?: string;
|
|
18
|
-
onChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
17
|
placeholder?: string;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
onChanged?: (e: NSBoxIPV6) => void;
|
|
20
|
+
onClicked?: (e: NSBoxIPV6) => void;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface INSBoxIPV6State
|
|
@@ -49,42 +50,41 @@ export class NSBoxIPV6 extends React.Component<INSBoxIPV6Props, INSBoxIPV6State>
|
|
|
49
50
|
if (error)
|
|
50
51
|
{
|
|
51
52
|
this.setState({ error });
|
|
52
|
-
setTimeout(() =>
|
|
53
|
-
{
|
|
54
|
-
this.setState({ error: "" });
|
|
55
|
-
}, 7000);
|
|
56
53
|
throw new Error(error);
|
|
57
54
|
}
|
|
58
55
|
return this.state.value;
|
|
59
56
|
}
|
|
60
57
|
setValue(value: string): void
|
|
61
58
|
{
|
|
62
|
-
this.setState({ value })
|
|
59
|
+
this.setState({ value }, () =>
|
|
60
|
+
{
|
|
61
|
+
if (this.props.onChanged)
|
|
62
|
+
this.props.onChanged(this);
|
|
63
|
+
});
|
|
63
64
|
}
|
|
64
65
|
private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
|
|
65
66
|
{
|
|
66
67
|
this.setValue(e.target.value);
|
|
67
|
-
if (this.props.onChanged)
|
|
68
|
-
this.props.onChanged(e);
|
|
69
68
|
}
|
|
70
69
|
override render()
|
|
71
70
|
{
|
|
72
71
|
return (
|
|
73
72
|
<>
|
|
74
|
-
<div className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
73
|
+
<div id={this.props.id} className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
|
|
75
74
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
76
75
|
<input
|
|
77
|
-
id={this.props.id}
|
|
78
|
-
value={this.state.value}
|
|
79
|
-
onChange={this.onChanged}
|
|
80
76
|
type="text"
|
|
77
|
+
name={this.props.name}
|
|
81
78
|
className={Styles.ns_input}
|
|
82
79
|
placeholder={this.props.placeholder}
|
|
80
|
+
value={this.state.value}
|
|
81
|
+
onChange={this.onChanged}
|
|
82
|
+
onClick={() => this.props.onClicked}
|
|
83
83
|
pattern={IPV6_PATTERN}
|
|
84
84
|
style={{ background: `url(${IconInputIP}) white no-repeat scroll center right 16px` }}
|
|
85
85
|
/>
|
|
86
86
|
</div>
|
|
87
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
87
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
88
88
|
</>
|
|
89
89
|
);
|
|
90
90
|
}
|