form-builder-pro 1.3.6 → 1.3.8
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 +36 -4
- package/dist/index.d.ts +36 -4
- package/dist/index.js +490 -155
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +488 -156
- 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,39 +4076,12 @@ var FormSchemaValidation = external_exports.object({
|
|
|
4076
4076
|
}))
|
|
4077
4077
|
});
|
|
4078
4078
|
|
|
4079
|
-
// node_modules/zustand/esm/vanilla.mjs
|
|
4080
|
-
var createStoreImpl = (createState) => {
|
|
4081
|
-
let state;
|
|
4082
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
4083
|
-
const setState = (partial, replace) => {
|
|
4084
|
-
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
4085
|
-
if (!Object.is(nextState, state)) {
|
|
4086
|
-
const previousState = state;
|
|
4087
|
-
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
4088
|
-
listeners.forEach((listener) => listener(state, previousState));
|
|
4089
|
-
}
|
|
4090
|
-
};
|
|
4091
|
-
const getState = () => state;
|
|
4092
|
-
const getInitialState = () => initialState;
|
|
4093
|
-
const subscribe = (listener) => {
|
|
4094
|
-
listeners.add(listener);
|
|
4095
|
-
return () => listeners.delete(listener);
|
|
4096
|
-
};
|
|
4097
|
-
const destroy2 = () => {
|
|
4098
|
-
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
4099
|
-
console.warn(
|
|
4100
|
-
"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
|
|
4101
|
-
);
|
|
4102
|
-
}
|
|
4103
|
-
listeners.clear();
|
|
4104
|
-
};
|
|
4105
|
-
const api = { setState, getState, getInitialState, subscribe, destroy: destroy2 };
|
|
4106
|
-
const initialState = state = createState(setState, getState, api);
|
|
4107
|
-
return api;
|
|
4108
|
-
};
|
|
4109
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
4110
|
-
|
|
4111
4079
|
// src/core/constants.ts
|
|
4080
|
+
var LOOKUP_SOURCE_TYPE_OPTIONS = [
|
|
4081
|
+
{ value: "MODULE", label: "Module" },
|
|
4082
|
+
{ value: "MASTER_TYPE", label: "Master Type" },
|
|
4083
|
+
{ value: "SETTINGS", label: "Settings Entity" }
|
|
4084
|
+
];
|
|
4112
4085
|
var generateId = () => Math.random().toString(36).substring(2, 9);
|
|
4113
4086
|
var FIELD_TYPES = [
|
|
4114
4087
|
{ type: "text", label: "Text Input", icon: "Type" },
|
|
@@ -4125,7 +4098,8 @@ var FIELD_TYPES = [
|
|
|
4125
4098
|
{ type: "binary_choice", label: "Yes/No Toggle", icon: "ToggleLeft" },
|
|
4126
4099
|
{ type: "repeater", label: "Repeater", icon: "Copy" },
|
|
4127
4100
|
{ type: "file", label: "File Upload", icon: "Upload" },
|
|
4128
|
-
{ type: "image", label: "Image", icon: "Image" }
|
|
4101
|
+
{ type: "image", label: "Image", icon: "Image" },
|
|
4102
|
+
{ type: "name_generator", label: "Name Generator", icon: "Hash" }
|
|
4129
4103
|
];
|
|
4130
4104
|
var DEFAULT_FIELD_CONFIG = {
|
|
4131
4105
|
text: { label: "Text Input", placeholder: "Enter text...", width: "100%", enabled: true, visible: true },
|
|
@@ -4172,7 +4146,17 @@ var DEFAULT_FIELD_CONFIG = {
|
|
|
4172
4146
|
repeatIncrementEnabled: false
|
|
4173
4147
|
},
|
|
4174
4148
|
file: { label: "File Upload", width: "100%", enabled: true, visible: true },
|
|
4175
|
-
image: { label: "Image", width: "50%", enabled: true, visible: true }
|
|
4149
|
+
image: { label: "Image", width: "50%", enabled: true, visible: true },
|
|
4150
|
+
name_generator: {
|
|
4151
|
+
label: "Name Generator",
|
|
4152
|
+
placeholder: "Auto-generated",
|
|
4153
|
+
width: "100%",
|
|
4154
|
+
enabled: true,
|
|
4155
|
+
visible: true,
|
|
4156
|
+
nameGeneratorFormat: "TEXT_ID",
|
|
4157
|
+
nameGeneratorText: "",
|
|
4158
|
+
nameGeneratorIdPadding: 4
|
|
4159
|
+
}
|
|
4176
4160
|
};
|
|
4177
4161
|
var VALIDATION_TYPE_PRESETS = {
|
|
4178
4162
|
postalCode: {
|
|
@@ -4306,6 +4290,38 @@ var REGEX_PRESETS = [
|
|
|
4306
4290
|
}
|
|
4307
4291
|
];
|
|
4308
4292
|
|
|
4293
|
+
// node_modules/.pnpm/zustand@4.5.7_react@19.2.4/node_modules/zustand/esm/vanilla.mjs
|
|
4294
|
+
var createStoreImpl = (createState) => {
|
|
4295
|
+
let state;
|
|
4296
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4297
|
+
const setState = (partial, replace) => {
|
|
4298
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
4299
|
+
if (!Object.is(nextState, state)) {
|
|
4300
|
+
const previousState = state;
|
|
4301
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
4302
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
4303
|
+
}
|
|
4304
|
+
};
|
|
4305
|
+
const getState = () => state;
|
|
4306
|
+
const getInitialState = () => initialState;
|
|
4307
|
+
const subscribe = (listener) => {
|
|
4308
|
+
listeners.add(listener);
|
|
4309
|
+
return () => listeners.delete(listener);
|
|
4310
|
+
};
|
|
4311
|
+
const destroy2 = () => {
|
|
4312
|
+
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
4313
|
+
console.warn(
|
|
4314
|
+
"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
|
|
4315
|
+
);
|
|
4316
|
+
}
|
|
4317
|
+
listeners.clear();
|
|
4318
|
+
};
|
|
4319
|
+
const api = { setState, getState, getInitialState, subscribe, destroy: destroy2 };
|
|
4320
|
+
const initialState = state = createState(setState, getState, api);
|
|
4321
|
+
return api;
|
|
4322
|
+
};
|
|
4323
|
+
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
4324
|
+
|
|
4309
4325
|
// src/utils/clone.ts
|
|
4310
4326
|
var cloneForm = (schema) => {
|
|
4311
4327
|
return {
|
|
@@ -4487,6 +4503,8 @@ function normalizeFieldType(type) {
|
|
|
4487
4503
|
return "repeater";
|
|
4488
4504
|
if (str === "DATETIME" || normalized === "datetime")
|
|
4489
4505
|
return "datetime";
|
|
4506
|
+
if (str === "NAME_GENERATOR" || normalized === "namegenerator")
|
|
4507
|
+
return "name_generator";
|
|
4490
4508
|
return str.toLowerCase();
|
|
4491
4509
|
}
|
|
4492
4510
|
function transformField(field) {
|
|
@@ -4628,16 +4646,19 @@ function transformField(field) {
|
|
|
4628
4646
|
let lookupSource;
|
|
4629
4647
|
let lookupValueField;
|
|
4630
4648
|
let lookupLabelField;
|
|
4649
|
+
let lookupParentFieldName;
|
|
4631
4650
|
if (field.lookup) {
|
|
4632
4651
|
lookupSourceType = field.lookup.sourceType;
|
|
4633
4652
|
lookupSource = field.lookup.sourceKey || field.lookup.source;
|
|
4634
4653
|
lookupValueField = field.lookup.valueField;
|
|
4635
4654
|
lookupLabelField = field.lookup.labelField;
|
|
4655
|
+
lookupParentFieldName = field.lookup.parentFieldName ?? void 0;
|
|
4636
4656
|
} else {
|
|
4637
4657
|
lookupSourceType = field.lookupSourceType;
|
|
4638
4658
|
lookupSource = field.lookupSource;
|
|
4639
4659
|
lookupValueField = field.lookupValueField;
|
|
4640
4660
|
lookupLabelField = field.lookupLabelField;
|
|
4661
|
+
lookupParentFieldName = field.lookupParentFieldName;
|
|
4641
4662
|
}
|
|
4642
4663
|
if (["select", "radio", "checkbox"].includes(normalizedType)) {
|
|
4643
4664
|
if (field.optionSource) {
|
|
@@ -4660,6 +4681,8 @@ function transformField(field) {
|
|
|
4660
4681
|
transformed.lookupValueField = lookupValueField;
|
|
4661
4682
|
if (lookupLabelField !== void 0)
|
|
4662
4683
|
transformed.lookupLabelField = lookupLabelField;
|
|
4684
|
+
if (lookupParentFieldName !== void 0)
|
|
4685
|
+
transformed.lookupParentFieldName = lookupParentFieldName || null;
|
|
4663
4686
|
if (field.fieldName !== void 0)
|
|
4664
4687
|
transformed.fieldName = field.fieldName;
|
|
4665
4688
|
else if (field.name !== void 0)
|
|
@@ -4678,6 +4701,8 @@ function transformField(field) {
|
|
|
4678
4701
|
transformed.enabled = field.enabled;
|
|
4679
4702
|
if (field.visible !== void 0)
|
|
4680
4703
|
transformed.visible = field.visible;
|
|
4704
|
+
if (field.isUnique !== void 0)
|
|
4705
|
+
transformed.isUnique = field.isUnique;
|
|
4681
4706
|
if (field.isd !== void 0)
|
|
4682
4707
|
transformed.isd = field.isd;
|
|
4683
4708
|
if (field.imageUrl !== void 0)
|
|
@@ -4708,6 +4733,16 @@ function transformField(field) {
|
|
|
4708
4733
|
transformed.repeatIncrementEnabled = field.repeatIncrementEnabled;
|
|
4709
4734
|
if (field.dateConstraints !== void 0)
|
|
4710
4735
|
transformed.dateConstraints = field.dateConstraints;
|
|
4736
|
+
if (field.nameGeneratorFormat !== void 0)
|
|
4737
|
+
transformed.nameGeneratorFormat = field.nameGeneratorFormat;
|
|
4738
|
+
if (field.nameGeneratorText !== void 0)
|
|
4739
|
+
transformed.nameGeneratorText = field.nameGeneratorText;
|
|
4740
|
+
if (field.nameGeneratorPrefix !== void 0)
|
|
4741
|
+
transformed.nameGeneratorPrefix = field.nameGeneratorPrefix;
|
|
4742
|
+
if (field.nameGeneratorSuffix !== void 0)
|
|
4743
|
+
transformed.nameGeneratorSuffix = field.nameGeneratorSuffix;
|
|
4744
|
+
if (field.nameGeneratorIdPadding !== void 0)
|
|
4745
|
+
transformed.nameGeneratorIdPadding = field.nameGeneratorIdPadding;
|
|
4711
4746
|
if (field.css !== void 0)
|
|
4712
4747
|
transformed.css = field.css;
|
|
4713
4748
|
if (field.optionsSource !== void 0)
|
|
@@ -4903,6 +4938,8 @@ function fieldToPayload(field) {
|
|
|
4903
4938
|
payload.enabled = field.enabled;
|
|
4904
4939
|
if (field.visible !== void 0)
|
|
4905
4940
|
payload.visible = field.visible;
|
|
4941
|
+
if (field.isUnique !== void 0)
|
|
4942
|
+
payload.isUnique = field.isUnique;
|
|
4906
4943
|
if (field.css !== void 0)
|
|
4907
4944
|
payload.css = field.css;
|
|
4908
4945
|
if (field.optionSource !== void 0)
|
|
@@ -4923,6 +4960,20 @@ function fieldToPayload(field) {
|
|
|
4923
4960
|
payload.lookupValueField = field.lookupValueField;
|
|
4924
4961
|
if (field.lookupLabelField !== void 0)
|
|
4925
4962
|
payload.lookupLabelField = field.lookupLabelField;
|
|
4963
|
+
if (field.optionSource === "LOOKUP") {
|
|
4964
|
+
payload.parentFieldName = field.lookupParentFieldName ?? null;
|
|
4965
|
+
}
|
|
4966
|
+
if (field.lookupParentFieldName !== void 0)
|
|
4967
|
+
payload.lookupParentFieldName = field.lookupParentFieldName;
|
|
4968
|
+
if (field.optionSource === "LOOKUP" && (field.lookupSourceType || field.lookupSource)) {
|
|
4969
|
+
payload.lookup = {
|
|
4970
|
+
sourceType: field.lookupSourceType || "MODULE",
|
|
4971
|
+
sourceKey: field.lookupSource || "",
|
|
4972
|
+
valueField: field.lookupValueField || "",
|
|
4973
|
+
labelField: field.lookupLabelField || "",
|
|
4974
|
+
parentFieldName: field.lookupParentFieldName ?? null
|
|
4975
|
+
};
|
|
4976
|
+
}
|
|
4926
4977
|
if (field.isd !== void 0)
|
|
4927
4978
|
payload.isd = field.isd;
|
|
4928
4979
|
if (field.imageUrl !== void 0)
|
|
@@ -4938,6 +4989,20 @@ function fieldToPayload(field) {
|
|
|
4938
4989
|
}
|
|
4939
4990
|
if (field.dateConstraints !== void 0)
|
|
4940
4991
|
payload.dateConstraints = field.dateConstraints;
|
|
4992
|
+
if (field.type === "name_generator") {
|
|
4993
|
+
payload.fieldType = "NAME_GENERATOR";
|
|
4994
|
+
payload.type = "name_generator";
|
|
4995
|
+
if (field.nameGeneratorFormat !== void 0)
|
|
4996
|
+
payload.nameGeneratorFormat = field.nameGeneratorFormat;
|
|
4997
|
+
if (field.nameGeneratorIdPadding !== void 0)
|
|
4998
|
+
payload.nameGeneratorIdPadding = field.nameGeneratorIdPadding;
|
|
4999
|
+
if (field.nameGeneratorPrefix !== void 0)
|
|
5000
|
+
payload.nameGeneratorPrefix = field.nameGeneratorPrefix;
|
|
5001
|
+
if (field.nameGeneratorSuffix !== void 0)
|
|
5002
|
+
payload.nameGeneratorSuffix = field.nameGeneratorSuffix;
|
|
5003
|
+
if (field.nameGeneratorText !== void 0)
|
|
5004
|
+
payload.nameGeneratorText = field.nameGeneratorText;
|
|
5005
|
+
}
|
|
4941
5006
|
if (field.type === "datetime") {
|
|
4942
5007
|
payload.fieldType = "DATETIME";
|
|
4943
5008
|
}
|
|
@@ -6012,6 +6077,93 @@ function getDefaultCountry() {
|
|
|
6012
6077
|
return INDIA;
|
|
6013
6078
|
}
|
|
6014
6079
|
|
|
6080
|
+
// src/utils/nameGenerator.ts
|
|
6081
|
+
var sessionIdCounter = 1;
|
|
6082
|
+
function resetNameGeneratorCounter() {
|
|
6083
|
+
sessionIdCounter = 1;
|
|
6084
|
+
}
|
|
6085
|
+
function getNextId(padding) {
|
|
6086
|
+
const id = String(sessionIdCounter).padStart(Math.max(1, padding), "0");
|
|
6087
|
+
sessionIdCounter += 1;
|
|
6088
|
+
return id;
|
|
6089
|
+
}
|
|
6090
|
+
function getRandom4() {
|
|
6091
|
+
return String(Math.floor(1e3 + Math.random() * 9e3));
|
|
6092
|
+
}
|
|
6093
|
+
function getYear() {
|
|
6094
|
+
return String((/* @__PURE__ */ new Date()).getFullYear());
|
|
6095
|
+
}
|
|
6096
|
+
function getMonth() {
|
|
6097
|
+
return String((/* @__PURE__ */ new Date()).getMonth() + 1).padStart(2, "0");
|
|
6098
|
+
}
|
|
6099
|
+
function getDay() {
|
|
6100
|
+
return String((/* @__PURE__ */ new Date()).getDate()).padStart(2, "0");
|
|
6101
|
+
}
|
|
6102
|
+
function getYearMonth() {
|
|
6103
|
+
return getYear() + getMonth();
|
|
6104
|
+
}
|
|
6105
|
+
function getYearMonthDay() {
|
|
6106
|
+
return `${getYear()}-${getMonth()}-${getDay()}`;
|
|
6107
|
+
}
|
|
6108
|
+
function generateName(fieldConfig, userInput) {
|
|
6109
|
+
const format = fieldConfig.nameGeneratorFormat ?? "TEXT_ID";
|
|
6110
|
+
const text = fieldConfig.nameGeneratorText?.trim() || "RFQ";
|
|
6111
|
+
const prefix = fieldConfig.nameGeneratorPrefix ?? "";
|
|
6112
|
+
const suffix = fieldConfig.nameGeneratorSuffix ?? "";
|
|
6113
|
+
const padding = Math.max(1, fieldConfig.nameGeneratorIdPadding ?? 4);
|
|
6114
|
+
const id = getNextId(padding);
|
|
6115
|
+
const userVal = userInput ?? "";
|
|
6116
|
+
const sep = {
|
|
6117
|
+
hyphen: "-",
|
|
6118
|
+
underscore: "_",
|
|
6119
|
+
slash: "/"
|
|
6120
|
+
};
|
|
6121
|
+
switch (format) {
|
|
6122
|
+
case "TEXT_HYPHEN_ID":
|
|
6123
|
+
return `${text}${sep.hyphen}${id}`;
|
|
6124
|
+
case "TEXT_UNDERSCORE_ID":
|
|
6125
|
+
return `${text}${sep.underscore}${id}`;
|
|
6126
|
+
case "TEXT_SLASH_ID":
|
|
6127
|
+
return `${text}${sep.slash}${id}`;
|
|
6128
|
+
case "TEXT_ID":
|
|
6129
|
+
return `${text}${id}`;
|
|
6130
|
+
case "ID_HYPHEN_TEXT":
|
|
6131
|
+
return `${id}${sep.hyphen}${text}`;
|
|
6132
|
+
case "ID_UNDERSCORE_TEXT":
|
|
6133
|
+
return `${id}${sep.underscore}${text}`;
|
|
6134
|
+
case "TEXT_YEAR_ID":
|
|
6135
|
+
return `${text}${sep.hyphen}${getYear()}${sep.hyphen}${id}`;
|
|
6136
|
+
case "TEXT_MONTH_ID":
|
|
6137
|
+
return `${text}${sep.hyphen}${getMonth()}${sep.hyphen}${id}`;
|
|
6138
|
+
case "TEXT_YEAR_MONTH_ID":
|
|
6139
|
+
return `${text}${sep.hyphen}${getYearMonth()}${sep.hyphen}${id}`;
|
|
6140
|
+
case "TEXT_ACCOUNT_CODE_ID":
|
|
6141
|
+
return `${text}${sep.hyphen}AccountCode${sep.hyphen}${id}`;
|
|
6142
|
+
case "TEXT_BRANCH_ID":
|
|
6143
|
+
return `${text}${sep.hyphen}Branch${sep.hyphen}${id}`;
|
|
6144
|
+
case "PREFIX_TEXT_ID":
|
|
6145
|
+
return `${prefix || "CRM"}${sep.hyphen}${text}${sep.hyphen}${id}`;
|
|
6146
|
+
case "TEXT_ID_SUFFIX":
|
|
6147
|
+
return `${text}${sep.hyphen}${id}${sep.hyphen}${suffix || "IND"}`;
|
|
6148
|
+
case "TEXT_RANDOM_4":
|
|
6149
|
+
return `${text}${sep.hyphen}${getRandom4()}`;
|
|
6150
|
+
case "TEXT_YEAR_MONTH_DAY_ID":
|
|
6151
|
+
return `${text}${sep.hyphen}${getYearMonthDay()}${sep.hyphen}${id}`;
|
|
6152
|
+
case "TEXT_HYPHEN_USER_INPUT":
|
|
6153
|
+
return `${text}${sep.hyphen}${userVal || "P001"}`;
|
|
6154
|
+
case "TEXT_UNDERSCORE_USER_INPUT":
|
|
6155
|
+
return `${text}${sep.underscore}${userVal || "P001"}`;
|
|
6156
|
+
case "TEXT_SLASH_USER_INPUT":
|
|
6157
|
+
return `${text}${sep.slash}${userVal || "P001"}`;
|
|
6158
|
+
case "USER_INPUT_HYPHEN_TEXT":
|
|
6159
|
+
return `${userVal || "P001"}${sep.hyphen}${text}`;
|
|
6160
|
+
case "USER_INPUT_UNDERSCORE_TEXT":
|
|
6161
|
+
return `${userVal || "P001"}${sep.underscore}${text}`;
|
|
6162
|
+
default:
|
|
6163
|
+
return `${text}${id}`;
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
|
|
6015
6167
|
// src/renderer/FieldRenderer.ts
|
|
6016
6168
|
function getValidationRules(field) {
|
|
6017
6169
|
const v = field.validations;
|
|
@@ -6302,13 +6454,19 @@ var FieldRenderer = class {
|
|
|
6302
6454
|
oninput: (e) => onChange?.(e.target.value)
|
|
6303
6455
|
});
|
|
6304
6456
|
break;
|
|
6305
|
-
case "select":
|
|
6457
|
+
case "select": {
|
|
6458
|
+
const isLookupWithParent = field.optionSource === "LOOKUP" && field.lookupParentFieldName;
|
|
6459
|
+
const parentValue = formData?.[field.lookupParentFieldName];
|
|
6460
|
+
const parentNotSelected = Boolean(isLookupWithParent && (parentValue === void 0 || parentValue === null || parentValue === ""));
|
|
6461
|
+
const effectiveOptions = parentNotSelected ? [] : field.options || [];
|
|
6462
|
+
const placeholder = parentNotSelected ? "Select parent first" : "Select an option";
|
|
6463
|
+
const selectDisabled = !isEnabled || parentNotSelected;
|
|
6306
6464
|
const isMultiSelect = field.multiSelect === true || field.multiselect === true;
|
|
6307
6465
|
if (isMultiSelect) {
|
|
6308
6466
|
input = createElement("select", {
|
|
6309
6467
|
multiple: true,
|
|
6310
6468
|
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:
|
|
6469
|
+
disabled: selectDisabled,
|
|
6312
6470
|
onchange: (e) => {
|
|
6313
6471
|
const select = e.target;
|
|
6314
6472
|
const selectedValues = Array.from(select.selectedOptions).map((opt) => opt.value);
|
|
@@ -6316,7 +6474,7 @@ var FieldRenderer = class {
|
|
|
6316
6474
|
}
|
|
6317
6475
|
});
|
|
6318
6476
|
const currentValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
6319
|
-
|
|
6477
|
+
effectiveOptions.forEach((opt) => {
|
|
6320
6478
|
const option2 = createElement("option", { value: opt.value, text: opt.label });
|
|
6321
6479
|
if (currentValues.includes(opt.value)) {
|
|
6322
6480
|
option2.selected = true;
|
|
@@ -6327,15 +6485,16 @@ var FieldRenderer = class {
|
|
|
6327
6485
|
input = createElement("select", {
|
|
6328
6486
|
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
6487
|
value: value || "",
|
|
6330
|
-
disabled:
|
|
6488
|
+
disabled: selectDisabled,
|
|
6331
6489
|
onchange: (e) => onChange?.(e.target.value)
|
|
6332
6490
|
});
|
|
6333
|
-
input.appendChild(createElement("option", { value: "", text:
|
|
6334
|
-
|
|
6491
|
+
input.appendChild(createElement("option", { value: "", text: placeholder, disabled: true, selected: !value }));
|
|
6492
|
+
effectiveOptions.forEach((opt) => {
|
|
6335
6493
|
input.appendChild(createElement("option", { value: opt.value, text: opt.label, selected: value === opt.value }));
|
|
6336
6494
|
});
|
|
6337
6495
|
}
|
|
6338
6496
|
break;
|
|
6497
|
+
}
|
|
6339
6498
|
case "checkbox":
|
|
6340
6499
|
if (field.options && field.options.length > 0) {
|
|
6341
6500
|
input = createElement("div", { className: "flex flex-wrap gap-x-4 gap-y-2" });
|
|
@@ -6500,6 +6659,18 @@ var FieldRenderer = class {
|
|
|
6500
6659
|
case "image":
|
|
6501
6660
|
input = this.renderImageField(field, value ?? field.imageUrl ?? field.defaultValue, onChange, isEnabled);
|
|
6502
6661
|
break;
|
|
6662
|
+
case "name_generator": {
|
|
6663
|
+
const displayValue = value ?? generateName(field);
|
|
6664
|
+
input = createElement("input", {
|
|
6665
|
+
type: "text",
|
|
6666
|
+
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",
|
|
6667
|
+
placeholder: field.placeholder || "Auto-generated",
|
|
6668
|
+
value: displayValue,
|
|
6669
|
+
readonly: true,
|
|
6670
|
+
disabled: true
|
|
6671
|
+
});
|
|
6672
|
+
break;
|
|
6673
|
+
}
|
|
6503
6674
|
default:
|
|
6504
6675
|
const rules = getValidationRules(field);
|
|
6505
6676
|
const useNumericTextInput = field.type === "text" && isNumericTextField(field);
|
|
@@ -6560,10 +6731,7 @@ var FieldRenderer = class {
|
|
|
6560
6731
|
const isdConfig = field.isd || {
|
|
6561
6732
|
enabled: true,
|
|
6562
6733
|
defaultCode: "+91",
|
|
6563
|
-
showFlag: true
|
|
6564
|
-
showCountryName: false,
|
|
6565
|
-
allowCustomCode: false
|
|
6566
|
-
};
|
|
6734
|
+
showFlag: true};
|
|
6567
6735
|
let currentIsd = isdConfig.defaultCode;
|
|
6568
6736
|
let currentNumber = "";
|
|
6569
6737
|
if (value) {
|
|
@@ -6893,6 +7061,17 @@ function getFieldValidationError(field, fieldValue, allFields, formData) {
|
|
|
6893
7061
|
function getModelKey(field) {
|
|
6894
7062
|
return field.fieldName ?? field.id;
|
|
6895
7063
|
}
|
|
7064
|
+
function getLookupChildrenOfParent(schema, parentModelKey) {
|
|
7065
|
+
const children = [];
|
|
7066
|
+
for (const section of schema.sections) {
|
|
7067
|
+
for (const field of section.fields) {
|
|
7068
|
+
if (field.type === "select" && field.optionSource === "LOOKUP" && field.lookupParentFieldName === parentModelKey) {
|
|
7069
|
+
children.push(field);
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
return children;
|
|
7074
|
+
}
|
|
6896
7075
|
function buildFormulaValuesMap(schema, data) {
|
|
6897
7076
|
const values = {};
|
|
6898
7077
|
const allFields = schema.sections.flatMap((s) => s.fields);
|
|
@@ -7007,6 +7186,12 @@ var FormRenderer = class {
|
|
|
7007
7186
|
const computed = computeFormulaValue(field, this.schema, this.data);
|
|
7008
7187
|
fieldValue = computed;
|
|
7009
7188
|
this.data[modelKey] = computed;
|
|
7189
|
+
} else if (field.type === "name_generator") {
|
|
7190
|
+
fieldValue = this.data[modelKey];
|
|
7191
|
+
if (!fieldValue) {
|
|
7192
|
+
fieldValue = generateName(field);
|
|
7193
|
+
this.data[modelKey] = fieldValue;
|
|
7194
|
+
}
|
|
7010
7195
|
} else if (field.type === "image") {
|
|
7011
7196
|
fieldValue = this.data[modelKey] ?? field.imageUrl ?? field.defaultValue;
|
|
7012
7197
|
} else {
|
|
@@ -7024,6 +7209,15 @@ var FormRenderer = class {
|
|
|
7024
7209
|
value: val || ""
|
|
7025
7210
|
});
|
|
7026
7211
|
}
|
|
7212
|
+
const lookupChildren = getLookupChildrenOfParent(this.schema, modelKey);
|
|
7213
|
+
if (lookupChildren.length > 0) {
|
|
7214
|
+
for (const child of lookupChildren) {
|
|
7215
|
+
const childKey = getModelKey(child);
|
|
7216
|
+
this.data[childKey] = null;
|
|
7217
|
+
}
|
|
7218
|
+
this.render();
|
|
7219
|
+
return;
|
|
7220
|
+
}
|
|
7027
7221
|
if (isFormulaDependency(this.schema, modelKey, field.id)) {
|
|
7028
7222
|
this.render();
|
|
7029
7223
|
return;
|
|
@@ -7093,110 +7287,94 @@ var FormRenderer = class {
|
|
|
7093
7287
|
}
|
|
7094
7288
|
};
|
|
7095
7289
|
|
|
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;
|
|
7290
|
+
// node_modules/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js
|
|
7291
|
+
function _defineProperty(e, r, t) {
|
|
7292
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
7293
|
+
value: t,
|
|
7294
|
+
enumerable: true,
|
|
7295
|
+
configurable: true,
|
|
7296
|
+
writable: true
|
|
7297
|
+
}) : e[r] = t, e;
|
|
7109
7298
|
}
|
|
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;
|
|
7299
|
+
function _extends() {
|
|
7300
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
7301
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
7302
|
+
var t = arguments[e];
|
|
7303
|
+
for (var r in t)
|
|
7304
|
+
({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
7305
|
+
}
|
|
7306
|
+
return n;
|
|
7307
|
+
}, _extends.apply(null, arguments);
|
|
7126
7308
|
}
|
|
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
|
-
};
|
|
7309
|
+
function ownKeys(e, r) {
|
|
7310
|
+
var t = Object.keys(e);
|
|
7311
|
+
if (Object.getOwnPropertySymbols) {
|
|
7312
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7313
|
+
r && (o = o.filter(function(r2) {
|
|
7314
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
7315
|
+
})), t.push.apply(t, o);
|
|
7137
7316
|
}
|
|
7138
|
-
return
|
|
7317
|
+
return t;
|
|
7139
7318
|
}
|
|
7140
|
-
function
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7319
|
+
function _objectSpread2(e) {
|
|
7320
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
7321
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
7322
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
7323
|
+
_defineProperty(e, r2, t[r2]);
|
|
7324
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
7325
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
7147
7326
|
});
|
|
7148
|
-
} else {
|
|
7149
|
-
obj[key] = value;
|
|
7150
7327
|
}
|
|
7151
|
-
return
|
|
7328
|
+
return e;
|
|
7152
7329
|
}
|
|
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)
|
|
7330
|
+
function _objectWithoutProperties(e, t) {
|
|
7331
|
+
if (null == e)
|
|
7169
7332
|
return {};
|
|
7170
|
-
var
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
if (excluded.indexOf(key) >= 0)
|
|
7176
|
-
continue;
|
|
7177
|
-
target[key] = source[key];
|
|
7333
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
7334
|
+
if (Object.getOwnPropertySymbols) {
|
|
7335
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
7336
|
+
for (r = 0; r < n.length; r++)
|
|
7337
|
+
o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
7178
7338
|
}
|
|
7179
|
-
return
|
|
7339
|
+
return i;
|
|
7180
7340
|
}
|
|
7181
|
-
function
|
|
7182
|
-
if (
|
|
7341
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
7342
|
+
if (null == r)
|
|
7183
7343
|
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)
|
|
7191
|
-
continue;
|
|
7192
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
7344
|
+
var t = {};
|
|
7345
|
+
for (var n in r)
|
|
7346
|
+
if ({}.hasOwnProperty.call(r, n)) {
|
|
7347
|
+
if (-1 !== e.indexOf(n))
|
|
7193
7348
|
continue;
|
|
7194
|
-
|
|
7349
|
+
t[n] = r[n];
|
|
7195
7350
|
}
|
|
7196
|
-
|
|
7197
|
-
|
|
7351
|
+
return t;
|
|
7352
|
+
}
|
|
7353
|
+
function _toPrimitive(t, r) {
|
|
7354
|
+
if ("object" != typeof t || !t)
|
|
7355
|
+
return t;
|
|
7356
|
+
var e = t[Symbol.toPrimitive];
|
|
7357
|
+
if (void 0 !== e) {
|
|
7358
|
+
var i = e.call(t, r);
|
|
7359
|
+
if ("object" != typeof i)
|
|
7360
|
+
return i;
|
|
7361
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7362
|
+
}
|
|
7363
|
+
return ("string" === r ? String : Number)(t);
|
|
7364
|
+
}
|
|
7365
|
+
function _toPropertyKey(t) {
|
|
7366
|
+
var i = _toPrimitive(t, "string");
|
|
7367
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7198
7368
|
}
|
|
7199
|
-
|
|
7369
|
+
function _typeof(o) {
|
|
7370
|
+
"@babel/helpers - typeof";
|
|
7371
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
7372
|
+
return typeof o2;
|
|
7373
|
+
} : function(o2) {
|
|
7374
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
7375
|
+
}, _typeof(o);
|
|
7376
|
+
}
|
|
7377
|
+
var version = "1.15.7";
|
|
7200
7378
|
function userAgent(pattern) {
|
|
7201
7379
|
if (typeof window !== "undefined" && window.navigator) {
|
|
7202
7380
|
return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
|
|
@@ -7238,7 +7416,7 @@ function matches(el, selector) {
|
|
|
7238
7416
|
return false;
|
|
7239
7417
|
}
|
|
7240
7418
|
function getParentOrHost(el) {
|
|
7241
|
-
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
|
7419
|
+
return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
|
|
7242
7420
|
}
|
|
7243
7421
|
function closest(el, selector, ctx, includeCTX) {
|
|
7244
7422
|
if (el) {
|
|
@@ -7376,10 +7554,8 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
7376
7554
|
var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
|
|
7377
7555
|
while (parent) {
|
|
7378
7556
|
var parentSideVal = getRect(parent)[parentSide], visible = void 0;
|
|
7379
|
-
|
|
7557
|
+
{
|
|
7380
7558
|
visible = elSideVal >= parentSideVal;
|
|
7381
|
-
} else {
|
|
7382
|
-
visible = elSideVal <= parentSideVal;
|
|
7383
7559
|
}
|
|
7384
7560
|
if (!visible)
|
|
7385
7561
|
return parent;
|
|
@@ -8797,8 +8973,11 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
8797
8973
|
_nulling: function _nulling() {
|
|
8798
8974
|
pluginEvent2("nulling", this);
|
|
8799
8975
|
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
|
-
|
|
8976
|
+
var el = this.el;
|
|
8977
|
+
savedInputChecked.forEach(function(checkEl) {
|
|
8978
|
+
if (el.contains(checkEl)) {
|
|
8979
|
+
checkEl.checked = true;
|
|
8980
|
+
}
|
|
8802
8981
|
});
|
|
8803
8982
|
savedInputChecked.length = lastDx = lastDy = 0;
|
|
8804
8983
|
},
|
|
@@ -9448,7 +9627,7 @@ var Section = class {
|
|
|
9448
9627
|
className: "form-builder-grid p-4 min-h-[100px] fields-list !gap-4",
|
|
9449
9628
|
"data-section-id": this.section.id
|
|
9450
9629
|
});
|
|
9451
|
-
const gridColumns = this.section.layout?.columns || columns
|
|
9630
|
+
const gridColumns = this.section.layout?.columns || columns;
|
|
9452
9631
|
fieldsGrid.style.gridTemplateColumns = `repeat(${gridColumns}, minmax(0, 1fr))`;
|
|
9453
9632
|
if (this.section.layout?.gap) {
|
|
9454
9633
|
fieldsGrid.style.gap = this.section.layout.gap;
|
|
@@ -10121,9 +10300,10 @@ var FormBuilder = class {
|
|
|
10121
10300
|
}
|
|
10122
10301
|
});
|
|
10123
10302
|
});
|
|
10124
|
-
|
|
10303
|
+
const payload = builderToPlatform(schema);
|
|
10304
|
+
console.log("[Form Builder] Schema being sent to app:", JSON.stringify(payload, null, 2));
|
|
10125
10305
|
if (this.options.onSave) {
|
|
10126
|
-
this.options.onSave(
|
|
10306
|
+
this.options.onSave(payload);
|
|
10127
10307
|
}
|
|
10128
10308
|
}
|
|
10129
10309
|
}, [createElement("span", { className: "", text: "Save" })]);
|
|
@@ -10565,6 +10745,95 @@ var FormBuilder = class {
|
|
|
10565
10745
|
(checked) => formStore.getState().updateField(selectedField.id, { visible: checked }),
|
|
10566
10746
|
`visible-${selectedField.id}`
|
|
10567
10747
|
));
|
|
10748
|
+
body.appendChild(this.createCheckboxField(
|
|
10749
|
+
"Unique",
|
|
10750
|
+
selectedField.isUnique === true,
|
|
10751
|
+
(checked) => formStore.getState().updateField(selectedField.id, { isUnique: checked }),
|
|
10752
|
+
`unique-${selectedField.id}`
|
|
10753
|
+
));
|
|
10754
|
+
if (selectedField.type === "name_generator") {
|
|
10755
|
+
const ngHeader = createElement("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 mt-6", text: "Name Generator Settings" });
|
|
10756
|
+
body.appendChild(ngHeader);
|
|
10757
|
+
const NAME_GENERATOR_FORMATS = [
|
|
10758
|
+
{ value: "TEXT_HYPHEN_ID", text: "Text-ID (e.g. RFQ-0001)" },
|
|
10759
|
+
{ value: "TEXT_UNDERSCORE_ID", text: "Text_ID (e.g. RFQ_0001)" },
|
|
10760
|
+
{ value: "TEXT_SLASH_ID", text: "Text/ID (e.g. RFQ/0001)" },
|
|
10761
|
+
{ value: "TEXT_ID", text: "TextID (e.g. RFQ0001)" },
|
|
10762
|
+
{ value: "ID_HYPHEN_TEXT", text: "ID-Text (e.g. 0001-RFQ)" },
|
|
10763
|
+
{ value: "ID_UNDERSCORE_TEXT", text: "ID_Text (e.g. 0001_RFQ)" },
|
|
10764
|
+
{ value: "TEXT_YEAR_ID", text: "Text-Year-ID (e.g. RFQ-2026-0001)" },
|
|
10765
|
+
{ value: "TEXT_MONTH_ID", text: "Text-Month-ID (e.g. RFQ-03-0001)" },
|
|
10766
|
+
{ value: "TEXT_YEAR_MONTH_ID", text: "Text-YearMonth-ID (e.g. RFQ-202603-0001)" },
|
|
10767
|
+
{ value: "TEXT_ACCOUNT_CODE_ID", text: "Text-AccountCode-ID" },
|
|
10768
|
+
{ value: "TEXT_BRANCH_ID", text: "Text-Branch-ID" },
|
|
10769
|
+
{ value: "PREFIX_TEXT_ID", text: "Prefix-Text-ID (e.g. CRM-RFQ-0001)" },
|
|
10770
|
+
{ value: "TEXT_ID_SUFFIX", text: "Text-ID-Suffix (e.g. RFQ-0001-IND)" },
|
|
10771
|
+
{ value: "TEXT_RANDOM_4", text: "Text-Random4 (e.g. RFQ-4821)" },
|
|
10772
|
+
{ value: "TEXT_YEAR_MONTH_DAY_ID", text: "Text-Year-Month-ID" },
|
|
10773
|
+
{ value: "TEXT_HYPHEN_USER_INPUT", text: "Text-UserInput (e.g. RFQ-P001)" },
|
|
10774
|
+
{ value: "TEXT_UNDERSCORE_USER_INPUT", text: "Text_UserInput" },
|
|
10775
|
+
{ value: "TEXT_SLASH_USER_INPUT", text: "Text/UserInput" },
|
|
10776
|
+
{ value: "USER_INPUT_HYPHEN_TEXT", text: "UserInput-Text (e.g. P001-RFQ)" },
|
|
10777
|
+
{ value: "USER_INPUT_UNDERSCORE_TEXT", text: "UserInput_Text" }
|
|
10778
|
+
];
|
|
10779
|
+
const formatGroup = createElement("div", { className: "mb-3" });
|
|
10780
|
+
formatGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Format" }));
|
|
10781
|
+
const formatSelect = createElement("select", {
|
|
10782
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10783
|
+
value: selectedField.nameGeneratorFormat ?? "TEXT_ID",
|
|
10784
|
+
onchange: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorFormat: e.target.value })
|
|
10785
|
+
});
|
|
10786
|
+
NAME_GENERATOR_FORMATS.forEach((opt) => {
|
|
10787
|
+
formatSelect.appendChild(createElement("option", { value: opt.value, text: opt.text, selected: (selectedField.nameGeneratorFormat ?? "TEXT_ID") === opt.value }));
|
|
10788
|
+
});
|
|
10789
|
+
formatGroup.appendChild(formatSelect);
|
|
10790
|
+
body.appendChild(formatGroup);
|
|
10791
|
+
const staticTextGroup = createElement("div", { className: "mb-3" });
|
|
10792
|
+
staticTextGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Static Text" }));
|
|
10793
|
+
staticTextGroup.appendChild(createElement("input", {
|
|
10794
|
+
type: "text",
|
|
10795
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10796
|
+
value: selectedField.nameGeneratorText ?? "",
|
|
10797
|
+
placeholder: "e.g. RFQ",
|
|
10798
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorText: e.target.value })
|
|
10799
|
+
}));
|
|
10800
|
+
body.appendChild(staticTextGroup);
|
|
10801
|
+
const prefixGroup = createElement("div", { className: "mb-3" });
|
|
10802
|
+
prefixGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Prefix (Optional)" }));
|
|
10803
|
+
prefixGroup.appendChild(createElement("input", {
|
|
10804
|
+
type: "text",
|
|
10805
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10806
|
+
value: selectedField.nameGeneratorPrefix ?? "",
|
|
10807
|
+
placeholder: "e.g. CRM",
|
|
10808
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorPrefix: e.target.value })
|
|
10809
|
+
}));
|
|
10810
|
+
body.appendChild(prefixGroup);
|
|
10811
|
+
const suffixGroup = createElement("div", { className: "mb-3" });
|
|
10812
|
+
suffixGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Suffix (Optional)" }));
|
|
10813
|
+
suffixGroup.appendChild(createElement("input", {
|
|
10814
|
+
type: "text",
|
|
10815
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10816
|
+
value: selectedField.nameGeneratorSuffix ?? "",
|
|
10817
|
+
placeholder: "e.g. IND",
|
|
10818
|
+
oninput: (e) => formStore.getState().updateField(selectedField.id, { nameGeneratorSuffix: e.target.value })
|
|
10819
|
+
}));
|
|
10820
|
+
body.appendChild(suffixGroup);
|
|
10821
|
+
const paddingGroup2 = createElement("div", { className: "mb-3" });
|
|
10822
|
+
paddingGroup2.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "ID Padding" }));
|
|
10823
|
+
paddingGroup2.appendChild(createElement("input", {
|
|
10824
|
+
type: "number",
|
|
10825
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10826
|
+
value: String(selectedField.nameGeneratorIdPadding ?? 4),
|
|
10827
|
+
placeholder: "4",
|
|
10828
|
+
min: "1",
|
|
10829
|
+
max: "10",
|
|
10830
|
+
oninput: (e) => {
|
|
10831
|
+
const val = parseInt(e.target.value, 10);
|
|
10832
|
+
formStore.getState().updateField(selectedField.id, { nameGeneratorIdPadding: isNaN(val) ? 4 : Math.max(1, Math.min(10, val)) });
|
|
10833
|
+
}
|
|
10834
|
+
}));
|
|
10835
|
+
body.appendChild(paddingGroup2);
|
|
10836
|
+
}
|
|
10568
10837
|
if (selectedField.type === "binary_choice") {
|
|
10569
10838
|
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
10839
|
body.appendChild(bcHeader);
|
|
@@ -10853,8 +11122,14 @@ var FormBuilder = class {
|
|
|
10853
11122
|
this.render();
|
|
10854
11123
|
}
|
|
10855
11124
|
});
|
|
10856
|
-
|
|
10857
|
-
|
|
11125
|
+
const currentLookupSourceType = selectedField.lookupSourceType || "MODULE";
|
|
11126
|
+
LOOKUP_SOURCE_TYPE_OPTIONS.forEach((opt) => {
|
|
11127
|
+
lookupSourceTypeSelect.appendChild(createElement("option", {
|
|
11128
|
+
value: opt.value,
|
|
11129
|
+
text: opt.label,
|
|
11130
|
+
selected: currentLookupSourceType === opt.value
|
|
11131
|
+
}));
|
|
11132
|
+
});
|
|
10858
11133
|
lookupSourceTypeGroup.appendChild(lookupSourceTypeSelect);
|
|
10859
11134
|
body.appendChild(lookupSourceTypeGroup);
|
|
10860
11135
|
if (selectedField.lookupSourceType === "MODULE") {
|
|
@@ -10893,6 +11168,42 @@ var FormBuilder = class {
|
|
|
10893
11168
|
});
|
|
10894
11169
|
lookupSourceGroup.appendChild(lookupSourceSelect);
|
|
10895
11170
|
body.appendChild(lookupSourceGroup);
|
|
11171
|
+
} else if (selectedField.lookupSourceType === "SETTINGS") {
|
|
11172
|
+
const settingsEntities = this.options.settingsEntities || [];
|
|
11173
|
+
const lookupSourceGroup = createElement("div", { className: "mb-4" });
|
|
11174
|
+
lookupSourceGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Source Key" }));
|
|
11175
|
+
const lookupSourceSelect = createElement("select", {
|
|
11176
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
11177
|
+
value: selectedField.lookupSource || "",
|
|
11178
|
+
onchange: (e) => {
|
|
11179
|
+
const lookupSource = e.target.value;
|
|
11180
|
+
formStore.getState().updateField(selectedField.id, { lookupSource: lookupSource || void 0 });
|
|
11181
|
+
if (lookupSource) {
|
|
11182
|
+
formStore.getState().updateField(selectedField.id, {
|
|
11183
|
+
lookupValueField: void 0,
|
|
11184
|
+
lookupLabelField: void 0
|
|
11185
|
+
});
|
|
11186
|
+
}
|
|
11187
|
+
if (this.options.onLookupSourceChange && lookupSource) {
|
|
11188
|
+
this.options.onLookupSourceChange({
|
|
11189
|
+
fieldId: selectedField.id,
|
|
11190
|
+
lookupSourceType: "SETTINGS",
|
|
11191
|
+
lookupSource
|
|
11192
|
+
});
|
|
11193
|
+
}
|
|
11194
|
+
this.render();
|
|
11195
|
+
}
|
|
11196
|
+
});
|
|
11197
|
+
lookupSourceSelect.appendChild(createElement("option", { value: "", text: "Select Settings Entity", selected: !selectedField.lookupSource }));
|
|
11198
|
+
settingsEntities.forEach((ent) => {
|
|
11199
|
+
lookupSourceSelect.appendChild(createElement("option", {
|
|
11200
|
+
value: ent.value,
|
|
11201
|
+
text: ent.label,
|
|
11202
|
+
selected: selectedField.lookupSource === ent.value
|
|
11203
|
+
}));
|
|
11204
|
+
});
|
|
11205
|
+
lookupSourceGroup.appendChild(lookupSourceSelect);
|
|
11206
|
+
body.appendChild(lookupSourceGroup);
|
|
10896
11207
|
} else if (selectedField.lookupSourceType === "MASTER_TYPE") {
|
|
10897
11208
|
const masterTypes = formStore.getState().masterTypes;
|
|
10898
11209
|
const activeMasterTypes = masterTypes.filter((mt) => mt.active === true);
|
|
@@ -10982,6 +11293,27 @@ var FormBuilder = class {
|
|
|
10982
11293
|
}
|
|
10983
11294
|
lookupLabelFieldGroup.appendChild(lookupLabelFieldSelect);
|
|
10984
11295
|
body.appendChild(lookupLabelFieldGroup);
|
|
11296
|
+
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 }));
|
|
11297
|
+
const parentFieldGroup = createElement("div", { className: "mb-4" });
|
|
11298
|
+
parentFieldGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Filter by Parent Field" }));
|
|
11299
|
+
const parentFieldSelect = createElement("select", {
|
|
11300
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
11301
|
+
value: selectedField.lookupParentFieldName || "",
|
|
11302
|
+
onchange: (e) => {
|
|
11303
|
+
const val = e.target.value;
|
|
11304
|
+
formStore.getState().updateField(selectedField.id, { lookupParentFieldName: val || null });
|
|
11305
|
+
}
|
|
11306
|
+
});
|
|
11307
|
+
parentFieldSelect.appendChild(createElement("option", { value: "", text: "None (no parent)", selected: !selectedField.lookupParentFieldName }));
|
|
11308
|
+
parentFieldOptions.forEach((opt) => {
|
|
11309
|
+
parentFieldSelect.appendChild(createElement("option", {
|
|
11310
|
+
value: opt.value,
|
|
11311
|
+
text: opt.label,
|
|
11312
|
+
selected: selectedField.lookupParentFieldName === opt.value
|
|
11313
|
+
}));
|
|
11314
|
+
});
|
|
11315
|
+
parentFieldGroup.appendChild(parentFieldSelect);
|
|
11316
|
+
body.appendChild(parentFieldGroup);
|
|
10985
11317
|
body.appendChild(this.createCheckboxField(
|
|
10986
11318
|
"Visibility",
|
|
10987
11319
|
selectedField.visible !== false,
|
|
@@ -11488,7 +11820,7 @@ var FormBuilder = class {
|
|
|
11488
11820
|
}
|
|
11489
11821
|
updateValidations({
|
|
11490
11822
|
pattern: val || void 0,
|
|
11491
|
-
customErrorMessages: { ...validationsObj.customErrorMessages, pattern: currentPreset?.errorMessage || regexMessage
|
|
11823
|
+
customErrorMessages: { ...validationsObj.customErrorMessages, pattern: currentPreset?.errorMessage || regexMessage }
|
|
11492
11824
|
});
|
|
11493
11825
|
if (examplesList) {
|
|
11494
11826
|
if (currentPreset) {
|
|
@@ -11988,7 +12320,7 @@ var initFormBuilder = (options) => {
|
|
|
11988
12320
|
|
|
11989
12321
|
sortablejs/modular/sortable.esm.js:
|
|
11990
12322
|
(**!
|
|
11991
|
-
* Sortable 1.15.
|
|
12323
|
+
* Sortable 1.15.7
|
|
11992
12324
|
* @author RubaXa <trash@rubaxa.org>
|
|
11993
12325
|
* @author owenm <owen23355@gmail.com>
|
|
11994
12326
|
* @license MIT
|
|
@@ -11998,12 +12330,14 @@ sortablejs/modular/sortable.esm.js:
|
|
|
11998
12330
|
exports.FormBuilder = FormBuilder;
|
|
11999
12331
|
exports.FormRenderer = FormRenderer;
|
|
12000
12332
|
exports.FormSchemaValidation = FormSchemaValidation;
|
|
12333
|
+
exports.LOOKUP_SOURCE_TYPE_OPTIONS = LOOKUP_SOURCE_TYPE_OPTIONS;
|
|
12001
12334
|
exports.builderToPlatform = builderToPlatform;
|
|
12002
12335
|
exports.cleanFormSchema = cleanFormSchema;
|
|
12003
12336
|
exports.convertValidationObjectToArray = convertValidationObjectToArray;
|
|
12004
12337
|
exports.detectCircularDependency = detectCircularDependency;
|
|
12005
12338
|
exports.evaluateFormula = evaluateFormula;
|
|
12006
12339
|
exports.formStore = formStore;
|
|
12340
|
+
exports.generateName = generateName;
|
|
12007
12341
|
exports.getColSpanFromWidth = getColSpanFromWidth;
|
|
12008
12342
|
exports.getNumericFieldsForFormula = getNumericFieldsForFormula;
|
|
12009
12343
|
exports.getValidationConfigForAngular = getValidationConfigForAngular;
|
|
@@ -12011,6 +12345,7 @@ exports.initFormBuilder = initFormBuilder;
|
|
|
12011
12345
|
exports.parseFormulaDependencies = parseFormulaDependencies;
|
|
12012
12346
|
exports.parseWidth = parseWidth;
|
|
12013
12347
|
exports.platformToBuilder = platformToBuilder;
|
|
12348
|
+
exports.resetNameGeneratorCounter = resetNameGeneratorCounter;
|
|
12014
12349
|
exports.validateFormula = validateFormula;
|
|
12015
12350
|
//# sourceMappingURL=out.js.map
|
|
12016
12351
|
//# sourceMappingURL=index.js.map
|