@steroidsjs/core 2.2.67 → 2.2.70

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.
@@ -117,21 +117,22 @@ function useDataProvider(config) {
117
117
  react_1.useEffect(function () {
118
118
  var fetchRemote = function (isAuto) { return __awaiter(_this, void 0, void 0, function () {
119
119
  var searchHandler, result, newItems;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
120
+ var _a;
121
+ return __generator(this, function (_b) {
122
+ switch (_b.label) {
122
123
  case 0:
123
124
  searchHandler = dataProvider.onSearch || (typeof dataProvider.action === 'function'
124
125
  ? function (method, params) { return method(components.api, params).then(function (response) { return response.data; }); }
125
126
  : function (method, params) { return components.http.send(dataProvider.actionMethod, method, params)
126
127
  .then(function (response) { return response.data; }); });
127
- result = searchHandler(dataProvider.action, __assign(__assign({ query: config.query }, (isAuto ? { ids: config.initialSelectedIds } : null)), config.dataProvider.params));
128
+ result = searchHandler(dataProvider.action, __assign(__assign(__assign({ query: config.query }, (isAuto ? { ids: config.initialSelectedIds } : null)), (((_a = config.initialSelectedIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? { withIds: config.initialSelectedIds } : null)), config.dataProvider.params));
128
129
  if (!(result && isFunction_1["default"](result.then))) return [3 /*break*/, 2];
129
130
  setIsLoading(true);
130
131
  return [4 /*yield*/, result];
131
132
  case 1:
132
- newItems = _a.sent();
133
+ newItems = _b.sent();
133
134
  setIsLoading(false);
134
- _a.label = 2;
135
+ _b.label = 2;
135
136
  case 2:
136
137
  // Update items
137
138
  newItems = data_1.normalizeItems(newItems);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.67",
3
+ "version": "2.2.70",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
package/reducers/form.js CHANGED
@@ -19,6 +19,7 @@ var get_1 = __importDefault(require("lodash-es/get"));
19
19
  var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
20
20
  var cloneDeep_1 = __importDefault(require("lodash-es/cloneDeep"));
21
21
  var isObject_1 = __importDefault(require("lodash-es/isObject"));
22
+ var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
22
23
  var dot_prop_immutable_1 = require("dot-prop-immutable");
23
24
  var form_1 = require("../actions/form");
24
25
  /**
@@ -35,7 +36,7 @@ function reducerItem(state, action) {
35
36
  }
36
37
  switch (action.type) {
37
38
  case form_1.FORM_INITIALIZE:
38
- return __assign(__assign({ errors: {}, isInvalid: false, isSubmitting: false }, state), { values: cloneDeep_1["default"](action.values || {}) || (state === null || state === void 0 ? void 0 : state.values), initialValues: action.values || (state === null || state === void 0 ? void 0 : state.values) || null });
39
+ return __assign(__assign({ errors: {}, isInvalid: false, isSubmitting: false }, state), { values: cloneDeep_1["default"](action.values) || (state === null || state === void 0 ? void 0 : state.values) || {}, initialValues: action.values || (state === null || state === void 0 ? void 0 : state.values) || null });
39
40
  case form_1.FORM_CHANGE:
40
41
  if (isObject_1["default"](action.nameOrObject)) {
41
42
  var newValues = __assign(__assign({}, state.values), action.nameOrObject);
@@ -46,7 +47,7 @@ function reducerItem(state, action) {
46
47
  }
47
48
  return dot_prop_immutable_1.set(state, 'values.' + action.nameOrObject, action.value);
48
49
  case form_1.FORM_SET_ERRORS:
49
- return dot_prop_immutable_1.set(state, 'errors', action.errors);
50
+ return __assign(__assign({}, state), { errors: action.errors, isInvalid: !isEmpty_1["default"](action.errors) });
50
51
  case form_1.FORM_SUBMIT:
51
52
  return dot_prop_immutable_1.set(state, 'submitCounter', (state.submitCounter || 0) + 1);
52
53
  case form_1.FORM_SET_SUBMITTING:
@@ -151,6 +151,7 @@ export interface IFormViewProps {
151
151
  submitLabel?: string;
152
152
  fields?: (string | IFieldProps)[];
153
153
  onSubmit: any;
154
+ isInvalid?: boolean;
154
155
  className?: CssClassName;
155
156
  isBordered?: boolean;
156
157
  autoFocus?: boolean;