Skip to content

Commit 4a6061a

Browse files
authored
#2321 Single select table with moveable rows and no Delete icons (#2322)
Signed-off-by: srikant <[email protected]>
1 parent b542e84 commit 4a6061a

File tree

2 files changed

+272
-1
lines changed

2 files changed

+272
-1
lines changed

canvas_modules/common-canvas/src/common-properties/controls/abstract-table.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,8 @@ export default class AbstractTable extends React.Component {
744744
const cell = this.buildChildItem(propertyName, rowIndex, tableState);
745745
columns.push(cell);
746746
}
747-
if (this.props.control.rowSelection === ROW_SELECTION.SINGLE && !this.isReadonlyTable()) {
747+
// Do not show delete icon if add_remove_rows is false (default is true)
748+
if (this.props.control.rowSelection === ROW_SELECTION.SINGLE && !this.isReadonlyTable() && this.props.addRemoveRows) {
748749
const toolTip = PropertyUtils.formatMessage(this.reactIntl, MESSAGE_KEYS.TABLE_DELETEICON_TOOLTIP);
749750
const tooltipId = "tooltip-delete-row";
750751
const deleteOption = (

canvas_modules/harness/test_resources/parameterDefs/structurelisteditor_paramDef.json

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@
107107
"strawberry"
108108
]
109109
],
110+
"inlineEditingTableError3": [
111+
[
112+
1,
113+
1.234,
114+
"Age >= 55",
115+
"dog",
116+
"apple"
117+
],
118+
[
119+
3,
120+
1.234,
121+
"Age < 55",
122+
"cat",
123+
"orange"
124+
],
125+
[
126+
1,
127+
3.5,
128+
"Age >= 55",
129+
"pig",
130+
"strawberry"
131+
]
132+
],
110133
"onPanelNotVisibleTable": [
111134
[
112135
1,
@@ -248,6 +271,11 @@
248271
"type": "array[inlineEditingTableError2]",
249272
"default": []
250273
},
274+
{
275+
"id": "inlineEditingTableError3",
276+
"type": "array[inlineEditingTableError3]",
277+
"default": []
278+
},
251279
{
252280
"id": "onPanelNotVisibleTable",
253281
"type": "array[onPanelNotVisibleTable]",
@@ -504,6 +532,45 @@
504532
}
505533
]
506534
},
535+
{
536+
"id": "inlineEditingTableError3",
537+
"parameters": [
538+
{
539+
"id": "valueName",
540+
"type": "integer",
541+
"default": "1",
542+
"role": "new_column"
543+
},
544+
{
545+
"id": "doubleName",
546+
"type": "double",
547+
"default": "1.2",
548+
"role": "new_column"
549+
},
550+
{
551+
"id": "condition",
552+
"type": "string",
553+
"default": "",
554+
"role": "expression"
555+
},
556+
{
557+
"id": "dropdown",
558+
"enum": [
559+
"dog",
560+
"cat",
561+
"pig",
562+
"horse"
563+
],
564+
"default": "yellow"
565+
},
566+
{
567+
"id": "textfield",
568+
"type": "string",
569+
"default": "",
570+
"role": "new_column"
571+
}
572+
]
573+
},
507574
{
508575
"id": "onPanelNotVisibleTable",
509576
"parameters": [
@@ -885,6 +952,18 @@
885952
"default": "To generated a error: (integer Field = 2 OR double Field = 2.3) || condition field = help || animals field = horse || fruit field = pear"
886953
}
887954
},
955+
{
956+
"parameter_ref": "inlineEditingTableError3",
957+
"label": {
958+
"default": "Values"
959+
},
960+
"description": {
961+
"default": "Complex table control list editor table input without delete button"
962+
},
963+
"text_before": {
964+
"default": "To generated a error: (integer Field = 2 OR double Field = 2.3) || condition field = help || animals field = horse || fruit field = pear"
965+
}
966+
},
888967
{
889968
"parameter_ref": "onPanelNotVisibleTable",
890969
"label": {
@@ -1342,6 +1421,76 @@
13421421
}
13431422
]
13441423
},
1424+
{
1425+
"complex_type_ref": "inlineEditingTableError3",
1426+
"row_selection": "single",
1427+
"add_remove_rows": false,
1428+
"parameters": [
1429+
{
1430+
"parameter_ref": "valueName",
1431+
"label": {
1432+
"default": "Integer Field",
1433+
"resource_key": "expressionCellTable.name.label"
1434+
},
1435+
"description": {
1436+
"resource_key": "expressionCellTable.name.desc"
1437+
},
1438+
"width": 10,
1439+
"edit_style": "inline",
1440+
"summary": true
1441+
},
1442+
{
1443+
"parameter_ref": "doubleName",
1444+
"label": {
1445+
"default": "Double Field",
1446+
"resource_key": "expressionCellTable.doubleName.label"
1447+
},
1448+
"description": {
1449+
"resource_key": "expressionCellTable.doubleName.desc"
1450+
},
1451+
"width": 10,
1452+
"edit_style": "inline",
1453+
"summary": true
1454+
},
1455+
{
1456+
"parameter_ref": "condition",
1457+
"language": "CLEM",
1458+
"label": {
1459+
"resource_key": "expressionCellTable.description.label"
1460+
},
1461+
"description": {
1462+
"resource_key": "expressionCellTable.description.desc"
1463+
},
1464+
"width": 15,
1465+
"edit_style": "on_panel",
1466+
"place_holder_text": {
1467+
"default": "Enter condition expression"
1468+
}
1469+
},
1470+
{
1471+
"parameter_ref": "dropdown",
1472+
"label": {
1473+
"resource_key": "dropdown.label"
1474+
},
1475+
"description": {
1476+
"resource_key": "dropdown.desc"
1477+
},
1478+
"width": 10,
1479+
"edit_style": "inline"
1480+
},
1481+
{
1482+
"parameter_ref": "textfield",
1483+
"label": {
1484+
"resource_key": "textfield.label"
1485+
},
1486+
"description": {
1487+
"resource_key": "textfield.desc"
1488+
},
1489+
"width": 10,
1490+
"edit_style": "inline"
1491+
}
1492+
]
1493+
},
13451494
{
13461495
"complex_type_ref": "onPanelNotVisibleTable",
13471496
"row_selection": "single",
@@ -2009,6 +2158,21 @@
20092158
]
20102159
}
20112160
]
2161+
},
2162+
{
2163+
"id": "inlineEditingTableError3-summary-panel",
2164+
"type": "summaryPanel",
2165+
"label": {
2166+
"default": "Configure Error 3 Inline Editing Table without delete row button"
2167+
},
2168+
"group_info": [
2169+
{
2170+
"id": "Inline editing2",
2171+
"parameter_refs": [
2172+
"inlineEditingTableError3"
2173+
]
2174+
}
2175+
]
20122176
}
20132177
]
20142178
}
@@ -2244,6 +2408,112 @@
22442408
}
22452409
}
22462410
},
2411+
{
2412+
"validation": {
2413+
"id": "tableerror2test5",
2414+
"fail_message": {
2415+
"type": "error",
2416+
"focus_parameter_ref": "inlineEditingTableError3",
2417+
"message": {
2418+
"default": "This is a table control level error."
2419+
}
2420+
},
2421+
"evaluate": {
2422+
"condition": {
2423+
"parameter_ref": "inlineEditingTableError3",
2424+
"op": "isEmpty"
2425+
}
2426+
}
2427+
}
2428+
},
2429+
{
2430+
"validation": {
2431+
"id": "tableerror2test1",
2432+
"fail_message": {
2433+
"type": "error",
2434+
"focus_parameter_ref": "inlineEditingTableError3[0]",
2435+
"message": {
2436+
"resource_key": "invalid_subpanel_name",
2437+
"default": "fields are 2 or 2.3"
2438+
}
2439+
},
2440+
"evaluate": {
2441+
"and": [
2442+
{
2443+
"condition": {
2444+
"parameter_ref": "inlineEditingTableError3[0]",
2445+
"op": "notEquals",
2446+
"value": 2
2447+
}
2448+
},
2449+
{
2450+
"condition": {
2451+
"parameter_ref": "inlineEditingTableError3[1]",
2452+
"op": "notEquals",
2453+
"value": 2.3
2454+
}
2455+
}
2456+
]
2457+
}
2458+
}
2459+
},
2460+
{
2461+
"validation": {
2462+
"id": "tableerror2test2",
2463+
"fail_message": {
2464+
"type": "error",
2465+
"focus_parameter_ref": "inlineEditingTableError3[2]",
2466+
"message": {
2467+
"default": "expression contains help"
2468+
}
2469+
},
2470+
"evaluate": {
2471+
"condition": {
2472+
"parameter_ref": "inlineEditingTableError3[2]",
2473+
"op": "notContains",
2474+
"value": "help"
2475+
}
2476+
}
2477+
}
2478+
},
2479+
{
2480+
"validation": {
2481+
"id": "tableerror2test3",
2482+
"fail_message": {
2483+
"type": "warning",
2484+
"focus_parameter_ref": "inlineEditingTableError3[3]",
2485+
"message": {
2486+
"default": "animal equals horse"
2487+
}
2488+
},
2489+
"evaluate": {
2490+
"condition": {
2491+
"parameter_ref": "inlineEditingTableError3[3]",
2492+
"op": "notEquals",
2493+
"value": "horse"
2494+
}
2495+
}
2496+
}
2497+
},
2498+
{
2499+
"validation": {
2500+
"id": "tableerror2test4",
2501+
"fail_message": {
2502+
"type": "error",
2503+
"focus_parameter_ref": "inlineEditingTableError3[4]",
2504+
"message": {
2505+
"default": "fruit equals pear"
2506+
}
2507+
},
2508+
"evaluate": {
2509+
"condition": {
2510+
"parameter_ref": "inlineEditingTableError3[4]",
2511+
"op": "notEquals",
2512+
"value": "pear"
2513+
}
2514+
}
2515+
}
2516+
},
22472517
{
22482518
"allow_change": {
22492519
"parameter_refs": [

0 commit comments

Comments
 (0)