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.mjs
CHANGED
|
@@ -155,10 +155,6 @@ var NO_OP_PROVIDER = {
|
|
|
155
155
|
function applyPrefill(currentValues, fields, prefilledData = {}) {
|
|
156
156
|
const newValues = { ...currentValues };
|
|
157
157
|
fields.forEach((field) => {
|
|
158
|
-
const currentValue = newValues[field.id];
|
|
159
|
-
if (!isEmpty(currentValue)) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
158
|
if (field.prefill?.value !== void 0) {
|
|
163
159
|
newValues[field.id] = field.prefill.value;
|
|
164
160
|
return;
|
|
@@ -170,9 +166,6 @@ function applyPrefill(currentValues, fields, prefilledData = {}) {
|
|
|
170
166
|
});
|
|
171
167
|
return newValues;
|
|
172
168
|
}
|
|
173
|
-
function isEmpty(val) {
|
|
174
|
-
return val === void 0 || val === null || val === "";
|
|
175
|
-
}
|
|
176
169
|
|
|
177
170
|
// src/core/store.ts
|
|
178
171
|
var FormStore = class {
|
|
@@ -2341,10 +2334,10 @@ var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
|
2341
2334
|
return String(opt.value) === String(value) || opt.value === value;
|
|
2342
2335
|
});
|
|
2343
2336
|
const displayValue = selectedOption ? selectedOption.label : value ?? "";
|
|
2344
|
-
const
|
|
2337
|
+
const isEmpty = !value && value !== 0;
|
|
2345
2338
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2346
2339
|
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2347
|
-
/* @__PURE__ */ 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__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2340
|
+
/* @__PURE__ */ 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__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No value" }) : displayValue })
|
|
2348
2341
|
] });
|
|
2349
2342
|
};
|
|
2350
2343
|
var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
@@ -2368,10 +2361,10 @@ var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
|
2368
2361
|
});
|
|
2369
2362
|
return option ? option.label : String(val);
|
|
2370
2363
|
}).filter(Boolean);
|
|
2371
|
-
const
|
|
2364
|
+
const isEmpty = selectedLabels.length === 0;
|
|
2372
2365
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2373
2366
|
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2374
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: loading ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2367
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: loading ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No values selected" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: selectedLabels.map((label, idx) => /* @__PURE__ */ jsx(
|
|
2375
2368
|
"span",
|
|
2376
2369
|
{
|
|
2377
2370
|
className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",
|
|
@@ -2574,10 +2567,10 @@ var ReadOnlyRadio = ({ fieldDef, value }) => {
|
|
|
2574
2567
|
(opt) => String(opt.value) === String(value) || opt.value === value
|
|
2575
2568
|
);
|
|
2576
2569
|
const displayValue = selectedOption ? selectedOption.label : value ?? "";
|
|
2577
|
-
const
|
|
2570
|
+
const isEmpty = value == null || value === "";
|
|
2578
2571
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2579
2572
|
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
2580
|
-
/* @__PURE__ */ 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__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) :
|
|
2573
|
+
/* @__PURE__ */ 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__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : isEmpty ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No value" }) : displayValue })
|
|
2581
2574
|
] });
|
|
2582
2575
|
};
|
|
2583
2576
|
function isOptionSelected2(selected, optValue) {
|