namirasoft-site-react 1.3.332 → 1.3.333
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/components/NSPageSelectionModal.d.ts +2 -0
- package/dist/components/NSPageSelectionModal.js +15 -10
- package/dist/components/NSPageSelectionModal.js.map +1 -1
- package/dist/components/NSRadioButton.d.ts +5 -4
- package/dist/components/NSRadioButton.js +9 -11
- package/dist/components/NSRadioButton.js.map +1 -1
- package/dist/components/NSRadioButton.module.css +8 -0
- package/package.json +1 -1
- package/src/components/NSPageSelectionModal.tsx +55 -19
- package/src/components/NSRadioButton.module.css +8 -0
- package/src/components/NSRadioButton.tsx +24 -19
|
@@ -7,6 +7,7 @@ export interface NSPageSelectionModalProps<RowType> {
|
|
|
7
7
|
onFinish: (items: RowType[]) => void;
|
|
8
8
|
}
|
|
9
9
|
interface NSPageSelectionModalState {
|
|
10
|
+
selectedRadio: string;
|
|
10
11
|
}
|
|
11
12
|
export declare class NSPageSelectionModal<RowType> extends Component<NSPageSelectionModalProps<RowType>, NSPageSelectionModalState> {
|
|
12
13
|
private toastRef;
|
|
@@ -20,6 +21,7 @@ export declare class NSPageSelectionModal<RowType> extends Component<NSPageSelec
|
|
|
20
21
|
componentWillUnmount(): void;
|
|
21
22
|
parseCustomPage(pages_value: string): number[];
|
|
22
23
|
private onClickOutside;
|
|
24
|
+
private handleRadioChange;
|
|
23
25
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
24
26
|
}
|
|
25
27
|
export default NSPageSelectionModal;
|
|
@@ -24,8 +24,11 @@ export class NSPageSelectionModal extends Component {
|
|
|
24
24
|
this.NSBoxBoolean_CustomPage = createRef();
|
|
25
25
|
this.NSBoxBoolean_AllPage = createRef();
|
|
26
26
|
this.NSBoxString_Pages = createRef();
|
|
27
|
-
this.state = {
|
|
27
|
+
this.state = {
|
|
28
|
+
selectedRadio: 'current_page'
|
|
29
|
+
};
|
|
28
30
|
this.onClickOutside = this.onClickOutside.bind(this);
|
|
31
|
+
this.handleRadioChange = this.handleRadioChange.bind(this);
|
|
29
32
|
}
|
|
30
33
|
componentDidMount() {
|
|
31
34
|
document.addEventListener('mousedown', this.onClickOutside);
|
|
@@ -67,12 +70,14 @@ export class NSPageSelectionModal extends Component {
|
|
|
67
70
|
this.props.onClose();
|
|
68
71
|
}
|
|
69
72
|
}
|
|
73
|
+
handleRadioChange(selectedRadio) {
|
|
74
|
+
this.setState({ selectedRadio });
|
|
75
|
+
}
|
|
70
76
|
render() {
|
|
71
|
-
var _a, _b;
|
|
72
77
|
return (_jsx(_Fragment, { children: _jsxs(_Fragment, { children: [_jsx("div", { className: Styles.ns_print_container, ref: this.toastRef, children: _jsxs("div", { className: Styles.ns_header_print, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/close/blue.svg", alt: "Close", width: 24, height: 24, onClick: (e) => {
|
|
73
78
|
e.stopPropagation();
|
|
74
79
|
this.props.onClose();
|
|
75
|
-
}, className: Styles.ns_close_icon }), _jsxs("div", { className: Styles.ns_print_title, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/print/blue.svg", alt: "Print", width: 24, height: 24 }), _jsx("h2", { className: 'm-0', children: "Page Selection" })] }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("p", { className: Styles.ns_print_description, children: "Please select which pages you want to continue with" }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsxs("div", { className: Styles.ns_parent_checkboxs, children: [_jsx(NSRadioButton, { defaultValue: true, ref: this.NSBoxBoolean_CurrentPage, title: "Current page", required: false, name: "PageSelection" }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_SelectedItems, title: "Only Selected Items", required: false, name: "PageSelection" }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_CustomPage, title: "Custom Pages", required: false, name: "PageSelection" }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_AllPage, title: "All Pages", required: false, name: "PageSelection" })] }), _jsx(NSSpace, { size: NSSpaceSizeType.MICRO }),
|
|
80
|
+
}, className: Styles.ns_close_icon }), _jsxs("div", { className: Styles.ns_print_title, children: [_jsx("img", { src: "https://static.namirasoft.com/image/concept/print/blue.svg", alt: "Print", width: 24, height: 24 }), _jsx("h2", { className: 'm-0', children: "Page Selection" })] }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx("p", { className: Styles.ns_print_description, children: "Please select which pages you want to continue with" }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsxs("div", { className: Styles.ns_parent_checkboxs, children: [_jsx(NSRadioButton, { defaultValue: true, ref: this.NSBoxBoolean_CurrentPage, title: "Current page", required: false, name: "PageSelection", isSelected: this.state.selectedRadio === 'current_page', onClick: () => this.handleRadioChange('current_page') }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_SelectedItems, title: "Only Selected Items", required: false, name: "PageSelection", isSelected: this.state.selectedRadio === 'selected_items', onClick: () => this.handleRadioChange('selected_items') }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_CustomPage, title: "Custom Pages", required: false, name: "PageSelection", isSelected: this.state.selectedRadio === 'custom_page', onClick: () => this.handleRadioChange('custom_page') }), _jsx(NSRadioButton, { ref: this.NSBoxBoolean_AllPage, title: "All Pages", required: false, name: "PageSelection", isSelected: this.state.selectedRadio === 'all_page', onClick: () => this.handleRadioChange('all_page') }), " "] }), _jsx(NSSpace, { size: NSSpaceSizeType.MICRO }), this.state.selectedRadio === 'custom_page' && (_jsx(NSBoxString, { ref: this.NSBoxString_Pages, classList: [Styles.ns_w_box_string], required: false, title: "Custom Pages", getError: value => {
|
|
76
81
|
try {
|
|
77
82
|
this.parseCustomPage(value);
|
|
78
83
|
return null;
|
|
@@ -80,27 +85,27 @@ export class NSPageSelectionModal extends Component {
|
|
|
80
85
|
catch (error) {
|
|
81
86
|
return error.message;
|
|
82
87
|
}
|
|
83
|
-
} }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx(NSButtonBlue, { style: { width: "100%" }, title: 'Apply', onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
var _c, _d, _e, _f
|
|
88
|
+
} })), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx(NSButtonBlue, { style: { width: "100%" }, title: 'Apply', onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
var _a, _b, _c, _d, _e, _f;
|
|
85
90
|
try {
|
|
86
91
|
let items = [];
|
|
87
|
-
if ((
|
|
92
|
+
if ((_a = this.NSBoxBoolean_CurrentPage.current) === null || _a === void 0 ? void 0 : _a.getValue()) {
|
|
88
93
|
let is = yield this.props.getItems(this.props.current_page, false);
|
|
89
94
|
items.push(...is);
|
|
90
95
|
}
|
|
91
|
-
else if ((
|
|
96
|
+
else if ((_b = this.NSBoxBoolean_SelectedItems.current) === null || _b === void 0 ? void 0 : _b.getValue()) {
|
|
92
97
|
let is = yield this.props.getItems(this.props.current_page, true);
|
|
93
98
|
items.push(...is);
|
|
94
99
|
}
|
|
95
|
-
else if ((
|
|
96
|
-
let pages_value = (
|
|
100
|
+
else if ((_c = this.NSBoxBoolean_CustomPage.current) === null || _c === void 0 ? void 0 : _c.getValue()) {
|
|
101
|
+
let pages_value = (_e = (_d = this.NSBoxString_Pages.current) === null || _d === void 0 ? void 0 : _d.getValue()) !== null && _e !== void 0 ? _e : "";
|
|
97
102
|
let pages = this.parseCustomPage(pages_value);
|
|
98
103
|
for (let p = 0; p < pages.length; p++) {
|
|
99
104
|
let is = yield this.props.getItems(pages[p], false);
|
|
100
105
|
items.push(...is);
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
else if ((
|
|
108
|
+
else if ((_f = this.NSBoxBoolean_AllPage.current) === null || _f === void 0 ? void 0 : _f.getValue()) {
|
|
104
109
|
for (let p = 1; p <= this.props.max_page; p++) {
|
|
105
110
|
let is = yield this.props.getItems(p, false);
|
|
106
111
|
items.push(...is);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSPageSelectionModal.js","sourceRoot":"","sources":["../../src/components/NSPageSelectionModal.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"NSPageSelectionModal.js","sourceRoot":"","sources":["../../src/components/NSPageSelectionModal.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAgBhD,MAAM,OAAO,oBAA8B,SAAQ,SAAwE;IASvH,YAAY,KAAyC;QAEjD,KAAK,CAAC,KAAK,CAAC,CAAC;QATT,aAAQ,GAAoC,SAAS,EAAE,CAAC;QACxD,6BAAwB,GAAmC,SAAS,EAAE,CAAC;QACvE,+BAA0B,GAAmC,SAAS,EAAE,CAAC;QACzE,4BAAuB,GAAmC,SAAS,EAAE,CAAC;QACtE,yBAAoB,GAAmC,SAAS,EAAE,CAAC;QACnE,sBAAiB,GAAiC,SAAS,EAAE,CAAC;QAKlE,IAAI,CAAC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oDACI,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;oDAC7C,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;iDACrB;6CACJ;iDAED,GAAG;4CACH,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;yCAC9B;wCAAC,OAAO,KAAK,EACd;yCAEC;oCACL,CAAC,CAAA,GAAI,IACH,GACJ,EACN,cAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,GAAQ,IACnD,GAER,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,19 +6,20 @@ export interface INSRadioButtonProps extends IBaseComponentProps, IValidationPro
|
|
|
6
6
|
title: string;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
defaultValue?: boolean;
|
|
9
|
+
isSelected?: boolean;
|
|
9
10
|
onChanged?: (e: NSRadioButton) => void;
|
|
10
|
-
|
|
11
|
+
onClick?: () => void;
|
|
11
12
|
}
|
|
12
|
-
export interface
|
|
13
|
+
export interface INSBoxBooleanState {
|
|
13
14
|
value: boolean;
|
|
14
15
|
error?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare class NSRadioButton extends React.Component<INSRadioButtonProps,
|
|
17
|
+
export declare class NSRadioButton extends React.Component<INSRadioButtonProps, INSBoxBooleanState> {
|
|
17
18
|
constructor(props: INSRadioButtonProps);
|
|
18
19
|
getError(): string | null;
|
|
19
20
|
getValue(): boolean;
|
|
20
21
|
setValue(value: boolean): void;
|
|
21
|
-
private onChanged;
|
|
22
22
|
private onClicked;
|
|
23
|
+
componentDidUpdate(prevProps: INSRadioButtonProps): void;
|
|
23
24
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import Styles from "./NSRadioButton.module.css";
|
|
@@ -10,14 +9,12 @@ export class NSRadioButton extends React.Component {
|
|
|
10
9
|
this.state = { value: (_a = props.defaultValue) !== null && _a !== void 0 ? _a : false };
|
|
11
10
|
this.getValue = this.getValue.bind(this);
|
|
12
11
|
this.setValue = this.setValue.bind(this);
|
|
13
|
-
this.onChanged = this.onChanged.bind(this);
|
|
14
12
|
this.onClicked = this.onClicked.bind(this);
|
|
15
13
|
}
|
|
16
14
|
getError() {
|
|
17
15
|
return null;
|
|
18
16
|
}
|
|
19
17
|
getValue() {
|
|
20
|
-
debugger;
|
|
21
18
|
let error = this.getError();
|
|
22
19
|
if (error) {
|
|
23
20
|
this.setState({ error });
|
|
@@ -26,24 +23,25 @@ export class NSRadioButton extends React.Component {
|
|
|
26
23
|
return this.state.value;
|
|
27
24
|
}
|
|
28
25
|
setValue(value) {
|
|
29
|
-
debugger;
|
|
30
26
|
this.setState({ value }, () => {
|
|
31
27
|
if (this.props.onChanged)
|
|
32
28
|
this.props.onChanged(this);
|
|
33
29
|
});
|
|
34
30
|
}
|
|
35
|
-
onChanged(e) {
|
|
36
|
-
e.stopPropagation();
|
|
37
|
-
this.setValue(e.target.checked);
|
|
38
|
-
}
|
|
39
31
|
onClicked() {
|
|
40
32
|
this.setValue(true);
|
|
41
|
-
if (this.props.
|
|
42
|
-
this.props.
|
|
33
|
+
if (this.props.onClick)
|
|
34
|
+
this.props.onClick();
|
|
35
|
+
}
|
|
36
|
+
componentDidUpdate(prevProps) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (prevProps.isSelected !== this.props.isSelected) {
|
|
39
|
+
this.setValue((_a = this.props.isSelected) !== null && _a !== void 0 ? _a : false);
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
render() {
|
|
45
43
|
var _a;
|
|
46
|
-
return (_jsxs(_Fragment, { children: [
|
|
44
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { id: this.props.id, className: `${Styles.ns_input_parent} ${(_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")}`, style: this.props.style, children: [_jsx("div", { className: Styles.ns_input_transparent, onClick: this.onClicked }), _jsxs("div", { className: Styles.ns_checkbox_parent, children: [_jsx("input", { type: "radio", name: this.props.name, className: Styles.ns_input, checked: this.state.value, onChange: () => { } }), _jsxs("span", { className: Styles.ns_input_title, children: [this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title] })] })] }), _jsx(NSBoxErrorNotifier, { error: this.state.error, clearError: () => this.setState({ error: "" }) })] }));
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
//# sourceMappingURL=NSRadioButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSRadioButton.js","sourceRoot":"","sources":["../../src/components/NSRadioButton.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"NSRadioButton.js","sourceRoot":"","sources":["../../src/components/NSRadioButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAIhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAkB1D,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAkD;IACvF,YAAY,KAA0B;;QAElC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,MAAA,KAAK,CAAC,YAAY,mCAAI,KAAK,EAAE,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,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AAS,EAAE,MAAM,CAAC,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,GAAQ,EAC5E,eAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,aACrC,gBACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACzB,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,GACrB,EACF,gBAAM,SAAS,EAAE,MAAM,CAAC,cAAc,aACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAW,OAAG,IAAI,CAAC,KAAK,CAAC,KAAK,IAChF,IACL,IACJ,EACN,KAAC,kBAAkB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAI,IAChG,CACN,CAAC;IACN,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export interface NSPageSelectionModalProps<RowType>
|
|
|
17
17
|
|
|
18
18
|
interface NSPageSelectionModalState
|
|
19
19
|
{
|
|
20
|
+
selectedRadio: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export class NSPageSelectionModal<RowType> extends Component<NSPageSelectionModalProps<RowType>, NSPageSelectionModalState>
|
|
@@ -31,8 +32,11 @@ export class NSPageSelectionModal<RowType> extends Component<NSPageSelectionModa
|
|
|
31
32
|
constructor(props: NSPageSelectionModalProps<RowType>)
|
|
32
33
|
{
|
|
33
34
|
super(props);
|
|
34
|
-
this.state = {
|
|
35
|
+
this.state = {
|
|
36
|
+
selectedRadio: 'current_page'
|
|
37
|
+
};
|
|
35
38
|
this.onClickOutside = this.onClickOutside.bind(this);
|
|
39
|
+
this.handleRadioChange = this.handleRadioChange.bind(this);
|
|
36
40
|
}
|
|
37
41
|
override componentDidMount(): void
|
|
38
42
|
{
|
|
@@ -84,6 +88,10 @@ export class NSPageSelectionModal<RowType> extends Component<NSPageSelectionModa
|
|
|
84
88
|
this.props.onClose();
|
|
85
89
|
}
|
|
86
90
|
}
|
|
91
|
+
private handleRadioChange(selectedRadio: string)
|
|
92
|
+
{
|
|
93
|
+
this.setState({ selectedRadio });
|
|
94
|
+
}
|
|
87
95
|
override render()
|
|
88
96
|
{
|
|
89
97
|
return (
|
|
@@ -117,26 +125,54 @@ export class NSPageSelectionModal<RowType> extends Component<NSPageSelectionModa
|
|
|
117
125
|
<p className={Styles.ns_print_description}>Please select which pages you want to continue with</p>
|
|
118
126
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
119
127
|
<div className={Styles.ns_parent_checkboxs}>
|
|
120
|
-
<NSRadioButton
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
<NSRadioButton
|
|
129
|
+
defaultValue={true}
|
|
130
|
+
ref={this.NSBoxBoolean_CurrentPage}
|
|
131
|
+
title={"Current page"}
|
|
132
|
+
required={false}
|
|
133
|
+
name={"PageSelection"}
|
|
134
|
+
isSelected={this.state.selectedRadio === 'current_page'}
|
|
135
|
+
onClick={() => this.handleRadioChange('current_page')}
|
|
136
|
+
/>
|
|
137
|
+
<NSRadioButton
|
|
138
|
+
ref={this.NSBoxBoolean_SelectedItems}
|
|
139
|
+
title={"Only Selected Items"}
|
|
140
|
+
required={false}
|
|
141
|
+
name={"PageSelection"}
|
|
142
|
+
isSelected={this.state.selectedRadio === 'selected_items'}
|
|
143
|
+
onClick={() => this.handleRadioChange('selected_items')}
|
|
144
|
+
/>
|
|
145
|
+
<NSRadioButton
|
|
146
|
+
ref={this.NSBoxBoolean_CustomPage}
|
|
147
|
+
title={"Custom Pages"}
|
|
148
|
+
required={false}
|
|
149
|
+
name={"PageSelection"}
|
|
150
|
+
isSelected={this.state.selectedRadio === 'custom_page'}
|
|
151
|
+
onClick={() => this.handleRadioChange('custom_page')}
|
|
152
|
+
/>
|
|
153
|
+
<NSRadioButton
|
|
154
|
+
ref={this.NSBoxBoolean_AllPage}
|
|
155
|
+
title={"All Pages"}
|
|
156
|
+
required={false}
|
|
157
|
+
name={"PageSelection"}
|
|
158
|
+
isSelected={this.state.selectedRadio === 'all_page'}
|
|
159
|
+
onClick={() => this.handleRadioChange('all_page')}
|
|
160
|
+
/> </div>
|
|
125
161
|
<NSSpace size={NSSpaceSizeType.MICRO} />
|
|
126
|
-
{this.
|
|
127
|
-
|
|
128
|
-
|
|
162
|
+
{this.state.selectedRadio === 'custom_page' && (
|
|
163
|
+
<NSBoxString ref={this.NSBoxString_Pages} classList={[Styles.ns_w_box_string]} required={false} title="Custom Pages"
|
|
164
|
+
getError={value =>
|
|
165
|
+
{
|
|
166
|
+
try
|
|
129
167
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}} />
|
|
139
|
-
}
|
|
168
|
+
this.parseCustomPage(value);
|
|
169
|
+
return null;
|
|
170
|
+
} catch (error: any)
|
|
171
|
+
{
|
|
172
|
+
return error.message;
|
|
173
|
+
}
|
|
174
|
+
}} />
|
|
175
|
+
)}
|
|
140
176
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
141
177
|
<NSButtonBlue style={{ width: "100%" }} title='Apply' onClick={async () =>
|
|
142
178
|
{
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import Styles from "./NSRadioButton.module.css";
|
|
5
3
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
@@ -12,34 +10,34 @@ export interface INSRadioButtonProps extends IBaseComponentProps, IValidationPro
|
|
|
12
10
|
title: string;
|
|
13
11
|
placeholder?: string;
|
|
14
12
|
defaultValue?: boolean;
|
|
13
|
+
isSelected?: boolean;
|
|
15
14
|
onChanged?: (e: NSRadioButton) => void;
|
|
16
|
-
|
|
15
|
+
onClick?: () => void;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
export interface
|
|
18
|
+
export interface INSBoxBooleanState
|
|
20
19
|
{
|
|
21
20
|
value: boolean;
|
|
22
21
|
error?: string;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export class NSRadioButton extends React.Component<INSRadioButtonProps,
|
|
26
|
-
{
|
|
24
|
+
export class NSRadioButton extends React.Component<INSRadioButtonProps, INSBoxBooleanState> {
|
|
27
25
|
constructor(props: INSRadioButtonProps)
|
|
28
26
|
{
|
|
29
27
|
super(props);
|
|
30
28
|
this.state = { value: props.defaultValue ?? false };
|
|
31
29
|
this.getValue = this.getValue.bind(this);
|
|
32
30
|
this.setValue = this.setValue.bind(this);
|
|
33
|
-
this.onChanged = this.onChanged.bind(this);
|
|
34
31
|
this.onClicked = this.onClicked.bind(this);
|
|
35
32
|
}
|
|
33
|
+
|
|
36
34
|
getError(): string | null
|
|
37
35
|
{
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
38
|
+
|
|
40
39
|
getValue(): boolean
|
|
41
40
|
{
|
|
42
|
-
debugger
|
|
43
41
|
let error = this.getError();
|
|
44
42
|
if (error)
|
|
45
43
|
{
|
|
@@ -48,26 +46,31 @@ export class NSRadioButton extends React.Component<INSRadioButtonProps, INSBoxBo
|
|
|
48
46
|
}
|
|
49
47
|
return this.state.value;
|
|
50
48
|
}
|
|
49
|
+
|
|
51
50
|
setValue(value: boolean): void
|
|
52
51
|
{
|
|
53
|
-
debugger
|
|
54
52
|
this.setState({ value }, () =>
|
|
55
53
|
{
|
|
56
54
|
if (this.props.onChanged)
|
|
57
55
|
this.props.onChanged(this);
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
e.stopPropagation(); // Prevent the parent div's onClick from being triggered
|
|
63
|
-
this.setValue(e.target.checked);
|
|
64
|
-
}
|
|
58
|
+
|
|
65
59
|
private onClicked(): void
|
|
66
60
|
{
|
|
67
61
|
this.setValue(true);
|
|
68
|
-
if (this.props.
|
|
69
|
-
this.props.
|
|
62
|
+
if (this.props.onClick)
|
|
63
|
+
this.props.onClick();
|
|
70
64
|
}
|
|
65
|
+
|
|
66
|
+
override componentDidUpdate(prevProps: INSRadioButtonProps)
|
|
67
|
+
{
|
|
68
|
+
if (prevProps.isSelected !== this.props.isSelected)
|
|
69
|
+
{
|
|
70
|
+
this.setValue(this.props.isSelected ?? false);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
71
74
|
override render()
|
|
72
75
|
{
|
|
73
76
|
return (
|
|
@@ -76,17 +79,19 @@ export class NSRadioButton extends React.Component<INSRadioButtonProps, INSBoxBo
|
|
|
76
79
|
id={this.props.id}
|
|
77
80
|
className={`${Styles.ns_input_parent} ${this.props.classList?.join(" ")}`}
|
|
78
81
|
style={this.props.style}
|
|
79
|
-
onClick={this.onClicked}
|
|
80
82
|
>
|
|
83
|
+
<div className={Styles.ns_input_transparent} onClick={this.onClicked}></div>
|
|
81
84
|
<div className={Styles.ns_checkbox_parent} >
|
|
82
85
|
<input
|
|
83
86
|
type="radio"
|
|
84
87
|
name={this.props.name}
|
|
85
88
|
className={Styles.ns_input}
|
|
86
89
|
checked={this.state.value}
|
|
87
|
-
onChange={
|
|
90
|
+
onChange={() => { }}
|
|
88
91
|
/>
|
|
89
|
-
<span className={Styles.ns_input_title}>
|
|
92
|
+
<span className={Styles.ns_input_title}>
|
|
93
|
+
{this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title}
|
|
94
|
+
</span>
|
|
90
95
|
</div>
|
|
91
96
|
</div>
|
|
92
97
|
<NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
|