-
Notifications
You must be signed in to change notification settings - Fork 10
Dash Canvas: add ability to drop widgets in from outside. #4183
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
Open
cnrudd
wants to merge
42
commits into
develop
Choose a base branch
from
drag-onto-dash-canvas
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
f4ede20
Handle RGL dropping item in get rglLayout
cnrudd 0ed3722
DashCanvas: Support dragging widget into and dropping to add
cnrudd a642e7b
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd ec3613d
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 6837432
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd c788fc6
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 651eaa8
Add typings
cnrudd fb2ab47
Make droppable a first class option on DashCanvas, not something to b…
cnrudd e945fa8
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 5df8688
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 9b9bdb0
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd d7e18d4
Update react-grid-layout to v2.1.0
cnrudd f7daaeb
CHANGELOG.md entry
cnrudd 7bdcf9b
`<Some>` not needed since ReactNode includes `Iterable<ReactNode>`
cnrudd 485cea6
Remove unused argument `type` from `normalizeArgs` method.
cnrudd 9d77f34
Make not droppable if contentLocked.
cnrudd fb80f8a
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 1e0c6c6
fix spreading of rglOptions
cnrudd d2a3610
fix typing of rglOptions
cnrudd e77515d
switch to "moduleResolution": "bundler", triggered by import of
cnrudd bf8cfab
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 12a8c8b
support 2 compact strategies + support toggle grid background
cnrudd 864b789
comment removed as per Lee's suggestion
cnrudd 9d1427a
replace droppable with allowsDrop
cnrudd 7b558ab
create type OnDropDragOverResult
cnrudd ea98f00
merge in latest from develop
cnrudd b8fbe5f
Update qs dep to resolve this code analysis warning:
cnrudd 685b9ee
Update to "react-grid-layout": "2.2.2" to get latest fixes, and conse…
cnrudd e5a8f51
Merge branch 'refs/heads/develop' into drag-onto-dash-canvas
cnrudd 4e7ad50
2 new html tags
cnrudd c504c91
Merge branch 'refs/heads/develop' into drag-onto-dash-canvas
cnrudd 4d2243b
new hoist components:
cnrudd 38208f1
add to docs.
cnrudd 6d8fa28
Rename CollapsibleFieldset to CollapsibleBox,
cnrudd a013eec
Default to flex box rendering for collapsibleBox, not block.
cnrudd 66b47b0
Support flexDirection prop on DashCanvasWidgetWell
cnrudd dee8742
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd e4ef652
add testId support
cnrudd 2b1d463
Merge branch 'develop' into drag-onto-dash-canvas
cnrudd 233821d
support collapsibleSet on mobile by creating a dynamic button
cnrudd a577133
Add support for renderMode
cnrudd c93d120
Merge remote-tracking branch 'origin/develop' into drag-onto-dash-canvas
ghsolomon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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,49 @@ | ||
| /* | ||
| * This file belongs to Hoist, an application development toolkit | ||
| * developed by Extremely Heavy Industries (www.xh.io | info@xh.io) | ||
| * | ||
| * Copyright © 2026 Extremely Heavy Industries Inc. | ||
| */ | ||
|
|
||
| .xh-collapsible-set { | ||
| &--collapsed { | ||
| border-bottom: none; | ||
| border-left: none; | ||
| border-right: none; | ||
|
|
||
| &--render-mode--always, | ||
| &--render-mode--lazy { | ||
| > *:not(:first-child) { | ||
| display: none; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| &.xh-collapsible-set--intent-primary { | ||
| border-color: var(--xh-intent-primary-trans2); | ||
| &.xh-collapsible-set--enabled { | ||
| border-color: var(--xh-intent-primary); | ||
| } | ||
| } | ||
|
|
||
| &.xh-collapsible-set--intent-success { | ||
| border-color: var(--xh-intent-success-trans2); | ||
| &.xh-collapsible-set--enabled { | ||
| border-color: var(--xh-intent-success); | ||
| } | ||
| } | ||
|
|
||
| &.xh-collapsible-set--intent-warning { | ||
| border-color: var(--xh-intent-warning-trans2); | ||
| &.xh-collapsible-set--enabled { | ||
| border-color: var(--xh-intent-warning); | ||
| } | ||
| } | ||
|
|
||
| &.xh-collapsible-set--intent-danger { | ||
| border-color: var(--xh-intent-danger-trans2); | ||
| &.xh-collapsible-set--enabled { | ||
| border-color: var(--xh-intent-danger); | ||
| } | ||
| } | ||
| } |
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,135 @@ | ||
| /* | ||
| * This file belongs to Hoist, an application development toolkit | ||
| * developed by Extremely Heavy Industries (www.xh.io | info@xh.io) | ||
| * | ||
| * Copyright © 2026 Extremely Heavy Industries Inc. | ||
| */ | ||
|
|
||
| import classNames from 'classnames'; | ||
| import {castArray} from 'lodash'; | ||
| import {type FieldsetHTMLAttributes, type ReactElement, type ReactNode, useState} from 'react'; | ||
| import {XH, hoistCmp} from '@xh/hoist/core'; | ||
| import type {HoistProps, Intent, LayoutProps, RenderMode, TestSupportProps} from '@xh/hoist/core'; | ||
| import {fieldset} from '@xh/hoist/cmp/layout'; | ||
| import {TEST_ID, mergeDeep} from '@xh/hoist/utils/js'; | ||
| import {splitLayoutProps} from '@xh/hoist/utils/react'; | ||
| import {collapsibleSetButton as desktopCollapsibleSetButtonImpl} from '@xh/hoist/dynamics/desktop'; | ||
| import {collapsibleSetButton as mobileCollapsibleSetButtonImpl} from '@xh/hoist/dynamics/mobile'; | ||
|
|
||
| import './CollapsibleSet.scss'; | ||
|
|
||
| export interface CollapsibleSetProps | ||
| extends FieldsetHTMLAttributes<HTMLFieldSetElement>, HoistProps, TestSupportProps, LayoutProps { | ||
| icon?: ReactElement; | ||
| label: ReactNode; | ||
| tooltip?: JSX.Element | string; | ||
| intent?: Intent; | ||
| clickHandler?: () => void; | ||
| collapsed?: boolean; | ||
| hideItemCount?: boolean; | ||
| renderMode?: RenderMode; | ||
| } | ||
|
|
||
| export const [CollapsibleSet, collapsibleSet] = hoistCmp.withFactory<CollapsibleSetProps>({ | ||
| displayName: 'CollapsibleSet', | ||
| model: false, | ||
| className: 'xh-collapsible-set', | ||
| render({ | ||
| icon, | ||
| label, | ||
| tooltip, | ||
| intent, | ||
| collapsed, | ||
| children, | ||
| hideItemCount, | ||
| className, | ||
| disabled, | ||
| display = 'flex', | ||
| flexDirection = 'column', | ||
| flexWrap = 'wrap', | ||
| renderMode = 'unmountOnHide', | ||
| ...rest | ||
| }) { | ||
| // Note `model` destructured off of non-layout props to avoid setting | ||
| // model as a bogus DOM attribute. This low-level component may easily be passed one from | ||
| // a parent that has not properly managed its own props. | ||
| let [layoutProps, {model, testId, ...restProps}] = splitLayoutProps(rest); | ||
|
|
||
| restProps = mergeDeep( | ||
| {style: {display, flexDirection, flexWrap, ...layoutProps}}, | ||
| {[TEST_ID]: testId}, | ||
| restProps | ||
| ); | ||
|
|
||
| const [isCollapsed, setIsCollapsed] = useState<boolean>(collapsed === true), | ||
| [expandCount, setExpandCount] = useState<number>(!collapsed ? 1 : 0), | ||
| items = castArray(children), | ||
| itemCount = hideItemCount === true ? '' : ` (${items.length})`, | ||
| classes = []; | ||
|
|
||
| if (isCollapsed) { | ||
| classes.push('xh-collapsible-set--collapsed'); | ||
| } else { | ||
| classes.push('xh-collapsible-set--expanded'); | ||
| } | ||
|
|
||
| if (disabled) { | ||
| classes.push('xh-collapsible-set--disabled'); | ||
| } else { | ||
| classes.push('xh-collapsible-set--enabled'); | ||
| } | ||
|
|
||
| if (intent) { | ||
| classes.push(`xh-collapsible-set--intent-${intent}`); | ||
| } else { | ||
| classes.push(`xh-collapsible-set--intent-none`); | ||
| } | ||
|
|
||
| const btn = XH.isMobileApp | ||
| ? mobileCollapsibleSetButtonImpl | ||
| : desktopCollapsibleSetButtonImpl; | ||
|
|
||
| let content; | ||
| switch (renderMode) { | ||
| case 'always': | ||
| content = items; | ||
| if (isCollapsed) { | ||
| classes.push('xh-collapsible-set--collapsed--render-mode--always'); | ||
| } | ||
| break; | ||
|
|
||
| case 'lazy': | ||
| content = isCollapsed && !expandCount ? [] : items; | ||
| if (isCollapsed) { | ||
| classes.push('xh-collapsible-set--collapsed--render-mode--lazy'); | ||
| } | ||
| break; | ||
|
|
||
| // unmountOnHide | ||
| default: | ||
| content = isCollapsed ? [] : items; | ||
| break; | ||
| } | ||
|
|
||
| return fieldset({ | ||
| className: classNames(className, classes), | ||
| items: [ | ||
| btn({ | ||
| icon, | ||
| text: `${label}${itemCount}`, | ||
| tooltip, | ||
| intent, | ||
| clickHandler: val => { | ||
| setIsCollapsed(val); | ||
| setExpandCount(expandCount + 1); | ||
| }, | ||
| collapsed: isCollapsed, | ||
| disabled | ||
| }), | ||
| ...content | ||
| ], | ||
| disabled, | ||
| ...restProps | ||
| }); | ||
| } | ||
| }); |
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
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 |
|---|---|---|
|
|
@@ -123,7 +123,7 @@ export class TabContainerModel extends HoistModel { | |
|
|
||
| /** | ||
| * @param config - TabContainer configuration. | ||
| * @param [depth] - Depth in hierarchy of nested TabContainerModels. Not for application use. | ||
| * @param depth - Depth in hierarchy of nested TabContainerModels. Not for application use. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated linting change |
||
| */ | ||
| constructor( | ||
| { | ||
|
|
||
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
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
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,57 @@ | ||
| /* | ||
| * This file belongs to Hoist, an application development toolkit | ||
| * developed by Extremely Heavy Industries (www.xh.io | info@xh.io) | ||
| * | ||
| * Copyright © 2026 Extremely Heavy Industries Inc. | ||
| */ | ||
|
|
||
| import {type ReactElement, type ReactNode, type JSX, useState} from 'react'; | ||
| import {tooltip as bpTooltip} from '@xh/hoist/kit/blueprint'; | ||
| import {hoistCmp} from '@xh/hoist/core'; | ||
| import type {Intent, HoistProps} from '@xh/hoist/core'; | ||
| import {button} from '@xh/hoist/desktop/cmp/button'; | ||
| import {legend} from '@xh/hoist/cmp/layout'; | ||
| import {Icon} from '@xh/hoist/icon/Icon'; | ||
|
|
||
| export interface CollapsibleSetButtonProps extends HoistProps { | ||
| icon?: ReactElement; | ||
| text: ReactNode; | ||
| tooltip?: JSX.Element | string; | ||
| clickHandler?: (boolean) => void; | ||
| intent?: Intent; | ||
| collapsed?: boolean; | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| export const [CollapsibleSetButton, collapsibleSetButton] = | ||
| hoistCmp.withFactory<CollapsibleSetButtonProps>({ | ||
| displayName: 'CollapsibleSetButton', | ||
| model: false, | ||
| render({icon, text, tooltip, intent, clickHandler, collapsed, disabled}) { | ||
| const [isCollapsed, setIsCollapsed] = useState<boolean>(collapsed === true), | ||
| btn = button({ | ||
| text, | ||
| icon, | ||
| rightIcon: isCollapsed ? Icon.angleDown() : Icon.angleUp(), | ||
| outlined: isCollapsed && !intent, | ||
| minimal: !intent || (intent && !isCollapsed), | ||
| intent, | ||
| disabled, | ||
| onClick: () => { | ||
| const val = !isCollapsed; | ||
| setIsCollapsed(val); | ||
| clickHandler?.(val); | ||
| } | ||
| }); | ||
|
|
||
| return legend( | ||
| tooltip | ||
| ? bpTooltip({ | ||
| item: btn, | ||
| content: tooltip, | ||
| intent | ||
| }) | ||
| : btn | ||
| ); | ||
| } | ||
| }); |
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.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated linting change