listpage-next 0.0.248 → 0.0.249

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,5 +135,23 @@ function setupClient(HttpClient) {
135
135
  document.body.removeChild(link);
136
136
  window.URL.revokeObjectURL(url);
137
137
  };
138
+ HttpClient.prototype.upload = async function(url, data, config) {
139
+ const client = this.client;
140
+ const formData = new FormData();
141
+ if (data && 'object' == typeof data) Object.keys(data).forEach((key)=>{
142
+ const value = data[key];
143
+ if (Array.isArray(value)) value.forEach((item)=>{
144
+ formData.append(key, item);
145
+ });
146
+ else if (null != value) formData.append(key, value);
147
+ });
148
+ return client.post(url, formData, {
149
+ ...config,
150
+ headers: {
151
+ 'Content-Type': 'multipart/form-data',
152
+ ...config?.headers
153
+ }
154
+ });
155
+ };
138
156
  }
139
157
  export { setupClient };
@@ -20,4 +20,5 @@ export declare class HttpClient implements IHttpClient {
20
20
  filename?: string;
21
21
  type?: string;
22
22
  }, config?: AxiosRequestConfig<D>): Promise<void>;
23
+ upload<D = any, T = any>(url: string, params?: D, config?: AxiosRequestConfig<D>): Promise<T>;
23
24
  }
@@ -54,5 +54,8 @@ class HttpClient {
54
54
  download(url, params, downloadOptions, config) {
55
55
  throw new Error('Method should be implemented by setupClient');
56
56
  }
57
+ upload(url, params, config) {
58
+ throw new Error('Method should be implemented by setupClient');
59
+ }
57
60
  }
58
61
  export { HttpClient };
@@ -183,7 +183,7 @@ function FileManager({ title, storage }) {
183
183
  }));
184
184
  };
185
185
  return /*#__PURE__*/ jsxs("div", {
186
- className: "flex h-screen bg-slate-950 text-slate-200 font-sans",
186
+ className: "flex h-full bg-slate-950 text-slate-200 font-sans",
187
187
  children: [
188
188
  /*#__PURE__*/ jsx(Sidebar, {
189
189
  title: title,
@@ -161,7 +161,7 @@ const deleteFolder = async (folderPath)=>{
161
161
  const uploadObject = async (file, folderId)=>{
162
162
  const prefix = folderId || '';
163
163
  const cleanName = file.name.replace(/[^a-zA-Z0-9.-]/g, '_');
164
- const key = `${prefix}${Date.now()}-${cleanName}`;
164
+ const key = `${prefix}${cleanName}`;
165
165
  try {
166
166
  const cfg = getStorageConfig();
167
167
  const s3 = getS3Client();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.248",
3
+ "version": "0.0.249",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",