@measured/puck 0.7.1-canary.c2d7fae → 0.8.0-canary.06b145b
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/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -7,6 +7,9 @@ type Adaptor<AdaptorParams = {}> = {
|
|
7
7
|
name: string;
|
8
8
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<Record<string, any>[] | null>;
|
9
9
|
};
|
10
|
+
type WithId<T> = T & {
|
11
|
+
id: string;
|
12
|
+
};
|
10
13
|
type Field<Props extends {
|
11
14
|
[key: string]: any;
|
12
15
|
} = {
|
@@ -17,7 +20,7 @@ type Field<Props extends {
|
|
17
20
|
adaptor?: Adaptor;
|
18
21
|
adaptorParams?: object;
|
19
22
|
arrayFields?: {
|
20
|
-
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
23
|
+
[SubPropName in keyof Props]: Field<Props[SubPropName][0]>;
|
21
24
|
};
|
22
25
|
getItemSummary?: (item: Props, index?: number) => string;
|
23
26
|
defaultItemProps?: Props;
|
@@ -52,7 +55,7 @@ type Content<Props extends {
|
|
52
55
|
[key: string]: any;
|
53
56
|
}> = MappedItem<Props>[];
|
54
57
|
type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps> = {
|
55
|
-
render: (props: ComponentProps) => ReactElement;
|
58
|
+
render: (props: WithId<ComponentProps>) => ReactElement;
|
56
59
|
defaultProps?: DefaultProps;
|
57
60
|
fields?: Fields<ComponentProps>;
|
58
61
|
};
|
@@ -76,11 +79,9 @@ type MappedItem<Props extends {
|
|
76
79
|
[key: string]: any;
|
77
80
|
}> = {
|
78
81
|
type: keyof Props;
|
79
|
-
props: {
|
82
|
+
props: WithId<{
|
80
83
|
[key: string]: any;
|
81
|
-
}
|
82
|
-
id: string;
|
83
|
-
};
|
84
|
+
}>;
|
84
85
|
};
|
85
86
|
type Data<Props extends {
|
86
87
|
[key: string]: any;
|
package/dist/index.js
CHANGED
@@ -2330,7 +2330,7 @@ init_react_import();
|
|
2330
2330
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
2331
2331
|
function Render({ config, data }) {
|
2332
2332
|
if (config.root) {
|
2333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.root.render, __spreadProps(__spreadValues({}, data.root), { editMode: false, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) })) });
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.root.render, __spreadProps(__spreadValues({}, data.root), { editMode: false, id: "puck-root", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) })) });
|
2334
2334
|
}
|
2335
2335
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) });
|
2336
2336
|
}
|