@visns-studio/visns-components 5.7.6 → 5.7.8
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 +2 -2
- package/src/components/crm/TableFilter.jsx +57 -17
- package/src/components/crm/generic/ActionButtons.jsx +22 -0
- package/src/components/crm/generic/GenericIndex.jsx +2 -0
- package/src/components/crm/generic/GenericQuote.jsx +278 -152
- package/src/components/crm/generic/styles/ActionButtons.module.scss +65 -0
- package/src/components/crm/generic/styles/GenericQuote.module.scss +425 -130
- package/src/components/crm/generic/utils/formatters.js +43 -0
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"reactjs-popup": "^2.0.6",
|
|
55
55
|
"style-loader": "^4.0.0",
|
|
56
56
|
"swapy": "^1.0.5",
|
|
57
|
-
"sweetalert2": "^11.
|
|
57
|
+
"sweetalert2": "^11.20.0",
|
|
58
58
|
"truncate": "^3.0.0",
|
|
59
59
|
"uuid": "^11.1.0",
|
|
60
60
|
"validator": "^13.15.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
83
83
|
},
|
|
84
84
|
"name": "@visns-studio/visns-components",
|
|
85
|
-
"version": "5.7.
|
|
85
|
+
"version": "5.7.8",
|
|
86
86
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
87
87
|
"main": "src/index.js",
|
|
88
88
|
"files": [
|
|
@@ -5,6 +5,7 @@ function TableFilter({
|
|
|
5
5
|
filters,
|
|
6
6
|
setFilters,
|
|
7
7
|
setSettings,
|
|
8
|
+
settings,
|
|
8
9
|
type,
|
|
9
10
|
onFilterChange,
|
|
10
11
|
}) {
|
|
@@ -165,15 +166,36 @@ function TableFilter({
|
|
|
165
166
|
}
|
|
166
167
|
// For non-parent filters (backward compatibility)
|
|
167
168
|
else {
|
|
169
|
+
const updatedChildren = isParent
|
|
170
|
+
? filter.children.map((child) => ({
|
|
171
|
+
...child,
|
|
172
|
+
class: child.id === id ? 'subactivechildren' : '',
|
|
173
|
+
show: child.id === id,
|
|
174
|
+
active: child.id === id,
|
|
175
|
+
}))
|
|
176
|
+
: filter.children
|
|
177
|
+
? filter.children.map((child, childKey) => ({
|
|
178
|
+
...child,
|
|
179
|
+
class:
|
|
180
|
+
childKey === 0 && isActive
|
|
181
|
+
? 'subactivechildren'
|
|
182
|
+
: '',
|
|
183
|
+
show: childKey === 0 && isActive,
|
|
184
|
+
active: childKey === 0 && isActive,
|
|
185
|
+
}))
|
|
186
|
+
: [];
|
|
187
|
+
|
|
168
188
|
return {
|
|
169
189
|
...filter,
|
|
170
|
-
class:
|
|
171
|
-
|
|
172
|
-
? '
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
190
|
+
class:
|
|
191
|
+
isActive || isParent
|
|
192
|
+
? type === 'simple'
|
|
193
|
+
? 'activetab'
|
|
194
|
+
: 'subactive'
|
|
195
|
+
: '',
|
|
196
|
+
show: isActive || isParent,
|
|
197
|
+
active: isActive || isParent,
|
|
198
|
+
children: updatedChildren,
|
|
177
199
|
};
|
|
178
200
|
}
|
|
179
201
|
};
|
|
@@ -199,27 +221,36 @@ function TableFilter({
|
|
|
199
221
|
let updatedSettings = null;
|
|
200
222
|
|
|
201
223
|
if (setSettings) {
|
|
202
|
-
// For child items
|
|
224
|
+
// For child items, non-parent items, or parent items with a value property
|
|
225
|
+
// we need to update the filter value
|
|
203
226
|
if (
|
|
204
227
|
filtertype === 'children' ||
|
|
205
228
|
(filtertype === 'parent' &&
|
|
206
|
-
!filters.find((f) => f.id === id && f.isParent)
|
|
229
|
+
(!filters.find((f) => f.id === id && f.isParent) ||
|
|
230
|
+
filters.find(
|
|
231
|
+
(f) => f.id === id && f.hasOwnProperty('value')
|
|
232
|
+
)))
|
|
207
233
|
) {
|
|
208
|
-
// For
|
|
234
|
+
// For filters, we need to update the filter with the ID and value
|
|
209
235
|
const filterId = id;
|
|
210
236
|
const filterValue = value || '';
|
|
211
237
|
|
|
212
238
|
// Start with the current settings
|
|
213
|
-
|
|
239
|
+
// Check if _currentValue exists (React state setter) or use the object directly
|
|
240
|
+
updatedSettings = setSettings._currentValue
|
|
241
|
+
? { ...setSettings._currentValue }
|
|
242
|
+
: { ...setSettings };
|
|
214
243
|
|
|
215
244
|
if (updatedSettings.ajaxSetting) {
|
|
216
245
|
// First, remove any existing filters that might conflict
|
|
217
|
-
let _where =
|
|
218
|
-
(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
let _where = updatedSettings.ajaxSetting.where
|
|
247
|
+
? [...updatedSettings.ajaxSetting.where].filter(
|
|
248
|
+
(item) => {
|
|
249
|
+
// Keep items that don't match this filter ID
|
|
250
|
+
return item.id !== filterId;
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
: [];
|
|
223
254
|
|
|
224
255
|
// Add the new filter
|
|
225
256
|
_where.push({ id: filterId, value: filterValue });
|
|
@@ -244,6 +275,15 @@ function TableFilter({
|
|
|
244
275
|
w.push({ id: filterId, value: filterValue });
|
|
245
276
|
|
|
246
277
|
updatedSettings = { ...updatedSettings, where: w };
|
|
278
|
+
} else {
|
|
279
|
+
// If neither ajaxSetting.where nor where exists, create a new ajaxSetting
|
|
280
|
+
updatedSettings = {
|
|
281
|
+
...settings,
|
|
282
|
+
ajaxSetting: {
|
|
283
|
+
...(settings.ajaxSetting || {}),
|
|
284
|
+
where: [{ id: filterId, value: filterValue }],
|
|
285
|
+
},
|
|
286
|
+
};
|
|
247
287
|
}
|
|
248
288
|
}
|
|
249
289
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './styles/ActionButtons.module.scss';
|
|
3
|
+
|
|
4
|
+
function ActionButtons({ actions, onActionClick }) {
|
|
5
|
+
return (
|
|
6
|
+
<div className={styles.actionButtons}>
|
|
7
|
+
{actions &&
|
|
8
|
+
actions.map((action) => (
|
|
9
|
+
<button
|
|
10
|
+
key={`action-${action.id}`}
|
|
11
|
+
className={styles.actionButton}
|
|
12
|
+
onClick={() => onActionClick(action.id)}
|
|
13
|
+
title={action.label}
|
|
14
|
+
>
|
|
15
|
+
{action.label}
|
|
16
|
+
</button>
|
|
17
|
+
))}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default ActionButtons;
|
|
@@ -576,6 +576,7 @@ function GenericIndex({
|
|
|
576
576
|
filters={subnav}
|
|
577
577
|
setFilters={setSubnav}
|
|
578
578
|
setSettings={setConfig}
|
|
579
|
+
settings={config}
|
|
579
580
|
type={layout}
|
|
580
581
|
onFilterChange={handleFilterChange}
|
|
581
582
|
/>
|
|
@@ -598,6 +599,7 @@ function GenericIndex({
|
|
|
598
599
|
filters={subnav}
|
|
599
600
|
setFilters={setSubnav}
|
|
600
601
|
setSettings={setConfig}
|
|
602
|
+
settings={config}
|
|
601
603
|
type={layout}
|
|
602
604
|
onFilterChange={handleFilterChange}
|
|
603
605
|
/>
|