@kaspernj/api-maker 1.0.433 → 1.0.435
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 +2 -2
- package/src/base-component.jsx +1 -4
- package/src/bootstrap/attribute-row/index.jsx +2 -1
- package/src/bootstrap/attribute-rows.jsx +1 -1
- package/src/bootstrap/card.jsx +2 -1
- package/src/bootstrap/input.jsx +1 -1
- package/src/bootstrap/paginate.jsx +2 -1
- package/src/bootstrap/sort-link.jsx +40 -41
- package/src/collection-loader.jsx +2 -1
- package/src/event-created.jsx +1 -1
- package/src/event-destroyed.jsx +1 -1
- package/src/event-emitter-listener.jsx +1 -1
- package/src/event-listener.jsx +1 -1
- package/src/event-updated.jsx +4 -3
- package/src/form.jsx +2 -1
- package/src/inputs/attachment.jsx +1 -1
- package/src/inputs/checkbox.jsx +1 -1
- package/src/inputs/checkboxes.jsx +1 -1
- package/src/inputs/input.jsx +2 -1
- package/src/inputs/money.jsx +2 -1
- package/src/inputs/select.jsx +1 -1
- package/src/link.jsx +12 -7
- package/src/modal.jsx +1 -1
- package/src/resize-observer.jsx +1 -1
- package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +2 -1
- package/src/super-admin/edit-page/edit-attribute-content.jsx +1 -1
- package/src/super-admin/edit-page/edit-attribute-input.jsx +2 -1
- package/src/super-admin/edit-page/edit-attribute.jsx +1 -1
- package/src/super-admin/edit-page.jsx +1 -1
- package/src/super-admin/index-page.jsx +1 -1
- package/src/super-admin/index.jsx +2 -1
- package/src/super-admin/layout/header/index.jsx +2 -1
- package/src/super-admin/layout/index.jsx +2 -2
- package/src/super-admin/layout/menu/index.jsx +1 -1
- package/src/super-admin/layout/menu/menu-content.jsx +2 -1
- package/src/super-admin/layout/menu/menu-item/index.jsx +1 -1
- package/src/super-admin/layout/no-access.jsx +1 -1
- package/src/super-admin/model-class-table.jsx +2 -1
- package/src/super-admin/show-nav.jsx +1 -1
- package/src/super-admin/show-page/belongs-to-attribute-row.jsx +1 -1
- package/src/super-admin/show-page/index.jsx +2 -1
- package/src/super-admin/show-reflection-actions.jsx +2 -1
- package/src/super-admin/show-reflection-link.jsx +1 -1
- package/src/super-admin/show-reflection-page.jsx +1 -1
- package/src/table/components/column.jsx +1 -1
- package/src/table/components/flat-list.jsx +1 -1
- package/src/table/components/header.jsx +10 -2
- package/src/table/components/row.jsx +4 -2
- package/src/table/filters/attribute-element.jsx +1 -1
- package/src/table/filters/filter-form.jsx +2 -1
- package/src/table/filters/filter.jsx +1 -1
- package/src/table/filters/index.jsx +1 -1
- package/src/table/filters/load-search-modal.jsx +2 -1
- package/src/table/filters/reflection-element.jsx +1 -1
- package/src/table/filters/save-search-modal.jsx +1 -1
- package/src/table/filters/scope-element.jsx +1 -1
- package/src/table/header-column-content.jsx +54 -0
- package/src/table/header-column.jsx +25 -32
- package/src/table/header-select.jsx +72 -0
- package/src/table/model-column.jsx +14 -6
- package/src/table/model-row.jsx +2 -4
- package/src/table/settings/column-row.jsx +2 -1
- package/src/table/settings/download-action.jsx +1 -1
- package/src/table/settings/index.jsx +2 -1
- package/src/table/table.jsx +82 -42
- package/src/table/use-sorting.mjs +30 -0
- package/src/table/worker-plugins-check-all-checkbox.jsx +2 -1
- package/src/table/worker-plugins-checkbox.jsx +2 -1
- package/src/utils/card.jsx +49 -0
- package/src/utils/checkbox.jsx +1 -1
- package/src/utils/modal.jsx +59 -0
- package/src/with-can-can.jsx +1 -1
- package/src/with-collection.jsx +1 -1
- package/src/with-model.jsx +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
2
|
import {FlatList} from "react-native"
|
|
3
|
-
import
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
4
4
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
5
5
|
|
|
6
6
|
export default memo(shapeComponent(class SharedTagble extends BaseComponent {
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
|
-
import
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
3
4
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
4
5
|
import {View} from "react-native"
|
|
5
6
|
|
|
6
7
|
export default memo(shapeComponent(class SharedTableHeader extends BaseComponent {
|
|
7
8
|
render() {
|
|
9
|
+
const {dataSet, ...restProps} = this.props
|
|
10
|
+
const {component, ...restDataSet} = dataSet || {}
|
|
11
|
+
const actualDataSet = Object.assign(
|
|
12
|
+
{component: classNames("api-maker/table/header", component)},
|
|
13
|
+
restDataSet
|
|
14
|
+
)
|
|
15
|
+
|
|
8
16
|
return (
|
|
9
|
-
<View {...
|
|
17
|
+
<View dataSet={actualDataSet} {...restProps} />
|
|
10
18
|
)
|
|
11
19
|
}
|
|
12
20
|
}))
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
|
-
import
|
|
2
|
+
import memo from "set-state-compare/src/memo"
|
|
3
3
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
4
|
+
import useBreakpoint from "../../use-breakpoint"
|
|
4
5
|
import {View} from "react-native"
|
|
5
6
|
|
|
6
7
|
export default memo(shapeComponent(class SharedTableRow extends BaseComponent {
|
|
7
8
|
render() {
|
|
8
9
|
const {style, ...restProps} = this.props
|
|
10
|
+
const {name: breakpoint, smDown} = useBreakpoint()
|
|
9
11
|
const actualStyle = Object.assign(
|
|
10
12
|
{
|
|
11
|
-
flexDirection: "row"
|
|
13
|
+
flexDirection: breakpoint == "sm" || smDown ? "column" : "row"
|
|
12
14
|
},
|
|
13
15
|
style
|
|
14
16
|
)
|
|
@@ -2,7 +2,7 @@ import BaseComponent from "../../base-component"
|
|
|
2
2
|
import {digg} from "diggerize"
|
|
3
3
|
import PropTypes from "prop-types"
|
|
4
4
|
import PropTypesExact from "prop-types-exact"
|
|
5
|
-
import
|
|
5
|
+
import memo from "set-state-compare/src/memo"
|
|
6
6
|
import {Pressable} from "react-native"
|
|
7
7
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
8
|
import Text from "../../utils/text"
|
|
@@ -4,9 +4,10 @@ import {digg, digs} from "diggerize"
|
|
|
4
4
|
import * as inflection from "inflection"
|
|
5
5
|
import {Form} from "../../form"
|
|
6
6
|
import Input from "../../inputs/input"
|
|
7
|
+
import memo from "set-state-compare/src/memo"
|
|
7
8
|
import PropTypes from "prop-types"
|
|
8
9
|
import PropTypesExact from "prop-types-exact"
|
|
9
|
-
import {
|
|
10
|
+
import {useMemo, useRef} from "react"
|
|
10
11
|
import {ActivityIndicator, View} from "react-native"
|
|
11
12
|
import ReflectionElement from "./reflection-element"
|
|
12
13
|
import ScopeElement from "./scope-element"
|
|
@@ -3,7 +3,7 @@ import BaseComponent from "../../base-component"
|
|
|
3
3
|
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
|
|
4
4
|
import PropTypes from "prop-types"
|
|
5
5
|
import PropTypesExact from "prop-types-exact"
|
|
6
|
-
import
|
|
6
|
+
import memo from "set-state-compare/src/memo"
|
|
7
7
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
8
|
import Text from "../../utils/text"
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import FilterForm from "./filter-form"
|
|
|
5
5
|
import LoadSearchModal from "./load-search-modal"
|
|
6
6
|
import SaveSearchModal from "./save-search-modal"
|
|
7
7
|
import PropTypes from "prop-types"
|
|
8
|
-
import
|
|
8
|
+
import memo from "set-state-compare/src/memo"
|
|
9
9
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
10
10
|
import {TableSearch} from "../../models.mjs.erb"
|
|
11
11
|
import useI18n from "i18n-on-steroids/src/use-i18n.mjs"
|
|
@@ -2,7 +2,8 @@ import apiMakerConfig from "@kaspernj/api-maker/src/config.mjs"
|
|
|
2
2
|
import BaseComponent from "../../base-component"
|
|
3
3
|
import classNames from "classnames"
|
|
4
4
|
import {digg} from "diggerize"
|
|
5
|
-
import
|
|
5
|
+
import memo from "set-state-compare/src/memo"
|
|
6
|
+
import {useMemo} from "react"
|
|
6
7
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
7
8
|
import {TableSearch} from "../../models.mjs.erb"
|
|
8
9
|
import {Pressable, View} from "react-native"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
2
|
import PropTypes from "prop-types"
|
|
3
3
|
import PropTypesExact from "prop-types-exact"
|
|
4
|
-
import
|
|
4
|
+
import memo from "set-state-compare/src/memo"
|
|
5
5
|
import {Pressable} from "react-native"
|
|
6
6
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
7
7
|
import Text from "../../utils/text"
|
|
@@ -6,7 +6,7 @@ import {Form} from "../../form"
|
|
|
6
6
|
import Input from "../../bootstrap/input"
|
|
7
7
|
import modelClassRequire from "../../model-class-require.mjs"
|
|
8
8
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
9
|
-
import
|
|
9
|
+
import memo from "set-state-compare/src/memo"
|
|
10
10
|
import useI18n from "i18n-on-steroids/src/use-i18n.mjs"
|
|
11
11
|
|
|
12
12
|
const TableSearch = modelClassRequire("TableSearch")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
2
|
import PropTypes from "prop-types"
|
|
3
|
-
import
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
4
4
|
import {Pressable} from "react-native"
|
|
5
5
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
6
6
|
import Text from "../../utils/text"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import BaseComponent from "../base-component"
|
|
2
|
+
import {digs} from "diggerize"
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
4
|
+
import {View} from "react-native"
|
|
5
|
+
import PropTypes from "prop-types"
|
|
6
|
+
import propTypesExact from "prop-types-exact"
|
|
7
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
|
+
import SortLink from "../bootstrap/sort-link"
|
|
9
|
+
import Text from "../utils/text"
|
|
10
|
+
|
|
11
|
+
export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseComponent {
|
|
12
|
+
static propTypes = propTypesExact({
|
|
13
|
+
column: PropTypes.object.isRequired,
|
|
14
|
+
sortLinkProps: PropTypes.object,
|
|
15
|
+
table: PropTypes.object.isRequired,
|
|
16
|
+
tableSettingColumn: PropTypes.object.isRequired
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const {column, table, tableSettingColumn} = this.p
|
|
21
|
+
const {defaultParams} = table.props
|
|
22
|
+
const {styleForHeaderText} = table.tt
|
|
23
|
+
const {query} = digs(table.collection, "query")
|
|
24
|
+
const columnProps = table.columnProps(column)
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View
|
|
28
|
+
dataSet={{
|
|
29
|
+
component: "api-maker/table/header-column-content",
|
|
30
|
+
identifier: tableSettingColumn.identifier()
|
|
31
|
+
}}
|
|
32
|
+
style={{display: "flex", flexDirection: "row", alignItems: "center"}}
|
|
33
|
+
{...columnProps}
|
|
34
|
+
>
|
|
35
|
+
{tableSettingColumn.hasSortKey() && query &&
|
|
36
|
+
<SortLink
|
|
37
|
+
attribute={tableSettingColumn.sortKey()}
|
|
38
|
+
defaultParams={defaultParams}
|
|
39
|
+
query={query}
|
|
40
|
+
style={{whiteSpace: "nowrap", overflow: "hidden"}}
|
|
41
|
+
textProps={{ellipsizeMode: "clip", numberOfLines: 1, style: styleForHeaderText()}}
|
|
42
|
+
title={table.headerLabelForColumn(column)}
|
|
43
|
+
{...this.props.sortLinkProps}
|
|
44
|
+
/>
|
|
45
|
+
}
|
|
46
|
+
{(!tableSettingColumn.hasSortKey() || !query) &&
|
|
47
|
+
<Text ellipsizeMode="clip" numberOfLines={1}>
|
|
48
|
+
{table.headerLabelForColumn(column)}
|
|
49
|
+
</Text>
|
|
50
|
+
}
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}))
|
|
@@ -2,13 +2,15 @@ import BaseComponent from "../base-component"
|
|
|
2
2
|
import classNames from "classnames"
|
|
3
3
|
import {digs} from "diggerize"
|
|
4
4
|
import Header from "./components/header"
|
|
5
|
-
import
|
|
5
|
+
import HeaderColumnContent from "./header-column-content"
|
|
6
|
+
import memo from "set-state-compare/src/memo"
|
|
6
7
|
import {Platform, Pressable, View} from "react-native"
|
|
7
8
|
import PropTypes from "prop-types"
|
|
8
9
|
import propTypesExact from "prop-types-exact"
|
|
9
10
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
10
11
|
import SortLink from "../bootstrap/sort-link"
|
|
11
12
|
import Text from "../utils/text"
|
|
13
|
+
import useBreakpoint from "../use-breakpoint"
|
|
12
14
|
import useEventListener from "../use-event-listener.mjs"
|
|
13
15
|
import Widths from "./widths"
|
|
14
16
|
|
|
@@ -23,6 +25,10 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
|
|
|
23
25
|
})
|
|
24
26
|
|
|
25
27
|
setup() {
|
|
28
|
+
const {name: breakpoint, mdUp, smDown} = useBreakpoint()
|
|
29
|
+
|
|
30
|
+
this.setInstance({breakpoint, mdUp, smDown})
|
|
31
|
+
|
|
26
32
|
useEventListener(window, "mousemove", this.tt.onWindowMouseMove)
|
|
27
33
|
useEventListener(window, "mouseup", this.tt.onWindowMouseUp)
|
|
28
34
|
|
|
@@ -34,6 +40,7 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
|
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
render() {
|
|
43
|
+
const {breakpoint, mdUp, smDown} = this.tt
|
|
37
44
|
const {column, resizing, table, tableSettingColumn, width} = this.p
|
|
38
45
|
const {defaultParams} = table.props
|
|
39
46
|
const {styleForHeader, styleForHeaderText} = table.tt
|
|
@@ -43,7 +50,7 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
|
|
|
43
50
|
const actualStyle = Object.assign(
|
|
44
51
|
{
|
|
45
52
|
cursor: resizing ? "col-resize" : undefined,
|
|
46
|
-
width
|
|
53
|
+
width: mdUp ? width : "100%"
|
|
47
54
|
},
|
|
48
55
|
style
|
|
49
56
|
)
|
|
@@ -58,36 +65,22 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
|
|
|
58
65
|
style={styleForHeader({style: actualStyle})}
|
|
59
66
|
{...restColumnProps}
|
|
60
67
|
>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</View>
|
|
78
|
-
<Pressable
|
|
79
|
-
onMouseDown={Platform.OS == "web" ? this.tt.onResizeMouseDown : undefined}
|
|
80
|
-
onPressIn={this.tt.onResizePressIn}
|
|
81
|
-
style={{
|
|
82
|
-
position: "absolute",
|
|
83
|
-
top: 0,
|
|
84
|
-
right: 0,
|
|
85
|
-
width: 10,
|
|
86
|
-
height: "100%",
|
|
87
|
-
cursor: "col-resize",
|
|
88
|
-
zIndex: 9999
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
68
|
+
<HeaderColumnContent column={column} table={table} tableSettingColumn={tableSettingColumn} />
|
|
69
|
+
{mdUp &&
|
|
70
|
+
<Pressable
|
|
71
|
+
onMouseDown={Platform.OS == "web" ? this.tt.onResizeMouseDown : undefined}
|
|
72
|
+
onPressIn={this.tt.onResizePressIn}
|
|
73
|
+
style={{
|
|
74
|
+
position: "absolute",
|
|
75
|
+
top: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
width: 10,
|
|
78
|
+
height: "100%",
|
|
79
|
+
cursor: "col-resize",
|
|
80
|
+
zIndex: 9999
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
91
84
|
</Header>
|
|
92
85
|
)
|
|
93
86
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {Pressable, View} from "react-native"
|
|
2
|
+
import BaseComponent from "../base-component"
|
|
3
|
+
import Collection from "../collection"
|
|
4
|
+
import HeaderColumnContent from "./header-column-content"
|
|
5
|
+
import memo from "set-state-compare/src/memo"
|
|
6
|
+
import Modal from "../utils/modal"
|
|
7
|
+
import PropTypes from "prop-types"
|
|
8
|
+
import propTypesExact from "prop-types-exact"
|
|
9
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
10
|
+
import Text from "../utils/text"
|
|
11
|
+
import useI18n from "i18n-on-steroids/src/use-i18n.mjs"
|
|
12
|
+
import useSorting from "./use-sorting"
|
|
13
|
+
|
|
14
|
+
export default memo(shapeComponent(class ApiMakerTableHeaderSelect extends BaseComponent {
|
|
15
|
+
static propTypes = propTypesExact({
|
|
16
|
+
preparedColumns: PropTypes.array.isRequired,
|
|
17
|
+
query: PropTypes.instanceOf(Collection).isRequired,
|
|
18
|
+
table: PropTypes.object
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
setup() {
|
|
22
|
+
const {t} = useI18n({namespace: "js.api_maker.table.header_select"})
|
|
23
|
+
const {preparedColumns, query} = this.p
|
|
24
|
+
const {qParams, searchKey, sortAttribute, sortMode} = useSorting({query})
|
|
25
|
+
|
|
26
|
+
this.useStates({
|
|
27
|
+
modalOpen: false
|
|
28
|
+
})
|
|
29
|
+
this.setInstance({qParams, searchKey, sortAttribute, sortMode, t})
|
|
30
|
+
this.sortedByPreparedColumn = preparedColumns.find((preparedColumn) => preparedColumn.tableSettingColumn.sortKey() == sortAttribute)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
const {sortedByPreparedColumn, sortMode, t} = this.tt
|
|
35
|
+
const {table} = this.p
|
|
36
|
+
const column = sortedByPreparedColumn?.column
|
|
37
|
+
const columnLabel = column && table.headerLabelForColumn(column)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View dataSet={{component: "api-maker/table/header-select"}}>
|
|
41
|
+
{this.s.modalOpen &&
|
|
42
|
+
<Modal dataSet={{class: "table-header-select-modal"}} onRequestClose={this.tt.onModalRequestClose} transparent>
|
|
43
|
+
{this.p.preparedColumns.map(({column, tableSettingColumn}) =>
|
|
44
|
+
<View
|
|
45
|
+
key={tableSettingColumn.identifier()}
|
|
46
|
+
style={{marginVertical: 5}}
|
|
47
|
+
>
|
|
48
|
+
<HeaderColumnContent column={column} table={table} tableSettingColumn={tableSettingColumn} sortLinkProps={{usePressable: true}} />
|
|
49
|
+
</View>
|
|
50
|
+
)}
|
|
51
|
+
</Modal>
|
|
52
|
+
}
|
|
53
|
+
<Pressable onPress={this.tt.onSortedByPress}>
|
|
54
|
+
<Text>
|
|
55
|
+
{sortedByPreparedColumn && sortMode == "asc" &&
|
|
56
|
+
t(".sorted_by_column", {column: columnLabel, defaultValue: "Sorted by %{column}"})
|
|
57
|
+
}
|
|
58
|
+
{sortedByPreparedColumn && sortMode == "desc" &&
|
|
59
|
+
t(".sorted_by_column_reversed", {column: columnLabel, defaultValue: "Sorted by %{column} reversed"})
|
|
60
|
+
}
|
|
61
|
+
{!sortedByPreparedColumn &&
|
|
62
|
+
t(".not_sorted", {defaultValue: "Not sorted"})
|
|
63
|
+
}
|
|
64
|
+
</Text>
|
|
65
|
+
</Pressable>
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onModalRequestClose = () => this.setState({modalOpen: false})
|
|
71
|
+
onSortedByPress = () => this.setState({modalOpen: true})
|
|
72
|
+
}))
|
|
@@ -6,16 +6,16 @@ import ColumnContent from "./column-content"
|
|
|
6
6
|
import columnIdentifier from "./column-identifier.mjs"
|
|
7
7
|
import PropTypes from "prop-types"
|
|
8
8
|
import propTypesExact from "prop-types-exact"
|
|
9
|
-
import
|
|
9
|
+
import memo from "set-state-compare/src/memo"
|
|
10
10
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
11
11
|
import Text from "../utils/text"
|
|
12
|
+
import useBreakpoint from "../use-breakpoint"
|
|
12
13
|
|
|
13
14
|
export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseComponent {
|
|
14
15
|
static propTypes = propTypesExact({
|
|
15
16
|
column: PropTypes.object.isRequired,
|
|
16
17
|
columnIndex: PropTypes.number.isRequired,
|
|
17
18
|
even: PropTypes.bool.isRequired,
|
|
18
|
-
isSmallScreen: PropTypes.bool.isRequired,
|
|
19
19
|
model: PropTypes.object.isRequired,
|
|
20
20
|
table: PropTypes.object.isRequired,
|
|
21
21
|
tableSettingColumn: PropTypes.object.isRequired,
|
|
@@ -23,11 +23,19 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
render() {
|
|
26
|
-
const {
|
|
26
|
+
const {mdUp} = useBreakpoint()
|
|
27
|
+
const {column, columnIndex, even, model, table, width} = this.props
|
|
27
28
|
const columnProps = table.columnProps(column)
|
|
28
29
|
const {style, ...restColumnProps} = columnProps
|
|
29
30
|
const actualStyle = Object.assign(
|
|
30
|
-
table.styleForColumn({
|
|
31
|
+
table.styleForColumn({
|
|
32
|
+
column,
|
|
33
|
+
columnIndex,
|
|
34
|
+
even,
|
|
35
|
+
style: {
|
|
36
|
+
width: mdUp ? width : "100%"
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
31
39
|
style
|
|
32
40
|
)
|
|
33
41
|
|
|
@@ -40,9 +48,9 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
|
|
|
40
48
|
style={actualStyle}
|
|
41
49
|
{...restColumnProps}
|
|
42
50
|
>
|
|
43
|
-
{
|
|
51
|
+
{!mdUp &&
|
|
44
52
|
<View dataSet={{class: "table--column-label"}}>
|
|
45
|
-
<Text>
|
|
53
|
+
<Text style={{fontWeight: "bold"}}>
|
|
46
54
|
{table.headerLabelForColumn(column)}
|
|
47
55
|
</Text>
|
|
48
56
|
</View>
|
package/src/table/model-row.jsx
CHANGED
|
@@ -11,7 +11,7 @@ import ModelColumn from "./model-column"
|
|
|
11
11
|
import PropTypes from "prop-types"
|
|
12
12
|
import propTypesExact from "prop-types-exact"
|
|
13
13
|
import Row from "./components/row"
|
|
14
|
-
import
|
|
14
|
+
import memo from "set-state-compare/src/memo"
|
|
15
15
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
16
16
|
|
|
17
17
|
const WorkerPluginsCheckbox = React.lazy(() => import("./worker-plugins-checkbox"))
|
|
@@ -21,7 +21,6 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
|
|
|
21
21
|
cacheKey: PropTypes.string.isRequired,
|
|
22
22
|
columnWidths: PropTypes.object.isRequired,
|
|
23
23
|
index: PropTypes.number.isRequired,
|
|
24
|
-
isSmallScreen: PropTypes.bool.isRequired,
|
|
25
24
|
model: PropTypes.object.isRequired,
|
|
26
25
|
table: PropTypes.object.isRequired,
|
|
27
26
|
preparedColumns: PropTypes.array,
|
|
@@ -86,14 +85,13 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
columnsContentFromColumns(model, even) {
|
|
89
|
-
const {
|
|
88
|
+
const {table, preparedColumns} = this.p
|
|
90
89
|
|
|
91
90
|
return preparedColumns?.map(({column, tableSettingColumn, width}, columnIndex) => columnVisible(column, tableSettingColumn) &&
|
|
92
91
|
<ModelColumn
|
|
93
92
|
column={column}
|
|
94
93
|
columnIndex={columnIndex}
|
|
95
94
|
even={even}
|
|
96
|
-
isSmallScreen={isSmallScreen}
|
|
97
95
|
key={columnIdentifier(column)}
|
|
98
96
|
model={model}
|
|
99
97
|
table={table}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
2
|
import columnIdentifier from "../column-identifier.mjs"
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
3
4
|
import PropTypes from "prop-types"
|
|
4
5
|
import propTypesExact from "prop-types-exact"
|
|
5
|
-
import {
|
|
6
|
+
import {useEffect, useRef} from "react"
|
|
6
7
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
7
8
|
import Text from "../../utils/text"
|
|
8
9
|
import {View} from "react-native"
|
|
@@ -4,7 +4,7 @@ import columnIdentifier from "../column-identifier.mjs"
|
|
|
4
4
|
import columnVisible from "../column-visible.mjs"
|
|
5
5
|
import {saveAs} from "file-saver"
|
|
6
6
|
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
|
|
7
|
-
import
|
|
7
|
+
import memo from "set-state-compare/src/memo"
|
|
8
8
|
import PropTypes from "prop-types"
|
|
9
9
|
import propTypesExact from "prop-types-exact"
|
|
10
10
|
import {renderToString} from "react-dom/server"
|
|
@@ -2,7 +2,8 @@ import BaseComponent from "../../base-component"
|
|
|
2
2
|
import columnIdentifier from "../column-identifier.mjs"
|
|
3
3
|
import ColumnRow from "./column-row"
|
|
4
4
|
import DownloadAction from "./download-action"
|
|
5
|
-
import {
|
|
5
|
+
import {useRef} from "react"
|
|
6
|
+
import memo from "set-state-compare/src/memo"
|
|
6
7
|
import Modal from "../../modal"
|
|
7
8
|
import PropTypes from "prop-types"
|
|
8
9
|
import propTypesExact from "prop-types-exact"
|