@solidxai/core-ui 0.1.3 → 0.1.4-beta.0
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/auth/SolidInitialLoginOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.js +0 -5
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.tsx +0 -5
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +7 -5
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidLogin.tsx +10 -8
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +48 -47
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +41 -10
- package/dist/components/core/common/FilterComponent.js.map +1 -1
- package/dist/components/core/common/FilterComponent.tsx +1 -1
- package/dist/components/core/common/GroupingComponent.d.ts +54 -0
- package/dist/components/core/common/GroupingComponent.d.ts.map +1 -0
- package/dist/components/core/common/GroupingComponent.js +196 -0
- package/dist/components/core/common/GroupingComponent.js.map +1 -0
- package/dist/components/core/common/GroupingComponent.tsx +452 -0
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts +18 -1
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +146 -47
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +191 -18
- package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.d.ts +19 -0
- package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.js +90 -0
- package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx +59 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +7 -3
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +45 -40
- package/dist/components/core/filter/SolidOneToManyFilterElement.d.ts +2 -0
- package/dist/components/core/filter/SolidOneToManyFilterElement.d.ts.map +1 -0
- package/dist/components/core/filter/SolidOneToManyFilterElement.js +86 -0
- package/dist/components/core/filter/SolidOneToManyFilterElement.js.map +1 -0
- package/dist/components/core/filter/SolidOneToManyFilterElement.tsx +62 -0
- package/dist/components/core/filter/SolidVarInputsFilterElement.d.ts +1 -0
- package/dist/components/core/filter/SolidVarInputsFilterElement.d.ts.map +1 -1
- package/dist/components/core/filter/SolidVarInputsFilterElement.js +4 -1
- package/dist/components/core/filter/SolidVarInputsFilterElement.js.map +1 -1
- package/dist/components/core/filter/SolidVarInputsFilterElement.tsx +10 -0
- package/dist/components/core/filter/fields/SolidRelationField.d.ts.map +1 -1
- package/dist/components/core/filter/fields/SolidRelationField.js +4 -2
- package/dist/components/core/filter/fields/SolidRelationField.js.map +1 -1
- package/dist/components/core/filter/fields/SolidRelationField.tsx +4 -2
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.d.ts +4 -0
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -0
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js +25 -0
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.js.map +1 -0
- package/dist/components/core/filter/fields/relations/SolidRelationOneToManyField.tsx +60 -0
- package/dist/components/core/form/SolidFormFooter.js +4 -4
- package/dist/components/core/form/SolidFormFooter.js.map +1 -1
- package/dist/components/core/form/SolidFormFooter.tsx +4 -4
- package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.js +11 -8
- package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.tsx +20 -8
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +26 -21
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +27 -17
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts +1 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js +51 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +51 -0
- package/dist/components/core/kanban/SolidKanbanView.js +5 -5
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +5 -5
- package/dist/components/core/list/SolidListView.d.ts +12 -7
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +138 -150
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +84 -91
- package/dist/components/core/list/listViewRegistry.js.map +1 -1
- package/dist/components/core/list/listViewRegistry.ts +1 -2
- package/dist/components/core/tree/SolidTreeView.d.ts +38 -0
- package/dist/components/core/tree/SolidTreeView.d.ts.map +1 -0
- package/dist/components/core/tree/SolidTreeView.js +1170 -0
- package/dist/components/core/tree/SolidTreeView.js.map +1 -0
- package/dist/components/core/tree/SolidTreeView.tsx +1603 -0
- package/dist/components/core/tree/treeViewRegistry.d.ts +7 -0
- package/dist/components/core/tree/treeViewRegistry.d.ts.map +1 -0
- package/dist/components/core/tree/treeViewRegistry.js +17 -0
- package/dist/components/core/tree/treeViewRegistry.js.map +1 -0
- package/dist/components/core/tree/treeViewRegistry.ts +23 -0
- package/dist/components/core/users/CreateUser.d.ts.map +1 -1
- package/dist/components/core/users/CreateUser.js +19 -6
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/components/core/users/CreateUser.tsx +39 -0
- package/dist/helpers/helpers.d.ts +2 -0
- package/dist/helpers/helpers.d.ts.map +1 -1
- package/dist/helpers/helpers.js +3 -1
- package/dist/helpers/helpers.js.map +1 -1
- package/dist/helpers/helpers.ts +4 -1
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +2 -0
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +6 -1
- package/dist/resources/globals.css +18 -4
- package/dist/routes/pages/admin/core/ListPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.js +1 -1
- package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.tsx +2 -1
- package/dist/routes/pages/admin/core/TreePage.d.ts +2 -0
- package/dist/routes/pages/admin/core/TreePage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/TreePage.js +37 -0
- package/dist/routes/pages/admin/core/TreePage.js.map +1 -0
- package/dist/routes/pages/admin/core/TreePage.tsx +30 -0
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +2 -0
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +3 -1
- package/dist/routes/types.d.ts +1 -1
- package/dist/routes/types.d.ts.map +1 -1
- package/dist/routes/types.js.map +1 -1
- package/dist/routes/types.ts +1 -0
- package/dist/types/index.d.ts +8 -2
- package/dist/types/solid-core.d.ts +40 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { Divider } from "primereact/divider";
|
|
|
6
6
|
import { usePathname } from "../../../hooks/usePathname";
|
|
7
7
|
import { useRouter } from "../../../hooks/useRouter";
|
|
8
8
|
import { useSearchParams } from "../../../hooks/useSearchParams";
|
|
9
|
-
import {
|
|
9
|
+
import { getFilterObjectFromLocalStorage } from "../list/SolidListView";
|
|
10
10
|
import { InputText } from "primereact/inputtext";
|
|
11
11
|
import { createSolidEntityApi } from "../../../redux/api/solidEntityApi";
|
|
12
12
|
import qs from "qs";
|
|
@@ -14,6 +14,8 @@ import { SolidSaveCustomFilterForm } from "./SolidSaveCustomFilterForm";
|
|
|
14
14
|
import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
15
15
|
import { hydrateRelationRules } from "../../../helpers/hydrateRelationRules";
|
|
16
16
|
import { useSession } from '../../../hooks/useSession'
|
|
17
|
+
import GroupingComponent, { AggregationRule, GroupingRule, DateGroupingFormat } from "./GroupingComponent";
|
|
18
|
+
|
|
17
19
|
|
|
18
20
|
const getRandomInt = (min: number, max: number) => {
|
|
19
21
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
@@ -25,6 +27,24 @@ interface PredefinedSearch {
|
|
|
25
27
|
filters: Record<string, any>;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
export type SearchableField = {
|
|
31
|
+
fieldName: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
searchField: string;
|
|
34
|
+
matchMode: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type GroupableField = {
|
|
38
|
+
fieldName: string;
|
|
39
|
+
displayName: string;
|
|
40
|
+
searchField: string;
|
|
41
|
+
matchMode: string;
|
|
42
|
+
type: string;
|
|
43
|
+
ormType: string;
|
|
44
|
+
relationType: string;
|
|
45
|
+
computedFieldValueType: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
28
48
|
const extractFields = (nodes: any[] = []): any[] => {
|
|
29
49
|
const result: any[] = [];
|
|
30
50
|
|
|
@@ -354,7 +374,7 @@ export const mergeSearchAndCustomFilters = (transformedFilter: any, newFilter: a
|
|
|
354
374
|
}
|
|
355
375
|
|
|
356
376
|
|
|
357
|
-
export const mergeAllDiffFilters = (customFilter: any, searchFilter: any, savedFilter: any, preDefinedFilter?: any) => {
|
|
377
|
+
export const mergeAllDiffFilters = (customFilter: any, searchFilter: any, savedFilter: any, preDefinedFilter?: any, groupingRules?: GroupingRule[], aggregationRules?: AggregationRule[]) => {
|
|
358
378
|
const filters: any = {};
|
|
359
379
|
|
|
360
380
|
// Add only non-null filters
|
|
@@ -370,6 +390,12 @@ export const mergeAllDiffFilters = (customFilter: any, searchFilter: any, savedF
|
|
|
370
390
|
if (preDefinedFilter && Object.keys(preDefinedFilter).length > 0) {
|
|
371
391
|
filters["predefined_search_predicate"] = preDefinedFilter;
|
|
372
392
|
}
|
|
393
|
+
if (groupingRules && Object.keys(groupingRules).length > 0) {
|
|
394
|
+
filters["grouping_rules"] = groupingRules;
|
|
395
|
+
}
|
|
396
|
+
if (aggregationRules && Object.keys(aggregationRules).length > 0) {
|
|
397
|
+
filters["aggregation_rules"] = aggregationRules;
|
|
398
|
+
}
|
|
373
399
|
// Return the combined filters object
|
|
374
400
|
return filters;
|
|
375
401
|
}
|
|
@@ -479,11 +505,13 @@ const extractChips = (node: any): any[] => {
|
|
|
479
505
|
return [];
|
|
480
506
|
};
|
|
481
507
|
|
|
508
|
+
|
|
509
|
+
|
|
482
510
|
type RelationCache = Map<string, { label: string; value: number }>;
|
|
483
511
|
|
|
484
512
|
|
|
485
513
|
|
|
486
|
-
export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCustomFilter, showSaveFilterPopup, setShowSaveFilterPopup, filterPredicates }: any, ref) => {
|
|
514
|
+
export const SolidGlobalSearchElement = forwardRef(({ viewData, viewType, handleApplyCustomFilter, showSaveFilterPopup, setShowSaveFilterPopup, filterPredicates }: any, ref) => {
|
|
487
515
|
const defaultState: FilterRule[] = [
|
|
488
516
|
{
|
|
489
517
|
id: 1,
|
|
@@ -512,6 +540,20 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
512
540
|
]
|
|
513
541
|
}
|
|
514
542
|
];
|
|
543
|
+
|
|
544
|
+
const defaultAggregationRules: AggregationRule[] = [
|
|
545
|
+
{
|
|
546
|
+
id: 1,
|
|
547
|
+
operator: "count",
|
|
548
|
+
fieldName: "id",
|
|
549
|
+
locked: true
|
|
550
|
+
}
|
|
551
|
+
];
|
|
552
|
+
|
|
553
|
+
const defaultGroupingRules: GroupingRule[] = [
|
|
554
|
+
{ id: 1, fieldName: null, dateGrouping: null }
|
|
555
|
+
];
|
|
556
|
+
|
|
515
557
|
const [initialState, setInitialState] = useState(defaultState);
|
|
516
558
|
const pathname = usePathname();
|
|
517
559
|
|
|
@@ -530,6 +572,10 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
530
572
|
|
|
531
573
|
const [fields, setFields] = useState<any[]>([]);
|
|
532
574
|
const [searchableFields, setSearchableFields] = useState<any[]>([]);
|
|
575
|
+
const [groupableFields, setGroupableFields] = useState<GroupableField[]>([]);
|
|
576
|
+
|
|
577
|
+
const [groupingRules, setGroupingRules] = useState<GroupingRule[]>(defaultGroupingRules);
|
|
578
|
+
const [aggregationRules, setAggregationRules] = useState<AggregationRule[]>(defaultAggregationRules);
|
|
533
579
|
|
|
534
580
|
// used to show the list of predefined searches
|
|
535
581
|
const [predefinedSearches, setPredefinedSearches] = useState<PredefinedSearch[]>([]);
|
|
@@ -537,6 +583,10 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
537
583
|
// used to open / close the custom fitler popup
|
|
538
584
|
const [showGlobalSearchElement, setShowGlobalSearchElement] = useState<boolean>(false);
|
|
539
585
|
|
|
586
|
+
// used to open / close the group fitler popup
|
|
587
|
+
const [showGroupFilterElement, setShowGroupFilterElement] = useState<boolean>(false);
|
|
588
|
+
|
|
589
|
+
|
|
540
590
|
// searchChips maintain the ui to display searched query
|
|
541
591
|
// searchFilter maintain the transformed filter of the searched query
|
|
542
592
|
const [searchChips, setSearchChips] = useState<{ columnName?: string; value: string }[]>([]);
|
|
@@ -670,7 +720,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
670
720
|
|
|
671
721
|
if (activeSavedFilter && savedFilters.length === 0) return;
|
|
672
722
|
|
|
673
|
-
const queryObject =
|
|
723
|
+
const queryObject = getFilterObjectFromLocalStorage();
|
|
674
724
|
// const savedQuery = parsedSearchParams?.get("savedQuery");
|
|
675
725
|
if (activeSavedFilter) {
|
|
676
726
|
const currentSavedFilterId = Number(activeSavedFilter);
|
|
@@ -717,6 +767,31 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
717
767
|
const hydratedRules = await hydrateRelationRules([rules], viewData);
|
|
718
768
|
setFilterRules(hydratedRules);
|
|
719
769
|
}
|
|
770
|
+
const hasGroupingRules = (queryObject?.grouping_rules?.some((rule: any) => rule.fieldName !== null));
|
|
771
|
+
|
|
772
|
+
if (hasGroupingRules) {
|
|
773
|
+
setGroupingRules(queryObject?.grouping_rules);
|
|
774
|
+
} else {
|
|
775
|
+
// If no grouping rules in localStorage check layout
|
|
776
|
+
const layoutGroupBy = viewData?.data?.solidView?.layout?.attrs?.groupBy;
|
|
777
|
+
|
|
778
|
+
if (Array.isArray(layoutGroupBy) && layoutGroupBy.length > 0) {
|
|
779
|
+
const initialGroupingRules: GroupingRule[] = layoutGroupBy.map((groupStr: string, index: number) => {
|
|
780
|
+
const [fieldName, dateGrouping] = groupStr.split(":");
|
|
781
|
+
return {
|
|
782
|
+
id: Date.now() + index,
|
|
783
|
+
fieldName: fieldName || null,
|
|
784
|
+
dateGrouping: (dateGrouping as DateGroupingFormat) || null
|
|
785
|
+
};
|
|
786
|
+
});
|
|
787
|
+
setGroupingRules(initialGroupingRules);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
if (queryObject?.aggregation_rules && queryObject?.aggregation_rules !== aggregationRules) {
|
|
792
|
+
setAggregationRules(queryObject?.aggregation_rules);
|
|
793
|
+
}
|
|
794
|
+
|
|
720
795
|
|
|
721
796
|
setRefreshKey((prev) => prev + 1)
|
|
722
797
|
setHasSearched(true);
|
|
@@ -791,6 +866,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
791
866
|
matchMode: viewFieldElement?.attrs?.searchMatchMode,
|
|
792
867
|
searchField: viewFieldElement?.attrs?.searchField ?? null,
|
|
793
868
|
isSearchable: viewFieldElement?.attrs?.isSearchable ?? false,
|
|
869
|
+
relationType: value?.relationType ?? null,
|
|
794
870
|
};
|
|
795
871
|
});
|
|
796
872
|
|
|
@@ -816,8 +892,30 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
816
892
|
}
|
|
817
893
|
});
|
|
818
894
|
|
|
819
|
-
|
|
820
|
-
|
|
895
|
+
const groupableFieldsList = fieldsList.filter((field: any) => {
|
|
896
|
+
switch (field.type) {
|
|
897
|
+
case "relation":
|
|
898
|
+
// Only include relation if searchField is present
|
|
899
|
+
if (field.relationType === "many-to-one")
|
|
900
|
+
return true;
|
|
901
|
+
return false;
|
|
902
|
+
case "longText":
|
|
903
|
+
case "shortText":
|
|
904
|
+
case "selectionStatic":
|
|
905
|
+
case "selectionDynamic":
|
|
906
|
+
case "int":
|
|
907
|
+
case "float":
|
|
908
|
+
case "boolean":
|
|
909
|
+
case "date":
|
|
910
|
+
case "datetime":
|
|
911
|
+
return true;
|
|
912
|
+
// case "selectionStatic":
|
|
913
|
+
case "computed":
|
|
914
|
+
return field.ormType === "varchar";
|
|
915
|
+
default:
|
|
916
|
+
return false;
|
|
917
|
+
}
|
|
918
|
+
});
|
|
821
919
|
|
|
822
920
|
// Optionally map to a minimal structure if needed for UI
|
|
823
921
|
let finalSearchableFieldsList: any = searchableFieldsList.map((field: any) => ({
|
|
@@ -827,10 +925,21 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
827
925
|
matchMode: field.matchMode
|
|
828
926
|
}));
|
|
829
927
|
|
|
830
|
-
// console.log("finalSearchableFieldsList", finalSearchableFieldsList);
|
|
831
|
-
|
|
832
928
|
setSearchableFields(finalSearchableFieldsList);
|
|
833
929
|
|
|
930
|
+
let finalGroupableFieldsList: any = groupableFieldsList.map((field: any) => ({
|
|
931
|
+
fieldName: field.value,
|
|
932
|
+
displayName: field.name,
|
|
933
|
+
searchField: field.searchField ?? "",
|
|
934
|
+
matchMode: field.matchMode,
|
|
935
|
+
type: field.type,
|
|
936
|
+
ormType: field.ormType,
|
|
937
|
+
relationType: field.relationType,
|
|
938
|
+
computedFieldValueType: field.computedFieldValueType
|
|
939
|
+
}));
|
|
940
|
+
|
|
941
|
+
setGroupableFields(finalGroupableFieldsList)
|
|
942
|
+
|
|
834
943
|
const predefinedSearchesList = viewData?.data?.solidView?.layout?.attrs?.predefinedSearches || [];
|
|
835
944
|
setPredefinedSearches(predefinedSearchesList);
|
|
836
945
|
}
|
|
@@ -922,10 +1031,16 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
922
1031
|
|
|
923
1032
|
}
|
|
924
1033
|
|
|
1034
|
+
const applyGrouping = (groupingRules: GroupingRule[], aggregationRules: AggregationRule[]) => {
|
|
1035
|
+
setHasSearched(true)
|
|
1036
|
+
setShowGroupFilterElement(false);
|
|
1037
|
+
setGroupingRules(groupingRules);
|
|
1038
|
+
setAggregationRules(aggregationRules);
|
|
1039
|
+
setRefreshKey((prev) => prev + 1)
|
|
1040
|
+
}
|
|
1041
|
+
|
|
925
1042
|
useEffect(() => {
|
|
926
1043
|
if (refreshKey > 0 && hasSearched) {
|
|
927
|
-
console.log("refres", refreshKey);
|
|
928
|
-
console.log("hasSearched", hasSearched);
|
|
929
1044
|
|
|
930
1045
|
const formattedChips = {
|
|
931
1046
|
$and: searchChips.map((chip: any) => ({
|
|
@@ -944,7 +1059,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
944
1059
|
const finalPredefinedFilter = predefinedSearchBaseFilter
|
|
945
1060
|
|
|
946
1061
|
const finalCustomFilter = customFilter
|
|
947
|
-
const finalFilter = mergeAllDiffFilters(finalCustomFilter, finalSearchFilter, finalSavedFilter, finalPredefinedFilter)
|
|
1062
|
+
const finalFilter = mergeAllDiffFilters(finalCustomFilter, finalSearchFilter, finalSavedFilter, finalPredefinedFilter, groupingRules, aggregationRules)
|
|
948
1063
|
handleApplyCustomFilter(finalFilter, true);
|
|
949
1064
|
setHasSearched(false)
|
|
950
1065
|
// }
|
|
@@ -1006,8 +1121,8 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1006
1121
|
} else {
|
|
1007
1122
|
console.error(ERROR_MESSAGES.SAVE_FILTER_UNDEFINED_NULL);
|
|
1008
1123
|
}
|
|
1009
|
-
|
|
1010
1124
|
}
|
|
1125
|
+
|
|
1011
1126
|
const deleteSavedFilter = async () => {
|
|
1012
1127
|
// delte the saved filter with id
|
|
1013
1128
|
await deleteEntity(savedFilterTobeDeleted);
|
|
@@ -1170,7 +1285,6 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1170
1285
|
}
|
|
1171
1286
|
}
|
|
1172
1287
|
|
|
1173
|
-
|
|
1174
1288
|
const SavedFiltersChip = () => {
|
|
1175
1289
|
|
|
1176
1290
|
return (
|
|
@@ -1212,6 +1326,40 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1212
1326
|
)
|
|
1213
1327
|
};
|
|
1214
1328
|
|
|
1329
|
+
const removeGrouping = () => {
|
|
1330
|
+
setGroupingRules(defaultGroupingRules);
|
|
1331
|
+
setAggregationRules(defaultAggregationRules);
|
|
1332
|
+
setHasSearched(true);
|
|
1333
|
+
setRefreshKey((prev) => prev + 1)
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
const GroupingChip = () => {
|
|
1337
|
+
return (
|
|
1338
|
+
<li className="solid-global-search-chip">
|
|
1339
|
+
<div className="flex align-items-center gap-2">
|
|
1340
|
+
<div className="flex align-items-center gap-2">
|
|
1341
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
1342
|
+
|
|
1343
|
+
onClick={() => setShowGroupFilterElement(true)}
|
|
1344
|
+
>
|
|
1345
|
+
<rect width="20" height="20" rx="4" fill="#722ED1" />
|
|
1346
|
+
<path d="M8.66667 15V13.3333H11.3333V15H8.66667ZM6 10.8333V9.16667H14V10.8333H6ZM4 6.66667V5H16V6.66667H4Z"
|
|
1347
|
+
fill="white" />
|
|
1348
|
+
</svg>
|
|
1349
|
+
<span><strong>{groupingRules.length}</strong> Grouping rules applied</span>
|
|
1350
|
+
</div>
|
|
1351
|
+
|
|
1352
|
+
{/* button to clear filter */}
|
|
1353
|
+
<a onClick={removeGrouping}
|
|
1354
|
+
style={{ cursor: "pointer" }}
|
|
1355
|
+
>
|
|
1356
|
+
<i className="pi pi-times ml-1">
|
|
1357
|
+
</i></a>
|
|
1358
|
+
</div>
|
|
1359
|
+
</li>
|
|
1360
|
+
)
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1215
1363
|
|
|
1216
1364
|
|
|
1217
1365
|
|
|
@@ -1312,7 +1460,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1312
1460
|
}
|
|
1313
1461
|
|
|
1314
1462
|
try {
|
|
1315
|
-
// Replace {{search}} placeholders with actual search value
|
|
1463
|
+
// Replace {{ search }} placeholders with actual search value
|
|
1316
1464
|
const processedFilter = replacePlaceholders(predefinedSearch.filters, inputValue.trim());
|
|
1317
1465
|
|
|
1318
1466
|
// Clear all existing filters and searches
|
|
@@ -1383,6 +1531,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1383
1531
|
{currentSavedFilterData && <SavedFiltersChip />}
|
|
1384
1532
|
{predefinedSearchChip && <PredefinedSearchChip />}
|
|
1385
1533
|
{customFilter && <CustomChip />}
|
|
1534
|
+
{groupingRules.length > 0 && groupingRules.some(r => r.fieldName !== null) && <GroupingChip />}
|
|
1386
1535
|
<SearchChip />
|
|
1387
1536
|
<li ref={chipsRef}>
|
|
1388
1537
|
<div className="relative solid-global-search-element-wrapper">
|
|
@@ -1509,8 +1658,11 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1509
1658
|
<Divider className="m-0" />
|
|
1510
1659
|
</>
|
|
1511
1660
|
}
|
|
1512
|
-
<div className="px-2 py-1">
|
|
1661
|
+
<div className="px-2 py-1 flex justify-content-between">
|
|
1513
1662
|
<Button text size="small" label="Custom Filter" iconPos="left" icon='pi pi-plus' onClick={() => setShowGlobalSearchElement(true)} className="font-bold" />
|
|
1663
|
+
{viewType === "tree" &&
|
|
1664
|
+
<Button text size="small" label="Grouping" iconPos="left" icon='pi pi-plus' onClick={() => setShowGroupFilterElement(true)} className="font-bold" />
|
|
1665
|
+
}
|
|
1514
1666
|
</div>
|
|
1515
1667
|
</div>
|
|
1516
1668
|
)
|
|
@@ -1521,19 +1673,40 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1521
1673
|
<Button icon="pi pi-times" rounded text aria-label="Cancel" type="reset" size="small" onClick={() => setShowGlobalSearchElement(false)} />
|
|
1522
1674
|
</div>
|
|
1523
1675
|
<Divider className="m-0" />
|
|
1524
|
-
<div className="p-
|
|
1676
|
+
<div className="p-2 lg:p-2">
|
|
1525
1677
|
{fields.length > 0 &&
|
|
1526
1678
|
<FilterComponent viewData={viewData} fields={fields} filterRules={filterRules} setFilterRules={setFilterRules} transformFilterRules={transformCustomFilterRules} closeDialog={() => setShowGlobalSearchElement(false)}></FilterComponent>
|
|
1527
1679
|
}
|
|
1528
1680
|
</div>
|
|
1529
1681
|
</Dialog>
|
|
1682
|
+
<Dialog header={false} className="solid-global-search-filter" showHeader={false} visible={showGroupFilterElement} style={{ width: '20vw' }} breakpoints={{ '1024px': '75vw', '991px': '90vw', '767px': '94w', '250px': '96vw' }} onHide={() => { if (!showGroupFilterElement) return; setShowGroupFilterElement(false); }}>
|
|
1683
|
+
<div className="flex align-items-center justify-content-between px-3">
|
|
1684
|
+
<h5 className="solid-custom-title m-0"></h5>
|
|
1685
|
+
<Button icon="pi pi-times" rounded text aria-label="Cancel" type="reset" size="small" onClick={() => setShowGroupFilterElement(false)} />
|
|
1686
|
+
</div>
|
|
1687
|
+
<Divider className="m-0" />
|
|
1688
|
+
<div className="p-2 lg:p-2">
|
|
1689
|
+
{groupableFields.length > 0 &&
|
|
1690
|
+
<GroupingComponent
|
|
1691
|
+
viewData={viewData}
|
|
1692
|
+
fields={groupableFields}
|
|
1693
|
+
groupingRules={groupingRules}
|
|
1694
|
+
setGroupingRules={setGroupingRules}
|
|
1695
|
+
aggregationRules={aggregationRules}
|
|
1696
|
+
setAggregationRules={setAggregationRules}
|
|
1697
|
+
applyGrouping={applyGrouping}
|
|
1698
|
+
closeDialog={() => setShowGroupFilterElement(false)}
|
|
1699
|
+
></GroupingComponent>
|
|
1700
|
+
}
|
|
1701
|
+
</div>
|
|
1702
|
+
</Dialog >
|
|
1530
1703
|
<Dialog header={false} className="solid-global-search-filter" showHeader={false} visible={showSavedFilterComponent} style={{ width: '65vw' }} breakpoints={{ '1024px': '75vw', '991px': '90vw', '767px': '94w', '250px': '96vw' }} onHide={() => { if (!showSavedFilterComponent) return; setShowSavedFilterComponent(false); }}>
|
|
1531
1704
|
<div className="flex align-items-center justify-content-between px-3">
|
|
1532
1705
|
<h5 className="solid-custom-title m-0">Saved Filter</h5>
|
|
1533
1706
|
<Button icon="pi pi-times" rounded text aria-label="Cancel" type="reset" size="small" onClick={() => setShowSavedFilterComponent(false)} />
|
|
1534
1707
|
</div>
|
|
1535
1708
|
<Divider className="m-0" />
|
|
1536
|
-
<div className="p-
|
|
1709
|
+
<div className="p-2 lg:p-2">
|
|
1537
1710
|
{fields.length > 0 &&
|
|
1538
1711
|
<FilterComponent viewData={viewData} fields={fields} filterRules={currentSavedFilterRules} setFilterRules={setCurrentSavedFilterRules} transformFilterRules={transformSavedFilterRules} closeDialog={() => setShowSavedFilterComponent(false)}></FilterComponent>
|
|
1539
1712
|
}
|
|
@@ -1558,7 +1731,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
|
|
|
1558
1731
|
>
|
|
1559
1732
|
<p>Are you sure you want to delete the {currentSavedFilterData?.name} saved query?</p>
|
|
1560
1733
|
</Dialog>
|
|
1561
|
-
</div>
|
|
1734
|
+
</div >
|
|
1562
1735
|
{/* <div>
|
|
1563
1736
|
<Button
|
|
1564
1737
|
icon="pi pi-save"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const hanldeModelSequenceFormViewChange: (event: any) => Promise<{
|
|
2
|
+
layoutChanged: boolean;
|
|
3
|
+
dataChanged: boolean;
|
|
4
|
+
newFormData: {
|
|
5
|
+
model: null;
|
|
6
|
+
field: null;
|
|
7
|
+
};
|
|
8
|
+
newLayout: import("../../../../..").LayoutNode;
|
|
9
|
+
} | {
|
|
10
|
+
layoutChanged: boolean;
|
|
11
|
+
dataChanged: boolean;
|
|
12
|
+
newFormData: {
|
|
13
|
+
field: null;
|
|
14
|
+
model?: undefined;
|
|
15
|
+
};
|
|
16
|
+
newLayout: import("../../../../..").LayoutNode;
|
|
17
|
+
} | undefined>;
|
|
18
|
+
export default hanldeModelSequenceFormViewChange;
|
|
19
|
+
//# sourceMappingURL=modelSequenceFormViewChangeHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelSequenceFormViewChangeHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,iCAAiC,UAAiB,GAAG;;;;;;;;;;;;;;;;cAuD1D,CAAA;AACD,eAAe,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { SolidViewLayoutManager } from "../../../../../components/core/common/SolidViewLayoutManager";
|
|
38
|
+
var hanldeModelSequenceFormViewChange = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var modifiedField, modifiedFieldValue, formViewLayout, layout, layoutManager, modelWhereClause, fieldWhereClauseOnModule, fieldWhereClauseOnModel;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
console.log("event", event);
|
|
42
|
+
modifiedField = event.modifiedField, modifiedFieldValue = event.modifiedFieldValue, formViewLayout = event.formViewLayout;
|
|
43
|
+
layout = formViewLayout;
|
|
44
|
+
layoutManager = new SolidViewLayoutManager(layout);
|
|
45
|
+
if (modifiedField === 'module') {
|
|
46
|
+
modelWhereClause = {
|
|
47
|
+
module: {
|
|
48
|
+
id: { $eq: modifiedFieldValue.id }
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
fieldWhereClauseOnModule = {
|
|
52
|
+
model: {
|
|
53
|
+
module: {
|
|
54
|
+
id: { $eq: modifiedFieldValue.id }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
layoutManager.updateNodeAttributes('model', { "whereClause": JSON.stringify(modelWhereClause) });
|
|
59
|
+
layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModule) });
|
|
60
|
+
return [2 /*return*/, {
|
|
61
|
+
layoutChanged: true,
|
|
62
|
+
dataChanged: true,
|
|
63
|
+
newFormData: {
|
|
64
|
+
model: null,
|
|
65
|
+
field: null
|
|
66
|
+
},
|
|
67
|
+
newLayout: layoutManager.getLayout(),
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
70
|
+
if (modifiedField === 'model') {
|
|
71
|
+
fieldWhereClauseOnModel = {
|
|
72
|
+
model: {
|
|
73
|
+
id: { $eq: modifiedFieldValue.id }
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModel) });
|
|
77
|
+
return [2 /*return*/, {
|
|
78
|
+
layoutChanged: true,
|
|
79
|
+
dataChanged: true,
|
|
80
|
+
newFormData: {
|
|
81
|
+
field: null
|
|
82
|
+
},
|
|
83
|
+
newLayout: layoutManager.getLayout(),
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
});
|
|
88
|
+
}); };
|
|
89
|
+
export default hanldeModelSequenceFormViewChange;
|
|
90
|
+
//# sourceMappingURL=modelSequenceFormViewChangeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelSequenceFormViewChangeHandler.js","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/modelSequence/modelSequenceFormViewChangeHandler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AAEtG,IAAM,iCAAiC,GAAG,UAAO,KAAU;;;QAEvD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAEnB,aAAa,GAAyC,KAAK,cAA9C,EAAE,kBAAkB,GAAqB,KAAK,mBAA1B,EAAE,cAAc,GAAK,KAAK,eAAV,CAAW;QAE9D,MAAM,GAAG,cAAc,CAAC;QACxB,aAAa,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,aAAa,KAAK,QAAQ,EAAE;YAEtB,gBAAgB,GAAG;gBACrB,MAAM,EAAE;oBACJ,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,CAAC,EAAE,EAAE;iBACrC;aACJ,CAAC;YACI,wBAAwB,GAAG;gBAC7B,KAAK,EAAE;oBACH,MAAM,EAAE;wBACJ,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,CAAC,EAAE,EAAE;qBACrC;iBACJ;aACJ,CAAC;YAEF,aAAa,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACjG,aAAa,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;YAEzG,sBAAO;oBACH,aAAa,EAAE,IAAI;oBACnB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE;wBACT,KAAK,EAAE,IAAI;wBACX,KAAK,EAAE,IAAI;qBACd;oBACD,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE;iBACvC,EAAA;SACJ;QACD,IAAI,aAAa,KAAK,OAAO,EAAE;YAErB,uBAAuB,GAAG;gBAC5B,KAAK,EAAE;oBACH,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,CAAC,EAAE,EAAE;iBACrC;aACJ,CAAC;YAEF,aAAa,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;YAExG,sBAAO;oBACH,aAAa,EAAE,IAAI;oBACnB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE;wBACT,KAAK,EAAE,IAAI;qBACd;oBACD,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE;iBACvC,EAAA;SACJ;;;KACJ,CAAA;AACD,eAAe,iCAAiC,CAAC","sourcesContent":["import { SolidViewLayoutManager } from \"../../../../../components/core/common/SolidViewLayoutManager\";\n\nconst hanldeModelSequenceFormViewChange = async (event: any) => {\n\n console.log(\"event\", event)\n\n const { modifiedField, modifiedFieldValue, formViewLayout } = event;\n\n const layout = formViewLayout;\n const layoutManager = new SolidViewLayoutManager(layout);\n if (modifiedField === 'module') {\n // module change\n const modelWhereClause = {\n module: {\n id: { $eq: modifiedFieldValue.id }\n }\n };\n const fieldWhereClauseOnModule = {\n model: {\n module: {\n id: { $eq: modifiedFieldValue.id }\n }\n }\n };\n\n layoutManager.updateNodeAttributes('model', { \"whereClause\": JSON.stringify(modelWhereClause) });\n layoutManager.updateNodeAttributes('field', { \"whereClause\": JSON.stringify(fieldWhereClauseOnModule) });\n\n return {\n layoutChanged: true,\n dataChanged: true,\n newFormData: {\n model: null,\n field: null\n },\n newLayout: layoutManager.getLayout(),\n }\n }\n if (modifiedField === 'model') {\n // model change\n const fieldWhereClauseOnModel = {\n model: {\n id: { $eq: modifiedFieldValue.id }\n }\n };\n\n layoutManager.updateNodeAttributes('field', { \"whereClause\": JSON.stringify(fieldWhereClauseOnModel) });\n\n return {\n layoutChanged: true,\n dataChanged: true,\n newFormData: {\n field: null\n },\n newLayout: layoutManager.getLayout(),\n }\n }\n}\nexport default hanldeModelSequenceFormViewChange;"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { SolidViewLayoutManager } from "../../../../../components/core/common/SolidViewLayoutManager";
|
|
2
|
+
|
|
3
|
+
const hanldeModelSequenceFormViewChange = async (event: any) => {
|
|
4
|
+
|
|
5
|
+
console.log("event", event)
|
|
6
|
+
|
|
7
|
+
const { modifiedField, modifiedFieldValue, formViewLayout } = event;
|
|
8
|
+
|
|
9
|
+
const layout = formViewLayout;
|
|
10
|
+
const layoutManager = new SolidViewLayoutManager(layout);
|
|
11
|
+
if (modifiedField === 'module') {
|
|
12
|
+
// module change
|
|
13
|
+
const modelWhereClause = {
|
|
14
|
+
module: {
|
|
15
|
+
id: { $eq: modifiedFieldValue.id }
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const fieldWhereClauseOnModule = {
|
|
19
|
+
model: {
|
|
20
|
+
module: {
|
|
21
|
+
id: { $eq: modifiedFieldValue.id }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
layoutManager.updateNodeAttributes('model', { "whereClause": JSON.stringify(modelWhereClause) });
|
|
27
|
+
layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModule) });
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
layoutChanged: true,
|
|
31
|
+
dataChanged: true,
|
|
32
|
+
newFormData: {
|
|
33
|
+
model: null,
|
|
34
|
+
field: null
|
|
35
|
+
},
|
|
36
|
+
newLayout: layoutManager.getLayout(),
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (modifiedField === 'model') {
|
|
40
|
+
// model change
|
|
41
|
+
const fieldWhereClauseOnModel = {
|
|
42
|
+
model: {
|
|
43
|
+
id: { $eq: modifiedFieldValue.id }
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
layoutManager.updateNodeAttributes('field', { "whereClause": JSON.stringify(fieldWhereClauseOnModel) });
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
layoutChanged: true,
|
|
51
|
+
dataChanged: true,
|
|
52
|
+
newFormData: {
|
|
53
|
+
field: null
|
|
54
|
+
},
|
|
55
|
+
newLayout: layoutManager.getLayout(),
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export default hanldeModelSequenceFormViewChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RolePermissionsManyToManyFieldWidget.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAe5E,eAAO,MAAM,oCAAoC,6BAA8B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"RolePermissionsManyToManyFieldWidget.d.ts","sourceRoot":"","sources":["../../../../../../src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAe5E,eAAO,MAAM,oCAAoC,6BAA8B,yBAAyB,4CA+GvG,CAAC"}
|
|
@@ -38,12 +38,16 @@ var groupByController = function (items) {
|
|
|
38
38
|
return grouped;
|
|
39
39
|
};
|
|
40
40
|
export var RolePermissionsManyToManyFieldWidget = function (_a) {
|
|
41
|
+
var _b;
|
|
41
42
|
var formik = _a.formik, fieldContext = _a.fieldContext;
|
|
42
43
|
var fieldLayoutInfo = fieldContext.field;
|
|
43
44
|
var readOnlyPermission = fieldContext.readOnly;
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
45
|
+
var _c = useState(false), visibleCreateDialog = _c[0], setVisibleCreateDialog = _c[1];
|
|
46
|
+
var _d = useRelationEntityHandler({ fieldContext: fieldContext, formik: formik }), autoCompleteItems = _d.autoCompleteItems, fetchRelationEntities = _d.fetchRelationEntities, populateFormikWithRelatedEntities = _d.populateFormikWithRelatedEntities, addNewRelation = _d.addNewRelation;
|
|
47
|
+
var _e = useState({}), visibleDialogs = _e[0], setVisibleDialogs = _e[1];
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
populateFormikWithRelatedEntities();
|
|
50
|
+
}, [(_b = formik.values) === null || _b === void 0 ? void 0 : _b.id]);
|
|
47
51
|
useEffect(function () {
|
|
48
52
|
var queryData = {
|
|
49
53
|
offset: 0,
|