namirasoft-site-react 1.4.24 → 1.4.25

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.
@@ -8,6 +8,7 @@ export interface INSBoxIntegerProps extends IBaseComponentProps, IValidationProp
8
8
  defaultValue?: number;
9
9
  onChanged?: (e: NSBoxInteger) => void;
10
10
  onClicked?: (e: NSBoxInteger) => void;
11
+ isPositiveValue?: boolean;
11
12
  }
12
13
  export interface INSBoxIntegerState {
13
14
  value?: number;
@@ -27,17 +27,28 @@ export class NSBoxInteger extends React.Component {
27
27
  return this.state.value;
28
28
  }
29
29
  setValue(value) {
30
- this.setState({ value }, () => {
31
- if (this.props.onChanged)
32
- this.props.onChanged(this);
33
- });
30
+ if (this.props.isPositiveValue) {
31
+ if (value)
32
+ if (value > 0)
33
+ this.setState({ value }, () => {
34
+ if (this.props.onChanged)
35
+ this.props.onChanged(this);
36
+ });
37
+ else
38
+ throw new Error("Only Positive Value");
39
+ }
40
+ else
41
+ this.setState({ value }, () => {
42
+ if (this.props.onChanged)
43
+ this.props.onChanged(this);
44
+ });
34
45
  }
35
46
  onChanged(e) {
36
47
  this.setValue(parseInt(e.target.value));
37
48
  }
38
49
  render() {
39
50
  var _a;
40
- 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: [_jsxs("span", { className: Styles.ns_input_title, children: [" ", this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title, " "] }), _jsx("input", { type: "number", name: this.props.name, className: Styles.ns_input, placeholder: this.props.placeholder, value: this.state.value, onChange: this.onChanged, onClick: () => this.props.onClicked, style: { background: `url("https://static.namirasoft.com/image/concept/nsbox/Integer.png") white no-repeat scroll center right 16px`, backgroundSize: "24px" } })] }), _jsx(NSBoxErrorNotifier, { error: this.state.error, clearError: () => this.setState({ error: "" }) })] }));
51
+ return (_jsx(_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: [_jsxs("span", { className: Styles.ns_input_title, children: [" ", this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), " ", this.props.title, " "] }), _jsx("input", { type: "number", name: this.props.name, className: Styles.ns_input, placeholder: this.props.placeholder, value: this.state.value, onChange: this.onChanged, onClick: () => this.props.onClicked, style: { background: `url("https://static.namirasoft.com/image/concept/nsbox/Integer.png") white no-repeat scroll center right 16px`, backgroundSize: "24px" } }), _jsx(NSBoxErrorNotifier, { error: this.state.error, clearError: () => this.setState({ error: "" }) })] }) }));
41
52
  }
42
53
  }
43
54
  //# sourceMappingURL=NSBoxInteger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSBoxInteger.js","sourceRoot":"","sources":["../../src/components/NSBoxInteger.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAiB1D,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAAiD;IAExF,YAAY,KAAyB;QAEpC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,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,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,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AC,SAAS,EACnC,KAAK,EAAE,EAAE,UAAU,EAAE,+GAA+G,EAAE,cAAc,EAAE,MAAM,EAAE,GAC7J,EACH,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,IACzF,GACJ,CACH,CAAC;IACH,CAAC;CACD"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.24",
11
+ "version": "1.4.25",
12
12
  "author": "Amir Abolhasani, Alireza Esmaeeli",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -33,7 +33,7 @@
33
33
  "link-react": "^3.0.0",
34
34
  "namirasoft-api-link": "^1.4.5",
35
35
  "namirasoft-api-product": "^1.4.5",
36
- "namirasoft-core": "^1.4.8",
36
+ "namirasoft-core": "^1.4.11",
37
37
  "path-browserify": "^1.0.1",
38
38
  "react": "^18.3.1",
39
39
  "react-app-rewired": "^2.2.1",
@@ -15,6 +15,7 @@ export interface INSBoxIntegerProps extends IBaseComponentProps, IValidationProp
15
15
  defaultValue?: number;
16
16
  onChanged?: (e: NSBoxInteger) => void;
17
17
  onClicked?: (e: NSBoxInteger) => void;
18
+ isPositiveValue?: boolean;
18
19
  }
19
20
 
20
21
  export interface INSBoxIntegerState
@@ -55,11 +56,24 @@ export class NSBoxInteger extends React.Component<INSBoxIntegerProps, INSBoxInte
55
56
  }
56
57
  setValue(value: number | undefined): void
57
58
  {
58
- this.setState({ value }, () =>
59
+ if (this.props.isPositiveValue)
59
60
  {
60
- if (this.props.onChanged)
61
- this.props.onChanged(this);
62
- });
61
+ if (value)
62
+ if (value > 0)
63
+ this.setState({ value }, () =>
64
+ {
65
+ if (this.props.onChanged)
66
+ this.props.onChanged(this);
67
+ });
68
+ else
69
+ throw new Error("Only Positive Value"); //todo: Fix Error Message
70
+ }
71
+ else
72
+ this.setState({ value }, () =>
73
+ {
74
+ if (this.props.onChanged)
75
+ this.props.onChanged(this);
76
+ });
63
77
  }
64
78
  private onChanged(e: React.ChangeEvent<HTMLInputElement>): void
65
79
  {
@@ -81,8 +95,8 @@ export class NSBoxInteger extends React.Component<INSBoxIntegerProps, INSBoxInte
81
95
  onClick={() => this.props.onClicked}
82
96
  style={{ background: `url("https://static.namirasoft.com/image/concept/nsbox/Integer.png") white no-repeat scroll center right 16px`, backgroundSize: "24px" }}
83
97
  />
84
- </div>
85
98
  <NSBoxErrorNotifier error={this.state.error} clearError={() => this.setState({ error: "" })} />
99
+ </div>
86
100
  </>
87
101
  );
88
102
  }