@kaspernj/api-maker 1.0.295 → 1.0.296

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
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.295",
19
+ "version": "1.0.296",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -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) return JSON.parse(queryParams[searchKey])
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
  }
@@ -195,6 +195,9 @@ class ApiMakerTable extends React.PureComponent {
195
195
 
196
196
  return (
197
197
  <div className={this.className()}>
198
+ <div>
199
+ queryQName: {this.shape.queryQName}
200
+ </div>
198
201
  {preload !== undefined &&
199
202
  <CollectionLoader
200
203
  abilities={this.abilitiesToLoad()}
@@ -540,6 +543,7 @@ class ApiMakerTable extends React.PureComponent {
540
543
  rowComponent = () => this.responsiveComponent("tr")
541
544
 
542
545
  headersContentFromColumns () {
546
+ const {defaultParams} = this.props
543
547
  const {preparedColumns, query} = digs(this.shape, "preparedColumns", "query")
544
548
  const ColumnInHeadComponent = this.columnInHeadComponent()
545
549
 
@@ -551,7 +555,7 @@ class ApiMakerTable extends React.PureComponent {
551
555
  {...this.columnProps(column)}
552
556
  >
553
557
  {tableSettingColumn.hasSortKey() && query &&
554
- <SortLink attribute={tableSettingColumn.sortKey()} query={query} title={this.headerLabelForColumn(column)} />
558
+ <SortLink attribute={tableSettingColumn.sortKey()} defaultParams={defaultParams} query={query} title={this.headerLabelForColumn(column)} />
555
559
  }
556
560
  {(!tableSettingColumn.hasSortKey() || !query) &&
557
561
  this.headerLabelForColumn(column)