intelicoreact 0.2.25 → 0.2.28

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,145 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _classnames = _interopRequireDefault(require("classnames"));
21
+
22
+ var _chart = require("chart.js");
23
+
24
+ var _helpers = require("chart.js/helpers");
25
+
26
+ var ChartComponents = _interopRequireWildcard(require("react-chartjs-2"));
27
+
28
+ var _optionsConstructor = require("./partial/optionsConstructor");
29
+
30
+ var _utils = require("./partial/utils");
31
+
32
+ var _Chart = require("./partial/Chart.constants");
33
+
34
+ var _ChartTypeSwitcherIcon = _interopRequireDefault(require("./partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon"));
35
+
36
+ require("./Chart.scss");
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
+
42
+ var RC = 'chart';
43
+
44
+ _chart.Chart.register(_chart.CategoryScale, _chart.LinearScale, _chart.BarElement, _chart.PointElement, _chart.LineElement);
45
+
46
+ var Chart = function Chart(_ref) {
47
+ var className = _ref.className,
48
+ initialModel = _ref.initialModel,
49
+ modelsForSwitch = _ref.modelsForSwitch,
50
+ setModelExternalValue = _ref.setModelExternalValue,
51
+ description = _ref.description,
52
+ customOptions = _ref.customOptions,
53
+ data = _ref.data;
54
+ if (!data) return null;
55
+
56
+ var correctModelKey = function correctModelKey(key) {
57
+ return key && _Chart.CHART_TYPES.includes((0, _utils.getChartTypeKey)(key)) ? key : _Chart.DEFAULT_CHART_MODEL;
58
+ };
59
+
60
+ var _ref2 = description || {},
61
+ label = _ref2.label,
62
+ value = _ref2.value;
63
+
64
+ var _useState = (0, _react.useState)(correctModelKey(initialModel)),
65
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
66
+ model = _useState2[0],
67
+ setModel = _useState2[1];
68
+
69
+ var _useState3 = (0, _react.useState)(data),
70
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
71
+ localData = _useState4[0],
72
+ setLocalData = _useState4[1];
73
+
74
+ var chartRef = (0, _react.useRef)(null);
75
+
76
+ var isExcludeDescription = _optionsConstructor.componentOptions.disableDescriptionsFor.includes(model);
77
+
78
+ var isExcludeChartTypeSwitcher = _optionsConstructor.componentOptions.disableChartTypeSwitcherFor.includes(model);
79
+
80
+ var getChartOptions = function getChartOptions() {
81
+ return customOptions || (0, _utils.getOptions)(model);
82
+ };
83
+
84
+ var ChartComponent = (0, _react.useCallback)(function (props) {
85
+ var Component = ChartComponents[(0, _utils.getChartTypeKey)(model)];
86
+ return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
87
+ ref: chartRef
88
+ }, props));
89
+ }, [model]);
90
+ (0, _react.useLayoutEffect)(function () {
91
+ if (initialModel !== model) setModel(correctModelKey(initialModel));
92
+ }, [initialModel]);
93
+ (0, _react.useLayoutEffect)(function () {
94
+ if (setModelExternalValue) setModelExternalValue(correctModelKey(model));
95
+ }, [model]);
96
+ (0, _react.useEffect)(function () {
97
+ return setLocalData((0, _utils.prepareData)(model, data, chartRef.current));
98
+ }, [model, data, chartRef]);
99
+ (0, _react.useEffect)(function () {
100
+ var _getChartOptions = getChartOptions(),
101
+ _getChartOptions$notL = _getChartOptions.notLibraryOptions;
102
+
103
+ _getChartOptions$notL = _getChartOptions$notL === void 0 ? {} : _getChartOptions$notL;
104
+ var setCanvasDimensions = _getChartOptions$notL.setCanvasDimensions;
105
+
106
+ if (chartRef.current) {
107
+ var _setCanvasDimensions$, _setCanvasDimensions$2;
108
+
109
+ chartRef.current.canvas.parentNode.style.width = (_setCanvasDimensions$ = setCanvasDimensions === null || setCanvasDimensions === void 0 ? void 0 : setCanvasDimensions.width) !== null && _setCanvasDimensions$ !== void 0 ? _setCanvasDimensions$ : '';
110
+ chartRef.current.canvas.parentNode.style.height = (_setCanvasDimensions$2 = setCanvasDimensions === null || setCanvasDimensions === void 0 ? void 0 : setCanvasDimensions.height) !== null && _setCanvasDimensions$2 !== void 0 ? _setCanvasDimensions$2 : '';
111
+ }
112
+ }, [model]);
113
+ return /*#__PURE__*/_react.default.createElement("div", {
114
+ className: (0, _classnames.default)(RC, (0, _defineProperty2.default)({}, "".concat(RC, "_icon-mode"), _optionsConstructor.iconModels.includes(model)), className)
115
+ }, /*#__PURE__*/_react.default.createElement("div", {
116
+ className: (0, _classnames.default)("".concat(RC, "__header"), (0, _defineProperty2.default)({}, "".concat(RC, "__header_only-switcher"), !description))
117
+ }, description && !isExcludeDescription ? /*#__PURE__*/_react.default.createElement("div", {
118
+ className: (0, _classnames.default)("".concat(RC, "__description"))
119
+ }, label ? /*#__PURE__*/_react.default.createElement("span", {
120
+ className: (0, _classnames.default)("".concat(RC, "__description-title"))
121
+ }, label) : null, value ? /*#__PURE__*/_react.default.createElement("div", {
122
+ className: (0, _classnames.default)("".concat(RC, "__description-value"))
123
+ }, value) : null) : null, !isExcludeChartTypeSwitcher ? /*#__PURE__*/_react.default.createElement("div", {
124
+ className: (0, _classnames.default)("".concat(RC, "__type-switcher"))
125
+ }, /*#__PURE__*/_react.default.createElement(_ChartTypeSwitcherIcon.default, {
126
+ iconType: "Bar",
127
+ isActive: (0, _utils.getChartTypeKey)(model) === 'Bar',
128
+ onClick: function onClick() {
129
+ return setModel((modelsForSwitch === null || modelsForSwitch === void 0 ? void 0 : modelsForSwitch[0]) || 'barLayout');
130
+ }
131
+ }), /*#__PURE__*/_react.default.createElement(_ChartTypeSwitcherIcon.default, {
132
+ iconType: "Line",
133
+ isActive: (0, _utils.getChartTypeKey)(model) === 'Line',
134
+ onClick: function onClick() {
135
+ return setModel((modelsForSwitch === null || modelsForSwitch === void 0 ? void 0 : modelsForSwitch[1]) || 'lineLayout');
136
+ }
137
+ })) : null), /*#__PURE__*/_react.default.createElement("div", {
138
+ className: (0, _classnames.default)("".concat(RC, "__chart-wrapper"))
139
+ }, /*#__PURE__*/_react.default.createElement(ChartComponent, (0, _extends2.default)({}, getChartOptions(), {
140
+ data: localData
141
+ }))));
142
+ };
143
+
144
+ var _default = Chart;
145
+ exports.default = _default;
@@ -0,0 +1,57 @@
1
+
2
+ .chart {
3
+ box-sizing: border-box;
4
+ position: relative;
5
+ height: fit-content;
6
+ padding: 24px;
7
+
8
+ &__header {
9
+ margin-bottom: 24px;
10
+ display: flex;
11
+ flex-flow: row nowrap;
12
+ justify-content: space-between;
13
+ align-items: flex-start;
14
+
15
+ &_only-switcher {
16
+ justify-content: flex-end;
17
+ }
18
+ }
19
+
20
+ &__description {
21
+ flex-grow: 1;
22
+ padding-left: 24px;
23
+
24
+ display: flex;
25
+ flex-flow: column nowrap;
26
+ justify-content: flex-start;
27
+ align-items: flex-start;
28
+ }
29
+
30
+ &__type-switcher {
31
+ width: fit-content;
32
+ height: fit-content;
33
+
34
+ display: flex;
35
+ flex-flow: row nowrap;
36
+ justify-content: flex-start;
37
+ align-items: flex-start;
38
+
39
+ &-icon {
40
+ margin-right: 8px;
41
+
42
+ &:last-child {
43
+ margin-right: 0;
44
+ }
45
+ }
46
+ }
47
+
48
+ // не менять положение этого/этих классов, класс-модификаторы должны быть внизу
49
+ &_icon-mode {
50
+ width: fit-content;
51
+ padding: 0;
52
+
53
+ .chart__header {
54
+ margin-bottom: 0;
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,38 @@
1
+ .any-outer-class__chart:not(.chart_icon-mode) {
2
+ max-width: 806px;
3
+
4
+ background: #FFFFFF;
5
+ box-shadow: 0px 16px 24px rgba(0, 0, 0, 0.05);
6
+ border-radius: 16px;
7
+ }
8
+
9
+
10
+ .any-outer-class__chart {
11
+ .chart__description-title {
12
+ font-style: normal;
13
+ font-weight: 600;
14
+ font-size: 16px;
15
+ line-height: 24px;
16
+ letter-spacing: 0.1px;
17
+ color: #3B414B;
18
+ }
19
+ .chart__description-value {
20
+ span {
21
+ font-style: normal;
22
+ font-weight: 600;
23
+ font-size: 20px;
24
+ line-height: 30px;
25
+ letter-spacing: 0.359794px;
26
+ color: #3B414B;
27
+
28
+
29
+
30
+ &:last-child {
31
+ font-size: 14px;
32
+ line-height: 20px;
33
+ letter-spacing: 0.2px;
34
+ color: #757F8C;
35
+ }
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GRADIENT_OBJECTS = exports.FINTURF_ADD_GRADIENT_COLORS_NEGATIVE = exports.FINTURF_ADD_GRADIENT_COLORS_POSITIVE = exports.DEFAULT_CHART_MODEL = exports.CHART_TYPES = void 0;
7
+ var CHART_TYPES = ['Bar', 'Line'];
8
+ exports.CHART_TYPES = CHART_TYPES;
9
+ var DEFAULT_CHART_MODEL = 'barLayout';
10
+ exports.DEFAULT_CHART_MODEL = DEFAULT_CHART_MODEL;
11
+ var FINTURF_ADD_GRADIENT_COLORS_POSITIVE = ['#53D1AD', '#389AA3'];
12
+ exports.FINTURF_ADD_GRADIENT_COLORS_POSITIVE = FINTURF_ADD_GRADIENT_COLORS_POSITIVE;
13
+ var FINTURF_ADD_GRADIENT_COLORS_NEGATIVE = ['#FDB4DB', '#FA2E69'];
14
+ exports.FINTURF_ADD_GRADIENT_COLORS_NEGATIVE = FINTURF_ADD_GRADIENT_COLORS_NEGATIVE;
15
+ var GRADIENT_OBJECTS = {
16
+ finturf: {
17
+ bar: {
18
+ gradientTargetPropertyName: 'backgroundColor',
19
+ colors: FINTURF_ADD_GRADIENT_COLORS_POSITIVE,
20
+ direction: 'toBottom',
21
+ typeDistributionOfGradientPoints: 'personalBase'
22
+ },
23
+ line: {
24
+ gradientTargetPropertyName: 'borderColor',
25
+ colors: FINTURF_ADD_GRADIENT_COLORS_POSITIVE,
26
+ direction: 'toRight'
27
+ }
28
+ }
29
+ };
30
+ exports.GRADIENT_OBJECTS = GRADIENT_OBJECTS;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _utils = require("../utils");
17
+
18
+ require("./ChartTypeSwitcherIcon.scss");
19
+
20
+ var RC = 'chart__type-switcher-icon';
21
+
22
+ var getIcon = function getIcon(type) {
23
+ switch (type) {
24
+ case 'Bar':
25
+ return /*#__PURE__*/_react.default.createElement("svg", {
26
+ width: "24",
27
+ height: "24",
28
+ viewBox: "0 0 24 25",
29
+ fill: "none",
30
+ xmlns: "http://www.w3.org/2000/svg"
31
+ }, /*#__PURE__*/_react.default.createElement("rect", {
32
+ y: "0.5",
33
+ width: "24",
34
+ height: "24",
35
+ rx: "4",
36
+ fill: "#EAF2FF"
37
+ }), /*#__PURE__*/_react.default.createElement("path", {
38
+ d: "M18 18V11",
39
+ stroke: "#1F7499",
40
+ "stroke-width": "2",
41
+ "stroke-linecap": "round",
42
+ "stroke-linejoin": "round"
43
+ }), /*#__PURE__*/_react.default.createElement("path", {
44
+ d: "M12 18V6",
45
+ stroke: "#1F7499",
46
+ "stroke-width": "2",
47
+ "stroke-linecap": "round",
48
+ "stroke-linejoin": "round"
49
+ }), /*#__PURE__*/_react.default.createElement("path", {
50
+ d: "M6 18V13",
51
+ stroke: "#1F7499",
52
+ "stroke-width": "2",
53
+ "stroke-linecap": "round",
54
+ "stroke-linejoin": "round"
55
+ }));
56
+
57
+ case 'Line':
58
+ return /*#__PURE__*/_react.default.createElement("svg", {
59
+ width: "24",
60
+ height: "24",
61
+ viewBox: "0 0 24 25",
62
+ fill: "none",
63
+ xmlns: "http://www.w3.org/2000/svg"
64
+ }, /*#__PURE__*/_react.default.createElement("rect", {
65
+ y: "0.5",
66
+ width: "24",
67
+ height: "24",
68
+ rx: "4",
69
+ fill: "#EAF2FF"
70
+ }), /*#__PURE__*/_react.default.createElement("path", {
71
+ d: "M21 8L15.2544 13.2668C14.1075 14.3181 12.3288 14.3014 11.1818 13.25V13.25C10.0349 12.1986 8.25615 12.1819 7.10919 13.2332L3 17",
72
+ stroke: "#1F7499",
73
+ "stroke-width": "2",
74
+ "stroke-linecap": "round",
75
+ "stroke-linejoin": "round"
76
+ }));
77
+
78
+ default:
79
+ return null;
80
+ }
81
+ };
82
+
83
+ var ChartTypeSwitcherIcon = function ChartTypeSwitcherIcon(_ref) {
84
+ var iconType = _ref.iconType,
85
+ isActive = _ref.isActive,
86
+ className = _ref.className,
87
+ onClick = _ref.onClick;
88
+ return /*#__PURE__*/_react.default.createElement("div", {
89
+ className: (0, _classnames.default)(RC, (0, _defineProperty2.default)({}, "".concat(RC, "_active"), isActive), className),
90
+ onClick: onClick
91
+ }, getIcon(iconType));
92
+ };
93
+
94
+ var _default = ChartTypeSwitcherIcon;
95
+ exports.default = _default;
@@ -0,0 +1,18 @@
1
+ .chart__type-switcher-icon {
2
+ overflow: hidden;
3
+ width: 24px;
4
+ height: 24px;
5
+ cursor: pointer;
6
+ svg {
7
+ width: 100%;
8
+ height: 100%;
9
+ }
10
+ &_active {
11
+ svg rect{
12
+ fill: #1F7499;
13
+ }
14
+ svg path {
15
+ stroke: white;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.componentOptions = exports.iconModels = exports.chartTypeKeysFormatter = exports.default = exports.reactChartJsOptionsLayouts = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _Chart = require("./Chart.constants");
13
+
14
+ var _reactChartJsOptionsL, _reactChartJsOptionsL2, _reactChartJsOptionsL3, _reactChartJsOptionsL4, _reactChartJsOptionsL5, _reactChartJsOptionsL6, _reactChartJsOptionsL7, _reactChartJsOptionsL8, _reactChartJsOptionsL9, _reactChartJsOptionsL10, _reactChartJsOptionsL11, _reactChartJsOptionsL12, _reactChartJsOptionsL13, _reactChartJsOptionsL14, _reactChartJsOptionsL15, _reactChartJsOptionsL16, _reactChartJsOptionsL17, _reactChartJsOptionsL18, _reactChartJsOptionsL19, _reactChartJsOptionsL20, _reactChartJsOptionsL21, _reactChartJsOptionsL22, _reactChartJsOptionsL23, _reactChartJsOptionsL24, _reactChartJsOptionsL25, _finturfChartLine$opt, _finturfChartLine$opt2, _finturfChartLine$opt3, _reactChartJsOptions;
15
+
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
+
20
+ // options constructors for ChartJS
21
+ var reactChartJsOptionsLayouts = {
22
+ lineIconLayout: {
23
+ options: {
24
+ responsive: true,
25
+ maintainAspectRatio: false,
26
+ scales: {
27
+ x: {
28
+ display: false
29
+ },
30
+ y: {
31
+ display: false
32
+ }
33
+ },
34
+ elements: {
35
+ point: {
36
+ radius: 0
37
+ },
38
+ line: {
39
+ tension: 0.45,
40
+ borderJoinStyle: 'round',
41
+ borderWidth: 1,
42
+ capBezierPoints: true
43
+ }
44
+ }
45
+ },
46
+ plugins: {},
47
+ redraw: true,
48
+ notLibraryOptions: {
49
+ // Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
50
+ // На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
51
+ // => Файл Chart.js => определение ChartComponent
52
+ chartTypeKey: 'Line',
53
+ changeData: {},
54
+ setCanvasDimensions: {
55
+ width: '75px',
56
+ height: '35px'
57
+ }
58
+ }
59
+ },
60
+ lineLayout: {
61
+ options: {
62
+ responsive: true,
63
+ scales: {
64
+ x: {
65
+ grid: {
66
+ display: false,
67
+ offset: true
68
+ }
69
+ },
70
+ y: {
71
+ min: 0,
72
+ bounds: 'data',
73
+ title: {// color: '#A0A4B0',
74
+ // color: '#32A784',
75
+ // font: '',
76
+ // padding: {
77
+ // right: 25,
78
+ // bottom: 10,
79
+ // },
80
+ },
81
+ grid: {
82
+ borderColor: '#E1E8F1',
83
+ color: '#E1E8F1',
84
+ borderDash: [5],
85
+ // borderDashOffset: 12,
86
+ drawTicks: false,
87
+ z: -1
88
+ }
89
+ }
90
+ },
91
+ elements: {
92
+ point: {
93
+ radius: 4,
94
+ pointStyle: 'circle',
95
+ backgroundColor: '#FFFFFF',
96
+ color: '#FFFFFF'
97
+ },
98
+ line: {
99
+ tension: 0.45,
100
+ borderWidth: 2,
101
+ borderJoinStyle: 'round',
102
+ capBezierPoints: true
103
+ }
104
+ }
105
+ },
106
+ plugins: {},
107
+ redraw: true,
108
+ notLibraryOptions: {
109
+ // Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
110
+ // На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
111
+ // => Файл Chart.js => определение ChartComponent
112
+ chartTypeKey: 'Line'
113
+ }
114
+ },
115
+ barLayout: {
116
+ options: {
117
+ responsive: true,
118
+ scales: {
119
+ x: {
120
+ grid: {
121
+ display: false,
122
+ offset: true
123
+ }
124
+ },
125
+ y: {
126
+ min: 0,
127
+ bounds: 'data',
128
+ title: {// color: '#A0A4B0',
129
+ // color: '#32A784',
130
+ // font: '',
131
+ // padding: {
132
+ // right: 25,
133
+ // bottom: 10,
134
+ // },
135
+ },
136
+ grid: {
137
+ borderColor: '#E1E8F1',
138
+ color: '#E1E8F1',
139
+ borderDash: [5],
140
+ drawTicks: false,
141
+ z: -1
142
+ }
143
+ }
144
+ },
145
+ elements: {
146
+ bar: {
147
+ borderRadius: 5
148
+ }
149
+ }
150
+ },
151
+ plugins: {},
152
+ redraw: true,
153
+ notLibraryOptions: {
154
+ // Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
155
+ // На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
156
+ // => Файл Chart.js => определение ChartComponent
157
+ chartTypeKey: 'Bar'
158
+ }
159
+ }
160
+ };
161
+ exports.reactChartJsOptionsLayouts = reactChartJsOptionsLayouts;
162
+
163
+ var addGradient = function addGradient(currentOptions, gradientObj) {
164
+ var _currentOptions$notLi;
165
+
166
+ return _objectSpread(_objectSpread({}, currentOptions), {}, {
167
+ notLibraryOptions: _objectSpread(_objectSpread({}, currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.notLibraryOptions), {}, {
168
+ changeData: _objectSpread(_objectSpread({}, currentOptions === null || currentOptions === void 0 ? void 0 : (_currentOptions$notLi = currentOptions.notLibraryOptions) === null || _currentOptions$notLi === void 0 ? void 0 : _currentOptions$notLi.changeData), {}, {
169
+ addGradient: gradientObj
170
+ })
171
+ })
172
+ });
173
+ };
174
+
175
+ var getLineIconLayoutOptionsAlongWithGradient = function getLineIconLayoutOptionsAlongWithGradient(gradientObj) {
176
+ return _objectSpread({}, addGradient(reactChartJsOptionsLayouts.lineIconLayout, gradientObj));
177
+ };
178
+
179
+ var finturfChartBar = _objectSpread(_objectSpread({}, reactChartJsOptionsLayouts.barLayout), {}, {
180
+ options: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL = reactChartJsOptionsLayouts.barLayout) === null || _reactChartJsOptionsL === void 0 ? void 0 : _reactChartJsOptionsL.options), {}, {
181
+ maintainAspectRatio: false,
182
+ elements: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL2 = reactChartJsOptionsLayouts.barLayout) === null || _reactChartJsOptionsL2 === void 0 ? void 0 : (_reactChartJsOptionsL3 = _reactChartJsOptionsL2.options) === null || _reactChartJsOptionsL3 === void 0 ? void 0 : _reactChartJsOptionsL3.elements), {}, {
183
+ bar: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL4 = reactChartJsOptionsLayouts.barLayout) === null || _reactChartJsOptionsL4 === void 0 ? void 0 : (_reactChartJsOptionsL5 = _reactChartJsOptionsL4.options) === null || _reactChartJsOptionsL5 === void 0 ? void 0 : (_reactChartJsOptionsL6 = _reactChartJsOptionsL5.elements) === null || _reactChartJsOptionsL6 === void 0 ? void 0 : _reactChartJsOptionsL6.bar), {}, {
184
+ borderRadius: 10
185
+ })
186
+ })
187
+ }),
188
+ notLibraryOptions: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL7 = reactChartJsOptionsLayouts.barLayout) === null || _reactChartJsOptionsL7 === void 0 ? void 0 : _reactChartJsOptionsL7.notLibraryOptions), {}, {
189
+ changeData: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL8 = reactChartJsOptionsLayouts.barLayout) === null || _reactChartJsOptionsL8 === void 0 ? void 0 : (_reactChartJsOptionsL9 = _reactChartJsOptionsL8.notLibraryOptions) === null || _reactChartJsOptionsL9 === void 0 ? void 0 : _reactChartJsOptionsL9.changeData), {}, {
190
+ setMaxBarThickness: 20
191
+ }),
192
+ setCanvasDimensions: {
193
+ height: '194px'
194
+ }
195
+ })
196
+ });
197
+
198
+ var finturfChartLine = _objectSpread(_objectSpread({}, reactChartJsOptionsLayouts.lineLayout), {}, {
199
+ options: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL10 = reactChartJsOptionsLayouts.lineLayout) === null || _reactChartJsOptionsL10 === void 0 ? void 0 : _reactChartJsOptionsL10.options), {}, {
200
+ maintainAspectRatio: false,
201
+ scales: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL11 = reactChartJsOptionsLayouts.lineLayout) === null || _reactChartJsOptionsL11 === void 0 ? void 0 : (_reactChartJsOptionsL12 = _reactChartJsOptionsL11.options) === null || _reactChartJsOptionsL12 === void 0 ? void 0 : _reactChartJsOptionsL12.scales), {}, {
202
+ y: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL13 = reactChartJsOptionsLayouts.lineLayout) === null || _reactChartJsOptionsL13 === void 0 ? void 0 : (_reactChartJsOptionsL14 = _reactChartJsOptionsL13.options) === null || _reactChartJsOptionsL14 === void 0 ? void 0 : _reactChartJsOptionsL14.scales.y), {}, {
203
+ title: _objectSpread({}, (_reactChartJsOptionsL15 = reactChartJsOptionsLayouts.lineLayout) === null || _reactChartJsOptionsL15 === void 0 ? void 0 : (_reactChartJsOptionsL16 = _reactChartJsOptionsL15.options) === null || _reactChartJsOptionsL16 === void 0 ? void 0 : (_reactChartJsOptionsL17 = _reactChartJsOptionsL16.scales) === null || _reactChartJsOptionsL17 === void 0 ? void 0 : (_reactChartJsOptionsL18 = _reactChartJsOptionsL17.y) === null || _reactChartJsOptionsL18 === void 0 ? void 0 : _reactChartJsOptionsL18.title),
204
+ grid: _objectSpread({}, (_reactChartJsOptionsL19 = reactChartJsOptionsLayouts.lineLayout) === null || _reactChartJsOptionsL19 === void 0 ? void 0 : (_reactChartJsOptionsL20 = _reactChartJsOptionsL19.options) === null || _reactChartJsOptionsL20 === void 0 ? void 0 : (_reactChartJsOptionsL21 = _reactChartJsOptionsL20.scales) === null || _reactChartJsOptionsL21 === void 0 ? void 0 : (_reactChartJsOptionsL22 = _reactChartJsOptionsL21.y) === null || _reactChartJsOptionsL22 === void 0 ? void 0 : _reactChartJsOptionsL22.grid)
205
+ })
206
+ }),
207
+ elements: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL23 = reactChartJsOptionsLayouts.lineLayout.options) === null || _reactChartJsOptionsL23 === void 0 ? void 0 : _reactChartJsOptionsL23.elements), {}, {
208
+ point: _objectSpread(_objectSpread({}, (_reactChartJsOptionsL24 = reactChartJsOptionsLayouts.lineLayout.options) === null || _reactChartJsOptionsL24 === void 0 ? void 0 : (_reactChartJsOptionsL25 = _reactChartJsOptionsL24.elements) === null || _reactChartJsOptionsL25 === void 0 ? void 0 : _reactChartJsOptionsL25.point), {}, {
209
+ borderColor: '#32A784'
210
+ })
211
+ })
212
+ }),
213
+ notLibraryOptions: _objectSpread(_objectSpread({}, reactChartJsOptionsLayouts.lineLayout.notLibraryOptions), {}, {
214
+ setCanvasDimensions: {
215
+ height: '194px'
216
+ }
217
+ })
218
+ });
219
+
220
+ var finturfLoadingModeBar = _objectSpread(_objectSpread({}, finturfChartBar), {}, {
221
+ options: _objectSpread(_objectSpread({}, finturfChartBar.options), {}, {
222
+ animation: false
223
+ })
224
+ });
225
+
226
+ var finturfLoadingModeLine = _objectSpread(_objectSpread({}, finturfChartLine), {}, {
227
+ options: _objectSpread(_objectSpread({}, finturfChartLine.options), {}, {
228
+ elements: _objectSpread(_objectSpread({}, (_finturfChartLine$opt = finturfChartLine.options) === null || _finturfChartLine$opt === void 0 ? void 0 : _finturfChartLine$opt.elements), {}, {
229
+ point: _objectSpread(_objectSpread({}, (_finturfChartLine$opt2 = finturfChartLine.options) === null || _finturfChartLine$opt2 === void 0 ? void 0 : (_finturfChartLine$opt3 = _finturfChartLine$opt2.elements) === null || _finturfChartLine$opt3 === void 0 ? void 0 : _finturfChartLine$opt3.point), {}, {
230
+ borderColor: '#E1E8F1'
231
+ })
232
+ }),
233
+ animations: {
234
+ y: false
235
+ } // transitions: {
236
+ // show: {
237
+ // animations: {
238
+ // x: false,
239
+ // y: false,
240
+ // }
241
+ // },
242
+ // hide: {
243
+ // animations: {
244
+ // x: false,
245
+ // y: false,
246
+ // }
247
+ // },
248
+ // },
249
+
250
+ })
251
+ });
252
+
253
+ var reactChartJsOptions = (_reactChartJsOptions = {
254
+ finturfChartBar: _objectSpread({}, addGradient(finturfChartBar, _Chart.GRADIENT_OBJECTS.finturf.bar)),
255
+ finturfChartBarLoadingMode: _objectSpread({}, finturfChartBar),
256
+ finturfChartLine: _objectSpread({}, addGradient(finturfChartLine, _Chart.GRADIENT_OBJECTS.finturf.line)),
257
+ finturfChartLineLoadingMode: _objectSpread({}, finturfChartLine),
258
+ finturfPositiveLineIcon: _objectSpread({}, addGradient(reactChartJsOptionsLayouts.lineIconLayout, _Chart.GRADIENT_OBJECTS.finturf.line))
259
+ }, (0, _defineProperty2.default)(_reactChartJsOptions, "finturfPositiveLineIcon", _objectSpread({}, addGradient(reactChartJsOptionsLayouts.lineIconLayout, _objectSpread(_objectSpread({}, _Chart.GRADIENT_OBJECTS.finturf.line), {}, {
260
+ colors: _Chart.FINTURF_ADD_GRADIENT_COLORS_NEGATIVE
261
+ })))), (0, _defineProperty2.default)(_reactChartJsOptions, "finturfPositiveLineIcon", getLineIconLayoutOptionsAlongWithGradient({
262
+ gradientTargetPropertyName: 'borderColor',
263
+ colors: ['#53D1AD', '#389AA3'],
264
+ direction: 'toRight'
265
+ })), (0, _defineProperty2.default)(_reactChartJsOptions, "finturfNegativeLineIcon", getLineIconLayoutOptionsAlongWithGradient({
266
+ gradientTargetPropertyName: 'borderColor',
267
+ colors: ['#FDB4DB', '#FA2E69'],
268
+ direction: 'toRight'
269
+ })), (0, _defineProperty2.default)(_reactChartJsOptions, "finturfLoadingModeBar", finturfLoadingModeBar), (0, _defineProperty2.default)(_reactChartJsOptions, "finturfLoadingModeLine", finturfLoadingModeLine), _reactChartJsOptions);
270
+ var _default = reactChartJsOptions; // Chart component constructors
271
+
272
+ exports.default = _default;
273
+ var chartTypeKeysFormatter = {
274
+ finturfChartBar: 'Bar',
275
+ finturfChartLine: 'Line',
276
+ finturfPositiveLineIcon: 'Line',
277
+ finturfNegativeLineIcon: 'Line'
278
+ };
279
+ exports.chartTypeKeysFormatter = chartTypeKeysFormatter;
280
+ var iconModels = ['lineIconLayout', 'finturfPositiveLineIcon', 'finturfNegativeLineIcon'];
281
+ exports.iconModels = iconModels;
282
+ var componentOptions = {
283
+ disableDescriptionsFor: [].concat(iconModels),
284
+ disableChartTypeSwitcherFor: [].concat(iconModels)
285
+ };
286
+ exports.componentOptions = componentOptions;