@solidstarters/solid-core-ui 1.1.1 → 1.1.2
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/components/core/common/FilterComponent.d.ts +2 -2
- package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
- package/dist/components/core/common/FilterComponent.js +6 -7
- package/dist/components/core/common/FilterComponent.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts +2 -1
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +150 -9
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.js +1 -1
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidSelectionStaticField.js +1 -2
- package/dist/components/core/filter/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidShortTextField.js +0 -1
- package/dist/components/core/filter/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/kanban/KanbanBoard.d.ts.map +1 -1
- package/dist/components/core/kanban/KanbanBoard.js +2 -0
- package/dist/components/core/kanban/KanbanBoard.js.map +1 -1
- package/dist/components/core/kanban/KanbanColumn.d.ts +2 -0
- package/dist/components/core/kanban/KanbanColumn.d.ts.map +1 -1
- package/dist/components/core/kanban/KanbanColumn.js +4 -3
- package/dist/components/core/kanban/KanbanColumn.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +131 -46
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +93 -302
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/components/core/common/FilterComponent.tsx +6 -7
- package/src/components/core/common/SolidGlobalSearchElement.tsx +143 -10
- package/src/components/core/filter/fields/SolidSelectionDynamicField.tsx +1 -1
- package/src/components/core/filter/fields/SolidSelectionStaticField.tsx +1 -2
- package/src/components/core/filter/fields/SolidShortTextField.tsx +0 -1
- package/src/components/core/kanban/KanbanBoard.tsx +3 -1
- package/src/components/core/kanban/KanbanColumn.tsx +15 -9
- package/src/components/core/kanban/SolidKanbanView.tsx +124 -31
- package/src/components/core/list/SolidListView.tsx +70 -332
- package/dist/components/common/FilterComponent.d.ts +0 -3
- package/dist/components/common/FilterComponent.d.ts.map +0 -1
- package/dist/components/common/FilterComponent.js +0 -214
- package/dist/components/common/FilterComponent.js.map +0 -1
- package/dist/components/core/filter/columns/SolidBigintField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidBigintField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidBigintField.js +0 -8
- package/dist/components/core/filter/columns/SolidBigintField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidBooleanField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidBooleanField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidBooleanField.js +0 -27
- package/dist/components/core/filter/columns/SolidBooleanField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidComputedField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidComputedField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidComputedField.js +0 -22
- package/dist/components/core/filter/columns/SolidComputedField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidDateField.d.ts +0 -9
- package/dist/components/core/filter/columns/SolidDateField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidDateField.js +0 -35
- package/dist/components/core/filter/columns/SolidDateField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidDatetimeField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidDatetimeField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidDatetimeField.js +0 -24
- package/dist/components/core/filter/columns/SolidDatetimeField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidDecimalField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidDecimalField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidDecimalField.js +0 -8
- package/dist/components/core/filter/columns/SolidDecimalField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidExternalIdField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidExternalIdField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidExternalIdField.js +0 -25
- package/dist/components/core/filter/columns/SolidExternalIdField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidFloatField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidFloatField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidFloatField.js +0 -8
- package/dist/components/core/filter/columns/SolidFloatField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidIdField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidIdField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidIdField.js +0 -25
- package/dist/components/core/filter/columns/SolidIdField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidIntField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidIntField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidIntField.js +0 -34
- package/dist/components/core/filter/columns/SolidIntField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidLongTextField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidLongTextField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidLongTextField.js +0 -8
- package/dist/components/core/filter/columns/SolidLongTextField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidMediaMultipleField.js +0 -35
- package/dist/components/core/filter/columns/SolidMediaMultipleField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidMediaSingleField.js +0 -35
- package/dist/components/core/filter/columns/SolidMediaSingleField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidRelationField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidRelationField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidRelationField.js +0 -12
- package/dist/components/core/filter/columns/SolidRelationField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidRichTextField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidRichTextField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidRichTextField.js +0 -8
- package/dist/components/core/filter/columns/SolidRichTextField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidSelectionDynamicField.js +0 -25
- package/dist/components/core/filter/columns/SolidSelectionDynamicField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidSelectionStaticField.js +0 -26
- package/dist/components/core/filter/columns/SolidSelectionStaticField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidShortTextField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidShortTextField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidShortTextField.js +0 -33
- package/dist/components/core/filter/columns/SolidShortTextField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidTimeField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidTimeField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidTimeField.js +0 -24
- package/dist/components/core/filter/columns/SolidTimeField.js.map +0 -1
- package/dist/components/core/filter/columns/SolidUuidField.d.ts +0 -4
- package/dist/components/core/filter/columns/SolidUuidField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/SolidUuidField.js +0 -25
- package/dist/components/core/filter/columns/SolidUuidField.js.map +0 -1
- package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts +0 -4
- package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts.map +0 -1
- package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js +0 -54
- package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -195,7 +195,7 @@ export { CancelButton, SolidCancelButton } from './components/common/CancelButto
|
|
|
195
195
|
export { CreateButton } from './components/common/CreateButton';
|
|
196
196
|
export { DropzonePlaceholder } from './components/common/DropzonePlaceholder';
|
|
197
197
|
export { DropzoneUpload } from './components/common/DropzoneUpload';
|
|
198
|
-
// export * from '
|
|
198
|
+
// export * from '@/components/common/FilterComponent';
|
|
199
199
|
export { HeaderDynamicTitles } from './components/common/HeaderDynamicTitles';
|
|
200
200
|
// export * from './components/common/MarkdownViewer';
|
|
201
201
|
export { MultipleSelectAutoCompleteField } from './components/common/MultipleSelectAutoCompleteField';
|
|
@@ -429,7 +429,7 @@ export { default as AuthBanner } from './components/common/AuthBanner';
|
|
|
429
429
|
//CodeEditor.tsx
|
|
430
430
|
export { default as CodeEditor } from './components/common/CodeEditor';
|
|
431
431
|
//FilterComponent.tsx
|
|
432
|
-
// export { default as FilterComponent } from '
|
|
432
|
+
// export { default as FilterComponent } from '@/components/common/FilterComponent';
|
|
433
433
|
//MarkdownViewer.tsx
|
|
434
434
|
export { default as MarkdownViewer } from './components/common/MarkdownViewer';
|
|
435
435
|
//SolidFormView.tsx
|
package/package.json
CHANGED
|
@@ -88,7 +88,6 @@ const FilterRuleComponent = ({ viewData, fields, rule, onChange, onAddRule, onAd
|
|
|
88
88
|
// const applicableInputField = rule.fieldName ? fields.find(f => f.name === rule.fieldName)?.type : "";
|
|
89
89
|
const [fieldName, setFieldName] = useState({ name: rule.fieldName });
|
|
90
90
|
const [matchMode, setMatchMode] = useState({ name: rule.matchMode });
|
|
91
|
-
console.log("level", level);
|
|
92
91
|
|
|
93
92
|
return (
|
|
94
93
|
// <div style={{ marginLeft: (level - 1) * 10 + 'px' }} className="filter-rule">
|
|
@@ -303,7 +302,7 @@ const FilterGroupComponent = ({ viewData, fields, group, onChange, onAddRule, on
|
|
|
303
302
|
};
|
|
304
303
|
|
|
305
304
|
// Main Filter component
|
|
306
|
-
const FilterComponent = ({ viewData, fields, filterRules, setFilterRules,
|
|
305
|
+
const FilterComponent = ({ viewData, fields, filterRules, setFilterRules, transformFilterRules }) => {
|
|
307
306
|
// const initialState: FilterRule[] = [
|
|
308
307
|
// {
|
|
309
308
|
// id: 1,
|
|
@@ -420,10 +419,10 @@ const FilterComponent = ({ viewData, fields, filterRules, setFilterRules, handle
|
|
|
420
419
|
setFilterRules(prev => deleteRecursively(prev, id));
|
|
421
420
|
};
|
|
422
421
|
|
|
423
|
-
const handlePrintState = () => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
};
|
|
422
|
+
// const handlePrintState = () => {
|
|
423
|
+
// // setPrintedState(JSON.stringify(filterRules, null, 2)); // Pretty format the state
|
|
424
|
+
// transformFilterRules(filterRules)
|
|
425
|
+
// };
|
|
427
426
|
|
|
428
427
|
|
|
429
428
|
|
|
@@ -449,7 +448,7 @@ const FilterComponent = ({ viewData, fields, filterRules, setFilterRules, handle
|
|
|
449
448
|
</div>
|
|
450
449
|
|
|
451
450
|
<div className='text-center'>
|
|
452
|
-
<Button label="Apply" size="small" onClick={
|
|
451
|
+
<Button label="Apply" size="small" onClick={() => transformFilterRules(filterRules)} type="submit" className="small-button" />
|
|
453
452
|
|
|
454
453
|
<br></br>
|
|
455
454
|
<textarea value={printedState} readOnly rows={20} cols={100} style={{ marginTop: '20px' }} />
|
|
@@ -1,20 +1,153 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
1
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
2
2
|
import { Dialog } from "primereact/dialog";
|
|
3
3
|
import { TabPanel, TabView } from "primereact/tabview";
|
|
4
4
|
import { SolidSearchBox } from "./SolidSearchBox";
|
|
5
|
-
import FilterComponent from "@/components/core/common/FilterComponent";
|
|
5
|
+
import FilterComponent, { FilterOperator, FilterRule, FilterRuleType } from "@/components/core/common/FilterComponent";
|
|
6
6
|
import { Button } from "primereact/button";
|
|
7
7
|
import { InputText } from "primereact/inputtext";
|
|
8
8
|
import { OverlayPanel } from "primereact/overlaypanel";
|
|
9
9
|
import { Divider } from "primereact/divider";
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
export const SolidGlobalSearchElement = ({ viewData, applyFilter, showGlobalSearchElement, setShowGlobalSearchElement,customFilter, setCustomFilter,handleApplyCustomFilter }: any) => {
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const getRandomInt = (min: number, max: number) => {
|
|
14
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const transformRulesToFilters = (input: any) => {
|
|
18
|
+
|
|
19
|
+
// Helper function to process individual rules
|
|
20
|
+
const processRule = (rule: any) => {
|
|
21
|
+
if (rule.value && rule.value.length > 0) {
|
|
22
|
+
|
|
23
|
+
// Ensure rule.value is always an array
|
|
24
|
+
let values = typeof rule.value[0] === "object" ? rule.value.map((i: any) => i.value) : rule.value;
|
|
25
|
+
if (rule.matchMode !== '$in' && rule.matchMode !== '$notIn' && rule.matchMode !== '$between') {
|
|
26
|
+
values = values[0];
|
|
27
|
+
}
|
|
28
|
+
// Rule transformation
|
|
29
|
+
let transformedRule = {
|
|
30
|
+
[rule.fieldName]: {
|
|
31
|
+
[rule.matchMode]: values // Assuming `value` is always an array with `value` and `label`
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// If the rule has children (which means it's a rule group), process them
|
|
36
|
+
let processedFields;
|
|
37
|
+
if (rule.children && rule.children.length > 0) {
|
|
38
|
+
processedFields = rule.children.map((child: any) => processRuleGroup(child));
|
|
39
|
+
}
|
|
40
|
+
if (processedFields) {
|
|
41
|
+
return { ...transformedRule, processedFields }
|
|
42
|
+
}
|
|
43
|
+
return { ...transformedRule }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Helper function to process rule groups
|
|
49
|
+
const processRuleGroup = (ruleGroup: any) => {
|
|
50
|
+
const operator = ruleGroup.matchOperator === 'or' ? '$or' : '$and';
|
|
51
|
+
const children = ruleGroup.children.map((child: any) => {
|
|
52
|
+
if (child.type === 'rule') {
|
|
53
|
+
// Process the rule
|
|
54
|
+
return processRule(child);
|
|
55
|
+
} else if (child.type === 'rule_group') {
|
|
56
|
+
// Process the rule group recursively
|
|
57
|
+
return processRuleGroup(child);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
[operator]: children
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Start processing the root rule group
|
|
67
|
+
const filterObject = processRuleGroup(input);
|
|
68
|
+
|
|
69
|
+
function liftProcessedFields(filters: any) {
|
|
70
|
+
if (!filters || typeof filters !== 'object') return filters;
|
|
71
|
+
|
|
72
|
+
const processArray = (arr: any) => {
|
|
73
|
+
let newArr = [];
|
|
74
|
+
for (let obj of arr) {
|
|
75
|
+
if (obj && obj.processedFields) {
|
|
76
|
+
let processed: any = processArray(obj.processedFields); // Recursively process nested processedFields
|
|
77
|
+
delete obj.processedFields;
|
|
78
|
+
newArr.push(obj, ...processed);
|
|
79
|
+
} else {
|
|
80
|
+
newArr.push(obj);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (let key in obj) {
|
|
84
|
+
if (Array.isArray(obj[key])) {
|
|
85
|
+
obj[key] = processArray(obj[key]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return newArr;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (let key in filters) {
|
|
93
|
+
if (Array.isArray(filters[key])) {
|
|
94
|
+
filters[key] = processArray(filters[key]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return filters;
|
|
17
99
|
}
|
|
100
|
+
return liftProcessedFields(filterObject)
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCustomFilter }: any, ref) => {
|
|
105
|
+
|
|
106
|
+
const initialState: FilterRule[] = [
|
|
107
|
+
{
|
|
108
|
+
id: 1,
|
|
109
|
+
type: FilterRuleType.RULE_GROUP,
|
|
110
|
+
matchOperator: FilterOperator.OR,
|
|
111
|
+
parentRule: null,
|
|
112
|
+
children: [
|
|
113
|
+
{
|
|
114
|
+
id: Date.now() + getRandomInt(1, 500),
|
|
115
|
+
type: FilterRuleType.RULE,
|
|
116
|
+
fieldName: null,
|
|
117
|
+
matchMode: null,
|
|
118
|
+
value: null,
|
|
119
|
+
parentRule: 1,
|
|
120
|
+
children: []
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: Date.now() + getRandomInt(1, 500),
|
|
124
|
+
type: FilterRuleType.RULE,
|
|
125
|
+
fieldName: null,
|
|
126
|
+
matchMode: null,
|
|
127
|
+
value: null,
|
|
128
|
+
parentRule: 1,
|
|
129
|
+
children: []
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
const [filterRules, setFilterRules] = useState<FilterRule[]>(initialState);
|
|
135
|
+
const [showGlobalSearchElement, setShowGlobalSearchElement] = useState<boolean>(false);
|
|
136
|
+
const transformFilterRules = (filterRules: any) => {
|
|
137
|
+
const transformedFilter = transformRulesToFilters(filterRules[0]);
|
|
138
|
+
if (transformedFilter) {
|
|
139
|
+
handleApplyCustomFilter(transformedFilter)
|
|
140
|
+
}
|
|
141
|
+
setShowGlobalSearchElement(false)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
useImperativeHandle(ref, () => ({
|
|
145
|
+
clearFilter: () => {
|
|
146
|
+
setFilterRules(initialState);
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
|
|
18
151
|
|
|
19
152
|
const [fields, setFields] = useState<any[]>([]);
|
|
20
153
|
|
|
@@ -44,12 +177,12 @@ export const SolidGlobalSearchElement = ({ viewData, applyFilter, showGlobalSear
|
|
|
44
177
|
/>
|
|
45
178
|
</div>
|
|
46
179
|
<OverlayPanel ref={op} className="solid-custom-overlay" style={{ minWidth: 378 }}>
|
|
47
|
-
|
|
180
|
+
<div className="px-4 py-3">
|
|
48
181
|
<p className="m-0">Searching...</p>
|
|
49
182
|
</div>
|
|
50
183
|
<Divider className="m-0" />
|
|
51
184
|
<div className="px-2 py-1">
|
|
52
|
-
<Button text size="small" label="Custom Filter" iconPos="left" icon='pi pi-plus'
|
|
185
|
+
<Button text size="small" label="Custom Filter" iconPos="left" icon='pi pi-plus' onClick={() => setShowGlobalSearchElement(true)} />
|
|
53
186
|
</div>
|
|
54
187
|
</OverlayPanel>
|
|
55
188
|
<Dialog header={false} className="search-filter-popup" showHeader={false} visible={showGlobalSearchElement} style={{ width: '50vw' }} onHide={() => { if (!showGlobalSearchElement) return; setShowGlobalSearchElement(false); }}>
|
|
@@ -69,7 +202,7 @@ export const SolidGlobalSearchElement = ({ viewData, applyFilter, showGlobalSear
|
|
|
69
202
|
</TabPanel>
|
|
70
203
|
<TabPanel header="Filter" >
|
|
71
204
|
{fields.length > 0 &&
|
|
72
|
-
<FilterComponent viewData={viewData} fields={fields} filterRules={
|
|
205
|
+
<FilterComponent viewData={viewData} fields={fields} filterRules={filterRules} setFilterRules={setFilterRules} transformFilterRules={transformFilterRules} ></FilterComponent>
|
|
73
206
|
}
|
|
74
207
|
{/* <SolidKanbanFilter solidKanbanViewMetaData={solidKanbanViewMetaData} handleApplyFilter={handleApplyFilter} filterValues={filterValues} setFilterValues={setFilterValues}></SolidKanbanFilter> */}
|
|
75
208
|
</TabPanel>
|
|
@@ -79,4 +212,4 @@ export const SolidGlobalSearchElement = ({ viewData, applyFilter, showGlobalSear
|
|
|
79
212
|
</div>
|
|
80
213
|
)
|
|
81
214
|
|
|
82
|
-
}
|
|
215
|
+
});
|
|
@@ -29,7 +29,7 @@ const SolidSelectionDynamicField = ({ fieldMetadata, onChange, index, rule }: So
|
|
|
29
29
|
values={rule.value}
|
|
30
30
|
onChange={(e: any) => {
|
|
31
31
|
console.log("e", e);
|
|
32
|
-
onChange(rule.id, 'value', e
|
|
32
|
+
onChange(rule.id, 'value', e)
|
|
33
33
|
}}
|
|
34
34
|
numberOfInputs={numberOfInputs}
|
|
35
35
|
inputType={InputTypes.SelectionDynamic}
|
|
@@ -31,8 +31,7 @@ const SolidSelectionStaticField = ({ fieldMetadata, onChange, index, rule }: Sol
|
|
|
31
31
|
<SolidVarInputsFilterElement
|
|
32
32
|
values={rule.value}
|
|
33
33
|
onChange={(e: any) => {
|
|
34
|
-
|
|
35
|
-
onChange(rule.id, 'value', e.value)
|
|
34
|
+
onChange(rule.id, 'value', e)
|
|
36
35
|
}}
|
|
37
36
|
numberOfInputs={numberOfInputs}
|
|
38
37
|
inputType={InputTypes.SelectionStatic}
|
|
@@ -24,7 +24,7 @@ interface ApiResponse {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export const KanbanBoard = ({ kanbanViewData, solidViewMetaData, setKanbanViewData, handleLoadMore, onDragEnd,handleSwimLinPagination }: any) => {
|
|
27
|
+
export const KanbanBoard = ({ kanbanViewData, solidViewMetaData, setKanbanViewData, handleLoadMore, onDragEnd, handleSwimLinPagination }: any) => {
|
|
28
28
|
const [loading, setLoading] = useState<boolean>(true);
|
|
29
29
|
// State to manage the folded status of each column
|
|
30
30
|
const [foldedStates, setFoldedStates] = useState<Record<string, boolean>>({});
|
|
@@ -94,6 +94,8 @@ export const KanbanBoard = ({ kanbanViewData, solidViewMetaData, setKanbanViewDa
|
|
|
94
94
|
const group = {
|
|
95
95
|
label: data.groupName,
|
|
96
96
|
count: data.groupData.meta.totalRecords,
|
|
97
|
+
limit: data.groupData.meta.perPage,
|
|
98
|
+
currentPage: data.groupData.meta.currentPage,
|
|
97
99
|
folded: foldedStates[data.groupName] || false,
|
|
98
100
|
};
|
|
99
101
|
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
import React, { useRef } from "react";
|
|
5
6
|
import { Droppable, DroppableProvided } from "@hello-pangea/dnd";
|
|
6
|
-
import {
|
|
7
|
-
import { useRef } from "react";
|
|
7
|
+
import { Button } from "primereact/button";
|
|
8
8
|
import KanbanCard from "./KanbanCard";
|
|
9
|
+
import { OverlayPanel } from "primereact/overlaypanel";
|
|
9
10
|
|
|
10
11
|
// Define types for props
|
|
11
12
|
interface Group {
|
|
12
13
|
label: string;
|
|
13
14
|
count: number;
|
|
14
15
|
folded: boolean;
|
|
16
|
+
limit: number;
|
|
17
|
+
currentPage: number;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
interface GroupData {
|
|
@@ -28,9 +31,10 @@ interface KanbanColumnProps {
|
|
|
28
31
|
handleLoadMore: (groupByField: string) => void;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
const KanbanColumn = ({ groupByField, solidViewMetaData,group, groupData, toggleFold, handleLoadMore }: KanbanColumnProps) => {
|
|
34
|
+
const KanbanColumn = ({ groupByField, solidViewMetaData, group, groupData, toggleFold, handleLoadMore }: KanbanColumnProps) => {
|
|
32
35
|
const op = useRef<any>(null);
|
|
33
36
|
|
|
37
|
+
|
|
34
38
|
return (
|
|
35
39
|
<div className={group.folded ? "kanban-column kanban-column-folded" : "kanban-column"}>
|
|
36
40
|
<div className="kaban-heading-area">
|
|
@@ -107,12 +111,14 @@ const KanbanColumn = ({ groupByField, solidViewMetaData,group, groupData, toggle
|
|
|
107
111
|
<KanbanCard key={data.id} data={data} solidViewMetaData={solidViewMetaData} index={index} />
|
|
108
112
|
))}
|
|
109
113
|
{provided.placeholder}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
{group.count > 0 &&
|
|
115
|
+
<a
|
|
116
|
+
className="load-more-button"
|
|
117
|
+
onClick={() => handleLoadMore(groupByField)}
|
|
118
|
+
>
|
|
119
|
+
Load more data... ({group.count - (group.limit * group.currentPage)} remaining)
|
|
120
|
+
</a>
|
|
121
|
+
}
|
|
116
122
|
</div>
|
|
117
123
|
)}
|
|
118
124
|
</Droppable>
|
|
@@ -7,13 +7,11 @@ import { DropResult } from "@hello-pangea/dnd";
|
|
|
7
7
|
import Link from "next/link";
|
|
8
8
|
import { FilterMatchMode } from "primereact/api";
|
|
9
9
|
import { Button } from "primereact/button";
|
|
10
|
-
import {
|
|
11
|
-
DataTableFilterMeta
|
|
12
|
-
} from "primereact/datatable";
|
|
13
10
|
import { Dialog } from "primereact/dialog";
|
|
14
11
|
import qs from "qs";
|
|
15
|
-
import { useEffect, useState } from "react";
|
|
12
|
+
import { useEffect, useRef, useState } from "react";
|
|
16
13
|
import { SolidCreateButton } from "../common/SolidCreateButton";
|
|
14
|
+
import { SolidGlobalSearchElement } from "../common/SolidGlobalSearchElement";
|
|
17
15
|
import KanbanBoard from "./KanbanBoard";
|
|
18
16
|
|
|
19
17
|
type SolidKanbanViewParams = {
|
|
@@ -22,12 +20,15 @@ type SolidKanbanViewParams = {
|
|
|
22
20
|
embeded: boolean;
|
|
23
21
|
};
|
|
24
22
|
|
|
23
|
+
|
|
25
24
|
export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
25
|
+
const solidGlobalSearchElementRef = useRef();
|
|
26
26
|
|
|
27
27
|
// TODO: The initial filter state will be created based on the fields which are present on this kanban view.
|
|
28
|
-
const [filters, setFilters] = useState<
|
|
28
|
+
const [filters, setFilters] = useState<any>();
|
|
29
29
|
const [toPopulate, setToPopulate] = useState<string[]>([]);
|
|
30
30
|
const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
|
|
31
|
+
const [showGlobalSearchElement, setShowGlobalSearchElement] = useState<boolean>(false);
|
|
31
32
|
|
|
32
33
|
const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
|
|
33
34
|
useEffect(() => {
|
|
@@ -52,9 +53,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
52
53
|
fetchPermissions();
|
|
53
54
|
}, [params.modelName]);
|
|
54
55
|
|
|
55
|
-
const isFilterApplied =
|
|
56
|
-
(filter: any) => filter?.value && filter.value.length > 0
|
|
57
|
-
);
|
|
56
|
+
const isFilterApplied = filters ? true : false;
|
|
58
57
|
|
|
59
58
|
// Create the RTK slices for this entity
|
|
60
59
|
const entityApi = createSolidEntityApi(params.modelName);
|
|
@@ -137,8 +136,8 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
137
136
|
toPopulate.push(fieldMetadata.name);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
|
-
setFilters(initialFilters);
|
|
141
|
-
setRows(kanbanViewMetaData?.data?.solidView?.layout?.attrs?.
|
|
139
|
+
// setFilters(initialFilters);
|
|
140
|
+
setRows(kanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsCount ? kanbanViewMetaData?.data?.solidView?.layout?.attrs.recordsCount : 25)
|
|
142
141
|
setToPopulate(toPopulate);
|
|
143
142
|
}
|
|
144
143
|
|
|
@@ -167,9 +166,6 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
167
166
|
const [columnsCount, setColumnsCount] = useState(5);
|
|
168
167
|
const [swimLaneCurrentPageNumber, setSwimLaneCurrentPageNumber] = useState(1);
|
|
169
168
|
|
|
170
|
-
console.log("kanbanViewData", kanbanViewData);
|
|
171
|
-
|
|
172
|
-
|
|
173
169
|
// Get the kanban view data.
|
|
174
170
|
// const [triggerGetSolidEntitiesForKanban, { data: solidEntityKanbanViewData, isLoading, error }] = useLazyGetSolidKanbanEntitiesQuery();
|
|
175
171
|
const [triggerGetSolidEntities, { data: solidEntityKanbanViewData, isLoading, error }] = useLazyGetSolidEntitiesQuery();
|
|
@@ -178,9 +174,9 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
178
174
|
// After data is fetched populate the kanban view state so as to be able to render the data.
|
|
179
175
|
useEffect(() => {
|
|
180
176
|
if (solidEntityKanbanViewData) {
|
|
181
|
-
|
|
182
|
-
setKanbanViewData(
|
|
183
|
-
const loadmoredata = Object.entries(
|
|
177
|
+
const latestKanbanGroupData = [...kanbanViewData, ...solidEntityKanbanViewData?.groupRecords]
|
|
178
|
+
setKanbanViewData(latestKanbanGroupData);
|
|
179
|
+
const loadmoredata = Object.entries(latestKanbanGroupData).reduce((acc: any, [key, value]: any) => {
|
|
184
180
|
acc[value.groupName] = {
|
|
185
181
|
offset: (value.groupData.meta.currentPage - 1) * value.groupData.meta.perPage,
|
|
186
182
|
limit: value.groupData.meta.perPage,
|
|
@@ -191,7 +187,6 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
191
187
|
|
|
192
188
|
setKanbanLoadMoreData(loadmoredata)
|
|
193
189
|
setLoading(false);
|
|
194
|
-
|
|
195
190
|
}
|
|
196
191
|
}, [solidEntityKanbanViewData]);
|
|
197
192
|
|
|
@@ -230,18 +225,19 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
230
225
|
if (solidKanbanViewMetaData) {
|
|
231
226
|
const groupByFieldName = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.groupBy;
|
|
232
227
|
const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.pageSize || 5;
|
|
233
|
-
|
|
228
|
+
|
|
234
229
|
if (toPopulate) {
|
|
235
230
|
const queryData = {
|
|
236
231
|
offset: 0,
|
|
237
|
-
limit:
|
|
232
|
+
limit: columnsToLoadCount,
|
|
238
233
|
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
239
234
|
groupBy: groupByFieldName,
|
|
240
235
|
populate: toPopulate,
|
|
241
236
|
populateGroup: true,
|
|
242
237
|
groupFilter: {
|
|
243
|
-
limit:
|
|
244
|
-
offset: 0
|
|
238
|
+
limit: kanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsCount,
|
|
239
|
+
offset: 0,
|
|
240
|
+
filters:filters
|
|
245
241
|
}
|
|
246
242
|
// sort: [`id:desc`],
|
|
247
243
|
};
|
|
@@ -261,13 +257,51 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
261
257
|
|
|
262
258
|
|
|
263
259
|
// clear Filter
|
|
264
|
-
|
|
260
|
+
|
|
261
|
+
const clearFilter = async() => {
|
|
265
262
|
if (solidKanbanViewMetaData) {
|
|
266
|
-
initialFilterMethod()
|
|
263
|
+
// initialFilterMethod()
|
|
264
|
+
}
|
|
265
|
+
setFilters(null);
|
|
266
|
+
if (solidKanbanViewMetaData) {
|
|
267
|
+
const groupByFieldName = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.groupBy;
|
|
268
|
+
const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.pageSize || 5;
|
|
269
|
+
|
|
270
|
+
if (toPopulate) {
|
|
271
|
+
const queryData = {
|
|
272
|
+
offset: 0,
|
|
273
|
+
limit: columnsToLoadCount,
|
|
274
|
+
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
275
|
+
groupBy: groupByFieldName,
|
|
276
|
+
populate: toPopulate,
|
|
277
|
+
populateGroup: true,
|
|
278
|
+
groupFilter: {
|
|
279
|
+
limit: rows,
|
|
280
|
+
offset: 0,
|
|
281
|
+
}
|
|
282
|
+
// sort: [`id:desc`],
|
|
283
|
+
};
|
|
284
|
+
// fields=status&groupBy=status&fields=count(status)&populateGroup=true
|
|
285
|
+
const queryString = qs.stringify(queryData, {
|
|
286
|
+
encodeValuesOnly: true
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const data: any = await triggerGetSolidEntities(queryString);
|
|
290
|
+
if (data && data?.data?.groupRecords.length > 0) {
|
|
291
|
+
const updatedData = [...data.data.groupRecords];
|
|
292
|
+
setKanbanViewData(updatedData);
|
|
293
|
+
}
|
|
294
|
+
setSelectedRecords([]);
|
|
295
|
+
}
|
|
267
296
|
}
|
|
297
|
+
|
|
298
|
+
// @ts-ignore
|
|
299
|
+
solidGlobalSearchElementRef.current.clearFilter()
|
|
268
300
|
};
|
|
269
301
|
|
|
270
302
|
|
|
303
|
+
|
|
304
|
+
|
|
271
305
|
// clickable link allowing one to open the detail / form view.
|
|
272
306
|
const detailsBodyTemplate = (solidViewData: any) => {
|
|
273
307
|
return (
|
|
@@ -316,7 +350,8 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
316
350
|
filters: {
|
|
317
351
|
[groupByFieldName]: {
|
|
318
352
|
$in: [status],
|
|
319
|
-
}
|
|
353
|
+
},
|
|
354
|
+
...filters
|
|
320
355
|
}
|
|
321
356
|
}
|
|
322
357
|
|
|
@@ -434,15 +469,16 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
434
469
|
const groupByFieldName = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.groupBy;
|
|
435
470
|
const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.pageSize || 5;
|
|
436
471
|
const queryData = {
|
|
437
|
-
offset: swimLaneCurrentPageNumber *
|
|
438
|
-
limit:
|
|
472
|
+
offset: swimLaneCurrentPageNumber * columnsToLoadCount,
|
|
473
|
+
limit: columnsToLoadCount,
|
|
439
474
|
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
440
475
|
groupBy: groupByFieldName,
|
|
441
476
|
populate: toPopulate,
|
|
442
477
|
populateGroup: true,
|
|
443
478
|
groupFilter: {
|
|
444
479
|
limit: rows,
|
|
445
|
-
offset: 0
|
|
480
|
+
offset: 0,
|
|
481
|
+
filters: filters
|
|
446
482
|
}
|
|
447
483
|
// sort: [`id:desc`],
|
|
448
484
|
};
|
|
@@ -452,7 +488,6 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
452
488
|
});
|
|
453
489
|
|
|
454
490
|
const data: any = await triggerGetSolidEntities(queryString);
|
|
455
|
-
console.log("data", data);
|
|
456
491
|
if (data && data?.data?.groupRecords.length > 0) {
|
|
457
492
|
const updatedData = [...kanbanViewData, ...data.data.groupRecords];
|
|
458
493
|
setKanbanViewData(updatedData);
|
|
@@ -461,6 +496,62 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
461
496
|
}
|
|
462
497
|
}
|
|
463
498
|
|
|
499
|
+
const handleApplyCustomFilter = async (filters: any) => {
|
|
500
|
+
|
|
501
|
+
const groupByFieldName = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.groupBy;
|
|
502
|
+
const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.pageSize || 5;
|
|
503
|
+
setFilters(filters)
|
|
504
|
+
|
|
505
|
+
if (toPopulate) {
|
|
506
|
+
const queryData = {
|
|
507
|
+
offset: 0,
|
|
508
|
+
limit: columnsToLoadCount,
|
|
509
|
+
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
510
|
+
groupBy: groupByFieldName,
|
|
511
|
+
populate: toPopulate,
|
|
512
|
+
populateGroup: true,
|
|
513
|
+
groupFilter: {
|
|
514
|
+
limit: rows,
|
|
515
|
+
offset: 0,
|
|
516
|
+
filters: filters
|
|
517
|
+
}
|
|
518
|
+
// sort: [`id:desc`],
|
|
519
|
+
};
|
|
520
|
+
// fields=status&groupBy=status&fields=count(status)&populateGroup=true
|
|
521
|
+
const queryString = qs.stringify(queryData, {
|
|
522
|
+
encodeValuesOnly: true
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// triggerGetSolidEntities(queryString);
|
|
526
|
+
const data: any = await triggerGetSolidEntities(queryString);
|
|
527
|
+
if (data && data?.data?.groupRecords.length > 0) {
|
|
528
|
+
const updatedData = [...data.data.groupRecords];
|
|
529
|
+
setKanbanViewData(updatedData);
|
|
530
|
+
}
|
|
531
|
+
setSelectedRecords([]);
|
|
532
|
+
}
|
|
533
|
+
// if (toPopulate) {
|
|
534
|
+
// const queryData = {
|
|
535
|
+
// offset: 0,
|
|
536
|
+
// limit: 25,
|
|
537
|
+
// populate: toPopulate,
|
|
538
|
+
// sort: [`id:desc`],
|
|
539
|
+
// filters: { ...transformedFilter.filters }
|
|
540
|
+
// };
|
|
541
|
+
// if (params.embeded) {
|
|
542
|
+
|
|
543
|
+
// }
|
|
544
|
+
// const queryString = qs.stringify(queryData, {
|
|
545
|
+
// encodeValuesOnly: true
|
|
546
|
+
// });
|
|
547
|
+
|
|
548
|
+
// triggerGetSolidEntities(queryString);
|
|
549
|
+
// // setShowGlobalSearchElement(false)
|
|
550
|
+
// setSelectedRecords([]);
|
|
551
|
+
// }
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
|
|
464
555
|
|
|
465
556
|
return (
|
|
466
557
|
<>
|
|
@@ -491,9 +582,11 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
491
582
|
/>
|
|
492
583
|
}
|
|
493
584
|
|
|
494
|
-
{
|
|
495
|
-
// <SolidGlobalSearchElement
|
|
496
|
-
|
|
585
|
+
{solidKanbanViewMetaData?.data?.solidView?.layout?.attrs.enableGlobalSearch === true &&
|
|
586
|
+
// <SolidGlobalSearchElement viewData={solidKanbanViewMetaData} handleApplyCustomFilter={handleApplyCustomFilter} ></SolidGlobalSearchElement>
|
|
587
|
+
<SolidGlobalSearchElement ref={solidGlobalSearchElementRef} viewData={solidKanbanViewMetaData} handleApplyCustomFilter={handleApplyCustomFilter} ></SolidGlobalSearchElement>
|
|
588
|
+
|
|
589
|
+
}
|
|
497
590
|
</div>
|
|
498
591
|
|
|
499
592
|
{/* <SolidConfigureLayoutElement></SolidConfigureLayoutElement> */}
|