@synerise/ds-column-manager 1.2.47 → 1.2.49
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/CHANGELOG.md +8 -0
- package/dist/ColumnManager.d.ts +2 -2
- package/dist/ColumnManager.js +59 -101
- package/dist/ColumnManager.styles.d.ts +4 -4
- package/dist/ColumnManager.styles.js +12 -7
- package/dist/ColumnManager.types.d.ts +1 -1
- package/dist/ColumnManager.types.js +1 -1
- package/dist/ColumnManagerActions/ColumnManagerActions.d.ts +2 -2
- package/dist/ColumnManagerActions/ColumnManagerActions.js +16 -19
- package/dist/ColumnManagerActions/ColumnManagerActions.styles.d.ts +2 -2
- package/dist/ColumnManagerActions/ColumnManagerActions.styles.js +9 -7
- package/dist/ColumnManagerActions/ColumnManagerActions.types.d.ts +1 -1
- package/dist/ColumnManagerActions/ColumnManagerActions.types.js +1 -1
- package/dist/ColumnManagerItem/ColumManagerItem.types.d.ts +2 -2
- package/dist/ColumnManagerItem/ColumManagerItem.types.js +1 -1
- package/dist/ColumnManagerItem/ColumnManagerItem.const.js +16 -11
- package/dist/ColumnManagerItem/ColumnManagerItem.d.ts +3 -3
- package/dist/ColumnManagerItem/ColumnManagerItem.js +41 -57
- package/dist/ColumnManagerItem/ColumnManagerItem.styles.d.ts +7 -7
- package/dist/ColumnManagerItem/ColumnManagerItem.styles.js +23 -33
- package/dist/ColumnManagerList/ColumnManager.style.d.ts +4 -4
- package/dist/ColumnManagerList/ColumnManager.style.js +12 -19
- package/dist/ColumnManagerList/ColumnManagerList.d.ts +3 -3
- package/dist/ColumnManagerList/ColumnManagerList.js +57 -84
- package/dist/ColumnManagerList/ColumnManagerList.types.d.ts +2 -2
- package/dist/ColumnManagerList/ColumnManagerList.types.js +1 -1
- package/dist/ColumnManagerSortableItem/ColumnManagerSortableItem.d.ts +3 -3
- package/dist/ColumnManagerSortableItem/ColumnManagerSortableItem.js +35 -34
- package/dist/ColumnManagerSortableItem/ColumnManagerSortableItem.types.d.ts +3 -3
- package/dist/ColumnManagerSortableItem/ColumnManagerSortableItem.types.js +1 -1
- package/dist/hooks/useTranslations.d.ts +1 -1
- package/dist/hooks/useTranslations.js +29 -26
- package/dist/index.js +4 -2
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/matchesSearchQuery.js +5 -2
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.49](https://github.com/Synerise/synerise-design/compare/@synerise/ds-column-manager@1.2.48...@synerise/ds-column-manager@1.2.49) (2026-04-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-column-manager
|
|
9
|
+
|
|
10
|
+
## [1.2.48](https://github.com/Synerise/synerise-design/compare/@synerise/ds-column-manager@1.2.47...@synerise/ds-column-manager@1.2.48) (2026-03-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-column-manager
|
|
13
|
+
|
|
6
14
|
## [1.2.47](https://github.com/Synerise/synerise-design/compare/@synerise/ds-column-manager@1.2.46...@synerise/ds-column-manager@1.2.47) (2026-03-20)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-column-manager
|
package/dist/ColumnManager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Column, ColumnManagerProps } from './ColumnManager.types';
|
|
3
3
|
declare const ColumnManager: <ColumnType extends Column>({ columns, texts: customTexts, onApply, visible, hide, draggable, }: ColumnManagerProps<ColumnType>) => React.JSX.Element;
|
|
4
4
|
export default ColumnManager;
|
package/dist/ColumnManager.js
CHANGED
|
@@ -1,118 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import Button from
|
|
4
|
-
import { useTheme } from
|
|
5
|
-
import Drawer from
|
|
6
|
-
import Icon, { CloseM, SearchM } from
|
|
7
|
-
import { Title } from
|
|
8
|
-
import
|
|
9
|
-
import { ColumnManagerActions } from
|
|
10
|
-
import ColumnManagerList from
|
|
11
|
-
import { useTranslations } from
|
|
12
|
-
import { matchesSearchQuery } from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setCurrentColumns = _useState2[1];
|
|
27
|
-
var texts = useTranslations(customTexts);
|
|
28
|
-
var theme = useTheme();
|
|
29
|
-
useEffect(function () {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useMemo } from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import { useTheme } from "@synerise/ds-core";
|
|
5
|
+
import Drawer from "@synerise/ds-drawer";
|
|
6
|
+
import Icon, { CloseM, SearchM } from "@synerise/ds-icon";
|
|
7
|
+
import { Title } from "@synerise/ds-typography";
|
|
8
|
+
import { ColumnManager as ColumnManager$1, SearchBar, ColumnManagerListWrapper } from "./ColumnManager.styles.js";
|
|
9
|
+
import { ColumnManagerActions } from "./ColumnManagerActions/ColumnManagerActions.js";
|
|
10
|
+
import ColumnManagerList from "./ColumnManagerList/ColumnManagerList.js";
|
|
11
|
+
import { useTranslations } from "./hooks/useTranslations.js";
|
|
12
|
+
import { matchesSearchQuery } from "./utils/matchesSearchQuery.js";
|
|
13
|
+
const ColumnManager = ({
|
|
14
|
+
columns,
|
|
15
|
+
texts: customTexts,
|
|
16
|
+
onApply,
|
|
17
|
+
visible,
|
|
18
|
+
hide,
|
|
19
|
+
draggable = true
|
|
20
|
+
}) => {
|
|
21
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
22
|
+
const [currentColumns, setCurrentColumns] = useState(columns);
|
|
23
|
+
const texts = useTranslations(customTexts);
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
useEffect(() => {
|
|
30
26
|
setCurrentColumns(columns);
|
|
31
27
|
}, [columns]);
|
|
32
|
-
useEffect(
|
|
28
|
+
useEffect(() => {
|
|
33
29
|
if (!visible) {
|
|
34
30
|
setCurrentColumns(columns);
|
|
35
31
|
}
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
32
|
}, [visible]);
|
|
38
|
-
|
|
33
|
+
const handleApply = () => {
|
|
39
34
|
onApply(currentColumns);
|
|
40
35
|
};
|
|
41
|
-
|
|
36
|
+
const handleCancel = () => {
|
|
42
37
|
hide();
|
|
43
38
|
};
|
|
44
|
-
|
|
45
|
-
setCurrentColumns(currentColumns.map(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}));
|
|
39
|
+
const handleToggleColumn = (id, updatedVisible) => {
|
|
40
|
+
setCurrentColumns(currentColumns.map((column) => column.id === id ? {
|
|
41
|
+
...column,
|
|
42
|
+
visible: updatedVisible
|
|
43
|
+
} : column));
|
|
50
44
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
var updatedColumns = [].concat(currentColumns).sort(function (a, b) {
|
|
56
|
-
return idOrder.indexOf(a.id) - idOrder.indexOf(b.id);
|
|
57
|
-
});
|
|
45
|
+
const handleOrderChange = (newOrder) => {
|
|
46
|
+
const idOrder = newOrder.map((item) => item.id);
|
|
47
|
+
const updatedColumns = [...currentColumns].sort((a, b) => idOrder.indexOf(a.id) - idOrder.indexOf(b.id));
|
|
58
48
|
setCurrentColumns(updatedColumns);
|
|
59
49
|
};
|
|
60
|
-
|
|
50
|
+
const handleSearchChange = (query) => {
|
|
61
51
|
setSearchQuery(query);
|
|
62
52
|
};
|
|
63
|
-
|
|
64
|
-
return searchQuery ? currentColumns.filter(
|
|
65
|
-
return matchesSearchQuery(column.name, searchQuery);
|
|
66
|
-
}) : currentColumns;
|
|
53
|
+
const filteredColumns = useMemo(() => {
|
|
54
|
+
return searchQuery ? currentColumns.filter((column) => matchesSearchQuery(column.name, searchQuery)) : currentColumns;
|
|
67
55
|
}, [currentColumns, searchQuery]);
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})))), /*#__PURE__*/React.createElement(S.SearchBar, {
|
|
89
|
-
onSearchChange: handleSearchChange,
|
|
90
|
-
placeholder: texts.searchPlaceholder,
|
|
91
|
-
value: searchQuery,
|
|
92
|
-
onClearInput: function onClearInput() {
|
|
93
|
-
return handleSearchChange('');
|
|
94
|
-
},
|
|
95
|
-
iconLeft: /*#__PURE__*/React.createElement(Icon, {
|
|
96
|
-
component: /*#__PURE__*/React.createElement(SearchM, null),
|
|
97
|
-
color: theme.palette['grey-600']
|
|
98
|
-
}),
|
|
99
|
-
clearTooltip: texts.searchClearTooltip || ''
|
|
100
|
-
}), /*#__PURE__*/React.createElement(S.ColumnManagerListWrapper, null, /*#__PURE__*/React.createElement(Drawer.DrawerContent, {
|
|
101
|
-
style: {
|
|
102
|
-
padding: '0',
|
|
103
|
-
height: '100%'
|
|
104
|
-
}
|
|
105
|
-
}, /*#__PURE__*/React.createElement(ColumnManagerList, {
|
|
106
|
-
texts: texts,
|
|
107
|
-
draggable: draggable,
|
|
108
|
-
handleOrderChange: handleOrderChange,
|
|
109
|
-
searchQuery: searchQuery,
|
|
110
|
-
columns: filteredColumns,
|
|
111
|
-
toggleColumn: handleToggleColumn
|
|
112
|
-
}))), /*#__PURE__*/React.createElement(ColumnManagerActions, {
|
|
113
|
-
onApply: handleApply,
|
|
114
|
-
onCancel: handleCancel,
|
|
115
|
-
texts: texts
|
|
116
|
-
}));
|
|
56
|
+
return /* @__PURE__ */ jsxs(ColumnManager$1, { visible, width: 338, onClose: hide, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Drawer.DrawerHeader, { children: /* @__PURE__ */ jsxs(Drawer.DrawerHeaderBar, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Title, { style: {
|
|
59
|
+
flex: 1,
|
|
60
|
+
margin: 0
|
|
61
|
+
}, level: 4, children: texts.title }),
|
|
62
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": "ds-column-manager-close", style: {
|
|
63
|
+
marginLeft: "8px"
|
|
64
|
+
}, mode: "single-icon", type: "ghost", onClick: hide, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) })
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(SearchBar, { onSearchChange: handleSearchChange, placeholder: texts.searchPlaceholder, value: searchQuery, onClearInput: () => handleSearchChange(""), iconLeft: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(SearchM, {}), color: theme.palette["grey-600"] }), clearTooltip: texts.searchClearTooltip || "" }),
|
|
67
|
+
/* @__PURE__ */ jsx(ColumnManagerListWrapper, { children: /* @__PURE__ */ jsx(Drawer.DrawerContent, { style: {
|
|
68
|
+
padding: "0",
|
|
69
|
+
height: "100%"
|
|
70
|
+
}, children: /* @__PURE__ */ jsx(ColumnManagerList, { texts, draggable, handleOrderChange, searchQuery, columns: filteredColumns, toggleColumn: handleToggleColumn }) }) }),
|
|
71
|
+
/* @__PURE__ */ jsx(ColumnManagerActions, { onApply: handleApply, onCancel: handleCancel, texts })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
ColumnManager as default
|
|
117
76
|
};
|
|
118
|
-
export default ColumnManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Drawer from '@synerise/ds-drawer';
|
|
2
|
-
import {
|
|
3
|
-
export declare const ColumnManager: import(
|
|
1
|
+
import { default as Drawer } from '@synerise/ds-drawer';
|
|
2
|
+
import { StyledSearchBar } from '@synerise/ds-search-bar';
|
|
3
|
+
export declare const ColumnManager: import('styled-components').StyledComponent<typeof Drawer, any, {}, never>;
|
|
4
4
|
export declare const SearchBar: StyledSearchBar;
|
|
5
|
-
export declare const ColumnManagerListWrapper: import(
|
|
5
|
+
export declare const ColumnManagerListWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import Drawer from
|
|
3
|
-
import SearchBarBase from
|
|
4
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Drawer from "@synerise/ds-drawer";
|
|
3
|
+
import SearchBarBase from "@synerise/ds-search-bar";
|
|
4
|
+
const ColumnManager = /* @__PURE__ */ styled(Drawer).withConfig({
|
|
5
5
|
displayName: "ColumnManagerstyles__ColumnManager",
|
|
6
6
|
componentId: "sc-4cxi70-0"
|
|
7
7
|
})([""]);
|
|
8
|
-
|
|
8
|
+
const SearchBar = /* @__PURE__ */ styled(SearchBarBase).withConfig({
|
|
9
9
|
displayName: "ColumnManagerstyles__SearchBar",
|
|
10
10
|
componentId: "sc-4cxi70-1"
|
|
11
11
|
})(["min-height:52px;height:52px;"]);
|
|
12
|
-
|
|
12
|
+
const ColumnManagerListWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
13
13
|
displayName: "ColumnManagerstyles__ColumnManagerListWrapper",
|
|
14
14
|
componentId: "sc-4cxi70-2"
|
|
15
|
-
})(["flex:1 1 auto;min-height:0;"]);
|
|
15
|
+
})(["flex:1 1 auto;min-height:0;"]);
|
|
16
|
+
export {
|
|
17
|
+
ColumnManager,
|
|
18
|
+
ColumnManagerListWrapper,
|
|
19
|
+
SearchBar
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ColumnManagerActionsProps } from './ColumnManagerActions.types';
|
|
3
3
|
export declare const ColumnManagerActions: ({ texts, onApply, onCancel, }: ColumnManagerActionsProps) => React.JSX.Element;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type: "ghost",
|
|
11
|
-
mode: "simple",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onClick: onApply
|
|
18
|
-
}, texts.apply)));
|
|
19
|
-
};
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import { ColumnManagerActions as ColumnManagerActions$1, RightButtons } from "./ColumnManagerActions.styles.js";
|
|
4
|
+
const ColumnManagerActions = ({
|
|
5
|
+
texts,
|
|
6
|
+
onApply,
|
|
7
|
+
onCancel
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(ColumnManagerActions$1, { children: /* @__PURE__ */ jsxs(RightButtons, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": "ds-column-manager-cancel", type: "ghost", mode: "simple", onClick: onCancel, children: texts.cancel }),
|
|
11
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": "ds-column-manager-apply", type: "primary", mode: "simple", onClick: onApply, children: texts.apply })
|
|
12
|
+
] }) });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
ColumnManagerActions
|
|
16
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ColumnManagerActions: import(
|
|
2
|
-
export declare const RightButtons: import(
|
|
1
|
+
export declare const ColumnManagerActions: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const RightButtons: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const ColumnManagerActions = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "ColumnManagerActionsstyles__ColumnManagerActions",
|
|
4
4
|
componentId: "sc-1vmwevx-0"
|
|
5
|
-
})(["display:flex;flex:0 0 80px;flex-direction:row;align-items:center;justify-content:flex-end;background-color:", ";padding:24px;"],
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
export var RightButtons = styled.div.withConfig({
|
|
5
|
+
})(["display:flex;flex:0 0 80px;flex-direction:row;align-items:center;justify-content:flex-end;background-color:", ";padding:24px;"], (props) => props.theme.palette["grey-050"]);
|
|
6
|
+
const RightButtons = /* @__PURE__ */ styled.div.withConfig({
|
|
9
7
|
displayName: "ColumnManagerActionsstyles__RightButtons",
|
|
10
8
|
componentId: "sc-1vmwevx-1"
|
|
11
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-end;button{margin-left:8px;}"]);
|
|
9
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-end;button{margin-left:8px;}"]);
|
|
10
|
+
export {
|
|
11
|
+
ColumnManagerActions,
|
|
12
|
+
RightButtons
|
|
13
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { DraggableAttributes, DraggableSyntheticListeners } from '@synerise/ds-sortable';
|
|
2
|
+
import { Column, ColumnManagerTexts } from '../ColumnManager.types';
|
|
3
3
|
export type ColumnManagerItemProps<ColumnType extends Column> = {
|
|
4
4
|
draggable?: boolean;
|
|
5
5
|
isDragged?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VarTypeBooleanM, VarTypeDateM,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
text:
|
|
7
|
-
number:
|
|
8
|
-
date:
|
|
9
|
-
|
|
10
|
-
list:
|
|
11
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VarTypeListM, VarTypeBooleanM, VarTypeDateM, VarTypeNumberM, VarTypeStringM } from "@synerise/ds-icon";
|
|
3
|
+
const DEFAULT_ITEM_TYPE = "text";
|
|
4
|
+
const TYPES_WITH_ICONS = ["text", "number", "date", "boolean", "list"];
|
|
5
|
+
const ICON_MAP = {
|
|
6
|
+
text: /* @__PURE__ */ jsx(VarTypeStringM, {}),
|
|
7
|
+
number: /* @__PURE__ */ jsx(VarTypeNumberM, {}),
|
|
8
|
+
date: /* @__PURE__ */ jsx(VarTypeDateM, {}),
|
|
9
|
+
boolean: /* @__PURE__ */ jsx(VarTypeBooleanM, {}),
|
|
10
|
+
list: /* @__PURE__ */ jsx(VarTypeListM, {})
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_ITEM_TYPE,
|
|
14
|
+
ICON_MAP,
|
|
15
|
+
TYPES_WITH_ICONS
|
|
16
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Column } from '../ColumnManager.types';
|
|
3
|
+
import { ColumnManagerItemProps } from './ColumManagerItem.types';
|
|
4
4
|
export declare const ColumnManagerItem: <ColumnType extends Column>({ item, switchAction, draggable, searchQuery, texts, dragHandleProps, id, isDragged, ...rest }: ColumnManagerItemProps<ColumnType>) => React.JSX.Element;
|
|
5
5
|
export default ColumnManagerItem;
|
|
@@ -1,62 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var columnName = useMemo(function () {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTheme } from "@synerise/ds-core";
|
|
4
|
+
import Icon, { DragHandleM } from "@synerise/ds-icon";
|
|
5
|
+
import { RawSwitch } from "@synerise/ds-switch";
|
|
6
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
7
|
+
import { escapeRegEx } from "@synerise/ds-utils";
|
|
8
|
+
import { ICON_MAP, TYPES_WITH_ICONS, DEFAULT_ITEM_TYPE } from "./ColumnManagerItem.const.js";
|
|
9
|
+
import { ColumnManagerItem as ColumnManagerItem$1, ItemPart, DragHandler, ColumnManagerItemName } from "./ColumnManagerItem.styles.js";
|
|
10
|
+
const ColumnManagerItem = ({
|
|
11
|
+
item,
|
|
12
|
+
switchAction,
|
|
13
|
+
draggable,
|
|
14
|
+
searchQuery,
|
|
15
|
+
texts,
|
|
16
|
+
dragHandleProps,
|
|
17
|
+
id,
|
|
18
|
+
isDragged,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const iconComponent = ICON_MAP[item.type && TYPES_WITH_ICONS.includes(item.type) ? item.type : DEFAULT_ITEM_TYPE];
|
|
23
|
+
const columnName = useMemo(() => {
|
|
25
24
|
if (searchQuery) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return item.name.replace(result,
|
|
25
|
+
const escapedQuery = escapeRegEx(searchQuery);
|
|
26
|
+
const startOfQuery = item.name.toLowerCase().search(escapedQuery.toLowerCase());
|
|
27
|
+
const result = item.name.substr(startOfQuery, searchQuery.length);
|
|
28
|
+
return item.name.replace(result, `<span class="search-highlight">${result}</span>`);
|
|
30
29
|
}
|
|
31
30
|
return item.name;
|
|
32
31
|
}, [item.name, searchQuery]);
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
})), /*#__PURE__*/React.createElement(S.ItemPart, {
|
|
49
|
-
align: "right"
|
|
50
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
51
|
-
title: item.visible ? texts.switchOff : texts.switchOn,
|
|
52
|
-
placement: "topRight",
|
|
53
|
-
disabled: item.readOnly
|
|
54
|
-
}, /*#__PURE__*/React.createElement(RawSwitch, {
|
|
55
|
-
disabled: item.readOnly,
|
|
56
|
-
checked: item.visible,
|
|
57
|
-
onChange: function onChange() {
|
|
58
|
-
return switchAction(item.id, !item.visible);
|
|
59
|
-
}
|
|
60
|
-
}))));
|
|
32
|
+
return /* @__PURE__ */ jsxs(ColumnManagerItem$1, { "data-testid": "ds-column-manager-item", isDragged, ...rest, children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(ItemPart, { align: "left", children: [
|
|
34
|
+
draggable && /* @__PURE__ */ jsx(DragHandler, { component: /* @__PURE__ */ jsx(DragHandleM, {}), color: theme.palette["grey-400"], ...dragHandleProps?.attributes, ...dragHandleProps?.listeners }),
|
|
35
|
+
/* @__PURE__ */ jsx(Icon, { component: iconComponent, color: theme.palette["grey-600"] }),
|
|
36
|
+
/* @__PURE__ */ jsx(ColumnManagerItemName, { dangerouslySetInnerHTML: {
|
|
37
|
+
__html: columnName
|
|
38
|
+
} })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsx(ItemPart, { align: "right", children: /* @__PURE__ */ jsx(Tooltip, { title: item.visible ? texts.switchOff : texts.switchOn, placement: "topRight", disabled: item.readOnly, children: /* @__PURE__ */ jsx(RawSwitch, { disabled: item.readOnly, checked: item.visible, onChange: () => switchAction(item.id, !item.visible) }) }) })
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
ColumnManagerItem,
|
|
45
|
+
ColumnManagerItem as default
|
|
61
46
|
};
|
|
62
|
-
export default ColumnManagerItem;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Menu from '@synerise/ds-menu';
|
|
2
|
-
export declare const DragHandler: import(
|
|
3
|
-
export declare const Icons: import(
|
|
4
|
-
export declare const ItemPart: import(
|
|
1
|
+
import { default as Menu } from '@synerise/ds-menu';
|
|
2
|
+
export declare const DragHandler: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<import('@synerise/ds-icon').BaseIconProps & Omit<import('react').HTMLAttributes<HTMLDivElement>, keyof import('@synerise/ds-icon').BaseIconProps> & import('@synerise/ds-utils').DataAttributes & import('react').RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
3
|
+
export declare const Icons: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const ItemPart: import('styled-components').StyledComponent<"div", any, {
|
|
5
5
|
align: string;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const ColumnManagerItem: import(
|
|
7
|
+
export declare const ColumnManagerItem: import('styled-components').StyledComponent<"div", any, {
|
|
8
8
|
isDragged?: boolean;
|
|
9
9
|
}, never>;
|
|
10
|
-
export declare const ColumnManagerItemName: import(
|
|
11
|
-
export declare const FixedMenu: import(
|
|
10
|
+
export declare const ColumnManagerItemName: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
11
|
+
export declare const FixedMenu: import('styled-components').StyledComponent<typeof Menu, any, {}, never>;
|
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import Icon, { IconContainer } from
|
|
3
|
-
import Menu from
|
|
4
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Icon, { IconContainer } from "@synerise/ds-icon";
|
|
3
|
+
import Menu from "@synerise/ds-menu";
|
|
4
|
+
const DragHandler = /* @__PURE__ */ styled(Icon).withConfig({
|
|
5
5
|
displayName: "ColumnManagerItemstyles__DragHandler",
|
|
6
6
|
componentId: "sc-12ob8aa-0"
|
|
7
7
|
})(["position:absolute;top:16px;left:-24px;opacity:0;cursor:pointer;"]);
|
|
8
|
-
|
|
8
|
+
const Icons = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "ColumnManagerItemstyles__Icons",
|
|
10
10
|
componentId: "sc-12ob8aa-1"
|
|
11
11
|
})(["display:flex;align-items:center;justify-content:center;", "{margin-left:8px;}"], IconContainer);
|
|
12
|
-
|
|
12
|
+
const ItemPart = /* @__PURE__ */ styled.div.withConfig({
|
|
13
13
|
displayName: "ColumnManagerItemstyles__ItemPart",
|
|
14
14
|
componentId: "sc-12ob8aa-2"
|
|
15
|
-
})(["display:flex;flex-direction:row;align-items:center;position:relative;height:56px;justify-content:", ";flex:", ";max-width:", ";.switch-texts{margin:0;}.ds-switch{margin-left:8px;}"],
|
|
16
|
-
|
|
17
|
-
}, function (props) {
|
|
18
|
-
return props.align === 'left' ? '1' : 'auto';
|
|
19
|
-
}, function (props) {
|
|
20
|
-
return props.align === 'left' ? 'calc(100% - 80px)' : '68px';
|
|
21
|
-
});
|
|
22
|
-
export var ColumnManagerItem = styled.div.withConfig({
|
|
15
|
+
})(["display:flex;flex-direction:row;align-items:center;position:relative;height:56px;justify-content:", ";flex:", ";max-width:", ";.switch-texts{margin:0;}.ds-switch{margin-left:8px;}"], (props) => props.align === "left" ? "flex-start" : "flex-end", (props) => props.align === "left" ? "1" : "auto", (props) => props.align === "left" ? "calc(100% - 80px)" : "68px");
|
|
16
|
+
const ColumnManagerItem = /* @__PURE__ */ styled.div.withConfig({
|
|
23
17
|
displayName: "ColumnManagerItemstyles__ColumnManagerItem",
|
|
24
18
|
componentId: "sc-12ob8aa-3"
|
|
25
|
-
})(["display:flex;flex-direction:row;align-items:center;height:56px;justify-content:space-between;width:100%;padding:13px 24px;position:relative;background:", ";border-bottom:1px solid ", ";", " &:hover{background-color:", ";&:before{width:2px;position:absolute;top:0;left:0;height:100%;background-color:", ";content:'';}", "{opacity:1;}", "{display:none;}&&{.ds-button{visibility:visible;opacity:1;}}}&&{.ds-button{position:absolute;right:36px;top:12px;display:flex;visibility:hidden;opacity:0;transition:all 0s;}}"],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, function (props) {
|
|
30
|
-
return props.isDragged && "\n opacity: 0;\n ";
|
|
31
|
-
}, function (props) {
|
|
32
|
-
return props.theme.palette['grey-050'];
|
|
33
|
-
}, function (props) {
|
|
34
|
-
return props.theme.palette['blue-600'];
|
|
35
|
-
}, DragHandler, Icons);
|
|
36
|
-
export var ColumnManagerItemName = styled.span.withConfig({
|
|
19
|
+
})(["display:flex;flex-direction:row;align-items:center;height:56px;justify-content:space-between;width:100%;padding:13px 24px;position:relative;background:", ";border-bottom:1px solid ", ";", " &:hover{background-color:", ";&:before{width:2px;position:absolute;top:0;left:0;height:100%;background-color:", ";content:'';}", "{opacity:1;}", "{display:none;}&&{.ds-button{visibility:visible;opacity:1;}}}&&{.ds-button{position:absolute;right:36px;top:12px;display:flex;visibility:hidden;opacity:0;transition:all 0s;}}"], (props) => props.theme.palette.white, (props) => props.theme.palette["grey-200"], (props) => props.isDragged && `
|
|
20
|
+
opacity: 0;
|
|
21
|
+
`, (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-600"], DragHandler, Icons);
|
|
22
|
+
const ColumnManagerItemName = /* @__PURE__ */ styled.span.withConfig({
|
|
37
23
|
displayName: "ColumnManagerItemstyles__ColumnManagerItemName",
|
|
38
24
|
componentId: "sc-12ob8aa-4"
|
|
39
|
-
})(["font-size:13px;line-height:1.38;color:", ";margin-left:8px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:1;.search-highlight{font-weight:500;color:", ";}"],
|
|
40
|
-
|
|
41
|
-
}, function (props) {
|
|
42
|
-
return props.theme.palette['grey-800'];
|
|
43
|
-
});
|
|
44
|
-
export var FixedMenu = styled(Menu).withConfig({
|
|
25
|
+
})(["font-size:13px;line-height:1.38;color:", ";margin-left:8px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:1;.search-highlight{font-weight:500;color:", ";}"], (props) => props.theme.palette["grey-600"], (props) => props.theme.palette["grey-800"]);
|
|
26
|
+
const FixedMenu = /* @__PURE__ */ styled(Menu).withConfig({
|
|
45
27
|
displayName: "ColumnManagerItemstyles__FixedMenu",
|
|
46
28
|
componentId: "sc-12ob8aa-5"
|
|
47
|
-
})(["padding:8px;.ant-dropdown-menu-item{padding:0 8px !important;}"]);
|
|
29
|
+
})(["padding:8px;.ant-dropdown-menu-item{padding:0 8px !important;}"]);
|
|
30
|
+
export {
|
|
31
|
+
ColumnManagerItem,
|
|
32
|
+
ColumnManagerItemName,
|
|
33
|
+
DragHandler,
|
|
34
|
+
FixedMenu,
|
|
35
|
+
Icons,
|
|
36
|
+
ItemPart
|
|
37
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FixedSizeList } from '
|
|
2
|
-
export declare const ColumnManagerList: import(
|
|
3
|
-
export declare const ListHeadline: import(
|
|
4
|
-
export declare const List: import(
|
|
1
|
+
import { FixedSizeList } from '../../../../../config/vitest/__mocks__/reactWindowMock.js';
|
|
2
|
+
export declare const ColumnManagerList: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const ListHeadline: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
4
|
+
export declare const List: import('styled-components').StyledComponent<typeof FixedSizeList, any, {
|
|
5
5
|
maxHeight?: number;
|
|
6
6
|
isDragging?: boolean;
|
|
7
7
|
}, never>;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import { FixedSizeList } from
|
|
2
|
-
import styled from
|
|
3
|
-
|
|
1
|
+
import { FixedSizeList } from "react-window";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
const ColumnManagerList = /* @__PURE__ */ styled.div.withConfig({
|
|
4
4
|
displayName: "ColumnManagerstyle__ColumnManagerList",
|
|
5
5
|
componentId: "sc-8vnyk-0"
|
|
6
6
|
})(["display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;width:100%;height:100%;"]);
|
|
7
|
-
|
|
7
|
+
const ListHeadline = /* @__PURE__ */ styled.span.withConfig({
|
|
8
8
|
displayName: "ColumnManagerstyle__ListHeadline",
|
|
9
9
|
componentId: "sc-8vnyk-1"
|
|
10
|
-
})(["display:flex;width:100%;font-size:14px;line-height:1.42;font-weight:500;padding:24px 24px 12px;border-bottom:1px solid ", ";color:", ";"],
|
|
11
|
-
|
|
12
|
-
}, function (props) {
|
|
13
|
-
return props.theme.palette['grey-800'];
|
|
14
|
-
});
|
|
15
|
-
export var List = styled(FixedSizeList).withConfig({
|
|
10
|
+
})(["display:flex;width:100%;font-size:14px;line-height:1.42;font-weight:500;padding:24px 24px 12px;border-bottom:1px solid ", ";color:", ";"], (props) => props.theme.palette["grey-200"], (props) => props.theme.palette["grey-800"]);
|
|
11
|
+
const List = /* @__PURE__ */ styled(FixedSizeList).withConfig({
|
|
16
12
|
displayName: "ColumnManagerstyle__List",
|
|
17
13
|
componentId: "sc-8vnyk-2"
|
|
18
|
-
})(["overflow-x:unset;overflow-y:unset;height:auto !important;background:", ";box-shadow:2px 0 0 0 ", " inset;", " ", ""],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, function (props) {
|
|
25
|
-
return props.isDragging && "user-select: none;";
|
|
26
|
-
});
|
|
14
|
+
})(["overflow-x:unset;overflow-y:unset;height:auto !important;background:", ";box-shadow:2px 0 0 0 ", " inset;", " ", ""], (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-600"], (props) => props.maxHeight !== void 0 && `max-height: ${props.maxHeight}px;`, (props) => props.isDragging && `user-select: none;`);
|
|
15
|
+
export {
|
|
16
|
+
ColumnManagerList,
|
|
17
|
+
List,
|
|
18
|
+
ListHeadline
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as React, CSSProperties } from 'react';
|
|
2
|
+
import { Column } from '../ColumnManager.types';
|
|
3
|
+
import { ColumnManagerListProps } from './ColumnManagerList.types';
|
|
4
4
|
export declare const LIST_STYLE: CSSProperties;
|
|
5
5
|
declare const ColumnManagerList: <ColumnType extends Column>({ searchQuery, columns, draggable, handleOrderChange, toggleColumn, texts, }: ColumnManagerListProps<ColumnType>) => React.JSX.Element;
|
|
6
6
|
export default ColumnManagerList;
|
|
@@ -1,93 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useMemo } from "react";
|
|
3
|
+
import Result from "@synerise/ds-result";
|
|
4
|
+
import Scrollbar from "@synerise/ds-scrollbar";
|
|
5
|
+
import { SortableContainer, DragOverlay } from "@synerise/ds-sortable";
|
|
6
|
+
import { useResizeObserver } from "@synerise/ds-utils";
|
|
7
|
+
import { ColumnManagerItem } from "../ColumnManagerItem/ColumnManagerItem.js";
|
|
8
|
+
import { ColumnManagerSortableItem } from "../ColumnManagerSortableItem/ColumnManagerSortableItem.js";
|
|
9
|
+
import { ColumnManagerList as ColumnManagerList$1, List } from "./ColumnManager.style.js";
|
|
10
|
+
const LIST_STYLE = {
|
|
11
|
+
overflowX: "unset",
|
|
12
|
+
overflowY: "unset"
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
switchAction: toggleColumn,
|
|
37
|
-
draggable: isItemDraggable,
|
|
38
|
-
texts: texts
|
|
39
|
-
};
|
|
40
|
-
});
|
|
14
|
+
const ColumnManagerList = ({
|
|
15
|
+
searchQuery,
|
|
16
|
+
columns,
|
|
17
|
+
draggable,
|
|
18
|
+
handleOrderChange,
|
|
19
|
+
toggleColumn,
|
|
20
|
+
texts
|
|
21
|
+
}) => {
|
|
22
|
+
const [activeItem, setActiveItem] = useState();
|
|
23
|
+
const [containerHeight, setContainerHeight] = useState(0);
|
|
24
|
+
const listRef = useRef(null);
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const isItemDraggable = draggable && !searchQuery;
|
|
27
|
+
const items = useMemo(() => {
|
|
28
|
+
return columns.map((column) => ({
|
|
29
|
+
key: column.id,
|
|
30
|
+
id: column.id,
|
|
31
|
+
item: column,
|
|
32
|
+
isDragged: activeItem && activeItem?.id === column.id,
|
|
33
|
+
switchAction: toggleColumn,
|
|
34
|
+
draggable: isItemDraggable,
|
|
35
|
+
texts
|
|
36
|
+
}));
|
|
41
37
|
}, [columns, toggleColumn, texts, activeItem, isItemDraggable]);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const handleScroll = ({
|
|
39
|
+
currentTarget
|
|
40
|
+
}) => {
|
|
41
|
+
const {
|
|
42
|
+
scrollTop
|
|
43
|
+
} = currentTarget;
|
|
45
44
|
if (listRef.current) {
|
|
46
45
|
listRef.current.scrollTo(scrollTop);
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
|
-
useResizeObserver(containerRef,
|
|
48
|
+
useResizeObserver(containerRef, (dimensions) => {
|
|
50
49
|
setContainerHeight(dimensions.height);
|
|
51
50
|
});
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
setActiveItem(undefined);
|
|
68
|
-
},
|
|
69
|
-
onDragCancel: function onDragCancel() {
|
|
70
|
-
return setActiveItem(undefined);
|
|
71
|
-
},
|
|
72
|
-
onOrderChange: handleOrderChange,
|
|
73
|
-
items: items,
|
|
74
|
-
axis: "y"
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Scrollbar, {
|
|
76
|
-
absolute: true,
|
|
77
|
-
withDnd: true,
|
|
78
|
-
onScroll: handleScroll,
|
|
79
|
-
maxHeight: containerHeight
|
|
80
|
-
}, /*#__PURE__*/React.createElement(S.List, {
|
|
81
|
-
isDragging: !!activeItem,
|
|
82
|
-
height: containerHeight,
|
|
83
|
-
itemCount: items.length,
|
|
84
|
-
itemSize: 56,
|
|
85
|
-
itemData: items,
|
|
86
|
-
width: "100%",
|
|
87
|
-
ref: listRef,
|
|
88
|
-
style: LIST_STYLE
|
|
89
|
-
}, function (props) {
|
|
90
|
-
return /*#__PURE__*/React.createElement(ColumnManagerSortableItem, props);
|
|
91
|
-
})), /*#__PURE__*/React.createElement(DragOverlay, null, activeItem && /*#__PURE__*/React.createElement(ColumnManagerItem, activeItem))));
|
|
51
|
+
return /* @__PURE__ */ jsx(ColumnManagerList$1, { ref: containerRef, "data-testid": "ds-column-manager-list", children: !items.length && searchQuery ? /* @__PURE__ */ jsx(Result, { description: texts.noResults, type: "no-results" }) : /* @__PURE__ */ jsxs(SortableContainer, { onDragStart: ({
|
|
52
|
+
active
|
|
53
|
+
}) => {
|
|
54
|
+
const column = items.find((item) => item.id === active.id);
|
|
55
|
+
setActiveItem(column);
|
|
56
|
+
}, onDragEnd: () => {
|
|
57
|
+
setActiveItem(void 0);
|
|
58
|
+
}, onDragCancel: () => setActiveItem(void 0), onOrderChange: handleOrderChange, items, axis: "y", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Scrollbar, { absolute: true, withDnd: true, onScroll: handleScroll, maxHeight: containerHeight, children: /* @__PURE__ */ jsx(List, { isDragging: !!activeItem, height: containerHeight, itemCount: items.length, itemSize: 56, itemData: items, width: "100%", ref: listRef, style: LIST_STYLE, children: (props) => /* @__PURE__ */ jsx(ColumnManagerSortableItem, { ...props }) }) }),
|
|
60
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: activeItem && /* @__PURE__ */ jsx(ColumnManagerItem, { ...activeItem }) })
|
|
61
|
+
] }) });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
LIST_STYLE,
|
|
65
|
+
ColumnManagerList as default
|
|
92
66
|
};
|
|
93
|
-
export default ColumnManagerList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Column, ColumnManagerTexts } from '../ColumnManager.types';
|
|
2
|
+
import { ColumnManagerItemProps } from '../ColumnManagerItem/ColumManagerItem.types';
|
|
3
3
|
export type ColumnManagerListProps<ColumnType extends Column> = {
|
|
4
4
|
searchQuery: string;
|
|
5
5
|
columns: ColumnType[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Column } from '../ColumnManager.types';
|
|
3
|
+
import { ColumnManagerSortableItemProps } from './ColumnManagerSortableItem.types';
|
|
4
4
|
export declare const ColumnManagerSortableItem: <ColumnType extends Column>(props: ColumnManagerSortableItemProps<ColumnType>) => React.JSX.Element;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
attributes
|
|
17
|
-
listeners
|
|
18
|
-
setNodeRef
|
|
19
|
-
transform
|
|
20
|
-
transition
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
transition: transition
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { useSortable, CSS } from "@synerise/ds-sortable";
|
|
4
|
+
import { ColumnManagerItem } from "../ColumnManagerItem/ColumnManagerItem.js";
|
|
5
|
+
const ColumnManagerSortableItem = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
index,
|
|
8
|
+
style: styleProp,
|
|
9
|
+
data,
|
|
10
|
+
...rest
|
|
11
|
+
} = props;
|
|
12
|
+
const {
|
|
13
|
+
id
|
|
14
|
+
} = data[index];
|
|
15
|
+
const {
|
|
16
|
+
attributes,
|
|
17
|
+
listeners,
|
|
18
|
+
setNodeRef,
|
|
19
|
+
transform,
|
|
20
|
+
transition
|
|
21
|
+
} = useSortable({
|
|
22
|
+
id
|
|
24
23
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
const style = {
|
|
25
|
+
...styleProp,
|
|
26
|
+
transform: CSS.Transform.toString(transform),
|
|
27
|
+
transition
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ createElement("div", { ...rest, key: `column-manager-item-${id}`, style, ref: setNodeRef }, /* @__PURE__ */ jsx(ColumnManagerItem, { ...data[index], dragHandleProps: {
|
|
30
|
+
attributes,
|
|
31
|
+
listeners
|
|
32
|
+
} }));
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
ColumnManagerSortableItem
|
|
36
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ListChildComponentProps } from '../../../../../config/vitest/__mocks__/reactWindowMock.js';
|
|
2
|
+
import { Column } from '../ColumnManager.types';
|
|
3
|
+
import { ColumnManagerItemProps } from '../ColumnManagerItem/ColumManagerItem.types';
|
|
4
4
|
export type ColumnManagerSortableItemProps<ColumnType extends Column> = ListChildComponentProps<ColumnManagerItemProps<ColumnType>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ColumnManagerTexts } from '../ColumnManager.types';
|
|
2
2
|
export declare const useTranslations: (texts?: Partial<ColumnManagerTexts>) => ColumnManagerTexts;
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return _extends({
|
|
1
|
+
import { useIntl } from "react-intl";
|
|
2
|
+
const useTranslations = (texts) => {
|
|
3
|
+
const intl = useIntl();
|
|
4
|
+
return {
|
|
6
5
|
title: intl.formatMessage({
|
|
7
|
-
id:
|
|
8
|
-
defaultMessage:
|
|
6
|
+
id: "DS.COLUMN-MANAGER.TITLE",
|
|
7
|
+
defaultMessage: "Manage columns"
|
|
9
8
|
}),
|
|
10
9
|
searchPlaceholder: intl.formatMessage({
|
|
11
|
-
id:
|
|
12
|
-
defaultMessage:
|
|
10
|
+
id: "DS.COLUMN-MANAGER.SEARCH-PLACEHOLDER",
|
|
11
|
+
defaultMessage: "Search columns"
|
|
13
12
|
}),
|
|
14
13
|
searchClearTooltip: intl.formatMessage({
|
|
15
|
-
id:
|
|
16
|
-
defaultMessage:
|
|
14
|
+
id: "DS.ITEM-FILTER.SEARCH-CLEAR",
|
|
15
|
+
defaultMessage: "Clear"
|
|
17
16
|
}),
|
|
18
17
|
noResults: intl.formatMessage({
|
|
19
|
-
id:
|
|
20
|
-
defaultMessage:
|
|
18
|
+
id: "DS.COLUMN-MANAGER.NO-RESULTS",
|
|
19
|
+
defaultMessage: "No results"
|
|
21
20
|
}),
|
|
22
21
|
cancel: intl.formatMessage({
|
|
23
|
-
id:
|
|
24
|
-
defaultMessage:
|
|
22
|
+
id: "DS.COLUMN-MANAGER.CANCEL",
|
|
23
|
+
defaultMessage: "Cancel"
|
|
25
24
|
}),
|
|
26
25
|
apply: intl.formatMessage({
|
|
27
|
-
id:
|
|
28
|
-
defaultMessage:
|
|
26
|
+
id: "DS.COLUMN-MANAGER.APPLY",
|
|
27
|
+
defaultMessage: "Apply"
|
|
29
28
|
}),
|
|
30
29
|
clear: intl.formatMessage({
|
|
31
|
-
id:
|
|
32
|
-
defaultMessage:
|
|
30
|
+
id: "DS.COLUMN-MANAGER.CLEAR",
|
|
31
|
+
defaultMessage: "Clear"
|
|
33
32
|
}),
|
|
34
33
|
switchOn: intl.formatMessage({
|
|
35
|
-
id:
|
|
36
|
-
defaultMessage:
|
|
34
|
+
id: "DS.COLUMN-MANAGER.SWITCH-ON",
|
|
35
|
+
defaultMessage: "Hide column"
|
|
37
36
|
}),
|
|
38
37
|
switchOff: intl.formatMessage({
|
|
39
|
-
id:
|
|
40
|
-
defaultMessage:
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
};
|
|
38
|
+
id: "DS.COLUMN-MANAGER.SWITCH-OFF",
|
|
39
|
+
defaultMessage: "Show column"
|
|
40
|
+
}),
|
|
41
|
+
...texts || {}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
useTranslations
|
|
46
|
+
};
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-column-manager",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.49",
|
|
4
4
|
"description": "ColumnManager UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^1.5.
|
|
36
|
-
"@synerise/ds-drawer": "^1.1.
|
|
37
|
-
"@synerise/ds-icon": "^1.15.
|
|
38
|
-
"@synerise/ds-menu": "^1.4.
|
|
39
|
-
"@synerise/ds-result": "^1.0.
|
|
40
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
41
|
-
"@synerise/ds-search-bar": "^1.4.
|
|
42
|
-
"@synerise/ds-sortable": "^1.3.
|
|
43
|
-
"@synerise/ds-switch": "^1.2.
|
|
44
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
45
|
-
"@synerise/ds-typography": "^1.1.
|
|
46
|
-
"@synerise/ds-utils": "^1.7.
|
|
35
|
+
"@synerise/ds-button": "^1.5.19",
|
|
36
|
+
"@synerise/ds-drawer": "^1.1.2",
|
|
37
|
+
"@synerise/ds-icon": "^1.15.2",
|
|
38
|
+
"@synerise/ds-menu": "^1.4.14",
|
|
39
|
+
"@synerise/ds-result": "^1.0.50",
|
|
40
|
+
"@synerise/ds-scrollbar": "^1.2.18",
|
|
41
|
+
"@synerise/ds-search-bar": "^1.4.21",
|
|
42
|
+
"@synerise/ds-sortable": "^1.3.14",
|
|
43
|
+
"@synerise/ds-switch": "^1.2.21",
|
|
44
|
+
"@synerise/ds-tooltip": "^1.4.11",
|
|
45
|
+
"@synerise/ds-typography": "^1.1.14",
|
|
46
|
+
"@synerise/ds-utils": "^1.7.1",
|
|
47
47
|
"react-window": "1.8.11"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@synerise/ds-input": "^1.6.
|
|
50
|
+
"@synerise/ds-input": "^1.6.11",
|
|
51
51
|
"vitest": "4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
58
58
|
"styled-components": "^5.3.3"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
|
|
61
61
|
}
|