Skip to content

Commit 397de92

Browse files
yangzhang75claudemengw15
authored
feat(workflow-form): render Projection's drag-reorder list in the form, with the drag (apache#8843)
### What changes were proposed in this PR? Closes apache#8761. Part of the Form View feature (apache#8011); from the apache#8439 refinements (item 2). An exposed drag-reorder property -- Projection's columns, formly type `repeat-section-dnd` -- fell back to a plain repeated list in the Form View (`CANVAS_ONLY_FORMLY_TYPES`): a reader could edit the rows but not reorder them, which is what the widget is for. The fallback assumed the drag had nowhere to attach on a form; the widget carries its own CDK drop list, and the row template it needs comes from the operator's own schema (the per-instance one, with the upstream columns), which the form already builds. - `repeat-section-dnd` leaves `CANVAS_ONLY_FORMLY_TYPES`; the set now holds the code editor only. On the form the widget renders exactly as on the operator property panel, drag handle and all, and a drop reaches the operator through the card's `valueChanges` write-back; the panel's `reorder` callback stays optional (the widget calls it only when the host provides one), so the same widget serves both hosts without a form-specific branch. Nothing is added to the widget's UI. - Two defects in the widget itself, found while reviewing this and in reach of the form for the first time: every button now has `type="button"` -- `nz-button` sets no type, so inside a form (the card's, the panel's) a typeless button is the submit button and Enter in a row's input clicked it, removing the first row (the fallback the form used before had typed buttons; the panel has had this since the widget exists); and the rows are re-keyed to their positions after a drop, as formly's own `remove()` does -- formly keys rows by position and writes a cell's value into the model by that key path, so a value typed into a moved row landed on the row that used to be there (the same after a drag on the panel, until the operator was re-selected). ### Any related issues, documentation, discussions? Closes apache#8761. Raised by @mengw15 on apache#8436; filed from apache#8439. Builds on the sub-field walk from apache#8438. apache#8760 (proper) also shrinks `CANVAS_ONLY_FORMLY_TYPES`; whichever lands second deletes the then-empty set. Known limitation, not this PR's code: the Form View rebuilds every card on every compilation, including the one a card's own write triggers, so on the form a drop's write redraws the rows about a second later, and a second drop made in the last 150 ms before that redraw is undone. The canvas panel has no such rebuild. Filed as apache#8844 and fixed in apache#8845 (the form rebuilds only when the schema, the set of inputs or a value it does not hold changed); this PR is independent of it. Other follow-ups: a card's model is seeded once and never re-seeded from a co-editor's edit of the same property, so a reorder writes the whole array back over such an edit (pre-existing for every array/object property; a reorder is one more trigger); the HuggingFace and codearea widgets also carry typeless buttons. ### How was this PR tested? Unit tests (vitest). The widget's spec: a drop reorders the model, the field configs and the form controls and then tells the parent; a section without a reorder callback still reorders; a keyless row's children are re-keyed to the row's new position, as formly's own remove() does; every button carries `type="button"`; the existing rendering tests (one row per entry, draggable rows, remove, add, disabled section) still hold. A second spec stands the widget up under real formly (`FormlyModule.forRoot`, a form, a model): a drop changes the model and the cells and keeps the rows' keys in step with their positions, and a value typed into a moved row lands on that row's entry. The form's spec: Projection's `attributes` renders through `repeat-section-dnd`. `custom-formly-type`'s spec pins the set. Each guard was deletion-checked (the re-keying dropped; the callback called unguarded; the remove button typeless; the type back in the canvas-only set) and turned a named test red. eslint, prettier and the production (AOT) build pass; the full frontend suite passes; every statement, function and branch this PR adds is covered. Checked on a flag-on instance (main-demo; a Python source with four columns feeding a Projection whose `attributes` is exposed), with the canvas and the form open side by side: on main the card is a plain list (no handle); with this PR the card shows the drag handles, as the panel does. Dragging the last row to the top: the operator's order follows in the canvas tab's panel within a second and in the saved workflow. An alias typed into the moved row lands on that column, not its neighbour; Enter in an alias input removes no row; a reload shows the same order. A drop made on the canvas panel reaches the form within a second. #### Video **Before** https://github.com/user-attachments/assets/5a78f6f5-3b27-4b93-955e-bb15b40fd854 **After** https://github.com/user-attachments/assets/b84c79fa-a0a4-4bbc-b734-e75147bdf0d6 ### Was this PR authored or co-authored using generative AI tooling? Yes. Generated-by: Claude Code (Claude Fable 5.1, Anthropic). Co-authored with Claude, reviewed line by line by the author before submission. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: Meng Wang <[email protected]>
1 parent 4c982a7 commit 397de92

8 files changed

Lines changed: 216 additions & 37 deletions

File tree

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { CdkDragDrop } from "@angular/cdk/drag-drop";
21+
import { Component } from "@angular/core";
22+
import { TestBed } from "@angular/core/testing";
23+
import { FormArray, ReactiveFormsModule, UntypedFormGroup } from "@angular/forms";
24+
import { By } from "@angular/platform-browser";
25+
import { FieldType, FieldTypeConfig, FormlyFieldConfig, FormlyForm, FormlyModule } from "@ngx-formly/core";
26+
import { FormlyRepeatDndComponent } from "./repeat-dnd.component";
27+
28+
/** The plainest cell formly can build a row's sub-field into. */
29+
@Component({
30+
template: '<input [formControl]="formControl" />',
31+
imports: [ReactiveFormsModule],
32+
})
33+
class PlainInputType extends FieldType<FieldTypeConfig> {}
34+
35+
/** A form holding one repeated section, as the Form View's card and the operator property panel do. */
36+
@Component({
37+
template:
38+
'<form [formGroup]="form"><formly-form [form]="form" [model]="model" [fields]="fields"></formly-form></form>',
39+
imports: [ReactiveFormsModule, FormlyForm],
40+
})
41+
class CardComponent {
42+
form = new UntypedFormGroup({});
43+
model: { attributes: { alias: string }[] } = { attributes: [{ alias: "a" }, { alias: "b" }, { alias: "c" }] };
44+
fields: FormlyFieldConfig[] = [
45+
{
46+
key: "attributes",
47+
type: "repeat-section-dnd",
48+
fieldArray: () => ({ fieldGroup: [{ key: "alias", type: "plain" }] }),
49+
},
50+
];
51+
}
52+
53+
/**
54+
* Real formly, no mocks: formly keys a repeated section's rows by position and writes a cell's value
55+
* into the model by that key path, so a move that leaves the keys where they were sends a later edit
56+
* to the wrong row. The widget's own spec drives the drops on flat rows; this one proves the model.
57+
*/
58+
describe("FormlyRepeatDndComponent under real formly", () => {
59+
beforeEach(async () => {
60+
await TestBed.configureTestingModule({
61+
imports: [
62+
CardComponent,
63+
FormlyModule.forRoot({
64+
types: [
65+
{ name: "repeat-section-dnd", component: FormlyRepeatDndComponent },
66+
{ name: "plain", component: PlainInputType },
67+
],
68+
}),
69+
],
70+
}).compileComponents();
71+
});
72+
73+
function renderCard() {
74+
const fixture = TestBed.createComponent(CardComponent);
75+
fixture.detectChanges();
76+
const widget = fixture.debugElement.query(By.directive(FormlyRepeatDndComponent))
77+
.componentInstance as FormlyRepeatDndComponent;
78+
const aliases = () => fixture.componentInstance.model.attributes.map(row => row.alias);
79+
const cells = () => Array.from(fixture.nativeElement.querySelectorAll("input") as NodeListOf<HTMLInputElement>);
80+
return { fixture, widget, aliases, cells };
81+
}
82+
83+
it("moves the row in the model and on screen, and keeps the rows' keys in step with their positions", () => {
84+
const { fixture, widget, aliases, cells } = renderCard();
85+
86+
widget.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop<string[]>);
87+
fixture.detectChanges();
88+
89+
expect(aliases()).toEqual(["b", "a", "c"]);
90+
expect(cells().map(cell => cell.value)).toEqual(["b", "a", "c"]);
91+
expect(widget.field.fieldGroup!.map(row => row.key)).toEqual(["0", "1", "2"]);
92+
});
93+
94+
it("writes a value typed into a moved row onto that row's entry, not onto the row that used to be there", () => {
95+
const { fixture, widget, aliases } = renderCard();
96+
widget.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop<string[]>);
97+
fixture.detectChanges();
98+
99+
// The first row now shows "b"; typing there edits b's entry.
100+
(fixture.componentInstance.form.get("attributes") as FormArray).at(0).get("alias")!.setValue("typed");
101+
102+
expect(aliases()).toEqual(["typed", "a", "c"]);
103+
});
104+
});

‎frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.html‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@
4040
[field]="subField"></formly-field>
4141
</div>
4242

43+
<!-- type="button" on every button here: nz-button sets no type, so inside a form (the Form View's
44+
card, the operator property panel) a typeless button is the form's submit button, and Enter
45+
in a row's input would click it -- here, removing the first row. -->
4346
<button
4447
nz-button
4548
nzType="default"
49+
type="button"
4650
(click)="remove(i)"
4751
class="dnd-remove-button"
4852
[disabled]="field.templateOptions?.disabled">
@@ -57,6 +61,7 @@
5761
<button
5862
nz-button
5963
nzType="default"
64+
type="button"
6065
(click)="add()"
6166
[disabled]="field.templateOptions?.disabled">
6267
{{ field.templateOptions?.addText || "Add" }}

‎frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.spec.ts‎

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ describe("FormlyRepeatDndComponent", () => {
3535

3636
component.field = {
3737
model: ["a", "b", "c"],
38-
fieldGroup: [{ key: "a" }, { key: "b" }, { key: "c" }],
38+
// Keyed by position, as formly keys rows; the id is the test's own marker for which row is which.
39+
fieldGroup: [
40+
{ key: "0", id: "a" },
41+
{ key: "1", id: "b" },
42+
{ key: "2", id: "c" },
43+
],
3944
formControl,
4045
props: { reorder },
4146
} as any;
@@ -64,7 +69,7 @@ describe("FormlyRepeatDndComponent", () => {
6469
component.onDrop(createDropEvent(1, 1));
6570

6671
expect(component.model).toEqual(["a", "b", "c"]);
67-
expect(component.field.fieldGroup?.map(field => field.key)).toEqual(["a", "b", "c"]);
72+
expect(component.field.fieldGroup?.map(field => field.id)).toEqual(["a", "b", "c"]);
6873
expect((component.formControl as FormArray).controls.map(control => control.value)).toEqual(["a", "b", "c"]);
6974
expect(reorder).not.toHaveBeenCalled();
7075
});
@@ -78,7 +83,7 @@ describe("FormlyRepeatDndComponent", () => {
7883

7984
component.onDrop(createDropEvent(0, 2));
8085

81-
expect(component.field.fieldGroup?.map(field => field.key)).toEqual(["a", "b", "c"]);
86+
expect(component.field.fieldGroup?.map(field => field.id)).toEqual(["a", "b", "c"]);
8287
expect((component.formControl as FormArray).controls.map(control => control.value)).toEqual(["a", "b", "c"]);
8388
expect(reorder).not.toHaveBeenCalled();
8489
});
@@ -90,24 +95,24 @@ describe("FormlyRepeatDndComponent", () => {
9095
// what makes that ordering observable — the final assertions below are order-insensitive,
9196
// and moveItemInArray mutates in place, so the captures must be copies.
9297
let seenModel: string[] | undefined;
93-
let seenFieldKeys: unknown[] | undefined;
98+
let seenFieldIds: unknown[] | undefined;
9499
let seenControls: unknown[] | undefined;
95100
const reorder = setComponentState(
96101
vi.fn(() => {
97102
seenModel = [...(component.model as string[])];
98-
seenFieldKeys = component.field.fieldGroup?.map(field => field.key);
103+
seenFieldIds = component.field.fieldGroup?.map(field => field.id);
99104
seenControls = (component.formControl as FormArray).controls.map(control => control.value);
100105
})
101106
);
102107

103108
component.onDrop(createDropEvent(0, 2));
104109

105110
expect(component.model).toEqual(["b", "c", "a"]);
106-
expect(component.field.fieldGroup?.map(field => field.key)).toEqual(["b", "c", "a"]);
111+
expect(component.field.fieldGroup?.map(field => field.id)).toEqual(["b", "c", "a"]);
107112
expect((component.formControl as FormArray).controls.map(control => control.value)).toEqual(["b", "c", "a"]);
108113
expect(reorder).toHaveBeenCalledOnce();
109114
expect(seenModel).toEqual(["b", "c", "a"]);
110-
expect(seenFieldKeys).toEqual(["b", "c", "a"]);
115+
expect(seenFieldIds).toEqual(["b", "c", "a"]);
111116
expect(seenControls).toEqual(["b", "c", "a"]);
112117
});
113118

@@ -122,9 +127,29 @@ describe("FormlyRepeatDndComponent", () => {
122127

123128
expect(() => component.onDrop(createDropEvent(0, 2))).not.toThrow();
124129
expect(component.model).toEqual(["b", "c", "a"]);
125-
expect(component.field.fieldGroup?.map(field => field.key)).toEqual(["b", "c", "a"]);
130+
expect(component.field.fieldGroup?.map(field => field.id)).toEqual(["b", "c", "a"]);
126131
expect((component.formControl as FormArray).controls.map(control => control.value)).toEqual(["b", "c", "a"]);
127132
});
133+
// formly keys a row by position unless the template says `key: null`; then the row's keyed children
134+
// carry the position instead, and formly's own remove() re-keys those. The move mirrors it.
135+
it("re-keys a keyless row's children to the row's new position, as formly does", () => {
136+
setComponentState();
137+
component.field = {
138+
...component.field,
139+
fieldGroup: [
140+
{ key: null, id: "a", fieldGroup: [{ key: "0" }] },
141+
{ key: null, id: "b", fieldGroup: [{ key: "1" }] },
142+
{ key: null, id: "c", fieldGroup: [{ key: "2" }] },
143+
],
144+
} as any;
145+
146+
component.onDrop(createDropEvent(0, 2));
147+
148+
expect(component.field.fieldGroup?.map(row => row.id)).toEqual(["b", "c", "a"]);
149+
expect(component.field.fieldGroup?.map(row => row.fieldGroup?.[0].key)).toEqual(["0", "1", "2"]);
150+
expect(component.field.fieldGroup?.every(row => row.key === null)).toBe(true);
151+
});
152+
128153
/**
129154
* The class-level tests above drive onDrop directly and never render. The template owns the rest
130155
* of the control: one row per entry, which index a row's remove button carries, and whether the
@@ -136,7 +161,12 @@ describe("FormlyRepeatDndComponent", () => {
136161
setComponentState();
137162
component.field = {
138163
...component.field,
139-
fieldGroup: [{ key: "a" }, { key: "b" }, { key: "c" }],
164+
// Keyed by position, as formly keys rows; the id is the test's own marker for which row is which.
165+
fieldGroup: [
166+
{ key: "0", id: "a" },
167+
{ key: "1", id: "b" },
168+
{ key: "2", id: "c" },
169+
],
140170
templateOptions,
141171
} as any;
142172
fixture.detectChanges();
@@ -156,6 +186,16 @@ describe("FormlyRepeatDndComponent", () => {
156186
)!;
157187
}
158188

189+
// nz-button sets no type, so a typeless button inside a form is its submit button and Enter in a
190+
// row's input clicks it (HTML implicit submission) -- which here used to remove the first row.
191+
it("gives every button an explicit type, so Enter in a row's input submits nothing", () => {
192+
const el = render();
193+
194+
const buttons = Array.from(el.querySelectorAll("button"));
195+
expect(buttons.length).toBeGreaterThan(3);
196+
expect(buttons.every(button => button.getAttribute("type") === "button")).toBe(true);
197+
});
198+
159199
it("renders one row per entry", () => {
160200
const el = render();
161201

‎frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.ts‎

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Component } from "@angular/core";
21-
import { FieldArrayType, FormlyModule } from "@ngx-formly/core";
21+
import { FieldArrayType, FormlyFieldConfig, FormlyModule } from "@ngx-formly/core";
2222
import { CdkDragDrop, moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle } from "@angular/cdk/drag-drop";
2323
import { NgFor } from "@angular/common";
2424
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
@@ -45,25 +45,39 @@ import { NzWaveDirective } from "ng-zorro-antd/core/wave";
4545
],
4646
})
4747
export class FormlyRepeatDndComponent extends FieldArrayType {
48+
/**
49+
* Move the dropped row, in step: the data model (the source of truth for the backend), the formly
50+
* field configs (the UI definition) and the FormArray controls (the live form state), then the
51+
* parent's optional reorder callback (the operator property panel's, which saves without redrawing
52+
* the form; the Form View's card has none, its form's valueChanges persists the move). Nothing
53+
* moves for no model or a drop on the same position.
54+
*/
4855
onDrop(event: CdkDragDrop<string[]>) {
49-
if (!this.model || event.previousIndex === event.currentIndex) {
56+
const from = event.previousIndex;
57+
const to = event.currentIndex;
58+
if (!this.model || from === to) {
5059
return;
5160
}
52-
53-
// 1. Reorder the data model. This is the source of truth for the backend.
54-
moveItemInArray(this.model, event.previousIndex, event.currentIndex);
55-
56-
// 2. Reorder the Formly field configurations. This keeps the UI definition in sync with the data.
57-
moveItemInArray(this.field.fieldGroup!, event.previousIndex, event.currentIndex);
58-
59-
// 3. Reorder the actual Angular FormArray controls. This keeps the live form state in sync.
60-
const control = this.formControl.at(event.previousIndex);
61-
this.formControl.removeAt(event.previousIndex);
62-
this.formControl.insert(event.currentIndex, control);
63-
64-
// 4. Notify the parent to save the changes. The parent should NOT redraw the form.
61+
moveItemInArray(this.model, from, to);
62+
moveItemInArray(this.field.fieldGroup!, from, to);
63+
// formly keys a row by its position when it builds the rows, and writes a cell's value into
64+
// the model by that key path; so the rows are re-keyed to where they now are, as formly's own
65+
// remove() does, or a value typed into a moved row would land on the row that used to be there.
66+
this.field.fieldGroup!.forEach((row, index) => this.rekey(row, `${index}`));
67+
const control = this.formControl.at(from);
68+
this.formControl.removeAt(from);
69+
this.formControl.insert(to, control);
6570
if (this.props.reorder) {
6671
this.props.reorder();
6772
}
6873
}
74+
75+
/** formly's updateArrayElementKey, which it keeps private: the row's own key, else its keyed children's. */
76+
private rekey(row: FormlyFieldConfig, key: string): void {
77+
if (row.key !== undefined && row.key !== null && row.key !== "") {
78+
row.key = key;
79+
return;
80+
}
81+
row.fieldGroup?.forEach(child => this.rekey(child, key));
82+
}
6983
}

‎frontend/src/app/workspace/component/workflow-form/workflow-form.component.spec.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,22 @@ describe("WorkflowFormComponent", () => {
954954
expect(component.rendered[0].fields[0].type).toBe("huggingface");
955955
});
956956

957+
// Projection's column list is the drag-reorder widget on the canvas; the form renders the same
958+
// widget, with its drag, rather than falling back to a plain list (#8761).
959+
it("renders Projection's attributes through the drag-reorder widget, as the canvas does", () => {
960+
build(formViewWorkflow).ngOnInit();
961+
h.graphOperators.push({ operatorID: "op-1", operatorType: "Projection" });
962+
(component as any).formlyJsonschema = {
963+
toFieldConfig: (_schema: any, opts: any) => ({
964+
fieldGroup: [{ key: "attributes", type: "array", props: { label: "Attributes" } }].map(opts.map),
965+
}),
966+
};
967+
968+
renderOne("attributes");
969+
970+
expect(component.rendered[0].fields[0].type).toBe("repeat-section-dnd");
971+
});
972+
957973
it("renders a file property through its own picker type", () => {
958974
build(formViewWorkflow).ngOnInit();
959975

‎frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,9 @@ export class WorkflowFormComponent implements OnInit, OnDestroy {
869869
description: (source as { description?: string })?.description,
870870
currentType: mapped.type,
871871
});
872-
// Canvas-only widgets (code editor, drag-reorder) do not work here; an older workflow may
873-
// already carry one, so leave it to formly's default editable control rather than a widget
874-
// that cannot function on a form.
872+
// A canvas-only widget (the code editor) does not work here; an older workflow may already
873+
// carry one, so leave it to formly's default editable control rather than a widget that
874+
// cannot function on a form.
875875
if (customType && !CANVAS_ONLY_FORMLY_TYPES.has(customType)) {
876876
mapped.type = customType;
877877
}

‎frontend/src/app/workspace/util/custom-formly-type.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ import { customFormlyFieldType, NON_FORM_FIELD_TYPES, CANVAS_ONLY_FORMLY_TYPES }
2222
describe("NON_FORM_FIELD_TYPES", () => {
2323
it("blocks only the code editor from being a form field, not the drag-reorder list", () => {
2424
expect(NON_FORM_FIELD_TYPES.has("codearea")).toBe(true);
25-
// a drag-reorder property is still a valid form field (it just renders without the drag)
25+
// a drag-reorder property is still a valid form field, and the form renders it with its drag (#8761)
2626
expect(NON_FORM_FIELD_TYPES.has("repeat-section-dnd")).toBe(false);
2727
});
2828
});
2929

3030
describe("CANVAS_ONLY_FORMLY_TYPES", () => {
31-
it("holds the widgets the form falls back from: the code editor and the drag-reorder list", () => {
31+
it("holds the widgets the form falls back from: the code editor, and the code editor only", () => {
3232
expect(CANVAS_ONLY_FORMLY_TYPES.has("codearea")).toBe(true);
33-
// the drag has nowhere to attach on a form, so an exposed one degrades to the default control
34-
expect(CANVAS_ONLY_FORMLY_TYPES.has("repeat-section-dnd")).toBe(true);
33+
// the drag-reorder list carries its own drop list, so the form renders it, drag and all (#8761)
34+
expect(CANVAS_ONLY_FORMLY_TYPES.has("repeat-section-dnd")).toBe(false);
3535
// an ordinary custom widget (a picker/uploader) is rendered as itself, not fallen back from
3636
expect(CANVAS_ONLY_FORMLY_TYPES.has("datasetversionselector")).toBe(false);
3737
});

‎frontend/src/app/workspace/util/custom-formly-type.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
* Widget types that cannot be a form field at all, so the property is not offered for exposure on
2222
* the Form View. Only the code editor: editing code is not "filling in a value", and a form reader
2323
* should not be writing code. (A drag-reorder property such as Projection's columns stays exposable
24-
* -- it just renders without the drag in the form -- so it is deliberately NOT in this set.)
24+
* and renders with its drag in the form, so it is deliberately NOT in this set.)
2525
*/
2626
export const NON_FORM_FIELD_TYPES: ReadonlySet<string> = new Set(["codearea"]);
2727

2828
/**
2929
* Widgets that only work on the operator canvas, so the Form View does not render them: it falls
30-
* back to formly's default control instead. The code editor (also blocked from exposure by
31-
* {@link NON_FORM_FIELD_TYPES}) and the drag-reorder list, whose drag has nowhere to attach on a
32-
* form -- a workflow may still carry an exposed drag-reorder property from before, and it degrades
33-
* to a plain editable list rather than a control that cannot function here.
30+
* back to formly's default control instead. Only the code editor (also blocked from exposure by
31+
* {@link NON_FORM_FIELD_TYPES}), which opens into an outlet the canvas owns. The drag-reorder list
32+
* used to be here too, as if its drag had nowhere to attach on a form; it carries its own drop
33+
* list, and renders on the form with the drag, as on the panel (#8761).
3434
*/
35-
export const CANVAS_ONLY_FORMLY_TYPES: ReadonlySet<string> = new Set(["codearea", "repeat-section-dnd"]);
35+
export const CANVAS_ONLY_FORMLY_TYPES: ReadonlySet<string> = new Set(["codearea"]);
3636

3737
/**
3838
* The custom formly widget an operator-schema property renders as, decided from the property key

0 commit comments

Comments
 (0)