namirasoft-site-react 1.3.140 → 1.3.141
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/App.js +109 -55
- package/dist/App.js.map +1 -1
- package/dist/components/NSButtonRed.module.css +1 -1
- package/dist/components/NSFilterBox.d.ts +44 -1
- package/dist/components/NSFilterBox.js +112 -2
- package/dist/components/NSFilterBox.js.map +1 -1
- package/dist/components/NSFilterBox.module.css +10 -0
- package/dist/components/NSFilterBoxDialog.d.ts +1 -0
- package/dist/components/NSFilterBoxDialog.js +2 -2
- package/dist/components/NSFilterBoxDialog.js.map +1 -1
- package/dist/components/NSFilterItem.d.ts +17 -0
- package/dist/components/NSFilterItem.js +29 -0
- package/dist/components/NSFilterItem.js.map +1 -0
- package/dist/components/NSFilterItem.module.css +24 -0
- package/dist/components/NSGroupedList.d.ts +21 -0
- package/dist/components/NSGroupedList.js +12 -0
- package/dist/components/NSGroupedList.js.map +1 -0
- package/dist/components/NSGroupedList.module.css +71 -0
- package/dist/components/NSLayoutAction.js +4 -4
- package/dist/components/NSLayoutAction.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +110 -92
- package/src/components/NSButtonRed.module.css +1 -1
- package/src/components/NSFilterBox.module.css +10 -0
- package/src/components/NSFilterBox.tsx +204 -20
- package/src/components/NSFilterBoxDialog.tsx +5 -3
- package/src/components/NSFilterItem.module.css +24 -0
- package/src/components/NSFilterItem.tsx +72 -0
- package/src/components/NSGroupedList.module.css +71 -0
- package/src/components/NSGroupedList.tsx +59 -0
- package/src/components/NSLayoutAction.tsx +23 -21
|
@@ -12,9 +12,9 @@ export function NSLayoutAction(props) {
|
|
|
12
12
|
show: false
|
|
13
13
|
});
|
|
14
14
|
const filtered_actions = props.actions.filter((action) => action.group);
|
|
15
|
-
return (_jsxs(NSLayout, Object.assign({}, props, { children: [_jsxs("div", { className: Styles.ns_action_bar_holder, children: [_jsxs("div", { className: `d-none d-lg-flex ${Styles.ns_desktop_action_bar_title}`, children: [_jsx("h1", { className: Styles.title, children: props.title }), _jsxs("button", { className: Styles.ns_info_container, onClick: () => setState({ show: true }), children: [_jsx("img", { src: 'https://static.namirasoft.com/image/concept/info/white-blue.svg', alt: 'info-icon', width: 24, height: 24 }), _jsx("span", { children: " Info " })] }), _jsx(NSModal, { show: state.show, description: props.description, title: props.title, onClose: () => setState({ show: false }) })] }), _jsxs("div", { className: `d-block d-lg-none ${Styles.ns_mobile_action_bar_title}`, children: [_jsx("h1", { className: Styles.title, children: props.title }), props.description && lines &&
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
return (_jsxs(NSLayout, Object.assign({}, props, { children: [_jsxs("div", { className: Styles.ns_action_bar_holder, children: [_jsxs("div", { className: `d-none d-lg-flex ${Styles.ns_desktop_action_bar_title}`, children: [_jsx("h1", { className: Styles.title, children: props.title }), _jsxs("button", { className: Styles.ns_info_container, onClick: () => setState({ show: true }), children: [_jsx("img", { src: 'https://static.namirasoft.com/image/concept/info/white-blue.svg', alt: 'info-icon', width: 24, height: 24 }), _jsx("span", { children: " Info " })] }), _jsx(NSModal, { show: state.show, description: props.description, title: props.title, onClose: () => setState({ show: false }) })] }), _jsx("div", { className: Styles.ns_actions_hodler, children: filtered_actions.map((action) => _jsx(NSActionMenu, { group: action.group, items: action.items }, action.id)) })] }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsxs("div", { className: `container d-block d-lg-none ${Styles.ns_mobile_action_bar_title}`, children: [_jsx("h1", { className: Styles.title, children: props.title }), props.description && lines &&
|
|
16
|
+
_jsxs(_Fragment, { children: [_jsx("p", { className: Styles.description, children: lines.map((line, index) => {
|
|
17
|
+
return _jsxs(_Fragment, { children: [line.trim(), index != lines.length - 1 && _jsx("br", {})] });
|
|
18
|
+
}) }), _jsx(NSSpace, { size: NSSpaceSizeType.MINI })] })] }), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), props.children] })));
|
|
19
19
|
}
|
|
20
20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,CAAA;oCACJ,CAAC,CAAC,GAEA,EACJ,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,IAAI,GAAI,IACrC,IAEC,EACN,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,KAAK,GAAI,EACvC,KAAK,CAAC,QAAQ,KACL,CACX,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import './App.css';
|
|
2
2
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
3
|
-
import { NSBoxIPV4, NSTable, NSTabPage } from './main';
|
|
4
|
-
import { useRef } from 'react';
|
|
5
3
|
import { NSLayoutAction } from './components/NSLayoutAction';
|
|
6
|
-
import { NSBoxIPV6 } from './components/NSBoxIPV6';
|
|
7
|
-
import { NSBoxBoolean } from './components/NSBoxBoolean';
|
|
8
4
|
import { NSFilterBox } from './components/NSFilterBox';
|
|
5
|
+
import { FilterItemColumnType } from 'namirasoft-core';
|
|
9
6
|
|
|
10
7
|
const actions = [
|
|
11
8
|
{
|
|
@@ -63,70 +60,118 @@ const actions = [
|
|
|
63
60
|
}
|
|
64
61
|
]
|
|
65
62
|
|
|
66
|
-
export function App()
|
|
67
|
-
{
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
let columns = {
|
|
71
|
-
"id": "ID",
|
|
72
|
-
"project": "Project",
|
|
73
|
-
"level": "Level",
|
|
74
|
-
"message": "Message",
|
|
75
|
-
"cent": "Cent",
|
|
76
|
-
"status": "Status",
|
|
77
|
-
}
|
|
78
|
-
let rows = [{
|
|
79
|
-
id: 1,
|
|
80
|
-
project: "Namirasoft Account",
|
|
81
|
-
level: "Debug",
|
|
82
|
-
message: "Lorem ipsum dolor sit amet, consetetur ",
|
|
83
|
-
cent: "26",
|
|
84
|
-
status: "pending"
|
|
85
|
-
},
|
|
64
|
+
const suggest_items = [
|
|
86
65
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
]
|
|
93
90
|
},
|
|
94
91
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
+
]
|
|
116
|
+
},
|
|
113
117
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
+
},
|
|
117
143
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
+
{
|
|
174
|
+
|
|
130
175
|
return (
|
|
131
176
|
<>
|
|
132
177
|
<NSLayoutAction
|
|
@@ -137,36 +182,9 @@ export function App()
|
|
|
137
182
|
scope='Namirasoft Account Console'
|
|
138
183
|
logo='https://static.namirasoft.com/image/namirasoft/site/logo/base.png'
|
|
139
184
|
>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
columns={columns}
|
|
144
|
-
rows={rows}
|
|
145
|
-
getCell={getCell}
|
|
146
|
-
getColumnAttributes={() => { return {} }}
|
|
147
|
-
getRowKey={row => row.id.toString()}
|
|
148
|
-
onChanged={onChange}
|
|
149
|
-
pageSize={10}
|
|
150
|
-
totalItems={100}
|
|
151
|
-
getRows={getRows}
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
<NSBoxIPV6
|
|
155
|
-
title='IPV6'
|
|
156
|
-
required={false}
|
|
157
|
-
/>
|
|
158
|
-
|
|
159
|
-
<NSBoxIPV4
|
|
160
|
-
title='IPV4'
|
|
161
|
-
required={false}
|
|
162
|
-
/>
|
|
163
|
-
<NSBoxBoolean
|
|
164
|
-
title='I4'
|
|
165
|
-
required={false}
|
|
166
|
-
name='salam '
|
|
167
|
-
/>
|
|
168
|
-
<NSTabPage tabs={tabs} />
|
|
169
|
-
<NSFilterBox />
|
|
185
|
+
<NSFilterBox
|
|
186
|
+
tables={suggest_items}
|
|
187
|
+
placeholder='placeholder' />
|
|
170
188
|
</NSLayoutAction>
|
|
171
189
|
</>
|
|
172
190
|
);
|
|
@@ -1,20 +1,127 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { Component } from 'react';
|
|
4
|
-
import { NSFilterBoxDialog } from './NSFilterBoxDialog';
|
|
3
|
+
import React, { Component } from 'react';
|
|
5
4
|
import Styles from './NSFilterBox.module.css'
|
|
6
|
-
|
|
7
|
-
{
|
|
5
|
+
import { IBaseComponentProps } from '../main';
|
|
6
|
+
import { NSFilterItem } from './NSFilterItem';
|
|
7
|
+
import { FilterItem, FilterItemColumnType, FilterItemOperator } from 'namirasoft-core'
|
|
8
|
+
import NSGroupedList from './NSGroupedList';
|
|
8
9
|
|
|
10
|
+
interface INSFilterBoxProps extends IBaseComponentProps
|
|
11
|
+
{
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
onChanged?: () => void;
|
|
14
|
+
tables: {
|
|
15
|
+
name: string,
|
|
16
|
+
text: string
|
|
17
|
+
columns: {
|
|
18
|
+
name: string,
|
|
19
|
+
text: string,
|
|
20
|
+
type: FilterItemColumnType
|
|
21
|
+
}[];
|
|
22
|
+
}[];
|
|
9
23
|
}
|
|
10
24
|
|
|
11
25
|
interface INSFilterBoxState
|
|
12
26
|
{
|
|
27
|
+
filterItems: FilterItem[];
|
|
28
|
+
showSuggestList: boolean;
|
|
29
|
+
searchValue: string;
|
|
30
|
+
groupListState: GroupListState;
|
|
31
|
+
selectedColumns: {
|
|
32
|
+
name: string,
|
|
33
|
+
text: string
|
|
34
|
+
columns: {
|
|
35
|
+
name: string,
|
|
36
|
+
text: string,
|
|
37
|
+
type: FilterItemColumnType
|
|
38
|
+
}[];
|
|
39
|
+
}[];
|
|
40
|
+
selectedOperators: {
|
|
41
|
+
name: string;
|
|
42
|
+
operator: FilterItemOperator
|
|
43
|
+
};
|
|
44
|
+
selectedValues: [];
|
|
45
|
+
}
|
|
13
46
|
|
|
47
|
+
enum GroupListState
|
|
48
|
+
{
|
|
49
|
+
Normal = 'Normal',
|
|
50
|
+
Column = 'Column',
|
|
51
|
+
Opertor = 'Opertor',
|
|
52
|
+
Value = 'Value'
|
|
14
53
|
}
|
|
15
54
|
|
|
16
55
|
export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
|
|
17
56
|
{
|
|
57
|
+
constructor(props: INSFilterBoxProps)
|
|
58
|
+
{
|
|
59
|
+
super(props);
|
|
60
|
+
this.state = {
|
|
61
|
+
filterItems: [],
|
|
62
|
+
groupListState: GroupListState.Normal,
|
|
63
|
+
showSuggestList: false,
|
|
64
|
+
searchValue: "",
|
|
65
|
+
selectedColumns: [],
|
|
66
|
+
selectedOperators: {
|
|
67
|
+
name: "",
|
|
68
|
+
operator: FilterItemOperator.all.Empty
|
|
69
|
+
},
|
|
70
|
+
selectedValues: []
|
|
71
|
+
}
|
|
72
|
+
this.selectColumn = this.selectColumn.bind(this);
|
|
73
|
+
this.removeSelected = this.removeSelected.bind(this);
|
|
74
|
+
this.onChanged = this.onChanged.bind(this);
|
|
75
|
+
this.getValue = this.getValue.bind(this);
|
|
76
|
+
this.setValue = this.setValue.bind(this);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getValue(): string
|
|
80
|
+
{
|
|
81
|
+
return this.state.searchValue;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setValue(value: string): void
|
|
85
|
+
{
|
|
86
|
+
if (value !== "")
|
|
87
|
+
this.setState({
|
|
88
|
+
showSuggestList: true,
|
|
89
|
+
groupListState: GroupListState.Column,
|
|
90
|
+
searchValue: value
|
|
91
|
+
})
|
|
92
|
+
else
|
|
93
|
+
this.setState({
|
|
94
|
+
showSuggestList: false
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
selectColumn(groupe: string, item: string): void
|
|
100
|
+
{
|
|
101
|
+
console.log(item);
|
|
102
|
+
let columns = this.props.tables.filter((table) => table.name === groupe)
|
|
103
|
+
this.setState({
|
|
104
|
+
selectedColumns: columns,
|
|
105
|
+
groupListState: GroupListState.Opertor
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
removeSelected(text: string): void
|
|
110
|
+
{
|
|
111
|
+
let selectedArray = [...this.state.filterItems];
|
|
112
|
+
selectedArray = selectedArray.filter(item => item.column !== text)
|
|
113
|
+
this.setState({
|
|
114
|
+
filterItems: selectedArray
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private onChanged = async (e: React.ChangeEvent<HTMLInputElement>): Promise<void> =>
|
|
119
|
+
{
|
|
120
|
+
await this.setValue(e.target.value);
|
|
121
|
+
if (this.props.onChanged)
|
|
122
|
+
this.props.onChanged();
|
|
123
|
+
}
|
|
124
|
+
|
|
18
125
|
override render()
|
|
19
126
|
{
|
|
20
127
|
return (
|
|
@@ -31,28 +138,105 @@ export class NSFilterBox extends Component<INSFilterBoxProps, INSFilterBoxState>
|
|
|
31
138
|
</figure>
|
|
32
139
|
<input
|
|
33
140
|
// id={this.props.id}
|
|
34
|
-
|
|
35
|
-
|
|
141
|
+
value={this.state.searchValue}
|
|
142
|
+
onChange={(e) => this.onChanged(e)}
|
|
36
143
|
type="text"
|
|
37
144
|
className={Styles.ns_input}
|
|
38
|
-
placeholder={
|
|
145
|
+
placeholder={this.props.placeholder}
|
|
39
146
|
/>
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
147
|
+
{this.state.showSuggestList &&
|
|
148
|
+
<figure className={Styles.ns_input_close_icon}
|
|
149
|
+
onClick={() => this.setState({
|
|
150
|
+
showSuggestList: false,
|
|
151
|
+
searchValue: ""
|
|
152
|
+
})}
|
|
153
|
+
>
|
|
154
|
+
<img
|
|
155
|
+
src="https://static.namirasoft.com/image/concept/close/blue.svg"
|
|
156
|
+
alt="input-icon"
|
|
157
|
+
width={24}
|
|
158
|
+
height={24}
|
|
159
|
+
/>
|
|
160
|
+
</figure>
|
|
161
|
+
}
|
|
48
162
|
</div>
|
|
49
|
-
|
|
163
|
+
{
|
|
164
|
+
this.state.groupListState == GroupListState.Column &&
|
|
165
|
+
<NSGroupedList
|
|
166
|
+
onClick={this.selectColumn}
|
|
167
|
+
groups={this.props.tables.map((table) =>
|
|
168
|
+
{
|
|
169
|
+
return {
|
|
170
|
+
name: table.name,
|
|
171
|
+
text: table.text,
|
|
172
|
+
items: table.columns.map((column) =>
|
|
173
|
+
{
|
|
174
|
+
return {
|
|
175
|
+
name: column.name,
|
|
176
|
+
text: column.text,
|
|
177
|
+
type: column.type
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
})}
|
|
182
|
+
/>
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
{
|
|
186
|
+
this.state.groupListState == GroupListState.Opertor &&
|
|
187
|
+
<NSGroupedList
|
|
188
|
+
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
|
+
})
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
onClick={() =>
|
|
208
|
+
{
|
|
209
|
+
this.setState({
|
|
210
|
+
groupListState: GroupListState.Value,
|
|
211
|
+
selectedOperators: {...this.state.selectedColumns[0], operator: this.state.selectedOperators.operator }
|
|
212
|
+
})
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
{/* {
|
|
218
|
+
this.state.groupListState == GroupListState.Value &&
|
|
219
|
+
<NSGroupedList
|
|
220
|
+
onClick={() =>
|
|
221
|
+
{
|
|
222
|
+
let filterItems = new FilterItem("", false, this.state.selectedOperators.operator, this.state.selectedOperators.name)
|
|
223
|
+
}}
|
|
224
|
+
/>
|
|
225
|
+
} */}
|
|
50
226
|
|
|
51
|
-
<ul>
|
|
52
227
|
|
|
53
|
-
</
|
|
54
|
-
<
|
|
55
|
-
|
|
228
|
+
</div>
|
|
229
|
+
<div className={Styles.ns_selected_list_parent}>
|
|
230
|
+
{this.state.filterItems.map((item, index) =>
|
|
231
|
+
<NSFilterItem
|
|
232
|
+
item={item}
|
|
233
|
+
key={index}
|
|
234
|
+
removeSelected={() => this.removeSelected(item.column)}
|
|
235
|
+
/>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
</div>
|
|
239
|
+
|
|
56
240
|
</>
|
|
57
241
|
);
|
|
58
242
|
}
|
|
@@ -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
|
+
}
|