node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var designSystem = require('@strapi/design-system');
var icons = require('@strapi/icons');
var reactIntl = require('react-intl');
var styledComponents = require('styled-components');
var getTranslation = require('../utils/getTranslation.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
const mutateEditViewHook = ({ layout })=>{
// If i18n isn't explicitly enabled on the content type, then no field can be localized
if (!('i18n' in layout.options) || typeof layout.options.i18n === 'object' && layout.options.i18n !== null && 'localized' in layout.options.i18n && !layout.options.i18n.localized) {
return {
layout
};
}
const components = Object.entries(layout.components).reduce((acc, [key, componentLayout])=>{
return {
...acc,
[key]: {
...componentLayout,
layout: componentLayout.layout.map((row)=>row.map(addLabelActionToField))
}
};
}, {});
return {
layout: {
...layout,
components,
layout: layout.layout.map((panel)=>panel.map((row)=>row.map(addLabelActionToField)))
}
};
};
const addLabelActionToField = (field)=>{
const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions) ? field.attribute.pluginOptions.i18n.localized : true;
const labelActionProps = {
title: {
id: isFieldLocalized ? getTranslation.getTranslation('Field.localized') : getTranslation.getTranslation('Field.not-localized'),
defaultMessage: isFieldLocalized ? 'This value is unique for the selected locale' : 'This value is the same across all locales'
},
icon: isFieldLocalized ? /*#__PURE__*/ jsxRuntime.jsx(icons.Earth, {}) : null
};
return {
...field,
labelAction: isFieldLocalized ? /*#__PURE__*/ jsxRuntime.jsx(LabelAction, {
...labelActionProps
}) : null
};
};
const doesFieldHaveI18nPluginOpt = (pluginOpts)=>{
if (!pluginOpts) {
return false;
}
return 'i18n' in pluginOpts && typeof pluginOpts.i18n === 'object' && pluginOpts.i18n !== null && 'localized' in pluginOpts.i18n;
};
const LabelAction = ({ title, icon })=>{
const { formatMessage } = reactIntl.useIntl();
return /*#__PURE__*/ jsxRuntime.jsxs(Span, {
tag: "span",
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
tag: "span",
children: formatMessage(title)
}),
/*#__PURE__*/ React__namespace.cloneElement(icon, {
'aria-hidden': true,
focusable: false
})
]
});
};
const Span = styledComponents.styled(designSystem.Flex)`
svg {
width: 12px;
height: 12px;
fill: ${({ theme })=>theme.colors.neutral500};
path {
fill: ${({ theme })=>theme.colors.neutral500};
}
}
`;
exports.mutateEditViewHook = mutateEditViewHook;
//# sourceMappingURL=editView.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,85 @@
import { jsx, jsxs } from 'react/jsx-runtime';
import * as React from 'react';
import { Flex, VisuallyHidden } from '@strapi/design-system';
import { Earth } from '@strapi/icons';
import { useIntl } from 'react-intl';
import { styled } from 'styled-components';
import { getTranslation } from '../utils/getTranslation.mjs';
const mutateEditViewHook = ({ layout })=>{
// If i18n isn't explicitly enabled on the content type, then no field can be localized
if (!('i18n' in layout.options) || typeof layout.options.i18n === 'object' && layout.options.i18n !== null && 'localized' in layout.options.i18n && !layout.options.i18n.localized) {
return {
layout
};
}
const components = Object.entries(layout.components).reduce((acc, [key, componentLayout])=>{
return {
...acc,
[key]: {
...componentLayout,
layout: componentLayout.layout.map((row)=>row.map(addLabelActionToField))
}
};
}, {});
return {
layout: {
...layout,
components,
layout: layout.layout.map((panel)=>panel.map((row)=>row.map(addLabelActionToField)))
}
};
};
const addLabelActionToField = (field)=>{
const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions) ? field.attribute.pluginOptions.i18n.localized : true;
const labelActionProps = {
title: {
id: isFieldLocalized ? getTranslation('Field.localized') : getTranslation('Field.not-localized'),
defaultMessage: isFieldLocalized ? 'This value is unique for the selected locale' : 'This value is the same across all locales'
},
icon: isFieldLocalized ? /*#__PURE__*/ jsx(Earth, {}) : null
};
return {
...field,
labelAction: isFieldLocalized ? /*#__PURE__*/ jsx(LabelAction, {
...labelActionProps
}) : null
};
};
const doesFieldHaveI18nPluginOpt = (pluginOpts)=>{
if (!pluginOpts) {
return false;
}
return 'i18n' in pluginOpts && typeof pluginOpts.i18n === 'object' && pluginOpts.i18n !== null && 'localized' in pluginOpts.i18n;
};
const LabelAction = ({ title, icon })=>{
const { formatMessage } = useIntl();
return /*#__PURE__*/ jsxs(Span, {
tag: "span",
children: [
/*#__PURE__*/ jsx(VisuallyHidden, {
tag: "span",
children: formatMessage(title)
}),
/*#__PURE__*/ React.cloneElement(icon, {
'aria-hidden': true,
focusable: false
})
]
});
};
const Span = styled(Flex)`
svg {
width: 12px;
height: 12px;
fill: ${({ theme })=>theme.colors.neutral500};
path {
fill: ${({ theme })=>theme.colors.neutral500};
}
}
`;
export { mutateEditViewHook };
//# sourceMappingURL=editView.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var LocaleListCell = require('../components/LocaleListCell.js');
var fields = require('../utils/fields.js');
var getTranslation = require('../utils/getTranslation.js');
const addColumnToTableHook = ({ displayedHeaders, layout })=>{
const { options } = layout;
const isFieldLocalized = fields.doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
if (!isFieldLocalized) {
return {
displayedHeaders,
layout
};
}
return {
displayedHeaders: [
...displayedHeaders,
{
attribute: {
type: 'string'
},
label: {
id: getTranslation.getTranslation('list-view.table.header.label'),
defaultMessage: 'Available in'
},
searchable: false,
sortable: false,
name: 'locales',
// @ts-expect-error ID is seen as number | string; this will change when we move the type over.
cellFormatter: (props, _header, meta)=>/*#__PURE__*/ jsxRuntime.jsx(LocaleListCell.LocaleListCell, {
...props,
...meta
})
}
],
layout
};
};
exports.addColumnToTableHook = addColumnToTableHook;
//# sourceMappingURL=listView.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"listView.js","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => <LocaleListCell {...props} {...meta} />,\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell"],"mappings":";;;;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,yCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,6BAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAASC,cAACC,CAAAA,6BAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE;;AAC1E;AACD,SAAA;AACDlB,QAAAA;AACF,KAAA;AACF;;;;"}

View File

@@ -0,0 +1,41 @@
import { jsx } from 'react/jsx-runtime';
import { LocaleListCell } from '../components/LocaleListCell.mjs';
import { doesPluginOptionsHaveI18nLocalized } from '../utils/fields.mjs';
import { getTranslation } from '../utils/getTranslation.mjs';
const addColumnToTableHook = ({ displayedHeaders, layout })=>{
const { options } = layout;
const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options) ? options.i18n.localized : false;
if (!isFieldLocalized) {
return {
displayedHeaders,
layout
};
}
return {
displayedHeaders: [
...displayedHeaders,
{
attribute: {
type: 'string'
},
label: {
id: getTranslation('list-view.table.header.label'),
defaultMessage: 'Available in'
},
searchable: false,
sortable: false,
name: 'locales',
// @ts-expect-error ID is seen as number | string; this will change when we move the type over.
cellFormatter: (props, _header, meta)=>/*#__PURE__*/ jsx(LocaleListCell, {
...props,
...meta
})
}
],
layout
};
};
export { addColumnToTableHook };
//# sourceMappingURL=listView.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"listView.mjs","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => <LocaleListCell {...props} {...meta} />,\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell"],"mappings":";;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,kCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,cAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAASC,GAACC,CAAAA,cAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE;;AAC1E;AACD,SAAA;AACDlB,QAAAA;AACF,KAAA;AACF;;;;"}