- fixed dynamic tags aggregation #6342;
This commit is contained in:
@@ -95,12 +95,13 @@ const BandoEditFormStep3 = forwardRef(function () {
|
|||||||
const getFormsCallback = (resp) => {
|
const getFormsCallback = (resp) => {
|
||||||
if (resp.status === 'SUCCESS') {
|
if (resp.status === 'SUCCESS') {
|
||||||
const EXCLUDED_TYPES = new Set(['fileupload', 'fileselect', 'table', 'criteria_table', 'spreadsheet']);
|
const EXCLUDED_TYPES = new Set(['fileupload', 'fileselect', 'table', 'criteria_table', 'spreadsheet']);
|
||||||
|
console.log('resp.data', resp.data)
|
||||||
const raw = (resp.data ?? []).flatMap(form =>
|
const raw = (resp.data ?? []).flatMap(form =>
|
||||||
(form.content ?? [])
|
(form.content ?? [])
|
||||||
.filter(f => !EXCLUDED_TYPES.has(f.name))
|
.filter(f => !EXCLUDED_TYPES.has(f.name))
|
||||||
.map(f => ({
|
.map(f => ({
|
||||||
id: f.id,
|
id: f.id,
|
||||||
label: f.label,
|
label: f.settings?.find(s => s.name === 'label')?.value ?? f.label,
|
||||||
placeholder: f.settings?.find(s => s.name === 'placeholder')?.value ?? ''
|
placeholder: f.settings?.find(s => s.name === 'placeholder')?.value ?? ''
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
@@ -109,6 +110,7 @@ const BandoEditFormStep3 = forwardRef(function () {
|
|||||||
if (!byLabel.has(f.label)) byLabel.set(f.label, { label: f.label, ids: [], placeholder: f.placeholder });
|
if (!byLabel.has(f.label)) byLabel.set(f.label, { label: f.label, ids: [], placeholder: f.placeholder });
|
||||||
byLabel.get(f.label).ids.push(f.id);
|
byLabel.get(f.label).ids.push(f.id);
|
||||||
});
|
});
|
||||||
|
console.log('byLabel', Array.from(byLabel.values()))
|
||||||
storeSet('callFormFields', Array.from(byLabel.values()));
|
storeSet('callFormFields', Array.from(byLabel.values()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,10 +162,16 @@ const ElementSettingSpreadsheet = ({ value, name, setDataFn }) => {
|
|||||||
|
|
||||||
}, []); // refs are stable
|
}, []); // refs are stable
|
||||||
|
|
||||||
// Keep formFieldsRef in sync with store value
|
// Keep formFieldsRef in sync with store value; rebuild Univer (and its context menu)
|
||||||
|
// once fields arrive, because the menu is constructed at init time from formFieldsRef.current.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('callFormFields', callFormFields)
|
||||||
formFieldsRef.current = callFormFields;
|
formFieldsRef.current = callFormFields;
|
||||||
}, [callFormFields]);
|
if (callFormFields.length > 0 && univerAPIRef.current) {
|
||||||
|
const currentWorkbook = univerAPIRef.current.getActiveWorkbook()?.save() ?? null;
|
||||||
|
initializeUniver(currentWorkbook);
|
||||||
|
}
|
||||||
|
}, [callFormFields, initializeUniver]);
|
||||||
|
|
||||||
// Initialize Univer on mount
|
// Initialize Univer on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user