Skip to content

Commit

Permalink
Merge pull request #205 from RXNT/ED-6474_-_update_collapsible_field_…
Browse files Browse the repository at this point in the history
…for_bulk_delete

Ed 6474   update collapsible field for bulk delete
  • Loading branch information
cheeverm authored Mar 2, 2022
2 parents c8fe25a + fb358f7 commit 4b480bc
Show file tree
Hide file tree
Showing 13 changed files with 758 additions and 455 deletions.
69 changes: 43 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"description": "Extra widgets for Mozilla's react-jsonschema-form",
"private": false,
"author": "[email protected]",
"version": "0.9.67",
"version": "0.9.68",
"scripts": {
"build:lib": "rimraf lib && cross-env NODE_ENV=production babel -d lib/ src/",
"build:dist": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.dist.js --optimize-minimize",
"build:playground": "rimraf build && cross-env NODE_ENV=production webpack --config webpack.config.prod.js --optimize-minimize && cp playground/index.prod.html build/index.html",
"cs-check": "prettier -l $npm_package_prettierOptions '{playground,src,test}/**/*.js'",
"cs-format": "prettier $npm_package_prettierOptions '{playground,src,test}/**/*.js' --write",
"dist": "npm run build:lib && npm run build:dist",
"lint": "eslint src test playground",
"lint": "eslint --fix src test playground",
"precommit": "lint-staged",
"publish-to-gh-pages": "npm run build:playground && gh-pages --dist build/",
"publish-to-npm": "npm run dist && npm publish && npm version patch",
Expand Down Expand Up @@ -95,6 +95,7 @@
"istanbul-reports": "1.1.4",
"jest": "^23.6.0",
"jsdom": "^11.12.0",
"json-rules-engine-simplified": "^0.1.17",
"lint-staged": "^6.0.0",
"moment": "^2.20.1",
"prettier": "^1.7.4",
Expand All @@ -104,6 +105,7 @@
"react-day-picker": "^7.0.5",
"react-dom": "^16.0.0",
"react-jsonschema-form": "^1.0.0",
"react-jsonschema-form-conditionals": "^0.3.15",
"react-rte": "^0.15.0",
"react-test-renderer": "^16.0.0",
"react-transform-catch-errors": "^1.0.2",
Expand Down
36 changes: 21 additions & 15 deletions playground/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Form from "react-jsonschema-form";
import typeahead from "./order";
import medications from "./medications";
import typeaheadNonExpandable from "./typeaheadNonExpandable";
import rte from "./rte";
import datePicker from "./react-date-picker";
import rte2 from "./rte2";
import dx from "./dx";
Expand All @@ -18,6 +17,8 @@ import aTypeahead from "./asyncTypeahead";
import formContextField from "./formContextField";
import SignatureCheckbox from "./formContextField/SignatureCheckbox";
import procedureCodes from "./procedureCodes";
import applyRules from "react-jsonschema-form-conditionals";
import Engine from "json-rules-engine-simplified";

const ALL_CONFS = [
label,
Expand All @@ -27,40 +28,45 @@ const ALL_CONFS = [
typeaheadNonExpandable,
medications,
typeahead,
rte(),
dx,
ros,
simpleLabel,
aTypeahead,
formContextField,
procedureCodes,
procedureCodes
];

export default function App() {
let handleChange = ({ formData }) => console.log(JSON.stringify(formData));
let formContext = {
legends: {
LanguageLegend: props => <h1>Expected {props.language} characters</h1>,
LanguageLegend: props => <h1>Expected {props.language} characters</h1>
},
allActions: {
SignatureComponent: props => <SignatureCheckbox {...props} />,
Button: props => (
<a className="btn btn-info pull-right">Update allergies</a>
),
},
)
}
};

return (
<div>
{ALL_CONFS.map((conf, i) => (
<Form
key={i}
{...conf}
fields={fields}
onChange={handleChange}
formContext={formContext}
/>
))}
{ALL_CONFS.map((conf, i) => {
let { schema, uiSchema, formData, rules = [] } = conf;
let FormToDisplay = applyRules(schema, uiSchema, rules, Engine)(Form);

return (
<FormToDisplay
key={i}
{...conf}
fields={fields}
onChange={handleChange}
formData={formData}
formContext={formContext}
/>
);
})}
</div>
);
}
10 changes: 6 additions & 4 deletions playground/app/medications/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import schema from "./schema";
import uiSchema from "./uiSchema";
import rules from "./rules.json";

export default {
schema,
uiSchema,
...rules,
formData: {
medicationData: {
medications: [
{ drugId: 0, quantity: 21, useGeneric: true, isSelected: true },
{ drugId: 1, quantity: 22, useGeneric: true, isSelected: true },
{ drugId: 3, quantity: 23, useGeneric: true, isSelected: true },
{ drugId: 1, quantity: 24, useGeneric: true, isSelected: true },
],
},
},
{ drugId: 1, quantity: 24, useGeneric: true, isSelected: true }
]
}
}
};
15 changes: 15 additions & 0 deletions playground/app/medications/rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"rules": [
{
"conditions": {
"medicationData$medications_no_active": "truthy"
},
"event": {
"type": "remove",
"params": {
"field": "medicationData.medications"
}
}
}
]
}
Loading

0 comments on commit 4b480bc

Please sign in to comment.