@firecms/core 3.0.0-canary.90 → 3.0.0-canary.92
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/common/useColumnsIds.d.ts +2 -1
- package/dist/index.es.js +79 -38
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +78 -37
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/components/common/useColumnsIds.tsx +13 -0
- package/src/core/EntityEditView.tsx +74 -45
- package/src/hooks/useBuildNavigationController.tsx +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -3982,7 +3982,7 @@
|
|
|
3982
3982
|
]
|
|
3983
3983
|
);
|
|
3984
3984
|
let shouldUpdateTopLevelNav = false;
|
|
3985
|
-
if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections)) {
|
|
3985
|
+
if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections) || resolvedCollections.length === 0) {
|
|
3986
3986
|
collectionsRef.current = resolvedCollections;
|
|
3987
3987
|
shouldUpdateTopLevelNav = true;
|
|
3988
3988
|
}
|
|
@@ -8537,6 +8537,18 @@
|
|
|
8537
8537
|
disabled: disabled || Boolean(property.disabled) || Boolean(property.readOnly)
|
|
8538
8538
|
}];
|
|
8539
8539
|
}
|
|
8540
|
+
function getFormFieldKeys(collection) {
|
|
8541
|
+
const propertyKeys = Object.keys(collection.properties);
|
|
8542
|
+
const additionalFields = collection.additionalFields ?? [];
|
|
8543
|
+
const allKeys = [
|
|
8544
|
+
...propertyKeys,
|
|
8545
|
+
...additionalFields.map((field) => field.key)
|
|
8546
|
+
];
|
|
8547
|
+
if (collection.propertiesOrder) {
|
|
8548
|
+
return collection.propertiesOrder.filter((key) => allKeys.includes(key));
|
|
8549
|
+
}
|
|
8550
|
+
return allKeys;
|
|
8551
|
+
}
|
|
8540
8552
|
function buildIdColumn(largeLayout) {
|
|
8541
8553
|
return {
|
|
8542
8554
|
key: "id_ewcfedcswdf3",
|
|
@@ -18165,46 +18177,74 @@
|
|
|
18165
18177
|
});
|
|
18166
18178
|
}
|
|
18167
18179
|
}, [formex$1.isSubmitting, autoSave, underlyingChanges, entity, formex$1.values, formex$1.touched, formex$1.setFieldValue]);
|
|
18168
|
-
const formFields = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (resolvedCollection
|
|
18180
|
+
const formFields = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: getFormFieldKeys(resolvedCollection).map((key) => {
|
|
18169
18181
|
const property = resolvedCollection.properties[key];
|
|
18170
|
-
if (
|
|
18171
|
-
|
|
18172
|
-
|
|
18182
|
+
if (property) {
|
|
18183
|
+
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key) && !!formex$1.touched[key];
|
|
18184
|
+
const disabled2 = !autoSave && formex$1.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
18185
|
+
const hidden = isHidden(property);
|
|
18186
|
+
if (hidden) return null;
|
|
18187
|
+
const cmsFormFieldProps = {
|
|
18188
|
+
propertyKey: key,
|
|
18189
|
+
disabled: disabled2,
|
|
18190
|
+
property,
|
|
18191
|
+
includeDescription: property.description || property.longDescription,
|
|
18192
|
+
underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
|
|
18193
|
+
context: formContext,
|
|
18194
|
+
tableMode: false,
|
|
18195
|
+
partOfArray: false,
|
|
18196
|
+
partOfBlock: false,
|
|
18197
|
+
autoFocus: false
|
|
18198
|
+
};
|
|
18199
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18200
|
+
"div",
|
|
18201
|
+
{
|
|
18202
|
+
id: `form_field_${key}`,
|
|
18203
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18204
|
+
ui.Tooltip,
|
|
18205
|
+
{
|
|
18206
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(PropertyIdCopyTooltipContent, { propertyId: key }),
|
|
18207
|
+
delayDuration: 800,
|
|
18208
|
+
side: "left",
|
|
18209
|
+
align: "start",
|
|
18210
|
+
sideOffset: 16,
|
|
18211
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...cmsFormFieldProps })
|
|
18212
|
+
}
|
|
18213
|
+
) })
|
|
18214
|
+
},
|
|
18215
|
+
`field_${resolvedCollection.name}_${key}`
|
|
18216
|
+
);
|
|
18173
18217
|
}
|
|
18174
|
-
const
|
|
18175
|
-
|
|
18176
|
-
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
partOfBlock: false,
|
|
18188
|
-
autoFocus: false
|
|
18189
|
-
};
|
|
18190
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18191
|
-
"div",
|
|
18192
|
-
{
|
|
18193
|
-
id: `form_field_${key}`,
|
|
18194
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18195
|
-
ui.Tooltip,
|
|
18218
|
+
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key);
|
|
18219
|
+
if (additionalField && entity) {
|
|
18220
|
+
const Builder = additionalField.Builder;
|
|
18221
|
+
if (!Builder && !additionalField.value) {
|
|
18222
|
+
throw new Error("When using additional fields you need to provide a Builder or a value");
|
|
18223
|
+
}
|
|
18224
|
+
const child = Builder ? /* @__PURE__ */ jsxRuntime.jsx(Builder, { entity, context }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: additionalField.value?.({
|
|
18225
|
+
entity,
|
|
18226
|
+
context
|
|
18227
|
+
}) });
|
|
18228
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18229
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18230
|
+
LabelWithIcon,
|
|
18196
18231
|
{
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
align: "start",
|
|
18201
|
-
sideOffset: 16,
|
|
18202
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...cmsFormFieldProps })
|
|
18232
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(ui.NotesIcon, { size: "small" }),
|
|
18233
|
+
title: additionalField.name,
|
|
18234
|
+
className: "text-text-secondary dark:text-text-secondary-dark ml-3.5"
|
|
18203
18235
|
}
|
|
18204
|
-
)
|
|
18205
|
-
|
|
18206
|
-
|
|
18207
|
-
|
|
18236
|
+
),
|
|
18237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18238
|
+
"div",
|
|
18239
|
+
{
|
|
18240
|
+
className: ui.cls(ui.paperMixin, "min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"),
|
|
18241
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: child })
|
|
18242
|
+
}
|
|
18243
|
+
)
|
|
18244
|
+
] });
|
|
18245
|
+
}
|
|
18246
|
+
console.warn(`Property ${key} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
|
|
18247
|
+
return null;
|
|
18208
18248
|
}).filter(Boolean) });
|
|
18209
18249
|
const disabled = formex$1.isSubmitting || !modified && status === "existing";
|
|
18210
18250
|
const formRef = React.useRef(null);
|
|
@@ -20113,6 +20153,7 @@
|
|
|
20113
20153
|
exports2.getEntityTitlePropertyKey = getEntityTitlePropertyKey;
|
|
20114
20154
|
exports2.getFieldConfig = getFieldConfig;
|
|
20115
20155
|
exports2.getFieldId = getFieldId;
|
|
20156
|
+
exports2.getFormFieldKeys = getFormFieldKeys;
|
|
20116
20157
|
exports2.getHashValue = getHashValue;
|
|
20117
20158
|
exports2.getIcon = getIcon;
|
|
20118
20159
|
exports2.getIconForProperty = getIconForProperty;
|