-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2108 from xodio/feat-add-sugar-to-table-log
Add sugar to table log feature
- Loading branch information
Showing
14 changed files
with
498 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
50 changes: 50 additions & 0 deletions
50
packages/xod-client/src/project/components/nodeParts/TableLogNodeBody.jsx
This file contains 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,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import * as XP from 'xod-project'; | ||
|
||
import { NODE_CORNER_RADIUS } from '../../nodeLayout'; | ||
import NodeLabel from './NodeLabel'; | ||
import VariadicHandle from './VariadicHandle'; | ||
|
||
const NODE_BODY_RECT_PROPS = { | ||
rx: NODE_CORNER_RADIUS, | ||
ry: NODE_CORNER_RADIUS, | ||
// pxSize is set in root svg, let's occupy it all | ||
width: '100%', | ||
height: '100%', | ||
}; | ||
|
||
const TableLogNodeBody = props => ( | ||
<g className={classNames('watch-node', { active: props.isDebugSession })}> | ||
<rect className="body" {...NODE_BODY_RECT_PROPS} /> | ||
<NodeLabel | ||
text={props.nodeValue || props.label || XP.getBaseName(props.type)} | ||
width={props.pxSize.width} | ||
height={props.pxSize.height} | ||
/> | ||
<rect className="outline" {...NODE_BODY_RECT_PROPS} /> | ||
<VariadicHandle | ||
pxSize={props.pxSize} | ||
onMouseDown={event => { | ||
event.stopPropagation(); | ||
props.onVariadicHandleDown(event, props.id); | ||
}} | ||
/> | ||
</g> | ||
); | ||
|
||
TableLogNodeBody.propTypes = { | ||
id: PropTypes.string, | ||
type: PropTypes.string, | ||
label: PropTypes.string, | ||
pxSize: PropTypes.shape({ | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
}), | ||
nodeValue: PropTypes.string, | ||
isDebugSession: PropTypes.bool, | ||
onVariadicHandleDown: PropTypes.func, | ||
}; | ||
|
||
export default TableLogNodeBody; |
This file contains 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 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 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,23 @@ | ||
|
||
node { | ||
ConcatListView<char> accPlusDelimiter; | ||
ConcatListView<char> result; | ||
|
||
void evaluate(Context ctx) { | ||
auto arity = getValue<input_AR>(ctx); | ||
emitValue<output_ARU0027>(ctx, arity + 1); | ||
|
||
auto input = getValue<input_IN>(ctx); | ||
|
||
if (arity == 0) { | ||
emitValue<output_OUT>(ctx, input); | ||
return; | ||
} | ||
|
||
auto acc = getValue<input_ACC>(ctx); | ||
auto delimeter = getValue<input_D>(ctx); | ||
accPlusDelimiter = ConcatListView<char>(acc, delimeter); | ||
result = ConcatListView<char>(XString(&accPlusDelimiter), input); | ||
emitValue<output_OUT>(ctx, XString(&result)); | ||
} | ||
} |
Oops, something went wrong.