namirasoft-site-react 1.3.149 → 1.3.151

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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.3.149",
11
+ "version": "1.3.151",
12
12
  "author": "Amir Abolhasani, Alireza Esmaeeli, Sepideh Mazloumi, Hooman Shashaeh",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -22,13 +22,13 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@types/node": "^20.12.12",
25
- "@types/react": "^18.3.2",
25
+ "@types/react": "^18.3.3",
26
26
  "@types/react-dom": "^18.3.0",
27
27
  "antd": "^5.17.3",
28
28
  "bootstrap": "^5.3.3",
29
29
  "copyfiles": "^2.4.1",
30
30
  "link-react": "^3.0.0",
31
- "namirasoft-api-link": "^1.3.9",
31
+ "namirasoft-api-link": "^1.3.10",
32
32
  "namirasoft-core": "^1.3.34",
33
33
  "path-browserify": "^1.0.1",
34
34
  "react": "^18.3.1",
@@ -36,7 +36,7 @@
36
36
  "react-bootstrap": "^2.10.2",
37
37
  "react-dom": "^18.3.1",
38
38
  "react-phone-input-2": "^2.15.1",
39
- "react-phone-number-input": "^3.4.1",
39
+ "react-phone-number-input": "^3.4.3",
40
40
  "react-router-dom": "^6.23.1",
41
41
  "react-scripts": "5.0.1"
42
42
  },
package/src/App.tsx CHANGED
@@ -1,191 +1,86 @@
1
1
  import './App.css';
2
2
  import 'bootstrap/dist/css/bootstrap.min.css';
3
- import { NSLayoutAction } from './components/NSLayoutAction';
4
- import { NSFilterBox } from './components/NSFilterBox';
5
- import { FilterItemColumnType } from 'namirasoft-core';
6
-
7
- const actions = [
8
- {
9
- group: "test-1",
10
- items: [
11
- {
12
- id: "1",
13
- menu_item: "View",
14
- handler()
15
- {
16
- console.log("View")
17
- },
18
- isActive()
19
- {
20
- return true
21
- }
22
- },
23
- {
24
- id: "2",
25
- menu_item: "View History",
26
- handler()
27
- {
28
- console.log("View History")
29
- },
30
- isActive()
31
- {
32
- return true
33
- }
34
- },
35
- {
36
- id: "3",
37
- menu_item: "Edit",
38
- handler()
39
- {
40
- console.log("Edit")
41
- },
42
- isActive()
43
- {
44
- return true
45
- }
46
- },
47
- {
48
- id: "4",
49
- menu_item: "Delete",
50
- handler()
51
- {
52
- console.log("Delete")
53
- },
54
- isActive()
55
- {
56
- return true
57
- }
58
- },
59
- ]
60
- }
61
- ]
3
+ import { NSBoxTextArea, NSTable } from './main';
4
+ import { useRef } from 'react';
62
5
 
6
+ export function App()
7
+ {
63
8
 
64
- const suggest_items = [
65
- {
66
- name: "test-category-1",
67
- text: "test-category-1",
68
- columns: [
69
- {
70
- name: "item-id-test-1",
71
- text: "item-title-test-1",
72
- type: FilterItemColumnType.String
73
- },
74
- {
75
- name: "item-id-test-2",
76
- text: "item-title-test-2",
77
- type: FilterItemColumnType.String
78
- },
79
- {
80
- name: "item-id-test-2",
81
- text: "item-title-test-2",
82
- type: FilterItemColumnType.String
83
- },
84
- {
85
- name: "item-id-test-2",
86
- text: "item-title-test-2",
87
- type: FilterItemColumnType.String
88
- },
89
- ]
9
+ let table = useRef<NSTable<App>>(null);
10
+ let columns = {
11
+ "id": "ID",
12
+ "project": "Project",
13
+ "level": "Level",
14
+ "message": "Message",
15
+ "cent": "Cent",
16
+ "status": "Status",
17
+ }
18
+ let rows = [{
19
+ id: 1,
20
+ project: "Namirasoft Account",
21
+ level: "Debug",
22
+ message: "Lorem ipsum dolor sit amet, consetetur ",
23
+ cent: "26",
24
+ status: "pending"
90
25
  },
91
26
  {
92
- name: "test-category-1",
93
- text: "test-category-1",
94
- columns: [
95
- {
96
- name: "item-id-test-1",
97
- text: "item-title-test-1",
98
- type: FilterItemColumnType.String
99
- },
100
- {
101
- name: "item-id-test-2",
102
- text: "item-title-test-2",
103
- type: FilterItemColumnType.String
104
- },
105
- {
106
- name: "item-id-test-2",
107
- text: "item-title-test-2",
108
- type: FilterItemColumnType.String
109
- },
110
- {
111
- name: "item-id-test-2",
112
- text: "item-title-test-2",
113
- type: FilterItemColumnType.String
114
- },
115
- ]
27
+ id: 2,
28
+ project: "Namirasoft Account",
29
+ level: "Debug",
30
+ message: "Lorem ipsum dolor sit amet, consetetur ",
31
+ cent: "24",
32
+ status: "Done"
116
33
  },
117
34
  {
118
- name: "test-category-1",
119
- text: "test-category-2",
120
- columns: [
121
- {
122
- name: "item-id-test-2-1",
123
- text: "item-title-test-2-1",
124
- type: FilterItemColumnType.String
125
- },
126
- {
127
- name: "item-id-test-2-2",
128
- text: "item-title-test-2-1",
129
- type: FilterItemColumnType.String
130
- },
131
- {
132
- name: "item-id-test-2-3",
133
- text: "item-title-test-2-3",
134
- type: FilterItemColumnType.String
135
- },
136
- {
137
- name: "item-id-test-2-4",
138
- text: "item-title-test-2-4",
139
- type: FilterItemColumnType.String
140
- },
141
- ]
142
- },
35
+ id: 3,
36
+ project: "Namirasoft Account",
37
+ level: "Debug",
38
+ message: "Lorem ipsum dolor sit amet, consetetur ",
39
+ cent: "24",
40
+ status: "Done"
41
+ }
42
+ ]
43
+ interface App
143
44
  {
144
- name: "test-category-3",
145
- text: "test-category-3",
146
- columns: [
147
- {
148
- name: "item-id-test-3-1",
149
- text: "item-title-test-3-1",
150
- type: FilterItemColumnType.String
151
- },
152
- {
153
- name: "item-id-test-3-2",
154
- text: "item-title-test-3-2",
155
- type: FilterItemColumnType.String
156
- },
157
- {
158
- name: "item-id-test-3-3",
159
- text: "item-title-test-3-3",
160
- type: FilterItemColumnType.String
161
- },
162
- {
163
- name: "item-id-test-3-4",
164
- text: "item-title-test-3-4",
165
- type: FilterItemColumnType.String
166
- },
167
- ]
168
- },
169
- ]
170
-
171
-
172
- export function App()
173
- {
45
+ id: number,
46
+ project: string,
47
+ level: string,
48
+ message: string,
49
+ cent: string,
50
+ status: string
51
+ }
52
+ function getCell(row: App, column: string): any
53
+ {
54
+ return (row as any)[column];
55
+ }
56
+ function getRows(page: number): void
57
+ {
58
+ console.log(page);
59
+ }
60
+ function onChange(): void
61
+ { }
174
62
 
175
63
  return (
176
64
  <>
177
- <NSLayoutAction
178
- notifications={[]}
179
- actions={actions}
180
- title='Test2 test2'
181
- description='Lorem lorem orem Lorem lorem orem Lorem lorem orem Lorem lorem orem Lorem lorem orem Lorem lorem orem '
182
- scope='Namirasoft Account Console'
183
- logo='https://static.namirasoft.com/image/namirasoft/site/logo/base.png'
184
- >
185
- <NSFilterBox
186
- tables={suggest_items}
187
- placeholder='placeholder' />
188
- </NSLayoutAction>
65
+ <NSTable
66
+ ref={table}
67
+ columns={columns}
68
+ rows={rows}
69
+ getCell={getCell}
70
+ getColumnAttributes={() => { return {} }}
71
+ getRowKey={row => row.id.toString()}
72
+ onChanged={onChange}
73
+ pageSize={3}
74
+ totalItems={100}
75
+ getRows={getRows}
76
+ />
77
+ <NSBoxTextArea
78
+ rows={10}
79
+ cols={24}
80
+ title='Description'
81
+ placeholder=''
82
+ required={false}
83
+ />
189
84
  </>
190
85
  );
191
86
  }
@@ -69,7 +69,7 @@
69
69
 
70
70
  @media only screen and (min-width: 380px) {
71
71
  .ns_input_phone_parent input {
72
- width: 206px !important;
72
+ width: 272px !important;
73
73
  }
74
74
  }
75
75
 
@@ -1,7 +1,7 @@
1
1
  .ns_input_parent {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- width: 206px;
4
+ width: 272px;
5
5
  color: #141B5C;
6
6
  position: relative;
7
7
  max-width: 100%;
@@ -0,0 +1,38 @@
1
+ .ns_text_area_parent {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: fit-content;
5
+ color: #141B5C;
6
+ position: relative;
7
+ justify-content: center;
8
+ width: 100%;
9
+ max-width: 560px;
10
+ }
11
+
12
+ .ns_text_area_container {
13
+ display: flex;
14
+ align-items: center;
15
+ position: relative;
16
+ width: 100%;
17
+ }
18
+
19
+ .ns_text_area_icon_container {
20
+ margin: 0 !important;
21
+ position: absolute;
22
+ right: 12px;
23
+ top: 10px;
24
+ }
25
+
26
+ .ns_text_area {
27
+ border-radius: 8px;
28
+ padding: 10px 12px 10px 12px;
29
+ font-size: 16px;
30
+ font-weight: 400;
31
+ border: 1px solid rgba(0, 0, 0, 1) !important;
32
+ width: 100%;
33
+ }
34
+
35
+ .ns_text_area_title {
36
+ font-size: 16px;
37
+ font-weight: 400;
38
+ }
@@ -0,0 +1,96 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import Styles from "./NSBoxTextArea.module.css";
5
+ import { IBaseComponentProps } from "../props/IBaseComponentProps";
6
+ import { IValidationProps } from "../props/IValidationProps";
7
+ import { IValidationStringProps } from "../props/IValidationStringProps";
8
+ import { Validator } from "../Validator";
9
+ import { NSBoxErrorNotifier } from "./NSBoxErrorNotifier";
10
+
11
+ export interface INSBoxTextAreaProps extends IBaseComponentProps, IValidationProps, IValidationStringProps
12
+ {
13
+ title: string;
14
+ defaultValue?: string;
15
+ onChanged?: () => void;
16
+ placeholder?: string;
17
+ cols: number;
18
+ rows: number;
19
+ }
20
+
21
+ export interface INSBoxTextAreaState
22
+ {
23
+ value: string;
24
+ error?: string;
25
+ }
26
+
27
+ export class NSBoxTextArea extends React.Component<INSBoxTextAreaProps, INSBoxTextAreaState>
28
+ {
29
+ constructor(props: INSBoxTextAreaProps)
30
+ {
31
+ super(props);
32
+ this.state = { value: props.defaultValue ?? "" };
33
+ this.getValue = this.getValue.bind(this);
34
+ this.setValue = this.setValue.bind(this);
35
+ // this.onChanged = this.onChanged.bind(this);
36
+ }
37
+ getError(): string | null
38
+ {
39
+ return (
40
+ Validator.getError(this.props.title, this.state.value, this.props) &&
41
+ Validator.getErrorString(this.props.title, this.state.value, this.props)
42
+ );
43
+ }
44
+ getValue(): string
45
+ {
46
+ let error = this.getError();
47
+ if (error)
48
+ {
49
+ this.setState({ error });
50
+ throw new Error(error);
51
+ }
52
+ return this.state.value;
53
+
54
+ }
55
+ setValue(value: string): void
56
+ {
57
+ this.setState({ value });
58
+ }
59
+ // private onChanged = async (e: React.ChangeEventHandler<HTMLTextAreaElement>): Promise<void> =>
60
+ // {
61
+ // await this.setValue(e.value);
62
+ // if (this.props.onChanged)
63
+ // this.props.onChanged();
64
+ // }
65
+ override render()
66
+ {
67
+ return (
68
+ <>
69
+ <div className={`${Styles.ns_text_area_parent} ${this.props.classList?.join(" ")}`} style={this.props.style}>
70
+ <span className={Styles.ns_text_area_title}> {this.props.required && <span style={{ color: "red" }}>*</span>} {this.props.title} </span>
71
+ <div className={Styles.ns_text_area_container}>
72
+ <figure className={Styles.ns_text_area_icon_container}>
73
+ <img
74
+ src="https://static.namirasoft.com/image/concept/magnifier/blue.svg"
75
+ alt="input-icon"
76
+ width={24}
77
+ height={24}
78
+ />
79
+ </figure>
80
+ <textarea
81
+ id={this.props.id}
82
+ value={this.state.value}
83
+ className={Styles.ns_text_area}
84
+ placeholder={this.props.placeholder}
85
+ rows={this.props.rows}
86
+ cols={this.props.cols}
87
+ />
88
+
89
+
90
+ </div>
91
+ </div>
92
+ <NSBoxErrorNotifier error={this.state.error} />
93
+ </>
94
+ );
95
+ }
96
+ }
@@ -20,6 +20,7 @@ interface INSFilterBoxProps extends IBaseComponentProps
20
20
  type: FilterItemColumnType
21
21
  }[];
22
22
  }[];
23
+ getData: (column: string) => string[];
23
24
  }
24
25
 
25
26
  interface INSFilterBoxState
@@ -70,6 +71,8 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
70
71
  selectedValues: []
71
72
  }
72
73
  this.selectColumn = this.selectColumn.bind(this);
74
+ this.selectOperator = this.selectOperator.bind(this);
75
+ this.selectValue = this.selectValue.bind(this);
73
76
  this.removeSelected = this.removeSelected.bind(this);
74
77
  this.onChanged = this.onChanged.bind(this);
75
78
  this.getValue = this.getValue.bind(this);
@@ -81,6 +84,7 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
81
84
  return this.state.searchValue;
82
85
  }
83
86
 
87
+ //show and hide list ui
84
88
  setValue(value: string): void
85
89
  {
86
90
  if (value !== "")
@@ -91,21 +95,46 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
91
95
  })
92
96
  else
93
97
  this.setState({
94
- showSuggestList: false
98
+ showSuggestList: false,
99
+ groupListState: GroupListState.Normal,
100
+ searchValue: ""
95
101
  })
96
102
  }
97
103
 
98
104
 
99
105
  selectColumn(groupe: string, item: string): void
100
106
  {
101
- console.log(item);
102
- let columns = this.props.tables.filter((table) => table.name === groupe)
107
+ console.log("item", groupe);
108
+ console.log("item", item);
103
109
  this.setState({
104
- selectedColumns: columns,
105
- groupListState: GroupListState.Opertor
110
+ groupListState: GroupListState.Opertor,
111
+ searchValue: item
112
+ //selectedOperators
106
113
  })
107
114
  }
108
115
 
116
+ selectOperator(group: string, item: string): void
117
+ {
118
+ console.log("item", item);
119
+ console.log("group", group);
120
+ debugger
121
+ this.setState({
122
+ groupListState: GroupListState.Value,
123
+ })
124
+
125
+ }
126
+
127
+ selectValue(group: string, item: string): void
128
+ {
129
+ console.log("item", item);
130
+ console.log("group", group);
131
+ // let filterItems = new FilterItem("", false, this.state.selectedOperators.operator, this.state.selectedOperators.name)
132
+ // console.log(filterItems)
133
+ // this.setState({
134
+ // filterItems
135
+ // })
136
+ }
137
+
109
138
  removeSelected(text: string): void
110
139
  {
111
140
  let selectedArray = [...this.state.filterItems];
@@ -139,7 +168,7 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
139
168
  <input
140
169
  // id={this.props.id}
141
170
  value={this.state.searchValue}
142
- onChange={(e) => this.onChanged(e)}
171
+ onChange={this.onChanged}
143
172
  type="text"
144
173
  className={Styles.ns_input}
145
174
  placeholder={this.props.placeholder}
@@ -148,6 +177,7 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
148
177
  <figure className={Styles.ns_input_close_icon}
149
178
  onClick={() => this.setState({
150
179
  showSuggestList: false,
180
+ groupListState: GroupListState.Normal,
151
181
  searchValue: ""
152
182
  })}
153
183
  >
@@ -185,44 +215,49 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
185
215
  {
186
216
  this.state.groupListState == GroupListState.Opertor &&
187
217
  <NSGroupedList
218
+ onClick={this.selectOperator}
188
219
  groups={
189
- FilterItemOperator.getAllByType(FilterItemColumnType.String).map((operator) =>
190
- {
191
- return {
192
- name: this.state.selectedColumns[0].name,
193
- text: this.state.selectedColumns[0].text,
194
- sign: operator.sign,
195
- operator_name: operator.name,
196
- items: this.state.selectedColumns[0]?.columns?.map((column) =>
197
- {
198
- return {
199
- name: column.name,
200
- text: column.text,
201
- }
202
- })
220
+ [
221
+ {
222
+ name: "operators",
223
+ text: "Operators",
224
+ items:
225
+ FilterItemOperator.getAllByType(FilterItemColumnType.String).map((operator) =>
226
+ {
227
+ return {
228
+ name: operator.name,
229
+ text: operator.name,
230
+ }
231
+
232
+ })
203
233
  }
204
- }
205
- )
234
+ ]
235
+
206
236
  }
207
- onClick={() =>
208
- {
209
- this.setState({
210
- groupListState: GroupListState.Value,
211
- selectedOperators: {...this.state.selectedColumns[0], operator: this.state.selectedOperators.operator }
212
- })
213
- }}
214
237
  />
215
238
  }
216
239
 
217
- {/* {
240
+ {
218
241
  this.state.groupListState == GroupListState.Value &&
219
242
  <NSGroupedList
220
- onClick={() =>
221
- {
222
- let filterItems = new FilterItem("", false, this.state.selectedOperators.operator, this.state.selectedOperators.name)
223
- }}
243
+ onClick={this.selectValue}
244
+ groups={
245
+ [{
246
+ name: "value",
247
+ text: "Value",
248
+ items:
249
+ this.props.getData(this.state.searchValue).map((data) =>
250
+ {
251
+ return {
252
+ name: data,
253
+ text: data
254
+ }
255
+ })
256
+ }
257
+ ]
258
+ }
224
259
  />
225
- } */}
260
+ }
226
261
 
227
262
 
228
263
  </div>
@@ -5,7 +5,7 @@
5
5
  border: solid 1px #B2BBD9;
6
6
  background-color: #fff;
7
7
  padding-bottom: 16px;
8
- height: 250px;
8
+ height: 360px;
9
9
  overflow: auto;
10
10
  }
11
11
 
@@ -19,9 +19,7 @@ interface INSGroupedListProps extends IBaseComponentProps
19
19
  }
20
20
 
21
21
  interface INSGroupedListState
22
- {
23
-
24
- }
22
+ { }
25
23
 
26
24
  class NSGroupedList extends Component<INSGroupedListProps, INSGroupedListState>
27
25
  {
@@ -31,13 +29,13 @@ class NSGroupedList extends Component<INSGroupedListProps, INSGroupedListState>
31
29
  <div className={Styles.ns_group_list_parent}>
32
30
  {this.props.groups.map((group, index) =>
33
31
  <ul key={index} className={Styles.ns_group_list}>
34
- <span className={Styles.ns_group_category}> {group.name} </span>
32
+ <span className={Styles.ns_group_category}> {group.text} </span>
35
33
  {
36
34
  group.items.map((item, index) =>
37
35
  <li key={index} onClick={() => this.props.onClick(group.name, item.name)}>
38
36
  <div className={Styles.ns_group_item}>
39
37
  <span>
40
- {item.name} {" "}
38
+ {item.text} {" "}
41
39
  {group.sign && <span> {group.sign} </span>}
42
40
  </span>
43
41
  {
@@ -47,9 +47,6 @@ export function NSLayoutAction(props: INSLayoutActionProps)
47
47
  onClose={() => setState({ show: false })}
48
48
  />
49
49
  </div>
50
-
51
-
52
-
53
50
  <div className={Styles.ns_actions_hodler}>
54
51
  {filtered_actions.map((action) =>
55
52
  <NSActionMenu
@@ -59,7 +56,6 @@ export function NSLayoutAction(props: INSLayoutActionProps)
59
56
  />
60
57
  )}
61
58
  </div>
62
-
63
59
  </div>
64
60
  <NSSpace size={NSSpaceSizeType.SMALL} />
65
61
  {/* Mobile */}
@@ -9,6 +9,7 @@
9
9
  margin: 0 auto;
10
10
  border: 1px solid rgba(161, 164, 176, 1);
11
11
  box-shadow: 0px 0px 2px 0px rgba(161, 164, 176, 1);
12
+ justify-content: center;
12
13
  }
13
14
 
14
15
  .ns_panel_column {