@kaspernj/api-maker 1.0.295 → 1.0.297
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.
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ class ApiMakerBootstrapSortLink extends PureComponent {
|
|
|
12
12
|
static propTypes = {
|
|
13
13
|
attribute: PropTypes.string.isRequired,
|
|
14
14
|
className: PropTypes.string,
|
|
15
|
+
defaultParams: PropTypes.object,
|
|
15
16
|
linkComponent: PropTypes.object,
|
|
16
17
|
onChanged: PropTypes.func,
|
|
17
18
|
query: PropTypes.object.isRequired,
|
|
@@ -51,7 +52,7 @@ class ApiMakerBootstrapSortLink extends PureComponent {
|
|
|
51
52
|
|
|
52
53
|
render () {
|
|
53
54
|
const LinkComponent = this.linkComponent()
|
|
54
|
-
const {attribute, className, linkComponent, onChanged, query, queryParams, title, ...restProps} = this.props
|
|
55
|
+
const {attribute, className, defaultParams, linkComponent, onChanged, query, queryParams, title, ...restProps} = this.props
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<>
|
|
@@ -83,10 +84,15 @@ class ApiMakerBootstrapSortLink extends PureComponent {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
qParams() {
|
|
87
|
+
const {defaultParams} = this.props
|
|
86
88
|
const {queryParams} = digs(this.props, "queryParams")
|
|
87
89
|
const {searchKey} = digs(this, "searchKey")
|
|
88
90
|
|
|
89
|
-
if (searchKey in queryParams)
|
|
91
|
+
if (searchKey in queryParams) {
|
|
92
|
+
return JSON.parse(queryParams[searchKey])
|
|
93
|
+
} else if (defaultParams) {
|
|
94
|
+
return {...defaultParams}
|
|
95
|
+
}
|
|
90
96
|
|
|
91
97
|
return {}
|
|
92
98
|
}
|
package/src/table/table.jsx
CHANGED
|
@@ -540,6 +540,7 @@ class ApiMakerTable extends React.PureComponent {
|
|
|
540
540
|
rowComponent = () => this.responsiveComponent("tr")
|
|
541
541
|
|
|
542
542
|
headersContentFromColumns () {
|
|
543
|
+
const {defaultParams} = this.props
|
|
543
544
|
const {preparedColumns, query} = digs(this.shape, "preparedColumns", "query")
|
|
544
545
|
const ColumnInHeadComponent = this.columnInHeadComponent()
|
|
545
546
|
|
|
@@ -551,7 +552,7 @@ class ApiMakerTable extends React.PureComponent {
|
|
|
551
552
|
{...this.columnProps(column)}
|
|
552
553
|
>
|
|
553
554
|
{tableSettingColumn.hasSortKey() && query &&
|
|
554
|
-
<SortLink attribute={tableSettingColumn.sortKey()} query={query} title={this.headerLabelForColumn(column)} />
|
|
555
|
+
<SortLink attribute={tableSettingColumn.sortKey()} defaultParams={defaultParams} query={query} title={this.headerLabelForColumn(column)} />
|
|
555
556
|
}
|
|
556
557
|
{(!tableSettingColumn.hasSortKey() || !query) &&
|
|
557
558
|
this.headerLabelForColumn(column)
|