@steroidsjs/bootstrap 3.0.0-beta.97 → 3.0.0-beta.99
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/content/Calendar/CalendarView.js +3 -1
- package/content/Chart/ChartView.d.ts +2 -0
- package/content/Chart/ChartView.js +47 -0
- package/content/Chart/ChartView.scss +8 -0
- package/content/Slider/SliderView.js +3 -1
- package/form/CheckboxListField/CheckboxListFieldView.js +7 -7
- package/form/ImageField/ImageFieldModalView.js +3 -1
- package/form/InputField/InputFieldView.js +2 -2
- package/form/NumberField/NumberFieldView.js +5 -16
- package/form/RadioField/RadioFieldView.js +1 -1
- package/form/RadioListField/RadioListFieldView.js +6 -8
- package/form/SliderField/SliderFieldView.js +3 -1
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +2 -2
|
@@ -46,6 +46,8 @@ var CaptionElement_1 = __importDefault(require("./CaptionElement"));
|
|
|
46
46
|
function CalendarView(props) {
|
|
47
47
|
var bem = (0, hooks_1.useBem)('CalendarView');
|
|
48
48
|
var localeComponent = (0, hooks_1.useComponents)().locale;
|
|
49
|
+
//TODO Исправить тип, связано с yarn tsc в action publish.yml
|
|
50
|
+
var DayPicker = react_day_picker_1["default"];
|
|
49
51
|
var month = props.month, toYear = props.toYear, fromYear = props.fromYear, showFooter = props.showFooter, onDaySelect = props.onDaySelect, selectedDates = props.selectedDates, onMonthSelect = props.onMonthSelect, numberOfMonths = props.numberOfMonths, toggleCaptionPanel = props.toggleCaptionPanel, isCaptionPanelVisible = props.isCaptionPanelVisible;
|
|
50
52
|
var isRange = !!selectedDates[0] && !!selectedDates[1];
|
|
51
53
|
var _a = (0, react_1.useMemo)(function () {
|
|
@@ -66,7 +68,7 @@ function CalendarView(props) {
|
|
|
66
68
|
: undefined
|
|
67
69
|
};
|
|
68
70
|
}, [isRange, selectedDates]), selectedDays = _a.selectedDays, modifiers = _a.modifiers;
|
|
69
|
-
return (React.createElement(
|
|
71
|
+
return (React.createElement(DayPicker, __assign({}, props, { className: bem(bem.block({ ranged: isRange }), props.className), captionElement: (0, react_1.useCallback)(function (_a) {
|
|
70
72
|
var classNames = _a.classNames, date = _a.date, localeUtils = _a.localeUtils, locale = _a.locale;
|
|
71
73
|
return (React.createElement(CaptionElement_1["default"], { date: date, locale: locale, toYear: toYear, fromYear: fromYear, classNames: classNames, onChange: onMonthSelect, localeUtils: localeUtils, showCalendarFooter: showFooter, toggleCaptionPanel: toggleCaptionPanel, isCaptionPanelVisible: isCaptionPanelVisible }));
|
|
72
74
|
}, [fromYear, isCaptionPanelVisible, onMonthSelect, showFooter, toYear, toggleCaptionPanel]), renderDay: function (day) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
exports.__esModule = true;
|
|
17
|
+
var react_1 = __importDefault(require("react"));
|
|
18
|
+
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
19
|
+
var DEFAULT_AXIS_PARAMS = {
|
|
20
|
+
tickSize: 5,
|
|
21
|
+
tickPadding: 5,
|
|
22
|
+
tickRotation: 0,
|
|
23
|
+
legend: '',
|
|
24
|
+
legendPosition: 'middle'
|
|
25
|
+
};
|
|
26
|
+
var DEFAULT_LINE_CHART_CONFIG = {
|
|
27
|
+
yScale: {
|
|
28
|
+
type: 'linear',
|
|
29
|
+
min: 'auto',
|
|
30
|
+
max: 'auto',
|
|
31
|
+
stacked: true,
|
|
32
|
+
reverse: false
|
|
33
|
+
},
|
|
34
|
+
xScale: { type: 'point' },
|
|
35
|
+
axisBottom: __assign(__assign({}, DEFAULT_AXIS_PARAMS), { legendOffset: 36 }),
|
|
36
|
+
axisLeft: __assign(__assign({}, DEFAULT_AXIS_PARAMS), { legendOffset: -40 }),
|
|
37
|
+
pointSize: 8,
|
|
38
|
+
useMesh: true
|
|
39
|
+
};
|
|
40
|
+
function ChartView(props) {
|
|
41
|
+
var bem = (0, hooks_1.useBem)('ChartView');
|
|
42
|
+
var ChartComponent = props.chartComponent;
|
|
43
|
+
var defaultChartConfig = (props.useDefaultLineChartConfig && DEFAULT_LINE_CHART_CONFIG) || {};
|
|
44
|
+
return (react_1["default"].createElement("div", { className: bem(bem.block(), props.className), style: __assign({ height: "".concat(props.height, "px") }, props.style) },
|
|
45
|
+
react_1["default"].createElement(ChartComponent, __assign({ data: props.data }, defaultChartConfig, props.config))));
|
|
46
|
+
}
|
|
47
|
+
exports["default"] = ChartView;
|
|
@@ -11,9 +11,11 @@ require("@splidejs/splide/dist/css/splide.min.css");
|
|
|
11
11
|
function SliderView(props) {
|
|
12
12
|
var _a;
|
|
13
13
|
var bem = (0, useBem_1["default"])('Slider');
|
|
14
|
+
//TODO Исправить тип, связано с yarn tsc в action publish.yml
|
|
15
|
+
var Splide = react_splide_1.Splide;
|
|
14
16
|
var ItemView = props.itemView;
|
|
15
17
|
return (react_1["default"].createElement("div", { className: bem(bem.block(), props.className), style: props.style },
|
|
16
|
-
react_1["default"].createElement(
|
|
18
|
+
react_1["default"].createElement(Splide, { options: props.sliderOptions, extensions: props.extensions, hasTrack: props.hasTrack, tag: props.tag, transition: props.transition }, (_a = props.items) === null || _a === void 0 ? void 0 : _a.map(function (item, itemIndex) { return (react_1["default"].createElement(react_splide_1.SplideSlide, { key: itemIndex },
|
|
17
19
|
react_1["default"].createElement(ItemView, { item: item }))); }))));
|
|
18
20
|
}
|
|
19
21
|
exports["default"] = SliderView;
|
|
@@ -36,19 +36,19 @@ function CheckboxListFieldView(props) {
|
|
|
36
36
|
return (React.createElement("div", { className: bem(bem.block((_a = {},
|
|
37
37
|
_a["".concat(props.orientation)] = !!props.orientation,
|
|
38
38
|
_a))) }, props.items.map(function (checkbox, checkboxIndex) { return props.renderCheckbox({
|
|
39
|
+
key: checkboxIndex,
|
|
40
|
+
id: "".concat(prefix, "_").concat(checkbox.id),
|
|
41
|
+
label: checkbox.label,
|
|
39
42
|
inputProps: {
|
|
40
43
|
name: "".concat(prefix, "_").concat(checkbox.id),
|
|
41
|
-
checked: null,
|
|
42
44
|
type: 'checkbox',
|
|
43
|
-
|
|
45
|
+
checked: props.selectedIds.includes(checkbox.id),
|
|
44
46
|
onChange: function () {
|
|
45
47
|
props.onItemSelect(checkbox.id);
|
|
46
|
-
}
|
|
48
|
+
},
|
|
49
|
+
disabled: props.disabled
|
|
47
50
|
},
|
|
48
|
-
|
|
49
|
-
label: checkbox.label,
|
|
50
|
-
id: "".concat(prefix, "_").concat(checkbox.id),
|
|
51
|
-
key: checkboxIndex
|
|
51
|
+
size: props.size
|
|
52
52
|
}); })));
|
|
53
53
|
}
|
|
54
54
|
exports["default"] = CheckboxListFieldView;
|
|
@@ -45,6 +45,8 @@ var Modal_1 = __importDefault(require("@steroidsjs/core/ui/modal/Modal"));
|
|
|
45
45
|
require("react-image-crop/dist/ReactCrop.css");
|
|
46
46
|
function ImageFieldModalView(props) {
|
|
47
47
|
var bem = (0, hooks_1.useBem)('ImageFieldModalView');
|
|
48
|
+
//TODO Исправить тип, связано с yarn tsc в action publish.yml
|
|
49
|
+
var ReactCrop = react_image_crop_1["default"];
|
|
48
50
|
var _a = (0, react_1.useState)(props.crop.initialValues), crop = _a[0], setCrop = _a[1];
|
|
49
51
|
return (React.createElement(Modal_1["default"], { className: bem.block(), title: props.title || __('Выберите область изображения'), onClose: props.onClose, controls: [{
|
|
50
52
|
label: __(('Сохранить')),
|
|
@@ -54,6 +56,6 @@ function ImageFieldModalView(props) {
|
|
|
54
56
|
}
|
|
55
57
|
}] },
|
|
56
58
|
React.createElement("div", { className: 'mb-3' },
|
|
57
|
-
React.createElement(
|
|
59
|
+
React.createElement(ReactCrop, __assign({}, props.crop.reactImageCropProps, { className: bem.element('crop'), src: props.image && props.image.url, crop: crop, onChange: setCrop })))));
|
|
58
60
|
}
|
|
59
61
|
exports["default"] = ImageFieldModalView;
|
|
@@ -69,10 +69,10 @@ function InputFieldView(props) {
|
|
|
69
69
|
props.maskOptions
|
|
70
70
|
? (React.createElement("input", __assign({ onBlur: props.onBlur, onFocus: props.onFocus, onMouseDown: props.onMouseDown, className: bem(bem.element('input', {
|
|
71
71
|
size: props.size
|
|
72
|
-
})) }, props.inputProps, {
|
|
72
|
+
})) }, props.inputProps, { type: props.type, placeholder: props.placeholder, disabled: props.disabled, required: props.required, id: props.id, ref: props.inputRef })))
|
|
73
73
|
: (React.createElement("input", __assign({ className: bem(bem.element('input', {
|
|
74
74
|
size: props.size
|
|
75
|
-
})) }, props.inputProps, {
|
|
75
|
+
})) }, props.inputProps, { type: props.type, placeholder: props.placeholder, disabled: props.disabled, required: props.required, id: props.id, ref: props.inputRef }))),
|
|
76
76
|
!props.disabled && props.showClear && !props.maskProps && (React.createElement(Icon_1["default"], { name: "cross_8x8", className: bem.element('icon-clear'), tabIndex: -1, onClick: props.onClear }))),
|
|
77
77
|
props.textAfter && (React.createElement("span", { className: bem.element('text-after') }, props.textAfter)),
|
|
78
78
|
props.addonAfter && (React.createElement("span", { className: bem.element('addon-after') }, props.addonAfter))));
|
|
@@ -38,38 +38,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
exports.__esModule = true;
|
|
40
40
|
var React = __importStar(require("react"));
|
|
41
|
-
var react_1 = require("react");
|
|
42
41
|
var isNumber_1 = __importDefault(require("lodash-es/isNumber"));
|
|
43
42
|
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
44
43
|
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
45
44
|
function NumberFieldView(props) {
|
|
46
|
-
var _a;
|
|
47
|
-
// Input ref
|
|
48
|
-
var inputRef = (0, react_1.useRef)(null);
|
|
49
|
-
var onStepUp = (0, react_1.useCallback)(function () {
|
|
50
|
-
inputRef.current.stepUp();
|
|
51
|
-
props.inputProps.onChange(inputRef.current.value);
|
|
52
|
-
}, [props.inputProps]);
|
|
53
|
-
var onStepDown = (0, react_1.useCallback)(function () {
|
|
54
|
-
inputRef.current.stepDown();
|
|
55
|
-
props.inputProps.onChange(inputRef.current.value);
|
|
56
|
-
}, [props.inputProps]);
|
|
45
|
+
var _a, _b;
|
|
57
46
|
var bem = (0, hooks_1.useBem)('NumberFieldView');
|
|
58
47
|
return (React.createElement("div", { className: bem(bem.block({
|
|
59
48
|
disabled: props.inputProps.disabled,
|
|
60
49
|
size: props.size,
|
|
61
50
|
hasErrors: !!props.errors,
|
|
62
|
-
filled: !!((_a = inputRef
|
|
51
|
+
filled: !!((_b = (_a = props.inputRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.value)
|
|
63
52
|
}), props.className) },
|
|
64
|
-
React.createElement("input", __assign({ ref: inputRef, className: bem(bem.element('input')) }, props.inputProps, {
|
|
53
|
+
React.createElement("input", __assign({ ref: props.inputRef, className: bem(bem.element('input')) }, props.inputProps, { onWheel: function (event) { return event.currentTarget.blur(); }, id: props.id })),
|
|
65
54
|
!props.disabled && !props.errors && (React.createElement("div", { className: bem.element('arrows-container') },
|
|
66
55
|
React.createElement("button", { className: bem.element('arrow', {
|
|
67
56
|
disabled: (0, isNumber_1["default"])(props.inputProps.max) && props.inputProps.value >= props.inputProps.max
|
|
68
|
-
}), type: 'button', onClick: onStepUp },
|
|
57
|
+
}), type: 'button', onClick: props.onStepUp },
|
|
69
58
|
React.createElement(Icon_1["default"], { name: 'expand_up', tabIndex: -1 })),
|
|
70
59
|
React.createElement("button", { className: bem.element('arrow', {
|
|
71
60
|
disabled: (0, isNumber_1["default"])(props.inputProps.min) && props.inputProps.value <= props.inputProps.min
|
|
72
|
-
}), type: 'button', onClick: onStepDown },
|
|
61
|
+
}), type: 'button', onClick: props.onStepDown },
|
|
73
62
|
React.createElement(Icon_1["default"], { name: 'expand_up', tabIndex: -1 })))),
|
|
74
63
|
React.createElement("span", { className: bem.element('input-effects') })));
|
|
75
64
|
}
|
|
@@ -49,7 +49,7 @@ function RadioFieldView(props) {
|
|
|
49
49
|
}), props.className), onClick: props.onChange },
|
|
50
50
|
React.createElement("input", __assign({ className: bem(bem.element('input', {
|
|
51
51
|
checked: props.checked
|
|
52
|
-
})), id: props.id || id }, props.inputProps, {
|
|
52
|
+
})), id: props.id || id }, props.inputProps, { disabled: props.disabled, required: props.required })),
|
|
53
53
|
React.createElement("label", { className: bem.element('label'), htmlFor: props.id || id },
|
|
54
54
|
React.createElement("span", { className: bem.element('ellipse') }),
|
|
55
55
|
props.label)));
|
|
@@ -36,20 +36,18 @@ function RadioListFieldView(props) {
|
|
|
36
36
|
return (React.createElement("div", { className: bem(bem.block((_a = {},
|
|
37
37
|
_a["".concat(props.orientation)] = !!props.orientation,
|
|
38
38
|
_a)), props.className) }, props.items.map(function (radio, radioIndex) { return props.renderRadio({
|
|
39
|
+
key: radioIndex,
|
|
40
|
+
id: "".concat(prefix, "_").concat(radio.id),
|
|
41
|
+
label: radio.label,
|
|
39
42
|
inputProps: {
|
|
40
43
|
name: "".concat(prefix, "_").concat(radio.id),
|
|
41
|
-
checked: null,
|
|
42
44
|
type: 'radio',
|
|
43
|
-
|
|
45
|
+
checked: props.selectedIds.includes(radio.id),
|
|
44
46
|
onChange: function () {
|
|
45
47
|
props.onItemSelect(radio.id);
|
|
46
|
-
}
|
|
48
|
+
},
|
|
49
|
+
disabled: props.disabled
|
|
47
50
|
},
|
|
48
|
-
disabled: props.disabled,
|
|
49
|
-
checked: props.selectedIds.includes(radio.id),
|
|
50
|
-
label: radio.label,
|
|
51
|
-
id: "".concat(prefix, "_").concat(radio.id),
|
|
52
|
-
key: radioIndex,
|
|
53
51
|
size: props.size
|
|
54
52
|
}); })));
|
|
55
53
|
}
|
|
@@ -43,10 +43,12 @@ var RangeComponent = createRangeWithTooltip(rc_slider_1.Range);
|
|
|
43
43
|
var SliderComponent = createSliderWithTooltip(rc_slider_1["default"]);
|
|
44
44
|
function SliderFieldView(props) {
|
|
45
45
|
var bem = (0, hooks_1.useBem)('SliderFieldView');
|
|
46
|
+
//TODO Исправить тип, связано с yarn tsc в action publish.yml
|
|
47
|
+
var Handle = rc_slider_1.Handle;
|
|
46
48
|
var handle = function (prevProps) {
|
|
47
49
|
var value = prevProps.value;
|
|
48
50
|
return (React.createElement(rc_slider_1.SliderTooltip, { prefixCls: 'rc-slider-tooltip', placement: 'top', overlay: "".concat(value) },
|
|
49
|
-
React.createElement(
|
|
51
|
+
React.createElement(Handle, { value: value })));
|
|
50
52
|
};
|
|
51
53
|
var commonProps = {
|
|
52
54
|
slider: props.slider,
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -38,6 +38,9 @@ exports["default"] = {
|
|
|
38
38
|
'content.CopyToClipboardView': {
|
|
39
39
|
lazy: function () { return require('./content/CopyToClipboard/CopyToClipboardView')["default"]; }
|
|
40
40
|
},
|
|
41
|
+
'content.ChartView': {
|
|
42
|
+
lazy: function () { return require('./content/Chart/ChartView')["default"]; }
|
|
43
|
+
},
|
|
41
44
|
'content.SliderView': {
|
|
42
45
|
lazy: function () { return require('./content/Slider/SliderView')["default"]; }
|
|
43
46
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steroidsjs/bootstrap",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.99",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Vladimir Kozhin <hello@kozhindev.com>",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-use": "^17.4.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@steroidsjs/core": "^3.0 || >=3.0.0-beta.
|
|
40
|
+
"@steroidsjs/core": "^3.0 || >=3.0.0-beta.84",
|
|
41
41
|
"@steroidsjs/eslint-config": "^2.1.4",
|
|
42
42
|
"@types/enzyme": "^3.10.8",
|
|
43
43
|
"@types/googlemaps": "^3.43.3",
|