@steroidsjs/core 3.0.0-beta.118 → 3.0.0-beta.119

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.
@@ -18182,6 +18182,15 @@
18182
18182
  "example": "{\n label: 'All',\n id: 'all'\n}",
18183
18183
  "defaultValue": null
18184
18184
  },
18185
+ {
18186
+ "name": "itemView",
18187
+ "decorators": [],
18188
+ "description": "Кастомная вьюшка для элемента",
18189
+ "required": false,
18190
+ "type": "React.ReactNode | {}",
18191
+ "example": null,
18192
+ "defaultValue": null
18193
+ },
18185
18194
  {
18186
18195
  "name": "items",
18187
18196
  "decorators": [],
@@ -18596,6 +18605,14 @@
18596
18605
  "type": "{id: string, label: string}",
18597
18606
  "example": null
18598
18607
  },
18608
+ {
18609
+ "name": "itemView",
18610
+ "decorators": [],
18611
+ "description": "Кастомная вьюшка для элемента",
18612
+ "required": false,
18613
+ "type": "React.ReactNode | {}",
18614
+ "example": null
18615
+ },
18599
18616
  {
18600
18617
  "name": "items",
18601
18618
  "decorators": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.0-beta.118",
3
+ "version": "3.0.0-beta.119",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -126,6 +126,10 @@ export interface IDropDownFieldProps extends IFieldWrapperInputProps, Omit<IData
126
126
  label: string;
127
127
  id: string;
128
128
  };
129
+ /**
130
+ * Кастомная вьюшка для элемента
131
+ */
132
+ itemView?: CustomView;
129
133
  [key: string]: any;
130
134
  }
131
135
  export interface IDropDownFieldViewProps extends IDropDownFieldProps {
@@ -170,7 +170,7 @@ function DropDownField(props) {
170
170
  onReset();
171
171
  }
172
172
  }, [onReset, prevInputValue, props.input.value, selectedIds.length]);
173
- var renderItemView = function (item, type, src) { return components.ui.renderView('form.DropDownFieldItemView', {
173
+ var renderItemView = function (item, type, src) { return components.ui.renderView(props.itemView || 'form.DropDownFieldItemView', {
174
174
  item: __assign(__assign({}, item), { contentSrc: src, contentType: type }),
175
175
  selectedIds: selectedIds,
176
176
  size: props.size,
@@ -80,9 +80,10 @@ var renderComponent = function (route, activePath, routeProps) {
80
80
  return (React.createElement(Component, __assign({}, routeProps, route.componentProps)));
81
81
  };
82
82
  function Router(props) {
83
+ var _a;
83
84
  var components = (0, hooks_1.useComponents)();
84
85
  var routeParams = (0, hooks_1.useSelector)(router_2.getRouteParams);
85
- var _a = (0, hooks_1.useSelector)(function (state) {
86
+ var _b = (0, hooks_1.useSelector)(function (state) {
86
87
  var _a, _b;
87
88
  return ({
88
89
  isInitialized: (0, router_2.isRouterInitialized)(state),
@@ -91,7 +92,7 @@ function Router(props) {
91
92
  activePath: (_b = (_a = state.router) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.pathname,
92
93
  activeRouteIds: (0, router_2.getActiveRouteIds)(state)
93
94
  });
94
- }), isInitialized = _a.isInitialized, pathname = _a.pathname, route = _a.route, activePath = _a.activePath, activeRouteIds = _a.activeRouteIds;
95
+ }), isInitialized = _b.isInitialized, pathname = _b.pathname, route = _b.route, activePath = _b.activePath, activeRouteIds = _b.activeRouteIds;
95
96
  var routeId = (route === null || route === void 0 ? void 0 : route.id) || null;
96
97
  // Init routes in redux
97
98
  var dispatch = (0, useDispatch_1["default"])();
@@ -101,14 +102,14 @@ function Router(props) {
101
102
  }
102
103
  });
103
104
  // Sync route params with redux
104
- var prevRouteParams = (0, react_use_1.usePreviousDistinct)(routeParams);
105
+ var prevRouteParams = (_a = (0, react_use_1.usePreviousDistinct)(routeParams)) !== null && _a !== void 0 ? _a : routeParams;
105
106
  (0, react_1.useEffect)(function () {
106
107
  if (!(0, isEqual_1["default"])(prevRouteParams, routeParams)) {
107
108
  dispatch((0, router_1.initParams)(routeParams));
108
109
  }
109
110
  }, [dispatch, prevRouteParams, routeParams]);
110
111
  // Routes state
111
- var _b = (0, react_1.useState)((0, helpers_1.treeToList)(props.routes, true, null, props.alwaysAppendParentRoutePath)), routes = _b[0], setRoutes = _b[1];
112
+ var _c = (0, react_1.useState)((0, helpers_1.treeToList)(props.routes, true, null, props.alwaysAppendParentRoutePath)), routes = _c[0], setRoutes = _c[1];
112
113
  (0, react_use_1.useUpdateEffect)(function () {
113
114
  setRoutes(props.routes);
114
115
  }, [props.routes]);