@measured/puck 0.16.3-canary.af421c6 → 0.17.0-canary.159d819
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.css +85 -83
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +193 -121
- package/dist/index.mjs +136 -59
- package/dist/{resolve-all-data-BoWgijLi.d.mts → resolve-all-data-C7aAQCY3.d.mts} +8 -1
- package/dist/{resolve-all-data-BoWgijLi.d.ts → resolve-all-data-C7aAQCY3.d.ts} +8 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -178,14 +178,13 @@ init_react_import();
|
|
178
178
|
|
179
179
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
180
180
|
init_react_import();
|
181
|
-
var styles_module_default2 = { "Input": "
|
181
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
|
182
182
|
|
183
183
|
// components/AutoField/index.tsx
|
184
184
|
import {
|
185
185
|
useCallback as useCallback5,
|
186
186
|
useEffect as useEffect9,
|
187
187
|
useMemo as useMemo2,
|
188
|
-
useRef as useRef2,
|
189
188
|
useState as useState10
|
190
189
|
} from "react";
|
191
190
|
|
@@ -880,7 +879,8 @@ var defaultAppState = {
|
|
880
879
|
},
|
881
880
|
options: [],
|
882
881
|
controlsVisible: true
|
883
|
-
}
|
882
|
+
},
|
883
|
+
field: { focus: null }
|
884
884
|
}
|
885
885
|
};
|
886
886
|
var defaultContext = {
|
@@ -1228,11 +1228,13 @@ var ArrayField = ({
|
|
1228
1228
|
event.source.index,
|
1229
1229
|
(_b = event.destination) == null ? void 0 : _b.index
|
1230
1230
|
);
|
1231
|
-
|
1231
|
+
const newUi = {
|
1232
1232
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
1233
1233
|
[id]: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
1234
1234
|
})
|
1235
|
-
}
|
1235
|
+
};
|
1236
|
+
setUi(newUi, false);
|
1237
|
+
onChange(newValue, newUi);
|
1236
1238
|
setLocalState({
|
1237
1239
|
value: newValue,
|
1238
1240
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -1298,32 +1300,60 @@ var ArrayField = ({
|
|
1298
1300
|
children: [
|
1299
1301
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1300
1302
|
/* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
|
1301
|
-
!readOnly && /* @__PURE__ */
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
e
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1303
|
+
!readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
|
1304
|
+
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
1305
|
+
IconButton,
|
1306
|
+
{
|
1307
|
+
type: "button",
|
1308
|
+
disabled: !!addDisabled,
|
1309
|
+
onClick: (e) => {
|
1310
|
+
e.stopPropagation();
|
1311
|
+
const existingValue = [
|
1312
|
+
...value || []
|
1313
|
+
];
|
1314
|
+
existingValue.splice(
|
1315
|
+
i,
|
1316
|
+
0,
|
1317
|
+
existingValue[i]
|
1318
|
+
);
|
1319
|
+
onChange(
|
1320
|
+
existingValue,
|
1321
|
+
mapArrayStateToUi(
|
1322
|
+
regenerateArrayState(existingValue)
|
1323
|
+
)
|
1324
|
+
);
|
1325
|
+
},
|
1326
|
+
title: "Duplicate",
|
1327
|
+
children: /* @__PURE__ */ jsx9(Copy, { size: 16 })
|
1328
|
+
}
|
1329
|
+
) }),
|
1330
|
+
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
1331
|
+
IconButton,
|
1332
|
+
{
|
1333
|
+
type: "button",
|
1334
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1335
|
+
onClick: (e) => {
|
1336
|
+
e.stopPropagation();
|
1337
|
+
const existingValue = [
|
1338
|
+
...value || []
|
1339
|
+
];
|
1340
|
+
const existingItems = [
|
1341
|
+
...arrayState.items || []
|
1342
|
+
];
|
1343
|
+
existingValue.splice(i, 1);
|
1344
|
+
existingItems.splice(i, 1);
|
1345
|
+
onChange(
|
1346
|
+
existingValue,
|
1347
|
+
mapArrayStateToUi({
|
1348
|
+
items: existingItems
|
1349
|
+
})
|
1350
|
+
);
|
1351
|
+
},
|
1352
|
+
title: "Delete",
|
1353
|
+
children: /* @__PURE__ */ jsx9(Trash, { size: 16 })
|
1354
|
+
}
|
1355
|
+
) })
|
1356
|
+
] }),
|
1327
1357
|
/* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(DragIcon, {}) })
|
1328
1358
|
] })
|
1329
1359
|
]
|
@@ -1420,7 +1450,7 @@ var DefaultField = ({
|
|
1420
1450
|
autoComplete: "off",
|
1421
1451
|
type: field.type,
|
1422
1452
|
name,
|
1423
|
-
value: typeof value === "undefined" ? "" : value,
|
1453
|
+
value: typeof value === "undefined" ? "" : value.toString(),
|
1424
1454
|
onChange: (e) => {
|
1425
1455
|
if (field.type === "number") {
|
1426
1456
|
onChange(Number(e.currentTarget.value));
|
@@ -1445,11 +1475,17 @@ import { useEffect as useEffect8 } from "react";
|
|
1445
1475
|
|
1446
1476
|
// components/ExternalInput/index.tsx
|
1447
1477
|
init_react_import();
|
1448
|
-
import {
|
1478
|
+
import {
|
1479
|
+
useMemo,
|
1480
|
+
useEffect as useEffect7,
|
1481
|
+
useState as useState8,
|
1482
|
+
useCallback as useCallback4,
|
1483
|
+
isValidElement
|
1484
|
+
} from "react";
|
1449
1485
|
|
1450
1486
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
1451
1487
|
init_react_import();
|
1452
|
-
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-
|
1488
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_8wgzm_1", "ExternalInput-button": "_ExternalInput-button_8wgzm_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_8wgzm_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_8wgzm_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_8wgzm_35", "ExternalInput": "_ExternalInput_8wgzm_1", "ExternalInputModal": "_ExternalInputModal_8wgzm_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_8wgzm_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_8wgzm_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_8wgzm_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_8wgzm_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_8wgzm_133", "ExternalInputModal-table": "_ExternalInputModal-table_8wgzm_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_8wgzm_149", "ExternalInputModal-th": "_ExternalInputModal-th_8wgzm_149", "ExternalInputModal-td": "_ExternalInputModal-td_8wgzm_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_8wgzm_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_8wgzm_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_8wgzm_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_8wgzm_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_8wgzm_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_8wgzm_227", "ExternalInputModal-search": "_ExternalInputModal-search_8wgzm_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_8wgzm_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_8wgzm_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_8wgzm_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_8wgzm_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_8wgzm_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_8wgzm_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_8wgzm_330" };
|
1453
1489
|
|
1454
1490
|
// components/Modal/index.tsx
|
1455
1491
|
init_react_import();
|
@@ -1606,7 +1642,7 @@ var ExternalInput = ({
|
|
1606
1642
|
const validKeys = /* @__PURE__ */ new Set();
|
1607
1643
|
for (const item of mappedData) {
|
1608
1644
|
for (const key of Object.keys(item)) {
|
1609
|
-
if (typeof item[key] === "string" || typeof item[key] === "number") {
|
1645
|
+
if (typeof item[key] === "string" || typeof item[key] === "number" || isValidElement(item[key])) {
|
1610
1646
|
validKeys.add(key);
|
1611
1647
|
}
|
1612
1648
|
}
|
@@ -1627,6 +1663,14 @@ var ExternalInput = ({
|
|
1627
1663
|
}),
|
1628
1664
|
[id, field]
|
1629
1665
|
);
|
1666
|
+
const Footer = useCallback4(
|
1667
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs7("span", { className: getClassNameModal("footer"), children: [
|
1668
|
+
props.items.length,
|
1669
|
+
" result",
|
1670
|
+
props.items.length === 1 ? "" : "s"
|
1671
|
+
] }),
|
1672
|
+
[field.renderFooter]
|
1673
|
+
);
|
1630
1674
|
useEffect7(() => {
|
1631
1675
|
search(searchQuery, filters);
|
1632
1676
|
}, []);
|
@@ -1766,11 +1810,7 @@ var ExternalInput = ({
|
|
1766
1810
|
/* @__PURE__ */ jsx14("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx14(Loader, { size: 24 }) })
|
1767
1811
|
] })
|
1768
1812
|
] }),
|
1769
|
-
/* @__PURE__ */
|
1770
|
-
mappedData.length,
|
1771
|
-
" result",
|
1772
|
-
mappedData.length === 1 ? "" : "s"
|
1773
|
-
] })
|
1813
|
+
/* @__PURE__ */ jsx14("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx14(Footer, { items: mappedData }) })
|
1774
1814
|
]
|
1775
1815
|
}
|
1776
1816
|
) })
|
@@ -2050,6 +2090,7 @@ var useSafeId = () => {
|
|
2050
2090
|
// components/AutoField/index.tsx
|
2051
2091
|
import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
2052
2092
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2093
|
+
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2053
2094
|
var FieldLabel = ({
|
2054
2095
|
children,
|
2055
2096
|
icon,
|
@@ -2097,7 +2138,7 @@ var FieldLabelInternal2 = ({
|
|
2097
2138
|
};
|
2098
2139
|
function AutoFieldInternal(props) {
|
2099
2140
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2100
|
-
const { overrides } = useAppContext();
|
2141
|
+
const { dispatch, overrides } = useAppContext();
|
2101
2142
|
const { id, Label = FieldLabelInternal2 } = props;
|
2102
2143
|
const field = props.field;
|
2103
2144
|
const label = field.label;
|
@@ -2129,23 +2170,45 @@ function AutoFieldInternal(props) {
|
|
2129
2170
|
Label,
|
2130
2171
|
id: resolvedId
|
2131
2172
|
});
|
2173
|
+
const onFocus = useCallback5(
|
2174
|
+
(e) => {
|
2175
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2176
|
+
e.stopPropagation();
|
2177
|
+
dispatch({
|
2178
|
+
type: "setUi",
|
2179
|
+
ui: {
|
2180
|
+
field: { focus: mergedProps.name }
|
2181
|
+
}
|
2182
|
+
});
|
2183
|
+
}
|
2184
|
+
},
|
2185
|
+
[mergedProps.name]
|
2186
|
+
);
|
2187
|
+
const onBlur = useCallback5((e) => {
|
2188
|
+
if ("name" in e.target) {
|
2189
|
+
dispatch({
|
2190
|
+
type: "setUi",
|
2191
|
+
ui: {
|
2192
|
+
field: { focus: null }
|
2193
|
+
}
|
2194
|
+
});
|
2195
|
+
}
|
2196
|
+
}, []);
|
2132
2197
|
if (field.type === "custom") {
|
2133
2198
|
if (!field.render) {
|
2134
2199
|
return null;
|
2135
2200
|
}
|
2136
2201
|
const CustomField = field.render;
|
2137
|
-
return /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) });
|
2202
|
+
return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) }) });
|
2138
2203
|
}
|
2139
2204
|
const children = defaultFields[field.type](mergedProps);
|
2140
2205
|
const Render2 = render[field.type];
|
2141
|
-
return /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
2206
|
+
return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children })) });
|
2142
2207
|
}
|
2143
|
-
var RECENT_CHANGE_TIMEOUT = 200;
|
2144
2208
|
function AutoFieldPrivate(props) {
|
2209
|
+
const { state } = useAppContext();
|
2145
2210
|
const { value, onChange } = props;
|
2146
2211
|
const [localValue, setLocalValue] = useState10(value);
|
2147
|
-
const [recentlyChanged, setRecentlyChanged] = useState10(false);
|
2148
|
-
const timeoutRef = useRef2();
|
2149
2212
|
const onChangeDb = useDebouncedCallback(
|
2150
2213
|
(val, ui) => {
|
2151
2214
|
onChange(val, ui);
|
@@ -2155,15 +2218,10 @@ function AutoFieldPrivate(props) {
|
|
2155
2218
|
);
|
2156
2219
|
const onChangeLocal = useCallback5((val, ui) => {
|
2157
2220
|
setLocalValue(val);
|
2158
|
-
setRecentlyChanged(true);
|
2159
|
-
clearTimeout(timeoutRef.current);
|
2160
|
-
timeoutRef.current = setTimeout(() => {
|
2161
|
-
setRecentlyChanged(false);
|
2162
|
-
}, RECENT_CHANGE_TIMEOUT);
|
2163
2221
|
onChangeDb(val, ui);
|
2164
2222
|
}, []);
|
2165
2223
|
useEffect9(() => {
|
2166
|
-
if (
|
2224
|
+
if (state.ui.field.focus !== props.name) {
|
2167
2225
|
setLocalValue(value);
|
2168
2226
|
}
|
2169
2227
|
}, [value]);
|
@@ -3514,6 +3572,22 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields
|
|
3514
3572
|
|
3515
3573
|
// components/Puck/components/Fields/index.tsx
|
3516
3574
|
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useState as useState15 } from "react";
|
3575
|
+
|
3576
|
+
// lib/use-parent.ts
|
3577
|
+
init_react_import();
|
3578
|
+
import { useContext as useContext5 } from "react";
|
3579
|
+
var useParent = (itemSelector) => {
|
3580
|
+
var _a;
|
3581
|
+
const { selectedItem, state } = useAppContext();
|
3582
|
+
const { pathData } = useContext5(dropZoneContext) || {};
|
3583
|
+
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3584
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3585
|
+
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
3586
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
|
3587
|
+
return parent || null;
|
3588
|
+
};
|
3589
|
+
|
3590
|
+
// components/Puck/components/Fields/index.tsx
|
3517
3591
|
import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
3518
3592
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3519
3593
|
var defaultPageFields = {
|
@@ -3527,6 +3601,7 @@ var DefaultFields = ({
|
|
3527
3601
|
var useResolvedFields = () => {
|
3528
3602
|
var _a, _b;
|
3529
3603
|
const { selectedItem, state, config } = useAppContext();
|
3604
|
+
const parent = useParent();
|
3530
3605
|
const { data } = state;
|
3531
3606
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3532
3607
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
@@ -3557,7 +3632,8 @@ var useResolvedFields = () => {
|
|
3557
3632
|
fields,
|
3558
3633
|
lastFields: resolvedFields,
|
3559
3634
|
lastData,
|
3560
|
-
appState: state
|
3635
|
+
appState: state,
|
3636
|
+
parent
|
3561
3637
|
}
|
3562
3638
|
);
|
3563
3639
|
}
|
@@ -3567,7 +3643,8 @@ var useResolvedFields = () => {
|
|
3567
3643
|
fields,
|
3568
3644
|
lastFields: resolvedFields,
|
3569
3645
|
lastData,
|
3570
|
-
appState: state
|
3646
|
+
appState: state,
|
3647
|
+
parent
|
3571
3648
|
});
|
3572
3649
|
}
|
3573
3650
|
return defaultResolveFields(componentData, {
|
@@ -3589,7 +3666,7 @@ var useResolvedFields = () => {
|
|
3589
3666
|
} else {
|
3590
3667
|
setResolvedFields(defaultFields);
|
3591
3668
|
}
|
3592
|
-
}, [data, defaultFields,
|
3669
|
+
}, [data, defaultFields, selectedItem, hasResolver]);
|
3593
3670
|
return [resolvedFields, fieldsLoading];
|
3594
3671
|
};
|
3595
3672
|
var Fields = () => {
|
@@ -3896,7 +3973,7 @@ import { useCallback as useCallback8, useMemo as useMemo8 } from "react";
|
|
3896
3973
|
init_react_import();
|
3897
3974
|
import {
|
3898
3975
|
createContext as createContext4,
|
3899
|
-
useContext as
|
3976
|
+
useContext as useContext6,
|
3900
3977
|
useEffect as useEffect15,
|
3901
3978
|
useRef as useRef3,
|
3902
3979
|
useState as useState17
|
@@ -4106,7 +4183,7 @@ var CopyHostStyles = ({
|
|
4106
4183
|
return /* @__PURE__ */ jsx31(Fragment13, { children });
|
4107
4184
|
};
|
4108
4185
|
var autoFrameContext = createContext4({});
|
4109
|
-
var useFrame = () =>
|
4186
|
+
var useFrame = () => useContext6(autoFrameContext);
|
4110
4187
|
function AutoFrame(_a) {
|
4111
4188
|
var _b = _a, {
|
4112
4189
|
children,
|
@@ -4259,7 +4336,7 @@ var scrollIntoView = (el) => {
|
|
4259
4336
|
};
|
4260
4337
|
|
4261
4338
|
// components/LayerTree/index.tsx
|
4262
|
-
import { useContext as
|
4339
|
+
import { useContext as useContext7 } from "react";
|
4263
4340
|
|
4264
4341
|
// lib/is-child-of-zone.ts
|
4265
4342
|
init_react_import();
|
@@ -4286,7 +4363,7 @@ var LayerTree = ({
|
|
4286
4363
|
label
|
4287
4364
|
}) => {
|
4288
4365
|
const zones = data.zones || {};
|
4289
|
-
const ctx =
|
4366
|
+
const ctx = useContext7(dropZoneContext);
|
4290
4367
|
return /* @__PURE__ */ jsxs17(Fragment15, { children: [
|
4291
4368
|
label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
|
4292
4369
|
/* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
|
@@ -91,9 +91,12 @@ type ExternalField<Props extends {
|
|
91
91
|
filters: Record<string, any>;
|
92
92
|
}) => Promise<any[] | null>;
|
93
93
|
mapProp?: (value: any) => Props;
|
94
|
-
mapRow?: (value: any) => Record<string, string | number>;
|
94
|
+
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
95
|
getItemSummary?: (item: Props, index?: number) => string;
|
96
96
|
showSearch?: boolean;
|
97
|
+
renderFooter?: (props: {
|
98
|
+
items: any[];
|
99
|
+
}) => ReactElement;
|
97
100
|
initialQuery?: string;
|
98
101
|
filterFields?: Record<string, Field>;
|
99
102
|
initialFilters?: Record<string, any>;
|
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
142
145
|
lastFields: Fields<FieldProps>;
|
143
146
|
lastData: DataShape | null;
|
144
147
|
appState: AppState;
|
148
|
+
parent: ComponentData | null;
|
145
149
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
146
150
|
resolveData?: (data: DataShape, params: {
|
147
151
|
changed: Partial<Record<keyof FieldProps, boolean>>;
|
@@ -271,6 +275,9 @@ type UiState = {
|
|
271
275
|
controlsVisible: boolean;
|
272
276
|
options: Viewport[];
|
273
277
|
};
|
278
|
+
field: {
|
279
|
+
focus?: string | null;
|
280
|
+
};
|
274
281
|
};
|
275
282
|
type AppState<UserData extends Data = Data> = {
|
276
283
|
data: UserData;
|
@@ -91,9 +91,12 @@ type ExternalField<Props extends {
|
|
91
91
|
filters: Record<string, any>;
|
92
92
|
}) => Promise<any[] | null>;
|
93
93
|
mapProp?: (value: any) => Props;
|
94
|
-
mapRow?: (value: any) => Record<string, string | number>;
|
94
|
+
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
95
|
getItemSummary?: (item: Props, index?: number) => string;
|
96
96
|
showSearch?: boolean;
|
97
|
+
renderFooter?: (props: {
|
98
|
+
items: any[];
|
99
|
+
}) => ReactElement;
|
97
100
|
initialQuery?: string;
|
98
101
|
filterFields?: Record<string, Field>;
|
99
102
|
initialFilters?: Record<string, any>;
|
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
142
145
|
lastFields: Fields<FieldProps>;
|
143
146
|
lastData: DataShape | null;
|
144
147
|
appState: AppState;
|
148
|
+
parent: ComponentData | null;
|
145
149
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
146
150
|
resolveData?: (data: DataShape, params: {
|
147
151
|
changed: Partial<Record<keyof FieldProps, boolean>>;
|
@@ -271,6 +275,9 @@ type UiState = {
|
|
271
275
|
controlsVisible: boolean;
|
272
276
|
options: Viewport[];
|
273
277
|
};
|
278
|
+
field: {
|
279
|
+
focus?: string | null;
|
280
|
+
};
|
274
281
|
};
|
275
282
|
type AppState<UserData extends Data = Data> = {
|
276
283
|
data: UserData;
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './resolve-all-data-
|
3
|
-
export { a4 as resolveAllData } from './resolve-all-data-
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.mjs';
|
3
|
+
export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './resolve-all-data-
|
3
|
-
export { a4 as resolveAllData } from './resolve-all-data-
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.js';
|
3
|
+
export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/package.json
CHANGED