node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

@@ -0,0 +1,154 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var designSystem = require('@strapi/design-system');
var formik = require('formik');
var isEmpty = require('lodash/isEmpty');
var reactIntl = require('react-intl');
var useBulkMove = require('../../hooks/useBulkMove.js');
var useFolderStructure = require('../../hooks/useFolderStructure.js');
require('byte-size');
require('date-fns');
var normalizeAPIError = require('../../utils/normalizeAPIError.js');
var getTrad = require('../../utils/getTrad.js');
require('qs');
require('../../constants.js');
require('../../utils/urlYupSchema.js');
var SelectTree = require('../SelectTree/SelectTree.js');
const BulkMoveDialog = ({ onClose, selected = [], currentFolder })=>{
const { formatMessage } = reactIntl.useIntl();
const { data: folderStructure, isLoading } = useFolderStructure.useFolderStructure();
const { move } = useBulkMove.useBulkMove();
if (!folderStructure) {
return null;
}
const handleSubmit = async (values, { setErrors })=>{
try {
if (typeof values.destination !== 'string') {
const destinationValue = values.destination.value;
await move(destinationValue, selected);
onClose();
}
} catch (error) {
const normalizedError = normalizeAPIError.normalizeAPIError(error);
if (normalizedError && 'errors' in normalizedError) {
const formikErrors = normalizedError.errors?.reduce((acc, error)=>{
acc[error.values?.path?.length || 'destination'] = error.defaultMessage;
return acc;
}, {});
if (!isEmpty(formikErrors)) {
setErrors(formikErrors);
}
}
}
};
if (isLoading) {
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Content, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Body, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
justifyContent: "center",
paddingTop: 4,
paddingBottom: 4,
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Loader, {
children: formatMessage({
id: getTrad.getTrad('content.isLoading'),
defaultMessage: 'Content is loading.'
})
})
})
})
});
}
const initialFormData = {
destination: {
value: currentFolder?.id || '',
label: currentFolder?.name || folderStructure[0].label
}
};
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Content, {
children: /*#__PURE__*/ jsxRuntime.jsx(formik.Formik, {
validateOnChange: false,
onSubmit: handleSubmit,
initialValues: initialFormData,
children: ({ values, errors, setFieldValue })=>/*#__PURE__*/ jsxRuntime.jsxs(formik.Form, {
noValidate: true,
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Header, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Title, {
children: formatMessage({
id: getTrad.getTrad('modal.folder.move.title'),
defaultMessage: 'Move elements to'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Body, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Root, {
gap: 4,
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Item, {
xs: 12,
col: 12,
direction: "column",
alignItems: "stretch",
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Field.Root, {
id: "folder-destination",
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
children: formatMessage({
id: getTrad.getTrad('form.input.label.folder-location'),
defaultMessage: 'Location'
})
}),
/*#__PURE__*/ jsxRuntime.jsx(SelectTree.SelectTree, {
options: folderStructure,
onChange: (value)=>{
setFieldValue('destination', value);
},
defaultValue: typeof values.destination !== 'string' ? values.destination : undefined,
name: "destination",
menuPortalTarget: document.querySelector('body'),
inputId: "folder-destination",
error: errors?.destination,
ariaErrorMessage: "destination-error"
}),
errors.destination && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
variant: "pi",
tag: "p",
textColor: "danger600",
children: errors.destination
})
]
})
})
})
}),
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Modal.Footer, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Close, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
variant: "tertiary",
name: "cancel",
children: formatMessage({
id: 'cancel',
defaultMessage: 'Cancel'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
type: "submit",
loading: isLoading,
children: formatMessage({
id: 'modal.folder.move.submit',
defaultMessage: 'Move'
})
})
]
})
]
})
})
});
};
exports.BulkMoveDialog = BulkMoveDialog;
//# sourceMappingURL=BulkMoveDialog.js.map
@@ -0,0 +1 @@
{"version":3,"file":"BulkMoveDialog.js","sources":["../../../../admin/src/components/BulkMoveDialog/BulkMoveDialog.tsx"],"sourcesContent":["import { Button, Flex, Grid, Field, Loader, Modal, Typography } from '@strapi/design-system';\nimport { Form, Formik, FormikErrors } from 'formik';\nimport isEmpty from 'lodash/isEmpty';\nimport { useIntl } from 'react-intl';\n\nimport { File } from '../../../../shared/contracts/files';\nimport { useBulkMove } from '../../hooks/useBulkMove';\nimport { useFolderStructure } from '../../hooks/useFolderStructure';\nimport { getTrad, normalizeAPIError } from '../../utils';\nimport { SelectTree } from '../SelectTree/SelectTree';\n\nimport type { Folder } from '../../../../shared/contracts/folders';\nimport type { OptionSelectTree } from '../SelectTree/SelectTree';\nimport type { FetchError } from '@strapi/admin/strapi-admin';\n\ntype InitialFormData = {\n destination:\n | {\n value: string | number;\n label: string;\n }\n | string;\n};\n\ninterface FolderWithType extends Folder {\n type: string;\n}\n\ninterface FileWithType extends File {\n type: string;\n}\n\nexport interface BulkMoveDialogProps {\n onClose: () => void;\n selected?: Array<FolderWithType | FileWithType>;\n currentFolder?: FolderWithType;\n}\n\nexport const BulkMoveDialog = ({ onClose, selected = [], currentFolder }: BulkMoveDialogProps) => {\n const { formatMessage } = useIntl();\n const { data: folderStructure, isLoading } = useFolderStructure();\n const { move } = useBulkMove();\n\n if (!folderStructure) {\n return null;\n }\n\n const handleSubmit = async (\n values: InitialFormData,\n { setErrors }: { setErrors: (errors: FormikErrors<InitialFormData>) => void }\n ) => {\n try {\n if (typeof values.destination !== 'string') {\n const destinationValue = values.destination.value;\n await move(destinationValue, selected);\n onClose();\n }\n } catch (error) {\n const normalizedError = normalizeAPIError(error as FetchError)!;\n\n if (normalizedError && 'errors' in normalizedError) {\n const formikErrors = normalizedError.errors?.reduce<Record<string, string>>(\n (acc, error) => {\n acc[error.values?.path?.length || 'destination'] = error.defaultMessage;\n\n return acc;\n },\n {}\n );\n\n if (!isEmpty(formikErrors)) {\n setErrors(formikErrors);\n }\n }\n }\n };\n\n if (isLoading) {\n return (\n <Modal.Content>\n <Modal.Body>\n <Flex justifyContent=\"center\" paddingTop={4} paddingBottom={4}>\n <Loader>\n {formatMessage({\n id: getTrad('content.isLoading'),\n defaultMessage: 'Content is loading.',\n })}\n </Loader>\n </Flex>\n </Modal.Body>\n </Modal.Content>\n );\n }\n\n const initialFormData: InitialFormData = {\n destination: {\n value: currentFolder?.id || '',\n label: currentFolder?.name || folderStructure[0].label,\n },\n };\n\n return (\n <Modal.Content>\n <Formik validateOnChange={false} onSubmit={handleSubmit} initialValues={initialFormData}>\n {({ values, errors, setFieldValue }) => (\n <Form noValidate>\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTrad('modal.folder.move.title'),\n defaultMessage: 'Move elements to',\n })}\n </Modal.Title>\n </Modal.Header>\n\n <Modal.Body>\n <Grid.Root gap={4}>\n <Grid.Item xs={12} col={12} direction=\"column\" alignItems=\"stretch\">\n <Field.Root id=\"folder-destination\">\n <Field.Label>\n {formatMessage({\n id: getTrad('form.input.label.folder-location'),\n defaultMessage: 'Location',\n })}\n </Field.Label>\n\n <SelectTree\n options={folderStructure as OptionSelectTree[]}\n onChange={(value: Record<string, string | number>) => {\n setFieldValue('destination', value);\n }}\n defaultValue={\n typeof values.destination !== 'string' ? values.destination : undefined\n }\n name=\"destination\"\n menuPortalTarget={document.querySelector('body')}\n inputId=\"folder-destination\"\n error={errors?.destination}\n ariaErrorMessage=\"destination-error\"\n />\n\n {errors.destination && (\n <Typography variant=\"pi\" tag=\"p\" textColor=\"danger600\">\n {errors.destinatioLine truncated
@@ -0,0 +1,152 @@
import { jsx, jsxs } from 'react/jsx-runtime';
import { Modal, Flex, Loader, Grid, Field, Typography, Button } from '@strapi/design-system';
import { Formik, Form } from 'formik';
import isEmpty from 'lodash/isEmpty';
import { useIntl } from 'react-intl';
import { useBulkMove } from '../../hooks/useBulkMove.mjs';
import { useFolderStructure } from '../../hooks/useFolderStructure.mjs';
import 'byte-size';
import 'date-fns';
import { normalizeAPIError } from '../../utils/normalizeAPIError.mjs';
import { getTrad } from '../../utils/getTrad.mjs';
import 'qs';
import '../../constants.mjs';
import '../../utils/urlYupSchema.mjs';
import { SelectTree } from '../SelectTree/SelectTree.mjs';
const BulkMoveDialog = ({ onClose, selected = [], currentFolder })=>{
const { formatMessage } = useIntl();
const { data: folderStructure, isLoading } = useFolderStructure();
const { move } = useBulkMove();
if (!folderStructure) {
return null;
}
const handleSubmit = async (values, { setErrors })=>{
try {
if (typeof values.destination !== 'string') {
const destinationValue = values.destination.value;
await move(destinationValue, selected);
onClose();
}
} catch (error) {
const normalizedError = normalizeAPIError(error);
if (normalizedError && 'errors' in normalizedError) {
const formikErrors = normalizedError.errors?.reduce((acc, error)=>{
acc[error.values?.path?.length || 'destination'] = error.defaultMessage;
return acc;
}, {});
if (!isEmpty(formikErrors)) {
setErrors(formikErrors);
}
}
}
};
if (isLoading) {
return /*#__PURE__*/ jsx(Modal.Content, {
children: /*#__PURE__*/ jsx(Modal.Body, {
children: /*#__PURE__*/ jsx(Flex, {
justifyContent: "center",
paddingTop: 4,
paddingBottom: 4,
children: /*#__PURE__*/ jsx(Loader, {
children: formatMessage({
id: getTrad('content.isLoading'),
defaultMessage: 'Content is loading.'
})
})
})
})
});
}
const initialFormData = {
destination: {
value: currentFolder?.id || '',
label: currentFolder?.name || folderStructure[0].label
}
};
return /*#__PURE__*/ jsx(Modal.Content, {
children: /*#__PURE__*/ jsx(Formik, {
validateOnChange: false,
onSubmit: handleSubmit,
initialValues: initialFormData,
children: ({ values, errors, setFieldValue })=>/*#__PURE__*/ jsxs(Form, {
noValidate: true,
children: [
/*#__PURE__*/ jsx(Modal.Header, {
children: /*#__PURE__*/ jsx(Modal.Title, {
children: formatMessage({
id: getTrad('modal.folder.move.title'),
defaultMessage: 'Move elements to'
})
})
}),
/*#__PURE__*/ jsx(Modal.Body, {
children: /*#__PURE__*/ jsx(Grid.Root, {
gap: 4,
children: /*#__PURE__*/ jsx(Grid.Item, {
xs: 12,
col: 12,
direction: "column",
alignItems: "stretch",
children: /*#__PURE__*/ jsxs(Field.Root, {
id: "folder-destination",
children: [
/*#__PURE__*/ jsx(Field.Label, {
children: formatMessage({
id: getTrad('form.input.label.folder-location'),
defaultMessage: 'Location'
})
}),
/*#__PURE__*/ jsx(SelectTree, {
options: folderStructure,
onChange: (value)=>{
setFieldValue('destination', value);
},
defaultValue: typeof values.destination !== 'string' ? values.destination : undefined,
name: "destination",
menuPortalTarget: document.querySelector('body'),
inputId: "folder-destination",
error: errors?.destination,
ariaErrorMessage: "destination-error"
}),
errors.destination && /*#__PURE__*/ jsx(Typography, {
variant: "pi",
tag: "p",
textColor: "danger600",
children: errors.destination
})
]
})
})
})
}),
/*#__PURE__*/ jsxs(Modal.Footer, {
children: [
/*#__PURE__*/ jsx(Modal.Close, {
children: /*#__PURE__*/ jsx(Button, {
variant: "tertiary",
name: "cancel",
children: formatMessage({
id: 'cancel',
defaultMessage: 'Cancel'
})
})
}),
/*#__PURE__*/ jsx(Button, {
type: "submit",
loading: isLoading,
children: formatMessage({
id: 'modal.folder.move.submit',
defaultMessage: 'Move'
})
})
]
})
]
})
})
});
};
export { BulkMoveDialog };
//# sourceMappingURL=BulkMoveDialog.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"BulkMoveDialog.mjs","sources":["../../../../admin/src/components/BulkMoveDialog/BulkMoveDialog.tsx"],"sourcesContent":["import { Button, Flex, Grid, Field, Loader, Modal, Typography } from '@strapi/design-system';\nimport { Form, Formik, FormikErrors } from 'formik';\nimport isEmpty from 'lodash/isEmpty';\nimport { useIntl } from 'react-intl';\n\nimport { File } from '../../../../shared/contracts/files';\nimport { useBulkMove } from '../../hooks/useBulkMove';\nimport { useFolderStructure } from '../../hooks/useFolderStructure';\nimport { getTrad, normalizeAPIError } from '../../utils';\nimport { SelectTree } from '../SelectTree/SelectTree';\n\nimport type { Folder } from '../../../../shared/contracts/folders';\nimport type { OptionSelectTree } from '../SelectTree/SelectTree';\nimport type { FetchError } from '@strapi/admin/strapi-admin';\n\ntype InitialFormData = {\n destination:\n | {\n value: string | number;\n label: string;\n }\n | string;\n};\n\ninterface FolderWithType extends Folder {\n type: string;\n}\n\ninterface FileWithType extends File {\n type: string;\n}\n\nexport interface BulkMoveDialogProps {\n onClose: () => void;\n selected?: Array<FolderWithType | FileWithType>;\n currentFolder?: FolderWithType;\n}\n\nexport const BulkMoveDialog = ({ onClose, selected = [], currentFolder }: BulkMoveDialogProps) => {\n const { formatMessage } = useIntl();\n const { data: folderStructure, isLoading } = useFolderStructure();\n const { move } = useBulkMove();\n\n if (!folderStructure) {\n return null;\n }\n\n const handleSubmit = async (\n values: InitialFormData,\n { setErrors }: { setErrors: (errors: FormikErrors<InitialFormData>) => void }\n ) => {\n try {\n if (typeof values.destination !== 'string') {\n const destinationValue = values.destination.value;\n await move(destinationValue, selected);\n onClose();\n }\n } catch (error) {\n const normalizedError = normalizeAPIError(error as FetchError)!;\n\n if (normalizedError && 'errors' in normalizedError) {\n const formikErrors = normalizedError.errors?.reduce<Record<string, string>>(\n (acc, error) => {\n acc[error.values?.path?.length || 'destination'] = error.defaultMessage;\n\n return acc;\n },\n {}\n );\n\n if (!isEmpty(formikErrors)) {\n setErrors(formikErrors);\n }\n }\n }\n };\n\n if (isLoading) {\n return (\n <Modal.Content>\n <Modal.Body>\n <Flex justifyContent=\"center\" paddingTop={4} paddingBottom={4}>\n <Loader>\n {formatMessage({\n id: getTrad('content.isLoading'),\n defaultMessage: 'Content is loading.',\n })}\n </Loader>\n </Flex>\n </Modal.Body>\n </Modal.Content>\n );\n }\n\n const initialFormData: InitialFormData = {\n destination: {\n value: currentFolder?.id || '',\n label: currentFolder?.name || folderStructure[0].label,\n },\n };\n\n return (\n <Modal.Content>\n <Formik validateOnChange={false} onSubmit={handleSubmit} initialValues={initialFormData}>\n {({ values, errors, setFieldValue }) => (\n <Form noValidate>\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTrad('modal.folder.move.title'),\n defaultMessage: 'Move elements to',\n })}\n </Modal.Title>\n </Modal.Header>\n\n <Modal.Body>\n <Grid.Root gap={4}>\n <Grid.Item xs={12} col={12} direction=\"column\" alignItems=\"stretch\">\n <Field.Root id=\"folder-destination\">\n <Field.Label>\n {formatMessage({\n id: getTrad('form.input.label.folder-location'),\n defaultMessage: 'Location',\n })}\n </Field.Label>\n\n <SelectTree\n options={folderStructure as OptionSelectTree[]}\n onChange={(value: Record<string, string | number>) => {\n setFieldValue('destination', value);\n }}\n defaultValue={\n typeof values.destination !== 'string' ? values.destination : undefined\n }\n name=\"destination\"\n menuPortalTarget={document.querySelector('body')}\n inputId=\"folder-destination\"\n error={errors?.destination}\n ariaErrorMessage=\"destination-error\"\n />\n\n {errors.destination && (\n <Typography variant=\"pi\" tag=\"p\" textColor=\"danger600\">\n {errors.destinatiLine truncated