@gnwebsoft/ui 2.17.0 → 2.17.2

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 };
@@ -0,0 +1,6 @@
1
+ type AsyncSelectPayload = {
2
+ query: string | null;
3
+ initialValue?: number | null;
4
+ };
5
+
6
+ export type { AsyncSelectPayload as A };
@@ -0,0 +1,6 @@
1
+ type AsyncSelectPayload = {
2
+ query: string | null;
3
+ initialValue?: number | null;
4
+ };
5
+
6
+ export type { AsyncSelectPayload as A };
@@ -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 {
@@ -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;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.mjs';
2
2
  export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.mjs';
3
- export { AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors } from './types/index.mjs';
4
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.mjs';
3
+ export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.mjs';
4
+ 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';
5
7
  export { Field } from './wrappers/index.mjs';
6
8
  import 'react/jsx-runtime';
7
9
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { FilterButton, FormWrapper, LabelText, ListWrapper, SimpleToolbar } from './components/index.js';
2
2
  export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.js';
3
- export { AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors } from './types/index.js';
4
- export { flattenObjectKeys, getTimezone, propertyExists, readValueAsDate, removeLeadingTrailingSlashes } from './utils/index.js';
3
+ export { A as ApiResponse, V as ValidationErrors } from './ApiResponse-DWjEML13.js';
4
+ 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';
5
7
  export { Field } from './wrappers/index.js';
6
8
  import 'react/jsx-runtime';
7
9
  import 'react';
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
  var _chunkPCTIEZLNjs = require('./chunk-PCTIEZLN.js');
8
8
  require('./chunk-7M2VOCYN.js');
9
- require('./chunk-SK6Y2YH6.js');
9
+ require('./chunk-TLJXC46A.js');
10
10
 
11
11
 
12
- var _chunkXMOYASC5js = require('./chunk-XMOYASC5.js');
12
+ var _chunkNLI47OFIjs = require('./chunk-NLI47OFI.js');
13
13
 
14
14
 
15
15
  var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
@@ -19,8 +19,8 @@ var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
19
19
 
20
20
 
21
21
 
22
- var _chunkDFFDICTBjs = require('./chunk-DFFDICTB.js');
23
22
 
23
+ var _chunkYAGXZLL6js = require('./chunk-YAGXZLL6.js');
24
24
 
25
25
 
26
26
 
@@ -33,4 +33,6 @@ var _chunkDFFDICTBjs = require('./chunk-DFFDICTB.js');
33
33
 
34
34
 
35
35
 
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;
36
+
37
+
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;
package/dist/index.mjs CHANGED
@@ -6,20 +6,21 @@ import {
6
6
  SimpleToolbar_default
7
7
  } from "./chunk-2LTU3GNL.mjs";
8
8
  import "./chunk-2JFL7TS5.mjs";
9
- import "./chunk-IJXNDCK2.mjs";
9
+ import "./chunk-5VR5QVUV.mjs";
10
10
  import {
11
11
  Field_default
12
- } from "./chunk-JCZNO267.mjs";
12
+ } from "./chunk-2VRWJP7M.mjs";
13
13
  import {
14
14
  useTransform
15
15
  } from "./chunk-GFSTK7KN.mjs";
16
16
  import {
17
+ api,
17
18
  flattenObjectKeys,
18
19
  getTimezone,
19
20
  propertyExists,
20
21
  readValueAsDate,
21
22
  removeLeadingTrailingSlashes
22
- } from "./chunk-D3X5GWIG.mjs";
23
+ } from "./chunk-DMQDQUAE.mjs";
23
24
  export {
24
25
  Field_default as Field,
25
26
  FilterButton_default as FilterButton,
@@ -27,6 +28,7 @@ export {
27
28
  LabelText_default as LabelText,
28
29
  ListWrapper_default as ListWrapper,
29
30
  SimpleToolbar_default as SimpleToolbar,
31
+ api,
30
32
  flattenObjectKeys,
31
33
  getTimezone,
32
34
  propertyExists,
@@ -1,3 +1,6 @@
1
+ export { A as ApiResponse, V as ValidationErrors } from '../ApiResponse-DWjEML13.mjs';
2
+ export { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.mjs';
3
+
1
4
  type OptionItem = {
2
5
  label: string;
3
6
  value: string;
@@ -11,11 +14,4 @@ type OptionItem2 = {
11
14
  value: number;
12
15
  };
13
16
 
14
- type ValidationErrors = {
15
- [field: string]: string | string[] | boolean | {
16
- key: string;
17
- message: string;
18
- };
19
- };
20
-
21
- export type { AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors };
17
+ export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
@@ -1,3 +1,6 @@
1
+ export { A as ApiResponse, V as ValidationErrors } from '../ApiResponse-DWjEML13.js';
2
+ export { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.js';
3
+
1
4
  type OptionItem = {
2
5
  label: string;
3
6
  value: string;
@@ -11,11 +14,4 @@ type OptionItem2 = {
11
14
  value: number;
12
15
  };
13
16
 
14
- type ValidationErrors = {
15
- [field: string]: string | string[] | boolean | {
16
- key: string;
17
- message: string;
18
- };
19
- };
20
-
21
- export type { AsyncMultiSelectPayload, OptionItem, OptionItem2, ValidationErrors };
17
+ export type { AsyncMultiSelectPayload, OptionItem, OptionItem2 };
@@ -1 +1 @@
1
- "use strict";require('../chunk-SK6Y2YH6.js');
1
+ "use strict";require('../chunk-TLJXC46A.js');
@@ -1 +1 @@
1
- import "../chunk-IJXNDCK2.mjs";
1
+ import "../chunk-5VR5QVUV.mjs";
@@ -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,3 +1,4 @@
1
+ import { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.mjs';
1
2
  import { ChipTypeMap, AutocompleteProps, Grid2Props, TextFieldProps, IconButtonProps, FormControlLabelProps, FormLabelProps, RadioProps, CheckboxProps, TextField } from '@mui/material';
2
3
  import * as react_hook_form from 'react-hook-form';
3
4
  import { FieldValues, FieldPath, Control, UseControllerProps, FieldError, PathValue } from 'react-hook-form';
@@ -22,10 +23,6 @@ type AsyncSelectElementProps<TFieldValues extends FieldValues = FieldValues, TNa
22
23
  initialValue?: number | null;
23
24
  queryFn: (data: AsyncSelectPayload) => Promise<TValue[] | undefined>;
24
25
  };
25
- type AsyncSelectPayload = {
26
- query: string | null;
27
- initialValue?: number | null;
28
- };
29
26
 
30
27
  type SelectCascadeElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue extends {
31
28
  value: number | boolean;
@@ -1,3 +1,4 @@
1
+ import { A as AsyncSelectPayload } from '../AsyncSelectPayload-DHN-R3gc.js';
1
2
  import { ChipTypeMap, AutocompleteProps, Grid2Props, TextFieldProps, IconButtonProps, FormControlLabelProps, FormLabelProps, RadioProps, CheckboxProps, TextField } from '@mui/material';
2
3
  import * as react_hook_form from 'react-hook-form';
3
4
  import { FieldValues, FieldPath, Control, UseControllerProps, FieldError, PathValue } from 'react-hook-form';
@@ -22,10 +23,6 @@ type AsyncSelectElementProps<TFieldValues extends FieldValues = FieldValues, TNa
22
23
  initialValue?: number | null;
23
24
  queryFn: (data: AsyncSelectPayload) => Promise<TValue[] | undefined>;
24
25
  };
25
- type AsyncSelectPayload = {
26
- query: string | null;
27
- initialValue?: number | null;
28
- };
29
26
 
30
27
  type SelectCascadeElementProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue extends {
31
28
  value: number | boolean;
@@ -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.0",
3
+ "version": "2.17.2",
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;
File without changes
File without changes