@kaspernj/api-maker 1.0.233 → 1.0.234
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
|
@@ -75,10 +75,11 @@ class ReflectionElement extends React.PureComponent {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export default class
|
|
78
|
+
export default class ApiMakerTableFiltersFilterForm extends React.PureComponent {
|
|
79
79
|
static propTypes = PropTypesExact({
|
|
80
80
|
filter: PropTypes.object,
|
|
81
81
|
modelClass: PropTypes.func.isRequired,
|
|
82
|
+
onApplyClicked: PropTypes.func.isRequired,
|
|
82
83
|
querySearchName: PropTypes.string.isRequired
|
|
83
84
|
})
|
|
84
85
|
|
|
@@ -269,6 +270,8 @@ export default class ApiMakerTableFiltersRelationshipSelect extends React.PureCo
|
|
|
269
270
|
newParams[querySearchName] = searchParams
|
|
270
271
|
|
|
271
272
|
Params.changeParams(newParams)
|
|
273
|
+
|
|
274
|
+
this.props.onApplyClicked()
|
|
272
275
|
}
|
|
273
276
|
|
|
274
277
|
reflectionsWithModelClass(reflections) {
|
|
@@ -10,6 +10,7 @@ class ApiMakerTableFilter extends React.PureComponent {
|
|
|
10
10
|
a: PropTypes.string.isRequired,
|
|
11
11
|
filterIndex: PropTypes.number.isRequired,
|
|
12
12
|
onClick: PropTypes.func.isRequired,
|
|
13
|
+
onRemoveClicked: PropTypes.func.isRequired,
|
|
13
14
|
p: PropTypes.array.isRequired,
|
|
14
15
|
pre: PropTypes.string.isRequired,
|
|
15
16
|
v: PropTypes.string.isRequired
|
|
@@ -19,8 +20,18 @@ class ApiMakerTableFilter extends React.PureComponent {
|
|
|
19
20
|
const {a, p, pre, v} = digs(this.props, "a", "p", "pre", "v")
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
|
-
<div
|
|
23
|
-
{
|
|
23
|
+
<div style={{display: "inline-block", backgroundColor: "grey", padding: "10px 6px"}}>
|
|
24
|
+
<span className="filter-label" onClick={digg(this, "onFilterClicked")} style={{cursor: "pointer"}}>
|
|
25
|
+
{p.length > 0 &&
|
|
26
|
+
`${p.join(".")}.`
|
|
27
|
+
}
|
|
28
|
+
{a} {pre} {v}
|
|
29
|
+
</span>
|
|
30
|
+
<span>
|
|
31
|
+
<a className="remove-filter-button" href="#" onClick={digg(this, "onRemoveFilterClicked")}>
|
|
32
|
+
<i className="fa fa-remove la la-remove" />
|
|
33
|
+
</a>
|
|
34
|
+
</span>
|
|
24
35
|
</div>
|
|
25
36
|
)
|
|
26
37
|
}
|
|
@@ -32,6 +43,14 @@ class ApiMakerTableFilter extends React.PureComponent {
|
|
|
32
43
|
|
|
33
44
|
this.props.onClick({a, filterIndex, p, pre, v})
|
|
34
45
|
}
|
|
46
|
+
|
|
47
|
+
onRemoveFilterClicked = (e) => {
|
|
48
|
+
e.preventDefault()
|
|
49
|
+
|
|
50
|
+
const {filterIndex} = digs(this.props, "filterIndex")
|
|
51
|
+
|
|
52
|
+
this.props.onRemoveClicked({filterIndex})
|
|
53
|
+
}
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
class ApiMakerTableFilters extends React.PureComponent {
|
|
@@ -60,11 +79,18 @@ class ApiMakerTableFilters extends React.PureComponent {
|
|
|
60
79
|
filter={filter}
|
|
61
80
|
key={`filter-${filter.filterIndex}`}
|
|
62
81
|
modelClass={modelClass}
|
|
82
|
+
onApplyClicked={digg(this, "onApplyClicked")}
|
|
63
83
|
querySearchName={this.querySearchName()}
|
|
64
84
|
/>
|
|
65
85
|
}
|
|
66
86
|
{currentFilters?.map((filterData, filterIndex) =>
|
|
67
|
-
<ApiMakerTableFilter
|
|
87
|
+
<ApiMakerTableFilter
|
|
88
|
+
key={filterIndex}
|
|
89
|
+
filterIndex={filterIndex}
|
|
90
|
+
onClick={digg(this, "onFilterClicked")}
|
|
91
|
+
onRemoveClicked={digg(this, "onRemoveClicked")}
|
|
92
|
+
{...JSON.parse(filterData)}
|
|
93
|
+
/>
|
|
68
94
|
)}
|
|
69
95
|
</div>
|
|
70
96
|
)
|
|
@@ -89,6 +115,24 @@ class ApiMakerTableFilters extends React.PureComponent {
|
|
|
89
115
|
})
|
|
90
116
|
}
|
|
91
117
|
|
|
118
|
+
onApplyClicked = () => this.shape.set({filter: undefined})
|
|
119
|
+
|
|
120
|
+
onRemoveClicked = ({filterIndex}) => {
|
|
121
|
+
const searchParams = Params.parse()[this.querySearchName()] || {}
|
|
122
|
+
|
|
123
|
+
delete searchParams[filterIndex]
|
|
124
|
+
|
|
125
|
+
const newParams = {}
|
|
126
|
+
|
|
127
|
+
newParams[this.querySearchName()] = searchParams
|
|
128
|
+
|
|
129
|
+
Params.changeParams(newParams)
|
|
130
|
+
|
|
131
|
+
this.shape.set({
|
|
132
|
+
filter: undefined
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
92
136
|
onFilterClicked = (args) => this.shape.set({filter: args})
|
|
93
137
|
querySearchName = () => `${this.props.queryName}_s`
|
|
94
138
|
}
|