@firecms/core 3.4.0-canary.63041d0 → 3.4.0-canary.d20cc85
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/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +3 -1
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +3 -1
- package/dist/components/ReferenceTable/ReferenceSelectionTable.d.ts +10 -1
- package/dist/form/EntityForm.d.ts +6 -1
- package/dist/hooks/data/useCollectionFetch.d.ts +7 -1
- package/dist/index.es.js +177 -112
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +177 -112
- package/dist/index.umd.js.map +1 -1
- package/dist/types/datasource.d.ts +17 -4
- package/dist/types/entities.d.ts +21 -1
- package/dist/util/parent_references_from_path.d.ts +1 -0
- package/package.json +4 -4
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +5 -1
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +4 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +10 -2
- package/src/components/EntityCollectionView/useBoardDataController.tsx +11 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +11 -0
- package/src/components/common/useDataSourceTableController.tsx +8 -2
- package/src/core/EntityEditView.tsx +5 -2
- package/src/form/EntityForm.tsx +8 -2
- package/src/hooks/data/delete.ts +2 -0
- package/src/hooks/data/save.ts +1 -1
- package/src/hooks/data/useCollectionFetch.tsx +13 -0
- package/src/hooks/data/useEntityFetch.tsx +10 -1
- package/src/hooks/useResolvedNavigationFrom.tsx +2 -0
- package/src/internal/useBuildDataSource.ts +14 -4
- package/src/types/datasource.ts +17 -4
- package/src/types/entities.ts +24 -1
- package/src/util/entities.ts +3 -1
- package/src/util/parent_references_from_path.ts +10 -2
package/dist/index.es.js
CHANGED
|
@@ -369,10 +369,21 @@ class EntityReference {
|
|
|
369
369
|
* Optional database ID where the entity is stored (if multiple databases are used)
|
|
370
370
|
*/
|
|
371
371
|
databaseId;
|
|
372
|
-
|
|
372
|
+
/**
|
|
373
|
+
* `path` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
374
|
+
*
|
|
375
|
+
* `path` is a single flattened string, so a parent entity id containing "/" cannot be
|
|
376
|
+
* recovered from it. This keeps each segment whole.
|
|
377
|
+
*
|
|
378
|
+
* Optional, and never derived by splitting `path` — a guess would be wrong in exactly
|
|
379
|
+
* the case the field exists for. Absent means "not known here", not "no slashes".
|
|
380
|
+
*/
|
|
381
|
+
pathSegments;
|
|
382
|
+
constructor(id, path, databaseId, pathSegments) {
|
|
373
383
|
this.id = id;
|
|
374
384
|
this.path = path;
|
|
375
385
|
this.databaseId = databaseId;
|
|
386
|
+
this.pathSegments = pathSegments;
|
|
376
387
|
}
|
|
377
388
|
get pathWithId() {
|
|
378
389
|
return `${this.path}/${this.id}`;
|
|
@@ -743,7 +754,7 @@ function getReferenceFrom(entity) {
|
|
|
743
754
|
if (!entity) {
|
|
744
755
|
throw new Error("getReferenceFrom: entity is null or undefined");
|
|
745
756
|
}
|
|
746
|
-
return new EntityReference(entity.id, entity.path, entity.databaseId);
|
|
757
|
+
return new EntityReference(entity.id, entity.path, entity.databaseId, entity.pathSegments);
|
|
747
758
|
}
|
|
748
759
|
function traverseValuesProperties(inputValues, properties, operation) {
|
|
749
760
|
const safeInputValues = inputValues ?? {};
|
|
@@ -4636,9 +4647,10 @@ const useFireCMSContext = () => {
|
|
|
4636
4647
|
return fireCMSContextRef.current;
|
|
4637
4648
|
};
|
|
4638
4649
|
function useCollectionFetch(t0) {
|
|
4639
|
-
const $ = c(
|
|
4650
|
+
const $ = c(27);
|
|
4640
4651
|
const {
|
|
4641
4652
|
path: inputPath,
|
|
4653
|
+
pathSegments,
|
|
4642
4654
|
collection,
|
|
4643
4655
|
filterValues,
|
|
4644
4656
|
sortBy,
|
|
@@ -4672,10 +4684,16 @@ function useCollectionFetch(t0) {
|
|
|
4672
4684
|
const [dataLoadingError, setDataLoadingError] = useState();
|
|
4673
4685
|
const [noMoreToLoad, setNoMoreToLoad] = useState(false);
|
|
4674
4686
|
let t3;
|
|
4675
|
-
if ($[4] !== collection || $[5] !== context || $[6] !== currentSort || $[7] !== dataSource || $[8] !== filterValues || $[9] !== itemCount || $[10] !== path || $[11] !==
|
|
4687
|
+
if ($[4] !== collection || $[5] !== context || $[6] !== currentSort || $[7] !== dataSource || $[8] !== filterValues || $[9] !== itemCount || $[10] !== path || $[11] !== pathSegments || $[12] !== searchString || $[13] !== sortByProperty) {
|
|
4676
4688
|
t3 = () => {
|
|
4677
4689
|
setDataLoading(true);
|
|
4678
4690
|
const onEntitiesUpdate = async (entities) => {
|
|
4691
|
+
if (pathSegments) {
|
|
4692
|
+
entities = entities.map((e) => e.pathSegments ? e : {
|
|
4693
|
+
...e,
|
|
4694
|
+
pathSegments
|
|
4695
|
+
});
|
|
4696
|
+
}
|
|
4679
4697
|
if (collection.callbacks?.onFetch) {
|
|
4680
4698
|
try {
|
|
4681
4699
|
entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
|
|
@@ -4685,8 +4703,8 @@ function useCollectionFetch(t0) {
|
|
|
4685
4703
|
context
|
|
4686
4704
|
})));
|
|
4687
4705
|
} catch (t42) {
|
|
4688
|
-
const
|
|
4689
|
-
console.error(
|
|
4706
|
+
const e_0 = t42;
|
|
4707
|
+
console.error(e_0);
|
|
4690
4708
|
}
|
|
4691
4709
|
}
|
|
4692
4710
|
setDataLoading(false);
|
|
@@ -4703,6 +4721,7 @@ function useCollectionFetch(t0) {
|
|
|
4703
4721
|
if (dataSource.listenCollection) {
|
|
4704
4722
|
return dataSource.listenCollection({
|
|
4705
4723
|
path,
|
|
4724
|
+
pathSegments,
|
|
4706
4725
|
collection,
|
|
4707
4726
|
onUpdate: onEntitiesUpdate,
|
|
4708
4727
|
onError,
|
|
@@ -4716,6 +4735,7 @@ function useCollectionFetch(t0) {
|
|
|
4716
4735
|
} else {
|
|
4717
4736
|
dataSource.fetchCollection({
|
|
4718
4737
|
path,
|
|
4738
|
+
pathSegments,
|
|
4719
4739
|
collection,
|
|
4720
4740
|
searchString,
|
|
4721
4741
|
filter: filterValues,
|
|
@@ -4734,54 +4754,55 @@ function useCollectionFetch(t0) {
|
|
|
4734
4754
|
$[8] = filterValues;
|
|
4735
4755
|
$[9] = itemCount;
|
|
4736
4756
|
$[10] = path;
|
|
4737
|
-
$[11] =
|
|
4738
|
-
$[12] =
|
|
4739
|
-
$[13] =
|
|
4757
|
+
$[11] = pathSegments;
|
|
4758
|
+
$[12] = searchString;
|
|
4759
|
+
$[13] = sortByProperty;
|
|
4760
|
+
$[14] = t3;
|
|
4740
4761
|
} else {
|
|
4741
|
-
t3 = $[
|
|
4762
|
+
t3 = $[14];
|
|
4742
4763
|
}
|
|
4743
4764
|
let t4;
|
|
4744
|
-
if ($[
|
|
4765
|
+
if ($[15] !== currentSort || $[16] !== filterValues || $[17] !== itemCount || $[18] !== path || $[19] !== searchString || $[20] !== sortByProperty) {
|
|
4745
4766
|
t4 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
|
|
4746
|
-
$[
|
|
4747
|
-
$[
|
|
4748
|
-
$[
|
|
4749
|
-
$[
|
|
4750
|
-
$[
|
|
4751
|
-
$[
|
|
4752
|
-
$[
|
|
4767
|
+
$[15] = currentSort;
|
|
4768
|
+
$[16] = filterValues;
|
|
4769
|
+
$[17] = itemCount;
|
|
4770
|
+
$[18] = path;
|
|
4771
|
+
$[19] = searchString;
|
|
4772
|
+
$[20] = sortByProperty;
|
|
4773
|
+
$[21] = t4;
|
|
4753
4774
|
} else {
|
|
4754
|
-
t4 = $[
|
|
4775
|
+
t4 = $[21];
|
|
4755
4776
|
}
|
|
4756
4777
|
useEffect(t3, t4);
|
|
4757
4778
|
let t5;
|
|
4758
|
-
if ($[
|
|
4779
|
+
if ($[22] !== data || $[23] !== dataLoading || $[24] !== dataLoadingError || $[25] !== noMoreToLoad) {
|
|
4759
4780
|
t5 = {
|
|
4760
4781
|
data,
|
|
4761
4782
|
dataLoading,
|
|
4762
4783
|
dataLoadingError,
|
|
4763
4784
|
noMoreToLoad
|
|
4764
4785
|
};
|
|
4765
|
-
$[
|
|
4766
|
-
$[
|
|
4767
|
-
$[
|
|
4768
|
-
$[
|
|
4769
|
-
$[
|
|
4786
|
+
$[22] = data;
|
|
4787
|
+
$[23] = dataLoading;
|
|
4788
|
+
$[24] = dataLoadingError;
|
|
4789
|
+
$[25] = noMoreToLoad;
|
|
4790
|
+
$[26] = t5;
|
|
4770
4791
|
} else {
|
|
4771
|
-
t5 = $[
|
|
4792
|
+
t5 = $[26];
|
|
4772
4793
|
}
|
|
4773
4794
|
return t5;
|
|
4774
4795
|
}
|
|
4775
4796
|
function _temp2$f() {
|
|
4776
4797
|
}
|
|
4777
|
-
function _temp$D(
|
|
4798
|
+
function _temp$D(e_1) {
|
|
4778
4799
|
return {
|
|
4779
|
-
...
|
|
4800
|
+
...e_1
|
|
4780
4801
|
};
|
|
4781
4802
|
}
|
|
4782
4803
|
const CACHE = {};
|
|
4783
4804
|
function useEntityFetch(t0) {
|
|
4784
|
-
const $ = c(
|
|
4805
|
+
const $ = c(19);
|
|
4785
4806
|
const {
|
|
4786
4807
|
path: inputPath,
|
|
4787
4808
|
pathSegments: inputPathSegments,
|
|
@@ -4793,30 +4814,32 @@ function useEntityFetch(t0) {
|
|
|
4793
4814
|
const useCache = t1 === void 0 ? false : t1;
|
|
4794
4815
|
const dataSource = useDataSource();
|
|
4795
4816
|
const navigationController = useNavigationController();
|
|
4796
|
-
let path;
|
|
4797
4817
|
let t2;
|
|
4798
|
-
if ($[0] !== inputPath || $[1] !==
|
|
4799
|
-
|
|
4800
|
-
t2 = inputPathSegments ?? path.split("/");
|
|
4818
|
+
if ($[0] !== inputPath || $[1] !== navigationController) {
|
|
4819
|
+
t2 = navigationController.resolveIdsFrom(inputPath);
|
|
4801
4820
|
$[0] = inputPath;
|
|
4802
|
-
$[1] =
|
|
4803
|
-
$[2] =
|
|
4804
|
-
$[3] = path;
|
|
4805
|
-
$[4] = t2;
|
|
4821
|
+
$[1] = navigationController;
|
|
4822
|
+
$[2] = t2;
|
|
4806
4823
|
} else {
|
|
4807
|
-
|
|
4808
|
-
t2 = $[4];
|
|
4824
|
+
t2 = $[2];
|
|
4809
4825
|
}
|
|
4810
|
-
const
|
|
4826
|
+
const path = t2;
|
|
4827
|
+
const pathSegments = inputPathSegments;
|
|
4811
4828
|
const context = useFireCMSContext();
|
|
4812
4829
|
const [entity, setEntity] = useState();
|
|
4813
4830
|
const [dataLoading, setDataLoading] = useState(true);
|
|
4814
4831
|
const [dataLoadingError, setDataLoadingError] = useState();
|
|
4815
4832
|
let t3;
|
|
4816
|
-
if ($[
|
|
4833
|
+
if ($[3] !== collection || $[4] !== context || $[5] !== dataSource || $[6] !== databaseId || $[7] !== entityId || $[8] !== path || $[9] !== pathSegments || $[10] !== useCache) {
|
|
4817
4834
|
t3 = () => {
|
|
4818
4835
|
setDataLoading(true);
|
|
4819
4836
|
const onEntityUpdate = async (updatedEntity) => {
|
|
4837
|
+
if (updatedEntity && pathSegments && !updatedEntity.pathSegments) {
|
|
4838
|
+
updatedEntity = {
|
|
4839
|
+
...updatedEntity,
|
|
4840
|
+
pathSegments
|
|
4841
|
+
};
|
|
4842
|
+
}
|
|
4820
4843
|
if (collection.callbacks?.onFetch && updatedEntity) {
|
|
4821
4844
|
try {
|
|
4822
4845
|
updatedEntity = await collection.callbacks.onFetch({
|
|
@@ -4874,41 +4897,41 @@ function useEntityFetch(t0) {
|
|
|
4874
4897
|
}
|
|
4875
4898
|
}
|
|
4876
4899
|
};
|
|
4877
|
-
$[
|
|
4878
|
-
$[
|
|
4879
|
-
$[
|
|
4880
|
-
$[
|
|
4881
|
-
$[
|
|
4882
|
-
$[
|
|
4883
|
-
$[
|
|
4884
|
-
$[
|
|
4885
|
-
$[
|
|
4900
|
+
$[3] = collection;
|
|
4901
|
+
$[4] = context;
|
|
4902
|
+
$[5] = dataSource;
|
|
4903
|
+
$[6] = databaseId;
|
|
4904
|
+
$[7] = entityId;
|
|
4905
|
+
$[8] = path;
|
|
4906
|
+
$[9] = pathSegments;
|
|
4907
|
+
$[10] = useCache;
|
|
4908
|
+
$[11] = t3;
|
|
4886
4909
|
} else {
|
|
4887
|
-
t3 = $[
|
|
4910
|
+
t3 = $[11];
|
|
4888
4911
|
}
|
|
4889
4912
|
let t4;
|
|
4890
|
-
if ($[
|
|
4913
|
+
if ($[12] !== entityId || $[13] !== path) {
|
|
4891
4914
|
t4 = [entityId, path];
|
|
4892
|
-
$[
|
|
4893
|
-
$[
|
|
4894
|
-
$[
|
|
4915
|
+
$[12] = entityId;
|
|
4916
|
+
$[13] = path;
|
|
4917
|
+
$[14] = t4;
|
|
4895
4918
|
} else {
|
|
4896
|
-
t4 = $[
|
|
4919
|
+
t4 = $[14];
|
|
4897
4920
|
}
|
|
4898
4921
|
useEffect(t3, t4);
|
|
4899
4922
|
let t5;
|
|
4900
|
-
if ($[
|
|
4923
|
+
if ($[15] !== dataLoading || $[16] !== dataLoadingError || $[17] !== entity) {
|
|
4901
4924
|
t5 = {
|
|
4902
4925
|
entity,
|
|
4903
4926
|
dataLoading,
|
|
4904
4927
|
dataLoadingError
|
|
4905
4928
|
};
|
|
4906
|
-
$[
|
|
4907
|
-
$[
|
|
4908
|
-
$[
|
|
4909
|
-
$[
|
|
4929
|
+
$[15] = dataLoading;
|
|
4930
|
+
$[16] = dataLoadingError;
|
|
4931
|
+
$[17] = entity;
|
|
4932
|
+
$[18] = t5;
|
|
4910
4933
|
} else {
|
|
4911
|
-
t5 = $[
|
|
4934
|
+
t5 = $[18];
|
|
4912
4935
|
}
|
|
4913
4936
|
return t5;
|
|
4914
4937
|
}
|
|
@@ -4971,7 +4994,7 @@ async function saveEntityWithCallbacks({
|
|
|
4971
4994
|
return dataSource.saveEntity({
|
|
4972
4995
|
collection,
|
|
4973
4996
|
path: resolvedPath,
|
|
4974
|
-
pathSegments
|
|
4997
|
+
pathSegments,
|
|
4975
4998
|
entityId,
|
|
4976
4999
|
values: updatedValues,
|
|
4977
5000
|
previousValues,
|
|
@@ -5055,6 +5078,8 @@ async function deleteEntityWithCallbacks({
|
|
|
5055
5078
|
}
|
|
5056
5079
|
}
|
|
5057
5080
|
return dataSource.deleteEntity({
|
|
5081
|
+
// Carried by the entity from the fetch that produced it; undefined if unknown.
|
|
5082
|
+
pathSegments: entity.pathSegments,
|
|
5058
5083
|
entity,
|
|
5059
5084
|
collection
|
|
5060
5085
|
}).then(() => {
|
|
@@ -5096,6 +5121,8 @@ function resolveNavigationFrom({
|
|
|
5096
5121
|
}
|
|
5097
5122
|
return dataSource.fetchEntity({
|
|
5098
5123
|
path: entry.path,
|
|
5124
|
+
// The navigation entry already knows the real segment boundaries.
|
|
5125
|
+
pathSegments: entry.pathSegments,
|
|
5099
5126
|
entityId: entry.entityId,
|
|
5100
5127
|
collection
|
|
5101
5128
|
}).then((entity) => {
|
|
@@ -16742,6 +16769,7 @@ function getChanges(source, comparison) {
|
|
|
16742
16769
|
}
|
|
16743
16770
|
function EntityForm({
|
|
16744
16771
|
path,
|
|
16772
|
+
pathSegments,
|
|
16745
16773
|
fullIdPath,
|
|
16746
16774
|
entityId: entityIdProp,
|
|
16747
16775
|
collection,
|
|
@@ -16808,7 +16836,7 @@ function EntityForm({
|
|
|
16808
16836
|
if (mustSetCustomId) {
|
|
16809
16837
|
return void 0;
|
|
16810
16838
|
} else {
|
|
16811
|
-
return dataSource.generateEntityId(path, collection);
|
|
16839
|
+
return dataSource.generateEntityId(path, collection, pathSegments);
|
|
16812
16840
|
}
|
|
16813
16841
|
} else {
|
|
16814
16842
|
return entityIdProp;
|
|
@@ -17121,7 +17149,7 @@ function EntityForm({
|
|
|
17121
17149
|
const uniqueFieldValidator = useCallback(({
|
|
17122
17150
|
name,
|
|
17123
17151
|
value
|
|
17124
|
-
}) => dataSource.checkUniqueField(path, name, value, entityId, collection), [dataSource, path, entityId]);
|
|
17152
|
+
}) => dataSource.checkUniqueField(path, name, value, entityId, collection, pathSegments), [dataSource, path, entityId]);
|
|
17125
17153
|
const validationSchema = useMemo(() => entityId ? getYupEntitySchema(entityId, resolvedCollection.properties, uniqueFieldValidator) : void 0, [entityId, resolvedCollection.properties, uniqueFieldValidator]);
|
|
17126
17154
|
useOnAutoSave(autoSave, formex, lastSavedValues, save);
|
|
17127
17155
|
const prevEntityValuesRef = useRef(entity?.values);
|
|
@@ -20089,7 +20117,7 @@ function useDataSourceTableController({
|
|
|
20089
20117
|
const navigation = useNavigationController();
|
|
20090
20118
|
const dataSource = useDataSource();
|
|
20091
20119
|
const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
20092
|
-
const resolvedPathSegments =
|
|
20120
|
+
const resolvedPathSegments = pathSegments;
|
|
20093
20121
|
const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
|
|
20094
20122
|
const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
|
|
20095
20123
|
const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE$1;
|
|
@@ -20097,6 +20125,7 @@ function useDataSourceTableController({
|
|
|
20097
20125
|
if (!dataSource.isFilterCombinationValid) return true;
|
|
20098
20126
|
return dataSource.isFilterCombinationValid({
|
|
20099
20127
|
path: resolvedPath,
|
|
20128
|
+
pathSegments: resolvedPathSegments,
|
|
20100
20129
|
collection,
|
|
20101
20130
|
filterValues,
|
|
20102
20131
|
sortBy
|
|
@@ -20185,6 +20214,12 @@ function useDataSourceTableController({
|
|
|
20185
20214
|
useEffect(() => {
|
|
20186
20215
|
setDataLoading(true);
|
|
20187
20216
|
const onEntitiesUpdate = async (entities) => {
|
|
20217
|
+
if (resolvedPathSegments) {
|
|
20218
|
+
entities = entities.map((e) => e.pathSegments ? e : {
|
|
20219
|
+
...e,
|
|
20220
|
+
pathSegments: resolvedPathSegments
|
|
20221
|
+
});
|
|
20222
|
+
}
|
|
20188
20223
|
if (collection.callbacks?.onFetch) {
|
|
20189
20224
|
try {
|
|
20190
20225
|
entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
|
|
@@ -20193,14 +20228,14 @@ function useDataSourceTableController({
|
|
|
20193
20228
|
entity,
|
|
20194
20229
|
context
|
|
20195
20230
|
})));
|
|
20196
|
-
} catch (
|
|
20197
|
-
console.error(
|
|
20231
|
+
} catch (e_0) {
|
|
20232
|
+
console.error(e_0);
|
|
20198
20233
|
}
|
|
20199
20234
|
}
|
|
20200
20235
|
setDataLoading(false);
|
|
20201
20236
|
setDataLoadingError(void 0);
|
|
20202
|
-
setRawData(entities.map((
|
|
20203
|
-
...
|
|
20237
|
+
setRawData(entities.map((e_1) => ({
|
|
20238
|
+
...e_1
|
|
20204
20239
|
// values: sanitizeData(e.values, resolvedCollection.properties)
|
|
20205
20240
|
})));
|
|
20206
20241
|
setNoMoreToLoad(!itemCount || entities.length < itemCount);
|
|
@@ -20241,8 +20276,8 @@ function useDataSourceTableController({
|
|
|
20241
20276
|
return () => {
|
|
20242
20277
|
};
|
|
20243
20278
|
}
|
|
20244
|
-
} catch (
|
|
20245
|
-
onError(
|
|
20279
|
+
} catch (e_2) {
|
|
20280
|
+
onError(e_2 instanceof Error ? e_2 : new Error(String(e_2)));
|
|
20246
20281
|
return () => {
|
|
20247
20282
|
};
|
|
20248
20283
|
}
|
|
@@ -20754,6 +20789,7 @@ function ReferenceSelectionTable({
|
|
|
20754
20789
|
multiselect,
|
|
20755
20790
|
collection,
|
|
20756
20791
|
path: pathInput,
|
|
20792
|
+
pathSegments,
|
|
20757
20793
|
selectedEntityIds: selectedEntityIdsProp,
|
|
20758
20794
|
description,
|
|
20759
20795
|
forceFilter,
|
|
@@ -20796,6 +20832,7 @@ function ReferenceSelectionTable({
|
|
|
20796
20832
|
if (selectedEntityIds && collection) {
|
|
20797
20833
|
Promise.all(selectedEntityIds.map((entityId) => dataSource.fetchEntity({
|
|
20798
20834
|
path: fullPath,
|
|
20835
|
+
pathSegments,
|
|
20799
20836
|
entityId,
|
|
20800
20837
|
collection
|
|
20801
20838
|
}))).then((entities) => {
|
|
@@ -24394,6 +24431,7 @@ const EntityBoardCard = memo(EntityBoardCardInner);
|
|
|
24394
24431
|
const DEFAULT_PAGE_SIZE = 20;
|
|
24395
24432
|
function useBoardDataController({
|
|
24396
24433
|
fullPath,
|
|
24434
|
+
pathSegments,
|
|
24397
24435
|
collection,
|
|
24398
24436
|
columnProperty,
|
|
24399
24437
|
columns,
|
|
@@ -24406,6 +24444,7 @@ function useBoardDataController({
|
|
|
24406
24444
|
const dataSource = useDataSource();
|
|
24407
24445
|
const navigation = useNavigationController();
|
|
24408
24446
|
const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
24447
|
+
const resolvedPathSegments = pathSegments;
|
|
24409
24448
|
const dataSourceRef = useRef(dataSource);
|
|
24410
24449
|
const collectionRef = useRef(collection);
|
|
24411
24450
|
const contextRef = useRef(context);
|
|
@@ -24417,11 +24456,13 @@ function useBoardDataController({
|
|
|
24417
24456
|
const orderPropertyRef = useRef(orderProperty);
|
|
24418
24457
|
const searchStringRef = useRef(searchString);
|
|
24419
24458
|
const resolvedPathRef = useRef(resolvedPath);
|
|
24459
|
+
const resolvedPathSegmentsRef = useRef(resolvedPathSegments);
|
|
24420
24460
|
filterValuesRef.current = filterValues;
|
|
24421
24461
|
columnPropertyRef.current = columnProperty;
|
|
24422
24462
|
orderPropertyRef.current = orderProperty;
|
|
24423
24463
|
searchStringRef.current = searchString;
|
|
24424
24464
|
resolvedPathRef.current = resolvedPath;
|
|
24465
|
+
resolvedPathSegmentsRef.current = resolvedPathSegments;
|
|
24425
24466
|
const [columnItemCounts, setColumnItemCounts] = useState(() => {
|
|
24426
24467
|
const initial = {};
|
|
24427
24468
|
columns.forEach((col) => {
|
|
@@ -24468,6 +24509,7 @@ function useBoardDataController({
|
|
|
24468
24509
|
const currentOrderProperty = orderPropertyRef.current;
|
|
24469
24510
|
const currentSearchString = searchStringRef.current;
|
|
24470
24511
|
const currentResolvedPath = resolvedPathRef.current;
|
|
24512
|
+
const currentPathSegments = resolvedPathSegmentsRef.current;
|
|
24471
24513
|
const columnFilter = {
|
|
24472
24514
|
...currentFilterValues,
|
|
24473
24515
|
[currentColumnProperty]: ["==", column]
|
|
@@ -24524,6 +24566,7 @@ function useBoardDataController({
|
|
|
24524
24566
|
if (currentDataSource.listenCollection) {
|
|
24525
24567
|
const unsubscribe = currentDataSource.listenCollection({
|
|
24526
24568
|
path: currentResolvedPath,
|
|
24569
|
+
pathSegments: currentPathSegments,
|
|
24527
24570
|
collection: currentCollection,
|
|
24528
24571
|
onUpdate,
|
|
24529
24572
|
onError,
|
|
@@ -24538,6 +24581,7 @@ function useBoardDataController({
|
|
|
24538
24581
|
} else {
|
|
24539
24582
|
currentDataSource.fetchCollection({
|
|
24540
24583
|
path: currentResolvedPath,
|
|
24584
|
+
pathSegments: currentPathSegments,
|
|
24541
24585
|
collection: currentCollection,
|
|
24542
24586
|
searchString: currentSearchString,
|
|
24543
24587
|
filter: columnFilter,
|
|
@@ -24566,6 +24610,7 @@ function useBoardDataController({
|
|
|
24566
24610
|
const currentColumnProperty = columnPropertyRef.current;
|
|
24567
24611
|
const currentSearchString = searchStringRef.current;
|
|
24568
24612
|
const currentResolvedPath = resolvedPathRef.current;
|
|
24613
|
+
const currentPathSegments = resolvedPathSegmentsRef.current;
|
|
24569
24614
|
const currentColumns = columns;
|
|
24570
24615
|
const currentColumnItemCounts = columnItemCounts;
|
|
24571
24616
|
const timeoutId = setTimeout(() => {
|
|
@@ -24580,6 +24625,7 @@ function useBoardDataController({
|
|
|
24580
24625
|
};
|
|
24581
24626
|
currentDataSource.countEntities({
|
|
24582
24627
|
path: currentResolvedPath,
|
|
24628
|
+
pathSegments: currentPathSegments,
|
|
24583
24629
|
collection: currentCollection,
|
|
24584
24630
|
filter: columnFilter,
|
|
24585
24631
|
searchString: currentSearchString
|
|
@@ -24824,6 +24870,7 @@ function EntityCollectionBoardView({
|
|
|
24824
24870
|
collection,
|
|
24825
24871
|
tableController,
|
|
24826
24872
|
fullPath,
|
|
24873
|
+
pathSegments,
|
|
24827
24874
|
parentCollectionIds = [],
|
|
24828
24875
|
columnProperty,
|
|
24829
24876
|
onEntityClick,
|
|
@@ -24917,6 +24964,7 @@ function EntityCollectionBoardView({
|
|
|
24917
24964
|
const columns = localColumnsOrder;
|
|
24918
24965
|
const boardDataController = useBoardDataController({
|
|
24919
24966
|
fullPath,
|
|
24967
|
+
pathSegments,
|
|
24920
24968
|
collection,
|
|
24921
24969
|
columnProperty,
|
|
24922
24970
|
columns,
|
|
@@ -25462,7 +25510,7 @@ function PopupFormField(props) {
|
|
|
25462
25510
|
return t0;
|
|
25463
25511
|
}
|
|
25464
25512
|
function PopupFormFieldLoading(t0) {
|
|
25465
|
-
const $ = c(
|
|
25513
|
+
const $ = c(22);
|
|
25466
25514
|
const {
|
|
25467
25515
|
tableKey,
|
|
25468
25516
|
entityId,
|
|
@@ -25470,6 +25518,7 @@ function PopupFormFieldLoading(t0) {
|
|
|
25470
25518
|
propertyKey,
|
|
25471
25519
|
collection: inputCollection,
|
|
25472
25520
|
path,
|
|
25521
|
+
pathSegments,
|
|
25473
25522
|
cellRect,
|
|
25474
25523
|
open,
|
|
25475
25524
|
onClose,
|
|
@@ -25480,33 +25529,35 @@ function PopupFormFieldLoading(t0) {
|
|
|
25480
25529
|
const [entity, setEntity] = useState(void 0);
|
|
25481
25530
|
let t1;
|
|
25482
25531
|
let t2;
|
|
25483
|
-
if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path) {
|
|
25532
|
+
if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path || $[4] !== pathSegments) {
|
|
25484
25533
|
t1 = () => {
|
|
25485
25534
|
if (entityId && inputCollection) {
|
|
25486
25535
|
dataSource.fetchEntity({
|
|
25487
25536
|
path,
|
|
25537
|
+
pathSegments,
|
|
25488
25538
|
entityId,
|
|
25489
25539
|
collection: inputCollection
|
|
25490
25540
|
}).then(setEntity);
|
|
25491
25541
|
}
|
|
25492
25542
|
};
|
|
25493
|
-
t2 = [entityId, inputCollection, dataSource, path];
|
|
25543
|
+
t2 = [entityId, inputCollection, dataSource, path, pathSegments];
|
|
25494
25544
|
$[0] = dataSource;
|
|
25495
25545
|
$[1] = entityId;
|
|
25496
25546
|
$[2] = inputCollection;
|
|
25497
25547
|
$[3] = path;
|
|
25498
|
-
$[4] =
|
|
25499
|
-
$[5] =
|
|
25548
|
+
$[4] = pathSegments;
|
|
25549
|
+
$[5] = t1;
|
|
25550
|
+
$[6] = t2;
|
|
25500
25551
|
} else {
|
|
25501
|
-
t1 = $[
|
|
25502
|
-
t2 = $[
|
|
25552
|
+
t1 = $[5];
|
|
25553
|
+
t2 = $[6];
|
|
25503
25554
|
}
|
|
25504
25555
|
useEffect(t1, t2);
|
|
25505
25556
|
if (!entity) {
|
|
25506
25557
|
return null;
|
|
25507
25558
|
}
|
|
25508
25559
|
let t3;
|
|
25509
|
-
if ($[
|
|
25560
|
+
if ($[7] !== cellRect || $[8] !== container || $[9] !== customFieldValidator || $[10] !== entityId || $[11] !== inputCollection || $[12] !== onCellValueChange || $[13] !== onClose || $[14] !== open || $[15] !== path || $[16] !== propertyKey || $[17] !== tableKey) {
|
|
25510
25561
|
t3 = {
|
|
25511
25562
|
tableKey,
|
|
25512
25563
|
entityId,
|
|
@@ -25520,29 +25571,29 @@ function PopupFormFieldLoading(t0) {
|
|
|
25520
25571
|
onCellValueChange,
|
|
25521
25572
|
container
|
|
25522
25573
|
};
|
|
25523
|
-
$[
|
|
25524
|
-
$[
|
|
25525
|
-
$[
|
|
25526
|
-
$[
|
|
25527
|
-
$[
|
|
25528
|
-
$[
|
|
25529
|
-
$[
|
|
25530
|
-
$[
|
|
25531
|
-
$[
|
|
25532
|
-
$[
|
|
25533
|
-
$[
|
|
25534
|
-
$[
|
|
25574
|
+
$[7] = cellRect;
|
|
25575
|
+
$[8] = container;
|
|
25576
|
+
$[9] = customFieldValidator;
|
|
25577
|
+
$[10] = entityId;
|
|
25578
|
+
$[11] = inputCollection;
|
|
25579
|
+
$[12] = onCellValueChange;
|
|
25580
|
+
$[13] = onClose;
|
|
25581
|
+
$[14] = open;
|
|
25582
|
+
$[15] = path;
|
|
25583
|
+
$[16] = propertyKey;
|
|
25584
|
+
$[17] = tableKey;
|
|
25585
|
+
$[18] = t3;
|
|
25535
25586
|
} else {
|
|
25536
|
-
t3 = $[
|
|
25587
|
+
t3 = $[18];
|
|
25537
25588
|
}
|
|
25538
25589
|
let t4;
|
|
25539
|
-
if ($[
|
|
25590
|
+
if ($[19] !== entity || $[20] !== t3) {
|
|
25540
25591
|
t4 = /* @__PURE__ */ jsx(PopupFormFieldInternal, { ...t3, entity });
|
|
25541
|
-
$[
|
|
25542
|
-
$[
|
|
25543
|
-
$[
|
|
25592
|
+
$[19] = entity;
|
|
25593
|
+
$[20] = t3;
|
|
25594
|
+
$[21] = t4;
|
|
25544
25595
|
} else {
|
|
25545
|
-
t4 = $[
|
|
25596
|
+
t4 = $[21];
|
|
25546
25597
|
}
|
|
25547
25598
|
return t4;
|
|
25548
25599
|
}
|
|
@@ -26582,7 +26633,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
|
|
|
26582
26633
|
breadcrumbs.updateCount(fullPath, docsCount);
|
|
26583
26634
|
}
|
|
26584
26635
|
}, [docsCount, fullPath, breadcrumbs.updateCount]);
|
|
26585
|
-
const countFetcher = /* @__PURE__ */ jsx(EntitiesCount, { fullPath, collection, filter: tableController.filterValues, sortBy: tableController.sortBy, onCountChange: setDocsCount });
|
|
26636
|
+
const countFetcher = /* @__PURE__ */ jsx(EntitiesCount, { fullPath, pathSegments, collection, filter: tableController.filterValues, sortBy: tableController.sortBy, onCountChange: setDocsCount });
|
|
26586
26637
|
const buildAdditionalHeaderWidget = useCallback(({
|
|
26587
26638
|
property: property_2,
|
|
26588
26639
|
propertyKey: propertyKey_1,
|
|
@@ -26629,7 +26680,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
|
|
|
26629
26680
|
return /* @__PURE__ */ jsxs("div", { className: cls("overflow-hidden h-full w-full rounded-md flex flex-col", className), ref: containerRef, children: [
|
|
26630
26681
|
countFetcher,
|
|
26631
26682
|
/* @__PURE__ */ jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, initialSearchString: tableController.searchString, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
|
|
26632
|
-
tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsx(EntityCollectionBoardView, { collection, tableController, fullPath, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
26683
|
+
tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsx(EntityCollectionBoardView, { collection, tableController, fullPath, pathSegments, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
26633
26684
|
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("so_empty") }),
|
|
26634
26685
|
/* @__PURE__ */ jsxs(Button, { onClick: onNewClick, className: "mt-4", children: [
|
|
26635
26686
|
/* @__PURE__ */ jsx(AddIcon, {}),
|
|
@@ -26666,7 +26717,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
|
|
|
26666
26717
|
});
|
|
26667
26718
|
}
|
|
26668
26719
|
} }, `collection_table_${fullPath}`),
|
|
26669
|
-
popupCell && /* @__PURE__ */ jsx(PopupFormField, { open: Boolean(popupCell), onClose: onPopupClose, cellRect: popupCell?.cellRect, propertyKey: popupCell?.propertyKey, collection, entityId: popupCell.entityId, tableKey: tableKey.current, customFieldValidator: uniqueFieldValidator, path: resolvedFullPath, onCellValueChange: onValueChange, container: containerRef.current }, `popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`),
|
|
26720
|
+
popupCell && /* @__PURE__ */ jsx(PopupFormField, { pathSegments, open: Boolean(popupCell), onClose: onPopupClose, cellRect: popupCell?.cellRect, propertyKey: popupCell?.propertyKey, collection, entityId: popupCell.entityId, tableKey: tableKey.current, customFieldValidator: uniqueFieldValidator, path: resolvedFullPath, onCellValueChange: onValueChange, container: containerRef.current }, `popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`),
|
|
26670
26721
|
deleteEntityClicked && /* @__PURE__ */ jsx(DeleteEntityDialog, { entityOrEntitiesToDelete: deleteEntityClicked, path: fullPath, collection, callbacks: collection.callbacks, open: Boolean(deleteEntityClicked), onEntityDelete: internalOnEntityDelete, onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete, onClose: () => setDeleteEntityClicked(void 0) })
|
|
26671
26722
|
] });
|
|
26672
26723
|
}, (a, b) => {
|
|
@@ -26677,7 +26728,8 @@ function EntitiesCount({
|
|
|
26677
26728
|
collection,
|
|
26678
26729
|
filter,
|
|
26679
26730
|
sortBy,
|
|
26680
|
-
onCountChange
|
|
26731
|
+
onCountChange,
|
|
26732
|
+
pathSegments
|
|
26681
26733
|
}) {
|
|
26682
26734
|
const dataSource = useDataSource();
|
|
26683
26735
|
const navigation = useNavigationController();
|
|
@@ -26686,15 +26738,17 @@ function EntitiesCount({
|
|
|
26686
26738
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
26687
26739
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
26688
26740
|
const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
26741
|
+
const resolvedPathSegments = pathSegments;
|
|
26689
26742
|
useEffect(() => {
|
|
26690
26743
|
if (dataSource.countEntities) dataSource.countEntities({
|
|
26691
26744
|
path: resolvedPath,
|
|
26745
|
+
pathSegments: resolvedPathSegments,
|
|
26692
26746
|
collection,
|
|
26693
26747
|
filter,
|
|
26694
26748
|
orderBy: sortByProperty,
|
|
26695
26749
|
order: currentSort
|
|
26696
26750
|
}).then(setCount).catch(setError);
|
|
26697
|
-
}, [fullPath, dataSource.countEntities, resolvedPath, collection, filter, sortByProperty, currentSort]);
|
|
26751
|
+
}, [fullPath, dataSource.countEntities, resolvedPath, resolvedPathSegments, collection, filter, sortByProperty, currentSort]);
|
|
26698
26752
|
useEffect(() => {
|
|
26699
26753
|
if (onCountChange && count !== void 0) {
|
|
26700
26754
|
setError(void 0);
|
|
@@ -28482,7 +28536,8 @@ function getParentReferencesFromPath(props) {
|
|
|
28482
28536
|
const {
|
|
28483
28537
|
path,
|
|
28484
28538
|
collections = [],
|
|
28485
|
-
currentFullPath
|
|
28539
|
+
currentFullPath,
|
|
28540
|
+
currentPathSegments = []
|
|
28486
28541
|
} = props;
|
|
28487
28542
|
const subpaths = removeInitialAndTrailingSlashes(path).split("/");
|
|
28488
28543
|
const subpathCombinations = getCollectionPathsCombinations(subpaths);
|
|
@@ -28492,12 +28547,14 @@ function getParentReferencesFromPath(props) {
|
|
|
28492
28547
|
const collection = collections && collections.find((entry) => entry.id === subpathCombination || entry.path === subpathCombination);
|
|
28493
28548
|
if (collection) {
|
|
28494
28549
|
const collectionPath = currentFullPath && currentFullPath.length > 0 ? currentFullPath + "/" + collection.path : collection.path;
|
|
28550
|
+
const collectionSegments = [...currentPathSegments, ...collection.path.split("/")];
|
|
28495
28551
|
const restOfThePath = removeInitialAndTrailingSlashes(removeInitialAndTrailingSlashes(path).replace(subpathCombination, ""));
|
|
28496
28552
|
const nextSegments = restOfThePath.length > 0 ? restOfThePath.split("/") : [];
|
|
28497
28553
|
if (nextSegments.length > 0) {
|
|
28498
28554
|
const entityId = decodeEntityId(nextSegments[0]);
|
|
28499
28555
|
const fullPath = collectionPath + "/" + entityId;
|
|
28500
|
-
|
|
28556
|
+
const entitySegments = [...collectionSegments, entityId];
|
|
28557
|
+
result.push(new EntityReference(entityId, collectionPath, void 0, collectionSegments));
|
|
28501
28558
|
if (nextSegments.length > 1) {
|
|
28502
28559
|
const newPath = nextSegments.slice(1).join("/");
|
|
28503
28560
|
if (!collection) {
|
|
@@ -28507,7 +28564,8 @@ function getParentReferencesFromPath(props) {
|
|
|
28507
28564
|
result.push(...getParentReferencesFromPath({
|
|
28508
28565
|
path: newPath,
|
|
28509
28566
|
collections: collection.subcollections,
|
|
28510
|
-
currentFullPath: fullPath
|
|
28567
|
+
currentFullPath: fullPath,
|
|
28568
|
+
currentPathSegments: entitySegments
|
|
28511
28569
|
}));
|
|
28512
28570
|
}
|
|
28513
28571
|
}
|
|
@@ -30307,7 +30365,7 @@ function EntityEditViewInner({
|
|
|
30307
30365
|
const subcollectionId = subcollection.id ?? subcollection.path;
|
|
30308
30366
|
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.path)}` : void 0;
|
|
30309
30367
|
const newFullIdPath = fullIdPath && usedEntity ? `${fullIdPath}/${encodeEntityId(usedEntity.id)}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
|
|
30310
|
-
const newPathSegments = usedEntity ? [...pathSegments
|
|
30368
|
+
const newPathSegments = usedEntity && pathSegments ? [...pathSegments, usedEntity.id, ...removeInitialAndTrailingSlashes(subcollection.path).split("/")] : void 0;
|
|
30311
30369
|
if (selectedTab !== subcollectionId) return null;
|
|
30312
30370
|
return /* @__PURE__ */ jsxs("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: [
|
|
30313
30371
|
globalLoading && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
@@ -30330,7 +30388,7 @@ function EntityEditViewInner({
|
|
|
30330
30388
|
/* @__PURE__ */ jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
|
|
30331
30389
|
/* @__PURE__ */ jsx("div", { className: "h-16" })
|
|
30332
30390
|
] }) }) : null;
|
|
30333
|
-
const entityView = /* @__PURE__ */ jsx(EntityForm, { fullIdPath, collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
|
|
30391
|
+
const entityView = /* @__PURE__ */ jsx(EntityForm, { fullIdPath, collection, path, pathSegments, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
|
|
30334
30392
|
setUsedEntity(entity_0);
|
|
30335
30393
|
formProps?.onEntityChange?.(entity_0);
|
|
30336
30394
|
}, onStatusChange: (status_0) => {
|
|
@@ -31039,11 +31097,14 @@ function useBuildDataSource({
|
|
|
31039
31097
|
*/
|
|
31040
31098
|
deleteEntity: useCallback(({
|
|
31041
31099
|
entity,
|
|
31100
|
+
pathSegments: pathSegments_4,
|
|
31042
31101
|
collection: collection_4
|
|
31043
31102
|
}) => {
|
|
31044
31103
|
const usedDelegate_4 = collection_4?.overrides?.dataSourceDelegate ?? delegate;
|
|
31045
31104
|
return usedDelegate_4.deleteEntity({
|
|
31046
31105
|
entity,
|
|
31106
|
+
// Falls back to what the entity carries from the fetch that produced it.
|
|
31107
|
+
pathSegments: pathSegments_4 ?? entity.pathSegments,
|
|
31047
31108
|
collection: collection_4
|
|
31048
31109
|
});
|
|
31049
31110
|
}, [delegate.deleteEntity]),
|
|
@@ -31057,16 +31118,17 @@ function useBuildDataSource({
|
|
|
31057
31118
|
* @return `true` if there are no other fields besides the given entity
|
|
31058
31119
|
* @group Firestore
|
|
31059
31120
|
*/
|
|
31060
|
-
checkUniqueField: useCallback((path_4, name, value, entityId_2, collection_5) => {
|
|
31121
|
+
checkUniqueField: useCallback((path_4, name, value, entityId_2, collection_5, pathSegments_5) => {
|
|
31061
31122
|
const usedDelegate_5 = collection_5?.overrides?.dataSourceDelegate ?? delegate;
|
|
31062
|
-
return usedDelegate_5.checkUniqueField(path_4, name, value, entityId_2, collection_5);
|
|
31123
|
+
return usedDelegate_5.checkUniqueField(path_4, name, value, entityId_2, collection_5, pathSegments_5);
|
|
31063
31124
|
}, [delegate.checkUniqueField]),
|
|
31064
|
-
generateEntityId: useCallback((path_5, collection_6) => {
|
|
31125
|
+
generateEntityId: useCallback((path_5, collection_6, pathSegments_6) => {
|
|
31065
31126
|
const usedDelegate_6 = collection_6?.overrides?.dataSourceDelegate ?? delegate;
|
|
31066
|
-
return usedDelegate_6.generateEntityId(path_5, collection_6);
|
|
31127
|
+
return usedDelegate_6.generateEntityId(path_5, collection_6, pathSegments_6);
|
|
31067
31128
|
}, [delegate.generateEntityId]),
|
|
31068
31129
|
countEntities: delegate.countEntities ? async ({
|
|
31069
31130
|
path: path_6,
|
|
31131
|
+
pathSegments: pathSegments_7,
|
|
31070
31132
|
collection: collection_7,
|
|
31071
31133
|
filter: filter_1,
|
|
31072
31134
|
order: order_1,
|
|
@@ -31075,6 +31137,7 @@ function useBuildDataSource({
|
|
|
31075
31137
|
const usedDelegate_7 = collection_7?.overrides?.dataSourceDelegate ?? delegate;
|
|
31076
31138
|
return usedDelegate_7.countEntities({
|
|
31077
31139
|
path: path_6,
|
|
31140
|
+
pathSegments: pathSegments_7,
|
|
31078
31141
|
filter: filter_1,
|
|
31079
31142
|
orderBy: orderBy_1,
|
|
31080
31143
|
order: order_1,
|
|
@@ -31083,6 +31146,7 @@ function useBuildDataSource({
|
|
|
31083
31146
|
} : void 0,
|
|
31084
31147
|
isFilterCombinationValid: useCallback(({
|
|
31085
31148
|
path: path_7,
|
|
31149
|
+
pathSegments: pathSegments_8,
|
|
31086
31150
|
databaseId,
|
|
31087
31151
|
filterValues,
|
|
31088
31152
|
sortBy
|
|
@@ -31090,6 +31154,7 @@ function useBuildDataSource({
|
|
|
31090
31154
|
if (!delegate.isFilterCombinationValid) return true;
|
|
31091
31155
|
return delegate.isFilterCombinationValid({
|
|
31092
31156
|
path: path_7,
|
|
31157
|
+
pathSegments: pathSegments_8,
|
|
31093
31158
|
databaseId,
|
|
31094
31159
|
filterValues,
|
|
31095
31160
|
sortBy
|