@synerise/ds-mapping 1.1.34 → 1.1.36
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/Mapping.d.ts +2 -2
- package/dist/Mapping.js +77 -95
- package/dist/Mapping.styles.d.ts +12 -12
- package/dist/Mapping.styles.js +31 -21
- package/dist/Mapping.types.d.ts +4 -4
- package/dist/Mapping.types.js +1 -1
- package/dist/components/BatchSelectionHeader/BatchSelectionHeader.d.ts +2 -2
- package/dist/components/BatchSelectionHeader/BatchSelectionHeader.js +24 -18
- package/dist/components/RowSelection/RowSelection.d.ts +2 -2
- package/dist/components/RowSelection/RowSelection.js +13 -15
- package/dist/components/TitleRow/TitleRow.d.ts +2 -2
- package/dist/components/TitleRow/TitleRow.js +31 -24
- package/dist/components/index.js +8 -3
- package/dist/hooks/useBatchSelection.d.ts +2 -2
- package/dist/hooks/useBatchSelection.js +16 -17
- package/dist/hooks/useTexts.d.ts +1 -1
- package/dist/hooks/useTexts.js +21 -19
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/counter.d.ts +1 -1
- package/dist/utils/counter.js +14 -5
- package/package.json +10 -10
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.1.36](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.35...@synerise/ds-mapping@1.1.36) (2026-04-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-mapping
|
|
9
|
+
|
|
10
|
+
## [1.1.35](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.34...@synerise/ds-mapping@1.1.35) (2026-03-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-mapping
|
|
13
|
+
|
|
6
14
|
## [1.1.34](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.33...@synerise/ds-mapping@1.1.34) (2026-03-20)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-mapping
|
package/dist/Mapping.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseItemType, MappingProps } from './Mapping.types';
|
|
3
3
|
declare const Mapping: <ItemType extends BaseItemType>({ batchSelection, dataSource, leftTitle, leftTitleTooltip, rightTitle, rightTitleTooltip, leftComponent, rightComponent, centerComponent, texts, ...htmlAttributes }: MappingProps<ItemType>) => React.JSX.Element;
|
|
4
4
|
export default Mapping;
|
package/dist/Mapping.js
CHANGED
|
@@ -1,106 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { useBatchSelection } from
|
|
10
|
-
import { useTexts } from
|
|
11
|
-
import { renderCounter
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
actionButtons
|
|
38
|
-
onSelectionChange
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useMemo, useEffect } from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import Icon, { HideM, TaskCheckM } from "@synerise/ds-icon";
|
|
5
|
+
import { MappingWrapper, MappingRow, MappingRowLeft, MappingRowCenter, MappingRowRight } from "./Mapping.styles.js";
|
|
6
|
+
import { BatchSelectionHeader } from "./components/BatchSelectionHeader/BatchSelectionHeader.js";
|
|
7
|
+
import { RowSelection } from "./components/RowSelection/RowSelection.js";
|
|
8
|
+
import { TitleRow } from "./components/TitleRow/TitleRow.js";
|
|
9
|
+
import { useBatchSelection } from "./hooks/useBatchSelection.js";
|
|
10
|
+
import { useTexts } from "./hooks/useTexts.js";
|
|
11
|
+
import { renderCounter } from "./utils/counter.js";
|
|
12
|
+
const Mapping = ({
|
|
13
|
+
batchSelection,
|
|
14
|
+
dataSource,
|
|
15
|
+
leftTitle,
|
|
16
|
+
leftTitleTooltip,
|
|
17
|
+
rightTitle,
|
|
18
|
+
rightTitleTooltip,
|
|
19
|
+
leftComponent,
|
|
20
|
+
rightComponent,
|
|
21
|
+
centerComponent,
|
|
22
|
+
texts,
|
|
23
|
+
...htmlAttributes
|
|
24
|
+
}) => {
|
|
25
|
+
const hasCenterComponent = !!centerComponent;
|
|
26
|
+
const hasSelection = !!batchSelection;
|
|
27
|
+
const isCompact = dataSource.length === 1;
|
|
28
|
+
const [selectionEnabled, setSelectionEnabled] = useState(false);
|
|
29
|
+
const allTexts = useTexts(texts);
|
|
30
|
+
const {
|
|
31
|
+
selectedItemIds,
|
|
32
|
+
setSelectedItemIds,
|
|
33
|
+
handleBatchCheckboxChange,
|
|
34
|
+
batchSelectionCheckboxState
|
|
35
|
+
} = useBatchSelection(dataSource, hasSelection);
|
|
36
|
+
const {
|
|
37
|
+
actionButtons,
|
|
38
|
+
onSelectionChange,
|
|
39
|
+
renderCounter: renderCounter$1 = renderCounter
|
|
40
|
+
} = batchSelection || {};
|
|
41
|
+
const handleItemSelection = (checked, id) => {
|
|
42
42
|
if (checked) {
|
|
43
|
-
setSelectedItemIds([
|
|
43
|
+
setSelectedItemIds([...selectedItemIds, id]);
|
|
44
44
|
} else {
|
|
45
|
-
setSelectedItemIds(selectedItemIds.filter(
|
|
46
|
-
return itemId !== id;
|
|
47
|
-
}));
|
|
45
|
+
setSelectedItemIds(selectedItemIds.filter((itemId) => itemId !== id));
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
|
|
48
|
+
const toggleBatchButton = useCallback((newState) => {
|
|
51
49
|
setSelectionEnabled(newState);
|
|
52
50
|
setSelectedItemIds([]);
|
|
53
51
|
}, [setSelectedItemIds]);
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}), " ", allTexts.disableBatchSelection) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
65
|
-
component: /*#__PURE__*/React.createElement(TaskCheckM, null)
|
|
66
|
-
}), " ", allTexts.enableBatchSelection));
|
|
52
|
+
const batchButton = useMemo(() => {
|
|
53
|
+
return /* @__PURE__ */ jsx(Button, { "data-testid": "toggle-bulk-actions", type: "ghost", mode: "icon-label", onClick: () => toggleBatchButton(!selectionEnabled), children: selectionEnabled ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(HideM, {}) }),
|
|
55
|
+
" ",
|
|
56
|
+
allTexts.disableBatchSelection
|
|
57
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(TaskCheckM, {}) }),
|
|
59
|
+
" ",
|
|
60
|
+
allTexts.enableBatchSelection
|
|
61
|
+
] }) });
|
|
67
62
|
}, [allTexts.disableBatchSelection, allTexts.enableBatchSelection, selectionEnabled, toggleBatchButton]);
|
|
68
|
-
useEffect(
|
|
63
|
+
useEffect(() => {
|
|
69
64
|
onSelectionChange && onSelectionChange(selectedItemIds);
|
|
70
65
|
}, [onSelectionChange, selectedItemIds]);
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
onChange: handleItemSelection
|
|
94
|
-
}), /*#__PURE__*/React.createElement(S.MappingRowLeft, null, leftComponent({
|
|
95
|
-
item: item,
|
|
96
|
-
index: index
|
|
97
|
-
})), hasCenterComponent && /*#__PURE__*/React.createElement(S.MappingRowCenter, null, centerComponent({
|
|
98
|
-
item: item,
|
|
99
|
-
index: index
|
|
100
|
-
})), /*#__PURE__*/React.createElement(S.MappingRowRight, null, rightComponent({
|
|
101
|
-
item: item,
|
|
102
|
-
index: index
|
|
103
|
-
})));
|
|
104
|
-
}));
|
|
66
|
+
return /* @__PURE__ */ jsxs(MappingWrapper, { isCompact, ...htmlAttributes, children: [
|
|
67
|
+
batchSelection && /* @__PURE__ */ jsx(BatchSelectionHeader, { checkboxState: batchSelectionCheckboxState, onChange: handleBatchCheckboxChange, actionButtons, batchButton, enabled: selectionEnabled, counter: renderCounter$1(selectedItemIds.length, dataSource.length) }),
|
|
68
|
+
(leftTitle || rightTitle) && /* @__PURE__ */ jsx(TitleRow, { leftTitle, rightTitle, leftTitleTooltip, rightTitleTooltip, hasCenterComponent, hasSelection: hasSelection && selectionEnabled }),
|
|
69
|
+
dataSource.map((item, index) => /* @__PURE__ */ jsxs(MappingRow, { children: [
|
|
70
|
+
hasSelection && selectionEnabled && /* @__PURE__ */ jsx(RowSelection, { checkboxState: selectedItemIds.includes(item.id), itemId: item.id, onChange: handleItemSelection }),
|
|
71
|
+
/* @__PURE__ */ jsx(MappingRowLeft, { children: leftComponent({
|
|
72
|
+
item,
|
|
73
|
+
index
|
|
74
|
+
}) }),
|
|
75
|
+
hasCenterComponent && /* @__PURE__ */ jsx(MappingRowCenter, { children: centerComponent({
|
|
76
|
+
item,
|
|
77
|
+
index
|
|
78
|
+
}) }),
|
|
79
|
+
/* @__PURE__ */ jsx(MappingRowRight, { children: rightComponent({
|
|
80
|
+
item,
|
|
81
|
+
index
|
|
82
|
+
}) })
|
|
83
|
+
] }, item.id))
|
|
84
|
+
] });
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
Mapping as default
|
|
105
88
|
};
|
|
106
|
-
export default Mapping;
|
package/dist/Mapping.styles.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare const MappingWrapper: import(
|
|
1
|
+
export declare const MappingWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
2
2
|
isCompact: boolean;
|
|
3
3
|
}, never>;
|
|
4
|
-
export declare const MappingRow: import(
|
|
5
|
-
export declare const MappingRowLeft: import(
|
|
6
|
-
export declare const MappingRowRight: import(
|
|
7
|
-
export declare const MappingRowCenter: import(
|
|
8
|
-
export declare const RowSelectionWrapper: import(
|
|
9
|
-
export declare const ColumnTitle: import(
|
|
10
|
-
export declare const BatchSelectionWrapper: import(
|
|
11
|
-
export declare const BatchActionButtons: import(
|
|
12
|
-
export declare const BatchCounter: import(
|
|
13
|
-
export declare const BatchSelectionInner: import(
|
|
14
|
-
export declare const BatchToggleButton: import(
|
|
4
|
+
export declare const MappingRow: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const MappingRowLeft: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const MappingRowRight: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const MappingRowCenter: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const RowSelectionWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const ColumnTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
|
10
|
+
export declare const BatchSelectionWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const BatchActionButtons: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const BatchCounter: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const BatchSelectionInner: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const BatchToggleButton: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/Mapping.styles.js
CHANGED
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import { Title } from
|
|
3
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Title } from "@synerise/ds-typography";
|
|
3
|
+
const MappingWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
4
4
|
displayName: "Mappingstyles__MappingWrapper",
|
|
5
5
|
componentId: "sc-1f47eqt-0"
|
|
6
|
-
})(["display:flex;flex-direction:column;", ";"],
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
export var MappingRow = styled.div.withConfig({
|
|
6
|
+
})(["display:flex;flex-direction:column;", ";"], (props) => !props.isCompact && `gap: 16px`);
|
|
7
|
+
const MappingRow = /* @__PURE__ */ styled.div.withConfig({
|
|
10
8
|
displayName: "Mappingstyles__MappingRow",
|
|
11
9
|
componentId: "sc-1f47eqt-1"
|
|
12
10
|
})(["display:flex;gap:14px;align-items:center;"]);
|
|
13
|
-
|
|
11
|
+
const MappingRowLeft = /* @__PURE__ */ styled.div.withConfig({
|
|
14
12
|
displayName: "Mappingstyles__MappingRowLeft",
|
|
15
13
|
componentId: "sc-1f47eqt-2"
|
|
16
14
|
})(["flex:1 1 50%;"]);
|
|
17
|
-
|
|
15
|
+
const MappingRowRight = /* @__PURE__ */ styled.div.withConfig({
|
|
18
16
|
displayName: "Mappingstyles__MappingRowRight",
|
|
19
17
|
componentId: "sc-1f47eqt-3"
|
|
20
18
|
})(["flex:1 1 50%;"]);
|
|
21
|
-
|
|
19
|
+
const MappingRowCenter = /* @__PURE__ */ styled.div.withConfig({
|
|
22
20
|
displayName: "Mappingstyles__MappingRowCenter",
|
|
23
21
|
componentId: "sc-1f47eqt-4"
|
|
24
22
|
})(["flex:0 0 32px;display:flex;justify-content:center;"]);
|
|
25
|
-
|
|
23
|
+
const RowSelectionWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
26
24
|
displayName: "Mappingstyles__RowSelectionWrapper",
|
|
27
25
|
componentId: "sc-1f47eqt-5"
|
|
28
26
|
})(["flex:0 0 32px;"]);
|
|
29
|
-
|
|
27
|
+
const ColumnTitle = /* @__PURE__ */ styled(Title).withConfig({
|
|
30
28
|
displayName: "Mappingstyles__ColumnTitle",
|
|
31
29
|
componentId: "sc-1f47eqt-6"
|
|
32
30
|
})([""]);
|
|
33
|
-
|
|
31
|
+
const BatchSelectionWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
34
32
|
displayName: "Mappingstyles__BatchSelectionWrapper",
|
|
35
33
|
componentId: "sc-1f47eqt-7"
|
|
36
|
-
})(["display:flex;align-items:center;justify-content:space-between;gap:14px;border-bottom:solid 1px ", ";height:64px;"],
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
export var BatchActionButtons = styled.div.withConfig({
|
|
34
|
+
})(["display:flex;align-items:center;justify-content:space-between;gap:14px;border-bottom:solid 1px ", ";height:64px;"], (props) => props.theme.palette["grey-300"]);
|
|
35
|
+
const BatchActionButtons = /* @__PURE__ */ styled.div.withConfig({
|
|
40
36
|
displayName: "Mappingstyles__BatchActionButtons",
|
|
41
37
|
componentId: "sc-1f47eqt-8"
|
|
42
38
|
})(["display:flex;gap:8px;"]);
|
|
43
|
-
|
|
39
|
+
const BatchCounter = /* @__PURE__ */ styled.div.withConfig({
|
|
44
40
|
displayName: "Mappingstyles__BatchCounter",
|
|
45
41
|
componentId: "sc-1f47eqt-9"
|
|
46
42
|
})(["white-space:nowrap;"]);
|
|
47
|
-
|
|
43
|
+
const BatchSelectionInner = /* @__PURE__ */ styled.div.withConfig({
|
|
48
44
|
displayName: "Mappingstyles__BatchSelectionInner",
|
|
49
45
|
componentId: "sc-1f47eqt-10"
|
|
50
46
|
})(["display:flex;flex-grow:1;align-items:center;gap:24px;"]);
|
|
51
|
-
|
|
47
|
+
const BatchToggleButton = /* @__PURE__ */ styled.div.withConfig({
|
|
52
48
|
displayName: "Mappingstyles__BatchToggleButton",
|
|
53
49
|
componentId: "sc-1f47eqt-11"
|
|
54
|
-
})([""]);
|
|
50
|
+
})([""]);
|
|
51
|
+
export {
|
|
52
|
+
BatchActionButtons,
|
|
53
|
+
BatchCounter,
|
|
54
|
+
BatchSelectionInner,
|
|
55
|
+
BatchSelectionWrapper,
|
|
56
|
+
BatchToggleButton,
|
|
57
|
+
ColumnTitle,
|
|
58
|
+
MappingRow,
|
|
59
|
+
MappingRowCenter,
|
|
60
|
+
MappingRowLeft,
|
|
61
|
+
MappingRowRight,
|
|
62
|
+
MappingWrapper,
|
|
63
|
+
RowSelectionWrapper
|
|
64
|
+
};
|
package/dist/Mapping.types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CheckboxProps, CheckboxTristateProps } from '@synerise/ds-checkbox';
|
|
3
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
4
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
5
5
|
export type BaseItemType = {
|
|
6
6
|
id: string | number;
|
|
7
7
|
};
|
package/dist/Mapping.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BatchSelectionProps } from '../../Mapping.types';
|
|
3
3
|
export declare const BatchSelectionHeader: ({ counter, checkboxState, onChange, actionButtons, batchButton, enabled, }: BatchSelectionProps) => React.JSX.Element;
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Checkbox from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Checkbox from "@synerise/ds-checkbox";
|
|
3
|
+
import { BatchSelectionWrapper, RowSelectionWrapper, BatchSelectionInner, BatchCounter, BatchActionButtons, BatchToggleButton } from "../../Mapping.styles.js";
|
|
4
|
+
const BatchSelectionHeader = ({
|
|
5
|
+
counter,
|
|
6
|
+
checkboxState,
|
|
7
|
+
onChange,
|
|
8
|
+
actionButtons,
|
|
9
|
+
batchButton,
|
|
10
|
+
enabled
|
|
11
|
+
}) => {
|
|
12
|
+
const handleChange = () => {
|
|
12
13
|
if (checkboxState !== true) {
|
|
13
14
|
onChange(true);
|
|
14
15
|
} else {
|
|
15
16
|
onChange(false);
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
return
|
|
19
|
-
tristate: true,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
return /* @__PURE__ */ jsxs(BatchSelectionWrapper, { children: [
|
|
20
|
+
enabled && /* @__PURE__ */ jsx(RowSelectionWrapper, { children: /* @__PURE__ */ jsx(Checkbox, { tristate: true, withoutPadding: true, checked: checkboxState, onChange: handleChange }) }),
|
|
21
|
+
/* @__PURE__ */ jsxs(BatchSelectionInner, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(BatchCounter, { children: counter }),
|
|
23
|
+
enabled && checkboxState !== false && /* @__PURE__ */ jsx(BatchActionButtons, { children: actionButtons })
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ jsx(BatchToggleButton, { children: batchButton })
|
|
26
|
+
] });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
BatchSelectionHeader
|
|
30
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseItemType, RowSelectionProps } from '../../Mapping.types';
|
|
3
3
|
export declare const RowSelection: <T extends BaseItemType>({ itemId, checkboxState, onChange, }: RowSelectionProps<T>) => React.JSX.Element;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Checkbox from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}));
|
|
15
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Checkbox from "@synerise/ds-checkbox";
|
|
3
|
+
import { RowSelectionWrapper } from "../../Mapping.styles.js";
|
|
4
|
+
const RowSelection = ({
|
|
5
|
+
itemId,
|
|
6
|
+
checkboxState,
|
|
7
|
+
onChange
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(RowSelectionWrapper, { children: /* @__PURE__ */ jsx(Checkbox, { withoutPadding: true, checked: checkboxState, onChange: (event) => onChange(event.target.checked, itemId) }) });
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
RowSelection
|
|
13
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TitleRowProps } from '../../Mapping.types';
|
|
3
3
|
export declare const TitleRow: ({ leftTitle, leftTitleTooltip, rightTitle, rightTitleTooltip, hasCenterComponent, hasSelection, }: TitleRowProps) => React.JSX.Element;
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { theme } from
|
|
3
|
-
import Icon, { InfoFillS } from
|
|
4
|
-
import Tooltip from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { theme } from "@synerise/ds-core";
|
|
3
|
+
import Icon, { InfoFillS } from "@synerise/ds-icon";
|
|
4
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
5
|
+
import { MappingRow, RowSelectionWrapper, MappingRowLeft, ColumnTitle, MappingRowCenter } from "../../Mapping.styles.js";
|
|
6
|
+
const TitleRow = ({
|
|
7
|
+
leftTitle,
|
|
8
|
+
leftTitleTooltip,
|
|
9
|
+
rightTitle,
|
|
10
|
+
rightTitleTooltip,
|
|
11
|
+
hasCenterComponent,
|
|
12
|
+
hasSelection
|
|
13
|
+
}) => {
|
|
14
|
+
return /* @__PURE__ */ jsxs(MappingRow, { children: [
|
|
15
|
+
hasSelection && /* @__PURE__ */ jsx(RowSelectionWrapper, {}),
|
|
16
|
+
/* @__PURE__ */ jsx(MappingRowLeft, { children: /* @__PURE__ */ jsxs(ColumnTitle, { level: 6, children: [
|
|
17
|
+
leftTitle,
|
|
18
|
+
" ",
|
|
19
|
+
leftTitleTooltip && /* @__PURE__ */ jsx(Tooltip, { ...leftTitleTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), color: theme.palette["grey-400"] }) })
|
|
20
|
+
] }) }),
|
|
21
|
+
hasCenterComponent && /* @__PURE__ */ jsx(MappingRowCenter, {}),
|
|
22
|
+
/* @__PURE__ */ jsx(MappingRowLeft, { children: /* @__PURE__ */ jsxs(ColumnTitle, { level: 6, children: [
|
|
23
|
+
rightTitle,
|
|
24
|
+
" ",
|
|
25
|
+
rightTitleTooltip && /* @__PURE__ */ jsx(Tooltip, { ...rightTitleTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), color: theme.palette["grey-400"] }) })
|
|
26
|
+
] }) })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
TitleRow
|
|
31
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { BatchSelectionHeader } from "./BatchSelectionHeader/BatchSelectionHeader.js";
|
|
2
|
+
import { RowSelection } from "./RowSelection/RowSelection.js";
|
|
3
|
+
import { TitleRow } from "./TitleRow/TitleRow.js";
|
|
4
|
+
export {
|
|
5
|
+
BatchSelectionHeader,
|
|
6
|
+
RowSelection,
|
|
7
|
+
TitleRow
|
|
8
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseItemType } from '../Mapping.types';
|
|
2
2
|
export declare const useBatchSelection: <ItemType extends BaseItemType>(dataSource: Array<ItemType>, hasBatchSelection?: boolean) => {
|
|
3
3
|
selectedItemIds: ItemType["id"][];
|
|
4
4
|
batchSelectionCheckboxState: boolean | undefined;
|
|
5
|
-
setSelectedItemIds: import(
|
|
5
|
+
setSelectedItemIds: import('react').Dispatch<import('react').SetStateAction<ItemType["id"][]>>;
|
|
6
6
|
handleBatchCheckboxChange: (newVal: boolean | undefined) => void;
|
|
7
7
|
};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
setSelectedItemIds = _useState[1];
|
|
6
|
-
var handleBatchCheckboxChange = function handleBatchCheckboxChange(newVal) {
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
const useBatchSelection = (dataSource, hasBatchSelection) => {
|
|
3
|
+
const [selectedItemIds, setSelectedItemIds] = useState([]);
|
|
4
|
+
const handleBatchCheckboxChange = (newVal) => {
|
|
7
5
|
if (newVal === true) {
|
|
8
|
-
setSelectedItemIds(dataSource.map(
|
|
9
|
-
return item.id;
|
|
10
|
-
}));
|
|
6
|
+
setSelectedItemIds(dataSource.map((item) => item.id));
|
|
11
7
|
return;
|
|
12
8
|
}
|
|
13
9
|
if (newVal === false) {
|
|
14
10
|
setSelectedItemIds([]);
|
|
15
11
|
}
|
|
16
12
|
};
|
|
17
|
-
|
|
13
|
+
const batchSelectionCheckboxState = useMemo(() => {
|
|
18
14
|
if (hasBatchSelection) {
|
|
19
15
|
switch (dataSource.length - selectedItemIds.length) {
|
|
20
16
|
case 0:
|
|
@@ -22,15 +18,18 @@ export var useBatchSelection = function useBatchSelection(dataSource, hasBatchSe
|
|
|
22
18
|
case dataSource.length:
|
|
23
19
|
return false;
|
|
24
20
|
default:
|
|
25
|
-
return
|
|
21
|
+
return void 0;
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
return
|
|
24
|
+
return void 0;
|
|
29
25
|
}, [dataSource, selectedItemIds, hasBatchSelection]);
|
|
30
26
|
return {
|
|
31
|
-
selectedItemIds
|
|
32
|
-
batchSelectionCheckboxState
|
|
33
|
-
setSelectedItemIds
|
|
34
|
-
handleBatchCheckboxChange
|
|
27
|
+
selectedItemIds,
|
|
28
|
+
batchSelectionCheckboxState,
|
|
29
|
+
setSelectedItemIds,
|
|
30
|
+
handleBatchCheckboxChange
|
|
35
31
|
};
|
|
36
|
-
};
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
useBatchSelection
|
|
35
|
+
};
|
package/dist/hooks/useTexts.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MappingTexts } from '../Mapping.types';
|
|
2
2
|
export declare const useTexts: (defaultTexts?: Partial<MappingTexts>) => MappingTexts;
|
package/dist/hooks/useTexts.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, [defaultTexts, formatMessage]);
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
const useTexts = (defaultTexts) => {
|
|
4
|
+
const {
|
|
5
|
+
formatMessage
|
|
6
|
+
} = useIntl();
|
|
7
|
+
const texts = useMemo(() => ({
|
|
8
|
+
enableBatchSelection: formatMessage({
|
|
9
|
+
id: "DS.MAPPING.BULK_ACTIONS_ENABLE",
|
|
10
|
+
defaultMessage: "Bulk actions"
|
|
11
|
+
}),
|
|
12
|
+
disableBatchSelection: formatMessage({
|
|
13
|
+
id: "DS.MAPPING.BULK_ACTIONS_DISABLE",
|
|
14
|
+
defaultMessage: "Hide actions"
|
|
15
|
+
}),
|
|
16
|
+
...defaultTexts
|
|
17
|
+
}), [defaultTexts, formatMessage]);
|
|
19
18
|
return texts;
|
|
20
|
-
};
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useTexts
|
|
22
|
+
};
|
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/dist/utils/counter.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
export declare const renderCounter: (selected: number, total: number) => React.JSX.Element;
|
package/dist/utils/counter.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
const renderCounter = (selected, total) => {
|
|
3
3
|
if (selected === 0) {
|
|
4
|
-
return
|
|
4
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5
|
+
total,
|
|
6
|
+
" Items"
|
|
7
|
+
] });
|
|
5
8
|
}
|
|
6
|
-
return
|
|
7
|
-
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
selected,
|
|
11
|
+
" Selected"
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
renderCounter
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-mapping",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
4
4
|
"description": "Mapping 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",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-button": "^1.5.
|
|
39
|
-
"@synerise/ds-checkbox": "^1.2.
|
|
40
|
-
"@synerise/ds-icon": "^1.15.
|
|
41
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
42
|
-
"@synerise/ds-typography": "^1.1.
|
|
43
|
-
"@synerise/ds-utils": "^1.7.
|
|
38
|
+
"@synerise/ds-button": "^1.5.19",
|
|
39
|
+
"@synerise/ds-checkbox": "^1.2.22",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.2",
|
|
41
|
+
"@synerise/ds-tooltip": "^1.4.11",
|
|
42
|
+
"@synerise/ds-typography": "^1.1.14",
|
|
43
|
+
"@synerise/ds-utils": "^1.7.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@synerise/ds-core": "*",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
50
50
|
"styled-components": "^5.3.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
|
|
53
53
|
}
|