namirasoft-site-react 1.3.117 → 1.3.118
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/NSBoxEntity.d.ts +15 -2
- package/dist/components/NSBoxEntity.js +55 -3
- package/dist/components/NSBoxEntity.js.map +1 -1
- package/dist/components/NSBoxEnum.d.ts +19 -1
- package/dist/components/NSBoxEnum.js +60 -36
- package/dist/components/NSBoxEnum.js.map +1 -1
- package/dist/main.d.ts +4 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NSBoxEntity.tsx +97 -11
- package/src/components/NSBoxEnum.tsx +104 -43
- package/src/main.ts +4 -1
- package/dist/components/NSSelectBox.d.ts +0 -25
- package/dist/components/NSSelectBox.js +0 -62
- package/dist/components/NSSelectBox.js.map +0 -1
- package/src/components/NSSelectBox.tsx +0 -115
- /package/dist/components/{NSSelectBox.module.css → NSBoxEnum.module.css} +0 -0
- /package/src/components/{NSSelectBox.module.css → NSBoxEnum.module.css} +0 -0
|
@@ -6,7 +6,20 @@ export interface INSBoxEntityProps extends IBaseComponentProps, IValidationProps
|
|
|
6
6
|
title: string;
|
|
7
7
|
options: SelectProps['options'];
|
|
8
8
|
multiple: boolean;
|
|
9
|
+
placeHolder?: string;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
11
|
+
export interface INSBoxEntityState {
|
|
12
|
+
value: string | null;
|
|
13
|
+
values: string[];
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntityState> {
|
|
17
|
+
constructor(props: INSBoxEntityProps);
|
|
18
|
+
getError(value: string): string | null;
|
|
19
|
+
getValue(): string | null;
|
|
20
|
+
getValues(): string[];
|
|
21
|
+
setValue(value: string | null): void;
|
|
22
|
+
setValues(values: string[]): void;
|
|
23
|
+
handleChange(value: string | null | string[]): void;
|
|
24
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
12
25
|
}
|
|
@@ -1,10 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import
|
|
4
|
+
import Styles from "./NSSelectBox.module.css";
|
|
5
|
+
import { Select, Space } from 'antd';
|
|
6
|
+
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
7
|
+
import { Validator } from "../Validator";
|
|
8
|
+
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
5
9
|
export class NSBoxEntity extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = {
|
|
13
|
+
value: null,
|
|
14
|
+
values: [],
|
|
15
|
+
};
|
|
16
|
+
this.getValues = this.getValues.bind(this);
|
|
17
|
+
this.setValues = this.setValues.bind(this);
|
|
18
|
+
this.setValue = this.setValue.bind(this);
|
|
19
|
+
this.getValue = this.getValue.bind(this);
|
|
20
|
+
this.handleChange = this.handleChange.bind(this);
|
|
21
|
+
}
|
|
22
|
+
getError(value) {
|
|
23
|
+
return (Validator.getError(this.props.title, value, this.props));
|
|
24
|
+
}
|
|
25
|
+
getValue() {
|
|
26
|
+
let error = this.getError(this.state.value || "");
|
|
27
|
+
if (error) {
|
|
28
|
+
this.setState({ error });
|
|
29
|
+
throw new Error(error);
|
|
30
|
+
}
|
|
31
|
+
return this.state.value;
|
|
32
|
+
}
|
|
33
|
+
getValues() {
|
|
34
|
+
this.state.values.forEach(value => {
|
|
35
|
+
let error = this.getError(value || "");
|
|
36
|
+
if (error) {
|
|
37
|
+
this.setState({ error });
|
|
38
|
+
throw new Error(error);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return this.state.values;
|
|
42
|
+
}
|
|
43
|
+
setValue(value) {
|
|
44
|
+
this.setState({ value });
|
|
45
|
+
}
|
|
46
|
+
setValues(values) {
|
|
47
|
+
this.setState({ values });
|
|
48
|
+
}
|
|
49
|
+
handleChange(value) {
|
|
50
|
+
if (this.props.multiple) {
|
|
51
|
+
this.setValues(value);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.setValue(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
6
57
|
render() {
|
|
7
|
-
|
|
58
|
+
var _a;
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${Styles.ns_input_parent}`, children: [_jsxs("span", { className: Styles.ns_input_title, children: [" ", this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title, " "] }), _jsx(Select, { mode: this.props.multiple ? "multiple" : undefined, style: { width: '100%' }, className: Styles.ns_input_select, placeholder: (_a = this.props.placeHolder) !== null && _a !== void 0 ? _a : "Combo Box", onChange: this.handleChange, optionLabelProp: "label", options: this.props.options, optionRender: (option) => (_jsx(Space, { className: Styles.ns_input_select_option, children: option.data.desc })), suffixIcon: _jsx("img", { src: IconSelectBox, alt: "SelectBox Icon" }) })] }), _jsx(NSBoxErrorNotifier, { error: this.state.error })] }));
|
|
8
60
|
}
|
|
9
61
|
}
|
|
10
62
|
//# sourceMappingURL=NSBoxEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSBoxEntity.js","sourceRoot":"","sources":["../../src/components/NSBoxEntity.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NSBoxEntity.js","sourceRoot":"","sources":["../../src/components/NSBoxEntity.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,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AS,EAAE,MAAM,CAAC,eAAe,EACjC,WAAW,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,WAAW,mCAAI,WAAW,EAClD,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,eAAe,EAAC,OAAO,EACvB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CACzB,KAAC,KAAK,IAAC,SAAS,EAAE,MAAM,CAAC,sBAAsB,YAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,GACV,CACR,EACD,UAAU,EAAE,cAAK,GAAG,EAAE,aAAa,EAAE,GAAG,EAAC,gBAAgB,GAAG,GAC3D,IACG,EACN,KAAC,kBAAkB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,IAC7C,CACH,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SelectProps } from 'antd';
|
|
1
3
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
2
4
|
import { IValidationProps } from "../props/IValidationProps";
|
|
3
5
|
export interface INSBoxEnumProps extends IBaseComponentProps, IValidationProps {
|
|
4
6
|
title: string;
|
|
7
|
+
options: SelectProps['options'];
|
|
5
8
|
multiple: boolean;
|
|
9
|
+
placeHolder?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface INSBoxEnumState {
|
|
12
|
+
value: string | null;
|
|
13
|
+
values: string[];
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState> {
|
|
17
|
+
constructor(props: INSBoxEnumProps);
|
|
18
|
+
getError(value: string): string | null;
|
|
19
|
+
getValue(): string | null;
|
|
20
|
+
getValues(): string[];
|
|
21
|
+
setValue(value: string | null): void;
|
|
22
|
+
setValues(values: string[]): void;
|
|
23
|
+
handleChange(value: string | null | string[]): void;
|
|
24
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
25
|
}
|
|
7
|
-
export declare function NSBoxEnum(props: INSBoxEnumProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,38 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import Styles from "./NSBoxEnum.module.css";
|
|
5
|
+
import { Select, Space } from 'antd';
|
|
6
|
+
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
7
|
+
import { Validator } from "../Validator";
|
|
8
|
+
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
9
|
+
export class NSBoxEnum extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = {
|
|
13
|
+
value: null,
|
|
14
|
+
values: [],
|
|
15
|
+
};
|
|
16
|
+
this.getValues = this.getValues.bind(this);
|
|
17
|
+
this.setValues = this.setValues.bind(this);
|
|
18
|
+
this.setValue = this.setValue.bind(this);
|
|
19
|
+
this.getValue = this.getValue.bind(this);
|
|
20
|
+
this.handleChange = this.handleChange.bind(this);
|
|
21
|
+
}
|
|
22
|
+
getError(value) {
|
|
23
|
+
return (Validator.getError(this.props.title, value, this.props));
|
|
24
|
+
}
|
|
25
|
+
getValue() {
|
|
26
|
+
let error = this.getError(this.state.value || "");
|
|
27
|
+
if (error) {
|
|
28
|
+
this.setState({ error });
|
|
29
|
+
throw new Error(error);
|
|
30
|
+
}
|
|
31
|
+
return this.state.value;
|
|
32
|
+
}
|
|
33
|
+
getValues() {
|
|
34
|
+
this.state.values.forEach(value => {
|
|
35
|
+
let error = this.getError(value || "");
|
|
36
|
+
if (error) {
|
|
37
|
+
this.setState({ error });
|
|
38
|
+
throw new Error(error);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return this.state.values;
|
|
42
|
+
}
|
|
43
|
+
setValue(value) {
|
|
44
|
+
this.setState({ value });
|
|
45
|
+
}
|
|
46
|
+
setValues(values) {
|
|
47
|
+
this.setState({ values });
|
|
48
|
+
}
|
|
49
|
+
handleChange(value) {
|
|
50
|
+
if (this.props.multiple) {
|
|
51
|
+
this.setValues(value);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.setValue(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
var _a;
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${Styles.ns_input_parent}`, children: [_jsxs("span", { className: Styles.ns_input_title, children: [" ", this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title, " "] }), _jsx(Select, { mode: this.props.multiple ? "multiple" : undefined, style: { width: '100%' }, className: Styles.ns_input_select, placeholder: (_a = this.props.placeHolder) !== null && _a !== void 0 ? _a : "Combo Box", onChange: this.handleChange, optionLabelProp: "label", options: this.props.options, optionRender: (option) => (_jsx(Space, { className: Styles.ns_input_select_option, children: option.data.desc })), suffixIcon: _jsx("img", { src: IconSelectBox, alt: "SelectBox Icon" }) })] }), _jsx(NSBoxErrorNotifier, { error: this.state.error })] }));
|
|
60
|
+
}
|
|
37
61
|
}
|
|
38
62
|
//# sourceMappingURL=NSBoxEnum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSBoxEnum.js","sourceRoot":"","sources":["../../src/components/NSBoxEnum.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NSBoxEnum.js","sourceRoot":"","sources":["../../src/components/NSBoxEnum.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,aAAa,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAiB1D,MAAM,OAAO,SAAU,SAAQ,KAAK,CAAC,SAA2C;IAE/E,YAAY,KAAsB;QAEjC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACZ,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,EAAE;SACV,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,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,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,QAAQ,CAAC,KAAa;QAErB,OAAO,CACN,SAAS,CAAC,QAAQ,CAAC,IAA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AAS,EAAE,GAAG,MAAM,CAAC,eAAe,EAAE,aAC1C,gBAAM,SAAS,EAAE,MAAM,CAAC,cAAc,kBAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAW,OAAG,IAAI,CAAC,KAAK,CAAC,KAAK,SAAS,EACrI,KAAC,MAAM,IACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACxB,SAAS,EAAE,MAAM,CAAC,eAAe,EACjC,WAAW,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,WAAW,mCAAI,WAAW,EAClD,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,eAAe,EAAC,OAAO,EACvB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CACzB,KAAC,KAAK,IAAC,SAAS,EAAE,MAAM,CAAC,sBAAsB,YAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,GACV,CACR,EACD,UAAU,EAAE,cAAK,GAAG,EAAE,aAAa,EAAE,GAAG,EAAC,gBAAgB,GAAG,GAC3D,IACG,EACN,KAAC,kBAAkB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,IAC7C,CACH,CAAC;IACH,CAAC;CACD"}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export * from "./components/NSBoxBoolean";
|
|
1
2
|
export * from "./components/NSBoxDate";
|
|
3
|
+
export * from "./components/NSBoxDateTime";
|
|
2
4
|
export * from "./components/NSBoxDouble";
|
|
3
5
|
export * from "./components/NSBoxDuration";
|
|
4
6
|
export * from "./components/NSBoxEmail";
|
|
7
|
+
export * from "./components/NSBoxEntity";
|
|
8
|
+
export * from "./components/NSBoxEnum";
|
|
5
9
|
export * from "./components/NSBoxErrorNotifier";
|
|
6
10
|
export * from "./components/NSBoxInteger";
|
|
7
11
|
export * from "./components/NSBoxIPV4";
|
|
@@ -29,7 +33,6 @@ export * from "./components/NSLayoutHeroBanner";
|
|
|
29
33
|
export * from "./components/NSLayoutTitle";
|
|
30
34
|
export * from "./components/NSLoading";
|
|
31
35
|
export * from "./components/NSNotification";
|
|
32
|
-
export * from "./components/NSSelectBox";
|
|
33
36
|
export * from "./components/NSSpace";
|
|
34
37
|
export * from "./components/NSSection";
|
|
35
38
|
export * from "./components/NSSectionBars";
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export * from "./components/NSBoxBoolean";
|
|
1
2
|
export * from "./components/NSBoxDate";
|
|
3
|
+
export * from "./components/NSBoxDateTime";
|
|
2
4
|
export * from "./components/NSBoxDouble";
|
|
3
5
|
export * from "./components/NSBoxDuration";
|
|
4
6
|
export * from "./components/NSBoxEmail";
|
|
7
|
+
export * from "./components/NSBoxEntity";
|
|
8
|
+
export * from "./components/NSBoxEnum";
|
|
5
9
|
export * from "./components/NSBoxErrorNotifier";
|
|
6
10
|
export * from "./components/NSBoxInteger";
|
|
7
11
|
export * from "./components/NSBoxIPV4";
|
|
@@ -29,7 +33,6 @@ export * from "./components/NSLayoutHeroBanner";
|
|
|
29
33
|
export * from "./components/NSLayoutTitle";
|
|
30
34
|
export * from "./components/NSLoading";
|
|
31
35
|
export * from "./components/NSNotification";
|
|
32
|
-
export * from "./components/NSSelectBox";
|
|
33
36
|
export * from "./components/NSSpace";
|
|
34
37
|
export * from "./components/NSSection";
|
|
35
38
|
export * from "./components/NSSectionBars";
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AAC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AAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,115 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import Styles from "./NSSelectBox.module.css";
|
|
4
|
+
import { Select, Space } from 'antd';
|
|
3
5
|
import type { SelectProps } from 'antd';
|
|
6
|
+
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
4
7
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
5
8
|
import { IValidationProps } from "../props/IValidationProps";
|
|
6
|
-
import {
|
|
9
|
+
import { Validator } from "../Validator";
|
|
10
|
+
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
7
11
|
|
|
8
12
|
export interface INSBoxEntityProps extends IBaseComponentProps, IValidationProps
|
|
9
13
|
{
|
|
10
14
|
title: string;
|
|
11
15
|
options: SelectProps['options'];
|
|
12
16
|
multiple: boolean;
|
|
17
|
+
placeHolder?: string;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
export
|
|
20
|
+
export interface INSBoxEntityState
|
|
16
21
|
{
|
|
17
|
-
|
|
22
|
+
value: string | null;
|
|
23
|
+
values: string[];
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class NSBoxEntity extends React.Component<INSBoxEntityProps, INSBoxEntityState>
|
|
28
|
+
{
|
|
29
|
+
constructor(props: INSBoxEntityProps)
|
|
30
|
+
{
|
|
31
|
+
super(props);
|
|
32
|
+
this.state = {
|
|
33
|
+
value: null,
|
|
34
|
+
values: [],
|
|
35
|
+
};
|
|
36
|
+
this.getValues = this.getValues.bind(this);
|
|
37
|
+
this.setValues = this.setValues.bind(this);
|
|
38
|
+
this.setValue = this.setValue.bind(this);
|
|
39
|
+
this.getValue = this.getValue.bind(this);
|
|
40
|
+
this.handleChange = this.handleChange.bind(this);
|
|
41
|
+
}
|
|
42
|
+
getError(value: string): string | null
|
|
43
|
+
{
|
|
44
|
+
return (
|
|
45
|
+
Validator.getError(this.props.title, value, this.props)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
getValue(): string | null
|
|
49
|
+
{
|
|
50
|
+
let error = this.getError(this.state.value || "");
|
|
51
|
+
if (error)
|
|
52
|
+
{
|
|
53
|
+
this.setState({ error });
|
|
54
|
+
throw new Error(error);
|
|
55
|
+
}
|
|
56
|
+
return this.state.value;
|
|
57
|
+
}
|
|
58
|
+
getValues(): string[]
|
|
59
|
+
{
|
|
60
|
+
this.state.values.forEach(value =>
|
|
61
|
+
{
|
|
62
|
+
let error = this.getError(value || "");
|
|
63
|
+
if (error)
|
|
64
|
+
{
|
|
65
|
+
this.setState({ error });
|
|
66
|
+
throw new Error(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return this.state.values;
|
|
70
|
+
}
|
|
71
|
+
setValue(value: string | null): void
|
|
72
|
+
{
|
|
73
|
+
this.setState({ value });
|
|
74
|
+
}
|
|
75
|
+
setValues(values: string[]): void
|
|
76
|
+
{
|
|
77
|
+
this.setState({ values });
|
|
78
|
+
}
|
|
79
|
+
handleChange(value: string | null | string[]): void
|
|
80
|
+
{
|
|
81
|
+
if (this.props.multiple)
|
|
82
|
+
{
|
|
83
|
+
this.setValues(value as string[]);
|
|
84
|
+
} else
|
|
85
|
+
{
|
|
86
|
+
this.setValue(value as string | null);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
override render()
|
|
18
90
|
{
|
|
19
91
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
92
|
+
<>
|
|
93
|
+
<div className={`${Styles.ns_input_parent}`}>
|
|
94
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
95
|
+
<Select
|
|
96
|
+
mode={this.props.multiple ? "multiple" : undefined}
|
|
97
|
+
style={{ width: '100%' }}
|
|
98
|
+
className={Styles.ns_input_select}
|
|
99
|
+
placeholder={this.props.placeHolder ?? "Combo Box"}
|
|
100
|
+
onChange={this.handleChange}
|
|
101
|
+
optionLabelProp="label"
|
|
102
|
+
options={this.props.options}
|
|
103
|
+
optionRender={(option) => (
|
|
104
|
+
<Space className={Styles.ns_input_select_option}>
|
|
105
|
+
{option.data.desc}
|
|
106
|
+
</Space>
|
|
107
|
+
)}
|
|
108
|
+
suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
<NSBoxErrorNotifier error={this.state.error} />
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
28
114
|
}
|
|
29
115
|
}
|
|
@@ -1,54 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Styles from "./NSBoxEnum.module.css";
|
|
4
|
+
import { Select, Space } from 'antd';
|
|
5
|
+
import type { SelectProps } from 'antd';
|
|
6
|
+
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
1
7
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
2
8
|
import { IValidationProps } from "../props/IValidationProps";
|
|
3
|
-
import {
|
|
9
|
+
import { Validator } from "../Validator";
|
|
10
|
+
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
4
11
|
|
|
5
|
-
const options = [
|
|
6
|
-
{
|
|
7
|
-
date: {
|
|
8
|
-
desc : "test"
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
date: {
|
|
13
|
-
desc : "test"
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
date: {
|
|
18
|
-
desc : "test"
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
date: {
|
|
23
|
-
desc : "test"
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
date: {
|
|
28
|
-
desc : "test"
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
date: {
|
|
33
|
-
desc : "test"
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
]
|
|
37
12
|
export interface INSBoxEnumProps extends IBaseComponentProps, IValidationProps
|
|
38
13
|
{
|
|
39
14
|
title: string;
|
|
15
|
+
options: SelectProps['options'];
|
|
40
16
|
multiple: boolean;
|
|
17
|
+
placeHolder?: string;
|
|
41
18
|
}
|
|
42
19
|
|
|
43
|
-
export
|
|
20
|
+
export interface INSBoxEnumState
|
|
44
21
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
value: string | null;
|
|
23
|
+
values: string[];
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class NSBoxEnum extends React.Component<INSBoxEnumProps, INSBoxEnumState>
|
|
28
|
+
{
|
|
29
|
+
constructor(props: INSBoxEnumProps)
|
|
30
|
+
{
|
|
31
|
+
super(props);
|
|
32
|
+
this.state = {
|
|
33
|
+
value: null,
|
|
34
|
+
values: [],
|
|
35
|
+
};
|
|
36
|
+
this.getValues = this.getValues.bind(this);
|
|
37
|
+
this.setValues = this.setValues.bind(this);
|
|
38
|
+
this.setValue = this.setValue.bind(this);
|
|
39
|
+
this.getValue = this.getValue.bind(this);
|
|
40
|
+
this.handleChange = this.handleChange.bind(this);
|
|
41
|
+
}
|
|
42
|
+
getError(value: string): string | null
|
|
43
|
+
{
|
|
44
|
+
return (
|
|
45
|
+
Validator.getError(this.props.title, value, this.props)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
getValue(): string | null
|
|
49
|
+
{
|
|
50
|
+
let error = this.getError(this.state.value || "");
|
|
51
|
+
if (error)
|
|
52
|
+
{
|
|
53
|
+
this.setState({ error });
|
|
54
|
+
throw new Error(error);
|
|
55
|
+
}
|
|
56
|
+
return this.state.value;
|
|
57
|
+
}
|
|
58
|
+
getValues(): string[]
|
|
59
|
+
{
|
|
60
|
+
this.state.values.forEach(value =>
|
|
61
|
+
{
|
|
62
|
+
let error = this.getError(value || "");
|
|
63
|
+
if (error)
|
|
64
|
+
{
|
|
65
|
+
this.setState({ error });
|
|
66
|
+
throw new Error(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return this.state.values;
|
|
70
|
+
}
|
|
71
|
+
setValue(value: string | null): void
|
|
72
|
+
{
|
|
73
|
+
this.setState({ value });
|
|
74
|
+
}
|
|
75
|
+
setValues(values: string[]): void
|
|
76
|
+
{
|
|
77
|
+
this.setState({ values });
|
|
78
|
+
}
|
|
79
|
+
handleChange(value: string | null | string[]): void
|
|
80
|
+
{
|
|
81
|
+
if (this.props.multiple)
|
|
82
|
+
{
|
|
83
|
+
this.setValues(value as string[]);
|
|
84
|
+
} else
|
|
85
|
+
{
|
|
86
|
+
this.setValue(value as string | null);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
override render()
|
|
90
|
+
{
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<div className={`${Styles.ns_input_parent}`}>
|
|
94
|
+
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
95
|
+
<Select
|
|
96
|
+
mode={this.props.multiple ? "multiple" : undefined}
|
|
97
|
+
style={{ width: '100%' }}
|
|
98
|
+
className={Styles.ns_input_select}
|
|
99
|
+
placeholder={this.props.placeHolder ?? "Combo Box"}
|
|
100
|
+
onChange={this.handleChange}
|
|
101
|
+
optionLabelProp="label"
|
|
102
|
+
options={this.props.options}
|
|
103
|
+
optionRender={(option) => (
|
|
104
|
+
<Space className={Styles.ns_input_select_option}>
|
|
105
|
+
{option.data.desc}
|
|
106
|
+
</Space>
|
|
107
|
+
)}
|
|
108
|
+
suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
<NSBoxErrorNotifier error={this.state.error} />
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
54
115
|
}
|
package/src/main.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export * from "./components/NSBoxBoolean";
|
|
1
2
|
export * from "./components/NSBoxDate";
|
|
3
|
+
export * from "./components/NSBoxDateTime";
|
|
2
4
|
export * from "./components/NSBoxDouble";
|
|
3
5
|
export * from "./components/NSBoxDuration";
|
|
4
6
|
export * from "./components/NSBoxEmail";
|
|
7
|
+
export * from "./components/NSBoxEntity";
|
|
8
|
+
export * from "./components/NSBoxEnum";
|
|
5
9
|
export * from "./components/NSBoxErrorNotifier";
|
|
6
10
|
export * from "./components/NSBoxInteger";
|
|
7
11
|
export * from "./components/NSBoxIPV4";
|
|
@@ -29,7 +33,6 @@ export * from "./components/NSLayoutHeroBanner";
|
|
|
29
33
|
export * from "./components/NSLayoutTitle";
|
|
30
34
|
export * from "./components/NSLoading";
|
|
31
35
|
export * from "./components/NSNotification";
|
|
32
|
-
export * from "./components/NSSelectBox";
|
|
33
36
|
export * from "./components/NSSpace";
|
|
34
37
|
export * from "./components/NSSection";
|
|
35
38
|
export * from "./components/NSSectionBars";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { SelectProps } from 'antd';
|
|
3
|
-
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
4
|
-
import { IValidationProps } from "../props/IValidationProps";
|
|
5
|
-
export interface INSSelectBoxProps extends IBaseComponentProps, IValidationProps {
|
|
6
|
-
title: string;
|
|
7
|
-
options: SelectProps['options'];
|
|
8
|
-
multiple: boolean;
|
|
9
|
-
placeHolder?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface NSSelectBoxState {
|
|
12
|
-
value: string | null;
|
|
13
|
-
values: string[];
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class NSSelectBox extends React.Component<INSSelectBoxProps, NSSelectBoxState> {
|
|
17
|
-
constructor(props: INSSelectBoxProps);
|
|
18
|
-
getError(value: string): string | null;
|
|
19
|
-
getValue(): string | null;
|
|
20
|
-
getValues(): string[];
|
|
21
|
-
setValue(value: string | null): void;
|
|
22
|
-
setValues(values: string[]): void;
|
|
23
|
-
handleChange(value: string | null | string[]): void;
|
|
24
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import Styles from "./NSSelectBox.module.css";
|
|
5
|
-
import { Select, Space } from 'antd';
|
|
6
|
-
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
7
|
-
import { Validator } from "../Validator";
|
|
8
|
-
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
9
|
-
export class NSSelectBox extends React.Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
this.state = {
|
|
13
|
-
value: null,
|
|
14
|
-
values: [],
|
|
15
|
-
};
|
|
16
|
-
this.getValues = this.getValues.bind(this);
|
|
17
|
-
this.setValues = this.setValues.bind(this);
|
|
18
|
-
this.setValue = this.setValue.bind(this);
|
|
19
|
-
this.getValue = this.getValue.bind(this);
|
|
20
|
-
this.handleChange = this.handleChange.bind(this);
|
|
21
|
-
}
|
|
22
|
-
getError(value) {
|
|
23
|
-
return (Validator.getError(this.props.title, value, this.props));
|
|
24
|
-
}
|
|
25
|
-
getValue() {
|
|
26
|
-
let error = this.getError(this.state.value || "");
|
|
27
|
-
if (error) {
|
|
28
|
-
this.setState({ error });
|
|
29
|
-
throw new Error(error);
|
|
30
|
-
}
|
|
31
|
-
return this.state.value;
|
|
32
|
-
}
|
|
33
|
-
getValues() {
|
|
34
|
-
this.state.values.forEach(value => {
|
|
35
|
-
let error = this.getError(value || "");
|
|
36
|
-
if (error) {
|
|
37
|
-
this.setState({ error });
|
|
38
|
-
throw new Error(error);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return this.state.values;
|
|
42
|
-
}
|
|
43
|
-
setValue(value) {
|
|
44
|
-
this.setState({ value });
|
|
45
|
-
}
|
|
46
|
-
setValues(values) {
|
|
47
|
-
this.setState({ values });
|
|
48
|
-
}
|
|
49
|
-
handleChange(value) {
|
|
50
|
-
if (this.props.multiple) {
|
|
51
|
-
this.setValues(value);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.setValue(value);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
var _a;
|
|
59
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${Styles.ns_input_parent}`, children: [_jsxs("span", { className: Styles.ns_input_title, children: [" ", this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title, " "] }), _jsx(Select, { mode: this.props.multiple ? "multiple" : undefined, style: { width: '100%' }, className: Styles.ns_input_select, placeholder: (_a = this.props.placeHolder) !== null && _a !== void 0 ? _a : "Combo Box", onChange: this.handleChange, optionLabelProp: "label", options: this.props.options, optionRender: (option) => (_jsx(Space, { className: Styles.ns_input_select_option, children: option.data.desc })), suffixIcon: _jsx("img", { src: IconSelectBox, alt: "SelectBox Icon" }) })] }), _jsx(NSBoxErrorNotifier, { error: this.state.error })] }));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=NSSelectBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NSSelectBox.js","sourceRoot":"","sources":["../../src/components/NSSelectBox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,0BAA0B,CAAC;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CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EACxB,SAAS,EAAE,MAAM,CAAC,eAAe,EACjC,WAAW,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,WAAW,mCAAI,WAAW,EAClD,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,eAAe,EAAC,OAAO,EACvB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CACzB,KAAC,KAAK,IAAC,SAAS,EAAE,MAAM,CAAC,sBAAsB,YAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,GACV,CACR,EACD,UAAU,EAAE,cAAK,GAAG,EAAE,aAAa,EAAE,GAAG,EAAC,gBAAgB,GAAG,GAC3D,IACG,EACN,KAAC,kBAAkB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,IAC7C,CACH,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import Styles from "./NSSelectBox.module.css";
|
|
4
|
-
import { Select, Space } from 'antd';
|
|
5
|
-
import type { SelectProps } from 'antd';
|
|
6
|
-
import IconSelectBox from '../assets/images/icon-select-box.svg';
|
|
7
|
-
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
8
|
-
import { IValidationProps } from "../props/IValidationProps";
|
|
9
|
-
import { Validator } from "../Validator";
|
|
10
|
-
import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
|
|
11
|
-
|
|
12
|
-
export interface INSSelectBoxProps extends IBaseComponentProps, IValidationProps
|
|
13
|
-
{
|
|
14
|
-
title: string;
|
|
15
|
-
options: SelectProps['options'];
|
|
16
|
-
multiple: boolean;
|
|
17
|
-
placeHolder?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface NSSelectBoxState
|
|
21
|
-
{
|
|
22
|
-
value: string | null;
|
|
23
|
-
values: string[];
|
|
24
|
-
error?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class NSSelectBox extends React.Component<INSSelectBoxProps, NSSelectBoxState>
|
|
28
|
-
{
|
|
29
|
-
constructor(props: INSSelectBoxProps)
|
|
30
|
-
{
|
|
31
|
-
super(props);
|
|
32
|
-
this.state = {
|
|
33
|
-
value: null,
|
|
34
|
-
values: [],
|
|
35
|
-
};
|
|
36
|
-
this.getValues = this.getValues.bind(this);
|
|
37
|
-
this.setValues = this.setValues.bind(this);
|
|
38
|
-
this.setValue = this.setValue.bind(this);
|
|
39
|
-
this.getValue = this.getValue.bind(this);
|
|
40
|
-
this.handleChange = this.handleChange.bind(this);
|
|
41
|
-
}
|
|
42
|
-
getError(value: string): string | null
|
|
43
|
-
{
|
|
44
|
-
return (
|
|
45
|
-
Validator.getError(this.props.title, value, this.props)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
getValue(): string | null
|
|
49
|
-
{
|
|
50
|
-
let error = this.getError(this.state.value || "");
|
|
51
|
-
if (error)
|
|
52
|
-
{
|
|
53
|
-
this.setState({ error });
|
|
54
|
-
throw new Error(error);
|
|
55
|
-
}
|
|
56
|
-
return this.state.value;
|
|
57
|
-
}
|
|
58
|
-
getValues(): string[]
|
|
59
|
-
{
|
|
60
|
-
this.state.values.forEach(value =>
|
|
61
|
-
{
|
|
62
|
-
let error = this.getError(value || "");
|
|
63
|
-
if (error)
|
|
64
|
-
{
|
|
65
|
-
this.setState({ error });
|
|
66
|
-
throw new Error(error);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return this.state.values;
|
|
70
|
-
}
|
|
71
|
-
setValue(value: string | null): void
|
|
72
|
-
{
|
|
73
|
-
this.setState({ value });
|
|
74
|
-
}
|
|
75
|
-
setValues(values: string[]): void
|
|
76
|
-
{
|
|
77
|
-
this.setState({ values });
|
|
78
|
-
}
|
|
79
|
-
handleChange(value: string | null | string[]): void
|
|
80
|
-
{
|
|
81
|
-
if (this.props.multiple)
|
|
82
|
-
{
|
|
83
|
-
this.setValues(value as string[]);
|
|
84
|
-
} else
|
|
85
|
-
{
|
|
86
|
-
this.setValue(value as string | null);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
override render()
|
|
90
|
-
{
|
|
91
|
-
return (
|
|
92
|
-
<>
|
|
93
|
-
<div className={`${Styles.ns_input_parent}`}>
|
|
94
|
-
<span className={Styles.ns_input_title}> {this.props.required && <span style={{ color: "red" }} >*</span>} {this.props.title} </span>
|
|
95
|
-
<Select
|
|
96
|
-
mode={this.props.multiple ? "multiple" : undefined}
|
|
97
|
-
style={{ width: '100%' }}
|
|
98
|
-
className={Styles.ns_input_select}
|
|
99
|
-
placeholder={this.props.placeHolder ?? "Combo Box"}
|
|
100
|
-
onChange={this.handleChange}
|
|
101
|
-
optionLabelProp="label"
|
|
102
|
-
options={this.props.options}
|
|
103
|
-
optionRender={(option) => (
|
|
104
|
-
<Space className={Styles.ns_input_select_option}>
|
|
105
|
-
{option.data.desc}
|
|
106
|
-
</Space>
|
|
107
|
-
)}
|
|
108
|
-
suffixIcon={<img src={IconSelectBox} alt="SelectBox Icon" />}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
<NSBoxErrorNotifier error={this.state.error} />
|
|
112
|
-
</>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
File without changes
|
|
File without changes
|