web-mojo 2.1.377 → 2.1.379
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/admin.cjs.js +1 -1
- package/dist/admin.es.js +10 -10
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.cjs.js.map +1 -1
- package/dist/auth.es.js +3 -3
- package/dist/auth.es.js.map +1 -1
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +2 -2
- package/dist/chunks/{ContextMenu-D2tBgZ0e.js → ContextMenu-jd9XHorC.js} +2 -2
- package/dist/chunks/{ContextMenu-D2tBgZ0e.js.map → ContextMenu-jd9XHorC.js.map} +1 -1
- package/dist/chunks/{ContextMenu-BWnqzYVd.js → ContextMenu-jer972eJ.js} +2 -2
- package/dist/chunks/{ContextMenu-BWnqzYVd.js.map → ContextMenu-jer972eJ.js.map} +1 -1
- package/dist/chunks/{DataView-CW3BsyCC.js → DataView-CN_p0YbE.js} +2 -2
- package/dist/chunks/{DataView-CW3BsyCC.js.map → DataView-CN_p0YbE.js.map} +1 -1
- package/dist/chunks/{DataView-CzkzVfVN.js → DataView-ChNpDhxW.js} +2 -2
- package/dist/chunks/{DataView-CzkzVfVN.js.map → DataView-ChNpDhxW.js.map} +1 -1
- package/dist/chunks/{Dialog-CJnRsIRI.js → Dialog-CkRozcqm.js} +2 -2
- package/dist/chunks/{Dialog-CJnRsIRI.js.map → Dialog-CkRozcqm.js.map} +1 -1
- package/dist/chunks/{Dialog-LGRqcq9L.js → Dialog-CqUJLhaj.js} +5 -5
- package/dist/chunks/{Dialog-LGRqcq9L.js.map → Dialog-CqUJLhaj.js.map} +1 -1
- package/dist/chunks/{FilePreviewView-D566wPDs.js → FilePreviewView-BxSfHgVu.js} +2 -2
- package/dist/chunks/{FilePreviewView-D566wPDs.js.map → FilePreviewView-BxSfHgVu.js.map} +1 -1
- package/dist/chunks/{FilePreviewView-D_Vxhbgh.js → FilePreviewView-C6E1UpLP.js} +6 -6
- package/dist/chunks/{FilePreviewView-D_Vxhbgh.js.map → FilePreviewView-C6E1UpLP.js.map} +1 -1
- package/dist/chunks/{FormView-m5tw5nNB.js → FormView-BxSIJ_E_.js} +54 -54
- package/dist/chunks/FormView-BxSIJ_E_.js.map +1 -0
- package/dist/chunks/FormView-Cp1Dx-wN.js +2 -0
- package/dist/chunks/FormView-Cp1Dx-wN.js.map +1 -0
- package/dist/chunks/{MetricsChart-Dv1FjVHY.js → MetricsChart-CCUd_4rl.js} +2 -2
- package/dist/chunks/{MetricsChart-Dv1FjVHY.js.map → MetricsChart-CCUd_4rl.js.map} +1 -1
- package/dist/chunks/{MetricsChart-DAsnnfJU.js → MetricsChart-fbYECZor.js} +3 -3
- package/dist/chunks/{MetricsChart-DAsnnfJU.js.map → MetricsChart-fbYECZor.js.map} +1 -1
- package/dist/chunks/{PDFViewer-t0RM_1eX.js → PDFViewer-BlVqUSUu.js} +2 -2
- package/dist/chunks/{PDFViewer-t0RM_1eX.js.map → PDFViewer-BlVqUSUu.js.map} +1 -1
- package/dist/chunks/{PDFViewer-mJGc4Jhu.js → PDFViewer-BqLwEA9I.js} +3 -3
- package/dist/chunks/{PDFViewer-mJGc4Jhu.js.map → PDFViewer-BqLwEA9I.js.map} +1 -1
- package/dist/chunks/{Page-Bs2o-GSU.js → Page-CZQtHgzc.js} +2 -2
- package/dist/chunks/{Page-Bs2o-GSU.js.map → Page-CZQtHgzc.js.map} +1 -1
- package/dist/chunks/{Page-Ds6akb5s.js → Page-D2MLDNoL.js} +2 -2
- package/dist/chunks/{Page-Ds6akb5s.js.map → Page-D2MLDNoL.js.map} +1 -1
- package/dist/chunks/{TopNav-COdpl44u.js → TopNav-CfdhPogz.js} +2 -2
- package/dist/chunks/{TopNav-COdpl44u.js.map → TopNav-CfdhPogz.js.map} +1 -1
- package/dist/chunks/{TopNav-Ck5XOp7S.js → TopNav-De_0Ljqr.js} +2 -2
- package/dist/chunks/{TopNav-Ck5XOp7S.js.map → TopNav-De_0Ljqr.js.map} +1 -1
- package/dist/chunks/{WebApp-BHqYQKaY.js → WebApp-DGEbMf2Q.js} +12 -12
- package/dist/chunks/{WebApp-BHqYQKaY.js.map → WebApp-DGEbMf2Q.js.map} +1 -1
- package/dist/chunks/{WebApp-B3IFukwD.js → WebApp-DN8DgOwI.js} +2 -2
- package/dist/chunks/{WebApp-B3IFukwD.js.map → WebApp-DN8DgOwI.js.map} +1 -1
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.es.js +5 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +11 -11
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/FormView-DJqs63UC.js +0 -2
- package/dist/chunks/FormView-DJqs63UC.js.map +0 -1
- package/dist/chunks/FormView-m5tw5nNB.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-
|
|
1
|
+
import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-DGEbMf2Q.js";
|
|
2
2
|
class FormBuilder {
|
|
3
3
|
constructor(config = {}) {
|
|
4
4
|
this.fields = config.fields || [];
|
|
@@ -54,7 +54,7 @@ class FormBuilder {
|
|
|
54
54
|
class="{{inputClass}}{{#error}} is-invalid{{/error}}"
|
|
55
55
|
value="{{fieldValue}}" {{#placeholder}}placeholder="{{placeholder}}"{{/placeholder}}
|
|
56
56
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
57
|
-
{{#readonly}}readonly{{/readonly}}
|
|
57
|
+
{{#readonly}}readonly{{/readonly}} {{{attrs}}}>
|
|
58
58
|
{{#help}}<div class="{{helpClass}}">{{help}}</div>{{/help}}
|
|
59
59
|
{{#error}}<div class="{{errorClass}}">{{error}}</div>{{/error}}
|
|
60
60
|
</div>
|
|
@@ -71,7 +71,7 @@ class FormBuilder {
|
|
|
71
71
|
class="{{inputClass}}{{#error}} is-invalid{{/error}}"
|
|
72
72
|
value="{{fieldValue}}" {{#placeholder}}placeholder="{{placeholder}}"{{/placeholder}}
|
|
73
73
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
74
|
-
{{#readonly}}readonly{{/readonly}}
|
|
74
|
+
{{#readonly}}readonly{{/readonly}}
|
|
75
75
|
data-field-type="password" {{{attrs}}}>
|
|
76
76
|
{{#showToggle}}
|
|
77
77
|
<button type="button" class="btn btn-outline-secondary"
|
|
@@ -111,7 +111,7 @@ class FormBuilder {
|
|
|
111
111
|
<textarea id="{{fieldId}}" name="{{name}}" class="{{inputClass}}{{#error}} is-invalid{{/error}}"
|
|
112
112
|
rows="{{rows}}" {{#placeholder}}placeholder="{{placeholder}}"{{/placeholder}}
|
|
113
113
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
114
|
-
{{#readonly}}readonly{{/readonly}}
|
|
114
|
+
{{#readonly}}readonly{{/readonly}} {{{attrs}}}>{{fieldValue}}</textarea>
|
|
115
115
|
{{#help}}<div class="{{helpClass}}">{{help}}</div>{{/help}}
|
|
116
116
|
{{#error}}<div class="{{errorClass}}">{{error}}</div>{{/error}}
|
|
117
117
|
</div>
|
|
@@ -126,7 +126,7 @@ class FormBuilder {
|
|
|
126
126
|
{{#searchInput}}{{{searchInput}}}{{/searchInput}}
|
|
127
127
|
<select id="{{fieldId}}" name="{{name}}" class="{{inputClass}}{{#error}} is-invalid{{/error}}"
|
|
128
128
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
129
|
-
{{#multiple}}multiple{{/multiple}}
|
|
129
|
+
{{#multiple}}multiple{{/multiple}} {{{attrs}}}>
|
|
130
130
|
{{{optionsHTML}}}
|
|
131
131
|
</select>
|
|
132
132
|
{{#help}}<div class="{{helpClass}}">{{help}}</div>{{/help}}
|
|
@@ -139,7 +139,7 @@ class FormBuilder {
|
|
|
139
139
|
<input type="checkbox" id="{{fieldId}}" name="{{name}}"
|
|
140
140
|
class="form-check-input{{#error}} is-invalid{{/error}}" value="{{value}}"
|
|
141
141
|
{{#checked}}checked{{/checked}} {{#required}}required{{/required}}
|
|
142
|
-
{{#disabled}}disabled{{/disabled}}
|
|
142
|
+
{{#disabled}}disabled{{/disabled}} {{{attrs}}}>
|
|
143
143
|
<label class="form-check-label" for="{{fieldId}}">{{label}}</label>
|
|
144
144
|
</div>
|
|
145
145
|
{{#help}}<div class="{{helpClass}}">{{help}}</div>{{/help}}
|
|
@@ -231,7 +231,7 @@ class FormBuilder {
|
|
|
231
231
|
<input type="radio" id="{{fieldId}}_{{value}}" name="{{name}}" value="{{value}}"
|
|
232
232
|
class="form-check-input{{#error}} is-invalid{{/error}}" {{#checked}}checked{{/checked}}
|
|
233
233
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
234
|
-
|
|
234
|
+
{{{attrs}}}>
|
|
235
235
|
<label class="form-check-label" for="{{fieldId}}_{{value}}">{{text}}</label>
|
|
236
236
|
</div>
|
|
237
237
|
{{/options}}
|
|
@@ -324,7 +324,7 @@ class FormBuilder {
|
|
|
324
324
|
class="{{inputClass}}{{#error}} is-invalid{{/error}}"
|
|
325
325
|
value="{{fieldValue}}"
|
|
326
326
|
{{#required}}required{{/required}} {{#disabled}}disabled{{/disabled}}
|
|
327
|
-
{{#readonly}}readonly{{/readonly}}
|
|
327
|
+
{{#readonly}}readonly{{/readonly}} {{{attrs}}}>
|
|
328
328
|
<button type="button" class="btn-sm text-muted border-0 bg-transparent p-1"
|
|
329
329
|
data-action="clear-color" data-field="{{name}}"
|
|
330
330
|
title="Clear color">
|
|
@@ -1141,7 +1141,7 @@ class FormBuilder {
|
|
|
1141
1141
|
value="${this.escapeHtml(radioValue)}"
|
|
1142
1142
|
${checked}
|
|
1143
1143
|
${disabled ? "disabled" : ""}
|
|
1144
|
-
|
|
1144
|
+
|
|
1145
1145
|
${attrs}
|
|
1146
1146
|
>
|
|
1147
1147
|
<label class="form-check-label" for="${radioId}">
|
|
@@ -1588,7 +1588,7 @@ class FormBuilder {
|
|
|
1588
1588
|
placeholder="${this.escapeHtml(placeholder)}"
|
|
1589
1589
|
${disabled ? "disabled" : ""}
|
|
1590
1590
|
${readonly ? "readonly" : ""}
|
|
1591
|
-
|
|
1591
|
+
|
|
1592
1592
|
<input type="hidden" name="${name}" value="${this.escapeHtml(fieldValue)}">
|
|
1593
1593
|
<small class="form-text text-muted">This will be enhanced with TagInput component</small>
|
|
1594
1594
|
</div>
|
|
@@ -1648,7 +1648,7 @@ class FormBuilder {
|
|
|
1648
1648
|
placeholder="${this.escapeHtml(placeholder)}"
|
|
1649
1649
|
${disabled ? "disabled" : ""}
|
|
1650
1650
|
${readonly ? "readonly" : ""}
|
|
1651
|
-
|
|
1651
|
+
|
|
1652
1652
|
<input type="hidden" name="${name}" value="${this.escapeHtml(fieldValue)}">
|
|
1653
1653
|
<small class="form-text text-muted">This will be enhanced with CollectionSelect component</small>
|
|
1654
1654
|
</div>
|
|
@@ -1709,7 +1709,7 @@ class FormBuilder {
|
|
|
1709
1709
|
${disabled ? "disabled" : ""}
|
|
1710
1710
|
${readonly ? "readonly" : ""}
|
|
1711
1711
|
${required ? "required" : ""}
|
|
1712
|
-
|
|
1712
|
+
|
|
1713
1713
|
<small class="form-text text-muted">This will be enhanced with Easepick DatePicker</small>
|
|
1714
1714
|
</div>
|
|
1715
1715
|
${help ? `<div class="${this.options.helpClass}">${this.escapeHtml(help)}</div>` : ""}
|
|
@@ -1786,7 +1786,7 @@ class FormBuilder {
|
|
|
1786
1786
|
${disabled ? "disabled" : ""}
|
|
1787
1787
|
${readonly ? "readonly" : ""}
|
|
1788
1788
|
${required ? "required" : ""}
|
|
1789
|
-
|
|
1789
|
+
|
|
1790
1790
|
</div>
|
|
1791
1791
|
<div class="col-auto d-flex align-items-center">
|
|
1792
1792
|
<span class="text-muted">${this.escapeHtml(separator.trim())}</span>
|
|
@@ -1803,7 +1803,7 @@ class FormBuilder {
|
|
|
1803
1803
|
${disabled ? "disabled" : ""}
|
|
1804
1804
|
${readonly ? "readonly" : ""}
|
|
1805
1805
|
${required ? "required" : ""}
|
|
1806
|
-
|
|
1806
|
+
|
|
1807
1807
|
</div>
|
|
1808
1808
|
</div>
|
|
1809
1809
|
<small class="form-text text-muted">This will be enhanced with Easepick DateRangePicker</small>
|
|
@@ -4240,6 +4240,7 @@ class FormView extends View {
|
|
|
4240
4240
|
this.data = this.prepareFormData();
|
|
4241
4241
|
this.populateFormValues();
|
|
4242
4242
|
this.initializeFormComponents();
|
|
4243
|
+
this.initializeChangeHandlers();
|
|
4243
4244
|
}
|
|
4244
4245
|
/**
|
|
4245
4246
|
* Populate all form fields with current data values
|
|
@@ -4307,10 +4308,41 @@ class FormView extends View {
|
|
|
4307
4308
|
this.initializeDateRangePickers();
|
|
4308
4309
|
const componentContainers = this.element.querySelectorAll("[data-component]");
|
|
4309
4310
|
componentContainers.forEach((container) => {
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4311
|
+
container.getAttribute("data-component");
|
|
4312
|
+
container.getAttribute("data-field");
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
/**
|
|
4316
|
+
* Initialize generic change handlers for all form inputs
|
|
4317
|
+
*/
|
|
4318
|
+
initializeChangeHandlers() {
|
|
4319
|
+
if (!this.element) return;
|
|
4320
|
+
const inputs = this.element.querySelectorAll("input:not([data-action]), select:not([data-action]), textarea:not([data-action])");
|
|
4321
|
+
inputs.forEach((input) => {
|
|
4322
|
+
if (input.hasAttribute("data-component") || input.classList.contains("form-check-input")) {
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
input.addEventListener("change", (event) => {
|
|
4326
|
+
const fieldName = input.name;
|
|
4327
|
+
if (fieldName) {
|
|
4328
|
+
let value = input.value;
|
|
4329
|
+
if (input.type === "checkbox") {
|
|
4330
|
+
value = input.checked;
|
|
4331
|
+
} else if (input.type === "radio") {
|
|
4332
|
+
if (!input.checked) return;
|
|
4333
|
+
} else if (input.multiple && input.selectedOptions) {
|
|
4334
|
+
value = Array.from(input.selectedOptions).map((opt) => opt.value);
|
|
4335
|
+
}
|
|
4336
|
+
this.handleFieldChange(fieldName, value);
|
|
4337
|
+
}
|
|
4338
|
+
});
|
|
4339
|
+
if (input.type === "text" || input.type === "email" || input.type === "url" || input.tagName === "TEXTAREA") {
|
|
4340
|
+
input.addEventListener("input", (event) => {
|
|
4341
|
+
const fieldName = input.name;
|
|
4342
|
+
if (fieldName) {
|
|
4343
|
+
this.handleFieldChange(fieldName, input.value);
|
|
4344
|
+
}
|
|
4345
|
+
});
|
|
4314
4346
|
}
|
|
4315
4347
|
});
|
|
4316
4348
|
}
|
|
@@ -4335,7 +4367,6 @@ class FormView extends View {
|
|
|
4335
4367
|
this.handleFieldChange(fieldName, data.value);
|
|
4336
4368
|
});
|
|
4337
4369
|
} catch (error) {
|
|
4338
|
-
console.error("Failed to initialize TagInput:", error);
|
|
4339
4370
|
}
|
|
4340
4371
|
});
|
|
4341
4372
|
}
|
|
@@ -4351,7 +4382,6 @@ class FormView extends View {
|
|
|
4351
4382
|
const config = JSON.parse(configData);
|
|
4352
4383
|
const fieldConfig = this.getFormFieldConfig(fieldName);
|
|
4353
4384
|
if (!fieldConfig || !fieldConfig.Collection) {
|
|
4354
|
-
console.warn(`CollectionSelect field ${fieldName} missing Collection class`);
|
|
4355
4385
|
return;
|
|
4356
4386
|
}
|
|
4357
4387
|
const collection = new fieldConfig.Collection();
|
|
@@ -4370,7 +4400,6 @@ class FormView extends View {
|
|
|
4370
4400
|
this.handleFieldChange(fieldName, data.value);
|
|
4371
4401
|
});
|
|
4372
4402
|
} catch (error) {
|
|
4373
|
-
console.error("Failed to initialize CollectionSelect:", error);
|
|
4374
4403
|
}
|
|
4375
4404
|
});
|
|
4376
4405
|
}
|
|
@@ -4395,7 +4424,6 @@ class FormView extends View {
|
|
|
4395
4424
|
this.handleFieldChange(fieldName, data.value);
|
|
4396
4425
|
});
|
|
4397
4426
|
} catch (error) {
|
|
4398
|
-
console.error("Failed to initialize DatePicker:", error);
|
|
4399
4427
|
}
|
|
4400
4428
|
});
|
|
4401
4429
|
}
|
|
@@ -4420,7 +4448,6 @@ class FormView extends View {
|
|
|
4420
4448
|
this.handleFieldChange(fieldName, data.combined);
|
|
4421
4449
|
});
|
|
4422
4450
|
} catch (error) {
|
|
4423
|
-
console.error("Failed to initialize DateRangePicker:", error);
|
|
4424
4451
|
}
|
|
4425
4452
|
});
|
|
4426
4453
|
}
|
|
@@ -4461,7 +4488,6 @@ class FormView extends View {
|
|
|
4461
4488
|
}
|
|
4462
4489
|
statusManager.showStatus("saved");
|
|
4463
4490
|
} catch (error) {
|
|
4464
|
-
console.error("Field save error:", error);
|
|
4465
4491
|
statusManager.showStatus("error", { message: error.message });
|
|
4466
4492
|
} finally {
|
|
4467
4493
|
this.isSaving = false;
|
|
@@ -4495,7 +4521,7 @@ class FormView extends View {
|
|
|
4495
4521
|
}
|
|
4496
4522
|
}
|
|
4497
4523
|
/**
|
|
4498
|
-
* Get reason why a field is considered changed
|
|
4524
|
+
* Get reason why a field is considered changed
|
|
4499
4525
|
* @param {*} newValue - New value from form
|
|
4500
4526
|
* @param {*} originalValue - Original value from model
|
|
4501
4527
|
* @returns {string} Reason for change
|
|
@@ -4722,7 +4748,6 @@ class FormView extends View {
|
|
|
4722
4748
|
try {
|
|
4723
4749
|
const ImageCropView = window.MOJO?.plugins?.ImageCropView;
|
|
4724
4750
|
if (!ImageCropView) {
|
|
4725
|
-
console.warn("ImageCropView not available. Load lightbox extension for image cropping.");
|
|
4726
4751
|
return;
|
|
4727
4752
|
}
|
|
4728
4753
|
const result = await ImageCropView.showDialog(previewUrl, {
|
|
@@ -4755,7 +4780,6 @@ class FormView extends View {
|
|
|
4755
4780
|
element.value = "";
|
|
4756
4781
|
}
|
|
4757
4782
|
} catch (error) {
|
|
4758
|
-
console.error("Error during image cropping:", error);
|
|
4759
4783
|
this.data[fieldName] = file;
|
|
4760
4784
|
await this.updateImagePreview(fieldName, previewUrl);
|
|
4761
4785
|
this.emit("image:selected", {
|
|
@@ -4876,7 +4900,6 @@ class FormView extends View {
|
|
|
4876
4900
|
* Handle file drop errors
|
|
4877
4901
|
*/
|
|
4878
4902
|
async onFileDropError(error, event, files) {
|
|
4879
|
-
console.error("File drop error:", error.message);
|
|
4880
4903
|
this.showError(`File upload error: ${error.message}`);
|
|
4881
4904
|
this.emit("file:error", {
|
|
4882
4905
|
error,
|
|
@@ -4949,7 +4972,6 @@ class FormView extends View {
|
|
|
4949
4972
|
try {
|
|
4950
4973
|
data[textarea.name] = JSON.parse(textarea.value);
|
|
4951
4974
|
} catch (e) {
|
|
4952
|
-
console.warn(`Invalid JSON in field ${textarea.name}:`, textarea.value);
|
|
4953
4975
|
data[textarea.name] = textarea.value;
|
|
4954
4976
|
}
|
|
4955
4977
|
});
|
|
@@ -4958,7 +4980,6 @@ class FormView extends View {
|
|
|
4958
4980
|
try {
|
|
4959
4981
|
data[key] = await this.fileToBase64(value);
|
|
4960
4982
|
} catch (error) {
|
|
4961
|
-
console.error(`Failed to convert file ${key} to base64:`, error);
|
|
4962
4983
|
data[key] = null;
|
|
4963
4984
|
}
|
|
4964
4985
|
} else if (value instanceof FileList) {
|
|
@@ -4967,7 +4988,6 @@ class FormView extends View {
|
|
|
4967
4988
|
try {
|
|
4968
4989
|
base64Files.push(await this.fileToBase64(value[i]));
|
|
4969
4990
|
} catch (error) {
|
|
4970
|
-
console.error(`Failed to convert file ${key}[${i}] to base64:`, error);
|
|
4971
4991
|
base64Files.push(null);
|
|
4972
4992
|
}
|
|
4973
4993
|
}
|
|
@@ -5135,7 +5155,6 @@ class FormView extends View {
|
|
|
5135
5155
|
return formData;
|
|
5136
5156
|
}
|
|
5137
5157
|
} catch (error) {
|
|
5138
|
-
console.error("Form submission error:", error);
|
|
5139
5158
|
return {
|
|
5140
5159
|
success: false,
|
|
5141
5160
|
error: error.message || "An error occurred while submitting the form"
|
|
@@ -5155,22 +5174,17 @@ class FormView extends View {
|
|
|
5155
5174
|
if (!formData) formData = await this.getFormData();
|
|
5156
5175
|
const changes = this.getChangedData(formData);
|
|
5157
5176
|
if (!changes || Object.keys(changes).length === 0) {
|
|
5158
|
-
console.log("No changes detected, skipping save");
|
|
5159
5177
|
return {
|
|
5160
5178
|
success: true,
|
|
5161
5179
|
message: "No changes to save",
|
|
5162
5180
|
data: formData
|
|
5163
5181
|
};
|
|
5164
5182
|
}
|
|
5165
|
-
console.log("Saving changed data via model:", changes);
|
|
5166
|
-
console.log("Data type:", changes instanceof FormData ? "FormData (multipart)" : "Object (JSON/base64)");
|
|
5167
5183
|
try {
|
|
5168
5184
|
this._isFormDrivenChange = true;
|
|
5169
5185
|
const result = await this.model.save(changes);
|
|
5170
|
-
console.log("Model save result:", result);
|
|
5171
5186
|
return result;
|
|
5172
5187
|
} catch (error) {
|
|
5173
|
-
console.error("Model save error:", error);
|
|
5174
5188
|
throw error;
|
|
5175
5189
|
}
|
|
5176
5190
|
}
|
|
@@ -5182,19 +5196,12 @@ class FormView extends View {
|
|
|
5182
5196
|
getChangedData(currentData) {
|
|
5183
5197
|
if (!this.model) return currentData;
|
|
5184
5198
|
const originalData = this.getOriginalModelData();
|
|
5185
|
-
console.log("=== Change Detection ===");
|
|
5186
|
-
console.log("Original model data:", originalData);
|
|
5187
|
-
console.log("Current form data:", currentData instanceof FormData ? "[FormData object]" : currentData);
|
|
5188
5199
|
let changes;
|
|
5189
5200
|
if (currentData instanceof FormData) {
|
|
5190
|
-
console.log("Comparing FormData...");
|
|
5191
5201
|
changes = this.getChangedFormData(currentData, originalData);
|
|
5192
5202
|
} else {
|
|
5193
|
-
console.log("Comparing Object data...");
|
|
5194
5203
|
changes = this.getChangedObjectData(currentData, originalData);
|
|
5195
5204
|
}
|
|
5196
|
-
console.log("Changes detected:", changes instanceof FormData ? "[FormData with changes]" : changes);
|
|
5197
|
-
console.log("=== End Change Detection ===");
|
|
5198
5205
|
return changes;
|
|
5199
5206
|
}
|
|
5200
5207
|
/**
|
|
@@ -5221,21 +5228,16 @@ class FormView extends View {
|
|
|
5221
5228
|
let hasChanges = false;
|
|
5222
5229
|
for (const [key, value] of currentData.entries()) {
|
|
5223
5230
|
if (value instanceof File) {
|
|
5224
|
-
if (value.size === 0 || value.name === "" || value.name === "blob")
|
|
5225
|
-
|
|
5226
|
-
} else {
|
|
5227
|
-
console.log(` - ${key}: File upload detected (${value.name}, ${value.size} bytes)`);
|
|
5231
|
+
if (value.size === 0 || value.name === "" || value.name === "blob") ;
|
|
5232
|
+
else {
|
|
5228
5233
|
changedData.set(key, value);
|
|
5229
5234
|
hasChanges = true;
|
|
5230
5235
|
}
|
|
5231
5236
|
} else {
|
|
5232
5237
|
const originalValue = originalData[key];
|
|
5233
5238
|
if (value !== originalValue && value !== String(originalValue)) {
|
|
5234
|
-
console.log(` - ${key}: "${originalValue}" → "${value}"`);
|
|
5235
5239
|
changedData.set(key, value);
|
|
5236
5240
|
hasChanges = true;
|
|
5237
|
-
} else {
|
|
5238
|
-
console.log(` - ${key}: unchanged ("${value}")`);
|
|
5239
5241
|
}
|
|
5240
5242
|
}
|
|
5241
5243
|
}
|
|
@@ -5385,7 +5387,6 @@ class FormView extends View {
|
|
|
5385
5387
|
* Show error message
|
|
5386
5388
|
*/
|
|
5387
5389
|
showError(message) {
|
|
5388
|
-
console.error("Form error:", message);
|
|
5389
5390
|
this.emit("error", { message, form: this });
|
|
5390
5391
|
if (this.element) {
|
|
5391
5392
|
const existingAlerts = this.element.querySelectorAll(".alert");
|
|
@@ -5421,7 +5422,6 @@ class FormView extends View {
|
|
|
5421
5422
|
async updateImagePreview(fieldName, imageUrl) {
|
|
5422
5423
|
const dropZone = this.element.querySelector(`[data-field="${fieldName}"].image-drop-zone`);
|
|
5423
5424
|
if (!dropZone) {
|
|
5424
|
-
console.warn(`Could not find drop zone for field: ${fieldName}`);
|
|
5425
5425
|
return;
|
|
5426
5426
|
}
|
|
5427
5427
|
let preview = dropZone.querySelector("img");
|
|
@@ -5931,4 +5931,4 @@ export {
|
|
|
5931
5931
|
applyFileDropMixin as a,
|
|
5932
5932
|
FormView$1 as b
|
|
5933
5933
|
};
|
|
5934
|
-
//# sourceMappingURL=FormView-
|
|
5934
|
+
//# sourceMappingURL=FormView-BxSIJ_E_.js.map
|