form-builder-pro 1.3.6 → 1.3.7
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.css +1 -1
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +399 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +398 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11
11
|
return value;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
// node_modules/zod/v3/external.js
|
|
14
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
15
15
|
var external_exports = {};
|
|
16
16
|
__export(external_exports, {
|
|
17
17
|
BRAND: () => BRAND,
|
|
@@ -123,7 +123,7 @@ __export(external_exports, {
|
|
|
123
123
|
void: () => voidType
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
// node_modules/zod/v3/helpers/util.js
|
|
126
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
127
127
|
var util;
|
|
128
128
|
(function(util2) {
|
|
129
129
|
util2.assertEqual = (_) => {
|
|
@@ -257,7 +257,7 @@ var getParsedType = (data) => {
|
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
-
// node_modules/zod/v3/ZodError.js
|
|
260
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
261
261
|
var ZodIssueCode = util.arrayToEnum([
|
|
262
262
|
"invalid_type",
|
|
263
263
|
"invalid_literal",
|
|
@@ -375,7 +375,7 @@ ZodError.create = (issues) => {
|
|
|
375
375
|
return error;
|
|
376
376
|
};
|
|
377
377
|
|
|
378
|
-
// node_modules/zod/v3/locales/en.js
|
|
378
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
379
379
|
var errorMap = (issue, _ctx) => {
|
|
380
380
|
let message;
|
|
381
381
|
switch (issue.code) {
|
|
@@ -478,7 +478,7 @@ var errorMap = (issue, _ctx) => {
|
|
|
478
478
|
};
|
|
479
479
|
var en_default = errorMap;
|
|
480
480
|
|
|
481
|
-
// node_modules/zod/v3/errors.js
|
|
481
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
482
482
|
var overrideErrorMap = en_default;
|
|
483
483
|
function setErrorMap(map) {
|
|
484
484
|
overrideErrorMap = map;
|
|
@@ -487,7 +487,7 @@ function getErrorMap() {
|
|
|
487
487
|
return overrideErrorMap;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
490
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
491
491
|
var makeIssue = (params) => {
|
|
492
492
|
const { data, path, errorMaps, issueData } = params;
|
|
493
493
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -597,14 +597,14 @@ var isDirty = (x) => x.status === "dirty";
|
|
|
597
597
|
var isValid = (x) => x.status === "valid";
|
|
598
598
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
599
599
|
|
|
600
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
600
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
601
601
|
var errorUtil;
|
|
602
602
|
(function(errorUtil2) {
|
|
603
603
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
604
604
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
605
605
|
})(errorUtil || (errorUtil = {}));
|
|
606
606
|
|
|
607
|
-
// node_modules/zod/v3/types.js
|
|
607
|
+
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
608
608
|
var ParseInputLazyPath = class {
|
|
609
609
|
constructor(parent, value, path, key) {
|
|
610
610
|
this._cachedPath = [];
|
|
@@ -4076,7 +4076,7 @@ var FormSchemaValidation = external_exports.object({
|
|
|
4076
4076
|
}))
|
|
4077
4077
|
});
|
|
4078
4078
|
|
|
4079
|
-
// node_modules/zustand/esm/vanilla.mjs
|
|
4079
|
+
// node_modules/.pnpm/zustand@4.5.7_react@19.2.4/node_modules/zustand/esm/vanilla.mjs
|
|
4080
4080
|
var createStoreImpl = (createState) => {
|
|
4081
4081
|
let state;
|
|
4082
4082
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -4125,7 +4125,8 @@ var FIELD_TYPES = [
|
|
|
4125
4125
|
{ type: "binary_choice", label: "Yes/No Toggle", icon: "ToggleLeft" },
|
|
4126
4126
|
{ type: "repeater", label: "Repeater", icon: "Copy" },
|
|
4127
4127
|
{ type: "file", label: "File Upload", icon: "Upload" },
|
|
4128
|
-
{ type: "image", label: "Image", icon: "Image" }
|
|
4128
|
+
{ type: "image", label: "Image", icon: "Image" },
|
|
4129
|
+
{ type: "name_generator", label: "Name Generator", icon: "Hash" }
|
|
4129
4130
|
];
|
|
4130
4131
|
var DEFAULT_FIELD_CONFIG = {
|
|
4131
4132
|
text: { label: "Text Input", placeholder: "Enter text...", width: "100%", enabled: true, visible: true },
|
|
@@ -4172,7 +4173,17 @@ var DEFAULT_FIELD_CONFIG = {
|
|
|
4172
4173
|
repeatIncrementEnabled: false
|
|
4173
4174
|
},
|
|
4174
4175
|
file: { label: "File Upload", width: "100%", enabled: true, visible: true },
|
|
4175
|
-
image: { label: "Image", width: "50%", enabled: true, visible: true }
|
|
4176
|
+
image: { label: "Image", width: "50%", enabled: true, visible: true },
|
|
4177
|
+
name_generator: {
|
|
4178
|
+
label: "Name Generator",
|
|
4179
|
+
placeholder: "Auto-generated",
|
|
4180
|
+
width: "100%",
|
|
4181
|
+
enabled: true,
|
|
4182
|
+
visible: true,
|
|
4183
|
+
nameGeneratorFormat: "TEXT_ID",
|
|
4184
|
+
nameGeneratorText: "",
|
|
4185
|
+
nameGeneratorIdPadding: 4
|
|
4186
|
+
}
|
|
4176
4187
|
};
|
|
4177
4188
|
var VALIDATION_TYPE_PRESETS = {
|
|
4178
4189
|
postalCode: {
|
|
@@ -4487,6 +4498,8 @@ function normalizeFieldType(type) {
|
|
|
4487
4498
|
return "repeater";
|
|
4488
4499
|
if (str === "DATETIME" || normalized === "datetime")
|
|
4489
4500
|
return "datetime";
|
|
4501
|
+
if (str === "NAME_GENERATOR" || normalized === "namegenerator")
|
|
4502
|
+
return "name_generator";
|
|
4490
4503
|
return str.toLowerCase();
|
|
4491
4504
|
}
|
|
4492
4505
|
function transformField(field) {
|
|
@@ -4628,16 +4641,19 @@ function transformField(field) {
|
|
|
4628
4641
|
let lookupSource;
|
|
4629
4642
|
let lookupValueField;
|
|
4630
4643
|
let lookupLabelField;
|
|
4644
|
+
let lookupParentFieldName;
|
|
4631
4645
|
if (field.lookup) {
|
|
4632
4646
|
lookupSourceType = field.lookup.sourceType;
|
|
4633
4647
|
lookupSource = field.lookup.sourceKey || field.lookup.source;
|
|
4634
4648
|
lookupValueField = field.lookup.valueField;
|
|
4635
4649
|
lookupLabelField = field.lookup.labelField;
|
|
4650
|
+
lookupParentFieldName = field.lookup.parentFieldName ?? void 0;
|
|
4636
4651
|
} else {
|
|
4637
4652
|
lookupSourceType = field.lookupSourceType;
|
|
4638
4653
|
lookupSource = field.lookupSource;
|
|
4639
4654
|
lookupValueField = field.lookupValueField;
|
|
4640
4655
|
lookupLabelField = field.lookupLabelField;
|
|
4656
|
+
lookupParentFieldName = field.lookupParentFieldName;
|
|
4641
4657
|
}
|
|
4642
4658
|
if (["select", "radio", "checkbox"].includes(normalizedType)) {
|
|
4643
4659
|
if (field.optionSource) {
|
|
@@ -4660,6 +4676,8 @@ function transformField(field) {
|
|
|
4660
4676
|
transformed.lookupValueField = lookupValueField;
|
|
4661
4677
|
if (lookupLabelField !== void 0)
|
|
4662
4678
|
transformed.lookupLabelField = lookupLabelField;
|
|
4679
|
+
if (lookupParentFieldName !== void 0)
|
|
4680
|
+
transformed.lookupParentFieldName = lookupParentFieldName || null;
|
|
4663
4681
|
if (field.fieldName !== void 0)
|
|
4664
4682
|
transformed.fieldName = field.fieldName;
|
|
4665
4683
|
else if (field.name !== void 0)
|
|
@@ -4708,6 +4726,16 @@ function transformField(field) {
|
|
|
4708
4726
|
transformed.repeatIncrementEnabled = field.repeatIncrementEnabled;
|
|
4709
4727
|
if (field.dateConstraints !== void 0)
|
|
4710
4728
|
transformed.dateConstraints = field.dateConstraints;
|
|
4729
|
+
if (field.nameGeneratorFormat !== void 0)
|
|
4730
|
+
transformed.nameGeneratorFormat = field.nameGeneratorFormat;
|
|
4731
|
+
if (field.nameGeneratorText !== void 0)
|
|
4732
|
+
transformed.nameGeneratorText = field.nameGeneratorText;
|
|
4733
|
+
if (field.nameGeneratorPrefix !== void 0)
|
|
4734
|
+
transformed.nameGeneratorPrefix = field.nameGeneratorPrefix;
|
|
4735
|
+
if (field.nameGeneratorSuffix !== void 0)
|
|
4736
|
+
transformed.nameGeneratorSuffix = field.nameGeneratorSuffix;
|
|
4737
|
+
if (field.nameGeneratorIdPadding !== void 0)
|
|
4738
|
+
transformed.nameGeneratorIdPadding = field.nameGeneratorIdPadding;
|
|
4711
4739
|
if (field.css !== void 0)
|
|
4712
4740
|
transformed.css = field.css;
|
|
4713
4741
|
if (field.optionsSource !== void 0)
|
|
@@ -4923,6 +4951,20 @@ function fieldToPayload(field) {
|
|
|
4923
4951
|
payload.lookupValueField = field.lookupValueField;
|
|
4924
4952
|
if (field.lookupLabelField !== void 0)
|
|
4925
4953
|
payload.lookupLabelField = field.lookupLabelField;
|
|
4954
|
+
if (field.optionSource === "LOOKUP") {
|
|
4955
|
+
payload.parentFieldName = field.lookupParentFieldName ?? null;
|
|
4956
|
+
}
|
|
4957
|
+
if (field.lookupParentFieldName !== void 0)
|
|
4958
|
+
payload.lookupParentFieldName = field.lookupParentFieldName;
|
|
4959
|
+
if (field.optionSource === "LOOKUP" && (field.lookupSourceType || field.lookupSource)) {
|
|
4960
|
+
payload.lookup = {
|
|
4961
|
+
sourceType: field.lookupSourceType || "MODULE",
|
|
4962
|
+
sourceKey: field.lookupSource || "",
|
|
4963
|
+
valueField: field.lookupValueField || "",
|
|
4964
|
+
labelField: field.lookupLabelField || "",
|
|
4965
|
+
parentFieldName: field.lookupParentFieldName ?? null
|
|
4966
|
+
};
|
|
4967
|
+
}
|
|
4926
4968
|
if (field.isd !== void 0)
|
|
4927
4969
|
payload.isd = field.isd;
|
|
4928
4970
|
if (field.imageUrl !== void 0)
|
|
@@ -4938,6 +4980,20 @@ function fieldToPayload(field) {
|
|
|
4938
4980
|
}
|
|
4939
4981
|
if (field.dateConstraints !== void 0)
|
|
4940
4982
|
payload.dateConstraints = field.dateConstraints;
|
|
4983
|
+
if (field.type === "name_generator") {
|
|
4984
|
+
payload.fieldType = "NAME_GENERATOR";
|
|
4985
|
+
payload.type = "name_generator";
|
|
4986
|
+
if (field.nameGeneratorFormat !== void 0)
|
|
4987
|
+
payload.nameGeneratorFormat = field.nameGeneratorFormat;
|
|
4988
|
+
if (field.nameGeneratorIdPadding !== void 0)
|
|
4989
|
+
payload.nameGeneratorIdPadding = field.nameGeneratorIdPadding;
|
|
4990
|
+
if (field.nameGeneratorPrefix !== void 0)
|
|
4991
|
+
payload.nameGeneratorPrefix = field.nameGeneratorPrefix;
|
|
4992
|
+
if (field.nameGeneratorSuffix !== void 0)
|
|
4993
|
+
payload.nameGeneratorSuffix = field.nameGeneratorSuffix;
|
|
4994
|
+
if (field.nameGeneratorText !== void 0)
|
|
4995
|
+
payload.nameGeneratorText = field.nameGeneratorText;
|
|
4996
|
+
}
|
|
4941
4997
|
if (field.type === "datetime") {
|
|
4942
4998
|
payload.fieldType = "DATETIME";
|
|
4943
4999
|
}
|
|
@@ -6012,6 +6068,93 @@ function getDefaultCountry() {
|
|
|
6012
6068
|
return INDIA;
|
|
6013
6069
|
}
|
|
6014
6070
|
|
|
6071
|
+
// src/utils/nameGenerator.ts
|
|
6072
|
+
var sessionIdCounter = 1;
|
|
6073
|
+
function resetNameGeneratorCounter() {
|
|
6074
|
+
sessionIdCounter = 1;
|
|
6075
|
+
}
|
|
6076
|
+
function getNextId(padding) {
|
|
6077
|
+
const id = String(sessionIdCounter).padStart(Math.max(1, padding), "0");
|
|
6078
|
+
sessionIdCounter += 1;
|
|
6079
|
+
return id;
|
|
6080
|
+
}
|
|
6081
|
+
function getRandom4() {
|
|
6082
|
+
return String(Math.floor(1e3 + Math.random() * 9e3));
|
|
6083
|
+
}
|
|
6084
|
+
function getYear() {
|
|
6085
|
+
return String((/* @__PURE__ */ new Date()).getFullYear());
|
|
6086
|
+
}
|
|
6087
|
+
function getMonth() {
|
|
6088
|
+
return String((/* @__PURE__ */ new Date()).getMonth() + 1).padStart(2, "0");
|
|
6089
|
+
}
|
|
6090
|
+
function getDay() {
|
|
6091
|
+
return String((/* @__PURE__ */ new Date()).getDate()).padStart(2, "0");
|
|
6092
|
+
}
|
|
6093
|
+
function getYearMonth() {
|
|
6094
|
+
return getYear() + getMonth();
|
|
6095
|
+
}
|
|
6096
|
+
function getYearMonthDay() {
|
|
6097
|
+
return `${getYear()}-${getMonth()}-${getDay()}`;
|
|
6098
|
+
}
|
|
6099
|
+
function generateName(fieldConfig, userInput) {
|
|
6100
|
+
const format = fieldConfig.nameGeneratorFormat ?? "TEXT_ID";
|
|
6101
|
+
const text = fieldConfig.nameGeneratorText?.trim() || "RFQ";
|
|
6102
|
+
const prefix = fieldConfig.nameGeneratorPrefix ?? "";
|
|
6103
|
+
const suffix = fieldConfig.nameGeneratorSuffix ?? "";
|
|
6104
|
+
const padding = Math.max(1, fieldConfig.nameGeneratorIdPadding ?? 4);
|
|
6105
|
+
const id = getNextId(padding);
|
|
6106
|
+
const userVal = userInput ?? "";
|
|
6107
|
+
const sep = {
|
|
6108
|
+
hyphen: "-",
|
|
6109
|
+
underscore: "_",
|
|
6110
|
+
slash: "/"
|
|
6111
|
+
};
|
|
6112
|
+
switch (format) {
|
|
6113
|
+
case "TEXT_HYPHEN_ID":
|
|
6114
|
+
return `${text}${sep.hyphen}${id}`;
|
|
6115
|
+
case "TEXT_UNDERSCORE_ID":
|
|
6116
|
+
return `${text}${sep.underscore}${id}`;
|
|
6117
|
+
case "TEXT_SLASH_ID":
|
|
6118
|
+
return `${text}${sep.slash}${id}`;
|
|
6119
|
+
case "TEXT_ID":
|
|
6120
|
+
return `${text}${id}`;
|
|
6121
|
+
case "ID_HYPHEN_TEXT":
|
|
6122
|
+
return `${id}${sep.hyphen}${text}`;
|
|
6123
|
+
case "ID_UNDERSCORE_TEXT":
|
|
6124
|
+
return `${id}${sep.underscore}${text}`;
|
|
6125
|
+
case "TEXT_YEAR_ID":
|
|
6126
|
+
return `${text}${sep.hyphen}${getYear()}${sep.hyphen}${id}`;
|
|
6127
|
+
case "TEXT_MONTH_ID":
|
|
6128
|
+
return `${text}${sep.hyphen}${getMonth()}${sep.hyphen}${id}`;
|
|
6129
|
+
case "TEXT_YEAR_MONTH_ID":
|
|
6130
|
+
return `${text}${sep.hyphen}${getYearMonth()}${sep.hyphen}${id}`;
|
|
6131
|
+
case "TEXT_ACCOUNT_CODE_ID":
|
|
6132
|
+
return `${text}${sep.hyphen}AccountCode${sep.hyphen}${id}`;
|
|
6133
|
+
case "TEXT_BRANCH_ID":
|
|
6134
|
+
return `${text}${sep.hyphen}Branch${sep.hyphen}${id}`;
|
|
6135
|
+
case "PREFIX_TEXT_ID":
|
|
6136
|
+
return `${prefix || "CRM"}${sep.hyphen}${text}${sep.hyphen}${id}`;
|
|
6137
|
+
case "TEXT_ID_SUFFIX":
|
|
6138
|
+
return `${text}${sep.hyphen}${id}${sep.hyphen}${suffix || "IND"}`;
|
|
6139
|
+
case "TEXT_RANDOM_4":
|
|
6140
|
+
return `${text}${sep.hyphen}${getRandom4()}`;
|
|
6141
|
+
case "TEXT_YEAR_MONTH_DAY_ID":
|
|
6142
|
+
return `${text}${sep.hyphen}${getYearMonthDay()}${sep.hyphen}${id}`;
|
|
6143
|
+
case "TEXT_HYPHEN_USER_INPUT":
|
|
6144
|
+
return `${text}${sep.hyphen}${userVal || "P001"}`;
|
|
6145
|
+
case "TEXT_UNDERSCORE_USER_INPUT":
|
|
6146
|
+
return `${text}${sep.underscore}${userVal || "P001"}`;
|
|
6147
|
+
case "TEXT_SLASH_USER_INPUT":
|
|
6148
|
+
return `${text}${sep.slash}${userVal || "P001"}`;
|
|
6149
|
+
case "USER_INPUT_HYPHEN_TEXT":
|
|
6150
|
+
return `${userVal || "P001"}${sep.hyphen}${text}`;
|
|
6151
|
+
case "USER_INPUT_UNDERSCORE_TEXT":
|
|
6152
|
+
return `${userVal || "P001"}${sep.underscore}${text}`;
|
|
6153
|
+
default:
|
|
6154
|
+
return `${text}${id}`;
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6157
|
+
|
|
6015
6158
|
// src/renderer/FieldRenderer.ts
|
|
6016
6159
|
function getValidationRules(field) {
|
|
6017
6160
|
const v = field.validations;
|
|
@@ -6302,13 +6445,19 @@ var FieldRenderer = class {
|
|
|
6302
6445
|
oninput: (e) => onChange?.(e.target.value)
|
|
6303
6446
|
});
|
|
6304
6447
|
break;
|
|
6305
|
-
case "select":
|
|
6448
|
+
case "select": {
|
|
6449
|
+
const isLookupWithParent = field.optionSource === "LOOKUP" && field.lookupParentFieldName;
|
|
6450
|
+
const parentValue = formData?.[field.lookupParentFieldName];
|
|
6451
|
+
const parentNotSelected = Boolean(isLookupWithParent && (parentValue === void 0 || parentValue === null || parentValue === ""));
|
|
6452
|
+
const effectiveOptions = parentNotSelected ? [] : field.options || [];
|
|
6453
|
+
const placeholder = parentNotSelected ? "Select parent first" : "Select an option";
|
|
6454
|
+
const selectDisabled = !isEnabled || parentNotSelected;
|
|
6306
6455
|
const isMultiSelect = field.multiSelect === true || field.multiselect === true;
|
|
6307
6456
|
if (isMultiSelect) {
|
|
6308
6457
|
input = createElement("select", {
|
|
6309
6458
|
multiple: true,
|
|
6310
6459
|
className: "flex min-h-touch w-full rounded-md border border-input bg-background px-3 py-2 text-sm sm:text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
6311
|
-
disabled:
|
|
6460
|
+
disabled: selectDisabled,
|
|
6312
6461
|
onchange: (e) => {
|
|
6313
6462
|
const select = e.target;
|
|
6314
6463
|
const selectedValues = Array.from(select.selectedOptions).map((opt) => opt.value);
|
|
@@ -6316,7 +6465,7 @@ var FieldRenderer = class {
|
|
|
6316
6465
|
}
|
|
6317
6466
|
});
|
|
6318
6467
|
const currentValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
6319
|
-
|
|
6468
|
+
effectiveOptions.forEach((opt) => {
|
|
6320
6469
|
const option2 = createElement("option", { value: opt.value, text: opt.label });
|
|
6321
6470
|
if (currentValues.includes(opt.value)) {
|
|
6322
6471
|
option2.selected = true;
|
|
@@ -6327,15 +6476,16 @@ var FieldRenderer = class {
|
|
|
6327
6476
|
input = createElement("select", {
|
|
6328
6477
|
className: "flex min-h-touch w-full rounded-md border border-input bg-background px-3 py-2 text-sm sm:text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
6329
6478
|
value: value || "",
|
|
6330
|
-
disabled:
|
|
6479
|
+
disabled: selectDisabled,
|
|
6331
6480
|
onchange: (e) => onChange?.(e.target.value)
|
|
6332
6481
|
});
|
|
6333
|
-
input.appendChild(createElement("option", { value: "", text:
|
|
6334
|
-
|
|
6482
|
+
input.appendChild(createElement("option", { value: "", text: placeholder, disabled: true, selected: !value }));
|
|
6483
|
+
effectiveOptions.forEach((opt) => {
|
|
6335
6484
|
input.appendChild(createElement("option", { value: opt.value, text: opt.label, selected: value === opt.value }));
|
|
6336
6485
|
});
|
|
6337
6486
|
}
|
|
6338
6487
|
break;
|
|
6488
|
+
}
|
|
6339
6489
|
case "checkbox":
|
|
6340
6490
|
if (field.options && field.options.length > 0) {
|
|
6341
6491
|
input = createElement("div", { className: "flex flex-wrap gap-x-4 gap-y-2" });
|
|
@@ -6500,6 +6650,18 @@ var FieldRenderer = class {
|
|
|
6500
6650
|
case "image":
|
|
6501
6651
|
input = this.renderImageField(field, value ?? field.imageUrl ?? field.defaultValue, onChange, isEnabled);
|
|
6502
6652
|
break;
|
|
6653
|
+
case "name_generator": {
|
|
6654
|
+
const displayValue = value ?? generateName(field);
|
|
6655
|
+
input = createElement("input", {
|
|
6656
|
+
type: "text",
|
|
6657
|
+
className: "flex min-h-touch w-full rounded-md border border-input bg-gray-50 dark:bg-gray-800 px-3 py-2 text-sm sm:text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
6658
|
+
placeholder: field.placeholder || "Auto-generated",
|
|
6659
|
+
value: displayValue,
|
|
6660
|
+
readonly: true,
|
|
6661
|
+
disabled: true
|
|
6662
|
+
});
|
|
6663
|
+
break;
|
|
6664
|
+
}
|
|
6503
6665
|
default:
|
|
6504
6666
|
const rules = getValidationRules(field);
|
|
6505
6667
|
const useNumericTextInput = field.type === "text" && isNumericTextField(field);
|
|
@@ -6560,10 +6722,7 @@ var FieldRenderer = class {
|
|
|
6560
6722
|
const isdConfig = field.isd || {
|
|
6561
6723
|
enabled: true,
|
|
6562
6724
|
defaultCode: "+91",
|
|
6563
|
-
showFlag: true
|
|
6564
|
-
showCountryName: false,
|
|
6565
|
-
allowCustomCode: false
|
|
6566
|
-
};
|
|
6725
|
+
showFlag: true};
|
|
6567
6726
|
let currentIsd = isdConfig.defaultCode;
|
|
6568
6727
|
let currentNumber = "";
|
|
6569
6728
|
if (value) {
|
|
@@ -6893,6 +7052,17 @@ function getFieldValidationError(field, fieldValue, allFields, formData) {
|
|
|
6893
7052
|
function getModelKey(field) {
|
|
6894
7053
|
return field.fieldName ?? field.id;
|
|
6895
7054
|
}
|
|
7055
|
+
function getLookupChildrenOfParent(schema, parentModelKey) {
|
|
7056
|
+
const children = [];
|
|
7057
|
+
for (const section of schema.sections) {
|
|
7058
|
+
for (const field of section.fields) {
|
|
7059
|
+
if (field.type === "select" && field.optionSource === "LOOKUP" && field.lookupParentFieldName === parentModelKey) {
|
|
7060
|
+
children.push(field);
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
}
|
|
7064
|
+
return children;
|
|
7065
|
+
}
|
|
6896
7066
|
function buildFormulaValuesMap(schema, data) {
|
|
6897
7067
|
const values = {};
|
|
6898
7068
|
const allFields = schema.sections.flatMap((s) => s.fields);
|
|
@@ -7007,6 +7177,12 @@ var FormRenderer = class {
|
|
|
7007
7177
|
const computed = computeFormulaValue(field, this.schema, this.data);
|
|
7008
7178
|
fieldValue = computed;
|
|
7009
7179
|
this.data[modelKey] = computed;
|
|
7180
|
+
} else if (field.type === "name_generator") {
|
|
7181
|
+
fieldValue = this.data[modelKey];
|
|
7182
|
+
if (!fieldValue) {
|
|
7183
|
+
fieldValue = generateName(field);
|
|
7184
|
+
this.data[modelKey] = fieldValue;
|
|
7185
|
+
}
|
|
7010
7186
|
} else if (field.type === "image") {
|
|
7011
7187
|
fieldValue = this.data[modelKey] ?? field.imageUrl ?? field.defaultValue;
|
|
7012
7188
|
} else {
|
|
@@ -7024,6 +7200,15 @@ var FormRenderer = class {
|
|
|
7024
7200
|
value: val || ""
|
|
7025
7201
|
});
|
|
7026
7202
|
}
|
|
7203
|
+
const lookupChildren = getLookupChildrenOfParent(this.schema, modelKey);
|
|
7204
|
+
if (lookupChildren.length > 0) {
|
|
7205
|
+
for (const child of lookupChildren) {
|
|
7206
|
+
const childKey = getModelKey(child);
|
|
7207
|
+
this.data[childKey] = null;
|
|
7208
|
+
}
|
|
7209
|
+
this.render();
|
|
7210
|
+
return;
|
|
7211
|
+
}
|
|
7027
7212
|
if (isFormulaDependency(this.schema, modelKey, field.id)) {
|
|
7028
7213
|
this.render();
|
|
7029
7214
|
return;
|
|
@@ -7093,110 +7278,94 @@ var FormRenderer = class {
|
|
|
7093
7278
|
}
|
|
7094
7279
|
};
|
|
7095
7280
|
|
|
7096
|
-
// node_modules/sortablejs/modular/sortable.esm.js
|
|
7097
|
-
function
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
});
|
|
7105
|
-
}
|
|
7106
|
-
keys.push.apply(keys, symbols);
|
|
7107
|
-
}
|
|
7108
|
-
return keys;
|
|
7281
|
+
// node_modules/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js
|
|
7282
|
+
function _defineProperty(e, r, t) {
|
|
7283
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
7284
|
+
value: t,
|
|
7285
|
+
enumerable: true,
|
|
7286
|
+
configurable: true,
|
|
7287
|
+
writable: true
|
|
7288
|
+
}) : e[r] = t, e;
|
|
7109
7289
|
}
|
|
7110
|
-
function
|
|
7111
|
-
|
|
7112
|
-
var
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
} else {
|
|
7120
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
7121
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7122
|
-
});
|
|
7123
|
-
}
|
|
7124
|
-
}
|
|
7125
|
-
return target;
|
|
7290
|
+
function _extends() {
|
|
7291
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
7292
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
7293
|
+
var t = arguments[e];
|
|
7294
|
+
for (var r in t)
|
|
7295
|
+
({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
7296
|
+
}
|
|
7297
|
+
return n;
|
|
7298
|
+
}, _extends.apply(null, arguments);
|
|
7126
7299
|
}
|
|
7127
|
-
function
|
|
7128
|
-
|
|
7129
|
-
if (
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
_typeof = function(obj2) {
|
|
7135
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
7136
|
-
};
|
|
7300
|
+
function ownKeys(e, r) {
|
|
7301
|
+
var t = Object.keys(e);
|
|
7302
|
+
if (Object.getOwnPropertySymbols) {
|
|
7303
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7304
|
+
r && (o = o.filter(function(r2) {
|
|
7305
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
7306
|
+
})), t.push.apply(t, o);
|
|
7137
7307
|
}
|
|
7138
|
-
return
|
|
7308
|
+
return t;
|
|
7139
7309
|
}
|
|
7140
|
-
function
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7310
|
+
function _objectSpread2(e) {
|
|
7311
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
7312
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
7313
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
7314
|
+
_defineProperty(e, r2, t[r2]);
|
|
7315
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
7316
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
7147
7317
|
});
|
|
7148
|
-
} else {
|
|
7149
|
-
obj[key] = value;
|
|
7150
7318
|
}
|
|
7151
|
-
return
|
|
7319
|
+
return e;
|
|
7152
7320
|
}
|
|
7153
|
-
function
|
|
7154
|
-
|
|
7155
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7156
|
-
var source = arguments[i];
|
|
7157
|
-
for (var key in source) {
|
|
7158
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7159
|
-
target[key] = source[key];
|
|
7160
|
-
}
|
|
7161
|
-
}
|
|
7162
|
-
}
|
|
7163
|
-
return target;
|
|
7164
|
-
};
|
|
7165
|
-
return _extends.apply(this, arguments);
|
|
7166
|
-
}
|
|
7167
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7168
|
-
if (source == null)
|
|
7321
|
+
function _objectWithoutProperties(e, t) {
|
|
7322
|
+
if (null == e)
|
|
7169
7323
|
return {};
|
|
7170
|
-
var
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
if (excluded.indexOf(key) >= 0)
|
|
7176
|
-
continue;
|
|
7177
|
-
target[key] = source[key];
|
|
7324
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
7325
|
+
if (Object.getOwnPropertySymbols) {
|
|
7326
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
7327
|
+
for (r = 0; r < n.length; r++)
|
|
7328
|
+
o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
7178
7329
|
}
|
|
7179
|
-
return
|
|
7330
|
+
return i;
|
|
7180
7331
|
}
|
|
7181
|
-
function
|
|
7182
|
-
if (
|
|
7332
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
7333
|
+
if (null == r)
|
|
7183
7334
|
return {};
|
|
7184
|
-
var
|
|
7185
|
-
var
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
7189
|
-
key = sourceSymbolKeys[i];
|
|
7190
|
-
if (excluded.indexOf(key) >= 0)
|
|
7335
|
+
var t = {};
|
|
7336
|
+
for (var n in r)
|
|
7337
|
+
if ({}.hasOwnProperty.call(r, n)) {
|
|
7338
|
+
if (-1 !== e.indexOf(n))
|
|
7191
7339
|
continue;
|
|
7192
|
-
|
|
7193
|
-
continue;
|
|
7194
|
-
target[key] = source[key];
|
|
7340
|
+
t[n] = r[n];
|
|
7195
7341
|
}
|
|
7196
|
-
|
|
7197
|
-
return target;
|
|
7342
|
+
return t;
|
|
7198
7343
|
}
|
|
7199
|
-
|
|
7344
|
+
function _toPrimitive(t, r) {
|
|
7345
|
+
if ("object" != typeof t || !t)
|
|
7346
|
+
return t;
|
|
7347
|
+
var e = t[Symbol.toPrimitive];
|
|
7348
|
+
if (void 0 !== e) {
|
|
7349
|
+
var i = e.call(t, r);
|
|
7350
|
+
if ("object" != typeof i)
|
|
7351
|
+
return i;
|
|
7352
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7353
|
+
}
|
|
7354
|
+
return ("string" === r ? String : Number)(t);
|
|
7355
|
+
}
|
|
7356
|
+
function _toPropertyKey(t) {
|
|
7357
|
+
var i = _toPrimitive(t, "string");
|
|
7358
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7359
|
+
}
|
|
7360
|
+
function _typeof(o) {
|
|
7361
|
+
"@babel/helpers - typeof";
|
|
7362
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
7363
|
+
return typeof o2;
|
|
7364
|
+
} : function(o2) {
|
|
7365
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
7366
|
+
}, _typeof(o);
|
|
7367
|
+
}
|
|
7368
|
+
var version = "1.15.7";
|
|
7200
7369
|
function userAgent(pattern) {
|
|
7201
7370
|
if (typeof window !== "undefined" && window.navigator) {
|
|
7202
7371
|
return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
|
|
@@ -7238,7 +7407,7 @@ function matches(el, selector) {
|
|
|
7238
7407
|
return false;
|
|
7239
7408
|
}
|
|
7240
7409
|
function getParentOrHost(el) {
|
|
7241
|
-
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
|
7410
|
+
return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
|
|
7242
7411
|
}
|
|
7243
7412
|
function closest(el, selector, ctx, includeCTX) {
|
|
7244
7413
|
if (el) {
|
|
@@ -7376,10 +7545,8 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
7376
7545
|
var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
|
|
7377
7546
|
while (parent) {
|
|
7378
7547
|
var parentSideVal = getRect(parent)[parentSide], visible = void 0;
|
|
7379
|
-
|
|
7548
|
+
{
|
|
7380
7549
|
visible = elSideVal >= parentSideVal;
|
|
7381
|
-
} else {
|
|
7382
|
-
visible = elSideVal <= parentSideVal;
|
|
7383
7550
|
}
|
|
7384
7551
|
if (!visible)
|
|
7385
7552
|
return parent;
|
|
@@ -8797,8 +8964,11 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
8797
8964
|
_nulling: function _nulling() {
|
|
8798
8965
|
pluginEvent2("nulling", this);
|
|
8799
8966
|
rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
|
|
8800
|
-
|
|
8801
|
-
|
|
8967
|
+
var el = this.el;
|
|
8968
|
+
savedInputChecked.forEach(function(checkEl) {
|
|
8969
|
+
if (el.contains(checkEl)) {
|
|
8970
|
+
checkEl.checked = true;
|
|
8971
|
+
}
|
|
8802
8972
|
});
|
|
8803
8973
|
savedInputChecked.length = lastDx = lastDy = 0;
|
|
8804
8974
|
},
|
|
@@ -9448,7 +9618,7 @@ var Section = class {
|
|
|
9448
9618
|
className: "form-builder-grid p-4 min-h-[100px] fields-list !gap-4",
|
|
9449
9619
|
"data-section-id": this.section.id
|
|
9450
9620
|
});
|
|
9451
|
-
const gridColumns = this.section.layout?.columns || columns
|
|
9621
|
+
const gridColumns = this.section.layout?.columns || columns;
|
|
9452
9622
|
fieldsGrid.style.gridTemplateColumns = `repeat(${gridColumns}, minmax(0, 1fr))`;
|
|
9453
9623
|
if (this.section.layout?.gap) {
|
|
9454
9624
|
fieldsGrid.style.gap = this.section.layout.gap;
|
|
@@ -10121,9 +10291,10 @@ var FormBuilder = class {
|
|
|
10121
10291
|
}
|
|
10122
10292
|
});
|
|
10123
10293
|
});
|
|
10124
|
-
|
|
10294
|
+
const payload = builderToPlatform(schema);
|
|
10295
|
+
console.log("[Form Builder] Schema being sent to app:", JSON.stringify(payload, null, 2));
|
|
10125
10296
|
if (this.options.onSave) {
|
|
10126
|
-
this.options.onSave(
|
|
10297
|
+
this.options.onSave(payload);
|
|
10127
10298
|
}
|
|
10128
10299
|
}
|
|
10129
10300
|
}, [createElement("span", { className: "", text: "Save" })]);
|
|
@@ -10565,6 +10736,89 @@ var FormBuilder = class {
|
|
|
10565
10736
|
(checked) => formStore.getState().updateField(selectedField.id, { visible: checked }),
|
|
10566
10737
|
`visible-${selectedField.id}`
|
|
10567
10738
|
));
|
|
10739
|
+
if (selectedField.type === "name_generator") {
|
|
10740
|
+
const ngHeader = createElement("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 mt-6", text: "Name Generator Settings" });
|
|
10741
|
+
body.appendChild(ngHeader);
|
|
10742
|
+
const NAME_GENERATOR_FORMATS = [
|
|
10743
|
+
{ value: "TEXT_HYPHEN_ID", text: "Text-ID (e.g. RFQ-0001)" },
|
|
10744
|
+
{ value: "TEXT_UNDERSCORE_ID", text: "Text_ID (e.g. RFQ_0001)" },
|
|
10745
|
+
{ value: "TEXT_SLASH_ID", text: "Text/ID (e.g. RFQ/0001)" },
|
|
10746
|
+
{ value: "TEXT_ID", text: "TextID (e.g. RFQ0001)" },
|
|
10747
|
+
{ value: "ID_HYPHEN_TEXT", text: "ID-Text (e.g. 0001-RFQ)" },
|
|
10748
|
+
{ value: "ID_UNDERSCORE_TEXT", text: "ID_Text (e.g. 0001_RFQ)" },
|
|
10749
|
+
{ value: "TEXT_YEAR_ID", text: "Text-Year-ID (e.g. RFQ-2026-0001)" },
|
|
10750
|
+
{ value: "TEXT_MONTH_ID", text: "Text-Month-ID (e.g. RFQ-03-0001)" },
|
|
10751
|
+
{ value: "TEXT_YEAR_MONTH_ID", text: "Text-YearMonth-ID (e.g. RFQ-202603-0001)" },
|
|
10752
|
+
{ value: "TEXT_ACCOUNT_CODE_ID", text: "Text-AccountCode-ID" },
|
|
10753
|
+
{ value: "TEXT_BRANCH_ID", text: "Text-Branch-ID" },
|
|
10754
|
+
{ value: "PREFIX_TEXT_ID", text: "Prefix-Text-ID (e.g. CRM-RFQ-0001)" },
|
|
10755
|
+
{ value: "TEXT_ID_SUFFIX", text: "Text-ID-Suffix (e.g. RFQ-0001-IND)" },
|
|
10756
|
+
{ value: "TEXT_RANDOM_4", text: "Text-Random4 (e.g. RFQ-4821)" },
|
|
10757
|
+
{ value: "TEXT_YEAR_MONTH_DAY_ID", text: "Text-Year-Month-ID" },
|
|
10758
|
+
{ value: "TEXT_HYPHEN_USER_INPUT", text: "Text-UserInput (e.g. RFQ-P001)" },
|
|
10759
|
+
{ value: "TEXT_UNDERSCORE_USER_INPUT", text: "Text_UserInput" },
|
|
10760
|
+
{ value: "TEXT_SLASH_USER_INPUT", text: "Text/UserInput" },
|
|
10761
|
+
{ value: "USER_INPUT_HYPHEN_TEXT", text: "UserInput-Text (e.g. P001-RFQ)" },
|
|
10762
|
+
{ value: "USER_INPUT_UNDERSCORE_TEXT", text: "UserInput_Text" }
|
|
10763
|
+
];
|
|
10764
|
+
const formatGroup = createElement("div", { className: "mb-3" });
|
|
10765
|
+
formatGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Format" }));
|
|
10766
|
+
const formatSelect = createElement("select", {
|
|
10767
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10768
|
+
value: selectedField.nameGeneratorFormat ?? "TEXT_ID",
|
|
10769
|
+
onchange: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorFormat: e.target.value })
|
|
10770
|
+
});
|
|
10771
|
+
NAME_GENERATOR_FORMATS.forEach((opt) => {
|
|
10772
|
+
formatSelect.appendChild(createElement("option", { value: opt.value, text: opt.text, selected: (selectedField.nameGeneratorFormat ?? "TEXT_ID") === opt.value }));
|
|
10773
|
+
});
|
|
10774
|
+
formatGroup.appendChild(formatSelect);
|
|
10775
|
+
body.appendChild(formatGroup);
|
|
10776
|
+
const staticTextGroup = createElement("div", { className: "mb-3" });
|
|
10777
|
+
staticTextGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Static Text" }));
|
|
10778
|
+
staticTextGroup.appendChild(createElement("input", {
|
|
10779
|
+
type: "text",
|
|
10780
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10781
|
+
value: selectedField.nameGeneratorText ?? "",
|
|
10782
|
+
placeholder: "e.g. RFQ",
|
|
10783
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorText: e.target.value })
|
|
10784
|
+
}));
|
|
10785
|
+
body.appendChild(staticTextGroup);
|
|
10786
|
+
const prefixGroup = createElement("div", { className: "mb-3" });
|
|
10787
|
+
prefixGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Prefix (Optional)" }));
|
|
10788
|
+
prefixGroup.appendChild(createElement("input", {
|
|
10789
|
+
type: "text",
|
|
10790
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10791
|
+
value: selectedField.nameGeneratorPrefix ?? "",
|
|
10792
|
+
placeholder: "e.g. CRM",
|
|
10793
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorPrefix: e.target.value })
|
|
10794
|
+
}));
|
|
10795
|
+
body.appendChild(prefixGroup);
|
|
10796
|
+
const suffixGroup = createElement("div", { className: "mb-3" });
|
|
10797
|
+
suffixGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Suffix (Optional)" }));
|
|
10798
|
+
suffixGroup.appendChild(createElement("input", {
|
|
10799
|
+
type: "text",
|
|
10800
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10801
|
+
value: selectedField.nameGeneratorSuffix ?? "",
|
|
10802
|
+
placeholder: "e.g. IND",
|
|
10803
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorSuffix: e.target.value })
|
|
10804
|
+
}));
|
|
10805
|
+
body.appendChild(suffixGroup);
|
|
10806
|
+
const paddingGroup2 = createElement("div", { className: "mb-3" });
|
|
10807
|
+
paddingGroup2.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "ID Padding" }));
|
|
10808
|
+
paddingGroup2.appendChild(createElement("input", {
|
|
10809
|
+
type: "number",
|
|
10810
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10811
|
+
value: String(selectedField.nameGeneratorIdPadding ?? 4),
|
|
10812
|
+
placeholder: "4",
|
|
10813
|
+
min: "1",
|
|
10814
|
+
max: "10",
|
|
10815
|
+
oninput: (e) => {
|
|
10816
|
+
const val = parseInt(e.target.value, 10);
|
|
10817
|
+
formStore.getState().updateField(selectedField.id, { nameGeneratorIdPadding: isNaN(val) ? 4 : Math.max(1, Math.min(10, val)) });
|
|
10818
|
+
}
|
|
10819
|
+
}));
|
|
10820
|
+
body.appendChild(paddingGroup2);
|
|
10821
|
+
}
|
|
10568
10822
|
if (selectedField.type === "binary_choice") {
|
|
10569
10823
|
const bcHeader = createElement("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 mt-6", text: "Yes/No Toggle Settings" });
|
|
10570
10824
|
body.appendChild(bcHeader);
|
|
@@ -10982,6 +11236,27 @@ var FormBuilder = class {
|
|
|
10982
11236
|
}
|
|
10983
11237
|
lookupLabelFieldGroup.appendChild(lookupLabelFieldSelect);
|
|
10984
11238
|
body.appendChild(lookupLabelFieldGroup);
|
|
11239
|
+
const parentFieldOptions = formStore.getState().schema.sections.flatMap((s) => s.fields).filter((f) => f.type === "select" && f.id !== selectedField.id).map((f) => ({ value: f.fieldName || f.id, label: f.label || f.fieldName || f.id }));
|
|
11240
|
+
const parentFieldGroup = createElement("div", { className: "mb-4" });
|
|
11241
|
+
parentFieldGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Filter by Parent Field" }));
|
|
11242
|
+
const parentFieldSelect = createElement("select", {
|
|
11243
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
11244
|
+
value: selectedField.lookupParentFieldName || "",
|
|
11245
|
+
onchange: (e) => {
|
|
11246
|
+
const val = e.target.value;
|
|
11247
|
+
formStore.getState().updateField(selectedField.id, { lookupParentFieldName: val || null });
|
|
11248
|
+
}
|
|
11249
|
+
});
|
|
11250
|
+
parentFieldSelect.appendChild(createElement("option", { value: "", text: "None (no parent)", selected: !selectedField.lookupParentFieldName }));
|
|
11251
|
+
parentFieldOptions.forEach((opt) => {
|
|
11252
|
+
parentFieldSelect.appendChild(createElement("option", {
|
|
11253
|
+
value: opt.value,
|
|
11254
|
+
text: opt.label,
|
|
11255
|
+
selected: selectedField.lookupParentFieldName === opt.value
|
|
11256
|
+
}));
|
|
11257
|
+
});
|
|
11258
|
+
parentFieldGroup.appendChild(parentFieldSelect);
|
|
11259
|
+
body.appendChild(parentFieldGroup);
|
|
10985
11260
|
body.appendChild(this.createCheckboxField(
|
|
10986
11261
|
"Visibility",
|
|
10987
11262
|
selectedField.visible !== false,
|
|
@@ -11488,7 +11763,7 @@ var FormBuilder = class {
|
|
|
11488
11763
|
}
|
|
11489
11764
|
updateValidations({
|
|
11490
11765
|
pattern: val || void 0,
|
|
11491
|
-
customErrorMessages: { ...validationsObj.customErrorMessages, pattern: currentPreset?.errorMessage || regexMessage
|
|
11766
|
+
customErrorMessages: { ...validationsObj.customErrorMessages, pattern: currentPreset?.errorMessage || regexMessage }
|
|
11492
11767
|
});
|
|
11493
11768
|
if (examplesList) {
|
|
11494
11769
|
if (currentPreset) {
|
|
@@ -11988,7 +12263,7 @@ var initFormBuilder = (options) => {
|
|
|
11988
12263
|
|
|
11989
12264
|
sortablejs/modular/sortable.esm.js:
|
|
11990
12265
|
(**!
|
|
11991
|
-
* Sortable 1.15.
|
|
12266
|
+
* Sortable 1.15.7
|
|
11992
12267
|
* @author RubaXa <trash@rubaxa.org>
|
|
11993
12268
|
* @author owenm <owen23355@gmail.com>
|
|
11994
12269
|
* @license MIT
|
|
@@ -12004,6 +12279,7 @@ exports.convertValidationObjectToArray = convertValidationObjectToArray;
|
|
|
12004
12279
|
exports.detectCircularDependency = detectCircularDependency;
|
|
12005
12280
|
exports.evaluateFormula = evaluateFormula;
|
|
12006
12281
|
exports.formStore = formStore;
|
|
12282
|
+
exports.generateName = generateName;
|
|
12007
12283
|
exports.getColSpanFromWidth = getColSpanFromWidth;
|
|
12008
12284
|
exports.getNumericFieldsForFormula = getNumericFieldsForFormula;
|
|
12009
12285
|
exports.getValidationConfigForAngular = getValidationConfigForAngular;
|
|
@@ -12011,6 +12287,7 @@ exports.initFormBuilder = initFormBuilder;
|
|
|
12011
12287
|
exports.parseFormulaDependencies = parseFormulaDependencies;
|
|
12012
12288
|
exports.parseWidth = parseWidth;
|
|
12013
12289
|
exports.platformToBuilder = platformToBuilder;
|
|
12290
|
+
exports.resetNameGeneratorCounter = resetNameGeneratorCounter;
|
|
12014
12291
|
exports.validateFormula = validateFormula;
|
|
12015
12292
|
//# sourceMappingURL=out.js.map
|
|
12016
12293
|
//# sourceMappingURL=index.js.map
|