@kaspernj/api-maker 1.0.437 → 1.0.439
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/header-column.jsx +5 -10
- package/src/table/table.jsx +23 -2
- package/src/table/use-sorting.mjs +6 -1
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import BaseComponent from "../base-component"
|
|
2
2
|
import classNames from "classnames"
|
|
3
|
-
import {digs} from "diggerize"
|
|
4
3
|
import Header from "./components/header"
|
|
5
4
|
import HeaderColumnContent from "./header-column-content"
|
|
6
5
|
import memo from "set-state-compare/src/memo"
|
|
7
|
-
import {Platform, Pressable
|
|
6
|
+
import {Platform, Pressable} from "react-native"
|
|
8
7
|
import PropTypes from "prop-types"
|
|
9
8
|
import propTypesExact from "prop-types-exact"
|
|
10
9
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
11
|
-
import SortLink from "../bootstrap/sort-link"
|
|
12
|
-
import Text from "../utils/text"
|
|
13
10
|
import useBreakpoint from "../use-breakpoint"
|
|
14
11
|
import useEventListener from "../use-event-listener.mjs"
|
|
15
12
|
import Widths from "./widths"
|
|
@@ -40,13 +37,11 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
|
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
render() {
|
|
43
|
-
const {
|
|
40
|
+
const {mdUp} = this.tt
|
|
44
41
|
const {column, resizing, table, tableSettingColumn, width} = this.p
|
|
45
|
-
const {
|
|
46
|
-
const
|
|
47
|
-
const {
|
|
48
|
-
const columnProps = table.columnProps(column)
|
|
49
|
-
const {style, ...restColumnProps} = columnProps
|
|
42
|
+
const {styleForHeader} = table.tt
|
|
43
|
+
const headerProps = table.headerProps(column)
|
|
44
|
+
const {style, ...restColumnProps} = headerProps
|
|
50
45
|
const actualStyle = Object.assign(
|
|
51
46
|
{
|
|
52
47
|
cursor: resizing ? "col-resize" : undefined,
|
package/src/table/table.jsx
CHANGED
|
@@ -633,16 +633,21 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
styleForHeader = ({column, columnIndex, style, type}) => {
|
|
636
|
+
const {mdUp} = this.tt
|
|
636
637
|
const defaultStyle = {
|
|
637
638
|
flexDirection: "row",
|
|
638
639
|
alignItems: "center",
|
|
639
640
|
padding: 8
|
|
640
641
|
}
|
|
641
642
|
|
|
642
|
-
if (type != "actions" &&
|
|
643
|
+
if (type != "actions" && mdUp && this.p.styleUI) {
|
|
643
644
|
defaultStyle.borderRight = "1px solid #dbdbdb"
|
|
644
645
|
}
|
|
645
646
|
|
|
647
|
+
if (mdUp) {
|
|
648
|
+
|
|
649
|
+
}
|
|
650
|
+
|
|
646
651
|
const actualStyle = Object.assign(
|
|
647
652
|
defaultStyle,
|
|
648
653
|
style
|
|
@@ -763,6 +768,22 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
763
768
|
return props
|
|
764
769
|
}
|
|
765
770
|
|
|
771
|
+
headerProps(column) {
|
|
772
|
+
const props = {}
|
|
773
|
+
|
|
774
|
+
if (column.textCenter) {
|
|
775
|
+
props.style ||= {}
|
|
776
|
+
props.style.justifyContent = "center"
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
if (column.textRight) {
|
|
780
|
+
props.style ||= {}
|
|
781
|
+
props.style.justifyContent = "end"
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return props
|
|
785
|
+
}
|
|
786
|
+
|
|
766
787
|
columnWidths() {
|
|
767
788
|
const columnWidths = {}
|
|
768
789
|
|
|
@@ -786,7 +807,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
786
807
|
)
|
|
787
808
|
|
|
788
809
|
headerClassNameForColumn(column) {
|
|
789
|
-
const classNames = [
|
|
810
|
+
const classNames = []
|
|
790
811
|
|
|
791
812
|
if (column.commonProps && column.commonProps.className) classNames.push(column.commonProps.className)
|
|
792
813
|
if (column.headerProps && column.headerProps.className) classNames.push(column.headerProps.className)
|
|
@@ -15,7 +15,12 @@ const useSorting = ({defaultParams, query}) => {
|
|
|
15
15
|
const queryParams = useQueryParams()
|
|
16
16
|
const searchKey = query.queryArgs.searchKey || "q"
|
|
17
17
|
const qParams = calculateQParams(defaultParams, queryParams, searchKey)
|
|
18
|
-
|
|
18
|
+
let matchSortParam
|
|
19
|
+
|
|
20
|
+
if (typeof qParams.s == "string") {
|
|
21
|
+
matchSortParam = qParams.s?.match(/^(.+?)( asc| desc|)$/)
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
const sortAttribute = matchSortParam ? camelize(matchSortParam[1], true) : null
|
|
20
25
|
const sortMode = matchSortParam ? matchSortParam[2].trim() : null
|
|
21
26
|
|