@payloadcms/ui 3.72.0-internal.3e70d4c → 3.72.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/dist/elements/FolderView/FolderTypeField/index.d.ts +2 -4
- package/dist/elements/FolderView/FolderTypeField/index.d.ts.map +1 -1
- package/dist/elements/FolderView/FolderTypeField/index.js +2 -4
- package/dist/elements/FolderView/FolderTypeField/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/JSON/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/JSON/index.js +44 -10
- package/dist/elements/Table/DefaultCell/fields/JSON/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/JSON/index.scss +7 -0
- package/dist/exports/client/index.js +12 -12
- package/dist/exports/client/index.js.map +4 -4
- package/dist/styles.css +1 -1
- package/dist/utilities/stringifyTruncated.d.ts +13 -0
- package/dist/utilities/stringifyTruncated.d.ts.map +1 -0
- package/dist/utilities/stringifyTruncated.js +20 -0
- package/dist/utilities/stringifyTruncated.js.map +1 -0
- package/package.json +4 -4
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SelectFieldClientProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare const FolderTypeField: (
|
|
4
|
-
options: Option[];
|
|
5
|
-
} & SelectFieldClientProps) => React.JSX.Element;
|
|
3
|
+
export declare const FolderTypeField: (props: SelectFieldClientProps) => React.JSX.Element;
|
|
6
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,eAAO,MAAM,eAAe,UAAW,sBAAsB,sBA0H5D,CAAA"}
|
|
@@ -6,10 +6,7 @@ import { SelectInput } from '../../../fields/Select/Input.js';
|
|
|
6
6
|
import { useField } from '../../../forms/useField/index.js';
|
|
7
7
|
import { useFolder } from '../../../providers/Folders/index.js';
|
|
8
8
|
import { useTranslation } from '../../../providers/Translation/index.js';
|
|
9
|
-
export const FolderTypeField =
|
|
10
|
-
options: allSelectOptions,
|
|
11
|
-
...props
|
|
12
|
-
}) => {
|
|
9
|
+
export const FolderTypeField = props => {
|
|
13
10
|
const {
|
|
14
11
|
field,
|
|
15
12
|
field: {
|
|
@@ -23,6 +20,7 @@ export const FolderTypeField = ({
|
|
|
23
20
|
hasMany = false,
|
|
24
21
|
label,
|
|
25
22
|
localized,
|
|
23
|
+
options: allSelectOptions = [],
|
|
26
24
|
required
|
|
27
25
|
},
|
|
28
26
|
onChange: onChangeFromProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","mergeFieldStyles","formatOptions","SelectInput","useField","useFolder","useTranslation","FolderTypeField","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","mergeFieldStyles","formatOptions","SelectInput","useField","useFolder","useTranslation","FolderTypeField","props","field","name","admin","className","isClearable","isSortable","placeholder","hasMany","label","localized","options","allSelectOptions","required","onChange","onChangeFromProps","path","pathFromProps","readOnly","validate","t","folderType","useMemo","length","filter","option","value","includes","memoizedValidate","useCallback","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","selectFilterOptions","setValue","showError","potentiallyStalePath","selectedOption","newValue","Array","isArray","map","styles","_jsx","description","filterOption","some","undefined","style"],"sources":["../../../../src/elements/FolderView/FolderTypeField/index.tsx"],"sourcesContent":["import type { Option, OptionObject, SelectFieldClientProps } from 'payload'\n\nimport React from 'react'\n\nimport type { ReactSelectAdapterProps } from '../../ReactSelect/types.js'\n\nimport { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js'\nimport { formatOptions } from '../../../fields/Select/index.js'\nimport { SelectInput } from '../../../fields/Select/Input.js'\nimport { useField } from '../../../forms/useField/index.js'\nimport { useFolder } from '../../../providers/Folders/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nexport const FolderTypeField = (props: SelectFieldClientProps) => {\n const {\n field,\n field: {\n name,\n admin: {\n className,\n isClearable = true,\n isSortable = true,\n placeholder,\n } = {} as SelectFieldClientProps['field']['admin'],\n hasMany = false,\n label,\n localized,\n options: allSelectOptions = [],\n required,\n },\n onChange: onChangeFromProps,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n const { t } = useTranslation()\n\n const { folderType } = useFolder()\n\n const options = React.useMemo(() => {\n if (!folderType || folderType.length === 0) {\n return formatOptions(allSelectOptions)\n }\n return formatOptions(\n allSelectOptions.filter((option) => {\n if (typeof option === 'object' && option.value) {\n return folderType.includes(option.value)\n }\n return true\n }),\n )\n }, [allSelectOptions, folderType])\n\n const memoizedValidate = React.useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, hasMany, options, required })\n }\n },\n [validate, required, hasMany, options],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n path,\n selectFilterOptions,\n setValue,\n showError,\n value,\n } = useField({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const onChange: ReactSelectAdapterProps['onChange'] = React.useCallback(\n (selectedOption: OptionObject | OptionObject[]) => {\n if (!readOnly || disabled) {\n let newValue: string | string[] = null\n if (selectedOption && hasMany) {\n if (Array.isArray(selectedOption) && selectedOption.length > 0) {\n newValue = selectedOption.map((option) => option.value)\n } else {\n newValue = null\n }\n } else if (selectedOption && !Array.isArray(selectedOption)) {\n newValue = selectedOption.value\n }\n\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(newValue)\n }\n\n setValue(newValue)\n }\n },\n [readOnly, disabled, hasMany, setValue, onChangeFromProps],\n )\n\n const styles = React.useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <SelectInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n className={className}\n Description={Description}\n description={t('folder:folderTypeDescription')}\n Error={Error}\n filterOption={\n selectFilterOptions\n ? ({ value }) =>\n selectFilterOptions?.some(\n (option) => (typeof option === 'string' ? option : option.value) === value,\n )\n : undefined\n }\n hasMany={hasMany}\n isClearable={isClearable}\n isSortable={isSortable}\n Label={Label}\n label={label}\n localized={localized}\n name={name}\n onChange={onChange}\n options={options}\n path={path}\n placeholder={placeholder}\n readOnly={readOnly || disabled}\n required={required || (Array.isArray(folderType) && folderType.length > 0)}\n showError={showError}\n style={styles}\n value={value as string | string[]}\n />\n )\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAIlB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,WAAW,QAAQ;AAC5B,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAAmBC,KAAA;EAC9B,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QACLC,SAAS;QACTC,WAAA,GAAc,IAAI;QAClBC,UAAA,GAAa,IAAI;QACjBC;MAAW,CACZ,GAAG,CAAC,CAA6C;MAClDC,OAAA,GAAU,KAAK;MACfC,KAAK;MACLC,SAAS;MACTC,OAAA,EAASC,gBAAA,GAAmB,EAAE;MAC9BC;IAAQ,CACT;IACDC,QAAA,EAAUC,iBAAiB;IAC3BC,IAAA,EAAMC,aAAa;IACnBC,QAAQ;IACRC;EAAQ,CACT,GAAGnB,KAAA;EACJ,MAAM;IAAEoB;EAAC,CAAE,GAAGtB,cAAA;EAEd,MAAM;IAAEuB;EAAU,CAAE,GAAGxB,SAAA;EAEvB,MAA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A,WAAA;IACbW,QAAA,EAAUA,QAAA,IAAYmB,QAAA;IACtBxB,QAAA,EAAUA,QAAA,IAAa+B,KAAA,CAAMC,OAAO,CAACxB,UAAA,KAAeA,UAAA,CAAWE,MAAM,GAAG;IACxEiB,SAAA,EAAWA,SAAA;IACXa,KAAA,EAAON,MAAA;IACPrB,KAAA,EAAOA;;AAGb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/Table/DefaultCell/fields/JSON/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/Table/DefaultCell/fields/JSON/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAGrB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAgBzE,CAAA"}
|
|
@@ -1,17 +1,51 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
import React from 'react';
|
|
6
|
+
import { useTranslation } from '../../../../../providers/Translation/index.js';
|
|
5
7
|
import './index.scss';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import { stringifyTruncated } from '../../../../../utilities/stringifyTruncated.js';
|
|
9
|
+
export const JSONCell = t0 => {
|
|
10
|
+
const $ = _c(4);
|
|
11
|
+
const {
|
|
12
|
+
cellData
|
|
13
|
+
} = t0;
|
|
14
|
+
const {
|
|
15
|
+
t
|
|
16
|
+
} = useTranslation();
|
|
17
|
+
;
|
|
18
|
+
try {
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[0] !== cellData) {
|
|
21
|
+
const cellDataString = stringifyTruncated(cellData, 100);
|
|
22
|
+
t2 = _jsx("code", {
|
|
23
|
+
className: "json-cell",
|
|
24
|
+
children: _jsx("span", {
|
|
25
|
+
children: cellDataString
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
$[0] = cellData;
|
|
29
|
+
$[1] = t2;
|
|
30
|
+
} else {
|
|
31
|
+
t2 = $[1];
|
|
32
|
+
}
|
|
33
|
+
return t2;
|
|
34
|
+
} catch (t1) {
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[2] !== t) {
|
|
37
|
+
t2 = _jsx("code", {
|
|
38
|
+
className: "json-cell",
|
|
39
|
+
children: _jsx("span", {
|
|
40
|
+
children: t("general:error")
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
$[2] = t;
|
|
44
|
+
$[3] = t2;
|
|
45
|
+
} else {
|
|
46
|
+
t2 = $[3];
|
|
47
|
+
}
|
|
48
|
+
return t2;
|
|
49
|
+
}
|
|
16
50
|
};
|
|
17
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","JSONCell","cellData","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","useTranslation","stringifyTruncated","JSONCell","t0","$","cellData","t","t2","cellDataString","_jsx","className","children"],"sources":["../../../../../../src/elements/Table/DefaultCell/fields/JSON/index.tsx"],"sourcesContent":["'use client'\nimport type { DefaultCellComponentProps, JSONFieldClient } from 'payload'\n\nimport React from 'react'\n\nimport { useTranslation } from '../../../../../providers/Translation/index.js'\nimport './index.scss'\nimport { stringifyTruncated } from '../../../../../utilities/stringifyTruncated.js'\n\nexport const JSONCell: React.FC<DefaultCellComponentProps<JSONFieldClient>> = ({ cellData }) => {\n const { t } = useTranslation()\n try {\n const cellDataString = stringifyTruncated(cellData, 100)\n return (\n <code className=\"json-cell\">\n <span>{cellDataString}</span>\n </code>\n )\n } catch (_ignore) {\n return (\n <code className=\"json-cell\">\n <span>{t('general:error')}</span>\n </code>\n )\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,QAAA,GAAiEC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAC;IAAAO;EAAA,IAAAF,EAAY;EACzF;IAAAG;EAAA,IAAcN,cAAA;EAAA;EAAA;IAAA,IAAAO,EAAA;IAAA,IAAAH,CAAA,QAAAC,QAAA;MAEZ,MAAAG,cAAA,GAAuBP,kBAAA,CAAmBI,QAAA,KAAU;MAElDE,EAAA,GAAAE,IAAA,CAAC;QAAAC,SAAA,EAAe;QAAAC,QAAA,EACdF,IAAA,CAAC;UAAAE,QAAA,EAAMH;QAAA,C;;;;;;;WADTD,E;;;;MAMAA,EAAA,GAAAE,IAAA,CAAC;QAAAC,SAAA,EAAe;QAAAC,QAAA,EACdF,IAAA,CAAC;UAAAE,QAAA,EAAML,CAAA,CAAE;QAAA,C;;;;;;;WADXC,E;;CAKN","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
color: var(--theme-elevation-800);
|
|
12
12
|
border-radius: $style-radius-m;
|
|
13
13
|
padding: 0 base(0.25);
|
|
14
|
+
max-width: 99.9%;
|
|
14
15
|
[dir='ltr'] & {
|
|
15
16
|
padding-left: base(0.0875 + 0.25);
|
|
16
17
|
}
|
|
@@ -20,5 +21,11 @@
|
|
|
20
21
|
|
|
21
22
|
background: var(--theme-elevation-100);
|
|
22
23
|
color: var(--theme-elevation-800);
|
|
24
|
+
|
|
25
|
+
span {
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
}
|