cherrypy-foundation 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. cherrypy_foundation/__init__.py +0 -0
  2. cherrypy_foundation/components/ColorModes.jinja +70 -0
  3. cherrypy_foundation/components/Datatable.css +47 -0
  4. cherrypy_foundation/components/Datatable.jinja +63 -0
  5. cherrypy_foundation/components/Datatable.js +358 -0
  6. cherrypy_foundation/components/Field.css +10 -0
  7. cherrypy_foundation/components/Field.jinja +66 -0
  8. cherrypy_foundation/components/Field.js +56 -0
  9. cherrypy_foundation/components/Fields.jinja +4 -0
  10. cherrypy_foundation/components/Flash.jinja +13 -0
  11. cherrypy_foundation/components/Icon.jinja +3 -0
  12. cherrypy_foundation/components/LocaleSelection.jinja +13 -0
  13. cherrypy_foundation/components/LocaleSelection.js +26 -0
  14. cherrypy_foundation/components/SideBySideMultiSelect.css +25 -0
  15. cherrypy_foundation/components/SideBySideMultiSelect.jinja +9 -0
  16. cherrypy_foundation/components/SideBySideMultiSelect.js +9 -0
  17. cherrypy_foundation/components/Typeahead.css +55 -0
  18. cherrypy_foundation/components/Typeahead.jinja +106 -0
  19. cherrypy_foundation/components/Typeahead.js +8 -0
  20. cherrypy_foundation/components/__init__.py +51 -0
  21. cherrypy_foundation/components/tests/__init__.py +0 -0
  22. cherrypy_foundation/components/tests/test_static.py +90 -0
  23. cherrypy_foundation/components/vendor/bootstrap-icons/bootstrap-icons.css +2106 -0
  24. cherrypy_foundation/components/vendor/bootstrap-icons/bootstrap-icons.min.css +5 -0
  25. cherrypy_foundation/components/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
  26. cherrypy_foundation/components/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
  27. cherrypy_foundation/components/vendor/bootstrap5/css/bootstrap.css +9262 -0
  28. cherrypy_foundation/components/vendor/bootstrap5/css/bootstrap.css.map +95 -0
  29. cherrypy_foundation/components/vendor/bootstrap5/css/bootstrap.min.css +6 -0
  30. cherrypy_foundation/components/vendor/bootstrap5/css/bootstrap.min.css.map +7 -0
  31. cherrypy_foundation/components/vendor/bootstrap5/js/bootstrap.js +4846 -0
  32. cherrypy_foundation/components/vendor/bootstrap5/js/bootstrap.js.map +1 -0
  33. cherrypy_foundation/components/vendor/bootstrap5/js/bootstrap.min.js +7 -0
  34. cherrypy_foundation/components/vendor/bootstrap5/js/bootstrap.min.js.map +7 -0
  35. cherrypy_foundation/components/vendor/bootstrap5/js/color-modes.js +80 -0
  36. cherrypy_foundation/components/vendor/datatables/css/dataTables.dataTables.css +849 -0
  37. cherrypy_foundation/components/vendor/datatables/css/dataTables.dataTables.min.css +1 -0
  38. cherrypy_foundation/components/vendor/datatables/images/sort_asc.png +0 -0
  39. cherrypy_foundation/components/vendor/datatables/images/sort_asc_disabled.png +0 -0
  40. cherrypy_foundation/components/vendor/datatables/images/sort_both.png +0 -0
  41. cherrypy_foundation/components/vendor/datatables/images/sort_desc.png +0 -0
  42. cherrypy_foundation/components/vendor/datatables/images/sort_desc_disabled.png +0 -0
  43. cherrypy_foundation/components/vendor/datatables/js/dataTables.js +14073 -0
  44. cherrypy_foundation/components/vendor/datatables/js/dataTables.min.js +4 -0
  45. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/css/buttons.dataTables.css +556 -0
  46. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/css/buttons.dataTables.min.css +1 -0
  47. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/js/buttons.html5.js +1700 -0
  48. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/js/buttons.html5.min.js +8 -0
  49. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/js/dataTables.buttons.js +2944 -0
  50. cherrypy_foundation/components/vendor/datatables-extensions/Buttons/js/dataTables.buttons.min.js +4 -0
  51. cherrypy_foundation/components/vendor/datatables-extensions/FixedHeader/css/fixedHeader.dataTables.css +13 -0
  52. cherrypy_foundation/components/vendor/datatables-extensions/FixedHeader/css/fixedHeader.dataTables.min.css +1 -0
  53. cherrypy_foundation/components/vendor/datatables-extensions/FixedHeader/js/dataTables.fixedHeader.js +1202 -0
  54. cherrypy_foundation/components/vendor/datatables-extensions/FixedHeader/js/dataTables.fixedHeader.min.js +4 -0
  55. cherrypy_foundation/components/vendor/datatables-extensions/JSZip/jszip.js +11577 -0
  56. cherrypy_foundation/components/vendor/datatables-extensions/JSZip/jszip.min.js +13 -0
  57. cherrypy_foundation/components/vendor/datatables-extensions/Responsive/css/responsive.dataTables.css +194 -0
  58. cherrypy_foundation/components/vendor/datatables-extensions/Responsive/css/responsive.dataTables.min.css +1 -0
  59. cherrypy_foundation/components/vendor/datatables-extensions/Responsive/js/dataTables.responsive.js +1861 -0
  60. cherrypy_foundation/components/vendor/datatables-extensions/Responsive/js/dataTables.responsive.min.js +4 -0
  61. cherrypy_foundation/components/vendor/datatables-extensions/pdfmake/build/pdfmake.js +75023 -0
  62. cherrypy_foundation/components/vendor/datatables-extensions/pdfmake/build/pdfmake.min.js +3 -0
  63. cherrypy_foundation/components/vendor/datatables-extensions/pdfmake/build/vfs_fonts.js +6 -0
  64. cherrypy_foundation/components/vendor/datatables-extensions/rowgroup/css/rowGroup.dataTables.css +53 -0
  65. cherrypy_foundation/components/vendor/datatables-extensions/rowgroup/css/rowGroup.dataTables.min.css +1 -0
  66. cherrypy_foundation/components/vendor/datatables-extensions/rowgroup/js/dataTables.rowGroup.js +485 -0
  67. cherrypy_foundation/components/vendor/datatables-extensions/rowgroup/js/dataTables.rowGroup.min.js +4 -0
  68. cherrypy_foundation/components/vendor/jquery/jquery.min.js +2 -0
  69. cherrypy_foundation/components/vendor/multi/LICENSE +7 -0
  70. cherrypy_foundation/components/vendor/multi/README.md +109 -0
  71. cherrypy_foundation/components/vendor/multi/multi.css +95 -0
  72. cherrypy_foundation/components/vendor/multi/multi.js +328 -0
  73. cherrypy_foundation/components/vendor/popper/popper.js +1825 -0
  74. cherrypy_foundation/components/vendor/popper/popper.min.js +6 -0
  75. cherrypy_foundation/components/vendor/typeahead/jquery.typeahead.min.css +1 -0
  76. cherrypy_foundation/components/vendor/typeahead/jquery.typeahead.min.js +10 -0
  77. cherrypy_foundation/error_page.py +94 -0
  78. cherrypy_foundation/flash.py +50 -0
  79. cherrypy_foundation/form.py +119 -0
  80. cherrypy_foundation/logging.py +103 -0
  81. cherrypy_foundation/passwd.py +65 -0
  82. cherrypy_foundation/plugins/__init__.py +0 -0
  83. cherrypy_foundation/plugins/db.py +286 -0
  84. cherrypy_foundation/plugins/ldap.py +257 -0
  85. cherrypy_foundation/plugins/restapi.py +74 -0
  86. cherrypy_foundation/plugins/scheduler.py +287 -0
  87. cherrypy_foundation/plugins/smtp.py +223 -0
  88. cherrypy_foundation/plugins/tests/__init__.py +0 -0
  89. cherrypy_foundation/plugins/tests/test_db.py +118 -0
  90. cherrypy_foundation/plugins/tests/test_ldap.py +451 -0
  91. cherrypy_foundation/plugins/tests/test_scheduler.py +100 -0
  92. cherrypy_foundation/plugins/tests/test_scheduler_db.py +107 -0
  93. cherrypy_foundation/plugins/tests/test_smtp.py +140 -0
  94. cherrypy_foundation/sessions.py +93 -0
  95. cherrypy_foundation/tests/__init__.py +72 -0
  96. cherrypy_foundation/tests/templates/test_flash.html +9 -0
  97. cherrypy_foundation/tests/templates/test_form.html +16 -0
  98. cherrypy_foundation/tests/templates/test_url.html +15 -0
  99. cherrypy_foundation/tests/test_error_page.py +78 -0
  100. cherrypy_foundation/tests/test_flash.py +61 -0
  101. cherrypy_foundation/tests/test_form.py +148 -0
  102. cherrypy_foundation/tests/test_logging.py +78 -0
  103. cherrypy_foundation/tests/test_passwd.py +51 -0
  104. cherrypy_foundation/tests/test_sessions.py +89 -0
  105. cherrypy_foundation/tests/test_url.py +161 -0
  106. cherrypy_foundation/tools/__init__.py +0 -0
  107. cherrypy_foundation/tools/auth.py +263 -0
  108. cherrypy_foundation/tools/auth_mfa.py +249 -0
  109. cherrypy_foundation/tools/i18n.py +529 -0
  110. cherrypy_foundation/tools/jinja2.py +158 -0
  111. cherrypy_foundation/tools/ratelimit.py +265 -0
  112. cherrypy_foundation/tools/secure_headers.py +119 -0
  113. cherrypy_foundation/tools/sessions_timeout.py +167 -0
  114. cherrypy_foundation/tools/tests/__init__.py +0 -0
  115. cherrypy_foundation/tools/tests/components/Button.jinja +2 -0
  116. cherrypy_foundation/tools/tests/locales/de/LC_MESSAGES/messages.mo +0 -0
  117. cherrypy_foundation/tools/tests/locales/de/LC_MESSAGES/messages.po +15 -0
  118. cherrypy_foundation/tools/tests/locales/fr/LC_MESSAGES/messages.mo +0 -0
  119. cherrypy_foundation/tools/tests/locales/fr/LC_MESSAGES/messages.po +15 -0
  120. cherrypy_foundation/tools/tests/locales/messages.pot +2 -0
  121. cherrypy_foundation/tools/tests/templates/test_jinja2.html +11 -0
  122. cherrypy_foundation/tools/tests/templates/test_jinjax.html +9 -0
  123. cherrypy_foundation/tools/tests/templates/test_jinjax_i18n.html +22 -0
  124. cherrypy_foundation/tools/tests/test_auth.py +110 -0
  125. cherrypy_foundation/tools/tests/test_auth_mfa.py +369 -0
  126. cherrypy_foundation/tools/tests/test_i18n.py +247 -0
  127. cherrypy_foundation/tools/tests/test_jinja2.py +153 -0
  128. cherrypy_foundation/tools/tests/test_ratelimit.py +109 -0
  129. cherrypy_foundation/tools/tests/test_secure_headers.py +200 -0
  130. cherrypy_foundation/url.py +66 -0
  131. cherrypy_foundation/widgets.py +48 -0
  132. cherrypy_foundation-1.0.0.dist-info/METADATA +71 -0
  133. cherrypy_foundation-1.0.0.dist-info/RECORD +136 -0
  134. cherrypy_foundation-1.0.0.dist-info/WHEEL +5 -0
  135. cherrypy_foundation-1.0.0.dist-info/licenses/LICENSE.md +674 -0
  136. cherrypy_foundation-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,53 @@
1
+ table.dataTable tr.dtrg-group th {
2
+ background-color: rgba(0, 0, 0, 0.1);
3
+ text-align: left;
4
+ }
5
+
6
+ table.dataTable tr.dtrg-group.dtrg-level-0 th {
7
+ font-weight: bold;
8
+ }
9
+
10
+ table.dataTable tr.dtrg-group.dtrg-level-1 th,
11
+ table.dataTable tr.dtrg-group.dtrg-level-2 th,
12
+ table.dataTable tr.dtrg-group.dtrg-level-3 th,
13
+ table.dataTable tr.dtrg-group.dtrg-level-4 th,
14
+ table.dataTable tr.dtrg-group.dtrg-level-5 th {
15
+ background-color: rgba(0, 0, 0, 0.05);
16
+ padding-top: 0.25em;
17
+ padding-bottom: 0.25em;
18
+ padding-left: 2em;
19
+ font-size: 0.9em;
20
+ }
21
+
22
+ table.dataTable tr.dtrg-group.dtrg-level-2 th {
23
+ background-color: rgba(0, 0, 0, 0.01);
24
+ padding-left: 2.5em;
25
+ }
26
+
27
+ table.dataTable tr.dtrg-group.dtrg-level-3 th {
28
+ background-color: rgba(0, 0, 0, 0.01);
29
+ padding-left: 3em;
30
+ }
31
+
32
+ table.dataTable tr.dtrg-group.dtrg-level-4 th {
33
+ background-color: rgba(0, 0, 0, 0.01);
34
+ padding-left: 3.5em;
35
+ }
36
+
37
+ table.dataTable tr.dtrg-group.dtrg-level-5 th {
38
+ background-color: rgba(0, 0, 0, 0.01);
39
+ padding-left: 4em;
40
+ }
41
+
42
+ html.dark table.dataTable tr.dtrg-group th {
43
+ background-color: rgba(255, 255, 255, 0.1);
44
+ }
45
+ html.dark table.dataTable tr.dtrg-group.dtrg-level-1 th {
46
+ background-color: rgba(255, 255, 255, 0.05);
47
+ }
48
+ html.dark table.dataTable tr.dtrg-group.dtrg-level-2 th,
49
+ html.dark table.dataTable tr.dtrg-group.dtrg-level-3 th,
50
+ html.dark table.dataTable tr.dtrg-group.dtrg-level-4 th,
51
+ html.dark table.dataTable tr.dtrg-group.dtrg-level-5 th {
52
+ background-color: rgba(255, 255, 255, 0.01);
53
+ }
@@ -0,0 +1 @@
1
+ table.dataTable tr.dtrg-group th{background-color:rgba(0, 0, 0, 0.1);text-align:left}table.dataTable tr.dtrg-group.dtrg-level-0 th{font-weight:bold}table.dataTable tr.dtrg-group.dtrg-level-1 th,table.dataTable tr.dtrg-group.dtrg-level-2 th,table.dataTable tr.dtrg-group.dtrg-level-3 th,table.dataTable tr.dtrg-group.dtrg-level-4 th,table.dataTable tr.dtrg-group.dtrg-level-5 th{background-color:rgba(0, 0, 0, 0.05);padding-top:.25em;padding-bottom:.25em;padding-left:2em;font-size:.9em}table.dataTable tr.dtrg-group.dtrg-level-2 th{background-color:rgba(0, 0, 0, 0.01);padding-left:2.5em}table.dataTable tr.dtrg-group.dtrg-level-3 th{background-color:rgba(0, 0, 0, 0.01);padding-left:3em}table.dataTable tr.dtrg-group.dtrg-level-4 th{background-color:rgba(0, 0, 0, 0.01);padding-left:3.5em}table.dataTable tr.dtrg-group.dtrg-level-5 th{background-color:rgba(0, 0, 0, 0.01);padding-left:4em}html.dark table.dataTable tr.dtrg-group th{background-color:rgba(255, 255, 255, 0.1)}html.dark table.dataTable tr.dtrg-group.dtrg-level-1 th{background-color:rgba(255, 255, 255, 0.05)}html.dark table.dataTable tr.dtrg-group.dtrg-level-2 th,html.dark table.dataTable tr.dtrg-group.dtrg-level-3 th,html.dark table.dataTable tr.dtrg-group.dtrg-level-4 th,html.dark table.dataTable tr.dtrg-group.dtrg-level-5 th{background-color:rgba(255, 255, 255, 0.01)}
@@ -0,0 +1,485 @@
1
+ /*! RowGroup 1.5.1
2
+ * © SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ var jq = require('jquery');
15
+ var cjsRequires = function (root, $) {
16
+ if ( ! $.fn.dataTable ) {
17
+ require('datatables.net')(root, $);
18
+ }
19
+ };
20
+
21
+ if (typeof window === 'undefined') {
22
+ module.exports = function (root, $) {
23
+ if ( ! root ) {
24
+ // CommonJS environments without a window global must pass a
25
+ // root. This will give an error otherwise
26
+ root = window;
27
+ }
28
+
29
+ if ( ! $ ) {
30
+ $ = jq( root );
31
+ }
32
+
33
+ cjsRequires( root, $ );
34
+ return factory( $, root, root.document );
35
+ };
36
+ }
37
+ else {
38
+ cjsRequires( window, jq );
39
+ module.exports = factory( jq, window, window.document );
40
+ }
41
+ }
42
+ else {
43
+ // Browser
44
+ factory( jQuery, window, document );
45
+ }
46
+ }(function( $, window, document ) {
47
+ 'use strict';
48
+ var DataTable = $.fn.dataTable;
49
+
50
+
51
+
52
+ /**
53
+ * @summary RowGroup
54
+ * @description RowGrouping for DataTables
55
+ * @version 1.5.1
56
+ * @author SpryMedia Ltd (www.sprymedia.co.uk)
57
+ * @contact datatables.net
58
+ * @copyright SpryMedia Ltd.
59
+ *
60
+ * This source file is free software, available under the following license:
61
+ * MIT license - http://datatables.net/license/mit
62
+ *
63
+ * This source file is distributed in the hope that it will be useful, but
64
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
65
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
66
+ *
67
+ * For details please refer to: http://www.datatables.net
68
+ */
69
+
70
+ var RowGroup = function (dt, opts) {
71
+ // Sanity check that we are using DataTables 1.10 or newer
72
+ if (!DataTable.versionCheck || !DataTable.versionCheck('1.11')) {
73
+ throw 'RowGroup requires DataTables 1.11 or newer';
74
+ }
75
+
76
+ // User and defaults configuration object
77
+ this.c = $.extend(true, {}, DataTable.defaults.rowGroup, RowGroup.defaults, opts);
78
+
79
+ // Internal settings
80
+ this.s = {
81
+ dt: new DataTable.Api(dt)
82
+ };
83
+
84
+ // DOM items
85
+ this.dom = {};
86
+
87
+ // Check if row grouping has already been initialised on this table
88
+ var settings = this.s.dt.settings()[0];
89
+ var existing = settings.rowGroup;
90
+ if (existing) {
91
+ return existing;
92
+ }
93
+
94
+ settings.rowGroup = this;
95
+ this._constructor();
96
+ };
97
+
98
+ $.extend(RowGroup.prototype, {
99
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
100
+ * API methods for DataTables API interface
101
+ */
102
+
103
+ /**
104
+ * Get/set the grouping data source - need to call draw after this is
105
+ * executed as a setter
106
+ * @returns string~RowGroup
107
+ */
108
+ dataSrc: function (val) {
109
+ if (val === undefined) {
110
+ return this.c.dataSrc;
111
+ }
112
+
113
+ var dt = this.s.dt;
114
+
115
+ this.c.dataSrc = val;
116
+
117
+ $(dt.table().node()).triggerHandler('rowgroup-datasrc.dt', [dt, val]);
118
+
119
+ return this;
120
+ },
121
+
122
+ /**
123
+ * Disable - need to call draw after this is executed
124
+ * @returns RowGroup
125
+ */
126
+ disable: function () {
127
+ this.c.enable = false;
128
+ return this;
129
+ },
130
+
131
+ /**
132
+ * Enable - need to call draw after this is executed
133
+ * @returns RowGroup
134
+ */
135
+ enable: function (flag) {
136
+ if (flag === false) {
137
+ return this.disable();
138
+ }
139
+
140
+ this.c.enable = true;
141
+ return this;
142
+ },
143
+
144
+ /**
145
+ * Get enabled flag
146
+ * @returns boolean
147
+ */
148
+ enabled: function () {
149
+ return this.c.enable;
150
+ },
151
+
152
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
153
+ * Constructor
154
+ */
155
+ _constructor: function () {
156
+ var that = this;
157
+ var dt = this.s.dt;
158
+ var hostSettings = dt.settings()[0];
159
+
160
+ dt.on('draw.dtrg', function (e, s) {
161
+ if (that.c.enable && hostSettings === s) {
162
+ that._draw();
163
+ }
164
+ });
165
+
166
+ dt.on('column-visibility.dt.dtrg responsive-resize.dt.dtrg', function () {
167
+ that._adjustColspan();
168
+ });
169
+
170
+ dt.on('destroy', function () {
171
+ dt.off('.dtrg');
172
+ });
173
+ },
174
+
175
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
176
+ * Private methods
177
+ */
178
+
179
+ /**
180
+ * Adjust column span when column visibility changes
181
+ * @private
182
+ */
183
+ _adjustColspan: function () {
184
+ $('tr.' + this.c.className, this.s.dt.table().body())
185
+ .find('th:visible, td:visible')
186
+ .attr('colspan', this._colspan());
187
+ },
188
+
189
+ /**
190
+ * Get the number of columns that a grouping row should span
191
+ * @private
192
+ */
193
+ _colspan: function () {
194
+ return this.s.dt
195
+ .columns()
196
+ .visible()
197
+ .reduce(function (a, b) {
198
+ return a + b;
199
+ }, 0);
200
+ },
201
+
202
+ /**
203
+ * Update function that is called whenever we need to draw the grouping rows.
204
+ * This is basically a bootstrap for the self iterative _group and _groupDisplay
205
+ * methods
206
+ * @private
207
+ */
208
+ _draw: function () {
209
+ var dt = this.s.dt;
210
+ var groupedRows = this._group(0, dt.rows({ page: 'current' }).indexes());
211
+
212
+ this._groupDisplay(0, groupedRows);
213
+ },
214
+
215
+ /**
216
+ * Get the grouping information from a data set (index) of rows
217
+ * @param {number} level Nesting level
218
+ * @param {DataTables.Api} rows API of the rows to consider for this group
219
+ * @returns {object[]} Nested grouping information - it is structured like this:
220
+ * {
221
+ * dataPoint: 'Edinburgh',
222
+ * rows: [ 1,2,3,4,5,6,7 ],
223
+ * children: [ {
224
+ * dataPoint: 'developer'
225
+ * rows: [ 1, 2, 3 ]
226
+ * },
227
+ * {
228
+ * dataPoint: 'support',
229
+ * rows: [ 4, 5, 6, 7 ]
230
+ * } ]
231
+ * }
232
+ * @private
233
+ */
234
+ _group: function (level, rows) {
235
+ var fns = Array.isArray(this.c.dataSrc) ? this.c.dataSrc : [this.c.dataSrc];
236
+ var fn = DataTable.util.get(fns[level]);
237
+ var dt = this.s.dt;
238
+ var group, last;
239
+ var i, ien;
240
+ var data = [];
241
+ var that = this;
242
+
243
+ for (i = 0, ien = rows.length; i < ien; i++) {
244
+ var rowIndex = rows[i];
245
+ var rowData = dt.row(rowIndex).data();
246
+
247
+ group = fn(rowData, level);
248
+
249
+ if (group === null || group === undefined) {
250
+ group = that.c.emptyDataGroup;
251
+ }
252
+
253
+ if (last === undefined || group !== last) {
254
+ data.push({
255
+ dataPoint: group,
256
+ rows: []
257
+ });
258
+
259
+ last = group;
260
+ }
261
+
262
+ data[data.length - 1].rows.push(rowIndex);
263
+ }
264
+
265
+ if (fns[level + 1] !== undefined) {
266
+ for (i = 0, ien = data.length; i < ien; i++) {
267
+ data[i].children = this._group(level + 1, data[i].rows);
268
+ }
269
+ }
270
+
271
+ return data;
272
+ },
273
+
274
+ /**
275
+ * Row group display - insert the rows into the document
276
+ * @param {number} level Nesting level
277
+ * @param {object[]} groups Takes the nested array from `_group`
278
+ * @private
279
+ */
280
+ _groupDisplay: function (level, groups) {
281
+ var dt = this.s.dt;
282
+ var display;
283
+
284
+ for (var i = 0, ien = groups.length; i < ien; i++) {
285
+ var group = groups[i];
286
+ var groupName = group.dataPoint;
287
+ var row;
288
+ var rows = group.rows;
289
+
290
+ if (this.c.startRender) {
291
+ display = this.c.startRender.call(this, dt.rows(rows), groupName, level);
292
+ row = this._rowWrap(display, this.c.startClassName, level);
293
+
294
+ if (row) {
295
+ row.insertBefore(dt.row(rows[0]).node());
296
+ }
297
+ }
298
+
299
+ if (this.c.endRender) {
300
+ display = this.c.endRender.call(this, dt.rows(rows), groupName, level);
301
+ row = this._rowWrap(display, this.c.endClassName, level);
302
+
303
+ if (row) {
304
+ row.insertAfter(dt.row(rows[rows.length - 1]).node());
305
+ }
306
+ }
307
+
308
+ if (group.children) {
309
+ this._groupDisplay(level + 1, group.children);
310
+ }
311
+ }
312
+ },
313
+
314
+ /**
315
+ * Take a rendered value from an end user and make it suitable for display
316
+ * as a row, by wrapping it in a row, or detecting that it is a row.
317
+ * @param {node|jQuery|string} display Display value
318
+ * @param {string} className Class to add to the row
319
+ * @param {array} group
320
+ * @param {number} group level
321
+ * @private
322
+ */
323
+ _rowWrap: function (display, className, level) {
324
+ var row;
325
+
326
+ if (display === null || display === '') {
327
+ display = this.c.emptyDataGroup;
328
+ }
329
+
330
+ if (display === undefined || display === null) {
331
+ return null;
332
+ }
333
+
334
+ if (
335
+ typeof display === 'object' &&
336
+ display.nodeName &&
337
+ display.nodeName.toLowerCase() === 'tr'
338
+ ) {
339
+ row = $(display);
340
+ }
341
+ else if (
342
+ display instanceof $ &&
343
+ display.length &&
344
+ display[0].nodeName.toLowerCase() === 'tr'
345
+ ) {
346
+ row = display;
347
+ }
348
+ else {
349
+ row = $('<tr/>').append(
350
+ $('<th/>').attr('colspan', this._colspan()).attr('scope', 'row').append(display)
351
+ );
352
+ }
353
+
354
+ return row
355
+ .addClass(this.c.className)
356
+ .addClass(className)
357
+ .addClass('dtrg-level-' + level);
358
+ }
359
+ });
360
+
361
+ /**
362
+ * RowGroup default settings for initialisation
363
+ *
364
+ * @namespace
365
+ * @name RowGroup.defaults
366
+ * @static
367
+ */
368
+ RowGroup.defaults = {
369
+ /**
370
+ * Class to apply to grouping rows - applied to both the start and
371
+ * end grouping rows.
372
+ * @type string
373
+ */
374
+ className: 'dtrg-group',
375
+
376
+ /**
377
+ * Data property from which to read the grouping information
378
+ * @type string|integer|array
379
+ */
380
+ dataSrc: 0,
381
+
382
+ /**
383
+ * Text to show if no data is found for a group
384
+ * @type string
385
+ */
386
+ emptyDataGroup: 'No group',
387
+
388
+ /**
389
+ * Initial enablement state
390
+ * @boolean
391
+ */
392
+ enable: true,
393
+
394
+ /**
395
+ * Class name to give to the end grouping row
396
+ * @type string
397
+ */
398
+ endClassName: 'dtrg-end',
399
+
400
+ /**
401
+ * End grouping label function
402
+ * @function
403
+ */
404
+ endRender: null,
405
+
406
+ /**
407
+ * Class name to give to the start grouping row
408
+ * @type string
409
+ */
410
+ startClassName: 'dtrg-start',
411
+
412
+ /**
413
+ * Start grouping label function
414
+ * @function
415
+ */
416
+ startRender: function (rows, group) {
417
+ return group;
418
+ }
419
+ };
420
+
421
+ RowGroup.version = '1.5.1';
422
+
423
+ $.fn.dataTable.RowGroup = RowGroup;
424
+ $.fn.DataTable.RowGroup = RowGroup;
425
+
426
+ DataTable.Api.register('rowGroup()', function () {
427
+ return this;
428
+ });
429
+
430
+ DataTable.Api.register('rowGroup().disable()', function () {
431
+ return this.iterator('table', function (ctx) {
432
+ if (ctx.rowGroup) {
433
+ ctx.rowGroup.enable(false);
434
+ }
435
+ });
436
+ });
437
+
438
+ DataTable.Api.register('rowGroup().enable()', function (opts) {
439
+ return this.iterator('table', function (ctx) {
440
+ if (ctx.rowGroup) {
441
+ ctx.rowGroup.enable(opts === undefined ? true : opts);
442
+ }
443
+ });
444
+ });
445
+
446
+ DataTable.Api.register('rowGroup().enabled()', function () {
447
+ var ctx = this.context;
448
+
449
+ return ctx.length && ctx[0].rowGroup ? ctx[0].rowGroup.enabled() : false;
450
+ });
451
+
452
+ DataTable.Api.register('rowGroup().dataSrc()', function (val) {
453
+ if (val === undefined) {
454
+ return this.context[0].rowGroup.dataSrc();
455
+ }
456
+
457
+ return this.iterator('table', function (ctx) {
458
+ if (ctx.rowGroup) {
459
+ ctx.rowGroup.dataSrc(val);
460
+ }
461
+ });
462
+ });
463
+
464
+ // Attach a listener to the document which listens for DataTables initialisation
465
+ // events so we can automatically initialise
466
+ $(document).on('preInit.dt.dtrg', function (e, settings, json) {
467
+ if (e.namespace !== 'dt') {
468
+ return;
469
+ }
470
+
471
+ var init = settings.oInit.rowGroup;
472
+ var defaults = DataTable.defaults.rowGroup;
473
+
474
+ if (init || defaults) {
475
+ var opts = $.extend({}, defaults, init);
476
+
477
+ if (init !== false) {
478
+ new RowGroup(settings, opts);
479
+ }
480
+ }
481
+ });
482
+
483
+
484
+ return DataTable;
485
+ }));
@@ -0,0 +1,4 @@
1
+ /*! RowGroup 1.5.1
2
+ * © SpryMedia Ltd - datatables.net/license
3
+ */
4
+ !function(e){var n,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?(n=require("jquery"),o=function(t,r){r.fn.dataTable||require("datatables.net")(t,r)},"undefined"==typeof window?module.exports=function(t,r){return t=t||window,r=r||n(t),o(t,r),e(r,0,t.document)}:(o(window,n),module.exports=e(n,window,window.document))):e(jQuery,window,document)}(function(i,t,r){"use strict";function a(t,r){if(!l.versionCheck||!l.versionCheck("1.11"))throw"RowGroup requires DataTables 1.11 or newer";if(this.c=i.extend(!0,{},l.defaults.rowGroup,a.defaults,r),this.s={dt:new l.Api(t)},this.dom={},r=this.s.dt.settings()[0],t=r.rowGroup)return t;(r.rowGroup=this)._constructor()}var l=i.fn.dataTable;return i.extend(a.prototype,{dataSrc:function(t){var r;return void 0===t?this.c.dataSrc:(r=this.s.dt,this.c.dataSrc=t,i(r.table().node()).triggerHandler("rowgroup-datasrc.dt",[r,t]),this)},disable:function(){return this.c.enable=!1,this},enable:function(t){return!1===t?this.disable():(this.c.enable=!0,this)},enabled:function(){return this.c.enable},_constructor:function(){var e=this,t=this.s.dt,n=t.settings()[0];t.on("draw.dtrg",function(t,r){e.c.enable&&n===r&&e._draw()}),t.on("column-visibility.dt.dtrg responsive-resize.dt.dtrg",function(){e._adjustColspan()}),t.on("destroy",function(){t.off(".dtrg")})},_adjustColspan:function(){i("tr."+this.c.className,this.s.dt.table().body()).find("th:visible, td:visible").attr("colspan",this._colspan())},_colspan:function(){return this.s.dt.columns().visible().reduce(function(t,r){return t+r},0)},_draw:function(){var t=this.s.dt,t=this._group(0,t.rows({page:"current"}).indexes());this._groupDisplay(0,t)},_group:function(t,r){for(var e,n=Array.isArray(this.c.dataSrc)?this.c.dataSrc:[this.c.dataSrc],o=l.util.get(n[t]),i=this.s.dt,a=[],s=0,d=r.length;s<d;s++){var u,c=r[s];null==(u=o(i.row(c).data(),t))&&(u=this.c.emptyDataGroup),void 0!==e&&u===e||(a.push({dataPoint:u,rows:[]}),e=u),a[a.length-1].rows.push(c)}if(void 0!==n[t+1])for(s=0,d=a.length;s<d;s++)a[s].children=this._group(t+1,a[s].rows);return a},_groupDisplay:function(t,r){for(var e,n=this.s.dt,o=0,i=r.length;o<i;o++){var a,s=r[o],d=s.dataPoint,u=s.rows;this.c.startRender&&(e=this.c.startRender.call(this,n.rows(u),d,t),a=this._rowWrap(e,this.c.startClassName,t))&&a.insertBefore(n.row(u[0]).node()),this.c.endRender&&(e=this.c.endRender.call(this,n.rows(u),d,t),a=this._rowWrap(e,this.c.endClassName,t))&&a.insertAfter(n.row(u[u.length-1]).node()),s.children&&this._groupDisplay(t+1,s.children)}},_rowWrap:function(t,r,e){return null==(t=null!==t&&""!==t?t:this.c.emptyDataGroup)?null:("object"==typeof t&&t.nodeName&&"tr"===t.nodeName.toLowerCase()?i(t):t instanceof i&&t.length&&"tr"===t[0].nodeName.toLowerCase()?t:i("<tr/>").append(i("<th/>").attr("colspan",this._colspan()).attr("scope","row").append(t))).addClass(this.c.className).addClass(r).addClass("dtrg-level-"+e)}}),a.defaults={className:"dtrg-group",dataSrc:0,emptyDataGroup:"No group",enable:!0,endClassName:"dtrg-end",endRender:null,startClassName:"dtrg-start",startRender:function(t,r){return r}},a.version="1.5.1",i.fn.dataTable.RowGroup=a,i.fn.DataTable.RowGroup=a,l.Api.register("rowGroup()",function(){return this}),l.Api.register("rowGroup().disable()",function(){return this.iterator("table",function(t){t.rowGroup&&t.rowGroup.enable(!1)})}),l.Api.register("rowGroup().enable()",function(r){return this.iterator("table",function(t){t.rowGroup&&t.rowGroup.enable(void 0===r||r)})}),l.Api.register("rowGroup().enabled()",function(){var t=this.context;return!(!t.length||!t[0].rowGroup)&&t[0].rowGroup.enabled()}),l.Api.register("rowGroup().dataSrc()",function(r){return void 0===r?this.context[0].rowGroup.dataSrc():this.iterator("table",function(t){t.rowGroup&&t.rowGroup.dataSrc(r)})}),i(r).on("preInit.dt.dtrg",function(t,r,e){var n,o;"dt"===t.namespace&&(t=r.oInit.rowGroup,n=l.defaults.rowGroup,t||n)&&(o=i.extend({},n,t),!1!==t)&&new a(r,o)}),l});