@gnwebsoft/ui 2.17.2 → 2.17.4

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.
@@ -135,6 +135,33 @@ function getTimezone(adapter, value) {
135
135
  return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
136
136
  }
137
137
 
138
+ // src/utils/handleServerErrors.ts
139
+ var handleServerErrors = function handleServerErrors2(args) {
140
+ const { errors, setError } = args;
141
+ for (const key in errors) {
142
+ const isKeyInVariables = Object.keys(flattenObjectKeys(errors)).includes(
143
+ key
144
+ );
145
+ if (!isKeyInVariables) {
146
+ continue;
147
+ }
148
+ const fieldError = errors[key];
149
+ let errorMessage = "";
150
+ if (Array.isArray(fieldError)) {
151
+ errorMessage = fieldError.join(" ");
152
+ }
153
+ if (typeof fieldError === "string") {
154
+ errorMessage = fieldError;
155
+ }
156
+ if (typeof fieldError === "boolean" && fieldError) {
157
+ errorMessage = "Field is not valid.";
158
+ }
159
+ setError(key, {
160
+ message: errorMessage
161
+ });
162
+ }
163
+ };
164
+
138
165
  // src/utils/propertyExists.ts
139
166
  function propertyExists(obj, prop) {
140
167
  return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
@@ -156,11 +183,25 @@ var removeLeadingTrailingSlashes = (route) => {
156
183
  return route.replace(/^\/|\/$/g, "");
157
184
  };
158
185
 
186
+ // src/utils/schemaTools.ts
187
+ import dayjs from "dayjs";
188
+ import { z } from "zod";
189
+ var schemaTools = {
190
+ date: () => z.coerce.string().transform((c) => c === "null" || c === "undefined" ? null : c).refine((c) => !!c, { message: "required" }).refine((c) => !!c ? dayjs(c).isValid() : true, {
191
+ message: "Invalid date"
192
+ }),
193
+ nullableDate: () => z.coerce.string().transform((c) => c === "null" ? null : c).transform((c) => c === "undefined" ? null : c).refine((c) => !c && c != null ? dayjs(c).isValid() : true, {
194
+ message: "Invalid date"
195
+ })
196
+ };
197
+
159
198
  export {
160
199
  api,
161
200
  flattenObjectKeys,
162
201
  getTimezone,
202
+ handleServerErrors,
163
203
  propertyExists,
164
204
  readValueAsDate,
165
- removeLeadingTrailingSlashes
205
+ removeLeadingTrailingSlashes,
206
+ schemaTools
166
207
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GFSTK7KN.mjs";
4
4
  import {
5
5
  readValueAsDate
6
- } from "./chunk-DMQDQUAE.mjs";
6
+ } from "./chunk-44LP4RZD.mjs";
7
7
 
8
8
  // src/wrappers/DatePickerElement/DatePickerElement.tsx
9
9
  import {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/api.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/utils/api.ts
2
2
  var makeRequest = async (url, options = {}) => {
3
3
  const response = await fetch(url, options);
4
4
  if (response.ok) {
@@ -135,6 +135,33 @@ function getTimezone(adapter, value) {
135
135
  return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
136
136
  }
137
137
 
138
+ // src/utils/handleServerErrors.ts
139
+ var handleServerErrors = function handleServerErrors2(args) {
140
+ const { errors, setError } = args;
141
+ for (const key in errors) {
142
+ const isKeyInVariables = Object.keys(flattenObjectKeys(errors)).includes(
143
+ key
144
+ );
145
+ if (!isKeyInVariables) {
146
+ continue;
147
+ }
148
+ const fieldError = errors[key];
149
+ let errorMessage = "";
150
+ if (Array.isArray(fieldError)) {
151
+ errorMessage = fieldError.join(" ");
152
+ }
153
+ if (typeof fieldError === "string") {
154
+ errorMessage = fieldError;
155
+ }
156
+ if (typeof fieldError === "boolean" && fieldError) {
157
+ errorMessage = "Field is not valid.";
158
+ }
159
+ setError(key, {
160
+ message: errorMessage
161
+ });
162
+ }
163
+ };
164
+
138
165
  // src/utils/propertyExists.ts
139
166
  function propertyExists(obj, prop) {
140
167
  return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
@@ -156,6 +183,20 @@ var removeLeadingTrailingSlashes = (route) => {
156
183
  return route.replace(/^\/|\/$/g, "");
157
184
  };
158
185
 
186
+ // src/utils/schemaTools.ts
187
+ var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);
188
+ var _zod = require('zod');
189
+ var schemaTools = {
190
+ date: () => _zod.z.coerce.string().transform((c) => c === "null" || c === "undefined" ? null : c).refine((c) => !!c, { message: "required" }).refine((c) => !!c ? _dayjs2.default.call(void 0, c).isValid() : true, {
191
+ message: "Invalid date"
192
+ }),
193
+ nullableDate: () => _zod.z.coerce.string().transform((c) => c === "null" ? null : c).transform((c) => c === "undefined" ? null : c).refine((c) => !c && c != null ? _dayjs2.default.call(void 0, c).isValid() : true, {
194
+ message: "Invalid date"
195
+ })
196
+ };
197
+
198
+
199
+
159
200
 
160
201
 
161
202
 
@@ -163,4 +204,4 @@ var removeLeadingTrailingSlashes = (route) => {
163
204
 
164
205
 
165
206
 
166
- exports.api = api; exports.flattenObjectKeys = flattenObjectKeys; exports.getTimezone = getTimezone; exports.propertyExists = propertyExists; exports.readValueAsDate = readValueAsDate; exports.removeLeadingTrailingSlashes = removeLeadingTrailingSlashes;
207
+ exports.api = api; exports.flattenObjectKeys = flattenObjectKeys; exports.getTimezone = getTimezone; exports.handleServerErrors = handleServerErrors; exports.propertyExists = propertyExists; exports.readValueAsDate = readValueAsDate; exports.removeLeadingTrailingSlashes = removeLeadingTrailingSlashes; exports.schemaTools = schemaTools;
@@ -1,10 +1,29 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/components/ClearButton/index.tsx
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/components/ClearButton/ClearButton.tsx
2
+ var _material = require('@mui/material');
2
3
  var _jsxruntime = require('react/jsx-runtime');
4
+ var ClearButton = ({ isSubmitting, handleClear }) => {
5
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Button, { variant: "outlined", onClick: handleClear, disabled: isSubmitting, children: "Clear" });
6
+ };
7
+ var ClearButton_default = ClearButton;
3
8
 
4
9
  // src/components/FilterButton/FilterButton.tsx
10
+ var _lab = require('@mui/lab');
11
+
12
+ var _FilterAlt = require('@mui/icons-material/FilterAlt'); var _FilterAlt2 = _interopRequireDefault(_FilterAlt);
5
13
 
6
14
  var FilterButton = ({ isSubmitting }) => {
7
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
15
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
16
+ _lab.LoadingButton,
17
+ {
18
+ type: "submit",
19
+ variant: "contained",
20
+ loading: isSubmitting,
21
+ disableRipple: true,
22
+ sx: { bgcolor: "#3caed7 !important" },
23
+ startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Badge, { color: "error", variant: "standard", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FilterAlt2.default, { width: "20", height: "20" }) }),
24
+ children: "Filter"
25
+ }
26
+ );
8
27
  };
9
28
  var FilterButton_default = FilterButton;
10
29
 
@@ -16,7 +35,7 @@ var FilterButton_default = FilterButton;
16
35
 
17
36
 
18
37
 
19
- var _material = require('@mui/material');
38
+
20
39
 
21
40
  var FormWrapper = ({
22
41
  children,
@@ -214,4 +233,5 @@ var SimpleToolbar_default = SimpleToolbar;
214
233
 
215
234
 
216
235
 
217
- exports.FilterButton_default = FilterButton_default; exports.FormWrapper_default = FormWrapper_default; exports.LabelText_default = LabelText_default; exports.ListWrapper_default = ListWrapper_default; exports.SimpleToolbar_default = SimpleToolbar_default;
236
+
237
+ exports.ClearButton_default = ClearButton_default; exports.FilterButton_default = FilterButton_default; exports.FormWrapper_default = FormWrapper_default; exports.LabelText_default = LabelText_default; exports.ListWrapper_default = ListWrapper_default; exports.SimpleToolbar_default = SimpleToolbar_default;
@@ -3,7 +3,7 @@
3
3
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
4
4
 
5
5
 
6
- var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.js');
6
+ var _chunkBSA6BJG2js = require('./chunk-BSA6BJG2.js');
7
7
 
8
8
  // src/wrappers/DatePickerElement/DatePickerElement.tsx
9
9
 
@@ -45,7 +45,7 @@ var Component = function DatePickerElement(props) {
45
45
  value: field.value,
46
46
  onChange: field.onChange,
47
47
  transform: {
48
- input: typeof _optionalChain([transform, 'optionalAccess', _3 => _3.input]) === "function" ? transform.input : (newValue) => _chunkYAGXZLL6js.readValueAsDate.call(void 0, adapter, newValue),
48
+ input: typeof _optionalChain([transform, 'optionalAccess', _3 => _3.input]) === "function" ? transform.input : (newValue) => _chunkBSA6BJG2js.readValueAsDate.call(void 0, adapter, newValue),
49
49
  output: typeof _optionalChain([transform, 'optionalAccess', _4 => _4.output]) === "function" ? transform.output : (newValue) => newValue
50
50
  }
51
51
  });
@@ -476,7 +476,7 @@ var Component5 = function TimePickerElement(props) {
476
476
  value: field.value,
477
477
  onChange: field.onChange,
478
478
  transform: {
479
- input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (newValue) => _chunkYAGXZLL6js.readValueAsDate.call(void 0, adapter, newValue),
479
+ input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (newValue) => _chunkBSA6BJG2js.readValueAsDate.call(void 0, adapter, newValue),
480
480
  output: typeof _optionalChain([transform, 'optionalAccess', _16 => _16.output]) === "function" ? transform.output : (newValue) => newValue
481
481
  }
482
482
  });
@@ -1,10 +1,29 @@
1
- // src/components/ClearButton/index.tsx
2
- import { Fragment, jsx } from "react/jsx-runtime";
1
+ // src/components/ClearButton/ClearButton.tsx
2
+ import { Button } from "@mui/material";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var ClearButton = ({ isSubmitting, handleClear }) => {
5
+ return /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: handleClear, disabled: isSubmitting, children: "Clear" });
6
+ };
7
+ var ClearButton_default = ClearButton;
3
8
 
4
9
  // src/components/FilterButton/FilterButton.tsx
5
- import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
10
+ import { LoadingButton } from "@mui/lab";
11
+ import { Badge } from "@mui/material";
12
+ import FilterAltIcon from "@mui/icons-material/FilterAlt";
13
+ import { jsx as jsx2 } from "react/jsx-runtime";
6
14
  var FilterButton = ({ isSubmitting }) => {
7
- return /* @__PURE__ */ jsx2(Fragment2, {});
15
+ return /* @__PURE__ */ jsx2(
16
+ LoadingButton,
17
+ {
18
+ type: "submit",
19
+ variant: "contained",
20
+ loading: isSubmitting,
21
+ disableRipple: true,
22
+ sx: { bgcolor: "#3caed7 !important" },
23
+ startIcon: /* @__PURE__ */ jsx2(Badge, { color: "error", variant: "standard", children: /* @__PURE__ */ jsx2(FilterAltIcon, { width: "20", height: "20" }) }),
24
+ children: "Filter"
25
+ }
26
+ );
8
27
  };
9
28
  var FilterButton_default = FilterButton;
10
29
 
@@ -17,15 +36,15 @@ import {
17
36
  Grid2,
18
37
  Typography
19
38
  } from "@mui/material";
20
- import { Fragment as Fragment3, jsx as jsx3, jsxs } from "react/jsx-runtime";
39
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
21
40
  var FormWrapper = ({
22
41
  children,
23
42
  title,
24
43
  editMode,
25
44
  breadCrumb
26
45
  }) => {
27
- return /* @__PURE__ */ jsxs(Fragment3, { children: [
28
- breadCrumb ? breadCrumb : /* @__PURE__ */ jsx3(Fragment3, {}),
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ breadCrumb ? breadCrumb : /* @__PURE__ */ jsx3(Fragment, {}),
29
48
  /* @__PURE__ */ jsxs(
30
49
  Card,
31
50
  {
@@ -209,6 +228,7 @@ var SimpleToolbar = () => /* @__PURE__ */ jsxs4(GridToolbarContainer, { children
209
228
  var SimpleToolbar_default = SimpleToolbar;
210
229
 
211
230
  export {
231
+ ClearButton_default,
212
232
  FilterButton_default,
213
233
  FormWrapper_default,
214
234
  LabelText_default,
@@ -1,6 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import react__default, { PropsWithChildren } from 'react';
3
3
 
4
+ type ClearButtonProps = {
5
+ isSubmitting: boolean;
6
+ handleClear: () => void;
7
+ };
8
+ declare const ClearButton: ({ isSubmitting, handleClear }: ClearButtonProps) => react_jsx_runtime.JSX.Element;
9
+
4
10
  type FilterButtonProps = {
5
11
  isSubmitting: boolean;
6
12
  };
@@ -28,4 +34,4 @@ declare const ListWrapper: ({ children, title, count }: ListWrapperProps) => rea
28
34
 
29
35
  declare const SimpleToolbar: () => react_jsx_runtime.JSX.Element;
30
36
 
31
- export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar };
37
+ export { ClearButton, FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar };
@@ -1,6 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import react__default, { PropsWithChildren } from 'react';
3
3
 
4
+ type ClearButtonProps = {
5
+ isSubmitting: boolean;
6
+ handleClear: () => void;
7
+ };
8
+ declare const ClearButton: ({ isSubmitting, handleClear }: ClearButtonProps) => react_jsx_runtime.JSX.Element;
9
+
4
10
  type FilterButtonProps = {
5
11
  isSubmitting: boolean;
6
12
  };
@@ -28,4 +34,4 @@ declare const ListWrapper: ({ children, title, count }: ListWrapperProps) => rea
28
34
 
29
35
  declare const SimpleToolbar: () => react_jsx_runtime.JSX.Element;
30
36
 
31
- export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar };
37
+ export { ClearButton, FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar };
@@ -4,11 +4,13 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkPCTIEZLNjs = require('../chunk-PCTIEZLN.js');
8
7
 
8
+ var _chunkMXOTA42Jjs = require('../chunk-MXOTA42J.js');
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
- exports.FilterButton = _chunkPCTIEZLNjs.FilterButton_default; exports.FormWrapper = _chunkPCTIEZLNjs.FormWrapper_default; exports.LabelText = _chunkPCTIEZLNjs.LabelText_default; exports.ListWrapper = _chunkPCTIEZLNjs.ListWrapper_default; exports.SimpleToolbar = _chunkPCTIEZLNjs.SimpleToolbar_default;
14
+
15
+
16
+ exports.ClearButton = _chunkMXOTA42Jjs.ClearButton_default; exports.FilterButton = _chunkMXOTA42Jjs.FilterButton_default; exports.FormWrapper = _chunkMXOTA42Jjs.FormWrapper_default; exports.LabelText = _chunkMXOTA42Jjs.LabelText_default; exports.ListWrapper = _chunkMXOTA42Jjs.ListWrapper_default; exports.SimpleToolbar = _chunkMXOTA42Jjs.SimpleToolbar_default;
@@ -1,11 +1,13 @@
1
1
  import {
2
+ ClearButton_default,
2
3
  FilterButton_default,
3
4
  FormWrapper_default,
4
5
  LabelText_default,
5
6
  ListWrapper_default,
6
7
  SimpleToolbar_default
7
- } from "../chunk-2LTU3GNL.mjs";
8
+ } from "../chunk-WE5MOMEE.mjs";
8
9
  export {
10
+ ClearButton_default as ClearButton,
9
11
  FilterButton_default as FilterButton,
10
12
  FormWrapper_default as FormWrapper,
11
13
  LabelText_default as LabelText,
package/dist/index.d.mts CHANGED
@@ -1,14 +1,15 @@
1
- export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.mjs';
1
+ export { ClearButton, FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.mjs';
2
2
  export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.mjs';
3
+ export { AsyncMultiSelectPayload, ListResponse, OptionItem, OptionItem2, PostModel } from './types/index.mjs';
4
+ export { api, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools } from './utils/index.mjs';
5
+ export { Field } from './wrappers/index.mjs';
3
6
  export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.mjs';
4
7
  export { A as AsyncSelectPayload } from './AsyncSelectPayload-DHN-R3gc.mjs';
5
- export { AsyncMultiSelectPayload, OptionItem, OptionItem2 } from './types/index.mjs';
6
- export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.mjs';
7
- export { Field } from './wrappers/index.mjs';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
10
10
  import 'react-hook-form';
11
11
  import '@mui/x-date-pickers';
12
12
  import '@mui/x-date-pickers/internals';
13
+ import 'zod';
13
14
  import '@mui/material';
14
15
  import '@mui/x-date-pickers/models';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.js';
1
+ export { ClearButton, FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.js';
2
2
  export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.js';
3
+ export { AsyncMultiSelectPayload, ListResponse, OptionItem, OptionItem2, PostModel } from './types/index.js';
4
+ export { api, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools } from './utils/index.js';
5
+ export { Field } from './wrappers/index.js';
3
6
  export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.js';
4
7
  export { A as AsyncSelectPayload } from './AsyncSelectPayload-DHN-R3gc.js';
5
- export { AsyncMultiSelectPayload, OptionItem, OptionItem2 } from './types/index.js';
6
- export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.js';
7
- export { Field } from './wrappers/index.js';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
10
10
  import 'react-hook-form';
11
11
  import '@mui/x-date-pickers';
12
12
  import '@mui/x-date-pickers/internals';
13
+ import 'zod';
13
14
  import '@mui/material';
14
15
  import '@mui/x-date-pickers/models';
package/dist/index.js CHANGED
@@ -4,12 +4,13 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkPCTIEZLNjs = require('./chunk-PCTIEZLN.js');
7
+
8
+ var _chunkMXOTA42Jjs = require('./chunk-MXOTA42J.js');
8
9
  require('./chunk-7M2VOCYN.js');
9
10
  require('./chunk-TLJXC46A.js');
10
11
 
11
12
 
12
- var _chunkNLI47OFIjs = require('./chunk-NLI47OFI.js');
13
+ var _chunkTP5OSIU5js = require('./chunk-TP5OSIU5.js');
13
14
 
14
15
 
15
16
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
@@ -20,7 +21,12 @@ var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
20
21
 
21
22
 
22
23
 
23
- var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.js');
24
+
25
+
26
+ var _chunkBSA6BJG2js = require('./chunk-BSA6BJG2.js');
27
+
28
+
29
+
24
30
 
25
31
 
26
32
 
@@ -35,4 +41,4 @@ var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.js');
35
41
 
36
42
 
37
43
 
38
- exports.Field = _chunkNLI47OFIjs.Field_default; exports.FilterButton = _chunkPCTIEZLNjs.FilterButton_default; exports.FormWrapper = _chunkPCTIEZLNjs.FormWrapper_default; exports.LabelText = _chunkPCTIEZLNjs.LabelText_default; exports.ListWrapper = _chunkPCTIEZLNjs.ListWrapper_default; exports.SimpleToolbar = _chunkPCTIEZLNjs.SimpleToolbar_default; exports.api = _chunkYAGXZLL6js.api; exports.flattenObjectKeys = _chunkYAGXZLL6js.flattenObjectKeys; exports.getTimezone = _chunkYAGXZLL6js.getTimezone; exports.propertyExists = _chunkYAGXZLL6js.propertyExists; exports.readValueAsDate = _chunkYAGXZLL6js.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkYAGXZLL6js.removeLeadingTrailingSlashes; exports.useTransform = _chunk6JZ35VQJjs.useTransform;
44
+ exports.ClearButton = _chunkMXOTA42Jjs.ClearButton_default; exports.Field = _chunkTP5OSIU5js.Field_default; exports.FilterButton = _chunkMXOTA42Jjs.FilterButton_default; exports.FormWrapper = _chunkMXOTA42Jjs.FormWrapper_default; exports.LabelText = _chunkMXOTA42Jjs.LabelText_default; exports.ListWrapper = _chunkMXOTA42Jjs.ListWrapper_default; exports.SimpleToolbar = _chunkMXOTA42Jjs.SimpleToolbar_default; exports.api = _chunkBSA6BJG2js.api; exports.flattenObjectKeys = _chunkBSA6BJG2js.flattenObjectKeys; exports.getTimezone = _chunkBSA6BJG2js.getTimezone; exports.handleServerErrors = _chunkBSA6BJG2js.handleServerErrors; exports.propertyExists = _chunkBSA6BJG2js.propertyExists; exports.readValueAsDate = _chunkBSA6BJG2js.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkBSA6BJG2js.removeLeadingTrailingSlashes; exports.schemaTools = _chunkBSA6BJG2js.schemaTools; exports.useTransform = _chunk6JZ35VQJjs.useTransform;
package/dist/index.mjs CHANGED
@@ -1,15 +1,16 @@
1
1
  import {
2
+ ClearButton_default,
2
3
  FilterButton_default,
3
4
  FormWrapper_default,
4
5
  LabelText_default,
5
6
  ListWrapper_default,
6
7
  SimpleToolbar_default
7
- } from "./chunk-2LTU3GNL.mjs";
8
+ } from "./chunk-WE5MOMEE.mjs";
8
9
  import "./chunk-2JFL7TS5.mjs";
9
10
  import "./chunk-5VR5QVUV.mjs";
10
11
  import {
11
12
  Field_default
12
- } from "./chunk-2VRWJP7M.mjs";
13
+ } from "./chunk-B3F2F3PI.mjs";
13
14
  import {
14
15
  useTransform
15
16
  } from "./chunk-GFSTK7KN.mjs";
@@ -17,11 +18,14 @@ import {
17
18
  api,
18
19
  flattenObjectKeys,
19
20
  getTimezone,
21
+ handleServerErrors,
20
22
  propertyExists,
21
23
  readValueAsDate,
22
- removeLeadingTrailingSlashes
23
- } from "./chunk-DMQDQUAE.mjs";
24
+ removeLeadingTrailingSlashes,
25
+ schemaTools
26
+ } from "./chunk-44LP4RZD.mjs";
24
27
  export {
28
+ ClearButton_default as ClearButton,
25
29
  Field_default as Field,
26
30
  FilterButton_default as FilterButton,
27
31
  FormWrapper_default as FormWrapper,
@@ -31,8 +35,10 @@ export {
31
35
  api,
32
36
  flattenObjectKeys,
33
37
  getTimezone,
38
+ handleServerErrors,
34
39
  propertyExists,
35
40
  readValueAsDate,
36
41
  removeLeadingTrailingSlashes,
42
+ schemaTools,
37
43
  useTransform
38
44
  };
@@ -14,4 +14,20 @@ type OptionItem2 = {
14
14
  value: number;
15
15
  };
16
16
 
17
- export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
17
+ type PostModel<TFilterModel> = {
18
+ filterModel?: TFilterModel;
19
+ pageOffset: number;
20
+ pageSize: number;
21
+ sortField: string | null;
22
+ sortOrder: "asc" | "desc" | null | undefined;
23
+ sortModel?: {
24
+ sortField: string | null;
25
+ sortDirection: string | null;
26
+ };
27
+ };
28
+ type ListResponse<TGridModel> = {
29
+ data: TGridModel[];
30
+ total: number;
31
+ };
32
+
33
+ export type { AsyncMultiSelectPayload, ListResponse, OptionItem, OptionItem2, PostModel };
@@ -14,4 +14,20 @@ type OptionItem2 = {
14
14
  value: number;
15
15
  };
16
16
 
17
- export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
17
+ type PostModel<TFilterModel> = {
18
+ filterModel?: TFilterModel;
19
+ pageOffset: number;
20
+ pageSize: number;
21
+ sortField: string | null;
22
+ sortOrder: "asc" | "desc" | null | undefined;
23
+ sortModel?: {
24
+ sortField: string | null;
25
+ sortDirection: string | null;
26
+ };
27
+ };
28
+ type ListResponse<TGridModel> = {
29
+ data: TGridModel[];
30
+ total: number;
31
+ };
32
+
33
+ export type { AsyncMultiSelectPayload, ListResponse, OptionItem, OptionItem2, PostModel };
@@ -1,6 +1,8 @@
1
1
  import { A as ApiResponse } from '../ApiResponse-DWjEML13.mjs';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers';
3
3
  import { useLocalizationContext } from '@mui/x-date-pickers/internals';
4
+ import { FieldValues, UseFormSetError } from 'react-hook-form';
5
+ import { z } from 'zod';
4
6
 
5
7
  declare class api {
6
8
  static post<T>(url: string, body?: any): Promise<ApiResponse<T>>;
@@ -18,10 +20,21 @@ declare const flattenObjectKeys: (obj: any, prefix?: string) => {
18
20
 
19
21
  declare function getTimezone<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: TDate): string | null;
20
22
 
23
+ type HandleServerErrorsType<TFieldValues extends FieldValues = FieldValues> = {
24
+ errors: Record<string, string[]>;
25
+ setError: UseFormSetError<TFieldValues>;
26
+ };
27
+ declare const handleServerErrors: <TFieldValues extends FieldValues = FieldValues>(args: HandleServerErrorsType<TFieldValues>) => void;
28
+
21
29
  declare function propertyExists<X, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
22
30
 
23
31
  declare function readValueAsDate<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: string | null | TDate): TDate | null;
24
32
 
25
33
  declare const removeLeadingTrailingSlashes: (route: string) => string;
26
34
 
27
- export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
35
+ declare const schemaTools: {
36
+ date: () => z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string | null, string>, string | null, string>, string | null, string>;
37
+ nullableDate: () => z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string | null, string>, string | null, string>, string | null, string>;
38
+ };
39
+
40
+ export { api, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools };
@@ -1,6 +1,8 @@
1
1
  import { A as ApiResponse } from '../ApiResponse-DWjEML13.js';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers';
3
3
  import { useLocalizationContext } from '@mui/x-date-pickers/internals';
4
+ import { FieldValues, UseFormSetError } from 'react-hook-form';
5
+ import { z } from 'zod';
4
6
 
5
7
  declare class api {
6
8
  static post<T>(url: string, body?: any): Promise<ApiResponse<T>>;
@@ -18,10 +20,21 @@ declare const flattenObjectKeys: (obj: any, prefix?: string) => {
18
20
 
19
21
  declare function getTimezone<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: TDate): string | null;
20
22
 
23
+ type HandleServerErrorsType<TFieldValues extends FieldValues = FieldValues> = {
24
+ errors: Record<string, string[]>;
25
+ setError: UseFormSetError<TFieldValues>;
26
+ };
27
+ declare const handleServerErrors: <TFieldValues extends FieldValues = FieldValues>(args: HandleServerErrorsType<TFieldValues>) => void;
28
+
21
29
  declare function propertyExists<X, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
22
30
 
23
31
  declare function readValueAsDate<TDate extends PickerValidDate>(adapter: ReturnType<typeof useLocalizationContext>, value: string | null | TDate): TDate | null;
24
32
 
25
33
  declare const removeLeadingTrailingSlashes: (route: string) => string;
26
34
 
27
- export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
35
+ declare const schemaTools: {
36
+ date: () => z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string | null, string>, string | null, string>, string | null, string>;
37
+ nullableDate: () => z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string | null, string>, string | null, string>, string | null, string>;
38
+ };
39
+
40
+ export { api, flattenObjectKeys, getTimezone, handleServerErrors, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools };
@@ -5,12 +5,16 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkYAGXZLL6js = require('../chunk-YAGXZLL6.js');
9
8
 
10
9
 
10
+ var _chunkBSA6BJG2js = require('../chunk-BSA6BJG2.js');
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
- exports.api = _chunkYAGXZLL6js.api; exports.flattenObjectKeys = _chunkYAGXZLL6js.flattenObjectKeys; exports.getTimezone = _chunkYAGXZLL6js.getTimezone; exports.propertyExists = _chunkYAGXZLL6js.propertyExists; exports.readValueAsDate = _chunkYAGXZLL6js.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkYAGXZLL6js.removeLeadingTrailingSlashes;
16
+
17
+
18
+
19
+
20
+ exports.api = _chunkBSA6BJG2js.api; exports.flattenObjectKeys = _chunkBSA6BJG2js.flattenObjectKeys; exports.getTimezone = _chunkBSA6BJG2js.getTimezone; exports.handleServerErrors = _chunkBSA6BJG2js.handleServerErrors; exports.propertyExists = _chunkBSA6BJG2js.propertyExists; exports.readValueAsDate = _chunkBSA6BJG2js.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkBSA6BJG2js.removeLeadingTrailingSlashes; exports.schemaTools = _chunkBSA6BJG2js.schemaTools;
@@ -2,15 +2,19 @@ import {
2
2
  api,
3
3
  flattenObjectKeys,
4
4
  getTimezone,
5
+ handleServerErrors,
5
6
  propertyExists,
6
7
  readValueAsDate,
7
- removeLeadingTrailingSlashes
8
- } from "../chunk-DMQDQUAE.mjs";
8
+ removeLeadingTrailingSlashes,
9
+ schemaTools
10
+ } from "../chunk-44LP4RZD.mjs";
9
11
  export {
10
12
  api,
11
13
  flattenObjectKeys,
12
14
  getTimezone,
15
+ handleServerErrors,
13
16
  propertyExists,
14
17
  readValueAsDate,
15
- removeLeadingTrailingSlashes
18
+ removeLeadingTrailingSlashes,
19
+ schemaTools
16
20
  };
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkNLI47OFIjs = require('../chunk-NLI47OFI.js');
3
+ var _chunkTP5OSIU5js = require('../chunk-TP5OSIU5.js');
4
4
  require('../chunk-6JZ35VQJ.js');
5
- require('../chunk-YAGXZLL6.js');
5
+ require('../chunk-BSA6BJG2.js');
6
6
 
7
7
 
8
- exports.Field = _chunkNLI47OFIjs.Field_default;
8
+ exports.Field = _chunkTP5OSIU5js.Field_default;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Field_default
3
- } from "../chunk-2VRWJP7M.mjs";
3
+ } from "../chunk-B3F2F3PI.mjs";
4
4
  import "../chunk-GFSTK7KN.mjs";
5
- import "../chunk-DMQDQUAE.mjs";
5
+ import "../chunk-44LP4RZD.mjs";
6
6
  export {
7
7
  Field_default as Field
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnwebsoft/ui",
3
- "version": "2.17.2",
3
+ "version": "2.17.4",
4
4
  "description": "A set of reusable wrappers for MUI v6",
5
5
  "author": "GNWebsoft Private Limited",
6
6
  "license": "",