@steroidsjs/core 3.0.19 → 3.0.21
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/docs-autogen-result.json +34 -0
- package/en.json +1 -0
- package/package.json +1 -1
- package/ui/content/CalendarSystem/CalendarSystem.d.ts +5 -0
- package/ui/content/CalendarSystem/CalendarSystem.js +2 -1
- package/ui/form/CheckboxListField/CheckboxListField.d.ts +0 -1
- package/ui/form/CheckboxListField/CheckboxListField.js +10 -4
- package/ui/form/FileField/FileField.js +4 -2
- package/ui/form/NumberField/NumberField.d.ts +4 -0
- package/ui/form/NumberField/NumberField.js +3 -2
- package/ui/form/NumberField/hooks/useInputTypeNumber.d.ts +1 -1
- package/ui/form/NumberField/hooks/useInputTypeNumber.js +25 -13
package/docs-autogen-result.json
CHANGED
|
@@ -7604,6 +7604,15 @@
|
|
|
7604
7604
|
"example": null,
|
|
7605
7605
|
"defaultValue": null
|
|
7606
7606
|
},
|
|
7607
|
+
{
|
|
7608
|
+
"name": "children",
|
|
7609
|
+
"decorators": [],
|
|
7610
|
+
"description": "Дочерние элементы",
|
|
7611
|
+
"required": false,
|
|
7612
|
+
"type": "ReactNode",
|
|
7613
|
+
"example": null,
|
|
7614
|
+
"defaultValue": null
|
|
7615
|
+
},
|
|
7607
7616
|
{
|
|
7608
7617
|
"name": "className",
|
|
7609
7618
|
"decorators": [],
|
|
@@ -7743,6 +7752,14 @@
|
|
|
7743
7752
|
"type": "default",
|
|
7744
7753
|
"example": null
|
|
7745
7754
|
},
|
|
7755
|
+
{
|
|
7756
|
+
"name": "children",
|
|
7757
|
+
"decorators": [],
|
|
7758
|
+
"description": "",
|
|
7759
|
+
"required": true,
|
|
7760
|
+
"type": "ReactNode",
|
|
7761
|
+
"example": null
|
|
7762
|
+
},
|
|
7746
7763
|
{
|
|
7747
7764
|
"name": "className",
|
|
7748
7765
|
"decorators": [],
|
|
@@ -25367,6 +25384,15 @@
|
|
|
25367
25384
|
"example": "{ onKeyDown: ... }",
|
|
25368
25385
|
"defaultValue": null
|
|
25369
25386
|
},
|
|
25387
|
+
{
|
|
25388
|
+
"name": "isCanBeNegative",
|
|
25389
|
+
"decorators": [],
|
|
25390
|
+
"description": "Может ли число быть отрицательным",
|
|
25391
|
+
"required": false,
|
|
25392
|
+
"type": "boolean",
|
|
25393
|
+
"example": null,
|
|
25394
|
+
"defaultValue": null
|
|
25395
|
+
},
|
|
25370
25396
|
{
|
|
25371
25397
|
"name": "isRenderWithoutFieldLayout",
|
|
25372
25398
|
"decorators": [],
|
|
@@ -25648,6 +25674,14 @@
|
|
|
25648
25674
|
"type": "MutableRefObject",
|
|
25649
25675
|
"example": null
|
|
25650
25676
|
},
|
|
25677
|
+
{
|
|
25678
|
+
"name": "isCanBeNegative",
|
|
25679
|
+
"decorators": [],
|
|
25680
|
+
"description": "Может ли число быть отрицательным",
|
|
25681
|
+
"required": false,
|
|
25682
|
+
"type": "boolean",
|
|
25683
|
+
"example": null
|
|
25684
|
+
},
|
|
25651
25685
|
{
|
|
25652
25686
|
"name": "isRenderWithoutFieldLayout",
|
|
25653
25687
|
"decorators": [],
|
package/en.json
CHANGED
|
@@ -1003,6 +1003,7 @@
|
|
|
1003
1003
|
"Конструктор редактора 'ckeditor5-react' из библиотеки @steroidsjs/ckeditor5/packages/ckeditor5-build-classic\nПримечание: для использования встроенного отображения 'HtmlField', данный компонент должен быть передан": "",
|
|
1004
1004
|
"Компонент редактора 'ckeditor5-react' из библиотеки @ckeditor\nПримечание: для использования встроенного отображения 'HtmlField', данный компонент должен быть передан": "",
|
|
1005
1005
|
"Допустимое количество символов после разделителя": "",
|
|
1006
|
+
"Может ли число быть отрицательным": "",
|
|
1006
1007
|
"CSS-класс для элемента навигации.": "",
|
|
1007
1008
|
"Тип данных для параметров маршрута.": "",
|
|
1008
1009
|
"Обертка над Redux Store со встроенными middleware (thunk, multi, promise..) и react-router.": ""
|
package/package.json
CHANGED
|
@@ -141,6 +141,10 @@ export interface ICalendarSystemProps extends IUiComponent {
|
|
|
141
141
|
* Дополнительные свойства для бокового календаря
|
|
142
142
|
*/
|
|
143
143
|
asideCalendarProps?: ICalendarProps;
|
|
144
|
+
/**
|
|
145
|
+
* Дочерние элементы
|
|
146
|
+
*/
|
|
147
|
+
children?: React.ReactNode;
|
|
144
148
|
[key: string]: any;
|
|
145
149
|
}
|
|
146
150
|
export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'className' | 'style' | 'additionalViewProps' | 'users' | 'asideCalendarProps'> {
|
|
@@ -153,6 +157,7 @@ export interface ICalendarSystemViewProps extends Pick<ICalendarSystemProps, 'cl
|
|
|
153
157
|
handleCalendarTypeChange: (newType: string) => void;
|
|
154
158
|
onClickControl: (event: React.MouseEvent<HTMLElement>) => void;
|
|
155
159
|
calendarType: CalendarEnum;
|
|
160
|
+
children: React.ReactNode;
|
|
156
161
|
getEventsFromDate: (dateFromDay: Date, currentCalendarType: CalendarEnum) => IEvent[];
|
|
157
162
|
openEditModal: (event: IEvent) => void;
|
|
158
163
|
openCreateModal: (eventInitialDay?: IDay) => void;
|
|
@@ -37,6 +37,7 @@ function CalendarSystem(props) {
|
|
|
37
37
|
users: calendarSystem.users,
|
|
38
38
|
eventGroupsTitle: props.eventBlock.title,
|
|
39
39
|
asideCalendarProps: props.asideCalendarProps,
|
|
40
|
+
children: props.children,
|
|
40
41
|
dateToDisplay: calendarSystem.dateToDisplay,
|
|
41
42
|
eventGroups: calendarSystem.innerEventGroups,
|
|
42
43
|
calendarType: calendarSystem.calendarType,
|
|
@@ -51,7 +52,7 @@ function CalendarSystem(props) {
|
|
|
51
52
|
monthGridProps: __assign({ monthGridWeekDays: calendarSystem.monthGridWeekDays, monthGridCalendarDays: calendarSystem.monthGridCalendarDays }, monthGridViews),
|
|
52
53
|
weekGridProps: __assign({ weekGridTwentyFourHoursArray: calendarSystem.weekGridTwentyFourHoursArray, weekGridCurrentWeekDays: calendarSystem.weekGridCurrentWeekDays }, weekGridViews),
|
|
53
54
|
dayGridProps: __assign({ dayGridTwentyFourHoursArray: calendarSystem.dayGridTwentyFourHoursArray, dayGridCurrentDay: calendarSystem.dayGridCurrentDay }, dayGridViews)
|
|
54
|
-
}); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, props.asideCalendarProps, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
|
|
55
|
+
}); }, [props.className, props.style, props.additionalViewProps, props.eventBlock.title, props.asideCalendarProps, props.children, calendarSystem, monthGridViews, weekGridViews, dayGridViews]);
|
|
55
56
|
return components.ui.renderView(props.view || 'content.CalendarSystemView', viewProps);
|
|
56
57
|
}
|
|
57
58
|
exports["default"] = CalendarSystem;
|
|
@@ -58,7 +58,6 @@ export interface ICheckboxListFieldProps extends IFieldWrapperInputProps, Omit<I
|
|
|
58
58
|
viewProps?: {
|
|
59
59
|
[key: string]: any;
|
|
60
60
|
};
|
|
61
|
-
[key: string]: any;
|
|
62
61
|
}
|
|
63
62
|
export interface ICheckboxListFieldViewProps extends IFieldWrapperOutputProps, IUiComponent {
|
|
64
63
|
inputProps: {
|
|
@@ -39,6 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
exports.__esModule = true;
|
|
40
40
|
var react_1 = __importStar(require("react"));
|
|
41
41
|
var react_use_1 = require("react-use");
|
|
42
|
+
var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
|
|
42
43
|
var hooks_1 = require("../../../hooks");
|
|
43
44
|
var fieldWrapper_1 = __importDefault(require("../../../ui/form/Field/fieldWrapper"));
|
|
44
45
|
function CheckboxListField(props) {
|
|
@@ -53,6 +54,7 @@ function CheckboxListField(props) {
|
|
|
53
54
|
selectedIds: inputSelectedIds,
|
|
54
55
|
multiple: props.multiple,
|
|
55
56
|
primaryKey: props.primaryKey,
|
|
57
|
+
selectFirst: props.selectFirst,
|
|
56
58
|
items: items,
|
|
57
59
|
inputValue: props.input.value
|
|
58
60
|
}), selectedIds = _a.selectedIds, setSelectedIds = _a.setSelectedIds;
|
|
@@ -61,12 +63,16 @@ function CheckboxListField(props) {
|
|
|
61
63
|
}, [setSelectedIds]);
|
|
62
64
|
var inputProps = (0, react_1.useMemo)(function () { return (__assign(__assign({}, props.inputProps), { type: 'checkbox', name: props.input.name, disabled: props.disabled })); }, [props.disabled, props.input, props.inputProps]);
|
|
63
65
|
// Sync with form
|
|
66
|
+
var prevSelectedIds = (0, react_use_1.usePrevious)(selectedIds);
|
|
64
67
|
(0, react_1.useEffect)(function () {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
props.onChange
|
|
68
|
+
if (!(0, isEqual_1["default"])(prevSelectedIds || [], selectedIds)) {
|
|
69
|
+
props.input.onChange.call(null, selectedIds);
|
|
70
|
+
if (props.onChange) {
|
|
71
|
+
props.onChange.call(null, selectedIds);
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
|
-
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, [props.input.onChange, selectedIds]);
|
|
70
76
|
var onReset = (0, react_1.useCallback)(function () {
|
|
71
77
|
setSelectedIds([]);
|
|
72
78
|
}, [setSelectedIds]);
|
|
@@ -71,7 +71,10 @@ function FileFieldComponent(props) {
|
|
|
71
71
|
}
|
|
72
72
|
}, [files, props]);
|
|
73
73
|
var viewProps = (0, react_1.useMemo)(function () { return ({
|
|
74
|
+
input: props.input,
|
|
74
75
|
buttonView: props.buttonView,
|
|
76
|
+
multiple: props.multiple,
|
|
77
|
+
imagesOnly: props.imagesOnly,
|
|
75
78
|
buttonProps: __assign({ label: props.filesLayout === FilesLayout.wall
|
|
76
79
|
? __('Upload')
|
|
77
80
|
: __('Click to Upload'), size: props.size, disabled: props.disabled, onClick: onBrowse }, props.buttonProps),
|
|
@@ -122,8 +125,7 @@ function FileFieldComponent(props) {
|
|
|
122
125
|
}
|
|
123
126
|
return item;
|
|
124
127
|
})
|
|
125
|
-
}); }, [FileFieldItemView, files, onBrowse, onRemove, props.buttonProps, props.buttonView, props.className, props.disabled,
|
|
126
|
-
props.filesLayout, props.imagesOnly, props.imagesProcessor, props.itemProps, props.showRemove, props.size]);
|
|
128
|
+
}); }, [FileFieldItemView, files, onBrowse, onRemove, props.buttonProps, props.buttonView, props.className, props.disabled, props.filesLayout, props.imagesOnly, props.imagesProcessor, props.input, props.itemProps, props.showRemove, props.size]);
|
|
127
129
|
return (react_1["default"].createElement(FileFieldView, __assign({}, viewProps)));
|
|
128
130
|
}
|
|
129
131
|
function FileField(props) {
|
|
@@ -26,6 +26,10 @@ export interface INumberFieldProps extends IBaseFieldProps {
|
|
|
26
26
|
* Допустимое количество символов после разделителя
|
|
27
27
|
*/
|
|
28
28
|
decimal?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Может ли число быть отрицательным
|
|
31
|
+
*/
|
|
32
|
+
isCanBeNegative?: boolean;
|
|
29
33
|
}
|
|
30
34
|
export interface INumberFieldViewProps extends INumberFieldProps, IFieldWrapperOutputProps {
|
|
31
35
|
inputProps: {
|
|
@@ -52,7 +52,7 @@ function NumberField(props) {
|
|
|
52
52
|
min: props.min,
|
|
53
53
|
value: props.input.value,
|
|
54
54
|
required: props.required
|
|
55
|
-
}, onChange, props.decimal).onInputChange;
|
|
55
|
+
}, onChange, props.decimal, props.isCanBeNegative).onInputChange;
|
|
56
56
|
var onStep = (0, react_1.useCallback)(function (isIncrement) {
|
|
57
57
|
var _a;
|
|
58
58
|
var currentValue = Number((_a = currentInputRef === null || currentInputRef === void 0 ? void 0 : currentInputRef.current) === null || _a === void 0 ? void 0 : _a.value);
|
|
@@ -105,6 +105,7 @@ function NumberField(props) {
|
|
|
105
105
|
}
|
|
106
106
|
NumberField.defaultProps = {
|
|
107
107
|
disabled: false,
|
|
108
|
-
required: false
|
|
108
|
+
required: false,
|
|
109
|
+
isCanBeNegative: true
|
|
109
110
|
};
|
|
110
111
|
exports["default"] = (0, fieldWrapper_1["default"])('NumberField', NumberField);
|
|
@@ -5,7 +5,7 @@ interface IInputTypeNumberProps {
|
|
|
5
5
|
value: string | undefined | null;
|
|
6
6
|
required?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const useInputTypeNumber: (currentInputRef: React.MutableRefObject<HTMLInputElement>, inputTypeNumberProps: IInputTypeNumberProps, onChange: (event: React.ChangeEvent<HTMLInputElement>, value?: any) => void, decimal: number) => {
|
|
8
|
+
declare const useInputTypeNumber: (currentInputRef: React.MutableRefObject<HTMLInputElement>, inputTypeNumberProps: IInputTypeNumberProps, onChange: (event: React.ChangeEvent<HTMLInputElement>, value?: any) => void, decimal: number, isCanBeNegative?: boolean) => {
|
|
9
9
|
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
10
|
};
|
|
11
11
|
export default useInputTypeNumber;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var useInputTypeNumber = function (currentInputRef, inputTypeNumberProps, onChange, decimal) {
|
|
7
|
+
var useInputTypeNumber = function (currentInputRef, inputTypeNumberProps, onChange, decimal, isCanBeNegative) {
|
|
8
8
|
react_1["default"].useEffect(function () {
|
|
9
9
|
var _a;
|
|
10
10
|
var defaultValidity = __('The number is not valid.');
|
|
@@ -20,18 +20,30 @@ var useInputTypeNumber = function (currentInputRef, inputTypeNumberProps, onChan
|
|
|
20
20
|
if (!value) {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
var numericFloatRegExp = isCanBeNegative
|
|
24
|
+
/**
|
|
25
|
+
* Подходят отрицательные и положительные числа с плавающей точкой
|
|
26
|
+
* @example -1.0
|
|
27
|
+
* @example 1.1
|
|
28
|
+
*/
|
|
29
|
+
? new RegExp("^-?\\d*\\.?\\d{0,".concat(decimal, "}$"))
|
|
30
|
+
/**
|
|
31
|
+
* Подходят положительные числа с плавающей точкой
|
|
32
|
+
* @example 1.1
|
|
33
|
+
*/
|
|
34
|
+
: new RegExp("^\\d*\\.?\\d{0,".concat(decimal, "}$"));
|
|
35
|
+
var numericRegExp = isCanBeNegative
|
|
36
|
+
/**
|
|
37
|
+
* Подходят отрицательные и положительные целые числа
|
|
38
|
+
* @example 1
|
|
39
|
+
* @example -2
|
|
40
|
+
*/
|
|
41
|
+
? new RegExp('^-?\\d*$')
|
|
42
|
+
/**
|
|
43
|
+
* Подходят положительные целые числа
|
|
44
|
+
* @example 1
|
|
45
|
+
*/
|
|
46
|
+
: new RegExp('^\\d+$');
|
|
35
47
|
return decimal ? numericFloatRegExp.test(value) : numericRegExp.test(value);
|
|
36
48
|
};
|
|
37
49
|
var onInputChange = function (event) {
|