CreateColumnPanelsBox.ts 1,4 КБ
Newer Older
Medvedev Anton's avatar
Medvedev Anton включено в состав коммита
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { COLOR_LIGHT, COLOR_PRIMARY, COLOR_DARK } from './Const';
import CreateColumnPanel from './CreateColumnPanel';
import AddDragDropColumnPanelBehavior from './AddDragDropColumnPanelBehavior';

type Scene = {
  rexUI: {
      add: {
          sizer: (config: SizerConfig) => Sizer
      }
  }
};

type SizerConfig = {
  orientation: string;
  space: {
      left: number;
      right: number;
      top: number;
      bottom: number;
  };
};

type Sizer = {
  add: (item: any, config: any) => void;
};

const CreateColumnPanelsBox = (scene: Scene, itemCountArray: number[]): Sizer => {
  const config: SizerConfig = {
      orientation: 'x',
      space: {
          left: 10, right: 10, top: 10, bottom: 10
      },
  };

  const columnPanelsBox: Sizer = scene.rexUI.add.sizer(config);
  // .addBackground(
  //     scene.rexUI.add.roundRectangle({
  //         strokeColor: COLOR_PRIMARY,
  //         strokeWidth: 3,
  //     }),
  //     'background'
  // )

  for (let i = 0, cnt = itemCountArray.length; i < cnt; i++) {
      const columnPanel = CreateColumnPanel(scene, `Header ${i}`, itemCountArray[i]);
      columnPanelsBox.add(
          columnPanel,
          { proportion: 0, expand: true }
      );
  }

  AddDragDropColumnPanelBehavior(columnPanelsBox); // Убедитесь, что функция AddDragDropColumnPanelBehavior определена где-то в вашем коде

  return columnPanelsBox;
}

export default CreateColumnPanelsBox;