@bennerinformatics/ember-fw-table 2.1.4 → 2.1.6

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 (166) hide show
  1. package/addon/components/fw-table-resort.js +18 -4
  2. package/addon/components/fw-table-sortable.js +23 -0
  3. package/addon/templates/components/fw-table-resort.hbs +3 -0
  4. package/addon/templates/components/fw-table-sortable.hbs +10 -1
  5. package/docs/api.js +61 -0
  6. package/docs/assets/css/custom.css +82 -0
  7. package/docs/assets/css/external-small.png +0 -0
  8. package/docs/assets/css/logo.png +0 -0
  9. package/docs/assets/css/main.css +793 -0
  10. package/docs/assets/css/theme.css +547 -0
  11. package/docs/assets/favicon.ico +0 -0
  12. package/docs/assets/icons/android-icon-144x144.png +0 -0
  13. package/docs/assets/icons/android-icon-192x192.png +0 -0
  14. package/docs/assets/icons/android-icon-36x36.png +0 -0
  15. package/docs/assets/icons/android-icon-48x48.png +0 -0
  16. package/docs/assets/icons/android-icon-72x72.png +0 -0
  17. package/docs/assets/icons/android-icon-96x96.png +0 -0
  18. package/docs/assets/icons/apple-icon-114x114.png +0 -0
  19. package/docs/assets/icons/apple-icon-120x120.png +0 -0
  20. package/docs/assets/icons/apple-icon-144x144.png +0 -0
  21. package/docs/assets/icons/apple-icon-152x152.png +0 -0
  22. package/docs/assets/icons/apple-icon-180x180.png +0 -0
  23. package/docs/assets/icons/apple-icon-57x57.png +0 -0
  24. package/docs/assets/icons/apple-icon-60x60.png +0 -0
  25. package/docs/assets/icons/apple-icon-72x72.png +0 -0
  26. package/docs/assets/icons/apple-icon-76x76.png +0 -0
  27. package/docs/assets/icons/apple-icon-precomposed.png +0 -0
  28. package/docs/assets/icons/apple-icon.png +0 -0
  29. package/docs/assets/icons/browserconfig.xml +2 -0
  30. package/docs/assets/icons/favicon-16x16.png +0 -0
  31. package/docs/assets/icons/favicon-32x32.png +0 -0
  32. package/docs/assets/icons/favicon-96x96.png +0 -0
  33. package/docs/assets/icons/favicon.ico +0 -0
  34. package/docs/assets/icons/manifest.json +41 -0
  35. package/docs/assets/icons/ms-icon-144x144.png +0 -0
  36. package/docs/assets/icons/ms-icon-150x150.png +0 -0
  37. package/docs/assets/icons/ms-icon-310x310.png +0 -0
  38. package/docs/assets/icons/ms-icon-70x70.png +0 -0
  39. package/docs/assets/img/ember-logo.png +0 -0
  40. package/docs/assets/img/fw-logo.png +0 -0
  41. package/docs/assets/img/spinner.gif +0 -0
  42. package/docs/assets/index.html +10 -0
  43. package/docs/assets/js/api-filter.js +56 -0
  44. package/docs/assets/js/api-list.js +255 -0
  45. package/docs/assets/js/api-search.js +98 -0
  46. package/docs/assets/js/apidocs.js +376 -0
  47. package/docs/assets/js/yui-prettify.js +17 -0
  48. package/docs/assets/js/yuidoc-bootstrap.js +274 -0
  49. package/docs/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
  50. package/docs/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
  51. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  52. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  53. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  54. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  55. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  56. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  57. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  58. package/docs/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
  59. package/docs/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
  60. package/docs/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
  61. package/docs/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
  62. package/docs/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  63. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  64. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
  65. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  66. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  67. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  68. package/docs/assets/vendor/github-slugger/slugger.js +59 -0
  69. package/docs/assets/vendor/jquery/jquery.min.js +6 -0
  70. package/docs/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
  71. package/docs/assets/vendor/prettify/CHANGES.html +130 -0
  72. package/docs/assets/vendor/prettify/COPYING +202 -0
  73. package/docs/assets/vendor/prettify/README.html +203 -0
  74. package/docs/assets/vendor/prettify/prettify-min.css +1 -0
  75. package/docs/assets/vendor/prettify/prettify-min.js +1 -0
  76. package/docs/classes/BaseCells.html +484 -0
  77. package/docs/classes/Export.html +457 -0
  78. package/docs/classes/Format.html +577 -0
  79. package/docs/classes/FwCellAction.html +312 -0
  80. package/docs/classes/FwCellBoolean.html +311 -0
  81. package/docs/classes/FwCellNullable.html +312 -0
  82. package/docs/classes/FwCellPermissionIcon.html +321 -0
  83. package/docs/classes/FwColumnSortable.html +358 -0
  84. package/docs/classes/FwColumnTitle.html +314 -0
  85. package/docs/classes/FwDeleteModal.html +485 -0
  86. package/docs/classes/FwExpandableRow.html +307 -0
  87. package/docs/classes/FwPaginationWrapper.html +2129 -0
  88. package/docs/classes/FwRowToggle.html +355 -0
  89. package/docs/classes/FwRowToggleIndex.html +312 -0
  90. package/docs/classes/FwTableExpandedRow.html +307 -0
  91. package/docs/classes/FwTableResort.html +827 -0
  92. package/docs/classes/FwTableSortable.html +1293 -0
  93. package/docs/classes/Row.html +352 -0
  94. package/docs/classes/Table.html +672 -0
  95. package/docs/classes/TableUtil.html +410 -0
  96. package/docs/classes/index.html +10 -0
  97. package/docs/data.json +2324 -0
  98. package/docs/elements/index.html +10 -0
  99. package/docs/files/addon_classes_Row.js.html +318 -0
  100. package/docs/files/addon_classes_Table.js.html +390 -0
  101. package/docs/files/addon_components_fw-cell-action.js.html +257 -0
  102. package/docs/files/addon_components_fw-cell-boolean.js.html +251 -0
  103. package/docs/files/addon_components_fw-cell-nullable.js.html +253 -0
  104. package/docs/files/addon_components_fw-cell-permission-icon.js.html +266 -0
  105. package/docs/files/addon_components_fw-column-sortable.js.html +281 -0
  106. package/docs/files/addon_components_fw-column-title.js.html +259 -0
  107. package/docs/files/addon_components_fw-delete-modal.js.html +318 -0
  108. package/docs/files/addon_components_fw-expandable-row.js.html +248 -0
  109. package/docs/files/addon_components_fw-pagination-wrapper.js.html +838 -0
  110. package/docs/files/addon_components_fw-row-toggle-index.js.html +252 -0
  111. package/docs/files/addon_components_fw-row-toggle.js.html +270 -0
  112. package/docs/files/addon_components_fw-table-expanded-row.js.html +261 -0
  113. package/docs/files/addon_components_fw-table-expanded-rows.js.html +263 -0
  114. package/docs/files/addon_components_fw-table-resort.js.html +457 -0
  115. package/docs/files/addon_components_fw-table-sortable.js.html +663 -0
  116. package/docs/files/addon_documentation.js.html +301 -0
  117. package/docs/files/addon_initializers_responsive.js.html +253 -0
  118. package/docs/files/addon_utils_base-cells.js.html +313 -0
  119. package/docs/files/addon_utils_export.js.html +316 -0
  120. package/docs/files/addon_utils_formats.js.html +335 -0
  121. package/docs/files/addon_utils_table.js.html +274 -0
  122. package/docs/files/index.html +10 -0
  123. package/docs/index.html +252 -0
  124. package/docs/modules/CellComponents.html +313 -0
  125. package/docs/modules/ColumnComponents.html +284 -0
  126. package/docs/modules/Components.html +285 -0
  127. package/docs/modules/Introduction.html +261 -0
  128. package/docs/modules/Utils.html +285 -0
  129. package/docs/modules/index.html +10 -0
  130. package/package.json +64 -64
  131. package/.yalc/ember-sortable/.huskyrc +0 -5
  132. package/.yalc/ember-sortable/CHANGELOG.md +0 -755
  133. package/.yalc/ember-sortable/CODE_OF_CONDUCT.md +0 -6
  134. package/.yalc/ember-sortable/LICENSE.md +0 -9
  135. package/.yalc/ember-sortable/MIGRATION_GUIDE_MODIFIERS.md +0 -95
  136. package/.yalc/ember-sortable/MIGRATION_GUIDE_V2.md +0 -120
  137. package/.yalc/ember-sortable/Makefile +0 -24
  138. package/.yalc/ember-sortable/README.md +0 -423
  139. package/.yalc/ember-sortable/RELEASE.md +0 -60
  140. package/.yalc/ember-sortable/V2_MIGRATION_RFC.md +0 -1100
  141. package/.yalc/ember-sortable/addon/modifiers/sortable-group.js +0 -754
  142. package/.yalc/ember-sortable/addon/modifiers/sortable-handle.js +0 -29
  143. package/.yalc/ember-sortable/addon/modifiers/sortable-item.js +0 -869
  144. package/.yalc/ember-sortable/addon/services/ember-sortable.js +0 -92
  145. package/.yalc/ember-sortable/addon/system/scroll-container.js +0 -53
  146. package/.yalc/ember-sortable/addon/system/scroll-parent.js +0 -33
  147. package/.yalc/ember-sortable/addon/utils/constant.js +0 -9
  148. package/.yalc/ember-sortable/addon/utils/coordinate.js +0 -34
  149. package/.yalc/ember-sortable/addon/utils/css-calculation.js +0 -20
  150. package/.yalc/ember-sortable/addon/utils/defaults.js +0 -26
  151. package/.yalc/ember-sortable/addon/utils/keyboard.js +0 -32
  152. package/.yalc/ember-sortable/addon-test-support/helpers/drag.js +0 -111
  153. package/.yalc/ember-sortable/addon-test-support/helpers/index.js +0 -4
  154. package/.yalc/ember-sortable/addon-test-support/helpers/reorder.js +0 -41
  155. package/.yalc/ember-sortable/addon-test-support/utils/keyboard.js +0 -32
  156. package/.yalc/ember-sortable/addon-test-support/utils/offset.js +0 -14
  157. package/.yalc/ember-sortable/app/modifiers/sortable-group.js +0 -1
  158. package/.yalc/ember-sortable/app/modifiers/sortable-handle.js +0 -1
  159. package/.yalc/ember-sortable/app/modifiers/sortable-item.js +0 -1
  160. package/.yalc/ember-sortable/app/services/ember-sortable-internal-state.js +0 -1
  161. package/.yalc/ember-sortable/config/environment.js +0 -5
  162. package/.yalc/ember-sortable/demo.gif +0 -0
  163. package/.yalc/ember-sortable/index.js +0 -5
  164. package/.yalc/ember-sortable/package.json +0 -65
  165. package/.yalc/ember-sortable/yalc.sig +0 -1
  166. package/yalc.lock +0 -10
@@ -0,0 +1,663 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>addon\components\fw-table-sortable.js - Ember-FW-Table</title>
6
+ <meta name="description" content="A set of components surrounding the functionality of the fw-table-sortable, which is a simplified table, with ember-light-table as its internals.">
7
+ <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
8
+ <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
+ <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
10
+ <link rel="stylesheet" href="../assets/css/custom.css">
11
+ <link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap.css">
12
+ <link rel="stylesheet" href="../assets/vendor/font-awesome/css/font-awesome.min.css">
13
+ <link rel="stylesheet" href="../assets/css/theme.css">
14
+ <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,600,700' rel='stylesheet' type='text/css'>
15
+ <!-- favicon information -->
16
+ <link rel="apple-touch-icon" sizes="57x57" href="/assets/icons/apple-icon-57x57.png">
17
+ <link rel="apple-touch-icon" sizes="60x60" href="/assets/icons/apple-icon-60x60.png">
18
+ <link rel="apple-touch-icon" sizes="72x72" href="/assets/icons/apple-icon-72x72.png">
19
+ <link rel="apple-touch-icon" sizes="76x76" href="/assets/icons/apple-icon-76x76.png">
20
+ <link rel="apple-touch-icon" sizes="114x114" href="/assets/icons/apple-icon-114x114.png">
21
+ <link rel="apple-touch-icon" sizes="120x120" href="/assets/icons/apple-icon-120x120.png">
22
+ <link rel="apple-touch-icon" sizes="144x144" href="/assets/icons/apple-icon-144x144.png">
23
+ <link rel="apple-touch-icon" sizes="152x152" href="/assets/icons/apple-icon-152x152.png">
24
+ <link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-icon-180x180.png">
25
+ <link rel="icon" type="image/png" sizes="192x192" href="/assets/icons/android-icon-192x192.png">
26
+ <link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png">
27
+ <link rel="icon" type="image/png" sizes="96x96" href="/assets/icons/favicon-96x96.png">
28
+ <link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png">
29
+ <link rel="manifest" href="/assets/icons/manifest.json">
30
+ <meta name="msapplication-TileImage" content="/assets/icons/ms-icon-144x144.png">
31
+
32
+
33
+ <style>
34
+ body a {
35
+ color: #7E3DB7;
36
+ }
37
+ body a:hover {
38
+ color: #7E3DB7;
39
+ opacity: 0.5;
40
+ }
41
+ .navbar.navbar-default .navbar-nav> li> a:focus, .navbar.navbar-default .navbar-nav> li> a:hover {
42
+ color: #7E3DB7;
43
+ }
44
+ .navbar.navbar-default .navbar-nav> .active> a, .navbar.navbar-default .navbar-nav> .active> a:focus, .navbar.navbar-default .navbar-nav> .active> a:hover {
45
+ color: #7E3DB7;
46
+ }
47
+ #docs-main .page-header {
48
+ color: #7E3DB7;
49
+ }
50
+ #docs-main .page-section .nav-tabs {
51
+ border-bottom: 1px solid #7E3DB7;
52
+ }
53
+ #docs-main .page-section .nav-tabs> li.active a {
54
+ background: #7E3DB7;
55
+ border: 1px solid #7E3DB7;
56
+ }
57
+ #sidebar li.panel .panel-body ol> li.active, #sidebar li.panel .panel-body ol> li:hover {
58
+ background: #efefef;
59
+ }
60
+ </style>
61
+ </head>
62
+ <body>
63
+ <nav class="navbar navbar-default">
64
+ <div class="container-fluid">
65
+ <div class="navbar-header">
66
+ <a href="../" class="navbar-brand">
67
+ <img src="..\assets\img\fw-logo.png" alt="enterprise logo">
68
+ <span>Ember-FW-Table (API)</span>
69
+ </a>
70
+ </div>
71
+
72
+ <div class="collapse navbar-collapse" id="nav">
73
+ <ul class="nav navbar-nav navbar-right">
74
+ <li><a href="https://linformatics.bitbucket.io/docs/">Docs</a></li>
75
+ <li><a href="https://linformatics.bitbucket.io/downloads/">Downloads</a></li>
76
+ <li><a href="https://linformatics.bitbucket.io/api/">API</a></li>
77
+ <li><a href="https://bitbucket.org/linformatics/ember-fw-table" class="fa fa-github github"></a></li>
78
+ </ul>
79
+ </div>
80
+ </div>
81
+ </nav>
82
+ <div id="main-wrapper" class="row">
83
+ <div id="content-wrapper">
84
+ <ol class="panel-group" id="sidebar" role="tablist" aria-multiselectable="true">
85
+ <li class="panel panel-default">
86
+ <div class="panel-heading" role="tab" id="sidebar-search-heading">
87
+ <h4 class="panel-title">
88
+ <a role="button" data-toggle="collapse" href="#sidebar-search" aria-expanded="true" aria-controls="collapseOne">
89
+ Search
90
+ </a>
91
+ </h4>
92
+ </div>
93
+ <div id="sidebar-search" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-search-heading">
94
+ <div class="panel-body">
95
+ <div id="api-tabview-filter">
96
+ <input type="search" id="api-filter" placeholder="Search...">
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </li>
101
+ <li class="panel panel-default">
102
+ <div class="panel-heading" role="tab" id="sidebar-version-heading">
103
+ <h4 class="panel-title">
104
+ <a role="button" href="https://bitbucket.org/linformatics/ember-fw-table/commits/04d3b2ce" target="_blank">
105
+ Tag: 2.1.4.04d3b2ce
106
+ </a>
107
+ </h4>
108
+ </div>
109
+ </li>
110
+ <li class="panel panel-default">
111
+ <div class="panel-heading" role="tab" id="sidebar-modules-heading">
112
+ <h4 class="panel-title">
113
+ <a role="button" data-toggle="collapse" href="#sidebar-modules" aria-expanded="true" aria-controls="collapseOne">
114
+ Modules
115
+ </a>
116
+ </h4>
117
+ </div>
118
+ <div id="sidebar-modules" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-modules-heading">
119
+ <div class="panel-body">
120
+ <ol>
121
+ <li>
122
+ <a href="../modules/CellComponents.html">CellComponents</a>
123
+ </li>
124
+ <li>
125
+ <a href="../modules/ColumnComponents.html">ColumnComponents</a>
126
+ </li>
127
+ <li>
128
+ <a href="../modules/Components.html">Components</a>
129
+ </li>
130
+ <li>
131
+ <a href="../modules/Introduction.html">Introduction</a>
132
+ </li>
133
+ <li>
134
+ <a href="../modules/Utils.html">Utils</a>
135
+ </li>
136
+ </ol>
137
+ </div>
138
+ </div>
139
+ </li>
140
+
141
+ <li class="panel panel-default">
142
+ <div class="panel-heading" role="tab" id="sidebar-classes-heading">
143
+ <h4 class="panel-title">
144
+ <a role="button" data-toggle="collapse" href="#sidebar-classes" aria-expanded="true" aria-controls="collapseOne">
145
+ Classes
146
+ </a>
147
+ </h4>
148
+ </div>
149
+ <div id="sidebar-classes" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="sidebar-classes-heading">
150
+ <div class="panel-body">
151
+ <ol>
152
+ <li>
153
+ <a href="../classes/BaseCells.html">BaseCells</a>
154
+ </li>
155
+ <li>
156
+ <a href="../classes/Export.html">Export</a>
157
+ </li>
158
+ <li>
159
+ <a href="../classes/Format.html">Format</a>
160
+ </li>
161
+ <li>
162
+ <a href="../classes/FwCellAction.html">FwCellAction</a>
163
+ </li>
164
+ <li>
165
+ <a href="../classes/FwCellBoolean.html">FwCellBoolean</a>
166
+ </li>
167
+ <li>
168
+ <a href="../classes/FwCellNullable.html">FwCellNullable</a>
169
+ </li>
170
+ <li>
171
+ <a href="../classes/FwCellPermissionIcon.html">FwCellPermissionIcon</a>
172
+ </li>
173
+ <li>
174
+ <a href="../classes/FwColumnSortable.html">FwColumnSortable</a>
175
+ </li>
176
+ <li>
177
+ <a href="../classes/FwColumnTitle.html">FwColumnTitle</a>
178
+ </li>
179
+ <li>
180
+ <a href="../classes/FwDeleteModal.html">FwDeleteModal</a>
181
+ </li>
182
+ <li>
183
+ <a href="../classes/FwPaginationWrapper.html">FwPaginationWrapper</a>
184
+ </li>
185
+ <li>
186
+ <a href="../classes/FwRowToggle.html">FwRowToggle</a>
187
+ </li>
188
+ <li>
189
+ <a href="../classes/FwRowToggleIndex.html">FwRowToggleIndex</a>
190
+ </li>
191
+ <li>
192
+ <a href="../classes/FwTableResort.html">FwTableResort</a>
193
+ </li>
194
+ <li>
195
+ <a href="../classes/FwTableSortable.html">FwTableSortable</a>
196
+ </li>
197
+ <li>
198
+ <a href="../classes/Row.html">Row</a>
199
+ </li>
200
+ <li>
201
+ <a href="../classes/Table.html">Table</a>
202
+ </li>
203
+ <li>
204
+ <a href="../classes/TableUtil.html">TableUtil</a>
205
+ </li>
206
+ </ol>
207
+ </div>
208
+ </div>
209
+ </li>
210
+ </ol>
211
+ <div class="content-container">
212
+ <div class="apidocs">
213
+ <div id="docs-main">
214
+ <div class="content">
215
+ <div class="page-header">
216
+ <h1><i class="fa fa-file-code-o" aria-hidden="true"></i> File</h1>
217
+ </div>
218
+
219
+ <div class="file">
220
+ <pre class="prettyprint linenums">
221
+ import {isArray} from &#x27;@ember/array&#x27;;
222
+ import Component from &#x27;@ember/component&#x27;;
223
+ import {computed, observer} from &#x27;@ember/object&#x27;;
224
+ import {sort} from &#x27;@ember/object/computed&#x27;;
225
+ import {isEmpty, isNone} from &#x27;@ember/utils&#x27;;
226
+ import newTable from &#x27;../classes/Table&#x27;;
227
+ import exportTable from &#x27;../utils/export&#x27;;
228
+ import layout from &#x27;../templates/components/fw-table-sortable&#x27;;
229
+ import RSVP from &#x27;rsvp&#x27;;
230
+
231
+ /**
232
+ * This table contains logic to show a table as a panel in an app. This table features sorting rows can be expanded
233
+ * to show hidden data
234
+ * &#x60;&#x60;&#x60;handlebars
235
+ * &lt;FwTableSortable @data={{model}} @columns={{columns}} @title=&#x27;Table&#x27; /&gt;
236
+ * &#x60;&#x60;&#x60;
237
+ *
238
+ * If used in a block format instead, it is possible to fully define the title area, replacing the title parameter. The export action is passed as a yield parameter to redefine the export button
239
+ * &#x60;&#x60;&#x60;handlebars
240
+ * &lt;FwTableSortable @data={{model}} @columns={{columns}} as |export|&gt;
241
+ * &lt;strong class=&#x27;panel-title&#x27;&gt;Table&lt;/strong&gt;
242
+ * &lt;/FwTableSortable&gt;
243
+ * &#x60;&#x60;&#x60;
244
+ *
245
+ * In addition to the usual properties in columns, fw-table-sortable supports adding an additional &#x60;sortKey&#x60; property
246
+ * If defined, clicking that column will sort by that property instead of valuePath
247
+ *
248
+ * It also supports a showExpanded property, which is set to a value which will cause this row to show in the expanded view if hidden.
249
+ * Alternatively, setting this to &#x60;true&#x60; or &#x60;false&#x60; will force the state regardless of a property.
250
+ * By default will show if the property from &#x60;valuePath&#x60; is not null
251
+ *
252
+ * @class FwTableSortable
253
+ * @module Components
254
+ * @extends EmberLightTable
255
+ * @public
256
+ */
257
+ const TableSortable = Component.extend({
258
+ layout,
259
+ classNames: [&#x27;panel&#x27;, &#x27;panel-default&#x27;],
260
+
261
+ /**
262
+ * Table rows
263
+ *
264
+ * @public
265
+ * @property data
266
+ * @type {Array}
267
+ */
268
+
269
+ /**
270
+ * Table columns. See ember-light-table docs for more information
271
+ *
272
+ * @public
273
+ * @property columns
274
+ * @type {Array}
275
+ */
276
+ columns: null,
277
+
278
+ /**
279
+ * Additional class names for the table
280
+ *
281
+ * @public
282
+ * @property tableClassNames
283
+ * @type {Hash}
284
+ */
285
+ tableClassNames: &#x27;&#x27;,
286
+
287
+ /**
288
+ * Hash of maximum columns based on responsive size
289
+ *
290
+ * @public
291
+ * @property breakpoints
292
+ * @type {Hash}
293
+ */
294
+
295
+ /**
296
+ * Hash of actions to pass into the table for use in components
297
+ *
298
+ * @public
299
+ * @property tableActions
300
+ * @type {Hash}
301
+ */
302
+
303
+ /**
304
+ * Title to display in the panel above the table
305
+ *
306
+ * @public
307
+ * @property title
308
+ * @type {String}
309
+ */
310
+
311
+ /**
312
+ * Text to display when the table is empty
313
+ *
314
+ * @public
315
+ * @property empty
316
+ * @type {String}
317
+ */
318
+
319
+ /**
320
+ * Action called when sorting the table
321
+ *
322
+ * @public
323
+ * @property onSort
324
+ * @type {Action}
325
+ */
326
+ onSort: () =&gt; RSVP.resolve(),
327
+
328
+ /**
329
+ * Set to false to make the table not show the header if empty
330
+ *
331
+ * @public
332
+ * @property headerEmpty
333
+ * @type {Boolean}
334
+ * @default true
335
+ */
336
+ headerEmpty: true,
337
+ /**
338
+ * Sets the table to a fixed height, and adds a scroll bar to see the hidden rows
339
+ *
340
+ * @public
341
+ * @property fixedHeight
342
+ * @type {String}
343
+ */
344
+ fixedHeight: null,
345
+ /**
346
+ * Makes the table responsive to the screen width. The table is slightly more efficient if false when responsive is not used
347
+ *
348
+ * @public
349
+ * @property responsive
350
+ * @type {Boolean}
351
+ * @default false
352
+ */
353
+ responsive: false,
354
+
355
+ /**
356
+ * Makes the headers able to be dragged to resize. You will still need to put &#x60;resizable: true&#x60; in each column you want to be able to resize.
357
+ * @public
358
+ * @property resizeOnDrag
359
+ * @type {Boolean}
360
+ * @default false
361
+ */
362
+
363
+ resizeOnDrag: false,
364
+ /**
365
+ * Allows exporting the current contents of the table using an export button. Note that this sets a default title of &quot;Table&quot;, so setting a separate one is recommended
366
+ *
367
+ * When enabled, columns have some additional values defined:
368
+ * * &#x60;canExport&#x60;: if true (default), the column will be included in the export. Set to false to skip exporting the column.
369
+ * * &#x60;exportOnly&#x60;: if true, the column will not show in the table, but will still be exported.
370
+ *
371
+ * Additionally, the value &#x60;export&#x60; is set to true in &#x60;format&#x60;&#x27;s context.
372
+ *
373
+ * If this is set to a string, the string is used as the name of the export button.
374
+ * @public
375
+ * @property canExport
376
+ * @type {Boolean | String}
377
+ * @default false
378
+ */
379
+ canExport: false,
380
+
381
+ /**
382
+ * If true, uses the table block data for the header
383
+ *
384
+ * @public
385
+ * @property showHeader
386
+ * @type {Boolean}
387
+ * @default true
388
+ */
389
+ showHeader: true,
390
+
391
+ /**
392
+ * If true, uses the table block data for the footer
393
+ *
394
+ * @public
395
+ * @property showFooter
396
+ * @type {Boolean}
397
+ * @default true
398
+ */
399
+ showFooter: false,
400
+
401
+ /**
402
+ * Default sort order for the table. Can be a string for a single property, or an array to fallback
403
+ *
404
+ * @public
405
+ * @property defaultSort
406
+ * @type {String|Array}
407
+ */
408
+ defaultSort: null,
409
+
410
+ /**
411
+ * Private copy of defaultSort, made an array if its not
412
+ *
413
+ * @private
414
+ * @property _defaultSort
415
+ * @type {Array}
416
+ */
417
+ _defaultSort: computed(&#x27;defaultSort&#x27;, function() {
418
+ let defaultSort = this.defaultSort;
419
+ if (isNone(defaultSort)) {
420
+ return [];
421
+ }
422
+ if (!isArray(defaultSort)) {
423
+ return [defaultSort];
424
+ }
425
+ return defaultSort;
426
+ }),
427
+
428
+ /**
429
+ * Sort column set by clicking a column to sort
430
+ *
431
+ * @private
432
+ * @property sortColumn
433
+ * @type {String}
434
+ */
435
+ sortColumn: null,
436
+
437
+ /**
438
+ * Internal sort order. Calculated from sortColumn and _defaultSort
439
+ *
440
+ * @private
441
+ * @property sortOrder
442
+ * @type {Array}
443
+ */
444
+ sortOrder: computed(&#x27;_defaultSort.[]&#x27;, &#x27;sortColumn&#x27;, function() {
445
+ let sortColumn = this.sortColumn;
446
+ if (sortColumn) {
447
+ // this addresses a bug where sorting by the default sort column would break
448
+ // in that case just sort by the selected column and ignore the default sort
449
+ if (this._defaultSort.any((sort) =&gt; {
450
+ return sort === sortColumn || sort === &#x60;${sortColumn}:desc&#x60; || &#x60;${sort}:desc&#x60; === sortColumn;
451
+ })) {
452
+ return [sortColumn];
453
+ }
454
+ // otherwise add the sort column to the front of the default sort array so the default sort is done after
455
+ let sortOrder = this._defaultSort.slice();
456
+ sortOrder.unshift(sortColumn);
457
+
458
+ return sortOrder;
459
+ }
460
+ return this._defaultSort;
461
+ }),
462
+
463
+ /**
464
+ * Passed in table data after sorting.
465
+ *
466
+ * @private
467
+ * @property sortedData
468
+ * @type {Array}
469
+ */
470
+ sortedData: sort(&#x27;data&#x27;, &#x27;sortOrder&#x27;),
471
+
472
+ /**
473
+ * Internal table instance, in general changes to the table should be done to columns or data so they update properly
474
+ *
475
+ * @protected
476
+ * @property table
477
+ * @type {Table}
478
+ */
479
+ table: null,
480
+
481
+ /**
482
+ * Computed table title based on whether a boolean true is passed or a title
483
+ *
484
+ * @private
485
+ * @property exportTitle
486
+ * @type {String}
487
+ */
488
+ exportTitle: computed(&#x27;canExport&#x27;, function() {
489
+ let canExport = this.canExport;
490
+ if (canExport === true) {
491
+ return &#x27;Export&#x27;;
492
+ }
493
+ return canExport || &#x27;&#x27;;
494
+ }),
495
+
496
+ /**
497
+ * Called to delete the full page of entries. Pass in the action to be called by the button.
498
+ *
499
+ * @property deleteTable
500
+ * @type {Action}
501
+ * @default undefined
502
+ */
503
+ deleteTable: undefined,
504
+
505
+ /**
506
+ * Determines title for delete function. This will only be used if deleteTable action is passed in.
507
+ *
508
+ * @property deleteOverrideTitle
509
+ * @type {String}
510
+ */
511
+ deleteOverrideTitle: null,
512
+
513
+ deleteTitle: computed(&#x27;deleteTable&#x27;, &#x27;deleteOverrideTitle&#x27;, function() {
514
+ if (!this.deleteTable) {
515
+ return null;
516
+ } else {
517
+ return this.deleteOverrideTitle ? this.deleteOverrideTitle : &#x27;Delete All&#x27;;
518
+ }
519
+ }),
520
+
521
+ /**
522
+ * Determines if the current user has permission to delete the table (usually has-role helper will be used to determine this)
523
+ * example: &#x60;@deleteTablePermission={{has-role &#x27;admin&#x27;}}&#x60;. This will only be used if &#x60;deleteTable&#x60; action is passed in.
524
+ * @property deleteTablePermissions
525
+ * @type {Boolean}
526
+ * @default true
527
+ */
528
+ deleteTablePermission: true,
529
+
530
+ /**
531
+ * Callback to update the table rows whenever the data is changed, generally from sorting
532
+ *
533
+ * @private
534
+ * @method updateTableRows
535
+ */
536
+ // eslint-disable-next-line ember/no-observers
537
+ updateTableRows: observer(&#x27;sortedData&#x27;, function() {
538
+ if (this.table) {
539
+ this.table.setRows(this.sortedData);
540
+ }
541
+ }),
542
+
543
+ /**
544
+ * Callback to update the table columns whenever they change. Unlikely, but still a case worth covering
545
+ *
546
+ * @private
547
+ * @method updateTableColumns
548
+ */
549
+ // eslint-disable-next-line ember/no-observers
550
+ updateTableColumns: observer(&#x27;columns&#x27;, function() {
551
+ if (this.table) {
552
+ this.table.setColumns(this.columns);
553
+ }
554
+ }),
555
+
556
+ /**
557
+ * Initializes the component and loads the modal path.
558
+ *
559
+ * @private
560
+ * @method didReceiveAttrs
561
+ */
562
+ didReceiveAttrs() {
563
+ this._super(...arguments);
564
+ // first, determine our sorting
565
+ let defaultSort = this._defaultSort;
566
+ let columns = this.columns || [];
567
+ if (!isEmpty(defaultSort)) {
568
+ // make a map of key to ascending
569
+ let [mainKey] = defaultSort;
570
+ let ascending = true;
571
+ if (mainKey.endsWith(&#x27;:desc&#x27;)) {
572
+ ascending = false;
573
+ mainKey = mainKey.substring(0, mainKey.length - 5);
574
+ }
575
+ columns = columns.map((column) =&gt; {
576
+ let key = column.sortKey || column.valuePath;
577
+ return key === mainKey ? Object.assign({}, column, {sorted: true, ascending}) : column;
578
+ });
579
+ }
580
+ this.set(&#x27;table&#x27;, newTable(columns, this.sortedData));
581
+
582
+ if (this.noPanel) {
583
+ this.set(&#x27;classNames&#x27;, null);
584
+ }
585
+ },
586
+
587
+ actions: {
588
+ /**
589
+ * Called when clicking aa column header to sort the current row
590
+ * @param {Column} column Column clicked
591
+ */
592
+ sort(column) {
593
+ if (!column.sortable) {
594
+ return;
595
+ }
596
+
597
+ // modify the sort state, this is ported from the default code to properly set ascending to true on sort
598
+ if (column.sorted) {
599
+ column.toggleProperty(&#x27;ascending&#x27;);
600
+ } else {
601
+ this.get(&#x27;table.sortedColumns&#x27;).setEach(&#x27;sorted&#x27;, false);
602
+ column.set(&#x27;sorted&#x27;, true);
603
+ column.set(&#x27;ascending&#x27;, true);
604
+ }
605
+
606
+ // determine how we are sorting
607
+ let sortKey = column.sortKey || column.valuePath;
608
+
609
+ // if the column is now descending, sort descending
610
+ if (!column.ascending) {
611
+ sortKey = &#x60;${sortKey}:desc&#x60;;
612
+ }
613
+
614
+ // call the sort logic
615
+ this.onSort(column, sortKey).then(() =&gt; {
616
+ this.set(&#x27;sortColumn&#x27;, sortKey);
617
+ });
618
+ },
619
+
620
+ /**
621
+ * Called when clicking a row to expand it and show more information
622
+ * @param {Row} row Row clicked
623
+ */
624
+ expand(row) {
625
+ let expand = row.get(&#x27;canExpand&#x27;) ? !row.get(&#x27;expanded&#x27;) : false;
626
+ if (expand) {
627
+ this.get(&#x27;table.expandedRows&#x27;).setEach(&#x27;expanded&#x27;, false);
628
+ }
629
+ row.set(&#x27;expanded&#x27;, expand);
630
+ },
631
+
632
+ /**
633
+ * Called by the export button to export the current table data to CSV
634
+ */
635
+ export() {
636
+ exportTable(this.table, this.title);
637
+ }
638
+ }
639
+ });
640
+
641
+ TableSortable.reopenClass({
642
+ positionalParams: [&#x27;data&#x27;, &#x27;columns&#x27;]
643
+ });
644
+
645
+ export default TableSortable;
646
+
647
+ </pre>
648
+ </div>
649
+ </div>
650
+ </div>
651
+ </div>
652
+ </div>
653
+ </div>
654
+ </div>
655
+ <script src="../assets/vendor/prettify/prettify-min.js"></script>
656
+ <script>prettyPrint();</script>
657
+ <script src="../assets/vendor/jquery/jquery.min.js"></script>
658
+ <script src="../assets/vendor/jquery-ui/jquery-ui.min.js"></script>
659
+ <script src="../assets/vendor/bootstrap/js/bootstrap.js"></script>
660
+ <script src="../assets/vendor/github-slugger/slugger.js"></script>
661
+ <script src="../assets/js/yuidoc-bootstrap.js"></script>
662
+ </body>
663
+ </html>