Skip to content

Commit

Permalink
fix the group handling of image-8 (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 authored Jan 24, 2024
1 parent a11f38f commit 56cf9a7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/src/Vis/Widgets/Basic/BasicImage8.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { GetRxDataFromWidget, RxRenderWidgetProps } from '@/types';
import type { GetRxDataFromWidget, RxRenderWidgetProps } from '@/types';
import { store, recalculateFields } from '@/Store';
import VisRxWidget from '@/Vis/visRxWidget';

type RxData = GetRxDataFromWidget<typeof BasicImage8>;
Expand Down Expand Up @@ -30,13 +31,26 @@ export default class BasicImage8 extends VisRxWidget<RxData> {
name: 'count',
type: 'number',
default: 1,
onChange: async (_field: unknown, data: Record<string, any>, changeData: (data: Record<string, any>) => void) => {
const { count } = data;

for (let i = 0; i < count; i++) {
data[`g_images-${i}`] = true;
}

changeData(data);
store.dispatch(recalculateFields(true));
},
},
],
}, {
name: 'group.images',
name: 'images',
label: 'Image',
indexFrom: 1,
indexTo: 'count',
fields: [
{
name: 'src_(0-count)',
name: 'src_',
type: 'image',
},
],
Expand Down

0 comments on commit 56cf9a7

Please sign in to comment.