xladmin-import-export 0.1.1 → 0.2.0

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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="https://img.shields.io/badge/English-blue?style=for-the-badge" alt="English">
4
4
  </a>
5
5
  <a href="./docs/README.ru.md">
6
- <img src="https://img.shields.io/badge/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-red?style=for-the-badge" alt="Русский">
6
+ <img src="https://img.shields.io/badge/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-red?style=for-the-badge" alt="Russian">
7
7
  </a>
8
8
  </div>
9
9
 
@@ -21,7 +21,7 @@ Optional frontend extension for `xladmin` that adds import/export actions to mod
21
21
  ## Install
22
22
 
23
23
  ```bash
24
- npm i xladmin xladmin-import-export
24
+ npm install xladmin xladmin-import-export
25
25
  ```
26
26
 
27
27
  ## Minimal Example
@@ -30,10 +30,10 @@ npm i xladmin xladmin-import-export
30
30
  import {ModelPage} from 'xladmin';
31
31
  import {
32
32
  ModelImportExportActions,
33
- createAxiosXLAdminImportExportClient,
33
+ createAxiosAdminImportExportClient,
34
34
  } from 'xladmin-import-export';
35
35
 
36
- const importExportClient = createAxiosXLAdminImportExportClient(api);
36
+ const importExportClient = createAxiosAdminImportExportClient(api);
37
37
 
38
38
  <ModelPage
39
39
  client={client}
@@ -53,3 +53,8 @@ npm run test --workspace ./packages/xladmin-import-export
53
53
  npm run check --workspace ./packages/xladmin-import-export
54
54
  npm run build --workspace ./packages/xladmin-import-export
55
55
  ```
56
+
57
+ ## Docs
58
+
59
+ - [npm package](https://www.npmjs.com/package/xladmin-import-export)
60
+ - [Monorepo README](../../../README.md)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { XLAdminRequestOptions, ModelPageToolbarContext } from 'xladmin';
1
+ import { AdminRequestOptions, ModelPageToolbarContext } from 'xladmin';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  type ImportExportFieldMeta = {
@@ -71,7 +71,7 @@ type DownloadExportResponse = {
71
71
  blob: Blob;
72
72
  filename: string;
73
73
  };
74
- type XLAdminImportExportAxiosLike = {
74
+ type AdminImportExportAxiosLike = {
75
75
  get: <T>(url: string, config?: {
76
76
  signal?: AbortSignal;
77
77
  }) => Promise<{
@@ -86,25 +86,25 @@ type XLAdminImportExportAxiosLike = {
86
86
  headers?: Record<string, string>;
87
87
  } | T>;
88
88
  };
89
- type XLAdminImportExportClient = {
90
- getMeta: (slug: string, options?: XLAdminRequestOptions) => Promise<ImportExportMetaResponse>;
91
- downloadExport: (slug: string, payload: ExportRequestPayload, options?: XLAdminRequestOptions) => Promise<DownloadExportResponse>;
92
- validateImport: (slug: string, payload: ImportRequestPayload, options?: XLAdminRequestOptions) => Promise<ImportValidationResponse>;
93
- commitImport: (slug: string, payload: ImportRequestPayload, options?: XLAdminRequestOptions) => Promise<ImportCommitResponse>;
89
+ type AdminImportExportClient = {
90
+ getMeta: (slug: string, options?: AdminRequestOptions) => Promise<ImportExportMetaResponse>;
91
+ downloadExport: (slug: string, payload: ExportRequestPayload, options?: AdminRequestOptions) => Promise<DownloadExportResponse>;
92
+ validateImport: (slug: string, payload: ImportRequestPayload, options?: AdminRequestOptions) => Promise<ImportValidationResponse>;
93
+ commitImport: (slug: string, payload: ImportRequestPayload, options?: AdminRequestOptions) => Promise<ImportCommitResponse>;
94
94
  };
95
- type XLAdminImportExportFetchClientConfig = {
95
+ type AdminImportExportFetchClientConfig = {
96
96
  baseUrl: string;
97
97
  fetch?: typeof globalThis.fetch;
98
98
  headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
99
99
  credentials?: RequestCredentials;
100
100
  };
101
- declare function createAxiosXLAdminImportExportClient(api: XLAdminImportExportAxiosLike): XLAdminImportExportClient;
102
- declare function createFetchXLAdminImportExportClient(config: XLAdminImportExportFetchClientConfig): XLAdminImportExportClient;
101
+ declare function createAxiosAdminImportExportClient(api: AdminImportExportAxiosLike): AdminImportExportClient;
102
+ declare function createFetchAdminImportExportClient(config: AdminImportExportFetchClientConfig): AdminImportExportClient;
103
103
 
104
104
  type ModelImportExportActionsProps = {
105
- client: XLAdminImportExportClient;
105
+ client: AdminImportExportClient;
106
106
  context: ModelPageToolbarContext;
107
107
  };
108
108
  declare function ModelImportExportActions({ client, context }: ModelImportExportActionsProps): react_jsx_runtime.JSX.Element | null;
109
109
 
110
- export { type DownloadExportResponse, type ExportRequestPayload, type ImportCommitResponse, type ImportConflictMode, type ImportExportFieldMeta, type ImportExportFormat, type ImportExportMetaResponse, type ImportExportSelectionScope, type ImportRequestPayload, type ImportValidationResponse, ModelImportExportActions, type XLAdminImportExportAxiosLike, type XLAdminImportExportClient, type XLAdminImportExportFetchClientConfig, createAxiosXLAdminImportExportClient, createFetchXLAdminImportExportClient };
110
+ export { type AdminImportExportAxiosLike, type AdminImportExportClient, type AdminImportExportFetchClientConfig, type DownloadExportResponse, type ExportRequestPayload, type ImportCommitResponse, type ImportConflictMode, type ImportExportFieldMeta, type ImportExportFormat, type ImportExportMetaResponse, type ImportExportSelectionScope, type ImportRequestPayload, type ImportValidationResponse, ModelImportExportActions, createAxiosAdminImportExportClient, createFetchAdminImportExportClient };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/client.ts
2
- function createAxiosXLAdminImportExportClient(api) {
2
+ function createAxiosAdminImportExportClient(api) {
3
3
  return {
4
4
  async getMeta(slug, options) {
5
5
  return unwrap(await api.get(`/xladmin/models/${slug}/import-export/meta/`, {
@@ -45,7 +45,7 @@ function createAxiosXLAdminImportExportClient(api) {
45
45
  }
46
46
  };
47
47
  }
48
- function createFetchXLAdminImportExportClient(config) {
48
+ function createFetchAdminImportExportClient(config) {
49
49
  var _a;
50
50
  const fetchImpl = (_a = config.fetch) != null ? _a : globalThis.fetch;
51
51
  if (!fetchImpl) {
@@ -267,7 +267,7 @@ function ModelImportExportActions({ client, context }) {
267
267
  }
268
268
  const exportCount = context.selectionCount > 0 ? context.selectionCount : context.total;
269
269
  return /* @__PURE__ */ jsxs(Fragment, { children: [
270
- /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
270
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, sx: { alignItems: "center" }, children: [
271
271
  /* @__PURE__ */ jsx(Tooltip, { title: messages.exportButton, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => setExportOpen(true), disabled: Boolean(error), children: /* @__PURE__ */ jsx(DownloadIcon, { fontSize: "small" }) }) }) }),
272
272
  /* @__PURE__ */ jsx(Tooltip, { title: messages.importButton, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => setImportOpen(true), disabled: Boolean(error), children: /* @__PURE__ */ jsx(UploadIcon, { fontSize: "small" }) }) }) })
273
273
  ] }),
@@ -413,7 +413,7 @@ function ModelImportExportActions({ client, context }) {
413
413
  noneLabel: messages.clearFields
414
414
  }
415
415
  ),
416
- /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
416
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, children: [
417
417
  /* @__PURE__ */ jsx(
418
418
  Button,
419
419
  {
@@ -486,7 +486,7 @@ function FieldsSelector({
486
486
  noneLabel
487
487
  }) {
488
488
  return /* @__PURE__ */ jsxs(Stack, { children: [
489
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
489
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", sx: { justifyContent: "space-between", alignItems: "center" }, children: [
490
490
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: title }),
491
491
  /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
492
492
  /* @__PURE__ */ jsx(Button, { size: "small", onClick: () => onChange(fields.map((field) => field.name)), children: allLabel }),
@@ -520,7 +520,7 @@ function FieldsSelector({
520
520
  }
521
521
  }
522
522
  ),
523
- label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.75, alignItems: "center", sx: { minHeight: 24 }, children: [
523
+ label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.75, sx: { minHeight: 24, alignItems: "center" }, children: [
524
524
  /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { lineHeight: 1.35 }, children: field.label }),
525
525
  field.label !== field.name ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", sx: { lineHeight: 1.2 }, children: field.name }) : null
526
526
  ] })
@@ -727,6 +727,6 @@ function getMessages(locale) {
727
727
  }
728
728
  export {
729
729
  ModelImportExportActions,
730
- createAxiosXLAdminImportExportClient,
731
- createFetchXLAdminImportExportClient
730
+ createAxiosAdminImportExportClient,
731
+ createFetchAdminImportExportClient
732
732
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xladmin-import-export",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Optional import/export extension for xladmin.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "peerDependencies": {
39
39
  "@emotion/react": ">=11.14.0 <12.0.0",
40
40
  "@emotion/styled": ">=11.14.0 <12.0.0",
41
- "@mui/icons-material": ">=7.0.0 <8.0.0",
42
- "@mui/material": ">=7.0.0 <8.0.0",
41
+ "@mui/icons-material": ">=9.0.0 <10.0.0",
42
+ "@mui/material": ">=9.0.0 <10.0.0",
43
43
  "axios": ">=1.0.0 <2.0.0",
44
44
  "react": ">=19.0.0 <20.0.0",
45
45
  "react-dom": ">=19.0.0 <20.0.0",