@reltio/components 1.4.857 → 1.4.859

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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ value: string;
4
+ isSelected?: boolean;
5
+ onClick?: () => void;
6
+ };
7
+ declare const ContributorItem: ({ value, isSelected, onClick }: Props) => JSX.Element;
8
+ export default ContributorItem;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var react_1 = __importDefault(require("react"));
7
+ var classnames_1 = __importDefault(require("classnames"));
8
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
9
+ var styles_1 = require("./styles");
10
+ var ContributorItem = function (_a) {
11
+ var _b;
12
+ var value = _a.value, _c = _a.isSelected, isSelected = _c === void 0 ? true : _c, onClick = _a.onClick;
13
+ var color = mdm_sdk_1.getContributorColor(value);
14
+ var styles = styles_1.useContributorStyles({ color: color });
15
+ return (react_1.default.createElement("div", { className: classnames_1.default(styles.icon, (_b = {},
16
+ _b[styles.inactive] = !isSelected,
17
+ _b[styles.active] = isSelected,
18
+ _b[styles.clickable] = !!onClick,
19
+ _b)), onClick: onClick }));
20
+ };
21
+ exports.default = ContributorItem;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ values: string[];
4
+ selectedValues: string[];
5
+ onSelectValues: (values: string[]) => void;
6
+ entityUri: string;
7
+ className?: string;
8
+ };
9
+ declare const ContributorsPanel: ({ values, selectedValues, entityUri, onSelectValues, className }: Props) => JSX.Element;
10
+ export default ContributorsPanel;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
4
+ to[j] = from[i];
5
+ return to;
6
+ };
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ var react_1 = __importDefault(require("react"));
12
+ var classnames_1 = __importDefault(require("classnames"));
13
+ var ramda_1 = require("ramda");
14
+ var ContributorItem_1 = __importDefault(require("./ContributorItem"));
15
+ var styles_1 = require("./styles");
16
+ var ContributorsPanel = function (_a) {
17
+ var values = _a.values, selectedValues = _a.selectedValues, entityUri = _a.entityUri, onSelectValues = _a.onSelectValues, className = _a.className;
18
+ var styles = styles_1.useStyles();
19
+ var handleClick = function (value) {
20
+ if (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(value)) {
21
+ onSelectValues(ramda_1.without([value], selectedValues));
22
+ }
23
+ else {
24
+ onSelectValues(__spreadArray(__spreadArray([], (selectedValues || [])), [value]));
25
+ }
26
+ };
27
+ return (react_1.default.createElement("div", { className: classnames_1.default(styles.root, className) },
28
+ react_1.default.createElement(ContributorItem_1.default, { value: entityUri }),
29
+ (values === null || values === void 0 ? void 0 : values.length) > 0 &&
30
+ values.map(function (value) { return (react_1.default.createElement(ContributorItem_1.default, { key: value, value: value, isSelected: selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(value), onClick: function () { return handleClick(value); } })); })));
31
+ };
32
+ exports.default = ContributorsPanel;
@@ -0,0 +1,6 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"root">;
2
+ declare type StylesProps = {
3
+ color: string;
4
+ };
5
+ export declare const useContributorStyles: (props: StylesProps) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon" | "active" | "inactive" | "clickable">;
6
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useContributorStyles = exports.useStyles = void 0;
4
+ var styles_1 = require("@material-ui/core/styles");
5
+ exports.useStyles = styles_1.makeStyles({
6
+ root: {
7
+ flex: 1,
8
+ display: 'flex',
9
+ flexWrap: 'wrap',
10
+ padding: '10px 15px'
11
+ }
12
+ });
13
+ exports.useContributorStyles = styles_1.makeStyles({
14
+ icon: function (_a) {
15
+ var color = _a.color;
16
+ return ({
17
+ boxSizing: 'border-box',
18
+ borderWidth: 2,
19
+ borderStyle: 'solid',
20
+ borderColor: color,
21
+ height: 12,
22
+ width: 12,
23
+ borderRadius: 30,
24
+ transition: 'opacity 0.3s',
25
+ margin: 4
26
+ });
27
+ },
28
+ active: function (_a) {
29
+ var color = _a.color;
30
+ return ({
31
+ backgroundColor: color
32
+ });
33
+ },
34
+ inactive: {
35
+ backgroundColor: 'white'
36
+ },
37
+ clickable: {
38
+ cursor: 'pointer'
39
+ }
40
+ });
@@ -3,6 +3,8 @@ import React from 'react';
3
3
  declare type Props = {
4
4
  isLoading: boolean;
5
5
  historyWithTotal: HistoryWithTotal;
6
+ contributorsUris: string[];
7
+ entityUri: string;
6
8
  };
7
- declare const _default: React.MemoExoticComponent<({ isLoading, historyWithTotal }: Props) => JSX.Element>;
9
+ declare const _default: React.MemoExoticComponent<({ isLoading, historyWithTotal, contributorsUris, entityUri }: Props) => JSX.Element>;
8
10
  export default _default;
@@ -18,12 +18,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
21
24
  Object.defineProperty(exports, "__esModule", { value: true });
22
25
  var react_1 = __importStar(require("react"));
26
+ var ContributorsPanel_1 = __importDefault(require("../ContributorsPanel/ContributorsPanel"));
23
27
  var styles_1 = require("./styles");
24
28
  var HistoryView = function (_a) {
25
- var isLoading = _a.isLoading, historyWithTotal = _a.historyWithTotal;
29
+ var isLoading = _a.isLoading, historyWithTotal = _a.historyWithTotal, contributorsUris = _a.contributorsUris, entityUri = _a.entityUri;
26
30
  var styles = styles_1.useStyles();
27
- return react_1.default.createElement("div", { className: styles.root }, !isLoading && react_1.default.createElement("div", null, "total: " + (historyWithTotal === null || historyWithTotal === void 0 ? void 0 : historyWithTotal.total)));
31
+ var _b = react_1.useState(null), selectedUris = _b[0], setSelectedUris = _b[1];
32
+ react_1.useEffect(function () {
33
+ setSelectedUris(contributorsUris);
34
+ }, [contributorsUris]);
35
+ return (react_1.default.createElement("div", { className: styles.root },
36
+ react_1.default.createElement(ContributorsPanel_1.default, { values: contributorsUris, selectedValues: selectedUris, onSelectValues: setSelectedUris, entityUri: entityUri, className: styles.borderBottom }),
37
+ !isLoading && react_1.default.createElement("div", null, "total: " + (historyWithTotal === null || historyWithTotal === void 0 ? void 0 : historyWithTotal.total))));
28
38
  };
29
39
  exports.default = react_1.memo(HistoryView);
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"root">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"borderBottom" | "root">;
@@ -5,5 +5,8 @@ var styles_1 = require("@material-ui/core/styles");
5
5
  exports.useStyles = styles_1.makeStyles({
6
6
  root: {
7
7
  flex: 1
8
+ },
9
+ borderBottom: {
10
+ borderBottom: '1px solid rgba(0, 0, 0, 0.12)'
8
11
  }
9
12
  });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.857",
3
+ "version": "1.4.859",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
7
  "@date-io/moment": "^1.3.5",
8
8
  "@react-google-maps/api": "^2.7.0",
9
- "@reltio/mdm-module": "^1.4.857",
10
- "@reltio/mdm-sdk": "^1.4.857",
9
+ "@reltio/mdm-module": "^1.4.859",
10
+ "@reltio/mdm-sdk": "^1.4.859",
11
11
  "classnames": "^2.2.5",
12
12
  "frontend-collective-react-dnd-scrollzone": "^1.0.2",
13
13
  "nanoid": "^2.0.0",