- Notifications
You must be signed in to change notification settings - Fork286
Add Map Mode for NavComponent#2038
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
30f2923 [Fix]: #2021 add map mode for NAV
iamfaran6741bf5 update Menu Items name
iamfaranbd23748 [Feat]: #2021 add disabled property for nav
iamfaran8dc2af3 [Fix]: #2021 import nav app data issue
iamfaran18fadd6 [Fix]: #2021 disabled for the submenu item
iamfaran1d86562 refactor navComp
iamfaranFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
77 changes: 77 additions & 0 deletionsclient/packages/lowcoder/src/comps/comps/navComp/components/NavItemsControl.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { BoolCodeControl, StringControl } from "comps/controls/codeControl"; | ||
| import { clickEvent, eventHandlerControl } from "comps/controls/eventHandlerControl"; | ||
| import { MultiCompBuilder } from "comps/generators/multi"; | ||
| import { dropdownControl } from "comps/controls/dropdownControl"; | ||
| import { mapOptionsControl } from "comps/controls/optionsControl"; | ||
| import { trans } from "i18n"; | ||
| import { navListComp } from "../navItemComp"; | ||
| import { controlItem } from "lowcoder-design"; | ||
| import { menuPropertyView } from "./MenuItemList"; | ||
| export function createNavItemsControl() { | ||
| const OptionTypes = [ | ||
| { label: trans("prop.manual"), value: "manual" }, | ||
| { label: trans("prop.map"), value: "map" }, | ||
| ] as const; | ||
| const NavMapOption = new MultiCompBuilder( | ||
| { | ||
| label: StringControl, | ||
| hidden: BoolCodeControl, | ||
| disabled: BoolCodeControl, | ||
| active: BoolCodeControl, | ||
| onEvent: eventHandlerControl([clickEvent]), | ||
| }, | ||
| (props) => props | ||
| ) | ||
| .setPropertyViewFn((children) => ( | ||
| <> | ||
| {children.label.propertyView({ label: trans("label"), placeholder: "{{item}}" })} | ||
| {children.active.propertyView({ label: trans("navItemComp.active") })} | ||
| {children.hidden.propertyView({ label: trans("hidden") })} | ||
| {children.disabled.propertyView({ label: trans("disabled") })} | ||
| {children.onEvent.getPropertyView()} | ||
| </> | ||
| )) | ||
| .build(); | ||
| const TmpNavItemsControl = new MultiCompBuilder( | ||
| { | ||
| optionType: dropdownControl(OptionTypes, "manual"), | ||
| manual: navListComp(), | ||
| mapData: mapOptionsControl(NavMapOption), | ||
| }, | ||
| (props) => { | ||
| return props.optionType === "manual" ? props.manual : props.mapData; | ||
| } | ||
| ) | ||
| .setPropertyViewFn(() => { | ||
| throw new Error("Method not implemented."); | ||
| }) | ||
| .build(); | ||
| return class NavItemsControl extends TmpNavItemsControl { | ||
| exposingNode() { | ||
| return this.children.optionType.getView() === "manual" | ||
| ? (this.children.manual as any).exposingNode() | ||
| : (this.children.mapData as any).exposingNode(); | ||
| } | ||
| propertyView() { | ||
| const isManual = this.children.optionType.getView() === "manual"; | ||
| const content = isManual | ||
| ? menuPropertyView(this.children.manual as any) | ||
| : this.children.mapData.getPropertyView(); | ||
| return controlItem( | ||
| { searchChild: true }, | ||
| <> | ||
| {this.children.optionType.propertyView({ radioButton: true, type: "oneline" })} | ||
| {content} | ||
| </> | ||
| ); | ||
| } | ||
| }; | ||
| } | ||
97 changes: 70 additions & 27 deletionsclient/packages/lowcoder/src/comps/comps/navComp/navComp.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletionclient/packages/lowcoder/src/comps/comps/navComp/navItemComp.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletionclient/packages/lowcoder/src/i18n/locales/en.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.