@gnwebsoft/ui 2.17.1 → 2.17.3

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.
@@ -0,0 +1,18 @@
1
+ type ValidationErrors = {
2
+ [field: string]: string | string[] | boolean | {
3
+ key: string;
4
+ message: string;
5
+ };
6
+ };
7
+
8
+ type ApiResponse<TModel> = {
9
+ type?: string;
10
+ title?: string;
11
+ status?: number;
12
+ traceId?: string;
13
+ errors?: ValidationErrors;
14
+ modelErrors?: boolean;
15
+ apiData?: TModel;
16
+ };
17
+
18
+ export type { ApiResponse as A, ValidationErrors as V };
@@ -0,0 +1,18 @@
1
+ type ValidationErrors = {
2
+ [field: string]: string | string[] | boolean | {
3
+ key: string;
4
+ message: string;
5
+ };
6
+ };
7
+
8
+ type ApiResponse<TModel> = {
9
+ type?: string;
10
+ title?: string;
11
+ status?: number;
12
+ traceId?: string;
13
+ errors?: ValidationErrors;
14
+ modelErrors?: boolean;
15
+ apiData?: TModel;
16
+ };
17
+
18
+ export type { ApiResponse as A, ValidationErrors as V };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GFSTK7KN.mjs";
4
4
  import {
5
5
  readValueAsDate
6
- } from "./chunk-D3X5GWIG.mjs";
6
+ } from "./chunk-DMQDQUAE.mjs";
7
7
 
8
8
  // src/wrappers/DatePickerElement/DatePickerElement.tsx
9
9
  import {
@@ -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, 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,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, 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;
@@ -0,0 +1,166 @@
1
+ // src/utils/api.ts
2
+ var makeRequest = async (url, options = {}) => {
3
+ const response = await fetch(url, options);
4
+ if (response.ok) {
5
+ const apiData = await response.json();
6
+ return {
7
+ apiData,
8
+ status: response.status
9
+ };
10
+ } else if (response.status === 404) {
11
+ const apiData = await response.json();
12
+ const data = {
13
+ status: response.status,
14
+ title: apiData.title
15
+ };
16
+ return data;
17
+ }
18
+ const apiResponse = await response.json();
19
+ return apiResponse;
20
+ };
21
+ var api = class {
22
+ static async post(url, body = {}) {
23
+ const alteredOptions = {
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
27
+ },
28
+ body: JSON.stringify(body),
29
+ method: "POST"
30
+ };
31
+ const apiResponse = await makeRequest(url, alteredOptions);
32
+ return apiResponse;
33
+ }
34
+ static async get(url) {
35
+ const alteredOptions = {
36
+ headers: {
37
+ "Content-Type": "application/json",
38
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
39
+ },
40
+ method: "GET"
41
+ };
42
+ const data = await makeRequest(url, alteredOptions);
43
+ return data;
44
+ }
45
+ static async delete(url) {
46
+ const alteredOptions = {
47
+ headers: {
48
+ "Content-Type": "application/json",
49
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
50
+ },
51
+ method: "DELETE"
52
+ };
53
+ const data = await makeRequest(url, alteredOptions);
54
+ return data;
55
+ }
56
+ static async put(url, body = {}) {
57
+ const alteredOptions = {
58
+ headers: {
59
+ "Content-Type": "application/json",
60
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
61
+ },
62
+ body: JSON.stringify(body),
63
+ method: "PUT"
64
+ };
65
+ const apiResponse = await makeRequest(url, alteredOptions);
66
+ return apiResponse;
67
+ }
68
+ static async fetch(url, options = {}) {
69
+ const alteredOptions = {
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
73
+ },
74
+ ...options
75
+ };
76
+ const result = await fetch(url, alteredOptions);
77
+ console.log("result", result);
78
+ return result;
79
+ }
80
+ static async tempFetch(url, options = {}) {
81
+ const alteredOptions = {
82
+ headers: {
83
+ "Content-Type": "application/json"
84
+ },
85
+ ...options
86
+ };
87
+ const apiResponse = await makeRequest(url, alteredOptions);
88
+ return apiResponse;
89
+ }
90
+ static async upload(url, formData) {
91
+ const alteredOptions = {
92
+ headers: {
93
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
94
+ },
95
+ body: formData,
96
+ method: "POST"
97
+ };
98
+ const apiResponse = await makeRequest(url, alteredOptions);
99
+ return apiResponse;
100
+ }
101
+ };
102
+
103
+ // src/utils/flattenObjectKeys.ts
104
+ var isNested = (obj) => typeof obj === "object" && obj !== null;
105
+ var isArray = (obj) => Array.isArray(obj);
106
+ var flattenObjectKeys = (obj, prefix = "") => {
107
+ if (!isNested(obj)) {
108
+ return {
109
+ [prefix]: obj
110
+ };
111
+ }
112
+ return Object.keys(obj).reduce((acc, key) => {
113
+ const currentPrefix = prefix.length ? `${prefix}.` : "";
114
+ if (isNested(obj[key]) && Object.keys(obj[key]).length) {
115
+ if (isArray(obj[key]) && obj[key].length) {
116
+ obj[key].forEach((item, index) => {
117
+ Object.assign(
118
+ acc,
119
+ flattenObjectKeys(item, `${currentPrefix + key}.${index}`)
120
+ );
121
+ });
122
+ } else {
123
+ Object.assign(acc, flattenObjectKeys(obj[key], currentPrefix + key));
124
+ }
125
+ acc[currentPrefix + key] = obj[key];
126
+ } else {
127
+ acc[currentPrefix + key] = obj[key];
128
+ }
129
+ return acc;
130
+ }, {});
131
+ };
132
+
133
+ // src/utils/getTimezone.ts
134
+ function getTimezone(adapter, value) {
135
+ return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
136
+ }
137
+
138
+ // src/utils/propertyExists.ts
139
+ function propertyExists(obj, prop) {
140
+ return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
141
+ }
142
+
143
+ // src/utils/readValueAsDate.ts
144
+ function readValueAsDate(adapter, value) {
145
+ if (typeof value === "string") {
146
+ if (value === "") {
147
+ return null;
148
+ }
149
+ return adapter.utils.date(value);
150
+ }
151
+ return value;
152
+ }
153
+
154
+ // src/utils/removeLeadingTrailingSlashes.ts
155
+ var removeLeadingTrailingSlashes = (route) => {
156
+ return route.replace(/^\/|\/$/g, "");
157
+ };
158
+
159
+ export {
160
+ api,
161
+ flattenObjectKeys,
162
+ getTimezone,
163
+ propertyExists,
164
+ readValueAsDate,
165
+ removeLeadingTrailingSlashes
166
+ };
@@ -3,7 +3,7 @@
3
3
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
4
4
 
5
5
 
6
- var _chunkDFFDICTBjs = require('./chunk-DFFDICTB.js');
6
+ var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.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) => _chunkDFFDICTBjs.readValueAsDate.call(void 0, adapter, newValue),
48
+ input: typeof _optionalChain([transform, 'optionalAccess', _3 => _3.input]) === "function" ? transform.input : (newValue) => _chunkYAGXZLL6js.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) => _chunkDFFDICTBjs.readValueAsDate.call(void 0, adapter, newValue),
479
+ input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (newValue) => _chunkYAGXZLL6js.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
  });
@@ -0,0 +1,166 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/api.ts
2
+ var makeRequest = async (url, options = {}) => {
3
+ const response = await fetch(url, options);
4
+ if (response.ok) {
5
+ const apiData = await response.json();
6
+ return {
7
+ apiData,
8
+ status: response.status
9
+ };
10
+ } else if (response.status === 404) {
11
+ const apiData = await response.json();
12
+ const data = {
13
+ status: response.status,
14
+ title: apiData.title
15
+ };
16
+ return data;
17
+ }
18
+ const apiResponse = await response.json();
19
+ return apiResponse;
20
+ };
21
+ var api = class {
22
+ static async post(url, body = {}) {
23
+ const alteredOptions = {
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
27
+ },
28
+ body: JSON.stringify(body),
29
+ method: "POST"
30
+ };
31
+ const apiResponse = await makeRequest(url, alteredOptions);
32
+ return apiResponse;
33
+ }
34
+ static async get(url) {
35
+ const alteredOptions = {
36
+ headers: {
37
+ "Content-Type": "application/json",
38
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
39
+ },
40
+ method: "GET"
41
+ };
42
+ const data = await makeRequest(url, alteredOptions);
43
+ return data;
44
+ }
45
+ static async delete(url) {
46
+ const alteredOptions = {
47
+ headers: {
48
+ "Content-Type": "application/json",
49
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
50
+ },
51
+ method: "DELETE"
52
+ };
53
+ const data = await makeRequest(url, alteredOptions);
54
+ return data;
55
+ }
56
+ static async put(url, body = {}) {
57
+ const alteredOptions = {
58
+ headers: {
59
+ "Content-Type": "application/json",
60
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
61
+ },
62
+ body: JSON.stringify(body),
63
+ method: "PUT"
64
+ };
65
+ const apiResponse = await makeRequest(url, alteredOptions);
66
+ return apiResponse;
67
+ }
68
+ static async fetch(url, options = {}) {
69
+ const alteredOptions = {
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
73
+ },
74
+ ...options
75
+ };
76
+ const result = await fetch(url, alteredOptions);
77
+ console.log("result", result);
78
+ return result;
79
+ }
80
+ static async tempFetch(url, options = {}) {
81
+ const alteredOptions = {
82
+ headers: {
83
+ "Content-Type": "application/json"
84
+ },
85
+ ...options
86
+ };
87
+ const apiResponse = await makeRequest(url, alteredOptions);
88
+ return apiResponse;
89
+ }
90
+ static async upload(url, formData) {
91
+ const alteredOptions = {
92
+ headers: {
93
+ Authorization: `Bearer ${localStorage.getItem("serviceToken")}`
94
+ },
95
+ body: formData,
96
+ method: "POST"
97
+ };
98
+ const apiResponse = await makeRequest(url, alteredOptions);
99
+ return apiResponse;
100
+ }
101
+ };
102
+
103
+ // src/utils/flattenObjectKeys.ts
104
+ var isNested = (obj) => typeof obj === "object" && obj !== null;
105
+ var isArray = (obj) => Array.isArray(obj);
106
+ var flattenObjectKeys = (obj, prefix = "") => {
107
+ if (!isNested(obj)) {
108
+ return {
109
+ [prefix]: obj
110
+ };
111
+ }
112
+ return Object.keys(obj).reduce((acc, key) => {
113
+ const currentPrefix = prefix.length ? `${prefix}.` : "";
114
+ if (isNested(obj[key]) && Object.keys(obj[key]).length) {
115
+ if (isArray(obj[key]) && obj[key].length) {
116
+ obj[key].forEach((item, index) => {
117
+ Object.assign(
118
+ acc,
119
+ flattenObjectKeys(item, `${currentPrefix + key}.${index}`)
120
+ );
121
+ });
122
+ } else {
123
+ Object.assign(acc, flattenObjectKeys(obj[key], currentPrefix + key));
124
+ }
125
+ acc[currentPrefix + key] = obj[key];
126
+ } else {
127
+ acc[currentPrefix + key] = obj[key];
128
+ }
129
+ return acc;
130
+ }, {});
131
+ };
132
+
133
+ // src/utils/getTimezone.ts
134
+ function getTimezone(adapter, value) {
135
+ return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
136
+ }
137
+
138
+ // src/utils/propertyExists.ts
139
+ function propertyExists(obj, prop) {
140
+ return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
141
+ }
142
+
143
+ // src/utils/readValueAsDate.ts
144
+ function readValueAsDate(adapter, value) {
145
+ if (typeof value === "string") {
146
+ if (value === "") {
147
+ return null;
148
+ }
149
+ return adapter.utils.date(value);
150
+ }
151
+ return value;
152
+ }
153
+
154
+ // src/utils/removeLeadingTrailingSlashes.ts
155
+ var removeLeadingTrailingSlashes = (route) => {
156
+ return route.replace(/^\/|\/$/g, "");
157
+ };
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+ exports.api = api; exports.flattenObjectKeys = flattenObjectKeys; exports.getTimezone = getTimezone; exports.propertyExists = propertyExists; exports.readValueAsDate = readValueAsDate; exports.removeLeadingTrailingSlashes = removeLeadingTrailingSlashes;
@@ -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 _chunkDK74BFWAjs = require('../chunk-DK74BFWA.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 = _chunkDK74BFWAjs.ClearButton_default; exports.FilterButton = _chunkDK74BFWAjs.FilterButton_default; exports.FormWrapper = _chunkDK74BFWAjs.FormWrapper_default; exports.LabelText = _chunkDK74BFWAjs.LabelText_default; exports.ListWrapper = _chunkDK74BFWAjs.ListWrapper_default; exports.SimpleToolbar = _chunkDK74BFWAjs.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-BWAFZ6F6.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,8 +1,9 @@
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 { ApiResponse, AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors } from './types/index.mjs';
3
+ export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.mjs';
4
4
  export { A as AsyncSelectPayload } from './AsyncSelectPayload-DHN-R3gc.mjs';
5
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.mjs';
5
+ export { AsyncMultiSelectPayload, OptionItem, OptionItem2 } from './types/index.mjs';
6
+ export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.mjs';
6
7
  export { Field } from './wrappers/index.mjs';
7
8
  import 'react/jsx-runtime';
8
9
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
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 { ApiResponse, AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors } from './types/index.js';
3
+ export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.js';
4
4
  export { A as AsyncSelectPayload } from './AsyncSelectPayload-DHN-R3gc.js';
5
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.js';
5
+ export { AsyncMultiSelectPayload, OptionItem, OptionItem2 } from './types/index.js';
6
+ export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.js';
6
7
  export { Field } from './wrappers/index.js';
7
8
  import 'react/jsx-runtime';
8
9
  import 'react';
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 _chunkDK74BFWAjs = require('./chunk-DK74BFWA.js');
8
9
  require('./chunk-7M2VOCYN.js');
9
10
  require('./chunk-TLJXC46A.js');
10
11
 
11
12
 
12
- var _chunkXMOYASC5js = require('./chunk-XMOYASC5.js');
13
+ var _chunkNLI47OFIjs = require('./chunk-NLI47OFI.js');
13
14
 
14
15
 
15
16
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
@@ -19,7 +20,10 @@ var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
19
20
 
20
21
 
21
22
 
22
- var _chunkDFFDICTBjs = require('./chunk-DFFDICTB.js');
23
+
24
+ var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.js');
25
+
26
+
23
27
 
24
28
 
25
29
 
@@ -33,4 +37,4 @@ var _chunkDFFDICTBjs = require('./chunk-DFFDICTB.js');
33
37
 
34
38
 
35
39
 
36
- exports.Field = _chunkXMOYASC5js.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.flattenObjectKeys = _chunkDFFDICTBjs.flattenObjectKeys; exports.getTimezone = _chunkDFFDICTBjs.getTimezone; exports.propertyExists = _chunkDFFDICTBjs.propertyExists; exports.readValueAsDate = _chunkDFFDICTBjs.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkDFFDICTBjs.removeLeadingTrailingSlashes; exports.useTransform = _chunk6JZ35VQJjs.useTransform;
40
+ exports.ClearButton = _chunkDK74BFWAjs.ClearButton_default; exports.Field = _chunkNLI47OFIjs.Field_default; exports.FilterButton = _chunkDK74BFWAjs.FilterButton_default; exports.FormWrapper = _chunkDK74BFWAjs.FormWrapper_default; exports.LabelText = _chunkDK74BFWAjs.LabelText_default; exports.ListWrapper = _chunkDK74BFWAjs.ListWrapper_default; exports.SimpleToolbar = _chunkDK74BFWAjs.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;
package/dist/index.mjs CHANGED
@@ -1,32 +1,36 @@
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-BWAFZ6F6.mjs";
8
9
  import "./chunk-2JFL7TS5.mjs";
9
10
  import "./chunk-5VR5QVUV.mjs";
10
11
  import {
11
12
  Field_default
12
- } from "./chunk-JCZNO267.mjs";
13
+ } from "./chunk-2VRWJP7M.mjs";
13
14
  import {
14
15
  useTransform
15
16
  } from "./chunk-GFSTK7KN.mjs";
16
17
  import {
18
+ api,
17
19
  flattenObjectKeys,
18
20
  getTimezone,
19
21
  propertyExists,
20
22
  readValueAsDate,
21
23
  removeLeadingTrailingSlashes
22
- } from "./chunk-D3X5GWIG.mjs";
24
+ } from "./chunk-DMQDQUAE.mjs";
23
25
  export {
26
+ ClearButton_default as ClearButton,
24
27
  Field_default as Field,
25
28
  FilterButton_default as FilterButton,
26
29
  FormWrapper_default as FormWrapper,
27
30
  LabelText_default as LabelText,
28
31
  ListWrapper_default as ListWrapper,
29
32
  SimpleToolbar_default as SimpleToolbar,
33
+ api,
30
34
  flattenObjectKeys,
31
35
  getTimezone,
32
36
  propertyExists,
@@ -1,22 +1,6 @@
1
+ export { A as ApiResponse, V as ValidationErrors } from '../ApiResponse-DWjEML13.mjs';
1
2
  export { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.mjs';
2
3
 
3
- type ValidationErrors = {
4
- [field: string]: string | string[] | boolean | {
5
- key: string;
6
- message: string;
7
- };
8
- };
9
-
10
- type ApiResponse<TModel> = {
11
- type?: string;
12
- title?: string;
13
- status?: number;
14
- traceId?: string;
15
- errors?: ValidationErrors;
16
- modelErrors?: boolean;
17
- apiData?: TModel;
18
- };
19
-
20
4
  type OptionItem = {
21
5
  label: string;
22
6
  value: string;
@@ -30,4 +14,4 @@ type OptionItem2 = {
30
14
  value: number;
31
15
  };
32
16
 
33
- export type { ApiResponse, AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors };
17
+ export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
@@ -1,22 +1,6 @@
1
+ export { A as ApiResponse, V as ValidationErrors } from '../ApiResponse-DWjEML13.js';
1
2
  export { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.js';
2
3
 
3
- type ValidationErrors = {
4
- [field: string]: string | string[] | boolean | {
5
- key: string;
6
- message: string;
7
- };
8
- };
9
-
10
- type ApiResponse<TModel> = {
11
- type?: string;
12
- title?: string;
13
- status?: number;
14
- traceId?: string;
15
- errors?: ValidationErrors;
16
- modelErrors?: boolean;
17
- apiData?: TModel;
18
- };
19
-
20
4
  type OptionItem = {
21
5
  label: string;
22
6
  value: string;
@@ -30,4 +14,4 @@ type OptionItem2 = {
30
14
  value: number;
31
15
  };
32
16
 
33
- export type { ApiResponse, AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors };
17
+ export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
@@ -1,6 +1,17 @@
1
+ import { A as ApiResponse } from '../ApiResponse-DWjEML13.mjs';
1
2
  import { PickerValidDate } from '@mui/x-date-pickers';
2
3
  import { useLocalizationContext } from '@mui/x-date-pickers/internals';
3
4
 
5
+ declare class api {
6
+ static post<T>(url: string, body?: any): Promise<ApiResponse<T>>;
7
+ static get<T>(url: string): Promise<ApiResponse<T>>;
8
+ static delete<T>(url: string): Promise<ApiResponse<T>>;
9
+ static put<T>(url: string, body?: any): Promise<ApiResponse<T>>;
10
+ static fetch(url: string, options?: any): Promise<Response>;
11
+ static tempFetch<T>(url: string, options?: any): Promise<ApiResponse<T>>;
12
+ static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
13
+ }
14
+
4
15
  declare const flattenObjectKeys: (obj: any, prefix?: string) => {
5
16
  [x: string]: any;
6
17
  };
@@ -13,4 +24,4 @@ declare function readValueAsDate<TDate extends PickerValidDate>(adapter: ReturnT
13
24
 
14
25
  declare const removeLeadingTrailingSlashes: (route: string) => string;
15
26
 
16
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
27
+ export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
@@ -1,6 +1,17 @@
1
+ import { A as ApiResponse } from '../ApiResponse-DWjEML13.js';
1
2
  import { PickerValidDate } from '@mui/x-date-pickers';
2
3
  import { useLocalizationContext } from '@mui/x-date-pickers/internals';
3
4
 
5
+ declare class api {
6
+ static post<T>(url: string, body?: any): Promise<ApiResponse<T>>;
7
+ static get<T>(url: string): Promise<ApiResponse<T>>;
8
+ static delete<T>(url: string): Promise<ApiResponse<T>>;
9
+ static put<T>(url: string, body?: any): Promise<ApiResponse<T>>;
10
+ static fetch(url: string, options?: any): Promise<Response>;
11
+ static tempFetch<T>(url: string, options?: any): Promise<ApiResponse<T>>;
12
+ static upload<T>(url: string, formData: FormData): Promise<ApiResponse<T>>;
13
+ }
14
+
4
15
  declare const flattenObjectKeys: (obj: any, prefix?: string) => {
5
16
  [x: string]: any;
6
17
  };
@@ -13,4 +24,4 @@ declare function readValueAsDate<TDate extends PickerValidDate>(adapter: ReturnT
13
24
 
14
25
  declare const removeLeadingTrailingSlashes: (route: string) => string;
15
26
 
16
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
27
+ export { api, flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes };
@@ -4,11 +4,13 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkDFFDICTBjs = require('../chunk-DFFDICTB.js');
8
7
 
8
+ var _chunkYAGXZLL6js = require('../chunk-YAGXZLL6.js');
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
- exports.flattenObjectKeys = _chunkDFFDICTBjs.flattenObjectKeys; exports.getTimezone = _chunkDFFDICTBjs.getTimezone; exports.propertyExists = _chunkDFFDICTBjs.propertyExists; exports.readValueAsDate = _chunkDFFDICTBjs.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkDFFDICTBjs.removeLeadingTrailingSlashes;
14
+
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;
@@ -1,11 +1,13 @@
1
1
  import {
2
+ api,
2
3
  flattenObjectKeys,
3
4
  getTimezone,
4
5
  propertyExists,
5
6
  readValueAsDate,
6
7
  removeLeadingTrailingSlashes
7
- } from "../chunk-D3X5GWIG.mjs";
8
+ } from "../chunk-DMQDQUAE.mjs";
8
9
  export {
10
+ api,
9
11
  flattenObjectKeys,
10
12
  getTimezone,
11
13
  propertyExists,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXMOYASC5js = require('../chunk-XMOYASC5.js');
3
+ var _chunkNLI47OFIjs = require('../chunk-NLI47OFI.js');
4
4
  require('../chunk-6JZ35VQJ.js');
5
- require('../chunk-DFFDICTB.js');
5
+ require('../chunk-YAGXZLL6.js');
6
6
 
7
7
 
8
- exports.Field = _chunkXMOYASC5js.Field_default;
8
+ exports.Field = _chunkNLI47OFIjs.Field_default;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Field_default
3
- } from "../chunk-JCZNO267.mjs";
3
+ } from "../chunk-2VRWJP7M.mjs";
4
4
  import "../chunk-GFSTK7KN.mjs";
5
- import "../chunk-D3X5GWIG.mjs";
5
+ import "../chunk-DMQDQUAE.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.1",
3
+ "version": "2.17.3",
4
4
  "description": "A set of reusable wrappers for MUI v6",
5
5
  "author": "GNWebsoft Private Limited",
6
6
  "license": "",
@@ -1,63 +0,0 @@
1
- // src/utils/flattenObjectKeys.ts
2
- var isNested = (obj) => typeof obj === "object" && obj !== null;
3
- var isArray = (obj) => Array.isArray(obj);
4
- var flattenObjectKeys = (obj, prefix = "") => {
5
- if (!isNested(obj)) {
6
- return {
7
- [prefix]: obj
8
- };
9
- }
10
- return Object.keys(obj).reduce((acc, key) => {
11
- const currentPrefix = prefix.length ? `${prefix}.` : "";
12
- if (isNested(obj[key]) && Object.keys(obj[key]).length) {
13
- if (isArray(obj[key]) && obj[key].length) {
14
- obj[key].forEach((item, index) => {
15
- Object.assign(
16
- acc,
17
- flattenObjectKeys(item, `${currentPrefix + key}.${index}`)
18
- );
19
- });
20
- } else {
21
- Object.assign(acc, flattenObjectKeys(obj[key], currentPrefix + key));
22
- }
23
- acc[currentPrefix + key] = obj[key];
24
- } else {
25
- acc[currentPrefix + key] = obj[key];
26
- }
27
- return acc;
28
- }, {});
29
- };
30
-
31
- // src/utils/getTimezone.ts
32
- function getTimezone(adapter, value) {
33
- return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
34
- }
35
-
36
- // src/utils/propertyExists.ts
37
- function propertyExists(obj, prop) {
38
- return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
39
- }
40
-
41
- // src/utils/readValueAsDate.ts
42
- function readValueAsDate(adapter, value) {
43
- if (typeof value === "string") {
44
- if (value === "") {
45
- return null;
46
- }
47
- return adapter.utils.date(value);
48
- }
49
- return value;
50
- }
51
-
52
- // src/utils/removeLeadingTrailingSlashes.ts
53
- var removeLeadingTrailingSlashes = (route) => {
54
- return route.replace(/^\/|\/$/g, "");
55
- };
56
-
57
- export {
58
- flattenObjectKeys,
59
- getTimezone,
60
- propertyExists,
61
- readValueAsDate,
62
- removeLeadingTrailingSlashes
63
- };
@@ -1,63 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/flattenObjectKeys.ts
2
- var isNested = (obj) => typeof obj === "object" && obj !== null;
3
- var isArray = (obj) => Array.isArray(obj);
4
- var flattenObjectKeys = (obj, prefix = "") => {
5
- if (!isNested(obj)) {
6
- return {
7
- [prefix]: obj
8
- };
9
- }
10
- return Object.keys(obj).reduce((acc, key) => {
11
- const currentPrefix = prefix.length ? `${prefix}.` : "";
12
- if (isNested(obj[key]) && Object.keys(obj[key]).length) {
13
- if (isArray(obj[key]) && obj[key].length) {
14
- obj[key].forEach((item, index) => {
15
- Object.assign(
16
- acc,
17
- flattenObjectKeys(item, `${currentPrefix + key}.${index}`)
18
- );
19
- });
20
- } else {
21
- Object.assign(acc, flattenObjectKeys(obj[key], currentPrefix + key));
22
- }
23
- acc[currentPrefix + key] = obj[key];
24
- } else {
25
- acc[currentPrefix + key] = obj[key];
26
- }
27
- return acc;
28
- }, {});
29
- };
30
-
31
- // src/utils/getTimezone.ts
32
- function getTimezone(adapter, value) {
33
- return value == null || !adapter.utils.isValid(value) ? null : adapter.utils.getTimezone(value);
34
- }
35
-
36
- // src/utils/propertyExists.ts
37
- function propertyExists(obj, prop) {
38
- return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, prop);
39
- }
40
-
41
- // src/utils/readValueAsDate.ts
42
- function readValueAsDate(adapter, value) {
43
- if (typeof value === "string") {
44
- if (value === "") {
45
- return null;
46
- }
47
- return adapter.utils.date(value);
48
- }
49
- return value;
50
- }
51
-
52
- // src/utils/removeLeadingTrailingSlashes.ts
53
- var removeLeadingTrailingSlashes = (route) => {
54
- return route.replace(/^\/|\/$/g, "");
55
- };
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- exports.flattenObjectKeys = flattenObjectKeys; exports.getTimezone = getTimezone; exports.propertyExists = propertyExists; exports.readValueAsDate = readValueAsDate; exports.removeLeadingTrailingSlashes = removeLeadingTrailingSlashes;