@siemens/ix-react 1.0.0 → 1.1.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Siemens AG
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Siemens iX React Components
2
+
3
+ This library is part of the Siemens iX mono repository.
4
+ You can find the root README [here](https://github.com/siemens/ix/blob/main/README.md)
package/dist/index.esm.js CHANGED
@@ -367,12 +367,14 @@ async function showToast(config) {
367
367
  const InternalIxTree = /*@__PURE__*/ createReactComponent('ix-tree');
368
368
  const IxTree = (props) => {
369
369
  const cachedRootNodes = useRef(new Map());
370
- const renderItem = useCallback((_, data, __, context
371
- // update: (callback: UpdateCallback) => void
372
- ) => {
370
+ const renderItem = useCallback((_, data, __, context, update) => {
373
371
  const treeItem = document.createElement('ix-tree-item');
374
372
  treeItem.hasChildren = data.hasChildren;
375
- treeItem.context = context;
373
+ treeItem.context = context[data.id];
374
+ update((itemData, context) => {
375
+ treeItem.context = context[itemData.id];
376
+ treeItem.hasChildren = itemData.hasChildren;
377
+ });
376
378
  const container = document.createElement('DIV');
377
379
  const rootNode = ReactDOMClient.createRoot(container);
378
380
  if (props.renderItem) {
package/dist/index.js CHANGED
@@ -376,12 +376,14 @@ async function showToast(config) {
376
376
  const InternalIxTree = /*@__PURE__*/ createReactComponent('ix-tree');
377
377
  const IxTree = (props) => {
378
378
  const cachedRootNodes = React.useRef(new Map());
379
- const renderItem = React.useCallback((_, data, __, context
380
- // update: (callback: UpdateCallback) => void
381
- ) => {
379
+ const renderItem = React.useCallback((_, data, __, context, update) => {
382
380
  const treeItem = document.createElement('ix-tree-item');
383
381
  treeItem.hasChildren = data.hasChildren;
384
- treeItem.context = context;
382
+ treeItem.context = context[data.id];
383
+ update((itemData, context) => {
384
+ treeItem.context = context[itemData.id];
385
+ treeItem.hasChildren = itemData.hasChildren;
386
+ });
385
387
  const container = document.createElement('DIV');
386
388
  const rootNode = ReactDOMClient__default["default"].createRoot(container);
387
389
  if (props.renderItem) {
package/package.json CHANGED
@@ -1,11 +1,20 @@
1
1
  {
2
2
  "name": "@siemens/ix-react",
3
- "version": "1.0.0",
3
+ "homepage": "https://ix.siemens.io",
4
+ "bugs": "https://github.com/siemens/ix/issues",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/siemens/ix",
8
+ "directory": "packages/react"
9
+ },
10
+ "version": "1.1.0-beta.1",
4
11
  "description": "Siemens iX for React",
5
12
  "main": "dist/index.js",
6
13
  "module": "dist/index.esm.js",
7
14
  "types": "dist/types/index.d.ts",
8
15
  "files": [
16
+ "LICENSE",
17
+ "README.md",
9
18
  "dist"
10
19
  ],
11
20
  "scripts": {
@@ -18,7 +27,7 @@
18
27
  "license": "MIT",
19
28
  "devDependencies": {
20
29
  "@rollup/plugin-typescript": "^8.4.0",
21
- "@siemens/ix": "~1.0.0",
30
+ "@siemens/ix": "~1.1.0-beta.1",
22
31
  "@types/estree": "~0.0.51",
23
32
  "@types/react": "~18.0.15",
24
33
  "@types/react-dom": "~18.0.6",
@@ -38,6 +47,6 @@
38
47
  },
39
48
  "dependencies": {
40
49
  "@siemens/ix-icons": "~1.0.0",
41
- "@siemens/ix": "~1.0.0"
50
+ "@siemens/ix": "~1.1.0-beta.1"
42
51
  }
43
52
  }