hs-uix 1.3.0 → 1.4.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/form.js +24 -11
- package/dist/form.mjs +24 -11
- package/dist/index.js +24 -11
- package/dist/index.mjs +24 -11
- package/package.json +1 -1
package/dist/form.js
CHANGED
|
@@ -55,6 +55,7 @@ var getEmptyValue = (field) => {
|
|
|
55
55
|
case "datetime":
|
|
56
56
|
return void 0;
|
|
57
57
|
case "display":
|
|
58
|
+
case "slot":
|
|
58
59
|
case "crmPropertyList":
|
|
59
60
|
case "crmAssociationPropertyList":
|
|
60
61
|
return void 0;
|
|
@@ -198,7 +199,7 @@ var collectAsyncValidatorPromises = (value, field, allValues, context) => {
|
|
|
198
199
|
var runValidators = (value, field, allValues, fieldTypes, options = {}) => {
|
|
199
200
|
const includeCustomValidators = options.includeCustomValidators !== false;
|
|
200
201
|
const msg = options.messages || {};
|
|
201
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
202
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
202
203
|
const isRequired = resolveRequired(field, allValues);
|
|
203
204
|
const plugin = fieldTypes && fieldTypes[field.type];
|
|
204
205
|
const empty = plugin && plugin.isEmpty ? plugin.isEmpty(value) : isValueEmpty(value, field);
|
|
@@ -421,6 +422,8 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
421
422
|
// explicit row layout array (overrides columns + columnWidth)
|
|
422
423
|
sections,
|
|
423
424
|
// FormBuilderSection[] — accordion field grouping
|
|
425
|
+
groups,
|
|
426
|
+
// Record<string, FormBuilderGroupOptions> — per-group rendering options keyed by group name
|
|
424
427
|
gap = "sm",
|
|
425
428
|
// gap between fields
|
|
426
429
|
showRequiredIndicator = true,
|
|
@@ -630,7 +633,7 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
630
633
|
const resolved = transformInitialValues && initialValues ? transformInitialValues(initialValues) : initialValues;
|
|
631
634
|
const vals = {};
|
|
632
635
|
for (const field of fields) {
|
|
633
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
636
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
634
637
|
if (field.type === "fieldGroup" && field.items && field.fields) {
|
|
635
638
|
for (const item of field.items) {
|
|
636
639
|
const subFields = field.fields(item);
|
|
@@ -1162,7 +1165,7 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
1162
1165
|
const rawValues = {};
|
|
1163
1166
|
for (const key of Object.keys(formValues)) {
|
|
1164
1167
|
const f = fieldByName.get(key);
|
|
1165
|
-
if (f && (f.type === "display" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
1168
|
+
if (f && (f.type === "display" || f.type === "slot" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
1166
1169
|
rawValues[key] = f && f.transformOut ? f.transformOut(formValues[key]) : formValues[key];
|
|
1167
1170
|
}
|
|
1168
1171
|
for (const f of fields) {
|
|
@@ -1313,7 +1316,7 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
1313
1316
|
const isReadOnly = field.readOnly || formReadOnly;
|
|
1314
1317
|
const isDisabled = disabled || resolveDisabled(field, formValues) || formReadOnly;
|
|
1315
1318
|
const fieldOnChange = field.debounce ? (v) => handleDebouncedFieldChange(field.name, v) : (v) => handleFieldChange(field.name, v);
|
|
1316
|
-
if (field.type === "display") {
|
|
1319
|
+
if (field.type === "display" || field.type === "slot") {
|
|
1317
1320
|
if (field.render) {
|
|
1318
1321
|
return field.render({
|
|
1319
1322
|
values: formValues,
|
|
@@ -1885,7 +1888,7 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
1885
1888
|
const getFieldColSpan = (field) => {
|
|
1886
1889
|
if (field.colSpan != null) return Math.min(field.colSpan, columns);
|
|
1887
1890
|
if (field.width === "full" && columns > 1) return columns;
|
|
1888
|
-
if (columns > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
1891
|
+
if (columns > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
1889
1892
|
return 1;
|
|
1890
1893
|
};
|
|
1891
1894
|
const getDependents = (parentField) => visibleFields.filter(
|
|
@@ -1910,7 +1913,7 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
1910
1913
|
const colSpan = (field) => {
|
|
1911
1914
|
if (field.colSpan != null) return Math.min(field.colSpan, cols);
|
|
1912
1915
|
if (field.width === "full" && cols > 1) return cols;
|
|
1913
|
-
if (cols > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
1916
|
+
if (cols > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
1914
1917
|
return 1;
|
|
1915
1918
|
};
|
|
1916
1919
|
const flushRow = () => {
|
|
@@ -2074,13 +2077,23 @@ var FormBuilder = (0, import_react.forwardRef)(function FormBuilder2(props, ref)
|
|
|
2074
2077
|
const elements = [];
|
|
2075
2078
|
for (let i = 0; i < chunks.length; i++) {
|
|
2076
2079
|
const chunk = chunks[i];
|
|
2077
|
-
|
|
2080
|
+
const opts = chunk.group && groups && groups[chunk.group] || {};
|
|
2081
|
+
const showDivider = opts.showDivider !== false;
|
|
2082
|
+
const showLabel = opts.showLabel !== false;
|
|
2083
|
+
if (i > 0 && showDivider) {
|
|
2078
2084
|
elements.push(/* @__PURE__ */ import_react.default.createElement(import_ui_extensions.Divider, { key: `group-div-${i}` }));
|
|
2079
2085
|
}
|
|
2080
|
-
if (chunk.group) {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2086
|
+
if (chunk.group && showLabel) {
|
|
2087
|
+
if (typeof opts.renderHeader === "function") {
|
|
2088
|
+
const header = opts.renderHeader(chunk.group, chunk.fields, formValues);
|
|
2089
|
+
if (header) elements.push(
|
|
2090
|
+
/* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: `group-header-${i}` }, header)
|
|
2091
|
+
);
|
|
2092
|
+
} else {
|
|
2093
|
+
elements.push(
|
|
2094
|
+
/* @__PURE__ */ import_react.default.createElement(import_ui_extensions.Text, { key: `group-label-${i}`, format: { fontWeight: "demibold" } }, opts.label || chunk.group)
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2084
2097
|
}
|
|
2085
2098
|
const chunkElements = renderFn(chunk.fields);
|
|
2086
2099
|
if (Array.isArray(chunkElements)) {
|
package/dist/form.mjs
CHANGED
|
@@ -59,6 +59,7 @@ var getEmptyValue = (field) => {
|
|
|
59
59
|
case "datetime":
|
|
60
60
|
return void 0;
|
|
61
61
|
case "display":
|
|
62
|
+
case "slot":
|
|
62
63
|
case "crmPropertyList":
|
|
63
64
|
case "crmAssociationPropertyList":
|
|
64
65
|
return void 0;
|
|
@@ -202,7 +203,7 @@ var collectAsyncValidatorPromises = (value, field, allValues, context) => {
|
|
|
202
203
|
var runValidators = (value, field, allValues, fieldTypes, options = {}) => {
|
|
203
204
|
const includeCustomValidators = options.includeCustomValidators !== false;
|
|
204
205
|
const msg = options.messages || {};
|
|
205
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
206
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
206
207
|
const isRequired = resolveRequired(field, allValues);
|
|
207
208
|
const plugin = fieldTypes && fieldTypes[field.type];
|
|
208
209
|
const empty = plugin && plugin.isEmpty ? plugin.isEmpty(value) : isValueEmpty(value, field);
|
|
@@ -425,6 +426,8 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
425
426
|
// explicit row layout array (overrides columns + columnWidth)
|
|
426
427
|
sections,
|
|
427
428
|
// FormBuilderSection[] — accordion field grouping
|
|
429
|
+
groups,
|
|
430
|
+
// Record<string, FormBuilderGroupOptions> — per-group rendering options keyed by group name
|
|
428
431
|
gap = "sm",
|
|
429
432
|
// gap between fields
|
|
430
433
|
showRequiredIndicator = true,
|
|
@@ -634,7 +637,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
634
637
|
const resolved = transformInitialValues && initialValues ? transformInitialValues(initialValues) : initialValues;
|
|
635
638
|
const vals = {};
|
|
636
639
|
for (const field of fields) {
|
|
637
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
640
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
638
641
|
if (field.type === "fieldGroup" && field.items && field.fields) {
|
|
639
642
|
for (const item of field.items) {
|
|
640
643
|
const subFields = field.fields(item);
|
|
@@ -1166,7 +1169,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1166
1169
|
const rawValues = {};
|
|
1167
1170
|
for (const key of Object.keys(formValues)) {
|
|
1168
1171
|
const f = fieldByName.get(key);
|
|
1169
|
-
if (f && (f.type === "display" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
1172
|
+
if (f && (f.type === "display" || f.type === "slot" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
1170
1173
|
rawValues[key] = f && f.transformOut ? f.transformOut(formValues[key]) : formValues[key];
|
|
1171
1174
|
}
|
|
1172
1175
|
for (const f of fields) {
|
|
@@ -1317,7 +1320,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1317
1320
|
const isReadOnly = field.readOnly || formReadOnly;
|
|
1318
1321
|
const isDisabled = disabled || resolveDisabled(field, formValues) || formReadOnly;
|
|
1319
1322
|
const fieldOnChange = field.debounce ? (v) => handleDebouncedFieldChange(field.name, v) : (v) => handleFieldChange(field.name, v);
|
|
1320
|
-
if (field.type === "display") {
|
|
1323
|
+
if (field.type === "display" || field.type === "slot") {
|
|
1321
1324
|
if (field.render) {
|
|
1322
1325
|
return field.render({
|
|
1323
1326
|
values: formValues,
|
|
@@ -1889,7 +1892,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1889
1892
|
const getFieldColSpan = (field) => {
|
|
1890
1893
|
if (field.colSpan != null) return Math.min(field.colSpan, columns);
|
|
1891
1894
|
if (field.width === "full" && columns > 1) return columns;
|
|
1892
|
-
if (columns > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
1895
|
+
if (columns > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
1893
1896
|
return 1;
|
|
1894
1897
|
};
|
|
1895
1898
|
const getDependents = (parentField) => visibleFields.filter(
|
|
@@ -1914,7 +1917,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1914
1917
|
const colSpan = (field) => {
|
|
1915
1918
|
if (field.colSpan != null) return Math.min(field.colSpan, cols);
|
|
1916
1919
|
if (field.width === "full" && cols > 1) return cols;
|
|
1917
|
-
if (cols > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
1920
|
+
if (cols > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
1918
1921
|
return 1;
|
|
1919
1922
|
};
|
|
1920
1923
|
const flushRow = () => {
|
|
@@ -2078,13 +2081,23 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
2078
2081
|
const elements = [];
|
|
2079
2082
|
for (let i = 0; i < chunks.length; i++) {
|
|
2080
2083
|
const chunk = chunks[i];
|
|
2081
|
-
|
|
2084
|
+
const opts = chunk.group && groups && groups[chunk.group] || {};
|
|
2085
|
+
const showDivider = opts.showDivider !== false;
|
|
2086
|
+
const showLabel = opts.showLabel !== false;
|
|
2087
|
+
if (i > 0 && showDivider) {
|
|
2082
2088
|
elements.push(/* @__PURE__ */ React.createElement(Divider, { key: `group-div-${i}` }));
|
|
2083
2089
|
}
|
|
2084
|
-
if (chunk.group) {
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2090
|
+
if (chunk.group && showLabel) {
|
|
2091
|
+
if (typeof opts.renderHeader === "function") {
|
|
2092
|
+
const header = opts.renderHeader(chunk.group, chunk.fields, formValues);
|
|
2093
|
+
if (header) elements.push(
|
|
2094
|
+
/* @__PURE__ */ React.createElement(React.Fragment, { key: `group-header-${i}` }, header)
|
|
2095
|
+
);
|
|
2096
|
+
} else {
|
|
2097
|
+
elements.push(
|
|
2098
|
+
/* @__PURE__ */ React.createElement(Text, { key: `group-label-${i}`, format: { fontWeight: "demibold" } }, opts.label || chunk.group)
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2088
2101
|
}
|
|
2089
2102
|
const chunkElements = renderFn(chunk.fields);
|
|
2090
2103
|
if (Array.isArray(chunkElements)) {
|
package/dist/index.js
CHANGED
|
@@ -1126,6 +1126,7 @@ var getEmptyValue = (field) => {
|
|
|
1126
1126
|
case "datetime":
|
|
1127
1127
|
return void 0;
|
|
1128
1128
|
case "display":
|
|
1129
|
+
case "slot":
|
|
1129
1130
|
case "crmPropertyList":
|
|
1130
1131
|
case "crmAssociationPropertyList":
|
|
1131
1132
|
return void 0;
|
|
@@ -1269,7 +1270,7 @@ var collectAsyncValidatorPromises = (value, field, allValues, context) => {
|
|
|
1269
1270
|
var runValidators = (value, field, allValues, fieldTypes, options = {}) => {
|
|
1270
1271
|
const includeCustomValidators = options.includeCustomValidators !== false;
|
|
1271
1272
|
const msg = options.messages || {};
|
|
1272
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
1273
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
1273
1274
|
const isRequired = resolveRequired(field, allValues);
|
|
1274
1275
|
const plugin = fieldTypes && fieldTypes[field.type];
|
|
1275
1276
|
const empty = plugin && plugin.isEmpty ? plugin.isEmpty(value) : isValueEmpty(value, field);
|
|
@@ -1492,6 +1493,8 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
1492
1493
|
// explicit row layout array (overrides columns + columnWidth)
|
|
1493
1494
|
sections,
|
|
1494
1495
|
// FormBuilderSection[] — accordion field grouping
|
|
1496
|
+
groups,
|
|
1497
|
+
// Record<string, FormBuilderGroupOptions> — per-group rendering options keyed by group name
|
|
1495
1498
|
gap = "sm",
|
|
1496
1499
|
// gap between fields
|
|
1497
1500
|
showRequiredIndicator = true,
|
|
@@ -1701,7 +1704,7 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
1701
1704
|
const resolved = transformInitialValues && initialValues ? transformInitialValues(initialValues) : initialValues;
|
|
1702
1705
|
const vals = {};
|
|
1703
1706
|
for (const field of fields) {
|
|
1704
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
1707
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
1705
1708
|
if (field.type === "fieldGroup" && field.items && field.fields) {
|
|
1706
1709
|
for (const item of field.items) {
|
|
1707
1710
|
const subFields = field.fields(item);
|
|
@@ -2233,7 +2236,7 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
2233
2236
|
const rawValues = {};
|
|
2234
2237
|
for (const key of Object.keys(formValues)) {
|
|
2235
2238
|
const f = fieldByName.get(key);
|
|
2236
|
-
if (f && (f.type === "display" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
2239
|
+
if (f && (f.type === "display" || f.type === "slot" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
2237
2240
|
rawValues[key] = f && f.transformOut ? f.transformOut(formValues[key]) : formValues[key];
|
|
2238
2241
|
}
|
|
2239
2242
|
for (const f of fields) {
|
|
@@ -2384,7 +2387,7 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
2384
2387
|
const isReadOnly = field.readOnly || formReadOnly;
|
|
2385
2388
|
const isDisabled = disabled || resolveDisabled(field, formValues) || formReadOnly;
|
|
2386
2389
|
const fieldOnChange = field.debounce ? (v) => handleDebouncedFieldChange(field.name, v) : (v) => handleFieldChange(field.name, v);
|
|
2387
|
-
if (field.type === "display") {
|
|
2390
|
+
if (field.type === "display" || field.type === "slot") {
|
|
2388
2391
|
if (field.render) {
|
|
2389
2392
|
return field.render({
|
|
2390
2393
|
values: formValues,
|
|
@@ -2956,7 +2959,7 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
2956
2959
|
const getFieldColSpan = (field) => {
|
|
2957
2960
|
if (field.colSpan != null) return Math.min(field.colSpan, columns);
|
|
2958
2961
|
if (field.width === "full" && columns > 1) return columns;
|
|
2959
|
-
if (columns > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
2962
|
+
if (columns > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
2960
2963
|
return 1;
|
|
2961
2964
|
};
|
|
2962
2965
|
const getDependents = (parentField) => visibleFields.filter(
|
|
@@ -2981,7 +2984,7 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
2981
2984
|
const colSpan = (field) => {
|
|
2982
2985
|
if (field.colSpan != null) return Math.min(field.colSpan, cols);
|
|
2983
2986
|
if (field.width === "full" && cols > 1) return cols;
|
|
2984
|
-
if (cols > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
2987
|
+
if (cols > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
2985
2988
|
return 1;
|
|
2986
2989
|
};
|
|
2987
2990
|
const flushRow = () => {
|
|
@@ -3145,13 +3148,23 @@ var FormBuilder = (0, import_react2.forwardRef)(function FormBuilder2(props, ref
|
|
|
3145
3148
|
const elements = [];
|
|
3146
3149
|
for (let i = 0; i < chunks.length; i++) {
|
|
3147
3150
|
const chunk = chunks[i];
|
|
3148
|
-
|
|
3151
|
+
const opts = chunk.group && groups && groups[chunk.group] || {};
|
|
3152
|
+
const showDivider = opts.showDivider !== false;
|
|
3153
|
+
const showLabel = opts.showLabel !== false;
|
|
3154
|
+
if (i > 0 && showDivider) {
|
|
3149
3155
|
elements.push(/* @__PURE__ */ import_react2.default.createElement(import_ui_extensions2.Divider, { key: `group-div-${i}` }));
|
|
3150
3156
|
}
|
|
3151
|
-
if (chunk.group) {
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3157
|
+
if (chunk.group && showLabel) {
|
|
3158
|
+
if (typeof opts.renderHeader === "function") {
|
|
3159
|
+
const header = opts.renderHeader(chunk.group, chunk.fields, formValues);
|
|
3160
|
+
if (header) elements.push(
|
|
3161
|
+
/* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, { key: `group-header-${i}` }, header)
|
|
3162
|
+
);
|
|
3163
|
+
} else {
|
|
3164
|
+
elements.push(
|
|
3165
|
+
/* @__PURE__ */ import_react2.default.createElement(import_ui_extensions2.Text, { key: `group-label-${i}`, format: { fontWeight: "demibold" } }, opts.label || chunk.group)
|
|
3166
|
+
);
|
|
3167
|
+
}
|
|
3155
3168
|
}
|
|
3156
3169
|
const chunkElements = renderFn(chunk.fields);
|
|
3157
3170
|
if (Array.isArray(chunkElements)) {
|
package/dist/index.mjs
CHANGED
|
@@ -1159,6 +1159,7 @@ var getEmptyValue = (field) => {
|
|
|
1159
1159
|
case "datetime":
|
|
1160
1160
|
return void 0;
|
|
1161
1161
|
case "display":
|
|
1162
|
+
case "slot":
|
|
1162
1163
|
case "crmPropertyList":
|
|
1163
1164
|
case "crmAssociationPropertyList":
|
|
1164
1165
|
return void 0;
|
|
@@ -1302,7 +1303,7 @@ var collectAsyncValidatorPromises = (value, field, allValues, context) => {
|
|
|
1302
1303
|
var runValidators = (value, field, allValues, fieldTypes, options = {}) => {
|
|
1303
1304
|
const includeCustomValidators = options.includeCustomValidators !== false;
|
|
1304
1305
|
const msg = options.messages || {};
|
|
1305
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
1306
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList" || field.type === "fieldGroup") return null;
|
|
1306
1307
|
const isRequired = resolveRequired(field, allValues);
|
|
1307
1308
|
const plugin = fieldTypes && fieldTypes[field.type];
|
|
1308
1309
|
const empty = plugin && plugin.isEmpty ? plugin.isEmpty(value) : isValueEmpty(value, field);
|
|
@@ -1525,6 +1526,8 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1525
1526
|
// explicit row layout array (overrides columns + columnWidth)
|
|
1526
1527
|
sections,
|
|
1527
1528
|
// FormBuilderSection[] — accordion field grouping
|
|
1529
|
+
groups,
|
|
1530
|
+
// Record<string, FormBuilderGroupOptions> — per-group rendering options keyed by group name
|
|
1528
1531
|
gap = "sm",
|
|
1529
1532
|
// gap between fields
|
|
1530
1533
|
showRequiredIndicator = true,
|
|
@@ -1734,7 +1737,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
1734
1737
|
const resolved = transformInitialValues && initialValues ? transformInitialValues(initialValues) : initialValues;
|
|
1735
1738
|
const vals = {};
|
|
1736
1739
|
for (const field of fields) {
|
|
1737
|
-
if (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
1740
|
+
if (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList") continue;
|
|
1738
1741
|
if (field.type === "fieldGroup" && field.items && field.fields) {
|
|
1739
1742
|
for (const item of field.items) {
|
|
1740
1743
|
const subFields = field.fields(item);
|
|
@@ -2266,7 +2269,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
2266
2269
|
const rawValues = {};
|
|
2267
2270
|
for (const key of Object.keys(formValues)) {
|
|
2268
2271
|
const f = fieldByName.get(key);
|
|
2269
|
-
if (f && (f.type === "display" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
2272
|
+
if (f && (f.type === "display" || f.type === "slot" || f.type === "crmPropertyList" || f.type === "crmAssociationPropertyList" || f.type === "fieldGroup")) continue;
|
|
2270
2273
|
rawValues[key] = f && f.transformOut ? f.transformOut(formValues[key]) : formValues[key];
|
|
2271
2274
|
}
|
|
2272
2275
|
for (const f of fields) {
|
|
@@ -2417,7 +2420,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
2417
2420
|
const isReadOnly = field.readOnly || formReadOnly;
|
|
2418
2421
|
const isDisabled = disabled || resolveDisabled(field, formValues) || formReadOnly;
|
|
2419
2422
|
const fieldOnChange = field.debounce ? (v) => handleDebouncedFieldChange(field.name, v) : (v) => handleFieldChange(field.name, v);
|
|
2420
|
-
if (field.type === "display") {
|
|
2423
|
+
if (field.type === "display" || field.type === "slot") {
|
|
2421
2424
|
if (field.render) {
|
|
2422
2425
|
return field.render({
|
|
2423
2426
|
values: formValues,
|
|
@@ -2989,7 +2992,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
2989
2992
|
const getFieldColSpan = (field) => {
|
|
2990
2993
|
if (field.colSpan != null) return Math.min(field.colSpan, columns);
|
|
2991
2994
|
if (field.width === "full" && columns > 1) return columns;
|
|
2992
|
-
if (columns > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
2995
|
+
if (columns > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return columns;
|
|
2993
2996
|
return 1;
|
|
2994
2997
|
};
|
|
2995
2998
|
const getDependents = (parentField) => visibleFields.filter(
|
|
@@ -3014,7 +3017,7 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
3014
3017
|
const colSpan = (field) => {
|
|
3015
3018
|
if (field.colSpan != null) return Math.min(field.colSpan, cols);
|
|
3016
3019
|
if (field.width === "full" && cols > 1) return cols;
|
|
3017
|
-
if (cols > 1 && (field.type === "display" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
3020
|
+
if (cols > 1 && (field.type === "display" || field.type === "slot" || field.type === "crmPropertyList" || field.type === "crmAssociationPropertyList")) return cols;
|
|
3018
3021
|
return 1;
|
|
3019
3022
|
};
|
|
3020
3023
|
const flushRow = () => {
|
|
@@ -3178,13 +3181,23 @@ var FormBuilder = forwardRef(function FormBuilder2(props, ref) {
|
|
|
3178
3181
|
const elements = [];
|
|
3179
3182
|
for (let i = 0; i < chunks.length; i++) {
|
|
3180
3183
|
const chunk = chunks[i];
|
|
3181
|
-
|
|
3184
|
+
const opts = chunk.group && groups && groups[chunk.group] || {};
|
|
3185
|
+
const showDivider = opts.showDivider !== false;
|
|
3186
|
+
const showLabel = opts.showLabel !== false;
|
|
3187
|
+
if (i > 0 && showDivider) {
|
|
3182
3188
|
elements.push(/* @__PURE__ */ React2.createElement(Divider, { key: `group-div-${i}` }));
|
|
3183
3189
|
}
|
|
3184
|
-
if (chunk.group) {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3190
|
+
if (chunk.group && showLabel) {
|
|
3191
|
+
if (typeof opts.renderHeader === "function") {
|
|
3192
|
+
const header = opts.renderHeader(chunk.group, chunk.fields, formValues);
|
|
3193
|
+
if (header) elements.push(
|
|
3194
|
+
/* @__PURE__ */ React2.createElement(React2.Fragment, { key: `group-header-${i}` }, header)
|
|
3195
|
+
);
|
|
3196
|
+
} else {
|
|
3197
|
+
elements.push(
|
|
3198
|
+
/* @__PURE__ */ React2.createElement(Text2, { key: `group-label-${i}`, format: { fontWeight: "demibold" } }, opts.label || chunk.group)
|
|
3199
|
+
);
|
|
3200
|
+
}
|
|
3188
3201
|
}
|
|
3189
3202
|
const chunkElements = renderFn(chunk.fields);
|
|
3190
3203
|
if (Array.isArray(chunkElements)) {
|