@kaspernj/api-maker 1.0.439 → 1.0.440
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/table/table.jsx +8 -8
- package/src/use-input.mjs +1 -1
package/package.json
CHANGED
package/src/table/table.jsx
CHANGED
|
@@ -9,6 +9,7 @@ import debounce from "debounce"
|
|
|
9
9
|
import Filters from "./filters"
|
|
10
10
|
import FlatList from "./components/flat-list"
|
|
11
11
|
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
|
|
12
|
+
import {Form} from "../form"
|
|
12
13
|
import Header from "./components/header"
|
|
13
14
|
import HeaderColumn from "./header-column"
|
|
14
15
|
import HeaderSelect from "./header-select"
|
|
@@ -157,6 +158,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
157
158
|
columns: columnsAsArray,
|
|
158
159
|
currentWorkplace: undefined,
|
|
159
160
|
currentWorkplaceCount: null,
|
|
161
|
+
filterForm: null,
|
|
160
162
|
identifier: () => this.props.identifier || `${collectionKey}-default`,
|
|
161
163
|
lastUpdate: () => new Date(),
|
|
162
164
|
preload: undefined,
|
|
@@ -529,18 +531,20 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
529
531
|
filterForm = () => {
|
|
530
532
|
const {filterFormRef, submitFilter, submitFilterDebounce} = this.tt
|
|
531
533
|
const {filterContent, filterSubmitButton} = this.p
|
|
534
|
+
const {queryQName} = this.s
|
|
532
535
|
const {filterSubmitLabel} = this.props
|
|
533
536
|
const {qParams} = digs(this.collection, "qParams")
|
|
534
537
|
|
|
535
538
|
return (
|
|
536
|
-
<
|
|
539
|
+
<Form className="live-table--filter-form" formRef={filterFormRef} onSubmit={this.onFilterFormSubmit} setForm={this.setStates.filterForm}>
|
|
537
540
|
{"s" in qParams &&
|
|
538
541
|
<input name="s" type="hidden" value={qParams.s} />
|
|
539
542
|
}
|
|
540
543
|
{filterContent({
|
|
541
544
|
onFilterChanged: submitFilter,
|
|
542
545
|
onFilterChangedWithDelay: submitFilterDebounce,
|
|
543
|
-
qParams
|
|
546
|
+
qParams,
|
|
547
|
+
queryQName
|
|
544
548
|
})}
|
|
545
549
|
{filterSubmitButton &&
|
|
546
550
|
<input
|
|
@@ -550,7 +554,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
550
554
|
value={filterSubmitLabel || this.t(".filter", {defaultValue: "Filter"})}
|
|
551
555
|
/>
|
|
552
556
|
}
|
|
553
|
-
</
|
|
557
|
+
</Form>
|
|
554
558
|
)
|
|
555
559
|
}
|
|
556
560
|
|
|
@@ -843,11 +847,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
843
847
|
throw new Error("No 'label' or 'attribute' was given")
|
|
844
848
|
}
|
|
845
849
|
|
|
846
|
-
onFilterFormSubmit = (
|
|
847
|
-
e.preventDefault()
|
|
848
|
-
this.submitFilter()
|
|
849
|
-
}
|
|
850
|
-
|
|
850
|
+
onFilterFormSubmit = () => this.submitFilter()
|
|
851
851
|
onRequestCloseSettings = () => this.setState({showSettings: false})
|
|
852
852
|
|
|
853
853
|
onSettingsClicked = (e) => {
|
package/src/use-input.mjs
CHANGED
|
@@ -63,7 +63,7 @@ const useInput = ({props, wrapperOptions}) => {
|
|
|
63
63
|
const inputDefaultValue = useCallback(() => {
|
|
64
64
|
if ("defaultValue" in s.props) {
|
|
65
65
|
return formatValue(s.props.defaultValue)
|
|
66
|
-
} else if (s.props.model) {
|
|
66
|
+
} else if (s.props.model && s.props.attribute) {
|
|
67
67
|
if (!s.props.model[s.props.attribute]) {
|
|
68
68
|
throw new Error(`No such attribute defined on resource: ${digg(s.props.model.modelClassData(), "name")}#${s.props.attribute}`)
|
|
69
69
|
}
|