ljmotta commented on code in PR #2202:
URL:
https://github.com/apache/incubator-kie-tools/pull/2202#discussion_r1535573149
##########
packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx:
##########
@@ -296,63 +407,92 @@ export function DecisionTableExpression(
return [...inputColumns, outputSection, ...annotationColumns];
}
}, [
- decisionNodeId,
- decisionTableExpression.annotations,
- decisionTableExpression.dataType,
- decisionTableExpression.input,
- decisionTableExpression.name,
- decisionTableExpression.output,
+ expressionHolderId,
+ decisionTableExpression,
+ getAnnotationWidth,
+ getInputWidth,
+ getOutputWidth,
setAnnotationColumnWidth,
setInputColumnWidth,
setOutputColumnWidth,
]);
const beeTableRows = useMemo(
() =>
- (decisionTableExpression.rules ?? []).map((rule) => {
- const ruleRow = [...rule.inputEntries, ...rule.outputEntries,
...rule.annotationEntries];
- const tableRow = getColumnsAtLastLevel(beeTableColumns).reduce(
+ (decisionTableExpression.rule ?? []).map((rule) => {
+ const ruleRow = [
+ ...(rule.inputEntry ?? []),
+ ...(rule.outputEntry ?? new
Array(decisionTableExpression.output.length)),
+ ...(rule.annotationEntry ?? []),
+ ];
+
+ return getColumnsAtLastLevel(beeTableColumns).reduce(
(tableRow: ROWTYPE, column, columnIndex) => {
- tableRow[column.accessor] = ruleRow[columnIndex] ?? "";
+ tableRow[column.accessor] = ruleRow[columnIndex]?.text?.__$$text
?? "";
return tableRow;
},
- { id: rule.id }
+ { id: rule["@_id"] }
);
- return tableRow;
}),
- [beeTableColumns, decisionTableExpression.rules]
+ [beeTableColumns, decisionTableExpression.output.length,
decisionTableExpression.rule]
);
const onCellUpdates = useCallback(
(cellUpdates: BeeTableCellUpdate<ROWTYPE>[]) => {
setExpression((prev: DecisionTableExpressionDefinition) => {
- const n = { ...prev };
+ let n = { ...prev };
cellUpdates.forEach((u) => {
Review Comment:
The same for `u`.
##########
packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx:
##########
@@ -365,47 +505,59 @@ export function DecisionTableExpression(
(columnUpdates: BeeTableColumnUpdate<ROWTYPE>[]) => {
setExpression((prev: DecisionTableExpressionDefinition) => {
const n = { ...prev };
- for (const u of columnUpdates) {
+ for (const columnUpdate of columnUpdates) {
Review Comment:
👍 👍 👍 😄
##########
packages/boxed-expression-component/src/expressions/BoxedExpressionEditor/BoxedExpressionEditorContext.tsx:
##########
@@ -64,24 +67,32 @@ export function useBoxedExpressionEditorDispatch() {
}
export function BoxedExpressionEditorContextProvider({
- setExpressionDefinition,
+ onExpressionChange,
+ onWidthsChange,
dataTypes,
- decisionNodeId,
+ expressionHolderId,
beeGwtService,
children,
- pmmlParams,
+ pmmlDocuments,
scrollableParentRef,
variables,
+ widthsById,
}: React.PropsWithChildren<BoxedExpressionEditorProps>) {
const [currentlyOpenContextMenu, setCurrentlyOpenContextMenu] =
useState<string | undefined>(undefined);
const editorRef = useRef<HTMLDivElement>(null);
- const dispatch = useMemo(
+ const dispatch = useMemo<BoxedExpressionEditorDispatchContextType>(
() => ({
- setExpression: setExpressionDefinition,
+ setExpression: onExpressionChange,
+ setWidth: ({ id, values }) => {
+ console.log("width" + id);
Review Comment:
I guess we could change this to a debug console?
##########
packages/stunner-editors-dmn-loader/src/DmnBuiltInDataType.ts:
##########
Review Comment:
Should we not use the `boxed-expression-component` one? Or it's necessary to
duplicate it?
##########
packages/boxed-expression-component/src/expressions/ExpressionDefinitionRoot/ExpressionContainer.tsx:
##########
@@ -71,12 +74,12 @@ export const ExpressionContainer:
React.FunctionComponent<ExpressionContainerPro
const addContextExpressionToVariables = useCallback(
(contextExpressionDefinition: ContextExpressionDefinition) => {
- const contextEntries = contextExpressionDefinition.contextEntries;
+ const contextEntries = contextExpressionDefinition.contextEntry ?? [];
for (const contextEntry of contextEntries) {
variables?.repository.addVariableToContext(
- contextEntry.entryInfo.id,
- contextEntry.entryInfo.name,
- contextExpressionDefinition.id
+ contextEntry["@_id"]!,
+ contextEntry["@_label"] ?? "<var>",
Review Comment:
Could you add a comment for the `"<var>"`?
##########
packages/boxed-expression-component/src/expressions/FunctionExpression/FeelFunctionExpression.tsx:
##########
@@ -211,16 +210,17 @@ export function FeelFunctionImplementationCell({
rowIndex,
columnIndex,
parentElementId,
+ widthsById,
}: BeeTableCellProps<FEEL_ROWTYPE> & { parentElementId: string }) {
- const functionExpression = data[rowIndex].functionExpression as
FeelFunctionExpressionDefinition;
+ const functionExpression = data[rowIndex].functionExpression; // as
FeelFunctionExpressionDefinition;
Review Comment:
Left over?
##########
packages/boxed-expression-component/src/expressions/DecisionTableExpression/DecisionTableExpression.tsx:
##########
@@ -296,63 +407,92 @@ export function DecisionTableExpression(
return [...inputColumns, outputSection, ...annotationColumns];
}
}, [
- decisionNodeId,
- decisionTableExpression.annotations,
- decisionTableExpression.dataType,
- decisionTableExpression.input,
- decisionTableExpression.name,
- decisionTableExpression.output,
+ expressionHolderId,
+ decisionTableExpression,
+ getAnnotationWidth,
+ getInputWidth,
+ getOutputWidth,
setAnnotationColumnWidth,
setInputColumnWidth,
setOutputColumnWidth,
]);
const beeTableRows = useMemo(
() =>
- (decisionTableExpression.rules ?? []).map((rule) => {
- const ruleRow = [...rule.inputEntries, ...rule.outputEntries,
...rule.annotationEntries];
- const tableRow = getColumnsAtLastLevel(beeTableColumns).reduce(
+ (decisionTableExpression.rule ?? []).map((rule) => {
+ const ruleRow = [
+ ...(rule.inputEntry ?? []),
+ ...(rule.outputEntry ?? new
Array(decisionTableExpression.output.length)),
+ ...(rule.annotationEntry ?? []),
+ ];
+
+ return getColumnsAtLastLevel(beeTableColumns).reduce(
(tableRow: ROWTYPE, column, columnIndex) => {
- tableRow[column.accessor] = ruleRow[columnIndex] ?? "";
+ tableRow[column.accessor] = ruleRow[columnIndex]?.text?.__$$text
?? "";
return tableRow;
},
- { id: rule.id }
+ { id: rule["@_id"] }
);
- return tableRow;
}),
- [beeTableColumns, decisionTableExpression.rules]
+ [beeTableColumns, decisionTableExpression.output.length,
decisionTableExpression.rule]
);
const onCellUpdates = useCallback(
(cellUpdates: BeeTableCellUpdate<ROWTYPE>[]) => {
setExpression((prev: DecisionTableExpressionDefinition) => {
- const n = { ...prev };
+ let n = { ...prev };
Review Comment:
A better name here? newExpression/prevExpression, WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]