web-mojo 2.1.378 → 2.1.380

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.
Files changed (57) hide show
  1. package/dist/admin.cjs.js +1 -1
  2. package/dist/admin.es.js +10 -10
  3. package/dist/auth.cjs.js +1 -1
  4. package/dist/auth.cjs.js.map +1 -1
  5. package/dist/auth.es.js +3 -3
  6. package/dist/auth.es.js.map +1 -1
  7. package/dist/charts.cjs.js +1 -1
  8. package/dist/charts.es.js +2 -2
  9. package/dist/chunks/{ContextMenu-n23iaLzc.js → ContextMenu-BPJJR6l6.js} +2 -2
  10. package/dist/chunks/{ContextMenu-n23iaLzc.js.map → ContextMenu-BPJJR6l6.js.map} +1 -1
  11. package/dist/chunks/{ContextMenu-BxE_1Qd8.js → ContextMenu-YwW7txyQ.js} +2 -2
  12. package/dist/chunks/{ContextMenu-BxE_1Qd8.js.map → ContextMenu-YwW7txyQ.js.map} +1 -1
  13. package/dist/chunks/{DataView-B6yHMLUg.js → DataView-ED8X_cvp.js} +2 -2
  14. package/dist/chunks/{DataView-B6yHMLUg.js.map → DataView-ED8X_cvp.js.map} +1 -1
  15. package/dist/chunks/{DataView-CzwNX--7.js → DataView-ryKnMcUa.js} +2 -2
  16. package/dist/chunks/{DataView-CzwNX--7.js.map → DataView-ryKnMcUa.js.map} +1 -1
  17. package/dist/chunks/{Dialog-NZpWuQ43.js → Dialog-DmEPwI5D.js} +5 -5
  18. package/dist/chunks/{Dialog-NZpWuQ43.js.map → Dialog-DmEPwI5D.js.map} +1 -1
  19. package/dist/chunks/{Dialog-Ddgmt0gO.js → Dialog-hiboYc1m.js} +2 -2
  20. package/dist/chunks/{Dialog-Ddgmt0gO.js.map → Dialog-hiboYc1m.js.map} +1 -1
  21. package/dist/chunks/{FilePreviewView-BM219euF.js → FilePreviewView-C3beZ-UX.js} +2 -2
  22. package/dist/chunks/{FilePreviewView-BM219euF.js.map → FilePreviewView-C3beZ-UX.js.map} +1 -1
  23. package/dist/chunks/{FilePreviewView-Cl3yIYXj.js → FilePreviewView-D39a1bWs.js} +6 -6
  24. package/dist/chunks/{FilePreviewView-Cl3yIYXj.js.map → FilePreviewView-D39a1bWs.js.map} +1 -1
  25. package/dist/chunks/{FormView-B1ldH_5V.js → FormView-CCrutTVr.js} +43 -41
  26. package/dist/chunks/FormView-CCrutTVr.js.map +1 -0
  27. package/dist/chunks/{FormView-CZVfn24F.js → FormView-wKzv7Fey.js} +2 -2
  28. package/dist/chunks/FormView-wKzv7Fey.js.map +1 -0
  29. package/dist/chunks/{MetricsChart-CONguG4G.js → MetricsChart-B7yBoTzr.js} +2 -2
  30. package/dist/chunks/{MetricsChart-CONguG4G.js.map → MetricsChart-B7yBoTzr.js.map} +1 -1
  31. package/dist/chunks/{MetricsChart-DNEz5MOj.js → MetricsChart-D9j0JkfY.js} +3 -3
  32. package/dist/chunks/{MetricsChart-DNEz5MOj.js.map → MetricsChart-D9j0JkfY.js.map} +1 -1
  33. package/dist/chunks/{PDFViewer-BcGM_abb.js → PDFViewer--7dBYfiB.js} +2 -2
  34. package/dist/chunks/{PDFViewer-BcGM_abb.js.map → PDFViewer--7dBYfiB.js.map} +1 -1
  35. package/dist/chunks/{PDFViewer-BPVjeOWK.js → PDFViewer-BPFrZSlU.js} +3 -3
  36. package/dist/chunks/{PDFViewer-BPVjeOWK.js.map → PDFViewer-BPFrZSlU.js.map} +1 -1
  37. package/dist/chunks/{Page-CHOQIJni.js → Page-D2Yq8RbO.js} +2 -2
  38. package/dist/chunks/{Page-CHOQIJni.js.map → Page-D2Yq8RbO.js.map} +1 -1
  39. package/dist/chunks/{Page-DUi1d14L.js → Page-DY5i-6Wq.js} +2 -2
  40. package/dist/chunks/{Page-DUi1d14L.js.map → Page-DY5i-6Wq.js.map} +1 -1
  41. package/dist/chunks/{TopNav-Dbv_5N1P.js → TopNav-BN3TAAxN.js} +2 -2
  42. package/dist/chunks/{TopNav-Dbv_5N1P.js.map → TopNav-BN3TAAxN.js.map} +1 -1
  43. package/dist/chunks/{TopNav-CWoyhg7a.js → TopNav-BzKZzgE6.js} +2 -2
  44. package/dist/chunks/{TopNav-CWoyhg7a.js.map → TopNav-BzKZzgE6.js.map} +1 -1
  45. package/dist/chunks/{WebApp-DkvQsYEF.js → WebApp-Czng9Krl.js} +2 -2
  46. package/dist/chunks/{WebApp-DkvQsYEF.js.map → WebApp-Czng9Krl.js.map} +1 -1
  47. package/dist/chunks/{WebApp-CUL8EXgl.js → WebApp-p0nOftj0.js} +12 -12
  48. package/dist/chunks/{WebApp-CUL8EXgl.js.map → WebApp-p0nOftj0.js.map} +1 -1
  49. package/dist/docit.cjs.js +1 -1
  50. package/dist/docit.es.js +5 -5
  51. package/dist/index.cjs.js +1 -1
  52. package/dist/index.es.js +11 -11
  53. package/dist/lightbox.cjs.js +1 -1
  54. package/dist/lightbox.es.js +4 -4
  55. package/package.json +1 -1
  56. package/dist/chunks/FormView-B1ldH_5V.js.map +0 -1
  57. package/dist/chunks/FormView-CZVfn24F.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-CUL8EXgl.js";
1
+ import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-p0nOftj0.js";
2
2
  class FormBuilder {
3
3
  constructor(config = {}) {
4
4
  this.fields = config.fields || [];
@@ -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,43 @@ class FormView extends View {
4307
4308
  this.initializeDateRangePickers();
4308
4309
  const componentContainers = this.element.querySelectorAll("[data-component]");
4309
4310
  componentContainers.forEach((container) => {
4310
- const componentType = container.getAttribute("data-component");
4311
- const fieldName = container.getAttribute("data-field");
4312
- if (componentType && fieldName) {
4313
- console.log(`Found ${componentType} component for field: ${fieldName}`);
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
+ if (this._isFormDrivenChange) return;
4327
+ const fieldName = input.name;
4328
+ if (fieldName) {
4329
+ let value = input.value;
4330
+ if (input.type === "checkbox") {
4331
+ value = input.checked;
4332
+ } else if (input.type === "radio") {
4333
+ if (!input.checked) return;
4334
+ } else if (input.multiple && input.selectedOptions) {
4335
+ value = Array.from(input.selectedOptions).map((opt) => opt.value);
4336
+ }
4337
+ this.handleFieldChange(fieldName, value);
4338
+ }
4339
+ });
4340
+ if (input.type === "text" || input.type === "email" || input.type === "url" || input.tagName === "TEXTAREA") {
4341
+ input.addEventListener("input", (event) => {
4342
+ if (this._isFormDrivenChange) return;
4343
+ const fieldName = input.name;
4344
+ if (fieldName) {
4345
+ this.handleFieldChange(fieldName, input.value);
4346
+ }
4347
+ });
4314
4348
  }
4315
4349
  });
4316
4350
  }
@@ -4335,7 +4369,6 @@ class FormView extends View {
4335
4369
  this.handleFieldChange(fieldName, data.value);
4336
4370
  });
4337
4371
  } catch (error) {
4338
- console.error("Failed to initialize TagInput:", error);
4339
4372
  }
4340
4373
  });
4341
4374
  }
@@ -4351,7 +4384,6 @@ class FormView extends View {
4351
4384
  const config = JSON.parse(configData);
4352
4385
  const fieldConfig = this.getFormFieldConfig(fieldName);
4353
4386
  if (!fieldConfig || !fieldConfig.Collection) {
4354
- console.warn(`CollectionSelect field ${fieldName} missing Collection class`);
4355
4387
  return;
4356
4388
  }
4357
4389
  const collection = new fieldConfig.Collection();
@@ -4370,7 +4402,6 @@ class FormView extends View {
4370
4402
  this.handleFieldChange(fieldName, data.value);
4371
4403
  });
4372
4404
  } catch (error) {
4373
- console.error("Failed to initialize CollectionSelect:", error);
4374
4405
  }
4375
4406
  });
4376
4407
  }
@@ -4395,7 +4426,6 @@ class FormView extends View {
4395
4426
  this.handleFieldChange(fieldName, data.value);
4396
4427
  });
4397
4428
  } catch (error) {
4398
- console.error("Failed to initialize DatePicker:", error);
4399
4429
  }
4400
4430
  });
4401
4431
  }
@@ -4420,7 +4450,6 @@ class FormView extends View {
4420
4450
  this.handleFieldChange(fieldName, data.combined);
4421
4451
  });
4422
4452
  } catch (error) {
4423
- console.error("Failed to initialize DateRangePicker:", error);
4424
4453
  }
4425
4454
  });
4426
4455
  }
@@ -4461,7 +4490,6 @@ class FormView extends View {
4461
4490
  }
4462
4491
  statusManager.showStatus("saved");
4463
4492
  } catch (error) {
4464
- console.error("Field save error:", error);
4465
4493
  statusManager.showStatus("error", { message: error.message });
4466
4494
  } finally {
4467
4495
  this.isSaving = false;
@@ -4495,7 +4523,7 @@ class FormView extends View {
4495
4523
  }
4496
4524
  }
4497
4525
  /**
4498
- * Get reason why a field is considered changed (for debugging)
4526
+ * Get reason why a field is considered changed
4499
4527
  * @param {*} newValue - New value from form
4500
4528
  * @param {*} originalValue - Original value from model
4501
4529
  * @returns {string} Reason for change
@@ -4722,7 +4750,6 @@ class FormView extends View {
4722
4750
  try {
4723
4751
  const ImageCropView = window.MOJO?.plugins?.ImageCropView;
4724
4752
  if (!ImageCropView) {
4725
- console.warn("ImageCropView not available. Load lightbox extension for image cropping.");
4726
4753
  return;
4727
4754
  }
4728
4755
  const result = await ImageCropView.showDialog(previewUrl, {
@@ -4755,7 +4782,6 @@ class FormView extends View {
4755
4782
  element.value = "";
4756
4783
  }
4757
4784
  } catch (error) {
4758
- console.error("Error during image cropping:", error);
4759
4785
  this.data[fieldName] = file;
4760
4786
  await this.updateImagePreview(fieldName, previewUrl);
4761
4787
  this.emit("image:selected", {
@@ -4876,7 +4902,6 @@ class FormView extends View {
4876
4902
  * Handle file drop errors
4877
4903
  */
4878
4904
  async onFileDropError(error, event, files) {
4879
- console.error("File drop error:", error.message);
4880
4905
  this.showError(`File upload error: ${error.message}`);
4881
4906
  this.emit("file:error", {
4882
4907
  error,
@@ -4949,7 +4974,6 @@ class FormView extends View {
4949
4974
  try {
4950
4975
  data[textarea.name] = JSON.parse(textarea.value);
4951
4976
  } catch (e) {
4952
- console.warn(`Invalid JSON in field ${textarea.name}:`, textarea.value);
4953
4977
  data[textarea.name] = textarea.value;
4954
4978
  }
4955
4979
  });
@@ -4958,7 +4982,6 @@ class FormView extends View {
4958
4982
  try {
4959
4983
  data[key] = await this.fileToBase64(value);
4960
4984
  } catch (error) {
4961
- console.error(`Failed to convert file ${key} to base64:`, error);
4962
4985
  data[key] = null;
4963
4986
  }
4964
4987
  } else if (value instanceof FileList) {
@@ -4967,7 +4990,6 @@ class FormView extends View {
4967
4990
  try {
4968
4991
  base64Files.push(await this.fileToBase64(value[i]));
4969
4992
  } catch (error) {
4970
- console.error(`Failed to convert file ${key}[${i}] to base64:`, error);
4971
4993
  base64Files.push(null);
4972
4994
  }
4973
4995
  }
@@ -5135,7 +5157,6 @@ class FormView extends View {
5135
5157
  return formData;
5136
5158
  }
5137
5159
  } catch (error) {
5138
- console.error("Form submission error:", error);
5139
5160
  return {
5140
5161
  success: false,
5141
5162
  error: error.message || "An error occurred while submitting the form"
@@ -5155,22 +5176,17 @@ class FormView extends View {
5155
5176
  if (!formData) formData = await this.getFormData();
5156
5177
  const changes = this.getChangedData(formData);
5157
5178
  if (!changes || Object.keys(changes).length === 0) {
5158
- console.log("No changes detected, skipping save");
5159
5179
  return {
5160
5180
  success: true,
5161
5181
  message: "No changes to save",
5162
5182
  data: formData
5163
5183
  };
5164
5184
  }
5165
- console.log("Saving changed data via model:", changes);
5166
- console.log("Data type:", changes instanceof FormData ? "FormData (multipart)" : "Object (JSON/base64)");
5167
5185
  try {
5168
5186
  this._isFormDrivenChange = true;
5169
5187
  const result = await this.model.save(changes);
5170
- console.log("Model save result:", result);
5171
5188
  return result;
5172
5189
  } catch (error) {
5173
- console.error("Model save error:", error);
5174
5190
  throw error;
5175
5191
  }
5176
5192
  }
@@ -5182,19 +5198,12 @@ class FormView extends View {
5182
5198
  getChangedData(currentData) {
5183
5199
  if (!this.model) return currentData;
5184
5200
  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
5201
  let changes;
5189
5202
  if (currentData instanceof FormData) {
5190
- console.log("Comparing FormData...");
5191
5203
  changes = this.getChangedFormData(currentData, originalData);
5192
5204
  } else {
5193
- console.log("Comparing Object data...");
5194
5205
  changes = this.getChangedObjectData(currentData, originalData);
5195
5206
  }
5196
- console.log("Changes detected:", changes instanceof FormData ? "[FormData with changes]" : changes);
5197
- console.log("=== End Change Detection ===");
5198
5207
  return changes;
5199
5208
  }
5200
5209
  /**
@@ -5221,21 +5230,16 @@ class FormView extends View {
5221
5230
  let hasChanges = false;
5222
5231
  for (const [key, value] of currentData.entries()) {
5223
5232
  if (value instanceof File) {
5224
- if (value.size === 0 || value.name === "" || value.name === "blob") {
5225
- console.log(` - ${key}: Empty file field (no change)`);
5226
- } else {
5227
- console.log(` - ${key}: File upload detected (${value.name}, ${value.size} bytes)`);
5233
+ if (value.size === 0 || value.name === "" || value.name === "blob") ;
5234
+ else {
5228
5235
  changedData.set(key, value);
5229
5236
  hasChanges = true;
5230
5237
  }
5231
5238
  } else {
5232
5239
  const originalValue = originalData[key];
5233
5240
  if (value !== originalValue && value !== String(originalValue)) {
5234
- console.log(` - ${key}: "${originalValue}" → "${value}"`);
5235
5241
  changedData.set(key, value);
5236
5242
  hasChanges = true;
5237
- } else {
5238
- console.log(` - ${key}: unchanged ("${value}")`);
5239
5243
  }
5240
5244
  }
5241
5245
  }
@@ -5385,7 +5389,6 @@ class FormView extends View {
5385
5389
  * Show error message
5386
5390
  */
5387
5391
  showError(message) {
5388
- console.error("Form error:", message);
5389
5392
  this.emit("error", { message, form: this });
5390
5393
  if (this.element) {
5391
5394
  const existingAlerts = this.element.querySelectorAll(".alert");
@@ -5421,7 +5424,6 @@ class FormView extends View {
5421
5424
  async updateImagePreview(fieldName, imageUrl) {
5422
5425
  const dropZone = this.element.querySelector(`[data-field="${fieldName}"].image-drop-zone`);
5423
5426
  if (!dropZone) {
5424
- console.warn(`Could not find drop zone for field: ${fieldName}`);
5425
5427
  return;
5426
5428
  }
5427
5429
  let preview = dropZone.querySelector("img");
@@ -5931,4 +5933,4 @@ export {
5931
5933
  applyFileDropMixin as a,
5932
5934
  FormView$1 as b
5933
5935
  };
5934
- //# sourceMappingURL=FormView-B1ldH_5V.js.map
5936
+ //# sourceMappingURL=FormView-CCrutTVr.js.map