@kaspernj/api-maker 1.0.381 → 1.0.383
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 +1 -1
- package/src/base-model.mjs +56 -63
- package/src/bootstrap/paginate.jsx +3 -3
- package/src/collection-loader.jsx +2 -2
- package/src/super-admin/edit-page.jsx +3 -3
- package/src/super-admin/index.jsx +1 -2
- package/src/super-admin/layout/index.jsx +2 -2
- package/src/table/filters/attribute-element.jsx +5 -4
- package/src/table/filters/filter.jsx +7 -6
- package/src/table/filters/load-search-modal.jsx +6 -5
- package/src/table/filters/reflection-element.jsx +5 -4
- package/src/table/filters/save-search-modal.jsx +5 -4
- package/src/table/filters/scope-element.jsx +6 -4
- package/src/table/header-column.jsx +25 -8
- package/src/table/model-row.jsx +12 -6
- package/src/table/settings/column-row.jsx +88 -0
- package/src/table/settings/index.jsx +48 -96
- package/src/table/style.scss +4 -2
- package/src/table/table.jsx +17 -7
- package/src/table/use-breakpoint.mjs +2 -2
- package/src/table/worker-plugins-checkbox.jsx +2 -2
- package/src/use-can-can.mjs +3 -3
- package/src/use-collection.mjs +14 -17
- package/src/use-created-event.mjs +2 -2
- package/src/use-current-user.mjs +2 -2
- package/src/use-destroyed-event.mjs +2 -2
- package/src/use-event-emitter.mjs +2 -2
- package/src/use-event-listener.mjs +2 -2
- package/src/use-model.mjs +6 -6
- package/src/use-resize-observer.mjs +1 -1
- package/src/use-updated-event.mjs +2 -2
- package/src/utils/checkbox.jsx +33 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
3
|
import ModelEvents from "./model-events.mjs"
|
|
4
4
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
@@ -34,7 +34,7 @@ const apiMakerUseDestroyedEvent = (model, onDestroyed, props) => {
|
|
|
34
34
|
}
|
|
35
35
|
}, [])
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
useMemo(() => {
|
|
38
38
|
let connectDestroyed, onConnectedListener
|
|
39
39
|
|
|
40
40
|
if (model) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useMemo} from "react"
|
|
2
2
|
|
|
3
3
|
const ApiMakerUseEventListener = (target, event, onCalled) => {
|
|
4
4
|
const onCalledCallback = useCallback((...args) => {
|
|
5
5
|
onCalled.apply(null, args)
|
|
6
6
|
}, [target, event, onCalled])
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
useMemo(() => {
|
|
9
9
|
if (target) {
|
|
10
10
|
target.addEventListener(event, onCalledCallback)
|
|
11
11
|
|
package/src/use-model.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useMemo, useState} from "react"
|
|
2
2
|
import Devise from "./devise.mjs"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
4
|
import ModelEvents from "./model-events.mjs"
|
|
@@ -90,12 +90,12 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
90
90
|
}
|
|
91
91
|
}, [])
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
useMemo(
|
|
94
94
|
() => { loadModel() },
|
|
95
95
|
cacheArgs
|
|
96
96
|
)
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
useMemo(() => {
|
|
99
99
|
let reloadModelCallback
|
|
100
100
|
|
|
101
101
|
if (args.events) {
|
|
@@ -109,7 +109,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
109
109
|
}
|
|
110
110
|
}, [args.events])
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
useMemo(() => {
|
|
113
113
|
let connectUpdated
|
|
114
114
|
|
|
115
115
|
if (model && args.eventUpdated) {
|
|
@@ -129,7 +129,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
129
129
|
loadModel()
|
|
130
130
|
}, [])
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
useMemo(() => {
|
|
133
133
|
Devise.events().addListener("onDeviseSignIn", onSignedIn)
|
|
134
134
|
Devise.events().addListener("onDeviseSignOut", onSignedOut)
|
|
135
135
|
|
|
@@ -147,7 +147,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
147
147
|
s.p.onDestroyed(forwardArgs)
|
|
148
148
|
}, [])
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
useMemo(() => {
|
|
151
151
|
let connectDestroyed
|
|
152
152
|
|
|
153
153
|
if (model && args.onDestroyed) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
3
|
import ModelEvents from "./model-events.mjs"
|
|
4
4
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
@@ -32,7 +32,7 @@ const apiMakerUseUpdatedEvent = (model, onUpdated, {active = true, debounce, onC
|
|
|
32
32
|
}
|
|
33
33
|
}, [])
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
useMemo(() => {
|
|
36
36
|
let connectUpdated, onConnectedListener
|
|
37
37
|
|
|
38
38
|
if (model) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseComponent from "../base-component"
|
|
2
|
+
import {CheckBox, Text, View} from "react-native"
|
|
3
|
+
import {memo} from "react"
|
|
4
|
+
import PropTypes from "prop-types"
|
|
5
|
+
import propTypesExact from "prop-types-exact"
|
|
6
|
+
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
7
|
+
|
|
8
|
+
export default memo(shapeComponent(class ApiMakerUtilsCheckbox extends BaseComponent {
|
|
9
|
+
static defaultProps = {
|
|
10
|
+
label: undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static propTypes = propTypesExact({
|
|
14
|
+
checked: PropTypes.bool.isRequired,
|
|
15
|
+
label: PropTypes.string,
|
|
16
|
+
onValueChange: PropTypes.func.isRequired
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const {checked, label, onValueChange} = this.p
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View dataSet={{component: "api-maker--utils--checkbox"}} style={{flexDirection: "row", alignItems: "center"}}>
|
|
24
|
+
<CheckBox onValueChange={onValueChange} value={checked} />
|
|
25
|
+
{label &&
|
|
26
|
+
<Text style={{marginLeft: 3}}>
|
|
27
|
+
{label}
|
|
28
|
+
</Text>
|
|
29
|
+
}
|
|
30
|
+
</View>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}))
|