@steroidsjs/core 3.0.22 → 3.0.24

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.
@@ -13569,6 +13569,15 @@
13569
13569
  "example": "true",
13570
13570
  "defaultValue": null
13571
13571
  },
13572
+ {
13573
+ "name": "empty",
13574
+ "decorators": [],
13575
+ "description": "Текст при отсутствии элементов",
13576
+ "required": false,
13577
+ "type": "string",
13578
+ "example": "'Ничего не найдено'",
13579
+ "defaultValue": null
13580
+ },
13572
13581
  {
13573
13582
  "name": "errors",
13574
13583
  "decorators": [],
@@ -13921,6 +13930,15 @@
13921
13930
  }
13922
13931
  ],
13923
13932
  "methods": [
13933
+ {
13934
+ "name": "onClear",
13935
+ "decorators": [],
13936
+ "description": "",
13937
+ "required": false,
13938
+ "type": "void",
13939
+ "example": null,
13940
+ "parameters": []
13941
+ },
13924
13942
  {
13925
13943
  "name": "onItemHover",
13926
13944
  "decorators": [],
@@ -17601,6 +17619,15 @@
17601
17619
  "example": null,
17602
17620
  "defaultValue": null
17603
17621
  },
17622
+ {
17623
+ "name": "dateTimeSeparator",
17624
+ "decorators": [],
17625
+ "description": "Разделитель для даты и времени, не влияет на отображение",
17626
+ "required": false,
17627
+ "type": "string",
17628
+ "example": null,
17629
+ "defaultValue": null
17630
+ },
17604
17631
  {
17605
17632
  "name": "disabled",
17606
17633
  "decorators": [],
@@ -20741,6 +20768,15 @@
20741
20768
  "example": null,
20742
20769
  "defaultValue": null
20743
20770
  },
20771
+ {
20772
+ "name": "initialItems",
20773
+ "decorators": [],
20774
+ "description": "Начальные элементы списка",
20775
+ "required": false,
20776
+ "type": "{}[]",
20777
+ "example": "[\n {\n name: 'Ivan',\n amount: 5\n },\n {\n name: 'John',\n amount: 1\n }\n]",
20778
+ "defaultValue": null
20779
+ },
20744
20780
  {
20745
20781
  "name": "initialRowsCount",
20746
20782
  "decorators": [],
@@ -20753,7 +20789,7 @@
20753
20789
  {
20754
20790
  "name": "initialValues",
20755
20791
  "decorators": [],
20756
- "description": "Начальные значения в полях",
20792
+ "description": "Значения для полей при нажатии кнопки 'Добавить'",
20757
20793
  "required": false,
20758
20794
  "type": "{}",
20759
20795
  "example": "{\n name: 'Ivan',\n amount: 5\n}",
@@ -21308,6 +21344,14 @@
21308
21344
  "type": "Record",
21309
21345
  "example": null
21310
21346
  },
21347
+ {
21348
+ "name": "loadingText",
21349
+ "decorators": [],
21350
+ "description": "Текст, который отобразится при загрузке файла",
21351
+ "required": false,
21352
+ "type": "string",
21353
+ "example": "'Loading...'"
21354
+ },
21311
21355
  {
21312
21356
  "name": "mimeTypes",
21313
21357
  "decorators": [],
@@ -21613,6 +21657,15 @@
21613
21657
  "example": "'Visible'",
21614
21658
  "defaultValue": null
21615
21659
  },
21660
+ {
21661
+ "name": "loadingText",
21662
+ "decorators": [],
21663
+ "description": "Текст, который отобразится при загрузке файла",
21664
+ "required": false,
21665
+ "type": "string",
21666
+ "example": "'Loading...'",
21667
+ "defaultValue": null
21668
+ },
21616
21669
  {
21617
21670
  "name": "mimeTypes",
21618
21671
  "decorators": [],
@@ -21947,6 +22000,14 @@
21947
22000
  "type": "any",
21948
22001
  "example": "'Visible'"
21949
22002
  },
22003
+ {
22004
+ "name": "loadingText",
22005
+ "decorators": [],
22006
+ "description": "Текст, который отобразится при загрузке файла",
22007
+ "required": false,
22008
+ "type": "string",
22009
+ "example": "'Loading...'"
22010
+ },
21950
22011
  {
21951
22012
  "name": "mimeTypes",
21952
22013
  "decorators": [],
package/en.json CHANGED
@@ -996,8 +996,13 @@
996
996
  "Начальная дата": "",
997
997
  "Дополнительные данные которые попадут в дата аттрибут data-icon": "",
998
998
  "Компоненты для подключения wysiwyg редактора": "",
999
+ "Текст при отсутствии элементов": "",
999
1000
  "Отображать чекбоксы только на узлах, не имеющих вложенных элементов": "",
1001
+ "Разделитель для даты и времени, не влияет на отображение": "",
1002
+ "Начальные элементы списка": "",
1003
+ "Значения для полей при нажатии кнопки 'Добавить'": "",
1000
1004
  "Размер компонента и вложенных полей": "",
1005
+ "Текст, который отобразится при загрузке файла": "",
1001
1006
  "Параметры для кнопки отправки формы": "",
1002
1007
  "Очищать сообщение об ошибке при редактировании поля. По-умолчанию включено": "",
1003
1008
  "Конструктор редактора 'ckeditor5-react' из библиотеки @steroidsjs/ckeditor5/packages/ckeditor5-build-classic\nПримечание: для использования встроенного отображения 'HtmlField', данный компонент должен быть передан": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.22",
3
+ "version": "3.0.24",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -32,6 +32,11 @@ export interface IAutoCompleteFieldProps extends IBaseFieldProps, IDataProviderC
32
32
  * @example true
33
33
  */
34
34
  searchOnFocus?: boolean;
35
+ /**
36
+ * Текст при отсутствии элементов
37
+ * @example 'Ничего не найдено'
38
+ */
39
+ empty?: string;
35
40
  }
36
41
  export interface IAutoCompleteFieldViewProps extends Omit<IAutoCompleteFieldProps, 'items'> {
37
42
  items: IAutoCompleteItem[];
@@ -53,6 +58,7 @@ export interface IAutoCompleteFieldViewProps extends Omit<IAutoCompleteFieldProp
53
58
  isLoading?: boolean;
54
59
  onItemSelect: (id: PrimaryKey | any) => void;
55
60
  onItemHover: (id: PrimaryKey | any) => void;
61
+ onClear: () => void;
56
62
  }
57
63
  declare const _default: import("../../../ui/form/Field/fieldWrapper").FieldWrapperComponent<IAutoCompleteFieldProps>;
58
64
  export default _default;
@@ -40,14 +40,16 @@ function AutoCompleteField(props) {
40
40
  dataProvider: props.dataProvider,
41
41
  autoComplete: props.autoComplete,
42
42
  autoFetch: props.autoFetch,
43
+ initialSelectedIds: props.selectedIds,
43
44
  query: query
44
- }), items = _b.items, isLoading = _b.isLoading;
45
+ }), items = _b.items, isLoading = _b.isLoading, sourceItems = _b.sourceItems;
45
46
  // Data select
46
47
  var _c = (0, hooks_1.useDataSelect)({
47
48
  selectedIds: props.selectedIds,
48
49
  primaryKey: props.primaryKey,
49
50
  items: items,
50
- inputValue: props.input.value
51
+ inputValue: props.input.value,
52
+ sourceItems: sourceItems
51
53
  }), isOpened = _c.isOpened, setIsOpened = _c.setIsOpened, setIsFocused = _c.setIsFocused, hoveredId = _c.hoveredId, setHoveredId = _c.setHoveredId, selectedIds = _c.selectedIds, setSelectedIds = _c.setSelectedIds;
52
54
  var onOpen = (0, react_1.useCallback)(function () {
53
55
  setQuery('');
@@ -65,6 +67,9 @@ function AutoCompleteField(props) {
65
67
  setIsFocused(false);
66
68
  setIsOpened(false);
67
69
  }, [setIsFocused, setIsOpened]);
70
+ var onClear = (0, react_1.useCallback)(function () {
71
+ setSelectedIds([]);
72
+ }, [setSelectedIds]);
68
73
  // Outside click -> close
69
74
  var forwardedRef = (0, react_1.useRef)(null);
70
75
  (0, react_use_1.useClickAway)(forwardedRef, onClose);
@@ -99,6 +104,7 @@ function AutoCompleteField(props) {
99
104
  onOpen: onOpen,
100
105
  isOpened: isOpened,
101
106
  onClose: onClose,
107
+ onClear: onClear,
102
108
  forwardedRef: forwardedRef,
103
109
  onItemHover: onItemHover,
104
110
  onItemSelect: onItemSelect,
@@ -109,10 +115,12 @@ function AutoCompleteField(props) {
109
115
  required: props.required,
110
116
  categories: getCategories(props.items),
111
117
  className: props.className,
112
- style: props.style
113
- }); }, [inputProps, items, isLoading, hoveredId, selectedIds, onOpen, isOpened, onClose,
114
- onItemHover, onItemSelect, props.primaryKey, props.size, props.placeholder, props.disabled,
115
- props.required, props.items, props.className, props.style]);
118
+ style: props.style,
119
+ showClear: props.showClear,
120
+ empty: props.empty
121
+ }); }, [inputProps, items, isLoading, hoveredId, selectedIds, onOpen, isOpened, onClose, onClear, onItemHover, onItemSelect,
122
+ props.primaryKey, props.size, props.placeholder, props.disabled, props.required, props.items, props.className,
123
+ props.style, props.showClear, props.empty]);
116
124
  return components.ui.renderView(props.view || 'form.AutoCompleteFieldView', viewProps);
117
125
  }
118
126
  AutoCompleteField.defaultProps = {
@@ -120,6 +128,7 @@ AutoCompleteField.defaultProps = {
120
128
  autoComplete: true,
121
129
  multiple: false,
122
130
  disabled: false,
123
- required: false
131
+ required: false,
132
+ showClear: false
124
133
  };
125
134
  exports["default"] = (0, fieldWrapper_1["default"])('AutoCompleteField', AutoCompleteField);
@@ -23,6 +23,10 @@ export interface IDateTimeFieldProps extends IDateInputStateInput, IUiComponent
23
23
  * Опции маски для поля ввода
24
24
  */
25
25
  maskOptions?: MaskitoOptions;
26
+ /**
27
+ * Разделитель для даты и времени, не влияет на отображение
28
+ */
29
+ dateTimeSeparator?: string;
26
30
  [key: string]: any;
27
31
  }
28
32
  export interface IDateTimeFieldViewProps extends IDateInputStateOutput, Pick<IDateTimeFieldProps, 'size' | 'errors' | 'showRemove' | 'calendarProps' | 'className' | 'timePanelViewProps'> {
@@ -27,9 +27,10 @@ var DATE_TIME_SEPARATOR = ', ';
27
27
  * Поля ввода с выпадающими списками для выбора даты и времени
28
28
  */
29
29
  function DateTimeField(props) {
30
+ var _a;
30
31
  var components = (0, hooks_1.useComponents)();
31
32
  var maskInputRef = (0, react_2.useMaskito)({ options: props.maskOptions });
32
- var _a = (0, useDateInputState_1["default"])({
33
+ var _b = (0, useDateInputState_1["default"])({
33
34
  input: props.input,
34
35
  disabled: props.disabled,
35
36
  onChange: props.onChange,
@@ -40,15 +41,15 @@ function DateTimeField(props) {
40
41
  displayFormat: props.displayFormat,
41
42
  useUTC: props.useUTC,
42
43
  dateInUTC: props.dateInUTC
43
- }), onClear = _a.onClear, onClose = _a.onClose, isOpened = _a.isOpened, inputProps = _a.inputProps;
44
- var _b = (0, useDateTime_1["default"])({
44
+ }), onClear = _b.onClear, onClose = _b.onClose, isOpened = _b.isOpened, inputProps = _b.inputProps;
45
+ var _c = (0, useDateTime_1["default"])({
45
46
  displayFormat: props.displayFormat,
46
- dateTimeSeparator: DATE_TIME_SEPARATOR,
47
+ dateTimeSeparator: (_a = props.dateTimeSeparator) !== null && _a !== void 0 ? _a : DATE_TIME_SEPARATOR,
47
48
  input: props.input,
48
49
  valueFormat: props.valueFormat,
49
50
  useUTC: props.useUTC,
50
51
  dateInUTC: props.dateInUTC
51
- }), dateValueFormat = _b.dateValueFormat, dateValue = _b.dateValue, timeValue = _b.timeValue, onDateSelect = _b.onDateSelect, onTimeSelect = _b.onTimeSelect;
52
+ }), dateValueFormat = _c.dateValueFormat, dateValue = _c.dateValue, timeValue = _c.timeValue, onDateSelect = _c.onDateSelect, onTimeSelect = _c.onTimeSelect;
52
53
  // Calendar props
53
54
  var calendarProps = (0, react_1.useMemo)(function () { return (__assign({ value: dateValue, onChange: onDateSelect, valueFormat: dateValueFormat }, props.calendarProps)); }, [dateValue, dateValueFormat, onDateSelect, props.calendarProps]);
54
55
  // TimePanel props
@@ -34,7 +34,7 @@ export interface IFieldListItem extends IFieldWrapperInputProps, IUiComponent {
34
34
  */
35
35
  export interface IFieldListProps extends IFieldWrapperInputProps, IUiComponent {
36
36
  /**
37
- * Начальные значения в полях
37
+ * Значения для полей при нажатии кнопки 'Добавить'
38
38
  * @example
39
39
  * {
40
40
  * name: 'Ivan',
@@ -44,6 +44,23 @@ export interface IFieldListProps extends IFieldWrapperInputProps, IUiComponent {
44
44
  initialValues?: {
45
45
  [key: string]: any;
46
46
  };
47
+ /**
48
+ * Начальные элементы списка
49
+ * @example
50
+ * [
51
+ * {
52
+ * name: 'Ivan',
53
+ * amount: 5
54
+ * },
55
+ * {
56
+ * name: 'John',
57
+ * amount: 1
58
+ * }
59
+ * ]
60
+ */
61
+ initialItems?: {
62
+ [key: string]: any;
63
+ }[];
47
64
  /**
48
65
  * Список с полями формы
49
66
  */
@@ -88,11 +88,15 @@ function FieldList(props) {
88
88
  removeRowIndex(rowIndex);
89
89
  dispatch((0, form_1.formArrayRemove)(context.formId, props.input.name, rowIndex));
90
90
  }, [context.formId, dispatch, props.input.name, removeRowIndex]);
91
- // Add initial rows
92
91
  (0, react_use_1.useMount)(function () {
92
+ // Add initial rows
93
93
  if (!props.input.value) {
94
94
  onAdd(props.initialRowsCount);
95
95
  }
96
+ // Add initial items
97
+ if (props.initialItems) {
98
+ dispatch((0, form_1.formChange)(context.formId, props.input.name, props.initialItems));
99
+ }
96
100
  });
97
101
  // Keyboard navigation
98
102
  var nodeRef = (0, react_1.useRef)();
@@ -138,6 +142,7 @@ function FieldList(props) {
138
142
  }
139
143
  FieldList.defaultProps = {
140
144
  initialValues: null,
145
+ initialItems: null,
141
146
  disabled: false,
142
147
  required: false,
143
148
  showAdd: true,
@@ -21,6 +21,11 @@ interface IFileFieldCommonProps extends IFileInput {
21
21
  * @example 'list'
22
22
  */
23
23
  filesLayout?: FilesLayout | string;
24
+ /**
25
+ * Текст, который отобразится при загрузке файла
26
+ * @example 'Loading...'
27
+ */
28
+ loadingText?: string;
24
29
  }
25
30
  /**
26
31
  * FileField
@@ -82,6 +82,7 @@ function FileFieldComponent(props) {
82
82
  filesLayout: props.filesLayout,
83
83
  className: props.className,
84
84
  itemProps: props.itemProps,
85
+ loadingText: props.loadingText,
85
86
  items: files.map(function (file) {
86
87
  var data = file.getResultHttpMessage() || {};
87
88
  var item = {
@@ -125,7 +126,7 @@ function FileFieldComponent(props) {
125
126
  }
126
127
  return item;
127
128
  })
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]);
129
+ }); }, [FileFieldItemView, files, onBrowse, onRemove, props.buttonProps, props.buttonView, props.className, props.disabled, props.filesLayout, props.imagesOnly, props.imagesProcessor, props.input, props.itemProps, props.loadingText, props.multiple, props.showRemove, props.size]);
129
130
  return (react_1["default"].createElement(FileFieldView, __assign({}, viewProps)));
130
131
  }
131
132
  function FileField(props) {