@kaspernj/api-maker 1.0.263 → 1.0.264

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.263",
19
+ "version": "1.0.264",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -75,6 +75,6 @@
75
75
  "eslint-plugin-react": "^7.23.2",
76
76
  "i18n-on-steroids": "^1.0.5",
77
77
  "jest": "^29.0.1",
78
- "jsdom": "^21.0.0"
78
+ "jsdom": "^22.0.0"
79
79
  }
80
80
  }
@@ -3,7 +3,7 @@ import SourceMapsLoader from "./source-maps-loader.mjs"
3
3
 
4
4
  export default class ErrorLogger {
5
5
  constructor () {
6
- this.debugging = true
6
+ this.debugging = false
7
7
  this.errorOccurred = false
8
8
  this.errors = []
9
9
  this.isHandlingError = false
@@ -18,7 +18,12 @@ export default class ErrorLogger {
18
18
  })
19
19
  }
20
20
 
21
+ debug(...output) {
22
+ if (this.debugging) console.error(`ApiMaker ErrorLogger:`, ...output)
23
+ }
24
+
21
25
  enable () {
26
+ this.debug("Enable called")
22
27
  this.connectOnError()
23
28
  this.connectUnhandledRejection()
24
29
  }
@@ -40,7 +45,8 @@ export default class ErrorLogger {
40
45
  }
41
46
 
42
47
  connectOnError () {
43
- globalThis.addEventListener("error", (event) => {
48
+ window.addEventListener("error", (event) => {
49
+ if (this.debugging) this.debug(`Error:`, event.message)
44
50
  this.errorOccurred = true
45
51
 
46
52
  if (!this.isHandlingError) {
@@ -53,7 +59,8 @@ export default class ErrorLogger {
53
59
  }
54
60
 
55
61
  connectUnhandledRejection () {
56
- globalThis.addEventListener("unhandledrejection", (event) => {
62
+ window.addEventListener("unhandledrejection", (event) => {
63
+ if (this.debugging) this.debug(`Unhandled rejection:`, event.reason.message)
57
64
  this.errorOccurred = true
58
65
 
59
66
  if (!this.isHandlingError) {
@@ -1,6 +1,6 @@
1
1
  @import "./variables";
2
2
 
3
- .component-api-maker-live-table {
3
+ .api-maker--table {
4
4
  .live-table-header {
5
5
  text-align: left;
6
6
  }
@@ -23,6 +23,7 @@ import uniqunize from "uniqunize"
23
23
  import withBreakpoint from "./with-breakpoint"
24
24
 
25
25
  const paginationOptions = [30, 60, 90, ["All", "all"]]
26
+ const WorkerPluginsCheckAllCheckbox = React.lazy(() => import("./worker-plugins-check-all-checkbox"))
26
27
 
27
28
  class ApiMakerTable extends React.PureComponent {
28
29
  static defaultProps = {
@@ -397,7 +398,7 @@ class ApiMakerTable extends React.PureComponent {
397
398
 
398
399
  tableContent () {
399
400
  const {breakPoint, workplace} = digs(this.props, "breakPoint", "workplace")
400
- const {models, preparedColumns} = digs(this.shape, "models", "preparedColumns")
401
+ const {currentWorkplace, models, preparedColumns, query} = digs(this.shape, "currentWorkplace", "models", "preparedColumns", "query")
401
402
  const ColumnInHeadComponent = this.columnInHeadComponent()
402
403
  const RowComponent = this.rowComponent()
403
404
 
@@ -415,8 +416,10 @@ class ApiMakerTable extends React.PureComponent {
415
416
  <>
416
417
  <HeadComponent>
417
418
  <RowComponent className="live-table-header-row">
418
- {workplace &&
419
- <ColumnInHeadComponent />
419
+ {workplace && currentWorkplace &&
420
+ <ColumnInHeadComponent>
421
+ <WorkerPluginsCheckAllCheckbox currentWorkplace={currentWorkplace} query={query} />
422
+ </ColumnInHeadComponent>
420
423
  }
421
424
  {this.headersContentFromColumns()}
422
425
  <ColumnInHeadComponent />
@@ -469,7 +472,7 @@ class ApiMakerTable extends React.PureComponent {
469
472
  }
470
473
 
471
474
  className() {
472
- const classNames = ["component-api-maker-live-table"]
475
+ const classNames = ["api-maker--table"]
473
476
 
474
477
  if (this.props.className)
475
478
  classNames.push(this.props.className)
@@ -0,0 +1,29 @@
1
+ import Collection from "../collection.mjs"
2
+
3
+ export default class ApiMakerTableWorkerPluginsCheckAllCheckbox extends BaseComponent {
4
+ static propTypes = PropTypesExact({
5
+ currentWorkplace: PropTypes.object,
6
+ query: PropTypes.instanceOf(Collection)
7
+ })
8
+
9
+ render() {
10
+ const {className} = this.props
11
+
12
+ return (
13
+ <input
14
+ className={classNames("api-maker--table--worker-plugins-check-all-checkbox", className)}
15
+ onChange={this.onCheckedChanged}
16
+ type="checkbox"
17
+ />
18
+ )
19
+ }
20
+
21
+ onCheckedChanged = async (e) => {
22
+ e.preventDefault()
23
+
24
+ const {currentWorkplace, query} = this.props
25
+
26
+ await currentWorkplace.addCollection({query})
27
+ e.target.checked = true
28
+ }
29
+ }