Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish new navigation apis for Gallery #2979

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion js-wixcode-sdk/$w.service.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ "name": "$w",
"mixes": [],
"labels": [],
"labels":
[ "changed" ],
"location":
{ "lineno": 1,
"filename": "wixCode.js" },
Expand Down Expand Up @@ -486,6 +487,27 @@
{ } },
"extra":
{ } },
{ "name": "GalleryNavigationStartEventHandler",
"labels":
[ "new" ],
"nameParams": [],
"params":
[ { "name": "event",
"type": "$w.GalleryNavigationStartEvent",
"doc": "The event that has occurred." } ],
"ret":
{ "type": "void" },
"locations":
[ { "lineno": 1,
"filename": "GalleryNavigationStartEvent.js" } ],
"docs":
{ "summary": "Handles events fired when a gallery starts navigation.",
"links": [],
"examples": [],
"extra":
{ } },
"extra":
{ } },
{ "name": "GoogleMapClickEvent",
"labels":
[ "removed" ],
Expand Down
184 changes: 181 additions & 3 deletions js-wixcode-sdk/$w/Gallery.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[ "$w.Element",
"$w.HiddenCollapsedMixin",
"$w.PlayableMixin" ],
"labels": [],
"labels":
[ "changed" ],
"location":
{ "lineno": 43,
"filename": "BaseGallery.js" },
Expand Down Expand Up @@ -422,7 +423,103 @@
"extra":
{ } } ],
"operations":
[ { "name": "onCurrentItemChanged",
[ { "name": "navigateNextEnabled",
"labels":
[ "new" ],
"nameParams": [],
"params": [],
"ret":
{ "type": "boolean" },
"locations":
[ { "lineno": 444,
"filename": "BaseGallery.js" } ],
"docs":
{ "summary": "Whether navigation to the next gallery item is enabled.",
"description":
[ "The `navigateNextEnabled()` function returns `true` when the gallery can navigate to the next item (slide).",
" ",
"If the gallery isn't set to loop in the UI settings, and the current item is the last one, the gallery can't navigate to the next item. In this case, the `navigateNextEnabled()` function returns `false`." ],
"links": [],
"examples":
[ { "title": "Get whether navigation to the next item is enabled",
"body":
[ "let isNavigationNextEnabled = $w(\"#myGallery\").navigateNextEnabled(); // false" ],
"extra":
{ } } ],
"extra":
{ } },
"extra":
{ } },
{ "name": "navigatePreviousEnabled",
"labels":
[ "new" ],
"nameParams": [],
"params": [],
"ret":
{ "type": "boolean" },
"locations":
[ { "lineno": 455,
"filename": "BaseGallery.js" } ],
"docs":
{ "summary": "Whether navigation to the previous gallery item is enabled.",
"description":
[ "The `navigatePreviousEnabled()` function returns `true` when the gallery can navigate to the previous item (slide).",
" ",
"If the gallery isn't set to loop in the UI settings, and the current item is the first one, the gallery can't navigate to the previous item. In this case, the `navigatePreviousEnabled()` function returns `false`." ],
"links": [],
"examples":
[ { "title": "Get whether navigation to the previous item is enabled",
"body":
[ "let isNavigationPreviousEnabled = $w(\"#myGallery\").navigatePreviousEnabled(); // false" ],
"extra":
{ } } ],
"extra":
{ } },
"extra":
{ } },
{ "name": "navigateToIndex",
"labels":
[ "new" ],
"nameParams": [],
"params":
[ { "name": "index",
"type": "number",
"doc": "Gallery item index to navigate to." },
{ "name": "animationDuration",
"type": "number",
"doc": "Animation duration in milliseconds. \nDefault: `400`",
"optional": true } ],
"ret":
{ "type": "void" },
"locations":
[ { "lineno": 466,
"filename": "BaseGallery.js" } ],
"docs":
{ "summary": "Navigates to a specific gallery item index.",
"description":
[ "The `navigateToIndex()` function navigates to the specified item's index.",
"",
"Use the `animationDuration` parameter to set the speed of slide transitions during navigation." ],
"links": [],
"examples":
[ { "title": "Navigate to gallery item 10 (index 9)",
"body":
[ "$w(\"#myGallery\").navigateToIndex(9); // gallery item 10" ],
"extra":
{ } },
{ "title": "Navigate to gallery item 10 with an animation duration",
"body":
[ "$w(\"#myGallery\").navigateToIndex(9, 250)",
" .then(() => {",
" console.log(\"Finished navigating to the specified item.\");",
" });" ],
"extra":
{ } } ],
"extra":
{ } },
"extra":
{ } },
{ "name": "onCurrentItemChanged",
"labels": [],
"nameParams": [],
"params":
Expand Down Expand Up @@ -463,6 +560,56 @@
{ } },
"extra":
{ "eventType": "imageChanged" } },
{ "name": "onGalleryNavigationStart",
"labels":
[ "new" ],
"nameParams": [],
"params":
[ { "name": "handler",
"type": "$w.GalleryNavigationStartEventHandler",
"doc": "The name of the function or\nthe function expression to run when the gallery starts navigation." } ],
"ret":
{ "type": "void" },
"locations":
[ { "lineno": 495,
"filename": "BaseGallery.js" } ],
"docs":
{ "summary": "Adds an event handler that runs when the gallery starts navigation.",
"description":
[ "You can use `onGalleryNavigationStart()` event handler to trigger an action when gallery navigation starts. For example, synchronizing the scrolling of 2 galleries." ],
"links": [],
"examples":
[ { "title": "Get information about the gallery when navigation starts",
"body":
[ "$w('#myGallery').onGalleryNavigationStart( (event) => {",
" const animationDuration = event.animationDuration;",
" const autoplay = event.autoplay;",
"});",
"",
"/* Full event object:",
" * {",
" * \"target\": \"$w('#myGallery')\",",
" * \"animationDuration\": 400, ",
" * \"continuousScroll\": false, ",
" * \"autoplay\": true,",
" * \"currentIndex\": 1, ",
" * \"scrollDirection\": \"HORIZONTAL\",",
" * \"slideTransition\": \"cubic-bezier(0.46,0.1,0.25,1)\"",
" * }",
" */" ],
"extra":
{ } },
{ "title": "Sync the navigation of 2 galleries",
"body":
[ "$w('#myGallery1').onGalleryNavigationStart( (event) => {",
" $w('#myGallery2').navigateToIndex(event.currentIndex, 0);",
"});" ],
"extra":
{ "description": "When the first gallery starts navigation, navigate the second gallery to the same item index as the first gallery." } } ],
"extra":
{ } },
"extra":
{ } },
{ "name": "onItemClicked",
"labels": [],
"nameParams": [],
Expand Down Expand Up @@ -499,7 +646,38 @@
"extra":
{ } },
"extra":
{ "eventType": "itemClicked" } } ],
{ "eventType": "itemClicked" } },
{ "name": "triggerItemClick",
"labels":
[ "new" ],
"nameParams": [],
"params":
[ { "name": "itemIndex",
"type": "number",
"doc": "Index of the gallery item on which to trigger a click event. \nDefault: [`currentIndex`](#currentindex)",
"optional": true } ],
"ret":
{ "type": "void" },
"locations":
[ { "lineno": 481,
"filename": "BaseGallery.js" } ],
"docs":
{ "summary": "Triggers a click event on the specified gallery item.",
"description":
[ "The `triggerItemClick()` function triggers a click event on the specified item in the gallery. ",
"",
"If `itemIndex` isn't specified, the function triggers a click event on the [`currentIndex`](#currentindex) value." ],
"links": [],
"examples":
[ { "title": "Trigger a click event on gallery item 1 (index 0)",
"body":
[ "$w('#myGallery').triggerItemClick(0); // click event on gallery item 1" ],
"extra":
{ } } ],
"extra":
{ } },
"extra":
{ } } ],
"callbacks": [],
"messages":
[ { "name": "GalleryCapabilities",
Expand Down
Loading
Loading