namirasoft-site-react 1.3.140 → 1.3.142

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.
Files changed (39) hide show
  1. package/dist/App.js +109 -55
  2. package/dist/App.js.map +1 -1
  3. package/dist/components/NSButtonRed.module.css +1 -1
  4. package/dist/components/NSFilterBox.d.ts +44 -1
  5. package/dist/components/NSFilterBox.js +112 -2
  6. package/dist/components/NSFilterBox.js.map +1 -1
  7. package/dist/components/NSFilterBox.module.css +10 -0
  8. package/dist/components/NSFilterBoxDialog.d.ts +1 -0
  9. package/dist/components/NSFilterBoxDialog.js +2 -2
  10. package/dist/components/NSFilterBoxDialog.js.map +1 -1
  11. package/dist/components/NSFilterItem.d.ts +17 -0
  12. package/dist/components/NSFilterItem.js +29 -0
  13. package/dist/components/NSFilterItem.js.map +1 -0
  14. package/dist/components/NSFilterItem.module.css +24 -0
  15. package/dist/components/NSFooter.d.ts +3 -3
  16. package/dist/components/NSFooter.js +2 -2
  17. package/dist/components/NSFooter.js.map +1 -1
  18. package/dist/components/NSGroupedList.d.ts +21 -0
  19. package/dist/components/NSGroupedList.js +12 -0
  20. package/dist/components/NSGroupedList.js.map +1 -0
  21. package/dist/components/NSGroupedList.module.css +71 -0
  22. package/dist/components/NSHeader.d.ts +3 -3
  23. package/dist/components/NSHeader.js +2 -2
  24. package/dist/components/NSHeader.js.map +1 -1
  25. package/dist/components/NSLayoutAction.js +4 -4
  26. package/dist/components/NSLayoutAction.js.map +1 -1
  27. package/package.json +3 -3
  28. package/src/App.tsx +110 -92
  29. package/src/components/NSButtonRed.module.css +1 -1
  30. package/src/components/NSFilterBox.module.css +10 -0
  31. package/src/components/NSFilterBox.tsx +204 -20
  32. package/src/components/NSFilterBoxDialog.tsx +5 -3
  33. package/src/components/NSFilterItem.module.css +24 -0
  34. package/src/components/NSFilterItem.tsx +72 -0
  35. package/src/components/NSFooter.tsx +13 -11
  36. package/src/components/NSGroupedList.module.css +71 -0
  37. package/src/components/NSGroupedList.tsx +59 -0
  38. package/src/components/NSHeader.tsx +8 -8
  39. package/src/components/NSLayoutAction.tsx +23 -21
@@ -8,7 +8,8 @@ import { NSButtonRed } from './NSButtonRed';
8
8
 
9
9
  interface INSFilterBoxDialogProps extends IBaseComponentProps
10
10
  {
11
- title: string
11
+ title: string;
12
+ onCloseDialog: () => void;
12
13
  }
13
14
 
14
15
  interface INSFilterBoxDialogState
@@ -22,7 +23,8 @@ export class NSFilterBoxDialog extends Component<INSFilterBoxDialogProps, INSFil
22
23
  {
23
24
  return (
24
25
  <div className={Styles.ns_dialog_holder}>
25
- <button className={Styles.ns_dialog_close}>
26
+ <button className={Styles.ns_dialog_close}
27
+ onClick={this.props.onCloseDialog}>
26
28
  <img src="https://static.namirasoft.com/image/concept/close/blue.svg" alt="close-dialog" width={24} height={24} />
27
29
  </button>
28
30
  <h3 className={Styles.ns_dialog_title}>
@@ -64,7 +66,7 @@ export class NSFilterBoxDialog extends Component<INSFilterBoxDialogProps, INSFil
64
66
 
65
67
  <NSButtonBlue
66
68
  title='Cancel'
67
- onClick={() => { }}
69
+ onClick={this.props.onCloseDialog}
68
70
  />
69
71
  </div>
70
72
  </div>
@@ -0,0 +1,24 @@
1
+ .ns_selected_holder {
2
+ position: relative;
3
+ }
4
+ .ns_selected_item_parent {
5
+ padding: 6px;
6
+ border: solid 1px #0377FF;
7
+ border-radius: 8px;
8
+ background-color: #fff;
9
+ color: #141B5C;
10
+ cursor: pointer;
11
+ }
12
+
13
+ .ns_selected_close_icon {
14
+ outline: none;
15
+ border: none;
16
+ background: none;
17
+ padding-top: 4px;
18
+ border-left: solid 1px #0377FF;
19
+ }
20
+
21
+ .ns_dialog_parent {
22
+ position: absolute;
23
+
24
+ }
@@ -0,0 +1,72 @@
1
+ import { Component } from 'react';
2
+ import { IBaseComponentProps } from '../props/IBaseComponentProps';
3
+ import Styles from './NSFilterItem.module.css'
4
+ import { NSFilterBoxDialog } from './NSFilterBoxDialog';
5
+ import { FilterItem } from 'namirasoft-core';
6
+
7
+ interface INSFilterItemProps extends IBaseComponentProps
8
+ {
9
+ item: FilterItem
10
+ removeSelected: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, text: string) => void
11
+ }
12
+
13
+ interface INSFilterItemState
14
+ {
15
+ showDialog: boolean
16
+ }
17
+
18
+ export class NSFilterItem extends Component<INSFilterItemProps, INSFilterItemState>
19
+ {
20
+ constructor(props: INSFilterItemProps)
21
+ {
22
+ super(props);
23
+ this.state = {
24
+ showDialog: false
25
+ }
26
+ this.onClsoeDialog = this.onClsoeDialog.bind(this);
27
+ this.onShowDialog = this.onShowDialog.bind(this);
28
+ }
29
+
30
+ onShowDialog()
31
+ {
32
+ this.setState({
33
+ showDialog: true
34
+ })
35
+ }
36
+
37
+ onClsoeDialog()
38
+ {
39
+ this.setState({
40
+ showDialog: false
41
+ })
42
+ }
43
+
44
+ override render()
45
+ {
46
+ return (
47
+ <div className={Styles.ns_selected_holder}>
48
+ <div className={Styles.ns_selected_item_parent}
49
+ onClick={this.onShowDialog}
50
+ >
51
+ <span>{ this.props.item.column} </span>
52
+ <button
53
+ className={Styles.ns_selected_close_icon}
54
+ onClick={(e) => this.props.removeSelected(e, this.props.item.column)}
55
+ >
56
+ <img src="https://static.namirasoft.com/image/concept/close/blue.svg" alt="close" width={24} height={24} />
57
+ </button>
58
+ </div>
59
+
60
+ {this.state.showDialog &&
61
+ <div className={Styles.ns_dialog_parent}>
62
+ <NSFilterBoxDialog
63
+ onCloseDialog={this.onClsoeDialog}
64
+ title='Edit Filter'
65
+
66
+ />
67
+ </div>
68
+ }
69
+ </div>
70
+ );
71
+ }
72
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from "react";
4
4
  import Styles from "./NSFooter.module.css";
5
- import { NamirasoftAPILinkServer, FilterLinkRow } from 'namirasoft-api-link';
5
+ import { NamirasoftAPILinkServer, FilterLinkFullRow } from 'namirasoft-api-link';
6
6
  import { IBaseComponentProps } from "../props/IBaseComponentProps";
7
7
 
8
8
  export interface INSFooterProps extends IBaseComponentProps
@@ -14,8 +14,8 @@ export interface INSFooterProps extends IBaseComponentProps
14
14
 
15
15
  export interface NSFooterState
16
16
  {
17
- filters: FilterLinkRow[];
18
- selected: FilterLinkRow | null;
17
+ filters: FilterLinkFullRow[];
18
+ selected: FilterLinkFullRow | null;
19
19
  }
20
20
 
21
21
  export class NSFooter extends React.Component<INSFooterProps, NSFooterState>
@@ -34,9 +34,9 @@ export class NSFooter extends React.Component<INSFooterProps, NSFooterState>
34
34
  override componentDidMount(): void
35
35
  {
36
36
  let server = new NamirasoftAPILinkServer(console.error);
37
- server.filter.GetFilters(this.props.scope, this.props.name).then(filters =>
37
+ server.filter.ListFilterLinks(this.props.scope, this.props.name, [], null, null).then(filters =>
38
38
  {
39
- this.setState({ filters });
39
+ this.setState({ filters: filters.rows });
40
40
  });
41
41
  }
42
42
  private hasChild(id: number): boolean
@@ -79,9 +79,9 @@ export class NSFooter extends React.Component<INSFooterProps, NSFooterState>
79
79
  </div>
80
80
  </div>
81
81
  <div className={`${Styles.ns_footer_copyright}`}>
82
- <span> ©Copyright 2010 - {new Date().getFullYear()} </span>{" "}
83
- <a href="https://namirasoft.com/" target="_blank" rel="noopener noreferrer"> Namira Software Corporation</a>. {" "}
84
- <span > All rights reserved. </span>
82
+ <span> ©Copyright 2010 - {new Date().getFullYear()} </span>{" "}
83
+ <a href="https://namirasoft.com/" target="_blank" rel="noopener noreferrer"> Namira Software Corporation</a>. {" "}
84
+ <span > All rights reserved. </span>
85
85
  </div>
86
86
  </div>
87
87
  </footer >
@@ -89,14 +89,16 @@ export class NSFooter extends React.Component<INSFooterProps, NSFooterState>
89
89
  }
90
90
  private render_menu(level: number, parent_id: number | null)
91
91
  {
92
- let fs: FilterLinkRow[] = this.state.filters?.filter(f => f.parent_id === parent_id);
92
+ let fs: FilterLinkFullRow[] = this.state.filters?.filter(f => f.parent_id === parent_id);
93
93
  return (
94
94
  <>
95
- {(fs?.map(f => this.render_menuItem(level, f)))}
95
+ {
96
+ (fs?.map(f => this.render_menuItem(level, f)))
97
+ }
96
98
  </>
97
99
  );
98
100
  }
99
- private render_menuItem(level: number, filter: FilterLinkRow)
101
+ private render_menuItem(level: number, filter: FilterLinkFullRow)
100
102
  {
101
103
  if (this.hasChild(filter.id))
102
104
  {
@@ -0,0 +1,71 @@
1
+ .ns_group_list_parent {
2
+ width: 100%;
3
+ max-width: 560px;
4
+ border-radius: 8px;
5
+ border: solid 1px #B2BBD9;
6
+ background-color: #fff;
7
+ padding-bottom: 16px;
8
+ height: 250px;
9
+ overflow: auto;
10
+ }
11
+
12
+ .ns_group_list_parent::-webkit-scrollbar {
13
+ width: 1rem;
14
+ }
15
+
16
+ .ns_group_list_parent::-webkit-scrollbar-track {
17
+ box-shadow: inset 0 0 6px #E8EBF6;
18
+ }
19
+
20
+ .ns_group_list_parent::-webkit-scrollbar-thumb {
21
+ background-color: #A1A4B0;
22
+ border-radius: 8px;
23
+ }
24
+
25
+ .ns_group_list {
26
+ list-style-type: none;
27
+ color: #141B5C;
28
+ padding: 0;
29
+ margin: 0;
30
+ display: flex;
31
+ flex-direction: column;
32
+ align-items: flex-start;
33
+ justify-content: flex-start;
34
+ font-size: 16px;
35
+ font-weight: 700;
36
+ width: 100%;
37
+ }
38
+
39
+ .ns_group_category {
40
+ display: inline-block;
41
+ padding-top: 10px;
42
+ padding-bottom: 10px;
43
+ padding-left: 8px;
44
+ border-bottom: solid 1px currentColor;
45
+ width: 100%;
46
+ }
47
+
48
+ .ns_group_list li {
49
+ width: 100%;
50
+ }
51
+
52
+ .ns_group_item {
53
+ cursor: pointer;
54
+ padding: 6px 0 6px 24px;
55
+ font-size: 16px;
56
+ font-weight: 300;
57
+ color: #141B5C;
58
+ border-bottom: solid 1px currentColor;
59
+ width: 100%;
60
+ display: inline-block;
61
+ transition: all 0.1s;
62
+ }
63
+
64
+ .ns_group_item:hover {
65
+ background-color: #B2BBD9;
66
+ font-weight: 700;
67
+ }
68
+
69
+ .ns_block {
70
+ display: block;
71
+ }
@@ -0,0 +1,59 @@
1
+ "use client"
2
+ import { Component } from 'react';
3
+ import { IBaseComponentProps } from '../main';
4
+ import Styles from "./NSGroupedList.module.css"
5
+
6
+ interface INSGroupedListProps extends IBaseComponentProps
7
+ {
8
+ groups: {
9
+ name: string;
10
+ text: string;
11
+ sign?: string;
12
+ operator_name?: string;
13
+ items: {
14
+ name: string;
15
+ text: string;
16
+ }[];
17
+ }[];
18
+ onClick: (group: string, item: string) => void;
19
+ }
20
+
21
+ interface INSGroupedListState
22
+ {
23
+
24
+ }
25
+
26
+ class NSGroupedList extends Component<INSGroupedListProps, INSGroupedListState>
27
+ {
28
+ override render()
29
+ {
30
+ return (
31
+ <div className={Styles.ns_group_list_parent}>
32
+ {this.props.groups.map((group, index) =>
33
+ <ul key={index} className={Styles.ns_group_list}>
34
+ <span className={Styles.ns_group_category}> {group.name} </span>
35
+ {
36
+ group.items.map((item, index) =>
37
+ <li key={index} onClick={() => this.props.onClick(group.name, item.name)}>
38
+ <div className={Styles.ns_group_item}>
39
+ <span>
40
+ {item.name} {" "}
41
+ {group.sign && <span> {group.sign} </span>}
42
+ </span>
43
+ {
44
+ group.operator_name &&
45
+ <span className={Styles.ns_block}> {group.operator_name} </span>
46
+ }
47
+ </div>
48
+ </li>
49
+ )
50
+ }
51
+ </ul>
52
+ )}
53
+ </div>
54
+
55
+ );
56
+ }
57
+ }
58
+
59
+ export default NSGroupedList;
@@ -3,7 +3,7 @@
3
3
  import React from "react";
4
4
  import Styles from "./NSHeader.module.css";
5
5
  import NavDropdown from 'react-bootstrap/NavDropdown';
6
- import { NamirasoftAPILinkServer, FilterLinkRow } from 'namirasoft-api-link';
6
+ import { NamirasoftAPILinkServer, FilterLinkFullRow } from 'namirasoft-api-link';
7
7
  import { IBaseComponentProps } from "../props/IBaseComponentProps";
8
8
  import Logout from '../assets/images/icon-logout.png';
9
9
  export interface INSHeaderProps extends IBaseComponentProps
@@ -19,8 +19,8 @@ export interface INSHeaderProps extends IBaseComponentProps
19
19
 
20
20
  export interface NSHeaderState
21
21
  {
22
- filters: FilterLinkRow[];
23
- selected: FilterLinkRow | null;
22
+ filters: FilterLinkFullRow[];
23
+ selected: FilterLinkFullRow | null;
24
24
  showNavbar: boolean;
25
25
  }
26
26
 
@@ -43,12 +43,12 @@ export class NSHeader extends React.Component<INSHeaderProps, NSHeaderState>
43
43
  override componentDidMount(): void
44
44
  {
45
45
  let server = new NamirasoftAPILinkServer(console.error);
46
- server.filter.GetFilters(this.props.scope, this.props.name).then(filters =>
46
+ server.filter.ListFilterLinks(this.props.scope, this.props.name, [], null, null).then(filters =>
47
47
  {
48
- this.setState({ filters });
48
+ this.setState({ filters: filters.rows });
49
49
  });
50
50
  }
51
- private onMenuItemToggled(checked: boolean, selected: FilterLinkRow)
51
+ private onMenuItemToggled(checked: boolean, selected: FilterLinkFullRow)
52
52
  {
53
53
  if (checked)
54
54
  this.setState({ selected });
@@ -139,14 +139,14 @@ export class NSHeader extends React.Component<INSHeaderProps, NSHeaderState>
139
139
  }
140
140
  private render_menu(level: number, parent_id: number | null)
141
141
  {
142
- let fs: FilterLinkRow[] = this.state.filters?.filter(f => f.parent_id === parent_id);
142
+ let fs: FilterLinkFullRow[] = this.state.filters?.filter(f => f.parent_id === parent_id);
143
143
  return (
144
144
  <div className={`me-auto nav ${Styles.ns_navbar_items_container}`} >
145
145
  {(fs?.map(f => this.render_menuItem(level, f)))}
146
146
  </div>
147
147
  );
148
148
  }
149
- private render_menuItem(level: number, filter: FilterLinkRow)
149
+ private render_menuItem(level: number, filter: FilterLinkFullRow)
150
150
  {
151
151
  if (this.hasChild(filter.id))
152
152
  {
@@ -48,27 +48,7 @@ export function NSLayoutAction(props: INSLayoutActionProps)
48
48
  />
49
49
  </div>
50
50
 
51
- {/* Mobile */}
52
- <div className={`d-block d-lg-none ${Styles.ns_mobile_action_bar_title}`}>
53
- <h1 className={Styles.title}>{props.title}</h1>
54
- {
55
- props.description && lines &&
56
- <>
57
- <p className={Styles.description}>
58
- {
59
- lines.map((line, index) =>
60
- {
61
- return <>
62
- {line.trim()}
63
- {index != lines.length - 1 && <br />}
64
- </>
65
- })
66
- }
67
- </p>
68
- <NSSpace size={NSSpaceSizeType.MINI} />
69
- </>
70
- }
71
- </div>
51
+
72
52
 
73
53
  <div className={Styles.ns_actions_hodler}>
74
54
  {filtered_actions.map((action) =>
@@ -82,6 +62,28 @@ export function NSLayoutAction(props: INSLayoutActionProps)
82
62
 
83
63
  </div>
84
64
  <NSSpace size={NSSpaceSizeType.SMALL} />
65
+ {/* Mobile */}
66
+ <div className={`container d-block d-lg-none ${Styles.ns_mobile_action_bar_title}`}>
67
+ <h1 className={Styles.title}>{props.title}</h1>
68
+ {
69
+ props.description && lines &&
70
+ <>
71
+ <p className={Styles.description}>
72
+ {
73
+ lines.map((line, index) =>
74
+ {
75
+ return <>
76
+ {line.trim()}
77
+ {index != lines.length - 1 && <br />}
78
+ </>
79
+ })
80
+ }
81
+ </p>
82
+ <NSSpace size={NSSpaceSizeType.MINI} />
83
+ </>
84
+ }
85
+ </div>
86
+ <NSSpace size={NSSpaceSizeType.SMALL} />
85
87
  {props.children}
86
88
  </NSLayout>
87
89
  );