@bindu-dashing/dam-solution-v2 5.8.172 → 5.8.173
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.
|
@@ -147,6 +147,13 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
147
147
|
const defaultName = currentInputType === null || currentInputType === void 0 ? void 0 : currentInputType.defaultName;
|
|
148
148
|
const options = ((_a = formValues.options) === null || _a === void 0 ? void 0 : _a.filter((opt) => (opt === null || opt === void 0 ? void 0 : opt.label) && (opt === null || opt === void 0 ? void 0 : opt.value))) || [];
|
|
149
149
|
const settings = formValues.inputTypeSettings || {};
|
|
150
|
+
// For SELECT/RADIO/CHECKBOX fields, only show Default Value when options exist
|
|
151
|
+
const isOptionsBasedField = includes([InputTypes.SELECT, InputTypes.CHECKBOX, InputTypes.RADIO], defaultName);
|
|
152
|
+
if (isOptionsBasedField && options.length === 0) {
|
|
153
|
+
// Don't show Default Value field if no options exist
|
|
154
|
+
setDefaultValueInput(null);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
150
157
|
// Use a specific placeholder for default value input, or fallback to field placeholder
|
|
151
158
|
const defaultValuePlaceholder = "Enter default value";
|
|
152
159
|
const item = {
|
|
@@ -230,16 +237,6 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
230
237
|
// Pass rules to getFormItem
|
|
231
238
|
const defaultValueItem = getFormItem(Object.assign(Object.assign({}, item), { additionalRules: rules }), true);
|
|
232
239
|
setDefaultValueInput(defaultValueItem);
|
|
233
|
-
// Check form validity after values change
|
|
234
|
-
setTimeout(() => {
|
|
235
|
-
const errors = form.getFieldsError();
|
|
236
|
-
const touchedFields = form.isFieldsTouched(['name', 'placeholder'], true);
|
|
237
|
-
const hasErrors = errors.some((error) => error.errors && error.errors.length > 0);
|
|
238
|
-
const values = form.getFieldsValue();
|
|
239
|
-
const nameFilled = !!(values.name && typeof values.name === 'string' && values.name.trim() !== '');
|
|
240
|
-
const placeholderFilled = !!(values.placeholder && typeof values.placeholder === 'string' && values.placeholder.trim() !== '');
|
|
241
|
-
setIsFormValid(Boolean(!!touchedFields && nameFilled && placeholderFilled && !hasErrors));
|
|
242
|
-
}, 0);
|
|
243
240
|
};
|
|
244
241
|
return (_jsxs("div", { className: "md-lib-p-4", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx("h2", { className: "md-lib-text-xl md-lib-font-semibold", children: "Properties" }), _jsxs("p", { className: "md-lib-ml-auto md-lib-text-sm md-lib-truncate", style: { color: styles === null || styles === void 0 ? void 0 : styles.secondaryTextColor }, children: ["Type: ", get(field, "name", "N/A")] })] }), _jsx("div", { className: "md-lib-mt-4 md-lib-relative", children: _jsxs(Form, { layout: "vertical", form: form, requiredMark: true, scrollToFirstError: true, onFinish: onUpdate, initialValues: field, onValuesChange: handleFormValuesChange, className: "md-lib-pb-20", children: [_jsx(Form.Item, { name: "isMandatory", valuePropName: "checked", children: _jsx(Checkbox, { children: "Marks as mandatory field" }) }), _jsx(Form.Item, { name: "name", label: "Field Name", rules: [
|
|
245
242
|
{ required: true, message: "Name is required" },
|
|
@@ -257,7 +254,7 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
257
254
|
required: true,
|
|
258
255
|
message: "Placeholder is required",
|
|
259
256
|
},
|
|
260
|
-
], children: _jsx(Input, { placeholder: "Enter Field Placeholder", className: "md-lib-h-12" }) }), defaultValueInput, _jsxs("div", { children: [!!get(currentInputType, "supportedTypes.length") && (_jsx("h3", { className: "md-lib-text-md md-lib-font-semibold md-lib-mb-2", children: "Field Validations" })), _jsxs(Form.Item, { name: "field_validations", children: [includes([InputTypes.PARAGRAPH, InputTypes.TEXT, InputTypes.LINK], get(currentInputType, "defaultName")) && (_jsx(TextField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), get(currentInputType, "defaultName") == InputTypes.NUMBERS && (_jsx(NumberField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), (get(currentInputType, "defaultName") == InputTypes.DATE ||
|
|
257
|
+
], children: _jsx(Input, { placeholder: "Enter Field Placeholder", className: "md-lib-h-12" }) }), defaultValueInput && defaultValueInput, _jsxs("div", { children: [!!get(currentInputType, "supportedTypes.length") && (_jsx("h3", { className: "md-lib-text-md md-lib-font-semibold md-lib-mb-2", children: "Field Validations" })), _jsxs(Form.Item, { name: "field_validations", children: [includes([InputTypes.PARAGRAPH, InputTypes.TEXT, InputTypes.LINK], get(currentInputType, "defaultName")) && (_jsx(TextField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), get(currentInputType, "defaultName") == InputTypes.NUMBERS && (_jsx(NumberField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), (get(currentInputType, "defaultName") == InputTypes.DATE ||
|
|
261
258
|
get(currentInputType, "defaultName") ==
|
|
262
259
|
InputTypes.DATE_RANGE) && (_jsx(DateField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), includes([
|
|
263
260
|
InputTypes.SELECT,
|
|
@@ -20,7 +20,7 @@ export declare const REMOVE_OK_TEXT = "Yes, Remove";
|
|
|
20
20
|
export declare const ARCHIVE_OK_TEXT = "Yes, Archive";
|
|
21
21
|
export declare const DELETE_OK_TEXT = "Yes, Delete";
|
|
22
22
|
export declare const DEACTIVATE_OK_TEXT = "Yes, Deactivate";
|
|
23
|
-
export declare const DELETE_CONFIRMATION_MESSAGE = ":action :entity?";
|
|
23
|
+
export declare const DELETE_CONFIRMATION_MESSAGE = "Are you sure want to :action :entity?";
|
|
24
24
|
export declare const DELETE_MESSAGE_DESCRIPTION = "Are you sure you want to delete.";
|
|
25
25
|
export declare const CREATE_SUCCESS = "Created Successfully";
|
|
26
26
|
export declare const DELETE_SUCCESS = "Deleted Successfully";
|
|
@@ -20,7 +20,7 @@ export const REMOVE_OK_TEXT = "Yes, Remove";
|
|
|
20
20
|
export const ARCHIVE_OK_TEXT = "Yes, Archive";
|
|
21
21
|
export const DELETE_OK_TEXT = "Yes, Delete";
|
|
22
22
|
export const DEACTIVATE_OK_TEXT = "Yes, Deactivate";
|
|
23
|
-
export const DELETE_CONFIRMATION_MESSAGE = ":action :entity?";
|
|
23
|
+
export const DELETE_CONFIRMATION_MESSAGE = "Are you sure want to :action :entity?";
|
|
24
24
|
export const DELETE_MESSAGE_DESCRIPTION = "Are you sure you want to delete.";
|
|
25
25
|
export const CREATE_SUCCESS = "Created Successfully";
|
|
26
26
|
export const DELETE_SUCCESS = "Deleted Successfully";
|