xladmin 0.2.7 → 0.2.8
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/dist/components/FieldEditor.d.ts +2 -2
- package/dist/components/layout/AdminDataContext.d.ts +1 -1
- package/dist/components/layout/Sidebar.d.ts +1 -1
- package/dist/components/model-page/ListFiltersBar.d.ts +2 -2
- package/dist/components/model-page/ListRow.d.ts +1 -1
- package/dist/components/model-page/useModelPageController.d.ts +8 -8
- package/dist/components/models-blocks/types.d.ts +1 -1
- package/dist/components/object-page/ObjectField.d.ts +2 -2
- package/dist/components/object-page/ReadonlyObjectField.d.ts +1 -1
- package/dist/components/object-page/useObjectPageController.d.ts +7 -7
- package/dist/index.js +37 -31
- package/dist/utils/adminFields.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { XLAdminClient } from '
|
|
2
|
-
import type { AdminFieldMeta } from '
|
|
1
|
+
import type { XLAdminClient } from '@xladmin-core/client';
|
|
2
|
+
import type { AdminFieldMeta } from '@xladmin-core/types';
|
|
3
3
|
type AdminFieldEditorProps = {
|
|
4
4
|
field: AdminFieldMeta;
|
|
5
5
|
value: unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { AdminLocale, AdminModelMeta, AdminModelsBlockMeta } from '
|
|
2
|
+
import type { AdminLocale, AdminModelMeta, AdminModelsBlockMeta } from '@xladmin-core/types';
|
|
3
3
|
type AdminDataContextValue = {
|
|
4
4
|
locale: AdminLocale;
|
|
5
5
|
models: AdminModelMeta[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { XLAdminClient } from '
|
|
2
|
-
import type { AdminListFilterMeta } from '
|
|
1
|
+
import type { XLAdminClient } from '@xladmin-core/client';
|
|
2
|
+
import type { AdminListFilterMeta } from '@xladmin-core/types';
|
|
3
3
|
type ListFiltersSidebarProps = {
|
|
4
4
|
client: XLAdminClient;
|
|
5
5
|
slug: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { XLAdminClient } from '
|
|
2
|
-
import type { AdminTranslationKey } from '
|
|
3
|
-
import type { XLAdminRouter } from '
|
|
4
|
-
import type { AdminDeletePreviewResponse, AdminListResponse } from '
|
|
1
|
+
import type { XLAdminClient } from '@xladmin-core/client';
|
|
2
|
+
import type { AdminTranslationKey } from '@xladmin-core/i18n';
|
|
3
|
+
import type { XLAdminRouter } from '@xladmin-core/router';
|
|
4
|
+
import type { AdminDeletePreviewResponse, AdminListResponse } from '@xladmin-core/types';
|
|
5
5
|
type UseModelPageControllerOptions = {
|
|
6
6
|
client: XLAdminClient;
|
|
7
7
|
slug: string;
|
|
@@ -15,7 +15,7 @@ export declare function useModelPageController({ client, slug, pathname, locatio
|
|
|
15
15
|
appliedFilters: Record<string, string>;
|
|
16
16
|
appliedQuery: string;
|
|
17
17
|
bulkActionMenuAnchor: HTMLElement | null;
|
|
18
|
-
bulkActions: import("
|
|
18
|
+
bulkActions: import("@xladmin-core/types").AdminBulkActionMeta[];
|
|
19
19
|
createOpen: boolean;
|
|
20
20
|
currentPage: number;
|
|
21
21
|
data: AdminListResponse | null;
|
|
@@ -23,7 +23,7 @@ export declare function useModelPageController({ client, slug, pathname, locatio
|
|
|
23
23
|
deletePreviewError: string | null;
|
|
24
24
|
deletePreviewOpen: boolean;
|
|
25
25
|
error: string | null;
|
|
26
|
-
fieldMap: Map<string, import("
|
|
26
|
+
fieldMap: Map<string, import("@xladmin-core/types").AdminFieldMeta>;
|
|
27
27
|
filtersOpen: boolean;
|
|
28
28
|
handleConfirmDelete: () => Promise<void>;
|
|
29
29
|
handleFilterChange: (filterSlug: string, value: string) => void;
|
|
@@ -44,8 +44,8 @@ export declare function useModelPageController({ client, slug, pathname, locatio
|
|
|
44
44
|
isDeleteSubmitting: boolean;
|
|
45
45
|
isLoading: boolean;
|
|
46
46
|
listFields: string[];
|
|
47
|
-
listFilters: import("
|
|
48
|
-
meta: import("
|
|
47
|
+
listFilters: import("@xladmin-core/types").AdminListFilterMeta[];
|
|
48
|
+
meta: import("@xladmin-core/types").AdminModelMeta | null;
|
|
49
49
|
pageInput: string;
|
|
50
50
|
pendingDeleteIds: (string | number)[];
|
|
51
51
|
pendingDeleteMode: "single" | "bulk";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { XLAdminClient } from '
|
|
2
|
-
import type { AdminFieldMeta } from '
|
|
1
|
+
import type { XLAdminClient } from '@xladmin-core/client';
|
|
2
|
+
import type { AdminFieldMeta } from '@xladmin-core/types';
|
|
3
3
|
type ObjectFieldProps = {
|
|
4
4
|
field: AdminFieldMeta;
|
|
5
5
|
value: unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { XLAdminClient } from '
|
|
2
|
-
import type { AdminTranslationKey } from '
|
|
3
|
-
import type { XLAdminRouter } from '
|
|
4
|
-
import type { AdminDeletePreviewResponse, AdminDetailResponse } from '
|
|
1
|
+
import type { XLAdminClient } from '@xladmin-core/client';
|
|
2
|
+
import type { AdminTranslationKey } from '@xladmin-core/i18n';
|
|
3
|
+
import type { XLAdminRouter } from '@xladmin-core/router';
|
|
4
|
+
import type { AdminDeletePreviewResponse, AdminDetailResponse } from '@xladmin-core/types';
|
|
5
5
|
type UseObjectPageControllerOptions = {
|
|
6
6
|
client: XLAdminClient;
|
|
7
7
|
slug: string;
|
|
@@ -20,7 +20,7 @@ export declare function useObjectPageController({ client, slug, id, listPath, ro
|
|
|
20
20
|
detailFields: string[];
|
|
21
21
|
editableFieldNames: Set<string>;
|
|
22
22
|
error: string | null;
|
|
23
|
-
fieldMap: Map<string, import("
|
|
23
|
+
fieldMap: Map<string, import("@xladmin-core/types").AdminFieldMeta>;
|
|
24
24
|
handleDelete: () => Promise<void>;
|
|
25
25
|
handleFieldChange: (fieldName: string, nextValue: unknown) => void;
|
|
26
26
|
handleNavigateBack: () => void;
|
|
@@ -34,8 +34,8 @@ export declare function useObjectPageController({ client, slug, id, listPath, ro
|
|
|
34
34
|
isDirty: boolean;
|
|
35
35
|
isLoading: boolean;
|
|
36
36
|
isSaving: boolean;
|
|
37
|
-
meta: import("
|
|
38
|
-
objectActions: import("
|
|
37
|
+
meta: import("@xladmin-core/types").AdminModelMeta | null;
|
|
38
|
+
objectActions: import("@xladmin-core/types").AdminObjectActionMeta[];
|
|
39
39
|
objectTitle: string;
|
|
40
40
|
setActionsAnchorEl: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
|
|
41
41
|
setDeleteConfirmOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
package/dist/index.js
CHANGED
|
@@ -762,7 +762,7 @@ var FieldEditor = memo(function FieldEditor2({
|
|
|
762
762
|
label: field.label,
|
|
763
763
|
disabled: readOnly,
|
|
764
764
|
value: value ? dayjs(String(value)) : null,
|
|
765
|
-
onChange: (nextValue) => onChange(nextValue ? nextValue.format("YYYY-MM-
|
|
765
|
+
onChange: (nextValue) => onChange(nextValue ? nextValue.format("YYYY-MM-DD[T]HH:mm:ss") : null),
|
|
766
766
|
slotProps: {
|
|
767
767
|
popper: { disablePortal: true },
|
|
768
768
|
desktopPaper: buildPickerPaperProps(),
|
|
@@ -898,17 +898,19 @@ function renderChoiceEditor({
|
|
|
898
898
|
label: field.label,
|
|
899
899
|
placeholder: searchPlaceholder,
|
|
900
900
|
helperText: (_a2 = field.help_text) != null ? _a2 : void 0,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
901
|
+
slotProps: {
|
|
902
|
+
input: {
|
|
903
|
+
...InputProps,
|
|
904
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
905
|
+
isLoadingChoices ? /* @__PURE__ */ jsx3(CircularProgress, { color: "inherit", size: 16 }) : null,
|
|
906
|
+
InputProps.endAdornment
|
|
907
|
+
] })
|
|
908
|
+
},
|
|
909
|
+
htmlInput: {
|
|
910
|
+
...inputProps,
|
|
911
|
+
autoComplete: "new-password",
|
|
912
|
+
name: `admin-choice-${field.name}`
|
|
913
|
+
}
|
|
912
914
|
}
|
|
913
915
|
}
|
|
914
916
|
);
|
|
@@ -954,17 +956,19 @@ function renderChoiceEditor({
|
|
|
954
956
|
label: field.label,
|
|
955
957
|
placeholder: searchPlaceholder,
|
|
956
958
|
helperText: (_a2 = field.help_text) != null ? _a2 : void 0,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
959
|
+
slotProps: {
|
|
960
|
+
input: {
|
|
961
|
+
...InputProps,
|
|
962
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
963
|
+
isLoadingChoices ? /* @__PURE__ */ jsx3(CircularProgress, { color: "inherit", size: 16 }) : null,
|
|
964
|
+
InputProps.endAdornment
|
|
965
|
+
] })
|
|
966
|
+
},
|
|
967
|
+
htmlInput: {
|
|
968
|
+
...inputProps,
|
|
969
|
+
autoComplete: "new-password",
|
|
970
|
+
name: `admin-choice-${field.name}`
|
|
971
|
+
}
|
|
968
972
|
}
|
|
969
973
|
}
|
|
970
974
|
);
|
|
@@ -2238,14 +2242,16 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2238
2242
|
...textFieldParams,
|
|
2239
2243
|
label: filter.label,
|
|
2240
2244
|
placeholder: (_a2 = filter.placeholder) != null ? _a2 : t("search"),
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2245
|
+
slotProps: {
|
|
2246
|
+
input: {
|
|
2247
|
+
...InputProps,
|
|
2248
|
+
endAdornment: /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2249
|
+
isLoadingChoices ? /* @__PURE__ */ jsx15(CircularProgress3, { color: "inherit", size: 16 }) : null,
|
|
2250
|
+
InputProps.endAdornment
|
|
2251
|
+
] })
|
|
2252
|
+
},
|
|
2253
|
+
htmlInput: inputProps
|
|
2254
|
+
}
|
|
2249
2255
|
}
|
|
2250
2256
|
);
|
|
2251
2257
|
})()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminFieldMeta, AdminLocale } from '
|
|
1
|
+
import type { AdminFieldMeta, AdminLocale } from '@xladmin-core/types';
|
|
2
2
|
/**
|
|
3
3
|
* Готовит payload для create/patch так, чтобы nullable-поля можно было очищать,
|
|
4
4
|
* а служебные пустые поля вроде пароля не улетали в API без необходимости.
|