@sis-cc/dotstatsuite-visions 7.17.0 → 7.17.2

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.
@@ -27,7 +27,7 @@ var AxisConfig = function AxisConfig(_ref) {
27
27
  { container: true, spacing: 1, className: classes.inputContainer },
28
28
  isActive(min) && React.createElement(
29
29
  Grid,
30
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: cx(classes.axis, classes.wrapper) },
30
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
31
31
  React.createElement(Input, _extends({}, min, {
32
32
  value: R.when(R.isNil, R.always(''))(min.value),
33
33
  type: 'number',
@@ -40,7 +40,7 @@ var AxisConfig = function AxisConfig(_ref) {
40
40
  ),
41
41
  isActive(max) && React.createElement(
42
42
  Grid,
43
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: cx(classes.axis, classes.wrapper) },
43
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
44
44
  React.createElement(Input, _extends({}, max, {
45
45
  value: R.when(R.isNil, R.always(''))(max.value),
46
46
  type: 'number',
@@ -53,7 +53,7 @@ var AxisConfig = function AxisConfig(_ref) {
53
53
  ),
54
54
  isActive(pivot) && React.createElement(
55
55
  Grid,
56
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: cx(classes.axis, classes.wrapper) },
56
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
57
57
  React.createElement(Input, _extends({}, pivot, {
58
58
  value: R.when(R.isNil, R.always(''))(pivot.value),
59
59
  type: 'number',
@@ -66,7 +66,7 @@ var AxisConfig = function AxisConfig(_ref) {
66
66
  ),
67
67
  isActive(step) && React.createElement(
68
68
  Grid,
69
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: cx(classes.axis, classes.wrapper) },
69
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: cx(classes.axis, classes.wrapper) },
70
70
  React.createElement(Input, _extends({}, step, {
71
71
  value: R.when(R.isNil, R.always(''))(step.value),
72
72
  type: 'number',
@@ -34,6 +34,12 @@ export var useStyles = makeStyles(function (theme) {
34
34
  paddingTop: '0px !important', // spacing items
35
35
  paddingBottom: '0px !important' // spacing items
36
36
  },
37
+ ellipsis: {
38
+ whiteSpace: 'nowrap',
39
+ overflow: 'hidden',
40
+ textOverflow: 'ellipsis',
41
+ flexFlow: 'nowrap'
42
+ },
37
43
  marginDense: {
38
44
  marginBottom: '0px !important'
39
45
  },
@@ -37,7 +37,7 @@ var UserRightForm = function UserRightForm(_ref) {
37
37
  artefactTypes = _ref.artefactTypes,
38
38
  dataSpaces = _ref.dataSpaces,
39
39
  permissionTabs = _ref.permissionTabs,
40
- apply = _ref.apply,
40
+ onSubmit = _ref.onSubmit,
41
41
  onCancel = _ref.onCancel,
42
42
  user = _ref.user,
43
43
  artefactID = _ref.artefactID,
@@ -108,9 +108,9 @@ var UserRightForm = function UserRightForm(_ref) {
108
108
  }
109
109
  };
110
110
  var evolvedPermissions = R.pipe(R.over(R.lensPath(['options', 'data']), R.map(function (opt) {
111
- return R.assoc('isSelected', R.has(opt.id, selectedPermissions), opt);
111
+ return R.pipe(R.assoc('isSelected', R.has(opt.id, selectedPermissions)), R.assoc('disabled', !R.is(Function, onSubmit)))(opt);
112
112
  })), R.over(R.lensPath(['permissions', 'data']), R.map(function (opt) {
113
- return R.assoc('isSelected', R.has(opt.id, selectedPermissionsGroups), opt);
113
+ return R.pipe(R.assoc('isSelected', R.has(opt.id, selectedPermissionsGroups)), R.assoc('disabled', !R.is(Function, onSubmit)))(opt);
114
114
  })))(permissionTabs);
115
115
 
116
116
  var onChangeDataspace = function onChangeDataspace(value) {
@@ -124,7 +124,7 @@ var UserRightForm = function UserRightForm(_ref) {
124
124
  if (R.is(Function)(onCancel)) return onCancel();
125
125
  };
126
126
  var handleSubmit = function handleSubmit() {
127
- if (R.is(Function)(apply)) return apply({
127
+ if (R.is(Function)(onSubmit)) return onSubmit({
128
128
  user: userValue,
129
129
  dataspace: dataspaceValue,
130
130
  artefactType: artefactTypeValue,
@@ -137,11 +137,19 @@ var UserRightForm = function UserRightForm(_ref) {
137
137
 
138
138
  var isErrorDataspace = R.pipe(R.find(R.propEq('value', dataspaceValue)), R.isNil)(dataSpaces);
139
139
  var isErrorArtefactType = R.pipe(R.find(R.propEq('value', artefactTypeValue)), R.isNil)(artefactTypes);
140
- var isValidPermissions = !R.isEmpty(selectedPermissions) && !R.equals(selectedPermissions, initialSelectedPermissions);
140
+ var isValidPermissions = !R.isEmpty(selectedPermissions);
141
141
  var isValidFields = R.all(function (value) {
142
142
  return !R.isEmpty(value) && !R.isNil(value);
143
143
  }, [userValue, maintenanceAgencyIDValue, artefactIDValue, artefactVersionValue, dataspaceValue, artefactTypeValue]);
144
144
 
145
+ var hasPermissionsSelectionChanged = !R.equals(selectedPermissions, initialSelectedPermissions);
146
+ var hasFieldsChanged = !R.all(function (_ref4) {
147
+ var state = _ref4[0],
148
+ initial = _ref4[1];
149
+ return R.equals(state, initial);
150
+ }, [[userValue, R.propOr('', 'value', user)], [maintenanceAgencyIDValue, R.propOr('', 'value', maintenanceAgencyID)], [artefactIDValue, R.propOr('', 'value', artefactID)], [artefactVersionValue, R.propOr('', 'value', artefactVersion)], [dataspaceValue, R.propOr('', 'value', dataspace)], [artefactTypeValue, R.propOr('', 'value', artefactType)]]);
151
+ var isValid = isValidPermissions && isValidFields && (hasPermissionsSelectionChanged || hasFieldsChanged);
152
+
145
153
  return React.createElement(
146
154
  Grid,
147
155
  { container: true, className: classes.paper, 'data-testid': 'permission-test-id' },
@@ -361,7 +369,7 @@ var UserRightForm = function UserRightForm(_ref) {
361
369
  R.prop('cancel')(labels)
362
370
  )
363
371
  ),
364
- React.createElement(
372
+ R.is(Function, onSubmit) && React.createElement(
365
373
  Grid,
366
374
  { item: true },
367
375
  React.createElement(
@@ -369,7 +377,7 @@ var UserRightForm = function UserRightForm(_ref) {
369
377
  {
370
378
  'aria-label': R.prop('submit')(labels),
371
379
  type: 'submit',
372
- disabled: !isValidPermissions || !isValidFields || isErrorArtefactType || isErrorDataspace,
380
+ disabled: !isValid || isErrorArtefactType || isErrorDataspace,
373
381
  variant: 'contained',
374
382
  color: 'primary',
375
383
  alternative: 'siscc',
@@ -384,7 +392,7 @@ var UserRightForm = function UserRightForm(_ref) {
384
392
  );
385
393
  };
386
394
  UserRightForm.propTypes = process.env.NODE_ENV !== "production" ? {
387
- apply: PropTypes.func,
395
+ onSubmit: PropTypes.func,
388
396
  onCancel: PropTypes.func,
389
397
  artefactTypes: PropTypes.arrayOf(PropTypes.shape({
390
398
  value: PropTypes.string,
@@ -1,14 +1,12 @@
1
1
  /**
2
- * A modified version of the vanilla Material UI button with selected props
3
- *
4
- * Permission allows to add or edit permission
2
+ * UserRightForm allows to view and edit an user right
5
3
  * @memberOf VISIONS
6
- * @name Permission
4
+ * @name UserRightForm
7
5
  * @tag component
8
6
  * @api public
9
7
  *
10
- * Permission.propTypes = {
11
- * apply: PropTypes.func,
8
+ * UserRightForm.propTypes = {
9
+ * onSubmit: PropTypes.func,
12
10
  * onCancel: PropTypes.func,
13
11
  * artefactTypes: PropTypes.arrayOf(
14
12
  * PropTypes.shape({
@@ -58,7 +58,7 @@ var AxisConfig = function AxisConfig(_ref) {
58
58
  { container: true, spacing: 1, className: classes.inputContainer },
59
59
  (0, _utils.isActive)(min) && _react2.default.createElement(
60
60
  _Grid2.default,
61
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
61
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
62
62
  _react2.default.createElement(_Input2.default, _extends({}, min, {
63
63
  value: R.when(R.isNil, R.always(''))(min.value),
64
64
  type: 'number',
@@ -71,7 +71,7 @@ var AxisConfig = function AxisConfig(_ref) {
71
71
  ),
72
72
  (0, _utils.isActive)(max) && _react2.default.createElement(
73
73
  _Grid2.default,
74
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
74
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
75
75
  _react2.default.createElement(_Input2.default, _extends({}, max, {
76
76
  value: R.when(R.isNil, R.always(''))(max.value),
77
77
  type: 'number',
@@ -84,7 +84,7 @@ var AxisConfig = function AxisConfig(_ref) {
84
84
  ),
85
85
  (0, _utils.isActive)(pivot) && _react2.default.createElement(
86
86
  _Grid2.default,
87
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
87
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
88
88
  _react2.default.createElement(_Input2.default, _extends({}, pivot, {
89
89
  value: R.when(R.isNil, R.always(''))(pivot.value),
90
90
  type: 'number',
@@ -97,7 +97,7 @@ var AxisConfig = function AxisConfig(_ref) {
97
97
  ),
98
98
  (0, _utils.isActive)(step) && _react2.default.createElement(
99
99
  _Grid2.default,
100
- { item: true, xs: 12, sm: 12, md: 6, lg: 3, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
100
+ { item: true, xs: 12, sm: 12, md: 6, lg: 4, className: (0, _classnames2.default)(classes.axis, classes.wrapper) },
101
101
  _react2.default.createElement(_Input2.default, _extends({}, step, {
102
102
  value: R.when(R.isNil, R.always(''))(step.value),
103
103
  type: 'number',
@@ -44,6 +44,12 @@ var useStyles = exports.useStyles = (0, _styles.makeStyles)(function (theme) {
44
44
  paddingTop: '0px !important', // spacing items
45
45
  paddingBottom: '0px !important' // spacing items
46
46
  },
47
+ ellipsis: {
48
+ whiteSpace: 'nowrap',
49
+ overflow: 'hidden',
50
+ textOverflow: 'ellipsis',
51
+ flexFlow: 'nowrap'
52
+ },
47
53
  marginDense: {
48
54
  marginBottom: '0px !important'
49
55
  },
@@ -67,7 +67,7 @@ var UserRightForm = function UserRightForm(_ref) {
67
67
  artefactTypes = _ref.artefactTypes,
68
68
  dataSpaces = _ref.dataSpaces,
69
69
  permissionTabs = _ref.permissionTabs,
70
- apply = _ref.apply,
70
+ onSubmit = _ref.onSubmit,
71
71
  onCancel = _ref.onCancel,
72
72
  user = _ref.user,
73
73
  artefactID = _ref.artefactID,
@@ -138,9 +138,9 @@ var UserRightForm = function UserRightForm(_ref) {
138
138
  }
139
139
  };
140
140
  var evolvedPermissions = R.pipe(R.over(R.lensPath(['options', 'data']), R.map(function (opt) {
141
- return R.assoc('isSelected', R.has(opt.id, selectedPermissions), opt);
141
+ return R.pipe(R.assoc('isSelected', R.has(opt.id, selectedPermissions)), R.assoc('disabled', !R.is(Function, onSubmit)))(opt);
142
142
  })), R.over(R.lensPath(['permissions', 'data']), R.map(function (opt) {
143
- return R.assoc('isSelected', R.has(opt.id, selectedPermissionsGroups), opt);
143
+ return R.pipe(R.assoc('isSelected', R.has(opt.id, selectedPermissionsGroups)), R.assoc('disabled', !R.is(Function, onSubmit)))(opt);
144
144
  })))(permissionTabs);
145
145
 
146
146
  var onChangeDataspace = function onChangeDataspace(value) {
@@ -154,7 +154,7 @@ var UserRightForm = function UserRightForm(_ref) {
154
154
  if (R.is(Function)(onCancel)) return onCancel();
155
155
  };
156
156
  var handleSubmit = function handleSubmit() {
157
- if (R.is(Function)(apply)) return apply({
157
+ if (R.is(Function)(onSubmit)) return onSubmit({
158
158
  user: userValue,
159
159
  dataspace: dataspaceValue,
160
160
  artefactType: artefactTypeValue,
@@ -167,11 +167,19 @@ var UserRightForm = function UserRightForm(_ref) {
167
167
 
168
168
  var isErrorDataspace = R.pipe(R.find(R.propEq('value', dataspaceValue)), R.isNil)(dataSpaces);
169
169
  var isErrorArtefactType = R.pipe(R.find(R.propEq('value', artefactTypeValue)), R.isNil)(artefactTypes);
170
- var isValidPermissions = !R.isEmpty(selectedPermissions) && !R.equals(selectedPermissions, initialSelectedPermissions);
170
+ var isValidPermissions = !R.isEmpty(selectedPermissions);
171
171
  var isValidFields = R.all(function (value) {
172
172
  return !R.isEmpty(value) && !R.isNil(value);
173
173
  }, [userValue, maintenanceAgencyIDValue, artefactIDValue, artefactVersionValue, dataspaceValue, artefactTypeValue]);
174
174
 
175
+ var hasPermissionsSelectionChanged = !R.equals(selectedPermissions, initialSelectedPermissions);
176
+ var hasFieldsChanged = !R.all(function (_ref4) {
177
+ var state = _ref4[0],
178
+ initial = _ref4[1];
179
+ return R.equals(state, initial);
180
+ }, [[userValue, R.propOr('', 'value', user)], [maintenanceAgencyIDValue, R.propOr('', 'value', maintenanceAgencyID)], [artefactIDValue, R.propOr('', 'value', artefactID)], [artefactVersionValue, R.propOr('', 'value', artefactVersion)], [dataspaceValue, R.propOr('', 'value', dataspace)], [artefactTypeValue, R.propOr('', 'value', artefactType)]]);
181
+ var isValid = isValidPermissions && isValidFields && (hasPermissionsSelectionChanged || hasFieldsChanged);
182
+
175
183
  return _react2.default.createElement(
176
184
  _core.Grid,
177
185
  { container: true, className: classes.paper, 'data-testid': 'permission-test-id' },
@@ -391,7 +399,7 @@ var UserRightForm = function UserRightForm(_ref) {
391
399
  R.prop('cancel')(labels)
392
400
  )
393
401
  ),
394
- _react2.default.createElement(
402
+ R.is(Function, onSubmit) && _react2.default.createElement(
395
403
  _core.Grid,
396
404
  { item: true },
397
405
  _react2.default.createElement(
@@ -399,7 +407,7 @@ var UserRightForm = function UserRightForm(_ref) {
399
407
  {
400
408
  'aria-label': R.prop('submit')(labels),
401
409
  type: 'submit',
402
- disabled: !isValidPermissions || !isValidFields || isErrorArtefactType || isErrorDataspace,
410
+ disabled: !isValid || isErrorArtefactType || isErrorDataspace,
403
411
  variant: 'contained',
404
412
  color: 'primary',
405
413
  alternative: 'siscc',
@@ -414,7 +422,7 @@ var UserRightForm = function UserRightForm(_ref) {
414
422
  );
415
423
  };
416
424
  UserRightForm.propTypes = process.env.NODE_ENV !== "production" ? {
417
- apply: _propTypes2.default.func,
425
+ onSubmit: _propTypes2.default.func,
418
426
  onCancel: _propTypes2.default.func,
419
427
  artefactTypes: _propTypes2.default.arrayOf(_propTypes2.default.shape({
420
428
  value: _propTypes2.default.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "7.17.0",
3
+ "version": "7.17.2",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",