namirasoft-site-react 1.3.252 → 1.3.255
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 +1 -0
- package/dist/components/NSBoxDate.js +1 -4
- package/dist/components/NSBoxDate.js.map +1 -1
- package/dist/components/NSBoxDateTime.d.ts +1 -0
- package/dist/components/NSBoxDateTime.js +1 -4
- package/dist/components/NSBoxDateTime.js.map +1 -1
- package/dist/components/NSBoxDouble.d.ts +1 -0
- package/dist/components/NSBoxDouble.js +1 -4
- package/dist/components/NSBoxDouble.js.map +1 -1
- package/dist/components/NSBoxDuration.d.ts +1 -0
- package/dist/components/NSBoxDuration.js +1 -4
- package/dist/components/NSBoxDuration.js.map +1 -1
- package/dist/components/NSBoxEmail.d.ts +1 -0
- package/dist/components/NSBoxEmail.js +1 -4
- package/dist/components/NSBoxEmail.js.map +1 -1
- package/dist/components/NSBoxEntity.d.ts +4 -3
- package/dist/components/NSBoxEntity.js +13 -10
- package/dist/components/NSBoxEntity.js.map +1 -1
- package/dist/components/NSBoxEnum.js +1 -4
- 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 +1 -0
- package/dist/components/NSBoxIPV4.js +1 -4
- package/dist/components/NSBoxIPV4.js.map +1 -1
- package/dist/components/NSBoxIPV6.d.ts +1 -0
- package/dist/components/NSBoxIPV6.js +1 -4
- package/dist/components/NSBoxIPV6.js.map +1 -1
- package/dist/components/NSBoxInteger.d.ts +1 -0
- package/dist/components/NSBoxInteger.js +1 -4
- 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.js +2 -1
- package/dist/components/NSBoxOTP.js.map +1 -1
- package/dist/components/NSBoxPassword.d.ts +1 -0
- package/dist/components/NSBoxPassword.js +1 -4
- package/dist/components/NSBoxPassword.js.map +1 -1
- package/dist/components/NSBoxPhone.d.ts +1 -0
- package/dist/components/NSBoxPhone.js +1 -4
- package/dist/components/NSBoxPhone.js.map +1 -1
- package/dist/components/NSBoxPrice.d.ts +1 -0
- package/dist/components/NSBoxPrice.js +1 -4
- package/dist/components/NSBoxPrice.js.map +1 -1
- package/dist/components/NSBoxString.d.ts +1 -0
- package/dist/components/NSBoxString.js +2 -5
- package/dist/components/NSBoxString.js.map +1 -1
- package/dist/components/NSBoxTextArea.d.ts +1 -0
- package/dist/components/NSBoxTextArea.js +3 -6
- package/dist/components/NSBoxTextArea.js.map +1 -1
- package/dist/components/NSBoxTime.d.ts +1 -0
- package/dist/components/NSBoxTime.js +1 -4
- package/dist/components/NSBoxTime.js.map +1 -1
- 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/pages/NSLoginPage.d.ts +0 -2
- package/dist/pages/NSLoginPage.js +2 -16
- package/dist/pages/NSLoginPage.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 +7 -10
- package/src/components/NSBoxDateTime.tsx +7 -10
- package/src/components/NSBoxDouble.tsx +8 -12
- package/src/components/NSBoxDuration.tsx +7 -9
- package/src/components/NSBoxEmail.tsx +10 -11
- package/src/components/NSBoxEntity.tsx +21 -14
- package/src/components/NSBoxEnum.tsx +2 -6
- package/src/components/NSBoxErrorNotifier.tsx +7 -1
- package/src/components/NSBoxIPV4.tsx +7 -9
- package/src/components/NSBoxIPV6.tsx +7 -9
- package/src/components/NSBoxInteger.tsx +7 -9
- package/src/components/NSBoxLabel.tsx +3 -2
- package/src/components/NSBoxOTP.tsx +17 -15
- package/src/components/NSBoxPassword.tsx +7 -9
- package/src/components/NSBoxPhone.tsx +2 -7
- package/src/components/NSBoxPrice.tsx +8 -10
- package/src/components/NSBoxString.tsx +9 -11
- package/src/components/NSBoxTextArea.tsx +5 -12
- package/src/components/NSBoxTime.tsx +7 -9
- package/src/components/NSPagination.tsx +154 -117
- package/src/components/NSTable.tsx +8 -8
- package/src/pages/NSLoginPage.tsx +4 -19
- package/src/props/IBaseComponentProps.ts +1 -0
|
@@ -18,6 +18,7 @@ export interface INSBoxTextAreaProps extends IBaseComponentProps, IValidationPro
|
|
|
18
18
|
placeholder?: string;
|
|
19
19
|
defaultValue?: string;
|
|
20
20
|
onChanged?: (e: NSBoxTextArea) => void;
|
|
21
|
+
onClicked?: (e: NSBoxTextArea) => void;
|
|
21
22
|
cols?: number;
|
|
22
23
|
rows?: number;
|
|
23
24
|
}
|
|
@@ -53,15 +54,9 @@ export class NSBoxTextArea extends React.Component<INSBoxTextAreaProps, INSBoxTe
|
|
|
53
54
|
if (error)
|
|
54
55
|
{
|
|
55
56
|
this.setState({ error });
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
this.setState({ error: "" });
|
|
59
|
-
}, 7000);
|
|
60
|
-
// throw new Error(error);
|
|
61
|
-
return '';
|
|
57
|
+
throw new Error(error);
|
|
62
58
|
}
|
|
63
59
|
return this.state.value;
|
|
64
|
-
|
|
65
60
|
}
|
|
66
61
|
setValue(value: string): void
|
|
67
62
|
{
|
|
@@ -84,7 +79,7 @@ export class NSBoxTextArea extends React.Component<INSBoxTextAreaProps, INSBoxTe
|
|
|
84
79
|
{
|
|
85
80
|
return (
|
|
86
81
|
<>
|
|
87
|
-
<div className={`${Styles.ns_text_area_parent} ${this.props.classList?.join(" ")} ${this.state.isFullScreen ? Styles.ns_full_screen : ""}`} style={this.props.style} onClick={this.state.isFullScreen ? () => { } : () => { }}>
|
|
82
|
+
<div id={this.props.id} className={`${Styles.ns_text_area_parent} ${this.props.classList?.join(" ")} ${this.state.isFullScreen ? Styles.ns_full_screen : ""}`} style={this.props.style} onClick={this.state.isFullScreen ? () => { } : () => { }}>
|
|
88
83
|
<div className="d-flex justify-content-between align-items-center">
|
|
89
84
|
<span className={Styles.ns_input_title}>
|
|
90
85
|
{this.props.required && <span style={{ color: "red" }}>*</span>} {this.props.title}
|
|
@@ -118,17 +113,15 @@ export class NSBoxTextArea extends React.Component<INSBoxTextAreaProps, INSBoxTe
|
|
|
118
113
|
}}
|
|
119
114
|
cols={this.props.cols}
|
|
120
115
|
rows={this.props.rows}
|
|
121
|
-
id={this.props.id}
|
|
122
116
|
value={this.state.value}
|
|
123
117
|
className={Styles.ns_text_area}
|
|
124
118
|
placeholder={this.props.placeholder}
|
|
125
119
|
onChange={this.onChanged}
|
|
120
|
+
onClick={() => this.props.onClicked}
|
|
126
121
|
/>
|
|
127
|
-
|
|
128
|
-
|
|
129
122
|
</div>
|
|
130
123
|
</div>
|
|
131
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
124
|
+
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|
|
132
125
|
</>
|
|
133
126
|
);
|
|
134
127
|
}
|
|
@@ -15,6 +15,7 @@ export interface INSBoxTimeProps extends IBaseComponentProps, IValidationProps,
|
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
defaultValue?: string;
|
|
17
17
|
onChanged?: (e: NSBoxTime) => void;
|
|
18
|
+
onClicked?: (e: NSBoxTime) => void;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface INSBoxTimeState
|
|
@@ -47,10 +48,6 @@ export class NSBoxTime extends React.Component<INSBoxTimeProps, INSBoxTimeState>
|
|
|
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;
|
|
@@ -71,20 +68,21 @@ export class NSBoxTime extends React.Component<INSBoxTimeProps, INSBoxTimeState>
|
|
|
71
68
|
{
|
|
72
69
|
return (
|
|
73
70
|
<>
|
|
74
|
-
<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}>
|
|
75
72
|
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
76
73
|
<input
|
|
77
|
-
id={this.props.id}
|
|
78
|
-
value={this.state.value}
|
|
79
|
-
onChange={this.onChanged}
|
|
80
74
|
type="time"
|
|
75
|
+
name={this.props.name}
|
|
81
76
|
className={Styles.ns_input}
|
|
82
77
|
placeholder={this.props.placeholder}
|
|
78
|
+
value={this.state.value}
|
|
79
|
+
onChange={this.onChanged}
|
|
80
|
+
onClick={() => this.props.onClicked}
|
|
83
81
|
step="2"
|
|
84
82
|
style={{ background: `url(${IconInputTime}) white no-repeat scroll center right 16px` }}
|
|
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
|
}
|
|
@@ -1,154 +1,191 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component } from 'react';
|
|
2
2
|
import { IBaseComponentProps } from '../props/IBaseComponentProps';
|
|
3
3
|
import { NSBoxEnum } from './NSBoxEnum';
|
|
4
4
|
import Styles from './NSPagination.module.css';
|
|
5
|
+
import React from "react";
|
|
5
6
|
|
|
6
7
|
export interface INSPaginationProps extends IBaseComponentProps
|
|
7
8
|
{
|
|
8
9
|
totalItems: number;
|
|
9
|
-
currentPage: number;
|
|
10
10
|
onPageChange: (page: number, size: number) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface INSPaginationState
|
|
14
14
|
{
|
|
15
|
+
currentPage: number;
|
|
15
16
|
pageSize: number;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
let pageSizes = [25, 50, 100, 200, 500];
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
+
export class NSPagination extends Component<INSPaginationProps, INSPaginationState>
|
|
21
22
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
PageSize = React.createRef<NSBoxEnum>();
|
|
24
|
+
constructor(props: INSPaginationProps)
|
|
25
|
+
{
|
|
26
|
+
super(props);
|
|
27
|
+
this.state = { currentPage: 1, pageSize: pageSizes[0] };
|
|
28
|
+
}
|
|
29
|
+
getCurrentPage(): number
|
|
30
|
+
{
|
|
31
|
+
return this.state.currentPage;
|
|
32
|
+
}
|
|
33
|
+
getPageSize(): number
|
|
34
|
+
{
|
|
35
|
+
return this.state.pageSize;
|
|
36
|
+
}
|
|
37
|
+
override render()
|
|
38
|
+
{
|
|
39
|
+
let pageSize = this.state.pageSize;
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
const { totalItems, onPageChange } = this.props;
|
|
42
|
+
const totalPages = Math.ceil(totalItems / pageSize);
|
|
43
|
+
const windowSize = 2;
|
|
44
|
+
const minPage = Math.max(2, this.state.currentPage - windowSize);
|
|
45
|
+
const maxPage = Math.min(this.state.currentPage + windowSize, totalPages - 1);
|
|
46
|
+
const current_min = Math.min(totalItems, (this.state.currentPage - 1) * pageSize + 1);
|
|
47
|
+
const current_max = Math.min(totalItems, this.state.currentPage * pageSize);
|
|
48
|
+
const pages = [];
|
|
35
49
|
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
const pushPage = (page: number) =>
|
|
51
|
+
{
|
|
52
|
+
pages.push(
|
|
53
|
+
<div key={page} className={`${Styles.ns_select_number_parent}`}>
|
|
54
|
+
<a
|
|
55
|
+
href="#"
|
|
56
|
+
className={`${Styles.ns_paginate_link} ${page === this.state.currentPage ? Styles.ns_select_number : ''}`}
|
|
57
|
+
onClick={(e) =>
|
|
58
|
+
{
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
let currentPage = page;
|
|
61
|
+
let pageSize = this.state.pageSize;
|
|
62
|
+
this.setState({ currentPage, pageSize }, () =>
|
|
63
|
+
{
|
|
64
|
+
onPageChange(currentPage, pageSize);
|
|
65
|
+
});
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{page}
|
|
69
|
+
</a>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
//prev
|
|
38
74
|
pages.push(
|
|
39
|
-
<div key=
|
|
75
|
+
<div key="prev">
|
|
40
76
|
<a
|
|
41
77
|
href="#"
|
|
42
|
-
className={`${Styles.ns_paginate_link} ${page === currentPage ? Styles.ns_select_number : ''}`}
|
|
43
78
|
onClick={(e) =>
|
|
44
79
|
{
|
|
45
80
|
e.preventDefault();
|
|
46
|
-
|
|
81
|
+
if (this.state.currentPage > 1)
|
|
82
|
+
{
|
|
83
|
+
let currentPage = this.state.currentPage - 1;
|
|
84
|
+
let pageSize = this.state.pageSize;
|
|
85
|
+
this.setState({ currentPage, pageSize }, () =>
|
|
86
|
+
{
|
|
87
|
+
onPageChange(currentPage, pageSize);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
47
90
|
}}
|
|
48
91
|
>
|
|
49
|
-
|
|
92
|
+
<img
|
|
93
|
+
style={{ margin: "0 8px 0 0" }}
|
|
94
|
+
src="https://static.namirasoft.com/image/concept/arrow/left/white-blue.svg"
|
|
95
|
+
alt="left_vector"
|
|
96
|
+
width={32}
|
|
97
|
+
height={32}
|
|
98
|
+
/>
|
|
50
99
|
</a>
|
|
51
100
|
</div>
|
|
52
101
|
);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
pages.push(
|
|
81
|
-
<div key="ellipsis1" className={Styles.ns_pagination_left_ellipses}>
|
|
82
|
-
<a href="#" className={`${Styles.ns_paginate_link}`} onClick={(e) => e.preventDefault()}>...</a>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
for (let i = minPage; i <= maxPage; i++)
|
|
87
|
-
pushPage(i);
|
|
88
|
-
if (currentPage < totalPages - windowSize - 1)
|
|
89
|
-
{
|
|
102
|
+
//FirstPage
|
|
103
|
+
pushPage(1);
|
|
104
|
+
if (this.state.currentPage > windowSize + 2)
|
|
105
|
+
{
|
|
106
|
+
pages.push(
|
|
107
|
+
<div key="ellipsis1" className={Styles.ns_pagination_left_ellipses}>
|
|
108
|
+
<a href="#" className={`${Styles.ns_paginate_link}`} onClick={(e) => e.preventDefault()}>...</a>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
for (let i = minPage; i <= maxPage; i++)
|
|
113
|
+
pushPage(i);
|
|
114
|
+
if (this.state.currentPage < totalPages - windowSize - 1)
|
|
115
|
+
{
|
|
116
|
+
pages.push(
|
|
117
|
+
<div key="ellipsis2" className={Styles.ns_pagination_right_ellipses}>
|
|
118
|
+
<a href="#" className={`${Styles.ns_paginate_link}`} onClick={(e) => e.preventDefault()}>...</a>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
//LastPage
|
|
123
|
+
if (totalPages > 1)
|
|
124
|
+
{
|
|
125
|
+
pushPage(totalPages);
|
|
126
|
+
}
|
|
127
|
+
//next
|
|
90
128
|
pages.push(
|
|
91
|
-
<div key="
|
|
92
|
-
<a
|
|
129
|
+
<div key="next">
|
|
130
|
+
<a
|
|
131
|
+
href="#"
|
|
132
|
+
onClick={(e) =>
|
|
133
|
+
{
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
if (this.state.currentPage < totalPages)
|
|
136
|
+
{
|
|
137
|
+
let currentPage = this.state.currentPage + 1;
|
|
138
|
+
let pageSize = this.state.pageSize;
|
|
139
|
+
this.setState({ currentPage, pageSize }, () =>
|
|
140
|
+
{
|
|
141
|
+
onPageChange(currentPage, pageSize);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<img
|
|
147
|
+
style={{ margin: "0 0 0 8px" }}
|
|
148
|
+
src="https://static.namirasoft.com/image/concept/arrow/right/white-blue.svg"
|
|
149
|
+
width={32}
|
|
150
|
+
height={32}
|
|
151
|
+
alt="right_vector"
|
|
152
|
+
/>
|
|
153
|
+
</a>
|
|
93
154
|
</div>
|
|
94
155
|
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<div
|
|
126
|
-
id={props.id}
|
|
127
|
-
className={`${Styles.ns_pagination_container} ${props.classList?.join(' ')}`}
|
|
128
|
-
style={props.style}
|
|
129
|
-
>
|
|
130
|
-
{pages}
|
|
131
|
-
<div className={Styles.ns_pagination_info}>
|
|
132
|
-
<div style={{ width: 70 }}>
|
|
133
|
-
<NSBoxEnum
|
|
134
|
-
ref={PageSize}
|
|
135
|
-
title=''
|
|
136
|
-
multiple={false}
|
|
137
|
-
required={false}
|
|
138
|
-
options={pageSizes.map(pagesize => { return { desc: pagesize.toString(), value: pagesize.toString() } })}
|
|
139
|
-
onChanged={() =>
|
|
140
|
-
{
|
|
141
|
-
setState({ pageSize: parseInt(PageSize.current?.getValue() ?? pageSizes[0].toString()) });
|
|
142
|
-
onPageChange(currentPage + 1, state.pageSize);
|
|
143
|
-
}}
|
|
144
|
-
/>
|
|
156
|
+
return (
|
|
157
|
+
<>
|
|
158
|
+
<div
|
|
159
|
+
id={this.props.id}
|
|
160
|
+
className={`${Styles.ns_pagination_container} ${this.props.classList?.join(' ')}`}
|
|
161
|
+
style={this.props.style}
|
|
162
|
+
>
|
|
163
|
+
{pages}
|
|
164
|
+
<div className={Styles.ns_pagination_info}>
|
|
165
|
+
<div style={{ width: 70 }}>
|
|
166
|
+
<NSBoxEnum
|
|
167
|
+
ref={this.PageSize}
|
|
168
|
+
title=''
|
|
169
|
+
multiple={false}
|
|
170
|
+
required={false}
|
|
171
|
+
options={pageSizes.map(pagesize => { return { desc: pagesize.toString(), value: pagesize.toString() } })}
|
|
172
|
+
onChanged={() =>
|
|
173
|
+
{
|
|
174
|
+
let currentPage = this.state.currentPage;
|
|
175
|
+
let pageSize = parseInt(this.PageSize.current?.getValue() ?? pageSizes[0].toString());
|
|
176
|
+
this.setState({ currentPage, pageSize }, () =>
|
|
177
|
+
{
|
|
178
|
+
onPageChange(currentPage, pageSize);
|
|
179
|
+
});
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
<h6>
|
|
184
|
+
{`(${current_min} - ${current_max}) of ${totalItems}`}
|
|
185
|
+
</h6>
|
|
145
186
|
</div>
|
|
146
|
-
<h6>
|
|
147
|
-
{`(${current_min} - ${current_max}) of ${totalItems}`}
|
|
148
|
-
</h6>
|
|
149
187
|
</div>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
);
|
|
188
|
+
</>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
154
191
|
}
|
|
@@ -14,7 +14,7 @@ export interface INSTableProps<RowType> extends IBaseComponentProps
|
|
|
14
14
|
{
|
|
15
15
|
columns: { [key: string]: string };
|
|
16
16
|
totalItems: number;
|
|
17
|
-
reload: (page: number) => void
|
|
17
|
+
reload: (page: number, size: number) => void
|
|
18
18
|
getRowKey: (row: RowType, rowIndex: number) => string;
|
|
19
19
|
getColumnAttributes?: (column: string, columnIndex: number) => { [key: string]: string };
|
|
20
20
|
getCell?: (row: RowType, column: string, rowIndex: number, columnIndex: number) => any;
|
|
@@ -28,7 +28,6 @@ export interface NSTableState<RowType>
|
|
|
28
28
|
columns: { [key: string]: string };
|
|
29
29
|
rows: RowType[] | null;
|
|
30
30
|
title?: string;
|
|
31
|
-
currentPage: number,
|
|
32
31
|
model: {
|
|
33
32
|
show: boolean;
|
|
34
33
|
description?: string;
|
|
@@ -37,10 +36,11 @@ export interface NSTableState<RowType>
|
|
|
37
36
|
|
|
38
37
|
export class NSTable<RowType> extends Component<INSTableProps<RowType>, NSTableState<RowType>>
|
|
39
38
|
{
|
|
39
|
+
NSPagination = React.createRef<NSPagination>();
|
|
40
40
|
constructor(props: INSTableProps<RowType>)
|
|
41
41
|
{
|
|
42
42
|
super(props);
|
|
43
|
-
this.state = { columns: props.columns, rows: null,
|
|
43
|
+
this.state = { columns: props.columns, rows: null, model: { show: false } };
|
|
44
44
|
this.setColumns = this.setColumns.bind(this);
|
|
45
45
|
this.setRows = this.setRows.bind(this);
|
|
46
46
|
this.showModal = this.showModal.bind(this);
|
|
@@ -63,10 +63,9 @@ export class NSTable<RowType> extends Component<INSTableProps<RowType>, NSTableS
|
|
|
63
63
|
{
|
|
64
64
|
this.setState({ model: { show: false } });
|
|
65
65
|
}
|
|
66
|
-
onPageChange = (page: number) =>
|
|
66
|
+
onPageChange = (page: number, size: number) =>
|
|
67
67
|
{
|
|
68
|
-
this.
|
|
69
|
-
this.props.reload(page);
|
|
68
|
+
this.props.reload(page, size);
|
|
70
69
|
}
|
|
71
70
|
override render()
|
|
72
71
|
{
|
|
@@ -159,14 +158,15 @@ export class NSTable<RowType> extends Component<INSTableProps<RowType>, NSTableS
|
|
|
159
158
|
</table>
|
|
160
159
|
<NSSpace size={NSSpaceSizeType.MICRO} />
|
|
161
160
|
<section className={Styles.ns_pagination_button}>
|
|
162
|
-
<NSPagination
|
|
161
|
+
<NSPagination ref={this.NSPagination} totalItems={this.props.totalItems} onPageChange={this.onPageChange} />
|
|
163
162
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
164
163
|
<div className={Styles.ns_button}>
|
|
165
164
|
<NSButton title='Print' icon={{ src: "https://static.namirasoft.com/image/concept/export/blue.svg" }} onClick={() => { }} style={{ border: '1px solid rgba(255, 148, 50, 1)', width: "128px" }} />
|
|
166
165
|
<NSButton title='Export' icon={{ src: "https://static.namirasoft.com/image/concept/export/blue.svg" }} onClick={() => { }} style={{ border: '1px solid rgba(255, 148, 50, 1)', width: "128px" }} />
|
|
167
166
|
<NSButton title='Refresh' icon={{ src: "https://static.namirasoft.com/image/concept/export/blue.svg" }} onClick={() =>
|
|
168
167
|
{
|
|
169
|
-
|
|
168
|
+
if (this.NSPagination.current)
|
|
169
|
+
this.props.reload(this.NSPagination.current.getCurrentPage(), this.NSPagination.current.getPageSize());
|
|
170
170
|
}} style={{ border: '1px solid rgba(3, 119, 255, 1)', width: "128px" }} />
|
|
171
171
|
</div>
|
|
172
172
|
</section>
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import Styles from './NSLoginPage.module.css'
|
|
2
2
|
import { NSLinkBlue } from '../components/NSLinkBlue';
|
|
3
3
|
import { NSSpace, NSSpaceSizeType } from '../components/NSSpace';
|
|
4
|
-
import NSButton from '../components/NSButton';
|
|
5
4
|
|
|
6
5
|
export interface INSLoginPageProps
|
|
7
6
|
{
|
|
8
7
|
title: string;
|
|
9
8
|
logo: string;
|
|
10
9
|
background: string;
|
|
11
|
-
href?: string;
|
|
12
|
-
onClick?: () => void;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
export function NSLoginPage(props: INSLoginPageProps)
|
|
16
13
|
{
|
|
17
|
-
let button = <></>;
|
|
18
|
-
if (props.href)
|
|
19
|
-
button = <NSLinkBlue title="Login" href={props.href ?? ""} />;
|
|
20
|
-
else if (props.onClick)
|
|
21
|
-
button = <NSButton title="Login" onClick={props.onClick}
|
|
22
|
-
style=
|
|
23
|
-
{{
|
|
24
|
-
color: "#fff",
|
|
25
|
-
border: "none",
|
|
26
|
-
backgroundColor: "rgba(3, 119, 255, 1)",
|
|
27
|
-
width: "358px",
|
|
28
|
-
height: "48px",
|
|
29
|
-
boxShadow: "inset 0 - 4px 4px 0px rgb(0 0 0 / 25 %)"
|
|
30
|
-
}} />;
|
|
31
14
|
return (
|
|
32
15
|
<div style={{ backgroundImage: props.background, width: "100%", backgroundSize: "cover", backgroundAttachment: "fixed" }}>
|
|
33
16
|
<div className={`${Styles.ns_login_container}`} style={{ minHeight: "100vh" }}>
|
|
@@ -35,10 +18,12 @@ export function NSLoginPage(props: INSLoginPageProps)
|
|
|
35
18
|
<img width={256} height={256} src={props.logo} alt={`${props.title} Logo`}></img>
|
|
36
19
|
</div>
|
|
37
20
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
38
|
-
<div
|
|
21
|
+
<div>
|
|
22
|
+
<h1 className={`${Styles.ns_title}`}>{props.title}</h1>
|
|
23
|
+
</div>
|
|
39
24
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
40
25
|
<div className={`${Styles.ns_button}`}>
|
|
41
|
-
|
|
26
|
+
<NSLinkBlue title="Login" href="https://account.namirasoft.com" target='_blank' />
|
|
42
27
|
</div>
|
|
43
28
|
</div>
|
|
44
29
|
</div >
|