Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed serach popup issue #1162

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion micro-ui/web/core/inter-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"dependencies": {
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"homepage": "/core-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.3",
"@egovernments/digit-ui-module-workbench": "1.0.5",
"@egovernments/digit-ui-module-workbench": "1.0.6",
"@egovernments/digit-ui-module-core": "1.8.2",
"@egovernments/digit-ui-module-pgr": "1.8.0",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"@egovernments/digit-ui-module-utilities": "1.0.0",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"devDependencies": {
"@egovernments/digit-ui-libraries": "1.8.3",
"@egovernments/digit-ui-module-workbench": "1.0.5",
"@egovernments/digit-ui-module-workbench": "1.0.6",
"@egovernments/digit-ui-module-dss": "1.8.0",
"@egovernments/digit-ui-module-core": "1.8.2",
"@egovernments/digit-ui-module-common": "1.8.0",
"@egovernments/digit-ui-module-pgr": "1.8.0",
"@egovernments/digit-ui-module-hrms": "1.8.0",
"@egovernments/digit-ui-module-utilities": "1.0.0",
"@egovernments/digit-ui-module-engagement": "1.8.0",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dependencies": {
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"jsonpath": "^1.1.1",
"react": "17.0.2",
"react-date-range": "1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"lodash.merge": "^4.6.2",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ https://github.com/egovernments/DIGIT-OSS/pull/99/commits/6e711bdc005c226c7debd5
### Changelog

```bash
1.0.5 Fixed Search Popup Issue
1.0.5 Updated Search Feature Change
1.0.4 Added Search feature changes
1.0.3 Changed url in view and edit screen of workbench and fix some bug
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-module-workbench",
"version": "1.0.5",
"version": "1.0.6",
"description": "Workbench",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand All @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Config = {
filterFormJsonPath: "requestBody.MdmsCriteria.custom",
searchFormJsonPath: "requestBody.MdmsCriteria.custom"
},
customHook:"useMDMSPopupSearch",
sections: {
search: {
uiConfig: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { useQuery, useQueryClient } from "react-query";
import axios from "axios";

const useMDMSPopupSearch = (criteria) => {
const updatedCriteria = { ...criteria };
// Update filters
if (updatedCriteria.state?.searchForm) {
const { field, value } = updatedCriteria.state.searchForm;
if (field && value !== undefined) {
updatedCriteria.body.MdmsCriteria = {
...updatedCriteria.body.MdmsCriteria,
tenantId: updatedCriteria.body.MdmsCriteria.tenantId,
filters: {
...(updatedCriteria.body.MdmsCriteria.filters || {}),
[field.code]: value,
},
};
}
}
// Update limit and offset
if (updatedCriteria.state?.tableForm) {
const { limit, offset } = updatedCriteria.state.tableForm;
updatedCriteria.body.MdmsCriteria = {
...updatedCriteria.body.MdmsCriteria,
limit,
offset,
};
}

const { url, params, body, config = {}, changeQueryName = "Random" } = updatedCriteria;
const client = useQueryClient();

const fetchData = async () => {
try {
const response = await axios.post(url, body, { params }, config);
return response.data;
} catch (error) {
throw new Error("Error fetching data");
}
};

const { isLoading, data, isFetching, refetch, error } = useQuery(
[url, params, body, "popup"].filter((e) => e),
fetchData,
{
cacheTime: 0,
...config,
}
);

return {
isLoading,
data,
isFetching,
revalidate: () => {
data && client.invalidateQueries([url].filter((e) => e));
},
refetch,
error,
};
};

export default useMDMSPopupSearch;
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { logoutV1 } from "./logout";
import { UICreateConfigGenerator , getMDMSContextPath, isSchemaCodeInMDMSAction} from "./workbench";
import { UICreateConfigGenerator, getMDMSContextPath, isSchemaCodeInMDMSAction } from "./workbench";
import utils from "../utils";
import useLocalisationSearch from "./useLocalisationSearch";
import useMDMSPopupSearch from "./inbox";

const UserService = {
logoutV1,
};

const workbench = {
UICreateConfigGenerator , getMDMSContextPath, isSchemaCodeInMDMSAction,
useLocalisationSearch
UICreateConfigGenerator,
getMDMSContextPath,
isSchemaCodeInMDMSAction,
useLocalisationSearch,
};

const contracts = {};
Expand All @@ -20,6 +23,9 @@ const Hooks = {
},
workbench,
contracts,
inbox: {
useMDMSPopupSearch,
},
};

const Utils = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Syntax for the FormComposersV2
### Changelog

```bash
1.8.3 updated Inboxsearchcomposer with customhook
1.8.2 updated serachcomponent for serachscreen inside popup
1.8.1 build issue fix due to ajv library
1.8.0 workbench v1.0 release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-react-components",
"version": "1.8.2",
"version": "1.8.3",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ const TextField = (props) => {
props?.addProps?.currentIndex > 2 && e?.target?.parentElement?.parentElement?.children?.namedItem("jk-dropdown-unique")?.scrollBy?.(0, -45);
}
e.preventDefault();
} else if (e.key == "Enter") {
props.addProps.selectOption(props.addProps.currentIndex);
} else if (e.key === "Enter") {
if (props.addProps.length === 1) {
props.addProps.selectOption(0);
} else {
props.addProps.selectOption(props.addProps.currentIndex);
}
e.preventDefault();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ const InboxSearchComposer = ({configs,headerLabel,additionalConfig,onFormValueCh

const updatedReqCriteria = Digit?.Customizations?.[apiDetails?.masterName]?.[apiDetails?.moduleName]?.preProcess ? Digit?.Customizations?.[apiDetails?.masterName]?.[apiDetails?.moduleName]?.preProcess(requestCriteria,configs.additionalDetails) : requestCriteria

if(configs.customHookName){
var { isLoading, data, revalidate,isFetching,refetch,error } = eval(`Digit.Hooks.${configs.customHookName}(updatedReqCriteria)`);
}
else {
var { isLoading, data, revalidate,isFetching,error } = Digit.Hooks.useCustomAPIHook(updatedReqCriteria);
if (configs.customHookName) {
var { isLoading, data, revalidate, isFetching, refetch, error } = eval(`Digit.Hooks.${configs.customHookName}(updatedReqCriteria)`);
} else if (configs.customHook) {
var { isLoading, data, revalidate, isFetching, refetch, error } = eval(`Digit.Hooks.inbox.${configs.customHook}(updatedReqCriteria)`);
} else {
var { isLoading, data, revalidate, isFetching, error } = Digit.Hooks.useCustomAPIHook(updatedReqCriteria);
}

const closeToast = () => {
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"homepage": "/digit-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.3",
"@egovernments/digit-ui-module-workbench": "1.0.5",
"@egovernments/digit-ui-module-workbench": "1.0.6",
"@egovernments/digit-ui-module-core": "1.8.2",
"@egovernments/digit-ui-module-hrms": "1.8.0",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"@egovernments/digit-ui-module-dss": "1.8.0",
"@egovernments/digit-ui-module-pgr": "1.8.0",
"@egovernments/digit-ui-module-common": "1.8.0",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/workbench/inter-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"dependencies": {
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"homepage": "/workbench-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.3",
"@egovernments/digit-ui-module-workbench": "1.0.5",
"@egovernments/digit-ui-module-workbench": "1.0.6",
"@egovernments/digit-ui-module-core": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.2",
"@egovernments/digit-ui-react-components": "1.8.3",
"@egovernments/digit-ui-module-utilities": "1.0.0",
"@egovernments/digit-ui-module-hrms":"1.8.0",
"@egovernments/digit-ui-module-pgr":"1.8.0",
Expand Down