web-mojo 2.1.1092 → 2.1.1094

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 (51) hide show
  1. package/dist/admin.cjs.js +1 -1
  2. package/dist/admin.es.js +8 -8
  3. package/dist/auth.cjs.js +1 -1
  4. package/dist/auth.es.js +1 -1
  5. package/dist/charts.cjs.js +1 -1
  6. package/dist/charts.es.js +3 -3
  7. package/dist/chunks/{ChatView-BD92BdTD.js → ChatView-D_xGFVrZ.js} +4 -4
  8. package/dist/chunks/{ChatView-BD92BdTD.js.map → ChatView-D_xGFVrZ.js.map} +1 -1
  9. package/dist/chunks/{ChatView-DaqmHVfd.js → ChatView-DaAzO4fN.js} +2 -2
  10. package/dist/chunks/{ChatView-DaqmHVfd.js.map → ChatView-DaAzO4fN.js.map} +1 -1
  11. package/dist/chunks/{ContextMenu-DG-2yxqU.js → ContextMenu-CLRRrCUp.js} +33 -19
  12. package/dist/chunks/ContextMenu-CLRRrCUp.js.map +1 -0
  13. package/dist/chunks/ContextMenu-DWau8gXS.js +3 -0
  14. package/dist/chunks/ContextMenu-DWau8gXS.js.map +1 -0
  15. package/dist/chunks/{Dialog-DvSrCOj1.js → Dialog-B7Sr0SnN.js} +3 -3
  16. package/dist/chunks/{Dialog-DvSrCOj1.js.map → Dialog-B7Sr0SnN.js.map} +1 -1
  17. package/dist/chunks/{Dialog-zrXDKGkH.js → Dialog-CTQabcag.js} +2 -2
  18. package/dist/chunks/{Dialog-zrXDKGkH.js.map → Dialog-CTQabcag.js.map} +1 -1
  19. package/dist/chunks/{FormView-DGRmcKUG.js → FormView-4TUGCb-w.js} +59 -32
  20. package/dist/chunks/FormView-4TUGCb-w.js.map +1 -0
  21. package/dist/chunks/FormView-D7b279iQ.js +3 -0
  22. package/dist/chunks/FormView-D7b279iQ.js.map +1 -0
  23. package/dist/chunks/{MetricsMiniChartWidget-C9ou095r.js → MetricsMiniChartWidget-DqqNihMU.js} +2 -2
  24. package/dist/chunks/{MetricsMiniChartWidget-C9ou095r.js.map → MetricsMiniChartWidget-DqqNihMU.js.map} +1 -1
  25. package/dist/chunks/{MetricsMiniChartWidget-Z-Iz-gxt.js → MetricsMiniChartWidget-Dro33AOK.js} +2 -2
  26. package/dist/chunks/{MetricsMiniChartWidget-Z-Iz-gxt.js.map → MetricsMiniChartWidget-Dro33AOK.js.map} +1 -1
  27. package/dist/chunks/{PDFViewer-BXcbKJHv.js → PDFViewer-CD2LK6vG.js} +2 -2
  28. package/dist/chunks/{PDFViewer-BXcbKJHv.js.map → PDFViewer-CD2LK6vG.js.map} +1 -1
  29. package/dist/chunks/{PDFViewer-Bq55sL4x.js → PDFViewer-Dijf-xZd.js} +2 -2
  30. package/dist/chunks/{PDFViewer-Bq55sL4x.js.map → PDFViewer-Dijf-xZd.js.map} +1 -1
  31. package/dist/chunks/{TokenManager-D8VO38Nx.js → TokenManager-OY8r8Z8L.js} +2 -2
  32. package/dist/chunks/{TokenManager-D8VO38Nx.js.map → TokenManager-OY8r8Z8L.js.map} +1 -1
  33. package/dist/chunks/{TokenManager-BYVQWApC.js → TokenManager-Wocv3-Vf.js} +4 -4
  34. package/dist/chunks/{TokenManager-BYVQWApC.js.map → TokenManager-Wocv3-Vf.js.map} +1 -1
  35. package/dist/chunks/{version-UVRFlgA9.js → version-C06qSDNM.js} +2 -2
  36. package/dist/chunks/{version-UVRFlgA9.js.map → version-C06qSDNM.js.map} +1 -1
  37. package/dist/chunks/{version-BJh2uAwA.js → version-oiThQIqq.js} +4 -4
  38. package/dist/chunks/{version-BJh2uAwA.js.map → version-oiThQIqq.js.map} +1 -1
  39. package/dist/docit.cjs.js +1 -1
  40. package/dist/docit.es.js +4 -4
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.es.js +9 -9
  43. package/dist/lightbox.cjs.js +1 -1
  44. package/dist/lightbox.es.js +4 -4
  45. package/package.json +1 -1
  46. package/dist/chunks/ContextMenu-CfMAB33c.js +0 -3
  47. package/dist/chunks/ContextMenu-CfMAB33c.js.map +0 -1
  48. package/dist/chunks/ContextMenu-DG-2yxqU.js.map +0 -1
  49. package/dist/chunks/FormView-DGRmcKUG.js.map +0 -1
  50. package/dist/chunks/FormView-KGvr68ju.js +0 -3
  51. package/dist/chunks/FormView-KGvr68ju.js.map +0 -1
@@ -784,6 +784,9 @@ class FormBuilder {
784
784
  * @returns {string} Unique field ID
785
785
  */
786
786
  getFieldId(name) {
787
+ if (!name) {
788
+ return `field_${Math.random().toString(36).substr(2, 9)}`;
789
+ }
787
790
  const safeName = name.replace(/[.\s\[\]]/g, "_");
788
791
  return `field_${safeName}`;
789
792
  }
@@ -2229,7 +2232,7 @@ class FormBuilder {
2229
2232
  * Supports multiple generation modes:
2230
2233
  * - Numeric ranges: start, end, step
2231
2234
  * - Formatting: format function, prefix, suffix
2232
- *
2235
+ *
2233
2236
  * @param {number} start - Start value (inclusive)
2234
2237
  * @param {number} end - End value (inclusive)
2235
2238
  * @param {number} step - Step increment (default: 1)
@@ -2238,27 +2241,27 @@ class FormBuilder {
2238
2241
  * @param {string} options.prefix - Prefix for label
2239
2242
  * @param {string} options.suffix - Suffix for label
2240
2243
  * @returns {Array} Array of option objects {value, label}
2241
- *
2244
+ *
2242
2245
  * @example
2243
2246
  * // Hours 1-24
2244
2247
  * generateSelectOptions(1, 24, 1)
2245
- *
2248
+ *
2246
2249
  * // Minutes in 15-min increments with padding
2247
2250
  * generateSelectOptions(0, 45, 15, { format: 'padded' })
2248
- *
2251
+ *
2249
2252
  * // Days with ordinal suffix
2250
2253
  * generateSelectOptions(1, 31, 1, { format: 'ordinal' })
2251
- *
2254
+ *
2252
2255
  * // Years with prefix
2253
2256
  * generateSelectOptions(2020, 2030, 1, { prefix: 'Year ' })
2254
- *
2257
+ *
2255
2258
  * // Percentages
2256
2259
  * generateSelectOptions(0, 100, 10, { suffix: '%' })
2257
- *
2260
+ *
2258
2261
  * // Custom formatter
2259
- * generateSelectOptions(1, 12, 1, {
2260
- * format: (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2261
- * 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][v-1]
2262
+ * generateSelectOptions(1, 12, 1, {
2263
+ * format: (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2264
+ * 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][v-1]
2262
2265
  * })
2263
2266
  */
2264
2267
  generateSelectOptions(start, end, step = 1, options = {}) {
@@ -5752,6 +5755,8 @@ class FormView extends View {
5752
5755
  this.customComponents = /* @__PURE__ */ new Map();
5753
5756
  this.fieldStatusManagers = /* @__PURE__ */ new Map();
5754
5757
  this.saveTimeouts = /* @__PURE__ */ new Map();
5758
+ this.pendingSaveFields = /* @__PURE__ */ new Map();
5759
+ this.batchSaveTimeout = null;
5755
5760
  this.isSaving = false;
5756
5761
  this.data = this.prepareFormData();
5757
5762
  this.formConfig = formConfig || { fields: fields || [] };
@@ -6169,35 +6174,57 @@ class FormView extends View {
6169
6174
  FormPlugins.onFieldChange?.(this, fieldName, value);
6170
6175
  }
6171
6176
  /**
6172
- * Handle saving individual field changes to the model with debouncing
6177
+ * Handle saving field changes to the model with intelligent batching
6178
+ * When multiple fields change within a short time (e.g., autofill), they are batched together
6173
6179
  * @param {string} fieldName - Name of the field being saved
6174
6180
  * @param {*} value - New value to save
6175
6181
  */
6176
6182
  async handleFieldSave(fieldName, value) {
6177
- if (!this.model || this.isSaving) return;
6178
- if (this.saveTimeouts.has(fieldName)) {
6179
- clearTimeout(this.saveTimeouts.get(fieldName));
6180
- }
6183
+ if (!this.model) return;
6184
+ this.pendingSaveFields.set(fieldName, value);
6181
6185
  const statusManager = this.getFieldStatusManager(fieldName);
6182
6186
  statusManager.showStatus("saving");
6183
- const timeoutId = setTimeout(async () => {
6184
- try {
6185
- this.isSaving = true;
6186
- this.saveTimeouts.delete(fieldName);
6187
- this._isFormDrivenChange = true;
6188
- if (typeof this.model.save === "function") {
6189
- await this.model.save({ [fieldName]: value });
6190
- } else {
6191
- this.model.set(fieldName, value);
6192
- }
6187
+ if (this.batchSaveTimeout) {
6188
+ clearTimeout(this.batchSaveTimeout);
6189
+ }
6190
+ this.batchSaveTimeout = setTimeout(async () => {
6191
+ await this.executeBatchSave();
6192
+ }, 300);
6193
+ }
6194
+ /**
6195
+ * Execute a batch save of all pending field changes
6196
+ * This sends all changed fields in a single request to avoid race conditions
6197
+ * @private
6198
+ */
6199
+ async executeBatchSave() {
6200
+ if (this.isSaving || this.pendingSaveFields.size === 0) return;
6201
+ try {
6202
+ this.isSaving = true;
6203
+ const changes = Object.fromEntries(this.pendingSaveFields);
6204
+ const fieldNames = Array.from(this.pendingSaveFields.keys());
6205
+ this.pendingSaveFields.clear();
6206
+ this.batchSaveTimeout = null;
6207
+ this._isFormDrivenChange = true;
6208
+ if (typeof this.model.save === "function") {
6209
+ await this.model.save(changes);
6210
+ } else {
6211
+ Object.entries(changes).forEach(([key, val]) => {
6212
+ this.model.set(key, val);
6213
+ });
6214
+ }
6215
+ fieldNames.forEach((fieldName) => {
6216
+ const statusManager = this.getFieldStatusManager(fieldName);
6193
6217
  statusManager.showStatus("saved");
6194
- } catch (error) {
6218
+ });
6219
+ } catch (error) {
6220
+ console.error("Batch save error:", error);
6221
+ Array.from(this.pendingSaveFields.keys()).forEach((fieldName) => {
6222
+ const statusManager = this.getFieldStatusManager(fieldName);
6195
6223
  statusManager.showStatus("error", { message: error.message });
6196
- } finally {
6197
- this.isSaving = false;
6198
- }
6199
- }, 300);
6200
- this.saveTimeouts.set(fieldName, timeoutId);
6224
+ });
6225
+ } finally {
6226
+ this.isSaving = false;
6227
+ }
6201
6228
  }
6202
6229
  /**
6203
6230
  * Get or create a field status manager for a specific field
@@ -7749,4 +7776,4 @@ export {
7749
7776
  applyFileDropMixin as a,
7750
7777
  FormView$1 as b
7751
7778
  };
7752
- //# sourceMappingURL=FormView-DGRmcKUG.js.map
7779
+ //# sourceMappingURL=FormView-4TUGCb-w.js.map