diff --git a/CHANGELOG.md b/CHANGELOG.md index 9882795..a34306c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ## Dev +### Added + +* **client-api**: Add `resetFilters` and `resetExclusions` calls, requires minimum Graphistry version 2.42.18 +* **client-api**: Add `playUpdates` observer which creates event when graph simulation completes +* **client-api-react**: Add `onPlayComplete` callback property + ## 5.1.4 - 2025-05-29 ### Added * **client-api-react**: Add `pointStrokeWidth` and `showCollections` bindings -* **client-api**: Add `playUpdates` observer which creates event when graph simulation completes -* **client-api-react**: Add `onPlayComplete` callback property ### Security diff --git a/lerna.json b/lerna.json index 82d03e2..26c8218 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "5.1.4", + "version": "5.1.5", "packages": [ "projects/client-api", "projects/client-api-react", diff --git a/projects/client-api-react/package-lock.json b/projects/client-api-react/package-lock.json index 3c94ea7..00e2a13 100644 --- a/projects/client-api-react/package-lock.json +++ b/projects/client-api-react/package-lock.json @@ -1,15 +1,15 @@ { "name": "@graphistry/client-api-react", - "version": "5.1.4", + "version": "5.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@graphistry/client-api-react", - "version": "5.1.4", + "version": "5.1.5", "license": "ISC", "dependencies": { - "@graphistry/client-api": "^5.1.4", + "@graphistry/client-api": "^5.1.5", "crypto-browserify": "3.12.0", "prop-types": ">=15.6.0", "shallowequal": "1.1.0", diff --git a/projects/client-api-react/package.json b/projects/client-api-react/package.json index 54e8ef6..f6e7d49 100644 --- a/projects/client-api-react/package.json +++ b/projects/client-api-react/package.json @@ -1,6 +1,6 @@ { "name": "@graphistry/client-api-react", - "version": "5.1.4", + "version": "5.1.5", "repository": { "type": "git", "url": "git+https://github.com/graphistry/graphistry-js.git" @@ -69,7 +69,7 @@ "author": "Graphistry, Inc ", "license": "ISC", "dependencies": { - "@graphistry/client-api": "^5.1.4", + "@graphistry/client-api": "^5.1.5", "crypto-browserify": "3.12.0", "prop-types": ">=15.6.0", "shallowequal": "1.1.0", diff --git a/projects/client-api-react/src/bindings.js b/projects/client-api-react/src/bindings.js index f452b71..f6dfcc4 100644 --- a/projects/client-api-react/src/bindings.js +++ b/projects/client-api-react/src/bindings.js @@ -126,7 +126,9 @@ const bindings = // TODO: infer this from chainList in client-api const calls = bindings.map(b => b.jsCommand).filter(Boolean).concat([ 'setSelectionExternal', - 'setHighlightExternal' + 'setHighlightExternal', + 'resetFilters', + 'resetExclusions' ]) export { bindings, panelNames, calls }; \ No newline at end of file diff --git a/projects/client-api-react/src/stories/GraphistryJS.stories.jsx b/projects/client-api-react/src/stories/GraphistryJS.stories.jsx index ab99873..fdae251 100644 --- a/projects/client-api-react/src/stories/GraphistryJS.stories.jsx +++ b/projects/client-api-react/src/stories/GraphistryJS.stories.jsx @@ -8,6 +8,8 @@ import { updateSetting, addFilters, addExclusions, + resetFilters, + resetExclusions, togglePanel, toggleToolbar, toggleHistograms, @@ -294,6 +296,46 @@ export const setFilters = { }, }; +export const ResetFilters = { + render: (args) => { + const iframe = useRef(null); + const [messages, setMessages] = useState(['loading...']); + + useEffect(() => { + //////// Instantiate GraphistryJS for an iframe + const sub = + (graphistryJS(iframe.current) + .pipe( + tap(() => + setMessages((arr) => arr.concat([`graphistryJS instantiated; pausing 3s...`])) + ), + delay(3000), + tap(() => setMessages((arr) => arr.concat([`adding filters`]))), + addFilters( + args.filters || ['point:community_infomap in (4, 5, 6)', 'point:degree > 1'] + ), + addExclusions(args.exclusions || ['edge:id = 1']), + togglePanel('filters', false), + tap(() => setMessages((arr) => arr.concat([`pausing before removing filters`]))), + delay(3000), + tap(() => setMessages((arr) => arr.concat([`removing filters`]))), + resetFilters(), + resetExclusions() + ) + .subscribe(() => null), + (err) => setMessages((arr) => arr.concat([`Error: ${err}`])), + () => setMessages((arr) => arr.concat(['Completed']))); + //////// + return () => (sub.unsubscribe ? sub.unsubscribe() : null); + }, [iframe]); + + return <> +