drf-react-by-schema 0.17.9 → 0.17.10

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.
@@ -129,9 +129,11 @@ const GenericModelList = ({ model, columnFields, hiddenFields = [], creatableFie
129
129
  return;
130
130
  }
131
131
  });
132
- if (forceReload) {
133
- loadObjectList();
134
- }
132
+ (0, react_1.useEffect)(() => {
133
+ if (forceReload) {
134
+ loadObjectList();
135
+ }
136
+ }, [forceReload]);
135
137
  (0, react_1.useEffect)(() => {
136
138
  loadObjectList();
137
139
  }, [model, defaultFilter, queryParams, hiddenFields]);
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { FieldValues, SubmitHandler, UseFormGetValues, UseFormSetValue } from 'react-hook-form';
3
3
  import { AlertColor, AlertPropsColorOverrides } from '@mui/material/Alert';
4
4
  import { OverridableStringUnion } from '@mui/types';
5
- import { ItemSchemaColumnsType, Id, Item, SchemaType, DataSchemaColumnsType, OnSuccessEvent, OptionsAC, GenericValue, FormFieldLayout, TargetApiParamsLocal, GetGenericModelListPropsLocal } from '../utils';
5
+ import { ItemSchemaColumnsType, Id, Item, SchemaType, DataSchemaColumnsType, OnSuccessEvent, OptionsAC, GenericValue, FormFieldLayout, TargetApiParamsLocal, TargetApiPostParamsLocal, GetGenericModelListPropsLocal } from '../utils';
6
6
  import { serverEndPointType } from './DRFReactBySchemaContext';
7
7
  export interface LoadSinglePageDataProps {
8
8
  model: string;
@@ -88,7 +88,7 @@ export interface APIWrapperContextType {
88
88
  loginByPayload: (payload: Item) => Promise<boolean>;
89
89
  getSignUpOptions: () => Promise<false | SchemaType>;
90
90
  signUp: (data: Item) => Promise<false | Item>;
91
- postData: (params: TargetApiParamsLocal) => Promise<false | Item>;
91
+ postData: (params: TargetApiPostParamsLocal) => Promise<false | Item>;
92
92
  serverEndPoint: serverEndPointType;
93
93
  editModel: React.MutableRefObject<Item>;
94
94
  updateModel: (p: TargetApiParamsLocal) => Promise<false | Item>;
package/dist/utils.d.ts CHANGED
@@ -179,7 +179,7 @@ export declare function reducer<T>(state: T | null, newState: Partial<T> | null)
179
179
  export declare const getPatternFormat: (type: string) => string;
180
180
  export type AddParametersToEnd<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (...args: [...Parameters<TFunction>, ...TParameters]) => ReturnType<TFunction>;
181
181
  export declare function buildDateFormatBySchema(dateViews: string[] | null | undefined): "DD/MM/YYYY" | "MM/YYYY" | "YYYY" | "MM" | "DD";
182
- export declare const slugToCamelCase: (str: string) => string;
182
+ export declare const slugToCamelCase: (str: string, includeFirst?: boolean) => string;
183
183
  export declare const slugify: (text: string | null) => string;
184
184
  export declare function mergeFilterItems(defaultFilter: GridFilterModel | undefined, filter: GridFilterModel | undefined): GridFilterModel | undefined;
185
185
  export type ActionType = 'editInline' | 'remove' | 'edit' | 'view';
package/dist/utils.js CHANGED
@@ -311,10 +311,16 @@ function buildDateFormatBySchema(dateViews) {
311
311
  return defaultFormat;
312
312
  }
313
313
  exports.buildDateFormatBySchema = buildDateFormatBySchema;
314
- const slugToCamelCase = (str) => {
314
+ const slugToCamelCase = (str, includeFirst = false) => {
315
+ if (!str) {
316
+ return '';
317
+ }
315
318
  const ret = str.replace(/_([a-z])/g, function (g) {
316
319
  return g[1].toUpperCase();
317
320
  });
321
+ if (includeFirst) {
322
+ return ret[0].toUpperCase() + ret.slice(1);
323
+ }
318
324
  return ret;
319
325
  };
320
326
  exports.slugToCamelCase = slugToCamelCase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drf-react-by-schema",
3
- "version": "0.17.9",
3
+ "version": "0.17.10",
4
4
  "description": "Components and Tools for building a React App having Django Rest Framework (DRF) as server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",