diff --git a/micro-ui/web/core/inter-package.json b/micro-ui/web/core/inter-package.json index af0707eece6..4602f1f42cc 100644 --- a/micro-ui/web/core/inter-package.json +++ b/micro-ui/web/core/inter-package.json @@ -50,6 +50,7 @@ "resolutions": { "**/@babel/runtime": "7.20.1", "**/babel-preset-react-app": "10.0.0", + "**/@babel/traverse":"7.25.9", "**/ajv": "8.11.2", "fast-uri":"2.1.0" }, diff --git a/micro-ui/web/micro-ui-internals/package.json b/micro-ui/web/micro-ui-internals/package.json index f8f56d67ac2..05b2751ef0e 100644 --- a/micro-ui/web/micro-ui-internals/package.json +++ b/micro-ui/web/micro-ui-internals/package.json @@ -57,6 +57,7 @@ "resolutions": { "**/@babel/runtime": "7.20.1", "**/babel-preset-react-app": "10.0.0", + "**/@babel/traverse":"7.25.9", "**/styled-components": "5.0.0", "fast-uri":"2.1.0" }, diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/digitv2/pages/employee/workbench.scss b/micro-ui/web/micro-ui-internals/packages/css/src/digitv2/pages/employee/workbench.scss index 8af10232ef1..8936721f46d 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/digitv2/pages/employee/workbench.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/digitv2/pages/employee/workbench.scss @@ -1047,4 +1047,53 @@ user-select: none; .diff-code-insert { background-color: #eaffee; } -} \ No newline at end of file + +} + + +.code-details { + padding: 0.5rem 1.5rem; + background-color: #f9f9f9; + border: 1px solid #e0e0e0; + border-radius: 4px; +} + +.code-row { + display: flex; + align-items: flex-start; + margin-bottom: 0.75rem; +} + +.code-key { + flex: 0 0 150px; + font-size: 0.9rem; + font-weight: bold; + color: #444; +} + +.code-value-container { + display: flex; + flex-direction: column; + flex: 1; +} + +.code-value { + font-size: 0.9rem; + color: #555; + margin-bottom: 0.2rem; +} + +.code-row:last-child { + margin-bottom: 0; +} + + + + + + + + + + + diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js index 692f65d3d91..26441ac20c2 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js @@ -269,4 +269,4 @@ export const UICustomizations = { } }, }, -}; +}; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js b/micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js index 76d8af0b5bc..47744ff2dd6 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js @@ -11,33 +11,20 @@ import { Menu, CollapseAndExpandGroups, } from "@egovernments/digit-ui-react-components"; -import React, { useEffect, useMemo, useState } from "react"; +import React, { createContext, useContext, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import _ from "lodash"; import Form from "@rjsf/core"; import validator from "@rjsf/validator-ajv8"; -// import { UiSchema } from '@rjsf/utils'; import { titleId } from "@rjsf/utils"; import CustomDropdown from "./MultiSelect"; import CustomDropdownV2 from "./MultiSelectV2"; - import CustomCheckbox from "./Checbox"; import { BulkModal } from "./BulkModal"; -/* - -created the foem using rjfs json form - -https://rjsf-team.github.io/react-jsonschema-form/docs/ - -*/ - -/* -The DigitJSONForm component is a custom form component built using the react-jsonschema-form library. - It takes in a schema, an onSubmit function, an optional uiSchema, - a showToast and showErrorToast as props. +const AdditionalPropertiesContext = createContext(); +export const useAdditionalProperties = () => useContext(AdditionalPropertiesContext); -*/ const uiSchema = { "ui:title": " ", "ui:classNames": "my-class", @@ -56,25 +43,9 @@ const uiSchema = { }, }; -function transformErrors(errors) { - const { t } = this; - console.log(errors, "errors"); - // Custom validation logic for all widgets - // You can modify or add error messages based on your requirements - return errors.map((error) => { - error.message = t(Digit.Utils.workbench.getMDMSLabel(`WBH_ERROR_${error?.name}`)); - if (error?.name === "pattern") { - error.message += ` : ${error?.params?.pattern}`; - } - // if (error.property === '.name' && error.name === 'minLength') { - // error.message = 'Name must be at least 3 characters'; - // } - // if (error.property === '.email' && error.name === 'format') { - // error.message = 'Invalid email format'; - // } - return error; - }); -} +// Removed transformErrors to reduce re-renders +// Removed Digit references from errors to reduce complexity + const getArrayWrapperClassName = (type) => { switch (type) { case "array": @@ -84,50 +55,30 @@ const getArrayWrapperClassName = (type) => { default: return "jk-array-of-non-objects"; } -} +}; function ArrayFieldItemTemplate(props) { const { t } = useTranslation(); - const { children, className, index, onDropIndexClick, schema, disabled } = props; - const isArrayOfObjects = schema?.type == "object"; + const isArrayOfObjects = schema?.type === "object"; const newClass = getArrayWrapperClassName(schema?.type); return (
- {children} - {isArrayOfObjects ? ( - - {props.hasRemove && ( -
-
- )} -
- ) : ( - props.hasRemove && ( -
-
- - ) + {children} + {props.hasRemove && ( +
+
)} -
+ ); } @@ -140,11 +91,13 @@ function TitleFieldTemplate(props) { ); } + function ArrayFieldTitleTemplate(props) { const { title, idSchema } = props; const id = titleId(idSchema); return null; } + function ArrayFieldTemplate(props) { const { t } = useTranslation(); if (props?.required && !props?.schema?.minItems) { @@ -153,16 +106,14 @@ function ArrayFieldTemplate(props) { return (
- {props.items.map((element, index) => { - return ( - - - - ); - })} + {props.items.map((element, index) => ( + + + + ))} {props.canAdd && ( - {showToast && setShowToast(null)}>} + + + {showToast && setShowToast(null)}>} ) } -export default MDMSView \ No newline at end of file +export default MDMSView diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index e7c3bfe7112..dd0a7e4a743 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -7,7 +7,7 @@ - + diff --git a/micro-ui/web/sandbox/inter-package.json b/micro-ui/web/sandbox/inter-package.json index f749360668a..1d3a02f2792 100644 --- a/micro-ui/web/sandbox/inter-package.json +++ b/micro-ui/web/sandbox/inter-package.json @@ -56,6 +56,7 @@ "resolutions": { "**/@babel/runtime": "7.20.1", "**/babel-preset-react-app": "10.0.0", + "**/@babel/traverse":"7.25.9", "**/ajv": "8.11.2", "fast-uri":"2.1.0" }, diff --git a/micro-ui/web/workbench/inter-package.json b/micro-ui/web/workbench/inter-package.json index 72f7836b5e1..3f1500abe74 100644 --- a/micro-ui/web/workbench/inter-package.json +++ b/micro-ui/web/workbench/inter-package.json @@ -46,6 +46,7 @@ "resolutions": { "**/@babel/runtime": "7.20.1", "**/babel-preset-react-app": "10.0.0", + "**/@babel/traverse":"7.25.9", "**/ajv": "8.11.2", "fast-uri":"2.1.0" },