procode-vs-template 1.0.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/CHANGELOG.md +37 -0
- package/README.md +188 -0
- package/dist/actions.esm.js +53 -0
- package/dist/actions.esm.js.map +1 -0
- package/dist/actions.js +55 -0
- package/dist/actions.js.map +1 -0
- package/dist/assets/delete.png +0 -0
- package/dist/assets/info.svg +5 -0
- package/dist/assets/react.svg +1 -0
- package/dist/assets/styles/_tempalte-base.scss +5 -0
- package/dist/factories.esm.js +39149 -0
- package/dist/factories.esm.js.map +1 -0
- package/dist/factories.js +39169 -0
- package/dist/factories.js.map +1 -0
- package/dist/index.esm.js +39200 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +39224 -0
- package/dist/index.js.map +1 -0
- package/dist/src/assets/styles/_tempalte-base.scss +5 -0
- package/dist/types/Action/TemplateActionFactory.d.ts +8 -0
- package/dist/types/Action/TemplateActionType.d.ts +8 -0
- package/dist/types/Action/TemplateActions/handleMenuNavigation.d.ts +1 -0
- package/dist/types/Factory/BaseType.d.ts +16 -0
- package/dist/types/Factory/TemplateWidgetFactory.d.ts +14 -0
- package/dist/types/Renderer/index.d.ts +2 -0
- package/dist/types/Widgets/Block/BlockView.d.ts +3 -0
- package/dist/types/Widgets/Block/index.d.ts +3 -0
- package/dist/types/Widgets/Block/types.d.ts +12 -0
- package/dist/types/Widgets/ConfirmationAlert/ConfirmationAlertView.d.ts +14 -0
- package/dist/types/Widgets/ConfirmationAlert/index.d.ts +11 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/AdvancedSearch.d.ts +15 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/AdvancedSearchView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/Filter.d.ts +20 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/FilterPopup.d.ts +13 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/FilterPopupView.d.ts +25 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/TypeBasedWidgetFactory.d.ts +8 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/constant.d.ts +8 -0
- package/dist/types/Widgets/GridToolBar/Components/AdvancedSearch/helper/AdvancedSearchFunctions.d.ts +7 -0
- package/dist/types/Widgets/GridToolBar/Components/Export/Export.d.ts +14 -0
- package/dist/types/Widgets/GridToolBar/Components/Export/ExportPopup.d.ts +20 -0
- package/dist/types/Widgets/GridToolBar/Components/Export/ExportView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/Export/type.d.ts +4 -0
- package/dist/types/Widgets/GridToolBar/Components/GlobalSearch/GlobalSearch.d.ts +11 -0
- package/dist/types/Widgets/GridToolBar/Components/GlobalSearch/GlobalSearchView.d.ts +9 -0
- package/dist/types/Widgets/GridToolBar/Components/GroupBy/GroupByPopUp.d.ts +17 -0
- package/dist/types/Widgets/GridToolBar/Components/GroupBy/GroupByView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/GroupBy/index.d.ts +15 -0
- package/dist/types/Widgets/GridToolBar/Components/QuickFilter/FilterPopup.d.ts +10 -0
- package/dist/types/Widgets/GridToolBar/Components/QuickFilter/QuickFilterView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/QuickFilter/index.d.ts +12 -0
- package/dist/types/Widgets/GridToolBar/Components/Reset/ResetView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/Reset/index.d.ts +11 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/CreateScreenPopup.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/UserView.d.ts +26 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/UserViewView.d.ts +13 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/ViewItem.d.ts +11 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/actions/index.d.ts +8 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/deserializedScreenView.d.ts +4 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/getSavedSystemDefault.d.ts +2 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/saveSystemDefaultInSession.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/advancedSearchHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/globalSearchHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/groupByHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/localSearchHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/paginationHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/quickFilterHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/settingHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/sortHandler.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/Components/ScreenView/services/index.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/ColumnChooser/ColumnChooser.d.ts +15 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/ColumnChooser/ColumnChooserView.d.ts +17 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/ColumnChooser/DragDropContext.d.ts +9 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/Setting.d.ts +19 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/SettingPopup.d.ts +9 -0
- package/dist/types/Widgets/GridToolBar/Components/Setting/SettingView.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/GridToolBar.d.ts +8 -0
- package/dist/types/Widgets/GridToolBar/GridToolBarView.d.ts +23 -0
- package/dist/types/Widgets/GridToolBar/data/advancedSearch/index.d.ts +46 -0
- package/dist/types/Widgets/GridToolBar/data/globalSearch/index.d.ts +4 -0
- package/dist/types/Widgets/GridToolBar/data/groupBy/index.d.ts +6 -0
- package/dist/types/Widgets/GridToolBar/data/index.d.ts +49 -0
- package/dist/types/Widgets/GridToolBar/data/quickFilter/index.d.ts +30 -0
- package/dist/types/Widgets/GridToolBar/data/setting/index.d.ts +21 -0
- package/dist/types/Widgets/GridToolBar/data/userView/index.d.ts +10 -0
- package/dist/types/Widgets/GridToolBar/enum/index.d.ts +27 -0
- package/dist/types/Widgets/GridToolBar/helper/getUniqueId.d.ts +1 -0
- package/dist/types/Widgets/GridToolBar/type.d.ts +58 -0
- package/dist/types/Widgets/InformationAlert/InformationAlert.d.ts +8 -0
- package/dist/types/Widgets/InformationAlert/InformationAlertView.d.ts +8 -0
- package/dist/types/Widgets/Menu/MenuMainHeader.d.ts +3 -0
- package/dist/types/Widgets/Menu/MenuSubHeader.d.ts +3 -0
- package/dist/types/Widgets/Menu/MenuSubItem.d.ts +3 -0
- package/dist/types/Widgets/Menu/MenuView.d.ts +6 -0
- package/dist/types/Widgets/Menu/index.d.ts +14 -0
- package/dist/types/actions.d.ts +2 -0
- package/dist/types/constant.d.ts +8 -0
- package/dist/types/factories.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/utils/getValueFromNestedObject.d.ts +1 -0
- package/package.json +98 -0
- package/src/Action/TemplateActionFactory.ts +27 -0
- package/src/Action/TemplateActionType.ts +8 -0
- package/src/Action/TemplateActions/handleMenuNavigation.ts +23 -0
- package/src/Factory/BaseType.ts +12 -0
- package/src/Factory/TemplateWidgetFactory.tsx +50 -0
- package/src/Renderer/index.tsx +14 -0
- package/src/Widgets/Block/BlockView.tsx +31 -0
- package/src/Widgets/Block/Styles/index.scss +41 -0
- package/src/Widgets/Block/index.tsx +8 -0
- package/src/Widgets/Block/types.ts +11 -0
- package/src/Widgets/ConfirmationAlert/ConfirmationAlertView.tsx +90 -0
- package/src/Widgets/ConfirmationAlert/index.tsx +16 -0
- package/src/Widgets/ConfirmationAlert/scss/index.scss +66 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/AdvancedSearch.tsx +83 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/AdvancedSearchView.tsx +25 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/Filter.tsx +162 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/FilterPopup.tsx +437 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/FilterPopupView.tsx +111 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/TypeBasedWidgetFactory.tsx +226 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/constant.ts +55 -0
- package/src/Widgets/GridToolBar/Components/AdvancedSearch/helper/AdvancedSearchFunctions.ts +36 -0
- package/src/Widgets/GridToolBar/Components/Export/Export.tsx +57 -0
- package/src/Widgets/GridToolBar/Components/Export/ExportPopup.tsx +388 -0
- package/src/Widgets/GridToolBar/Components/Export/ExportView.tsx +21 -0
- package/src/Widgets/GridToolBar/Components/Export/type.ts +4 -0
- package/src/Widgets/GridToolBar/Components/GlobalSearch/GlobalSearch.tsx +95 -0
- package/src/Widgets/GridToolBar/Components/GlobalSearch/GlobalSearchView.tsx +65 -0
- package/src/Widgets/GridToolBar/Components/GroupBy/GroupByPopUp.tsx +115 -0
- package/src/Widgets/GridToolBar/Components/GroupBy/GroupByView.tsx +21 -0
- package/src/Widgets/GridToolBar/Components/GroupBy/index.tsx +84 -0
- package/src/Widgets/GridToolBar/Components/QuickFilter/FilterPopup.tsx +41 -0
- package/src/Widgets/GridToolBar/Components/QuickFilter/QuickFilterView.tsx +23 -0
- package/src/Widgets/GridToolBar/Components/QuickFilter/index.tsx +199 -0
- package/src/Widgets/GridToolBar/Components/Reset/ResetView.tsx +22 -0
- package/src/Widgets/GridToolBar/Components/Reset/index.tsx +41 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/CreateScreenPopup.tsx +88 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/UserView.tsx +266 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/UserViewView.tsx +67 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/ViewItem.tsx +94 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/actions/index.ts +20 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/deserializedScreenView.ts +19 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/getSavedSystemDefault.ts +18 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/saveSystemDefaultInSession.ts +12 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/advancedSearchHandler.ts +32 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/globalSearchHandler.ts +13 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/groupByHandler.ts +8 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/localSearchHandler.ts +6 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/paginationHandler.ts +6 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/quickFilterHandler.ts +13 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/settingHandler.ts +19 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/helpers/uiElementHandler/sortHandler.ts +6 -0
- package/src/Widgets/GridToolBar/Components/ScreenView/services/index.ts +63 -0
- package/src/Widgets/GridToolBar/Components/Setting/ColumnChooser/ColumnChooser.tsx +274 -0
- package/src/Widgets/GridToolBar/Components/Setting/ColumnChooser/ColumnChooserView.tsx +154 -0
- package/src/Widgets/GridToolBar/Components/Setting/ColumnChooser/DragDropContext.tsx +76 -0
- package/src/Widgets/GridToolBar/Components/Setting/Setting.tsx +116 -0
- package/src/Widgets/GridToolBar/Components/Setting/SettingPopup.tsx +23 -0
- package/src/Widgets/GridToolBar/Components/Setting/SettingView.tsx +23 -0
- package/src/Widgets/GridToolBar/GridToolBar.tsx +111 -0
- package/src/Widgets/GridToolBar/GridToolBarView.tsx +138 -0
- package/src/Widgets/GridToolBar/data/advancedSearch/index.ts +45 -0
- package/src/Widgets/GridToolBar/data/globalSearch/index.ts +4 -0
- package/src/Widgets/GridToolBar/data/groupBy/index.ts +3 -0
- package/src/Widgets/GridToolBar/data/index.ts +74 -0
- package/src/Widgets/GridToolBar/data/quickFilter/index.ts +37 -0
- package/src/Widgets/GridToolBar/data/setting/index.ts +23 -0
- package/src/Widgets/GridToolBar/data/userView/index.ts +11 -0
- package/src/Widgets/GridToolBar/enum/index.ts +29 -0
- package/src/Widgets/GridToolBar/helper/getUniqueId.ts +2 -0
- package/src/Widgets/GridToolBar/scss/index.scss +834 -0
- package/src/Widgets/GridToolBar/type.ts +63 -0
- package/src/Widgets/InformationAlert/InformationAlert.tsx +12 -0
- package/src/Widgets/InformationAlert/InformationAlertView.tsx +46 -0
- package/src/Widgets/InformationAlert/scss/index.scss +73 -0
- package/src/Widgets/Menu/MenuMainHeader.tsx +28 -0
- package/src/Widgets/Menu/MenuSubHeader.tsx +20 -0
- package/src/Widgets/Menu/MenuSubItem.tsx +10 -0
- package/src/Widgets/Menu/MenuView.tsx +19 -0
- package/src/Widgets/Menu/index.json +245 -0
- package/src/Widgets/Menu/index.tsx +32 -0
- package/src/Widgets/Menu/scss/index.scss +93 -0
- package/src/actions.ts +5 -0
- package/src/assets/delete.png +0 -0
- package/src/assets/info.svg +5 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/styles/_tempalte-base.scss +5 -0
- package/src/constant.ts +8 -0
- package/src/factories.ts +5 -0
- package/src/index.ts +12 -0
- package/src/utils/getValueFromNestedObject.ts +14 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import FactoryRenderer from "../../../../Renderer";
|
|
2
|
+
|
|
3
|
+
export type GroupByViewProps = {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
onPopupToggle: () => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const GroupByView = (props: GroupByViewProps) => {
|
|
9
|
+
return (
|
|
10
|
+
<FactoryRenderer
|
|
11
|
+
onClick={props.onPopupToggle}
|
|
12
|
+
title="Group By"
|
|
13
|
+
rootStyle={{ className: "tmpl-groupby" }}
|
|
14
|
+
widgetStyle={{ className: "tmpl-button" }}
|
|
15
|
+
uiElementType="WIDGET"
|
|
16
|
+
widgetType="BUTTON"
|
|
17
|
+
disabled={props.disabled}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export default GroupByView;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import GroupByView from "./GroupByView";
|
|
4
|
+
import GroupByPopUp from "./GroupByPopUp";
|
|
5
|
+
import _ from "lodash";
|
|
6
|
+
|
|
7
|
+
export type GroupByProps = {
|
|
8
|
+
visible: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
groupableFields: { label: string; value: string }[];
|
|
11
|
+
uiElementGroupData: Record<string, any>;
|
|
12
|
+
config: { uiElementGroupId: string };
|
|
13
|
+
onModelUpdate: (
|
|
14
|
+
callBack: ((args: any) => void) | null,
|
|
15
|
+
fieldName: string,
|
|
16
|
+
value: any
|
|
17
|
+
) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const GroupBy = (props: GroupByProps) => {
|
|
21
|
+
const [togglePopup, setTogglePopup] = useState(false);
|
|
22
|
+
const popupRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (togglePopup) {
|
|
26
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
27
|
+
} else {
|
|
28
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
32
|
+
};
|
|
33
|
+
}, [togglePopup]);
|
|
34
|
+
|
|
35
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
36
|
+
if (
|
|
37
|
+
popupRef.current &&
|
|
38
|
+
!popupRef.current.contains(event.target as Node) &&
|
|
39
|
+
(event.target as any)?.offsetParent?.className !== "k-list-content"
|
|
40
|
+
) {
|
|
41
|
+
setTogglePopup(false);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const onGroupApply = (groupFields: { label: string; value: string }[]) => {
|
|
46
|
+
const updatedGroupedBy = {
|
|
47
|
+
...props.uiElementGroupData.groupedBy,
|
|
48
|
+
appliedGroups: _.cloneDeep(groupFields),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const updatedUiElementGroupData = {
|
|
52
|
+
...props.uiElementGroupData,
|
|
53
|
+
groupedBy: updatedGroupedBy,
|
|
54
|
+
};
|
|
55
|
+
setTogglePopup(false);
|
|
56
|
+
props.onModelUpdate(
|
|
57
|
+
null,
|
|
58
|
+
props.config.uiElementGroupId,
|
|
59
|
+
updatedUiElementGroupData
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const onPopupToggle = () => {
|
|
64
|
+
setTogglePopup((prevToggle) => !prevToggle);
|
|
65
|
+
};
|
|
66
|
+
return props.visible ? (
|
|
67
|
+
<div className="tmpl-group-filter-container" ref={popupRef}>
|
|
68
|
+
<GroupByView disabled={props.disabled} onPopupToggle={onPopupToggle} />
|
|
69
|
+
{togglePopup && !props.disabled && (
|
|
70
|
+
<GroupByPopUp
|
|
71
|
+
selectedGroups={
|
|
72
|
+
props.uiElementGroupData?.groupedBy?.appliedGroups ?? []
|
|
73
|
+
}
|
|
74
|
+
groupableFields={props.groupableFields}
|
|
75
|
+
onPopupToggle={onPopupToggle}
|
|
76
|
+
onGroupApply={onGroupApply}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
) : (
|
|
81
|
+
<></>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
export default GroupBy;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import FactoryRenderer from "../../../../Renderer";
|
|
3
|
+
import { FilterExpression } from "../../data/quickFilter";
|
|
4
|
+
|
|
5
|
+
interface FilterPopupProps {
|
|
6
|
+
filterRows: FilterExpression[];
|
|
7
|
+
onQuickFilterApply: (
|
|
8
|
+
id: string,
|
|
9
|
+
value: { label: string; value: any }
|
|
10
|
+
) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const FilterPopup = (props: FilterPopupProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<div className="tmpl-quick-filter-popup">
|
|
16
|
+
{props.filterRows?.map((filterRow) => {
|
|
17
|
+
return (
|
|
18
|
+
<div className="tmpl-dropdown-container" key={filterRow.id}>
|
|
19
|
+
<span>{filterRow.propertyToFilter.label}</span>
|
|
20
|
+
<FactoryRenderer
|
|
21
|
+
value={filterRow.value}
|
|
22
|
+
textField="label"
|
|
23
|
+
listData={filterRow.allValues ?? []}
|
|
24
|
+
title="Filter"
|
|
25
|
+
defaultItem={{ label: "Select...", value: null }}
|
|
26
|
+
widgetStyle={{ className: "tmpl-dropdown" }}
|
|
27
|
+
rootStyle={{ className: "tmpl-dropdown-container" }}
|
|
28
|
+
popupSettings={{ className: `tmpl-prvent-outside-click-close` }}
|
|
29
|
+
onChange={(callBack: any, fieldName: string, e: any) =>
|
|
30
|
+
props.onQuickFilterApply(filterRow.id, e)
|
|
31
|
+
}
|
|
32
|
+
uiElementType="WIDGET"
|
|
33
|
+
widgetType="DROPDOWN"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
})}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export default FilterPopup;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import FactoryRenderer from "../../../../Renderer";
|
|
3
|
+
|
|
4
|
+
export type QuickFilterViewProps = {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onPopupToggle: () => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const QuickFilterView = (props: QuickFilterViewProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<FactoryRenderer
|
|
12
|
+
onClick={props.onPopupToggle}
|
|
13
|
+
rootStyle={{ className: "tmpl-quick-filter", inline: { width: "32px" } }}
|
|
14
|
+
widgetStyle={{ className: "tmpl-button", inline: { width: "100%" } }}
|
|
15
|
+
uiElementType="WIDGET"
|
|
16
|
+
widgetType="ICON"
|
|
17
|
+
name="filter"
|
|
18
|
+
fillMode=""
|
|
19
|
+
disabled={props.disabled}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export default QuickFilterView;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import QuickFilterView from "./QuickFilterView";
|
|
4
|
+
import { FilterExpression, FilterValue } from "../../data/quickFilter";
|
|
5
|
+
import { ValueLoadType } from "../../type";
|
|
6
|
+
import FilterPopup from "./FilterPopup";
|
|
7
|
+
import _ from "lodash";
|
|
8
|
+
import { FilterTargetType, OperatorCreiteria } from "../../enum";
|
|
9
|
+
|
|
10
|
+
export type QuickFilterProps = {
|
|
11
|
+
visible: boolean;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
uiElementGroupData: Record<string, any>;
|
|
14
|
+
config: { uiElementGroupId: string };
|
|
15
|
+
onModelUpdate: (
|
|
16
|
+
callBack: ((args: any) => void) | null,
|
|
17
|
+
fieldName: string,
|
|
18
|
+
value: any
|
|
19
|
+
) => void;
|
|
20
|
+
loadTemplateSupportiveData?: (
|
|
21
|
+
callBack: (args: any) => void,
|
|
22
|
+
supportiveKeys: any
|
|
23
|
+
) => Promise<any>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const QuickFilter = (props: QuickFilterProps) => {
|
|
27
|
+
const [togglePopup, setTogglePopup] = useState(false);
|
|
28
|
+
const popupRef = useRef<HTMLDivElement>(null);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (props.uiElementGroupData?.quickFilter?.filterRows?.length > 0) {
|
|
32
|
+
loadFilterValues();
|
|
33
|
+
}
|
|
34
|
+
}, [
|
|
35
|
+
props.uiElementGroupData?.quickFilter?.filterRows?.length,
|
|
36
|
+
props.uiElementGroupData?.reset,
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (togglePopup) {
|
|
41
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
42
|
+
} else {
|
|
43
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
44
|
+
}
|
|
45
|
+
return () => {
|
|
46
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
47
|
+
};
|
|
48
|
+
}, [togglePopup]);
|
|
49
|
+
|
|
50
|
+
const updateQuickFilterSupportiveData = (result: Record<string, any[]>) => {
|
|
51
|
+
const filterRows = props.uiElementGroupData?.quickFilter?.filterRows.map(
|
|
52
|
+
(f: FilterExpression) => {
|
|
53
|
+
const filterRow = { ...f };
|
|
54
|
+
if (
|
|
55
|
+
filterRow.propertyToFilter?.dataProvider?.valueLoadType ===
|
|
56
|
+
ValueLoadType.API
|
|
57
|
+
) {
|
|
58
|
+
filterRow.allValues =
|
|
59
|
+
result[filterRow.propertyToFilter?.dataProvider.key ?? ""];
|
|
60
|
+
} else if (
|
|
61
|
+
filterRow.propertyToFilter?.dataProvider?.valueLoadType ===
|
|
62
|
+
ValueLoadType.SELF
|
|
63
|
+
) {
|
|
64
|
+
filterRow.allValues = filterRow.propertyToFilter?.dataProvider
|
|
65
|
+
.value as FilterValue[];
|
|
66
|
+
}
|
|
67
|
+
return filterRow;
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const updatedQuickFilter = {
|
|
72
|
+
...props.uiElementGroupData.quickFilter,
|
|
73
|
+
filterRows: filterRows,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const updatedUiElementGroupData = {
|
|
77
|
+
...props.uiElementGroupData,
|
|
78
|
+
quickFilter: updatedQuickFilter,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
props.onModelUpdate(
|
|
82
|
+
null,
|
|
83
|
+
props.config.uiElementGroupId,
|
|
84
|
+
updatedUiElementGroupData
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const loadFilterValues = () => {
|
|
89
|
+
const dataProviderKeys: string[] = [];
|
|
90
|
+
props.uiElementGroupData?.quickFilter?.filterRows?.map(
|
|
91
|
+
(filterRow: FilterExpression) => {
|
|
92
|
+
if (
|
|
93
|
+
filterRow.propertyToFilter?.dataProvider?.valueLoadType ===
|
|
94
|
+
ValueLoadType.API
|
|
95
|
+
) {
|
|
96
|
+
dataProviderKeys.push(
|
|
97
|
+
filterRow.propertyToFilter?.dataProvider.key ?? ""
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (dataProviderKeys.length > 0) {
|
|
104
|
+
props.loadTemplateSupportiveData?.(
|
|
105
|
+
updateQuickFilterSupportiveData,
|
|
106
|
+
dataProviderKeys
|
|
107
|
+
);
|
|
108
|
+
} else {
|
|
109
|
+
updateQuickFilterSupportiveData({});
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const onQuickFilterApply = (
|
|
113
|
+
id: string,
|
|
114
|
+
value: FilterValue | FilterValue[]
|
|
115
|
+
) => {
|
|
116
|
+
const filterRows = _.cloneDeep(
|
|
117
|
+
props.uiElementGroupData?.quickFilter?.filterRows
|
|
118
|
+
);
|
|
119
|
+
const filterRowIndex = filterRows.findIndex(
|
|
120
|
+
(filterRow: FilterExpression) => filterRow.id === id
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
filterRows[filterRowIndex].value = value;
|
|
124
|
+
const appliedFilterRows = _.cloneDeep(filterRows).filter(
|
|
125
|
+
(row: FilterExpression) => {
|
|
126
|
+
if (row.propertyToFilter.type === FilterTargetType.LIST)
|
|
127
|
+
return (
|
|
128
|
+
(row.value as { label: string; value: any })?.value !== undefined &&
|
|
129
|
+
(row.value as { label: string; value: any })?.value !== null
|
|
130
|
+
);
|
|
131
|
+
return row.value;
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const updatedQuickFilter = {
|
|
136
|
+
...props.uiElementGroupData.quickFilter,
|
|
137
|
+
filterRows: filterRows,
|
|
138
|
+
appliedQuery: {
|
|
139
|
+
criteria: "",
|
|
140
|
+
filterRows: _.cloneDeep(appliedFilterRows),
|
|
141
|
+
joinCriteria: OperatorCreiteria.AND,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const updatedUiElementGroupData = {
|
|
146
|
+
...props.uiElementGroupData,
|
|
147
|
+
quickFilter: updatedQuickFilter,
|
|
148
|
+
pagination: { ...props.uiElementGroupData.pagination, skip: 0 },
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
props.onModelUpdate(
|
|
152
|
+
null,
|
|
153
|
+
props.config.uiElementGroupId,
|
|
154
|
+
updatedUiElementGroupData
|
|
155
|
+
);
|
|
156
|
+
setTogglePopup(false);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
160
|
+
const target = event.target as HTMLElement;
|
|
161
|
+
const isInsideMyPopup = target.closest(`.tmpl-prvent-outside-click-close`);
|
|
162
|
+
|
|
163
|
+
if (
|
|
164
|
+
popupRef.current &&
|
|
165
|
+
!popupRef.current.contains(event.target as Node) &&
|
|
166
|
+
!isInsideMyPopup
|
|
167
|
+
) {
|
|
168
|
+
setTogglePopup(false);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const onPopupToggle = () => {
|
|
173
|
+
if (popupRef.current && togglePopup) {
|
|
174
|
+
popupRef.current.classList.add("tmpl-popup-animation-reverse");
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
setTogglePopup((prevToggle) => !prevToggle);
|
|
177
|
+
}, 200);
|
|
178
|
+
} else {
|
|
179
|
+
setTogglePopup((prevToggle) => !prevToggle);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return props.visible ? (
|
|
183
|
+
<div className="tmpl-quick-filter-container" ref={popupRef}>
|
|
184
|
+
<QuickFilterView
|
|
185
|
+
disabled={props.disabled}
|
|
186
|
+
onPopupToggle={onPopupToggle}
|
|
187
|
+
/>
|
|
188
|
+
{togglePopup && !props.disabled && (
|
|
189
|
+
<FilterPopup
|
|
190
|
+
filterRows={props.uiElementGroupData?.quickFilter?.filterRows ?? []}
|
|
191
|
+
onQuickFilterApply={onQuickFilterApply}
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
) : (
|
|
196
|
+
<></>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
export default QuickFilter;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import FactoryRenderer from "../../../../Renderer";
|
|
2
|
+
|
|
3
|
+
export type ResetViewProps = {
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
onReset: () => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const ResetView = (props: ResetViewProps) => {
|
|
9
|
+
return (
|
|
10
|
+
<FactoryRenderer
|
|
11
|
+
disabled={props.disabled}
|
|
12
|
+
rootStyle={{ className: "tmpl-reset" }}
|
|
13
|
+
widgetStyle={{ className: "tmpl-button", inline: { width: "100%" } }}
|
|
14
|
+
onClick={props.onReset}
|
|
15
|
+
name="reset"
|
|
16
|
+
title="Reset"
|
|
17
|
+
uiElementType="WIDGET"
|
|
18
|
+
widgetType="ICON"
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export default ResetView;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { SYSTEM_DEFAULT } from "../../../../constant";
|
|
3
|
+
import ResetView from "./ResetView";
|
|
4
|
+
|
|
5
|
+
export type ResetProps = {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
uiElementGroupData: Record<string, any>;
|
|
9
|
+
config: { uiElementGroupId: string };
|
|
10
|
+
onModelUpdate: (
|
|
11
|
+
callBack: ((args: any) => void) | null,
|
|
12
|
+
fieldName: string,
|
|
13
|
+
value: any
|
|
14
|
+
) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Reset = (props: ResetProps) => {
|
|
18
|
+
const onReset = () => {
|
|
19
|
+
if (props.uiElementGroupData.userView.selectedView?.id === SYSTEM_DEFAULT) {
|
|
20
|
+
const defaultScreenViewId = `${props.config.uiElementGroupId}_${SYSTEM_DEFAULT}`;
|
|
21
|
+
sessionStorage.removeItem(defaultScreenViewId);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const updatedUiElementGroupData = {
|
|
25
|
+
...props.uiElementGroupData,
|
|
26
|
+
reset: (props.uiElementGroupData.reset ?? 0) + 1,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
props.onModelUpdate(
|
|
30
|
+
null,
|
|
31
|
+
props.config.uiElementGroupId,
|
|
32
|
+
updatedUiElementGroupData
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
return props.visible ? (
|
|
36
|
+
<ResetView disabled={props.disabled} onReset={onReset} />
|
|
37
|
+
) : (
|
|
38
|
+
<></>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export default Reset;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Button } from "@progress/kendo-react-buttons";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { TextBox, TextBoxChangeEvent } from "@progress/kendo-react-inputs";
|
|
4
|
+
import FactoryRenderer from "../../../../Renderer";
|
|
5
|
+
|
|
6
|
+
interface CreateScreenPopupProps {
|
|
7
|
+
onViewToggle: () => void;
|
|
8
|
+
create: (viewName: string) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const CreateScreenPopup = (props: CreateScreenPopupProps) => {
|
|
12
|
+
const [screenName, setScreenName] = useState("");
|
|
13
|
+
const [isValid, setIsValid] = useState(true);
|
|
14
|
+
const popupRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
18
|
+
if (
|
|
19
|
+
popupRef.current &&
|
|
20
|
+
!popupRef.current.contains(event.target as Node)
|
|
21
|
+
) {
|
|
22
|
+
popupRef.current.classList.add("tmpl-popup-animation-2-reverse");
|
|
23
|
+
setTimeout(props.onViewToggle, 200);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
28
|
+
|
|
29
|
+
return () => {
|
|
30
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
const handleCreate = () => {
|
|
35
|
+
if (!screenName.trim()) {
|
|
36
|
+
setIsValid(false);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
props.create(screenName.trim());
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const onScreenNameChange = (e: TextBoxChangeEvent) => {
|
|
43
|
+
setScreenName(e.target.value?.toString() || "");
|
|
44
|
+
setIsValid(true);
|
|
45
|
+
};
|
|
46
|
+
return (
|
|
47
|
+
<div className="tmpl-screen-creater-popup" ref={popupRef}>
|
|
48
|
+
<div className="tmpl-screen-creater-popup-header">
|
|
49
|
+
<div>
|
|
50
|
+
<h2>Create New View</h2>
|
|
51
|
+
</div>
|
|
52
|
+
<FactoryRenderer
|
|
53
|
+
widgetStyle={{
|
|
54
|
+
className: "tmpl-button-sm",
|
|
55
|
+
}}
|
|
56
|
+
name="close"
|
|
57
|
+
fillMode="clear"
|
|
58
|
+
onClick={props.onViewToggle}
|
|
59
|
+
uiElementType="WIDGET"
|
|
60
|
+
widgetType="ICON"
|
|
61
|
+
title=""
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="tmpl-screen-creater-popup-body">
|
|
65
|
+
<div className="tmpl-dropdown-container">
|
|
66
|
+
<span>View Name</span>
|
|
67
|
+
<TextBox
|
|
68
|
+
value={screenName}
|
|
69
|
+
className="tmpl-input"
|
|
70
|
+
placeholder="Type Here..."
|
|
71
|
+
onChange={onScreenNameChange}
|
|
72
|
+
/>
|
|
73
|
+
{!isValid && <span>Required</span>}
|
|
74
|
+
</div>
|
|
75
|
+
<div className="tmpl-screen-creater-popup-footer">
|
|
76
|
+
<Button
|
|
77
|
+
title="Create View"
|
|
78
|
+
className="tmpl-button"
|
|
79
|
+
onClick={handleCreate}
|
|
80
|
+
>
|
|
81
|
+
Create
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
export default CreateScreenPopup;
|