UNPKG

6.14 kBJavaScriptView Raw
1(function (global, factory) {
2 if (typeof define === "function" && define.amd) {
3 define(['module'], factory);
4 } else if (typeof exports !== "undefined") {
5 factory(module);
6 } else {
7 var mod = {
8 exports: {}
9 };
10 factory(mod);
11 global.dataTableConfig = mod.exports;
12 }
13})(this, function (module) {
14 'use strict';
15
16 var menuItems = [{
17 label: 'Stop app',
18 primaryFocus: true
19 }, {
20 label: 'Restart app'
21 }, {
22 label: 'Rename app'
23 }, {
24 label: 'Edit routes and access'
25 }, {
26 label: 'Delete app',
27 danger: true
28 }];
29
30 var columns = [{
31 name: 'section',
32 section: true
33 }, {
34 name: 'select',
35 title: 'Label name',
36 checkbox: true,
37 checkboxId: 'bx--checkbox-1',
38 checkboxName: 'checkbox-1',
39 checkboxValue: 'green'
40 }, {
41 name: 'firstName',
42 title: 'First Name',
43 sortable: true
44 }, {
45 name: 'lastName',
46 title: 'Last Name',
47 sortable: true
48 }, {
49 name: 'house',
50 title: 'House',
51 sortable: true
52 }, {
53 name: 'menu',
54 menu: true
55 }];
56
57 var columnsSimple = [{
58 name: 'firstName',
59 title: 'First Name',
60 sortable: true
61 }, {
62 name: 'lastName',
63 title: 'Last Name',
64 sortable: true
65 }, {
66 name: 'house',
67 title: 'House',
68 sortable: true
69 }];
70
71 var rows = [{
72 sectionContent: '\n <h4><strong>Harry Potter</strong></h4>\n <p>Harry James Potter (b. 31 July, 1980) was a half-blood wizard, the only child and son of the late James and Lily\n Potter (n\xE9e Evans), and one of the most famous and powerful wizards of modern times. In what proved to be a vain\n attempt to circumvent a prophecy that stated that a boy born at the end of July of 1980 could be able to defeat\n him, Lord Voldemort tried to murder him when he was a year and three months old. Voldemort murdered Harry\'s parents\n as they tried to protect him, shortly before attacking Harry.</p>\n ',
73 section: true,
74 select: {
75 id: 'checkbox-2',
76 label: 'Label name'
77 },
78 firstName: 'Harry',
79 lastName: 'Potter',
80 house: 'Gryffindor',
81 menu: {
82 label: 'Overflow menu description',
83 items: menuItems
84 }
85 }, {
86 sectionContent: '\n <table class="bx--responsive-table bx--responsive-table--static-size">\n <thead>\n <tr class="bx--table-row">\n <th class="bx--table-header">First Name</th>\n <th class="bx--table-header">Last Name</th>\n <th class="bx--table-header">House</th>\n <th class="bx--table-header">Hello</th>\n <th class="bx--table-header">Column</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Godric</td>\n <td>Gryffindor</td>\n <td>Origin</td>\n <td>Something</td>\n <td>Hooray</td>\n </tr>\n <tr>\n <td>Salazar</td>\n <td>Slytherin</td>\n <td>Origin</td>\n <td>Something</td>\n <td>Hooray</td>\n </tr>\n </tbody>\n </table>\n ',
87 section: true,
88 select: {
89 id: 'checkbox-3',
90 label: 'Label name'
91 },
92 firstName: 'Hermoine',
93 lastName: 'Granger',
94 house: 'Gryffindor',
95 menu: {
96 label: 'Overflow menu description',
97 items: menuItems,
98 flip: true
99 }
100 }, {
101 sectionContent: '\n <img src="https://upload.wikimedia.org/wikipedia/en/5/5e/Ron_Weasley_poster.jpg" />\n ',
102 section: true,
103 select: {
104 id: 'checkbox-4',
105 label: 'Label name'
106 },
107 firstName: 'Ron',
108 lastName: 'Weasley',
109 house: 'Gryffindor',
110 menu: {
111 label: 'Overflow menu description',
112 items: menuItems,
113 flip: true
114 }
115 }, {
116 sectionContent: '\n <p>Draco Malfoy is in Gryffindor House. He is in his fifth year.</p>\n ',
117 section: true,
118 select: {
119 id: 'checkbox-5',
120 label: 'Label name'
121 },
122 firstName: 'Draco',
123 lastName: 'Malfoy',
124 house: 'Slytherin',
125 menu: {
126 label: 'Overflow menu description',
127 items: menuItems,
128 flip: true
129 }
130 }, {
131 sectionContent: '\n <p>Blaise Zabini is in Gryffindor House. He is in his fifth year.</p>\n ',
132 section: true,
133 select: {
134 id: 'checkbox-6',
135 label: 'Label name'
136 },
137 firstName: 'Blaise',
138 lastName: 'Zabini',
139 house: 'Slytherin',
140 menu: {
141 label: 'Overflow menu description',
142 items: menuItems,
143 flip: true
144 }
145 }, {
146 sectionContent: '\n <p>Cedric Diggory is in Hufflepuff House. He is in his fifth year.</p>\n ',
147 section: true,
148 select: {
149 id: 'checkbox-7',
150 label: 'Label name'
151 },
152 firstName: 'Cedric',
153 lastName: 'Diggory',
154 house: 'Hufflepuff',
155 menu: {
156 label: 'Overflow menu description',
157 items: menuItems,
158 flip: true
159 }
160 }, {
161 sectionContent: '\n <p>Luna Lovegood is in Ravenclaw House. She is in her fifth year.</p>\n ',
162 section: true,
163 select: {
164 id: 'checkbox-8',
165 label: 'Label name'
166 },
167 firstName: 'Luna',
168 lastName: 'Lovegood',
169 house: 'Ravenclaw',
170 menu: {
171 label: 'Overflow menu description',
172 items: menuItems,
173 flip: true
174 }
175 }, {
176 sectionContent: '\n <p>Cho Chang is in Gryffindor House. She is in her fifth year.</p>\n ',
177 section: true,
178 select: {
179 id: 'checkbox-9',
180 label: 'Label name'
181 },
182 firstName: 'Cho',
183 lastName: 'Chang',
184 house: 'Ravenclaw',
185 menu: {
186 label: 'Overflow menu description',
187 items: menuItems,
188 flip: true
189 }
190 }];
191
192 module.exports = {
193 variants: [{
194 name: 'default',
195 label: 'Data Table',
196 notes: '\n Data Tables are used to represent a collection of resources, displaying a\n subset of their fields in columns, or headers.\n ',
197 context: {
198 columns: columns,
199 rows: rows
200 }
201 }, {
202 name: 'simple',
203 label: 'Simple',
204 context: {
205 simple: true,
206 columns: columnsSimple,
207 rows: rows
208 }
209 }]
210 };
211});
\No newline at end of file