@itwin/grouping-mapping-widget 0.6.0 → 0.8.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/README.md +84 -0
- package/lib/cjs/grouping-mapping-widget.d.ts +1 -0
- package/lib/cjs/grouping-mapping-widget.js +3 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.d.ts +2 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +162 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -0
- package/lib/cjs/test/WidgetHeader.test.d.ts +2 -0
- package/lib/cjs/test/WidgetHeader.test.js +36 -0
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -0
- package/lib/cjs/test/test-utils.d.ts +72 -0
- package/lib/cjs/test/test-utils.js +71 -0
- package/lib/cjs/test/test-utils.js.map +1 -0
- package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
- package/lib/cjs/widget/components/GroupAction.js +82 -75
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +1 -13
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js +149 -302
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.scss +82 -8
- package/lib/cjs/widget/components/GroupPropertyUtils.d.ts +21 -0
- package/lib/cjs/widget/components/GroupPropertyUtils.js +287 -0
- package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -0
- package/lib/cjs/widget/components/Grouping.d.ts +5 -0
- package/lib/cjs/widget/components/Grouping.js +107 -44
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +18 -3
- package/lib/cjs/widget/components/GroupingMapping.d.ts +6 -1
- package/lib/cjs/widget/components/GroupingMapping.js +22 -9
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.d.ts +5 -3
- package/lib/cjs/widget/components/HorizontalTile.js +9 -6
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +46 -22
- package/lib/cjs/widget/components/Mapping.scss +4 -5
- package/lib/cjs/widget/components/SelectProject.js +2 -0
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/SortableHorizontalTile.d.ts +8 -0
- package/lib/cjs/widget/components/SortableHorizontalTile.js +51 -0
- package/lib/cjs/widget/components/SortableHorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js +25 -0
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js +9 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +31 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +17 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +97 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +17 -0
- package/lib/esm/grouping-mapping-widget.d.ts +1 -0
- package/lib/esm/grouping-mapping-widget.js +1 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.d.ts +2 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js +138 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -0
- package/lib/esm/test/WidgetHeader.test.d.ts +2 -0
- package/lib/esm/test/WidgetHeader.test.js +31 -0
- package/lib/esm/test/WidgetHeader.test.js.map +1 -0
- package/lib/esm/test/test-utils.d.ts +72 -0
- package/lib/esm/test/test-utils.js +42 -0
- package/lib/esm/test/test-utils.js.map +1 -0
- package/lib/esm/widget/components/GroupAction.d.ts +2 -1
- package/lib/esm/widget/components/GroupAction.js +85 -78
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +1 -13
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.js +151 -304
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.scss +82 -8
- package/lib/esm/widget/components/GroupPropertyUtils.d.ts +21 -0
- package/lib/esm/widget/components/GroupPropertyUtils.js +280 -0
- package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -0
- package/lib/esm/widget/components/Grouping.d.ts +5 -0
- package/lib/esm/widget/components/Grouping.js +107 -44
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +18 -3
- package/lib/esm/widget/components/GroupingMapping.d.ts +6 -1
- package/lib/esm/widget/components/GroupingMapping.js +23 -10
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.d.ts +5 -3
- package/lib/esm/widget/components/HorizontalTile.js +9 -6
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.scss +46 -22
- package/lib/esm/widget/components/Mapping.scss +4 -5
- package/lib/esm/widget/components/SelectProject.js +2 -0
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/SortableHorizontalTile.d.ts +8 -0
- package/lib/esm/widget/components/SortableHorizontalTile.js +30 -0
- package/lib/esm/widget/components/SortableHorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js +20 -0
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js +6 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +26 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +17 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +92 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +17 -0
- package/package.json +24 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/grouping-mapping-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -36,16 +36,22 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@
|
|
39
|
+
"@dnd-kit/core": "^6.0.5",
|
|
40
|
+
"@dnd-kit/sortable": "7.0.1",
|
|
41
|
+
"@dnd-kit/utilities": "3.2.0",
|
|
42
|
+
"@itwin/imodel-browser-react": "^0.12.3",
|
|
40
43
|
"@itwin/insights-client": "^0.3.0",
|
|
41
|
-
"@itwin/itwinui-icons-react": "^1.
|
|
44
|
+
"@itwin/itwinui-icons-react": "^1.15.1",
|
|
42
45
|
"@itwin/itwinui-react": "~1.42.0",
|
|
43
46
|
"classnames": "^2.3.1",
|
|
44
47
|
"cross-fetch": "^3.1.4",
|
|
48
|
+
"fast-equals": "^4.0.2",
|
|
45
49
|
"immer": "^9.0.7",
|
|
50
|
+
"react-split": "2.0.14",
|
|
46
51
|
"simple-react-validator": "^1.6.1"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
54
|
+
"@faker-js/faker": "^7.5.0",
|
|
49
55
|
"@itwin/appui-abstract": "^3.2.0",
|
|
50
56
|
"@itwin/appui-layout-react": "^3.2.0",
|
|
51
57
|
"@itwin/appui-react": "^3.2.0",
|
|
@@ -66,12 +72,18 @@
|
|
|
66
72
|
"@itwin/presentation-components": "^3.2.0",
|
|
67
73
|
"@itwin/presentation-frontend": "^3.2.0",
|
|
68
74
|
"@itwin/webgl-compatibility": "^3.2.0",
|
|
75
|
+
"@testing-library/dom": "^8.12.0",
|
|
76
|
+
"@testing-library/jest-dom": "^5.16.3",
|
|
77
|
+
"@testing-library/react": "^12.1.4",
|
|
78
|
+
"@testing-library/user-event": "^14.1.1",
|
|
69
79
|
"@types/i18next": "^8.4.2",
|
|
80
|
+
"@types/jest": "^27.4.1",
|
|
70
81
|
"@types/node": "^14.14.20",
|
|
71
82
|
"@types/react": "^17.0.19",
|
|
72
83
|
"@types/react-dom": "^17.0.9",
|
|
73
84
|
"@types/react-redux": "^7.0.1",
|
|
74
85
|
"@types/react-table": "^7.7.0",
|
|
86
|
+
"@types/testing-library__jest-dom": "^5.14.3",
|
|
75
87
|
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
76
88
|
"@typescript-eslint/parser": "^5.10.1",
|
|
77
89
|
"cpx2": "^3.0.0",
|
|
@@ -79,12 +91,18 @@
|
|
|
79
91
|
"eslint-plugin-node": "^11.1.0",
|
|
80
92
|
"eslint-plugin-react": "^7.25.1",
|
|
81
93
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
94
|
+
"jest": "^27.5.1",
|
|
95
|
+
"jest-cli": "^27.5.1",
|
|
96
|
+
"jest-transform-stub": "^2.0.0",
|
|
97
|
+
"msw": "^0.39.2",
|
|
82
98
|
"react": "^17.0.2",
|
|
83
99
|
"react-dom": "^17.0.2",
|
|
84
100
|
"react-redux": "^7.2.0",
|
|
85
101
|
"react-table": "^7.7.0",
|
|
86
102
|
"redux": "^4.1.0",
|
|
87
103
|
"rimraf": "^3.0.2",
|
|
104
|
+
"ts-jest": "^27.1.3",
|
|
105
|
+
"typemoq": "^2.1.0",
|
|
88
106
|
"typescript": "~4.3.0"
|
|
89
107
|
},
|
|
90
108
|
"peerDependencies": {
|
|
@@ -114,7 +132,8 @@
|
|
|
114
132
|
"lint:fix": "npm run lint -- --fix",
|
|
115
133
|
"pseudolocalize": "betools pseudolocalize --englishDir ./public/locales/en --out ./public/locales/en-PSEUDO",
|
|
116
134
|
"rebuild": "npm run clean && npm run build",
|
|
117
|
-
"test": ""
|
|
135
|
+
"test": "jest",
|
|
136
|
+
"test:watch": "jest --watch "
|
|
118
137
|
},
|
|
119
|
-
"readme": "# @itwin/grouping-mapping-widget\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved.\r\nThe Grouping Mapping widget is a UI component for iTwin Viewer applications that simplifies how users (and developers) interface with the [Reporting Platform APIs](https://developer.bentley.com/apis/insights/overview/).\r\nThe grouping-mapping-widget package provides a UiProvider class - `GroupingMappingProvider` - which can be passed into the `uiProviders` prop of the iTwin Viewer's `<Viewer />` component.\r\n\r\n## Getting Started\r\n\r\nThis is not a standalone UI and requires a parent iTwin Viewer application to work as intended.\r\nA guide on how to create a basic iTwin Viewer application can be found here: <https://www.itwinjs.org/learning/tutorials/develop-web-viewer/>.\r\nThis package provides a viewer 'widget'. Documentation on how to add a widget to your application can be found here: <https://developer.bentley.com/tutorials/itwin-viewer-hello-world/#2-your-first-ui-widget>.\r\n\r\n## Permissions and Scopes\r\n\r\nThe SPA client used by your iTwin viewer must have these additional scopes:\r\n\r\n- `insights:read`\r\n- `insights:modify`\r\n- `projects:read`\r\n\r\nIn addition, users must have the `imodels_read` and `imodels_write` [permissions](https://developer.bentley.com/apis/insights/operations/create-mapping/#authorization) assigned at either the Project or iModel level. Further instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).\r\n\r\n## Sample usage\r\n\r\n```tsx\r\nimport { GroupingMappingProvider } from \"@itwin/grouping-mapping-widget\";\r\n<Viewer\r\n ...\r\n uiProviders={[new GroupingMappingProvider()]}\r\n/>\r\n```\r\n"
|
|
138
|
+
"readme": "# @itwin/grouping-mapping-widget\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved.\r\nThe Grouping Mapping widget is a UI component for iTwin Viewer applications that simplifies how users (and developers) interface with the [Reporting Platform APIs](https://developer.bentley.com/apis/insights/overview/).\r\nThe grouping-mapping-widget package provides a UiProvider class - `GroupingMappingProvider` - which can be passed into the `uiProviders` prop of the iTwin Viewer's `<Viewer />` component.\r\n\r\n## Getting Started\r\n\r\nThis is not a standalone UI and requires a parent iTwin Viewer application to work as intended.\r\nA guide on how to create a basic iTwin Viewer application can be found here: <https://www.itwinjs.org/learning/tutorials/develop-web-viewer/>.\r\nThis package provides a viewer 'widget'. Documentation on how to add a widget to your application can be found here: <https://developer.bentley.com/tutorials/itwin-viewer-hello-world/#2-your-first-ui-widget>.\r\n\r\n## Permissions and Scopes\r\n\r\nThe SPA client used by your iTwin viewer must have these additional scopes:\r\n\r\n- `insights:read`\r\n- `insights:modify`\r\n- `projects:read`\r\n\r\nIn addition, users must have the `imodels_read` and `imodels_write` [permissions](https://developer.bentley.com/apis/insights/operations/create-mapping/#authorization) assigned at either the Project or iModel level. Further instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).\r\n\r\n## Sample usage\r\n\r\n```tsx\r\nimport { GroupingMappingProvider } from \"@itwin/grouping-mapping-widget\";\r\n<Viewer\r\n ...\r\n uiProviders={[new GroupingMappingProvider()]}\r\n/>\r\n```\r\n\r\n## Custom UI\r\n\r\nThis package provides an interface to define your own custom UI or callback functions in grouping mapping widget. There are different types of custom UIs provided.\r\n\r\n### Grouping Custom UI\r\n\r\nYou can use your own UI component to define group creation method.\r\n\r\nAn example of grouping custom UI, [ManualGroupingCustomUI](https://github.com/iTwin/viewer-components-react/blob/master/packages/itwin/grouping-mapping-widget/src/widget/components/customUI/ManualGroupingCustomUI.tsx) helps user to manually define ECSQL query for groups.\r\n\r\nIn `GroupingCustomUIProps`:\r\n\r\n- `updateQuery` is used to run the query and visualize results in the viewer.\r\n- `isUpdating` keeps track of the status of query execution.\r\n- `resetView` enables you to reset the viewer state.\r\n\r\nTo configure your own grouping custom UI, you need to give it:\r\n\r\n- a `type` as `GroupingMappingCustomUIType.Grouping`\r\n- a `name` as identifier\r\n- a `displayLabel` which will be shown in the 'Add Group' dropdown list\r\n- a `uiComponent` like above\r\n- an optional `icon`\r\n\r\nYou can define your UI provider as follows in the GroupingMappingProvider:\r\n\r\n```tsx\r\nnew GroupingMappingProvider({\r\n customUIs: [\r\n {\r\n type: GroupingMappingCustomUIType.Grouping,\r\n name: \"Manual\",\r\n displayLabel: \"Manual Query\",\r\n uiComponent: ManualGroupingCustomUI,\r\n icon: <SvgDraw />,\r\n },\r\n ],\r\n});\r\n```\r\n\r\nAfter adding the grouping custom UI, it will be presented in the 'Add Group' drop down list.\r\n\r\n\r\n\r\n### Context Custom UI\r\n\r\nYou can also add custom UI in context menu for each group. This could be UI driven interaction or simply a callback function to execute your own code.\r\n\r\nYou can use the `iModelId`, `mappingId` and `groupId` in `ContextCustomUIProps` provided by Grouping Mapping Widget in your UI component or callback.\r\n\r\nTo configure your own context custom UI, you need to give it:\r\n\r\n- a `type` as `GroupingMappingCustomUIType.Context`\r\n- a `name` as identifier\r\n- a `displayLabel` which will be shown in the context dropdown list in each group tile\r\n- an optional `uiComponent` which will be presented in the widget as a UI component\r\n- an optional `onClick` callback function where you could make your own API calls\r\n- an optional `icon`\r\n\r\nYou can define your context custom UI as following example in the GroupingMappingProvider with an example is to use [clash detection](https://www.itwinjs.org/sandboxes/iTwinPlatform/Clash%20Review) in the widget:\r\n\r\n```tsx\r\nconst customCB = (groupId: string, mappingId: string, iModelId: string) => {\r\n toaster.informational(`Called callback for group ${groupId}`)\r\n}\r\n\r\nnew GroupingMappingProvider({\r\n customUIs: [\r\n {\r\n type: GroupingMappingCustomUIType.Context,\r\n name: \"ClashDetection\",\r\n displayLabel: \"Clash Detection\",\r\n uiComponent: ClashDetectionCustomUI,\r\n onClick: customCB,\r\n icon: <SvgClash />,\r\n },\r\n ],\r\n});\r\n```\r\n\r\nAfter adding the context custom UI, the context menu item will look like this with additional `Clash Detection` menu item.\r\n\r\n\r\n"
|
|
120
139
|
}
|