@payloadcms/plugin-import-export 3.47.0-internal.b17506e → 3.47.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/components/ExportSaveButton/index.d.ts.map +1 -1
- package/dist/components/ExportSaveButton/index.js +21 -2
- package/dist/components/ExportSaveButton/index.js.map +1 -1
- package/dist/components/FieldsToExport/index.d.ts.map +1 -1
- package/dist/components/FieldsToExport/index.js +28 -41
- package/dist/components/FieldsToExport/index.js.map +1 -1
- package/dist/components/SelectionToUseField/index.d.ts +3 -0
- package/dist/components/SelectionToUseField/index.d.ts.map +1 -0
- package/dist/components/SelectionToUseField/index.js +128 -0
- package/dist/components/SelectionToUseField/index.js.map +1 -0
- package/dist/components/SortBy/index.js +3 -2
- package/dist/components/SortBy/index.js.map +1 -1
- package/dist/export/createExport.d.ts.map +1 -1
- package/dist/export/createExport.js +1 -2
- package/dist/export/createExport.js.map +1 -1
- package/dist/export/flattenObject.d.ts.map +1 -1
- package/dist/export/flattenObject.js +48 -30
- package/dist/export/flattenObject.js.map +1 -1
- package/dist/export/getCustomFieldFunctions.d.ts +2 -3
- package/dist/export/getCustomFieldFunctions.d.ts.map +1 -1
- package/dist/export/getCustomFieldFunctions.js +3 -5
- package/dist/export/getCustomFieldFunctions.js.map +1 -1
- package/dist/export/getFields.d.ts.map +1 -1
- package/dist/export/getFields.js +15 -10
- package/dist/export/getFields.js.map +1 -1
- package/dist/exports/rsc.d.ts +1 -1
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +1 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/utilities/getFlattenedFieldKeys.d.ts.map +1 -1
- package/dist/utilities/getFlattenedFieldKeys.js +16 -5
- package/dist/utilities/getFlattenedFieldKeys.js.map +1 -1
- package/package.json +7 -7
- package/dist/components/WhereField/index.d.ts +0 -4
- package/dist/components/WhereField/index.d.ts.map +0 -1
- package/dist/components/WhereField/index.js +0 -72
- package/dist/components/WhereField/index.js.map +0 -1
- package/dist/components/WhereField/index.scss +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useDocumentInfo, useField, useListQuery, useSelection } from '@payloadcms/ui';
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import './index.scss';
|
|
5
|
-
export const WhereField = ()=>{
|
|
6
|
-
const { setValue: setSelectionToUseValue, value: selectionToUseValue } = useField({
|
|
7
|
-
path: 'selectionToUse'
|
|
8
|
-
});
|
|
9
|
-
const { setValue } = useField({
|
|
10
|
-
path: 'where'
|
|
11
|
-
});
|
|
12
|
-
const { selectAll, selected } = useSelection();
|
|
13
|
-
const { query } = useListQuery();
|
|
14
|
-
const { id } = useDocumentInfo();
|
|
15
|
-
// setValue based on selectionToUseValue
|
|
16
|
-
useEffect(()=>{
|
|
17
|
-
if (id) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (selectionToUseValue === 'currentFilters' && query && query?.where) {
|
|
21
|
-
setValue(query.where);
|
|
22
|
-
}
|
|
23
|
-
if (selectionToUseValue === 'currentSelection' && selected) {
|
|
24
|
-
const ids = [];
|
|
25
|
-
for (const [key, value] of selected){
|
|
26
|
-
if (value) {
|
|
27
|
-
ids.push(key);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
setValue({
|
|
31
|
-
id: {
|
|
32
|
-
in: ids
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (selectionToUseValue === 'all' && selected) {
|
|
37
|
-
setValue({});
|
|
38
|
-
}
|
|
39
|
-
// Selected set a where query with IDs
|
|
40
|
-
}, [
|
|
41
|
-
id,
|
|
42
|
-
selectionToUseValue,
|
|
43
|
-
query,
|
|
44
|
-
selected,
|
|
45
|
-
setValue
|
|
46
|
-
]);
|
|
47
|
-
// handles default value of selectionToUse
|
|
48
|
-
useEffect(()=>{
|
|
49
|
-
if (id) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
let defaultSelection = 'all';
|
|
53
|
-
if ([
|
|
54
|
-
'allInPage',
|
|
55
|
-
'some'
|
|
56
|
-
].includes(selectAll)) {
|
|
57
|
-
defaultSelection = 'currentSelection';
|
|
58
|
-
}
|
|
59
|
-
if (defaultSelection === 'all' && query?.where) {
|
|
60
|
-
defaultSelection = 'currentFilters';
|
|
61
|
-
}
|
|
62
|
-
setSelectionToUseValue(defaultSelection);
|
|
63
|
-
}, [
|
|
64
|
-
id,
|
|
65
|
-
query,
|
|
66
|
-
selectAll,
|
|
67
|
-
setSelectionToUseValue
|
|
68
|
-
]);
|
|
69
|
-
return null;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/WhereField/index.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useDocumentInfo, useField, useListQuery, useSelection } from '@payloadcms/ui'\nimport { useEffect } from 'react'\n\nimport './index.scss'\n\nexport const WhereField: React.FC = () => {\n const { setValue: setSelectionToUseValue, value: selectionToUseValue } = useField({\n path: 'selectionToUse',\n })\n\n const { setValue } = useField({ path: 'where' })\n const { selectAll, selected } = useSelection()\n const { query } = useListQuery()\n const { id } = useDocumentInfo()\n\n // setValue based on selectionToUseValue\n useEffect(() => {\n if (id) {\n return\n }\n\n if (selectionToUseValue === 'currentFilters' && query && query?.where) {\n setValue(query.where)\n }\n\n if (selectionToUseValue === 'currentSelection' && selected) {\n const ids = []\n\n for (const [key, value] of selected) {\n if (value) {\n ids.push(key)\n }\n }\n\n setValue({\n id: {\n in: ids,\n },\n })\n }\n\n if (selectionToUseValue === 'all' && selected) {\n setValue({})\n }\n\n // Selected set a where query with IDs\n }, [id, selectionToUseValue, query, selected, setValue])\n\n // handles default value of selectionToUse\n useEffect(() => {\n if (id) {\n return\n }\n let defaultSelection: 'all' | 'currentFilters' | 'currentSelection' = 'all'\n\n if (['allInPage', 'some'].includes(selectAll)) {\n defaultSelection = 'currentSelection'\n }\n\n if (defaultSelection === 'all' && query?.where) {\n defaultSelection = 'currentFilters'\n }\n\n setSelectionToUseValue(defaultSelection)\n }, [id, query, selectAll, setSelectionToUseValue])\n\n return null\n}\n"],"names":["useDocumentInfo","useField","useListQuery","useSelection","useEffect","WhereField","setValue","setSelectionToUseValue","value","selectionToUseValue","path","selectAll","selected","query","id","where","ids","key","push","in","defaultSelection","includes"],"mappings":"AAAA;AAIA,SAASA,eAAe,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,YAAY,QAAQ,iBAAgB;AACtF,SAASC,SAAS,QAAQ,QAAO;AAEjC,OAAO,eAAc;AAErB,OAAO,MAAMC,aAAuB;IAClC,MAAM,EAAEC,UAAUC,sBAAsB,EAAEC,OAAOC,mBAAmB,EAAE,GAAGR,SAAS;QAChFS,MAAM;IACR;IAEA,MAAM,EAAEJ,QAAQ,EAAE,GAAGL,SAAS;QAAES,MAAM;IAAQ;IAC9C,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGT;IAChC,MAAM,EAAEU,KAAK,EAAE,GAAGX;IAClB,MAAM,EAAEY,EAAE,EAAE,GAAGd;IAEf,wCAAwC;IACxCI,UAAU;QACR,IAAIU,IAAI;YACN;QACF;QAEA,IAAIL,wBAAwB,oBAAoBI,SAASA,OAAOE,OAAO;YACrET,SAASO,MAAME,KAAK;QACtB;QAEA,IAAIN,wBAAwB,sBAAsBG,UAAU;YAC1D,MAAMI,MAAM,EAAE;YAEd,KAAK,MAAM,CAACC,KAAKT,MAAM,IAAII,SAAU;gBACnC,IAAIJ,OAAO;oBACTQ,IAAIE,IAAI,CAACD;gBACX;YACF;YAEAX,SAAS;gBACPQ,IAAI;oBACFK,IAAIH;gBACN;YACF;QACF;QAEA,IAAIP,wBAAwB,SAASG,UAAU;YAC7CN,SAAS,CAAC;QACZ;IAEA,sCAAsC;IACxC,GAAG;QAACQ;QAAIL;QAAqBI;QAAOD;QAAUN;KAAS;IAEvD,0CAA0C;IAC1CF,UAAU;QACR,IAAIU,IAAI;YACN;QACF;QACA,IAAIM,mBAAkE;QAEtE,IAAI;YAAC;YAAa;SAAO,CAACC,QAAQ,CAACV,YAAY;YAC7CS,mBAAmB;QACrB;QAEA,IAAIA,qBAAqB,SAASP,OAAOE,OAAO;YAC9CK,mBAAmB;QACrB;QAEAb,uBAAuBa;IACzB,GAAG;QAACN;QAAID;QAAOF;QAAWJ;KAAuB;IAEjD,OAAO;AACT,EAAC"}
|
|
File without changes
|