@bennerinformatics/ember-fw-table 2.0.19 → 2.0.21

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 (32) hide show
  1. package/addon/classes/Row.js +74 -74
  2. package/addon/classes/Table.js +147 -147
  3. package/addon/components/fw-cell-action.js +15 -15
  4. package/addon/components/fw-cell-boolean.js +12 -12
  5. package/addon/components/fw-cell-nullable.js +12 -12
  6. package/addon/components/fw-cell-permission-icon.js +12 -12
  7. package/addon/components/fw-column-title.js +13 -13
  8. package/addon/components/fw-delete-modal.js +61 -61
  9. package/addon/components/fw-pagination-wrapper.js +681 -681
  10. package/addon/components/fw-row-toggle-index.js +14 -14
  11. package/addon/components/fw-table-expanded-row.js +24 -24
  12. package/addon/components/fw-table-resort.js +3 -3
  13. package/addon/components/fw-table-sortable.js +398 -389
  14. package/addon/documentation.js +98 -98
  15. package/addon/templates/components/fw-delete-modal.hbs +2 -7
  16. package/addon/templates/components/fw-pagination-wrapper.hbs +45 -74
  17. package/addon/templates/components/fw-table-expanded-row.hbs +23 -23
  18. package/addon/templates/components/fw-table-expanded-rows.hbs +1 -1
  19. package/addon/templates/components/fw-table-resort.hbs +4 -4
  20. package/addon/templates/components/fw-table-sortable.hbs +9 -31
  21. package/addon/utils/base-cells.js +40 -40
  22. package/addon/utils/export.js +76 -76
  23. package/addon/utils/formats.js +46 -46
  24. package/addon/utils/table.js +35 -35
  25. package/app/breakpoints.js +1 -1
  26. package/app/components/fw-cell-permission-icon.js +1 -1
  27. package/app/initializers/responsive.js +1 -1
  28. package/bitbucket-helpers-override.js +240 -240
  29. package/codemods.log +16 -0
  30. package/index.js +9 -10
  31. package/package.json +67 -67
  32. package/yuidoc.json +21 -21
@@ -1,98 +1,98 @@
1
- /* Below is the main documentation for the addon. This file is only for documentation, it doesn't actually do anything. */
2
- /**
3
- * The primary purpose of ember-fw-table is to make a simplified form of ember-light-table,
4
- * and which is easier to use than its parent. Within it as well, we have added a few extra
5
- * things that make more complicated aspects of tables also easier to incorporate (such as
6
- * paginated tables). For more information on ember-light-table,
7
- * [see their documentation](https://adopted-ember-addons.github.io/ember-light-table/docs).
8
- *
9
- * Because of the design of this addon, it is much simpler than some of Informatics other
10
- * addons. All of the "internal" elements of this addon, which are used within the addon, but
11
- * are not designed to be used outside, are in an "Internal" submodule.
12
- * * [Components](Components.html)
13
- * - [Main Components](Main.html)
14
- * - [Internal Components](Internal.html)
15
- * - [Cell Components](Cell.html)
16
- * * [Utils](Utils.html)
17
- *
18
- * @module Introduction
19
- * @main Introduction
20
- */
21
- /**
22
- * Ember-FW-Table defines many different components that can be used throughout the Informatics apps. To understand what a component is,
23
- * [click here](https://guides.emberjs.com/v2.18.0/components/) for Ember's own documentation on components. The main focus of this app
24
- * is of course the main table Here contains a list
25
- * of all of the different components that are defined by ember-fw. Ember-fw also adds the ability for more advanced components
26
- * (which are components that require more than just a simple call to use), such as [Notifications](../classes/NotificationsService.html)
27
- * and [Modals](Modals.html).
28
- *
29
- * @module Components
30
- * @main Components
31
- */
32
- /**
33
- * Since the main component that is imported with this addon is to do with the table,
34
- * there are many components that can be explained in detail, but are really only internal to
35
- * the addon itself, and probably shouldn't be used without a serious reason. Those listed below
36
- * are technically able to be used by any app which import the addon, but will probably only be
37
- * helpful documentation for the developer who develops the ember-fw-table addon.
38
- *
39
- * @module Components
40
- * @submodule Internal
41
- * @main Internal
42
- */
43
-
44
- /**
45
- * There are a few other components which are added in this addon, which are built to be used within
46
- * the app. Of course the largest of these is the fw-table-sortable, after which the addon derives
47
- * its name, but there are also other supplemental components designed for use with the app.
48
- *
49
- * ***
50
- *
51
- * ###Classes
52
- * * [FW-Table-Sortable](../classes/FW-Table-Sortable.html)
53
- * * [FW-Table-Resort](../classes/FW-Table-Resort.html)
54
- * * [FW-Pagination-Wrapper](../classes/FW-Pagination-Wrapper.html)
55
- * * [FW-Delete-Modal](../classes/FW-Delete-Modal.html)
56
- *
57
- * @module Components
58
- * @submodule Main
59
- * @main Main
60
- */
61
-
62
- /**
63
- * Some components in this addon were designed to be used with the `cellComponent` value used in the table.
64
- * For information on how `cellComponent` works, [click here](https://adopted-ember-addons.github.io/ember-light-table/docs/classes/Column.html#property_cellComponent).
65
- *
66
- * For each of these cell components, you call them in the following way:
67
- * ```js
68
- * column: [
69
- * {
70
- * label: 'Actions',
71
- * cellComponent: 'fw-cell-action'
72
- * }
73
- * ]
74
- * ```
75
- *
76
- * ***
77
- *
78
- * ### Classes
79
- * * [FW-Cell-Action](../classes/FW-Cell-Action.html)
80
- * * [FW-Cell-Boolean](../classes/FW-Cell-Boolean.html)
81
- * * [FW-Cell-Nullable](../classes/FW-Cell-Nullable.html)
82
- * * [FW-Cell-Permission-Icon](../classes/FW-Cell-Permission-Icon.html)
83
- * * [FW-Row-Toggle](../classes/FW-Row-Toggle.html)
84
- * * [FW-Row-Toggle-Index](../classes/FW-Row-Toggle-Index.html)
85
- *
86
- * @module Components
87
- * @submodule Cell
88
- * @main Cell
89
- */
90
-
91
- /**
92
- * Utils is short for Utilities, and they are essentially whatever you need them to be. It is simply a way to import a function that does a certain task.
93
- * In ember-fw-table, we have a few utils files that have been defined, and each has a couple different functions that are semi-related to each other. So each "class"
94
- * within the utils module actually is simply a group of related functions exported that can be used after they are imported.
95
- *
96
- * @module Utils
97
- * @main Utils
98
- */
1
+ /* Below is the main documentation for the addon. This file is only for documentation, it doesn't actually do anything. */
2
+ /**
3
+ * The primary purpose of ember-fw-table is to make a simplified form of ember-light-table,
4
+ * and which is easier to use than its parent. Within it as well, we have added a few extra
5
+ * things that make more complicated aspects of tables also easier to incorporate (such as
6
+ * paginated tables). For more information on ember-light-table,
7
+ * [see their documentation](https://adopted-ember-addons.github.io/ember-light-table/docs).
8
+ *
9
+ * Because of the design of this addon, it is much simpler than some of Informatics other
10
+ * addons. All of the "internal" elements of this addon, which are used within the addon, but
11
+ * are not designed to be used outside, are in an "Internal" submodule.
12
+ * * [Components](Components.html)
13
+ * - [Main Components](Main.html)
14
+ * - [Internal Components](Internal.html)
15
+ * - [Cell Components](Cell.html)
16
+ * * [Utils](Utils.html)
17
+ *
18
+ * @module Introduction
19
+ * @main Introduction
20
+ */
21
+ /**
22
+ * Ember-FW-Table defines many different components that can be used throughout the Informatics apps. To understand what a component is,
23
+ * [click here](https://guides.emberjs.com/v2.18.0/components/) for Ember's own documentation on components. The main focus of this app
24
+ * is of course the main table Here contains a list
25
+ * of all of the different components that are defined by ember-fw. Ember-fw also adds the ability for more advanced components
26
+ * (which are components that require more than just a simple call to use), such as [Notifications](../classes/NotificationsService.html)
27
+ * and [Modals](Modals.html).
28
+ *
29
+ * @module Components
30
+ * @main Components
31
+ */
32
+ /**
33
+ * Since the main component that is imported with this addon is to do with the table,
34
+ * there are many components that can be explained in detail, but are really only internal to
35
+ * the addon itself, and probably shouldn't be used without a serious reason. Those listed below
36
+ * are technically able to be used by any app which import the addon, but will probably only be
37
+ * helpful documentation for the developer who develops the ember-fw-table addon.
38
+ *
39
+ * @module Components
40
+ * @submodule Internal
41
+ * @main Internal
42
+ */
43
+
44
+ /**
45
+ * There are a few other components which are added in this addon, which are built to be used within
46
+ * the app. Of course the largest of these is the fw-table-sortable, after which the addon derives
47
+ * its name, but there are also other supplemental components designed for use with the app.
48
+ *
49
+ * ***
50
+ *
51
+ * ###Classes
52
+ * * [FW-Table-Sortable](../classes/FW-Table-Sortable.html)
53
+ * * [FW-Table-Resort](../classes/FW-Table-Resort.html)
54
+ * * [FW-Pagination-Wrapper](../classes/FW-Pagination-Wrapper.html)
55
+ * * [FW-Delete-Modal](../classes/FW-Delete-Modal.html)
56
+ *
57
+ * @module Components
58
+ * @submodule Main
59
+ * @main Main
60
+ */
61
+
62
+ /**
63
+ * Some components in this addon were designed to be used with the `cellComponent` value used in the table.
64
+ * For information on how `cellComponent` works, [click here](https://adopted-ember-addons.github.io/ember-light-table/docs/classes/Column.html#property_cellComponent).
65
+ *
66
+ * For each of these cell components, you call them in the following way:
67
+ * ```js
68
+ * column: [
69
+ * {
70
+ * label: 'Actions',
71
+ * cellComponent: 'fw-cell-action'
72
+ * }
73
+ * ]
74
+ * ```
75
+ *
76
+ * ***
77
+ *
78
+ * ### Classes
79
+ * * [FW-Cell-Action](../classes/FW-Cell-Action.html)
80
+ * * [FW-Cell-Boolean](../classes/FW-Cell-Boolean.html)
81
+ * * [FW-Cell-Nullable](../classes/FW-Cell-Nullable.html)
82
+ * * [FW-Cell-Permission-Icon](../classes/FW-Cell-Permission-Icon.html)
83
+ * * [FW-Row-Toggle](../classes/FW-Row-Toggle.html)
84
+ * * [FW-Row-Toggle-Index](../classes/FW-Row-Toggle-Index.html)
85
+ *
86
+ * @module Components
87
+ * @submodule Cell
88
+ * @main Cell
89
+ */
90
+
91
+ /**
92
+ * Utils is short for Utilities, and they are essentially whatever you need them to be. It is simply a way to import a function that does a certain task.
93
+ * In ember-fw-table, we have a few utils files that have been defined, and each has a couple different functions that are semi-related to each other. So each "class"
94
+ * within the utils module actually is simply a group of related functions exported that can be used after they are imported.
95
+ *
96
+ * @module Utils
97
+ * @main Utils
98
+ */
@@ -1,12 +1,7 @@
1
- {{fw-fullscreen-modal "confirm-choice"
2
- size="md"
3
- model=(hash
1
+ <FwFullscreenModal @modal="confirm-choice" @size="md" @model={{hash
4
2
  confirmButtonText="Delete"
5
3
  confirmButtonStyle="danger"
6
4
  confirmButtonIcon="fa-regular fa-trash-can"
7
5
  onconfirm=(action 'deleteModel')
8
6
  message=_message
9
- )
10
- close=close
11
- scrollTop=scrollTop
12
- }}
7
+ }} @close={{close}} @scrollTop={{scrollTop}} />
@@ -1,74 +1,45 @@
1
- {{!-- Search buttons, whole search component is in block --}}
2
- {{yield (hash
3
- search=(action 'search')
4
- export=(action 'export')
5
- ) false}}
6
-
7
- {{!-- Table contents, show loading spinner if in progress --}}
8
- <div class={{tableWrapperClass}}>
9
- {{#if searchingTable}}
10
- {{fw-loading-spinner}}
11
- {{else if pageEntries}}
12
- {{!-- Page numbers --}}
13
- {{#if (and showPages showPagesTop)}}
14
- <div class="text-center" style="overflow:auto">
15
- {{page-numbers
16
- content=(hash)
17
- showFL=true
18
- currentPage=page
19
- numPagesToShow=maxPageButtons
20
- totalPages=totalPages
21
- action=(action 'setPage')
22
- }}
23
- </div>
24
- {{/if}}
25
- {{!-- If we are searching a page, show its loading spinner --}}
26
- {{#if pagesSearching}}
27
- {{fw-loading-spinner}}
28
- {{else}}
29
- {{!-- If given a column getter, use that for columns --}}
30
- {{#if tableColumns}}
31
- {{fw-table-sortable
32
- filteredEntries
33
- tableColumns
34
- title=fullTableTitle
35
- class='sticky-table'
36
- defaultSort=(array tableSortKey defaultSortKey)
37
- responsive=true
38
- empty=emptyText
39
- hideEmpty=hideEmpty
40
- canExport=(if showExport 'Export Page' false)
41
- deleteTable=deletePage
42
- deleteTablePermission=deletePagePermission
43
- deleteOverrideTitle='Delete Page'
44
- onSort=(action 'sortColumn')
45
- tableActions=tableActions
46
- }}
47
- {{else}}
48
- {{!-- Let the user provide the table --}}
49
- {{yield (hash
50
- sort=(action 'sortColumn')
51
- ) (hash
52
- title=fullTableTitle
53
- suffix=tableSuffix
54
- entries=filteredEntries
55
- sortKey=tableSortKey
56
- )}}
57
- {{/if}}
58
-
59
- {{!-- Second page numbers --}}
60
- {{#if (and showPages showPagesBottom)}}
61
- <div class="text-center" style="overflow:auto">
62
- {{page-numbers
63
- content=(hash)
64
- showFL=true
65
- currentPage=page
66
- numPagesToShow=maxPageButtons
67
- totalPages=totalPages
68
- action=(action 'setPage')
69
- }}
70
- </div>
71
- {{/if}}
72
- {{/if}}
73
- {{/if}}
74
- </div>
1
+ {{!-- Search buttons, whole search component is in block --}}
2
+ {{yield (hash
3
+ search=(action 'search')
4
+ export=(action 'export')
5
+ ) false}}
6
+
7
+ {{!-- Table contents, show loading spinner if in progress --}}
8
+ <div class={{tableWrapperClass}}>
9
+ {{#if searchingTable}}
10
+ <FwLoadingSpinner />
11
+ {{else if pageEntries}}
12
+ {{!-- Page numbers --}}
13
+ {{#if (and showPages showPagesTop)}}
14
+ <div class="text-center" style="overflow:auto">
15
+ <PageNumbers @content={{hash }} @showFL={{true}} @currentPage={{page}} @numPagesToShow={{maxPageButtons}} @totalPages={{totalPages}} @action={{action "setPage"}} />
16
+ </div>
17
+ {{/if}}
18
+ {{!-- If we are searching a page, show its loading spinner --}}
19
+ {{#if pagesSearching}}
20
+ <FwLoadingSpinner />
21
+ {{else}}
22
+ {{!-- If given a column getter, use that for columns --}}
23
+ {{#if tableColumns}}
24
+ <FwTableSortable @data={{filteredEntries}} @columns={{tableColumns}} @title={{fullTableTitle}} @class="sticky-table" @defaultSort={{array tableSortKey defaultSortKey}} @responsive={{true}} @empty={{emptyText}} @hideEmpty={{hideEmpty}} @canExport={{if showExport "Export Page" false}} @deleteTable={{deletePage}} @deleteTablePermission={{deletePagePermission}} @deleteOverrideTitle="Delete Page" @onSort={{action "sortColumn"}} @tableActions={{tableActions}} />
25
+ {{else}}
26
+ {{!-- Let the user provide the table --}}
27
+ {{yield (hash
28
+ sort=(action 'sortColumn')
29
+ ) (hash
30
+ title=fullTableTitle
31
+ suffix=tableSuffix
32
+ entries=filteredEntries
33
+ sortKey=tableSortKey
34
+ )}}
35
+ {{/if}}
36
+
37
+ {{!-- Second page numbers --}}
38
+ {{#if (and showPages showPagesBottom)}}
39
+ <div class="text-center" style="overflow:auto">
40
+ <PageNumbers @content={{hash }} @showFL={{true}} @currentPage={{page}} @numPagesToShow={{maxPageButtons}} @totalPages={{totalPages}} @action={{action "setPage"}} />
41
+ </div>
42
+ {{/if}}
43
+ {{/if}}
44
+ {{/if}}
45
+ </div>
@@ -1,23 +1,23 @@
1
- {{!-- If column has a hideLabel set to true, just spit back the value of whatever the user gave it --}}
2
- {{#if column.hideLabel}}
3
- {{#if column.cellComponent}}
4
- {{!-- Pass in all the normal component values, but add an extra boolean so they know it is a hidden row --}}
5
- {{component column.cellComponent tableActions=tableActions table=table column=column row=row value=value rawValue=rawValue isExpandedRow=true}}
6
- {{else}}
7
- {{value}}
8
- {{/if}}
9
- {{else}}
10
- {{!-- Only print the cell if the column label is defined--}}
11
- {{#if column.label}}
12
- <dt class="{{column.classNames}}" title="{{column.label}}">{{column.label}}:</dt>
13
- <dd class="{{column.cellClassNames}}">
14
- {{!-- If the cell has a custom component, use that --}}
15
- {{#if column.cellComponent}}
16
- {{!-- Pass in all the normal component values, but add an extra boolean so they know it is a hidden row --}}
17
- {{component column.cellComponent tableActions=tableActions table=table column=column row=row value=value rawValue=rawValue isExpandedRow=true}}
18
- {{else}}
19
- {{value}}
20
- {{/if}}
21
- </dd>
22
- {{/if}}
23
- {{/if}}
1
+ {{!-- If column has a hideLabel set to true, just spit back the value of whatever the user gave it --}}
2
+ {{#if column.hideLabel}}
3
+ {{#if column.cellComponent}}
4
+ {{!-- Pass in all the normal component values, but add an extra boolean so they know it is a hidden row --}}
5
+ {{component column.cellComponent tableActions=tableActions table=table column=column row=row value=value rawValue=rawValue isExpandedRow=true}}
6
+ {{else}}
7
+ {{value}}
8
+ {{/if}}
9
+ {{else}}
10
+ {{!-- Only print the cell if the column label is defined--}}
11
+ {{#if column.label}}
12
+ <dt class="{{column.classNames}}" title="{{column.label}}">{{column.label}}:</dt>
13
+ <dd class="{{column.cellClassNames}}">
14
+ {{!-- If the cell has a custom component, use that --}}
15
+ {{#if column.cellComponent}}
16
+ {{!-- Pass in all the normal component values, but add an extra boolean so they know it is a hidden row --}}
17
+ {{component column.cellComponent tableActions=tableActions table=table column=column row=row value=value rawValue=rawValue isExpandedRow=true}}
18
+ {{else}}
19
+ {{value}}
20
+ {{/if}}
21
+ </dd>
22
+ {{/if}}
23
+ {{/if}}
@@ -1,7 +1,7 @@
1
1
  {{#if hasColumns}}
2
2
  <dl class="dl-horizontal">
3
3
  {{#each columns as |column|}}
4
- {{fw-table-expanded-row tableActions=tableActions table=table row=row column=column rawValue=(get row column.valuePath)}}
4
+ <FwTableExpandedRow @tableActions={{tableActions}} @table={{table}} @row={{row}} @column={{column}} @rawValue={{get row column.valuePath}} />
5
5
  {{/each}}
6
6
  </dl>
7
7
  {{/if}}
@@ -1,6 +1,6 @@
1
- {{#sortable-group tagName="ul" class="js-list-sort resort-list" onChange=(action "reorderItems") as |group|}}
1
+ <SortableGroup @tagName="ul" @class="js-list-sort resort-list" @onChange={{action "reorderItems"}} as |group|>
2
2
  {{#each sortedItems as |item|}}
3
- {{#sortable-item tagName="li" model=item group=group handle=".handle" spacing=spacing}}
3
+ <SortableItem @tagName="li" @model={{item}} @group={{group}} @handle=".handle" @spacing={{spacing}}>
4
4
  <div class="input-group">
5
5
  <span class="input-group-addon handle draggable">
6
6
  <i class="fa-solid fa-ellipsis-vertical fa-2"></i>
@@ -35,8 +35,8 @@
35
35
  <span class="input-group-addon"/>
36
36
  {{/if}}
37
37
  </div>
38
- {{/sortable-item}}
38
+ </SortableItem>
39
39
  {{else}}
40
40
  {{empty}}
41
41
  {{/each}}
42
- {{/sortable-group}}
42
+ </SortableGroup>
@@ -5,14 +5,7 @@
5
5
  {{else}}
6
6
  <strong class="panel-title">{{or title 'Table'}}</strong>
7
7
  {{#if (and deleteTable deleteTablePermission)}}
8
- {{fw-promise-button
9
- class="btn btn-xs pull-right"
10
- buttonIcon='fa-regular fa-trash-can'
11
- buttonText=deleteTitle
12
- buttonStyle='danger'
13
- promise=(action deleteTable data)
14
- type='submit'
15
- }}
8
+ <FwPromiseButton @class="btn btn-xs pull-right" @buttonIcon="fa-regular fa-trash-can" @buttonText={{deleteTitle}} @buttonStyle="danger" @promise={{action deleteTable data}} @type="submit" />
16
9
  {{/if}}
17
10
  {{#if canExport}}
18
11
  <button class="btn btn-xs btn-primary pull-right" {{action 'export'}}>
@@ -37,35 +30,20 @@
37
30
  breakpoints=breakpoints
38
31
  as |t|
39
32
  }}
40
- {{t.head
41
- onColumnClick=(action 'sort')
42
- iconAscending='fa-solid fa-sort-up'
43
- iconDescending='fa-solid fa-sort-down'
44
- iconSortable='fa-solid fa-sort'
45
- sortOnClick=false
46
- fixed=(if fixedHeight true false)
47
- }}
48
- {{#t.body
49
- canExpand=hasExpandedColumns
50
- onRowClick=(action 'expand')
51
- expandOnClick=false
52
- multiRowExpansion=false
53
- rowComponent=(component 'fw-expandable-row')
54
- canSelect=false
55
- as |body|
56
- }}
33
+ <t.head @onColumnClick={{action "sort"}} @iconAscending="fa-solid fa-sort-up" @iconDescending="fa-solid fa-sort-down" @iconSortable="fa-solid fa-sort" @sortOnClick={{false}} @fixed={{if fixedHeight true false}} @resizeOnDrag={{resizeOnDrag}} />
34
+ <t.body @canExpand={{hasExpandedColumns}} @onRowClick={{action "expand"}} @expandOnClick={{false}} @multiRowExpansion={{false}} @rowComponent={{component "fw-expandable-row"}} @canSelect={{false}} as |body|>
57
35
  {{#if table.hasExpandedColumns}}
58
- {{#body.expanded-row as |row|}}
59
- {{fw-table-expanded-rows tableActions=tableActions table=table row=row}}
60
- {{/body.expanded-row}}
36
+ <body.expanded-row as |row|>
37
+ <FwTableExpandedRows @tableActions={{tableActions}} @table={{table}} @row={{row}} />
38
+ </body.expanded-row>
61
39
  {{/if}}
62
40
 
63
41
  {{#if table.isEmpty}}
64
- {{#body.no-data}}
42
+ <body.no-data>
65
43
  {{empty}}
66
- {{/body.no-data}}
44
+ </body.no-data>
67
45
  {{/if}}
68
- {{/t.body}}
46
+ </t.body>
69
47
  {{/light-table}}
70
48
  {{/if}}
71
49
  </section>
@@ -1,40 +1,40 @@
1
- /**
2
- * DESCRIPTION NEEDED
3
- * @class BaseCells
4
- * @module Utils
5
- */
6
- /**
7
- * Creates a generic row toggle object
8
- * @param {Object} extra Additional values to add to the row toggle. Breakpoints is the most common one
9
- * @return {Object} Object to use as a row toggle column
10
- */
11
- export function rowToggle(extra = {}) {
12
- let {valuePath} = extra;
13
- return Object.assign({
14
- label: valuePath ? '#' : '',
15
- width: valuePath ? '40px' : '35px',
16
- align: valuePath ? 'toggle' : 'center',
17
- sortable: !!valuePath,
18
- canExport: false,
19
- showExpanded: false,
20
- cellComponent: valuePath ? 'fw-row-toggle-index' : 'fw-row-toggle'
21
- }, extra);
22
- }
23
-
24
- /**
25
- * Creates a generic action cell
26
- * @param {Object} extra Additional values to add to the action buttons. Small is useful to shrink it with breakpoints
27
- * @return {Object} Object to use as an actions button column
28
- */
29
- export function actions(extra = {}) {
30
- let {small} = extra;
31
- return Object.assign({
32
- label: 'Actions',
33
- // if small is set, shrink the width
34
- width: small ? '95px' : '170px',
35
- sortable: false,
36
- canExport: false,
37
- showExpanded: false,
38
- cellComponent: 'fw-cell-action'
39
- }, extra);
40
- }
1
+ /**
2
+ * DESCRIPTION NEEDED
3
+ * @class BaseCells
4
+ * @module Utils
5
+ */
6
+ /**
7
+ * Creates a generic row toggle object
8
+ * @param {Object} extra Additional values to add to the row toggle. Breakpoints is the most common one
9
+ * @return {Object} Object to use as a row toggle column
10
+ */
11
+ export function rowToggle(extra = {}) {
12
+ let {valuePath} = extra;
13
+ return Object.assign({
14
+ label: valuePath ? '#' : '',
15
+ width: valuePath ? '40px' : '35px',
16
+ align: valuePath ? 'toggle' : 'center',
17
+ sortable: !!valuePath,
18
+ canExport: false,
19
+ showExpanded: false,
20
+ cellComponent: valuePath ? 'fw-row-toggle-index' : 'fw-row-toggle'
21
+ }, extra);
22
+ }
23
+
24
+ /**
25
+ * Creates a generic action cell
26
+ * @param {Object} extra Additional values to add to the action buttons. Small is useful to shrink it with breakpoints
27
+ * @return {Object} Object to use as an actions button column
28
+ */
29
+ export function actions(extra = {}) {
30
+ let {small} = extra;
31
+ return Object.assign({
32
+ label: 'Actions',
33
+ // if small is set, shrink the width
34
+ width: small ? '95px' : '170px',
35
+ sortable: false,
36
+ canExport: false,
37
+ showExpanded: false,
38
+ cellComponent: 'fw-cell-action'
39
+ }, extra);
40
+ }