@bennerinformatics/ember-fw-table 2.0.20 → 2.1.0

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 (115) hide show
  1. package/README.md +6 -0
  2. package/addon/classes/Row.js +80 -74
  3. package/addon/classes/Table.js +152 -147
  4. package/addon/components/fw-cell-action.js +19 -15
  5. package/addon/components/fw-cell-boolean.js +13 -12
  6. package/addon/components/fw-cell-nullable.js +15 -12
  7. package/addon/components/fw-cell-permission-icon.js +28 -12
  8. package/addon/components/fw-column-sortable.js +12 -4
  9. package/addon/components/fw-column-title.js +21 -13
  10. package/addon/components/fw-delete-modal.js +80 -61
  11. package/addon/components/fw-expandable-row.js +5 -0
  12. package/addon/components/fw-pagination-wrapper.js +600 -681
  13. package/addon/components/fw-row-toggle-index.js +14 -14
  14. package/addon/components/fw-row-toggle.js +12 -5
  15. package/addon/components/fw-table-expanded-row.js +23 -24
  16. package/addon/components/fw-table-expanded-rows.js +8 -4
  17. package/addon/components/fw-table-resort.js +31 -18
  18. package/addon/components/fw-table-sortable.js +414 -398
  19. package/addon/documentation.js +63 -98
  20. package/addon/templates/components/fw-delete-modal.hbs +2 -7
  21. package/addon/templates/components/fw-pagination-wrapper.hbs +45 -74
  22. package/addon/templates/components/fw-table-expanded-row.hbs +23 -23
  23. package/addon/templates/components/fw-table-expanded-rows.hbs +1 -1
  24. package/addon/templates/components/fw-table-resort.hbs +4 -4
  25. package/addon/templates/components/fw-table-sortable.hbs +54 -77
  26. package/addon/utils/base-cells.js +75 -40
  27. package/addon/utils/export.js +78 -76
  28. package/addon/utils/formats.js +93 -46
  29. package/addon/utils/table.js +36 -35
  30. package/app/breakpoints.js +1 -1
  31. package/app/components/fw-cell-permission-icon.js +1 -1
  32. package/app/initializers/responsive.js +1 -1
  33. package/codemods.log +16 -0
  34. package/index.js +10 -9
  35. package/package.json +65 -67
  36. package/yuidoc-ember-theme/LICENSE +21 -0
  37. package/yuidoc-ember-theme/README.md +88 -0
  38. package/yuidoc-ember-theme/assets/css/custom.css +82 -0
  39. package/yuidoc-ember-theme/assets/css/external-small.png +0 -0
  40. package/yuidoc-ember-theme/assets/css/main.css +793 -0
  41. package/yuidoc-ember-theme/assets/css/theme.css +547 -0
  42. package/yuidoc-ember-theme/assets/icons/android-icon-144x144.png +0 -0
  43. package/yuidoc-ember-theme/assets/icons/android-icon-192x192.png +0 -0
  44. package/yuidoc-ember-theme/assets/icons/android-icon-36x36.png +0 -0
  45. package/yuidoc-ember-theme/assets/icons/android-icon-48x48.png +0 -0
  46. package/yuidoc-ember-theme/assets/icons/android-icon-72x72.png +0 -0
  47. package/yuidoc-ember-theme/assets/icons/android-icon-96x96.png +0 -0
  48. package/yuidoc-ember-theme/assets/icons/apple-icon-114x114.png +0 -0
  49. package/yuidoc-ember-theme/assets/icons/apple-icon-120x120.png +0 -0
  50. package/yuidoc-ember-theme/assets/icons/apple-icon-144x144.png +0 -0
  51. package/yuidoc-ember-theme/assets/icons/apple-icon-152x152.png +0 -0
  52. package/yuidoc-ember-theme/assets/icons/apple-icon-180x180.png +0 -0
  53. package/yuidoc-ember-theme/assets/icons/apple-icon-57x57.png +0 -0
  54. package/yuidoc-ember-theme/assets/icons/apple-icon-60x60.png +0 -0
  55. package/yuidoc-ember-theme/assets/icons/apple-icon-72x72.png +0 -0
  56. package/yuidoc-ember-theme/assets/icons/apple-icon-76x76.png +0 -0
  57. package/yuidoc-ember-theme/assets/icons/apple-icon-precomposed.png +0 -0
  58. package/yuidoc-ember-theme/assets/icons/apple-icon.png +0 -0
  59. package/yuidoc-ember-theme/assets/icons/browserconfig.xml +2 -0
  60. package/yuidoc-ember-theme/assets/icons/favicon-16x16.png +0 -0
  61. package/yuidoc-ember-theme/assets/icons/favicon-32x32.png +0 -0
  62. package/yuidoc-ember-theme/assets/icons/favicon-96x96.png +0 -0
  63. package/yuidoc-ember-theme/assets/icons/favicon.ico +0 -0
  64. package/yuidoc-ember-theme/assets/icons/manifest.json +41 -0
  65. package/yuidoc-ember-theme/assets/icons/ms-icon-144x144.png +0 -0
  66. package/yuidoc-ember-theme/assets/icons/ms-icon-150x150.png +0 -0
  67. package/yuidoc-ember-theme/assets/icons/ms-icon-310x310.png +0 -0
  68. package/yuidoc-ember-theme/assets/icons/ms-icon-70x70.png +0 -0
  69. package/yuidoc-ember-theme/assets/img/ember-logo.png +0 -0
  70. package/yuidoc-ember-theme/assets/img/fw-logo.png +0 -0
  71. package/yuidoc-ember-theme/assets/img/spinner.gif +0 -0
  72. package/yuidoc-ember-theme/assets/index.html +10 -0
  73. package/yuidoc-ember-theme/assets/js/yuidoc-bootstrap.js +274 -0
  74. package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
  75. package/yuidoc-ember-theme/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
  76. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  77. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  78. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  79. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  80. package/yuidoc-ember-theme/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  81. package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  82. package/yuidoc-ember-theme/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  83. package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
  84. package/yuidoc-ember-theme/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
  85. package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
  86. package/yuidoc-ember-theme/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
  87. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  88. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  89. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
  90. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  91. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  92. package/yuidoc-ember-theme/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  93. package/yuidoc-ember-theme/assets/vendor/github-slugger/slugger.js +59 -0
  94. package/yuidoc-ember-theme/assets/vendor/jquery/jquery.min.js +6 -0
  95. package/yuidoc-ember-theme/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
  96. package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.css +1 -0
  97. package/yuidoc-ember-theme/assets/vendor/prettify/prettify-min.js +1 -0
  98. package/{bitbucket-helpers-override.js → yuidoc-ember-theme/helpers/bitbucket-helpers-override.js} +240 -240
  99. package/yuidoc-ember-theme/helpers/helpers.js +236 -0
  100. package/yuidoc-ember-theme/layouts/main.handlebars +111 -0
  101. package/yuidoc-ember-theme/layouts/xhr.handlebars +7 -0
  102. package/yuidoc-ember-theme/package.json +15 -0
  103. package/yuidoc-ember-theme/partials/attrs.handlebars +144 -0
  104. package/yuidoc-ember-theme/partials/classes.handlebars +229 -0
  105. package/yuidoc-ember-theme/partials/events.handlebars +140 -0
  106. package/yuidoc-ember-theme/partials/files.handlebars +9 -0
  107. package/yuidoc-ember-theme/partials/index.handlebars +25 -0
  108. package/yuidoc-ember-theme/partials/method.handlebars +193 -0
  109. package/yuidoc-ember-theme/partials/module.handlebars +108 -0
  110. package/yuidoc-ember-theme/partials/options.handlebars +22 -0
  111. package/yuidoc-ember-theme/partials/props.handlebars +122 -0
  112. package/yuidoc-ember-theme/partials/sidebar.handlebars +77 -0
  113. package/yuidoc-ember-theme/theme.json +4 -0
  114. package/yuidoc-ember-theme/yarn.lock +4 -0
  115. package/yuidoc.json +23 -21
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ember-fw-table
2
2
 
3
+ We have a couple of documentation websites, which may help in using this package:
4
+
5
+ [Ember FW Table Docs](https://linformatics.bitbucket.io/docs/addons/client/ember-fw-table) give a more robust guide to some of the important features of the package.
6
+
7
+ [Ember FW Table API Docs](https://linformatics.bitbucket.io/docs/addons/client-api/ember-fw-table) are api documentation for each of our components, which are generated from code comments.
8
+
3
9
  This README outlines the details of collaborating on this Ember addon.
4
10
 
5
11
  ## Installation
@@ -1,74 +1,80 @@
1
- import {computed, defineProperty, observer} from '@ember/object';
2
- import {alias} from '@ember/object/computed';
3
- import LightRow from 'ember-light-table/classes/Row';
4
- import {showExpanded} from '../utils/table';
5
-
6
- /**
7
- * Function to create the canExpand computed property
8
- * @param {array} keys Array of keys to watch
9
- * @return {computed} Computed property
10
- */
11
- function canExpand(keys) {
12
- return computed('table.{alwaysExpand,hasExpandedColumns}', ...keys, function() {
13
- // start with some short exits
14
- // no expanded columns is false
15
- if (!this.get('table.hasExpandedColumns')) {
16
- return false;
17
- }
18
- // if it has an expanded column that always shows, automatically true
19
- if (this.get('table.alwaysExpand')) {
20
- return true;
21
- }
22
-
23
- // try and find any column that has something
24
- return this.get('table.expandedColumns').any((column) => {
25
- return showExpanded(this.get('table'), this, column);
26
- });
27
- });
28
- }
29
-
30
- /**
31
- * Personal copy of Ember Light Table row to support the can expand property
32
- * @type {EmberObject}
33
- * @extends EmberLightTable/Row
34
- * @class Row
35
- */
36
- export default class Row extends LightRow.extend({
37
- /**
38
- * Parent table instance
39
- * @property table
40
- * @type {Table}
41
- */
42
-
43
- /**
44
- * Checks if the row is currently allowed to expand
45
- * @type {boolean}
46
- */
47
- canExpand: alias('table.hasExpandedColumns'),
48
-
49
- /** Disables expanded state if canExpand is false */
50
- expanded: computed('canExpand', '_expanded', {
51
- get() {
52
- return this.get('canExpand') && this.get('_expanded');
53
- },
54
- set(_, value) {
55
- value &= this.get('canExpand');
56
- this.set('_expanded', value);
57
- return value;
58
- }
59
- }),
60
-
61
- /**
62
- * Observer to update canExpand if the expanded keys ever changes
63
- */
64
- // eslint-disable-next-line ember/no-observers
65
- updateColumns: observer('table.expandedKeys', function() {
66
- defineProperty(this, 'canExpand', canExpand(this.get('table.expandedKeys')));
67
- })
68
- }) {
69
- constructor({content, table}) {
70
- super(content);
71
- this.set('table', table);
72
- defineProperty(this, 'canExpand', canExpand(table.get('expandedKeys')));
73
- }
74
- }
1
+ import {computed, defineProperty, observer} from '@ember/object';
2
+ import {alias} from '@ember/object/computed';
3
+ import LightRow from 'ember-light-table/classes/Row';
4
+ import {showExpanded} from '../utils/table';
5
+
6
+ /**
7
+ * Function to create the canExpand computed property
8
+ * @param {array} keys Array of keys to watch
9
+ * @return {computed} Computed property
10
+ */
11
+ function canExpand(keys) {
12
+ return computed('table.{alwaysExpand,hasExpandedColumns,expandedColumns}', ...keys, function() {
13
+ // start with some short exits
14
+ // no expanded columns is false
15
+ if (!this.table.hasExpandedColumns) {
16
+ return false;
17
+ }
18
+ // if it has an expanded column that always shows, automatically true
19
+ if (this.table.alwaysExpand) {
20
+ return true;
21
+ }
22
+
23
+ // try and find any column that has something
24
+ return this.table.expandedColumns.any((column) => {
25
+ return showExpanded(this.table, this, column);
26
+ });
27
+ });
28
+ }
29
+
30
+ /**
31
+ * Personal copy of Ember Light Table row to support the can expand property
32
+ * @type {EmberObject}
33
+ * @extends EmberLightTable/Row
34
+ * @class Row
35
+ */
36
+ export default class Row extends LightRow.extend({
37
+ /**
38
+ * Parent table instance
39
+ * @property table
40
+ * @type {Table}
41
+ */
42
+
43
+ /**
44
+ * Checks if the row is currently allowed to expand
45
+ * @type {boolean}
46
+ */
47
+ canExpand: alias('table.hasExpandedColumns'),
48
+
49
+ /** Disables expanded state if canExpand is false */
50
+ expanded: computed('canExpand', '_expanded', {
51
+ get() {
52
+ return this.canExpand && this.get('_expanded');
53
+ },
54
+ set(_, value) {
55
+ value &= this.canExpand;
56
+ this.set('_expanded', value);
57
+ return value;
58
+ }
59
+ }),
60
+
61
+ /**
62
+ * Observer to update canExpand if the expanded keys ever changes
63
+ */
64
+ // eslint-disable-next-line ember/no-observers
65
+ updateColumns: observer('table.expandedKeys', function() {
66
+ defineProperty(this, 'canExpand', canExpand(this.table.expandedKeys));
67
+ }),
68
+
69
+ init({content, table}) {
70
+ this._super(...arguments);
71
+ this.table = table;
72
+ defineProperty(this, 'canExpand', canExpand(table.get('expandedKeys')));
73
+ }
74
+ }) {
75
+ // constructor({content, table}) {
76
+ // super(content);
77
+ // this.table = table;
78
+ // defineProperty(this, 'canExpand', canExpand(table.get('expandedKeys')));
79
+ // }
80
+ }
@@ -1,147 +1,152 @@
1
- import LightTable from 'ember-light-table/classes/Table';
2
- import Row from './Row';
3
- import {A as emberArray} from '@ember/array';
4
- import {computed} from '@ember/object';
5
- import {filter} from '@ember/object/computed';
6
- import {isEmpty, isNone} from '@ember/utils';
7
-
8
- /**
9
- * Create a collection of Row objects with the given collection
10
- * @method createRows
11
- * @static
12
- * @param {Array} rows Passed in rows
13
- * @param {Table} table Table instance
14
- * @return {Array} Array of table rows
15
- */
16
- function createRows(rows = [], table) {
17
- return rows.map((r) => new Row({content: r, table}));
18
- }
19
-
20
- /**
21
- * Personal copy of the table class with some additional computed properties
22
- *
23
- * @class Table
24
- * @extends EmberLightTable/Table
25
- */
26
- /*
27
- * TODO: needs to implement some additional row methods as right now only setRows is wrapped
28
- */
29
- export class Table extends LightTable.extend({
30
- /**
31
- * Table columns without export only columns
32
- * @property tableColumns
33
- * @type {Ember.Array}
34
- */
35
- tableColumns: filter('columns.@each.exportOnly', function(column) {
36
- return !column.get('exportOnly');
37
- }),
38
-
39
- /**
40
- * @property visibleColumnGroups
41
- * @type {Ember.Array}
42
- */
43
- visibleColumnGroups: computed('tableColumns.[]', 'tableColumns.@each.{isHidden,isVisibleGroupColumn}', function() {
44
- return this.get('tableColumns').filter((c) => {
45
- return c.get('isVisibleGroupColumn') || (!c.get('isGroupColumn') && !c.get('isHidden'));
46
- });
47
- }).readOnly(),
48
-
49
- /**
50
- * @property visibleSubColumns
51
- * @type {Ember.Array}
52
- */
53
- visibleSubColumns: computed('tableColumns.@each.visibleSubColumns', function() {
54
- return emberArray([].concat(...this.get('tableColumns').getEach('visibleSubColumns')));
55
- }).readOnly(),
56
-
57
- /**
58
- * @property allColumns
59
- * @type {Ember.Array}
60
- */
61
- allColumns: computed('tableColumns.@each.subColumns', function() {
62
- return this.get('tableColumns').reduce((arr, c) => {
63
- arr.pushObjects(c.get('isGroupColumn') ? c.get('subColumns') : [c]);
64
- return arr;
65
- }, emberArray([]));
66
- }).readOnly(),
67
-
68
- /**
69
- * List of all columns that can show in expanded view, it will be filtered again later
70
- *
71
- * @private
72
- * @property expandedColumns
73
- * @type {Array}
74
- */
75
- expandedColumns: filter('allColumns.@each.{isHidden,showExpanded,cellComponent}', function(column) {
76
- // if the column is not hidden, skip it
77
- if (!column.get('isHidden')) {
78
- return false;
79
- }
80
- // if hidden, ask the column if we should show it
81
- let showExpanded = column.get('showExpanded');
82
- if (!isNone(showExpanded)) {
83
- return showExpanded;
84
- }
85
-
86
- // by default, show if the value path is empty and its not a row toggle
87
- return column.get('cellComponent') !== 'fw-row-toggle';
88
- }).readOnly(),
89
-
90
- alwaysExpand: computed('expandedColumns.@each.canExpand', function() {
91
- return this.get('expandedColumns').any((column) => column.get('showExpanded') === true);
92
- }),
93
-
94
- expandedKeys: computed('expandedColumns.[]', function() {
95
- let keys = [];
96
- this.get('expandedColumns').forEach((column) => {
97
- // check if we have a specific expansion property
98
- let showExpanded = column.get('showExpanded');
99
- if (typeof showExpanded === 'string') {
100
- keys.pushObject(showExpanded);
101
- } else {
102
- // otherwise, try the value path
103
- if (column.get('valuePath')) {
104
- keys.pushObject(column.get('valuePath'));
105
- }
106
- }
107
- });
108
-
109
- return keys;
110
- }),
111
-
112
- /**
113
- * Returns true if the table currently contains hidden columns
114
- *
115
- * @private
116
- * @property hasHiddenColumns
117
- * @type {Boolean}
118
- */
119
- hasExpandedColumns: computed('expandedColumns', function() {
120
- return !isEmpty(this.get('expandedColumns'));
121
- }),
122
-
123
- /**
124
- * Replace all the row's content with content of the argument. If argument is an empty array rows will be cleared.
125
- * @method setRows
126
- * @param {Array} rows
127
- * @return {Array} rows
128
- */
129
- setRows(rows = []) {
130
- return this.get('rows').setObjects(createRows(rows, this));
131
- }
132
- }) {
133
- constructor({columns, rows}) {
134
- super(columns, []);
135
- this.setRows(rows);
136
- }
137
- }
138
-
139
- /**
140
- * Creates an instance of the table class, mimicking the new Table constructor of the parent
141
- * @param {Array} columns Table columns
142
- * @param {Array} rows Table rows
143
- * @return {Table} Table class to use in ember-light-table
144
- */
145
- export default function newTable(columns, rows) {
146
- return new Table({columns, rows});
147
- }
1
+ import LightTable from 'ember-light-table/classes/Table';
2
+ import Row from './Row';
3
+ import {A as emberArray} from '@ember/array';
4
+ import {computed} from '@ember/object';
5
+ import {filter} from '@ember/object/computed';
6
+ import {isEmpty, isNone} from '@ember/utils';
7
+
8
+ /**
9
+ * Create a collection of Row objects with the given collection
10
+ * @method createRows
11
+ * @static
12
+ * @param {Array} rows Passed in rows
13
+ * @param {Table} table Table instance
14
+ * @return {Array} Array of table rows
15
+ */
16
+ function createRows(rows = [], table) {
17
+ return rows.map((r) => Row.create({content: r, table}));
18
+ }
19
+
20
+ /**
21
+ * Personal copy of the table class with some additional computed properties
22
+ *
23
+ * @class Table
24
+ * @extends EmberLightTable/Table
25
+ */
26
+ /*
27
+ * TODO: needs to implement some additional row methods as right now only setRows is wrapped
28
+ */
29
+ export class Table extends LightTable.extend({
30
+ /**
31
+ * Table columns without export only columns
32
+ * @property tableColumns
33
+ * @type {Ember.Array}
34
+ */
35
+ tableColumns: filter('columns.@each.exportOnly', function(column) {
36
+ return !column.get('exportOnly');
37
+ }),
38
+
39
+ /**
40
+ * @property visibleColumnGroups
41
+ * @type {Ember.Array}
42
+ */
43
+ visibleColumnGroups: computed('tableColumns.[]', 'tableColumns.@each.{isHidden,isVisibleGroupColumn}', function() {
44
+ return this.tableColumns.filter((c) => {
45
+ return c.get('isVisibleGroupColumn') || (!c.get('isGroupColumn') && !c.get('isHidden'));
46
+ });
47
+ }).readOnly(),
48
+
49
+ /**
50
+ * @property visibleSubColumns
51
+ * @type {Ember.Array}
52
+ */
53
+ visibleSubColumns: computed('tableColumns.@each.visibleSubColumns', function() {
54
+ return emberArray([].concat(...this.tableColumns.getEach('visibleSubColumns')));
55
+ }).readOnly(),
56
+
57
+ /**
58
+ * @property allColumns
59
+ * @type {Ember.Array}
60
+ */
61
+ allColumns: computed('tableColumns.@each.subColumns', function() {
62
+ return this.tableColumns.reduce((arr, c) => {
63
+ arr.pushObjects(c.get('isGroupColumn') ? c.get('subColumns') : [c]);
64
+ return arr;
65
+ }, emberArray([]));
66
+ }).readOnly(),
67
+
68
+ /**
69
+ * List of all columns that can show in expanded view, it will be filtered again later
70
+ *
71
+ * @private
72
+ * @property expandedColumns
73
+ * @type {Array}
74
+ */
75
+ expandedColumns: filter('allColumns.@each.{isHidden,showExpanded,cellComponent}', function(column) {
76
+ // if the column is not hidden, skip it
77
+ if (!column.get('isHidden')) {
78
+ return false;
79
+ }
80
+ // if hidden, ask the column if we should show it
81
+ let showExpanded = column.get('showExpanded');
82
+ if (!isNone(showExpanded)) {
83
+ return showExpanded;
84
+ }
85
+
86
+ // by default, show if the value path is empty and its not a row toggle
87
+ return column.get('cellComponent') !== 'fw-row-toggle';
88
+ }).readOnly(),
89
+
90
+ alwaysExpand: computed('expandedColumns.@each.canExpand', function() {
91
+ return this.expandedColumns.any((column) => column.get('showExpanded') === true);
92
+ }),
93
+
94
+ expandedKeys: computed('expandedColumns.[]', function() {
95
+ let keys = [];
96
+ this.expandedColumns.forEach((column) => {
97
+ // check if we have a specific expansion property
98
+ let showExpanded = column.get('showExpanded');
99
+ if (typeof showExpanded === 'string') {
100
+ keys.pushObject(showExpanded);
101
+ } else {
102
+ // otherwise, try the value path
103
+ if (column.get('valuePath')) {
104
+ keys.pushObject(column.get('valuePath'));
105
+ }
106
+ }
107
+ });
108
+
109
+ return keys;
110
+ }),
111
+
112
+ /**
113
+ * Returns true if the table currently contains hidden columns
114
+ *
115
+ * @private
116
+ * @property hasHiddenColumns
117
+ * @type {Boolean}
118
+ */
119
+ hasExpandedColumns: computed('expandedColumns', function() {
120
+ return !isEmpty(this.expandedColumns);
121
+ }),
122
+
123
+ /**
124
+ * Replace all the row's content with content of the argument. If argument is an empty array rows will be cleared.
125
+ * @method setRows
126
+ * @param {Array} rows
127
+ * @return {Array} rows
128
+ */
129
+ setRows(rows = []) {
130
+ return this.rows.setObjects(createRows(rows, this));
131
+ },
132
+
133
+ init({columns, rows}) {
134
+ this._super(...arguments);
135
+ this.setRows(rows);
136
+ }
137
+ }) {
138
+ // constructor({columns, rows}) {
139
+ // super(columns, []);
140
+ // this.setRows(rows);
141
+ // }
142
+ }
143
+
144
+ /**
145
+ * Creates an instance of the table class, mimicking the new Table constructor of the parent
146
+ * @param {Array} columns Table columns
147
+ * @param {Array} rows Table rows
148
+ * @return {Table} Table class to use in ember-light-table
149
+ */
150
+ export default function newTable(columns, rows) {
151
+ return Table.create({columns, rows});
152
+ }
@@ -1,15 +1,19 @@
1
- import Component from '@ember/component';
2
- import layout from '../templates/components/fw-cell-action';
3
-
4
- /**
5
- * This cell contains buttons to edit and delete a model, which can have actions passed in
6
- * The edit action is expected to be passed in as tableActions.edit, while delete as tableActions.delete
7
- *
8
- * Setting the variable "small" in the column will cause the buttons to display smaller
9
- * The easiest way to add this cell is through the base cell in utils, for more information, [click here](../classes/BaseCells.html)
10
- * @public
11
- * @class FW-Cell-Action
12
- */
13
- export default Component.extend({
14
- layout
15
- });
1
+ import Component from '@ember/component';
2
+ import layout from '../templates/components/fw-cell-action';
3
+
4
+ /**
5
+ * This cell contains buttons to edit and delete a model, which can have actions passed in.
6
+ * The edit action is expected to be passed in as `tableActions.edit`, while delete as `tableActions.delete`.
7
+ * This component will only give you two actions, so if you need a more complicated component than edit and delete,
8
+ * you will need to create your own cell component.
9
+ * Setting the variable `small` in the column will cause the buttons to display smaller.
10
+ *
11
+ * The easiest way to add this cell is through the base cell in utils, for more information, [click here](../classes/BaseCells.html). In most cases, it is best
12
+ * to use the util rather than this cell component directly.
13
+ * @public
14
+ * @class FwCellAction
15
+ * @module CellComponents
16
+ */
17
+ export default Component.extend({
18
+ layout
19
+ });
@@ -1,12 +1,13 @@
1
- import Component from '@ember/component';
2
- import layout from '../templates/components/fw-cell-boolean';
3
-
4
- /**
5
- * Displays a cell containing a boolean as either "Yes" or "No"
6
- * @public
7
- * @deprecated Use utils/formats.formatBoolean
8
- * @class FW-Cell-Boolean
9
- */
10
- export default Component.extend({
11
- layout
12
- });
1
+ import Component from '@ember/component';
2
+ import layout from '../templates/components/fw-cell-boolean';
3
+
4
+ /**
5
+ * Displays a cell containing a boolean as either "Yes" or "No".
6
+ * @public
7
+ * @deprecated You should use the [`formatBoolean` in the Format Util](../classes/BaseCells.html) instead.
8
+ * @class FwCellBoolean
9
+ * @module CellComponents
10
+ */
11
+ export default Component.extend({
12
+ layout
13
+ });
@@ -1,12 +1,15 @@
1
- import Component from '@ember/component';
2
- import layout from '../templates/components/fw-cell-nullable';
3
-
4
- /**
5
- * Creates a table cell that displays a default value if null.
6
- * That value defaults to "None", but can be changed by setting the nullText property in a column
7
- * @public
8
- * @class FW-Cell-Nullable
9
- */
10
- export default Component.extend({
11
- layout
12
- });
1
+ import Component from '@ember/component';
2
+ import layout from '../templates/components/fw-cell-nullable';
3
+
4
+ /**
5
+ * Creates a table cell that displays a default value if null.
6
+ * That value defaults to "None", but can be changed by setting the `nullText` property in a column.
7
+ * @deprecated You should use the [`formatNullable` in the Format Util](../classes/BaseCells.html) instead.
8
+ * @public
9
+ * @class FwCellNullable
10
+ * @module CellComponents
11
+ *
12
+ */
13
+ export default Component.extend({
14
+ layout
15
+ });
@@ -1,12 +1,28 @@
1
- import Component from '@ember/component';
2
- import layout from '../templates/components/fw-cell-permission-icon';
3
-
4
- /**
5
- * Displays a cell containing a boolean as either "Yes" or "No"
6
- * @public
7
- * @deprecated Use utils/formats.formatBoolean
8
- * @class FW-Cell-Permission-Icon
9
- */
10
- export default Component.extend({
11
- layout
12
- });
1
+ import Component from '@ember/component';
2
+ import layout from '../templates/components/fw-cell-permission-icon';
3
+
4
+ /**
5
+ * This component displays the permission icon for the table on the Permissions page. It should be used in the following way:
6
+ * ```js
7
+ * columns: [{
8
+ * label: 'Admin',
9
+ * valuePath: 'admin',
10
+ * cellComponent: 'fw-cell-permission-icon',
11
+ * align: 'center',
12
+ * width: '80px'
13
+ * }]
14
+ * ```
15
+ * This component will take the value, and display the proper Fontawesome icon based on its value. The value should be one of the following three numbers:
16
+ *
17
+ * - 0 means that that role does not have access to that feature, and it will display a red X.
18
+ * - 1 means that that feature is controlled by access control, not by Group Control, and it will display a lock icon in the primary color of the app
19
+ * - 2 means that that role has access to that feature, and will display a green check mark.
20
+ * - If the value is anything else, the cell will just be empty
21
+ *
22
+ * @public
23
+ * @class FwCellPermissionIcon
24
+ * @module CellComponents
25
+ */
26
+ export default Component.extend({
27
+ layout
28
+ });
@@ -3,11 +3,19 @@ import {computed} from '@ember/object';
3
3
  import layout from '../templates/components/fw-column-sortable';
4
4
 
5
5
  /**
6
- * Displays a column title which can show a sorting icon
6
+ * Displays a column title which can show a sorting icon if a network request is still active. This can be used for your columns when using the [FwPaginationWrapper](../classes/FwPaginationWrapper.html),
7
+ * so that sorting works properly. It should be set as the columns component (not the cellComponent), like so:
8
+ * ```js
9
+ * columns: [{
10
+ * label: 'Name',
11
+ * valuePath: 'name',
12
+ * component: 'fw-column-sortable'
13
+ * }...]
14
+ * ```
15
+ * If you do this, when you are sorting the table within the paginated wrapper, it will display a spinning icon letting the user know that the sort is loading.
7
16
  * @public
8
- * @class FW-Column-Sortable
9
- * @module Components
10
- * @submodule Internal
17
+ * @class FwColumnSortable
18
+ * @module ColumnComponents
11
19
  */
12
20
  export default Component.extend({
13
21
  layout,
@@ -1,13 +1,21 @@
1
- import Sortable from './fw-column-sortable';
2
- import layout from '../templates/components/fw-column-title';
3
-
4
- /**
5
- * Displays a column title which will truncate with an ellipsis if too long
6
- * @public
7
- * @class FW-Column-Title
8
- * @module Components
9
- * @submodule Internal
10
- */
11
- export default Sortable.extend({
12
- layout
13
- });
1
+ import Sortable from './fw-column-sortable';
2
+ import layout from '../templates/components/fw-column-title';
3
+
4
+ /**
5
+ * This column component extends [`fw-column-sortable` component](../classes/FwColumnSortable.html), so it will display a sort-icon, but it also display a column title
6
+ * which will truncate with an ellipsis if too long. This can be used for your columns when using the [FwPaginationWrapper](../classes/FwPaginationWrapper.html),
7
+ * so that sorting works properly. It should be set as the columns component (not the cellComponent), like so:
8
+ * ```js
9
+ * columns: [{
10
+ * label: 'Name',
11
+ * valuePath: 'name',
12
+ * component: 'fw-column-title'
13
+ * }...]
14
+ * ```
15
+ * @public
16
+ * @class FwColumnTitle
17
+ * @module ColumnComponents
18
+ */
19
+ export default Sortable.extend({
20
+ layout
21
+ });