File size: 6,516 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
"use strict";

module.exports = [
  {
    title: "Showcase",
    source: "showcase",
    paragraphs: [
      "React-Grid-Layout is a grid layout system for React. It features auto-packing, draggable and resizable " +
        "widgets, static widgets, a fluid layout, and separate layouts per responsive breakpoint.",
      "Try it out! Drag some boxes around, resize them, and resize the window to see the responsive breakpoints."
    ]
  },
  {
    title: "Basic",
    source: "basic",
    paragraphs: [
      "Try dragging the elements around.",
      "This is a basic, non-responsive layout with dragging and resizing. Usage is very simple."
    ]
  },
  {
    title: "No Dragging",
    source: "no-dragging",
    paragraphs: [
      "This particular example has dragging and resizing turned off."
    ]
  },
  {
    title: "Messy",
    source: "messy",
    paragraphs: [
      "This demo shows what happens when elements are placed randomly all over the layout.",
      "RGL does not auto-pack in the same fashion as other projects, such as jQuery Masonry. Packing is only done " +
        "in the vertical dimension. If objects all have the same width, they will be packed efficiently.",
      "If a layout is fed to RGL that has items with incorrect dimensions (width too big, overlapping other elements, " +
        "out of bounds, etc), they will be automatically corrected on startup. See the " +
        "source of this demo, where elements are placed randomly in the layout."
    ]
  },
  {
    title: "Grid Item Properties",
    source: "grid-property",
    paragraphs: [
      "This demo uses a layout assigned on the grid items themselves as the <code>data-grid</code> property."
    ]
  },
  {
    title: "Static Elements",
    source: "static-elements",
    paragraphs: [
      "This demo sets an item to <code>static</code>. Static elements cannot be moved or resized. Other elements " +
        "move themselves around a static element."
    ]
  },
  {
    title: "Dynamic Add/Remove",
    source: "dynamic-add-remove",
    paragraphs: [
      "This demo shows what happens when items are dynamically added and removed.",
      'You can remove an item by clicking its "x", and add a new one with the button.',
      "To further illustration RGL's capacities, this particular example is responsive. Trying resizing the window."
    ]
  },
  {
    title: "LocalStorage",
    source: "localstorage",
    paragraphs: [
      "This simple demo synchronizes to localStorage.",
      "Try moving and resizing elements, then reloading."
    ]
  },
  {
    title: "Responsive with LocalStorage",
    source: "localstorage-responsive",
    paragraphs: [
      "This simple demo synchronizes to localStorage for each responsive breakpoint.",
      "Try moving and resizing elements, changing window width, moving some more, and refreshing.",
      "Each breakpoint has a separate layout. The <code>onLayoutChange</code> callback calls back with " +
        "a hash of breakpoints to layouts, which is then synchronized to localStorage."
    ]
  },
  {
    title: "Minimum and Maximum Width/Height",
    source: "min-max-wh",
    paragraphs: [
      "You can set min and max dimensions on a grid item by using the `minW`, `maxW`, `minH`, and `maxH` properties.",
      "In this demo, the min and max dimensions are generated automatically. Try resizing the items below.",
      "If your mins and maxes collide: for example min > max, or the initial dimensions are out of range, " +
        "an error will be thrown."
    ]
  },
  {
    title: "Dynamic Minimum and Maximum Width/Height",
    source: "dynamic-min-max-wh",
    paragraphs: [
      "Your application may have more complex rules for determining an element's mins and maxes. This demo " +
        "demonstrates how to use the `onResize` handler to accomplish this.",
      "In this grid, all elements are allowed a max width of 2 if the height < 3, " +
        "and a min width of 2 if the height >= 3."
    ]
  },
  {
    title: "No Vertical Compacting (Free Movement)",
    source: "no-vertical-compact",
    paragraphs: [
      "You may want to turn off vertical compacting so items can be placed anywhere in the grid. Set the " +
        "property `compactType` to `null` to achieve this effect."
    ]
  },
  {
    title: "Prevent Collision",
    source: "prevent-collision",
    paragraphs: [
      "You may want to turn off rearrangement so items don't move arround when dragging. Set the " +
        "property `preventCollision` to `true` to achieve this effect. " +
        "It's particularly useful with `compactType` set to `null`."
    ]
  },
  {
    title: "Error Case",
    source: "error-case",
    paragraphs: [
      "This is an extra test case for a collision bug fixed in November 2017. When you drag 1 over 2, it should not " +
        "move over 3."
    ]
  },
  {
    title: "Toolbox",
    source: "toolbox",
    paragraphs: [
      "This demonstrates how to implement a toolbox to add and remove widgets. Click the 'X' on a widget to move it into the toolbox."
    ]
  },
  {
    title: "Drag From Outside",
    source: "drag-from-outside",
    paragraphs: [
      "This demo shows what happens when an item is added from outside of the grid.",
      "Once you drop the item within the grid you'll get its coordinates/properties and can perform actions with " +
        "it accordingly."
    ]
  },
  {
    title: "Bounded",
    source: "bounded",
    paragraphs: [
      "Try dragging the elements around. They can only be moved within the grid, the draggable placeholder will not show outside it."
    ]
  },
  {
    title: "Bootstrap-style Responsive Grid",
    source: "responsive-bootstrap-style",
    paragraphs: [
      "This demonstrates how to use ResponsiveGridLayout to create a Bootstrap-style responsive grid."
    ]
  },
  {
    title: "Scale",
    source: "scale",
    paragraphs: [
      "This demonstrates how to compensate for a scaled parent."
    ]
  },
  {
    title: "Allow Overlap",
    source: "allow-overlap",
    paragraphs: [
      "This demonstrates how to overlap grid items."
    ]
  },
  {
    title: "All Resizable Handles",
    source: "resizable-handles",
    paragraphs: [
      "This shows a grid with all resizable handles enabled. See the prop `resizableHandles` on the grid and grid items in the README."
    ]
  },
  {
    title: "Single Row Horizontal",
    source: "horizontal",
    paragraphs: [
      "This demonstrates how to constrain the elements to a single row."
    ]
  },
];