formanitor 0.0.8 → 0.0.9
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.cjs +6 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +6 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -181,10 +181,6 @@ var NO_OP_PROVIDER = {
|
|
|
181
181
|
function applyPrefill(currentValues, fields, prefilledData = {}) {
|
|
182
182
|
const newValues = { ...currentValues };
|
|
183
183
|
fields.forEach((field) => {
|
|
184
|
-
const currentValue = newValues[field.id];
|
|
185
|
-
if (!isEmpty(currentValue)) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
184
|
if (field.prefill?.value !== void 0) {
|
|
189
185
|
newValues[field.id] = field.prefill.value;
|
|
190
186
|
return;
|
|
@@ -196,9 +192,6 @@ function applyPrefill(currentValues, fields, prefilledData = {}) {
|
|
|
196
192
|
});
|
|
197
193
|
return newValues;
|
|
198
194
|
}
|
|
199
|
-
function isEmpty(val) {
|
|
200
|
-
return val === void 0 || val === null || val === "";
|
|
201
|
-
}
|
|
202
195
|
|
|
203
196
|
// src/core/store.ts
|
|
204
197
|
var FormStore = class {
|
|
@@ -2367,10 +2360,10 @@ var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
|
2367
2360
|
return String(opt.value) === String(value) || opt.value === value;
|
|
2368
2361
|
});
|
|
2369
2362
|
const displayValue = selectedOption ? selectedOption.label : value ?? "";
|
|
2370
|
-
const
|
|
2363
|
+
const isEmpty = !value && value !== 0;
|
|
2371
2364
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2372
2365
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2373
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] flex items-center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2366
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] flex items-center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No value" }) : displayValue })
|
|
2374
2367
|
] });
|
|
2375
2368
|
};
|
|
2376
2369
|
var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
@@ -2394,10 +2387,10 @@ var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
|
2394
2387
|
});
|
|
2395
2388
|
return option ? option.label : String(val);
|
|
2396
2389
|
}).filter(Boolean);
|
|
2397
|
-
const
|
|
2390
|
+
const isEmpty = selectedLabels.length === 0;
|
|
2398
2391
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2399
2392
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2400
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2393
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No values selected" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: selectedLabels.map((label, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2401
2394
|
"span",
|
|
2402
2395
|
{
|
|
2403
2396
|
className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",
|
|
@@ -2600,10 +2593,10 @@ var ReadOnlyRadio = ({ fieldDef, value }) => {
|
|
|
2600
2593
|
(opt) => String(opt.value) === String(value) || opt.value === value
|
|
2601
2594
|
);
|
|
2602
2595
|
const displayValue = selectedOption ? selectedOption.label : value ?? "";
|
|
2603
|
-
const
|
|
2596
|
+
const isEmpty = value == null || value === "";
|
|
2604
2597
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2605
2598
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2606
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] flex items-center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2599
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] flex items-center", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No value" }) : displayValue })
|
|
2607
2600
|
] });
|
|
2608
2601
|
};
|
|
2609
2602
|
function isOptionSelected2(selected, optValue) {
|