@visns-studio/visns-components 1.2.2 → 1.2.3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
function TableFilter(props) {
|
|
4
|
-
const { filters, setFilters, setSettings } = props;
|
|
4
|
+
const { filters, setFilters, setSettings, type } = props;
|
|
5
5
|
|
|
6
6
|
const filterTable = (e) => {
|
|
7
7
|
const { id, value, url } = e.target.dataset;
|
|
@@ -101,22 +101,48 @@ function TableFilter(props) {
|
|
|
101
101
|
setFilters((prevState) => [...prevState]);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
const renderContent = (d) => {
|
|
105
|
+
switch (type) {
|
|
106
|
+
case "simple":
|
|
107
|
+
return (
|
|
108
|
+
<li className={d.class}>
|
|
109
|
+
<button
|
|
110
|
+
data-id={d.id}
|
|
111
|
+
data-value={
|
|
112
|
+
d.hasOwnProperty("value") ? d.value : ""
|
|
113
|
+
}
|
|
114
|
+
data-url={d.url || ""}
|
|
115
|
+
onClick={filterTable}
|
|
116
|
+
>
|
|
117
|
+
{d.label}
|
|
118
|
+
</button>
|
|
119
|
+
</li>
|
|
120
|
+
);
|
|
121
|
+
default:
|
|
122
|
+
return (
|
|
123
|
+
<li>
|
|
124
|
+
<a
|
|
125
|
+
data-id={d.id}
|
|
126
|
+
data-value={
|
|
127
|
+
d.hasOwnProperty("value") ? d.value : ""
|
|
128
|
+
}
|
|
129
|
+
data-url={d.url || ""}
|
|
130
|
+
onClick={filterTable}
|
|
131
|
+
className={d.class}
|
|
132
|
+
>
|
|
133
|
+
{d.label}
|
|
134
|
+
</a>
|
|
135
|
+
</li>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
104
140
|
return (
|
|
105
141
|
<ul>
|
|
106
142
|
{filters.map((item, key) => (
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
data-value={
|
|
111
|
-
item.hasOwnProperty("value") ? item.value : ""
|
|
112
|
-
}
|
|
113
|
-
data-url={item.url || ""}
|
|
114
|
-
onClick={filterTable}
|
|
115
|
-
className={item.class}
|
|
116
|
-
>
|
|
117
|
-
{item.label}
|
|
118
|
-
</a>
|
|
119
|
-
</li>
|
|
143
|
+
<React.Fragment key={"table-filter-" + key}>
|
|
144
|
+
{renderContent(item)}
|
|
145
|
+
</React.Fragment>
|
|
120
146
|
))}
|
|
121
147
|
</ul>
|
|
122
148
|
);
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"react-dom": ">=18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"name": "@visns-studio/visns-components",
|
|
36
|
-
"version": "1.2.
|
|
36
|
+
"version": "1.2.3",
|
|
37
37
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
38
38
|
"main": "index.js",
|
|
39
39
|
"devDependencies": {},
|