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

Dialog #1809

Draft
wants to merge 125 commits into
base: develop
Choose a base branch
from
Draft

Dialog #1809

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
471594f
First cut of hoist dialog with isDraggable option.
cnrudd Dec 26, 2019
7da244f
Removed unused imports.
cnrudd Dec 26, 2019
2bab03f
Added canMaskClickClose prop and maskClick handler
cnrudd Dec 27, 2019
8a90e0f
Fix maskclick handler
cnrudd Dec 27, 2019
ec01ac3
added todo
cnrudd Dec 27, 2019
73ccc65
Support autoFocus: true on dialog children
cnrudd Jan 2, 2020
107c490
Replaced react-draggable with react-rnd, which uses react-draggable.
cnrudd Jan 3, 2020
90f5f42
Added --xh-dialog-box-shadow
cnrudd Jan 3, 2020
d6650a3
Support for resizing
cnrudd Jan 3, 2020
9a7f05b
Fix repaint bug
cnrudd Jan 6, 2020
b3fe561
Remove redundant use of splitLayoutProps
cnrudd Jan 6, 2020
2a65a78
Remove bug comment and fix. Bug existed only on chrome 78.3x . Upgr…
cnrudd Jan 6, 2020
c8f401b
Refactored with elementfactory.
cnrudd Jan 6, 2020
8e347e3
Remove need for constructor.
cnrudd Jan 6, 2020
3af10ed
Converted Dialog from class comp to function comp.
cnrudd Jan 7, 2020
a3b640b
Support resizable config
cnrudd Jan 7, 2020
d583d76
Refactor, with dialogHeader impl
cnrudd Jan 7, 2020
fad1660
Linting.
cnrudd Jan 8, 2020
88b0d45
Let dialogs autocenter based on content dimensions;
cnrudd Jan 8, 2020
c06514e
Use given width and height props if resizeable
cnrudd Jan 14, 2020
42a4d00
throw if no dims props with resizable = true
cnrudd Jan 14, 2020
d7d7a10
Add Maximize Minimize toggle if resizable.
cnrudd Jan 14, 2020
41c129c
Implemented localstorage statemodel on dialog.
cnrudd Jan 17, 2020
cfaa2af
Improve handling of 0 position values.
cnrudd Jan 17, 2020
e3169c1
Improve safe state loading on dialog.
cnrudd Jan 18, 2020
1d57410
Remove unnecessary setting of defaults on RnD, fix unMaximize.
cnrudd Jan 18, 2020
21f9f5d
Support x, y props.
cnrudd Jan 18, 2020
10f08c2
Merge branch 'develop' into hoistDialog
cnrudd Jan 21, 2020
40c27b5
Merge branch 'develop' into hoistDialog
cnrudd Jan 21, 2020
28c1175
Cleanup setState on render logic
cnrudd Jan 23, 2020
ffb7b14
Unifiied dialog sub component with mask and closeOnOutsideClick props.
cnrudd Feb 2, 2020
f320af6
added --xh-dialog-box-shadow
cnrudd Feb 9, 2020
34475a7
Support style passthrough and zIndex prop
cnrudd Feb 9, 2020
07fb4bb
Merge branch 'hoistDialog' of github.com:exhi/hoist-react into hoistD…
cnrudd Feb 9, 2020
4c38c76
--xh-dialog-box-shadow dark theme
cnrudd Feb 9, 2020
321de51
Improve takeup of style & zIndex & rndoptions
cnrudd Feb 10, 2020
2f934ec
Cleanup prop and model passing.
cnrudd Feb 15, 2020
cf7e6c4
Remove unused zIndex
cnrudd Feb 15, 2020
b2bdf02
Support static base zindex for all dialogs
cnrudd Feb 15, 2020
4753e87
Better method name: calcPos -> calcCenteredPos.
cnrudd Feb 16, 2020
cc5a41c
React-rnd semver tweak.
cnrudd Feb 16, 2020
633563b
Put scss var decl on one line.
cnrudd Feb 16, 2020
8ed6342
Merge branch 'develop' into hoistDialog
cnrudd Feb 16, 2020
ea94ab1
Latest deps in yarn.lock
cnrudd Feb 16, 2020
8b8283a
Model passing cleanup.
cnrudd Feb 16, 2020
372a8c7
Fix setPositionState
cnrudd Feb 16, 2020
65816e0
Move showCloseButton to prop
cnrudd Feb 17, 2020
7e6d049
Rework as controlled component;
cnrudd Feb 18, 2020
9ac3175
Fix closeOnEscape handling
cnrudd Feb 19, 2020
ede3e35
convert closeOnEscape to prop
cnrudd Feb 19, 2020
3fdf152
Fix handling of specified size and width when not resizable.
cnrudd Feb 21, 2020
5f5c8b8
Merge branch 'develop' into hoistDialog
cnrudd Feb 21, 2020
272a2b0
Use Hoist Dialog for messages.
cnrudd Feb 21, 2020
3d7d0c8
Match dialog styles to current hoist/bp dialog styles.
cnrudd Feb 21, 2020
b10b57e
Lee and Colin: codev
lbwexler Feb 21, 2020
31df902
WIP
cnrudd Feb 24, 2020
aa32bf8
Use elementFromContent for the dialog content.
cnrudd Feb 24, 2020
839bbf5
Get setting off model, not prop.
cnrudd Feb 24, 2020
2f5add3
Remove body overflow switch
cnrudd Feb 25, 2020
8207761
No longer allow create model from default.
cnrudd Feb 25, 2020
482af25
Remove portal div from DOM when popup closes
cnrudd Feb 25, 2020
f8087c5
use Hoist Dialog on Message components.
cnrudd Feb 25, 2020
573ad4f
ClientErrorDetail dialog uses Hoist Dialog.
cnrudd Feb 25, 2020
2a56b6e
Keep centered dialogs centered on window resize.
cnrudd Feb 25, 2020
02e69ec
Add inPortal switch
cnrudd Feb 25, 2020
15df57f
Cleanup
cnrudd Feb 25, 2020
ce58b7e
Merge branch 'develop' into hoistDialogModel
cnrudd Feb 25, 2020
b3fc861
Changes to positioning to better handle observable positions and sizes.
cnrudd Mar 4, 2020
95a5217
Merge branch 'develop' into hoistDialogModel
cnrudd Mar 4, 2020
d8d7f2b
Better use of computed and observables for position and sizing.
cnrudd Mar 4, 2020
5e75e54
Fix some state model edge cases.
cnrudd Mar 5, 2020
bd54225
Working observables!
cnrudd Mar 5, 2020
026ce7e
Make maximized dialog resize with body when body resizes.
cnrudd Mar 5, 2020
3a44217
Merge branch 'develop' into hoistDialogModel
cnrudd Mar 16, 2020
c4a5aec
Fix maximize in non-portal dialog
cnrudd Mar 16, 2020
4d8fca3
Use initialX|Y|Width|Height
cnrudd Mar 16, 2020
014ef1e
Use currentHeight|Width in sizing dialog content
cnrudd Mar 16, 2020
9ccb92f
Refactor pos and size functionality.
cnrudd Mar 16, 2020
e2f315b
Enforce x,y & width,height set together.
cnrudd Mar 16, 2020
86075b2
Prevent draghandles when maximized
cnrudd Mar 16, 2020
378b189
todo reminder
cnrudd Mar 16, 2020
7c7efde
Name cleanups.
cnrudd Mar 16, 2020
5e60c71
Move non-public methods to implementation section.
cnrudd Mar 17, 2020
405df39
Replace .bp3_dailog default css width of 500px with content width
cnrudd Mar 22, 2020
35c2d6f
Put width setting on content, not on dialog.
cnrudd Mar 22, 2020
c6a1596
Specify width on ClientError dialog, and make resizable.
cnrudd Mar 23, 2020
b127522
Better content rendering via css: avoid background -color bleed with…
cnrudd Mar 23, 2020
91d1537
Now that dialog is resizable, make jsoninput 100% height
cnrudd Mar 23, 2020
36c2520
Put width spec on Dialog, not on content.
cnrudd Mar 23, 2020
62f631d
New MenuButton component
cnrudd Mar 23, 2020
e99536a
Support resizable with no width & height, or just one dim. Also sup…
cnrudd Mar 23, 2020
46ee943
Merge branch 'develop' into hoistDialogModel
lbwexler Mar 26, 2020
c163282
Merge remote-tracking branch 'origin/hoistDialogModel' into hoistDial…
lbwexler Mar 26, 2020
5492d18
+ Pass model with Context.
lbwexler Mar 26, 2020
76883e7
+ Use LocalModel pattern
lbwexler Mar 26, 2020
d85f253
Checkpoint
lbwexler Mar 27, 2020
5d47c7b
Refactor
lbwexler Mar 28, 2020
bb825bc
Checkpoint
lbwexler Mar 29, 2020
ec923ea
Checkpoint
lbwexler Mar 29, 2020
1a13dc9
Remove stray console log
lbwexler Mar 30, 2020
f1d1caa
Fix issue with Titleless dialog
lbwexler Mar 30, 2020
fdb82df
Checkpoint
lbwexler Mar 30, 2020
5a838d7
unMaximize() => restore()
lbwexler Mar 30, 2020
62f279d
Update dependencies
lbwexler Mar 30, 2020
67ceec2
Update yarn.lock
lbwexler Mar 30, 2020
141da17
Merge branch 'develop' into dialogX
lbwexler Mar 30, 2020
c78f349
Merge branch 'develop' into dialogX
lbwexler Mar 31, 2020
d7f0b21
Merge branch 'develop' into dialogX
lbwexler Apr 2, 2020
0e9241e
+ Incorporate parent resizing behavior
lbwexler Apr 3, 2020
3afec6a
Don't set position on user induced re-size
lbwexler Apr 3, 2020
3c7c855
Doc fix
lbwexler Apr 3, 2020
536f57f
Merge branch 'develop' into dialogX
lbwexler Apr 11, 2020
8d63efb
Cleanup checkpoint
lbwexler Apr 12, 2020
7005f6d
Continued Refactor
lbwexler Apr 13, 2020
c9bd74b
Support Percentage Width and Height
lbwexler Apr 13, 2020
f55683f
Checkpoint
lbwexler Apr 13, 2020
dbedd17
Merge branch 'develop' into dialogX
lbwexler Apr 13, 2020
206bc7c
Update to new package import
lbwexler Apr 13, 2020
0c82994
Provide proper renderMode/refreshMode support
lbwexler Apr 14, 2020
4710630
Merge branch 'develop' into dialogX
cnrudd Apr 27, 2020
b29e92b
Latest yarn.lock
cnrudd Apr 27, 2020
0200375
Merge branch 'develop' into dialogX
lbwexler Jun 4, 2020
0868e64
Merge branch 'dialogX' of https://github.com/xh/hoist-react into dialogX
lbwexler Jun 4, 2020
a654ae0
Merge branch 'develop' into dialogX
cnrudd Jun 26, 2020
debbec7
Merge branch 'develop' into dialogX
cnrudd Sep 18, 2020
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
2 changes: 1 addition & 1 deletion core/HoistComponentFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function hoistComponent(config) {
isForwardRef = (render.length === 2);

// 1) Default and validate the modelSpec
const modelSpec = withDefault(config.model, uses('*'));
const modelSpec = withDefault(config.model, uses('*', {publishMode: ModelPublishMode.NONE}));
throwIf(
modelSpec && !(modelSpec instanceof ModelSpec),
"The 'model' config passed to hoistComponent() is incorrectly specified: provide a spec returned by either uses() or creates()."
Expand Down
23 changes: 13 additions & 10 deletions desktop/appcontainer/AboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
*
* Copyright © 2020 Extremely Heavy Industries Inc.
*/
import {AboutDialogModel} from '@xh/hoist/appcontainer/AboutDialogModel';
import {filler, frame} from '@xh/hoist/cmp/layout';
import {hoistCmp, uses, XH} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';

import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {XH, hoistCmp, uses} from '@xh/hoist/core';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import {button} from '@xh/hoist/desktop/cmp/button';
import {Icon} from '@xh/hoist/icon';
import {dialog} from '@xh/hoist/kit/blueprint';
import {frame, filler} from '@xh/hoist/cmp/layout';

import {AboutDialogModel} from '@xh/hoist/appcontainer/AboutDialogModel';
import './AboutDialog.scss';

/**
Expand All @@ -30,12 +32,14 @@ export const aboutDialog = hoistCmp.factory({
const onClose = () => model.hide();

return dialog({
isOpen: true,
isCloseButtonShown: false,
model: {
showCloseButton: false,
size: {width: 450},
onClose
},
icon: Icon.info({size: 'lg'}),
className: 'xh-about-dialog',
title: `About ${XH.appName}`,
style: {width: 450},
items: [
frame({
className: 'xh-about-dialog__inner',
Expand All @@ -49,8 +53,7 @@ export const aboutDialog = hoistCmp.factory({
onClick: onClose
})
)
],
onClose
]
});
}
});
31 changes: 18 additions & 13 deletions desktop/appcontainer/ExceptionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
*
* Copyright © 2020 Extremely Heavy Industries Inc.
*/
import {ExceptionDialogModel} from '@xh/hoist/appcontainer/ExceptionDialogModel';

import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {XH, hoistCmp, uses} from '@xh/hoist/core';
import {filler, fragment} from '@xh/hoist/cmp/layout';
import {hoistCmp, uses, XH} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import {Icon} from '@xh/hoist/icon';
import {dialog, dialogBody} from '@xh/hoist/kit/blueprint';
import './ExceptionDialog.scss';
import {button} from '@xh/hoist/desktop/cmp/button';

import {ExceptionDialogModel} from '@xh/hoist/appcontainer/ExceptionDialogModel';

import {exceptionDialogDetails} from './ExceptionDialogDetails';
import './ExceptionDialog.scss';

/**
* Dialog for display of exceptions, with support for viewing a detailed stacktrace
Expand All @@ -33,15 +37,17 @@ export const exceptionDialog = hoistCmp.factory({

return fragment(
dialog({
isOpen: true,
model: {
showCloseButton: !options.requireReload,
size: {width: 500},
onClose
},
title: options.title,
isCloseButtonShown: !options.requireReload,
onClose,
icon: Icon.warning({size: 'lg'}),
items: [
dialogBody(options.message),
bbar()
]
items: panel({
item: options.message,
bbar: bbar()
})
}),
exceptionDialogDetails()
);
Expand Down Expand Up @@ -79,7 +85,6 @@ export const dismissButton = hoistCmp.factory(
({model}) => {
const reloadRequired = model.options.requireReload,
loginRequired = isSessionExpired(model.exception);

return reloadRequired ?
button({
icon: loginRequired ? Icon.login() : Icon.refresh(),
Expand Down
24 changes: 13 additions & 11 deletions desktop/appcontainer/ExceptionDialogDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
*
* Copyright © 2020 Extremely Heavy Industries Inc.
*/
import {filler, pre, table, tbody, td, th, tr} from '@xh/hoist/cmp/layout';
import {hoistCmp, XH} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';
import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {XH, hoistCmp} from '@xh/hoist/core';
import {pre, table, tbody, td, th, tr, filler, vframe} from '@xh/hoist/cmp/layout';
import {clipboardButton} from '@xh/hoist/desktop/cmp/clipboard';
import {textArea} from '@xh/hoist/desktop/cmp/input';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import {stringifyErrorSafely} from '@xh/hoist/exception';
import {button} from '@xh/hoist/desktop/cmp/button';
import {textArea} from '@xh/hoist/desktop/cmp/input';
import {Icon} from '@xh/hoist/icon';
import {dialog, dialogBody} from '@xh/hoist/kit/blueprint';
import {stringifyErrorSafely} from '@xh/hoist/exception';

import {dismissButton} from './ExceptionDialog';

/**
Expand Down Expand Up @@ -45,12 +46,13 @@ export const exceptionDialogDetails = hoistCmp.factory(
return dialog({
title: 'Error Details',
icon: Icon.search(),
isOpen: true,
isCloseButtonShown: !requireReload,
onClose: !requireReload ? () => model.close() : null,
style: {width: 800},
model: {
showCloseButton: !requireReload,
onClose: !requireReload ? () => model.close() : null,
size: {width: 800}
},
items: [
dialogBody({
vframe({
className: 'xh-exception-dialog-details',
items: [
header,
Expand Down
18 changes: 11 additions & 7 deletions desktop/appcontainer/FeedbackDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
*
* Copyright © 2020 Extremely Heavy Industries Inc.
*/
import {FeedbackDialogModel} from '@xh/hoist/appcontainer/FeedbackDialogModel';
import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {filler} from '@xh/hoist/cmp/layout';
import {hoistCmp, uses, XH} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';
import {textArea} from '@xh/hoist/desktop/cmp/input';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import {dialog} from '@xh/hoist/kit/blueprint';

import {FeedbackDialogModel} from '@xh/hoist/appcontainer/FeedbackDialogModel';

/**
* A simple dialog component to collect user feedback from directly within the application.
Expand All @@ -25,12 +26,15 @@ export const feedbackDialog = hoistCmp.factory({
render({model}) {
if (!model.isOpen) return null;

const onClose = () => model.hide();

return dialog({
title: `${XH.clientAppName} Feedback`,
style: {width: 450},
isOpen: true,
onClose: () => model.hide(),
canOutsideClickClose: false,
model: {
size: {width: 450},
closeOnOutsideClick: false,
onClose
},
items: [
textArea({
placeholder: 'Please enter your comments...',
Expand All @@ -45,7 +49,7 @@ export const feedbackDialog = hoistCmp.factory({
filler(),
button({
text: 'Cancel',
onClick: () => model.hide()
onClick: onClose
}),
button({
text: 'Send Feedback',
Expand Down
19 changes: 10 additions & 9 deletions desktop/appcontainer/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
import {MessageModel} from '@xh/hoist/appcontainer/MessageModel';
import {form} from '@xh/hoist/cmp/form';
import {filler} from '@xh/hoist/cmp/layout';
import {filler, vframe} from '@xh/hoist/cmp/layout';
import {hoistCmp, uses} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';
import {formField} from '@xh/hoist/desktop/cmp/form';
import {textInput} from '@xh/hoist/desktop/cmp/input';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import {dialog, dialogBody} from '@xh/hoist/kit/blueprint';
import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {withDefault} from '@xh/hoist/utils/js';
import './Message.scss';

Expand All @@ -30,18 +30,19 @@ export const message = hoistCmp.factory({
if (!model.isOpen) return null;

return dialog({
isOpen: true,
isCloseButtonShown: false,
title: model.title,
icon: model.icon,
model: {
showCloseButton: false,
onClose: model.cancelProps ? () => model.doCancel() : null
},
items: [
dialogBody(
model.message,
inputCmp()
),
vframe({
margin: '20px',
items: [model.message, inputCmp()]
}),
bbar()
],
onClose: () => {if (model.cancelProps) model.doCancel();},
...props
});
}
Expand Down
73 changes: 35 additions & 38 deletions desktop/appcontainer/OptionsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
*
* Copyright © 2020 Extremely Heavy Industries Inc.
*/
import {OptionsDialogModel} from '@xh/hoist/appcontainer/OptionsDialogModel';
import {form} from '@xh/hoist/cmp/form';
import {dialog} from '@xh/hoist/desktop/cmp/dialog';
import {hoistCmp, XH, uses} from '@xh/hoist/core';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {Icon} from '@xh/hoist/icon';
import {filler} from '@xh/hoist/cmp/layout';
import {hoistCmp, uses, XH} from '@xh/hoist/core';
import {button, restoreDefaultsButton} from '@xh/hoist/desktop/cmp/button';
import {form} from '@xh/hoist/cmp/form';
import {formField} from '@xh/hoist/desktop/cmp/form';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {Icon} from '@xh/hoist/icon';
import {dialog, dialogBody} from '@xh/hoist/kit/blueprint';
import {OptionsDialogModel} from '@xh/hoist/appcontainer/OptionsDialogModel';
import './OptionsDialog.scss';

/**
Expand All @@ -35,38 +35,35 @@ export const optionsDialog = hoistCmp.factory({
title: `${XH.clientAppName} Options`,
icon: Icon.options(),
className,
isOpen: true,
onClose: () => model.hide(),
canOutsideClickClose: false,
item: [
panel({
mask: 'onLoad',
item: dialogBody(
form({
model: formModel,
fieldDefaults: {minimal: true, inline: true},
items: model.options.map(option => {
return formField({field: option.name, ...option.formField});
})
})
),
bbar: [
restoreDefaultsButton(),
filler(),
button({
text: 'Cancel',
onClick: () => model.hide()
}),
button({
disabled: !formModel.isDirty,
text: reloadRequired ? 'Save & Reload' : 'Save',
icon: reloadRequired ? Icon.refresh() : Icon.check(),
intent: 'success',
onClick: () => model.saveAsync()
})
]
})
]
model: {
closeOnOutsideClick: false,
onClose: () => model.hide()
},
item: panel({
mask: 'onLoad',
item: form({
model: formModel,
fieldDefaults: {minimal: true, inline: true},
items: model.options.map(option => {
return formField({field: option.name, ...option.formField});
})
}),
bbar: [
restoreDefaultsButton(),
filler(),
button({
text: 'Cancel',
onClick: () => model.hide()
}),
button({
disabled: !formModel.isDirty,
text: reloadRequired ? 'Save & Reload' : 'Save',
icon: reloadRequired ? Icon.refresh() : Icon.check(),
intent: 'success',
onClick: () => model.saveAsync()
})
]
})
});
}
});
Expand Down
Loading