@synerise/ds-form 0.3.1 → 0.4.0
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 +11 -0
- package/dist/editable-list/__spec__/editable-list.spec.d.ts +0 -0
- package/dist/editable-list/__spec__/editable-list.spec.js +9 -0
- package/dist/editable-list/editable-list.js +14 -10
- package/dist/editable-list/editable-list.styles.js +3 -3
- package/dist/editable-list/editable-list.types.d.ts +3 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [0.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-form@0.3.1...@synerise/ds-form@0.4.0) (2022-08-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **form:** add index for render column functions in EditableList ([54a2699](https://github.com/Synerise/synerise-design/commit/54a26997a4b6d136273da47f20b14ff17939119b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.3.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-form@0.3.0...@synerise/ds-form@0.3.1) (2022-08-25)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-form
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
describe('editable-list', function () {
|
|
2
|
+
it.todo('is able to invalidate every second row'
|
|
3
|
+
/* () => {
|
|
4
|
+
const container = renderWithProvider(<EditableList value={[{}, {}, {}, {}]} renderLeftColumn={(param, i) => <input className={i % 2 == 'error' : ''}/>}>)
|
|
5
|
+
container.querySelectorAll('.error')
|
|
6
|
+
return render
|
|
7
|
+
} */
|
|
8
|
+
);
|
|
9
|
+
});
|
|
@@ -15,6 +15,7 @@ export var EditableList = function EditableList(_ref) {
|
|
|
15
15
|
_onChange = _ref.onChange,
|
|
16
16
|
textAddButton = _ref.textAddButton,
|
|
17
17
|
onSearch = _ref.onSearch,
|
|
18
|
+
onClickAddRow = _ref.onClickAddRow,
|
|
18
19
|
renderAddButton = _ref.renderAddButton,
|
|
19
20
|
renderLeftColumn = _ref.renderLeftColumn,
|
|
20
21
|
renderRightColumn = _ref.renderRightColumn,
|
|
@@ -37,6 +38,16 @@ export var EditableList = function EditableList(_ref) {
|
|
|
37
38
|
React.useEffect(function () {
|
|
38
39
|
setParams(value);
|
|
39
40
|
}, [value]);
|
|
41
|
+
|
|
42
|
+
var onSetParamsDefault = function onSetParamsDefault() {
|
|
43
|
+
return setParams(function (prevParams) {
|
|
44
|
+
return [].concat(prevParams || [], [{
|
|
45
|
+
name: '',
|
|
46
|
+
value: ''
|
|
47
|
+
}]);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
40
51
|
return /*#__PURE__*/React.createElement("div", null, params == null ? void 0 : params.map(function (param, id) {
|
|
41
52
|
var _renderLeftColumn, _renderRightColumn;
|
|
42
53
|
|
|
@@ -45,7 +56,7 @@ export var EditableList = function EditableList(_ref) {
|
|
|
45
56
|
// eslint-disable-next-line react/no-array-index-key
|
|
46
57
|
React.createElement(S.RowWrapper, {
|
|
47
58
|
key: id
|
|
48
|
-
}, (_renderLeftColumn = renderLeftColumn == null ? void 0 : renderLeftColumn(param)) != null ? _renderLeftColumn : /*#__PURE__*/React.createElement(S.AutoCompleteWrapper, null, /*#__PURE__*/React.createElement(Autocomplete, {
|
|
59
|
+
}, (_renderLeftColumn = renderLeftColumn == null ? void 0 : renderLeftColumn(param, id)) != null ? _renderLeftColumn : /*#__PURE__*/React.createElement(S.AutoCompleteWrapper, null, /*#__PURE__*/React.createElement(Autocomplete, {
|
|
49
60
|
style: {
|
|
50
61
|
width: 350
|
|
51
62
|
},
|
|
@@ -57,7 +68,7 @@ export var EditableList = function EditableList(_ref) {
|
|
|
57
68
|
if (_onChange) _onChange(newParams);
|
|
58
69
|
},
|
|
59
70
|
label: id === 0 ? leftColumnName : null
|
|
60
|
-
}, autocompleteOptions)), (_renderRightColumn = renderRightColumn == null ? void 0 : renderRightColumn(param)) != null ? _renderRightColumn : /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, {
|
|
71
|
+
}, autocompleteOptions)), (_renderRightColumn = renderRightColumn == null ? void 0 : renderRightColumn(param, id)) != null ? _renderRightColumn : /*#__PURE__*/React.createElement(S.InputWrapper, null, /*#__PURE__*/React.createElement(Input, {
|
|
61
72
|
value: param.value,
|
|
62
73
|
onChange: function onChange(ev) {
|
|
63
74
|
var newParams = paramsWithNewValue(id, param.name, ev.target.value);
|
|
@@ -77,14 +88,7 @@ export var EditableList = function EditableList(_ref) {
|
|
|
77
88
|
})) || undefined)
|
|
78
89
|
);
|
|
79
90
|
}), (_renderAddButton = renderAddButton == null ? void 0 : renderAddButton()) != null ? _renderAddButton : /*#__PURE__*/React.createElement(S.ButtonWrapper, null, /*#__PURE__*/React.createElement(S.AddButton, {
|
|
80
|
-
onClick:
|
|
81
|
-
return setParams(function (prevParams) {
|
|
82
|
-
return [].concat(prevParams || [], [{
|
|
83
|
-
name: '',
|
|
84
|
-
value: ''
|
|
85
|
-
}]);
|
|
86
|
-
});
|
|
87
|
-
},
|
|
91
|
+
onClick: onClickAddRow || onSetParamsDefault,
|
|
88
92
|
type: "ghost-primary"
|
|
89
93
|
}, /*#__PURE__*/React.createElement(S.AddIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
90
94
|
component: /*#__PURE__*/React.createElement(Add3M, null),
|
|
@@ -3,7 +3,7 @@ import Button from '@synerise/ds-button';
|
|
|
3
3
|
export var RowWrapper = styled.div.withConfig({
|
|
4
4
|
displayName: "editable-liststyles__RowWrapper",
|
|
5
5
|
componentId: "ctaimf-0"
|
|
6
|
-
})(["@media (min-width:1280px){display:flex;padding:8px 200px 8px 0px;align-items:
|
|
6
|
+
})(["@media (min-width:1280px){display:flex;padding:8px 200px 8px 0px;align-items:start;}padding:8px 0px 8px 0px;"]);
|
|
7
7
|
export var AutoCompleteWrapper = styled.div.withConfig({
|
|
8
8
|
displayName: "editable-liststyles__AutoCompleteWrapper",
|
|
9
9
|
componentId: "ctaimf-1"
|
|
@@ -23,8 +23,8 @@ export var AddIconWrapper = styled.div.withConfig({
|
|
|
23
23
|
export var CrudWrapper = styled.div.withConfig({
|
|
24
24
|
displayName: "editable-liststyles__CrudWrapper",
|
|
25
25
|
componentId: "ctaimf-5"
|
|
26
|
-
})(["padding-left:4px;margin:", ";"], function (props) {
|
|
27
|
-
return props.marginWithLabel ? '
|
|
26
|
+
})(["padding-left:4px;margin-top:", ";"], function (props) {
|
|
27
|
+
return props.marginWithLabel ? '30px' : '4px';
|
|
28
28
|
});
|
|
29
29
|
export var InputWrapper = styled.div.withConfig({
|
|
30
30
|
displayName: "editable-liststyles__InputWrapper",
|
|
@@ -10,10 +10,11 @@ export declare type EditListProps = {
|
|
|
10
10
|
value?: EditableParam[];
|
|
11
11
|
onChange?: (params: EditableParam[]) => void;
|
|
12
12
|
onSearch?: (query: string) => void;
|
|
13
|
+
onClickAddRow?: () => void;
|
|
13
14
|
textAddButton?: string;
|
|
14
15
|
renderAddButton?: (params?: EditableParam[]) => JSX.Element;
|
|
15
|
-
renderLeftColumn?: (
|
|
16
|
-
renderRightColumn?: (
|
|
16
|
+
renderLeftColumn?: (param?: EditableParam, index?: number) => JSX.Element;
|
|
17
|
+
renderRightColumn?: (param?: EditableParam, index?: number, ref?: React.ClassAttributes<{}>['ref']) => JSX.Element;
|
|
17
18
|
renderAdditionalColumn?: (row?: EditableParam[]) => JSX.Element;
|
|
18
19
|
renderActions?: boolean | ((param?: EditableParam, idx?: number, params?: EditableParam[]) => JSX.Element);
|
|
19
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Form UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@synerise/ds-cruds": "^0.3.16",
|
|
37
37
|
"@synerise/ds-divider": "^0.5.19",
|
|
38
38
|
"@synerise/ds-icon": "^0.50.0",
|
|
39
|
-
"@synerise/ds-input": "^0.18.
|
|
39
|
+
"@synerise/ds-input": "^0.18.18",
|
|
40
40
|
"@synerise/ds-typography": "^0.12.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@synerise/ds-utils": "^0.22.8"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c92d02f04157e6b1189eb59bba9dea4c1594c123"
|
|
50
50
|
}
|