Skip to content

Commit

Permalink
Merge pull request #6 from agentlab/amivanoff/issue5
Browse files Browse the repository at this point in the history
GH-5 Move UI structure, CollConstrs and data mapping to the ViewKind
  • Loading branch information
amivanoff authored Aug 16, 2021
2 parents 9391ccc + 5fdbebc commit 95be563
Show file tree
Hide file tree
Showing 58 changed files with 2,620 additions and 2,386 deletions.
7 changes: 4 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = {
},
],
// https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
//typescript: {
// check: true, // type-check stories during Storybook build
//}
typescript: {
check: false, // type-check stories during Storybook build
reactDocgen: false, //'react-docgen-typescript',
},
};
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"ryu1kn.partial-diff",
"vscode-icons-team.vscode-icons"
"vscode-icons-team.vscode-icons",
"syler.sass-indented",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-russian",
"github.vscode-pull-request-github"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"request": "launch",
"name": "Launch Storybook in Chrome",
"breakOnLoad": true,
"url": "http://localhost:6006/?path=/story/several-controls-treeandform-mktp--empty",
"url": "http://localhost:6006/?path=/story/several-controls-treeandform-cards--empty",
"sourceMaps": true,
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
Expand Down
41 changes: 40 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,44 @@
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.endOfLine": "lf",
"jest.autoRun": "off"
"jest.autoRun": "off",
"cSpell.words": [
"A",
"Aртефакт",
"Constrs",
"Descr",
"Descrs",
"Individ",
"Interp",
"Intrnl",
"Modifiability",
"Rubberband",
"SHACL",
"SPDX",
"Scroller",
"Subcat",
"agentlab",
"aldkg",
"antd",
"antv",
"collapsable",
"colls",
"dcterms",
"dryrun",
"jsld",
"jumpover",
"ldkg",
"middlewares",
"mktp",
"oslc",
"pannable",
"plotly",
"pporoles",
"remotedev",
"sider",
"sparql",
"undelegate",
"uuidv"
],
"cSpell.language": "en,ru"
}
107 changes: 62 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
{
"name": "@agentlab/ldkg-ui-react",
"version": "0.1.11",
"version": "0.1.12",
"description": "LDKG Forms UI Components",
"license": "GPL-3.0",
"author": "Alexey Ivanov <amivanoff@gmail.com>",
"contributors": [
"Alexey Ivanov <amivanoff@gmail.com>",
"Artkrygin"
],
"keywords": [
"react",
"antd",
"forms",
"ui",
"sparql",
"json-ld",
"json-schema"
],
"homepage": "https://github.com/agentlab/ldkg-ui-react#README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/agentlab/ldkg-ui-react.git"
},
"bugs": {
"url": "https://github.com/agentlab/ldkg-ui-react/issues"
},
"main": "es/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
Expand All @@ -33,11 +50,11 @@
"lint-staged": "lint-staged"
},
"peerDependencies": {
"@agentlab/sparql-jsld-client": ">=5.0.0-rc.9",
"@agentlab/sparql-jsld-client": ">=5.0.0-rc.10",
"@ant-design/icons": ">=4.6.2",
"@tinymce/tinymce-react": ">=3.12.6",
"antd": ">=4.16.5",
"history": ">=5.0.0",
"antd": ">=4.16.11",
"history": ">=5.0.1",
"lodash-es": ">=4.17.21",
"mobx": ">=6.3.2",
"mobx-react-lite": ">=3.2.0",
Expand All @@ -49,23 +66,23 @@
"react-router": ">=6.0.0-beta.0",
"react-router-dom": ">=6.0.0-beta.0",
"react-virtualized": ">=9.22.3",
"rc-util": ">=5.13.1",
"rc-util": ">=5.13.2",
"react-split-pane": ">=2.0.3",
"tinymce": ">=5.5.1",
"uri-js": ">=4.4.1"
},
"dependencies": {
"@agentlab/sparql-jsld-client": "^5.0.0-rc.9",
"@agentlab/sparql-jsld-client": "^5.0.0-rc.10",
"@ant-design/icons": "^4.6.2",
"@tinymce/tinymce-react": "^3.12.6",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"@types/react-router": "^5.1.15",
"@types/react-router-dom": "^5.1.7",
"@types/react-virtualized": "^9.21.11",
"@types/tinymce": "^4.6.2",
"antd": "^4.16.5",
"history": "^5.0.0",
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.8",
"@types/react-virtualized": "^9.21.13",
"@types/tinymce": "^4.6.4",
"antd": "^4.16.11",
"history": "^5.0.1",
"mobx-react-lite": "^3.2.0",
"mst-middlewares": "^5.0.2",
"react": "^17.0.2",
Expand All @@ -76,64 +93,64 @@
"react-router": "^6.0.0-beta.0",
"react-router-dom": "^6.0.0-beta.0",
"react-virtualized": "^9.22.3",
"redux": "^4.1.0",
"redux": "^4.1.1",
"remotedev": "^0.2.9",
"react-split-pane": "^2.0.3",
"tinymce": "5.5.1",
"uri-js": "^4.4.1"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-typescript": "^8.2.1",
"@storybook/addon-actions": "^6.3.0",
"@storybook/addon-essentials": "^6.3.0",
"@storybook/addon-links": "^6.3.0",
"@storybook/addons": "^6.3.0",
"@storybook/node-logger": "^6.3.0",
"@babel/core": "^7.15.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-typescript": "^8.2.5",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-essentials": "^6.3.7",
"@storybook/addon-links": "^6.3.7",
"@storybook/addons": "^6.3.7",
"@storybook/node-logger": "^6.3.7",
"@storybook/preset-ant-design": "^0.0.2",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react": "^6.3.0",
"@storybook/react": "^6.3.7",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.1.9",
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"autoprefixer": "^10.2.6",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"autoprefixer": "^10.3.1",
"babel-loader": "^8.2.2",
"cross-env": "^7.0.3",
"cssnano": "^5.0.4",
"eslint": "^7.29.0",
"cssnano": "^5.0.7",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.7.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-flowtype": "^5.9.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^6.0.0",
"jest": "^27.0.5",
"husky": "^7.0.1",
"jest": "^27.0.6",
"jest-watch-typeahead": "^0.6.4",
"lint-staged": "^11.0.0",
"prettier": "^2.3.1",
"postcss": "^8.3.0",
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"postcss": "^8.3.6",
"rimraf": "^3.0.2",
"rollup": "^2.52.3",
"rollup": "^2.56.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.32.12",
"sass-loader": "10.1.1",
"storybook-css-modules-preset": "^1.1.1",
"style-loader": "^2.0.0",
"ts-jest": "^27.0.3",
"tslib": "^2.3.0",
"typescript": "4.2.4",
"ts-jest": "^27.0.4",
"tslib": "^2.3.1",
"typescript": "4.3.5",
"typescript-plugin-css-modules": "^3.4.0"
},
"lint-staged": {
Expand Down
32 changes: 10 additions & 22 deletions src/DispatchCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,17 @@ import { MstContext } from './MstContext';
* Dispatch renderer component for cells.
*/
export const DispatchCell: React.FC<DispatchCellProps> = React.memo(
({
data,
uischema,
onMeasureChange,
uri,
schema,
viewElement,
view,
enabled,
id,
parent,
CKey,
rowData,
...rest
}) => {
({ data, onMeasureChange, uri, schema, viewKindElement, viewKind, enabled, id, CKey, rowData, ...rest }) => {
const { cells } = useContext(MstContext);
const renderer = maxBy(cells, (r) => r.tester(viewElement, schema));
if (renderer === undefined || renderer.tester(viewElement, schema) === -1) {
const renderer = maxBy(cells, (r) => r.tester(viewKindElement, schema));
if (renderer === undefined || renderer.tester(viewKindElement, schema) === -1) {
return (
<td>
<UnknownRenderer type={'renderer'} />
<UnknownRenderer
type={'renderer'}
elementId={viewKindElement['@id']}
elementType={viewKindElement['@type']}
/>
</td>
);
} else {
Expand All @@ -51,14 +41,12 @@ export const DispatchCell: React.FC<DispatchCellProps> = React.memo(
data={data}
rowData={rowData}
onMeasureChange={onMeasureChange}
uischema={uischema}
schema={schema}
viewElement={viewElement}
viewKindElement={viewKindElement}
uri={uri}
enabled={enabled}
view={view}
viewKind={viewKind}
id={id}
parent={parent}
{...rest}
/>
</ErrorBoundary>
Expand Down
Loading

0 comments on commit 95be563

Please sign in to comment.